@spoosh/react 0.13.2 → 0.14.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 +15 -7
- package/dist/index.d.ts +15 -7
- package/dist/index.js +6 -6
- package/dist/index.mjs +6 -6
- 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;
|
|
@@ -68,6 +68,9 @@ type ExtractAllSubscriptionEvents<T> = SubscriptionReturnType<T> extends {
|
|
|
68
68
|
data: infer EventData;
|
|
69
69
|
} ? EventData : unknown;
|
|
70
70
|
} : unknown : unknown;
|
|
71
|
+
type ExtractSubscriptionError<T> = SubscriptionReturnType<T> extends {
|
|
72
|
+
error: infer E;
|
|
73
|
+
} ? E : unknown;
|
|
71
74
|
|
|
72
75
|
type TagModeInArray$1 = "all" | "self";
|
|
73
76
|
/**
|
|
@@ -456,8 +459,8 @@ interface UseSSEOptionsBase {
|
|
|
456
459
|
/** Delay between retries in ms */
|
|
457
460
|
retryDelay?: number;
|
|
458
461
|
}
|
|
459
|
-
type ParseFn = (data: string) =>
|
|
460
|
-
type TypedParseConfig<TEventKeys extends string
|
|
462
|
+
type ParseFn<TEvents extends Record<string, unknown> = Record<string, unknown>> = (data: string) => Partial<TEvents>;
|
|
463
|
+
type TypedParseConfig<TEventKeys extends string, TEvents extends Record<string, unknown>> = ParseStrategy | ParseFn<TEvents> | Partial<Record<TEventKeys, ParseStrategy | ((data: string) => unknown)>>;
|
|
461
464
|
type TypedAccumulateConfig<TEvents extends Record<string, unknown>> = AccumulateStrategy | {
|
|
462
465
|
[K in keyof TEvents]?: AccumulateStrategy | AccumulatorFn<TEvents[K]> | AccumulateFieldConfig<TEvents[K]>;
|
|
463
466
|
};
|
|
@@ -465,7 +468,7 @@ interface TypedUseSSEOptions<TEventKeys extends string, TEvents extends Record<s
|
|
|
465
468
|
/** Event types to listen for. If not provided, listens to all events. */
|
|
466
469
|
events?: TSelectedEvents;
|
|
467
470
|
/** Parse strategy for SSE event data. Defaults to 'auto'. */
|
|
468
|
-
parse?: TypedParseConfig<TEventKeys>;
|
|
471
|
+
parse?: TypedParseConfig<TEventKeys, TEvents>;
|
|
469
472
|
/** Accumulate strategy for combining events. Defaults to 'replace'. */
|
|
470
473
|
accumulate?: TypedAccumulateConfig<TEvents>;
|
|
471
474
|
}
|
|
@@ -518,7 +521,8 @@ type UseReadFn<TDefaultError, TSchema, TPlugins extends PluginArray> = {
|
|
|
518
521
|
<TReadFn extends (api: ReadApiClient<TSchema, TDefaultError>) => Promise<SpooshResponse<unknown, unknown>>>(readFn: TReadFn): BaseReadResult<ExtractMethodData<TReadFn>, InferError<ExtractMethodError<TReadFn>, TDefaultError>, MergePluginResults<TPlugins>["read"], TriggerOptions<TReadFn>> & ResponseInputFields<ExtractResponseQuery<TReadFn>, ExtractResponseBody<TReadFn>, ExtractResponseParamNames<TReadFn>>;
|
|
519
522
|
};
|
|
520
523
|
type UseWriteFn<TDefaultError, TSchema, TPlugins extends PluginArray> = {
|
|
521
|
-
<TWriteFn extends (api: WriteApiClient<TSchema, TDefaultError>) => Promise<SpooshResponse<unknown, unknown>>, TWriteOpts extends ResolvedWriteOptions<TSchema, TPlugins, TWriteFn, TDefaultError
|
|
524
|
+
<TWriteFn extends (api: WriteApiClient<TSchema, TDefaultError>) => Promise<SpooshResponse<unknown, unknown>>, TWriteOpts extends ResolvedWriteOptions<TSchema, TPlugins, TWriteFn, TDefaultError>>(writeFn: TWriteFn, writeOptions: StrictOptions<TWriteOpts, ResolvedWriteOptions<TSchema, TPlugins, TWriteFn, TDefaultError>>): BaseWriteResult<ExtractMethodData<TWriteFn>, InferError<ExtractMethodError<TWriteFn>, TDefaultError>, WriteTriggerInput<TWriteFn> & ResolvedWriteTriggerOptions<TSchema, TPlugins, TWriteFn, TDefaultError>, ResolveResultTypes<MergePluginResults<TPlugins>["write"], TWriteOpts>> & WriteResponseInputFields<ExtractMethodQuery<TWriteFn>, ExtractMethodBody<TWriteFn>, ExtractResponseParamNames<TWriteFn>>;
|
|
525
|
+
<TWriteFn extends (api: WriteApiClient<TSchema, TDefaultError>) => Promise<SpooshResponse<unknown, unknown>>>(writeFn: TWriteFn): BaseWriteResult<ExtractMethodData<TWriteFn>, InferError<ExtractMethodError<TWriteFn>, TDefaultError>, WriteTriggerInput<TWriteFn> & ResolvedWriteTriggerOptions<TSchema, TPlugins, TWriteFn, TDefaultError>, MergePluginResults<TPlugins>["write"]> & WriteResponseInputFields<ExtractMethodQuery<TWriteFn>, ExtractMethodBody<TWriteFn>, ExtractResponseParamNames<TWriteFn>>;
|
|
522
526
|
};
|
|
523
527
|
type UseQueueFn<TDefaultError, TSchema, TPlugins extends PluginArray> = {
|
|
524
528
|
<TQueueFn extends (api: QueueApiClient<TSchema, TDefaultError>) => Promise<SpooshResponse<unknown, unknown>>>(queueFn: TQueueFn, queueOptions?: ResolvedQueueOptions<TSchema, TPlugins, TQueueFn, TDefaultError> & UseQueueOptions): UseQueueResult<ExtractMethodData<TQueueFn>, InferError<ExtractMethodError<TQueueFn>, TDefaultError>, QueueTriggerInput<TQueueFn> & ResolvedQueueTriggerOptions<TSchema, TPlugins, TQueueFn, TDefaultError>, ResolveResultTypes<MergePluginResults<TPlugins>["queue"], ResolvedQueueOptions<TSchema, TPlugins, TQueueFn, TDefaultError> & UseQueueOptions>>;
|
|
@@ -637,7 +641,7 @@ type BaseSpooshReactHooks<TDefaultError, TSchema, TPlugins extends PluginArray>
|
|
|
637
641
|
* ```
|
|
638
642
|
*/
|
|
639
643
|
useSubscription: UseSubscriptionFn<TDefaultError, TSchema, TPlugins>;
|
|
640
|
-
} &
|
|
644
|
+
} & MergePluginApi<TPlugins, TSchema>;
|
|
641
645
|
/**
|
|
642
646
|
* SSE hooks available when SSE transport is registered.
|
|
643
647
|
*/
|
|
@@ -727,10 +731,14 @@ type SpooshInstanceShape<TApi, TSchema, TDefaultError, TPlugins, TTransports ext
|
|
|
727
731
|
*/
|
|
728
732
|
declare function create<TSchema, TDefaultError, TPlugins extends PluginArray, TApi, TTransports extends string = never>(instance: SpooshInstanceShape<TApi, TSchema, TDefaultError, TPlugins, TTransports>): SpooshReactHooks<TDefaultError, TSchema, TPlugins, TTransports>;
|
|
729
733
|
|
|
734
|
+
type QueryRequestOptions = CoreRequestOptionsBase;
|
|
735
|
+
type MutationRequestOptions = CoreRequestOptionsBase;
|
|
736
|
+
type ReactOptionsMap = MethodOptionsMap<QueryRequestOptions, MutationRequestOptions>;
|
|
737
|
+
type ApiClient<TSchema> = SpooshClient<TSchema, unknown>;
|
|
730
738
|
type PluginHooksConfig<TPlugins extends readonly SpooshPlugin<PluginTypeConfig>[]> = {
|
|
731
739
|
baseUrl: string;
|
|
732
740
|
defaultOptions?: SpooshOptions;
|
|
733
741
|
plugins: TPlugins;
|
|
734
742
|
};
|
|
735
743
|
|
|
736
|
-
export { type BasePagesOptions, type BasePagesResult, type BaseReadOptions, type BaseReadResult, type BaseWriteResult, type ExtractCoreMethodOptions, type ExtractMethodBody, type ExtractMethodData, type ExtractMethodError, type ExtractMethodOptions, type ExtractMethodQuery, type ExtractResponseBody, type ExtractResponseParamNames, type ExtractResponseQuery, type ExtractResponseRequestOptions, type PagesApiClient, type PagesTriggerOptions, type PluginHooksConfig, type QueueApiClient, type QueueTriggerInput, type ReadApiClient, type ResponseInputFields, type SpooshReactHooks, type TriggerOptions, type TypedAccumulateConfig, type TypedParseConfig, type TypedUseSSEOptions, type UsePagesResult, type UseQueueOptions, type UseQueueResult, type UseReadResult, type UseSSEOptions, type UseSSEResult, type UseWriteResult, type WriteApiClient, type WriteResponseInputFields, create };
|
|
744
|
+
export { type ApiClient, type BasePagesOptions, type BasePagesResult, type BaseReadOptions, type BaseReadResult, type BaseSubscriptionOptions, type BaseSubscriptionResult, type BaseWriteResult, type ExtractAllSubscriptionEventKeys, type ExtractAllSubscriptionEvents, type ExtractCoreMethodOptions, type ExtractMethodBody, type ExtractMethodData, type ExtractMethodError, type ExtractMethodOptions, type ExtractMethodQuery, type ExtractResponseBody, type ExtractResponseParamNames, type ExtractResponseQuery, type ExtractResponseRequestOptions, type ExtractSubscriptionBody, type ExtractSubscriptionError, type ExtractSubscriptionEvents, type ExtractSubscriptionQuery, type PagesApiClient, type PagesTriggerOptions, type PluginHooksConfig, type QueueApiClient, type QueueTriggerInput, type ReactOptionsMap, type ReadApiClient, type ResponseInputFields, type SpooshReactHooks, type SubscriptionApiClient, type SubscriptionTriggerInput, type TriggerOptions, type TypedAccumulateConfig, type TypedParseConfig, type TypedUseSSEOptions, type UsePagesResult, type UseQueueOptions, type UseQueueResult, type UseReadResult, type UseSSEOptions, type UseSSEOptionsBase, type UseSSEResult, type UseWriteResult, type WriteApiClient, type WriteResponseInputFields, type WriteTriggerInput, create };
|
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;
|
|
@@ -68,6 +68,9 @@ type ExtractAllSubscriptionEvents<T> = SubscriptionReturnType<T> extends {
|
|
|
68
68
|
data: infer EventData;
|
|
69
69
|
} ? EventData : unknown;
|
|
70
70
|
} : unknown : unknown;
|
|
71
|
+
type ExtractSubscriptionError<T> = SubscriptionReturnType<T> extends {
|
|
72
|
+
error: infer E;
|
|
73
|
+
} ? E : unknown;
|
|
71
74
|
|
|
72
75
|
type TagModeInArray$1 = "all" | "self";
|
|
73
76
|
/**
|
|
@@ -456,8 +459,8 @@ interface UseSSEOptionsBase {
|
|
|
456
459
|
/** Delay between retries in ms */
|
|
457
460
|
retryDelay?: number;
|
|
458
461
|
}
|
|
459
|
-
type ParseFn = (data: string) =>
|
|
460
|
-
type TypedParseConfig<TEventKeys extends string
|
|
462
|
+
type ParseFn<TEvents extends Record<string, unknown> = Record<string, unknown>> = (data: string) => Partial<TEvents>;
|
|
463
|
+
type TypedParseConfig<TEventKeys extends string, TEvents extends Record<string, unknown>> = ParseStrategy | ParseFn<TEvents> | Partial<Record<TEventKeys, ParseStrategy | ((data: string) => unknown)>>;
|
|
461
464
|
type TypedAccumulateConfig<TEvents extends Record<string, unknown>> = AccumulateStrategy | {
|
|
462
465
|
[K in keyof TEvents]?: AccumulateStrategy | AccumulatorFn<TEvents[K]> | AccumulateFieldConfig<TEvents[K]>;
|
|
463
466
|
};
|
|
@@ -465,7 +468,7 @@ interface TypedUseSSEOptions<TEventKeys extends string, TEvents extends Record<s
|
|
|
465
468
|
/** Event types to listen for. If not provided, listens to all events. */
|
|
466
469
|
events?: TSelectedEvents;
|
|
467
470
|
/** Parse strategy for SSE event data. Defaults to 'auto'. */
|
|
468
|
-
parse?: TypedParseConfig<TEventKeys>;
|
|
471
|
+
parse?: TypedParseConfig<TEventKeys, TEvents>;
|
|
469
472
|
/** Accumulate strategy for combining events. Defaults to 'replace'. */
|
|
470
473
|
accumulate?: TypedAccumulateConfig<TEvents>;
|
|
471
474
|
}
|
|
@@ -518,7 +521,8 @@ type UseReadFn<TDefaultError, TSchema, TPlugins extends PluginArray> = {
|
|
|
518
521
|
<TReadFn extends (api: ReadApiClient<TSchema, TDefaultError>) => Promise<SpooshResponse<unknown, unknown>>>(readFn: TReadFn): BaseReadResult<ExtractMethodData<TReadFn>, InferError<ExtractMethodError<TReadFn>, TDefaultError>, MergePluginResults<TPlugins>["read"], TriggerOptions<TReadFn>> & ResponseInputFields<ExtractResponseQuery<TReadFn>, ExtractResponseBody<TReadFn>, ExtractResponseParamNames<TReadFn>>;
|
|
519
522
|
};
|
|
520
523
|
type UseWriteFn<TDefaultError, TSchema, TPlugins extends PluginArray> = {
|
|
521
|
-
<TWriteFn extends (api: WriteApiClient<TSchema, TDefaultError>) => Promise<SpooshResponse<unknown, unknown>>, TWriteOpts extends ResolvedWriteOptions<TSchema, TPlugins, TWriteFn, TDefaultError
|
|
524
|
+
<TWriteFn extends (api: WriteApiClient<TSchema, TDefaultError>) => Promise<SpooshResponse<unknown, unknown>>, TWriteOpts extends ResolvedWriteOptions<TSchema, TPlugins, TWriteFn, TDefaultError>>(writeFn: TWriteFn, writeOptions: StrictOptions<TWriteOpts, ResolvedWriteOptions<TSchema, TPlugins, TWriteFn, TDefaultError>>): BaseWriteResult<ExtractMethodData<TWriteFn>, InferError<ExtractMethodError<TWriteFn>, TDefaultError>, WriteTriggerInput<TWriteFn> & ResolvedWriteTriggerOptions<TSchema, TPlugins, TWriteFn, TDefaultError>, ResolveResultTypes<MergePluginResults<TPlugins>["write"], TWriteOpts>> & WriteResponseInputFields<ExtractMethodQuery<TWriteFn>, ExtractMethodBody<TWriteFn>, ExtractResponseParamNames<TWriteFn>>;
|
|
525
|
+
<TWriteFn extends (api: WriteApiClient<TSchema, TDefaultError>) => Promise<SpooshResponse<unknown, unknown>>>(writeFn: TWriteFn): BaseWriteResult<ExtractMethodData<TWriteFn>, InferError<ExtractMethodError<TWriteFn>, TDefaultError>, WriteTriggerInput<TWriteFn> & ResolvedWriteTriggerOptions<TSchema, TPlugins, TWriteFn, TDefaultError>, MergePluginResults<TPlugins>["write"]> & WriteResponseInputFields<ExtractMethodQuery<TWriteFn>, ExtractMethodBody<TWriteFn>, ExtractResponseParamNames<TWriteFn>>;
|
|
522
526
|
};
|
|
523
527
|
type UseQueueFn<TDefaultError, TSchema, TPlugins extends PluginArray> = {
|
|
524
528
|
<TQueueFn extends (api: QueueApiClient<TSchema, TDefaultError>) => Promise<SpooshResponse<unknown, unknown>>>(queueFn: TQueueFn, queueOptions?: ResolvedQueueOptions<TSchema, TPlugins, TQueueFn, TDefaultError> & UseQueueOptions): UseQueueResult<ExtractMethodData<TQueueFn>, InferError<ExtractMethodError<TQueueFn>, TDefaultError>, QueueTriggerInput<TQueueFn> & ResolvedQueueTriggerOptions<TSchema, TPlugins, TQueueFn, TDefaultError>, ResolveResultTypes<MergePluginResults<TPlugins>["queue"], ResolvedQueueOptions<TSchema, TPlugins, TQueueFn, TDefaultError> & UseQueueOptions>>;
|
|
@@ -637,7 +641,7 @@ type BaseSpooshReactHooks<TDefaultError, TSchema, TPlugins extends PluginArray>
|
|
|
637
641
|
* ```
|
|
638
642
|
*/
|
|
639
643
|
useSubscription: UseSubscriptionFn<TDefaultError, TSchema, TPlugins>;
|
|
640
|
-
} &
|
|
644
|
+
} & MergePluginApi<TPlugins, TSchema>;
|
|
641
645
|
/**
|
|
642
646
|
* SSE hooks available when SSE transport is registered.
|
|
643
647
|
*/
|
|
@@ -727,10 +731,14 @@ type SpooshInstanceShape<TApi, TSchema, TDefaultError, TPlugins, TTransports ext
|
|
|
727
731
|
*/
|
|
728
732
|
declare function create<TSchema, TDefaultError, TPlugins extends PluginArray, TApi, TTransports extends string = never>(instance: SpooshInstanceShape<TApi, TSchema, TDefaultError, TPlugins, TTransports>): SpooshReactHooks<TDefaultError, TSchema, TPlugins, TTransports>;
|
|
729
733
|
|
|
734
|
+
type QueryRequestOptions = CoreRequestOptionsBase;
|
|
735
|
+
type MutationRequestOptions = CoreRequestOptionsBase;
|
|
736
|
+
type ReactOptionsMap = MethodOptionsMap<QueryRequestOptions, MutationRequestOptions>;
|
|
737
|
+
type ApiClient<TSchema> = SpooshClient<TSchema, unknown>;
|
|
730
738
|
type PluginHooksConfig<TPlugins extends readonly SpooshPlugin<PluginTypeConfig>[]> = {
|
|
731
739
|
baseUrl: string;
|
|
732
740
|
defaultOptions?: SpooshOptions;
|
|
733
741
|
plugins: TPlugins;
|
|
734
742
|
};
|
|
735
743
|
|
|
736
|
-
export { type BasePagesOptions, type BasePagesResult, type BaseReadOptions, type BaseReadResult, type BaseWriteResult, type ExtractCoreMethodOptions, type ExtractMethodBody, type ExtractMethodData, type ExtractMethodError, type ExtractMethodOptions, type ExtractMethodQuery, type ExtractResponseBody, type ExtractResponseParamNames, type ExtractResponseQuery, type ExtractResponseRequestOptions, type PagesApiClient, type PagesTriggerOptions, type PluginHooksConfig, type QueueApiClient, type QueueTriggerInput, type ReadApiClient, type ResponseInputFields, type SpooshReactHooks, type TriggerOptions, type TypedAccumulateConfig, type TypedParseConfig, type TypedUseSSEOptions, type UsePagesResult, type UseQueueOptions, type UseQueueResult, type UseReadResult, type UseSSEOptions, type UseSSEResult, type UseWriteResult, type WriteApiClient, type WriteResponseInputFields, create };
|
|
744
|
+
export { type ApiClient, type BasePagesOptions, type BasePagesResult, type BaseReadOptions, type BaseReadResult, type BaseSubscriptionOptions, type BaseSubscriptionResult, type BaseWriteResult, type ExtractAllSubscriptionEventKeys, type ExtractAllSubscriptionEvents, type ExtractCoreMethodOptions, type ExtractMethodBody, type ExtractMethodData, type ExtractMethodError, type ExtractMethodOptions, type ExtractMethodQuery, type ExtractResponseBody, type ExtractResponseParamNames, type ExtractResponseQuery, type ExtractResponseRequestOptions, type ExtractSubscriptionBody, type ExtractSubscriptionError, type ExtractSubscriptionEvents, type ExtractSubscriptionQuery, type PagesApiClient, type PagesTriggerOptions, type PluginHooksConfig, type QueueApiClient, type QueueTriggerInput, type ReactOptionsMap, type ReadApiClient, type ResponseInputFields, type SpooshReactHooks, type SubscriptionApiClient, type SubscriptionTriggerInput, type TriggerOptions, type TypedAccumulateConfig, type TypedParseConfig, type TypedUseSSEOptions, type UsePagesResult, type UseQueueOptions, type UseQueueResult, type UseReadResult, type UseSSEOptions, type UseSSEOptionsBase, type UseSSEResult, type UseWriteResult, type WriteApiClient, type WriteResponseInputFields, type WriteTriggerInput, create };
|
package/dist/index.js
CHANGED
|
@@ -1017,16 +1017,16 @@ function create(instance) {
|
|
|
1017
1017
|
for (const plugin of plugins) {
|
|
1018
1018
|
plugin.setup?.(setupContext);
|
|
1019
1019
|
}
|
|
1020
|
-
const
|
|
1021
|
-
api,
|
|
1020
|
+
const apiContext = {
|
|
1021
|
+
spoosh: api,
|
|
1022
1022
|
stateManager,
|
|
1023
1023
|
eventEmitter,
|
|
1024
1024
|
pluginExecutor
|
|
1025
1025
|
};
|
|
1026
|
-
const
|
|
1026
|
+
const pluginApis = plugins.reduce(
|
|
1027
1027
|
(acc, plugin) => {
|
|
1028
|
-
if (plugin.
|
|
1029
|
-
return { ...acc, ...plugin.
|
|
1028
|
+
if (plugin.api) {
|
|
1029
|
+
return { ...acc, ...plugin.api(apiContext) };
|
|
1030
1030
|
}
|
|
1031
1031
|
return acc;
|
|
1032
1032
|
},
|
|
@@ -1039,6 +1039,6 @@ function create(instance) {
|
|
|
1039
1039
|
useQueue,
|
|
1040
1040
|
useSubscription,
|
|
1041
1041
|
useSSE,
|
|
1042
|
-
...
|
|
1042
|
+
...pluginApis
|
|
1043
1043
|
};
|
|
1044
1044
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1039,16 +1039,16 @@ function create(instance) {
|
|
|
1039
1039
|
for (const plugin of plugins) {
|
|
1040
1040
|
plugin.setup?.(setupContext);
|
|
1041
1041
|
}
|
|
1042
|
-
const
|
|
1043
|
-
api,
|
|
1042
|
+
const apiContext = {
|
|
1043
|
+
spoosh: api,
|
|
1044
1044
|
stateManager,
|
|
1045
1045
|
eventEmitter,
|
|
1046
1046
|
pluginExecutor
|
|
1047
1047
|
};
|
|
1048
|
-
const
|
|
1048
|
+
const pluginApis = plugins.reduce(
|
|
1049
1049
|
(acc, plugin) => {
|
|
1050
|
-
if (plugin.
|
|
1051
|
-
return { ...acc, ...plugin.
|
|
1050
|
+
if (plugin.api) {
|
|
1051
|
+
return { ...acc, ...plugin.api(apiContext) };
|
|
1052
1052
|
}
|
|
1053
1053
|
return acc;
|
|
1054
1054
|
},
|
|
@@ -1061,7 +1061,7 @@ function create(instance) {
|
|
|
1061
1061
|
useQueue,
|
|
1062
1062
|
useSubscription,
|
|
1063
1063
|
useSSE,
|
|
1064
|
-
...
|
|
1064
|
+
...pluginApis
|
|
1065
1065
|
};
|
|
1066
1066
|
}
|
|
1067
1067
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spoosh/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
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.0",
|
|
38
38
|
"@spoosh/transport-sse": ">=0.1.0",
|
|
39
39
|
"react": "^18 || ^19"
|
|
40
40
|
},
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@testing-library/react": "^16.0.0",
|
|
48
48
|
"jsdom": "^26.0.0",
|
|
49
|
-
"@spoosh/core": "0.
|
|
49
|
+
"@spoosh/core": "0.17.0",
|
|
50
50
|
"@spoosh/transport-sse": "0.1.1",
|
|
51
51
|
"@spoosh/test-utils": "0.3.0"
|
|
52
52
|
},
|