@sasjs/cli 3.12.5 → 3.12.6
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.
|
@@ -10,6 +10,25 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
13
32
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
33
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
34
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -54,7 +73,7 @@ exports.createEnvFileForSasjs = exports.createEnvFileForSas9 = exports.createEnv
|
|
|
54
73
|
var path_1 = __importDefault(require("path"));
|
|
55
74
|
var logger_1 = require("@sasjs/utils/logger");
|
|
56
75
|
var types_1 = require("@sasjs/utils/types");
|
|
57
|
-
var node_1 =
|
|
76
|
+
var node_1 = __importStar(require("@sasjs/adapter/node"));
|
|
58
77
|
var auth_1 = require("../../utils/auth");
|
|
59
78
|
var utils_1 = require("@sasjs/utils");
|
|
60
79
|
var input_1 = require("./internal/input");
|
|
@@ -174,7 +193,12 @@ var getTokens = function (target, client, secret, httpsAgentOptions) { return __
|
|
|
174
193
|
});
|
|
175
194
|
return [4 /*yield*/, (0, auth_1.getNewAccessToken)(adapter, client, secret, target).catch(function (e) {
|
|
176
195
|
var _a;
|
|
177
|
-
|
|
196
|
+
var errorMessage = "An error has occurred while validating your credentials: ".concat(e);
|
|
197
|
+
var checkCredentialsMessage = "Please check your Client ID ".concat(target.serverType === types_1.ServerType.Sasjs ? '' : 'and Client Secret ', "and try again.\n");
|
|
198
|
+
var errorMessageToDisplay = e instanceof node_1.CertificateError
|
|
199
|
+
? errorMessage
|
|
200
|
+
: "".concat(errorMessage, "\n").concat(checkCredentialsMessage);
|
|
201
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error(errorMessageToDisplay);
|
|
178
202
|
throw e;
|
|
179
203
|
})];
|
|
180
204
|
case 1:
|
|
@@ -90,7 +90,7 @@ var DeployCommand = /** @class */ (function (_super) {
|
|
|
90
90
|
})
|
|
91
91
|
.catch(function (err) {
|
|
92
92
|
var _a;
|
|
93
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error(
|
|
93
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error("An error has occurred when deploying services: ".concat(err));
|
|
94
94
|
return command_1.ReturnCode.InternalError;
|
|
95
95
|
})];
|
|
96
96
|
case 2: return [2 /*return*/, _b.sent()];
|
package/build/utils/config.js
CHANGED
|
@@ -415,16 +415,20 @@ function saveGlobalRcFile(content) {
|
|
|
415
415
|
}
|
|
416
416
|
exports.saveGlobalRcFile = saveGlobalRcFile;
|
|
417
417
|
function saveToGlobalConfig(target, isDefault, saveWithDefaultValues) {
|
|
418
|
+
var _a;
|
|
418
419
|
if (isDefault === void 0) { isDefault = false; }
|
|
419
420
|
if (saveWithDefaultValues === void 0) { saveWithDefaultValues = true; }
|
|
420
421
|
return __awaiter(this, void 0, void 0, function () {
|
|
421
422
|
var globalConfig, targetJson, existingTargetIndex;
|
|
422
|
-
return __generator(this, function (
|
|
423
|
-
switch (
|
|
423
|
+
return __generator(this, function (_b) {
|
|
424
|
+
switch (_b.label) {
|
|
424
425
|
case 0: return [4 /*yield*/, getGlobalRcFile()];
|
|
425
426
|
case 1:
|
|
426
|
-
globalConfig =
|
|
427
|
+
globalConfig = _b.sent();
|
|
427
428
|
targetJson = target.toJson(saveWithDefaultValues);
|
|
429
|
+
if ((_a = targetJson.httpsAgentOptions) === null || _a === void 0 ? void 0 : _a.ca) {
|
|
430
|
+
targetJson.httpsAgentOptions.ca = undefined;
|
|
431
|
+
}
|
|
428
432
|
if (globalConfig) {
|
|
429
433
|
if (globalConfig.targets && globalConfig.targets.length) {
|
|
430
434
|
existingTargetIndex = globalConfig.targets.findIndex(function (t) { return t.name === target.name; });
|
|
@@ -446,7 +450,7 @@ function saveToGlobalConfig(target, isDefault, saveWithDefaultValues) {
|
|
|
446
450
|
globalConfig.defaultTarget = target.name;
|
|
447
451
|
}
|
|
448
452
|
return [4 /*yield*/, saveGlobalRcFile(JSON.stringify(globalConfig, null, 2))];
|
|
449
|
-
case 2: return [2 /*return*/,
|
|
453
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
450
454
|
}
|
|
451
455
|
});
|
|
452
456
|
});
|
|
@@ -552,20 +556,23 @@ function saveLocalConfigFile(content) {
|
|
|
552
556
|
}
|
|
553
557
|
exports.saveLocalConfigFile = saveLocalConfigFile;
|
|
554
558
|
function saveToLocalConfig(target, isDefault, saveWithDefaultValues) {
|
|
555
|
-
var _a;
|
|
559
|
+
var _a, _b;
|
|
556
560
|
if (isDefault === void 0) { isDefault = false; }
|
|
557
561
|
if (saveWithDefaultValues === void 0) { saveWithDefaultValues = true; }
|
|
558
562
|
return __awaiter(this, void 0, void 0, function () {
|
|
559
563
|
var targetJson, config, existingTargetIndex, configPath;
|
|
560
|
-
return __generator(this, function (
|
|
561
|
-
switch (
|
|
564
|
+
return __generator(this, function (_c) {
|
|
565
|
+
switch (_c.label) {
|
|
562
566
|
case 0:
|
|
563
567
|
targetJson = target.toJson(saveWithDefaultValues);
|
|
568
|
+
if ((_a = targetJson.httpsAgentOptions) === null || _a === void 0 ? void 0 : _a.ca) {
|
|
569
|
+
targetJson.httpsAgentOptions.ca = undefined;
|
|
570
|
+
}
|
|
564
571
|
return [4 /*yield*/, getLocalConfig()];
|
|
565
572
|
case 1:
|
|
566
|
-
config =
|
|
573
|
+
config = _c.sent();
|
|
567
574
|
if (config) {
|
|
568
|
-
if ((
|
|
575
|
+
if ((_b = config === null || config === void 0 ? void 0 : config.targets) === null || _b === void 0 ? void 0 : _b.length) {
|
|
569
576
|
existingTargetIndex = config.targets.findIndex(function (t) { return t.name === target.name; });
|
|
570
577
|
if (existingTargetIndex > -1) {
|
|
571
578
|
config.targets[existingTargetIndex] = targetJson;
|
|
@@ -587,7 +594,7 @@ function saveToLocalConfig(target, isDefault, saveWithDefaultValues) {
|
|
|
587
594
|
configPath = path_1.default.join(process.projectDir, 'sasjs', 'sasjsconfig.json');
|
|
588
595
|
return [4 /*yield*/, (0, utils_1.createFile)(configPath, JSON.stringify(config, null, 2))];
|
|
589
596
|
case 2:
|
|
590
|
-
|
|
597
|
+
_c.sent();
|
|
591
598
|
return [2 /*return*/, configPath];
|
|
592
599
|
}
|
|
593
600
|
});
|
|
@@ -988,32 +995,30 @@ var overrideEnvVariables = function (targetName) { return __awaiter(void 0, void
|
|
|
988
995
|
}); };
|
|
989
996
|
exports.overrideEnvVariables = overrideEnvVariables;
|
|
990
997
|
var getPrecedenceOfHttpsAgentOptionsAndContent = function (config, target) { return __awaiter(void 0, void 0, void 0, function () {
|
|
991
|
-
var httpsAgentOptions, _a, _b
|
|
992
|
-
return __generator(this, function (
|
|
993
|
-
switch (
|
|
998
|
+
var httpsAgentOptions, rootCas, _a, _b;
|
|
999
|
+
return __generator(this, function (_c) {
|
|
1000
|
+
switch (_c.label) {
|
|
994
1001
|
case 0:
|
|
995
1002
|
httpsAgentOptions = getHttpsAgentOptionsForInsecure(__assign(__assign({ allowInsecureRequests: false }, config.httpsAgentOptions), target.httpsAgentOptions));
|
|
996
|
-
if (
|
|
1003
|
+
if (httpsAgentOptions.caPath) {
|
|
1004
|
+
rootCas = require('ssl-root-cas');
|
|
1005
|
+
rootCas.addFile(path_1.default.resolve(httpsAgentOptions.caPath));
|
|
1006
|
+
httpsAgentOptions.ca = rootCas;
|
|
1007
|
+
}
|
|
1008
|
+
if (!httpsAgentOptions.keyPath) return [3 /*break*/, 2];
|
|
997
1009
|
_a = httpsAgentOptions;
|
|
998
|
-
return [4 /*yield*/, (0, utils_1.readFile)(httpsAgentOptions.
|
|
1010
|
+
return [4 /*yield*/, (0, utils_1.readFile)(httpsAgentOptions.keyPath)];
|
|
999
1011
|
case 1:
|
|
1000
|
-
_a.
|
|
1001
|
-
|
|
1012
|
+
_a.key = _c.sent();
|
|
1013
|
+
_c.label = 2;
|
|
1002
1014
|
case 2:
|
|
1003
|
-
if (!httpsAgentOptions.
|
|
1015
|
+
if (!httpsAgentOptions.certPath) return [3 /*break*/, 4];
|
|
1004
1016
|
_b = httpsAgentOptions;
|
|
1005
|
-
return [4 /*yield*/, (0, utils_1.readFile)(httpsAgentOptions.keyPath)];
|
|
1006
|
-
case 3:
|
|
1007
|
-
_b.key = _d.sent();
|
|
1008
|
-
_d.label = 4;
|
|
1009
|
-
case 4:
|
|
1010
|
-
if (!httpsAgentOptions.certPath) return [3 /*break*/, 6];
|
|
1011
|
-
_c = httpsAgentOptions;
|
|
1012
1017
|
return [4 /*yield*/, (0, utils_1.readFile)(httpsAgentOptions.certPath)];
|
|
1013
|
-
case
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
case
|
|
1018
|
+
case 3:
|
|
1019
|
+
_b.cert = _c.sent();
|
|
1020
|
+
_c.label = 4;
|
|
1021
|
+
case 4: return [2 /*return*/, httpsAgentOptions];
|
|
1017
1022
|
}
|
|
1018
1023
|
});
|
|
1019
1024
|
}); };
|
|
@@ -46,7 +46,7 @@ var config_1 = require("./config");
|
|
|
46
46
|
var utils_1 = require("@sasjs/utils");
|
|
47
47
|
exports.contextName = 'sasjs cli compute context';
|
|
48
48
|
var setConstants = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
49
|
-
var _a, configuration, isLocal, buildOutputFolder, buildResultsFolder, homeDir,
|
|
49
|
+
var _a, configuration, isLocal, buildOutputFolder, buildResultsFolder, homeDir, buildSourceFolder, buildSourceDbFolder, buildDestinationFolder, buildDestinationServicesFolder, buildDestinationTestFolder, buildDestinationJobsFolder, buildDestinationDbFolder, buildDestinationDocsFolder, macroCorePath, _b, buildDestinationResultsFolder, buildDestinationResultsLogsFolder, sas9CredentialsError, invalidSasError;
|
|
50
50
|
var _c, _d;
|
|
51
51
|
return __generator(this, function (_e) {
|
|
52
52
|
switch (_e.label) {
|
|
@@ -61,24 +61,6 @@ var setConstants = function () { return __awaiter(void 0, void 0, void 0, functi
|
|
|
61
61
|
buildResultsFolder = ((_d = configuration === null || configuration === void 0 ? void 0 : configuration.buildConfig) === null || _d === void 0 ? void 0 : _d.buildResultsFolder) ||
|
|
62
62
|
(isLocal ? 'sasjsresults' : '.sasjs/sasjsresults');
|
|
63
63
|
homeDir = require('os').homedir();
|
|
64
|
-
getMacroCoreGlobalPath = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
|
-
var sasjsPath, macroCoreGlobal, e_1;
|
|
66
|
-
return __generator(this, function (_a) {
|
|
67
|
-
switch (_a.label) {
|
|
68
|
-
case 0:
|
|
69
|
-
_a.trys.push([0, 2, , 3]);
|
|
70
|
-
return [4 /*yield*/, (0, get_installed_path_1.getInstalledPath)('@sasjs/cli')];
|
|
71
|
-
case 1:
|
|
72
|
-
sasjsPath = _a.sent();
|
|
73
|
-
macroCoreGlobal = path_1.default.join(sasjsPath, 'node_modules', '@sasjs', 'core');
|
|
74
|
-
return [2 /*return*/, macroCoreGlobal];
|
|
75
|
-
case 2:
|
|
76
|
-
e_1 = _a.sent();
|
|
77
|
-
throw 'Please install SASjs cli `npm i -g @sasjs/cli`';
|
|
78
|
-
case 3: return [2 /*return*/];
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}); };
|
|
82
64
|
buildSourceFolder = path_1.default.join(isLocal ? process.projectDir : homeDir);
|
|
83
65
|
buildSourceDbFolder = path_1.default.join(isLocal ? process.projectDir : homeDir, 'sasjs', 'db');
|
|
84
66
|
buildDestinationFolder = (0, utils_1.getAbsolutePath)(buildOutputFolder, isLocal ? process.projectDir : homeDir);
|
|
@@ -90,7 +72,8 @@ var setConstants = function () { return __awaiter(void 0, void 0, void 0, functi
|
|
|
90
72
|
if (!isLocal) return [3 /*break*/, 2];
|
|
91
73
|
_b = path_1.default.join(buildSourceFolder, 'node_modules', '@sasjs/core');
|
|
92
74
|
return [3 /*break*/, 4];
|
|
93
|
-
case 2:
|
|
75
|
+
case 2: // use @sasjs/core from @sasjs/cli's dependencies
|
|
76
|
+
return [4 /*yield*/, (0, get_installed_path_1.getInstalledPath)('@sasjs/core', { local: true })];
|
|
94
77
|
case 3:
|
|
95
78
|
_b = _e.sent();
|
|
96
79
|
_e.label = 4;
|
|
@@ -140,12 +140,5 @@ var verifySasjsConstants = function (appFolder) {
|
|
|
140
140
|
if (appFolder)
|
|
141
141
|
expect(sasjsConstants.macroCorePath).toEqual([prefixAppFolder, 'node_modules', '@sasjs', 'core'].join(path_1.default.sep));
|
|
142
142
|
else
|
|
143
|
-
expect(sasjsConstants.macroCorePath).toEqual(expect.toEndWith([
|
|
144
|
-
'node_modules',
|
|
145
|
-
'@sasjs',
|
|
146
|
-
'cli',
|
|
147
|
-
'node_modules',
|
|
148
|
-
'@sasjs',
|
|
149
|
-
'core'
|
|
150
|
-
].join(path_1.default.sep)));
|
|
143
|
+
expect(sasjsConstants.macroCorePath).toEqual(expect.toEndWith(['cli', 'node_modules', '@sasjs', 'core'].join(path_1.default.sep)));
|
|
151
144
|
};
|
package/package.json
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@sasjs/adapter": "3.8.
|
|
50
|
+
"@sasjs/adapter": "3.8.5",
|
|
51
51
|
"@sasjs/core": "4.15.3",
|
|
52
52
|
"@sasjs/lint": "1.11.2",
|
|
53
53
|
"@sasjs/utils": "2.42.0",
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"ora": "5.4.1",
|
|
67
67
|
"rimraf": "3.0.2",
|
|
68
68
|
"shelljs": "0.8.5",
|
|
69
|
+
"ssl-root-cas": "^1.3.1",
|
|
69
70
|
"xml": "1.0.1",
|
|
70
71
|
"yargs": "17.2.1"
|
|
71
72
|
},
|
|
@@ -94,5 +95,5 @@
|
|
|
94
95
|
"typescript": "4.5.4",
|
|
95
96
|
"util": "0.12.4"
|
|
96
97
|
},
|
|
97
|
-
"version": "3.12.
|
|
98
|
+
"version": "3.12.6"
|
|
98
99
|
}
|