@lunora/client 1.0.0-alpha.12 → 1.0.0-alpha.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -311,7 +311,7 @@ declare class OfflineQueue {
311
311
  */
312
312
  declare const createInMemoryPersistence: () => PersistenceAdapter;
313
313
  interface IndexedDbPersistenceOptions {
314
- /** Database name; defaults to `"lunora"`. */
314
+ /** Database name; defaults to `"lunora-outbox"` (its own DB, separate from the read cache). */
315
315
  databaseName?: string;
316
316
  /** Injectable `IDBFactory` (e.g. `fake-indexeddb` in tests); defaults to the global `indexedDB`. */
317
317
  indexedDB?: IDBFactory;
@@ -364,7 +364,7 @@ declare const createInMemoryQueryCache: (options?: {
364
364
  maxEntries?: number;
365
365
  }) => QueryCacheAdapter;
366
366
  interface IndexedDbQueryCacheOptions {
367
- /** Database name; defaults to `"lunora"` (shared with the offline-mutation store). */
367
+ /** Database name; defaults to `"lunora-query-cache"` (its own DB, separate from the offline outbox). */
368
368
  databaseName?: string;
369
369
  /** Injectable `IDBFactory` (e.g. `fake-indexeddb` in tests); defaults to the global `indexedDB`. */
370
370
  indexedDB?: IDBFactory;
@@ -379,11 +379,11 @@ interface IndexedDbQueryCacheOptions {
379
379
  * LRU eviction. The store handle is opened lazily and cached, so repeated ops
380
380
  * reuse one connection.
381
381
  *
382
- * The store lives in the same `lunora` database as the offline-mutation queue
383
- * (bumped to schema v2). Opening it upgrades a v1 database in place, adding the
384
- * `query-cache` store without touching `offline-mutations`. Throws eagerly if no
385
- * `IDBFactory` is available — callers in non-browser environments should use
386
- * {@link createInMemoryQueryCache}.
382
+ * The store lives in its own `lunora-query-cache` database deliberately
383
+ * separate from the offline-mutation outbox's `lunora-outbox` database so the two
384
+ * independently-toggleable adapters never share (and drift on) a schema version.
385
+ * Throws eagerly if no `IDBFactory` is available — callers in non-browser
386
+ * environments should use {@link createInMemoryQueryCache}.
387
387
  */
388
388
  declare const createIndexedDbQueryCache: (options?: IndexedDbQueryCacheOptions) => QueryCacheAdapter;
389
389
  /**
package/dist/index.d.ts CHANGED
@@ -311,7 +311,7 @@ declare class OfflineQueue {
311
311
  */
312
312
  declare const createInMemoryPersistence: () => PersistenceAdapter;
313
313
  interface IndexedDbPersistenceOptions {
314
- /** Database name; defaults to `"lunora"`. */
314
+ /** Database name; defaults to `"lunora-outbox"` (its own DB, separate from the read cache). */
315
315
  databaseName?: string;
316
316
  /** Injectable `IDBFactory` (e.g. `fake-indexeddb` in tests); defaults to the global `indexedDB`. */
317
317
  indexedDB?: IDBFactory;
@@ -364,7 +364,7 @@ declare const createInMemoryQueryCache: (options?: {
364
364
  maxEntries?: number;
365
365
  }) => QueryCacheAdapter;
366
366
  interface IndexedDbQueryCacheOptions {
367
- /** Database name; defaults to `"lunora"` (shared with the offline-mutation store). */
367
+ /** Database name; defaults to `"lunora-query-cache"` (its own DB, separate from the offline outbox). */
368
368
  databaseName?: string;
369
369
  /** Injectable `IDBFactory` (e.g. `fake-indexeddb` in tests); defaults to the global `indexedDB`. */
370
370
  indexedDB?: IDBFactory;
@@ -379,11 +379,11 @@ interface IndexedDbQueryCacheOptions {
379
379
  * LRU eviction. The store handle is opened lazily and cached, so repeated ops
380
380
  * reuse one connection.
381
381
  *
382
- * The store lives in the same `lunora` database as the offline-mutation queue
383
- * (bumped to schema v2). Opening it upgrades a v1 database in place, adding the
384
- * `query-cache` store without touching `offline-mutations`. Throws eagerly if no
385
- * `IDBFactory` is available — callers in non-browser environments should use
386
- * {@link createInMemoryQueryCache}.
382
+ * The store lives in its own `lunora-query-cache` database deliberately
383
+ * separate from the offline-mutation outbox's `lunora-outbox` database so the two
384
+ * independently-toggleable adapters never share (and drift on) a schema version.
385
+ * Throws eagerly if no `IDBFactory` is available — callers in non-browser
386
+ * environments should use {@link createInMemoryQueryCache}.
387
387
  */
388
388
  declare const createIndexedDbQueryCache: (options?: IndexedDbQueryCacheOptions) => QueryCacheAdapter;
389
389
  /**
package/dist/index.mjs CHANGED
@@ -3,13 +3,13 @@ export { default as createInMemoryBookmarkStorage } from './packem_shared/create
3
3
  export { applyDelta, isMutationDelta } from './packem_shared/applyDelta-4jFGTPA3.mjs';
4
4
  export { CONFLICT_ERROR_CODE, isConflictError } from './packem_shared/CONFLICT_ERROR_CODE-aUdVbEDw.mjs';
5
5
  export { c as createLocalStore } from './packem_shared/local-store-BNgN3Dw3.mjs';
6
- export { LunoraClient } from './packem_shared/LunoraClient-wh6w9Ivn.mjs';
6
+ export { LunoraClient } from './packem_shared/LunoraClient-DEEhIPi_.mjs';
7
7
  export { createMutationRunner } from './packem_shared/createMutationRunner-BqsavzvG.mjs';
8
8
  export { createMutatorRunner } from './packem_shared/createMutatorRunner-BETvCd0p.mjs';
9
- export { O as OfflineQueue } from './packem_shared/offline-queue-7Wc4onA0.mjs';
10
- export { createInMemoryPersistence, createIndexedDbPersistence } from './packem_shared/createInMemoryPersistence-DlFjWtOm.mjs';
9
+ export { O as OfflineQueue } from './packem_shared/offline-queue-B9vfdSqp.mjs';
10
+ export { createInMemoryPersistence, createIndexedDbPersistence } from './packem_shared/createInMemoryPersistence-CY6F0ZvQ.mjs';
11
11
  export { preloadQuery, preloadedQueryResult } from './packem_shared/preloadQuery-lobFkD2Z.mjs';
12
- export { createInMemoryQueryCache, createIndexedDbQueryCache, queryCacheKey } from './packem_shared/createInMemoryQueryCache-4AkTV38-.mjs';
12
+ export { createInMemoryQueryCache, createIndexedDbQueryCache, queryCacheKey } from './packem_shared/createInMemoryQueryCache-Bv4Ruv6n.mjs';
13
13
  export { createReconnect } from './packem_shared/createReconnect-Di_-oHH7.mjs';
14
14
  export { DEFAULT_MAX_BUFFER, createStream } from './packem_shared/DEFAULT_MAX_BUFFER-BDkqO5PW.mjs';
15
15
  export { S as SubscriptionRegistry } from './packem_shared/subscription-DoyO04-2.mjs';
@@ -2,9 +2,9 @@ import { S as SubscriptionRegistry, s as stableStringify } from './subscription-
2
2
  import createInMemoryBookmarkStorage from './createInMemoryBookmarkStorage-BoN7a7TH.mjs';
3
3
  import { isMutationDelta, applyDelta } from './applyDelta-4jFGTPA3.mjs';
4
4
  import { a as applyOptimisticLayer, d as dropConfirmedLayers, n as notifySubscription, f as foldOptimistic, c as createLocalStore } from './local-store-BNgN3Dw3.mjs';
5
- import { O as OfflineQueue, n as nextId, i as isStaleVersion, r as reportPersistenceError } from './offline-queue-7Wc4onA0.mjs';
6
- import { resolvePersistenceAdapter } from './createInMemoryPersistence-DlFjWtOm.mjs';
7
- import { resolveQueryCacheAdapter, queryCacheKey } from './createInMemoryQueryCache-4AkTV38-.mjs';
5
+ import { O as OfflineQueue, n as nextId, i as isStaleVersion, r as reportPersistenceError } from './offline-queue-B9vfdSqp.mjs';
6
+ import { resolvePersistenceAdapter } from './createInMemoryPersistence-CY6F0ZvQ.mjs';
7
+ import { resolveQueryCacheAdapter, queryCacheKey } from './createInMemoryQueryCache-Bv4Ruv6n.mjs';
8
8
  import { createReconnect } from './createReconnect-Di_-oHH7.mjs';
9
9
  import { createStream } from './DEFAULT_MAX_BUFFER-BDkqO5PW.mjs';
10
10
 
@@ -2929,12 +2929,15 @@ class LunoraClient {
2929
2929
  if (token === null) {
2930
2930
  return null;
2931
2931
  }
2932
- let hash = 2166136261;
2932
+ let fnv = 2166136261;
2933
+ let djb2 = 5381;
2933
2934
  for (let index = 0; index < token.length; index += 1) {
2934
- hash ^= token.charCodeAt(index);
2935
- hash = Math.imul(hash, 16777619);
2935
+ const code = token.charCodeAt(index);
2936
+ fnv ^= code;
2937
+ fnv = Math.imul(fnv, 16777619);
2938
+ djb2 = Math.imul(djb2, 33) + code;
2936
2939
  }
2937
- return `${token.length.toString(36)}:${(hash >>> 0).toString(36)}`;
2940
+ return `${token.length.toString(36)}:${(fnv >>> 0).toString(36)}:${(djb2 >>> 0).toString(36)}`;
2938
2941
  }
2939
2942
  /**
2940
2943
  * Drain every in-memory offline write and reject it because the auth
@@ -1 +1 @@
1
- export { O as OfflineQueue, n as nextId, r as reportPersistenceError } from './offline-queue-7Wc4onA0.mjs';
1
+ export { O as OfflineQueue, n as nextId, r as reportPersistenceError } from './offline-queue-B9vfdSqp.mjs';
@@ -25,7 +25,7 @@ const createInMemoryPersistence = () => {
25
25
  }
26
26
  };
27
27
  };
28
- const DEFAULT_DATABASE = "lunora";
28
+ const DEFAULT_DATABASE = "lunora-outbox";
29
29
  const DEFAULT_STORE = "offline-mutations";
30
30
  const ID_INDEX = "by_id";
31
31
  const promisifyRequest = (request) => new Promise((resolve, reject) => {
@@ -35,10 +35,10 @@ const createInMemoryQueryCache = (options = {}) => {
35
35
  }
36
36
  };
37
37
  };
38
- const DEFAULT_DATABASE = "lunora";
38
+ const DEFAULT_DATABASE = "lunora-query-cache";
39
39
  const DEFAULT_STORE = "query-cache";
40
40
  const TS_INDEX = "by_ts";
41
- const DATABASE_VERSION = 2;
41
+ const DATABASE_VERSION = 1;
42
42
  const promisifyRequest = (request) => new Promise((resolve, reject) => {
43
43
  request.addEventListener("success", () => {
44
44
  resolve(request.result);
@@ -1,4 +1,4 @@
1
- import { LunoraClient } from './LunoraClient-wh6w9Ivn.mjs';
1
+ import { LunoraClient } from './LunoraClient-DEEhIPi_.mjs';
2
2
 
3
3
  const createServerClient = (options) => {
4
4
  const client = new LunoraClient({ fetch: options.fetch, url: options.url });
@@ -84,7 +84,13 @@ class OfflineQueue {
84
84
  if (!this.persistence) {
85
85
  return [];
86
86
  }
87
- const persisted = await this.persistence.load();
87
+ let persisted;
88
+ try {
89
+ persisted = await this.persistence.load();
90
+ } catch (error) {
91
+ reportPersistenceError(this.onPersistenceError, "load", error);
92
+ throw error;
93
+ }
88
94
  const shardKeys = /* @__PURE__ */ new Set();
89
95
  for (const mutation of persisted) {
90
96
  if (this.items.some((item) => item.id === mutation.id)) {
@@ -1,4 +1,4 @@
1
1
  export { getServerSession } from '../packem_shared/getServerSession-8jXewqxd.mjs';
2
2
  export { deserializePreloaded, serializePreloaded } from '../packem_shared/deserializePreloaded-C0eJTY_W.mjs';
3
- export { createServerClient } from '../packem_shared/createServerClient-C5GMCGSQ.mjs';
3
+ export { createServerClient } from '../packem_shared/createServerClient-DgJaS1_M.mjs';
4
4
  export { preloadQuery, preloadedQueryResult } from '../packem_shared/preloadQuery-lobFkD2Z.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/client",
3
- "version": "1.0.0-alpha.12",
3
+ "version": "1.0.0-alpha.14",
4
4
  "description": "Lunora browser SDK: WebSocket transport, optimistic updates, and an offline mutation queue",
5
5
  "keywords": [
6
6
  "cloudflare",