houdini-svelte 2.2.0-next.2 → 2.2.0-next.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-cjs/index.js +74 -62
- package/build/plugin-esm/index.js +74 -62
- package/build/preprocess-cjs/index.js +72 -58
- package/build/preprocess-esm/index.js +72 -58
- package/build/runtime/types.d.ts +1 -1
- package/build/runtime-cjs/types.d.ts +1 -1
- package/build/runtime-esm/types.d.ts +1 -1
- package/build/test-cjs/index.js +146 -120
- package/build/test-esm/index.js +146 -120
- package/package.json +2 -2
|
@@ -90494,20 +90494,21 @@ var CacheInternal = class {
|
|
|
90494
90494
|
} else if (Array.isArray(value) && // make typescript happy
|
|
90495
90495
|
(typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
90496
90496
|
let oldIDs = [...previousValue || []];
|
|
90497
|
-
|
|
90498
|
-
|
|
90499
|
-
|
|
90500
|
-
|
|
90501
|
-
|
|
90502
|
-
|
|
90503
|
-
|
|
90504
|
-
|
|
90505
|
-
|
|
90506
|
-
|
|
90507
|
-
|
|
90508
|
-
|
|
90509
|
-
|
|
90510
|
-
|
|
90497
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
90498
|
+
oldIDs = oldIDs.filter((id) => {
|
|
90499
|
+
for (const layer2 of this.storage.data) {
|
|
90500
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
90501
|
+
if (operation.fields?.[key])
|
|
90502
|
+
for (const listOperation of operation.fields[key]) {
|
|
90503
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
90504
|
+
return false;
|
|
90505
|
+
}
|
|
90506
|
+
}
|
|
90507
|
+
}
|
|
90508
|
+
}
|
|
90509
|
+
return true;
|
|
90510
|
+
});
|
|
90511
|
+
}
|
|
90511
90512
|
let linkedIDs = [];
|
|
90512
90513
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
90513
90514
|
value,
|
|
@@ -90526,39 +90527,45 @@ var CacheInternal = class {
|
|
|
90526
90527
|
layer.writeLink(parent2, key, linkedIDs);
|
|
90527
90528
|
};
|
|
90528
90529
|
if (applyUpdates && updates) {
|
|
90529
|
-
|
|
90530
|
-
const
|
|
90531
|
-
for (const id of
|
|
90530
|
+
const filterIDs = (keep, insert) => {
|
|
90531
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
90532
|
+
for (const id of keep) {
|
|
90532
90533
|
if (!id) {
|
|
90533
90534
|
continue;
|
|
90534
90535
|
}
|
|
90535
90536
|
const { value: node } = this.storage.get(id, "node");
|
|
90536
|
-
if (
|
|
90537
|
+
if (!node) {
|
|
90537
90538
|
continue;
|
|
90538
90539
|
}
|
|
90539
|
-
|
|
90540
|
+
const nodeID = this.storage.get(node, "id");
|
|
90541
|
+
if (!nodeID) {
|
|
90540
90542
|
continue;
|
|
90541
90543
|
}
|
|
90542
|
-
|
|
90544
|
+
existingIDs.add(nodeID.value);
|
|
90543
90545
|
}
|
|
90544
|
-
|
|
90546
|
+
return insert.filter((id) => {
|
|
90545
90547
|
if (!id) {
|
|
90546
90548
|
return true;
|
|
90547
90549
|
}
|
|
90548
|
-
const { value:
|
|
90549
|
-
|
|
90550
|
-
|
|
90551
|
-
return false;
|
|
90550
|
+
const { value: node } = this.storage.get(id, "node");
|
|
90551
|
+
if (!node) {
|
|
90552
|
+
return true;
|
|
90552
90553
|
}
|
|
90553
|
-
|
|
90554
|
+
const nodeID = this.storage.get(node, "id");
|
|
90555
|
+
if (!nodeID) {
|
|
90556
|
+
return true;
|
|
90557
|
+
}
|
|
90558
|
+
return !existingIDs.has(nodeID.value);
|
|
90554
90559
|
});
|
|
90555
|
-
}
|
|
90560
|
+
};
|
|
90556
90561
|
for (const update of applyUpdates) {
|
|
90557
90562
|
if (update !== "replace" && !updates.includes(update)) {
|
|
90558
90563
|
continue;
|
|
90559
90564
|
}
|
|
90560
90565
|
if (update === "prepend") {
|
|
90561
|
-
linkedIDs = newIDs.concat(
|
|
90566
|
+
linkedIDs = newIDs.concat(
|
|
90567
|
+
filterIDs(newIDs, oldIDs)
|
|
90568
|
+
);
|
|
90562
90569
|
if (layer?.optimistic) {
|
|
90563
90570
|
action = () => {
|
|
90564
90571
|
for (const id of newIDs) {
|
|
@@ -90569,7 +90576,7 @@ var CacheInternal = class {
|
|
|
90569
90576
|
};
|
|
90570
90577
|
}
|
|
90571
90578
|
} else if (update === "append") {
|
|
90572
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
90579
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
90573
90580
|
if (layer?.optimistic) {
|
|
90574
90581
|
action = () => {
|
|
90575
90582
|
for (const id of newIDs) {
|
|
@@ -163269,20 +163276,21 @@ var CacheInternal2 = class {
|
|
|
163269
163276
|
} else if (Array.isArray(value) && // make typescript happy
|
|
163270
163277
|
(typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
163271
163278
|
let oldIDs = [...previousValue || []];
|
|
163272
|
-
|
|
163273
|
-
|
|
163274
|
-
|
|
163275
|
-
|
|
163276
|
-
|
|
163277
|
-
|
|
163278
|
-
|
|
163279
|
-
|
|
163280
|
-
|
|
163281
|
-
|
|
163282
|
-
|
|
163283
|
-
|
|
163284
|
-
|
|
163285
|
-
|
|
163279
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
163280
|
+
oldIDs = oldIDs.filter((id) => {
|
|
163281
|
+
for (const layer2 of this.storage.data) {
|
|
163282
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
163283
|
+
if (operation.fields?.[key])
|
|
163284
|
+
for (const listOperation of operation.fields[key]) {
|
|
163285
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
163286
|
+
return false;
|
|
163287
|
+
}
|
|
163288
|
+
}
|
|
163289
|
+
}
|
|
163290
|
+
}
|
|
163291
|
+
return true;
|
|
163292
|
+
});
|
|
163293
|
+
}
|
|
163286
163294
|
let linkedIDs = [];
|
|
163287
163295
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
163288
163296
|
value,
|
|
@@ -163301,39 +163309,45 @@ var CacheInternal2 = class {
|
|
|
163301
163309
|
layer.writeLink(parent2, key, linkedIDs);
|
|
163302
163310
|
};
|
|
163303
163311
|
if (applyUpdates && updates) {
|
|
163304
|
-
|
|
163305
|
-
const
|
|
163306
|
-
for (const id of
|
|
163312
|
+
const filterIDs = (keep, insert) => {
|
|
163313
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
163314
|
+
for (const id of keep) {
|
|
163307
163315
|
if (!id) {
|
|
163308
163316
|
continue;
|
|
163309
163317
|
}
|
|
163310
163318
|
const { value: node } = this.storage.get(id, "node");
|
|
163311
|
-
if (
|
|
163319
|
+
if (!node) {
|
|
163312
163320
|
continue;
|
|
163313
163321
|
}
|
|
163314
|
-
|
|
163322
|
+
const nodeID = this.storage.get(node, "id");
|
|
163323
|
+
if (!nodeID) {
|
|
163315
163324
|
continue;
|
|
163316
163325
|
}
|
|
163317
|
-
|
|
163326
|
+
existingIDs.add(nodeID.value);
|
|
163318
163327
|
}
|
|
163319
|
-
|
|
163328
|
+
return insert.filter((id) => {
|
|
163320
163329
|
if (!id) {
|
|
163321
163330
|
return true;
|
|
163322
163331
|
}
|
|
163323
|
-
const { value:
|
|
163324
|
-
|
|
163325
|
-
|
|
163326
|
-
return false;
|
|
163332
|
+
const { value: node } = this.storage.get(id, "node");
|
|
163333
|
+
if (!node) {
|
|
163334
|
+
return true;
|
|
163327
163335
|
}
|
|
163328
|
-
|
|
163336
|
+
const nodeID = this.storage.get(node, "id");
|
|
163337
|
+
if (!nodeID) {
|
|
163338
|
+
return true;
|
|
163339
|
+
}
|
|
163340
|
+
return !existingIDs.has(nodeID.value);
|
|
163329
163341
|
});
|
|
163330
|
-
}
|
|
163342
|
+
};
|
|
163331
163343
|
for (const update of applyUpdates) {
|
|
163332
163344
|
if (update !== "replace" && !updates.includes(update)) {
|
|
163333
163345
|
continue;
|
|
163334
163346
|
}
|
|
163335
163347
|
if (update === "prepend") {
|
|
163336
|
-
linkedIDs = newIDs.concat(
|
|
163348
|
+
linkedIDs = newIDs.concat(
|
|
163349
|
+
filterIDs(newIDs, oldIDs)
|
|
163350
|
+
);
|
|
163337
163351
|
if (layer?.optimistic) {
|
|
163338
163352
|
action = () => {
|
|
163339
163353
|
for (const id of newIDs) {
|
|
@@ -163344,7 +163358,7 @@ var CacheInternal2 = class {
|
|
|
163344
163358
|
};
|
|
163345
163359
|
}
|
|
163346
163360
|
} else if (update === "append") {
|
|
163347
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
163361
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
163348
163362
|
if (layer?.optimistic) {
|
|
163349
163363
|
action = () => {
|
|
163350
163364
|
for (const id of newIDs) {
|
|
@@ -90491,20 +90491,21 @@ var CacheInternal = class {
|
|
|
90491
90491
|
} else if (Array.isArray(value) && // make typescript happy
|
|
90492
90492
|
(typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
90493
90493
|
let oldIDs = [...previousValue || []];
|
|
90494
|
-
|
|
90495
|
-
|
|
90496
|
-
|
|
90497
|
-
|
|
90498
|
-
|
|
90499
|
-
|
|
90500
|
-
|
|
90501
|
-
|
|
90502
|
-
|
|
90503
|
-
|
|
90504
|
-
|
|
90505
|
-
|
|
90506
|
-
|
|
90507
|
-
|
|
90494
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
90495
|
+
oldIDs = oldIDs.filter((id) => {
|
|
90496
|
+
for (const layer2 of this.storage.data) {
|
|
90497
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
90498
|
+
if (operation.fields?.[key])
|
|
90499
|
+
for (const listOperation of operation.fields[key]) {
|
|
90500
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
90501
|
+
return false;
|
|
90502
|
+
}
|
|
90503
|
+
}
|
|
90504
|
+
}
|
|
90505
|
+
}
|
|
90506
|
+
return true;
|
|
90507
|
+
});
|
|
90508
|
+
}
|
|
90508
90509
|
let linkedIDs = [];
|
|
90509
90510
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
90510
90511
|
value,
|
|
@@ -90523,39 +90524,45 @@ var CacheInternal = class {
|
|
|
90523
90524
|
layer.writeLink(parent2, key, linkedIDs);
|
|
90524
90525
|
};
|
|
90525
90526
|
if (applyUpdates && updates) {
|
|
90526
|
-
|
|
90527
|
-
const
|
|
90528
|
-
for (const id of
|
|
90527
|
+
const filterIDs = (keep, insert) => {
|
|
90528
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
90529
|
+
for (const id of keep) {
|
|
90529
90530
|
if (!id) {
|
|
90530
90531
|
continue;
|
|
90531
90532
|
}
|
|
90532
90533
|
const { value: node } = this.storage.get(id, "node");
|
|
90533
|
-
if (
|
|
90534
|
+
if (!node) {
|
|
90534
90535
|
continue;
|
|
90535
90536
|
}
|
|
90536
|
-
|
|
90537
|
+
const nodeID = this.storage.get(node, "id");
|
|
90538
|
+
if (!nodeID) {
|
|
90537
90539
|
continue;
|
|
90538
90540
|
}
|
|
90539
|
-
|
|
90541
|
+
existingIDs.add(nodeID.value);
|
|
90540
90542
|
}
|
|
90541
|
-
|
|
90543
|
+
return insert.filter((id) => {
|
|
90542
90544
|
if (!id) {
|
|
90543
90545
|
return true;
|
|
90544
90546
|
}
|
|
90545
|
-
const { value:
|
|
90546
|
-
|
|
90547
|
-
|
|
90548
|
-
return false;
|
|
90547
|
+
const { value: node } = this.storage.get(id, "node");
|
|
90548
|
+
if (!node) {
|
|
90549
|
+
return true;
|
|
90549
90550
|
}
|
|
90550
|
-
|
|
90551
|
+
const nodeID = this.storage.get(node, "id");
|
|
90552
|
+
if (!nodeID) {
|
|
90553
|
+
return true;
|
|
90554
|
+
}
|
|
90555
|
+
return !existingIDs.has(nodeID.value);
|
|
90551
90556
|
});
|
|
90552
|
-
}
|
|
90557
|
+
};
|
|
90553
90558
|
for (const update of applyUpdates) {
|
|
90554
90559
|
if (update !== "replace" && !updates.includes(update)) {
|
|
90555
90560
|
continue;
|
|
90556
90561
|
}
|
|
90557
90562
|
if (update === "prepend") {
|
|
90558
|
-
linkedIDs = newIDs.concat(
|
|
90563
|
+
linkedIDs = newIDs.concat(
|
|
90564
|
+
filterIDs(newIDs, oldIDs)
|
|
90565
|
+
);
|
|
90559
90566
|
if (layer?.optimistic) {
|
|
90560
90567
|
action = () => {
|
|
90561
90568
|
for (const id of newIDs) {
|
|
@@ -90566,7 +90573,7 @@ var CacheInternal = class {
|
|
|
90566
90573
|
};
|
|
90567
90574
|
}
|
|
90568
90575
|
} else if (update === "append") {
|
|
90569
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
90576
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
90570
90577
|
if (layer?.optimistic) {
|
|
90571
90578
|
action = () => {
|
|
90572
90579
|
for (const id of newIDs) {
|
|
@@ -163265,20 +163272,21 @@ var CacheInternal2 = class {
|
|
|
163265
163272
|
} else if (Array.isArray(value) && // make typescript happy
|
|
163266
163273
|
(typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
163267
163274
|
let oldIDs = [...previousValue || []];
|
|
163268
|
-
|
|
163269
|
-
|
|
163270
|
-
|
|
163271
|
-
|
|
163272
|
-
|
|
163273
|
-
|
|
163274
|
-
|
|
163275
|
-
|
|
163276
|
-
|
|
163277
|
-
|
|
163278
|
-
|
|
163279
|
-
|
|
163280
|
-
|
|
163281
|
-
|
|
163275
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
163276
|
+
oldIDs = oldIDs.filter((id) => {
|
|
163277
|
+
for (const layer2 of this.storage.data) {
|
|
163278
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
163279
|
+
if (operation.fields?.[key])
|
|
163280
|
+
for (const listOperation of operation.fields[key]) {
|
|
163281
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
163282
|
+
return false;
|
|
163283
|
+
}
|
|
163284
|
+
}
|
|
163285
|
+
}
|
|
163286
|
+
}
|
|
163287
|
+
return true;
|
|
163288
|
+
});
|
|
163289
|
+
}
|
|
163282
163290
|
let linkedIDs = [];
|
|
163283
163291
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
163284
163292
|
value,
|
|
@@ -163297,39 +163305,45 @@ var CacheInternal2 = class {
|
|
|
163297
163305
|
layer.writeLink(parent2, key, linkedIDs);
|
|
163298
163306
|
};
|
|
163299
163307
|
if (applyUpdates && updates) {
|
|
163300
|
-
|
|
163301
|
-
const
|
|
163302
|
-
for (const id of
|
|
163308
|
+
const filterIDs = (keep, insert) => {
|
|
163309
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
163310
|
+
for (const id of keep) {
|
|
163303
163311
|
if (!id) {
|
|
163304
163312
|
continue;
|
|
163305
163313
|
}
|
|
163306
163314
|
const { value: node } = this.storage.get(id, "node");
|
|
163307
|
-
if (
|
|
163315
|
+
if (!node) {
|
|
163308
163316
|
continue;
|
|
163309
163317
|
}
|
|
163310
|
-
|
|
163318
|
+
const nodeID = this.storage.get(node, "id");
|
|
163319
|
+
if (!nodeID) {
|
|
163311
163320
|
continue;
|
|
163312
163321
|
}
|
|
163313
|
-
|
|
163322
|
+
existingIDs.add(nodeID.value);
|
|
163314
163323
|
}
|
|
163315
|
-
|
|
163324
|
+
return insert.filter((id) => {
|
|
163316
163325
|
if (!id) {
|
|
163317
163326
|
return true;
|
|
163318
163327
|
}
|
|
163319
|
-
const { value:
|
|
163320
|
-
|
|
163321
|
-
|
|
163322
|
-
return false;
|
|
163328
|
+
const { value: node } = this.storage.get(id, "node");
|
|
163329
|
+
if (!node) {
|
|
163330
|
+
return true;
|
|
163323
163331
|
}
|
|
163324
|
-
|
|
163332
|
+
const nodeID = this.storage.get(node, "id");
|
|
163333
|
+
if (!nodeID) {
|
|
163334
|
+
return true;
|
|
163335
|
+
}
|
|
163336
|
+
return !existingIDs.has(nodeID.value);
|
|
163325
163337
|
});
|
|
163326
|
-
}
|
|
163338
|
+
};
|
|
163327
163339
|
for (const update of applyUpdates) {
|
|
163328
163340
|
if (update !== "replace" && !updates.includes(update)) {
|
|
163329
163341
|
continue;
|
|
163330
163342
|
}
|
|
163331
163343
|
if (update === "prepend") {
|
|
163332
|
-
linkedIDs = newIDs.concat(
|
|
163344
|
+
linkedIDs = newIDs.concat(
|
|
163345
|
+
filterIDs(newIDs, oldIDs)
|
|
163346
|
+
);
|
|
163333
163347
|
if (layer?.optimistic) {
|
|
163334
163348
|
action = () => {
|
|
163335
163349
|
for (const id of newIDs) {
|
|
@@ -163340,7 +163354,7 @@ var CacheInternal2 = class {
|
|
|
163340
163354
|
};
|
|
163341
163355
|
}
|
|
163342
163356
|
} else if (update === "append") {
|
|
163343
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
163357
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
163344
163358
|
if (layer?.optimistic) {
|
|
163345
163359
|
action = () => {
|
|
163346
163360
|
for (const id of newIDs) {
|
package/build/runtime/types.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type QueryInputs<_Data> = FetchQueryResult<_Data> & {
|
|
|
7
7
|
[key: string]: any;
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
export type VariableFunction<
|
|
10
|
+
export type VariableFunction<_Event extends LoadEvent, _Input> = (event: _Event) => _Input | Promise<_Input>;
|
|
11
11
|
export type AfterLoadFunction<_Params extends Record<string, string>, _Data, _Input, _ReturnType extends Record<string, any>> = (args: {
|
|
12
12
|
event: LoadEvent<_Params>;
|
|
13
13
|
data: _Data;
|
|
@@ -7,7 +7,7 @@ export type QueryInputs<_Data> = FetchQueryResult<_Data> & {
|
|
|
7
7
|
[key: string]: any;
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
export type VariableFunction<
|
|
10
|
+
export type VariableFunction<_Event extends LoadEvent, _Input> = (event: _Event) => _Input | Promise<_Input>;
|
|
11
11
|
export type AfterLoadFunction<_Params extends Record<string, string>, _Data, _Input, _ReturnType extends Record<string, any>> = (args: {
|
|
12
12
|
event: LoadEvent<_Params>;
|
|
13
13
|
data: _Data;
|
|
@@ -7,7 +7,7 @@ export type QueryInputs<_Data> = FetchQueryResult<_Data> & {
|
|
|
7
7
|
[key: string]: any;
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
export type VariableFunction<
|
|
10
|
+
export type VariableFunction<_Event extends LoadEvent, _Input> = (event: _Event) => _Input | Promise<_Input>;
|
|
11
11
|
export type AfterLoadFunction<_Params extends Record<string, string>, _Data, _Input, _ReturnType extends Record<string, any>> = (args: {
|
|
12
12
|
event: LoadEvent<_Params>;
|
|
13
13
|
data: _Data;
|