houdini-svelte 1.2.2 → 1.2.4
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/plugin/codegen/index.d.ts +2 -3
- package/build/plugin/fsPatch.d.ts +4 -0
- package/build/plugin-cjs/index.js +303 -103
- package/build/plugin-esm/index.js +303 -103
- package/build/preprocess-cjs/index.js +303 -103
- package/build/preprocess-esm/index.js +303 -103
- package/build/runtime/stores/base.d.ts +1 -1
- package/build/runtime-cjs/stores/base.d.ts +1 -1
- package/build/runtime-esm/stores/base.d.ts +1 -1
- package/build/test-cjs/index.js +635 -215
- package/build/test-esm/index.js +635 -215
- package/package.json +2 -2
|
@@ -92295,6 +92295,7 @@ __export2(fs_exports, {
|
|
|
92295
92295
|
recursiveCopy: () => recursiveCopy,
|
|
92296
92296
|
remove: () => remove,
|
|
92297
92297
|
rmdir: () => rmdir,
|
|
92298
|
+
snapshot: () => snapshot,
|
|
92298
92299
|
stat: () => stat,
|
|
92299
92300
|
writeFile: () => writeFile
|
|
92300
92301
|
});
|
|
@@ -92481,16 +92482,17 @@ function existsSync(dirPath) {
|
|
|
92481
92482
|
}
|
|
92482
92483
|
return import_memfs.fs.existsSync(dirPath);
|
|
92483
92484
|
}
|
|
92484
|
-
async function readdir(filepath) {
|
|
92485
|
+
async function readdir(filepath, opts) {
|
|
92485
92486
|
if (!houdini_mode.is_testing) {
|
|
92486
|
-
return await import_promises.default.readdir(filepath);
|
|
92487
|
+
return await import_promises.default.readdir(filepath, opts);
|
|
92487
92488
|
}
|
|
92488
92489
|
if (filepath.includes("build/runtime")) {
|
|
92489
|
-
return await import_promises.default.readdir(filepath);
|
|
92490
|
+
return await import_promises.default.readdir(filepath, opts);
|
|
92490
92491
|
}
|
|
92491
92492
|
try {
|
|
92492
|
-
return import_memfs.fs.readdirSync(filepath);
|
|
92493
|
-
} catch {
|
|
92493
|
+
return import_memfs.fs.readdirSync(filepath, opts);
|
|
92494
|
+
} catch (e22) {
|
|
92495
|
+
console.log(e22);
|
|
92494
92496
|
return [];
|
|
92495
92497
|
}
|
|
92496
92498
|
}
|
|
@@ -92541,6 +92543,11 @@ async function recursiveCopy(source, target, transforms, notRoot) {
|
|
|
92541
92543
|
);
|
|
92542
92544
|
}
|
|
92543
92545
|
}
|
|
92546
|
+
function snapshot(base) {
|
|
92547
|
+
return Object.fromEntries(
|
|
92548
|
+
Object.entries(import_memfs.vol.toJSON()).filter(([key]) => !base || key.startsWith(base)).map(([key, value2]) => [!base ? key : key.substring(base.length), value2])
|
|
92549
|
+
);
|
|
92550
|
+
}
|
|
92544
92551
|
async function glob(pattern) {
|
|
92545
92552
|
return await (0, import_node_util.promisify)(import_glob.glob)(posixify(pattern));
|
|
92546
92553
|
}
|
|
@@ -93871,10 +93878,10 @@ var ListManager = class {
|
|
|
93871
93878
|
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
93872
93879
|
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
93873
93880
|
}
|
|
93874
|
-
removeIDFromAllLists(id2) {
|
|
93881
|
+
removeIDFromAllLists(id2, layer) {
|
|
93875
93882
|
for (const fieldMap of this.lists.values()) {
|
|
93876
93883
|
for (const list of fieldMap.values()) {
|
|
93877
|
-
list.removeID(id2);
|
|
93884
|
+
list.removeID(id2, void 0, layer);
|
|
93878
93885
|
}
|
|
93879
93886
|
}
|
|
93880
93887
|
}
|
|
@@ -93971,6 +93978,10 @@ var List = class {
|
|
|
93971
93978
|
updates: ["append", "prepend"],
|
|
93972
93979
|
selection: {
|
|
93973
93980
|
fields: {
|
|
93981
|
+
__typename: {
|
|
93982
|
+
keyRaw: "__typename",
|
|
93983
|
+
type: "String"
|
|
93984
|
+
},
|
|
93974
93985
|
node: {
|
|
93975
93986
|
type: listType,
|
|
93976
93987
|
keyRaw: "node",
|
|
@@ -93995,7 +94006,15 @@ var List = class {
|
|
|
93995
94006
|
};
|
|
93996
94007
|
insertData = {
|
|
93997
94008
|
newEntry: {
|
|
93998
|
-
edges: [
|
|
94009
|
+
edges: [
|
|
94010
|
+
{
|
|
94011
|
+
__typename: listType + "Edge",
|
|
94012
|
+
node: {
|
|
94013
|
+
...data2,
|
|
94014
|
+
__typename: listType
|
|
94015
|
+
}
|
|
94016
|
+
}
|
|
94017
|
+
]
|
|
93999
94018
|
}
|
|
94000
94019
|
};
|
|
94001
94020
|
} else {
|
|
@@ -94031,7 +94050,7 @@ var List = class {
|
|
|
94031
94050
|
layer: layer?.id
|
|
94032
94051
|
});
|
|
94033
94052
|
}
|
|
94034
|
-
removeID(id2, variables = {}) {
|
|
94053
|
+
removeID(id2, variables = {}, layer) {
|
|
94035
94054
|
if (!this.validateWhen()) {
|
|
94036
94055
|
return;
|
|
94037
94056
|
}
|
|
@@ -94078,7 +94097,7 @@ var List = class {
|
|
|
94078
94097
|
subscribers.map((sub) => sub[0]),
|
|
94079
94098
|
variables
|
|
94080
94099
|
);
|
|
94081
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
94100
|
+
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID, layer);
|
|
94082
94101
|
for (const [spec] of subscribers) {
|
|
94083
94102
|
spec.set(
|
|
94084
94103
|
this.cache._internal_unstable.getSelection({
|
|
@@ -94091,12 +94110,12 @@ var List = class {
|
|
|
94091
94110
|
}
|
|
94092
94111
|
return true;
|
|
94093
94112
|
}
|
|
94094
|
-
remove(data2, variables = {}) {
|
|
94113
|
+
remove(data2, variables = {}, layer) {
|
|
94095
94114
|
const targetID = this.cache._internal_unstable.id(this.listType(data2), data2);
|
|
94096
94115
|
if (!targetID) {
|
|
94097
94116
|
return;
|
|
94098
94117
|
}
|
|
94099
|
-
return this.removeID(targetID, variables);
|
|
94118
|
+
return this.removeID(targetID, variables, layer);
|
|
94100
94119
|
}
|
|
94101
94120
|
listType(data2) {
|
|
94102
94121
|
return data2.__typename || this.type;
|
|
@@ -94128,7 +94147,7 @@ var List = class {
|
|
|
94128
94147
|
layer,
|
|
94129
94148
|
where
|
|
94130
94149
|
}) {
|
|
94131
|
-
if (!this.remove(data2, variables)) {
|
|
94150
|
+
if (!this.remove(data2, variables, layer)) {
|
|
94132
94151
|
this.addToList(selection, data2, variables, where, layer);
|
|
94133
94152
|
}
|
|
94134
94153
|
}
|
|
@@ -94261,7 +94280,7 @@ var StaleManager = class {
|
|
|
94261
94280
|
};
|
|
94262
94281
|
var InMemoryStorage = class {
|
|
94263
94282
|
data;
|
|
94264
|
-
idCount =
|
|
94283
|
+
idCount = 1;
|
|
94265
94284
|
rank = 0;
|
|
94266
94285
|
constructor() {
|
|
94267
94286
|
this.data = [];
|
|
@@ -94281,11 +94300,11 @@ var InMemoryStorage = class {
|
|
|
94281
94300
|
insert(id2, field, location, target) {
|
|
94282
94301
|
return this.topLayer.insert(id2, field, location, target);
|
|
94283
94302
|
}
|
|
94284
|
-
remove(id2, field, target) {
|
|
94285
|
-
return
|
|
94303
|
+
remove(id2, field, target, layerToUser = this.topLayer) {
|
|
94304
|
+
return layerToUser.remove(id2, field, target);
|
|
94286
94305
|
}
|
|
94287
|
-
delete(id2) {
|
|
94288
|
-
return
|
|
94306
|
+
delete(id2, layerToUser = this.topLayer) {
|
|
94307
|
+
return layerToUser.delete(id2);
|
|
94289
94308
|
}
|
|
94290
94309
|
deleteField(id2, field) {
|
|
94291
94310
|
return this.topLayer.deleteField(id2, field);
|
|
@@ -94419,6 +94438,23 @@ var InMemoryStorage = class {
|
|
|
94419
94438
|
}
|
|
94420
94439
|
return this.data[this.data.length - 1];
|
|
94421
94440
|
}
|
|
94441
|
+
serialize() {
|
|
94442
|
+
return JSON.stringify({
|
|
94443
|
+
rank: this.rank,
|
|
94444
|
+
fields: this.topLayer.fields,
|
|
94445
|
+
links: this.topLayer.links
|
|
94446
|
+
});
|
|
94447
|
+
}
|
|
94448
|
+
hydrate(args, layer) {
|
|
94449
|
+
if (!args) {
|
|
94450
|
+
return;
|
|
94451
|
+
}
|
|
94452
|
+
const { rank, fields, links } = args;
|
|
94453
|
+
this.rank = rank;
|
|
94454
|
+
layer ??= this.createLayer(true);
|
|
94455
|
+
layer.fields = fields;
|
|
94456
|
+
layer.links = links;
|
|
94457
|
+
}
|
|
94422
94458
|
};
|
|
94423
94459
|
var Layer = class {
|
|
94424
94460
|
id;
|
|
@@ -94653,6 +94689,9 @@ var InMemorySubscriptions = class {
|
|
|
94653
94689
|
subscribers = {};
|
|
94654
94690
|
referenceCounts = {};
|
|
94655
94691
|
keyVersions = {};
|
|
94692
|
+
activeFields(parent2) {
|
|
94693
|
+
return Object.keys(this.subscribers[parent2] || {});
|
|
94694
|
+
}
|
|
94656
94695
|
add({
|
|
94657
94696
|
parent: parent2,
|
|
94658
94697
|
spec,
|
|
@@ -94919,20 +94958,7 @@ var Cache = class {
|
|
|
94919
94958
|
}) {
|
|
94920
94959
|
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
94921
94960
|
const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
|
|
94922
|
-
|
|
94923
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
94924
|
-
if (!notified.includes(spec.set)) {
|
|
94925
|
-
notified.push(spec.set);
|
|
94926
|
-
spec.set(
|
|
94927
|
-
this._internal_unstable.getSelection({
|
|
94928
|
-
parent: spec.parentID || rootID,
|
|
94929
|
-
selection: spec.selection,
|
|
94930
|
-
variables: spec.variables?.() || {},
|
|
94931
|
-
ignoreMasking: false
|
|
94932
|
-
}).data
|
|
94933
|
-
);
|
|
94934
|
-
}
|
|
94935
|
-
}
|
|
94961
|
+
this.#notifySubscribers(subscribers.concat(notifySubscribers));
|
|
94936
94962
|
return subscribers;
|
|
94937
94963
|
}
|
|
94938
94964
|
read(...args) {
|
|
@@ -94971,10 +94997,10 @@ var Cache = class {
|
|
|
94971
94997
|
}
|
|
94972
94998
|
return handler;
|
|
94973
94999
|
}
|
|
94974
|
-
delete(id2) {
|
|
95000
|
+
delete(id2, layer) {
|
|
94975
95001
|
this._internal_unstable.subscriptions.removeAllSubscribers(id2);
|
|
94976
|
-
this._internal_unstable.lists.removeIDFromAllLists(id2);
|
|
94977
|
-
this._internal_unstable.storage.delete(id2);
|
|
95002
|
+
this._internal_unstable.lists.removeIDFromAllLists(id2, layer);
|
|
95003
|
+
this._internal_unstable.storage.delete(id2, layer);
|
|
94978
95004
|
}
|
|
94979
95005
|
setConfig(config4) {
|
|
94980
95006
|
this._internal_unstable.setConfig(config4);
|
|
@@ -95006,6 +95032,76 @@ var Cache = class {
|
|
|
95006
95032
|
config() {
|
|
95007
95033
|
return this._internal_unstable.config;
|
|
95008
95034
|
}
|
|
95035
|
+
serialize() {
|
|
95036
|
+
return this._internal_unstable.storage.serialize();
|
|
95037
|
+
}
|
|
95038
|
+
hydrate(...args) {
|
|
95039
|
+
return this._internal_unstable.storage.hydrate(...args);
|
|
95040
|
+
}
|
|
95041
|
+
clearLayer(layerID) {
|
|
95042
|
+
const layer = this._internal_unstable.storage.getLayer(layerID);
|
|
95043
|
+
if (!layer) {
|
|
95044
|
+
throw new Error("Cannot find layer with id: " + layerID);
|
|
95045
|
+
}
|
|
95046
|
+
const toNotify = [];
|
|
95047
|
+
const allFields = [];
|
|
95048
|
+
for (const target of [layer.fields, layer.links]) {
|
|
95049
|
+
for (const [id2, fields] of Object.entries(target)) {
|
|
95050
|
+
allFields.push(
|
|
95051
|
+
...Object.entries(fields).map(([field, value2]) => ({ id: id2, field, value: value2 }))
|
|
95052
|
+
);
|
|
95053
|
+
}
|
|
95054
|
+
}
|
|
95055
|
+
const displayFields = [];
|
|
95056
|
+
for (const pair of allFields) {
|
|
95057
|
+
const { displayLayers } = this._internal_unstable.storage.get(pair.id, pair.field);
|
|
95058
|
+
if (!displayLayers.includes(layerID)) {
|
|
95059
|
+
continue;
|
|
95060
|
+
}
|
|
95061
|
+
displayFields.push(pair);
|
|
95062
|
+
}
|
|
95063
|
+
for (const [id2, operation] of Object.entries(layer.operations)) {
|
|
95064
|
+
if (operation.deleted) {
|
|
95065
|
+
displayFields.push(
|
|
95066
|
+
...this._internal_unstable.subscriptions.activeFields(id2).map((field) => ({ id: id2, field }))
|
|
95067
|
+
);
|
|
95068
|
+
}
|
|
95069
|
+
const fields = Object.keys(operation.fields ?? {});
|
|
95070
|
+
if (fields.length > 0) {
|
|
95071
|
+
displayFields.push(...fields.map((field) => ({ id: id2, field })));
|
|
95072
|
+
}
|
|
95073
|
+
}
|
|
95074
|
+
layer.clear();
|
|
95075
|
+
for (const display of displayFields) {
|
|
95076
|
+
const { field, id: id2 } = display;
|
|
95077
|
+
const notify = !("value" in display) || this._internal_unstable.storage.get(id2, field).value !== display.value;
|
|
95078
|
+
if (notify) {
|
|
95079
|
+
toNotify.push(
|
|
95080
|
+
...this._internal_unstable.subscriptions.get(id2, field).map((sub) => sub[0])
|
|
95081
|
+
);
|
|
95082
|
+
}
|
|
95083
|
+
}
|
|
95084
|
+
this.#notifySubscribers(toNotify);
|
|
95085
|
+
}
|
|
95086
|
+
#notifySubscribers(subs) {
|
|
95087
|
+
if (subs.length === 0) {
|
|
95088
|
+
return;
|
|
95089
|
+
}
|
|
95090
|
+
const notified = [];
|
|
95091
|
+
for (const spec of subs) {
|
|
95092
|
+
if (!notified.includes(spec.set)) {
|
|
95093
|
+
notified.push(spec.set);
|
|
95094
|
+
spec.set(
|
|
95095
|
+
this._internal_unstable.getSelection({
|
|
95096
|
+
parent: spec.parentID || rootID,
|
|
95097
|
+
selection: spec.selection,
|
|
95098
|
+
variables: spec.variables?.() || {},
|
|
95099
|
+
ignoreMasking: false
|
|
95100
|
+
}).data
|
|
95101
|
+
);
|
|
95102
|
+
}
|
|
95103
|
+
}
|
|
95104
|
+
}
|
|
95009
95105
|
};
|
|
95010
95106
|
var CacheInternal = class {
|
|
95011
95107
|
_disabled = false;
|
|
@@ -95293,8 +95389,16 @@ var CacheInternal = class {
|
|
|
95293
95389
|
operation.position || "last",
|
|
95294
95390
|
layer
|
|
95295
95391
|
);
|
|
95392
|
+
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
95393
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
95394
|
+
selection: fieldSelection,
|
|
95395
|
+
data: target,
|
|
95396
|
+
variables,
|
|
95397
|
+
where: operation.position || "last",
|
|
95398
|
+
layer
|
|
95399
|
+
});
|
|
95296
95400
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
95297
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
95401
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
95298
95402
|
} else if (operation.action === "delete" && operation.type) {
|
|
95299
95403
|
if (typeof target !== "string") {
|
|
95300
95404
|
throw new Error("Cannot delete a record with a non-string ID");
|
|
@@ -95303,15 +95407,7 @@ var CacheInternal = class {
|
|
|
95303
95407
|
if (!targetID) {
|
|
95304
95408
|
continue;
|
|
95305
95409
|
}
|
|
95306
|
-
this.cache.delete(targetID);
|
|
95307
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
95308
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
95309
|
-
selection: fieldSelection,
|
|
95310
|
-
data: target,
|
|
95311
|
-
variables,
|
|
95312
|
-
where: operation.position || "last",
|
|
95313
|
-
layer
|
|
95314
|
-
});
|
|
95410
|
+
this.cache.delete(targetID, layer);
|
|
95315
95411
|
}
|
|
95316
95412
|
}
|
|
95317
95413
|
}
|
|
@@ -95834,7 +95930,7 @@ var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
|
95834
95930
|
var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
95835
95931
|
return {
|
|
95836
95932
|
async start(ctx, { next, marshalVariables: marshalVariables2 }) {
|
|
95837
|
-
const
|
|
95933
|
+
const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
|
|
95838
95934
|
const optimisticResponse = ctx.stuff.optimisticResponse;
|
|
95839
95935
|
let toNotify = [];
|
|
95840
95936
|
if (optimisticResponse) {
|
|
@@ -95845,25 +95941,29 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
95845
95941
|
data: optimisticResponse
|
|
95846
95942
|
}),
|
|
95847
95943
|
variables: marshalVariables2(ctx),
|
|
95848
|
-
layer:
|
|
95944
|
+
layer: layerOptimistic.id
|
|
95849
95945
|
});
|
|
95850
95946
|
}
|
|
95851
95947
|
ctx.cacheParams = {
|
|
95852
95948
|
...ctx.cacheParams,
|
|
95853
|
-
layer,
|
|
95949
|
+
layer: layerOptimistic,
|
|
95854
95950
|
notifySubscribers: toNotify,
|
|
95855
95951
|
forceNotify: true
|
|
95856
95952
|
};
|
|
95857
95953
|
next(ctx);
|
|
95858
95954
|
},
|
|
95859
95955
|
afterNetwork(ctx, { resolve: resolve22 }) {
|
|
95860
|
-
ctx.cacheParams?.layer
|
|
95956
|
+
if (ctx.cacheParams?.layer) {
|
|
95957
|
+
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
95958
|
+
}
|
|
95861
95959
|
resolve22(ctx);
|
|
95862
95960
|
},
|
|
95863
95961
|
end(ctx, { resolve: resolve22, value: value2 }) {
|
|
95864
95962
|
const hasErrors = value2.errors && value2.errors.length > 0;
|
|
95865
95963
|
if (hasErrors) {
|
|
95866
|
-
ctx.cacheParams?.layer
|
|
95964
|
+
if (ctx.cacheParams?.layer) {
|
|
95965
|
+
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
95966
|
+
}
|
|
95867
95967
|
}
|
|
95868
95968
|
if (ctx.cacheParams?.layer) {
|
|
95869
95969
|
cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
|
|
@@ -95873,7 +95973,7 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
95873
95973
|
catch(ctx, { error: error2 }) {
|
|
95874
95974
|
if (ctx.cacheParams?.layer) {
|
|
95875
95975
|
const { layer } = ctx.cacheParams;
|
|
95876
|
-
layer.
|
|
95976
|
+
cache_default.clearLayer(layer.id);
|
|
95877
95977
|
cache_default._internal_unstable.storage.resolveLayer(layer.id);
|
|
95878
95978
|
}
|
|
95879
95979
|
throw error2;
|
|
@@ -96749,7 +96849,7 @@ function deepMerge2(filepath, ...targets) {
|
|
|
96749
96849
|
});
|
|
96750
96850
|
}
|
|
96751
96851
|
}
|
|
96752
|
-
|
|
96852
|
+
function parseJS(str, config4) {
|
|
96753
96853
|
const defaultConfig = {
|
|
96754
96854
|
plugins: ["typescript", "importAssertions"],
|
|
96755
96855
|
sourceType: "module"
|
|
@@ -186553,6 +186653,7 @@ __export3(fs_exports2, {
|
|
|
186553
186653
|
recursiveCopy: () => recursiveCopy2,
|
|
186554
186654
|
remove: () => remove2,
|
|
186555
186655
|
rmdir: () => rmdir2,
|
|
186656
|
+
snapshot: () => snapshot2,
|
|
186556
186657
|
stat: () => stat3,
|
|
186557
186658
|
writeFile: () => writeFile2
|
|
186558
186659
|
});
|
|
@@ -186739,16 +186840,17 @@ function existsSync2(dirPath) {
|
|
|
186739
186840
|
}
|
|
186740
186841
|
return import_memfs2.fs.existsSync(dirPath);
|
|
186741
186842
|
}
|
|
186742
|
-
async function readdir2(filepath) {
|
|
186843
|
+
async function readdir2(filepath, opts) {
|
|
186743
186844
|
if (!houdini_mode2.is_testing) {
|
|
186744
|
-
return await import_promises2.default.readdir(filepath);
|
|
186845
|
+
return await import_promises2.default.readdir(filepath, opts);
|
|
186745
186846
|
}
|
|
186746
186847
|
if (filepath.includes("build/runtime")) {
|
|
186747
|
-
return await import_promises2.default.readdir(filepath);
|
|
186848
|
+
return await import_promises2.default.readdir(filepath, opts);
|
|
186748
186849
|
}
|
|
186749
186850
|
try {
|
|
186750
|
-
return import_memfs2.fs.readdirSync(filepath);
|
|
186751
|
-
} catch {
|
|
186851
|
+
return import_memfs2.fs.readdirSync(filepath, opts);
|
|
186852
|
+
} catch (e22) {
|
|
186853
|
+
console.log(e22);
|
|
186752
186854
|
return [];
|
|
186753
186855
|
}
|
|
186754
186856
|
}
|
|
@@ -186799,6 +186901,11 @@ async function recursiveCopy2(source, target, transforms, notRoot) {
|
|
|
186799
186901
|
);
|
|
186800
186902
|
}
|
|
186801
186903
|
}
|
|
186904
|
+
function snapshot2(base) {
|
|
186905
|
+
return Object.fromEntries(
|
|
186906
|
+
Object.entries(import_memfs2.vol.toJSON()).filter(([key]) => !base || key.startsWith(base)).map(([key, value2]) => [!base ? key : key.substring(base.length), value2])
|
|
186907
|
+
);
|
|
186908
|
+
}
|
|
186802
186909
|
async function glob2(pattern) {
|
|
186803
186910
|
return await (0, import_node_util5.promisify)(import_glob2.glob)(posixify2(pattern));
|
|
186804
186911
|
}
|
|
@@ -187552,10 +187659,10 @@ var ListManager2 = class {
|
|
|
187552
187659
|
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
187553
187660
|
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
187554
187661
|
}
|
|
187555
|
-
removeIDFromAllLists(id2) {
|
|
187662
|
+
removeIDFromAllLists(id2, layer) {
|
|
187556
187663
|
for (const fieldMap of this.lists.values()) {
|
|
187557
187664
|
for (const list of fieldMap.values()) {
|
|
187558
|
-
list.removeID(id2);
|
|
187665
|
+
list.removeID(id2, void 0, layer);
|
|
187559
187666
|
}
|
|
187560
187667
|
}
|
|
187561
187668
|
}
|
|
@@ -187652,6 +187759,10 @@ var List3 = class {
|
|
|
187652
187759
|
updates: ["append", "prepend"],
|
|
187653
187760
|
selection: {
|
|
187654
187761
|
fields: {
|
|
187762
|
+
__typename: {
|
|
187763
|
+
keyRaw: "__typename",
|
|
187764
|
+
type: "String"
|
|
187765
|
+
},
|
|
187655
187766
|
node: {
|
|
187656
187767
|
type: listType,
|
|
187657
187768
|
keyRaw: "node",
|
|
@@ -187676,7 +187787,15 @@ var List3 = class {
|
|
|
187676
187787
|
};
|
|
187677
187788
|
insertData = {
|
|
187678
187789
|
newEntry: {
|
|
187679
|
-
edges: [
|
|
187790
|
+
edges: [
|
|
187791
|
+
{
|
|
187792
|
+
__typename: listType + "Edge",
|
|
187793
|
+
node: {
|
|
187794
|
+
...data2,
|
|
187795
|
+
__typename: listType
|
|
187796
|
+
}
|
|
187797
|
+
}
|
|
187798
|
+
]
|
|
187680
187799
|
}
|
|
187681
187800
|
};
|
|
187682
187801
|
} else {
|
|
@@ -187712,7 +187831,7 @@ var List3 = class {
|
|
|
187712
187831
|
layer: layer?.id
|
|
187713
187832
|
});
|
|
187714
187833
|
}
|
|
187715
|
-
removeID(id2, variables = {}) {
|
|
187834
|
+
removeID(id2, variables = {}, layer) {
|
|
187716
187835
|
if (!this.validateWhen()) {
|
|
187717
187836
|
return;
|
|
187718
187837
|
}
|
|
@@ -187759,7 +187878,7 @@ var List3 = class {
|
|
|
187759
187878
|
subscribers.map((sub) => sub[0]),
|
|
187760
187879
|
variables
|
|
187761
187880
|
);
|
|
187762
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
187881
|
+
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID, layer);
|
|
187763
187882
|
for (const [spec] of subscribers) {
|
|
187764
187883
|
spec.set(
|
|
187765
187884
|
this.cache._internal_unstable.getSelection({
|
|
@@ -187772,12 +187891,12 @@ var List3 = class {
|
|
|
187772
187891
|
}
|
|
187773
187892
|
return true;
|
|
187774
187893
|
}
|
|
187775
|
-
remove(data2, variables = {}) {
|
|
187894
|
+
remove(data2, variables = {}, layer) {
|
|
187776
187895
|
const targetID = this.cache._internal_unstable.id(this.listType(data2), data2);
|
|
187777
187896
|
if (!targetID) {
|
|
187778
187897
|
return;
|
|
187779
187898
|
}
|
|
187780
|
-
return this.removeID(targetID, variables);
|
|
187899
|
+
return this.removeID(targetID, variables, layer);
|
|
187781
187900
|
}
|
|
187782
187901
|
listType(data2) {
|
|
187783
187902
|
return data2.__typename || this.type;
|
|
@@ -187809,7 +187928,7 @@ var List3 = class {
|
|
|
187809
187928
|
layer,
|
|
187810
187929
|
where
|
|
187811
187930
|
}) {
|
|
187812
|
-
if (!this.remove(data2, variables)) {
|
|
187931
|
+
if (!this.remove(data2, variables, layer)) {
|
|
187813
187932
|
this.addToList(selection, data2, variables, where, layer);
|
|
187814
187933
|
}
|
|
187815
187934
|
}
|
|
@@ -187942,7 +188061,7 @@ var StaleManager2 = class {
|
|
|
187942
188061
|
};
|
|
187943
188062
|
var InMemoryStorage2 = class {
|
|
187944
188063
|
data;
|
|
187945
|
-
idCount =
|
|
188064
|
+
idCount = 1;
|
|
187946
188065
|
rank = 0;
|
|
187947
188066
|
constructor() {
|
|
187948
188067
|
this.data = [];
|
|
@@ -187962,11 +188081,11 @@ var InMemoryStorage2 = class {
|
|
|
187962
188081
|
insert(id2, field, location, target) {
|
|
187963
188082
|
return this.topLayer.insert(id2, field, location, target);
|
|
187964
188083
|
}
|
|
187965
|
-
remove(id2, field, target) {
|
|
187966
|
-
return
|
|
188084
|
+
remove(id2, field, target, layerToUser = this.topLayer) {
|
|
188085
|
+
return layerToUser.remove(id2, field, target);
|
|
187967
188086
|
}
|
|
187968
|
-
delete(id2) {
|
|
187969
|
-
return
|
|
188087
|
+
delete(id2, layerToUser = this.topLayer) {
|
|
188088
|
+
return layerToUser.delete(id2);
|
|
187970
188089
|
}
|
|
187971
188090
|
deleteField(id2, field) {
|
|
187972
188091
|
return this.topLayer.deleteField(id2, field);
|
|
@@ -188100,6 +188219,23 @@ var InMemoryStorage2 = class {
|
|
|
188100
188219
|
}
|
|
188101
188220
|
return this.data[this.data.length - 1];
|
|
188102
188221
|
}
|
|
188222
|
+
serialize() {
|
|
188223
|
+
return JSON.stringify({
|
|
188224
|
+
rank: this.rank,
|
|
188225
|
+
fields: this.topLayer.fields,
|
|
188226
|
+
links: this.topLayer.links
|
|
188227
|
+
});
|
|
188228
|
+
}
|
|
188229
|
+
hydrate(args, layer) {
|
|
188230
|
+
if (!args) {
|
|
188231
|
+
return;
|
|
188232
|
+
}
|
|
188233
|
+
const { rank, fields, links } = args;
|
|
188234
|
+
this.rank = rank;
|
|
188235
|
+
layer ??= this.createLayer(true);
|
|
188236
|
+
layer.fields = fields;
|
|
188237
|
+
layer.links = links;
|
|
188238
|
+
}
|
|
188103
188239
|
};
|
|
188104
188240
|
var Layer2 = class {
|
|
188105
188241
|
id;
|
|
@@ -188334,6 +188470,9 @@ var InMemorySubscriptions2 = class {
|
|
|
188334
188470
|
subscribers = {};
|
|
188335
188471
|
referenceCounts = {};
|
|
188336
188472
|
keyVersions = {};
|
|
188473
|
+
activeFields(parent2) {
|
|
188474
|
+
return Object.keys(this.subscribers[parent2] || {});
|
|
188475
|
+
}
|
|
188337
188476
|
add({
|
|
188338
188477
|
parent: parent2,
|
|
188339
188478
|
spec,
|
|
@@ -188600,20 +188739,7 @@ var Cache2 = class {
|
|
|
188600
188739
|
}) {
|
|
188601
188740
|
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
188602
188741
|
const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
|
|
188603
|
-
|
|
188604
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
188605
|
-
if (!notified.includes(spec.set)) {
|
|
188606
|
-
notified.push(spec.set);
|
|
188607
|
-
spec.set(
|
|
188608
|
-
this._internal_unstable.getSelection({
|
|
188609
|
-
parent: spec.parentID || rootID2,
|
|
188610
|
-
selection: spec.selection,
|
|
188611
|
-
variables: spec.variables?.() || {},
|
|
188612
|
-
ignoreMasking: false
|
|
188613
|
-
}).data
|
|
188614
|
-
);
|
|
188615
|
-
}
|
|
188616
|
-
}
|
|
188742
|
+
this.#notifySubscribers(subscribers.concat(notifySubscribers));
|
|
188617
188743
|
return subscribers;
|
|
188618
188744
|
}
|
|
188619
188745
|
read(...args) {
|
|
@@ -188652,10 +188778,10 @@ var Cache2 = class {
|
|
|
188652
188778
|
}
|
|
188653
188779
|
return handler;
|
|
188654
188780
|
}
|
|
188655
|
-
delete(id2) {
|
|
188781
|
+
delete(id2, layer) {
|
|
188656
188782
|
this._internal_unstable.subscriptions.removeAllSubscribers(id2);
|
|
188657
|
-
this._internal_unstable.lists.removeIDFromAllLists(id2);
|
|
188658
|
-
this._internal_unstable.storage.delete(id2);
|
|
188783
|
+
this._internal_unstable.lists.removeIDFromAllLists(id2, layer);
|
|
188784
|
+
this._internal_unstable.storage.delete(id2, layer);
|
|
188659
188785
|
}
|
|
188660
188786
|
setConfig(config4) {
|
|
188661
188787
|
this._internal_unstable.setConfig(config4);
|
|
@@ -188687,6 +188813,76 @@ var Cache2 = class {
|
|
|
188687
188813
|
config() {
|
|
188688
188814
|
return this._internal_unstable.config;
|
|
188689
188815
|
}
|
|
188816
|
+
serialize() {
|
|
188817
|
+
return this._internal_unstable.storage.serialize();
|
|
188818
|
+
}
|
|
188819
|
+
hydrate(...args) {
|
|
188820
|
+
return this._internal_unstable.storage.hydrate(...args);
|
|
188821
|
+
}
|
|
188822
|
+
clearLayer(layerID) {
|
|
188823
|
+
const layer = this._internal_unstable.storage.getLayer(layerID);
|
|
188824
|
+
if (!layer) {
|
|
188825
|
+
throw new Error("Cannot find layer with id: " + layerID);
|
|
188826
|
+
}
|
|
188827
|
+
const toNotify = [];
|
|
188828
|
+
const allFields = [];
|
|
188829
|
+
for (const target of [layer.fields, layer.links]) {
|
|
188830
|
+
for (const [id2, fields] of Object.entries(target)) {
|
|
188831
|
+
allFields.push(
|
|
188832
|
+
...Object.entries(fields).map(([field, value2]) => ({ id: id2, field, value: value2 }))
|
|
188833
|
+
);
|
|
188834
|
+
}
|
|
188835
|
+
}
|
|
188836
|
+
const displayFields = [];
|
|
188837
|
+
for (const pair of allFields) {
|
|
188838
|
+
const { displayLayers } = this._internal_unstable.storage.get(pair.id, pair.field);
|
|
188839
|
+
if (!displayLayers.includes(layerID)) {
|
|
188840
|
+
continue;
|
|
188841
|
+
}
|
|
188842
|
+
displayFields.push(pair);
|
|
188843
|
+
}
|
|
188844
|
+
for (const [id2, operation] of Object.entries(layer.operations)) {
|
|
188845
|
+
if (operation.deleted) {
|
|
188846
|
+
displayFields.push(
|
|
188847
|
+
...this._internal_unstable.subscriptions.activeFields(id2).map((field) => ({ id: id2, field }))
|
|
188848
|
+
);
|
|
188849
|
+
}
|
|
188850
|
+
const fields = Object.keys(operation.fields ?? {});
|
|
188851
|
+
if (fields.length > 0) {
|
|
188852
|
+
displayFields.push(...fields.map((field) => ({ id: id2, field })));
|
|
188853
|
+
}
|
|
188854
|
+
}
|
|
188855
|
+
layer.clear();
|
|
188856
|
+
for (const display of displayFields) {
|
|
188857
|
+
const { field, id: id2 } = display;
|
|
188858
|
+
const notify = !("value" in display) || this._internal_unstable.storage.get(id2, field).value !== display.value;
|
|
188859
|
+
if (notify) {
|
|
188860
|
+
toNotify.push(
|
|
188861
|
+
...this._internal_unstable.subscriptions.get(id2, field).map((sub) => sub[0])
|
|
188862
|
+
);
|
|
188863
|
+
}
|
|
188864
|
+
}
|
|
188865
|
+
this.#notifySubscribers(toNotify);
|
|
188866
|
+
}
|
|
188867
|
+
#notifySubscribers(subs) {
|
|
188868
|
+
if (subs.length === 0) {
|
|
188869
|
+
return;
|
|
188870
|
+
}
|
|
188871
|
+
const notified = [];
|
|
188872
|
+
for (const spec of subs) {
|
|
188873
|
+
if (!notified.includes(spec.set)) {
|
|
188874
|
+
notified.push(spec.set);
|
|
188875
|
+
spec.set(
|
|
188876
|
+
this._internal_unstable.getSelection({
|
|
188877
|
+
parent: spec.parentID || rootID2,
|
|
188878
|
+
selection: spec.selection,
|
|
188879
|
+
variables: spec.variables?.() || {},
|
|
188880
|
+
ignoreMasking: false
|
|
188881
|
+
}).data
|
|
188882
|
+
);
|
|
188883
|
+
}
|
|
188884
|
+
}
|
|
188885
|
+
}
|
|
188690
188886
|
};
|
|
188691
188887
|
var CacheInternal2 = class {
|
|
188692
188888
|
_disabled = false;
|
|
@@ -188974,8 +189170,16 @@ var CacheInternal2 = class {
|
|
|
188974
189170
|
operation.position || "last",
|
|
188975
189171
|
layer
|
|
188976
189172
|
);
|
|
189173
|
+
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
189174
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
189175
|
+
selection: fieldSelection,
|
|
189176
|
+
data: target,
|
|
189177
|
+
variables,
|
|
189178
|
+
where: operation.position || "last",
|
|
189179
|
+
layer
|
|
189180
|
+
});
|
|
188977
189181
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
188978
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
189182
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
188979
189183
|
} else if (operation.action === "delete" && operation.type) {
|
|
188980
189184
|
if (typeof target !== "string") {
|
|
188981
189185
|
throw new Error("Cannot delete a record with a non-string ID");
|
|
@@ -188984,15 +189188,7 @@ var CacheInternal2 = class {
|
|
|
188984
189188
|
if (!targetID) {
|
|
188985
189189
|
continue;
|
|
188986
189190
|
}
|
|
188987
|
-
this.cache.delete(targetID);
|
|
188988
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
188989
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
188990
|
-
selection: fieldSelection,
|
|
188991
|
-
data: target,
|
|
188992
|
-
variables,
|
|
188993
|
-
where: operation.position || "last",
|
|
188994
|
-
layer
|
|
188995
|
-
});
|
|
189191
|
+
this.cache.delete(targetID, layer);
|
|
188996
189192
|
}
|
|
188997
189193
|
}
|
|
188998
189194
|
}
|
|
@@ -189515,7 +189711,7 @@ var fragment3 = documentPlugin2(ArtifactKind2.Fragment, function() {
|
|
|
189515
189711
|
var mutation2 = documentPlugin2(ArtifactKind2.Mutation, () => {
|
|
189516
189712
|
return {
|
|
189517
189713
|
async start(ctx, { next, marshalVariables }) {
|
|
189518
|
-
const
|
|
189714
|
+
const layerOptimistic = cache_default2._internal_unstable.storage.createLayer(true);
|
|
189519
189715
|
const optimisticResponse = ctx.stuff.optimisticResponse;
|
|
189520
189716
|
let toNotify = [];
|
|
189521
189717
|
if (optimisticResponse) {
|
|
@@ -189526,25 +189722,29 @@ var mutation2 = documentPlugin2(ArtifactKind2.Mutation, () => {
|
|
|
189526
189722
|
data: optimisticResponse
|
|
189527
189723
|
}),
|
|
189528
189724
|
variables: marshalVariables(ctx),
|
|
189529
|
-
layer:
|
|
189725
|
+
layer: layerOptimistic.id
|
|
189530
189726
|
});
|
|
189531
189727
|
}
|
|
189532
189728
|
ctx.cacheParams = {
|
|
189533
189729
|
...ctx.cacheParams,
|
|
189534
|
-
layer,
|
|
189730
|
+
layer: layerOptimistic,
|
|
189535
189731
|
notifySubscribers: toNotify,
|
|
189536
189732
|
forceNotify: true
|
|
189537
189733
|
};
|
|
189538
189734
|
next(ctx);
|
|
189539
189735
|
},
|
|
189540
189736
|
afterNetwork(ctx, { resolve: resolve22 }) {
|
|
189541
|
-
ctx.cacheParams?.layer
|
|
189737
|
+
if (ctx.cacheParams?.layer) {
|
|
189738
|
+
cache_default2.clearLayer(ctx.cacheParams.layer.id);
|
|
189739
|
+
}
|
|
189542
189740
|
resolve22(ctx);
|
|
189543
189741
|
},
|
|
189544
189742
|
end(ctx, { resolve: resolve22, value: value2 }) {
|
|
189545
189743
|
const hasErrors = value2.errors && value2.errors.length > 0;
|
|
189546
189744
|
if (hasErrors) {
|
|
189547
|
-
ctx.cacheParams?.layer
|
|
189745
|
+
if (ctx.cacheParams?.layer) {
|
|
189746
|
+
cache_default2.clearLayer(ctx.cacheParams.layer.id);
|
|
189747
|
+
}
|
|
189548
189748
|
}
|
|
189549
189749
|
if (ctx.cacheParams?.layer) {
|
|
189550
189750
|
cache_default2._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
|
|
@@ -189554,7 +189754,7 @@ var mutation2 = documentPlugin2(ArtifactKind2.Mutation, () => {
|
|
|
189554
189754
|
catch(ctx, { error: error2 }) {
|
|
189555
189755
|
if (ctx.cacheParams?.layer) {
|
|
189556
189756
|
const { layer } = ctx.cacheParams;
|
|
189557
|
-
layer.
|
|
189757
|
+
cache_default2.clearLayer(layer.id);
|
|
189558
189758
|
cache_default2._internal_unstable.storage.resolveLayer(layer.id);
|
|
189559
189759
|
}
|
|
189560
189760
|
throw error2;
|