@dudousxd/nestjs-durable-store-typeorm 0.18.0 → 0.19.1
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 +297 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -3
- package/dist/index.d.ts +29 -3
- package/dist/index.js +297 -4
- package/dist/index.js.map +1 -1
- package/package.json +14 -4
package/dist/index.cjs
CHANGED
|
@@ -26,6 +26,7 @@ __export(index_exports, {
|
|
|
26
26
|
ENTITIES: () => ENTITIES,
|
|
27
27
|
JSON_BLOB_COLUMNS: () => JSON_BLOB_COLUMNS,
|
|
28
28
|
RunAttributeEntity: () => RunAttributeEntity,
|
|
29
|
+
ScheduleEntity: () => ScheduleEntity,
|
|
29
30
|
SignalWaiterEntity: () => SignalWaiterEntity,
|
|
30
31
|
StepCheckpointEntity: () => StepCheckpointEntity,
|
|
31
32
|
TypeOrmStateStore: () => TypeOrmStateStore,
|
|
@@ -152,6 +153,23 @@ var BufferedEventEntity = class {
|
|
|
152
153
|
payload;
|
|
153
154
|
publishedAt;
|
|
154
155
|
};
|
|
156
|
+
var ScheduleEntity = class {
|
|
157
|
+
static {
|
|
158
|
+
__name(this, "ScheduleEntity");
|
|
159
|
+
}
|
|
160
|
+
id;
|
|
161
|
+
namespace;
|
|
162
|
+
workflow;
|
|
163
|
+
paused;
|
|
164
|
+
/** Epoch ms as a `bigint` (drivers hand it back as a string) — an exact integer, so the
|
|
165
|
+
* compare-and-set in `updateSchedule` can't be defeated by a DATETIME's truncated milliseconds. */
|
|
166
|
+
nextFireAt;
|
|
167
|
+
tags;
|
|
168
|
+
spec;
|
|
169
|
+
state;
|
|
170
|
+
createdAt;
|
|
171
|
+
updatedAt;
|
|
172
|
+
};
|
|
155
173
|
function durableEntities(options = {}) {
|
|
156
174
|
const col = columnNamer(options.naming ?? "snake_case");
|
|
157
175
|
const workflowRuns = new import_typeorm.EntitySchema({
|
|
@@ -479,13 +497,69 @@ function durableEntities(options = {}) {
|
|
|
479
497
|
}
|
|
480
498
|
}
|
|
481
499
|
});
|
|
500
|
+
const schedules = new import_typeorm.EntitySchema({
|
|
501
|
+
name: "ScheduleEntity",
|
|
502
|
+
target: ScheduleEntity,
|
|
503
|
+
tableName: "durable_schedules",
|
|
504
|
+
columns: {
|
|
505
|
+
id: {
|
|
506
|
+
type: "text",
|
|
507
|
+
primary: true,
|
|
508
|
+
name: col("id")
|
|
509
|
+
},
|
|
510
|
+
namespace: {
|
|
511
|
+
type: "text",
|
|
512
|
+
name: col("namespace"),
|
|
513
|
+
default: "default"
|
|
514
|
+
},
|
|
515
|
+
workflow: {
|
|
516
|
+
type: "text",
|
|
517
|
+
name: col("workflow")
|
|
518
|
+
},
|
|
519
|
+
paused: {
|
|
520
|
+
type: Boolean,
|
|
521
|
+
name: col("paused"),
|
|
522
|
+
default: false
|
|
523
|
+
},
|
|
524
|
+
nextFireAt: {
|
|
525
|
+
type: "bigint",
|
|
526
|
+
nullable: true,
|
|
527
|
+
name: col("nextFireAt")
|
|
528
|
+
},
|
|
529
|
+
tags: {
|
|
530
|
+
type: "text",
|
|
531
|
+
nullable: true,
|
|
532
|
+
name: col("tags"),
|
|
533
|
+
transformer: jsonColumnTransformer("schedules.tags")
|
|
534
|
+
},
|
|
535
|
+
spec: {
|
|
536
|
+
type: "text",
|
|
537
|
+
name: col("spec"),
|
|
538
|
+
transformer: jsonColumnTransformer("schedules.spec")
|
|
539
|
+
},
|
|
540
|
+
state: {
|
|
541
|
+
type: "text",
|
|
542
|
+
name: col("state"),
|
|
543
|
+
transformer: jsonColumnTransformer("schedules.state")
|
|
544
|
+
},
|
|
545
|
+
createdAt: {
|
|
546
|
+
type: Date,
|
|
547
|
+
name: col("createdAt")
|
|
548
|
+
},
|
|
549
|
+
updatedAt: {
|
|
550
|
+
type: Date,
|
|
551
|
+
name: col("updatedAt")
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
});
|
|
482
555
|
return [
|
|
483
556
|
workflowRuns,
|
|
484
557
|
stepCheckpoints,
|
|
485
558
|
runAttributes,
|
|
486
559
|
signalWaiters,
|
|
487
560
|
bufferedSignals,
|
|
488
|
-
bufferedEvents
|
|
561
|
+
bufferedEvents,
|
|
562
|
+
schedules
|
|
489
563
|
];
|
|
490
564
|
}
|
|
491
565
|
__name(durableEntities, "durableEntities");
|
|
@@ -513,7 +587,8 @@ var TABLE_TO_ENTITY = {
|
|
|
513
587
|
durable_run_attributes: RunAttributeEntity,
|
|
514
588
|
durable_signal_waiters: SignalWaiterEntity,
|
|
515
589
|
durable_buffered_signals: BufferedSignalEntity,
|
|
516
|
-
durable_buffered_events: BufferedEventEntity
|
|
590
|
+
durable_buffered_events: BufferedEventEntity,
|
|
591
|
+
durable_schedules: ScheduleEntity
|
|
517
592
|
};
|
|
518
593
|
function durableManagedTables() {
|
|
519
594
|
return Object.keys(TABLE_TO_ENTITY);
|
|
@@ -571,6 +646,8 @@ async function ensureTypeOrmDurableSchema(dataSource) {
|
|
|
571
646
|
const waiterCol = /* @__PURE__ */ __name((property) => q(resolve("durable_signal_waiters", property)), "waiterCol");
|
|
572
647
|
const bufCol = /* @__PURE__ */ __name((property) => q(resolve("durable_buffered_signals", property)), "bufCol");
|
|
573
648
|
const bevCol = /* @__PURE__ */ __name((property) => q(resolve("durable_buffered_events", property)), "bevCol");
|
|
649
|
+
const schedules = q("durable_schedules");
|
|
650
|
+
const schCol = /* @__PURE__ */ __name((property) => q(resolve("durable_schedules", property)), "schCol");
|
|
574
651
|
const num = isPg ? "double precision" : isMysql ? "double" : "real";
|
|
575
652
|
const bufferedId = isSqlite ? `${bufCol("id")} integer PRIMARY KEY AUTOINCREMENT` : isMysql ? `${bufCol("id")} bigint NOT NULL AUTO_INCREMENT PRIMARY KEY` : isPg ? `${bufCol("id")} bigserial PRIMARY KEY` : `${bufCol("id")} bigint NOT NULL AUTO_INCREMENT PRIMARY KEY`;
|
|
576
653
|
const tables = [
|
|
@@ -614,6 +691,16 @@ async function ensureTypeOrmDurableSchema(dataSource) {
|
|
|
614
691
|
`CREATE TABLE IF NOT EXISTS ${bufferedEvents} (
|
|
615
692
|
${bevCol("id")} ${str} PRIMARY KEY, ${bevCol("name")} ${str} NOT NULL,
|
|
616
693
|
${bevCol("payload")} ${txt}, ${bevCol("publishedAt")} ${ts} NOT NULL
|
|
694
|
+
)`,
|
|
695
|
+
// Persisted schedules. `next_fire_at` is epoch ms as a bigint (exact, so the compare-and-set on
|
|
696
|
+
// it survives MySQL's DATETIME millisecond truncation); `spec`/`state` are engine-owned JSON.
|
|
697
|
+
`CREATE TABLE IF NOT EXISTS ${schedules} (
|
|
698
|
+
${schCol("id")} ${str} PRIMARY KEY, ${schCol("namespace")} ${nsCol},
|
|
699
|
+
${schCol("workflow")} ${str} NOT NULL,
|
|
700
|
+
${schCol("paused")} boolean NOT NULL DEFAULT ${isPg ? "false" : "0"},
|
|
701
|
+
${schCol("nextFireAt")} bigint, ${schCol("tags")} ${txt},
|
|
702
|
+
${schCol("spec")} ${txt} NOT NULL, ${schCol("state")} ${txt} NOT NULL,
|
|
703
|
+
${schCol("createdAt")} ${ts} NOT NULL, ${schCol("updatedAt")} ${ts} NOT NULL
|
|
617
704
|
)`
|
|
618
705
|
];
|
|
619
706
|
const additive = {
|
|
@@ -757,6 +844,11 @@ async function ensureTypeOrmDurableSchema(dataSource) {
|
|
|
757
844
|
],
|
|
758
845
|
// Search-attribute pushdown: equality + range predicates probe by (key, value). Two composite
|
|
759
846
|
// indexes — one per typed column — so a numeric range or a string equality is an index scan.
|
|
847
|
+
// Persisted schedules: the poll's "due by T" scan (`paused = false AND next_fire_at <= T`).
|
|
848
|
+
[
|
|
849
|
+
"durable_schedules_due_idx",
|
|
850
|
+
`${schedules} (${schCol("paused")}, ${schCol("nextFireAt")})`
|
|
851
|
+
],
|
|
760
852
|
[
|
|
761
853
|
"durable_run_attributes_num_idx",
|
|
762
854
|
`${runAttributes} (${attrCol("key")}, ${attrCol("numValue")})`
|
|
@@ -794,6 +886,7 @@ __name(existingColumns, "existingColumns");
|
|
|
794
886
|
// src/typeorm-state-store.ts
|
|
795
887
|
var import_nestjs_durable_core = require("@dudousxd/nestjs-durable-core");
|
|
796
888
|
var import_typeorm2 = require("typeorm");
|
|
889
|
+
var sqliteSingletonClaims = /* @__PURE__ */ new WeakMap();
|
|
797
890
|
var TypeOrmStateStore = class {
|
|
798
891
|
static {
|
|
799
892
|
__name(this, "TypeOrmStateStore");
|
|
@@ -823,6 +916,9 @@ var TypeOrmStateStore = class {
|
|
|
823
916
|
attributes() {
|
|
824
917
|
return this.dataSource.getRepository(RunAttributeEntity);
|
|
825
918
|
}
|
|
919
|
+
schedules() {
|
|
920
|
+
return this.dataSource.getRepository(ScheduleEntity);
|
|
921
|
+
}
|
|
826
922
|
/** Rewrite a run's normalized attribute rows: delete the old set, insert the current one. Mirrors
|
|
827
923
|
* the in-memory store's reindex so the side-table always reflects the run's live searchAttributes. */
|
|
828
924
|
async reindexAttributes(runId, attributes, em) {
|
|
@@ -833,11 +929,63 @@ var TypeOrmStateStore = class {
|
|
|
833
929
|
const rows = (0, import_nestjs_durable_core.normalizeAttributeRows)(runId, attributes);
|
|
834
930
|
if (rows.length) await repo.insert(rows);
|
|
835
931
|
}
|
|
932
|
+
async tryAdmitSingleton(runId, tag, workflow, limit, retryWakeAt) {
|
|
933
|
+
const previous = sqliteSingletonClaims.get(this.dataSource) ?? Promise.resolve();
|
|
934
|
+
const sqlite = [
|
|
935
|
+
"sqlite",
|
|
936
|
+
"better-sqlite3",
|
|
937
|
+
"sqljs"
|
|
938
|
+
].includes(this.dataSource.options.type);
|
|
939
|
+
let release;
|
|
940
|
+
if (sqlite) {
|
|
941
|
+
const next = new Promise((resolve) => {
|
|
942
|
+
release = resolve;
|
|
943
|
+
});
|
|
944
|
+
sqliteSingletonClaims.set(this.dataSource, previous.then(() => next));
|
|
945
|
+
await previous;
|
|
946
|
+
}
|
|
947
|
+
try {
|
|
948
|
+
return await this.dataSource.transaction(async (em) => {
|
|
949
|
+
const repo = em.getRepository(WorkflowRunEntity);
|
|
950
|
+
const where = {
|
|
951
|
+
workflow,
|
|
952
|
+
status: (0, import_typeorm2.In)(import_nestjs_durable_core.SINGLETON_ACTIVE_STATUSES)
|
|
953
|
+
};
|
|
954
|
+
await repo.update(where, {
|
|
955
|
+
workflow
|
|
956
|
+
});
|
|
957
|
+
const runs = (await repo.find({
|
|
958
|
+
where
|
|
959
|
+
})).map(fromRunEntity);
|
|
960
|
+
const tags = (0, import_nestjs_durable_core.singletonAdmissionTags)(runs, runId, tag, workflow, limit);
|
|
961
|
+
if (!tags) {
|
|
962
|
+
const patch = (0, import_nestjs_durable_core.singletonAdmissionDenialPatch)(runs, runId, tag, workflow, retryWakeAt);
|
|
963
|
+
if (patch) await repo.update({
|
|
964
|
+
id: runId
|
|
965
|
+
}, {
|
|
966
|
+
status: "suspended",
|
|
967
|
+
wakeAt: new Date(patch.wakeAt),
|
|
968
|
+
updatedAt: patch.updatedAt
|
|
969
|
+
});
|
|
970
|
+
return false;
|
|
971
|
+
}
|
|
972
|
+
await repo.update({
|
|
973
|
+
id: runId
|
|
974
|
+
}, {
|
|
975
|
+
tags
|
|
976
|
+
});
|
|
977
|
+
return true;
|
|
978
|
+
});
|
|
979
|
+
} finally {
|
|
980
|
+
release?.();
|
|
981
|
+
}
|
|
982
|
+
}
|
|
836
983
|
async createRun(run) {
|
|
837
984
|
await this.runs().save(toRunEntity(run));
|
|
838
985
|
await this.reindexAttributes(run.id, run.searchAttributes);
|
|
839
986
|
}
|
|
840
|
-
async updateRun(runId,
|
|
987
|
+
async updateRun(runId, inputPatch) {
|
|
988
|
+
const patch = inputPatch.status && import_nestjs_durable_core.TERMINAL_RUN_STATUSES.includes(inputPatch.status) ? await (0, import_nestjs_durable_core.clearTerminalSingletonAdmission)(runId, inputPatch, (id) => this.getRun(id)) : inputPatch;
|
|
841
989
|
const update = {};
|
|
842
990
|
if ("workflow" in patch) update.workflow = patch.workflow;
|
|
843
991
|
if ("workflowVersion" in patch) update.workflowVersion = patch.workflowVersion;
|
|
@@ -883,6 +1031,52 @@ var TypeOrmStateStore = class {
|
|
|
883
1031
|
id: runId
|
|
884
1032
|
});
|
|
885
1033
|
}
|
|
1034
|
+
async deleteRuns(runIds) {
|
|
1035
|
+
if (runIds.length === 0) return;
|
|
1036
|
+
await this.dataSource.transaction(async (em) => {
|
|
1037
|
+
await em.getRepository(StepCheckpointEntity).delete({
|
|
1038
|
+
runId: (0, import_typeorm2.In)(runIds)
|
|
1039
|
+
});
|
|
1040
|
+
await em.getRepository(SignalWaiterEntity).delete({
|
|
1041
|
+
runId: (0, import_typeorm2.In)(runIds)
|
|
1042
|
+
});
|
|
1043
|
+
await em.getRepository(RunAttributeEntity).delete({
|
|
1044
|
+
runId: (0, import_typeorm2.In)(runIds)
|
|
1045
|
+
});
|
|
1046
|
+
await em.getRepository(WorkflowRunEntity).delete({
|
|
1047
|
+
id: (0, import_typeorm2.In)(runIds)
|
|
1048
|
+
});
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
async pruneTerminalRuns(policy, nowMs, limit) {
|
|
1052
|
+
const statuses = policy.statuses.filter((s) => import_nestjs_durable_core.TERMINAL_RUN_STATUSES.includes(s));
|
|
1053
|
+
if (statuses.length === 0 || limit <= 0) return 0;
|
|
1054
|
+
if (policy.maxAge == null && policy.maxCount == null) return 0;
|
|
1055
|
+
const scoped = /* @__PURE__ */ __name(() => this.runQueryBuilder({
|
|
1056
|
+
...policy.scope ?? {},
|
|
1057
|
+
statuses
|
|
1058
|
+
}).select("r.id", "id"), "scoped");
|
|
1059
|
+
const ids = /* @__PURE__ */ new Set();
|
|
1060
|
+
if (policy.maxAge != null) {
|
|
1061
|
+
const cutoff = new Date(nowMs - (0, import_nestjs_durable_core.parseDuration)(policy.maxAge));
|
|
1062
|
+
const rows = await scoped().andWhere("r.updatedAt < :cutoff", {
|
|
1063
|
+
cutoff
|
|
1064
|
+
}).orderBy("r.updatedAt", "ASC").limit(limit).getRawMany();
|
|
1065
|
+
for (const r of rows) ids.add(r.id);
|
|
1066
|
+
}
|
|
1067
|
+
if (policy.maxCount != null && ids.size < limit) {
|
|
1068
|
+
const rows = await scoped().orderBy("r.updatedAt", "DESC").addOrderBy("r.id", "DESC").limit(limit).offset(policy.maxCount).getRawMany();
|
|
1069
|
+
for (const r of rows) {
|
|
1070
|
+
if (ids.size >= limit) break;
|
|
1071
|
+
ids.add(r.id);
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
const doomed = [
|
|
1075
|
+
...ids
|
|
1076
|
+
].slice(0, limit);
|
|
1077
|
+
await this.deleteRuns(doomed);
|
|
1078
|
+
return doomed.length;
|
|
1079
|
+
}
|
|
886
1080
|
async getCheckpoint(runId, seq) {
|
|
887
1081
|
const e = await this.checkpoints().findOneBy({
|
|
888
1082
|
runId,
|
|
@@ -1038,6 +1232,9 @@ var TypeOrmStateStore = class {
|
|
|
1038
1232
|
const rows = await qb.getMany();
|
|
1039
1233
|
return rows.map(fromRunEntity);
|
|
1040
1234
|
}
|
|
1235
|
+
async countRuns(query) {
|
|
1236
|
+
return this.runQueryBuilder(query).getCount();
|
|
1237
|
+
}
|
|
1041
1238
|
/** `GROUP BY status, origin` over the same predicates {@link listRuns} pages — one aggregate, so a
|
|
1042
1239
|
* console can show whole-set counts next to a bounded page instead of downloading every run to
|
|
1043
1240
|
* count them in the browser. */
|
|
@@ -1100,6 +1297,69 @@ var TypeOrmStateStore = class {
|
|
|
1100
1297
|
const type = String(this.dataSource.options.type);
|
|
1101
1298
|
return type === "mysql" || type === "mariadb" || type === "aurora-mysql" ? "`" : '"';
|
|
1102
1299
|
}
|
|
1300
|
+
// ---- persisted schedules ----------------------------------------------------------------------
|
|
1301
|
+
async saveSchedule(record) {
|
|
1302
|
+
await this.schedules().save(toScheduleEntity(record));
|
|
1303
|
+
}
|
|
1304
|
+
async getSchedule(id) {
|
|
1305
|
+
const e = await this.schedules().findOneBy({
|
|
1306
|
+
id
|
|
1307
|
+
});
|
|
1308
|
+
return e ? fromScheduleEntity(e) : null;
|
|
1309
|
+
}
|
|
1310
|
+
/** One conditional UPDATE: the compare-and-set on `next_fire_at` (an exact bigint) is atomic. */
|
|
1311
|
+
async updateSchedule(id, patch, expectedNextFireAt) {
|
|
1312
|
+
const set = {};
|
|
1313
|
+
if (patch.namespace !== void 0) set.namespace = patch.namespace;
|
|
1314
|
+
if (patch.workflow !== void 0) set.workflow = patch.workflow;
|
|
1315
|
+
if (patch.paused !== void 0) set.paused = patch.paused;
|
|
1316
|
+
if ("nextFireAt" in patch) set.nextFireAt = patch.nextFireAt ?? null;
|
|
1317
|
+
if ("tags" in patch) set.tags = patch.tags ?? null;
|
|
1318
|
+
if (patch.spec !== void 0) set.spec = patch.spec;
|
|
1319
|
+
if (patch.state !== void 0) set.state = patch.state;
|
|
1320
|
+
if (patch.updatedAt !== void 0) set.updatedAt = patch.updatedAt;
|
|
1321
|
+
if (!Object.keys(set).length) return await this.getSchedule(id) !== null;
|
|
1322
|
+
const qb = this.schedules().createQueryBuilder().update().set(set).where({
|
|
1323
|
+
id
|
|
1324
|
+
});
|
|
1325
|
+
if (expectedNextFireAt === null) qb.andWhere({
|
|
1326
|
+
nextFireAt: (0, import_typeorm2.IsNull)()
|
|
1327
|
+
});
|
|
1328
|
+
else if (expectedNextFireAt !== void 0) qb.andWhere({
|
|
1329
|
+
nextFireAt: expectedNextFireAt
|
|
1330
|
+
});
|
|
1331
|
+
const result = await qb.execute();
|
|
1332
|
+
return (result.affected ?? 0) > 0;
|
|
1333
|
+
}
|
|
1334
|
+
async deleteSchedule(id) {
|
|
1335
|
+
const result = await this.schedules().delete({
|
|
1336
|
+
id
|
|
1337
|
+
});
|
|
1338
|
+
return (result.affected ?? 0) > 0;
|
|
1339
|
+
}
|
|
1340
|
+
async listSchedules(query) {
|
|
1341
|
+
const qb = this.schedules().createQueryBuilder("s");
|
|
1342
|
+
if (query.namespace !== void 0) qb.andWhere("s.namespace = :namespace", {
|
|
1343
|
+
namespace: query.namespace
|
|
1344
|
+
});
|
|
1345
|
+
if (query.workflow !== void 0) qb.andWhere("s.workflow = :workflow", {
|
|
1346
|
+
workflow: query.workflow
|
|
1347
|
+
});
|
|
1348
|
+
if (query.paused !== void 0) qb.andWhere("s.paused = :paused", {
|
|
1349
|
+
paused: query.paused
|
|
1350
|
+
});
|
|
1351
|
+
if (query.tag !== void 0) qb.andWhere("s.tags LIKE :tag", {
|
|
1352
|
+
tag: `%"${query.tag}"%`
|
|
1353
|
+
});
|
|
1354
|
+
if (query.dueBy !== void 0) qb.andWhere("s.paused = :notPaused AND s.nextFireAt <= :dueBy", {
|
|
1355
|
+
notPaused: false,
|
|
1356
|
+
dueBy: query.dueBy
|
|
1357
|
+
});
|
|
1358
|
+
qb.orderBy("CASE WHEN s.nextFireAt IS NULL THEN 1 ELSE 0 END", "ASC").addOrderBy("s.nextFireAt", "ASC").addOrderBy("s.id", "ASC");
|
|
1359
|
+
if (query.limit != null) qb.take(query.limit);
|
|
1360
|
+
if (query.offset != null) qb.skip(query.offset);
|
|
1361
|
+
return (await qb.getMany()).map(fromScheduleEntity);
|
|
1362
|
+
}
|
|
1103
1363
|
async listCheckpoints(runId) {
|
|
1104
1364
|
const rows = await this.checkpoints().find({
|
|
1105
1365
|
where: {
|
|
@@ -1343,6 +1603,39 @@ function fromCheckpointEntity(e) {
|
|
|
1343
1603
|
};
|
|
1344
1604
|
}
|
|
1345
1605
|
__name(fromCheckpointEntity, "fromCheckpointEntity");
|
|
1606
|
+
function toScheduleEntity(r) {
|
|
1607
|
+
const e = new ScheduleEntity();
|
|
1608
|
+
e.id = r.id;
|
|
1609
|
+
e.namespace = r.namespace;
|
|
1610
|
+
e.workflow = r.workflow;
|
|
1611
|
+
e.paused = r.paused;
|
|
1612
|
+
e.nextFireAt = r.nextFireAt;
|
|
1613
|
+
e.tags = r.tags ?? null;
|
|
1614
|
+
e.spec = r.spec;
|
|
1615
|
+
e.state = r.state;
|
|
1616
|
+
e.createdAt = r.createdAt;
|
|
1617
|
+
e.updatedAt = r.updatedAt;
|
|
1618
|
+
return e;
|
|
1619
|
+
}
|
|
1620
|
+
__name(toScheduleEntity, "toScheduleEntity");
|
|
1621
|
+
function fromScheduleEntity(e) {
|
|
1622
|
+
return {
|
|
1623
|
+
id: e.id,
|
|
1624
|
+
namespace: e.namespace,
|
|
1625
|
+
workflow: e.workflow,
|
|
1626
|
+
// SQLite/MySQL hand a boolean column back as 0/1.
|
|
1627
|
+
paused: Boolean(e.paused),
|
|
1628
|
+
nextFireAt: e.nextFireAt == null ? null : Number(e.nextFireAt),
|
|
1629
|
+
...e.tags ? {
|
|
1630
|
+
tags: e.tags
|
|
1631
|
+
} : {},
|
|
1632
|
+
spec: e.spec ?? {},
|
|
1633
|
+
state: e.state ?? {},
|
|
1634
|
+
createdAt: e.createdAt,
|
|
1635
|
+
updatedAt: e.updatedAt
|
|
1636
|
+
};
|
|
1637
|
+
}
|
|
1638
|
+
__name(fromScheduleEntity, "fromScheduleEntity");
|
|
1346
1639
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1347
1640
|
0 && (module.exports = {
|
|
1348
1641
|
BufferedEventEntity,
|
|
@@ -1350,6 +1643,7 @@ __name(fromCheckpointEntity, "fromCheckpointEntity");
|
|
|
1350
1643
|
ENTITIES,
|
|
1351
1644
|
JSON_BLOB_COLUMNS,
|
|
1352
1645
|
RunAttributeEntity,
|
|
1646
|
+
ScheduleEntity,
|
|
1353
1647
|
SignalWaiterEntity,
|
|
1354
1648
|
StepCheckpointEntity,
|
|
1355
1649
|
TypeOrmStateStore,
|