@dudousxd/nestjs-durable-store-mikro-orm 0.33.6 → 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 +14 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -11
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
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) {
|