@spoosh/core 0.15.0 → 0.16.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 +440 -48
- package/dist/index.d.ts +440 -48
- package/dist/index.js +259 -4
- package/dist/index.mjs +259 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -412,6 +412,51 @@ interface RequestCompleteEvent {
|
|
|
412
412
|
context: PluginContext;
|
|
413
413
|
queryKey: string;
|
|
414
414
|
}
|
|
415
|
+
/** Event emitted when a subscription starts connecting */
|
|
416
|
+
interface SubscriptionConnectEvent {
|
|
417
|
+
subscriptionId: string;
|
|
418
|
+
channel: string;
|
|
419
|
+
transport: string;
|
|
420
|
+
connectionUrl: string;
|
|
421
|
+
queryKey: string;
|
|
422
|
+
timestamp: number;
|
|
423
|
+
/** Event types being listened to. Empty or ["*"] means all events. */
|
|
424
|
+
listenedEvents?: string[];
|
|
425
|
+
}
|
|
426
|
+
/** Event emitted when a subscription successfully connects */
|
|
427
|
+
interface SubscriptionConnectedEvent {
|
|
428
|
+
subscriptionId: string;
|
|
429
|
+
timestamp: number;
|
|
430
|
+
}
|
|
431
|
+
/** Event emitted when a subscription receives a message */
|
|
432
|
+
interface SubscriptionMessageEvent {
|
|
433
|
+
subscriptionId: string;
|
|
434
|
+
messageId: string;
|
|
435
|
+
eventType: string;
|
|
436
|
+
rawData: unknown;
|
|
437
|
+
accumulatedData: Record<string, unknown>;
|
|
438
|
+
timestamp: number;
|
|
439
|
+
}
|
|
440
|
+
/** Event emitted when a subscription encounters an error */
|
|
441
|
+
interface SubscriptionErrorEvent {
|
|
442
|
+
subscriptionId: string;
|
|
443
|
+
error: Error;
|
|
444
|
+
retryCount: number;
|
|
445
|
+
timestamp: number;
|
|
446
|
+
}
|
|
447
|
+
/** Event emitted when a subscription disconnects */
|
|
448
|
+
interface SubscriptionDisconnectEvent {
|
|
449
|
+
subscriptionId: string;
|
|
450
|
+
reason: string;
|
|
451
|
+
timestamp: number;
|
|
452
|
+
}
|
|
453
|
+
/** Event emitted when hook-level accumulation updates data */
|
|
454
|
+
interface SubscriptionAccumulateEvent {
|
|
455
|
+
queryKey: string;
|
|
456
|
+
eventType: string;
|
|
457
|
+
accumulatedData: Record<string, unknown>;
|
|
458
|
+
timestamp: number;
|
|
459
|
+
}
|
|
415
460
|
/**
|
|
416
461
|
* Internal events used by core and devtools. Not for public use.
|
|
417
462
|
* @internal
|
|
@@ -419,6 +464,12 @@ interface RequestCompleteEvent {
|
|
|
419
464
|
interface DevtoolEvents {
|
|
420
465
|
"spoosh:devtool-event": StandaloneEvent;
|
|
421
466
|
"spoosh:request-complete": RequestCompleteEvent;
|
|
467
|
+
"spoosh:subscription:connect": SubscriptionConnectEvent;
|
|
468
|
+
"spoosh:subscription:connected": SubscriptionConnectedEvent;
|
|
469
|
+
"spoosh:subscription:message": SubscriptionMessageEvent;
|
|
470
|
+
"spoosh:subscription:error": SubscriptionErrorEvent;
|
|
471
|
+
"spoosh:subscription:disconnect": SubscriptionDisconnectEvent;
|
|
472
|
+
"spoosh:subscription:accumulate": SubscriptionAccumulateEvent;
|
|
422
473
|
}
|
|
423
474
|
/**
|
|
424
475
|
* Event tracer API for standalone events not tied to a request lifecycle.
|
|
@@ -437,7 +488,42 @@ interface EventTracer {
|
|
|
437
488
|
emit(msg: string, options?: EventOptions): void;
|
|
438
489
|
}
|
|
439
490
|
|
|
440
|
-
|
|
491
|
+
interface SpooshTransport<TOptions = unknown, TMessage = unknown> {
|
|
492
|
+
name: string;
|
|
493
|
+
operationType: OperationType;
|
|
494
|
+
connect(url: string, options?: TOptions): Promise<void>;
|
|
495
|
+
disconnect(): Promise<void>;
|
|
496
|
+
subscribe(channel: string, callback: (message: TMessage) => void): () => void;
|
|
497
|
+
send(channel: string, message: TMessage): Promise<void>;
|
|
498
|
+
isConnected(): boolean;
|
|
499
|
+
}
|
|
500
|
+
interface SpooshTransportRegistry {
|
|
501
|
+
}
|
|
502
|
+
type TransportName = keyof SpooshTransportRegistry;
|
|
503
|
+
interface SubscriptionContext<TData = unknown, TError = unknown> extends PluginContext {
|
|
504
|
+
channel: string;
|
|
505
|
+
message?: unknown;
|
|
506
|
+
onData?: (data: TData) => void;
|
|
507
|
+
onError?: (error: TError) => void;
|
|
508
|
+
onDisconnect?: () => void;
|
|
509
|
+
registerUnsubscribers?: (unsubscribers: Array<() => void>) => void;
|
|
510
|
+
}
|
|
511
|
+
interface SubscriptionAdapter<TData = unknown, TError = unknown> {
|
|
512
|
+
subscribe(context: SubscriptionContext<TData, TError>): Promise<SubscriptionHandle<TData, TError>>;
|
|
513
|
+
emit(context: SubscriptionContext<TData, TError>): Promise<{
|
|
514
|
+
success: boolean;
|
|
515
|
+
error?: TError;
|
|
516
|
+
}>;
|
|
517
|
+
}
|
|
518
|
+
interface SubscriptionHandle<TData = unknown, TError = unknown> {
|
|
519
|
+
unsubscribe(): void;
|
|
520
|
+
getData(): TData | undefined;
|
|
521
|
+
getError(): TError | undefined;
|
|
522
|
+
onData(callback: (data: TData) => void): () => void;
|
|
523
|
+
onError(callback: (error: TError) => void): () => void;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
type OperationType = "read" | "write" | "pages" | "queue" | (string & {});
|
|
441
527
|
type LifecyclePhase = "onMount" | "onUnmount" | "onUpdate";
|
|
442
528
|
type OperationState<TData = unknown, TError = unknown> = {
|
|
443
529
|
data: TData | undefined;
|
|
@@ -604,9 +690,12 @@ type PluginTypeConfig = {
|
|
|
604
690
|
writeTriggerOptions?: object;
|
|
605
691
|
queueOptions?: object;
|
|
606
692
|
queueTriggerOptions?: object;
|
|
693
|
+
subscribeOptions?: object;
|
|
694
|
+
subscribeTriggerOptions?: object;
|
|
607
695
|
readResult?: object;
|
|
608
696
|
writeResult?: object;
|
|
609
697
|
queueResult?: object;
|
|
698
|
+
subscribeResult?: object;
|
|
610
699
|
instanceApi?: object;
|
|
611
700
|
};
|
|
612
701
|
/**
|
|
@@ -702,6 +791,22 @@ interface SpooshPlugin<T extends PluginTypeConfig = PluginTypeConfig> {
|
|
|
702
791
|
instanceApi?: (context: InstanceApiContext) => T extends {
|
|
703
792
|
instanceApi: infer A;
|
|
704
793
|
} ? A : object;
|
|
794
|
+
/**
|
|
795
|
+
* Wrap a subscription adapter to add plugin behavior (e.g., caching, retry, logging).
|
|
796
|
+
* Called for subscription operations to compose adapter functionality.
|
|
797
|
+
*
|
|
798
|
+
* @example
|
|
799
|
+
* ```ts
|
|
800
|
+
* wrapAdapter: (inner) => ({
|
|
801
|
+
* subscribe: async (ctx) => {
|
|
802
|
+
* // Add caching logic
|
|
803
|
+
* return inner.subscribe(ctx);
|
|
804
|
+
* },
|
|
805
|
+
* emit: inner.emit,
|
|
806
|
+
* })
|
|
807
|
+
* ```
|
|
808
|
+
*/
|
|
809
|
+
wrapAdapter?: (inner: SubscriptionAdapter) => SubscriptionAdapter;
|
|
705
810
|
/**
|
|
706
811
|
* Plugin execution priority. Lower numbers run first, higher numbers run last.
|
|
707
812
|
* Default: 0
|
|
@@ -937,6 +1042,8 @@ type PluginExecutor = {
|
|
|
937
1042
|
executeUpdateLifecycle: (operationType: OperationType, context: PluginContext, previousContext: PluginContext) => Promise<void>;
|
|
938
1043
|
executeMiddleware: (operationType: OperationType, context: PluginContext, coreFetch: () => Promise<SpooshResponse<any, any>>) => Promise<SpooshResponse<any, any>>;
|
|
939
1044
|
getPlugins: () => readonly SpooshPlugin[];
|
|
1045
|
+
/** Get plugins that support a specific operation type */
|
|
1046
|
+
getPluginsForOperation: (operationType: OperationType) => readonly SpooshPlugin[];
|
|
940
1047
|
/** Creates a full PluginContext with plugins accessor */
|
|
941
1048
|
createContext: (input: PluginContextInput) => PluginContext;
|
|
942
1049
|
/**
|
|
@@ -1044,6 +1151,9 @@ type ExtractQueueTriggerOptions<T> = T extends SpooshPlugin<infer Types> ? Types
|
|
|
1044
1151
|
type ExtractQueueResult<T> = T extends SpooshPlugin<infer Types> ? Types extends {
|
|
1045
1152
|
queueResult: infer Q;
|
|
1046
1153
|
} ? Q : object : object;
|
|
1154
|
+
type ExtractSubscribeResult<T> = T extends SpooshPlugin<infer Types> ? Types extends {
|
|
1155
|
+
subscribeResult: infer S;
|
|
1156
|
+
} ? S : object : object;
|
|
1047
1157
|
type ExtractReadResult<T> = T extends SpooshPlugin<infer Types> ? Types extends {
|
|
1048
1158
|
readResult: infer R;
|
|
1049
1159
|
} ? R : object : object;
|
|
@@ -1053,31 +1163,42 @@ type ExtractWriteResult<T> = T extends SpooshPlugin<infer Types> ? Types extends
|
|
|
1053
1163
|
type ExtractInstanceApi<T> = T extends SpooshPlugin<infer Types> ? Types extends {
|
|
1054
1164
|
instanceApi: infer A;
|
|
1055
1165
|
} ? A : object : object;
|
|
1056
|
-
type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
|
1166
|
+
type UnionToIntersection$1<U> = (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
|
1057
1167
|
type MergePluginOptions<TPlugins extends readonly SpooshPlugin<PluginTypeConfig>[]> = {
|
|
1058
|
-
read: UnionToIntersection<ExtractReadOptions<TPlugins[number]>>;
|
|
1059
|
-
write: UnionToIntersection<ExtractWriteOptions<TPlugins[number]>>;
|
|
1060
|
-
pages: UnionToIntersection<ExtractPagesOptions<TPlugins[number]>>;
|
|
1061
|
-
writeTrigger: UnionToIntersection<ExtractWriteTriggerOptions<TPlugins[number]>>;
|
|
1062
|
-
queue: UnionToIntersection<ExtractQueueOptions<TPlugins[number]>>;
|
|
1063
|
-
queueTrigger: UnionToIntersection<ExtractQueueTriggerOptions<TPlugins[number]>>;
|
|
1168
|
+
read: UnionToIntersection$1<ExtractReadOptions<TPlugins[number]>>;
|
|
1169
|
+
write: UnionToIntersection$1<ExtractWriteOptions<TPlugins[number]>>;
|
|
1170
|
+
pages: UnionToIntersection$1<ExtractPagesOptions<TPlugins[number]>>;
|
|
1171
|
+
writeTrigger: UnionToIntersection$1<ExtractWriteTriggerOptions<TPlugins[number]>>;
|
|
1172
|
+
queue: UnionToIntersection$1<ExtractQueueOptions<TPlugins[number]>>;
|
|
1173
|
+
queueTrigger: UnionToIntersection$1<ExtractQueueTriggerOptions<TPlugins[number]>>;
|
|
1064
1174
|
};
|
|
1065
1175
|
type MergePluginResults<TPlugins extends readonly SpooshPlugin<PluginTypeConfig>[]> = {
|
|
1066
|
-
read: UnionToIntersection<ExtractReadResult<TPlugins[number]>>;
|
|
1067
|
-
write: UnionToIntersection<ExtractWriteResult<TPlugins[number]>>;
|
|
1068
|
-
queue: UnionToIntersection<ExtractQueueResult<TPlugins[number]>>;
|
|
1176
|
+
read: UnionToIntersection$1<ExtractReadResult<TPlugins[number]>>;
|
|
1177
|
+
write: UnionToIntersection$1<ExtractWriteResult<TPlugins[number]>>;
|
|
1178
|
+
queue: UnionToIntersection$1<ExtractQueueResult<TPlugins[number]>>;
|
|
1179
|
+
subscribe: UnionToIntersection$1<ExtractSubscribeResult<TPlugins[number]>>;
|
|
1069
1180
|
};
|
|
1070
|
-
type MergePluginInstanceApi<TPlugins extends readonly SpooshPlugin<PluginTypeConfig>[], TSchema = unknown> = ResolveInstanceApi<UnionToIntersection<ExtractInstanceApi<TPlugins[number]>>, TSchema, MergePluginOptions<TPlugins>["read"]>;
|
|
1181
|
+
type MergePluginInstanceApi<TPlugins extends readonly SpooshPlugin<PluginTypeConfig>[], TSchema = unknown> = ResolveInstanceApi<UnionToIntersection$1<ExtractInstanceApi<TPlugins[number]>>, TSchema, MergePluginOptions<TPlugins>["read"]>;
|
|
1071
1182
|
type PluginRegistry<TPlugins extends SpooshPlugin<PluginTypeConfig>[]> = {
|
|
1072
1183
|
plugins: TPlugins;
|
|
1073
1184
|
_options: MergePluginOptions<TPlugins>;
|
|
1074
1185
|
};
|
|
1075
1186
|
declare function createPluginRegistry<TPlugins extends SpooshPlugin<PluginTypeConfig>[]>(plugins: [...TPlugins]): PluginRegistry<TPlugins>;
|
|
1076
1187
|
|
|
1188
|
+
/**
|
|
1189
|
+
* Registry for subscription methods. Transports extend via module augmentation.
|
|
1190
|
+
*/
|
|
1191
|
+
interface SpooshSubscriptionMethodRegistry {
|
|
1192
|
+
}
|
|
1193
|
+
type SubscriptionMethod = keyof SpooshSubscriptionMethodRegistry;
|
|
1194
|
+
type AnyMethod = HttpMethod | SubscriptionMethod;
|
|
1077
1195
|
/**
|
|
1078
1196
|
* An API schema where routes are defined as string keys with path patterns.
|
|
1079
1197
|
* Define data, body, query, and error directly on each method.
|
|
1080
1198
|
*
|
|
1199
|
+
* For subscription endpoints (SSE, WebSocket), define the `events` field instead of `data`.
|
|
1200
|
+
* The transport to use is determined by the hook (useSSE, useWebSocket), not the path.
|
|
1201
|
+
*
|
|
1081
1202
|
* @example
|
|
1082
1203
|
* ```ts
|
|
1083
1204
|
* type ApiSchema = {
|
|
@@ -1090,22 +1211,69 @@ declare function createPluginRegistry<TPlugins extends SpooshPlugin<PluginTypeCo
|
|
|
1090
1211
|
* PUT: { data: Post; body: UpdatePostBody };
|
|
1091
1212
|
* DELETE: { data: void };
|
|
1092
1213
|
* };
|
|
1093
|
-
* "
|
|
1094
|
-
* GET: {
|
|
1214
|
+
* "notifications": {
|
|
1215
|
+
* GET: {
|
|
1216
|
+
* events: {
|
|
1217
|
+
* alert: { data: Alert };
|
|
1218
|
+
* message: { data: Message };
|
|
1219
|
+
* };
|
|
1220
|
+
* query?: { userId: string };
|
|
1221
|
+
* };
|
|
1095
1222
|
* };
|
|
1096
1223
|
* };
|
|
1097
1224
|
* ```
|
|
1098
1225
|
*/
|
|
1226
|
+
/**
|
|
1227
|
+
* HTTP endpoint method config.
|
|
1228
|
+
*/
|
|
1229
|
+
type HttpMethodConfig = {
|
|
1230
|
+
data?: unknown;
|
|
1231
|
+
body?: unknown;
|
|
1232
|
+
query?: unknown;
|
|
1233
|
+
error?: unknown;
|
|
1234
|
+
};
|
|
1235
|
+
/**
|
|
1236
|
+
* Subscription endpoint method config (SSE, WebSocket, etc.).
|
|
1237
|
+
* Has events field instead of data.
|
|
1238
|
+
*/
|
|
1239
|
+
type SubscriptionMethodConfig = {
|
|
1240
|
+
events?: Record<string, {
|
|
1241
|
+
data: unknown;
|
|
1242
|
+
}>;
|
|
1243
|
+
body?: unknown;
|
|
1244
|
+
query?: unknown;
|
|
1245
|
+
error?: unknown;
|
|
1246
|
+
};
|
|
1247
|
+
/**
|
|
1248
|
+
* Endpoint config - supports both HTTP and subscription methods.
|
|
1249
|
+
* Subscription endpoints are those with an `events` field, HTTP endpoints have `data`.
|
|
1250
|
+
*/
|
|
1251
|
+
type EndpointConfig = {
|
|
1252
|
+
[M in HttpMethod | SubscriptionMethod]?: HttpMethodConfig | SubscriptionMethodConfig;
|
|
1253
|
+
};
|
|
1254
|
+
/**
|
|
1255
|
+
* Base API schema type.
|
|
1256
|
+
*/
|
|
1099
1257
|
type ApiSchema = {
|
|
1100
1258
|
[path: string]: {
|
|
1101
|
-
[method
|
|
1102
|
-
data?: unknown;
|
|
1103
|
-
body?: unknown;
|
|
1104
|
-
query?: unknown;
|
|
1105
|
-
error?: unknown;
|
|
1106
|
-
};
|
|
1259
|
+
[method: string]: unknown;
|
|
1107
1260
|
};
|
|
1108
1261
|
};
|
|
1262
|
+
/**
|
|
1263
|
+
* Helper type for defining API schemas with proper autocomplete.
|
|
1264
|
+
* Use `events` field for subscription endpoints, `data` field for HTTP endpoints.
|
|
1265
|
+
*
|
|
1266
|
+
* @example
|
|
1267
|
+
* ```ts
|
|
1268
|
+
* type MyApi = SpooshSchema<{
|
|
1269
|
+
* "posts": { GET: { data: Post[] } };
|
|
1270
|
+
* "chat": { GET: { events: { message: { data: string } } } };
|
|
1271
|
+
* }>;
|
|
1272
|
+
* ```
|
|
1273
|
+
*/
|
|
1274
|
+
type SpooshSchema<T extends {
|
|
1275
|
+
[K in keyof T]: EndpointConfig;
|
|
1276
|
+
}> = T;
|
|
1109
1277
|
/**
|
|
1110
1278
|
* Extract data type from an endpoint.
|
|
1111
1279
|
*/
|
|
@@ -1130,28 +1298,6 @@ type ExtractQuery$1<T> = T extends {
|
|
|
1130
1298
|
type ExtractError<T, TDefault = unknown> = T extends {
|
|
1131
1299
|
error: infer E;
|
|
1132
1300
|
} ? E : TDefault;
|
|
1133
|
-
/**
|
|
1134
|
-
* Helper type to define a type-safe API schema.
|
|
1135
|
-
* Use this to get type checking on your schema definition.
|
|
1136
|
-
*
|
|
1137
|
-
* @example
|
|
1138
|
-
* ```ts
|
|
1139
|
-
* type ApiSchema = SpooshSchema<{
|
|
1140
|
-
* "posts": {
|
|
1141
|
-
* GET: { data: Post[] };
|
|
1142
|
-
* POST: { data: Post; body: CreatePostBody };
|
|
1143
|
-
* };
|
|
1144
|
-
* "posts/:id": {
|
|
1145
|
-
* GET: { data: Post };
|
|
1146
|
-
* PUT: { data: Post; body: UpdatePostBody };
|
|
1147
|
-
* DELETE: { data: void };
|
|
1148
|
-
* };
|
|
1149
|
-
* }>;
|
|
1150
|
-
*
|
|
1151
|
-
* const api = createClient<ApiSchema>({ baseUrl: "/api" });
|
|
1152
|
-
* ```
|
|
1153
|
-
*/
|
|
1154
|
-
type SpooshSchema<T extends ApiSchema> = T;
|
|
1155
1301
|
/**
|
|
1156
1302
|
* Convert a route pattern like "posts/:id" to a path matcher pattern like `posts/${string}`.
|
|
1157
1303
|
* This enables TypeScript to match actual paths like "posts/123" to their schema definitions.
|
|
@@ -1219,6 +1365,24 @@ type HasReadMethod<TSchema, TPath extends string> = FindMatchingKey<TSchema, TPa
|
|
|
1219
1365
|
* Check if a schema path has any write methods.
|
|
1220
1366
|
*/
|
|
1221
1367
|
type HasWriteMethod<TSchema, TPath extends string> = FindMatchingKey<TSchema, TPath> extends infer TKey ? TKey extends keyof TSchema ? WriteMethod extends never ? false : Extract<keyof TSchema[TKey], WriteMethod> extends never ? false : true : false : false;
|
|
1368
|
+
/**
|
|
1369
|
+
* Extract paths that have methods with events (subscription endpoints).
|
|
1370
|
+
*/
|
|
1371
|
+
type SubscriptionPaths<TSchema> = {
|
|
1372
|
+
[K in keyof TSchema & string]: {
|
|
1373
|
+
[M in keyof TSchema[K]]: TSchema[K][M] extends {
|
|
1374
|
+
events: unknown;
|
|
1375
|
+
} ? K : never;
|
|
1376
|
+
}[keyof TSchema[K]] extends never ? never : K;
|
|
1377
|
+
}[keyof TSchema & string];
|
|
1378
|
+
/**
|
|
1379
|
+
* Check if a schema path has any method with events field.
|
|
1380
|
+
*/
|
|
1381
|
+
type HasSubscriptionMethod<TSchema, TPath extends string> = FindMatchingKey<TSchema, TPath> extends infer TKey ? TKey extends keyof TSchema ? {
|
|
1382
|
+
[M in keyof TSchema[TKey]]: TSchema[TKey][M] extends {
|
|
1383
|
+
events: unknown;
|
|
1384
|
+
} ? true : never;
|
|
1385
|
+
}[keyof TSchema[TKey]] extends never ? false : true : false : false;
|
|
1222
1386
|
type NormalizePrefix<T extends string> = T extends `/${infer Rest}` ? NormalizePrefix<Rest> : T extends `${infer Rest}/` ? NormalizePrefix<Rest> : T;
|
|
1223
1387
|
type StripPrefixFromPath<TPath extends string, TPrefix extends string> = TPath extends TPrefix ? "" : TPath extends `${TPrefix}/${infer Rest}` ? Rest : TPath;
|
|
1224
1388
|
/**
|
|
@@ -1311,12 +1475,103 @@ type WritePathMethods$1<TSchema, TPath extends string> = FindMatchingKey<TSchema
|
|
|
1311
1475
|
*/
|
|
1312
1476
|
type WriteSchemaHelper<TSchema> = <TPath extends WritePaths<TSchema> | (string & {})>(path: TPath) => HasWriteMethod<TSchema, TPath> extends true ? WritePathMethods$1<TSchema, TPath> : never;
|
|
1313
1477
|
|
|
1478
|
+
/**
|
|
1479
|
+
* Check for exact type equality using function type assignability.
|
|
1480
|
+
* Two types are equal if functions returning them are mutually assignable.
|
|
1481
|
+
*/
|
|
1482
|
+
type Equals<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false;
|
|
1483
|
+
/**
|
|
1484
|
+
* Convert bare `object` type to `never` to exclude it from the union.
|
|
1485
|
+
* Preserves all other types including interfaces and types with actual properties.
|
|
1486
|
+
*/
|
|
1487
|
+
type FilterObjectType<T> = Equals<T, object> extends true ? never : T;
|
|
1488
|
+
/**
|
|
1489
|
+
* Convert a union type to an intersection type.
|
|
1490
|
+
* This merges all properties from all types in the union.
|
|
1491
|
+
*/
|
|
1492
|
+
type UnionToIntersection<U> = (U extends unknown ? (arg: U) => void : never) extends (arg: infer I) => void ? I : never;
|
|
1493
|
+
/**
|
|
1494
|
+
* Extract all option types from plugin configuration and create a union, then intersect.
|
|
1495
|
+
* This allows middleware to access all properties from all option types.
|
|
1496
|
+
* object types are converted to unknown which doesn't affect the intersection.
|
|
1497
|
+
*/
|
|
1498
|
+
type ExtractPluginOptionsUnion<T extends PluginTypeConfig> = UnionToIntersection<FilterObjectType<T extends {
|
|
1499
|
+
readOptions: infer R;
|
|
1500
|
+
} ? R : never> | FilterObjectType<T extends {
|
|
1501
|
+
writeOptions: infer W;
|
|
1502
|
+
} ? W : never> | FilterObjectType<T extends {
|
|
1503
|
+
writeTriggerOptions: infer WT;
|
|
1504
|
+
} ? WT : never> | FilterObjectType<T extends {
|
|
1505
|
+
queueTriggerOptions: infer QT;
|
|
1506
|
+
} ? QT : never> | FilterObjectType<T extends {
|
|
1507
|
+
pagesOptions: infer P;
|
|
1508
|
+
} ? P : never> | FilterObjectType<T extends {
|
|
1509
|
+
queueOptions: infer Q;
|
|
1510
|
+
} ? Q : never>>;
|
|
1511
|
+
/**
|
|
1512
|
+
* Plugin context with typed pluginOptions based on plugin configuration.
|
|
1513
|
+
*/
|
|
1514
|
+
type TypedPluginContext<T extends PluginTypeConfig> = Omit<PluginContext, "pluginOptions"> & {
|
|
1515
|
+
pluginOptions?: ExtractPluginOptionsUnion<T>;
|
|
1516
|
+
};
|
|
1517
|
+
/**
|
|
1518
|
+
* Plugin definition with typed context for middleware and handlers.
|
|
1519
|
+
*/
|
|
1520
|
+
type TypedPluginDefinition<T extends PluginTypeConfig> = Omit<SpooshPlugin<T>, "middleware" | "afterResponse" | "lifecycle"> & {
|
|
1521
|
+
middleware?: (context: TypedPluginContext<T>, next: () => Promise<any>) => Promise<any>;
|
|
1522
|
+
afterResponse?: (context: TypedPluginContext<T>, response: any) => any;
|
|
1523
|
+
lifecycle?: {
|
|
1524
|
+
onMount?: (context: TypedPluginContext<T>) => void | Promise<void>;
|
|
1525
|
+
onUpdate?: (context: TypedPluginContext<T>, previousContext: TypedPluginContext<T>) => void | Promise<void>;
|
|
1526
|
+
onUnmount?: (context: TypedPluginContext<T>) => void | Promise<void>;
|
|
1527
|
+
};
|
|
1528
|
+
};
|
|
1529
|
+
/**
|
|
1530
|
+
* Helper to create a Spoosh plugin with automatic type inference for plugin options.
|
|
1531
|
+
*
|
|
1532
|
+
* This eliminates the need for manual type assertions in middleware by automatically
|
|
1533
|
+
* intersecting all option types, making all properties accessible:
|
|
1534
|
+
*
|
|
1535
|
+
* ```ts
|
|
1536
|
+
* // Before:
|
|
1537
|
+
* const pluginOptions = context.pluginOptions as CacheReadOptions | undefined;
|
|
1538
|
+
* const staleTime = pluginOptions?.staleTime ?? defaultStaleTime;
|
|
1539
|
+
*
|
|
1540
|
+
* // After (with createSpooshPlugin):
|
|
1541
|
+
* const staleTime = context.pluginOptions?.staleTime ?? defaultStaleTime;
|
|
1542
|
+
* ```
|
|
1543
|
+
*
|
|
1544
|
+
* @typeParam T - Plugin type configuration (readOptions, writeOptions, etc.)
|
|
1545
|
+
* @param definition - Plugin definition with typed context
|
|
1546
|
+
* @returns Typed Spoosh plugin
|
|
1547
|
+
*
|
|
1548
|
+
* @example
|
|
1549
|
+
* ```ts
|
|
1550
|
+
* export const cachePlugin = (config: CachePluginConfig = {}) =>
|
|
1551
|
+
* createSpooshPlugin<{
|
|
1552
|
+
* readOptions: CacheReadOptions;
|
|
1553
|
+
* writeOptions: CacheWriteOptions;
|
|
1554
|
+
* pagesOptions: CachePagesOptions;
|
|
1555
|
+
* }>({
|
|
1556
|
+
* name: "spoosh:cache",
|
|
1557
|
+
* operations: ["read", "write", "pages"],
|
|
1558
|
+
* middleware: async (context, next) => {
|
|
1559
|
+
* // context.pluginOptions is automatically typed as an intersection:
|
|
1560
|
+
* // CacheReadOptions & CachePagesOptions (CacheWriteOptions filtered as it's just 'object')
|
|
1561
|
+
* // All properties from all option types are accessible:
|
|
1562
|
+
* const staleTime = context.pluginOptions?.staleTime ?? defaultStaleTime;
|
|
1563
|
+
* return next();
|
|
1564
|
+
* },
|
|
1565
|
+
* });
|
|
1566
|
+
* ```
|
|
1567
|
+
*/
|
|
1568
|
+
declare function createSpooshPlugin<T extends PluginTypeConfig>(definition: TypedPluginDefinition<T>): SpooshPlugin<T>;
|
|
1569
|
+
|
|
1314
1570
|
/**
|
|
1315
1571
|
* Base request options available on all methods.
|
|
1316
1572
|
*/
|
|
1317
1573
|
type BaseRequestOptions = {
|
|
1318
1574
|
headers?: HeadersInitOrGetter;
|
|
1319
|
-
cache?: RequestCache;
|
|
1320
1575
|
signal?: AbortSignal;
|
|
1321
1576
|
};
|
|
1322
1577
|
/**
|
|
@@ -1469,6 +1724,79 @@ type QueueSelectorPathMethods<TSchema, TPath extends string, TDefaultError> = Fi
|
|
|
1469
1724
|
* Used by useQueue for selecting endpoints. All input goes to trigger().
|
|
1470
1725
|
*/
|
|
1471
1726
|
type QueueSelectorClient<TSchema, TDefaultError = unknown> = <TPath extends SchemaPaths<TSchema> | (string & {})>(path: TPath) => QueueSelectorPathMethods<TSchema, TPath, TDefaultError>;
|
|
1727
|
+
/**
|
|
1728
|
+
* Extract events type from a method config.
|
|
1729
|
+
*/
|
|
1730
|
+
type ExtractEvents<T> = T extends {
|
|
1731
|
+
events: infer E;
|
|
1732
|
+
} ? E : never;
|
|
1733
|
+
/**
|
|
1734
|
+
* Transport-specific options for subscriptions.
|
|
1735
|
+
*/
|
|
1736
|
+
type SubscriptionTransportOptions = {
|
|
1737
|
+
/** Keep connection alive when browser tab is hidden. Defaults to true. */
|
|
1738
|
+
openWhenHidden?: boolean;
|
|
1739
|
+
};
|
|
1740
|
+
/**
|
|
1741
|
+
* Strict subscription request options (for GET method).
|
|
1742
|
+
* Body/query are required if schema requires them.
|
|
1743
|
+
* Note: Transport options (maxRetries, retryDelay, events, parse, accumulate)
|
|
1744
|
+
* are now configured at the hook level (useSSE).
|
|
1745
|
+
*/
|
|
1746
|
+
type StrictSubscriptionRequestOptions<TMethodConfig, TUserPath extends string, TRequestedEvents extends readonly (keyof ExtractEvents<TMethodConfig>)[] = readonly (keyof ExtractEvents<TMethodConfig>)[]> = Simplify<BaseRequestOptions & QueryOption<TMethodConfig> & BodyOption<TMethodConfig> & ParamsOption<TUserPath> & SubscriptionTransportOptions>;
|
|
1747
|
+
/**
|
|
1748
|
+
* Loose subscription request options (for POST/PUT/etc methods).
|
|
1749
|
+
* Body/query are always optional since they're provided via trigger().
|
|
1750
|
+
* Note: Transport options (maxRetries, retryDelay, events, parse, accumulate)
|
|
1751
|
+
* are now configured at the hook level (useSSE).
|
|
1752
|
+
*/
|
|
1753
|
+
type LooseSubscriptionRequestOptions<TMethodConfig, TUserPath extends string, TRequestedEvents extends readonly (keyof ExtractEvents<TMethodConfig>)[] = readonly (keyof ExtractEvents<TMethodConfig>)[]> = Simplify<BaseRequestOptions & {
|
|
1754
|
+
query?: ExtractQuery<TMethodConfig>;
|
|
1755
|
+
} & {
|
|
1756
|
+
body?: ExtractBody<TMethodConfig> | SpooshBody<ExtractBody<TMethodConfig>>;
|
|
1757
|
+
} & ParamsOption<TUserPath> & SubscriptionTransportOptions>;
|
|
1758
|
+
/**
|
|
1759
|
+
* Check if strict subscription options are required (for GET method).
|
|
1760
|
+
*/
|
|
1761
|
+
type IsStrictSubscriptionOptionsRequired<TMethodConfig, TUserPath extends string> = IsBodyRequired<TMethodConfig> extends true ? true : IsQueryRequired<TMethodConfig> extends true ? true : HasParams<TUserPath> extends true ? true : false;
|
|
1762
|
+
/**
|
|
1763
|
+
* Subscription response type that carries event types.
|
|
1764
|
+
*/
|
|
1765
|
+
type SubscriptionResponse<TMethodConfig, TRequestedEvents extends readonly (keyof ExtractEvents<TMethodConfig>)[] = readonly (keyof ExtractEvents<TMethodConfig>)[]> = {
|
|
1766
|
+
_subscription: true;
|
|
1767
|
+
events: ExtractEvents<TMethodConfig>;
|
|
1768
|
+
requestedEvents: TRequestedEvents;
|
|
1769
|
+
query: ExtractQuery<TMethodConfig>;
|
|
1770
|
+
body: ExtractBody<TMethodConfig>;
|
|
1771
|
+
error: ExtractError<TMethodConfig>;
|
|
1772
|
+
};
|
|
1773
|
+
type BaseSubscriptionResponse<TEvents extends Record<string, unknown> = Record<string, unknown>, TError = unknown> = {
|
|
1774
|
+
_subscription: true;
|
|
1775
|
+
events: TEvents;
|
|
1776
|
+
requestedEvents: readonly string[];
|
|
1777
|
+
query: unknown;
|
|
1778
|
+
body: unknown;
|
|
1779
|
+
error: TError;
|
|
1780
|
+
};
|
|
1781
|
+
/**
|
|
1782
|
+
* Subscription method function type - methods with events field.
|
|
1783
|
+
* GET: Strict typing (body/query required if schema requires)
|
|
1784
|
+
* POST/PUT/etc: Loose typing (body/query always optional, passed to trigger)
|
|
1785
|
+
*/
|
|
1786
|
+
type SubscriptionMethodFn<TMethodConfig, TUserPath extends string, TMethod extends string> = TMethod extends "GET" ? IsStrictSubscriptionOptionsRequired<TMethodConfig, TUserPath> extends true ? <TRequestedEvents extends readonly (keyof ExtractEvents<TMethodConfig>)[]>(options: StrictSubscriptionRequestOptions<TMethodConfig, TUserPath, TRequestedEvents>) => SubscriptionResponse<TMethodConfig, TRequestedEvents> : <TRequestedEvents extends readonly (keyof ExtractEvents<TMethodConfig>)[]>(options?: StrictSubscriptionRequestOptions<TMethodConfig, TUserPath, TRequestedEvents>) => SubscriptionResponse<TMethodConfig, TRequestedEvents> : <TRequestedEvents extends readonly (keyof ExtractEvents<TMethodConfig>)[]>(options?: LooseSubscriptionRequestOptions<TMethodConfig, TUserPath, TRequestedEvents>) => SubscriptionResponse<TMethodConfig, TRequestedEvents>;
|
|
1787
|
+
/**
|
|
1788
|
+
* Subscription path methods - only methods with events field.
|
|
1789
|
+
*/
|
|
1790
|
+
type SubscriptionPathMethods<TSchema, TPath extends string> = FindMatchingKey<TSchema, TPath> extends infer TKey ? TKey extends keyof TSchema ? Simplify<{
|
|
1791
|
+
[M in HttpMethod as M extends keyof TSchema[TKey] ? TSchema[TKey][M] extends {
|
|
1792
|
+
events: unknown;
|
|
1793
|
+
} ? M : never : never]: M extends keyof TSchema[TKey] ? SubscriptionMethodFn<TSchema[TKey][M], TPath, M> : never;
|
|
1794
|
+
}> : never : never;
|
|
1795
|
+
/**
|
|
1796
|
+
* A subscription API interface that only exposes methods with events field.
|
|
1797
|
+
* Used by useSubscription hook for real-time data streams.
|
|
1798
|
+
*/
|
|
1799
|
+
type SubscriptionClient<TSchema, TDefaultError = unknown> = <TPath extends SubscriptionPaths<TSchema> | (string & {})>(path: TPath) => HasSubscriptionMethod<TSchema, TPath> extends true ? SubscriptionPathMethods<TSchema, TPath> : never;
|
|
1472
1800
|
|
|
1473
1801
|
type PluginArray = readonly SpooshPlugin<PluginTypeConfig>[];
|
|
1474
1802
|
interface SpooshConfig<TPlugins extends PluginArray = PluginArray> {
|
|
@@ -1476,11 +1804,12 @@ interface SpooshConfig<TPlugins extends PluginArray = PluginArray> {
|
|
|
1476
1804
|
defaultOptions?: SpooshOptions;
|
|
1477
1805
|
plugins?: TPlugins;
|
|
1478
1806
|
}
|
|
1479
|
-
type SpooshInstance<TSchema = unknown, TDefaultError = unknown, TPlugins extends PluginArray = PluginArray> = {
|
|
1807
|
+
type SpooshInstance<TSchema = unknown, TDefaultError = unknown, TPlugins extends PluginArray = PluginArray, TTransports extends string = never> = {
|
|
1480
1808
|
api: SpooshClient<TSchema, TDefaultError>;
|
|
1481
1809
|
stateManager: StateManager;
|
|
1482
1810
|
eventEmitter: EventEmitter;
|
|
1483
1811
|
pluginExecutor: PluginExecutor;
|
|
1812
|
+
transports: Map<string, SpooshTransport>;
|
|
1484
1813
|
config: {
|
|
1485
1814
|
baseUrl: string;
|
|
1486
1815
|
defaultOptions: SpooshOptions;
|
|
@@ -1489,6 +1818,7 @@ type SpooshInstance<TSchema = unknown, TDefaultError = unknown, TPlugins extends
|
|
|
1489
1818
|
schema: TSchema;
|
|
1490
1819
|
defaultError: TDefaultError;
|
|
1491
1820
|
plugins: TPlugins;
|
|
1821
|
+
transports: TTransports;
|
|
1492
1822
|
};
|
|
1493
1823
|
};
|
|
1494
1824
|
|
|
@@ -1547,10 +1877,11 @@ type ExtractTriggerParams<I> = I extends {
|
|
|
1547
1877
|
*
|
|
1548
1878
|
* @since 0.1.0
|
|
1549
1879
|
*/
|
|
1550
|
-
declare class Spoosh<TSchema = unknown, TError = unknown, TPlugins extends PluginArray = []> {
|
|
1880
|
+
declare class Spoosh<TSchema = unknown, TError = unknown, TPlugins extends PluginArray = [], TTransports extends string = never> {
|
|
1551
1881
|
private baseUrl;
|
|
1552
1882
|
private defaultOptions;
|
|
1553
1883
|
private _plugins;
|
|
1884
|
+
private _transports;
|
|
1554
1885
|
/**
|
|
1555
1886
|
* Creates a new Spoosh instance.
|
|
1556
1887
|
*
|
|
@@ -1575,7 +1906,7 @@ declare class Spoosh<TSchema = unknown, TError = unknown, TPlugins extends Plugi
|
|
|
1575
1906
|
* });
|
|
1576
1907
|
* ```
|
|
1577
1908
|
*/
|
|
1578
|
-
constructor(baseUrl: string, defaultOptions?: SpooshOptionsInput, plugins?: TPlugins);
|
|
1909
|
+
constructor(baseUrl: string, defaultOptions?: SpooshOptionsInput, plugins?: TPlugins, transports?: Map<string, SpooshTransport>);
|
|
1579
1910
|
/**
|
|
1580
1911
|
* Adds plugins to the Spoosh instance.
|
|
1581
1912
|
*
|
|
@@ -1594,7 +1925,23 @@ declare class Spoosh<TSchema = unknown, TError = unknown, TPlugins extends Plugi
|
|
|
1594
1925
|
* ]);
|
|
1595
1926
|
* ```
|
|
1596
1927
|
*/
|
|
1597
|
-
use<const TNewPlugins extends PluginArray>(plugins: TNewPlugins): Omit<Spoosh<TSchema, TError, TNewPlugins>, "use">;
|
|
1928
|
+
use<const TNewPlugins extends PluginArray>(plugins: TNewPlugins): Omit<Spoosh<TSchema, TError, TNewPlugins, TTransports>, "use">;
|
|
1929
|
+
/**
|
|
1930
|
+
* Registers transport implementations for real-time operations.
|
|
1931
|
+
*
|
|
1932
|
+
* @param transports - Array of transport instances to register
|
|
1933
|
+
* @returns This Spoosh instance for method chaining
|
|
1934
|
+
*
|
|
1935
|
+
* @example
|
|
1936
|
+
* ```ts
|
|
1937
|
+
* import { sse } from '@spoosh/transport-sse';
|
|
1938
|
+
*
|
|
1939
|
+
* const spoosh = new Spoosh<Schema, Error>('/api')
|
|
1940
|
+
* .withTransports([sse()])
|
|
1941
|
+
* .use([...]);
|
|
1942
|
+
* ```
|
|
1943
|
+
*/
|
|
1944
|
+
withTransports<const T extends SpooshTransport[]>(transports: T): Spoosh<TSchema, TError, TPlugins, TTransports | T[number]["name"]>;
|
|
1598
1945
|
/**
|
|
1599
1946
|
* Cached instance of the underlying SpooshInstance.
|
|
1600
1947
|
* Created lazily on first property access.
|
|
@@ -1705,7 +2052,18 @@ declare class Spoosh<TSchema = unknown, TError = unknown, TPlugins extends Plugi
|
|
|
1705
2052
|
schema: TSchema;
|
|
1706
2053
|
defaultError: TError;
|
|
1707
2054
|
plugins: TPlugins;
|
|
2055
|
+
transports: TTransports;
|
|
1708
2056
|
};
|
|
2057
|
+
/**
|
|
2058
|
+
* Map of registered transport implementations.
|
|
2059
|
+
*
|
|
2060
|
+
* @example
|
|
2061
|
+
* ```ts
|
|
2062
|
+
* const { transports } = client;
|
|
2063
|
+
* const sseTransport = transports.get('sse');
|
|
2064
|
+
* ```
|
|
2065
|
+
*/
|
|
2066
|
+
get transports(): Map<string, SpooshTransport<unknown, unknown>>;
|
|
1709
2067
|
}
|
|
1710
2068
|
|
|
1711
2069
|
/**
|
|
@@ -1984,6 +2342,8 @@ declare module "./types" {
|
|
|
1984
2342
|
}
|
|
1985
2343
|
declare const xhrTransport: Transport<XhrTransportOptions>;
|
|
1986
2344
|
|
|
2345
|
+
declare function composeAdapter(baseAdapter: SubscriptionAdapter, plugins: readonly SpooshPlugin[]): SubscriptionAdapter;
|
|
2346
|
+
|
|
1987
2347
|
declare function executeFetch<TData, TError>(baseUrl: string, path: string[], method: HttpMethod, defaultOptions: SpooshOptions, requestOptions?: AnyRequestOptions, nextTags?: boolean): Promise<SpooshResponse<TData, TError>>;
|
|
1988
2348
|
|
|
1989
2349
|
type ExecuteOptions = {
|
|
@@ -2212,4 +2572,36 @@ declare class Semaphore {
|
|
|
2212
2572
|
getWaitingCount(): number;
|
|
2213
2573
|
}
|
|
2214
2574
|
|
|
2215
|
-
|
|
2575
|
+
interface SubscriptionController<TData = unknown, TError = unknown> {
|
|
2576
|
+
subscribe(): Promise<SubscriptionHandle<TData, TError>>;
|
|
2577
|
+
subscribe(callback: () => void): () => void;
|
|
2578
|
+
emit(message: unknown): Promise<{
|
|
2579
|
+
success: boolean;
|
|
2580
|
+
error?: TError;
|
|
2581
|
+
}>;
|
|
2582
|
+
unsubscribe(): void;
|
|
2583
|
+
getState(): {
|
|
2584
|
+
data: TData | undefined;
|
|
2585
|
+
error: TError | undefined;
|
|
2586
|
+
isConnected: boolean;
|
|
2587
|
+
};
|
|
2588
|
+
mount(): void;
|
|
2589
|
+
unmount(): void;
|
|
2590
|
+
setDisconnected(): void;
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
interface CreateSubscriptionControllerOptions<TData, TError> {
|
|
2594
|
+
channel: string;
|
|
2595
|
+
baseAdapter: SubscriptionAdapter<TData, TError>;
|
|
2596
|
+
stateManager: StateManager;
|
|
2597
|
+
eventEmitter: EventEmitter;
|
|
2598
|
+
pluginExecutor: PluginExecutor;
|
|
2599
|
+
queryKey: string;
|
|
2600
|
+
operationType: OperationType;
|
|
2601
|
+
path: string;
|
|
2602
|
+
method: string;
|
|
2603
|
+
instanceId?: string;
|
|
2604
|
+
}
|
|
2605
|
+
declare function createSubscriptionController<TData, TError>(options: CreateSubscriptionControllerOptions<TData, TError>): SubscriptionController<TData, TError>;
|
|
2606
|
+
|
|
2607
|
+
export { type AnyMethod, type AnyRequestOptions, type ApiSchema, type BaseSubscriptionResponse, type BuiltInEvents, type CacheEntry, type CacheEntryWithKey, type CapturedCall, type ComputeRequestOptions, type CoreRequestOptionsBase, type CreateInfiniteReadOptions, type CreateOperationOptions, type CreateSubscriptionControllerOptions, type DataAwareCallback, type DataAwareTransform, type DataChangeCallback, type DevtoolEvents, type EventEmitter, type EventListener, type EventOptions, type EventTracer, type ExecuteOptions, type ExtractBody$1 as ExtractBody, type ExtractData, type ExtractError, type ExtractMethodOptions, type ExtractParamNames, type ExtractQuery$1 as ExtractQuery, type ExtractTriggerBody, type ExtractTriggerParams, type ExtractTriggerQuery, type FetchDirection, type FetchExecutor, type FindMatchingKey, HTTP_METHODS, type HasParams, type HasReadMethod, type HasSubscriptionMethod, type HasWriteMethod, type HeadersInitOrGetter, type HttpMethod, type HttpMethodKey, type InfiniteNextContext, type InfinitePage, type InfinitePageStatus, type InfinitePrevContext, type InfiniteReadController, type InfiniteReadState, type InfiniteRequestOptions, type InfiniteTriggerOptions, type InstanceApiContext, type InstanceApiResolvers, type InstancePluginExecutor, type LifecyclePhase, type MergePluginInstanceApi, type MergePluginOptions, type MergePluginResults, type MethodOptionsMap, type OperationController, type OperationState, type OperationType, type PluginAccessor, type PluginArray, type PluginContext, type PluginContextBase, type PluginContextExtensions, type PluginContextInput, type PluginExecutor, type PluginExportsRegistry, type PluginFactory, type PluginHandler, type PluginLifecycle, type PluginMiddleware, type PluginRegistry, type PluginRequestOptions, type PluginResolvers, type PluginResponseHandler, type PluginResultResolvers, type PluginTypeConfig, type PluginUpdateHandler, type QueueController, type QueueControllerConfig, type QueueControllerContext, type QueueItem, type QueueItemStatus, type QueueSelectorClient, type QueueStats, type QueueTriggerInput, type ReadClient, type ReadPaths, type ReadSchemaHelper, type RefetchEvent, type RequestCompleteEvent, type RequestOptions$1 as RequestOptions, type RequestTracer, type ResolveInstanceApi, type ResolveResultTypes, type ResolveSchemaTypes, type ResolveTypes, type ResolverContext, type SchemaPaths, type SelectedEndpoint, type SelectorFunction, type SelectorResult, Semaphore, type SetupContext, type Simplify, Spoosh, type SpooshBody, type SpooshClient, type SpooshConfig, type SpooshInstance, type SpooshOptions, type SpooshOptionsInput, type SpooshPlugin, type SpooshResponse, type SpooshSchema, type SpooshSubscriptionMethodRegistry, type SpooshTransport, type SpooshTransportRegistry, type StandaloneEvent, type StateManager, type StripPrefix, type Subscriber, type SubscriptionAccumulateEvent, type SubscriptionAdapter, type SubscriptionClient, type SubscriptionConnectEvent, type SubscriptionConnectedEvent, type SubscriptionContext, type SubscriptionController, type SubscriptionDisconnectEvent, type SubscriptionErrorEvent, type SubscriptionHandle, type SubscriptionMessageEvent, type SubscriptionMethod, type SubscriptionPaths, type TagMode, type TagOptions, type Trace, type TraceColor, type TraceEvent, type TraceInfo, type TraceListener, type TraceOptions, type TraceStage, type Transport, type TransportName, type TransportOption, type TransportOptionsMap, type TransportResponse, type TypedPluginContext, type TypedPluginDefinition, type WriteClient, type WriteMethod, type WritePaths, type WriteSchemaHelper, type WriteSelectorClient, __DEV__, buildUrl, clone, composeAdapter, containsFile, createClient, createEventEmitter, createInfiniteReadController, createInitialState, createOperationController, createPluginExecutor, createPluginRegistry, createProxyHandler, createQueueController, createSelectorProxy, createSpooshPlugin, createStateManager, createSubscriptionController, createTracer, executeFetch, extractMethodFromSelector, extractPathFromSelector, fetchTransport, form, generateTags, getContentType, isAbortError, isJsonBody, isNetworkError, isSpooshBody, json, mergeHeaders, objectToFormData, objectToUrlEncoded, removeHeaderKeys, resolveHeadersToRecord, resolvePath, resolvePathString, resolveRequestBody, resolveTags, setHeaders, sortObjectKeys, urlencoded, xhrTransport };
|