@dudousxd/nestjs-durable-store-typeorm 0.23.0 → 0.23.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 +5 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1029,11 +1029,13 @@ var TypeOrmStateStore = class {
|
|
|
1029
1029
|
async updateRunIf(runId, expectedStatuses, inputPatch) {
|
|
1030
1030
|
if (expectedStatuses.length === 0) return false;
|
|
1031
1031
|
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;
|
|
1032
|
-
const
|
|
1032
|
+
const set = runUpdateSet(patch);
|
|
1033
|
+
const where = {
|
|
1033
1034
|
id: runId,
|
|
1034
1035
|
status: (0, import_typeorm2.In)(expectedStatuses)
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1036
|
+
};
|
|
1037
|
+
const matched = Object.keys(set).length ? (await this.runs().createQueryBuilder().update().set(set).where(where).execute()).affected ?? 0 : await this.runs().countBy(where);
|
|
1038
|
+
if (!matched) return false;
|
|
1037
1039
|
if ("searchAttributes" in patch) await this.reindexAttributes(runId, patch.searchAttributes);
|
|
1038
1040
|
return true;
|
|
1039
1041
|
}
|