@aifabrix/builder 2.44.5 → 2.45.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 +8 -4
- package/.cursor/rules/project-rules.mdc +1 -1
- package/README.md +15 -23
- package/integration/hubspot-test/README.md +2 -0
- package/integration/hubspot-test/test.js +5 -3
- package/jest.projects.js +104 -2
- package/lib/api/controller-health.api.js +49 -0
- package/lib/api/dimension-values.api.js +82 -0
- package/lib/api/dimensions.api.js +114 -0
- package/lib/api/external-systems.api.js +1 -0
- package/lib/api/integration-clients.api.js +168 -0
- package/lib/api/types/dimension-values.types.js +28 -0
- package/lib/api/types/dimensions.types.js +31 -0
- package/lib/api/types/integration-clients.types.js +45 -0
- package/lib/api/validation-runner.js +46 -25
- package/lib/app/deploy-config.js +11 -1
- package/lib/app/deploy-status-display.js +3 -3
- package/lib/app/deploy.js +36 -14
- package/lib/app/display.js +15 -11
- package/lib/app/helpers.js +3 -3
- package/lib/app/index.js +3 -3
- package/lib/app/push.js +46 -23
- package/lib/app/register.js +7 -6
- package/lib/app/restart-display.js +126 -0
- package/lib/app/rotate-secret.js +7 -6
- package/lib/app/run-container-start.js +12 -6
- package/lib/app/run-env-compose.js +30 -1
- package/lib/app/run-helpers.js +58 -19
- package/lib/app/run-reload-sync.js +148 -0
- package/lib/app/run-resolve-image.js +51 -1
- package/lib/app/run.js +148 -74
- package/lib/app/show-display.js +7 -0
- package/lib/app/show.js +87 -5
- package/lib/build/index.js +83 -49
- package/lib/cli/doctor-check.js +117 -0
- package/lib/cli/index.js +8 -2
- package/lib/cli/infra-guided.js +460 -0
- package/lib/cli/installation-log-command.js +73 -0
- package/lib/cli/setup-app.js +31 -3
- package/lib/cli/setup-auth.js +98 -27
- package/lib/cli/setup-dev-path-commands.js +50 -3
- package/lib/cli/setup-infra-up-dataplane-action.js +111 -0
- package/lib/cli/setup-infra-up-platform-action.js +131 -0
- package/lib/cli/setup-infra.js +132 -118
- package/lib/cli/setup-integration-client.js +182 -0
- package/lib/cli/setup-parameters.js +21 -2
- package/lib/cli/setup-platform.js +102 -0
- package/lib/cli/setup-secrets.js +18 -6
- package/lib/cli/setup-utility-resolve.js +132 -0
- package/lib/cli/setup-utility.js +143 -84
- package/lib/commands/app-logs.js +81 -33
- package/lib/commands/auth-config.js +116 -18
- package/lib/commands/datasource-capability-dimension-cli.js +128 -0
- package/lib/commands/datasource-capability-output.js +29 -0
- package/lib/commands/datasource-capability-relate-cli.js +140 -0
- package/lib/commands/datasource-capability.js +411 -0
- package/lib/commands/datasource-unified-test-cli.options.js +1 -1
- package/lib/commands/datasource.js +53 -13
- package/lib/commands/dev-down.js +3 -3
- package/lib/commands/dev-infra-gate.js +32 -0
- package/lib/commands/dev-init.js +13 -7
- package/lib/commands/dimension-value.js +179 -0
- package/lib/commands/dimension.js +330 -0
- package/lib/commands/integration-client.js +430 -0
- package/lib/commands/login-device.js +65 -30
- package/lib/commands/login.js +21 -10
- package/lib/commands/parameters-validate.js +78 -13
- package/lib/commands/repair-datasource-auto-rbac.js +166 -0
- package/lib/commands/repair-datasource-keys.js +10 -5
- package/lib/commands/repair-datasource.js +19 -7
- package/lib/commands/repair-env-template.js +4 -1
- package/lib/commands/repair-openapi-sync.js +172 -0
- package/lib/commands/repair-persist.js +102 -0
- package/lib/commands/repair-rbac-extract.js +27 -0
- package/lib/commands/repair-rbac-migrate.js +186 -0
- package/lib/commands/repair-rbac.js +214 -31
- package/lib/commands/repair-system-alignment.js +246 -0
- package/lib/commands/repair-system-permissions.js +168 -0
- package/lib/commands/repair.js +120 -338
- package/lib/commands/secure.js +1 -1
- package/lib/commands/setup-modes.js +468 -0
- package/lib/commands/setup-prompts.js +421 -0
- package/lib/commands/setup.js +254 -0
- package/lib/commands/teardown.js +277 -0
- package/lib/commands/up-common.js +113 -19
- package/lib/commands/up-dataplane.js +44 -19
- package/lib/commands/up-miso.js +18 -18
- package/lib/commands/upload.js +111 -23
- package/lib/commands/wizard-core-helpers.js +14 -11
- package/lib/commands/wizard-core.js +6 -5
- package/lib/commands/wizard-dataplane.js +2 -2
- package/lib/commands/wizard-entity-selection.js +4 -3
- package/lib/commands/wizard-headless.js +2 -1
- package/lib/commands/wizard.js +2 -1
- package/lib/constants/infra-compose-service-names.js +40 -0
- package/lib/core/audit-logger.js +1 -34
- package/lib/core/config-admin-email.js +56 -0
- package/lib/core/config-normalize.js +60 -0
- package/lib/core/config-registered-controller-urls.js +54 -0
- package/lib/core/config.js +33 -50
- package/lib/core/env-reader.js +16 -3
- package/lib/core/secrets-admin-env.js +101 -0
- package/lib/core/secrets-ensure-infra.js +34 -1
- package/lib/core/secrets-ensure.js +88 -66
- package/lib/core/secrets-env-content.js +428 -0
- package/lib/core/secrets-env-declarative-expand.js +170 -0
- package/lib/core/secrets-env-write.js +29 -1
- package/lib/core/secrets-load.js +252 -0
- package/lib/core/secrets-names.js +32 -0
- package/lib/core/secrets.js +17 -757
- package/lib/datasource/capability/basic-exposure.js +76 -0
- package/lib/datasource/capability/capability-diff-slice.js +41 -0
- package/lib/datasource/capability/capability-key.js +34 -0
- package/lib/datasource/capability/capability-resolve.js +172 -0
- package/lib/datasource/capability/capability-storage-keys.js +22 -0
- package/lib/datasource/capability/copy-operations.js +348 -0
- package/lib/datasource/capability/copy-test-payload.js +139 -0
- package/lib/datasource/capability/create-operations.js +235 -0
- package/lib/datasource/capability/dimension-operations.js +151 -0
- package/lib/datasource/capability/dimension-validate.js +219 -0
- package/lib/datasource/capability/json-pointer.js +31 -0
- package/lib/datasource/capability/reference-rewrite.js +51 -0
- package/lib/datasource/capability/relate-operations.js +325 -0
- package/lib/datasource/capability/relate-validate.js +219 -0
- package/lib/datasource/capability/remove-operations.js +275 -0
- package/lib/datasource/capability/run-capability-copy.js +152 -0
- package/lib/datasource/capability/run-capability-diff.js +135 -0
- package/lib/datasource/capability/run-capability-dimension.js +291 -0
- package/lib/datasource/capability/run-capability-edit.js +377 -0
- package/lib/datasource/capability/run-capability-relate.js +193 -0
- package/lib/datasource/capability/run-capability-remove.js +105 -0
- package/lib/datasource/capability/templates/minimal-fetch.json +18 -0
- package/lib/datasource/capability/validate-capability-slice.js +35 -0
- package/lib/datasource/list.js +136 -23
- package/lib/datasource/log-viewer.js +2 -4
- package/lib/datasource/unified-validation-run.js +51 -16
- package/lib/datasource/validate.js +53 -1
- package/lib/deployment/deploy-poll-ui.js +60 -0
- package/lib/deployment/deployer-status.js +29 -3
- package/lib/deployment/deployer.js +48 -30
- package/lib/deployment/environment.js +7 -2
- package/lib/deployment/poll-interval.js +72 -0
- package/lib/deployment/push.js +11 -9
- package/lib/external-system/deploy.js +9 -2
- package/lib/external-system/download.js +61 -32
- package/lib/external-system/sync-deploy-manifest.js +33 -0
- package/lib/infrastructure/index.js +49 -19
- package/lib/infrastructure/orphan-infra-docker-teardown.js +177 -0
- package/lib/internal/node-fs.js +2 -0
- package/lib/parameters/infra-kv-discovery.js +29 -4
- package/lib/parameters/infra-parameter-catalog.js +6 -3
- package/lib/parameters/infra-parameter-validate.js +67 -19
- package/lib/resolvers/datasource-resolver.js +53 -0
- package/lib/resolvers/dimension-file.js +52 -0
- package/lib/resolvers/manifest-resolver.js +133 -0
- package/lib/schema/application-schema.json +4 -0
- package/lib/schema/external-datasource.schema.json +183 -53
- package/lib/schema/external-system.schema.json +23 -10
- package/lib/schema/infra.parameter.yaml +26 -1
- package/lib/schema/wizard-config.schema.json +1 -1
- package/lib/utils/aifabrix-config-dir-walk.js +40 -0
- package/lib/utils/aifabrix-runtime-config-dir.js +26 -3
- package/lib/utils/app-config-resolver.js +24 -1
- package/lib/utils/app-run-containers.js +2 -2
- package/lib/utils/applications-config-defaults.js +206 -0
- package/lib/utils/auth-config-validator.js +2 -12
- package/lib/utils/bash-secret-env.js +59 -0
- package/lib/utils/cli-secrets-error-format.js +78 -0
- package/lib/utils/cli-test-layout-chalk.js +31 -9
- package/lib/utils/cli-utils.js +4 -36
- package/lib/utils/compose-generate-docker-compose.js +111 -6
- package/lib/utils/compose-generator.js +17 -8
- package/lib/utils/controller-url.js +50 -7
- package/lib/utils/datasource-test-run-display.js +8 -0
- package/lib/utils/dev-hosts-helper.js +3 -2
- package/lib/utils/dev-init-ssh-merge.js +2 -1
- package/lib/utils/docker-build.js +17 -9
- package/lib/utils/docker-reload-mount.js +127 -0
- package/lib/utils/env-copy.js +99 -14
- package/lib/utils/env-template.js +5 -1
- package/lib/utils/external-readme.js +71 -2
- package/lib/utils/external-system-local-test-tty.js +3 -2
- package/lib/utils/external-system-readiness-core.js +45 -12
- package/lib/utils/external-system-readiness-deploy-display.js +3 -3
- package/lib/utils/external-system-readiness-display-internals.js +33 -3
- package/lib/utils/external-system-readiness-display.js +10 -1
- package/lib/utils/file-upload.js +40 -3
- package/lib/utils/health-check-db-init.js +107 -0
- package/lib/utils/health-check-public-warn.js +69 -0
- package/lib/utils/health-check-url.js +28 -10
- package/lib/utils/health-check.js +139 -107
- package/lib/utils/help-builder.js +5 -1
- package/lib/utils/image-name.js +34 -7
- package/lib/utils/infra-optional-service-flags.js +69 -0
- package/lib/utils/installation-log-core.js +282 -0
- package/lib/utils/installation-log-record.js +237 -0
- package/lib/utils/installation-log.js +123 -0
- package/lib/utils/integration-file-backup.js +74 -0
- package/lib/utils/log-redaction.js +105 -0
- package/lib/utils/manifest-location.js +164 -0
- package/lib/utils/manifest-source-emit.js +162 -0
- package/lib/utils/mutagen-install.js +30 -3
- package/lib/utils/paths.js +308 -76
- package/lib/utils/postgres-wipe.js +212 -0
- package/lib/utils/register-aifabrix-shell-env.js +15 -0
- package/lib/utils/remote-dev-auth.js +21 -5
- package/lib/utils/remote-docker-env.js +9 -1
- package/lib/utils/remote-secrets-loader.js +49 -4
- package/lib/utils/resolve-docker-image-ref.js +9 -3
- package/lib/utils/run-cli-flags.js +29 -0
- package/lib/utils/secrets-ancestor-paths.js +47 -0
- package/lib/utils/secrets-canonical.js +10 -3
- package/lib/utils/secrets-helpers.js +17 -10
- package/lib/utils/secrets-kv-refs.js +42 -0
- package/lib/utils/secrets-kv-scope.js +19 -2
- package/lib/utils/secrets-materialize-local.js +134 -0
- package/lib/utils/secrets-path.js +26 -13
- package/lib/utils/secrets-utils.js +20 -10
- package/lib/utils/system-builder-root.js +42 -0
- package/lib/utils/url-declarative-public-base.js +80 -12
- package/lib/utils/url-declarative-resolve-build-urls.js +238 -0
- package/lib/utils/url-declarative-resolve-build.js +24 -388
- package/lib/utils/url-declarative-resolve-expand-token.js +189 -0
- package/lib/utils/url-declarative-resolve-load-doc.js +12 -3
- package/lib/utils/url-declarative-resolve-surface-state.js +102 -0
- package/lib/utils/url-declarative-resolve.js +47 -7
- package/lib/utils/url-declarative-runtime-base-path.js +52 -0
- package/lib/utils/url-declarative-vdir-inactive-env.js +2 -1
- package/lib/utils/urls-local-registry-scan.js +103 -0
- package/lib/utils/urls-local-registry.js +158 -76
- package/lib/utils/validation-poll-ui.js +81 -0
- package/lib/utils/validation-run-poll.js +29 -5
- package/lib/utils/with-muted-logger.js +53 -0
- package/package.json +3 -1
- package/templates/applications/dataplane/application.yaml +5 -1
- package/templates/applications/dataplane/rbac.yaml +10 -10
- package/templates/applications/keycloak/env.template +8 -6
- package/templates/applications/miso-controller/application.yaml +9 -0
- package/templates/applications/miso-controller/env.template +27 -29
- package/templates/applications/miso-controller/rbac.yaml +9 -9
- package/templates/external-system/README.md.hbs +83 -123
- package/.npmrc.token +0 -1
- package/.nyc_output/55e9d034-ddab-4579-a706-e02a91d75c91.json +0 -1
- package/.nyc_output/processinfo/55e9d034-ddab-4579-a706-e02a91d75c91.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/lib/api/service-users.api.js +0 -150
- package/lib/api/types/service-users.types.js +0 -65
- package/lib/cli/setup-service-user.js +0 -187
- package/lib/commands/service-user.js +0 -429
|
@@ -12,7 +12,7 @@ When you touch **CLI surface** (`bin/aifabrix.js`, `lib/cli.js`, `lib/cli/**`, `
|
|
|
12
12
|
| Document | Role |
|
|
13
13
|
| -------- | ---- |
|
|
14
14
|
| [layout.md](./layout.md) | Visual and semantic spec: colors, sections, glyphs, blocking vs warning, non-TTY/CI, helper map to `cli-test-layout-chalk.js`. |
|
|
15
|
-
| [cli-output-command-matrix.md](./cli-output-command-matrix.md) | **One row per leaf command**: expected **output profile** (layout-blocks, tty-summary, stream-logs, json-opt, stdout-only, delegate). |
|
|
15
|
+
| [cli-output-command-matrix.md](./cli-output-command-matrix.md) | **One row per leaf command**: expected **output profile** (layout-blocks, tty-summary, stream-logs, json-opt, stdout-only, delegate) and **Manifest roots (141)** (when to emit gray manifest path line — see plan 141). |
|
|
16
16
|
|
|
17
17
|
If implementation and `layout.md` disagree, **fix implementation** or **update docs** in the same change so they stay one story.
|
|
18
18
|
|
|
@@ -27,9 +27,13 @@ Use the matrix row for your command to decide UX:
|
|
|
27
27
|
- **stdout-only** — Stable, script-friendly stdout; minimal chalk; often used for diffs or piping.
|
|
28
28
|
- **delegate** — Output comes from delegated library (wizard, etc.); still avoid forbidden glyphs and spurious decoration in anything you add.
|
|
29
29
|
|
|
30
|
-
**New leaf command:** add a row to [cli-output-command-matrix.md](./cli-output-command-matrix.md) with the correct profile combination.
|
|
30
|
+
**New leaf command:** add a row to [cli-output-command-matrix.md](./cli-output-command-matrix.md) with the correct profile combination and **Manifest roots (141)** code (`141`, `141+`, `int`, `cfg`, `—`).
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## Manifest path visibility (plan 141)
|
|
33
|
+
|
|
34
|
+
When a command’s matrix cell is **141**, **141+**, or **int** and the implementation reads an `application.yaml` (or integration equivalent), print **one** gray metadata line for humans (e.g. `Manifest: cwd/builder — /abs/path/application.yaml`) using `metadata()` or a small helper from `cli-test-layout-chalk.js`. Do not spam per-substep. Follow [.cursor/plans/141-manifest-location.plan.md](../plans/141-manifest-location.plan.md).
|
|
35
|
+
|
|
36
|
+
**`aifabrix setup`:** destructive / conflict prompts that list folders to be replaced must use **resolved absolute paths** for every directory (plan § Guided setup — not only `builder/<app>/` under an otherwise absolute builder root).
|
|
33
37
|
|
|
34
38
|
From [layout.md](./layout.md) contributor appendix:
|
|
35
39
|
|
|
@@ -50,7 +54,7 @@ Markdown headings in `layout.md` may use emoji for doc navigation; **user-facing
|
|
|
50
54
|
|
|
51
55
|
- **Canonical helpers:** `lib/utils/cli-test-layout-chalk.js` (see symbol → helper table in [layout.md](./layout.md) § “Implementation map”).
|
|
52
56
|
- **Preferred import alias:** `lib/utils/cli-layout-chalk.js` re-exports the same API when the path should not contain `test`.
|
|
53
|
-
- **Prefer** `formatSuccessLine`, `formatSuccessParagraph`, `formatBlockingError`, `failureGlyph`, `successGlyph`, and other exported section helpers over ad hoc `` chalk.green(`✔ …`) `` for one-off success/error lines.
|
|
57
|
+
- **Prefer** `formatSuccessLine`, `formatSuccessParagraph`, `formatWarningLine`, `formatBlockingError`, `failureGlyph`, `successGlyph`, and other exported section helpers over ad hoc `` chalk.green(`✔ …`) `` for one-off success/error lines.
|
|
54
58
|
- **Composite / indented lines** (e.g. `successGlyph()` + `chalk.white(…)`, or ` ✔ …` in validate-style output) may stay raw chalk **only** when a single helper would not match the spec; keep glyphs canonical.
|
|
55
59
|
- **Tests:** extend or add tests under `tests/lib/utils/cli-test-layout-chalk.test.js` (and command tests) when behavior or snapshots encode layout.
|
|
56
60
|
|
|
@@ -28,7 +28,7 @@ When adding or changing CLI commands, subcommands, flags, help text, or terminal
|
|
|
28
28
|
|
|
29
29
|
- **Rule**: `.cursor/rules/cli-layout.mdc`
|
|
30
30
|
- **Visual/layout spec**: `.cursor/rules/layout.md`
|
|
31
|
-
- **Per-command output profiles**: `.cursor/rules/cli-output-command-matrix.md` (update for every new leaf command)
|
|
31
|
+
- **Per-command output profiles**: `.cursor/rules/cli-output-command-matrix.md` (update for every new leaf command; see matrix **Layout compliance** for `cli-test-layout-chalk` adoption status)
|
|
32
32
|
|
|
33
33
|
## Architecture Patterns
|
|
34
34
|
|
package/README.md
CHANGED
|
@@ -42,33 +42,25 @@ npm install -g @aifabrix/builder
|
|
|
42
42
|
|
|
43
43
|
Get the platform running locally so you can try it.
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
**One-shot install:**
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
First-time run creates required infra secrets automatically. Use `aifabrix up-infra --adminPassword <password>` to set a custom admin password for Postgres, pgAdmin, and Redis Commander.
|
|
52
|
-
|
|
53
|
-
2. **Start the platform** (Keycloak, Miso Controller, Dataplane) from community images:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
aifabrix up-platform
|
|
57
|
-
```
|
|
47
|
+
```bash
|
|
48
|
+
aifabrix setup
|
|
49
|
+
```
|
|
58
50
|
|
|
59
|
-
|
|
51
|
+
`aifabrix setup` detects your local state and either runs a fresh-install wizard (admin email/password, optional AI tool keys) or shows a mode menu (re-install, wipe data, clean files, update images). It then runs `up-infra` and `up-platform` for you. Use `aifabrix teardown` to fully remove the local installation. See [Infrastructure commands](docs/commands/infrastructure.md#aifabrix-setup) for details and CI flags.
|
|
60
52
|
|
|
61
|
-
|
|
53
|
+
If you prefer to set the AI tool key outside the wizard, use one of:
|
|
62
54
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
55
|
+
- **OpenAI:** set your API key:
|
|
56
|
+
```bash
|
|
57
|
+
aifabrix secret set secrets-openaiApiKeyVault <your-openai-secret-key>
|
|
58
|
+
```
|
|
59
|
+
- **Azure OpenAI:** set endpoint and API key:
|
|
60
|
+
```bash
|
|
61
|
+
aifabrix secret set azure-openaiapi-urlKeyVault <your-azure-openai-endpoint-url>
|
|
62
|
+
aifabrix secret set secrets-azureOpenaiApiKeyVault <your-azure-openai-secret-key>
|
|
63
|
+
```
|
|
72
64
|
|
|
73
65
|
Secrets are stored in `~/.aifabrix/secrets.local.yaml` or the file from `aifabrix-secrets` in your config (e.g. `builder/secrets.local.yaml`).
|
|
74
66
|
|
|
@@ -150,6 +150,8 @@ If you see **"Invalid token or insufficient permissions"** or **"Failed to creat
|
|
|
150
150
|
|
|
151
151
|
If the dataplane is configured to accept device tokens for the wizard API, ensure you are logged in with `aifabrix login` and that the controller URL and environment match (e.g. `dev`). No client credentials are needed.
|
|
152
152
|
|
|
153
|
+
When this error appears, `pnpm test:hubspot-wizard` **skips** the live wizard cases (exit code 0) so optional CI/agents are not blocked; configure client credentials or dataplane auth to run those cases for real.
|
|
154
|
+
|
|
153
155
|
## Troubleshooting
|
|
154
156
|
|
|
155
157
|
- **Validation errors**: Run `aifabrix validate hubspot-test --type external` to see schema and manifest errors.
|
|
@@ -796,8 +796,8 @@ async function testDownloadAndSplit(appName, context, options) {
|
|
|
796
796
|
}
|
|
797
797
|
|
|
798
798
|
/**
|
|
799
|
-
* Returns a skip message
|
|
800
|
-
*
|
|
799
|
+
* Returns a skip message when the wizard cannot run due to environment (dataplane missing,
|
|
800
|
+
* or dataplane rejecting the CLI token for wizard session).
|
|
801
801
|
* @param {string} errorOutput - Combined stdout + stderr from wizard command
|
|
802
802
|
* @returns {string|null} Skip message or null
|
|
803
803
|
*/
|
|
@@ -1257,7 +1257,9 @@ async function createSystemForNegativeTest(appName, configName, context, options
|
|
|
1257
1257
|
});
|
|
1258
1258
|
const wizardResult = await runWizard(configPath, context, options);
|
|
1259
1259
|
if (!wizardResult.success) {
|
|
1260
|
-
|
|
1260
|
+
const errorOutput = `${wizardResult.stdout}\n${wizardResult.stderr}`;
|
|
1261
|
+
const skipMsg = getWizardEnvironmentSkipMessage(errorOutput);
|
|
1262
|
+
throw new SkipTestError(skipMsg || `Wizard failed to create system: ${wizardResult.stderr}`);
|
|
1261
1263
|
}
|
|
1262
1264
|
await new Promise(resolve => setTimeout(resolve, 200));
|
|
1263
1265
|
return path.join(process.cwd(), 'integration', appName);
|
package/jest.projects.js
CHANGED
|
@@ -83,6 +83,10 @@ const defaultProject = {
|
|
|
83
83
|
'\\\\tests\\\\lib\\\\commands\\\\parameters-validate.test.js',
|
|
84
84
|
'lib/commands/parameters-validate.test.js',
|
|
85
85
|
'parameters-validate\\.test\\.js',
|
|
86
|
+
'/tests/lib/commands/repair-openapi-sync.test.js',
|
|
87
|
+
'\\\\tests\\\\lib\\\\commands\\\\repair-openapi-sync.test.js',
|
|
88
|
+
'lib/commands/repair-openapi-sync.test.js',
|
|
89
|
+
'repair-openapi-sync\\.test\\.js',
|
|
86
90
|
'/tests/lib/utils/datasource-test-run-schema-sync.test.js',
|
|
87
91
|
'\\\\tests\\\\lib\\\\utils\\\\datasource-test-run-schema-sync.test.js',
|
|
88
92
|
'lib/utils/datasource-test-run-schema-sync.test.js',
|
|
@@ -137,6 +141,34 @@ const defaultProject = {
|
|
|
137
141
|
'\\\\tests\\\\lib\\\\utils\\\\url-declarative-vdir-inactive-env.test.js',
|
|
138
142
|
'lib/utils/url-declarative-vdir-inactive-env.test.js',
|
|
139
143
|
'url-declarative-vdir-inactive-env\\.test\\.js',
|
|
144
|
+
'/tests/lib/utils/url-declarative-user-cfg-per-app-proxy.test.js',
|
|
145
|
+
'\\\\tests\\\\lib\\\\utils\\\\url-declarative-user-cfg-per-app-proxy.test.js',
|
|
146
|
+
'lib/utils/url-declarative-user-cfg-per-app-proxy.test.js',
|
|
147
|
+
'url-declarative-user-cfg-per-app-proxy\\.test\\.js',
|
|
148
|
+
'/tests/lib/utils/url-declarative-expand-traefik-off-no-usercfg.test.js',
|
|
149
|
+
'\\\\tests\\\\lib\\\\utils\\\\url-declarative-expand-traefik-off-no-usercfg.test.js',
|
|
150
|
+
'lib/utils/url-declarative-expand-traefik-off-no-usercfg.test.js',
|
|
151
|
+
'url-declarative-expand-traefik-off-no-usercfg\\.test\\.js',
|
|
152
|
+
'/tests/lib/core/secrets-env-declarative-show-urls.test.js',
|
|
153
|
+
'\\\\tests\\\\lib\\\\core\\\\secrets-env-declarative-show-urls.test.js',
|
|
154
|
+
'lib/core/secrets-env-declarative-show-urls.test.js',
|
|
155
|
+
'secrets-env-declarative-show-urls\\.test\\.js',
|
|
156
|
+
'/tests/lib/utils/url-declarative-registry-internal-docker-origin.test.js',
|
|
157
|
+
'\\\\tests\\\\lib\\\\utils\\\\url-declarative-registry-internal-docker-origin.test.js',
|
|
158
|
+
'lib/utils/url-declarative-registry-internal-docker-origin.test.js',
|
|
159
|
+
'url-declarative-registry-internal-docker-origin\\.test\\.js',
|
|
160
|
+
'/tests/lib/commands/platform-urls-registry.validation.test.js',
|
|
161
|
+
'\\\\tests\\\\lib\\\\commands\\\\platform-urls-registry.validation.test.js',
|
|
162
|
+
'lib/commands/platform-urls-registry.validation.test.js',
|
|
163
|
+
'platform-urls-registry\\.validation\\.test\\.js',
|
|
164
|
+
'/tests/lib/utils/env-copy-resolve-output.test.js',
|
|
165
|
+
'\\\\tests\\\\lib\\\\utils\\\\env-copy-resolve-output.test.js',
|
|
166
|
+
'lib/utils/env-copy-resolve-output.test.js',
|
|
167
|
+
'env-copy-resolve-output\\.test\\.js',
|
|
168
|
+
'/tests/lib/utils/write-env-output-reload.test.js',
|
|
169
|
+
'\\\\tests\\\\lib\\\\utils\\\\write-env-output-reload.test.js',
|
|
170
|
+
'lib/utils/write-env-output-reload.test.js',
|
|
171
|
+
'write-env-output-reload\\.test\\.js',
|
|
140
172
|
'/tests/lib/utils/app-service-env-from-builder.test.js',
|
|
141
173
|
'\\\\tests\\\\lib\\\\utils\\\\app-service-env-from-builder.test.js',
|
|
142
174
|
'lib/utils/app-service-env-from-builder.test.js',
|
|
@@ -157,6 +189,26 @@ const defaultProject = {
|
|
|
157
189
|
'\\\\tests\\\\lib\\\\utils\\\\paths-app-listing.test.js',
|
|
158
190
|
'lib/utils/paths-app-listing.test.js',
|
|
159
191
|
'paths-app-listing\\.test\\.js',
|
|
192
|
+
'/tests/lib/utils/paths-system-builder-resolution.test.js',
|
|
193
|
+
'\\\\tests\\\\lib\\\\utils\\\\paths-system-builder-resolution.test.js',
|
|
194
|
+
'lib/utils/paths-system-builder-resolution.test.js',
|
|
195
|
+
'paths-system-builder-resolution\\.test\\.js',
|
|
196
|
+
'/tests/lib/utils/manifest-location.test.js',
|
|
197
|
+
'\\\\tests\\\\lib\\\\utils\\\\manifest-location.test.js',
|
|
198
|
+
'lib/utils/manifest-location.test.js',
|
|
199
|
+
'manifest-location\\.test\\.js',
|
|
200
|
+
'/tests/lib/utils/installation-log.test.js',
|
|
201
|
+
'\\\\tests\\\\lib\\\\utils\\\\installation-log.test.js',
|
|
202
|
+
'lib/utils/installation-log.test.js',
|
|
203
|
+
'installation-log\\.test\\.js',
|
|
204
|
+
'/tests/lib/utils/manifest-source-emit.test.js',
|
|
205
|
+
'\\\\tests\\\\lib\\\\utils\\\\manifest-source-emit.test.js',
|
|
206
|
+
'lib/utils/manifest-source-emit.test.js',
|
|
207
|
+
'manifest-source-emit\\.test\\.js',
|
|
208
|
+
'/tests/lib/utils/secrets-ancestor-paths.test.js',
|
|
209
|
+
'\\\\tests\\\\lib\\\\utils\\\\secrets-ancestor-paths.test.js',
|
|
210
|
+
'lib/utils/secrets-ancestor-paths.test.js',
|
|
211
|
+
'secrets-ancestor-paths\\.test\\.js',
|
|
160
212
|
'/tests/lib/generator/generator-external-rbac.test.js',
|
|
161
213
|
'\\\\tests\\\\lib\\\\generator\\\\generator-external-rbac.test.js',
|
|
162
214
|
'lib/generator/generator-external-rbac.test.js',
|
|
@@ -206,7 +258,27 @@ const defaultProject = {
|
|
|
206
258
|
'application-frontdoor-paths\\.contract\\.test\\.js',
|
|
207
259
|
'/tests/lib/core/admin-secrets.test.js',
|
|
208
260
|
'\\\\tests\\\\lib\\\\core\\\\admin-secrets.test.js',
|
|
209
|
-
'lib/core/admin-secrets.test.js'
|
|
261
|
+
'lib/core/admin-secrets.test.js',
|
|
262
|
+
'/tests/lib/datasource/validate-datasource-parsed.test.js',
|
|
263
|
+
'\\\\tests\\\\lib\\\\datasource\\\\validate-datasource-parsed.test.js',
|
|
264
|
+
'lib/datasource/validate-datasource-parsed.test.js',
|
|
265
|
+
'validate-datasource-parsed\\.test\\.js',
|
|
266
|
+
'/tests/lib/datasource/run-capability-copy.test.js',
|
|
267
|
+
'\\\\tests\\\\lib\\\\datasource\\\\run-capability-copy.test.js',
|
|
268
|
+
'lib/datasource/run-capability-copy.test.js',
|
|
269
|
+
'run-capability-copy\\.test\\.js',
|
|
270
|
+
'/tests/lib/datasource/run-capability-diff.test.js',
|
|
271
|
+
'\\\\tests\\\\lib\\\\datasource\\\\run-capability-diff.test.js',
|
|
272
|
+
'lib/datasource/run-capability-diff.test.js',
|
|
273
|
+
'run-capability-diff\\.test\\.js',
|
|
274
|
+
'/tests/lib/datasource/run-capability-edit.test.js',
|
|
275
|
+
'\\\\tests\\\\lib\\\\datasource\\\\run-capability-edit.test.js',
|
|
276
|
+
'lib/datasource/run-capability-edit.test.js',
|
|
277
|
+
'run-capability-edit\\.test\\.js',
|
|
278
|
+
'/tests/lib/datasource/run-capability-remove.test.js',
|
|
279
|
+
'\\\\tests\\\\lib\\\\datasource\\\\run-capability-remove.test.js',
|
|
280
|
+
'lib/datasource/run-capability-remove.test.js',
|
|
281
|
+
'run-capability-remove\\.test\\.js'
|
|
210
282
|
];
|
|
211
283
|
if (process.env.INCLUDE_LOCAL_TESTS !== 'true') {
|
|
212
284
|
patterns.push('/tests/local/');
|
|
@@ -226,7 +298,14 @@ const isolatedProjects = [
|
|
|
226
298
|
makeIsolatedProject('external-system-display', ['**/tests/lib/utils/external-system-display.test.js']),
|
|
227
299
|
makeIsolatedProject('dev-hosts-helper', ['**/tests/lib/utils/dev-hosts-helper.test.js']),
|
|
228
300
|
makeIsolatedProject('parameters-validate', ['**/tests/lib/commands/parameters-validate.test.js']),
|
|
301
|
+
makeIsolatedProject('repair-openapi-sync', ['**/tests/lib/commands/repair-openapi-sync.test.js']),
|
|
229
302
|
makeIsolatedProject('paths-app-listing', ['**/tests/lib/utils/paths-app-listing.test.js']),
|
|
303
|
+
makeIsolatedProject('paths-system-builder-resolution', [
|
|
304
|
+
'**/tests/lib/utils/paths-system-builder-resolution.test.js'
|
|
305
|
+
]),
|
|
306
|
+
makeIsolatedProject('manifest-location', ['**/tests/lib/utils/manifest-location.test.js']),
|
|
307
|
+
makeIsolatedProject('installation-log', ['**/tests/lib/utils/installation-log.test.js']),
|
|
308
|
+
makeIsolatedProject('secrets-ancestor-paths', ['**/tests/lib/utils/secrets-ancestor-paths.test.js']),
|
|
230
309
|
makeIsolatedProject('datasource-validation-watch', [
|
|
231
310
|
'**/tests/lib/utils/datasource-validation-watch.test.js'
|
|
232
311
|
]),
|
|
@@ -235,6 +314,7 @@ const isolatedProjects = [
|
|
|
235
314
|
'**/tests/lib/datasource/log-viewer-structural.test.js',
|
|
236
315
|
'**/tests/lib/datasource/log-viewer-run.test.js'
|
|
237
316
|
]),
|
|
317
|
+
makeIsolatedProject('manifest-source-emit', ['**/tests/lib/utils/manifest-source-emit.test.js']),
|
|
238
318
|
makeIsolatedProject('register-aifabrix-shell-env', [
|
|
239
319
|
'**/tests/lib/utils/register-aifabrix-shell-env.test.js'
|
|
240
320
|
]),
|
|
@@ -277,6 +357,19 @@ const isolatedProjects = [
|
|
|
277
357
|
makeIsolatedProject('url-declarative-vdir-inactive-env', [
|
|
278
358
|
'**/tests/lib/utils/url-declarative-vdir-inactive-env.test.js'
|
|
279
359
|
]),
|
|
360
|
+
makeIsolatedProject('url-declarative-user-cfg-per-app-proxy', [
|
|
361
|
+
'**/tests/lib/utils/url-declarative-user-cfg-per-app-proxy.test.js'
|
|
362
|
+
]),
|
|
363
|
+
makeIsolatedProject('declarative-url-paths-spy-suites', [
|
|
364
|
+
'**/tests/lib/utils/url-declarative-expand-traefik-off-no-usercfg.test.js',
|
|
365
|
+
'**/tests/lib/core/secrets-env-declarative-show-urls.test.js',
|
|
366
|
+
'**/tests/lib/utils/url-declarative-registry-internal-docker-origin.test.js'
|
|
367
|
+
]),
|
|
368
|
+
makeIsolatedProject('platform-urls-registry-validation', [
|
|
369
|
+
'**/tests/lib/commands/platform-urls-registry.validation.test.js'
|
|
370
|
+
]),
|
|
371
|
+
makeIsolatedProject('env-copy-resolve-output', ['**/tests/lib/utils/env-copy-resolve-output.test.js']),
|
|
372
|
+
makeIsolatedProject('write-env-output-reload', ['**/tests/lib/utils/write-env-output-reload.test.js']),
|
|
280
373
|
makeIsolatedProject('app-service-env-from-builder', [
|
|
281
374
|
'**/tests/lib/utils/app-service-env-from-builder.test.js'
|
|
282
375
|
]),
|
|
@@ -302,7 +395,16 @@ const isolatedProjects = [
|
|
|
302
395
|
makeIsolatedProject('schema-241-alignment', ['**/tests/lib/validation/schema-241-alignment.test.js']),
|
|
303
396
|
makeIsolatedProject('schema-resolver-order', ['**/tests/lib/utils/schema-resolver-order.test.js']),
|
|
304
397
|
makeIsolatedProject('app-module', ['**/tests/lib/app/app.test.js']),
|
|
305
|
-
makeIsolatedProject('admin-secrets', ['**/tests/lib/core/admin-secrets.test.js'])
|
|
398
|
+
makeIsolatedProject('admin-secrets', ['**/tests/lib/core/admin-secrets.test.js']),
|
|
399
|
+
makeIsolatedProject('validate-datasource-parsed', [
|
|
400
|
+
'**/tests/lib/datasource/validate-datasource-parsed.test.js'
|
|
401
|
+
]),
|
|
402
|
+
makeIsolatedProject('capability-run-real-fs', [
|
|
403
|
+
'**/tests/lib/datasource/run-capability-copy.test.js',
|
|
404
|
+
'**/tests/lib/datasource/run-capability-diff.test.js',
|
|
405
|
+
'**/tests/lib/datasource/run-capability-edit.test.js',
|
|
406
|
+
'**/tests/lib/datasource/run-capability-remove.test.js'
|
|
407
|
+
])
|
|
306
408
|
];
|
|
307
409
|
|
|
308
410
|
const allProjects = [defaultProject, ...isolatedProjects];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Controller health (public) — deployment mode for Builder polling tuning.
|
|
3
|
+
*
|
|
4
|
+
* GET /api/v1/health returns `{ data: { deploymentType, ... } }` (miso-controller).
|
|
5
|
+
*
|
|
6
|
+
* @fileoverview Read controller deployment type without authentication
|
|
7
|
+
* @author AI Fabrix Team
|
|
8
|
+
* @version 2.0.0
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const { ApiClient } = require('./index');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Extract deploymentType from harmonized API JSON body.
|
|
15
|
+
* @param {Object} response - Result from ApiClient.get / makeApiCall shape `{ success, data }`
|
|
16
|
+
* @returns {string|undefined} Normalized lowercase deployment type or undefined
|
|
17
|
+
*/
|
|
18
|
+
function extractDeploymentTypeFromHealthResponse(response) {
|
|
19
|
+
if (!response || response.success === false || response.data === null) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
const body = response.data;
|
|
23
|
+
if (!body || typeof body !== 'object') {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const payload = body.data !== undefined ? body.data : body;
|
|
27
|
+
if (!payload || typeof payload !== 'object') {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
const dt = payload.deploymentType;
|
|
31
|
+
return typeof dt === 'string' ? dt.trim().toLowerCase() : undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Fetch controller DEPLOYMENT mode label (public endpoint, no auth).
|
|
36
|
+
* @async
|
|
37
|
+
* @param {string} controllerUrl - Controller base URL
|
|
38
|
+
* @returns {Promise<string|undefined>} e.g. 'database', 'local', 'azure', 'azure-mock'
|
|
39
|
+
*/
|
|
40
|
+
async function getControllerDeploymentType(controllerUrl) {
|
|
41
|
+
const client = new ApiClient(controllerUrl);
|
|
42
|
+
const response = await client.get('/api/v1/health');
|
|
43
|
+
return extractDeploymentTypeFromHealthResponse(response);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
module.exports = {
|
|
47
|
+
getControllerDeploymentType,
|
|
48
|
+
extractDeploymentTypeFromHealthResponse
|
|
49
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Dimension values API (Controller)
|
|
3
|
+
* @author AI Fabrix Team
|
|
4
|
+
* @version 2.0.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const { ApiClient } = require('./index');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* List dimension values for a dimension
|
|
13
|
+
* @requiresPermission {Controller} dimensions:read
|
|
14
|
+
* @async
|
|
15
|
+
* @function listDimensionValues
|
|
16
|
+
* @param {string} controllerUrl
|
|
17
|
+
* @param {Object} authConfig
|
|
18
|
+
* @param {string} dimensionIdOrKey
|
|
19
|
+
* @param {Object} [options]
|
|
20
|
+
* @param {number} [options.page]
|
|
21
|
+
* @param {number} [options.pageSize]
|
|
22
|
+
* @param {string} [options.sort]
|
|
23
|
+
* @param {string} [options.filter]
|
|
24
|
+
* @param {string} [options.search]
|
|
25
|
+
* @returns {Promise<Object>}
|
|
26
|
+
*/
|
|
27
|
+
async function listDimensionValues(controllerUrl, authConfig, dimensionIdOrKey, options = {}) {
|
|
28
|
+
const client = new ApiClient(controllerUrl, authConfig);
|
|
29
|
+
return await client.get(`/api/v1/dimensions/${encodeURIComponent(dimensionIdOrKey)}/values`, {
|
|
30
|
+
params: options
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Create a dimension value under a dimension
|
|
36
|
+
* @requiresPermission {Controller} dimensions:create
|
|
37
|
+
* @async
|
|
38
|
+
* @function createDimensionValue
|
|
39
|
+
* @param {string} controllerUrl
|
|
40
|
+
* @param {Object} authConfig
|
|
41
|
+
* @param {string} dimensionIdOrKey
|
|
42
|
+
* @param {Object} body
|
|
43
|
+
* @param {string} body.value
|
|
44
|
+
* @param {string} [body.displayName]
|
|
45
|
+
* @param {string} [body.description]
|
|
46
|
+
* @returns {Promise<Object>}
|
|
47
|
+
*/
|
|
48
|
+
async function createDimensionValue(controllerUrl, authConfig, dimensionIdOrKey, body) {
|
|
49
|
+
const client = new ApiClient(controllerUrl, authConfig);
|
|
50
|
+
const payload = { value: body.value };
|
|
51
|
+
if (body.displayName !== undefined && body.displayName !== null && body.displayName !== '') {
|
|
52
|
+
payload.displayName = body.displayName;
|
|
53
|
+
}
|
|
54
|
+
if (body.description !== undefined && body.description !== null && body.description !== '') {
|
|
55
|
+
payload.description = body.description;
|
|
56
|
+
}
|
|
57
|
+
return await client.post(`/api/v1/dimensions/${encodeURIComponent(dimensionIdOrKey)}/values`, {
|
|
58
|
+
body: payload
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Delete a dimension value by id
|
|
64
|
+
* @requiresPermission {Controller} dimensions:delete
|
|
65
|
+
* @async
|
|
66
|
+
* @function deleteDimensionValue
|
|
67
|
+
* @param {string} controllerUrl
|
|
68
|
+
* @param {Object} authConfig
|
|
69
|
+
* @param {string} dimensionValueId
|
|
70
|
+
* @returns {Promise<Object>}
|
|
71
|
+
*/
|
|
72
|
+
async function deleteDimensionValue(controllerUrl, authConfig, dimensionValueId) {
|
|
73
|
+
const client = new ApiClient(controllerUrl, authConfig);
|
|
74
|
+
return await client.delete(`/api/v1/dimension-values/${encodeURIComponent(dimensionValueId)}`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
module.exports = {
|
|
78
|
+
listDimensionValues,
|
|
79
|
+
createDimensionValue,
|
|
80
|
+
deleteDimensionValue
|
|
81
|
+
};
|
|
82
|
+
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Dimensions API (Controller /api/v1/dimensions)
|
|
3
|
+
* @author AI Fabrix Team
|
|
4
|
+
* @version 2.0.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const { ApiClient } = require('./index');
|
|
10
|
+
|
|
11
|
+
const BASE = '/api/v1/dimensions';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* List dimensions (paginated)
|
|
15
|
+
* @requiresPermission {Controller} dimensions:read
|
|
16
|
+
* @async
|
|
17
|
+
* @function listDimensions
|
|
18
|
+
* @param {string} controllerUrl
|
|
19
|
+
* @param {Object} authConfig
|
|
20
|
+
* @param {Object} [options]
|
|
21
|
+
* @param {number} [options.page]
|
|
22
|
+
* @param {number} [options.pageSize]
|
|
23
|
+
* @param {string} [options.sort]
|
|
24
|
+
* @param {string} [options.filter]
|
|
25
|
+
* @param {string} [options.search]
|
|
26
|
+
* @returns {Promise<Object>}
|
|
27
|
+
*/
|
|
28
|
+
async function listDimensions(controllerUrl, authConfig, options = {}) {
|
|
29
|
+
const client = new ApiClient(controllerUrl, authConfig);
|
|
30
|
+
return await client.get(BASE, { params: options });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get a dimension by id or key
|
|
35
|
+
* @requiresPermission {Controller} dimensions:read
|
|
36
|
+
* @async
|
|
37
|
+
* @function getDimension
|
|
38
|
+
* @param {string} controllerUrl
|
|
39
|
+
* @param {Object} authConfig
|
|
40
|
+
* @param {string} dimensionIdOrKey
|
|
41
|
+
* @param {Object} [options]
|
|
42
|
+
* @param {boolean} [options.includeValues]
|
|
43
|
+
* @returns {Promise<Object>}
|
|
44
|
+
*/
|
|
45
|
+
async function getDimension(controllerUrl, authConfig, dimensionIdOrKey, options = {}) {
|
|
46
|
+
const client = new ApiClient(controllerUrl, authConfig);
|
|
47
|
+
const params = {};
|
|
48
|
+
if (options.includeValues !== undefined && options.includeValues !== null) {
|
|
49
|
+
params.includeValues = options.includeValues;
|
|
50
|
+
}
|
|
51
|
+
return await client.get(`${BASE}/${encodeURIComponent(dimensionIdOrKey)}`, { params });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Create a dimension
|
|
56
|
+
* @requiresPermission {Controller} dimensions:create
|
|
57
|
+
* @async
|
|
58
|
+
* @function createDimension
|
|
59
|
+
* @param {string} controllerUrl
|
|
60
|
+
* @param {Object} authConfig
|
|
61
|
+
* @param {Object} body
|
|
62
|
+
* @returns {Promise<Object>}
|
|
63
|
+
*/
|
|
64
|
+
async function createDimension(controllerUrl, authConfig, body) {
|
|
65
|
+
const client = new ApiClient(controllerUrl, authConfig);
|
|
66
|
+
const payload = {
|
|
67
|
+
key: body.key,
|
|
68
|
+
displayName: body.displayName,
|
|
69
|
+
dataType: body.dataType
|
|
70
|
+
};
|
|
71
|
+
if (body.description !== undefined && body.description !== null && body.description !== '') {
|
|
72
|
+
payload.description = body.description;
|
|
73
|
+
}
|
|
74
|
+
if (body.isRequired !== undefined && body.isRequired !== null) {
|
|
75
|
+
payload.isRequired = Boolean(body.isRequired);
|
|
76
|
+
}
|
|
77
|
+
return await client.post(BASE, { body: payload });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Create-if-missing (idempotent by default): if a dimension already exists for the key, return it as success.
|
|
82
|
+
* @requiresPermission {Controller} dimensions:read + dimensions:create
|
|
83
|
+
* @async
|
|
84
|
+
* @function createDimensionIdempotent
|
|
85
|
+
* @param {string} controllerUrl
|
|
86
|
+
* @param {Object} authConfig
|
|
87
|
+
* @param {Object} body
|
|
88
|
+
* @returns {Promise<{ created: boolean, response: Object }>}
|
|
89
|
+
*/
|
|
90
|
+
async function createDimensionIdempotent(controllerUrl, authConfig, body) {
|
|
91
|
+
const key = String(body?.key || '').trim();
|
|
92
|
+
if (!key) {
|
|
93
|
+
throw new Error('Dimension key is required');
|
|
94
|
+
}
|
|
95
|
+
const getRes = await getDimension(controllerUrl, authConfig, key);
|
|
96
|
+
if (getRes && getRes.success === true) {
|
|
97
|
+
return { created: false, response: getRes };
|
|
98
|
+
}
|
|
99
|
+
// Not found or other read failure; attempt create and let errors surface.
|
|
100
|
+
const createRes = await createDimension(controllerUrl, authConfig, body);
|
|
101
|
+
if (createRes && createRes.success === true) {
|
|
102
|
+
return { created: true, response: createRes };
|
|
103
|
+
}
|
|
104
|
+
const msg = createRes?.error || createRes?.formattedError || 'Failed to create dimension';
|
|
105
|
+
throw new Error(msg);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
module.exports = {
|
|
109
|
+
listDimensions,
|
|
110
|
+
getDimension,
|
|
111
|
+
createDimension,
|
|
112
|
+
createDimensionIdempotent
|
|
113
|
+
};
|
|
114
|
+
|
|
@@ -60,6 +60,7 @@ async function createExternalSystem(dataplaneUrl, authConfig, systemData) {
|
|
|
60
60
|
* @param {Object} authConfig - Authentication configuration
|
|
61
61
|
* @returns {Promise<Object>} External system details response. May include optional fields:
|
|
62
62
|
* - {string} [mcpServerUrl] - Full URL of external system MCP server when configured
|
|
63
|
+
* - {string} [mcpDocsPageUrl] - Full URL of MCP OpenAPI docs page (builder may derive when absent)
|
|
63
64
|
* - {string} [apiDocumentUrl] - Full URL of API document (OpenAPI spec) when configured
|
|
64
65
|
* - {string} [openApiDocsPageUrl] - Full URL of dataplane API docs page when showOpenApiDocs is true
|
|
65
66
|
* @throws {Error} If request fails
|