@spoosh/plugin-optimistic 0.5.0 → 0.6.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/README.md +1 -1
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ const spoosh = new Spoosh<ApiSchema, Error>("/api").use([
|
|
|
27
27
|
optimisticPlugin(),
|
|
28
28
|
]);
|
|
29
29
|
|
|
30
|
-
const { trigger } = useWrite((api) => api("posts/:id").DELETE);
|
|
30
|
+
const { trigger } = useWrite((api) => api("posts/:id").DELETE());
|
|
31
31
|
|
|
32
32
|
trigger({
|
|
33
33
|
params: { id },
|
package/dist/index.d.mts
CHANGED
|
@@ -164,7 +164,8 @@ type CompletedOptimisticBuilder = {
|
|
|
164
164
|
*/
|
|
165
165
|
type OptimisticCallbackFn<TSchema = unknown, TResponse = unknown> = (api: OptimisticApiHelper<TSchema, TResponse>) => CompletedOptimisticBuilder | CompletedOptimisticBuilder[];
|
|
166
166
|
type OptimisticPluginConfig = object;
|
|
167
|
-
|
|
167
|
+
type OptimisticWriteOptions = object;
|
|
168
|
+
interface OptimisticWriteTriggerOptions<TSchema = unknown, TResponse = unknown> {
|
|
168
169
|
/**
|
|
169
170
|
* Configure optimistic updates for this mutation.
|
|
170
171
|
*
|
|
@@ -218,9 +219,10 @@ declare module "@spoosh/core" {
|
|
|
218
219
|
declare function optimisticPlugin(): SpooshPlugin<{
|
|
219
220
|
readOptions: OptimisticReadOptions;
|
|
220
221
|
writeOptions: OptimisticWriteOptions;
|
|
222
|
+
writeTriggerOptions: OptimisticWriteTriggerOptions;
|
|
221
223
|
infiniteReadOptions: OptimisticInfiniteReadOptions;
|
|
222
224
|
readResult: OptimisticReadResult;
|
|
223
225
|
writeResult: OptimisticWriteResult;
|
|
224
226
|
}>;
|
|
225
227
|
|
|
226
|
-
export { type AnyOptimisticTarget, type OptimisticApiHelper, type OptimisticBuilder, type OptimisticCallbackFn, type OptimisticInfiniteReadOptions, type OptimisticPluginConfig, type OptimisticReadOptions, type OptimisticReadResult, type OptimisticTarget, type OptimisticWriteOptions, type OptimisticWriteResult, optimisticPlugin };
|
|
228
|
+
export { type AnyOptimisticTarget, type OptimisticApiHelper, type OptimisticBuilder, type OptimisticCallbackFn, type OptimisticInfiniteReadOptions, type OptimisticPluginConfig, type OptimisticReadOptions, type OptimisticReadResult, type OptimisticTarget, type OptimisticWriteOptions, type OptimisticWriteResult, type OptimisticWriteTriggerOptions, optimisticPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -164,7 +164,8 @@ type CompletedOptimisticBuilder = {
|
|
|
164
164
|
*/
|
|
165
165
|
type OptimisticCallbackFn<TSchema = unknown, TResponse = unknown> = (api: OptimisticApiHelper<TSchema, TResponse>) => CompletedOptimisticBuilder | CompletedOptimisticBuilder[];
|
|
166
166
|
type OptimisticPluginConfig = object;
|
|
167
|
-
|
|
167
|
+
type OptimisticWriteOptions = object;
|
|
168
|
+
interface OptimisticWriteTriggerOptions<TSchema = unknown, TResponse = unknown> {
|
|
168
169
|
/**
|
|
169
170
|
* Configure optimistic updates for this mutation.
|
|
170
171
|
*
|
|
@@ -218,9 +219,10 @@ declare module "@spoosh/core" {
|
|
|
218
219
|
declare function optimisticPlugin(): SpooshPlugin<{
|
|
219
220
|
readOptions: OptimisticReadOptions;
|
|
220
221
|
writeOptions: OptimisticWriteOptions;
|
|
222
|
+
writeTriggerOptions: OptimisticWriteTriggerOptions;
|
|
221
223
|
infiniteReadOptions: OptimisticInfiniteReadOptions;
|
|
222
224
|
readResult: OptimisticReadResult;
|
|
223
225
|
writeResult: OptimisticWriteResult;
|
|
224
226
|
}>;
|
|
225
227
|
|
|
226
|
-
export { type AnyOptimisticTarget, type OptimisticApiHelper, type OptimisticBuilder, type OptimisticCallbackFn, type OptimisticInfiniteReadOptions, type OptimisticPluginConfig, type OptimisticReadOptions, type OptimisticReadResult, type OptimisticTarget, type OptimisticWriteOptions, type OptimisticWriteResult, optimisticPlugin };
|
|
228
|
+
export { type AnyOptimisticTarget, type OptimisticApiHelper, type OptimisticBuilder, type OptimisticCallbackFn, type OptimisticInfiniteReadOptions, type OptimisticPluginConfig, type OptimisticReadOptions, type OptimisticReadResult, type OptimisticTarget, type OptimisticWriteOptions, type OptimisticWriteResult, type OptimisticWriteTriggerOptions, optimisticPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spoosh/plugin-optimistic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Optimistic updates plugin for Spoosh - instant UI updates with automatic rollback",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@spoosh/core": ">=0.13.
|
|
37
|
-
"@spoosh/plugin-invalidation": ">=0.
|
|
36
|
+
"@spoosh/core": ">=0.13.1",
|
|
37
|
+
"@spoosh/plugin-invalidation": ">=0.7.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@spoosh/core": "0.13.
|
|
41
|
-
"@spoosh/
|
|
42
|
-
"@spoosh/
|
|
40
|
+
"@spoosh/core": "0.13.1",
|
|
41
|
+
"@spoosh/plugin-invalidation": "0.7.0",
|
|
42
|
+
"@spoosh/test-utils": "0.2.0"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"dev": "tsup --watch",
|