@spoosh/plugin-invalidation 0.8.0 → 0.9.1
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 +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +3 -4
- package/dist/index.mjs +7 -5
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _spoosh_core from '@spoosh/core';
|
|
2
2
|
|
|
3
3
|
type InvalidationMode = "all" | "self" | "none";
|
|
4
4
|
/**
|
|
@@ -29,7 +29,7 @@ interface InvalidationWriteTriggerOptions<TSchema = unknown> {
|
|
|
29
29
|
invalidate?: InvalidateOption<TSchema>;
|
|
30
30
|
}
|
|
31
31
|
type InvalidationReadOptions = object;
|
|
32
|
-
type
|
|
32
|
+
type InvalidationPagesOptions = object;
|
|
33
33
|
type InvalidationReadResult = object;
|
|
34
34
|
type InvalidationWriteResult = object;
|
|
35
35
|
interface InvalidationQueueTriggerOptions<TSchema = unknown> {
|
|
@@ -106,16 +106,16 @@ declare module "@spoosh/core" {
|
|
|
106
106
|
* });
|
|
107
107
|
* ```
|
|
108
108
|
*/
|
|
109
|
-
declare function invalidationPlugin(config?: InvalidationPluginConfig): SpooshPlugin<{
|
|
109
|
+
declare function invalidationPlugin(config?: InvalidationPluginConfig): _spoosh_core.SpooshPlugin<{
|
|
110
110
|
readOptions: InvalidationReadOptions;
|
|
111
111
|
writeOptions: InvalidationWriteOptions;
|
|
112
112
|
writeTriggerOptions: InvalidationWriteTriggerOptions;
|
|
113
113
|
queueTriggerOptions: InvalidationQueueTriggerOptions;
|
|
114
|
-
|
|
114
|
+
pagesOptions: InvalidationPagesOptions;
|
|
115
115
|
readResult: InvalidationReadResult;
|
|
116
116
|
writeResult: InvalidationWriteResult;
|
|
117
117
|
queueResult: InvalidationQueueResult;
|
|
118
118
|
instanceApi: InvalidationInstanceApi;
|
|
119
119
|
}>;
|
|
120
120
|
|
|
121
|
-
export { type InvalidateOption, type
|
|
121
|
+
export { type InvalidateOption, type InvalidationMode, type InvalidationPagesOptions, 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _spoosh_core from '@spoosh/core';
|
|
2
2
|
|
|
3
3
|
type InvalidationMode = "all" | "self" | "none";
|
|
4
4
|
/**
|
|
@@ -29,7 +29,7 @@ interface InvalidationWriteTriggerOptions<TSchema = unknown> {
|
|
|
29
29
|
invalidate?: InvalidateOption<TSchema>;
|
|
30
30
|
}
|
|
31
31
|
type InvalidationReadOptions = object;
|
|
32
|
-
type
|
|
32
|
+
type InvalidationPagesOptions = object;
|
|
33
33
|
type InvalidationReadResult = object;
|
|
34
34
|
type InvalidationWriteResult = object;
|
|
35
35
|
interface InvalidationQueueTriggerOptions<TSchema = unknown> {
|
|
@@ -106,16 +106,16 @@ declare module "@spoosh/core" {
|
|
|
106
106
|
* });
|
|
107
107
|
* ```
|
|
108
108
|
*/
|
|
109
|
-
declare function invalidationPlugin(config?: InvalidationPluginConfig): SpooshPlugin<{
|
|
109
|
+
declare function invalidationPlugin(config?: InvalidationPluginConfig): _spoosh_core.SpooshPlugin<{
|
|
110
110
|
readOptions: InvalidationReadOptions;
|
|
111
111
|
writeOptions: InvalidationWriteOptions;
|
|
112
112
|
writeTriggerOptions: InvalidationWriteTriggerOptions;
|
|
113
113
|
queueTriggerOptions: InvalidationQueueTriggerOptions;
|
|
114
|
-
|
|
114
|
+
pagesOptions: InvalidationPagesOptions;
|
|
115
115
|
readResult: InvalidationReadResult;
|
|
116
116
|
writeResult: InvalidationWriteResult;
|
|
117
117
|
queueResult: InvalidationQueueResult;
|
|
118
118
|
instanceApi: InvalidationInstanceApi;
|
|
119
119
|
}>;
|
|
120
120
|
|
|
121
|
-
export { type InvalidateOption, type
|
|
121
|
+
export { type InvalidateOption, type InvalidationMode, type InvalidationPagesOptions, type InvalidationPluginConfig, type InvalidationPluginExports, type InvalidationQueueResult, type InvalidationQueueTriggerOptions, type InvalidationReadOptions, type InvalidationReadResult, type InvalidationWriteOptions, type InvalidationWriteResult, type InvalidationWriteTriggerOptions, invalidationPlugin };
|
package/dist/index.js
CHANGED
|
@@ -40,8 +40,7 @@ function resolveModeTags(context, mode) {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
function resolveInvalidateTags(context, defaultMode) {
|
|
43
|
-
const
|
|
44
|
-
const invalidateOption = pluginOptions?.invalidate;
|
|
43
|
+
const invalidateOption = context.pluginOptions?.invalidate;
|
|
45
44
|
if (!invalidateOption) {
|
|
46
45
|
const overrideDefault = context.temp.get(INVALIDATION_DEFAULT_KEY);
|
|
47
46
|
const effectiveDefault = overrideDefault ?? defaultMode;
|
|
@@ -70,7 +69,7 @@ function resolveInvalidateTags(context, defaultMode) {
|
|
|
70
69
|
}
|
|
71
70
|
function invalidationPlugin(config = {}) {
|
|
72
71
|
const { defaultMode = "all" } = config;
|
|
73
|
-
return {
|
|
72
|
+
return (0, import_core.createSpooshPlugin)({
|
|
74
73
|
name: PLUGIN_NAME,
|
|
75
74
|
operations: ["write", "queue"],
|
|
76
75
|
exports(context) {
|
|
@@ -119,5 +118,5 @@ function invalidationPlugin(config = {}) {
|
|
|
119
118
|
};
|
|
120
119
|
return { invalidate };
|
|
121
120
|
}
|
|
122
|
-
};
|
|
121
|
+
});
|
|
123
122
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
// src/plugin.ts
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
resolvePathString,
|
|
4
|
+
createSpooshPlugin
|
|
5
|
+
} from "@spoosh/core";
|
|
3
6
|
var PLUGIN_NAME = "spoosh:invalidation";
|
|
4
7
|
var INVALIDATION_DEFAULT_KEY = "invalidation:defaultMode";
|
|
5
8
|
function resolveModeTags(context, mode) {
|
|
@@ -14,8 +17,7 @@ function resolveModeTags(context, mode) {
|
|
|
14
17
|
}
|
|
15
18
|
}
|
|
16
19
|
function resolveInvalidateTags(context, defaultMode) {
|
|
17
|
-
const
|
|
18
|
-
const invalidateOption = pluginOptions?.invalidate;
|
|
20
|
+
const invalidateOption = context.pluginOptions?.invalidate;
|
|
19
21
|
if (!invalidateOption) {
|
|
20
22
|
const overrideDefault = context.temp.get(INVALIDATION_DEFAULT_KEY);
|
|
21
23
|
const effectiveDefault = overrideDefault ?? defaultMode;
|
|
@@ -44,7 +46,7 @@ function resolveInvalidateTags(context, defaultMode) {
|
|
|
44
46
|
}
|
|
45
47
|
function invalidationPlugin(config = {}) {
|
|
46
48
|
const { defaultMode = "all" } = config;
|
|
47
|
-
return {
|
|
49
|
+
return createSpooshPlugin({
|
|
48
50
|
name: PLUGIN_NAME,
|
|
49
51
|
operations: ["write", "queue"],
|
|
50
52
|
exports(context) {
|
|
@@ -93,7 +95,7 @@ function invalidationPlugin(config = {}) {
|
|
|
93
95
|
};
|
|
94
96
|
return { invalidate };
|
|
95
97
|
}
|
|
96
|
-
};
|
|
98
|
+
});
|
|
97
99
|
}
|
|
98
100
|
export {
|
|
99
101
|
invalidationPlugin
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spoosh/plugin-invalidation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
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.15.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@spoosh/
|
|
40
|
-
"@spoosh/
|
|
39
|
+
"@spoosh/core": "0.15.1",
|
|
40
|
+
"@spoosh/test-utils": "0.3.0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"dev": "tsup --watch",
|