@spoosh/react 0.13.3 → 0.14.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 +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +8 -7
- package/dist/index.mjs +8 -7
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReadClient, TagMode, SpooshResponse, ExtractTriggerQuery as ExtractTriggerQuery$3, ExtractTriggerBody as ExtractTriggerBody$3, ExtractTriggerParams as ExtractTriggerParams$3, SpooshPlugin, PluginTypeConfig, MergePluginResults, WriteSelectorClient, SpooshBody, QueueSelectorClient, QueueItem, QueueStats, InfiniteRequestOptions, InfiniteNextContext, InfinitePage, InfinitePrevContext, SubscriptionClient, SubscriptionAdapter, OperationType, StateManager, EventEmitter, PluginExecutor, SpooshTransport, PluginArray, ResolveTypes, MergePluginOptions, ResolverContext, ResolveResultTypes,
|
|
1
|
+
import { ReadClient, TagMode, SpooshResponse, ExtractTriggerQuery as ExtractTriggerQuery$3, ExtractTriggerBody as ExtractTriggerBody$3, ExtractTriggerParams as ExtractTriggerParams$3, SpooshPlugin, PluginTypeConfig, MergePluginResults, WriteSelectorClient, SpooshBody, QueueSelectorClient, QueueItem, QueueStats, InfiniteRequestOptions, InfiniteNextContext, InfinitePage, InfinitePrevContext, SubscriptionClient, SubscriptionAdapter, OperationType, StateManager, EventEmitter, PluginExecutor, SpooshTransport, PluginArray, ResolveTypes, MergePluginOptions, ResolverContext, ResolveResultTypes, MergePluginApi, MethodOptionsMap, CoreRequestOptionsBase, SpooshClient, SpooshOptions } from '@spoosh/core';
|
|
2
2
|
|
|
3
3
|
type SuccessResponse<T> = Extract<T, {
|
|
4
4
|
data: unknown;
|
|
@@ -282,6 +282,8 @@ type UseQueueResult<TData, TError, TTriggerInput, TMeta = object> = {
|
|
|
282
282
|
removeSettled: () => void;
|
|
283
283
|
/** Abort all and clear queue */
|
|
284
284
|
clear: () => void;
|
|
285
|
+
/** Update concurrency limit */
|
|
286
|
+
setConcurrency: (concurrency: number) => void;
|
|
285
287
|
};
|
|
286
288
|
/**
|
|
287
289
|
* API client type for queue selector.
|
|
@@ -641,7 +643,7 @@ type BaseSpooshReactHooks<TDefaultError, TSchema, TPlugins extends PluginArray>
|
|
|
641
643
|
* ```
|
|
642
644
|
*/
|
|
643
645
|
useSubscription: UseSubscriptionFn<TDefaultError, TSchema, TPlugins>;
|
|
644
|
-
} &
|
|
646
|
+
} & MergePluginApi<TPlugins, TSchema>;
|
|
645
647
|
/**
|
|
646
648
|
* SSE hooks available when SSE transport is registered.
|
|
647
649
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReadClient, TagMode, SpooshResponse, ExtractTriggerQuery as ExtractTriggerQuery$3, ExtractTriggerBody as ExtractTriggerBody$3, ExtractTriggerParams as ExtractTriggerParams$3, SpooshPlugin, PluginTypeConfig, MergePluginResults, WriteSelectorClient, SpooshBody, QueueSelectorClient, QueueItem, QueueStats, InfiniteRequestOptions, InfiniteNextContext, InfinitePage, InfinitePrevContext, SubscriptionClient, SubscriptionAdapter, OperationType, StateManager, EventEmitter, PluginExecutor, SpooshTransport, PluginArray, ResolveTypes, MergePluginOptions, ResolverContext, ResolveResultTypes,
|
|
1
|
+
import { ReadClient, TagMode, SpooshResponse, ExtractTriggerQuery as ExtractTriggerQuery$3, ExtractTriggerBody as ExtractTriggerBody$3, ExtractTriggerParams as ExtractTriggerParams$3, SpooshPlugin, PluginTypeConfig, MergePluginResults, WriteSelectorClient, SpooshBody, QueueSelectorClient, QueueItem, QueueStats, InfiniteRequestOptions, InfiniteNextContext, InfinitePage, InfinitePrevContext, SubscriptionClient, SubscriptionAdapter, OperationType, StateManager, EventEmitter, PluginExecutor, SpooshTransport, PluginArray, ResolveTypes, MergePluginOptions, ResolverContext, ResolveResultTypes, MergePluginApi, MethodOptionsMap, CoreRequestOptionsBase, SpooshClient, SpooshOptions } from '@spoosh/core';
|
|
2
2
|
|
|
3
3
|
type SuccessResponse<T> = Extract<T, {
|
|
4
4
|
data: unknown;
|
|
@@ -282,6 +282,8 @@ type UseQueueResult<TData, TError, TTriggerInput, TMeta = object> = {
|
|
|
282
282
|
removeSettled: () => void;
|
|
283
283
|
/** Abort all and clear queue */
|
|
284
284
|
clear: () => void;
|
|
285
|
+
/** Update concurrency limit */
|
|
286
|
+
setConcurrency: (concurrency: number) => void;
|
|
285
287
|
};
|
|
286
288
|
/**
|
|
287
289
|
* API client type for queue selector.
|
|
@@ -641,7 +643,7 @@ type BaseSpooshReactHooks<TDefaultError, TSchema, TPlugins extends PluginArray>
|
|
|
641
643
|
* ```
|
|
642
644
|
*/
|
|
643
645
|
useSubscription: UseSubscriptionFn<TDefaultError, TSchema, TPlugins>;
|
|
644
|
-
} &
|
|
646
|
+
} & MergePluginApi<TPlugins, TSchema>;
|
|
645
647
|
/**
|
|
646
648
|
* SSE hooks available when SSE transport is registered.
|
|
647
649
|
*/
|
package/dist/index.js
CHANGED
|
@@ -655,7 +655,8 @@ function createUseQueue(options) {
|
|
|
655
655
|
retry: controller.retry,
|
|
656
656
|
remove: controller.remove,
|
|
657
657
|
removeSettled: controller.removeSettled,
|
|
658
|
-
clear: controller.clear
|
|
658
|
+
clear: controller.clear,
|
|
659
|
+
setConcurrency: controller.setConcurrency
|
|
659
660
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
660
661
|
};
|
|
661
662
|
}
|
|
@@ -1017,16 +1018,16 @@ function create(instance) {
|
|
|
1017
1018
|
for (const plugin of plugins) {
|
|
1018
1019
|
plugin.setup?.(setupContext);
|
|
1019
1020
|
}
|
|
1020
|
-
const
|
|
1021
|
-
api,
|
|
1021
|
+
const apiContext = {
|
|
1022
|
+
spoosh: api,
|
|
1022
1023
|
stateManager,
|
|
1023
1024
|
eventEmitter,
|
|
1024
1025
|
pluginExecutor
|
|
1025
1026
|
};
|
|
1026
|
-
const
|
|
1027
|
+
const pluginApis = plugins.reduce(
|
|
1027
1028
|
(acc, plugin) => {
|
|
1028
|
-
if (plugin.
|
|
1029
|
-
return { ...acc, ...plugin.
|
|
1029
|
+
if (plugin.api) {
|
|
1030
|
+
return { ...acc, ...plugin.api(apiContext) };
|
|
1030
1031
|
}
|
|
1031
1032
|
return acc;
|
|
1032
1033
|
},
|
|
@@ -1039,6 +1040,6 @@ function create(instance) {
|
|
|
1039
1040
|
useQueue,
|
|
1040
1041
|
useSubscription,
|
|
1041
1042
|
useSSE,
|
|
1042
|
-
...
|
|
1043
|
+
...pluginApis
|
|
1043
1044
|
};
|
|
1044
1045
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -668,7 +668,8 @@ function createUseQueue(options) {
|
|
|
668
668
|
retry: controller.retry,
|
|
669
669
|
remove: controller.remove,
|
|
670
670
|
removeSettled: controller.removeSettled,
|
|
671
|
-
clear: controller.clear
|
|
671
|
+
clear: controller.clear,
|
|
672
|
+
setConcurrency: controller.setConcurrency
|
|
672
673
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
673
674
|
};
|
|
674
675
|
}
|
|
@@ -1039,16 +1040,16 @@ function create(instance) {
|
|
|
1039
1040
|
for (const plugin of plugins) {
|
|
1040
1041
|
plugin.setup?.(setupContext);
|
|
1041
1042
|
}
|
|
1042
|
-
const
|
|
1043
|
-
api,
|
|
1043
|
+
const apiContext = {
|
|
1044
|
+
spoosh: api,
|
|
1044
1045
|
stateManager,
|
|
1045
1046
|
eventEmitter,
|
|
1046
1047
|
pluginExecutor
|
|
1047
1048
|
};
|
|
1048
|
-
const
|
|
1049
|
+
const pluginApis = plugins.reduce(
|
|
1049
1050
|
(acc, plugin) => {
|
|
1050
|
-
if (plugin.
|
|
1051
|
-
return { ...acc, ...plugin.
|
|
1051
|
+
if (plugin.api) {
|
|
1052
|
+
return { ...acc, ...plugin.api(apiContext) };
|
|
1052
1053
|
}
|
|
1053
1054
|
return acc;
|
|
1054
1055
|
},
|
|
@@ -1061,7 +1062,7 @@ function create(instance) {
|
|
|
1061
1062
|
useQueue,
|
|
1062
1063
|
useSubscription,
|
|
1063
1064
|
useSSE,
|
|
1064
|
-
...
|
|
1065
|
+
...pluginApis
|
|
1065
1066
|
};
|
|
1066
1067
|
}
|
|
1067
1068
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spoosh/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React hooks for Spoosh API toolkit",
|
|
6
6
|
"keywords": [
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@spoosh/core": ">=0.
|
|
37
|
+
"@spoosh/core": ">=0.17.1",
|
|
38
38
|
"@spoosh/transport-sse": ">=0.1.0",
|
|
39
39
|
"react": "^18 || ^19"
|
|
40
40
|
},
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@testing-library/react": "^16.0.0",
|
|
48
48
|
"jsdom": "^26.0.0",
|
|
49
|
+
"@spoosh/core": "0.17.1",
|
|
49
50
|
"@spoosh/transport-sse": "0.1.1",
|
|
50
|
-
"@spoosh/core": "0.16.0",
|
|
51
51
|
"@spoosh/test-utils": "0.3.0"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|