@spoosh/core 0.4.3 → 0.5.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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -205,7 +205,7 @@ type StateManager = {
|
|
|
205
205
|
getCacheByTags: <TData>(tags: string[]) => CacheEntry<TData> | undefined;
|
|
206
206
|
getCacheEntriesByTags: <TData, TError>(tags: string[]) => CacheEntryWithKey<TData, TError>[];
|
|
207
207
|
getCacheEntriesBySelfTag: <TData, TError>(selfTag: string) => CacheEntryWithKey<TData, TError>[];
|
|
208
|
-
|
|
208
|
+
setMeta: (key: string, data: Record<string, unknown>) => void;
|
|
209
209
|
/** Mark all cache entries with matching tags as stale */
|
|
210
210
|
markStale: (tags: string[]) => void;
|
|
211
211
|
/** Get all cache entries */
|
|
@@ -231,7 +231,7 @@ type CacheEntry<TData = unknown, TError = unknown> = {
|
|
|
231
231
|
state: OperationState<TData, TError>;
|
|
232
232
|
tags: string[];
|
|
233
233
|
/** Plugin-contributed result data (e.g., isOptimistic, isStale). Merged into hook result. */
|
|
234
|
-
|
|
234
|
+
meta: Map<string, unknown>;
|
|
235
235
|
/** The original path-derived tag (e.g., "posts/1/comments"). Used for exact matching in cache */
|
|
236
236
|
selfTag?: string;
|
|
237
237
|
previousData?: TData;
|
package/dist/index.d.ts
CHANGED
|
@@ -205,7 +205,7 @@ type StateManager = {
|
|
|
205
205
|
getCacheByTags: <TData>(tags: string[]) => CacheEntry<TData> | undefined;
|
|
206
206
|
getCacheEntriesByTags: <TData, TError>(tags: string[]) => CacheEntryWithKey<TData, TError>[];
|
|
207
207
|
getCacheEntriesBySelfTag: <TData, TError>(selfTag: string) => CacheEntryWithKey<TData, TError>[];
|
|
208
|
-
|
|
208
|
+
setMeta: (key: string, data: Record<string, unknown>) => void;
|
|
209
209
|
/** Mark all cache entries with matching tags as stale */
|
|
210
210
|
markStale: (tags: string[]) => void;
|
|
211
211
|
/** Get all cache entries */
|
|
@@ -231,7 +231,7 @@ type CacheEntry<TData = unknown, TError = unknown> = {
|
|
|
231
231
|
state: OperationState<TData, TError>;
|
|
232
232
|
tags: string[];
|
|
233
233
|
/** Plugin-contributed result data (e.g., isOptimistic, isStale). Merged into hook result. */
|
|
234
|
-
|
|
234
|
+
meta: Map<string, unknown>;
|
|
235
235
|
/** The original path-derived tag (e.g., "posts/1/comments"). Used for exact matching in cache */
|
|
236
236
|
selfTag?: string;
|
|
237
237
|
previousData?: TData;
|
package/dist/index.js
CHANGED
|
@@ -598,7 +598,7 @@ function createStateManager() {
|
|
|
598
598
|
const newEntry = {
|
|
599
599
|
state: entry.state ?? createInitialState(),
|
|
600
600
|
tags: entry.tags ?? [],
|
|
601
|
-
|
|
601
|
+
meta: /* @__PURE__ */ new Map(),
|
|
602
602
|
selfTag: generateSelfTagFromKey(key),
|
|
603
603
|
previousData: entry.previousData,
|
|
604
604
|
stale: entry.stale
|
|
@@ -658,11 +658,11 @@ function createStateManager() {
|
|
|
658
658
|
});
|
|
659
659
|
return entries;
|
|
660
660
|
},
|
|
661
|
-
|
|
661
|
+
setMeta(key, data) {
|
|
662
662
|
const entry = cache.get(key);
|
|
663
663
|
if (entry) {
|
|
664
664
|
for (const [name, value] of Object.entries(data)) {
|
|
665
|
-
entry.
|
|
665
|
+
entry.meta.set(name, value);
|
|
666
666
|
}
|
|
667
667
|
notifySubscribers(key);
|
|
668
668
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -543,7 +543,7 @@ function createStateManager() {
|
|
|
543
543
|
const newEntry = {
|
|
544
544
|
state: entry.state ?? createInitialState(),
|
|
545
545
|
tags: entry.tags ?? [],
|
|
546
|
-
|
|
546
|
+
meta: /* @__PURE__ */ new Map(),
|
|
547
547
|
selfTag: generateSelfTagFromKey(key),
|
|
548
548
|
previousData: entry.previousData,
|
|
549
549
|
stale: entry.stale
|
|
@@ -603,11 +603,11 @@ function createStateManager() {
|
|
|
603
603
|
});
|
|
604
604
|
return entries;
|
|
605
605
|
},
|
|
606
|
-
|
|
606
|
+
setMeta(key, data) {
|
|
607
607
|
const entry = cache.get(key);
|
|
608
608
|
if (entry) {
|
|
609
609
|
for (const [name, value] of Object.entries(data)) {
|
|
610
|
-
entry.
|
|
610
|
+
entry.meta.set(name, value);
|
|
611
611
|
}
|
|
612
612
|
notifySubscribers(key);
|
|
613
613
|
}
|