@memberjunction/testing-cli 3.4.0 → 4.0.0
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/dist/commands/compare.d.ts +1 -1
- package/dist/commands/compare.js +4 -8
- package/dist/commands/compare.js.map +1 -1
- package/dist/commands/history.d.ts +1 -1
- package/dist/commands/history.js +4 -8
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/list.d.ts +1 -1
- package/dist/commands/list.js +32 -39
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/report.d.ts +1 -1
- package/dist/commands/report.js +4 -8
- package/dist/commands/report.js.map +1 -1
- package/dist/commands/run.d.ts +1 -1
- package/dist/commands/run.js +34 -38
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/suite.d.ts +1 -1
- package/dist/commands/suite.js +22 -26
- package/dist/commands/suite.js.map +1 -1
- package/dist/commands/validate.d.ts +1 -1
- package/dist/commands/validate.js +28 -58
- package/dist/commands/validate.js.map +1 -1
- package/dist/index.d.ts +12 -12
- package/dist/index.js +12 -40
- package/dist/index.js.map +1 -1
- package/dist/lib/mj-provider.js +20 -30
- package/dist/lib/mj-provider.js.map +1 -1
- package/dist/types.js +1 -2
- package/dist/types.js.map +1 -1
- package/dist/utils/config-loader.d.ts +1 -1
- package/dist/utils/config-loader.js +8 -16
- package/dist/utils/config-loader.js.map +1 -1
- package/dist/utils/output-formatter.d.ts +1 -1
- package/dist/utils/output-formatter.js +33 -63
- package/dist/utils/output-formatter.js.map +1 -1
- package/dist/utils/spinner-manager.js +3 -10
- package/dist/utils/spinner-manager.js.map +1 -1
- package/dist/utils/variable-parser.js +4 -9
- package/dist/utils/variable-parser.js.map +1 -1
- package/package.json +16 -15
package/dist/commands/suite.js
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @fileoverview Suite command implementation
|
|
4
3
|
* @module @memberjunction/testing-cli
|
|
5
4
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const mj_provider_1 = require("../lib/mj-provider");
|
|
13
|
-
const variable_parser_1 = require("../utils/variable-parser");
|
|
5
|
+
import { TestEngine } from '@memberjunction/testing-engine';
|
|
6
|
+
import { OutputFormatter } from '../utils/output-formatter.js';
|
|
7
|
+
import { SpinnerManager } from '../utils/spinner-manager.js';
|
|
8
|
+
import { loadCLIConfig } from '../utils/config-loader.js';
|
|
9
|
+
import { initializeMJProvider, closeMJProvider, getContextUser } from '../lib/mj-provider.js';
|
|
10
|
+
import { parseVariableFlags } from '../utils/variable-parser.js';
|
|
14
11
|
/**
|
|
15
12
|
* Suite command - Execute a test suite
|
|
16
13
|
*/
|
|
17
|
-
class SuiteCommand {
|
|
14
|
+
export class SuiteCommand {
|
|
18
15
|
constructor() {
|
|
19
|
-
this.spinner = new
|
|
16
|
+
this.spinner = new SpinnerManager();
|
|
20
17
|
}
|
|
21
18
|
/**
|
|
22
19
|
* Execute the suite command
|
|
@@ -29,17 +26,17 @@ class SuiteCommand {
|
|
|
29
26
|
try {
|
|
30
27
|
// Initialize MJ provider (database connection and metadata)
|
|
31
28
|
console.log('Initializing MJ provider...');
|
|
32
|
-
await
|
|
29
|
+
await initializeMJProvider();
|
|
33
30
|
console.log('MJ provider initialized successfully');
|
|
34
31
|
// Get context user after initialization if not provided
|
|
35
32
|
if (!contextUser) {
|
|
36
|
-
contextUser = await
|
|
33
|
+
contextUser = await getContextUser();
|
|
37
34
|
}
|
|
38
|
-
const config =
|
|
39
|
-
const format = flags.format || config.defaultFormat;
|
|
35
|
+
const config = loadCLIConfig();
|
|
36
|
+
const format = flags.format || config.defaultFormat || 'console';
|
|
40
37
|
// Get engine instance
|
|
41
38
|
console.log('Getting TestEngine instance...');
|
|
42
|
-
const engine =
|
|
39
|
+
const engine = TestEngine.Instance;
|
|
43
40
|
console.log('Configuring TestEngine...');
|
|
44
41
|
await engine.Config(false, contextUser);
|
|
45
42
|
console.log(`TestEngine configured. Test Types loaded: ${engine.TestTypes?.length || 0}`);
|
|
@@ -51,7 +48,7 @@ class SuiteCommand {
|
|
|
51
48
|
console.log(`Looking for suite by ID: ${suiteId}`);
|
|
52
49
|
suite = engine.GetTestSuiteByID(suiteId);
|
|
53
50
|
if (!suite) {
|
|
54
|
-
console.error(
|
|
51
|
+
console.error(OutputFormatter.formatError(`Test suite not found: ${suiteId}`));
|
|
55
52
|
console.error(`Available suites: ${engine.TestSuites?.map(s => s.Name).join(', ') || 'none'}`);
|
|
56
53
|
process.exit(1);
|
|
57
54
|
}
|
|
@@ -61,18 +58,18 @@ class SuiteCommand {
|
|
|
61
58
|
console.log(`Looking for suite by name: ${flags.name}`);
|
|
62
59
|
suite = engine.GetTestSuiteByName(flags.name);
|
|
63
60
|
if (!suite) {
|
|
64
|
-
console.error(
|
|
61
|
+
console.error(OutputFormatter.formatError(`Test suite not found: ${flags.name}`));
|
|
65
62
|
console.error(`Available suites: ${engine.TestSuites?.map(s => s.Name).join(', ') || 'none'}`);
|
|
66
63
|
process.exit(1);
|
|
67
64
|
}
|
|
68
65
|
}
|
|
69
66
|
else {
|
|
70
|
-
console.error(
|
|
67
|
+
console.error(OutputFormatter.formatError('Must specify suite ID or --name'));
|
|
71
68
|
process.exit(1);
|
|
72
69
|
}
|
|
73
70
|
// Parse variables from --var flags
|
|
74
71
|
// Note: Suite variables apply to all tests - type conversion happens per-test
|
|
75
|
-
const variables =
|
|
72
|
+
const variables = parseVariableFlags(flags.var);
|
|
76
73
|
// Execute suite
|
|
77
74
|
this.spinner.start(`Running test suite: ${suite.Name}...`);
|
|
78
75
|
// Note: parallel and failFast are handled by RunSuite internally
|
|
@@ -83,21 +80,21 @@ class SuiteCommand {
|
|
|
83
80
|
}, contextUser);
|
|
84
81
|
this.spinner.stop();
|
|
85
82
|
// Format and display result
|
|
86
|
-
const output =
|
|
83
|
+
const output = OutputFormatter.formatSuiteResult(result, format);
|
|
87
84
|
console.log(output);
|
|
88
85
|
// Write to file if requested
|
|
89
|
-
|
|
86
|
+
OutputFormatter.writeToFile(output, flags.output);
|
|
90
87
|
// Clean up resources
|
|
91
|
-
await
|
|
88
|
+
await closeMJProvider();
|
|
92
89
|
// Exit with appropriate code (non-zero if any test failed)
|
|
93
90
|
process.exit(result.failedTests === 0 ? 0 : 1);
|
|
94
91
|
}
|
|
95
92
|
catch (error) {
|
|
96
93
|
this.spinner.fail();
|
|
97
|
-
console.error(
|
|
94
|
+
console.error(OutputFormatter.formatError('Failed to run test suite', error));
|
|
98
95
|
// Clean up resources before exit
|
|
99
96
|
try {
|
|
100
|
-
await
|
|
97
|
+
await closeMJProvider();
|
|
101
98
|
}
|
|
102
99
|
catch {
|
|
103
100
|
// Ignore cleanup errors
|
|
@@ -106,5 +103,4 @@ class SuiteCommand {
|
|
|
106
103
|
}
|
|
107
104
|
}
|
|
108
105
|
}
|
|
109
|
-
exports.SuiteCommand = SuiteCommand;
|
|
110
106
|
//# sourceMappingURL=suite.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suite.js","sourceRoot":"","sources":["../../src/commands/suite.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"suite.js","sourceRoot":"","sources":["../../src/commands/suite.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAG5D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,YAAY;IAAzB;QACY,YAAO,GAAG,IA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|
2
1
|
/**
|
|
3
2
|
* @fileoverview Validate command implementation
|
|
4
3
|
* @module @memberjunction/testing-cli
|
|
5
4
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
|
-
if (mod && mod.__esModule) return mod;
|
|
24
|
-
var result = {};
|
|
25
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
26
|
-
__setModuleDefault(result, mod);
|
|
27
|
-
return result;
|
|
28
|
-
};
|
|
29
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
30
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
31
|
-
};
|
|
32
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.ValidateCommand = void 0;
|
|
34
|
-
const testing_engine_1 = require("@memberjunction/testing-engine");
|
|
35
|
-
const output_formatter_1 = require("../utils/output-formatter");
|
|
36
|
-
const spinner_manager_1 = require("../utils/spinner-manager");
|
|
37
|
-
const mj_provider_1 = require("../lib/mj-provider");
|
|
38
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
39
|
-
const fs = __importStar(require("fs"));
|
|
5
|
+
import { TestEngine } from '@memberjunction/testing-engine';
|
|
6
|
+
import { OutputFormatter } from '../utils/output-formatter.js';
|
|
7
|
+
import { SpinnerManager } from '../utils/spinner-manager.js';
|
|
8
|
+
import { initializeMJProvider, closeMJProvider, getContextUser } from '../lib/mj-provider.js';
|
|
9
|
+
import chalk from 'chalk';
|
|
10
|
+
import * as fs from 'fs';
|
|
40
11
|
/**
|
|
41
12
|
* Validate command - Validate test definitions without executing
|
|
42
13
|
*/
|
|
43
|
-
class ValidateCommand {
|
|
14
|
+
export class ValidateCommand {
|
|
44
15
|
constructor() {
|
|
45
|
-
this.spinner = new
|
|
16
|
+
this.spinner = new SpinnerManager();
|
|
46
17
|
}
|
|
47
18
|
/**
|
|
48
19
|
* Execute the validate command
|
|
@@ -54,19 +25,19 @@ class ValidateCommand {
|
|
|
54
25
|
async execute(testId, flags, contextUser) {
|
|
55
26
|
try {
|
|
56
27
|
// Initialize MJ provider (database connection and metadata)
|
|
57
|
-
await
|
|
28
|
+
await initializeMJProvider();
|
|
58
29
|
// Get context user after initialization if not provided
|
|
59
30
|
if (!contextUser) {
|
|
60
|
-
contextUser = await
|
|
31
|
+
contextUser = await getContextUser();
|
|
61
32
|
}
|
|
62
|
-
const engine =
|
|
33
|
+
const engine = TestEngine.Instance;
|
|
63
34
|
await engine.Config(false, contextUser);
|
|
64
35
|
let testsToValidate;
|
|
65
36
|
if (testId) {
|
|
66
37
|
// Validate specific test
|
|
67
38
|
const test = engine.GetTestByID(testId);
|
|
68
39
|
if (!test) {
|
|
69
|
-
console.error(
|
|
40
|
+
console.error(OutputFormatter.formatError(`Test not found: ${testId}`));
|
|
70
41
|
process.exit(1);
|
|
71
42
|
}
|
|
72
43
|
testsToValidate = [test];
|
|
@@ -79,13 +50,13 @@ class ValidateCommand {
|
|
|
79
50
|
// Validate tests by type
|
|
80
51
|
const type = engine.GetTestTypeByName(flags.type);
|
|
81
52
|
if (!type) {
|
|
82
|
-
console.error(
|
|
53
|
+
console.error(OutputFormatter.formatError(`Test type not found: ${flags.type}`));
|
|
83
54
|
process.exit(1);
|
|
84
55
|
}
|
|
85
56
|
testsToValidate = engine.Tests.filter(t => t.TypeID === type.ID);
|
|
86
57
|
}
|
|
87
58
|
else {
|
|
88
|
-
console.error(
|
|
59
|
+
console.error(OutputFormatter.formatError('Must specify test ID, --all, or --type'));
|
|
89
60
|
process.exit(1);
|
|
90
61
|
}
|
|
91
62
|
// Validate tests
|
|
@@ -100,17 +71,17 @@ class ValidateCommand {
|
|
|
100
71
|
this.saveReport(results, reportPath);
|
|
101
72
|
}
|
|
102
73
|
// Clean up resources
|
|
103
|
-
await
|
|
74
|
+
await closeMJProvider();
|
|
104
75
|
// Exit with appropriate code
|
|
105
76
|
const hasErrors = results.some(r => !r.valid);
|
|
106
77
|
process.exit(hasErrors ? 1 : 0);
|
|
107
78
|
}
|
|
108
79
|
catch (error) {
|
|
109
80
|
this.spinner.fail();
|
|
110
|
-
console.error(
|
|
81
|
+
console.error(OutputFormatter.formatError('Failed to validate tests', error));
|
|
111
82
|
// Clean up resources before exit
|
|
112
83
|
try {
|
|
113
|
-
await
|
|
84
|
+
await closeMJProvider();
|
|
114
85
|
}
|
|
115
86
|
catch {
|
|
116
87
|
// Ignore cleanup errors
|
|
@@ -184,33 +155,33 @@ class ValidateCommand {
|
|
|
184
155
|
* Display validation results
|
|
185
156
|
*/
|
|
186
157
|
displayResults(results) {
|
|
187
|
-
console.log(
|
|
158
|
+
console.log(chalk.bold('\nValidating Tests...\n'));
|
|
188
159
|
for (const result of results) {
|
|
189
|
-
const symbol = result.valid ?
|
|
160
|
+
const symbol = result.valid ? chalk.green('✓') : chalk.red('✗');
|
|
190
161
|
console.log(`${symbol} ${result.testName}`);
|
|
191
162
|
if (result.valid && result.warnings.length === 0) {
|
|
192
|
-
console.log(
|
|
163
|
+
console.log(chalk.gray(' - No issues found'));
|
|
193
164
|
}
|
|
194
165
|
for (const error of result.errors) {
|
|
195
|
-
console.log(
|
|
166
|
+
console.log(chalk.red(` ✗ Error: ${error}`));
|
|
196
167
|
}
|
|
197
168
|
for (const warning of result.warnings) {
|
|
198
|
-
console.log(
|
|
169
|
+
console.log(chalk.yellow(` ⚠ Warning: ${warning}`));
|
|
199
170
|
}
|
|
200
171
|
console.log('');
|
|
201
172
|
}
|
|
202
173
|
// Summary
|
|
203
174
|
const validCount = results.filter(r => r.valid).length;
|
|
204
175
|
const warningCount = results.filter(r => r.warnings.length > 0).length;
|
|
205
|
-
console.log(
|
|
176
|
+
console.log(chalk.bold('[SUMMARY]'));
|
|
206
177
|
if (validCount === results.length && warningCount === 0) {
|
|
207
|
-
console.log(
|
|
178
|
+
console.log(chalk.green(`All ${results.length} test(s) are valid with no warnings`));
|
|
208
179
|
}
|
|
209
180
|
else if (validCount === results.length) {
|
|
210
|
-
console.log(
|
|
181
|
+
console.log(chalk.yellow(`${validCount}/${results.length} test(s) valid, ${warningCount} with warnings`));
|
|
211
182
|
}
|
|
212
183
|
else {
|
|
213
|
-
console.log(
|
|
184
|
+
console.log(chalk.red(`${validCount}/${results.length} test(s) valid, ${results.length - validCount} with errors`));
|
|
214
185
|
}
|
|
215
186
|
console.log('');
|
|
216
187
|
}
|
|
@@ -255,12 +226,11 @@ class ValidateCommand {
|
|
|
255
226
|
const report = lines.join('\n');
|
|
256
227
|
try {
|
|
257
228
|
fs.writeFileSync(filePath, report, 'utf-8');
|
|
258
|
-
console.log(
|
|
229
|
+
console.log(OutputFormatter.formatSuccess(`Validation report saved to ${filePath}`));
|
|
259
230
|
}
|
|
260
231
|
catch (error) {
|
|
261
|
-
console.error(
|
|
232
|
+
console.error(OutputFormatter.formatError(`Failed to save report to ${filePath}`, error));
|
|
262
233
|
}
|
|
263
234
|
}
|
|
264
235
|
}
|
|
265
|
-
exports.ValidateCommand = ValidateCommand;
|
|
266
236
|
//# sourceMappingURL=validate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA;;;GAGG;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IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;oBACpC,KAAK,CAAC,IAAI,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;gBAC/B,CAAC;gBACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACnB,CAAC;YAED,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC/C,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YACrC,CAAC;QACL,CAAC;QAED,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEhC,IAAI,CAAC;YACD,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YAC5C,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,aAAa,CAAC,8BAA8B,QAAQ,EAAE,CAAC,CAAC,CAAC;QACzF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,WAAW,CAAC,4BAA4B,QAAQ,EAAE,EAAE,KAAc,CAAC,CAAC,CAAC;QACvG,CAAC;IACL,CAAC;CACJ"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
* Command-line interface for the Testing Framework.
|
|
5
5
|
* Provides thin wrappers around Testing Engine for CLI execution.
|
|
6
6
|
*/
|
|
7
|
-
export { RunCommand } from './commands/run';
|
|
8
|
-
export { SuiteCommand } from './commands/suite';
|
|
9
|
-
export { ListCommand } from './commands/list';
|
|
10
|
-
export { ValidateCommand } from './commands/validate';
|
|
11
|
-
export { ReportCommand } from './commands/report';
|
|
12
|
-
export { HistoryCommand } from './commands/history';
|
|
13
|
-
export { CompareCommand } from './commands/compare';
|
|
14
|
-
export { OutputFormatter } from './utils/output-formatter';
|
|
15
|
-
export { loadCLIConfig } from './utils/config-loader';
|
|
16
|
-
export { SpinnerManager } from './utils/spinner-manager';
|
|
17
|
-
export { getContextUser } from './lib/mj-provider';
|
|
18
|
-
export * from './types';
|
|
7
|
+
export { RunCommand } from './commands/run.js';
|
|
8
|
+
export { SuiteCommand } from './commands/suite.js';
|
|
9
|
+
export { ListCommand } from './commands/list.js';
|
|
10
|
+
export { ValidateCommand } from './commands/validate.js';
|
|
11
|
+
export { ReportCommand } from './commands/report.js';
|
|
12
|
+
export { HistoryCommand } from './commands/history.js';
|
|
13
|
+
export { CompareCommand } from './commands/compare.js';
|
|
14
|
+
export { OutputFormatter } from './utils/output-formatter.js';
|
|
15
|
+
export { loadCLIConfig } from './utils/config-loader.js';
|
|
16
|
+
export { SpinnerManager } from './utils/spinner-manager.js';
|
|
17
|
+
export { getContextUser } from './lib/mj-provider.js';
|
|
18
|
+
export * from './types.js';
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,50 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* MemberJunction Testing CLI
|
|
4
3
|
*
|
|
5
4
|
* Command-line interface for the Testing Framework.
|
|
6
5
|
* Provides thin wrappers around Testing Engine for CLI execution.
|
|
7
6
|
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.getContextUser = exports.SpinnerManager = exports.loadCLIConfig = exports.OutputFormatter = exports.CompareCommand = exports.HistoryCommand = exports.ReportCommand = exports.ValidateCommand = exports.ListCommand = exports.SuiteCommand = exports.RunCommand = void 0;
|
|
24
7
|
// Command implementations
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Object.defineProperty(exports, "ValidateCommand", { enumerable: true, get: function () { return validate_1.ValidateCommand; } });
|
|
33
|
-
var report_1 = require("./commands/report");
|
|
34
|
-
Object.defineProperty(exports, "ReportCommand", { enumerable: true, get: function () { return report_1.ReportCommand; } });
|
|
35
|
-
var history_1 = require("./commands/history");
|
|
36
|
-
Object.defineProperty(exports, "HistoryCommand", { enumerable: true, get: function () { return history_1.HistoryCommand; } });
|
|
37
|
-
var compare_1 = require("./commands/compare");
|
|
38
|
-
Object.defineProperty(exports, "CompareCommand", { enumerable: true, get: function () { return compare_1.CompareCommand; } });
|
|
8
|
+
export { RunCommand } from './commands/run.js';
|
|
9
|
+
export { SuiteCommand } from './commands/suite.js';
|
|
10
|
+
export { ListCommand } from './commands/list.js';
|
|
11
|
+
export { ValidateCommand } from './commands/validate.js';
|
|
12
|
+
export { ReportCommand } from './commands/report.js';
|
|
13
|
+
export { HistoryCommand } from './commands/history.js';
|
|
14
|
+
export { CompareCommand } from './commands/compare.js';
|
|
39
15
|
// Utilities
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var spinner_manager_1 = require("./utils/spinner-manager");
|
|
45
|
-
Object.defineProperty(exports, "SpinnerManager", { enumerable: true, get: function () { return spinner_manager_1.SpinnerManager; } });
|
|
46
|
-
var mj_provider_1 = require("./lib/mj-provider");
|
|
47
|
-
Object.defineProperty(exports, "getContextUser", { enumerable: true, get: function () { return mj_provider_1.getContextUser; } });
|
|
16
|
+
export { OutputFormatter } from './utils/output-formatter.js';
|
|
17
|
+
export { loadCLIConfig } from './utils/config-loader.js';
|
|
18
|
+
export { SpinnerManager } from './utils/spinner-manager.js';
|
|
19
|
+
export { getContextUser } from './lib/mj-provider.js';
|
|
48
20
|
// Types
|
|
49
|
-
|
|
21
|
+
export * from './types.js';
|
|
50
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,0BAA0B;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,YAAY;AACZ,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,QAAQ;AACR,cAAc,SAAS,CAAC"}
|
package/dist/lib/mj-provider.js
CHANGED
|
@@ -1,33 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const core_1 = require("@memberjunction/core");
|
|
8
|
-
const sqlserver_dataprovider_1 = require("@memberjunction/sqlserver-dataprovider");
|
|
9
|
-
const mssql_1 = __importDefault(require("mssql"));
|
|
10
|
-
const dotenv_1 = __importDefault(require("dotenv"));
|
|
11
|
-
const path_1 = __importDefault(require("path"));
|
|
12
|
-
const config_loader_1 = require("../utils/config-loader");
|
|
1
|
+
import { Metadata } from '@memberjunction/core';
|
|
2
|
+
import { setupSQLServerClient, SQLServerProviderConfigData, UserCache } from '@memberjunction/sqlserver-dataprovider';
|
|
3
|
+
import sql from 'mssql';
|
|
4
|
+
import dotenv from 'dotenv';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import { loadMJConfig } from '../utils/config-loader.js';
|
|
13
7
|
// Load environment variables from .env file
|
|
14
8
|
// Note: config-loader.ts also loads dotenv with override:true, but we include it here
|
|
15
9
|
// for completeness in case mj-provider is used standalone
|
|
16
|
-
|
|
10
|
+
dotenv.config({ path: path.resolve(process.cwd(), '.env'), override: true, quiet: true });
|
|
17
11
|
let isInitialized = false;
|
|
18
12
|
let connectionPool = null;
|
|
19
|
-
async function initializeMJProvider() {
|
|
13
|
+
export async function initializeMJProvider() {
|
|
20
14
|
if (isInitialized) {
|
|
21
15
|
return;
|
|
22
16
|
}
|
|
23
17
|
// Check if MJ provider is already initialized
|
|
24
|
-
if (
|
|
18
|
+
if (Metadata.Provider) {
|
|
25
19
|
console.log('MJ Provider already initialized');
|
|
26
20
|
isInitialized = true;
|
|
27
21
|
return;
|
|
28
22
|
}
|
|
29
23
|
try {
|
|
30
|
-
const config = await
|
|
24
|
+
const config = await loadMJConfig();
|
|
31
25
|
// Debug: Check what's in process.env and config
|
|
32
26
|
console.log(`process.env.DB_DATABASE: ${process.env.DB_DATABASE}`);
|
|
33
27
|
console.log(`config.dbDatabase: ${config.dbDatabase}`);
|
|
@@ -94,12 +88,12 @@ For security, use environment variables:
|
|
|
94
88
|
idleTimeoutMillis: 30000,
|
|
95
89
|
},
|
|
96
90
|
};
|
|
97
|
-
connectionPool = new
|
|
91
|
+
connectionPool = new sql.ConnectionPool(sqlConfig);
|
|
98
92
|
await connectionPool.connect();
|
|
99
|
-
const providerConfig = new
|
|
100
|
-
await
|
|
93
|
+
const providerConfig = new SQLServerProviderConfigData(connectionPool, dbSchema || '__mj', 180000);
|
|
94
|
+
await setupSQLServerClient(providerConfig);
|
|
101
95
|
// Debug: Log entity counts
|
|
102
|
-
const md = new
|
|
96
|
+
const md = new Metadata();
|
|
103
97
|
console.log(`Total entities loaded: ${md.Entities.length}`);
|
|
104
98
|
const testEntities = md.Entities.filter(e => e.Name.toLowerCase().includes('test'));
|
|
105
99
|
console.log(`Test-related entities found: ${testEntities.length}`);
|
|
@@ -151,8 +145,7 @@ For debugging, run with --verbose flag for detailed error information.`);
|
|
|
151
145
|
}
|
|
152
146
|
}
|
|
153
147
|
}
|
|
154
|
-
|
|
155
|
-
function getConnectionPool() {
|
|
148
|
+
export function getConnectionPool() {
|
|
156
149
|
if (!connectionPool) {
|
|
157
150
|
throw new Error(`❌ MJ Provider not initialized
|
|
158
151
|
|
|
@@ -163,25 +156,23 @@ This is an internal error. Please report this issue.`);
|
|
|
163
156
|
}
|
|
164
157
|
return connectionPool;
|
|
165
158
|
}
|
|
166
|
-
|
|
167
|
-
async function closeMJProvider() {
|
|
159
|
+
export async function closeMJProvider() {
|
|
168
160
|
if (connectionPool) {
|
|
169
161
|
await connectionPool.close();
|
|
170
162
|
connectionPool = null;
|
|
171
163
|
isInitialized = false;
|
|
172
164
|
}
|
|
173
165
|
}
|
|
174
|
-
exports.closeMJProvider = closeMJProvider;
|
|
175
166
|
/**
|
|
176
167
|
* Get a context user for CLI operations
|
|
177
168
|
* Tries to get the "System" user first, falls back to first available user
|
|
178
169
|
*/
|
|
179
|
-
async function getContextUser() {
|
|
170
|
+
export async function getContextUser() {
|
|
180
171
|
// Try to get the System user like other CLIs do
|
|
181
|
-
let user =
|
|
172
|
+
let user = UserCache.Instance.UserByName("System", false);
|
|
182
173
|
if (!user) {
|
|
183
174
|
// Fallback to first available user if System user doesn't exist
|
|
184
|
-
if (!
|
|
175
|
+
if (!UserCache.Instance.Users || UserCache.Instance.Users.length === 0) {
|
|
185
176
|
throw new Error(`❌ No users found in UserCache
|
|
186
177
|
|
|
187
178
|
Problem: UserCache is empty or not properly initialized
|
|
@@ -194,12 +185,11 @@ Next steps:
|
|
|
194
185
|
|
|
195
186
|
This is typically a configuration or database setup issue.`);
|
|
196
187
|
}
|
|
197
|
-
user =
|
|
188
|
+
user = UserCache.Instance.Users[0];
|
|
198
189
|
}
|
|
199
190
|
if (!user) {
|
|
200
191
|
throw new Error('No valid user found for execution context');
|
|
201
192
|
}
|
|
202
193
|
return user;
|
|
203
194
|
}
|
|
204
|
-
exports.getContextUser = getContextUser;
|
|
205
195
|
//# sourceMappingURL=mj-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mj-provider.js","sourceRoot":"","sources":["../../src/lib/mj-provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mj-provider.js","sourceRoot":"","sources":["../../src/lib/mj-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACtH,OAAO,GAAG,MAAM,OAAO,CAAC;AACxB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,4CAA4C;AAC5C,sFAAsF;AACtF,0DAA0D;AAC1D,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,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UAAU,iBAAiB;IAC/B,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC;;;;;qDAKiC,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,IAAI,cAAc,EAAE,CAAC;QACnB,MAAM,cAAc,CAAC,KAAK,EAAE,CAAC;QAC7B,cAAc,GAAG,IAAI,CAAC;QACtB,aAAa,GAAG,KAAK,CAAC;IACxB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,gDAAgD;IAChD,IAAI,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAE1D,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,gEAAgE;QAChE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,IAAI,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvE,MAAM,IAAI,KAAK,CAAC;;;;;;;;;;2DAUqC,CAAC,CAAC;QACzD,CAAC;QAED,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/types.js
CHANGED
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|