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
|
@@ -54771,10 +54771,10 @@ var ListManager = class {
|
|
|
54771
54771
|
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
54772
54772
|
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
54773
54773
|
}
|
|
54774
|
-
removeIDFromAllLists(id) {
|
|
54774
|
+
removeIDFromAllLists(id, layer) {
|
|
54775
54775
|
for (const fieldMap of this.lists.values()) {
|
|
54776
54776
|
for (const list of fieldMap.values()) {
|
|
54777
|
-
list.removeID(id);
|
|
54777
|
+
list.removeID(id, void 0, layer);
|
|
54778
54778
|
}
|
|
54779
54779
|
}
|
|
54780
54780
|
}
|
|
@@ -54931,7 +54931,7 @@ var List = class {
|
|
|
54931
54931
|
layer: layer?.id
|
|
54932
54932
|
});
|
|
54933
54933
|
}
|
|
54934
|
-
removeID(id, variables = {}) {
|
|
54934
|
+
removeID(id, variables = {}, layer) {
|
|
54935
54935
|
if (!this.validateWhen()) {
|
|
54936
54936
|
return;
|
|
54937
54937
|
}
|
|
@@ -54978,7 +54978,7 @@ var List = class {
|
|
|
54978
54978
|
subscribers.map((sub) => sub[0]),
|
|
54979
54979
|
variables
|
|
54980
54980
|
);
|
|
54981
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
54981
|
+
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID, layer);
|
|
54982
54982
|
for (const [spec] of subscribers) {
|
|
54983
54983
|
spec.set(
|
|
54984
54984
|
this.cache._internal_unstable.getSelection({
|
|
@@ -54991,12 +54991,12 @@ var List = class {
|
|
|
54991
54991
|
}
|
|
54992
54992
|
return true;
|
|
54993
54993
|
}
|
|
54994
|
-
remove(data, variables = {}) {
|
|
54994
|
+
remove(data, variables = {}, layer) {
|
|
54995
54995
|
const targetID = this.cache._internal_unstable.id(this.listType(data), data);
|
|
54996
54996
|
if (!targetID) {
|
|
54997
54997
|
return;
|
|
54998
54998
|
}
|
|
54999
|
-
return this.removeID(targetID, variables);
|
|
54999
|
+
return this.removeID(targetID, variables, layer);
|
|
55000
55000
|
}
|
|
55001
55001
|
listType(data) {
|
|
55002
55002
|
return data.__typename || this.type;
|
|
@@ -55028,7 +55028,7 @@ var List = class {
|
|
|
55028
55028
|
layer,
|
|
55029
55029
|
where
|
|
55030
55030
|
}) {
|
|
55031
|
-
if (!this.remove(data, variables)) {
|
|
55031
|
+
if (!this.remove(data, variables, layer)) {
|
|
55032
55032
|
this.addToList(selection, data, variables, where, layer);
|
|
55033
55033
|
}
|
|
55034
55034
|
}
|
|
@@ -55165,7 +55165,7 @@ var StaleManager = class {
|
|
|
55165
55165
|
// src/runtime/cache/storage.ts
|
|
55166
55166
|
var InMemoryStorage = class {
|
|
55167
55167
|
data;
|
|
55168
|
-
idCount =
|
|
55168
|
+
idCount = 1;
|
|
55169
55169
|
rank = 0;
|
|
55170
55170
|
constructor() {
|
|
55171
55171
|
this.data = [];
|
|
@@ -55185,11 +55185,11 @@ var InMemoryStorage = class {
|
|
|
55185
55185
|
insert(id, field, location, target) {
|
|
55186
55186
|
return this.topLayer.insert(id, field, location, target);
|
|
55187
55187
|
}
|
|
55188
|
-
remove(id, field, target) {
|
|
55189
|
-
return
|
|
55188
|
+
remove(id, field, target, layerToUser = this.topLayer) {
|
|
55189
|
+
return layerToUser.remove(id, field, target);
|
|
55190
55190
|
}
|
|
55191
|
-
delete(id) {
|
|
55192
|
-
return
|
|
55191
|
+
delete(id, layerToUser = this.topLayer) {
|
|
55192
|
+
return layerToUser.delete(id);
|
|
55193
55193
|
}
|
|
55194
55194
|
deleteField(id, field) {
|
|
55195
55195
|
return this.topLayer.deleteField(id, field);
|
|
@@ -55561,6 +55561,9 @@ var InMemorySubscriptions = class {
|
|
|
55561
55561
|
subscribers = {};
|
|
55562
55562
|
referenceCounts = {};
|
|
55563
55563
|
keyVersions = {};
|
|
55564
|
+
activeFields(parent2) {
|
|
55565
|
+
return Object.keys(this.subscribers[parent2] || {});
|
|
55566
|
+
}
|
|
55564
55567
|
add({
|
|
55565
55568
|
parent: parent2,
|
|
55566
55569
|
spec,
|
|
@@ -55829,20 +55832,7 @@ var Cache = class {
|
|
|
55829
55832
|
}) {
|
|
55830
55833
|
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
55831
55834
|
const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
|
|
55832
|
-
|
|
55833
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
55834
|
-
if (!notified.includes(spec.set)) {
|
|
55835
|
-
notified.push(spec.set);
|
|
55836
|
-
spec.set(
|
|
55837
|
-
this._internal_unstable.getSelection({
|
|
55838
|
-
parent: spec.parentID || rootID,
|
|
55839
|
-
selection: spec.selection,
|
|
55840
|
-
variables: spec.variables?.() || {},
|
|
55841
|
-
ignoreMasking: false
|
|
55842
|
-
}).data
|
|
55843
|
-
);
|
|
55844
|
-
}
|
|
55845
|
-
}
|
|
55835
|
+
this.#notifySubscribers(subscribers.concat(notifySubscribers));
|
|
55846
55836
|
return subscribers;
|
|
55847
55837
|
}
|
|
55848
55838
|
read(...args) {
|
|
@@ -55881,10 +55871,10 @@ var Cache = class {
|
|
|
55881
55871
|
}
|
|
55882
55872
|
return handler;
|
|
55883
55873
|
}
|
|
55884
|
-
delete(id) {
|
|
55874
|
+
delete(id, layer) {
|
|
55885
55875
|
this._internal_unstable.subscriptions.removeAllSubscribers(id);
|
|
55886
|
-
this._internal_unstable.lists.removeIDFromAllLists(id);
|
|
55887
|
-
this._internal_unstable.storage.delete(id);
|
|
55876
|
+
this._internal_unstable.lists.removeIDFromAllLists(id, layer);
|
|
55877
|
+
this._internal_unstable.storage.delete(id, layer);
|
|
55888
55878
|
}
|
|
55889
55879
|
setConfig(config2) {
|
|
55890
55880
|
this._internal_unstable.setConfig(config2);
|
|
@@ -55916,6 +55906,70 @@ var Cache = class {
|
|
|
55916
55906
|
config() {
|
|
55917
55907
|
return this._internal_unstable.config;
|
|
55918
55908
|
}
|
|
55909
|
+
clearLayer(layerID) {
|
|
55910
|
+
const layer = this._internal_unstable.storage.getLayer(layerID);
|
|
55911
|
+
if (!layer) {
|
|
55912
|
+
throw new Error("Cannot find layer with id: " + layerID);
|
|
55913
|
+
}
|
|
55914
|
+
const toNotify = [];
|
|
55915
|
+
const allFields = [];
|
|
55916
|
+
for (const target of [layer.fields, layer.links]) {
|
|
55917
|
+
for (const [id, fields] of Object.entries(target)) {
|
|
55918
|
+
allFields.push(
|
|
55919
|
+
...Object.entries(fields).map(([field, value]) => ({ id, field, value }))
|
|
55920
|
+
);
|
|
55921
|
+
}
|
|
55922
|
+
}
|
|
55923
|
+
const displayFields = [];
|
|
55924
|
+
for (const pair of allFields) {
|
|
55925
|
+
const { displayLayers } = this._internal_unstable.storage.get(pair.id, pair.field);
|
|
55926
|
+
if (!displayLayers.includes(layerID)) {
|
|
55927
|
+
continue;
|
|
55928
|
+
}
|
|
55929
|
+
displayFields.push(pair);
|
|
55930
|
+
}
|
|
55931
|
+
for (const [id, operation] of Object.entries(layer.operations)) {
|
|
55932
|
+
if (operation.deleted) {
|
|
55933
|
+
displayFields.push(
|
|
55934
|
+
...this._internal_unstable.subscriptions.activeFields(id).map((field) => ({ id, field }))
|
|
55935
|
+
);
|
|
55936
|
+
}
|
|
55937
|
+
const fields = Object.keys(operation.fields ?? {});
|
|
55938
|
+
if (fields.length > 0) {
|
|
55939
|
+
displayFields.push(...fields.map((field) => ({ id, field })));
|
|
55940
|
+
}
|
|
55941
|
+
}
|
|
55942
|
+
layer.clear();
|
|
55943
|
+
for (const display of displayFields) {
|
|
55944
|
+
const { field, id } = display;
|
|
55945
|
+
const notify = !("value" in display) || this._internal_unstable.storage.get(id, field).value !== display.value;
|
|
55946
|
+
if (notify) {
|
|
55947
|
+
toNotify.push(
|
|
55948
|
+
...this._internal_unstable.subscriptions.get(id, field).map((sub) => sub[0])
|
|
55949
|
+
);
|
|
55950
|
+
}
|
|
55951
|
+
}
|
|
55952
|
+
this.#notifySubscribers(toNotify);
|
|
55953
|
+
}
|
|
55954
|
+
#notifySubscribers(subs) {
|
|
55955
|
+
if (subs.length === 0) {
|
|
55956
|
+
return;
|
|
55957
|
+
}
|
|
55958
|
+
const notified = [];
|
|
55959
|
+
for (const spec of subs) {
|
|
55960
|
+
if (!notified.includes(spec.set)) {
|
|
55961
|
+
notified.push(spec.set);
|
|
55962
|
+
spec.set(
|
|
55963
|
+
this._internal_unstable.getSelection({
|
|
55964
|
+
parent: spec.parentID || rootID,
|
|
55965
|
+
selection: spec.selection,
|
|
55966
|
+
variables: spec.variables?.() || {},
|
|
55967
|
+
ignoreMasking: false
|
|
55968
|
+
}).data
|
|
55969
|
+
);
|
|
55970
|
+
}
|
|
55971
|
+
}
|
|
55972
|
+
}
|
|
55919
55973
|
};
|
|
55920
55974
|
var CacheInternal = class {
|
|
55921
55975
|
_disabled = false;
|
|
@@ -56203,8 +56257,16 @@ var CacheInternal = class {
|
|
|
56203
56257
|
operation.position || "last",
|
|
56204
56258
|
layer
|
|
56205
56259
|
);
|
|
56260
|
+
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
56261
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
56262
|
+
selection: fieldSelection,
|
|
56263
|
+
data: target,
|
|
56264
|
+
variables,
|
|
56265
|
+
where: operation.position || "last",
|
|
56266
|
+
layer
|
|
56267
|
+
});
|
|
56206
56268
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
56207
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
56269
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
56208
56270
|
} else if (operation.action === "delete" && operation.type) {
|
|
56209
56271
|
if (typeof target !== "string") {
|
|
56210
56272
|
throw new Error("Cannot delete a record with a non-string ID");
|
|
@@ -56213,15 +56275,7 @@ var CacheInternal = class {
|
|
|
56213
56275
|
if (!targetID) {
|
|
56214
56276
|
continue;
|
|
56215
56277
|
}
|
|
56216
|
-
this.cache.delete(targetID);
|
|
56217
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
56218
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
56219
|
-
selection: fieldSelection,
|
|
56220
|
-
data: target,
|
|
56221
|
-
variables,
|
|
56222
|
-
where: operation.position || "last",
|
|
56223
|
-
layer
|
|
56224
|
-
});
|
|
56278
|
+
this.cache.delete(targetID, layer);
|
|
56225
56279
|
}
|
|
56226
56280
|
}
|
|
56227
56281
|
}
|
|
@@ -56756,7 +56810,7 @@ var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
|
56756
56810
|
var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
56757
56811
|
return {
|
|
56758
56812
|
async start(ctx, { next, marshalVariables }) {
|
|
56759
|
-
const
|
|
56813
|
+
const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
|
|
56760
56814
|
const optimisticResponse = ctx.stuff.optimisticResponse;
|
|
56761
56815
|
let toNotify = [];
|
|
56762
56816
|
if (optimisticResponse) {
|
|
@@ -56767,25 +56821,29 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
56767
56821
|
data: optimisticResponse
|
|
56768
56822
|
}),
|
|
56769
56823
|
variables: marshalVariables(ctx),
|
|
56770
|
-
layer:
|
|
56824
|
+
layer: layerOptimistic.id
|
|
56771
56825
|
});
|
|
56772
56826
|
}
|
|
56773
56827
|
ctx.cacheParams = {
|
|
56774
56828
|
...ctx.cacheParams,
|
|
56775
|
-
layer,
|
|
56829
|
+
layer: layerOptimistic,
|
|
56776
56830
|
notifySubscribers: toNotify,
|
|
56777
56831
|
forceNotify: true
|
|
56778
56832
|
};
|
|
56779
56833
|
next(ctx);
|
|
56780
56834
|
},
|
|
56781
56835
|
afterNetwork(ctx, { resolve: resolve2 }) {
|
|
56782
|
-
ctx.cacheParams?.layer
|
|
56836
|
+
if (ctx.cacheParams?.layer) {
|
|
56837
|
+
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
56838
|
+
}
|
|
56783
56839
|
resolve2(ctx);
|
|
56784
56840
|
},
|
|
56785
56841
|
end(ctx, { resolve: resolve2, value }) {
|
|
56786
56842
|
const hasErrors = value.errors && value.errors.length > 0;
|
|
56787
56843
|
if (hasErrors) {
|
|
56788
|
-
ctx.cacheParams?.layer
|
|
56844
|
+
if (ctx.cacheParams?.layer) {
|
|
56845
|
+
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
56846
|
+
}
|
|
56789
56847
|
}
|
|
56790
56848
|
if (ctx.cacheParams?.layer) {
|
|
56791
56849
|
cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
|
|
@@ -56795,7 +56853,7 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
56795
56853
|
catch(ctx, { error }) {
|
|
56796
56854
|
if (ctx.cacheParams?.layer) {
|
|
56797
56855
|
const { layer } = ctx.cacheParams;
|
|
56798
|
-
layer.
|
|
56856
|
+
cache_default.clearLayer(layer.id);
|
|
56799
56857
|
cache_default._internal_unstable.storage.resolveLayer(layer.id);
|
|
56800
56858
|
}
|
|
56801
56859
|
throw error;
|
|
@@ -57283,18 +57341,14 @@ function flattenSelections({
|
|
|
57283
57341
|
filepath,
|
|
57284
57342
|
selections,
|
|
57285
57343
|
fragmentDefinitions,
|
|
57286
|
-
|
|
57287
|
-
keepFragmentSpreadNodes,
|
|
57288
|
-
hoistFragments
|
|
57344
|
+
applyFragments
|
|
57289
57345
|
}) {
|
|
57290
57346
|
const fields = new FieldCollection({
|
|
57291
57347
|
config: config2,
|
|
57292
57348
|
filepath,
|
|
57293
57349
|
selections,
|
|
57294
57350
|
fragmentDefinitions,
|
|
57295
|
-
|
|
57296
|
-
keepFragmentSpreadNodes: !!keepFragmentSpreadNodes,
|
|
57297
|
-
hoistFragments
|
|
57351
|
+
applyFragments: !!applyFragments
|
|
57298
57352
|
});
|
|
57299
57353
|
return fields.toSelectionSet();
|
|
57300
57354
|
}
|
|
@@ -57305,18 +57359,14 @@ var FieldCollection = class {
|
|
|
57305
57359
|
fields;
|
|
57306
57360
|
inlineFragments;
|
|
57307
57361
|
fragmentSpreads;
|
|
57308
|
-
|
|
57309
|
-
keepFragmentSpreadNodes;
|
|
57310
|
-
hoistFragments;
|
|
57362
|
+
applyFragments;
|
|
57311
57363
|
constructor(args) {
|
|
57312
57364
|
this.config = args.config;
|
|
57313
57365
|
this.fragmentDefinitions = args.fragmentDefinitions;
|
|
57314
|
-
this.
|
|
57315
|
-
this.keepFragmentSpreadNodes = args.keepFragmentSpreadNodes;
|
|
57366
|
+
this.applyFragments = args.applyFragments;
|
|
57316
57367
|
this.fields = {};
|
|
57317
57368
|
this.inlineFragments = {};
|
|
57318
57369
|
this.fragmentSpreads = {};
|
|
57319
|
-
this.hoistFragments = !!args.hoistFragments;
|
|
57320
57370
|
this.filepath = args.filepath;
|
|
57321
57371
|
for (const selection of args.selections) {
|
|
57322
57372
|
this.add({ selection });
|
|
@@ -57326,21 +57376,18 @@ var FieldCollection = class {
|
|
|
57326
57376
|
return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
|
|
57327
57377
|
}
|
|
57328
57378
|
add({ selection, external }) {
|
|
57329
|
-
let
|
|
57379
|
+
let include = this.config.defaultFragmentMasking === "disable";
|
|
57330
57380
|
const maskEnableDirective = selection.directives?.find(
|
|
57331
57381
|
({ name }) => name.value === this.config.maskEnableDirective
|
|
57332
57382
|
);
|
|
57333
57383
|
if (maskEnableDirective) {
|
|
57334
|
-
|
|
57384
|
+
include = false;
|
|
57335
57385
|
}
|
|
57336
57386
|
const maskDisableDirective = selection.directives?.find(
|
|
57337
57387
|
({ name }) => name.value === this.config.maskDisableDirective
|
|
57338
57388
|
);
|
|
57339
57389
|
if (maskDisableDirective) {
|
|
57340
|
-
|
|
57341
|
-
}
|
|
57342
|
-
if (this.ignoreMaskDisable) {
|
|
57343
|
-
includeFragments = true;
|
|
57390
|
+
include = true;
|
|
57344
57391
|
}
|
|
57345
57392
|
if (selection.kind === "Field") {
|
|
57346
57393
|
const key = selection.alias?.value || selection.name.value;
|
|
@@ -57356,7 +57403,7 @@ var FieldCollection = class {
|
|
|
57356
57403
|
external
|
|
57357
57404
|
});
|
|
57358
57405
|
}
|
|
57359
|
-
if (
|
|
57406
|
+
if (this.applyFragments && !external) {
|
|
57360
57407
|
this.fields[key].selection.fragmentSpreads = {
|
|
57361
57408
|
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
57362
57409
|
...this.fields[key].selection.fragmentSpreads
|
|
@@ -57370,16 +57417,13 @@ var FieldCollection = class {
|
|
|
57370
57417
|
}
|
|
57371
57418
|
}
|
|
57372
57419
|
if (selection.kind === "InlineFragment" && selection.typeCondition) {
|
|
57373
|
-
this.walkInlineFragment({ selection, external
|
|
57420
|
+
this.walkInlineFragment({ selection, external });
|
|
57374
57421
|
return;
|
|
57375
57422
|
}
|
|
57376
57423
|
if (selection.kind === "FragmentSpread") {
|
|
57377
|
-
if (
|
|
57424
|
+
if (!external || include) {
|
|
57378
57425
|
this.fragmentSpreads[selection.name.value] = selection;
|
|
57379
57426
|
}
|
|
57380
|
-
if (!includeFragments) {
|
|
57381
|
-
return;
|
|
57382
|
-
}
|
|
57383
57427
|
const definition = this.fragmentDefinitions[selection.name.value];
|
|
57384
57428
|
if (!definition) {
|
|
57385
57429
|
throw new HoudiniError({
|
|
@@ -57387,23 +57431,25 @@ var FieldCollection = class {
|
|
|
57387
57431
|
message: "Could not find referenced fragment definition: " + selection.name.value + "\n" + JSON.stringify(Object.keys(this.fragmentDefinitions), null, 4)
|
|
57388
57432
|
});
|
|
57389
57433
|
}
|
|
57390
|
-
this.
|
|
57391
|
-
|
|
57392
|
-
|
|
57393
|
-
|
|
57394
|
-
|
|
57395
|
-
|
|
57396
|
-
|
|
57397
|
-
|
|
57434
|
+
if (this.applyFragments || include) {
|
|
57435
|
+
this.add({
|
|
57436
|
+
selection: {
|
|
57437
|
+
kind: "InlineFragment",
|
|
57438
|
+
typeCondition: {
|
|
57439
|
+
kind: "NamedType",
|
|
57440
|
+
name: {
|
|
57441
|
+
kind: "Name",
|
|
57442
|
+
value: definition.typeCondition.name.value
|
|
57443
|
+
}
|
|
57444
|
+
},
|
|
57445
|
+
selectionSet: {
|
|
57446
|
+
kind: "SelectionSet",
|
|
57447
|
+
selections: [...definition.selectionSet.selections]
|
|
57398
57448
|
}
|
|
57399
57449
|
},
|
|
57400
|
-
|
|
57401
|
-
|
|
57402
|
-
|
|
57403
|
-
}
|
|
57404
|
-
},
|
|
57405
|
-
external
|
|
57406
|
-
});
|
|
57450
|
+
external: !include
|
|
57451
|
+
});
|
|
57452
|
+
}
|
|
57407
57453
|
}
|
|
57408
57454
|
}
|
|
57409
57455
|
collectFragmentSpreads(selections, result = {}) {
|
|
@@ -57460,8 +57506,7 @@ var FieldCollection = class {
|
|
|
57460
57506
|
}
|
|
57461
57507
|
walkInlineFragment({
|
|
57462
57508
|
selection,
|
|
57463
|
-
external
|
|
57464
|
-
hoistFragments
|
|
57509
|
+
external
|
|
57465
57510
|
}) {
|
|
57466
57511
|
const key = selection.typeCondition.name.value;
|
|
57467
57512
|
if (!this.inlineFragments[key]) {
|
|
@@ -57471,7 +57516,7 @@ var FieldCollection = class {
|
|
|
57471
57516
|
};
|
|
57472
57517
|
}
|
|
57473
57518
|
for (const subselect of selection.selectionSet.selections || []) {
|
|
57474
|
-
if (subselect.kind === "
|
|
57519
|
+
if (subselect.kind === "Field" || subselect.kind === "InlineFragment" && !subselect.typeCondition) {
|
|
57475
57520
|
this.inlineFragments[key].selection.add({
|
|
57476
57521
|
selection: subselect,
|
|
57477
57522
|
external
|
|
@@ -57480,11 +57525,11 @@ var FieldCollection = class {
|
|
|
57480
57525
|
} else if (subselect.kind === "FragmentSpread") {
|
|
57481
57526
|
this.add({
|
|
57482
57527
|
selection: subselect,
|
|
57483
|
-
external
|
|
57528
|
+
external
|
|
57484
57529
|
});
|
|
57485
57530
|
continue;
|
|
57486
57531
|
} else {
|
|
57487
|
-
this.walkInlineFragment({ selection: subselect, external
|
|
57532
|
+
this.walkInlineFragment({ selection: subselect, external });
|
|
57488
57533
|
}
|
|
57489
57534
|
}
|
|
57490
57535
|
}
|
|
@@ -57494,9 +57539,7 @@ var FieldCollection = class {
|
|
|
57494
57539
|
fragmentDefinitions: this.fragmentDefinitions,
|
|
57495
57540
|
selections: [],
|
|
57496
57541
|
filepath: this.filepath,
|
|
57497
|
-
|
|
57498
|
-
keepFragmentSpreadNodes: this.keepFragmentSpreadNodes,
|
|
57499
|
-
hoistFragments: this.hoistFragments
|
|
57542
|
+
applyFragments: this.applyFragments
|
|
57500
57543
|
});
|
|
57501
57544
|
}
|
|
57502
57545
|
};
|
|
@@ -58425,7 +58468,7 @@ function operationObject({
|
|
|
58425
58468
|
if (operationKind === "insert" || operationKind === "toggle") {
|
|
58426
58469
|
operation.position = position;
|
|
58427
58470
|
}
|
|
58428
|
-
if (operationKind
|
|
58471
|
+
if (allLists && operationKind !== "delete") {
|
|
58429
58472
|
operation.target = "all";
|
|
58430
58473
|
}
|
|
58431
58474
|
if (parentID) {
|
|
@@ -59416,7 +59459,8 @@ function prepareSelection({
|
|
|
59416
59459
|
inConnection,
|
|
59417
59460
|
typeMap,
|
|
59418
59461
|
abstractTypes,
|
|
59419
|
-
globalLoading
|
|
59462
|
+
globalLoading,
|
|
59463
|
+
includeFragments
|
|
59420
59464
|
}) {
|
|
59421
59465
|
let object = {};
|
|
59422
59466
|
const loadingTypes = [];
|
|
@@ -59436,7 +59480,8 @@ function prepareSelection({
|
|
|
59436
59480
|
document,
|
|
59437
59481
|
typeMap,
|
|
59438
59482
|
abstractTypes,
|
|
59439
|
-
globalLoading
|
|
59483
|
+
globalLoading,
|
|
59484
|
+
includeFragments
|
|
59440
59485
|
}).fields || {}
|
|
59441
59486
|
);
|
|
59442
59487
|
} else {
|
|
@@ -59484,7 +59529,8 @@ function prepareSelection({
|
|
|
59484
59529
|
document,
|
|
59485
59530
|
typeMap,
|
|
59486
59531
|
abstractTypes,
|
|
59487
|
-
globalLoading
|
|
59532
|
+
globalLoading,
|
|
59533
|
+
includeFragments
|
|
59488
59534
|
}).fields
|
|
59489
59535
|
};
|
|
59490
59536
|
if (field.directives?.find((d) => d.name.value === config2.loadingDirective)) {
|
|
@@ -59602,7 +59648,8 @@ function prepareSelection({
|
|
|
59602
59648
|
inConnection: connectionState,
|
|
59603
59649
|
typeMap,
|
|
59604
59650
|
abstractTypes,
|
|
59605
|
-
globalLoading: forceLoading
|
|
59651
|
+
globalLoading: forceLoading,
|
|
59652
|
+
includeFragments
|
|
59606
59653
|
});
|
|
59607
59654
|
if (Object.values(fieldObj.selection.fields ?? {}).some((field2) => field2.required)) {
|
|
59608
59655
|
fieldObj.nullable = true;
|
|
@@ -59935,14 +59982,13 @@ function artifactGenerator(stats) {
|
|
|
59935
59982
|
document: doc,
|
|
59936
59983
|
rootType,
|
|
59937
59984
|
globalLoading,
|
|
59985
|
+
includeFragments: doc.kind !== ArtifactKind.Fragment,
|
|
59938
59986
|
selections: flattenSelections({
|
|
59939
59987
|
config: config2,
|
|
59940
59988
|
filepath: doc.filename,
|
|
59941
59989
|
selections: selectionSet.selections,
|
|
59942
59990
|
fragmentDefinitions,
|
|
59943
|
-
|
|
59944
|
-
keepFragmentSpreadNodes: true,
|
|
59945
|
-
hoistFragments: true
|
|
59991
|
+
applyFragments: doc.kind !== ArtifactKind.Fragment
|
|
59946
59992
|
}),
|
|
59947
59993
|
operations: operationsByPath(
|
|
59948
59994
|
config2,
|
|
@@ -60907,8 +60953,7 @@ async function generateDocumentTypes(config2, docs) {
|
|
|
60907
60953
|
config: config2,
|
|
60908
60954
|
filepath: filename,
|
|
60909
60955
|
selections: definition.selectionSet.selections,
|
|
60910
|
-
fragmentDefinitions
|
|
60911
|
-
keepFragmentSpreadNodes: true
|
|
60956
|
+
fragmentDefinitions
|
|
60912
60957
|
});
|
|
60913
60958
|
if (definition?.kind === "OperationDefinition") {
|
|
60914
60959
|
await generateOperationTypeDefs(
|