@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,1215 @@
1
+ {
2
+ "id": "3012b1b1-e7f8-4fe2-bdb6-2e90f1cf983a",
3
+ "prevId": "7e2c325f-38de-4fbf-a841-14b2e51e1f91",
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
+ "with": {},
104
+ "method": "btree",
105
+ "concurrently": false
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
+ "with": {},
131
+ "method": "btree",
132
+ "concurrently": false
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
+ "with": {},
152
+ "method": "btree",
153
+ "concurrently": false
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
+ "columnsFrom": [
161
+ "automation_id"
162
+ ],
163
+ "tableTo": "automations",
164
+ "columnsTo": [
165
+ "id"
166
+ ],
167
+ "onUpdate": "no action",
168
+ "onDelete": "cascade"
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
+ "columnsFrom": [
174
+ "run_id"
175
+ ],
176
+ "tableTo": "automation_runs",
177
+ "columnsTo": [
178
+ "id"
179
+ ],
180
+ "onUpdate": "no action",
181
+ "onDelete": "cascade"
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
+ "columnsFrom": [
187
+ "step_id"
188
+ ],
189
+ "tableTo": "automation_run_steps",
190
+ "columnsTo": [
191
+ "id"
192
+ ],
193
+ "onUpdate": "no action",
194
+ "onDelete": "cascade"
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
+ "with": {},
294
+ "method": "btree",
295
+ "concurrently": false
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
+ "with": {},
309
+ "method": "btree",
310
+ "concurrently": false
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
+ "with": {},
324
+ "method": "btree",
325
+ "concurrently": false
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
+ "columnsFrom": [
333
+ "automation_id"
334
+ ],
335
+ "tableTo": "automations",
336
+ "columnsTo": [
337
+ "id"
338
+ ],
339
+ "onUpdate": "no action",
340
+ "onDelete": "cascade"
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
+ "columns": [
416
+ "subscription_id"
417
+ ],
418
+ "nullsNotDistinct": false
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
+ "with": {},
475
+ "method": "btree",
476
+ "concurrently": false
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
+ "columnsFrom": [
484
+ "run_id"
485
+ ],
486
+ "tableTo": "automation_runs",
487
+ "columnsTo": [
488
+ "id"
489
+ ],
490
+ "onUpdate": "no action",
491
+ "onDelete": "cascade"
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
+ "with": {},
593
+ "method": "btree",
594
+ "concurrently": false
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
+ "columnsFrom": [
602
+ "run_id"
603
+ ],
604
+ "tableTo": "automation_runs",
605
+ "columnsTo": [
606
+ "id"
607
+ ],
608
+ "onUpdate": "no action",
609
+ "onDelete": "cascade"
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
+ "with": {},
704
+ "method": "btree",
705
+ "concurrently": false
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
+ "with": {},
719
+ "method": "btree",
720
+ "concurrently": false
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
+ "with": {},
740
+ "method": "btree",
741
+ "concurrently": false
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
+ "columnsFrom": [
749
+ "automation_id"
750
+ ],
751
+ "tableTo": "automations",
752
+ "columnsTo": [
753
+ "id"
754
+ ],
755
+ "onUpdate": "no action",
756
+ "onDelete": "cascade"
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
+ "with": {},
851
+ "method": "btree",
852
+ "concurrently": false
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
+ "with": {},
866
+ "method": "btree",
867
+ "concurrently": false
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
+ "with": {},
881
+ "method": "btree",
882
+ "concurrently": false
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
+ "with": {},
896
+ "method": "btree",
897
+ "concurrently": false
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
+ "columnsFrom": [
905
+ "run_id"
906
+ ],
907
+ "tableTo": "automation_runs",
908
+ "columnsTo": [
909
+ "id"
910
+ ],
911
+ "onUpdate": "no action",
912
+ "onDelete": "cascade"
913
+ }
914
+ },
915
+ "compositePrimaryKeys": {},
916
+ "uniqueConstraints": {},
917
+ "policies": {},
918
+ "checkConstraints": {},
919
+ "isRLSEnabled": false
920
+ },
921
+ "public.automation_wake_index": {
922
+ "name": "automation_wake_index",
923
+ "schema": "",
924
+ "columns": {
925
+ "id": {
926
+ "name": "id",
927
+ "type": "text",
928
+ "primaryKey": true,
929
+ "notNull": true
930
+ },
931
+ "wait_lock_id": {
932
+ "name": "wait_lock_id",
933
+ "type": "text",
934
+ "primaryKey": false,
935
+ "notNull": true
936
+ },
937
+ "ref": {
938
+ "name": "ref",
939
+ "type": "text",
940
+ "primaryKey": false,
941
+ "notNull": true
942
+ }
943
+ },
944
+ "indexes": {
945
+ "automation_wake_index_ref_idx": {
946
+ "name": "automation_wake_index_ref_idx",
947
+ "columns": [
948
+ {
949
+ "expression": "ref",
950
+ "isExpression": false,
951
+ "asc": true,
952
+ "nulls": "last"
953
+ }
954
+ ],
955
+ "isUnique": false,
956
+ "with": {},
957
+ "method": "btree",
958
+ "concurrently": false
959
+ },
960
+ "automation_wake_index_lock_idx": {
961
+ "name": "automation_wake_index_lock_idx",
962
+ "columns": [
963
+ {
964
+ "expression": "wait_lock_id",
965
+ "isExpression": false,
966
+ "asc": true,
967
+ "nulls": "last"
968
+ }
969
+ ],
970
+ "isUnique": false,
971
+ "with": {},
972
+ "method": "btree",
973
+ "concurrently": false
974
+ },
975
+ "automation_wake_index_lock_ref_unique": {
976
+ "name": "automation_wake_index_lock_ref_unique",
977
+ "columns": [
978
+ {
979
+ "expression": "wait_lock_id",
980
+ "isExpression": false,
981
+ "asc": true,
982
+ "nulls": "last"
983
+ },
984
+ {
985
+ "expression": "ref",
986
+ "isExpression": false,
987
+ "asc": true,
988
+ "nulls": "last"
989
+ }
990
+ ],
991
+ "isUnique": true,
992
+ "with": {},
993
+ "method": "btree",
994
+ "concurrently": false
995
+ }
996
+ },
997
+ "foreignKeys": {
998
+ "automation_wake_index_wait_lock_id_automation_wait_locks_id_fk": {
999
+ "name": "automation_wake_index_wait_lock_id_automation_wait_locks_id_fk",
1000
+ "tableFrom": "automation_wake_index",
1001
+ "columnsFrom": [
1002
+ "wait_lock_id"
1003
+ ],
1004
+ "tableTo": "automation_wait_locks",
1005
+ "columnsTo": [
1006
+ "id"
1007
+ ],
1008
+ "onUpdate": "no action",
1009
+ "onDelete": "cascade"
1010
+ }
1011
+ },
1012
+ "compositePrimaryKeys": {},
1013
+ "uniqueConstraints": {},
1014
+ "policies": {},
1015
+ "checkConstraints": {},
1016
+ "isRLSEnabled": false
1017
+ },
1018
+ "public.automations": {
1019
+ "name": "automations",
1020
+ "schema": "",
1021
+ "columns": {
1022
+ "id": {
1023
+ "name": "id",
1024
+ "type": "text",
1025
+ "primaryKey": true,
1026
+ "notNull": true
1027
+ },
1028
+ "name": {
1029
+ "name": "name",
1030
+ "type": "text",
1031
+ "primaryKey": false,
1032
+ "notNull": true
1033
+ },
1034
+ "description": {
1035
+ "name": "description",
1036
+ "type": "text",
1037
+ "primaryKey": false,
1038
+ "notNull": false
1039
+ },
1040
+ "status": {
1041
+ "name": "status",
1042
+ "type": "text",
1043
+ "primaryKey": false,
1044
+ "notNull": true,
1045
+ "default": "'enabled'"
1046
+ },
1047
+ "definition": {
1048
+ "name": "definition",
1049
+ "type": "jsonb",
1050
+ "primaryKey": false,
1051
+ "notNull": true
1052
+ },
1053
+ "managed_by": {
1054
+ "name": "managed_by",
1055
+ "type": "text",
1056
+ "primaryKey": false,
1057
+ "notNull": false
1058
+ },
1059
+ "created_at": {
1060
+ "name": "created_at",
1061
+ "type": "timestamp",
1062
+ "primaryKey": false,
1063
+ "notNull": true,
1064
+ "default": "now()"
1065
+ },
1066
+ "updated_at": {
1067
+ "name": "updated_at",
1068
+ "type": "timestamp",
1069
+ "primaryKey": false,
1070
+ "notNull": true,
1071
+ "default": "now()"
1072
+ }
1073
+ },
1074
+ "indexes": {
1075
+ "automations_status_idx": {
1076
+ "name": "automations_status_idx",
1077
+ "columns": [
1078
+ {
1079
+ "expression": "status",
1080
+ "isExpression": false,
1081
+ "asc": true,
1082
+ "nulls": "last"
1083
+ }
1084
+ ],
1085
+ "isUnique": false,
1086
+ "with": {},
1087
+ "method": "btree",
1088
+ "concurrently": false
1089
+ },
1090
+ "automations_managed_by_idx": {
1091
+ "name": "automations_managed_by_idx",
1092
+ "columns": [
1093
+ {
1094
+ "expression": "managed_by",
1095
+ "isExpression": false,
1096
+ "asc": true,
1097
+ "nulls": "last"
1098
+ }
1099
+ ],
1100
+ "isUnique": false,
1101
+ "with": {},
1102
+ "method": "btree",
1103
+ "concurrently": false
1104
+ }
1105
+ },
1106
+ "foreignKeys": {},
1107
+ "compositePrimaryKeys": {},
1108
+ "uniqueConstraints": {},
1109
+ "policies": {},
1110
+ "checkConstraints": {},
1111
+ "isRLSEnabled": false
1112
+ },
1113
+ "public.entity_transitions": {
1114
+ "name": "entity_transitions",
1115
+ "schema": "",
1116
+ "columns": {
1117
+ "id": {
1118
+ "name": "id",
1119
+ "type": "text",
1120
+ "primaryKey": true,
1121
+ "notNull": true
1122
+ },
1123
+ "kind": {
1124
+ "name": "kind",
1125
+ "type": "text",
1126
+ "primaryKey": false,
1127
+ "notNull": true
1128
+ },
1129
+ "entity_id": {
1130
+ "name": "entity_id",
1131
+ "type": "text",
1132
+ "primaryKey": false,
1133
+ "notNull": true
1134
+ },
1135
+ "field": {
1136
+ "name": "field",
1137
+ "type": "text",
1138
+ "primaryKey": false,
1139
+ "notNull": true
1140
+ },
1141
+ "from_value": {
1142
+ "name": "from_value",
1143
+ "type": "text",
1144
+ "primaryKey": false,
1145
+ "notNull": false
1146
+ },
1147
+ "to_value": {
1148
+ "name": "to_value",
1149
+ "type": "text",
1150
+ "primaryKey": false,
1151
+ "notNull": true
1152
+ },
1153
+ "transitioned_at": {
1154
+ "name": "transitioned_at",
1155
+ "type": "timestamp",
1156
+ "primaryKey": false,
1157
+ "notNull": true,
1158
+ "default": "now()"
1159
+ }
1160
+ },
1161
+ "indexes": {
1162
+ "entity_transitions_lookup_idx": {
1163
+ "name": "entity_transitions_lookup_idx",
1164
+ "columns": [
1165
+ {
1166
+ "expression": "kind",
1167
+ "isExpression": false,
1168
+ "asc": true,
1169
+ "nulls": "last"
1170
+ },
1171
+ {
1172
+ "expression": "entity_id",
1173
+ "isExpression": false,
1174
+ "asc": true,
1175
+ "nulls": "last"
1176
+ },
1177
+ {
1178
+ "expression": "field",
1179
+ "isExpression": false,
1180
+ "asc": true,
1181
+ "nulls": "last"
1182
+ },
1183
+ {
1184
+ "expression": "transitioned_at",
1185
+ "isExpression": false,
1186
+ "asc": true,
1187
+ "nulls": "last"
1188
+ }
1189
+ ],
1190
+ "isUnique": false,
1191
+ "with": {},
1192
+ "method": "btree",
1193
+ "concurrently": false
1194
+ }
1195
+ },
1196
+ "foreignKeys": {},
1197
+ "compositePrimaryKeys": {},
1198
+ "uniqueConstraints": {},
1199
+ "policies": {},
1200
+ "checkConstraints": {},
1201
+ "isRLSEnabled": false
1202
+ }
1203
+ },
1204
+ "enums": {},
1205
+ "schemas": {},
1206
+ "views": {},
1207
+ "sequences": {},
1208
+ "roles": {},
1209
+ "policies": {},
1210
+ "_meta": {
1211
+ "columns": {},
1212
+ "schemas": {},
1213
+ "tables": {}
1214
+ }
1215
+ }