@dudousxd/nestjs-durable-store-mikro-orm 0.9.1 → 0.11.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/index.cjs +252 -268
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -4
- package/dist/index.d.ts +30 -4
- package/dist/index.js +252 -269
- package/dist/index.js.map +1 -1
- package/package.json +11 -9
package/dist/index.cjs
CHANGED
|
@@ -28,23 +28,23 @@ __export(index_exports, {
|
|
|
28
28
|
SignalWaiterEntity: () => SignalWaiterEntity,
|
|
29
29
|
StepCheckpointEntity: () => StepCheckpointEntity,
|
|
30
30
|
WorkflowRunEntity: () => WorkflowRunEntity,
|
|
31
|
+
durableEntities: () => durableEntities,
|
|
31
32
|
ensureMikroOrmDurableSchema: () => ensureMikroOrmDurableSchema
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(index_exports);
|
|
34
35
|
|
|
35
36
|
// src/entities.ts
|
|
36
37
|
var import_core = require("@mikro-orm/core");
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
40
|
-
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;
|
|
41
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
38
|
+
function snakeCase(property) {
|
|
39
|
+
return property.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`);
|
|
42
40
|
}
|
|
43
|
-
__name(
|
|
44
|
-
function
|
|
45
|
-
if (
|
|
41
|
+
__name(snakeCase, "snakeCase");
|
|
42
|
+
function columnNamer(naming) {
|
|
43
|
+
if (naming === "snake_case") return snakeCase;
|
|
44
|
+
if (naming === "preserve") return (property) => property;
|
|
45
|
+
return naming;
|
|
46
46
|
}
|
|
47
|
-
__name(
|
|
47
|
+
__name(columnNamer, "columnNamer");
|
|
48
48
|
var WorkflowRunEntity = class {
|
|
49
49
|
static {
|
|
50
50
|
__name(this, "WorkflowRunEntity");
|
|
@@ -65,95 +65,6 @@ var WorkflowRunEntity = class {
|
|
|
65
65
|
createdAt;
|
|
66
66
|
updatedAt;
|
|
67
67
|
};
|
|
68
|
-
_ts_decorate([
|
|
69
|
-
(0, import_core.PrimaryKey)(),
|
|
70
|
-
_ts_metadata("design:type", String)
|
|
71
|
-
], WorkflowRunEntity.prototype, "id", void 0);
|
|
72
|
-
_ts_decorate([
|
|
73
|
-
(0, import_core.Property)(),
|
|
74
|
-
_ts_metadata("design:type", String)
|
|
75
|
-
], WorkflowRunEntity.prototype, "workflow", void 0);
|
|
76
|
-
_ts_decorate([
|
|
77
|
-
(0, import_core.Property)(),
|
|
78
|
-
_ts_metadata("design:type", String)
|
|
79
|
-
], WorkflowRunEntity.prototype, "workflowVersion", void 0);
|
|
80
|
-
_ts_decorate([
|
|
81
|
-
(0, import_core.Property)(),
|
|
82
|
-
_ts_metadata("design:type", typeof RunStatus === "undefined" ? Object : RunStatus)
|
|
83
|
-
], WorkflowRunEntity.prototype, "status", void 0);
|
|
84
|
-
_ts_decorate([
|
|
85
|
-
(0, import_core.Property)({
|
|
86
|
-
type: "json",
|
|
87
|
-
nullable: true
|
|
88
|
-
}),
|
|
89
|
-
_ts_metadata("design:type", Object)
|
|
90
|
-
], WorkflowRunEntity.prototype, "input", void 0);
|
|
91
|
-
_ts_decorate([
|
|
92
|
-
(0, import_core.Property)({
|
|
93
|
-
type: "json",
|
|
94
|
-
nullable: true
|
|
95
|
-
}),
|
|
96
|
-
_ts_metadata("design:type", Object)
|
|
97
|
-
], WorkflowRunEntity.prototype, "output", void 0);
|
|
98
|
-
_ts_decorate([
|
|
99
|
-
(0, import_core.Property)({
|
|
100
|
-
type: "json",
|
|
101
|
-
nullable: true
|
|
102
|
-
}),
|
|
103
|
-
_ts_metadata("design:type", Object)
|
|
104
|
-
], WorkflowRunEntity.prototype, "error", void 0);
|
|
105
|
-
_ts_decorate([
|
|
106
|
-
(0, import_core.Property)({
|
|
107
|
-
nullable: true
|
|
108
|
-
}),
|
|
109
|
-
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
110
|
-
], WorkflowRunEntity.prototype, "wakeAt", void 0);
|
|
111
|
-
_ts_decorate([
|
|
112
|
-
(0, import_core.Property)({
|
|
113
|
-
nullable: true
|
|
114
|
-
}),
|
|
115
|
-
_ts_metadata("design:type", String)
|
|
116
|
-
], WorkflowRunEntity.prototype, "lockedBy", void 0);
|
|
117
|
-
_ts_decorate([
|
|
118
|
-
(0, import_core.Property)({
|
|
119
|
-
nullable: true
|
|
120
|
-
}),
|
|
121
|
-
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
122
|
-
], WorkflowRunEntity.prototype, "lockedUntil", void 0);
|
|
123
|
-
_ts_decorate([
|
|
124
|
-
(0, import_core.Property)({
|
|
125
|
-
type: "integer",
|
|
126
|
-
nullable: true
|
|
127
|
-
}),
|
|
128
|
-
_ts_metadata("design:type", Number)
|
|
129
|
-
], WorkflowRunEntity.prototype, "recoveryAttempts", void 0);
|
|
130
|
-
_ts_decorate([
|
|
131
|
-
(0, import_core.Property)({
|
|
132
|
-
type: "json",
|
|
133
|
-
nullable: true
|
|
134
|
-
}),
|
|
135
|
-
_ts_metadata("design:type", Object)
|
|
136
|
-
], WorkflowRunEntity.prototype, "tags", void 0);
|
|
137
|
-
_ts_decorate([
|
|
138
|
-
(0, import_core.Property)({
|
|
139
|
-
type: "json",
|
|
140
|
-
nullable: true
|
|
141
|
-
}),
|
|
142
|
-
_ts_metadata("design:type", Object)
|
|
143
|
-
], WorkflowRunEntity.prototype, "searchAttributes", void 0);
|
|
144
|
-
_ts_decorate([
|
|
145
|
-
(0, import_core.Property)(),
|
|
146
|
-
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
147
|
-
], WorkflowRunEntity.prototype, "createdAt", void 0);
|
|
148
|
-
_ts_decorate([
|
|
149
|
-
(0, import_core.Property)(),
|
|
150
|
-
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
151
|
-
], WorkflowRunEntity.prototype, "updatedAt", void 0);
|
|
152
|
-
WorkflowRunEntity = _ts_decorate([
|
|
153
|
-
(0, import_core.Entity)({
|
|
154
|
-
tableName: "durable_workflow_runs"
|
|
155
|
-
})
|
|
156
|
-
], WorkflowRunEntity);
|
|
157
68
|
var StepCheckpointEntity = class {
|
|
158
69
|
static {
|
|
159
70
|
__name(this, "StepCheckpointEntity");
|
|
@@ -175,93 +86,6 @@ var StepCheckpointEntity = class {
|
|
|
175
86
|
startedAt;
|
|
176
87
|
finishedAt;
|
|
177
88
|
};
|
|
178
|
-
_ts_decorate([
|
|
179
|
-
(0, import_core.PrimaryKey)(),
|
|
180
|
-
_ts_metadata("design:type", String)
|
|
181
|
-
], StepCheckpointEntity.prototype, "runId", void 0);
|
|
182
|
-
_ts_decorate([
|
|
183
|
-
(0, import_core.PrimaryKey)(),
|
|
184
|
-
_ts_metadata("design:type", Number)
|
|
185
|
-
], StepCheckpointEntity.prototype, "seq", void 0);
|
|
186
|
-
_ts_decorate([
|
|
187
|
-
(0, import_core.Property)(),
|
|
188
|
-
_ts_metadata("design:type", String)
|
|
189
|
-
], StepCheckpointEntity.prototype, "name", void 0);
|
|
190
|
-
_ts_decorate([
|
|
191
|
-
(0, import_core.Property)(),
|
|
192
|
-
_ts_metadata("design:type", typeof StepKind === "undefined" ? Object : StepKind)
|
|
193
|
-
], StepCheckpointEntity.prototype, "kind", void 0);
|
|
194
|
-
_ts_decorate([
|
|
195
|
-
(0, import_core.Property)(),
|
|
196
|
-
_ts_metadata("design:type", String)
|
|
197
|
-
], StepCheckpointEntity.prototype, "stepId", void 0);
|
|
198
|
-
_ts_decorate([
|
|
199
|
-
(0, import_core.Property)(),
|
|
200
|
-
_ts_metadata("design:type", String)
|
|
201
|
-
], StepCheckpointEntity.prototype, "status", void 0);
|
|
202
|
-
_ts_decorate([
|
|
203
|
-
(0, import_core.Property)({
|
|
204
|
-
type: "json",
|
|
205
|
-
nullable: true
|
|
206
|
-
}),
|
|
207
|
-
_ts_metadata("design:type", Object)
|
|
208
|
-
], StepCheckpointEntity.prototype, "input", void 0);
|
|
209
|
-
_ts_decorate([
|
|
210
|
-
(0, import_core.Property)({
|
|
211
|
-
type: "json",
|
|
212
|
-
nullable: true
|
|
213
|
-
}),
|
|
214
|
-
_ts_metadata("design:type", Object)
|
|
215
|
-
], StepCheckpointEntity.prototype, "output", void 0);
|
|
216
|
-
_ts_decorate([
|
|
217
|
-
(0, import_core.Property)({
|
|
218
|
-
type: "json",
|
|
219
|
-
nullable: true
|
|
220
|
-
}),
|
|
221
|
-
_ts_metadata("design:type", Object)
|
|
222
|
-
], StepCheckpointEntity.prototype, "error", void 0);
|
|
223
|
-
_ts_decorate([
|
|
224
|
-
(0, import_core.Property)({
|
|
225
|
-
type: "json",
|
|
226
|
-
nullable: true
|
|
227
|
-
}),
|
|
228
|
-
_ts_metadata("design:type", Object)
|
|
229
|
-
], StepCheckpointEntity.prototype, "events", void 0);
|
|
230
|
-
_ts_decorate([
|
|
231
|
-
(0, import_core.Property)(),
|
|
232
|
-
_ts_metadata("design:type", Number)
|
|
233
|
-
], StepCheckpointEntity.prototype, "attempts", void 0);
|
|
234
|
-
_ts_decorate([
|
|
235
|
-
(0, import_core.Property)({
|
|
236
|
-
nullable: true
|
|
237
|
-
}),
|
|
238
|
-
_ts_metadata("design:type", String)
|
|
239
|
-
], StepCheckpointEntity.prototype, "workerGroup", void 0);
|
|
240
|
-
_ts_decorate([
|
|
241
|
-
(0, import_core.Property)({
|
|
242
|
-
nullable: true
|
|
243
|
-
}),
|
|
244
|
-
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
245
|
-
], StepCheckpointEntity.prototype, "wakeAt", void 0);
|
|
246
|
-
_ts_decorate([
|
|
247
|
-
(0, import_core.Property)({
|
|
248
|
-
nullable: true
|
|
249
|
-
}),
|
|
250
|
-
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
251
|
-
], StepCheckpointEntity.prototype, "enqueuedAt", void 0);
|
|
252
|
-
_ts_decorate([
|
|
253
|
-
(0, import_core.Property)(),
|
|
254
|
-
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
255
|
-
], StepCheckpointEntity.prototype, "startedAt", void 0);
|
|
256
|
-
_ts_decorate([
|
|
257
|
-
(0, import_core.Property)(),
|
|
258
|
-
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
259
|
-
], StepCheckpointEntity.prototype, "finishedAt", void 0);
|
|
260
|
-
StepCheckpointEntity = _ts_decorate([
|
|
261
|
-
(0, import_core.Entity)({
|
|
262
|
-
tableName: "durable_step_checkpoints"
|
|
263
|
-
})
|
|
264
|
-
], StepCheckpointEntity);
|
|
265
89
|
var RunAttributeEntity = class {
|
|
266
90
|
static {
|
|
267
91
|
__name(this, "RunAttributeEntity");
|
|
@@ -269,36 +93,8 @@ var RunAttributeEntity = class {
|
|
|
269
93
|
runId;
|
|
270
94
|
key;
|
|
271
95
|
strValue;
|
|
272
|
-
// `float`/`double` is portable across SQLite/MySQL/Postgres for numeric range scans.
|
|
273
96
|
numValue;
|
|
274
97
|
};
|
|
275
|
-
_ts_decorate([
|
|
276
|
-
(0, import_core.PrimaryKey)(),
|
|
277
|
-
_ts_metadata("design:type", String)
|
|
278
|
-
], RunAttributeEntity.prototype, "runId", void 0);
|
|
279
|
-
_ts_decorate([
|
|
280
|
-
(0, import_core.PrimaryKey)(),
|
|
281
|
-
_ts_metadata("design:type", String)
|
|
282
|
-
], RunAttributeEntity.prototype, "key", void 0);
|
|
283
|
-
_ts_decorate([
|
|
284
|
-
(0, import_core.Property)({
|
|
285
|
-
type: "string",
|
|
286
|
-
nullable: true
|
|
287
|
-
}),
|
|
288
|
-
_ts_metadata("design:type", Object)
|
|
289
|
-
], RunAttributeEntity.prototype, "strValue", void 0);
|
|
290
|
-
_ts_decorate([
|
|
291
|
-
(0, import_core.Property)({
|
|
292
|
-
type: "float",
|
|
293
|
-
nullable: true
|
|
294
|
-
}),
|
|
295
|
-
_ts_metadata("design:type", Object)
|
|
296
|
-
], RunAttributeEntity.prototype, "numValue", void 0);
|
|
297
|
-
RunAttributeEntity = _ts_decorate([
|
|
298
|
-
(0, import_core.Entity)({
|
|
299
|
-
tableName: "durable_run_attributes"
|
|
300
|
-
})
|
|
301
|
-
], RunAttributeEntity);
|
|
302
98
|
var SignalWaiterEntity = class {
|
|
303
99
|
static {
|
|
304
100
|
__name(this, "SignalWaiterEntity");
|
|
@@ -307,23 +103,6 @@ var SignalWaiterEntity = class {
|
|
|
307
103
|
runId;
|
|
308
104
|
seq;
|
|
309
105
|
};
|
|
310
|
-
_ts_decorate([
|
|
311
|
-
(0, import_core.PrimaryKey)(),
|
|
312
|
-
_ts_metadata("design:type", String)
|
|
313
|
-
], SignalWaiterEntity.prototype, "token", void 0);
|
|
314
|
-
_ts_decorate([
|
|
315
|
-
(0, import_core.Property)(),
|
|
316
|
-
_ts_metadata("design:type", String)
|
|
317
|
-
], SignalWaiterEntity.prototype, "runId", void 0);
|
|
318
|
-
_ts_decorate([
|
|
319
|
-
(0, import_core.Property)(),
|
|
320
|
-
_ts_metadata("design:type", Number)
|
|
321
|
-
], SignalWaiterEntity.prototype, "seq", void 0);
|
|
322
|
-
SignalWaiterEntity = _ts_decorate([
|
|
323
|
-
(0, import_core.Entity)({
|
|
324
|
-
tableName: "durable_signal_waiters"
|
|
325
|
-
})
|
|
326
|
-
], SignalWaiterEntity);
|
|
327
106
|
var BufferedSignalEntity = class {
|
|
328
107
|
static {
|
|
329
108
|
__name(this, "BufferedSignalEntity");
|
|
@@ -332,44 +111,248 @@ var BufferedSignalEntity = class {
|
|
|
332
111
|
token;
|
|
333
112
|
payload;
|
|
334
113
|
};
|
|
335
|
-
|
|
336
|
-
(
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
114
|
+
function durableEntities(options = {}) {
|
|
115
|
+
const col = columnNamer(options.naming ?? "snake_case");
|
|
116
|
+
const workflowRuns = new import_core.EntitySchema({
|
|
117
|
+
class: WorkflowRunEntity,
|
|
118
|
+
tableName: "durable_workflow_runs",
|
|
119
|
+
properties: {
|
|
120
|
+
id: {
|
|
121
|
+
type: "string",
|
|
122
|
+
primary: true,
|
|
123
|
+
fieldName: col("id")
|
|
124
|
+
},
|
|
125
|
+
workflow: {
|
|
126
|
+
type: "string",
|
|
127
|
+
fieldName: col("workflow")
|
|
128
|
+
},
|
|
129
|
+
workflowVersion: {
|
|
130
|
+
type: "string",
|
|
131
|
+
fieldName: col("workflowVersion")
|
|
132
|
+
},
|
|
133
|
+
status: {
|
|
134
|
+
type: "string",
|
|
135
|
+
fieldName: col("status")
|
|
136
|
+
},
|
|
137
|
+
input: {
|
|
138
|
+
type: "json",
|
|
139
|
+
nullable: true,
|
|
140
|
+
fieldName: col("input")
|
|
141
|
+
},
|
|
142
|
+
output: {
|
|
143
|
+
type: "json",
|
|
144
|
+
nullable: true,
|
|
145
|
+
fieldName: col("output")
|
|
146
|
+
},
|
|
147
|
+
error: {
|
|
148
|
+
type: "json",
|
|
149
|
+
nullable: true,
|
|
150
|
+
fieldName: col("error")
|
|
151
|
+
},
|
|
152
|
+
wakeAt: {
|
|
153
|
+
type: "Date",
|
|
154
|
+
nullable: true,
|
|
155
|
+
fieldName: col("wakeAt")
|
|
156
|
+
},
|
|
157
|
+
lockedBy: {
|
|
158
|
+
type: "string",
|
|
159
|
+
nullable: true,
|
|
160
|
+
fieldName: col("lockedBy")
|
|
161
|
+
},
|
|
162
|
+
lockedUntil: {
|
|
163
|
+
type: "Date",
|
|
164
|
+
nullable: true,
|
|
165
|
+
fieldName: col("lockedUntil")
|
|
166
|
+
},
|
|
167
|
+
recoveryAttempts: {
|
|
168
|
+
type: "integer",
|
|
169
|
+
nullable: true,
|
|
170
|
+
fieldName: col("recoveryAttempts")
|
|
171
|
+
},
|
|
172
|
+
tags: {
|
|
173
|
+
type: "json",
|
|
174
|
+
nullable: true,
|
|
175
|
+
fieldName: col("tags")
|
|
176
|
+
},
|
|
177
|
+
searchAttributes: {
|
|
178
|
+
type: "json",
|
|
179
|
+
nullable: true,
|
|
180
|
+
fieldName: col("searchAttributes")
|
|
181
|
+
},
|
|
182
|
+
createdAt: {
|
|
183
|
+
type: "Date",
|
|
184
|
+
fieldName: col("createdAt")
|
|
185
|
+
},
|
|
186
|
+
updatedAt: {
|
|
187
|
+
type: "Date",
|
|
188
|
+
fieldName: col("updatedAt")
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
const stepCheckpoints = new import_core.EntitySchema({
|
|
193
|
+
class: StepCheckpointEntity,
|
|
194
|
+
tableName: "durable_step_checkpoints",
|
|
195
|
+
properties: {
|
|
196
|
+
runId: {
|
|
197
|
+
type: "string",
|
|
198
|
+
primary: true,
|
|
199
|
+
fieldName: col("runId")
|
|
200
|
+
},
|
|
201
|
+
seq: {
|
|
202
|
+
type: "integer",
|
|
203
|
+
primary: true,
|
|
204
|
+
fieldName: col("seq")
|
|
205
|
+
},
|
|
206
|
+
name: {
|
|
207
|
+
type: "string",
|
|
208
|
+
fieldName: col("name")
|
|
209
|
+
},
|
|
210
|
+
kind: {
|
|
211
|
+
type: "string",
|
|
212
|
+
fieldName: col("kind")
|
|
213
|
+
},
|
|
214
|
+
stepId: {
|
|
215
|
+
type: "string",
|
|
216
|
+
fieldName: col("stepId")
|
|
217
|
+
},
|
|
218
|
+
status: {
|
|
219
|
+
type: "string",
|
|
220
|
+
fieldName: col("status")
|
|
221
|
+
},
|
|
222
|
+
input: {
|
|
223
|
+
type: "json",
|
|
224
|
+
nullable: true,
|
|
225
|
+
fieldName: col("input")
|
|
226
|
+
},
|
|
227
|
+
output: {
|
|
228
|
+
type: "json",
|
|
229
|
+
nullable: true,
|
|
230
|
+
fieldName: col("output")
|
|
231
|
+
},
|
|
232
|
+
error: {
|
|
233
|
+
type: "json",
|
|
234
|
+
nullable: true,
|
|
235
|
+
fieldName: col("error")
|
|
236
|
+
},
|
|
237
|
+
events: {
|
|
238
|
+
type: "json",
|
|
239
|
+
nullable: true,
|
|
240
|
+
fieldName: col("events")
|
|
241
|
+
},
|
|
242
|
+
attempts: {
|
|
243
|
+
type: "integer",
|
|
244
|
+
fieldName: col("attempts")
|
|
245
|
+
},
|
|
246
|
+
workerGroup: {
|
|
247
|
+
type: "string",
|
|
248
|
+
nullable: true,
|
|
249
|
+
fieldName: col("workerGroup")
|
|
250
|
+
},
|
|
251
|
+
wakeAt: {
|
|
252
|
+
type: "Date",
|
|
253
|
+
nullable: true,
|
|
254
|
+
fieldName: col("wakeAt")
|
|
255
|
+
},
|
|
256
|
+
enqueuedAt: {
|
|
257
|
+
type: "Date",
|
|
258
|
+
nullable: true,
|
|
259
|
+
fieldName: col("enqueuedAt")
|
|
260
|
+
},
|
|
261
|
+
startedAt: {
|
|
262
|
+
type: "Date",
|
|
263
|
+
fieldName: col("startedAt")
|
|
264
|
+
},
|
|
265
|
+
finishedAt: {
|
|
266
|
+
type: "Date",
|
|
267
|
+
fieldName: col("finishedAt")
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
const runAttributes = new import_core.EntitySchema({
|
|
272
|
+
class: RunAttributeEntity,
|
|
273
|
+
tableName: "durable_run_attributes",
|
|
274
|
+
properties: {
|
|
275
|
+
runId: {
|
|
276
|
+
type: "string",
|
|
277
|
+
primary: true,
|
|
278
|
+
fieldName: col("runId")
|
|
279
|
+
},
|
|
280
|
+
key: {
|
|
281
|
+
type: "string",
|
|
282
|
+
primary: true,
|
|
283
|
+
fieldName: col("key")
|
|
284
|
+
},
|
|
285
|
+
strValue: {
|
|
286
|
+
type: "string",
|
|
287
|
+
nullable: true,
|
|
288
|
+
fieldName: col("strValue")
|
|
289
|
+
},
|
|
290
|
+
// `float`/`double` is portable across SQLite/MySQL/Postgres for numeric range scans.
|
|
291
|
+
numValue: {
|
|
292
|
+
type: "float",
|
|
293
|
+
nullable: true,
|
|
294
|
+
fieldName: col("numValue")
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
const signalWaiters = new import_core.EntitySchema({
|
|
299
|
+
class: SignalWaiterEntity,
|
|
300
|
+
tableName: "durable_signal_waiters",
|
|
301
|
+
properties: {
|
|
302
|
+
token: {
|
|
303
|
+
type: "string",
|
|
304
|
+
primary: true,
|
|
305
|
+
fieldName: col("token")
|
|
306
|
+
},
|
|
307
|
+
runId: {
|
|
308
|
+
type: "string",
|
|
309
|
+
fieldName: col("runId")
|
|
310
|
+
},
|
|
311
|
+
seq: {
|
|
312
|
+
type: "integer",
|
|
313
|
+
fieldName: col("seq")
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
const bufferedSignals = new import_core.EntitySchema({
|
|
318
|
+
class: BufferedSignalEntity,
|
|
319
|
+
tableName: "durable_buffered_signals",
|
|
320
|
+
properties: {
|
|
321
|
+
id: {
|
|
322
|
+
type: "integer",
|
|
323
|
+
primary: true,
|
|
324
|
+
autoincrement: true,
|
|
325
|
+
fieldName: col("id")
|
|
326
|
+
},
|
|
327
|
+
token: {
|
|
328
|
+
type: "string",
|
|
329
|
+
index: true,
|
|
330
|
+
fieldName: col("token")
|
|
331
|
+
},
|
|
332
|
+
payload: {
|
|
333
|
+
type: "json",
|
|
334
|
+
nullable: true,
|
|
335
|
+
fieldName: col("payload")
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
return [
|
|
340
|
+
workflowRuns,
|
|
341
|
+
stepCheckpoints,
|
|
342
|
+
runAttributes,
|
|
343
|
+
signalWaiters,
|
|
344
|
+
bufferedSignals
|
|
345
|
+
];
|
|
346
|
+
}
|
|
347
|
+
__name(durableEntities, "durableEntities");
|
|
348
|
+
var ENTITIES = durableEntities();
|
|
366
349
|
|
|
367
350
|
// src/mikro-orm-state-store.ts
|
|
368
351
|
var import_nestjs_durable_core = require("@dudousxd/nestjs-durable-core");
|
|
369
352
|
|
|
370
353
|
// src/schema.ts
|
|
371
354
|
async function ensureMikroOrmDurableSchema(orm) {
|
|
372
|
-
await orm.schema.
|
|
355
|
+
await orm.schema.update({
|
|
373
356
|
safe: true
|
|
374
357
|
});
|
|
375
358
|
}
|
|
@@ -585,9 +568,9 @@ var MikroOrmStateStore = class {
|
|
|
585
568
|
* the active naming strategy (underscore vs camelCase) rather than guessing. The run PK column is
|
|
586
569
|
* reused for BOTH the outer correlation and the side-table FK (they share the same fieldName). */
|
|
587
570
|
attributeColumns(em) {
|
|
588
|
-
const meta = em.getMetadata().get(RunAttributeEntity
|
|
589
|
-
const field = /* @__PURE__ */ __name((prop) => meta.
|
|
590
|
-
const runMeta = em.getMetadata().get(WorkflowRunEntity
|
|
571
|
+
const meta = em.getMetadata().get(RunAttributeEntity);
|
|
572
|
+
const field = /* @__PURE__ */ __name((prop) => meta.props.find((p) => p.name === prop)?.fieldNames?.[0] ?? prop, "field");
|
|
573
|
+
const runMeta = em.getMetadata().get(WorkflowRunEntity);
|
|
591
574
|
const runPk = runMeta.properties.id?.fieldNames?.[0] ?? "id";
|
|
592
575
|
return {
|
|
593
576
|
table: meta.tableName,
|
|
@@ -600,7 +583,7 @@ var MikroOrmStateStore = class {
|
|
|
600
583
|
}
|
|
601
584
|
/** Resolve the `tags` column name from metadata (per the active naming strategy), for the raw LIKE. */
|
|
602
585
|
tagsColumn(em) {
|
|
603
|
-
const runMeta = em.getMetadata().get(WorkflowRunEntity
|
|
586
|
+
const runMeta = em.getMetadata().get(WorkflowRunEntity);
|
|
604
587
|
return runMeta.properties.tags?.fieldNames?.[0] ?? "tags";
|
|
605
588
|
}
|
|
606
589
|
/** Wrap a JSON column reference so it can be `LIKE`d as text. Postgres `jsonb`/`json` rejects `LIKE`
|
|
@@ -677,7 +660,7 @@ var MikroOrmStateStore = class {
|
|
|
677
660
|
runId: entity.runId,
|
|
678
661
|
seq: entity.seq
|
|
679
662
|
};
|
|
680
|
-
await em.
|
|
663
|
+
await em.remove(entity).flush();
|
|
681
664
|
return waiter;
|
|
682
665
|
}
|
|
683
666
|
async listSignalWaiters(prefix) {
|
|
@@ -712,7 +695,7 @@ var MikroOrmStateStore = class {
|
|
|
712
695
|
});
|
|
713
696
|
if (!entity) return null;
|
|
714
697
|
const payload = entity.payload ?? void 0;
|
|
715
|
-
await em.
|
|
698
|
+
await em.remove(entity).flush();
|
|
716
699
|
return {
|
|
717
700
|
payload
|
|
718
701
|
};
|
|
@@ -809,6 +792,7 @@ __name(fromCheckpointEntity, "fromCheckpointEntity");
|
|
|
809
792
|
SignalWaiterEntity,
|
|
810
793
|
StepCheckpointEntity,
|
|
811
794
|
WorkflowRunEntity,
|
|
795
|
+
durableEntities,
|
|
812
796
|
ensureMikroOrmDurableSchema
|
|
813
797
|
});
|
|
814
798
|
//# sourceMappingURL=index.cjs.map
|