@codemation/host 0.1.0 → 0.1.3
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/CHANGELOG.md +33 -0
- package/dist/{AppConfigFactory-Ciz9YKWx.js → AppConfigFactory-ByT1D8dM.js} +253 -15
- package/dist/{AppConfigFactory-Ciz9YKWx.js.map → AppConfigFactory-ByT1D8dM.js.map} +1 -1
- package/dist/{AppConfigFactory-CiBPHleh.d.ts → AppConfigFactory-_fqSok1J.d.ts} +6565 -177
- package/dist/{AppContainerFactory-DH88oxpg.js → AppContainerFactory-BRU02PTm.js} +838 -145
- package/dist/AppContainerFactory-BRU02PTm.js.map +1 -0
- package/dist/{CodemationConfig-DfK1KLvO.d.ts → CodemationConfig-CNfytKR6.d.ts} +2 -2
- package/dist/{CodemationConfigNormalizer-BKgIOeLm.d.ts → CodemationConfigNormalizer-BuKWVNEq.d.ts} +2 -2
- package/dist/{CodemationConsumerConfigLoader-bdhJsBKt.d.ts → CodemationConsumerConfigLoader-Mv4cywWu.d.ts} +2 -2
- package/dist/{CodemationPluginListMerger-BFZeO0WG.d.ts → CodemationPluginListMerger-BD5mR6gK.d.ts} +11 -5
- package/dist/{CredentialServices-aKIwHEhf.d.ts → CredentialServices-BQsEtctT.d.ts} +8 -7
- package/dist/{CredentialServices-DNb3CZwW.js → CredentialServices-xVxVA9Tq.js} +60 -114
- package/dist/CredentialServices-xVxVA9Tq.js.map +1 -0
- package/dist/{PublicFrontendBootstrapFactory-6ahaU0XM.d.ts → PublicFrontendBootstrapFactory-kTyAJdHI.d.ts} +2 -2
- package/dist/consumer.d.ts +4 -4
- package/dist/credentials.d.ts +3 -3
- package/dist/credentials.js +1 -1
- package/dist/devServerSidecar.d.ts +1 -1
- package/dist/{index-BYbzmUwS.d.ts → index-CX752QE9.d.ts} +68 -4
- package/dist/index.d.ts +10 -10
- package/dist/index.js +5 -5
- package/dist/nextServer.d.ts +20 -15
- package/dist/nextServer.js +35 -58
- package/dist/nextServer.js.map +1 -1
- package/dist/{persistenceServer-DL8yBGDU.d.ts → persistenceServer-CLY4qtMo.d.ts} +2 -2
- package/dist/{persistenceServer-CuAqL_fF.js → persistenceServer-DMvIOGW8.js} +2 -2
- package/dist/{persistenceServer-CuAqL_fF.js.map → persistenceServer-DMvIOGW8.js.map} +1 -1
- package/dist/persistenceServer.d.ts +5 -5
- package/dist/persistenceServer.js +2 -2
- package/dist/{server-EbxQft_X.js → server-ChTCEc6R.js} +4 -4
- package/dist/{server-EbxQft_X.js.map → server-ChTCEc6R.js.map} +1 -1
- package/dist/{server-BceIfIJf.d.ts → server-DwpcwzFb.d.ts} +6 -5
- package/dist/server.d.ts +8 -8
- package/dist/server.js +5 -5
- package/package.json +5 -5
- package/prisma/migrations/20260407140000_run_normalized_persistence/migration.sql +327 -0
- package/prisma/migrations/20260407193000_rename_run_projection_to_run_slot_projection/migration.sql +10 -0
- package/prisma/migrations.sqlite/20260407140000_run_normalized_persistence/migration.sql +326 -0
- package/prisma/migrations.sqlite/20260407193000_rename_run_projection_to_run_slot_projection/migration.sql +38 -0
- package/prisma/schema.postgresql.prisma +100 -1
- package/prisma/schema.sqlite.prisma +101 -1
- package/scripts/integration-database-global-setup.mjs +0 -3
- package/src/application/mapping/WorkflowDefinitionMapper.ts +95 -56
- package/src/application/mapping/WorkflowPolicyUiPresentationFactory.ts +1 -1
- package/src/application/queries/GetWorkflowRunDetailQuery.ts +8 -0
- package/src/application/queries/GetWorkflowRunDetailQueryHandler.ts +24 -0
- package/src/application/queries/WorkflowQueryHandlers.ts +1 -0
- package/src/application/runs/WorkflowRunRetentionPruneScheduler.ts +52 -27
- package/src/domain/credentials/WorkflowCredentialNodeResolver.ts +113 -158
- package/src/domain/runs/WorkflowRunRepository.ts +7 -1
- package/src/infrastructure/persistence/InMemoryWorkflowRunRepository.ts +123 -1
- package/src/infrastructure/persistence/PrismaMigrationDeployer.ts +226 -6
- package/src/infrastructure/persistence/PrismaWorkflowRunRepository.ts +796 -109
- package/src/infrastructure/persistence/generated/prisma-postgresql-client/edge.js +85 -5
- package/src/infrastructure/persistence/generated/prisma-postgresql-client/index-browser.js +81 -1
- package/src/infrastructure/persistence/generated/prisma-postgresql-client/index.d.ts +7107 -237
- package/src/infrastructure/persistence/generated/prisma-postgresql-client/index.js +85 -5
- package/src/infrastructure/persistence/generated/prisma-postgresql-client/package.json +1 -1
- package/src/infrastructure/persistence/generated/prisma-postgresql-client/schema.prisma +101 -1
- package/src/infrastructure/persistence/generated/prisma-sqlite-client/edge.js +85 -5
- package/src/infrastructure/persistence/generated/prisma-sqlite-client/index-browser.js +81 -1
- package/src/infrastructure/persistence/generated/prisma-sqlite-client/index.d.ts +7104 -242
- package/src/infrastructure/persistence/generated/prisma-sqlite-client/index.js +85 -5
- package/src/infrastructure/persistence/generated/prisma-sqlite-client/package.json +1 -1
- package/src/infrastructure/persistence/generated/prisma-sqlite-client/schema.prisma +101 -1
- package/src/presentation/http/ApiPaths.ts +4 -0
- package/src/presentation/http/hono/registrars/RunHonoApiRouteRegistrar.ts +1 -0
- package/src/presentation/http/routeHandlers/RunHttpRouteHandler.ts +13 -0
- package/dist/AppContainerFactory-DH88oxpg.js.map +0 -1
- package/dist/CredentialServices-DNb3CZwW.js.map +0 -1
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
-- Replace monolithic Run.state_json with normalized runtime storage for SQLite.
|
|
2
|
+
|
|
3
|
+
ALTER TABLE "Run" RENAME TO "Run_legacy";
|
|
4
|
+
|
|
5
|
+
CREATE TABLE "Run" (
|
|
6
|
+
"run_id" TEXT NOT NULL PRIMARY KEY,
|
|
7
|
+
"workflow_id" TEXT NOT NULL,
|
|
8
|
+
"started_at" TEXT NOT NULL,
|
|
9
|
+
"finished_at" TEXT,
|
|
10
|
+
"status" TEXT NOT NULL,
|
|
11
|
+
"revision" INTEGER NOT NULL DEFAULT 0,
|
|
12
|
+
"parent_json" TEXT,
|
|
13
|
+
"execution_options_json" TEXT,
|
|
14
|
+
"control_json" TEXT,
|
|
15
|
+
"workflow_snapshot_json" TEXT,
|
|
16
|
+
"policy_snapshot_json" TEXT,
|
|
17
|
+
"engine_counters_json" TEXT,
|
|
18
|
+
"mutable_state_json" TEXT,
|
|
19
|
+
"outputs_by_node_json" TEXT NOT NULL,
|
|
20
|
+
"updated_at" TEXT NOT NULL
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
INSERT INTO "Run" (
|
|
24
|
+
"run_id",
|
|
25
|
+
"workflow_id",
|
|
26
|
+
"started_at",
|
|
27
|
+
"finished_at",
|
|
28
|
+
"status",
|
|
29
|
+
"revision",
|
|
30
|
+
"parent_json",
|
|
31
|
+
"execution_options_json",
|
|
32
|
+
"control_json",
|
|
33
|
+
"workflow_snapshot_json",
|
|
34
|
+
"policy_snapshot_json",
|
|
35
|
+
"engine_counters_json",
|
|
36
|
+
"mutable_state_json",
|
|
37
|
+
"outputs_by_node_json",
|
|
38
|
+
"updated_at"
|
|
39
|
+
)
|
|
40
|
+
SELECT
|
|
41
|
+
r."run_id",
|
|
42
|
+
r."workflow_id",
|
|
43
|
+
r."started_at",
|
|
44
|
+
CASE
|
|
45
|
+
WHEN r."status" IN ('completed', 'failed') THEN COALESCE(
|
|
46
|
+
(
|
|
47
|
+
SELECT MAX(json_extract(snapshot.value, '$.finishedAt'))
|
|
48
|
+
FROM json_each(COALESCE(json_extract(r."state_json", '$.nodeSnapshotsByNodeId'), '{}')) AS snapshot
|
|
49
|
+
),
|
|
50
|
+
r."updated_at"
|
|
51
|
+
)
|
|
52
|
+
ELSE NULL
|
|
53
|
+
END,
|
|
54
|
+
r."status",
|
|
55
|
+
COALESCE(CAST(json_extract(r."state_json", '$.revision') AS INTEGER), 0),
|
|
56
|
+
r."parent_json",
|
|
57
|
+
r."execution_options_json",
|
|
58
|
+
json_extract(r."state_json", '$.control'),
|
|
59
|
+
json_extract(r."state_json", '$.workflowSnapshot'),
|
|
60
|
+
json_extract(r."state_json", '$.policySnapshot'),
|
|
61
|
+
json_extract(r."state_json", '$.engineCounters'),
|
|
62
|
+
json_extract(r."state_json", '$.mutableState'),
|
|
63
|
+
COALESCE(json_extract(r."state_json", '$.outputsByNode'), '{}'),
|
|
64
|
+
r."updated_at"
|
|
65
|
+
FROM "Run_legacy" r;
|
|
66
|
+
|
|
67
|
+
CREATE INDEX "Run_workflow_id_started_at_idx" ON "Run"("workflow_id", "started_at");
|
|
68
|
+
CREATE INDEX "Run_workflow_id_status_finished_at_idx" ON "Run"("workflow_id", "status", "finished_at");
|
|
69
|
+
|
|
70
|
+
CREATE TABLE "RunWorkItem" (
|
|
71
|
+
"work_item_id" TEXT NOT NULL PRIMARY KEY,
|
|
72
|
+
"run_id" TEXT NOT NULL,
|
|
73
|
+
"workflow_id" TEXT NOT NULL,
|
|
74
|
+
"status" TEXT NOT NULL,
|
|
75
|
+
"target_node_id" TEXT NOT NULL,
|
|
76
|
+
"batch_id" TEXT NOT NULL,
|
|
77
|
+
"queue_name" TEXT,
|
|
78
|
+
"claim_token" TEXT,
|
|
79
|
+
"claimed_by" TEXT,
|
|
80
|
+
"claimed_at" TEXT,
|
|
81
|
+
"available_at" TEXT NOT NULL,
|
|
82
|
+
"enqueued_at" TEXT NOT NULL,
|
|
83
|
+
"completed_at" TEXT,
|
|
84
|
+
"failed_at" TEXT,
|
|
85
|
+
"source_instance_id" TEXT,
|
|
86
|
+
"parent_instance_id" TEXT,
|
|
87
|
+
"items_in" INTEGER NOT NULL,
|
|
88
|
+
"inputs_by_port_json" TEXT NOT NULL,
|
|
89
|
+
"error_json" TEXT,
|
|
90
|
+
CONSTRAINT "RunWorkItem_run_id_fkey" FOREIGN KEY ("run_id") REFERENCES "Run"("run_id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
CREATE INDEX "RunWorkItem_run_id_status_available_at_idx"
|
|
94
|
+
ON "RunWorkItem"("run_id", "status", "available_at");
|
|
95
|
+
CREATE INDEX "RunWorkItem_run_id_target_node_id_batch_id_idx"
|
|
96
|
+
ON "RunWorkItem"("run_id", "target_node_id", "batch_id");
|
|
97
|
+
|
|
98
|
+
CREATE TABLE "ExecutionInstance" (
|
|
99
|
+
"instance_id" TEXT NOT NULL PRIMARY KEY,
|
|
100
|
+
"run_id" TEXT NOT NULL,
|
|
101
|
+
"workflow_id" TEXT NOT NULL,
|
|
102
|
+
"slot_node_id" TEXT NOT NULL,
|
|
103
|
+
"workflow_node_id" TEXT NOT NULL,
|
|
104
|
+
"kind" TEXT NOT NULL,
|
|
105
|
+
"connection_kind" TEXT,
|
|
106
|
+
"activation_id" TEXT,
|
|
107
|
+
"batch_id" TEXT NOT NULL,
|
|
108
|
+
"run_index" INTEGER NOT NULL,
|
|
109
|
+
"parent_instance_id" TEXT,
|
|
110
|
+
"parent_run_id" TEXT,
|
|
111
|
+
"worker_claim_token" TEXT,
|
|
112
|
+
"status" TEXT NOT NULL,
|
|
113
|
+
"queued_at" TEXT,
|
|
114
|
+
"started_at" TEXT,
|
|
115
|
+
"finished_at" TEXT,
|
|
116
|
+
"updated_at" TEXT NOT NULL,
|
|
117
|
+
"item_count" INTEGER NOT NULL,
|
|
118
|
+
"input_json" TEXT,
|
|
119
|
+
"output_json" TEXT,
|
|
120
|
+
"error_json" TEXT,
|
|
121
|
+
"input_item_indices_json" TEXT,
|
|
122
|
+
"output_item_count" INTEGER,
|
|
123
|
+
"successful_item_count" INTEGER,
|
|
124
|
+
"failed_item_count" INTEGER,
|
|
125
|
+
"input_storage_kind" TEXT,
|
|
126
|
+
"output_storage_kind" TEXT,
|
|
127
|
+
"input_bytes" INTEGER,
|
|
128
|
+
"output_bytes" INTEGER,
|
|
129
|
+
"input_preview_json" TEXT,
|
|
130
|
+
"output_preview_json" TEXT,
|
|
131
|
+
"input_payload_ref" TEXT,
|
|
132
|
+
"output_payload_ref" TEXT,
|
|
133
|
+
"input_truncated" BOOLEAN,
|
|
134
|
+
"output_truncated" BOOLEAN,
|
|
135
|
+
"used_pinned_output" BOOLEAN,
|
|
136
|
+
CONSTRAINT "ExecutionInstance_run_id_fkey" FOREIGN KEY ("run_id") REFERENCES "Run"("run_id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
CREATE INDEX "ExecutionInstance_run_id_slot_node_id_updated_at_idx"
|
|
140
|
+
ON "ExecutionInstance"("run_id", "slot_node_id", "updated_at");
|
|
141
|
+
CREATE INDEX "ExecutionInstance_run_id_parent_instance_id_updated_at_idx"
|
|
142
|
+
ON "ExecutionInstance"("run_id", "parent_instance_id", "updated_at");
|
|
143
|
+
CREATE INDEX "ExecutionInstance_run_id_kind_updated_at_idx"
|
|
144
|
+
ON "ExecutionInstance"("run_id", "kind", "updated_at");
|
|
145
|
+
CREATE UNIQUE INDEX "ExecutionInstance_run_id_slot_node_id_run_index_key"
|
|
146
|
+
ON "ExecutionInstance"("run_id", "slot_node_id", "run_index");
|
|
147
|
+
|
|
148
|
+
CREATE TABLE "RunProjection" (
|
|
149
|
+
"run_id" TEXT NOT NULL PRIMARY KEY,
|
|
150
|
+
"workflow_id" TEXT NOT NULL,
|
|
151
|
+
"revision" INTEGER NOT NULL,
|
|
152
|
+
"updated_at" TEXT NOT NULL,
|
|
153
|
+
"slot_states_json" TEXT NOT NULL,
|
|
154
|
+
"mutable_state_json" TEXT,
|
|
155
|
+
CONSTRAINT "RunProjection_run_id_fkey" FOREIGN KEY ("run_id") REFERENCES "Run"("run_id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
CREATE INDEX "RunProjection_workflow_id_updated_at_idx"
|
|
159
|
+
ON "RunProjection"("workflow_id", "updated_at");
|
|
160
|
+
|
|
161
|
+
INSERT INTO "RunWorkItem" (
|
|
162
|
+
"work_item_id",
|
|
163
|
+
"run_id",
|
|
164
|
+
"workflow_id",
|
|
165
|
+
"status",
|
|
166
|
+
"target_node_id",
|
|
167
|
+
"batch_id",
|
|
168
|
+
"available_at",
|
|
169
|
+
"enqueued_at",
|
|
170
|
+
"items_in",
|
|
171
|
+
"inputs_by_port_json"
|
|
172
|
+
)
|
|
173
|
+
SELECT
|
|
174
|
+
r."run_id" || ':queue:' || CAST(CAST(q.key AS INTEGER) + 1 AS TEXT),
|
|
175
|
+
r."run_id",
|
|
176
|
+
r."workflow_id",
|
|
177
|
+
'queued',
|
|
178
|
+
json_extract(q.value, '$.nodeId'),
|
|
179
|
+
COALESCE(json_extract(q.value, '$.batchId'), 'batch_1'),
|
|
180
|
+
r."updated_at",
|
|
181
|
+
r."updated_at",
|
|
182
|
+
COALESCE(json_array_length(COALESCE(json_extract(q.value, '$.input'), '[]')), 0),
|
|
183
|
+
CASE
|
|
184
|
+
WHEN json_type(q.value, '$.collect') IS NOT NULL THEN COALESCE(json_extract(q.value, '$.collect.received'), '{}')
|
|
185
|
+
ELSE json_object(
|
|
186
|
+
COALESCE(json_extract(q.value, '$.toInput'), 'in'),
|
|
187
|
+
json(COALESCE(json_extract(q.value, '$.input'), '[]'))
|
|
188
|
+
)
|
|
189
|
+
END
|
|
190
|
+
FROM "Run_legacy" r
|
|
191
|
+
JOIN json_each(COALESCE(json_extract(r."state_json", '$.queue'), '[]')) AS q;
|
|
192
|
+
|
|
193
|
+
INSERT INTO "RunWorkItem" (
|
|
194
|
+
"work_item_id",
|
|
195
|
+
"run_id",
|
|
196
|
+
"workflow_id",
|
|
197
|
+
"status",
|
|
198
|
+
"target_node_id",
|
|
199
|
+
"batch_id",
|
|
200
|
+
"queue_name",
|
|
201
|
+
"available_at",
|
|
202
|
+
"enqueued_at",
|
|
203
|
+
"items_in",
|
|
204
|
+
"inputs_by_port_json"
|
|
205
|
+
)
|
|
206
|
+
SELECT
|
|
207
|
+
COALESCE(json_extract(r."state_json", '$.pending.activationId'), r."run_id" || ':pending'),
|
|
208
|
+
r."run_id",
|
|
209
|
+
r."workflow_id",
|
|
210
|
+
'claimed',
|
|
211
|
+
json_extract(r."state_json", '$.pending.nodeId'),
|
|
212
|
+
COALESCE(json_extract(r."state_json", '$.pending.batchId'), 'batch_1'),
|
|
213
|
+
json_extract(r."state_json", '$.pending.queue'),
|
|
214
|
+
COALESCE(json_extract(r."state_json", '$.pending.enqueuedAt'), r."updated_at"),
|
|
215
|
+
COALESCE(json_extract(r."state_json", '$.pending.enqueuedAt'), r."updated_at"),
|
|
216
|
+
COALESCE(CAST(json_extract(r."state_json", '$.pending.itemsIn') AS INTEGER), 0),
|
|
217
|
+
COALESCE(json_extract(r."state_json", '$.pending.inputsByPort'), '{}')
|
|
218
|
+
FROM "Run_legacy" r
|
|
219
|
+
WHERE json_type(r."state_json", '$.pending') IS NOT NULL;
|
|
220
|
+
|
|
221
|
+
INSERT INTO "ExecutionInstance" (
|
|
222
|
+
"instance_id",
|
|
223
|
+
"run_id",
|
|
224
|
+
"workflow_id",
|
|
225
|
+
"slot_node_id",
|
|
226
|
+
"workflow_node_id",
|
|
227
|
+
"kind",
|
|
228
|
+
"activation_id",
|
|
229
|
+
"batch_id",
|
|
230
|
+
"run_index",
|
|
231
|
+
"status",
|
|
232
|
+
"queued_at",
|
|
233
|
+
"started_at",
|
|
234
|
+
"finished_at",
|
|
235
|
+
"updated_at",
|
|
236
|
+
"item_count",
|
|
237
|
+
"input_json",
|
|
238
|
+
"output_json",
|
|
239
|
+
"error_json",
|
|
240
|
+
"used_pinned_output"
|
|
241
|
+
)
|
|
242
|
+
SELECT
|
|
243
|
+
r."run_id" || ':node:' || snapshot.key || ':' || COALESCE(json_extract(snapshot.value, '$.activationId'), 'na'),
|
|
244
|
+
r."run_id",
|
|
245
|
+
r."workflow_id",
|
|
246
|
+
snapshot.key,
|
|
247
|
+
snapshot.key,
|
|
248
|
+
'workflowNodeActivation',
|
|
249
|
+
json_extract(snapshot.value, '$.activationId'),
|
|
250
|
+
COALESCE(json_extract(r."state_json", '$.pending.batchId'), 'batch_1'),
|
|
251
|
+
1,
|
|
252
|
+
COALESCE(json_extract(snapshot.value, '$.status'), 'completed'),
|
|
253
|
+
json_extract(snapshot.value, '$.queuedAt'),
|
|
254
|
+
json_extract(snapshot.value, '$.startedAt'),
|
|
255
|
+
json_extract(snapshot.value, '$.finishedAt'),
|
|
256
|
+
COALESCE(json_extract(snapshot.value, '$.updatedAt'), r."updated_at"),
|
|
257
|
+
COALESCE(json_array_length(COALESCE(json_extract(snapshot.value, '$.outputs.main'), '[]')), 0),
|
|
258
|
+
json_extract(snapshot.value, '$.inputsByPort'),
|
|
259
|
+
json_extract(snapshot.value, '$.outputs'),
|
|
260
|
+
json_extract(snapshot.value, '$.error'),
|
|
261
|
+
CAST(json_extract(snapshot.value, '$.usedPinnedOutput') AS INTEGER)
|
|
262
|
+
FROM "Run_legacy" r
|
|
263
|
+
JOIN json_each(COALESCE(json_extract(r."state_json", '$.nodeSnapshotsByNodeId'), '{}')) AS snapshot;
|
|
264
|
+
|
|
265
|
+
INSERT INTO "ExecutionInstance" (
|
|
266
|
+
"instance_id",
|
|
267
|
+
"run_id",
|
|
268
|
+
"workflow_id",
|
|
269
|
+
"slot_node_id",
|
|
270
|
+
"workflow_node_id",
|
|
271
|
+
"kind",
|
|
272
|
+
"connection_kind",
|
|
273
|
+
"activation_id",
|
|
274
|
+
"batch_id",
|
|
275
|
+
"run_index",
|
|
276
|
+
"status",
|
|
277
|
+
"queued_at",
|
|
278
|
+
"started_at",
|
|
279
|
+
"finished_at",
|
|
280
|
+
"updated_at",
|
|
281
|
+
"item_count",
|
|
282
|
+
"input_json",
|
|
283
|
+
"output_json",
|
|
284
|
+
"error_json"
|
|
285
|
+
)
|
|
286
|
+
SELECT
|
|
287
|
+
json_extract(inv.value, '$.invocationId'),
|
|
288
|
+
r."run_id",
|
|
289
|
+
r."workflow_id",
|
|
290
|
+
json_extract(inv.value, '$.connectionNodeId'),
|
|
291
|
+
json_extract(inv.value, '$.parentAgentNodeId'),
|
|
292
|
+
'connectionInvocation',
|
|
293
|
+
'languageModel',
|
|
294
|
+
json_extract(inv.value, '$.parentAgentActivationId'),
|
|
295
|
+
COALESCE(json_extract(r."state_json", '$.pending.batchId'), 'batch_1'),
|
|
296
|
+
1000000 + CAST(inv.key AS INTEGER) + 1,
|
|
297
|
+
COALESCE(json_extract(inv.value, '$.status'), 'completed'),
|
|
298
|
+
json_extract(inv.value, '$.queuedAt'),
|
|
299
|
+
json_extract(inv.value, '$.startedAt'),
|
|
300
|
+
json_extract(inv.value, '$.finishedAt'),
|
|
301
|
+
COALESCE(json_extract(inv.value, '$.updatedAt'), r."updated_at"),
|
|
302
|
+
0,
|
|
303
|
+
json_extract(inv.value, '$.managedInput'),
|
|
304
|
+
json_extract(inv.value, '$.managedOutput'),
|
|
305
|
+
json_extract(inv.value, '$.error')
|
|
306
|
+
FROM "Run_legacy" r
|
|
307
|
+
JOIN json_each(COALESCE(json_extract(r."state_json", '$.connectionInvocations'), '[]')) AS inv;
|
|
308
|
+
|
|
309
|
+
INSERT INTO "RunProjection" (
|
|
310
|
+
"run_id",
|
|
311
|
+
"workflow_id",
|
|
312
|
+
"revision",
|
|
313
|
+
"updated_at",
|
|
314
|
+
"slot_states_json",
|
|
315
|
+
"mutable_state_json"
|
|
316
|
+
)
|
|
317
|
+
SELECT
|
|
318
|
+
r."run_id",
|
|
319
|
+
r."workflow_id",
|
|
320
|
+
r."revision",
|
|
321
|
+
r."updated_at",
|
|
322
|
+
json_object('slotStatesByNodeId', json('{}')),
|
|
323
|
+
NULL
|
|
324
|
+
FROM "Run" r;
|
|
325
|
+
|
|
326
|
+
DROP TABLE "Run_legacy";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
CREATE TABLE IF NOT EXISTS "RunProjection" (
|
|
2
|
+
"run_id" TEXT NOT NULL PRIMARY KEY,
|
|
3
|
+
"workflow_id" TEXT NOT NULL,
|
|
4
|
+
"revision" INTEGER NOT NULL,
|
|
5
|
+
"updated_at" TEXT NOT NULL,
|
|
6
|
+
"slot_states_json" TEXT NOT NULL,
|
|
7
|
+
"mutable_state_json" TEXT,
|
|
8
|
+
CONSTRAINT "RunProjection_run_id_fkey" FOREIGN KEY ("run_id") REFERENCES "Run"("run_id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
CREATE TABLE IF NOT EXISTS "RunSlotProjection" (
|
|
12
|
+
"run_id" TEXT NOT NULL PRIMARY KEY,
|
|
13
|
+
"workflow_id" TEXT NOT NULL,
|
|
14
|
+
"revision" INTEGER NOT NULL,
|
|
15
|
+
"updated_at" TEXT NOT NULL,
|
|
16
|
+
"slot_states_json" TEXT NOT NULL,
|
|
17
|
+
CONSTRAINT "RunSlotProjection_run_id_fkey" FOREIGN KEY ("run_id") REFERENCES "Run"("run_id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
INSERT OR IGNORE INTO "RunSlotProjection" (
|
|
21
|
+
"run_id",
|
|
22
|
+
"workflow_id",
|
|
23
|
+
"revision",
|
|
24
|
+
"updated_at",
|
|
25
|
+
"slot_states_json"
|
|
26
|
+
)
|
|
27
|
+
SELECT
|
|
28
|
+
"run_id",
|
|
29
|
+
"workflow_id",
|
|
30
|
+
"revision",
|
|
31
|
+
"updated_at",
|
|
32
|
+
"slot_states_json"
|
|
33
|
+
FROM "RunProjection";
|
|
34
|
+
|
|
35
|
+
DROP TABLE IF EXISTS "RunProjection";
|
|
36
|
+
|
|
37
|
+
CREATE INDEX IF NOT EXISTS "RunSlotProjection_workflow_id_updated_at_idx"
|
|
38
|
+
ON "RunSlotProjection"("workflow_id", "updated_at");
|
|
@@ -11,11 +11,110 @@ model Run {
|
|
|
11
11
|
runId String @id @map("run_id")
|
|
12
12
|
workflowId String @map("workflow_id")
|
|
13
13
|
startedAt String @map("started_at")
|
|
14
|
+
finishedAt String? @map("finished_at")
|
|
14
15
|
status String
|
|
16
|
+
revision Int @default(0)
|
|
15
17
|
parentJson String? @map("parent_json")
|
|
16
18
|
executionOptionsJson String? @map("execution_options_json")
|
|
19
|
+
controlJson String? @map("control_json")
|
|
20
|
+
workflowSnapshotJson String? @map("workflow_snapshot_json")
|
|
21
|
+
policySnapshotJson String? @map("policy_snapshot_json")
|
|
22
|
+
engineCountersJson String? @map("engine_counters_json")
|
|
23
|
+
mutableStateJson String? @map("mutable_state_json")
|
|
24
|
+
outputsByNodeJson String @map("outputs_by_node_json")
|
|
17
25
|
updatedAt String @map("updated_at")
|
|
18
|
-
|
|
26
|
+
|
|
27
|
+
workItems RunWorkItem[]
|
|
28
|
+
executionInstances ExecutionInstance[]
|
|
29
|
+
slotProjection RunSlotProjection?
|
|
30
|
+
|
|
31
|
+
@@index([workflowId, startedAt])
|
|
32
|
+
@@index([workflowId, status, finishedAt])
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
model RunWorkItem {
|
|
36
|
+
workItemId String @id @map("work_item_id")
|
|
37
|
+
runId String @map("run_id")
|
|
38
|
+
workflowId String @map("workflow_id")
|
|
39
|
+
status String
|
|
40
|
+
targetNodeId String @map("target_node_id")
|
|
41
|
+
batchId String @map("batch_id")
|
|
42
|
+
queueName String? @map("queue_name")
|
|
43
|
+
claimToken String? @map("claim_token")
|
|
44
|
+
claimedBy String? @map("claimed_by")
|
|
45
|
+
claimedAt String? @map("claimed_at")
|
|
46
|
+
availableAt String @map("available_at")
|
|
47
|
+
enqueuedAt String @map("enqueued_at")
|
|
48
|
+
completedAt String? @map("completed_at")
|
|
49
|
+
failedAt String? @map("failed_at")
|
|
50
|
+
sourceInstanceId String? @map("source_instance_id")
|
|
51
|
+
parentInstanceId String? @map("parent_instance_id")
|
|
52
|
+
itemsIn Int @map("items_in")
|
|
53
|
+
inputsByPortJson String @map("inputs_by_port_json")
|
|
54
|
+
errorJson String? @map("error_json")
|
|
55
|
+
|
|
56
|
+
run Run @relation(fields: [runId], references: [runId], onDelete: Cascade)
|
|
57
|
+
|
|
58
|
+
@@index([runId, status, availableAt])
|
|
59
|
+
@@index([runId, targetNodeId, batchId])
|
|
60
|
+
}
|
|
61
|
+
model ExecutionInstance {
|
|
62
|
+
instanceId String @id @map("instance_id")
|
|
63
|
+
runId String @map("run_id")
|
|
64
|
+
workflowId String @map("workflow_id")
|
|
65
|
+
slotNodeId String @map("slot_node_id")
|
|
66
|
+
workflowNodeId String @map("workflow_node_id")
|
|
67
|
+
kind String
|
|
68
|
+
connectionKind String? @map("connection_kind")
|
|
69
|
+
activationId String? @map("activation_id")
|
|
70
|
+
batchId String @map("batch_id")
|
|
71
|
+
runIndex Int @map("run_index")
|
|
72
|
+
parentInstanceId String? @map("parent_instance_id")
|
|
73
|
+
parentRunId String? @map("parent_run_id")
|
|
74
|
+
workerClaimToken String? @map("worker_claim_token")
|
|
75
|
+
status String
|
|
76
|
+
queuedAt String? @map("queued_at")
|
|
77
|
+
startedAt String? @map("started_at")
|
|
78
|
+
finishedAt String? @map("finished_at")
|
|
79
|
+
updatedAt String @map("updated_at")
|
|
80
|
+
itemCount Int @map("item_count")
|
|
81
|
+
inputJson String? @map("input_json")
|
|
82
|
+
outputJson String? @map("output_json")
|
|
83
|
+
errorJson String? @map("error_json")
|
|
84
|
+
inputItemIndicesJson String? @map("input_item_indices_json")
|
|
85
|
+
outputItemCount Int? @map("output_item_count")
|
|
86
|
+
successfulItemCount Int? @map("successful_item_count")
|
|
87
|
+
failedItemCount Int? @map("failed_item_count")
|
|
88
|
+
inputStorageKind String? @map("input_storage_kind")
|
|
89
|
+
outputStorageKind String? @map("output_storage_kind")
|
|
90
|
+
inputBytes Int? @map("input_bytes")
|
|
91
|
+
outputBytes Int? @map("output_bytes")
|
|
92
|
+
inputPreviewJson String? @map("input_preview_json")
|
|
93
|
+
outputPreviewJson String? @map("output_preview_json")
|
|
94
|
+
inputPayloadRef String? @map("input_payload_ref")
|
|
95
|
+
outputPayloadRef String? @map("output_payload_ref")
|
|
96
|
+
inputTruncated Boolean? @map("input_truncated")
|
|
97
|
+
outputTruncated Boolean? @map("output_truncated")
|
|
98
|
+
usedPinnedOutput Boolean? @map("used_pinned_output")
|
|
99
|
+
|
|
100
|
+
run Run @relation(fields: [runId], references: [runId], onDelete: Cascade)
|
|
101
|
+
|
|
102
|
+
@@index([runId, slotNodeId, updatedAt])
|
|
103
|
+
@@index([runId, parentInstanceId, updatedAt])
|
|
104
|
+
@@index([runId, kind, updatedAt])
|
|
105
|
+
@@unique([runId, slotNodeId, runIndex])
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
model RunSlotProjection {
|
|
109
|
+
runId String @id @map("run_id")
|
|
110
|
+
workflowId String @map("workflow_id")
|
|
111
|
+
revision Int
|
|
112
|
+
updatedAt String @map("updated_at")
|
|
113
|
+
slotStatesJson String @map("slot_states_json")
|
|
114
|
+
|
|
115
|
+
run Run @relation(fields: [runId], references: [runId], onDelete: Cascade)
|
|
116
|
+
|
|
117
|
+
@@index([workflowId, updatedAt])
|
|
19
118
|
}
|
|
20
119
|
|
|
21
120
|
model WorkflowDebuggerOverlay {
|
|
@@ -11,11 +11,111 @@ model Run {
|
|
|
11
11
|
runId String @id @map("run_id")
|
|
12
12
|
workflowId String @map("workflow_id")
|
|
13
13
|
startedAt String @map("started_at")
|
|
14
|
+
finishedAt String? @map("finished_at")
|
|
14
15
|
status String
|
|
16
|
+
revision Int @default(0)
|
|
15
17
|
parentJson String? @map("parent_json")
|
|
16
18
|
executionOptionsJson String? @map("execution_options_json")
|
|
19
|
+
controlJson String? @map("control_json")
|
|
20
|
+
workflowSnapshotJson String? @map("workflow_snapshot_json")
|
|
21
|
+
policySnapshotJson String? @map("policy_snapshot_json")
|
|
22
|
+
engineCountersJson String? @map("engine_counters_json")
|
|
23
|
+
mutableStateJson String? @map("mutable_state_json")
|
|
24
|
+
outputsByNodeJson String @map("outputs_by_node_json")
|
|
17
25
|
updatedAt String @map("updated_at")
|
|
18
|
-
|
|
26
|
+
|
|
27
|
+
workItems RunWorkItem[]
|
|
28
|
+
executionInstances ExecutionInstance[]
|
|
29
|
+
slotProjection RunSlotProjection?
|
|
30
|
+
|
|
31
|
+
@@index([workflowId, startedAt])
|
|
32
|
+
@@index([workflowId, status, finishedAt])
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
model RunWorkItem {
|
|
36
|
+
workItemId String @id @map("work_item_id")
|
|
37
|
+
runId String @map("run_id")
|
|
38
|
+
workflowId String @map("workflow_id")
|
|
39
|
+
status String
|
|
40
|
+
targetNodeId String @map("target_node_id")
|
|
41
|
+
batchId String @map("batch_id")
|
|
42
|
+
queueName String? @map("queue_name")
|
|
43
|
+
claimToken String? @map("claim_token")
|
|
44
|
+
claimedBy String? @map("claimed_by")
|
|
45
|
+
claimedAt String? @map("claimed_at")
|
|
46
|
+
availableAt String @map("available_at")
|
|
47
|
+
enqueuedAt String @map("enqueued_at")
|
|
48
|
+
completedAt String? @map("completed_at")
|
|
49
|
+
failedAt String? @map("failed_at")
|
|
50
|
+
sourceInstanceId String? @map("source_instance_id")
|
|
51
|
+
parentInstanceId String? @map("parent_instance_id")
|
|
52
|
+
itemsIn Int @map("items_in")
|
|
53
|
+
inputsByPortJson String @map("inputs_by_port_json")
|
|
54
|
+
errorJson String? @map("error_json")
|
|
55
|
+
|
|
56
|
+
run Run @relation(fields: [runId], references: [runId], onDelete: Cascade)
|
|
57
|
+
|
|
58
|
+
@@index([runId, status, availableAt])
|
|
59
|
+
@@index([runId, targetNodeId, batchId])
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
model ExecutionInstance {
|
|
63
|
+
instanceId String @id @map("instance_id")
|
|
64
|
+
runId String @map("run_id")
|
|
65
|
+
workflowId String @map("workflow_id")
|
|
66
|
+
slotNodeId String @map("slot_node_id")
|
|
67
|
+
workflowNodeId String @map("workflow_node_id")
|
|
68
|
+
kind String
|
|
69
|
+
connectionKind String? @map("connection_kind")
|
|
70
|
+
activationId String? @map("activation_id")
|
|
71
|
+
batchId String @map("batch_id")
|
|
72
|
+
runIndex Int @map("run_index")
|
|
73
|
+
parentInstanceId String? @map("parent_instance_id")
|
|
74
|
+
parentRunId String? @map("parent_run_id")
|
|
75
|
+
workerClaimToken String? @map("worker_claim_token")
|
|
76
|
+
status String
|
|
77
|
+
queuedAt String? @map("queued_at")
|
|
78
|
+
startedAt String? @map("started_at")
|
|
79
|
+
finishedAt String? @map("finished_at")
|
|
80
|
+
updatedAt String @map("updated_at")
|
|
81
|
+
itemCount Int @map("item_count")
|
|
82
|
+
inputJson String? @map("input_json")
|
|
83
|
+
outputJson String? @map("output_json")
|
|
84
|
+
errorJson String? @map("error_json")
|
|
85
|
+
inputItemIndicesJson String? @map("input_item_indices_json")
|
|
86
|
+
outputItemCount Int? @map("output_item_count")
|
|
87
|
+
successfulItemCount Int? @map("successful_item_count")
|
|
88
|
+
failedItemCount Int? @map("failed_item_count")
|
|
89
|
+
inputStorageKind String? @map("input_storage_kind")
|
|
90
|
+
outputStorageKind String? @map("output_storage_kind")
|
|
91
|
+
inputBytes Int? @map("input_bytes")
|
|
92
|
+
outputBytes Int? @map("output_bytes")
|
|
93
|
+
inputPreviewJson String? @map("input_preview_json")
|
|
94
|
+
outputPreviewJson String? @map("output_preview_json")
|
|
95
|
+
inputPayloadRef String? @map("input_payload_ref")
|
|
96
|
+
outputPayloadRef String? @map("output_payload_ref")
|
|
97
|
+
inputTruncated Boolean? @map("input_truncated")
|
|
98
|
+
outputTruncated Boolean? @map("output_truncated")
|
|
99
|
+
usedPinnedOutput Boolean? @map("used_pinned_output")
|
|
100
|
+
|
|
101
|
+
run Run @relation(fields: [runId], references: [runId], onDelete: Cascade)
|
|
102
|
+
|
|
103
|
+
@@index([runId, slotNodeId, updatedAt])
|
|
104
|
+
@@index([runId, parentInstanceId, updatedAt])
|
|
105
|
+
@@index([runId, kind, updatedAt])
|
|
106
|
+
@@unique([runId, slotNodeId, runIndex])
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
model RunSlotProjection {
|
|
110
|
+
runId String @id @map("run_id")
|
|
111
|
+
workflowId String @map("workflow_id")
|
|
112
|
+
revision Int
|
|
113
|
+
updatedAt String @map("updated_at")
|
|
114
|
+
slotStatesJson String @map("slot_states_json")
|
|
115
|
+
|
|
116
|
+
run Run @relation(fields: [runId], references: [runId], onDelete: Cascade)
|
|
117
|
+
|
|
118
|
+
@@index([workflowId, updatedAt])
|
|
19
119
|
}
|
|
20
120
|
|
|
21
121
|
model WorkflowDebuggerOverlay {
|
|
@@ -9,9 +9,6 @@ const runner = path.join(hostPackageRoot, "test/http/testkit/IntegrationDatabase
|
|
|
9
9
|
const cachePath = path.join(hostPackageRoot, ".cache", "integration-database.json");
|
|
10
10
|
|
|
11
11
|
export default function integrationDatabaseGlobalSetup() {
|
|
12
|
-
if (!process.env.DATABASE_URL?.trim()) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
12
|
const result = spawnSync("pnpm", ["exec", "tsx", runner], {
|
|
16
13
|
cwd: repoRoot,
|
|
17
14
|
stdio: "inherit",
|