@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.js
CHANGED
|
@@ -2,18 +2,17 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
4
|
// src/entities.ts
|
|
5
|
-
import {
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9
|
-
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;
|
|
10
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5
|
+
import { EntitySchema } from "@mikro-orm/core";
|
|
6
|
+
function snakeCase(property) {
|
|
7
|
+
return property.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`);
|
|
11
8
|
}
|
|
12
|
-
__name(
|
|
13
|
-
function
|
|
14
|
-
if (
|
|
9
|
+
__name(snakeCase, "snakeCase");
|
|
10
|
+
function columnNamer(naming) {
|
|
11
|
+
if (naming === "snake_case") return snakeCase;
|
|
12
|
+
if (naming === "preserve") return (property) => property;
|
|
13
|
+
return naming;
|
|
15
14
|
}
|
|
16
|
-
__name(
|
|
15
|
+
__name(columnNamer, "columnNamer");
|
|
17
16
|
var WorkflowRunEntity = class {
|
|
18
17
|
static {
|
|
19
18
|
__name(this, "WorkflowRunEntity");
|
|
@@ -34,95 +33,6 @@ var WorkflowRunEntity = class {
|
|
|
34
33
|
createdAt;
|
|
35
34
|
updatedAt;
|
|
36
35
|
};
|
|
37
|
-
_ts_decorate([
|
|
38
|
-
PrimaryKey(),
|
|
39
|
-
_ts_metadata("design:type", String)
|
|
40
|
-
], WorkflowRunEntity.prototype, "id", void 0);
|
|
41
|
-
_ts_decorate([
|
|
42
|
-
Property(),
|
|
43
|
-
_ts_metadata("design:type", String)
|
|
44
|
-
], WorkflowRunEntity.prototype, "workflow", void 0);
|
|
45
|
-
_ts_decorate([
|
|
46
|
-
Property(),
|
|
47
|
-
_ts_metadata("design:type", String)
|
|
48
|
-
], WorkflowRunEntity.prototype, "workflowVersion", void 0);
|
|
49
|
-
_ts_decorate([
|
|
50
|
-
Property(),
|
|
51
|
-
_ts_metadata("design:type", typeof RunStatus === "undefined" ? Object : RunStatus)
|
|
52
|
-
], WorkflowRunEntity.prototype, "status", void 0);
|
|
53
|
-
_ts_decorate([
|
|
54
|
-
Property({
|
|
55
|
-
type: "json",
|
|
56
|
-
nullable: true
|
|
57
|
-
}),
|
|
58
|
-
_ts_metadata("design:type", Object)
|
|
59
|
-
], WorkflowRunEntity.prototype, "input", void 0);
|
|
60
|
-
_ts_decorate([
|
|
61
|
-
Property({
|
|
62
|
-
type: "json",
|
|
63
|
-
nullable: true
|
|
64
|
-
}),
|
|
65
|
-
_ts_metadata("design:type", Object)
|
|
66
|
-
], WorkflowRunEntity.prototype, "output", void 0);
|
|
67
|
-
_ts_decorate([
|
|
68
|
-
Property({
|
|
69
|
-
type: "json",
|
|
70
|
-
nullable: true
|
|
71
|
-
}),
|
|
72
|
-
_ts_metadata("design:type", Object)
|
|
73
|
-
], WorkflowRunEntity.prototype, "error", void 0);
|
|
74
|
-
_ts_decorate([
|
|
75
|
-
Property({
|
|
76
|
-
nullable: true
|
|
77
|
-
}),
|
|
78
|
-
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
79
|
-
], WorkflowRunEntity.prototype, "wakeAt", void 0);
|
|
80
|
-
_ts_decorate([
|
|
81
|
-
Property({
|
|
82
|
-
nullable: true
|
|
83
|
-
}),
|
|
84
|
-
_ts_metadata("design:type", String)
|
|
85
|
-
], WorkflowRunEntity.prototype, "lockedBy", void 0);
|
|
86
|
-
_ts_decorate([
|
|
87
|
-
Property({
|
|
88
|
-
nullable: true
|
|
89
|
-
}),
|
|
90
|
-
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
91
|
-
], WorkflowRunEntity.prototype, "lockedUntil", void 0);
|
|
92
|
-
_ts_decorate([
|
|
93
|
-
Property({
|
|
94
|
-
type: "integer",
|
|
95
|
-
nullable: true
|
|
96
|
-
}),
|
|
97
|
-
_ts_metadata("design:type", Number)
|
|
98
|
-
], WorkflowRunEntity.prototype, "recoveryAttempts", void 0);
|
|
99
|
-
_ts_decorate([
|
|
100
|
-
Property({
|
|
101
|
-
type: "json",
|
|
102
|
-
nullable: true
|
|
103
|
-
}),
|
|
104
|
-
_ts_metadata("design:type", Object)
|
|
105
|
-
], WorkflowRunEntity.prototype, "tags", void 0);
|
|
106
|
-
_ts_decorate([
|
|
107
|
-
Property({
|
|
108
|
-
type: "json",
|
|
109
|
-
nullable: true
|
|
110
|
-
}),
|
|
111
|
-
_ts_metadata("design:type", Object)
|
|
112
|
-
], WorkflowRunEntity.prototype, "searchAttributes", void 0);
|
|
113
|
-
_ts_decorate([
|
|
114
|
-
Property(),
|
|
115
|
-
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
116
|
-
], WorkflowRunEntity.prototype, "createdAt", void 0);
|
|
117
|
-
_ts_decorate([
|
|
118
|
-
Property(),
|
|
119
|
-
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
120
|
-
], WorkflowRunEntity.prototype, "updatedAt", void 0);
|
|
121
|
-
WorkflowRunEntity = _ts_decorate([
|
|
122
|
-
Entity({
|
|
123
|
-
tableName: "durable_workflow_runs"
|
|
124
|
-
})
|
|
125
|
-
], WorkflowRunEntity);
|
|
126
36
|
var StepCheckpointEntity = class {
|
|
127
37
|
static {
|
|
128
38
|
__name(this, "StepCheckpointEntity");
|
|
@@ -144,93 +54,6 @@ var StepCheckpointEntity = class {
|
|
|
144
54
|
startedAt;
|
|
145
55
|
finishedAt;
|
|
146
56
|
};
|
|
147
|
-
_ts_decorate([
|
|
148
|
-
PrimaryKey(),
|
|
149
|
-
_ts_metadata("design:type", String)
|
|
150
|
-
], StepCheckpointEntity.prototype, "runId", void 0);
|
|
151
|
-
_ts_decorate([
|
|
152
|
-
PrimaryKey(),
|
|
153
|
-
_ts_metadata("design:type", Number)
|
|
154
|
-
], StepCheckpointEntity.prototype, "seq", void 0);
|
|
155
|
-
_ts_decorate([
|
|
156
|
-
Property(),
|
|
157
|
-
_ts_metadata("design:type", String)
|
|
158
|
-
], StepCheckpointEntity.prototype, "name", void 0);
|
|
159
|
-
_ts_decorate([
|
|
160
|
-
Property(),
|
|
161
|
-
_ts_metadata("design:type", typeof StepKind === "undefined" ? Object : StepKind)
|
|
162
|
-
], StepCheckpointEntity.prototype, "kind", void 0);
|
|
163
|
-
_ts_decorate([
|
|
164
|
-
Property(),
|
|
165
|
-
_ts_metadata("design:type", String)
|
|
166
|
-
], StepCheckpointEntity.prototype, "stepId", void 0);
|
|
167
|
-
_ts_decorate([
|
|
168
|
-
Property(),
|
|
169
|
-
_ts_metadata("design:type", String)
|
|
170
|
-
], StepCheckpointEntity.prototype, "status", void 0);
|
|
171
|
-
_ts_decorate([
|
|
172
|
-
Property({
|
|
173
|
-
type: "json",
|
|
174
|
-
nullable: true
|
|
175
|
-
}),
|
|
176
|
-
_ts_metadata("design:type", Object)
|
|
177
|
-
], StepCheckpointEntity.prototype, "input", void 0);
|
|
178
|
-
_ts_decorate([
|
|
179
|
-
Property({
|
|
180
|
-
type: "json",
|
|
181
|
-
nullable: true
|
|
182
|
-
}),
|
|
183
|
-
_ts_metadata("design:type", Object)
|
|
184
|
-
], StepCheckpointEntity.prototype, "output", void 0);
|
|
185
|
-
_ts_decorate([
|
|
186
|
-
Property({
|
|
187
|
-
type: "json",
|
|
188
|
-
nullable: true
|
|
189
|
-
}),
|
|
190
|
-
_ts_metadata("design:type", Object)
|
|
191
|
-
], StepCheckpointEntity.prototype, "error", void 0);
|
|
192
|
-
_ts_decorate([
|
|
193
|
-
Property({
|
|
194
|
-
type: "json",
|
|
195
|
-
nullable: true
|
|
196
|
-
}),
|
|
197
|
-
_ts_metadata("design:type", Object)
|
|
198
|
-
], StepCheckpointEntity.prototype, "events", void 0);
|
|
199
|
-
_ts_decorate([
|
|
200
|
-
Property(),
|
|
201
|
-
_ts_metadata("design:type", Number)
|
|
202
|
-
], StepCheckpointEntity.prototype, "attempts", void 0);
|
|
203
|
-
_ts_decorate([
|
|
204
|
-
Property({
|
|
205
|
-
nullable: true
|
|
206
|
-
}),
|
|
207
|
-
_ts_metadata("design:type", String)
|
|
208
|
-
], StepCheckpointEntity.prototype, "workerGroup", void 0);
|
|
209
|
-
_ts_decorate([
|
|
210
|
-
Property({
|
|
211
|
-
nullable: true
|
|
212
|
-
}),
|
|
213
|
-
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
214
|
-
], StepCheckpointEntity.prototype, "wakeAt", void 0);
|
|
215
|
-
_ts_decorate([
|
|
216
|
-
Property({
|
|
217
|
-
nullable: true
|
|
218
|
-
}),
|
|
219
|
-
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
220
|
-
], StepCheckpointEntity.prototype, "enqueuedAt", void 0);
|
|
221
|
-
_ts_decorate([
|
|
222
|
-
Property(),
|
|
223
|
-
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
224
|
-
], StepCheckpointEntity.prototype, "startedAt", void 0);
|
|
225
|
-
_ts_decorate([
|
|
226
|
-
Property(),
|
|
227
|
-
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
228
|
-
], StepCheckpointEntity.prototype, "finishedAt", void 0);
|
|
229
|
-
StepCheckpointEntity = _ts_decorate([
|
|
230
|
-
Entity({
|
|
231
|
-
tableName: "durable_step_checkpoints"
|
|
232
|
-
})
|
|
233
|
-
], StepCheckpointEntity);
|
|
234
57
|
var RunAttributeEntity = class {
|
|
235
58
|
static {
|
|
236
59
|
__name(this, "RunAttributeEntity");
|
|
@@ -238,36 +61,8 @@ var RunAttributeEntity = class {
|
|
|
238
61
|
runId;
|
|
239
62
|
key;
|
|
240
63
|
strValue;
|
|
241
|
-
// `float`/`double` is portable across SQLite/MySQL/Postgres for numeric range scans.
|
|
242
64
|
numValue;
|
|
243
65
|
};
|
|
244
|
-
_ts_decorate([
|
|
245
|
-
PrimaryKey(),
|
|
246
|
-
_ts_metadata("design:type", String)
|
|
247
|
-
], RunAttributeEntity.prototype, "runId", void 0);
|
|
248
|
-
_ts_decorate([
|
|
249
|
-
PrimaryKey(),
|
|
250
|
-
_ts_metadata("design:type", String)
|
|
251
|
-
], RunAttributeEntity.prototype, "key", void 0);
|
|
252
|
-
_ts_decorate([
|
|
253
|
-
Property({
|
|
254
|
-
type: "string",
|
|
255
|
-
nullable: true
|
|
256
|
-
}),
|
|
257
|
-
_ts_metadata("design:type", Object)
|
|
258
|
-
], RunAttributeEntity.prototype, "strValue", void 0);
|
|
259
|
-
_ts_decorate([
|
|
260
|
-
Property({
|
|
261
|
-
type: "float",
|
|
262
|
-
nullable: true
|
|
263
|
-
}),
|
|
264
|
-
_ts_metadata("design:type", Object)
|
|
265
|
-
], RunAttributeEntity.prototype, "numValue", void 0);
|
|
266
|
-
RunAttributeEntity = _ts_decorate([
|
|
267
|
-
Entity({
|
|
268
|
-
tableName: "durable_run_attributes"
|
|
269
|
-
})
|
|
270
|
-
], RunAttributeEntity);
|
|
271
66
|
var SignalWaiterEntity = class {
|
|
272
67
|
static {
|
|
273
68
|
__name(this, "SignalWaiterEntity");
|
|
@@ -276,23 +71,6 @@ var SignalWaiterEntity = class {
|
|
|
276
71
|
runId;
|
|
277
72
|
seq;
|
|
278
73
|
};
|
|
279
|
-
_ts_decorate([
|
|
280
|
-
PrimaryKey(),
|
|
281
|
-
_ts_metadata("design:type", String)
|
|
282
|
-
], SignalWaiterEntity.prototype, "token", void 0);
|
|
283
|
-
_ts_decorate([
|
|
284
|
-
Property(),
|
|
285
|
-
_ts_metadata("design:type", String)
|
|
286
|
-
], SignalWaiterEntity.prototype, "runId", void 0);
|
|
287
|
-
_ts_decorate([
|
|
288
|
-
Property(),
|
|
289
|
-
_ts_metadata("design:type", Number)
|
|
290
|
-
], SignalWaiterEntity.prototype, "seq", void 0);
|
|
291
|
-
SignalWaiterEntity = _ts_decorate([
|
|
292
|
-
Entity({
|
|
293
|
-
tableName: "durable_signal_waiters"
|
|
294
|
-
})
|
|
295
|
-
], SignalWaiterEntity);
|
|
296
74
|
var BufferedSignalEntity = class {
|
|
297
75
|
static {
|
|
298
76
|
__name(this, "BufferedSignalEntity");
|
|
@@ -301,44 +79,248 @@ var BufferedSignalEntity = class {
|
|
|
301
79
|
token;
|
|
302
80
|
payload;
|
|
303
81
|
};
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
82
|
+
function durableEntities(options = {}) {
|
|
83
|
+
const col = columnNamer(options.naming ?? "snake_case");
|
|
84
|
+
const workflowRuns = new EntitySchema({
|
|
85
|
+
class: WorkflowRunEntity,
|
|
86
|
+
tableName: "durable_workflow_runs",
|
|
87
|
+
properties: {
|
|
88
|
+
id: {
|
|
89
|
+
type: "string",
|
|
90
|
+
primary: true,
|
|
91
|
+
fieldName: col("id")
|
|
92
|
+
},
|
|
93
|
+
workflow: {
|
|
94
|
+
type: "string",
|
|
95
|
+
fieldName: col("workflow")
|
|
96
|
+
},
|
|
97
|
+
workflowVersion: {
|
|
98
|
+
type: "string",
|
|
99
|
+
fieldName: col("workflowVersion")
|
|
100
|
+
},
|
|
101
|
+
status: {
|
|
102
|
+
type: "string",
|
|
103
|
+
fieldName: col("status")
|
|
104
|
+
},
|
|
105
|
+
input: {
|
|
106
|
+
type: "json",
|
|
107
|
+
nullable: true,
|
|
108
|
+
fieldName: col("input")
|
|
109
|
+
},
|
|
110
|
+
output: {
|
|
111
|
+
type: "json",
|
|
112
|
+
nullable: true,
|
|
113
|
+
fieldName: col("output")
|
|
114
|
+
},
|
|
115
|
+
error: {
|
|
116
|
+
type: "json",
|
|
117
|
+
nullable: true,
|
|
118
|
+
fieldName: col("error")
|
|
119
|
+
},
|
|
120
|
+
wakeAt: {
|
|
121
|
+
type: "Date",
|
|
122
|
+
nullable: true,
|
|
123
|
+
fieldName: col("wakeAt")
|
|
124
|
+
},
|
|
125
|
+
lockedBy: {
|
|
126
|
+
type: "string",
|
|
127
|
+
nullable: true,
|
|
128
|
+
fieldName: col("lockedBy")
|
|
129
|
+
},
|
|
130
|
+
lockedUntil: {
|
|
131
|
+
type: "Date",
|
|
132
|
+
nullable: true,
|
|
133
|
+
fieldName: col("lockedUntil")
|
|
134
|
+
},
|
|
135
|
+
recoveryAttempts: {
|
|
136
|
+
type: "integer",
|
|
137
|
+
nullable: true,
|
|
138
|
+
fieldName: col("recoveryAttempts")
|
|
139
|
+
},
|
|
140
|
+
tags: {
|
|
141
|
+
type: "json",
|
|
142
|
+
nullable: true,
|
|
143
|
+
fieldName: col("tags")
|
|
144
|
+
},
|
|
145
|
+
searchAttributes: {
|
|
146
|
+
type: "json",
|
|
147
|
+
nullable: true,
|
|
148
|
+
fieldName: col("searchAttributes")
|
|
149
|
+
},
|
|
150
|
+
createdAt: {
|
|
151
|
+
type: "Date",
|
|
152
|
+
fieldName: col("createdAt")
|
|
153
|
+
},
|
|
154
|
+
updatedAt: {
|
|
155
|
+
type: "Date",
|
|
156
|
+
fieldName: col("updatedAt")
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
const stepCheckpoints = new EntitySchema({
|
|
161
|
+
class: StepCheckpointEntity,
|
|
162
|
+
tableName: "durable_step_checkpoints",
|
|
163
|
+
properties: {
|
|
164
|
+
runId: {
|
|
165
|
+
type: "string",
|
|
166
|
+
primary: true,
|
|
167
|
+
fieldName: col("runId")
|
|
168
|
+
},
|
|
169
|
+
seq: {
|
|
170
|
+
type: "integer",
|
|
171
|
+
primary: true,
|
|
172
|
+
fieldName: col("seq")
|
|
173
|
+
},
|
|
174
|
+
name: {
|
|
175
|
+
type: "string",
|
|
176
|
+
fieldName: col("name")
|
|
177
|
+
},
|
|
178
|
+
kind: {
|
|
179
|
+
type: "string",
|
|
180
|
+
fieldName: col("kind")
|
|
181
|
+
},
|
|
182
|
+
stepId: {
|
|
183
|
+
type: "string",
|
|
184
|
+
fieldName: col("stepId")
|
|
185
|
+
},
|
|
186
|
+
status: {
|
|
187
|
+
type: "string",
|
|
188
|
+
fieldName: col("status")
|
|
189
|
+
},
|
|
190
|
+
input: {
|
|
191
|
+
type: "json",
|
|
192
|
+
nullable: true,
|
|
193
|
+
fieldName: col("input")
|
|
194
|
+
},
|
|
195
|
+
output: {
|
|
196
|
+
type: "json",
|
|
197
|
+
nullable: true,
|
|
198
|
+
fieldName: col("output")
|
|
199
|
+
},
|
|
200
|
+
error: {
|
|
201
|
+
type: "json",
|
|
202
|
+
nullable: true,
|
|
203
|
+
fieldName: col("error")
|
|
204
|
+
},
|
|
205
|
+
events: {
|
|
206
|
+
type: "json",
|
|
207
|
+
nullable: true,
|
|
208
|
+
fieldName: col("events")
|
|
209
|
+
},
|
|
210
|
+
attempts: {
|
|
211
|
+
type: "integer",
|
|
212
|
+
fieldName: col("attempts")
|
|
213
|
+
},
|
|
214
|
+
workerGroup: {
|
|
215
|
+
type: "string",
|
|
216
|
+
nullable: true,
|
|
217
|
+
fieldName: col("workerGroup")
|
|
218
|
+
},
|
|
219
|
+
wakeAt: {
|
|
220
|
+
type: "Date",
|
|
221
|
+
nullable: true,
|
|
222
|
+
fieldName: col("wakeAt")
|
|
223
|
+
},
|
|
224
|
+
enqueuedAt: {
|
|
225
|
+
type: "Date",
|
|
226
|
+
nullable: true,
|
|
227
|
+
fieldName: col("enqueuedAt")
|
|
228
|
+
},
|
|
229
|
+
startedAt: {
|
|
230
|
+
type: "Date",
|
|
231
|
+
fieldName: col("startedAt")
|
|
232
|
+
},
|
|
233
|
+
finishedAt: {
|
|
234
|
+
type: "Date",
|
|
235
|
+
fieldName: col("finishedAt")
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
const runAttributes = new EntitySchema({
|
|
240
|
+
class: RunAttributeEntity,
|
|
241
|
+
tableName: "durable_run_attributes",
|
|
242
|
+
properties: {
|
|
243
|
+
runId: {
|
|
244
|
+
type: "string",
|
|
245
|
+
primary: true,
|
|
246
|
+
fieldName: col("runId")
|
|
247
|
+
},
|
|
248
|
+
key: {
|
|
249
|
+
type: "string",
|
|
250
|
+
primary: true,
|
|
251
|
+
fieldName: col("key")
|
|
252
|
+
},
|
|
253
|
+
strValue: {
|
|
254
|
+
type: "string",
|
|
255
|
+
nullable: true,
|
|
256
|
+
fieldName: col("strValue")
|
|
257
|
+
},
|
|
258
|
+
// `float`/`double` is portable across SQLite/MySQL/Postgres for numeric range scans.
|
|
259
|
+
numValue: {
|
|
260
|
+
type: "float",
|
|
261
|
+
nullable: true,
|
|
262
|
+
fieldName: col("numValue")
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
const signalWaiters = new EntitySchema({
|
|
267
|
+
class: SignalWaiterEntity,
|
|
268
|
+
tableName: "durable_signal_waiters",
|
|
269
|
+
properties: {
|
|
270
|
+
token: {
|
|
271
|
+
type: "string",
|
|
272
|
+
primary: true,
|
|
273
|
+
fieldName: col("token")
|
|
274
|
+
},
|
|
275
|
+
runId: {
|
|
276
|
+
type: "string",
|
|
277
|
+
fieldName: col("runId")
|
|
278
|
+
},
|
|
279
|
+
seq: {
|
|
280
|
+
type: "integer",
|
|
281
|
+
fieldName: col("seq")
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
const bufferedSignals = new EntitySchema({
|
|
286
|
+
class: BufferedSignalEntity,
|
|
287
|
+
tableName: "durable_buffered_signals",
|
|
288
|
+
properties: {
|
|
289
|
+
id: {
|
|
290
|
+
type: "integer",
|
|
291
|
+
primary: true,
|
|
292
|
+
autoincrement: true,
|
|
293
|
+
fieldName: col("id")
|
|
294
|
+
},
|
|
295
|
+
token: {
|
|
296
|
+
type: "string",
|
|
297
|
+
index: true,
|
|
298
|
+
fieldName: col("token")
|
|
299
|
+
},
|
|
300
|
+
payload: {
|
|
301
|
+
type: "json",
|
|
302
|
+
nullable: true,
|
|
303
|
+
fieldName: col("payload")
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
return [
|
|
308
|
+
workflowRuns,
|
|
309
|
+
stepCheckpoints,
|
|
310
|
+
runAttributes,
|
|
311
|
+
signalWaiters,
|
|
312
|
+
bufferedSignals
|
|
313
|
+
];
|
|
314
|
+
}
|
|
315
|
+
__name(durableEntities, "durableEntities");
|
|
316
|
+
var ENTITIES = durableEntities();
|
|
335
317
|
|
|
336
318
|
// src/mikro-orm-state-store.ts
|
|
337
319
|
import { attributeColumnFor, attributeOperand, normalizeAttributeRows, sqlComparator } from "@dudousxd/nestjs-durable-core";
|
|
338
320
|
|
|
339
321
|
// src/schema.ts
|
|
340
322
|
async function ensureMikroOrmDurableSchema(orm) {
|
|
341
|
-
await orm.schema.
|
|
323
|
+
await orm.schema.update({
|
|
342
324
|
safe: true
|
|
343
325
|
});
|
|
344
326
|
}
|
|
@@ -554,9 +536,9 @@ var MikroOrmStateStore = class {
|
|
|
554
536
|
* the active naming strategy (underscore vs camelCase) rather than guessing. The run PK column is
|
|
555
537
|
* reused for BOTH the outer correlation and the side-table FK (they share the same fieldName). */
|
|
556
538
|
attributeColumns(em) {
|
|
557
|
-
const meta = em.getMetadata().get(RunAttributeEntity
|
|
558
|
-
const field = /* @__PURE__ */ __name((prop) => meta.
|
|
559
|
-
const runMeta = em.getMetadata().get(WorkflowRunEntity
|
|
539
|
+
const meta = em.getMetadata().get(RunAttributeEntity);
|
|
540
|
+
const field = /* @__PURE__ */ __name((prop) => meta.props.find((p) => p.name === prop)?.fieldNames?.[0] ?? prop, "field");
|
|
541
|
+
const runMeta = em.getMetadata().get(WorkflowRunEntity);
|
|
560
542
|
const runPk = runMeta.properties.id?.fieldNames?.[0] ?? "id";
|
|
561
543
|
return {
|
|
562
544
|
table: meta.tableName,
|
|
@@ -569,7 +551,7 @@ var MikroOrmStateStore = class {
|
|
|
569
551
|
}
|
|
570
552
|
/** Resolve the `tags` column name from metadata (per the active naming strategy), for the raw LIKE. */
|
|
571
553
|
tagsColumn(em) {
|
|
572
|
-
const runMeta = em.getMetadata().get(WorkflowRunEntity
|
|
554
|
+
const runMeta = em.getMetadata().get(WorkflowRunEntity);
|
|
573
555
|
return runMeta.properties.tags?.fieldNames?.[0] ?? "tags";
|
|
574
556
|
}
|
|
575
557
|
/** Wrap a JSON column reference so it can be `LIKE`d as text. Postgres `jsonb`/`json` rejects `LIKE`
|
|
@@ -646,7 +628,7 @@ var MikroOrmStateStore = class {
|
|
|
646
628
|
runId: entity.runId,
|
|
647
629
|
seq: entity.seq
|
|
648
630
|
};
|
|
649
|
-
await em.
|
|
631
|
+
await em.remove(entity).flush();
|
|
650
632
|
return waiter;
|
|
651
633
|
}
|
|
652
634
|
async listSignalWaiters(prefix) {
|
|
@@ -681,7 +663,7 @@ var MikroOrmStateStore = class {
|
|
|
681
663
|
});
|
|
682
664
|
if (!entity) return null;
|
|
683
665
|
const payload = entity.payload ?? void 0;
|
|
684
|
-
await em.
|
|
666
|
+
await em.remove(entity).flush();
|
|
685
667
|
return {
|
|
686
668
|
payload
|
|
687
669
|
};
|
|
@@ -777,6 +759,7 @@ export {
|
|
|
777
759
|
SignalWaiterEntity,
|
|
778
760
|
StepCheckpointEntity,
|
|
779
761
|
WorkflowRunEntity,
|
|
762
|
+
durableEntities,
|
|
780
763
|
ensureMikroOrmDurableSchema
|
|
781
764
|
};
|
|
782
765
|
//# sourceMappingURL=index.js.map
|