@dudousxd/nestjs-durable-store-typeorm 0.23.1 → 0.24.0
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/index.cjs +19 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +20 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -998,6 +998,7 @@ var TypeOrmStateStore = class {
|
|
|
998
998
|
}, {
|
|
999
999
|
status: "suspended",
|
|
1000
1000
|
wakeAt: new Date(patch.wakeAt),
|
|
1001
|
+
tags: patch.tags,
|
|
1001
1002
|
updatedAt: patch.updatedAt
|
|
1002
1003
|
});
|
|
1003
1004
|
return false;
|
|
@@ -1158,7 +1159,7 @@ var TypeOrmStateStore = class {
|
|
|
1158
1159
|
});
|
|
1159
1160
|
return rows.map(fromRunEntity);
|
|
1160
1161
|
}
|
|
1161
|
-
async listOrphanedRuns(nowMs, limit, namespace) {
|
|
1162
|
+
async listOrphanedRuns(nowMs, limit, namespace, ownedBy) {
|
|
1162
1163
|
if (limit <= 0) return [];
|
|
1163
1164
|
const now = new Date(nowMs);
|
|
1164
1165
|
const rows = await this.runs().find({
|
|
@@ -1182,7 +1183,21 @@ var TypeOrmStateStore = class {
|
|
|
1182
1183
|
...namespace !== void 0 ? {
|
|
1183
1184
|
namespace
|
|
1184
1185
|
} : {}
|
|
1185
|
-
}
|
|
1186
|
+
},
|
|
1187
|
+
// A live lease left by a previous process with the caller's own instance id.
|
|
1188
|
+
...ownedBy ? [
|
|
1189
|
+
{
|
|
1190
|
+
status: (0, import_typeorm2.In)([
|
|
1191
|
+
"running",
|
|
1192
|
+
"cancelling"
|
|
1193
|
+
]),
|
|
1194
|
+
lockedBy: ownedBy.owner,
|
|
1195
|
+
lockedUntil: (0, import_typeorm2.LessThan)(new Date(ownedBy.lockedBefore)),
|
|
1196
|
+
...namespace !== void 0 ? {
|
|
1197
|
+
namespace
|
|
1198
|
+
} : {}
|
|
1199
|
+
}
|
|
1200
|
+
] : []
|
|
1186
1201
|
],
|
|
1187
1202
|
order: {
|
|
1188
1203
|
createdAt: "ASC"
|
|
@@ -1739,7 +1754,7 @@ function toRunEntity(run) {
|
|
|
1739
1754
|
// An absent namespace is persisted as `'default'` (what the core `WorkflowRun.namespace` docblock
|
|
1740
1755
|
// promises), so the column is always a value a worker can match on — the opposite of `origin`
|
|
1741
1756
|
// below, where NULL is the only honest answer.
|
|
1742
|
-
namespace: run.namespace
|
|
1757
|
+
namespace: run.namespace || "default",
|
|
1743
1758
|
// Absent origin stays SQL NULL — "unknown", never coerced into a real-looking library name.
|
|
1744
1759
|
origin: run.origin ?? null,
|
|
1745
1760
|
createdAt: run.createdAt,
|
|
@@ -1871,7 +1886,7 @@ function runUpdateSet(patch) {
|
|
|
1871
1886
|
if ("tags" in patch) update.tags = patch.tags ?? null;
|
|
1872
1887
|
if ("searchAttributes" in patch) update.searchAttributes = patch.searchAttributes ?? null;
|
|
1873
1888
|
if ("priority" in patch) update.priority = patch.priority ?? null;
|
|
1874
|
-
if ("namespace" in patch) update.namespace = patch.namespace
|
|
1889
|
+
if ("namespace" in patch) update.namespace = patch.namespace || "default";
|
|
1875
1890
|
if ("origin" in patch) update.origin = patch.origin ?? null;
|
|
1876
1891
|
if ("createdAt" in patch) update.createdAt = patch.createdAt;
|
|
1877
1892
|
if ("updatedAt" in patch) update.updatedAt = patch.updatedAt;
|