@spoosh/plugin-invalidation 0.7.0 → 0.8.0
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/dist/index.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +5 -3
- package/dist/index.mjs +5 -3
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -32,6 +32,11 @@ type InvalidationReadOptions = object;
|
|
|
32
32
|
type InvalidationInfiniteReadOptions = object;
|
|
33
33
|
type InvalidationReadResult = object;
|
|
34
34
|
type InvalidationWriteResult = object;
|
|
35
|
+
interface InvalidationQueueTriggerOptions<TSchema = unknown> {
|
|
36
|
+
/** Unified invalidation configuration */
|
|
37
|
+
invalidate?: InvalidateOption<TSchema>;
|
|
38
|
+
}
|
|
39
|
+
type InvalidationQueueResult = object;
|
|
35
40
|
/**
|
|
36
41
|
* Manual invalidation - tags only, or "*" for global refetch
|
|
37
42
|
*/
|
|
@@ -105,10 +110,12 @@ declare function invalidationPlugin(config?: InvalidationPluginConfig): SpooshPl
|
|
|
105
110
|
readOptions: InvalidationReadOptions;
|
|
106
111
|
writeOptions: InvalidationWriteOptions;
|
|
107
112
|
writeTriggerOptions: InvalidationWriteTriggerOptions;
|
|
113
|
+
queueTriggerOptions: InvalidationQueueTriggerOptions;
|
|
108
114
|
infiniteReadOptions: InvalidationInfiniteReadOptions;
|
|
109
115
|
readResult: InvalidationReadResult;
|
|
110
116
|
writeResult: InvalidationWriteResult;
|
|
117
|
+
queueResult: InvalidationQueueResult;
|
|
111
118
|
instanceApi: InvalidationInstanceApi;
|
|
112
119
|
}>;
|
|
113
120
|
|
|
114
|
-
export { type InvalidateOption, type InvalidationInfiniteReadOptions, type InvalidationMode, type InvalidationPluginConfig, type InvalidationPluginExports, type InvalidationReadOptions, type InvalidationReadResult, type InvalidationWriteOptions, type InvalidationWriteResult, type InvalidationWriteTriggerOptions, invalidationPlugin };
|
|
121
|
+
export { type InvalidateOption, type InvalidationInfiniteReadOptions, type InvalidationMode, type InvalidationPluginConfig, type InvalidationPluginExports, type InvalidationQueueResult, type InvalidationQueueTriggerOptions, type InvalidationReadOptions, type InvalidationReadResult, type InvalidationWriteOptions, type InvalidationWriteResult, type InvalidationWriteTriggerOptions, invalidationPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,11 @@ type InvalidationReadOptions = object;
|
|
|
32
32
|
type InvalidationInfiniteReadOptions = object;
|
|
33
33
|
type InvalidationReadResult = object;
|
|
34
34
|
type InvalidationWriteResult = object;
|
|
35
|
+
interface InvalidationQueueTriggerOptions<TSchema = unknown> {
|
|
36
|
+
/** Unified invalidation configuration */
|
|
37
|
+
invalidate?: InvalidateOption<TSchema>;
|
|
38
|
+
}
|
|
39
|
+
type InvalidationQueueResult = object;
|
|
35
40
|
/**
|
|
36
41
|
* Manual invalidation - tags only, or "*" for global refetch
|
|
37
42
|
*/
|
|
@@ -105,10 +110,12 @@ declare function invalidationPlugin(config?: InvalidationPluginConfig): SpooshPl
|
|
|
105
110
|
readOptions: InvalidationReadOptions;
|
|
106
111
|
writeOptions: InvalidationWriteOptions;
|
|
107
112
|
writeTriggerOptions: InvalidationWriteTriggerOptions;
|
|
113
|
+
queueTriggerOptions: InvalidationQueueTriggerOptions;
|
|
108
114
|
infiniteReadOptions: InvalidationInfiniteReadOptions;
|
|
109
115
|
readResult: InvalidationReadResult;
|
|
110
116
|
writeResult: InvalidationWriteResult;
|
|
117
|
+
queueResult: InvalidationQueueResult;
|
|
111
118
|
instanceApi: InvalidationInstanceApi;
|
|
112
119
|
}>;
|
|
113
120
|
|
|
114
|
-
export { type InvalidateOption, type InvalidationInfiniteReadOptions, type InvalidationMode, type InvalidationPluginConfig, type InvalidationPluginExports, type InvalidationReadOptions, type InvalidationReadResult, type InvalidationWriteOptions, type InvalidationWriteResult, type InvalidationWriteTriggerOptions, invalidationPlugin };
|
|
121
|
+
export { type InvalidateOption, type InvalidationInfiniteReadOptions, type InvalidationMode, type InvalidationPluginConfig, type InvalidationPluginExports, type InvalidationQueueResult, type InvalidationQueueTriggerOptions, type InvalidationReadOptions, type InvalidationReadResult, type InvalidationWriteOptions, type InvalidationWriteResult, type InvalidationWriteTriggerOptions, invalidationPlugin };
|
package/dist/index.js
CHANGED
|
@@ -25,14 +25,16 @@ __export(src_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(src_exports);
|
|
26
26
|
|
|
27
27
|
// src/plugin.ts
|
|
28
|
+
var import_core = require("@spoosh/core");
|
|
28
29
|
var PLUGIN_NAME = "spoosh:invalidation";
|
|
29
30
|
var INVALIDATION_DEFAULT_KEY = "invalidation:defaultMode";
|
|
30
31
|
function resolveModeTags(context, mode) {
|
|
32
|
+
const params = context.request.params;
|
|
31
33
|
switch (mode) {
|
|
32
34
|
case "all":
|
|
33
|
-
return context.tags;
|
|
35
|
+
return context.tags.map((tag) => (0, import_core.resolvePathString)(tag, params));
|
|
34
36
|
case "self":
|
|
35
|
-
return [context.path];
|
|
37
|
+
return [(0, import_core.resolvePathString)(context.path, params)];
|
|
36
38
|
case "none":
|
|
37
39
|
return [];
|
|
38
40
|
}
|
|
@@ -70,7 +72,7 @@ function invalidationPlugin(config = {}) {
|
|
|
70
72
|
const { defaultMode = "all" } = config;
|
|
71
73
|
return {
|
|
72
74
|
name: PLUGIN_NAME,
|
|
73
|
-
operations: ["write"],
|
|
75
|
+
operations: ["write", "queue"],
|
|
74
76
|
exports(context) {
|
|
75
77
|
return {
|
|
76
78
|
setDefaultMode(value) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
// src/plugin.ts
|
|
2
|
+
import { resolvePathString } from "@spoosh/core";
|
|
2
3
|
var PLUGIN_NAME = "spoosh:invalidation";
|
|
3
4
|
var INVALIDATION_DEFAULT_KEY = "invalidation:defaultMode";
|
|
4
5
|
function resolveModeTags(context, mode) {
|
|
6
|
+
const params = context.request.params;
|
|
5
7
|
switch (mode) {
|
|
6
8
|
case "all":
|
|
7
|
-
return context.tags;
|
|
9
|
+
return context.tags.map((tag) => resolvePathString(tag, params));
|
|
8
10
|
case "self":
|
|
9
|
-
return [context.path];
|
|
11
|
+
return [resolvePathString(context.path, params)];
|
|
10
12
|
case "none":
|
|
11
13
|
return [];
|
|
12
14
|
}
|
|
@@ -44,7 +46,7 @@ function invalidationPlugin(config = {}) {
|
|
|
44
46
|
const { defaultMode = "all" } = config;
|
|
45
47
|
return {
|
|
46
48
|
name: PLUGIN_NAME,
|
|
47
|
-
operations: ["write"],
|
|
49
|
+
operations: ["write", "queue"],
|
|
48
50
|
exports(context) {
|
|
49
51
|
return {
|
|
50
52
|
setDefaultMode(value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spoosh/plugin-invalidation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Cache invalidation plugin for Spoosh - auto-invalidates after mutations",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@spoosh/core": ">=0.
|
|
36
|
+
"@spoosh/core": ">=0.14.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@spoosh/
|
|
40
|
-
"@spoosh/
|
|
39
|
+
"@spoosh/test-utils": "0.2.0",
|
|
40
|
+
"@spoosh/core": "0.14.0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"dev": "tsup --watch",
|