@sasjs/cli 3.6.5 → 3.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/commands/build/build.js +19 -34
- package/build/commands/deploy/deploy.d.ts +7 -0
- package/build/commands/deploy/deploy.js +105 -44
- package/build/commands/deploy/spec/cbd.spec.js +1 -1
- package/build/commands/job/internal/execute/sasjs.d.ts +1 -0
- package/build/commands/testing/spec/testing.spec.server.js +545 -308
- package/build/commands/testing/test.d.ts +3 -1
- package/build/commands/testing/test.js +166 -113
- package/build/commands/web/internal/getTags.d.ts +2 -0
- package/build/commands/web/internal/getTags.js +9 -1
- package/build/commands/web/internal/spec/testFiles/script3.d.ts +23 -0
- package/build/commands/web/internal/spec/testFiles/script3.js +218 -0
- package/build/commands/web/internal/spec/updateLinkTag.spec.js +1 -1
- package/build/commands/web/internal/spec/updateScriptTag.spec.js +146 -1
- package/build/commands/web/internal/spec/updateStyleTag.spec.d.ts +4 -0
- package/build/commands/web/internal/spec/updateStyleTag.spec.js +131 -0
- package/build/commands/web/internal/updateAllTags.js +22 -8
- package/build/commands/web/internal/updateLinkTag.d.ts +2 -2
- package/build/commands/web/internal/updateScriptTag.d.ts +1 -1
- package/build/commands/web/internal/updateScriptTag.js +21 -10
- package/build/commands/web/internal/updateStyleTag.d.ts +5 -0
- package/build/commands/web/internal/updateStyleTag.js +96 -0
- package/build/utils/config.js +4 -1
- package/package.json +2 -2
|
@@ -294,23 +294,21 @@ function getCreateFileScript(serverType) {
|
|
|
294
294
|
});
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
|
-
function getWebServiceScriptInvocation(serverType,
|
|
298
|
-
if (filePath === void 0) { filePath = ''; }
|
|
297
|
+
function getWebServiceScriptInvocation(serverType, isSASFile, encoded) {
|
|
299
298
|
if (isSASFile === void 0) { isSASFile = true; }
|
|
300
299
|
if (encoded === void 0) { encoded = false; }
|
|
301
|
-
var loc = filePath === '' ? 'services' : 'tests';
|
|
302
300
|
var encodedParam = encoded ? ', intype=BASE64' : '';
|
|
303
301
|
switch (serverType) {
|
|
304
302
|
case utils_1.ServerType.SasViya:
|
|
305
303
|
return isSASFile
|
|
306
|
-
? "%mv_createwebservice(path=&appLoc
|
|
307
|
-
: "%mv_createfile(path=&appLoc
|
|
304
|
+
? "%mv_createwebservice(path=&appLoc/&path, name=&service, code=sascode ,replace=yes)"
|
|
305
|
+
: "%mv_createfile(path=&appLoc/&path, name=&filename, inref=filecode".concat(encodedParam, ")");
|
|
308
306
|
case utils_1.ServerType.Sas9:
|
|
309
|
-
return "%mm_createwebservice(path=&appLoc
|
|
307
|
+
return "%mm_createwebservice(path=&appLoc/&path, name=&service, code=sascode ,replace=yes)";
|
|
310
308
|
case utils_1.ServerType.Sasjs:
|
|
311
309
|
return isSASFile
|
|
312
|
-
? "%mv_createwebservice(path=&appLoc
|
|
313
|
-
: "%mv_createfile(path=&appLoc
|
|
310
|
+
? "%mv_createwebservice(path=&appLoc/&path, name=&service, code=sascode ,replace=yes)"
|
|
311
|
+
: "%mv_createfile(path=&appLoc/&path, name=&filename, inref=filecode".concat(encodedParam, ")");
|
|
314
312
|
default:
|
|
315
313
|
throw new error_1.ServerTypeError();
|
|
316
314
|
}
|
|
@@ -340,7 +338,7 @@ function getFolderContent(serverType) {
|
|
|
340
338
|
var _a, content, contentJSON;
|
|
341
339
|
return __generator(this, function (_b) {
|
|
342
340
|
switch (_b.label) {
|
|
343
|
-
case 0: return [4 /*yield*/, getContentFor(
|
|
341
|
+
case 0: return [4 /*yield*/, getContentFor(buildDestinationFolder, path_1.default.join(buildDestinationFolder, subFolder), serverType)];
|
|
344
342
|
case 1:
|
|
345
343
|
_a = _b.sent(), content = _a.content, contentJSON = _a.contentJSON;
|
|
346
344
|
folderContent += "\n".concat(content);
|
|
@@ -383,28 +381,19 @@ function getDependencies(filePaths) {
|
|
|
383
381
|
});
|
|
384
382
|
});
|
|
385
383
|
}
|
|
386
|
-
function getContentFor(rootDirectory, folderPath, serverType
|
|
387
|
-
if (testPath === void 0) { testPath = undefined; }
|
|
384
|
+
function getContentFor(rootDirectory, folderPath, serverType) {
|
|
388
385
|
return __awaiter(this, void 0, void 0, function () {
|
|
389
|
-
var folderName,
|
|
386
|
+
var folderName, content, contentJSON, files, subFolders;
|
|
390
387
|
var _this = this;
|
|
391
388
|
return __generator(this, function (_a) {
|
|
392
389
|
switch (_a.label) {
|
|
393
390
|
case 0:
|
|
394
391
|
folderName = path_1.default.basename(folderPath);
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
? ''
|
|
401
|
-
: testPath !== undefined
|
|
402
|
-
? testPath
|
|
403
|
-
: folderPath
|
|
404
|
-
.replace(rootDirectory, '')
|
|
405
|
-
.substr(1)
|
|
406
|
-
.split(path_1.default.sep)
|
|
407
|
-
.join('/'), ";\n");
|
|
392
|
+
content = "\n%let path=".concat(folderPath
|
|
393
|
+
.replace(rootDirectory, '')
|
|
394
|
+
.substr(1)
|
|
395
|
+
.split(path_1.default.sep)
|
|
396
|
+
.join('/'), ";\n");
|
|
408
397
|
contentJSON = {
|
|
409
398
|
name: folderName,
|
|
410
399
|
type: 'folder',
|
|
@@ -423,7 +412,7 @@ function getContentFor(rootDirectory, folderPath, serverType, testPath) {
|
|
|
423
412
|
return [4 /*yield*/, (0, utils_1.readFile)(filePath)];
|
|
424
413
|
case 1:
|
|
425
414
|
fileContent = _a.sent();
|
|
426
|
-
transformedContent = getServiceText(file, fileContent, serverType
|
|
415
|
+
transformedContent = getServiceText(file, fileContent, serverType);
|
|
427
416
|
content += "\n".concat(transformedContent, "\n");
|
|
428
417
|
contentJSON.members.push({
|
|
429
418
|
name: file.replace(/.sas$/, ''),
|
|
@@ -455,11 +444,7 @@ function getContentFor(rootDirectory, folderPath, serverType, testPath) {
|
|
|
455
444
|
var _a, childContent, childContentJSON;
|
|
456
445
|
return __generator(this, function (_b) {
|
|
457
446
|
switch (_b.label) {
|
|
458
|
-
case 0: return [4 /*yield*/, getContentFor(rootDirectory, path_1.default.join(folderPath, subFolder), serverType
|
|
459
|
-
? testPath === ''
|
|
460
|
-
? subFolder
|
|
461
|
-
: "".concat(testPath, "/").concat(subFolder)
|
|
462
|
-
: undefined)];
|
|
447
|
+
case 0: return [4 /*yield*/, getContentFor(rootDirectory, path_1.default.join(folderPath, subFolder), serverType)];
|
|
463
448
|
case 1:
|
|
464
449
|
_a = _b.sent(), childContent = _a.content, childContentJSON = _a.contentJSON;
|
|
465
450
|
contentJSON.members.push(childContentJSON);
|
|
@@ -475,7 +460,7 @@ function getContentFor(rootDirectory, folderPath, serverType, testPath) {
|
|
|
475
460
|
});
|
|
476
461
|
});
|
|
477
462
|
}
|
|
478
|
-
function getServiceText(serviceFileName, fileContent, serverType
|
|
463
|
+
function getServiceText(serviceFileName, fileContent, serverType) {
|
|
479
464
|
var serviceName = serviceFileName.replace(/.sas$/, '');
|
|
480
465
|
var sourceCodeLines = getLines((0, utils_2.removeComments)(fileContent));
|
|
481
466
|
var content = "";
|
|
@@ -486,14 +471,14 @@ function getServiceText(serviceFileName, fileContent, serverType, testPath) {
|
|
|
486
471
|
}
|
|
487
472
|
});
|
|
488
473
|
return "%let service=".concat(serviceName, ";\nfilename sascode temp lrecl=32767;\ndata _null_;\nfile sascode;\n").concat(content, "\n\nrun;\n").concat(serverType !== utils_1.ServerType.Sasjs
|
|
489
|
-
? getWebServiceScriptInvocation(serverType
|
|
474
|
+
? getWebServiceScriptInvocation(serverType)
|
|
490
475
|
: '', "\nfilename sascode clear;\n");
|
|
491
476
|
}
|
|
492
477
|
function getFileText(fileName, fileContent, serverType) {
|
|
493
478
|
var fileExtension = path_1.default.extname(fileName).substring(1).toUpperCase();
|
|
494
479
|
var _a = getWebFileContent(fileContent, fileExtension), content = _a.content, maxLineLength = _a.maxLineLength;
|
|
495
480
|
return "%let filename=".concat(fileName, ";\nfilename filecode temp lrecl=").concat(maxLineLength, ";\ndata _null_;\nfile filecode;\n").concat(content, "\n\nrun;\n").concat(serverType !== utils_1.ServerType.Sasjs
|
|
496
|
-
? getWebServiceScriptInvocation(serverType,
|
|
481
|
+
? getWebServiceScriptInvocation(serverType, false, true)
|
|
497
482
|
: '', "\nfilename filecode clear;\n");
|
|
498
483
|
}
|
|
499
484
|
function getWebFileContent(filecontent, type) {
|
|
@@ -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 () {
|
|
@@ -83,12 +90,12 @@ 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
97
|
case 5: return [4 /*yield*/, (0, utils_2.asyncForEach)(deployScripts, function (deployScript) { return __awaiter(_this, void 0, void 0, function () {
|
|
91
|
-
var deployScriptPath,
|
|
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) {
|
|
@@ -100,19 +107,20 @@ function deploy(target, isLocal, sasjs) {
|
|
|
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
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;
|
|
@@ -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;
|
|
@@ -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 ".concat(
|
|
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 {
|
|
@@ -200,26 +228,37 @@ function deployToSasViya(deployScript, target, isLocal, linesToExecute, logFileP
|
|
|
200
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*/, (0, 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 ".concat(path_1.default.join(
|
|
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"))));
|
|
236
|
+
return [3 /*break*/, 5];
|
|
237
|
+
case 4:
|
|
238
|
+
(_d = process.logger) === null || _d === void 0 ? void 0 : _d.error('Unable to create log file.');
|
|
239
|
+
_g.label = 5;
|
|
240
|
+
case 5:
|
|
208
241
|
if (streamConfig === null || streamConfig === void 0 ? void 0 : streamConfig.streamWeb) {
|
|
209
242
|
appLoc = target.appLoc.replace(/\ /g, '%20');
|
|
210
243
|
webAppStreamUrl = "".concat(target.serverUrl, "/SASJobExecution?_FILE=").concat(appLoc, "/services/").concat(streamConfig.streamServiceName, ".html&_debug=2");
|
|
211
|
-
(
|
|
244
|
+
(_e = process.logger) === null || _e === void 0 ? void 0 : _e.info("Web app is available at ".concat(webAppStreamUrl));
|
|
212
245
|
}
|
|
213
|
-
return [
|
|
214
|
-
case 4:
|
|
215
|
-
(_e = process.logger) === null || _e === void 0 ? void 0 : _e.error('Unable to create log file.');
|
|
216
|
-
_g.label = 5;
|
|
217
|
-
case 5: return [2 /*return*/];
|
|
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;
|
|
@@ -256,33 +295,42 @@ function deployToSas9(deployScript, target, linesToExecute, logFilePath, streamC
|
|
|
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*/, (0, utils_2.createFile)(path_1.default.join(logFilePath, "".concat(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
311
|
webAppStreamUrl = "".concat(target.serverUrl, "/SASStoredProcess/?_PROGRAM=").concat(appLoc, "/services/").concat(streamConfig.streamServiceName);
|
|
271
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;
|
|
333
|
+
var buildDestinationFolder, finalFilePathJSON, jsonContent, payload, authConfig, e_2, result;
|
|
286
334
|
return __generator(this, function (_c) {
|
|
287
335
|
switch (_c.label) {
|
|
288
336
|
case 0:
|
|
@@ -292,18 +340,31 @@ function deployToSasjs(target, sasjs) {
|
|
|
292
340
|
case 1:
|
|
293
341
|
jsonContent = _c.sent();
|
|
294
342
|
payload = JSON.parse(jsonContent);
|
|
295
|
-
sasjs
|
|
296
|
-
|
|
297
|
-
:
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error(err);
|
|
305
|
-
})];
|
|
343
|
+
if (!!sasjs) return [3 /*break*/, 5];
|
|
344
|
+
sasjs = new node_1.default({
|
|
345
|
+
serverUrl: target.serverUrl,
|
|
346
|
+
appLoc: target.appLoc,
|
|
347
|
+
serverType: target.serverType,
|
|
348
|
+
httpsAgentOptions: target.httpsAgentOptions,
|
|
349
|
+
debug: true
|
|
350
|
+
});
|
|
351
|
+
_c.label = 2;
|
|
306
352
|
case 2:
|
|
353
|
+
_c.trys.push([2, 4, , 5]);
|
|
354
|
+
return [4 /*yield*/, (0, config_1.getAuthConfig)(target)];
|
|
355
|
+
case 3:
|
|
356
|
+
authConfig = _c.sent();
|
|
357
|
+
return [3 /*break*/, 5];
|
|
358
|
+
case 4:
|
|
359
|
+
e_2 = _c.sent();
|
|
360
|
+
return [3 /*break*/, 5];
|
|
361
|
+
case 5: return [4 /*yield*/, sasjs
|
|
362
|
+
.deployToSASjs(payload, undefined, authConfig)
|
|
363
|
+
.catch(function (err) {
|
|
364
|
+
var _a;
|
|
365
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error(err);
|
|
366
|
+
})];
|
|
367
|
+
case 6:
|
|
307
368
|
result = _c.sent();
|
|
308
369
|
if ((result === null || result === void 0 ? void 0 : result.status) === 'failure') {
|
|
309
370
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error(result.message);
|