@vantreeseba/drizzle-graphql 10.0.2 → 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 +150 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +150 -83
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3154,16 +3154,23 @@ const extractRelationsParams = (relationMap, tables, tableName, info, typeName,
|
|
|
3154
3154
|
if (!info) return;
|
|
3155
3155
|
const relationsForTable = relationMap[tableName];
|
|
3156
3156
|
if (!relationsForTable) return;
|
|
3157
|
-
const baseField =
|
|
3157
|
+
const baseField = info.fieldsByTypeName[typeName];
|
|
3158
3158
|
if (!baseField) return;
|
|
3159
|
+
const selectionsByName = /* @__PURE__ */ new Map();
|
|
3160
|
+
for (const selection of Object.values(baseField)) {
|
|
3161
|
+
const selections = selectionsByName.get(selection.name);
|
|
3162
|
+
if (selections) selections.push(selection);
|
|
3163
|
+
else selectionsByName.set(selection.name, [selection]);
|
|
3164
|
+
}
|
|
3159
3165
|
const args = {};
|
|
3160
3166
|
for (const [relName, relEntry] of Object.entries(relationsForTable)) {
|
|
3161
3167
|
const { targetTableName, targetPkNames } = relEntry;
|
|
3162
3168
|
const relTypeName = resolveObjectTypeName(targetTableName, typeNameMapper, resolveName);
|
|
3163
|
-
const
|
|
3164
|
-
if (!
|
|
3165
|
-
|
|
3166
|
-
|
|
3169
|
+
const selections = selectionsByName.get(relName);
|
|
3170
|
+
if (!selections) continue;
|
|
3171
|
+
const field = selections[0];
|
|
3172
|
+
if (selections.length > 1) continue;
|
|
3173
|
+
const relFieldSelection = field.fieldsByTypeName[relTypeName];
|
|
3167
3174
|
if (!relFieldSelection) continue;
|
|
3168
3175
|
const eagerArgs = field.args;
|
|
3169
3176
|
if (!is(relEntry.relation ?? relEntry, One) && (eagerArgs?.after != null || !!(eagerArgs?.distinct)?.length || isCursorFieldSelected(relFieldSelection, tables[targetTableName]))) continue;
|
|
@@ -3175,8 +3182,7 @@ const extractRelationsParams = (relationMap, tables, tableName, info, typeName,
|
|
|
3175
3182
|
});
|
|
3176
3183
|
const thisRecord = {};
|
|
3177
3184
|
thisRecord.columns = columns;
|
|
3178
|
-
const
|
|
3179
|
-
const relationArgs = is(relEntry.relation, One) ? relationField?.args : relationField && withDefaultOrderBy(relationField.args ?? {}, targetTableName, defaultOrderBy);
|
|
3185
|
+
const relationArgs = is(relEntry.relation, One) ? field.args : withDefaultOrderBy(field.args ?? {}, targetTableName, defaultOrderBy);
|
|
3180
3186
|
const offset = relationArgs?.offset ?? void 0;
|
|
3181
3187
|
const limit = is(relEntry.relation, One) ? relationArgs?.limit ?? void 0 : applyLimitPolicy(relationArgs?.limit, limits?.(targetTableName), {
|
|
3182
3188
|
table: targetTableName,
|
|
@@ -3191,7 +3197,7 @@ const extractRelationsParams = (relationMap, tables, tableName, info, typeName,
|
|
|
3191
3197
|
thisRecord.orderBy = relationArgs?.orderBy ? (aliasedTable) => extractOrderBy(aliasedTable, relationArgs.orderBy, relationFilterCtx(filterCtx, targetTableName), relWhere) : hasPagination && pkNames.length ? (aliasedTable) => primaryKeyOrderExprs(aliasedTable, pkNames) : void 0;
|
|
3192
3198
|
thisRecord.offset = offset;
|
|
3193
3199
|
thisRecord.limit = limit;
|
|
3194
|
-
thisRecord.with = extractRelationsParams(relationMap, tables, targetTableName,
|
|
3200
|
+
thisRecord.with = extractRelationsParams(relationMap, tables, targetTableName, field, relTypeName, options);
|
|
3195
3201
|
args[relName] = thisRecord;
|
|
3196
3202
|
}
|
|
3197
3203
|
return args;
|
|
@@ -3539,6 +3545,7 @@ const generateWriteCount = ({ db, tableName, table, kind, setArgs, filterArgs, f
|
|
|
3539
3545
|
//#endregion
|
|
3540
3546
|
//#region src/util/batch-loader/index.ts
|
|
3541
3547
|
const DRIZZLE_LOADERS_KEY = Symbol("drizzle-graphql-loaders");
|
|
3548
|
+
const DRIZZLE_REQUEST_CACHE_KEY = Symbol("drizzle-graphql-request-cache");
|
|
3542
3549
|
var BatchLoader = class {
|
|
3543
3550
|
batchFn;
|
|
3544
3551
|
batch = [];
|
|
@@ -3582,6 +3589,32 @@ const getOrCreateLoader = (context, key, batchFn) => {
|
|
|
3582
3589
|
if (!loaders.has(key)) loaders.set(key, new BatchLoader(batchFn));
|
|
3583
3590
|
return loaders.get(key);
|
|
3584
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
|
+
};
|
|
3585
3618
|
//#endregion
|
|
3586
3619
|
//#region src/util/extensions.ts
|
|
3587
3620
|
/**
|
|
@@ -3799,30 +3832,40 @@ const createRelationResolverFactory = (db, tables, nullOrdering, filterCtx, limi
|
|
|
3799
3832
|
const localValue = parent[localColPropName];
|
|
3800
3833
|
if (localValue == null) return isOne ? null : [];
|
|
3801
3834
|
const { where: whereArg, limit: requestedLimit, offset, after, deleted } = args ?? {};
|
|
3802
|
-
const orderByArg
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
if (
|
|
3809
|
-
|
|
3810
|
-
if (
|
|
3811
|
-
|
|
3812
|
-
if (
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
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
|
+
});
|
|
3826
3869
|
return getOrCreateLoader(context, loaderKey, async (parentIds) => {
|
|
3827
3870
|
const executor = resolveExecutor(db, context);
|
|
3828
3871
|
const uniqueIds = [...new Set(parentIds)];
|
|
@@ -3896,20 +3939,24 @@ const computeResolverFieldNames = (tableName, typeNameMapper, prefixes, suffixes
|
|
|
3896
3939
|
const singleFieldName = mapped?.singular ?? uncapitalize(tableName) + suffixes.single;
|
|
3897
3940
|
const aggregateFieldName = `${mapped?.plural ?? uncapitalize(tableName)}Aggregate`;
|
|
3898
3941
|
const groupByFieldName = `${mapped?.plural ?? uncapitalize(tableName)}GroupBy`;
|
|
3899
|
-
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}`;
|
|
3900
3945
|
const createSingleFieldName = mapped ? `${prefixes.insert}${capitalize(mapped.singular)}` : `${prefixes.insert}${capitalize(tableName)}${suffixes.single}`;
|
|
3901
3946
|
const upsertPrefix = prefixes.upsert ?? "upsert";
|
|
3902
|
-
const upsertArrayFieldName = `${upsertPrefix}${
|
|
3947
|
+
const upsertArrayFieldName = `${upsertPrefix}${pluralNoun}${suffixes.list}`;
|
|
3903
3948
|
const upsertSingleFieldName = mapped ? `${upsertPrefix}${capitalize(mapped.singular)}` : `${upsertPrefix}${capitalize(tableName)}${suffixes.single}`;
|
|
3904
|
-
const
|
|
3905
|
-
const
|
|
3906
|
-
const
|
|
3907
|
-
const
|
|
3908
|
-
const
|
|
3909
|
-
const
|
|
3910
|
-
const
|
|
3911
|
-
const
|
|
3912
|
-
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}`;
|
|
3913
3960
|
return {
|
|
3914
3961
|
typeName,
|
|
3915
3962
|
listFieldName,
|
|
@@ -3932,6 +3979,26 @@ const computeResolverFieldNames = (tableName, typeNameMapper, prefixes, suffixes
|
|
|
3932
3979
|
};
|
|
3933
3980
|
};
|
|
3934
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
|
|
3935
4002
|
//#region src/util/builders/common/select-runtime.ts
|
|
3936
4003
|
/**
|
|
3937
4004
|
* Runs the relational-query-builder select shared by every dialect's `generateSelect*`
|
|
@@ -6294,7 +6361,7 @@ const createSchemaBuilder = (adapter) => {
|
|
|
6294
6361
|
const groupByEnum = groupByType ? generateGroupByEnum(table, tableName, typeName, cacheCtx) : void 0;
|
|
6295
6362
|
const havingInput = groupByEnum ? generateHavingInput(table, tableName, typeName, cacheCtx) : void 0;
|
|
6296
6363
|
const groupByGenerated = groupByType && groupByEnum && havingInput ? generateGroupBy(db, tableName, table, typeName, groupByFieldName, tableFilters, groupByEnum, havingInput, filterCtx, tablePolicies, cacheCtx.typeName) : void 0;
|
|
6297
|
-
ctx.queries
|
|
6364
|
+
defineRootField(ctx.queries, "query", selectArrGenerated.name, {
|
|
6298
6365
|
type: selectArrOutput,
|
|
6299
6366
|
args: selectArrGenerated.args,
|
|
6300
6367
|
resolve: selectArrGenerated.resolver,
|
|
@@ -6307,8 +6374,8 @@ const createSchemaBuilder = (adapter) => {
|
|
|
6307
6374
|
}),
|
|
6308
6375
|
...complexity ? { complexity: listFieldComplexity(complexity, limits?.(tableName)) } : {}
|
|
6309
6376
|
}
|
|
6310
|
-
};
|
|
6311
|
-
ctx.queries
|
|
6377
|
+
});
|
|
6378
|
+
defineRootField(ctx.queries, "query", selectSingleGenerated.name, {
|
|
6312
6379
|
type: selectSingleOutput,
|
|
6313
6380
|
args: selectSingleGenerated.args,
|
|
6314
6381
|
resolve: selectSingleGenerated.resolver,
|
|
@@ -6318,8 +6385,8 @@ const createSchemaBuilder = (adapter) => {
|
|
|
6318
6385
|
single: true,
|
|
6319
6386
|
targetArg: "where"
|
|
6320
6387
|
}) }
|
|
6321
|
-
};
|
|
6322
|
-
if (aggregateGenerated && aggregateType) ctx.queries
|
|
6388
|
+
});
|
|
6389
|
+
if (aggregateGenerated && aggregateType) defineRootField(ctx.queries, "query", aggregateGenerated.name, {
|
|
6323
6390
|
type: new GraphQLNonNull(aggregateType),
|
|
6324
6391
|
args: aggregateGenerated.args,
|
|
6325
6392
|
resolve: aggregateGenerated.resolver,
|
|
@@ -6332,8 +6399,8 @@ const createSchemaBuilder = (adapter) => {
|
|
|
6332
6399
|
}),
|
|
6333
6400
|
...complexity ? { complexity: aggregateFieldComplexity(complexity) } : {}
|
|
6334
6401
|
}
|
|
6335
|
-
};
|
|
6336
|
-
if (groupByGenerated && groupByType) ctx.queries
|
|
6402
|
+
});
|
|
6403
|
+
if (groupByGenerated && groupByType) defineRootField(ctx.queries, "query", groupByGenerated.name, {
|
|
6337
6404
|
type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(groupByType))),
|
|
6338
6405
|
args: groupByGenerated.args,
|
|
6339
6406
|
resolve: groupByGenerated.resolver,
|
|
@@ -6346,7 +6413,7 @@ const createSchemaBuilder = (adapter) => {
|
|
|
6346
6413
|
}),
|
|
6347
6414
|
...complexity ? { complexity: aggregateFieldComplexity(complexity) } : {}
|
|
6348
6415
|
}
|
|
6349
|
-
};
|
|
6416
|
+
});
|
|
6350
6417
|
return {
|
|
6351
6418
|
aggregateType,
|
|
6352
6419
|
groupByType,
|
|
@@ -6724,7 +6791,7 @@ const generateSchemaData$2 = (db, schema, relations, options) => {
|
|
|
6724
6791
|
targetArg: "where"
|
|
6725
6792
|
}]
|
|
6726
6793
|
];
|
|
6727
|
-
for (const [generated, meta] of generatedMutations) if (generated) mutations
|
|
6794
|
+
for (const [generated, meta] of generatedMutations) if (generated) defineRootField(mutations, "mutation", generated.name, {
|
|
6728
6795
|
type: mutationReturnType,
|
|
6729
6796
|
args: generated.args,
|
|
6730
6797
|
resolve: generated.resolver,
|
|
@@ -6732,19 +6799,19 @@ const generateSchemaData$2 = (db, schema, relations, options) => {
|
|
|
6732
6799
|
kind: "mutation",
|
|
6733
6800
|
...meta
|
|
6734
6801
|
}) }
|
|
6735
|
-
};
|
|
6736
|
-
if (updateCountGenerated) mutations
|
|
6802
|
+
});
|
|
6803
|
+
if (updateCountGenerated) defineRootField(mutations, "mutation", updateCountGenerated.name, {
|
|
6737
6804
|
type: new GraphQLNonNull(GraphQLInt),
|
|
6738
6805
|
args: updateCountGenerated.args,
|
|
6739
6806
|
resolve: updateCountGenerated.resolver,
|
|
6740
6807
|
description: "How many rows the update touched. The rows themselves are not read back, which is the point of this mutation."
|
|
6741
|
-
};
|
|
6742
|
-
if (deleteCountGenerated) mutations
|
|
6808
|
+
});
|
|
6809
|
+
if (deleteCountGenerated) defineRootField(mutations, "mutation", deleteCountGenerated.name, {
|
|
6743
6810
|
type: new GraphQLNonNull(GraphQLInt),
|
|
6744
6811
|
args: deleteCountGenerated.args,
|
|
6745
6812
|
resolve: deleteCountGenerated.resolver,
|
|
6746
6813
|
description: "How many rows the delete removed. The rows themselves are not read back, which is the point of this mutation."
|
|
6747
|
-
};
|
|
6814
|
+
});
|
|
6748
6815
|
[
|
|
6749
6816
|
...tableFeatures.insert || onConflictInput ? [insertInput] : [],
|
|
6750
6817
|
...onConflictInput ? [onConflictInput] : [],
|
|
@@ -7190,7 +7257,7 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7190
7257
|
filterCtx,
|
|
7191
7258
|
txCtx: mutationTxCtx
|
|
7192
7259
|
}) : void 0;
|
|
7193
|
-
if (insertArrGenerated) mutations
|
|
7260
|
+
if (insertArrGenerated) defineRootField(mutations, "mutation", insertArrGenerated.name, {
|
|
7194
7261
|
type: arrTableItemOutput,
|
|
7195
7262
|
args: insertArrGenerated.args,
|
|
7196
7263
|
resolve: insertArrGenerated.resolver,
|
|
@@ -7200,8 +7267,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7200
7267
|
single: false,
|
|
7201
7268
|
targetArg: "values"
|
|
7202
7269
|
}) }
|
|
7203
|
-
};
|
|
7204
|
-
if (insertSingleGenerated) mutations
|
|
7270
|
+
});
|
|
7271
|
+
if (insertSingleGenerated) defineRootField(mutations, "mutation", insertSingleGenerated.name, {
|
|
7205
7272
|
type: conflictDoNothing ? singleTableItemOutput : new GraphQLNonNull(singleTableItemOutput),
|
|
7206
7273
|
args: insertSingleGenerated.args,
|
|
7207
7274
|
resolve: insertSingleGenerated.resolver,
|
|
@@ -7211,8 +7278,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7211
7278
|
single: true,
|
|
7212
7279
|
targetArg: "values"
|
|
7213
7280
|
}) }
|
|
7214
|
-
};
|
|
7215
|
-
if (upsertArrGenerated) mutations
|
|
7281
|
+
});
|
|
7282
|
+
if (upsertArrGenerated) defineRootField(mutations, "mutation", upsertArrGenerated.name, {
|
|
7216
7283
|
type: arrTableItemOutput,
|
|
7217
7284
|
args: upsertArrGenerated.args,
|
|
7218
7285
|
resolve: upsertArrGenerated.resolver,
|
|
@@ -7222,8 +7289,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7222
7289
|
single: false,
|
|
7223
7290
|
targetArg: "values"
|
|
7224
7291
|
}) }
|
|
7225
|
-
};
|
|
7226
|
-
if (upsertSingleGenerated) mutations
|
|
7292
|
+
});
|
|
7293
|
+
if (upsertSingleGenerated) defineRootField(mutations, "mutation", upsertSingleGenerated.name, {
|
|
7227
7294
|
type: singleTableItemOutput,
|
|
7228
7295
|
args: upsertSingleGenerated.args,
|
|
7229
7296
|
resolve: upsertSingleGenerated.resolver,
|
|
@@ -7233,8 +7300,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7233
7300
|
single: true,
|
|
7234
7301
|
targetArg: "values"
|
|
7235
7302
|
}) }
|
|
7236
|
-
};
|
|
7237
|
-
if (updateGenerated) mutations
|
|
7303
|
+
});
|
|
7304
|
+
if (updateGenerated) defineRootField(mutations, "mutation", updateGenerated.name, {
|
|
7238
7305
|
type: arrTableItemOutput,
|
|
7239
7306
|
args: updateGenerated.args,
|
|
7240
7307
|
resolve: updateGenerated.resolver,
|
|
@@ -7244,8 +7311,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7244
7311
|
single: false,
|
|
7245
7312
|
targetArg: "where"
|
|
7246
7313
|
}) }
|
|
7247
|
-
};
|
|
7248
|
-
if (updateManyGenerated) mutations
|
|
7314
|
+
});
|
|
7315
|
+
if (updateManyGenerated) defineRootField(mutations, "mutation", updateManyGenerated.name, {
|
|
7249
7316
|
type: new GraphQLNonNull(new GraphQLList(singleTableItemOutput)),
|
|
7250
7317
|
args: updateManyGenerated.args,
|
|
7251
7318
|
resolve: updateManyGenerated.resolver,
|
|
@@ -7256,8 +7323,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7256
7323
|
targetArg: "updates"
|
|
7257
7324
|
}) },
|
|
7258
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."
|
|
7259
|
-
};
|
|
7260
|
-
if (updateSingleGenerated) mutations
|
|
7326
|
+
});
|
|
7327
|
+
if (updateSingleGenerated) defineRootField(mutations, "mutation", updateSingleGenerated.name, {
|
|
7261
7328
|
type: singleTableItemOutput,
|
|
7262
7329
|
args: updateSingleGenerated.args,
|
|
7263
7330
|
resolve: updateSingleGenerated.resolver,
|
|
@@ -7267,8 +7334,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7267
7334
|
single: true,
|
|
7268
7335
|
targetArg: "where"
|
|
7269
7336
|
}) }
|
|
7270
|
-
};
|
|
7271
|
-
if (deleteGenerated) mutations
|
|
7337
|
+
});
|
|
7338
|
+
if (deleteGenerated) defineRootField(mutations, "mutation", deleteGenerated.name, {
|
|
7272
7339
|
type: arrTableItemOutput,
|
|
7273
7340
|
args: deleteGenerated.args,
|
|
7274
7341
|
resolve: deleteGenerated.resolver,
|
|
@@ -7279,8 +7346,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7279
7346
|
targetArg: "where",
|
|
7280
7347
|
...softDeleteInfo?.hardDelete ? { hardDelete: true } : {}
|
|
7281
7348
|
}) }
|
|
7282
|
-
};
|
|
7283
|
-
if (deleteSingleGenerated) mutations
|
|
7349
|
+
});
|
|
7350
|
+
if (deleteSingleGenerated) defineRootField(mutations, "mutation", deleteSingleGenerated.name, {
|
|
7284
7351
|
type: singleTableItemOutput,
|
|
7285
7352
|
args: deleteSingleGenerated.args,
|
|
7286
7353
|
resolve: deleteSingleGenerated.resolver,
|
|
@@ -7291,8 +7358,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7291
7358
|
targetArg: "where",
|
|
7292
7359
|
...softDeleteInfo?.hardDelete ? { hardDelete: true } : {}
|
|
7293
7360
|
}) }
|
|
7294
|
-
};
|
|
7295
|
-
if (restoreGenerated) mutations
|
|
7361
|
+
});
|
|
7362
|
+
if (restoreGenerated) defineRootField(mutations, "mutation", restoreGenerated.name, {
|
|
7296
7363
|
type: arrTableItemOutput,
|
|
7297
7364
|
args: restoreGenerated.args,
|
|
7298
7365
|
resolve: restoreGenerated.resolver,
|
|
@@ -7302,8 +7369,8 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7302
7369
|
single: false,
|
|
7303
7370
|
targetArg: "where"
|
|
7304
7371
|
}) }
|
|
7305
|
-
};
|
|
7306
|
-
if (restoreSingleGenerated) mutations
|
|
7372
|
+
});
|
|
7373
|
+
if (restoreSingleGenerated) defineRootField(mutations, "mutation", restoreSingleGenerated.name, {
|
|
7307
7374
|
type: singleTableItemOutput,
|
|
7308
7375
|
args: restoreSingleGenerated.args,
|
|
7309
7376
|
resolve: restoreSingleGenerated.resolver,
|
|
@@ -7313,19 +7380,19 @@ const createSchemaDataGenerator = (adapter) => {
|
|
|
7313
7380
|
single: true,
|
|
7314
7381
|
targetArg: "where"
|
|
7315
7382
|
}) }
|
|
7316
|
-
};
|
|
7317
|
-
if (updateCountGenerated) mutations
|
|
7383
|
+
});
|
|
7384
|
+
if (updateCountGenerated) defineRootField(mutations, "mutation", updateCountGenerated.name, {
|
|
7318
7385
|
type: new GraphQLNonNull(GraphQLInt),
|
|
7319
7386
|
args: updateCountGenerated.args,
|
|
7320
7387
|
resolve: updateCountGenerated.resolver,
|
|
7321
7388
|
description: "How many rows the update touched. The rows themselves are not read back, which is the point of this mutation."
|
|
7322
|
-
};
|
|
7323
|
-
if (deleteCountGenerated) mutations
|
|
7389
|
+
});
|
|
7390
|
+
if (deleteCountGenerated) defineRootField(mutations, "mutation", deleteCountGenerated.name, {
|
|
7324
7391
|
type: new GraphQLNonNull(GraphQLInt),
|
|
7325
7392
|
args: deleteCountGenerated.args,
|
|
7326
7393
|
resolve: deleteCountGenerated.resolver,
|
|
7327
7394
|
description: "How many rows the delete removed. The rows themselves are not read back, which is the point of this mutation."
|
|
7328
|
-
};
|
|
7395
|
+
});
|
|
7329
7396
|
[
|
|
7330
7397
|
...tableFeatures.insert || onConflictInput ? [insertInput] : [],
|
|
7331
7398
|
...onConflictInput ? [onConflictInput] : [],
|