@checkstack/automation-backend 0.2.0 → 0.3.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.
Files changed (125) hide show
  1. package/CHANGELOG.md +544 -0
  2. package/drizzle/0003_sparkling_xorn.sql +17 -0
  3. package/drizzle/0004_cultured_spyke.sql +2 -0
  4. package/drizzle/0005_classy_the_hand.sql +19 -0
  5. package/drizzle/0006_burly_wallop.sql +10 -0
  6. package/drizzle/0007_nappy_jackal.sql +1 -0
  7. package/drizzle/0008_remove_seeded_auto_incident_automations.sql +13 -0
  8. package/drizzle/0009_steady_liz_osborn.sql +12 -0
  9. package/drizzle/0010_chunky_changeling.sql +2 -0
  10. package/drizzle/meta/0003_snapshot.json +1007 -0
  11. package/drizzle/meta/0004_snapshot.json +1028 -0
  12. package/drizzle/meta/0005_snapshot.json +1164 -0
  13. package/drizzle/meta/0006_snapshot.json +1261 -0
  14. package/drizzle/meta/0007_snapshot.json +1215 -0
  15. package/drizzle/meta/0008_snapshot.json +1215 -0
  16. package/drizzle/meta/0009_snapshot.json +1328 -0
  17. package/drizzle/meta/0010_snapshot.json +1349 -0
  18. package/drizzle/meta/_journal.json +56 -0
  19. package/package.json +23 -12
  20. package/src/action-types.ts +23 -0
  21. package/src/artifact-store.ts +16 -1
  22. package/src/automation-store.test.ts +143 -0
  23. package/src/automation-store.ts +30 -8
  24. package/src/builtin-triggers.test.ts +77 -74
  25. package/src/builtin-triggers.ts +105 -108
  26. package/src/dispatch/action-kind.ts +2 -0
  27. package/src/dispatch/assemble-get-service.ts +31 -0
  28. package/src/dispatch/cancel-resurrect.test.ts +147 -0
  29. package/src/dispatch/concurrency-race.test.ts +255 -0
  30. package/src/dispatch/concurrency-scope.test.ts +166 -0
  31. package/src/dispatch/condition.ts +24 -5
  32. package/src/dispatch/dwell-queue.ts +65 -0
  33. package/src/dispatch/dwell-store.ts +154 -0
  34. package/src/dispatch/dwell.it.test.ts +142 -0
  35. package/src/dispatch/dwell.test.ts +799 -0
  36. package/src/dispatch/dwell.ts +257 -0
  37. package/src/dispatch/engine.test.ts +189 -2
  38. package/src/dispatch/engine.ts +555 -9
  39. package/src/dispatch/entity-scope.test.ts +176 -0
  40. package/src/dispatch/get-service-wiring.test.ts +318 -0
  41. package/src/dispatch/numeric.test.ts +71 -0
  42. package/src/dispatch/numeric.ts +96 -0
  43. package/src/dispatch/render.test.ts +34 -0
  44. package/src/dispatch/render.ts +31 -11
  45. package/src/dispatch/reseed-run-secrets.ts +230 -0
  46. package/src/dispatch/run-secret-registry.test.ts +189 -0
  47. package/src/dispatch/run-secret-registry.ts +247 -0
  48. package/src/dispatch/run-state-masking.test.ts +376 -0
  49. package/src/dispatch/run-state-store.ts +95 -38
  50. package/src/dispatch/run-state.ts +226 -59
  51. package/src/dispatch/scope-artifact-masking.test.ts +138 -0
  52. package/src/dispatch/secret-ref-ids.test.ts +19 -0
  53. package/src/dispatch/secret-ref-ids.ts +17 -0
  54. package/src/dispatch/snapshots.test.ts +86 -0
  55. package/src/dispatch/snapshots.ts +79 -0
  56. package/src/dispatch/stage1-router.test.ts +324 -0
  57. package/src/dispatch/stage1-router.ts +152 -0
  58. package/src/dispatch/stage1.it.test.ts +84 -0
  59. package/src/dispatch/stage2-dispatch.test.ts +285 -0
  60. package/src/dispatch/stage2-dispatch.ts +207 -0
  61. package/src/dispatch/stage2-stalled.it.test.ts +132 -0
  62. package/src/dispatch/stalled-sweeper.test.ts +197 -0
  63. package/src/dispatch/stalled-sweeper.ts +112 -5
  64. package/src/dispatch/state-scope.test.ts +234 -0
  65. package/src/dispatch/state-scope.ts +322 -0
  66. package/src/dispatch/structured-conditions.test.ts +246 -0
  67. package/src/dispatch/structured-conditions.ts +146 -0
  68. package/src/dispatch/test-fixtures.ts +306 -38
  69. package/src/dispatch/trigger-fanin.test.ts +111 -0
  70. package/src/dispatch/trigger-subscriber.ts +316 -14
  71. package/src/dispatch/types.ts +263 -8
  72. package/src/dispatch/wait-timeout-queue.ts +89 -0
  73. package/src/dispatch/wait-until-entity-wake.test.ts +544 -0
  74. package/src/dispatch/wait-until.test.ts +540 -0
  75. package/src/dispatch/wake-refs.test.ts +158 -0
  76. package/src/dispatch/wake-refs.ts +348 -0
  77. package/src/dispatch/window-gate.test.ts +513 -0
  78. package/src/dispatch/window-store.test.ts +162 -0
  79. package/src/dispatch/window-store.ts +102 -0
  80. package/src/entity/change-derivers.test.ts +148 -0
  81. package/src/entity/change-derivers.ts +143 -0
  82. package/src/entity/change-emitter.test.ts +66 -0
  83. package/src/entity/change-emitter.ts +76 -0
  84. package/src/entity/create-handle.ts +344 -0
  85. package/src/entity/cross-pod-read-consistency.it.test.ts +281 -0
  86. package/src/entity/define-entity.ts +157 -0
  87. package/src/entity/diff.test.ts +57 -0
  88. package/src/entity/diff.ts +54 -0
  89. package/src/entity/entity-store.test.ts +30 -0
  90. package/src/entity/entity-store.ts +171 -0
  91. package/src/entity/extension-point.ts +56 -0
  92. package/src/entity/fake-entity-store.ts +130 -0
  93. package/src/entity/hook.ts +19 -0
  94. package/src/entity/index.ts +50 -0
  95. package/src/entity/mutate-handle.test.ts +517 -0
  96. package/src/entity/on-entity-changed.test.ts +189 -0
  97. package/src/entity/on-entity-changed.ts +214 -0
  98. package/src/entity/registry.test.ts +181 -0
  99. package/src/entity/registry.ts +200 -0
  100. package/src/entity/stable-stringify.test.ts +55 -0
  101. package/src/entity/stable-stringify.ts +49 -0
  102. package/src/entity/wake-index.it.test.ts +251 -0
  103. package/src/entity/with-entity-write.test.ts +100 -0
  104. package/src/entity/with-entity-write.ts +69 -0
  105. package/src/entity-driven-trigger.ts +46 -0
  106. package/src/extension-points.ts +35 -0
  107. package/src/gitops-docs.test.ts +215 -0
  108. package/src/gitops-docs.ts +151 -0
  109. package/src/gitops-kinds.test.ts +174 -0
  110. package/src/gitops-kinds.ts +137 -0
  111. package/src/index.ts +355 -11
  112. package/src/migration/flapping-to-window.test.ts +123 -0
  113. package/src/migration/flapping-to-window.ts +205 -0
  114. package/src/router.test.ts +182 -1
  115. package/src/router.ts +73 -2
  116. package/src/schema.ts +236 -3
  117. package/src/script-test-replay.test.ts +88 -0
  118. package/src/script-test-replay.ts +100 -0
  119. package/src/script-test-shell-env.test.ts +41 -0
  120. package/src/script-test-shell-env.ts +89 -0
  121. package/src/script-test.test.ts +386 -0
  122. package/src/script-test.ts +258 -0
  123. package/src/trigger-registry.ts +2 -0
  124. package/src/validate-definition.test.ts +1 -0
  125. package/tsconfig.json +24 -0
@@ -0,0 +1,1164 @@
1
+ {
2
+ "id": "5069551f-b8f5-4617-b61f-e74cc6fc2509",
3
+ "prevId": "5c9d1493-b9aa-43cf-a2c2-0bd82fcd5331",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.automation_artifacts": {
8
+ "name": "automation_artifacts",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "automation_id": {
18
+ "name": "automation_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "run_id": {
24
+ "name": "run_id",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": true
28
+ },
29
+ "step_id": {
30
+ "name": "step_id",
31
+ "type": "text",
32
+ "primaryKey": false,
33
+ "notNull": true
34
+ },
35
+ "action_id": {
36
+ "name": "action_id",
37
+ "type": "text",
38
+ "primaryKey": false,
39
+ "notNull": false
40
+ },
41
+ "artifact_type": {
42
+ "name": "artifact_type",
43
+ "type": "text",
44
+ "primaryKey": false,
45
+ "notNull": true
46
+ },
47
+ "data": {
48
+ "name": "data",
49
+ "type": "jsonb",
50
+ "primaryKey": false,
51
+ "notNull": true
52
+ },
53
+ "context_key": {
54
+ "name": "context_key",
55
+ "type": "text",
56
+ "primaryKey": false,
57
+ "notNull": false
58
+ },
59
+ "closed_at": {
60
+ "name": "closed_at",
61
+ "type": "timestamp",
62
+ "primaryKey": false,
63
+ "notNull": false
64
+ },
65
+ "created_at": {
66
+ "name": "created_at",
67
+ "type": "timestamp",
68
+ "primaryKey": false,
69
+ "notNull": true,
70
+ "default": "now()"
71
+ }
72
+ },
73
+ "indexes": {
74
+ "automation_artifacts_context_lookup_idx": {
75
+ "name": "automation_artifacts_context_lookup_idx",
76
+ "columns": [
77
+ {
78
+ "expression": "automation_id",
79
+ "isExpression": false,
80
+ "asc": true,
81
+ "nulls": "last"
82
+ },
83
+ {
84
+ "expression": "context_key",
85
+ "isExpression": false,
86
+ "asc": true,
87
+ "nulls": "last"
88
+ },
89
+ {
90
+ "expression": "artifact_type",
91
+ "isExpression": false,
92
+ "asc": true,
93
+ "nulls": "last"
94
+ },
95
+ {
96
+ "expression": "created_at",
97
+ "isExpression": false,
98
+ "asc": true,
99
+ "nulls": "last"
100
+ }
101
+ ],
102
+ "isUnique": false,
103
+ "concurrently": false,
104
+ "method": "btree",
105
+ "with": {}
106
+ },
107
+ "automation_artifacts_action_lookup_idx": {
108
+ "name": "automation_artifacts_action_lookup_idx",
109
+ "columns": [
110
+ {
111
+ "expression": "automation_id",
112
+ "isExpression": false,
113
+ "asc": true,
114
+ "nulls": "last"
115
+ },
116
+ {
117
+ "expression": "action_id",
118
+ "isExpression": false,
119
+ "asc": true,
120
+ "nulls": "last"
121
+ },
122
+ {
123
+ "expression": "created_at",
124
+ "isExpression": false,
125
+ "asc": true,
126
+ "nulls": "last"
127
+ }
128
+ ],
129
+ "isUnique": false,
130
+ "concurrently": false,
131
+ "method": "btree",
132
+ "with": {}
133
+ },
134
+ "automation_artifacts_open_idx": {
135
+ "name": "automation_artifacts_open_idx",
136
+ "columns": [
137
+ {
138
+ "expression": "automation_id",
139
+ "isExpression": false,
140
+ "asc": true,
141
+ "nulls": "last"
142
+ },
143
+ {
144
+ "expression": "closed_at",
145
+ "isExpression": false,
146
+ "asc": true,
147
+ "nulls": "last"
148
+ }
149
+ ],
150
+ "isUnique": false,
151
+ "concurrently": false,
152
+ "method": "btree",
153
+ "with": {}
154
+ }
155
+ },
156
+ "foreignKeys": {
157
+ "automation_artifacts_automation_id_automations_id_fk": {
158
+ "name": "automation_artifacts_automation_id_automations_id_fk",
159
+ "tableFrom": "automation_artifacts",
160
+ "tableTo": "automations",
161
+ "columnsFrom": [
162
+ "automation_id"
163
+ ],
164
+ "columnsTo": [
165
+ "id"
166
+ ],
167
+ "onDelete": "cascade",
168
+ "onUpdate": "no action"
169
+ },
170
+ "automation_artifacts_run_id_automation_runs_id_fk": {
171
+ "name": "automation_artifacts_run_id_automation_runs_id_fk",
172
+ "tableFrom": "automation_artifacts",
173
+ "tableTo": "automation_runs",
174
+ "columnsFrom": [
175
+ "run_id"
176
+ ],
177
+ "columnsTo": [
178
+ "id"
179
+ ],
180
+ "onDelete": "cascade",
181
+ "onUpdate": "no action"
182
+ },
183
+ "automation_artifacts_step_id_automation_run_steps_id_fk": {
184
+ "name": "automation_artifacts_step_id_automation_run_steps_id_fk",
185
+ "tableFrom": "automation_artifacts",
186
+ "tableTo": "automation_run_steps",
187
+ "columnsFrom": [
188
+ "step_id"
189
+ ],
190
+ "columnsTo": [
191
+ "id"
192
+ ],
193
+ "onDelete": "cascade",
194
+ "onUpdate": "no action"
195
+ }
196
+ },
197
+ "compositePrimaryKeys": {},
198
+ "uniqueConstraints": {},
199
+ "policies": {},
200
+ "checkConstraints": {},
201
+ "isRLSEnabled": false
202
+ },
203
+ "public.automation_dwell_timers": {
204
+ "name": "automation_dwell_timers",
205
+ "schema": "",
206
+ "columns": {
207
+ "id": {
208
+ "name": "id",
209
+ "type": "text",
210
+ "primaryKey": true,
211
+ "notNull": true
212
+ },
213
+ "automation_id": {
214
+ "name": "automation_id",
215
+ "type": "text",
216
+ "primaryKey": false,
217
+ "notNull": true
218
+ },
219
+ "trigger_id": {
220
+ "name": "trigger_id",
221
+ "type": "text",
222
+ "primaryKey": false,
223
+ "notNull": true
224
+ },
225
+ "event_id": {
226
+ "name": "event_id",
227
+ "type": "text",
228
+ "primaryKey": false,
229
+ "notNull": true
230
+ },
231
+ "context_key": {
232
+ "name": "context_key",
233
+ "type": "text",
234
+ "primaryKey": false,
235
+ "notNull": false
236
+ },
237
+ "armed_status": {
238
+ "name": "armed_status",
239
+ "type": "text",
240
+ "primaryKey": false,
241
+ "notNull": false
242
+ },
243
+ "payload_snapshot": {
244
+ "name": "payload_snapshot",
245
+ "type": "jsonb",
246
+ "primaryKey": false,
247
+ "notNull": true
248
+ },
249
+ "actor_snapshot": {
250
+ "name": "actor_snapshot",
251
+ "type": "jsonb",
252
+ "primaryKey": false,
253
+ "notNull": true
254
+ },
255
+ "fire_at": {
256
+ "name": "fire_at",
257
+ "type": "timestamp",
258
+ "primaryKey": false,
259
+ "notNull": true
260
+ },
261
+ "created_at": {
262
+ "name": "created_at",
263
+ "type": "timestamp",
264
+ "primaryKey": false,
265
+ "notNull": true,
266
+ "default": "now()"
267
+ }
268
+ },
269
+ "indexes": {
270
+ "automation_dwell_timers_key_unique": {
271
+ "name": "automation_dwell_timers_key_unique",
272
+ "columns": [
273
+ {
274
+ "expression": "automation_id",
275
+ "isExpression": false,
276
+ "asc": true,
277
+ "nulls": "last"
278
+ },
279
+ {
280
+ "expression": "trigger_id",
281
+ "isExpression": false,
282
+ "asc": true,
283
+ "nulls": "last"
284
+ },
285
+ {
286
+ "expression": "context_key",
287
+ "isExpression": false,
288
+ "asc": true,
289
+ "nulls": "last"
290
+ }
291
+ ],
292
+ "isUnique": true,
293
+ "concurrently": false,
294
+ "method": "btree",
295
+ "with": {}
296
+ },
297
+ "automation_dwell_timers_fire_at_idx": {
298
+ "name": "automation_dwell_timers_fire_at_idx",
299
+ "columns": [
300
+ {
301
+ "expression": "fire_at",
302
+ "isExpression": false,
303
+ "asc": true,
304
+ "nulls": "last"
305
+ }
306
+ ],
307
+ "isUnique": false,
308
+ "concurrently": false,
309
+ "method": "btree",
310
+ "with": {}
311
+ },
312
+ "automation_dwell_timers_automation_idx": {
313
+ "name": "automation_dwell_timers_automation_idx",
314
+ "columns": [
315
+ {
316
+ "expression": "automation_id",
317
+ "isExpression": false,
318
+ "asc": true,
319
+ "nulls": "last"
320
+ }
321
+ ],
322
+ "isUnique": false,
323
+ "concurrently": false,
324
+ "method": "btree",
325
+ "with": {}
326
+ }
327
+ },
328
+ "foreignKeys": {
329
+ "automation_dwell_timers_automation_id_automations_id_fk": {
330
+ "name": "automation_dwell_timers_automation_id_automations_id_fk",
331
+ "tableFrom": "automation_dwell_timers",
332
+ "tableTo": "automations",
333
+ "columnsFrom": [
334
+ "automation_id"
335
+ ],
336
+ "columnsTo": [
337
+ "id"
338
+ ],
339
+ "onDelete": "cascade",
340
+ "onUpdate": "no action"
341
+ }
342
+ },
343
+ "compositePrimaryKeys": {},
344
+ "uniqueConstraints": {},
345
+ "policies": {},
346
+ "checkConstraints": {},
347
+ "isRLSEnabled": false
348
+ },
349
+ "public.automation_migration_failures": {
350
+ "name": "automation_migration_failures",
351
+ "schema": "",
352
+ "columns": {
353
+ "id": {
354
+ "name": "id",
355
+ "type": "text",
356
+ "primaryKey": true,
357
+ "notNull": true
358
+ },
359
+ "subscription_id": {
360
+ "name": "subscription_id",
361
+ "type": "text",
362
+ "primaryKey": false,
363
+ "notNull": true
364
+ },
365
+ "subscription_name": {
366
+ "name": "subscription_name",
367
+ "type": "text",
368
+ "primaryKey": false,
369
+ "notNull": true
370
+ },
371
+ "provider_id": {
372
+ "name": "provider_id",
373
+ "type": "text",
374
+ "primaryKey": false,
375
+ "notNull": true
376
+ },
377
+ "event_id": {
378
+ "name": "event_id",
379
+ "type": "text",
380
+ "primaryKey": false,
381
+ "notNull": true
382
+ },
383
+ "reason": {
384
+ "name": "reason",
385
+ "type": "text",
386
+ "primaryKey": false,
387
+ "notNull": true
388
+ },
389
+ "detail": {
390
+ "name": "detail",
391
+ "type": "text",
392
+ "primaryKey": false,
393
+ "notNull": false
394
+ },
395
+ "provider_config": {
396
+ "name": "provider_config",
397
+ "type": "jsonb",
398
+ "primaryKey": false,
399
+ "notNull": true
400
+ },
401
+ "created_at": {
402
+ "name": "created_at",
403
+ "type": "timestamp",
404
+ "primaryKey": false,
405
+ "notNull": true,
406
+ "default": "now()"
407
+ }
408
+ },
409
+ "indexes": {},
410
+ "foreignKeys": {},
411
+ "compositePrimaryKeys": {},
412
+ "uniqueConstraints": {
413
+ "automation_migration_failures_subscription_id_unique": {
414
+ "name": "automation_migration_failures_subscription_id_unique",
415
+ "nullsNotDistinct": false,
416
+ "columns": [
417
+ "subscription_id"
418
+ ]
419
+ }
420
+ },
421
+ "policies": {},
422
+ "checkConstraints": {},
423
+ "isRLSEnabled": false
424
+ },
425
+ "public.automation_run_state": {
426
+ "name": "automation_run_state",
427
+ "schema": "",
428
+ "columns": {
429
+ "run_id": {
430
+ "name": "run_id",
431
+ "type": "text",
432
+ "primaryKey": true,
433
+ "notNull": true
434
+ },
435
+ "scope_snapshot": {
436
+ "name": "scope_snapshot",
437
+ "type": "jsonb",
438
+ "primaryKey": false,
439
+ "notNull": true
440
+ },
441
+ "last_action_path": {
442
+ "name": "last_action_path",
443
+ "type": "text",
444
+ "primaryKey": false,
445
+ "notNull": false
446
+ },
447
+ "last_heartbeat_at": {
448
+ "name": "last_heartbeat_at",
449
+ "type": "timestamp",
450
+ "primaryKey": false,
451
+ "notNull": true,
452
+ "default": "now()"
453
+ },
454
+ "updated_at": {
455
+ "name": "updated_at",
456
+ "type": "timestamp",
457
+ "primaryKey": false,
458
+ "notNull": true,
459
+ "default": "now()"
460
+ }
461
+ },
462
+ "indexes": {
463
+ "automation_run_state_heartbeat_idx": {
464
+ "name": "automation_run_state_heartbeat_idx",
465
+ "columns": [
466
+ {
467
+ "expression": "last_heartbeat_at",
468
+ "isExpression": false,
469
+ "asc": true,
470
+ "nulls": "last"
471
+ }
472
+ ],
473
+ "isUnique": false,
474
+ "concurrently": false,
475
+ "method": "btree",
476
+ "with": {}
477
+ }
478
+ },
479
+ "foreignKeys": {
480
+ "automation_run_state_run_id_automation_runs_id_fk": {
481
+ "name": "automation_run_state_run_id_automation_runs_id_fk",
482
+ "tableFrom": "automation_run_state",
483
+ "tableTo": "automation_runs",
484
+ "columnsFrom": [
485
+ "run_id"
486
+ ],
487
+ "columnsTo": [
488
+ "id"
489
+ ],
490
+ "onDelete": "cascade",
491
+ "onUpdate": "no action"
492
+ }
493
+ },
494
+ "compositePrimaryKeys": {},
495
+ "uniqueConstraints": {},
496
+ "policies": {},
497
+ "checkConstraints": {},
498
+ "isRLSEnabled": false
499
+ },
500
+ "public.automation_run_steps": {
501
+ "name": "automation_run_steps",
502
+ "schema": "",
503
+ "columns": {
504
+ "id": {
505
+ "name": "id",
506
+ "type": "text",
507
+ "primaryKey": true,
508
+ "notNull": true
509
+ },
510
+ "run_id": {
511
+ "name": "run_id",
512
+ "type": "text",
513
+ "primaryKey": false,
514
+ "notNull": true
515
+ },
516
+ "action_path": {
517
+ "name": "action_path",
518
+ "type": "text",
519
+ "primaryKey": false,
520
+ "notNull": true
521
+ },
522
+ "action_id": {
523
+ "name": "action_id",
524
+ "type": "text",
525
+ "primaryKey": false,
526
+ "notNull": false
527
+ },
528
+ "action_kind": {
529
+ "name": "action_kind",
530
+ "type": "text",
531
+ "primaryKey": false,
532
+ "notNull": true
533
+ },
534
+ "provider_action_id": {
535
+ "name": "provider_action_id",
536
+ "type": "text",
537
+ "primaryKey": false,
538
+ "notNull": false
539
+ },
540
+ "status": {
541
+ "name": "status",
542
+ "type": "text",
543
+ "primaryKey": false,
544
+ "notNull": true,
545
+ "default": "'pending'"
546
+ },
547
+ "attempts": {
548
+ "name": "attempts",
549
+ "type": "integer",
550
+ "primaryKey": false,
551
+ "notNull": true,
552
+ "default": 0
553
+ },
554
+ "error_message": {
555
+ "name": "error_message",
556
+ "type": "text",
557
+ "primaryKey": false,
558
+ "notNull": false
559
+ },
560
+ "result_payload": {
561
+ "name": "result_payload",
562
+ "type": "jsonb",
563
+ "primaryKey": false,
564
+ "notNull": false
565
+ },
566
+ "started_at": {
567
+ "name": "started_at",
568
+ "type": "timestamp",
569
+ "primaryKey": false,
570
+ "notNull": true,
571
+ "default": "now()"
572
+ },
573
+ "finished_at": {
574
+ "name": "finished_at",
575
+ "type": "timestamp",
576
+ "primaryKey": false,
577
+ "notNull": false
578
+ }
579
+ },
580
+ "indexes": {
581
+ "automation_run_steps_run_idx": {
582
+ "name": "automation_run_steps_run_idx",
583
+ "columns": [
584
+ {
585
+ "expression": "run_id",
586
+ "isExpression": false,
587
+ "asc": true,
588
+ "nulls": "last"
589
+ }
590
+ ],
591
+ "isUnique": false,
592
+ "concurrently": false,
593
+ "method": "btree",
594
+ "with": {}
595
+ }
596
+ },
597
+ "foreignKeys": {
598
+ "automation_run_steps_run_id_automation_runs_id_fk": {
599
+ "name": "automation_run_steps_run_id_automation_runs_id_fk",
600
+ "tableFrom": "automation_run_steps",
601
+ "tableTo": "automation_runs",
602
+ "columnsFrom": [
603
+ "run_id"
604
+ ],
605
+ "columnsTo": [
606
+ "id"
607
+ ],
608
+ "onDelete": "cascade",
609
+ "onUpdate": "no action"
610
+ }
611
+ },
612
+ "compositePrimaryKeys": {},
613
+ "uniqueConstraints": {},
614
+ "policies": {},
615
+ "checkConstraints": {},
616
+ "isRLSEnabled": false
617
+ },
618
+ "public.automation_runs": {
619
+ "name": "automation_runs",
620
+ "schema": "",
621
+ "columns": {
622
+ "id": {
623
+ "name": "id",
624
+ "type": "text",
625
+ "primaryKey": true,
626
+ "notNull": true
627
+ },
628
+ "automation_id": {
629
+ "name": "automation_id",
630
+ "type": "text",
631
+ "primaryKey": false,
632
+ "notNull": true
633
+ },
634
+ "trigger_id": {
635
+ "name": "trigger_id",
636
+ "type": "text",
637
+ "primaryKey": false,
638
+ "notNull": true
639
+ },
640
+ "trigger_event_id": {
641
+ "name": "trigger_event_id",
642
+ "type": "text",
643
+ "primaryKey": false,
644
+ "notNull": true
645
+ },
646
+ "trigger_payload": {
647
+ "name": "trigger_payload",
648
+ "type": "jsonb",
649
+ "primaryKey": false,
650
+ "notNull": true
651
+ },
652
+ "context_key": {
653
+ "name": "context_key",
654
+ "type": "text",
655
+ "primaryKey": false,
656
+ "notNull": false
657
+ },
658
+ "status": {
659
+ "name": "status",
660
+ "type": "text",
661
+ "primaryKey": false,
662
+ "notNull": true,
663
+ "default": "'pending'"
664
+ },
665
+ "error_message": {
666
+ "name": "error_message",
667
+ "type": "text",
668
+ "primaryKey": false,
669
+ "notNull": false
670
+ },
671
+ "started_at": {
672
+ "name": "started_at",
673
+ "type": "timestamp",
674
+ "primaryKey": false,
675
+ "notNull": true,
676
+ "default": "now()"
677
+ },
678
+ "finished_at": {
679
+ "name": "finished_at",
680
+ "type": "timestamp",
681
+ "primaryKey": false,
682
+ "notNull": false
683
+ }
684
+ },
685
+ "indexes": {
686
+ "automation_runs_automation_idx": {
687
+ "name": "automation_runs_automation_idx",
688
+ "columns": [
689
+ {
690
+ "expression": "automation_id",
691
+ "isExpression": false,
692
+ "asc": true,
693
+ "nulls": "last"
694
+ },
695
+ {
696
+ "expression": "started_at",
697
+ "isExpression": false,
698
+ "asc": true,
699
+ "nulls": "last"
700
+ }
701
+ ],
702
+ "isUnique": false,
703
+ "concurrently": false,
704
+ "method": "btree",
705
+ "with": {}
706
+ },
707
+ "automation_runs_status_idx": {
708
+ "name": "automation_runs_status_idx",
709
+ "columns": [
710
+ {
711
+ "expression": "status",
712
+ "isExpression": false,
713
+ "asc": true,
714
+ "nulls": "last"
715
+ }
716
+ ],
717
+ "isUnique": false,
718
+ "concurrently": false,
719
+ "method": "btree",
720
+ "with": {}
721
+ },
722
+ "automation_runs_context_key_idx": {
723
+ "name": "automation_runs_context_key_idx",
724
+ "columns": [
725
+ {
726
+ "expression": "automation_id",
727
+ "isExpression": false,
728
+ "asc": true,
729
+ "nulls": "last"
730
+ },
731
+ {
732
+ "expression": "context_key",
733
+ "isExpression": false,
734
+ "asc": true,
735
+ "nulls": "last"
736
+ }
737
+ ],
738
+ "isUnique": false,
739
+ "concurrently": false,
740
+ "method": "btree",
741
+ "with": {}
742
+ }
743
+ },
744
+ "foreignKeys": {
745
+ "automation_runs_automation_id_automations_id_fk": {
746
+ "name": "automation_runs_automation_id_automations_id_fk",
747
+ "tableFrom": "automation_runs",
748
+ "tableTo": "automations",
749
+ "columnsFrom": [
750
+ "automation_id"
751
+ ],
752
+ "columnsTo": [
753
+ "id"
754
+ ],
755
+ "onDelete": "cascade",
756
+ "onUpdate": "no action"
757
+ }
758
+ },
759
+ "compositePrimaryKeys": {},
760
+ "uniqueConstraints": {},
761
+ "policies": {},
762
+ "checkConstraints": {},
763
+ "isRLSEnabled": false
764
+ },
765
+ "public.automation_wait_locks": {
766
+ "name": "automation_wait_locks",
767
+ "schema": "",
768
+ "columns": {
769
+ "id": {
770
+ "name": "id",
771
+ "type": "text",
772
+ "primaryKey": true,
773
+ "notNull": true
774
+ },
775
+ "run_id": {
776
+ "name": "run_id",
777
+ "type": "text",
778
+ "primaryKey": false,
779
+ "notNull": true
780
+ },
781
+ "action_path": {
782
+ "name": "action_path",
783
+ "type": "text",
784
+ "primaryKey": false,
785
+ "notNull": true
786
+ },
787
+ "kind": {
788
+ "name": "kind",
789
+ "type": "text",
790
+ "primaryKey": false,
791
+ "notNull": true,
792
+ "default": "'trigger'"
793
+ },
794
+ "event_id": {
795
+ "name": "event_id",
796
+ "type": "text",
797
+ "primaryKey": false,
798
+ "notNull": true
799
+ },
800
+ "context_key": {
801
+ "name": "context_key",
802
+ "type": "text",
803
+ "primaryKey": false,
804
+ "notNull": false
805
+ },
806
+ "filter_template": {
807
+ "name": "filter_template",
808
+ "type": "text",
809
+ "primaryKey": false,
810
+ "notNull": false
811
+ },
812
+ "wait_config": {
813
+ "name": "wait_config",
814
+ "type": "jsonb",
815
+ "primaryKey": false,
816
+ "notNull": false
817
+ },
818
+ "timeout_at": {
819
+ "name": "timeout_at",
820
+ "type": "timestamp",
821
+ "primaryKey": false,
822
+ "notNull": false
823
+ },
824
+ "created_at": {
825
+ "name": "created_at",
826
+ "type": "timestamp",
827
+ "primaryKey": false,
828
+ "notNull": true,
829
+ "default": "now()"
830
+ }
831
+ },
832
+ "indexes": {
833
+ "automation_wait_locks_event_lookup_idx": {
834
+ "name": "automation_wait_locks_event_lookup_idx",
835
+ "columns": [
836
+ {
837
+ "expression": "event_id",
838
+ "isExpression": false,
839
+ "asc": true,
840
+ "nulls": "last"
841
+ },
842
+ {
843
+ "expression": "context_key",
844
+ "isExpression": false,
845
+ "asc": true,
846
+ "nulls": "last"
847
+ }
848
+ ],
849
+ "isUnique": false,
850
+ "concurrently": false,
851
+ "method": "btree",
852
+ "with": {}
853
+ },
854
+ "automation_wait_locks_timeout_idx": {
855
+ "name": "automation_wait_locks_timeout_idx",
856
+ "columns": [
857
+ {
858
+ "expression": "timeout_at",
859
+ "isExpression": false,
860
+ "asc": true,
861
+ "nulls": "last"
862
+ }
863
+ ],
864
+ "isUnique": false,
865
+ "concurrently": false,
866
+ "method": "btree",
867
+ "with": {}
868
+ },
869
+ "automation_wait_locks_run_idx": {
870
+ "name": "automation_wait_locks_run_idx",
871
+ "columns": [
872
+ {
873
+ "expression": "run_id",
874
+ "isExpression": false,
875
+ "asc": true,
876
+ "nulls": "last"
877
+ }
878
+ ],
879
+ "isUnique": false,
880
+ "concurrently": false,
881
+ "method": "btree",
882
+ "with": {}
883
+ },
884
+ "automation_wait_locks_kind_idx": {
885
+ "name": "automation_wait_locks_kind_idx",
886
+ "columns": [
887
+ {
888
+ "expression": "kind",
889
+ "isExpression": false,
890
+ "asc": true,
891
+ "nulls": "last"
892
+ }
893
+ ],
894
+ "isUnique": false,
895
+ "concurrently": false,
896
+ "method": "btree",
897
+ "with": {}
898
+ }
899
+ },
900
+ "foreignKeys": {
901
+ "automation_wait_locks_run_id_automation_runs_id_fk": {
902
+ "name": "automation_wait_locks_run_id_automation_runs_id_fk",
903
+ "tableFrom": "automation_wait_locks",
904
+ "tableTo": "automation_runs",
905
+ "columnsFrom": [
906
+ "run_id"
907
+ ],
908
+ "columnsTo": [
909
+ "id"
910
+ ],
911
+ "onDelete": "cascade",
912
+ "onUpdate": "no action"
913
+ }
914
+ },
915
+ "compositePrimaryKeys": {},
916
+ "uniqueConstraints": {},
917
+ "policies": {},
918
+ "checkConstraints": {},
919
+ "isRLSEnabled": false
920
+ },
921
+ "public.automations": {
922
+ "name": "automations",
923
+ "schema": "",
924
+ "columns": {
925
+ "id": {
926
+ "name": "id",
927
+ "type": "text",
928
+ "primaryKey": true,
929
+ "notNull": true
930
+ },
931
+ "name": {
932
+ "name": "name",
933
+ "type": "text",
934
+ "primaryKey": false,
935
+ "notNull": true
936
+ },
937
+ "description": {
938
+ "name": "description",
939
+ "type": "text",
940
+ "primaryKey": false,
941
+ "notNull": false
942
+ },
943
+ "status": {
944
+ "name": "status",
945
+ "type": "text",
946
+ "primaryKey": false,
947
+ "notNull": true,
948
+ "default": "'enabled'"
949
+ },
950
+ "definition": {
951
+ "name": "definition",
952
+ "type": "jsonb",
953
+ "primaryKey": false,
954
+ "notNull": true
955
+ },
956
+ "managed_by": {
957
+ "name": "managed_by",
958
+ "type": "text",
959
+ "primaryKey": false,
960
+ "notNull": false
961
+ },
962
+ "created_at": {
963
+ "name": "created_at",
964
+ "type": "timestamp",
965
+ "primaryKey": false,
966
+ "notNull": true,
967
+ "default": "now()"
968
+ },
969
+ "updated_at": {
970
+ "name": "updated_at",
971
+ "type": "timestamp",
972
+ "primaryKey": false,
973
+ "notNull": true,
974
+ "default": "now()"
975
+ }
976
+ },
977
+ "indexes": {
978
+ "automations_status_idx": {
979
+ "name": "automations_status_idx",
980
+ "columns": [
981
+ {
982
+ "expression": "status",
983
+ "isExpression": false,
984
+ "asc": true,
985
+ "nulls": "last"
986
+ }
987
+ ],
988
+ "isUnique": false,
989
+ "concurrently": false,
990
+ "method": "btree",
991
+ "with": {}
992
+ },
993
+ "automations_managed_by_idx": {
994
+ "name": "automations_managed_by_idx",
995
+ "columns": [
996
+ {
997
+ "expression": "managed_by",
998
+ "isExpression": false,
999
+ "asc": true,
1000
+ "nulls": "last"
1001
+ }
1002
+ ],
1003
+ "isUnique": false,
1004
+ "concurrently": false,
1005
+ "method": "btree",
1006
+ "with": {}
1007
+ }
1008
+ },
1009
+ "foreignKeys": {},
1010
+ "compositePrimaryKeys": {},
1011
+ "uniqueConstraints": {},
1012
+ "policies": {},
1013
+ "checkConstraints": {},
1014
+ "isRLSEnabled": false
1015
+ },
1016
+ "public.entity_state": {
1017
+ "name": "entity_state",
1018
+ "schema": "",
1019
+ "columns": {
1020
+ "kind": {
1021
+ "name": "kind",
1022
+ "type": "text",
1023
+ "primaryKey": false,
1024
+ "notNull": true
1025
+ },
1026
+ "entity_id": {
1027
+ "name": "entity_id",
1028
+ "type": "text",
1029
+ "primaryKey": false,
1030
+ "notNull": true
1031
+ },
1032
+ "state": {
1033
+ "name": "state",
1034
+ "type": "jsonb",
1035
+ "primaryKey": false,
1036
+ "notNull": true
1037
+ },
1038
+ "updated_at": {
1039
+ "name": "updated_at",
1040
+ "type": "timestamp",
1041
+ "primaryKey": false,
1042
+ "notNull": true,
1043
+ "default": "now()"
1044
+ }
1045
+ },
1046
+ "indexes": {},
1047
+ "foreignKeys": {},
1048
+ "compositePrimaryKeys": {
1049
+ "entity_state_kind_entity_id_pk": {
1050
+ "name": "entity_state_kind_entity_id_pk",
1051
+ "columns": [
1052
+ "kind",
1053
+ "entity_id"
1054
+ ]
1055
+ }
1056
+ },
1057
+ "uniqueConstraints": {},
1058
+ "policies": {},
1059
+ "checkConstraints": {},
1060
+ "isRLSEnabled": false
1061
+ },
1062
+ "public.entity_transitions": {
1063
+ "name": "entity_transitions",
1064
+ "schema": "",
1065
+ "columns": {
1066
+ "id": {
1067
+ "name": "id",
1068
+ "type": "text",
1069
+ "primaryKey": true,
1070
+ "notNull": true
1071
+ },
1072
+ "kind": {
1073
+ "name": "kind",
1074
+ "type": "text",
1075
+ "primaryKey": false,
1076
+ "notNull": true
1077
+ },
1078
+ "entity_id": {
1079
+ "name": "entity_id",
1080
+ "type": "text",
1081
+ "primaryKey": false,
1082
+ "notNull": true
1083
+ },
1084
+ "field": {
1085
+ "name": "field",
1086
+ "type": "text",
1087
+ "primaryKey": false,
1088
+ "notNull": true
1089
+ },
1090
+ "from_value": {
1091
+ "name": "from_value",
1092
+ "type": "text",
1093
+ "primaryKey": false,
1094
+ "notNull": false
1095
+ },
1096
+ "to_value": {
1097
+ "name": "to_value",
1098
+ "type": "text",
1099
+ "primaryKey": false,
1100
+ "notNull": true
1101
+ },
1102
+ "transitioned_at": {
1103
+ "name": "transitioned_at",
1104
+ "type": "timestamp",
1105
+ "primaryKey": false,
1106
+ "notNull": true,
1107
+ "default": "now()"
1108
+ }
1109
+ },
1110
+ "indexes": {
1111
+ "entity_transitions_lookup_idx": {
1112
+ "name": "entity_transitions_lookup_idx",
1113
+ "columns": [
1114
+ {
1115
+ "expression": "kind",
1116
+ "isExpression": false,
1117
+ "asc": true,
1118
+ "nulls": "last"
1119
+ },
1120
+ {
1121
+ "expression": "entity_id",
1122
+ "isExpression": false,
1123
+ "asc": true,
1124
+ "nulls": "last"
1125
+ },
1126
+ {
1127
+ "expression": "field",
1128
+ "isExpression": false,
1129
+ "asc": true,
1130
+ "nulls": "last"
1131
+ },
1132
+ {
1133
+ "expression": "transitioned_at",
1134
+ "isExpression": false,
1135
+ "asc": true,
1136
+ "nulls": "last"
1137
+ }
1138
+ ],
1139
+ "isUnique": false,
1140
+ "concurrently": false,
1141
+ "method": "btree",
1142
+ "with": {}
1143
+ }
1144
+ },
1145
+ "foreignKeys": {},
1146
+ "compositePrimaryKeys": {},
1147
+ "uniqueConstraints": {},
1148
+ "policies": {},
1149
+ "checkConstraints": {},
1150
+ "isRLSEnabled": false
1151
+ }
1152
+ },
1153
+ "enums": {},
1154
+ "schemas": {},
1155
+ "sequences": {},
1156
+ "roles": {},
1157
+ "policies": {},
1158
+ "views": {},
1159
+ "_meta": {
1160
+ "columns": {},
1161
+ "schemas": {},
1162
+ "tables": {}
1163
+ }
1164
+ }