@spoosh/core 0.12.1 → 0.13.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 +317 -16
- package/dist/index.d.ts +317 -16
- package/dist/index.js +93 -25
- package/dist/index.mjs +93 -25
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -172,11 +172,6 @@ interface BuiltInEvents {
|
|
|
172
172
|
invalidate: string[];
|
|
173
173
|
refetchAll: void;
|
|
174
174
|
}
|
|
175
|
-
/**
|
|
176
|
-
* Resolves event payload type. Built-in events get their specific type,
|
|
177
|
-
* custom events get `unknown` (or explicit type parameter).
|
|
178
|
-
*/
|
|
179
|
-
type EventPayload<E extends string> = E extends keyof BuiltInEvents ? BuiltInEvents[E] : unknown;
|
|
180
175
|
type EventEmitter = {
|
|
181
176
|
/**
|
|
182
177
|
* Subscribe to an event. Built-in events have type-safe payloads.
|
|
@@ -192,7 +187,8 @@ type EventEmitter = {
|
|
|
192
187
|
* eventEmitter.on<MyPayload>("my-event", (payload) => { ... });
|
|
193
188
|
* ```
|
|
194
189
|
*/
|
|
195
|
-
on<E extends
|
|
190
|
+
on<E extends keyof BuiltInEvents>(event: E, callback: EventCallback<BuiltInEvents[E]>): () => void;
|
|
191
|
+
on<T = unknown>(event: string, callback: EventCallback<T>): () => void;
|
|
196
192
|
/**
|
|
197
193
|
* Emit an event. Built-in events have type-safe payloads.
|
|
198
194
|
*
|
|
@@ -205,7 +201,8 @@ type EventEmitter = {
|
|
|
205
201
|
* eventEmitter.emit("my-event", myPayload);
|
|
206
202
|
* ```
|
|
207
203
|
*/
|
|
208
|
-
emit<E extends
|
|
204
|
+
emit<E extends keyof BuiltInEvents>(event: E, payload: BuiltInEvents[E]): void;
|
|
205
|
+
emit<T = unknown>(event: string, payload: T): void;
|
|
209
206
|
off: (event: string, callback: EventCallback) => void;
|
|
210
207
|
clear: () => void;
|
|
211
208
|
};
|
|
@@ -247,6 +244,190 @@ type StateManager = {
|
|
|
247
244
|
};
|
|
248
245
|
declare function createStateManager(): StateManager;
|
|
249
246
|
|
|
247
|
+
/**
|
|
248
|
+
* Devtool-related types for tracing and debugging.
|
|
249
|
+
* These types are used by the devtool plugin and plugins that emit trace events.
|
|
250
|
+
*/
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Stage of plugin execution for tracing.
|
|
254
|
+
*/
|
|
255
|
+
type TraceStage = "return" | "log" | "skip" | "fetch";
|
|
256
|
+
/**
|
|
257
|
+
* Color hint for devtools visualization.
|
|
258
|
+
*/
|
|
259
|
+
type TraceColor = "success" | "warning" | "error" | "info" | "muted";
|
|
260
|
+
/**
|
|
261
|
+
* Structured trace event emitted by plugins.
|
|
262
|
+
* Plugins self-report what they did and why.
|
|
263
|
+
*/
|
|
264
|
+
type TraceEvent = {
|
|
265
|
+
/** Plugin name */
|
|
266
|
+
plugin: string;
|
|
267
|
+
/** Execution stage */
|
|
268
|
+
stage: TraceStage;
|
|
269
|
+
/** Human-readable explanation of what happened */
|
|
270
|
+
reason?: string;
|
|
271
|
+
/** Color hint for devtools (success=green, warning=yellow, error=red, info=blue) */
|
|
272
|
+
color?: TraceColor;
|
|
273
|
+
/** Before/after diff with optional label */
|
|
274
|
+
diff?: {
|
|
275
|
+
before: unknown;
|
|
276
|
+
after: unknown;
|
|
277
|
+
label?: string;
|
|
278
|
+
};
|
|
279
|
+
/** Structured information to display (e.g., invalidated tags, cache keys) */
|
|
280
|
+
info?: Array<{
|
|
281
|
+
label?: string;
|
|
282
|
+
value: unknown;
|
|
283
|
+
}>;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* Trace API available to plugins via ctx.trace.
|
|
287
|
+
* Plugins emit structured events; devtools renders them.
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* ```ts
|
|
291
|
+
* middleware: async (ctx, next) => {
|
|
292
|
+
* const cached = getCache(ctx.queryKey);
|
|
293
|
+
* if (cached) {
|
|
294
|
+
* ctx.trace?.step({
|
|
295
|
+
* plugin: "cache",
|
|
296
|
+
* stage: "skip",
|
|
297
|
+
* meta: { reason: "Cache hit (TTL valid)" }
|
|
298
|
+
* });
|
|
299
|
+
* return cached;
|
|
300
|
+
* }
|
|
301
|
+
*
|
|
302
|
+
* ctx.trace?.step({
|
|
303
|
+
* plugin: "cache",
|
|
304
|
+
* stage: "before",
|
|
305
|
+
* intent: "read",
|
|
306
|
+
* });
|
|
307
|
+
*
|
|
308
|
+
* const result = await next();
|
|
309
|
+
*
|
|
310
|
+
* ctx.trace?.step({
|
|
311
|
+
* plugin: "cache",
|
|
312
|
+
* stage: "after",
|
|
313
|
+
* meta: {
|
|
314
|
+
* reason: "Stored in cache",
|
|
315
|
+
* diff: { before: null, after: result.data }
|
|
316
|
+
* }
|
|
317
|
+
* });
|
|
318
|
+
*
|
|
319
|
+
* return result;
|
|
320
|
+
* }
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
type Trace = {
|
|
324
|
+
/**
|
|
325
|
+
* Emit a trace event. Lazy evaluation - only computed when devtools is active.
|
|
326
|
+
*
|
|
327
|
+
* @param event - Trace event or function that returns trace event (for lazy evaluation)
|
|
328
|
+
*/
|
|
329
|
+
step: (event: TraceEvent | (() => TraceEvent)) => void;
|
|
330
|
+
};
|
|
331
|
+
/**
|
|
332
|
+
* Listener for trace events emitted by plugins.
|
|
333
|
+
*/
|
|
334
|
+
type TraceListener = (event: TraceEvent & {
|
|
335
|
+
queryKey: string;
|
|
336
|
+
timestamp: number;
|
|
337
|
+
}) => void;
|
|
338
|
+
/**
|
|
339
|
+
* Standalone event not tied to a request lifecycle.
|
|
340
|
+
* Used for polling, debounce, gc, and other background activities.
|
|
341
|
+
*/
|
|
342
|
+
type StandaloneEvent = {
|
|
343
|
+
/** Plugin name */
|
|
344
|
+
plugin: string;
|
|
345
|
+
/** Human-readable message */
|
|
346
|
+
message: string;
|
|
347
|
+
/** Color hint for devtools */
|
|
348
|
+
color?: TraceColor;
|
|
349
|
+
/** Related query key (for filtering) */
|
|
350
|
+
queryKey?: string;
|
|
351
|
+
/** Additional metadata */
|
|
352
|
+
meta?: Record<string, unknown>;
|
|
353
|
+
/** Timestamp when event occurred */
|
|
354
|
+
timestamp: number;
|
|
355
|
+
};
|
|
356
|
+
type EventListener = (event: StandaloneEvent) => void;
|
|
357
|
+
type TraceInfo = {
|
|
358
|
+
label?: string;
|
|
359
|
+
value: unknown;
|
|
360
|
+
};
|
|
361
|
+
type TraceOptions = {
|
|
362
|
+
color?: TraceColor;
|
|
363
|
+
diff?: {
|
|
364
|
+
before: unknown;
|
|
365
|
+
after: unknown;
|
|
366
|
+
label?: string;
|
|
367
|
+
};
|
|
368
|
+
info?: TraceInfo[];
|
|
369
|
+
};
|
|
370
|
+
type EventOptions = {
|
|
371
|
+
color?: TraceColor;
|
|
372
|
+
/** Query key this event relates to (for filtering) */
|
|
373
|
+
queryKey?: string;
|
|
374
|
+
/** Additional metadata to display */
|
|
375
|
+
meta?: Record<string, unknown>;
|
|
376
|
+
};
|
|
377
|
+
/**
|
|
378
|
+
* Request-bound tracer API for plugins.
|
|
379
|
+
* Created via `context.tracer?.(pluginName)`.
|
|
380
|
+
* Automatically bound to the request's queryKey for accurate devtool tracing.
|
|
381
|
+
*
|
|
382
|
+
* @example
|
|
383
|
+
* ```ts
|
|
384
|
+
* const t = context.tracer?.("my-plugin");
|
|
385
|
+
* t?.return("Cache hit", { color: "success" });
|
|
386
|
+
* t?.log("Transformed", { color: "info", diff: { before, after } });
|
|
387
|
+
* t?.skip("Nothing to do", { color: "muted" });
|
|
388
|
+
* ```
|
|
389
|
+
*/
|
|
390
|
+
interface RequestTracer {
|
|
391
|
+
/** Returned early without calling next() */
|
|
392
|
+
return(msg: string, options?: TraceOptions): void;
|
|
393
|
+
/** Did something (any activity worth noting) */
|
|
394
|
+
log(msg: string, options?: TraceOptions): void;
|
|
395
|
+
/** Nothing to do, passed through */
|
|
396
|
+
skip(msg: string, options?: TraceOptions): void;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Event emitted after all afterResponse hooks complete.
|
|
400
|
+
* Used by devtools to capture meta snapshots.
|
|
401
|
+
*/
|
|
402
|
+
interface RequestCompleteEvent {
|
|
403
|
+
context: PluginContext;
|
|
404
|
+
queryKey: string;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Internal events used by core and devtools. Not for public use.
|
|
408
|
+
* @internal
|
|
409
|
+
*/
|
|
410
|
+
interface DevtoolEvents {
|
|
411
|
+
"spoosh:devtool-event": StandaloneEvent;
|
|
412
|
+
"spoosh:request-complete": RequestCompleteEvent;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Event tracer API for standalone events not tied to a request lifecycle.
|
|
416
|
+
* Created via `context.eventTracer?.(pluginName)`.
|
|
417
|
+
* Use for async callbacks like polling, debounce completion, gc, etc.
|
|
418
|
+
*
|
|
419
|
+
* @example
|
|
420
|
+
* ```ts
|
|
421
|
+
* const et = context.eventTracer?.("my-plugin");
|
|
422
|
+
* et?.emit("Poll triggered", { queryKey, color: "success" });
|
|
423
|
+
* et?.emit("GC cleaned 5 entries", { color: "info", meta: { count: 5 } });
|
|
424
|
+
* ```
|
|
425
|
+
*/
|
|
426
|
+
interface EventTracer {
|
|
427
|
+
/** Emit a standalone event not tied to a request */
|
|
428
|
+
emit(msg: string, options?: EventOptions): void;
|
|
429
|
+
}
|
|
430
|
+
|
|
250
431
|
type OperationType = "read" | "write" | "infiniteRead";
|
|
251
432
|
type LifecyclePhase = "onMount" | "onUnmount" | "onUpdate";
|
|
252
433
|
type OperationState<TData = unknown, TError = unknown> = {
|
|
@@ -269,7 +450,23 @@ type CacheEntry<TData = unknown, TError = unknown> = {
|
|
|
269
450
|
type PluginRequestOptions = Omit<AnyRequestOptions, "headers" | "cache"> & {
|
|
270
451
|
headers: Record<string, string>;
|
|
271
452
|
};
|
|
272
|
-
|
|
453
|
+
/**
|
|
454
|
+
* Registry for extending PluginContext with custom properties.
|
|
455
|
+
* Third-party plugins can extend this interface via declaration merging.
|
|
456
|
+
*
|
|
457
|
+
* @example
|
|
458
|
+
* ```ts
|
|
459
|
+
* // In your plugin's types file:
|
|
460
|
+
* declare module '@spoosh/core' {
|
|
461
|
+
* interface PluginContextExtensions {
|
|
462
|
+
* myCustomProperty?: MyCustomType;
|
|
463
|
+
* }
|
|
464
|
+
* }
|
|
465
|
+
* ```
|
|
466
|
+
*/
|
|
467
|
+
interface PluginContextExtensions {
|
|
468
|
+
}
|
|
469
|
+
type PluginContextBase = {
|
|
273
470
|
readonly operationType: OperationType;
|
|
274
471
|
readonly path: string;
|
|
275
472
|
readonly method: HttpMethod;
|
|
@@ -292,9 +489,40 @@ type PluginContext = {
|
|
|
292
489
|
pluginOptions?: unknown;
|
|
293
490
|
/** Force a network request even if cached data exists. Used by plugins to communicate intent. */
|
|
294
491
|
forceRefetch?: boolean;
|
|
492
|
+
/**
|
|
493
|
+
* Creates a request-bound tracer for devtools debugging.
|
|
494
|
+
* Automatically bound to this request's queryKey.
|
|
495
|
+
* Only available when devtools plugin is active.
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* ```ts
|
|
499
|
+
* const t = ctx.tracer?.("my-plugin");
|
|
500
|
+
* t?.return("Cache hit", { color: "success" });
|
|
501
|
+
* t?.log("Processing", { color: "info" });
|
|
502
|
+
* t?.skip("Nothing to do", { color: "muted" });
|
|
503
|
+
* ```
|
|
504
|
+
*/
|
|
505
|
+
tracer?: (plugin: string) => RequestTracer;
|
|
506
|
+
/**
|
|
507
|
+
* Creates an event tracer for standalone events not tied to a request lifecycle.
|
|
508
|
+
* Use for async callbacks like polling, debounce completion, gc, etc.
|
|
509
|
+
* Only available when devtools plugin is active.
|
|
510
|
+
*
|
|
511
|
+
* @example
|
|
512
|
+
* ```ts
|
|
513
|
+
* const et = ctx.eventTracer?.("my-plugin");
|
|
514
|
+
* et?.emit("Poll triggered", { queryKey, color: "success" });
|
|
515
|
+
* ```
|
|
516
|
+
*/
|
|
517
|
+
eventTracer?: (plugin: string) => EventTracer;
|
|
295
518
|
};
|
|
519
|
+
/**
|
|
520
|
+
* Plugin context with extensions from third-party plugins.
|
|
521
|
+
* Plugins can extend this via PluginContextExtensions declaration merging.
|
|
522
|
+
*/
|
|
523
|
+
type PluginContext = PluginContextBase & PluginContextExtensions;
|
|
296
524
|
/** Input type for creating PluginContext (without injected properties) */
|
|
297
|
-
type PluginContextInput = Omit<PluginContext, "plugins">;
|
|
525
|
+
type PluginContextInput = Omit<PluginContext, "plugins" | "tracer" | "eventTracer">;
|
|
298
526
|
/**
|
|
299
527
|
* Middleware function that wraps the fetch flow.
|
|
300
528
|
* Plugins use this for full control over request/response handling.
|
|
@@ -419,9 +647,36 @@ interface SpooshPlugin<T extends PluginTypeConfig = PluginTypeConfig> {
|
|
|
419
647
|
lifecycle?: PluginLifecycle;
|
|
420
648
|
/** Expose functions/variables for other plugins to access via `context.plugins.get(name)` */
|
|
421
649
|
exports?: (context: PluginContext) => object;
|
|
650
|
+
/**
|
|
651
|
+
* One-time initialization when the Spoosh instance is created.
|
|
652
|
+
* Use for setting up timers, event listeners, or other side effects.
|
|
653
|
+
* Runs before instanceApi is called.
|
|
654
|
+
*
|
|
655
|
+
* @example
|
|
656
|
+
* ```ts
|
|
657
|
+
* setup: ({ stateManager, eventEmitter, pluginExecutor }) => {
|
|
658
|
+
* // Set up interval timer
|
|
659
|
+
* const intervalId = setInterval(() => {
|
|
660
|
+
* // periodic cleanup
|
|
661
|
+
* }, 60000);
|
|
662
|
+
*
|
|
663
|
+
* // Register context enhancer
|
|
664
|
+
* pluginExecutor.registerContextEnhancer((context) => {
|
|
665
|
+
* context.myProperty = myValue;
|
|
666
|
+
* });
|
|
667
|
+
*
|
|
668
|
+
* // Set up event listener
|
|
669
|
+
* eventEmitter.on("invalidate", (tags) => {
|
|
670
|
+
* // handle invalidation
|
|
671
|
+
* });
|
|
672
|
+
* }
|
|
673
|
+
* ```
|
|
674
|
+
*/
|
|
675
|
+
setup?: (context: SetupContext) => void;
|
|
422
676
|
/**
|
|
423
677
|
* Expose functions/properties on the framework adapter return value (e.g., create).
|
|
424
678
|
* Unlike `exports`, these are accessible directly from the instance, not just within plugin context.
|
|
679
|
+
* Should be pure - use `setup` for side effects like timers or event listeners.
|
|
425
680
|
*
|
|
426
681
|
* @example
|
|
427
682
|
* ```ts
|
|
@@ -625,6 +880,12 @@ type RefetchEvent = {
|
|
|
625
880
|
type InstancePluginExecutor = {
|
|
626
881
|
executeMiddleware: <TData, TError>(operationType: OperationType, context: PluginContext, coreFetch: () => Promise<SpooshResponse<any, any>>) => Promise<SpooshResponse<TData, TError>>;
|
|
627
882
|
createContext: (input: PluginContextInput) => PluginContext;
|
|
883
|
+
getPlugins: () => readonly SpooshPlugin[];
|
|
884
|
+
/**
|
|
885
|
+
* Register a function to enhance every PluginContext during creation.
|
|
886
|
+
* Call this during plugin setup to inject properties into all request contexts.
|
|
887
|
+
*/
|
|
888
|
+
registerContextEnhancer: (enhancer: (context: PluginContext) => void) => void;
|
|
628
889
|
};
|
|
629
890
|
/**
|
|
630
891
|
* Context provided to plugin's instanceApi function.
|
|
@@ -635,6 +896,25 @@ type InstanceApiContext<TApi = unknown> = {
|
|
|
635
896
|
stateManager: StateManager;
|
|
636
897
|
eventEmitter: EventEmitter;
|
|
637
898
|
pluginExecutor: InstancePluginExecutor;
|
|
899
|
+
/**
|
|
900
|
+
* Creates an event tracer for standalone events.
|
|
901
|
+
* Only available when devtools plugin is active.
|
|
902
|
+
*/
|
|
903
|
+
eventTracer?: (plugin: string) => EventTracer;
|
|
904
|
+
};
|
|
905
|
+
/**
|
|
906
|
+
* Context provided to plugin's setup function.
|
|
907
|
+
* Used for one-time initialization when the Spoosh instance is created.
|
|
908
|
+
*/
|
|
909
|
+
type SetupContext = {
|
|
910
|
+
stateManager: StateManager;
|
|
911
|
+
eventEmitter: EventEmitter;
|
|
912
|
+
pluginExecutor: InstancePluginExecutor;
|
|
913
|
+
/**
|
|
914
|
+
* Creates an event tracer for standalone events.
|
|
915
|
+
* Only available when devtools plugin is active.
|
|
916
|
+
*/
|
|
917
|
+
eventTracer?: (plugin: string) => EventTracer;
|
|
638
918
|
};
|
|
639
919
|
|
|
640
920
|
type PluginExecutor = {
|
|
@@ -644,8 +924,13 @@ type PluginExecutor = {
|
|
|
644
924
|
executeUpdateLifecycle: (operationType: OperationType, context: PluginContext, previousContext: PluginContext) => Promise<void>;
|
|
645
925
|
executeMiddleware: (operationType: OperationType, context: PluginContext, coreFetch: () => Promise<SpooshResponse<any, any>>) => Promise<SpooshResponse<any, any>>;
|
|
646
926
|
getPlugins: () => readonly SpooshPlugin[];
|
|
647
|
-
/** Creates a full PluginContext with plugins accessor
|
|
927
|
+
/** Creates a full PluginContext with plugins accessor */
|
|
648
928
|
createContext: (input: PluginContextInput) => PluginContext;
|
|
929
|
+
/**
|
|
930
|
+
* Register a function to enhance every PluginContext during creation.
|
|
931
|
+
* Call this during plugin setup to inject properties into all request contexts.
|
|
932
|
+
*/
|
|
933
|
+
registerContextEnhancer: (enhancer: (context: PluginContext) => void) => void;
|
|
649
934
|
};
|
|
650
935
|
declare function createPluginExecutor(initialPlugins?: SpooshPlugin[]): PluginExecutor;
|
|
651
936
|
|
|
@@ -1156,7 +1441,7 @@ type SpooshInstance<TSchema = unknown, TDefaultError = unknown, TPlugins extends
|
|
|
1156
1441
|
* @example Basic usage
|
|
1157
1442
|
* ```ts
|
|
1158
1443
|
* const spoosh = new Spoosh<ApiSchema, Error>('/api')
|
|
1159
|
-
* .use([cachePlugin(),
|
|
1444
|
+
* .use([cachePlugin(), devtool()]);
|
|
1160
1445
|
*
|
|
1161
1446
|
* const { api } = client;
|
|
1162
1447
|
* const response = await api("posts").GET();
|
|
@@ -1217,12 +1502,12 @@ declare class Spoosh<TSchema = unknown, TError = unknown, TPlugins extends Plugi
|
|
|
1217
1502
|
/**
|
|
1218
1503
|
* Adds plugins to the Spoosh instance.
|
|
1219
1504
|
*
|
|
1220
|
-
* Returns a
|
|
1221
|
-
*
|
|
1505
|
+
* Returns a configured Spoosh instance with the specified plugins.
|
|
1506
|
+
* Can only be called once - the returned instance does not have `.use()`.
|
|
1222
1507
|
*
|
|
1223
1508
|
* @template TNewPlugins - The const tuple type of the new plugins array
|
|
1224
1509
|
* @param plugins - Array of plugin instances to use
|
|
1225
|
-
* @returns A
|
|
1510
|
+
* @returns A configured Spoosh instance (without `.use()` method)
|
|
1226
1511
|
*
|
|
1227
1512
|
* ```ts
|
|
1228
1513
|
* const spoosh = new Spoosh<Schema, Error>('/api').use([
|
|
@@ -1232,7 +1517,7 @@ declare class Spoosh<TSchema = unknown, TError = unknown, TPlugins extends Plugi
|
|
|
1232
1517
|
* ]);
|
|
1233
1518
|
* ```
|
|
1234
1519
|
*/
|
|
1235
|
-
use<const TNewPlugins extends PluginArray>(plugins: TNewPlugins): Spoosh<TSchema, TError, TNewPlugins>;
|
|
1520
|
+
use<const TNewPlugins extends PluginArray>(plugins: TNewPlugins): Omit<Spoosh<TSchema, TError, TNewPlugins>, "use">;
|
|
1236
1521
|
/**
|
|
1237
1522
|
* Cached instance of the underlying SpooshInstance.
|
|
1238
1523
|
* Created lazily on first property access.
|
|
@@ -1446,6 +1731,22 @@ declare function resolvePath(path: string[], params: Record<string, string | num
|
|
|
1446
1731
|
declare const isNetworkError: (err: unknown) => boolean;
|
|
1447
1732
|
declare const isAbortError: (err: unknown) => boolean;
|
|
1448
1733
|
|
|
1734
|
+
declare function clone<T>(value: T, seen?: WeakMap<WeakKey, any>): T;
|
|
1735
|
+
|
|
1736
|
+
/**
|
|
1737
|
+
* Creates a request-bound tracer for a plugin.
|
|
1738
|
+
* Use for middleware, afterResponse, and lifecycle hooks.
|
|
1739
|
+
*
|
|
1740
|
+
* @example
|
|
1741
|
+
* ```ts
|
|
1742
|
+
* const t = createTracer("spoosh:cache", context.trace);
|
|
1743
|
+
* t.return("Cache hit", { color: "success" });
|
|
1744
|
+
* t.log("Cached response", { color: "info", diff: { before, after } });
|
|
1745
|
+
* t.skip("No query params", { color: "muted" });
|
|
1746
|
+
* ```
|
|
1747
|
+
*/
|
|
1748
|
+
declare function createTracer(plugin: string, trace: Trace | undefined): RequestTracer;
|
|
1749
|
+
|
|
1449
1750
|
type ProxyHandlerConfig<TOptions = SpooshOptions> = {
|
|
1450
1751
|
baseUrl: string;
|
|
1451
1752
|
defaultOptions: TOptions;
|
|
@@ -1680,4 +1981,4 @@ type CreateInfiniteReadOptions<TData, TItem, TError, TRequest> = {
|
|
|
1680
1981
|
};
|
|
1681
1982
|
declare function createInfiniteReadController<TData, TItem, TError, TRequest extends InfiniteRequestOptions = InfiniteRequestOptions>(options: CreateInfiniteReadOptions<TData, TItem, TError, TRequest>): InfiniteReadController<TData, TItem, TError>;
|
|
1682
1983
|
|
|
1683
|
-
export { type AnyRequestOptions, type ApiSchema, type BuiltInEvents, type CacheEntry, type CacheEntryWithKey, type CapturedCall, type ComputeRequestOptions, type CoreRequestOptionsBase, type CreateInfiniteReadOptions, type CreateOperationOptions, type DataAwareCallback, type DataAwareTransform, type EventEmitter, type ExtractBody$1 as ExtractBody, type ExtractData, type ExtractError, type ExtractMethodOptions, type ExtractParamNames, type ExtractQuery$1 as ExtractQuery, type FetchDirection, type FetchExecutor, type FindMatchingKey, HTTP_METHODS, type HasParams, type HasReadMethod, type HasWriteMethod, type HeadersInitOrGetter, type HttpMethod, type HttpMethodKey, type InfiniteReadController, type InfiniteReadState, type InfiniteRequestOptions, type InstanceApiContext, type InstanceApiResolvers, type InstancePluginExecutor, type LifecyclePhase, type MergePluginInstanceApi, type MergePluginOptions, type MergePluginResults, type MethodOptionsMap, type OperationController, type OperationState, type OperationType, type PageContext, type PluginAccessor, type PluginArray, type PluginContext, 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 ReadClient, type ReadPaths, type ReadSchemaHelper, type RefetchEvent, type RequestOptions$1 as RequestOptions, type ResolveInstanceApi, type ResolveResultTypes, type ResolveSchemaTypes, type ResolveTypes, type ResolverContext, type SchemaPaths, type SelectedEndpoint, type SelectorFunction, type SelectorResult, type Simplify, Spoosh, type SpooshBody, type SpooshClient, type SpooshConfig, type SpooshInstance, type SpooshOptions, type SpooshOptionsInput, type SpooshPlugin, type SpooshResponse, type SpooshSchema, type StateManager, type StripPrefix, type TagMode, type TagOptions, type Transport, type TransportOption, type TransportOptionsMap, type TransportResponse, type WriteClient, type WriteMethod, type WritePaths, type WriteSchemaHelper, __DEV__, buildUrl, containsFile, createClient, createEventEmitter, createInfiniteReadController, createInitialState, createOperationController, createPluginExecutor, createPluginRegistry, createProxyHandler, createSelectorProxy, createStateManager, executeFetch, extractMethodFromSelector, extractPathFromSelector, fetchTransport, form, generateTags, getContentType, isAbortError, isJsonBody, isNetworkError, isSpooshBody, json, mergeHeaders, objectToFormData, objectToUrlEncoded, resolveHeadersToRecord, resolvePath, resolveRequestBody, resolveTags, setHeaders, sortObjectKeys, urlencoded, xhrTransport };
|
|
1984
|
+
export { type AnyRequestOptions, type ApiSchema, type BuiltInEvents, type CacheEntry, type CacheEntryWithKey, type CapturedCall, type ComputeRequestOptions, type CoreRequestOptionsBase, type CreateInfiniteReadOptions, type CreateOperationOptions, type DataAwareCallback, type DataAwareTransform, type DevtoolEvents, type EventEmitter, type EventListener, type EventOptions, type EventTracer, type ExtractBody$1 as ExtractBody, type ExtractData, type ExtractError, type ExtractMethodOptions, type ExtractParamNames, type ExtractQuery$1 as ExtractQuery, type FetchDirection, type FetchExecutor, type FindMatchingKey, HTTP_METHODS, type HasParams, type HasReadMethod, type HasWriteMethod, type HeadersInitOrGetter, type HttpMethod, type HttpMethodKey, type InfiniteReadController, type InfiniteReadState, type InfiniteRequestOptions, type InstanceApiContext, type InstanceApiResolvers, type InstancePluginExecutor, type LifecyclePhase, type MergePluginInstanceApi, type MergePluginOptions, type MergePluginResults, type MethodOptionsMap, type OperationController, type OperationState, type OperationType, type PageContext, 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 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, type SetupContext, type Simplify, Spoosh, type SpooshBody, type SpooshClient, type SpooshConfig, type SpooshInstance, type SpooshOptions, type SpooshOptionsInput, type SpooshPlugin, type SpooshResponse, type SpooshSchema, type StandaloneEvent, type StateManager, type StripPrefix, type TagMode, type TagOptions, type Trace, type TraceColor, type TraceEvent, type TraceInfo, type TraceListener, type TraceOptions, type TraceStage, type Transport, type TransportOption, type TransportOptionsMap, type TransportResponse, type WriteClient, type WriteMethod, type WritePaths, type WriteSchemaHelper, __DEV__, buildUrl, clone, containsFile, createClient, createEventEmitter, createInfiniteReadController, createInitialState, createOperationController, createPluginExecutor, createPluginRegistry, createProxyHandler, createSelectorProxy, createStateManager, createTracer, executeFetch, extractMethodFromSelector, extractPathFromSelector, fetchTransport, form, generateTags, getContentType, isAbortError, isJsonBody, isNetworkError, isSpooshBody, json, mergeHeaders, objectToFormData, objectToUrlEncoded, resolveHeadersToRecord, resolvePath, resolveRequestBody, resolveTags, setHeaders, sortObjectKeys, urlencoded, xhrTransport };
|