@shipfox/api-definitions 2.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.
- package/.turbo/turbo-build.log +2 -0
- package/.turbo/turbo-type$colon$emit.log +1 -0
- package/.turbo/turbo-type.log +1 -0
- package/CHANGELOG.md +215 -0
- package/LICENSE +21 -0
- package/dist/config.d.ts +10 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +35 -0
- package/dist/config.js.map +1 -0
- package/dist/core/entities/index.d.ts +5 -0
- package/dist/core/entities/index.d.ts.map +1 -0
- package/dist/core/entities/index.js +6 -0
- package/dist/core/entities/index.js.map +1 -0
- package/dist/core/entities/integration-context.d.ts +11 -0
- package/dist/core/entities/integration-context.d.ts.map +1 -0
- package/dist/core/entities/integration-context.js +3 -0
- package/dist/core/entities/integration-context.js.map +1 -0
- package/dist/core/entities/sync-state.d.ts +19 -0
- package/dist/core/entities/sync-state.d.ts.map +1 -0
- package/dist/core/entities/sync-state.js +20 -0
- package/dist/core/entities/sync-state.js.map +1 -0
- package/dist/core/entities/workflow-definition.d.ts +35 -0
- package/dist/core/entities/workflow-definition.d.ts.map +1 -0
- package/dist/core/entities/workflow-definition.js +3 -0
- package/dist/core/entities/workflow-definition.js.map +1 -0
- package/dist/core/entities/workflow-model.d.ts +138 -0
- package/dist/core/entities/workflow-model.d.ts.map +1 -0
- package/dist/core/entities/workflow-model.js +3 -0
- package/dist/core/entities/workflow-model.js.map +1 -0
- package/dist/core/errors.d.ts +10 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +14 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/has-agent-step-integrations.d.ts +3 -0
- package/dist/core/has-agent-step-integrations.d.ts.map +1 -0
- package/dist/core/has-agent-step-integrations.js +5 -0
- package/dist/core/has-agent-step-integrations.js.map +1 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +9 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/parse-definition.d.ts +9 -0
- package/dist/core/parse-definition.d.ts.map +1 -0
- package/dist/core/parse-definition.js +17 -0
- package/dist/core/parse-definition.js.map +1 -0
- package/dist/core/sync-definitions.d.ts +44 -0
- package/dist/core/sync-definitions.d.ts.map +1 -0
- package/dist/core/sync-definitions.js +140 -0
- package/dist/core/sync-definitions.js.map +1 -0
- package/dist/core/validate-definition.d.ts +20 -0
- package/dist/core/validate-definition.d.ts.map +1 -0
- package/dist/core/validate-definition.js +61 -0
- package/dist/core/validate-definition.js.map +1 -0
- package/dist/core/workflow-model/constants.d.ts +2 -0
- package/dist/core/workflow-model/constants.d.ts.map +1 -0
- package/dist/core/workflow-model/constants.js +3 -0
- package/dist/core/workflow-model/constants.js.map +1 -0
- package/dist/core/workflow-model/cron-trigger.d.ts +16 -0
- package/dist/core/workflow-model/cron-trigger.d.ts.map +1 -0
- package/dist/core/workflow-model/cron-trigger.js +85 -0
- package/dist/core/workflow-model/cron-trigger.js.map +1 -0
- package/dist/core/workflow-model/index.d.ts +4 -0
- package/dist/core/workflow-model/index.d.ts.map +1 -0
- package/dist/core/workflow-model/index.js +5 -0
- package/dist/core/workflow-model/index.js.map +1 -0
- package/dist/core/workflow-model/invalid-workflow-model-error.d.ts +15 -0
- package/dist/core/workflow-model/invalid-workflow-model-error.d.ts.map +1 -0
- package/dist/core/workflow-model/invalid-workflow-model-error.js +9 -0
- package/dist/core/workflow-model/invalid-workflow-model-error.js.map +1 -0
- package/dist/core/workflow-model/map-job-ids.d.ts +4 -0
- package/dist/core/workflow-model/map-job-ids.d.ts.map +1 -0
- package/dist/core/workflow-model/map-job-ids.js +33 -0
- package/dist/core/workflow-model/map-job-ids.js.map +1 -0
- package/dist/core/workflow-model/normalize-agent-integrations.d.ts +12 -0
- package/dist/core/workflow-model/normalize-agent-integrations.d.ts.map +1 -0
- package/dist/core/workflow-model/normalize-agent-integrations.js +157 -0
- package/dist/core/workflow-model/normalize-agent-integrations.js.map +1 -0
- package/dist/core/workflow-model/normalize-dependencies.d.ts +6 -0
- package/dist/core/workflow-model/normalize-dependencies.d.ts.map +1 -0
- package/dist/core/workflow-model/normalize-dependencies.js +119 -0
- package/dist/core/workflow-model/normalize-dependencies.js.map +1 -0
- package/dist/core/workflow-model/normalize-env.d.ts +17 -0
- package/dist/core/workflow-model/normalize-env.d.ts.map +1 -0
- package/dist/core/workflow-model/normalize-env.js +40 -0
- package/dist/core/workflow-model/normalize-env.js.map +1 -0
- package/dist/core/workflow-model/normalize-if-condition.d.ts +14 -0
- package/dist/core/workflow-model/normalize-if-condition.d.ts.map +1 -0
- package/dist/core/workflow-model/normalize-if-condition.js +75 -0
- package/dist/core/workflow-model/normalize-if-condition.js.map +1 -0
- package/dist/core/workflow-model/normalize-job-checkout.d.ts +5 -0
- package/dist/core/workflow-model/normalize-job-checkout.d.ts.map +1 -0
- package/dist/core/workflow-model/normalize-job-checkout.js +16 -0
- package/dist/core/workflow-model/normalize-job-checkout.js.map +1 -0
- package/dist/core/workflow-model/normalize-job-listening.d.ts +10 -0
- package/dist/core/workflow-model/normalize-job-listening.d.ts.map +1 -0
- package/dist/core/workflow-model/normalize-job-listening.js +125 -0
- package/dist/core/workflow-model/normalize-job-listening.js.map +1 -0
- package/dist/core/workflow-model/normalize-job-success.d.ts +11 -0
- package/dist/core/workflow-model/normalize-job-success.d.ts.map +1 -0
- package/dist/core/workflow-model/normalize-job-success.js +23 -0
- package/dist/core/workflow-model/normalize-job-success.js.map +1 -0
- package/dist/core/workflow-model/normalize-jobs.d.ts +12 -0
- package/dist/core/workflow-model/normalize-jobs.d.ts.map +1 -0
- package/dist/core/workflow-model/normalize-jobs.js +935 -0
- package/dist/core/workflow-model/normalize-jobs.js.map +1 -0
- package/dist/core/workflow-model/normalize-needs.d.ts +2 -0
- package/dist/core/workflow-model/normalize-needs.d.ts.map +1 -0
- package/dist/core/workflow-model/normalize-needs.js +16 -0
- package/dist/core/workflow-model/normalize-needs.js.map +1 -0
- package/dist/core/workflow-model/normalize-step-gate.d.ts +15 -0
- package/dist/core/workflow-model/normalize-step-gate.d.ts.map +1 -0
- package/dist/core/workflow-model/normalize-step-gate.js +89 -0
- package/dist/core/workflow-model/normalize-step-gate.js.map +1 -0
- package/dist/core/workflow-model/normalize-step-outputs.d.ts +10 -0
- package/dist/core/workflow-model/normalize-step-outputs.d.ts.map +1 -0
- package/dist/core/workflow-model/normalize-step-outputs.js +32 -0
- package/dist/core/workflow-model/normalize-step-outputs.js.map +1 -0
- package/dist/core/workflow-model/normalize-triggers.d.ts +11 -0
- package/dist/core/workflow-model/normalize-triggers.d.ts.map +1 -0
- package/dist/core/workflow-model/normalize-triggers.js +128 -0
- package/dist/core/workflow-model/normalize-triggers.js.map +1 -0
- package/dist/core/workflow-model/normalize-workflow-document.d.ts +11 -0
- package/dist/core/workflow-model/normalize-workflow-document.d.ts.map +1 -0
- package/dist/core/workflow-model/normalize-workflow-document.js +43 -0
- package/dist/core/workflow-model/normalize-workflow-document.js.map +1 -0
- package/dist/core/workflow-model/parse-duration-ms.d.ts +11 -0
- package/dist/core/workflow-model/parse-duration-ms.d.ts.map +1 -0
- package/dist/core/workflow-model/parse-duration-ms.js +47 -0
- package/dist/core/workflow-model/parse-duration-ms.js.map +1 -0
- package/dist/core/workflow-model/parse-interpolation-field.d.ts +14 -0
- package/dist/core/workflow-model/parse-interpolation-field.d.ts.map +1 -0
- package/dist/core/workflow-model/parse-interpolation-field.js +377 -0
- package/dist/core/workflow-model/parse-interpolation-field.js.map +1 -0
- package/dist/core/workflow-model/stable-id.d.ts +2 -0
- package/dist/core/workflow-model/stable-id.d.ts.map +1 -0
- package/dist/core/workflow-model/stable-id.js +8 -0
- package/dist/core/workflow-model/stable-id.js.map +1 -0
- package/dist/core/workflow-model/validate-job-references.d.ts +10 -0
- package/dist/core/workflow-model/validate-job-references.d.ts.map +1 -0
- package/dist/core/workflow-model/validate-job-references.js +42 -0
- package/dist/core/workflow-model/validate-job-references.js.map +1 -0
- package/dist/core/workflow-model/validate-predicate-expression.d.ts +14 -0
- package/dist/core/workflow-model/validate-predicate-expression.d.ts.map +1 -0
- package/dist/core/workflow-model/validate-predicate-expression.js +273 -0
- package/dist/core/workflow-model/validate-predicate-expression.js.map +1 -0
- package/dist/core/workflow-model/validation-issue.d.ts +8 -0
- package/dist/core/workflow-model/validation-issue.d.ts.map +1 -0
- package/dist/core/workflow-model/validation-issue.js +17 -0
- package/dist/core/workflow-model/validation-issue.js.map +1 -0
- package/dist/core/workflow-model/workflow-field-label.d.ts +3 -0
- package/dist/core/workflow-model/workflow-field-label.d.ts.map +1 -0
- package/dist/core/workflow-model/workflow-field-label.js +47 -0
- package/dist/core/workflow-model/workflow-field-label.js.map +1 -0
- package/dist/core/workflow-yaml/index.d.ts +3 -0
- package/dist/core/workflow-yaml/index.d.ts.map +1 -0
- package/dist/core/workflow-yaml/index.js +4 -0
- package/dist/core/workflow-yaml/index.js.map +1 -0
- package/dist/core/workflow-yaml/invalid-workflow-yaml-error.d.ts +16 -0
- package/dist/core/workflow-yaml/invalid-workflow-yaml-error.d.ts.map +1 -0
- package/dist/core/workflow-yaml/invalid-workflow-yaml-error.js +12 -0
- package/dist/core/workflow-yaml/invalid-workflow-yaml-error.js.map +1 -0
- package/dist/core/workflow-yaml/parse-workflow-yaml.d.ts +9 -0
- package/dist/core/workflow-yaml/parse-workflow-yaml.d.ts.map +1 -0
- package/dist/core/workflow-yaml/parse-workflow-yaml.js +52 -0
- package/dist/core/workflow-yaml/parse-workflow-yaml.js.map +1 -0
- package/dist/core/workflow-yaml/source-locations.d.ts +3 -0
- package/dist/core/workflow-yaml/source-locations.d.ts.map +1 -0
- package/dist/core/workflow-yaml/source-locations.js +48 -0
- package/dist/core/workflow-yaml/source-locations.js.map +1 -0
- package/dist/db/db.d.ts +1277 -0
- package/dist/db/db.d.ts.map +1 -0
- package/dist/db/db.js +22 -0
- package/dist/db/db.js.map +1 -0
- package/dist/db/definition-triggers.d.ts +4 -0
- package/dist/db/definition-triggers.d.ts.map +1 -0
- package/dist/db/definition-triggers.js +17 -0
- package/dist/db/definition-triggers.js.map +1 -0
- package/dist/db/definitions.d.ts +63 -0
- package/dist/db/definitions.d.ts.map +1 -0
- package/dist/db/definitions.js +208 -0
- package/dist/db/definitions.js.map +1 -0
- package/dist/db/index.d.ts +8 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +10 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/schema/common.d.ts +2 -0
- package/dist/db/schema/common.d.ts.map +1 -0
- package/dist/db/schema/common.js +4 -0
- package/dist/db/schema/common.js.map +1 -0
- package/dist/db/schema/definitions.d.ts +237 -0
- package/dist/db/schema/definitions.d.ts.map +1 -0
- package/dist/db/schema/definitions.js +63 -0
- package/dist/db/schema/definitions.js.map +1 -0
- package/dist/db/schema/outbox.d.ts +195 -0
- package/dist/db/schema/outbox.d.ts.map +1 -0
- package/dist/db/schema/outbox.js +5 -0
- package/dist/db/schema/outbox.js.map +1 -0
- package/dist/db/schema/sync-states.d.ts +218 -0
- package/dist/db/schema/sync-states.d.ts.map +1 -0
- package/dist/db/schema/sync-states.js +68 -0
- package/dist/db/schema/sync-states.js.map +1 -0
- package/dist/db/sync-states.d.ts +21 -0
- package/dist/db/sync-states.d.ts.map +1 -0
- package/dist/db/sync-states.js +47 -0
- package/dist/db/sync-states.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +63 -0
- package/dist/index.js.map +1 -0
- package/dist/presentation/dto/definition.d.ts +6 -0
- package/dist/presentation/dto/definition.d.ts.map +1 -0
- package/dist/presentation/dto/definition.js +35 -0
- package/dist/presentation/dto/definition.js.map +1 -0
- package/dist/presentation/dto/index.d.ts +2 -0
- package/dist/presentation/dto/index.d.ts.map +1 -0
- package/dist/presentation/dto/index.js +3 -0
- package/dist/presentation/dto/index.js.map +1 -0
- package/dist/presentation/index.d.ts +2 -0
- package/dist/presentation/index.d.ts.map +1 -0
- package/dist/presentation/index.js +3 -0
- package/dist/presentation/index.js.map +1 -0
- package/dist/presentation/routes/create-definition.d.ts +9 -0
- package/dist/presentation/routes/create-definition.d.ts.map +1 -0
- package/dist/presentation/routes/create-definition.js +76 -0
- package/dist/presentation/routes/create-definition.js.map +1 -0
- package/dist/presentation/routes/get-definition.d.ts +2 -0
- package/dist/presentation/routes/get-definition.d.ts.map +1 -0
- package/dist/presentation/routes/get-definition.js +43 -0
- package/dist/presentation/routes/get-definition.js.map +1 -0
- package/dist/presentation/routes/index.d.ts +7 -0
- package/dist/presentation/routes/index.d.ts.map +1 -0
- package/dist/presentation/routes/index.js +22 -0
- package/dist/presentation/routes/index.js.map +1 -0
- package/dist/presentation/routes/list-definitions.d.ts +2 -0
- package/dist/presentation/routes/list-definitions.d.ts.map +1 -0
- package/dist/presentation/routes/list-definitions.js +56 -0
- package/dist/presentation/routes/list-definitions.js.map +1 -0
- package/dist/presentation/routes/validate-definition.d.ts +2 -0
- package/dist/presentation/routes/validate-definition.d.ts.map +1 -0
- package/dist/presentation/routes/validate-definition.js +43 -0
- package/dist/presentation/routes/validate-definition.js.map +1 -0
- package/dist/presentation/subscribers/index.d.ts +3 -0
- package/dist/presentation/subscribers/index.d.ts.map +1 -0
- package/dist/presentation/subscribers/index.js +4 -0
- package/dist/presentation/subscribers/index.js.map +1 -0
- package/dist/presentation/subscribers/on-project-source-bound.d.ts +3 -0
- package/dist/presentation/subscribers/on-project-source-bound.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-project-source-bound.js +11 -0
- package/dist/presentation/subscribers/on-project-source-bound.js.map +1 -0
- package/dist/presentation/subscribers/on-project-source-commit-observed.d.ts +3 -0
- package/dist/presentation/subscribers/on-project-source-commit-observed.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-project-source-commit-observed.js +13 -0
- package/dist/presentation/subscribers/on-project-source-commit-observed.js.map +1 -0
- package/dist/presentation/subscribers/start-definition-sync.d.ts +10 -0
- package/dist/presentation/subscribers/start-definition-sync.d.ts.map +1 -0
- package/dist/presentation/subscribers/start-definition-sync.js +26 -0
- package/dist/presentation/subscribers/start-definition-sync.js.map +1 -0
- package/dist/temporal/activities/index.d.ts +3 -0
- package/dist/temporal/activities/index.d.ts.map +1 -0
- package/dist/temporal/activities/index.js +3 -0
- package/dist/temporal/activities/index.js.map +1 -0
- package/dist/temporal/activities/sync-activities.d.ts +47 -0
- package/dist/temporal/activities/sync-activities.d.ts.map +1 -0
- package/dist/temporal/activities/sync-activities.js +128 -0
- package/dist/temporal/activities/sync-activities.js.map +1 -0
- package/dist/temporal/constants.d.ts +3 -0
- package/dist/temporal/constants.d.ts.map +1 -0
- package/dist/temporal/constants.js +4 -0
- package/dist/temporal/constants.js.map +1 -0
- package/dist/temporal/index.d.ts +3 -0
- package/dist/temporal/index.d.ts.map +1 -0
- package/dist/temporal/index.js +4 -0
- package/dist/temporal/index.js.map +1 -0
- package/dist/temporal/workflows/definition-sync.d.ts +20 -0
- package/dist/temporal/workflows/definition-sync.d.ts.map +1 -0
- package/dist/temporal/workflows/definition-sync.js +95 -0
- package/dist/temporal/workflows/definition-sync.js.map +1 -0
- package/dist/temporal/workflows/index.d.ts +2 -0
- package/dist/temporal/workflows/index.d.ts.map +1 -0
- package/dist/temporal/workflows/index.js +3 -0
- package/dist/temporal/workflows/index.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -0
- package/drizzle/0000_initial.sql +64 -0
- package/drizzle/0001_definition_list_pagination.sql +1 -0
- package/drizzle/meta/0000_snapshot.json +527 -0
- package/drizzle/meta/_journal.json +20 -0
- package/drizzle.config.ts +11 -0
- package/package.json +89 -0
- package/src/config.test.ts +23 -0
- package/src/config.ts +50 -0
- package/src/core/entities/index.ts +4 -0
- package/src/core/entities/integration-context.ts +21 -0
- package/src/core/entities/sync-state.ts +40 -0
- package/src/core/entities/workflow-definition.ts +38 -0
- package/src/core/entities/workflow-model.ts +162 -0
- package/src/core/errors.ts +21 -0
- package/src/core/has-agent-step-integrations.ts +7 -0
- package/src/core/index.ts +23 -0
- package/src/core/parse-definition.test.ts +200 -0
- package/src/core/parse-definition.ts +28 -0
- package/src/core/sync-definitions.test.ts +390 -0
- package/src/core/sync-definitions.ts +216 -0
- package/src/core/validate-definition.test.ts +152 -0
- package/src/core/validate-definition.ts +72 -0
- package/src/core/workflow-model/README.md +129 -0
- package/src/core/workflow-model/constants.ts +1 -0
- package/src/core/workflow-model/cron-trigger.test.ts +29 -0
- package/src/core/workflow-model/cron-trigger.ts +83 -0
- package/src/core/workflow-model/index.ts +9 -0
- package/src/core/workflow-model/invalid-workflow-model-error.ts +71 -0
- package/src/core/workflow-model/map-job-ids.ts +33 -0
- package/src/core/workflow-model/normalize-agent-integrations.ts +208 -0
- package/src/core/workflow-model/normalize-dependencies.ts +139 -0
- package/src/core/workflow-model/normalize-env.ts +48 -0
- package/src/core/workflow-model/normalize-if-condition.ts +126 -0
- package/src/core/workflow-model/normalize-job-checkout.ts +19 -0
- package/src/core/workflow-model/normalize-job-listening.ts +121 -0
- package/src/core/workflow-model/normalize-job-success.ts +28 -0
- package/src/core/workflow-model/normalize-jobs.ts +1010 -0
- package/src/core/workflow-model/normalize-needs.ts +12 -0
- package/src/core/workflow-model/normalize-step-gate.ts +90 -0
- package/src/core/workflow-model/normalize-step-outputs.ts +36 -0
- package/src/core/workflow-model/normalize-triggers.ts +130 -0
- package/src/core/workflow-model/normalize-workflow-document.test.ts +4463 -0
- package/src/core/workflow-model/normalize-workflow-document.ts +63 -0
- package/src/core/workflow-model/parse-duration-ms.ts +58 -0
- package/src/core/workflow-model/parse-interpolation-field.ts +566 -0
- package/src/core/workflow-model/stable-id.ts +12 -0
- package/src/core/workflow-model/validate-job-references.ts +54 -0
- package/src/core/workflow-model/validate-predicate-expression.test.ts +161 -0
- package/src/core/workflow-model/validate-predicate-expression.ts +406 -0
- package/src/core/workflow-model/validation-issue.ts +27 -0
- package/src/core/workflow-model/workflow-field-label.ts +50 -0
- package/src/core/workflow-yaml/README.md +77 -0
- package/src/core/workflow-yaml/index.ts +11 -0
- package/src/core/workflow-yaml/invalid-workflow-yaml-error.ts +23 -0
- package/src/core/workflow-yaml/parse-workflow-yaml.test.ts +71 -0
- package/src/core/workflow-yaml/parse-workflow-yaml.ts +74 -0
- package/src/core/workflow-yaml/source-locations.ts +62 -0
- package/src/db/db.ts +18 -0
- package/src/db/definition-triggers.test.ts +95 -0
- package/src/db/definition-triggers.ts +17 -0
- package/src/db/definitions.test.ts +1309 -0
- package/src/db/definitions.ts +357 -0
- package/src/db/index.ts +31 -0
- package/src/db/schema/common.ts +3 -0
- package/src/db/schema/definitions.test.ts +36 -0
- package/src/db/schema/definitions.ts +76 -0
- package/src/db/schema/outbox.ts +4 -0
- package/src/db/schema/sync-states.ts +79 -0
- package/src/db/sync-states.test.ts +90 -0
- package/src/db/sync-states.ts +86 -0
- package/src/index.ts +104 -0
- package/src/presentation/dto/definition.test.ts +59 -0
- package/src/presentation/dto/definition.ts +41 -0
- package/src/presentation/dto/index.ts +1 -0
- package/src/presentation/index.ts +1 -0
- package/src/presentation/routes/create-definition.test.ts +356 -0
- package/src/presentation/routes/create-definition.ts +101 -0
- package/src/presentation/routes/get-definition.test.ts +79 -0
- package/src/presentation/routes/get-definition.ts +37 -0
- package/src/presentation/routes/index.test.ts +41 -0
- package/src/presentation/routes/index.ts +28 -0
- package/src/presentation/routes/list-definitions.test.ts +195 -0
- package/src/presentation/routes/list-definitions.ts +49 -0
- package/src/presentation/routes/validate-definition.test.ts +63 -0
- package/src/presentation/routes/validate-definition.ts +46 -0
- package/src/presentation/subscribers/index.ts +2 -0
- package/src/presentation/subscribers/on-project-source-bound.test.ts +65 -0
- package/src/presentation/subscribers/on-project-source-bound.ts +11 -0
- package/src/presentation/subscribers/on-project-source-commit-observed.test.ts +56 -0
- package/src/presentation/subscribers/on-project-source-commit-observed.ts +15 -0
- package/src/presentation/subscribers/start-definition-sync.ts +38 -0
- package/src/temporal/activities/index.ts +10 -0
- package/src/temporal/activities/sync-activities.test.ts +337 -0
- package/src/temporal/activities/sync-activities.ts +206 -0
- package/src/temporal/constants.ts +2 -0
- package/src/temporal/index.ts +2 -0
- package/src/temporal/workflows/definition-sync.test.ts +59 -0
- package/src/temporal/workflows/definition-sync.ts +116 -0
- package/src/temporal/workflows/index.ts +1 -0
- package/test/env.ts +7 -0
- package/test/factories/definition.ts +66 -0
- package/test/fixtures/invalid-cycle.yml +13 -0
- package/test/fixtures/invalid-missing-name.yml +4 -0
- package/test/fixtures/invalid-yaml-syntax.yml +6 -0
- package/test/fixtures/valid-dag.yml +25 -0
- package/test/fixtures/valid-listening-job.yml +21 -0
- package/test/fixtures/valid-simple.yml +18 -0
- package/test/fixtures/workflow-yaml/invalid/invalid-yaml-syntax.yaml +6 -0
- package/test/fixtures/workflow-yaml/invalid/missing-step-run.yaml +5 -0
- package/test/fixtures/workflow-yaml/valid/simple-build.document.json +26 -0
- package/test/fixtures/workflow-yaml/valid/simple-build.yaml +14 -0
- package/test/globalSetup.ts +25 -0
- package/test/index.ts +1 -0
- package/test/setup.ts +17 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/tsconfig.test.json +8 -0
- package/vitest.config.ts +11 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function normalizeNeeds(value: string | readonly string[] | undefined): readonly string[] {
|
|
2
|
+
return uniqueStrings(normalizeStringArray(value));
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
function normalizeStringArray(value: string | readonly string[] | undefined): readonly string[] {
|
|
6
|
+
if (value === undefined) return [];
|
|
7
|
+
return typeof value === 'string' ? [value] : value;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function uniqueStrings(values: readonly string[]): readonly string[] {
|
|
11
|
+
return [...new Set(values)];
|
|
12
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type {ExpressionTypeEnvironment, WorkflowExpression} from '@shipfox/expression';
|
|
2
|
+
import type {WorkflowDocumentStep} from '@shipfox/workflow-document';
|
|
3
|
+
import type {WorkflowModelStepGate} from '../entities/workflow-model.js';
|
|
4
|
+
import type {WorkflowModelValidationIssue} from './invalid-workflow-model-error.js';
|
|
5
|
+
import {parseInterpolationField} from './parse-interpolation-field.js';
|
|
6
|
+
import {validatePredicateExpression} from './validate-predicate-expression.js';
|
|
7
|
+
import {issue} from './validation-issue.js';
|
|
8
|
+
|
|
9
|
+
export function normalizeStepGate(params: {
|
|
10
|
+
step: WorkflowDocumentStep;
|
|
11
|
+
sourceName: string;
|
|
12
|
+
stepIndex: number;
|
|
13
|
+
stepId: string;
|
|
14
|
+
previousStepKeys: ReadonlySet<string>;
|
|
15
|
+
issues: WorkflowModelValidationIssue[];
|
|
16
|
+
allowedJobReferences: ReadonlySet<string>;
|
|
17
|
+
typeOverlay?: ExpressionTypeEnvironment | undefined;
|
|
18
|
+
}): WorkflowModelStepGate | undefined {
|
|
19
|
+
const gate = params.step.gate;
|
|
20
|
+
if (gate === undefined) return undefined;
|
|
21
|
+
|
|
22
|
+
const success = normalizeGateSuccess({
|
|
23
|
+
source: gate.success,
|
|
24
|
+
sourceName: params.sourceName,
|
|
25
|
+
stepIndex: params.stepIndex,
|
|
26
|
+
issues: params.issues,
|
|
27
|
+
allowedJobReferences: params.allowedJobReferences,
|
|
28
|
+
typeOverlay: params.typeOverlay,
|
|
29
|
+
});
|
|
30
|
+
const feedbackTemplate =
|
|
31
|
+
gate.on_failure?.feedback === undefined
|
|
32
|
+
? undefined
|
|
33
|
+
: parseInterpolationField({
|
|
34
|
+
field: 'step.feedback',
|
|
35
|
+
source: gate.on_failure.feedback,
|
|
36
|
+
path: ['jobs', params.sourceName, 'steps', params.stepIndex, 'gate', 'on_failure'],
|
|
37
|
+
issues: params.issues,
|
|
38
|
+
fillSite: 'step-report',
|
|
39
|
+
typeOverlay: params.typeOverlay,
|
|
40
|
+
});
|
|
41
|
+
const onFailure =
|
|
42
|
+
gate.on_failure === undefined
|
|
43
|
+
? undefined
|
|
44
|
+
: {
|
|
45
|
+
restartFrom: gate.on_failure.restart_from,
|
|
46
|
+
...(gate.on_failure.feedback === undefined ? {} : {feedback: gate.on_failure.feedback}),
|
|
47
|
+
...(feedbackTemplate === undefined ? {} : {feedbackTemplate}),
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
if (gate.on_failure !== undefined && !params.previousStepKeys.has(gate.on_failure.restart_from)) {
|
|
51
|
+
params.issues.push(
|
|
52
|
+
issue({
|
|
53
|
+
code: 'invalid-step-gate-restart-from',
|
|
54
|
+
message: `Step "${params.stepId}" must restart from an earlier keyed step; found "${gate.on_failure.restart_from}".`,
|
|
55
|
+
path: ['jobs', params.sourceName, 'steps', params.stepIndex, 'gate', 'on_failure'],
|
|
56
|
+
details: {stepId: params.stepId, restartFrom: gate.on_failure.restart_from},
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (success === undefined && onFailure === undefined) return undefined;
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
...(success === undefined ? {} : {success}),
|
|
65
|
+
...(onFailure === undefined ? {} : {onFailure}),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function normalizeGateSuccess(params: {
|
|
70
|
+
source: string | undefined;
|
|
71
|
+
sourceName: string;
|
|
72
|
+
stepIndex: number;
|
|
73
|
+
issues: WorkflowModelValidationIssue[];
|
|
74
|
+
allowedJobReferences: ReadonlySet<string>;
|
|
75
|
+
typeOverlay?: ExpressionTypeEnvironment | undefined;
|
|
76
|
+
}): WorkflowExpression | undefined {
|
|
77
|
+
if (params.source === undefined) return undefined;
|
|
78
|
+
|
|
79
|
+
return validatePredicateExpression({
|
|
80
|
+
field: 'step.success',
|
|
81
|
+
source: params.source,
|
|
82
|
+
site: 'step-report',
|
|
83
|
+
path: ['jobs', params.sourceName, 'steps', params.stepIndex, 'gate', 'success'],
|
|
84
|
+
invalidCode: 'invalid-step-gate-success',
|
|
85
|
+
invalidMessage: 'Step gate success must be a valid CEL boolean expression.',
|
|
86
|
+
issues: params.issues,
|
|
87
|
+
allowedJobReferences: params.allowedJobReferences,
|
|
88
|
+
typeOverlay: params.typeOverlay,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {type OutputDeclarations, validateJsonSchema} from '@shipfox/expression';
|
|
2
|
+
import type {WorkflowDocumentStep} from '@shipfox/workflow-document';
|
|
3
|
+
import type {WorkflowModelValidationIssue} from './invalid-workflow-model-error.js';
|
|
4
|
+
import {issue} from './validation-issue.js';
|
|
5
|
+
|
|
6
|
+
export function normalizeStepOutputs(params: {
|
|
7
|
+
step: WorkflowDocumentStep;
|
|
8
|
+
sourceName: string;
|
|
9
|
+
stepIndex: number;
|
|
10
|
+
issues: WorkflowModelValidationIssue[];
|
|
11
|
+
}): OutputDeclarations | undefined {
|
|
12
|
+
const outputs = params.step.outputs;
|
|
13
|
+
if (outputs === undefined) return undefined;
|
|
14
|
+
|
|
15
|
+
for (const [key, declaration] of Object.entries(outputs)) {
|
|
16
|
+
const schema = 'schema' in declaration ? declaration.schema : undefined;
|
|
17
|
+
if (declaration.type !== 'json' || schema === undefined) continue;
|
|
18
|
+
|
|
19
|
+
const validation = validateJsonSchema(schema);
|
|
20
|
+
if (validation.ok) continue;
|
|
21
|
+
|
|
22
|
+
params.issues.push(
|
|
23
|
+
issue({
|
|
24
|
+
code: 'invalid-output-schema',
|
|
25
|
+
message: `Step output "${key}" must declare a valid JSON Schema.`,
|
|
26
|
+
path: ['jobs', params.sourceName, 'steps', params.stepIndex, 'outputs', key, 'schema'],
|
|
27
|
+
details: {
|
|
28
|
+
output: key,
|
|
29
|
+
reason: validation.reason,
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return outputs;
|
|
36
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {triggerSourceConfigSchemas, type WorkflowDocument} from '@shipfox/workflow-document';
|
|
2
|
+
import type {
|
|
3
|
+
WorkflowModelListeningTrigger,
|
|
4
|
+
WorkflowModelTrigger,
|
|
5
|
+
} from '../entities/workflow-model.js';
|
|
6
|
+
import {cronTriggerDefaultTimezone, validateCronTrigger} from './cron-trigger.js';
|
|
7
|
+
import type {WorkflowModelValidationIssue} from './invalid-workflow-model-error.js';
|
|
8
|
+
import {stableId} from './stable-id.js';
|
|
9
|
+
import {validatePredicateExpression} from './validate-predicate-expression.js';
|
|
10
|
+
import {issue} from './validation-issue.js';
|
|
11
|
+
|
|
12
|
+
const manualTriggerSource = 'manual';
|
|
13
|
+
const cronTriggerSource = 'cron';
|
|
14
|
+
type WorkflowDocumentTrigger = NonNullable<WorkflowDocument['triggers']>[string];
|
|
15
|
+
|
|
16
|
+
export function normalizeTriggers(
|
|
17
|
+
document: WorkflowDocument,
|
|
18
|
+
issues: WorkflowModelValidationIssue[],
|
|
19
|
+
): readonly WorkflowModelTrigger[] {
|
|
20
|
+
const triggers = document.triggers ?? {};
|
|
21
|
+
const manualTriggerKeys = Object.entries(triggers)
|
|
22
|
+
.filter(([, trigger]) => trigger.source === manualTriggerSource)
|
|
23
|
+
.map(([sourceKey]) => sourceKey);
|
|
24
|
+
const usedTriggerIds = new Map<string, string>();
|
|
25
|
+
|
|
26
|
+
if (manualTriggerKeys.length > 1) {
|
|
27
|
+
issues.push(
|
|
28
|
+
issue({
|
|
29
|
+
code: 'multiple-manual-triggers',
|
|
30
|
+
message: `A workflow may declare at most one manual trigger; found ${manualTriggerKeys.length}: ${manualTriggerKeys.join(', ')}.`,
|
|
31
|
+
path: ['triggers'],
|
|
32
|
+
details: {manualTriggerKeys},
|
|
33
|
+
}),
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return Object.entries(triggers).flatMap(([sourceKey, trigger]) => {
|
|
38
|
+
const id = stableId(sourceKey);
|
|
39
|
+
const existingSourceKey = usedTriggerIds.get(id);
|
|
40
|
+
if (existingSourceKey !== undefined) {
|
|
41
|
+
issues.push(
|
|
42
|
+
issue({
|
|
43
|
+
code: 'duplicate-trigger-id',
|
|
44
|
+
message: `Trigger keys "${existingSourceKey}" and "${sourceKey}" resolve to the same stable id "${id}".`,
|
|
45
|
+
path: ['triggers', sourceKey],
|
|
46
|
+
details: {id, sourceKeys: [existingSourceKey, sourceKey]},
|
|
47
|
+
}),
|
|
48
|
+
);
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
usedTriggerIds.set(id, sourceKey);
|
|
52
|
+
|
|
53
|
+
validateTriggerFilter({sourceKey, trigger, issues});
|
|
54
|
+
|
|
55
|
+
const normalizedTrigger = normalizeTriggerEntry(trigger);
|
|
56
|
+
if (trigger.source !== cronTriggerSource) {
|
|
57
|
+
return [
|
|
58
|
+
{
|
|
59
|
+
id,
|
|
60
|
+
key: sourceKey,
|
|
61
|
+
...normalizedTrigger,
|
|
62
|
+
...(trigger.config === undefined ? {} : {config: trigger.config}),
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const cronConfig = triggerSourceConfigSchemas.cron.parse(trigger.config ?? {});
|
|
68
|
+
const normalizedCronConfig = {
|
|
69
|
+
...cronConfig,
|
|
70
|
+
timezone: cronConfig.timezone ?? cronTriggerDefaultTimezone,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
validateCronTrigger({trigger, config: cronConfig, sourceKey, issues});
|
|
74
|
+
|
|
75
|
+
return [
|
|
76
|
+
{
|
|
77
|
+
id,
|
|
78
|
+
key: sourceKey,
|
|
79
|
+
...normalizedTrigger,
|
|
80
|
+
config: normalizedCronConfig,
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function validateTriggerFilter(params: {
|
|
87
|
+
sourceKey: string;
|
|
88
|
+
trigger: WorkflowDocumentTrigger;
|
|
89
|
+
issues: WorkflowModelValidationIssue[];
|
|
90
|
+
}): void {
|
|
91
|
+
const {sourceKey, trigger, issues} = params;
|
|
92
|
+
if (trigger.filter === undefined) return;
|
|
93
|
+
|
|
94
|
+
const path = ['triggers', sourceKey, 'filter'] as const;
|
|
95
|
+
if (trigger.source === manualTriggerSource || trigger.source === cronTriggerSource) {
|
|
96
|
+
issues.push(
|
|
97
|
+
issue({
|
|
98
|
+
code: 'invalid-trigger-filter',
|
|
99
|
+
message: `A ${trigger.source} trigger cannot define a filter because it does not receive an event payload.`,
|
|
100
|
+
path,
|
|
101
|
+
details: {source: trigger.filter, triggerSource: trigger.source},
|
|
102
|
+
}),
|
|
103
|
+
);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
validatePredicateExpression({
|
|
108
|
+
field: 'trigger.filter',
|
|
109
|
+
source: trigger.filter,
|
|
110
|
+
site: 'ingest',
|
|
111
|
+
path,
|
|
112
|
+
invalidCode: 'invalid-trigger-filter',
|
|
113
|
+
invalidMessage: 'Trigger filter must be a valid boolean predicate.',
|
|
114
|
+
issues,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function normalizeTriggerEntry(trigger: {
|
|
119
|
+
readonly source: string;
|
|
120
|
+
readonly event: string;
|
|
121
|
+
readonly with?: Readonly<Record<string, unknown>> | undefined;
|
|
122
|
+
readonly filter?: string | undefined;
|
|
123
|
+
}): WorkflowModelListeningTrigger {
|
|
124
|
+
return {
|
|
125
|
+
source: trigger.source,
|
|
126
|
+
event: trigger.event,
|
|
127
|
+
...(trigger.with === undefined ? {} : {inputs: trigger.with}),
|
|
128
|
+
...(trigger.filter === undefined ? {} : {filter: trigger.filter}),
|
|
129
|
+
};
|
|
130
|
+
}
|