@aifabrix/builder 2.43.0 → 2.44.1
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/.cursor/rules/anchor-docs.mdc +15 -0
- package/.cursor/rules/cli-layout.mdc +75 -0
- package/.cursor/rules/project-rules.mdc +8 -0
- package/.npmrc.token +1 -0
- package/.nyc_output/55e9d034-ddab-4579-a706-e02a91d75c91.json +1 -0
- package/.nyc_output/processinfo/55e9d034-ddab-4579-a706-e02a91d75c91.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/README.md +1 -1
- package/anchor-docs/README.md +10 -0
- package/anchor-docs/_TEMPLATE +24 -0
- package/bin/aifabrix.js +13 -4
- package/integration/hubspot-test/README.md +31 -0
- package/integration/hubspot-test/create-hubspot.js +5 -5
- package/integration/hubspot-test/hubspot-test-datasource-company.json +58 -462
- package/integration/hubspot-test/hubspot-test-datasource-contact.json +61 -555
- package/integration/hubspot-test/hubspot-test-datasource-deal.json +63 -506
- package/integration/hubspot-test/hubspot-test-datasource-users.json +42 -83
- package/integration/hubspot-test/hubspot-test-deploy.json +3 -3
- package/integration/hubspot-test/test-dataplane-down-tests.js +1 -7
- package/integration/hubspot-test/test-dataplane-down.js +3 -3
- package/integration/hubspot-test/test.js +35 -43
- package/integration/hubspot-test/wizard-hubspot-test-headless.yaml +23 -0
- package/integration/roundtrip-test-local/README.md +144 -0
- package/integration/roundtrip-test-local/application.yaml +13 -0
- package/integration/roundtrip-test-local/env.template +15 -0
- package/integration/roundtrip-test-local/roundtrip-test-local-datasource-roundtrip-test-company.yaml +14 -0
- package/integration/roundtrip-test-local/roundtrip-test-local-deploy.json +61 -0
- package/integration/roundtrip-test-local/roundtrip-test-local-system.yaml +25 -0
- package/integration/roundtrip-test-local2/README.md +144 -0
- package/integration/roundtrip-test-local2/application.yaml +13 -0
- package/integration/roundtrip-test-local2/env.template +15 -0
- package/integration/roundtrip-test-local2/roundtrip-test-local2-datasource-company.yaml +31 -0
- package/integration/roundtrip-test-local2/roundtrip-test-local2-deploy.json +86 -0
- package/integration/roundtrip-test-local2/roundtrip-test-local2-system.yaml +25 -0
- package/integration/test/wizard.yaml +8 -0
- package/jest.config.default.js +10 -0
- package/jest.config.integration.fixtures.js +22 -0
- package/jest.config.integration.js +21 -18
- package/jest.config.isolated.js +10 -0
- package/jest.projects.js +301 -0
- package/lib/api/certificates.api.js +62 -0
- package/lib/api/datasources-core.api.js +3 -3
- package/lib/api/dev-mtls-request.js +110 -0
- package/lib/api/dev-server-https.js +145 -0
- package/lib/api/dev.api.js +133 -144
- package/lib/api/index.js +11 -3
- package/lib/api/pipeline.api.js +67 -20
- package/lib/api/types/certificates.types.js +48 -0
- package/lib/api/types/dev.types.js +4 -3
- package/lib/api/types/pipeline.types.js +8 -5
- package/lib/api/types/validation-run.types.js +56 -0
- package/lib/api/validation-run.api.js +111 -0
- package/lib/api/validation-runner.js +109 -0
- package/lib/app/certification-show-enrich.js +129 -0
- package/lib/app/certification-verify-rows.js +60 -0
- package/lib/app/config.js +1 -1
- package/lib/app/deploy-status-display.js +2 -2
- package/lib/app/deploy.js +7 -6
- package/lib/app/display.js +2 -1
- package/lib/app/dockerfile.js +3 -2
- package/lib/app/down.js +2 -1
- package/lib/app/helpers.js +6 -5
- package/lib/app/index.js +27 -8
- package/lib/app/list.js +7 -6
- package/lib/app/push.js +4 -3
- package/lib/app/register.js +16 -7
- package/lib/app/rotate-secret.js +14 -13
- package/lib/app/run-container-start.js +184 -0
- package/lib/app/run-docker-fallback.js +108 -0
- package/lib/app/run-env-compose.js +30 -42
- package/lib/app/run-helpers.js +49 -126
- package/lib/app/run-infra-requirements.js +30 -0
- package/lib/app/run-resolve-image.js +21 -0
- package/lib/app/run.js +74 -21
- package/lib/app/show-display.js +44 -1
- package/lib/app/show.js +93 -9
- package/lib/build/index.js +13 -10
- package/lib/certification/cli-cert-sync-skip.js +21 -0
- package/lib/certification/merge-certification-from-artifact.js +185 -0
- package/lib/certification/post-unified-cert-sync.js +33 -0
- package/lib/certification/sync-after-external-command.js +52 -0
- package/lib/certification/sync-system-certification.js +197 -0
- package/lib/cli/index.js +2 -0
- package/lib/cli/setup-app.help.js +67 -0
- package/lib/cli/setup-app.js +61 -121
- package/lib/cli/setup-app.test-commands.js +195 -0
- package/lib/cli/setup-auth.js +19 -5
- package/lib/cli/setup-credential-deployment.js +22 -8
- package/lib/cli/setup-dev-path-commands.js +124 -0
- package/lib/cli/setup-dev.js +170 -113
- package/lib/cli/setup-environment.js +7 -1
- package/lib/cli/setup-external-system.js +84 -23
- package/lib/cli/setup-infra.js +126 -47
- package/lib/cli/setup-parameters.js +32 -0
- package/lib/cli/setup-secrets.js +137 -18
- package/lib/cli/setup-service-user.js +1 -1
- package/lib/cli/setup-utility.js +54 -22
- package/lib/commands/app-down.js +5 -7
- package/lib/commands/app-install.js +14 -7
- package/lib/commands/app-logs.js +13 -10
- package/lib/commands/app-shell.js +4 -1
- package/lib/commands/app-test.js +25 -19
- package/lib/commands/app.js +32 -11
- package/lib/commands/auth-config.js +6 -6
- package/lib/commands/auth-status.js +4 -3
- package/lib/commands/credential-env.js +4 -3
- package/lib/commands/credential-list.js +5 -4
- package/lib/commands/credential-push.js +4 -3
- package/lib/commands/datasource-unified-test-cli.js +428 -0
- package/lib/commands/datasource-unified-test-cli.options.js +191 -0
- package/lib/commands/datasource-unified-test-e2e-cli-helpers.js +106 -0
- package/lib/commands/datasource-validation-cli.js +143 -0
- package/lib/commands/datasource.js +125 -95
- package/lib/commands/deployment-list.js +6 -5
- package/lib/commands/dev-cli-handlers.js +122 -18
- package/lib/commands/dev-down.js +4 -3
- package/lib/commands/dev-init.js +231 -116
- package/lib/commands/dev-show-display.js +473 -0
- package/lib/commands/login-credentials.js +3 -2
- package/lib/commands/login-device.js +4 -3
- package/lib/commands/login.js +5 -4
- package/lib/commands/logout.js +8 -7
- package/lib/commands/parameters-validate.js +54 -0
- package/lib/commands/repair-datasource.js +314 -68
- package/lib/commands/repair-env-template.js +2 -2
- package/lib/commands/repair.js +21 -3
- package/lib/commands/secrets-list.js +23 -12
- package/lib/commands/secrets-remove-all.js +220 -0
- package/lib/commands/secrets-remove.js +21 -12
- package/lib/commands/secrets-set.js +21 -12
- package/lib/commands/secrets-validate.js +4 -4
- package/lib/commands/secure.js +10 -9
- package/lib/commands/service-user.js +26 -25
- package/lib/commands/test-e2e-external.js +27 -1
- package/lib/commands/up-common.js +3 -2
- package/lib/commands/up-dataplane.js +29 -16
- package/lib/commands/up-miso.js +19 -29
- package/lib/commands/upload.js +149 -39
- package/lib/commands/wizard-core-helpers.js +1 -1
- package/lib/commands/wizard-dataplane.js +4 -3
- package/lib/commands/wizard-helpers.js +3 -3
- package/lib/commands/wizard.js +2 -2
- package/lib/core/admin-secrets.js +14 -5
- package/lib/core/audit-logger.js +12 -4
- package/lib/core/config-attach-extensions.js +46 -0
- package/lib/core/config-runtime-paths.js +29 -0
- package/lib/core/config.js +55 -56
- package/lib/core/diff.js +3 -2
- package/lib/core/ensure-encryption-key.js +1 -1
- package/lib/core/secrets-ensure-infra.js +77 -0
- package/lib/core/secrets-ensure.js +120 -64
- package/lib/core/secrets-env-write.js +35 -7
- package/lib/core/secrets-infra-placeholder-sync.js +61 -0
- package/lib/core/secrets.js +200 -37
- package/lib/core/templates-env.js +4 -3
- package/lib/datasource/abac-validator.js +1 -10
- package/lib/datasource/deploy.js +75 -53
- package/lib/datasource/field-reference-validator.js +9 -6
- package/lib/datasource/integration-context.js +63 -0
- package/lib/datasource/list.js +8 -7
- package/lib/datasource/log-viewer.js +189 -67
- package/lib/datasource/resolve-app.js +4 -4
- package/lib/datasource/test-e2e.js +113 -146
- package/lib/datasource/test-integration.js +114 -122
- package/lib/datasource/unified-validation-run-body.js +68 -0
- package/lib/datasource/unified-validation-run-post.js +23 -0
- package/lib/datasource/unified-validation-run-resolve.js +43 -0
- package/lib/datasource/unified-validation-run.js +93 -0
- package/lib/datasource/validate.js +157 -13
- package/lib/deployment/deployer.js +4 -3
- package/lib/deployment/environment.js +7 -6
- package/lib/deployment/push.js +17 -8
- package/lib/external-system/delete.js +4 -3
- package/lib/external-system/deploy.js +166 -53
- package/lib/external-system/download-helpers.js +1 -1
- package/lib/external-system/download.js +7 -6
- package/lib/external-system/generator.js +92 -6
- package/lib/external-system/integration-test-dispatch.js +26 -0
- package/lib/external-system/test-execution.js +5 -1
- package/lib/external-system/test-helpers.js +0 -4
- package/lib/external-system/test-system-level-helpers.js +110 -0
- package/lib/external-system/test-system-level.js +83 -44
- package/lib/external-system/test.js +59 -8
- package/lib/generator/builders.js +23 -11
- package/lib/generator/deploy-manifest-azure-kv.js +81 -0
- package/lib/generator/external.js +16 -4
- package/lib/generator/helpers.js +58 -3
- package/lib/generator/index.js +4 -0
- package/lib/generator/split-readme.js +12 -7
- package/lib/generator/split-variables.js +2 -1
- package/lib/generator/split.js +1 -1
- package/lib/generator/wizard-readme.js +3 -3
- package/lib/generator/wizard.js +8 -8
- package/lib/infrastructure/compose.js +70 -7
- package/lib/infrastructure/helpers-docker-check.js +67 -0
- package/lib/infrastructure/helpers.js +203 -42
- package/lib/infrastructure/index.js +31 -18
- package/lib/infrastructure/services.js +21 -67
- package/lib/internal/fs-real-sync.js +104 -0
- package/lib/internal/node-fs.js +98 -0
- package/lib/parameters/database-secret-values.js +173 -0
- package/lib/parameters/infra-kv-discovery.js +121 -0
- package/lib/parameters/infra-parameter-catalog.js +458 -0
- package/lib/parameters/infra-parameter-validate.js +64 -0
- package/lib/schema/application-schema.json +37 -17
- package/lib/schema/datasource-test-run.schema.json +493 -0
- package/lib/schema/deployment-rules.yaml +102 -63
- package/lib/schema/external-datasource.schema.json +1200 -442
- package/lib/schema/external-system.schema.json +203 -5
- package/lib/schema/flag-map-validation-run.json +31 -0
- package/lib/schema/infra-parameter.schema.json +106 -0
- package/lib/schema/infra.parameter.yaml +421 -0
- package/lib/schema/type/credential-auth-templates.json +40 -0
- package/lib/schema/type/document-storage.json +226 -0
- package/lib/schema/type/message-service.json +123 -0
- package/lib/schema/type/vector-store.json +88 -0
- package/lib/utils/aifabrix-runtime-config-dir.js +132 -0
- package/lib/utils/api-error-handler.js +2 -2
- package/lib/utils/api.js +77 -17
- package/lib/utils/app-register-api.js +3 -2
- package/lib/utils/app-register-auth.js +1 -1
- package/lib/utils/app-register-config.js +4 -4
- package/lib/utils/app-register-display.js +3 -2
- package/lib/utils/app-register-validator.js +3 -2
- package/lib/utils/app-run-containers.js +26 -22
- package/lib/utils/app-scoped-config.js +31 -0
- package/lib/utils/app-service-env-from-builder.js +164 -0
- package/lib/utils/build-copy.js +1 -1
- package/lib/utils/build-helpers.js +20 -20
- package/lib/utils/build-resolve-image.js +165 -0
- package/lib/utils/cli-layout-chalk.js +8 -0
- package/lib/utils/cli-test-layout-chalk.js +267 -0
- package/lib/utils/cli-utils.js +88 -11
- package/lib/utils/compose-db-passwords.js +138 -0
- package/lib/utils/compose-generate-docker-compose.js +216 -0
- package/lib/utils/compose-generator.js +197 -291
- package/lib/utils/compose-miso-env.js +18 -0
- package/lib/utils/compose-traefik-ingress-base.js +158 -0
- package/lib/utils/config-paths.js +166 -7
- package/lib/utils/config-scoped-resources-preference.js +41 -0
- package/lib/utils/configuration-env-resolver.js +11 -8
- package/lib/utils/controller-deployment-outcome.js +68 -0
- package/lib/utils/credential-display.js +2 -2
- package/lib/utils/credential-secrets-env.js +5 -5
- package/lib/utils/dataplane-pipeline-warning.js +4 -3
- package/lib/utils/datasource-test-run-capability-scope.js +43 -0
- package/lib/utils/datasource-test-run-certificate-tty.js +82 -0
- package/lib/utils/datasource-test-run-debug-display.js +137 -0
- package/lib/utils/datasource-test-run-debug-slice.js +93 -0
- package/lib/utils/datasource-test-run-display.js +459 -0
- package/lib/utils/datasource-test-run-exit.js +83 -0
- package/lib/utils/datasource-test-run-legacy-adapter.js +93 -0
- package/lib/utils/datasource-test-run-report-version.js +51 -0
- package/lib/utils/datasource-test-run-schema-sync.js +59 -0
- package/lib/utils/datasource-test-run-tty-log.js +81 -0
- package/lib/utils/datasource-validation-watch.js +266 -0
- package/lib/utils/declarative-url-ports.js +47 -0
- package/lib/utils/derive-env-key-from-client-id.js +41 -0
- package/lib/utils/dev-ca-install.js +185 -23
- package/lib/utils/dev-cert-helper.js +266 -17
- package/lib/utils/dev-hosts-helper.js +307 -0
- package/lib/utils/dev-init-cert-hints.js +37 -0
- package/lib/utils/dev-init-health-messages.js +52 -0
- package/lib/utils/dev-init-resolve.js +86 -0
- package/lib/utils/dev-init-ssh-merge.js +65 -0
- package/lib/utils/dev-ssh-config-helper.js +196 -0
- package/lib/utils/dev-user-groups.js +93 -0
- package/lib/utils/docker-build.js +42 -17
- package/lib/utils/docker-exec.js +28 -0
- package/lib/utils/docker-manifest-public-port.js +116 -0
- package/lib/utils/docker-not-running-hint.js +52 -0
- package/lib/utils/docker.js +98 -11
- package/lib/utils/ensure-dev-certs-for-remote-docker.js +192 -0
- package/lib/utils/env-config-loader.js +10 -91
- package/lib/utils/env-copy.js +19 -10
- package/lib/utils/env-map.js +35 -8
- package/lib/utils/env-template.js +2 -2
- package/lib/utils/environment-scoped-resources.js +144 -0
- package/lib/utils/error-formatter.js +92 -13
- package/lib/utils/error-formatters/http-status-errors.js +6 -5
- package/lib/utils/error-formatters/network-errors.js +2 -1
- package/lib/utils/error-formatters/permission-errors.js +2 -1
- package/lib/utils/error-formatters/validation-errors.js +2 -1
- package/lib/utils/external-readme.js +8 -1
- package/lib/utils/external-system-display.js +242 -136
- package/lib/utils/external-system-local-test-tty.js +389 -0
- package/lib/utils/external-system-readiness-core.js +377 -0
- package/lib/utils/external-system-readiness-deploy-display.js +270 -0
- package/lib/utils/external-system-readiness-display-internals.js +150 -0
- package/lib/utils/external-system-readiness-display.js +186 -0
- package/lib/utils/external-system-system-test-tty-overview.js +120 -0
- package/lib/utils/external-system-system-test-tty.js +417 -0
- package/lib/utils/external-system-test-helpers.js +24 -6
- package/lib/utils/external-system-validators.js +30 -12
- package/lib/utils/health-check-url.js +119 -0
- package/lib/utils/health-check.js +59 -25
- package/lib/utils/help-builder.js +11 -8
- package/lib/utils/image-version.js +4 -8
- package/lib/utils/infra-containers.js +4 -7
- package/lib/utils/infra-env-defaults.js +162 -0
- package/lib/utils/infra-status-display.js +167 -0
- package/lib/utils/infra-status.js +16 -8
- package/lib/utils/local-secrets.js +3 -4
- package/lib/utils/paths.js +148 -47
- package/lib/utils/port-resolver.js +10 -23
- package/lib/utils/redis-env-scope.js +62 -0
- package/lib/utils/register-aifabrix-shell-env.js +204 -0
- package/lib/utils/remote-builder-validation.js +99 -0
- package/lib/utils/remote-dev-auth.js +117 -21
- package/lib/utils/remote-docker-env.js +67 -15
- package/lib/utils/remote-secrets-loader.js +13 -4
- package/lib/utils/resolve-docker-image-ref.js +124 -0
- package/lib/utils/schema-loader.js +22 -9
- package/lib/utils/secrets-bash-kv.js +25 -0
- package/lib/utils/secrets-generator.js +169 -49
- package/lib/utils/secrets-helpers.js +70 -59
- package/lib/utils/secrets-kv-scope.js +60 -0
- package/lib/utils/secrets-utils.js +32 -38
- package/lib/utils/secrets-validation.js +3 -1
- package/lib/utils/secrets-yaml-preserve.js +109 -0
- package/lib/utils/ssh-key-helper.js +4 -2
- package/lib/utils/template-helpers.js +2 -2
- package/lib/utils/test-log-writer.js +3 -3
- package/lib/utils/token-manager.js +1 -2
- package/lib/utils/url-declarative-public-base.js +188 -0
- package/lib/utils/url-declarative-resolve-build.js +493 -0
- package/lib/utils/url-declarative-resolve-load-doc.js +51 -0
- package/lib/utils/url-declarative-resolve.js +220 -0
- package/lib/utils/url-declarative-token-parse.js +74 -0
- package/lib/utils/url-declarative-url-flags.js +50 -0
- package/lib/utils/url-declarative-vdir-inactive-env.js +99 -0
- package/lib/utils/url-public-path-prefix.js +34 -0
- package/lib/utils/urls-local-registry.js +220 -0
- package/lib/utils/validation-report-tty-kit.js +77 -0
- package/lib/utils/validation-run-poll.js +112 -0
- package/lib/utils/validation-run-post-retry.js +85 -0
- package/lib/utils/validation-run-request.js +116 -0
- package/lib/utils/variable-transformer.js +21 -4
- package/lib/utils/yaml-preserve.js +33 -14
- package/lib/validation/datasource-warnings.js +56 -0
- package/lib/validation/env-template-auth.js +1 -1
- package/lib/validation/external-manifest-validator.js +27 -7
- package/lib/validation/validate-display.js +37 -31
- package/lib/validation/validate-external-cert-sync.js +23 -0
- package/lib/validation/validate.js +8 -14
- package/lib/validation/validator-unresolved-placeholders.js +98 -0
- package/lib/validation/validator.js +22 -65
- package/lib/validation/wizard-config-validator.js +2 -1
- package/package.json +9 -4
- package/scripts/check-datasource-test-run-schema-sync.js +34 -0
- package/scripts/diagnose-cli.js +150 -0
- package/scripts/install-local.js +307 -55
- package/scripts/pnpm-global-remove.js +48 -0
- package/templates/README.md +15 -2
- package/templates/applications/dataplane/application.yaml +52 -2
- package/templates/applications/dataplane/env.template +79 -17
- package/templates/applications/dataplane/rbac.yaml +8 -0
- package/templates/applications/keycloak/application.yaml +9 -1
- package/templates/applications/keycloak/env.template +15 -6
- package/templates/applications/miso-controller/application.yaml +10 -2
- package/templates/applications/miso-controller/env.template +42 -12
- package/templates/applications/miso-controller/rbac.yaml +5 -0
- package/templates/external-system/README.md.hbs +20 -7
- package/templates/external-system/deploy.js.hbs +5 -5
- package/templates/external-system/external-datasource.yaml.hbs +197 -118
- package/templates/infra/compose.yaml.hbs +33 -16
- package/templates/infra/servers.json.hbs +3 -1
- package/templates/python/docker-compose.hbs +16 -0
- package/templates/typescript/docker-compose.hbs +16 -0
- package/lib/api/external-test.api.js +0 -111
- package/lib/schema/env-config.yaml +0 -60
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview JSDoc typedefs for dataplane Trust / integration certificate APIs (camelCase).
|
|
3
|
+
* @author AI Fabrix Team
|
|
4
|
+
* @version 2.0.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Integration certificate artifact (dataplane OpenAPI **CertificateArtifactResponse**).
|
|
9
|
+
*
|
|
10
|
+
* @typedef {Object} CertificateArtifactResponse
|
|
11
|
+
* @property {string|{id?: string}} [certificateId]
|
|
12
|
+
* @property {string} [systemKey]
|
|
13
|
+
* @property {string} [datasourceKey]
|
|
14
|
+
* @property {string} [version]
|
|
15
|
+
* @property {string|null} [certificateVersion]
|
|
16
|
+
* @property {string|null} [systemVersion]
|
|
17
|
+
* @property {string} [certificationLevel]
|
|
18
|
+
* @property {Object} [metrics]
|
|
19
|
+
* @property {string|null} [contractHash]
|
|
20
|
+
* @property {string|null} [integrationHash]
|
|
21
|
+
* @property {string} [issuedAt]
|
|
22
|
+
* @property {string} [issuedBy]
|
|
23
|
+
* @property {string} [licenseLevelIssuer]
|
|
24
|
+
* @property {string} [dataplaneVersion]
|
|
25
|
+
* @property {('RS256'|'HS256')} [algorithm] RS256 production; HS256 local dev HMAC signer only
|
|
26
|
+
* @property {string|null} [publicKey]
|
|
27
|
+
* @property {string|null} [publicKeyFingerprint]
|
|
28
|
+
* @property {Object} [metadata]
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @typedef {Object} CertificateVerificationResponse
|
|
33
|
+
* @property {boolean} validSignature
|
|
34
|
+
* @property {boolean} validHash
|
|
35
|
+
* @property {boolean} overallValid
|
|
36
|
+
* @property {string[]} [reasons]
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @typedef {Object} CertificateVerifyRequest
|
|
41
|
+
* @property {string|null} [certificateId]
|
|
42
|
+
* @property {Object|null} [certificate]
|
|
43
|
+
* @property {boolean} [verifyHash]
|
|
44
|
+
* @property {string|null} [systemIdOrKey]
|
|
45
|
+
* @property {string|null} [datasourceKey]
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
module.exports = {};
|
|
@@ -27,10 +27,11 @@
|
|
|
27
27
|
* @typedef {Object} SettingsResponseDto
|
|
28
28
|
* @property {string} user-mutagen-folder - Server path to workspace root (no app segment)
|
|
29
29
|
* @property {string} secrets-encryption - Encryption key (hex)
|
|
30
|
-
* @property {string} aifabrix-secrets -
|
|
30
|
+
* @property {string} aifabrix-secrets - Local filesystem path or https URL for shared secrets (file vs remote API)
|
|
31
31
|
* @property {string} aifabrix-env-config - Env config path
|
|
32
32
|
* @property {string} remote-server - Builder-server base URL
|
|
33
33
|
* @property {string} docker-endpoint - Docker API endpoint
|
|
34
|
+
* @property {boolean} [docker-tls-skip-verify] - When true and ca.pem is absent, Docker uses DOCKER_TLS_VERIFY=0; if ca.pem exists, daemon is always verified
|
|
34
35
|
* @property {string} sync-ssh-user - SSH user for Mutagen
|
|
35
36
|
* @property {string} sync-ssh-host - SSH host for Mutagen
|
|
36
37
|
*/
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
* @property {string} createdAt - ISO 8601
|
|
45
46
|
* @property {boolean} certificateIssued - Whether cert was issued
|
|
46
47
|
* @property {string} [certificateValidNotAfter] - Cert validity end (optional)
|
|
47
|
-
* @property {string[]} groups - Access groups (admin, secret-manager, developer)
|
|
48
|
+
* @property {string[]} groups - Access groups (admin, secret-manager, developer, docker)
|
|
48
49
|
*/
|
|
49
50
|
|
|
50
51
|
/**
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
* @property {string} developerId - Unique developer ID (numeric string)
|
|
54
55
|
* @property {string} name - Display name
|
|
55
56
|
* @property {string} email - Email
|
|
56
|
-
* @property {string[]} [groups] - Default [developer]
|
|
57
|
+
* @property {string[]} [groups] - Default [developer]; tokens: admin, secret-manager, developer, docker
|
|
57
58
|
*/
|
|
58
59
|
|
|
59
60
|
/**
|
|
@@ -131,13 +131,16 @@
|
|
|
131
131
|
*/
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
|
-
* Dataplane pipeline upload
|
|
134
|
+
* Dataplane pipeline upload API envelope (makeApiCall / ApiClient).
|
|
135
|
+
* Body in `data` matches dataplane PublicationResult (uploadId, uploadStatus, system, datasources, generateMcpContract, …).
|
|
135
136
|
* @typedef {Object} PipelineUploadResponse
|
|
136
137
|
* @property {boolean} success - Request success flag
|
|
137
|
-
* @property {Object} [data] -
|
|
138
|
-
* @property {string} [data.
|
|
139
|
-
* @property {string
|
|
140
|
-
* @property {
|
|
138
|
+
* @property {Object} [data] - PublicationResult from dataplane (not a generic wrapper with datasourceKeys/warnings)
|
|
139
|
+
* @property {string} [data.uploadId] - Upload / publication id
|
|
140
|
+
* @property {string} [data.uploadStatus] - e.g. published
|
|
141
|
+
* @property {Object} [data.system] - Published external system
|
|
142
|
+
* @property {Object[]} [data.datasources] - Published datasources
|
|
143
|
+
* @property {boolean} [data.generateMcpContract] - MCP generation flag
|
|
141
144
|
* @property {string} [formattedError] - Formatted error message on failure
|
|
142
145
|
*/
|
|
143
146
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview JSDoc types for unified validation run (POST /api/v1/validation/run).
|
|
3
|
+
* @author AI Fabrix Team
|
|
4
|
+
* @version 2.0.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {'externalSystem'|'externalDataSource'} ValidationScope
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {'test'|'integration'|'e2e'} ValidationRunKind
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Request body for POST /api/v1/validation/run (camelCase; see Dataplane OpenAPI).
|
|
17
|
+
* @typedef {Object} ValidationRunRequestBody
|
|
18
|
+
* @property {string} [systemIdOrKey]
|
|
19
|
+
* @property {string} [systemKey]
|
|
20
|
+
* @property {string[]} [datasourceKeys]
|
|
21
|
+
* @property {string} [datasourceKey]
|
|
22
|
+
* @property {boolean} [explain]
|
|
23
|
+
* @property {boolean} [includeLiveChecks]
|
|
24
|
+
* @property {boolean} [includeLiveDebug]
|
|
25
|
+
* @property {boolean} [showCapabilities]
|
|
26
|
+
* @property {boolean} [explainMetrics]
|
|
27
|
+
* @property {boolean} [explainCertification]
|
|
28
|
+
* @property {boolean} [includeMetrics]
|
|
29
|
+
* @property {boolean} [includeCertification]
|
|
30
|
+
* @property {Object} [systemConfig]
|
|
31
|
+
* @property {Object[]} [datasourceConfigs]
|
|
32
|
+
* @property {ValidationScope} [validationScope]
|
|
33
|
+
* @property {ValidationRunKind} [runType]
|
|
34
|
+
* @property {Object} [payloadTemplate]
|
|
35
|
+
* @property {boolean} [asyncRun]
|
|
36
|
+
* @property {Object} [e2eOptions]
|
|
37
|
+
* @property {boolean} [includeDebug]
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Minimal DatasourceTestRun shape for CLI exit / display (full schema in lib/schema).
|
|
42
|
+
* @typedef {Object} DatasourceTestRunLike
|
|
43
|
+
* @property {string} [reportVersion]
|
|
44
|
+
* @property {string} datasourceKey
|
|
45
|
+
* @property {string} systemKey
|
|
46
|
+
* @property {ValidationRunKind} runType
|
|
47
|
+
* @property {'ok'|'warn'|'fail'|'skipped'} status
|
|
48
|
+
* @property {'minimal'|'partial'|'full'} [reportCompleteness]
|
|
49
|
+
* @property {string} [runId]
|
|
50
|
+
* @property {string} [testRunId]
|
|
51
|
+
* @property {Object} [certificate]
|
|
52
|
+
* @property {string} [certificate.status]
|
|
53
|
+
* @property {Object} [developer]
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
module.exports = {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Unified dataplane validation API — POST /api/v1/validation/run and poll GET.
|
|
3
|
+
* @author AI Fabrix Team
|
|
4
|
+
* @version 2.0.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { ApiClient } = require('./index');
|
|
8
|
+
|
|
9
|
+
const POST_PATH = '/api/v1/validation/run';
|
|
10
|
+
|
|
11
|
+
function buildClientCredentialHeaders(authConfig) {
|
|
12
|
+
if (!authConfig || typeof authConfig !== 'object') return null;
|
|
13
|
+
if (authConfig.type !== 'client-credentials') return null;
|
|
14
|
+
if (!authConfig.clientId || !authConfig.clientSecret) return null;
|
|
15
|
+
return {
|
|
16
|
+
'x-client-id': String(authConfig.clientId),
|
|
17
|
+
'x-client-secret': String(authConfig.clientSecret)
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Normalize auth for dataplane: Bearer user token, x-client-token app token, or API key as Bearer.
|
|
23
|
+
* @param {Object} authConfig - Auth configuration
|
|
24
|
+
* @returns {Object} Auth for ApiClient
|
|
25
|
+
*/
|
|
26
|
+
function normalizeDataplaneAuth(authConfig) {
|
|
27
|
+
if (!authConfig || typeof authConfig !== 'object') {
|
|
28
|
+
throw new Error('authConfig is required');
|
|
29
|
+
}
|
|
30
|
+
if (authConfig.token) {
|
|
31
|
+
return authConfig;
|
|
32
|
+
}
|
|
33
|
+
if (authConfig.apiKey) {
|
|
34
|
+
return { ...authConfig, token: authConfig.apiKey, type: authConfig.type || 'bearer' };
|
|
35
|
+
}
|
|
36
|
+
throw new Error(
|
|
37
|
+
'Validation run requires Bearer token or API key. Run \'aifabrix login\' or configure API key.'
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @requiresPermission {Dataplane} external-system:read
|
|
43
|
+
* @async
|
|
44
|
+
* @function postValidationRun
|
|
45
|
+
* @param {string} dataplaneUrl - Dataplane base URL
|
|
46
|
+
* @param {Object} authConfig - Authentication (token or apiKey)
|
|
47
|
+
* @param {import('./types/validation-run.types').ValidationRunRequestBody} body - Request JSON body
|
|
48
|
+
* @param {Object} [transportOpts]
|
|
49
|
+
* @param {number} [transportOpts.timeoutMs] - Per-request HTTP timeout (validation E2E POST can exceed 30s)
|
|
50
|
+
* @returns {Promise<Object>} ApiClient result: { success, data, status, ... }
|
|
51
|
+
*/
|
|
52
|
+
async function postValidationRun(dataplaneUrl, authConfig, body, transportOpts = {}) {
|
|
53
|
+
const hdrs = buildClientCredentialHeaders(authConfig);
|
|
54
|
+
const clientAuth = hdrs ? {} : normalizeDataplaneAuth(authConfig);
|
|
55
|
+
const client = new ApiClient(dataplaneUrl, clientAuth);
|
|
56
|
+
const postOpts = { body, headers: hdrs || undefined };
|
|
57
|
+
if (Number.isFinite(transportOpts.timeoutMs) && transportOpts.timeoutMs > 0) {
|
|
58
|
+
postOpts.timeoutMs = transportOpts.timeoutMs;
|
|
59
|
+
}
|
|
60
|
+
return client.post(POST_PATH, postOpts);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @requiresPermission {Dataplane} external-system:read
|
|
65
|
+
* @async
|
|
66
|
+
* @function getValidationRun
|
|
67
|
+
* @param {string} dataplaneUrl - Dataplane base URL
|
|
68
|
+
* @param {Object} authConfig - Authentication
|
|
69
|
+
* @param {string} testRunId - Poll id from 202 / envelope
|
|
70
|
+
* @param {Object} [transportOpts]
|
|
71
|
+
* @param {number} [transportOpts.timeoutMs] - Per-request HTTP timeout (align with aggregate validation budget)
|
|
72
|
+
* @returns {Promise<Object>} ApiClient result
|
|
73
|
+
*/
|
|
74
|
+
async function getValidationRun(dataplaneUrl, authConfig, testRunId, transportOpts = {}) {
|
|
75
|
+
if (!testRunId || typeof testRunId !== 'string') {
|
|
76
|
+
throw new Error('testRunId is required for validation run poll');
|
|
77
|
+
}
|
|
78
|
+
const hdrs = buildClientCredentialHeaders(authConfig);
|
|
79
|
+
const clientAuth = hdrs ? {} : normalizeDataplaneAuth(authConfig);
|
|
80
|
+
const client = new ApiClient(dataplaneUrl, clientAuth);
|
|
81
|
+
const path = `${POST_PATH}/${encodeURIComponent(testRunId)}`;
|
|
82
|
+
const getOpts = { headers: hdrs || undefined };
|
|
83
|
+
if (Number.isFinite(transportOpts.timeoutMs) && transportOpts.timeoutMs > 0) {
|
|
84
|
+
getOpts.timeoutMs = transportOpts.timeoutMs;
|
|
85
|
+
}
|
|
86
|
+
return client.get(path, getOpts);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Extract async poll id from POST 202 body or partial DatasourceTestRun.
|
|
91
|
+
* @param {Object} data - Parsed JSON body
|
|
92
|
+
* @returns {string|null}
|
|
93
|
+
*/
|
|
94
|
+
function extractTestRunId(data) {
|
|
95
|
+
if (!data || typeof data !== 'object') return null;
|
|
96
|
+
if (typeof data.testRunId === 'string' && data.testRunId.trim()) return data.testRunId.trim();
|
|
97
|
+
if (data.testRunId && typeof data.testRunId === 'object') {
|
|
98
|
+
const id = data.testRunId.id || data.testRunId.key;
|
|
99
|
+
if (typeof id === 'string' && id.trim()) return id.trim();
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
module.exports = {
|
|
105
|
+
postValidationRun,
|
|
106
|
+
getValidationRun,
|
|
107
|
+
extractTestRunId,
|
|
108
|
+
normalizeDataplaneAuth,
|
|
109
|
+
buildClientCredentialHeaders,
|
|
110
|
+
POST_PATH
|
|
111
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Single reusable module for unified validation POST + optional poll.
|
|
3
|
+
*
|
|
4
|
+
* Used by datasource- and system-scoped CLI flows to enforce plan §9 behavior consistently.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const { extractTestRunId } = require('./validation-run.api');
|
|
10
|
+
const { postValidationRunWithTransportRetry } = require('../utils/validation-run-post-retry');
|
|
11
|
+
const { pollValidationRunUntilComplete } = require('../utils/validation-run-poll');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* POST /api/v1/validation/run and (when async) poll GET until reportCompleteness is full.
|
|
15
|
+
*
|
|
16
|
+
* @param {Object} opts
|
|
17
|
+
* @param {string} opts.dataplaneUrl
|
|
18
|
+
* @param {Object} opts.authConfig
|
|
19
|
+
* @param {Object} opts.body
|
|
20
|
+
* @param {number} opts.timeoutMs
|
|
21
|
+
* @param {boolean} opts.useAsync
|
|
22
|
+
* @param {boolean} opts.noAsync
|
|
23
|
+
* @returns {Promise<{ envelope: Object|null, apiError: Object|null, pollTimedOut: boolean, incompleteNoAsync: boolean }>}
|
|
24
|
+
*/
|
|
25
|
+
/* eslint-disable max-lines-per-function, max-statements, complexity -- POST + poll orchestration */
|
|
26
|
+
async function postValidationRunAndOptionalPoll(opts) {
|
|
27
|
+
const { dataplaneUrl, authConfig, body, timeoutMs, useAsync, noAsync, verbosePoll } = opts;
|
|
28
|
+
const started = Date.now();
|
|
29
|
+
const transportOpts =
|
|
30
|
+
Number.isFinite(timeoutMs) && timeoutMs > 0 ? { timeoutMs } : {};
|
|
31
|
+
const postRes = await postValidationRunWithTransportRetry(
|
|
32
|
+
dataplaneUrl,
|
|
33
|
+
authConfig,
|
|
34
|
+
body,
|
|
35
|
+
transportOpts
|
|
36
|
+
);
|
|
37
|
+
if (!postRes.success) {
|
|
38
|
+
return {
|
|
39
|
+
envelope: null,
|
|
40
|
+
apiError: postRes,
|
|
41
|
+
pollTimedOut: false,
|
|
42
|
+
incompleteNoAsync: false
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let envelope = postRes.data;
|
|
47
|
+
const httpStatus = postRes.status;
|
|
48
|
+
const testRunId = extractTestRunId(envelope);
|
|
49
|
+
const completeness = envelope && envelope.reportCompleteness;
|
|
50
|
+
const needsPoll =
|
|
51
|
+
httpStatus === 202 ||
|
|
52
|
+
(testRunId && completeness && completeness !== 'full' && useAsync);
|
|
53
|
+
|
|
54
|
+
if (needsPoll && testRunId) {
|
|
55
|
+
const elapsed = Date.now() - started;
|
|
56
|
+
const remaining = Math.max(0, timeoutMs - elapsed);
|
|
57
|
+
const pollResult = await pollValidationRunUntilComplete({
|
|
58
|
+
dataplaneUrl,
|
|
59
|
+
authConfig,
|
|
60
|
+
testRunId,
|
|
61
|
+
budgetMs: remaining,
|
|
62
|
+
verbosePoll: verbosePoll === true,
|
|
63
|
+
pollRequestTimeoutMs:
|
|
64
|
+
Number.isFinite(timeoutMs) && timeoutMs > 0 ? timeoutMs : undefined
|
|
65
|
+
});
|
|
66
|
+
if (!pollResult.lastApiResult || !pollResult.lastApiResult.success) {
|
|
67
|
+
return {
|
|
68
|
+
envelope: pollResult.envelope,
|
|
69
|
+
apiError: pollResult.lastApiResult,
|
|
70
|
+
pollTimedOut: pollResult.timedOut,
|
|
71
|
+
incompleteNoAsync: false
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
envelope = pollResult.envelope;
|
|
75
|
+
if (pollResult.timedOut) {
|
|
76
|
+
return {
|
|
77
|
+
envelope,
|
|
78
|
+
apiError: null,
|
|
79
|
+
pollTimedOut: true,
|
|
80
|
+
incompleteNoAsync: false
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (
|
|
86
|
+
noAsync &&
|
|
87
|
+
envelope &&
|
|
88
|
+
envelope.reportCompleteness &&
|
|
89
|
+
envelope.reportCompleteness !== 'full'
|
|
90
|
+
) {
|
|
91
|
+
return {
|
|
92
|
+
envelope,
|
|
93
|
+
apiError: null,
|
|
94
|
+
pollTimedOut: false,
|
|
95
|
+
incompleteNoAsync: true
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
envelope,
|
|
101
|
+
apiError: null,
|
|
102
|
+
pollTimedOut: false,
|
|
103
|
+
incompleteNoAsync: false
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/* eslint-enable max-lines-per-function, max-statements, complexity */
|
|
107
|
+
|
|
108
|
+
module.exports = { postValidationRunAndOptionalPoll };
|
|
109
|
+
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Load local `certification` and optional dataplane verify for `aifabrix show` (external).
|
|
3
|
+
* @author AI Fabrix Team
|
|
4
|
+
* @version 2.0.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const { resolvePrimarySystemFilePath } = require('../certification/sync-system-certification');
|
|
10
|
+
const { loadConfigFile } = require('../utils/config-format');
|
|
11
|
+
const { generateControllerManifest } = require('../generator/external-controller-manifest');
|
|
12
|
+
const { verifyRowForDatasource } = require('./certification-verify-rows');
|
|
13
|
+
|
|
14
|
+
const MAX_VERIFY_DATASOURCES = 12;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param {string} pem
|
|
18
|
+
* @param {number} maxLen
|
|
19
|
+
* @returns {string}
|
|
20
|
+
*/
|
|
21
|
+
function truncatePublicKeyPreview(pem, maxLen = 52) {
|
|
22
|
+
if (!pem || typeof pem !== 'string') return '—';
|
|
23
|
+
const s = pem.trim();
|
|
24
|
+
if (s.length <= maxLen) return s;
|
|
25
|
+
return `${s.slice(0, maxLen)}… (${s.length} chars)`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @param {Object|null|undefined} cert
|
|
30
|
+
* @returns {Object|null}
|
|
31
|
+
*/
|
|
32
|
+
function sanitizeCertificationForJson(cert) {
|
|
33
|
+
if (!cert || typeof cert !== 'object') return null;
|
|
34
|
+
const pk = cert.publicKey;
|
|
35
|
+
return {
|
|
36
|
+
enabled: cert.enabled,
|
|
37
|
+
algorithm: cert.algorithm,
|
|
38
|
+
issuer: cert.issuer,
|
|
39
|
+
version: cert.version,
|
|
40
|
+
publicKeyPreview: truncatePublicKeyPreview(pk, 96)
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param {string} appKey
|
|
46
|
+
* @returns {Object|null}
|
|
47
|
+
*/
|
|
48
|
+
function loadLocalCertificationFromSystemFile(appKey) {
|
|
49
|
+
const r = resolvePrimarySystemFilePath(appKey);
|
|
50
|
+
if (!r || !r.systemFilePath) return null;
|
|
51
|
+
try {
|
|
52
|
+
const sys = loadConfigFile(r.systemFilePath);
|
|
53
|
+
const c = sys && sys.certification;
|
|
54
|
+
if (!c || typeof c !== 'object') return null;
|
|
55
|
+
return c;
|
|
56
|
+
} catch {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @param {Object} summary - show summary (mutated)
|
|
63
|
+
* @param {string} appKey
|
|
64
|
+
*/
|
|
65
|
+
function attachLocalCertification(summary, appKey) {
|
|
66
|
+
if (!summary || !summary.isExternal) return;
|
|
67
|
+
const cert = loadLocalCertificationFromSystemFile(appKey);
|
|
68
|
+
if (cert) summary.localCertification = cert;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Resolve dataplane URL + datasource keys for verify, or set summary errors.
|
|
73
|
+
* @returns {Promise<{ dataplaneUrl: string, authConfig: Object, systemKey: string, keys: string[] }|null>}
|
|
74
|
+
*/
|
|
75
|
+
async function resolveCertificationVerifyTargets(summary, appKey, authBundle) {
|
|
76
|
+
if (!authBundle || !authBundle.token || !authBundle.controllerUrl) {
|
|
77
|
+
summary.certificationVerifySkipped = true;
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const { resolveEnvironment } = require('../core/config');
|
|
81
|
+
const { resolveDataplaneUrl } = require('../utils/dataplane-resolver');
|
|
82
|
+
const authConfig = { type: 'bearer', token: authBundle.token };
|
|
83
|
+
const environment = await resolveEnvironment();
|
|
84
|
+
let dataplaneUrl;
|
|
85
|
+
try {
|
|
86
|
+
dataplaneUrl = await resolveDataplaneUrl(authBundle.controllerUrl, environment, authConfig);
|
|
87
|
+
} catch (e) {
|
|
88
|
+
summary.certificationVerifyError = e.message || 'dataplane_unavailable';
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
let manifest;
|
|
92
|
+
try {
|
|
93
|
+
manifest = await generateControllerManifest(appKey, { type: 'external' });
|
|
94
|
+
} catch {
|
|
95
|
+
summary.certificationVerifyError = 'manifest_unavailable';
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
const systemKey = manifest.key || appKey;
|
|
99
|
+
const keys = (manifest.dataSources || []).map((ds) => ds && ds.key).filter(Boolean).slice(0, MAX_VERIFY_DATASOURCES);
|
|
100
|
+
return { dataplaneUrl, authConfig, systemKey, keys };
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Populate **certificationVerifyRows** on summary (mutates).
|
|
105
|
+
*
|
|
106
|
+
* @async
|
|
107
|
+
* @param {Object} summary
|
|
108
|
+
* @param {string} appKey
|
|
109
|
+
* @param {{ token: string, controllerUrl: string }} authBundle
|
|
110
|
+
* @returns {Promise<void>}
|
|
111
|
+
*/
|
|
112
|
+
async function attachCertificationVerifyFromDataplane(summary, appKey, authBundle) {
|
|
113
|
+
if (!summary || !summary.isExternal) return;
|
|
114
|
+
const ctx = await resolveCertificationVerifyTargets(summary, appKey, authBundle);
|
|
115
|
+
if (!ctx) return;
|
|
116
|
+
const rows = [];
|
|
117
|
+
for (const dk of ctx.keys) {
|
|
118
|
+
rows.push(await verifyRowForDatasource(ctx.dataplaneUrl, ctx.authConfig, ctx.systemKey, dk));
|
|
119
|
+
}
|
|
120
|
+
summary.certificationVerifyRows = rows;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
module.exports = {
|
|
124
|
+
attachLocalCertification,
|
|
125
|
+
attachCertificationVerifyFromDataplane,
|
|
126
|
+
sanitizeCertificationForJson,
|
|
127
|
+
truncatePublicKeyPreview,
|
|
128
|
+
loadLocalCertificationFromSystemFile
|
|
129
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Build per-datasource certificate verify rows for show / enrich (small helpers for lint limits).
|
|
3
|
+
* @author AI Fabrix Team
|
|
4
|
+
* @version 2.0.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const { unwrapApiData } = require('../utils/external-system-readiness-core');
|
|
10
|
+
const { getActiveIntegrationCertificate, verifyIntegrationCertificate } = require('../api/certificates.api');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {*} id
|
|
14
|
+
* @returns {string|null}
|
|
15
|
+
*/
|
|
16
|
+
function certificateIdString(id) {
|
|
17
|
+
if (id === undefined || id === null) return null;
|
|
18
|
+
if (typeof id === 'string') return id.trim() || null;
|
|
19
|
+
if (typeof id === 'object' && id !== null && typeof id.id === 'string') return id.id.trim() || null;
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {string} dataplaneUrl
|
|
25
|
+
* @param {Object} authConfig
|
|
26
|
+
* @param {string} systemKey
|
|
27
|
+
* @param {string} dk
|
|
28
|
+
* @returns {Promise<Object>}
|
|
29
|
+
*/
|
|
30
|
+
async function verifyRowForDatasource(dataplaneUrl, authConfig, systemKey, dk) {
|
|
31
|
+
const activeRes = await getActiveIntegrationCertificate(dataplaneUrl, authConfig, systemKey, dk);
|
|
32
|
+
if (!activeRes || activeRes.success === false) {
|
|
33
|
+
return { datasourceKey: dk, error: 'active_unavailable' };
|
|
34
|
+
}
|
|
35
|
+
const art = unwrapApiData(activeRes);
|
|
36
|
+
const cid = certificateIdString(art && art.certificateId);
|
|
37
|
+
if (!cid) {
|
|
38
|
+
return { datasourceKey: dk, error: 'no_certificate_id' };
|
|
39
|
+
}
|
|
40
|
+
const verRes = await verifyIntegrationCertificate(dataplaneUrl, authConfig, {
|
|
41
|
+
certificateId: cid,
|
|
42
|
+
verifyHash: true,
|
|
43
|
+
systemIdOrKey: systemKey,
|
|
44
|
+
datasourceKey: dk
|
|
45
|
+
});
|
|
46
|
+
if (!verRes || verRes.success === false) {
|
|
47
|
+
return { datasourceKey: dk, certificateId: cid, error: 'verify_request_failed' };
|
|
48
|
+
}
|
|
49
|
+
const v = unwrapApiData(verRes);
|
|
50
|
+
return {
|
|
51
|
+
datasourceKey: dk,
|
|
52
|
+
certificateId: cid,
|
|
53
|
+
overallValid: !!(v && v.overallValid),
|
|
54
|
+
validSignature: !!(v && v.validSignature),
|
|
55
|
+
validHash: !!(v && v.validHash),
|
|
56
|
+
reasons: Array.isArray(v && v.reasons) ? v.reasons : []
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
module.exports = { verifyRowForDatasource, certificateIdString };
|
package/lib/app/config.js
CHANGED
|
@@ -135,7 +135,7 @@ async function generateEnvTemplateFile(appPath, appName, config, existingEnv) {
|
|
|
135
135
|
envTemplate = envResult.template;
|
|
136
136
|
|
|
137
137
|
if (envResult.warnings.length > 0) {
|
|
138
|
-
logger.log(chalk.yellow('\n
|
|
138
|
+
logger.log(chalk.yellow('\n⚠ Environment conversion warnings:'));
|
|
139
139
|
envResult.warnings.forEach(warning => logger.log(chalk.yellow(` - ${warning}`)));
|
|
140
140
|
}
|
|
141
141
|
} else {
|
|
@@ -69,9 +69,9 @@ async function displayAppUrlFromController(controllerUrl, envKey, appKey, authCo
|
|
|
69
69
|
url = buildAppUrlFromControllerAndPort(controllerUrl, port);
|
|
70
70
|
}
|
|
71
71
|
if (url) {
|
|
72
|
-
logger.log(chalk.green(`
|
|
72
|
+
logger.log(chalk.green(` ✔ App running at ${url}`));
|
|
73
73
|
} else {
|
|
74
|
-
logger.log(chalk.blue('
|
|
74
|
+
logger.log(chalk.blue(' ✔ App deployed. Get URL from controller dashboard.'));
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
package/lib/app/deploy.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { formatSuccessLine, formatSuccessParagraph } = require('../utils/cli-test-layout-chalk');
|
|
1
2
|
/**
|
|
2
3
|
* AI Fabrix Builder Application Deployment Module
|
|
3
4
|
*
|
|
@@ -79,7 +80,7 @@ async function validatePushPrerequisites(appName, registry) {
|
|
|
79
80
|
*/
|
|
80
81
|
async function executePush(appName, registry, tags) {
|
|
81
82
|
if (await pushUtils.checkACRAuthentication(registry)) {
|
|
82
|
-
logger.log(
|
|
83
|
+
logger.log(formatSuccessLine(`Already authenticated with ${registry}`));
|
|
83
84
|
} else {
|
|
84
85
|
await pushUtils.authenticateACR(registry);
|
|
85
86
|
}
|
|
@@ -98,7 +99,7 @@ async function executePush(appName, registry, tags) {
|
|
|
98
99
|
* @param {string} appName - Application name
|
|
99
100
|
*/
|
|
100
101
|
function verifyPushResult(tags, registry, appName) {
|
|
101
|
-
logger.log(
|
|
102
|
+
logger.log(formatSuccessParagraph(`Successfully pushed ${tags.length} tag(s) to ${registry}`));
|
|
102
103
|
logger.log(chalk.gray(`Image: ${registry}/${appName}:*`));
|
|
103
104
|
logger.log(chalk.gray(`Tags: ${tags.join(', ')}`));
|
|
104
105
|
}
|
|
@@ -173,7 +174,7 @@ async function generateAndValidateManifest(appName, options = {}) {
|
|
|
173
174
|
* @param {string} manifestPath - Path to manifest file
|
|
174
175
|
*/
|
|
175
176
|
function displayDeploymentInfo(manifest, manifestPath) {
|
|
176
|
-
logger.log(
|
|
177
|
+
logger.log(formatSuccessLine(`Manifest generated: ${manifestPath}`));
|
|
177
178
|
logger.log(chalk.blue(` Key: ${manifest.key}`));
|
|
178
179
|
logger.log(chalk.blue(` Display Name: ${manifest.displayName}`));
|
|
179
180
|
logger.log(chalk.blue(` Image: ${manifest.image}`));
|
|
@@ -216,8 +217,8 @@ function displayDeploymentResults(result) {
|
|
|
216
217
|
logger.log(chalk.blue(` Deployment ID: ${result.deploymentId}`));
|
|
217
218
|
}
|
|
218
219
|
if (result.status) {
|
|
219
|
-
const statusIcon = result.status.status === 'completed' ? '
|
|
220
|
-
result.status.status === 'failed' ? '
|
|
220
|
+
const statusIcon = result.status.status === 'completed' ? '✔' :
|
|
221
|
+
result.status.status === 'failed' ? '✖' : '⏳';
|
|
221
222
|
logger.log(chalk.blue(` Status: ${statusIcon} ${result.status.status}`));
|
|
222
223
|
}
|
|
223
224
|
}
|
|
@@ -368,7 +369,7 @@ async function executeStandardDeployment(appName, options) {
|
|
|
368
369
|
}
|
|
369
370
|
|
|
370
371
|
/**
|
|
371
|
-
* Tries external deploy when builder/<
|
|
372
|
+
* Tries external deploy when builder/<appKey> does not exist but integration/<systemKey> does.
|
|
372
373
|
* @async
|
|
373
374
|
* @param {string} appName - Application name
|
|
374
375
|
* @param {Object} options - Deployment options
|
package/lib/app/display.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { formatSuccessParagraph } = require('../utils/cli-test-layout-chalk');
|
|
1
2
|
/**
|
|
2
3
|
* Application Display Utilities
|
|
3
4
|
*
|
|
@@ -64,7 +65,7 @@ function displayWebappSuccess(appName, config, envConversionMessage) {
|
|
|
64
65
|
* @param {string} appPath - Application path
|
|
65
66
|
*/
|
|
66
67
|
function displaySuccessMessage(appName, config, envConversionMessage, hasAppFiles = false, appPath = null) {
|
|
67
|
-
logger.log(
|
|
68
|
+
logger.log(formatSuccessParagraph('Application created successfully!'));
|
|
68
69
|
logger.log(chalk.blue(`\nApplication: ${appName}`));
|
|
69
70
|
|
|
70
71
|
// Determine location based on app type
|
package/lib/app/dockerfile.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { formatSuccessLine } = require('../utils/cli-test-layout-chalk');
|
|
1
2
|
/**
|
|
2
3
|
* Application Dockerfile Generation
|
|
3
4
|
*
|
|
@@ -74,7 +75,7 @@ async function generateAndCopyDockerfile(appPath, dockerfilePath, config) {
|
|
|
74
75
|
const buildConfig = config.build || {};
|
|
75
76
|
const generatedPath = await build.generateDockerfile(appPath, config.language, config, buildConfig);
|
|
76
77
|
await fs.copyFile(generatedPath, dockerfilePath);
|
|
77
|
-
logger.log(
|
|
78
|
+
logger.log(formatSuccessLine('Generated Dockerfile from template'));
|
|
78
79
|
return dockerfilePath;
|
|
79
80
|
}
|
|
80
81
|
|
|
@@ -90,7 +91,7 @@ async function generateDockerfileForApp(appName, options = {}) {
|
|
|
90
91
|
try {
|
|
91
92
|
const { isExternal } = await detectAppType(appName);
|
|
92
93
|
if (isExternal) {
|
|
93
|
-
logger.log(chalk.yellow('
|
|
94
|
+
logger.log(chalk.yellow('⚠ External systems don\'t require Dockerfiles. Skipping...'));
|
|
94
95
|
return null;
|
|
95
96
|
}
|
|
96
97
|
} catch (error) {
|