houdini 1.2.37 → 1.2.39
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 +8 -8
- package/build/cmd-esm/index.js +8 -8
- package/build/codegen-cjs/index.js +5 -6
- package/build/codegen-esm/index.js +5 -6
- package/build/lib-cjs/index.js +7 -8
- package/build/lib-esm/index.js +7 -8
- package/build/runtime/client/documentStore.d.ts +2 -2
- package/build/runtime/lib/types.d.ts +1 -0
- package/build/runtime-cjs/cache/cache.js +2 -5
- package/build/runtime-cjs/client/documentStore.d.ts +2 -2
- package/build/runtime-cjs/client/plugins/cache.js +3 -2
- package/build/runtime-cjs/lib/types.d.ts +1 -0
- package/build/runtime-cjs/lib/types.js +2 -1
- package/build/runtime-esm/cache/cache.js +2 -5
- package/build/runtime-esm/client/documentStore.d.ts +2 -2
- package/build/runtime-esm/client/plugins/cache.js +3 -2
- package/build/runtime-esm/lib/types.d.ts +1 -0
- package/build/runtime-esm/lib/types.js +2 -1
- package/build/test-cjs/index.js +5 -6
- package/build/test-esm/index.js +5 -6
- package/build/vite-cjs/index.js +5 -6
- package/build/vite-esm/index.js +5 -6
- package/package.json +1 -1
package/build/cmd-cjs/index.js
CHANGED
|
@@ -63351,7 +63351,8 @@ var CachePolicy = {
|
|
|
63351
63351
|
CacheOrNetwork: "CacheOrNetwork",
|
|
63352
63352
|
CacheOnly: "CacheOnly",
|
|
63353
63353
|
NetworkOnly: "NetworkOnly",
|
|
63354
|
-
CacheAndNetwork: "CacheAndNetwork"
|
|
63354
|
+
CacheAndNetwork: "CacheAndNetwork",
|
|
63355
|
+
NoCache: "NoCache"
|
|
63355
63356
|
};
|
|
63356
63357
|
var PaginateMode = {
|
|
63357
63358
|
Infinite: "Infinite",
|
|
@@ -66826,10 +66827,7 @@ var CacheInternal = class {
|
|
|
66826
66827
|
});
|
|
66827
66828
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
66828
66829
|
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
66829
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
66830
|
-
if (typeof target !== "string") {
|
|
66831
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
66832
|
-
}
|
|
66830
|
+
} else if (operation.action === "delete" && operation.type && target) {
|
|
66833
66831
|
const targetID = this.id(operation.type, target);
|
|
66834
66832
|
if (!targetID) {
|
|
66835
66833
|
continue;
|
|
@@ -67029,7 +67027,7 @@ var CacheInternal = class {
|
|
|
67029
67027
|
};
|
|
67030
67028
|
}
|
|
67031
67029
|
id(type, data) {
|
|
67032
|
-
const id = typeof data === "
|
|
67030
|
+
const id = typeof data === "object" ? this.computeID(type, data) : data;
|
|
67033
67031
|
if (!id) {
|
|
67034
67032
|
return null;
|
|
67035
67033
|
}
|
|
@@ -75456,6 +75454,7 @@ enum CachePolicy {
|
|
|
75456
75454
|
${CachePolicy.CacheOnly}
|
|
75457
75455
|
${CachePolicy.CacheOrNetwork}
|
|
75458
75456
|
${CachePolicy.NetworkOnly}
|
|
75457
|
+
${CachePolicy.NoCache}
|
|
75459
75458
|
}
|
|
75460
75459
|
|
|
75461
75460
|
"""
|
|
@@ -77146,6 +77145,7 @@ async function generate(args = {
|
|
|
77146
77145
|
console.error(error.stack.split("\n").slice(1).join("\n"));
|
|
77147
77146
|
}
|
|
77148
77147
|
});
|
|
77148
|
+
process.exit(1);
|
|
77149
77149
|
}
|
|
77150
77150
|
}
|
|
77151
77151
|
|
|
@@ -78121,12 +78121,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
78121
78121
|
}
|
|
78122
78122
|
packageJSON2.devDependencies = {
|
|
78123
78123
|
...packageJSON2.devDependencies,
|
|
78124
|
-
houdini: "^1.2.
|
|
78124
|
+
houdini: "^1.2.39"
|
|
78125
78125
|
};
|
|
78126
78126
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
78127
78127
|
packageJSON2.devDependencies = {
|
|
78128
78128
|
...packageJSON2.devDependencies,
|
|
78129
|
-
"houdini-svelte": "^1.2.
|
|
78129
|
+
"houdini-svelte": "^1.2.39"
|
|
78130
78130
|
};
|
|
78131
78131
|
} else {
|
|
78132
78132
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|
package/build/cmd-esm/index.js
CHANGED
|
@@ -63357,7 +63357,8 @@ var CachePolicy = {
|
|
|
63357
63357
|
CacheOrNetwork: "CacheOrNetwork",
|
|
63358
63358
|
CacheOnly: "CacheOnly",
|
|
63359
63359
|
NetworkOnly: "NetworkOnly",
|
|
63360
|
-
CacheAndNetwork: "CacheAndNetwork"
|
|
63360
|
+
CacheAndNetwork: "CacheAndNetwork",
|
|
63361
|
+
NoCache: "NoCache"
|
|
63361
63362
|
};
|
|
63362
63363
|
var PaginateMode = {
|
|
63363
63364
|
Infinite: "Infinite",
|
|
@@ -66832,10 +66833,7 @@ var CacheInternal = class {
|
|
|
66832
66833
|
});
|
|
66833
66834
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
66834
66835
|
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
66835
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
66836
|
-
if (typeof target !== "string") {
|
|
66837
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
66838
|
-
}
|
|
66836
|
+
} else if (operation.action === "delete" && operation.type && target) {
|
|
66839
66837
|
const targetID = this.id(operation.type, target);
|
|
66840
66838
|
if (!targetID) {
|
|
66841
66839
|
continue;
|
|
@@ -67035,7 +67033,7 @@ var CacheInternal = class {
|
|
|
67035
67033
|
};
|
|
67036
67034
|
}
|
|
67037
67035
|
id(type, data) {
|
|
67038
|
-
const id = typeof data === "
|
|
67036
|
+
const id = typeof data === "object" ? this.computeID(type, data) : data;
|
|
67039
67037
|
if (!id) {
|
|
67040
67038
|
return null;
|
|
67041
67039
|
}
|
|
@@ -75461,6 +75459,7 @@ enum CachePolicy {
|
|
|
75461
75459
|
${CachePolicy.CacheOnly}
|
|
75462
75460
|
${CachePolicy.CacheOrNetwork}
|
|
75463
75461
|
${CachePolicy.NetworkOnly}
|
|
75462
|
+
${CachePolicy.NoCache}
|
|
75464
75463
|
}
|
|
75465
75464
|
|
|
75466
75465
|
"""
|
|
@@ -77151,6 +77150,7 @@ async function generate(args = {
|
|
|
77151
77150
|
console.error(error.stack.split("\n").slice(1).join("\n"));
|
|
77152
77151
|
}
|
|
77153
77152
|
});
|
|
77153
|
+
process.exit(1);
|
|
77154
77154
|
}
|
|
77155
77155
|
}
|
|
77156
77156
|
|
|
@@ -78126,12 +78126,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
78126
78126
|
}
|
|
78127
78127
|
packageJSON2.devDependencies = {
|
|
78128
78128
|
...packageJSON2.devDependencies,
|
|
78129
|
-
houdini: "^1.2.
|
|
78129
|
+
houdini: "^1.2.39"
|
|
78130
78130
|
};
|
|
78131
78131
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
78132
78132
|
packageJSON2.devDependencies = {
|
|
78133
78133
|
...packageJSON2.devDependencies,
|
|
78134
|
-
"houdini-svelte": "^1.2.
|
|
78134
|
+
"houdini-svelte": "^1.2.39"
|
|
78135
78135
|
};
|
|
78136
78136
|
} else {
|
|
78137
78137
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|
|
@@ -54011,7 +54011,8 @@ var CachePolicy = {
|
|
|
54011
54011
|
CacheOrNetwork: "CacheOrNetwork",
|
|
54012
54012
|
CacheOnly: "CacheOnly",
|
|
54013
54013
|
NetworkOnly: "NetworkOnly",
|
|
54014
|
-
CacheAndNetwork: "CacheAndNetwork"
|
|
54014
|
+
CacheAndNetwork: "CacheAndNetwork",
|
|
54015
|
+
NoCache: "NoCache"
|
|
54015
54016
|
};
|
|
54016
54017
|
var PaginateMode = {
|
|
54017
54018
|
Infinite: "Infinite",
|
|
@@ -56200,10 +56201,7 @@ var CacheInternal = class {
|
|
|
56200
56201
|
});
|
|
56201
56202
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
56202
56203
|
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
56203
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
56204
|
-
if (typeof target !== "string") {
|
|
56205
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
56206
|
-
}
|
|
56204
|
+
} else if (operation.action === "delete" && operation.type && target) {
|
|
56207
56205
|
const targetID = this.id(operation.type, target);
|
|
56208
56206
|
if (!targetID) {
|
|
56209
56207
|
continue;
|
|
@@ -56403,7 +56401,7 @@ var CacheInternal = class {
|
|
|
56403
56401
|
};
|
|
56404
56402
|
}
|
|
56405
56403
|
id(type, data) {
|
|
56406
|
-
const id = typeof data === "
|
|
56404
|
+
const id = typeof data === "object" ? this.computeID(type, data) : data;
|
|
56407
56405
|
if (!id) {
|
|
56408
56406
|
return null;
|
|
56409
56407
|
}
|
|
@@ -63845,6 +63843,7 @@ enum CachePolicy {
|
|
|
63845
63843
|
${CachePolicy.CacheOnly}
|
|
63846
63844
|
${CachePolicy.CacheOrNetwork}
|
|
63847
63845
|
${CachePolicy.NetworkOnly}
|
|
63846
|
+
${CachePolicy.NoCache}
|
|
63848
63847
|
}
|
|
63849
63848
|
|
|
63850
63849
|
"""
|
|
@@ -54011,7 +54011,8 @@ var CachePolicy = {
|
|
|
54011
54011
|
CacheOrNetwork: "CacheOrNetwork",
|
|
54012
54012
|
CacheOnly: "CacheOnly",
|
|
54013
54013
|
NetworkOnly: "NetworkOnly",
|
|
54014
|
-
CacheAndNetwork: "CacheAndNetwork"
|
|
54014
|
+
CacheAndNetwork: "CacheAndNetwork",
|
|
54015
|
+
NoCache: "NoCache"
|
|
54015
54016
|
};
|
|
54016
54017
|
var PaginateMode = {
|
|
54017
54018
|
Infinite: "Infinite",
|
|
@@ -56200,10 +56201,7 @@ var CacheInternal = class {
|
|
|
56200
56201
|
});
|
|
56201
56202
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
56202
56203
|
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
56203
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
56204
|
-
if (typeof target !== "string") {
|
|
56205
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
56206
|
-
}
|
|
56204
|
+
} else if (operation.action === "delete" && operation.type && target) {
|
|
56207
56205
|
const targetID = this.id(operation.type, target);
|
|
56208
56206
|
if (!targetID) {
|
|
56209
56207
|
continue;
|
|
@@ -56403,7 +56401,7 @@ var CacheInternal = class {
|
|
|
56403
56401
|
};
|
|
56404
56402
|
}
|
|
56405
56403
|
id(type, data) {
|
|
56406
|
-
const id = typeof data === "
|
|
56404
|
+
const id = typeof data === "object" ? this.computeID(type, data) : data;
|
|
56407
56405
|
if (!id) {
|
|
56408
56406
|
return null;
|
|
56409
56407
|
}
|
|
@@ -63844,6 +63842,7 @@ enum CachePolicy {
|
|
|
63844
63842
|
${CachePolicy.CacheOnly}
|
|
63845
63843
|
${CachePolicy.CacheOrNetwork}
|
|
63846
63844
|
${CachePolicy.NetworkOnly}
|
|
63845
|
+
${CachePolicy.NoCache}
|
|
63847
63846
|
}
|
|
63848
63847
|
|
|
63849
63848
|
"""
|
package/build/lib-cjs/index.js
CHANGED
|
@@ -61603,7 +61603,8 @@ var CachePolicy = {
|
|
|
61603
61603
|
CacheOrNetwork: "CacheOrNetwork",
|
|
61604
61604
|
CacheOnly: "CacheOnly",
|
|
61605
61605
|
NetworkOnly: "NetworkOnly",
|
|
61606
|
-
CacheAndNetwork: "CacheAndNetwork"
|
|
61606
|
+
CacheAndNetwork: "CacheAndNetwork",
|
|
61607
|
+
NoCache: "NoCache"
|
|
61607
61608
|
};
|
|
61608
61609
|
var PaginateMode = {
|
|
61609
61610
|
Infinite: "Infinite",
|
|
@@ -65292,10 +65293,7 @@ var CacheInternal = class {
|
|
|
65292
65293
|
});
|
|
65293
65294
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
65294
65295
|
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
65295
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
65296
|
-
if (typeof target !== "string") {
|
|
65297
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
65298
|
-
}
|
|
65296
|
+
} else if (operation.action === "delete" && operation.type && target) {
|
|
65299
65297
|
const targetID = this.id(operation.type, target);
|
|
65300
65298
|
if (!targetID) {
|
|
65301
65299
|
continue;
|
|
@@ -65495,7 +65493,7 @@ var CacheInternal = class {
|
|
|
65495
65493
|
};
|
|
65496
65494
|
}
|
|
65497
65495
|
id(type, data) {
|
|
65498
|
-
const id = typeof data === "
|
|
65496
|
+
const id = typeof data === "object" ? this.computeID(type, data) : data;
|
|
65499
65497
|
if (!id) {
|
|
65500
65498
|
return null;
|
|
65501
65499
|
}
|
|
@@ -65759,7 +65757,8 @@ var cachePolicy = ({
|
|
|
65759
65757
|
const { policy, artifact } = ctx;
|
|
65760
65758
|
let useCache = false;
|
|
65761
65759
|
if (enabled && (artifact.kind === ArtifactKind.Query || artifact.kind === ArtifactKind.Fragment) && !ctx.cacheParams?.disableRead) {
|
|
65762
|
-
|
|
65760
|
+
const policyAllowsCache = policy !== CachePolicy.NetworkOnly && policy !== CachePolicy.NoCache;
|
|
65761
|
+
if (policyAllowsCache) {
|
|
65763
65762
|
const value = localCache.read({
|
|
65764
65763
|
selection: artifact.selection,
|
|
65765
65764
|
variables: marshalVariables2(ctx),
|
|
@@ -65813,7 +65812,7 @@ var cachePolicy = ({
|
|
|
65813
65812
|
return next(ctx);
|
|
65814
65813
|
},
|
|
65815
65814
|
afterNetwork(ctx, { resolve: resolve2, value, marshalVariables: marshalVariables2 }) {
|
|
65816
|
-
if (value.source !== DataSource.Cache && enabled && value.data && !ctx.cacheParams?.disableWrite) {
|
|
65815
|
+
if (ctx.policy !== CachePolicy.NoCache && value.source !== DataSource.Cache && enabled && value.data && !ctx.cacheParams?.disableWrite) {
|
|
65817
65816
|
if (ctx.cacheParams && "serverSideFallback" in ctx.cacheParams) {
|
|
65818
65817
|
serverSideFallback = ctx.cacheParams?.serverSideFallback ?? serverSideFallback;
|
|
65819
65818
|
}
|
package/build/lib-esm/index.js
CHANGED
|
@@ -61525,7 +61525,8 @@ var CachePolicy = {
|
|
|
61525
61525
|
CacheOrNetwork: "CacheOrNetwork",
|
|
61526
61526
|
CacheOnly: "CacheOnly",
|
|
61527
61527
|
NetworkOnly: "NetworkOnly",
|
|
61528
|
-
CacheAndNetwork: "CacheAndNetwork"
|
|
61528
|
+
CacheAndNetwork: "CacheAndNetwork",
|
|
61529
|
+
NoCache: "NoCache"
|
|
61529
61530
|
};
|
|
61530
61531
|
var PaginateMode = {
|
|
61531
61532
|
Infinite: "Infinite",
|
|
@@ -65214,10 +65215,7 @@ var CacheInternal = class {
|
|
|
65214
65215
|
});
|
|
65215
65216
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
65216
65217
|
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
65217
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
65218
|
-
if (typeof target !== "string") {
|
|
65219
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
65220
|
-
}
|
|
65218
|
+
} else if (operation.action === "delete" && operation.type && target) {
|
|
65221
65219
|
const targetID = this.id(operation.type, target);
|
|
65222
65220
|
if (!targetID) {
|
|
65223
65221
|
continue;
|
|
@@ -65417,7 +65415,7 @@ var CacheInternal = class {
|
|
|
65417
65415
|
};
|
|
65418
65416
|
}
|
|
65419
65417
|
id(type, data) {
|
|
65420
|
-
const id = typeof data === "
|
|
65418
|
+
const id = typeof data === "object" ? this.computeID(type, data) : data;
|
|
65421
65419
|
if (!id) {
|
|
65422
65420
|
return null;
|
|
65423
65421
|
}
|
|
@@ -65681,7 +65679,8 @@ var cachePolicy = ({
|
|
|
65681
65679
|
const { policy, artifact } = ctx;
|
|
65682
65680
|
let useCache = false;
|
|
65683
65681
|
if (enabled && (artifact.kind === ArtifactKind.Query || artifact.kind === ArtifactKind.Fragment) && !ctx.cacheParams?.disableRead) {
|
|
65684
|
-
|
|
65682
|
+
const policyAllowsCache = policy !== CachePolicy.NetworkOnly && policy !== CachePolicy.NoCache;
|
|
65683
|
+
if (policyAllowsCache) {
|
|
65685
65684
|
const value = localCache.read({
|
|
65686
65685
|
selection: artifact.selection,
|
|
65687
65686
|
variables: marshalVariables2(ctx),
|
|
@@ -65735,7 +65734,7 @@ var cachePolicy = ({
|
|
|
65735
65734
|
return next(ctx);
|
|
65736
65735
|
},
|
|
65737
65736
|
afterNetwork(ctx, { resolve: resolve2, value, marshalVariables: marshalVariables2 }) {
|
|
65738
|
-
if (value.source !== DataSource.Cache && enabled && value.data && !ctx.cacheParams?.disableWrite) {
|
|
65737
|
+
if (ctx.policy !== CachePolicy.NoCache && value.source !== DataSource.Cache && enabled && value.data && !ctx.cacheParams?.disableWrite) {
|
|
65739
65738
|
if (ctx.cacheParams && "serverSideFallback" in ctx.cacheParams) {
|
|
65740
65739
|
serverSideFallback = ctx.cacheParams?.serverSideFallback ?? serverSideFallback;
|
|
65741
65740
|
}
|
|
@@ -81,12 +81,12 @@ export type ClientPluginEnterHandlers = {
|
|
|
81
81
|
/** Returns the marshaled variables for the operation */
|
|
82
82
|
marshalVariables: typeof marshalVariables;
|
|
83
83
|
};
|
|
84
|
-
/** Exit handlers are the same as enter
|
|
84
|
+
/** Exit handlers are the same as enter handlers but don't need to resolve with a specific value */
|
|
85
85
|
export type ClientPluginExitHandlers = Omit<ClientPluginEnterHandlers, 'resolve'> & {
|
|
86
86
|
resolve: (ctx: ClientPluginContext, data?: QueryResult) => void;
|
|
87
87
|
value: QueryResult;
|
|
88
88
|
};
|
|
89
|
-
/** Exit handlers are the same as enter
|
|
89
|
+
/** Exit handlers are the same as enter handlers but don't need to resolve with a specific value */
|
|
90
90
|
export type ClientPluginErrorHandlers = ClientPluginEnterHandlers & {
|
|
91
91
|
error: unknown;
|
|
92
92
|
};
|
|
@@ -4,6 +4,7 @@ export declare const CachePolicy: {
|
|
|
4
4
|
readonly CacheOnly: "CacheOnly";
|
|
5
5
|
readonly NetworkOnly: "NetworkOnly";
|
|
6
6
|
readonly CacheAndNetwork: "CacheAndNetwork";
|
|
7
|
+
readonly NoCache: "NoCache";
|
|
7
8
|
};
|
|
8
9
|
export type CachePolicies = ValuesOf<typeof CachePolicy>;
|
|
9
10
|
export declare const PaginateMode: {
|
|
@@ -520,10 +520,7 @@ class CacheInternal {
|
|
|
520
520
|
});
|
|
521
521
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
522
522
|
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
523
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
524
|
-
if (typeof target !== "string") {
|
|
525
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
526
|
-
}
|
|
523
|
+
} else if (operation.action === "delete" && operation.type && target) {
|
|
527
524
|
const targetID = this.id(operation.type, target);
|
|
528
525
|
if (!targetID) {
|
|
529
526
|
continue;
|
|
@@ -723,7 +720,7 @@ class CacheInternal {
|
|
|
723
720
|
};
|
|
724
721
|
}
|
|
725
722
|
id(type, data) {
|
|
726
|
-
const id = typeof data === "
|
|
723
|
+
const id = typeof data === "object" ? this.computeID(type, data) : data;
|
|
727
724
|
if (!id) {
|
|
728
725
|
return null;
|
|
729
726
|
}
|
|
@@ -81,12 +81,12 @@ export type ClientPluginEnterHandlers = {
|
|
|
81
81
|
/** Returns the marshaled variables for the operation */
|
|
82
82
|
marshalVariables: typeof marshalVariables;
|
|
83
83
|
};
|
|
84
|
-
/** Exit handlers are the same as enter
|
|
84
|
+
/** Exit handlers are the same as enter handlers but don't need to resolve with a specific value */
|
|
85
85
|
export type ClientPluginExitHandlers = Omit<ClientPluginEnterHandlers, 'resolve'> & {
|
|
86
86
|
resolve: (ctx: ClientPluginContext, data?: QueryResult) => void;
|
|
87
87
|
value: QueryResult;
|
|
88
88
|
};
|
|
89
|
-
/** Exit handlers are the same as enter
|
|
89
|
+
/** Exit handlers are the same as enter handlers but don't need to resolve with a specific value */
|
|
90
90
|
export type ClientPluginErrorHandlers = ClientPluginEnterHandlers & {
|
|
91
91
|
error: unknown;
|
|
92
92
|
};
|
|
@@ -42,7 +42,8 @@ const cachePolicy = ({
|
|
|
42
42
|
const { policy, artifact } = ctx;
|
|
43
43
|
let useCache = false;
|
|
44
44
|
if (enabled && (artifact.kind === import_types.ArtifactKind.Query || artifact.kind === import_types.ArtifactKind.Fragment) && !ctx.cacheParams?.disableRead) {
|
|
45
|
-
|
|
45
|
+
const policyAllowsCache = policy !== import_types.CachePolicy.NetworkOnly && policy !== import_types.CachePolicy.NoCache;
|
|
46
|
+
if (policyAllowsCache) {
|
|
46
47
|
const value = localCache.read({
|
|
47
48
|
selection: artifact.selection,
|
|
48
49
|
variables: marshalVariables(ctx),
|
|
@@ -96,7 +97,7 @@ const cachePolicy = ({
|
|
|
96
97
|
return next(ctx);
|
|
97
98
|
},
|
|
98
99
|
afterNetwork(ctx, { resolve, value, marshalVariables }) {
|
|
99
|
-
if (value.source !== import_types.DataSource.Cache && enabled && value.data && !ctx.cacheParams?.disableWrite) {
|
|
100
|
+
if (ctx.policy !== import_types.CachePolicy.NoCache && value.source !== import_types.DataSource.Cache && enabled && value.data && !ctx.cacheParams?.disableWrite) {
|
|
100
101
|
if (ctx.cacheParams && "serverSideFallback" in ctx.cacheParams) {
|
|
101
102
|
serverSideFallback = ctx.cacheParams?.serverSideFallback ?? serverSideFallback;
|
|
102
103
|
}
|
|
@@ -4,6 +4,7 @@ export declare const CachePolicy: {
|
|
|
4
4
|
readonly CacheOnly: "CacheOnly";
|
|
5
5
|
readonly NetworkOnly: "NetworkOnly";
|
|
6
6
|
readonly CacheAndNetwork: "CacheAndNetwork";
|
|
7
|
+
readonly NoCache: "NoCache";
|
|
7
8
|
};
|
|
8
9
|
export type CachePolicies = ValuesOf<typeof CachePolicy>;
|
|
9
10
|
export declare const PaginateMode: {
|
|
@@ -38,7 +38,8 @@ const CachePolicy = {
|
|
|
38
38
|
CacheOrNetwork: "CacheOrNetwork",
|
|
39
39
|
CacheOnly: "CacheOnly",
|
|
40
40
|
NetworkOnly: "NetworkOnly",
|
|
41
|
-
CacheAndNetwork: "CacheAndNetwork"
|
|
41
|
+
CacheAndNetwork: "CacheAndNetwork",
|
|
42
|
+
NoCache: "NoCache"
|
|
42
43
|
};
|
|
43
44
|
const PaginateMode = {
|
|
44
45
|
Infinite: "Infinite",
|
|
@@ -492,10 +492,7 @@ class CacheInternal {
|
|
|
492
492
|
});
|
|
493
493
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
494
494
|
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
495
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
496
|
-
if (typeof target !== "string") {
|
|
497
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
498
|
-
}
|
|
495
|
+
} else if (operation.action === "delete" && operation.type && target) {
|
|
499
496
|
const targetID = this.id(operation.type, target);
|
|
500
497
|
if (!targetID) {
|
|
501
498
|
continue;
|
|
@@ -695,7 +692,7 @@ class CacheInternal {
|
|
|
695
692
|
};
|
|
696
693
|
}
|
|
697
694
|
id(type, data) {
|
|
698
|
-
const id = typeof data === "
|
|
695
|
+
const id = typeof data === "object" ? this.computeID(type, data) : data;
|
|
699
696
|
if (!id) {
|
|
700
697
|
return null;
|
|
701
698
|
}
|
|
@@ -81,12 +81,12 @@ export type ClientPluginEnterHandlers = {
|
|
|
81
81
|
/** Returns the marshaled variables for the operation */
|
|
82
82
|
marshalVariables: typeof marshalVariables;
|
|
83
83
|
};
|
|
84
|
-
/** Exit handlers are the same as enter
|
|
84
|
+
/** Exit handlers are the same as enter handlers but don't need to resolve with a specific value */
|
|
85
85
|
export type ClientPluginExitHandlers = Omit<ClientPluginEnterHandlers, 'resolve'> & {
|
|
86
86
|
resolve: (ctx: ClientPluginContext, data?: QueryResult) => void;
|
|
87
87
|
value: QueryResult;
|
|
88
88
|
};
|
|
89
|
-
/** Exit handlers are the same as enter
|
|
89
|
+
/** Exit handlers are the same as enter handlers but don't need to resolve with a specific value */
|
|
90
90
|
export type ClientPluginErrorHandlers = ClientPluginEnterHandlers & {
|
|
91
91
|
error: unknown;
|
|
92
92
|
};
|
|
@@ -13,7 +13,8 @@ const cachePolicy = ({
|
|
|
13
13
|
const { policy, artifact } = ctx;
|
|
14
14
|
let useCache = false;
|
|
15
15
|
if (enabled && (artifact.kind === ArtifactKind.Query || artifact.kind === ArtifactKind.Fragment) && !ctx.cacheParams?.disableRead) {
|
|
16
|
-
|
|
16
|
+
const policyAllowsCache = policy !== CachePolicy.NetworkOnly && policy !== CachePolicy.NoCache;
|
|
17
|
+
if (policyAllowsCache) {
|
|
17
18
|
const value = localCache.read({
|
|
18
19
|
selection: artifact.selection,
|
|
19
20
|
variables: marshalVariables(ctx),
|
|
@@ -67,7 +68,7 @@ const cachePolicy = ({
|
|
|
67
68
|
return next(ctx);
|
|
68
69
|
},
|
|
69
70
|
afterNetwork(ctx, { resolve, value, marshalVariables }) {
|
|
70
|
-
if (value.source !== DataSource.Cache && enabled && value.data && !ctx.cacheParams?.disableWrite) {
|
|
71
|
+
if (ctx.policy !== CachePolicy.NoCache && value.source !== DataSource.Cache && enabled && value.data && !ctx.cacheParams?.disableWrite) {
|
|
71
72
|
if (ctx.cacheParams && "serverSideFallback" in ctx.cacheParams) {
|
|
72
73
|
serverSideFallback = ctx.cacheParams?.serverSideFallback ?? serverSideFallback;
|
|
73
74
|
}
|
|
@@ -4,6 +4,7 @@ export declare const CachePolicy: {
|
|
|
4
4
|
readonly CacheOnly: "CacheOnly";
|
|
5
5
|
readonly NetworkOnly: "NetworkOnly";
|
|
6
6
|
readonly CacheAndNetwork: "CacheAndNetwork";
|
|
7
|
+
readonly NoCache: "NoCache";
|
|
7
8
|
};
|
|
8
9
|
export type CachePolicies = ValuesOf<typeof CachePolicy>;
|
|
9
10
|
export declare const PaginateMode: {
|
package/build/test-cjs/index.js
CHANGED
|
@@ -54021,7 +54021,8 @@ var CachePolicy = {
|
|
|
54021
54021
|
CacheOrNetwork: "CacheOrNetwork",
|
|
54022
54022
|
CacheOnly: "CacheOnly",
|
|
54023
54023
|
NetworkOnly: "NetworkOnly",
|
|
54024
|
-
CacheAndNetwork: "CacheAndNetwork"
|
|
54024
|
+
CacheAndNetwork: "CacheAndNetwork",
|
|
54025
|
+
NoCache: "NoCache"
|
|
54025
54026
|
};
|
|
54026
54027
|
var PaginateMode = {
|
|
54027
54028
|
Infinite: "Infinite",
|
|
@@ -56210,10 +56211,7 @@ var CacheInternal = class {
|
|
|
56210
56211
|
});
|
|
56211
56212
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
56212
56213
|
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
56213
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
56214
|
-
if (typeof target !== "string") {
|
|
56215
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
56216
|
-
}
|
|
56214
|
+
} else if (operation.action === "delete" && operation.type && target) {
|
|
56217
56215
|
const targetID = this.id(operation.type, target);
|
|
56218
56216
|
if (!targetID) {
|
|
56219
56217
|
continue;
|
|
@@ -56413,7 +56411,7 @@ var CacheInternal = class {
|
|
|
56413
56411
|
};
|
|
56414
56412
|
}
|
|
56415
56413
|
id(type, data) {
|
|
56416
|
-
const id = typeof data === "
|
|
56414
|
+
const id = typeof data === "object" ? this.computeID(type, data) : data;
|
|
56417
56415
|
if (!id) {
|
|
56418
56416
|
return null;
|
|
56419
56417
|
}
|
|
@@ -64199,6 +64197,7 @@ enum CachePolicy {
|
|
|
64199
64197
|
${CachePolicy.CacheOnly}
|
|
64200
64198
|
${CachePolicy.CacheOrNetwork}
|
|
64201
64199
|
${CachePolicy.NetworkOnly}
|
|
64200
|
+
${CachePolicy.NoCache}
|
|
64202
64201
|
}
|
|
64203
64202
|
|
|
64204
64203
|
"""
|
package/build/test-esm/index.js
CHANGED
|
@@ -54018,7 +54018,8 @@ var CachePolicy = {
|
|
|
54018
54018
|
CacheOrNetwork: "CacheOrNetwork",
|
|
54019
54019
|
CacheOnly: "CacheOnly",
|
|
54020
54020
|
NetworkOnly: "NetworkOnly",
|
|
54021
|
-
CacheAndNetwork: "CacheAndNetwork"
|
|
54021
|
+
CacheAndNetwork: "CacheAndNetwork",
|
|
54022
|
+
NoCache: "NoCache"
|
|
54022
54023
|
};
|
|
54023
54024
|
var PaginateMode = {
|
|
54024
54025
|
Infinite: "Infinite",
|
|
@@ -56207,10 +56208,7 @@ var CacheInternal = class {
|
|
|
56207
56208
|
});
|
|
56208
56209
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
56209
56210
|
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
56210
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
56211
|
-
if (typeof target !== "string") {
|
|
56212
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
56213
|
-
}
|
|
56211
|
+
} else if (operation.action === "delete" && operation.type && target) {
|
|
56214
56212
|
const targetID = this.id(operation.type, target);
|
|
56215
56213
|
if (!targetID) {
|
|
56216
56214
|
continue;
|
|
@@ -56410,7 +56408,7 @@ var CacheInternal = class {
|
|
|
56410
56408
|
};
|
|
56411
56409
|
}
|
|
56412
56410
|
id(type, data) {
|
|
56413
|
-
const id = typeof data === "
|
|
56411
|
+
const id = typeof data === "object" ? this.computeID(type, data) : data;
|
|
56414
56412
|
if (!id) {
|
|
56415
56413
|
return null;
|
|
56416
56414
|
}
|
|
@@ -64195,6 +64193,7 @@ enum CachePolicy {
|
|
|
64195
64193
|
${CachePolicy.CacheOnly}
|
|
64196
64194
|
${CachePolicy.CacheOrNetwork}
|
|
64197
64195
|
${CachePolicy.NetworkOnly}
|
|
64196
|
+
${CachePolicy.NoCache}
|
|
64198
64197
|
}
|
|
64199
64198
|
|
|
64200
64199
|
"""
|
package/build/vite-cjs/index.js
CHANGED
|
@@ -64628,7 +64628,8 @@ var CachePolicy = {
|
|
|
64628
64628
|
CacheOrNetwork: "CacheOrNetwork",
|
|
64629
64629
|
CacheOnly: "CacheOnly",
|
|
64630
64630
|
NetworkOnly: "NetworkOnly",
|
|
64631
|
-
CacheAndNetwork: "CacheAndNetwork"
|
|
64631
|
+
CacheAndNetwork: "CacheAndNetwork",
|
|
64632
|
+
NoCache: "NoCache"
|
|
64632
64633
|
};
|
|
64633
64634
|
var PaginateMode = {
|
|
64634
64635
|
Infinite: "Infinite",
|
|
@@ -67966,10 +67967,7 @@ var CacheInternal = class {
|
|
|
67966
67967
|
});
|
|
67967
67968
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
67968
67969
|
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
67969
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
67970
|
-
if (typeof target !== "string") {
|
|
67971
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
67972
|
-
}
|
|
67970
|
+
} else if (operation.action === "delete" && operation.type && target) {
|
|
67973
67971
|
const targetID = this.id(operation.type, target);
|
|
67974
67972
|
if (!targetID) {
|
|
67975
67973
|
continue;
|
|
@@ -68169,7 +68167,7 @@ var CacheInternal = class {
|
|
|
68169
68167
|
};
|
|
68170
68168
|
}
|
|
68171
68169
|
id(type, data) {
|
|
68172
|
-
const id = typeof data === "
|
|
68170
|
+
const id = typeof data === "object" ? this.computeID(type, data) : data;
|
|
68173
68171
|
if (!id) {
|
|
68174
68172
|
return null;
|
|
68175
68173
|
}
|
|
@@ -76890,6 +76888,7 @@ enum CachePolicy {
|
|
|
76890
76888
|
${CachePolicy.CacheOnly}
|
|
76891
76889
|
${CachePolicy.CacheOrNetwork}
|
|
76892
76890
|
${CachePolicy.NetworkOnly}
|
|
76891
|
+
${CachePolicy.NoCache}
|
|
76893
76892
|
}
|
|
76894
76893
|
|
|
76895
76894
|
"""
|
package/build/vite-esm/index.js
CHANGED
|
@@ -64622,7 +64622,8 @@ var CachePolicy = {
|
|
|
64622
64622
|
CacheOrNetwork: "CacheOrNetwork",
|
|
64623
64623
|
CacheOnly: "CacheOnly",
|
|
64624
64624
|
NetworkOnly: "NetworkOnly",
|
|
64625
|
-
CacheAndNetwork: "CacheAndNetwork"
|
|
64625
|
+
CacheAndNetwork: "CacheAndNetwork",
|
|
64626
|
+
NoCache: "NoCache"
|
|
64626
64627
|
};
|
|
64627
64628
|
var PaginateMode = {
|
|
64628
64629
|
Infinite: "Infinite",
|
|
@@ -67960,10 +67961,7 @@ var CacheInternal = class {
|
|
|
67960
67961
|
});
|
|
67961
67962
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
67962
67963
|
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
67963
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
67964
|
-
if (typeof target !== "string") {
|
|
67965
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
67966
|
-
}
|
|
67964
|
+
} else if (operation.action === "delete" && operation.type && target) {
|
|
67967
67965
|
const targetID = this.id(operation.type, target);
|
|
67968
67966
|
if (!targetID) {
|
|
67969
67967
|
continue;
|
|
@@ -68163,7 +68161,7 @@ var CacheInternal = class {
|
|
|
68163
68161
|
};
|
|
68164
68162
|
}
|
|
68165
68163
|
id(type, data) {
|
|
68166
|
-
const id = typeof data === "
|
|
68164
|
+
const id = typeof data === "object" ? this.computeID(type, data) : data;
|
|
68167
68165
|
if (!id) {
|
|
68168
68166
|
return null;
|
|
68169
68167
|
}
|
|
@@ -76883,6 +76881,7 @@ enum CachePolicy {
|
|
|
76883
76881
|
${CachePolicy.CacheOnly}
|
|
76884
76882
|
${CachePolicy.CacheOrNetwork}
|
|
76885
76883
|
${CachePolicy.NetworkOnly}
|
|
76884
|
+
${CachePolicy.NoCache}
|
|
76886
76885
|
}
|
|
76887
76886
|
|
|
76888
76887
|
"""
|