@workglow/storage 0.2.19 → 0.2.21

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/browser.js CHANGED
@@ -2278,9 +2278,10 @@ class LazyEncryptedCredentialStore {
2278
2278
  }
2279
2279
  }
2280
2280
  // src/tabular/IndexedDbTabularStorage.ts
2281
- import { createServiceToken as createServiceToken12, makeFingerprint as makeFingerprint5, uuid4 as uuid43 } from "@workglow/util";
2281
+ import { createServiceToken as createServiceToken12, deepEqual as deepEqual2, makeFingerprint as makeFingerprint5, uuid4 as uuid43 } from "@workglow/util";
2282
2282
 
2283
2283
  // src/util/IndexedDbTable.ts
2284
+ import { deepEqual } from "@workglow/util";
2284
2285
  var METADATA_STORE_NAME = "__schema_metadata__";
2285
2286
  async function saveSchemaMetadata(db, tableName, snapshot) {
2286
2287
  return new Promise((resolve, reject) => {
@@ -2345,7 +2346,7 @@ function compareSchemas(store, expectedPrimaryKey, expectedIndexes) {
2345
2346
  const actualKeyPath = store.keyPath;
2346
2347
  const normalizedExpected = Array.isArray(expectedPrimaryKey) ? expectedPrimaryKey : expectedPrimaryKey;
2347
2348
  const normalizedActual = Array.isArray(actualKeyPath) ? actualKeyPath : actualKeyPath;
2348
- if (JSON.stringify(normalizedExpected) !== JSON.stringify(normalizedActual)) {
2349
+ if (!deepEqual(normalizedExpected, normalizedActual)) {
2349
2350
  diff.primaryKeyChanged = true;
2350
2351
  diff.needsObjectStoreRecreation = true;
2351
2352
  return diff;
@@ -2362,7 +2363,7 @@ function compareSchemas(store, expectedPrimaryKey, expectedIndexes) {
2362
2363
  } else {
2363
2364
  const expectedKeyPath = Array.isArray(expectedIdx.keyPath) ? expectedIdx.keyPath : [expectedIdx.keyPath];
2364
2365
  const actualKeyPath2 = Array.isArray(existingIdx.keyPath) ? existingIdx.keyPath : [existingIdx.keyPath];
2365
- const keyPathChanged = JSON.stringify(expectedKeyPath) !== JSON.stringify(actualKeyPath2);
2366
+ const keyPathChanged = !deepEqual(expectedKeyPath, actualKeyPath2);
2366
2367
  const uniqueChanged = existingIdx.unique !== (expectedIdx.options?.unique ?? false);
2367
2368
  const multiEntryChanged = existingIdx.multiEntry !== (expectedIdx.options?.multiEntry ?? false);
2368
2369
  if (keyPathChanged || uniqueChanged || multiEntryChanged) {
@@ -2598,6 +2599,14 @@ async function dropIndexedDbTable(tableName) {
2598
2599
 
2599
2600
  // src/tabular/IndexedDbTabularStorage.ts
2600
2601
  var IDB_TABULAR_REPOSITORY = createServiceToken12("storage.tabularRepository.indexedDb");
2602
+ function compareEntitiesForChange(a, b) {
2603
+ const au = a?.updated_at;
2604
+ const bu = b?.updated_at;
2605
+ if (typeof au === "string" && typeof bu === "string") {
2606
+ return au === bu;
2607
+ }
2608
+ return deepEqual2(a, b);
2609
+ }
2601
2610
 
2602
2611
  class IndexedDbTabularStorage extends BaseTabularStorage {
2603
2612
  table;
@@ -3008,7 +3017,7 @@ class IndexedDbTabularStorage extends BaseTabularStorage {
3008
3017
  map.set(fingerprint, entity);
3009
3018
  }
3010
3019
  return map;
3011
- }, (a, b) => JSON.stringify(a) === JSON.stringify(b), {
3020
+ }, compareEntitiesForChange, {
3012
3021
  insert: (item) => ({ type: "INSERT", new: item }),
3013
3022
  update: (oldItem, newItem) => ({ type: "UPDATE", old: oldItem, new: newItem }),
3014
3023
  delete: (item) => ({ type: "DELETE", old: item })
@@ -3944,7 +3953,7 @@ class SupabaseKvStorage extends KvViaTabularStorage {
3944
3953
  }
3945
3954
  }
3946
3955
  // src/queue/IndexedDbQueueStorage.ts
3947
- import { createServiceToken as createServiceToken17, makeFingerprint as makeFingerprint6, uuid4 as uuid44 } from "@workglow/util";
3956
+ import { createServiceToken as createServiceToken17, deepEqual as deepEqual3, makeFingerprint as makeFingerprint6, uuid4 as uuid44 } from "@workglow/util";
3948
3957
  var INDEXED_DB_QUEUE_STORAGE = createServiceToken17("jobqueue.storage.indexedDb");
3949
3958
 
3950
3959
  class IndexedDbQueueStorage {
@@ -4451,7 +4460,7 @@ class IndexedDbQueueStorage {
4451
4460
  this.hybridManager = new HybridSubscriptionManager(channelName, async () => {
4452
4461
  const jobs = await this.getAllJobs();
4453
4462
  return new Map(jobs.map((j) => [j.id, j]));
4454
- }, (a, b) => JSON.stringify(a) === JSON.stringify(b), {
4463
+ }, (a, b) => deepEqual3(a, b), {
4455
4464
  insert: (item) => ({ type: "INSERT", new: item }),
4456
4465
  update: (oldItem, newItem) => ({ type: "UPDATE", old: oldItem, new: newItem }),
4457
4466
  delete: (item) => ({ type: "DELETE", old: item })
@@ -4478,7 +4487,7 @@ class IndexedDbQueueStorage {
4478
4487
  const old = lastKnownJobs.get(id);
4479
4488
  if (!old) {
4480
4489
  callback({ type: "INSERT", new: job });
4481
- } else if (JSON.stringify(old) !== JSON.stringify(job)) {
4490
+ } else if (!deepEqual3(old, job)) {
4482
4491
  callback({ type: "UPDATE", old, new: job });
4483
4492
  }
4484
4493
  }
@@ -4513,7 +4522,7 @@ class IndexedDbQueueStorage {
4513
4522
  }
4514
4523
  }
4515
4524
  // src/queue/SupabaseQueueStorage.ts
4516
- import { createServiceToken as createServiceToken18, makeFingerprint as makeFingerprint7, uuid4 as uuid45 } from "@workglow/util";
4525
+ import { createServiceToken as createServiceToken18, deepEqual as deepEqual4, makeFingerprint as makeFingerprint7, uuid4 as uuid45 } from "@workglow/util";
4517
4526
  var SUPABASE_QUEUE_STORAGE = createServiceToken18("jobqueue.storage.supabase");
4518
4527
 
4519
4528
  class SupabaseQueueStorage {
@@ -4975,7 +4984,7 @@ class SupabaseQueueStorage {
4975
4984
  this.pollingManager = new PollingSubscriptionManager(async () => {
4976
4985
  const jobs = await this.getAllJobs();
4977
4986
  return new Map(jobs.map((j) => [j.id, j]));
4978
- }, (a, b) => JSON.stringify(a) === JSON.stringify(b), {
4987
+ }, (a, b) => deepEqual4(a, b), {
4979
4988
  insert: (item) => ({ type: "INSERT", new: item }),
4980
4989
  update: (oldItem, newItem) => ({ type: "UPDATE", old: oldItem, new: newItem }),
4981
4990
  delete: (item) => ({ type: "DELETE", old: item })
@@ -4998,7 +5007,7 @@ class SupabaseQueueStorage {
4998
5007
  const old = lastKnownJobs.get(id);
4999
5008
  if (!old) {
5000
5009
  callback({ type: "INSERT", new: job });
5001
- } else if (JSON.stringify(old) !== JSON.stringify(job)) {
5010
+ } else if (!deepEqual4(old, job)) {
5002
5011
  callback({ type: "UPDATE", old, new: job });
5003
5012
  }
5004
5013
  }
@@ -5568,4 +5577,4 @@ export {
5568
5577
  BaseTabularStorage
5569
5578
  };
5570
5579
 
5571
- //# debugId=67550E2145370E0164756E2164756E21
5580
+ //# debugId=BBB7B06FA3B7568C64756E2164756E21