@lunora/client 1.0.0-alpha.6 → 1.0.0-alpha.61

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 (88) hide show
  1. package/LICENSE.md +6 -0
  2. package/dist/auth/index.d.mts +11 -10
  3. package/dist/auth/index.d.ts +11 -10
  4. package/dist/auth/index.mjs +1 -60
  5. package/dist/index.d.mts +779 -230
  6. package/dist/index.d.ts +779 -230
  7. package/dist/index.mjs +1 -15
  8. package/dist/packem_shared/CONFLICT_ERROR_CODE-LjU7z0mB.mjs +1 -0
  9. package/dist/packem_shared/ClientServiceWorker-DXnBXeWK.mjs +1 -0
  10. package/dist/packem_shared/DEFAULT_MAX_BUFFER-D3QH2iaq.mjs +1 -0
  11. package/dist/packem_shared/LunoraClient-CMVwq6C2.mjs +1 -0
  12. package/dist/packem_shared/OfflineQueue-DG51qWl4.mjs +1 -0
  13. package/dist/packem_shared/RETIRE_AFTER_DURABLE_SEQ_ADVANCE-DoEHtuR8.mjs +1 -0
  14. package/dist/packem_shared/SKIP-d7LeP-sY.mjs +1 -0
  15. package/dist/packem_shared/SubscriptionRegistry-CdHSrDqu.mjs +1 -0
  16. package/dist/packem_shared/TabCoordinator-CXD7vulJ.mjs +1 -0
  17. package/dist/packem_shared/anyApi-CBOws2ZA.mjs +1 -0
  18. package/dist/packem_shared/applyDelta-DGqMpi3N.mjs +1 -0
  19. package/dist/packem_shared/createAsyncStoragePersistence-CNdM5o1u.mjs +1 -0
  20. package/dist/packem_shared/createAsyncStorageQueryCache-Di-S52wy.mjs +1 -0
  21. package/dist/packem_shared/createCallRunner-Bwcrfh76.mjs +1 -0
  22. package/dist/packem_shared/createClientQuery-TKD_52cT.mjs +1 -0
  23. package/dist/packem_shared/createInMemoryBookmarkStorage-BooZhW0n.mjs +1 -0
  24. package/dist/packem_shared/createInMemoryPersistence-C0qm7c47.mjs +1 -0
  25. package/dist/packem_shared/createInMemoryQueryCache-D2uNHLfM.mjs +1 -0
  26. package/dist/packem_shared/createLocalStore-CZwiN9F4.mjs +1 -0
  27. package/dist/packem_shared/createMutatorRunner-CuMRJpUx.mjs +1 -0
  28. package/dist/packem_shared/createReconnect-CjTmjJDH.mjs +1 -0
  29. package/dist/packem_shared/createReply-CwFABEJs.mjs +1 -0
  30. package/dist/packem_shared/createServerClient-D3TBy--H.mjs +1 -0
  31. package/dist/packem_shared/createSnapshotPrecondition-BPMQbAbk.mjs +1 -0
  32. package/dist/packem_shared/delta-merge-BoVuM-rE.mjs +1 -0
  33. package/dist/packem_shared/deserializePreloaded-CHfOFpka.mjs +1 -0
  34. package/dist/packem_shared/getServerSession-BaOoo1p6.mjs +1 -0
  35. package/dist/packem_shared/httpStream-x6q-x4yK.mjs +11 -0
  36. package/dist/packem_shared/idb-utility-C8WS390w.mjs +1 -0
  37. package/dist/packem_shared/local-store-tpI9VFpO.mjs +1 -0
  38. package/dist/packem_shared/lunora-client.d-CEJvJAXn.d.mts +2295 -0
  39. package/dist/packem_shared/lunora-client.d-CU6S8XiA.d.ts +2295 -0
  40. package/dist/packem_shared/offline-queue-CzI2lYQ8.mjs +1 -0
  41. package/dist/packem_shared/preload.d-7lAyp-Ky.d.mts +21 -0
  42. package/dist/packem_shared/preload.d-Gmmtaq2-.d.ts +21 -0
  43. package/dist/packem_shared/preloadQuery-uFy24PCR.mjs +1 -0
  44. package/dist/packem_shared/single-blob-store-DrhzObic.mjs +1 -0
  45. package/dist/packem_shared/types.d-BOB755CV.d.mts +1015 -0
  46. package/dist/packem_shared/types.d-BOB755CV.d.ts +1015 -0
  47. package/dist/packem_shared/wire-codec-D4iww4NV.mjs +1 -0
  48. package/dist/packem_shared/wire-key-BOdKmpG3.mjs +1 -0
  49. package/dist/pagination/index.d.mts +42 -42
  50. package/dist/pagination/index.d.ts +42 -42
  51. package/dist/pagination/index.mjs +1 -61
  52. package/dist/query/index.d.mts +110 -43
  53. package/dist/query/index.d.ts +110 -43
  54. package/dist/query/index.mjs +1 -1
  55. package/dist/service.d.mts +49 -0
  56. package/dist/service.d.ts +49 -0
  57. package/dist/service.mjs +1 -0
  58. package/dist/ssr/index.d.mts +100 -79
  59. package/dist/ssr/index.d.ts +100 -79
  60. package/dist/ssr/index.mjs +1 -4
  61. package/dist/upload.d.mts +35 -0
  62. package/dist/upload.d.ts +35 -0
  63. package/dist/upload.mjs +1 -0
  64. package/package.json +13 -1
  65. package/dist/packem_shared/CONFLICT_ERROR_CODE-aUdVbEDw.mjs +0 -4
  66. package/dist/packem_shared/DEFAULT_MAX_BUFFER-BDkqO5PW.mjs +0 -107
  67. package/dist/packem_shared/LunoraClient-DhwA_5Kj.mjs +0 -2502
  68. package/dist/packem_shared/OfflineQueue-D-ASeqL7.mjs +0 -131
  69. package/dist/packem_shared/SKIP-vItZChkw.mjs +0 -50
  70. package/dist/packem_shared/SubscriptionRegistry-Dn-7k7eo.mjs +0 -1
  71. package/dist/packem_shared/applyDelta-4jFGTPA3.mjs +0 -61
  72. package/dist/packem_shared/createAsyncStoragePersistence-1Z5BZ8RC.mjs +0 -45
  73. package/dist/packem_shared/createInMemoryBookmarkStorage-BoN7a7TH.mjs +0 -11
  74. package/dist/packem_shared/createInMemoryPersistence-CW82inU5.mjs +0 -105
  75. package/dist/packem_shared/createInMemoryQueryCache-B1PQ9Twl.mjs +0 -138
  76. package/dist/packem_shared/createLocalStore-DSUfoLqY.mjs +0 -36
  77. package/dist/packem_shared/createMutationRunner-BqsavzvG.mjs +0 -21
  78. package/dist/packem_shared/createMutatorRunner-BETvCd0p.mjs +0 -31
  79. package/dist/packem_shared/createReconnect-Di_-oHH7.mjs +0 -22
  80. package/dist/packem_shared/createServerClient-XahK8bPv.mjs +0 -11
  81. package/dist/packem_shared/deserializePreloaded-C0eJTY_W.mjs +0 -4
  82. package/dist/packem_shared/getServerSession-8jXewqxd.mjs +0 -13
  83. package/dist/packem_shared/lunora-client.d-DzEWBYeP.d.mts +0 -1948
  84. package/dist/packem_shared/lunora-client.d-DzEWBYeP.d.ts +0 -1948
  85. package/dist/packem_shared/preload.d-CmMMC-wm.d.ts +0 -20
  86. package/dist/packem_shared/preload.d-DuYqEQ5J.d.mts +0 -20
  87. package/dist/packem_shared/preloadQuery-lobFkD2Z.mjs +0 -13
  88. 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 -->
@@ -1,20 +1,21 @@
1
- import { U as User, L as LunoraClient } from "../packem_shared/lunora-client.d-DzEWBYeP.mjs";
1
+ import { L as LunoraClient } from "../packem_shared/lunora-client.d-CEJvJAXn.mjs";
2
+ import { U as User } from "../packem_shared/types.d-BOB755CV.mjs";
2
3
  import '@lunora/runtime';
3
4
  interface IdentityStore {
4
5
  /** Read the current resolved user, or `null` when signed out / not yet resolved. */
5
6
  getUser: () => User | null;
6
7
  /**
7
- * Subscribe to identity changes. `onChange` is called whenever the user or
8
- * token changes. Returns an unsubscribe handle.
9
- */
8
+ * Subscribe to identity changes. `onChange` is called whenever the user or
9
+ * token changes. Returns an unsubscribe handle.
10
+ */
10
11
  subscribe: (onChange: () => void) => () => void;
11
12
  }
12
13
  /**
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
- */
14
+ * Return the per-client identity store, creating it on first access.
15
+ *
16
+ * The store is cached via a `WeakMap` so it is GC'd when the client is dropped,
17
+ * and creation is idempotent — calling this multiple times with the same client
18
+ * returns the same store, keeping the single-fetch / fan-out invariant.
19
+ */
19
20
  declare const getIdentityStore: (client: LunoraClient) => IdentityStore;
20
21
  export { type IdentityStore, getIdentityStore };
@@ -1,20 +1,21 @@
1
- import { U as User, L as LunoraClient } from "../packem_shared/lunora-client.d-DzEWBYeP.js";
1
+ import { L as LunoraClient } from "../packem_shared/lunora-client.d-CU6S8XiA.js";
2
+ import { U as User } from "../packem_shared/types.d-BOB755CV.js";
2
3
  import '@lunora/runtime';
3
4
  interface IdentityStore {
4
5
  /** Read the current resolved user, or `null` when signed out / not yet resolved. */
5
6
  getUser: () => User | null;
6
7
  /**
7
- * Subscribe to identity changes. `onChange` is called whenever the user or
8
- * token changes. Returns an unsubscribe handle.
9
- */
8
+ * Subscribe to identity changes. `onChange` is called whenever the user or
9
+ * token changes. Returns an unsubscribe handle.
10
+ */
10
11
  subscribe: (onChange: () => void) => () => void;
11
12
  }
12
13
  /**
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
- */
14
+ * Return the per-client identity store, creating it on first access.
15
+ *
16
+ * The store is cached via a `WeakMap` so it is GC'd when the client is dropped,
17
+ * and creation is idempotent — calling this multiple times with the same client
18
+ * returns the same store, keeping the single-fetch / fan-out invariant.
19
+ */
19
20
  declare const getIdentityStore: (client: LunoraClient) => IdentityStore;
20
21
  export { type IdentityStore, getIdentityStore };
@@ -1,60 +1 @@
1
- const stores = /* @__PURE__ */ new WeakMap();
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};