@aifabrix/builder 2.53.1 → 2.55.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/README.md +8 -0
- package/bin/aifabrix.js +2 -2
- package/lib/agent-kit/apply-ops.js +82 -0
- package/lib/agent-kit/checksums.js +28 -0
- package/lib/agent-kit/classify.js +113 -0
- package/lib/agent-kit/claude-shim.js +61 -0
- package/lib/agent-kit/constants.js +55 -0
- package/lib/agent-kit/file-list.js +103 -0
- package/lib/agent-kit/host-approve.js +130 -0
- package/lib/agent-kit/hosting/github.js +63 -0
- package/lib/agent-kit/hosts.js +71 -0
- package/lib/agent-kit/init.js +319 -0
- package/lib/agent-kit/kit-root.js +17 -0
- package/lib/agent-kit/managed-section.js +79 -0
- package/lib/agent-kit/package-load.js +45 -0
- package/lib/agent-kit/plan-ops.js +69 -0
- package/lib/agent-kit/remote-prompts.js +239 -0
- package/lib/agent-kit/render-host-markdown.js +40 -0
- package/lib/agent-kit/repo-guard.js +47 -0
- package/lib/agent-kit/report.js +107 -0
- package/lib/agent-kit/run.js +82 -0
- package/lib/agent-kit/scm/git.js +122 -0
- package/lib/agent-kit/state-file.js +83 -0
- package/lib/agent-kit/status.js +50 -0
- package/lib/agent-kit/v1-detect.js +81 -0
- package/lib/agent-kit/validate-kit.js +87 -0
- package/lib/agent-kit/workspace-name.js +40 -0
- package/lib/agent-kit/workspace-skeleton.js +103 -0
- package/lib/api/assistants.api.js +8 -5
- package/lib/api/channel-identity.api.js +41 -0
- package/lib/api/evidence-authoring.api.js +5 -1
- package/lib/api/evidence.api.js +2 -0
- package/lib/api/role-assistant-test-pack.api.js +86 -0
- package/lib/api/types/evidence.types.js +2 -0
- package/lib/api/work-search.api.js +163 -0
- package/lib/api/work.api.js +19 -12
- package/lib/app/list-external-systems.js +2 -1
- package/lib/app/show-display.js +33 -6
- package/lib/app/show.js +25 -2
- package/lib/channels/add-channel.js +164 -126
- package/lib/channels/approval-guides/chatgpt.js +14 -18
- package/lib/channels/approval-guides/claude.js +29 -0
- package/lib/channels/approval-guides/index.js +88 -22
- package/lib/channels/approval-guides/mcp-client.js +27 -0
- package/lib/channels/approval-guides/microsoft-copilot.js +52 -3
- package/lib/channels/approval-guides/slack.js +10 -10
- package/lib/channels/approval-guides/teams-bot.js +8 -12
- package/lib/channels/channel-add-continuations.js +91 -0
- package/lib/channels/channel-add-ensure.js +124 -27
- package/lib/channels/channel-add-existing.js +160 -28
- package/lib/channels/channel-add-failure.js +61 -0
- package/lib/channels/channel-add-remaining.js +492 -0
- package/lib/channels/channel-add-tty.js +190 -0
- package/lib/channels/channel-add-wizard-config.js +138 -0
- package/lib/channels/channel-add-wizard.js +250 -0
- package/lib/channels/channel-artifact-generator.js +27 -13
- package/lib/channels/channel-cardinality.js +83 -0
- package/lib/channels/channel-catalog-icon.js +45 -0
- package/lib/channels/channel-cli-instructions.js +75 -0
- package/lib/channels/channel-configuration-map.js +213 -0
- package/lib/channels/channel-credential.js +11 -14
- package/lib/channels/channel-definition-project.js +101 -0
- package/lib/channels/channel-definition-registry.js +154 -0
- package/lib/channels/channel-definition-status.js +115 -0
- package/lib/channels/channel-description.js +60 -2
- package/lib/channels/channel-discovery.js +16 -2
- package/lib/channels/channel-external-system.js +86 -9
- package/lib/channels/channel-install-envelope-actions.js +88 -0
- package/lib/channels/channel-install-envelope-microsoft.js +155 -0
- package/lib/channels/channel-install-envelope.js +358 -0
- package/lib/channels/channel-install-help-md.js +172 -0
- package/lib/channels/channel-install-http-payload.js +62 -0
- package/lib/channels/channel-install-inventory.js +115 -0
- package/lib/channels/channel-install-profiles.js +90 -0
- package/lib/channels/channel-instance-collision.js +118 -0
- package/lib/channels/channel-instance-key.js +100 -0
- package/lib/channels/channel-instance-materialize.js +240 -0
- package/lib/channels/channel-integration-generator.js +18 -9
- package/lib/channels/channel-integration-template.js +101 -22
- package/lib/channels/channel-inventory-fetch.js +79 -0
- package/lib/channels/channel-oauth-preflight.js +104 -0
- package/lib/channels/channel-package-version.js +76 -0
- package/lib/channels/channel-predefined-client.js +154 -0
- package/lib/channels/channel-probe.js +7 -2
- package/lib/channels/channel-runtime-resolver.js +194 -72
- package/lib/channels/channel-status-display.js +86 -16
- package/lib/channels/channel-targets.js +132 -92
- package/lib/channels/chatgpt-callback.js +318 -0
- package/lib/channels/chatgpt-channel-add.js +229 -0
- package/lib/channels/chatgpt-preflight.js +396 -0
- package/lib/channels/chatgpt-runtime-contract.js +17 -0
- package/lib/channels/chatgpt-setup-values.js +124 -0
- package/lib/channels/claude-callback.js +67 -0
- package/lib/channels/claude-channel-add.js +254 -0
- package/lib/channels/claude-runtime-contract.js +40 -0
- package/lib/channels/claude-runtime.js +58 -0
- package/lib/channels/claude-setup-values.js +92 -0
- package/lib/channels/mcp-client/config-merge.js +148 -0
- package/lib/channels/mcp-client/ensure-client.js +231 -0
- package/lib/channels/mcp-client/paths.js +53 -0
- package/lib/channels/mcp-client/profiles.js +122 -0
- package/lib/channels/mcp-client/redirect-uris.js +99 -0
- package/lib/channels/mcp-client/runtime.js +59 -0
- package/lib/channels/mcp-client-channel-add.js +186 -0
- package/lib/channels/microsoft-copilot-channel-add.js +117 -7
- package/lib/channels/microsoft-copilot-entra-identifier-uris.js +187 -0
- package/lib/channels/microsoft-copilot-entra-sso-form.js +106 -18
- package/lib/channels/microsoft-copilot-entra-sso.js +31 -2
- package/lib/channels/microsoft-copilot-package-prior.js +107 -0
- package/lib/channels/microsoft-copilot-package.js +29 -28
- package/lib/channels/microsoft-provisioning/a365.js +80 -0
- package/lib/channels/microsoft-provisioning/auth-config.js +240 -0
- package/lib/channels/microsoft-provisioning/auth.js +179 -0
- package/lib/channels/microsoft-provisioning/cli.js +71 -0
- package/lib/channels/microsoft-provisioning/constants.js +75 -0
- package/lib/channels/microsoft-provisioning/errors.js +117 -0
- package/lib/channels/microsoft-provisioning/index.js +55 -0
- package/lib/channels/microsoft-provisioning/install-atk.js +158 -0
- package/lib/channels/microsoft-provisioning/install-teams.js +115 -0
- package/lib/channels/microsoft-provisioning/login-portal-device.js +236 -0
- package/lib/channels/microsoft-provisioning/login-portal-parse.js +71 -0
- package/lib/channels/microsoft-provisioning/login-portal-teams.js +193 -0
- package/lib/channels/microsoft-provisioning/login-portal.js +230 -0
- package/lib/channels/microsoft-provisioning/persist.js +110 -0
- package/lib/channels/microsoft-provisioning/teams-bot-args.js +119 -0
- package/lib/channels/microsoft-provisioning/teams-bot-controller.js +123 -0
- package/lib/channels/microsoft-provisioning/teams-bot-parse.js +134 -0
- package/lib/channels/microsoft-provisioning/teams-bot-persist.js +113 -0
- package/lib/channels/microsoft-provisioning/teams-bot-provision.js +234 -0
- package/lib/channels/microsoft-provisioning/teams-bot-secrets.js +45 -0
- package/lib/channels/microsoft-provisioning/teams-cli.js +82 -0
- package/lib/channels/runtime-tool-catalog.js +5 -2
- package/lib/channels/slack-channel-add-portal.js +130 -0
- package/lib/channels/slack-channel-add-tty-auth.js +95 -0
- package/lib/channels/slack-channel-add.js +311 -0
- package/lib/channels/slack-mcp-callback.js +51 -0
- package/lib/channels/slack-mcp-runtime.js +156 -0
- package/lib/channels/slack-provisioning/apps.js +181 -0
- package/lib/channels/slack-provisioning/auth-store.js +110 -0
- package/lib/channels/slack-provisioning/auth-ticket.js +185 -0
- package/lib/channels/slack-provisioning/auth.js +115 -0
- package/lib/channels/slack-provisioning/callbacks.js +41 -0
- package/lib/channels/slack-provisioning/cli.js +226 -0
- package/lib/channels/slack-provisioning/constants.js +37 -0
- package/lib/channels/slack-provisioning/credentials.js +169 -0
- package/lib/channels/slack-provisioning/curl-shim.js +132 -0
- package/lib/channels/slack-provisioning/developer-install.js +118 -0
- package/lib/channels/slack-provisioning/env-file.js +120 -0
- package/lib/channels/slack-provisioning/errors.js +47 -0
- package/lib/channels/slack-provisioning/go-ca-bundle.js +137 -0
- package/lib/channels/slack-provisioning/index.js +250 -0
- package/lib/channels/slack-provisioning/install-cli.js +335 -0
- package/lib/channels/slack-provisioning/manifest.js +89 -0
- package/lib/channels/slack-provisioning/oauth-lock.js +33 -0
- package/lib/channels/slack-provisioning/offer-cli.js +113 -0
- package/lib/channels/slack-provisioning/onboard-members.js +122 -0
- package/lib/channels/slack-provisioning/onboard.js +89 -0
- package/lib/channels/slack-provisioning/persist.js +95 -0
- package/lib/channels/slack-provisioning/remaining-urls.js +158 -0
- package/lib/channels/slack-provisioning/with-curl-on-path.js +53 -0
- package/lib/channels/teams-bot-channel-add.js +94 -0
- package/lib/channels/vendor-dataplane-url.js +249 -0
- package/lib/cli/index.js +4 -0
- package/lib/cli/setup-certification-commands.js +2 -2
- package/lib/cli/setup-certification.help.js +5 -1
- package/lib/cli/setup-external-system-help.js +2 -0
- package/lib/cli/setup-external-system.js +1 -1
- package/lib/commands/agent-kit-help.js +79 -0
- package/lib/commands/agent-kit.js +346 -0
- package/lib/commands/channel-add-help.js +366 -0
- package/lib/commands/channel-add-setup.js +162 -80
- package/lib/commands/channel-configure.js +118 -0
- package/lib/commands/channel.js +10 -1
- package/lib/commands/datasource-capability-relate-cli.js +5 -4
- package/lib/commands/governance-upload-external.js +6 -3
- package/lib/commands/lifecycle-command-action.js +2 -5
- package/lib/commands/lifecycle-external.js +93 -21
- package/lib/commands/repair-auth-apply.js +1 -1
- package/lib/commands/repair-datasource-key-skip.js +39 -0
- package/lib/commands/repair-datasource-keys.js +24 -12
- package/lib/commands/repair-datasource-test-payload.js +4 -2
- package/lib/commands/repair-datasource-webhooks-sync-bridge.js +23 -2
- package/lib/commands/repair-datasource.js +3 -0
- package/lib/commands/repair-external-run.js +59 -25
- package/lib/commands/repair-openapi-rest-runtime.js +127 -0
- package/lib/commands/repair-orchestration-tag-merge.js +339 -0
- package/lib/commands/repair-rbac-catalog-defaults.js +96 -0
- package/lib/commands/repair-rbac-platform-preset.js +26 -15
- package/lib/commands/repair-rbac-reader-roles.js +8 -21
- package/lib/commands/repair-rbac.js +26 -44
- package/lib/commands/repair-system-permissions.js +24 -22
- package/lib/commands/role-assistant-copy-output.js +61 -0
- package/lib/commands/role-assistant-copy.js +155 -0
- package/lib/commands/role-assistant-test-output.js +22 -9
- package/lib/commands/role-assistant-test-result-rows.js +42 -0
- package/lib/commands/role-assistant.js +150 -43
- package/lib/commands/search.js +143 -0
- package/lib/commands/test-e2e-external.js +148 -21
- package/lib/commands/test-trust-external.js +7 -5
- package/lib/commands/upload-credential-push-log.js +2 -1
- package/lib/commands/upload-publish-context.js +1 -1
- package/lib/commands/upload-role-assistant-shell.js +124 -0
- package/lib/commands/upload-sidecar-followups.js +10 -4
- package/lib/commands/upload.js +18 -3
- package/lib/commands/verify-operations-skip-e2e.js +131 -0
- package/lib/commands/verify-operations-step-plan.js +6 -33
- package/lib/commands/verify-operations-steps.js +3 -1
- package/lib/core/secrets-docker-env.js +4 -1
- package/lib/core/secrets-env-content.js +17 -3
- package/lib/datasource/capability/capability-manifest.js +0 -3
- package/lib/datasource/capability/copy-test-payload.js +3 -0
- package/lib/datasource/capability/relate-operations.js +28 -10
- package/lib/datasource/capability/run-capability-relate.js +48 -25
- package/lib/datasource/datasource-identifier.js +13 -5
- package/lib/deployment/deployer-poll-run.js +117 -35
- package/lib/external-system/deploy-dataplane-published.js +70 -0
- package/lib/external-system/deploy-helpers.js +26 -1
- package/lib/external-system/deploy.js +22 -8
- package/lib/external-system/download-helpers.js +29 -2
- package/lib/external-system/download-role-assistant.js +109 -4
- package/lib/external-system/download.js +46 -30
- package/lib/external-system/sync-deploy-manifest.js +3 -2
- package/lib/external-system/upload-identity.js +42 -0
- package/lib/generator/index.js +19 -15
- package/lib/generator/split.js +13 -2
- package/lib/generator/wizard-datasource-key.js +54 -0
- package/lib/generator/wizard.js +55 -54
- package/lib/integration-definition/apply-datasource-keys.js +75 -0
- package/lib/integration-definition/apply-relationships.js +195 -0
- package/lib/integration-definition/apply-static-enterprise.js +229 -0
- package/lib/integration-definition/apply-system-file.js +71 -0
- package/lib/integration-definition/apply-test-endpoint.js +89 -0
- package/lib/integration-definition/apply-viewpoint-defaults.js +157 -0
- package/lib/integration-definition/apply.js +78 -59
- package/lib/integration-definition/enrich-openapi-operations.js +36 -10
- package/lib/integration-definition/enrich-openapi-pick.js +87 -0
- package/lib/lifecycle/role-assistant-governance.js +181 -0
- package/lib/lifecycle/scenario-upload.js +181 -30
- package/lib/programmatic/builder-api-cors.js +143 -0
- package/lib/programmatic/builder-api-request.js +6 -0
- package/lib/programmatic/builder-api-route-dispatch.js +56 -42
- package/lib/programmatic/builder-api-server.js +8 -1
- package/lib/programmatic/capability-registry.js +55 -0
- package/lib/programmatic/channel-install-help-resolve.js +359 -0
- package/lib/programmatic/channel-install-session.js +218 -0
- package/lib/programmatic/help-content/channel-onboarding.md +2 -0
- package/lib/programmatic/help-content/cip-overview.md +3 -1
- package/lib/programmatic/http-raw-response.js +62 -0
- package/lib/programmatic/index.js +2 -0
- package/lib/programmatic/openapi-apply-result-schemas.js +8 -0
- package/lib/programmatic/openapi-channel-install-bindings.js +179 -0
- package/lib/programmatic/openapi-channel-install-schemas.js +289 -0
- package/lib/programmatic/openapi-component-schemas.js +19 -1
- package/lib/programmatic/openapi-description-enricher.js +3 -1
- package/lib/programmatic/openapi-descriptions.js +80 -3
- package/lib/programmatic/openapi-envelope-examples.js +124 -0
- package/lib/programmatic/openapi-operation-bindings.js +9 -1
- package/lib/programmatic/openapi-request-schemas.js +5 -0
- package/lib/programmatic/openapi-schema-descriptions-channel.js +319 -0
- package/lib/programmatic/openapi-schema-descriptions-operations.js +19 -0
- package/lib/programmatic/openapi-spec.js +13 -8
- package/lib/programmatic/platform-rbac-catalog.js +36 -18
- package/lib/programmatic/request-timeout.js +3 -0
- package/lib/programmatic/route-handler-map.js +58 -1
- package/lib/programmatic/route-handlers-context.js +2 -1
- package/lib/programmatic/run-auth-permissions.js +54 -0
- package/lib/programmatic/run-channel-catalog.js +238 -0
- package/lib/programmatic/run-channel-install-artifacts.js +137 -0
- package/lib/programmatic/run-channel-install-copilot.js +353 -0
- package/lib/programmatic/run-channel-install-options.js +236 -0
- package/lib/programmatic/run-channel-install-teams-bot.js +204 -0
- package/lib/programmatic/run-channel-install.js +346 -0
- package/lib/programmatic/run-channel-package.js +87 -7
- package/lib/programmatic/run-download.js +41 -0
- package/lib/programmatic/workspace-context.js +2 -0
- package/lib/protection/auth-context.js +3 -1
- package/lib/protection/protection-display.js +3 -2
- package/lib/protection/report-exit.js +50 -0
- package/lib/protection/run-commands.js +2 -0
- package/lib/role-assistant/evidence-sync.js +4 -2
- package/lib/role-assistant/evidence-validation-issues.js +51 -0
- package/lib/role-assistant/knowledge-sync.js +10 -4
- package/lib/role-assistant/package-validate.js +175 -0
- package/lib/role-assistant/settings.js +49 -2
- package/lib/role-assistant/test-case-assertion-row.js +36 -0
- package/lib/role-assistant/test-case-copy-bind.js +77 -0
- package/lib/role-assistant/test-case-copy-expected.js +127 -0
- package/lib/role-assistant/test-case-copy-from-work.js +90 -0
- package/lib/role-assistant/test-case-copy-interactions.js +67 -0
- package/lib/role-assistant/test-case-copy.js +119 -0
- package/lib/role-assistant/test-case-expected-catalog.js +135 -0
- package/lib/role-assistant/test-case-validate.js +88 -0
- package/lib/role-assistant/test-cases-bid.js +117 -4
- package/lib/role-assistant/test-cases-evaluate.js +159 -24
- package/lib/role-assistant/test-cases-evidence.js +175 -0
- package/lib/role-assistant/test-cases-honesty.js +155 -6
- package/lib/role-assistant/test-cases-lifecycle.js +291 -0
- package/lib/role-assistant/test-cases-search-graph.js +122 -0
- package/lib/role-assistant/test-cases-search.js +247 -0
- package/lib/role-assistant/test-cases.js +71 -172
- package/lib/role-assistant/test-pack-map.js +180 -0
- package/lib/role-assistant/test-pack-sync.js +187 -0
- package/lib/role-assistant/test-runner-debug.js +54 -0
- package/lib/role-assistant/test-runner-respond-body.js +36 -0
- package/lib/role-assistant/test-runner-search.js +164 -0
- package/lib/role-assistant/test-runner-start-payload.js +63 -10
- package/lib/role-assistant/test-runner-workhub-answers.js +45 -16
- package/lib/role-assistant/test-runner-workhub-helpers.js +40 -2
- package/lib/role-assistant/test-runner-workhub-soft.js +9 -3
- package/lib/role-assistant/test-runner-workhub.js +74 -32
- package/lib/role-assistant/test-runner.js +66 -11
- package/lib/schema/external-datasource.schema.json +146 -21
- package/lib/schema/external-system.schema.json +177 -2
- package/lib/schema/mcp-client-profile.schema.json +103 -0
- package/lib/schema/role-assistant-test-case.schema.json +408 -0
- package/lib/search/dataplane-context.js +23 -0
- package/lib/search/search-args.js +211 -0
- package/lib/search/search-display.js +238 -0
- package/lib/search/search-errors.js +50 -0
- package/lib/search/search-prompts.js +119 -0
- package/lib/search/search-roles.js +85 -0
- package/lib/search/search-run.js +241 -0
- package/lib/search/search-skills.js +198 -0
- package/lib/utils/app-path-resolve.js +4 -0
- package/lib/utils/authentication-env-template.js +44 -6
- package/lib/utils/authentication-slot-show.js +153 -0
- package/lib/utils/credential-display.js +43 -1
- package/lib/utils/credential-secrets-env.js +6 -1
- package/lib/utils/env-copy.js +19 -7
- package/lib/utils/external-env-template.js +20 -2
- package/lib/utils/external-system-readiness-compact-blocks.js +5 -1
- package/lib/utils/external-system-readiness-compact-display.js +30 -1
- package/lib/utils/external-system-validators.js +2 -1
- package/lib/utils/help-builder.js +3 -1
- package/lib/utils/paths.js +18 -1
- package/lib/utils/platform-shell-package.js +69 -0
- package/lib/utils/port-resolver.js +50 -1
- package/lib/utils/rewrite-name-flag.js +20 -0
- package/lib/utils/role-assistant-paths.js +13 -10
- package/lib/utils/schema-loader.js +37 -0
- package/lib/utils/schema-resolver.js +11 -1
- package/lib/utils/secrets-helpers.js +12 -21
- package/lib/utils/token-manager.js +10 -5
- package/lib/validation/validate-external-file.js +5 -1
- package/lib/validation/validate.js +41 -0
- package/package.json +1 -1
- package/templates/README.md +1 -1
- package/templates/agent-kit/adapters/claude/nested.CLAUDE.md +1 -0
- package/templates/agent-kit/adapters/claude/root.CLAUDE.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-0-plan.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-1-validate.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-2-build.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-3-push.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-biz-1-validate.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-biz-2-build.md +5 -0
- package/templates/agent-kit/adapters/cursor/commands/cust-biz-3-prove.md +5 -0
- package/templates/agent-kit/agent-kit.yaml +45 -0
- package/templates/agent-kit/instructions/AGENTKIT.md +83 -0
- package/templates/agent-kit/instructions/integration.AGENTS.md +25 -0
- package/templates/agent-kit/instructions/role-assistant.AGENTS.md +22 -0
- package/templates/agent-kit/instructions/root.AGENTS.md +37 -0
- package/templates/agent-kit/parity-inventory.yaml +188 -0
- package/templates/agent-kit/skills/aifabrix-connected-system/SKILL.md +58 -0
- package/templates/agent-kit/skills/aifabrix-connected-system/references/contract-checklist.md +40 -0
- package/templates/agent-kit/skills/aifabrix-connected-system/references/delivery-gates.md +54 -0
- package/templates/agent-kit/skills/aifabrix-connected-system/references/production-safety.md +35 -0
- package/templates/agent-kit/skills/aifabrix-connected-system/scripts/reserved-system-key.js +19 -0
- package/templates/agent-kit/skills/aifabrix-plan/SKILL.md +51 -0
- package/templates/agent-kit/skills/aifabrix-plan/references/challenge-checklist.md +108 -0
- package/templates/agent-kit/skills/aifabrix-plan/references/interaction.md +34 -0
- package/templates/agent-kit/skills/aifabrix-plan/references/plan-template.md +182 -0
- package/templates/agent-kit/skills/aifabrix-prove/SKILL.md +50 -0
- package/templates/agent-kit/skills/aifabrix-prove/references/demo-template.md +65 -0
- package/templates/agent-kit/skills/aifabrix-prove/references/evidence-lifecycle.md +68 -0
- package/templates/agent-kit/skills/aifabrix-prove/references/learning-template.md +66 -0
- package/templates/agent-kit/skills/aifabrix-role-assistant/SKILL.md +42 -0
- package/templates/agent-kit/skills/aifabrix-role-assistant/references/package-boundary.md +21 -0
- package/templates/agent-kit/skills/shared/hosts.md +78 -0
- package/templates/agent-kit/workspace/.cursor/plans/README.md +22 -0
- package/templates/agent-kit/workspace/LICENSE.mit +21 -0
- package/templates/agent-kit/workspace/README.md +89 -0
- package/templates/applications/builder-api/Dockerfile +3 -1
- package/templates/applications/builder-api/env.template +7 -0
- package/templates/applications/dataplane/application.yaml +6 -5
- package/templates/applications/dataplane/env.template +2 -2
- package/templates/applications/dataplane/rbac.yaml +35 -2
- package/templates/applications/keycloak/Dockerfile +30 -4
- package/templates/applications/keycloak/application.yaml +2 -2
- package/templates/applications/keycloak/cimd-lenient-parse/AbstractClientIdMetadataDocumentExecutor.java +896 -0
- package/templates/applications/keycloak/cimd-lenient-parse/SOURCE.md +19 -0
- package/templates/applications/keycloak/env.template +3 -0
- package/templates/applications/miso-controller/application.yaml +1 -2
- package/templates/applications/miso-controller/env.template +10 -9
- package/templates/channels/README.md +5 -5
- package/templates/channels/chatgpt/TROUBLESHOOTING.md +51 -0
- package/templates/channels/chatgpt/channel.json +59 -0
- package/templates/channels/chatgpt/icon.svg +1 -0
- package/templates/channels/chatgpt/install.template.md.hbs +20 -95
- package/templates/channels/chatgpt/integration/README.md +1 -1
- package/templates/channels/chatgpt/integration/application.json +2 -2
- package/templates/channels/chatgpt/integration/chatgpt-system.json +49 -4
- package/templates/channels/chatgpt/integration/env.template +2 -4
- package/templates/channels/chatgpt/integration/rbac.json +13 -0
- package/templates/channels/claude/TROUBLESHOOTING.md +44 -0
- package/templates/channels/claude/channel.json +59 -0
- package/templates/channels/claude/icon.svg +1 -0
- package/templates/channels/claude/install.template.md.hbs +22 -0
- package/templates/channels/claude/integration/README.md +14 -0
- package/templates/channels/claude/integration/application.json +15 -0
- package/templates/channels/claude/integration/claude-system.json +59 -0
- package/templates/channels/claude/integration/env.template +2 -0
- package/templates/channels/claude/integration/rbac.json +13 -0
- package/templates/channels/claude/manifest.template.json.hbs +40 -0
- package/templates/channels/mcp-client/channel.json +72 -0
- package/templates/channels/mcp-client/icon.svg +1 -0
- package/templates/channels/mcp-client/install.template.md.hbs +24 -0
- package/templates/channels/mcp-client/integration/README.md +13 -0
- package/templates/channels/mcp-client/integration/application.json +15 -0
- package/templates/channels/mcp-client/integration/env.template +2 -0
- package/templates/channels/mcp-client/integration/mcp-client-system.json +72 -0
- package/templates/channels/mcp-client/integration/rbac.json +13 -0
- package/templates/channels/mcp-client/manifest.template.json.hbs +41 -0
- package/templates/channels/mcp-client/profiles/cursor.json +26 -0
- package/templates/channels/mcp-client/profiles/github-copilot.json +29 -0
- package/templates/channels/mcp-client/profiles/vscode.json +29 -0
- package/templates/channels/microsoft-copilot/channel.json +73 -0
- package/templates/channels/microsoft-copilot/declarative-agent.template.json.hbs +8 -4
- package/templates/channels/microsoft-copilot/entra-sso-registration.template.md.hbs +65 -5
- package/templates/channels/microsoft-copilot/icon.svg +1 -0
- package/templates/channels/microsoft-copilot/install.template.md.hbs +9 -9
- package/templates/channels/microsoft-copilot/integration/README.md +1 -1
- package/templates/channels/microsoft-copilot/integration/application.json +2 -2
- package/templates/channels/microsoft-copilot/integration/env.template +3 -6
- package/templates/channels/microsoft-copilot/integration/microsoft-copilot-system.json +63 -4
- package/templates/channels/microsoft-copilot/integration/rbac.json +13 -0
- package/templates/channels/microsoft-copilot/oauth-plugin-vault-required.template.md.hbs +5 -5
- package/templates/channels/slack/channel.json +234 -0
- package/templates/channels/slack/icon.svg +1 -0
- package/templates/channels/slack/install.template.md.hbs +45 -28
- package/templates/channels/slack/integration/README.md +245 -22
- package/templates/channels/slack/integration/application.json +44 -7
- package/templates/channels/slack/integration/env.template +15 -6
- package/templates/channels/slack/integration/openapi/openapi.json +126 -0
- package/templates/channels/slack/integration/rbac.json +84 -0
- package/templates/channels/slack/integration/slack-datasource-commands.json +154 -0
- package/templates/channels/slack/integration/slack-datasource-conversations.json +28 -3
- package/templates/channels/slack/integration/slack-datasource-events.json +154 -0
- package/templates/channels/slack/integration/slack-datasource-interactive.json +154 -0
- package/templates/channels/slack/integration/slack-datasource-messages.json +40 -2
- package/templates/channels/slack/integration/slack-system.json +161 -72
- package/templates/channels/slack/manifest.template.json.hbs +10 -4
- package/templates/channels/teams-bot/channel.json +162 -0
- package/templates/channels/teams-bot/icon.svg +1 -0
- package/templates/channels/teams-bot/install.template.md.hbs +12 -13
- package/templates/channels/teams-bot/integration/README.md +5 -4
- package/templates/channels/teams-bot/integration/application.json +6 -4
- package/templates/channels/teams-bot/integration/env.template +5 -4
- package/templates/channels/teams-bot/integration/openapi/openapi.json +68 -0
- package/templates/channels/teams-bot/integration/rbac.json +21 -0
- package/templates/channels/teams-bot/integration/teams-bot-datasource-activities.json +154 -0
- package/templates/channels/teams-bot/integration/teams-bot-system.json +128 -23
- package/templates/channels/web-embed/channel.json +60 -0
- package/templates/channels/web-embed/install.template.md.hbs +1 -1
- package/templates/channels/web-embed/integration/README.md +2 -2
- package/templates/channels/web-embed/integration/application.json +2 -2
- package/templates/channels/web-embed/integration/env.template +1 -1
- package/templates/channels/web-embed/integration/rbac.json +13 -0
- package/templates/channels/web-embed/integration/web-embed-system.json +50 -4
- package/templates/python/docker-compose.hbs +14 -0
- package/templates/typescript/docker-compose.hbs +14 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Viewpoint grain and inherited date filter keys for BID apply.
|
|
3
|
+
*
|
|
4
|
+
* @fileoverview Prefer joined storage resourceType; copy date filterable fields
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const { remapKey } = require('./apply-datasource-keys');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param {unknown} format
|
|
13
|
+
* @returns {boolean}
|
|
14
|
+
*/
|
|
15
|
+
function isDateFormat(format) {
|
|
16
|
+
const raw = String(format || '').toLowerCase();
|
|
17
|
+
return raw === 'date' || raw === 'date-time' || raw === 'datetime';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param {Record<string, unknown>} body
|
|
22
|
+
* @returns {string[]}
|
|
23
|
+
*/
|
|
24
|
+
function dateFilterableKeys(body) {
|
|
25
|
+
const props = body.metadataSchema && body.metadataSchema.properties;
|
|
26
|
+
if (!props || typeof props !== 'object') {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
const exposed = body.exposed && Array.isArray(body.exposed.filterable)
|
|
30
|
+
? body.exposed.filterable
|
|
31
|
+
: [];
|
|
32
|
+
const keys = [];
|
|
33
|
+
for (const [name, node] of Object.entries(props)) {
|
|
34
|
+
if (!node || typeof node !== 'object') {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (!isDateFormat(node.format)) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (exposed.includes(name) || node.filter === true) {
|
|
41
|
+
keys.push(name);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return keys;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @param {Record<string, unknown>} viewBody
|
|
49
|
+
* @param {Record<string, unknown>} factBody
|
|
50
|
+
* @returns {void}
|
|
51
|
+
*/
|
|
52
|
+
function copyOneDateField(viewBody, factBody, key, props, filterable) {
|
|
53
|
+
const src = factBody.metadataSchema.properties[key];
|
|
54
|
+
if (!props[key]) {
|
|
55
|
+
props[key] = { ...src, filter: true };
|
|
56
|
+
} else if (typeof props[key] === 'object') {
|
|
57
|
+
props[key].filter = true;
|
|
58
|
+
if (!props[key].format && src && src.format) {
|
|
59
|
+
props[key].format = src.format;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (!filterable.includes(key)) {
|
|
63
|
+
filterable.push(key);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function copyDateFilterableOntoView(viewBody, factBody) {
|
|
68
|
+
const keys = dateFilterableKeys(factBody);
|
|
69
|
+
if (keys.length === 0) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (!viewBody.metadataSchema || typeof viewBody.metadataSchema !== 'object') {
|
|
73
|
+
viewBody.metadataSchema = { type: 'object', properties: {} };
|
|
74
|
+
}
|
|
75
|
+
const schema = /** @type {Record<string, unknown>} */ (viewBody.metadataSchema);
|
|
76
|
+
if (!schema.properties || typeof schema.properties !== 'object') {
|
|
77
|
+
schema.properties = {};
|
|
78
|
+
}
|
|
79
|
+
const props = /** @type {Record<string, unknown>} */ (schema.properties);
|
|
80
|
+
if (!viewBody.exposed || typeof viewBody.exposed !== 'object') {
|
|
81
|
+
viewBody.exposed = {};
|
|
82
|
+
}
|
|
83
|
+
const exposed = /** @type {Record<string, unknown>} */ (viewBody.exposed);
|
|
84
|
+
const filterable = Array.isArray(exposed.filterable) ? [...exposed.filterable] : [];
|
|
85
|
+
for (const key of keys) {
|
|
86
|
+
copyOneDateField(viewBody, factBody, key, props, filterable);
|
|
87
|
+
}
|
|
88
|
+
exposed.filterable = filterable;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @param {Record<string, unknown>} body
|
|
93
|
+
* @returns {boolean}
|
|
94
|
+
*/
|
|
95
|
+
function isViewpointBody(body) {
|
|
96
|
+
const entityType = String(body.entityType || '');
|
|
97
|
+
const storageType = String(body.storageType || '');
|
|
98
|
+
return entityType === 'viewpoint' || storageType === 'view';
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @param {Array<{ body: Record<string, unknown> }>} dsFiles
|
|
103
|
+
* @returns {Map<string, Record<string, unknown>>}
|
|
104
|
+
*/
|
|
105
|
+
function bodiesByKey(dsFiles) {
|
|
106
|
+
const map = new Map();
|
|
107
|
+
for (const file of dsFiles || []) {
|
|
108
|
+
const key = String(file.body && file.body.key ? file.body.key : '').trim();
|
|
109
|
+
if (key) {
|
|
110
|
+
map.set(key, file.body);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return map;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @param {Array<{ body: Record<string, unknown> }>} dsFiles
|
|
118
|
+
* @param {unknown[]} relationships
|
|
119
|
+
* @param {Map<string, string>} keyMap
|
|
120
|
+
* @returns {void}
|
|
121
|
+
*/
|
|
122
|
+
function applyOneViewpoint(viewBody, rels, keyMap, bodies) {
|
|
123
|
+
const fromKey = String(viewBody.key || '');
|
|
124
|
+
const rel = rels.find((row) => row && remapKey(String(row.from || ''), keyMap) === fromKey);
|
|
125
|
+
if (!rel || typeof rel !== 'object') {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const factKey = remapKey(String(rel.to || ''), keyMap);
|
|
129
|
+
const factBody = bodies.get(factKey);
|
|
130
|
+
if (!factBody) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const factType = String(factBody.resourceType || '').trim();
|
|
134
|
+
const viewType = String(viewBody.resourceType || '').trim();
|
|
135
|
+
if (factType && (!viewType || viewType === 'document')) {
|
|
136
|
+
viewBody.resourceType = factType;
|
|
137
|
+
}
|
|
138
|
+
copyDateFilterableOntoView(viewBody, factBody);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function applyViewpointDefaults(dsFiles, relationships, keyMap) {
|
|
142
|
+
const bodies = bodiesByKey(dsFiles);
|
|
143
|
+
const rels = Array.isArray(relationships) ? relationships : [];
|
|
144
|
+
for (const file of dsFiles || []) {
|
|
145
|
+
const viewBody = file.body;
|
|
146
|
+
if (!viewBody || !isViewpointBody(viewBody)) {
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
applyOneViewpoint(viewBody, rels, keyMap, bodies);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
module.exports = {
|
|
154
|
+
applyViewpointDefaults,
|
|
155
|
+
dateFilterableKeys,
|
|
156
|
+
copyDateFilterableOntoView
|
|
157
|
+
};
|
|
@@ -9,6 +9,15 @@ const path = require('path');
|
|
|
9
9
|
const fsReal = require('../internal/fs-real-sync');
|
|
10
10
|
const { getIntegrationPath } = require('../utils/paths');
|
|
11
11
|
const { validateIntegrationDefinition } = require('./validate');
|
|
12
|
+
const {
|
|
13
|
+
canonicalDatasourceKeyMap,
|
|
14
|
+
datasourceFileName
|
|
15
|
+
} = require('./apply-datasource-keys');
|
|
16
|
+
const { applyBidRelationships } = require('./apply-relationships');
|
|
17
|
+
const { applyStaticAndEnterprise } = require('./apply-static-enterprise');
|
|
18
|
+
const { applyViewpointDefaults } = require('./apply-viewpoint-defaults');
|
|
19
|
+
const { stampCredentialTestEndpoint } = require('./apply-test-endpoint');
|
|
20
|
+
const { buildSystemFile } = require('./apply-system-file');
|
|
12
21
|
|
|
13
22
|
const STAMP_FILE = '.aifabrix-integration-definition.json';
|
|
14
23
|
|
|
@@ -96,6 +105,21 @@ function buildDatasourceSchema(labelField) {
|
|
|
96
105
|
};
|
|
97
106
|
}
|
|
98
107
|
|
|
108
|
+
function mergeBidSchemaProperties(body, ds) {
|
|
109
|
+
const extra = ds.metadataSchema && ds.metadataSchema.properties;
|
|
110
|
+
if (!extra || typeof extra !== 'object') {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (!body.metadataSchema || typeof body.metadataSchema !== 'object') {
|
|
114
|
+
body.metadataSchema = { type: 'object', properties: {} };
|
|
115
|
+
}
|
|
116
|
+
const schema = /** @type {Record<string, unknown>} */ (body.metadataSchema);
|
|
117
|
+
if (!schema.properties || typeof schema.properties !== 'object') {
|
|
118
|
+
schema.properties = {};
|
|
119
|
+
}
|
|
120
|
+
Object.assign(schema.properties, extra);
|
|
121
|
+
}
|
|
122
|
+
|
|
99
123
|
function enrichDatasourceFile(body, ds, enrichOptions) {
|
|
100
124
|
const { enrichDatasourceFromOpenApi } = require('./enrich-openapi-operations');
|
|
101
125
|
const openapiSourceRef =
|
|
@@ -133,6 +157,8 @@ function buildDatasourceFile(ds, systemKey, capabilities, sync, enrichOptions =
|
|
|
133
157
|
entityType: ds.entityType || 'recordStorage',
|
|
134
158
|
resourceType: ds.resourceType,
|
|
135
159
|
version: '1.0.0',
|
|
160
|
+
...(ds.storageType ? { storageType: ds.storageType } : {}),
|
|
161
|
+
...(ds.dimensions && typeof ds.dimensions === 'object' ? { dimensions: ds.dimensions } : {}),
|
|
136
162
|
capabilities: buildDatasourceCapabilities(caps, key),
|
|
137
163
|
// Schema sync is mode/schedule/batchSize only; BID sync.mode=incremental is operational intent.
|
|
138
164
|
sync: { mode: 'pull', schedule: /** @type {any} */ (sync).schedule || '0 */6 * * *', batchSize: 100 },
|
|
@@ -143,6 +169,7 @@ function buildDatasourceFile(ds, systemKey, capabilities, sync, enrichOptions =
|
|
|
143
169
|
// Mirror capabilities → openapi.operations + execution.cip.operations stubs (154.7).
|
|
144
170
|
repairSyncOperationsFromCapabilities(body, []);
|
|
145
171
|
seedPropertyKeysOnDatasource(body, ds.propertyKeys);
|
|
172
|
+
mergeBidSchemaProperties(body, ds);
|
|
146
173
|
enrichDatasourceFile(body, ds, enrichOptions);
|
|
147
174
|
return body;
|
|
148
175
|
}
|
|
@@ -192,42 +219,6 @@ function collectAssociationObjectTypes(datasources, systemOpenapiSourceRef, enri
|
|
|
192
219
|
return [...types];
|
|
193
220
|
}
|
|
194
221
|
|
|
195
|
-
/**
|
|
196
|
-
* @param {Record<string, unknown>} bid
|
|
197
|
-
* @returns {Record<string, unknown>}
|
|
198
|
-
*/
|
|
199
|
-
function buildSystemFile(bid) {
|
|
200
|
-
const system = /** @type {Record<string, unknown>} */ (bid.system);
|
|
201
|
-
const identity = /** @type {Record<string, unknown>} */ (bid.packageIdentity);
|
|
202
|
-
const refs = /** @type {Record<string, string>} */ (system.connectionRefs || {});
|
|
203
|
-
const tokenRef = refs.token || refs.apiKey || Object.values(refs)[0] || `kv://${identity.systemKey}/token`;
|
|
204
|
-
return {
|
|
205
|
-
key: system.key,
|
|
206
|
-
displayName: system.displayName || identity.displayName,
|
|
207
|
-
description: system.description || identity.displayName,
|
|
208
|
-
type: system.type || 'openapi',
|
|
209
|
-
enabled: true,
|
|
210
|
-
systemKind: system.systemKind || 'crm',
|
|
211
|
-
authentication: {
|
|
212
|
-
authType: 'credential',
|
|
213
|
-
credential: {
|
|
214
|
-
credentialKey: `${identity.systemKey}-cred`,
|
|
215
|
-
method: 'bearerToken',
|
|
216
|
-
variables: {
|
|
217
|
-
baseUrl: refs.baseUrl || 'https://example.invalid',
|
|
218
|
-
headerName: 'Authorization',
|
|
219
|
-
prefix: 'Bearer'
|
|
220
|
-
},
|
|
221
|
-
security: {
|
|
222
|
-
token: tokenRef
|
|
223
|
-
},
|
|
224
|
-
writeOnce: true
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
dataSources: (/** @type {any[]} */ (bid.datasources) || []).map((d) => d.key)
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
|
|
231
222
|
/**
|
|
232
223
|
* @param {Record<string, unknown>} bid
|
|
233
224
|
* @param {string[]} datasourceFiles
|
|
@@ -290,45 +281,73 @@ function buildEnvTemplate(bid) {
|
|
|
290
281
|
* nextStamp: Record<string, unknown>
|
|
291
282
|
* }}
|
|
292
283
|
*/
|
|
284
|
+
function remappedCapabilities(capabilities, keyMap) {
|
|
285
|
+
const out = {};
|
|
286
|
+
for (const [key, value] of Object.entries(capabilities || {})) {
|
|
287
|
+
out[keyMap.get(key) || key] = value;
|
|
288
|
+
}
|
|
289
|
+
return out;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function buildApplyStamp(bid, systemKey, identity) {
|
|
293
|
+
return {
|
|
294
|
+
schemaName: bid.schemaName,
|
|
295
|
+
schemaVersion: bid.schemaVersion,
|
|
296
|
+
definitionId: bid.definitionId,
|
|
297
|
+
definitionHash: bid.definitionHash,
|
|
298
|
+
suiteRunId: /** @type {any} */ (bid.meta).suiteRunId,
|
|
299
|
+
systemKey,
|
|
300
|
+
packageVersion: identity.packageVersion,
|
|
301
|
+
appliedAt: new Date().toISOString()
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
293
305
|
function buildPackageArtifacts(bid, systemKey, enrichOptions = {}) {
|
|
294
306
|
const identity = /** @type {Record<string, unknown>} */ (bid.packageIdentity);
|
|
295
307
|
const datasources = /** @type {Record<string, unknown>[]} */ (bid.datasources || []);
|
|
296
|
-
const capabilities =
|
|
308
|
+
const capabilities = remappedCapabilities(
|
|
309
|
+
/** @type {Record<string, string[]>} */ (bid.capabilities || {}),
|
|
310
|
+
canonicalDatasourceKeyMap(datasources, systemKey)
|
|
311
|
+
);
|
|
297
312
|
const sync = /** @type {Record<string, unknown>} */ (bid.sync || {});
|
|
298
|
-
const
|
|
313
|
+
const systemBlock = /** @type {Record<string, unknown>} */ (bid.system || {});
|
|
299
314
|
const systemOpenapiSourceRef =
|
|
300
|
-
typeof
|
|
315
|
+
typeof systemBlock.openapiSourceRef === 'string' ? systemBlock.openapiSourceRef : '';
|
|
301
316
|
const associationTargets = collectAssociationObjectTypes(
|
|
302
317
|
datasources,
|
|
303
318
|
systemOpenapiSourceRef,
|
|
304
319
|
enrichOptions
|
|
305
320
|
);
|
|
321
|
+
const keyMap = canonicalDatasourceKeyMap(datasources, systemKey);
|
|
306
322
|
const systemFile = `${systemKey}-system.json`;
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
system: buildSystemFile(bid),
|
|
313
|
-
dsFiles: datasources.map((ds) => ({
|
|
314
|
-
name: `${systemKey}-datasource-${ds.key}.json`,
|
|
315
|
-
body: buildDatasourceFile(ds, systemKey, capabilities, sync, {
|
|
323
|
+
const dsFiles = datasources.map((ds) => {
|
|
324
|
+
const canonicalKey = keyMap.get(String(ds.key)) || String(ds.key);
|
|
325
|
+
return {
|
|
326
|
+
name: datasourceFileName(systemKey, canonicalKey),
|
|
327
|
+
body: buildDatasourceFile({ ...ds, key: canonicalKey }, systemKey, capabilities, sync, {
|
|
316
328
|
...enrichOptions,
|
|
317
329
|
systemOpenapiSourceRef,
|
|
318
330
|
associationTargets
|
|
319
331
|
})
|
|
320
|
-
}
|
|
332
|
+
};
|
|
333
|
+
});
|
|
334
|
+
applyBidRelationships(dsFiles, /** @type {any[]} */ (bid.relationships) || [], keyMap);
|
|
335
|
+
applyStaticAndEnterprise(dsFiles, bid);
|
|
336
|
+
applyViewpointDefaults(dsFiles, /** @type {any[]} */ (bid.relationships) || [], keyMap);
|
|
337
|
+
const system = buildSystemFile(bid);
|
|
338
|
+
stampCredentialTestEndpoint(system, dsFiles);
|
|
339
|
+
return {
|
|
340
|
+
systemFile,
|
|
341
|
+
datasourceFiles: dsFiles.map((file) => file.name),
|
|
342
|
+
application: buildApplicationFile(
|
|
343
|
+
bid,
|
|
344
|
+
dsFiles.map((file) => file.name),
|
|
345
|
+
systemFile
|
|
346
|
+
),
|
|
347
|
+
system,
|
|
348
|
+
dsFiles,
|
|
321
349
|
envTemplate: buildEnvTemplate(bid),
|
|
322
|
-
nextStamp:
|
|
323
|
-
schemaName: bid.schemaName,
|
|
324
|
-
schemaVersion: bid.schemaVersion,
|
|
325
|
-
definitionId: bid.definitionId,
|
|
326
|
-
definitionHash: bid.definitionHash,
|
|
327
|
-
suiteRunId: /** @type {any} */ (bid.meta).suiteRunId,
|
|
328
|
-
systemKey,
|
|
329
|
-
packageVersion: identity.packageVersion,
|
|
330
|
-
appliedAt: new Date().toISOString()
|
|
331
|
-
}
|
|
350
|
+
nextStamp: buildApplyStamp(bid, systemKey, identity)
|
|
332
351
|
};
|
|
333
352
|
}
|
|
334
353
|
|
|
@@ -10,6 +10,7 @@ const fsReal = require('../internal/fs-real-sync');
|
|
|
10
10
|
const {
|
|
11
11
|
maybeEnrichCrmStyleFieldMappings
|
|
12
12
|
} = require('./enrich-crm-field-mappings');
|
|
13
|
+
const { pickBestMatchingOp, entityTokensFromDatasource } = require('./enrich-openapi-pick');
|
|
13
14
|
|
|
14
15
|
const PATH_PARAM_RE = /\{(\w+)\}/g;
|
|
15
16
|
|
|
@@ -171,7 +172,8 @@ function normalizeOp(method, opPath, op) {
|
|
|
171
172
|
method: String(method || '').toUpperCase(),
|
|
172
173
|
path: String(opPath),
|
|
173
174
|
operationId: typeof op.operationId === 'string' ? op.operationId : '',
|
|
174
|
-
pathParamCount: params.length
|
|
175
|
+
pathParamCount: params.length,
|
|
176
|
+
tags: Array.isArray(op.tags) ? op.tags.map((row) => String(row || '')) : []
|
|
175
177
|
};
|
|
176
178
|
}
|
|
177
179
|
|
|
@@ -212,12 +214,29 @@ function isBatchOrSearch(text) {
|
|
|
212
214
|
* @param {Array<{ method: string, path: string, operationId: string, pathParamCount: number }>} ops
|
|
213
215
|
* @returns {{ method: string, path: string, operationId: string } | null}
|
|
214
216
|
*/
|
|
215
|
-
function
|
|
216
|
-
const
|
|
217
|
-
|
|
217
|
+
function requiredQueryDefaults(doc, method, opPath) {
|
|
218
|
+
const out = {};
|
|
219
|
+
for (const param of operationParameters(doc, method, opPath)) {
|
|
220
|
+
if (!param || param.in !== 'query' || param.required !== true) {
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
const name = String(param.name || '').trim();
|
|
224
|
+
if (!name) {
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
const schema = param.schema && typeof param.schema === 'object' ? param.schema : {};
|
|
228
|
+
if (schema.default !== undefined) {
|
|
229
|
+
out[name] = schema.default;
|
|
230
|
+
} else if (typeof schema.minimum === 'number') {
|
|
231
|
+
out[name] = schema.minimum;
|
|
232
|
+
} else {
|
|
233
|
+
out[name] = `{{${name}}}`;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return out;
|
|
218
237
|
}
|
|
219
238
|
|
|
220
|
-
function pickOperationForCapability(capabilityKey, ops) {
|
|
239
|
+
function pickOperationForCapability(capabilityKey, ops, entityTokens) {
|
|
221
240
|
const key = String(capabilityKey || '').toLowerCase();
|
|
222
241
|
const candidates = ops.filter((op) => !isBatchOrSearch(`${op.path} ${op.operationId}`));
|
|
223
242
|
const rules = {
|
|
@@ -256,7 +275,7 @@ function pickOperationForCapability(capabilityKey, ops) {
|
|
|
256
275
|
if (!rule) {
|
|
257
276
|
return null;
|
|
258
277
|
}
|
|
259
|
-
return
|
|
278
|
+
return pickBestMatchingOp(candidates, rule.predicate, rule.idPattern, entityTokens);
|
|
260
279
|
}
|
|
261
280
|
|
|
262
281
|
/**
|
|
@@ -293,7 +312,11 @@ function bindOpenApiOperation(body, binding, capabilityKey) {
|
|
|
293
312
|
|
|
294
313
|
function createCipQuery(capabilityKey, bindOptions) {
|
|
295
314
|
const cap = String(capabilityKey || '').toLowerCase();
|
|
296
|
-
const query = {
|
|
315
|
+
const query = {
|
|
316
|
+
...(bindOptions.requiredQuery && typeof bindOptions.requiredQuery === 'object'
|
|
317
|
+
? bindOptions.requiredQuery
|
|
318
|
+
: {})
|
|
319
|
+
};
|
|
297
320
|
const targets = Array.isArray(bindOptions.associationTargets)
|
|
298
321
|
? bindOptions.associationTargets.map((row) => String(row || '').trim()).filter(Boolean)
|
|
299
322
|
: [];
|
|
@@ -394,10 +417,11 @@ function enrichDatasourceFromOpenApi(body, openapiSourceRef, options = {}) {
|
|
|
394
417
|
)
|
|
395
418
|
.map((row) => String(row || '').trim())
|
|
396
419
|
.filter((row) => row && row !== selfType);
|
|
420
|
+
const entityTokens = entityTokensFromDatasource(body);
|
|
397
421
|
const bound = [];
|
|
398
422
|
let samplePath = '';
|
|
399
423
|
for (const capabilityKey of caps) {
|
|
400
|
-
const picked = pickOperationForCapability(capabilityKey, indexed);
|
|
424
|
+
const picked = pickOperationForCapability(capabilityKey, indexed, entityTokens);
|
|
401
425
|
if (!picked) {
|
|
402
426
|
continue;
|
|
403
427
|
}
|
|
@@ -408,7 +432,8 @@ function enrichDatasourceFromOpenApi(body, openapiSourceRef, options = {}) {
|
|
|
408
432
|
picked.path
|
|
409
433
|
),
|
|
410
434
|
associationTargets,
|
|
411
|
-
cursorPagination: operationCursorPagination(doc, picked.method, picked.path)
|
|
435
|
+
cursorPagination: operationCursorPagination(doc, picked.method, picked.path),
|
|
436
|
+
requiredQuery: requiredQueryDefaults(doc, picked.method, picked.path)
|
|
412
437
|
});
|
|
413
438
|
bound.push(capabilityKey);
|
|
414
439
|
if (!samplePath) {
|
|
@@ -429,5 +454,6 @@ module.exports = {
|
|
|
429
454
|
enrichDatasourceFromOpenApi,
|
|
430
455
|
objectTypeFromOpenApiPath,
|
|
431
456
|
operationDeclaresAssociationsQuery,
|
|
432
|
-
operationCursorPagination
|
|
457
|
+
operationCursorPagination,
|
|
458
|
+
requiredQueryDefaults
|
|
433
459
|
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Score OpenAPI operations by datasource entity tokens.
|
|
3
|
+
*
|
|
4
|
+
* @fileoverview Prefer path/tag overlap over first GET in a multi-entity spec
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @param {Record<string, unknown>} body
|
|
11
|
+
* @returns {string[]}
|
|
12
|
+
*/
|
|
13
|
+
function entityTokensFromDatasource(body) {
|
|
14
|
+
const tokens = new Set();
|
|
15
|
+
for (const raw of [body.key, body.resourceType, body.displayName]) {
|
|
16
|
+
const value = String(raw || '').trim().toLowerCase();
|
|
17
|
+
if (!value) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
tokens.add(value);
|
|
21
|
+
for (const part of value.split(/[-_]/g)) {
|
|
22
|
+
if (part.length > 1) {
|
|
23
|
+
tokens.add(part);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return [...tokens];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @param {{ path?: string, operationId?: string, tags?: string[] }} op
|
|
32
|
+
* @param {string[]} tokens
|
|
33
|
+
* @returns {number}
|
|
34
|
+
*/
|
|
35
|
+
function scoreOpForEntity(op, tokens) {
|
|
36
|
+
if (!Array.isArray(tokens) || tokens.length === 0) {
|
|
37
|
+
return 0;
|
|
38
|
+
}
|
|
39
|
+
const path = String(op.path || '').toLowerCase();
|
|
40
|
+
const id = String(op.operationId || '').toLowerCase();
|
|
41
|
+
const tags = Array.isArray(op.tags)
|
|
42
|
+
? op.tags.map((row) => String(row || '').toLowerCase()).join(' ')
|
|
43
|
+
: '';
|
|
44
|
+
const hay = `${path} ${id} ${tags}`;
|
|
45
|
+
const segments = path.split('/').filter(Boolean);
|
|
46
|
+
let score = 0;
|
|
47
|
+
for (const token of tokens) {
|
|
48
|
+
if (segments.includes(token)) {
|
|
49
|
+
score += 20;
|
|
50
|
+
} else if (hay.includes(token)) {
|
|
51
|
+
score += 10;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return score;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @param {Array<{ method: string, path: string, operationId: string }>} candidates
|
|
59
|
+
* @param {(op: object) => boolean} predicate
|
|
60
|
+
* @param {RegExp} idPattern
|
|
61
|
+
* @param {string[]} [entityTokens]
|
|
62
|
+
* @returns {object | null}
|
|
63
|
+
*/
|
|
64
|
+
function pickBestMatchingOp(candidates, predicate, idPattern, entityTokens) {
|
|
65
|
+
const hits = candidates.filter(predicate);
|
|
66
|
+
if (hits.length === 0) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
const tokens = Array.isArray(entityTokens) ? entityTokens : [];
|
|
70
|
+
if (tokens.length > 0) {
|
|
71
|
+
const scored = hits.map((op) => ({
|
|
72
|
+
op,
|
|
73
|
+
score: scoreOpForEntity(op, tokens) + (idPattern.test(op.operationId) ? 5 : 0)
|
|
74
|
+
}));
|
|
75
|
+
scored.sort((left, right) => right.score - left.score);
|
|
76
|
+
if (scored[0].score > 0) {
|
|
77
|
+
return scored[0].op;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return hits.find((op) => idPattern.test(op.operationId)) || hits[0] || null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
module.exports = {
|
|
84
|
+
entityTokensFromDatasource,
|
|
85
|
+
scoreOpForEntity,
|
|
86
|
+
pickBestMatchingOp
|
|
87
|
+
};
|