@sasjs/cli 3.12.4 → 3.12.5
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 +18 -5
- package/build/commands/deploy/deploy.js +19 -18
- package/build/commands/deploy/spec/cbd.spec.js +30 -27
- package/build/commands/shared/deployToSasViyaWithServicePack.d.ts +2 -3
- package/build/commands/shared/deployToSasViyaWithServicePack.js +2 -2
- package/build/types/index.d.ts +0 -1
- package/package.json +3 -3
- package/build/types/servicePack.d.ts +0 -9
- package/build/types/servicePack.js +0 -2
|
@@ -96,6 +96,7 @@ var config_1 = require("../../utils/config");
|
|
|
96
96
|
var compile_1 = require("../compile/compile");
|
|
97
97
|
var config_2 = require("./internal/config");
|
|
98
98
|
var getLaunchPageCode_1 = require("./internal/getLaunchPageCode");
|
|
99
|
+
var types_1 = require("@sasjs/utils/types");
|
|
99
100
|
function build(target) {
|
|
100
101
|
return __awaiter(this, void 0, void 0, function () {
|
|
101
102
|
return __generator(this, function (_a) {
|
|
@@ -115,7 +116,7 @@ exports.build = build;
|
|
|
115
116
|
function createFinalSasFiles(target) {
|
|
116
117
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
117
118
|
return __awaiter(this, void 0, void 0, function () {
|
|
118
|
-
var streamConfig, streamWeb, buildConfig, serverType, name, macroFolders, buildOutputFileName, buildDestinationFolder, finalSasFileContent, finalFilePath, finalFilePathJSON, buildInfo, buildInit, buildTerm, macroCorePath, dependencyFilePaths, dependenciesContent, _h, folderContent, folderContentJSON;
|
|
119
|
+
var streamConfig, streamWeb, buildConfig, serverType, name, macroFolders, buildOutputFileName, buildDestinationFolder, finalSasFileContent, finalFilePath, finalFilePathJSON, buildInfo, buildInit, buildTerm, macroCorePath, dependencyFilePaths, dependenciesContent, _h, folderContent, folderContentJSON, servicePackSASjs, servicePack;
|
|
119
120
|
return __generator(this, function (_j) {
|
|
120
121
|
switch (_j.label) {
|
|
121
122
|
case 0:
|
|
@@ -154,6 +155,10 @@ function createFinalSasFiles(target) {
|
|
|
154
155
|
return [4 /*yield*/, getFolderContent(serverType)];
|
|
155
156
|
case 8:
|
|
156
157
|
_h = _j.sent(), folderContent = _h.folderContent, folderContentJSON = _h.folderContentJSON;
|
|
158
|
+
servicePackSASjs = {
|
|
159
|
+
appLoc: target.appLoc,
|
|
160
|
+
fileTree: folderContentJSON
|
|
161
|
+
};
|
|
157
162
|
finalSasFileContent += "\n".concat(folderContent);
|
|
158
163
|
finalSasFileContent += "\n".concat(buildTerm);
|
|
159
164
|
if (streamWeb) {
|
|
@@ -161,6 +166,11 @@ function createFinalSasFiles(target) {
|
|
|
161
166
|
target.serverType === utils_1.ServerType.Sas9) {
|
|
162
167
|
finalSasFileContent += (0, getLaunchPageCode_1.getLaunchPageCode)(target.serverType, streamConfig.streamServiceName);
|
|
163
168
|
}
|
|
169
|
+
else if (target.serverType === utils_1.ServerType.Sasjs) {
|
|
170
|
+
servicePackSASjs.streamLogo = streamConfig.streamLogo;
|
|
171
|
+
servicePackSASjs.streamServiceName = streamConfig.streamServiceName;
|
|
172
|
+
servicePackSASjs.streamWebFolder = streamConfig.streamWebFolder;
|
|
173
|
+
}
|
|
164
174
|
}
|
|
165
175
|
finalSasFileContent = (0, utils_2.removeComments)(finalSasFileContent);
|
|
166
176
|
(_d = process.logger) === null || _d === void 0 ? void 0 : _d.debug("Creating file ".concat(finalFilePath, " ."));
|
|
@@ -169,7 +179,10 @@ function createFinalSasFiles(target) {
|
|
|
169
179
|
_j.sent();
|
|
170
180
|
(_e = process.logger) === null || _e === void 0 ? void 0 : _e.success("File ".concat(finalFilePath, " has been created."));
|
|
171
181
|
(_f = process.logger) === null || _f === void 0 ? void 0 : _f.debug("Creating file ".concat(finalFilePathJSON, " ."));
|
|
172
|
-
|
|
182
|
+
servicePack = target.serverType === utils_1.ServerType.Sasjs
|
|
183
|
+
? servicePackSASjs
|
|
184
|
+
: folderContentJSON;
|
|
185
|
+
return [4 /*yield*/, (0, utils_1.createFile)(finalFilePathJSON, JSON.stringify(servicePack, null, 1))];
|
|
173
186
|
case 10:
|
|
174
187
|
_j.sent();
|
|
175
188
|
(_g = process.logger) === null || _g === void 0 ? void 0 : _g.success("File ".concat(finalFilePathJSON, " has been created."));
|
|
@@ -384,7 +397,7 @@ function getContentFor(rootDirectory, folderPath, serverType) {
|
|
|
384
397
|
.join('/'), ";\n");
|
|
385
398
|
contentJSON = {
|
|
386
399
|
name: folderName,
|
|
387
|
-
type:
|
|
400
|
+
type: types_1.MemberType.folder,
|
|
388
401
|
members: []
|
|
389
402
|
};
|
|
390
403
|
return [4 /*yield*/, (0, utils_1.listFilesInFolder)(folderPath)];
|
|
@@ -404,7 +417,7 @@ function getContentFor(rootDirectory, folderPath, serverType) {
|
|
|
404
417
|
content += "\n".concat(transformedContent, "\n");
|
|
405
418
|
contentJSON.members.push({
|
|
406
419
|
name: file.replace(/.sas$/, ''),
|
|
407
|
-
type:
|
|
420
|
+
type: types_1.MemberType.service,
|
|
408
421
|
code: (0, utils_2.removeComments)(fileContent)
|
|
409
422
|
});
|
|
410
423
|
return [3 /*break*/, 4];
|
|
@@ -415,7 +428,7 @@ function getContentFor(rootDirectory, folderPath, serverType) {
|
|
|
415
428
|
content += "\n".concat(transformedContent, "\n");
|
|
416
429
|
contentJSON.members.push({
|
|
417
430
|
name: file.replace(/.sas$/, ''),
|
|
418
|
-
type:
|
|
431
|
+
type: types_1.MemberType.file,
|
|
419
432
|
code: fileContentEncoded
|
|
420
433
|
});
|
|
421
434
|
_a.label = 4;
|
|
@@ -57,12 +57,12 @@ var deployToSasViyaWithServicePack_1 = require("../shared/deployToSasViyaWithSer
|
|
|
57
57
|
* @param {object} sasjs - optional configuration object of SAS adapter.
|
|
58
58
|
*/
|
|
59
59
|
function deploy(target, isLocal, sasjs) {
|
|
60
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
60
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
61
61
|
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
-
var appLoc, buildDestinationFolder_1, finalFilePathJSON, jsonObject, webIndexFileName, deployScripts, buildDestinationFolder, logFilePath, streamConfig;
|
|
62
|
+
var appLoc, buildDestinationFolder_1, finalFilePathJSON, jsonObject, servicesFolder, webIndexFileName, deployScripts, buildDestinationFolder, logFilePath, streamConfig;
|
|
63
63
|
var _this = this;
|
|
64
|
-
return __generator(this, function (
|
|
65
|
-
switch (
|
|
64
|
+
return __generator(this, function (_j) {
|
|
65
|
+
switch (_j.label) {
|
|
66
66
|
case 0:
|
|
67
67
|
if (!(target.serverType === utils_2.ServerType.SasViya &&
|
|
68
68
|
((_a = target.deployConfig) === null || _a === void 0 ? void 0 : _a.deployServicePack))) return [3 /*break*/, 2];
|
|
@@ -72,30 +72,31 @@ function deploy(target, isLocal, sasjs) {
|
|
|
72
72
|
finalFilePathJSON = path_1.default.join(buildDestinationFolder_1, "".concat(target.name, ".json"));
|
|
73
73
|
return [4 /*yield*/, (0, deployToSasViyaWithServicePack_1.deployToSasViyaWithServicePack)(finalFilePathJSON, target, isLocal, true)];
|
|
74
74
|
case 1:
|
|
75
|
-
jsonObject =
|
|
76
|
-
|
|
77
|
-
return (member === null || member === void 0 ? void 0 : member.name) === 'services' && (member === null || member === void 0 ? void 0 : member.type) ===
|
|
78
|
-
})
|
|
79
|
-
(
|
|
80
|
-
(
|
|
75
|
+
jsonObject = _j.sent();
|
|
76
|
+
servicesFolder = jsonObject === null || jsonObject === void 0 ? void 0 : jsonObject.members.find(function (member) {
|
|
77
|
+
return (member === null || member === void 0 ? void 0 : member.name) === 'services' && (member === null || member === void 0 ? void 0 : member.type) === utils_2.MemberType.folder;
|
|
78
|
+
});
|
|
79
|
+
webIndexFileName = (_e = (_d = (_c = servicesFolder === null || servicesFolder === void 0 ? void 0 : servicesFolder.members) === null || _c === void 0 ? void 0 : _c.find(function (member) { return (member === null || member === void 0 ? void 0 : member.type) === utils_2.MemberType.file; })) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : '';
|
|
80
|
+
(_f = process.logger) === null || _f === void 0 ? void 0 : _f.success('Build pack has been successfully deployed.');
|
|
81
|
+
(_g = process.logger) === null || _g === void 0 ? void 0 : _g.success(target.serverType === utils_2.ServerType.SasViya && webIndexFileName
|
|
81
82
|
? "".concat(target.serverUrl, "/SASJobExecution?_file=").concat(appLoc, "/services/").concat(webIndexFileName, "&_debug=2")
|
|
82
83
|
: "".concat(target.serverUrl, "/SASJobExecution?_folder=").concat(appLoc));
|
|
83
|
-
|
|
84
|
+
_j.label = 2;
|
|
84
85
|
case 2: return [4 /*yield*/, (0, getDeployScripts_1.getDeployScripts)(target)];
|
|
85
86
|
case 3:
|
|
86
|
-
deployScripts =
|
|
87
|
-
if (deployScripts.length === 0 && !((
|
|
87
|
+
deployScripts = _j.sent();
|
|
88
|
+
if (deployScripts.length === 0 && !((_h = target.deployConfig) === null || _h === void 0 ? void 0 : _h.deployServicePack)) {
|
|
88
89
|
throw new Error("Deployment failed.\nPlease either enable the 'deployServicePack' option or add deployment script paths to 'deployScripts' in your target's 'deployConfig'.");
|
|
89
90
|
}
|
|
90
91
|
buildDestinationFolder = process.sasjsConstants.buildDestinationFolder;
|
|
91
92
|
logFilePath = buildDestinationFolder;
|
|
92
93
|
return [4 /*yield*/, (0, config_1.getStreamConfig)(target)];
|
|
93
94
|
case 4:
|
|
94
|
-
streamConfig =
|
|
95
|
+
streamConfig = _j.sent();
|
|
95
96
|
if (!(target.serverType === utils_2.ServerType.Sasjs)) return [3 /*break*/, 6];
|
|
96
97
|
return [4 /*yield*/, deployToSasjs(target, sasjs, streamConfig)];
|
|
97
98
|
case 5:
|
|
98
|
-
|
|
99
|
+
_j.sent();
|
|
99
100
|
return [3 /*break*/, 8];
|
|
100
101
|
case 6: return [4 /*yield*/, (0, utils_2.asyncForEach)(deployScripts, function (deployScript) { return __awaiter(_this, void 0, void 0, function () {
|
|
101
102
|
var deployScriptPath, deployScriptContent, linesToExecute, deployScriptName, logPath;
|
|
@@ -139,8 +140,8 @@ function deploy(target, isLocal, sasjs) {
|
|
|
139
140
|
});
|
|
140
141
|
}); })];
|
|
141
142
|
case 7:
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
_j.sent();
|
|
144
|
+
_j.label = 8;
|
|
144
145
|
case 8: return [2 /*return*/];
|
|
145
146
|
}
|
|
146
147
|
});
|
|
@@ -364,7 +365,7 @@ function deployToSasjs(target, sasjs, streamConfig) {
|
|
|
364
365
|
e_2 = _d.sent();
|
|
365
366
|
return [3 /*break*/, 5];
|
|
366
367
|
case 5: return [4 /*yield*/, sasjs
|
|
367
|
-
.deployToSASjs(payload, undefined,
|
|
368
|
+
.deployToSASjs(payload, undefined, authConfig)
|
|
368
369
|
.catch(function (err) {
|
|
369
370
|
var _a;
|
|
370
371
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error(err);
|
|
@@ -133,33 +133,36 @@ describe('sasjs cbd with server type SASJS', function () {
|
|
|
133
133
|
webSourcePath: ''
|
|
134
134
|
};
|
|
135
135
|
expect(sasjs.deployToSASjs).toHaveBeenCalledWith({
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
'
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
'
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
136
|
+
appLoc: target.appLoc,
|
|
137
|
+
fileTree: {
|
|
138
|
+
members: [
|
|
139
|
+
{
|
|
140
|
+
name: 'services',
|
|
141
|
+
type: 'folder',
|
|
142
|
+
members: [
|
|
143
|
+
{
|
|
144
|
+
name: 'common',
|
|
145
|
+
type: 'folder',
|
|
146
|
+
members: [
|
|
147
|
+
{
|
|
148
|
+
name: 'appinit',
|
|
149
|
+
type: 'service',
|
|
150
|
+
code: (0, utils_3.removeComments)("".concat(mf_getuser).concat(mp_jsonout).concat(ms_webout).concat(webout) +
|
|
151
|
+
'/* provide additional debug info */\n%global _program;\n%put &=syscc;\n%put user=%mf_getuser();\n%put pgm=&_program;\n%put timestamp=%sysfunc(datetime(),datetime19.);\n* Service Variables start;\n* Service Variables end;\n* SAS Macros start;\n* SAS Macros end;\n* SAS Includes start;\n* SAS Includes end;\n* Binary Files start;\n* Binary Files end;\n* Service start;\nproc sql;\ncreate table areas as select distinct area\n from sashelp.springs;\n%webout(OPEN)\n%webout(OBJ,areas)\n%webout(CLOSE)\n* Service end;')
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: 'getdata',
|
|
155
|
+
type: 'service',
|
|
156
|
+
code: (0, utils_3.removeComments)("".concat(mf_getuser).concat(mp_jsonout).concat(ms_webout).concat(webout) +
|
|
157
|
+
'/* provide additional debug info */\n%global _program;\n%put &=syscc;\n%put user=%mf_getuser();\n%put pgm=&_program;\n%put timestamp=%sysfunc(datetime(),datetime19.);\n* Service Variables start;\n* Service Variables end;\n* SAS Macros start;\n* SAS Macros end;\n* SAS Includes start;\n* SAS Includes end;\n* Binary Files start;\n* Binary Files end;\n* Service start;\n%webout(FETCH)\nproc sql;\ncreate table springs as select * from sashelp.springs\n where area in (select area from work.areas);\n%webout(OPEN)\n%webout(OBJ,springs)\n%webout(CLOSE)\n* Service end;')
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
}, undefined, undefined);
|
|
163
166
|
return [2 /*return*/];
|
|
164
167
|
}
|
|
165
168
|
});
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { Target } from '@sasjs/utils';
|
|
2
|
-
|
|
3
|
-
export declare function deployToSasViyaWithServicePack(jsonFilePath: string, target: Target, isLocal: boolean, isForced?: boolean): Promise<ServicePack>;
|
|
1
|
+
import { FileTree, Target } from '@sasjs/utils';
|
|
2
|
+
export declare function deployToSasViyaWithServicePack(jsonFilePath: string, target: Target, isLocal: boolean, isForced?: boolean): Promise<FileTree>;
|
|
@@ -85,9 +85,9 @@ exports.deployToSasViyaWithServicePack = deployToSasViyaWithServicePack;
|
|
|
85
85
|
var populateCodeInServicePack = function (json) {
|
|
86
86
|
var _a;
|
|
87
87
|
return (_a = json === null || json === void 0 ? void 0 : json.members) === null || _a === void 0 ? void 0 : _a.forEach(function (member) {
|
|
88
|
-
if (member.type ===
|
|
88
|
+
if (member.type === utils_1.MemberType.file)
|
|
89
89
|
member.code = (0, js_base64_1.decode)(member.code);
|
|
90
|
-
if (member.type ===
|
|
90
|
+
if (member.type === utils_1.MemberType.folder)
|
|
91
91
|
populateCodeInServicePack(member);
|
|
92
92
|
});
|
|
93
93
|
};
|
package/build/types/index.d.ts
CHANGED
|
@@ -4,4 +4,3 @@ export { Folder } from './folder';
|
|
|
4
4
|
export { TargetScope } from './targetScope';
|
|
5
5
|
export { TestFlow, Coverage, CoverageType, CoverageState, TestResults, TestResultStatus, TestDescription, TestResult, TestResultDescription, TestResultCsv } from './testing';
|
|
6
6
|
export { Flow, FlowWave, FlowWaveJob } from './flow';
|
|
7
|
-
export { ServicePack, ServicePackMember } from './servicePack';
|
package/package.json
CHANGED
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@sasjs/adapter": "3.8.
|
|
50
|
+
"@sasjs/adapter": "3.8.2",
|
|
51
51
|
"@sasjs/core": "4.15.3",
|
|
52
52
|
"@sasjs/lint": "1.11.2",
|
|
53
|
-
"@sasjs/utils": "2.
|
|
53
|
+
"@sasjs/utils": "2.42.0",
|
|
54
54
|
"chalk": "4.1.2",
|
|
55
55
|
"csv-stringify": "5.6.5",
|
|
56
56
|
"dotenv": "10.0.0",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"typescript": "4.5.4",
|
|
95
95
|
"util": "0.12.4"
|
|
96
96
|
},
|
|
97
|
-
"version": "3.12.
|
|
97
|
+
"version": "3.12.5"
|
|
98
98
|
}
|