@aifabrix/builder 2.45.0 → 2.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/rules/cli-layout.mdc +2 -0
- package/.cursor/rules/cli-product-neutral.mdc +43 -0
- package/.cursor/rules/docs-rules.mdc +3 -1
- package/.cursor/rules/project-rules.mdc +1 -0
- package/README.md +43 -17
- package/integration/hubspot-test/wizard-hubspot-e2e.yaml +1 -1
- package/jest.config.default.js +2 -1
- package/jest.config.isolated.js +2 -1
- package/jest.global-live-fabrix-hooks.js +36 -0
- package/jest.isolated-projects.js +130 -0
- package/jest.projects.js +69 -121
- package/lib/api/agent-metadata-validation.api.js +93 -0
- package/lib/api/api-response-errors.js +124 -0
- package/lib/api/audit-api-helpers.js +68 -0
- package/lib/api/audit.api.js +119 -0
- package/lib/api/auth-cache.api.js +44 -0
- package/lib/api/certificates.api.js +4 -4
- package/lib/api/credential.api.js +2 -2
- package/lib/api/dataplane-health.api.js +137 -0
- package/lib/api/dataplane-sync.api.js +27 -0
- package/lib/api/datasources-core.api.js +21 -18
- package/lib/api/datasources-extended.api.js +22 -22
- package/lib/api/dimensions.api.js +3 -0
- package/lib/api/external-systems.api.js +13 -13
- package/lib/api/governance-scenario-pack.api.js +159 -0
- package/lib/api/governance-scenarios.api.js +39 -0
- package/lib/api/groups.api.js +79 -0
- package/lib/api/index.js +88 -5
- package/lib/api/lifecycle.api.js +77 -0
- package/lib/api/pipeline.api.js +7 -5
- package/lib/api/protection.api.js +157 -0
- package/lib/api/records-bulk.api.js +43 -0
- package/lib/api/records-search-parse.js +49 -0
- package/lib/api/records-search.api.js +29 -0
- package/lib/api/types/agent-metadata-validation.types.js +67 -0
- package/lib/api/types/audit.types.js +72 -0
- package/lib/api/types/dataplane-health.types.js +27 -0
- package/lib/api/types/dimensions.types.js +2 -0
- package/lib/api/types/governance-scenarios.types.js +39 -0
- package/lib/api/types/protection.types.js +69 -0
- package/lib/api/types/records-bulk.types.js +35 -0
- package/lib/api/types/records-search.types.js +28 -0
- package/lib/api/user-groups.api.js +50 -0
- package/lib/api/users.api.js +95 -0
- package/lib/api/validation-run.api.js +3 -3
- package/lib/api/validation-runner.js +5 -3
- package/lib/api/wizard-platform.api.js +3 -3
- package/lib/api/wizard.api.js +21 -21
- package/lib/app/deploy-config.js +4 -1
- package/lib/app/deploy.js +34 -19
- package/lib/app/down.js +20 -1
- package/lib/app/push.js +4 -5
- package/lib/app/register.js +7 -4
- package/lib/app/run-env-compose.js +84 -30
- package/lib/build/index.js +5 -0
- package/lib/certification/sync-system-certification.js +13 -6
- package/lib/cli/index.js +8 -2
- package/lib/cli/infra-guided-auth.js +109 -0
- package/lib/cli/infra-guided.js +91 -69
- package/lib/cli/setup-app.help.js +19 -2
- package/lib/cli/setup-app.js +58 -23
- package/lib/cli/setup-app.test-commands.js +28 -21
- package/lib/cli/setup-auth.js +55 -3
- package/lib/cli/setup-certification-commands.js +147 -0
- package/lib/cli/setup-certification.help.js +141 -0
- package/lib/cli/setup-environment.js +19 -2
- package/lib/cli/setup-external-system-help.js +62 -0
- package/lib/cli/setup-external-system.js +62 -6
- package/lib/cli/setup-infra.js +9 -1
- package/lib/cli/setup-platform.js +6 -1
- package/lib/cli/setup-secrets.js +33 -1
- package/lib/cli/setup-utility-help-after.js +65 -0
- package/lib/cli/setup-utility-repair.js +198 -0
- package/lib/cli/setup-utility-resolve.js +42 -6
- package/lib/cli/setup-utility-validate.js +197 -0
- package/lib/cli/setup-utility.js +41 -258
- package/lib/commands/auth-status-client-tokens.js +214 -0
- package/lib/commands/auth-status-dataplane-version.js +269 -0
- package/lib/commands/auth-status-display.js +94 -0
- package/lib/commands/auth-status.js +111 -53
- package/lib/commands/credential-push.js +10 -5
- package/lib/commands/datasource-load-export-cli.js +178 -0
- package/lib/commands/datasource-test-trust-cli.js +118 -0
- package/lib/commands/datasource-unified-test-cli.js +31 -20
- package/lib/commands/datasource-unified-test-cli.options.js +22 -3
- package/lib/commands/datasource-unified-test-e2e-cli-helpers.js +5 -5
- package/lib/commands/datasource-verify-audit-cli.js +96 -0
- package/lib/commands/datasource.js +68 -1
- package/lib/commands/dev-show-display.js +8 -1
- package/lib/commands/dimension-value.js +43 -13
- package/lib/commands/dimension.js +38 -7
- package/lib/commands/governance-cli-shared.js +94 -0
- package/lib/commands/governance-command-action.js +132 -0
- package/lib/commands/governance-download-external.js +34 -0
- package/lib/commands/governance-generate-external.js +71 -0
- package/lib/commands/governance-upload-external.js +36 -0
- package/lib/commands/governance-verify-external.js +64 -0
- package/lib/commands/governance.js +144 -0
- package/lib/commands/identity-apply-sync.js +131 -0
- package/lib/commands/identity-group-cli.js +146 -0
- package/lib/commands/identity-membership-role-cache.js +175 -0
- package/lib/commands/identity-shared.js +94 -0
- package/lib/commands/identity-user-cli.js +158 -0
- package/lib/commands/identity.js +43 -0
- package/lib/commands/lifecycle-command-action.js +123 -0
- package/lib/commands/lifecycle-external.js +268 -0
- package/lib/commands/login.js +56 -17
- package/lib/commands/protection-cli-leaves.js +286 -0
- package/lib/commands/protection.js +50 -0
- package/lib/commands/repair-auth-apply.js +127 -0
- package/lib/commands/repair-changed-files.js +41 -0
- package/lib/commands/repair-datasource-keys.js +4 -1
- package/lib/commands/repair-datasource-run.js +59 -0
- package/lib/commands/repair-datasource-test-payload.js +259 -0
- package/lib/commands/repair-datasource.js +1 -51
- package/lib/commands/repair-env-template.js +64 -13
- package/lib/commands/repair-external-run.js +216 -0
- package/lib/commands/repair-openapi-sync.js +23 -0
- package/lib/commands/repair-persist.js +4 -0
- package/lib/commands/repair-rbac.js +52 -1
- package/lib/commands/repair-steps.js +145 -0
- package/lib/commands/repair.js +29 -286
- package/lib/commands/secrets-get.js +184 -0
- package/lib/commands/secrets-remove-all.js +3 -1
- package/lib/commands/setup-image-refresh.js +146 -0
- package/lib/commands/setup-modes.js +158 -162
- package/lib/commands/setup-platform-auth.js +76 -0
- package/lib/commands/setup-prompts-admin.js +244 -0
- package/lib/commands/setup-prompts-platform-mode.js +67 -0
- package/lib/commands/setup-prompts-validators.js +36 -0
- package/lib/commands/setup-prompts.js +24 -76
- package/lib/commands/setup-run-context.js +45 -0
- package/lib/commands/setup-spinners.js +39 -0
- package/lib/commands/setup.js +27 -5
- package/lib/commands/teardown.js +39 -0
- package/lib/commands/test-e2e-external.js +61 -14
- package/lib/commands/test-governance-cli-options.js +47 -0
- package/lib/commands/test-governance-external.js +67 -0
- package/lib/commands/test-trust-cli-options.js +32 -0
- package/lib/commands/test-trust-external.js +126 -0
- package/lib/commands/up-common.js +25 -13
- package/lib/commands/up-dataplane.js +50 -13
- package/lib/commands/upload-publish-context.js +75 -0
- package/lib/commands/upload-sidecar-followups.js +89 -0
- package/lib/commands/upload.js +108 -105
- package/lib/commands/verify-governance-combined-external.js +61 -0
- package/lib/commands/verify-governance-command-action.js +64 -0
- package/lib/commands/verify-governance-db.js +102 -0
- package/lib/commands/verify-governance-external.js +77 -0
- package/lib/commands/verify-governance-result-builders.js +71 -0
- package/lib/commands/verify-operations-command-action.js +68 -0
- package/lib/commands/verify-operations-external.js +268 -0
- package/lib/commands/verify-operations-persist.js +75 -0
- package/lib/commands/verify-operations-step-plan.js +68 -0
- package/lib/commands/verify-operations-steps.js +111 -0
- package/lib/commands/verify-trust-command-action.js +70 -0
- package/lib/commands/verify-trust-external.js +67 -0
- package/lib/commands/wizard-config-normalizer.js +43 -23
- package/lib/commands/wizard-core.js +5 -0
- package/lib/core/admin-password-generator.js +38 -0
- package/lib/core/admin-secrets-bundle.js +111 -0
- package/lib/core/admin-secrets-env-overlay.js +62 -0
- package/lib/core/admin-secrets.js +32 -4
- package/lib/core/config-attach-extensions.js +3 -0
- package/lib/core/config-device-dataplane.js +185 -0
- package/lib/core/config-platform-controller.js +44 -0
- package/lib/core/config-setup-installation-profile.js +42 -0
- package/lib/core/config-setup-platform-mode.js +46 -0
- package/lib/core/config.js +46 -36
- package/lib/core/secrets-admin-env.js +6 -2
- package/lib/core/secrets-ensure.js +4 -0
- package/lib/core/secrets-env-content.js +54 -48
- package/lib/core/secrets-env-write.js +10 -1
- package/lib/core/secrets-infra-placeholder-sync.js +2 -0
- package/lib/core/setup-installation-profile.js +43 -0
- package/lib/core/setup-platform-mode.js +55 -0
- package/lib/datasource/agent-trust-debug-log.js +45 -0
- package/lib/datasource/agent-trust-fetch.js +115 -0
- package/lib/datasource/agent-trust-map.js +101 -0
- package/lib/datasource/agent-trust-mock.js +44 -0
- package/lib/datasource/agent-trust-run.js +95 -0
- package/lib/datasource/agent-trust-timeout.js +25 -0
- package/lib/datasource/audit-evidence-display.js +80 -0
- package/lib/datasource/audit-evidence-extract-debug.js +115 -0
- package/lib/datasource/audit-evidence-extract.js +180 -0
- package/lib/datasource/audit-evidence-matrix-rows.js +158 -0
- package/lib/datasource/audit-evidence-operation-aliases.js +63 -0
- package/lib/datasource/audit-evidence-poll.js +109 -0
- package/lib/datasource/audit-evidence-run.js +177 -0
- package/lib/datasource/audit-evidence-verify-helpers.js +167 -0
- package/lib/datasource/audit-evidence-verify-matrix.js +205 -0
- package/lib/datasource/audit-evidence-verify.js +108 -0
- package/lib/datasource/bulk-loader-run-batches.js +100 -0
- package/lib/datasource/bulk-loader-service-retry.js +52 -0
- package/lib/datasource/bulk-loader-service.js +127 -0
- package/lib/datasource/capability/run-capability-dimension.js +2 -1
- package/lib/datasource/datasource-exporter-resolve.js +82 -0
- package/lib/datasource/datasource-exporter-service.js +144 -0
- package/lib/datasource/datasource-identifier.js +148 -0
- package/lib/datasource/datasource-load-export-context.js +95 -0
- package/lib/datasource/integration-context.js +6 -4
- package/lib/datasource/local-data-paths.js +145 -0
- package/lib/datasource/log-cleaner.js +241 -0
- package/lib/datasource/log-viewer.js +111 -6
- package/lib/datasource/record-file-parser.js +85 -0
- package/lib/datasource/record-mapper.js +129 -0
- package/lib/datasource/resolve-app.js +74 -55
- package/lib/datasource/test-e2e.js +29 -2
- package/lib/datasource/unified-validation-run-body.js +3 -1
- package/lib/datasource/unified-validation-run-resolve.js +45 -12
- package/lib/datasource/unified-validation-run.js +47 -18
- package/lib/datasource/validate.js +37 -20
- package/lib/deployment/environment-poll-status.js +138 -0
- package/lib/deployment/environment.js +42 -34
- package/lib/external-system/download.js +21 -20
- package/lib/external-system/generator.js +5 -1
- package/lib/external-system/integration-auth-context.js +45 -0
- package/lib/external-system/test-auth.js +12 -5
- package/lib/external-system/test-system-level.js +25 -4
- package/lib/external-system/test.js +9 -7
- package/lib/generator/external-controller-manifest.js +15 -0
- package/lib/governance/governance-cli-errors.js +96 -0
- package/lib/governance/governance-download-display.js +38 -0
- package/lib/governance/governance-pack-loader.js +70 -0
- package/lib/governance/governance-run-display.js +309 -0
- package/lib/identity/identity-apply-core.js +108 -0
- package/lib/identity/identity-apply-phases.js +244 -0
- package/lib/identity/identity-apply-service.js +77 -0
- package/lib/identity/identity-csv-parser.js +114 -0
- package/lib/infrastructure/admin-secrets-apply.js +84 -0
- package/lib/infrastructure/admin-secrets-ensure.js +130 -0
- package/lib/infrastructure/admin-secrets-resolve.js +95 -0
- package/lib/infrastructure/admin-secrets-sync.js +91 -0
- package/lib/infrastructure/helpers.js +23 -129
- package/lib/infrastructure/index.js +5 -6
- package/lib/infrastructure/orphan-infra-docker-teardown.js +11 -5
- package/lib/internal/fs-real-sync.js +29 -1
- package/lib/lifecycle/certification-progress.js +231 -0
- package/lib/lifecycle/dataplane-ui-url.js +145 -0
- package/lib/lifecycle/exit-codes.js +24 -0
- package/lib/lifecycle/json-envelope.js +25 -0
- package/lib/lifecycle/lifecycle-governance-options.js +51 -0
- package/lib/lifecycle/logger-quiet.js +29 -0
- package/lib/lifecycle/open-api-published.js +59 -0
- package/lib/lifecycle/operations-readiness-metrics.js +101 -0
- package/lib/lifecycle/product-model.js +196 -0
- package/lib/lifecycle/report-display.js +471 -0
- package/lib/lifecycle/scenario-upload.js +191 -0
- package/lib/lifecycle/verify-step-progress.js +87 -0
- package/lib/parameters/infra-kv-discovery.js +27 -2
- package/lib/protection/auth-context.js +51 -0
- package/lib/protection/convert-batch.js +90 -0
- package/lib/protection/load.js +41 -0
- package/lib/protection/paths.js +158 -0
- package/lib/protection/preflight-datasource-ready.js +46 -0
- package/lib/protection/protection-create-probe-lines.js +142 -0
- package/lib/protection/protection-create-probes.js +95 -0
- package/lib/protection/protection-create-scaffold.js +281 -0
- package/lib/protection/protection-display-helpers.js +445 -0
- package/lib/protection/protection-display.js +215 -0
- package/lib/protection/protection-preset-registry.js +97 -0
- package/lib/protection/report-exit.js +62 -0
- package/lib/protection/resolve.js +202 -0
- package/lib/protection/run-commands-validate.js +130 -0
- package/lib/protection/run-commands.js +216 -0
- package/lib/protection/run-protection-create-helpers.js +134 -0
- package/lib/protection/run-protection-create-probes-flow.js +43 -0
- package/lib/protection/run-protection-create.js +191 -0
- package/lib/protection/scope.js +22 -0
- package/lib/protection/sync-after-upload.js +64 -0
- package/lib/protection/upload-batch.js +127 -0
- package/lib/protection/validate-batch.js +113 -0
- package/lib/protection/validate-local.js +65 -0
- package/lib/resolvers/dimension-file.js +29 -4
- package/lib/schema/application-schema.json +1 -1
- package/lib/schema/datasource-test-run.schema.json +89 -6
- package/lib/schema/external-datasource.schema.json +2636 -2588
- package/lib/schema/external-system.schema.json +1089 -761
- package/lib/schema/flag-map-validation-run.json +2 -2
- package/lib/schema/infra.parameter.yaml +45 -0
- package/lib/schema/protection.schema.json +374 -0
- package/lib/schema/type/credential-field-registry.json +642 -0
- package/lib/schema/wizard-config.schema.json +1 -1
- package/lib/utils/agent-trust-run-display.js +231 -0
- package/lib/utils/agent-trust-run-exit.js +59 -0
- package/lib/utils/agent-trust-wait-ui.js +94 -0
- package/lib/utils/aifabrix-test-runtime-guard.js +125 -0
- package/lib/utils/api.js +55 -31
- package/lib/utils/app-relative-path-env.js +112 -0
- package/lib/utils/cli-exit-codes.js +30 -0
- package/lib/utils/cli-secrets-error-format.js +83 -21
- package/lib/utils/cli-sync-options.js +33 -0
- package/lib/utils/cli-utils.js +16 -4
- package/lib/utils/compose-generate-docker-compose.js +4 -0
- package/lib/utils/compose-traefik-ingress-base.js +16 -1
- package/lib/utils/config-secrets-path.js +46 -0
- package/lib/utils/controller-url.js +88 -1
- package/lib/utils/credential-push-ui.js +90 -0
- package/lib/utils/credential-secrets-env.js +137 -9
- package/lib/utils/dataplane-cli-version-gate.js +202 -0
- package/lib/utils/dataplane-cli-version-help.js +74 -0
- package/lib/utils/dataplane-resolver.js +129 -2
- package/lib/utils/datasource-export-display.js +137 -0
- package/lib/utils/datasource-load-display.js +174 -0
- package/lib/utils/datasource-load-export-ui.js +120 -0
- package/lib/utils/datasource-test-run-capability-scope.js +3 -3
- package/lib/utils/datasource-test-run-display.js +3 -3
- package/lib/utils/datasource-test-run-tty-log.js +5 -1
- package/lib/utils/declarative-url-ports.js +3 -3
- package/lib/utils/deployment-auth-mode.js +41 -0
- package/lib/utils/developer-volume-id.js +33 -0
- package/lib/utils/env-copy.js +14 -9
- package/lib/utils/env-kv-orphan-lines.js +43 -0
- package/lib/utils/error-formatters/network-errors.js +13 -4
- package/lib/utils/external-env-template.js +1 -0
- package/lib/utils/external-system-readiness-core.js +10 -0
- package/lib/utils/external-system-readiness-display.js +80 -23
- package/lib/utils/health-check.js +4 -1
- package/lib/utils/help-builder.js +35 -26
- package/lib/utils/keycloak-realm-ready.js +101 -0
- package/lib/utils/load-cip-capacity-display-config.js +61 -15
- package/lib/utils/manifest-source-emit.js +24 -0
- package/lib/utils/pipeline-upload-auth-retry.js +82 -0
- package/lib/utils/platform-controller-url.js +156 -0
- package/lib/utils/postgres-platform-bootstrap.js +199 -0
- package/lib/utils/postgres-wipe.js +9 -2
- package/lib/utils/resolve-env-mode.js +47 -0
- package/lib/utils/secrets-generator.js +31 -25
- package/lib/utils/secrets-missing-error.js +164 -0
- package/lib/utils/semver-compare.js +127 -0
- package/lib/utils/service-url-label.js +81 -0
- package/lib/utils/setup-quiet-output.js +25 -0
- package/lib/utils/template-helpers.js +15 -0
- package/lib/utils/token-manager-client-credentials.js +201 -0
- package/lib/utils/token-manager-messages.js +8 -0
- package/lib/utils/token-manager-refresh.js +12 -2
- package/lib/utils/token-manager.js +86 -105
- package/lib/utils/upload-pipeline-ui.js +98 -0
- package/lib/utils/upload-sync-options.js +42 -0
- package/lib/utils/url-declarative-public-base.js +21 -3
- package/lib/utils/url-declarative-vdir-inactive-env.js +14 -4
- package/lib/utils/validation-poll-ui.js +22 -7
- package/lib/utils/validation-run-stage.js +45 -0
- package/lib/validation/wizard-config-validator.js +58 -19
- package/package.json +1 -1
- package/templates/applications/dataplane/application.yaml +2 -1
- package/templates/applications/dataplane/env.template +36 -1
- package/templates/applications/dataplane/rbac.yaml +4 -0
- package/templates/applications/miso-controller/env.template +16 -0
- package/templates/external-system/README.md.hbs +116 -11
- package/templates/python/docker-compose.hbs +19 -18
- package/templates/typescript/docker-compose.hbs +18 -17
package/lib/api/wizard.api.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @version 2.0.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
const {
|
|
7
|
+
const { createDataplaneApiClient } = require('./index');
|
|
8
8
|
const { uploadFile } = require('../utils/file-upload');
|
|
9
9
|
const { getPlatformDetails, discoverEntities } = require('./wizard-platform.api');
|
|
10
10
|
|
|
@@ -22,7 +22,7 @@ const { getPlatformDetails, discoverEntities } = require('./wizard-platform.api'
|
|
|
22
22
|
* @throws {Error} If request fails
|
|
23
23
|
*/
|
|
24
24
|
async function createWizardSession(dataplaneUrl, authConfig, mode, systemIdOrKey = null) {
|
|
25
|
-
const client =
|
|
25
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
26
26
|
const body = { mode };
|
|
27
27
|
if (systemIdOrKey) {
|
|
28
28
|
body.systemIdOrKey = systemIdOrKey;
|
|
@@ -45,7 +45,7 @@ async function createWizardSession(dataplaneUrl, authConfig, mode, systemIdOrKey
|
|
|
45
45
|
* @throws {Error} If request fails
|
|
46
46
|
*/
|
|
47
47
|
async function getWizardSession(dataplaneUrl, sessionId, authConfig) {
|
|
48
|
-
const client =
|
|
48
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
49
49
|
return await client.get(`/api/v1/wizard/sessions/${sessionId}`);
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -75,7 +75,7 @@ async function getWizardSession(dataplaneUrl, sessionId, authConfig) {
|
|
|
75
75
|
* @throws {Error} If request fails
|
|
76
76
|
*/
|
|
77
77
|
async function updateWizardSession(dataplaneUrl, sessionId, authConfig, updateData) {
|
|
78
|
-
const client =
|
|
78
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
79
79
|
return await client.put(`/api/v1/wizard/sessions/${sessionId}`, {
|
|
80
80
|
body: updateData
|
|
81
81
|
});
|
|
@@ -94,7 +94,7 @@ async function updateWizardSession(dataplaneUrl, sessionId, authConfig, updateDa
|
|
|
94
94
|
* @throws {Error} If request fails
|
|
95
95
|
*/
|
|
96
96
|
async function deleteWizardSession(dataplaneUrl, sessionId, authConfig) {
|
|
97
|
-
const client =
|
|
97
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
98
98
|
return await client.delete(`/api/v1/wizard/sessions/${sessionId}`);
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -111,7 +111,7 @@ async function deleteWizardSession(dataplaneUrl, sessionId, authConfig) {
|
|
|
111
111
|
* @throws {Error} If request fails
|
|
112
112
|
*/
|
|
113
113
|
async function getWizardProgress(dataplaneUrl, sessionId, authConfig) {
|
|
114
|
-
const client =
|
|
114
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
115
115
|
return await client.get(`/api/v1/wizard/sessions/${sessionId}/progress`);
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -130,7 +130,7 @@ async function getWizardProgress(dataplaneUrl, sessionId, authConfig) {
|
|
|
130
130
|
*/
|
|
131
131
|
async function parseOpenApi(dataplaneUrl, authConfig, openApiFilePathOrUrl, isUrl = false) {
|
|
132
132
|
if (isUrl) {
|
|
133
|
-
const client =
|
|
133
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
134
134
|
return await client.post(`/api/v1/wizard/parse-openapi?url=${encodeURIComponent(openApiFilePathOrUrl)}`);
|
|
135
135
|
}
|
|
136
136
|
const url = `${dataplaneUrl.replace(/\/$/, '')}/api/v1/wizard/parse-openapi`;
|
|
@@ -153,7 +153,7 @@ async function parseOpenApi(dataplaneUrl, authConfig, openApiFilePathOrUrl, isUr
|
|
|
153
153
|
* @throws {Error} If request fails
|
|
154
154
|
*/
|
|
155
155
|
async function credentialSelection(dataplaneUrl, authConfig, selectionData) {
|
|
156
|
-
const client =
|
|
156
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
157
157
|
return await client.post('/api/v1/wizard/credential-selection', {
|
|
158
158
|
body: selectionData
|
|
159
159
|
});
|
|
@@ -172,7 +172,7 @@ async function credentialSelection(dataplaneUrl, authConfig, selectionData) {
|
|
|
172
172
|
* @throws {Error} If request fails
|
|
173
173
|
*/
|
|
174
174
|
async function detectType(dataplaneUrl, authConfig, openapiSpec) {
|
|
175
|
-
const client =
|
|
175
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
176
176
|
return await client.post('/api/v1/wizard/detect-type', {
|
|
177
177
|
body: { openapiSpec }
|
|
178
178
|
});
|
|
@@ -199,7 +199,7 @@ async function detectType(dataplaneUrl, authConfig, openapiSpec) {
|
|
|
199
199
|
* @throws {Error} If request fails
|
|
200
200
|
*/
|
|
201
201
|
async function getPlatformConfig(dataplaneUrl, authConfig, platformKey, config) {
|
|
202
|
-
const client =
|
|
202
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
203
203
|
return await client.post(`/api/v1/wizard/platforms/${encodeURIComponent(platformKey)}/config`, {
|
|
204
204
|
body: config
|
|
205
205
|
});
|
|
@@ -233,7 +233,7 @@ async function getPlatformConfig(dataplaneUrl, authConfig, platformKey, config)
|
|
|
233
233
|
* @throws {Error} If request fails
|
|
234
234
|
*/
|
|
235
235
|
async function generateConfig(dataplaneUrl, authConfig, config) {
|
|
236
|
-
const client =
|
|
236
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
237
237
|
return await client.post('/api/v1/wizard/generate-config', {
|
|
238
238
|
body: config
|
|
239
239
|
});
|
|
@@ -252,7 +252,7 @@ async function generateConfig(dataplaneUrl, authConfig, config) {
|
|
|
252
252
|
* @throws {Error} If request fails
|
|
253
253
|
*/
|
|
254
254
|
async function generateConfigStream(dataplaneUrl, authConfig, config) {
|
|
255
|
-
const client =
|
|
255
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
256
256
|
return await client.post('/api/v1/wizard/generate-config-stream', {
|
|
257
257
|
body: config
|
|
258
258
|
});
|
|
@@ -272,7 +272,7 @@ async function generateConfigStream(dataplaneUrl, authConfig, config) {
|
|
|
272
272
|
* @throws {Error} If request fails
|
|
273
273
|
*/
|
|
274
274
|
async function validateWizardConfig(dataplaneUrl, authConfig, systemConfig, datasourceConfig) {
|
|
275
|
-
const client =
|
|
275
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
276
276
|
return await client.post('/api/v1/wizard/validate', {
|
|
277
277
|
body: {
|
|
278
278
|
systemConfig,
|
|
@@ -294,7 +294,7 @@ async function validateWizardConfig(dataplaneUrl, authConfig, systemConfig, data
|
|
|
294
294
|
* @throws {Error} If request fails
|
|
295
295
|
*/
|
|
296
296
|
async function validateAllSteps(dataplaneUrl, sessionId, authConfig) {
|
|
297
|
-
const client =
|
|
297
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
298
298
|
return await client.get(`/api/v1/wizard/sessions/${sessionId}/validate`);
|
|
299
299
|
}
|
|
300
300
|
|
|
@@ -312,7 +312,7 @@ async function validateAllSteps(dataplaneUrl, sessionId, authConfig) {
|
|
|
312
312
|
* @throws {Error} If request fails
|
|
313
313
|
*/
|
|
314
314
|
async function validateStep(dataplaneUrl, sessionId, authConfig, stepNumber) {
|
|
315
|
-
const client =
|
|
315
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
316
316
|
return await client.post(`/api/v1/wizard/sessions/${sessionId}/validate-step?step=${stepNumber}`);
|
|
317
317
|
}
|
|
318
318
|
|
|
@@ -329,7 +329,7 @@ async function validateStep(dataplaneUrl, sessionId, authConfig, stepNumber) {
|
|
|
329
329
|
* @throws {Error} If request fails
|
|
330
330
|
*/
|
|
331
331
|
async function getPreview(dataplaneUrl, sessionId, authConfig) {
|
|
332
|
-
const client =
|
|
332
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
333
333
|
return await client.get(`/api/v1/wizard/preview/${sessionId}`);
|
|
334
334
|
}
|
|
335
335
|
|
|
@@ -347,7 +347,7 @@ async function getPreview(dataplaneUrl, sessionId, authConfig) {
|
|
|
347
347
|
* @throws {Error} If request fails
|
|
348
348
|
*/
|
|
349
349
|
async function testMcpConnection(dataplaneUrl, authConfig, serverUrl, token) {
|
|
350
|
-
const client =
|
|
350
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
351
351
|
return await client.post('/api/v1/wizard/test-mcp-connection', {
|
|
352
352
|
body: {
|
|
353
353
|
serverUrl,
|
|
@@ -369,7 +369,7 @@ async function testMcpConnection(dataplaneUrl, authConfig, serverUrl, token) {
|
|
|
369
369
|
* @throws {Error} If request fails
|
|
370
370
|
*/
|
|
371
371
|
async function getDeploymentDocs(dataplaneUrl, authConfig, systemKey) {
|
|
372
|
-
const client =
|
|
372
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
373
373
|
return await client.get(`/api/v1/wizard/deployment-docs/${systemKey}`);
|
|
374
374
|
}
|
|
375
375
|
|
|
@@ -390,7 +390,7 @@ async function getDeploymentDocs(dataplaneUrl, authConfig, systemKey) {
|
|
|
390
390
|
* @throws {Error} If request fails
|
|
391
391
|
*/
|
|
392
392
|
async function postDeploymentDocs(dataplaneUrl, authConfig, systemKey, body = null) {
|
|
393
|
-
const client =
|
|
393
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
394
394
|
return await client.post(`/api/v1/wizard/deployment-docs/${systemKey}`, {
|
|
395
395
|
body: body || {}
|
|
396
396
|
});
|
|
@@ -410,7 +410,7 @@ async function postDeploymentDocs(dataplaneUrl, authConfig, systemKey, body = nu
|
|
|
410
410
|
*/
|
|
411
411
|
async function getWizardPlatforms(dataplaneUrl, authConfig) {
|
|
412
412
|
try {
|
|
413
|
-
const client =
|
|
413
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
414
414
|
const response = await client.get('/api/v1/wizard/platforms');
|
|
415
415
|
const platforms = response?.data?.platforms ?? response?.platforms ?? [];
|
|
416
416
|
return Array.isArray(platforms) ? platforms : [];
|
|
@@ -433,7 +433,7 @@ async function getWizardPlatforms(dataplaneUrl, authConfig) {
|
|
|
433
433
|
* @throws {Error} If request fails
|
|
434
434
|
*/
|
|
435
435
|
async function listWizardCredentials(dataplaneUrl, authConfig, options = {}) {
|
|
436
|
-
const client =
|
|
436
|
+
const client = createDataplaneApiClient(dataplaneUrl, authConfig);
|
|
437
437
|
return await client.get('/api/v1/wizard/credentials', {
|
|
438
438
|
params: options
|
|
439
439
|
});
|
package/lib/app/deploy-config.js
CHANGED
|
@@ -60,7 +60,10 @@ async function extractDeploymentConfig(options, _variables) {
|
|
|
60
60
|
const { resolveEnvironment } = require('../core/config');
|
|
61
61
|
|
|
62
62
|
const controllerUrl = await resolveControllerUrl();
|
|
63
|
-
const envKey =
|
|
63
|
+
const envKey =
|
|
64
|
+
options && options.envKey
|
|
65
|
+
? String(options.envKey).trim().toLowerCase()
|
|
66
|
+
: await resolveEnvironment();
|
|
64
67
|
|
|
65
68
|
const pollIntervalExplicit =
|
|
66
69
|
options.pollInterval !== undefined && options.pollInterval !== null
|
package/lib/app/deploy.js
CHANGED
|
@@ -421,6 +421,35 @@ async function tryExternalDeployFallback(appName, options) {
|
|
|
421
421
|
return { usedExternalDeploy: false, result: null };
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
+
function assertDeployNotProtectionScope(appName) {
|
|
425
|
+
const { isProtectionScope } = require('../protection/scope');
|
|
426
|
+
if (!isProtectionScope(appName)) {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
const { formatDeployProtectionNotImplementedTTY } = require('../protection/protection-display');
|
|
430
|
+
logger.error(formatDeployProtectionNotImplementedTTY());
|
|
431
|
+
process.exit(1);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Run external, fallback, or standard deployment paths.
|
|
436
|
+
* @param {string} appName
|
|
437
|
+
* @param {Object} options
|
|
438
|
+
* @returns {Promise<{ result: Object, usedExternalDeploy: boolean, controllerUrl?: string }>}
|
|
439
|
+
*/
|
|
440
|
+
async function executeDeployPipeline(appName, options) {
|
|
441
|
+
const externalResult = await handleExternalDeployment(appName, options);
|
|
442
|
+
if (externalResult) {
|
|
443
|
+
return { result: externalResult, usedExternalDeploy: true };
|
|
444
|
+
}
|
|
445
|
+
const fallback = await tryExternalDeployFallback(appName, options);
|
|
446
|
+
if (fallback.result) {
|
|
447
|
+
return { result: fallback.result, usedExternalDeploy: fallback.usedExternalDeploy };
|
|
448
|
+
}
|
|
449
|
+
const { result, controllerUrl } = await executeStandardDeployment(appName, options);
|
|
450
|
+
return { result, usedExternalDeploy: false, controllerUrl };
|
|
451
|
+
}
|
|
452
|
+
|
|
424
453
|
/**
|
|
425
454
|
* Deploys application to Miso Controller
|
|
426
455
|
* Orchestrates manifest generation, key creation, and deployment
|
|
@@ -446,26 +475,12 @@ async function deployApp(appName, options = {}) {
|
|
|
446
475
|
let usedExternalDeploy = false;
|
|
447
476
|
|
|
448
477
|
try {
|
|
449
|
-
|
|
450
|
-
throw new Error('App name is required');
|
|
451
|
-
}
|
|
478
|
+
assertDeployNotProtectionScope(appName);
|
|
452
479
|
validateAppName(appName);
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
return { result: externalResult, usedExternalDeploy: true };
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
const fallback = await tryExternalDeployFallback(appName, options);
|
|
461
|
-
if (fallback.result) {
|
|
462
|
-
usedExternalDeploy = fallback.usedExternalDeploy;
|
|
463
|
-
return { result: fallback.result, usedExternalDeploy };
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
const { result, controllerUrl: url } = await executeStandardDeployment(appName, options);
|
|
467
|
-
controllerUrl = url;
|
|
468
|
-
return { result, usedExternalDeploy: false };
|
|
480
|
+
const pipeline = await executeDeployPipeline(appName, options);
|
|
481
|
+
controllerUrl = pipeline.controllerUrl ?? null;
|
|
482
|
+
usedExternalDeploy = pipeline.usedExternalDeploy;
|
|
483
|
+
return { result: pipeline.result, usedExternalDeploy };
|
|
469
484
|
} catch (error) {
|
|
470
485
|
await handleDeploymentError(error, appName, controllerUrl, usedExternalDeploy);
|
|
471
486
|
}
|
package/lib/app/down.js
CHANGED
|
@@ -48,6 +48,8 @@ function execAsync(command, options = {}) {
|
|
|
48
48
|
* @param {number|string} developerId - Developer ID
|
|
49
49
|
* @returns {string} Docker volume name
|
|
50
50
|
*/
|
|
51
|
+
const { collectDeveloperVolumeIdSuffixes } = require('../utils/developer-volume-id');
|
|
52
|
+
|
|
51
53
|
function getAppVolumeName(appName, developerId) {
|
|
52
54
|
const idNum = typeof developerId === 'string' ? parseInt(developerId, 10) : developerId;
|
|
53
55
|
if (idNum === 0) {
|
|
@@ -56,6 +58,22 @@ function getAppVolumeName(appName, developerId) {
|
|
|
56
58
|
return `aifabrix_dev${developerId}_${appName}_data`;
|
|
57
59
|
}
|
|
58
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Docker volume name candidates for an app (handles dev6 vs dev06 naming drift).
|
|
63
|
+
*
|
|
64
|
+
* @param {string} appName
|
|
65
|
+
* @param {string|number} developerId
|
|
66
|
+
* @returns {string[]}
|
|
67
|
+
*/
|
|
68
|
+
function getAppVolumeNameCandidates(appName, developerId) {
|
|
69
|
+
const idNum = typeof developerId === 'string' ? parseInt(developerId, 10) : developerId;
|
|
70
|
+
if (idNum === 0) {
|
|
71
|
+
return [`aifabrix_${appName}_data`, `aifabrix_dev0_${appName}_data`];
|
|
72
|
+
}
|
|
73
|
+
const suffixes = collectDeveloperVolumeIdSuffixes(developerId);
|
|
74
|
+
return suffixes.map((suffix) => `aifabrix_dev${suffix}_${appName}_data`);
|
|
75
|
+
}
|
|
76
|
+
|
|
59
77
|
/**
|
|
60
78
|
* Stops and removes a specific application's container.
|
|
61
79
|
* If --volumes is passed, attempts to remove the app's named Docker volume.
|
|
@@ -120,6 +138,7 @@ async function downApp(appName, options = {}) {
|
|
|
120
138
|
|
|
121
139
|
module.exports = {
|
|
122
140
|
downApp,
|
|
123
|
-
getAppVolumeName
|
|
141
|
+
getAppVolumeName,
|
|
142
|
+
getAppVolumeNameCandidates
|
|
124
143
|
};
|
|
125
144
|
|
package/lib/app/push.js
CHANGED
|
@@ -19,7 +19,7 @@ const {
|
|
|
19
19
|
|
|
20
20
|
const pushUtils = require('../deployment/push');
|
|
21
21
|
const logger = require('../utils/logger');
|
|
22
|
-
const
|
|
22
|
+
const paths = require('../utils/paths');
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Validate application name format
|
|
@@ -92,11 +92,10 @@ function extractImageName(config, appName) {
|
|
|
92
92
|
* @throws {Error} If configuration cannot be loaded
|
|
93
93
|
*/
|
|
94
94
|
async function loadPushConfig(appName, options) {
|
|
95
|
-
const { detectAppType, resolveApplicationConfigPath } = require('../utils/paths');
|
|
96
95
|
const { loadConfigFile } = require('../utils/config-format');
|
|
97
|
-
const { appPath } = await detectAppType(appName);
|
|
98
96
|
try {
|
|
99
|
-
const
|
|
97
|
+
const { appPath } = await paths.detectAppType(appName);
|
|
98
|
+
const configPath = paths.resolveApplicationConfigPath(appPath);
|
|
100
99
|
const config = loadConfigFile(configPath);
|
|
101
100
|
const effective = getEffectiveConfig(config);
|
|
102
101
|
const registry = options.registry || effective.image?.registry;
|
|
@@ -242,7 +241,7 @@ function displayPushResults(registry, imageName, tags) {
|
|
|
242
241
|
*/
|
|
243
242
|
async function pushApp(appName, options = {}) {
|
|
244
243
|
try {
|
|
245
|
-
const { isExternal } = await detectAppType(appName);
|
|
244
|
+
const { isExternal } = await paths.detectAppType(appName);
|
|
246
245
|
if (isExternal) {
|
|
247
246
|
logExternalIntegrationPushNotice(appName);
|
|
248
247
|
return;
|
package/lib/app/register.js
CHANGED
|
@@ -25,6 +25,8 @@ const { callRegisterApi } = require('../utils/app-register-api');
|
|
|
25
25
|
const { displayRegistrationResults, getEnvironmentPrefix } = require('../utils/app-register-display');
|
|
26
26
|
const pathsUtil = require('../utils/paths');
|
|
27
27
|
const { refreshUrlsLocalRegistryFromBuilder } = require('../utils/urls-local-registry');
|
|
28
|
+
const { resolveControllerUrl } = require('../utils/controller-url');
|
|
29
|
+
const config = require('../core/config');
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
32
|
* Build registration data payload from app configuration
|
|
@@ -152,9 +154,6 @@ async function applyLocalhostPortAdjustment(appConfig, apiUrl, options) {
|
|
|
152
154
|
*/
|
|
153
155
|
async function registerApplication(appKey, options = {}) {
|
|
154
156
|
logger.log(chalk.blue('📋 Registering application...\n'));
|
|
155
|
-
|
|
156
|
-
const { resolveControllerUrl } = require('../utils/controller-url');
|
|
157
|
-
const config = require('../core/config');
|
|
158
157
|
await config.ensureSecretsEncryptionKey();
|
|
159
158
|
const { resolveEnvironment } = config;
|
|
160
159
|
|
|
@@ -168,7 +167,11 @@ async function registerApplication(appKey, options = {}) {
|
|
|
168
167
|
const appConfig = await extractAppConfiguration(finalVariables, appKey, options);
|
|
169
168
|
await validateAppRegistrationData(appConfig, appKey);
|
|
170
169
|
|
|
171
|
-
const
|
|
170
|
+
const controllerUrl = await resolveControllerUrl();
|
|
171
|
+
const environmentKey =
|
|
172
|
+
options && options.envKey
|
|
173
|
+
? String(options.envKey).trim().toLowerCase()
|
|
174
|
+
: await resolveEnvironment();
|
|
172
175
|
const authConfig = await checkAuthentication(controllerUrl, environmentKey);
|
|
173
176
|
const environment = registerApplicationSchema.environmentId(environmentKey);
|
|
174
177
|
|
|
@@ -14,9 +14,28 @@ const fs = require('fs').promises;
|
|
|
14
14
|
const fsSync = require('fs');
|
|
15
15
|
const pathsUtil = require('../utils/paths');
|
|
16
16
|
const adminSecrets = require('../core/admin-secrets');
|
|
17
|
+
const config = require('../core/config');
|
|
17
18
|
const secretsEnsure = require('../core/secrets-ensure');
|
|
18
19
|
const secretsEnvWrite = require('../core/secrets-env-write');
|
|
19
20
|
const { getContainerPort } = require('../utils/port-resolver');
|
|
21
|
+
const { applyAdminSecretsPlatformOverlay } = require('../core/admin-secrets-env-overlay');
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Merge app env with admin-secrets; overlay ensures platform keys come from admin file.
|
|
25
|
+
* @param {Object.<string, string>} merged
|
|
26
|
+
* @param {Object.<string, string>} adminObj
|
|
27
|
+
*/
|
|
28
|
+
function mergeRunEnvWithAdminOverlay(merged, adminObj) {
|
|
29
|
+
applyAdminSecretsPlatformOverlay(merged, adminObj);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function applyOnboardingPlatformModeIfNeeded(appName, merged) {
|
|
33
|
+
if (appName !== 'miso-controller') {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const mode = await config.getSetupPlatformMode();
|
|
37
|
+
merged.ONBOARDING_FULL_PLATFORM = mode === 'full' ? 'true' : 'false';
|
|
38
|
+
}
|
|
20
39
|
|
|
21
40
|
/**
|
|
22
41
|
* Backfill only secrets needed for `aifabrix run <app>`: kv:// keys from that app's env.template
|
|
@@ -194,31 +213,72 @@ async function readPasswordFromPgpassFile(pgpassPath) {
|
|
|
194
213
|
}
|
|
195
214
|
|
|
196
215
|
/**
|
|
197
|
-
* Read POSTGRES_PASSWORD from
|
|
198
|
-
*
|
|
199
|
-
*
|
|
216
|
+
* Read POSTGRES_PASSWORD from pgpass-style files beside the active infra compose
|
|
217
|
+
* (`resolveInfraStatePaths()`). Tries legacy `pgpass`, then `.pgpass.bootstrap` written at `up-infra`
|
|
218
|
+
* so db-init matches the password Postgres was started with when admin-secrets later drifted.
|
|
200
219
|
* @param {number|string} developerId - Developer ID
|
|
201
220
|
* @returns {Promise<string|undefined>} Password or undefined
|
|
202
221
|
*/
|
|
203
222
|
async function readPostgresPasswordFromPgpass(developerId) {
|
|
204
|
-
const { resolveInfraStatePaths } = require('../infrastructure/helpers');
|
|
223
|
+
const { resolveInfraStatePaths, PGPASS_BOOTSTRAP_BASENAME } = require('../infrastructure/helpers');
|
|
205
224
|
const { infraDir } = resolveInfraStatePaths(developerId);
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
225
|
+
const candidates = ['pgpass', PGPASS_BOOTSTRAP_BASENAME];
|
|
226
|
+
for (const name of candidates) {
|
|
227
|
+
const pgpassPath = path.join(infraDir, name);
|
|
228
|
+
if (!fsSync.existsSync(pgpassPath)) {
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
try {
|
|
232
|
+
const pwd = await readPasswordFromPgpassFile(pgpassPath);
|
|
233
|
+
if (pwd !== undefined && pwd !== '') {
|
|
234
|
+
return pwd;
|
|
235
|
+
}
|
|
236
|
+
} catch {
|
|
237
|
+
// try next candidate
|
|
238
|
+
}
|
|
215
239
|
}
|
|
240
|
+
return undefined;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* @returns {Function}
|
|
245
|
+
*/
|
|
246
|
+
function resolveEnsureAdminSecretsFn() {
|
|
247
|
+
const infra = require('../infrastructure');
|
|
248
|
+
return typeof infra.ensureAdminSecrets === 'function'
|
|
249
|
+
? infra.ensureAdminSecrets
|
|
250
|
+
: require('../infrastructure/helpers').ensureAdminSecrets;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* @param {Object} merged
|
|
255
|
+
* @param {number|string|undefined} developerId
|
|
256
|
+
* @returns {Promise<void>}
|
|
257
|
+
*/
|
|
258
|
+
async function applyPostgresPasswordFromPgpass(merged, developerId) {
|
|
259
|
+
if (developerId === undefined) return;
|
|
260
|
+
const pgpassPwd = await readPostgresPasswordFromPgpass(developerId);
|
|
261
|
+
if (pgpassPwd !== undefined) merged.POSTGRES_PASSWORD = pgpassPwd;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* @param {string} runEnvPath
|
|
266
|
+
* @param {string} runEnvAdminPath
|
|
267
|
+
* @param {Object} appOnly
|
|
268
|
+
* @param {Object} dbInitOnly
|
|
269
|
+
* @returns {Promise<void>}
|
|
270
|
+
*/
|
|
271
|
+
async function writeRunEnvFiles(runEnvPath, runEnvAdminPath, appOnly, dbInitOnly) {
|
|
272
|
+
const toContent = adminSecrets.envObjectToContent;
|
|
273
|
+
await fs.writeFile(runEnvPath, toContent(appOnly), { mode: 0o600 });
|
|
274
|
+
await fs.writeFile(runEnvAdminPath, toContent(dbInitOnly), { mode: 0o600 });
|
|
216
275
|
}
|
|
217
276
|
|
|
218
277
|
/**
|
|
219
278
|
* Build two run env files: .env.run (app-only, no admin secrets) and .env.run.admin (start-only, for db-init).
|
|
220
279
|
* Admin password is never set in the app container; .env.run.admin is used only for start and then deleted.
|
|
221
|
-
* When `pgpass` exists beside the active infra compose, POSTGRES_PASSWORD is taken
|
|
280
|
+
* When `pgpass` or `.pgpass.bootstrap` exists beside the active infra compose, POSTGRES_PASSWORD is taken
|
|
281
|
+
* from it so db-init matches Postgres.
|
|
222
282
|
* @async
|
|
223
283
|
* @param {string} appName - Application name
|
|
224
284
|
* @param {Object} appConfig - Application configuration
|
|
@@ -227,12 +287,8 @@ async function readPostgresPasswordFromPgpass(developerId) {
|
|
|
227
287
|
* @returns {Promise<{ runEnvPath: string, runEnvAdminPath: string }>} Paths to .env.run and .env.run.admin
|
|
228
288
|
*/
|
|
229
289
|
async function buildMergedRunEnvAndWrite(appName, appConfig, devDir, developerId, scopeOpts = null) {
|
|
230
|
-
const infra = require('../infrastructure');
|
|
231
|
-
const ensureAdminSecretsFn = typeof infra.ensureAdminSecrets === 'function'
|
|
232
|
-
? infra.ensureAdminSecrets
|
|
233
|
-
: require('../infrastructure/helpers').ensureAdminSecrets;
|
|
234
290
|
await ensureRunSecretsForApp(appName);
|
|
235
|
-
await
|
|
291
|
+
await resolveEnsureAdminSecretsFn()();
|
|
236
292
|
const adminObj = await adminSecrets.readAndDecryptAdminSecrets();
|
|
237
293
|
const runEnvKey = scopeOpts && scopeOpts.runEnvKey ? String(scopeOpts.runEnvKey).toLowerCase() : 'dev';
|
|
238
294
|
const appObj = await secretsEnvWrite.resolveAndGetEnvMap(appName, {
|
|
@@ -242,22 +298,20 @@ async function buildMergedRunEnvAndWrite(appName, appConfig, devDir, developerId
|
|
|
242
298
|
runEnvKey
|
|
243
299
|
});
|
|
244
300
|
const merged = { ...adminObj, ...appObj };
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
301
|
+
mergeRunEnvWithAdminOverlay(merged, adminObj);
|
|
302
|
+
await applyOnboardingPlatformModeIfNeeded(appName, merged);
|
|
303
|
+
await applyPostgresPasswordFromPgpass(merged, developerId);
|
|
249
304
|
injectDatabaseNamesAndUsers(merged, appConfig, scopeOpts);
|
|
250
305
|
injectContainerPortForRun(merged, appConfig, appName);
|
|
251
306
|
|
|
252
307
|
const runEnvPath = path.join(devDir, '.env.run');
|
|
253
308
|
const runEnvAdminPath = path.join(devDir, '.env.run.admin');
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
309
|
+
await writeRunEnvFiles(
|
|
310
|
+
runEnvPath,
|
|
311
|
+
runEnvAdminPath,
|
|
312
|
+
buildAppOnlyEnv(merged),
|
|
313
|
+
buildDbInitOnlyEnv(merged)
|
|
314
|
+
);
|
|
261
315
|
return { runEnvPath, runEnvAdminPath };
|
|
262
316
|
}
|
|
263
317
|
|
package/lib/build/index.js
CHANGED
|
@@ -401,6 +401,11 @@ async function resolveDockerBuildArgsForApp(appName) {
|
|
|
401
401
|
for (const [k, v] of Object.entries(bashOverlay)) {
|
|
402
402
|
if (v && buildArgs[k] === undefined) buildArgs[k] = v;
|
|
403
403
|
}
|
|
404
|
+
// Exported shell tokens win (local dev: export NPM_TOKEN=... before af build / docker build).
|
|
405
|
+
const shellNpm = typeof process.env.NPM_TOKEN === 'string' ? process.env.NPM_TOKEN.trim() : '';
|
|
406
|
+
const shellPypi = typeof process.env.PYPI_TOKEN === 'string' ? process.env.PYPI_TOKEN.trim() : '';
|
|
407
|
+
if (shellNpm) buildArgs.NPM_TOKEN = shellNpm;
|
|
408
|
+
if (shellPypi) buildArgs.PYPI_TOKEN = shellPypi;
|
|
404
409
|
return buildArgs;
|
|
405
410
|
}
|
|
406
411
|
|
|
@@ -211,7 +211,8 @@ async function maybeSyncSystemCertificationFromDataplane(params) {
|
|
|
211
211
|
authConfig,
|
|
212
212
|
datasourceKeys,
|
|
213
213
|
issuanceFailureHint,
|
|
214
|
-
verboseCertHints
|
|
214
|
+
verboseCertHints,
|
|
215
|
+
silent
|
|
215
216
|
} = params;
|
|
216
217
|
if (noCertSync === true) return;
|
|
217
218
|
try {
|
|
@@ -224,14 +225,20 @@ async function maybeSyncSystemCertificationFromDataplane(params) {
|
|
|
224
225
|
verboseCertHints
|
|
225
226
|
});
|
|
226
227
|
if (r.written) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
if (silent !== true) {
|
|
229
|
+
logger.log(
|
|
230
|
+
chalk.gray(`Updated certification block from dataplane${label ? ` (${label})` : ''} in system file.`)
|
|
231
|
+
);
|
|
232
|
+
}
|
|
230
233
|
} else if (r.reason) {
|
|
231
|
-
|
|
234
|
+
if (silent !== true) {
|
|
235
|
+
logCertificationSyncNotWritten(r, label, verboseCertHints === true);
|
|
236
|
+
}
|
|
232
237
|
}
|
|
233
238
|
} catch (e) {
|
|
234
|
-
|
|
239
|
+
if (silent !== true) {
|
|
240
|
+
logger.log(chalk.yellow(`⚠ Certification sync skipped: ${e.message}`));
|
|
241
|
+
}
|
|
235
242
|
}
|
|
236
243
|
}
|
|
237
244
|
|
package/lib/cli/index.js
CHANGED
|
@@ -22,10 +22,13 @@ const { setupExternalSystemCommands } = require('./setup-external-system');
|
|
|
22
22
|
const { setupAppCommands: setupAppManagementCommands } = require('../commands/app');
|
|
23
23
|
const { setupDatasourceCommands } = require('../commands/datasource');
|
|
24
24
|
const { setupDimensionCommands } = require('../commands/dimension');
|
|
25
|
-
const {
|
|
25
|
+
const { setupIdentityCommands } = require('../commands/identity');
|
|
26
|
+
const { setupProtectionCommands } = require('../commands/protection');
|
|
26
27
|
const { setupCredentialDeploymentCommands } = require('./setup-credential-deployment');
|
|
27
28
|
const { setupIntegrationClientCommands } = require('./setup-integration-client');
|
|
28
29
|
const { setupPlatformCommands } = require('./setup-platform');
|
|
30
|
+
const { setupCertificationCommands } = require('./setup-certification-commands');
|
|
31
|
+
const { setupGovernanceCommands } = require('../commands/governance');
|
|
29
32
|
|
|
30
33
|
/**
|
|
31
34
|
* Sets up all CLI commands on the Commander program instance
|
|
@@ -35,11 +38,14 @@ function setupCommands(program) {
|
|
|
35
38
|
setupInfraCommands(program);
|
|
36
39
|
setupAuthCommands(program);
|
|
37
40
|
setupAppCommands(program);
|
|
41
|
+
setupCertificationCommands(program);
|
|
42
|
+
setupGovernanceCommands(program);
|
|
38
43
|
setupEnvironmentCommands(program);
|
|
39
44
|
setupAppManagementCommands(program);
|
|
40
45
|
setupDatasourceCommands(program);
|
|
41
46
|
setupDimensionCommands(program);
|
|
42
|
-
|
|
47
|
+
setupIdentityCommands(program);
|
|
48
|
+
setupProtectionCommands(program);
|
|
43
49
|
setupUtilityCommands(program);
|
|
44
50
|
setupCredentialDeploymentCommands(program);
|
|
45
51
|
setupIntegrationClientCommands(program);
|