@aifabrix/builder 2.33.6 → 2.36.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 +5 -0
- package/integration/hubspot/README.md +47 -0
- package/integration/hubspot/env.template +6 -1
- package/integration/hubspot/hubspot-deploy.json +0 -6
- package/integration/hubspot/hubspot-system.json +0 -6
- package/integration/hubspot/test-artifacts/wizard-hubspot-env-vars.yaml +1 -1
- package/integration/hubspot/test-dataplane-down-helpers.js +4 -1
- package/integration/hubspot/test-dataplane-down-tests.js +5 -33
- package/integration/hubspot/test-dataplane-down.js +60 -8
- package/integration/hubspot/test.js +53 -19
- package/integration/hubspot/wizard-hubspot-e2e.yaml +1 -1
- package/lib/api/wizard.api.js +24 -1
- package/lib/app/config.js +0 -1
- package/lib/app/show-display.js +210 -0
- package/lib/app/show.js +642 -0
- package/lib/cli.js +28 -7
- package/lib/commands/app.js +15 -0
- package/lib/commands/wizard-core-helpers.js +278 -0
- package/lib/commands/wizard-core.js +26 -145
- package/lib/commands/wizard-headless.js +2 -2
- package/lib/commands/wizard-helpers.js +152 -0
- package/lib/commands/wizard.js +276 -68
- package/lib/generator/index.js +32 -0
- package/lib/generator/wizard-prompts.js +124 -45
- package/lib/schema/env-config.yaml +1 -3
- package/lib/utils/cli-utils.js +40 -1
- package/lib/utils/token-manager.js +30 -22
- package/lib/validation/wizard-config-validator.js +35 -0
- package/package.json +2 -2
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Human-readable display for aifabrix show command.
|
|
3
|
+
* Single display function for offline and online (unified summary shape).
|
|
4
|
+
*
|
|
5
|
+
* @fileoverview Display formatting for show command
|
|
6
|
+
* @author AI Fabrix Team
|
|
7
|
+
* @version 2.0.0
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
const chalk = require('chalk');
|
|
13
|
+
const logger = require('../utils/logger');
|
|
14
|
+
|
|
15
|
+
function logSourceAndHeader(summary) {
|
|
16
|
+
const isOffline = summary.source === 'offline';
|
|
17
|
+
const sourceLabel = isOffline
|
|
18
|
+
? `Source: offline (${summary.path || '—'})`
|
|
19
|
+
: `Source: online (${summary.controllerUrl || '—'})`;
|
|
20
|
+
logger.log(sourceLabel);
|
|
21
|
+
logger.log('');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function logApplicationRequired(a) {
|
|
25
|
+
logger.log('📱 Application');
|
|
26
|
+
logger.log(` Key: ${a.key ?? '—'}`);
|
|
27
|
+
logger.log(` Display name: ${a.displayName ?? '—'}`);
|
|
28
|
+
logger.log(` Description: ${a.description ?? '—'}`);
|
|
29
|
+
logger.log(` Type: ${a.type ?? '—'}`);
|
|
30
|
+
const port = (a.port !== undefined && a.port !== null) ? a.port : '—';
|
|
31
|
+
logger.log(` Port: ${port}`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function logApplicationOptional(a) {
|
|
35
|
+
if (a.deploymentKey !== undefined) logger.log(` Deployment: ${a.deploymentKey ?? '—'}`);
|
|
36
|
+
if (a.image !== undefined) logger.log(` Image: ${a.image ?? '—'}`);
|
|
37
|
+
if (a.registryMode !== undefined) logger.log(` Registry: ${a.registryMode ?? '—'}`);
|
|
38
|
+
if (a.healthCheck !== undefined) logger.log(` Health: ${a.healthCheck ?? '—'}`);
|
|
39
|
+
if (a.build !== undefined) logger.log(` Build: ${a.build ?? '—'}`);
|
|
40
|
+
if (a.status !== undefined) logger.log(` Status: ${a.status ?? '—'}`);
|
|
41
|
+
if (a.url !== undefined) logger.log(` URL: ${a.url ?? '—'}`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function logApplicationFields(a) {
|
|
45
|
+
logApplicationRequired(a);
|
|
46
|
+
logApplicationOptional(a);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function logApplicationExternalIntegration(ei) {
|
|
50
|
+
logger.log(' External integration:');
|
|
51
|
+
logger.log(` schemaBasePath: ${ei.schemaBasePath}`);
|
|
52
|
+
logger.log(` systems: [${(ei.systems || []).join(', ')}]`);
|
|
53
|
+
logger.log(` dataSources: [${(ei.dataSources || []).join(', ')}]`);
|
|
54
|
+
logger.log(chalk.gray('\n For external system data as on dataplane, run: aifabrix show <appKey> --online or aifabrix app show <appKey>.'));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function logApplicationSection(a, isExternal) {
|
|
58
|
+
logApplicationFields(a);
|
|
59
|
+
if (isExternal && a.externalIntegration) {
|
|
60
|
+
logApplicationExternalIntegration(a.externalIntegration);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function logRolesSection(roles) {
|
|
65
|
+
if (roles.length === 0) return;
|
|
66
|
+
logger.log('');
|
|
67
|
+
logger.log('👥 Roles');
|
|
68
|
+
roles.forEach((r) => {
|
|
69
|
+
const ro = typeof r === 'object' ? r : { name: r, value: r };
|
|
70
|
+
const name = ro.name ?? ro.value ?? '—';
|
|
71
|
+
const value = ro.value ?? ro.name ?? '—';
|
|
72
|
+
logger.log(` • ${name} (${value})`);
|
|
73
|
+
if (ro.description) logger.log(` \t${ro.description}`);
|
|
74
|
+
if (ro.groups && ro.groups.length > 0) logger.log(` \tgroups: [${ro.groups.join(', ')}]`);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function logPermissionsSection(permissions) {
|
|
79
|
+
if (permissions.length === 0) return;
|
|
80
|
+
logger.log('');
|
|
81
|
+
logger.log('🛡️ Permissions');
|
|
82
|
+
permissions.forEach((p) => {
|
|
83
|
+
const name = p.name ?? '—';
|
|
84
|
+
const roleList = (p.roles || []).join(', ');
|
|
85
|
+
logger.log(` • ${name}`);
|
|
86
|
+
logger.log(` \troles: [${roleList}]`);
|
|
87
|
+
if (p.description) logger.log(` \t${p.description}`);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function logAuthSection(authentication) {
|
|
92
|
+
if (!authentication) return;
|
|
93
|
+
logger.log('');
|
|
94
|
+
logger.log('🔐 Authentication');
|
|
95
|
+
const sso = authentication.enableSSO ? 'enabled' : 'disabled';
|
|
96
|
+
logger.log(` SSO: ${sso} type: ${authentication.type ?? '—'} requiredRoles: [${(authentication.requiredRoles || []).join(', ')}]`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function logConfigurationsSection(portalInputConfigurations) {
|
|
100
|
+
if (portalInputConfigurations.length === 0) return;
|
|
101
|
+
logger.log('');
|
|
102
|
+
logger.log('📝 Configurations');
|
|
103
|
+
portalInputConfigurations.forEach((c) => {
|
|
104
|
+
logger.log(` ${c.label ?? c.name ?? '—'}: ${c.value ?? '—'}`);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function logDatabasesSection(dbNames) {
|
|
109
|
+
if (dbNames.length === 0) return;
|
|
110
|
+
logger.log('');
|
|
111
|
+
logger.log('🗄️ Databases');
|
|
112
|
+
logger.log(` ${dbNames.join(', ')}`);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function logExternalSystemMain(ext) {
|
|
116
|
+
logger.log('🔗 External system (dataplane)');
|
|
117
|
+
logger.log(` Dataplane: ${ext.dataplaneUrl}`);
|
|
118
|
+
logger.log(` System key: ${ext.systemKey}`);
|
|
119
|
+
logger.log(` Display name: ${ext.displayName}`);
|
|
120
|
+
logger.log(` Type: ${ext.type}`);
|
|
121
|
+
logger.log(` Status: ${ext.status}`);
|
|
122
|
+
logger.log(` Version: ${ext.version ?? '—'}`);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function logExternalSystemDataSources(dataSources) {
|
|
126
|
+
if (!dataSources || dataSources.length === 0) return;
|
|
127
|
+
logger.log(' DataSources:');
|
|
128
|
+
dataSources.forEach((ds) => {
|
|
129
|
+
logger.log(` • ${ds.key} ${ds.displayName ?? ''} (systemKey: ${ds.systemKey ?? '—'})`);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Log OpenAPI and MCP documentation links for external system (dataplane endpoints).
|
|
135
|
+
* REST: /api/v1/rest/{systemKey}/docs; MCP: /api/v1/mcp/{systemKey}/{resourceType}/docs per dataSource.
|
|
136
|
+
* @param {Object} ext - External system result (dataplaneUrl, systemKey, dataSources, openapiFiles, openapiEndpoints)
|
|
137
|
+
*/
|
|
138
|
+
function logExternalSystemServiceLinks(ext) {
|
|
139
|
+
if (!ext || !ext.dataplaneUrl || !ext.systemKey) return;
|
|
140
|
+
const base = ext.dataplaneUrl.replace(/\/$/, '');
|
|
141
|
+
const sk = ext.systemKey;
|
|
142
|
+
const hasOpenApi = (ext.openapiFiles && ext.openapiFiles.length > 0) ||
|
|
143
|
+
(ext.openapiEndpoints && ext.openapiEndpoints.length > 0);
|
|
144
|
+
const dataSources = ext.dataSources || [];
|
|
145
|
+
const hasMcp = dataSources.length > 0;
|
|
146
|
+
if (!hasOpenApi && !hasMcp) return;
|
|
147
|
+
|
|
148
|
+
logger.log(' Service links:');
|
|
149
|
+
logger.log(` REST OpenAPI: ${base}/api/v1/rest/${sk}/docs`);
|
|
150
|
+
if (hasMcp) {
|
|
151
|
+
dataSources.forEach((ds) => {
|
|
152
|
+
const resourceType = ds.key || ds.systemKey || sk;
|
|
153
|
+
logger.log(` MCP ${resourceType}: ${base}/api/v1/mcp/${sk}/${resourceType}/docs`);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function logExternalSystemApplication(ap) {
|
|
159
|
+
if (!ap) return;
|
|
160
|
+
logger.log(' Application (from dataplane):');
|
|
161
|
+
logger.log(` key: ${ap.key} displayName: ${ap.displayName} type: ${ap.type}`);
|
|
162
|
+
if (ap.roles) logger.log(` roles: ${Array.isArray(ap.roles) ? ap.roles.join(', ') : ap.roles}`);
|
|
163
|
+
if (ap.permissions) logger.log(` permissions: ${Array.isArray(ap.permissions) ? ap.permissions.join(', ') : ap.permissions}`);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function logExternalSystemSection(ext) {
|
|
167
|
+
if (!ext) return;
|
|
168
|
+
logger.log('');
|
|
169
|
+
if (ext.error) {
|
|
170
|
+
logger.log('🔗 External system (dataplane): not available (dataplane unreachable or not found).');
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
logExternalSystemMain(ext);
|
|
174
|
+
logExternalSystemDataSources(ext.dataSources);
|
|
175
|
+
logExternalSystemApplication(ext.application);
|
|
176
|
+
if (ext.openapiFiles && ext.openapiFiles.length > 0) {
|
|
177
|
+
logger.log(` OpenAPI files: ${ext.openapiFiles.length}`);
|
|
178
|
+
}
|
|
179
|
+
if (ext.openapiEndpoints && ext.openapiEndpoints.length > 0) {
|
|
180
|
+
const sample = ext.openapiEndpoints.slice(0, 3).map((e) => `${e.method || 'GET'} ${e.path || e.pathPattern || e}`).join(', ');
|
|
181
|
+
logger.log(` OpenAPI endpoints: ${ext.openapiEndpoints.length} (e.g. ${sample}${ext.openapiEndpoints.length > 3 ? ' …' : ''})`);
|
|
182
|
+
}
|
|
183
|
+
logExternalSystemServiceLinks(ext);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Format and print human-readable show output (offline or online).
|
|
188
|
+
* @param {Object} summary - Unified summary (buildOfflineSummaryFromDeployJson or buildOnlineSummary)
|
|
189
|
+
*/
|
|
190
|
+
function display(summary) {
|
|
191
|
+
const a = summary.application;
|
|
192
|
+
const roles = summary.roles ?? a.roles ?? [];
|
|
193
|
+
const permissions = summary.permissions ?? a.permissions ?? [];
|
|
194
|
+
const authentication = summary.authentication ?? a.authentication;
|
|
195
|
+
const portalInputConfigurations = summary.portalInputConfigurations ?? a.portalInputConfigurations ?? [];
|
|
196
|
+
const databases = summary.databases ?? a.databases ?? [];
|
|
197
|
+
const dbNames = Array.isArray(databases) ? databases.map((d) => (d && d.name) || d).filter(Boolean) : [];
|
|
198
|
+
|
|
199
|
+
logSourceAndHeader(summary);
|
|
200
|
+
logApplicationSection(a, summary.isExternal);
|
|
201
|
+
logRolesSection(roles);
|
|
202
|
+
logPermissionsSection(permissions);
|
|
203
|
+
logAuthSection(authentication);
|
|
204
|
+
logConfigurationsSection(portalInputConfigurations);
|
|
205
|
+
logDatabasesSection(dbNames);
|
|
206
|
+
logExternalSystemSection(summary.externalSystem);
|
|
207
|
+
logger.log('');
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
module.exports = { display };
|