@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/node.js CHANGED
@@ -2281,7 +2281,14 @@ class LazyEncryptedCredentialStore {
2281
2281
  }
2282
2282
  }
2283
2283
  // src/tabular/FsFolderTabularStorage.ts
2284
- import { createServiceToken as createServiceToken12, getLogger as getLogger3, makeFingerprint as makeFingerprint5, sleep as sleep3, uuid4 as uuid43 } from "@workglow/util";
2284
+ import {
2285
+ createServiceToken as createServiceToken12,
2286
+ deepEqual,
2287
+ getLogger as getLogger3,
2288
+ makeFingerprint as makeFingerprint5,
2289
+ sleep as sleep3,
2290
+ uuid4 as uuid43
2291
+ } from "@workglow/util";
2285
2292
  import { mkdir, readdir, readFile, rm, writeFile } from "node:fs/promises";
2286
2293
  import path from "node:path";
2287
2294
  var FS_FOLDER_TABULAR_REPOSITORY = createServiceToken12("storage.tabularRepository.fsFolder");
@@ -2476,7 +2483,7 @@ class FsFolderTabularStorage extends BaseTabularStorage {
2476
2483
  map.set(fingerprint, entity);
2477
2484
  }
2478
2485
  return map;
2479
- }, (a, b) => JSON.stringify(a) === JSON.stringify(b), {
2486
+ }, (a, b) => deepEqual(a, b), {
2480
2487
  insert: (item) => ({ type: "INSERT", new: item }),
2481
2488
  update: (oldItem, newItem) => ({ type: "UPDATE", old: oldItem, new: newItem }),
2482
2489
  delete: (item) => ({ type: "DELETE", old: item })
@@ -4980,7 +4987,7 @@ class SqliteQueueStorage {
4980
4987
  }
4981
4988
  }
4982
4989
  // src/queue/SupabaseQueueStorage.ts
4983
- import { createServiceToken as createServiceToken23, makeFingerprint as makeFingerprint8, uuid4 as uuid47 } from "@workglow/util";
4990
+ import { createServiceToken as createServiceToken23, deepEqual as deepEqual2, makeFingerprint as makeFingerprint8, uuid4 as uuid47 } from "@workglow/util";
4984
4991
  var SUPABASE_QUEUE_STORAGE = createServiceToken23("jobqueue.storage.supabase");
4985
4992
 
4986
4993
  class SupabaseQueueStorage {
@@ -5442,7 +5449,7 @@ class SupabaseQueueStorage {
5442
5449
  this.pollingManager = new PollingSubscriptionManager(async () => {
5443
5450
  const jobs = await this.getAllJobs();
5444
5451
  return new Map(jobs.map((j) => [j.id, j]));
5445
- }, (a, b) => JSON.stringify(a) === JSON.stringify(b), {
5452
+ }, (a, b) => deepEqual2(a, b), {
5446
5453
  insert: (item) => ({ type: "INSERT", new: item }),
5447
5454
  update: (oldItem, newItem) => ({ type: "UPDATE", old: oldItem, new: newItem }),
5448
5455
  delete: (item) => ({ type: "DELETE", old: item })
@@ -5465,7 +5472,7 @@ class SupabaseQueueStorage {
5465
5472
  const old = lastKnownJobs.get(id);
5466
5473
  if (!old) {
5467
5474
  callback({ type: "INSERT", new: job });
5468
- } else if (JSON.stringify(old) !== JSON.stringify(job)) {
5475
+ } else if (!deepEqual2(old, job)) {
5469
5476
  callback({ type: "UPDATE", old, new: job });
5470
5477
  }
5471
5478
  }
@@ -6622,9 +6629,10 @@ class SqliteAiVectorStorage extends SqliteTabularStorage {
6622
6629
  import { createServiceToken as createServiceToken28 } from "@workglow/util";
6623
6630
 
6624
6631
  // src/tabular/IndexedDbTabularStorage.ts
6625
- import { createServiceToken as createServiceToken27, makeFingerprint as makeFingerprint9, uuid4 as uuid48 } from "@workglow/util";
6632
+ import { createServiceToken as createServiceToken27, deepEqual as deepEqual4, makeFingerprint as makeFingerprint9, uuid4 as uuid48 } from "@workglow/util";
6626
6633
 
6627
6634
  // src/util/IndexedDbTable.ts
6635
+ import { deepEqual as deepEqual3 } from "@workglow/util";
6628
6636
  var METADATA_STORE_NAME = "__schema_metadata__";
6629
6637
  async function saveSchemaMetadata(db, tableName, snapshot) {
6630
6638
  return new Promise((resolve, reject) => {
@@ -6689,7 +6697,7 @@ function compareSchemas(store, expectedPrimaryKey, expectedIndexes) {
6689
6697
  const actualKeyPath = store.keyPath;
6690
6698
  const normalizedExpected = Array.isArray(expectedPrimaryKey) ? expectedPrimaryKey : expectedPrimaryKey;
6691
6699
  const normalizedActual = Array.isArray(actualKeyPath) ? actualKeyPath : actualKeyPath;
6692
- if (JSON.stringify(normalizedExpected) !== JSON.stringify(normalizedActual)) {
6700
+ if (!deepEqual3(normalizedExpected, normalizedActual)) {
6693
6701
  diff.primaryKeyChanged = true;
6694
6702
  diff.needsObjectStoreRecreation = true;
6695
6703
  return diff;
@@ -6706,7 +6714,7 @@ function compareSchemas(store, expectedPrimaryKey, expectedIndexes) {
6706
6714
  } else {
6707
6715
  const expectedKeyPath = Array.isArray(expectedIdx.keyPath) ? expectedIdx.keyPath : [expectedIdx.keyPath];
6708
6716
  const actualKeyPath2 = Array.isArray(existingIdx.keyPath) ? existingIdx.keyPath : [existingIdx.keyPath];
6709
- const keyPathChanged = JSON.stringify(expectedKeyPath) !== JSON.stringify(actualKeyPath2);
6717
+ const keyPathChanged = !deepEqual3(expectedKeyPath, actualKeyPath2);
6710
6718
  const uniqueChanged = existingIdx.unique !== (expectedIdx.options?.unique ?? false);
6711
6719
  const multiEntryChanged = existingIdx.multiEntry !== (expectedIdx.options?.multiEntry ?? false);
6712
6720
  if (keyPathChanged || uniqueChanged || multiEntryChanged) {
@@ -6942,6 +6950,14 @@ async function dropIndexedDbTable(tableName) {
6942
6950
 
6943
6951
  // src/tabular/IndexedDbTabularStorage.ts
6944
6952
  var IDB_TABULAR_REPOSITORY = createServiceToken27("storage.tabularRepository.indexedDb");
6953
+ function compareEntitiesForChange(a, b) {
6954
+ const au = a?.updated_at;
6955
+ const bu = b?.updated_at;
6956
+ if (typeof au === "string" && typeof bu === "string") {
6957
+ return au === bu;
6958
+ }
6959
+ return deepEqual4(a, b);
6960
+ }
6945
6961
 
6946
6962
  class IndexedDbTabularStorage extends BaseTabularStorage {
6947
6963
  table;
@@ -7352,7 +7368,7 @@ class IndexedDbTabularStorage extends BaseTabularStorage {
7352
7368
  map.set(fingerprint, entity);
7353
7369
  }
7354
7370
  return map;
7355
- }, (a, b) => JSON.stringify(a) === JSON.stringify(b), {
7371
+ }, compareEntitiesForChange, {
7356
7372
  insert: (item) => ({ type: "INSERT", new: item }),
7357
7373
  update: (oldItem, newItem) => ({ type: "UPDATE", old: oldItem, new: newItem }),
7358
7374
  delete: (item) => ({ type: "DELETE", old: item })
@@ -7612,7 +7628,7 @@ class IndexedDbRateLimiterStorage {
7612
7628
  }
7613
7629
  }
7614
7630
  // src/queue/IndexedDbQueueStorage.ts
7615
- import { createServiceToken as createServiceToken30, makeFingerprint as makeFingerprint10, uuid4 as uuid49 } from "@workglow/util";
7631
+ import { createServiceToken as createServiceToken30, deepEqual as deepEqual5, makeFingerprint as makeFingerprint10, uuid4 as uuid49 } from "@workglow/util";
7616
7632
  var INDEXED_DB_QUEUE_STORAGE = createServiceToken30("jobqueue.storage.indexedDb");
7617
7633
 
7618
7634
  class IndexedDbQueueStorage {
@@ -8119,7 +8135,7 @@ class IndexedDbQueueStorage {
8119
8135
  this.hybridManager = new HybridSubscriptionManager(channelName, async () => {
8120
8136
  const jobs = await this.getAllJobs();
8121
8137
  return new Map(jobs.map((j) => [j.id, j]));
8122
- }, (a, b) => JSON.stringify(a) === JSON.stringify(b), {
8138
+ }, (a, b) => deepEqual5(a, b), {
8123
8139
  insert: (item) => ({ type: "INSERT", new: item }),
8124
8140
  update: (oldItem, newItem) => ({ type: "UPDATE", old: oldItem, new: newItem }),
8125
8141
  delete: (item) => ({ type: "DELETE", old: item })
@@ -8146,7 +8162,7 @@ class IndexedDbQueueStorage {
8146
8162
  const old = lastKnownJobs.get(id);
8147
8163
  if (!old) {
8148
8164
  callback({ type: "INSERT", new: job });
8149
- } else if (JSON.stringify(old) !== JSON.stringify(job)) {
8165
+ } else if (!deepEqual5(old, job)) {
8150
8166
  callback({ type: "UPDATE", old, new: job });
8151
8167
  }
8152
8168
  }
@@ -8371,4 +8387,4 @@ export {
8371
8387
  BaseTabularStorage
8372
8388
  };
8373
8389
 
8374
- //# debugId=68DCAFB0CAFAB85B64756E2164756E21
8390
+ //# debugId=DE2802AC74ABE49264756E2164756E21