@dudousxd/nestjs-durable-store-drizzle 0.24.5 → 0.24.6
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/pg/index.cjs +9 -0
- package/dist/pg/index.cjs.map +1 -1
- package/dist/pg/index.js +9 -0
- package/dist/pg/index.js.map +1 -1
- package/package.json +3 -3
package/dist/pg/index.js
CHANGED
|
@@ -442,6 +442,11 @@ var DrizzlePgStateStore = class _DrizzlePgStateStore {
|
|
|
442
442
|
});
|
|
443
443
|
}
|
|
444
444
|
async createRun(run) {
|
|
445
|
+
if (normalizeAttributeRows(run.id, run.searchAttributes).length === 0) {
|
|
446
|
+
await this.db.insert(durableWorkflowRuns).values(toRunRow(run));
|
|
447
|
+
await this.db.delete(durableRunAttributes).where(eq(durableRunAttributes.runId, run.id));
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
445
450
|
await this.db.transaction(async (tx) => {
|
|
446
451
|
await tx.insert(durableWorkflowRuns).values(toRunRow(run));
|
|
447
452
|
await reindexAttributes(tx, run.id, run.searchAttributes);
|
|
@@ -452,6 +457,10 @@ var DrizzlePgStateStore = class _DrizzlePgStateStore {
|
|
|
452
457
|
const row = toRunPatch(patch);
|
|
453
458
|
const reindex = "searchAttributes" in patch;
|
|
454
459
|
if (!Object.keys(row).length && !reindex) return;
|
|
460
|
+
if (!reindex) {
|
|
461
|
+
await this.db.update(durableWorkflowRuns).set(row).where(eq(durableWorkflowRuns.id, runId));
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
455
464
|
await this.db.transaction(async (tx) => {
|
|
456
465
|
if (Object.keys(row).length) await tx.update(durableWorkflowRuns).set(row).where(eq(durableWorkflowRuns.id, runId));
|
|
457
466
|
if (reindex) await reindexAttributes(tx, runId, patch.searchAttributes);
|