@dudousxd/nestjs-durable-store-mikro-orm 0.1.0
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/entities.d.ts +37 -0
- package/dist/entities.d.ts.map +1 -0
- package/dist/entities.js +173 -0
- package/dist/entities.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/mikro-orm-state-store.d.ts +26 -0
- package/dist/mikro-orm-state-store.d.ts.map +1 -0
- package/dist/mikro-orm-state-store.js +168 -0
- package/dist/mikro-orm-state-store.js.map +1 -0
- package/dist/schema.d.ts +14 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +18 -0
- package/dist/schema.js.map +1 -0
- package/package.json +33 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { RunStatus, StepKind } from '@dudousxd/nestjs-durable-core';
|
|
2
|
+
export declare class WorkflowRunEntity {
|
|
3
|
+
id: string;
|
|
4
|
+
workflow: string;
|
|
5
|
+
workflowVersion: string;
|
|
6
|
+
status: RunStatus;
|
|
7
|
+
input?: unknown;
|
|
8
|
+
output?: unknown;
|
|
9
|
+
error?: unknown;
|
|
10
|
+
wakeAt?: Date;
|
|
11
|
+
lockedBy?: string;
|
|
12
|
+
lockedUntil?: Date;
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
updatedAt: Date;
|
|
15
|
+
}
|
|
16
|
+
export declare class StepCheckpointEntity {
|
|
17
|
+
runId: string;
|
|
18
|
+
seq: number;
|
|
19
|
+
name: string;
|
|
20
|
+
kind: StepKind;
|
|
21
|
+
stepId: string;
|
|
22
|
+
status: 'completed' | 'failed';
|
|
23
|
+
output?: unknown;
|
|
24
|
+
error?: unknown;
|
|
25
|
+
attempts: number;
|
|
26
|
+
workerGroup?: string;
|
|
27
|
+
wakeAt?: Date;
|
|
28
|
+
startedAt: Date;
|
|
29
|
+
finishedAt: Date;
|
|
30
|
+
}
|
|
31
|
+
export declare class SignalWaiterEntity {
|
|
32
|
+
token: string;
|
|
33
|
+
runId: string;
|
|
34
|
+
seq: number;
|
|
35
|
+
}
|
|
36
|
+
export declare const ENTITIES: readonly [typeof WorkflowRunEntity, typeof StepCheckpointEntity, typeof SignalWaiterEntity];
|
|
37
|
+
//# sourceMappingURL=entities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../src/entities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAGzE,qBACa,iBAAiB;IAE5B,EAAE,EAAG,MAAM,CAAC;IAGZ,QAAQ,EAAG,MAAM,CAAC;IAGlB,eAAe,EAAG,MAAM,CAAC;IAGzB,MAAM,EAAG,SAAS,CAAC;IAGnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAGhB,MAAM,CAAC,EAAE,OAAO,CAAC;IAGjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAGhB,MAAM,CAAC,EAAE,IAAI,CAAC;IAGd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,WAAW,CAAC,EAAE,IAAI,CAAC;IAGnB,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;CAClB;AAED,qBACa,oBAAoB;IAE/B,KAAK,EAAG,MAAM,CAAC;IAGf,GAAG,EAAG,MAAM,CAAC;IAGb,IAAI,EAAG,MAAM,CAAC;IAGd,IAAI,EAAG,QAAQ,CAAC;IAGhB,MAAM,EAAG,MAAM,CAAC;IAGhB,MAAM,EAAG,WAAW,GAAG,QAAQ,CAAC;IAGhC,MAAM,CAAC,EAAE,OAAO,CAAC;IAGjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAGhB,QAAQ,EAAG,MAAM,CAAC;IAGlB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,MAAM,CAAC,EAAE,IAAI,CAAC;IAGd,SAAS,EAAG,IAAI,CAAC;IAGjB,UAAU,EAAG,IAAI,CAAC;CACnB;AAED,qBACa,kBAAkB;IAE7B,KAAK,EAAG,MAAM,CAAC;IAGf,KAAK,EAAG,MAAM,CAAC;IAGf,GAAG,EAAG,MAAM,CAAC;CACd;AAED,eAAO,MAAM,QAAQ,6FAAyE,CAAC"}
|
package/dist/entities.js
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ENTITIES = exports.SignalWaiterEntity = exports.StepCheckpointEntity = exports.WorkflowRunEntity = void 0;
|
|
13
|
+
const core_1 = require("@mikro-orm/core");
|
|
14
|
+
let WorkflowRunEntity = class WorkflowRunEntity {
|
|
15
|
+
id;
|
|
16
|
+
workflow;
|
|
17
|
+
workflowVersion;
|
|
18
|
+
status;
|
|
19
|
+
input;
|
|
20
|
+
output;
|
|
21
|
+
error;
|
|
22
|
+
wakeAt;
|
|
23
|
+
lockedBy;
|
|
24
|
+
lockedUntil;
|
|
25
|
+
createdAt;
|
|
26
|
+
updatedAt;
|
|
27
|
+
};
|
|
28
|
+
exports.WorkflowRunEntity = WorkflowRunEntity;
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, core_1.PrimaryKey)(),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], WorkflowRunEntity.prototype, "id", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, core_1.Property)(),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], WorkflowRunEntity.prototype, "workflow", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, core_1.Property)(),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], WorkflowRunEntity.prototype, "workflowVersion", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, core_1.Property)(),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], WorkflowRunEntity.prototype, "status", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, core_1.Property)({ type: 'json', nullable: true }),
|
|
47
|
+
__metadata("design:type", Object)
|
|
48
|
+
], WorkflowRunEntity.prototype, "input", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, core_1.Property)({ type: 'json', nullable: true }),
|
|
51
|
+
__metadata("design:type", Object)
|
|
52
|
+
], WorkflowRunEntity.prototype, "output", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, core_1.Property)({ type: 'json', nullable: true }),
|
|
55
|
+
__metadata("design:type", Object)
|
|
56
|
+
], WorkflowRunEntity.prototype, "error", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, core_1.Property)({ nullable: true }),
|
|
59
|
+
__metadata("design:type", Date)
|
|
60
|
+
], WorkflowRunEntity.prototype, "wakeAt", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, core_1.Property)({ nullable: true }),
|
|
63
|
+
__metadata("design:type", String)
|
|
64
|
+
], WorkflowRunEntity.prototype, "lockedBy", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, core_1.Property)({ nullable: true }),
|
|
67
|
+
__metadata("design:type", Date)
|
|
68
|
+
], WorkflowRunEntity.prototype, "lockedUntil", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, core_1.Property)(),
|
|
71
|
+
__metadata("design:type", Date)
|
|
72
|
+
], WorkflowRunEntity.prototype, "createdAt", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, core_1.Property)(),
|
|
75
|
+
__metadata("design:type", Date)
|
|
76
|
+
], WorkflowRunEntity.prototype, "updatedAt", void 0);
|
|
77
|
+
exports.WorkflowRunEntity = WorkflowRunEntity = __decorate([
|
|
78
|
+
(0, core_1.Entity)({ tableName: 'durable_workflow_runs' })
|
|
79
|
+
], WorkflowRunEntity);
|
|
80
|
+
let StepCheckpointEntity = class StepCheckpointEntity {
|
|
81
|
+
runId;
|
|
82
|
+
seq;
|
|
83
|
+
name;
|
|
84
|
+
kind;
|
|
85
|
+
stepId;
|
|
86
|
+
status;
|
|
87
|
+
output;
|
|
88
|
+
error;
|
|
89
|
+
attempts;
|
|
90
|
+
workerGroup;
|
|
91
|
+
wakeAt;
|
|
92
|
+
startedAt;
|
|
93
|
+
finishedAt;
|
|
94
|
+
};
|
|
95
|
+
exports.StepCheckpointEntity = StepCheckpointEntity;
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, core_1.PrimaryKey)(),
|
|
98
|
+
__metadata("design:type", String)
|
|
99
|
+
], StepCheckpointEntity.prototype, "runId", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
(0, core_1.PrimaryKey)(),
|
|
102
|
+
__metadata("design:type", Number)
|
|
103
|
+
], StepCheckpointEntity.prototype, "seq", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
(0, core_1.Property)(),
|
|
106
|
+
__metadata("design:type", String)
|
|
107
|
+
], StepCheckpointEntity.prototype, "name", void 0);
|
|
108
|
+
__decorate([
|
|
109
|
+
(0, core_1.Property)(),
|
|
110
|
+
__metadata("design:type", String)
|
|
111
|
+
], StepCheckpointEntity.prototype, "kind", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
(0, core_1.Property)(),
|
|
114
|
+
__metadata("design:type", String)
|
|
115
|
+
], StepCheckpointEntity.prototype, "stepId", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, core_1.Property)(),
|
|
118
|
+
__metadata("design:type", String)
|
|
119
|
+
], StepCheckpointEntity.prototype, "status", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
(0, core_1.Property)({ type: 'json', nullable: true }),
|
|
122
|
+
__metadata("design:type", Object)
|
|
123
|
+
], StepCheckpointEntity.prototype, "output", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
(0, core_1.Property)({ type: 'json', nullable: true }),
|
|
126
|
+
__metadata("design:type", Object)
|
|
127
|
+
], StepCheckpointEntity.prototype, "error", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
(0, core_1.Property)(),
|
|
130
|
+
__metadata("design:type", Number)
|
|
131
|
+
], StepCheckpointEntity.prototype, "attempts", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
(0, core_1.Property)({ nullable: true }),
|
|
134
|
+
__metadata("design:type", String)
|
|
135
|
+
], StepCheckpointEntity.prototype, "workerGroup", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
(0, core_1.Property)({ nullable: true }),
|
|
138
|
+
__metadata("design:type", Date)
|
|
139
|
+
], StepCheckpointEntity.prototype, "wakeAt", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
(0, core_1.Property)(),
|
|
142
|
+
__metadata("design:type", Date)
|
|
143
|
+
], StepCheckpointEntity.prototype, "startedAt", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
(0, core_1.Property)(),
|
|
146
|
+
__metadata("design:type", Date)
|
|
147
|
+
], StepCheckpointEntity.prototype, "finishedAt", void 0);
|
|
148
|
+
exports.StepCheckpointEntity = StepCheckpointEntity = __decorate([
|
|
149
|
+
(0, core_1.Entity)({ tableName: 'durable_step_checkpoints' })
|
|
150
|
+
], StepCheckpointEntity);
|
|
151
|
+
let SignalWaiterEntity = class SignalWaiterEntity {
|
|
152
|
+
token;
|
|
153
|
+
runId;
|
|
154
|
+
seq;
|
|
155
|
+
};
|
|
156
|
+
exports.SignalWaiterEntity = SignalWaiterEntity;
|
|
157
|
+
__decorate([
|
|
158
|
+
(0, core_1.PrimaryKey)(),
|
|
159
|
+
__metadata("design:type", String)
|
|
160
|
+
], SignalWaiterEntity.prototype, "token", void 0);
|
|
161
|
+
__decorate([
|
|
162
|
+
(0, core_1.Property)(),
|
|
163
|
+
__metadata("design:type", String)
|
|
164
|
+
], SignalWaiterEntity.prototype, "runId", void 0);
|
|
165
|
+
__decorate([
|
|
166
|
+
(0, core_1.Property)(),
|
|
167
|
+
__metadata("design:type", Number)
|
|
168
|
+
], SignalWaiterEntity.prototype, "seq", void 0);
|
|
169
|
+
exports.SignalWaiterEntity = SignalWaiterEntity = __decorate([
|
|
170
|
+
(0, core_1.Entity)({ tableName: 'durable_signal_waiters' })
|
|
171
|
+
], SignalWaiterEntity);
|
|
172
|
+
exports.ENTITIES = [WorkflowRunEntity, StepCheckpointEntity, SignalWaiterEntity];
|
|
173
|
+
//# sourceMappingURL=entities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../src/entities.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,0CAA+D;AAGxD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAE5B,EAAE,CAAU;IAGZ,QAAQ,CAAU;IAGlB,eAAe,CAAU;IAGzB,MAAM,CAAa;IAGnB,KAAK,CAAW;IAGhB,MAAM,CAAW;IAGjB,KAAK,CAAW;IAGhB,MAAM,CAAQ;IAGd,QAAQ,CAAU;IAGlB,WAAW,CAAQ;IAGnB,SAAS,CAAQ;IAGjB,SAAS,CAAQ;CAClB,CAAA;AApCY,8CAAiB;AAE5B;IADC,IAAA,iBAAU,GAAE;;6CACD;AAGZ;IADC,IAAA,eAAQ,GAAE;;mDAC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|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./entities"), exports);
|
|
18
|
+
__exportStar(require("./mikro-orm-state-store"), exports);
|
|
19
|
+
__exportStar(require("./schema"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,0DAAwC;AACxC,2CAAyB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { RunQuery, SignalWaiter, StateStore, StepCheckpoint, WorkflowRun } from '@dudousxd/nestjs-durable-core';
|
|
2
|
+
import type { MikroORM } from '@mikro-orm/core';
|
|
3
|
+
/**
|
|
4
|
+
* MikroORM-backed `StateStore`. Works on any MikroORM driver — Postgres, MySQL, SQLite (tested);
|
|
5
|
+
* timestamps and `wakeAt` use native datetime columns. Each operation runs on a forked
|
|
6
|
+
* EntityManager so it owns its unit of work.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MikroOrmStateStore implements StateStore {
|
|
9
|
+
private readonly orm;
|
|
10
|
+
constructor(orm: MikroORM);
|
|
11
|
+
ensureSchema(): Promise<void>;
|
|
12
|
+
createRun(run: WorkflowRun): Promise<void>;
|
|
13
|
+
updateRun(runId: string, patch: Partial<WorkflowRun>): Promise<void>;
|
|
14
|
+
getRun(runId: string): Promise<WorkflowRun | null>;
|
|
15
|
+
getCheckpoint(runId: string, seq: number): Promise<StepCheckpoint | null>;
|
|
16
|
+
saveCheckpoint(checkpoint: StepCheckpoint): Promise<void>;
|
|
17
|
+
listIncompleteRuns(): Promise<WorkflowRun[]>;
|
|
18
|
+
listDueTimers(nowMs: number): Promise<WorkflowRun[]>;
|
|
19
|
+
tryLockRun(runId: string, owner: string, leaseUntilMs: number, nowMs: number): Promise<boolean>;
|
|
20
|
+
releaseRunLock(runId: string): Promise<void>;
|
|
21
|
+
listRuns(query: RunQuery): Promise<WorkflowRun[]>;
|
|
22
|
+
listCheckpoints(runId: string): Promise<StepCheckpoint[]>;
|
|
23
|
+
putSignalWaiter(waiter: SignalWaiter): Promise<void>;
|
|
24
|
+
takeSignalWaiter(token: string): Promise<SignalWaiter | null>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=mikro-orm-state-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mikro-orm-state-store.d.ts","sourceRoot":"","sources":["../src/mikro-orm-state-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,cAAc,EAEd,WAAW,EACZ,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,QA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CAAC;CAQpE"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MikroOrmStateStore = void 0;
|
|
4
|
+
const entities_1 = require("./entities");
|
|
5
|
+
const schema_1 = require("./schema");
|
|
6
|
+
/**
|
|
7
|
+
* MikroORM-backed `StateStore`. Works on any MikroORM driver — Postgres, MySQL, SQLite (tested);
|
|
8
|
+
* timestamps and `wakeAt` use native datetime columns. Each operation runs on a forked
|
|
9
|
+
* EntityManager so it owns its unit of work.
|
|
10
|
+
*/
|
|
11
|
+
class MikroOrmStateStore {
|
|
12
|
+
orm;
|
|
13
|
+
constructor(orm) {
|
|
14
|
+
this.orm = orm;
|
|
15
|
+
}
|
|
16
|
+
async ensureSchema() {
|
|
17
|
+
await (0, schema_1.ensureMikroOrmDurableSchema)(this.orm);
|
|
18
|
+
}
|
|
19
|
+
async createRun(run) {
|
|
20
|
+
const em = this.orm.em.fork();
|
|
21
|
+
em.create(entities_1.WorkflowRunEntity, toRunEntity(run));
|
|
22
|
+
await em.flush();
|
|
23
|
+
}
|
|
24
|
+
async updateRun(runId, patch) {
|
|
25
|
+
const em = this.orm.em.fork();
|
|
26
|
+
const entity = await em.findOneOrFail(entities_1.WorkflowRunEntity, { id: runId });
|
|
27
|
+
Object.assign(entity, toRunEntity({ ...fromRunEntity(entity), ...patch }));
|
|
28
|
+
await em.flush();
|
|
29
|
+
}
|
|
30
|
+
async getRun(runId) {
|
|
31
|
+
const em = this.orm.em.fork();
|
|
32
|
+
const entity = await em.findOne(entities_1.WorkflowRunEntity, { id: runId });
|
|
33
|
+
return entity ? fromRunEntity(entity) : null;
|
|
34
|
+
}
|
|
35
|
+
async getCheckpoint(runId, seq) {
|
|
36
|
+
const em = this.orm.em.fork();
|
|
37
|
+
const entity = await em.findOne(entities_1.StepCheckpointEntity, { runId, seq });
|
|
38
|
+
return entity ? fromCheckpointEntity(entity) : null;
|
|
39
|
+
}
|
|
40
|
+
async saveCheckpoint(checkpoint) {
|
|
41
|
+
const em = this.orm.em.fork();
|
|
42
|
+
await em.upsert(entities_1.StepCheckpointEntity, toCheckpointEntity(checkpoint));
|
|
43
|
+
await em.flush();
|
|
44
|
+
}
|
|
45
|
+
async listIncompleteRuns() {
|
|
46
|
+
const em = this.orm.em.fork();
|
|
47
|
+
const rows = await em.find(entities_1.WorkflowRunEntity, { status: 'running' });
|
|
48
|
+
return rows.map(fromRunEntity);
|
|
49
|
+
}
|
|
50
|
+
async listDueTimers(nowMs) {
|
|
51
|
+
const em = this.orm.em.fork();
|
|
52
|
+
const rows = await em.find(entities_1.WorkflowRunEntity, {
|
|
53
|
+
status: 'suspended',
|
|
54
|
+
wakeAt: { $ne: null, $lte: new Date(nowMs) },
|
|
55
|
+
});
|
|
56
|
+
return rows.map(fromRunEntity);
|
|
57
|
+
}
|
|
58
|
+
async tryLockRun(runId, owner, leaseUntilMs, nowMs) {
|
|
59
|
+
const em = this.orm.em.fork();
|
|
60
|
+
const affected = await em.nativeUpdate(entities_1.WorkflowRunEntity, { id: runId, $or: [{ lockedUntil: null }, { lockedUntil: { $lte: new Date(nowMs) } }] }, { lockedBy: owner, lockedUntil: new Date(leaseUntilMs) });
|
|
61
|
+
return affected === 1;
|
|
62
|
+
}
|
|
63
|
+
async releaseRunLock(runId) {
|
|
64
|
+
const em = this.orm.em.fork();
|
|
65
|
+
await em.nativeUpdate(entities_1.WorkflowRunEntity, { id: runId }, { lockedBy: null, lockedUntil: null });
|
|
66
|
+
}
|
|
67
|
+
async listRuns(query) {
|
|
68
|
+
const em = this.orm.em.fork();
|
|
69
|
+
const where = {};
|
|
70
|
+
if (query.workflow)
|
|
71
|
+
where.workflow = query.workflow;
|
|
72
|
+
if (query.status)
|
|
73
|
+
where.status = query.status;
|
|
74
|
+
const rows = await em.find(entities_1.WorkflowRunEntity, where, {
|
|
75
|
+
limit: query.limit,
|
|
76
|
+
offset: query.offset,
|
|
77
|
+
orderBy: { createdAt: 'asc' },
|
|
78
|
+
});
|
|
79
|
+
return rows.map(fromRunEntity);
|
|
80
|
+
}
|
|
81
|
+
async listCheckpoints(runId) {
|
|
82
|
+
const em = this.orm.em.fork();
|
|
83
|
+
const rows = await em.find(entities_1.StepCheckpointEntity, { runId }, { orderBy: { seq: 'asc' } });
|
|
84
|
+
return rows.map(fromCheckpointEntity);
|
|
85
|
+
}
|
|
86
|
+
async putSignalWaiter(waiter) {
|
|
87
|
+
const em = this.orm.em.fork();
|
|
88
|
+
await em.upsert(entities_1.SignalWaiterEntity, { ...waiter });
|
|
89
|
+
await em.flush();
|
|
90
|
+
}
|
|
91
|
+
async takeSignalWaiter(token) {
|
|
92
|
+
const em = this.orm.em.fork();
|
|
93
|
+
const entity = await em.findOne(entities_1.SignalWaiterEntity, { token });
|
|
94
|
+
if (!entity)
|
|
95
|
+
return null;
|
|
96
|
+
const waiter = { token: entity.token, runId: entity.runId, seq: entity.seq };
|
|
97
|
+
await em.removeAndFlush(entity);
|
|
98
|
+
return waiter;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.MikroOrmStateStore = MikroOrmStateStore;
|
|
102
|
+
function toRunEntity(run) {
|
|
103
|
+
const e = new entities_1.WorkflowRunEntity();
|
|
104
|
+
e.id = run.id;
|
|
105
|
+
e.workflow = run.workflow;
|
|
106
|
+
e.workflowVersion = run.workflowVersion;
|
|
107
|
+
e.status = run.status;
|
|
108
|
+
e.input = run.input ?? null;
|
|
109
|
+
e.output = run.output ?? null;
|
|
110
|
+
e.error = run.error ?? null;
|
|
111
|
+
e.wakeAt = run.wakeAt == null ? undefined : new Date(run.wakeAt);
|
|
112
|
+
e.lockedBy = run.lockedBy;
|
|
113
|
+
e.lockedUntil = run.lockedUntil == null ? undefined : new Date(run.lockedUntil);
|
|
114
|
+
e.createdAt = run.createdAt;
|
|
115
|
+
e.updatedAt = run.updatedAt;
|
|
116
|
+
return e;
|
|
117
|
+
}
|
|
118
|
+
function fromRunEntity(e) {
|
|
119
|
+
return {
|
|
120
|
+
id: e.id,
|
|
121
|
+
workflow: e.workflow,
|
|
122
|
+
workflowVersion: e.workflowVersion,
|
|
123
|
+
status: e.status,
|
|
124
|
+
input: e.input ?? undefined,
|
|
125
|
+
output: e.output ?? undefined,
|
|
126
|
+
error: (e.error ?? undefined),
|
|
127
|
+
wakeAt: e.wakeAt?.getTime(),
|
|
128
|
+
lockedBy: e.lockedBy ?? undefined,
|
|
129
|
+
lockedUntil: e.lockedUntil?.getTime(),
|
|
130
|
+
createdAt: e.createdAt,
|
|
131
|
+
updatedAt: e.updatedAt,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function toCheckpointEntity(cp) {
|
|
135
|
+
const e = new entities_1.StepCheckpointEntity();
|
|
136
|
+
e.runId = cp.runId;
|
|
137
|
+
e.seq = cp.seq;
|
|
138
|
+
e.name = cp.name;
|
|
139
|
+
e.kind = cp.kind;
|
|
140
|
+
e.stepId = cp.stepId;
|
|
141
|
+
e.status = cp.status;
|
|
142
|
+
e.output = cp.output ?? null;
|
|
143
|
+
e.error = cp.error ?? null;
|
|
144
|
+
e.attempts = cp.attempts;
|
|
145
|
+
e.workerGroup = cp.workerGroup;
|
|
146
|
+
e.wakeAt = cp.wakeAt == null ? undefined : new Date(cp.wakeAt);
|
|
147
|
+
e.startedAt = cp.startedAt;
|
|
148
|
+
e.finishedAt = cp.finishedAt;
|
|
149
|
+
return e;
|
|
150
|
+
}
|
|
151
|
+
function fromCheckpointEntity(e) {
|
|
152
|
+
return {
|
|
153
|
+
runId: e.runId,
|
|
154
|
+
seq: e.seq,
|
|
155
|
+
name: e.name,
|
|
156
|
+
kind: e.kind,
|
|
157
|
+
stepId: e.stepId,
|
|
158
|
+
status: e.status,
|
|
159
|
+
output: e.output ?? undefined,
|
|
160
|
+
error: (e.error ?? undefined),
|
|
161
|
+
attempts: e.attempts,
|
|
162
|
+
workerGroup: e.workerGroup ?? undefined,
|
|
163
|
+
wakeAt: e.wakeAt?.getTime(),
|
|
164
|
+
startedAt: e.startedAt,
|
|
165
|
+
finishedAt: e.finishedAt,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=mikro-orm-state-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mikro-orm-state-store.js","sourceRoot":"","sources":["../src/mikro-orm-state-store.ts"],"names":[],"mappings":";;;AASA,yCAAyF;AACzF,qCAAuD;AAEvD;;;;GAIG;AACH,MAAa,kBAAkB;IACA;IAA7B,YAA6B,GAAa;QAAb,QAAG,GAAH,GAAG,CAAU;IAAG,CAAC;IAE9C,KAAK,CAAC,YAAY;QAChB,MAAM,IAAA,oCAA2B,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,GAAgB;QAC9B,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;QAC9B,EAAE,CAAC,MAAM,CAAC,4BAAiB,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/C,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,KAAa,EAAE,KAA2B;QACxD,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,4BAAiB,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACxE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,EAAiB,CAAC,CAAC,CAAC;QAC1F,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAa;QACxB,MAAM,EAAE,GAAG,IAA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ables (additive, never drops). Safe to run on every
|
|
4
|
+
* boot (auto-schema) and the function to call from a MikroORM migration when you disable
|
|
5
|
+
* auto-schema:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* export class AddDurableTables extends Migration {
|
|
9
|
+
* async up() { await ensureMikroOrmDurableSchema(this.getEntityManager().getOrm()); }
|
|
10
|
+
* }
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare function ensureMikroOrmDurableSchema(orm: MikroORM): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;;;;GAUG;AACH,wBAAsB,2BAA2B,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9E"}
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ensureMikroOrmDurableSchema = ensureMikroOrmDurableSchema;
|
|
4
|
+
/**
|
|
5
|
+
* Idempotently create/extend the durable tables (additive, never drops). Safe to run on every
|
|
6
|
+
* boot (auto-schema) and the function to call from a MikroORM migration when you disable
|
|
7
|
+
* auto-schema:
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* export class AddDurableTables extends Migration {
|
|
11
|
+
* async up() { await ensureMikroOrmDurableSchema(this.getEntityManager().getOrm()); }
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
async function ensureMikroOrmDurableSchema(orm) {
|
|
16
|
+
await orm.schema.updateSchema({ safe: true });
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":";;AAaA,kEAEC;AAbD;;;;;;;;;;GAUG;AACI,KAAK,UAAU,2BAA2B,CAAC,GAAa;IAC7D,MAAM,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAChD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dudousxd/nestjs-durable-store-mikro-orm",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MikroORM adapter for the nestjs-durable StateStore (reference ORM adapter)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Davide Carvalho",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/DavideCarvalho/nestjs-durable.git",
|
|
10
|
+
"directory": "packages/store-mikro-orm"
|
|
11
|
+
},
|
|
12
|
+
"type": "commonjs",
|
|
13
|
+
"main": "dist/index.js",
|
|
14
|
+
"types": "dist/index.d.ts",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"@dudousxd/nestjs-durable-core": ">=0.1.0 <1.0.0",
|
|
20
|
+
"@mikro-orm/core": "^6.0.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@mikro-orm/better-sqlite": "6.6.2",
|
|
24
|
+
"@mikro-orm/core": "6.6.2",
|
|
25
|
+
"reflect-metadata": "0.2.2",
|
|
26
|
+
"typescript": "5.9.3",
|
|
27
|
+
"@dudousxd/nestjs-durable-core": "^0.1.0"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc -p tsconfig.json",
|
|
31
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
32
|
+
}
|
|
33
|
+
}
|