@aifabrix/builder 2.31.0 → 2.32.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/README.md +9 -9
- package/integration/hubspot/README.md +2 -2
- package/integration/hubspot/hubspot-deploy-company.json +17 -14
- package/integration/hubspot/hubspot-deploy-contact.json +19 -16
- package/integration/hubspot/hubspot-deploy-deal.json +21 -18
- package/lib/api/types/datasources.types.js +31 -5
- package/lib/api/types/wizard.types.js +142 -0
- package/lib/api/wizard.api.js +177 -0
- package/lib/{app-config.js → app/config.js} +4 -4
- package/lib/{app-deploy.js → app/deploy.js} +8 -8
- package/lib/app/display.js +90 -0
- package/lib/{app-dockerfile.js → app/dockerfile.js} +4 -4
- package/lib/{app-down.js → app/down.js} +4 -4
- package/lib/app/helpers.js +218 -0
- package/lib/app/index.js +298 -0
- package/lib/{app-list.js → app/list.js} +6 -6
- package/lib/{app-push.js → app/push.js} +4 -4
- package/lib/{app-readme.js → app/readme.js} +34 -13
- package/lib/{app-register.js → app/register.js} +9 -9
- package/lib/{app-rotate-secret.js → app/rotate-secret.js} +123 -37
- package/lib/{app-run-helpers.js → app/run-helpers.js} +10 -10
- package/lib/{app-run.js → app/run.js} +6 -6
- package/lib/{build.js → build/index.js} +59 -32
- package/lib/build/package.json +7 -0
- package/lib/cli.js +245 -179
- package/lib/commands/app.js +3 -3
- package/lib/commands/datasource.js +4 -4
- package/lib/commands/login-credentials.js +209 -0
- package/lib/commands/login-device.js +254 -0
- package/lib/commands/login.js +67 -378
- package/lib/commands/logout.js +1 -1
- package/lib/commands/secrets-set.js +1 -1
- package/lib/commands/secure.js +2 -2
- package/lib/commands/wizard.js +498 -0
- package/lib/{audit-logger.js → core/audit-logger.js} +1 -1
- package/lib/{config.js → core/config.js} +28 -26
- package/lib/{diff.js → core/diff.js} +157 -72
- package/lib/{secrets.js → core/secrets.js} +86 -49
- package/lib/{templates.js → core/templates-env.js} +14 -222
- package/lib/core/templates.js +279 -0
- package/lib/{datasource-deploy.js → datasource/deploy.js} +6 -6
- package/lib/{datasource-diff.js → datasource/diff.js} +2 -2
- package/lib/datasource/list.js +223 -0
- package/lib/{datasource-validate.js → datasource/validate.js} +2 -2
- package/lib/{deployer.js → deployment/deployer.js} +48 -18
- package/lib/{environment-deploy.js → deployment/environment.js} +163 -84
- package/lib/{push.js → deployment/push.js} +1 -1
- package/lib/external-system/deploy-helpers.js +145 -0
- package/lib/{external-system-deploy.js → external-system/deploy.js} +156 -111
- package/lib/external-system/download-helpers.js +114 -0
- package/lib/{external-system-download.js → external-system/download.js} +92 -135
- package/lib/{external-system-generator.js → external-system/generator.js} +15 -11
- package/lib/external-system/test-auth.js +40 -0
- package/lib/external-system/test-execution.js +84 -0
- package/lib/external-system/test-helpers.js +109 -0
- package/lib/{external-system-test.js → external-system/test.js} +174 -192
- package/lib/{generator-builders.js → generator/builders.js} +87 -10
- package/lib/{generator-external.js → generator/external.js} +115 -52
- package/lib/{github-generator.js → generator/github.js} +116 -15
- package/lib/{generator-helpers.js → generator/helpers.js} +92 -42
- package/lib/{generator.js → generator/index.js} +49 -22
- package/lib/{generator-split.js → generator/split.js} +108 -55
- package/lib/generator/wizard-prompts.js +357 -0
- package/lib/generator/wizard.js +490 -0
- package/lib/{infra.js → infrastructure/index.js} +49 -22
- package/lib/schema/external-datasource.schema.json +145 -133
- package/lib/schema/external-system.schema.json +42 -0
- package/lib/utils/api.js +9 -5
- package/lib/utils/app-register-api.js +60 -32
- package/lib/utils/app-register-auth.js +172 -47
- package/lib/utils/app-register-config.js +130 -59
- package/lib/utils/app-run-containers.js +29 -8
- package/lib/utils/build-helpers.js +1 -1
- package/lib/utils/cli-utils.js +78 -30
- package/lib/utils/compose-generator.js +145 -65
- package/lib/utils/config-paths.js +2 -0
- package/lib/utils/deployment-errors.js +1 -1
- package/lib/utils/device-code.js +99 -41
- package/lib/utils/env-config-loader.js +1 -1
- package/lib/utils/env-copy.js +21 -18
- package/lib/utils/env-endpoints.js +115 -67
- package/lib/utils/env-map.js +13 -14
- package/lib/utils/env-ports.js +45 -25
- package/lib/utils/env-template.js +84 -42
- package/lib/utils/error-formatter.js +26 -9
- package/lib/utils/error-formatters/error-parser.js +90 -4
- package/lib/utils/error-formatters/http-status-errors.js +54 -17
- package/lib/utils/error-formatters/network-errors.js +103 -26
- package/lib/utils/external-system-display.js +184 -90
- package/lib/utils/external-system-validators.js +164 -42
- package/lib/utils/file-upload.js +109 -0
- package/lib/utils/health-check.js +199 -83
- package/lib/utils/infra-containers.js +1 -1
- package/lib/utils/infra-status.js +66 -15
- package/lib/utils/local-secrets.js +45 -25
- package/lib/utils/paths.js +45 -33
- package/lib/utils/schema-loader.js +42 -25
- package/lib/utils/schema-resolver.js +123 -74
- package/lib/utils/secrets-encryption.js +62 -25
- package/lib/utils/secrets-helpers.js +126 -63
- package/lib/utils/secrets-path.js +1 -1
- package/lib/utils/secrets-url.js +1 -1
- package/lib/utils/token-manager-refresh.js +181 -0
- package/lib/utils/token-manager.js +76 -123
- package/lib/utils/variable-transformer.js +154 -77
- package/lib/utils/yaml-preserve.js +41 -47
- package/lib/{template-validator.js → validation/template.js} +54 -23
- package/lib/{validate.js → validation/validate.js} +205 -125
- package/lib/{validator.js → validation/validator.js} +58 -39
- package/package.json +34 -3
- package/scripts/install-local.js +210 -0
- package/templates/external-system/deploy.ps1.hbs +34 -0
- package/templates/external-system/deploy.sh.hbs +34 -0
- package/templates/external-system/external-datasource.json.hbs +31 -12
- package/lib/app.js +0 -467
- package/lib/datasource-list.js +0 -141
- /package/lib/{app-prompts.js → app/prompts.js} +0 -0
- /package/lib/{env-reader.js → core/env-reader.js} +0 -0
- /package/lib/{key-generator.js → core/key-generator.js} +0 -0
|
@@ -16,16 +16,16 @@ const chalk = require('chalk');
|
|
|
16
16
|
const yaml = require('js-yaml');
|
|
17
17
|
const { exec } = require('child_process');
|
|
18
18
|
const { promisify } = require('util');
|
|
19
|
-
const validator = require('
|
|
20
|
-
const infra = require('
|
|
21
|
-
const secrets = require('
|
|
22
|
-
const config = require('
|
|
23
|
-
const buildCopy = require('
|
|
24
|
-
const logger = require('
|
|
25
|
-
const { waitForHealthCheck } = require('
|
|
26
|
-
const composeGenerator = require('
|
|
27
|
-
const dockerUtils = require('
|
|
28
|
-
const containerHelpers = require('
|
|
19
|
+
const validator = require('../validation/validator');
|
|
20
|
+
const infra = require('../infrastructure');
|
|
21
|
+
const secrets = require('../core/secrets');
|
|
22
|
+
const config = require('../core/config');
|
|
23
|
+
const buildCopy = require('../utils/build-copy');
|
|
24
|
+
const logger = require('../utils/logger');
|
|
25
|
+
const { waitForHealthCheck } = require('../utils/health-check');
|
|
26
|
+
const composeGenerator = require('../utils/compose-generator');
|
|
27
|
+
const dockerUtils = require('../utils/docker');
|
|
28
|
+
const containerHelpers = require('../utils/app-run-containers');
|
|
29
29
|
|
|
30
30
|
const execAsync = promisify(exec);
|
|
31
31
|
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
const chalk = require('chalk');
|
|
13
|
-
const config = require('
|
|
14
|
-
const logger = require('
|
|
15
|
-
const { checkPortAvailable, waitForHealthCheck } = require('
|
|
16
|
-
const composeGenerator = require('
|
|
13
|
+
const config = require('../core/config');
|
|
14
|
+
const logger = require('../utils/logger');
|
|
15
|
+
const { checkPortAvailable, waitForHealthCheck } = require('../utils/health-check');
|
|
16
|
+
const composeGenerator = require('../utils/compose-generator');
|
|
17
17
|
// Helper functions extracted to reduce file size and complexity
|
|
18
|
-
const helpers = require('./
|
|
18
|
+
const helpers = require('./run-helpers');
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Validate app for run and check if it's an external system
|
|
@@ -31,7 +31,7 @@ async function validateAppForRun(appName, _debug) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// Check if app type is external - skip Docker run
|
|
34
|
-
const { detectAppType } = require('
|
|
34
|
+
const { detectAppType } = require('../utils/paths');
|
|
35
35
|
try {
|
|
36
36
|
const { isExternal } = await detectAppType(appName);
|
|
37
37
|
if (isExternal) {
|
|
@@ -13,18 +13,18 @@
|
|
|
13
13
|
const fs = require('fs').promises;
|
|
14
14
|
const fsSync = require('fs');
|
|
15
15
|
const path = require('path');
|
|
16
|
-
const paths = require('
|
|
17
|
-
const { detectAppType, getProjectRoot } = require('
|
|
16
|
+
const paths = require('../utils/paths');
|
|
17
|
+
const { detectAppType, getProjectRoot } = require('../utils/paths');
|
|
18
18
|
const chalk = require('chalk');
|
|
19
19
|
const yaml = require('js-yaml');
|
|
20
|
-
const secrets = require('
|
|
21
|
-
const config = require('
|
|
22
|
-
const logger = require('
|
|
23
|
-
const dockerfileUtils = require('
|
|
24
|
-
const dockerBuild = require('
|
|
25
|
-
const buildCopy = require('
|
|
26
|
-
const { buildDevImageName } = require('
|
|
27
|
-
const buildHelpers = require('
|
|
20
|
+
const secrets = require('../core/secrets');
|
|
21
|
+
const config = require('../core/config');
|
|
22
|
+
const logger = require('../utils/logger');
|
|
23
|
+
const dockerfileUtils = require('../utils/dockerfile-utils');
|
|
24
|
+
const dockerBuild = require('../utils/docker-build');
|
|
25
|
+
const buildCopy = require('../utils/build-copy');
|
|
26
|
+
const { buildDevImageName } = require('../utils/image-name');
|
|
27
|
+
const buildHelpers = require('../utils/build-helpers');
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Loads variables.yaml configuration for an application
|
|
@@ -208,7 +208,7 @@ async function postBuildTasks(appName, buildConfig) {
|
|
|
208
208
|
async function checkExternalAppType(appName) {
|
|
209
209
|
const variables = await loadVariablesYaml(appName);
|
|
210
210
|
if (variables.app && variables.app.type === 'external') {
|
|
211
|
-
const generator = require('
|
|
211
|
+
const generator = require('../generator');
|
|
212
212
|
const jsonPath = await generator.generateDeployJson(appName);
|
|
213
213
|
logger.log(chalk.green(`✓ Generated deployment JSON: ${jsonPath}`));
|
|
214
214
|
return true;
|
|
@@ -224,6 +224,51 @@ async function checkExternalAppType(appName) {
|
|
|
224
224
|
* @param {Object} options - Build options
|
|
225
225
|
* @returns {Promise<Object>} Object with devDir, effectiveImageName, imageName, appConfig, and developerId
|
|
226
226
|
*/
|
|
227
|
+
/**
|
|
228
|
+
* Copies application source files if they exist
|
|
229
|
+
* @async
|
|
230
|
+
* @function copyApplicationSourceFiles
|
|
231
|
+
* @param {string} appName - Application name
|
|
232
|
+
* @param {string} devDir - Developer directory
|
|
233
|
+
* @returns {Promise<boolean>} True if files were copied
|
|
234
|
+
*/
|
|
235
|
+
async function copyApplicationSourceFiles(appName, devDir) {
|
|
236
|
+
const appsPath = path.join(process.cwd(), 'apps', appName);
|
|
237
|
+
if (fsSync.existsSync(appsPath)) {
|
|
238
|
+
await buildCopy.copyAppSourceFiles(appsPath, devDir);
|
|
239
|
+
logger.log(chalk.green(`✓ Copied application source files from apps/${appName}`));
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Copies template files if needed
|
|
247
|
+
* @async
|
|
248
|
+
* @function copyTemplateFilesIfNeeded
|
|
249
|
+
* @param {string} devDir - Developer directory
|
|
250
|
+
* @param {string} language - Language type
|
|
251
|
+
* @param {Object} buildConfig - Build configuration
|
|
252
|
+
* @param {Object} options - Build options
|
|
253
|
+
*/
|
|
254
|
+
async function copyTemplateFilesIfNeeded(devDir, language, buildConfig, options) {
|
|
255
|
+
const detectedLanguage = options.language || buildConfig.language || detectLanguage(devDir);
|
|
256
|
+
const packageJsonPath = path.join(devDir, 'package.json');
|
|
257
|
+
const requirementsPath = path.join(devDir, 'requirements.txt');
|
|
258
|
+
|
|
259
|
+
if (detectedLanguage === 'typescript' && !fsSync.existsSync(packageJsonPath)) {
|
|
260
|
+
const projectRoot = getProjectRoot();
|
|
261
|
+
const templatePath = path.join(projectRoot, 'templates', 'typescript');
|
|
262
|
+
await buildCopy.copyTemplateFilesToDevDir(templatePath, devDir, detectedLanguage);
|
|
263
|
+
logger.log(chalk.green(`✓ Generated application files from ${detectedLanguage} template`));
|
|
264
|
+
} else if (detectedLanguage === 'python' && !fsSync.existsSync(requirementsPath)) {
|
|
265
|
+
const projectRoot = getProjectRoot();
|
|
266
|
+
const templatePath = path.join(projectRoot, 'templates', 'python');
|
|
267
|
+
await buildCopy.copyTemplateFilesToDevDir(templatePath, devDir, detectedLanguage);
|
|
268
|
+
logger.log(chalk.green(`✓ Generated application files from ${detectedLanguage} template`));
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
227
272
|
async function prepareDevDirectory(appName, buildConfig, options) {
|
|
228
273
|
const developerId = await config.getDeveloperId();
|
|
229
274
|
const idNum = typeof developerId === 'string' ? parseInt(developerId, 10) : developerId;
|
|
@@ -236,27 +281,9 @@ async function prepareDevDirectory(appName, buildConfig, options) {
|
|
|
236
281
|
const effectiveImageName = buildDevImageName(imageName, developerId);
|
|
237
282
|
|
|
238
283
|
// Check if application source files exist, if not copy from templates
|
|
239
|
-
const
|
|
240
|
-
if (
|
|
241
|
-
await
|
|
242
|
-
logger.log(chalk.green(`✓ Copied application source files from apps/${appName}`));
|
|
243
|
-
} else {
|
|
244
|
-
// No apps directory - check if we need to copy template files
|
|
245
|
-
const language = options.language || buildConfig.language || detectLanguage(devDir);
|
|
246
|
-
const packageJsonPath = path.join(devDir, 'package.json');
|
|
247
|
-
const requirementsPath = path.join(devDir, 'requirements.txt');
|
|
248
|
-
|
|
249
|
-
if (language === 'typescript' && !fsSync.existsSync(packageJsonPath)) {
|
|
250
|
-
const projectRoot = getProjectRoot();
|
|
251
|
-
const templatePath = path.join(projectRoot, 'templates', 'typescript');
|
|
252
|
-
await buildCopy.copyTemplateFilesToDevDir(templatePath, devDir, language);
|
|
253
|
-
logger.log(chalk.green(`✓ Generated application files from ${language} template`));
|
|
254
|
-
} else if (language === 'python' && !fsSync.existsSync(requirementsPath)) {
|
|
255
|
-
const projectRoot = getProjectRoot();
|
|
256
|
-
const templatePath = path.join(projectRoot, 'templates', 'python');
|
|
257
|
-
await buildCopy.copyTemplateFilesToDevDir(templatePath, devDir, language);
|
|
258
|
-
logger.log(chalk.green(`✓ Generated application files from ${language} template`));
|
|
259
|
-
}
|
|
284
|
+
const filesCopied = await copyApplicationSourceFiles(appName, devDir);
|
|
285
|
+
if (!filesCopied) {
|
|
286
|
+
await copyTemplateFilesIfNeeded(devDir, null, buildConfig, options);
|
|
260
287
|
}
|
|
261
288
|
|
|
262
289
|
return { devDir, effectiveImageName, imageName, appConfig };
|