@vantreeseba/drizzle-graphql 11.0.0 → 11.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +11 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5340,17 +5340,22 @@ const createRelationAggregateFactory = (db, tables, cacheCtx, typeNameMapper, fi
|
|
|
5340
5340
|
};
|
|
5341
5341
|
const resolve = async (parent, args, context, info) => {
|
|
5342
5342
|
try {
|
|
5343
|
-
const request =
|
|
5343
|
+
const { request, loaderKey } = getOrCreateRequestValue(context, info?.fieldNodes?.[0], `aggregate:${tableName}::${relationName}`, () => {
|
|
5344
|
+
const request = parseAggregateRequest(info, target);
|
|
5345
|
+
return {
|
|
5346
|
+
request,
|
|
5347
|
+
loaderKey: `${tableName}::${relationName}::aggregate::${JSON.stringify({
|
|
5348
|
+
where: args?.where ?? null,
|
|
5349
|
+
deleted: args?.deleted ?? defaultDeleted ?? null,
|
|
5350
|
+
selection: Object.keys(request.selection).sort()
|
|
5351
|
+
})}`
|
|
5352
|
+
};
|
|
5353
|
+
});
|
|
5344
5354
|
if (!Object.keys(request.selection).length) return {};
|
|
5345
5355
|
const localValue = parent[localColPropName];
|
|
5346
5356
|
if (localValue == null) return assembleAggregateRow({}, request, target);
|
|
5347
5357
|
const whereArg = args?.where;
|
|
5348
5358
|
const deleted = args?.deleted;
|
|
5349
|
-
const loaderKey = `${tableName}::${relationName}::aggregate::${JSON.stringify({
|
|
5350
|
-
where: whereArg ?? null,
|
|
5351
|
-
deleted: deleted ?? defaultDeleted ?? null,
|
|
5352
|
-
selection: Object.keys(request.selection).sort()
|
|
5353
|
-
})}`;
|
|
5354
5359
|
const loader = getOrCreateLoader(context, loaderKey, async (parentIds) => {
|
|
5355
5360
|
const executor = resolveExecutor(db, context);
|
|
5356
5361
|
const uniqueIds = [...new Set(parentIds)];
|