@aifabrix/builder 2.32.3 → 2.33.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/.cursor/rules/project-rules.mdc +8 -0
- package/README.md +36 -8
- package/bin/aifabrix.js +6 -8
- package/integration/hubspot/README.md +12 -11
- package/integration/hubspot/companies.json +2048 -0
- package/integration/hubspot/create-hubspot.js +665 -0
- package/integration/hubspot/{hubspot-deploy-company.json → hubspot-datasource-company.json} +1 -1
- package/integration/hubspot/{hubspot-deploy-contact.json → hubspot-datasource-contact.json} +1 -1
- package/integration/hubspot/{hubspot-deploy-deal.json → hubspot-datasource-deal.json} +1 -1
- package/integration/hubspot/hubspot-deploy.json +832 -81
- package/integration/hubspot/hubspot-system.json +99 -0
- package/integration/hubspot/test-artifacts/wizard-hubspot-credential-real.yaml +20 -0
- package/integration/hubspot/test-artifacts/wizard-hubspot-env-vars.yaml +9 -0
- package/integration/hubspot/test-artifacts/wizard-invalid-add-datasource.yaml +5 -0
- package/integration/hubspot/test-artifacts/wizard-invalid-app-name.yaml +5 -0
- package/integration/hubspot/test-artifacts/wizard-invalid-credential-create.yaml +7 -0
- package/integration/hubspot/test-artifacts/wizard-invalid-credential-select.yaml +7 -0
- package/integration/hubspot/test-artifacts/wizard-invalid-known-platform.yaml +4 -0
- package/integration/hubspot/test-artifacts/wizard-invalid-missing-app.yaml +4 -0
- package/integration/hubspot/test-artifacts/wizard-invalid-missing-source.yaml +2 -0
- package/integration/hubspot/test-artifacts/wizard-invalid-mode.yaml +5 -0
- package/integration/hubspot/test-artifacts/wizard-invalid-openapi-file.yaml +5 -0
- package/integration/hubspot/test-artifacts/wizard-invalid-openapi-url.yaml +4 -0
- package/integration/hubspot/test-artifacts/wizard-invalid-source.yaml +4 -0
- package/integration/hubspot/test-artifacts/wizard-valid-for-dimension-array-test.yaml +5 -0
- package/integration/hubspot/test-artifacts/wizard-valid-for-dimension-key-test.yaml +5 -0
- package/integration/hubspot/test-artifacts/wizard-valid-for-dimension-path-test.yaml +5 -0
- package/integration/hubspot/test-artifacts/wizard-valid-for-dimension-test.yaml +5 -0
- package/integration/hubspot/test-artifacts/wizard-valid-for-rbac-test.yaml +5 -0
- package/integration/hubspot/test-artifacts/wizard-valid-for-rbac-yaml-test.yaml +5 -0
- package/integration/hubspot/test-dataplane-down-helpers.js +246 -0
- package/integration/hubspot/test-dataplane-down-tests.js +419 -0
- package/integration/hubspot/test-dataplane-down.js +157 -0
- package/integration/hubspot/test.js +1517 -0
- package/integration/hubspot/variables.yaml +4 -4
- package/integration/hubspot/wizard-hubspot-e2e.yaml +16 -0
- package/integration/hubspot/wizard-hubspot-platform.yaml +8 -0
- package/lib/api/applications.api.js +1 -0
- package/lib/api/index.js +6 -2
- package/lib/api/types/wizard.types.js +176 -38
- package/lib/api/wizard.api.js +161 -23
- package/lib/app/deploy.js +116 -54
- package/lib/app/display.js +6 -5
- package/lib/app/dockerfile.js +2 -1
- package/lib/app/list.js +17 -10
- package/lib/app/readme.js +41 -112
- package/lib/app/register.js +44 -9
- package/lib/app/rotate-secret.js +48 -31
- package/lib/cli.js +219 -70
- package/lib/commands/app.js +4 -9
- package/lib/commands/auth-config.js +125 -0
- package/lib/commands/auth-status.js +7 -8
- package/lib/commands/datasource.js +3 -6
- package/lib/commands/login-credentials.js +4 -4
- package/lib/commands/login-device.js +26 -17
- package/lib/commands/login.js +12 -10
- package/lib/commands/wizard-config-normalizer.js +92 -0
- package/lib/commands/wizard-core.js +515 -0
- package/lib/commands/wizard-dataplane.js +122 -0
- package/lib/commands/wizard-headless.js +115 -0
- package/lib/commands/wizard.js +110 -332
- package/lib/core/config.js +46 -0
- package/lib/core/secrets.js +3 -22
- package/lib/core/templates-env.js +1 -1
- package/lib/datasource/deploy.js +59 -23
- package/lib/datasource/list.js +108 -19
- package/lib/deployment/deployer.js +25 -0
- package/lib/deployment/environment.js +10 -13
- package/lib/external-system/delete.js +151 -0
- package/lib/external-system/deploy.js +53 -378
- package/lib/external-system/download-helpers.js +45 -65
- package/lib/external-system/download.js +33 -13
- package/lib/external-system/generator.js +11 -7
- package/lib/external-system/test-auth.js +4 -3
- package/lib/generator/builders.js +3 -1
- package/lib/generator/external-controller-manifest.js +157 -0
- package/lib/generator/external-schema-utils.js +236 -0
- package/lib/generator/external.js +55 -3
- package/lib/generator/index.js +22 -10
- package/lib/generator/wizard-prompts.js +33 -10
- package/lib/generator/wizard.js +69 -86
- package/lib/infrastructure/compose.js +100 -0
- package/lib/infrastructure/helpers.js +139 -0
- package/lib/infrastructure/index.js +52 -311
- package/lib/infrastructure/services.js +168 -0
- package/lib/schema/application-schema.json +23 -4
- package/lib/schema/external-datasource.schema.json +2 -2
- package/lib/schema/wizard-config.schema.json +234 -0
- package/lib/utils/api.js +102 -52
- package/lib/utils/app-existence.js +42 -0
- package/lib/utils/app-register-config.js +7 -2
- package/lib/utils/auth-config-validator.js +92 -0
- package/lib/utils/command-header.js +43 -0
- package/lib/utils/compose-generator.js +113 -70
- package/lib/utils/controller-url.js +65 -17
- package/lib/utils/dataplane-health.js +115 -0
- package/lib/utils/dataplane-resolver.js +29 -0
- package/lib/utils/dev-config.js +6 -2
- package/lib/utils/env-copy.js +2 -1
- package/lib/utils/env-ports.js +2 -1
- package/lib/utils/env-template.js +1 -1
- package/lib/utils/error-formatter.js +49 -0
- package/lib/utils/error-formatters/network-errors.js +13 -3
- package/lib/utils/external-readme.js +125 -0
- package/lib/utils/help-builder.js +190 -0
- package/lib/utils/infra-status.js +13 -3
- package/lib/utils/paths.js +17 -2
- package/lib/utils/port-resolver.js +111 -0
- package/lib/utils/secrets-helpers.js +3 -15
- package/lib/utils/secrets-utils.js +2 -2
- package/lib/utils/token-manager.js +9 -4
- package/lib/utils/variable-transformer.js +7 -2
- package/lib/validation/external-manifest-validator.js +202 -0
- package/lib/validation/validate-display.js +406 -0
- package/lib/validation/validate.js +159 -123
- package/lib/validation/validator.js +36 -3
- package/lib/validation/wizard-config-validator.js +267 -0
- package/package.json +4 -2
- package/templates/applications/README.md.hbs +18 -16
- package/templates/applications/miso-controller/env.template +1 -1
- package/templates/applications/miso-controller/rbac.yaml +7 -7
- package/templates/external-system/README.md.hbs +99 -0
- package/templates/github/ci.yaml.hbs +44 -1
- package/templates/github/release.yaml.hbs +44 -0
- package/templates/infra/compose.yaml.hbs +35 -0
- package/templates/python/docker-compose.hbs +26 -0
- package/templates/typescript/docker-compose.hbs +26 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Wizard headless mode handler - non-interactive external system creation
|
|
3
|
+
* @author AI Fabrix Team
|
|
4
|
+
* @version 2.0.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const chalk = require('chalk');
|
|
8
|
+
const logger = require('../utils/logger');
|
|
9
|
+
const {
|
|
10
|
+
validateWizardConfig: validateWizardConfigFile,
|
|
11
|
+
displayValidationResults
|
|
12
|
+
} = require('../validation/wizard-config-validator');
|
|
13
|
+
const {
|
|
14
|
+
validateAndCheckAppDirectory,
|
|
15
|
+
handleModeSelection,
|
|
16
|
+
handleSourceSelection,
|
|
17
|
+
handleOpenApiParsing,
|
|
18
|
+
handleCredentialSelection,
|
|
19
|
+
handleTypeDetection,
|
|
20
|
+
handleConfigurationGeneration,
|
|
21
|
+
validateWizardConfiguration,
|
|
22
|
+
handleFileSaving,
|
|
23
|
+
setupDataplaneAndAuth
|
|
24
|
+
} = require('./wizard-core');
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Execute wizard flow from config file (headless mode)
|
|
28
|
+
* @async
|
|
29
|
+
* @function executeWizardFromConfig
|
|
30
|
+
* @param {Object} wizardConfig - Validated wizard configuration
|
|
31
|
+
* @param {string} dataplaneUrl - Dataplane URL
|
|
32
|
+
* @param {Object} authConfig - Authentication configuration
|
|
33
|
+
* @returns {Promise<void>} Resolves when wizard flow completes
|
|
34
|
+
* @throws {Error} If wizard flow fails
|
|
35
|
+
*/
|
|
36
|
+
async function executeWizardFromConfig(wizardConfig, dataplaneUrl, authConfig) {
|
|
37
|
+
const { appName, mode, systemIdOrKey, source, credential, preferences } = wizardConfig;
|
|
38
|
+
|
|
39
|
+
// Step 1: Create Session
|
|
40
|
+
const { sessionId } = await handleModeSelection(dataplaneUrl, authConfig, mode, systemIdOrKey);
|
|
41
|
+
|
|
42
|
+
// Step 2: Source Selection & Parse
|
|
43
|
+
const { sourceType, sourceData } = await handleSourceSelection(dataplaneUrl, sessionId, authConfig, source);
|
|
44
|
+
|
|
45
|
+
// Parse OpenAPI
|
|
46
|
+
const openapiSpec = await handleOpenApiParsing(dataplaneUrl, authConfig, sourceType, sourceData);
|
|
47
|
+
|
|
48
|
+
// Step 3: Credential Selection
|
|
49
|
+
const credentialIdOrKey = await handleCredentialSelection(dataplaneUrl, authConfig, credential);
|
|
50
|
+
|
|
51
|
+
// Step 4: Detect Type
|
|
52
|
+
const detectedType = await handleTypeDetection(dataplaneUrl, authConfig, openapiSpec);
|
|
53
|
+
|
|
54
|
+
// Step 5: Generate Configuration
|
|
55
|
+
const { systemConfig, datasourceConfigs, systemKey } = await handleConfigurationGeneration(dataplaneUrl, authConfig, {
|
|
56
|
+
mode,
|
|
57
|
+
openapiSpec,
|
|
58
|
+
detectedType,
|
|
59
|
+
configPrefs: preferences,
|
|
60
|
+
credentialIdOrKey,
|
|
61
|
+
systemIdOrKey
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Step 6: Validate Configuration
|
|
65
|
+
await validateWizardConfiguration(dataplaneUrl, authConfig, systemConfig, datasourceConfigs);
|
|
66
|
+
|
|
67
|
+
// Step 7: Save Files
|
|
68
|
+
await handleFileSaving(
|
|
69
|
+
appName,
|
|
70
|
+
systemConfig,
|
|
71
|
+
datasourceConfigs,
|
|
72
|
+
systemKey || appName,
|
|
73
|
+
dataplaneUrl,
|
|
74
|
+
authConfig
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Handle wizard command in headless mode (config file)
|
|
80
|
+
* @async
|
|
81
|
+
* @function handleWizardHeadless
|
|
82
|
+
* @param {Object} options - Command options
|
|
83
|
+
* @param {string} options.config - Path to wizard.yaml config file
|
|
84
|
+
* @returns {Promise<void>} Resolves when wizard completes
|
|
85
|
+
* @throws {Error} If wizard fails
|
|
86
|
+
*/
|
|
87
|
+
async function handleWizardHeadless(options) {
|
|
88
|
+
logger.log(chalk.blue('\n\uD83E\uDDD9 AI Fabrix External System Wizard (Headless Mode)\n'));
|
|
89
|
+
logger.log(chalk.gray(`Reading configuration from: ${options.config}`));
|
|
90
|
+
|
|
91
|
+
// Validate wizard config file
|
|
92
|
+
const validationResult = await validateWizardConfigFile(options.config);
|
|
93
|
+
if (!validationResult.valid) {
|
|
94
|
+
displayValidationResults(validationResult);
|
|
95
|
+
throw new Error('Wizard configuration validation failed');
|
|
96
|
+
}
|
|
97
|
+
logger.log(chalk.green('\u2713 Configuration file validated'));
|
|
98
|
+
|
|
99
|
+
const wizardConfig = validationResult.config;
|
|
100
|
+
const appName = wizardConfig.appName;
|
|
101
|
+
|
|
102
|
+
// Validate app name and check directory (non-interactive)
|
|
103
|
+
const shouldContinue = await validateAndCheckAppDirectory(appName, false);
|
|
104
|
+
if (!shouldContinue) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Get dataplane URL and authentication (controller/environment from config.yaml)
|
|
109
|
+
const { dataplaneUrl, authConfig } = await setupDataplaneAndAuth(options, appName);
|
|
110
|
+
|
|
111
|
+
// Execute wizard flow from config
|
|
112
|
+
await executeWizardFromConfig(wizardConfig, dataplaneUrl, authConfig);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
module.exports = { handleWizardHeadless, executeWizardFromConfig };
|