MCPcopy
hub / github.com/cita-777/metapi / shouldWrapObject

Function shouldWrapObject

src/server/db/index.ts:1259–1265  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

1257const wrappedObjects = new WeakMap<object, unknown>();
1258
1259function shouldWrapObject(value: unknown): value is object {
1260 if (!value || typeof value !== 'object') return false;
1261 // Drizzle query builders are thenable objects (QueryPromise) but are not native Promises.
1262 // They still need wrapping so we can provide sqlite-style `.all/.get/.run` shims.
1263 if (value instanceof Promise) return false;
1264 return true;
1265}
1266
1267function wrapQueryLike<T>(value: T): T {
1268 if (!shouldWrapObject(value)) return value;

Callers 2

wrapQueryLikeFunction · 0.85
getFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected