houdini 0.18.2 → 0.18.3
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/build/cmd-cjs/index.js +257 -264
- package/build/cmd-esm/index.js +257 -264
- package/build/codegen/utils/objectIdentificationSelection.d.ts +3 -0
- package/build/codegen-cjs/index.js +255 -262
- package/build/codegen-esm/index.js +255 -262
- package/build/runtime/lib/config.d.ts +1 -1
- package/build/runtime-cjs/lib/config.d.ts +1 -1
- package/build/runtime-esm/lib/config.d.ts +1 -1
- package/build/test-cjs/index.js +263 -260
- package/build/test-esm/index.js +263 -260
- package/build/vite-cjs/index.js +255 -262
- package/build/vite-esm/index.js +255 -262
- package/package.json +1 -1
package/build/vite-cjs/index.js
CHANGED
|
@@ -4675,7 +4675,7 @@ var require_kinds = __commonJS({
|
|
|
4675
4675
|
value: true
|
|
4676
4676
|
});
|
|
4677
4677
|
exports.Kind = void 0;
|
|
4678
|
-
var
|
|
4678
|
+
var Kind30 = Object.freeze({
|
|
4679
4679
|
NAME: "Name",
|
|
4680
4680
|
DOCUMENT: "Document",
|
|
4681
4681
|
OPERATION_DEFINITION: "OperationDefinition",
|
|
@@ -4720,7 +4720,7 @@ var require_kinds = __commonJS({
|
|
|
4720
4720
|
ENUM_TYPE_EXTENSION: "EnumTypeExtension",
|
|
4721
4721
|
INPUT_OBJECT_TYPE_EXTENSION: "InputObjectTypeExtension"
|
|
4722
4722
|
});
|
|
4723
|
-
exports.Kind =
|
|
4723
|
+
exports.Kind = Kind30;
|
|
4724
4724
|
}
|
|
4725
4725
|
});
|
|
4726
4726
|
|
|
@@ -13900,7 +13900,7 @@ var require_graphql = __commonJS({
|
|
|
13900
13900
|
Object.defineProperty(exports, "__esModule", {
|
|
13901
13901
|
value: true
|
|
13902
13902
|
});
|
|
13903
|
-
exports.graphql =
|
|
13903
|
+
exports.graphql = graphql29;
|
|
13904
13904
|
exports.graphqlSync = graphqlSync;
|
|
13905
13905
|
var _isPromise = _interopRequireDefault(require_isPromise());
|
|
13906
13906
|
var _parser = require_parser();
|
|
@@ -13910,7 +13910,7 @@ var require_graphql = __commonJS({
|
|
|
13910
13910
|
function _interopRequireDefault(obj) {
|
|
13911
13911
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
13912
13912
|
}
|
|
13913
|
-
function
|
|
13913
|
+
function graphql29(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
13914
13914
|
var _arguments = arguments;
|
|
13915
13915
|
return new Promise(function(resolve2) {
|
|
13916
13916
|
return resolve2(
|
|
@@ -61938,7 +61938,7 @@ function watchAndRun(params) {
|
|
|
61938
61938
|
}
|
|
61939
61939
|
|
|
61940
61940
|
// src/codegen/index.ts
|
|
61941
|
-
var
|
|
61941
|
+
var graphql28 = __toESM(require_graphql2(), 1);
|
|
61942
61942
|
|
|
61943
61943
|
// src/lib/pipeline.ts
|
|
61944
61944
|
async function runPipeline(config4, pipeline2, target) {
|
|
@@ -69250,7 +69250,7 @@ async function find_graphql(config4, parsedScript, walker) {
|
|
|
69250
69250
|
}
|
|
69251
69251
|
|
|
69252
69252
|
// src/codegen/generators/artifacts/index.ts
|
|
69253
|
-
var
|
|
69253
|
+
var graphql14 = __toESM(require_graphql2(), 1);
|
|
69254
69254
|
var recast5 = __toESM(require_main2(), 1);
|
|
69255
69255
|
|
|
69256
69256
|
// src/codegen/utils/commonjs.ts
|
|
@@ -69854,7 +69854,7 @@ function ancestorKey(ancestors) {
|
|
|
69854
69854
|
}
|
|
69855
69855
|
|
|
69856
69856
|
// src/codegen/generators/artifacts/selection.ts
|
|
69857
|
-
var
|
|
69857
|
+
var graphql13 = __toESM(require_graphql2(), 1);
|
|
69858
69858
|
|
|
69859
69859
|
// ../../node_modules/.pnpm/@kitql+helper@0.5.0/node_modules/@kitql/helper/index.mjs
|
|
69860
69860
|
var config2 = {
|
|
@@ -69900,10 +69900,24 @@ async function sleep2(ms) {
|
|
|
69900
69900
|
}
|
|
69901
69901
|
|
|
69902
69902
|
// src/codegen/transforms/list.ts
|
|
69903
|
-
var
|
|
69903
|
+
var graphql11 = __toESM(require_graphql2(), 1);
|
|
69904
69904
|
|
|
69905
|
-
// src/codegen/
|
|
69905
|
+
// src/codegen/utils/objectIdentificationSelection.ts
|
|
69906
69906
|
var graphql9 = __toESM(require_graphql2(), 1);
|
|
69907
|
+
var objectIdentificationSelection = (config4, type) => {
|
|
69908
|
+
return config4.keyFieldsForType(type.name).map((key) => {
|
|
69909
|
+
return {
|
|
69910
|
+
kind: graphql9.Kind.FIELD,
|
|
69911
|
+
name: {
|
|
69912
|
+
kind: graphql9.Kind.NAME,
|
|
69913
|
+
value: key
|
|
69914
|
+
}
|
|
69915
|
+
};
|
|
69916
|
+
});
|
|
69917
|
+
};
|
|
69918
|
+
|
|
69919
|
+
// src/codegen/transforms/paginate.ts
|
|
69920
|
+
var graphql10 = __toESM(require_graphql2(), 1);
|
|
69907
69921
|
async function paginate(config4, documents) {
|
|
69908
69922
|
const newDocs = [];
|
|
69909
69923
|
for (const doc of documents) {
|
|
@@ -69936,7 +69950,7 @@ async function paginate(config4, documents) {
|
|
|
69936
69950
|
};
|
|
69937
69951
|
let cursorType = "String";
|
|
69938
69952
|
let paginationPath = [];
|
|
69939
|
-
doc.document =
|
|
69953
|
+
doc.document = graphql10.visit(doc.document, {
|
|
69940
69954
|
Field(node, _, __, ___, ancestors) {
|
|
69941
69955
|
const paginateDirective = node.directives?.find(
|
|
69942
69956
|
(directive) => directive.name.value === config4.paginateDirective
|
|
@@ -69963,7 +69977,7 @@ async function paginate(config4, documents) {
|
|
|
69963
69977
|
flags.offset.enabled = offsetPagination;
|
|
69964
69978
|
flags.limit.enabled = offsetPagination;
|
|
69965
69979
|
paginationPath = ancestors.filter(
|
|
69966
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
69980
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql10.Kind.FIELD
|
|
69967
69981
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
69968
69982
|
return {
|
|
69969
69983
|
...node,
|
|
@@ -69984,7 +69998,7 @@ async function paginate(config4, documents) {
|
|
|
69984
69998
|
refetchUpdate = "prepend" /* prepend */;
|
|
69985
69999
|
}
|
|
69986
70000
|
let fragment = "";
|
|
69987
|
-
doc.document =
|
|
70001
|
+
doc.document = graphql10.visit(doc.document, {
|
|
69988
70002
|
OperationDefinition(node) {
|
|
69989
70003
|
if (node.operation !== "query") {
|
|
69990
70004
|
throw new HoudiniError({
|
|
@@ -70038,9 +70052,9 @@ async function paginate(config4, documents) {
|
|
|
70038
70052
|
directives: [
|
|
70039
70053
|
...node.directives || [],
|
|
70040
70054
|
{
|
|
70041
|
-
kind:
|
|
70055
|
+
kind: graphql10.Kind.DIRECTIVE,
|
|
70042
70056
|
name: {
|
|
70043
|
-
kind:
|
|
70057
|
+
kind: graphql10.Kind.NAME,
|
|
70044
70058
|
value: config4.argumentsDirective
|
|
70045
70059
|
}
|
|
70046
70060
|
}
|
|
@@ -70103,16 +70117,16 @@ async function paginate(config4, documents) {
|
|
|
70103
70117
|
const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
70104
70118
|
const fragmentSpreadSelection = [
|
|
70105
70119
|
{
|
|
70106
|
-
kind:
|
|
70120
|
+
kind: graphql10.Kind.FRAGMENT_SPREAD,
|
|
70107
70121
|
name: {
|
|
70108
|
-
kind:
|
|
70122
|
+
kind: graphql10.Kind.NAME,
|
|
70109
70123
|
value: fragmentName
|
|
70110
70124
|
},
|
|
70111
70125
|
directives: [
|
|
70112
70126
|
{
|
|
70113
|
-
kind:
|
|
70127
|
+
kind: graphql10.Kind.DIRECTIVE,
|
|
70114
70128
|
name: {
|
|
70115
|
-
kind:
|
|
70129
|
+
kind: graphql10.Kind.NAME,
|
|
70116
70130
|
value: config4.withDirective
|
|
70117
70131
|
},
|
|
70118
70132
|
["arguments"]: paginationArgs.map(
|
|
@@ -70140,29 +70154,29 @@ async function paginate(config4, documents) {
|
|
|
70140
70154
|
});
|
|
70141
70155
|
const typeConfig = config4.typeConfig?.[fragment];
|
|
70142
70156
|
const queryDoc = {
|
|
70143
|
-
kind:
|
|
70157
|
+
kind: graphql10.Kind.DOCUMENT,
|
|
70144
70158
|
definitions: [
|
|
70145
70159
|
{
|
|
70146
|
-
kind:
|
|
70160
|
+
kind: graphql10.Kind.OPERATION_DEFINITION,
|
|
70147
70161
|
name: {
|
|
70148
|
-
kind:
|
|
70162
|
+
kind: graphql10.Kind.NAME,
|
|
70149
70163
|
value: refetchQueryName
|
|
70150
70164
|
},
|
|
70151
70165
|
operation: "query",
|
|
70152
70166
|
variableDefinitions: paginationArgs.map(
|
|
70153
70167
|
(arg) => ({
|
|
70154
|
-
kind:
|
|
70168
|
+
kind: graphql10.Kind.VARIABLE_DEFINITION,
|
|
70155
70169
|
type: {
|
|
70156
|
-
kind:
|
|
70170
|
+
kind: graphql10.Kind.NAMED_TYPE,
|
|
70157
70171
|
name: {
|
|
70158
|
-
kind:
|
|
70172
|
+
kind: graphql10.Kind.NAME,
|
|
70159
70173
|
value: arg.type
|
|
70160
70174
|
}
|
|
70161
70175
|
},
|
|
70162
70176
|
variable: {
|
|
70163
|
-
kind:
|
|
70177
|
+
kind: graphql10.Kind.VARIABLE,
|
|
70164
70178
|
name: {
|
|
70165
|
-
kind:
|
|
70179
|
+
kind: graphql10.Kind.NAME,
|
|
70166
70180
|
value: arg.name
|
|
70167
70181
|
}
|
|
70168
70182
|
},
|
|
@@ -70174,12 +70188,12 @@ async function paginate(config4, documents) {
|
|
|
70174
70188
|
).concat(
|
|
70175
70189
|
!nodeQuery ? [] : keys.map(
|
|
70176
70190
|
(key) => ({
|
|
70177
|
-
kind:
|
|
70191
|
+
kind: graphql10.Kind.VARIABLE_DEFINITION,
|
|
70178
70192
|
type: key.type,
|
|
70179
70193
|
variable: {
|
|
70180
|
-
kind:
|
|
70194
|
+
kind: graphql10.Kind.VARIABLE,
|
|
70181
70195
|
name: {
|
|
70182
|
-
kind:
|
|
70196
|
+
kind: graphql10.Kind.NAME,
|
|
70183
70197
|
value: key.name
|
|
70184
70198
|
}
|
|
70185
70199
|
}
|
|
@@ -70187,42 +70201,42 @@ async function paginate(config4, documents) {
|
|
|
70187
70201
|
)
|
|
70188
70202
|
),
|
|
70189
70203
|
selectionSet: {
|
|
70190
|
-
kind:
|
|
70204
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
70191
70205
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
70192
70206
|
{
|
|
70193
|
-
kind:
|
|
70207
|
+
kind: graphql10.Kind.FIELD,
|
|
70194
70208
|
name: {
|
|
70195
|
-
kind:
|
|
70209
|
+
kind: graphql10.Kind.NAME,
|
|
70196
70210
|
value: typeConfig?.resolve?.queryField || "node"
|
|
70197
70211
|
},
|
|
70198
70212
|
["arguments"]: keys.map((key) => ({
|
|
70199
|
-
kind:
|
|
70213
|
+
kind: graphql10.Kind.ARGUMENT,
|
|
70200
70214
|
name: {
|
|
70201
|
-
kind:
|
|
70215
|
+
kind: graphql10.Kind.NAME,
|
|
70202
70216
|
value: key.name
|
|
70203
70217
|
},
|
|
70204
70218
|
value: {
|
|
70205
|
-
kind:
|
|
70219
|
+
kind: graphql10.Kind.VARIABLE,
|
|
70206
70220
|
name: {
|
|
70207
|
-
kind:
|
|
70221
|
+
kind: graphql10.Kind.NAME,
|
|
70208
70222
|
value: key.name
|
|
70209
70223
|
}
|
|
70210
70224
|
}
|
|
70211
70225
|
})),
|
|
70212
70226
|
selectionSet: {
|
|
70213
|
-
kind:
|
|
70227
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
70214
70228
|
selections: [
|
|
70215
70229
|
{
|
|
70216
|
-
kind:
|
|
70230
|
+
kind: graphql10.Kind.FIELD,
|
|
70217
70231
|
name: {
|
|
70218
|
-
kind:
|
|
70232
|
+
kind: graphql10.Kind.NAME,
|
|
70219
70233
|
value: "__typename"
|
|
70220
70234
|
}
|
|
70221
70235
|
},
|
|
70222
70236
|
...(typeConfig?.keys || ["id"]).map((key) => ({
|
|
70223
|
-
kind:
|
|
70237
|
+
kind: graphql10.Kind.FIELD,
|
|
70224
70238
|
name: {
|
|
70225
|
-
kind:
|
|
70239
|
+
kind: graphql10.Kind.NAME,
|
|
70226
70240
|
value: key
|
|
70227
70241
|
}
|
|
70228
70242
|
})),
|
|
@@ -70284,15 +70298,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
70284
70298
|
}
|
|
70285
70299
|
function variableAsArgument(name2, variable) {
|
|
70286
70300
|
return {
|
|
70287
|
-
kind:
|
|
70301
|
+
kind: graphql10.Kind.ARGUMENT,
|
|
70288
70302
|
name: {
|
|
70289
|
-
kind:
|
|
70303
|
+
kind: graphql10.Kind.NAME,
|
|
70290
70304
|
value: name2
|
|
70291
70305
|
},
|
|
70292
70306
|
value: {
|
|
70293
|
-
kind:
|
|
70307
|
+
kind: graphql10.Kind.VARIABLE,
|
|
70294
70308
|
name: {
|
|
70295
|
-
kind:
|
|
70309
|
+
kind: graphql10.Kind.NAME,
|
|
70296
70310
|
value: variable ?? name2
|
|
70297
70311
|
}
|
|
70298
70312
|
}
|
|
@@ -70300,18 +70314,18 @@ function variableAsArgument(name2, variable) {
|
|
|
70300
70314
|
}
|
|
70301
70315
|
function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
70302
70316
|
return {
|
|
70303
|
-
kind:
|
|
70317
|
+
kind: graphql10.Kind.VARIABLE_DEFINITION,
|
|
70304
70318
|
type: {
|
|
70305
|
-
kind:
|
|
70319
|
+
kind: graphql10.Kind.NAMED_TYPE,
|
|
70306
70320
|
name: {
|
|
70307
|
-
kind:
|
|
70321
|
+
kind: graphql10.Kind.NAME,
|
|
70308
70322
|
value: type
|
|
70309
70323
|
}
|
|
70310
70324
|
},
|
|
70311
70325
|
variable: {
|
|
70312
|
-
kind:
|
|
70326
|
+
kind: graphql10.Kind.VARIABLE,
|
|
70313
70327
|
name: {
|
|
70314
|
-
kind:
|
|
70328
|
+
kind: graphql10.Kind.NAME,
|
|
70315
70329
|
value: variableName ?? name2
|
|
70316
70330
|
}
|
|
70317
70331
|
},
|
|
@@ -70323,9 +70337,9 @@ function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
|
70323
70337
|
}
|
|
70324
70338
|
function argumentNode(name2, value) {
|
|
70325
70339
|
return {
|
|
70326
|
-
kind:
|
|
70340
|
+
kind: graphql10.Kind.ARGUMENT,
|
|
70327
70341
|
name: {
|
|
70328
|
-
kind:
|
|
70342
|
+
kind: graphql10.Kind.NAME,
|
|
70329
70343
|
value: name2
|
|
70330
70344
|
},
|
|
70331
70345
|
value: objectNode(value)
|
|
@@ -70333,16 +70347,16 @@ function argumentNode(name2, value) {
|
|
|
70333
70347
|
}
|
|
70334
70348
|
function objectNode([type, defaultValue]) {
|
|
70335
70349
|
const node = {
|
|
70336
|
-
kind:
|
|
70350
|
+
kind: graphql10.Kind.OBJECT,
|
|
70337
70351
|
fields: [
|
|
70338
70352
|
{
|
|
70339
|
-
kind:
|
|
70353
|
+
kind: graphql10.Kind.OBJECT_FIELD,
|
|
70340
70354
|
name: {
|
|
70341
|
-
kind:
|
|
70355
|
+
kind: graphql10.Kind.NAME,
|
|
70342
70356
|
value: "type"
|
|
70343
70357
|
},
|
|
70344
70358
|
value: {
|
|
70345
|
-
kind:
|
|
70359
|
+
kind: graphql10.Kind.STRING,
|
|
70346
70360
|
value: type
|
|
70347
70361
|
}
|
|
70348
70362
|
}
|
|
@@ -70350,8 +70364,8 @@ function objectNode([type, defaultValue]) {
|
|
|
70350
70364
|
};
|
|
70351
70365
|
if (defaultValue) {
|
|
70352
70366
|
node.fields.push({
|
|
70353
|
-
kind:
|
|
70354
|
-
name: { kind:
|
|
70367
|
+
kind: graphql10.Kind.OBJECT_FIELD,
|
|
70368
|
+
name: { kind: graphql10.Kind.NAME, value: "default" },
|
|
70355
70369
|
value: {
|
|
70356
70370
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
70357
70371
|
value: defaultValue.toString()
|
|
@@ -70362,34 +70376,34 @@ function objectNode([type, defaultValue]) {
|
|
|
70362
70376
|
}
|
|
70363
70377
|
var pageInfoSelection = [
|
|
70364
70378
|
{
|
|
70365
|
-
kind:
|
|
70379
|
+
kind: graphql10.Kind.FIELD,
|
|
70366
70380
|
name: {
|
|
70367
|
-
kind:
|
|
70381
|
+
kind: graphql10.Kind.NAME,
|
|
70368
70382
|
value: "edges"
|
|
70369
70383
|
},
|
|
70370
70384
|
selectionSet: {
|
|
70371
|
-
kind:
|
|
70385
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
70372
70386
|
selections: [
|
|
70373
70387
|
{
|
|
70374
|
-
kind:
|
|
70388
|
+
kind: graphql10.Kind.FIELD,
|
|
70375
70389
|
name: {
|
|
70376
|
-
kind:
|
|
70390
|
+
kind: graphql10.Kind.NAME,
|
|
70377
70391
|
value: "cursor"
|
|
70378
70392
|
}
|
|
70379
70393
|
},
|
|
70380
70394
|
{
|
|
70381
|
-
kind:
|
|
70395
|
+
kind: graphql10.Kind.FIELD,
|
|
70382
70396
|
name: {
|
|
70383
|
-
kind:
|
|
70397
|
+
kind: graphql10.Kind.NAME,
|
|
70384
70398
|
value: "node"
|
|
70385
70399
|
},
|
|
70386
70400
|
selectionSet: {
|
|
70387
|
-
kind:
|
|
70401
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
70388
70402
|
selections: [
|
|
70389
70403
|
{
|
|
70390
|
-
kind:
|
|
70404
|
+
kind: graphql10.Kind.FIELD,
|
|
70391
70405
|
name: {
|
|
70392
|
-
kind:
|
|
70406
|
+
kind: graphql10.Kind.NAME,
|
|
70393
70407
|
value: "__typename"
|
|
70394
70408
|
}
|
|
70395
70409
|
}
|
|
@@ -70400,39 +70414,39 @@ var pageInfoSelection = [
|
|
|
70400
70414
|
}
|
|
70401
70415
|
},
|
|
70402
70416
|
{
|
|
70403
|
-
kind:
|
|
70417
|
+
kind: graphql10.Kind.FIELD,
|
|
70404
70418
|
name: {
|
|
70405
|
-
kind:
|
|
70419
|
+
kind: graphql10.Kind.NAME,
|
|
70406
70420
|
value: "pageInfo"
|
|
70407
70421
|
},
|
|
70408
70422
|
selectionSet: {
|
|
70409
|
-
kind:
|
|
70423
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
70410
70424
|
selections: [
|
|
70411
70425
|
{
|
|
70412
|
-
kind:
|
|
70426
|
+
kind: graphql10.Kind.FIELD,
|
|
70413
70427
|
name: {
|
|
70414
|
-
kind:
|
|
70428
|
+
kind: graphql10.Kind.NAME,
|
|
70415
70429
|
value: "hasPreviousPage"
|
|
70416
70430
|
}
|
|
70417
70431
|
},
|
|
70418
70432
|
{
|
|
70419
|
-
kind:
|
|
70433
|
+
kind: graphql10.Kind.FIELD,
|
|
70420
70434
|
name: {
|
|
70421
|
-
kind:
|
|
70435
|
+
kind: graphql10.Kind.NAME,
|
|
70422
70436
|
value: "hasNextPage"
|
|
70423
70437
|
}
|
|
70424
70438
|
},
|
|
70425
70439
|
{
|
|
70426
|
-
kind:
|
|
70440
|
+
kind: graphql10.Kind.FIELD,
|
|
70427
70441
|
name: {
|
|
70428
|
-
kind:
|
|
70442
|
+
kind: graphql10.Kind.NAME,
|
|
70429
70443
|
value: "startCursor"
|
|
70430
70444
|
}
|
|
70431
70445
|
},
|
|
70432
70446
|
{
|
|
70433
|
-
kind:
|
|
70447
|
+
kind: graphql10.Kind.FIELD,
|
|
70434
70448
|
name: {
|
|
70435
|
-
kind:
|
|
70449
|
+
kind: graphql10.Kind.NAME,
|
|
70436
70450
|
value: "endCursor"
|
|
70437
70451
|
}
|
|
70438
70452
|
}
|
|
@@ -70446,15 +70460,15 @@ async function addListFragments(config4, documents) {
|
|
|
70446
70460
|
const lists = {};
|
|
70447
70461
|
const errors = [];
|
|
70448
70462
|
for (const doc of documents) {
|
|
70449
|
-
doc.document =
|
|
70463
|
+
doc.document = graphql11.visit(doc.document, {
|
|
70450
70464
|
Directive(node, key, parent, path2, ancestors) {
|
|
70451
70465
|
if ([config4.listDirective, config4.paginateDirective].includes(node.name.value)) {
|
|
70452
70466
|
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
70453
70467
|
let error = {
|
|
70454
|
-
...new
|
|
70468
|
+
...new graphql11.GraphQLError(
|
|
70455
70469
|
"",
|
|
70456
70470
|
node,
|
|
70457
|
-
new
|
|
70471
|
+
new graphql11.Source(""),
|
|
70458
70472
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
70459
70473
|
path2
|
|
70460
70474
|
),
|
|
@@ -70506,7 +70520,7 @@ async function addListFragments(config4, documents) {
|
|
|
70506
70520
|
{
|
|
70507
70521
|
kind: "Argument",
|
|
70508
70522
|
name: {
|
|
70509
|
-
kind:
|
|
70523
|
+
kind: graphql11.Kind.NAME,
|
|
70510
70524
|
value: "connection"
|
|
70511
70525
|
},
|
|
70512
70526
|
value: {
|
|
@@ -70553,10 +70567,13 @@ async function addListFragments(config4, documents) {
|
|
|
70553
70567
|
if (errors.length > 0) {
|
|
70554
70568
|
throw errors;
|
|
70555
70569
|
}
|
|
70556
|
-
const
|
|
70570
|
+
const validDeletes = [
|
|
70557
70571
|
...new Set(
|
|
70558
70572
|
Object.values(lists).map(({ type }) => {
|
|
70559
|
-
if (!(type instanceof
|
|
70573
|
+
if (!(type instanceof graphql11.GraphQLObjectType)) {
|
|
70574
|
+
return "";
|
|
70575
|
+
}
|
|
70576
|
+
if (config4.keyFieldsForType(type.name).length !== 1) {
|
|
70560
70577
|
return "";
|
|
70561
70578
|
}
|
|
70562
70579
|
return type.name;
|
|
@@ -70567,7 +70584,7 @@ async function addListFragments(config4, documents) {
|
|
|
70567
70584
|
return;
|
|
70568
70585
|
}
|
|
70569
70586
|
const generatedDoc = {
|
|
70570
|
-
kind:
|
|
70587
|
+
kind: graphql11.Kind.DOCUMENT,
|
|
70571
70588
|
definitions: Object.entries(lists).flatMap(
|
|
70572
70589
|
([name2, { selection: selection2, type }]) => {
|
|
70573
70590
|
const schemaType = config4.schema.getType(type.name);
|
|
@@ -70575,35 +70592,29 @@ async function addListFragments(config4, documents) {
|
|
|
70575
70592
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
70576
70593
|
}
|
|
70577
70594
|
const fragmentSelection = {
|
|
70578
|
-
kind:
|
|
70595
|
+
kind: graphql11.Kind.SELECTION_SET,
|
|
70579
70596
|
selections: [...selection2.selections]
|
|
70580
70597
|
};
|
|
70581
70598
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
70582
|
-
(field) => field.kind === "Field" && field.name.value
|
|
70599
|
+
(field) => field.kind === "Field" && config4.keyFieldsForType(type.name).includes(field.name.value)
|
|
70583
70600
|
)) {
|
|
70584
70601
|
fragmentSelection.selections = [
|
|
70585
70602
|
...fragmentSelection.selections,
|
|
70586
|
-
|
|
70587
|
-
kind: graphql10.Kind.FIELD,
|
|
70588
|
-
name: {
|
|
70589
|
-
kind: graphql10.Kind.NAME,
|
|
70590
|
-
value: "id"
|
|
70591
|
-
}
|
|
70592
|
-
}
|
|
70603
|
+
...objectIdentificationSelection(config4, type)
|
|
70593
70604
|
];
|
|
70594
70605
|
}
|
|
70595
70606
|
return [
|
|
70596
70607
|
{
|
|
70597
70608
|
name: {
|
|
70598
70609
|
value: config4.listInsertFragment(name2),
|
|
70599
|
-
kind:
|
|
70610
|
+
kind: graphql11.Kind.NAME
|
|
70600
70611
|
},
|
|
70601
|
-
kind:
|
|
70612
|
+
kind: graphql11.Kind.FRAGMENT_DEFINITION,
|
|
70602
70613
|
selectionSet: fragmentSelection,
|
|
70603
70614
|
typeCondition: {
|
|
70604
|
-
kind:
|
|
70615
|
+
kind: graphql11.Kind.NAMED_TYPE,
|
|
70605
70616
|
name: {
|
|
70606
|
-
kind:
|
|
70617
|
+
kind: graphql11.Kind.NAME,
|
|
70607
70618
|
value: type.name
|
|
70608
70619
|
}
|
|
70609
70620
|
}
|
|
@@ -70611,52 +70622,32 @@ async function addListFragments(config4, documents) {
|
|
|
70611
70622
|
{
|
|
70612
70623
|
name: {
|
|
70613
70624
|
value: config4.listToggleFragment(name2),
|
|
70614
|
-
kind:
|
|
70615
|
-
},
|
|
70616
|
-
kind: graphql10.Kind.FRAGMENT_DEFINITION,
|
|
70617
|
-
selectionSet: {
|
|
70618
|
-
...fragmentSelection,
|
|
70619
|
-
selections: [
|
|
70620
|
-
...fragmentSelection.selections,
|
|
70621
|
-
{
|
|
70622
|
-
kind: graphql10.Kind.FIELD,
|
|
70623
|
-
name: {
|
|
70624
|
-
kind: graphql10.Kind.NAME,
|
|
70625
|
-
value: "id"
|
|
70626
|
-
}
|
|
70627
|
-
}
|
|
70628
|
-
]
|
|
70625
|
+
kind: graphql11.Kind.NAME
|
|
70629
70626
|
},
|
|
70627
|
+
kind: graphql11.Kind.FRAGMENT_DEFINITION,
|
|
70628
|
+
selectionSet: fragmentSelection,
|
|
70630
70629
|
typeCondition: {
|
|
70631
|
-
kind:
|
|
70630
|
+
kind: graphql11.Kind.NAMED_TYPE,
|
|
70632
70631
|
name: {
|
|
70633
|
-
kind:
|
|
70632
|
+
kind: graphql11.Kind.NAME,
|
|
70634
70633
|
value: type.name
|
|
70635
70634
|
}
|
|
70636
70635
|
}
|
|
70637
70636
|
},
|
|
70638
70637
|
{
|
|
70639
|
-
kind:
|
|
70638
|
+
kind: graphql11.Kind.FRAGMENT_DEFINITION,
|
|
70640
70639
|
name: {
|
|
70641
70640
|
value: config4.listRemoveFragment(name2),
|
|
70642
|
-
kind:
|
|
70641
|
+
kind: graphql11.Kind.NAME
|
|
70643
70642
|
},
|
|
70644
70643
|
selectionSet: {
|
|
70645
|
-
kind:
|
|
70646
|
-
selections: [
|
|
70647
|
-
{
|
|
70648
|
-
kind: graphql10.Kind.FIELD,
|
|
70649
|
-
name: {
|
|
70650
|
-
kind: graphql10.Kind.NAME,
|
|
70651
|
-
value: "id"
|
|
70652
|
-
}
|
|
70653
|
-
}
|
|
70654
|
-
]
|
|
70644
|
+
kind: graphql11.Kind.SELECTION_SET,
|
|
70645
|
+
selections: [...objectIdentificationSelection(config4, type)]
|
|
70655
70646
|
},
|
|
70656
70647
|
typeCondition: {
|
|
70657
|
-
kind:
|
|
70648
|
+
kind: graphql11.Kind.NAMED_TYPE,
|
|
70658
70649
|
name: {
|
|
70659
|
-
kind:
|
|
70650
|
+
kind: graphql11.Kind.NAME,
|
|
70660
70651
|
value: type.name
|
|
70661
70652
|
}
|
|
70662
70653
|
}
|
|
@@ -70664,15 +70655,15 @@ async function addListFragments(config4, documents) {
|
|
|
70664
70655
|
];
|
|
70665
70656
|
}
|
|
70666
70657
|
).concat(
|
|
70667
|
-
...
|
|
70668
|
-
kind:
|
|
70658
|
+
...validDeletes.map((typeName) => ({
|
|
70659
|
+
kind: graphql11.Kind.DIRECTIVE_DEFINITION,
|
|
70669
70660
|
name: {
|
|
70670
|
-
kind:
|
|
70661
|
+
kind: graphql11.Kind.NAME,
|
|
70671
70662
|
value: config4.listDeleteDirective(typeName)
|
|
70672
70663
|
},
|
|
70673
70664
|
locations: [
|
|
70674
70665
|
{
|
|
70675
|
-
kind:
|
|
70666
|
+
kind: graphql11.Kind.NAME,
|
|
70676
70667
|
value: "FIELD"
|
|
70677
70668
|
}
|
|
70678
70669
|
],
|
|
@@ -70680,8 +70671,8 @@ async function addListFragments(config4, documents) {
|
|
|
70680
70671
|
}))
|
|
70681
70672
|
)
|
|
70682
70673
|
};
|
|
70683
|
-
config4.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(
|
|
70684
|
-
config4.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(
|
|
70674
|
+
config4.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql11.print).join("\n\n");
|
|
70675
|
+
config4.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql11.print).join("\n\n");
|
|
70685
70676
|
documents.push({
|
|
70686
70677
|
name: "generated::lists",
|
|
70687
70678
|
kind: "HoudiniFragment" /* Fragment */,
|
|
@@ -70766,11 +70757,11 @@ var nodeNotDefinedMessage = (config4) => `Looks like you are trying to use the $
|
|
|
70766
70757
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
70767
70758
|
|
|
70768
70759
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
70769
|
-
var
|
|
70760
|
+
var graphql12 = __toESM(require_graphql2(), 1);
|
|
70770
70761
|
function fieldKey(config4, field) {
|
|
70771
70762
|
const attributeName = field.alias?.value || field.name.value;
|
|
70772
|
-
const printed =
|
|
70773
|
-
const secondParse =
|
|
70763
|
+
const printed = graphql12.print(field);
|
|
70764
|
+
const secondParse = graphql12.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
70774
70765
|
const paginated = !!field.directives?.find(
|
|
70775
70766
|
(directive) => directive.name.value === config4.paginateDirective
|
|
70776
70767
|
);
|
|
@@ -70863,8 +70854,8 @@ function selection({
|
|
|
70863
70854
|
const typeConditionName = field.typeCondition.name.value;
|
|
70864
70855
|
const typeCondition = config4.schema.getType(typeConditionName);
|
|
70865
70856
|
const possibleTypes = [];
|
|
70866
|
-
if (!
|
|
70867
|
-
} else if (
|
|
70857
|
+
if (!graphql13.isAbstractType(typeCondition)) {
|
|
70858
|
+
} else if (graphql13.isAbstractType(parentType)) {
|
|
70868
70859
|
const possibleParentTypes = config4.schema.getPossibleTypes(parentType).map((type) => type.name);
|
|
70869
70860
|
for (const possible of config4.schema.getPossibleTypes(typeCondition)) {
|
|
70870
70861
|
if (possibleParentTypes.includes(possible.name)) {
|
|
@@ -70912,7 +70903,7 @@ function selection({
|
|
|
70912
70903
|
} else {
|
|
70913
70904
|
let typeRef = type.getFields()[field.name.value].type;
|
|
70914
70905
|
fieldType = getRootType(typeRef);
|
|
70915
|
-
nullable = !
|
|
70906
|
+
nullable = !graphql13.isNonNullType(typeRef);
|
|
70916
70907
|
}
|
|
70917
70908
|
const typeName = fieldType.toString();
|
|
70918
70909
|
const pathSoFar = path2.concat(attributeName);
|
|
@@ -70977,7 +70968,7 @@ function selection({
|
|
|
70977
70968
|
{}
|
|
70978
70969
|
);
|
|
70979
70970
|
}
|
|
70980
|
-
if (
|
|
70971
|
+
if (graphql13.isInterfaceType(fieldType) || graphql13.isUnionType(fieldType)) {
|
|
70981
70972
|
fieldObj.abstract = true;
|
|
70982
70973
|
}
|
|
70983
70974
|
object.fields = {
|
|
@@ -71034,7 +71025,7 @@ function artifactGenerator(stats) {
|
|
|
71034
71025
|
return async function(config4, docs) {
|
|
71035
71026
|
const filterTypes = {};
|
|
71036
71027
|
for (const doc of docs) {
|
|
71037
|
-
|
|
71028
|
+
graphql14.visit(doc.document, {
|
|
71038
71029
|
Directive(node, _, __, ___, ancestors) {
|
|
71039
71030
|
if (node.name.value !== config4.listDirective) {
|
|
71040
71031
|
return;
|
|
@@ -71093,7 +71084,7 @@ function artifactGenerator(stats) {
|
|
|
71093
71084
|
return;
|
|
71094
71085
|
}
|
|
71095
71086
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
71096
|
-
let documentWithoutInternalDirectives =
|
|
71087
|
+
let documentWithoutInternalDirectives = graphql14.visit(document, {
|
|
71097
71088
|
Directive(node) {
|
|
71098
71089
|
if (config4.isInternalDirective(node)) {
|
|
71099
71090
|
return null;
|
|
@@ -71106,7 +71097,7 @@ function artifactGenerator(stats) {
|
|
|
71106
71097
|
}
|
|
71107
71098
|
}
|
|
71108
71099
|
});
|
|
71109
|
-
let documentWithoutExtraVariables =
|
|
71100
|
+
let documentWithoutExtraVariables = graphql14.visit(
|
|
71110
71101
|
documentWithoutInternalDirectives,
|
|
71111
71102
|
{
|
|
71112
71103
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -71117,13 +71108,13 @@ function artifactGenerator(stats) {
|
|
|
71117
71108
|
}
|
|
71118
71109
|
}
|
|
71119
71110
|
);
|
|
71120
|
-
let rawString =
|
|
71111
|
+
let rawString = graphql14.print(documentWithoutExtraVariables);
|
|
71121
71112
|
let docKind = doc.kind;
|
|
71122
71113
|
const operations = document.definitions.filter(
|
|
71123
|
-
({ kind }) => kind ===
|
|
71114
|
+
({ kind }) => kind === graphql14.Kind.OPERATION_DEFINITION
|
|
71124
71115
|
);
|
|
71125
71116
|
const fragments = document.definitions.filter(
|
|
71126
|
-
({ kind }) => kind ===
|
|
71117
|
+
({ kind }) => kind === graphql14.Kind.FRAGMENT_DEFINITION
|
|
71127
71118
|
);
|
|
71128
71119
|
let rootType = "";
|
|
71129
71120
|
let selectionSet;
|
|
@@ -71310,15 +71301,15 @@ async function generatePluginRuntime(config4, plugin) {
|
|
|
71310
71301
|
var recast10 = __toESM(require_main2(), 1);
|
|
71311
71302
|
|
|
71312
71303
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
71313
|
-
var
|
|
71304
|
+
var graphql17 = __toESM(require_graphql2(), 1);
|
|
71314
71305
|
var recast8 = __toESM(require_main2(), 1);
|
|
71315
71306
|
|
|
71316
71307
|
// src/codegen/generators/typescript/typeReference.ts
|
|
71317
|
-
var
|
|
71308
|
+
var graphql16 = __toESM(require_graphql2(), 1);
|
|
71318
71309
|
var recast7 = __toESM(require_main2(), 1);
|
|
71319
71310
|
|
|
71320
71311
|
// src/codegen/generators/typescript/types.ts
|
|
71321
|
-
var
|
|
71312
|
+
var graphql15 = __toESM(require_graphql2(), 1);
|
|
71322
71313
|
var recast6 = __toESM(require_main2(), 1);
|
|
71323
71314
|
var AST6 = recast6.types.builders;
|
|
71324
71315
|
function readonlyProperty(prop, enable = true) {
|
|
@@ -71352,7 +71343,7 @@ function scalarPropertyValue(config4, missingScalars, target) {
|
|
|
71352
71343
|
return AST6.tsStringKeyword();
|
|
71353
71344
|
}
|
|
71354
71345
|
default: {
|
|
71355
|
-
if (
|
|
71346
|
+
if (graphql15.isNonNullType(target) && "ofType" in target) {
|
|
71356
71347
|
return scalarPropertyValue(
|
|
71357
71348
|
config4,
|
|
71358
71349
|
missingScalars,
|
|
@@ -71373,7 +71364,7 @@ var AST7 = recast7.types.builders;
|
|
|
71373
71364
|
function tsTypeReference(config4, missingScalars, definition) {
|
|
71374
71365
|
const { type, wrappers } = unwrapType(config4, definition.type);
|
|
71375
71366
|
let result;
|
|
71376
|
-
if (
|
|
71367
|
+
if (graphql16.isScalarType(type)) {
|
|
71377
71368
|
result = scalarPropertyValue(config4, missingScalars, type);
|
|
71378
71369
|
} else {
|
|
71379
71370
|
result = AST7.tsTypeReference(AST7.identifier(type.name));
|
|
@@ -71394,17 +71385,17 @@ function tsTypeReference(config4, missingScalars, definition) {
|
|
|
71394
71385
|
var AST8 = recast8.types.builders;
|
|
71395
71386
|
function addReferencedInputTypes(config4, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
71396
71387
|
const { type } = unwrapType(config4, rootType);
|
|
71397
|
-
if (
|
|
71388
|
+
if (graphql17.isScalarType(type)) {
|
|
71398
71389
|
return;
|
|
71399
71390
|
}
|
|
71400
71391
|
if (visitedTypes.has(type.name)) {
|
|
71401
71392
|
return;
|
|
71402
71393
|
}
|
|
71403
|
-
if (
|
|
71394
|
+
if (graphql17.isUnionType(type)) {
|
|
71404
71395
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
71405
71396
|
}
|
|
71406
71397
|
visitedTypes.add(type.name);
|
|
71407
|
-
if (
|
|
71398
|
+
if (graphql17.isEnumType(type)) {
|
|
71408
71399
|
ensureImports({
|
|
71409
71400
|
config: config4,
|
|
71410
71401
|
body,
|
|
@@ -71421,7 +71412,7 @@ function addReferencedInputTypes(config4, filepath, body, visitedTypes, missingS
|
|
|
71421
71412
|
AST8.tsPropertySignature(
|
|
71422
71413
|
AST8.identifier(field.name),
|
|
71423
71414
|
AST8.tsTypeAnnotation(tsTypeReference(config4, missingScalars, field)),
|
|
71424
|
-
|
|
71415
|
+
graphql17.isNullableType(field.type)
|
|
71425
71416
|
)
|
|
71426
71417
|
);
|
|
71427
71418
|
}
|
|
@@ -71429,7 +71420,7 @@ function addReferencedInputTypes(config4, filepath, body, visitedTypes, missingS
|
|
|
71429
71420
|
}
|
|
71430
71421
|
|
|
71431
71422
|
// src/codegen/generators/typescript/inlineType.ts
|
|
71432
|
-
var
|
|
71423
|
+
var graphql18 = __toESM(require_graphql2(), 1);
|
|
71433
71424
|
var recast9 = __toESM(require_main2(), 1);
|
|
71434
71425
|
var AST9 = recast9.types.builders;
|
|
71435
71426
|
var fragmentKey = "$fragments";
|
|
@@ -71448,9 +71439,9 @@ function inlineType({
|
|
|
71448
71439
|
}) {
|
|
71449
71440
|
const { type, wrappers } = unwrapType(config4, rootType);
|
|
71450
71441
|
let result;
|
|
71451
|
-
if (
|
|
71442
|
+
if (graphql18.isScalarType(type)) {
|
|
71452
71443
|
result = scalarPropertyValue(config4, missingScalars, type);
|
|
71453
|
-
} else if (
|
|
71444
|
+
} else if (graphql18.isEnumType(type)) {
|
|
71454
71445
|
if (!visitedTypes.has(type.name)) {
|
|
71455
71446
|
ensureImports({
|
|
71456
71447
|
config: config4,
|
|
@@ -71468,11 +71459,11 @@ function inlineType({
|
|
|
71468
71459
|
for (const selection2 of selections) {
|
|
71469
71460
|
if (selection2.kind === "InlineFragment" && selection2.typeCondition) {
|
|
71470
71461
|
const fragmentType = config4.schema.getType(selection2.typeCondition.name.value);
|
|
71471
|
-
if (!
|
|
71462
|
+
if (!graphql18.isInterfaceType(type) && !graphql18.isUnionType(type)) {
|
|
71472
71463
|
selectedFields.push(...selection2.selectionSet.selections);
|
|
71473
71464
|
continue;
|
|
71474
71465
|
}
|
|
71475
|
-
if (!
|
|
71466
|
+
if (!graphql18.isInterfaceType(fragmentType) && !graphql18.isUnionType(fragmentType)) {
|
|
71476
71467
|
if (!inlineFragments[fragmentType.name]) {
|
|
71477
71468
|
inlineFragments[fragmentType.name] = [];
|
|
71478
71469
|
}
|
|
@@ -71592,7 +71583,7 @@ function inlineType({
|
|
|
71592
71583
|
}
|
|
71593
71584
|
}
|
|
71594
71585
|
}
|
|
71595
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
71586
|
+
if (objectType.type === "TSTypeLiteral" && !graphql18.isInterfaceType(fragmentRootType) && !graphql18.isUnionType(fragmentRootType)) {
|
|
71596
71587
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
71597
71588
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
71598
71589
|
);
|
|
@@ -71659,7 +71650,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
71659
71650
|
},
|
|
71660
71651
|
type: schema.getType("String")
|
|
71661
71652
|
};
|
|
71662
|
-
} else if (
|
|
71653
|
+
} else if (graphql18.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
71663
71654
|
fields = rootType.ofType.getFields();
|
|
71664
71655
|
} else {
|
|
71665
71656
|
fields = rootType.getFields();
|
|
@@ -71671,7 +71662,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
71671
71662
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
71672
71663
|
});
|
|
71673
71664
|
}
|
|
71674
|
-
const fieldType =
|
|
71665
|
+
const fieldType = graphql18.getNamedType(field.type);
|
|
71675
71666
|
if (!fieldType) {
|
|
71676
71667
|
throw new HoudiniError({
|
|
71677
71668
|
filepath,
|
|
@@ -71991,7 +71982,7 @@ async function generateFragmentTypeDefs(config4, filepath, body, selections, def
|
|
|
71991
71982
|
}
|
|
71992
71983
|
|
|
71993
71984
|
// src/codegen/generators/persistedQueries/index.ts
|
|
71994
|
-
var
|
|
71985
|
+
var graphql19 = __toESM(require_graphql2(), 1);
|
|
71995
71986
|
async function persistOutputGenerator(config4, docs) {
|
|
71996
71987
|
if (typeof config4.persistedQueryPath !== "string" || config4.persistedQueryPath.length === 0)
|
|
71997
71988
|
return;
|
|
@@ -72003,8 +71994,8 @@ async function persistOutputGenerator(config4, docs) {
|
|
|
72003
71994
|
if (!generateArtifact) {
|
|
72004
71995
|
return acc;
|
|
72005
71996
|
}
|
|
72006
|
-
let rawString =
|
|
72007
|
-
|
|
71997
|
+
let rawString = graphql19.print(
|
|
71998
|
+
graphql19.visit(document, {
|
|
72008
71999
|
Directive(node) {
|
|
72009
72000
|
if (config4.isInternalDirective(node)) {
|
|
72010
72001
|
return null;
|
|
@@ -72013,7 +72004,7 @@ async function persistOutputGenerator(config4, docs) {
|
|
|
72013
72004
|
})
|
|
72014
72005
|
);
|
|
72015
72006
|
const operations = document.definitions.filter(
|
|
72016
|
-
({ kind }) => kind ===
|
|
72007
|
+
({ kind }) => kind === graphql19.Kind.OPERATION_DEFINITION
|
|
72017
72008
|
);
|
|
72018
72009
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
72019
72010
|
acc[hashDocument(rawString)] = rawString;
|
|
@@ -72026,11 +72017,11 @@ async function persistOutputGenerator(config4, docs) {
|
|
|
72026
72017
|
}
|
|
72027
72018
|
|
|
72028
72019
|
// src/codegen/generators/definitions/enums.ts
|
|
72029
|
-
var
|
|
72020
|
+
var graphql20 = __toESM(require_graphql2(), 1);
|
|
72030
72021
|
var recast11 = __toESM(require_main2(), 1);
|
|
72031
72022
|
var AST11 = recast11.types.builders;
|
|
72032
72023
|
async function definitionsGenerator(config4) {
|
|
72033
|
-
const enums =
|
|
72024
|
+
const enums = graphql20.parse(graphql20.printSchema(config4.schema)).definitions.filter(
|
|
72034
72025
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
72035
72026
|
).filter((def) => !config4.isInternalEnum(def));
|
|
72036
72027
|
const runtimeDefinitions = recast11.print(
|
|
@@ -72203,7 +72194,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
72203
72194
|
}
|
|
72204
72195
|
|
|
72205
72196
|
// src/codegen/transforms/schema.ts
|
|
72206
|
-
var
|
|
72197
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
72207
72198
|
async function graphqlExtensions(config4, documents) {
|
|
72208
72199
|
const internalSchema = `
|
|
72209
72200
|
enum CachePolicy {
|
|
@@ -72281,19 +72272,19 @@ directive @${config4.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
72281
72272
|
"""
|
|
72282
72273
|
directive @${config4.maskDisableDirective} on FRAGMENT_SPREAD
|
|
72283
72274
|
`;
|
|
72284
|
-
let currentSchema =
|
|
72275
|
+
let currentSchema = graphql22.printSchema(config4.schema);
|
|
72285
72276
|
if (!currentSchema.includes(`directive @${config4.listDirective}`)) {
|
|
72286
72277
|
currentSchema += internalSchema;
|
|
72287
72278
|
}
|
|
72288
72279
|
config4.newSchema += internalSchema;
|
|
72289
|
-
config4.schema =
|
|
72280
|
+
config4.schema = graphql22.buildSchema(currentSchema);
|
|
72290
72281
|
}
|
|
72291
72282
|
|
|
72292
72283
|
// src/codegen/transforms/typename.ts
|
|
72293
|
-
var
|
|
72284
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
72294
72285
|
async function addTypename(config4, documents) {
|
|
72295
72286
|
for (const doc of documents) {
|
|
72296
|
-
doc.document =
|
|
72287
|
+
doc.document = graphql23.visit(doc.document, {
|
|
72297
72288
|
Field(node, key, parent, path2, ancestors) {
|
|
72298
72289
|
if (!node.selectionSet) {
|
|
72299
72290
|
return;
|
|
@@ -72305,7 +72296,7 @@ async function addTypename(config4, documents) {
|
|
|
72305
72296
|
);
|
|
72306
72297
|
const field = type.getFields()[node.name.value];
|
|
72307
72298
|
const fieldType = unwrapType(config4, field.type).type;
|
|
72308
|
-
if (
|
|
72299
|
+
if (graphql23.isInterfaceType(fieldType) || graphql23.isUnionType(fieldType)) {
|
|
72309
72300
|
return {
|
|
72310
72301
|
...node,
|
|
72311
72302
|
selectionSet: {
|
|
@@ -72313,9 +72304,9 @@ async function addTypename(config4, documents) {
|
|
|
72313
72304
|
selections: [
|
|
72314
72305
|
...node.selectionSet.selections,
|
|
72315
72306
|
{
|
|
72316
|
-
kind:
|
|
72307
|
+
kind: graphql23.Kind.FIELD,
|
|
72317
72308
|
name: {
|
|
72318
|
-
kind:
|
|
72309
|
+
kind: graphql23.Kind.NAME,
|
|
72319
72310
|
value: "__typename"
|
|
72320
72311
|
}
|
|
72321
72312
|
}
|
|
@@ -72329,10 +72320,10 @@ async function addTypename(config4, documents) {
|
|
|
72329
72320
|
}
|
|
72330
72321
|
|
|
72331
72322
|
// src/codegen/transforms/addID.ts
|
|
72332
|
-
var
|
|
72323
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
72333
72324
|
async function addID(config4, documents) {
|
|
72334
72325
|
for (const doc of documents) {
|
|
72335
|
-
doc.document =
|
|
72326
|
+
doc.document = graphql24.visit(doc.document, {
|
|
72336
72327
|
Field(node, key, parent, path2, ancestors) {
|
|
72337
72328
|
if (!node.selectionSet) {
|
|
72338
72329
|
return;
|
|
@@ -72345,7 +72336,7 @@ async function addID(config4, documents) {
|
|
|
72345
72336
|
const field = type.getFields()[node.name.value];
|
|
72346
72337
|
const fieldType = unwrapType(config4, field.type).type;
|
|
72347
72338
|
if (node.selectionSet?.selections.length > 0) {
|
|
72348
|
-
if (!
|
|
72339
|
+
if (!graphql24.isObjectType(fieldType) && !graphql24.isInterfaceType(fieldType)) {
|
|
72349
72340
|
return;
|
|
72350
72341
|
}
|
|
72351
72342
|
const keyFields = config4.keyFieldsForType(fieldType.name);
|
|
@@ -72360,9 +72351,9 @@ async function addID(config4, documents) {
|
|
|
72360
72351
|
continue;
|
|
72361
72352
|
}
|
|
72362
72353
|
selections.push({
|
|
72363
|
-
kind:
|
|
72354
|
+
kind: graphql24.Kind.FIELD,
|
|
72364
72355
|
name: {
|
|
72365
|
-
kind:
|
|
72356
|
+
kind: graphql24.Kind.NAME,
|
|
72366
72357
|
value: keyField
|
|
72367
72358
|
}
|
|
72368
72359
|
});
|
|
@@ -72381,8 +72372,8 @@ async function addID(config4, documents) {
|
|
|
72381
72372
|
}
|
|
72382
72373
|
|
|
72383
72374
|
// src/codegen/transforms/fragmentVariables.ts
|
|
72384
|
-
var
|
|
72385
|
-
var GraphqlKinds2 =
|
|
72375
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
72376
|
+
var GraphqlKinds2 = graphql25.Kind;
|
|
72386
72377
|
async function fragmentVariables(config4, documents) {
|
|
72387
72378
|
const fragments = collectFragments(config4, documents);
|
|
72388
72379
|
const generatedFragments = {};
|
|
@@ -72405,7 +72396,7 @@ async function fragmentVariables(config4, documents) {
|
|
|
72405
72396
|
});
|
|
72406
72397
|
}
|
|
72407
72398
|
const doc = {
|
|
72408
|
-
kind:
|
|
72399
|
+
kind: graphql25.Kind.DOCUMENT,
|
|
72409
72400
|
definitions: Object.values(generatedFragments)
|
|
72410
72401
|
};
|
|
72411
72402
|
documents.push({
|
|
@@ -72441,7 +72432,7 @@ function inlineFragmentArgs({
|
|
|
72441
72432
|
filepath,
|
|
72442
72433
|
document
|
|
72443
72434
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
72444
|
-
const result =
|
|
72435
|
+
const result = graphql25.visit(document, {
|
|
72445
72436
|
FragmentSpread(node) {
|
|
72446
72437
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
72447
72438
|
let { args, hash } = collectWithArguments(config4, filepath, node, scope);
|
|
@@ -72529,7 +72520,7 @@ function inlineFragmentArgs({
|
|
|
72529
72520
|
});
|
|
72530
72521
|
if (newName) {
|
|
72531
72522
|
result.name = {
|
|
72532
|
-
kind:
|
|
72523
|
+
kind: graphql25.Kind.NAME,
|
|
72533
72524
|
value: newName
|
|
72534
72525
|
};
|
|
72535
72526
|
}
|
|
@@ -72641,7 +72632,7 @@ function operationScope(operation) {
|
|
|
72641
72632
|
}
|
|
72642
72633
|
|
|
72643
72634
|
// src/codegen/validators/typeCheck.ts
|
|
72644
|
-
var
|
|
72635
|
+
var graphql26 = __toESM(require_graphql2(), 1);
|
|
72645
72636
|
async function typeCheck(config4, docs) {
|
|
72646
72637
|
const errors = [];
|
|
72647
72638
|
const freeLists = [];
|
|
@@ -72649,11 +72640,11 @@ async function typeCheck(config4, docs) {
|
|
|
72649
72640
|
const listTypes = [];
|
|
72650
72641
|
const fragments = {};
|
|
72651
72642
|
for (const { document: parsed, filename } of docs) {
|
|
72652
|
-
|
|
72653
|
-
[
|
|
72643
|
+
graphql26.visit(parsed, {
|
|
72644
|
+
[graphql26.Kind.FRAGMENT_DEFINITION](definition) {
|
|
72654
72645
|
fragments[definition.name.value] = definition;
|
|
72655
72646
|
},
|
|
72656
|
-
[
|
|
72647
|
+
[graphql26.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
72657
72648
|
if (![config4.listDirective, config4.paginateDirective].includes(directive.name.value)) {
|
|
72658
72649
|
return;
|
|
72659
72650
|
}
|
|
@@ -72699,14 +72690,14 @@ async function typeCheck(config4, docs) {
|
|
|
72699
72690
|
);
|
|
72700
72691
|
return;
|
|
72701
72692
|
}
|
|
72702
|
-
if (
|
|
72693
|
+
if (graphql26.isListType(rootType) || graphql26.isNonNullType(rootType) && graphql26.isListType(rootType.ofType)) {
|
|
72703
72694
|
needsParent = true;
|
|
72704
72695
|
break;
|
|
72705
72696
|
}
|
|
72706
|
-
if (
|
|
72697
|
+
if (graphql26.isNonNullType(rootType) && "ofType" in rootType) {
|
|
72707
72698
|
rootType = rootType.ofType;
|
|
72708
72699
|
}
|
|
72709
|
-
if (
|
|
72700
|
+
if (graphql26.isScalarType(rootType)) {
|
|
72710
72701
|
break;
|
|
72711
72702
|
}
|
|
72712
72703
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -72762,7 +72753,7 @@ async function typeCheck(config4, docs) {
|
|
|
72762
72753
|
);
|
|
72763
72754
|
const targetField = ancestors[ancestors.length - 1];
|
|
72764
72755
|
const targetFieldDefinition = pType.getFields()[targetField.name.value];
|
|
72765
|
-
const { type, error } = connectionSelection(
|
|
72756
|
+
const { type, error: errorConnectionSelection } = connectionSelection(
|
|
72766
72757
|
config4,
|
|
72767
72758
|
targetFieldDefinition,
|
|
72768
72759
|
parentTypeFromAncestors(
|
|
@@ -72772,10 +72763,19 @@ async function typeCheck(config4, docs) {
|
|
|
72772
72763
|
),
|
|
72773
72764
|
targetField.selectionSet
|
|
72774
72765
|
);
|
|
72766
|
+
if (errorConnectionSelection && directive.name.value === config4.paginateDirective) {
|
|
72767
|
+
errors.push(
|
|
72768
|
+
new HoudiniError({
|
|
72769
|
+
filepath: filename,
|
|
72770
|
+
message: errorConnectionSelection,
|
|
72771
|
+
description: errorConnectionSelection
|
|
72772
|
+
})
|
|
72773
|
+
);
|
|
72774
|
+
}
|
|
72775
72775
|
let targetTypes = [type];
|
|
72776
|
-
if (
|
|
72776
|
+
if (graphql26.isUnionType(type)) {
|
|
72777
72777
|
targetTypes = config4.schema.getPossibleTypes(type);
|
|
72778
|
-
} else if (
|
|
72778
|
+
} else if (graphql26.isInterfaceType(type)) {
|
|
72779
72779
|
try {
|
|
72780
72780
|
for (const key of config4.keyFieldsForType(type.name)) {
|
|
72781
72781
|
if (!type.getFields()[key]) {
|
|
@@ -72789,23 +72789,16 @@ async function typeCheck(config4, docs) {
|
|
|
72789
72789
|
for (const targetType of targetTypes) {
|
|
72790
72790
|
const missingIDFields = config4.keyFieldsForType(targetType.name).filter((fieldName) => !targetType.getFields()[fieldName]);
|
|
72791
72791
|
if (missingIDFields.length > 0) {
|
|
72792
|
-
|
|
72793
|
-
|
|
72794
|
-
|
|
72795
|
-
|
|
72796
|
-
|
|
72797
|
-
|
|
72798
|
-
|
|
72799
|
-
|
|
72800
|
-
|
|
72801
|
-
|
|
72802
|
-
filepath: filename,
|
|
72803
|
-
message: `@${config4.listDirective} can only be applied to types with the necessary id fields: ${missingIDFields.join(
|
|
72804
|
-
", "
|
|
72805
|
-
)}.`
|
|
72806
|
-
})
|
|
72807
|
-
);
|
|
72808
|
-
}
|
|
72792
|
+
const message = `@${config4.listDirective} on ${logGreen2(
|
|
72793
|
+
targetType.name
|
|
72794
|
+
)} as a configuration issue. Object identification missing: ${missingIDFields.map((c) => `"${logYellow2(c)}"`).join(", ")}. Check 'Custom IDs' if needed.`;
|
|
72795
|
+
errors.push(
|
|
72796
|
+
new HoudiniError({
|
|
72797
|
+
filepath: filename,
|
|
72798
|
+
message,
|
|
72799
|
+
description: message
|
|
72800
|
+
})
|
|
72801
|
+
);
|
|
72809
72802
|
return;
|
|
72810
72803
|
}
|
|
72811
72804
|
}
|
|
@@ -72820,13 +72813,13 @@ async function typeCheck(config4, docs) {
|
|
|
72820
72813
|
if (errors.length > 0) {
|
|
72821
72814
|
throw errors;
|
|
72822
72815
|
}
|
|
72823
|
-
const rules = (filepath) => [...
|
|
72816
|
+
const rules = (filepath) => [...graphql26.specifiedRules].filter(
|
|
72824
72817
|
(rule) => ![
|
|
72825
|
-
|
|
72826
|
-
|
|
72827
|
-
|
|
72828
|
-
|
|
72829
|
-
|
|
72818
|
+
graphql26.NoUnusedFragmentsRule,
|
|
72819
|
+
graphql26.KnownFragmentNamesRule,
|
|
72820
|
+
graphql26.ExecutableDefinitionsRule,
|
|
72821
|
+
graphql26.KnownDirectivesRule,
|
|
72822
|
+
graphql26.KnownArgumentNamesRule
|
|
72830
72823
|
].includes(rule)
|
|
72831
72824
|
).concat(
|
|
72832
72825
|
validateLists({
|
|
@@ -72845,7 +72838,7 @@ async function typeCheck(config4, docs) {
|
|
|
72845
72838
|
noUnusedFragmentArguments(config4)
|
|
72846
72839
|
);
|
|
72847
72840
|
for (const { filename, document: parsed } of docs) {
|
|
72848
|
-
for (const error of
|
|
72841
|
+
for (const error of graphql26.validate(config4.schema, parsed, rules(filename))) {
|
|
72849
72842
|
errors.push(
|
|
72850
72843
|
new HoudiniError({
|
|
72851
72844
|
filepath: filename,
|
|
@@ -72871,7 +72864,7 @@ var validateLists = ({
|
|
|
72871
72864
|
if (!config4.isListFragment(node.name.value)) {
|
|
72872
72865
|
if (!fragments[node.name.value]) {
|
|
72873
72866
|
ctx.reportError(
|
|
72874
|
-
new
|
|
72867
|
+
new graphql26.GraphQLError(
|
|
72875
72868
|
"Encountered unknown fragment: " + node.name.value
|
|
72876
72869
|
)
|
|
72877
72870
|
);
|
|
@@ -72881,7 +72874,7 @@ var validateLists = ({
|
|
|
72881
72874
|
const listName = config4.listNameFromFragment(node.name.value);
|
|
72882
72875
|
if (!lists.includes(listName)) {
|
|
72883
72876
|
ctx.reportError(
|
|
72884
|
-
new
|
|
72877
|
+
new graphql26.GraphQLError(
|
|
72885
72878
|
"Encountered fragment referencing unknown list: " + listName
|
|
72886
72879
|
)
|
|
72887
72880
|
);
|
|
@@ -72906,7 +72899,7 @@ var validateLists = ({
|
|
|
72906
72899
|
);
|
|
72907
72900
|
if (parentArg) {
|
|
72908
72901
|
ctx.reportError(
|
|
72909
|
-
new
|
|
72902
|
+
new graphql26.GraphQLError(
|
|
72910
72903
|
`@${config4.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
72911
72904
|
)
|
|
72912
72905
|
);
|
|
@@ -72922,7 +72915,7 @@ var validateLists = ({
|
|
|
72922
72915
|
return;
|
|
72923
72916
|
}
|
|
72924
72917
|
ctx.reportError(
|
|
72925
|
-
new
|
|
72918
|
+
new graphql26.GraphQLError(
|
|
72926
72919
|
`For this list fragment, you need to add or @${config4.listParentDirective} or @${config4.listAllListsDirective} directive to specify the behavior`
|
|
72927
72920
|
)
|
|
72928
72921
|
);
|
|
@@ -72932,7 +72925,7 @@ var validateLists = ({
|
|
|
72932
72925
|
const directiveName = node.name.value;
|
|
72933
72926
|
if (directiveName === "connection") {
|
|
72934
72927
|
ctx.reportError(
|
|
72935
|
-
new
|
|
72928
|
+
new graphql26.GraphQLError(
|
|
72936
72929
|
"@connection was renamed to @list. Please change your components. If you were using `cache.connection` in your components, you will need to update that to `cache.list` too."
|
|
72937
72930
|
)
|
|
72938
72931
|
);
|
|
@@ -72941,7 +72934,7 @@ var validateLists = ({
|
|
|
72941
72934
|
if (!config4.isInternalDirective(node)) {
|
|
72942
72935
|
if (!config4.schema.getDirective(directiveName)) {
|
|
72943
72936
|
ctx.reportError(
|
|
72944
|
-
new
|
|
72937
|
+
new graphql26.GraphQLError(
|
|
72945
72938
|
"Encountered unknown directive: " + directiveName
|
|
72946
72939
|
)
|
|
72947
72940
|
);
|
|
@@ -72950,7 +72943,7 @@ var validateLists = ({
|
|
|
72950
72943
|
}
|
|
72951
72944
|
if (config4.isListOperationDirective(directiveName) && !listTypes.includes(config4.listNameFromDirective(directiveName))) {
|
|
72952
72945
|
ctx.reportError(
|
|
72953
|
-
new
|
|
72946
|
+
new graphql26.GraphQLError(
|
|
72954
72947
|
"Encountered directive referencing unknown list: " + directiveName
|
|
72955
72948
|
)
|
|
72956
72949
|
);
|
|
@@ -72961,7 +72954,7 @@ var validateLists = ({
|
|
|
72961
72954
|
};
|
|
72962
72955
|
function knownArguments(config4) {
|
|
72963
72956
|
return function(ctx) {
|
|
72964
|
-
const nativeValidator =
|
|
72957
|
+
const nativeValidator = graphql26.KnownArgumentNamesRule(ctx);
|
|
72965
72958
|
return {
|
|
72966
72959
|
...nativeValidator,
|
|
72967
72960
|
Directive(directiveNode) {
|
|
@@ -72994,7 +72987,7 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
72994
72987
|
for (const arg of node.arguments || []) {
|
|
72995
72988
|
if (arg.value.kind !== "ObjectValue") {
|
|
72996
72989
|
ctx.reportError(
|
|
72997
|
-
new
|
|
72990
|
+
new graphql26.GraphQLError("values in @arguments must be an object")
|
|
72998
72991
|
);
|
|
72999
72992
|
return;
|
|
73000
72993
|
}
|
|
@@ -73004,13 +72997,13 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
73004
72997
|
);
|
|
73005
72998
|
if (!typeArg) {
|
|
73006
72999
|
ctx.reportError(
|
|
73007
|
-
new
|
|
73000
|
+
new graphql26.GraphQLError("missing type field for @arguments directive")
|
|
73008
73001
|
);
|
|
73009
73002
|
return;
|
|
73010
73003
|
}
|
|
73011
|
-
if (typeArg.value.kind !==
|
|
73004
|
+
if (typeArg.value.kind !== graphql26.Kind.STRING) {
|
|
73012
73005
|
ctx.reportError(
|
|
73013
|
-
new
|
|
73006
|
+
new graphql26.GraphQLError("type field to @arguments must be a string")
|
|
73014
73007
|
);
|
|
73015
73008
|
return;
|
|
73016
73009
|
}
|
|
@@ -73023,7 +73016,7 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
73023
73016
|
);
|
|
73024
73017
|
if (typeArg.value.value !== defaultValueType) {
|
|
73025
73018
|
ctx.reportError(
|
|
73026
|
-
new
|
|
73019
|
+
new graphql26.GraphQLError(
|
|
73027
73020
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
73028
73021
|
)
|
|
73029
73022
|
);
|
|
@@ -73041,7 +73034,7 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
73041
73034
|
try {
|
|
73042
73035
|
args = fragmentArguments(config4, filepath, fragments[fragmentName]);
|
|
73043
73036
|
} catch (e2) {
|
|
73044
|
-
ctx.reportError(new
|
|
73037
|
+
ctx.reportError(new graphql26.GraphQLError(e2.message));
|
|
73045
73038
|
return;
|
|
73046
73039
|
}
|
|
73047
73040
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -73064,7 +73057,7 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
73064
73057
|
);
|
|
73065
73058
|
if (missing.length > 0) {
|
|
73066
73059
|
ctx.reportError(
|
|
73067
|
-
new
|
|
73060
|
+
new graphql26.GraphQLError(
|
|
73068
73061
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
73069
73062
|
)
|
|
73070
73063
|
);
|
|
@@ -73075,7 +73068,7 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
73075
73068
|
);
|
|
73076
73069
|
if (unknown.length > 0) {
|
|
73077
73070
|
ctx.reportError(
|
|
73078
|
-
new
|
|
73071
|
+
new graphql26.GraphQLError(
|
|
73079
73072
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
73080
73073
|
)
|
|
73081
73074
|
);
|
|
@@ -73087,7 +73080,7 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
73087
73080
|
]
|
|
73088
73081
|
);
|
|
73089
73082
|
for (const [applied, target] of zipped) {
|
|
73090
|
-
if (applied.value.kind ===
|
|
73083
|
+
if (applied.value.kind === graphql26.Kind.VARIABLE || applied.value.kind === graphql26.Kind.LIST || applied.value.kind === graphql26.Kind.OBJECT) {
|
|
73091
73084
|
continue;
|
|
73092
73085
|
}
|
|
73093
73086
|
const appliedType = applied.value.kind.substring(
|
|
@@ -73096,7 +73089,7 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
73096
73089
|
);
|
|
73097
73090
|
if (appliedType !== target) {
|
|
73098
73091
|
ctx.reportError(
|
|
73099
|
-
new
|
|
73092
|
+
new graphql26.GraphQLError(
|
|
73100
73093
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
73101
73094
|
)
|
|
73102
73095
|
);
|
|
@@ -73117,7 +73110,7 @@ function paginateArgs(config4, filepath) {
|
|
|
73117
73110
|
}
|
|
73118
73111
|
if (alreadyPaginated) {
|
|
73119
73112
|
ctx.reportError(
|
|
73120
|
-
new
|
|
73113
|
+
new graphql26.GraphQLError(
|
|
73121
73114
|
`@${config4.paginateDirective} can only appear in a document once.`
|
|
73122
73115
|
)
|
|
73123
73116
|
);
|
|
@@ -73132,7 +73125,7 @@ function paginateArgs(config4, filepath) {
|
|
|
73132
73125
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
73133
73126
|
if (hasRequiredArgs) {
|
|
73134
73127
|
ctx.reportError(
|
|
73135
|
-
new
|
|
73128
|
+
new graphql26.GraphQLError(
|
|
73136
73129
|
"@paginate cannot appear on a document with required args"
|
|
73137
73130
|
)
|
|
73138
73131
|
);
|
|
@@ -73164,14 +73157,14 @@ function paginateArgs(config4, filepath) {
|
|
|
73164
73157
|
const backwards = appliedArgs.has("last");
|
|
73165
73158
|
if (!forward && !backwards) {
|
|
73166
73159
|
ctx.reportError(
|
|
73167
|
-
new
|
|
73160
|
+
new graphql26.GraphQLError(
|
|
73168
73161
|
"A field with cursor-based pagination must have a first or last argument"
|
|
73169
73162
|
)
|
|
73170
73163
|
);
|
|
73171
73164
|
}
|
|
73172
73165
|
if (forward && backwards) {
|
|
73173
73166
|
ctx.reportError(
|
|
73174
|
-
new
|
|
73167
|
+
new graphql26.GraphQLError(
|
|
73175
73168
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
73176
73169
|
)
|
|
73177
73170
|
);
|
|
@@ -73185,7 +73178,7 @@ function paginateArgs(config4, filepath) {
|
|
|
73185
73178
|
);
|
|
73186
73179
|
if (!appliedLimitArg) {
|
|
73187
73180
|
ctx.reportError(
|
|
73188
|
-
new
|
|
73181
|
+
new graphql26.GraphQLError(
|
|
73189
73182
|
"A field with offset-based pagination must have a limit argument"
|
|
73190
73183
|
)
|
|
73191
73184
|
);
|
|
@@ -73201,20 +73194,20 @@ function noUnusedFragmentArguments(config4) {
|
|
|
73201
73194
|
const args = /* @__PURE__ */ new Set();
|
|
73202
73195
|
return {
|
|
73203
73196
|
enter(node) {
|
|
73204
|
-
if (node.kind ===
|
|
73197
|
+
if (node.kind === graphql26.Kind.FRAGMENT_DEFINITION) {
|
|
73205
73198
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config4.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
73206
73199
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
73207
73200
|
args.add(arg);
|
|
73208
73201
|
}
|
|
73209
|
-
} else if (node.kind ===
|
|
73202
|
+
} else if (node.kind === graphql26.Kind.VARIABLE) {
|
|
73210
73203
|
args.delete(node.name.value);
|
|
73211
73204
|
}
|
|
73212
73205
|
},
|
|
73213
73206
|
leave(node) {
|
|
73214
|
-
if (node.kind ===
|
|
73207
|
+
if (node.kind === graphql26.Kind.FRAGMENT_DEFINITION) {
|
|
73215
73208
|
if (args.size > 0) {
|
|
73216
73209
|
ctx.reportError(
|
|
73217
|
-
new
|
|
73210
|
+
new graphql26.GraphQLError(
|
|
73218
73211
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
73219
73212
|
)
|
|
73220
73213
|
);
|
|
@@ -73250,7 +73243,7 @@ function nodeDirectives(config4, directives) {
|
|
|
73250
73243
|
if (definition.kind === "OperationDefinition") {
|
|
73251
73244
|
if (definition.operation !== "query") {
|
|
73252
73245
|
ctx.reportError(
|
|
73253
|
-
new
|
|
73246
|
+
new graphql26.GraphQLError(
|
|
73254
73247
|
`@${node.name.value} must fall on a fragment or query document`
|
|
73255
73248
|
)
|
|
73256
73249
|
);
|
|
@@ -73262,7 +73255,7 @@ function nodeDirectives(config4, directives) {
|
|
|
73262
73255
|
}
|
|
73263
73256
|
if (!possibleNodes.includes(definitionType)) {
|
|
73264
73257
|
ctx.reportError(
|
|
73265
|
-
new
|
|
73258
|
+
new graphql26.GraphQLError(paginateOnNonNodeMessage(config4, node.name.value))
|
|
73266
73259
|
);
|
|
73267
73260
|
}
|
|
73268
73261
|
}
|
|
@@ -73281,7 +73274,7 @@ function checkMutationOperation(config4) {
|
|
|
73281
73274
|
);
|
|
73282
73275
|
if (append && prepend) {
|
|
73283
73276
|
ctx.reportError(
|
|
73284
|
-
new
|
|
73277
|
+
new graphql26.GraphQLError(
|
|
73285
73278
|
`You can't apply both @${config4.listPrependDirective} and @${config4.listAppendDirective} at the same time`
|
|
73286
73279
|
)
|
|
73287
73280
|
);
|
|
@@ -73295,7 +73288,7 @@ function checkMutationOperation(config4) {
|
|
|
73295
73288
|
);
|
|
73296
73289
|
if (parentId && allLists) {
|
|
73297
73290
|
ctx.reportError(
|
|
73298
|
-
new
|
|
73291
|
+
new graphql26.GraphQLError(
|
|
73299
73292
|
`You can't apply both @${config4.listParentDirective} and @${config4.listAllListsDirective} at the same time`
|
|
73300
73293
|
)
|
|
73301
73294
|
);
|
|
@@ -73317,7 +73310,7 @@ function checkMaskDirective(config4) {
|
|
|
73317
73310
|
);
|
|
73318
73311
|
if (maskEnableDirective && maskDisableDirective) {
|
|
73319
73312
|
ctx.reportError(
|
|
73320
|
-
new
|
|
73313
|
+
new graphql26.GraphQLError(
|
|
73321
73314
|
`You can't apply both @${config4.maskEnableDirective} and @${config4.maskDisableDirective} at the same time`
|
|
73322
73315
|
)
|
|
73323
73316
|
);
|
|
@@ -73333,7 +73326,7 @@ function getAndVerifyNodeInterface(config4) {
|
|
|
73333
73326
|
if (!nodeInterface) {
|
|
73334
73327
|
return null;
|
|
73335
73328
|
}
|
|
73336
|
-
if (!
|
|
73329
|
+
if (!graphql26.isInterfaceType(nodeInterface)) {
|
|
73337
73330
|
displayInvalidNodeFieldMessage(config4.logLevel);
|
|
73338
73331
|
return null;
|
|
73339
73332
|
}
|
|
@@ -73431,11 +73424,11 @@ async function uniqueDocumentNames(config4, docs) {
|
|
|
73431
73424
|
}
|
|
73432
73425
|
|
|
73433
73426
|
// src/codegen/validators/noIDAlias.ts
|
|
73434
|
-
var
|
|
73427
|
+
var graphql27 = __toESM(require_graphql2(), 1);
|
|
73435
73428
|
async function noIDAlias(config4, docs) {
|
|
73436
73429
|
const errors = [];
|
|
73437
73430
|
for (const { filename, document } of docs) {
|
|
73438
|
-
|
|
73431
|
+
graphql27.visit(document, {
|
|
73439
73432
|
Field(node, _, __, ___, ancestors) {
|
|
73440
73433
|
const fieldType = parentTypeFromAncestors(config4.schema, filename, ancestors).name;
|
|
73441
73434
|
if (config4.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -73633,12 +73626,12 @@ async function processJSFile(config4, contents) {
|
|
|
73633
73626
|
return documents;
|
|
73634
73627
|
}
|
|
73635
73628
|
async function processGraphQLDocument(config4, filepath, document) {
|
|
73636
|
-
const parsedDoc =
|
|
73629
|
+
const parsedDoc = graphql28.parse(document);
|
|
73637
73630
|
const operations = parsedDoc.definitions.filter(
|
|
73638
|
-
({ kind: kind2 }) => kind2 ===
|
|
73631
|
+
({ kind: kind2 }) => kind2 === graphql28.Kind.OPERATION_DEFINITION
|
|
73639
73632
|
);
|
|
73640
73633
|
const fragments = parsedDoc.definitions.filter(
|
|
73641
|
-
({ kind: kind2 }) => kind2 ===
|
|
73634
|
+
({ kind: kind2 }) => kind2 === graphql28.Kind.FRAGMENT_DEFINITION
|
|
73642
73635
|
);
|
|
73643
73636
|
if (operations.length > 1) {
|
|
73644
73637
|
throw new HoudiniError({
|