@shipfox/api-definitions 11.0.0 → 12.0.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 (148) hide show
  1. package/.turbo/turbo-build.log +13 -12
  2. package/CHANGELOG.md +81 -0
  3. package/dist/core/entities/index.d.ts +1 -0
  4. package/dist/core/entities/index.d.ts.map +1 -1
  5. package/dist/core/entities/index.js +1 -0
  6. package/dist/core/entities/index.js.map +1 -1
  7. package/dist/core/entities/sync-state.d.ts +4 -0
  8. package/dist/core/entities/sync-state.d.ts.map +1 -1
  9. package/dist/core/entities/sync-state.js +10 -0
  10. package/dist/core/entities/sync-state.js.map +1 -1
  11. package/dist/core/entities/validation-warning.d.ts +6 -0
  12. package/dist/core/entities/validation-warning.d.ts.map +1 -0
  13. package/dist/core/entities/validation-warning.js +3 -0
  14. package/dist/core/entities/validation-warning.js.map +1 -0
  15. package/dist/core/parse-definition.d.ts +9 -7
  16. package/dist/core/parse-definition.d.ts.map +1 -1
  17. package/dist/core/parse-definition.js +14 -2
  18. package/dist/core/parse-definition.js.map +1 -1
  19. package/dist/core/sync-definitions.d.ts +2 -0
  20. package/dist/core/sync-definitions.d.ts.map +1 -1
  21. package/dist/core/sync-definitions.js +6 -5
  22. package/dist/core/sync-definitions.js.map +1 -1
  23. package/dist/core/validate-definition.d.ts +9 -5
  24. package/dist/core/validate-definition.d.ts.map +1 -1
  25. package/dist/core/validate-definition.js +23 -2
  26. package/dist/core/validate-definition.js.map +1 -1
  27. package/dist/core/workflow-model/index.d.ts +1 -1
  28. package/dist/core/workflow-model/index.d.ts.map +1 -1
  29. package/dist/core/workflow-model/index.js.map +1 -1
  30. package/dist/core/workflow-model/invalid-workflow-model-error.d.ts +3 -1
  31. package/dist/core/workflow-model/invalid-workflow-model-error.d.ts.map +1 -1
  32. package/dist/core/workflow-model/invalid-workflow-model-error.js.map +1 -1
  33. package/dist/core/workflow-model/normalize-if-condition.d.ts +0 -1
  34. package/dist/core/workflow-model/normalize-if-condition.d.ts.map +1 -1
  35. package/dist/core/workflow-model/normalize-if-condition.js +0 -1
  36. package/dist/core/workflow-model/normalize-if-condition.js.map +1 -1
  37. package/dist/core/workflow-model/normalize-job-checkout.d.ts +15 -3
  38. package/dist/core/workflow-model/normalize-job-checkout.d.ts.map +1 -1
  39. package/dist/core/workflow-model/normalize-job-checkout.js +83 -4
  40. package/dist/core/workflow-model/normalize-job-checkout.js.map +1 -1
  41. package/dist/core/workflow-model/normalize-job-listening.js +0 -1
  42. package/dist/core/workflow-model/normalize-job-listening.js.map +1 -1
  43. package/dist/core/workflow-model/normalize-job-success.d.ts.map +1 -1
  44. package/dist/core/workflow-model/normalize-job-success.js +0 -1
  45. package/dist/core/workflow-model/normalize-job-success.js.map +1 -1
  46. package/dist/core/workflow-model/normalize-jobs.d.ts.map +1 -1
  47. package/dist/core/workflow-model/normalize-jobs.js +310 -45
  48. package/dist/core/workflow-model/normalize-jobs.js.map +1 -1
  49. package/dist/core/workflow-model/normalize-step-gate.js +0 -1
  50. package/dist/core/workflow-model/normalize-step-gate.js.map +1 -1
  51. package/dist/core/workflow-model/normalize-triggers.d.ts.map +1 -1
  52. package/dist/core/workflow-model/normalize-triggers.js +0 -1
  53. package/dist/core/workflow-model/normalize-triggers.js.map +1 -1
  54. package/dist/core/workflow-model/normalize-workflow-document.d.ts +3 -0
  55. package/dist/core/workflow-model/normalize-workflow-document.d.ts.map +1 -1
  56. package/dist/core/workflow-model/normalize-workflow-document.js +34 -4
  57. package/dist/core/workflow-model/normalize-workflow-document.js.map +1 -1
  58. package/dist/core/workflow-model/parse-interpolation-field.d.ts +1 -1
  59. package/dist/core/workflow-model/parse-interpolation-field.d.ts.map +1 -1
  60. package/dist/core/workflow-model/parse-interpolation-field.js +27 -57
  61. package/dist/core/workflow-model/parse-interpolation-field.js.map +1 -1
  62. package/dist/core/workflow-model/validate-literal-name.d.ts +12 -0
  63. package/dist/core/workflow-model/validate-literal-name.d.ts.map +1 -0
  64. package/dist/core/workflow-model/validate-literal-name.js +36 -0
  65. package/dist/core/workflow-model/validate-literal-name.js.map +1 -0
  66. package/dist/core/workflow-model/validate-predicate-expression.d.ts +1 -2
  67. package/dist/core/workflow-model/validate-predicate-expression.d.ts.map +1 -1
  68. package/dist/core/workflow-model/validate-predicate-expression.js +31 -90
  69. package/dist/core/workflow-model/validate-predicate-expression.js.map +1 -1
  70. package/dist/core/workflow-model/validation-issue.d.ts +2 -1
  71. package/dist/core/workflow-model/validation-issue.d.ts.map +1 -1
  72. package/dist/core/workflow-model/validation-issue.js +8 -2
  73. package/dist/core/workflow-model/validation-issue.js.map +1 -1
  74. package/dist/core/workflow-model/workflow-field-label.d.ts.map +1 -1
  75. package/dist/core/workflow-model/workflow-field-label.js +16 -2
  76. package/dist/core/workflow-model/workflow-field-label.js.map +1 -1
  77. package/dist/db/db.d.ts +38 -0
  78. package/dist/db/db.d.ts.map +1 -1
  79. package/dist/db/schema/sync-states.d.ts +19 -0
  80. package/dist/db/schema/sync-states.d.ts.map +1 -1
  81. package/dist/db/schema/sync-states.js +3 -1
  82. package/dist/db/schema/sync-states.js.map +1 -1
  83. package/dist/db/sync-states.d.ts +2 -1
  84. package/dist/db/sync-states.d.ts.map +1 -1
  85. package/dist/db/sync-states.js +4 -0
  86. package/dist/db/sync-states.js.map +1 -1
  87. package/dist/presentation/dto/definition.d.ts.map +1 -1
  88. package/dist/presentation/dto/definition.js +2 -1
  89. package/dist/presentation/dto/definition.js.map +1 -1
  90. package/dist/presentation/routes/project-access.d.ts +1 -0
  91. package/dist/presentation/routes/project-access.d.ts.map +1 -1
  92. package/dist/presentation/routes/validate-definition.d.ts.map +1 -1
  93. package/dist/presentation/routes/validate-definition.js +5 -3
  94. package/dist/presentation/routes/validate-definition.js.map +1 -1
  95. package/dist/temporal/activities/sync-activities.d.ts +6 -2
  96. package/dist/temporal/activities/sync-activities.d.ts.map +1 -1
  97. package/dist/temporal/activities/sync-activities.js +8 -1
  98. package/dist/temporal/activities/sync-activities.js.map +1 -1
  99. package/dist/temporal/workflows/definition-sync.js +4 -1
  100. package/dist/temporal/workflows/definition-sync.js.map +1 -1
  101. package/dist/temporal/workflows/index.bundle.js +9029 -3
  102. package/dist/tsconfig.test.tsbuildinfo +1 -1
  103. package/drizzle/0002_lumpy_ben_parker.sql +1 -0
  104. package/drizzle/meta/0002_snapshot.json +534 -0
  105. package/drizzle/meta/_journal.json +7 -0
  106. package/package.json +14 -14
  107. package/src/core/entities/index.ts +1 -0
  108. package/src/core/entities/sync-state.ts +23 -0
  109. package/src/core/entities/validation-warning.ts +5 -0
  110. package/src/core/parse-definition-warnings.test.ts +33 -0
  111. package/src/core/parse-definition.test.ts +7 -1
  112. package/src/core/parse-definition.ts +28 -10
  113. package/src/core/sync-definitions.test.ts +39 -0
  114. package/src/core/sync-definitions.ts +14 -4
  115. package/src/core/validate-definition.test.ts +128 -0
  116. package/src/core/validate-definition.ts +39 -8
  117. package/src/core/workflow-model/README.md +2 -2
  118. package/src/core/workflow-model/index.ts +1 -0
  119. package/src/core/workflow-model/invalid-workflow-model-error.ts +8 -2
  120. package/src/core/workflow-model/normalize-if-condition.ts +0 -2
  121. package/src/core/workflow-model/normalize-job-checkout.ts +105 -8
  122. package/src/core/workflow-model/normalize-job-listening.ts +0 -1
  123. package/src/core/workflow-model/normalize-job-success.ts +0 -1
  124. package/src/core/workflow-model/normalize-jobs.ts +330 -49
  125. package/src/core/workflow-model/normalize-step-gate.ts +0 -1
  126. package/src/core/workflow-model/normalize-triggers.ts +0 -1
  127. package/src/core/workflow-model/normalize-workflow-document.test.ts +732 -185
  128. package/src/core/workflow-model/normalize-workflow-document.ts +29 -4
  129. package/src/core/workflow-model/parse-interpolation-field.ts +50 -79
  130. package/src/core/workflow-model/validate-literal-name.ts +64 -0
  131. package/src/core/workflow-model/validate-predicate-expression.test.ts +153 -15
  132. package/src/core/workflow-model/validate-predicate-expression.ts +52 -120
  133. package/src/core/workflow-model/validation-issue.ts +4 -0
  134. package/src/core/workflow-model/workflow-field-label.ts +16 -2
  135. package/src/core/workflow-yaml/README.md +2 -2
  136. package/src/db/schema/sync-states.ts +4 -1
  137. package/src/db/sync-states.test.ts +57 -0
  138. package/src/db/sync-states.ts +6 -0
  139. package/src/presentation/dto/definition.ts +1 -0
  140. package/src/presentation/routes/list-definitions.test.ts +1 -0
  141. package/src/presentation/routes/validate-definition.test.ts +1 -0
  142. package/src/presentation/routes/validate-definition.ts +7 -1
  143. package/src/temporal/activities/sync-activities.test.ts +16 -0
  144. package/src/temporal/activities/sync-activities.ts +18 -3
  145. package/src/temporal/workflows/definition-sync.ts +1 -1
  146. package/test/agent-validation-catalog.ts +17 -0
  147. package/test/fixtures/valid-listening-job.yml +2 -1
  148. package/tsconfig.build.tsbuildinfo +1 -1
@@ -0,0 +1 @@
1
+ ALTER TABLE "definitions_sync_states" ADD COLUMN "warnings" jsonb DEFAULT '[]'::jsonb NOT NULL;
@@ -0,0 +1,534 @@
1
+ {
2
+ "id": "e5dff42f-09f1-4a29-973f-b0d63a150673",
3
+ "prevId": "a20924e2-d7b1-4f98-b8c4-bab54ea48de5",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.definitions_workflow_definitions": {
8
+ "name": "definitions_workflow_definitions",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "uuid",
14
+ "primaryKey": true,
15
+ "notNull": true,
16
+ "default": "uuidv7()"
17
+ },
18
+ "project_id": {
19
+ "name": "project_id",
20
+ "type": "uuid",
21
+ "primaryKey": false,
22
+ "notNull": true
23
+ },
24
+ "config_path": {
25
+ "name": "config_path",
26
+ "type": "text",
27
+ "primaryKey": false,
28
+ "notNull": false
29
+ },
30
+ "source": {
31
+ "name": "source",
32
+ "type": "definitions_source",
33
+ "typeSchema": "public",
34
+ "primaryKey": false,
35
+ "notNull": true,
36
+ "default": "'manual'"
37
+ },
38
+ "sha": {
39
+ "name": "sha",
40
+ "type": "text",
41
+ "primaryKey": false,
42
+ "notNull": false
43
+ },
44
+ "ref": {
45
+ "name": "ref",
46
+ "type": "text",
47
+ "primaryKey": false,
48
+ "notNull": false
49
+ },
50
+ "name": {
51
+ "name": "name",
52
+ "type": "text",
53
+ "primaryKey": false,
54
+ "notNull": true
55
+ },
56
+ "definition": {
57
+ "name": "definition",
58
+ "type": "jsonb",
59
+ "primaryKey": false,
60
+ "notNull": true
61
+ },
62
+ "content_hash": {
63
+ "name": "content_hash",
64
+ "type": "text",
65
+ "primaryKey": false,
66
+ "notNull": false
67
+ },
68
+ "fetched_at": {
69
+ "name": "fetched_at",
70
+ "type": "timestamp with time zone",
71
+ "primaryKey": false,
72
+ "notNull": true,
73
+ "default": "now()"
74
+ },
75
+ "created_at": {
76
+ "name": "created_at",
77
+ "type": "timestamp with time zone",
78
+ "primaryKey": false,
79
+ "notNull": true,
80
+ "default": "now()"
81
+ },
82
+ "updated_at": {
83
+ "name": "updated_at",
84
+ "type": "timestamp with time zone",
85
+ "primaryKey": false,
86
+ "notNull": true,
87
+ "default": "now()"
88
+ },
89
+ "deleted_at": {
90
+ "name": "deleted_at",
91
+ "type": "timestamp with time zone",
92
+ "primaryKey": false,
93
+ "notNull": false
94
+ }
95
+ },
96
+ "indexes": {
97
+ "definitions_wd_manual_unique": {
98
+ "name": "definitions_wd_manual_unique",
99
+ "columns": [
100
+ {
101
+ "expression": "project_id",
102
+ "isExpression": false,
103
+ "asc": true,
104
+ "nulls": "last"
105
+ },
106
+ {
107
+ "expression": "config_path",
108
+ "isExpression": false,
109
+ "asc": true,
110
+ "nulls": "last"
111
+ }
112
+ ],
113
+ "isUnique": true,
114
+ "where": "\"config_path\" IS NOT NULL AND \"ref\" IS NULL AND \"sha\" IS NULL",
115
+ "concurrently": false,
116
+ "method": "btree",
117
+ "with": {}
118
+ },
119
+ "definitions_wd_sha_lookup": {
120
+ "name": "definitions_wd_sha_lookup",
121
+ "columns": [
122
+ {
123
+ "expression": "project_id",
124
+ "isExpression": false,
125
+ "asc": true,
126
+ "nulls": "last"
127
+ },
128
+ {
129
+ "expression": "sha",
130
+ "isExpression": false,
131
+ "asc": true,
132
+ "nulls": "last"
133
+ },
134
+ {
135
+ "expression": "config_path",
136
+ "isExpression": false,
137
+ "asc": true,
138
+ "nulls": "last"
139
+ }
140
+ ],
141
+ "isUnique": true,
142
+ "where": "\"sha\" IS NOT NULL",
143
+ "concurrently": false,
144
+ "method": "btree",
145
+ "with": {}
146
+ },
147
+ "definitions_wd_ref_lookup": {
148
+ "name": "definitions_wd_ref_lookup",
149
+ "columns": [
150
+ {
151
+ "expression": "project_id",
152
+ "isExpression": false,
153
+ "asc": true,
154
+ "nulls": "last"
155
+ },
156
+ {
157
+ "expression": "ref",
158
+ "isExpression": false,
159
+ "asc": true,
160
+ "nulls": "last"
161
+ },
162
+ {
163
+ "expression": "config_path",
164
+ "isExpression": false,
165
+ "asc": true,
166
+ "nulls": "last"
167
+ }
168
+ ],
169
+ "isUnique": true,
170
+ "where": "\"ref\" IS NOT NULL",
171
+ "concurrently": false,
172
+ "method": "btree",
173
+ "with": {}
174
+ },
175
+ "definitions_wd_project_name_id_idx": {
176
+ "name": "definitions_wd_project_name_id_idx",
177
+ "columns": [
178
+ {
179
+ "expression": "project_id",
180
+ "isExpression": false,
181
+ "asc": true,
182
+ "nulls": "last"
183
+ },
184
+ {
185
+ "expression": "name",
186
+ "isExpression": false,
187
+ "asc": true,
188
+ "nulls": "last"
189
+ },
190
+ {
191
+ "expression": "id",
192
+ "isExpression": false,
193
+ "asc": true,
194
+ "nulls": "last"
195
+ }
196
+ ],
197
+ "isUnique": false,
198
+ "where": "\"deleted_at\" IS NULL",
199
+ "concurrently": false,
200
+ "method": "btree",
201
+ "with": {}
202
+ }
203
+ },
204
+ "foreignKeys": {},
205
+ "compositePrimaryKeys": {},
206
+ "uniqueConstraints": {},
207
+ "policies": {},
208
+ "checkConstraints": {
209
+ "definitions_wd_source_ref_sha_consistent": {
210
+ "name": "definitions_wd_source_ref_sha_consistent",
211
+ "value": "(\"source\" = 'vcs') = (\"ref\" IS NOT NULL OR \"sha\" IS NOT NULL)"
212
+ }
213
+ },
214
+ "isRLSEnabled": false
215
+ },
216
+ "public.definitions_outbox": {
217
+ "name": "definitions_outbox",
218
+ "schema": "",
219
+ "columns": {
220
+ "id": {
221
+ "name": "id",
222
+ "type": "uuid",
223
+ "primaryKey": true,
224
+ "notNull": true,
225
+ "default": "uuidv7()"
226
+ },
227
+ "event_type": {
228
+ "name": "event_type",
229
+ "type": "text",
230
+ "primaryKey": false,
231
+ "notNull": true
232
+ },
233
+ "ordering_key": {
234
+ "name": "ordering_key",
235
+ "type": "text",
236
+ "primaryKey": false,
237
+ "notNull": false
238
+ },
239
+ "payload": {
240
+ "name": "payload",
241
+ "type": "jsonb",
242
+ "primaryKey": false,
243
+ "notNull": true
244
+ },
245
+ "created_at": {
246
+ "name": "created_at",
247
+ "type": "timestamp with time zone",
248
+ "primaryKey": false,
249
+ "notNull": true,
250
+ "default": "now()"
251
+ },
252
+ "dispatched_at": {
253
+ "name": "dispatched_at",
254
+ "type": "timestamp with time zone",
255
+ "primaryKey": false,
256
+ "notNull": false
257
+ },
258
+ "dispatch_attempts": {
259
+ "name": "dispatch_attempts",
260
+ "type": "integer",
261
+ "primaryKey": false,
262
+ "notNull": true,
263
+ "default": 0
264
+ },
265
+ "next_dispatch_at": {
266
+ "name": "next_dispatch_at",
267
+ "type": "timestamp with time zone",
268
+ "primaryKey": false,
269
+ "notNull": true,
270
+ "default": "now()"
271
+ },
272
+ "last_dispatch_error": {
273
+ "name": "last_dispatch_error",
274
+ "type": "jsonb",
275
+ "primaryKey": false,
276
+ "notNull": false
277
+ },
278
+ "last_dispatch_failed_at": {
279
+ "name": "last_dispatch_failed_at",
280
+ "type": "timestamp with time zone",
281
+ "primaryKey": false,
282
+ "notNull": false
283
+ },
284
+ "dead_lettered_at": {
285
+ "name": "dead_lettered_at",
286
+ "type": "timestamp with time zone",
287
+ "primaryKey": false,
288
+ "notNull": false
289
+ }
290
+ },
291
+ "indexes": {
292
+ "definitions_outbox_pending_idx": {
293
+ "name": "definitions_outbox_pending_idx",
294
+ "columns": [
295
+ {
296
+ "expression": "next_dispatch_at",
297
+ "isExpression": false,
298
+ "asc": true,
299
+ "nulls": "last"
300
+ },
301
+ {
302
+ "expression": "created_at",
303
+ "isExpression": false,
304
+ "asc": true,
305
+ "nulls": "last"
306
+ }
307
+ ],
308
+ "isUnique": false,
309
+ "where": "\"dispatched_at\" IS NULL AND \"dead_lettered_at\" IS NULL",
310
+ "concurrently": false,
311
+ "method": "btree",
312
+ "with": {}
313
+ },
314
+ "definitions_outbox_dispatched_retention_idx": {
315
+ "name": "definitions_outbox_dispatched_retention_idx",
316
+ "columns": [
317
+ {
318
+ "expression": "dispatched_at",
319
+ "isExpression": false,
320
+ "asc": true,
321
+ "nulls": "last"
322
+ },
323
+ {
324
+ "expression": "id",
325
+ "isExpression": false,
326
+ "asc": true,
327
+ "nulls": "last"
328
+ }
329
+ ],
330
+ "isUnique": false,
331
+ "where": "\"dispatched_at\" IS NOT NULL",
332
+ "concurrently": false,
333
+ "method": "btree",
334
+ "with": {}
335
+ }
336
+ },
337
+ "foreignKeys": {},
338
+ "compositePrimaryKeys": {},
339
+ "uniqueConstraints": {},
340
+ "policies": {},
341
+ "checkConstraints": {},
342
+ "isRLSEnabled": false
343
+ },
344
+ "public.definitions_sync_states": {
345
+ "name": "definitions_sync_states",
346
+ "schema": "",
347
+ "columns": {
348
+ "id": {
349
+ "name": "id",
350
+ "type": "uuid",
351
+ "primaryKey": true,
352
+ "notNull": true,
353
+ "default": "uuidv7()"
354
+ },
355
+ "project_id": {
356
+ "name": "project_id",
357
+ "type": "uuid",
358
+ "primaryKey": false,
359
+ "notNull": true
360
+ },
361
+ "source_connection_id": {
362
+ "name": "source_connection_id",
363
+ "type": "uuid",
364
+ "primaryKey": false,
365
+ "notNull": true
366
+ },
367
+ "source_external_repository_id": {
368
+ "name": "source_external_repository_id",
369
+ "type": "text",
370
+ "primaryKey": false,
371
+ "notNull": true
372
+ },
373
+ "ref": {
374
+ "name": "ref",
375
+ "type": "text",
376
+ "primaryKey": false,
377
+ "notNull": true
378
+ },
379
+ "status": {
380
+ "name": "status",
381
+ "type": "definitions_sync_status",
382
+ "typeSchema": "public",
383
+ "primaryKey": false,
384
+ "notNull": true,
385
+ "default": "'pending'"
386
+ },
387
+ "last_error_code": {
388
+ "name": "last_error_code",
389
+ "type": "definitions_sync_error_code",
390
+ "typeSchema": "public",
391
+ "primaryKey": false,
392
+ "notNull": false
393
+ },
394
+ "last_error_message": {
395
+ "name": "last_error_message",
396
+ "type": "text",
397
+ "primaryKey": false,
398
+ "notNull": false
399
+ },
400
+ "warnings": {
401
+ "name": "warnings",
402
+ "type": "jsonb",
403
+ "primaryKey": false,
404
+ "notNull": true,
405
+ "default": "'[]'::jsonb"
406
+ },
407
+ "started_at": {
408
+ "name": "started_at",
409
+ "type": "timestamp with time zone",
410
+ "primaryKey": false,
411
+ "notNull": false
412
+ },
413
+ "finished_at": {
414
+ "name": "finished_at",
415
+ "type": "timestamp with time zone",
416
+ "primaryKey": false,
417
+ "notNull": false
418
+ },
419
+ "created_at": {
420
+ "name": "created_at",
421
+ "type": "timestamp with time zone",
422
+ "primaryKey": false,
423
+ "notNull": true,
424
+ "default": "now()"
425
+ },
426
+ "updated_at": {
427
+ "name": "updated_at",
428
+ "type": "timestamp with time zone",
429
+ "primaryKey": false,
430
+ "notNull": true,
431
+ "default": "now()"
432
+ }
433
+ },
434
+ "indexes": {
435
+ "definitions_sync_states_source_unique": {
436
+ "name": "definitions_sync_states_source_unique",
437
+ "columns": [
438
+ {
439
+ "expression": "project_id",
440
+ "isExpression": false,
441
+ "asc": true,
442
+ "nulls": "last"
443
+ },
444
+ {
445
+ "expression": "source_connection_id",
446
+ "isExpression": false,
447
+ "asc": true,
448
+ "nulls": "last"
449
+ },
450
+ {
451
+ "expression": "source_external_repository_id",
452
+ "isExpression": false,
453
+ "asc": true,
454
+ "nulls": "last"
455
+ },
456
+ {
457
+ "expression": "ref",
458
+ "isExpression": false,
459
+ "asc": true,
460
+ "nulls": "last"
461
+ }
462
+ ],
463
+ "isUnique": true,
464
+ "concurrently": false,
465
+ "method": "btree",
466
+ "with": {}
467
+ },
468
+ "definitions_sync_states_failed_idx": {
469
+ "name": "definitions_sync_states_failed_idx",
470
+ "columns": [
471
+ {
472
+ "expression": "updated_at",
473
+ "isExpression": false,
474
+ "asc": true,
475
+ "nulls": "last"
476
+ }
477
+ ],
478
+ "isUnique": false,
479
+ "where": "\"status\" = 'failed'",
480
+ "concurrently": false,
481
+ "method": "btree",
482
+ "with": {}
483
+ }
484
+ },
485
+ "foreignKeys": {},
486
+ "compositePrimaryKeys": {},
487
+ "uniqueConstraints": {},
488
+ "policies": {},
489
+ "checkConstraints": {},
490
+ "isRLSEnabled": false
491
+ }
492
+ },
493
+ "enums": {
494
+ "public.definitions_source": {
495
+ "name": "definitions_source",
496
+ "schema": "public",
497
+ "values": ["manual", "vcs"]
498
+ },
499
+ "public.definitions_sync_error_code": {
500
+ "name": "definitions_sync_error_code",
501
+ "schema": "public",
502
+ "values": [
503
+ "no-workflow-files",
504
+ "invalid-definition",
505
+ "provider-repository-not-found",
506
+ "provider-file-not-found",
507
+ "provider-access-denied",
508
+ "provider-rate-limited",
509
+ "provider-timeout",
510
+ "provider-unavailable",
511
+ "provider-malformed-response",
512
+ "content-too-large",
513
+ "too-many-files",
514
+ "connection-unavailable",
515
+ "unknown"
516
+ ]
517
+ },
518
+ "public.definitions_sync_status": {
519
+ "name": "definitions_sync_status",
520
+ "schema": "public",
521
+ "values": ["pending", "syncing", "succeeded", "failed"]
522
+ }
523
+ },
524
+ "schemas": {},
525
+ "sequences": {},
526
+ "roles": {},
527
+ "policies": {},
528
+ "views": {},
529
+ "_meta": {
530
+ "columns": {},
531
+ "schemas": {},
532
+ "tables": {}
533
+ }
534
+ }
@@ -15,6 +15,13 @@
15
15
  "when": 1778494690000,
16
16
  "tag": "0001_definition_list_pagination",
17
17
  "breakpoints": true
18
+ },
19
+ {
20
+ "idx": 2,
21
+ "version": "7",
22
+ "when": 1785415305913,
23
+ "tag": "0002_lumpy_ben_parker",
24
+ "breakpoints": true
18
25
  }
19
26
  ]
20
27
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shipfox/api-definitions",
3
3
  "license": "MIT",
4
- "version": "11.0.0",
4
+ "version": "12.0.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ShipfoxHQ/shipfox.git",
@@ -26,25 +26,25 @@
26
26
  "js-yaml": "^4.1.0",
27
27
  "yaml": "^2.8.3",
28
28
  "zod": "^4.4.3",
29
- "@shipfox/api-agent-dto": "10.0.0",
30
- "@shipfox/api-auth-context": "11.0.0",
31
- "@shipfox/api-definitions-dto": "11.0.0",
32
- "@shipfox/api-integration-core-dto": "9.0.2",
33
- "@shipfox/api-projects-dto": "10.1.0",
34
- "@shipfox/api-secrets-dto": "9.0.2",
29
+ "@shipfox/api-agent-dto": "12.0.0",
30
+ "@shipfox/api-auth-context": "12.0.0",
31
+ "@shipfox/api-definitions-dto": "12.0.0",
32
+ "@shipfox/api-integration-core-dto": "12.0.0",
33
+ "@shipfox/api-projects-dto": "12.0.0",
34
+ "@shipfox/api-secrets-dto": "12.0.0",
35
35
  "@shipfox/config": "1.2.4",
36
- "@shipfox/expression": "1.2.1",
37
- "@shipfox/inter-module": "0.2.2",
38
- "@shipfox/node-drizzle": "0.3.4",
39
- "@shipfox/node-fastify": "0.4.0",
36
+ "@shipfox/expression": "2.0.0",
37
+ "@shipfox/inter-module": "0.2.3",
38
+ "@shipfox/node-drizzle": "0.3.5",
39
+ "@shipfox/node-fastify": "0.4.1",
40
40
  "@shipfox/node-error-monitoring": "0.3.0",
41
- "@shipfox/node-module": "1.0.4",
41
+ "@shipfox/node-module": "1.0.5",
42
42
  "@shipfox/node-opentelemetry": "0.6.3",
43
43
  "@shipfox/node-outbox": "0.2.6",
44
- "@shipfox/node-postgres": "0.4.4",
44
+ "@shipfox/node-postgres": "0.5.0",
45
45
  "@shipfox/node-temporal": "0.4.4",
46
46
  "@shipfox/runner-labels": "0.1.3",
47
- "@shipfox/workflow-document": "2.1.3"
47
+ "@shipfox/workflow-document": "3.0.0"
48
48
  },
49
49
  "imports": {
50
50
  "#*": "./dist/*"
@@ -1,4 +1,5 @@
1
1
  export * from './integration-context.js';
2
2
  export * from './sync-state.js';
3
+ export * from './validation-warning.js';
3
4
  export * from './workflow-definition.js';
4
5
  export * from './workflow-model.js';
@@ -1,5 +1,27 @@
1
+ import {
2
+ DEFINITION_SYNC_WARNING_CODE_MAX_LENGTH,
3
+ DEFINITION_SYNC_WARNING_MESSAGE_MAX_LENGTH,
4
+ DEFINITION_SYNC_WARNING_PATH_MAX_LENGTH,
5
+ DEFINITION_SYNC_WARNINGS_MAX_COUNT,
6
+ } from '@shipfox/api-definitions-dto';
7
+ import type {ValidationWarning} from './validation-warning.js';
8
+
1
9
  export type DefinitionSyncStatus = 'pending' | 'syncing' | 'succeeded' | 'failed';
2
10
 
11
+ export type DefinitionSyncWarning = ValidationWarning;
12
+
13
+ export function limitDefinitionSyncWarnings(
14
+ warnings: readonly DefinitionSyncWarning[],
15
+ ): DefinitionSyncWarning[] {
16
+ return warnings.slice(0, DEFINITION_SYNC_WARNINGS_MAX_COUNT).map((warning) => ({
17
+ code: warning.code.slice(0, DEFINITION_SYNC_WARNING_CODE_MAX_LENGTH),
18
+ message: warning.message.slice(0, DEFINITION_SYNC_WARNING_MESSAGE_MAX_LENGTH),
19
+ ...(warning.path === undefined
20
+ ? {}
21
+ : {path: warning.path.slice(0, DEFINITION_SYNC_WARNING_PATH_MAX_LENGTH)}),
22
+ }));
23
+ }
24
+
3
25
  export const DEFINITION_SYNC_ERROR_CODES = [
4
26
  'no-workflow-files',
5
27
  'invalid-definition',
@@ -33,6 +55,7 @@ export interface DefinitionSyncState {
33
55
  status: DefinitionSyncStatus;
34
56
  lastErrorCode: DefinitionSyncErrorCode | null;
35
57
  lastErrorMessage: string | null;
58
+ warnings: DefinitionSyncWarning[];
36
59
  startedAt: Date | null;
37
60
  finishedAt: Date | null;
38
61
  createdAt: Date;
@@ -0,0 +1,5 @@
1
+ export interface ValidationWarning {
2
+ code: string;
3
+ message: string;
4
+ path?: string | undefined;
5
+ }
@@ -0,0 +1,33 @@
1
+ import {agentValidationCatalog} from '#test/agent-validation-catalog.js';
2
+ import {parseDefinitionWithWarnings} from './parse-definition.js';
3
+ import {validateDefinition} from './validate-definition.js';
4
+
5
+ vi.mock('./validate-definition.js', () => ({
6
+ validateDefinition: vi.fn(),
7
+ }));
8
+
9
+ describe('parseDefinitionWithWarnings', () => {
10
+ it('returns warnings from successful validation', () => {
11
+ vi.mocked(validateDefinition).mockReturnValue({
12
+ valid: true,
13
+ definition: {document: {}, model: {}} as never,
14
+ warnings: [
15
+ {
16
+ code: 'synthetic-warning',
17
+ message: 'A non-fatal validation warning',
18
+ path: 'jobs.build.steps.0.run',
19
+ },
20
+ ],
21
+ });
22
+
23
+ const parsed = parseDefinitionWithWarnings('name: Workflow', {agentValidationCatalog});
24
+
25
+ expect(parsed.warnings).toEqual([
26
+ {
27
+ code: 'synthetic-warning',
28
+ message: 'A non-fatal validation warning',
29
+ path: 'jobs.build.steps.0.run',
30
+ },
31
+ ]);
32
+ });
33
+ });