@aifabrix/builder 2.53.1 → 2.54.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/aifabrix.js +2 -2
- 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/types/evidence.types.js +2 -0
- package/lib/api/work-search.api.js +136 -0
- package/lib/channels/add-channel.js +163 -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 +60 -0
- package/lib/channels/channel-add-remaining.js +486 -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-description.js +59 -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 +356 -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 +16 -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 +180 -72
- package/lib/channels/channel-status-display.js +86 -16
- package/lib/channels/channel-targets.js +106 -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 +89 -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 +258 -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 +323 -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 +48 -0
- package/lib/channels/teams-bot-channel-add.js +94 -0
- package/lib/channels/vendor-dataplane-url.js +249 -0
- package/lib/cli/setup-certification.help.js +2 -0
- package/lib/cli/setup-external-system-help.js +2 -0
- package/lib/cli/setup-external-system.js +1 -1
- 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/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-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 +10 -34
- package/lib/commands/repair-system-permissions.js +24 -22
- package/lib/commands/role-assistant-test-output.js +14 -0
- package/lib/commands/role-assistant.js +59 -21
- package/lib/commands/test-e2e-external.js +148 -21
- 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 +6 -3
- package/lib/commands/upload.js +18 -3
- 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/external-system/deploy-helpers.js +26 -1
- package/lib/external-system/deploy.js +10 -6
- package/lib/external-system/download-helpers.js +29 -2
- package/lib/external-system/download-role-assistant.js +83 -4
- package/lib/external-system/download.js +40 -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/lifecycle/role-assistant-governance.js +146 -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 +54 -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/openapi-channel-install-bindings.js +179 -0
- package/lib/programmatic/openapi-channel-install-schemas.js +286 -0
- package/lib/programmatic/openapi-component-schemas.js +18 -1
- package/lib/programmatic/openapi-description-enricher.js +3 -1
- package/lib/programmatic/openapi-descriptions.js +74 -3
- package/lib/programmatic/openapi-envelope-examples.js +117 -0
- package/lib/programmatic/openapi-operation-bindings.js +4 -1
- package/lib/programmatic/openapi-schema-descriptions-channel.js +316 -0
- package/lib/programmatic/openapi-spec.js +12 -8
- package/lib/programmatic/platform-rbac-catalog.js +36 -18
- package/lib/programmatic/route-handler-map.js +51 -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 +196 -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 +232 -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/workspace-context.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/settings.js +49 -2
- package/lib/role-assistant/test-cases-evaluate.js +30 -2
- package/lib/role-assistant/test-cases-evidence.js +175 -0
- package/lib/role-assistant/test-cases-search.js +229 -0
- package/lib/role-assistant/test-cases.js +37 -4
- package/lib/role-assistant/test-runner-search.js +149 -0
- 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 +29 -11
- package/lib/role-assistant/test-runner.js +16 -1
- package/lib/schema/external-datasource.schema.json +112 -18
- package/lib/schema/external-system.schema.json +159 -2
- package/lib/schema/mcp-client-profile.schema.json +103 -0
- package/lib/utils/app-path-resolve.js +4 -0
- package/lib/utils/authentication-env-template.js +44 -6
- 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/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-resolver.js +11 -1
- package/lib/utils/secrets-helpers.js +12 -21
- package/lib/utils/token-manager.js +10 -5
- package/lib/validation/validate.js +40 -0
- package/package.json +1 -1
- package/templates/README.md +1 -1
- package/templates/applications/builder-api/Dockerfile +1 -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 +7 -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 +2 -0
- 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 +41 -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 +21 -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 +223 -0
- package/templates/channels/slack/icon.svg +1 -0
- package/templates/channels/slack/install.template.md.hbs +36 -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 +155 -77
- package/templates/channels/slack/manifest.template.json.hbs +5 -2
- package/templates/channels/teams-bot/channel.json +161 -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
|
@@ -8,13 +8,39 @@
|
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
10
10
|
|
|
11
|
-
const {
|
|
11
|
+
const {
|
|
12
|
+
getExternalSystem,
|
|
13
|
+
getExternalSystemConfig,
|
|
14
|
+
updateExternalSystem
|
|
15
|
+
} = require('../api/external-systems.api');
|
|
12
16
|
const { unwrapApiData } = require('../utils/external-system-readiness-core');
|
|
13
17
|
|
|
14
18
|
/**
|
|
15
19
|
* @param {Object|null} system
|
|
16
20
|
* @returns {Object|null}
|
|
17
21
|
*/
|
|
22
|
+
/**
|
|
23
|
+
* Connected System key for fetch/patch (instance, not definition).
|
|
24
|
+
* @param {Object} ctx
|
|
25
|
+
* @returns {string}
|
|
26
|
+
*/
|
|
27
|
+
function communicationSystemKey(ctx) {
|
|
28
|
+
const instanceKey = ctx && typeof ctx.instanceSystemKey === 'string'
|
|
29
|
+
? ctx.instanceSystemKey.trim()
|
|
30
|
+
: '';
|
|
31
|
+
if (!instanceKey) {
|
|
32
|
+
throw new Error(
|
|
33
|
+
'Connected System instance key is required. Derive it from the display name; it cannot equal the catalog key.'
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
if (ctx.channelTarget && instanceKey === ctx.channelTarget) {
|
|
37
|
+
throw new Error(
|
|
38
|
+
`Connected System key cannot equal the catalog key. Use ${ctx.channelTarget}-<name-slug>.`
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
return instanceKey;
|
|
42
|
+
}
|
|
43
|
+
|
|
18
44
|
function getExistingChannelExtension(system) {
|
|
19
45
|
if (!system || typeof system !== 'object') return null;
|
|
20
46
|
const channel = system.config?.extensions?.channel;
|
|
@@ -32,7 +58,7 @@ function getExistingChannelExtension(system) {
|
|
|
32
58
|
* @returns {Object}
|
|
33
59
|
*/
|
|
34
60
|
function buildChannelExtensionBlock(params, target) {
|
|
35
|
-
|
|
61
|
+
const block = {
|
|
36
62
|
type: target.channelType,
|
|
37
63
|
name: params.name,
|
|
38
64
|
baseName: params.baseName,
|
|
@@ -40,8 +66,20 @@ function buildChannelExtensionBlock(params, target) {
|
|
|
40
66
|
capabilities: [...target.capabilities],
|
|
41
67
|
status: params.status,
|
|
42
68
|
artifactHash: params.artifactHash,
|
|
43
|
-
credentialKey: target.credentialKey
|
|
69
|
+
credentialKey: target.credentialKey,
|
|
70
|
+
definitionKey: target.definitionKey || target.key
|
|
44
71
|
};
|
|
72
|
+
const prefix =
|
|
73
|
+
typeof params.commandPrefix === 'string' ? params.commandPrefix.trim().toLowerCase() : '';
|
|
74
|
+
if (prefix) {
|
|
75
|
+
block.commandPrefix = prefix;
|
|
76
|
+
}
|
|
77
|
+
const packageVersion =
|
|
78
|
+
typeof params.packageVersion === 'string' ? params.packageVersion.trim() : '';
|
|
79
|
+
if (packageVersion) {
|
|
80
|
+
block.packageVersion = packageVersion;
|
|
81
|
+
}
|
|
82
|
+
return block;
|
|
45
83
|
}
|
|
46
84
|
|
|
47
85
|
/**
|
|
@@ -55,7 +93,13 @@ function mergeChannelIntoSystem(system, channelBlock) {
|
|
|
55
93
|
config.extensions && typeof config.extensions === 'object' ? { ...config.extensions } : {};
|
|
56
94
|
extensions.channel = channelBlock;
|
|
57
95
|
config.extensions = extensions;
|
|
58
|
-
|
|
96
|
+
const definitionKey =
|
|
97
|
+
channelBlock.definitionKey || (system.channel && system.channel.definitionKey);
|
|
98
|
+
const channel = {
|
|
99
|
+
...(system.channel && typeof system.channel === 'object' ? system.channel : {}),
|
|
100
|
+
definitionKey
|
|
101
|
+
};
|
|
102
|
+
return { ...system, config, displayName: channelBlock.name, channel };
|
|
59
103
|
}
|
|
60
104
|
|
|
61
105
|
/**
|
|
@@ -67,11 +111,14 @@ function mergeChannelIntoSystem(system, channelBlock) {
|
|
|
67
111
|
* @returns {Promise<Object>}
|
|
68
112
|
*/
|
|
69
113
|
async function fetchCommunicationSystem(ctx) {
|
|
70
|
-
const res = await getExternalSystem(ctx.dataplaneUrl, ctx
|
|
114
|
+
const res = await getExternalSystem(ctx.dataplaneUrl, communicationSystemKey(ctx), ctx.authConfig);
|
|
71
115
|
const system = unwrapApiData(res);
|
|
72
116
|
if (!system || typeof system !== 'object') {
|
|
117
|
+
if (ctx.allowMissing === true) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
73
120
|
throw new Error(
|
|
74
|
-
`Communication external system "${ctx
|
|
121
|
+
`Communication external system "${communicationSystemKey(ctx)}" was not found. ` +
|
|
75
122
|
`Run: aifabrix channel add ${ctx.channelTarget} --name "…" --force`
|
|
76
123
|
);
|
|
77
124
|
}
|
|
@@ -84,6 +131,29 @@ async function fetchCommunicationSystem(ctx) {
|
|
|
84
131
|
return system;
|
|
85
132
|
}
|
|
86
133
|
|
|
134
|
+
/**
|
|
135
|
+
* GET /systems/{key} serializes a slim ExternalSystemConfig and drops
|
|
136
|
+
* authentications[]. Use the running manifest so inbound HMAC survives PUT.
|
|
137
|
+
*
|
|
138
|
+
* @param {Object} ctx
|
|
139
|
+
* @param {Object} system
|
|
140
|
+
* @returns {Promise<Object>}
|
|
141
|
+
*/
|
|
142
|
+
async function loadSystemConfigForChannelPatch(ctx, system) {
|
|
143
|
+
const getConfig = ctx.getExternalSystemConfig || getExternalSystemConfig;
|
|
144
|
+
try {
|
|
145
|
+
const res = await getConfig(ctx.dataplaneUrl, communicationSystemKey(ctx), ctx.authConfig);
|
|
146
|
+
const body = unwrapApiData(res) || res;
|
|
147
|
+
const application = body && body.application;
|
|
148
|
+
if (application && typeof application === 'object') {
|
|
149
|
+
return application;
|
|
150
|
+
}
|
|
151
|
+
} catch {
|
|
152
|
+
/* keep GET-by-id config */
|
|
153
|
+
}
|
|
154
|
+
return system.config && typeof system.config === 'object' ? system.config : {};
|
|
155
|
+
}
|
|
156
|
+
|
|
87
157
|
/**
|
|
88
158
|
* @async
|
|
89
159
|
* @param {Object} ctx
|
|
@@ -92,8 +162,14 @@ async function fetchCommunicationSystem(ctx) {
|
|
|
92
162
|
*/
|
|
93
163
|
async function patchChannelExtension(ctx, channelBlock) {
|
|
94
164
|
const system = await fetchCommunicationSystem(ctx);
|
|
95
|
-
const
|
|
96
|
-
const
|
|
165
|
+
const config = await loadSystemConfigForChannelPatch(ctx, system);
|
|
166
|
+
const merged = mergeChannelIntoSystem({ ...system, config }, channelBlock);
|
|
167
|
+
const res = await updateExternalSystem(
|
|
168
|
+
ctx.dataplaneUrl,
|
|
169
|
+
communicationSystemKey(ctx),
|
|
170
|
+
ctx.authConfig,
|
|
171
|
+
{ displayName: merged.displayName, config: merged.config, channel: merged.channel }
|
|
172
|
+
);
|
|
97
173
|
return unwrapApiData(res) || merged;
|
|
98
174
|
}
|
|
99
175
|
|
|
@@ -102,5 +178,6 @@ module.exports = {
|
|
|
102
178
|
buildChannelExtensionBlock,
|
|
103
179
|
mergeChannelIntoSystem,
|
|
104
180
|
fetchCommunicationSystem,
|
|
105
|
-
patchChannelExtension
|
|
181
|
+
patchChannelExtension,
|
|
182
|
+
communicationSystemKey
|
|
106
183
|
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared ChannelInstallEnvelope user-action builders.
|
|
3
|
+
*
|
|
4
|
+
* @fileoverview Keep envelope.js under the file-size limit
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @param {Object} params
|
|
11
|
+
* @param {string} params.id
|
|
12
|
+
* @param {string} params.kind
|
|
13
|
+
* @param {string} params.label
|
|
14
|
+
* @param {boolean} [params.required]
|
|
15
|
+
* @param {string} [params.resume]
|
|
16
|
+
* @param {Object} [params.extra]
|
|
17
|
+
* @returns {Object}
|
|
18
|
+
*/
|
|
19
|
+
function userAction(params) {
|
|
20
|
+
return {
|
|
21
|
+
id: params.id,
|
|
22
|
+
kind: params.kind,
|
|
23
|
+
label: params.label,
|
|
24
|
+
required: params.required !== false,
|
|
25
|
+
resume: params.resume || 'poll',
|
|
26
|
+
...(params.extra || {})
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @param {string} href
|
|
32
|
+
* @param {string} label
|
|
33
|
+
* @param {string} id
|
|
34
|
+
* @param {boolean} [required]
|
|
35
|
+
* @returns {Object|null}
|
|
36
|
+
*/
|
|
37
|
+
function openUrlAction(href, label, id, required) {
|
|
38
|
+
if (typeof href !== 'string' || !href.trim()) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return userAction({
|
|
42
|
+
id,
|
|
43
|
+
kind: 'openUrl',
|
|
44
|
+
label,
|
|
45
|
+
required,
|
|
46
|
+
extra: { href: href.trim() }
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param {string} label
|
|
52
|
+
* @param {string} value
|
|
53
|
+
* @param {string} id
|
|
54
|
+
* @returns {Object|null}
|
|
55
|
+
*/
|
|
56
|
+
function copyValueAction(label, value, id) {
|
|
57
|
+
if (typeof value !== 'string' || !value.trim()) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
return userAction({
|
|
61
|
+
id,
|
|
62
|
+
kind: 'copyValue',
|
|
63
|
+
label,
|
|
64
|
+
extra: { value: value.trim() }
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @param {string} text
|
|
70
|
+
* @param {string} id
|
|
71
|
+
* @returns {Object}
|
|
72
|
+
*/
|
|
73
|
+
function remainingStepAction(text, id) {
|
|
74
|
+
return userAction({
|
|
75
|
+
id,
|
|
76
|
+
kind: 'remainingVendorStep',
|
|
77
|
+
label: text,
|
|
78
|
+
required: false,
|
|
79
|
+
extra: { text }
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
module.exports = {
|
|
84
|
+
userAction,
|
|
85
|
+
openUrlAction,
|
|
86
|
+
copyValueAction,
|
|
87
|
+
remainingStepAction
|
|
88
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Microsoft Copilot and Teams Bot envelope actions.
|
|
3
|
+
*
|
|
4
|
+
* @fileoverview Sign-in / continue handoff for portal install
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const { userAction, copyValueAction } = require('./channel-install-envelope-actions');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param {Object|null} runtimeValues
|
|
13
|
+
* @returns {boolean}
|
|
14
|
+
*/
|
|
15
|
+
function copilotVaultMissing(runtimeValues) {
|
|
16
|
+
return !(
|
|
17
|
+
runtimeValues &&
|
|
18
|
+
typeof runtimeValues.oauthPluginVaultReferenceId === 'string' &&
|
|
19
|
+
runtimeValues.oauthPluginVaultReferenceId.trim()
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {Object} params
|
|
25
|
+
* @returns {boolean}
|
|
26
|
+
*/
|
|
27
|
+
function copilotWaitingNoLoginUrl(params) {
|
|
28
|
+
const values = params.runtimeValues || {};
|
|
29
|
+
return (
|
|
30
|
+
params.channelTarget === 'microsoft-copilot' &&
|
|
31
|
+
copilotVaultMissing(values) &&
|
|
32
|
+
values.microsoftAuthConfigFallback !== true &&
|
|
33
|
+
!(typeof values.microsoftLoginUrl === 'string' && values.microsoftLoginUrl.trim())
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {Object} params
|
|
39
|
+
* @returns {boolean}
|
|
40
|
+
*/
|
|
41
|
+
function teamsBotWaiting(params) {
|
|
42
|
+
return params.channelTarget === 'teams-bot' && Boolean(params.ctx && params.ctx.teamsBotSkipped);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @param {Object} params
|
|
47
|
+
* @returns {boolean}
|
|
48
|
+
*/
|
|
49
|
+
function microsoftLoginWaiting(params) {
|
|
50
|
+
if (teamsBotWaiting(params)) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
const waitingNoUrl = copilotWaitingNoLoginUrl(params);
|
|
54
|
+
return (
|
|
55
|
+
params.channelTarget === 'microsoft-copilot' &&
|
|
56
|
+
copilotVaultMissing(params.runtimeValues) &&
|
|
57
|
+
(params.runtimeValues || {}).microsoftAuthConfigFallback !== true &&
|
|
58
|
+
waitingNoUrl !== true
|
|
59
|
+
) || waitingNoUrl;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @param {Object} params
|
|
64
|
+
* @returns {Object|null}
|
|
65
|
+
*/
|
|
66
|
+
function continueAfterMicrosoftLoginAction(params) {
|
|
67
|
+
const values = params.runtimeValues || {};
|
|
68
|
+
const teams = teamsBotWaiting(params);
|
|
69
|
+
if (params.channelTarget === 'microsoft-copilot') {
|
|
70
|
+
if (!copilotVaultMissing(values) || values.microsoftAuthConfigFallback === true) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
} else if (!teams) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
const loginUrl =
|
|
77
|
+
typeof values.microsoftLoginUrl === 'string' ? values.microsoftLoginUrl.trim() : '';
|
|
78
|
+
return userAction({
|
|
79
|
+
id: 'continue-after-microsoft-login',
|
|
80
|
+
kind: 'submitInput',
|
|
81
|
+
label: loginUrl ? 'Continue after sign-in' : 'Continue'
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @param {Object} params
|
|
87
|
+
* @returns {Object[]}
|
|
88
|
+
*/
|
|
89
|
+
function microsoftLoginCodeActions(params) {
|
|
90
|
+
const actions = [];
|
|
91
|
+
const code =
|
|
92
|
+
params.runtimeValues && typeof params.runtimeValues.microsoftLoginUserCode === 'string'
|
|
93
|
+
? params.runtimeValues.microsoftLoginUserCode.trim()
|
|
94
|
+
: '';
|
|
95
|
+
const copy = copyValueAction('Enter this code', code, 'copy-microsoft-login-code');
|
|
96
|
+
if (copy) {
|
|
97
|
+
actions.push(copy);
|
|
98
|
+
}
|
|
99
|
+
const resume = continueAfterMicrosoftLoginAction(params);
|
|
100
|
+
if (resume) {
|
|
101
|
+
actions.push(resume);
|
|
102
|
+
}
|
|
103
|
+
return actions;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @param {Object} params
|
|
108
|
+
* @returns {Object[]}
|
|
109
|
+
*/
|
|
110
|
+
function copilotExtraActions(params) {
|
|
111
|
+
if (params.channelTarget !== 'microsoft-copilot') {
|
|
112
|
+
return [];
|
|
113
|
+
}
|
|
114
|
+
if (!copilotVaultMissing(params.runtimeValues)) {
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
if (params.runtimeValues && params.runtimeValues.microsoftAuthConfigFallback === true) {
|
|
118
|
+
return [
|
|
119
|
+
userAction({
|
|
120
|
+
id: 'submit-entra-sso-registration',
|
|
121
|
+
kind: 'submitInput',
|
|
122
|
+
label: 'Paste the Microsoft auth-config ID (fallback)',
|
|
123
|
+
extra: { field: 'oauthPluginVaultReferenceId' }
|
|
124
|
+
})
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
return microsoftLoginCodeActions(params);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @param {Object} params
|
|
132
|
+
* @returns {Object[]}
|
|
133
|
+
*/
|
|
134
|
+
function teamsBotExtraActions(params) {
|
|
135
|
+
if (!teamsBotWaiting(params)) {
|
|
136
|
+
return [];
|
|
137
|
+
}
|
|
138
|
+
return microsoftLoginCodeActions(params);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @param {Object} params
|
|
143
|
+
* @returns {Object[]}
|
|
144
|
+
*/
|
|
145
|
+
function microsoftExtraActions(params) {
|
|
146
|
+
return [...copilotExtraActions(params), ...teamsBotExtraActions(params)];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
module.exports = {
|
|
150
|
+
copilotVaultMissing,
|
|
151
|
+
copilotWaitingNoLoginUrl,
|
|
152
|
+
teamsBotWaiting,
|
|
153
|
+
microsoftLoginWaiting,
|
|
154
|
+
microsoftExtraActions
|
|
155
|
+
};
|