houdini 1.2.54 → 1.2.56
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 +142 -60
- package/build/cmd-esm/index.js +142 -60
- package/build/codegen-cjs/index.js +140 -58
- package/build/codegen-esm/index.js +140 -58
- package/build/lib-cjs/index.js +143 -59
- package/build/lib-esm/index.js +143 -59
- package/build/runtime/cache/cache.d.ts +1 -2
- package/build/runtime/cache/constants.d.ts +1 -0
- package/build/runtime/cache/lists.d.ts +2 -2
- package/build/runtime/cache/storage.d.ts +4 -4
- package/build/runtime/cache/stuff.d.ts +1 -0
- package/build/runtime/cache/subscription.d.ts +4 -1
- package/build/runtime-cjs/cache/cache.d.ts +1 -2
- package/build/runtime-cjs/cache/cache.js +41 -14
- package/build/runtime-cjs/cache/constants.d.ts +1 -0
- package/build/runtime-cjs/cache/constants.js +28 -0
- package/build/runtime-cjs/cache/lists.d.ts +2 -2
- package/build/runtime-cjs/cache/lists.js +14 -4
- package/build/runtime-cjs/cache/storage.d.ts +4 -4
- package/build/runtime-cjs/cache/storage.js +15 -6
- package/build/runtime-cjs/cache/stuff.d.ts +1 -0
- package/build/runtime-cjs/cache/stuff.js +5 -2
- package/build/runtime-cjs/cache/subscription.d.ts +4 -1
- package/build/runtime-cjs/cache/subscription.js +51 -19
- package/build/runtime-cjs/client/plugins/optimisticKeys.js +3 -1
- package/build/runtime-cjs/public/record.js +2 -2
- package/build/runtime-esm/cache/cache.d.ts +1 -2
- package/build/runtime-esm/cache/cache.js +35 -7
- package/build/runtime-esm/cache/constants.d.ts +1 -0
- package/build/runtime-esm/cache/constants.js +4 -0
- package/build/runtime-esm/cache/lists.d.ts +2 -2
- package/build/runtime-esm/cache/lists.js +13 -3
- package/build/runtime-esm/cache/storage.d.ts +4 -4
- package/build/runtime-esm/cache/storage.js +15 -6
- package/build/runtime-esm/cache/stuff.d.ts +1 -0
- package/build/runtime-esm/cache/stuff.js +3 -1
- package/build/runtime-esm/cache/subscription.d.ts +4 -1
- package/build/runtime-esm/cache/subscription.js +51 -19
- package/build/runtime-esm/client/plugins/optimisticKeys.js +3 -1
- package/build/runtime-esm/public/record.js +1 -1
- package/build/test-cjs/index.js +140 -58
- package/build/test-esm/index.js +140 -58
- package/build/vite-cjs/index.js +140 -58
- package/build/vite-esm/index.js +140 -58
- package/package.json +1 -1
- package/build/runtime/cache/schema.d.ts +0 -21
- package/build/runtime-cjs/cache/schema.d.ts +0 -21
- package/build/runtime-cjs/cache/schema.js +0 -66
- package/build/runtime-esm/cache/schema.d.ts +0 -21
- package/build/runtime-esm/cache/schema.js +0 -42
package/build/cmd-cjs/index.js
CHANGED
|
@@ -65292,6 +65292,35 @@ var GarbageCollector = class {
|
|
|
65292
65292
|
}
|
|
65293
65293
|
};
|
|
65294
65294
|
|
|
65295
|
+
// src/runtime/cache/stuff.ts
|
|
65296
|
+
function evaluateKey(key, variables = null) {
|
|
65297
|
+
let evaluated = "";
|
|
65298
|
+
let varName = "";
|
|
65299
|
+
let inString = false;
|
|
65300
|
+
for (const char of key) {
|
|
65301
|
+
if (varName) {
|
|
65302
|
+
if (varChars.includes(char)) {
|
|
65303
|
+
varName += char;
|
|
65304
|
+
continue;
|
|
65305
|
+
}
|
|
65306
|
+
const value = variables?.[varName.slice(1)];
|
|
65307
|
+
evaluated += typeof value !== "undefined" ? JSON.stringify(value) : "undefined";
|
|
65308
|
+
varName = "";
|
|
65309
|
+
}
|
|
65310
|
+
if (char === "$" && !inString) {
|
|
65311
|
+
varName = "$";
|
|
65312
|
+
continue;
|
|
65313
|
+
}
|
|
65314
|
+
if (char === '"') {
|
|
65315
|
+
inString = !inString;
|
|
65316
|
+
}
|
|
65317
|
+
evaluated += char;
|
|
65318
|
+
}
|
|
65319
|
+
return evaluated;
|
|
65320
|
+
}
|
|
65321
|
+
var varChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789";
|
|
65322
|
+
var rootID = "_ROOT_";
|
|
65323
|
+
|
|
65295
65324
|
// src/runtime/cache/lists.ts
|
|
65296
65325
|
var ListManager = class {
|
|
65297
65326
|
rootID;
|
|
@@ -65358,11 +65387,15 @@ var ListManager = class {
|
|
|
65358
65387
|
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
65359
65388
|
}
|
|
65360
65389
|
removeIDFromAllLists(id, layer) {
|
|
65390
|
+
let removed = false;
|
|
65361
65391
|
for (const fieldMap of this.lists.values()) {
|
|
65362
65392
|
for (const list of fieldMap.values()) {
|
|
65363
|
-
list.removeID(id, void 0, layer)
|
|
65393
|
+
if (list.removeID(id, void 0, layer)) {
|
|
65394
|
+
removed = true;
|
|
65395
|
+
}
|
|
65364
65396
|
}
|
|
65365
65397
|
}
|
|
65398
|
+
return removed;
|
|
65366
65399
|
}
|
|
65367
65400
|
deleteField(parentID, field) {
|
|
65368
65401
|
if (!this.listsByField.get(parentID)?.has(field)) {
|
|
@@ -65665,7 +65698,13 @@ var ListCollection = class {
|
|
|
65665
65698
|
this.lists.forEach((list) => list.addToList(...args));
|
|
65666
65699
|
}
|
|
65667
65700
|
removeID(...args) {
|
|
65668
|
-
|
|
65701
|
+
let removed = false;
|
|
65702
|
+
this.lists.forEach((list) => {
|
|
65703
|
+
if (list.removeID(...args)) {
|
|
65704
|
+
removed = true;
|
|
65705
|
+
}
|
|
65706
|
+
});
|
|
65707
|
+
return removed;
|
|
65669
65708
|
}
|
|
65670
65709
|
remove(...args) {
|
|
65671
65710
|
this.lists.forEach((list) => list.remove(...args));
|
|
@@ -65784,6 +65823,7 @@ var InMemoryStorage = class {
|
|
|
65784
65823
|
}
|
|
65785
65824
|
registerIDMapping(from, to) {
|
|
65786
65825
|
this.idMaps[from] = to;
|
|
65826
|
+
this.idMaps[to] = from;
|
|
65787
65827
|
}
|
|
65788
65828
|
createLayer(optimistic = false) {
|
|
65789
65829
|
const layer = new Layer(this.idCount++);
|
|
@@ -65794,11 +65834,11 @@ var InMemoryStorage = class {
|
|
|
65794
65834
|
insert(id, field, location, target) {
|
|
65795
65835
|
return this.topLayer.insert(id, field, location, target);
|
|
65796
65836
|
}
|
|
65797
|
-
remove(id, field, target,
|
|
65798
|
-
return
|
|
65837
|
+
remove(id, field, target, layer = this.topLayer) {
|
|
65838
|
+
return layer.remove(id, field, target);
|
|
65799
65839
|
}
|
|
65800
|
-
delete(id,
|
|
65801
|
-
return
|
|
65840
|
+
delete(id, layer = this.topLayer) {
|
|
65841
|
+
return layer.delete(id);
|
|
65802
65842
|
}
|
|
65803
65843
|
deleteField(id, field) {
|
|
65804
65844
|
return this.topLayer.deleteField(id, field);
|
|
@@ -65836,6 +65876,9 @@ var InMemoryStorage = class {
|
|
|
65836
65876
|
return;
|
|
65837
65877
|
}
|
|
65838
65878
|
operations.remove.add(v2);
|
|
65879
|
+
if (this.idMaps[v2]) {
|
|
65880
|
+
operations.remove.add(this.idMaps[v2]);
|
|
65881
|
+
}
|
|
65839
65882
|
});
|
|
65840
65883
|
if (typeof layerValue === "undefined" && defaultValue) {
|
|
65841
65884
|
const targetLayer = this.topLayer;
|
|
@@ -65862,7 +65905,11 @@ var InMemoryStorage = class {
|
|
|
65862
65905
|
operations.remove.add(op.id);
|
|
65863
65906
|
}
|
|
65864
65907
|
if (isInsertOperation(op)) {
|
|
65865
|
-
|
|
65908
|
+
if (op.location === OperationLocation.end) {
|
|
65909
|
+
operations.insert[op.location].unshift(op.id);
|
|
65910
|
+
} else {
|
|
65911
|
+
operations.insert[op.location].push(op.id);
|
|
65912
|
+
}
|
|
65866
65913
|
}
|
|
65867
65914
|
if (isDeleteOperation(op)) {
|
|
65868
65915
|
return {
|
|
@@ -66108,7 +66155,7 @@ var Layer = class {
|
|
|
66108
66155
|
}
|
|
66109
66156
|
for (const [id, ops] of Object.entries(layer.operations)) {
|
|
66110
66157
|
const fields = {};
|
|
66111
|
-
for (const opMap of [
|
|
66158
|
+
for (const opMap of [layer.operations[id], this.operations[id]].filter(Boolean)) {
|
|
66112
66159
|
for (const [fieldName, operations] of Object.entries(opMap.fields || {})) {
|
|
66113
66160
|
fields[fieldName] = [...fields[fieldName] || [], ...operations];
|
|
66114
66161
|
}
|
|
@@ -66148,6 +66195,7 @@ var Layer = class {
|
|
|
66148
66195
|
[id]: {
|
|
66149
66196
|
...this.operations[id],
|
|
66150
66197
|
fields: {
|
|
66198
|
+
...this.operations[id]?.fields,
|
|
66151
66199
|
[field]: [...this.operations[id]?.fields[field] || [], operation]
|
|
66152
66200
|
}
|
|
66153
66201
|
}
|
|
@@ -66173,34 +66221,6 @@ var OperationKind = {
|
|
|
66173
66221
|
remove: "remove"
|
|
66174
66222
|
};
|
|
66175
66223
|
|
|
66176
|
-
// src/runtime/cache/stuff.ts
|
|
66177
|
-
function evaluateKey(key, variables = null) {
|
|
66178
|
-
let evaluated = "";
|
|
66179
|
-
let varName = "";
|
|
66180
|
-
let inString = false;
|
|
66181
|
-
for (const char of key) {
|
|
66182
|
-
if (varName) {
|
|
66183
|
-
if (varChars.includes(char)) {
|
|
66184
|
-
varName += char;
|
|
66185
|
-
continue;
|
|
66186
|
-
}
|
|
66187
|
-
const value = variables?.[varName.slice(1)];
|
|
66188
|
-
evaluated += typeof value !== "undefined" ? JSON.stringify(value) : "undefined";
|
|
66189
|
-
varName = "";
|
|
66190
|
-
}
|
|
66191
|
-
if (char === "$" && !inString) {
|
|
66192
|
-
varName = "$";
|
|
66193
|
-
continue;
|
|
66194
|
-
}
|
|
66195
|
-
if (char === '"') {
|
|
66196
|
-
inString = !inString;
|
|
66197
|
-
}
|
|
66198
|
-
evaluated += char;
|
|
66199
|
-
}
|
|
66200
|
-
return evaluated;
|
|
66201
|
-
}
|
|
66202
|
-
var varChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789";
|
|
66203
|
-
|
|
66204
66224
|
// src/runtime/cache/subscription.ts
|
|
66205
66225
|
var InMemorySubscriptions = class {
|
|
66206
66226
|
cache;
|
|
@@ -66212,6 +66232,9 @@ var InMemorySubscriptions = class {
|
|
|
66212
66232
|
activeFields(parent2) {
|
|
66213
66233
|
return Object.keys(this.subscribers.get(parent2) || {});
|
|
66214
66234
|
}
|
|
66235
|
+
copySubscribers(from, to) {
|
|
66236
|
+
this.subscribers.set(to, this.subscribers.get(from) || /* @__PURE__ */ new Map());
|
|
66237
|
+
}
|
|
66215
66238
|
add({
|
|
66216
66239
|
parent: parent2,
|
|
66217
66240
|
spec,
|
|
@@ -66394,6 +66417,11 @@ var InMemorySubscriptions = class {
|
|
|
66394
66417
|
get(id, field) {
|
|
66395
66418
|
return this.subscribers.get(id)?.get(field)?.selections || [];
|
|
66396
66419
|
}
|
|
66420
|
+
getAll(id) {
|
|
66421
|
+
return [...this.subscribers.get(id)?.values() || []].flatMap(
|
|
66422
|
+
(fieldSub) => fieldSub.selections
|
|
66423
|
+
);
|
|
66424
|
+
}
|
|
66397
66425
|
remove(id, selection, targets, variables, visited = []) {
|
|
66398
66426
|
visited.push(id);
|
|
66399
66427
|
const linkedIDs = [];
|
|
@@ -66435,7 +66463,7 @@ var InMemorySubscriptions = class {
|
|
|
66435
66463
|
}
|
|
66436
66464
|
const subscriberField = subscriber.get(fieldName);
|
|
66437
66465
|
for (const spec of specs) {
|
|
66438
|
-
const counts =
|
|
66466
|
+
const counts = subscriberField?.referenceCounts;
|
|
66439
66467
|
if (!counts?.has(spec.set)) {
|
|
66440
66468
|
continue;
|
|
66441
66469
|
}
|
|
@@ -66458,24 +66486,23 @@ var InMemorySubscriptions = class {
|
|
|
66458
66486
|
this.subscribers.delete(id);
|
|
66459
66487
|
}
|
|
66460
66488
|
}
|
|
66461
|
-
removeAllSubscribers(id, targets
|
|
66462
|
-
|
|
66463
|
-
|
|
66464
|
-
|
|
66465
|
-
|
|
66466
|
-
|
|
66467
|
-
|
|
66468
|
-
|
|
66469
|
-
|
|
66470
|
-
|
|
66471
|
-
|
|
66472
|
-
|
|
66473
|
-
|
|
66474
|
-
|
|
66475
|
-
}
|
|
66476
|
-
this.removeAllSubscribers(id2, subscribers, visited);
|
|
66489
|
+
removeAllSubscribers(id, targets) {
|
|
66490
|
+
if (!targets) {
|
|
66491
|
+
targets = [...this.subscribers.get(id)?.values() || []].flatMap(
|
|
66492
|
+
(spec) => spec.selections.flatMap((sel) => sel[0])
|
|
66493
|
+
);
|
|
66494
|
+
}
|
|
66495
|
+
for (const target of targets) {
|
|
66496
|
+
for (const subselection of this.findSubSelections(
|
|
66497
|
+
target.parentID || rootID,
|
|
66498
|
+
target.selection,
|
|
66499
|
+
target.variables || {},
|
|
66500
|
+
id
|
|
66501
|
+
)) {
|
|
66502
|
+
this.remove(id, subselection, targets, target.variables || {});
|
|
66477
66503
|
}
|
|
66478
66504
|
}
|
|
66505
|
+
return;
|
|
66479
66506
|
}
|
|
66480
66507
|
get size() {
|
|
66481
66508
|
let size = 0;
|
|
@@ -66486,6 +66513,32 @@ var InMemorySubscriptions = class {
|
|
|
66486
66513
|
}
|
|
66487
66514
|
return size;
|
|
66488
66515
|
}
|
|
66516
|
+
findSubSelections(parentID, selection, variables, searchTarget, selections = []) {
|
|
66517
|
+
const __typename = this.cache._internal_unstable.storage.get(parentID, "__typename").value;
|
|
66518
|
+
let targetSelection = getFieldsForType(selection, __typename, false);
|
|
66519
|
+
for (const fieldSelection of Object.values(targetSelection || {})) {
|
|
66520
|
+
if (!fieldSelection.selection) {
|
|
66521
|
+
continue;
|
|
66522
|
+
}
|
|
66523
|
+
const key = evaluateKey(fieldSelection.keyRaw, variables || {});
|
|
66524
|
+
const linkedRecord = this.cache._internal_unstable.storage.get(parentID, key);
|
|
66525
|
+
const links = !Array.isArray(linkedRecord.value) ? [linkedRecord.value] : flatten(linkedRecord.value);
|
|
66526
|
+
if (links.includes(searchTarget)) {
|
|
66527
|
+
selections.push(fieldSelection.selection);
|
|
66528
|
+
} else {
|
|
66529
|
+
for (const link of links) {
|
|
66530
|
+
this.findSubSelections(
|
|
66531
|
+
link,
|
|
66532
|
+
fieldSelection.selection,
|
|
66533
|
+
variables,
|
|
66534
|
+
searchTarget,
|
|
66535
|
+
selections
|
|
66536
|
+
);
|
|
66537
|
+
}
|
|
66538
|
+
}
|
|
66539
|
+
}
|
|
66540
|
+
return selections;
|
|
66541
|
+
}
|
|
66489
66542
|
};
|
|
66490
66543
|
|
|
66491
66544
|
// src/runtime/cache/cache.ts
|
|
@@ -66563,11 +66616,17 @@ var Cache = class {
|
|
|
66563
66616
|
}
|
|
66564
66617
|
registerKeyMap(source, mapped) {
|
|
66565
66618
|
this._internal_unstable.storage.registerIDMapping(source, mapped);
|
|
66619
|
+
this._internal_unstable.subscriptions.copySubscribers(source, mapped);
|
|
66566
66620
|
}
|
|
66567
66621
|
delete(id, layer) {
|
|
66568
|
-
this._internal_unstable.
|
|
66569
|
-
|
|
66570
|
-
|
|
66622
|
+
const recordIDs = [this._internal_unstable.storage.idMaps[id], id].filter(
|
|
66623
|
+
Boolean
|
|
66624
|
+
);
|
|
66625
|
+
for (const recordID of recordIDs) {
|
|
66626
|
+
this._internal_unstable.subscriptions.removeAllSubscribers(recordID);
|
|
66627
|
+
this._internal_unstable.lists.removeIDFromAllLists(recordID, layer);
|
|
66628
|
+
this._internal_unstable.storage.delete(recordID, layer);
|
|
66629
|
+
}
|
|
66571
66630
|
}
|
|
66572
66631
|
setConfig(config) {
|
|
66573
66632
|
this._internal_unstable.setConfig(config);
|
|
@@ -66873,6 +66932,9 @@ var CacheInternal = class {
|
|
|
66873
66932
|
layer,
|
|
66874
66933
|
forceNotify
|
|
66875
66934
|
});
|
|
66935
|
+
let action = () => {
|
|
66936
|
+
layer.writeLink(parent2, key, linkedIDs);
|
|
66937
|
+
};
|
|
66876
66938
|
if (applyUpdates && updates) {
|
|
66877
66939
|
if (key === "edges") {
|
|
66878
66940
|
const newNodeIDs = [];
|
|
@@ -66907,8 +66969,26 @@ var CacheInternal = class {
|
|
|
66907
66969
|
}
|
|
66908
66970
|
if (update === "prepend") {
|
|
66909
66971
|
linkedIDs = newIDs.concat(oldIDs);
|
|
66972
|
+
if (layer?.optimistic) {
|
|
66973
|
+
action = () => {
|
|
66974
|
+
for (const id of newIDs) {
|
|
66975
|
+
if (id) {
|
|
66976
|
+
layer.insert(parent2, key, "start", id);
|
|
66977
|
+
}
|
|
66978
|
+
}
|
|
66979
|
+
};
|
|
66980
|
+
}
|
|
66910
66981
|
} else if (update === "append") {
|
|
66911
66982
|
linkedIDs = oldIDs.concat(newIDs);
|
|
66983
|
+
if (layer?.optimistic) {
|
|
66984
|
+
action = () => {
|
|
66985
|
+
for (const id of newIDs) {
|
|
66986
|
+
if (id) {
|
|
66987
|
+
layer.insert(parent2, key, "end", id);
|
|
66988
|
+
}
|
|
66989
|
+
}
|
|
66990
|
+
};
|
|
66991
|
+
}
|
|
66912
66992
|
} else if (update === "replace") {
|
|
66913
66993
|
linkedIDs = newIDs;
|
|
66914
66994
|
}
|
|
@@ -66927,7 +67007,7 @@ var CacheInternal = class {
|
|
|
66927
67007
|
this.subscriptions.remove(lostID, fieldSelection, specs, variables);
|
|
66928
67008
|
}
|
|
66929
67009
|
if (contentChanged || oldIDs.length === 0 && newIDs.length === 0) {
|
|
66930
|
-
|
|
67010
|
+
action();
|
|
66931
67011
|
}
|
|
66932
67012
|
for (const id of newIDs.filter((id2) => !oldIDs.includes(id2))) {
|
|
66933
67013
|
if (id == null) {
|
|
@@ -66982,6 +67062,9 @@ var CacheInternal = class {
|
|
|
66982
67062
|
if (!targetID) {
|
|
66983
67063
|
continue;
|
|
66984
67064
|
}
|
|
67065
|
+
toNotify.push(
|
|
67066
|
+
...this.subscriptions.getAll(targetID).filter((sub) => sub[0].parentID !== targetID)
|
|
67067
|
+
);
|
|
66985
67068
|
this.cache.delete(targetID, layer);
|
|
66986
67069
|
}
|
|
66987
67070
|
}
|
|
@@ -67403,7 +67486,6 @@ function variableValue(value, args) {
|
|
|
67403
67486
|
);
|
|
67404
67487
|
}
|
|
67405
67488
|
}
|
|
67406
|
-
var rootID = "_ROOT_";
|
|
67407
67489
|
function defaultComponentField({
|
|
67408
67490
|
cache,
|
|
67409
67491
|
component,
|
|
@@ -78330,12 +78412,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
78330
78412
|
}
|
|
78331
78413
|
packageJSON2.devDependencies = {
|
|
78332
78414
|
...packageJSON2.devDependencies,
|
|
78333
|
-
houdini: "^1.2.
|
|
78415
|
+
houdini: "^1.2.56"
|
|
78334
78416
|
};
|
|
78335
78417
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
78336
78418
|
packageJSON2.devDependencies = {
|
|
78337
78419
|
...packageJSON2.devDependencies,
|
|
78338
|
-
"houdini-svelte": "^1.2.
|
|
78420
|
+
"houdini-svelte": "^1.2.56"
|
|
78339
78421
|
};
|
|
78340
78422
|
} else {
|
|
78341
78423
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|