@sasjs/cli 3.6.2 → 3.6.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.
- package/README.md +0 -3
- package/build/cli.js +4 -4
- package/build/cli.spec.js +6 -6
- package/build/commands/add/addCommand.js +2 -2
- package/build/commands/add/addCredential.js +27 -27
- package/build/commands/add/addTarget.js +10 -10
- package/build/commands/add/internal/input.js +30 -30
- package/build/commands/add/internal/saveConfig.js +2 -2
- package/build/commands/add/spec/addCommand.spec.js +24 -20
- package/build/commands/add/spec/addCredential.spec.js +14 -14
- package/build/commands/add/spec/addTarget.spec.js +22 -22
- package/build/commands/build/build.js +81 -77
- package/build/commands/build/buildCommand.js +3 -3
- package/build/commands/build/compileBuildCommand.js +4 -4
- package/build/commands/build/internal/config.js +8 -8
- package/build/commands/build/internal/getLaunchPageCode.js +2 -2
- package/build/commands/build/spec/build.spec.js +10 -10
- package/build/commands/build/spec/buildCommand.spec.js +16 -12
- package/build/commands/build/spec/cb.spec.server.js +18 -18
- package/build/commands/build/spec/compileBuildCommand.spec.js +17 -13
- package/build/commands/compile/compile.js +61 -61
- package/build/commands/compile/compileCommand.js +10 -10
- package/build/commands/compile/compileSingleFile.js +17 -17
- package/build/commands/compile/internal/checkCompileStatus.js +11 -11
- package/build/commands/compile/internal/compareFolders.js +11 -11
- package/build/commands/compile/internal/compileJobFile.js +3 -3
- package/build/commands/compile/internal/compileServiceFile.js +14 -14
- package/build/commands/compile/internal/compileTestFile.js +41 -37
- package/build/commands/compile/internal/getAllJobFolders.js +13 -9
- package/build/commands/compile/internal/getAllServiceFolders.js +13 -9
- package/build/commands/compile/internal/getServerType.js +1 -1
- package/build/commands/compile/internal/identifySasFile.js +2 -2
- package/build/commands/compile/internal/loadDependencies.js +5 -5
- package/build/commands/compile/internal/spec/compileTestFile.spec.js +40 -40
- package/build/commands/compile/spec/compareFolders.spec.js +27 -27
- package/build/commands/compile/spec/compile.spec.js +93 -93
- package/build/commands/compile/spec/compileCommand.spec.js +37 -33
- package/build/commands/compile/spec/compileJobFile.spec.js +11 -11
- package/build/commands/compile/spec/compileServiceFile.spec.js +11 -11
- package/build/commands/compile/spec/copyFilesToBuildFolder.spec.js +7 -7
- package/build/commands/compile/spec/loadDependencies.spec.js +30 -30
- package/build/commands/context/contextCommand.js +16 -16
- package/build/commands/context/create.js +1 -1
- package/build/commands/context/delete.js +2 -2
- package/build/commands/context/edit.js +1 -1
- package/build/commands/context/export.js +5 -5
- package/build/commands/context/internal/validateConfigPath.js +1 -1
- package/build/commands/context/list.js +4 -4
- package/build/commands/context/spec/contextCommand.spec.js +80 -76
- package/build/commands/context/spec/create.spec.js +3 -3
- package/build/commands/context/spec/delete.spec.js +3 -3
- package/build/commands/context/spec/edit.spec.js +3 -3
- package/build/commands/context/spec/export.spec.js +8 -8
- package/build/commands/context/spec/list.spec.js +5 -5
- package/build/commands/create/create.js +12 -12
- package/build/commands/create/createCommand.js +2 -2
- package/build/commands/create/internal/createReadme.js +2 -2
- package/build/commands/create/spec/create.spec.js +39 -39
- package/build/commands/create/spec/createCommand.spec.js +14 -10
- package/build/commands/db/db.js +22 -22
- package/build/commands/db/dbCommand.js +1 -1
- package/build/commands/db/spec/db.spec.js +8 -8
- package/build/commands/db/spec/dbCommand.spec.js +11 -7
- package/build/commands/deploy/compileBuildDeployCommand.js +6 -6
- package/build/commands/deploy/deploy.d.ts +7 -0
- package/build/commands/deploy/deploy.js +131 -81
- package/build/commands/deploy/deployCommand.js +2 -2
- package/build/commands/deploy/internal/getDeployScripts.js +14 -10
- package/build/commands/deploy/spec/cbd.spec.js +15 -15
- package/build/commands/deploy/spec/cbd.spec.server.js +40 -40
- package/build/commands/deploy/spec/compileBuildDeployCommand.spec.js +18 -14
- package/build/commands/deploy/spec/deployCommand.spec.js +15 -11
- package/build/commands/deploy/spec/getDeployScripts.spec.js +8 -8
- package/build/commands/deploy/spec/utils.js +17 -17
- package/build/commands/docs/docsCommand.js +7 -7
- package/build/commands/docs/generateDocs.js +33 -29
- package/build/commands/docs/generateDot.js +12 -8
- package/build/commands/docs/initDocs.js +1 -1
- package/build/commands/docs/internal/createDotFiles.js +6 -6
- package/build/commands/docs/internal/getDotFileContent.js +17 -17
- package/build/commands/docs/internal/getFileInputs.js +1 -1
- package/build/commands/docs/internal/getFileOutputs.js +1 -1
- package/build/commands/docs/internal/getFoldersForDocs.js +4 -4
- package/build/commands/docs/internal/populateNodeDictionary.js +1 -1
- package/build/commands/docs/spec/docsCommand.spec.js +25 -21
- package/build/commands/docs/spec/generateDocs.spec.js +60 -60
- package/build/commands/docs/spec/generateDot.spec.js +23 -23
- package/build/commands/docs/spec/getDocConfig.spec.js +2 -2
- package/build/commands/docs/spec/initDocs.spec.js +7 -7
- package/build/commands/flow/execute.js +8 -8
- package/build/commands/flow/flowCommand.js +5 -5
- package/build/commands/flow/internal/checkPredecessorDeadlock.js +11 -7
- package/build/commands/flow/internal/executeFlow.js +23 -23
- package/build/commands/flow/internal/failAllSuccessors.js +1 -1
- package/build/commands/flow/internal/generateFileName.js +2 -2
- package/build/commands/flow/internal/normalizeFilePath.js +1 -1
- package/build/commands/flow/internal/parseJobDetails.js +3 -3
- package/build/commands/flow/internal/printError.js +1 -1
- package/build/commands/flow/internal/saveLog.js +8 -8
- package/build/commands/flow/internal/saveToCsv.js +2 -2
- package/build/commands/flow/internal/spec/allFlowsCompleted.spec.js +4 -4
- package/build/commands/flow/internal/spec/checkPredecessorDeadlock.spec.js +4 -4
- package/build/commands/flow/internal/spec/executeFlow.spec.js +10 -10
- package/build/commands/flow/internal/spec/failAllSuccessors.spec.js +1 -1
- package/build/commands/flow/internal/spec/saveToCsv.spec.js +16 -16
- package/build/commands/flow/internal/spec/validateParams.spec.js +33 -33
- package/build/commands/flow/internal/validateParams.js +17 -17
- package/build/commands/flow/spec/flow.spec.js +1 -1
- package/build/commands/flow/spec/flow.spec.server.js +60 -60
- package/build/commands/flow/spec/flowCommand.spec.js +16 -12
- package/build/commands/folder/create.js +2 -2
- package/build/commands/folder/delete.js +2 -2
- package/build/commands/folder/folderCommand.js +11 -11
- package/build/commands/folder/move.js +2 -2
- package/build/commands/folder/spec/folder.spec.server.js +35 -35
- package/build/commands/folder/spec/folderCommand.spec.js +23 -19
- package/build/commands/help/help.js +50 -48
- package/build/commands/help/helpCommand.js +1 -1
- package/build/commands/help/spec/help.spec.js +8 -8
- package/build/commands/help/spec/helpCommand.spec.js +11 -7
- package/build/commands/init/init.js +7 -7
- package/build/commands/init/initCommand.js +1 -1
- package/build/commands/init/spec/init.spec.server.js +17 -17
- package/build/commands/init/spec/initCommand.spec.js +11 -7
- package/build/commands/job/internal/execute/sasjs.js +1 -1
- package/build/commands/job/internal/execute/viya.js +35 -35
- package/build/commands/job/internal/utils.js +6 -6
- package/build/commands/job/jobCommand.js +6 -6
- package/build/commands/job/spec/execute.spec.js +6 -6
- package/build/commands/job/spec/getContextName.spec.js +2 -2
- package/build/commands/job/spec/job.spec.server.js +53 -53
- package/build/commands/job/spec/jobCommand.spec.js +17 -13
- package/build/commands/lint/initLint.js +2 -2
- package/build/commands/lint/lintCommand.js +10 -10
- package/build/commands/lint/processLint.js +5 -5
- package/build/commands/lint/spec/lintCommand.spec.js +19 -15
- package/build/commands/request/request.js +16 -16
- package/build/commands/request/requestCommand.js +5 -5
- package/build/commands/request/spec/request.spec.server.js +71 -71
- package/build/commands/request/spec/requestCommand.spec.js +17 -13
- package/build/commands/run/run.js +23 -23
- package/build/commands/run/runCommand.js +2 -2
- package/build/commands/run/spec/run.spec.server.js +51 -51
- package/build/commands/run/spec/runCommand.spec.js +10 -6
- package/build/commands/servicepack/deploy.js +6 -6
- package/build/commands/servicepack/servicePackCommand.js +3 -3
- package/build/commands/servicepack/spec/servicepack.spec.server.js +6 -6
- package/build/commands/servicepack/spec/servicepackCommand.spec.js +10 -6
- package/build/commands/shared/createConfigFile.js +2 -2
- package/build/commands/shared/createFileStructure.js +6 -6
- package/build/commands/shared/createLintConfigFile.js +1 -1
- package/build/commands/shared/deployToSasViyaWithServicePack.js +4 -4
- package/build/commands/shared/fetchLogFileContent.js +10 -6
- package/build/commands/testing/internal/saveOutput.js +38 -34
- package/build/commands/testing/spec/testCommand.spec.js +17 -13
- package/build/commands/testing/spec/testing.spec.server.js +38 -38
- package/build/commands/testing/test.js +45 -41
- package/build/commands/testing/testCommand.js +2 -2
- package/build/commands/version/spec/version.spec.js +1 -1
- package/build/commands/version/spec/versionCommand.spec.js +11 -7
- package/build/commands/version/version.js +3 -3
- package/build/commands/version/versionCommand.js +2 -2
- package/build/commands/web/internal/createAssetServices.js +28 -24
- package/build/commands/web/internal/getWebServiceContent.js +6 -6
- package/build/commands/web/internal/sasjsout.d.ts +1 -1
- package/build/commands/web/internal/sasjsout.js +1 -1
- package/build/commands/web/internal/spec/updateLinkTag.spec.js +2 -2
- package/build/commands/web/internal/spec/updateScriptTag.spec.js +10 -10
- package/build/commands/web/internal/updateAllTags.js +19 -15
- package/build/commands/web/internal/updateLinkTag.js +2 -2
- package/build/commands/web/internal/updateScriptTag.js +6 -6
- package/build/commands/web/spec/web.spec.js +23 -23
- package/build/commands/web/spec/webCommand.spec.js +16 -12
- package/build/commands/web/web.js +25 -25
- package/build/commands/web/webCommand.js +3 -3
- package/build/types/command/commandBase.js +19 -15
- package/build/types/command/parse.js +1 -1
- package/build/types/command/spec/commandBase.spec.js +16 -12
- package/build/types/command/targetCommand.js +4 -4
- package/build/types/command/unalias.js +9 -5
- package/build/utils/auth.js +7 -7
- package/build/utils/config.js +56 -49
- package/build/utils/displayResult.js +4 -4
- package/build/utils/file.js +11 -11
- package/build/utils/fileStructures/builtFiles.js +2 -2
- package/build/utils/fileStructures/builtFilesCustom1.js +2 -2
- package/build/utils/getLogFilePath.js +1 -1
- package/build/utils/loadEnvVariables.js +3 -3
- package/build/utils/prefixAppLoc.js +1 -1
- package/build/utils/saveLog.js +7 -7
- package/build/utils/setConstants.js +4 -4
- package/build/utils/setProjectDir.js +2 -2
- package/build/utils/spec/config.spec.js +80 -80
- package/build/utils/spec/displayResult.spec.js +7 -7
- package/build/utils/spec/file.spec.js +15 -15
- package/build/utils/spec/removeComments.spec.js +11 -11
- package/build/utils/spec/setConstants.spec.js +3 -3
- package/build/utils/spec/utils.spec.js +55 -55
- package/build/utils/test.js +59 -59
- package/build/utils/utils.js +47 -43
- package/package.json +11 -11
|
@@ -80,7 +80,7 @@ var DbCommand = /** @class */ (function (_super) {
|
|
|
80
80
|
return __awaiter(this, void 0, void 0, function () {
|
|
81
81
|
return __generator(this, function (_a) {
|
|
82
82
|
switch (_a.label) {
|
|
83
|
-
case 0: return [4 /*yield*/, db_1.buildDB()
|
|
83
|
+
case 0: return [4 /*yield*/, (0, db_1.buildDB)()
|
|
84
84
|
.then(function () {
|
|
85
85
|
var _a;
|
|
86
86
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success('DB build completed!');
|
|
@@ -44,12 +44,12 @@ var test_1 = require("../../../utils/test");
|
|
|
44
44
|
var utils_1 = require("@sasjs/utils");
|
|
45
45
|
var db_1 = require("../db");
|
|
46
46
|
describe("sasjs db", function () {
|
|
47
|
-
var timestamp = utils_1.generateTimestamp();
|
|
48
|
-
var appName = "test-app-DB-"
|
|
47
|
+
var timestamp = (0, utils_1.generateTimestamp)();
|
|
48
|
+
var appName = "test-app-DB-".concat(timestamp);
|
|
49
49
|
beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
50
50
|
return __generator(this, function (_a) {
|
|
51
51
|
switch (_a.label) {
|
|
52
|
-
case 0: return [4 /*yield*/, test_1.createTestApp(__dirname, appName)];
|
|
52
|
+
case 0: return [4 /*yield*/, (0, test_1.createTestApp)(__dirname, appName)];
|
|
53
53
|
case 1:
|
|
54
54
|
_a.sent();
|
|
55
55
|
return [2 /*return*/];
|
|
@@ -59,7 +59,7 @@ describe("sasjs db", function () {
|
|
|
59
59
|
afterAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
60
60
|
return __generator(this, function (_a) {
|
|
61
61
|
switch (_a.label) {
|
|
62
|
-
case 0: return [4 /*yield*/, test_1.removeTestApp(__dirname, appName)];
|
|
62
|
+
case 0: return [4 /*yield*/, (0, test_1.removeTestApp)(__dirname, appName)];
|
|
63
63
|
case 1:
|
|
64
64
|
_a.sent();
|
|
65
65
|
return [2 /*return*/];
|
|
@@ -69,10 +69,10 @@ describe("sasjs db", function () {
|
|
|
69
69
|
it("should create db folder", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
70
70
|
return __generator(this, function (_a) {
|
|
71
71
|
switch (_a.label) {
|
|
72
|
-
case 0: return [4 /*yield*/, expect(db_1.buildDB()).toResolve()];
|
|
72
|
+
case 0: return [4 /*yield*/, expect((0, db_1.buildDB)()).toResolve()];
|
|
73
73
|
case 1:
|
|
74
74
|
_a.sent();
|
|
75
|
-
return [4 /*yield*/, test_1.verifyStep('db')];
|
|
75
|
+
return [4 /*yield*/, (0, test_1.verifyStep)('db')];
|
|
76
76
|
case 2:
|
|
77
77
|
_a.sent();
|
|
78
78
|
return [2 /*return*/];
|
|
@@ -82,10 +82,10 @@ describe("sasjs db", function () {
|
|
|
82
82
|
it("should throw an error when the db folder does not exist", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
83
83
|
return __generator(this, function (_a) {
|
|
84
84
|
switch (_a.label) {
|
|
85
|
-
case 0: return [4 /*yield*/, utils_1.deleteFolder(path_1.default.join(__dirname, appName, 'sasjs', 'db'))];
|
|
85
|
+
case 0: return [4 /*yield*/, (0, utils_1.deleteFolder)(path_1.default.join(__dirname, appName, 'sasjs', 'db'))];
|
|
86
86
|
case 1:
|
|
87
87
|
_a.sent();
|
|
88
|
-
return [4 /*yield*/, expect(db_1.buildDB()).rejects.toThrow('no such file or directory')];
|
|
88
|
+
return [4 /*yield*/, expect((0, db_1.buildDB)()).rejects.toThrow('no such file or directory')];
|
|
89
89
|
case 2:
|
|
90
90
|
_a.sent();
|
|
91
91
|
return [2 /*return*/];
|
|
@@ -70,10 +70,14 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
70
70
|
}
|
|
71
71
|
return ar;
|
|
72
72
|
};
|
|
73
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
74
|
-
for (var i = 0,
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
74
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
75
|
+
if (ar || !(i in from)) {
|
|
76
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
77
|
+
ar[i] = from[i];
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
77
81
|
};
|
|
78
82
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
79
83
|
var logger_1 = require("@sasjs/utils/logger");
|
|
@@ -86,7 +90,7 @@ describe('DbCommand', function () {
|
|
|
86
90
|
setupMocks();
|
|
87
91
|
});
|
|
88
92
|
it('should parse a sasjs db command', function () {
|
|
89
|
-
var args = __spreadArray(__spreadArray([], __read(defaultArgs)), ['db']);
|
|
93
|
+
var args = __spreadArray(__spreadArray([], __read(defaultArgs), false), ['db'], false);
|
|
90
94
|
var command = new dbCommand_1.DbCommand(args);
|
|
91
95
|
expect(command.name).toEqual('db');
|
|
92
96
|
});
|
|
@@ -95,7 +99,7 @@ describe('DbCommand', function () {
|
|
|
95
99
|
return __generator(this, function (_a) {
|
|
96
100
|
switch (_a.label) {
|
|
97
101
|
case 0:
|
|
98
|
-
args = __spreadArray(__spreadArray([], __read(defaultArgs)), ['db']);
|
|
102
|
+
args = __spreadArray(__spreadArray([], __read(defaultArgs), false), ['db'], false);
|
|
99
103
|
command = new dbCommand_1.DbCommand(args);
|
|
100
104
|
return [4 /*yield*/, command.execute()];
|
|
101
105
|
case 1:
|
|
@@ -112,7 +116,7 @@ describe('DbCommand', function () {
|
|
|
112
116
|
return __generator(this, function (_a) {
|
|
113
117
|
switch (_a.label) {
|
|
114
118
|
case 0:
|
|
115
|
-
args = __spreadArray(__spreadArray([], __read(defaultArgs)), ['db']);
|
|
119
|
+
args = __spreadArray(__spreadArray([], __read(defaultArgs), false), ['db'], false);
|
|
116
120
|
jest
|
|
117
121
|
.spyOn(dbModule, 'buildDB')
|
|
118
122
|
.mockImplementation(function () { return Promise.reject(new Error('Test Error')); });
|
|
@@ -85,7 +85,7 @@ var CompileBuildDeployCommand = /** @class */ (function (_super) {
|
|
|
85
85
|
case 0: return [4 /*yield*/, this.getTargetInfo()];
|
|
86
86
|
case 1:
|
|
87
87
|
_d = _e.sent(), target = _d.target, isLocal = _d.isLocal;
|
|
88
|
-
return [4 /*yield*/, compile_1.compile(target, true)
|
|
88
|
+
return [4 /*yield*/, (0, compile_1.compile)(target, true)
|
|
89
89
|
.then(function () { return command_1.ReturnCode.Success; })
|
|
90
90
|
.catch(function (err) {
|
|
91
91
|
var _a;
|
|
@@ -98,8 +98,8 @@ var CompileBuildDeployCommand = /** @class */ (function (_super) {
|
|
|
98
98
|
return [2 /*return*/, returnCode];
|
|
99
99
|
}
|
|
100
100
|
buildDestinationFolder = process.sasjsConstants.buildDestinationFolder;
|
|
101
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("Services have been successfully compiled!\nThe compile output is located in the "
|
|
102
|
-
return [4 /*yield*/, build_1.build(target)
|
|
101
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("Services have been successfully compiled!\nThe compile output is located in the ".concat(buildDestinationFolder, " directory."));
|
|
102
|
+
return [4 /*yield*/, (0, build_1.build)(target)
|
|
103
103
|
.then(function () { return command_1.ReturnCode.Success; })
|
|
104
104
|
.catch(function (err) {
|
|
105
105
|
var _a;
|
|
@@ -111,8 +111,8 @@ var CompileBuildDeployCommand = /** @class */ (function (_super) {
|
|
|
111
111
|
if (returnCode === command_1.ReturnCode.InternalError) {
|
|
112
112
|
return [2 /*return*/, returnCode];
|
|
113
113
|
}
|
|
114
|
-
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.success("Services have been successfully built!\nThe build output is located in the "
|
|
115
|
-
return [4 /*yield*/, deploy_1.deploy(target, isLocal)
|
|
114
|
+
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.success("Services have been successfully built!\nThe build output is located in the ".concat(buildDestinationFolder, " directory."));
|
|
115
|
+
return [4 /*yield*/, (0, deploy_1.deploy)(target, isLocal)
|
|
116
116
|
.then(function () { return command_1.ReturnCode.Success; })
|
|
117
117
|
.catch(function (err) {
|
|
118
118
|
var _a;
|
|
@@ -124,7 +124,7 @@ var CompileBuildDeployCommand = /** @class */ (function (_super) {
|
|
|
124
124
|
if (returnCode === command_1.ReturnCode.InternalError) {
|
|
125
125
|
return [2 /*return*/, returnCode];
|
|
126
126
|
}
|
|
127
|
-
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.success("Services have been successfully deployed to "
|
|
127
|
+
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.success("Services have been successfully deployed to ".concat(target.serverUrl));
|
|
128
128
|
return [2 /*return*/, returnCode];
|
|
129
129
|
}
|
|
130
130
|
});
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import SASjs from '@sasjs/adapter/node';
|
|
2
2
|
import { Target } from '@sasjs/utils';
|
|
3
|
+
/**
|
|
4
|
+
* Deploys app to serverUrl/appLoc mentioned in specified target.
|
|
5
|
+
* @param {Target} target- the target having deploy configuration.
|
|
6
|
+
* @param {boolean} isLocal- flag indicating if specified target is
|
|
7
|
+
* from local sasjsconfig or global sasjsconfig file.
|
|
8
|
+
* @param {object} sasjs - optional configuration object of SAS adapter.
|
|
9
|
+
*/
|
|
3
10
|
export declare function deploy(target: Target, isLocal: boolean, sasjs?: SASjs): Promise<void>;
|
|
@@ -49,6 +49,13 @@ var utils_2 = require("@sasjs/utils");
|
|
|
49
49
|
var file_1 = require("../../utils/file");
|
|
50
50
|
var getDeployScripts_1 = require("./internal/getDeployScripts");
|
|
51
51
|
var deployToSasViyaWithServicePack_1 = require("../shared/deployToSasViyaWithServicePack");
|
|
52
|
+
/**
|
|
53
|
+
* Deploys app to serverUrl/appLoc mentioned in specified target.
|
|
54
|
+
* @param {Target} target- the target having deploy configuration.
|
|
55
|
+
* @param {boolean} isLocal- flag indicating if specified target is
|
|
56
|
+
* from local sasjsconfig or global sasjsconfig file.
|
|
57
|
+
* @param {object} sasjs - optional configuration object of SAS adapter.
|
|
58
|
+
*/
|
|
52
59
|
function deploy(target, isLocal, sasjs) {
|
|
53
60
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
54
61
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -60,10 +67,10 @@ function deploy(target, isLocal, sasjs) {
|
|
|
60
67
|
if (!(target.serverType === utils_2.ServerType.SasViya &&
|
|
61
68
|
((_a = target.deployConfig) === null || _a === void 0 ? void 0 : _a.deployServicePack))) return [3 /*break*/, 2];
|
|
62
69
|
appLoc = target.appLoc.replace(/\ /g, '%20');
|
|
63
|
-
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Deploying service pack to "
|
|
70
|
+
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Deploying service pack to ".concat(target.serverUrl, " at location ").concat(appLoc, " ."));
|
|
64
71
|
buildDestinationFolder_1 = process.sasjsConstants.buildDestinationFolder;
|
|
65
|
-
finalFilePathJSON = path_1.default.join(buildDestinationFolder_1, target.name
|
|
66
|
-
return [4 /*yield*/, deployToSasViyaWithServicePack_1.deployToSasViyaWithServicePack(finalFilePathJSON, target, isLocal, true)];
|
|
72
|
+
finalFilePathJSON = path_1.default.join(buildDestinationFolder_1, "".concat(target.name, ".json"));
|
|
73
|
+
return [4 /*yield*/, (0, deployToSasViyaWithServicePack_1.deployToSasViyaWithServicePack)(finalFilePathJSON, target, isLocal, true)];
|
|
67
74
|
case 1:
|
|
68
75
|
jsonObject = _k.sent();
|
|
69
76
|
webIndexFileName = (_f = (_e = (_d = (_c = jsonObject === null || jsonObject === void 0 ? void 0 : jsonObject.members.find(function (member) {
|
|
@@ -71,10 +78,10 @@ function deploy(target, isLocal, sasjs) {
|
|
|
71
78
|
})) === null || _c === void 0 ? void 0 : _c.members) === null || _d === void 0 ? void 0 : _d.find(function (member) { return (member === null || member === void 0 ? void 0 : member.type) === 'file'; })) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : '';
|
|
72
79
|
(_g = process.logger) === null || _g === void 0 ? void 0 : _g.success('Build pack has been successfully deployed.');
|
|
73
80
|
(_h = process.logger) === null || _h === void 0 ? void 0 : _h.success(target.serverType === utils_2.ServerType.SasViya && webIndexFileName
|
|
74
|
-
? target.serverUrl
|
|
75
|
-
: target.serverUrl
|
|
81
|
+
? "".concat(target.serverUrl, "/SASJobExecution?_file=").concat(appLoc, "/services/").concat(webIndexFileName, "&_debug=2")
|
|
82
|
+
: "".concat(target.serverUrl, "/SASJobExecution?_folder=").concat(appLoc));
|
|
76
83
|
_k.label = 2;
|
|
77
|
-
case 2: return [4 /*yield*/, getDeployScripts_1.getDeployScripts(target)];
|
|
84
|
+
case 2: return [4 /*yield*/, (0, getDeployScripts_1.getDeployScripts)(target)];
|
|
78
85
|
case 3:
|
|
79
86
|
deployScripts = _k.sent();
|
|
80
87
|
if (deployScripts.length === 0 && !((_j = target.deployConfig) === null || _j === void 0 ? void 0 : _j.deployServicePack)) {
|
|
@@ -83,48 +90,49 @@ function deploy(target, isLocal, sasjs) {
|
|
|
83
90
|
buildDestinationFolder = process.sasjsConstants.buildDestinationFolder;
|
|
84
91
|
logFilePath = buildDestinationFolder;
|
|
85
92
|
if (!(target.serverType === utils_2.ServerType.Sasjs)) return [3 /*break*/, 5];
|
|
86
|
-
return [4 /*yield*/, deployToSasjs(target, sasjs)];
|
|
93
|
+
return [4 /*yield*/, deployToSasjs(target, isLocal, sasjs)];
|
|
87
94
|
case 4:
|
|
88
95
|
_k.sent();
|
|
89
96
|
return [3 /*break*/, 7];
|
|
90
|
-
case 5: return [4 /*yield*/, utils_2.asyncForEach(deployScripts, function (deployScript) { return __awaiter(_this, void 0, void 0, function () {
|
|
91
|
-
var deployScriptPath,
|
|
97
|
+
case 5: return [4 /*yield*/, (0, utils_2.asyncForEach)(deployScripts, function (deployScript) { return __awaiter(_this, void 0, void 0, function () {
|
|
98
|
+
var deployScriptPath, deployScriptContent, linesToExecute, streamConfig, deployScriptName, logPath;
|
|
92
99
|
var _a, _b, _c;
|
|
93
100
|
return __generator(this, function (_d) {
|
|
94
101
|
switch (_d.label) {
|
|
95
102
|
case 0:
|
|
96
|
-
deployScriptPath = utils_2.getAbsolutePath(deployScript, process.projectDir);
|
|
97
|
-
if (!file_1.isSasFile(deployScript)) return [3 /*break*/, 7];
|
|
98
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Processing SAS file "
|
|
99
|
-
return [4 /*yield*/, utils_2.readFile(deployScriptPath)
|
|
103
|
+
deployScriptPath = (0, utils_2.getAbsolutePath)(deployScript, process.projectDir);
|
|
104
|
+
if (!(0, file_1.isSasFile)(deployScript)) return [3 /*break*/, 7];
|
|
105
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Processing SAS file ".concat(path_1.default.basename(deployScript), " ..."));
|
|
106
|
+
return [4 /*yield*/, (0, utils_2.readFile)(deployScriptPath)
|
|
100
107
|
// split into lines
|
|
101
108
|
];
|
|
102
109
|
case 1:
|
|
103
|
-
|
|
104
|
-
linesToExecute =
|
|
110
|
+
deployScriptContent = _d.sent();
|
|
111
|
+
linesToExecute = deployScriptContent
|
|
105
112
|
.replace(/\r\n/g, '\n')
|
|
106
113
|
.split('\n');
|
|
107
|
-
return [4 /*yield*/, config_1.getStreamConfig(target)];
|
|
114
|
+
return [4 /*yield*/, (0, config_1.getStreamConfig)(target)];
|
|
108
115
|
case 2:
|
|
109
116
|
streamConfig = _d.sent();
|
|
117
|
+
deployScriptName = path_1.default.basename(deployScript);
|
|
110
118
|
if (!(target.serverType === utils_2.ServerType.SasViya)) return [3 /*break*/, 4];
|
|
111
|
-
return [4 /*yield*/, deployToSasViya(
|
|
119
|
+
return [4 /*yield*/, deployToSasViya(deployScriptName, target, isLocal, linesToExecute, logFilePath, streamConfig)];
|
|
112
120
|
case 3:
|
|
113
121
|
_d.sent();
|
|
114
122
|
return [3 /*break*/, 6];
|
|
115
|
-
case 4: return [4 /*yield*/, deployToSas9(
|
|
123
|
+
case 4: return [4 /*yield*/, deployToSas9(deployScriptName, target, linesToExecute, logFilePath, streamConfig)];
|
|
116
124
|
case 5:
|
|
117
125
|
_d.sent();
|
|
118
126
|
_d.label = 6;
|
|
119
127
|
case 6: return [3 /*break*/, 9];
|
|
120
128
|
case 7:
|
|
121
|
-
if (!file_1.isShellScript(deployScript)) return [3 /*break*/, 9];
|
|
122
|
-
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Executing shell script "
|
|
123
|
-
logPath = path_1.default.join(process.projectDir, 'sasjsbuild', path_1.default.basename(deployScript).replace('.sh', '')
|
|
124
|
-
return [4 /*yield*/, utils_1.executeShellScript(deployScriptPath, logPath)];
|
|
129
|
+
if (!(0, file_1.isShellScript)(deployScript)) return [3 /*break*/, 9];
|
|
130
|
+
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Executing shell script ".concat(deployScript, " ..."));
|
|
131
|
+
logPath = path_1.default.join(process.projectDir, 'sasjsbuild', "".concat(path_1.default.basename(deployScript).replace('.sh', ''), ".log"));
|
|
132
|
+
return [4 /*yield*/, (0, utils_1.executeShellScript)(deployScriptPath, logPath)];
|
|
125
133
|
case 8:
|
|
126
134
|
_d.sent();
|
|
127
|
-
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.success("Shell script execution completed! Log is here: "
|
|
135
|
+
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.success("Shell script execution completed! Log is here: ".concat(logPath));
|
|
128
136
|
_d.label = 9;
|
|
129
137
|
case 9: return [2 /*return*/];
|
|
130
138
|
}
|
|
@@ -139,6 +147,14 @@ function deploy(target, isLocal, sasjs) {
|
|
|
139
147
|
});
|
|
140
148
|
}
|
|
141
149
|
exports.deploy = deploy;
|
|
150
|
+
/**
|
|
151
|
+
* Returns configuration object of SAS Adapter and authentication configuration
|
|
152
|
+
* @param {Target} target- the target to get auth configuration from.
|
|
153
|
+
* @param {boolean} isLocal- flag indicating if specified target is
|
|
154
|
+
* from local sasjsconfig or global sasjsconfig file.
|
|
155
|
+
* @returns an object containing a SAS Adapter configuration object `sasjs`
|
|
156
|
+
* and auth configuration `authConfig`.
|
|
157
|
+
*/
|
|
142
158
|
function getSASjsAndAuthConfig(target, isLocal) {
|
|
143
159
|
return __awaiter(this, void 0, void 0, function () {
|
|
144
160
|
var sasjs, authConfig, e_1;
|
|
@@ -156,13 +172,13 @@ function getSASjsAndAuthConfig(target, isLocal) {
|
|
|
156
172
|
_a.label = 1;
|
|
157
173
|
case 1:
|
|
158
174
|
_a.trys.push([1, 3, , 4]);
|
|
159
|
-
return [4 /*yield*/, config_1.getAuthConfig(target)];
|
|
175
|
+
return [4 /*yield*/, (0, config_1.getAuthConfig)(target)];
|
|
160
176
|
case 2:
|
|
161
177
|
authConfig = _a.sent();
|
|
162
178
|
return [3 /*break*/, 4];
|
|
163
179
|
case 3:
|
|
164
180
|
e_1 = _a.sent();
|
|
165
|
-
throw new Error("Deployment failed. Request is not authenticated.\nPlease add the following variables to your .env"
|
|
181
|
+
throw new Error("Deployment failed. Request is not authenticated.\nPlease add the following variables to your .env".concat(isLocal ? ".".concat(target.name) : '', " file:\nCLIENT, SECRET, ACCESS_TOKEN, REFRESH_TOKEN"));
|
|
166
182
|
case 4: return [2 /*return*/, {
|
|
167
183
|
sasjs: sasjs,
|
|
168
184
|
authConfig: authConfig
|
|
@@ -171,14 +187,26 @@ function getSASjsAndAuthConfig(target, isLocal) {
|
|
|
171
187
|
});
|
|
172
188
|
});
|
|
173
189
|
}
|
|
174
|
-
|
|
190
|
+
/**
|
|
191
|
+
* Deploys app to `SASVIYA` server through deployScript.
|
|
192
|
+
* @param {string} deployScriptName- name of deploy script.
|
|
193
|
+
* @param {Target} target- the target having deploy configuration.
|
|
194
|
+
* @param {boolean} isLocal- flag indicating if specified target is
|
|
195
|
+
* from local sasjsconfig or global sasjsconfig file.
|
|
196
|
+
* @param {string[]} linesToExecute - array of SAS code lines of deploy script to execute.
|
|
197
|
+
* @param {string} logFolder - optional path to log folder,
|
|
198
|
+
* log file name will be <deploy-script-name>.log
|
|
199
|
+
* @param {object} streamConfig - optional configuration object of StreamConfig
|
|
200
|
+
* for printing web app url on console.
|
|
201
|
+
*/
|
|
202
|
+
function deployToSasViya(deployScriptName, target, isLocal, linesToExecute, logFolder, streamConfig) {
|
|
175
203
|
var _a, _b, _c, _d, _e;
|
|
176
204
|
return __awaiter(this, void 0, void 0, function () {
|
|
177
205
|
var contextName, _f, sasjs, authConfig, executionResult, log, appLoc, webAppStreamUrl;
|
|
178
206
|
return __generator(this, function (_g) {
|
|
179
207
|
switch (_g.label) {
|
|
180
208
|
case 0:
|
|
181
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Sending "
|
|
209
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Sending ".concat(deployScriptName, " to SAS server for execution."));
|
|
182
210
|
contextName = target.contextName;
|
|
183
211
|
if (!contextName) {
|
|
184
212
|
throw new Error('Compute Context Name is required for SAS Viya deployments.\n Please ensure that `contextName` is present in your build target configuration or in your .env file, and try again.\n');
|
|
@@ -186,7 +214,7 @@ function deployToSasViya(deployScript, target, isLocal, linesToExecute, logFileP
|
|
|
186
214
|
return [4 /*yield*/, getSASjsAndAuthConfig(target, isLocal)];
|
|
187
215
|
case 1:
|
|
188
216
|
_f = _g.sent(), sasjs = _f.sasjs, authConfig = _f.authConfig;
|
|
189
|
-
return [4 /*yield*/, sasjs.executeScriptSASViya(
|
|
217
|
+
return [4 /*yield*/, sasjs.executeScriptSASViya(deployScriptName, linesToExecute, contextName, authConfig)];
|
|
190
218
|
case 2:
|
|
191
219
|
executionResult = _g.sent();
|
|
192
220
|
try {
|
|
@@ -197,29 +225,40 @@ function deployToSasViya(deployScript, target, isLocal, linesToExecute, logFileP
|
|
|
197
225
|
: JSON.stringify(executionResult.log).replace(/\\n/g, os_1.default.EOL);
|
|
198
226
|
}
|
|
199
227
|
catch (e) {
|
|
200
|
-
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.error("An error occurred when parsing the execution response: "
|
|
228
|
+
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.error("An error occurred when parsing the execution response: ".concat(e.message));
|
|
201
229
|
log = executionResult;
|
|
202
230
|
}
|
|
203
|
-
if (!
|
|
204
|
-
return [4 /*yield*/, utils_2.createFile(path_1.default.join(
|
|
231
|
+
if (!logFolder) return [3 /*break*/, 4];
|
|
232
|
+
return [4 /*yield*/, (0, utils_2.createFile)(path_1.default.join(logFolder, "".concat(deployScriptName.replace('.sas', ''), ".log")), log)];
|
|
205
233
|
case 3:
|
|
206
234
|
_g.sent();
|
|
207
|
-
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.success("Deployment completed! Log is available at "
|
|
208
|
-
if (streamConfig === null || streamConfig === void 0 ? void 0 : streamConfig.streamWeb) {
|
|
209
|
-
appLoc = target.appLoc.replace(/\ /g, '%20');
|
|
210
|
-
webAppStreamUrl = target.serverUrl + "/SASJobExecution?_FILE=" + appLoc + "/services/" + streamConfig.streamServiceName + ".html&_debug=2";
|
|
211
|
-
(_d = process.logger) === null || _d === void 0 ? void 0 : _d.info("Web app is available at " + webAppStreamUrl);
|
|
212
|
-
}
|
|
235
|
+
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.success("Deployment completed! Log is available at ".concat(path_1.default.join(logFolder, "".concat(deployScriptName.replace('.sas', ''), ".log"))));
|
|
213
236
|
return [3 /*break*/, 5];
|
|
214
237
|
case 4:
|
|
215
|
-
(
|
|
238
|
+
(_d = process.logger) === null || _d === void 0 ? void 0 : _d.error('Unable to create log file.');
|
|
216
239
|
_g.label = 5;
|
|
217
|
-
case 5:
|
|
240
|
+
case 5:
|
|
241
|
+
if (streamConfig === null || streamConfig === void 0 ? void 0 : streamConfig.streamWeb) {
|
|
242
|
+
appLoc = target.appLoc.replace(/\ /g, '%20');
|
|
243
|
+
webAppStreamUrl = "".concat(target.serverUrl, "/SASJobExecution?_FILE=").concat(appLoc, "/services/").concat(streamConfig.streamServiceName, ".html&_debug=2");
|
|
244
|
+
(_e = process.logger) === null || _e === void 0 ? void 0 : _e.info("Web app is available at ".concat(webAppStreamUrl));
|
|
245
|
+
}
|
|
246
|
+
return [2 /*return*/];
|
|
218
247
|
}
|
|
219
248
|
});
|
|
220
249
|
});
|
|
221
250
|
}
|
|
222
|
-
|
|
251
|
+
/**
|
|
252
|
+
* Deploys app to `SAS9` server through deployScript.
|
|
253
|
+
* @param {string} deployScriptName- name of deploy script.
|
|
254
|
+
* @param {Target} target- the target having deploy configuration.
|
|
255
|
+
* @param {string[]} linesToExecute - array of SAS code lines of deploy script to execute.
|
|
256
|
+
* @param {string} logFolder - optional path to log folder,
|
|
257
|
+
* log file name will be <deploy-script-name>.log
|
|
258
|
+
* @param {object} streamConfig - optional configuration object of StreamConfig
|
|
259
|
+
* for printing web app url on console.
|
|
260
|
+
*/
|
|
261
|
+
function deployToSas9(deployScriptName, target, linesToExecute, logFolder, streamConfig) {
|
|
223
262
|
var _a, _b, _c, _d;
|
|
224
263
|
return __awaiter(this, void 0, void 0, function () {
|
|
225
264
|
var username, password, sas9CredentialsError, sasjs, executionResult, appLoc, webAppStreamUrl;
|
|
@@ -238,7 +277,7 @@ function deployToSas9(deployScript, target, linesToExecute, logFilePath, streamC
|
|
|
238
277
|
sas9CredentialsError = process.sasjsConstants.sas9CredentialsError;
|
|
239
278
|
throw new Error(sas9CredentialsError);
|
|
240
279
|
}
|
|
241
|
-
password = utils_2.decodeFromBase64(password);
|
|
280
|
+
password = (0, utils_2.decodeFromBase64)(password);
|
|
242
281
|
sasjs = new node_1.default({
|
|
243
282
|
serverUrl: target.serverUrl,
|
|
244
283
|
httpsAgentOptions: target.httpsAgentOptions,
|
|
@@ -251,64 +290,75 @@ function deployToSas9(deployScript, target, linesToExecute, logFilePath, streamC
|
|
|
251
290
|
var _a;
|
|
252
291
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.log(formatErrorString(err));
|
|
253
292
|
if (err && err.errorCode === 404) {
|
|
254
|
-
utils_1.displaySasjsRunnerError(username);
|
|
293
|
+
(0, utils_1.displaySasjsRunnerError)(username);
|
|
255
294
|
}
|
|
256
295
|
})];
|
|
257
296
|
case 1:
|
|
258
297
|
executionResult = _e.sent();
|
|
259
|
-
if (
|
|
260
|
-
(
|
|
261
|
-
return [
|
|
298
|
+
if (!executionResult) return [3 /*break*/, 5];
|
|
299
|
+
if (!logFolder) return [3 /*break*/, 3];
|
|
300
|
+
return [4 /*yield*/, (0, utils_2.createFile)(path_1.default.join(logFolder, "".concat(deployScriptName.replace('.sas', ''), ".log")), executionResult !== null && executionResult !== void 0 ? executionResult : '')];
|
|
262
301
|
case 2:
|
|
263
|
-
if (!logFilePath) return [3 /*break*/, 4];
|
|
264
|
-
return [4 /*yield*/, utils_2.createFile(path_1.default.join(logFilePath, path_1.default.basename(deployScript).replace('.sas', '') + ".log"), executionResult !== null && executionResult !== void 0 ? executionResult : '')];
|
|
265
|
-
case 3:
|
|
266
302
|
_e.sent();
|
|
267
|
-
(
|
|
303
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("Deployment completed! Log is available at ".concat(path_1.default.join(logFolder, "".concat(deployScriptName.replace('.sas', ''), ".log"))));
|
|
304
|
+
return [3 /*break*/, 4];
|
|
305
|
+
case 3:
|
|
306
|
+
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.error('Unable to create log file.');
|
|
307
|
+
_e.label = 4;
|
|
308
|
+
case 4:
|
|
268
309
|
if (streamConfig === null || streamConfig === void 0 ? void 0 : streamConfig.streamWeb) {
|
|
269
310
|
appLoc = target.appLoc.replace(/\ /g, '%20');
|
|
270
|
-
webAppStreamUrl = target.serverUrl
|
|
271
|
-
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.info("Web app is available at "
|
|
311
|
+
webAppStreamUrl = "".concat(target.serverUrl, "/SASStoredProcess/?_PROGRAM=").concat(appLoc, "/services/").concat(streamConfig.streamServiceName);
|
|
312
|
+
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.info("Web app is available at ".concat(webAppStreamUrl));
|
|
272
313
|
}
|
|
273
|
-
return [3 /*break*/,
|
|
274
|
-
case
|
|
275
|
-
(_d = process.logger) === null || _d === void 0 ? void 0 : _d.error('
|
|
276
|
-
_e.label =
|
|
277
|
-
case
|
|
314
|
+
return [3 /*break*/, 6];
|
|
315
|
+
case 5:
|
|
316
|
+
(_d = process.logger) === null || _d === void 0 ? void 0 : _d.error('Error getting execution log');
|
|
317
|
+
_e.label = 6;
|
|
318
|
+
case 6: return [2 /*return*/];
|
|
278
319
|
}
|
|
279
320
|
});
|
|
280
321
|
});
|
|
281
322
|
}
|
|
282
|
-
|
|
323
|
+
/**
|
|
324
|
+
* Deploys app to `SASJS` server.
|
|
325
|
+
* @param {Target} target- the target having deploy configuration.
|
|
326
|
+
* @param {boolean} isLocal- flag indicating if specified target is
|
|
327
|
+
* from local sasjsconfig or global sasjsconfig file.
|
|
328
|
+
* @param {object} sasjs - optional configuration object of SAS adapter.
|
|
329
|
+
*/
|
|
330
|
+
function deployToSasjs(target, isLocal, sasjs) {
|
|
283
331
|
var _a, _b;
|
|
284
332
|
return __awaiter(this, void 0, void 0, function () {
|
|
285
|
-
var buildDestinationFolder, finalFilePathJSON, jsonContent, payload, result;
|
|
286
|
-
|
|
287
|
-
|
|
333
|
+
var buildDestinationFolder, finalFilePathJSON, jsonContent, payload, authConfig, result;
|
|
334
|
+
var _c;
|
|
335
|
+
return __generator(this, function (_d) {
|
|
336
|
+
switch (_d.label) {
|
|
288
337
|
case 0:
|
|
289
338
|
buildDestinationFolder = process.sasjsConstants.buildDestinationFolder;
|
|
290
|
-
finalFilePathJSON = path_1.default.join(buildDestinationFolder, target.name
|
|
291
|
-
return [4 /*yield*/, utils_2.readFile(finalFilePathJSON)];
|
|
339
|
+
finalFilePathJSON = path_1.default.join(buildDestinationFolder, "".concat(target.name, ".json"));
|
|
340
|
+
return [4 /*yield*/, (0, utils_2.readFile)(finalFilePathJSON)];
|
|
292
341
|
case 1:
|
|
293
|
-
jsonContent =
|
|
342
|
+
jsonContent = _d.sent();
|
|
294
343
|
payload = JSON.parse(jsonContent);
|
|
295
|
-
sasjs
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
serverType: target.serverType,
|
|
299
|
-
serverUrl: target.serverUrl,
|
|
300
|
-
appLoc: target.appLoc
|
|
301
|
-
});
|
|
302
|
-
return [4 /*yield*/, sasjs.deployToSASjs(payload).catch(function (err) {
|
|
303
|
-
var _a;
|
|
304
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error(err);
|
|
305
|
-
})];
|
|
344
|
+
if (!!sasjs) return [3 /*break*/, 3];
|
|
345
|
+
;
|
|
346
|
+
return [4 /*yield*/, getSASjsAndAuthConfig(target, isLocal)];
|
|
306
347
|
case 2:
|
|
307
|
-
|
|
348
|
+
(_c = _d.sent(), sasjs = _c.sasjs, authConfig = _c.authConfig);
|
|
349
|
+
_d.label = 3;
|
|
350
|
+
case 3: return [4 /*yield*/, sasjs
|
|
351
|
+
.deployToSASjs(payload, undefined, authConfig)
|
|
352
|
+
.catch(function (err) {
|
|
353
|
+
var _a;
|
|
354
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error(err);
|
|
355
|
+
})];
|
|
356
|
+
case 4:
|
|
357
|
+
result = _d.sent();
|
|
308
358
|
if ((result === null || result === void 0 ? void 0 : result.status) === 'failure') {
|
|
309
359
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error(result.message);
|
|
310
360
|
if (result.example) {
|
|
311
|
-
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Payload example:\n"
|
|
361
|
+
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Payload example:\n".concat(JSON.stringify(result.example, null, 2)));
|
|
312
362
|
}
|
|
313
363
|
}
|
|
314
364
|
return [2 /*return*/];
|
|
@@ -324,11 +374,11 @@ function deployToSasjs(target, sasjs) {
|
|
|
324
374
|
function formatErrorString(error) {
|
|
325
375
|
var _a, _b, _c, _d;
|
|
326
376
|
var err = '';
|
|
327
|
-
err += error.stack
|
|
328
|
-
err += "url: "
|
|
329
|
-
err += "method: "
|
|
330
|
-
err += "headers: "
|
|
331
|
-
err += "data: "
|
|
377
|
+
err += "".concat(error.stack, "\n");
|
|
378
|
+
err += "url: ".concat(((_a = error.config) === null || _a === void 0 ? void 0 : _a.url) ? removePasswordFromUrl(error.config.url) : '', "\n");
|
|
379
|
+
err += "method: ".concat(((_b = error.config) === null || _b === void 0 ? void 0 : _b.method) ? error.config.method : '', "\n");
|
|
380
|
+
err += "headers: ".concat(((_c = error.config) === null || _c === void 0 ? void 0 : _c.headers) ? error.config.headers : '', "\n");
|
|
381
|
+
err += "data: ".concat(((_d = error.response) === null || _d === void 0 ? void 0 : _d.data) ? error.response.data : '');
|
|
332
382
|
return err;
|
|
333
383
|
}
|
|
334
384
|
/**
|
|
@@ -82,10 +82,10 @@ var DeployCommand = /** @class */ (function (_super) {
|
|
|
82
82
|
case 0: return [4 /*yield*/, this.getTargetInfo()];
|
|
83
83
|
case 1:
|
|
84
84
|
_a = _b.sent(), target = _a.target, isLocal = _a.isLocal;
|
|
85
|
-
return [4 /*yield*/, deploy_1.deploy(target, isLocal)
|
|
85
|
+
return [4 /*yield*/, (0, deploy_1.deploy)(target, isLocal)
|
|
86
86
|
.then(function () {
|
|
87
87
|
var _a;
|
|
88
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("Services have been successfully deployed to "
|
|
88
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("Services have been successfully deployed to ".concat(target.serverUrl, "."));
|
|
89
89
|
return command_1.ReturnCode.Success;
|
|
90
90
|
})
|
|
91
91
|
.catch(function (err) {
|
|
@@ -51,10 +51,14 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
51
51
|
}
|
|
52
52
|
return ar;
|
|
53
53
|
};
|
|
54
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
55
|
-
for (var i = 0,
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
55
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
56
|
+
if (ar || !(i in from)) {
|
|
57
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
58
|
+
ar[i] = from[i];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
58
62
|
};
|
|
59
63
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
60
64
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -72,19 +76,19 @@ function getDeployScripts(target) {
|
|
|
72
76
|
switch (_f.label) {
|
|
73
77
|
case 0:
|
|
74
78
|
_e = process.sasjsConstants, buildSourceFolder = _e.buildSourceFolder, buildDestinationFolder = _e.buildDestinationFolder;
|
|
75
|
-
return [4 /*yield*/, config_1.getConfiguration(path_1.default.join(buildSourceFolder, 'sasjs', 'sasjsconfig.json'))];
|
|
79
|
+
return [4 /*yield*/, (0, config_1.getConfiguration)(path_1.default.join(buildSourceFolder, 'sasjs', 'sasjsconfig.json'))];
|
|
76
80
|
case 1:
|
|
77
81
|
configuration = _f.sent();
|
|
78
|
-
allDeployScripts = __spreadArray([], __read((((_a = configuration === null || configuration === void 0 ? void 0 : configuration.deployConfig) === null || _a === void 0 ? void 0 : _a.deployScripts) || [])));
|
|
79
|
-
allDeployScripts = __spreadArray(__spreadArray([], __read(allDeployScripts)), __read((((_b = target.deployConfig) === null || _b === void 0 ? void 0 : _b.deployScripts) || [])));
|
|
82
|
+
allDeployScripts = __spreadArray([], __read((((_a = configuration === null || configuration === void 0 ? void 0 : configuration.deployConfig) === null || _a === void 0 ? void 0 : _a.deployScripts) || [])), false);
|
|
83
|
+
allDeployScripts = __spreadArray(__spreadArray([], __read(allDeployScripts), false), __read((((_b = target.deployConfig) === null || _b === void 0 ? void 0 : _b.deployScripts) || [])), false);
|
|
80
84
|
if (!!((_c = target.deployConfig) === null || _c === void 0 ? void 0 : _c.deployServicePack) &&
|
|
81
85
|
target.serverType === utils_1.ServerType.Sas9) {
|
|
82
|
-
buildOutputFileName = ((_d = target.buildConfig) === null || _d === void 0 ? void 0 : _d.buildOutputFileName) || target.name
|
|
86
|
+
buildOutputFileName = ((_d = target.buildConfig) === null || _d === void 0 ? void 0 : _d.buildOutputFileName) || "".concat(target.name, ".sas");
|
|
83
87
|
deployScriptPath = path_1.default.join(buildDestinationFolder, buildOutputFileName);
|
|
84
|
-
allDeployScripts = __spreadArray(__spreadArray([], __read(allDeployScripts)), [deployScriptPath]);
|
|
88
|
+
allDeployScripts = __spreadArray(__spreadArray([], __read(allDeployScripts), false), [deployScriptPath], false);
|
|
85
89
|
}
|
|
86
90
|
allDeployScripts = allDeployScripts.filter(function (d) { return !!d; });
|
|
87
|
-
return [2 /*return*/, __spreadArray([], __read(new Set(allDeployScripts)))];
|
|
91
|
+
return [2 /*return*/, __spreadArray([], __read(new Set(allDeployScripts)), false)];
|
|
88
92
|
}
|
|
89
93
|
});
|
|
90
94
|
});
|