@workglow/postgres 0.2.36 → 0.2.37
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/job-queue/PostgresJobStore.d.ts +29 -0
- package/dist/job-queue/PostgresJobStore.d.ts.map +1 -0
- package/dist/job-queue/PostgresMessageQueue.d.ts +38 -0
- package/dist/job-queue/PostgresMessageQueue.d.ts.map +1 -0
- package/dist/job-queue/PostgresQueueStorage.d.ts +41 -10
- package/dist/job-queue/PostgresQueueStorage.d.ts.map +1 -1
- package/dist/job-queue/PostgresRateLimiterStorage.d.ts +1 -2
- package/dist/job-queue/PostgresRateLimiterStorage.d.ts.map +1 -1
- package/dist/job-queue/browser.js +401 -53
- package/dist/job-queue/browser.js.map +11 -8
- package/dist/job-queue/common.d.ts +3 -0
- package/dist/job-queue/common.d.ts.map +1 -1
- package/dist/job-queue/createPostgresQueue.d.ts +22 -0
- package/dist/job-queue/createPostgresQueue.d.ts.map +1 -0
- package/dist/job-queue/node.js +401 -53
- package/dist/job-queue/node.js.map +11 -8
- package/dist/migrations/PostgresMigrationRunner.d.ts +1 -1
- package/dist/migrations/PostgresMigrationRunner.d.ts.map +1 -1
- package/dist/migrations/postgresQueueMigrations.d.ts +9 -1
- package/dist/migrations/postgresQueueMigrations.d.ts.map +1 -1
- package/dist/migrations/postgresRateLimiterMigrations.d.ts +1 -1
- package/dist/migrations/postgresRateLimiterMigrations.d.ts.map +1 -1
- package/dist/storage/PostgresKvStorage.d.ts +1 -1
- package/dist/storage/PostgresKvStorage.d.ts.map +1 -1
- package/dist/storage/PostgresTabularStorage.d.ts +1 -1
- package/dist/storage/PostgresTabularStorage.d.ts.map +1 -1
- package/dist/storage/PostgresVectorStorage.d.ts +1 -1
- package/dist/storage/PostgresVectorStorage.d.ts.map +1 -1
- package/dist/storage/browser.js +28 -12
- package/dist/storage/browser.js.map +5 -5
- package/dist/storage/node.js +28 -12
- package/dist/storage/node.js.map +6 -6
- package/dist/text/PostgresFtsTextIndex.d.ts.map +1 -1
- package/dist/text/browser.js.map +2 -2
- package/dist/text/node.js.map +2 -2
- package/package.json +7 -7
package/dist/storage/node.js
CHANGED
|
@@ -32,19 +32,32 @@ var Postgres = {
|
|
|
32
32
|
createPool
|
|
33
33
|
};
|
|
34
34
|
// src/storage/PostgresKvStorage.ts
|
|
35
|
+
import {
|
|
36
|
+
DefaultKeyValueKey,
|
|
37
|
+
DefaultKeyValueSchema,
|
|
38
|
+
KvViaTabularStorage
|
|
39
|
+
} from "@workglow/storage";
|
|
35
40
|
import { createServiceToken as createServiceToken2 } from "@workglow/util";
|
|
36
41
|
|
|
37
42
|
// src/storage/PostgresTabularStorage.ts
|
|
38
|
-
import { createServiceToken } from "@workglow/util";
|
|
39
43
|
import {
|
|
40
44
|
BaseSqlTabularStorage,
|
|
41
45
|
buildSearchWhere,
|
|
42
46
|
MIGRATIONS_TABLE,
|
|
47
|
+
pickCoveringIndex,
|
|
43
48
|
PostgresDialect,
|
|
44
|
-
SqlTabularMigrationApplier
|
|
45
|
-
pickCoveringIndex
|
|
49
|
+
SqlTabularMigrationApplier
|
|
46
50
|
} from "@workglow/storage";
|
|
51
|
+
import { createServiceToken } from "@workglow/util";
|
|
47
52
|
var POSTGRES_TABULAR_REPOSITORY = createServiceToken("storage.tabularRepository.postgres");
|
|
53
|
+
var TYPED_ARRAY_CTORS = {
|
|
54
|
+
Float32Array,
|
|
55
|
+
Float64Array,
|
|
56
|
+
Int8Array,
|
|
57
|
+
Uint8Array,
|
|
58
|
+
Int16Array,
|
|
59
|
+
Uint16Array
|
|
60
|
+
};
|
|
48
61
|
function assertPositiveInt(value, label) {
|
|
49
62
|
if (value === undefined)
|
|
50
63
|
return;
|
|
@@ -283,12 +296,20 @@ class PostgresTabularStorage extends BaseSqlTabularStorage {
|
|
|
283
296
|
if (typeof actualType !== "boolean" && this.isVectorFormat(actualType.format)) {
|
|
284
297
|
if (typeof value === "string") {
|
|
285
298
|
try {
|
|
286
|
-
const
|
|
287
|
-
|
|
299
|
+
const parsed = JSON.parse(value);
|
|
300
|
+
const nums = Array.isArray(parsed) ? parsed : Object.values(parsed);
|
|
301
|
+
const ctorName = typeof actualType.format === "string" && actualType.format !== "TypedArray" ? actualType.format.slice("TypedArray:".length) : "Float32Array";
|
|
302
|
+
const Ctor = TYPED_ARRAY_CTORS[ctorName] ?? Float32Array;
|
|
303
|
+
return new Ctor(nums);
|
|
288
304
|
} catch (e) {
|
|
289
305
|
console.warn(`Failed to parse vector for column ${column}:`, e);
|
|
290
306
|
}
|
|
291
307
|
}
|
|
308
|
+
if (value && typeof value === "object" && Array.isArray(value)) {
|
|
309
|
+
const ctorName = typeof actualType.format === "string" && actualType.format !== "TypedArray" ? actualType.format.slice("TypedArray:".length) : "Float32Array";
|
|
310
|
+
const Ctor = TYPED_ARRAY_CTORS[ctorName] ?? Float32Array;
|
|
311
|
+
return new Ctor(value);
|
|
312
|
+
}
|
|
292
313
|
if (value && typeof value === "object") {
|
|
293
314
|
return value;
|
|
294
315
|
}
|
|
@@ -966,11 +987,6 @@ class PostgresTabularMigrationApplierImpl extends SqlTabularMigrationApplier {
|
|
|
966
987
|
}
|
|
967
988
|
|
|
968
989
|
// src/storage/PostgresKvStorage.ts
|
|
969
|
-
import {
|
|
970
|
-
DefaultKeyValueKey,
|
|
971
|
-
DefaultKeyValueSchema,
|
|
972
|
-
KvViaTabularStorage
|
|
973
|
-
} from "@workglow/storage";
|
|
974
990
|
var POSTGRES_KV_REPOSITORY = createServiceToken2("storage.kvRepository.postgres");
|
|
975
991
|
|
|
976
992
|
class PostgresKvStorage extends KvViaTabularStorage {
|
|
@@ -985,13 +1001,13 @@ class PostgresKvStorage extends KvViaTabularStorage {
|
|
|
985
1001
|
}
|
|
986
1002
|
}
|
|
987
1003
|
// src/storage/PostgresVectorStorage.ts
|
|
988
|
-
import { cosineSimilarity } from "@workglow/util/schema";
|
|
989
1004
|
import {
|
|
990
1005
|
PostgresDialect as PostgresDialect2,
|
|
991
1006
|
StorageValidationError,
|
|
992
1007
|
getMetadataProperty,
|
|
993
1008
|
getVectorProperty
|
|
994
1009
|
} from "@workglow/storage";
|
|
1010
|
+
import { cosineSimilarity } from "@workglow/util/schema";
|
|
995
1011
|
var SAFE_IDENTIFIER_RE = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
996
1012
|
|
|
997
1013
|
class PostgresVectorStorage extends PostgresTabularStorage {
|
|
@@ -1282,4 +1298,4 @@ export {
|
|
|
1282
1298
|
POSTGRES_KV_REPOSITORY
|
|
1283
1299
|
};
|
|
1284
1300
|
|
|
1285
|
-
//# debugId=
|
|
1301
|
+
//# debugId=014124ACC0ECDDB464756E2164756E21
|