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/cmd-esm/index.js
CHANGED
|
@@ -70299,10 +70299,10 @@ var ListManager = class {
|
|
|
70299
70299
|
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
70300
70300
|
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
70301
70301
|
}
|
|
70302
|
-
removeIDFromAllLists(id) {
|
|
70302
|
+
removeIDFromAllLists(id, layer) {
|
|
70303
70303
|
for (const fieldMap of this.lists.values()) {
|
|
70304
70304
|
for (const list of fieldMap.values()) {
|
|
70305
|
-
list.removeID(id);
|
|
70305
|
+
list.removeID(id, void 0, layer);
|
|
70306
70306
|
}
|
|
70307
70307
|
}
|
|
70308
70308
|
}
|
|
@@ -70459,7 +70459,7 @@ var List = class {
|
|
|
70459
70459
|
layer: layer?.id
|
|
70460
70460
|
});
|
|
70461
70461
|
}
|
|
70462
|
-
removeID(id, variables = {}) {
|
|
70462
|
+
removeID(id, variables = {}, layer) {
|
|
70463
70463
|
if (!this.validateWhen()) {
|
|
70464
70464
|
return;
|
|
70465
70465
|
}
|
|
@@ -70506,7 +70506,7 @@ var List = class {
|
|
|
70506
70506
|
subscribers.map((sub) => sub[0]),
|
|
70507
70507
|
variables
|
|
70508
70508
|
);
|
|
70509
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
70509
|
+
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID, layer);
|
|
70510
70510
|
for (const [spec] of subscribers) {
|
|
70511
70511
|
spec.set(
|
|
70512
70512
|
this.cache._internal_unstable.getSelection({
|
|
@@ -70519,12 +70519,12 @@ var List = class {
|
|
|
70519
70519
|
}
|
|
70520
70520
|
return true;
|
|
70521
70521
|
}
|
|
70522
|
-
remove(data, variables = {}) {
|
|
70522
|
+
remove(data, variables = {}, layer) {
|
|
70523
70523
|
const targetID = this.cache._internal_unstable.id(this.listType(data), data);
|
|
70524
70524
|
if (!targetID) {
|
|
70525
70525
|
return;
|
|
70526
70526
|
}
|
|
70527
|
-
return this.removeID(targetID, variables);
|
|
70527
|
+
return this.removeID(targetID, variables, layer);
|
|
70528
70528
|
}
|
|
70529
70529
|
listType(data) {
|
|
70530
70530
|
return data.__typename || this.type;
|
|
@@ -70556,7 +70556,7 @@ var List = class {
|
|
|
70556
70556
|
layer,
|
|
70557
70557
|
where
|
|
70558
70558
|
}) {
|
|
70559
|
-
if (!this.remove(data, variables)) {
|
|
70559
|
+
if (!this.remove(data, variables, layer)) {
|
|
70560
70560
|
this.addToList(selection, data, variables, where, layer);
|
|
70561
70561
|
}
|
|
70562
70562
|
}
|
|
@@ -70693,7 +70693,7 @@ var StaleManager = class {
|
|
|
70693
70693
|
// src/runtime/cache/storage.ts
|
|
70694
70694
|
var InMemoryStorage = class {
|
|
70695
70695
|
data;
|
|
70696
|
-
idCount =
|
|
70696
|
+
idCount = 1;
|
|
70697
70697
|
rank = 0;
|
|
70698
70698
|
constructor() {
|
|
70699
70699
|
this.data = [];
|
|
@@ -70713,11 +70713,11 @@ var InMemoryStorage = class {
|
|
|
70713
70713
|
insert(id, field, location, target) {
|
|
70714
70714
|
return this.topLayer.insert(id, field, location, target);
|
|
70715
70715
|
}
|
|
70716
|
-
remove(id, field, target) {
|
|
70717
|
-
return
|
|
70716
|
+
remove(id, field, target, layerToUser = this.topLayer) {
|
|
70717
|
+
return layerToUser.remove(id, field, target);
|
|
70718
70718
|
}
|
|
70719
|
-
delete(id) {
|
|
70720
|
-
return
|
|
70719
|
+
delete(id, layerToUser = this.topLayer) {
|
|
70720
|
+
return layerToUser.delete(id);
|
|
70721
70721
|
}
|
|
70722
70722
|
deleteField(id, field) {
|
|
70723
70723
|
return this.topLayer.deleteField(id, field);
|
|
@@ -71089,6 +71089,9 @@ var InMemorySubscriptions = class {
|
|
|
71089
71089
|
subscribers = {};
|
|
71090
71090
|
referenceCounts = {};
|
|
71091
71091
|
keyVersions = {};
|
|
71092
|
+
activeFields(parent2) {
|
|
71093
|
+
return Object.keys(this.subscribers[parent2] || {});
|
|
71094
|
+
}
|
|
71092
71095
|
add({
|
|
71093
71096
|
parent: parent2,
|
|
71094
71097
|
spec,
|
|
@@ -71357,20 +71360,7 @@ var Cache = class {
|
|
|
71357
71360
|
}) {
|
|
71358
71361
|
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
71359
71362
|
const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
|
|
71360
|
-
|
|
71361
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
71362
|
-
if (!notified.includes(spec.set)) {
|
|
71363
|
-
notified.push(spec.set);
|
|
71364
|
-
spec.set(
|
|
71365
|
-
this._internal_unstable.getSelection({
|
|
71366
|
-
parent: spec.parentID || rootID,
|
|
71367
|
-
selection: spec.selection,
|
|
71368
|
-
variables: spec.variables?.() || {},
|
|
71369
|
-
ignoreMasking: false
|
|
71370
|
-
}).data
|
|
71371
|
-
);
|
|
71372
|
-
}
|
|
71373
|
-
}
|
|
71363
|
+
this.#notifySubscribers(subscribers.concat(notifySubscribers));
|
|
71374
71364
|
return subscribers;
|
|
71375
71365
|
}
|
|
71376
71366
|
read(...args) {
|
|
@@ -71409,10 +71399,10 @@ var Cache = class {
|
|
|
71409
71399
|
}
|
|
71410
71400
|
return handler;
|
|
71411
71401
|
}
|
|
71412
|
-
delete(id) {
|
|
71402
|
+
delete(id, layer) {
|
|
71413
71403
|
this._internal_unstable.subscriptions.removeAllSubscribers(id);
|
|
71414
|
-
this._internal_unstable.lists.removeIDFromAllLists(id);
|
|
71415
|
-
this._internal_unstable.storage.delete(id);
|
|
71404
|
+
this._internal_unstable.lists.removeIDFromAllLists(id, layer);
|
|
71405
|
+
this._internal_unstable.storage.delete(id, layer);
|
|
71416
71406
|
}
|
|
71417
71407
|
setConfig(config2) {
|
|
71418
71408
|
this._internal_unstable.setConfig(config2);
|
|
@@ -71444,6 +71434,70 @@ var Cache = class {
|
|
|
71444
71434
|
config() {
|
|
71445
71435
|
return this._internal_unstable.config;
|
|
71446
71436
|
}
|
|
71437
|
+
clearLayer(layerID) {
|
|
71438
|
+
const layer = this._internal_unstable.storage.getLayer(layerID);
|
|
71439
|
+
if (!layer) {
|
|
71440
|
+
throw new Error("Cannot find layer with id: " + layerID);
|
|
71441
|
+
}
|
|
71442
|
+
const toNotify = [];
|
|
71443
|
+
const allFields = [];
|
|
71444
|
+
for (const target of [layer.fields, layer.links]) {
|
|
71445
|
+
for (const [id, fields] of Object.entries(target)) {
|
|
71446
|
+
allFields.push(
|
|
71447
|
+
...Object.entries(fields).map(([field, value]) => ({ id, field, value }))
|
|
71448
|
+
);
|
|
71449
|
+
}
|
|
71450
|
+
}
|
|
71451
|
+
const displayFields = [];
|
|
71452
|
+
for (const pair of allFields) {
|
|
71453
|
+
const { displayLayers } = this._internal_unstable.storage.get(pair.id, pair.field);
|
|
71454
|
+
if (!displayLayers.includes(layerID)) {
|
|
71455
|
+
continue;
|
|
71456
|
+
}
|
|
71457
|
+
displayFields.push(pair);
|
|
71458
|
+
}
|
|
71459
|
+
for (const [id, operation] of Object.entries(layer.operations)) {
|
|
71460
|
+
if (operation.deleted) {
|
|
71461
|
+
displayFields.push(
|
|
71462
|
+
...this._internal_unstable.subscriptions.activeFields(id).map((field) => ({ id, field }))
|
|
71463
|
+
);
|
|
71464
|
+
}
|
|
71465
|
+
const fields = Object.keys(operation.fields ?? {});
|
|
71466
|
+
if (fields.length > 0) {
|
|
71467
|
+
displayFields.push(...fields.map((field) => ({ id, field })));
|
|
71468
|
+
}
|
|
71469
|
+
}
|
|
71470
|
+
layer.clear();
|
|
71471
|
+
for (const display of displayFields) {
|
|
71472
|
+
const { field, id } = display;
|
|
71473
|
+
const notify = !("value" in display) || this._internal_unstable.storage.get(id, field).value !== display.value;
|
|
71474
|
+
if (notify) {
|
|
71475
|
+
toNotify.push(
|
|
71476
|
+
...this._internal_unstable.subscriptions.get(id, field).map((sub) => sub[0])
|
|
71477
|
+
);
|
|
71478
|
+
}
|
|
71479
|
+
}
|
|
71480
|
+
this.#notifySubscribers(toNotify);
|
|
71481
|
+
}
|
|
71482
|
+
#notifySubscribers(subs) {
|
|
71483
|
+
if (subs.length === 0) {
|
|
71484
|
+
return;
|
|
71485
|
+
}
|
|
71486
|
+
const notified = [];
|
|
71487
|
+
for (const spec of subs) {
|
|
71488
|
+
if (!notified.includes(spec.set)) {
|
|
71489
|
+
notified.push(spec.set);
|
|
71490
|
+
spec.set(
|
|
71491
|
+
this._internal_unstable.getSelection({
|
|
71492
|
+
parent: spec.parentID || rootID,
|
|
71493
|
+
selection: spec.selection,
|
|
71494
|
+
variables: spec.variables?.() || {},
|
|
71495
|
+
ignoreMasking: false
|
|
71496
|
+
}).data
|
|
71497
|
+
);
|
|
71498
|
+
}
|
|
71499
|
+
}
|
|
71500
|
+
}
|
|
71447
71501
|
};
|
|
71448
71502
|
var CacheInternal = class {
|
|
71449
71503
|
_disabled = false;
|
|
@@ -71731,8 +71785,16 @@ var CacheInternal = class {
|
|
|
71731
71785
|
operation.position || "last",
|
|
71732
71786
|
layer
|
|
71733
71787
|
);
|
|
71788
|
+
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
71789
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
71790
|
+
selection: fieldSelection,
|
|
71791
|
+
data: target,
|
|
71792
|
+
variables,
|
|
71793
|
+
where: operation.position || "last",
|
|
71794
|
+
layer
|
|
71795
|
+
});
|
|
71734
71796
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
71735
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
71797
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
71736
71798
|
} else if (operation.action === "delete" && operation.type) {
|
|
71737
71799
|
if (typeof target !== "string") {
|
|
71738
71800
|
throw new Error("Cannot delete a record with a non-string ID");
|
|
@@ -71741,15 +71803,7 @@ var CacheInternal = class {
|
|
|
71741
71803
|
if (!targetID) {
|
|
71742
71804
|
continue;
|
|
71743
71805
|
}
|
|
71744
|
-
this.cache.delete(targetID);
|
|
71745
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
71746
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
71747
|
-
selection: fieldSelection,
|
|
71748
|
-
data: target,
|
|
71749
|
-
variables,
|
|
71750
|
-
where: operation.position || "last",
|
|
71751
|
-
layer
|
|
71752
|
-
});
|
|
71806
|
+
this.cache.delete(targetID, layer);
|
|
71753
71807
|
}
|
|
71754
71808
|
}
|
|
71755
71809
|
}
|
|
@@ -72284,7 +72338,7 @@ var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
|
72284
72338
|
var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
72285
72339
|
return {
|
|
72286
72340
|
async start(ctx, { next, marshalVariables }) {
|
|
72287
|
-
const
|
|
72341
|
+
const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
|
|
72288
72342
|
const optimisticResponse = ctx.stuff.optimisticResponse;
|
|
72289
72343
|
let toNotify = [];
|
|
72290
72344
|
if (optimisticResponse) {
|
|
@@ -72295,25 +72349,29 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
72295
72349
|
data: optimisticResponse
|
|
72296
72350
|
}),
|
|
72297
72351
|
variables: marshalVariables(ctx),
|
|
72298
|
-
layer:
|
|
72352
|
+
layer: layerOptimistic.id
|
|
72299
72353
|
});
|
|
72300
72354
|
}
|
|
72301
72355
|
ctx.cacheParams = {
|
|
72302
72356
|
...ctx.cacheParams,
|
|
72303
|
-
layer,
|
|
72357
|
+
layer: layerOptimistic,
|
|
72304
72358
|
notifySubscribers: toNotify,
|
|
72305
72359
|
forceNotify: true
|
|
72306
72360
|
};
|
|
72307
72361
|
next(ctx);
|
|
72308
72362
|
},
|
|
72309
72363
|
afterNetwork(ctx, { resolve: resolve2 }) {
|
|
72310
|
-
ctx.cacheParams?.layer
|
|
72364
|
+
if (ctx.cacheParams?.layer) {
|
|
72365
|
+
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
72366
|
+
}
|
|
72311
72367
|
resolve2(ctx);
|
|
72312
72368
|
},
|
|
72313
72369
|
end(ctx, { resolve: resolve2, value }) {
|
|
72314
72370
|
const hasErrors = value.errors && value.errors.length > 0;
|
|
72315
72371
|
if (hasErrors) {
|
|
72316
|
-
ctx.cacheParams?.layer
|
|
72372
|
+
if (ctx.cacheParams?.layer) {
|
|
72373
|
+
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
72374
|
+
}
|
|
72317
72375
|
}
|
|
72318
72376
|
if (ctx.cacheParams?.layer) {
|
|
72319
72377
|
cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
|
|
@@ -72323,7 +72381,7 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
72323
72381
|
catch(ctx, { error }) {
|
|
72324
72382
|
if (ctx.cacheParams?.layer) {
|
|
72325
72383
|
const { layer } = ctx.cacheParams;
|
|
72326
|
-
layer.
|
|
72384
|
+
cache_default.clearLayer(layer.id);
|
|
72327
72385
|
cache_default._internal_unstable.storage.resolveLayer(layer.id);
|
|
72328
72386
|
}
|
|
72329
72387
|
throw error;
|
|
@@ -73677,18 +73735,14 @@ function flattenSelections({
|
|
|
73677
73735
|
filepath,
|
|
73678
73736
|
selections,
|
|
73679
73737
|
fragmentDefinitions,
|
|
73680
|
-
|
|
73681
|
-
keepFragmentSpreadNodes,
|
|
73682
|
-
hoistFragments
|
|
73738
|
+
applyFragments
|
|
73683
73739
|
}) {
|
|
73684
73740
|
const fields = new FieldCollection({
|
|
73685
73741
|
config: config2,
|
|
73686
73742
|
filepath,
|
|
73687
73743
|
selections,
|
|
73688
73744
|
fragmentDefinitions,
|
|
73689
|
-
|
|
73690
|
-
keepFragmentSpreadNodes: !!keepFragmentSpreadNodes,
|
|
73691
|
-
hoistFragments
|
|
73745
|
+
applyFragments: !!applyFragments
|
|
73692
73746
|
});
|
|
73693
73747
|
return fields.toSelectionSet();
|
|
73694
73748
|
}
|
|
@@ -73699,18 +73753,14 @@ var FieldCollection = class {
|
|
|
73699
73753
|
fields;
|
|
73700
73754
|
inlineFragments;
|
|
73701
73755
|
fragmentSpreads;
|
|
73702
|
-
|
|
73703
|
-
keepFragmentSpreadNodes;
|
|
73704
|
-
hoistFragments;
|
|
73756
|
+
applyFragments;
|
|
73705
73757
|
constructor(args) {
|
|
73706
73758
|
this.config = args.config;
|
|
73707
73759
|
this.fragmentDefinitions = args.fragmentDefinitions;
|
|
73708
|
-
this.
|
|
73709
|
-
this.keepFragmentSpreadNodes = args.keepFragmentSpreadNodes;
|
|
73760
|
+
this.applyFragments = args.applyFragments;
|
|
73710
73761
|
this.fields = {};
|
|
73711
73762
|
this.inlineFragments = {};
|
|
73712
73763
|
this.fragmentSpreads = {};
|
|
73713
|
-
this.hoistFragments = !!args.hoistFragments;
|
|
73714
73764
|
this.filepath = args.filepath;
|
|
73715
73765
|
for (const selection of args.selections) {
|
|
73716
73766
|
this.add({ selection });
|
|
@@ -73720,21 +73770,18 @@ var FieldCollection = class {
|
|
|
73720
73770
|
return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
|
|
73721
73771
|
}
|
|
73722
73772
|
add({ selection, external }) {
|
|
73723
|
-
let
|
|
73773
|
+
let include = this.config.defaultFragmentMasking === "disable";
|
|
73724
73774
|
const maskEnableDirective = selection.directives?.find(
|
|
73725
73775
|
({ name }) => name.value === this.config.maskEnableDirective
|
|
73726
73776
|
);
|
|
73727
73777
|
if (maskEnableDirective) {
|
|
73728
|
-
|
|
73778
|
+
include = false;
|
|
73729
73779
|
}
|
|
73730
73780
|
const maskDisableDirective = selection.directives?.find(
|
|
73731
73781
|
({ name }) => name.value === this.config.maskDisableDirective
|
|
73732
73782
|
);
|
|
73733
73783
|
if (maskDisableDirective) {
|
|
73734
|
-
|
|
73735
|
-
}
|
|
73736
|
-
if (this.ignoreMaskDisable) {
|
|
73737
|
-
includeFragments = true;
|
|
73784
|
+
include = true;
|
|
73738
73785
|
}
|
|
73739
73786
|
if (selection.kind === "Field") {
|
|
73740
73787
|
const key = selection.alias?.value || selection.name.value;
|
|
@@ -73750,7 +73797,7 @@ var FieldCollection = class {
|
|
|
73750
73797
|
external
|
|
73751
73798
|
});
|
|
73752
73799
|
}
|
|
73753
|
-
if (
|
|
73800
|
+
if (this.applyFragments && !external) {
|
|
73754
73801
|
this.fields[key].selection.fragmentSpreads = {
|
|
73755
73802
|
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
73756
73803
|
...this.fields[key].selection.fragmentSpreads
|
|
@@ -73764,16 +73811,13 @@ var FieldCollection = class {
|
|
|
73764
73811
|
}
|
|
73765
73812
|
}
|
|
73766
73813
|
if (selection.kind === "InlineFragment" && selection.typeCondition) {
|
|
73767
|
-
this.walkInlineFragment({ selection, external
|
|
73814
|
+
this.walkInlineFragment({ selection, external });
|
|
73768
73815
|
return;
|
|
73769
73816
|
}
|
|
73770
73817
|
if (selection.kind === "FragmentSpread") {
|
|
73771
|
-
if (
|
|
73818
|
+
if (!external || include) {
|
|
73772
73819
|
this.fragmentSpreads[selection.name.value] = selection;
|
|
73773
73820
|
}
|
|
73774
|
-
if (!includeFragments) {
|
|
73775
|
-
return;
|
|
73776
|
-
}
|
|
73777
73821
|
const definition = this.fragmentDefinitions[selection.name.value];
|
|
73778
73822
|
if (!definition) {
|
|
73779
73823
|
throw new HoudiniError({
|
|
@@ -73781,23 +73825,25 @@ var FieldCollection = class {
|
|
|
73781
73825
|
message: "Could not find referenced fragment definition: " + selection.name.value + "\n" + JSON.stringify(Object.keys(this.fragmentDefinitions), null, 4)
|
|
73782
73826
|
});
|
|
73783
73827
|
}
|
|
73784
|
-
this.
|
|
73785
|
-
|
|
73786
|
-
|
|
73787
|
-
|
|
73788
|
-
|
|
73789
|
-
|
|
73790
|
-
|
|
73791
|
-
|
|
73828
|
+
if (this.applyFragments || include) {
|
|
73829
|
+
this.add({
|
|
73830
|
+
selection: {
|
|
73831
|
+
kind: "InlineFragment",
|
|
73832
|
+
typeCondition: {
|
|
73833
|
+
kind: "NamedType",
|
|
73834
|
+
name: {
|
|
73835
|
+
kind: "Name",
|
|
73836
|
+
value: definition.typeCondition.name.value
|
|
73837
|
+
}
|
|
73838
|
+
},
|
|
73839
|
+
selectionSet: {
|
|
73840
|
+
kind: "SelectionSet",
|
|
73841
|
+
selections: [...definition.selectionSet.selections]
|
|
73792
73842
|
}
|
|
73793
73843
|
},
|
|
73794
|
-
|
|
73795
|
-
|
|
73796
|
-
|
|
73797
|
-
}
|
|
73798
|
-
},
|
|
73799
|
-
external
|
|
73800
|
-
});
|
|
73844
|
+
external: !include
|
|
73845
|
+
});
|
|
73846
|
+
}
|
|
73801
73847
|
}
|
|
73802
73848
|
}
|
|
73803
73849
|
collectFragmentSpreads(selections, result = {}) {
|
|
@@ -73854,8 +73900,7 @@ var FieldCollection = class {
|
|
|
73854
73900
|
}
|
|
73855
73901
|
walkInlineFragment({
|
|
73856
73902
|
selection,
|
|
73857
|
-
external
|
|
73858
|
-
hoistFragments
|
|
73903
|
+
external
|
|
73859
73904
|
}) {
|
|
73860
73905
|
const key = selection.typeCondition.name.value;
|
|
73861
73906
|
if (!this.inlineFragments[key]) {
|
|
@@ -73865,7 +73910,7 @@ var FieldCollection = class {
|
|
|
73865
73910
|
};
|
|
73866
73911
|
}
|
|
73867
73912
|
for (const subselect of selection.selectionSet.selections || []) {
|
|
73868
|
-
if (subselect.kind === "
|
|
73913
|
+
if (subselect.kind === "Field" || subselect.kind === "InlineFragment" && !subselect.typeCondition) {
|
|
73869
73914
|
this.inlineFragments[key].selection.add({
|
|
73870
73915
|
selection: subselect,
|
|
73871
73916
|
external
|
|
@@ -73874,11 +73919,11 @@ var FieldCollection = class {
|
|
|
73874
73919
|
} else if (subselect.kind === "FragmentSpread") {
|
|
73875
73920
|
this.add({
|
|
73876
73921
|
selection: subselect,
|
|
73877
|
-
external
|
|
73922
|
+
external
|
|
73878
73923
|
});
|
|
73879
73924
|
continue;
|
|
73880
73925
|
} else {
|
|
73881
|
-
this.walkInlineFragment({ selection: subselect, external
|
|
73926
|
+
this.walkInlineFragment({ selection: subselect, external });
|
|
73882
73927
|
}
|
|
73883
73928
|
}
|
|
73884
73929
|
}
|
|
@@ -73888,9 +73933,7 @@ var FieldCollection = class {
|
|
|
73888
73933
|
fragmentDefinitions: this.fragmentDefinitions,
|
|
73889
73934
|
selections: [],
|
|
73890
73935
|
filepath: this.filepath,
|
|
73891
|
-
|
|
73892
|
-
keepFragmentSpreadNodes: this.keepFragmentSpreadNodes,
|
|
73893
|
-
hoistFragments: this.hoistFragments
|
|
73936
|
+
applyFragments: this.applyFragments
|
|
73894
73937
|
});
|
|
73895
73938
|
}
|
|
73896
73939
|
};
|
|
@@ -74819,7 +74862,7 @@ function operationObject({
|
|
|
74819
74862
|
if (operationKind === "insert" || operationKind === "toggle") {
|
|
74820
74863
|
operation.position = position;
|
|
74821
74864
|
}
|
|
74822
|
-
if (operationKind
|
|
74865
|
+
if (allLists && operationKind !== "delete") {
|
|
74823
74866
|
operation.target = "all";
|
|
74824
74867
|
}
|
|
74825
74868
|
if (parentID) {
|
|
@@ -75810,7 +75853,8 @@ function prepareSelection({
|
|
|
75810
75853
|
inConnection,
|
|
75811
75854
|
typeMap,
|
|
75812
75855
|
abstractTypes,
|
|
75813
|
-
globalLoading
|
|
75856
|
+
globalLoading,
|
|
75857
|
+
includeFragments
|
|
75814
75858
|
}) {
|
|
75815
75859
|
let object = {};
|
|
75816
75860
|
const loadingTypes = [];
|
|
@@ -75830,7 +75874,8 @@ function prepareSelection({
|
|
|
75830
75874
|
document,
|
|
75831
75875
|
typeMap,
|
|
75832
75876
|
abstractTypes,
|
|
75833
|
-
globalLoading
|
|
75877
|
+
globalLoading,
|
|
75878
|
+
includeFragments
|
|
75834
75879
|
}).fields || {}
|
|
75835
75880
|
);
|
|
75836
75881
|
} else {
|
|
@@ -75878,7 +75923,8 @@ function prepareSelection({
|
|
|
75878
75923
|
document,
|
|
75879
75924
|
typeMap,
|
|
75880
75925
|
abstractTypes,
|
|
75881
|
-
globalLoading
|
|
75926
|
+
globalLoading,
|
|
75927
|
+
includeFragments
|
|
75882
75928
|
}).fields
|
|
75883
75929
|
};
|
|
75884
75930
|
if (field.directives?.find((d) => d.name.value === config2.loadingDirective)) {
|
|
@@ -75996,7 +76042,8 @@ function prepareSelection({
|
|
|
75996
76042
|
inConnection: connectionState,
|
|
75997
76043
|
typeMap,
|
|
75998
76044
|
abstractTypes,
|
|
75999
|
-
globalLoading: forceLoading
|
|
76045
|
+
globalLoading: forceLoading,
|
|
76046
|
+
includeFragments
|
|
76000
76047
|
});
|
|
76001
76048
|
if (Object.values(fieldObj.selection.fields ?? {}).some((field2) => field2.required)) {
|
|
76002
76049
|
fieldObj.nullable = true;
|
|
@@ -76329,14 +76376,13 @@ function artifactGenerator(stats) {
|
|
|
76329
76376
|
document: doc,
|
|
76330
76377
|
rootType,
|
|
76331
76378
|
globalLoading,
|
|
76379
|
+
includeFragments: doc.kind !== ArtifactKind.Fragment,
|
|
76332
76380
|
selections: flattenSelections({
|
|
76333
76381
|
config: config2,
|
|
76334
76382
|
filepath: doc.filename,
|
|
76335
76383
|
selections: selectionSet.selections,
|
|
76336
76384
|
fragmentDefinitions,
|
|
76337
|
-
|
|
76338
|
-
keepFragmentSpreadNodes: true,
|
|
76339
|
-
hoistFragments: true
|
|
76385
|
+
applyFragments: doc.kind !== ArtifactKind.Fragment
|
|
76340
76386
|
}),
|
|
76341
76387
|
operations: operationsByPath(
|
|
76342
76388
|
config2,
|
|
@@ -77301,8 +77347,7 @@ async function generateDocumentTypes(config2, docs) {
|
|
|
77301
77347
|
config: config2,
|
|
77302
77348
|
filepath: filename,
|
|
77303
77349
|
selections: definition.selectionSet.selections,
|
|
77304
|
-
fragmentDefinitions
|
|
77305
|
-
keepFragmentSpreadNodes: true
|
|
77350
|
+
fragmentDefinitions
|
|
77306
77351
|
});
|
|
77307
77352
|
if (definition?.kind === "OperationDefinition") {
|
|
77308
77353
|
await generateOperationTypeDefs(
|
|
@@ -80072,8 +80117,8 @@ async function updatePackageJSON(targetPath) {
|
|
|
80072
80117
|
}
|
|
80073
80118
|
packageJSON.devDependencies = {
|
|
80074
80119
|
...packageJSON.devDependencies,
|
|
80075
|
-
houdini: "^1.2.
|
|
80076
|
-
"houdini-svelte": "^1.2.
|
|
80120
|
+
houdini: "^1.2.3",
|
|
80121
|
+
"houdini-svelte": "^1.2.3"
|
|
80077
80122
|
};
|
|
80078
80123
|
await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
|
|
80079
80124
|
}
|
|
@@ -2,7 +2,7 @@ import * as graphql from 'graphql';
|
|
|
2
2
|
import type { Config, Document } from '../../../lib';
|
|
3
3
|
import { type MutationOperation, type SubscriptionSelection } from '../../../runtime/lib/types';
|
|
4
4
|
export default function (args: Omit<Parameters<typeof prepareSelection>[0], 'typeMap' | 'abstractTypes'>): SubscriptionSelection;
|
|
5
|
-
declare function prepareSelection({ config, filepath, rootType, selections, operations, path, document, inConnection, typeMap, abstractTypes, globalLoading, }: {
|
|
5
|
+
declare function prepareSelection({ config, filepath, rootType, selections, operations, path, document, inConnection, typeMap, abstractTypes, globalLoading, includeFragments, }: {
|
|
6
6
|
config: Config;
|
|
7
7
|
filepath: string;
|
|
8
8
|
rootType: string;
|
|
@@ -16,5 +16,6 @@ declare function prepareSelection({ config, filepath, rootType, selections, oper
|
|
|
16
16
|
typeMap: Record<string, string[]>;
|
|
17
17
|
abstractTypes: string[];
|
|
18
18
|
globalLoading?: boolean;
|
|
19
|
+
includeFragments?: boolean;
|
|
19
20
|
}): SubscriptionSelection;
|
|
20
21
|
export {};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type graphql from 'graphql';
|
|
2
2
|
import type { Config } from '../../lib';
|
|
3
|
-
export declare function flattenSelections({ config, filepath, selections, fragmentDefinitions,
|
|
3
|
+
export declare function flattenSelections({ config, filepath, selections, fragmentDefinitions, applyFragments, }: {
|
|
4
4
|
config: Config;
|
|
5
5
|
filepath: string;
|
|
6
6
|
selections: readonly graphql.SelectionNode[];
|
|
7
7
|
fragmentDefinitions: {
|
|
8
8
|
[name: string]: graphql.FragmentDefinitionNode;
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
keepFragmentSpreadNodes?: boolean;
|
|
12
|
-
hoistFragments?: boolean;
|
|
10
|
+
applyFragments?: boolean;
|
|
13
11
|
}): readonly graphql.SelectionNode[];
|