@shipfox/api-definitions 12.3.0 → 14.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 (223) hide show
  1. package/.turbo/turbo-build.log +11 -11
  2. package/CHANGELOG.md +45 -0
  3. package/dist/core/entities/index.d.ts +1 -1
  4. package/dist/core/entities/index.d.ts.map +1 -1
  5. package/dist/core/entities/index.js +1 -1
  6. package/dist/core/entities/index.js.map +1 -1
  7. package/dist/core/entities/integration-context.d.ts +4 -0
  8. package/dist/core/entities/integration-context.d.ts.map +1 -1
  9. package/dist/core/entities/integration-context.js.map +1 -1
  10. package/dist/core/entities/sync-state.d.ts +10 -4
  11. package/dist/core/entities/sync-state.d.ts.map +1 -1
  12. package/dist/core/entities/sync-state.js +26 -7
  13. package/dist/core/entities/sync-state.js.map +1 -1
  14. package/dist/core/entities/validation-diagnostic.d.ts +8 -0
  15. package/dist/core/entities/validation-diagnostic.d.ts.map +1 -0
  16. package/dist/core/entities/validation-diagnostic.js +3 -0
  17. package/dist/core/entities/validation-diagnostic.js.map +1 -0
  18. package/dist/core/entities/workflow-definition.d.ts +2 -0
  19. package/dist/core/entities/workflow-definition.d.ts.map +1 -1
  20. package/dist/core/entities/workflow-definition.js.map +1 -1
  21. package/dist/core/errors.d.ts +10 -0
  22. package/dist/core/errors.d.ts.map +1 -1
  23. package/dist/core/errors.js +9 -0
  24. package/dist/core/errors.js.map +1 -1
  25. package/dist/core/index.d.ts +2 -1
  26. package/dist/core/index.d.ts.map +1 -1
  27. package/dist/core/index.js +2 -1
  28. package/dist/core/index.js.map +1 -1
  29. package/dist/core/integrations.d.ts +3 -1
  30. package/dist/core/integrations.d.ts.map +1 -1
  31. package/dist/core/integrations.js +10 -2
  32. package/dist/core/integrations.js.map +1 -1
  33. package/dist/core/parse-definition.d.ts +4 -4
  34. package/dist/core/parse-definition.d.ts.map +1 -1
  35. package/dist/core/parse-definition.js +5 -5
  36. package/dist/core/parse-definition.js.map +1 -1
  37. package/dist/core/resolve-definition-at-ref.d.ts +66 -0
  38. package/dist/core/resolve-definition-at-ref.d.ts.map +1 -0
  39. package/dist/core/resolve-definition-at-ref.js +374 -0
  40. package/dist/core/resolve-definition-at-ref.js.map +1 -0
  41. package/dist/core/sync-definitions.d.ts +2 -2
  42. package/dist/core/sync-definitions.d.ts.map +1 -1
  43. package/dist/core/sync-definitions.js +5 -5
  44. package/dist/core/sync-definitions.js.map +1 -1
  45. package/dist/core/validate-definition.d.ts +3 -3
  46. package/dist/core/validate-definition.d.ts.map +1 -1
  47. package/dist/core/validate-definition.js +17 -12
  48. package/dist/core/validate-definition.js.map +1 -1
  49. package/dist/core/workflow-model/cron-trigger.d.ts +1 -1
  50. package/dist/core/workflow-model/cron-trigger.d.ts.map +1 -1
  51. package/dist/core/workflow-model/cron-trigger.js +9 -5
  52. package/dist/core/workflow-model/cron-trigger.js.map +1 -1
  53. package/dist/core/workflow-model/index.d.ts +1 -1
  54. package/dist/core/workflow-model/index.d.ts.map +1 -1
  55. package/dist/core/workflow-model/index.js.map +1 -1
  56. package/dist/core/workflow-model/invalid-workflow-model-error.d.ts +4 -2
  57. package/dist/core/workflow-model/invalid-workflow-model-error.d.ts.map +1 -1
  58. package/dist/core/workflow-model/invalid-workflow-model-error.js.map +1 -1
  59. package/dist/core/workflow-model/normalize-job-listening.d.ts.map +1 -1
  60. package/dist/core/workflow-model/normalize-job-listening.js +51 -30
  61. package/dist/core/workflow-model/normalize-job-listening.js.map +1 -1
  62. package/dist/core/workflow-model/normalize-triggers.d.ts +1 -1
  63. package/dist/core/workflow-model/normalize-triggers.d.ts.map +1 -1
  64. package/dist/core/workflow-model/normalize-triggers.js +48 -18
  65. package/dist/core/workflow-model/normalize-triggers.js.map +1 -1
  66. package/dist/core/workflow-model/normalize-workflow-document.d.ts +1 -1
  67. package/dist/core/workflow-model/normalize-workflow-document.d.ts.map +1 -1
  68. package/dist/core/workflow-model/normalize-workflow-document.js +3 -3
  69. package/dist/core/workflow-model/normalize-workflow-document.js.map +1 -1
  70. package/dist/core/workflow-model/parse-interpolation-field.d.ts.map +1 -1
  71. package/dist/core/workflow-model/parse-interpolation-field.js +1 -15
  72. package/dist/core/workflow-model/parse-interpolation-field.js.map +1 -1
  73. package/dist/core/workflow-model/validate-predicate-expression.d.ts +3 -1
  74. package/dist/core/workflow-model/validate-predicate-expression.d.ts.map +1 -1
  75. package/dist/core/workflow-model/validate-predicate-expression.js +3 -0
  76. package/dist/core/workflow-model/validate-predicate-expression.js.map +1 -1
  77. package/dist/core/workflow-model/validation-issue.d.ts +2 -1
  78. package/dist/core/workflow-model/validation-issue.d.ts.map +1 -1
  79. package/dist/core/workflow-model/validation-issue.js +12 -15
  80. package/dist/core/workflow-model/validation-issue.js.map +1 -1
  81. package/dist/db/db.d.ts +196 -4
  82. package/dist/db/db.d.ts.map +1 -1
  83. package/dist/db/db.js +3 -1
  84. package/dist/db/db.js.map +1 -1
  85. package/dist/db/definition-triggers.js +3 -1
  86. package/dist/db/definition-triggers.js.map +1 -1
  87. package/dist/db/definitions.d.ts +17 -0
  88. package/dist/db/definitions.d.ts.map +1 -1
  89. package/dist/db/definitions.js +190 -23
  90. package/dist/db/definitions.js.map +1 -1
  91. package/dist/db/index.d.ts +2 -1
  92. package/dist/db/index.d.ts.map +1 -1
  93. package/dist/db/index.js +2 -1
  94. package/dist/db/index.js.map +1 -1
  95. package/dist/db/schema/definitions.d.ts +17 -0
  96. package/dist/db/schema/definitions.d.ts.map +1 -1
  97. package/dist/db/schema/definitions.js +8 -0
  98. package/dist/db/schema/definitions.js.map +1 -1
  99. package/dist/db/schema/sync-states.d.ts +7 -3
  100. package/dist/db/schema/sync-states.d.ts.map +1 -1
  101. package/dist/db/schema/sync-states.js +5 -1
  102. package/dist/db/schema/sync-states.js.map +1 -1
  103. package/dist/db/schema/workflows.d.ts +78 -0
  104. package/dist/db/schema/workflows.d.ts.map +1 -0
  105. package/dist/db/schema/workflows.js +17 -0
  106. package/dist/db/schema/workflows.js.map +1 -0
  107. package/dist/db/sync-states.d.ts +2 -2
  108. package/dist/db/sync-states.d.ts.map +1 -1
  109. package/dist/db/sync-states.js +4 -4
  110. package/dist/db/sync-states.js.map +1 -1
  111. package/dist/index.d.ts.map +1 -1
  112. package/dist/index.js +5 -1
  113. package/dist/index.js.map +1 -1
  114. package/dist/metrics/index.d.ts +2 -0
  115. package/dist/metrics/index.d.ts.map +1 -0
  116. package/dist/metrics/index.js +3 -0
  117. package/dist/metrics/index.js.map +1 -0
  118. package/dist/metrics/instance.d.ts +4 -0
  119. package/dist/metrics/instance.d.ts.map +1 -0
  120. package/dist/metrics/instance.js +19 -0
  121. package/dist/metrics/instance.js.map +1 -0
  122. package/dist/presentation/dto/definition.d.ts.map +1 -1
  123. package/dist/presentation/dto/definition.js +11 -4
  124. package/dist/presentation/dto/definition.js.map +1 -1
  125. package/dist/presentation/inter-module.d.ts +9 -1
  126. package/dist/presentation/inter-module.d.ts.map +1 -1
  127. package/dist/presentation/inter-module.js +66 -2
  128. package/dist/presentation/inter-module.js.map +1 -1
  129. package/dist/presentation/routes/create-definition.d.ts.map +1 -1
  130. package/dist/presentation/routes/create-definition.js +16 -3
  131. package/dist/presentation/routes/create-definition.js.map +1 -1
  132. package/dist/presentation/routes/get-definition.d.ts.map +1 -1
  133. package/dist/presentation/routes/get-definition.js +18 -4
  134. package/dist/presentation/routes/get-definition.js.map +1 -1
  135. package/dist/presentation/routes/project-access.d.ts +1 -0
  136. package/dist/presentation/routes/project-access.d.ts.map +1 -1
  137. package/dist/presentation/routes/validate-definition.js +3 -3
  138. package/dist/presentation/routes/validate-definition.js.map +1 -1
  139. package/dist/temporal/activities/sync-activities.d.ts +3 -3
  140. package/dist/temporal/activities/sync-activities.d.ts.map +1 -1
  141. package/dist/temporal/activities/sync-activities.js +7 -4
  142. package/dist/temporal/activities/sync-activities.js.map +1 -1
  143. package/dist/temporal/workflows/definition-sync.js +1 -1
  144. package/dist/temporal/workflows/definition-sync.js.map +1 -1
  145. package/dist/temporal/workflows/index.bundle.js +50 -22
  146. package/dist/tsconfig.test.tsbuildinfo +1 -1
  147. package/drizzle/0003_nebulous_nemesis.sql +11 -0
  148. package/drizzle/0004_workflow_ref_lookup.sql +1 -0
  149. package/drizzle/meta/0003_snapshot.json +627 -0
  150. package/drizzle/meta/0004_snapshot.json +649 -0
  151. package/drizzle/meta/_journal.json +14 -0
  152. package/drizzle.config.ts +1 -0
  153. package/package.json +7 -7
  154. package/src/core/entities/index.ts +1 -1
  155. package/src/core/entities/integration-context.ts +4 -0
  156. package/src/core/entities/sync-state.test.ts +49 -0
  157. package/src/core/entities/sync-state.ts +35 -12
  158. package/src/core/entities/validation-diagnostic.ts +8 -0
  159. package/src/core/entities/workflow-definition.ts +2 -0
  160. package/src/core/errors.ts +26 -0
  161. package/src/core/index.ts +12 -0
  162. package/src/core/integrations.test.ts +38 -0
  163. package/src/core/integrations.ts +10 -1
  164. package/src/core/parse-definition-diagnostics.test.ts +47 -0
  165. package/src/core/parse-definition.test.ts +29 -5
  166. package/src/core/parse-definition.ts +7 -7
  167. package/src/core/resolve-definition-at-ref.test.ts +792 -0
  168. package/src/core/resolve-definition-at-ref.ts +551 -0
  169. package/src/core/sync-definitions.test.ts +61 -2
  170. package/src/core/sync-definitions.ts +7 -7
  171. package/src/core/validate-definition.test.ts +31 -22
  172. package/src/core/validate-definition.ts +21 -13
  173. package/src/core/workflow-model/cron-trigger.ts +6 -2
  174. package/src/core/workflow-model/index.ts +1 -0
  175. package/src/core/workflow-model/invalid-workflow-model-error.ts +5 -1
  176. package/src/core/workflow-model/normalize-job-listening.ts +55 -23
  177. package/src/core/workflow-model/normalize-triggers.ts +44 -15
  178. package/src/core/workflow-model/normalize-workflow-document.test.ts +494 -36
  179. package/src/core/workflow-model/normalize-workflow-document.ts +8 -4
  180. package/src/core/workflow-model/parse-interpolation-field.ts +1 -23
  181. package/src/core/workflow-model/validate-predicate-expression.ts +6 -0
  182. package/src/core/workflow-model/validation-issue.ts +8 -13
  183. package/src/db/db.ts +7 -1
  184. package/src/db/definition-triggers.test.ts +44 -0
  185. package/src/db/definition-triggers.ts +1 -1
  186. package/src/db/definitions.test.ts +300 -1
  187. package/src/db/definitions.ts +282 -28
  188. package/src/db/index.ts +2 -0
  189. package/src/db/schema/definitions.test.ts +1 -0
  190. package/src/db/schema/definitions.ts +11 -0
  191. package/src/db/schema/sync-states.ts +12 -3
  192. package/src/db/schema/workflows.ts +23 -0
  193. package/src/db/sync-states.test.ts +87 -18
  194. package/src/db/sync-states.ts +6 -6
  195. package/src/db/workflow-lineage-migration.test.ts +158 -0
  196. package/src/index.ts +3 -1
  197. package/src/metrics/index.ts +1 -0
  198. package/src/metrics/instance.test.ts +50 -0
  199. package/src/metrics/instance.ts +23 -0
  200. package/src/presentation/dto/definition.test.ts +89 -1
  201. package/src/presentation/dto/definition.ts +8 -5
  202. package/src/presentation/inter-module.test.ts +177 -0
  203. package/src/presentation/inter-module.ts +77 -4
  204. package/src/presentation/routes/create-definition.test.ts +38 -0
  205. package/src/presentation/routes/create-definition.ts +20 -3
  206. package/src/presentation/routes/get-definition.test.ts +125 -11
  207. package/src/presentation/routes/get-definition.ts +21 -4
  208. package/src/presentation/routes/list-definitions.test.ts +1 -1
  209. package/src/presentation/routes/validate-definition.test.ts +1 -1
  210. package/src/presentation/routes/validate-definition.ts +3 -3
  211. package/src/presentation/subscribers/on-integration-connection-available.test.ts +3 -0
  212. package/src/temporal/activities/sync-activities.test.ts +46 -2
  213. package/src/temporal/activities/sync-activities.ts +9 -7
  214. package/src/temporal/workflows/definition-sync.ts +1 -1
  215. package/test/factories/definition.ts +1 -0
  216. package/test/globalSetup.ts +2 -0
  217. package/tsconfig.build.tsbuildinfo +1 -1
  218. package/dist/core/entities/validation-warning.d.ts +0 -6
  219. package/dist/core/entities/validation-warning.d.ts.map +0 -1
  220. package/dist/core/entities/validation-warning.js +0 -3
  221. package/dist/core/entities/validation-warning.js.map +0 -1
  222. package/src/core/entities/validation-warning.ts +0 -5
  223. package/src/core/parse-definition-warnings.test.ts +0 -33
@@ -5,13 +5,13 @@ import { InvalidWorkflowYamlError, parseWorkflowYamlWithLocations } from './work
5
5
  export function validateDefinition(yamlContent, options) {
6
6
  try {
7
7
  const { document, stepSourceLocations } = parseWorkflowYamlWithLocations(yamlContent);
8
- const warnings = [];
8
+ const diagnostics = [];
9
9
  const model = normalizeWorkflowDocument(document, {
10
10
  defaultRunnerLabels: options.defaultRunnerLabels ?? definitionDefaultRunnerLabels,
11
11
  agentValidationCatalog: options.agentValidationCatalog,
12
12
  integrationValidationContext: options.integrationValidationContext,
13
13
  stepSourceLocations,
14
- warnings
14
+ diagnostics
15
15
  });
16
16
  return {
17
17
  valid: true,
@@ -19,7 +19,7 @@ export function validateDefinition(yamlContent, options) {
19
19
  document,
20
20
  model
21
21
  },
22
- warnings: validationWarningsFor(warnings)
22
+ diagnostics: validationDiagnosticsFor(diagnostics)
23
23
  };
24
24
  } catch (error) {
25
25
  return {
@@ -28,11 +28,12 @@ export function validateDefinition(yamlContent, options) {
28
28
  };
29
29
  }
30
30
  }
31
- function validationWarningsFor(issues) {
32
- return issues.map((issue)=>validationWarning({
31
+ function validationDiagnosticsFor(issues) {
32
+ return issues.map((issue)=>validationDiagnostic({
33
33
  code: issue.code,
34
34
  message: issue.message,
35
- path: issue.path.join('.') || undefined
35
+ path: issue.path.join('.') || undefined,
36
+ severity: issue.severity
36
37
  }));
37
38
  }
38
39
  function validationErrorsFor(error) {
@@ -67,15 +68,19 @@ function validationError(params) {
67
68
  path: params.path
68
69
  };
69
70
  }
70
- function validationWarning(params) {
71
- if (params.path === undefined) return {
72
- code: params.code,
73
- message: params.message
74
- };
71
+ function validationDiagnostic(params) {
72
+ if (params.path === undefined) {
73
+ return {
74
+ code: params.code,
75
+ message: params.message,
76
+ severity: params.severity
77
+ };
78
+ }
75
79
  return {
76
80
  code: params.code,
77
81
  message: params.message,
78
- path: params.path
82
+ path: params.path,
83
+ severity: params.severity
79
84
  };
80
85
  }
81
86
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/validate-definition.ts"],"sourcesContent":["import type {AgentValidationCatalog} from '@shipfox/api-agent-dto/inter-module';\nimport {InvalidWorkflowDocumentError} from '@shipfox/workflow-document';\nimport {definitionDefaultRunnerLabels} from '../config.js';\nimport type {IntegrationValidationContext} from './entities/integration-context.js';\nimport type {ValidationWarning} from './entities/validation-warning.js';\nimport type {WorkflowDefinitionPayload} from './entities/workflow-definition.js';\nimport {\n InvalidWorkflowModelError,\n normalizeWorkflowDocument,\n type WorkflowModelValidationIssue,\n} from './workflow-model/index.js';\nimport {InvalidWorkflowYamlError, parseWorkflowYamlWithLocations} from './workflow-yaml/index.js';\n\nexport type ValidationError = {message: string; path?: string | undefined};\nexport type {ValidationWarning} from './entities/validation-warning.js';\n\nexport interface DefinitionValidationOptions {\n defaultRunnerLabels?: readonly string[];\n agentValidationCatalog: AgentValidationCatalog;\n integrationValidationContext?: IntegrationValidationContext;\n}\n\nexport type ValidationResult =\n | {valid: true; definition: WorkflowDefinitionPayload; warnings: ValidationWarning[]}\n | {valid: false; errors: ValidationError[]};\n\nexport function validateDefinition(\n yamlContent: string,\n options: DefinitionValidationOptions,\n): ValidationResult {\n try {\n const {document, stepSourceLocations} = parseWorkflowYamlWithLocations(yamlContent);\n const warnings: WorkflowModelValidationIssue[] = [];\n const model = normalizeWorkflowDocument(document, {\n defaultRunnerLabels: options.defaultRunnerLabels ?? definitionDefaultRunnerLabels,\n agentValidationCatalog: options.agentValidationCatalog,\n integrationValidationContext: options.integrationValidationContext,\n stepSourceLocations,\n warnings,\n });\n return {valid: true, definition: {document, model}, warnings: validationWarningsFor(warnings)};\n } catch (error) {\n return {valid: false, errors: validationErrorsFor(error)};\n }\n}\n\nfunction validationWarningsFor(\n issues: readonly WorkflowModelValidationIssue[],\n): ValidationWarning[] {\n return issues.map((issue) =>\n validationWarning({\n code: issue.code,\n message: issue.message,\n path: issue.path.join('.') || undefined,\n }),\n );\n}\n\nfunction validationErrorsFor(error: unknown): ValidationError[] {\n if (error instanceof InvalidWorkflowYamlError) {\n return [\n validationError({\n message: error.message,\n path:\n error.location === undefined\n ? undefined\n : `${error.location.line}:${error.location.column}`,\n }),\n ];\n }\n\n if (error instanceof InvalidWorkflowDocumentError) {\n return error.validationError.issues.map((issue) =>\n validationError({\n message: issue.message,\n path: issue.path.join('.') || undefined,\n }),\n );\n }\n\n if (error instanceof InvalidWorkflowModelError) {\n return error.issues.map((issue) =>\n validationError({message: issue.message, path: issue.path.join('.')}),\n );\n }\n\n throw error;\n}\n\nfunction validationError(params: {message: string; path?: string | undefined}): ValidationError {\n if (params.path === undefined) return {message: params.message};\n return {message: params.message, path: params.path};\n}\n\nfunction validationWarning(params: {\n code: string;\n message: string;\n path?: string | undefined;\n}): ValidationWarning {\n if (params.path === undefined) return {code: params.code, message: params.message};\n return {code: params.code, message: params.message, path: params.path};\n}\n"],"names":["InvalidWorkflowDocumentError","definitionDefaultRunnerLabels","InvalidWorkflowModelError","normalizeWorkflowDocument","InvalidWorkflowYamlError","parseWorkflowYamlWithLocations","validateDefinition","yamlContent","options","document","stepSourceLocations","warnings","model","defaultRunnerLabels","agentValidationCatalog","integrationValidationContext","valid","definition","validationWarningsFor","error","errors","validationErrorsFor","issues","map","issue","validationWarning","code","message","path","join","undefined","validationError","location","line","column","params"],"mappings":"AACA,SAAQA,4BAA4B,QAAO,6BAA6B;AACxE,SAAQC,6BAA6B,QAAO,eAAe;AAI3D,SACEC,yBAAyB,EACzBC,yBAAyB,QAEpB,4BAA4B;AACnC,SAAQC,wBAAwB,EAAEC,8BAA8B,QAAO,2BAA2B;AAelG,OAAO,SAASC,mBACdC,WAAmB,EACnBC,OAAoC;IAEpC,IAAI;QACF,MAAM,EAACC,QAAQ,EAAEC,mBAAmB,EAAC,GAAGL,+BAA+BE;QACvE,MAAMI,WAA2C,EAAE;QACnD,MAAMC,QAAQT,0BAA0BM,UAAU;YAChDI,qBAAqBL,QAAQK,mBAAmB,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ACH,SAASQ,OAAOR,OAAO;IAAA;IAC9D,OAAO;QAACA,SAASQ,OAAOR,OAAO;QAAEC,MAAMO,OAAOP,IAAI;IAAA;AACpD;AAEA,SAASH,kBAAkBU,MAI1B;IACC,IAAIA,OAAOP,IAAI,KAAKE,WAAW,OAAO;QAACJ,MAAMS,OAAOT,IAAI;QAAEC,SAASQ,OAAOR,OAAO;IAAA;IACjF,OAAO;QAACD,MAAMS,OAAOT,IAAI;QAAEC,SAASQ,OAAOR,OAAO;QAAEC,MAAMO,OAAOP,IAAI;IAAA;AACvE"}
1
+ {"version":3,"sources":["../../src/core/validate-definition.ts"],"sourcesContent":["import type {AgentValidationCatalog} from '@shipfox/api-agent-dto/inter-module';\nimport {InvalidWorkflowDocumentError} from '@shipfox/workflow-document';\nimport {definitionDefaultRunnerLabels} from '../config.js';\nimport type {IntegrationValidationContext} from './entities/integration-context.js';\nimport type {ValidationDiagnostic} from './entities/validation-diagnostic.js';\nimport type {WorkflowDefinitionPayload} from './entities/workflow-definition.js';\nimport {\n InvalidWorkflowModelError,\n normalizeWorkflowDocument,\n type WorkflowModelValidationIssue,\n} from './workflow-model/index.js';\nimport {InvalidWorkflowYamlError, parseWorkflowYamlWithLocations} from './workflow-yaml/index.js';\n\nexport type ValidationError = {message: string; path?: string | undefined};\nexport type {ValidationDiagnostic} from './entities/validation-diagnostic.js';\n\nexport interface DefinitionValidationOptions {\n defaultRunnerLabels?: readonly string[];\n agentValidationCatalog: AgentValidationCatalog;\n integrationValidationContext?: IntegrationValidationContext;\n}\n\nexport type ValidationResult =\n | {valid: true; definition: WorkflowDefinitionPayload; diagnostics: ValidationDiagnostic[]}\n | {valid: false; errors: ValidationError[]};\n\nexport function validateDefinition(\n yamlContent: string,\n options: DefinitionValidationOptions,\n): ValidationResult {\n try {\n const {document, stepSourceLocations} = parseWorkflowYamlWithLocations(yamlContent);\n const diagnostics: WorkflowModelValidationIssue[] = [];\n const model = normalizeWorkflowDocument(document, {\n defaultRunnerLabels: options.defaultRunnerLabels ?? definitionDefaultRunnerLabels,\n agentValidationCatalog: options.agentValidationCatalog,\n integrationValidationContext: options.integrationValidationContext,\n stepSourceLocations,\n diagnostics,\n });\n return {\n valid: true,\n definition: {document, model},\n diagnostics: validationDiagnosticsFor(diagnostics),\n };\n } catch (error) {\n return {valid: false, errors: validationErrorsFor(error)};\n }\n}\n\nfunction validationDiagnosticsFor(\n issues: readonly WorkflowModelValidationIssue[],\n): ValidationDiagnostic[] {\n return issues.map((issue) =>\n validationDiagnostic({\n code: issue.code,\n message: issue.message,\n path: issue.path.join('.') || undefined,\n severity: issue.severity,\n }),\n );\n}\n\nfunction validationErrorsFor(error: unknown): ValidationError[] {\n if (error instanceof InvalidWorkflowYamlError) {\n return [\n validationError({\n message: error.message,\n path:\n error.location === undefined\n ? undefined\n : `${error.location.line}:${error.location.column}`,\n }),\n ];\n }\n\n if (error instanceof InvalidWorkflowDocumentError) {\n return error.validationError.issues.map((issue) =>\n validationError({\n message: issue.message,\n path: issue.path.join('.') || undefined,\n }),\n );\n }\n\n if (error instanceof InvalidWorkflowModelError) {\n return error.issues.map((issue) =>\n validationError({message: issue.message, path: issue.path.join('.')}),\n );\n }\n\n throw error;\n}\n\nfunction validationError(params: {message: string; path?: string | undefined}): ValidationError {\n if (params.path === undefined) return {message: params.message};\n return {message: params.message, path: params.path};\n}\n\nfunction validationDiagnostic(params: {\n code: string;\n message: string;\n path?: string | undefined;\n severity: 'error' | 'warning';\n}): ValidationDiagnostic {\n if (params.path === undefined) {\n return {code: params.code, message: params.message, severity: params.severity};\n }\n return {code: params.code, message: params.message, path: params.path, severity: params.severity};\n}\n"],"names":["InvalidWorkflowDocumentError","definitionDefaultRunnerLabels","InvalidWorkflowModelError","normalizeWorkflowDocument","InvalidWorkflowYamlError","parseWorkflowYamlWithLocations","validateDefinition","yamlContent","options","document","stepSourceLocations","diagnostics","model","defaultRunnerLabels","agentValidationCatalog","integrationValidationContext","valid","definition","validationDiagnosticsFor","error","errors","validationErrorsFor","issues","map","issue","validationDiagnostic","code","message","path","join","undefined","severity","validationError","location","line","column","params"],"mappings":"AACA,SAAQA,4BAA4B,QAAO,6BAA6B;AACxE,SAAQC,6BAA6B,QAAO,eAAe;AAI3D,SACEC,yBAAyB,EACzBC,yBAAyB,QAEpB,4BAA4B;AACnC,SAAQC,wBAAwB,EAAEC,8BAA8B,QAAO,2BAA2B;AAelG,OAAO,SAASC,mBACdC,WAAmB,EACnBC,OAAoC;IAEpC,IAAI;QACF,MAAM,EAACC,QAAQ,EAAEC,mBAAmB,EAAC,GAAGL,+BAA+BE;QACvE,MAAMI,cAA8C,EAAE;QACtD,MAAMC,QAAQT,0BAA0BM,UAAU;YAChDI,qBAAqBL,QAAQK,mBAAmB,IAAIZ;YACpDa,wBAAwBN,QAAQM,sBAAsB;YACtDC,8BAA8BP,QAAQO,4BAA4B;YAClEL;YACAC;QACF;QACA,OAAO;YACLK,OAAO;YACPC,YAAY;gBAACR;gBAAUG;YAAK;YAC5BD,aAAaO,yBAAyBP;QACxC;IACF,EAAE,OAAOQ,OAAO;QACd,OAAO;YAACH,OAAO;YAAOI,QAAQC,oBAAoBF;QAAM;IAC1D;AACF;AAEA,SAASD,yBACPI,MAA+C;IAE/C,OAAOA,OAAOC,GAAG,CAAC,CAACC,QACjBC,qBAAqB;YACnBC,MAAMF,MAAME,IAAI;YAChBC,SAASH,MAAMG,OAAO;YACtBC,MAAMJ,MAAMI,IAAI,CAACC,IAAI,CAAC,QAAQC;YAC9BC,UAAUP,MAAMO,QAAQ;QAC1B;AAEJ;AAEA,SAASV,oBAAoBF,KAAc;IACzC,IAAIA,iBAAiBf,0BAA0B;QAC7C,OAAO;YACL4B,gBAAgB;gBACdL,SAASR,MAAMQ,OAAO;gBACtBC,MACET,MAAMc,QAAQ,KAAKH,YACfA,YACA,GAAGX,MAAMc,QAAQ,CAACC,IAAI,CAAC,CAAC,EAAEf,MAAMc,QAAQ,CAACE,MAAM,EAAE;YACzD;SACD;IACH;IAEA,IAAIhB,iBAAiBnB,8BAA8B;QACjD,OAAOmB,MAAMa,eAAe,CAACV,MAAM,CAACC,GAAG,CAAC,CAACC,QACvCQ,gBAAgB;gBACdL,SAASH,MAAMG,OAAO;gBACtBC,MAAMJ,MAAMI,IAAI,CAACC,IAAI,CAAC,QAAQC;YAChC;IAEJ;IAEA,IAAIX,iBAAiBjB,2BAA2B;QAC9C,OAAOiB,MAAMG,MAAM,CAACC,GAAG,CAAC,CAACC,QACvBQ,gBAAgB;gBAACL,SAASH,MAAMG,OAAO;gBAAEC,MAAMJ,MAAMI,IAAI,CAACC,IAAI,CAAC;YAAI;IAEvE;IAEA,MAAMV;AACR;AAEA,SAASa,gBAAgBI,MAAoD;IAC3E,IAAIA,OAAOR,IAAI,KAAKE,WAAW,OAAO;QAACH,SAASS,OAAOT,OAAO;IAAA;IAC9D,OAAO;QAACA,SAASS,OAAOT,OAAO;QAAEC,MAAMQ,OAAOR,IAAI;IAAA;AACpD;AAEA,SAASH,qBAAqBW,MAK7B;IACC,IAAIA,OAAOR,IAAI,KAAKE,WAAW;QAC7B,OAAO;YAACJ,MAAMU,OAAOV,IAAI;YAAEC,SAASS,OAAOT,OAAO;YAAEI,UAAUK,OAAOL,QAAQ;QAAA;IAC/E;IACA,OAAO;QAACL,MAAMU,OAAOV,IAAI;QAAEC,SAASS,OAAOT,OAAO;QAAEC,MAAMQ,OAAOR,IAAI;QAAEG,UAAUK,OAAOL,QAAQ;IAAA;AAClG"}
@@ -3,7 +3,7 @@ export declare const cronTriggerDefaultTimezone = "UTC";
3
3
  export declare function validateCronTrigger(params: {
4
4
  readonly sourceKey: string;
5
5
  readonly trigger: {
6
- readonly event: string;
6
+ readonly event?: string | undefined;
7
7
  };
8
8
  readonly config: {
9
9
  readonly schedule?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"cron-trigger.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/cron-trigger.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,4BAA4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CA+CP;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAWjE;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAOzD"}
@@ -4,7 +4,7 @@ export const cronTriggerDefaultTimezone = 'UTC';
4
4
  const cronFieldSeparatorRegex = /\s+/;
5
5
  export function validateCronTrigger(params) {
6
6
  const { sourceKey, trigger, config, issues } = params;
7
- if (trigger.event !== 'tick') {
7
+ if (trigger.event !== undefined && trigger.event !== 'tick') {
8
8
  issues.push(issue({
9
9
  code: 'invalid-cron-event',
10
10
  message: `A cron trigger must use event "tick"; found "${trigger.event}".`,
@@ -15,7 +15,8 @@ export function validateCronTrigger(params) {
15
15
  ],
16
16
  details: {
17
17
  event: trigger.event
18
- }
18
+ },
19
+ scope: 'trigger'
19
20
  }));
20
21
  }
21
22
  if (config.schedule === undefined) {
@@ -27,7 +28,8 @@ export function validateCronTrigger(params) {
27
28
  sourceKey,
28
29
  'config',
29
30
  'schedule'
30
- ]
31
+ ],
32
+ scope: 'trigger'
31
33
  }));
32
34
  } else if (!isValidCronExpression(config.schedule)) {
33
35
  issues.push(issue({
@@ -41,7 +43,8 @@ export function validateCronTrigger(params) {
41
43
  ],
42
44
  details: {
43
45
  schedule: config.schedule
44
- }
46
+ },
47
+ scope: 'trigger'
45
48
  }));
46
49
  }
47
50
  if (config.timezone !== undefined && !isValidTimezone(config.timezone)) {
@@ -56,7 +59,8 @@ export function validateCronTrigger(params) {
56
59
  ],
57
60
  details: {
58
61
  timezone: config.timezone
59
- }
62
+ },
63
+ scope: 'trigger'
60
64
  }));
61
65
  }
62
66
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/workflow-model/cron-trigger.ts"],"sourcesContent":["import {CronExpressionParser} from 'cron-parser';\nimport type {WorkflowModelValidationIssue} from './invalid-workflow-model-error.js';\nimport {issue} from './validation-issue.js';\n\nexport const cronTriggerDefaultTimezone = 'UTC';\nconst cronFieldSeparatorRegex = /\\s+/;\n\nexport function validateCronTrigger(params: {\n readonly sourceKey: string;\n readonly trigger: {\n readonly event: string;\n };\n readonly config: {\n readonly schedule?: string | undefined;\n readonly timezone?: string | undefined;\n };\n readonly issues: WorkflowModelValidationIssue[];\n}): void {\n const {sourceKey, trigger, config, issues} = params;\n\n if (trigger.event !== 'tick') {\n issues.push(\n issue({\n code: 'invalid-cron-event',\n message: `A cron trigger must use event \"tick\"; found \"${trigger.event}\".`,\n path: ['triggers', sourceKey, 'event'],\n details: {event: trigger.event},\n }),\n );\n }\n\n if (config.schedule === undefined) {\n issues.push(\n issue({\n code: 'missing-cron-schedule',\n message: 'A cron trigger requires a schedule.',\n path: ['triggers', sourceKey, 'config', 'schedule'],\n }),\n );\n } else if (!isValidCronExpression(config.schedule)) {\n issues.push(\n issue({\n code: 'invalid-cron-schedule',\n message: 'Cron trigger schedule must be a valid 5-field cron expression.',\n path: ['triggers', sourceKey, 'config', 'schedule'],\n details: {schedule: config.schedule},\n }),\n );\n }\n\n if (config.timezone !== undefined && !isValidTimezone(config.timezone)) {\n issues.push(\n issue({\n code: 'invalid-cron-timezone',\n message: 'Cron trigger timezone must be a valid IANA time zone.',\n path: ['triggers', sourceKey, 'config', 'timezone'],\n details: {timezone: config.timezone},\n }),\n );\n }\n}\n\nexport function isValidCronExpression(expression: string): boolean {\n const trimmedExpression = expression.trim();\n if (trimmedExpression.length === 0) return false;\n if (trimmedExpression.split(cronFieldSeparatorRegex).length !== 5) return false;\n\n try {\n CronExpressionParser.parse(trimmedExpression);\n return true;\n } catch {\n return false;\n }\n}\n\nexport function isValidTimezone(timezone: string): boolean {\n try {\n new Intl.DateTimeFormat('en-US', {timeZone: timezone});\n return true;\n } catch {\n return false;\n }\n}\n"],"names":["CronExpressionParser","issue","cronTriggerDefaultTimezone","cronFieldSeparatorRegex","validateCronTrigger","params","sourceKey","trigger","config","issues","event","push","code","message","path","details","schedule","undefined","isValidCronExpression","timezone","isValidTimezone","expression","trimmedEx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AAI;IACzC,IAAID,kBAAkBE,MAAM,KAAK,GAAG,OAAO;IAC3C,IAAIF,kBAAkBG,KAAK,CAACtB,yBAAyBqB,MAAM,KAAK,GAAG,OAAO;IAE1E,IAAI;QACFxB,qBAAqB0B,KAAK,CAACJ;QAC3B,OAAO;IACT,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAEA,OAAO,SAASF,gBAAgBD,QAAgB;IAC9C,IAAI;QACF,IAAIQ,KAAKC,cAAc,CAAC,SAAS;YAACC,UAAUV;QAAQ;QACpD,OAAO;IACT,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
1
+ {"version":3,"sources":["../../../src/core/workflow-model/cron-trigger.ts"],"sourcesContent":["import {CronExpressionParser} from 'cron-parser';\nimport type {WorkflowModelValidationIssue} from './invalid-workflow-model-error.js';\nimport {issue} from './validation-issue.js';\n\nexport const cronTriggerDefaultTimezone = 'UTC';\nconst cronFieldSeparatorRegex = /\\s+/;\n\nexport function validateCronTrigger(params: {\n readonly sourceKey: string;\n readonly trigger: {\n readonly event?: string | undefined;\n };\n readonly config: {\n readonly schedule?: string | undefined;\n readonly timezone?: string | undefined;\n };\n readonly issues: WorkflowModelValidationIssue[];\n}): void {\n const {sourceKey, trigger, config, issues} = params;\n\n if (trigger.event !== undefined && trigger.event !== 'tick') {\n issues.push(\n issue({\n code: 'invalid-cron-event',\n message: `A cron trigger must use event \"tick\"; found \"${trigger.event}\".`,\n path: ['triggers', sourceKey, 'event'],\n details: {event: trigger.event},\n scope: 'trigger',\n }),\n );\n }\n\n if (config.schedule === undefined) {\n issues.push(\n issue({\n code: 'missing-cron-schedule',\n message: 'A cron trigger requires a schedule.',\n path: ['triggers', sourceKey, 'config', 'schedule'],\n scope: 'trigger',\n }),\n );\n } else if (!isValidCronExpression(config.schedule)) {\n issues.push(\n issue({\n code: 'invalid-cron-schedule',\n message: 'Cron trigger schedule must be a valid 5-field cron expression.',\n path: ['triggers', sourceKey, 'config', 'schedule'],\n details: {schedule: config.schedule},\n scope: 'trigger',\n }),\n );\n }\n\n if (config.timezone !== undefined && !isValidTimezone(config.timezone)) {\n issues.push(\n issue({\n code: 'invalid-cron-timezone',\n message: 'Cron trigger timezone must be a valid IANA time zone.',\n path: ['triggers', sourceKey, 'config', 'timezone'],\n details: {timezone: config.timezone},\n scope: 'trigger',\n }),\n );\n }\n}\n\nexport function isValidCronExpression(expression: string): boolean {\n const trimmedExpression = expression.trim();\n if (trimmedExpression.length === 0) return false;\n if (trimmedExpression.split(cronFieldSeparatorRegex).length !== 5) return false;\n\n try {\n CronExpressionParser.parse(trimmedExpression);\n return true;\n } catch {\n return false;\n }\n}\n\nexport function isValidTimezone(timezone: string): boolean {\n try {\n new Intl.DateTimeFormat('en-US', {timeZone: timezone});\n return true;\n } catch {\n return false;\n }\n}\n"],"names":["CronExpressionParser","issue","cronTriggerDefaultTimezone","cronFieldSeparatorRegex","validateCronTrigger","params","sourceKey","trigger","config","issues","event","undefined","push","code","message","path","details","scope","schedule","isValidCronExpression","timezone","isValidTimezone","expression","trimmedExpression","trim","length","split","parse","Intl","DateTimeFormat","timeZone"],"mappings":"AAAA,SAAQA,oBAAoB,QAAO,cAAc;AAEjD,SAAQC,KAAK,QAAO,wBAAwB;AAE5C,OAAO,MAAMC,6BAA6B,MAAM;AAChD,MAAMC,0BAA0B;AAEhC,OAAO,SAASC,oBAAoBC,MAUnC;IACC,MAAM,EAACC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,MAAM,EAAC,GAAGJ;IAE7C,IAAIE,QAAQG,KAAK,KAAKC,aAAaJ,QAAQG,KAAK,KAAK,QAAQ;QAC3DD,OAAOG,IAAI,CACTX,MAAM;YACJY,MAAM;YACNC,SAAS,CAAC,6CAA6C,EAAEP,QAAQG,KAAK,CAAC,EAAE,CAAC;YAC1EK,MAAM;gBAAC;gBAAYT;gBAAW;aAAQ;YACtCU,SAAS;gBAACN,OAAOH,QAAQG,KAAK;YAAA;YAC9BO,OAAO;QACT;IAEJ;IAEA,IAAIT,OAAOU,QAAQ,KAAKP,WAAW;QACjCF,OAAOG,IAAI,CACTX,MAAM;YACJY,MAAM;YACNC,SAAS;YACTC,MAAM;gBAAC;gBAAYT;gBAAW;gBAAU;aAAW;YACnDW,OAAO;QACT;IAEJ,OAAO,IAAI,CAACE,sBAAsBX,OAAOU,QAAQ,GAAG;QAClDT,OAAOG,IAAI,CACTX,MAAM;YACJY,MAAM;YACNC,SAAS;YACTC,MAAM;gBAAC;gBAAYT;gBAAW;gBAAU;aAAW;YACnDU,SAAS;gBAACE,UAAUV,OAAOU,QAAQ;YAAA;YACnCD,OAAO;QACT;IAEJ;IAEA,IAAIT,OAAOY,QAAQ,KAAKT,aAAa,CAACU,gBAAgBb,OAAOY,QAAQ,GAAG;QACtEX,OAAOG,IAAI,CACTX,MAAM;YACJY,MAAM;YACNC,SAAS;YACTC,MAAM;gBAAC;gBAAYT;gBAAW;gBAAU;aAAW;YACnDU,SAAS;gBAACI,UAAUZ,OAAOY,QAAQ;YAAA;YACnCH,OAAO;QACT;IAEJ;AACF;AAEA,OAAO,SAASE,sBAAsBG,UAAkB;IACtD,MAAMC,oBAAoBD,WAAWE,IAAI;IACzC,IAAID,kBAAkBE,MAAM,KAAK,GAAG,OAAO;IAC3C,IAAIF,kBAAkBG,KAAK,CAACvB,yBAAyBsB,MAAM,KAAK,GAAG,OAAO;IAE1E,IAAI;QACFzB,qBAAqB2B,KAAK,CAACJ;QAC3B,OAAO;IACT,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAEA,OAAO,SAASF,gBAAgBD,QAAgB;IAC9C,IAAI;QACF,IAAIQ,KAAKC,cAAc,CAAC,SAAS;YAACC,UAAUV;QAAQ;QACpD,OAAO;IACT,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
@@ -1,4 +1,4 @@
1
1
  export { DEFAULT_RUN_TIMEOUT_MS } from './constants.js';
2
- export { InvalidWorkflowModelError, invalidWorkflowModelErrorCode, type WorkflowModelValidationIssue, type WorkflowModelValidationIssueCode, type WorkflowModelValidationIssuePathSegment, type WorkflowModelValidationIssueSeverity, } from './invalid-workflow-model-error.js';
2
+ export { InvalidWorkflowModelError, invalidWorkflowModelErrorCode, type WorkflowModelValidationIssue, type WorkflowModelValidationIssueCode, type WorkflowModelValidationIssuePathSegment, type WorkflowModelValidationIssueScope, type WorkflowModelValidationIssueSeverity, } from './invalid-workflow-model-error.js';
3
3
  export { normalizeWorkflowDocument } from './normalize-workflow-document.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,gBAAgB,CAAC;AACtD,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,KAAK,4BAA4B,EACjC,KAAK,gCAAgC,EACrC,KAAK,uCAAuC,EAC5C,KAAK,oCAAoC,GAC1C,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAC,yBAAyB,EAAC,MAAM,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,gBAAgB,CAAC;AACtD,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,KAAK,4BAA4B,EACjC,KAAK,gCAAgC,EACrC,KAAK,uCAAuC,EAC5C,KAAK,iCAAiC,EACtC,KAAK,oCAAoC,GAC1C,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAC,yBAAyB,EAAC,MAAM,kCAAkC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/workflow-model/index.ts"],"sourcesContent":["export {DEFAULT_RUN_TIMEOUT_MS} from './constants.js';\nexport {\n InvalidWorkflowModelError,\n invalidWorkflowModelErrorCode,\n type WorkflowModelValidationIssue,\n type WorkflowModelValidationIssueCode,\n type WorkflowModelValidationIssuePathSegment,\n type WorkflowModelValidationIssueSeverity,\n} from './invalid-workflow-model-error.js';\nexport {normalizeWorkflowDocument} from './normalize-workflow-document.js';\n"],"names":["DEFAULT_RUN_TIMEOUT_MS","InvalidWorkflowModelError","invalidWorkflowModelErrorCode","normalizeWorkflowDocument"],"mappings":"AAAA,SAAQA,sBAAsB,QAAO,iBAAiB;AACtD,SACEC,yBAAyB,EACzBC,6BAA6B,QAKxB,oCAAoC;AAC3C,SAAQC,yBAAyB,QAAO,mCAAmC"}
1
+ {"version":3,"sources":["../../../src/core/workflow-model/index.ts"],"sourcesContent":["export {DEFAULT_RUN_TIMEOUT_MS} from './constants.js';\nexport {\n InvalidWorkflowModelError,\n invalidWorkflowModelErrorCode,\n type WorkflowModelValidationIssue,\n type WorkflowModelValidationIssueCode,\n type WorkflowModelValidationIssuePathSegment,\n type WorkflowModelValidationIssueScope,\n type WorkflowModelValidationIssueSeverity,\n} from './invalid-workflow-model-error.js';\nexport {normalizeWorkflowDocument} from './normalize-workflow-document.js';\n"],"names":["DEFAULT_RUN_TIMEOUT_MS","InvalidWorkflowModelError","invalidWorkflowModelErrorCode","normalizeWorkflowDocument"],"mappings":"AAAA,SAAQA,sBAAsB,QAAO,iBAAiB;AACtD,SACEC,yBAAyB,EACzBC,6BAA6B,QAMxB,oCAAoC;AAC3C,SAAQC,yBAAyB,QAAO,mCAAmC"}
@@ -1,13 +1,15 @@
1
1
  export declare const invalidWorkflowModelErrorCode = "invalid-workflow-model";
2
- export type WorkflowModelValidationIssueCode = 'context-unavailable-at-fill-site' | 'dynamic-name-self-reference' | 'context-unavailable-at-predicate-site' | 'computed-context-key' | 'checkout-target-invalid' | 'duplicate-job-id' | 'duplicate-step-id' | 'duplicate-trigger-id' | 'harness-provider-incompatible' | 'harness-thinking-incompatible' | 'harness-tool-incompatible' | 'integration-connection-not-capable' | 'integration-connection-not-found' | 'integration-write-not-allowed' | 'invalid-cron-event' | 'invalid-cron-schedule' | 'invalid-cron-timezone' | 'invalid-provider' | 'invalid-trigger-filter' | 'invalid-interpolation-expression' | 'invalid-interpolation-template' | 'invalid-duration' | 'invalid-listener-filter' | 'invalid-model' | 'invalid-job-if' | 'invalid-job-success' | 'invalid-output-schema' | 'invalid-runner-label' | 'invalid-step-gate-restart-from' | 'invalid-step-gate-success' | 'invalid-step-if' | 'job-dependency-cycle' | 'listening-job-missing-resolution-source' | 'listening-timeout-exceeds-run-timeout' | 'missing-harness-for-tools' | 'missing-connection-for-integration' | 'missing-job-needs-edge' | 'missing-cron-schedule' | 'missing-runner-label' | 'multiple-manual-triggers' | 'runner-context-not-bare' | 'runner-context-in-field' | 'runner-context-in-server-predicate' | 're-evaluating-command' | 'self-job-dependency' | 'too-many-runner-labels' | 'unknown-secret-store' | 'unknown-interpolation-context' | 'unknown-integration-method' | 'unknown-integration-tool' | 'unknown-job-dependency' | 'untrusted-agent-selection-context';
2
+ export type WorkflowModelValidationIssueCode = 'context-unavailable-at-fill-site' | 'dynamic-name-self-reference' | 'context-unavailable-at-predicate-site' | 'computed-context-key' | 'checkout-target-invalid' | 'duplicate-job-id' | 'duplicate-step-id' | 'duplicate-trigger-id' | 'harness-provider-incompatible' | 'harness-thinking-incompatible' | 'harness-tool-incompatible' | 'integration-connection-not-capable' | 'integration-connection-not-found' | 'integration-write-not-allowed' | 'invalid-cron-event' | 'invalid-cron-schedule' | 'invalid-cron-timezone' | 'invalid-provider' | 'invalid-trigger-filter' | 'invalid-interpolation-expression' | 'invalid-interpolation-template' | 'invalid-duration' | 'invalid-listener-filter' | 'invalid-model' | 'invalid-job-if' | 'invalid-job-success' | 'invalid-output-schema' | 'invalid-runner-label' | 'invalid-step-gate-restart-from' | 'invalid-step-gate-success' | 'invalid-step-if' | 'job-dependency-cycle' | 'listening-job-missing-resolution-source' | 'listening-job-no-active-matcher' | 'listening-timeout-exceeds-run-timeout' | 'missing-harness-for-tools' | 'missing-connection-for-integration' | 'missing-job-needs-edge' | 'missing-cron-schedule' | 'missing-runner-label' | 'multiple-manual-triggers' | 'runner-context-not-bare' | 'runner-context-in-field' | 'runner-context-in-server-predicate' | 're-evaluating-command' | 'self-job-dependency' | 'too-many-runner-labels' | 'unknown-secret-store' | 'unknown-interpolation-context' | 'unknown-integration-method' | 'unknown-integration-tool' | 'unknown-job-dependency' | 'untrusted-agent-selection-context';
3
3
  export type WorkflowModelValidationIssuePathSegment = string | number;
4
4
  export type WorkflowModelValidationIssueSeverity = 'error' | 'warning';
5
+ export type WorkflowModelValidationIssueScope = 'definition' | 'trigger';
5
6
  export interface WorkflowModelValidationIssue {
6
7
  readonly code: WorkflowModelValidationIssueCode;
7
8
  readonly message: string;
8
9
  readonly path: readonly WorkflowModelValidationIssuePathSegment[];
9
10
  readonly details?: Readonly<Record<string, unknown>>;
10
- readonly severity?: WorkflowModelValidationIssueSeverity;
11
+ readonly severity: WorkflowModelValidationIssueSeverity;
12
+ readonly scope: WorkflowModelValidationIssueScope;
11
13
  }
12
14
  export declare class InvalidWorkflowModelError extends Error {
13
15
  readonly issues: readonly WorkflowModelValidationIssue[];
@@ -1 +1 @@
1
- {"version":3,"file":"invalid-workflow-model-error.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/invalid-workflow-model-error.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B,2BAA2B,CAAC;AAEtE,MAAM,MAAM,gCAAgC,GACxC,kCAAkC,GAClC,6BAA6B,GAC7B,uCAAuC,GACvC,sBAAsB,GACtB,yBAAyB,GACzB,kBAAkB,GAClB,mBAAmB,GACnB,sBAAsB,GACtB,+BAA+B,GAC/B,+BAA+B,GAC/B,2BAA2B,GAC3B,oCAAoC,GACpC,kCAAkC,GAClC,+BAA+B,GAC/B,oBAAoB,GACpB,uBAAuB,GACvB,uBAAuB,GACvB,kBAAkB,GAClB,wBAAwB,GACxB,kCAAkC,GAClC,gCAAgC,GAChC,kBAAkB,GAClB,yBAAyB,GACzB,eAAe,GACf,gBAAgB,GAChB,qBAAqB,GACrB,uBAAuB,GACvB,sBAAsB,GACtB,gCAAgC,GAChC,2BAA2B,GAC3B,iBAAiB,GACjB,sBAAsB,GACtB,yCAAyC,GACzC,uCAAuC,GACvC,2BAA2B,GAC3B,oCAAoC,GACpC,wBAAwB,GACxB,uBAAuB,GACvB,sBAAsB,GACtB,0BAA0B,GAC1B,yBAAyB,GACzB,yBAAyB,GACzB,oCAAoC,GACpC,uBAAuB,GACvB,qBAAqB,GACrB,wBAAwB,GACxB,sBAAsB,GACtB,+BAA+B,GAC/B,4BAA4B,GAC5B,0BAA0B,GAC1B,wBAAwB,GACxB,mCAAmC,CAAC;AAExC,MAAM,MAAM,uCAAuC,GAAG,MAAM,GAAG,MAAM,CAAC;AAEtE,MAAM,MAAM,oCAAoC,GAAG,OAAO,GAAG,SAAS,CAAC;AAEvE,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,IAAI,EAAE,gCAAgC,CAAC;IAChD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,SAAS,uCAAuC,EAAE,CAAC;IAClE,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,QAAQ,CAAC,EAAE,oCAAoC,CAAC;CAC1D;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IAGtC,QAAQ,CAAC,MAAM,EAAE,SAAS,4BAA4B,EAAE;IAFpE,QAAQ,CAAC,IAAI,4BAAiC;IAE9C,YAAqB,MAAM,EAAE,SAAS,4BAA4B,EAAE,EAGnE;CACF"}
1
+ {"version":3,"file":"invalid-workflow-model-error.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/invalid-workflow-model-error.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B,2BAA2B,CAAC;AAEtE,MAAM,MAAM,gCAAgC,GACxC,kCAAkC,GAClC,6BAA6B,GAC7B,uCAAuC,GACvC,sBAAsB,GAC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KAAK,EAAE,iCAAiC,CAAC;CACnD;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IAGtC,QAAQ,CAAC,MAAM,EAAE,SAAS,4BAA4B,EAAE;IAFpE,QAAQ,CAAC,IAAI,4BAAiC;IAE9C,YAAqB,MAAM,EAAE,SAAS,4BAA4B,EAAE,EAGnE;CACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/workflow-model/invalid-workflow-model-error.ts"],"sourcesContent":["export const invalidWorkflowModelErrorCode = 'invalid-workflow-model';\n\nexport type WorkflowModelValidationIssueCode =\n | 'context-unavailable-at-fill-site'\n | 'dynamic-name-self-reference'\n | 'context-unavailable-at-predicate-site'\n | 'computed-context-key'\n | 'checkout-target-invalid'\n | 'duplicate-job-id'\n | 'duplicate-step-id'\n | 'duplicate-trigger-id'\n | 'harness-provider-incompatible'\n | 'harness-thinking-incompatible'\n | 'harness-tool-incompatible'\n | 'integration-connection-not-capable'\n | 'integration-connection-not-found'\n | 'integration-write-not-allowed'\n | 'invalid-cron-event'\n | 'invalid-cron-schedule'\n | 'invalid-cron-timezone'\n | 'invalid-provider'\n | 'invalid-trigger-filter'\n | 'invalid-interpolation-expression'\n | 'invalid-interpolation-template'\n | 'invalid-duration'\n | 'invalid-listener-filter'\n | 'invalid-model'\n | 'invalid-job-if'\n | 'invalid-job-success'\n | 'invalid-output-schema'\n | 'invalid-runner-label'\n | 'invalid-step-gate-restart-from'\n | 'invalid-step-gate-success'\n | 'invalid-step-if'\n | 'job-dependency-cycle'\n | 'listening-job-missing-resolution-source'\n | 'listening-timeout-exceeds-run-timeout'\n | 'missing-harness-for-tools'\n | 'missing-connection-for-integration'\n | 'missing-job-needs-edge'\n | 'missing-cron-schedule'\n | 'missing-runner-label'\n | 'multiple-manual-triggers'\n | 'runner-context-not-bare'\n | 'runner-context-in-field'\n | 'runner-context-in-server-predicate'\n | 're-evaluating-command'\n | 'self-job-dependency'\n | 'too-many-runner-labels'\n | 'unknown-secret-store'\n | 'unknown-interpolation-context'\n | 'unknown-integration-method'\n | 'unknown-integration-tool'\n | 'unknown-job-dependency'\n | 'untrusted-agent-selection-context';\n\nexport type WorkflowModelValidationIssuePathSegment = string | number;\n\nexport type WorkflowModelValidationIssueSeverity = 'error' | 'warning';\n\nexport interface WorkflowModelValidationIssue {\n readonly code: WorkflowModelValidationIssueCode;\n readonly message: string;\n readonly path: readonly WorkflowModelValidationIssuePathSegment[];\n readonly details?: Readonly<Record<string, unknown>>;\n readonly severity?: WorkflowModelValidationIssueSeverity;\n}\n\nexport class InvalidWorkflowModelError extends Error {\n readonly code = invalidWorkflowModelErrorCode;\n\n constructor(readonly issues: readonly WorkflowModelValidationIssue[]) {\n super('Invalid workflow model');\n this.name = 'InvalidWorkflowModelError';\n }\n}\n"],"names":["invalidWorkflowModelErrorCode","InvalidWorkflowModelError","Error","issues","code","name"],"mappings":"AAAA,OAAO,MAAMA,gCAAgC,yBAAyB;AAoEtE,OAAO,MAAMC,kCAAkCC;IAG7C,YAAY,AAASC,MAA+C,CAAE;QACpE,KAAK,CAAC,gCADaA,SAAAA,aAFZC,OAAOJ;QAId,IAAI,CAACK,IAAI,GAAG;IACd;AACF"}
1
+ {"version":3,"sources":["../../../src/core/workflow-model/invalid-workflow-model-error.ts"],"sourcesContent":["export const invalidWorkflowModelErrorCode = 'invalid-workflow-model';\n\nexport type WorkflowModelValidationIssueCode =\n | 'context-unavailable-at-fill-site'\n | 'dynamic-name-self-reference'\n | 'context-unavailable-at-predicate-site'\n | 'computed-context-key'\n | 'checkout-target-invalid'\n | 'duplicate-job-id'\n | 'duplicate-step-id'\n | 'duplicate-trigger-id'\n | 'harness-provider-incompatible'\n | 'harness-thinking-incompatible'\n | 'harness-tool-incompatible'\n | 'integration-connection-not-capable'\n | 'integration-connection-not-found'\n | 'integration-write-not-allowed'\n | 'invalid-cron-event'\n | 'invalid-cron-schedule'\n | 'invalid-cron-timezone'\n | 'invalid-provider'\n | 'invalid-trigger-filter'\n | 'invalid-interpolation-expression'\n | 'invalid-interpolation-template'\n | 'invalid-duration'\n | 'invalid-listener-filter'\n | 'invalid-model'\n | 'invalid-job-if'\n | 'invalid-job-success'\n | 'invalid-output-schema'\n | 'invalid-runner-label'\n | 'invalid-step-gate-restart-from'\n | 'invalid-step-gate-success'\n | 'invalid-step-if'\n | 'job-dependency-cycle'\n | 'listening-job-missing-resolution-source'\n | 'listening-job-no-active-matcher'\n | 'listening-timeout-exceeds-run-timeout'\n | 'missing-harness-for-tools'\n | 'missing-connection-for-integration'\n | 'missing-job-needs-edge'\n | 'missing-cron-schedule'\n | 'missing-runner-label'\n | 'multiple-manual-triggers'\n | 'runner-context-not-bare'\n | 'runner-context-in-field'\n | 'runner-context-in-server-predicate'\n | 're-evaluating-command'\n | 'self-job-dependency'\n | 'too-many-runner-labels'\n | 'unknown-secret-store'\n | 'unknown-interpolation-context'\n | 'unknown-integration-method'\n | 'unknown-integration-tool'\n | 'unknown-job-dependency'\n | 'untrusted-agent-selection-context';\n\nexport type WorkflowModelValidationIssuePathSegment = string | number;\n\nexport type WorkflowModelValidationIssueSeverity = 'error' | 'warning';\n\nexport type WorkflowModelValidationIssueScope = 'definition' | 'trigger';\n\nexport interface WorkflowModelValidationIssue {\n readonly code: WorkflowModelValidationIssueCode;\n readonly message: string;\n readonly path: readonly WorkflowModelValidationIssuePathSegment[];\n readonly details?: Readonly<Record<string, unknown>>;\n readonly severity: WorkflowModelValidationIssueSeverity;\n readonly scope: WorkflowModelValidationIssueScope;\n}\n\nexport class InvalidWorkflowModelError extends Error {\n readonly code = invalidWorkflowModelErrorCode;\n\n constructor(readonly issues: readonly WorkflowModelValidationIssue[]) {\n super('Invalid workflow model');\n this.name = 'InvalidWorkflowModelError';\n }\n}\n"],"names":["invalidWorkflowModelErrorCode","InvalidWorkflowModelError","Error","issues","code","name"],"mappings":"AAAA,OAAO,MAAMA,gCAAgC,yBAAyB;AAwEtE,OAAO,MAAMC,kCAAkCC;IAG7C,YAAY,AAASC,MAA+C,CAAE;QACpE,KAAK,CAAC,gCADaA,SAAAA,aAFZC,OAAOJ;QAId,IAAI,CAACK,IAAI,GAAG;IACd;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-job-listening.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/normalize-job-listening.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,+BAA+B,CAAC;AAE7E,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AAMpF,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAC5C,GAAG,EAAE,mBAAmB,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,4BAA4B,EAAE,CAAC;IACvC,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C,GAAG,yBAAyB,GAAG,SAAS,CA8ExC"}
1
+ {"version":3,"file":"normalize-job-listening.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/normalize-job-listening.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,+BAA+B,CAAC;AAE7E,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AAMpF,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAC5C,GAAG,EAAE,mBAAmB,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,4BAA4B,EAAE,CAAC;IACvC,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C,GAAG,yBAAyB,GAAG,SAAS,CAuGxC"}
@@ -44,7 +44,46 @@ export function normalizeJobListening(params) {
44
44
  ],
45
45
  issues: params.issues
46
46
  });
47
- if (listening.until === undefined && listening.timeout === undefined && listening.max_executions === undefined) {
47
+ const on = listening.on.map((trigger, index)=>normalizeListeningTrigger({
48
+ trigger,
49
+ field: 'listener.on',
50
+ path: [
51
+ ...path,
52
+ 'listening',
53
+ 'on',
54
+ index,
55
+ 'filter'
56
+ ],
57
+ issues: params.issues,
58
+ allowedJobReferences: params.allowedJobReferences
59
+ })).filter((matcher)=>matcher !== undefined);
60
+ if (on.length === 0) {
61
+ params.issues.push(issue({
62
+ code: 'listening-job-no-active-matcher',
63
+ message: `Listening job "${params.sourceName}" has no active "on" matcher; it can never execute.`,
64
+ path: [
65
+ ...path,
66
+ 'listening',
67
+ 'on'
68
+ ]
69
+ }));
70
+ }
71
+ const until = listening.until === undefined ? undefined : listening.until.map((trigger, index)=>normalizeListeningTrigger({
72
+ trigger,
73
+ field: 'listener.until',
74
+ path: [
75
+ ...path,
76
+ 'listening',
77
+ 'until',
78
+ index,
79
+ 'filter'
80
+ ],
81
+ issues: params.issues,
82
+ allowedJobReferences: params.allowedJobReferences
83
+ })).filter((matcher)=>matcher !== undefined);
84
+ // Inert `until` matchers do not resolve the listening job; the check runs on
85
+ // the matchers that stay active.
86
+ if ((until === undefined || until.length === 0) && listening.timeout === undefined && listening.max_executions === undefined) {
48
87
  params.issues.push(issue({
49
88
  code: 'listening-job-missing-resolution-source',
50
89
  message: `Listening job "${params.sourceName}" must declare until, timeout, or max_executions.`,
@@ -66,33 +105,9 @@ export function normalizeJobListening(params) {
66
105
  }
67
106
  };
68
107
  return {
69
- on: listening.on.map((trigger, index)=>normalizeListeningTrigger({
70
- trigger,
71
- field: 'listener.on',
72
- path: [
73
- ...path,
74
- 'listening',
75
- 'on',
76
- index,
77
- 'filter'
78
- ],
79
- issues: params.issues,
80
- allowedJobReferences: params.allowedJobReferences
81
- })),
82
- ...listening.until === undefined ? {} : {
83
- until: listening.until.map((trigger, index)=>normalizeListeningTrigger({
84
- trigger,
85
- field: 'listener.until',
86
- path: [
87
- ...path,
88
- 'listening',
89
- 'until',
90
- index,
91
- 'filter'
92
- ],
93
- issues: params.issues,
94
- allowedJobReferences: params.allowedJobReferences
95
- }))
108
+ on,
109
+ ...until === undefined || until.length === 0 ? {} : {
110
+ until
96
111
  },
97
112
  ...timeoutMs === undefined ? {} : {
98
113
  timeoutMs
@@ -107,6 +122,7 @@ export function normalizeJobListening(params) {
107
122
  };
108
123
  }
109
124
  function normalizeListeningTrigger(params) {
125
+ const matcherIssues = [];
110
126
  if (params.trigger.filter !== undefined) {
111
127
  validatePredicateExpression({
112
128
  field: params.field,
@@ -114,10 +130,15 @@ function normalizeListeningTrigger(params) {
114
130
  path: params.path,
115
131
  invalidCode: 'invalid-listener-filter',
116
132
  invalidMessage: `${params.field === 'listener.on' ? 'Listener on' : 'Listener until'} filter must be a valid CEL boolean expression.`,
117
- issues: params.issues,
118
- allowedJobReferences: params.allowedJobReferences
133
+ issues: matcherIssues,
134
+ allowedJobReferences: params.allowedJobReferences,
135
+ scope: 'trigger'
119
136
  });
120
137
  }
138
+ params.issues.push(...matcherIssues);
139
+ // A matcher with a trigger-scoped issue is inert: excluded from the matcher
140
+ // list while the authored document entry stays untouched.
141
+ if (matcherIssues.some((candidate)=>candidate.scope === 'trigger')) return undefined;
121
142
  return normalizeTriggerEntry(params.trigger);
122
143
  }
123
144
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/workflow-model/normalize-job-listening.ts"],"sourcesContent":["import type {WorkflowDocumentJob} from '@shipfox/workflow-document';\nimport type {WorkflowModelJobListening} from '../entities/workflow-model.js';\nimport {DEFAULT_RUN_TIMEOUT_MS} from './constants.js';\nimport type {WorkflowModelValidationIssue} from './invalid-workflow-model-error.js';\nimport {normalizeTriggerEntry} from './normalize-triggers.js';\nimport {parseDurationMs} from './parse-duration-ms.js';\nimport {validatePredicateExpression} from './validate-predicate-expression.js';\nimport {issue} from './validation-issue.js';\n\nexport function normalizeJobListening(params: {\n job: WorkflowDocumentJob;\n sourceName: string;\n issues: WorkflowModelValidationIssue[];\n allowedJobReferences: ReadonlySet<string>;\n}): WorkflowModelJobListening | undefined {\n const path = ['jobs', params.sourceName] as const;\n const listening = params.job.listening;\n\n if (listening === undefined) {\n return undefined;\n }\n\n const timeoutMs = parseDurationMs({\n source: listening.timeout,\n path: [...path, 'listening', 'timeout'],\n issues: params.issues,\n maxMs: DEFAULT_RUN_TIMEOUT_MS,\n outOfRangeCode: 'listening-timeout-exceeds-run-timeout',\n outOfRangeMessage: 'Listening job timeout must be between 1s and the workflow run timeout.',\n });\n const debounceMs = parseDurationMs({\n source: listening.batch?.debounce,\n path: [...path, 'listening', 'batch', 'debounce'],\n issues: params.issues,\n });\n const maxWaitMs = parseDurationMs({\n source: listening.batch?.max_wait,\n path: [...path, 'listening', 'batch', 'max_wait'],\n issues: params.issues,\n });\n\n if (\n listening.until === undefined &&\n listening.timeout === undefined &&\n listening.max_executions === undefined\n ) {\n params.issues.push(\n issue({\n code: 'listening-job-missing-resolution-source',\n message: `Listening job \"${params.sourceName}\" must declare until, timeout, or max_executions.`,\n path: [...path, 'listening'],\n }),\n );\n }\n\n const batch =\n debounceMs === undefined && listening.batch?.max_size === undefined && maxWaitMs === undefined\n ? undefined\n : {\n ...(debounceMs === undefined ? {} : {debounceMs}),\n ...(listening.batch?.max_size === undefined ? {} : {maxSize: listening.batch.max_size}),\n ...(maxWaitMs === undefined ? {} : {maxWaitMs}),\n };\n\n return {\n on: listening.on.map((trigger, index) =>\n normalizeListeningTrigger({\n trigger,\n field: 'listener.on',\n path: [...path, 'listening', 'on', index, 'filter'],\n issues: params.issues,\n allowedJobReferences: params.allowedJobReferences,\n }),\n ),\n ...(listening.until === undefined\n ? {}\n : {\n until: listening.until.map((trigger, index) =>\n normalizeListeningTrigger({\n trigger,\n field: 'listener.until',\n path: [...path, 'listening', 'until', index, 'filter'],\n issues: params.issues,\n allowedJobReferences: params.allowedJobReferences,\n }),\n ),\n }),\n ...(timeoutMs === undefined ? {} : {timeoutMs}),\n ...(listening.max_executions === undefined ? {} : {maxExecutions: listening.max_executions}),\n ...(batch === undefined ? {} : {batch}),\n onResolve: listening.on_resolve ?? 'finish',\n };\n}\n\nfunction normalizeListeningTrigger(params: {\n trigger: {\n readonly source: string;\n readonly event: string;\n readonly with?: Readonly<Record<string, unknown>> | undefined;\n readonly filter?: string | undefined;\n };\n field: 'listener.on' | 'listener.until';\n path: readonly (string | number)[];\n issues: WorkflowModelValidationIssue[];\n allowedJobReferences: ReadonlySet<string>;\n}): WorkflowModelJobListening['on'][number] {\n if (params.trigger.filter !== undefined) {\n validatePredicateExpression({\n field: params.field,\n source: params.trigger.filter,\n path: params.path,\n invalidCode: 'invalid-listener-filter',\n invalidMessage: `${params.field === 'listener.on' ? 'Listener on' : 'Listener until'} filter must be a valid CEL boolean expression.`,\n issues: params.issues,\n allowedJobReferences: params.allowedJobReferences,\n });\n }\n\n return normalizeTriggerEntry(params.trigger);\n}\n"],"names":["DEFAULT_RUN_TIMEOUT_MS","normalizeTriggerEntry","parseDurationMs","validatePredicateExpression","issue","normalizeJobListening","params","path","sourceName","listening","job","undefined","timeoutMs","source","timeout","issues","maxMs","outOfRangeCode","outOfRangeMessage","debounceMs","batch","debounce","maxWaitMs","max_wait","until","max_executions","push","code","message","max_size","maxSize","on","map","trigger","index","normalizeListeningTrigger","field","allowedJobReferences","maxExecutions","onResolve","on_resolve","filter","invalidCode","invalidMessage"],"mappings":"AAEA,SAAQA,sBAAsB,QAAO,iBAAiB;AAEtD,SAAQC,qBAAqB,QAAO,0BAA0B;AAC9D,SAAQC,eAAe,QAAO,yBAAyB;AACvD,SAAQC,2BAA2B,QAAO,qCAAqC;AAC/E,SAAQC,KAAK,QAAO,wBAAwB;AAE5C,OAAO,SAASC,sBAAsBC,MAKrC;IACC,MAAMC,OAAO;QAAC;QAAQD,OAAOE,UAAU;KAAC;IACxC,MAAMC,YAAYH,OAAOI,GAAG,CAACD,SAAS;IAEtC,IAAIA,cAAcE,WAAW;QAC3B,OAAOA;IACT;IAEA,MAAMC,YAAYV,gBAAgB;QAChCW,QAA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B/B,OAAO+B,oBAAoB;YACnD;QAEF,GAAI5B,UAAUe,KAAK,KAAKb,YACpB,CAAC,IACD;YACEa,OAAOf,UAAUe,KAAK,CAACQ,GAAG,CAAC,CAACC,SAASC,QACnCC,0BAA0B;oBACxBF;oBACAG,OAAO;oBACP7B,MAAM;2BAAIA;wBAAM;wBAAa;wBAAS2B;wBAAO;qBAAS;oBACtDnB,QAAQT,OAAOS,MAAM;oBACrBsB,sBAAsB/B,OAAO+B,oBAAoB;gBACnD;QAEJ,CAAC;QACL,GAAIzB,cAAcD,YAAY,CAAC,IAAI;YAACC;QAAS,CAAC;QAC9C,GAAIH,UAAUgB,cAAc,KAAKd,YAAY,CAAC,IAAI;YAAC2B,eAAe7B,UAAUgB,cAAc;QAAA,CAAC;QAC3F,GAAIL,UAAUT,YAAY,CAAC,IAAI;YAACS;QAAK,CAAC;QACtCmB,WAAW9B,UAAU+B,UAAU,IAAI;IACrC;AACF;AAEA,SAASL,0BAA0B7B,MAWlC;IACC,IAAIA,OAAO2B,OAAO,CAACQ,MAAM,KAAK9B,WAAW;QACvCR,4BAA4B;YAC1BiC,OAAO9B,OAAO8B,KAAK;YACnBvB,QAAQP,OAAO2B,OAAO,CAACQ,MAAM;YAC7BlC,MAAMD,OAAOC,IAAI;YACjBmC,aAAa;YACbC,gBAAgB,GAAGrC,OAAO8B,KAAK,KAAK,gBAAgB,gBAAgB,iBAAiB,+CAA+C,CAAC;YACrIrB,QAAQT,OAAOS,MAAM;YACrBsB,sBAAsB/B,OAAO+B,oBAAoB;QACnD;IACF;IAEA,OAAOpC,sBAAsBK,OAAO2B,OAAO;AAC7C"}
1
+ {"version":3,"sources":["../../../src/core/workflow-model/normalize-job-listening.ts"],"sourcesContent":["import type {WorkflowDocumentJob} from '@shipfox/workflow-document';\nimport type {WorkflowModelJobListening} from '../entities/workflow-model.js';\nimport {DEFAULT_RUN_TIMEOUT_MS} from './constants.js';\nimport type {WorkflowModelValidationIssue} from './invalid-workflow-model-error.js';\nimport {normalizeTriggerEntry} from './normalize-triggers.js';\nimport {parseDurationMs} from './parse-duration-ms.js';\nimport {validatePredicateExpression} from './validate-predicate-expression.js';\nimport {issue} from './validation-issue.js';\n\nexport function normalizeJobListening(params: {\n job: WorkflowDocumentJob;\n sourceName: string;\n issues: WorkflowModelValidationIssue[];\n allowedJobReferences: ReadonlySet<string>;\n}): WorkflowModelJobListening | undefined {\n const path = ['jobs', params.sourceName] as const;\n const listening = params.job.listening;\n\n if (listening === undefined) {\n return undefined;\n }\n\n const timeoutMs = parseDurationMs({\n source: listening.timeout,\n path: [...path, 'listening', 'timeout'],\n issues: params.issues,\n maxMs: DEFAULT_RUN_TIMEOUT_MS,\n outOfRangeCode: 'listening-timeout-exceeds-run-timeout',\n outOfRangeMessage: 'Listening job timeout must be between 1s and the workflow run timeout.',\n });\n const debounceMs = parseDurationMs({\n source: listening.batch?.debounce,\n path: [...path, 'listening', 'batch', 'debounce'],\n issues: params.issues,\n });\n const maxWaitMs = parseDurationMs({\n source: listening.batch?.max_wait,\n path: [...path, 'listening', 'batch', 'max_wait'],\n issues: params.issues,\n });\n\n const on = listening.on\n .map((trigger, index) =>\n normalizeListeningTrigger({\n trigger,\n field: 'listener.on',\n path: [...path, 'listening', 'on', index, 'filter'],\n issues: params.issues,\n allowedJobReferences: params.allowedJobReferences,\n }),\n )\n .filter((matcher): matcher is WorkflowModelJobListening['on'][number] => matcher !== undefined);\n\n if (on.length === 0) {\n params.issues.push(\n issue({\n code: 'listening-job-no-active-matcher',\n message: `Listening job \"${params.sourceName}\" has no active \"on\" matcher; it can never execute.`,\n path: [...path, 'listening', 'on'],\n }),\n );\n }\n\n const until =\n listening.until === undefined\n ? undefined\n : listening.until\n .map((trigger, index) =>\n normalizeListeningTrigger({\n trigger,\n field: 'listener.until',\n path: [...path, 'listening', 'until', index, 'filter'],\n issues: params.issues,\n allowedJobReferences: params.allowedJobReferences,\n }),\n )\n .filter(\n (matcher): matcher is WorkflowModelJobListening['on'][number] => matcher !== undefined,\n );\n\n // Inert `until` matchers do not resolve the listening job; the check runs on\n // the matchers that stay active.\n if (\n (until === undefined || until.length === 0) &&\n listening.timeout === undefined &&\n listening.max_executions === undefined\n ) {\n params.issues.push(\n issue({\n code: 'listening-job-missing-resolution-source',\n message: `Listening job \"${params.sourceName}\" must declare until, timeout, or max_executions.`,\n path: [...path, 'listening'],\n }),\n );\n }\n\n const batch =\n debounceMs === undefined && listening.batch?.max_size === undefined && maxWaitMs === undefined\n ? undefined\n : {\n ...(debounceMs === undefined ? {} : {debounceMs}),\n ...(listening.batch?.max_size === undefined ? {} : {maxSize: listening.batch.max_size}),\n ...(maxWaitMs === undefined ? {} : {maxWaitMs}),\n };\n\n return {\n on,\n ...(until === undefined || until.length === 0\n ? {}\n : {\n until,\n }),\n ...(timeoutMs === undefined ? {} : {timeoutMs}),\n ...(listening.max_executions === undefined ? {} : {maxExecutions: listening.max_executions}),\n ...(batch === undefined ? {} : {batch}),\n onResolve: listening.on_resolve ?? 'finish',\n };\n}\n\nfunction normalizeListeningTrigger(params: {\n trigger: {\n readonly source: string;\n readonly event?: string | undefined;\n readonly with?: Readonly<Record<string, unknown>> | undefined;\n readonly filter?: string | undefined;\n };\n field: 'listener.on' | 'listener.until';\n path: readonly (string | number)[];\n issues: WorkflowModelValidationIssue[];\n allowedJobReferences: ReadonlySet<string>;\n}): WorkflowModelJobListening['on'][number] | undefined {\n const matcherIssues: WorkflowModelValidationIssue[] = [];\n if (params.trigger.filter !== undefined) {\n validatePredicateExpression({\n field: params.field,\n source: params.trigger.filter,\n path: params.path,\n invalidCode: 'invalid-listener-filter',\n invalidMessage: `${params.field === 'listener.on' ? 'Listener on' : 'Listener until'} filter must be a valid CEL boolean expression.`,\n issues: matcherIssues,\n allowedJobReferences: params.allowedJobReferences,\n scope: 'trigger',\n });\n }\n params.issues.push(...matcherIssues);\n\n // A matcher with a trigger-scoped issue is inert: excluded from the matcher\n // list while the authored document entry stays untouched.\n if (matcherIssues.some((candidate) => candidate.scope === 'trigger')) return undefined;\n\n return normalizeTriggerEntry(params.trigger);\n}\n"],"names":["DEFAULT_RUN_TIMEOUT_MS","normalizeTriggerEntry","parseDurationMs","validatePredicateExpression","issue","normalizeJobListening","params","path","sourceName","listening","job","undefined","timeoutMs","source","timeout","issues","maxMs","outOfRangeCode","outOfRangeMessage","debounceMs","batch","debounce","maxWaitMs","max_wait","on","map","trigger","index","normalizeListeningTrigger","field","allowedJobReferences","filter","matcher","length","push","code","message","until","max_executions","max_size","maxSize","maxExecutions","onResolve","on_resolve","matcherIssues","invalidCode","invalidMessage","scope","some","candidate"],"mappings":"AAEA,SAAQA,sBAAsB,QAAO,iBAAiB;AAEtD,SAAQC,qBAAqB,QAAO,0BAA0B;AAC9D,SAAQC,eAAe,QAAO,yBAAyB;AACvD,SAAQC,2BAA2B,QAAO,qCAAqC;AAC/E,SAAQC,KAAK,QAAO,wBAAwB;AAE5C,OAAO,SAASC,sBAAsBC,MAKrC;IACC,MAAMC,OAAO;QAAC;QAAQD,OAAOE,UAAU;KAAC;IACxC,MAAMC,YAAYH,OAAOI,GAAG,CAACD,SAAS;IAEtC,IAAIA,cAAcE,WAAW;QAC3B,OAAOA;IACT;IAEA,MAAMC,YAAYV,gBAAgB;QAChCW,QAAQJ,UAAUK,OAAO;QACzBP,MAAM;eAAIA;YAAM;YAAa;SAAU;QACvCQ,QAAQT,OAAOS,MAAM;QACrBC,OAAOhB;QACPiB,gBAAgB;QAChBC,mBAAmB;IACrB;IACA,MAAMC,aAAajB,gBAAgB;QACjCW,QAAQJ,UAAUW,KAAK,EAAEC;QACzBd,MAAM;eAAIA;YAAM;YAAa;YAAS;SAAW;QACjDQ,QAAQT,OAAOS,MAAM;IACvB;IACA,MAAMO,YAAYpB,gBAAgB;QAChCW,QAAQJ,UAAUW,KAAK,EAAEG;QACzBhB,MAAM;eAAIA;YAAM;YAAa;YAAS;SAAW;QACjDQ,QAAQT,OAAOS,MAAM;IACvB;IAEA,MAAMS,KAAKf,UAAUe,E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-model-erro
4
4
  export declare function normalizeTriggers(document: WorkflowDocument, issues: WorkflowModelValidationIssue[]): readonly WorkflowModelTrigger[];
5
5
  export declare function normalizeTriggerEntry(trigger: {
6
6
  readonly source: string;
7
- readonly event: string;
7
+ readonly event?: string | undefined;
8
8
  readonly with?: Readonly<Record<string, unknown>> | undefined;
9
9
  readonly filter?: string | undefined;
10
10
  }): WorkflowModelListeningTrigger;
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-triggers.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/normalize-triggers.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAC7F,OAAO,KAAK,EACV,6BAA6B,EAC7B,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AASpF,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,4BAA4B,EAAE,GACrC,SAAS,oBAAoB,EAAE,CAiEjC;AAiCD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE;IAC7C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAC9D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC,GAAG,6BAA6B,CAOhC"}
1
+ {"version":3,"file":"normalize-triggers.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/normalize-triggers.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAC7F,OAAO,KAAK,EACV,6BAA6B,EAC7B,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AASpF,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,4BAA4B,EAAE,GACrC,SAAS,oBAAoB,EAAE,CAiFjC;AAmCD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE;IAC7C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAC9D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC,GAAG,6BAA6B,CAYhC"}
@@ -9,18 +9,7 @@ export function normalizeTriggers(document, issues) {
9
9
  const triggers = document.triggers ?? {};
10
10
  const manualTriggerKeys = Object.entries(triggers).filter(([, trigger])=>trigger.source === manualTriggerSource).map(([sourceKey])=>sourceKey);
11
11
  const usedTriggerIds = new Map();
12
- if (manualTriggerKeys.length > 1) {
13
- issues.push(issue({
14
- code: 'multiple-manual-triggers',
15
- message: `A workflow may declare at most one manual trigger; found ${manualTriggerKeys.length}: ${manualTriggerKeys.join(', ')}.`,
16
- path: [
17
- 'triggers'
18
- ],
19
- details: {
20
- manualTriggerKeys
21
- }
22
- }));
23
- }
12
+ let activeManualTriggerSeen = false;
24
13
  return Object.entries(triggers).flatMap(([sourceKey, trigger])=>{
25
14
  const id = stableId(sourceKey);
26
15
  const existingSourceKey = usedTriggerIds.get(id);
@@ -38,18 +27,41 @@ export function normalizeTriggers(document, issues) {
38
27
  existingSourceKey,
39
28
  sourceKey
40
29
  ]
41
- }
30
+ },
31
+ scope: 'trigger'
42
32
  }));
43
33
  return [];
44
34
  }
45
35
  usedTriggerIds.set(id, sourceKey);
36
+ if (trigger.source === manualTriggerSource) {
37
+ if (activeManualTriggerSeen) {
38
+ issues.push(issue({
39
+ code: 'multiple-manual-triggers',
40
+ message: `A workflow may declare at most one manual trigger; found ${manualTriggerKeys.length}: ${manualTriggerKeys.join(', ')}. This trigger is inert because it is not the first manual trigger in document order.`,
41
+ path: [
42
+ 'triggers',
43
+ sourceKey
44
+ ],
45
+ details: {
46
+ manualTriggerKeys
47
+ },
48
+ scope: 'trigger'
49
+ }));
50
+ return [];
51
+ }
52
+ }
53
+ const triggerIssues = [];
46
54
  validateTriggerFilter({
47
55
  sourceKey,
48
56
  trigger,
49
- issues
57
+ issues: triggerIssues
50
58
  });
59
+ issues.push(...triggerIssues);
51
60
  const normalizedTrigger = normalizeTriggerEntry(trigger);
61
+ const triggerIsInert = triggerIssues.some((candidate)=>candidate.scope === 'trigger');
52
62
  if (trigger.source !== cronTriggerSource) {
63
+ if (triggerIsInert) return [];
64
+ if (trigger.source === manualTriggerSource) activeManualTriggerSeen = true;
53
65
  return [
54
66
  {
55
67
  id,
@@ -66,12 +78,16 @@ export function normalizeTriggers(document, issues) {
66
78
  ...cronConfig,
67
79
  timezone: cronConfig.timezone ?? cronTriggerDefaultTimezone
68
80
  };
81
+ const cronIssues = [];
69
82
  validateCronTrigger({
70
83
  trigger,
71
84
  config: cronConfig,
72
85
  sourceKey,
73
- issues
86
+ issues: cronIssues
74
87
  });
88
+ issues.push(...cronIssues);
89
+ const cronIsInert = cronIssues.some((candidate)=>candidate.scope === 'trigger');
90
+ if (triggerIsInert || cronIsInert) return [];
75
91
  return [
76
92
  {
77
93
  id,
@@ -98,7 +114,8 @@ function validateTriggerFilter(params) {
98
114
  details: {
99
115
  source: trigger.filter,
100
116
  triggerSource: trigger.source
101
- }
117
+ },
118
+ scope: 'trigger'
102
119
  }));
103
120
  return;
104
121
  }
@@ -108,13 +125,21 @@ function validateTriggerFilter(params) {
108
125
  path,
109
126
  invalidCode: 'invalid-trigger-filter',
110
127
  invalidMessage: 'Trigger filter must be a valid boolean predicate.',
111
- issues
128
+ issues,
129
+ scope: 'trigger'
112
130
  });
113
131
  }
114
132
  export function normalizeTriggerEntry(trigger) {
133
+ // `manual` and `cron` have no delivered event to resolve against at fire
134
+ // time, so materialize their built-in name when the author omitted it.
135
+ // Integration sources keep the event absent, which becomes a source
136
+ // subscription (NULL row) on the write path.
137
+ const event = builtinEventForSource(trigger.source, trigger.event);
115
138
  return {
116
139
  source: trigger.source,
117
- event: trigger.event,
140
+ ...event === undefined ? {} : {
141
+ event
142
+ },
118
143
  ...trigger.with === undefined ? {} : {
119
144
  inputs: trigger.with
120
145
  },
@@ -123,5 +148,10 @@ export function normalizeTriggerEntry(trigger) {
123
148
  }
124
149
  };
125
150
  }
151
+ function builtinEventForSource(source, event) {
152
+ if (source === manualTriggerSource) return event ?? 'fire';
153
+ if (source === cronTriggerSource) return event ?? 'tick';
154
+ return event;
155
+ }
126
156
 
127
157
  //# sourceMappingURL=normalize-triggers.js.map