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-cjs/index.js
CHANGED
|
@@ -529,7 +529,7 @@ var require_kinds = __commonJS({
|
|
|
529
529
|
value: true
|
|
530
530
|
});
|
|
531
531
|
exports.Kind = void 0;
|
|
532
|
-
var
|
|
532
|
+
var Kind13 = Object.freeze({
|
|
533
533
|
NAME: "Name",
|
|
534
534
|
DOCUMENT: "Document",
|
|
535
535
|
OPERATION_DEFINITION: "OperationDefinition",
|
|
@@ -574,7 +574,7 @@ var require_kinds = __commonJS({
|
|
|
574
574
|
ENUM_TYPE_EXTENSION: "EnumTypeExtension",
|
|
575
575
|
INPUT_OBJECT_TYPE_EXTENSION: "InputObjectTypeExtension"
|
|
576
576
|
});
|
|
577
|
-
exports.Kind =
|
|
577
|
+
exports.Kind = Kind13;
|
|
578
578
|
}
|
|
579
579
|
});
|
|
580
580
|
|
|
@@ -9754,7 +9754,7 @@ var require_graphql = __commonJS({
|
|
|
9754
9754
|
Object.defineProperty(exports, "__esModule", {
|
|
9755
9755
|
value: true
|
|
9756
9756
|
});
|
|
9757
|
-
exports.graphql =
|
|
9757
|
+
exports.graphql = graphql27;
|
|
9758
9758
|
exports.graphqlSync = graphqlSync;
|
|
9759
9759
|
var _isPromise = _interopRequireDefault(require_isPromise());
|
|
9760
9760
|
var _parser = require_parser();
|
|
@@ -9764,7 +9764,7 @@ var require_graphql = __commonJS({
|
|
|
9764
9764
|
function _interopRequireDefault(obj) {
|
|
9765
9765
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
9766
9766
|
}
|
|
9767
|
-
function
|
|
9767
|
+
function graphql27(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
9768
9768
|
var _arguments = arguments;
|
|
9769
9769
|
return new Promise(function(resolve2) {
|
|
9770
9770
|
return resolve2(
|
|
@@ -53926,7 +53926,7 @@ __export(test_exports, {
|
|
|
53926
53926
|
testConfigFile: () => testConfigFile
|
|
53927
53927
|
});
|
|
53928
53928
|
module.exports = __toCommonJS(test_exports);
|
|
53929
|
-
var
|
|
53929
|
+
var graphql26 = __toESM(require_graphql2(), 1);
|
|
53930
53930
|
var import_memfs2 = __toESM(require_lib(), 1);
|
|
53931
53931
|
|
|
53932
53932
|
// src/lib/pipeline.ts
|
|
@@ -56550,7 +56550,7 @@ async function cleanupFiles(pathFolder, listOfObj) {
|
|
|
56550
56550
|
}
|
|
56551
56551
|
|
|
56552
56552
|
// src/codegen/generators/artifacts/index.ts
|
|
56553
|
-
var
|
|
56553
|
+
var graphql12 = __toESM(require_graphql2(), 1);
|
|
56554
56554
|
var recast5 = __toESM(require_main2(), 1);
|
|
56555
56555
|
|
|
56556
56556
|
// src/codegen/utils/commonjs.ts
|
|
@@ -57154,7 +57154,7 @@ function ancestorKey(ancestors) {
|
|
|
57154
57154
|
}
|
|
57155
57155
|
|
|
57156
57156
|
// src/codegen/generators/artifacts/selection.ts
|
|
57157
|
-
var
|
|
57157
|
+
var graphql11 = __toESM(require_graphql2(), 1);
|
|
57158
57158
|
|
|
57159
57159
|
// ../../node_modules/.pnpm/@kitql+helper@0.5.0/node_modules/@kitql/helper/index.mjs
|
|
57160
57160
|
var config = {
|
|
@@ -57194,10 +57194,24 @@ function logYellow(str) {
|
|
|
57194
57194
|
}
|
|
57195
57195
|
|
|
57196
57196
|
// src/codegen/transforms/list.ts
|
|
57197
|
-
var
|
|
57197
|
+
var graphql9 = __toESM(require_graphql2(), 1);
|
|
57198
57198
|
|
|
57199
|
-
// src/codegen/
|
|
57199
|
+
// src/codegen/utils/objectIdentificationSelection.ts
|
|
57200
57200
|
var graphql7 = __toESM(require_graphql2(), 1);
|
|
57201
|
+
var objectIdentificationSelection = (config2, type) => {
|
|
57202
|
+
return config2.keyFieldsForType(type.name).map((key) => {
|
|
57203
|
+
return {
|
|
57204
|
+
kind: graphql7.Kind.FIELD,
|
|
57205
|
+
name: {
|
|
57206
|
+
kind: graphql7.Kind.NAME,
|
|
57207
|
+
value: key
|
|
57208
|
+
}
|
|
57209
|
+
};
|
|
57210
|
+
});
|
|
57211
|
+
};
|
|
57212
|
+
|
|
57213
|
+
// src/codegen/transforms/paginate.ts
|
|
57214
|
+
var graphql8 = __toESM(require_graphql2(), 1);
|
|
57201
57215
|
async function paginate(config2, documents) {
|
|
57202
57216
|
const newDocs = [];
|
|
57203
57217
|
for (const doc of documents) {
|
|
@@ -57230,7 +57244,7 @@ async function paginate(config2, documents) {
|
|
|
57230
57244
|
};
|
|
57231
57245
|
let cursorType = "String";
|
|
57232
57246
|
let paginationPath = [];
|
|
57233
|
-
doc.document =
|
|
57247
|
+
doc.document = graphql8.visit(doc.document, {
|
|
57234
57248
|
Field(node, _, __, ___, ancestors) {
|
|
57235
57249
|
const paginateDirective = node.directives?.find(
|
|
57236
57250
|
(directive) => directive.name.value === config2.paginateDirective
|
|
@@ -57257,7 +57271,7 @@ async function paginate(config2, documents) {
|
|
|
57257
57271
|
flags.offset.enabled = offsetPagination;
|
|
57258
57272
|
flags.limit.enabled = offsetPagination;
|
|
57259
57273
|
paginationPath = ancestors.filter(
|
|
57260
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
57274
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql8.Kind.FIELD
|
|
57261
57275
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
57262
57276
|
return {
|
|
57263
57277
|
...node,
|
|
@@ -57278,7 +57292,7 @@ async function paginate(config2, documents) {
|
|
|
57278
57292
|
refetchUpdate = "prepend" /* prepend */;
|
|
57279
57293
|
}
|
|
57280
57294
|
let fragment = "";
|
|
57281
|
-
doc.document =
|
|
57295
|
+
doc.document = graphql8.visit(doc.document, {
|
|
57282
57296
|
OperationDefinition(node) {
|
|
57283
57297
|
if (node.operation !== "query") {
|
|
57284
57298
|
throw new HoudiniError({
|
|
@@ -57332,9 +57346,9 @@ async function paginate(config2, documents) {
|
|
|
57332
57346
|
directives: [
|
|
57333
57347
|
...node.directives || [],
|
|
57334
57348
|
{
|
|
57335
|
-
kind:
|
|
57349
|
+
kind: graphql8.Kind.DIRECTIVE,
|
|
57336
57350
|
name: {
|
|
57337
|
-
kind:
|
|
57351
|
+
kind: graphql8.Kind.NAME,
|
|
57338
57352
|
value: config2.argumentsDirective
|
|
57339
57353
|
}
|
|
57340
57354
|
}
|
|
@@ -57397,16 +57411,16 @@ async function paginate(config2, documents) {
|
|
|
57397
57411
|
const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
57398
57412
|
const fragmentSpreadSelection = [
|
|
57399
57413
|
{
|
|
57400
|
-
kind:
|
|
57414
|
+
kind: graphql8.Kind.FRAGMENT_SPREAD,
|
|
57401
57415
|
name: {
|
|
57402
|
-
kind:
|
|
57416
|
+
kind: graphql8.Kind.NAME,
|
|
57403
57417
|
value: fragmentName
|
|
57404
57418
|
},
|
|
57405
57419
|
directives: [
|
|
57406
57420
|
{
|
|
57407
|
-
kind:
|
|
57421
|
+
kind: graphql8.Kind.DIRECTIVE,
|
|
57408
57422
|
name: {
|
|
57409
|
-
kind:
|
|
57423
|
+
kind: graphql8.Kind.NAME,
|
|
57410
57424
|
value: config2.withDirective
|
|
57411
57425
|
},
|
|
57412
57426
|
["arguments"]: paginationArgs.map(
|
|
@@ -57434,29 +57448,29 @@ async function paginate(config2, documents) {
|
|
|
57434
57448
|
});
|
|
57435
57449
|
const typeConfig = config2.typeConfig?.[fragment];
|
|
57436
57450
|
const queryDoc = {
|
|
57437
|
-
kind:
|
|
57451
|
+
kind: graphql8.Kind.DOCUMENT,
|
|
57438
57452
|
definitions: [
|
|
57439
57453
|
{
|
|
57440
|
-
kind:
|
|
57454
|
+
kind: graphql8.Kind.OPERATION_DEFINITION,
|
|
57441
57455
|
name: {
|
|
57442
|
-
kind:
|
|
57456
|
+
kind: graphql8.Kind.NAME,
|
|
57443
57457
|
value: refetchQueryName
|
|
57444
57458
|
},
|
|
57445
57459
|
operation: "query",
|
|
57446
57460
|
variableDefinitions: paginationArgs.map(
|
|
57447
57461
|
(arg) => ({
|
|
57448
|
-
kind:
|
|
57462
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57449
57463
|
type: {
|
|
57450
|
-
kind:
|
|
57464
|
+
kind: graphql8.Kind.NAMED_TYPE,
|
|
57451
57465
|
name: {
|
|
57452
|
-
kind:
|
|
57466
|
+
kind: graphql8.Kind.NAME,
|
|
57453
57467
|
value: arg.type
|
|
57454
57468
|
}
|
|
57455
57469
|
},
|
|
57456
57470
|
variable: {
|
|
57457
|
-
kind:
|
|
57471
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57458
57472
|
name: {
|
|
57459
|
-
kind:
|
|
57473
|
+
kind: graphql8.Kind.NAME,
|
|
57460
57474
|
value: arg.name
|
|
57461
57475
|
}
|
|
57462
57476
|
},
|
|
@@ -57468,12 +57482,12 @@ async function paginate(config2, documents) {
|
|
|
57468
57482
|
).concat(
|
|
57469
57483
|
!nodeQuery ? [] : keys.map(
|
|
57470
57484
|
(key) => ({
|
|
57471
|
-
kind:
|
|
57485
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57472
57486
|
type: key.type,
|
|
57473
57487
|
variable: {
|
|
57474
|
-
kind:
|
|
57488
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57475
57489
|
name: {
|
|
57476
|
-
kind:
|
|
57490
|
+
kind: graphql8.Kind.NAME,
|
|
57477
57491
|
value: key.name
|
|
57478
57492
|
}
|
|
57479
57493
|
}
|
|
@@ -57481,42 +57495,42 @@ async function paginate(config2, documents) {
|
|
|
57481
57495
|
)
|
|
57482
57496
|
),
|
|
57483
57497
|
selectionSet: {
|
|
57484
|
-
kind:
|
|
57498
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57485
57499
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
57486
57500
|
{
|
|
57487
|
-
kind:
|
|
57501
|
+
kind: graphql8.Kind.FIELD,
|
|
57488
57502
|
name: {
|
|
57489
|
-
kind:
|
|
57503
|
+
kind: graphql8.Kind.NAME,
|
|
57490
57504
|
value: typeConfig?.resolve?.queryField || "node"
|
|
57491
57505
|
},
|
|
57492
57506
|
["arguments"]: keys.map((key) => ({
|
|
57493
|
-
kind:
|
|
57507
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57494
57508
|
name: {
|
|
57495
|
-
kind:
|
|
57509
|
+
kind: graphql8.Kind.NAME,
|
|
57496
57510
|
value: key.name
|
|
57497
57511
|
},
|
|
57498
57512
|
value: {
|
|
57499
|
-
kind:
|
|
57513
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57500
57514
|
name: {
|
|
57501
|
-
kind:
|
|
57515
|
+
kind: graphql8.Kind.NAME,
|
|
57502
57516
|
value: key.name
|
|
57503
57517
|
}
|
|
57504
57518
|
}
|
|
57505
57519
|
})),
|
|
57506
57520
|
selectionSet: {
|
|
57507
|
-
kind:
|
|
57521
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57508
57522
|
selections: [
|
|
57509
57523
|
{
|
|
57510
|
-
kind:
|
|
57524
|
+
kind: graphql8.Kind.FIELD,
|
|
57511
57525
|
name: {
|
|
57512
|
-
kind:
|
|
57526
|
+
kind: graphql8.Kind.NAME,
|
|
57513
57527
|
value: "__typename"
|
|
57514
57528
|
}
|
|
57515
57529
|
},
|
|
57516
57530
|
...(typeConfig?.keys || ["id"]).map((key) => ({
|
|
57517
|
-
kind:
|
|
57531
|
+
kind: graphql8.Kind.FIELD,
|
|
57518
57532
|
name: {
|
|
57519
|
-
kind:
|
|
57533
|
+
kind: graphql8.Kind.NAME,
|
|
57520
57534
|
value: key
|
|
57521
57535
|
}
|
|
57522
57536
|
})),
|
|
@@ -57578,15 +57592,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
57578
57592
|
}
|
|
57579
57593
|
function variableAsArgument(name2, variable) {
|
|
57580
57594
|
return {
|
|
57581
|
-
kind:
|
|
57595
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57582
57596
|
name: {
|
|
57583
|
-
kind:
|
|
57597
|
+
kind: graphql8.Kind.NAME,
|
|
57584
57598
|
value: name2
|
|
57585
57599
|
},
|
|
57586
57600
|
value: {
|
|
57587
|
-
kind:
|
|
57601
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57588
57602
|
name: {
|
|
57589
|
-
kind:
|
|
57603
|
+
kind: graphql8.Kind.NAME,
|
|
57590
57604
|
value: variable ?? name2
|
|
57591
57605
|
}
|
|
57592
57606
|
}
|
|
@@ -57594,18 +57608,18 @@ function variableAsArgument(name2, variable) {
|
|
|
57594
57608
|
}
|
|
57595
57609
|
function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
57596
57610
|
return {
|
|
57597
|
-
kind:
|
|
57611
|
+
kind: graphql8.Kind.VARIABLE_DEFINITION,
|
|
57598
57612
|
type: {
|
|
57599
|
-
kind:
|
|
57613
|
+
kind: graphql8.Kind.NAMED_TYPE,
|
|
57600
57614
|
name: {
|
|
57601
|
-
kind:
|
|
57615
|
+
kind: graphql8.Kind.NAME,
|
|
57602
57616
|
value: type
|
|
57603
57617
|
}
|
|
57604
57618
|
},
|
|
57605
57619
|
variable: {
|
|
57606
|
-
kind:
|
|
57620
|
+
kind: graphql8.Kind.VARIABLE,
|
|
57607
57621
|
name: {
|
|
57608
|
-
kind:
|
|
57622
|
+
kind: graphql8.Kind.NAME,
|
|
57609
57623
|
value: variableName ?? name2
|
|
57610
57624
|
}
|
|
57611
57625
|
},
|
|
@@ -57617,9 +57631,9 @@ function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
|
57617
57631
|
}
|
|
57618
57632
|
function argumentNode(name2, value) {
|
|
57619
57633
|
return {
|
|
57620
|
-
kind:
|
|
57634
|
+
kind: graphql8.Kind.ARGUMENT,
|
|
57621
57635
|
name: {
|
|
57622
|
-
kind:
|
|
57636
|
+
kind: graphql8.Kind.NAME,
|
|
57623
57637
|
value: name2
|
|
57624
57638
|
},
|
|
57625
57639
|
value: objectNode(value)
|
|
@@ -57627,16 +57641,16 @@ function argumentNode(name2, value) {
|
|
|
57627
57641
|
}
|
|
57628
57642
|
function objectNode([type, defaultValue]) {
|
|
57629
57643
|
const node = {
|
|
57630
|
-
kind:
|
|
57644
|
+
kind: graphql8.Kind.OBJECT,
|
|
57631
57645
|
fields: [
|
|
57632
57646
|
{
|
|
57633
|
-
kind:
|
|
57647
|
+
kind: graphql8.Kind.OBJECT_FIELD,
|
|
57634
57648
|
name: {
|
|
57635
|
-
kind:
|
|
57649
|
+
kind: graphql8.Kind.NAME,
|
|
57636
57650
|
value: "type"
|
|
57637
57651
|
},
|
|
57638
57652
|
value: {
|
|
57639
|
-
kind:
|
|
57653
|
+
kind: graphql8.Kind.STRING,
|
|
57640
57654
|
value: type
|
|
57641
57655
|
}
|
|
57642
57656
|
}
|
|
@@ -57644,8 +57658,8 @@ function objectNode([type, defaultValue]) {
|
|
|
57644
57658
|
};
|
|
57645
57659
|
if (defaultValue) {
|
|
57646
57660
|
node.fields.push({
|
|
57647
|
-
kind:
|
|
57648
|
-
name: { kind:
|
|
57661
|
+
kind: graphql8.Kind.OBJECT_FIELD,
|
|
57662
|
+
name: { kind: graphql8.Kind.NAME, value: "default" },
|
|
57649
57663
|
value: {
|
|
57650
57664
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
57651
57665
|
value: defaultValue.toString()
|
|
@@ -57656,34 +57670,34 @@ function objectNode([type, defaultValue]) {
|
|
|
57656
57670
|
}
|
|
57657
57671
|
var pageInfoSelection = [
|
|
57658
57672
|
{
|
|
57659
|
-
kind:
|
|
57673
|
+
kind: graphql8.Kind.FIELD,
|
|
57660
57674
|
name: {
|
|
57661
|
-
kind:
|
|
57675
|
+
kind: graphql8.Kind.NAME,
|
|
57662
57676
|
value: "edges"
|
|
57663
57677
|
},
|
|
57664
57678
|
selectionSet: {
|
|
57665
|
-
kind:
|
|
57679
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57666
57680
|
selections: [
|
|
57667
57681
|
{
|
|
57668
|
-
kind:
|
|
57682
|
+
kind: graphql8.Kind.FIELD,
|
|
57669
57683
|
name: {
|
|
57670
|
-
kind:
|
|
57684
|
+
kind: graphql8.Kind.NAME,
|
|
57671
57685
|
value: "cursor"
|
|
57672
57686
|
}
|
|
57673
57687
|
},
|
|
57674
57688
|
{
|
|
57675
|
-
kind:
|
|
57689
|
+
kind: graphql8.Kind.FIELD,
|
|
57676
57690
|
name: {
|
|
57677
|
-
kind:
|
|
57691
|
+
kind: graphql8.Kind.NAME,
|
|
57678
57692
|
value: "node"
|
|
57679
57693
|
},
|
|
57680
57694
|
selectionSet: {
|
|
57681
|
-
kind:
|
|
57695
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57682
57696
|
selections: [
|
|
57683
57697
|
{
|
|
57684
|
-
kind:
|
|
57698
|
+
kind: graphql8.Kind.FIELD,
|
|
57685
57699
|
name: {
|
|
57686
|
-
kind:
|
|
57700
|
+
kind: graphql8.Kind.NAME,
|
|
57687
57701
|
value: "__typename"
|
|
57688
57702
|
}
|
|
57689
57703
|
}
|
|
@@ -57694,39 +57708,39 @@ var pageInfoSelection = [
|
|
|
57694
57708
|
}
|
|
57695
57709
|
},
|
|
57696
57710
|
{
|
|
57697
|
-
kind:
|
|
57711
|
+
kind: graphql8.Kind.FIELD,
|
|
57698
57712
|
name: {
|
|
57699
|
-
kind:
|
|
57713
|
+
kind: graphql8.Kind.NAME,
|
|
57700
57714
|
value: "pageInfo"
|
|
57701
57715
|
},
|
|
57702
57716
|
selectionSet: {
|
|
57703
|
-
kind:
|
|
57717
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57704
57718
|
selections: [
|
|
57705
57719
|
{
|
|
57706
|
-
kind:
|
|
57720
|
+
kind: graphql8.Kind.FIELD,
|
|
57707
57721
|
name: {
|
|
57708
|
-
kind:
|
|
57722
|
+
kind: graphql8.Kind.NAME,
|
|
57709
57723
|
value: "hasPreviousPage"
|
|
57710
57724
|
}
|
|
57711
57725
|
},
|
|
57712
57726
|
{
|
|
57713
|
-
kind:
|
|
57727
|
+
kind: graphql8.Kind.FIELD,
|
|
57714
57728
|
name: {
|
|
57715
|
-
kind:
|
|
57729
|
+
kind: graphql8.Kind.NAME,
|
|
57716
57730
|
value: "hasNextPage"
|
|
57717
57731
|
}
|
|
57718
57732
|
},
|
|
57719
57733
|
{
|
|
57720
|
-
kind:
|
|
57734
|
+
kind: graphql8.Kind.FIELD,
|
|
57721
57735
|
name: {
|
|
57722
|
-
kind:
|
|
57736
|
+
kind: graphql8.Kind.NAME,
|
|
57723
57737
|
value: "startCursor"
|
|
57724
57738
|
}
|
|
57725
57739
|
},
|
|
57726
57740
|
{
|
|
57727
|
-
kind:
|
|
57741
|
+
kind: graphql8.Kind.FIELD,
|
|
57728
57742
|
name: {
|
|
57729
|
-
kind:
|
|
57743
|
+
kind: graphql8.Kind.NAME,
|
|
57730
57744
|
value: "endCursor"
|
|
57731
57745
|
}
|
|
57732
57746
|
}
|
|
@@ -57740,15 +57754,15 @@ async function addListFragments(config2, documents) {
|
|
|
57740
57754
|
const lists = {};
|
|
57741
57755
|
const errors = [];
|
|
57742
57756
|
for (const doc of documents) {
|
|
57743
|
-
doc.document =
|
|
57757
|
+
doc.document = graphql9.visit(doc.document, {
|
|
57744
57758
|
Directive(node, key, parent, path2, ancestors) {
|
|
57745
57759
|
if ([config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
57746
57760
|
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
57747
57761
|
let error = {
|
|
57748
|
-
...new
|
|
57762
|
+
...new graphql9.GraphQLError(
|
|
57749
57763
|
"",
|
|
57750
57764
|
node,
|
|
57751
|
-
new
|
|
57765
|
+
new graphql9.Source(""),
|
|
57752
57766
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
57753
57767
|
path2
|
|
57754
57768
|
),
|
|
@@ -57800,7 +57814,7 @@ async function addListFragments(config2, documents) {
|
|
|
57800
57814
|
{
|
|
57801
57815
|
kind: "Argument",
|
|
57802
57816
|
name: {
|
|
57803
|
-
kind:
|
|
57817
|
+
kind: graphql9.Kind.NAME,
|
|
57804
57818
|
value: "connection"
|
|
57805
57819
|
},
|
|
57806
57820
|
value: {
|
|
@@ -57847,10 +57861,13 @@ async function addListFragments(config2, documents) {
|
|
|
57847
57861
|
if (errors.length > 0) {
|
|
57848
57862
|
throw errors;
|
|
57849
57863
|
}
|
|
57850
|
-
const
|
|
57864
|
+
const validDeletes = [
|
|
57851
57865
|
...new Set(
|
|
57852
57866
|
Object.values(lists).map(({ type }) => {
|
|
57853
|
-
if (!(type instanceof
|
|
57867
|
+
if (!(type instanceof graphql9.GraphQLObjectType)) {
|
|
57868
|
+
return "";
|
|
57869
|
+
}
|
|
57870
|
+
if (config2.keyFieldsForType(type.name).length !== 1) {
|
|
57854
57871
|
return "";
|
|
57855
57872
|
}
|
|
57856
57873
|
return type.name;
|
|
@@ -57861,7 +57878,7 @@ async function addListFragments(config2, documents) {
|
|
|
57861
57878
|
return;
|
|
57862
57879
|
}
|
|
57863
57880
|
const generatedDoc = {
|
|
57864
|
-
kind:
|
|
57881
|
+
kind: graphql9.Kind.DOCUMENT,
|
|
57865
57882
|
definitions: Object.entries(lists).flatMap(
|
|
57866
57883
|
([name2, { selection: selection2, type }]) => {
|
|
57867
57884
|
const schemaType = config2.schema.getType(type.name);
|
|
@@ -57869,35 +57886,29 @@ async function addListFragments(config2, documents) {
|
|
|
57869
57886
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
57870
57887
|
}
|
|
57871
57888
|
const fragmentSelection = {
|
|
57872
|
-
kind:
|
|
57889
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
57873
57890
|
selections: [...selection2.selections]
|
|
57874
57891
|
};
|
|
57875
57892
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
57876
|
-
(field) => field.kind === "Field" && field.name.value
|
|
57893
|
+
(field) => field.kind === "Field" && config2.keyFieldsForType(type.name).includes(field.name.value)
|
|
57877
57894
|
)) {
|
|
57878
57895
|
fragmentSelection.selections = [
|
|
57879
57896
|
...fragmentSelection.selections,
|
|
57880
|
-
|
|
57881
|
-
kind: graphql8.Kind.FIELD,
|
|
57882
|
-
name: {
|
|
57883
|
-
kind: graphql8.Kind.NAME,
|
|
57884
|
-
value: "id"
|
|
57885
|
-
}
|
|
57886
|
-
}
|
|
57897
|
+
...objectIdentificationSelection(config2, type)
|
|
57887
57898
|
];
|
|
57888
57899
|
}
|
|
57889
57900
|
return [
|
|
57890
57901
|
{
|
|
57891
57902
|
name: {
|
|
57892
57903
|
value: config2.listInsertFragment(name2),
|
|
57893
|
-
kind:
|
|
57904
|
+
kind: graphql9.Kind.NAME
|
|
57894
57905
|
},
|
|
57895
|
-
kind:
|
|
57906
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57896
57907
|
selectionSet: fragmentSelection,
|
|
57897
57908
|
typeCondition: {
|
|
57898
|
-
kind:
|
|
57909
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57899
57910
|
name: {
|
|
57900
|
-
kind:
|
|
57911
|
+
kind: graphql9.Kind.NAME,
|
|
57901
57912
|
value: type.name
|
|
57902
57913
|
}
|
|
57903
57914
|
}
|
|
@@ -57905,52 +57916,32 @@ async function addListFragments(config2, documents) {
|
|
|
57905
57916
|
{
|
|
57906
57917
|
name: {
|
|
57907
57918
|
value: config2.listToggleFragment(name2),
|
|
57908
|
-
kind:
|
|
57909
|
-
},
|
|
57910
|
-
kind: graphql8.Kind.FRAGMENT_DEFINITION,
|
|
57911
|
-
selectionSet: {
|
|
57912
|
-
...fragmentSelection,
|
|
57913
|
-
selections: [
|
|
57914
|
-
...fragmentSelection.selections,
|
|
57915
|
-
{
|
|
57916
|
-
kind: graphql8.Kind.FIELD,
|
|
57917
|
-
name: {
|
|
57918
|
-
kind: graphql8.Kind.NAME,
|
|
57919
|
-
value: "id"
|
|
57920
|
-
}
|
|
57921
|
-
}
|
|
57922
|
-
]
|
|
57919
|
+
kind: graphql9.Kind.NAME
|
|
57923
57920
|
},
|
|
57921
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57922
|
+
selectionSet: fragmentSelection,
|
|
57924
57923
|
typeCondition: {
|
|
57925
|
-
kind:
|
|
57924
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57926
57925
|
name: {
|
|
57927
|
-
kind:
|
|
57926
|
+
kind: graphql9.Kind.NAME,
|
|
57928
57927
|
value: type.name
|
|
57929
57928
|
}
|
|
57930
57929
|
}
|
|
57931
57930
|
},
|
|
57932
57931
|
{
|
|
57933
|
-
kind:
|
|
57932
|
+
kind: graphql9.Kind.FRAGMENT_DEFINITION,
|
|
57934
57933
|
name: {
|
|
57935
57934
|
value: config2.listRemoveFragment(name2),
|
|
57936
|
-
kind:
|
|
57935
|
+
kind: graphql9.Kind.NAME
|
|
57937
57936
|
},
|
|
57938
57937
|
selectionSet: {
|
|
57939
|
-
kind:
|
|
57940
|
-
selections: [
|
|
57941
|
-
{
|
|
57942
|
-
kind: graphql8.Kind.FIELD,
|
|
57943
|
-
name: {
|
|
57944
|
-
kind: graphql8.Kind.NAME,
|
|
57945
|
-
value: "id"
|
|
57946
|
-
}
|
|
57947
|
-
}
|
|
57948
|
-
]
|
|
57938
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
57939
|
+
selections: [...objectIdentificationSelection(config2, type)]
|
|
57949
57940
|
},
|
|
57950
57941
|
typeCondition: {
|
|
57951
|
-
kind:
|
|
57942
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
57952
57943
|
name: {
|
|
57953
|
-
kind:
|
|
57944
|
+
kind: graphql9.Kind.NAME,
|
|
57954
57945
|
value: type.name
|
|
57955
57946
|
}
|
|
57956
57947
|
}
|
|
@@ -57958,15 +57949,15 @@ async function addListFragments(config2, documents) {
|
|
|
57958
57949
|
];
|
|
57959
57950
|
}
|
|
57960
57951
|
).concat(
|
|
57961
|
-
...
|
|
57962
|
-
kind:
|
|
57952
|
+
...validDeletes.map((typeName) => ({
|
|
57953
|
+
kind: graphql9.Kind.DIRECTIVE_DEFINITION,
|
|
57963
57954
|
name: {
|
|
57964
|
-
kind:
|
|
57955
|
+
kind: graphql9.Kind.NAME,
|
|
57965
57956
|
value: config2.listDeleteDirective(typeName)
|
|
57966
57957
|
},
|
|
57967
57958
|
locations: [
|
|
57968
57959
|
{
|
|
57969
|
-
kind:
|
|
57960
|
+
kind: graphql9.Kind.NAME,
|
|
57970
57961
|
value: "FIELD"
|
|
57971
57962
|
}
|
|
57972
57963
|
],
|
|
@@ -57974,8 +57965,8 @@ async function addListFragments(config2, documents) {
|
|
|
57974
57965
|
}))
|
|
57975
57966
|
)
|
|
57976
57967
|
};
|
|
57977
|
-
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(
|
|
57978
|
-
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(
|
|
57968
|
+
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql9.print).join("\n\n");
|
|
57969
|
+
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql9.print).join("\n\n");
|
|
57979
57970
|
documents.push({
|
|
57980
57971
|
name: "generated::lists",
|
|
57981
57972
|
kind: "HoudiniFragment" /* Fragment */,
|
|
@@ -58060,11 +58051,11 @@ var nodeNotDefinedMessage = (config2) => `Looks like you are trying to use the $
|
|
|
58060
58051
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
58061
58052
|
|
|
58062
58053
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
58063
|
-
var
|
|
58054
|
+
var graphql10 = __toESM(require_graphql2(), 1);
|
|
58064
58055
|
function fieldKey(config2, field) {
|
|
58065
58056
|
const attributeName = field.alias?.value || field.name.value;
|
|
58066
|
-
const printed =
|
|
58067
|
-
const secondParse =
|
|
58057
|
+
const printed = graphql10.print(field);
|
|
58058
|
+
const secondParse = graphql10.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
58068
58059
|
const paginated = !!field.directives?.find(
|
|
58069
58060
|
(directive) => directive.name.value === config2.paginateDirective
|
|
58070
58061
|
);
|
|
@@ -58157,8 +58148,8 @@ function selection({
|
|
|
58157
58148
|
const typeConditionName = field.typeCondition.name.value;
|
|
58158
58149
|
const typeCondition = config2.schema.getType(typeConditionName);
|
|
58159
58150
|
const possibleTypes = [];
|
|
58160
|
-
if (!
|
|
58161
|
-
} else if (
|
|
58151
|
+
if (!graphql11.isAbstractType(typeCondition)) {
|
|
58152
|
+
} else if (graphql11.isAbstractType(parentType)) {
|
|
58162
58153
|
const possibleParentTypes = config2.schema.getPossibleTypes(parentType).map((type) => type.name);
|
|
58163
58154
|
for (const possible of config2.schema.getPossibleTypes(typeCondition)) {
|
|
58164
58155
|
if (possibleParentTypes.includes(possible.name)) {
|
|
@@ -58206,7 +58197,7 @@ function selection({
|
|
|
58206
58197
|
} else {
|
|
58207
58198
|
let typeRef = type.getFields()[field.name.value].type;
|
|
58208
58199
|
fieldType = getRootType(typeRef);
|
|
58209
|
-
nullable = !
|
|
58200
|
+
nullable = !graphql11.isNonNullType(typeRef);
|
|
58210
58201
|
}
|
|
58211
58202
|
const typeName = fieldType.toString();
|
|
58212
58203
|
const pathSoFar = path2.concat(attributeName);
|
|
@@ -58271,7 +58262,7 @@ function selection({
|
|
|
58271
58262
|
{}
|
|
58272
58263
|
);
|
|
58273
58264
|
}
|
|
58274
|
-
if (
|
|
58265
|
+
if (graphql11.isInterfaceType(fieldType) || graphql11.isUnionType(fieldType)) {
|
|
58275
58266
|
fieldObj.abstract = true;
|
|
58276
58267
|
}
|
|
58277
58268
|
object.fields = {
|
|
@@ -58328,7 +58319,7 @@ function artifactGenerator(stats) {
|
|
|
58328
58319
|
return async function(config2, docs) {
|
|
58329
58320
|
const filterTypes = {};
|
|
58330
58321
|
for (const doc of docs) {
|
|
58331
|
-
|
|
58322
|
+
graphql12.visit(doc.document, {
|
|
58332
58323
|
Directive(node, _, __, ___, ancestors) {
|
|
58333
58324
|
if (node.name.value !== config2.listDirective) {
|
|
58334
58325
|
return;
|
|
@@ -58387,7 +58378,7 @@ function artifactGenerator(stats) {
|
|
|
58387
58378
|
return;
|
|
58388
58379
|
}
|
|
58389
58380
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
58390
|
-
let documentWithoutInternalDirectives =
|
|
58381
|
+
let documentWithoutInternalDirectives = graphql12.visit(document, {
|
|
58391
58382
|
Directive(node) {
|
|
58392
58383
|
if (config2.isInternalDirective(node)) {
|
|
58393
58384
|
return null;
|
|
@@ -58400,7 +58391,7 @@ function artifactGenerator(stats) {
|
|
|
58400
58391
|
}
|
|
58401
58392
|
}
|
|
58402
58393
|
});
|
|
58403
|
-
let documentWithoutExtraVariables =
|
|
58394
|
+
let documentWithoutExtraVariables = graphql12.visit(
|
|
58404
58395
|
documentWithoutInternalDirectives,
|
|
58405
58396
|
{
|
|
58406
58397
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -58411,13 +58402,13 @@ function artifactGenerator(stats) {
|
|
|
58411
58402
|
}
|
|
58412
58403
|
}
|
|
58413
58404
|
);
|
|
58414
|
-
let rawString =
|
|
58405
|
+
let rawString = graphql12.print(documentWithoutExtraVariables);
|
|
58415
58406
|
let docKind = doc.kind;
|
|
58416
58407
|
const operations = document.definitions.filter(
|
|
58417
|
-
({ kind }) => kind ===
|
|
58408
|
+
({ kind }) => kind === graphql12.Kind.OPERATION_DEFINITION
|
|
58418
58409
|
);
|
|
58419
58410
|
const fragments = document.definitions.filter(
|
|
58420
|
-
({ kind }) => kind ===
|
|
58411
|
+
({ kind }) => kind === graphql12.Kind.FRAGMENT_DEFINITION
|
|
58421
58412
|
);
|
|
58422
58413
|
let rootType = "";
|
|
58423
58414
|
let selectionSet;
|
|
@@ -58604,15 +58595,15 @@ async function generatePluginRuntime(config2, plugin) {
|
|
|
58604
58595
|
var recast10 = __toESM(require_main2(), 1);
|
|
58605
58596
|
|
|
58606
58597
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
58607
|
-
var
|
|
58598
|
+
var graphql15 = __toESM(require_graphql2(), 1);
|
|
58608
58599
|
var recast8 = __toESM(require_main2(), 1);
|
|
58609
58600
|
|
|
58610
58601
|
// src/codegen/generators/typescript/typeReference.ts
|
|
58611
|
-
var
|
|
58602
|
+
var graphql14 = __toESM(require_graphql2(), 1);
|
|
58612
58603
|
var recast7 = __toESM(require_main2(), 1);
|
|
58613
58604
|
|
|
58614
58605
|
// src/codegen/generators/typescript/types.ts
|
|
58615
|
-
var
|
|
58606
|
+
var graphql13 = __toESM(require_graphql2(), 1);
|
|
58616
58607
|
var recast6 = __toESM(require_main2(), 1);
|
|
58617
58608
|
var AST6 = recast6.types.builders;
|
|
58618
58609
|
function readonlyProperty(prop, enable = true) {
|
|
@@ -58646,7 +58637,7 @@ function scalarPropertyValue(config2, missingScalars, target) {
|
|
|
58646
58637
|
return AST6.tsStringKeyword();
|
|
58647
58638
|
}
|
|
58648
58639
|
default: {
|
|
58649
|
-
if (
|
|
58640
|
+
if (graphql13.isNonNullType(target) && "ofType" in target) {
|
|
58650
58641
|
return scalarPropertyValue(
|
|
58651
58642
|
config2,
|
|
58652
58643
|
missingScalars,
|
|
@@ -58667,7 +58658,7 @@ var AST7 = recast7.types.builders;
|
|
|
58667
58658
|
function tsTypeReference(config2, missingScalars, definition) {
|
|
58668
58659
|
const { type, wrappers } = unwrapType(config2, definition.type);
|
|
58669
58660
|
let result;
|
|
58670
|
-
if (
|
|
58661
|
+
if (graphql14.isScalarType(type)) {
|
|
58671
58662
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
58672
58663
|
} else {
|
|
58673
58664
|
result = AST7.tsTypeReference(AST7.identifier(type.name));
|
|
@@ -58688,17 +58679,17 @@ function tsTypeReference(config2, missingScalars, definition) {
|
|
|
58688
58679
|
var AST8 = recast8.types.builders;
|
|
58689
58680
|
function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
58690
58681
|
const { type } = unwrapType(config2, rootType);
|
|
58691
|
-
if (
|
|
58682
|
+
if (graphql15.isScalarType(type)) {
|
|
58692
58683
|
return;
|
|
58693
58684
|
}
|
|
58694
58685
|
if (visitedTypes.has(type.name)) {
|
|
58695
58686
|
return;
|
|
58696
58687
|
}
|
|
58697
|
-
if (
|
|
58688
|
+
if (graphql15.isUnionType(type)) {
|
|
58698
58689
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
58699
58690
|
}
|
|
58700
58691
|
visitedTypes.add(type.name);
|
|
58701
|
-
if (
|
|
58692
|
+
if (graphql15.isEnumType(type)) {
|
|
58702
58693
|
ensureImports({
|
|
58703
58694
|
config: config2,
|
|
58704
58695
|
body,
|
|
@@ -58715,7 +58706,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
58715
58706
|
AST8.tsPropertySignature(
|
|
58716
58707
|
AST8.identifier(field.name),
|
|
58717
58708
|
AST8.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
|
|
58718
|
-
|
|
58709
|
+
graphql15.isNullableType(field.type)
|
|
58719
58710
|
)
|
|
58720
58711
|
);
|
|
58721
58712
|
}
|
|
@@ -58723,7 +58714,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
58723
58714
|
}
|
|
58724
58715
|
|
|
58725
58716
|
// src/codegen/generators/typescript/inlineType.ts
|
|
58726
|
-
var
|
|
58717
|
+
var graphql16 = __toESM(require_graphql2(), 1);
|
|
58727
58718
|
var recast9 = __toESM(require_main2(), 1);
|
|
58728
58719
|
var AST9 = recast9.types.builders;
|
|
58729
58720
|
var fragmentKey = "$fragments";
|
|
@@ -58742,9 +58733,9 @@ function inlineType({
|
|
|
58742
58733
|
}) {
|
|
58743
58734
|
const { type, wrappers } = unwrapType(config2, rootType);
|
|
58744
58735
|
let result;
|
|
58745
|
-
if (
|
|
58736
|
+
if (graphql16.isScalarType(type)) {
|
|
58746
58737
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
58747
|
-
} else if (
|
|
58738
|
+
} else if (graphql16.isEnumType(type)) {
|
|
58748
58739
|
if (!visitedTypes.has(type.name)) {
|
|
58749
58740
|
ensureImports({
|
|
58750
58741
|
config: config2,
|
|
@@ -58762,11 +58753,11 @@ function inlineType({
|
|
|
58762
58753
|
for (const selection2 of selections) {
|
|
58763
58754
|
if (selection2.kind === "InlineFragment" && selection2.typeCondition) {
|
|
58764
58755
|
const fragmentType = config2.schema.getType(selection2.typeCondition.name.value);
|
|
58765
|
-
if (!
|
|
58756
|
+
if (!graphql16.isInterfaceType(type) && !graphql16.isUnionType(type)) {
|
|
58766
58757
|
selectedFields.push(...selection2.selectionSet.selections);
|
|
58767
58758
|
continue;
|
|
58768
58759
|
}
|
|
58769
|
-
if (!
|
|
58760
|
+
if (!graphql16.isInterfaceType(fragmentType) && !graphql16.isUnionType(fragmentType)) {
|
|
58770
58761
|
if (!inlineFragments[fragmentType.name]) {
|
|
58771
58762
|
inlineFragments[fragmentType.name] = [];
|
|
58772
58763
|
}
|
|
@@ -58886,7 +58877,7 @@ function inlineType({
|
|
|
58886
58877
|
}
|
|
58887
58878
|
}
|
|
58888
58879
|
}
|
|
58889
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
58880
|
+
if (objectType.type === "TSTypeLiteral" && !graphql16.isInterfaceType(fragmentRootType) && !graphql16.isUnionType(fragmentRootType)) {
|
|
58890
58881
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
58891
58882
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
58892
58883
|
);
|
|
@@ -58953,7 +58944,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58953
58944
|
},
|
|
58954
58945
|
type: schema.getType("String")
|
|
58955
58946
|
};
|
|
58956
|
-
} else if (
|
|
58947
|
+
} else if (graphql16.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
58957
58948
|
fields = rootType.ofType.getFields();
|
|
58958
58949
|
} else {
|
|
58959
58950
|
fields = rootType.getFields();
|
|
@@ -58965,7 +58956,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
58965
58956
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
58966
58957
|
});
|
|
58967
58958
|
}
|
|
58968
|
-
const fieldType =
|
|
58959
|
+
const fieldType = graphql16.getNamedType(field.type);
|
|
58969
58960
|
if (!fieldType) {
|
|
58970
58961
|
throw new HoudiniError({
|
|
58971
58962
|
filepath,
|
|
@@ -59285,7 +59276,7 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
59285
59276
|
}
|
|
59286
59277
|
|
|
59287
59278
|
// src/codegen/generators/persistedQueries/index.ts
|
|
59288
|
-
var
|
|
59279
|
+
var graphql17 = __toESM(require_graphql2(), 1);
|
|
59289
59280
|
async function persistOutputGenerator(config2, docs) {
|
|
59290
59281
|
if (typeof config2.persistedQueryPath !== "string" || config2.persistedQueryPath.length === 0)
|
|
59291
59282
|
return;
|
|
@@ -59297,8 +59288,8 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59297
59288
|
if (!generateArtifact) {
|
|
59298
59289
|
return acc;
|
|
59299
59290
|
}
|
|
59300
|
-
let rawString =
|
|
59301
|
-
|
|
59291
|
+
let rawString = graphql17.print(
|
|
59292
|
+
graphql17.visit(document, {
|
|
59302
59293
|
Directive(node) {
|
|
59303
59294
|
if (config2.isInternalDirective(node)) {
|
|
59304
59295
|
return null;
|
|
@@ -59307,7 +59298,7 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59307
59298
|
})
|
|
59308
59299
|
);
|
|
59309
59300
|
const operations = document.definitions.filter(
|
|
59310
|
-
({ kind }) => kind ===
|
|
59301
|
+
({ kind }) => kind === graphql17.Kind.OPERATION_DEFINITION
|
|
59311
59302
|
);
|
|
59312
59303
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
59313
59304
|
acc[hashDocument(rawString)] = rawString;
|
|
@@ -59320,11 +59311,11 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59320
59311
|
}
|
|
59321
59312
|
|
|
59322
59313
|
// src/codegen/generators/definitions/enums.ts
|
|
59323
|
-
var
|
|
59314
|
+
var graphql18 = __toESM(require_graphql2(), 1);
|
|
59324
59315
|
var recast11 = __toESM(require_main2(), 1);
|
|
59325
59316
|
var AST11 = recast11.types.builders;
|
|
59326
59317
|
async function definitionsGenerator(config2) {
|
|
59327
|
-
const enums =
|
|
59318
|
+
const enums = graphql18.parse(graphql18.printSchema(config2.schema)).definitions.filter(
|
|
59328
59319
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
59329
59320
|
).filter((def) => !config2.isInternalEnum(def));
|
|
59330
59321
|
const runtimeDefinitions = recast11.print(
|
|
@@ -59497,7 +59488,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
59497
59488
|
}
|
|
59498
59489
|
|
|
59499
59490
|
// src/codegen/transforms/schema.ts
|
|
59500
|
-
var
|
|
59491
|
+
var graphql20 = __toESM(require_graphql2(), 1);
|
|
59501
59492
|
async function graphqlExtensions(config2, documents) {
|
|
59502
59493
|
const internalSchema = `
|
|
59503
59494
|
enum CachePolicy {
|
|
@@ -59575,19 +59566,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
59575
59566
|
"""
|
|
59576
59567
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
59577
59568
|
`;
|
|
59578
|
-
let currentSchema =
|
|
59569
|
+
let currentSchema = graphql20.printSchema(config2.schema);
|
|
59579
59570
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
59580
59571
|
currentSchema += internalSchema;
|
|
59581
59572
|
}
|
|
59582
59573
|
config2.newSchema += internalSchema;
|
|
59583
|
-
config2.schema =
|
|
59574
|
+
config2.schema = graphql20.buildSchema(currentSchema);
|
|
59584
59575
|
}
|
|
59585
59576
|
|
|
59586
59577
|
// src/codegen/transforms/typename.ts
|
|
59587
|
-
var
|
|
59578
|
+
var graphql21 = __toESM(require_graphql2(), 1);
|
|
59588
59579
|
async function addTypename(config2, documents) {
|
|
59589
59580
|
for (const doc of documents) {
|
|
59590
|
-
doc.document =
|
|
59581
|
+
doc.document = graphql21.visit(doc.document, {
|
|
59591
59582
|
Field(node, key, parent, path2, ancestors) {
|
|
59592
59583
|
if (!node.selectionSet) {
|
|
59593
59584
|
return;
|
|
@@ -59599,7 +59590,7 @@ async function addTypename(config2, documents) {
|
|
|
59599
59590
|
);
|
|
59600
59591
|
const field = type.getFields()[node.name.value];
|
|
59601
59592
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59602
|
-
if (
|
|
59593
|
+
if (graphql21.isInterfaceType(fieldType) || graphql21.isUnionType(fieldType)) {
|
|
59603
59594
|
return {
|
|
59604
59595
|
...node,
|
|
59605
59596
|
selectionSet: {
|
|
@@ -59607,9 +59598,9 @@ async function addTypename(config2, documents) {
|
|
|
59607
59598
|
selections: [
|
|
59608
59599
|
...node.selectionSet.selections,
|
|
59609
59600
|
{
|
|
59610
|
-
kind:
|
|
59601
|
+
kind: graphql21.Kind.FIELD,
|
|
59611
59602
|
name: {
|
|
59612
|
-
kind:
|
|
59603
|
+
kind: graphql21.Kind.NAME,
|
|
59613
59604
|
value: "__typename"
|
|
59614
59605
|
}
|
|
59615
59606
|
}
|
|
@@ -59623,10 +59614,10 @@ async function addTypename(config2, documents) {
|
|
|
59623
59614
|
}
|
|
59624
59615
|
|
|
59625
59616
|
// src/codegen/transforms/addID.ts
|
|
59626
|
-
var
|
|
59617
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
59627
59618
|
async function addID(config2, documents) {
|
|
59628
59619
|
for (const doc of documents) {
|
|
59629
|
-
doc.document =
|
|
59620
|
+
doc.document = graphql22.visit(doc.document, {
|
|
59630
59621
|
Field(node, key, parent, path2, ancestors) {
|
|
59631
59622
|
if (!node.selectionSet) {
|
|
59632
59623
|
return;
|
|
@@ -59639,7 +59630,7 @@ async function addID(config2, documents) {
|
|
|
59639
59630
|
const field = type.getFields()[node.name.value];
|
|
59640
59631
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59641
59632
|
if (node.selectionSet?.selections.length > 0) {
|
|
59642
|
-
if (!
|
|
59633
|
+
if (!graphql22.isObjectType(fieldType) && !graphql22.isInterfaceType(fieldType)) {
|
|
59643
59634
|
return;
|
|
59644
59635
|
}
|
|
59645
59636
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -59654,9 +59645,9 @@ async function addID(config2, documents) {
|
|
|
59654
59645
|
continue;
|
|
59655
59646
|
}
|
|
59656
59647
|
selections.push({
|
|
59657
|
-
kind:
|
|
59648
|
+
kind: graphql22.Kind.FIELD,
|
|
59658
59649
|
name: {
|
|
59659
|
-
kind:
|
|
59650
|
+
kind: graphql22.Kind.NAME,
|
|
59660
59651
|
value: keyField
|
|
59661
59652
|
}
|
|
59662
59653
|
});
|
|
@@ -59675,8 +59666,8 @@ async function addID(config2, documents) {
|
|
|
59675
59666
|
}
|
|
59676
59667
|
|
|
59677
59668
|
// src/codegen/transforms/fragmentVariables.ts
|
|
59678
|
-
var
|
|
59679
|
-
var GraphqlKinds2 =
|
|
59669
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
59670
|
+
var GraphqlKinds2 = graphql23.Kind;
|
|
59680
59671
|
async function fragmentVariables(config2, documents) {
|
|
59681
59672
|
const fragments = collectFragments(config2, documents);
|
|
59682
59673
|
const generatedFragments = {};
|
|
@@ -59699,7 +59690,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
59699
59690
|
});
|
|
59700
59691
|
}
|
|
59701
59692
|
const doc = {
|
|
59702
|
-
kind:
|
|
59693
|
+
kind: graphql23.Kind.DOCUMENT,
|
|
59703
59694
|
definitions: Object.values(generatedFragments)
|
|
59704
59695
|
};
|
|
59705
59696
|
documents.push({
|
|
@@ -59735,7 +59726,7 @@ function inlineFragmentArgs({
|
|
|
59735
59726
|
filepath,
|
|
59736
59727
|
document
|
|
59737
59728
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
59738
|
-
const result =
|
|
59729
|
+
const result = graphql23.visit(document, {
|
|
59739
59730
|
FragmentSpread(node) {
|
|
59740
59731
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
59741
59732
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -59823,7 +59814,7 @@ function inlineFragmentArgs({
|
|
|
59823
59814
|
});
|
|
59824
59815
|
if (newName) {
|
|
59825
59816
|
result.name = {
|
|
59826
|
-
kind:
|
|
59817
|
+
kind: graphql23.Kind.NAME,
|
|
59827
59818
|
value: newName
|
|
59828
59819
|
};
|
|
59829
59820
|
}
|
|
@@ -59935,7 +59926,7 @@ function operationScope(operation) {
|
|
|
59935
59926
|
}
|
|
59936
59927
|
|
|
59937
59928
|
// src/codegen/validators/typeCheck.ts
|
|
59938
|
-
var
|
|
59929
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
59939
59930
|
async function typeCheck(config2, docs) {
|
|
59940
59931
|
const errors = [];
|
|
59941
59932
|
const freeLists = [];
|
|
@@ -59943,11 +59934,11 @@ async function typeCheck(config2, docs) {
|
|
|
59943
59934
|
const listTypes = [];
|
|
59944
59935
|
const fragments = {};
|
|
59945
59936
|
for (const { document: parsed, filename } of docs) {
|
|
59946
|
-
|
|
59947
|
-
[
|
|
59937
|
+
graphql24.visit(parsed, {
|
|
59938
|
+
[graphql24.Kind.FRAGMENT_DEFINITION](definition) {
|
|
59948
59939
|
fragments[definition.name.value] = definition;
|
|
59949
59940
|
},
|
|
59950
|
-
[
|
|
59941
|
+
[graphql24.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
59951
59942
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
59952
59943
|
return;
|
|
59953
59944
|
}
|
|
@@ -59993,14 +59984,14 @@ async function typeCheck(config2, docs) {
|
|
|
59993
59984
|
);
|
|
59994
59985
|
return;
|
|
59995
59986
|
}
|
|
59996
|
-
if (
|
|
59987
|
+
if (graphql24.isListType(rootType) || graphql24.isNonNullType(rootType) && graphql24.isListType(rootType.ofType)) {
|
|
59997
59988
|
needsParent = true;
|
|
59998
59989
|
break;
|
|
59999
59990
|
}
|
|
60000
|
-
if (
|
|
59991
|
+
if (graphql24.isNonNullType(rootType) && "ofType" in rootType) {
|
|
60001
59992
|
rootType = rootType.ofType;
|
|
60002
59993
|
}
|
|
60003
|
-
if (
|
|
59994
|
+
if (graphql24.isScalarType(rootType)) {
|
|
60004
59995
|
break;
|
|
60005
59996
|
}
|
|
60006
59997
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -60056,7 +60047,7 @@ async function typeCheck(config2, docs) {
|
|
|
60056
60047
|
);
|
|
60057
60048
|
const targetField = ancestors[ancestors.length - 1];
|
|
60058
60049
|
const targetFieldDefinition = pType.getFields()[targetField.name.value];
|
|
60059
|
-
const { type, error } = connectionSelection(
|
|
60050
|
+
const { type, error: errorConnectionSelection } = connectionSelection(
|
|
60060
60051
|
config2,
|
|
60061
60052
|
targetFieldDefinition,
|
|
60062
60053
|
parentTypeFromAncestors(
|
|
@@ -60066,10 +60057,19 @@ async function typeCheck(config2, docs) {
|
|
|
60066
60057
|
),
|
|
60067
60058
|
targetField.selectionSet
|
|
60068
60059
|
);
|
|
60060
|
+
if (errorConnectionSelection && directive.name.value === config2.paginateDirective) {
|
|
60061
|
+
errors.push(
|
|
60062
|
+
new HoudiniError({
|
|
60063
|
+
filepath: filename,
|
|
60064
|
+
message: errorConnectionSelection,
|
|
60065
|
+
description: errorConnectionSelection
|
|
60066
|
+
})
|
|
60067
|
+
);
|
|
60068
|
+
}
|
|
60069
60069
|
let targetTypes = [type];
|
|
60070
|
-
if (
|
|
60070
|
+
if (graphql24.isUnionType(type)) {
|
|
60071
60071
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
60072
|
-
} else if (
|
|
60072
|
+
} else if (graphql24.isInterfaceType(type)) {
|
|
60073
60073
|
try {
|
|
60074
60074
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
60075
60075
|
if (!type.getFields()[key]) {
|
|
@@ -60083,23 +60083,16 @@ async function typeCheck(config2, docs) {
|
|
|
60083
60083
|
for (const targetType of targetTypes) {
|
|
60084
60084
|
const missingIDFields = config2.keyFieldsForType(targetType.name).filter((fieldName) => !targetType.getFields()[fieldName]);
|
|
60085
60085
|
if (missingIDFields.length > 0) {
|
|
60086
|
-
|
|
60087
|
-
|
|
60088
|
-
|
|
60089
|
-
|
|
60090
|
-
|
|
60091
|
-
|
|
60092
|
-
|
|
60093
|
-
|
|
60094
|
-
|
|
60095
|
-
|
|
60096
|
-
filepath: filename,
|
|
60097
|
-
message: `@${config2.listDirective} can only be applied to types with the necessary id fields: ${missingIDFields.join(
|
|
60098
|
-
", "
|
|
60099
|
-
)}.`
|
|
60100
|
-
})
|
|
60101
|
-
);
|
|
60102
|
-
}
|
|
60086
|
+
const message = `@${config2.listDirective} on ${logGreen(
|
|
60087
|
+
targetType.name
|
|
60088
|
+
)} as a configuration issue. Object identification missing: ${missingIDFields.map((c) => `"${logYellow(c)}"`).join(", ")}. Check 'Custom IDs' if needed.`;
|
|
60089
|
+
errors.push(
|
|
60090
|
+
new HoudiniError({
|
|
60091
|
+
filepath: filename,
|
|
60092
|
+
message,
|
|
60093
|
+
description: message
|
|
60094
|
+
})
|
|
60095
|
+
);
|
|
60103
60096
|
return;
|
|
60104
60097
|
}
|
|
60105
60098
|
}
|
|
@@ -60114,13 +60107,13 @@ async function typeCheck(config2, docs) {
|
|
|
60114
60107
|
if (errors.length > 0) {
|
|
60115
60108
|
throw errors;
|
|
60116
60109
|
}
|
|
60117
|
-
const rules = (filepath) => [...
|
|
60110
|
+
const rules = (filepath) => [...graphql24.specifiedRules].filter(
|
|
60118
60111
|
(rule) => ![
|
|
60119
|
-
|
|
60120
|
-
|
|
60121
|
-
|
|
60122
|
-
|
|
60123
|
-
|
|
60112
|
+
graphql24.NoUnusedFragmentsRule,
|
|
60113
|
+
graphql24.KnownFragmentNamesRule,
|
|
60114
|
+
graphql24.ExecutableDefinitionsRule,
|
|
60115
|
+
graphql24.KnownDirectivesRule,
|
|
60116
|
+
graphql24.KnownArgumentNamesRule
|
|
60124
60117
|
].includes(rule)
|
|
60125
60118
|
).concat(
|
|
60126
60119
|
validateLists({
|
|
@@ -60139,7 +60132,7 @@ async function typeCheck(config2, docs) {
|
|
|
60139
60132
|
noUnusedFragmentArguments(config2)
|
|
60140
60133
|
);
|
|
60141
60134
|
for (const { filename, document: parsed } of docs) {
|
|
60142
|
-
for (const error of
|
|
60135
|
+
for (const error of graphql24.validate(config2.schema, parsed, rules(filename))) {
|
|
60143
60136
|
errors.push(
|
|
60144
60137
|
new HoudiniError({
|
|
60145
60138
|
filepath: filename,
|
|
@@ -60165,7 +60158,7 @@ var validateLists = ({
|
|
|
60165
60158
|
if (!config2.isListFragment(node.name.value)) {
|
|
60166
60159
|
if (!fragments[node.name.value]) {
|
|
60167
60160
|
ctx.reportError(
|
|
60168
|
-
new
|
|
60161
|
+
new graphql24.GraphQLError(
|
|
60169
60162
|
"Encountered unknown fragment: " + node.name.value
|
|
60170
60163
|
)
|
|
60171
60164
|
);
|
|
@@ -60175,7 +60168,7 @@ var validateLists = ({
|
|
|
60175
60168
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
60176
60169
|
if (!lists.includes(listName)) {
|
|
60177
60170
|
ctx.reportError(
|
|
60178
|
-
new
|
|
60171
|
+
new graphql24.GraphQLError(
|
|
60179
60172
|
"Encountered fragment referencing unknown list: " + listName
|
|
60180
60173
|
)
|
|
60181
60174
|
);
|
|
@@ -60200,7 +60193,7 @@ var validateLists = ({
|
|
|
60200
60193
|
);
|
|
60201
60194
|
if (parentArg) {
|
|
60202
60195
|
ctx.reportError(
|
|
60203
|
-
new
|
|
60196
|
+
new graphql24.GraphQLError(
|
|
60204
60197
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
60205
60198
|
)
|
|
60206
60199
|
);
|
|
@@ -60216,7 +60209,7 @@ var validateLists = ({
|
|
|
60216
60209
|
return;
|
|
60217
60210
|
}
|
|
60218
60211
|
ctx.reportError(
|
|
60219
|
-
new
|
|
60212
|
+
new graphql24.GraphQLError(
|
|
60220
60213
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
60221
60214
|
)
|
|
60222
60215
|
);
|
|
@@ -60226,7 +60219,7 @@ var validateLists = ({
|
|
|
60226
60219
|
const directiveName = node.name.value;
|
|
60227
60220
|
if (directiveName === "connection") {
|
|
60228
60221
|
ctx.reportError(
|
|
60229
|
-
new
|
|
60222
|
+
new graphql24.GraphQLError(
|
|
60230
60223
|
"@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."
|
|
60231
60224
|
)
|
|
60232
60225
|
);
|
|
@@ -60235,7 +60228,7 @@ var validateLists = ({
|
|
|
60235
60228
|
if (!config2.isInternalDirective(node)) {
|
|
60236
60229
|
if (!config2.schema.getDirective(directiveName)) {
|
|
60237
60230
|
ctx.reportError(
|
|
60238
|
-
new
|
|
60231
|
+
new graphql24.GraphQLError(
|
|
60239
60232
|
"Encountered unknown directive: " + directiveName
|
|
60240
60233
|
)
|
|
60241
60234
|
);
|
|
@@ -60244,7 +60237,7 @@ var validateLists = ({
|
|
|
60244
60237
|
}
|
|
60245
60238
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
60246
60239
|
ctx.reportError(
|
|
60247
|
-
new
|
|
60240
|
+
new graphql24.GraphQLError(
|
|
60248
60241
|
"Encountered directive referencing unknown list: " + directiveName
|
|
60249
60242
|
)
|
|
60250
60243
|
);
|
|
@@ -60255,7 +60248,7 @@ var validateLists = ({
|
|
|
60255
60248
|
};
|
|
60256
60249
|
function knownArguments(config2) {
|
|
60257
60250
|
return function(ctx) {
|
|
60258
|
-
const nativeValidator =
|
|
60251
|
+
const nativeValidator = graphql24.KnownArgumentNamesRule(ctx);
|
|
60259
60252
|
return {
|
|
60260
60253
|
...nativeValidator,
|
|
60261
60254
|
Directive(directiveNode) {
|
|
@@ -60288,7 +60281,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60288
60281
|
for (const arg of node.arguments || []) {
|
|
60289
60282
|
if (arg.value.kind !== "ObjectValue") {
|
|
60290
60283
|
ctx.reportError(
|
|
60291
|
-
new
|
|
60284
|
+
new graphql24.GraphQLError("values in @arguments must be an object")
|
|
60292
60285
|
);
|
|
60293
60286
|
return;
|
|
60294
60287
|
}
|
|
@@ -60298,13 +60291,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60298
60291
|
);
|
|
60299
60292
|
if (!typeArg) {
|
|
60300
60293
|
ctx.reportError(
|
|
60301
|
-
new
|
|
60294
|
+
new graphql24.GraphQLError("missing type field for @arguments directive")
|
|
60302
60295
|
);
|
|
60303
60296
|
return;
|
|
60304
60297
|
}
|
|
60305
|
-
if (typeArg.value.kind !==
|
|
60298
|
+
if (typeArg.value.kind !== graphql24.Kind.STRING) {
|
|
60306
60299
|
ctx.reportError(
|
|
60307
|
-
new
|
|
60300
|
+
new graphql24.GraphQLError("type field to @arguments must be a string")
|
|
60308
60301
|
);
|
|
60309
60302
|
return;
|
|
60310
60303
|
}
|
|
@@ -60317,7 +60310,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60317
60310
|
);
|
|
60318
60311
|
if (typeArg.value.value !== defaultValueType) {
|
|
60319
60312
|
ctx.reportError(
|
|
60320
|
-
new
|
|
60313
|
+
new graphql24.GraphQLError(
|
|
60321
60314
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
60322
60315
|
)
|
|
60323
60316
|
);
|
|
@@ -60335,7 +60328,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60335
60328
|
try {
|
|
60336
60329
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
60337
60330
|
} catch (e) {
|
|
60338
|
-
ctx.reportError(new
|
|
60331
|
+
ctx.reportError(new graphql24.GraphQLError(e.message));
|
|
60339
60332
|
return;
|
|
60340
60333
|
}
|
|
60341
60334
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -60358,7 +60351,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60358
60351
|
);
|
|
60359
60352
|
if (missing.length > 0) {
|
|
60360
60353
|
ctx.reportError(
|
|
60361
|
-
new
|
|
60354
|
+
new graphql24.GraphQLError(
|
|
60362
60355
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
60363
60356
|
)
|
|
60364
60357
|
);
|
|
@@ -60369,7 +60362,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60369
60362
|
);
|
|
60370
60363
|
if (unknown.length > 0) {
|
|
60371
60364
|
ctx.reportError(
|
|
60372
|
-
new
|
|
60365
|
+
new graphql24.GraphQLError(
|
|
60373
60366
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
60374
60367
|
)
|
|
60375
60368
|
);
|
|
@@ -60381,7 +60374,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60381
60374
|
]
|
|
60382
60375
|
);
|
|
60383
60376
|
for (const [applied, target] of zipped) {
|
|
60384
|
-
if (applied.value.kind ===
|
|
60377
|
+
if (applied.value.kind === graphql24.Kind.VARIABLE || applied.value.kind === graphql24.Kind.LIST || applied.value.kind === graphql24.Kind.OBJECT) {
|
|
60385
60378
|
continue;
|
|
60386
60379
|
}
|
|
60387
60380
|
const appliedType = applied.value.kind.substring(
|
|
@@ -60390,7 +60383,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60390
60383
|
);
|
|
60391
60384
|
if (appliedType !== target) {
|
|
60392
60385
|
ctx.reportError(
|
|
60393
|
-
new
|
|
60386
|
+
new graphql24.GraphQLError(
|
|
60394
60387
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
60395
60388
|
)
|
|
60396
60389
|
);
|
|
@@ -60411,7 +60404,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60411
60404
|
}
|
|
60412
60405
|
if (alreadyPaginated) {
|
|
60413
60406
|
ctx.reportError(
|
|
60414
|
-
new
|
|
60407
|
+
new graphql24.GraphQLError(
|
|
60415
60408
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
60416
60409
|
)
|
|
60417
60410
|
);
|
|
@@ -60426,7 +60419,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60426
60419
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
60427
60420
|
if (hasRequiredArgs) {
|
|
60428
60421
|
ctx.reportError(
|
|
60429
|
-
new
|
|
60422
|
+
new graphql24.GraphQLError(
|
|
60430
60423
|
"@paginate cannot appear on a document with required args"
|
|
60431
60424
|
)
|
|
60432
60425
|
);
|
|
@@ -60458,14 +60451,14 @@ function paginateArgs(config2, filepath) {
|
|
|
60458
60451
|
const backwards = appliedArgs.has("last");
|
|
60459
60452
|
if (!forward && !backwards) {
|
|
60460
60453
|
ctx.reportError(
|
|
60461
|
-
new
|
|
60454
|
+
new graphql24.GraphQLError(
|
|
60462
60455
|
"A field with cursor-based pagination must have a first or last argument"
|
|
60463
60456
|
)
|
|
60464
60457
|
);
|
|
60465
60458
|
}
|
|
60466
60459
|
if (forward && backwards) {
|
|
60467
60460
|
ctx.reportError(
|
|
60468
|
-
new
|
|
60461
|
+
new graphql24.GraphQLError(
|
|
60469
60462
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
60470
60463
|
)
|
|
60471
60464
|
);
|
|
@@ -60479,7 +60472,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60479
60472
|
);
|
|
60480
60473
|
if (!appliedLimitArg) {
|
|
60481
60474
|
ctx.reportError(
|
|
60482
|
-
new
|
|
60475
|
+
new graphql24.GraphQLError(
|
|
60483
60476
|
"A field with offset-based pagination must have a limit argument"
|
|
60484
60477
|
)
|
|
60485
60478
|
);
|
|
@@ -60495,20 +60488,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
60495
60488
|
const args = /* @__PURE__ */ new Set();
|
|
60496
60489
|
return {
|
|
60497
60490
|
enter(node) {
|
|
60498
|
-
if (node.kind ===
|
|
60491
|
+
if (node.kind === graphql24.Kind.FRAGMENT_DEFINITION) {
|
|
60499
60492
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
60500
60493
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
60501
60494
|
args.add(arg);
|
|
60502
60495
|
}
|
|
60503
|
-
} else if (node.kind ===
|
|
60496
|
+
} else if (node.kind === graphql24.Kind.VARIABLE) {
|
|
60504
60497
|
args.delete(node.name.value);
|
|
60505
60498
|
}
|
|
60506
60499
|
},
|
|
60507
60500
|
leave(node) {
|
|
60508
|
-
if (node.kind ===
|
|
60501
|
+
if (node.kind === graphql24.Kind.FRAGMENT_DEFINITION) {
|
|
60509
60502
|
if (args.size > 0) {
|
|
60510
60503
|
ctx.reportError(
|
|
60511
|
-
new
|
|
60504
|
+
new graphql24.GraphQLError(
|
|
60512
60505
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
60513
60506
|
)
|
|
60514
60507
|
);
|
|
@@ -60544,7 +60537,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60544
60537
|
if (definition.kind === "OperationDefinition") {
|
|
60545
60538
|
if (definition.operation !== "query") {
|
|
60546
60539
|
ctx.reportError(
|
|
60547
|
-
new
|
|
60540
|
+
new graphql24.GraphQLError(
|
|
60548
60541
|
`@${node.name.value} must fall on a fragment or query document`
|
|
60549
60542
|
)
|
|
60550
60543
|
);
|
|
@@ -60556,7 +60549,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60556
60549
|
}
|
|
60557
60550
|
if (!possibleNodes.includes(definitionType)) {
|
|
60558
60551
|
ctx.reportError(
|
|
60559
|
-
new
|
|
60552
|
+
new graphql24.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
60560
60553
|
);
|
|
60561
60554
|
}
|
|
60562
60555
|
}
|
|
@@ -60575,7 +60568,7 @@ function checkMutationOperation(config2) {
|
|
|
60575
60568
|
);
|
|
60576
60569
|
if (append && prepend) {
|
|
60577
60570
|
ctx.reportError(
|
|
60578
|
-
new
|
|
60571
|
+
new graphql24.GraphQLError(
|
|
60579
60572
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
60580
60573
|
)
|
|
60581
60574
|
);
|
|
@@ -60589,7 +60582,7 @@ function checkMutationOperation(config2) {
|
|
|
60589
60582
|
);
|
|
60590
60583
|
if (parentId && allLists) {
|
|
60591
60584
|
ctx.reportError(
|
|
60592
|
-
new
|
|
60585
|
+
new graphql24.GraphQLError(
|
|
60593
60586
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
60594
60587
|
)
|
|
60595
60588
|
);
|
|
@@ -60611,7 +60604,7 @@ function checkMaskDirective(config2) {
|
|
|
60611
60604
|
);
|
|
60612
60605
|
if (maskEnableDirective && maskDisableDirective) {
|
|
60613
60606
|
ctx.reportError(
|
|
60614
|
-
new
|
|
60607
|
+
new graphql24.GraphQLError(
|
|
60615
60608
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
60616
60609
|
)
|
|
60617
60610
|
);
|
|
@@ -60627,7 +60620,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
60627
60620
|
if (!nodeInterface) {
|
|
60628
60621
|
return null;
|
|
60629
60622
|
}
|
|
60630
|
-
if (!
|
|
60623
|
+
if (!graphql24.isInterfaceType(nodeInterface)) {
|
|
60631
60624
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
60632
60625
|
return null;
|
|
60633
60626
|
}
|
|
@@ -60725,11 +60718,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
60725
60718
|
}
|
|
60726
60719
|
|
|
60727
60720
|
// src/codegen/validators/noIDAlias.ts
|
|
60728
|
-
var
|
|
60721
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
60729
60722
|
async function noIDAlias(config2, docs) {
|
|
60730
60723
|
const errors = [];
|
|
60731
60724
|
for (const { filename, document } of docs) {
|
|
60732
|
-
|
|
60725
|
+
graphql25.visit(document, {
|
|
60733
60726
|
Field(node, _, __, ___, ancestors) {
|
|
60734
60727
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
60735
60728
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -60953,6 +60946,7 @@ function testConfigFile(config2 = {}) {
|
|
|
60953
60946
|
ghostsByCursor(first: Int, after: String, last: Int, before: String): IsGhostConnection!
|
|
60954
60947
|
entitiesByCursor(first: Int, after: String, last: Int, before: String): EntityConnection!
|
|
60955
60948
|
node(id: ID!): Node
|
|
60949
|
+
customIdList: [CustomIdType]!
|
|
60956
60950
|
}
|
|
60957
60951
|
|
|
60958
60952
|
type PageInfo {
|
|
@@ -61086,6 +61080,12 @@ function testConfigFile(config2 = {}) {
|
|
|
61086
61080
|
Value3
|
|
61087
61081
|
Value2
|
|
61088
61082
|
}
|
|
61083
|
+
|
|
61084
|
+
type CustomIdType {
|
|
61085
|
+
foo: String!
|
|
61086
|
+
bar: String!
|
|
61087
|
+
dummy: String
|
|
61088
|
+
}
|
|
61089
61089
|
`,
|
|
61090
61090
|
scalars: {
|
|
61091
61091
|
DateTime: {
|
|
@@ -61105,6 +61105,9 @@ function testConfigFile(config2 = {}) {
|
|
|
61105
61105
|
resolve: {
|
|
61106
61106
|
queryField: "ghost"
|
|
61107
61107
|
}
|
|
61108
|
+
},
|
|
61109
|
+
CustomIdType: {
|
|
61110
|
+
keys: ["foo", "bar"]
|
|
61108
61111
|
}
|
|
61109
61112
|
},
|
|
61110
61113
|
logLevel: "quiet",
|
|
@@ -61144,7 +61147,7 @@ function pipelineTest(config2, documents, shouldPass, testBody) {
|
|
|
61144
61147
|
};
|
|
61145
61148
|
}
|
|
61146
61149
|
function mockCollectedDoc(query) {
|
|
61147
|
-
const parsed =
|
|
61150
|
+
const parsed = graphql26.parse(query);
|
|
61148
61151
|
const name2 = parsed.definitions[0].name.value;
|
|
61149
61152
|
const operations = parsed.definitions;
|
|
61150
61153
|
let kind = "HoudiniFragment" /* Fragment */;
|