@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 CHANGED
@@ -5364,17 +5364,22 @@ const createRelationAggregateFactory = (db, tables, cacheCtx, typeNameMapper, fi
5364
5364
  };
5365
5365
  const resolve = async (parent, args, context, info) => {
5366
5366
  try {
5367
- const request = parseAggregateRequest(info, target);
5367
+ const { request, loaderKey } = getOrCreateRequestValue(context, info?.fieldNodes?.[0], `aggregate:${tableName}::${relationName}`, () => {
5368
+ const request = parseAggregateRequest(info, target);
5369
+ return {
5370
+ request,
5371
+ loaderKey: `${tableName}::${relationName}::aggregate::${JSON.stringify({
5372
+ where: args?.where ?? null,
5373
+ deleted: args?.deleted ?? defaultDeleted ?? null,
5374
+ selection: Object.keys(request.selection).sort()
5375
+ })}`
5376
+ };
5377
+ });
5368
5378
  if (!Object.keys(request.selection).length) return {};
5369
5379
  const localValue = parent[localColPropName];
5370
5380
  if (localValue == null) return assembleAggregateRow({}, request, target);
5371
5381
  const whereArg = args?.where;
5372
5382
  const deleted = args?.deleted;
5373
- const loaderKey = `${tableName}::${relationName}::aggregate::${JSON.stringify({
5374
- where: whereArg ?? null,
5375
- deleted: deleted ?? defaultDeleted ?? null,
5376
- selection: Object.keys(request.selection).sort()
5377
- })}`;
5378
5383
  const loader = getOrCreateLoader(context, loaderKey, async (parentIds) => {
5379
5384
  const executor = resolveExecutor(db, context);
5380
5385
  const uniqueIds = [...new Set(parentIds)];