houdini 1.2.0 → 1.2.2
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 +83 -68
- package/build/cmd-esm/index.js +83 -68
- package/build/codegen/generators/artifacts/selection.d.ts +2 -1
- package/build/codegen/utils/flattenSelections.d.ts +2 -3
- package/build/codegen-cjs/index.js +81 -66
- package/build/codegen-esm/index.js +81 -66
- package/build/lib-cjs/index.js +1 -1
- package/build/lib-esm/index.js +1 -1
- package/build/test-cjs/index.js +83 -66
- package/build/test-esm/index.js +83 -66
- package/build/vite-cjs/index.js +81 -66
- package/build/vite-esm/index.js +81 -66
- package/package.json +1 -1
|
@@ -57001,7 +57001,7 @@ function deepMerge2(filepath, ...targets) {
|
|
|
57001
57001
|
// src/lib/parse.ts
|
|
57002
57002
|
async function parseJS(str, config2) {
|
|
57003
57003
|
const defaultConfig = {
|
|
57004
|
-
plugins: ["typescript", "importAssertions"
|
|
57004
|
+
plugins: ["typescript", "importAssertions"],
|
|
57005
57005
|
sourceType: "module"
|
|
57006
57006
|
};
|
|
57007
57007
|
return (0, import_parser.parse)(str || "", config2 ? deepMerge2("", defaultConfig, config2) : defaultConfig).program;
|
|
@@ -57283,16 +57283,14 @@ function flattenSelections({
|
|
|
57283
57283
|
filepath,
|
|
57284
57284
|
selections,
|
|
57285
57285
|
fragmentDefinitions,
|
|
57286
|
-
|
|
57287
|
-
keepFragmentSpreadNodes
|
|
57286
|
+
applyFragments
|
|
57288
57287
|
}) {
|
|
57289
57288
|
const fields = new FieldCollection({
|
|
57290
57289
|
config: config2,
|
|
57291
57290
|
filepath,
|
|
57292
57291
|
selections,
|
|
57293
57292
|
fragmentDefinitions,
|
|
57294
|
-
|
|
57295
|
-
keepFragmentSpreadNodes: !!keepFragmentSpreadNodes
|
|
57293
|
+
applyFragments: !!applyFragments
|
|
57296
57294
|
});
|
|
57297
57295
|
return fields.toSelectionSet();
|
|
57298
57296
|
}
|
|
@@ -57303,25 +57301,36 @@ var FieldCollection = class {
|
|
|
57303
57301
|
fields;
|
|
57304
57302
|
inlineFragments;
|
|
57305
57303
|
fragmentSpreads;
|
|
57306
|
-
|
|
57307
|
-
keepFragmentSpreadNodes;
|
|
57304
|
+
applyFragments;
|
|
57308
57305
|
constructor(args) {
|
|
57309
57306
|
this.config = args.config;
|
|
57310
57307
|
this.fragmentDefinitions = args.fragmentDefinitions;
|
|
57311
|
-
this.
|
|
57312
|
-
this.keepFragmentSpreadNodes = args.keepFragmentSpreadNodes;
|
|
57308
|
+
this.applyFragments = args.applyFragments;
|
|
57313
57309
|
this.fields = {};
|
|
57314
57310
|
this.inlineFragments = {};
|
|
57315
57311
|
this.fragmentSpreads = {};
|
|
57316
57312
|
this.filepath = args.filepath;
|
|
57317
57313
|
for (const selection of args.selections) {
|
|
57318
|
-
this.add(selection);
|
|
57314
|
+
this.add({ selection });
|
|
57319
57315
|
}
|
|
57320
57316
|
}
|
|
57321
57317
|
get size() {
|
|
57322
57318
|
return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
|
|
57323
57319
|
}
|
|
57324
|
-
add(selection) {
|
|
57320
|
+
add({ selection, external }) {
|
|
57321
|
+
let include = this.config.defaultFragmentMasking === "disable";
|
|
57322
|
+
const maskEnableDirective = selection.directives?.find(
|
|
57323
|
+
({ name }) => name.value === this.config.maskEnableDirective
|
|
57324
|
+
);
|
|
57325
|
+
if (maskEnableDirective) {
|
|
57326
|
+
include = false;
|
|
57327
|
+
}
|
|
57328
|
+
const maskDisableDirective = selection.directives?.find(
|
|
57329
|
+
({ name }) => name.value === this.config.maskDisableDirective
|
|
57330
|
+
);
|
|
57331
|
+
if (maskDisableDirective) {
|
|
57332
|
+
include = true;
|
|
57333
|
+
}
|
|
57325
57334
|
if (selection.kind === "Field") {
|
|
57326
57335
|
const key = selection.alias?.value || selection.name.value;
|
|
57327
57336
|
if (!this.fields[key]) {
|
|
@@ -57331,46 +57340,32 @@ var FieldCollection = class {
|
|
|
57331
57340
|
};
|
|
57332
57341
|
}
|
|
57333
57342
|
for (const subselect of selection.selectionSet?.selections || []) {
|
|
57334
|
-
this.fields[key].selection.add(
|
|
57343
|
+
this.fields[key].selection.add({
|
|
57344
|
+
selection: subselect,
|
|
57345
|
+
external
|
|
57346
|
+
});
|
|
57347
|
+
}
|
|
57348
|
+
if (this.applyFragments && !external) {
|
|
57349
|
+
this.fields[key].selection.fragmentSpreads = {
|
|
57350
|
+
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
57351
|
+
...this.fields[key].selection.fragmentSpreads
|
|
57352
|
+
};
|
|
57335
57353
|
}
|
|
57336
|
-
this.fields[key].selection.fragmentSpreads = {
|
|
57337
|
-
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
57338
|
-
...this.fields[key].selection.fragmentSpreads
|
|
57339
|
-
};
|
|
57340
57354
|
return;
|
|
57341
57355
|
}
|
|
57342
57356
|
if (selection.kind === "InlineFragment" && !selection.typeCondition) {
|
|
57343
57357
|
for (const subselect of selection.selectionSet.selections) {
|
|
57344
|
-
this.add(subselect);
|
|
57358
|
+
this.add({ selection: subselect, external });
|
|
57345
57359
|
}
|
|
57346
57360
|
}
|
|
57347
57361
|
if (selection.kind === "InlineFragment" && selection.typeCondition) {
|
|
57348
|
-
this.walkInlineFragment(selection);
|
|
57362
|
+
this.walkInlineFragment({ selection, external });
|
|
57349
57363
|
return;
|
|
57350
57364
|
}
|
|
57351
57365
|
if (selection.kind === "FragmentSpread") {
|
|
57352
|
-
|
|
57353
|
-
const maskEnableDirective = selection.directives?.find(
|
|
57354
|
-
({ name }) => name.value === this.config.maskEnableDirective
|
|
57355
|
-
);
|
|
57356
|
-
if (maskEnableDirective) {
|
|
57357
|
-
includeFragments = false;
|
|
57358
|
-
}
|
|
57359
|
-
const maskDisableDirective = selection.directives?.find(
|
|
57360
|
-
({ name }) => name.value === this.config.maskDisableDirective
|
|
57361
|
-
);
|
|
57362
|
-
if (maskDisableDirective) {
|
|
57363
|
-
includeFragments = true;
|
|
57364
|
-
}
|
|
57365
|
-
if (this.ignoreMaskDisable) {
|
|
57366
|
-
includeFragments = true;
|
|
57367
|
-
}
|
|
57368
|
-
if (this.keepFragmentSpreadNodes) {
|
|
57366
|
+
if (!external || include) {
|
|
57369
57367
|
this.fragmentSpreads[selection.name.value] = selection;
|
|
57370
57368
|
}
|
|
57371
|
-
if (!includeFragments) {
|
|
57372
|
-
return;
|
|
57373
|
-
}
|
|
57374
57369
|
const definition = this.fragmentDefinitions[selection.name.value];
|
|
57375
57370
|
if (!definition) {
|
|
57376
57371
|
throw new HoudiniError({
|
|
@@ -57378,20 +57373,25 @@ var FieldCollection = class {
|
|
|
57378
57373
|
message: "Could not find referenced fragment definition: " + selection.name.value + "\n" + JSON.stringify(Object.keys(this.fragmentDefinitions), null, 4)
|
|
57379
57374
|
});
|
|
57380
57375
|
}
|
|
57381
|
-
this.
|
|
57382
|
-
|
|
57383
|
-
|
|
57384
|
-
|
|
57385
|
-
|
|
57386
|
-
|
|
57387
|
-
|
|
57388
|
-
|
|
57389
|
-
|
|
57390
|
-
|
|
57391
|
-
|
|
57392
|
-
|
|
57393
|
-
|
|
57394
|
-
|
|
57376
|
+
if (this.applyFragments || include) {
|
|
57377
|
+
this.add({
|
|
57378
|
+
selection: {
|
|
57379
|
+
kind: "InlineFragment",
|
|
57380
|
+
typeCondition: {
|
|
57381
|
+
kind: "NamedType",
|
|
57382
|
+
name: {
|
|
57383
|
+
kind: "Name",
|
|
57384
|
+
value: definition.typeCondition.name.value
|
|
57385
|
+
}
|
|
57386
|
+
},
|
|
57387
|
+
selectionSet: {
|
|
57388
|
+
kind: "SelectionSet",
|
|
57389
|
+
selections: [...definition.selectionSet.selections]
|
|
57390
|
+
}
|
|
57391
|
+
},
|
|
57392
|
+
external: !include
|
|
57393
|
+
});
|
|
57394
|
+
}
|
|
57395
57395
|
}
|
|
57396
57396
|
}
|
|
57397
57397
|
collectFragmentSpreads(selections, result = {}) {
|
|
@@ -57446,7 +57446,10 @@ var FieldCollection = class {
|
|
|
57446
57446
|
})
|
|
57447
57447
|
);
|
|
57448
57448
|
}
|
|
57449
|
-
walkInlineFragment(
|
|
57449
|
+
walkInlineFragment({
|
|
57450
|
+
selection,
|
|
57451
|
+
external
|
|
57452
|
+
}) {
|
|
57450
57453
|
const key = selection.typeCondition.name.value;
|
|
57451
57454
|
if (!this.inlineFragments[key]) {
|
|
57452
57455
|
this.inlineFragments[key] = {
|
|
@@ -57455,11 +57458,21 @@ var FieldCollection = class {
|
|
|
57455
57458
|
};
|
|
57456
57459
|
}
|
|
57457
57460
|
for (const subselect of selection.selectionSet.selections || []) {
|
|
57458
|
-
if (subselect.kind
|
|
57459
|
-
this.inlineFragments[key].selection.add(
|
|
57461
|
+
if (subselect.kind === "Field" || subselect.kind === "InlineFragment" && !subselect.typeCondition) {
|
|
57462
|
+
this.inlineFragments[key].selection.add({
|
|
57463
|
+
selection: subselect,
|
|
57464
|
+
external
|
|
57465
|
+
});
|
|
57466
|
+
continue;
|
|
57467
|
+
} else if (subselect.kind === "FragmentSpread") {
|
|
57468
|
+
this.add({
|
|
57469
|
+
selection: subselect,
|
|
57470
|
+
external
|
|
57471
|
+
});
|
|
57460
57472
|
continue;
|
|
57473
|
+
} else {
|
|
57474
|
+
this.walkInlineFragment({ selection: subselect, external });
|
|
57461
57475
|
}
|
|
57462
|
-
this.walkInlineFragment(subselect);
|
|
57463
57476
|
}
|
|
57464
57477
|
}
|
|
57465
57478
|
empty() {
|
|
@@ -57468,8 +57481,7 @@ var FieldCollection = class {
|
|
|
57468
57481
|
fragmentDefinitions: this.fragmentDefinitions,
|
|
57469
57482
|
selections: [],
|
|
57470
57483
|
filepath: this.filepath,
|
|
57471
|
-
|
|
57472
|
-
keepFragmentSpreadNodes: this.keepFragmentSpreadNodes
|
|
57484
|
+
applyFragments: this.applyFragments
|
|
57473
57485
|
});
|
|
57474
57486
|
}
|
|
57475
57487
|
};
|
|
@@ -59389,7 +59401,8 @@ function prepareSelection({
|
|
|
59389
59401
|
inConnection,
|
|
59390
59402
|
typeMap,
|
|
59391
59403
|
abstractTypes,
|
|
59392
|
-
globalLoading
|
|
59404
|
+
globalLoading,
|
|
59405
|
+
includeFragments
|
|
59393
59406
|
}) {
|
|
59394
59407
|
let object = {};
|
|
59395
59408
|
const loadingTypes = [];
|
|
@@ -59409,7 +59422,8 @@ function prepareSelection({
|
|
|
59409
59422
|
document,
|
|
59410
59423
|
typeMap,
|
|
59411
59424
|
abstractTypes,
|
|
59412
|
-
globalLoading
|
|
59425
|
+
globalLoading,
|
|
59426
|
+
includeFragments
|
|
59413
59427
|
}).fields || {}
|
|
59414
59428
|
);
|
|
59415
59429
|
} else {
|
|
@@ -59457,7 +59471,8 @@ function prepareSelection({
|
|
|
59457
59471
|
document,
|
|
59458
59472
|
typeMap,
|
|
59459
59473
|
abstractTypes,
|
|
59460
|
-
globalLoading
|
|
59474
|
+
globalLoading,
|
|
59475
|
+
includeFragments
|
|
59461
59476
|
}).fields
|
|
59462
59477
|
};
|
|
59463
59478
|
if (field.directives?.find((d) => d.name.value === config2.loadingDirective)) {
|
|
@@ -59575,7 +59590,8 @@ function prepareSelection({
|
|
|
59575
59590
|
inConnection: connectionState,
|
|
59576
59591
|
typeMap,
|
|
59577
59592
|
abstractTypes,
|
|
59578
|
-
globalLoading: forceLoading
|
|
59593
|
+
globalLoading: forceLoading,
|
|
59594
|
+
includeFragments
|
|
59579
59595
|
});
|
|
59580
59596
|
if (Object.values(fieldObj.selection.fields ?? {}).some((field2) => field2.required)) {
|
|
59581
59597
|
fieldObj.nullable = true;
|
|
@@ -59908,13 +59924,13 @@ function artifactGenerator(stats) {
|
|
|
59908
59924
|
document: doc,
|
|
59909
59925
|
rootType,
|
|
59910
59926
|
globalLoading,
|
|
59927
|
+
includeFragments: doc.kind !== ArtifactKind.Fragment,
|
|
59911
59928
|
selections: flattenSelections({
|
|
59912
59929
|
config: config2,
|
|
59913
59930
|
filepath: doc.filename,
|
|
59914
59931
|
selections: selectionSet.selections,
|
|
59915
59932
|
fragmentDefinitions,
|
|
59916
|
-
|
|
59917
|
-
keepFragmentSpreadNodes: true
|
|
59933
|
+
applyFragments: doc.kind !== ArtifactKind.Fragment
|
|
59918
59934
|
}),
|
|
59919
59935
|
operations: operationsByPath(
|
|
59920
59936
|
config2,
|
|
@@ -60879,8 +60895,7 @@ async function generateDocumentTypes(config2, docs) {
|
|
|
60879
60895
|
config: config2,
|
|
60880
60896
|
filepath: filename,
|
|
60881
60897
|
selections: definition.selectionSet.selections,
|
|
60882
|
-
fragmentDefinitions
|
|
60883
|
-
keepFragmentSpreadNodes: true
|
|
60898
|
+
fragmentDefinitions
|
|
60884
60899
|
});
|
|
60885
60900
|
if (definition?.kind === "OperationDefinition") {
|
|
60886
60901
|
await generateOperationTypeDefs(
|
|
@@ -56999,7 +56999,7 @@ function deepMerge2(filepath, ...targets) {
|
|
|
56999
56999
|
// src/lib/parse.ts
|
|
57000
57000
|
async function parseJS(str, config2) {
|
|
57001
57001
|
const defaultConfig = {
|
|
57002
|
-
plugins: ["typescript", "importAssertions"
|
|
57002
|
+
plugins: ["typescript", "importAssertions"],
|
|
57003
57003
|
sourceType: "module"
|
|
57004
57004
|
};
|
|
57005
57005
|
return (0, import_parser.parse)(str || "", config2 ? deepMerge2("", defaultConfig, config2) : defaultConfig).program;
|
|
@@ -57281,16 +57281,14 @@ function flattenSelections({
|
|
|
57281
57281
|
filepath,
|
|
57282
57282
|
selections,
|
|
57283
57283
|
fragmentDefinitions,
|
|
57284
|
-
|
|
57285
|
-
keepFragmentSpreadNodes
|
|
57284
|
+
applyFragments
|
|
57286
57285
|
}) {
|
|
57287
57286
|
const fields = new FieldCollection({
|
|
57288
57287
|
config: config2,
|
|
57289
57288
|
filepath,
|
|
57290
57289
|
selections,
|
|
57291
57290
|
fragmentDefinitions,
|
|
57292
|
-
|
|
57293
|
-
keepFragmentSpreadNodes: !!keepFragmentSpreadNodes
|
|
57291
|
+
applyFragments: !!applyFragments
|
|
57294
57292
|
});
|
|
57295
57293
|
return fields.toSelectionSet();
|
|
57296
57294
|
}
|
|
@@ -57301,25 +57299,36 @@ var FieldCollection = class {
|
|
|
57301
57299
|
fields;
|
|
57302
57300
|
inlineFragments;
|
|
57303
57301
|
fragmentSpreads;
|
|
57304
|
-
|
|
57305
|
-
keepFragmentSpreadNodes;
|
|
57302
|
+
applyFragments;
|
|
57306
57303
|
constructor(args) {
|
|
57307
57304
|
this.config = args.config;
|
|
57308
57305
|
this.fragmentDefinitions = args.fragmentDefinitions;
|
|
57309
|
-
this.
|
|
57310
|
-
this.keepFragmentSpreadNodes = args.keepFragmentSpreadNodes;
|
|
57306
|
+
this.applyFragments = args.applyFragments;
|
|
57311
57307
|
this.fields = {};
|
|
57312
57308
|
this.inlineFragments = {};
|
|
57313
57309
|
this.fragmentSpreads = {};
|
|
57314
57310
|
this.filepath = args.filepath;
|
|
57315
57311
|
for (const selection of args.selections) {
|
|
57316
|
-
this.add(selection);
|
|
57312
|
+
this.add({ selection });
|
|
57317
57313
|
}
|
|
57318
57314
|
}
|
|
57319
57315
|
get size() {
|
|
57320
57316
|
return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
|
|
57321
57317
|
}
|
|
57322
|
-
add(selection) {
|
|
57318
|
+
add({ selection, external }) {
|
|
57319
|
+
let include = this.config.defaultFragmentMasking === "disable";
|
|
57320
|
+
const maskEnableDirective = selection.directives?.find(
|
|
57321
|
+
({ name }) => name.value === this.config.maskEnableDirective
|
|
57322
|
+
);
|
|
57323
|
+
if (maskEnableDirective) {
|
|
57324
|
+
include = false;
|
|
57325
|
+
}
|
|
57326
|
+
const maskDisableDirective = selection.directives?.find(
|
|
57327
|
+
({ name }) => name.value === this.config.maskDisableDirective
|
|
57328
|
+
);
|
|
57329
|
+
if (maskDisableDirective) {
|
|
57330
|
+
include = true;
|
|
57331
|
+
}
|
|
57323
57332
|
if (selection.kind === "Field") {
|
|
57324
57333
|
const key = selection.alias?.value || selection.name.value;
|
|
57325
57334
|
if (!this.fields[key]) {
|
|
@@ -57329,46 +57338,32 @@ var FieldCollection = class {
|
|
|
57329
57338
|
};
|
|
57330
57339
|
}
|
|
57331
57340
|
for (const subselect of selection.selectionSet?.selections || []) {
|
|
57332
|
-
this.fields[key].selection.add(
|
|
57341
|
+
this.fields[key].selection.add({
|
|
57342
|
+
selection: subselect,
|
|
57343
|
+
external
|
|
57344
|
+
});
|
|
57345
|
+
}
|
|
57346
|
+
if (this.applyFragments && !external) {
|
|
57347
|
+
this.fields[key].selection.fragmentSpreads = {
|
|
57348
|
+
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
57349
|
+
...this.fields[key].selection.fragmentSpreads
|
|
57350
|
+
};
|
|
57333
57351
|
}
|
|
57334
|
-
this.fields[key].selection.fragmentSpreads = {
|
|
57335
|
-
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
57336
|
-
...this.fields[key].selection.fragmentSpreads
|
|
57337
|
-
};
|
|
57338
57352
|
return;
|
|
57339
57353
|
}
|
|
57340
57354
|
if (selection.kind === "InlineFragment" && !selection.typeCondition) {
|
|
57341
57355
|
for (const subselect of selection.selectionSet.selections) {
|
|
57342
|
-
this.add(subselect);
|
|
57356
|
+
this.add({ selection: subselect, external });
|
|
57343
57357
|
}
|
|
57344
57358
|
}
|
|
57345
57359
|
if (selection.kind === "InlineFragment" && selection.typeCondition) {
|
|
57346
|
-
this.walkInlineFragment(selection);
|
|
57360
|
+
this.walkInlineFragment({ selection, external });
|
|
57347
57361
|
return;
|
|
57348
57362
|
}
|
|
57349
57363
|
if (selection.kind === "FragmentSpread") {
|
|
57350
|
-
|
|
57351
|
-
const maskEnableDirective = selection.directives?.find(
|
|
57352
|
-
({ name }) => name.value === this.config.maskEnableDirective
|
|
57353
|
-
);
|
|
57354
|
-
if (maskEnableDirective) {
|
|
57355
|
-
includeFragments = false;
|
|
57356
|
-
}
|
|
57357
|
-
const maskDisableDirective = selection.directives?.find(
|
|
57358
|
-
({ name }) => name.value === this.config.maskDisableDirective
|
|
57359
|
-
);
|
|
57360
|
-
if (maskDisableDirective) {
|
|
57361
|
-
includeFragments = true;
|
|
57362
|
-
}
|
|
57363
|
-
if (this.ignoreMaskDisable) {
|
|
57364
|
-
includeFragments = true;
|
|
57365
|
-
}
|
|
57366
|
-
if (this.keepFragmentSpreadNodes) {
|
|
57364
|
+
if (!external || include) {
|
|
57367
57365
|
this.fragmentSpreads[selection.name.value] = selection;
|
|
57368
57366
|
}
|
|
57369
|
-
if (!includeFragments) {
|
|
57370
|
-
return;
|
|
57371
|
-
}
|
|
57372
57367
|
const definition = this.fragmentDefinitions[selection.name.value];
|
|
57373
57368
|
if (!definition) {
|
|
57374
57369
|
throw new HoudiniError({
|
|
@@ -57376,20 +57371,25 @@ var FieldCollection = class {
|
|
|
57376
57371
|
message: "Could not find referenced fragment definition: " + selection.name.value + "\n" + JSON.stringify(Object.keys(this.fragmentDefinitions), null, 4)
|
|
57377
57372
|
});
|
|
57378
57373
|
}
|
|
57379
|
-
this.
|
|
57380
|
-
|
|
57381
|
-
|
|
57382
|
-
|
|
57383
|
-
|
|
57384
|
-
|
|
57385
|
-
|
|
57386
|
-
|
|
57387
|
-
|
|
57388
|
-
|
|
57389
|
-
|
|
57390
|
-
|
|
57391
|
-
|
|
57392
|
-
|
|
57374
|
+
if (this.applyFragments || include) {
|
|
57375
|
+
this.add({
|
|
57376
|
+
selection: {
|
|
57377
|
+
kind: "InlineFragment",
|
|
57378
|
+
typeCondition: {
|
|
57379
|
+
kind: "NamedType",
|
|
57380
|
+
name: {
|
|
57381
|
+
kind: "Name",
|
|
57382
|
+
value: definition.typeCondition.name.value
|
|
57383
|
+
}
|
|
57384
|
+
},
|
|
57385
|
+
selectionSet: {
|
|
57386
|
+
kind: "SelectionSet",
|
|
57387
|
+
selections: [...definition.selectionSet.selections]
|
|
57388
|
+
}
|
|
57389
|
+
},
|
|
57390
|
+
external: !include
|
|
57391
|
+
});
|
|
57392
|
+
}
|
|
57393
57393
|
}
|
|
57394
57394
|
}
|
|
57395
57395
|
collectFragmentSpreads(selections, result = {}) {
|
|
@@ -57444,7 +57444,10 @@ var FieldCollection = class {
|
|
|
57444
57444
|
})
|
|
57445
57445
|
);
|
|
57446
57446
|
}
|
|
57447
|
-
walkInlineFragment(
|
|
57447
|
+
walkInlineFragment({
|
|
57448
|
+
selection,
|
|
57449
|
+
external
|
|
57450
|
+
}) {
|
|
57448
57451
|
const key = selection.typeCondition.name.value;
|
|
57449
57452
|
if (!this.inlineFragments[key]) {
|
|
57450
57453
|
this.inlineFragments[key] = {
|
|
@@ -57453,11 +57456,21 @@ var FieldCollection = class {
|
|
|
57453
57456
|
};
|
|
57454
57457
|
}
|
|
57455
57458
|
for (const subselect of selection.selectionSet.selections || []) {
|
|
57456
|
-
if (subselect.kind
|
|
57457
|
-
this.inlineFragments[key].selection.add(
|
|
57459
|
+
if (subselect.kind === "Field" || subselect.kind === "InlineFragment" && !subselect.typeCondition) {
|
|
57460
|
+
this.inlineFragments[key].selection.add({
|
|
57461
|
+
selection: subselect,
|
|
57462
|
+
external
|
|
57463
|
+
});
|
|
57464
|
+
continue;
|
|
57465
|
+
} else if (subselect.kind === "FragmentSpread") {
|
|
57466
|
+
this.add({
|
|
57467
|
+
selection: subselect,
|
|
57468
|
+
external
|
|
57469
|
+
});
|
|
57458
57470
|
continue;
|
|
57471
|
+
} else {
|
|
57472
|
+
this.walkInlineFragment({ selection: subselect, external });
|
|
57459
57473
|
}
|
|
57460
|
-
this.walkInlineFragment(subselect);
|
|
57461
57474
|
}
|
|
57462
57475
|
}
|
|
57463
57476
|
empty() {
|
|
@@ -57466,8 +57479,7 @@ var FieldCollection = class {
|
|
|
57466
57479
|
fragmentDefinitions: this.fragmentDefinitions,
|
|
57467
57480
|
selections: [],
|
|
57468
57481
|
filepath: this.filepath,
|
|
57469
|
-
|
|
57470
|
-
keepFragmentSpreadNodes: this.keepFragmentSpreadNodes
|
|
57482
|
+
applyFragments: this.applyFragments
|
|
57471
57483
|
});
|
|
57472
57484
|
}
|
|
57473
57485
|
};
|
|
@@ -59387,7 +59399,8 @@ function prepareSelection({
|
|
|
59387
59399
|
inConnection,
|
|
59388
59400
|
typeMap,
|
|
59389
59401
|
abstractTypes,
|
|
59390
|
-
globalLoading
|
|
59402
|
+
globalLoading,
|
|
59403
|
+
includeFragments
|
|
59391
59404
|
}) {
|
|
59392
59405
|
let object = {};
|
|
59393
59406
|
const loadingTypes = [];
|
|
@@ -59407,7 +59420,8 @@ function prepareSelection({
|
|
|
59407
59420
|
document,
|
|
59408
59421
|
typeMap,
|
|
59409
59422
|
abstractTypes,
|
|
59410
|
-
globalLoading
|
|
59423
|
+
globalLoading,
|
|
59424
|
+
includeFragments
|
|
59411
59425
|
}).fields || {}
|
|
59412
59426
|
);
|
|
59413
59427
|
} else {
|
|
@@ -59455,7 +59469,8 @@ function prepareSelection({
|
|
|
59455
59469
|
document,
|
|
59456
59470
|
typeMap,
|
|
59457
59471
|
abstractTypes,
|
|
59458
|
-
globalLoading
|
|
59472
|
+
globalLoading,
|
|
59473
|
+
includeFragments
|
|
59459
59474
|
}).fields
|
|
59460
59475
|
};
|
|
59461
59476
|
if (field.directives?.find((d) => d.name.value === config2.loadingDirective)) {
|
|
@@ -59573,7 +59588,8 @@ function prepareSelection({
|
|
|
59573
59588
|
inConnection: connectionState,
|
|
59574
59589
|
typeMap,
|
|
59575
59590
|
abstractTypes,
|
|
59576
|
-
globalLoading: forceLoading
|
|
59591
|
+
globalLoading: forceLoading,
|
|
59592
|
+
includeFragments
|
|
59577
59593
|
});
|
|
59578
59594
|
if (Object.values(fieldObj.selection.fields ?? {}).some((field2) => field2.required)) {
|
|
59579
59595
|
fieldObj.nullable = true;
|
|
@@ -59906,13 +59922,13 @@ function artifactGenerator(stats) {
|
|
|
59906
59922
|
document: doc,
|
|
59907
59923
|
rootType,
|
|
59908
59924
|
globalLoading,
|
|
59925
|
+
includeFragments: doc.kind !== ArtifactKind.Fragment,
|
|
59909
59926
|
selections: flattenSelections({
|
|
59910
59927
|
config: config2,
|
|
59911
59928
|
filepath: doc.filename,
|
|
59912
59929
|
selections: selectionSet.selections,
|
|
59913
59930
|
fragmentDefinitions,
|
|
59914
|
-
|
|
59915
|
-
keepFragmentSpreadNodes: true
|
|
59931
|
+
applyFragments: doc.kind !== ArtifactKind.Fragment
|
|
59916
59932
|
}),
|
|
59917
59933
|
operations: operationsByPath(
|
|
59918
59934
|
config2,
|
|
@@ -60877,8 +60893,7 @@ async function generateDocumentTypes(config2, docs) {
|
|
|
60877
60893
|
config: config2,
|
|
60878
60894
|
filepath: filename,
|
|
60879
60895
|
selections: definition.selectionSet.selections,
|
|
60880
|
-
fragmentDefinitions
|
|
60881
|
-
keepFragmentSpreadNodes: true
|
|
60896
|
+
fragmentDefinitions
|
|
60882
60897
|
});
|
|
60883
60898
|
if (definition?.kind === "OperationDefinition") {
|
|
60884
60899
|
await generateOperationTypeDefs(
|
package/build/lib-cjs/index.js
CHANGED
|
@@ -67483,7 +67483,7 @@ function deepMerge2(filepath, ...targets) {
|
|
|
67483
67483
|
// src/lib/parse.ts
|
|
67484
67484
|
async function parseJS(str, config) {
|
|
67485
67485
|
const defaultConfig = {
|
|
67486
|
-
plugins: ["typescript", "importAssertions"
|
|
67486
|
+
plugins: ["typescript", "importAssertions"],
|
|
67487
67487
|
sourceType: "module"
|
|
67488
67488
|
};
|
|
67489
67489
|
return (0, import_parser.parse)(str || "", config ? deepMerge2("", defaultConfig, config) : defaultConfig).program;
|
package/build/lib-esm/index.js
CHANGED
|
@@ -67424,7 +67424,7 @@ function deepMerge2(filepath, ...targets) {
|
|
|
67424
67424
|
// src/lib/parse.ts
|
|
67425
67425
|
async function parseJS(str, config) {
|
|
67426
67426
|
const defaultConfig = {
|
|
67427
|
-
plugins: ["typescript", "importAssertions"
|
|
67427
|
+
plugins: ["typescript", "importAssertions"],
|
|
67428
67428
|
sourceType: "module"
|
|
67429
67429
|
};
|
|
67430
67430
|
return (0, import_parser.parse)(str || "", config ? deepMerge2("", defaultConfig, config) : defaultConfig).program;
|