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-cjs/index.js
CHANGED
|
@@ -67158,10 +67158,10 @@ var ListManager = class {
|
|
|
67158
67158
|
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
67159
67159
|
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
67160
67160
|
}
|
|
67161
|
-
removeIDFromAllLists(id) {
|
|
67161
|
+
removeIDFromAllLists(id, layer) {
|
|
67162
67162
|
for (const fieldMap of this.lists.values()) {
|
|
67163
67163
|
for (const list of fieldMap.values()) {
|
|
67164
|
-
list.removeID(id);
|
|
67164
|
+
list.removeID(id, void 0, layer);
|
|
67165
67165
|
}
|
|
67166
67166
|
}
|
|
67167
67167
|
}
|
|
@@ -67318,7 +67318,7 @@ var List = class {
|
|
|
67318
67318
|
layer: layer?.id
|
|
67319
67319
|
});
|
|
67320
67320
|
}
|
|
67321
|
-
removeID(id, variables = {}) {
|
|
67321
|
+
removeID(id, variables = {}, layer) {
|
|
67322
67322
|
if (!this.validateWhen()) {
|
|
67323
67323
|
return;
|
|
67324
67324
|
}
|
|
@@ -67365,7 +67365,7 @@ var List = class {
|
|
|
67365
67365
|
subscribers.map((sub) => sub[0]),
|
|
67366
67366
|
variables
|
|
67367
67367
|
);
|
|
67368
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
67368
|
+
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID, layer);
|
|
67369
67369
|
for (const [spec] of subscribers) {
|
|
67370
67370
|
spec.set(
|
|
67371
67371
|
this.cache._internal_unstable.getSelection({
|
|
@@ -67378,12 +67378,12 @@ var List = class {
|
|
|
67378
67378
|
}
|
|
67379
67379
|
return true;
|
|
67380
67380
|
}
|
|
67381
|
-
remove(data, variables = {}) {
|
|
67381
|
+
remove(data, variables = {}, layer) {
|
|
67382
67382
|
const targetID = this.cache._internal_unstable.id(this.listType(data), data);
|
|
67383
67383
|
if (!targetID) {
|
|
67384
67384
|
return;
|
|
67385
67385
|
}
|
|
67386
|
-
return this.removeID(targetID, variables);
|
|
67386
|
+
return this.removeID(targetID, variables, layer);
|
|
67387
67387
|
}
|
|
67388
67388
|
listType(data) {
|
|
67389
67389
|
return data.__typename || this.type;
|
|
@@ -67415,7 +67415,7 @@ var List = class {
|
|
|
67415
67415
|
layer,
|
|
67416
67416
|
where
|
|
67417
67417
|
}) {
|
|
67418
|
-
if (!this.remove(data, variables)) {
|
|
67418
|
+
if (!this.remove(data, variables, layer)) {
|
|
67419
67419
|
this.addToList(selection, data, variables, where, layer);
|
|
67420
67420
|
}
|
|
67421
67421
|
}
|
|
@@ -67552,7 +67552,7 @@ var StaleManager = class {
|
|
|
67552
67552
|
// src/runtime/cache/storage.ts
|
|
67553
67553
|
var InMemoryStorage = class {
|
|
67554
67554
|
data;
|
|
67555
|
-
idCount =
|
|
67555
|
+
idCount = 1;
|
|
67556
67556
|
rank = 0;
|
|
67557
67557
|
constructor() {
|
|
67558
67558
|
this.data = [];
|
|
@@ -67572,11 +67572,11 @@ var InMemoryStorage = class {
|
|
|
67572
67572
|
insert(id, field, location, target) {
|
|
67573
67573
|
return this.topLayer.insert(id, field, location, target);
|
|
67574
67574
|
}
|
|
67575
|
-
remove(id, field, target) {
|
|
67576
|
-
return
|
|
67575
|
+
remove(id, field, target, layerToUser = this.topLayer) {
|
|
67576
|
+
return layerToUser.remove(id, field, target);
|
|
67577
67577
|
}
|
|
67578
|
-
delete(id) {
|
|
67579
|
-
return
|
|
67578
|
+
delete(id, layerToUser = this.topLayer) {
|
|
67579
|
+
return layerToUser.delete(id);
|
|
67580
67580
|
}
|
|
67581
67581
|
deleteField(id, field) {
|
|
67582
67582
|
return this.topLayer.deleteField(id, field);
|
|
@@ -67948,6 +67948,9 @@ var InMemorySubscriptions = class {
|
|
|
67948
67948
|
subscribers = {};
|
|
67949
67949
|
referenceCounts = {};
|
|
67950
67950
|
keyVersions = {};
|
|
67951
|
+
activeFields(parent2) {
|
|
67952
|
+
return Object.keys(this.subscribers[parent2] || {});
|
|
67953
|
+
}
|
|
67951
67954
|
add({
|
|
67952
67955
|
parent: parent2,
|
|
67953
67956
|
spec,
|
|
@@ -68216,20 +68219,7 @@ var Cache = class {
|
|
|
68216
68219
|
}) {
|
|
68217
68220
|
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
68218
68221
|
const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
|
|
68219
|
-
|
|
68220
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
68221
|
-
if (!notified.includes(spec.set)) {
|
|
68222
|
-
notified.push(spec.set);
|
|
68223
|
-
spec.set(
|
|
68224
|
-
this._internal_unstable.getSelection({
|
|
68225
|
-
parent: spec.parentID || rootID,
|
|
68226
|
-
selection: spec.selection,
|
|
68227
|
-
variables: spec.variables?.() || {},
|
|
68228
|
-
ignoreMasking: false
|
|
68229
|
-
}).data
|
|
68230
|
-
);
|
|
68231
|
-
}
|
|
68232
|
-
}
|
|
68222
|
+
this.#notifySubscribers(subscribers.concat(notifySubscribers));
|
|
68233
68223
|
return subscribers;
|
|
68234
68224
|
}
|
|
68235
68225
|
read(...args) {
|
|
@@ -68268,10 +68258,10 @@ var Cache = class {
|
|
|
68268
68258
|
}
|
|
68269
68259
|
return handler;
|
|
68270
68260
|
}
|
|
68271
|
-
delete(id) {
|
|
68261
|
+
delete(id, layer) {
|
|
68272
68262
|
this._internal_unstable.subscriptions.removeAllSubscribers(id);
|
|
68273
|
-
this._internal_unstable.lists.removeIDFromAllLists(id);
|
|
68274
|
-
this._internal_unstable.storage.delete(id);
|
|
68263
|
+
this._internal_unstable.lists.removeIDFromAllLists(id, layer);
|
|
68264
|
+
this._internal_unstable.storage.delete(id, layer);
|
|
68275
68265
|
}
|
|
68276
68266
|
setConfig(config4) {
|
|
68277
68267
|
this._internal_unstable.setConfig(config4);
|
|
@@ -68303,6 +68293,70 @@ var Cache = class {
|
|
|
68303
68293
|
config() {
|
|
68304
68294
|
return this._internal_unstable.config;
|
|
68305
68295
|
}
|
|
68296
|
+
clearLayer(layerID) {
|
|
68297
|
+
const layer = this._internal_unstable.storage.getLayer(layerID);
|
|
68298
|
+
if (!layer) {
|
|
68299
|
+
throw new Error("Cannot find layer with id: " + layerID);
|
|
68300
|
+
}
|
|
68301
|
+
const toNotify = [];
|
|
68302
|
+
const allFields = [];
|
|
68303
|
+
for (const target of [layer.fields, layer.links]) {
|
|
68304
|
+
for (const [id, fields] of Object.entries(target)) {
|
|
68305
|
+
allFields.push(
|
|
68306
|
+
...Object.entries(fields).map(([field, value]) => ({ id, field, value }))
|
|
68307
|
+
);
|
|
68308
|
+
}
|
|
68309
|
+
}
|
|
68310
|
+
const displayFields = [];
|
|
68311
|
+
for (const pair of allFields) {
|
|
68312
|
+
const { displayLayers } = this._internal_unstable.storage.get(pair.id, pair.field);
|
|
68313
|
+
if (!displayLayers.includes(layerID)) {
|
|
68314
|
+
continue;
|
|
68315
|
+
}
|
|
68316
|
+
displayFields.push(pair);
|
|
68317
|
+
}
|
|
68318
|
+
for (const [id, operation] of Object.entries(layer.operations)) {
|
|
68319
|
+
if (operation.deleted) {
|
|
68320
|
+
displayFields.push(
|
|
68321
|
+
...this._internal_unstable.subscriptions.activeFields(id).map((field) => ({ id, field }))
|
|
68322
|
+
);
|
|
68323
|
+
}
|
|
68324
|
+
const fields = Object.keys(operation.fields ?? {});
|
|
68325
|
+
if (fields.length > 0) {
|
|
68326
|
+
displayFields.push(...fields.map((field) => ({ id, field })));
|
|
68327
|
+
}
|
|
68328
|
+
}
|
|
68329
|
+
layer.clear();
|
|
68330
|
+
for (const display of displayFields) {
|
|
68331
|
+
const { field, id } = display;
|
|
68332
|
+
const notify = !("value" in display) || this._internal_unstable.storage.get(id, field).value !== display.value;
|
|
68333
|
+
if (notify) {
|
|
68334
|
+
toNotify.push(
|
|
68335
|
+
...this._internal_unstable.subscriptions.get(id, field).map((sub) => sub[0])
|
|
68336
|
+
);
|
|
68337
|
+
}
|
|
68338
|
+
}
|
|
68339
|
+
this.#notifySubscribers(toNotify);
|
|
68340
|
+
}
|
|
68341
|
+
#notifySubscribers(subs) {
|
|
68342
|
+
if (subs.length === 0) {
|
|
68343
|
+
return;
|
|
68344
|
+
}
|
|
68345
|
+
const notified = [];
|
|
68346
|
+
for (const spec of subs) {
|
|
68347
|
+
if (!notified.includes(spec.set)) {
|
|
68348
|
+
notified.push(spec.set);
|
|
68349
|
+
spec.set(
|
|
68350
|
+
this._internal_unstable.getSelection({
|
|
68351
|
+
parent: spec.parentID || rootID,
|
|
68352
|
+
selection: spec.selection,
|
|
68353
|
+
variables: spec.variables?.() || {},
|
|
68354
|
+
ignoreMasking: false
|
|
68355
|
+
}).data
|
|
68356
|
+
);
|
|
68357
|
+
}
|
|
68358
|
+
}
|
|
68359
|
+
}
|
|
68306
68360
|
};
|
|
68307
68361
|
var CacheInternal = class {
|
|
68308
68362
|
_disabled = false;
|
|
@@ -68590,8 +68644,16 @@ var CacheInternal = class {
|
|
|
68590
68644
|
operation.position || "last",
|
|
68591
68645
|
layer
|
|
68592
68646
|
);
|
|
68647
|
+
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
68648
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
68649
|
+
selection: fieldSelection,
|
|
68650
|
+
data: target,
|
|
68651
|
+
variables,
|
|
68652
|
+
where: operation.position || "last",
|
|
68653
|
+
layer
|
|
68654
|
+
});
|
|
68593
68655
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
68594
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
68656
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
68595
68657
|
} else if (operation.action === "delete" && operation.type) {
|
|
68596
68658
|
if (typeof target !== "string") {
|
|
68597
68659
|
throw new Error("Cannot delete a record with a non-string ID");
|
|
@@ -68600,15 +68662,7 @@ var CacheInternal = class {
|
|
|
68600
68662
|
if (!targetID) {
|
|
68601
68663
|
continue;
|
|
68602
68664
|
}
|
|
68603
|
-
this.cache.delete(targetID);
|
|
68604
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
68605
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
68606
|
-
selection: fieldSelection,
|
|
68607
|
-
data: target,
|
|
68608
|
-
variables,
|
|
68609
|
-
where: operation.position || "last",
|
|
68610
|
-
layer
|
|
68611
|
-
});
|
|
68665
|
+
this.cache.delete(targetID, layer);
|
|
68612
68666
|
}
|
|
68613
68667
|
}
|
|
68614
68668
|
}
|
|
@@ -69143,7 +69197,7 @@ var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
|
69143
69197
|
var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
69144
69198
|
return {
|
|
69145
69199
|
async start(ctx, { next, marshalVariables }) {
|
|
69146
|
-
const
|
|
69200
|
+
const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
|
|
69147
69201
|
const optimisticResponse = ctx.stuff.optimisticResponse;
|
|
69148
69202
|
let toNotify = [];
|
|
69149
69203
|
if (optimisticResponse) {
|
|
@@ -69154,25 +69208,29 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
69154
69208
|
data: optimisticResponse
|
|
69155
69209
|
}),
|
|
69156
69210
|
variables: marshalVariables(ctx),
|
|
69157
|
-
layer:
|
|
69211
|
+
layer: layerOptimistic.id
|
|
69158
69212
|
});
|
|
69159
69213
|
}
|
|
69160
69214
|
ctx.cacheParams = {
|
|
69161
69215
|
...ctx.cacheParams,
|
|
69162
|
-
layer,
|
|
69216
|
+
layer: layerOptimistic,
|
|
69163
69217
|
notifySubscribers: toNotify,
|
|
69164
69218
|
forceNotify: true
|
|
69165
69219
|
};
|
|
69166
69220
|
next(ctx);
|
|
69167
69221
|
},
|
|
69168
69222
|
afterNetwork(ctx, { resolve: resolve2 }) {
|
|
69169
|
-
ctx.cacheParams?.layer
|
|
69223
|
+
if (ctx.cacheParams?.layer) {
|
|
69224
|
+
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
69225
|
+
}
|
|
69170
69226
|
resolve2(ctx);
|
|
69171
69227
|
},
|
|
69172
69228
|
end(ctx, { resolve: resolve2, value }) {
|
|
69173
69229
|
const hasErrors = value.errors && value.errors.length > 0;
|
|
69174
69230
|
if (hasErrors) {
|
|
69175
|
-
ctx.cacheParams?.layer
|
|
69231
|
+
if (ctx.cacheParams?.layer) {
|
|
69232
|
+
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
69233
|
+
}
|
|
69176
69234
|
}
|
|
69177
69235
|
if (ctx.cacheParams?.layer) {
|
|
69178
69236
|
cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
|
|
@@ -69182,7 +69240,7 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
69182
69240
|
catch(ctx, { error }) {
|
|
69183
69241
|
if (ctx.cacheParams?.layer) {
|
|
69184
69242
|
const { layer } = ctx.cacheParams;
|
|
69185
|
-
layer.
|
|
69243
|
+
cache_default.clearLayer(layer.id);
|
|
69186
69244
|
cache_default._internal_unstable.storage.resolveLayer(layer.id);
|
|
69187
69245
|
}
|
|
69188
69246
|
throw error;
|
|
@@ -70479,18 +70537,14 @@ function flattenSelections({
|
|
|
70479
70537
|
filepath,
|
|
70480
70538
|
selections,
|
|
70481
70539
|
fragmentDefinitions,
|
|
70482
|
-
|
|
70483
|
-
keepFragmentSpreadNodes,
|
|
70484
|
-
hoistFragments
|
|
70540
|
+
applyFragments
|
|
70485
70541
|
}) {
|
|
70486
70542
|
const fields = new FieldCollection({
|
|
70487
70543
|
config: config4,
|
|
70488
70544
|
filepath,
|
|
70489
70545
|
selections,
|
|
70490
70546
|
fragmentDefinitions,
|
|
70491
|
-
|
|
70492
|
-
keepFragmentSpreadNodes: !!keepFragmentSpreadNodes,
|
|
70493
|
-
hoistFragments
|
|
70547
|
+
applyFragments: !!applyFragments
|
|
70494
70548
|
});
|
|
70495
70549
|
return fields.toSelectionSet();
|
|
70496
70550
|
}
|
|
@@ -70501,18 +70555,14 @@ var FieldCollection = class {
|
|
|
70501
70555
|
fields;
|
|
70502
70556
|
inlineFragments;
|
|
70503
70557
|
fragmentSpreads;
|
|
70504
|
-
|
|
70505
|
-
keepFragmentSpreadNodes;
|
|
70506
|
-
hoistFragments;
|
|
70558
|
+
applyFragments;
|
|
70507
70559
|
constructor(args) {
|
|
70508
70560
|
this.config = args.config;
|
|
70509
70561
|
this.fragmentDefinitions = args.fragmentDefinitions;
|
|
70510
|
-
this.
|
|
70511
|
-
this.keepFragmentSpreadNodes = args.keepFragmentSpreadNodes;
|
|
70562
|
+
this.applyFragments = args.applyFragments;
|
|
70512
70563
|
this.fields = {};
|
|
70513
70564
|
this.inlineFragments = {};
|
|
70514
70565
|
this.fragmentSpreads = {};
|
|
70515
|
-
this.hoistFragments = !!args.hoistFragments;
|
|
70516
70566
|
this.filepath = args.filepath;
|
|
70517
70567
|
for (const selection of args.selections) {
|
|
70518
70568
|
this.add({ selection });
|
|
@@ -70522,21 +70572,18 @@ var FieldCollection = class {
|
|
|
70522
70572
|
return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
|
|
70523
70573
|
}
|
|
70524
70574
|
add({ selection, external }) {
|
|
70525
|
-
let
|
|
70575
|
+
let include = this.config.defaultFragmentMasking === "disable";
|
|
70526
70576
|
const maskEnableDirective = selection.directives?.find(
|
|
70527
70577
|
({ name }) => name.value === this.config.maskEnableDirective
|
|
70528
70578
|
);
|
|
70529
70579
|
if (maskEnableDirective) {
|
|
70530
|
-
|
|
70580
|
+
include = false;
|
|
70531
70581
|
}
|
|
70532
70582
|
const maskDisableDirective = selection.directives?.find(
|
|
70533
70583
|
({ name }) => name.value === this.config.maskDisableDirective
|
|
70534
70584
|
);
|
|
70535
70585
|
if (maskDisableDirective) {
|
|
70536
|
-
|
|
70537
|
-
}
|
|
70538
|
-
if (this.ignoreMaskDisable) {
|
|
70539
|
-
includeFragments = true;
|
|
70586
|
+
include = true;
|
|
70540
70587
|
}
|
|
70541
70588
|
if (selection.kind === "Field") {
|
|
70542
70589
|
const key = selection.alias?.value || selection.name.value;
|
|
@@ -70552,7 +70599,7 @@ var FieldCollection = class {
|
|
|
70552
70599
|
external
|
|
70553
70600
|
});
|
|
70554
70601
|
}
|
|
70555
|
-
if (
|
|
70602
|
+
if (this.applyFragments && !external) {
|
|
70556
70603
|
this.fields[key].selection.fragmentSpreads = {
|
|
70557
70604
|
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
70558
70605
|
...this.fields[key].selection.fragmentSpreads
|
|
@@ -70566,16 +70613,13 @@ var FieldCollection = class {
|
|
|
70566
70613
|
}
|
|
70567
70614
|
}
|
|
70568
70615
|
if (selection.kind === "InlineFragment" && selection.typeCondition) {
|
|
70569
|
-
this.walkInlineFragment({ selection, external
|
|
70616
|
+
this.walkInlineFragment({ selection, external });
|
|
70570
70617
|
return;
|
|
70571
70618
|
}
|
|
70572
70619
|
if (selection.kind === "FragmentSpread") {
|
|
70573
|
-
if (
|
|
70620
|
+
if (!external || include) {
|
|
70574
70621
|
this.fragmentSpreads[selection.name.value] = selection;
|
|
70575
70622
|
}
|
|
70576
|
-
if (!includeFragments) {
|
|
70577
|
-
return;
|
|
70578
|
-
}
|
|
70579
70623
|
const definition = this.fragmentDefinitions[selection.name.value];
|
|
70580
70624
|
if (!definition) {
|
|
70581
70625
|
throw new HoudiniError({
|
|
@@ -70583,23 +70627,25 @@ var FieldCollection = class {
|
|
|
70583
70627
|
message: "Could not find referenced fragment definition: " + selection.name.value + "\n" + JSON.stringify(Object.keys(this.fragmentDefinitions), null, 4)
|
|
70584
70628
|
});
|
|
70585
70629
|
}
|
|
70586
|
-
this.
|
|
70587
|
-
|
|
70588
|
-
|
|
70589
|
-
|
|
70590
|
-
|
|
70591
|
-
|
|
70592
|
-
|
|
70593
|
-
|
|
70630
|
+
if (this.applyFragments || include) {
|
|
70631
|
+
this.add({
|
|
70632
|
+
selection: {
|
|
70633
|
+
kind: "InlineFragment",
|
|
70634
|
+
typeCondition: {
|
|
70635
|
+
kind: "NamedType",
|
|
70636
|
+
name: {
|
|
70637
|
+
kind: "Name",
|
|
70638
|
+
value: definition.typeCondition.name.value
|
|
70639
|
+
}
|
|
70640
|
+
},
|
|
70641
|
+
selectionSet: {
|
|
70642
|
+
kind: "SelectionSet",
|
|
70643
|
+
selections: [...definition.selectionSet.selections]
|
|
70594
70644
|
}
|
|
70595
70645
|
},
|
|
70596
|
-
|
|
70597
|
-
|
|
70598
|
-
|
|
70599
|
-
}
|
|
70600
|
-
},
|
|
70601
|
-
external
|
|
70602
|
-
});
|
|
70646
|
+
external: !include
|
|
70647
|
+
});
|
|
70648
|
+
}
|
|
70603
70649
|
}
|
|
70604
70650
|
}
|
|
70605
70651
|
collectFragmentSpreads(selections, result = {}) {
|
|
@@ -70656,8 +70702,7 @@ var FieldCollection = class {
|
|
|
70656
70702
|
}
|
|
70657
70703
|
walkInlineFragment({
|
|
70658
70704
|
selection,
|
|
70659
|
-
external
|
|
70660
|
-
hoistFragments
|
|
70705
|
+
external
|
|
70661
70706
|
}) {
|
|
70662
70707
|
const key = selection.typeCondition.name.value;
|
|
70663
70708
|
if (!this.inlineFragments[key]) {
|
|
@@ -70667,7 +70712,7 @@ var FieldCollection = class {
|
|
|
70667
70712
|
};
|
|
70668
70713
|
}
|
|
70669
70714
|
for (const subselect of selection.selectionSet.selections || []) {
|
|
70670
|
-
if (subselect.kind === "
|
|
70715
|
+
if (subselect.kind === "Field" || subselect.kind === "InlineFragment" && !subselect.typeCondition) {
|
|
70671
70716
|
this.inlineFragments[key].selection.add({
|
|
70672
70717
|
selection: subselect,
|
|
70673
70718
|
external
|
|
@@ -70676,11 +70721,11 @@ var FieldCollection = class {
|
|
|
70676
70721
|
} else if (subselect.kind === "FragmentSpread") {
|
|
70677
70722
|
this.add({
|
|
70678
70723
|
selection: subselect,
|
|
70679
|
-
external
|
|
70724
|
+
external
|
|
70680
70725
|
});
|
|
70681
70726
|
continue;
|
|
70682
70727
|
} else {
|
|
70683
|
-
this.walkInlineFragment({ selection: subselect, external
|
|
70728
|
+
this.walkInlineFragment({ selection: subselect, external });
|
|
70684
70729
|
}
|
|
70685
70730
|
}
|
|
70686
70731
|
}
|
|
@@ -70690,9 +70735,7 @@ var FieldCollection = class {
|
|
|
70690
70735
|
fragmentDefinitions: this.fragmentDefinitions,
|
|
70691
70736
|
selections: [],
|
|
70692
70737
|
filepath: this.filepath,
|
|
70693
|
-
|
|
70694
|
-
keepFragmentSpreadNodes: this.keepFragmentSpreadNodes,
|
|
70695
|
-
hoistFragments: this.hoistFragments
|
|
70738
|
+
applyFragments: this.applyFragments
|
|
70696
70739
|
});
|
|
70697
70740
|
}
|
|
70698
70741
|
};
|
|
@@ -71621,7 +71664,7 @@ function operationObject({
|
|
|
71621
71664
|
if (operationKind === "insert" || operationKind === "toggle") {
|
|
71622
71665
|
operation.position = position;
|
|
71623
71666
|
}
|
|
71624
|
-
if (operationKind
|
|
71667
|
+
if (allLists && operationKind !== "delete") {
|
|
71625
71668
|
operation.target = "all";
|
|
71626
71669
|
}
|
|
71627
71670
|
if (parentID) {
|
|
@@ -72618,7 +72661,8 @@ function prepareSelection({
|
|
|
72618
72661
|
inConnection,
|
|
72619
72662
|
typeMap,
|
|
72620
72663
|
abstractTypes,
|
|
72621
|
-
globalLoading
|
|
72664
|
+
globalLoading,
|
|
72665
|
+
includeFragments
|
|
72622
72666
|
}) {
|
|
72623
72667
|
let object = {};
|
|
72624
72668
|
const loadingTypes = [];
|
|
@@ -72638,7 +72682,8 @@ function prepareSelection({
|
|
|
72638
72682
|
document,
|
|
72639
72683
|
typeMap,
|
|
72640
72684
|
abstractTypes,
|
|
72641
|
-
globalLoading
|
|
72685
|
+
globalLoading,
|
|
72686
|
+
includeFragments
|
|
72642
72687
|
}).fields || {}
|
|
72643
72688
|
);
|
|
72644
72689
|
} else {
|
|
@@ -72686,7 +72731,8 @@ function prepareSelection({
|
|
|
72686
72731
|
document,
|
|
72687
72732
|
typeMap,
|
|
72688
72733
|
abstractTypes,
|
|
72689
|
-
globalLoading
|
|
72734
|
+
globalLoading,
|
|
72735
|
+
includeFragments
|
|
72690
72736
|
}).fields
|
|
72691
72737
|
};
|
|
72692
72738
|
if (field.directives?.find((d) => d.name.value === config4.loadingDirective)) {
|
|
@@ -72804,7 +72850,8 @@ function prepareSelection({
|
|
|
72804
72850
|
inConnection: connectionState,
|
|
72805
72851
|
typeMap,
|
|
72806
72852
|
abstractTypes,
|
|
72807
|
-
globalLoading: forceLoading
|
|
72853
|
+
globalLoading: forceLoading,
|
|
72854
|
+
includeFragments
|
|
72808
72855
|
});
|
|
72809
72856
|
if (Object.values(fieldObj.selection.fields ?? {}).some((field2) => field2.required)) {
|
|
72810
72857
|
fieldObj.nullable = true;
|
|
@@ -73137,14 +73184,13 @@ function artifactGenerator(stats) {
|
|
|
73137
73184
|
document: doc,
|
|
73138
73185
|
rootType,
|
|
73139
73186
|
globalLoading,
|
|
73187
|
+
includeFragments: doc.kind !== ArtifactKind.Fragment,
|
|
73140
73188
|
selections: flattenSelections({
|
|
73141
73189
|
config: config4,
|
|
73142
73190
|
filepath: doc.filename,
|
|
73143
73191
|
selections: selectionSet.selections,
|
|
73144
73192
|
fragmentDefinitions,
|
|
73145
|
-
|
|
73146
|
-
keepFragmentSpreadNodes: true,
|
|
73147
|
-
hoistFragments: true
|
|
73193
|
+
applyFragments: doc.kind !== ArtifactKind.Fragment
|
|
73148
73194
|
}),
|
|
73149
73195
|
operations: operationsByPath(
|
|
73150
73196
|
config4,
|
|
@@ -74109,8 +74155,7 @@ async function generateDocumentTypes(config4, docs) {
|
|
|
74109
74155
|
config: config4,
|
|
74110
74156
|
filepath: filename,
|
|
74111
74157
|
selections: definition.selectionSet.selections,
|
|
74112
|
-
fragmentDefinitions
|
|
74113
|
-
keepFragmentSpreadNodes: true
|
|
74158
|
+
fragmentDefinitions
|
|
74114
74159
|
});
|
|
74115
74160
|
if (definition?.kind === "OperationDefinition") {
|
|
74116
74161
|
await generateOperationTypeDefs(
|