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/test-esm/index.js
CHANGED
|
@@ -534,7 +534,7 @@ var require_kinds = __commonJS({
|
|
|
534
534
|
value: true
|
|
535
535
|
});
|
|
536
536
|
exports.Kind = void 0;
|
|
537
|
-
var
|
|
537
|
+
var Kind13 = Object.freeze({
|
|
538
538
|
NAME: "Name",
|
|
539
539
|
DOCUMENT: "Document",
|
|
540
540
|
OPERATION_DEFINITION: "OperationDefinition",
|
|
@@ -579,7 +579,7 @@ var require_kinds = __commonJS({
|
|
|
579
579
|
ENUM_TYPE_EXTENSION: "EnumTypeExtension",
|
|
580
580
|
INPUT_OBJECT_TYPE_EXTENSION: "InputObjectTypeExtension"
|
|
581
581
|
});
|
|
582
|
-
exports.Kind =
|
|
582
|
+
exports.Kind = Kind13;
|
|
583
583
|
}
|
|
584
584
|
});
|
|
585
585
|
|
|
@@ -9759,7 +9759,7 @@ var require_graphql = __commonJS({
|
|
|
9759
9759
|
Object.defineProperty(exports, "__esModule", {
|
|
9760
9760
|
value: true
|
|
9761
9761
|
});
|
|
9762
|
-
exports.graphql =
|
|
9762
|
+
exports.graphql = graphql27;
|
|
9763
9763
|
exports.graphqlSync = graphqlSync;
|
|
9764
9764
|
var _isPromise = _interopRequireDefault(require_isPromise());
|
|
9765
9765
|
var _parser = require_parser();
|
|
@@ -9769,7 +9769,7 @@ var require_graphql = __commonJS({
|
|
|
9769
9769
|
function _interopRequireDefault(obj) {
|
|
9770
9770
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
9771
9771
|
}
|
|
9772
|
-
function
|
|
9772
|
+
function graphql27(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
9773
9773
|
var _arguments = arguments;
|
|
9774
9774
|
return new Promise(function(resolve2) {
|
|
9775
9775
|
return resolve2(
|
|
@@ -53922,7 +53922,7 @@ var require_main2 = __commonJS({
|
|
|
53922
53922
|
});
|
|
53923
53923
|
|
|
53924
53924
|
// src/test/index.ts
|
|
53925
|
-
var
|
|
53925
|
+
var graphql26 = __toESM(require_graphql2(), 1);
|
|
53926
53926
|
var import_memfs2 = __toESM(require_lib(), 1);
|
|
53927
53927
|
|
|
53928
53928
|
// src/lib/pipeline.ts
|
|
@@ -56545,7 +56545,7 @@ async function cleanupFiles(pathFolder, listOfObj) {
|
|
|
56545
56545
|
}
|
|
56546
56546
|
|
|
56547
56547
|
// src/codegen/generators/artifacts/index.ts
|
|
56548
|
-
var
|
|
56548
|
+
var graphql12 = __toESM(require_graphql2(), 1);
|
|
56549
56549
|
var recast5 = __toESM(require_main2(), 1);
|
|
56550
56550
|
|
|
56551
56551
|
// src/codegen/utils/commonjs.ts
|
|
@@ -57149,7 +57149,7 @@ function ancestorKey(ancestors) {
|
|
|
57149
57149
|
}
|
|
57150
57150
|
|
|
57151
57151
|
// src/codegen/generators/artifacts/selection.ts
|
|
57152
|
-
var
|
|
57152
|
+
var graphql11 = __toESM(require_graphql2(), 1);
|
|
57153
57153
|
|
|
57154
57154
|
// ../../node_modules/.pnpm/@kitql+helper@0.5.0/node_modules/@kitql/helper/index.mjs
|
|
57155
57155
|
var config = {
|
|
@@ -57189,10 +57189,24 @@ function logYellow(str) {
|
|
|
57189
57189
|
}
|
|
57190
57190
|
|
|
57191
57191
|
// src/codegen/transforms/list.ts
|
|
57192
|
-
var
|
|
57192
|
+
var graphql9 = __toESM(require_graphql2(), 1);
|
|
57193
57193
|
|
|
57194
|
-
// src/codegen/
|
|
57194
|
+
// src/codegen/utils/objectIdentificationSelection.ts
|
|
57195
57195
|
var graphql7 = __toESM(require_graphql2(), 1);
|
|
57196
|
+
var objectIdentificationSelection = (config2, type) => {
|
|
57197
|
+
return config2.keyFieldsForType(type.name).map((key) => {
|
|
57198
|
+
return {
|
|
57199
|
+
kind: graphql7.Kind.FIELD,
|
|
57200
|
+
name: {
|
|
57201
|
+
kind: graphql7.Kind.NAME,
|
|
57202
|
+
value: key
|
|
57203
|
+
}
|
|
57204
|
+
};
|
|
57205
|
+
});
|
|
57206
|
+
};
|
|
57207
|
+
|
|
57208
|
+
// src/codegen/transforms/paginate.ts
|
|
57209
|
+
var graphql8 = __toESM(require_graphql2(), 1);
|
|
57196
57210
|
async function paginate(config2, documents) {
|
|
57197
57211
|
const newDocs = [];
|
|
57198
57212
|
for (const doc of documents) {
|
|
@@ -57225,7 +57239,7 @@ async function paginate(config2, documents) {
|
|
|
57225
57239
|
};
|
|
57226
57240
|
let cursorType = "String";
|
|
57227
57241
|
let paginationPath = [];
|
|
57228
|
-
doc.document =
|
|
57242
|
+
doc.document = graphql8.visit(doc.document, {
|
|
57229
57243
|
Field(node, _, __, ___, ancestors) {
|
|
57230
57244
|
const paginateDirective = node.directives?.find(
|
|
57231
57245
|
(directive) => directive.name.value === config2.paginateDirective
|
|
@@ -57252,7 +57266,7 @@ async function paginate(config2, documents) {
|
|
|
57252
57266
|
flags.offset.enabled = offsetPagination;
|
|
57253
57267
|
flags.limit.enabled = offsetPagination;
|
|
57254
57268
|
paginationPath = ancestors.filter(
|
|
57255
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
57269
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql8.Kind.FIELD
|
|
57256
57270
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
57257
57271
|
return {
|
|
57258
57272
|
...node,
|
|
@@ -57273,7 +57287,7 @@ async function paginate(config2, documents) {
|
|
|
57273
57287
|
refetchUpdate = "prepend" /* prepend */;
|
|
57274
57288
|
}
|
|
57275
57289
|
let fragment = "";
|
|
57276
|
-
doc.document =
|
|
57290
|
+
doc.document = graphql8.visit(doc.document, {
|
|
57277
57291
|
OperationDefinition(node) {
|
|
57278
57292
|
if (node.operation !== "query") {
|
|
57279
57293
|
throw new HoudiniError({
|
|
@@ -57327,9 +57341,9 @@ async function paginate(config2, documents) {
|
|
|
57327
57341
|
directives: [
|
|
57328
57342
|
...node.directives || [],
|
|
57329
57343
|
{
|
|
57330
|
-
kind:
|
|
57344
|
+
kind: graphql8.Kind.DIRECTIVE,
|
|
57331
57345
|
name: {
|
|
57332
|
-
kind:
|
|
57346
|
+
kind: graphql8.Kind.NAME,
|
|
57333
57347
|
value: config2.argumentsDirective
|
|
57334
57348
|
}
|
|
57335
57349
|
}
|
|
@@ -57392,16 +57406,16 @@ async function paginate(config2, documents) {
|
|
|
57392
57406
|
const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
57393
57407
|
const fragmentSpreadSelection = [
|
|
57394
57408
|
{
|
|
57395
|
-
kind:
|
|
57409
|
+
kind: graphql8.Kind.FRAGMENT_SPREAD,
|
|
57396
57410
|
name: {
|
|
57397
|
-
kind:
|
|
57411
|
+
kind: graphql8.Kind.NAME,
|
|
57398
57412
|
value: fragmentName
|
|
57399
57413
|
},
|
|
57400
57414
|
directives: [
|
|
57401
57415
|
{
|
|
57402
|
-
kind:
|
|
57416
|
+
kind: graphql8.Kind.DIRECTIVE,
|
|
57403
57417
|
name: {
|
|
57404
|
-
kind:
|
|
57418
|
+
kind: graphql8.Kind.NAME,
|
|
57405
57419
|
value: config2.withDirective
|
|
57406
57420
|
},
|
|
57407
57421
|
["arguments"]: paginationArgs.map(
|
|
@@ -57429,29 +57443,29 @@ async function paginate(config2, documents) {
|
|
|
57429
57443
|
});
|
|
57430
57444
|
const typeConfig = config2.typeConfig?.[fragment];
|
|
57431
57445
|
const queryDoc = {
|
|
57432
|
-
kind:
|
|
57446
|
+
kind: graphql8.Kind.DOCUMENT,
|
|
57433
57447
|
definitions: [
|
|
57434
57448
|
{
|
|
57435
|
-
kind:
|
|
57449
|
+
kind: graphql8.Kind.OPERATION_DEFINITION,
|
|
57436
57450
|
name: {
|
|
57437
|
-
kind:
|
|
57451
|
+
kind: graphql8.Kind.NAME,
|
|
57438
57452
|
value: refetchQueryName
|
|
57439
57453
|
},
|
|
57440
57454
|
operation: "query",
|
|
57441
57455
|
variableDefinitions: paginationArgs.map(
|
|
57442
57456
|
(arg) => ({
|
|
57443
|
-
kind:
|
|
57457
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57444
57458
|
type: {
|
|
57445
|
-
kind:
|
|
57459
|
+
kind: graphql8.Kind.NAMED_TYPE,
|
|
57446
57460
|
name: {
|
|
57447
|
-
kind:
|
|
57461
|
+
kind: graphql8.Kind.NAME,
|
|
57448
57462
|
value: arg.type
|
|
57449
57463
|
}
|
|
57450
57464
|
},
|
|
57451
57465
|
variable: {
|
|
57452
|
-
kind:
|
|
57466
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57453
57467
|
name: {
|
|
57454
|
-
kind:
|
|
57468
|
+
kind: graphql8.Kind.NAME,
|
|
57455
57469
|
value: arg.name
|
|
57456
57470
|
}
|
|
57457
57471
|
},
|
|
@@ -57463,12 +57477,12 @@ async function paginate(config2, documents) {
|
|
|
57463
57477
|
).concat(
|
|
57464
57478
|
!nodeQuery ? [] : keys.map(
|
|
57465
57479
|
(key) => ({
|
|
57466
|
-
kind:
|
|
57480
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57467
57481
|
type: key.type,
|
|
57468
57482
|
variable: {
|
|
57469
|
-
kind:
|
|
57483
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57470
57484
|
name: {
|
|
57471
|
-
kind:
|
|
57485
|
+
kind: graphql8.Kind.NAME,
|
|
57472
57486
|
value: key.name
|
|
57473
57487
|
}
|
|
57474
57488
|
}
|
|
@@ -57476,42 +57490,42 @@ async function paginate(config2, documents) {
|
|
|
57476
57490
|
)
|
|
57477
57491
|
),
|
|
57478
57492
|
selectionSet: {
|
|
57479
|
-
kind:
|
|
57493
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57480
57494
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
57481
57495
|
{
|
|
57482
|
-
kind:
|
|
57496
|
+
kind: graphql8.Kind.FIELD,
|
|
57483
57497
|
name: {
|
|
57484
|
-
kind:
|
|
57498
|
+
kind: graphql8.Kind.NAME,
|
|
57485
57499
|
value: typeConfig?.resolve?.queryField || "node"
|
|
57486
57500
|
},
|
|
57487
57501
|
["arguments"]: keys.map((key) => ({
|
|
57488
|
-
kind:
|
|
57502
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57489
57503
|
name: {
|
|
57490
|
-
kind:
|
|
57504
|
+
kind: graphql8.Kind.NAME,
|
|
57491
57505
|
value: key.name
|
|
57492
57506
|
},
|
|
57493
57507
|
value: {
|
|
57494
|
-
kind:
|
|
57508
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57495
57509
|
name: {
|
|
57496
|
-
kind:
|
|
57510
|
+
kind: graphql8.Kind.NAME,
|
|
57497
57511
|
value: key.name
|
|
57498
57512
|
}
|
|
57499
57513
|
}
|
|
57500
57514
|
})),
|
|
57501
57515
|
selectionSet: {
|
|
57502
|
-
kind:
|
|
57516
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57503
57517
|
selections: [
|
|
57504
57518
|
{
|
|
57505
|
-
kind:
|
|
57519
|
+
kind: graphql8.Kind.FIELD,
|
|
57506
57520
|
name: {
|
|
57507
|
-
kind:
|
|
57521
|
+
kind: graphql8.Kind.NAME,
|
|
57508
57522
|
value: "__typename"
|
|
57509
57523
|
}
|
|
57510
57524
|
},
|
|
57511
57525
|
...(typeConfig?.keys || ["id"]).map((key) => ({
|
|
57512
|
-
kind:
|
|
57526
|
+
kind: graphql8.Kind.FIELD,
|
|
57513
57527
|
name: {
|
|
57514
|
-
kind:
|
|
57528
|
+
kind: graphql8.Kind.NAME,
|
|
57515
57529
|
value: key
|
|
57516
57530
|
}
|
|
57517
57531
|
})),
|
|
@@ -57573,15 +57587,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
57573
57587
|
}
|
|
57574
57588
|
function variableAsArgument(name2, variable) {
|
|
57575
57589
|
return {
|
|
57576
|
-
kind:
|
|
57590
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57577
57591
|
name: {
|
|
57578
|
-
kind:
|
|
57592
|
+
kind: graphql8.Kind.NAME,
|
|
57579
57593
|
value: name2
|
|
57580
57594
|
},
|
|
57581
57595
|
value: {
|
|
57582
|
-
kind:
|
|
57596
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57583
57597
|
name: {
|
|
57584
|
-
kind:
|
|
57598
|
+
kind: graphql8.Kind.NAME,
|
|
57585
57599
|
value: variable ?? name2
|
|
57586
57600
|
}
|
|
57587
57601
|
}
|
|
@@ -57589,18 +57603,18 @@ function variableAsArgument(name2, variable) {
|
|
|
57589
57603
|
}
|
|
57590
57604
|
function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
57591
57605
|
return {
|
|
57592
|
-
kind:
|
|
57606
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57593
57607
|
type: {
|
|
57594
|
-
kind:
|
|
57608
|
+
kind: graphql8.Kind.NAMED_TYPE,
|
|
57595
57609
|
name: {
|
|
57596
|
-
kind:
|
|
57610
|
+
kind: graphql8.Kind.NAME,
|
|
57597
57611
|
value: type
|
|
57598
57612
|
}
|
|
57599
57613
|
},
|
|
57600
57614
|
variable: {
|
|
57601
|
-
kind:
|
|
57615
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57602
57616
|
name: {
|
|
57603
|
-
kind:
|
|
57617
|
+
kind: graphql8.Kind.NAME,
|
|
57604
57618
|
value: variableName ?? name2
|
|
57605
57619
|
}
|
|
57606
57620
|
},
|
|
@@ -57612,9 +57626,9 @@ function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
|
57612
57626
|
}
|
|
57613
57627
|
function argumentNode(name2, value) {
|
|
57614
57628
|
return {
|
|
57615
|
-
kind:
|
|
57629
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57616
57630
|
name: {
|
|
57617
|
-
kind:
|
|
57631
|
+
kind: graphql8.Kind.NAME,
|
|
57618
57632
|
value: name2
|
|
57619
57633
|
},
|
|
57620
57634
|
value: objectNode(value)
|
|
@@ -57622,16 +57636,16 @@ function argumentNode(name2, value) {
|
|
|
57622
57636
|
}
|
|
57623
57637
|
function objectNode([type, defaultValue]) {
|
|
57624
57638
|
const node = {
|
|
57625
|
-
kind:
|
|
57639
|
+
kind: graphql8.Kind.OBJECT,
|
|
57626
57640
|
fields: [
|
|
57627
57641
|
{
|
|
57628
|
-
kind:
|
|
57642
|
+
kind: graphql8.Kind.OBJECT_FIELD,
|
|
57629
57643
|
name: {
|
|
57630
|
-
kind:
|
|
57644
|
+
kind: graphql8.Kind.NAME,
|
|
57631
57645
|
value: "type"
|
|
57632
57646
|
},
|
|
57633
57647
|
value: {
|
|
57634
|
-
kind:
|
|
57648
|
+
kind: graphql8.Kind.STRING,
|
|
57635
57649
|
value: type
|
|
57636
57650
|
}
|
|
57637
57651
|
}
|
|
@@ -57639,8 +57653,8 @@ function objectNode([type, defaultValue]) {
|
|
|
57639
57653
|
};
|
|
57640
57654
|
if (defaultValue) {
|
|
57641
57655
|
node.fields.push({
|
|
57642
|
-
kind:
|
|
57643
|
-
name: { kind:
|
|
57656
|
+
kind: graphql8.Kind.OBJECT_FIELD,
|
|
57657
|
+
name: { kind: graphql8.Kind.NAME, value: "default" },
|
|
57644
57658
|
value: {
|
|
57645
57659
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
57646
57660
|
value: defaultValue.toString()
|
|
@@ -57651,34 +57665,34 @@ function objectNode([type, defaultValue]) {
|
|
|
57651
57665
|
}
|
|
57652
57666
|
var pageInfoSelection = [
|
|
57653
57667
|
{
|
|
57654
|
-
kind:
|
|
57668
|
+
kind: graphql8.Kind.FIELD,
|
|
57655
57669
|
name: {
|
|
57656
|
-
kind:
|
|
57670
|
+
kind: graphql8.Kind.NAME,
|
|
57657
57671
|
value: "edges"
|
|
57658
57672
|
},
|
|
57659
57673
|
selectionSet: {
|
|
57660
|
-
kind:
|
|
57674
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57661
57675
|
selections: [
|
|
57662
57676
|
{
|
|
57663
|
-
kind:
|
|
57677
|
+
kind: graphql8.Kind.FIELD,
|
|
57664
57678
|
name: {
|
|
57665
|
-
kind:
|
|
57679
|
+
kind: graphql8.Kind.NAME,
|
|
57666
57680
|
value: "cursor"
|
|
57667
57681
|
}
|
|
57668
57682
|
},
|
|
57669
57683
|
{
|
|
57670
|
-
kind:
|
|
57684
|
+
kind: graphql8.Kind.FIELD,
|
|
57671
57685
|
name: {
|
|
57672
|
-
kind:
|
|
57686
|
+
kind: graphql8.Kind.NAME,
|
|
57673
57687
|
value: "node"
|
|
57674
57688
|
},
|
|
57675
57689
|
selectionSet: {
|
|
57676
|
-
kind:
|
|
57690
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57677
57691
|
selections: [
|
|
57678
57692
|
{
|
|
57679
|
-
kind:
|
|
57693
|
+
kind: graphql8.Kind.FIELD,
|
|
57680
57694
|
name: {
|
|
57681
|
-
kind:
|
|
57695
|
+
kind: graphql8.Kind.NAME,
|
|
57682
57696
|
value: "__typename"
|
|
57683
57697
|
}
|
|
57684
57698
|
}
|
|
@@ -57689,39 +57703,39 @@ var pageInfoSelection = [
|
|
|
57689
57703
|
}
|
|
57690
57704
|
},
|
|
57691
57705
|
{
|
|
57692
|
-
kind:
|
|
57706
|
+
kind: graphql8.Kind.FIELD,
|
|
57693
57707
|
name: {
|
|
57694
|
-
kind:
|
|
57708
|
+
kind: graphql8.Kind.NAME,
|
|
57695
57709
|
value: "pageInfo"
|
|
57696
57710
|
},
|
|
57697
57711
|
selectionSet: {
|
|
57698
|
-
kind:
|
|
57712
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57699
57713
|
selections: [
|
|
57700
57714
|
{
|
|
57701
|
-
kind:
|
|
57715
|
+
kind: graphql8.Kind.FIELD,
|
|
57702
57716
|
name: {
|
|
57703
|
-
kind:
|
|
57717
|
+
kind: graphql8.Kind.NAME,
|
|
57704
57718
|
value: "hasPreviousPage"
|
|
57705
57719
|
}
|
|
57706
57720
|
},
|
|
57707
57721
|
{
|
|
57708
|
-
kind:
|
|
57722
|
+
kind: graphql8.Kind.FIELD,
|
|
57709
57723
|
name: {
|
|
57710
|
-
kind:
|
|
57724
|
+
kind: graphql8.Kind.NAME,
|
|
57711
57725
|
value: "hasNextPage"
|
|
57712
57726
|
}
|
|
57713
57727
|
},
|
|
57714
57728
|
{
|
|
57715
|
-
kind:
|
|
57729
|
+
kind: graphql8.Kind.FIELD,
|
|
57716
57730
|
name: {
|
|
57717
|
-
kind:
|
|
57731
|
+
kind: graphql8.Kind.NAME,
|
|
57718
57732
|
value: "startCursor"
|
|
57719
57733
|
}
|
|
57720
57734
|
},
|
|
57721
57735
|
{
|
|
57722
|
-
kind:
|
|
57736
|
+
kind: graphql8.Kind.FIELD,
|
|
57723
57737
|
name: {
|
|
57724
|
-
kind:
|
|
57738
|
+
kind: graphql8.Kind.NAME,
|
|
57725
57739
|
value: "endCursor"
|
|
57726
57740
|
}
|
|
57727
57741
|
}
|
|
@@ -57735,15 +57749,15 @@ async function addListFragments(config2, documents) {
|
|
|
57735
57749
|
const lists = {};
|
|
57736
57750
|
const errors = [];
|
|
57737
57751
|
for (const doc of documents) {
|
|
57738
|
-
doc.document =
|
|
57752
|
+
doc.document = graphql9.visit(doc.document, {
|
|
57739
57753
|
Directive(node, key, parent, path2, ancestors) {
|
|
57740
57754
|
if ([config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
57741
57755
|
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
57742
57756
|
let error = {
|
|
57743
|
-
...new
|
|
57757
|
+
...new graphql9.GraphQLError(
|
|
57744
57758
|
"",
|
|
57745
57759
|
node,
|
|
57746
|
-
new
|
|
57760
|
+
new graphql9.Source(""),
|
|
57747
57761
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
57748
57762
|
path2
|
|
57749
57763
|
),
|
|
@@ -57795,7 +57809,7 @@ async function addListFragments(config2, documents) {
|
|
|
57795
57809
|
{
|
|
57796
57810
|
kind: "Argument",
|
|
57797
57811
|
name: {
|
|
57798
|
-
kind:
|
|
57812
|
+
kind: graphql9.Kind.NAME,
|
|
57799
57813
|
value: "connection"
|
|
57800
57814
|
},
|
|
57801
57815
|
value: {
|
|
@@ -57842,10 +57856,13 @@ async function addListFragments(config2, documents) {
|
|
|
57842
57856
|
if (errors.length > 0) {
|
|
57843
57857
|
throw errors;
|
|
57844
57858
|
}
|
|
57845
|
-
const
|
|
57859
|
+
const validDeletes = [
|
|
57846
57860
|
...new Set(
|
|
57847
57861
|
Object.values(lists).map(({ type }) => {
|
|
57848
|
-
if (!(type instanceof
|
|
57862
|
+
if (!(type instanceof graphql9.GraphQLObjectType)) {
|
|
57863
|
+
return "";
|
|
57864
|
+
}
|
|
57865
|
+
if (config2.keyFieldsForType(type.name).length !== 1) {
|
|
57849
57866
|
return "";
|
|
57850
57867
|
}
|
|
57851
57868
|
return type.name;
|
|
@@ -57856,7 +57873,7 @@ async function addListFragments(config2, documents) {
|
|
|
57856
57873
|
return;
|
|
57857
57874
|
}
|
|
57858
57875
|
const generatedDoc = {
|
|
57859
|
-
kind:
|
|
57876
|
+
kind: graphql9.Kind.DOCUMENT,
|
|
57860
57877
|
definitions: Object.entries(lists).flatMap(
|
|
57861
57878
|
([name2, { selection: selection2, type }]) => {
|
|
57862
57879
|
const schemaType = config2.schema.getType(type.name);
|
|
@@ -57864,35 +57881,29 @@ async function addListFragments(config2, documents) {
|
|
|
57864
57881
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
57865
57882
|
}
|
|
57866
57883
|
const fragmentSelection = {
|
|
57867
|
-
kind:
|
|
57884
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
57868
57885
|
selections: [...selection2.selections]
|
|
57869
57886
|
};
|
|
57870
57887
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
57871
|
-
(field) => field.kind === "Field" && field.name.value
|
|
57888
|
+
(field) => field.kind === "Field" && config2.keyFieldsForType(type.name).includes(field.name.value)
|
|
57872
57889
|
)) {
|
|
57873
57890
|
fragmentSelection.selections = [
|
|
57874
57891
|
...fragmentSelection.selections,
|
|
57875
|
-
|
|
57876
|
-
kind: graphql8.Kind.FIELD,
|
|
57877
|
-
name: {
|
|
57878
|
-
kind: graphql8.Kind.NAME,
|
|
57879
|
-
value: "id"
|
|
57880
|
-
}
|
|
57881
|
-
}
|
|
57892
|
+
...objectIdentificationSelection(config2, type)
|
|
57882
57893
|
];
|
|
57883
57894
|
}
|
|
57884
57895
|
return [
|
|
57885
57896
|
{
|
|
57886
57897
|
name: {
|
|
57887
57898
|
value: config2.listInsertFragment(name2),
|
|
57888
|
-
kind:
|
|
57899
|
+
kind: graphql9.Kind.NAME
|
|
57889
57900
|
},
|
|
57890
|
-
kind:
|
|
57901
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57891
57902
|
selectionSet: fragmentSelection,
|
|
57892
57903
|
typeCondition: {
|
|
57893
|
-
kind:
|
|
57904
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57894
57905
|
name: {
|
|
57895
|
-
kind:
|
|
57906
|
+
kind: graphql9.Kind.NAME,
|
|
57896
57907
|
value: type.name
|
|
57897
57908
|
}
|
|
57898
57909
|
}
|
|
@@ -57900,52 +57911,32 @@ async function addListFragments(config2, documents) {
|
|
|
57900
57911
|
{
|
|
57901
57912
|
name: {
|
|
57902
57913
|
value: config2.listToggleFragment(name2),
|
|
57903
|
-
kind:
|
|
57904
|
-
},
|
|
57905
|
-
kind: graphql8.Kind.FRAGMENT_DEFINITION,
|
|
57906
|
-
selectionSet: {
|
|
57907
|
-
...fragmentSelection,
|
|
57908
|
-
selections: [
|
|
57909
|
-
...fragmentSelection.selections,
|
|
57910
|
-
{
|
|
57911
|
-
kind: graphql8.Kind.FIELD,
|
|
57912
|
-
name: {
|
|
57913
|
-
kind: graphql8.Kind.NAME,
|
|
57914
|
-
value: "id"
|
|
57915
|
-
}
|
|
57916
|
-
}
|
|
57917
|
-
]
|
|
57914
|
+
kind: graphql9.Kind.NAME
|
|
57918
57915
|
},
|
|
57916
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57917
|
+
selectionSet: fragmentSelection,
|
|
57919
57918
|
typeCondition: {
|
|
57920
|
-
kind:
|
|
57919
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57921
57920
|
name: {
|
|
57922
|
-
kind:
|
|
57921
|
+
kind: graphql9.Kind.NAME,
|
|
57923
57922
|
value: type.name
|
|
57924
57923
|
}
|
|
57925
57924
|
}
|
|
57926
57925
|
},
|
|
57927
57926
|
{
|
|
57928
|
-
kind:
|
|
57927
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57929
57928
|
name: {
|
|
57930
57929
|
value: config2.listRemoveFragment(name2),
|
|
57931
|
-
kind:
|
|
57930
|
+
kind: graphql9.Kind.NAME
|
|
57932
57931
|
},
|
|
57933
57932
|
selectionSet: {
|
|
57934
|
-
kind:
|
|
57935
|
-
selections: [
|
|
57936
|
-
{
|
|
57937
|
-
kind: graphql8.Kind.FIELD,
|
|
57938
|
-
name: {
|
|
57939
|
-
kind: graphql8.Kind.NAME,
|
|
57940
|
-
value: "id"
|
|
57941
|
-
}
|
|
57942
|
-
}
|
|
57943
|
-
]
|
|
57933
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
57934
|
+
selections: [...objectIdentificationSelection(config2, type)]
|
|
57944
57935
|
},
|
|
57945
57936
|
typeCondition: {
|
|
57946
|
-
kind:
|
|
57937
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57947
57938
|
name: {
|
|
57948
|
-
kind:
|
|
57939
|
+
kind: graphql9.Kind.NAME,
|
|
57949
57940
|
value: type.name
|
|
57950
57941
|
}
|
|
57951
57942
|
}
|
|
@@ -57953,15 +57944,15 @@ async function addListFragments(config2, documents) {
|
|
|
57953
57944
|
];
|
|
57954
57945
|
}
|
|
57955
57946
|
).concat(
|
|
57956
|
-
...
|
|
57957
|
-
kind:
|
|
57947
|
+
...validDeletes.map((typeName) => ({
|
|
57948
|
+
kind: graphql9.Kind.DIRECTIVE_DEFINITION,
|
|
57958
57949
|
name: {
|
|
57959
|
-
kind:
|
|
57950
|
+
kind: graphql9.Kind.NAME,
|
|
57960
57951
|
value: config2.listDeleteDirective(typeName)
|
|
57961
57952
|
},
|
|
57962
57953
|
locations: [
|
|
57963
57954
|
{
|
|
57964
|
-
kind:
|
|
57955
|
+
kind: graphql9.Kind.NAME,
|
|
57965
57956
|
value: "FIELD"
|
|
57966
57957
|
}
|
|
57967
57958
|
],
|
|
@@ -57969,8 +57960,8 @@ async function addListFragments(config2, documents) {
|
|
|
57969
57960
|
}))
|
|
57970
57961
|
)
|
|
57971
57962
|
};
|
|
57972
|
-
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(
|
|
57973
|
-
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(
|
|
57963
|
+
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql9.print).join("\n\n");
|
|
57964
|
+
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql9.print).join("\n\n");
|
|
57974
57965
|
documents.push({
|
|
57975
57966
|
name: "generated::lists",
|
|
57976
57967
|
kind: "HoudiniFragment" /* Fragment */,
|
|
@@ -58055,11 +58046,11 @@ var nodeNotDefinedMessage = (config2) => `Looks like you are trying to use the $
|
|
|
58055
58046
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
58056
58047
|
|
|
58057
58048
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
58058
|
-
var
|
|
58049
|
+
var graphql10 = __toESM(require_graphql2(), 1);
|
|
58059
58050
|
function fieldKey(config2, field) {
|
|
58060
58051
|
const attributeName = field.alias?.value || field.name.value;
|
|
58061
|
-
const printed =
|
|
58062
|
-
const secondParse =
|
|
58052
|
+
const printed = graphql10.print(field);
|
|
58053
|
+
const secondParse = graphql10.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
58063
58054
|
const paginated = !!field.directives?.find(
|
|
58064
58055
|
(directive) => directive.name.value === config2.paginateDirective
|
|
58065
58056
|
);
|
|
@@ -58152,8 +58143,8 @@ function selection({
|
|
|
58152
58143
|
const typeConditionName = field.typeCondition.name.value;
|
|
58153
58144
|
const typeCondition = config2.schema.getType(typeConditionName);
|
|
58154
58145
|
const possibleTypes = [];
|
|
58155
|
-
if (!
|
|
58156
|
-
} else if (
|
|
58146
|
+
if (!graphql11.isAbstractType(typeCondition)) {
|
|
58147
|
+
} else if (graphql11.isAbstractType(parentType)) {
|
|
58157
58148
|
const possibleParentTypes = config2.schema.getPossibleTypes(parentType).map((type) => type.name);
|
|
58158
58149
|
for (const possible of config2.schema.getPossibleTypes(typeCondition)) {
|
|
58159
58150
|
if (possibleParentTypes.includes(possible.name)) {
|
|
@@ -58201,7 +58192,7 @@ function selection({
|
|
|
58201
58192
|
} else {
|
|
58202
58193
|
let typeRef = type.getFields()[field.name.value].type;
|
|
58203
58194
|
fieldType = getRootType(typeRef);
|
|
58204
|
-
nullable = !
|
|
58195
|
+
nullable = !graphql11.isNonNullType(typeRef);
|
|
58205
58196
|
}
|
|
58206
58197
|
const typeName = fieldType.toString();
|
|
58207
58198
|
const pathSoFar = path2.concat(attributeName);
|
|
@@ -58266,7 +58257,7 @@ function selection({
|
|
|
58266
58257
|
{}
|
|
58267
58258
|
);
|
|
58268
58259
|
}
|
|
58269
|
-
if (
|
|
58260
|
+
if (graphql11.isInterfaceType(fieldType) || graphql11.isUnionType(fieldType)) {
|
|
58270
58261
|
fieldObj.abstract = true;
|
|
58271
58262
|
}
|
|
58272
58263
|
object.fields = {
|
|
@@ -58323,7 +58314,7 @@ function artifactGenerator(stats) {
|
|
|
58323
58314
|
return async function(config2, docs) {
|
|
58324
58315
|
const filterTypes = {};
|
|
58325
58316
|
for (const doc of docs) {
|
|
58326
|
-
|
|
58317
|
+
graphql12.visit(doc.document, {
|
|
58327
58318
|
Directive(node, _, __, ___, ancestors) {
|
|
58328
58319
|
if (node.name.value !== config2.listDirective) {
|
|
58329
58320
|
return;
|
|
@@ -58382,7 +58373,7 @@ function artifactGenerator(stats) {
|
|
|
58382
58373
|
return;
|
|
58383
58374
|
}
|
|
58384
58375
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
58385
|
-
let documentWithoutInternalDirectives =
|
|
58376
|
+
let documentWithoutInternalDirectives = graphql12.visit(document, {
|
|
58386
58377
|
Directive(node) {
|
|
58387
58378
|
if (config2.isInternalDirective(node)) {
|
|
58388
58379
|
return null;
|
|
@@ -58395,7 +58386,7 @@ function artifactGenerator(stats) {
|
|
|
58395
58386
|
}
|
|
58396
58387
|
}
|
|
58397
58388
|
});
|
|
58398
|
-
let documentWithoutExtraVariables =
|
|
58389
|
+
let documentWithoutExtraVariables = graphql12.visit(
|
|
58399
58390
|
documentWithoutInternalDirectives,
|
|
58400
58391
|
{
|
|
58401
58392
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -58406,13 +58397,13 @@ function artifactGenerator(stats) {
|
|
|
58406
58397
|
}
|
|
58407
58398
|
}
|
|
58408
58399
|
);
|
|
58409
|
-
let rawString =
|
|
58400
|
+
let rawString = graphql12.print(documentWithoutExtraVariables);
|
|
58410
58401
|
let docKind = doc.kind;
|
|
58411
58402
|
const operations = document.definitions.filter(
|
|
58412
|
-
({ kind }) => kind ===
|
|
58403
|
+
({ kind }) => kind === graphql12.Kind.OPERATION_DEFINITION
|
|
58413
58404
|
);
|
|
58414
58405
|
const fragments = document.definitions.filter(
|
|
58415
|
-
({ kind }) => kind ===
|
|
58406
|
+
({ kind }) => kind === graphql12.Kind.FRAGMENT_DEFINITION
|
|
58416
58407
|
);
|
|
58417
58408
|
let rootType = "";
|
|
58418
58409
|
let selectionSet;
|
|
@@ -58599,15 +58590,15 @@ async function generatePluginRuntime(config2, plugin) {
|
|
|
58599
58590
|
var recast10 = __toESM(require_main2(), 1);
|
|
58600
58591
|
|
|
58601
58592
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
58602
|
-
var
|
|
58593
|
+
var graphql15 = __toESM(require_graphql2(), 1);
|
|
58603
58594
|
var recast8 = __toESM(require_main2(), 1);
|
|
58604
58595
|
|
|
58605
58596
|
// src/codegen/generators/typescript/typeReference.ts
|
|
58606
|
-
var
|
|
58597
|
+
var graphql14 = __toESM(require_graphql2(), 1);
|
|
58607
58598
|
var recast7 = __toESM(require_main2(), 1);
|
|
58608
58599
|
|
|
58609
58600
|
// src/codegen/generators/typescript/types.ts
|
|
58610
|
-
var
|
|
58601
|
+
var graphql13 = __toESM(require_graphql2(), 1);
|
|
58611
58602
|
var recast6 = __toESM(require_main2(), 1);
|
|
58612
58603
|
var AST6 = recast6.types.builders;
|
|
58613
58604
|
function readonlyProperty(prop, enable = true) {
|
|
@@ -58641,7 +58632,7 @@ function scalarPropertyValue(config2, missingScalars, target) {
|
|
|
58641
58632
|
return AST6.tsStringKeyword();
|
|
58642
58633
|
}
|
|
58643
58634
|
default: {
|
|
58644
|
-
if (
|
|
58635
|
+
if (graphql13.isNonNullType(target) && "ofType" in target) {
|
|
58645
58636
|
return scalarPropertyValue(
|
|
58646
58637
|
config2,
|
|
58647
58638
|
missingScalars,
|
|
@@ -58662,7 +58653,7 @@ var AST7 = recast7.types.builders;
|
|
|
58662
58653
|
function tsTypeReference(config2, missingScalars, definition) {
|
|
58663
58654
|
const { type, wrappers } = unwrapType(config2, definition.type);
|
|
58664
58655
|
let result;
|
|
58665
|
-
if (
|
|
58656
|
+
if (graphql14.isScalarType(type)) {
|
|
58666
58657
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
58667
58658
|
} else {
|
|
58668
58659
|
result = AST7.tsTypeReference(AST7.identifier(type.name));
|
|
@@ -58683,17 +58674,17 @@ function tsTypeReference(config2, missingScalars, definition) {
|
|
|
58683
58674
|
var AST8 = recast8.types.builders;
|
|
58684
58675
|
function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
58685
58676
|
const { type } = unwrapType(config2, rootType);
|
|
58686
|
-
if (
|
|
58677
|
+
if (graphql15.isScalarType(type)) {
|
|
58687
58678
|
return;
|
|
58688
58679
|
}
|
|
58689
58680
|
if (visitedTypes.has(type.name)) {
|
|
58690
58681
|
return;
|
|
58691
58682
|
}
|
|
58692
|
-
if (
|
|
58683
|
+
if (graphql15.isUnionType(type)) {
|
|
58693
58684
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
58694
58685
|
}
|
|
58695
58686
|
visitedTypes.add(type.name);
|
|
58696
|
-
if (
|
|
58687
|
+
if (graphql15.isEnumType(type)) {
|
|
58697
58688
|
ensureImports({
|
|
58698
58689
|
config: config2,
|
|
58699
58690
|
body,
|
|
@@ -58710,7 +58701,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
58710
58701
|
AST8.tsPropertySignature(
|
|
58711
58702
|
AST8.identifier(field.name),
|
|
58712
58703
|
AST8.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
|
|
58713
|
-
|
|
58704
|
+
graphql15.isNullableType(field.type)
|
|
58714
58705
|
)
|
|
58715
58706
|
);
|
|
58716
58707
|
}
|
|
@@ -58718,7 +58709,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
58718
58709
|
}
|
|
58719
58710
|
|
|
58720
58711
|
// src/codegen/generators/typescript/inlineType.ts
|
|
58721
|
-
var
|
|
58712
|
+
var graphql16 = __toESM(require_graphql2(), 1);
|
|
58722
58713
|
var recast9 = __toESM(require_main2(), 1);
|
|
58723
58714
|
var AST9 = recast9.types.builders;
|
|
58724
58715
|
var fragmentKey = "$fragments";
|
|
@@ -58737,9 +58728,9 @@ function inlineType({
|
|
|
58737
58728
|
}) {
|
|
58738
58729
|
const { type, wrappers } = unwrapType(config2, rootType);
|
|
58739
58730
|
let result;
|
|
58740
|
-
if (
|
|
58731
|
+
if (graphql16.isScalarType(type)) {
|
|
58741
58732
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
58742
|
-
} else if (
|
|
58733
|
+
} else if (graphql16.isEnumType(type)) {
|
|
58743
58734
|
if (!visitedTypes.has(type.name)) {
|
|
58744
58735
|
ensureImports({
|
|
58745
58736
|
config: config2,
|
|
@@ -58757,11 +58748,11 @@ function inlineType({
|
|
|
58757
58748
|
for (const selection2 of selections) {
|
|
58758
58749
|
if (selection2.kind === "InlineFragment" && selection2.typeCondition) {
|
|
58759
58750
|
const fragmentType = config2.schema.getType(selection2.typeCondition.name.value);
|
|
58760
|
-
if (!
|
|
58751
|
+
if (!graphql16.isInterfaceType(type) && !graphql16.isUnionType(type)) {
|
|
58761
58752
|
selectedFields.push(...selection2.selectionSet.selections);
|
|
58762
58753
|
continue;
|
|
58763
58754
|
}
|
|
58764
|
-
if (!
|
|
58755
|
+
if (!graphql16.isInterfaceType(fragmentType) && !graphql16.isUnionType(fragmentType)) {
|
|
58765
58756
|
if (!inlineFragments[fragmentType.name]) {
|
|
58766
58757
|
inlineFragments[fragmentType.name] = [];
|
|
58767
58758
|
}
|
|
@@ -58881,7 +58872,7 @@ function inlineType({
|
|
|
58881
58872
|
}
|
|
58882
58873
|
}
|
|
58883
58874
|
}
|
|
58884
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
58875
|
+
if (objectType.type === "TSTypeLiteral" && !graphql16.isInterfaceType(fragmentRootType) && !graphql16.isUnionType(fragmentRootType)) {
|
|
58885
58876
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
58886
58877
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
58887
58878
|
);
|
|
@@ -58948,7 +58939,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58948
58939
|
},
|
|
58949
58940
|
type: schema.getType("String")
|
|
58950
58941
|
};
|
|
58951
|
-
} else if (
|
|
58942
|
+
} else if (graphql16.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
58952
58943
|
fields = rootType.ofType.getFields();
|
|
58953
58944
|
} else {
|
|
58954
58945
|
fields = rootType.getFields();
|
|
@@ -58960,7 +58951,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58960
58951
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
58961
58952
|
});
|
|
58962
58953
|
}
|
|
58963
|
-
const fieldType =
|
|
58954
|
+
const fieldType = graphql16.getNamedType(field.type);
|
|
58964
58955
|
if (!fieldType) {
|
|
58965
58956
|
throw new HoudiniError({
|
|
58966
58957
|
filepath,
|
|
@@ -59280,7 +59271,7 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
59280
59271
|
}
|
|
59281
59272
|
|
|
59282
59273
|
// src/codegen/generators/persistedQueries/index.ts
|
|
59283
|
-
var
|
|
59274
|
+
var graphql17 = __toESM(require_graphql2(), 1);
|
|
59284
59275
|
async function persistOutputGenerator(config2, docs) {
|
|
59285
59276
|
if (typeof config2.persistedQueryPath !== "string" || config2.persistedQueryPath.length === 0)
|
|
59286
59277
|
return;
|
|
@@ -59292,8 +59283,8 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59292
59283
|
if (!generateArtifact) {
|
|
59293
59284
|
return acc;
|
|
59294
59285
|
}
|
|
59295
|
-
let rawString =
|
|
59296
|
-
|
|
59286
|
+
let rawString = graphql17.print(
|
|
59287
|
+
graphql17.visit(document, {
|
|
59297
59288
|
Directive(node) {
|
|
59298
59289
|
if (config2.isInternalDirective(node)) {
|
|
59299
59290
|
return null;
|
|
@@ -59302,7 +59293,7 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59302
59293
|
})
|
|
59303
59294
|
);
|
|
59304
59295
|
const operations = document.definitions.filter(
|
|
59305
|
-
({ kind }) => kind ===
|
|
59296
|
+
({ kind }) => kind === graphql17.Kind.OPERATION_DEFINITION
|
|
59306
59297
|
);
|
|
59307
59298
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
59308
59299
|
acc[hashDocument(rawString)] = rawString;
|
|
@@ -59315,11 +59306,11 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59315
59306
|
}
|
|
59316
59307
|
|
|
59317
59308
|
// src/codegen/generators/definitions/enums.ts
|
|
59318
|
-
var
|
|
59309
|
+
var graphql18 = __toESM(require_graphql2(), 1);
|
|
59319
59310
|
var recast11 = __toESM(require_main2(), 1);
|
|
59320
59311
|
var AST11 = recast11.types.builders;
|
|
59321
59312
|
async function definitionsGenerator(config2) {
|
|
59322
|
-
const enums =
|
|
59313
|
+
const enums = graphql18.parse(graphql18.printSchema(config2.schema)).definitions.filter(
|
|
59323
59314
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
59324
59315
|
).filter((def) => !config2.isInternalEnum(def));
|
|
59325
59316
|
const runtimeDefinitions = recast11.print(
|
|
@@ -59492,7 +59483,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
59492
59483
|
}
|
|
59493
59484
|
|
|
59494
59485
|
// src/codegen/transforms/schema.ts
|
|
59495
|
-
var
|
|
59486
|
+
var graphql20 = __toESM(require_graphql2(), 1);
|
|
59496
59487
|
async function graphqlExtensions(config2, documents) {
|
|
59497
59488
|
const internalSchema = `
|
|
59498
59489
|
enum CachePolicy {
|
|
@@ -59570,19 +59561,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
59570
59561
|
"""
|
|
59571
59562
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
59572
59563
|
`;
|
|
59573
|
-
let currentSchema =
|
|
59564
|
+
let currentSchema = graphql20.printSchema(config2.schema);
|
|
59574
59565
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
59575
59566
|
currentSchema += internalSchema;
|
|
59576
59567
|
}
|
|
59577
59568
|
config2.newSchema += internalSchema;
|
|
59578
|
-
config2.schema =
|
|
59569
|
+
config2.schema = graphql20.buildSchema(currentSchema);
|
|
59579
59570
|
}
|
|
59580
59571
|
|
|
59581
59572
|
// src/codegen/transforms/typename.ts
|
|
59582
|
-
var
|
|
59573
|
+
var graphql21 = __toESM(require_graphql2(), 1);
|
|
59583
59574
|
async function addTypename(config2, documents) {
|
|
59584
59575
|
for (const doc of documents) {
|
|
59585
|
-
doc.document =
|
|
59576
|
+
doc.document = graphql21.visit(doc.document, {
|
|
59586
59577
|
Field(node, key, parent, path2, ancestors) {
|
|
59587
59578
|
if (!node.selectionSet) {
|
|
59588
59579
|
return;
|
|
@@ -59594,7 +59585,7 @@ async function addTypename(config2, documents) {
|
|
|
59594
59585
|
);
|
|
59595
59586
|
const field = type.getFields()[node.name.value];
|
|
59596
59587
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59597
|
-
if (
|
|
59588
|
+
if (graphql21.isInterfaceType(fieldType) || graphql21.isUnionType(fieldType)) {
|
|
59598
59589
|
return {
|
|
59599
59590
|
...node,
|
|
59600
59591
|
selectionSet: {
|
|
@@ -59602,9 +59593,9 @@ async function addTypename(config2, documents) {
|
|
|
59602
59593
|
selections: [
|
|
59603
59594
|
...node.selectionSet.selections,
|
|
59604
59595
|
{
|
|
59605
|
-
kind:
|
|
59596
|
+
kind: graphql21.Kind.FIELD,
|
|
59606
59597
|
name: {
|
|
59607
|
-
kind:
|
|
59598
|
+
kind: graphql21.Kind.NAME,
|
|
59608
59599
|
value: "__typename"
|
|
59609
59600
|
}
|
|
59610
59601
|
}
|
|
@@ -59618,10 +59609,10 @@ async function addTypename(config2, documents) {
|
|
|
59618
59609
|
}
|
|
59619
59610
|
|
|
59620
59611
|
// src/codegen/transforms/addID.ts
|
|
59621
|
-
var
|
|
59612
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
59622
59613
|
async function addID(config2, documents) {
|
|
59623
59614
|
for (const doc of documents) {
|
|
59624
|
-
doc.document =
|
|
59615
|
+
doc.document = graphql22.visit(doc.document, {
|
|
59625
59616
|
Field(node, key, parent, path2, ancestors) {
|
|
59626
59617
|
if (!node.selectionSet) {
|
|
59627
59618
|
return;
|
|
@@ -59634,7 +59625,7 @@ async function addID(config2, documents) {
|
|
|
59634
59625
|
const field = type.getFields()[node.name.value];
|
|
59635
59626
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59636
59627
|
if (node.selectionSet?.selections.length > 0) {
|
|
59637
|
-
if (!
|
|
59628
|
+
if (!graphql22.isObjectType(fieldType) && !graphql22.isInterfaceType(fieldType)) {
|
|
59638
59629
|
return;
|
|
59639
59630
|
}
|
|
59640
59631
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -59649,9 +59640,9 @@ async function addID(config2, documents) {
|
|
|
59649
59640
|
continue;
|
|
59650
59641
|
}
|
|
59651
59642
|
selections.push({
|
|
59652
|
-
kind:
|
|
59643
|
+
kind: graphql22.Kind.FIELD,
|
|
59653
59644
|
name: {
|
|
59654
|
-
kind:
|
|
59645
|
+
kind: graphql22.Kind.NAME,
|
|
59655
59646
|
value: keyField
|
|
59656
59647
|
}
|
|
59657
59648
|
});
|
|
@@ -59670,8 +59661,8 @@ async function addID(config2, documents) {
|
|
|
59670
59661
|
}
|
|
59671
59662
|
|
|
59672
59663
|
// src/codegen/transforms/fragmentVariables.ts
|
|
59673
|
-
var
|
|
59674
|
-
var GraphqlKinds2 =
|
|
59664
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
59665
|
+
var GraphqlKinds2 = graphql23.Kind;
|
|
59675
59666
|
async function fragmentVariables(config2, documents) {
|
|
59676
59667
|
const fragments = collectFragments(config2, documents);
|
|
59677
59668
|
const generatedFragments = {};
|
|
@@ -59694,7 +59685,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
59694
59685
|
});
|
|
59695
59686
|
}
|
|
59696
59687
|
const doc = {
|
|
59697
|
-
kind:
|
|
59688
|
+
kind: graphql23.Kind.DOCUMENT,
|
|
59698
59689
|
definitions: Object.values(generatedFragments)
|
|
59699
59690
|
};
|
|
59700
59691
|
documents.push({
|
|
@@ -59730,7 +59721,7 @@ function inlineFragmentArgs({
|
|
|
59730
59721
|
filepath,
|
|
59731
59722
|
document
|
|
59732
59723
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
59733
|
-
const result =
|
|
59724
|
+
const result = graphql23.visit(document, {
|
|
59734
59725
|
FragmentSpread(node) {
|
|
59735
59726
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
59736
59727
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -59818,7 +59809,7 @@ function inlineFragmentArgs({
|
|
|
59818
59809
|
});
|
|
59819
59810
|
if (newName) {
|
|
59820
59811
|
result.name = {
|
|
59821
|
-
kind:
|
|
59812
|
+
kind: graphql23.Kind.NAME,
|
|
59822
59813
|
value: newName
|
|
59823
59814
|
};
|
|
59824
59815
|
}
|
|
@@ -59930,7 +59921,7 @@ function operationScope(operation) {
|
|
|
59930
59921
|
}
|
|
59931
59922
|
|
|
59932
59923
|
// src/codegen/validators/typeCheck.ts
|
|
59933
|
-
var
|
|
59924
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
59934
59925
|
async function typeCheck(config2, docs) {
|
|
59935
59926
|
const errors = [];
|
|
59936
59927
|
const freeLists = [];
|
|
@@ -59938,11 +59929,11 @@ async function typeCheck(config2, docs) {
|
|
|
59938
59929
|
const listTypes = [];
|
|
59939
59930
|
const fragments = {};
|
|
59940
59931
|
for (const { document: parsed, filename } of docs) {
|
|
59941
|
-
|
|
59942
|
-
[
|
|
59932
|
+
graphql24.visit(parsed, {
|
|
59933
|
+
[graphql24.Kind.FRAGMENT_DEFINITION](definition) {
|
|
59943
59934
|
fragments[definition.name.value] = definition;
|
|
59944
59935
|
},
|
|
59945
|
-
[
|
|
59936
|
+
[graphql24.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
59946
59937
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
59947
59938
|
return;
|
|
59948
59939
|
}
|
|
@@ -59988,14 +59979,14 @@ async function typeCheck(config2, docs) {
|
|
|
59988
59979
|
);
|
|
59989
59980
|
return;
|
|
59990
59981
|
}
|
|
59991
|
-
if (
|
|
59982
|
+
if (graphql24.isListType(rootType) || graphql24.isNonNullType(rootType) && graphql24.isListType(rootType.ofType)) {
|
|
59992
59983
|
needsParent = true;
|
|
59993
59984
|
break;
|
|
59994
59985
|
}
|
|
59995
|
-
if (
|
|
59986
|
+
if (graphql24.isNonNullType(rootType) && "ofType" in rootType) {
|
|
59996
59987
|
rootType = rootType.ofType;
|
|
59997
59988
|
}
|
|
59998
|
-
if (
|
|
59989
|
+
if (graphql24.isScalarType(rootType)) {
|
|
59999
59990
|
break;
|
|
60000
59991
|
}
|
|
60001
59992
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -60051,7 +60042,7 @@ async function typeCheck(config2, docs) {
|
|
|
60051
60042
|
);
|
|
60052
60043
|
const targetField = ancestors[ancestors.length - 1];
|
|
60053
60044
|
const targetFieldDefinition = pType.getFields()[targetField.name.value];
|
|
60054
|
-
const { type, error } = connectionSelection(
|
|
60045
|
+
const { type, error: errorConnectionSelection } = connectionSelection(
|
|
60055
60046
|
config2,
|
|
60056
60047
|
targetFieldDefinition,
|
|
60057
60048
|
parentTypeFromAncestors(
|
|
@@ -60061,10 +60052,19 @@ async function typeCheck(config2, docs) {
|
|
|
60061
60052
|
),
|
|
60062
60053
|
targetField.selectionSet
|
|
60063
60054
|
);
|
|
60055
|
+
if (errorConnectionSelection && directive.name.value === config2.paginateDirective) {
|
|
60056
|
+
errors.push(
|
|
60057
|
+
new HoudiniError({
|
|
60058
|
+
filepath: filename,
|
|
60059
|
+
message: errorConnectionSelection,
|
|
60060
|
+
description: errorConnectionSelection
|
|
60061
|
+
})
|
|
60062
|
+
);
|
|
60063
|
+
}
|
|
60064
60064
|
let targetTypes = [type];
|
|
60065
|
-
if (
|
|
60065
|
+
if (graphql24.isUnionType(type)) {
|
|
60066
60066
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
60067
|
-
} else if (
|
|
60067
|
+
} else if (graphql24.isInterfaceType(type)) {
|
|
60068
60068
|
try {
|
|
60069
60069
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
60070
60070
|
if (!type.getFields()[key]) {
|
|
@@ -60078,23 +60078,16 @@ async function typeCheck(config2, docs) {
|
|
|
60078
60078
|
for (const targetType of targetTypes) {
|
|
60079
60079
|
const missingIDFields = config2.keyFieldsForType(targetType.name).filter((fieldName) => !targetType.getFields()[fieldName]);
|
|
60080
60080
|
if (missingIDFields.length > 0) {
|
|
60081
|
-
|
|
60082
|
-
|
|
60083
|
-
|
|
60084
|
-
|
|
60085
|
-
|
|
60086
|
-
|
|
60087
|
-
|
|
60088
|
-
|
|
60089
|
-
|
|
60090
|
-
|
|
60091
|
-
filepath: filename,
|
|
60092
|
-
message: `@${config2.listDirective} can only be applied to types with the necessary id fields: ${missingIDFields.join(
|
|
60093
|
-
", "
|
|
60094
|
-
)}.`
|
|
60095
|
-
})
|
|
60096
|
-
);
|
|
60097
|
-
}
|
|
60081
|
+
const message = `@${config2.listDirective} on ${logGreen(
|
|
60082
|
+
targetType.name
|
|
60083
|
+
)} as a configuration issue. Object identification missing: ${missingIDFields.map((c) => `"${logYellow(c)}"`).join(", ")}. Check 'Custom IDs' if needed.`;
|
|
60084
|
+
errors.push(
|
|
60085
|
+
new HoudiniError({
|
|
60086
|
+
filepath: filename,
|
|
60087
|
+
message,
|
|
60088
|
+
description: message
|
|
60089
|
+
})
|
|
60090
|
+
);
|
|
60098
60091
|
return;
|
|
60099
60092
|
}
|
|
60100
60093
|
}
|
|
@@ -60109,13 +60102,13 @@ async function typeCheck(config2, docs) {
|
|
|
60109
60102
|
if (errors.length > 0) {
|
|
60110
60103
|
throw errors;
|
|
60111
60104
|
}
|
|
60112
|
-
const rules = (filepath) => [...
|
|
60105
|
+
const rules = (filepath) => [...graphql24.specifiedRules].filter(
|
|
60113
60106
|
(rule) => ![
|
|
60114
|
-
|
|
60115
|
-
|
|
60116
|
-
|
|
60117
|
-
|
|
60118
|
-
|
|
60107
|
+
graphql24.NoUnusedFragmentsRule,
|
|
60108
|
+
graphql24.KnownFragmentNamesRule,
|
|
60109
|
+
graphql24.ExecutableDefinitionsRule,
|
|
60110
|
+
graphql24.KnownDirectivesRule,
|
|
60111
|
+
graphql24.KnownArgumentNamesRule
|
|
60119
60112
|
].includes(rule)
|
|
60120
60113
|
).concat(
|
|
60121
60114
|
validateLists({
|
|
@@ -60134,7 +60127,7 @@ async function typeCheck(config2, docs) {
|
|
|
60134
60127
|
noUnusedFragmentArguments(config2)
|
|
60135
60128
|
);
|
|
60136
60129
|
for (const { filename, document: parsed } of docs) {
|
|
60137
|
-
for (const error of
|
|
60130
|
+
for (const error of graphql24.validate(config2.schema, parsed, rules(filename))) {
|
|
60138
60131
|
errors.push(
|
|
60139
60132
|
new HoudiniError({
|
|
60140
60133
|
filepath: filename,
|
|
@@ -60160,7 +60153,7 @@ var validateLists = ({
|
|
|
60160
60153
|
if (!config2.isListFragment(node.name.value)) {
|
|
60161
60154
|
if (!fragments[node.name.value]) {
|
|
60162
60155
|
ctx.reportError(
|
|
60163
|
-
new
|
|
60156
|
+
new graphql24.GraphQLError(
|
|
60164
60157
|
"Encountered unknown fragment: " + node.name.value
|
|
60165
60158
|
)
|
|
60166
60159
|
);
|
|
@@ -60170,7 +60163,7 @@ var validateLists = ({
|
|
|
60170
60163
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
60171
60164
|
if (!lists.includes(listName)) {
|
|
60172
60165
|
ctx.reportError(
|
|
60173
|
-
new
|
|
60166
|
+
new graphql24.GraphQLError(
|
|
60174
60167
|
"Encountered fragment referencing unknown list: " + listName
|
|
60175
60168
|
)
|
|
60176
60169
|
);
|
|
@@ -60195,7 +60188,7 @@ var validateLists = ({
|
|
|
60195
60188
|
);
|
|
60196
60189
|
if (parentArg) {
|
|
60197
60190
|
ctx.reportError(
|
|
60198
|
-
new
|
|
60191
|
+
new graphql24.GraphQLError(
|
|
60199
60192
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
60200
60193
|
)
|
|
60201
60194
|
);
|
|
@@ -60211,7 +60204,7 @@ var validateLists = ({
|
|
|
60211
60204
|
return;
|
|
60212
60205
|
}
|
|
60213
60206
|
ctx.reportError(
|
|
60214
|
-
new
|
|
60207
|
+
new graphql24.GraphQLError(
|
|
60215
60208
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
60216
60209
|
)
|
|
60217
60210
|
);
|
|
@@ -60221,7 +60214,7 @@ var validateLists = ({
|
|
|
60221
60214
|
const directiveName = node.name.value;
|
|
60222
60215
|
if (directiveName === "connection") {
|
|
60223
60216
|
ctx.reportError(
|
|
60224
|
-
new
|
|
60217
|
+
new graphql24.GraphQLError(
|
|
60225
60218
|
"@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."
|
|
60226
60219
|
)
|
|
60227
60220
|
);
|
|
@@ -60230,7 +60223,7 @@ var validateLists = ({
|
|
|
60230
60223
|
if (!config2.isInternalDirective(node)) {
|
|
60231
60224
|
if (!config2.schema.getDirective(directiveName)) {
|
|
60232
60225
|
ctx.reportError(
|
|
60233
|
-
new
|
|
60226
|
+
new graphql24.GraphQLError(
|
|
60234
60227
|
"Encountered unknown directive: " + directiveName
|
|
60235
60228
|
)
|
|
60236
60229
|
);
|
|
@@ -60239,7 +60232,7 @@ var validateLists = ({
|
|
|
60239
60232
|
}
|
|
60240
60233
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
60241
60234
|
ctx.reportError(
|
|
60242
|
-
new
|
|
60235
|
+
new graphql24.GraphQLError(
|
|
60243
60236
|
"Encountered directive referencing unknown list: " + directiveName
|
|
60244
60237
|
)
|
|
60245
60238
|
);
|
|
@@ -60250,7 +60243,7 @@ var validateLists = ({
|
|
|
60250
60243
|
};
|
|
60251
60244
|
function knownArguments(config2) {
|
|
60252
60245
|
return function(ctx) {
|
|
60253
|
-
const nativeValidator =
|
|
60246
|
+
const nativeValidator = graphql24.KnownArgumentNamesRule(ctx);
|
|
60254
60247
|
return {
|
|
60255
60248
|
...nativeValidator,
|
|
60256
60249
|
Directive(directiveNode) {
|
|
@@ -60283,7 +60276,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60283
60276
|
for (const arg of node.arguments || []) {
|
|
60284
60277
|
if (arg.value.kind !== "ObjectValue") {
|
|
60285
60278
|
ctx.reportError(
|
|
60286
|
-
new
|
|
60279
|
+
new graphql24.GraphQLError("values in @arguments must be an object")
|
|
60287
60280
|
);
|
|
60288
60281
|
return;
|
|
60289
60282
|
}
|
|
@@ -60293,13 +60286,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60293
60286
|
);
|
|
60294
60287
|
if (!typeArg) {
|
|
60295
60288
|
ctx.reportError(
|
|
60296
|
-
new
|
|
60289
|
+
new graphql24.GraphQLError("missing type field for @arguments directive")
|
|
60297
60290
|
);
|
|
60298
60291
|
return;
|
|
60299
60292
|
}
|
|
60300
|
-
if (typeArg.value.kind !==
|
|
60293
|
+
if (typeArg.value.kind !== graphql24.Kind.STRING) {
|
|
60301
60294
|
ctx.reportError(
|
|
60302
|
-
new
|
|
60295
|
+
new graphql24.GraphQLError("type field to @arguments must be a string")
|
|
60303
60296
|
);
|
|
60304
60297
|
return;
|
|
60305
60298
|
}
|
|
@@ -60312,7 +60305,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60312
60305
|
);
|
|
60313
60306
|
if (typeArg.value.value !== defaultValueType) {
|
|
60314
60307
|
ctx.reportError(
|
|
60315
|
-
new
|
|
60308
|
+
new graphql24.GraphQLError(
|
|
60316
60309
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
60317
60310
|
)
|
|
60318
60311
|
);
|
|
@@ -60330,7 +60323,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60330
60323
|
try {
|
|
60331
60324
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
60332
60325
|
} catch (e) {
|
|
60333
|
-
ctx.reportError(new
|
|
60326
|
+
ctx.reportError(new graphql24.GraphQLError(e.message));
|
|
60334
60327
|
return;
|
|
60335
60328
|
}
|
|
60336
60329
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -60353,7 +60346,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60353
60346
|
);
|
|
60354
60347
|
if (missing.length > 0) {
|
|
60355
60348
|
ctx.reportError(
|
|
60356
|
-
new
|
|
60349
|
+
new graphql24.GraphQLError(
|
|
60357
60350
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
60358
60351
|
)
|
|
60359
60352
|
);
|
|
@@ -60364,7 +60357,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60364
60357
|
);
|
|
60365
60358
|
if (unknown.length > 0) {
|
|
60366
60359
|
ctx.reportError(
|
|
60367
|
-
new
|
|
60360
|
+
new graphql24.GraphQLError(
|
|
60368
60361
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
60369
60362
|
)
|
|
60370
60363
|
);
|
|
@@ -60376,7 +60369,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60376
60369
|
]
|
|
60377
60370
|
);
|
|
60378
60371
|
for (const [applied, target] of zipped) {
|
|
60379
|
-
if (applied.value.kind ===
|
|
60372
|
+
if (applied.value.kind === graphql24.Kind.VARIABLE || applied.value.kind === graphql24.Kind.LIST || applied.value.kind === graphql24.Kind.OBJECT) {
|
|
60380
60373
|
continue;
|
|
60381
60374
|
}
|
|
60382
60375
|
const appliedType = applied.value.kind.substring(
|
|
@@ -60385,7 +60378,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60385
60378
|
);
|
|
60386
60379
|
if (appliedType !== target) {
|
|
60387
60380
|
ctx.reportError(
|
|
60388
|
-
new
|
|
60381
|
+
new graphql24.GraphQLError(
|
|
60389
60382
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
60390
60383
|
)
|
|
60391
60384
|
);
|
|
@@ -60406,7 +60399,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60406
60399
|
}
|
|
60407
60400
|
if (alreadyPaginated) {
|
|
60408
60401
|
ctx.reportError(
|
|
60409
|
-
new
|
|
60402
|
+
new graphql24.GraphQLError(
|
|
60410
60403
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
60411
60404
|
)
|
|
60412
60405
|
);
|
|
@@ -60421,7 +60414,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60421
60414
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
60422
60415
|
if (hasRequiredArgs) {
|
|
60423
60416
|
ctx.reportError(
|
|
60424
|
-
new
|
|
60417
|
+
new graphql24.GraphQLError(
|
|
60425
60418
|
"@paginate cannot appear on a document with required args"
|
|
60426
60419
|
)
|
|
60427
60420
|
);
|
|
@@ -60453,14 +60446,14 @@ function paginateArgs(config2, filepath) {
|
|
|
60453
60446
|
const backwards = appliedArgs.has("last");
|
|
60454
60447
|
if (!forward && !backwards) {
|
|
60455
60448
|
ctx.reportError(
|
|
60456
|
-
new
|
|
60449
|
+
new graphql24.GraphQLError(
|
|
60457
60450
|
"A field with cursor-based pagination must have a first or last argument"
|
|
60458
60451
|
)
|
|
60459
60452
|
);
|
|
60460
60453
|
}
|
|
60461
60454
|
if (forward && backwards) {
|
|
60462
60455
|
ctx.reportError(
|
|
60463
|
-
new
|
|
60456
|
+
new graphql24.GraphQLError(
|
|
60464
60457
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
60465
60458
|
)
|
|
60466
60459
|
);
|
|
@@ -60474,7 +60467,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60474
60467
|
);
|
|
60475
60468
|
if (!appliedLimitArg) {
|
|
60476
60469
|
ctx.reportError(
|
|
60477
|
-
new
|
|
60470
|
+
new graphql24.GraphQLError(
|
|
60478
60471
|
"A field with offset-based pagination must have a limit argument"
|
|
60479
60472
|
)
|
|
60480
60473
|
);
|
|
@@ -60490,20 +60483,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
60490
60483
|
const args = /* @__PURE__ */ new Set();
|
|
60491
60484
|
return {
|
|
60492
60485
|
enter(node) {
|
|
60493
|
-
if (node.kind ===
|
|
60486
|
+
if (node.kind === graphql24.Kind.FRAGMENT_DEFINITION) {
|
|
60494
60487
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
60495
60488
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
60496
60489
|
args.add(arg);
|
|
60497
60490
|
}
|
|
60498
|
-
} else if (node.kind ===
|
|
60491
|
+
} else if (node.kind === graphql24.Kind.VARIABLE) {
|
|
60499
60492
|
args.delete(node.name.value);
|
|
60500
60493
|
}
|
|
60501
60494
|
},
|
|
60502
60495
|
leave(node) {
|
|
60503
|
-
if (node.kind ===
|
|
60496
|
+
if (node.kind === graphql24.Kind.FRAGMENT_DEFINITION) {
|
|
60504
60497
|
if (args.size > 0) {
|
|
60505
60498
|
ctx.reportError(
|
|
60506
|
-
new
|
|
60499
|
+
new graphql24.GraphQLError(
|
|
60507
60500
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
60508
60501
|
)
|
|
60509
60502
|
);
|
|
@@ -60539,7 +60532,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60539
60532
|
if (definition.kind === "OperationDefinition") {
|
|
60540
60533
|
if (definition.operation !== "query") {
|
|
60541
60534
|
ctx.reportError(
|
|
60542
|
-
new
|
|
60535
|
+
new graphql24.GraphQLError(
|
|
60543
60536
|
`@${node.name.value} must fall on a fragment or query document`
|
|
60544
60537
|
)
|
|
60545
60538
|
);
|
|
@@ -60551,7 +60544,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60551
60544
|
}
|
|
60552
60545
|
if (!possibleNodes.includes(definitionType)) {
|
|
60553
60546
|
ctx.reportError(
|
|
60554
|
-
new
|
|
60547
|
+
new graphql24.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
60555
60548
|
);
|
|
60556
60549
|
}
|
|
60557
60550
|
}
|
|
@@ -60570,7 +60563,7 @@ function checkMutationOperation(config2) {
|
|
|
60570
60563
|
);
|
|
60571
60564
|
if (append && prepend) {
|
|
60572
60565
|
ctx.reportError(
|
|
60573
|
-
new
|
|
60566
|
+
new graphql24.GraphQLError(
|
|
60574
60567
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
60575
60568
|
)
|
|
60576
60569
|
);
|
|
@@ -60584,7 +60577,7 @@ function checkMutationOperation(config2) {
|
|
|
60584
60577
|
);
|
|
60585
60578
|
if (parentId && allLists) {
|
|
60586
60579
|
ctx.reportError(
|
|
60587
|
-
new
|
|
60580
|
+
new graphql24.GraphQLError(
|
|
60588
60581
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
60589
60582
|
)
|
|
60590
60583
|
);
|
|
@@ -60606,7 +60599,7 @@ function checkMaskDirective(config2) {
|
|
|
60606
60599
|
);
|
|
60607
60600
|
if (maskEnableDirective && maskDisableDirective) {
|
|
60608
60601
|
ctx.reportError(
|
|
60609
|
-
new
|
|
60602
|
+
new graphql24.GraphQLError(
|
|
60610
60603
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
60611
60604
|
)
|
|
60612
60605
|
);
|
|
@@ -60622,7 +60615,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
60622
60615
|
if (!nodeInterface) {
|
|
60623
60616
|
return null;
|
|
60624
60617
|
}
|
|
60625
|
-
if (!
|
|
60618
|
+
if (!graphql24.isInterfaceType(nodeInterface)) {
|
|
60626
60619
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
60627
60620
|
return null;
|
|
60628
60621
|
}
|
|
@@ -60720,11 +60713,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
60720
60713
|
}
|
|
60721
60714
|
|
|
60722
60715
|
// src/codegen/validators/noIDAlias.ts
|
|
60723
|
-
var
|
|
60716
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
60724
60717
|
async function noIDAlias(config2, docs) {
|
|
60725
60718
|
const errors = [];
|
|
60726
60719
|
for (const { filename, document } of docs) {
|
|
60727
|
-
|
|
60720
|
+
graphql25.visit(document, {
|
|
60728
60721
|
Field(node, _, __, ___, ancestors) {
|
|
60729
60722
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
60730
60723
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -60948,6 +60941,7 @@ function testConfigFile(config2 = {}) {
|
|
|
60948
60941
|
ghostsByCursor(first: Int, after: String, last: Int, before: String): IsGhostConnection!
|
|
60949
60942
|
entitiesByCursor(first: Int, after: String, last: Int, before: String): EntityConnection!
|
|
60950
60943
|
node(id: ID!): Node
|
|
60944
|
+
customIdList: [CustomIdType]!
|
|
60951
60945
|
}
|
|
60952
60946
|
|
|
60953
60947
|
type PageInfo {
|
|
@@ -61081,6 +61075,12 @@ function testConfigFile(config2 = {}) {
|
|
|
61081
61075
|
Value3
|
|
61082
61076
|
Value2
|
|
61083
61077
|
}
|
|
61078
|
+
|
|
61079
|
+
type CustomIdType {
|
|
61080
|
+
foo: String!
|
|
61081
|
+
bar: String!
|
|
61082
|
+
dummy: String
|
|
61083
|
+
}
|
|
61084
61084
|
`,
|
|
61085
61085
|
scalars: {
|
|
61086
61086
|
DateTime: {
|
|
@@ -61100,6 +61100,9 @@ function testConfigFile(config2 = {}) {
|
|
|
61100
61100
|
resolve: {
|
|
61101
61101
|
queryField: "ghost"
|
|
61102
61102
|
}
|
|
61103
|
+
},
|
|
61104
|
+
CustomIdType: {
|
|
61105
|
+
keys: ["foo", "bar"]
|
|
61103
61106
|
}
|
|
61104
61107
|
},
|
|
61105
61108
|
logLevel: "quiet",
|
|
@@ -61139,7 +61142,7 @@ function pipelineTest(config2, documents, shouldPass, testBody) {
|
|
|
61139
61142
|
};
|
|
61140
61143
|
}
|
|
61141
61144
|
function mockCollectedDoc(query) {
|
|
61142
|
-
const parsed =
|
|
61145
|
+
const parsed = graphql26.parse(query);
|
|
61143
61146
|
const name2 = parsed.definitions[0].name.value;
|
|
61144
61147
|
const operations = parsed.definitions;
|
|
61145
61148
|
let kind = "HoudiniFragment" /* Fragment */;
|