@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 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
- setPluginResult: (key: string, data: Record<string, unknown>) => void;
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
- pluginResult: Map<string, unknown>;
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
- setPluginResult: (key: string, data: Record<string, unknown>) => void;
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
- pluginResult: Map<string, unknown>;
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
- pluginResult: /* @__PURE__ */ new Map(),
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
- setPluginResult(key, data) {
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.pluginResult.set(name, value);
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
- pluginResult: /* @__PURE__ */ new Map(),
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
- setPluginResult(key, data) {
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.pluginResult.set(name, value);
610
+ entry.meta.set(name, value);
611
611
  }
612
612
  notifySubscribers(key);
613
613
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spoosh/core",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "license": "MIT",
5
5
  "description": "Type-safe API client with plugin middleware system",
6
6
  "keywords": [