wrap() — drizzle-orm Function Reference
Architecture documentation for the wrap() function in driver.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 8c4a41bf_c14a_8a42_f07e_9d1dd21acbf9["wrap()"] a31a3294_138f_5fe3_66a6_78efb3064274["driver.ts"] 8c4a41bf_c14a_8a42_f07e_9d1dd21acbf9 -->|defined in| a31a3294_138f_5fe3_66a6_78efb3064274 2db4716b_9688_9922_c6ec_1ea6772d014f["$withAuth()"] 2db4716b_9688_9922_c6ec_1ea6772d014f -->|calls| 8c4a41bf_c14a_8a42_f07e_9d1dd21acbf9 style 8c4a41bf_c14a_8a42_f07e_9d1dd21acbf9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-orm/src/neon-http/driver.ts lines 53–78
function wrap<T extends object>(
target: T,
token: Exclude<HTTPQueryOptions<true, true>['authToken'], undefined>,
cb: (target: any, p: string | symbol, res: any) => any,
deep?: boolean,
) {
return new Proxy(target, {
get(target, p) {
const element = target[p as keyof typeof p];
if (typeof element !== 'function' && (typeof element !== 'object' || element === null)) return element;
if (deep) return wrap(element, token, cb);
if (p === 'query') return wrap(element, token, cb, true);
return new Proxy(element as any, {
apply(target, thisArg, argArray) {
const res = target.call(thisArg, ...argArray);
if (typeof res === 'object' && res !== null && 'setToken' in res && typeof res.setToken === 'function') {
res.setToken(token);
}
return cb(target, p, res);
},
});
},
});
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does wrap() do?
wrap() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/neon-http/driver.ts.
Where is wrap() defined?
wrap() is defined in drizzle-orm/src/neon-http/driver.ts at line 53.
What calls wrap()?
wrap() is called by 1 function(s): $withAuth.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free