@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.
Files changed (201) hide show
  1. package/README.md +0 -3
  2. package/build/cli.js +4 -4
  3. package/build/cli.spec.js +6 -6
  4. package/build/commands/add/addCommand.js +2 -2
  5. package/build/commands/add/addCredential.js +27 -27
  6. package/build/commands/add/addTarget.js +10 -10
  7. package/build/commands/add/internal/input.js +30 -30
  8. package/build/commands/add/internal/saveConfig.js +2 -2
  9. package/build/commands/add/spec/addCommand.spec.js +24 -20
  10. package/build/commands/add/spec/addCredential.spec.js +14 -14
  11. package/build/commands/add/spec/addTarget.spec.js +22 -22
  12. package/build/commands/build/build.js +81 -77
  13. package/build/commands/build/buildCommand.js +3 -3
  14. package/build/commands/build/compileBuildCommand.js +4 -4
  15. package/build/commands/build/internal/config.js +8 -8
  16. package/build/commands/build/internal/getLaunchPageCode.js +2 -2
  17. package/build/commands/build/spec/build.spec.js +10 -10
  18. package/build/commands/build/spec/buildCommand.spec.js +16 -12
  19. package/build/commands/build/spec/cb.spec.server.js +18 -18
  20. package/build/commands/build/spec/compileBuildCommand.spec.js +17 -13
  21. package/build/commands/compile/compile.js +61 -61
  22. package/build/commands/compile/compileCommand.js +10 -10
  23. package/build/commands/compile/compileSingleFile.js +17 -17
  24. package/build/commands/compile/internal/checkCompileStatus.js +11 -11
  25. package/build/commands/compile/internal/compareFolders.js +11 -11
  26. package/build/commands/compile/internal/compileJobFile.js +3 -3
  27. package/build/commands/compile/internal/compileServiceFile.js +14 -14
  28. package/build/commands/compile/internal/compileTestFile.js +41 -37
  29. package/build/commands/compile/internal/getAllJobFolders.js +13 -9
  30. package/build/commands/compile/internal/getAllServiceFolders.js +13 -9
  31. package/build/commands/compile/internal/getServerType.js +1 -1
  32. package/build/commands/compile/internal/identifySasFile.js +2 -2
  33. package/build/commands/compile/internal/loadDependencies.js +5 -5
  34. package/build/commands/compile/internal/spec/compileTestFile.spec.js +40 -40
  35. package/build/commands/compile/spec/compareFolders.spec.js +27 -27
  36. package/build/commands/compile/spec/compile.spec.js +93 -93
  37. package/build/commands/compile/spec/compileCommand.spec.js +37 -33
  38. package/build/commands/compile/spec/compileJobFile.spec.js +11 -11
  39. package/build/commands/compile/spec/compileServiceFile.spec.js +11 -11
  40. package/build/commands/compile/spec/copyFilesToBuildFolder.spec.js +7 -7
  41. package/build/commands/compile/spec/loadDependencies.spec.js +30 -30
  42. package/build/commands/context/contextCommand.js +16 -16
  43. package/build/commands/context/create.js +1 -1
  44. package/build/commands/context/delete.js +2 -2
  45. package/build/commands/context/edit.js +1 -1
  46. package/build/commands/context/export.js +5 -5
  47. package/build/commands/context/internal/validateConfigPath.js +1 -1
  48. package/build/commands/context/list.js +4 -4
  49. package/build/commands/context/spec/contextCommand.spec.js +80 -76
  50. package/build/commands/context/spec/create.spec.js +3 -3
  51. package/build/commands/context/spec/delete.spec.js +3 -3
  52. package/build/commands/context/spec/edit.spec.js +3 -3
  53. package/build/commands/context/spec/export.spec.js +8 -8
  54. package/build/commands/context/spec/list.spec.js +5 -5
  55. package/build/commands/create/create.js +12 -12
  56. package/build/commands/create/createCommand.js +2 -2
  57. package/build/commands/create/internal/createReadme.js +2 -2
  58. package/build/commands/create/spec/create.spec.js +39 -39
  59. package/build/commands/create/spec/createCommand.spec.js +14 -10
  60. package/build/commands/db/db.js +22 -22
  61. package/build/commands/db/dbCommand.js +1 -1
  62. package/build/commands/db/spec/db.spec.js +8 -8
  63. package/build/commands/db/spec/dbCommand.spec.js +11 -7
  64. package/build/commands/deploy/compileBuildDeployCommand.js +6 -6
  65. package/build/commands/deploy/deploy.d.ts +7 -0
  66. package/build/commands/deploy/deploy.js +131 -81
  67. package/build/commands/deploy/deployCommand.js +2 -2
  68. package/build/commands/deploy/internal/getDeployScripts.js +14 -10
  69. package/build/commands/deploy/spec/cbd.spec.js +15 -15
  70. package/build/commands/deploy/spec/cbd.spec.server.js +40 -40
  71. package/build/commands/deploy/spec/compileBuildDeployCommand.spec.js +18 -14
  72. package/build/commands/deploy/spec/deployCommand.spec.js +15 -11
  73. package/build/commands/deploy/spec/getDeployScripts.spec.js +8 -8
  74. package/build/commands/deploy/spec/utils.js +17 -17
  75. package/build/commands/docs/docsCommand.js +7 -7
  76. package/build/commands/docs/generateDocs.js +33 -29
  77. package/build/commands/docs/generateDot.js +12 -8
  78. package/build/commands/docs/initDocs.js +1 -1
  79. package/build/commands/docs/internal/createDotFiles.js +6 -6
  80. package/build/commands/docs/internal/getDotFileContent.js +17 -17
  81. package/build/commands/docs/internal/getFileInputs.js +1 -1
  82. package/build/commands/docs/internal/getFileOutputs.js +1 -1
  83. package/build/commands/docs/internal/getFoldersForDocs.js +4 -4
  84. package/build/commands/docs/internal/populateNodeDictionary.js +1 -1
  85. package/build/commands/docs/spec/docsCommand.spec.js +25 -21
  86. package/build/commands/docs/spec/generateDocs.spec.js +60 -60
  87. package/build/commands/docs/spec/generateDot.spec.js +23 -23
  88. package/build/commands/docs/spec/getDocConfig.spec.js +2 -2
  89. package/build/commands/docs/spec/initDocs.spec.js +7 -7
  90. package/build/commands/flow/execute.js +8 -8
  91. package/build/commands/flow/flowCommand.js +5 -5
  92. package/build/commands/flow/internal/checkPredecessorDeadlock.js +11 -7
  93. package/build/commands/flow/internal/executeFlow.js +23 -23
  94. package/build/commands/flow/internal/failAllSuccessors.js +1 -1
  95. package/build/commands/flow/internal/generateFileName.js +2 -2
  96. package/build/commands/flow/internal/normalizeFilePath.js +1 -1
  97. package/build/commands/flow/internal/parseJobDetails.js +3 -3
  98. package/build/commands/flow/internal/printError.js +1 -1
  99. package/build/commands/flow/internal/saveLog.js +8 -8
  100. package/build/commands/flow/internal/saveToCsv.js +2 -2
  101. package/build/commands/flow/internal/spec/allFlowsCompleted.spec.js +4 -4
  102. package/build/commands/flow/internal/spec/checkPredecessorDeadlock.spec.js +4 -4
  103. package/build/commands/flow/internal/spec/executeFlow.spec.js +10 -10
  104. package/build/commands/flow/internal/spec/failAllSuccessors.spec.js +1 -1
  105. package/build/commands/flow/internal/spec/saveToCsv.spec.js +16 -16
  106. package/build/commands/flow/internal/spec/validateParams.spec.js +33 -33
  107. package/build/commands/flow/internal/validateParams.js +17 -17
  108. package/build/commands/flow/spec/flow.spec.js +1 -1
  109. package/build/commands/flow/spec/flow.spec.server.js +60 -60
  110. package/build/commands/flow/spec/flowCommand.spec.js +16 -12
  111. package/build/commands/folder/create.js +2 -2
  112. package/build/commands/folder/delete.js +2 -2
  113. package/build/commands/folder/folderCommand.js +11 -11
  114. package/build/commands/folder/move.js +2 -2
  115. package/build/commands/folder/spec/folder.spec.server.js +35 -35
  116. package/build/commands/folder/spec/folderCommand.spec.js +23 -19
  117. package/build/commands/help/help.js +50 -48
  118. package/build/commands/help/helpCommand.js +1 -1
  119. package/build/commands/help/spec/help.spec.js +8 -8
  120. package/build/commands/help/spec/helpCommand.spec.js +11 -7
  121. package/build/commands/init/init.js +7 -7
  122. package/build/commands/init/initCommand.js +1 -1
  123. package/build/commands/init/spec/init.spec.server.js +17 -17
  124. package/build/commands/init/spec/initCommand.spec.js +11 -7
  125. package/build/commands/job/internal/execute/sasjs.js +1 -1
  126. package/build/commands/job/internal/execute/viya.js +35 -35
  127. package/build/commands/job/internal/utils.js +6 -6
  128. package/build/commands/job/jobCommand.js +6 -6
  129. package/build/commands/job/spec/execute.spec.js +6 -6
  130. package/build/commands/job/spec/getContextName.spec.js +2 -2
  131. package/build/commands/job/spec/job.spec.server.js +53 -53
  132. package/build/commands/job/spec/jobCommand.spec.js +17 -13
  133. package/build/commands/lint/initLint.js +2 -2
  134. package/build/commands/lint/lintCommand.js +10 -10
  135. package/build/commands/lint/processLint.js +5 -5
  136. package/build/commands/lint/spec/lintCommand.spec.js +19 -15
  137. package/build/commands/request/request.js +16 -16
  138. package/build/commands/request/requestCommand.js +5 -5
  139. package/build/commands/request/spec/request.spec.server.js +71 -71
  140. package/build/commands/request/spec/requestCommand.spec.js +17 -13
  141. package/build/commands/run/run.js +23 -23
  142. package/build/commands/run/runCommand.js +2 -2
  143. package/build/commands/run/spec/run.spec.server.js +51 -51
  144. package/build/commands/run/spec/runCommand.spec.js +10 -6
  145. package/build/commands/servicepack/deploy.js +6 -6
  146. package/build/commands/servicepack/servicePackCommand.js +3 -3
  147. package/build/commands/servicepack/spec/servicepack.spec.server.js +6 -6
  148. package/build/commands/servicepack/spec/servicepackCommand.spec.js +10 -6
  149. package/build/commands/shared/createConfigFile.js +2 -2
  150. package/build/commands/shared/createFileStructure.js +6 -6
  151. package/build/commands/shared/createLintConfigFile.js +1 -1
  152. package/build/commands/shared/deployToSasViyaWithServicePack.js +4 -4
  153. package/build/commands/shared/fetchLogFileContent.js +10 -6
  154. package/build/commands/testing/internal/saveOutput.js +38 -34
  155. package/build/commands/testing/spec/testCommand.spec.js +17 -13
  156. package/build/commands/testing/spec/testing.spec.server.js +38 -38
  157. package/build/commands/testing/test.js +45 -41
  158. package/build/commands/testing/testCommand.js +2 -2
  159. package/build/commands/version/spec/version.spec.js +1 -1
  160. package/build/commands/version/spec/versionCommand.spec.js +11 -7
  161. package/build/commands/version/version.js +3 -3
  162. package/build/commands/version/versionCommand.js +2 -2
  163. package/build/commands/web/internal/createAssetServices.js +28 -24
  164. package/build/commands/web/internal/getWebServiceContent.js +6 -6
  165. package/build/commands/web/internal/sasjsout.d.ts +1 -1
  166. package/build/commands/web/internal/sasjsout.js +1 -1
  167. package/build/commands/web/internal/spec/updateLinkTag.spec.js +2 -2
  168. package/build/commands/web/internal/spec/updateScriptTag.spec.js +10 -10
  169. package/build/commands/web/internal/updateAllTags.js +19 -15
  170. package/build/commands/web/internal/updateLinkTag.js +2 -2
  171. package/build/commands/web/internal/updateScriptTag.js +6 -6
  172. package/build/commands/web/spec/web.spec.js +23 -23
  173. package/build/commands/web/spec/webCommand.spec.js +16 -12
  174. package/build/commands/web/web.js +25 -25
  175. package/build/commands/web/webCommand.js +3 -3
  176. package/build/types/command/commandBase.js +19 -15
  177. package/build/types/command/parse.js +1 -1
  178. package/build/types/command/spec/commandBase.spec.js +16 -12
  179. package/build/types/command/targetCommand.js +4 -4
  180. package/build/types/command/unalias.js +9 -5
  181. package/build/utils/auth.js +7 -7
  182. package/build/utils/config.js +56 -49
  183. package/build/utils/displayResult.js +4 -4
  184. package/build/utils/file.js +11 -11
  185. package/build/utils/fileStructures/builtFiles.js +2 -2
  186. package/build/utils/fileStructures/builtFilesCustom1.js +2 -2
  187. package/build/utils/getLogFilePath.js +1 -1
  188. package/build/utils/loadEnvVariables.js +3 -3
  189. package/build/utils/prefixAppLoc.js +1 -1
  190. package/build/utils/saveLog.js +7 -7
  191. package/build/utils/setConstants.js +4 -4
  192. package/build/utils/setProjectDir.js +2 -2
  193. package/build/utils/spec/config.spec.js +80 -80
  194. package/build/utils/spec/displayResult.spec.js +7 -7
  195. package/build/utils/spec/file.spec.js +15 -15
  196. package/build/utils/spec/removeComments.spec.js +11 -11
  197. package/build/utils/spec/setConstants.spec.js +3 -3
  198. package/build/utils/spec/utils.spec.js +55 -55
  199. package/build/utils/test.js +59 -59
  200. package/build/utils/utils.js +47 -43
  201. 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-" + timestamp;
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, il = from.length, j = to.length; i < il; i++, j++)
75
- to[j] = from[i];
76
- return to;
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 " + buildDestinationFolder + " directory.");
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 " + buildDestinationFolder + " directory.");
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 " + target.serverUrl);
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 " + target.serverUrl + " at location " + appLoc + " .");
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 + ".json");
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 + "/SASJobExecution?_file=" + appLoc + "/services/" + webIndexFileName + "&_debug=2"
75
- : target.serverUrl + "/SASJobExecution?_folder=" + appLoc);
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, deployScriptFile, linesToExecute, streamConfig, logPath;
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 " + path_1.default.basename(deployScript) + " ...");
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
- deployScriptFile = _d.sent();
104
- linesToExecute = deployScriptFile
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(deployScript, target, isLocal, linesToExecute, logFilePath, streamConfig)];
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(deployScript, target, linesToExecute, logFilePath, streamConfig)];
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 " + deployScript + " ...");
123
- logPath = path_1.default.join(process.projectDir, 'sasjsbuild', path_1.default.basename(deployScript).replace('.sh', '') + ".log");
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: " + logPath);
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" + (isLocal ? "." + target.name : '') + " file:\nCLIENT, SECRET, ACCESS_TOKEN, REFRESH_TOKEN");
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
- function deployToSasViya(deployScript, target, isLocal, linesToExecute, logFilePath, streamConfig) {
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 " + path_1.default.basename(deployScript) + " to SAS server for execution.");
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(path_1.default.basename(deployScript), linesToExecute, contextName, authConfig)];
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: " + e.message);
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 (!logFilePath) return [3 /*break*/, 4];
204
- return [4 /*yield*/, utils_2.createFile(path_1.default.join(logFilePath, path_1.default.basename(deployScript).replace('.sas', '') + ".log"), log)];
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 " + path_1.default.join(logFilePath, path_1.default.basename(deployScript).replace('.sas', '') + ".log"));
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
- (_e = process.logger) === null || _e === void 0 ? void 0 : _e.error('Unable to create log file.');
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: return [2 /*return*/];
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
- function deployToSas9(deployScript, target, linesToExecute, logFilePath, streamConfig) {
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 (!!executionResult) return [3 /*break*/, 2];
260
- (_a = process.logger) === null || _a === void 0 ? void 0 : _a.error('Error getting execution log');
261
- return [3 /*break*/, 5];
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
- (_b = process.logger) === null || _b === void 0 ? void 0 : _b.success("Deployment completed! Log is available at " + path_1.default.join(logFilePath, path_1.default.basename(deployScript).replace('.sas', '') + ".log"));
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 + "/SASStoredProcess/?_PROGRAM=" + appLoc + "/services/" + streamConfig.streamServiceName;
271
- (_c = process.logger) === null || _c === void 0 ? void 0 : _c.info("Web app is available at " + webAppStreamUrl);
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*/, 5];
274
- case 4:
275
- (_d = process.logger) === null || _d === void 0 ? void 0 : _d.error('Unable to create log file.');
276
- _e.label = 5;
277
- case 5: return [2 /*return*/];
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
- function deployToSasjs(target, sasjs) {
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
- return __generator(this, function (_c) {
287
- switch (_c.label) {
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 + ".json");
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 = _c.sent();
342
+ jsonContent = _d.sent();
294
343
  payload = JSON.parse(jsonContent);
295
- sasjs = sasjs
296
- ? sasjs
297
- : new node_1.default({
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
- result = _c.sent();
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" + JSON.stringify(result.example, null, 2));
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 + "\n";
328
- err += "url: " + (((_a = error.config) === null || _a === void 0 ? void 0 : _a.url) ? removePasswordFromUrl(error.config.url) : '') + "\n";
329
- err += "method: " + (((_b = error.config) === null || _b === void 0 ? void 0 : _b.method) ? error.config.method : '') + "\n";
330
- err += "headers: " + (((_c = error.config) === null || _c === void 0 ? void 0 : _c.headers) ? error.config.headers : '') + "\n";
331
- err += "data: " + (((_d = error.response) === null || _d === void 0 ? void 0 : _d.data) ? error.response.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 " + target.serverUrl + ".");
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, il = from.length, j = to.length; i < il; i++, j++)
56
- to[j] = from[i];
57
- return to;
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 + ".sas";
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
  });