@aifabrix/builder 2.44.4 → 2.44.6

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.
Files changed (214) hide show
  1. package/.cursor/rules/cli-layout.mdc +1 -1
  2. package/.cursor/rules/project-rules.mdc +1 -1
  3. package/.npmrc.token +1 -1
  4. package/README.md +15 -23
  5. package/integration/hubspot-test/README.md +2 -0
  6. package/integration/hubspot-test/test.js +5 -3
  7. package/jest.projects.js +68 -17
  8. package/lib/api/controller-health.api.js +49 -0
  9. package/lib/api/dimension-values.api.js +82 -0
  10. package/lib/api/dimensions.api.js +114 -0
  11. package/lib/api/external-systems.api.js +1 -0
  12. package/lib/api/integration-clients.api.js +168 -0
  13. package/lib/api/types/dimension-values.types.js +28 -0
  14. package/lib/api/types/dimensions.types.js +31 -0
  15. package/lib/api/types/integration-clients.types.js +45 -0
  16. package/lib/api/types/wizard.types.js +2 -1
  17. package/lib/api/validation-runner.js +46 -25
  18. package/lib/app/deploy-config.js +11 -1
  19. package/lib/app/deploy-status-display.js +3 -3
  20. package/lib/app/deploy.js +36 -14
  21. package/lib/app/display.js +15 -11
  22. package/lib/app/push.js +46 -23
  23. package/lib/app/register.js +1 -1
  24. package/lib/app/restart-display.js +95 -0
  25. package/lib/app/rotate-secret.js +1 -1
  26. package/lib/app/run-container-start.js +12 -6
  27. package/lib/app/run-env-compose.js +30 -1
  28. package/lib/app/run-helpers.js +44 -12
  29. package/lib/app/run-reload-sync.js +148 -0
  30. package/lib/app/run-resolve-image.js +51 -1
  31. package/lib/app/run.js +99 -73
  32. package/lib/build/index.js +75 -45
  33. package/lib/cli/doctor-check.js +117 -0
  34. package/lib/cli/index.js +8 -2
  35. package/lib/cli/infra-guided.js +445 -0
  36. package/lib/cli/setup-app.help.js +1 -1
  37. package/lib/cli/setup-app.js +20 -2
  38. package/lib/cli/setup-app.test-commands.js +9 -5
  39. package/lib/cli/setup-auth.js +26 -0
  40. package/lib/cli/setup-dev-path-commands.js +50 -3
  41. package/lib/cli/setup-infra.js +138 -61
  42. package/lib/cli/setup-integration-client.js +182 -0
  43. package/lib/cli/setup-parameters.js +21 -2
  44. package/lib/cli/setup-platform.js +102 -0
  45. package/lib/cli/setup-secrets.js +18 -6
  46. package/lib/cli/setup-utility.js +97 -33
  47. package/lib/commands/datasource-capability-dimension-cli.js +128 -0
  48. package/lib/commands/datasource-capability-output.js +29 -0
  49. package/lib/commands/datasource-capability-relate-cli.js +140 -0
  50. package/lib/commands/datasource-capability.js +411 -0
  51. package/lib/commands/datasource-unified-test-cli.options.js +1 -1
  52. package/lib/commands/datasource.js +53 -13
  53. package/lib/commands/dev-down.js +3 -3
  54. package/lib/commands/dev-infra-gate.js +32 -0
  55. package/lib/commands/dev-init.js +13 -7
  56. package/lib/commands/dimension-value.js +179 -0
  57. package/lib/commands/dimension.js +330 -0
  58. package/lib/commands/integration-client.js +430 -0
  59. package/lib/commands/login-device.js +65 -30
  60. package/lib/commands/login.js +21 -10
  61. package/lib/commands/parameters-validate.js +78 -13
  62. package/lib/commands/repair-datasource-auto-rbac.js +166 -0
  63. package/lib/commands/repair-datasource-keys.js +10 -5
  64. package/lib/commands/repair-datasource.js +19 -7
  65. package/lib/commands/repair-env-template.js +4 -1
  66. package/lib/commands/repair-openapi-sync.js +172 -0
  67. package/lib/commands/repair-persist.js +102 -0
  68. package/lib/commands/repair-rbac-extract.js +27 -0
  69. package/lib/commands/repair-rbac-migrate.js +186 -0
  70. package/lib/commands/repair-rbac.js +225 -19
  71. package/lib/commands/repair-system-alignment.js +246 -0
  72. package/lib/commands/repair-system-permissions.js +168 -0
  73. package/lib/commands/repair.js +120 -354
  74. package/lib/commands/secure.js +1 -1
  75. package/lib/commands/setup-modes.js +455 -0
  76. package/lib/commands/setup-prompts.js +388 -0
  77. package/lib/commands/setup.js +149 -0
  78. package/lib/commands/teardown.js +228 -0
  79. package/lib/commands/test-e2e-external.js +4 -3
  80. package/lib/commands/up-common.js +97 -12
  81. package/lib/commands/up-dataplane.js +33 -11
  82. package/lib/commands/up-miso.js +7 -11
  83. package/lib/commands/upload.js +109 -23
  84. package/lib/commands/wizard-core-helpers.js +14 -11
  85. package/lib/commands/wizard-core.js +58 -15
  86. package/lib/commands/wizard-dataplane.js +2 -2
  87. package/lib/commands/wizard-entity-selection.js +72 -14
  88. package/lib/commands/wizard-headless.js +7 -3
  89. package/lib/commands/wizard-helpers.js +13 -1
  90. package/lib/commands/wizard.js +210 -61
  91. package/lib/constants/infra-compose-service-names.js +40 -0
  92. package/lib/core/env-reader.js +16 -3
  93. package/lib/core/secrets-admin-env.js +101 -0
  94. package/lib/core/secrets-ensure-infra.js +34 -1
  95. package/lib/core/secrets-ensure.js +88 -66
  96. package/lib/core/secrets-env-content.js +432 -0
  97. package/lib/core/secrets-env-write.js +27 -1
  98. package/lib/core/secrets-load.js +248 -0
  99. package/lib/core/secrets-names.js +32 -0
  100. package/lib/core/secrets.js +17 -757
  101. package/lib/datasource/capability/basic-exposure.js +76 -0
  102. package/lib/datasource/capability/capability-diff-slice.js +41 -0
  103. package/lib/datasource/capability/capability-key.js +34 -0
  104. package/lib/datasource/capability/capability-resolve.js +172 -0
  105. package/lib/datasource/capability/capability-storage-keys.js +22 -0
  106. package/lib/datasource/capability/copy-operations.js +348 -0
  107. package/lib/datasource/capability/copy-test-payload.js +139 -0
  108. package/lib/datasource/capability/create-operations.js +235 -0
  109. package/lib/datasource/capability/dimension-operations.js +151 -0
  110. package/lib/datasource/capability/dimension-validate.js +219 -0
  111. package/lib/datasource/capability/json-pointer.js +31 -0
  112. package/lib/datasource/capability/reference-rewrite.js +51 -0
  113. package/lib/datasource/capability/relate-operations.js +325 -0
  114. package/lib/datasource/capability/relate-validate.js +219 -0
  115. package/lib/datasource/capability/remove-operations.js +275 -0
  116. package/lib/datasource/capability/run-capability-copy.js +152 -0
  117. package/lib/datasource/capability/run-capability-diff.js +135 -0
  118. package/lib/datasource/capability/run-capability-dimension.js +291 -0
  119. package/lib/datasource/capability/run-capability-edit.js +377 -0
  120. package/lib/datasource/capability/run-capability-relate.js +193 -0
  121. package/lib/datasource/capability/run-capability-remove.js +105 -0
  122. package/lib/datasource/capability/templates/minimal-fetch.json +18 -0
  123. package/lib/datasource/capability/validate-capability-slice.js +35 -0
  124. package/lib/datasource/list.js +136 -23
  125. package/lib/datasource/log-viewer.js +2 -4
  126. package/lib/datasource/unified-validation-run.js +51 -16
  127. package/lib/datasource/validate.js +53 -1
  128. package/lib/deployment/deploy-poll-ui.js +60 -0
  129. package/lib/deployment/deployer-status.js +29 -3
  130. package/lib/deployment/deployer.js +48 -30
  131. package/lib/deployment/environment.js +7 -2
  132. package/lib/deployment/poll-interval.js +72 -0
  133. package/lib/deployment/push.js +11 -9
  134. package/lib/external-system/deploy.js +4 -1
  135. package/lib/external-system/download.js +61 -32
  136. package/lib/external-system/sync-deploy-manifest.js +33 -0
  137. package/lib/generator/wizard-prompts.js +7 -1
  138. package/lib/generator/wizard.js +34 -0
  139. package/lib/infrastructure/index.js +49 -19
  140. package/lib/infrastructure/orphan-infra-docker-teardown.js +177 -0
  141. package/lib/parameters/infra-kv-discovery.js +29 -4
  142. package/lib/parameters/infra-parameter-catalog.js +6 -3
  143. package/lib/parameters/infra-parameter-validate.js +67 -19
  144. package/lib/resolvers/datasource-resolver.js +53 -0
  145. package/lib/resolvers/dimension-file.js +52 -0
  146. package/lib/resolvers/manifest-resolver.js +133 -0
  147. package/lib/schema/external-datasource.schema.json +183 -53
  148. package/lib/schema/external-system.schema.json +23 -10
  149. package/lib/schema/infra.parameter.yaml +26 -11
  150. package/lib/schema/wizard-config.schema.json +2 -2
  151. package/lib/utils/aifabrix-config-dir-walk.js +40 -0
  152. package/lib/utils/aifabrix-runtime-config-dir.js +26 -3
  153. package/lib/utils/app-run-containers.js +2 -2
  154. package/lib/utils/bash-secret-env.js +59 -0
  155. package/lib/utils/cli-secrets-error-format.js +78 -0
  156. package/lib/utils/cli-test-layout-chalk.js +31 -9
  157. package/lib/utils/cli-utils.js +4 -36
  158. package/lib/utils/datasource-test-run-display.js +8 -0
  159. package/lib/utils/dev-hosts-helper.js +3 -2
  160. package/lib/utils/dev-init-ssh-merge.js +2 -1
  161. package/lib/utils/docker-build.js +17 -9
  162. package/lib/utils/docker-reload-mount.js +127 -0
  163. package/lib/utils/external-readme.js +117 -4
  164. package/lib/utils/external-system-local-test-tty.js +3 -2
  165. package/lib/utils/external-system-readiness-core.js +45 -12
  166. package/lib/utils/external-system-readiness-deploy-display.js +3 -3
  167. package/lib/utils/external-system-readiness-display-internals.js +33 -3
  168. package/lib/utils/external-system-readiness-display.js +10 -1
  169. package/lib/utils/file-upload.js +40 -3
  170. package/lib/utils/health-check-db-init.js +107 -0
  171. package/lib/utils/health-check-public-warn.js +69 -0
  172. package/lib/utils/health-check-url.js +19 -4
  173. package/lib/utils/health-check.js +135 -105
  174. package/lib/utils/help-builder.js +5 -1
  175. package/lib/utils/image-name.js +34 -7
  176. package/lib/utils/integration-file-backup.js +74 -0
  177. package/lib/utils/mutagen-install.js +30 -3
  178. package/lib/utils/paths.js +108 -25
  179. package/lib/utils/postgres-wipe.js +212 -0
  180. package/lib/utils/register-aifabrix-shell-env.js +15 -0
  181. package/lib/utils/remote-dev-auth.js +21 -5
  182. package/lib/utils/remote-docker-env.js +9 -1
  183. package/lib/utils/remote-secrets-loader.js +42 -3
  184. package/lib/utils/resolve-docker-image-ref.js +9 -3
  185. package/lib/utils/secrets-ancestor-paths.js +47 -0
  186. package/lib/utils/secrets-helpers.js +17 -10
  187. package/lib/utils/secrets-kv-refs.js +42 -0
  188. package/lib/utils/secrets-kv-scope.js +19 -2
  189. package/lib/utils/secrets-materialize-local.js +134 -0
  190. package/lib/utils/secrets-path.js +24 -10
  191. package/lib/utils/secrets-utils.js +2 -2
  192. package/lib/utils/system-builder-root.js +34 -0
  193. package/lib/utils/url-declarative-resolve-build.js +6 -1
  194. package/lib/utils/url-declarative-runtime-base-path.js +32 -0
  195. package/lib/utils/url-declarative-vdir-inactive-env.js +2 -1
  196. package/lib/utils/urls-local-registry.js +73 -20
  197. package/lib/utils/validation-poll-ui.js +81 -0
  198. package/lib/utils/validation-run-poll.js +29 -5
  199. package/lib/utils/with-muted-logger.js +53 -0
  200. package/package.json +1 -1
  201. package/templates/applications/dataplane/application.yaml +1 -1
  202. package/templates/applications/dataplane/rbac.yaml +10 -10
  203. package/templates/applications/keycloak/env.template +8 -6
  204. package/templates/applications/miso-controller/application.yaml +7 -0
  205. package/templates/applications/miso-controller/env.template +7 -7
  206. package/templates/applications/miso-controller/rbac.yaml +9 -9
  207. package/templates/external-system/README.md.hbs +89 -102
  208. package/.nyc_output/55e9d034-ddab-4579-a706-e02a91d75c91.json +0 -1
  209. package/.nyc_output/processinfo/55e9d034-ddab-4579-a706-e02a91d75c91.json +0 -1
  210. package/.nyc_output/processinfo/index.json +0 -1
  211. package/lib/api/service-users.api.js +0 -150
  212. package/lib/api/types/service-users.types.js +0 -65
  213. package/lib/cli/setup-service-user.js +0 -187
  214. package/lib/commands/service-user.js +0 -429
@@ -50,7 +50,7 @@ Markdown headings in `layout.md` may use emoji for doc navigation; **user-facing
50
50
 
51
51
  - **Canonical helpers:** `lib/utils/cli-test-layout-chalk.js` (see symbol → helper table in [layout.md](./layout.md) § “Implementation map”).
52
52
  - **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.
53
+ - **Prefer** `formatSuccessLine`, `formatSuccessParagraph`, `formatWarningLine`, `formatBlockingError`, `failureGlyph`, `successGlyph`, and other exported section helpers over ad hoc `` chalk.green(`✔ …`) `` for one-off success/error lines.
54
54
  - **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
55
  - **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
56
 
@@ -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/.npmrc.token CHANGED
@@ -1 +1 @@
1
- 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
1
+ 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
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
- 1. **Start local infrastructure** (Postgres, Redis, optional Traefik):
45
+ **One-shot install:**
46
46
 
47
- ```bash
48
- aifabrix up-infra
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
- Or run platform apps separately: `aifabrix up-miso` then `aifabrix up-dataplane`. Infra must be up first.
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
- 3. **Configure secrets** You need either **OpenAI** or **Azure OpenAI**:
53
+ If you prefer to set the AI tool key outside the wizard, use one of:
62
54
 
63
- - **OpenAI:** set your API key:
64
- ```bash
65
- aifabrix secret set secrets-openaiApiKeyVault <your-openai-secret-key>
66
- ```
67
- - **Azure OpenAI:** set endpoint and API key:
68
- ```bash
69
- aifabrix secret set azure-openaiapi-urlKeyVault <your-azure-openai-endpoint-url>
70
- aifabrix secret set secrets-azureOpenaiApiKeyVault <your-azure-openai-secret-key>
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 only when the wizard failure is due to dataplane unreachable (no service).
800
- * Does not skip for auth/session errors when dataplane is up (so tests fail with the real error).
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
- throw new SkipTestError(`Wizard failed to create system: ${wizardResult.stderr}`);
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
@@ -57,28 +57,36 @@ const defaultProject = {
57
57
  '/tests/lib/utils/cli-utils.test.js',
58
58
  '/tests/lib/utils/external-system-display.test.js',
59
59
  '/tests/lib/utils/dev-hosts-helper.test.js',
60
- '/tests/lib/utils/declarative-url-matrix-d-reload.test.js',
60
+ '/tests/lib/utils/register-aifabrix-shell-env.test.js',
61
61
  '/tests/lib/utils/datasource-validation-watch.test.js',
62
62
  '\\\\tests\\\\lib\\\\utils\\\\cli-utils.test.js',
63
63
  '\\\\tests\\\\lib\\\\utils\\\\external-system-display.test.js',
64
64
  '\\\\tests\\\\lib\\\\utils\\\\dev-hosts-helper.test.js',
65
- '\\\\tests\\\\lib\\\\utils\\\\declarative-url-matrix-d-reload.test.js',
65
+ '\\\\tests\\\\lib\\\\utils\\\\register-aifabrix-shell-env.test.js',
66
66
  '\\\\tests\\\\lib\\\\utils\\\\datasource-validation-watch.test.js',
67
67
  'lib/utils/dev-hosts-helper.test.js',
68
- 'lib/utils/declarative-url-matrix-d-reload.test.js',
68
+ 'lib/utils/register-aifabrix-shell-env.test.js',
69
69
  'lib/utils/datasource-validation-watch.test.js',
70
70
  'dev-hosts-helper\\.test\\.js',
71
- 'declarative-url-matrix-d-reload\\.test\\.js',
71
+ 'register-aifabrix-shell-env\\.test\\.js',
72
72
  '/tests/lib/datasource/log-viewer.test.js',
73
73
  '\\\\tests\\\\lib\\\\datasource\\\\log-viewer.test.js',
74
74
  'lib/datasource/log-viewer.test.js',
75
75
  '/tests/lib/datasource/log-viewer-structural.test.js',
76
+ '/tests/lib/datasource/log-viewer-run.test.js',
76
77
  '\\\\tests\\\\lib\\\\datasource\\\\log-viewer-structural.test.js',
78
+ '\\\\tests\\\\lib\\\\datasource\\\\log-viewer-run.test.js',
77
79
  'lib/datasource/log-viewer-structural.test.js',
80
+ 'lib/datasource/log-viewer-run.test.js',
81
+ 'log-viewer-run\\.test\\.js',
78
82
  '/tests/lib/commands/parameters-validate.test.js',
79
83
  '\\\\tests\\\\lib\\\\commands\\\\parameters-validate.test.js',
80
84
  'lib/commands/parameters-validate.test.js',
81
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',
82
90
  '/tests/lib/utils/datasource-test-run-schema-sync.test.js',
83
91
  '\\\\tests\\\\lib\\\\utils\\\\datasource-test-run-schema-sync.test.js',
84
92
  'lib/utils/datasource-test-run-schema-sync.test.js',
@@ -153,10 +161,14 @@ const defaultProject = {
153
161
  '\\\\tests\\\\lib\\\\utils\\\\paths-app-listing.test.js',
154
162
  'lib/utils/paths-app-listing.test.js',
155
163
  'paths-app-listing\\.test\\.js',
156
- '/tests/lib/utils/url-declarative-truth-table-124.test.js',
157
- '\\\\tests\\\\lib\\\\utils\\\\url-declarative-truth-table-124.test.js',
158
- 'lib/utils/url-declarative-truth-table-124.test.js',
159
- 'url-declarative-truth-table-124\\.test\\.js',
164
+ '/tests/lib/utils/paths-system-builder-resolution.test.js',
165
+ '\\\\tests\\\\lib\\\\utils\\\\paths-system-builder-resolution.test.js',
166
+ 'lib/utils/paths-system-builder-resolution.test.js',
167
+ 'paths-system-builder-resolution\\.test\\.js',
168
+ '/tests/lib/utils/secrets-ancestor-paths.test.js',
169
+ '\\\\tests\\\\lib\\\\utils\\\\secrets-ancestor-paths.test.js',
170
+ 'lib/utils/secrets-ancestor-paths.test.js',
171
+ 'secrets-ancestor-paths\\.test\\.js',
160
172
  '/tests/lib/generator/generator-external-rbac.test.js',
161
173
  '\\\\tests\\\\lib\\\\generator\\\\generator-external-rbac.test.js',
162
174
  'lib/generator/generator-external-rbac.test.js',
@@ -200,9 +212,33 @@ const defaultProject = {
200
212
  '/tests/lib/app/app.test.js',
201
213
  '\\\\tests\\\\lib\\\\app\\\\app.test.js',
202
214
  'lib/app/app.test.js',
215
+ '/tests/lib/templates/application-frontdoor-paths.contract.test.js',
216
+ '\\\\tests\\\\lib\\\\templates\\\\application-frontdoor-paths.contract.test.js',
217
+ 'lib/templates/application-frontdoor-paths.contract.test.js',
218
+ 'application-frontdoor-paths\\.contract\\.test\\.js',
203
219
  '/tests/lib/core/admin-secrets.test.js',
204
220
  '\\\\tests\\\\lib\\\\core\\\\admin-secrets.test.js',
205
- 'lib/core/admin-secrets.test.js'
221
+ 'lib/core/admin-secrets.test.js',
222
+ '/tests/lib/datasource/validate-datasource-parsed.test.js',
223
+ '\\\\tests\\\\lib\\\\datasource\\\\validate-datasource-parsed.test.js',
224
+ 'lib/datasource/validate-datasource-parsed.test.js',
225
+ 'validate-datasource-parsed\\.test\\.js',
226
+ '/tests/lib/datasource/run-capability-copy.test.js',
227
+ '\\\\tests\\\\lib\\\\datasource\\\\run-capability-copy.test.js',
228
+ 'lib/datasource/run-capability-copy.test.js',
229
+ 'run-capability-copy\\.test\\.js',
230
+ '/tests/lib/datasource/run-capability-diff.test.js',
231
+ '\\\\tests\\\\lib\\\\datasource\\\\run-capability-diff.test.js',
232
+ 'lib/datasource/run-capability-diff.test.js',
233
+ 'run-capability-diff\\.test\\.js',
234
+ '/tests/lib/datasource/run-capability-edit.test.js',
235
+ '\\\\tests\\\\lib\\\\datasource\\\\run-capability-edit.test.js',
236
+ 'lib/datasource/run-capability-edit.test.js',
237
+ 'run-capability-edit\\.test\\.js',
238
+ '/tests/lib/datasource/run-capability-remove.test.js',
239
+ '\\\\tests\\\\lib\\\\datasource\\\\run-capability-remove.test.js',
240
+ 'lib/datasource/run-capability-remove.test.js',
241
+ 'run-capability-remove\\.test\\.js'
206
242
  ];
207
243
  if (process.env.INCLUDE_LOCAL_TESTS !== 'true') {
208
244
  patterns.push('/tests/local/');
@@ -221,17 +257,23 @@ const isolatedProjects = [
221
257
  makeIsolatedProject('cli-utils', ['**/tests/lib/utils/cli-utils.test.js']),
222
258
  makeIsolatedProject('external-system-display', ['**/tests/lib/utils/external-system-display.test.js']),
223
259
  makeIsolatedProject('dev-hosts-helper', ['**/tests/lib/utils/dev-hosts-helper.test.js']),
224
- makeIsolatedProject('declarative-url-matrix-d-reload', [
225
- '**/tests/lib/utils/declarative-url-matrix-d-reload.test.js'
226
- ]),
227
260
  makeIsolatedProject('parameters-validate', ['**/tests/lib/commands/parameters-validate.test.js']),
261
+ makeIsolatedProject('repair-openapi-sync', ['**/tests/lib/commands/repair-openapi-sync.test.js']),
228
262
  makeIsolatedProject('paths-app-listing', ['**/tests/lib/utils/paths-app-listing.test.js']),
263
+ makeIsolatedProject('paths-system-builder-resolution', [
264
+ '**/tests/lib/utils/paths-system-builder-resolution.test.js'
265
+ ]),
266
+ makeIsolatedProject('secrets-ancestor-paths', ['**/tests/lib/utils/secrets-ancestor-paths.test.js']),
229
267
  makeIsolatedProject('datasource-validation-watch', [
230
268
  '**/tests/lib/utils/datasource-validation-watch.test.js'
231
269
  ]),
232
270
  makeIsolatedProject('log-viewer', [
233
271
  '**/tests/lib/datasource/log-viewer.test.js',
234
- '**/tests/lib/datasource/log-viewer-structural.test.js'
272
+ '**/tests/lib/datasource/log-viewer-structural.test.js',
273
+ '**/tests/lib/datasource/log-viewer-run.test.js'
274
+ ]),
275
+ makeIsolatedProject('register-aifabrix-shell-env', [
276
+ '**/tests/lib/utils/register-aifabrix-shell-env.test.js'
235
277
  ]),
236
278
  makeIsolatedProject('datasource-test-run-schema-sync', [
237
279
  '**/tests/lib/utils/datasource-test-run-schema-sync.test.js'
@@ -239,6 +281,9 @@ const isolatedProjects = [
239
281
  makeIsolatedProject('infra-platform-contract', [
240
282
  '**/tests/lib/parameters/infra-platform-contract.test.js'
241
283
  ]),
284
+ makeIsolatedProject('application-frontdoor-paths-contract', [
285
+ '**/tests/lib/templates/application-frontdoor-paths.contract.test.js'
286
+ ]),
242
287
  makeIsolatedProject('database-secret-values', [
243
288
  '**/tests/lib/parameters/database-secret-values.test.js'
244
289
  ]),
@@ -283,9 +328,6 @@ const isolatedProjects = [
283
328
  makeIsolatedProject('helpers-ensure-admin-secrets', [
284
329
  '**/tests/lib/infrastructure/helpers-ensure-admin-secrets.test.js'
285
330
  ]),
286
- makeIsolatedProject('url-declarative-truth-table-124', [
287
- '**/tests/lib/utils/url-declarative-truth-table-124.test.js'
288
- ]),
289
331
  makeIsolatedProject('secrets-generator', ['**/tests/lib/utils/secrets-generator.test.js']),
290
332
  makeIsolatedProject('app-uncovered-lines', ['**/tests/lib/app/app-uncovered-lines.test.js']),
291
333
  makeIsolatedProject('ensure-dev-certs-for-remote-docker', [
@@ -297,7 +339,16 @@ const isolatedProjects = [
297
339
  makeIsolatedProject('schema-241-alignment', ['**/tests/lib/validation/schema-241-alignment.test.js']),
298
340
  makeIsolatedProject('schema-resolver-order', ['**/tests/lib/utils/schema-resolver-order.test.js']),
299
341
  makeIsolatedProject('app-module', ['**/tests/lib/app/app.test.js']),
300
- makeIsolatedProject('admin-secrets', ['**/tests/lib/core/admin-secrets.test.js'])
342
+ makeIsolatedProject('admin-secrets', ['**/tests/lib/core/admin-secrets.test.js']),
343
+ makeIsolatedProject('validate-datasource-parsed', [
344
+ '**/tests/lib/datasource/validate-datasource-parsed.test.js'
345
+ ]),
346
+ makeIsolatedProject('capability-run-real-fs', [
347
+ '**/tests/lib/datasource/run-capability-copy.test.js',
348
+ '**/tests/lib/datasource/run-capability-diff.test.js',
349
+ '**/tests/lib/datasource/run-capability-edit.test.js',
350
+ '**/tests/lib/datasource/run-capability-remove.test.js'
351
+ ])
301
352
  ];
302
353
 
303
354
  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