@dcupl/cli 1.4.0-beta.0 → 1.4.0-beta.10
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/README.md +45 -0
- package/dist/cli.js +782 -149
- package/dist/cli.js.map +1 -1
- package/dist/functions/app/app-id.js +34 -2
- package/dist/functions/app/app-id.js.map +1 -1
- package/dist/functions/app/client/daemon-client.js.map +1 -1
- package/dist/functions/app/commands/cdn-host.d.ts +16 -0
- package/dist/functions/app/commands/cdn-host.js +47 -0
- package/dist/functions/app/commands/cdn-host.js.map +1 -0
- package/dist/functions/app/commands/create.js +50 -34
- package/dist/functions/app/commands/create.js.map +1 -1
- package/dist/functions/app/commands/destroy.js +10 -4
- package/dist/functions/app/commands/destroy.js.map +1 -1
- package/dist/functions/app/commands/detect-serve.js +17 -6
- package/dist/functions/app/commands/detect-serve.js.map +1 -1
- package/dist/functions/app/commands/fn/_fn-helpers.d.ts +13 -0
- package/dist/functions/app/commands/fn/_fn-helpers.js +64 -0
- package/dist/functions/app/commands/fn/_fn-helpers.js.map +1 -1
- package/dist/functions/app/commands/fn/aggregate.d.ts +8 -1
- package/dist/functions/app/commands/fn/aggregate.js +32 -3
- package/dist/functions/app/commands/fn/aggregate.js.map +1 -1
- package/dist/functions/app/commands/fn/facets.d.ts +1 -0
- package/dist/functions/app/commands/fn/facets.js +2 -0
- package/dist/functions/app/commands/fn/facets.js.map +1 -1
- package/dist/functions/app/commands/fn/group-by.d.ts +6 -0
- package/dist/functions/app/commands/fn/group-by.js +13 -22
- package/dist/functions/app/commands/fn/group-by.js.map +1 -1
- package/dist/functions/app/commands/fn/pivot.d.ts +14 -0
- package/dist/functions/app/commands/fn/pivot.js +72 -0
- package/dist/functions/app/commands/fn/pivot.js.map +1 -0
- package/dist/functions/app/commands/fn/suggest.d.ts +17 -0
- package/dist/functions/app/commands/fn/suggest.js +34 -0
- package/dist/functions/app/commands/fn/suggest.js.map +1 -0
- package/dist/functions/app/commands/list.js +6 -2
- package/dist/functions/app/commands/list.js.map +1 -1
- package/dist/functions/app/commands/loader-hash.js.map +1 -1
- package/dist/functions/app/commands/loaders/add.js +6 -0
- package/dist/functions/app/commands/loaders/add.js.map +1 -1
- package/dist/functions/app/commands/loaders/process-flags.js +4 -1
- package/dist/functions/app/commands/loaders/process-flags.js.map +1 -1
- package/dist/functions/app/commands/loaders/process.js +3 -1
- package/dist/functions/app/commands/loaders/process.js.map +1 -1
- package/dist/functions/app/commands/models/get.js.map +1 -1
- package/dist/functions/app/commands/models/keys.js.map +1 -1
- package/dist/functions/app/commands/models/remove.js.map +1 -1
- package/dist/functions/app/commands/models/set.js +3 -1
- package/dist/functions/app/commands/models/set.js.map +1 -1
- package/dist/functions/app/commands/query/execute.js +5 -2
- package/dist/functions/app/commands/query/execute.js.map +1 -1
- package/dist/functions/app/commands/query/one.js +3 -1
- package/dist/functions/app/commands/query/one.js.map +1 -1
- package/dist/functions/app/commands/render.js +10 -4
- package/dist/functions/app/commands/render.js.map +1 -1
- package/dist/functions/app/commands/resolve-app.js.map +1 -1
- package/dist/functions/app/commands/resolve-source.d.ts +1 -0
- package/dist/functions/app/commands/resolve-source.js +29 -6
- package/dist/functions/app/commands/resolve-source.js.map +1 -1
- package/dist/functions/app/commands/validate-report.d.ts +31 -0
- package/dist/functions/app/commands/validate-report.js +20 -1
- package/dist/functions/app/commands/validate-report.js.map +1 -1
- package/dist/functions/app/commands/validate.d.ts +1 -0
- package/dist/functions/app/commands/validate.js +32 -14
- package/dist/functions/app/commands/validate.js.map +1 -1
- package/dist/functions/app/daemon/app-server.module.js +6 -1
- package/dist/functions/app/daemon/app-server.module.js.map +1 -1
- package/dist/functions/app/daemon/controllers/data.controller.js +17 -6
- package/dist/functions/app/daemon/controllers/data.controller.js.map +1 -1
- package/dist/functions/app/daemon/controllers/fn.controller.d.ts +8 -0
- package/dist/functions/app/daemon/controllers/fn.controller.js +20 -0
- package/dist/functions/app/daemon/controllers/fn.controller.js.map +1 -1
- package/dist/functions/app/daemon/controllers/lifecycle.controller.js.map +1 -1
- package/dist/functions/app/daemon/controllers/query.controller.js +4 -1
- package/dist/functions/app/daemon/controllers/query.controller.js.map +1 -1
- package/dist/functions/app/daemon/daemon-args.js +2 -2
- package/dist/functions/app/daemon/daemon-args.js.map +1 -1
- package/dist/functions/app/daemon/filters/envelope-exception.filter.js +6 -1
- package/dist/functions/app/daemon/filters/envelope-exception.filter.js.map +1 -1
- package/dist/functions/app/daemon/main.js +14 -7
- package/dist/functions/app/daemon/main.js.map +1 -1
- package/dist/functions/app/daemon/services/attribute-validation.d.ts +21 -0
- package/dist/functions/app/daemon/services/attribute-validation.js +164 -0
- package/dist/functions/app/daemon/services/attribute-validation.js.map +1 -0
- package/dist/functions/app/daemon/services/dcupl-host.service.d.ts +7 -0
- package/dist/functions/app/daemon/services/dcupl-host.service.js +93 -16
- package/dist/functions/app/daemon/services/dcupl-host.service.js.map +1 -1
- package/dist/functions/app/daemon/services/idle-watchdog.service.js.map +1 -1
- package/dist/functions/app/daemon/services/ingest.service.js +8 -4
- package/dist/functions/app/daemon/services/ingest.service.js.map +1 -1
- package/dist/functions/app/daemon/services/init-options.js.map +1 -1
- package/dist/functions/app/daemon/services/loaders.service.d.ts +3 -1
- package/dist/functions/app/daemon/services/loaders.service.js +22 -6
- package/dist/functions/app/daemon/services/loaders.service.js.map +1 -1
- package/dist/functions/app/e2e/port-lock.d.ts +8 -0
- package/dist/functions/app/e2e/port-lock.js +66 -2
- package/dist/functions/app/e2e/port-lock.js.map +1 -1
- package/dist/functions/app/registry/registry.js +11 -10
- package/dist/functions/app/registry/registry.js.map +1 -1
- package/dist/functions/app/registry/serve-registry.js +13 -9
- package/dist/functions/app/registry/serve-registry.js.map +1 -1
- package/dist/functions/app/types.d.ts +2 -0
- package/dist/functions/config/commands/get.d.ts +3 -3
- package/dist/functions/config/commands/get.js +34 -16
- package/dist/functions/config/commands/get.js.map +1 -1
- package/dist/functions/config/commands/set.js +9 -4
- package/dist/functions/config/commands/set.js.map +1 -1
- package/dist/functions/config/io.d.ts +4 -1
- package/dist/functions/config/io.js +44 -11
- package/dist/functions/config/io.js.map +1 -1
- package/dist/functions/config/prompts.js +1 -3
- package/dist/functions/config/prompts.js.map +1 -1
- package/dist/functions/files/commands/copy.js +1 -1
- package/dist/functions/files/commands/copy.js.map +1 -1
- package/dist/functions/files/commands/delete.js +1 -1
- package/dist/functions/files/commands/delete.js.map +1 -1
- package/dist/functions/files/commands/list.js +6 -3
- package/dist/functions/files/commands/list.js.map +1 -1
- package/dist/functions/files/commands/move.js +1 -1
- package/dist/functions/files/commands/move.js.map +1 -1
- package/dist/functions/files/commands/pull.d.ts +16 -1
- package/dist/functions/files/commands/pull.js +135 -1
- package/dist/functions/files/commands/pull.js.map +1 -1
- package/dist/functions/files/commands/push.d.ts +1 -0
- package/dist/functions/files/commands/push.js +25 -3
- package/dist/functions/files/commands/push.js.map +1 -1
- package/dist/functions/files/commands/read.js +3 -2
- package/dist/functions/files/commands/read.js.map +1 -1
- package/dist/functions/files/commands/render.d.ts +29 -0
- package/dist/functions/files/commands/render.js +8 -4
- package/dist/functions/files/commands/render.js.map +1 -1
- package/dist/functions/files/commands/status.js +1 -0
- package/dist/functions/files/commands/status.js.map +1 -1
- package/dist/functions/files/commands/versions/copy.js +1 -1
- package/dist/functions/files/commands/versions/copy.js.map +1 -1
- package/dist/functions/files/commands/versions/delete.js +1 -1
- package/dist/functions/files/commands/versions/delete.js.map +1 -1
- package/dist/functions/files/commands/versions/list.js +4 -0
- package/dist/functions/files/commands/versions/list.js.map +1 -1
- package/dist/functions/files/commands/write.js +13 -3
- package/dist/functions/files/commands/write.js.map +1 -1
- package/dist/functions/files/files-pull.js +10 -7
- package/dist/functions/files/files-pull.js.map +1 -1
- package/dist/functions/files/files-push.js +11 -8
- package/dist/functions/files/files-push.js.map +1 -1
- package/dist/functions/files/helper/text-policy.d.ts +5 -0
- package/dist/functions/files/helper/text-policy.js +31 -0
- package/dist/functions/files/helper/text-policy.js.map +1 -0
- package/dist/functions/files/sync/large-upload.d.ts +20 -0
- package/dist/functions/files/sync/large-upload.js +140 -0
- package/dist/functions/files/sync/large-upload.js.map +1 -0
- package/dist/functions/files/sync/manifest.js +2 -1
- package/dist/functions/files/sync/manifest.js.map +1 -1
- package/dist/functions/files/sync/transfer.d.ts +5 -0
- package/dist/functions/files/sync/transfer.js +47 -10
- package/dist/functions/files/sync/transfer.js.map +1 -1
- package/dist/functions/files/test-helpers.d.ts +11 -0
- package/dist/functions/files/test-helpers.js +28 -0
- package/dist/functions/files/test-helpers.js.map +1 -1
- package/dist/functions/generate/files/generate-code.d.ts +1 -1
- package/dist/functions/generate/files/generate-files.d.ts +7 -1
- package/dist/functions/generate/files/generate-files.js +63 -15
- package/dist/functions/generate/files/generate-files.js.map +1 -1
- package/dist/functions/generate/files/workflow-presets.d.ts +6 -0
- package/dist/functions/generate/files/workflow-presets.js +158 -0
- package/dist/functions/generate/files/workflow-presets.js.map +1 -0
- package/dist/functions/generate/model-from-data/generate-model-from-data.js +11 -5
- package/dist/functions/generate/model-from-data/generate-model-from-data.js.map +1 -1
- package/dist/functions/generate/model-from-data/infer-key.js +1 -4
- package/dist/functions/generate/model-from-data/infer-key.js.map +1 -1
- package/dist/functions/generate/model-from-data/infer-to-model.js +6 -3
- package/dist/functions/generate/model-from-data/infer-to-model.js.map +1 -1
- package/dist/functions/generate/projects/generate-project.d.ts +5 -0
- package/dist/functions/generate/projects/generate-project.js +29 -8
- package/dist/functions/generate/projects/generate-project.js.map +1 -1
- package/dist/functions/helper/api-client.d.ts +3 -0
- package/dist/functions/helper/api-client.js +19 -17
- package/dist/functions/helper/api-client.js.map +1 -1
- package/dist/functions/helper/config.helper.d.ts +1 -0
- package/dist/functions/helper/config.helper.js.map +1 -1
- package/dist/functions/helper/credentials.helper.d.ts +21 -0
- package/dist/functions/helper/credentials.helper.js +39 -0
- package/dist/functions/helper/credentials.helper.js.map +1 -0
- package/dist/functions/helper/load-env.d.ts +1 -0
- package/dist/functions/helper/load-env.js +10 -0
- package/dist/functions/helper/load-env.js.map +1 -0
- package/dist/functions/helper/output.d.ts +1 -1
- package/dist/functions/helper/output.js +10 -12
- package/dist/functions/helper/output.js.map +1 -1
- package/dist/functions/helper/parse-fail.js +4 -1
- package/dist/functions/helper/parse-fail.js.map +1 -1
- package/dist/functions/schemas/command.js.map +1 -1
- package/dist/functions/schemas/examples/AppLoaderConfiguration.example.json +1 -3
- package/dist/functions/schemas/examples/AttributeQualityConfig.example.json +10 -0
- package/dist/functions/schemas/examples/DataMapperStepConfig.example.json +6 -1
- package/dist/functions/schemas/examples/ModelDefinition.example.json +29 -3
- package/dist/functions/schemas/examples/ScriptStepConfig.example.json +3 -1
- package/dist/functions/schemas/examples/TemplateV3.example.json +5 -1
- package/dist/functions/schemas/extract.js +1 -1
- package/dist/functions/schemas/extract.js.map +1 -1
- package/dist/functions/schemas/format.js +4 -4
- package/dist/functions/schemas/format.js.map +1 -1
- package/dist/functions/schemas/registry.d.ts +14 -0
- package/dist/functions/schemas/registry.js +122 -30
- package/dist/functions/schemas/registry.js.map +1 -1
- package/dist/functions/schemas/resolve.js +1 -2
- package/dist/functions/schemas/resolve.js.map +1 -1
- package/dist/functions/schemas/validate.d.ts +22 -0
- package/dist/functions/schemas/validate.js +67 -0
- package/dist/functions/schemas/validate.js.map +1 -0
- package/dist/functions/serve/commands/list.js +2 -1
- package/dist/functions/serve/commands/list.js.map +1 -1
- package/dist/functions/serve/commands/stop.js +10 -5
- package/dist/functions/serve/commands/stop.js.map +1 -1
- package/dist/functions/serve/dev-server/dev-server-access.guard.d.ts +11 -0
- package/dist/functions/serve/dev-server/dev-server-access.guard.js +41 -0
- package/dist/functions/serve/dev-server/dev-server-access.guard.js.map +1 -0
- package/dist/functions/serve/dev-server/dev-server.controller.d.ts +3 -0
- package/dist/functions/serve/dev-server/dev-server.controller.js +20 -0
- package/dist/functions/serve/dev-server/dev-server.controller.js.map +1 -1
- package/dist/functions/serve/dev-server/dev-server.module.d.ts +3 -0
- package/dist/functions/serve/dev-server/dev-server.module.js +34 -23
- package/dist/functions/serve/dev-server/dev-server.module.js.map +1 -1
- package/dist/functions/serve/dev-server/dev-server.options.d.ts +8 -0
- package/dist/functions/serve/dev-server/dev-server.options.js +5 -0
- package/dist/functions/serve/dev-server/dev-server.options.js.map +1 -0
- package/dist/functions/serve/dev-server/dev-server.service.d.ts +11 -3
- package/dist/functions/serve/dev-server/dev-server.service.js +72 -65
- package/dist/functions/serve/dev-server/dev-server.service.js.map +1 -1
- package/dist/functions/serve/dev-server/path-scope.d.ts +5 -0
- package/dist/functions/serve/dev-server/path-scope.js +88 -0
- package/dist/functions/serve/dev-server/path-scope.js.map +1 -0
- package/dist/functions/serve/dev-server/request-security.d.ts +34 -0
- package/dist/functions/serve/dev-server/request-security.js +145 -0
- package/dist/functions/serve/dev-server/request-security.js.map +1 -0
- package/dist/functions/serve/main.d.ts +13 -0
- package/dist/functions/serve/main.js +90 -17
- package/dist/functions/serve/main.js.map +1 -1
- package/dist/functions/serve/serve-self-register.js +2 -1
- package/dist/functions/serve/serve-self-register.js.map +1 -1
- package/dist/functions/version/command.d.ts +12 -1
- package/dist/functions/version/command.js +55 -7
- package/dist/functions/version/command.js.map +1 -1
- package/dist/functions/workflow/commands/deploy.d.ts +9 -1
- package/dist/functions/workflow/commands/deploy.js +39 -10
- package/dist/functions/workflow/commands/deploy.js.map +1 -1
- package/dist/functions/workflow/commands/get.js.map +1 -1
- package/dist/functions/workflow/commands/history.js.map +1 -1
- package/dist/functions/workflow/commands/run.d.ts +26 -0
- package/dist/functions/workflow/commands/run.js +101 -0
- package/dist/functions/workflow/commands/run.js.map +1 -0
- package/dist/functions/workflow/commands/runners-get.js.map +1 -1
- package/dist/functions/workflow/commands/runners.d.ts +2 -0
- package/dist/functions/workflow/commands/runners.js +10 -1
- package/dist/functions/workflow/commands/runners.js.map +1 -1
- package/dist/functions/workflow/commands/status.d.ts +1 -1
- package/dist/functions/workflow/commands/status.js +7 -1
- package/dist/functions/workflow/commands/status.js.map +1 -1
- package/dist/functions/workflow/commands/template.js.map +1 -1
- package/dist/functions/workflow/commands/test.d.ts +3 -0
- package/dist/functions/workflow/commands/test.js +22 -73
- package/dist/functions/workflow/commands/test.js.map +1 -1
- package/dist/functions/workflow/commands/trace.d.ts +4 -2
- package/dist/functions/workflow/commands/trace.js +22 -1
- package/dist/functions/workflow/commands/trace.js.map +1 -1
- package/dist/functions/workflow/commands/undeploy.js +3 -1
- package/dist/functions/workflow/commands/undeploy.js.map +1 -1
- package/dist/functions/workflow/commands/validate.d.ts +2 -0
- package/dist/functions/workflow/commands/validate.js +16 -2
- package/dist/functions/workflow/commands/validate.js.map +1 -1
- package/dist/functions/workflow/resolve-runner.d.ts +17 -0
- package/dist/functions/workflow/resolve-runner.js +41 -0
- package/dist/functions/workflow/resolve-runner.js.map +1 -0
- package/dist/functions/workflow/run-failure.d.ts +11 -0
- package/dist/functions/workflow/run-failure.js +74 -0
- package/dist/functions/workflow/run-failure.js.map +1 -0
- package/dist/functions/workflow/runner-health.d.ts +16 -0
- package/dist/functions/workflow/runner-health.js +36 -0
- package/dist/functions/workflow/runner-health.js.map +1 -0
- package/dist/functions/workflow/script-lint.d.ts +10 -0
- package/dist/functions/workflow/script-lint.js +513 -0
- package/dist/functions/workflow/script-lint.js.map +1 -0
- package/dist/functions/workflow/template-io.js +1 -1
- package/dist/functions/workflow/template-io.js.map +1 -1
- package/dist/functions/workflow/trace.js.map +1 -1
- package/dist/functions/workflow/types.d.ts +11 -2
- package/dist/functions/workflow/types.js +4 -0
- package/dist/functions/workflow/types.js.map +1 -1
- package/dist/functions/workflow/validate.js +4 -1
- package/dist/functions/workflow/validate.js.map +1 -1
- package/dist/functions/workflow/wait-for-swap.d.ts +24 -1
- package/dist/functions/workflow/wait-for-swap.js +58 -0
- package/dist/functions/workflow/wait-for-swap.js.map +1 -1
- package/dist/functions/workflow/workflow-api.js +3 -1
- package/dist/functions/workflow/workflow-api.js.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/files/common/.env.example +4 -0
- package/files/common/_gitignore +3 -1
- package/files/dev-server/index.html +2 -1
- package/package.json +45 -42
- package/dist/functions/serve/guards/apiKey.guard.d.ts +0 -4
- package/dist/functions/serve/guards/apiKey.guard.js +0 -23
- package/dist/functions/serve/guards/apiKey.guard.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/functions/version/command.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/functions/version/command.ts"],"names":[],"mappings":";;;AAoGA,sCAsBC;AAED,gDAaC;AAED,sCAWC;AAED,wCAUC;;AAlKD,+CAAyB;AACzB,mDAA6B;AAC7B,4DAA4B;AAI5B,MAAM,WAAW,GAAG,YAAY,CAAC;AAEjC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAGpB,QAAA,cAAc,GAAG,CAAC,aAAa,EAAE,eAAe,EAAE,wBAAwB,EAAE,eAAe,CAAU,CAAC;AAyCnH,SAAS,QAAQ;IACf,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,qBAAqB;IAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AACrF,CAAC;AAGD,SAAS,4BAA4B,CAAC,GAAW;IAC/C,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,cAAc,CAAC,CAAC;QAC/E,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IACnE,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../helper/output.js';
|
|
3
|
-
import type { DeployedWorkflow, TemplateV3, ValidationResult } from '../types.js';
|
|
3
|
+
import type { DeployedWorkflow, RunnerInfo, TemplateV3, ValidationResult } from '../types.js';
|
|
4
4
|
import { type SwapResult } from '../wait-for-swap.js';
|
|
5
|
+
import { type RunnerHealth } from '../runner-health.js';
|
|
6
|
+
export declare function checkRunnerReachable(client: ApiClient, runnerUid: string, deps: {
|
|
7
|
+
getRunner?: (client: ApiClient, uid: string) => Promise<RunnerInfo>;
|
|
8
|
+
probeHealth?: (url: string) => Promise<RunnerHealth>;
|
|
9
|
+
}): Promise<string | null>;
|
|
5
10
|
export interface DeployOptions {
|
|
6
11
|
file: string;
|
|
7
12
|
runner: string;
|
|
@@ -25,5 +30,8 @@ export interface DeployDeps {
|
|
|
25
30
|
waitForSwap?: (client: ApiClient, id: string, deployedV: string, deps?: object, opts?: {
|
|
26
31
|
timeoutMs?: number;
|
|
27
32
|
}) => Promise<SwapResult>;
|
|
33
|
+
getRunner?: (client: ApiClient, uid: string) => Promise<RunnerInfo>;
|
|
34
|
+
probeHealth?: (url: string) => Promise<RunnerHealth>;
|
|
35
|
+
listRunners?: (client: ApiClient) => Promise<RunnerInfo[]>;
|
|
28
36
|
}
|
|
29
37
|
export declare function deployCommand(output: Output, client: ApiClient, opts: DeployOptions, deps?: DeployDeps): Promise<void>;
|
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkRunnerReachable = checkRunnerReachable;
|
|
3
4
|
exports.deployCommand = deployCommand;
|
|
4
5
|
const template_io_js_1 = require("../template-io.js");
|
|
5
6
|
const workflow_api_js_1 = require("../workflow-api.js");
|
|
7
|
+
const resolve_runner_js_1 = require("../resolve-runner.js");
|
|
6
8
|
const confirm_js_1 = require("../../files/helper/confirm.js");
|
|
7
9
|
const wait_for_swap_js_1 = require("../wait-for-swap.js");
|
|
10
|
+
const runner_health_js_1 = require("../runner-health.js");
|
|
11
|
+
async function checkRunnerReachable(client, runnerUid, deps) {
|
|
12
|
+
const get = deps.getRunner ?? workflow_api_js_1.getRunner;
|
|
13
|
+
const probe = deps.probeHealth ?? runner_health_js_1.probeRunnerHealth;
|
|
14
|
+
try {
|
|
15
|
+
const runner = await get(client, runnerUid);
|
|
16
|
+
if (!runner?.url)
|
|
17
|
+
return null;
|
|
18
|
+
const health = await probe(runner.url);
|
|
19
|
+
if (health.status === 'unreachable') {
|
|
20
|
+
return (`Runner ${runnerUid} (${runner.runnerKey ?? runner.url}) is unreachable: ${health.reason}. ` +
|
|
21
|
+
`Check the runner or pick a healthy one via 'dcupl workflow runners list'.`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
8
28
|
async function deployCommand(output, client, opts, deps = {}) {
|
|
9
29
|
const load = deps.loadTemplate ?? template_io_js_1.loadTemplate;
|
|
10
30
|
const validate = deps.validateRemote ?? workflow_api_js_1.validateRemote;
|
|
@@ -12,18 +32,30 @@ async function deployCommand(output, client, opts, deps = {}) {
|
|
|
12
32
|
const confirm = deps.confirm ?? confirm_js_1.confirmDestructive;
|
|
13
33
|
const wait = deps.waitForSwap ?? wait_for_swap_js_1.waitForSwap;
|
|
14
34
|
const template = load(opts.file);
|
|
15
|
-
const
|
|
35
|
+
const resolved = await (0, resolve_runner_js_1.resolveRunnerRef)(() => (deps.listRunners ?? workflow_api_js_1.listRunners)(client), opts.runner);
|
|
36
|
+
if (!resolved.ok) {
|
|
37
|
+
output.error(resolved.message, resolved.code);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const runnerUid = resolved.uid;
|
|
41
|
+
const runnerLabel = resolved.runner ? `${resolved.runner.runnerKey} (${runnerUid})` : runnerUid;
|
|
42
|
+
const unreachable = await checkRunnerReachable(client, runnerUid, deps);
|
|
43
|
+
if (unreachable) {
|
|
44
|
+
output.error(unreachable, 'RUNNER_UNREACHABLE');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const result = await validate(client, { runnerUid, template });
|
|
16
48
|
if (!result.valid) {
|
|
17
49
|
const summary = (result.errors ?? []).map((e) => `✗ ${e.type}: ${e.message}`).join('\n');
|
|
18
50
|
output.error(summary, 'WORKFLOW_INVALID');
|
|
19
51
|
return;
|
|
20
52
|
}
|
|
21
|
-
const decision = await confirm(`Deploy workflow "${template.key}" to runner ${
|
|
53
|
+
const decision = await confirm(`Deploy workflow "${template.key}" to runner ${runnerLabel}? This goes live immediately.`, { yes: !!opts.yes });
|
|
22
54
|
if (decision !== 'execute') {
|
|
23
55
|
output.error('Deploy aborted (not confirmed).', 'WORKFLOW_DEPLOY_ABORTED');
|
|
24
56
|
return;
|
|
25
57
|
}
|
|
26
|
-
const deployed = await doDeploy(client, [{ runnerUid
|
|
58
|
+
const deployed = await doDeploy(client, [{ runnerUid, template }]);
|
|
27
59
|
const head = deployed[0];
|
|
28
60
|
if (!head) {
|
|
29
61
|
output.error('Deploy returned no workflow; check the runner uid.', 'DEPLOY_EMPTY_RESPONSE');
|
|
@@ -31,14 +63,11 @@ async function deployCommand(output, client, opts, deps = {}) {
|
|
|
31
63
|
}
|
|
32
64
|
let liveNote = '';
|
|
33
65
|
if (opts.wait !== false) {
|
|
66
|
+
const timeoutMs = opts.swapTimeout ?? wait_for_swap_js_1.DEFAULT_SWAP_TIMEOUT_MS;
|
|
34
67
|
const swap = await wait(client, head.uid, head.v, {}, { timeoutMs: opts.swapTimeout });
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
if (swap.outcome === 'timeout') {
|
|
40
|
-
const secs = (opts.swapTimeout ?? wait_for_swap_js_1.DEFAULT_SWAP_TIMEOUT_MS) / 1000;
|
|
41
|
-
output.error(`swap not confirmed after ${secs}s; deployed v=${swap.deployedV}, runner still serving v=${swap.liveV ?? 'unknown'}`, 'WORKFLOW_SWAP_TIMEOUT');
|
|
68
|
+
const failure = (0, wait_for_swap_js_1.describeSwapFailure)(swap, { workflowUid: head.uid, runnerLabel, timeoutMs });
|
|
69
|
+
if (failure) {
|
|
70
|
+
output.error(failure.message, failure.code, failure.extra);
|
|
42
71
|
return;
|
|
43
72
|
}
|
|
44
73
|
if (swap.outcome === 'skipped') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../../src/functions/workflow/commands/deploy.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../../src/functions/workflow/commands/deploy.ts"],"names":[],"mappings":";;AA2BA,oDAwBC;AA2BD,sCAyEC;AApJD,sDAAgE;AAChE,wDAK4B;AAC5B,4DAAwD;AACxD,8DAAmE;AACnE,0DAK6B;AAC7B,0DAAiG;AAS1F,KAAK,UAAU,oBAAoB,CACxC,MAAiB,EACjB,SAAiB,EACjB,IAGC;IAED,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,IAAI,2BAAgB,CAAC;IAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,IAAI,oCAAkB,CAAC;IACrD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,EAAE,GAAG;YAAE,OAAO,IAAI,CAAC;QAC9B,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,MAAM,CAAC,MAAM,KAAK,aAAa,EAAE,CAAC;YACpC,OAAO,CACL,UAAU,SAAS,KAAK,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,GAAG,qBAAqB,MAAM,CAAC,MAAM,IAAI;gBAC5F,2EAA2E,CAC5E,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;IAET,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AA2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AAC,CAAC,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QACvF,MAAM,OAAO,GAAG,IAAA,sCAAmB,EAAC,IAAI,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC;QAC7F,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;YAC3D,OAAO;QACT,CAAC;QACD,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAC/B,MAAM,CAAC,IAAI,CAAC,oEAAoE,CAAC,CAAC;YAClF,QAAQ,GAAG,WAAW,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,QAAQ,GAAG,WAAW,CAAC;QACzB,CAAC;IACH,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,EAAE,CAC5B,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAC1F,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../src/functions/workflow/commands/get.ts"],"names":[],"mappings":";;AAaA,
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../src/functions/workflow/commands/get.ts"],"names":[],"mappings":";;AAaA,gCASC;AAnBD,wDAAuE;AAUhE,KAAK,UAAU,UAAU,CAC9B,MAAc,EACd,MAAiB,EACjB,IAAgB,EAChB,OAAgB,EAAE;IAElB,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,IAAI,6BAAkB,CAAC;IACnD,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5C,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../../src/functions/workflow/commands/history.ts"],"names":[],"mappings":";;AAaA,
|
|
1
|
+
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../../src/functions/workflow/commands/history.ts"],"names":[],"mappings":";;AAaA,wCA0BC;AApCD,wDAAqE;AAU9D,KAAK,UAAU,cAAc,CAClC,MAAc,EACd,MAAiB,EACjB,IAAoB,EACpB,OAAoB,EAAE;IAEtB,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,IAAI,4BAAiB,CAAC;IACjD,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAG3C,IAAI,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;QACpB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACxB,OAAO;IACT,CAAC;IACD,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAClD,WAAW,EAAE,CAAC,CAAC,WAAW;QAC1B,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE;QACjE,UAAU,EAAE,CAAC,CAAC,QAAQ,IAAI,EAAE;QAC5B,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,IAAI,EAAE;KAC9B,CAAC,CAAC,CAAC;IACJ,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,CAAC;QACjD,OAAO;IACT,CAAC;IACD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ApiClient } from '../../helper/api-client.js';
|
|
2
|
+
import type { Output } from '../../helper/output.js';
|
|
3
|
+
import type { DeployedWorkflowV3, RunnerInfo } from '../types.js';
|
|
4
|
+
export interface RunOptions {
|
|
5
|
+
key: string;
|
|
6
|
+
runner: string;
|
|
7
|
+
body?: string;
|
|
8
|
+
input?: string;
|
|
9
|
+
node?: string;
|
|
10
|
+
triggerKey?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface RunDeps {
|
|
13
|
+
listRunners?: (client: ApiClient) => Promise<RunnerInfo[]>;
|
|
14
|
+
listWorkflows?: (client: ApiClient) => Promise<DeployedWorkflowV3[]>;
|
|
15
|
+
getWorkflow?: (client: ApiClient, id: string) => Promise<DeployedWorkflowV3>;
|
|
16
|
+
testNode?: (client: ApiClient, workflowId: string, nodeId: string, body: unknown) => Promise<unknown>;
|
|
17
|
+
triggerRun?: (args: {
|
|
18
|
+
runnerUrl: string;
|
|
19
|
+
key: string;
|
|
20
|
+
triggerPath: string;
|
|
21
|
+
method: string;
|
|
22
|
+
body?: unknown;
|
|
23
|
+
triggerKey?: string;
|
|
24
|
+
}) => Promise<unknown>;
|
|
25
|
+
}
|
|
26
|
+
export declare function runCommand(output: Output, client: ApiClient, opts: RunOptions, deps?: RunDeps): Promise<void>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runCommand = runCommand;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
6
|
+
const comment_json_1 = require("comment-json");
|
|
7
|
+
const workflow_api_js_1 = require("../workflow-api.js");
|
|
8
|
+
const trace_js_1 = require("../trace.js");
|
|
9
|
+
const run_failure_js_1 = require("../run-failure.js");
|
|
10
|
+
const resolve_runner_js_1 = require("../resolve-runner.js");
|
|
11
|
+
function findDeployed(workflows, key, runnerUid, projectId) {
|
|
12
|
+
const onRunner = workflows.filter((w) => w.runnerUid === runnerUid);
|
|
13
|
+
return onRunner.find((w) => w.key === key) ?? onRunner.find((w) => w.key === `${projectId}-${key}`);
|
|
14
|
+
}
|
|
15
|
+
async function runCommand(output, client, opts, deps = {}) {
|
|
16
|
+
const listRunners = deps.listRunners ?? workflow_api_js_1.listRunners;
|
|
17
|
+
const listWorkflows = deps.listWorkflows ?? workflow_api_js_1.listWorkflows;
|
|
18
|
+
const getWorkflow = deps.getWorkflow ?? workflow_api_js_1.getWorkflow;
|
|
19
|
+
const doTestNode = deps.testNode ?? workflow_api_js_1.testNode;
|
|
20
|
+
const doTrigger = deps.triggerRun ?? workflow_api_js_1.triggerRun;
|
|
21
|
+
if (opts.body !== undefined && opts.input !== undefined) {
|
|
22
|
+
output.error('--body and --input are mutually exclusive; pass the payload inline OR as a file.', 'WORKFLOW_RUN_INPUT_CONFLICT');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
let payload;
|
|
26
|
+
try {
|
|
27
|
+
payload =
|
|
28
|
+
opts.body !== undefined
|
|
29
|
+
? (0, comment_json_1.parse)(opts.body)
|
|
30
|
+
: opts.input
|
|
31
|
+
? (0, comment_json_1.parse)(fs.readFileSync(opts.input, 'utf-8'))
|
|
32
|
+
: undefined;
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
const source = opts.body !== undefined ? '--body is not valid JSON' : `--input could not be read as JSON (${opts.input})`;
|
|
36
|
+
output.error(`${source}: ${(0, run_failure_js_1.errorMessage)(err)}`, 'WORKFLOW_RUN_INVALID_INPUT');
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
let template;
|
|
40
|
+
let reachedRun = false;
|
|
41
|
+
try {
|
|
42
|
+
const workflows = await listWorkflows(client);
|
|
43
|
+
let runnerUid = opts.runner;
|
|
44
|
+
let runner;
|
|
45
|
+
let runnerLabel = opts.runner;
|
|
46
|
+
let deployed = findDeployed(workflows, opts.key, runnerUid, client.projectId);
|
|
47
|
+
if (!deployed || !opts.node) {
|
|
48
|
+
const resolved = await (0, resolve_runner_js_1.resolveRunnerRef)(() => listRunners(client), opts.runner);
|
|
49
|
+
if (!resolved.ok) {
|
|
50
|
+
output.error(resolved.message, resolved.code);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
runnerUid = resolved.uid;
|
|
54
|
+
runner = resolved.runner;
|
|
55
|
+
if (runner)
|
|
56
|
+
runnerLabel = `${runner.runnerKey} (${runnerUid})`;
|
|
57
|
+
deployed = findDeployed(workflows, opts.key, runnerUid, client.projectId);
|
|
58
|
+
}
|
|
59
|
+
if (!deployed) {
|
|
60
|
+
output.error(`Workflow "${opts.key}" is not deployed on runner ${runnerLabel}. \`dcupl workflow list\` shows what is deployed where.`, 'WORKFLOW_NOT_FOUND');
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
template = deployed.template ?? (await getWorkflow(client, deployed.uid)).template;
|
|
64
|
+
let raw;
|
|
65
|
+
if (opts.node) {
|
|
66
|
+
reachedRun = true;
|
|
67
|
+
raw = await doTestNode(client, deployed.uid, opts.node, { inputData: payload ?? { main: [] } });
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
if (!runner) {
|
|
71
|
+
output.error(`Runner ${opts.runner} not found for this project.`, 'RUNNER_NOT_FOUND');
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const trigger = (template?.config?.nodes ?? []).find((n) => n.type === 'trigger-request');
|
|
75
|
+
if (!trigger) {
|
|
76
|
+
output.error('The deployed workflow has no trigger-request node; cannot run it over HTTP.', 'NO_REQUEST_TRIGGER');
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const method = (trigger.config.methods?.[0] ?? 'POST');
|
|
80
|
+
reachedRun = true;
|
|
81
|
+
raw = await doTrigger({
|
|
82
|
+
runnerUrl: runner.url,
|
|
83
|
+
key: deployed.key,
|
|
84
|
+
triggerPath: trigger.config.path,
|
|
85
|
+
method,
|
|
86
|
+
body: payload,
|
|
87
|
+
triggerKey: opts.triggerKey,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
const trace = (0, trace_js_1.toTrace)(raw);
|
|
91
|
+
trace.workflowKey ??= deployed.key;
|
|
92
|
+
output.success(trace, () => (0, trace_js_1.renderTrace)(trace));
|
|
93
|
+
if ((0, trace_js_1.hasErrors)(trace)) {
|
|
94
|
+
output.error('Workflow run reported node errors (see trace above).', 'WORKFLOW_RUN_ERROR');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
(0, run_failure_js_1.reportRunFailure)(output, err, { template, reachedRun, failedCode: 'WORKFLOW_RUN_FAILED' });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../../src/functions/workflow/commands/run.ts"],"names":[],"mappings":";;AAkEA,gCAsHC;;AA7KD,+CAAyB;AACzB,+CAAqC;AAIrC,wDAM4B;AAC5B,0CAAkF;AAClF,sDAAmE;AACnE,4DAAwD;AA+BxD,SAAS,YAAY,CACnB,SAA+B,EAC/B,GAAW,EACX,SAAiB,EACjB,SAAiB;IAEjB,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;IACpE,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,QAAQ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AAM,CAAC,IAAI;gBAChC,MAAM;gBACN,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE,IAAI,CAAC,UAAU;aAC5B,CAAC,CAAC;QACL,CAAC;QAED,MAAM,KAAK,GAAkB,IAAA,kBAAO,EAAC,GAAG,CAAC,CAAC;QAG1C,KAAK,CAAC,WAAW,KAAK,QAAQ,CAAC,GAAG,CAAC;QAEnC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,IAAA,sBAAW,EAAC,KAAK,CAAC,CAAC,CAAC;QAChD,IAAI,IAAA,oBAAS,EAAC,KAAK,CAAC,EAAE,CAAC;YACrB,MAAM,CAAC,KAAK,CAAC,sDAAsD,EAAE,oBAAoB,CAAC,CAAC;QAC7F,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAA,iCAAgB,EAAC,MAAM,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,qBAAqB,EAAE,CAAC,CAAC;IAC7F,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runners-get.js","sourceRoot":"","sources":["../../../../src/functions/workflow/commands/runners-get.ts"],"names":[],"mappings":";;AAaA,
|
|
1
|
+
{"version":3,"file":"runners-get.js","sourceRoot":"","sources":["../../../../src/functions/workflow/commands/runners-get.ts"],"names":[],"mappings":";;AAaA,4CASC;AAnBD,wDAAmE;AAU5D,KAAK,UAAU,gBAAgB,CACpC,MAAc,EACd,MAAiB,EACjB,IAAsB,EACtB,OAAsB,EAAE;IAExB,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,IAAI,2BAAgB,CAAC;IAC/C,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1C,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ApiClient } from '../../helper/api-client.js';
|
|
2
2
|
import type { Output } from '../../helper/output.js';
|
|
3
3
|
import type { RunnerInfo } from '../types.js';
|
|
4
|
+
import { type RunnerHealth } from '../runner-health.js';
|
|
4
5
|
export interface RunnersDeps {
|
|
5
6
|
listRunners?: (client: ApiClient) => Promise<RunnerInfo[]>;
|
|
7
|
+
probeHealth?: (url: string) => Promise<RunnerHealth>;
|
|
6
8
|
}
|
|
7
9
|
export declare function runnersCommand(output: Output, client: ApiClient, deps?: RunnersDeps): Promise<void>;
|
|
@@ -2,10 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.runnersCommand = runnersCommand;
|
|
4
4
|
const workflow_api_js_1 = require("../workflow-api.js");
|
|
5
|
+
const runner_health_js_1 = require("../runner-health.js");
|
|
5
6
|
async function runnersCommand(output, client, deps = {}) {
|
|
6
7
|
const list = deps.listRunners ?? workflow_api_js_1.listRunners;
|
|
8
|
+
const probe = deps.probeHealth ?? runner_health_js_1.probeRunnerHealth;
|
|
7
9
|
const runners = await list(client);
|
|
8
|
-
const
|
|
10
|
+
const healths = await Promise.all(runners.map((r) => probe(r.url)));
|
|
11
|
+
const rows = runners.map((r, i) => ({
|
|
12
|
+
uid: r.uid,
|
|
13
|
+
runnerKey: r.runnerKey,
|
|
14
|
+
type: r.type,
|
|
15
|
+
url: r.url,
|
|
16
|
+
health: (0, runner_health_js_1.renderHealth)(healths[i]),
|
|
17
|
+
}));
|
|
9
18
|
output.success(rows);
|
|
10
19
|
}
|
|
11
20
|
//# sourceMappingURL=runners.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runners.js","sourceRoot":"","sources":["../../../../src/functions/workflow/commands/runners.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"runners.js","sourceRoot":"","sources":["../../../../src/functions/workflow/commands/runners.ts"],"names":[],"mappings":";;AAWA,wCAaC;AArBD,wDAAuE;AACvE,0DAA+G;AAOxG,KAAK,UAAU,cAAc,CAAC,MAAc,EAAE,MAAiB,EAAE,OAAoB,EAAE;IAC5F,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,IAAI,6BAAkB,CAAC;IACpD,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,IAAI,oCAAkB,CAAC;IACrD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACpE,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAClC,GAAG,EAAE,CAAC,CAAC,GAAG;QACV,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,GAAG,EAAE,CAAC,CAAC,GAAG;QACV,MAAM,EAAE,IAAA,+BAAY,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC;KACjC,CAAC,CAAC,CAAC;IACJ,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ApiClient } from '../../helper/api-client.js';
|
|
2
2
|
import type { Output } from '../../helper/output.js';
|
|
3
|
-
import type
|
|
3
|
+
import { type WorkflowStatusResponse } from '../types.js';
|
|
4
4
|
export interface StatusOptions {
|
|
5
5
|
id: string;
|
|
6
6
|
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.statusCommand = statusCommand;
|
|
4
|
+
const types_js_1 = require("../types.js");
|
|
4
5
|
const workflow_api_js_1 = require("../workflow-api.js");
|
|
5
6
|
async function statusCommand(output, client, opts, deps = {}) {
|
|
6
7
|
const get = deps.getStatus ?? workflow_api_js_1.getStatus;
|
|
7
8
|
const status = await get(client, opts.id);
|
|
8
|
-
output.success(status, (s) =>
|
|
9
|
+
output.success(status, (s) => {
|
|
10
|
+
if ((0, types_js_1.isFailedStatus)(s)) {
|
|
11
|
+
return `${s.key}: ${s.status} — ${s.reason}`;
|
|
12
|
+
}
|
|
13
|
+
return `${s.key}: ${s.status}${s.error ? ` — ${s.error}` : ''}`;
|
|
14
|
+
});
|
|
9
15
|
}
|
|
10
16
|
//# sourceMappingURL=status.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../src/functions/workflow/commands/status.ts"],"names":[],"mappings":";;AAaA,
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../src/functions/workflow/commands/status.ts"],"names":[],"mappings":";;AAaA,sCAeC;AA1BD,0CAA0E;AAC1E,wDAAmE;AAU5D,KAAK,UAAU,aAAa,CACjC,MAAc,EACd,MAAiB,EACjB,IAAmB,EACnB,OAAmB,EAAE;IAErB,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,IAAI,2BAAgB,CAAC;IAC/C,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1C,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE;QAE3B,IAAI,IAAA,yBAAc,EAAC,CAAC,CAAC,EAAE,CAAC;YACtB,OAAO,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;QAC/C,CAAC;QACD,OAAO,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/functions/workflow/commands/template.ts"],"names":[],"mappings":";;AAYA,
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/functions/workflow/commands/template.ts"],"names":[],"mappings":";;AAYA,0CASC;AAnBD,wDAAuF;AAUhF,KAAK,UAAU,eAAe,CACnC,MAAc,EACd,MAAiB,EACjB,IAAqB,EACrB,OAAqB,EAAE;IAEvB,MAAM,GAAG,GAAG,IAAI,CAAC,mBAAmB,IAAI,qCAA0B,CAAC;IACnE,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5C,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -2,6 +2,7 @@ import type { ApiClient } from '../../helper/api-client.js';
|
|
|
2
2
|
import type { Output } from '../../helper/output.js';
|
|
3
3
|
import type { DeployedWorkflow, RunnerInfo, TemplateV3, ValidationResult } from '../types.js';
|
|
4
4
|
import { type SwapResult } from '../wait-for-swap.js';
|
|
5
|
+
import type { RunnerHealth } from '../runner-health.js';
|
|
5
6
|
export interface TestOptions {
|
|
6
7
|
file: string;
|
|
7
8
|
runner: string;
|
|
@@ -32,5 +33,7 @@ export interface TestDeps {
|
|
|
32
33
|
waitForSwap?: (client: ApiClient, id: string, deployedV: string, deps?: object, opts?: {
|
|
33
34
|
timeoutMs?: number;
|
|
34
35
|
}) => Promise<SwapResult>;
|
|
36
|
+
getRunner?: (client: ApiClient, uid: string) => Promise<RunnerInfo>;
|
|
37
|
+
probeHealth?: (url: string) => Promise<RunnerHealth>;
|
|
35
38
|
}
|
|
36
39
|
export declare function testCommand(output: Output, client: ApiClient, opts: TestOptions, deps?: TestDeps): Promise<void>;
|
|
@@ -8,49 +8,15 @@ const template_io_js_1 = require("../template-io.js");
|
|
|
8
8
|
const validate_js_1 = require("../validate.js");
|
|
9
9
|
const workflow_api_js_1 = require("../workflow-api.js");
|
|
10
10
|
const trace_js_1 = require("../trace.js");
|
|
11
|
+
const run_failure_js_1 = require("../run-failure.js");
|
|
11
12
|
const wait_for_swap_js_1 = require("../wait-for-swap.js");
|
|
13
|
+
const deploy_js_1 = require("./deploy.js");
|
|
14
|
+
const resolve_runner_js_1 = require("../resolve-runner.js");
|
|
12
15
|
function readJson(file) {
|
|
13
16
|
if (!file)
|
|
14
17
|
return undefined;
|
|
15
18
|
return (0, comment_json_1.parse)(fs.readFileSync(file, 'utf-8'));
|
|
16
19
|
}
|
|
17
|
-
function errorBody(err) {
|
|
18
|
-
const e = err;
|
|
19
|
-
return e.response?.data ?? e.responseData;
|
|
20
|
-
}
|
|
21
|
-
function errorStatus(err) {
|
|
22
|
-
const e = err;
|
|
23
|
-
return e.response?.status ?? e.statusCode;
|
|
24
|
-
}
|
|
25
|
-
function errorMessage(err) {
|
|
26
|
-
return err.message ?? String(err);
|
|
27
|
-
}
|
|
28
|
-
function nodeTypeById(template, nodeId) {
|
|
29
|
-
if (!nodeId)
|
|
30
|
-
return undefined;
|
|
31
|
-
const nodes = (template.config?.nodes ?? []);
|
|
32
|
-
return nodes.find((n) => n.id === nodeId)?.type;
|
|
33
|
-
}
|
|
34
|
-
function hasFilesNode(template) {
|
|
35
|
-
const nodes = (template.config?.nodes ?? []);
|
|
36
|
-
return nodes.some((n) => n.type === 'dcupl-files');
|
|
37
|
-
}
|
|
38
|
-
function looks403(status, runError) {
|
|
39
|
-
if (status === 403)
|
|
40
|
-
return true;
|
|
41
|
-
const hay = `${runError?.message ?? ''} ${runError?.errorType ?? ''} ${runError?.detail ?? ''}`.toLowerCase();
|
|
42
|
-
return /\b403\b|forbidden|unauthor/.test(hay);
|
|
43
|
-
}
|
|
44
|
-
const FILES_AUTH_HINT = 'dcupl-files auth failed (403) — check auth.apiKey (the project workflow api-key UUID)';
|
|
45
|
-
function filesAuthHint(template, status, runError, reachedRun) {
|
|
46
|
-
if (!looks403(status, runError))
|
|
47
|
-
return undefined;
|
|
48
|
-
if (nodeTypeById(template, runError?.nodeId) === 'dcupl-files')
|
|
49
|
-
return FILES_AUTH_HINT;
|
|
50
|
-
if (reachedRun && !runError?.nodeId && hasFilesNode(template))
|
|
51
|
-
return FILES_AUTH_HINT;
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
20
|
async function testCommand(output, client, opts, deps = {}) {
|
|
55
21
|
const load = deps.loadTemplate ?? template_io_js_1.loadTemplate;
|
|
56
22
|
const validateLocal = deps.validateLocal ?? validate_js_1.validateLocal;
|
|
@@ -66,23 +32,32 @@ async function testCommand(output, client, opts, deps = {}) {
|
|
|
66
32
|
output.error(summary, 'WORKFLOW_INVALID');
|
|
67
33
|
return;
|
|
68
34
|
}
|
|
35
|
+
const resolved = await (0, resolve_runner_js_1.resolveRunnerRef)(() => listRunners(client), opts.runner);
|
|
36
|
+
if (!resolved.ok) {
|
|
37
|
+
output.error(resolved.message, resolved.code);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const runnerUid = resolved.uid;
|
|
41
|
+
const unreachable = await (0, deploy_js_1.checkRunnerReachable)(client, runnerUid, deps);
|
|
42
|
+
if (unreachable) {
|
|
43
|
+
output.error(unreachable, 'RUNNER_UNREACHABLE');
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
69
46
|
let reachedRun = false;
|
|
70
47
|
try {
|
|
71
|
-
const deployedList = await doDeploy(client, [{ runnerUid
|
|
48
|
+
const deployedList = await doDeploy(client, [{ runnerUid, template }]);
|
|
72
49
|
const deployed = deployedList[0];
|
|
73
50
|
if (!deployed) {
|
|
74
51
|
output.error('Deploy returned no workflow; check the runner uid.', 'DEPLOY_EMPTY_RESPONSE');
|
|
75
52
|
return;
|
|
76
53
|
}
|
|
77
54
|
if (opts.wait !== false) {
|
|
55
|
+
const timeoutMs = opts.swapTimeout ?? wait_for_swap_js_1.DEFAULT_SWAP_TIMEOUT_MS;
|
|
78
56
|
const swap = await wait(client, deployed.uid, deployed.v, {}, { timeoutMs: opts.swapTimeout });
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if (swap.outcome === 'timeout') {
|
|
84
|
-
const secs = (opts.swapTimeout ?? wait_for_swap_js_1.DEFAULT_SWAP_TIMEOUT_MS) / 1000;
|
|
85
|
-
output.error(`swap not confirmed after ${secs}s; deployed v=${swap.deployedV}, runner still serving v=${swap.liveV ?? 'unknown'}`, 'WORKFLOW_SWAP_TIMEOUT');
|
|
57
|
+
const runnerLabel = resolved.runner ? `${resolved.runner.runnerKey} (${runnerUid})` : runnerUid;
|
|
58
|
+
const failure = (0, wait_for_swap_js_1.describeSwapFailure)(swap, { workflowUid: deployed.uid, runnerLabel, timeoutMs });
|
|
59
|
+
if (failure) {
|
|
60
|
+
output.error(failure.message, failure.code, failure.extra);
|
|
86
61
|
return;
|
|
87
62
|
}
|
|
88
63
|
if (swap.outcome === 'skipped') {
|
|
@@ -99,7 +74,7 @@ async function testCommand(output, client, opts, deps = {}) {
|
|
|
99
74
|
}
|
|
100
75
|
else {
|
|
101
76
|
const runners = await listRunners(client);
|
|
102
|
-
const runner = runners.find((r) => r.uid ===
|
|
77
|
+
const runner = runners.find((r) => r.uid === runnerUid);
|
|
103
78
|
if (!runner) {
|
|
104
79
|
output.error(`Runner ${opts.runner} not found for this project.`, 'RUNNER_NOT_FOUND');
|
|
105
80
|
return;
|
|
@@ -126,33 +101,7 @@ async function testCommand(output, client, opts, deps = {}) {
|
|
|
126
101
|
}
|
|
127
102
|
}
|
|
128
103
|
catch (err) {
|
|
129
|
-
|
|
130
|
-
const status = errorStatus(err);
|
|
131
|
-
const trace = (0, trace_js_1.toTrace)(body);
|
|
132
|
-
if (Object.keys(trace.nodes ?? {}).length > 0 || trace.status === 'failed') {
|
|
133
|
-
output.success(trace, () => (0, trace_js_1.renderTrace)(trace));
|
|
134
|
-
output.error('Workflow run failed on the runner (see trace above).', 'WORKFLOW_RUN_ERROR');
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
const runError = (0, trace_js_1.toRunError)(body);
|
|
138
|
-
if (runError) {
|
|
139
|
-
output.success(runError, () => (0, trace_js_1.renderRunError)(runError));
|
|
140
|
-
const hint = filesAuthHint(template, status, runError, reachedRun);
|
|
141
|
-
if (hint) {
|
|
142
|
-
output.error(hint, 'WORKFLOW_FILES_AUTH');
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
const where = runError.nodeId ? ` @ nodeId: ${runError.nodeId}` : '';
|
|
146
|
-
output.error(`${runError.message}${where}`, 'WORKFLOW_RUN_ERROR');
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
const hint = filesAuthHint(template, status, undefined, reachedRun);
|
|
150
|
-
if (hint) {
|
|
151
|
-
output.error(hint, 'WORKFLOW_FILES_AUTH');
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
const suffix = status ? ` (HTTP ${status})` : '';
|
|
155
|
-
output.error(`${errorMessage(err)}${suffix}`, 'WORKFLOW_TEST_FAILED');
|
|
104
|
+
(0, run_failure_js_1.reportRunFailure)(output, err, { template, reachedRun, failedCode: 'WORKFLOW_TEST_FAILED' });
|
|
156
105
|
}
|
|
157
106
|
}
|
|
158
107
|
//# sourceMappingURL=test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../src/functions/workflow/commands/test.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../src/functions/workflow/commands/test.ts"],"names":[],"mappings":";;AAkEA,kCAwGC;;AA1KD,+CAAyB;AACzB,+CAAqC;AAIrC,sDAAgE;AAChE,gDAAuE;AACvE,wDAK4B;AAC5B,0CAAkF;AAClF,sDAAqD;AACrD,0DAK6B;AAC7B,2CAAmD;AACnD,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CAAC,CAAC;IAC9F,CAAC;AACH,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { ApiClient } from '../../helper/api-client.js';
|
|
2
2
|
import type { Output } from '../../helper/output.js';
|
|
3
|
-
import type { GraphStateResponse } from '../types.js';
|
|
3
|
+
import type { GraphStateResponse, WorkflowHistoryResponse } from '../types.js';
|
|
4
4
|
export interface TraceOptions {
|
|
5
5
|
id: string;
|
|
6
|
-
run
|
|
6
|
+
run?: string;
|
|
7
|
+
last?: boolean;
|
|
7
8
|
}
|
|
8
9
|
export interface TraceDeps {
|
|
9
10
|
getGraphState?: (client: ApiClient, id: string, runId: string) => Promise<GraphStateResponse>;
|
|
11
|
+
getHistory?: (client: ApiClient, id: string) => Promise<WorkflowHistoryResponse>;
|
|
10
12
|
}
|
|
11
13
|
export declare function traceCommand(output: Output, client: ApiClient, opts: TraceOptions, deps?: TraceDeps): Promise<void>;
|
|
@@ -4,7 +4,28 @@ exports.traceCommand = traceCommand;
|
|
|
4
4
|
const workflow_api_js_1 = require("../workflow-api.js");
|
|
5
5
|
async function traceCommand(output, client, opts, deps = {}) {
|
|
6
6
|
const get = deps.getGraphState ?? workflow_api_js_1.getGraphState;
|
|
7
|
-
|
|
7
|
+
if (opts.run && opts.last) {
|
|
8
|
+
output.error('--run and --last are mutually exclusive — pass one or the other.', 'TRACE_RUN_REQUIRED');
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (!opts.run && !opts.last) {
|
|
12
|
+
output.error('Name the run to trace: --run <id> (from `workflow history`) or --last for the most recent one.', 'TRACE_RUN_REQUIRED');
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
let runId = opts.run ?? '';
|
|
16
|
+
if (opts.last) {
|
|
17
|
+
const getHist = deps.getHistory ?? workflow_api_js_1.getHistory;
|
|
18
|
+
const history = await getHist(client, opts.id);
|
|
19
|
+
const executions = history.executions ?? [];
|
|
20
|
+
if (executions.length === 0) {
|
|
21
|
+
output.error('No runs found for this workflow — nothing to trace yet.', 'TRACE_NO_RUNS');
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const latest = executions.reduce((a, b) => (b.startedAt > a.startedAt ? b : a));
|
|
25
|
+
runId = latest.executionId;
|
|
26
|
+
output.warn(`--last resolved to run ${runId} (${latest.status}, started ${new Date(latest.startedAt).toISOString()})`);
|
|
27
|
+
}
|
|
28
|
+
const state = await get(client, opts.id, runId);
|
|
8
29
|
if (output.isJson()) {
|
|
9
30
|
output.success(state);
|
|
10
31
|
return;
|