@sweidos/eidos 1.0.30 → 1.0.31
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/README.md +136 -2
- package/dist/action.js +58 -47
- package/dist/action.js.map +1 -1
- package/dist/async-storage-adapter.js +42 -0
- package/dist/async-storage-adapter.js.map +1 -0
- package/dist/devtools.js +39 -9
- package/dist/eidos.cjs.js +2 -2
- package/dist/eidos.cjs.js.map +1 -1
- package/dist/idb.js.map +1 -1
- package/dist/index.d.ts +41 -2
- package/dist/index.js +38 -33
- package/dist/index.js.map +1 -1
- package/dist/queue-storage.js +12 -0
- package/dist/queue-storage.js.map +1 -0
- package/dist/react/ProviderRN.d.ts +23 -0
- package/dist/react-native.d.ts +8 -0
- package/dist/react-native.js +59 -0
- package/dist/runtime-rn.d.ts +18 -0
- package/dist/store.js +20 -19
- package/dist/store.js.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +6 -2
package/dist/index.d.ts
CHANGED
|
@@ -75,9 +75,34 @@ export declare interface ActionQueueItem {
|
|
|
75
75
|
nextRetryAt?: number;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
/** Minimal subset of @react-native-async-storage/async-storage (or any compatible key-value store). */
|
|
79
|
+
export declare interface AsyncStorageLike {
|
|
80
|
+
getItem(key: string): Promise<string | null>;
|
|
81
|
+
setItem(key: string, value: string): Promise<void>;
|
|
82
|
+
removeItem(key: string): Promise<void>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* QueueStorage implementation backed by any AsyncStorage-compatible API.
|
|
87
|
+
* Pass the AsyncStorage singleton from @react-native-async-storage/async-storage
|
|
88
|
+
* (or MMKV, SQLite, or any store that satisfies AsyncStorageLike).
|
|
89
|
+
*/
|
|
90
|
+
export declare class AsyncStorageQueueStorage implements QueueStorage {
|
|
91
|
+
private readonly storage;
|
|
92
|
+
constructor(storage: AsyncStorageLike);
|
|
93
|
+
private readAll;
|
|
94
|
+
private writeAll;
|
|
95
|
+
add(item: ActionQueueItem): Promise<void>;
|
|
96
|
+
getAll(): Promise<ActionQueueItem[]>;
|
|
97
|
+
getPending(): Promise<ActionQueueItem[]>;
|
|
98
|
+
update(id: string, patch: Partial<ActionQueueItem>): Promise<void>;
|
|
99
|
+
remove(id: string): Promise<void>;
|
|
100
|
+
clear(): Promise<void>;
|
|
101
|
+
}
|
|
102
|
+
|
|
78
103
|
export declare type CacheStrategy = 'cache-first' | 'stale-while-revalidate' | 'network-first';
|
|
79
104
|
|
|
80
|
-
/** Remove all items from the action queue (
|
|
105
|
+
/** Remove all items from the action queue (storage + in-memory store). */
|
|
81
106
|
export declare function clearQueue(): Promise<void>;
|
|
82
107
|
|
|
83
108
|
/**
|
|
@@ -191,6 +216,8 @@ export declare interface GeneratedStrategy {
|
|
|
191
216
|
equivalentCode: string;
|
|
192
217
|
}
|
|
193
218
|
|
|
219
|
+
export declare function _getQueueStorage(): QueueStorage | null;
|
|
220
|
+
|
|
194
221
|
declare function _getState(): EidosStore;
|
|
195
222
|
|
|
196
223
|
export declare function initEidos(config?: EidosConfig): Promise<void>;
|
|
@@ -207,6 +234,15 @@ export declare interface QueuedResult {
|
|
|
207
234
|
readonly message: string;
|
|
208
235
|
}
|
|
209
236
|
|
|
237
|
+
export declare interface QueueStorage {
|
|
238
|
+
add(item: ActionQueueItem): Promise<void>;
|
|
239
|
+
getAll(): Promise<ActionQueueItem[]>;
|
|
240
|
+
getPending(): Promise<ActionQueueItem[]>;
|
|
241
|
+
update(id: string, patch: Partial<ActionQueueItem>): Promise<void>;
|
|
242
|
+
remove(id: string): Promise<void>;
|
|
243
|
+
clear(): Promise<void>;
|
|
244
|
+
}
|
|
245
|
+
|
|
210
246
|
export declare function replayQueue(): Promise<ReplayResult>;
|
|
211
247
|
|
|
212
248
|
/** Summary returned by replayQueue(). */
|
|
@@ -273,6 +309,9 @@ export declare function setOfflineSimulation(enabled: boolean): void;
|
|
|
273
309
|
|
|
274
310
|
/* Excluded from this release type: setQueryInvalidator */
|
|
275
311
|
|
|
312
|
+
/** Override the default IndexedDB queue with a custom storage backend (e.g. AsyncStorage for React Native). */
|
|
313
|
+
export declare function setQueueStorage(s: QueueStorage): void;
|
|
314
|
+
|
|
276
315
|
declare function _subscribe(listener: Listener): () => void;
|
|
277
316
|
|
|
278
317
|
/** Full Eidos store — prefer the narrower hooks below for performance. */
|
|
@@ -333,7 +372,7 @@ export declare const useEidosStore: {
|
|
|
333
372
|
setState: (partial: Partial<EidosStore> | ((s: EidosStore) => Partial<EidosStore>)) => void;
|
|
334
373
|
};
|
|
335
374
|
|
|
336
|
-
export declare const VERSION = "1.0.
|
|
375
|
+
export declare const VERSION = "1.0.31";
|
|
337
376
|
|
|
338
377
|
/**
|
|
339
378
|
* Bulk-prefetch an array of resource handles concurrently, warming the cache
|
package/dist/index.js
CHANGED
|
@@ -1,39 +1,44 @@
|
|
|
1
|
-
import { resource as
|
|
2
|
-
import { action as
|
|
3
|
-
import { _resetEidos as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { resource as r, setQueryInvalidator as s, warmCache as t } from "./resource.js";
|
|
2
|
+
import { action as i, clearQueue as d, replayQueue as a } from "./action.js";
|
|
3
|
+
import { _resetEidos as S, initEidos as f } from "./runtime.js";
|
|
4
|
+
import { _getQueueStorage as E, setQueueStorage as c } from "./queue-storage.js";
|
|
5
|
+
import { AsyncStorageQueueStorage as x } from "./async-storage-adapter.js";
|
|
6
|
+
import { EidosProvider as g } from "./react/Provider.js";
|
|
7
|
+
import { useEidos as y, useEidosAction as R, useEidosOnDrain as A, useEidosQueue as O, useEidosQueueStats as v, useEidosResource as I, useEidosResources as _, useEidosStatus as h } from "./react/hooks.js";
|
|
8
|
+
import { VERSION as B } from "./version.js";
|
|
9
|
+
import { isBgSyncSupported as D, setOfflineSimulation as N } from "./sw-bridge.js";
|
|
10
|
+
import { useEidosStore as V } from "./store.js";
|
|
11
|
+
import { eidosAction as j, eidosQueue as k, eidosQueueStats as q, eidosResource as z, eidosStatus as F, eidosStore as G } from "./stores.js";
|
|
10
12
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
x as AsyncStorageQueueStorage,
|
|
14
|
+
g as EidosProvider,
|
|
15
|
+
B as VERSION,
|
|
16
|
+
E as _getQueueStorage,
|
|
17
|
+
S as _resetEidos,
|
|
18
|
+
i as action,
|
|
15
19
|
d as clearQueue,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
j as eidosAction,
|
|
21
|
+
k as eidosQueue,
|
|
22
|
+
q as eidosQueueStats,
|
|
23
|
+
z as eidosResource,
|
|
24
|
+
F as eidosStatus,
|
|
25
|
+
G as eidosStore,
|
|
22
26
|
f as initEidos,
|
|
23
|
-
|
|
27
|
+
D as isBgSyncSupported,
|
|
24
28
|
a as replayQueue,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
r as resource,
|
|
30
|
+
N as setOfflineSimulation,
|
|
31
|
+
s as setQueryInvalidator,
|
|
32
|
+
c as setQueueStorage,
|
|
33
|
+
y as useEidos,
|
|
34
|
+
R as useEidosAction,
|
|
35
|
+
A as useEidosOnDrain,
|
|
36
|
+
O as useEidosQueue,
|
|
37
|
+
v as useEidosQueueStats,
|
|
38
|
+
I as useEidosResource,
|
|
39
|
+
_ as useEidosResources,
|
|
40
|
+
h as useEidosStatus,
|
|
41
|
+
V as useEidosStore,
|
|
42
|
+
t as warmCache
|
|
38
43
|
};
|
|
39
44
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue-storage.js","sources":["../src/queue-storage.ts"],"sourcesContent":["import type { ActionQueueItem } from './types'\n\nexport interface QueueStorage {\n add(item: ActionQueueItem): Promise<void>\n getAll(): Promise<ActionQueueItem[]>\n getPending(): Promise<ActionQueueItem[]>\n update(id: string, patch: Partial<ActionQueueItem>): Promise<void>\n remove(id: string): Promise<void>\n clear(): Promise<void>\n}\n\nlet _storage: QueueStorage | null = null\n\n/** Override the default IndexedDB queue with a custom storage backend (e.g. AsyncStorage for React Native). */\nexport function setQueueStorage(s: QueueStorage): void {\n _storage = s\n}\n\nexport function _getQueueStorage(): QueueStorage | null {\n return _storage\n}\n"],"names":["_storage","setQueueStorage","s","_getQueueStorage"],"mappings":"AAWA,IAAIA,IAAgC;AAG7B,SAASC,EAAgBC,GAAuB;AACrD,EAAAF,IAAWE;AACb;AAEO,SAASC,IAAwC;AACtD,SAAOH;AACT;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface EidosProviderRNProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
/**
|
|
6
|
+
* Current network connectivity state.
|
|
7
|
+
* Pass the value from `useNetInfo()` (@react-native-community/netinfo).
|
|
8
|
+
* Defaults to `true` if omitted.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const netInfo = useNetInfo()
|
|
12
|
+
* <EidosProviderRN isConnected={netInfo.isConnected ?? true}>
|
|
13
|
+
*/
|
|
14
|
+
isConnected?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Connectivity bridge for React Native.
|
|
18
|
+
* Syncs the network state into the Eidos store so `initEidosRN`'s autoReplay
|
|
19
|
+
* subscription fires when the device comes back online.
|
|
20
|
+
*
|
|
21
|
+
* Render this near the root of your app, after calling `initEidosRN()`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function EidosProviderRN({ children, isConnected }: EidosProviderRNProps): React.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { EidosProviderRN } from './react/ProviderRN';
|
|
2
|
+
export type { EidosProviderRNProps } from './react/ProviderRN';
|
|
3
|
+
export { initEidosRN, _resetEidosRN } from './runtime-rn';
|
|
4
|
+
export type { EidosRNConfig } from './runtime-rn';
|
|
5
|
+
export { setQueueStorage } from './index.ts';
|
|
6
|
+
export type { QueueStorage } from './index.ts';
|
|
7
|
+
export { AsyncStorageQueueStorage } from './index.ts';
|
|
8
|
+
export type { AsyncStorageLike } from './index.ts';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useEffect } from "react";
|
|
3
|
+
import { useEidosStore, AsyncStorageQueueStorage, setQueueStorage, replayQueue } from "@sweidos/eidos";
|
|
4
|
+
import { AsyncStorageQueueStorage as AsyncStorageQueueStorage2, setQueueStorage as setQueueStorage2 } from "@sweidos/eidos";
|
|
5
|
+
function EidosProviderRN({ children, isConnected }) {
|
|
6
|
+
const prevRef = useRef(void 0);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const online = isConnected !== false;
|
|
9
|
+
if (online !== prevRef.current) {
|
|
10
|
+
prevRef.current = online;
|
|
11
|
+
useEidosStore.getState().setOnline(online);
|
|
12
|
+
}
|
|
13
|
+
}, [isConnected]);
|
|
14
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
15
|
+
}
|
|
16
|
+
let _initialized = false;
|
|
17
|
+
let _unsubscribe = null;
|
|
18
|
+
async function initEidosRN(config) {
|
|
19
|
+
if (_initialized) return;
|
|
20
|
+
_initialized = true;
|
|
21
|
+
const { storage, autoReplay = true } = config;
|
|
22
|
+
const queueStorage = new AsyncStorageQueueStorage(storage);
|
|
23
|
+
setQueueStorage(queueStorage);
|
|
24
|
+
try {
|
|
25
|
+
const persisted = await queueStorage.getAll();
|
|
26
|
+
if (persisted.length > 0) {
|
|
27
|
+
useEidosStore.getState().hydrateQueue(persisted);
|
|
28
|
+
}
|
|
29
|
+
} catch {
|
|
30
|
+
}
|
|
31
|
+
if (autoReplay) {
|
|
32
|
+
let prevIsOnline = useEidosStore.getState().isOnline;
|
|
33
|
+
_unsubscribe = useEidosStore.subscribe(() => {
|
|
34
|
+
const { isOnline } = useEidosStore.getState();
|
|
35
|
+
const justCameOnline = isOnline && !prevIsOnline;
|
|
36
|
+
prevIsOnline = isOnline;
|
|
37
|
+
if (justCameOnline) {
|
|
38
|
+
setTimeout(replayQueue, 600);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const store = useEidosStore.getState();
|
|
42
|
+
const hasPending = store.queue.some((q) => q.status === "pending" || q.status === "failed");
|
|
43
|
+
if (store.isOnline && hasPending) {
|
|
44
|
+
setTimeout(replayQueue, 1200);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function _resetEidosRN() {
|
|
49
|
+
_unsubscribe == null ? void 0 : _unsubscribe();
|
|
50
|
+
_unsubscribe = null;
|
|
51
|
+
_initialized = false;
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
AsyncStorageQueueStorage2 as AsyncStorageQueueStorage,
|
|
55
|
+
EidosProviderRN,
|
|
56
|
+
_resetEidosRN,
|
|
57
|
+
initEidosRN,
|
|
58
|
+
setQueueStorage2 as setQueueStorage
|
|
59
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AsyncStorageLike } from './index.ts';
|
|
2
|
+
|
|
3
|
+
export interface EidosRNConfig {
|
|
4
|
+
/** AsyncStorage singleton (or any AsyncStorageLike key-value store). */
|
|
5
|
+
storage: AsyncStorageLike;
|
|
6
|
+
/** Replay the queue automatically when the app comes back online. Default: true. */
|
|
7
|
+
autoReplay?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Initialize Eidos for React Native.
|
|
11
|
+
* Call this once at app startup (outside any component) before rendering.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* import AsyncStorage from '@react-native-async-storage/async-storage'
|
|
15
|
+
* await initEidosRN({ storage: AsyncStorage })
|
|
16
|
+
*/
|
|
17
|
+
export declare function initEidosRN(config: EidosRNConfig): Promise<void>;
|
|
18
|
+
export declare function _resetEidosRN(): void;
|
package/dist/store.js
CHANGED
|
@@ -3,43 +3,44 @@ const n = /* @__PURE__ */ new Set();
|
|
|
3
3
|
function a() {
|
|
4
4
|
n.forEach((e) => e());
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function r(e) {
|
|
7
7
|
o = { ...o, ...e(o) }, a();
|
|
8
8
|
}
|
|
9
9
|
o = {
|
|
10
|
-
|
|
10
|
+
// navigator.onLine is undefined in React Native — default to true unless explicitly false
|
|
11
|
+
isOnline: typeof navigator > "u" || navigator.onLine !== !1,
|
|
11
12
|
swStatus: "idle",
|
|
12
13
|
swError: void 0,
|
|
13
14
|
resources: {},
|
|
14
15
|
queue: [],
|
|
15
|
-
setOnline: (e) =>
|
|
16
|
-
setSwStatus: (e, u) =>
|
|
17
|
-
registerResource: (e, u) =>
|
|
18
|
-
updateResource: (e, u) =>
|
|
16
|
+
setOnline: (e) => r(() => ({ isOnline: e })),
|
|
17
|
+
setSwStatus: (e, u) => r(() => ({ swStatus: e, swError: u })),
|
|
18
|
+
registerResource: (e, u) => r((t) => ({ resources: { ...t.resources, [e]: u } })),
|
|
19
|
+
updateResource: (e, u) => r((t) => ({
|
|
19
20
|
resources: {
|
|
20
21
|
...t.resources,
|
|
21
22
|
[e]: t.resources[e] ? { ...t.resources[e], ...u } : t.resources[e]
|
|
22
23
|
}
|
|
23
24
|
})),
|
|
24
|
-
unregisterResource: (e) =>
|
|
25
|
-
const { [e]: t, ...
|
|
26
|
-
return { resources:
|
|
25
|
+
unregisterResource: (e) => r((u) => {
|
|
26
|
+
const { [e]: t, ...s } = u.resources;
|
|
27
|
+
return { resources: s };
|
|
27
28
|
}),
|
|
28
|
-
addQueueItem: (e) =>
|
|
29
|
-
updateQueueItem: (e, u) =>
|
|
30
|
-
queue: t.queue.map((
|
|
29
|
+
addQueueItem: (e) => r((u) => ({ queue: [...u.queue, e] })),
|
|
30
|
+
updateQueueItem: (e, u) => r((t) => ({
|
|
31
|
+
queue: t.queue.map((s) => s.id === e ? { ...s, ...u } : s)
|
|
31
32
|
})),
|
|
32
|
-
batchUpdateQueueItems: (e) =>
|
|
33
|
-
const t = new Map(e.map((
|
|
33
|
+
batchUpdateQueueItems: (e) => r((u) => {
|
|
34
|
+
const t = new Map(e.map((s) => [s.id, s.update]));
|
|
34
35
|
return {
|
|
35
|
-
queue: u.queue.map((
|
|
36
|
-
const c = t.get(
|
|
37
|
-
return c ? { ...
|
|
36
|
+
queue: u.queue.map((s) => {
|
|
37
|
+
const c = t.get(s.id);
|
|
38
|
+
return c ? { ...s, ...c } : s;
|
|
38
39
|
})
|
|
39
40
|
};
|
|
40
41
|
}),
|
|
41
|
-
removeQueueItem: (e) =>
|
|
42
|
-
hydrateQueue: (e) =>
|
|
42
|
+
removeQueueItem: (e) => r((u) => ({ queue: u.queue.filter((t) => t.id !== e) })),
|
|
43
|
+
hydrateQueue: (e) => r(() => ({ queue: e }))
|
|
43
44
|
};
|
|
44
45
|
function d() {
|
|
45
46
|
return o;
|
package/dist/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sources":["../src/store.ts"],"sourcesContent":["import type { EidosState, ResourceEntry, ActionQueueItem } from './types'\n\nexport interface EidosStore extends EidosState {\n // Online\n setOnline: (online: boolean) => void\n // SW\n setSwStatus: (status: EidosState['swStatus'], error?: string) => void\n // Resources\n registerResource: (url: string, entry: ResourceEntry) => void\n updateResource: (url: string, update: Partial<ResourceEntry>) => void\n unregisterResource: (url: string) => void\n // Queue\n addQueueItem: (item: ActionQueueItem) => void\n updateQueueItem: (id: string, update: Partial<ActionQueueItem>) => void\n batchUpdateQueueItems: (updates: Array<{ id: string; update: Partial<ActionQueueItem> }>) => void\n removeQueueItem: (id: string) => void\n hydrateQueue: (items: ActionQueueItem[]) => void\n}\n\ntype Listener = () => void\n\nlet _state: EidosStore\nconst _listeners = new Set<Listener>()\n\nfunction _notify() {\n _listeners.forEach((fn) => fn())\n}\n\nfunction _set(updater: (prev: EidosStore) => Partial<EidosStore>) {\n _state = { ..._state, ...updater(_state) }\n _notify()\n}\n\n_state = {\n isOnline: typeof navigator
|
|
1
|
+
{"version":3,"file":"store.js","sources":["../src/store.ts"],"sourcesContent":["import type { EidosState, ResourceEntry, ActionQueueItem } from './types'\n\nexport interface EidosStore extends EidosState {\n // Online\n setOnline: (online: boolean) => void\n // SW\n setSwStatus: (status: EidosState['swStatus'], error?: string) => void\n // Resources\n registerResource: (url: string, entry: ResourceEntry) => void\n updateResource: (url: string, update: Partial<ResourceEntry>) => void\n unregisterResource: (url: string) => void\n // Queue\n addQueueItem: (item: ActionQueueItem) => void\n updateQueueItem: (id: string, update: Partial<ActionQueueItem>) => void\n batchUpdateQueueItems: (updates: Array<{ id: string; update: Partial<ActionQueueItem> }>) => void\n removeQueueItem: (id: string) => void\n hydrateQueue: (items: ActionQueueItem[]) => void\n}\n\ntype Listener = () => void\n\nlet _state: EidosStore\nconst _listeners = new Set<Listener>()\n\nfunction _notify() {\n _listeners.forEach((fn) => fn())\n}\n\nfunction _set(updater: (prev: EidosStore) => Partial<EidosStore>) {\n _state = { ..._state, ...updater(_state) }\n _notify()\n}\n\n_state = {\n // navigator.onLine is undefined in React Native — default to true unless explicitly false\n isOnline: typeof navigator === 'undefined' || navigator.onLine !== false,\n swStatus: 'idle',\n swError: undefined,\n resources: {},\n queue: [],\n\n setOnline: (isOnline) => _set(() => ({ isOnline })),\n\n setSwStatus: (swStatus, swError) => _set(() => ({ swStatus, swError })),\n\n registerResource: (url, entry) =>\n _set((s) => ({ resources: { ...s.resources, [url]: entry } })),\n\n updateResource: (url, update) =>\n _set((s) => ({\n resources: {\n ...s.resources,\n [url]: s.resources[url] ? { ...s.resources[url], ...update } : s.resources[url],\n },\n })),\n\n unregisterResource: (url) =>\n _set((s) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [url]: _removed, ...rest } = s.resources\n return { resources: rest }\n }),\n\n addQueueItem: (item) => _set((s) => ({ queue: [...s.queue, item] })),\n\n updateQueueItem: (id, update) =>\n _set((s) => ({\n queue: s.queue.map((item) => (item.id === id ? { ...item, ...update } : item)),\n })),\n\n batchUpdateQueueItems: (updates) =>\n _set((s) => {\n const map = new Map(updates.map((u) => [u.id, u.update]))\n return {\n queue: s.queue.map((item) => {\n const u = map.get(item.id)\n return u ? { ...item, ...u } : item\n }),\n }\n }),\n\n removeQueueItem: (id) => _set((s) => ({ queue: s.queue.filter((item) => item.id !== id) })),\n\n hydrateQueue: (items) => _set(() => ({ queue: items })),\n}\n\nfunction _getState() {\n return _state\n}\n\nfunction _subscribe(listener: Listener) {\n _listeners.add(listener)\n return () => { _listeners.delete(listener) }\n}\n\nexport const useEidosStore = {\n getState: _getState,\n subscribe: _subscribe,\n // Test/devtools helper — merges partial state, preserves action methods.\n setState: (partial: Partial<EidosStore> | ((s: EidosStore) => Partial<EidosStore>)) => {\n const update = typeof partial === 'function' ? partial(_state) : partial\n _state = { ..._state, ...update }\n _notify()\n },\n}\n"],"names":["_state","_listeners","_notify","fn","_set","updater","isOnline","swStatus","swError","url","entry","s","update","_removed","rest","item","id","updates","map","u","items","_getState","_subscribe","listener","useEidosStore","partial"],"mappings":"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"}
|
package/dist/version.js
CHANGED
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":["export const VERSION = '1.0.
|
|
1
|
+
{"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":["export const VERSION = '1.0.31'\n"],"names":["VERSION"],"mappings":"AAAO,MAAMA,IAAU;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sweidos/eidos",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.31",
|
|
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",
|
|
@@ -60,6 +60,10 @@
|
|
|
60
60
|
"./devtools": {
|
|
61
61
|
"import": "./dist/devtools.js",
|
|
62
62
|
"types": "./dist/devtools.d.ts"
|
|
63
|
+
},
|
|
64
|
+
"./react-native": {
|
|
65
|
+
"import": "./dist/react-native.js",
|
|
66
|
+
"types": "./dist/react-native.d.ts"
|
|
63
67
|
}
|
|
64
68
|
},
|
|
65
69
|
"files": [
|
|
@@ -100,7 +104,7 @@
|
|
|
100
104
|
"vitest": "^2.1.9"
|
|
101
105
|
},
|
|
102
106
|
"scripts": {
|
|
103
|
-
"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.testing.config.ts && vite build --config vite.nextjs.config.ts && vite build --config vite.sveltekit.config.ts && vite build --config vite.devtools.config.ts && node scripts/copy-sw.mjs",
|
|
107
|
+
"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.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 && node scripts/copy-sw.mjs",
|
|
104
108
|
"dev": "vite build --watch",
|
|
105
109
|
"type-check": "tsc --noEmit",
|
|
106
110
|
"test": "vitest run",
|