@sweidos/eidos 2.1.0 → 2.3.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.
Files changed (56) hide show
  1. package/README.md +290 -22
  2. package/dist/action.d.ts +22 -0
  3. package/dist/action.js +47 -47
  4. package/dist/action.js.map +1 -1
  5. package/dist/async-storage-adapter.d.ts +25 -0
  6. package/dist/debug.d.ts +46 -0
  7. package/dist/debug.js +43 -0
  8. package/dist/debug.js.map +1 -0
  9. package/dist/devtools.js +350 -21
  10. package/dist/eidos-sw.js +60 -19
  11. package/dist/eidos.cjs +5 -5
  12. package/dist/eidos.cjs.map +1 -1
  13. package/dist/idb.d.ts +10 -0
  14. package/dist/index.d.ts +20 -586
  15. package/dist/index.js +47 -41
  16. package/dist/internal/url-base64.d.ts +2 -0
  17. package/dist/query.d.ts +1 -2
  18. package/dist/queue-storage.d.ts +12 -0
  19. package/dist/queue-sync.d.ts +32 -0
  20. package/dist/react/Provider.d.ts +16 -0
  21. package/dist/react/ProviderRN.d.ts +0 -1
  22. package/dist/react/hooks.d.ts +51 -0
  23. package/dist/react/hooks.js +30 -27
  24. package/dist/react/hooks.js.map +1 -1
  25. package/dist/replay.d.ts +15 -0
  26. package/dist/resource.d.ts +32 -0
  27. package/dist/resource.js +80 -78
  28. package/dist/resource.js.map +1 -1
  29. package/dist/runtime-rn.d.ts +0 -1
  30. package/dist/runtime.d.ts +39 -0
  31. package/dist/runtime.js +32 -24
  32. package/dist/runtime.js.map +1 -1
  33. package/dist/store-slices.d.ts +26 -0
  34. package/dist/store-slices.js +31 -20
  35. package/dist/store-slices.js.map +1 -1
  36. package/dist/store.d.ts +15 -0
  37. package/dist/store.js +22 -19
  38. package/dist/store.js.map +1 -1
  39. package/dist/stores.d.ts +64 -0
  40. package/dist/stores.js +31 -22
  41. package/dist/stores.js.map +1 -1
  42. package/dist/sveltekit.d.ts +0 -1
  43. package/dist/sw-bridge.d.ts +24 -0
  44. package/dist/sw-bridge.js +69 -54
  45. package/dist/sw-bridge.js.map +1 -1
  46. package/dist/testing.cjs +3 -2
  47. package/dist/testing.d.ts +1 -2
  48. package/dist/testing.js +3 -2
  49. package/dist/types.d.ts +305 -0
  50. package/dist/types.js +19 -8
  51. package/dist/types.js.map +1 -1
  52. package/dist/version.d.ts +1 -0
  53. package/dist/version.js +1 -1
  54. package/dist/version.js.map +1 -1
  55. package/dist/vite.d.ts +0 -1
  56. package/package.json +9 -7
package/dist/testing.cjs CHANGED
@@ -144,13 +144,14 @@ async function resetEidos() {
144
144
  * expect(getEidosState().queue).toHaveLength(1)
145
145
  */
146
146
  function getEidosState() {
147
- const { isOnline, swStatus, swError, resources, queue } = _sweidos_eidos.useEidosStore.getState();
147
+ const { isOnline, swStatus, swError, resources, queue, reliability } = _sweidos_eidos.useEidosStore.getState();
148
148
  return {
149
149
  isOnline,
150
150
  swStatus,
151
151
  swError,
152
152
  resources,
153
- queue
153
+ queue,
154
+ reliability
154
155
  };
155
156
  }
156
157
  //#endregion
package/dist/testing.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { EidosState, ReplayResult } from '@sweidos/eidos';
2
-
1
+ import { EidosState, ReplayResult } from './index.ts';
3
2
  export interface MockOfflineOptions {
4
3
  /**
5
4
  * Also stub `globalThis.fetch` to throw a TypeError (simulates a hard
package/dist/testing.js CHANGED
@@ -143,13 +143,14 @@ async function resetEidos() {
143
143
  * expect(getEidosState().queue).toHaveLength(1)
144
144
  */
145
145
  function getEidosState() {
146
- const { isOnline, swStatus, swError, resources, queue } = useEidosStore.getState();
146
+ const { isOnline, swStatus, swError, resources, queue, reliability } = useEidosStore.getState();
147
147
  return {
148
148
  isOnline,
149
149
  swStatus,
150
150
  swError,
151
151
  resources,
152
- queue
152
+ queue,
153
+ reliability
153
154
  };
154
155
  }
155
156
  //#endregion
@@ -0,0 +1,305 @@
1
+ export type CacheStrategy = 'cache-first' | 'stale-while-revalidate' | 'network-first';
2
+ export interface ResourceConfig {
3
+ /** Make this resource available when the device is offline. */
4
+ offline: boolean;
5
+ /** Override the auto-selected caching strategy. */
6
+ strategy?: CacheStrategy;
7
+ /** Custom cache bucket name. Defaults to 'eidos-resources-v1'. */
8
+ cacheName?: string;
9
+ /**
10
+ * Cache schema version. Bump when the response shape changes so old
11
+ * cached entries (a different shape) aren't served from a stale bucket.
12
+ * Appended to `cacheName` as a suffix (e.g. `eidos-resources-v1-v2`).
13
+ * Old-versioned buckets are left in Cache Storage — clear them via
14
+ * `caches.delete()` if needed.
15
+ */
16
+ version?: string | number;
17
+ /** Max age of cached response in milliseconds. Expired entries trigger a network fetch. */
18
+ maxAge?: number;
19
+ /**
20
+ * Maximum number of entries to keep in this resource's cache bucket.
21
+ * When the limit is exceeded after a `cache.put()`, the oldest entry is evicted (FIFO).
22
+ * Useful for list/image endpoints that grow unbounded.
23
+ */
24
+ maxEntries?: number;
25
+ }
26
+ export interface GeneratedStrategy {
27
+ name: string;
28
+ swStrategy: CacheStrategy;
29
+ cacheName: string;
30
+ /** One-line rationale for why this strategy was chosen. */
31
+ reasoning: string;
32
+ /** Human-readable description of each behavioral step. */
33
+ behavior: string[];
34
+ /** Pseudocode showing the equivalent Workbox config. */
35
+ equivalentCode: string;
36
+ }
37
+ export interface ResourceEntry {
38
+ url: string;
39
+ config: ResourceConfig;
40
+ strategy: GeneratedStrategy;
41
+ status: 'idle' | 'fetching' | 'fresh' | 'stale' | 'error' | 'offline';
42
+ cachedAt?: number;
43
+ fetchedAt?: number;
44
+ cacheHits: number;
45
+ cacheMisses: number;
46
+ lastEvent?: 'cache-hit' | 'cache-updated' | 'network-error' | 'cache-cleared';
47
+ }
48
+ export interface ResourceHandle<T = unknown> {
49
+ readonly url: string;
50
+ readonly config: ResourceConfig;
51
+ readonly strategy: GeneratedStrategy;
52
+ fetch: () => Promise<Response>;
53
+ json: () => Promise<T>;
54
+ /** Returns a TanStack Query-compatible options object. */
55
+ query: () => {
56
+ queryKey: [string, string];
57
+ queryFn: () => Promise<T>;
58
+ };
59
+ prefetch: () => Promise<void>;
60
+ invalidate: () => Promise<void>;
61
+ /** Remove from registry and SW. Required before re-registering the same URL with different config. */
62
+ unregister: () => void;
63
+ }
64
+ /**
65
+ * Handle for a URL pattern (`/api/products/*`, `/api/users/:id`, `**`).
66
+ * The SW intercepts all matching requests automatically — there is no single
67
+ * URL to fetch/cache directly, so only cache-management methods are exposed.
68
+ * Returned by `resourcePattern()`.
69
+ */
70
+ export interface PatternResourceHandle {
71
+ readonly url: string;
72
+ readonly config: ResourceConfig;
73
+ readonly strategy: GeneratedStrategy;
74
+ /** Clears all cache entries matching this pattern. */
75
+ invalidate: () => Promise<void>;
76
+ /** Remove from registry and SW. Required before re-registering the same pattern with different config. */
77
+ unregister: () => void;
78
+ }
79
+ /** A handle returned by either `resource()` or `resourcePattern()`. */
80
+ export type AnyResourceHandle = ResourceHandle<any> | PatternResourceHandle;
81
+ /** Summary returned by warmCache(). */
82
+ export interface WarmCacheResult {
83
+ /** Resources that were prefetched successfully. */
84
+ warmed: number;
85
+ /** Resources whose prefetch threw (network error, offline, etc.). */
86
+ failed: number;
87
+ /** The raw errors, in input order, for failed handles. */
88
+ errors: unknown[];
89
+ }
90
+ interface ActionConfigBase<TArgs extends any[] = any[]> {
91
+ /** Max retry attempts before marking as failed. Default: 3. */
92
+ maxRetries?: number;
93
+ /** Human-readable name for the action (used in devtools). */
94
+ name?: string;
95
+ /**
96
+ * Prefixes the registered action id (`namespace::name`). Use to avoid
97
+ * collisions when two actions share a name (e.g. across micro-frontends,
98
+ * or two `createOrder` actions in different modules) — without a
99
+ * namespace, the second registration silently overwrites the first.
100
+ */
101
+ namespace?: string;
102
+ /**
103
+ * Replay order when multiple queued actions are pending.
104
+ * `'high'` items replay before `'normal'`, which replay before `'low'`.
105
+ * Each tier completes fully before the next tier begins.
106
+ * Default: `'normal'`.
107
+ */
108
+ priority?: 'high' | 'normal' | 'low';
109
+ /**
110
+ * Called immediately before the async function executes, with the same args
111
+ * plus a trailing `ActionContext`. Use to apply an optimistic UI update (add
112
+ * item, mark as pending, etc.) and to capture `idempotencyKey` for later
113
+ * `handle.cancel(idempotencyKey)` calls. Called on every invocation —
114
+ * online, offline, and during queue replay.
115
+ */
116
+ onOptimistic?: (...args: [...TArgs, ActionContext]) => void;
117
+ /**
118
+ * Called when the action permanently fails and will not be retried.
119
+ * - `best-effort`: called on first throw.
120
+ * - `neverLose`: called when `maxRetries` is exhausted (status → `'failed'`).
121
+ * Use to revert the optimistic update.
122
+ */
123
+ onRollback?: (...args: [...TArgs, ActionContext]) => void;
124
+ /**
125
+ * Declarative conflict-resolution strategy used during queue replay when
126
+ * the server responds with a 4xx status (conflict, gone, unprocessable,
127
+ * etc.). If not provided, 4xx errors are treated identically to other
128
+ * errors (retried until `maxRetries` is exhausted, then `onRollback` is
129
+ * called). See `ConflictConfig`.
130
+ */
131
+ conflict?: ConflictConfig;
132
+ /**
133
+ * When `true`, each invocation gets an `AbortController` whose `signal` is
134
+ * passed via `ActionContext.signal`. Forward it to `fetch`/etc. so
135
+ * `handle.cancel(idempotencyKey)` can abort an in-flight call, or remove a
136
+ * not-yet-replayed queued item.
137
+ */
138
+ cancellable?: boolean;
139
+ }
140
+ export type ActionConfig<TArgs extends any[] = any[]> = (ActionConfigBase<TArgs> & {
141
+ /** Call directly, no persistence on failure. */
142
+ reliability: 'best-effort';
143
+ }) | (ActionConfigBase<TArgs> & {
144
+ /** Persist to IndexedDB before executing; replay on reconnect. */
145
+ reliability: 'neverLose';
146
+ /**
147
+ * Required for `neverLose` — queued items must survive a page reload
148
+ * and be matched back to this action on replay. `fn.name` is not
149
+ * reliable (minifiers rename it, arrow functions may be anonymous).
150
+ */
151
+ name: string;
152
+ });
153
+ /**
154
+ * Passed to `ConflictConfig.resolve` (for `'merge'`/`'custom'` strategies)
155
+ * when a queued action's replay receives a 4xx response.
156
+ */
157
+ export interface ConflictContext {
158
+ /** Whatever `fn` threw — typically a `Response` or an error with `.status`. */
159
+ error: unknown;
160
+ /** The original arguments the action was queued with. */
161
+ args: any[];
162
+ /** Number of replay attempts so far (0 on first replay). */
163
+ attempt: number;
164
+ idempotencyKey: string;
165
+ }
166
+ /**
167
+ * Outcome of `ConflictConfig.resolve`:
168
+ * - `'retry'`: keep the item queued, retry per normal backoff.
169
+ * - `'skip'`: silently remove the item (no `onRollback`).
170
+ * - `{ resolved: args }`: replace the queued args and retry immediately
171
+ * on the next replay pass.
172
+ */
173
+ export type ConflictResolution = 'retry' | 'skip' | {
174
+ resolved: any[];
175
+ };
176
+ export interface ConflictConfig {
177
+ /**
178
+ * - `'serverWins'`: drop the queued item, keeping the server's state.
179
+ * - `'clientWins'`: keep retrying — the client's write should eventually
180
+ * be accepted (e.g. once the server-side conflict is cleared).
181
+ * - `'merge'` / `'custom'`: call `resolve` to decide.
182
+ */
183
+ strategy: 'serverWins' | 'clientWins' | 'merge' | 'custom';
184
+ /** Required for `'merge'` and `'custom'`. */
185
+ resolve?: (ctx: ConflictContext) => ConflictResolution;
186
+ }
187
+ /** Bump when ActionQueueItem's shape changes. Used to migrate items persisted by older versions. */
188
+ export declare const CURRENT_QUEUE_SCHEMA_VERSION = 2;
189
+ export interface ActionQueueItem {
190
+ /** Shape version this item was persisted with. Items from before v2 are migrated on load. */
191
+ schemaVersion: number;
192
+ id: string;
193
+ /** ID of the registered action (maps to the function in the registry). */
194
+ actionId: string;
195
+ actionName: string;
196
+ /**
197
+ * Stable per-invocation key, generated once and reused across every retry/replay
198
+ * of this item. Pass to your server as an idempotency key so retries that reach
199
+ * the server after a dropped response don't double-execute.
200
+ */
201
+ idempotencyKey: string;
202
+ args: unknown[];
203
+ queuedAt: number;
204
+ retryCount: number;
205
+ maxRetries: number;
206
+ status: 'pending' | 'replaying' | 'succeeded' | 'failed';
207
+ /** Replay priority. High items replay before normal, normal before low. Default: 'normal'. */
208
+ priority?: 'high' | 'normal' | 'low';
209
+ error?: string;
210
+ completedAt?: number;
211
+ /** Earliest timestamp at which this item should be retried (exponential backoff). */
212
+ nextRetryAt?: number;
213
+ }
214
+ export interface QueuedResult {
215
+ readonly queued: true;
216
+ readonly id: string;
217
+ readonly message: string;
218
+ }
219
+ /** Summary returned by replayQueue(). */
220
+ export interface ReplayResult {
221
+ /** Items where the registered function was found and called. */
222
+ attempted: number;
223
+ /** Items that resolved successfully. */
224
+ succeeded: number;
225
+ /** Items that failed and have no retries remaining (status: 'failed'). */
226
+ failed: number;
227
+ /** Items that failed but will be retried later (nextRetryAt set). */
228
+ retrying: number;
229
+ /** Items whose actionId had no registered function — likely not yet imported. */
230
+ skipped: number;
231
+ /** Items that received a 4xx response and were dropped via `conflict: { strategy: 'serverWins' }` (or `resolve()` returning `'skip'`). */
232
+ conflicted: number;
233
+ /** Items removed via `handle.cancel(idempotencyKey)` before/during replay. */
234
+ cancelled: number;
235
+ }
236
+ /**
237
+ * Passed as an extra argument after the declared params to `neverLose` actions,
238
+ * on every invocation (initial call, offline queue, and replay). The same
239
+ * `idempotencyKey` is reused across all retries of one logical invocation —
240
+ * forward it to your server (e.g. as an `Idempotency-Key` header) so a retry
241
+ * that reaches the server after a dropped response doesn't double-execute.
242
+ */
243
+ export interface ActionContext {
244
+ idempotencyKey: string;
245
+ /** 0 on the first attempt, incremented on each replay retry. */
246
+ attempt: number;
247
+ /** Set when `config.cancellable` is true. Forward to `fetch`/etc. for cancellation support. */
248
+ signal?: AbortSignal;
249
+ }
250
+ /**
251
+ * Every action function receives its declared args plus a trailing
252
+ * `ActionContext` — on every invocation (online, offline, and replay).
253
+ */
254
+ export type ActionFn<TArgs extends unknown[], TReturn> = (...args: [...TArgs, ActionContext]) => Promise<TReturn>;
255
+ export interface ActionHandle<TArgs extends any[], TReturn> {
256
+ (...args: TArgs): Promise<TReturn | QueuedResult>;
257
+ readonly id: string;
258
+ readonly config: ActionConfig;
259
+ /**
260
+ * Cancel an invocation by its `idempotencyKey` (from `ActionContext` /
261
+ * `onOptimistic`). Aborts the in-flight call if `cancellable: true` and
262
+ * still running, otherwise removes a not-yet-replayed queued item.
263
+ * Returns `true` if something was cancelled/removed.
264
+ */
265
+ cancel: (idempotencyKey: string) => Promise<boolean>;
266
+ }
267
+ export interface EidosState {
268
+ isOnline: boolean;
269
+ swStatus: 'idle' | 'registering' | 'active' | 'error' | 'unsupported';
270
+ swError?: string;
271
+ resources: Record<string, ResourceEntry>;
272
+ queue: ActionQueueItem[];
273
+ reliability: ReliabilityStats;
274
+ }
275
+ /**
276
+ * Cumulative, session-scoped counters for `neverLose` queue outcomes — opt-in
277
+ * telemetry surfaced via `eidosReliabilityStats` / `useEidosReliabilityStats()`
278
+ * and `EidosConfig.onReliabilityReport`. Reset on page reload (not persisted).
279
+ */
280
+ export interface ReliabilityStats {
281
+ [key: string]: number;
282
+ /** Actions persisted to the queue (offline, or online call that threw). */
283
+ queued: number;
284
+ /** Queue items that executed successfully (first attempt or a retry). */
285
+ succeeded: number;
286
+ /** Queue items that exhausted `maxRetries` and moved to `'failed'`. */
287
+ failed: number;
288
+ /** Replay attempts that failed but will retry (haven't exhausted `maxRetries`). */
289
+ retried: number;
290
+ /** Queue items dropped by a `serverWins`/`merge`/`custom` conflict resolution. */
291
+ conflicted: number;
292
+ /** Queue items removed via `handle.cancel(idempotencyKey)` before replay completed. */
293
+ cancelled: number;
294
+ }
295
+ export declare function emptyReliabilityStats(): ReliabilityStats;
296
+ export interface QueueStatusCounts {
297
+ [key: string]: number;
298
+ pending: number;
299
+ failed: number;
300
+ replaying: number;
301
+ total: number;
302
+ }
303
+ /** Single pass over the queue — avoids separate .filter() calls per status. */
304
+ export declare function countQueueByStatus(queue: ActionQueueItem[]): QueueStatusCounts;
305
+ export {};
package/dist/types.js CHANGED
@@ -1,15 +1,26 @@
1
- function a(e) {
2
- let n = 0, i = 0, s = 0;
3
- for (const t of e) t.status === "pending" ? n++ : t.status === "failed" ? i++ : t.status === "replaying" && s++;
1
+ function a() {
4
2
  return {
5
- pending: n,
6
- failed: i,
7
- replaying: s,
8
- total: e.length
3
+ queued: 0,
4
+ succeeded: 0,
5
+ failed: 0,
6
+ retried: 0,
7
+ conflicted: 0,
8
+ cancelled: 0
9
+ };
10
+ }
11
+ function s(t) {
12
+ let i = 0, n = 0, l = 0;
13
+ for (const e of t) e.status === "pending" ? i++ : e.status === "failed" ? n++ : e.status === "replaying" && l++;
14
+ return {
15
+ pending: i,
16
+ failed: n,
17
+ replaying: l,
18
+ total: t.length
9
19
  };
10
20
  }
11
21
  export {
12
- a as countQueueByStatus
22
+ s as countQueueByStatus,
23
+ a as emptyReliabilityStats
13
24
  };
14
25
 
15
26
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["// ─────────────────────────────────────────────────────────────────────────────\n// Eidos Core Types\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type CacheStrategy = 'cache-first' | 'stale-while-revalidate' | 'network-first';\n\n// ── Resource ─────────────────────────────────────────────────────────────────\n\nexport interface ResourceConfig {\n /** Make this resource available when the device is offline. */\n offline: boolean;\n /** Override the auto-selected caching strategy. */\n strategy?: CacheStrategy;\n /** Custom cache bucket name. Defaults to 'eidos-resources-v1'. */\n cacheName?: string;\n /**\n * Cache schema version. Bump when the response shape changes so old\n * cached entries (a different shape) aren't served from a stale bucket.\n * Appended to `cacheName` as a suffix (e.g. `eidos-resources-v1-v2`).\n * Old-versioned buckets are left in Cache Storage — clear them via\n * `caches.delete()` if needed.\n */\n version?: string | number;\n /** Max age of cached response in milliseconds. Expired entries trigger a network fetch. */\n maxAge?: number;\n}\n\nexport interface GeneratedStrategy {\n name: string;\n swStrategy: CacheStrategy;\n cacheName: string;\n /** One-line rationale for why this strategy was chosen. */\n reasoning: string;\n /** Human-readable description of each behavioral step. */\n behavior: string[];\n /** Pseudocode showing the equivalent Workbox config. */\n equivalentCode: string;\n}\n\nexport interface ResourceEntry {\n url: string;\n config: ResourceConfig;\n strategy: GeneratedStrategy;\n status: 'idle' | 'fetching' | 'fresh' | 'stale' | 'error' | 'offline';\n cachedAt?: number;\n fetchedAt?: number;\n cacheHits: number;\n cacheMisses: number;\n lastEvent?: 'cache-hit' | 'cache-updated' | 'network-error' | 'cache-cleared';\n}\n\nexport interface ResourceHandle<T = unknown> {\n readonly url: string;\n readonly config: ResourceConfig;\n readonly strategy: GeneratedStrategy;\n fetch: () => Promise<Response>;\n json: () => Promise<T>;\n /** Returns a TanStack Query-compatible options object. */\n query: () => { queryKey: [string, string]; queryFn: () => Promise<T> };\n prefetch: () => Promise<void>;\n invalidate: () => Promise<void>;\n /** Remove from registry and SW. Required before re-registering the same URL with different config. */\n unregister: () => void;\n}\n\n/**\n * Handle for a URL pattern (`/api/products/*`, `/api/users/:id`, `**`).\n * The SW intercepts all matching requests automatically — there is no single\n * URL to fetch/cache directly, so only cache-management methods are exposed.\n * Returned by `resourcePattern()`.\n */\nexport interface PatternResourceHandle {\n readonly url: string;\n readonly config: ResourceConfig;\n readonly strategy: GeneratedStrategy;\n /** Clears all cache entries matching this pattern. */\n invalidate: () => Promise<void>;\n /** Remove from registry and SW. Required before re-registering the same pattern with different config. */\n unregister: () => void;\n}\n\n/** A handle returned by either `resource()` or `resourcePattern()`. */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyResourceHandle = ResourceHandle<any> | PatternResourceHandle;\n\n/** Summary returned by warmCache(). */\nexport interface WarmCacheResult {\n /** Resources that were prefetched successfully. */\n warmed: number;\n /** Resources whose prefetch threw (network error, offline, etc.). */\n failed: number;\n /** The raw errors, in input order, for failed handles. */\n errors: unknown[];\n}\n\n// ── Action ───────────────────────────────────────────────────────────────────\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ninterface ActionConfigBase<TArgs extends any[] = any[]> {\n /** Max retry attempts before marking as failed. Default: 3. */\n maxRetries?: number;\n /** Human-readable name for the action (used in devtools). */\n name?: string;\n /**\n * Prefixes the registered action id (`namespace::name`). Use to avoid\n * collisions when two actions share a name (e.g. across micro-frontends,\n * or two `createOrder` actions in different modules) — without a\n * namespace, the second registration silently overwrites the first.\n */\n namespace?: string;\n /**\n * Replay order when multiple queued actions are pending.\n * `'high'` items replay before `'normal'`, which replay before `'low'`.\n * Each tier completes fully before the next tier begins.\n * Default: `'normal'`.\n */\n priority?: 'high' | 'normal' | 'low';\n /**\n * Called immediately before the async function executes, with the same args\n * plus a trailing `ActionContext`. Use to apply an optimistic UI update (add\n * item, mark as pending, etc.) and to capture `idempotencyKey` for later\n * `handle.cancel(idempotencyKey)` calls. Called on every invocation —\n * online, offline, and during queue replay.\n */\n onOptimistic?: (...args: [...TArgs, ActionContext]) => void;\n /**\n * Called when the action permanently fails and will not be retried.\n * - `best-effort`: called on first throw.\n * - `neverLose`: called when `maxRetries` is exhausted (status → `'failed'`).\n * Use to revert the optimistic update.\n */\n onRollback?: (...args: [...TArgs, ActionContext]) => void;\n /**\n * Declarative conflict-resolution strategy used during queue replay when\n * the server responds with a 4xx status (conflict, gone, unprocessable,\n * etc.). If not provided, 4xx errors are treated identically to other\n * errors (retried until `maxRetries` is exhausted, then `onRollback` is\n * called). See `ConflictConfig`.\n */\n conflict?: ConflictConfig;\n /**\n * When `true`, each invocation gets an `AbortController` whose `signal` is\n * passed via `ActionContext.signal`. Forward it to `fetch`/etc. so\n * `handle.cancel(idempotencyKey)` can abort an in-flight call, or remove a\n * not-yet-replayed queued item.\n */\n cancellable?: boolean;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ActionConfig<TArgs extends any[] = any[]> =\n | (ActionConfigBase<TArgs> & {\n /** Call directly, no persistence on failure. */\n reliability: 'best-effort';\n })\n | (ActionConfigBase<TArgs> & {\n /** Persist to IndexedDB before executing; replay on reconnect. */\n reliability: 'neverLose';\n /**\n * Required for `neverLose` — queued items must survive a page reload\n * and be matched back to this action on replay. `fn.name` is not\n * reliable (minifiers rename it, arrow functions may be anonymous).\n */\n name: string;\n });\n\n/**\n * Passed to `ConflictConfig.resolve` (for `'merge'`/`'custom'` strategies)\n * when a queued action's replay receives a 4xx response.\n */\nexport interface ConflictContext {\n /** Whatever `fn` threw — typically a `Response` or an error with `.status`. */\n error: unknown;\n /** The original arguments the action was queued with. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n args: any[];\n /** Number of replay attempts so far (0 on first replay). */\n attempt: number;\n idempotencyKey: string;\n}\n\n/**\n * Outcome of `ConflictConfig.resolve`:\n * - `'retry'`: keep the item queued, retry per normal backoff.\n * - `'skip'`: silently remove the item (no `onRollback`).\n * - `{ resolved: args }`: replace the queued args and retry immediately\n * on the next replay pass.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ConflictResolution = 'retry' | 'skip' | { resolved: any[] };\n\nexport interface ConflictConfig {\n /**\n * - `'serverWins'`: drop the queued item, keeping the server's state.\n * - `'clientWins'`: keep retrying — the client's write should eventually\n * be accepted (e.g. once the server-side conflict is cleared).\n * - `'merge'` / `'custom'`: call `resolve` to decide.\n */\n strategy: 'serverWins' | 'clientWins' | 'merge' | 'custom';\n /** Required for `'merge'` and `'custom'`. */\n resolve?: (ctx: ConflictContext) => ConflictResolution;\n}\n\n/** Bump when ActionQueueItem's shape changes. Used to migrate items persisted by older versions. */\nexport const CURRENT_QUEUE_SCHEMA_VERSION = 2;\n\nexport interface ActionQueueItem {\n /** Shape version this item was persisted with. Items from before v2 are migrated on load. */\n schemaVersion: number;\n id: string;\n /** ID of the registered action (maps to the function in the registry). */\n actionId: string;\n actionName: string;\n /**\n * Stable per-invocation key, generated once and reused across every retry/replay\n * of this item. Pass to your server as an idempotency key so retries that reach\n * the server after a dropped response don't double-execute.\n */\n idempotencyKey: string;\n args: unknown[];\n queuedAt: number;\n retryCount: number;\n maxRetries: number;\n status: 'pending' | 'replaying' | 'succeeded' | 'failed';\n /** Replay priority. High items replay before normal, normal before low. Default: 'normal'. */\n priority?: 'high' | 'normal' | 'low';\n error?: string;\n completedAt?: number;\n /** Earliest timestamp at which this item should be retried (exponential backoff). */\n nextRetryAt?: number;\n}\n\nexport interface QueuedResult {\n readonly queued: true;\n readonly id: string;\n readonly message: string;\n}\n\n/** Summary returned by replayQueue(). */\nexport interface ReplayResult {\n /** Items where the registered function was found and called. */\n attempted: number;\n /** Items that resolved successfully. */\n succeeded: number;\n /** Items that failed and have no retries remaining (status: 'failed'). */\n failed: number;\n /** Items that failed but will be retried later (nextRetryAt set). */\n retrying: number;\n /** Items whose actionId had no registered function — likely not yet imported. */\n skipped: number;\n /** Items that received a 4xx response and were dropped via `conflict: { strategy: 'serverWins' }` (or `resolve()` returning `'skip'`). */\n conflicted: number;\n /** Items removed via `handle.cancel(idempotencyKey)` before/during replay. */\n cancelled: number;\n}\n\n/**\n * Passed as an extra argument after the declared params to `neverLose` actions,\n * on every invocation (initial call, offline queue, and replay). The same\n * `idempotencyKey` is reused across all retries of one logical invocation —\n * forward it to your server (e.g. as an `Idempotency-Key` header) so a retry\n * that reaches the server after a dropped response doesn't double-execute.\n */\nexport interface ActionContext {\n idempotencyKey: string;\n /** 0 on the first attempt, incremented on each replay retry. */\n attempt: number;\n /** Set when `config.cancellable` is true. Forward to `fetch`/etc. for cancellation support. */\n signal?: AbortSignal;\n}\n\n/**\n * Every action function receives its declared args plus a trailing\n * `ActionContext` — on every invocation (online, offline, and replay).\n */\nexport type ActionFn<TArgs extends unknown[], TReturn> = (\n ...args: [...TArgs, ActionContext]\n) => Promise<TReturn>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ActionHandle<TArgs extends any[], TReturn> {\n (...args: TArgs): Promise<TReturn | QueuedResult>;\n readonly id: string;\n readonly config: ActionConfig;\n /**\n * Cancel an invocation by its `idempotencyKey` (from `ActionContext` /\n * `onOptimistic`). Aborts the in-flight call if `cancellable: true` and\n * still running, otherwise removes a not-yet-replayed queued item.\n * Returns `true` if something was cancelled/removed.\n */\n cancel: (idempotencyKey: string) => Promise<boolean>;\n}\n\n// ── Global State ─────────────────────────────────────────────────────────────\n\nexport interface EidosState {\n isOnline: boolean;\n swStatus: 'idle' | 'registering' | 'active' | 'error' | 'unsupported';\n swError?: string;\n resources: Record<string, ResourceEntry>;\n queue: ActionQueueItem[];\n}\n\nexport interface QueueStatusCounts {\n [key: string]: number;\n pending: number;\n failed: number;\n replaying: number;\n total: number;\n}\n\n/** Single pass over the queue — avoids separate .filter() calls per status. */\nexport function countQueueByStatus(queue: ActionQueueItem[]): QueueStatusCounts {\n let pending = 0,\n failed = 0,\n replaying = 0;\n for (const q of queue) {\n if (q.status === 'pending') pending++;\n else if (q.status === 'failed') failed++;\n else if (q.status === 'replaying') replaying++;\n }\n return { pending, failed, replaying, total: queue.length };\n}\n"],"mappings":"AAwTA,SAAgB,EAAmB,GAA6C;AAC9E,MAAI,IAAU,GACZ,IAAS,GACT,IAAY;AACd,aAAW,KAAK,EACd,CAAI,EAAE,WAAW,YAAW,MACnB,EAAE,WAAW,WAAU,MACvB,EAAE,WAAW,eAAa;AAErC,SAAO;AAAA,IAAE,SAAA;AAAA,IAAS,QAAA;AAAA,IAAQ,WAAA;AAAA,IAAW,OAAO,EAAM;AAAA,EAAO;AAC3D"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["// ─────────────────────────────────────────────────────────────────────────────\n// Eidos Core Types\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type CacheStrategy = 'cache-first' | 'stale-while-revalidate' | 'network-first';\n\n// ── Resource ─────────────────────────────────────────────────────────────────\n\nexport interface ResourceConfig {\n /** Make this resource available when the device is offline. */\n offline: boolean;\n /** Override the auto-selected caching strategy. */\n strategy?: CacheStrategy;\n /** Custom cache bucket name. Defaults to 'eidos-resources-v1'. */\n cacheName?: string;\n /**\n * Cache schema version. Bump when the response shape changes so old\n * cached entries (a different shape) aren't served from a stale bucket.\n * Appended to `cacheName` as a suffix (e.g. `eidos-resources-v1-v2`).\n * Old-versioned buckets are left in Cache Storage — clear them via\n * `caches.delete()` if needed.\n */\n version?: string | number;\n /** Max age of cached response in milliseconds. Expired entries trigger a network fetch. */\n maxAge?: number;\n /**\n * Maximum number of entries to keep in this resource's cache bucket.\n * When the limit is exceeded after a `cache.put()`, the oldest entry is evicted (FIFO).\n * Useful for list/image endpoints that grow unbounded.\n */\n maxEntries?: number;\n}\n\nexport interface GeneratedStrategy {\n name: string;\n swStrategy: CacheStrategy;\n cacheName: string;\n /** One-line rationale for why this strategy was chosen. */\n reasoning: string;\n /** Human-readable description of each behavioral step. */\n behavior: string[];\n /** Pseudocode showing the equivalent Workbox config. */\n equivalentCode: string;\n}\n\nexport interface ResourceEntry {\n url: string;\n config: ResourceConfig;\n strategy: GeneratedStrategy;\n status: 'idle' | 'fetching' | 'fresh' | 'stale' | 'error' | 'offline';\n cachedAt?: number;\n fetchedAt?: number;\n cacheHits: number;\n cacheMisses: number;\n lastEvent?: 'cache-hit' | 'cache-updated' | 'network-error' | 'cache-cleared';\n}\n\nexport interface ResourceHandle<T = unknown> {\n readonly url: string;\n readonly config: ResourceConfig;\n readonly strategy: GeneratedStrategy;\n fetch: () => Promise<Response>;\n json: () => Promise<T>;\n /** Returns a TanStack Query-compatible options object. */\n query: () => { queryKey: [string, string]; queryFn: () => Promise<T> };\n prefetch: () => Promise<void>;\n invalidate: () => Promise<void>;\n /** Remove from registry and SW. Required before re-registering the same URL with different config. */\n unregister: () => void;\n}\n\n/**\n * Handle for a URL pattern (`/api/products/*`, `/api/users/:id`, `**`).\n * The SW intercepts all matching requests automatically — there is no single\n * URL to fetch/cache directly, so only cache-management methods are exposed.\n * Returned by `resourcePattern()`.\n */\nexport interface PatternResourceHandle {\n readonly url: string;\n readonly config: ResourceConfig;\n readonly strategy: GeneratedStrategy;\n /** Clears all cache entries matching this pattern. */\n invalidate: () => Promise<void>;\n /** Remove from registry and SW. Required before re-registering the same pattern with different config. */\n unregister: () => void;\n}\n\n/** A handle returned by either `resource()` or `resourcePattern()`. */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyResourceHandle = ResourceHandle<any> | PatternResourceHandle;\n\n/** Summary returned by warmCache(). */\nexport interface WarmCacheResult {\n /** Resources that were prefetched successfully. */\n warmed: number;\n /** Resources whose prefetch threw (network error, offline, etc.). */\n failed: number;\n /** The raw errors, in input order, for failed handles. */\n errors: unknown[];\n}\n\n// ── Action ───────────────────────────────────────────────────────────────────\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ninterface ActionConfigBase<TArgs extends any[] = any[]> {\n /** Max retry attempts before marking as failed. Default: 3. */\n maxRetries?: number;\n /** Human-readable name for the action (used in devtools). */\n name?: string;\n /**\n * Prefixes the registered action id (`namespace::name`). Use to avoid\n * collisions when two actions share a name (e.g. across micro-frontends,\n * or two `createOrder` actions in different modules) — without a\n * namespace, the second registration silently overwrites the first.\n */\n namespace?: string;\n /**\n * Replay order when multiple queued actions are pending.\n * `'high'` items replay before `'normal'`, which replay before `'low'`.\n * Each tier completes fully before the next tier begins.\n * Default: `'normal'`.\n */\n priority?: 'high' | 'normal' | 'low';\n /**\n * Called immediately before the async function executes, with the same args\n * plus a trailing `ActionContext`. Use to apply an optimistic UI update (add\n * item, mark as pending, etc.) and to capture `idempotencyKey` for later\n * `handle.cancel(idempotencyKey)` calls. Called on every invocation —\n * online, offline, and during queue replay.\n */\n onOptimistic?: (...args: [...TArgs, ActionContext]) => void;\n /**\n * Called when the action permanently fails and will not be retried.\n * - `best-effort`: called on first throw.\n * - `neverLose`: called when `maxRetries` is exhausted (status → `'failed'`).\n * Use to revert the optimistic update.\n */\n onRollback?: (...args: [...TArgs, ActionContext]) => void;\n /**\n * Declarative conflict-resolution strategy used during queue replay when\n * the server responds with a 4xx status (conflict, gone, unprocessable,\n * etc.). If not provided, 4xx errors are treated identically to other\n * errors (retried until `maxRetries` is exhausted, then `onRollback` is\n * called). See `ConflictConfig`.\n */\n conflict?: ConflictConfig;\n /**\n * When `true`, each invocation gets an `AbortController` whose `signal` is\n * passed via `ActionContext.signal`. Forward it to `fetch`/etc. so\n * `handle.cancel(idempotencyKey)` can abort an in-flight call, or remove a\n * not-yet-replayed queued item.\n */\n cancellable?: boolean;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ActionConfig<TArgs extends any[] = any[]> =\n | (ActionConfigBase<TArgs> & {\n /** Call directly, no persistence on failure. */\n reliability: 'best-effort';\n })\n | (ActionConfigBase<TArgs> & {\n /** Persist to IndexedDB before executing; replay on reconnect. */\n reliability: 'neverLose';\n /**\n * Required for `neverLose` — queued items must survive a page reload\n * and be matched back to this action on replay. `fn.name` is not\n * reliable (minifiers rename it, arrow functions may be anonymous).\n */\n name: string;\n });\n\n/**\n * Passed to `ConflictConfig.resolve` (for `'merge'`/`'custom'` strategies)\n * when a queued action's replay receives a 4xx response.\n */\nexport interface ConflictContext {\n /** Whatever `fn` threw — typically a `Response` or an error with `.status`. */\n error: unknown;\n /** The original arguments the action was queued with. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n args: any[];\n /** Number of replay attempts so far (0 on first replay). */\n attempt: number;\n idempotencyKey: string;\n}\n\n/**\n * Outcome of `ConflictConfig.resolve`:\n * - `'retry'`: keep the item queued, retry per normal backoff.\n * - `'skip'`: silently remove the item (no `onRollback`).\n * - `{ resolved: args }`: replace the queued args and retry immediately\n * on the next replay pass.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ConflictResolution = 'retry' | 'skip' | { resolved: any[] };\n\nexport interface ConflictConfig {\n /**\n * - `'serverWins'`: drop the queued item, keeping the server's state.\n * - `'clientWins'`: keep retrying — the client's write should eventually\n * be accepted (e.g. once the server-side conflict is cleared).\n * - `'merge'` / `'custom'`: call `resolve` to decide.\n */\n strategy: 'serverWins' | 'clientWins' | 'merge' | 'custom';\n /** Required for `'merge'` and `'custom'`. */\n resolve?: (ctx: ConflictContext) => ConflictResolution;\n}\n\n/** Bump when ActionQueueItem's shape changes. Used to migrate items persisted by older versions. */\nexport const CURRENT_QUEUE_SCHEMA_VERSION = 2;\n\nexport interface ActionQueueItem {\n /** Shape version this item was persisted with. Items from before v2 are migrated on load. */\n schemaVersion: number;\n id: string;\n /** ID of the registered action (maps to the function in the registry). */\n actionId: string;\n actionName: string;\n /**\n * Stable per-invocation key, generated once and reused across every retry/replay\n * of this item. Pass to your server as an idempotency key so retries that reach\n * the server after a dropped response don't double-execute.\n */\n idempotencyKey: string;\n args: unknown[];\n queuedAt: number;\n retryCount: number;\n maxRetries: number;\n status: 'pending' | 'replaying' | 'succeeded' | 'failed';\n /** Replay priority. High items replay before normal, normal before low. Default: 'normal'. */\n priority?: 'high' | 'normal' | 'low';\n error?: string;\n completedAt?: number;\n /** Earliest timestamp at which this item should be retried (exponential backoff). */\n nextRetryAt?: number;\n}\n\nexport interface QueuedResult {\n readonly queued: true;\n readonly id: string;\n readonly message: string;\n}\n\n/** Summary returned by replayQueue(). */\nexport interface ReplayResult {\n /** Items where the registered function was found and called. */\n attempted: number;\n /** Items that resolved successfully. */\n succeeded: number;\n /** Items that failed and have no retries remaining (status: 'failed'). */\n failed: number;\n /** Items that failed but will be retried later (nextRetryAt set). */\n retrying: number;\n /** Items whose actionId had no registered function — likely not yet imported. */\n skipped: number;\n /** Items that received a 4xx response and were dropped via `conflict: { strategy: 'serverWins' }` (or `resolve()` returning `'skip'`). */\n conflicted: number;\n /** Items removed via `handle.cancel(idempotencyKey)` before/during replay. */\n cancelled: number;\n}\n\n/**\n * Passed as an extra argument after the declared params to `neverLose` actions,\n * on every invocation (initial call, offline queue, and replay). The same\n * `idempotencyKey` is reused across all retries of one logical invocation —\n * forward it to your server (e.g. as an `Idempotency-Key` header) so a retry\n * that reaches the server after a dropped response doesn't double-execute.\n */\nexport interface ActionContext {\n idempotencyKey: string;\n /** 0 on the first attempt, incremented on each replay retry. */\n attempt: number;\n /** Set when `config.cancellable` is true. Forward to `fetch`/etc. for cancellation support. */\n signal?: AbortSignal;\n}\n\n/**\n * Every action function receives its declared args plus a trailing\n * `ActionContext` — on every invocation (online, offline, and replay).\n */\nexport type ActionFn<TArgs extends unknown[], TReturn> = (\n ...args: [...TArgs, ActionContext]\n) => Promise<TReturn>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ActionHandle<TArgs extends any[], TReturn> {\n (...args: TArgs): Promise<TReturn | QueuedResult>;\n readonly id: string;\n readonly config: ActionConfig;\n /**\n * Cancel an invocation by its `idempotencyKey` (from `ActionContext` /\n * `onOptimistic`). Aborts the in-flight call if `cancellable: true` and\n * still running, otherwise removes a not-yet-replayed queued item.\n * Returns `true` if something was cancelled/removed.\n */\n cancel: (idempotencyKey: string) => Promise<boolean>;\n}\n\n// ── Global State ─────────────────────────────────────────────────────────────\n\nexport interface EidosState {\n isOnline: boolean;\n swStatus: 'idle' | 'registering' | 'active' | 'error' | 'unsupported';\n swError?: string;\n resources: Record<string, ResourceEntry>;\n queue: ActionQueueItem[];\n reliability: ReliabilityStats;\n}\n\n/**\n * Cumulative, session-scoped counters for `neverLose` queue outcomes — opt-in\n * telemetry surfaced via `eidosReliabilityStats` / `useEidosReliabilityStats()`\n * and `EidosConfig.onReliabilityReport`. Reset on page reload (not persisted).\n */\nexport interface ReliabilityStats {\n [key: string]: number;\n /** Actions persisted to the queue (offline, or online call that threw). */\n queued: number;\n /** Queue items that executed successfully (first attempt or a retry). */\n succeeded: number;\n /** Queue items that exhausted `maxRetries` and moved to `'failed'`. */\n failed: number;\n /** Replay attempts that failed but will retry (haven't exhausted `maxRetries`). */\n retried: number;\n /** Queue items dropped by a `serverWins`/`merge`/`custom` conflict resolution. */\n conflicted: number;\n /** Queue items removed via `handle.cancel(idempotencyKey)` before replay completed. */\n cancelled: number;\n}\n\nexport function emptyReliabilityStats(): ReliabilityStats {\n return { queued: 0, succeeded: 0, failed: 0, retried: 0, conflicted: 0, cancelled: 0 };\n}\n\nexport interface QueueStatusCounts {\n [key: string]: number;\n pending: number;\n failed: number;\n replaying: number;\n total: number;\n}\n\n/** Single pass over the queue — avoids separate .filter() calls per status. */\nexport function countQueueByStatus(queue: ActionQueueItem[]): QueueStatusCounts {\n let pending = 0,\n failed = 0,\n replaying = 0;\n for (const q of queue) {\n if (q.status === 'pending') pending++;\n else if (q.status === 'failed') failed++;\n else if (q.status === 'replaying') replaying++;\n }\n return { pending, failed, replaying, total: queue.length };\n}\n"],"mappings":"AA2UA,SAAgB,IAA0C;AACxD,SAAO;AAAA,IAAE,QAAQ;AAAA,IAAG,WAAW;AAAA,IAAG,QAAQ;AAAA,IAAG,SAAS;AAAA,IAAG,YAAY;AAAA,IAAG,WAAW;AAAA,EAAE;AACvF;AAWA,SAAgB,EAAmB,GAA6C;AAC9E,MAAI,IAAU,GACZ,IAAS,GACT,IAAY;AACd,aAAW,KAAK,EACd,CAAI,EAAE,WAAW,YAAW,MACnB,EAAE,WAAW,WAAU,MACvB,EAAE,WAAW,eAAa;AAErC,SAAO;AAAA,IAAE,SAAA;AAAA,IAAS,QAAA;AAAA,IAAQ,WAAA;AAAA,IAAW,OAAO,EAAM;AAAA,EAAO;AAC3D"}
@@ -0,0 +1 @@
1
+ export declare const VERSION = "2.3.0";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
- var r = "2.1.0";
1
+ var r = "2.3.0";
2
2
  export {
3
3
  r as VERSION
4
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","names":[],"sources":["../src/version.ts"],"sourcesContent":["export const VERSION = '2.1.0';\n"],"mappings":"AAAA,IAAa,IAAU"}
1
+ {"version":3,"file":"version.js","names":[],"sources":["../src/version.ts"],"sourcesContent":["export const VERSION = '2.3.0';\n"],"mappings":"AAAA,IAAa,IAAU"}
package/dist/vite.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Plugin } from 'vite';
2
-
3
2
  export interface EidosPluginOptions {
4
3
  /**
5
4
  * Destination path for the service worker, relative to the project root.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sweidos/eidos",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "description": "Describe intent. The runtime figures out how. An abstraction layer for offline-first web apps.",
5
5
  "author": "Aditya Raj",
6
6
  "license": "MIT",
@@ -25,7 +25,7 @@
25
25
  ],
26
26
  "homepage": "https://sweidos.vercel.app/overview",
27
27
  "bugs": {
28
- "url": "https://github.com/iamadi11/eidos/issues"
28
+ "url": "https://github.com/sweidos/eidos/issues"
29
29
  },
30
30
  "funding": {
31
31
  "type": "github",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "repository": {
38
38
  "type": "git",
39
- "url": "https://github.com/iamadi11/eidos.git",
39
+ "url": "https://github.com/sweidos/eidos.git",
40
40
  "directory": "packages/core"
41
41
  },
42
42
  "main": "./dist/eidos.cjs",
@@ -138,14 +138,14 @@
138
138
  "@types/react": "^19.2.17",
139
139
  "@types/react-dom": "^19.2.3",
140
140
  "@vitejs/plugin-react": "^6.0.2",
141
- "@vitest/coverage-v8": "^4.1.8",
141
+ "@vitest/coverage-v8": "^4.1.9",
142
142
  "fake-indexeddb": "^6.2.5",
143
143
  "jsdom": "^29.1.1",
144
144
  "size-limit": "^12.1.0",
145
145
  "typescript": "^6.0.3",
146
146
  "vite": "^8.0.16",
147
- "vite-plugin-dts": "^3.9.1",
148
- "vitest": "^4.1.8"
147
+ "vite-plugin-dts": "^5.0.2",
148
+ "vitest": "^4.1.9"
149
149
  },
150
150
  "scripts": {
151
151
  "build": "vite build && vite build --config vite.cjs.config.ts && vite build --config vite.plugin.config.ts && vite build --config vite.query.config.ts && vite build --config vite.push.config.ts && vite build --config vite.testing.config.ts && vite build --config vite.nextjs.config.ts && vite build --config vite.sveltekit.config.ts && vite build --config vite.devtools.config.ts && vite build --config vite.react-native.config.ts && vite build --config vite.cli.config.ts && node scripts/copy-sw.mjs",
@@ -153,7 +153,9 @@
153
153
  "type-check": "tsc --noEmit",
154
154
  "test": "vitest run",
155
155
  "test:watch": "vitest",
156
+ "bench": "vitest bench run",
156
157
  "test:coverage": "vitest run --coverage",
157
- "size": "size-limit"
158
+ "size": "size-limit",
159
+ "size:check-docs": "node scripts/check-bundle-size-doc.mjs"
158
160
  }
159
161
  }