@spoosh/core 0.11.1 → 0.12.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 +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -279,13 +279,16 @@ type PluginContext = {
|
|
|
279
279
|
readonly method: HttpMethod;
|
|
280
280
|
readonly queryKey: string;
|
|
281
281
|
readonly tags: string[];
|
|
282
|
-
/** Timestamp when this request was initiated. Useful for tracing and debugging. */
|
|
283
282
|
readonly requestTimestamp: number;
|
|
284
|
-
/** Unique identifier for
|
|
285
|
-
readonly
|
|
283
|
+
/** Unique identifier for this usage instance. Persists across queryKey changes. */
|
|
284
|
+
readonly instanceId?: string;
|
|
285
|
+
/** Request options with resolved headers. Modify to customize the request (e.g., add headers, signal, body). */
|
|
286
286
|
request: PluginRequestOptions;
|
|
287
|
+
/** Temporary storage for inter-plugin communication during a single request lifecycle. Data stored here doesn't persist beyond the request. */
|
|
287
288
|
temp: Map<string, unknown>;
|
|
289
|
+
/** State manager for accessing and modifying cache entries. */
|
|
288
290
|
stateManager: StateManager;
|
|
291
|
+
/** Event emitter for triggering refetch, invalidation, and other events. */
|
|
289
292
|
eventEmitter: EventEmitter;
|
|
290
293
|
/** Access other plugins' exported APIs */
|
|
291
294
|
plugins: PluginAccessor;
|
|
@@ -1610,7 +1613,7 @@ type CreateOperationOptions<TData, TError> = {
|
|
|
1610
1613
|
pluginExecutor: PluginExecutor;
|
|
1611
1614
|
fetchFn: (options: AnyRequestOptions) => Promise<SpooshResponse<TData, TError>>;
|
|
1612
1615
|
/** Unique identifier for the hook instance. Persists across queryKey changes. */
|
|
1613
|
-
|
|
1616
|
+
instanceId?: string;
|
|
1614
1617
|
};
|
|
1615
1618
|
declare function createOperationController<TData, TError>(options: CreateOperationOptions<TData, TError>): OperationController<TData, TError>;
|
|
1616
1619
|
|
|
@@ -1663,7 +1666,7 @@ type CreateInfiniteReadOptions<TData, TItem, TError, TRequest> = {
|
|
|
1663
1666
|
pluginExecutor: PluginExecutor;
|
|
1664
1667
|
fetchFn: (options: InfiniteRequestOptions, signal: AbortSignal) => Promise<SpooshResponse<TData, TError>>;
|
|
1665
1668
|
/** Unique identifier for the hook instance. Persists across queryKey changes. */
|
|
1666
|
-
|
|
1669
|
+
instanceId?: string;
|
|
1667
1670
|
};
|
|
1668
1671
|
declare function createInfiniteReadController<TData, TItem, TError, TRequest extends InfiniteRequestOptions = InfiniteRequestOptions>(options: CreateInfiniteReadOptions<TData, TItem, TError, TRequest>): InfiniteReadController<TData, TItem, TError>;
|
|
1669
1672
|
|
package/dist/index.d.ts
CHANGED
|
@@ -279,13 +279,16 @@ type PluginContext = {
|
|
|
279
279
|
readonly method: HttpMethod;
|
|
280
280
|
readonly queryKey: string;
|
|
281
281
|
readonly tags: string[];
|
|
282
|
-
/** Timestamp when this request was initiated. Useful for tracing and debugging. */
|
|
283
282
|
readonly requestTimestamp: number;
|
|
284
|
-
/** Unique identifier for
|
|
285
|
-
readonly
|
|
283
|
+
/** Unique identifier for this usage instance. Persists across queryKey changes. */
|
|
284
|
+
readonly instanceId?: string;
|
|
285
|
+
/** Request options with resolved headers. Modify to customize the request (e.g., add headers, signal, body). */
|
|
286
286
|
request: PluginRequestOptions;
|
|
287
|
+
/** Temporary storage for inter-plugin communication during a single request lifecycle. Data stored here doesn't persist beyond the request. */
|
|
287
288
|
temp: Map<string, unknown>;
|
|
289
|
+
/** State manager for accessing and modifying cache entries. */
|
|
288
290
|
stateManager: StateManager;
|
|
291
|
+
/** Event emitter for triggering refetch, invalidation, and other events. */
|
|
289
292
|
eventEmitter: EventEmitter;
|
|
290
293
|
/** Access other plugins' exported APIs */
|
|
291
294
|
plugins: PluginAccessor;
|
|
@@ -1610,7 +1613,7 @@ type CreateOperationOptions<TData, TError> = {
|
|
|
1610
1613
|
pluginExecutor: PluginExecutor;
|
|
1611
1614
|
fetchFn: (options: AnyRequestOptions) => Promise<SpooshResponse<TData, TError>>;
|
|
1612
1615
|
/** Unique identifier for the hook instance. Persists across queryKey changes. */
|
|
1613
|
-
|
|
1616
|
+
instanceId?: string;
|
|
1614
1617
|
};
|
|
1615
1618
|
declare function createOperationController<TData, TError>(options: CreateOperationOptions<TData, TError>): OperationController<TData, TError>;
|
|
1616
1619
|
|
|
@@ -1663,7 +1666,7 @@ type CreateInfiniteReadOptions<TData, TItem, TError, TRequest> = {
|
|
|
1663
1666
|
pluginExecutor: PluginExecutor;
|
|
1664
1667
|
fetchFn: (options: InfiniteRequestOptions, signal: AbortSignal) => Promise<SpooshResponse<TData, TError>>;
|
|
1665
1668
|
/** Unique identifier for the hook instance. Persists across queryKey changes. */
|
|
1666
|
-
|
|
1669
|
+
instanceId?: string;
|
|
1667
1670
|
};
|
|
1668
1671
|
declare function createInfiniteReadController<TData, TItem, TError, TRequest extends InfiniteRequestOptions = InfiniteRequestOptions>(options: CreateInfiniteReadOptions<TData, TItem, TError, TRequest>): InfiniteReadController<TData, TItem, TError>;
|
|
1669
1672
|
|
package/dist/index.js
CHANGED
|
@@ -1232,7 +1232,7 @@ function createOperationController(options) {
|
|
|
1232
1232
|
eventEmitter,
|
|
1233
1233
|
pluginExecutor,
|
|
1234
1234
|
fetchFn,
|
|
1235
|
-
|
|
1235
|
+
instanceId
|
|
1236
1236
|
} = options;
|
|
1237
1237
|
const queryKey = stateManager.createQueryKey({
|
|
1238
1238
|
path,
|
|
@@ -1255,7 +1255,7 @@ function createOperationController(options) {
|
|
|
1255
1255
|
queryKey,
|
|
1256
1256
|
tags: resolvedTags,
|
|
1257
1257
|
requestTimestamp,
|
|
1258
|
-
|
|
1258
|
+
instanceId,
|
|
1259
1259
|
request: {
|
|
1260
1260
|
...initialRequestOptions,
|
|
1261
1261
|
...requestOptions,
|
|
@@ -1450,7 +1450,7 @@ function createInfiniteReadController(options) {
|
|
|
1450
1450
|
eventEmitter,
|
|
1451
1451
|
pluginExecutor,
|
|
1452
1452
|
fetchFn,
|
|
1453
|
-
|
|
1453
|
+
instanceId
|
|
1454
1454
|
} = options;
|
|
1455
1455
|
let pageKeys = [];
|
|
1456
1456
|
let pageRequests = /* @__PURE__ */ new Map();
|
|
@@ -1550,7 +1550,7 @@ function createInfiniteReadController(options) {
|
|
|
1550
1550
|
queryKey: pageKey,
|
|
1551
1551
|
tags,
|
|
1552
1552
|
requestTimestamp: Date.now(),
|
|
1553
|
-
|
|
1553
|
+
instanceId,
|
|
1554
1554
|
request: { headers: {} },
|
|
1555
1555
|
temp: /* @__PURE__ */ new Map(),
|
|
1556
1556
|
pluginOptions,
|
package/dist/index.mjs
CHANGED
|
@@ -1171,7 +1171,7 @@ function createOperationController(options) {
|
|
|
1171
1171
|
eventEmitter,
|
|
1172
1172
|
pluginExecutor,
|
|
1173
1173
|
fetchFn,
|
|
1174
|
-
|
|
1174
|
+
instanceId
|
|
1175
1175
|
} = options;
|
|
1176
1176
|
const queryKey = stateManager.createQueryKey({
|
|
1177
1177
|
path,
|
|
@@ -1194,7 +1194,7 @@ function createOperationController(options) {
|
|
|
1194
1194
|
queryKey,
|
|
1195
1195
|
tags: resolvedTags,
|
|
1196
1196
|
requestTimestamp,
|
|
1197
|
-
|
|
1197
|
+
instanceId,
|
|
1198
1198
|
request: {
|
|
1199
1199
|
...initialRequestOptions,
|
|
1200
1200
|
...requestOptions,
|
|
@@ -1389,7 +1389,7 @@ function createInfiniteReadController(options) {
|
|
|
1389
1389
|
eventEmitter,
|
|
1390
1390
|
pluginExecutor,
|
|
1391
1391
|
fetchFn,
|
|
1392
|
-
|
|
1392
|
+
instanceId
|
|
1393
1393
|
} = options;
|
|
1394
1394
|
let pageKeys = [];
|
|
1395
1395
|
let pageRequests = /* @__PURE__ */ new Map();
|
|
@@ -1489,7 +1489,7 @@ function createInfiniteReadController(options) {
|
|
|
1489
1489
|
queryKey: pageKey,
|
|
1490
1490
|
tags,
|
|
1491
1491
|
requestTimestamp: Date.now(),
|
|
1492
|
-
|
|
1492
|
+
instanceId,
|
|
1493
1493
|
request: { headers: {} },
|
|
1494
1494
|
temp: /* @__PURE__ */ new Map(),
|
|
1495
1495
|
pluginOptions,
|