@sasjs/cli 3.27.1 → 3.27.3
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.
|
@@ -74,7 +74,8 @@ function deployToSasjsWithServicePack(jsonFilePath, target, streamConfig) {
|
|
|
74
74
|
.deployZipFile(zipFilePath, authConfig)
|
|
75
75
|
.catch(function (err) {
|
|
76
76
|
var _a;
|
|
77
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error('
|
|
77
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error('deployServicePack error', err);
|
|
78
|
+
throw new Error('Deploy service pack error');
|
|
78
79
|
})];
|
|
79
80
|
case 6:
|
|
80
81
|
result = _e.sent();
|
|
@@ -87,7 +88,8 @@ function deployToSasjsWithServicePack(jsonFilePath, target, streamConfig) {
|
|
|
87
88
|
.deploy(payload, target.appLoc, authConfig)
|
|
88
89
|
.catch(function (err) {
|
|
89
90
|
var _a;
|
|
90
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error('
|
|
91
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error('deployServicePack error', err);
|
|
92
|
+
throw new Error('Deploy service pack error');
|
|
91
93
|
})];
|
|
92
94
|
case 9:
|
|
93
95
|
result = _e.sent();
|
|
@@ -98,6 +100,7 @@ function deployToSasjsWithServicePack(jsonFilePath, target, streamConfig) {
|
|
|
98
100
|
if (result.example) {
|
|
99
101
|
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Payload example:\n".concat(JSON.stringify(result.example, null, 2)));
|
|
100
102
|
}
|
|
103
|
+
throw new Error('Deploy service pack error');
|
|
101
104
|
}
|
|
102
105
|
if ((streamConfig === null || streamConfig === void 0 ? void 0 : streamConfig.streamWeb) && (result === null || result === void 0 ? void 0 : result.streamServiceName)) {
|
|
103
106
|
webAppStreamUrl = "".concat(target.serverUrl, "/AppStream/").concat(result.streamServiceName);
|
|
@@ -54,11 +54,11 @@ var utils_1 = require("@sasjs/utils");
|
|
|
54
54
|
* for printing web app url on console.
|
|
55
55
|
*/
|
|
56
56
|
function executeDeployScriptSasViya(deployScriptName, target, linesToExecute, logFilePath, streamConfig) {
|
|
57
|
-
var _a, _b, _c, _d;
|
|
57
|
+
var _a, _b, _c, _d, _e;
|
|
58
58
|
return __awaiter(this, void 0, void 0, function () {
|
|
59
|
-
var contextName,
|
|
60
|
-
return __generator(this, function (
|
|
61
|
-
switch (
|
|
59
|
+
var contextName, _f, sasjs, authConfig, executionResult, log, appLoc, webAppStreamUrl;
|
|
60
|
+
return __generator(this, function (_g) {
|
|
61
|
+
switch (_g.label) {
|
|
62
62
|
case 0:
|
|
63
63
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Sending ".concat(deployScriptName, " to SAS server for execution."));
|
|
64
64
|
contextName = target.contextName;
|
|
@@ -67,7 +67,7 @@ function executeDeployScriptSasViya(deployScriptName, target, linesToExecute, lo
|
|
|
67
67
|
}
|
|
68
68
|
return [4 /*yield*/, (0, config_1.getSASjsAndAuthConfig)(target)];
|
|
69
69
|
case 1:
|
|
70
|
-
|
|
70
|
+
_f = _g.sent(), sasjs = _f.sasjs, authConfig = _f.authConfig;
|
|
71
71
|
return [4 /*yield*/, sasjs
|
|
72
72
|
.executeScript({
|
|
73
73
|
fileName: deployScriptName,
|
|
@@ -77,15 +77,24 @@ function executeDeployScriptSasViya(deployScriptName, target, linesToExecute, lo
|
|
|
77
77
|
})
|
|
78
78
|
.catch(function (err) {
|
|
79
79
|
process.logger.error('executeScriptSASViya Error', err);
|
|
80
|
+
if (err.log)
|
|
81
|
+
return { log: err.log, completedWithError: true };
|
|
82
|
+
throw err;
|
|
80
83
|
})];
|
|
81
84
|
case 2:
|
|
82
|
-
executionResult =
|
|
85
|
+
executionResult = _g.sent();
|
|
83
86
|
try {
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
if (typeof executionResult.log === 'string') {
|
|
88
|
+
log = executionResult.log;
|
|
89
|
+
}
|
|
90
|
+
else if (executionResult.log.items) {
|
|
91
|
+
log = executionResult.log.items
|
|
86
92
|
.map(function (i) { return i.line; })
|
|
87
|
-
.join(os_1.default.EOL)
|
|
88
|
-
|
|
93
|
+
.join(os_1.default.EOL);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
log = JSON.stringify(executionResult.log).replace(/\\n/g, os_1.default.EOL);
|
|
97
|
+
}
|
|
89
98
|
}
|
|
90
99
|
catch (e) {
|
|
91
100
|
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.error("An error occurred when parsing the execution response: ".concat(e.message));
|
|
@@ -93,12 +102,16 @@ function executeDeployScriptSasViya(deployScriptName, target, linesToExecute, lo
|
|
|
93
102
|
}
|
|
94
103
|
return [4 /*yield*/, (0, utils_1.createFile)(logFilePath, log)];
|
|
95
104
|
case 3:
|
|
96
|
-
|
|
97
|
-
(
|
|
105
|
+
_g.sent();
|
|
106
|
+
if (executionResult.completedWithError) {
|
|
107
|
+
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.error("Deployment failed with errors! Log is available at ".concat(logFilePath));
|
|
108
|
+
throw new Error("Deployment failed.");
|
|
109
|
+
}
|
|
110
|
+
(_d = process.logger) === null || _d === void 0 ? void 0 : _d.success("Deployment completed! Log is available at ".concat(logFilePath));
|
|
98
111
|
if (streamConfig === null || streamConfig === void 0 ? void 0 : streamConfig.streamWeb) {
|
|
99
112
|
appLoc = encodeURI(target.appLoc);
|
|
100
113
|
webAppStreamUrl = "".concat(target.serverUrl, "/SASJobExecution?_FILE=").concat(appLoc, "/services/").concat(streamConfig.streamServiceName, ".html&_debug=2");
|
|
101
|
-
(
|
|
114
|
+
(_e = process.logger) === null || _e === void 0 ? void 0 : _e.info("Web app is available at ".concat(webAppStreamUrl));
|
|
102
115
|
}
|
|
103
116
|
return [2 /*return*/];
|
|
104
117
|
}
|
package/build/config.json
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
"fileName": "buildinitviya.sas",
|
|
39
|
-
"content": "/**\n @file buildinitviya.sas\n @brief this executed as part of the generation of the Viya build script\n @details This file is inserted *after* the build macros and *before* the service code.\n\n For an explanation of this part, see: https://sasjs.io/sasjs/sasjs-cli/#viya-deployment-script\n\n <h4> SAS Macros </h4>\n\n**/\n\n
|
|
39
|
+
"content": "/**\n @file buildinitviya.sas\n @brief this executed as part of the generation of the Viya build script\n @details This file is inserted *after* the build macros and *before* the service code.\n\n For an explanation of this part, see: https://sasjs.io/sasjs/sasjs-cli/#viya-deployment-script\n\n <h4> SAS Macros </h4>\n\n**/\n\n%put buildinit script;\n\n"
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
"fileName": "buildterm.sas",
|
|
@@ -195,27 +195,9 @@
|
|
|
195
195
|
],
|
|
196
196
|
"config": {
|
|
197
197
|
"$schema": "https://cli.sasjs.io/sasjsconfig-schema.json",
|
|
198
|
-
"docConfig": {
|
|
199
|
-
"displayMacroCore": true,
|
|
200
|
-
"enableLineage": true,
|
|
201
|
-
"outDirectory": "",
|
|
202
|
-
"dataControllerUrl": "",
|
|
203
|
-
"doxyContent": {
|
|
204
|
-
"favIcon": "favicon.ico",
|
|
205
|
-
"footer": "new_footer.html",
|
|
206
|
-
"header": "new_header.html",
|
|
207
|
-
"layout": "DoxygenLayout.xml",
|
|
208
|
-
"logo": "logo.png",
|
|
209
|
-
"readMe": "../../README.md",
|
|
210
|
-
"stylesheet": "new_stylesheet.css",
|
|
211
|
-
"path": "./sasjs/doxy/"
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
198
|
"buildConfig": {
|
|
215
199
|
"initProgram": "sasjs/build/buildinit.sas",
|
|
216
200
|
"termProgram": "sasjs/build/buildterm.sas",
|
|
217
|
-
"buildOutputFolder": "sasjsbuild",
|
|
218
|
-
"buildResultsFolder": "sasjsresults",
|
|
219
201
|
"macroVars": {
|
|
220
202
|
"name": "value",
|
|
221
203
|
"numvar": "42"
|
|
@@ -236,15 +218,12 @@
|
|
|
236
218
|
"macroFolders": ["sasjs/macros"],
|
|
237
219
|
"programFolders": ["sasjs/programs"],
|
|
238
220
|
"binaryFolders": ["sasjs/binaries"],
|
|
239
|
-
"
|
|
221
|
+
"defaultTarget": "viya",
|
|
240
222
|
"targets": [
|
|
241
223
|
{
|
|
242
224
|
"name": "viya",
|
|
243
225
|
"serverType": "SASVIYA",
|
|
244
|
-
"serverUrl": "
|
|
245
|
-
"httpsAgentOptions": {
|
|
246
|
-
"allowInsecureRequests": false
|
|
247
|
-
},
|
|
226
|
+
"serverUrl": "",
|
|
248
227
|
"appLoc": "/Public/app",
|
|
249
228
|
"contextName": "SAS Job Execution compute context",
|
|
250
229
|
"buildConfig": {
|
|
@@ -256,10 +235,6 @@
|
|
|
256
235
|
"extravar": "this too"
|
|
257
236
|
}
|
|
258
237
|
},
|
|
259
|
-
"deployConfig": {
|
|
260
|
-
"deployServicePack": true,
|
|
261
|
-
"deployScripts": ["sasjsbuild/myviyadeploy.sas"]
|
|
262
|
-
},
|
|
263
238
|
"serviceConfig": {
|
|
264
239
|
"serviceFolders": ["sasjs/targets/viya/services/admin"],
|
|
265
240
|
"initProgram": "sasjs/build/serviceinit.sas",
|
|
@@ -269,52 +244,30 @@
|
|
|
269
244
|
"extravar": "this too"
|
|
270
245
|
}
|
|
271
246
|
},
|
|
272
|
-
"
|
|
273
|
-
"jobFolders": [],
|
|
274
|
-
"initProgram": "",
|
|
275
|
-
"termProgram": "",
|
|
276
|
-
"macroVars": {}
|
|
277
|
-
},
|
|
278
|
-
"streamConfig": {
|
|
279
|
-
"assetPaths": [],
|
|
280
|
-
"streamWeb": false,
|
|
281
|
-
"streamWebFolder": "webv",
|
|
282
|
-
"webSourcePath": "dist"
|
|
283
|
-
},
|
|
284
|
-
"macroFolders": ["sasjs/targets/viya/macros"],
|
|
285
|
-
"programFolders": []
|
|
247
|
+
"macroFolders": ["sasjs/targets/viya/macros"]
|
|
286
248
|
},
|
|
287
249
|
{
|
|
288
250
|
"name": "sas9",
|
|
289
251
|
"serverType": "SAS9",
|
|
290
|
-
"serverUrl": "
|
|
252
|
+
"serverUrl": "",
|
|
291
253
|
"appLoc": "/User Folders/&sysuserid/My Folder",
|
|
292
254
|
"serverName": "Foundation",
|
|
293
255
|
"repositoryName": "SASApp",
|
|
294
|
-
"buildConfig": {
|
|
295
|
-
"buildOutputFileName": "mysas9deploy.sas",
|
|
296
|
-
"initProgram": "",
|
|
297
|
-
"termProgram": "",
|
|
298
|
-
"macroVars": {}
|
|
299
|
-
},
|
|
300
256
|
"deployConfig": {
|
|
301
257
|
"deployScripts": ["sasjs/build/deploysas9.sh"],
|
|
302
258
|
"deployServicePack": false
|
|
303
259
|
},
|
|
304
260
|
"serviceConfig": {
|
|
305
261
|
"serviceFolders": ["sasjs/targets/sas9/services/admin"],
|
|
306
|
-
"
|
|
307
|
-
"termProgram": "sasjs/build/servicetermother.sas",
|
|
308
|
-
"macroVars": {}
|
|
262
|
+
"termProgram": "sasjs/build/servicetermother.sas"
|
|
309
263
|
},
|
|
310
|
-
"
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
"
|
|
317
|
-
"programFolders": []
|
|
264
|
+
"macroFolders": ["sasjs/targets/sas9/macros"]
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"name": "sasjs",
|
|
268
|
+
"serverType": "SASJS",
|
|
269
|
+
"serverUrl": "",
|
|
270
|
+
"appLoc": "/Public/app"
|
|
318
271
|
}
|
|
319
272
|
]
|
|
320
273
|
}
|
|
@@ -156,26 +156,27 @@ describe('setConstants', function () {
|
|
|
156
156
|
return [4 /*yield*/, (0, setConstants_1.setConstants)()];
|
|
157
157
|
case 1:
|
|
158
158
|
_a.sent();
|
|
159
|
-
verifySasjsConstants();
|
|
159
|
+
verifySasjsConstants(undefined, false, false);
|
|
160
160
|
return [2 /*return*/];
|
|
161
161
|
}
|
|
162
162
|
});
|
|
163
163
|
}); });
|
|
164
164
|
});
|
|
165
|
-
var verifySasjsConstants = function (appFolder, hasSasjsCore) {
|
|
165
|
+
var verifySasjsConstants = function (appFolder, hasSasjsCore, isLocal) {
|
|
166
166
|
if (hasSasjsCore === void 0) { hasSasjsCore = false; }
|
|
167
|
+
if (isLocal === void 0) { isLocal = true; }
|
|
167
168
|
var prefixAppFolder = appFolder !== null && appFolder !== void 0 ? appFolder : require('os').homedir();
|
|
168
169
|
var sasjsConstants = process.sasjsConstants;
|
|
169
170
|
expect(sasjsConstants.buildSourceFolder).toEqual(prefixAppFolder);
|
|
170
171
|
expect(sasjsConstants.buildSourceDbFolder).toEqual([prefixAppFolder, 'sasjs', 'db'].join(path_1.default.sep));
|
|
171
|
-
expect(sasjsConstants.buildDestinationFolder).toEqual(
|
|
172
|
-
expect(sasjsConstants.buildDestinationServicesFolder).toEqual(
|
|
173
|
-
expect(sasjsConstants.buildDestinationJobsFolder).toEqual(
|
|
174
|
-
expect(sasjsConstants.buildDestinationDbFolder).toEqual(
|
|
175
|
-
expect(sasjsConstants.buildDestinationDocsFolder).toEqual(
|
|
176
|
-
expect(sasjsConstants.buildDestinationResultsFolder).toEqual(
|
|
177
|
-
expect(sasjsConstants.buildDestinationResultsLogsFolder).toEqual(
|
|
178
|
-
expect(sasjsConstants.buildDestinationTestFolder).toEqual(
|
|
172
|
+
expect(sasjsConstants.buildDestinationFolder).toEqual(path_1.default.join(prefixAppFolder, isLocal ? '' : '.sasjs', 'sasjsbuild'));
|
|
173
|
+
expect(sasjsConstants.buildDestinationServicesFolder).toEqual(path_1.default.join(prefixAppFolder, isLocal ? '' : '.sasjs', 'sasjsbuild', 'services'));
|
|
174
|
+
expect(sasjsConstants.buildDestinationJobsFolder).toEqual(path_1.default.join(prefixAppFolder, isLocal ? '' : '.sasjs', 'sasjsbuild', 'jobs'));
|
|
175
|
+
expect(sasjsConstants.buildDestinationDbFolder).toEqual(path_1.default.join(prefixAppFolder, isLocal ? '' : '.sasjs', 'sasjsbuild', 'db'));
|
|
176
|
+
expect(sasjsConstants.buildDestinationDocsFolder).toEqual(path_1.default.join(prefixAppFolder, isLocal ? '' : '.sasjs', 'sasjsbuild', 'docs'));
|
|
177
|
+
expect(sasjsConstants.buildDestinationResultsFolder).toEqual(path_1.default.join(prefixAppFolder, isLocal ? '' : '.sasjs', 'sasjsresults'));
|
|
178
|
+
expect(sasjsConstants.buildDestinationResultsLogsFolder).toEqual(path_1.default.join(prefixAppFolder, isLocal ? '' : '.sasjs', 'sasjsresults', 'logs'));
|
|
179
|
+
expect(sasjsConstants.buildDestinationTestFolder).toEqual(path_1.default.join(prefixAppFolder, isLocal ? '' : '.sasjs', 'sasjsbuild', 'tests'));
|
|
179
180
|
var corePath = hasSasjsCore
|
|
180
181
|
? 'core'
|
|
181
182
|
: path_1.default.join('cli', 'node_modules', '@sasjs', 'core');
|
package/package.json
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@sasjs/adapter": "4.1.
|
|
53
|
+
"@sasjs/adapter": "4.1.3",
|
|
54
54
|
"@sasjs/core": "4.45.4",
|
|
55
55
|
"@sasjs/lint": "2.2.0",
|
|
56
56
|
"@sasjs/utils": "2.52.0",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"typescript": "4.5.4",
|
|
102
102
|
"util": "0.12.4"
|
|
103
103
|
},
|
|
104
|
-
"version": "3.27.
|
|
104
|
+
"version": "3.27.3"
|
|
105
105
|
}
|