@zintrust/core 0.1.0 → 0.1.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 +214 -0
- package/package.json +4 -34
- package/public/index.html +535 -0
- package/src/builder/BundleOptimizer.d.ts.map +1 -1
- package/src/builder/BundleOptimizer.js +20 -26
- package/src/cache/Cache.d.ts.map +1 -1
- package/src/cache/Cache.js +4 -2
- package/src/cache/drivers/KVDriver.d.ts.map +1 -1
- package/src/cache/drivers/KVDriver.js +2 -1
- package/src/cache/drivers/MemoryDriver.d.ts.map +1 -1
- package/src/cache/drivers/MemoryDriver.js +5 -0
- package/src/cli/CLI.d.ts.map +1 -1
- package/src/cli/CLI.js +11 -14
- package/src/cli/ErrorHandler.d.ts.map +1 -1
- package/src/cli/ErrorHandler.js +2 -4
- package/src/cli/commands/AddCommand.d.ts +81 -0
- package/src/cli/commands/AddCommand.d.ts.map +1 -1
- package/src/cli/commands/AddCommand.js +23 -4
- package/src/cli/commands/ConfigCommand.d.ts.map +1 -1
- package/src/cli/commands/ConfigCommand.js +27 -23
- package/src/cli/commands/D1MigrateCommand.d.ts.map +1 -1
- package/src/cli/commands/D1MigrateCommand.js +3 -2
- package/src/cli/commands/FixCommand.d.ts.map +1 -1
- package/src/cli/commands/FixCommand.js +1 -0
- package/src/cli/commands/LogsCommand.d.ts.map +1 -1
- package/src/cli/commands/LogsCommand.js +3 -5
- package/src/cli/commands/MigrateCommand.d.ts.map +1 -1
- package/src/cli/commands/MigrateCommand.js +3 -3
- package/src/cli/commands/NewCommand.d.ts.map +1 -1
- package/src/cli/commands/NewCommand.js +3 -1
- package/src/cli/commands/QACommand.d.ts.map +1 -1
- package/src/cli/commands/QACommand.js +5 -6
- package/src/cli/scaffolding/ControllerGenerator.d.ts.map +1 -1
- package/src/cli/scaffolding/ControllerGenerator.js +10 -9
- package/src/cli/scaffolding/MigrationGenerator.d.ts.map +1 -1
- package/src/cli/scaffolding/MigrationGenerator.js +10 -9
- package/src/cli/scaffolding/ModelGenerator.d.ts.map +1 -1
- package/src/cli/scaffolding/ModelGenerator.js +10 -9
- package/src/cli/scaffolding/ProjectScaffolder.js +1 -1
- package/src/cli/scaffolding/ResponseFactoryGenerator.js +1 -1
- package/src/cli/scaffolding/RouteGenerator.d.ts.map +1 -1
- package/src/cli/scaffolding/RouteGenerator.js +14 -13
- package/src/cli/scaffolding/SeederGenerator.js +1 -1
- package/src/cli/scaffolding/ServiceIntegrationTestGenerator.d.ts.map +1 -1
- package/src/cli/scaffolding/ServiceIntegrationTestGenerator.js +6 -5
- package/src/cli/scaffolding/ServiceRequestFactoryGenerator.d.ts +1 -1
- package/src/cli/scaffolding/ServiceRequestFactoryGenerator.d.ts.map +1 -1
- package/src/cli/scaffolding/ServiceRequestFactoryGenerator.js +2 -2
- package/src/cli/scaffolding/ServiceScaffolder.d.ts.map +1 -1
- package/src/cli/scaffolding/ServiceScaffolder.js +11 -10
- package/src/cli/scaffolding/TemplateEngine.d.ts +10 -3
- package/src/cli/scaffolding/TemplateEngine.d.ts.map +1 -1
- package/src/cli/scaffolding/TemplateEngine.js +15 -285
- package/src/config/SecretsManager.d.ts.map +1 -1
- package/src/config/SecretsManager.js +11 -11
- package/src/functions/lambda.d.ts.map +1 -1
- package/src/functions/lambda.js +6 -1
- package/src/http/Request.d.ts +1 -1
- package/src/http/Request.d.ts.map +1 -1
- package/src/microservices/MicroserviceBootstrap.d.ts.map +1 -1
- package/src/microservices/MicroserviceBootstrap.js +6 -5
- package/src/microservices/MicroserviceManager.d.ts.map +1 -1
- package/src/microservices/MicroserviceManager.js +9 -10
- package/src/microservices/PostgresAdapter.d.ts.map +1 -1
- package/src/microservices/PostgresAdapter.js +4 -3
- package/src/microservices/ServiceBundler.js +3 -3
- package/src/microservices/ServiceHealthMonitor.d.ts.map +1 -1
- package/src/microservices/ServiceHealthMonitor.js +6 -2
- package/src/performance/Benchmark.d.ts.map +1 -1
- package/src/performance/Benchmark.js +3 -0
- package/src/performance/Optimizer.d.ts.map +1 -1
- package/src/performance/Optimizer.js +7 -5
- package/src/runtime/RuntimeDetector.d.ts.map +1 -1
- package/src/runtime/RuntimeDetector.js +1 -0
- package/src/runtime/adapters/DenoAdapter.js +9 -7
- package/src/runtime/adapters/FargateAdapter.d.ts.map +1 -1
- package/src/runtime/adapters/FargateAdapter.js +4 -4
- package/src/runtime/adapters/NodeServerAdapter.d.ts.map +1 -1
- package/src/runtime/adapters/NodeServerAdapter.js +7 -7
- package/src/templates/project/basic/config/SecretsManager.ts.tpl +22 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KVDriver.d.ts","sourceRoot":"","sources":["../../../../src/cache/drivers/KVDriver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"KVDriver.d.ts","sourceRoot":"","sources":["../../../../src/cache/drivers/KVDriver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAiEjD;;GAEG;AACH,eAAO,MAAM,QAAQ;kBAjDF,WAAW;EAmD5B,CAAC"}
|
|
@@ -15,7 +15,7 @@ const create = () => {
|
|
|
15
15
|
if (kv === undefined)
|
|
16
16
|
return null;
|
|
17
17
|
const value = await kv.get(key, { type: 'json' });
|
|
18
|
-
return value;
|
|
18
|
+
return value ?? null;
|
|
19
19
|
},
|
|
20
20
|
async set(key, value, ttl) {
|
|
21
21
|
if (kv === undefined) {
|
|
@@ -37,6 +37,7 @@ const create = () => {
|
|
|
37
37
|
async clear() {
|
|
38
38
|
// KV doesn't support clearing all keys easily without listing and deleting
|
|
39
39
|
Logger.warn('KV clear() is not implemented due to Cloudflare KV limitations.');
|
|
40
|
+
await Promise.resolve();
|
|
40
41
|
},
|
|
41
42
|
async has(key) {
|
|
42
43
|
if (kv === undefined)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryDriver.d.ts","sourceRoot":"","sources":["../../../../src/cache/drivers/MemoryDriver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"MemoryDriver.d.ts","sourceRoot":"","sources":["../../../../src/cache/drivers/MemoryDriver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAuDjD;;GAEG;AACH,eAAO,MAAM,YAAY;kBAnDN,WAAW;EAqD5B,CAAC"}
|
|
@@ -11,6 +11,7 @@ const create = () => {
|
|
|
11
11
|
const storage = new Map();
|
|
12
12
|
return {
|
|
13
13
|
async get(key) {
|
|
14
|
+
await Promise.resolve();
|
|
14
15
|
const item = storage.get(key);
|
|
15
16
|
if (item === undefined)
|
|
16
17
|
return null;
|
|
@@ -23,14 +24,18 @@ const create = () => {
|
|
|
23
24
|
async set(key, value, ttl) {
|
|
24
25
|
const expires = ttl === undefined ? null : Date.now() + ttl * 1000;
|
|
25
26
|
storage.set(key, { value, expires });
|
|
27
|
+
await Promise.resolve();
|
|
26
28
|
},
|
|
27
29
|
async delete(key) {
|
|
28
30
|
storage.delete(key);
|
|
31
|
+
await Promise.resolve();
|
|
29
32
|
},
|
|
30
33
|
async clear() {
|
|
31
34
|
storage.clear();
|
|
35
|
+
await Promise.resolve();
|
|
32
36
|
},
|
|
33
37
|
async has(key) {
|
|
38
|
+
await Promise.resolve();
|
|
34
39
|
const item = storage.get(key);
|
|
35
40
|
if (item === undefined)
|
|
36
41
|
return false;
|
package/src/cli/CLI.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CLI.d.ts","sourceRoot":"","sources":["../../../src/cli/CLI.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,MAAM,WAAW,IAAI;IACnB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,UAAU,IAAI,OAAO,CAAC;CACvB;
|
|
1
|
+
{"version":3,"file":"CLI.d.ts","sourceRoot":"","sources":["../../../src/cli/CLI.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,MAAM,WAAW,IAAI;IACnB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,UAAU,IAAI,OAAO,CAAC;CACvB;AAiLD;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG;cACJ,IAAI;EAed,CAAC"}
|
package/src/cli/CLI.js
CHANGED
|
@@ -132,9 +132,19 @@ const handleExecutionError = (error, version, log = true) => {
|
|
|
132
132
|
if (error === version) {
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
|
+
const exitCode = getExitCode(error);
|
|
135
136
|
if (error instanceof Error) {
|
|
136
137
|
ErrorHandler.handle(error, undefined, log);
|
|
137
138
|
}
|
|
139
|
+
// Check for commander-specific errors that need special handling
|
|
140
|
+
if (error instanceof Error &&
|
|
141
|
+
'code' in error &&
|
|
142
|
+
typeof error.code === 'string' &&
|
|
143
|
+
error.code.startsWith('commander.')) {
|
|
144
|
+
ErrorFactory.createCliError('CLI execution failed', error);
|
|
145
|
+
process.exit(exitCode);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
138
148
|
throw ErrorFactory.createCliError('Unhandled CLI execution error', error);
|
|
139
149
|
};
|
|
140
150
|
/**
|
|
@@ -162,20 +172,7 @@ const runCLI = async (program, version, args) => {
|
|
|
162
172
|
await program.parseAsync(['node', 'zintrust', ...processedArgs]);
|
|
163
173
|
}
|
|
164
174
|
catch (error) {
|
|
165
|
-
//
|
|
166
|
-
if (error instanceof Error &&
|
|
167
|
-
'code' in error &&
|
|
168
|
-
typeof error.code === 'string' &&
|
|
169
|
-
error.code.startsWith('commander.')) {
|
|
170
|
-
const exitCode = getExitCode(error);
|
|
171
|
-
if (exitCode !== 0) {
|
|
172
|
-
ErrorFactory.createCliError('CLI execution failed', error);
|
|
173
|
-
process.exit(exitCode);
|
|
174
|
-
}
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
// Handle all other errors with proper logging
|
|
178
|
-
ErrorFactory.createCliError('CLI execution failed', error);
|
|
175
|
+
// Handle all errors with proper logging and exit logic
|
|
179
176
|
handleExecutionError(error, version, false);
|
|
180
177
|
}
|
|
181
178
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorHandler.d.ts","sourceRoot":"","sources":["../../../src/cli/ErrorHandler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,eAAO,MAAM,UAAU;;;;CAIb,CAAC;
|
|
1
|
+
{"version":3,"file":"ErrorHandler.d.ts","sourceRoot":"","sources":["../../../src/cli/ErrorHandler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,eAAO,MAAM,UAAU;;;;CAIb,CAAC;AAqGX;;GAEG;AACH,eAAO,MAAM,YAAY;oBAjGhB,KAAK,GAAG,MAAM,aACX,MAAM,QACX,OAAO,KACX,IAAI;0BAYsB,MAAM,YAAY,MAAM,KAAG,IAAI;oBAY9B,MAAM,KAAG,IAAI;uBA4CV,MAAM,KAAG,IAAI;oBAQb,MAAM,KAAG,IAAI;qBAQf,MAAM,YAAW,OAAO,KAAW,IAAI;sBApDtC,MAAM,KAAG,IAAI;EAsE3C,CAAC"}
|
package/src/cli/ErrorHandler.js
CHANGED
|
@@ -17,9 +17,8 @@ export const EXIT_CODES = {
|
|
|
17
17
|
*/
|
|
18
18
|
const handleError = (error, exitCode = EXIT_CODES.RUNTIME_ERROR, log = true) => {
|
|
19
19
|
const message = typeof error === 'string' ? error : error.message;
|
|
20
|
-
const formattedMessage = `${chalk.red('[ERROR]')} ${message}`;
|
|
21
20
|
if (log) {
|
|
22
|
-
Logger.error(
|
|
21
|
+
Logger.error(message);
|
|
23
22
|
}
|
|
24
23
|
process.exit(exitCode);
|
|
25
24
|
};
|
|
@@ -29,8 +28,7 @@ const handleError = (error, exitCode = EXIT_CODES.RUNTIME_ERROR, log = true) =>
|
|
|
29
28
|
const usageError = (message, command) => {
|
|
30
29
|
const helpText = `Run: zin ${command} --help`;
|
|
31
30
|
const hint = command !== undefined && command !== '' ? `\n${chalk.gray(helpText)}` : '';
|
|
32
|
-
|
|
33
|
-
Logger.warn(formattedMessage);
|
|
31
|
+
Logger.error(`${message}${hint}`);
|
|
34
32
|
process.exit(EXIT_CODES.USAGE_ERROR);
|
|
35
33
|
};
|
|
36
34
|
/**
|
|
@@ -3,6 +3,64 @@
|
|
|
3
3
|
* Add services and features to existing Zintrust project
|
|
4
4
|
*/
|
|
5
5
|
import { IBaseCommand } from '../BaseCommand';
|
|
6
|
+
import { ResponseField } from '../scaffolding/ResponseFactoryGenerator';
|
|
7
|
+
interface ServicePromptAnswers {
|
|
8
|
+
name: string;
|
|
9
|
+
domain: string;
|
|
10
|
+
port: number;
|
|
11
|
+
database: 'shared' | 'isolated';
|
|
12
|
+
auth: 'api-key' | 'jwt' | 'none' | 'custom';
|
|
13
|
+
}
|
|
14
|
+
interface FeaturePromptAnswers {
|
|
15
|
+
name: string;
|
|
16
|
+
servicePath: string;
|
|
17
|
+
withTest: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface MigrationPromptAnswers {
|
|
20
|
+
name: string;
|
|
21
|
+
type: string;
|
|
22
|
+
}
|
|
23
|
+
interface ModelPromptAnswers {
|
|
24
|
+
name: string;
|
|
25
|
+
softDelete: boolean;
|
|
26
|
+
timestamps: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface ControllerPromptAnswers {
|
|
29
|
+
name: string;
|
|
30
|
+
type: string;
|
|
31
|
+
}
|
|
32
|
+
interface RoutesPromptAnswers {
|
|
33
|
+
name: string;
|
|
34
|
+
}
|
|
35
|
+
interface FactoryPromptAnswers {
|
|
36
|
+
name: string;
|
|
37
|
+
model: string;
|
|
38
|
+
addRelationships: boolean;
|
|
39
|
+
relationships?: string;
|
|
40
|
+
}
|
|
41
|
+
interface SeederPromptAnswers {
|
|
42
|
+
name: string;
|
|
43
|
+
model: string;
|
|
44
|
+
count: string;
|
|
45
|
+
states: boolean;
|
|
46
|
+
relationships: boolean;
|
|
47
|
+
truncate: boolean;
|
|
48
|
+
}
|
|
49
|
+
interface RequestFactoryPromptAnswers {
|
|
50
|
+
factoryName: string;
|
|
51
|
+
requestName: string;
|
|
52
|
+
endpoint: string;
|
|
53
|
+
method: string;
|
|
54
|
+
withDTO: boolean;
|
|
55
|
+
}
|
|
56
|
+
interface ResponseFactoryPromptAnswers {
|
|
57
|
+
factoryName: string;
|
|
58
|
+
responseName: string;
|
|
59
|
+
responseType: string;
|
|
60
|
+
factoryPath?: string;
|
|
61
|
+
responsePath?: string;
|
|
62
|
+
withDTO: boolean;
|
|
63
|
+
}
|
|
6
64
|
/**
|
|
7
65
|
* Add Command Factory
|
|
8
66
|
*/
|
|
@@ -11,5 +69,28 @@ export declare const AddCommand: Readonly<{
|
|
|
11
69
|
* Create a new add command instance
|
|
12
70
|
*/
|
|
13
71
|
create(): IBaseCommand;
|
|
72
|
+
/**
|
|
73
|
+
* Internal helpers for testing
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
_helpers: {
|
|
77
|
+
promptServiceConfig: (defaultName: string) => Promise<ServicePromptAnswers>;
|
|
78
|
+
promptFeatureConfig: () => Promise<FeaturePromptAnswers>;
|
|
79
|
+
promptMigrationConfig: () => Promise<MigrationPromptAnswers>;
|
|
80
|
+
promptModelConfig: () => Promise<ModelPromptAnswers>;
|
|
81
|
+
promptControllerConfig: () => Promise<ControllerPromptAnswers>;
|
|
82
|
+
promptRoutesConfig: () => Promise<RoutesPromptAnswers>;
|
|
83
|
+
promptFactoryConfig: () => Promise<FactoryPromptAnswers>;
|
|
84
|
+
promptSeederConfig: () => Promise<SeederPromptAnswers>;
|
|
85
|
+
promptRequestFactoryConfig: () => Promise<RequestFactoryPromptAnswers>;
|
|
86
|
+
promptResponseFactoryName: () => Promise<string>;
|
|
87
|
+
promptResponseFactoryConfig: (defaultResponseName: string) => Promise<ResponseFactoryPromptAnswers>;
|
|
88
|
+
promptWorkflowConfig: (defaultName: string) => Promise<{
|
|
89
|
+
name: string;
|
|
90
|
+
platform: "lambda" | "fargate" | "cloudflare" | "deno" | "all";
|
|
91
|
+
}>;
|
|
92
|
+
getDefaultResponseFields: (responseType: string) => ResponseField[];
|
|
93
|
+
};
|
|
14
94
|
}>;
|
|
95
|
+
export {};
|
|
15
96
|
//# sourceMappingURL=AddCommand.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/AddCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"AddCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/AddCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAO7E,OAAO,EAGL,aAAa,EACd,MAAM,2CAA2C,CAAC;AAoCnD,UAAU,oBAAoB;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAAC;IAChC,IAAI,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;CAC7C;AAED,UAAU,oBAAoB;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,uBAAuB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,oBAAoB;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,2BAA2B;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,UAAU,4BAA4B;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;CAClB;AAi+BD;;GAEG;AACH,eAAO,MAAM,UAAU;IACrB;;OAEG;cACO,YAAY;IAWtB;;;OAGG;;2CAp9B2C,MAAM,KAAG,OAAO,CAAC,oBAAoB,CAAC;mCA2EhD,OAAO,CAAC,oBAAoB,CAAC;qCA8D3B,OAAO,CAAC,sBAAsB,CAAC;iCAmDnC,OAAO,CAAC,kBAAkB,CAAC;sCA4DtB,OAAO,CAAC,uBAAuB,CAAC;kCAwDpC,OAAO,CAAC,mBAAmB,CAAC;mCAkE3B,OAAO,CAAC,oBAAoB,CAAC;kCAuI9B,OAAO,CAAC,mBAAmB,CAAC;0CAkGpB,OAAO,CAAC,2BAA2B,CAAC;yCAwFrC,OAAO,CAAC,MAAM,CAAC;2DAkBpC,MAAM,KAC1B,OAAO,CAAC,4BAA4B,CAAC;4CAoHzB,MAAM,KAClB,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,YAAY,GAAG,MAAM,GAAG,KAAK,CAAA;SAAE,CAAC;iDAlE5C,MAAM,KAAG,aAAa,EAAE;;EA2OtE,CAAC"}
|
|
@@ -143,7 +143,7 @@ const addFeature = async (cmd, featureName, opts) => {
|
|
|
143
143
|
throw ErrorFactory.createValidationError('Service path is required');
|
|
144
144
|
const fullServicePath = path.join(projectRoot, servicePath);
|
|
145
145
|
cmd.info(`Adding feature: ${name}...`);
|
|
146
|
-
const result =
|
|
146
|
+
const result = FeatureScaffolder.addFeature({
|
|
147
147
|
name: name,
|
|
148
148
|
servicePath: fullServicePath,
|
|
149
149
|
withTest: opts.withTest,
|
|
@@ -151,7 +151,7 @@ const addFeature = async (cmd, featureName, opts) => {
|
|
|
151
151
|
if (result.success === false)
|
|
152
152
|
throw ErrorFactory.createCliError(result.message);
|
|
153
153
|
cmd.success(`Feature '${name}' added successfully!`);
|
|
154
|
-
cmd.info(`Files created: ${result.filesCreated
|
|
154
|
+
cmd.info(`Files created: ${result.filesCreated?.length || 0}`);
|
|
155
155
|
cmd.info(`\nNext steps:\n • Integrate feature in service\n • Update routes if needed\n • Add to configuration`);
|
|
156
156
|
};
|
|
157
157
|
const promptMigrationConfig = async () => {
|
|
@@ -380,7 +380,7 @@ const addFactory = async (cmd, factoryName, opts) => {
|
|
|
380
380
|
else if (config.name === '') {
|
|
381
381
|
throw ErrorFactory.createValidationError('Factory name is required');
|
|
382
382
|
}
|
|
383
|
-
if (config.modelName === ''
|
|
383
|
+
if (config.modelName === '') {
|
|
384
384
|
throw ErrorFactory.createValidationError('Model name is required for factory generation');
|
|
385
385
|
}
|
|
386
386
|
const factoriesPath = path.join(projectRoot, 'database', 'factories');
|
|
@@ -485,7 +485,7 @@ const addSeeder = async (cmd, seederName, opts) => {
|
|
|
485
485
|
else if (config.name === '') {
|
|
486
486
|
throw ErrorFactory.createValidationError('Seeder name is required');
|
|
487
487
|
}
|
|
488
|
-
if (config.modelName === ''
|
|
488
|
+
if (config.modelName === '') {
|
|
489
489
|
throw ErrorFactory.createValidationError('Model name is required for seeder generation');
|
|
490
490
|
}
|
|
491
491
|
const seedersPath = path.join(projectRoot, 'database', 'seeders');
|
|
@@ -814,4 +814,23 @@ export const AddCommand = Object.freeze({
|
|
|
814
814
|
});
|
|
815
815
|
return cmd;
|
|
816
816
|
},
|
|
817
|
+
/**
|
|
818
|
+
* Internal helpers for testing
|
|
819
|
+
* @internal
|
|
820
|
+
*/
|
|
821
|
+
_helpers: {
|
|
822
|
+
promptServiceConfig,
|
|
823
|
+
promptFeatureConfig,
|
|
824
|
+
promptMigrationConfig,
|
|
825
|
+
promptModelConfig,
|
|
826
|
+
promptControllerConfig,
|
|
827
|
+
promptRoutesConfig,
|
|
828
|
+
promptFactoryConfig,
|
|
829
|
+
promptSeederConfig,
|
|
830
|
+
promptRequestFactoryConfig,
|
|
831
|
+
promptResponseFactoryName,
|
|
832
|
+
promptResponseFactoryConfig,
|
|
833
|
+
promptWorkflowConfig,
|
|
834
|
+
getDefaultResponseFields,
|
|
835
|
+
},
|
|
817
836
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/ConfigCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfigCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/ConfigCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA4T7E;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;cACO,YAAY;EAsEtB,CAAC"}
|
|
@@ -66,7 +66,10 @@ const displayValidationStatus = (cmd, config) => {
|
|
|
66
66
|
const errors = validation?.errors ?? [];
|
|
67
67
|
cmd.info(chalk.red(` ❌ Configuration has ${errors.length} errors:`));
|
|
68
68
|
for (const error of errors) {
|
|
69
|
-
|
|
69
|
+
const message = error !== null && typeof error === 'object' && 'message' in error
|
|
70
|
+
? String(error.message)
|
|
71
|
+
: String(error);
|
|
72
|
+
cmd.info(chalk.red(` - ${message}`));
|
|
70
73
|
}
|
|
71
74
|
};
|
|
72
75
|
const displayConfigurationKeys = (cmd, keys) => {
|
|
@@ -83,23 +86,22 @@ const displayConfigurationValues = (cmd, config) => {
|
|
|
83
86
|
cmd.info(`${chalk.cyan(key)}: ${formatConfigValue(value)}`);
|
|
84
87
|
}
|
|
85
88
|
};
|
|
86
|
-
const handleGet =
|
|
89
|
+
const handleGet = (cmd, manager, key) => {
|
|
87
90
|
if (key === undefined) {
|
|
88
91
|
ErrorHandler.usageError('Configuration key is required for "get"');
|
|
89
|
-
return;
|
|
90
92
|
}
|
|
91
93
|
if (typeof manager.get !== 'function') {
|
|
92
94
|
cmd.warn('Configuration manager does not support "get"');
|
|
93
|
-
return;
|
|
94
95
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
if (typeof manager.get === 'function' && key !== undefined) {
|
|
97
|
+
const value = manager.get(key);
|
|
98
|
+
if (value === undefined) {
|
|
99
|
+
cmd.warn(`Configuration key "${key}" not found`);
|
|
100
|
+
}
|
|
101
|
+
cmd.info(formatConfigValue(value));
|
|
99
102
|
}
|
|
100
|
-
cmd.info(formatConfigValue(value));
|
|
101
103
|
};
|
|
102
|
-
const handleSet =
|
|
104
|
+
const handleSet = (cmd, manager, key, value) => {
|
|
103
105
|
if (key === undefined || value === undefined) {
|
|
104
106
|
ErrorHandler.usageError('Both key and value are required for "set"');
|
|
105
107
|
return;
|
|
@@ -111,19 +113,18 @@ const handleSet = async (cmd, manager, key, value) => {
|
|
|
111
113
|
const parsedValue = parseConfigValue(value);
|
|
112
114
|
const validationError = ConfigValidator.validateValue(key, parsedValue);
|
|
113
115
|
if (validationError) {
|
|
114
|
-
cmd.warn(`Validation error for "${key}": ${validationError}`);
|
|
116
|
+
cmd.warn(`Validation error for "${key}": ${validationError.message}`);
|
|
115
117
|
return;
|
|
116
118
|
}
|
|
117
119
|
manager.set(key, parsedValue);
|
|
118
120
|
if (typeof manager.save === 'function') {
|
|
119
|
-
|
|
121
|
+
manager.save();
|
|
120
122
|
}
|
|
121
123
|
cmd.success(`Configuration updated: ${key} = ${value}`);
|
|
122
124
|
};
|
|
123
|
-
const handleList =
|
|
125
|
+
const handleList = (cmd, manager, options) => {
|
|
124
126
|
if (options['json'] === true && typeof manager.export === 'function') {
|
|
125
127
|
cmd.info(manager.export());
|
|
126
|
-
return;
|
|
127
128
|
}
|
|
128
129
|
const config = typeof manager.getConfig === 'function' ? manager.getConfig() : {};
|
|
129
130
|
cmd.info(chalk.bold('\n🛠️ Current Configuration:\n'));
|
|
@@ -141,7 +142,7 @@ const handleReset = async (cmd, manager) => {
|
|
|
141
142
|
return;
|
|
142
143
|
}
|
|
143
144
|
if (typeof manager.reset === 'function') {
|
|
144
|
-
|
|
145
|
+
manager.reset();
|
|
145
146
|
}
|
|
146
147
|
cmd.success('Configuration reset to defaults');
|
|
147
148
|
};
|
|
@@ -158,14 +159,14 @@ const editSingleConfig = async (cmd, manager, selectedKey) => {
|
|
|
158
159
|
const parsedValue = parseConfigValue(newValue);
|
|
159
160
|
const validationError = ConfigValidator.validateValue(selectedKey, parsedValue);
|
|
160
161
|
if (validationError) {
|
|
161
|
-
cmd.warn(`Validation error: ${validationError}`);
|
|
162
|
+
cmd.warn(`Validation error: ${validationError.message}`);
|
|
162
163
|
return;
|
|
163
164
|
}
|
|
164
165
|
if (typeof manager.set === 'function') {
|
|
165
166
|
manager.set(selectedKey, parsedValue);
|
|
166
167
|
}
|
|
167
168
|
if (typeof manager.save === 'function') {
|
|
168
|
-
|
|
169
|
+
manager.save();
|
|
169
170
|
}
|
|
170
171
|
cmd.success(`Updated ${selectedKey}`);
|
|
171
172
|
};
|
|
@@ -180,12 +181,15 @@ const handleEdit = async (cmd, manager) => {
|
|
|
180
181
|
return;
|
|
181
182
|
}
|
|
182
183
|
const menuKeys = [...availableKeys].sort((a, b) => a.localeCompare(b)).concat(['(Done)']);
|
|
184
|
+
// Interactive prompt loop must be sequential.
|
|
185
|
+
/* eslint-disable no-await-in-loop */
|
|
183
186
|
while (true) {
|
|
184
187
|
const selectedKey = await PromptHelper.chooseFrom('Select configuration key to edit:', menuKeys);
|
|
185
188
|
if (selectedKey === '' || selectedKey === '(Done)')
|
|
186
189
|
break;
|
|
187
190
|
await editSingleConfig(cmd, manager, selectedKey);
|
|
188
191
|
}
|
|
192
|
+
/* eslint-enable no-await-in-loop */
|
|
189
193
|
cmd.success('Configuration editing complete');
|
|
190
194
|
};
|
|
191
195
|
const handleExport = (cmd, manager) => {
|
|
@@ -232,22 +236,22 @@ export const ConfigCommand = Object.freeze({
|
|
|
232
236
|
execute: async (options) => executeConfig(cmd, options),
|
|
233
237
|
});
|
|
234
238
|
cmd.getConfigManager = async (isGlobal) => isGlobal ? getGlobalConfigManager() : getProjectConfigManager();
|
|
235
|
-
cmd.handleGet =
|
|
236
|
-
cmd.handleSet =
|
|
237
|
-
cmd.handleList =
|
|
239
|
+
cmd.handleGet = (manager, key, value) => handleGet(cmd, manager, key ?? value);
|
|
240
|
+
cmd.handleSet = (manager, key, value) => handleSet(cmd, manager, key, value);
|
|
241
|
+
cmd.handleList = (manager, options) => handleList(cmd, manager, options);
|
|
238
242
|
cmd.handleReset = async (manager) => handleReset(cmd, manager);
|
|
239
243
|
cmd.handleEdit = async (manager) => handleEdit(cmd, manager);
|
|
240
244
|
cmd.handleExport = (manager) => handleExport(cmd, manager);
|
|
241
245
|
cmd.handleAction = async (action, manager, key, value, options) => {
|
|
242
246
|
switch (action.toLowerCase()) {
|
|
243
247
|
case 'get':
|
|
244
|
-
|
|
248
|
+
cmd.handleGet(manager, key, value);
|
|
245
249
|
return;
|
|
246
250
|
case 'set':
|
|
247
|
-
|
|
251
|
+
cmd.handleSet(manager, key, value, options);
|
|
248
252
|
return;
|
|
249
253
|
case 'list':
|
|
250
|
-
|
|
254
|
+
cmd.handleList(manager, options ?? {});
|
|
251
255
|
return;
|
|
252
256
|
case 'reset':
|
|
253
257
|
await cmd.handleReset(manager);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"D1MigrateCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/D1MigrateCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"D1MigrateCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/D1MigrateCommand.ts"],"names":[],"mappings":"AAMA,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAmD7E;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;IAC3B;;OAEG;cACO,YAAY;EAqBtB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { appConfig } from '../../config/app';
|
|
2
1
|
/**
|
|
3
2
|
* D1 Migrate Command
|
|
4
3
|
* Run Cloudflare D1 migrations using Wrangler
|
|
@@ -6,16 +5,18 @@ import { appConfig } from '../../config/app';
|
|
|
6
5
|
import { resolveNpmPath } from '../../common';
|
|
7
6
|
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
8
7
|
import { BaseCommand } from '../BaseCommand';
|
|
8
|
+
import { appConfig } from '../../config/app';
|
|
9
9
|
import { Logger } from '../../config/logger';
|
|
10
10
|
import { execFileSync } from '../../node-singletons/child-process';
|
|
11
11
|
const runWrangler = async (cmd, args) => {
|
|
12
12
|
const npmPath = resolveNpmPath();
|
|
13
13
|
cmd.debug(`Executing: npm exec --yes -- wrangler ${args.join(' ')}`);
|
|
14
|
-
|
|
14
|
+
const result = execFileSync(npmPath, ['exec', '--yes', '--', 'wrangler', ...args], {
|
|
15
15
|
stdio: 'pipe',
|
|
16
16
|
encoding: 'utf8',
|
|
17
17
|
env: appConfig.getSafeEnv(),
|
|
18
18
|
});
|
|
19
|
+
return Promise.resolve(result);
|
|
19
20
|
};
|
|
20
21
|
const executeD1Migrate = async (cmd, options) => {
|
|
21
22
|
const isLocal = options['local'] === true || options['remote'] !== true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FixCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/FixCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"FixCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/FixCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAuE7E;;GAEG;AACH,eAAO,MAAM,UAAU;IACrB;;OAEG;cACO,YAAY;EAkBtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogsCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/LogsCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAM7E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"LogsCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/LogsCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAM7E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4KpC,eAAO,MAAM,WAAW;IACtB;;OAEG;cACO,YAAY;IAwBtB;;;OAGG;sBACe,OAAO,GAAG,IAAI;EAchC,CAAC;AAEH,eAAe,WAAW,CAAC"}
|
|
@@ -117,11 +117,6 @@ const followLogs = (category) => {
|
|
|
117
117
|
});
|
|
118
118
|
};
|
|
119
119
|
const clearLogs = (loggerInstance, category) => {
|
|
120
|
-
const confirmed = true;
|
|
121
|
-
if (!confirmed) {
|
|
122
|
-
Logger.info(chalk.yellow('Clearing logs cancelled'));
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
120
|
const success = loggerInstance.clearLogs(category);
|
|
126
121
|
if (success === true) {
|
|
127
122
|
Logger.info(chalk.green(`✓ Cleared logs for category: ${category}`));
|
|
@@ -133,6 +128,9 @@ const clearLogs = (loggerInstance, category) => {
|
|
|
133
128
|
const executeLogs = (options) => {
|
|
134
129
|
const normalized = normalizeLogsOptions(options);
|
|
135
130
|
const loggerInstance = FileLogger.getInstance();
|
|
131
|
+
if (options['lines'] !== undefined && Number.isNaN(Number(options['lines']))) {
|
|
132
|
+
throw ErrorFactory.createGeneralError('Lines must be a number');
|
|
133
|
+
}
|
|
136
134
|
if (normalized.clear) {
|
|
137
135
|
clearLogs(loggerInstance, normalized.category);
|
|
138
136
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrateCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/MigrateCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAI7E;;GAEG;AACH,eAAO,MAAM,cAAc;IACzB;;OAEG;cACO,YAAY;
|
|
1
|
+
{"version":3,"file":"MigrateCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/MigrateCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAI7E;;GAEG;AACH,eAAO,MAAM,cAAc;IACzB;;OAEG;cACO,YAAY;EA2CtB,CAAC"}
|
|
@@ -19,7 +19,7 @@ export const MigrateCommand = Object.freeze({
|
|
|
19
19
|
.option('--reset', 'Rollback all migrations')
|
|
20
20
|
.option('--step <number>', 'Number of batches to rollback', '0');
|
|
21
21
|
};
|
|
22
|
-
const execute =
|
|
22
|
+
const execute = (options, cmd) => {
|
|
23
23
|
cmd.debug(`Migrate command executed with options: ${JSON.stringify(options)}`);
|
|
24
24
|
try {
|
|
25
25
|
cmd.info('Loading configuration...');
|
|
@@ -42,14 +42,14 @@ export const MigrateCommand = Object.freeze({
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
catch (error) {
|
|
45
|
-
|
|
45
|
+
ErrorFactory.createTryCatchError(`Migration failed: ${error.message}`, error);
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
const cmd = BaseCommand.create({
|
|
49
49
|
name: 'migrate',
|
|
50
50
|
description: 'Run database migrations',
|
|
51
51
|
addOptions,
|
|
52
|
-
execute:
|
|
52
|
+
execute: (options) => execute(options, cmd),
|
|
53
53
|
});
|
|
54
54
|
return cmd;
|
|
55
55
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NewCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/NewCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NewCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/NewCommand.ts"],"names":[],"mappings":"AAKA,OAAO,EAAe,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAU7E,KAAK,YAAY,GAAG,OAAO,GAAG,KAAK,GAAG,cAAc,CAAC;AACrD,KAAK,YAAY,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,GAAG,SAAS,CAAC;AAYlE,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,YAAY,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,KAAK,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAyLhD,UAAU,WAAY,SAAQ,YAAY;IACxC,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACxF,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACzF,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,sBAAsB,GAAG,gBAAgB,EAAE,CAAC;IACjF,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC;IAChC,YAAY,IAAI,MAAM,CAAC;IACvB,cAAc,CACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,sBAAsB,EAC9B,SAAS,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC,OAAO,CAAC,CAAC;IACpB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAsHD;;;GAGG;AACH,eAAO,MAAM,UAAU;IACrB;;OAEG;cACO,WAAW;EAGrB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { appConfig } from '../../config/app';
|
|
2
1
|
/**
|
|
3
2
|
* New Command - Project scaffolding CLI command
|
|
4
3
|
* Handles creation of new Zintrust projects
|
|
@@ -7,6 +6,7 @@ import { resolveNpmPath } from '../../common';
|
|
|
7
6
|
import { BaseCommand } from '../BaseCommand';
|
|
8
7
|
import { PromptHelper } from '../PromptHelper';
|
|
9
8
|
import { ProjectScaffolder } from '../scaffolding/ProjectScaffolder';
|
|
9
|
+
import { appConfig } from '../../config/app';
|
|
10
10
|
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
11
11
|
import { execFileSync } from '../../node-singletons/child-process';
|
|
12
12
|
import * as path from '../../node-singletons/path';
|
|
@@ -14,6 +14,8 @@ import chalk from 'chalk';
|
|
|
14
14
|
const errorToMessage = (error) => {
|
|
15
15
|
if (error instanceof Error)
|
|
16
16
|
return error.message;
|
|
17
|
+
if (typeof error === 'string')
|
|
18
|
+
return error;
|
|
17
19
|
return 'Unknown error';
|
|
18
20
|
};
|
|
19
21
|
const getGitBinary = () => 'git';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QACommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/QACommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAe,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAM7E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;GAEG;AACH,UAAU,QAAQ;IAChB,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACpD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,SAAS;IACjB,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,QAAQ,CAAC;IACpB,KAAK,EAAE,QAAQ,CAAC;IAChB,KAAK,EAAE,QAAQ,CAAC;CACjB;AAsaD,UAAU,UAAW,SAAQ,YAAY;IACvC,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACnC,OAAO,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,YAAY,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAC1D,cAAc,CAAC,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD;
|
|
1
|
+
{"version":3,"file":"QACommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/QACommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAe,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAM7E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;GAEG;AACH,UAAU,QAAQ;IAChB,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACpD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,SAAS;IACjB,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,QAAQ,CAAC;IACpB,KAAK,EAAE,QAAQ,CAAC;IAChB,KAAK,EAAE,QAAQ,CAAC;CACjB;AAsaD,UAAU,UAAW,SAAQ,YAAY;IACvC,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACnC,OAAO,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,YAAY,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAC1D,cAAc,CAAC,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD;AAgFD;;GAEG;AACH,eAAO,MAAM,SAAS,QAAO,UAmB5B,CAAC"}
|
|
@@ -428,6 +428,11 @@ const generateReport = async (results) => {
|
|
|
428
428
|
ErrorFactory.createTryCatchError('Failed to generate QA report', error);
|
|
429
429
|
}
|
|
430
430
|
};
|
|
431
|
+
const addOptions = (command) => {
|
|
432
|
+
command.option('--no-sonar', 'Skip SonarQube analysis');
|
|
433
|
+
command.option('--report', 'Generate QA report (with coverage)');
|
|
434
|
+
command.option('--no-open', 'Do not open coverage report in browser');
|
|
435
|
+
};
|
|
431
436
|
const executeQA = async (qa, options) => {
|
|
432
437
|
try {
|
|
433
438
|
qa.info('Starting Zintrust QA Suite...');
|
|
@@ -465,11 +470,6 @@ const executeQA = async (qa, options) => {
|
|
|
465
470
|
* QA Command Factory - Create a new QA command instance
|
|
466
471
|
*/
|
|
467
472
|
export const QACommand = () => {
|
|
468
|
-
const addOptions = (command) => {
|
|
469
|
-
command.option('--no-sonar', 'Skip SonarQube analysis');
|
|
470
|
-
command.option('--report', 'Generate QA report (with coverage)');
|
|
471
|
-
command.option('--no-open', 'Do not open coverage report in browser');
|
|
472
|
-
};
|
|
473
473
|
const cmd = BaseCommand.create({
|
|
474
474
|
name: 'qa',
|
|
475
475
|
description: 'Run full Quality Assurance suite',
|
|
@@ -484,7 +484,6 @@ export const QACommand = () => {
|
|
|
484
484
|
runTests,
|
|
485
485
|
runSonar,
|
|
486
486
|
generateReport,
|
|
487
|
-
execute: async (options) => executeQA(qa, options), // NOSONAR
|
|
488
487
|
};
|
|
489
488
|
return qa;
|
|
490
489
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ControllerGenerator.d.ts","sourceRoot":"","sources":["../../../../src/cli/scaffolding/ControllerGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;AAE/F,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB;AAcD;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAgChG;AAED;;GAEG;
|
|
1
|
+
{"version":3,"file":"ControllerGenerator.d.ts","sourceRoot":"","sources":["../../../../src/cli/scaffolding/ControllerGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;AAE/F,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB;AAcD;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAgChG;AAED;;GAEG;AAEH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CA2CjG;AA6cD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,EAAE,CAEpD;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;EAI9B,CAAC"}
|