@spoosh/react 0.13.1 → 0.13.3
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 +19 -7
- package/dist/index.d.ts +19 -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, MergePluginInstanceApi, SpooshOptions } from '@spoosh/core';
|
|
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, MergePluginInstanceApi, 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
|
}
|
|
@@ -509,12 +512,17 @@ type ResolvedWriteTriggerOptions<TSchema, TPlugins extends PluginArray, TMethod,
|
|
|
509
512
|
type QueueResolverContext<TSchema, TMethod, TDefaultError> = ResolverContext<TSchema, ExtractMethodData<TMethod>, InferError<ExtractMethodError<TMethod>, TDefaultError>, ExtractMethodQuery<TMethod>, ExtractMethodBody<TMethod>, ExtractResponseParamNames<TMethod> extends never ? never : Record<ExtractResponseParamNames<TMethod>, string | number>>;
|
|
510
513
|
type ResolvedQueueOptions<TSchema, TPlugins extends PluginArray, TMethod, TDefaultError> = ResolveTypes<MergePluginOptions<TPlugins>["queue"], QueueResolverContext<TSchema, TMethod, TDefaultError>>;
|
|
511
514
|
type ResolvedQueueTriggerOptions<TSchema, TPlugins extends PluginArray, TMethod, TDefaultError> = ResolveTypes<MergePluginOptions<TPlugins>["queueTrigger"], QueueResolverContext<TSchema, TMethod, TDefaultError>>;
|
|
515
|
+
type ResolvedReadOptions<TSchema, TPlugins extends PluginArray, TReadFn, TDefaultError> = BaseReadOptions & ResolveTypes<MergePluginOptions<TPlugins>["read"], ResolverContext<TSchema, ExtractMethodData<TReadFn>, InferError<ExtractMethodError<TReadFn>, TDefaultError>, ExtractResponseQuery<TReadFn>, ExtractResponseBody<TReadFn>, ExtractResponseParamNames<TReadFn> extends never ? never : Record<ExtractResponseParamNames<TReadFn>, string | number>>>;
|
|
516
|
+
type StrictOptions<TOptions, TAllowed> = TOptions & {
|
|
517
|
+
[K in keyof TOptions as K extends keyof TAllowed ? never : K]: never;
|
|
518
|
+
};
|
|
512
519
|
type UseReadFn<TDefaultError, TSchema, TPlugins extends PluginArray> = {
|
|
513
|
-
<TReadFn extends (api: ReadApiClient<TSchema, TDefaultError>) => Promise<SpooshResponse<unknown, unknown>>, TReadOpts
|
|
520
|
+
<TReadFn extends (api: ReadApiClient<TSchema, TDefaultError>) => Promise<SpooshResponse<unknown, unknown>>, TReadOpts extends ResolvedReadOptions<TSchema, TPlugins, TReadFn, TDefaultError>>(readFn: TReadFn, readOptions: StrictOptions<TReadOpts, ResolvedReadOptions<TSchema, TPlugins, TReadFn, TDefaultError>>): BaseReadResult<ExtractMethodData<TReadFn>, InferError<ExtractMethodError<TReadFn>, TDefaultError>, ResolveResultTypes<MergePluginResults<TPlugins>["read"], TReadOpts>, TriggerOptions<TReadFn>> & ResponseInputFields<ExtractResponseQuery<TReadFn>, ExtractResponseBody<TReadFn>, ExtractResponseParamNames<TReadFn>>;
|
|
514
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>>;
|
|
515
522
|
};
|
|
516
523
|
type UseWriteFn<TDefaultError, TSchema, TPlugins extends PluginArray> = {
|
|
517
|
-
<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>>;
|
|
518
526
|
};
|
|
519
527
|
type UseQueueFn<TDefaultError, TSchema, TPlugins extends PluginArray> = {
|
|
520
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>>;
|
|
@@ -723,10 +731,14 @@ type SpooshInstanceShape<TApi, TSchema, TDefaultError, TPlugins, TTransports ext
|
|
|
723
731
|
*/
|
|
724
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>;
|
|
725
733
|
|
|
734
|
+
type QueryRequestOptions = CoreRequestOptionsBase;
|
|
735
|
+
type MutationRequestOptions = CoreRequestOptionsBase;
|
|
736
|
+
type ReactOptionsMap = MethodOptionsMap<QueryRequestOptions, MutationRequestOptions>;
|
|
737
|
+
type ApiClient<TSchema> = SpooshClient<TSchema, unknown>;
|
|
726
738
|
type PluginHooksConfig<TPlugins extends readonly SpooshPlugin<PluginTypeConfig>[]> = {
|
|
727
739
|
baseUrl: string;
|
|
728
740
|
defaultOptions?: SpooshOptions;
|
|
729
741
|
plugins: TPlugins;
|
|
730
742
|
};
|
|
731
743
|
|
|
732
|
-
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, MergePluginInstanceApi, SpooshOptions } from '@spoosh/core';
|
|
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, MergePluginInstanceApi, 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
|
}
|
|
@@ -509,12 +512,17 @@ type ResolvedWriteTriggerOptions<TSchema, TPlugins extends PluginArray, TMethod,
|
|
|
509
512
|
type QueueResolverContext<TSchema, TMethod, TDefaultError> = ResolverContext<TSchema, ExtractMethodData<TMethod>, InferError<ExtractMethodError<TMethod>, TDefaultError>, ExtractMethodQuery<TMethod>, ExtractMethodBody<TMethod>, ExtractResponseParamNames<TMethod> extends never ? never : Record<ExtractResponseParamNames<TMethod>, string | number>>;
|
|
510
513
|
type ResolvedQueueOptions<TSchema, TPlugins extends PluginArray, TMethod, TDefaultError> = ResolveTypes<MergePluginOptions<TPlugins>["queue"], QueueResolverContext<TSchema, TMethod, TDefaultError>>;
|
|
511
514
|
type ResolvedQueueTriggerOptions<TSchema, TPlugins extends PluginArray, TMethod, TDefaultError> = ResolveTypes<MergePluginOptions<TPlugins>["queueTrigger"], QueueResolverContext<TSchema, TMethod, TDefaultError>>;
|
|
515
|
+
type ResolvedReadOptions<TSchema, TPlugins extends PluginArray, TReadFn, TDefaultError> = BaseReadOptions & ResolveTypes<MergePluginOptions<TPlugins>["read"], ResolverContext<TSchema, ExtractMethodData<TReadFn>, InferError<ExtractMethodError<TReadFn>, TDefaultError>, ExtractResponseQuery<TReadFn>, ExtractResponseBody<TReadFn>, ExtractResponseParamNames<TReadFn> extends never ? never : Record<ExtractResponseParamNames<TReadFn>, string | number>>>;
|
|
516
|
+
type StrictOptions<TOptions, TAllowed> = TOptions & {
|
|
517
|
+
[K in keyof TOptions as K extends keyof TAllowed ? never : K]: never;
|
|
518
|
+
};
|
|
512
519
|
type UseReadFn<TDefaultError, TSchema, TPlugins extends PluginArray> = {
|
|
513
|
-
<TReadFn extends (api: ReadApiClient<TSchema, TDefaultError>) => Promise<SpooshResponse<unknown, unknown>>, TReadOpts
|
|
520
|
+
<TReadFn extends (api: ReadApiClient<TSchema, TDefaultError>) => Promise<SpooshResponse<unknown, unknown>>, TReadOpts extends ResolvedReadOptions<TSchema, TPlugins, TReadFn, TDefaultError>>(readFn: TReadFn, readOptions: StrictOptions<TReadOpts, ResolvedReadOptions<TSchema, TPlugins, TReadFn, TDefaultError>>): BaseReadResult<ExtractMethodData<TReadFn>, InferError<ExtractMethodError<TReadFn>, TDefaultError>, ResolveResultTypes<MergePluginResults<TPlugins>["read"], TReadOpts>, TriggerOptions<TReadFn>> & ResponseInputFields<ExtractResponseQuery<TReadFn>, ExtractResponseBody<TReadFn>, ExtractResponseParamNames<TReadFn>>;
|
|
514
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>>;
|
|
515
522
|
};
|
|
516
523
|
type UseWriteFn<TDefaultError, TSchema, TPlugins extends PluginArray> = {
|
|
517
|
-
<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>>;
|
|
518
526
|
};
|
|
519
527
|
type UseQueueFn<TDefaultError, TSchema, TPlugins extends PluginArray> = {
|
|
520
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>>;
|
|
@@ -723,10 +731,14 @@ type SpooshInstanceShape<TApi, TSchema, TDefaultError, TPlugins, TTransports ext
|
|
|
723
731
|
*/
|
|
724
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>;
|
|
725
733
|
|
|
734
|
+
type QueryRequestOptions = CoreRequestOptionsBase;
|
|
735
|
+
type MutationRequestOptions = CoreRequestOptionsBase;
|
|
736
|
+
type ReactOptionsMap = MethodOptionsMap<QueryRequestOptions, MutationRequestOptions>;
|
|
737
|
+
type ApiClient<TSchema> = SpooshClient<TSchema, unknown>;
|
|
726
738
|
type PluginHooksConfig<TPlugins extends readonly SpooshPlugin<PluginTypeConfig>[]> = {
|
|
727
739
|
baseUrl: string;
|
|
728
740
|
defaultOptions?: SpooshOptions;
|
|
729
741
|
plugins: TPlugins;
|
|
730
742
|
};
|
|
731
743
|
|
|
732
|
-
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spoosh/react",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React hooks for Spoosh API toolkit",
|
|
6
6
|
"keywords": [
|
|
@@ -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.16.0",
|
|
50
49
|
"@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": {
|
|
@@ -55,6 +55,6 @@
|
|
|
55
55
|
"build": "tsup",
|
|
56
56
|
"typecheck": "tsc --noEmit",
|
|
57
57
|
"lint": "eslint src --max-warnings 0",
|
|
58
|
-
"format": "prettier --write 'src/**/*.ts'"
|
|
58
|
+
"format": "prettier --write 'src/**/*.ts' '*.md'"
|
|
59
59
|
}
|
|
60
60
|
}
|