@vantreeseba/drizzle-graphql 10.0.3 → 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/README.md +15 -1
- package/dist/index.cjs +147 -81
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +147 -81
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3545,6 +3545,7 @@ const generateWriteCount = ({ db, tableName, table, kind, setArgs, filterArgs, f
|
|
|
3545
3545
|
//#endregion
|
|
3546
3546
|
//#region src/util/batch-loader/index.ts
|
|
3547
3547
|
const DRIZZLE_LOADERS_KEY = Symbol("drizzle-graphql-loaders");
|
|
3548
|
+
const DRIZZLE_REQUEST_CACHE_KEY = Symbol("drizzle-graphql-request-cache");
|
|
3548
3549
|
var BatchLoader = class {
|
|
3549
3550
|
batchFn;
|
|
3550
3551
|
batch = [];
|
|
@@ -3588,6 +3589,32 @@ const getOrCreateLoader = (context, key, batchFn) => {
|
|
|
3588
3589
|
if (!loaders.has(key)) loaders.set(key, new BatchLoader(batchFn));
|
|
3589
3590
|
return loaders.get(key);
|
|
3590
3591
|
};
|
|
3592
|
+
/**
|
|
3593
|
+
* Memoizes a value that a resolver derives from its own field — its args and its selection —
|
|
3594
|
+
* for the length of one request. Resolvers run once per parent row, so anything derived only
|
|
3595
|
+
* from the field is otherwise recomputed for every row of a batch.
|
|
3596
|
+
*
|
|
3597
|
+
* The cache lives on the context (weakly keyed by the AST node the value is derived from, so a
|
|
3598
|
+
* document cached across requests never carries values between them) and `key` separates fields
|
|
3599
|
+
* that share a node: one fragment selection can resolve for more than one parent type. Without a
|
|
3600
|
+
* context object there is nowhere request-scoped to cache, so the value is simply computed.
|
|
3601
|
+
*
|
|
3602
|
+
* `compute` must not read the parent row.
|
|
3603
|
+
*/
|
|
3604
|
+
const getOrCreateRequestValue = (context, node, key, compute) => {
|
|
3605
|
+
if (!context || typeof context !== "object" || !node || typeof node !== "object") return compute();
|
|
3606
|
+
if (!context[DRIZZLE_REQUEST_CACHE_KEY]) context[DRIZZLE_REQUEST_CACHE_KEY] = /* @__PURE__ */ new WeakMap();
|
|
3607
|
+
const cache = context[DRIZZLE_REQUEST_CACHE_KEY];
|
|
3608
|
+
let entries = cache.get(node);
|
|
3609
|
+
if (!entries) {
|
|
3610
|
+
entries = /* @__PURE__ */ new Map();
|
|
3611
|
+
cache.set(node, entries);
|
|
3612
|
+
}
|
|
3613
|
+
if (entries.has(key)) return entries.get(key);
|
|
3614
|
+
const value = compute();
|
|
3615
|
+
entries.set(key, value);
|
|
3616
|
+
return value;
|
|
3617
|
+
};
|
|
3591
3618
|
//#endregion
|
|
3592
3619
|
//#region src/util/extensions.ts
|
|
3593
3620
|
/**
|
|
@@ -3805,30 +3832,40 @@ const createRelationResolverFactory = (db, tables, nullOrdering, filterCtx, limi
|
|
|
3805
3832
|
const localValue = parent[localColPropName];
|
|
3806
3833
|
if (localValue == null) return isOne ? null : [];
|
|
3807
3834
|
const { where: whereArg, limit: requestedLimit, offset, after, deleted } = args ?? {};
|
|
3808
|
-
const orderByArg
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
if (
|
|
3815
|
-
|
|
3816
|
-
if (
|
|
3817
|
-
|
|
3818
|
-
if (
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3835
|
+
const { orderByArg, limit, distinct, cursorEntries, cursorValues, loaderKey } = getOrCreateRequestValue(context, info?.fieldNodes?.[0], `relation:${tableName}::${relationName}`, () => {
|
|
3836
|
+
const orderByArg = isOne ? args?.orderBy : withDefaultOrderBy(args ?? {}, targetTableName, policies?.defaultOrderBy).orderBy;
|
|
3837
|
+
const limit = applyLimitPolicy(requestedLimit, limitPolicy, errorCtx);
|
|
3838
|
+
const distinct = (args ?? {}).distinct?.length ? (args ?? {}).distinct : void 0;
|
|
3839
|
+
const cursorSelected = !isOne && !!info && selectsCursorField(info, targetTable);
|
|
3840
|
+
let cursorEntries;
|
|
3841
|
+
if (!isOne && (after != null || cursorSelected)) {
|
|
3842
|
+
if (after != null && distinct) throw drizzleError("'after' cannot be combined with 'distinct'.", { code: "DRIZZLE_INVALID_CURSOR" });
|
|
3843
|
+
if (orderByHasRelationEntry(orderByArg)) {
|
|
3844
|
+
if (after != null) throw drizzleError("'after' cannot be combined with an orderBy that orders through a relation — a related row's value cannot be encoded into a cursor.", { code: "DRIZZLE_INVALID_CURSOR" });
|
|
3845
|
+
} else if (!targetPkNames.length) {
|
|
3846
|
+
if (after != null) throw drizzleError(`Table ${targetTableName} has no primary key, so cursor pagination cannot be used on it.`, { code: "DRIZZLE_INVALID_CURSOR" });
|
|
3847
|
+
} else cursorEntries = cursorOrderingEntries(orderByArg, targetPkNames);
|
|
3848
|
+
}
|
|
3849
|
+
const cursorValues = after != null && cursorEntries ? decodeCursor(after, cursorEntries) : void 0;
|
|
3850
|
+
const argsKey = JSON.stringify({
|
|
3851
|
+
where: whereArg ?? null,
|
|
3852
|
+
orderBy: orderByArg ?? null,
|
|
3853
|
+
limit: limit ?? null,
|
|
3854
|
+
offset: offset ?? null,
|
|
3855
|
+
deleted: deleted ?? defaultDeleted ?? null,
|
|
3856
|
+
after: after ?? null,
|
|
3857
|
+
distinct: distinct ?? null,
|
|
3858
|
+
cursor: cursorEntries ? 1 : 0
|
|
3859
|
+
});
|
|
3860
|
+
return {
|
|
3861
|
+
orderByArg,
|
|
3862
|
+
limit,
|
|
3863
|
+
distinct,
|
|
3864
|
+
cursorEntries,
|
|
3865
|
+
cursorValues,
|
|
3866
|
+
loaderKey: `${tableName}::${relationName}::${argsKey}`
|
|
3867
|
+
};
|
|
3868
|
+
});
|
|
3832
3869
|
return getOrCreateLoader(context, loaderKey, async (parentIds) => {
|
|
3833
3870
|
const executor = resolveExecutor(db, context);
|
|
3834
3871
|
const uniqueIds = [...new Set(parentIds)];
|
|
@@ -3902,20 +3939,24 @@ const computeResolverFieldNames = (tableName, typeNameMapper, prefixes, suffixes
|
|
|
3902
3939
|
const singleFieldName = mapped?.singular ?? uncapitalize(tableName) + suffixes.single;
|
|
3903
3940
|
const aggregateFieldName = `${mapped?.plural ?? uncapitalize(tableName)}Aggregate`;
|
|
3904
3941
|
const groupByFieldName = `${mapped?.plural ?? uncapitalize(tableName)}GroupBy`;
|
|
3905
|
-
const
|
|
3942
|
+
const pluralNoun = mapped ? capitalize(mapped.plural) : capitalize(tableName);
|
|
3943
|
+
const singularNoun = mapped ? capitalize(mapped.singular) : capitalize(tableName);
|
|
3944
|
+
const createArrayFieldName = `${prefixes.insert}${pluralNoun}${suffixes.list}`;
|
|
3906
3945
|
const createSingleFieldName = mapped ? `${prefixes.insert}${capitalize(mapped.singular)}` : `${prefixes.insert}${capitalize(tableName)}${suffixes.single}`;
|
|
3907
3946
|
const upsertPrefix = prefixes.upsert ?? "upsert";
|
|
3908
|
-
const upsertArrayFieldName = `${upsertPrefix}${
|
|
3947
|
+
const upsertArrayFieldName = `${upsertPrefix}${pluralNoun}${suffixes.list}`;
|
|
3909
3948
|
const upsertSingleFieldName = mapped ? `${upsertPrefix}${capitalize(mapped.singular)}` : `${upsertPrefix}${capitalize(tableName)}${suffixes.single}`;
|
|
3910
|
-
const
|
|
3911
|
-
const
|
|
3912
|
-
const
|
|
3913
|
-
const
|
|
3914
|
-
const
|
|
3915
|
-
const
|
|
3916
|
-
const
|
|
3917
|
-
const
|
|
3918
|
-
const
|
|
3949
|
+
const updateBase = `${prefixes.update}${singularNoun}`;
|
|
3950
|
+
const deleteBase = `${prefixes.delete}${singularNoun}`;
|
|
3951
|
+
const restoreBase = `${prefixes.restore ?? "restore"}${singularNoun}`;
|
|
3952
|
+
const updateFieldName = `${updateBase}${suffixes.list}`;
|
|
3953
|
+
const updateManyFieldName = `${prefixes.update}${pluralNoun}Many`;
|
|
3954
|
+
const deleteFieldName = `${deleteBase}${suffixes.list}`;
|
|
3955
|
+
const restoreFieldName = `${restoreBase}${suffixes.list}`;
|
|
3956
|
+
const writeSingleSuffix = suffixes.single === suffixes.list ? "Single" : suffixes.single;
|
|
3957
|
+
const updateSingleFieldName = `${updateBase}${writeSingleSuffix}`;
|
|
3958
|
+
const deleteSingleFieldName = `${deleteBase}${writeSingleSuffix}`;
|
|
3959
|
+
const restoreSingleFieldName = `${restoreBase}${writeSingleSuffix}`;
|
|
3919
3960
|
return {
|
|
3920
3961
|
typeName,
|
|
3921
3962
|
listFieldName,
|
|
@@ -3938,6 +3979,26 @@ const computeResolverFieldNames = (tableName, typeNameMapper, prefixes, suffixes
|
|
|
3938
3979
|
};
|
|
3939
3980
|
};
|
|
3940
3981
|
//#endregion
|
|
3982
|
+
//#region src/util/builders/common/root-fields.ts
|
|
3983
|
+
/**
|
|
3984
|
+
* Registers one generated root field, refusing to overwrite a name already taken.
|
|
3985
|
+
*
|
|
3986
|
+
* A generated name is the table name run through `typeNameMapper`, a prefix and a suffix,
|
|
3987
|
+
* and the pluralization each operation applies — so whether two operations collide is a
|
|
3988
|
+
* property of the finished names, not of any one piece of the config. `buildSchema` checks
|
|
3989
|
+
* what it can up front (identical list and single suffixes with no mapper), but that check
|
|
3990
|
+
* compares the suffix *strings*, which cannot see a collision the rest of the naming rules
|
|
3991
|
+
* produce: `{ list: 'All', single: '' }` used to give both insert mutations the name
|
|
3992
|
+
* `createUsers`, and the array insert simply disappeared from the schema.
|
|
3993
|
+
*
|
|
3994
|
+
* Assigning into the record silently kept the last registration. Throwing here means a
|
|
3995
|
+
* naming config that cannot work says so at build time, naming the field it lost.
|
|
3996
|
+
*/
|
|
3997
|
+
const defineRootField = (fields, kind, name, config) => {
|
|
3998
|
+
if (Object.getOwnPropertyDescriptor(fields, name) !== void 0) throw new Error(`Drizzle-GraphQL Error: two generated ${kind} fields are both named '${name}'. Generated names come from the table name plus config.prefixes, config.suffixes and config.typeNameMapper — some combination of those gives two operations the same name. Adjust one of them so each operation gets its own.`);
|
|
3999
|
+
fields[name] = config;
|
|
4000
|
+
};
|
|
4001
|
+
//#endregion
|
|
3941
4002
|
//#region src/util/builders/common/select-runtime.ts
|
|
3942
4003
|
/**
|
|
3943
4004
|
* Runs the relational-query-builder select shared by every dialect's `generateSelect*`
|
|
@@ -5279,17 +5340,22 @@ const createRelationAggregateFactory = (db, tables, cacheCtx, typeNameMapper, fi
|
|
|
5279
5340
|
};
|
|
5280
5341
|
const resolve = async (parent, args, context, info) => {
|
|
5281
5342
|
try {
|
|
5282
|
-
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
|
+
});
|
|
5283
5354
|
if (!Object.keys(request.selection).length) return {};
|
|
5284
5355
|
const localValue = parent[localColPropName];
|
|
5285
5356
|
if (localValue == null) return assembleAggregateRow({}, request, target);
|
|
5286
5357
|
const whereArg = args?.where;
|
|
5287
5358
|
const deleted = args?.deleted;
|
|
5288
|
-
const loaderKey = `${tableName}::${relationName}::aggregate::${JSON.stringify({
|
|
5289
|
-
where: whereArg ?? null,
|
|
5290
|
-
deleted: deleted ?? defaultDeleted ?? null,
|
|
5291
|
-
selection: Object.keys(request.selection).sort()
|
|
5292
|
-
})}`;
|
|
5293
5359
|
const loader = getOrCreateLoader(context, loaderKey, async (parentIds) => {
|
|
5294
5360
|
const executor = resolveExecutor(db, context);
|
|
5295
5361
|
const uniqueIds = [...new Set(parentIds)];
|
|
@@ -6300,7 +6366,7 @@ const createSchemaBuilder = (adapter) => {
|
|
|
6300
6366
|
const groupByEnum = groupByType ? generateGroupByEnum(table, tableName, typeName, cacheCtx) : void 0;
|
|
6301
6367
|
const havingInput = groupByEnum ? generateHavingInput(table, tableName, typeName, cacheCtx) : void 0;
|
|
6302
6368
|
const groupByGenerated = groupByType && groupByEnum && havingInput ? generateGroupBy(db, tableName, table, typeName, groupByFieldName, tableFilters, groupByEnum, havingInput, filterCtx, tablePolicies, cacheCtx.typeName) : void 0;
|
|
6303
|
-
ctx.queries
|
|
6369
|
+
defineRootField(ctx.queries, "query", selectArrGenerated.name, {
|
|
6304
6370
|
type: selectArrOutput,
|
|
6305
6371
|
args: selectArrGenerated.args,
|
|
6306
6372
|
resolve: selectArrGenerated.resolver,
|
|
@@ -6313,8 +6379,8 @@ const createSchemaBuilder = (adapter) => {
|
|
|
6313
6379
|
}),
|
|
6314
6380
|
...complexity ? { complexity: listFieldComplexity(complexity, limits?.(tableName)) } : {}
|
|
6315
6381
|
}
|
|
6316
|
-
};
|
|
6317
|
-
ctx.queries
|
|
6382
|
+
});
|
|
6383
|
+
defineRootField(ctx.queries, "query", selectSingleGenerated.name, {
|
|
6318
6384
|
type: selectSingleOutput,
|
|
6319
6385
|
args: selectSingleGenerated.args,
|
|
6320
6386
|
resolve: selectSingleGenerated.resolver,
|
|
@@ -6324,8 +6390,8 @@ const createSchemaBuilder = (adapter) => {
|
|
|
6324
6390
|
single: true,
|
|
6325
6391
|
targetArg: "where"
|
|
6326
6392
|
}) }
|
|
6327
|
-
};
|
|
6328
|
-
if (aggregateGenerated && aggregateType) ctx.queries
|
|
6393
|
+
});
|
|
6394
|
+
if (aggregateGenerated && aggregateType) defineRootField(ctx.queries, "query", aggregateGenerated.name, {
|
|
6329
6395
|
type: new GraphQLNonNull(aggregateType),
|
|
6330
6396
|
args: aggregateGenerated.args,
|
|
6331
6397
|
resolve: aggregateGenerated.resolver,
|
|
@@ -6338,8 +6404,8 @@ const createSchemaBuilder = (adapter) => {
|
|
|
6338
6404
|
}),
|
|
6339
6405
|
...complexity ? { complexity: aggregateFieldComplexity(complexity) } : {}
|
|
6340
6406
|
}
|
|
6341
|
-
};
|
|
6342
|
-
if (groupByGenerated && groupByType) ctx.queries
|
|
6407
|
+
});
|
|
6408
|
+
if (groupByGenerated && groupByType) defineRootField(ctx.queries, "query", groupByGenerated.name, {
|
|
6343
6409
|
type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(groupByType))),
|
|
6344
6410
|
args: groupByGenerated.args,
|
|
6345
6411
|
resolve: groupByGenerated.resolver,
|
|
@@ -6352,7 +6418,7 @@ const createSchemaBuilder = (adapter) => {
|
|
|
6352
6418
|
}),
|
|
6353
6419
|
...complexity ? { complexity: aggregateFieldComplexity(complexity) } : {}
|
|
6354
6420
|
}
|
|
6355
|
-
};
|
|
6421
|
+
});
|
|
6356
6422
|
return {
|
|
6357
6423
|
aggregateType,
|
|
6358
6424
|
groupByType,
|
|
@@ -6730,7 +6796,7 @@ const generateSchemaData$2 = (db, schema, relations, options) => {
|
|
|
6730
6796
|
targetArg: "where"
|
|
6731
6797
|
}]
|
|
6732
6798
|
];
|
|
6733
|
-
for (const [generated, meta] of generatedMutations) if (generated) mutations
|
|
6799
|
+
for (const [generated, meta] of generatedMutations) if (generated) defineRootField(mutations, "mutation", generated.name, {
|
|
6734
6800
|
type: mutationReturnType,
|
|
6735
6801
|
args: generated.args,
|
|
6736
6802
|
resolve: generated.resolver,
|
|
@@ -6738,19 +6804,19 @@ const generateSchemaData$2 = (db, schema, relations, options) => {
|
|
|
6738
6804
|
kind: "mutation",
|
|
6739
6805
|
...meta
|
|
6740
6806
|
}) }
|
|
6741
|
-
};
|
|
6742
|
-
if (updateCountGenerated) mutations
|
|
6807
|
+
});
|
|
6808
|
+
if (updateCountGenerated) defineRootField(mutations, "mutation", updateCountGenerated.name, {
|
|
6743
6809
|
type: new GraphQLNonNull(GraphQLInt),
|
|
6744
6810
|
args: updateCountGenerated.args,
|
|
6745
6811
|
resolve: updateCountGenerated.resolver,
|
|
6746
6812
|
description: "How many rows the update touched. The rows themselves are not read back, which is the point of this mutation."
|
|
6747
|
-
};
|
|
6748
|
-
if (deleteCountGenerated) mutations
|
|
6813
|
+
});
|
|
6814
|
+
if (deleteCountGenerated) defineRootField(mutations, "mutation", deleteCountGenerated.name, {
|
|
6749
6815
|
type: new GraphQLNonNull(GraphQLInt),
|
|
6750
6816
|
args: deleteCountGenerated.args,
|
|
6751
6817
|
resolve: deleteCountGenerated.resolver,
|
|
6752
6818
|
description: "How many rows the delete removed. The rows themselves are not read back, which is the point of this mutation."
|
|
6753
|
-
};
|
|
6819
|
+
});
|
|
6754
6820
|
[
|
|
6755
6821
|
...tableFeatures.insert || onConflictInput ? [insertInput] : [],
|
|
6756
6822
|
...onConflictInput ? [onConflictInput] : [],
|
|
@@ -7196,7 +7262,7 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7196
7262
|
filterCtx,
|
|
7197
7263
|
txCtx: mutationTxCtx
|
|
7198
7264
|
}) : void 0;
|
|
7199
|
-
if (insertArrGenerated) mutations
|
|
7265
|
+
if (insertArrGenerated) defineRootField(mutations, "mutation", insertArrGenerated.name, {
|
|
7200
7266
|
type: arrTableItemOutput,
|
|
7201
7267
|
args: insertArrGenerated.args,
|
|
7202
7268
|
resolve: insertArrGenerated.resolver,
|
|
@@ -7206,8 +7272,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7206
7272
|
single: false,
|
|
7207
7273
|
targetArg: "values"
|
|
7208
7274
|
}) }
|
|
7209
|
-
};
|
|
7210
|
-
if (insertSingleGenerated) mutations
|
|
7275
|
+
});
|
|
7276
|
+
if (insertSingleGenerated) defineRootField(mutations, "mutation", insertSingleGenerated.name, {
|
|
7211
7277
|
type: conflictDoNothing ? singleTableItemOutput : new GraphQLNonNull(singleTableItemOutput),
|
|
7212
7278
|
args: insertSingleGenerated.args,
|
|
7213
7279
|
resolve: insertSingleGenerated.resolver,
|
|
@@ -7217,8 +7283,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7217
7283
|
single: true,
|
|
7218
7284
|
targetArg: "values"
|
|
7219
7285
|
}) }
|
|
7220
|
-
};
|
|
7221
|
-
if (upsertArrGenerated) mutations
|
|
7286
|
+
});
|
|
7287
|
+
if (upsertArrGenerated) defineRootField(mutations, "mutation", upsertArrGenerated.name, {
|
|
7222
7288
|
type: arrTableItemOutput,
|
|
7223
7289
|
args: upsertArrGenerated.args,
|
|
7224
7290
|
resolve: upsertArrGenerated.resolver,
|
|
@@ -7228,8 +7294,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7228
7294
|
single: false,
|
|
7229
7295
|
targetArg: "values"
|
|
7230
7296
|
}) }
|
|
7231
|
-
};
|
|
7232
|
-
if (upsertSingleGenerated) mutations
|
|
7297
|
+
});
|
|
7298
|
+
if (upsertSingleGenerated) defineRootField(mutations, "mutation", upsertSingleGenerated.name, {
|
|
7233
7299
|
type: singleTableItemOutput,
|
|
7234
7300
|
args: upsertSingleGenerated.args,
|
|
7235
7301
|
resolve: upsertSingleGenerated.resolver,
|
|
@@ -7239,8 +7305,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7239
7305
|
single: true,
|
|
7240
7306
|
targetArg: "values"
|
|
7241
7307
|
}) }
|
|
7242
|
-
};
|
|
7243
|
-
if (updateGenerated) mutations
|
|
7308
|
+
});
|
|
7309
|
+
if (updateGenerated) defineRootField(mutations, "mutation", updateGenerated.name, {
|
|
7244
7310
|
type: arrTableItemOutput,
|
|
7245
7311
|
args: updateGenerated.args,
|
|
7246
7312
|
resolve: updateGenerated.resolver,
|
|
@@ -7250,8 +7316,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7250
7316
|
single: false,
|
|
7251
7317
|
targetArg: "where"
|
|
7252
7318
|
}) }
|
|
7253
|
-
};
|
|
7254
|
-
if (updateManyGenerated) mutations
|
|
7319
|
+
});
|
|
7320
|
+
if (updateManyGenerated) defineRootField(mutations, "mutation", updateManyGenerated.name, {
|
|
7255
7321
|
type: new GraphQLNonNull(new GraphQLList(singleTableItemOutput)),
|
|
7256
7322
|
args: updateManyGenerated.args,
|
|
7257
7323
|
resolve: updateManyGenerated.resolver,
|
|
@@ -7262,8 +7328,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7262
7328
|
targetArg: "updates"
|
|
7263
7329
|
}) },
|
|
7264
7330
|
description: "Each entry's updated rows, in entry order. An entry whose `where` matched no rows contributes `null` in its slot; an entry that matched several contributes each of its rows."
|
|
7265
|
-
};
|
|
7266
|
-
if (updateSingleGenerated) mutations
|
|
7331
|
+
});
|
|
7332
|
+
if (updateSingleGenerated) defineRootField(mutations, "mutation", updateSingleGenerated.name, {
|
|
7267
7333
|
type: singleTableItemOutput,
|
|
7268
7334
|
args: updateSingleGenerated.args,
|
|
7269
7335
|
resolve: updateSingleGenerated.resolver,
|
|
@@ -7273,8 +7339,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7273
7339
|
single: true,
|
|
7274
7340
|
targetArg: "where"
|
|
7275
7341
|
}) }
|
|
7276
|
-
};
|
|
7277
|
-
if (deleteGenerated) mutations
|
|
7342
|
+
});
|
|
7343
|
+
if (deleteGenerated) defineRootField(mutations, "mutation", deleteGenerated.name, {
|
|
7278
7344
|
type: arrTableItemOutput,
|
|
7279
7345
|
args: deleteGenerated.args,
|
|
7280
7346
|
resolve: deleteGenerated.resolver,
|
|
@@ -7285,8 +7351,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7285
7351
|
targetArg: "where",
|
|
7286
7352
|
...softDeleteInfo?.hardDelete ? { hardDelete: true } : {}
|
|
7287
7353
|
}) }
|
|
7288
|
-
};
|
|
7289
|
-
if (deleteSingleGenerated) mutations
|
|
7354
|
+
});
|
|
7355
|
+
if (deleteSingleGenerated) defineRootField(mutations, "mutation", deleteSingleGenerated.name, {
|
|
7290
7356
|
type: singleTableItemOutput,
|
|
7291
7357
|
args: deleteSingleGenerated.args,
|
|
7292
7358
|
resolve: deleteSingleGenerated.resolver,
|
|
@@ -7297,8 +7363,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7297
7363
|
targetArg: "where",
|
|
7298
7364
|
...softDeleteInfo?.hardDelete ? { hardDelete: true } : {}
|
|
7299
7365
|
}) }
|
|
7300
|
-
};
|
|
7301
|
-
if (restoreGenerated) mutations
|
|
7366
|
+
});
|
|
7367
|
+
if (restoreGenerated) defineRootField(mutations, "mutation", restoreGenerated.name, {
|
|
7302
7368
|
type: arrTableItemOutput,
|
|
7303
7369
|
args: restoreGenerated.args,
|
|
7304
7370
|
resolve: restoreGenerated.resolver,
|
|
@@ -7308,8 +7374,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7308
7374
|
single: false,
|
|
7309
7375
|
targetArg: "where"
|
|
7310
7376
|
}) }
|
|
7311
|
-
};
|
|
7312
|
-
if (restoreSingleGenerated) mutations
|
|
7377
|
+
});
|
|
7378
|
+
if (restoreSingleGenerated) defineRootField(mutations, "mutation", restoreSingleGenerated.name, {
|
|
7313
7379
|
type: singleTableItemOutput,
|
|
7314
7380
|
args: restoreSingleGenerated.args,
|
|
7315
7381
|
resolve: restoreSingleGenerated.resolver,
|
|
@@ -7319,19 +7385,19 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7319
7385
|
single: true,
|
|
7320
7386
|
targetArg: "where"
|
|
7321
7387
|
}) }
|
|
7322
|
-
};
|
|
7323
|
-
if (updateCountGenerated) mutations
|
|
7388
|
+
});
|
|
7389
|
+
if (updateCountGenerated) defineRootField(mutations, "mutation", updateCountGenerated.name, {
|
|
7324
7390
|
type: new GraphQLNonNull(GraphQLInt),
|
|
7325
7391
|
args: updateCountGenerated.args,
|
|
7326
7392
|
resolve: updateCountGenerated.resolver,
|
|
7327
7393
|
description: "How many rows the update touched. The rows themselves are not read back, which is the point of this mutation."
|
|
7328
|
-
};
|
|
7329
|
-
if (deleteCountGenerated) mutations
|
|
7394
|
+
});
|
|
7395
|
+
if (deleteCountGenerated) defineRootField(mutations, "mutation", deleteCountGenerated.name, {
|
|
7330
7396
|
type: new GraphQLNonNull(GraphQLInt),
|
|
7331
7397
|
args: deleteCountGenerated.args,
|
|
7332
7398
|
resolve: deleteCountGenerated.resolver,
|
|
7333
7399
|
description: "How many rows the delete removed. The rows themselves are not read back, which is the point of this mutation."
|
|
7334
|
-
};
|
|
7400
|
+
});
|
|
7335
7401
|
[
|
|
7336
7402
|
...tableFeatures.insert || onConflictInput ? [insertInput] : [],
|
|
7337
7403
|
...onConflictInput ? [onConflictInput] : [],
|