@vantreeseba/drizzle-graphql 10.0.3 → 11.0.0
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 +136 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +136 -75
- 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*`
|
|
@@ -6300,7 +6361,7 @@ const createSchemaBuilder = (adapter) => {
|
|
|
6300
6361
|
const groupByEnum = groupByType ? generateGroupByEnum(table, tableName, typeName, cacheCtx) : void 0;
|
|
6301
6362
|
const havingInput = groupByEnum ? generateHavingInput(table, tableName, typeName, cacheCtx) : void 0;
|
|
6302
6363
|
const groupByGenerated = groupByType && groupByEnum && havingInput ? generateGroupBy(db, tableName, table, typeName, groupByFieldName, tableFilters, groupByEnum, havingInput, filterCtx, tablePolicies, cacheCtx.typeName) : void 0;
|
|
6303
|
-
ctx.queries
|
|
6364
|
+
defineRootField(ctx.queries, "query", selectArrGenerated.name, {
|
|
6304
6365
|
type: selectArrOutput,
|
|
6305
6366
|
args: selectArrGenerated.args,
|
|
6306
6367
|
resolve: selectArrGenerated.resolver,
|
|
@@ -6313,8 +6374,8 @@ const createSchemaBuilder = (adapter) => {
|
|
|
6313
6374
|
}),
|
|
6314
6375
|
...complexity ? { complexity: listFieldComplexity(complexity, limits?.(tableName)) } : {}
|
|
6315
6376
|
}
|
|
6316
|
-
};
|
|
6317
|
-
ctx.queries
|
|
6377
|
+
});
|
|
6378
|
+
defineRootField(ctx.queries, "query", selectSingleGenerated.name, {
|
|
6318
6379
|
type: selectSingleOutput,
|
|
6319
6380
|
args: selectSingleGenerated.args,
|
|
6320
6381
|
resolve: selectSingleGenerated.resolver,
|
|
@@ -6324,8 +6385,8 @@ const createSchemaBuilder = (adapter) => {
|
|
|
6324
6385
|
single: true,
|
|
6325
6386
|
targetArg: "where"
|
|
6326
6387
|
}) }
|
|
6327
|
-
};
|
|
6328
|
-
if (aggregateGenerated && aggregateType) ctx.queries
|
|
6388
|
+
});
|
|
6389
|
+
if (aggregateGenerated && aggregateType) defineRootField(ctx.queries, "query", aggregateGenerated.name, {
|
|
6329
6390
|
type: new GraphQLNonNull(aggregateType),
|
|
6330
6391
|
args: aggregateGenerated.args,
|
|
6331
6392
|
resolve: aggregateGenerated.resolver,
|
|
@@ -6338,8 +6399,8 @@ const createSchemaBuilder = (adapter) => {
|
|
|
6338
6399
|
}),
|
|
6339
6400
|
...complexity ? { complexity: aggregateFieldComplexity(complexity) } : {}
|
|
6340
6401
|
}
|
|
6341
|
-
};
|
|
6342
|
-
if (groupByGenerated && groupByType) ctx.queries
|
|
6402
|
+
});
|
|
6403
|
+
if (groupByGenerated && groupByType) defineRootField(ctx.queries, "query", groupByGenerated.name, {
|
|
6343
6404
|
type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(groupByType))),
|
|
6344
6405
|
args: groupByGenerated.args,
|
|
6345
6406
|
resolve: groupByGenerated.resolver,
|
|
@@ -6352,7 +6413,7 @@ const createSchemaBuilder = (adapter) => {
|
|
|
6352
6413
|
}),
|
|
6353
6414
|
...complexity ? { complexity: aggregateFieldComplexity(complexity) } : {}
|
|
6354
6415
|
}
|
|
6355
|
-
};
|
|
6416
|
+
});
|
|
6356
6417
|
return {
|
|
6357
6418
|
aggregateType,
|
|
6358
6419
|
groupByType,
|
|
@@ -6730,7 +6791,7 @@ const generateSchemaData$2 = (db, schema, relations, options) => {
|
|
|
6730
6791
|
targetArg: "where"
|
|
6731
6792
|
}]
|
|
6732
6793
|
];
|
|
6733
|
-
for (const [generated, meta] of generatedMutations) if (generated) mutations
|
|
6794
|
+
for (const [generated, meta] of generatedMutations) if (generated) defineRootField(mutations, "mutation", generated.name, {
|
|
6734
6795
|
type: mutationReturnType,
|
|
6735
6796
|
args: generated.args,
|
|
6736
6797
|
resolve: generated.resolver,
|
|
@@ -6738,19 +6799,19 @@ const generateSchemaData$2 = (db, schema, relations, options) => {
|
|
|
6738
6799
|
kind: "mutation",
|
|
6739
6800
|
...meta
|
|
6740
6801
|
}) }
|
|
6741
|
-
};
|
|
6742
|
-
if (updateCountGenerated) mutations
|
|
6802
|
+
});
|
|
6803
|
+
if (updateCountGenerated) defineRootField(mutations, "mutation", updateCountGenerated.name, {
|
|
6743
6804
|
type: new GraphQLNonNull(GraphQLInt),
|
|
6744
6805
|
args: updateCountGenerated.args,
|
|
6745
6806
|
resolve: updateCountGenerated.resolver,
|
|
6746
6807
|
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
|
|
6808
|
+
});
|
|
6809
|
+
if (deleteCountGenerated) defineRootField(mutations, "mutation", deleteCountGenerated.name, {
|
|
6749
6810
|
type: new GraphQLNonNull(GraphQLInt),
|
|
6750
6811
|
args: deleteCountGenerated.args,
|
|
6751
6812
|
resolve: deleteCountGenerated.resolver,
|
|
6752
6813
|
description: "How many rows the delete removed. The rows themselves are not read back, which is the point of this mutation."
|
|
6753
|
-
};
|
|
6814
|
+
});
|
|
6754
6815
|
[
|
|
6755
6816
|
...tableFeatures.insert || onConflictInput ? [insertInput] : [],
|
|
6756
6817
|
...onConflictInput ? [onConflictInput] : [],
|
|
@@ -7196,7 +7257,7 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7196
7257
|
filterCtx,
|
|
7197
7258
|
txCtx: mutationTxCtx
|
|
7198
7259
|
}) : void 0;
|
|
7199
|
-
if (insertArrGenerated) mutations
|
|
7260
|
+
if (insertArrGenerated) defineRootField(mutations, "mutation", insertArrGenerated.name, {
|
|
7200
7261
|
type: arrTableItemOutput,
|
|
7201
7262
|
args: insertArrGenerated.args,
|
|
7202
7263
|
resolve: insertArrGenerated.resolver,
|
|
@@ -7206,8 +7267,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7206
7267
|
single: false,
|
|
7207
7268
|
targetArg: "values"
|
|
7208
7269
|
}) }
|
|
7209
|
-
};
|
|
7210
|
-
if (insertSingleGenerated) mutations
|
|
7270
|
+
});
|
|
7271
|
+
if (insertSingleGenerated) defineRootField(mutations, "mutation", insertSingleGenerated.name, {
|
|
7211
7272
|
type: conflictDoNothing ? singleTableItemOutput : new GraphQLNonNull(singleTableItemOutput),
|
|
7212
7273
|
args: insertSingleGenerated.args,
|
|
7213
7274
|
resolve: insertSingleGenerated.resolver,
|
|
@@ -7217,8 +7278,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7217
7278
|
single: true,
|
|
7218
7279
|
targetArg: "values"
|
|
7219
7280
|
}) }
|
|
7220
|
-
};
|
|
7221
|
-
if (upsertArrGenerated) mutations
|
|
7281
|
+
});
|
|
7282
|
+
if (upsertArrGenerated) defineRootField(mutations, "mutation", upsertArrGenerated.name, {
|
|
7222
7283
|
type: arrTableItemOutput,
|
|
7223
7284
|
args: upsertArrGenerated.args,
|
|
7224
7285
|
resolve: upsertArrGenerated.resolver,
|
|
@@ -7228,8 +7289,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7228
7289
|
single: false,
|
|
7229
7290
|
targetArg: "values"
|
|
7230
7291
|
}) }
|
|
7231
|
-
};
|
|
7232
|
-
if (upsertSingleGenerated) mutations
|
|
7292
|
+
});
|
|
7293
|
+
if (upsertSingleGenerated) defineRootField(mutations, "mutation", upsertSingleGenerated.name, {
|
|
7233
7294
|
type: singleTableItemOutput,
|
|
7234
7295
|
args: upsertSingleGenerated.args,
|
|
7235
7296
|
resolve: upsertSingleGenerated.resolver,
|
|
@@ -7239,8 +7300,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7239
7300
|
single: true,
|
|
7240
7301
|
targetArg: "values"
|
|
7241
7302
|
}) }
|
|
7242
|
-
};
|
|
7243
|
-
if (updateGenerated) mutations
|
|
7303
|
+
});
|
|
7304
|
+
if (updateGenerated) defineRootField(mutations, "mutation", updateGenerated.name, {
|
|
7244
7305
|
type: arrTableItemOutput,
|
|
7245
7306
|
args: updateGenerated.args,
|
|
7246
7307
|
resolve: updateGenerated.resolver,
|
|
@@ -7250,8 +7311,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7250
7311
|
single: false,
|
|
7251
7312
|
targetArg: "where"
|
|
7252
7313
|
}) }
|
|
7253
|
-
};
|
|
7254
|
-
if (updateManyGenerated) mutations
|
|
7314
|
+
});
|
|
7315
|
+
if (updateManyGenerated) defineRootField(mutations, "mutation", updateManyGenerated.name, {
|
|
7255
7316
|
type: new GraphQLNonNull(new GraphQLList(singleTableItemOutput)),
|
|
7256
7317
|
args: updateManyGenerated.args,
|
|
7257
7318
|
resolve: updateManyGenerated.resolver,
|
|
@@ -7262,8 +7323,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7262
7323
|
targetArg: "updates"
|
|
7263
7324
|
}) },
|
|
7264
7325
|
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
|
|
7326
|
+
});
|
|
7327
|
+
if (updateSingleGenerated) defineRootField(mutations, "mutation", updateSingleGenerated.name, {
|
|
7267
7328
|
type: singleTableItemOutput,
|
|
7268
7329
|
args: updateSingleGenerated.args,
|
|
7269
7330
|
resolve: updateSingleGenerated.resolver,
|
|
@@ -7273,8 +7334,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7273
7334
|
single: true,
|
|
7274
7335
|
targetArg: "where"
|
|
7275
7336
|
}) }
|
|
7276
|
-
};
|
|
7277
|
-
if (deleteGenerated) mutations
|
|
7337
|
+
});
|
|
7338
|
+
if (deleteGenerated) defineRootField(mutations, "mutation", deleteGenerated.name, {
|
|
7278
7339
|
type: arrTableItemOutput,
|
|
7279
7340
|
args: deleteGenerated.args,
|
|
7280
7341
|
resolve: deleteGenerated.resolver,
|
|
@@ -7285,8 +7346,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7285
7346
|
targetArg: "where",
|
|
7286
7347
|
...softDeleteInfo?.hardDelete ? { hardDelete: true } : {}
|
|
7287
7348
|
}) }
|
|
7288
|
-
};
|
|
7289
|
-
if (deleteSingleGenerated) mutations
|
|
7349
|
+
});
|
|
7350
|
+
if (deleteSingleGenerated) defineRootField(mutations, "mutation", deleteSingleGenerated.name, {
|
|
7290
7351
|
type: singleTableItemOutput,
|
|
7291
7352
|
args: deleteSingleGenerated.args,
|
|
7292
7353
|
resolve: deleteSingleGenerated.resolver,
|
|
@@ -7297,8 +7358,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7297
7358
|
targetArg: "where",
|
|
7298
7359
|
...softDeleteInfo?.hardDelete ? { hardDelete: true } : {}
|
|
7299
7360
|
}) }
|
|
7300
|
-
};
|
|
7301
|
-
if (restoreGenerated) mutations
|
|
7361
|
+
});
|
|
7362
|
+
if (restoreGenerated) defineRootField(mutations, "mutation", restoreGenerated.name, {
|
|
7302
7363
|
type: arrTableItemOutput,
|
|
7303
7364
|
args: restoreGenerated.args,
|
|
7304
7365
|
resolve: restoreGenerated.resolver,
|
|
@@ -7308,8 +7369,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7308
7369
|
single: false,
|
|
7309
7370
|
targetArg: "where"
|
|
7310
7371
|
}) }
|
|
7311
|
-
};
|
|
7312
|
-
if (restoreSingleGenerated) mutations
|
|
7372
|
+
});
|
|
7373
|
+
if (restoreSingleGenerated) defineRootField(mutations, "mutation", restoreSingleGenerated.name, {
|
|
7313
7374
|
type: singleTableItemOutput,
|
|
7314
7375
|
args: restoreSingleGenerated.args,
|
|
7315
7376
|
resolve: restoreSingleGenerated.resolver,
|
|
@@ -7319,19 +7380,19 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7319
7380
|
single: true,
|
|
7320
7381
|
targetArg: "where"
|
|
7321
7382
|
}) }
|
|
7322
|
-
};
|
|
7323
|
-
if (updateCountGenerated) mutations
|
|
7383
|
+
});
|
|
7384
|
+
if (updateCountGenerated) defineRootField(mutations, "mutation", updateCountGenerated.name, {
|
|
7324
7385
|
type: new GraphQLNonNull(GraphQLInt),
|
|
7325
7386
|
args: updateCountGenerated.args,
|
|
7326
7387
|
resolve: updateCountGenerated.resolver,
|
|
7327
7388
|
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
|
|
7389
|
+
});
|
|
7390
|
+
if (deleteCountGenerated) defineRootField(mutations, "mutation", deleteCountGenerated.name, {
|
|
7330
7391
|
type: new GraphQLNonNull(GraphQLInt),
|
|
7331
7392
|
args: deleteCountGenerated.args,
|
|
7332
7393
|
resolve: deleteCountGenerated.resolver,
|
|
7333
7394
|
description: "How many rows the delete removed. The rows themselves are not read back, which is the point of this mutation."
|
|
7334
|
-
};
|
|
7395
|
+
});
|
|
7335
7396
|
[
|
|
7336
7397
|
...tableFeatures.insert || onConflictInput ? [insertInput] : [],
|
|
7337
7398
|
...onConflictInput ? [onConflictInput] : [],
|