@lunora/client 1.0.0-alpha.8 → 1.0.0-alpha.80
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/LICENSE.md +6 -0
- package/README.md +1 -1
- package/dist/auth/index.d.mts +12 -10
- package/dist/auth/index.d.ts +12 -10
- package/dist/auth/index.mjs +1 -60
- package/dist/index.d.mts +901 -230
- package/dist/index.d.ts +901 -230
- package/dist/index.mjs +1 -15
- package/dist/packem_shared/CONFLICT_ERROR_CODE-BOeeP_Wl.mjs +1 -0
- package/dist/packem_shared/ClientServiceWorker-DXnBXeWK.mjs +1 -0
- package/dist/packem_shared/DEFAULT_MAX_BUFFER-D3QH2iaq.mjs +1 -0
- package/dist/packem_shared/LunoraClient-DvW7qhym.mjs +1 -0
- package/dist/packem_shared/OfflineQueue-ZapYrAVi.mjs +1 -0
- package/dist/packem_shared/RETIRE_AFTER_DURABLE_SEQ_ADVANCE-DoEHtuR8.mjs +1 -0
- package/dist/packem_shared/SKIP-d7LeP-sY.mjs +1 -0
- package/dist/packem_shared/SubscriptionRegistry-B-DL8LN8.mjs +1 -0
- package/dist/packem_shared/TabCoordinator-CXD7vulJ.mjs +1 -0
- package/dist/packem_shared/anyApi-CBOws2ZA.mjs +1 -0
- package/dist/packem_shared/applyDelta-31EjZTCE.mjs +1 -0
- package/dist/packem_shared/createAsyncStoragePersistence-CeUW9NTj.mjs +1 -0
- package/dist/packem_shared/createAsyncStorageQueryCache-CHuT2gMk.mjs +1 -0
- package/dist/packem_shared/createCallRunner-Bwcrfh76.mjs +1 -0
- package/dist/packem_shared/createClientQuery-B8Nfj-7o.mjs +1 -0
- package/dist/packem_shared/createInMemoryBookmarkStorage-BooZhW0n.mjs +1 -0
- package/dist/packem_shared/createInMemoryPersistence-Cz2W6XVj.mjs +1 -0
- package/dist/packem_shared/createInMemoryQueryCache-D2uNHLfM.mjs +1 -0
- package/dist/packem_shared/createLocalStore-f4-wbsx8.mjs +1 -0
- package/dist/packem_shared/createMutatorRunner-CuMRJpUx.mjs +1 -0
- package/dist/packem_shared/createReconnect-CjTmjJDH.mjs +1 -0
- package/dist/packem_shared/createReply-CwFABEJs.mjs +1 -0
- package/dist/packem_shared/createServerClient-BMkP2YSw.mjs +1 -0
- package/dist/packem_shared/createSnapshotPrecondition-BPlxxQ17.mjs +1 -0
- package/dist/packem_shared/delta-merge-CI3MkJxS.mjs +1 -0
- package/dist/packem_shared/deserializePreloaded-DrV88fVa.mjs +1 -0
- package/dist/packem_shared/function-reference.d-Br_hsKje.d.mts +45 -0
- package/dist/packem_shared/function-reference.d-Br_hsKje.d.ts +45 -0
- package/dist/packem_shared/getServerSession-BaOoo1p6.mjs +1 -0
- package/dist/packem_shared/httpStream-x6q-x4yK.mjs +11 -0
- package/dist/packem_shared/idb-utility-C8WS390w.mjs +1 -0
- package/dist/packem_shared/local-store-nG88k2Wo.mjs +1 -0
- package/dist/packem_shared/lunora-client.d-D6g91j8X.d.mts +3755 -0
- package/dist/packem_shared/lunora-client.d-DiKeST-Z.d.ts +3755 -0
- package/dist/packem_shared/offline-queue-xntsWiKt.mjs +1 -0
- package/dist/packem_shared/preload.d-BWPg1lFK.d.ts +21 -0
- package/dist/packem_shared/preload.d-BfLwnKiD.d.mts +21 -0
- package/dist/packem_shared/preloadQuery-uFy24PCR.mjs +1 -0
- package/dist/packem_shared/single-blob-store-DrhzObic.mjs +1 -0
- package/dist/packem_shared/wire-codec-BiYbPSuZ.mjs +1 -0
- package/dist/packem_shared/wire-key-BShqqhZA.mjs +1 -0
- package/dist/pagination/index.d.mts +42 -42
- package/dist/pagination/index.d.ts +42 -42
- package/dist/pagination/index.mjs +1 -61
- package/dist/query/index.d.mts +111 -43
- package/dist/query/index.d.ts +111 -43
- package/dist/query/index.mjs +1 -1
- package/dist/service.d.mts +49 -0
- package/dist/service.d.ts +49 -0
- package/dist/service.mjs +1 -0
- package/dist/ssr/index.d.mts +109 -79
- package/dist/ssr/index.d.ts +109 -79
- package/dist/ssr/index.mjs +1 -4
- package/dist/upload.d.mts +35 -0
- package/dist/upload.d.ts +35 -0
- package/dist/upload.mjs +1 -0
- package/package.json +16 -1
- package/dist/packem_shared/CONFLICT_ERROR_CODE-aUdVbEDw.mjs +0 -4
- package/dist/packem_shared/DEFAULT_MAX_BUFFER-BDkqO5PW.mjs +0 -107
- package/dist/packem_shared/LunoraClient-Bsv8immC.mjs +0 -2546
- package/dist/packem_shared/OfflineQueue-D-ASeqL7.mjs +0 -131
- package/dist/packem_shared/SKIP-vItZChkw.mjs +0 -50
- package/dist/packem_shared/SubscriptionRegistry-Dn-7k7eo.mjs +0 -1
- package/dist/packem_shared/applyDelta-4jFGTPA3.mjs +0 -61
- package/dist/packem_shared/createAsyncStoragePersistence-1Z5BZ8RC.mjs +0 -45
- package/dist/packem_shared/createInMemoryBookmarkStorage-BoN7a7TH.mjs +0 -11
- package/dist/packem_shared/createInMemoryPersistence-CW82inU5.mjs +0 -105
- package/dist/packem_shared/createInMemoryQueryCache-B1PQ9Twl.mjs +0 -138
- package/dist/packem_shared/createLocalStore-DSUfoLqY.mjs +0 -36
- package/dist/packem_shared/createMutationRunner-BqsavzvG.mjs +0 -21
- package/dist/packem_shared/createMutatorRunner-BETvCd0p.mjs +0 -31
- package/dist/packem_shared/createReconnect-Di_-oHH7.mjs +0 -22
- package/dist/packem_shared/createServerClient-DucOyOz3.mjs +0 -11
- package/dist/packem_shared/deserializePreloaded-C0eJTY_W.mjs +0 -4
- package/dist/packem_shared/getServerSession-8jXewqxd.mjs +0 -13
- package/dist/packem_shared/lunora-client.d-CeUZ8lE1.d.mts +0 -2015
- package/dist/packem_shared/lunora-client.d-CeUZ8lE1.d.ts +0 -2015
- package/dist/packem_shared/preload.d-CzHLgVfw.d.ts +0 -20
- package/dist/packem_shared/preload.d-DipqU0PI.d.mts +0 -20
- package/dist/packem_shared/preloadQuery-lobFkD2Z.mjs +0 -13
- package/dist/packem_shared/subscription-C1Jy7HiF.mjs +0 -55
package/LICENSE.md
CHANGED
|
@@ -103,3 +103,9 @@ Unless required by applicable law or agreed to in writing, software distributed
|
|
|
103
103
|
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
104
|
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
105
|
specific language governing permissions and limitations under the License.
|
|
106
|
+
|
|
107
|
+
<!-- DEPENDENCIES -->
|
|
108
|
+
<!-- /DEPENDENCIES -->
|
|
109
|
+
|
|
110
|
+
<!-- TYPE_DEPENDENCIES -->
|
|
111
|
+
<!-- /TYPE_DEPENDENCIES -->
|
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
37
|
-
The framework-agnostic browser/edge SDK for Lunora. It runs RPC over HTTP and real-time deltas over a single multiplexed WebSocket, with optimistic updates, an offline mutation queue, and
|
|
37
|
+
The framework-agnostic browser/edge SDK for Lunora. It runs RPC over HTTP and real-time deltas over a single multiplexed WebSocket, with optimistic updates, an offline mutation queue, and exponential-backoff-with-jitter reconnect built in. It is the lowest-level user-facing entry point that every framework adapter (React, Vue, Svelte, Solid) layers on top of.
|
|
38
38
|
|
|
39
39
|
Part of the [Lunora](https://github.com/anolilab/lunora) framework — a type-safe, real-time backend on Cloudflare Workers + Durable Objects with a Vite-first DX.
|
|
40
40
|
|
package/dist/auth/index.d.mts
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import { U as User, L as LunoraClient } from "../packem_shared/lunora-client.d-
|
|
1
|
+
import { U as User, L as LunoraClient } from "../packem_shared/lunora-client.d-D6g91j8X.mjs";
|
|
2
|
+
import '@lunora/errors';
|
|
3
|
+
import "../packem_shared/function-reference.d-Br_hsKje.mjs";
|
|
2
4
|
import '@lunora/runtime';
|
|
3
5
|
interface IdentityStore {
|
|
4
6
|
/** Read the current resolved user, or `null` when signed out / not yet resolved. */
|
|
5
7
|
getUser: () => User | null;
|
|
6
8
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
* Subscribe to identity changes. `onChange` is called whenever the user or
|
|
10
|
+
* token changes. Returns an unsubscribe handle.
|
|
11
|
+
*/
|
|
10
12
|
subscribe: (onChange: () => void) => () => void;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
|
-
* Return the per-client identity store, creating it on first access.
|
|
14
|
-
*
|
|
15
|
-
* The store is cached via a `WeakMap` so it is GC'd when the client is dropped,
|
|
16
|
-
* and creation is idempotent — calling this multiple times with the same client
|
|
17
|
-
* returns the same store, keeping the single-fetch / fan-out invariant.
|
|
18
|
-
*/
|
|
15
|
+
* Return the per-client identity store, creating it on first access.
|
|
16
|
+
*
|
|
17
|
+
* The store is cached via a `WeakMap` so it is GC'd when the client is dropped,
|
|
18
|
+
* and creation is idempotent — calling this multiple times with the same client
|
|
19
|
+
* returns the same store, keeping the single-fetch / fan-out invariant.
|
|
20
|
+
*/
|
|
19
21
|
declare const getIdentityStore: (client: LunoraClient) => IdentityStore;
|
|
20
22
|
export { type IdentityStore, getIdentityStore };
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import { U as User, L as LunoraClient } from "../packem_shared/lunora-client.d-
|
|
1
|
+
import { U as User, L as LunoraClient } from "../packem_shared/lunora-client.d-DiKeST-Z.js";
|
|
2
|
+
import '@lunora/errors';
|
|
3
|
+
import "../packem_shared/function-reference.d-Br_hsKje.js";
|
|
2
4
|
import '@lunora/runtime';
|
|
3
5
|
interface IdentityStore {
|
|
4
6
|
/** Read the current resolved user, or `null` when signed out / not yet resolved. */
|
|
5
7
|
getUser: () => User | null;
|
|
6
8
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
* Subscribe to identity changes. `onChange` is called whenever the user or
|
|
10
|
+
* token changes. Returns an unsubscribe handle.
|
|
11
|
+
*/
|
|
10
12
|
subscribe: (onChange: () => void) => () => void;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
|
-
* Return the per-client identity store, creating it on first access.
|
|
14
|
-
*
|
|
15
|
-
* The store is cached via a `WeakMap` so it is GC'd when the client is dropped,
|
|
16
|
-
* and creation is idempotent — calling this multiple times with the same client
|
|
17
|
-
* returns the same store, keeping the single-fetch / fan-out invariant.
|
|
18
|
-
*/
|
|
15
|
+
* Return the per-client identity store, creating it on first access.
|
|
16
|
+
*
|
|
17
|
+
* The store is cached via a `WeakMap` so it is GC'd when the client is dropped,
|
|
18
|
+
* and creation is idempotent — calling this multiple times with the same client
|
|
19
|
+
* returns the same store, keeping the single-fetch / fan-out invariant.
|
|
20
|
+
*/
|
|
19
21
|
declare const getIdentityStore: (client: LunoraClient) => IdentityStore;
|
|
20
22
|
export { type IdentityStore, getIdentityStore };
|
package/dist/auth/index.mjs
CHANGED
|
@@ -1,60 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const createIdentityStore = (client) => {
|
|
3
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
4
|
-
let user = null;
|
|
5
|
-
let started = false;
|
|
6
|
-
const notify = () => {
|
|
7
|
-
for (const listener of listeners) {
|
|
8
|
-
listener();
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
let generation = 0;
|
|
12
|
-
const setUser = (next) => {
|
|
13
|
-
if (user !== next) {
|
|
14
|
-
user = next;
|
|
15
|
-
notify();
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
const refresh = () => {
|
|
19
|
-
generation += 1;
|
|
20
|
-
const current = generation;
|
|
21
|
-
if (client.getAuthToken() === null) {
|
|
22
|
-
setUser(null);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
client.getCurrentUser().then((next) => {
|
|
26
|
-
if (current === generation) {
|
|
27
|
-
setUser(next);
|
|
28
|
-
}
|
|
29
|
-
return void 0;
|
|
30
|
-
}).catch(() => {
|
|
31
|
-
if (current === generation) {
|
|
32
|
-
setUser(null);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
client.onAuthTokenChange(refresh);
|
|
37
|
-
return {
|
|
38
|
-
getUser: () => user,
|
|
39
|
-
subscribe: (onChange) => {
|
|
40
|
-
listeners.add(onChange);
|
|
41
|
-
if (!started) {
|
|
42
|
-
started = true;
|
|
43
|
-
refresh();
|
|
44
|
-
}
|
|
45
|
-
return () => {
|
|
46
|
-
listeners.delete(onChange);
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
const getIdentityStore = (client) => {
|
|
52
|
-
let store = stores.get(client);
|
|
53
|
-
if (!store) {
|
|
54
|
-
store = createIdentityStore(client);
|
|
55
|
-
stores.set(client, store);
|
|
56
|
-
}
|
|
57
|
-
return store;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export { getIdentityStore };
|
|
1
|
+
const f=new WeakMap,a=r=>{const t=new Set;let s=null,u=!1;const c=()=>{for(const e of t)e()};let n=0;const o=e=>{s!==e&&(s=e,c())},l=()=>{n+=1;const e=n;if(r.getAuthToken()===null){o(null);return}r.getCurrentUser().then(i=>{e===n&&o(i)}).catch(()=>{e===n&&o(null)})};return r.onAuthTokenChange(l),{getUser:()=>s,subscribe:e=>(t.add(e),u||(u=!0,l()),()=>{t.delete(e)})}},d=r=>{let t=f.get(r);return t||(t=a(r),f.set(r,t)),t};export{d as getIdentityStore};
|