@dudousxd/nestjs-durable-store-mikro-orm 0.33.5 → 0.33.7
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 +35 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +35 -11
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -410,6 +410,7 @@ declare class MikroOrmStateStore implements StateStore {
|
|
|
410
410
|
listCheckpoints(runId: string): Promise<StepCheckpoint[]>;
|
|
411
411
|
listCheckpointsForReplay(runId: string): Promise<StepCheckpoint[]>;
|
|
412
412
|
getLatestCheckpointByName(runId: string, name: string): Promise<StepCheckpoint | undefined>;
|
|
413
|
+
hasCheckpoints(runId: string, fromSeq: number, toSeq: number, statuses: StepCheckpoint['status'][]): Promise<boolean>;
|
|
413
414
|
countCheckpoints(runId: string, fromSeq: number, toSeq: number, statuses: StepCheckpoint['status'][]): Promise<number>;
|
|
414
415
|
listCheckpointsByNamePrefix(runId: string, prefixes: string[]): Promise<StepCheckpoint[]>;
|
|
415
416
|
/** One `GROUP BY parallel_group, status, <name kind>` over the run's checkpoints — the buckets a
|
package/dist/index.d.ts
CHANGED
|
@@ -410,6 +410,7 @@ declare class MikroOrmStateStore implements StateStore {
|
|
|
410
410
|
listCheckpoints(runId: string): Promise<StepCheckpoint[]>;
|
|
411
411
|
listCheckpointsForReplay(runId: string): Promise<StepCheckpoint[]>;
|
|
412
412
|
getLatestCheckpointByName(runId: string, name: string): Promise<StepCheckpoint | undefined>;
|
|
413
|
+
hasCheckpoints(runId: string, fromSeq: number, toSeq: number, statuses: StepCheckpoint['status'][]): Promise<boolean>;
|
|
413
414
|
countCheckpoints(runId: string, fromSeq: number, toSeq: number, statuses: StepCheckpoint['status'][]): Promise<number>;
|
|
414
415
|
listCheckpointsByNamePrefix(runId: string, prefixes: string[]): Promise<StepCheckpoint[]>;
|
|
415
416
|
/** One `GROUP BY parallel_group, status, <name kind>` over the run's checkpoints — the buckets a
|
package/dist/index.js
CHANGED
|
@@ -1130,22 +1130,25 @@ var MikroOrmStateStore = class _MikroOrmStateStore {
|
|
|
1130
1130
|
});
|
|
1131
1131
|
}
|
|
1132
1132
|
async createRun(run) {
|
|
1133
|
-
|
|
1134
|
-
em.create(WorkflowRunEntity, toRunEntity(run));
|
|
1135
|
-
await em.flush();
|
|
1133
|
+
await this.fork().insert(WorkflowRunEntity, toRunEntity(run));
|
|
1136
1134
|
await this.reindexAttributes(run.id, run.searchAttributes);
|
|
1137
1135
|
}
|
|
1138
1136
|
async updateRun(runId, inputPatch) {
|
|
1139
1137
|
const patch = inputPatch.status && TERMINAL_RUN_STATUSES.includes(inputPatch.status) ? await clearTerminalSingletonAdmission(runId, inputPatch, (id) => this.withScope({}).getRun(id)) : inputPatch;
|
|
1138
|
+
const data = runUpdateData(patch);
|
|
1140
1139
|
const em = this.fork();
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1140
|
+
if (Object.keys(data).length) {
|
|
1141
|
+
const affected = await em.nativeUpdate(WorkflowRunEntity, {
|
|
1142
|
+
id: runId
|
|
1143
|
+
}, data);
|
|
1144
|
+
if (affected === 0) await em.findOneOrFail(WorkflowRunEntity, {
|
|
1145
|
+
id: runId
|
|
1146
|
+
});
|
|
1147
|
+
} else {
|
|
1148
|
+
await em.findOneOrFail(WorkflowRunEntity, {
|
|
1149
|
+
id: runId
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1149
1152
|
if ("searchAttributes" in patch) await this.reindexAttributes(runId, patch.searchAttributes);
|
|
1150
1153
|
}
|
|
1151
1154
|
async updateRunIf(runId, expectedStatuses, inputPatch) {
|
|
@@ -1970,6 +1973,27 @@ var MikroOrmStateStore = class _MikroOrmStateStore {
|
|
|
1970
1973
|
});
|
|
1971
1974
|
return entity ? fromCheckpointEntity(entity) : void 0;
|
|
1972
1975
|
}
|
|
1976
|
+
async hasCheckpoints(runId, fromSeq, toSeq, statuses) {
|
|
1977
|
+
if (statuses.length === 0) return false;
|
|
1978
|
+
const row = await this.fork().findOne(StepCheckpointEntity, {
|
|
1979
|
+
runId,
|
|
1980
|
+
seq: {
|
|
1981
|
+
$gte: fromSeq,
|
|
1982
|
+
$lte: toSeq
|
|
1983
|
+
},
|
|
1984
|
+
status: {
|
|
1985
|
+
$in: statuses
|
|
1986
|
+
}
|
|
1987
|
+
}, {
|
|
1988
|
+
fields: [
|
|
1989
|
+
"seq"
|
|
1990
|
+
],
|
|
1991
|
+
orderBy: {
|
|
1992
|
+
seq: "desc"
|
|
1993
|
+
}
|
|
1994
|
+
});
|
|
1995
|
+
return row !== null;
|
|
1996
|
+
}
|
|
1973
1997
|
async countCheckpoints(runId, fromSeq, toSeq, statuses) {
|
|
1974
1998
|
if (statuses.length === 0) return 0;
|
|
1975
1999
|
return this.fork().count(StepCheckpointEntity, {
|