@workglow/storage 0.2.5 → 0.2.6

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
@@ -2066,13 +2066,11 @@ function textRelevance(text, query) {
2066
2066
 
2067
2067
  class InMemoryVectorStorage extends InMemoryTabularStorage {
2068
2068
  vectorDimensions;
2069
- VectorType;
2070
2069
  vectorPropertyName;
2071
2070
  metadataPropertyName;
2072
- constructor(schema, primaryKeyNames, indexes = [], dimensions, VectorType = Float32Array) {
2071
+ constructor(schema, primaryKeyNames, indexes = [], dimensions, _vectorCtor = Float32Array) {
2073
2072
  super(schema, primaryKeyNames, indexes);
2074
2073
  this.vectorDimensions = dimensions;
2075
- this.VectorType = VectorType;
2076
2074
  const vectorProp = getVectorProperty(schema);
2077
2075
  if (!vectorProp) {
2078
2076
  throw new Error("Schema must have a property with type array and format TypedArray");
@@ -2298,24 +2296,6 @@ async function saveSchemaMetadata(db, tableName, snapshot) {
2298
2296
  }
2299
2297
  });
2300
2298
  }
2301
- async function loadSchemaMetadata(db, tableName) {
2302
- return new Promise((resolve) => {
2303
- try {
2304
- if (!db.objectStoreNames.contains(METADATA_STORE_NAME)) {
2305
- resolve(null);
2306
- return;
2307
- }
2308
- const transaction = db.transaction(METADATA_STORE_NAME, "readonly");
2309
- const store = transaction.objectStore(METADATA_STORE_NAME);
2310
- const request = store.get(tableName);
2311
- request.onsuccess = () => resolve(request.result || null);
2312
- request.onerror = () => resolve(null);
2313
- transaction.onerror = () => resolve(null);
2314
- } catch (err) {
2315
- resolve(null);
2316
- }
2317
- });
2318
- }
2319
2299
  async function openIndexedDbTable(tableName, version, upgradeNeededCallback) {
2320
2300
  return new Promise((resolve, reject) => {
2321
2301
  const openRequest = indexedDB.open(tableName, version);
@@ -2407,7 +2387,6 @@ async function performIncrementalMigration(db, tableName, diff, options = {}) {
2407
2387
  db.close();
2408
2388
  options.onMigrationProgress?.(`Migrating ${tableName} from version ${currentVersion} to ${newVersion}...`, 0);
2409
2389
  return openIndexedDbTable(tableName, newVersion, (event) => {
2410
- const db2 = event.target.result;
2411
2390
  const transaction = event.target.transaction;
2412
2391
  const store = transaction.objectStore(tableName);
2413
2392
  for (const indexName of diff.indexesToRemove) {
@@ -2469,7 +2448,6 @@ async function performDestructiveMigration(db, tableName, primaryKey, expectedIn
2469
2448
  options.onMigrationProgress?.(`Recreating object store...`, 0.75);
2470
2449
  const newDb = await openIndexedDbTable(tableName, newVersion, (event) => {
2471
2450
  const db2 = event.target.result;
2472
- const transaction = event.target.transaction;
2473
2451
  if (db2.objectStoreNames.contains(tableName)) {
2474
2452
  db2.deleteObjectStore(tableName);
2475
2453
  }
@@ -2570,7 +2548,6 @@ async function ensureIndexedDbTable(tableName, primaryKey, expectedIndexes = [],
2570
2548
  }
2571
2549
  });
2572
2550
  }
2573
- const metadata = await loadSchemaMetadata(db, tableName);
2574
2551
  if (!db.objectStoreNames.contains(tableName)) {
2575
2552
  options.onMigrationProgress?.(`Object store ${tableName} does not exist, creating...`, 0);
2576
2553
  db.close();
@@ -5405,8 +5382,8 @@ class SupabaseRateLimiterStorage {
5405
5382
  }
5406
5383
  }
5407
5384
  // src/vector/IndexedDbVectorStorage.ts
5408
- import { cosineSimilarity as cosineSimilarity2 } from "@workglow/util/schema";
5409
5385
  import { createServiceToken as createServiceToken21 } from "@workglow/util";
5386
+ import { cosineSimilarity as cosineSimilarity2 } from "@workglow/util/schema";
5410
5387
  var IDB_VECTOR_REPOSITORY = createServiceToken21("storage.vectorRepository.indexedDb");
5411
5388
  function matchesFilter2(metadata, filter) {
5412
5389
  for (const [key, value] of Object.entries(filter)) {
@@ -5434,13 +5411,11 @@ function textRelevance2(text, query) {
5434
5411
 
5435
5412
  class IndexedDbVectorStorage extends IndexedDbTabularStorage {
5436
5413
  vectorDimensions;
5437
- VectorType;
5438
5414
  vectorPropertyName;
5439
5415
  metadataPropertyName;
5440
- constructor(table = "vectors", schema, primaryKeyNames, indexes = [], dimensions, VectorType = Float32Array, migrationOptions = {}, clientProvidedKeys = "if-missing") {
5416
+ constructor(table = "vectors", schema, primaryKeyNames, indexes = [], dimensions, _vectorCtor = Float32Array, migrationOptions = {}, clientProvidedKeys = "if-missing") {
5441
5417
  super(table, schema, primaryKeyNames, indexes, migrationOptions, clientProvidedKeys);
5442
5418
  this.vectorDimensions = dimensions;
5443
- this.VectorType = VectorType;
5444
5419
  const vectorProp = getVectorProperty(schema);
5445
5420
  if (!vectorProp) {
5446
5421
  throw new Error("Schema must have a property with type array and format TypedArray");
@@ -5574,4 +5549,4 @@ export {
5574
5549
  BaseTabularStorage
5575
5550
  };
5576
5551
 
5577
- //# debugId=5DBA415CCD0F79AA64756E2164756E21
5552
+ //# debugId=EAA8208BC9EF6C8264756E2164756E21