@getstrata/core 2.2.59 → 2.2.60
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# @getstrata/core changelog
|
|
2
2
|
|
|
3
|
+
## 2.2.60
|
|
4
|
+
|
|
5
|
+
- Preserve failed-job payloads as PostgreSQL JSONB objects by letting the native driver encode them once. Retain SQLite/MySQL JSON text mapping and readable legacy JSONB strings; timestamps, projections and replay admission/deletion ordering are unchanged.
|
|
6
|
+
- Add real PostgreSQL restricted-role persistence and replay regression coverage, including an independent stored-type oracle and legacy-string recovery.
|
|
7
|
+
|
|
3
8
|
## 2.2.59
|
|
4
9
|
|
|
5
10
|
- Reject unsupported SQLite column-level uniqueness during ADD COLUMN compilation, before any statement in a Schema.run plan executes. Use the existing nullable column plus table.unique() API; populated rows, duplicate rejection, CREATE behavior and PostgreSQL/MySQL SQL are preserved. #371
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// ../../src/core/queue/failedJobRepository.ts
|
|
3
3
|
import { BaseRepository } from "@getstrata/core/database/baseRepository";
|
|
4
|
-
import { sqlTimestamp } from "@getstrata/core/database/dialect";
|
|
4
|
+
import { currentSqlDialect, sqlTimestamp } from "@getstrata/core/database/dialect";
|
|
5
5
|
|
|
6
6
|
// ../../src/core/queue/failedJobTable.ts
|
|
7
7
|
import { defineTable } from "@getstrata/core/database/table";
|
|
@@ -20,7 +20,9 @@ class FailedJobRepository extends BaseRepository {
|
|
|
20
20
|
async create(values) {
|
|
21
21
|
const stored = {
|
|
22
22
|
...values,
|
|
23
|
-
...values.payload === undefined ? {} : {
|
|
23
|
+
...values.payload === undefined ? {} : {
|
|
24
|
+
payload: currentSqlDialect().driver === "pgsql" ? values.payload : JSON.stringify(values.payload)
|
|
25
|
+
},
|
|
24
26
|
...values.failed_at === undefined ? {} : { failed_at: sqlTimestamp(values.failed_at) }
|
|
25
27
|
};
|
|
26
28
|
return hydrateFailure(await super.create(stored));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// ../../src/core/queue/failedJobRepository.ts
|
|
3
3
|
import { BaseRepository } from "@getstrata/core/database/baseRepository";
|
|
4
|
-
import { sqlTimestamp } from "@getstrata/core/database/dialect";
|
|
4
|
+
import { currentSqlDialect, sqlTimestamp } from "@getstrata/core/database/dialect";
|
|
5
5
|
|
|
6
6
|
// ../../src/core/queue/failedJobTable.ts
|
|
7
7
|
import { defineTable } from "@getstrata/core/database/table";
|
|
@@ -20,7 +20,9 @@ class FailedJobRepository extends BaseRepository {
|
|
|
20
20
|
async create(values) {
|
|
21
21
|
const stored = {
|
|
22
22
|
...values,
|
|
23
|
-
...values.payload === undefined ? {} : {
|
|
23
|
+
...values.payload === undefined ? {} : {
|
|
24
|
+
payload: currentSqlDialect().driver === "pgsql" ? values.payload : JSON.stringify(values.payload)
|
|
25
|
+
},
|
|
24
26
|
...values.failed_at === undefined ? {} : { failed_at: sqlTimestamp(values.failed_at) }
|
|
25
27
|
};
|
|
26
28
|
return hydrateFailure(await super.create(stored));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// ../../src/core/queue/failedJobRepository.ts
|
|
3
3
|
import { BaseRepository } from "@getstrata/core/database/baseRepository";
|
|
4
|
-
import { sqlTimestamp } from "@getstrata/core/database/dialect";
|
|
4
|
+
import { currentSqlDialect, sqlTimestamp } from "@getstrata/core/database/dialect";
|
|
5
5
|
|
|
6
6
|
// ../../src/core/queue/failedJobTable.ts
|
|
7
7
|
import { defineTable } from "@getstrata/core/database/table";
|
|
@@ -20,7 +20,9 @@ class FailedJobRepository extends BaseRepository {
|
|
|
20
20
|
async create(values) {
|
|
21
21
|
const stored = {
|
|
22
22
|
...values,
|
|
23
|
-
...values.payload === undefined ? {} : {
|
|
23
|
+
...values.payload === undefined ? {} : {
|
|
24
|
+
payload: currentSqlDialect().driver === "pgsql" ? values.payload : JSON.stringify(values.payload)
|
|
25
|
+
},
|
|
24
26
|
...values.failed_at === undefined ? {} : { failed_at: sqlTimestamp(values.failed_at) }
|
|
25
27
|
};
|
|
26
28
|
return hydrateFailure(await super.create(stored));
|
|
@@ -80,7 +80,7 @@ function quoteIdentifierFor(dialect, column) {
|
|
|
80
80
|
function dialectFor(driver) {
|
|
81
81
|
return dialects[driver];
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function currentSqlDialect2() {
|
|
84
84
|
return dialectContext.getStore() ?? dialectOverride ?? dialectFor(resolveDatabaseDriver());
|
|
85
85
|
}
|
|
86
86
|
var postgresDialect, mysqlDialect, sqliteDialect, dialects, dialectContext, dialectOverride = null;
|
|
@@ -305,7 +305,7 @@ function resolveRepositoryConnection() {
|
|
|
305
305
|
return getActiveDatabaseConnection(getBoundDatabaseConnection() ?? getDefaultDatabaseQuery());
|
|
306
306
|
}
|
|
307
307
|
function compileTaggedSql(strings, values) {
|
|
308
|
-
const dialect =
|
|
308
|
+
const dialect = currentSqlDialect2();
|
|
309
309
|
let query = strings[0] ?? "";
|
|
310
310
|
const params = [];
|
|
311
311
|
for (let index = 0;index < values.length; index += 1) {
|
|
@@ -913,7 +913,7 @@ var {RedisClient: RedisClient3 } = globalThis.Bun;
|
|
|
913
913
|
|
|
914
914
|
// ../../src/core/queue/failedJobRepository.ts
|
|
915
915
|
import { BaseRepository } from "@getstrata/core/database/baseRepository";
|
|
916
|
-
import { sqlTimestamp } from "@getstrata/core/database/dialect";
|
|
916
|
+
import { currentSqlDialect, sqlTimestamp } from "@getstrata/core/database/dialect";
|
|
917
917
|
|
|
918
918
|
// ../../src/core/queue/failedJobTable.ts
|
|
919
919
|
import { defineTable } from "@getstrata/core/database/table";
|
|
@@ -932,7 +932,9 @@ class FailedJobRepository extends BaseRepository {
|
|
|
932
932
|
async create(values) {
|
|
933
933
|
const stored = {
|
|
934
934
|
...values,
|
|
935
|
-
...values.payload === undefined ? {} : {
|
|
935
|
+
...values.payload === undefined ? {} : {
|
|
936
|
+
payload: currentSqlDialect().driver === "pgsql" ? values.payload : JSON.stringify(values.payload)
|
|
937
|
+
},
|
|
936
938
|
...values.failed_at === undefined ? {} : { failed_at: sqlTimestamp(values.failed_at) }
|
|
937
939
|
};
|
|
938
940
|
return hydrateFailure(await super.create(stored));
|
|
@@ -2417,7 +2419,7 @@ function createReadOnlyCollector(name, timeoutMs, collect) {
|
|
|
2417
2419
|
throw new Error(`${name} collector is closed.`);
|
|
2418
2420
|
if (hasActiveTransaction() || hasActiveDatabaseConnection())
|
|
2419
2421
|
throw new Error(`${name} require an independent transaction.`);
|
|
2420
|
-
const driver =
|
|
2422
|
+
const driver = currentSqlDialect2().driver;
|
|
2421
2423
|
const pool = resolveRepositoryConnection();
|
|
2422
2424
|
if (driver !== "pgsql" && driver !== "sqlite" && driver !== "mysql")
|
|
2423
2425
|
throw new Error(`${name} require Postgres or an interruptible SQLite/MySQL adapter.`);
|
|
@@ -2508,7 +2510,7 @@ function createFailedJobMetricsCollector(options = {}) {
|
|
|
2508
2510
|
throw new TypeError("Failed-job metrics sample limit must be between 1 and 1000.");
|
|
2509
2511
|
const repository = new failedJobRepository_default;
|
|
2510
2512
|
return createReadOnlyCollector("Failed-job metrics", options.timeoutMs ?? 1000, async (remaining) => {
|
|
2511
|
-
const driver =
|
|
2513
|
+
const driver = currentSqlDialect2().driver;
|
|
2512
2514
|
const postgres = driver === "pgsql";
|
|
2513
2515
|
if (postgres)
|
|
2514
2516
|
await repositoryConnection.unsafe('LOCK TABLE "failed_job" IN ACCESS SHARE MODE');
|
package/dist/index.js
CHANGED
|
@@ -14755,7 +14755,9 @@ class FailedJobRepository extends BaseRepository {
|
|
|
14755
14755
|
async create(values) {
|
|
14756
14756
|
const stored = {
|
|
14757
14757
|
...values,
|
|
14758
|
-
...values.payload === undefined ? {} : {
|
|
14758
|
+
...values.payload === undefined ? {} : {
|
|
14759
|
+
payload: currentSqlDialect().driver === "pgsql" ? values.payload : JSON.stringify(values.payload)
|
|
14760
|
+
},
|
|
14759
14761
|
...values.failed_at === undefined ? {} : { failed_at: sqlTimestamp(values.failed_at) }
|
|
14760
14762
|
};
|
|
14761
14763
|
return hydrateFailure(await super.create(stored));
|