houdini 1.2.1 → 1.2.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 +149 -104
- package/build/cmd-esm/index.js +149 -104
- package/build/codegen/generators/artifacts/selection.d.ts +2 -1
- package/build/codegen/utils/flattenSelections.d.ts +2 -4
- package/build/codegen-cjs/index.js +147 -102
- package/build/codegen-esm/index.js +147 -102
- package/build/lib-cjs/index.js +103 -45
- package/build/lib-esm/index.js +103 -45
- package/build/runtime/cache/cache.d.ts +3 -1
- package/build/runtime/cache/lists.d.ts +3 -3
- package/build/runtime/cache/storage.d.ts +2 -2
- package/build/runtime/cache/subscription.d.ts +1 -0
- package/build/runtime-cjs/cache/cache.d.ts +3 -1
- package/build/runtime-cjs/cache/cache.js +78 -27
- package/build/runtime-cjs/cache/lists.d.ts +3 -3
- package/build/runtime-cjs/cache/lists.js +7 -7
- package/build/runtime-cjs/cache/storage.d.ts +2 -2
- package/build/runtime-cjs/cache/storage.js +5 -5
- package/build/runtime-cjs/cache/subscription.d.ts +1 -0
- package/build/runtime-cjs/cache/subscription.js +3 -0
- package/build/runtime-cjs/client/plugins/mutation.js +10 -6
- package/build/runtime-esm/cache/cache.d.ts +3 -1
- package/build/runtime-esm/cache/cache.js +78 -27
- package/build/runtime-esm/cache/lists.d.ts +3 -3
- package/build/runtime-esm/cache/lists.js +7 -7
- package/build/runtime-esm/cache/storage.d.ts +2 -2
- package/build/runtime-esm/cache/storage.js +5 -5
- package/build/runtime-esm/cache/subscription.d.ts +1 -0
- package/build/runtime-esm/cache/subscription.js +3 -0
- package/build/runtime-esm/client/plugins/mutation.js +10 -6
- package/build/test-cjs/index.js +147 -102
- package/build/test-esm/index.js +147 -102
- package/build/vite-cjs/index.js +147 -102
- package/build/vite-esm/index.js +147 -102
- package/package.json +1 -1
package/build/vite-esm/index.js
CHANGED
|
@@ -67153,10 +67153,10 @@ var ListManager = class {
|
|
|
67153
67153
|
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
67154
67154
|
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
67155
67155
|
}
|
|
67156
|
-
removeIDFromAllLists(id) {
|
|
67156
|
+
removeIDFromAllLists(id, layer) {
|
|
67157
67157
|
for (const fieldMap of this.lists.values()) {
|
|
67158
67158
|
for (const list of fieldMap.values()) {
|
|
67159
|
-
list.removeID(id);
|
|
67159
|
+
list.removeID(id, void 0, layer);
|
|
67160
67160
|
}
|
|
67161
67161
|
}
|
|
67162
67162
|
}
|
|
@@ -67313,7 +67313,7 @@ var List = class {
|
|
|
67313
67313
|
layer: layer?.id
|
|
67314
67314
|
});
|
|
67315
67315
|
}
|
|
67316
|
-
removeID(id, variables = {}) {
|
|
67316
|
+
removeID(id, variables = {}, layer) {
|
|
67317
67317
|
if (!this.validateWhen()) {
|
|
67318
67318
|
return;
|
|
67319
67319
|
}
|
|
@@ -67360,7 +67360,7 @@ var List = class {
|
|
|
67360
67360
|
subscribers.map((sub) => sub[0]),
|
|
67361
67361
|
variables
|
|
67362
67362
|
);
|
|
67363
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
67363
|
+
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID, layer);
|
|
67364
67364
|
for (const [spec] of subscribers) {
|
|
67365
67365
|
spec.set(
|
|
67366
67366
|
this.cache._internal_unstable.getSelection({
|
|
@@ -67373,12 +67373,12 @@ var List = class {
|
|
|
67373
67373
|
}
|
|
67374
67374
|
return true;
|
|
67375
67375
|
}
|
|
67376
|
-
remove(data, variables = {}) {
|
|
67376
|
+
remove(data, variables = {}, layer) {
|
|
67377
67377
|
const targetID = this.cache._internal_unstable.id(this.listType(data), data);
|
|
67378
67378
|
if (!targetID) {
|
|
67379
67379
|
return;
|
|
67380
67380
|
}
|
|
67381
|
-
return this.removeID(targetID, variables);
|
|
67381
|
+
return this.removeID(targetID, variables, layer);
|
|
67382
67382
|
}
|
|
67383
67383
|
listType(data) {
|
|
67384
67384
|
return data.__typename || this.type;
|
|
@@ -67410,7 +67410,7 @@ var List = class {
|
|
|
67410
67410
|
layer,
|
|
67411
67411
|
where
|
|
67412
67412
|
}) {
|
|
67413
|
-
if (!this.remove(data, variables)) {
|
|
67413
|
+
if (!this.remove(data, variables, layer)) {
|
|
67414
67414
|
this.addToList(selection, data, variables, where, layer);
|
|
67415
67415
|
}
|
|
67416
67416
|
}
|
|
@@ -67547,7 +67547,7 @@ var StaleManager = class {
|
|
|
67547
67547
|
// src/runtime/cache/storage.ts
|
|
67548
67548
|
var InMemoryStorage = class {
|
|
67549
67549
|
data;
|
|
67550
|
-
idCount =
|
|
67550
|
+
idCount = 1;
|
|
67551
67551
|
rank = 0;
|
|
67552
67552
|
constructor() {
|
|
67553
67553
|
this.data = [];
|
|
@@ -67567,11 +67567,11 @@ var InMemoryStorage = class {
|
|
|
67567
67567
|
insert(id, field, location, target) {
|
|
67568
67568
|
return this.topLayer.insert(id, field, location, target);
|
|
67569
67569
|
}
|
|
67570
|
-
remove(id, field, target) {
|
|
67571
|
-
return
|
|
67570
|
+
remove(id, field, target, layerToUser = this.topLayer) {
|
|
67571
|
+
return layerToUser.remove(id, field, target);
|
|
67572
67572
|
}
|
|
67573
|
-
delete(id) {
|
|
67574
|
-
return
|
|
67573
|
+
delete(id, layerToUser = this.topLayer) {
|
|
67574
|
+
return layerToUser.delete(id);
|
|
67575
67575
|
}
|
|
67576
67576
|
deleteField(id, field) {
|
|
67577
67577
|
return this.topLayer.deleteField(id, field);
|
|
@@ -67943,6 +67943,9 @@ var InMemorySubscriptions = class {
|
|
|
67943
67943
|
subscribers = {};
|
|
67944
67944
|
referenceCounts = {};
|
|
67945
67945
|
keyVersions = {};
|
|
67946
|
+
activeFields(parent2) {
|
|
67947
|
+
return Object.keys(this.subscribers[parent2] || {});
|
|
67948
|
+
}
|
|
67946
67949
|
add({
|
|
67947
67950
|
parent: parent2,
|
|
67948
67951
|
spec,
|
|
@@ -68211,20 +68214,7 @@ var Cache = class {
|
|
|
68211
68214
|
}) {
|
|
68212
68215
|
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
68213
68216
|
const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
|
|
68214
|
-
|
|
68215
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
68216
|
-
if (!notified.includes(spec.set)) {
|
|
68217
|
-
notified.push(spec.set);
|
|
68218
|
-
spec.set(
|
|
68219
|
-
this._internal_unstable.getSelection({
|
|
68220
|
-
parent: spec.parentID || rootID,
|
|
68221
|
-
selection: spec.selection,
|
|
68222
|
-
variables: spec.variables?.() || {},
|
|
68223
|
-
ignoreMasking: false
|
|
68224
|
-
}).data
|
|
68225
|
-
);
|
|
68226
|
-
}
|
|
68227
|
-
}
|
|
68217
|
+
this.#notifySubscribers(subscribers.concat(notifySubscribers));
|
|
68228
68218
|
return subscribers;
|
|
68229
68219
|
}
|
|
68230
68220
|
read(...args) {
|
|
@@ -68263,10 +68253,10 @@ var Cache = class {
|
|
|
68263
68253
|
}
|
|
68264
68254
|
return handler;
|
|
68265
68255
|
}
|
|
68266
|
-
delete(id) {
|
|
68256
|
+
delete(id, layer) {
|
|
68267
68257
|
this._internal_unstable.subscriptions.removeAllSubscribers(id);
|
|
68268
|
-
this._internal_unstable.lists.removeIDFromAllLists(id);
|
|
68269
|
-
this._internal_unstable.storage.delete(id);
|
|
68258
|
+
this._internal_unstable.lists.removeIDFromAllLists(id, layer);
|
|
68259
|
+
this._internal_unstable.storage.delete(id, layer);
|
|
68270
68260
|
}
|
|
68271
68261
|
setConfig(config4) {
|
|
68272
68262
|
this._internal_unstable.setConfig(config4);
|
|
@@ -68298,6 +68288,70 @@ var Cache = class {
|
|
|
68298
68288
|
config() {
|
|
68299
68289
|
return this._internal_unstable.config;
|
|
68300
68290
|
}
|
|
68291
|
+
clearLayer(layerID) {
|
|
68292
|
+
const layer = this._internal_unstable.storage.getLayer(layerID);
|
|
68293
|
+
if (!layer) {
|
|
68294
|
+
throw new Error("Cannot find layer with id: " + layerID);
|
|
68295
|
+
}
|
|
68296
|
+
const toNotify = [];
|
|
68297
|
+
const allFields = [];
|
|
68298
|
+
for (const target of [layer.fields, layer.links]) {
|
|
68299
|
+
for (const [id, fields] of Object.entries(target)) {
|
|
68300
|
+
allFields.push(
|
|
68301
|
+
...Object.entries(fields).map(([field, value]) => ({ id, field, value }))
|
|
68302
|
+
);
|
|
68303
|
+
}
|
|
68304
|
+
}
|
|
68305
|
+
const displayFields = [];
|
|
68306
|
+
for (const pair of allFields) {
|
|
68307
|
+
const { displayLayers } = this._internal_unstable.storage.get(pair.id, pair.field);
|
|
68308
|
+
if (!displayLayers.includes(layerID)) {
|
|
68309
|
+
continue;
|
|
68310
|
+
}
|
|
68311
|
+
displayFields.push(pair);
|
|
68312
|
+
}
|
|
68313
|
+
for (const [id, operation] of Object.entries(layer.operations)) {
|
|
68314
|
+
if (operation.deleted) {
|
|
68315
|
+
displayFields.push(
|
|
68316
|
+
...this._internal_unstable.subscriptions.activeFields(id).map((field) => ({ id, field }))
|
|
68317
|
+
);
|
|
68318
|
+
}
|
|
68319
|
+
const fields = Object.keys(operation.fields ?? {});
|
|
68320
|
+
if (fields.length > 0) {
|
|
68321
|
+
displayFields.push(...fields.map((field) => ({ id, field })));
|
|
68322
|
+
}
|
|
68323
|
+
}
|
|
68324
|
+
layer.clear();
|
|
68325
|
+
for (const display of displayFields) {
|
|
68326
|
+
const { field, id } = display;
|
|
68327
|
+
const notify = !("value" in display) || this._internal_unstable.storage.get(id, field).value !== display.value;
|
|
68328
|
+
if (notify) {
|
|
68329
|
+
toNotify.push(
|
|
68330
|
+
...this._internal_unstable.subscriptions.get(id, field).map((sub) => sub[0])
|
|
68331
|
+
);
|
|
68332
|
+
}
|
|
68333
|
+
}
|
|
68334
|
+
this.#notifySubscribers(toNotify);
|
|
68335
|
+
}
|
|
68336
|
+
#notifySubscribers(subs) {
|
|
68337
|
+
if (subs.length === 0) {
|
|
68338
|
+
return;
|
|
68339
|
+
}
|
|
68340
|
+
const notified = [];
|
|
68341
|
+
for (const spec of subs) {
|
|
68342
|
+
if (!notified.includes(spec.set)) {
|
|
68343
|
+
notified.push(spec.set);
|
|
68344
|
+
spec.set(
|
|
68345
|
+
this._internal_unstable.getSelection({
|
|
68346
|
+
parent: spec.parentID || rootID,
|
|
68347
|
+
selection: spec.selection,
|
|
68348
|
+
variables: spec.variables?.() || {},
|
|
68349
|
+
ignoreMasking: false
|
|
68350
|
+
}).data
|
|
68351
|
+
);
|
|
68352
|
+
}
|
|
68353
|
+
}
|
|
68354
|
+
}
|
|
68301
68355
|
};
|
|
68302
68356
|
var CacheInternal = class {
|
|
68303
68357
|
_disabled = false;
|
|
@@ -68585,8 +68639,16 @@ var CacheInternal = class {
|
|
|
68585
68639
|
operation.position || "last",
|
|
68586
68640
|
layer
|
|
68587
68641
|
);
|
|
68642
|
+
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
68643
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
68644
|
+
selection: fieldSelection,
|
|
68645
|
+
data: target,
|
|
68646
|
+
variables,
|
|
68647
|
+
where: operation.position || "last",
|
|
68648
|
+
layer
|
|
68649
|
+
});
|
|
68588
68650
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
68589
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
68651
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
68590
68652
|
} else if (operation.action === "delete" && operation.type) {
|
|
68591
68653
|
if (typeof target !== "string") {
|
|
68592
68654
|
throw new Error("Cannot delete a record with a non-string ID");
|
|
@@ -68595,15 +68657,7 @@ var CacheInternal = class {
|
|
|
68595
68657
|
if (!targetID) {
|
|
68596
68658
|
continue;
|
|
68597
68659
|
}
|
|
68598
|
-
this.cache.delete(targetID);
|
|
68599
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
68600
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
68601
|
-
selection: fieldSelection,
|
|
68602
|
-
data: target,
|
|
68603
|
-
variables,
|
|
68604
|
-
where: operation.position || "last",
|
|
68605
|
-
layer
|
|
68606
|
-
});
|
|
68660
|
+
this.cache.delete(targetID, layer);
|
|
68607
68661
|
}
|
|
68608
68662
|
}
|
|
68609
68663
|
}
|
|
@@ -69138,7 +69192,7 @@ var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
|
69138
69192
|
var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
69139
69193
|
return {
|
|
69140
69194
|
async start(ctx, { next, marshalVariables }) {
|
|
69141
|
-
const
|
|
69195
|
+
const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
|
|
69142
69196
|
const optimisticResponse = ctx.stuff.optimisticResponse;
|
|
69143
69197
|
let toNotify = [];
|
|
69144
69198
|
if (optimisticResponse) {
|
|
@@ -69149,25 +69203,29 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
69149
69203
|
data: optimisticResponse
|
|
69150
69204
|
}),
|
|
69151
69205
|
variables: marshalVariables(ctx),
|
|
69152
|
-
layer:
|
|
69206
|
+
layer: layerOptimistic.id
|
|
69153
69207
|
});
|
|
69154
69208
|
}
|
|
69155
69209
|
ctx.cacheParams = {
|
|
69156
69210
|
...ctx.cacheParams,
|
|
69157
|
-
layer,
|
|
69211
|
+
layer: layerOptimistic,
|
|
69158
69212
|
notifySubscribers: toNotify,
|
|
69159
69213
|
forceNotify: true
|
|
69160
69214
|
};
|
|
69161
69215
|
next(ctx);
|
|
69162
69216
|
},
|
|
69163
69217
|
afterNetwork(ctx, { resolve: resolve2 }) {
|
|
69164
|
-
ctx.cacheParams?.layer
|
|
69218
|
+
if (ctx.cacheParams?.layer) {
|
|
69219
|
+
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
69220
|
+
}
|
|
69165
69221
|
resolve2(ctx);
|
|
69166
69222
|
},
|
|
69167
69223
|
end(ctx, { resolve: resolve2, value }) {
|
|
69168
69224
|
const hasErrors = value.errors && value.errors.length > 0;
|
|
69169
69225
|
if (hasErrors) {
|
|
69170
|
-
ctx.cacheParams?.layer
|
|
69226
|
+
if (ctx.cacheParams?.layer) {
|
|
69227
|
+
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
69228
|
+
}
|
|
69171
69229
|
}
|
|
69172
69230
|
if (ctx.cacheParams?.layer) {
|
|
69173
69231
|
cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
|
|
@@ -69177,7 +69235,7 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
69177
69235
|
catch(ctx, { error }) {
|
|
69178
69236
|
if (ctx.cacheParams?.layer) {
|
|
69179
69237
|
const { layer } = ctx.cacheParams;
|
|
69180
|
-
layer.
|
|
69238
|
+
cache_default.clearLayer(layer.id);
|
|
69181
69239
|
cache_default._internal_unstable.storage.resolveLayer(layer.id);
|
|
69182
69240
|
}
|
|
69183
69241
|
throw error;
|
|
@@ -70473,18 +70531,14 @@ function flattenSelections({
|
|
|
70473
70531
|
filepath,
|
|
70474
70532
|
selections,
|
|
70475
70533
|
fragmentDefinitions,
|
|
70476
|
-
|
|
70477
|
-
keepFragmentSpreadNodes,
|
|
70478
|
-
hoistFragments
|
|
70534
|
+
applyFragments
|
|
70479
70535
|
}) {
|
|
70480
70536
|
const fields = new FieldCollection({
|
|
70481
70537
|
config: config4,
|
|
70482
70538
|
filepath,
|
|
70483
70539
|
selections,
|
|
70484
70540
|
fragmentDefinitions,
|
|
70485
|
-
|
|
70486
|
-
keepFragmentSpreadNodes: !!keepFragmentSpreadNodes,
|
|
70487
|
-
hoistFragments
|
|
70541
|
+
applyFragments: !!applyFragments
|
|
70488
70542
|
});
|
|
70489
70543
|
return fields.toSelectionSet();
|
|
70490
70544
|
}
|
|
@@ -70495,18 +70549,14 @@ var FieldCollection = class {
|
|
|
70495
70549
|
fields;
|
|
70496
70550
|
inlineFragments;
|
|
70497
70551
|
fragmentSpreads;
|
|
70498
|
-
|
|
70499
|
-
keepFragmentSpreadNodes;
|
|
70500
|
-
hoistFragments;
|
|
70552
|
+
applyFragments;
|
|
70501
70553
|
constructor(args) {
|
|
70502
70554
|
this.config = args.config;
|
|
70503
70555
|
this.fragmentDefinitions = args.fragmentDefinitions;
|
|
70504
|
-
this.
|
|
70505
|
-
this.keepFragmentSpreadNodes = args.keepFragmentSpreadNodes;
|
|
70556
|
+
this.applyFragments = args.applyFragments;
|
|
70506
70557
|
this.fields = {};
|
|
70507
70558
|
this.inlineFragments = {};
|
|
70508
70559
|
this.fragmentSpreads = {};
|
|
70509
|
-
this.hoistFragments = !!args.hoistFragments;
|
|
70510
70560
|
this.filepath = args.filepath;
|
|
70511
70561
|
for (const selection of args.selections) {
|
|
70512
70562
|
this.add({ selection });
|
|
@@ -70516,21 +70566,18 @@ var FieldCollection = class {
|
|
|
70516
70566
|
return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
|
|
70517
70567
|
}
|
|
70518
70568
|
add({ selection, external }) {
|
|
70519
|
-
let
|
|
70569
|
+
let include = this.config.defaultFragmentMasking === "disable";
|
|
70520
70570
|
const maskEnableDirective = selection.directives?.find(
|
|
70521
70571
|
({ name }) => name.value === this.config.maskEnableDirective
|
|
70522
70572
|
);
|
|
70523
70573
|
if (maskEnableDirective) {
|
|
70524
|
-
|
|
70574
|
+
include = false;
|
|
70525
70575
|
}
|
|
70526
70576
|
const maskDisableDirective = selection.directives?.find(
|
|
70527
70577
|
({ name }) => name.value === this.config.maskDisableDirective
|
|
70528
70578
|
);
|
|
70529
70579
|
if (maskDisableDirective) {
|
|
70530
|
-
|
|
70531
|
-
}
|
|
70532
|
-
if (this.ignoreMaskDisable) {
|
|
70533
|
-
includeFragments = true;
|
|
70580
|
+
include = true;
|
|
70534
70581
|
}
|
|
70535
70582
|
if (selection.kind === "Field") {
|
|
70536
70583
|
const key = selection.alias?.value || selection.name.value;
|
|
@@ -70546,7 +70593,7 @@ var FieldCollection = class {
|
|
|
70546
70593
|
external
|
|
70547
70594
|
});
|
|
70548
70595
|
}
|
|
70549
|
-
if (
|
|
70596
|
+
if (this.applyFragments && !external) {
|
|
70550
70597
|
this.fields[key].selection.fragmentSpreads = {
|
|
70551
70598
|
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
70552
70599
|
...this.fields[key].selection.fragmentSpreads
|
|
@@ -70560,16 +70607,13 @@ var FieldCollection = class {
|
|
|
70560
70607
|
}
|
|
70561
70608
|
}
|
|
70562
70609
|
if (selection.kind === "InlineFragment" && selection.typeCondition) {
|
|
70563
|
-
this.walkInlineFragment({ selection, external
|
|
70610
|
+
this.walkInlineFragment({ selection, external });
|
|
70564
70611
|
return;
|
|
70565
70612
|
}
|
|
70566
70613
|
if (selection.kind === "FragmentSpread") {
|
|
70567
|
-
if (
|
|
70614
|
+
if (!external || include) {
|
|
70568
70615
|
this.fragmentSpreads[selection.name.value] = selection;
|
|
70569
70616
|
}
|
|
70570
|
-
if (!includeFragments) {
|
|
70571
|
-
return;
|
|
70572
|
-
}
|
|
70573
70617
|
const definition = this.fragmentDefinitions[selection.name.value];
|
|
70574
70618
|
if (!definition) {
|
|
70575
70619
|
throw new HoudiniError({
|
|
@@ -70577,23 +70621,25 @@ var FieldCollection = class {
|
|
|
70577
70621
|
message: "Could not find referenced fragment definition: " + selection.name.value + "\n" + JSON.stringify(Object.keys(this.fragmentDefinitions), null, 4)
|
|
70578
70622
|
});
|
|
70579
70623
|
}
|
|
70580
|
-
this.
|
|
70581
|
-
|
|
70582
|
-
|
|
70583
|
-
|
|
70584
|
-
|
|
70585
|
-
|
|
70586
|
-
|
|
70587
|
-
|
|
70624
|
+
if (this.applyFragments || include) {
|
|
70625
|
+
this.add({
|
|
70626
|
+
selection: {
|
|
70627
|
+
kind: "InlineFragment",
|
|
70628
|
+
typeCondition: {
|
|
70629
|
+
kind: "NamedType",
|
|
70630
|
+
name: {
|
|
70631
|
+
kind: "Name",
|
|
70632
|
+
value: definition.typeCondition.name.value
|
|
70633
|
+
}
|
|
70634
|
+
},
|
|
70635
|
+
selectionSet: {
|
|
70636
|
+
kind: "SelectionSet",
|
|
70637
|
+
selections: [...definition.selectionSet.selections]
|
|
70588
70638
|
}
|
|
70589
70639
|
},
|
|
70590
|
-
|
|
70591
|
-
|
|
70592
|
-
|
|
70593
|
-
}
|
|
70594
|
-
},
|
|
70595
|
-
external
|
|
70596
|
-
});
|
|
70640
|
+
external: !include
|
|
70641
|
+
});
|
|
70642
|
+
}
|
|
70597
70643
|
}
|
|
70598
70644
|
}
|
|
70599
70645
|
collectFragmentSpreads(selections, result = {}) {
|
|
@@ -70650,8 +70696,7 @@ var FieldCollection = class {
|
|
|
70650
70696
|
}
|
|
70651
70697
|
walkInlineFragment({
|
|
70652
70698
|
selection,
|
|
70653
|
-
external
|
|
70654
|
-
hoistFragments
|
|
70699
|
+
external
|
|
70655
70700
|
}) {
|
|
70656
70701
|
const key = selection.typeCondition.name.value;
|
|
70657
70702
|
if (!this.inlineFragments[key]) {
|
|
@@ -70661,7 +70706,7 @@ var FieldCollection = class {
|
|
|
70661
70706
|
};
|
|
70662
70707
|
}
|
|
70663
70708
|
for (const subselect of selection.selectionSet.selections || []) {
|
|
70664
|
-
if (subselect.kind === "
|
|
70709
|
+
if (subselect.kind === "Field" || subselect.kind === "InlineFragment" && !subselect.typeCondition) {
|
|
70665
70710
|
this.inlineFragments[key].selection.add({
|
|
70666
70711
|
selection: subselect,
|
|
70667
70712
|
external
|
|
@@ -70670,11 +70715,11 @@ var FieldCollection = class {
|
|
|
70670
70715
|
} else if (subselect.kind === "FragmentSpread") {
|
|
70671
70716
|
this.add({
|
|
70672
70717
|
selection: subselect,
|
|
70673
|
-
external
|
|
70718
|
+
external
|
|
70674
70719
|
});
|
|
70675
70720
|
continue;
|
|
70676
70721
|
} else {
|
|
70677
|
-
this.walkInlineFragment({ selection: subselect, external
|
|
70722
|
+
this.walkInlineFragment({ selection: subselect, external });
|
|
70678
70723
|
}
|
|
70679
70724
|
}
|
|
70680
70725
|
}
|
|
@@ -70684,9 +70729,7 @@ var FieldCollection = class {
|
|
|
70684
70729
|
fragmentDefinitions: this.fragmentDefinitions,
|
|
70685
70730
|
selections: [],
|
|
70686
70731
|
filepath: this.filepath,
|
|
70687
|
-
|
|
70688
|
-
keepFragmentSpreadNodes: this.keepFragmentSpreadNodes,
|
|
70689
|
-
hoistFragments: this.hoistFragments
|
|
70732
|
+
applyFragments: this.applyFragments
|
|
70690
70733
|
});
|
|
70691
70734
|
}
|
|
70692
70735
|
};
|
|
@@ -71615,7 +71658,7 @@ function operationObject({
|
|
|
71615
71658
|
if (operationKind === "insert" || operationKind === "toggle") {
|
|
71616
71659
|
operation.position = position;
|
|
71617
71660
|
}
|
|
71618
|
-
if (operationKind
|
|
71661
|
+
if (allLists && operationKind !== "delete") {
|
|
71619
71662
|
operation.target = "all";
|
|
71620
71663
|
}
|
|
71621
71664
|
if (parentID) {
|
|
@@ -72612,7 +72655,8 @@ function prepareSelection({
|
|
|
72612
72655
|
inConnection,
|
|
72613
72656
|
typeMap,
|
|
72614
72657
|
abstractTypes,
|
|
72615
|
-
globalLoading
|
|
72658
|
+
globalLoading,
|
|
72659
|
+
includeFragments
|
|
72616
72660
|
}) {
|
|
72617
72661
|
let object = {};
|
|
72618
72662
|
const loadingTypes = [];
|
|
@@ -72632,7 +72676,8 @@ function prepareSelection({
|
|
|
72632
72676
|
document,
|
|
72633
72677
|
typeMap,
|
|
72634
72678
|
abstractTypes,
|
|
72635
|
-
globalLoading
|
|
72679
|
+
globalLoading,
|
|
72680
|
+
includeFragments
|
|
72636
72681
|
}).fields || {}
|
|
72637
72682
|
);
|
|
72638
72683
|
} else {
|
|
@@ -72680,7 +72725,8 @@ function prepareSelection({
|
|
|
72680
72725
|
document,
|
|
72681
72726
|
typeMap,
|
|
72682
72727
|
abstractTypes,
|
|
72683
|
-
globalLoading
|
|
72728
|
+
globalLoading,
|
|
72729
|
+
includeFragments
|
|
72684
72730
|
}).fields
|
|
72685
72731
|
};
|
|
72686
72732
|
if (field.directives?.find((d) => d.name.value === config4.loadingDirective)) {
|
|
@@ -72798,7 +72844,8 @@ function prepareSelection({
|
|
|
72798
72844
|
inConnection: connectionState,
|
|
72799
72845
|
typeMap,
|
|
72800
72846
|
abstractTypes,
|
|
72801
|
-
globalLoading: forceLoading
|
|
72847
|
+
globalLoading: forceLoading,
|
|
72848
|
+
includeFragments
|
|
72802
72849
|
});
|
|
72803
72850
|
if (Object.values(fieldObj.selection.fields ?? {}).some((field2) => field2.required)) {
|
|
72804
72851
|
fieldObj.nullable = true;
|
|
@@ -73131,14 +73178,13 @@ function artifactGenerator(stats) {
|
|
|
73131
73178
|
document: doc,
|
|
73132
73179
|
rootType,
|
|
73133
73180
|
globalLoading,
|
|
73181
|
+
includeFragments: doc.kind !== ArtifactKind.Fragment,
|
|
73134
73182
|
selections: flattenSelections({
|
|
73135
73183
|
config: config4,
|
|
73136
73184
|
filepath: doc.filename,
|
|
73137
73185
|
selections: selectionSet.selections,
|
|
73138
73186
|
fragmentDefinitions,
|
|
73139
|
-
|
|
73140
|
-
keepFragmentSpreadNodes: true,
|
|
73141
|
-
hoistFragments: true
|
|
73187
|
+
applyFragments: doc.kind !== ArtifactKind.Fragment
|
|
73142
73188
|
}),
|
|
73143
73189
|
operations: operationsByPath(
|
|
73144
73190
|
config4,
|
|
@@ -74103,8 +74149,7 @@ async function generateDocumentTypes(config4, docs) {
|
|
|
74103
74149
|
config: config4,
|
|
74104
74150
|
filepath: filename,
|
|
74105
74151
|
selections: definition.selectionSet.selections,
|
|
74106
|
-
fragmentDefinitions
|
|
74107
|
-
keepFragmentSpreadNodes: true
|
|
74152
|
+
fragmentDefinitions
|
|
74108
74153
|
});
|
|
74109
74154
|
if (definition?.kind === "OperationDefinition") {
|
|
74110
74155
|
await generateOperationTypeDefs(
|