@sasjs/cli 3.16.0 → 3.16.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/README.md +3 -0
- package/build/commands/compile/internal/spec/compileTestFile.spec.js +5 -3
- package/build/commands/deploy/spec/cbd.spec.js +38 -17
- package/build/commands/testing/spec/testing.spec.js +5 -0
- package/build/commands/web/internal/createAssetServices.d.ts +11 -2
- package/build/commands/web/internal/createAssetServices.js +83 -92
- package/build/commands/web/internal/getAssetPath.d.ts +2 -0
- package/build/commands/web/internal/getAssetPath.js +17 -0
- package/build/commands/web/internal/modifyLinksInContent.d.ts +2 -0
- package/build/commands/web/internal/modifyLinksInContent.js +11 -0
- package/build/commands/web/internal/sas9/createClickMeService.d.ts +6 -0
- package/build/commands/web/internal/sas9/createClickMeService.js +91 -0
- package/build/commands/web/internal/sas9/generateAssetService.d.ts +7 -0
- package/build/commands/web/internal/sas9/generateAssetService.js +75 -0
- package/build/commands/web/internal/sas9/getWebServiceContent.d.ts +7 -0
- package/build/commands/web/internal/{getWebServiceContent.js → sas9/getWebServiceContent.js} +12 -8
- package/build/commands/web/internal/sas9/index.d.ts +3 -0
- package/build/commands/web/internal/sas9/index.js +15 -0
- package/build/commands/web/internal/sasViya/createClickMeFile.d.ts +6 -0
- package/build/commands/web/internal/sasViya/createClickMeFile.js +63 -0
- package/build/commands/web/internal/sasViya/index.d.ts +1 -0
- package/build/commands/web/internal/sasViya/index.js +13 -0
- package/build/commands/web/internal/sasjsout.d.ts +1 -1
- package/build/commands/web/internal/sasjsout.js +2 -1
- package/build/commands/web/internal/updateAllTags.d.ts +7 -4
- package/build/commands/web/internal/updateAllTags.js +5 -0
- package/build/commands/web/internal/updateLinkTag.d.ts +2 -4
- package/build/commands/web/internal/updateScriptTag.d.ts +2 -4
- package/build/commands/web/internal/updateScriptTag.js +32 -32
- package/build/commands/web/internal/updateStyleTag.d.ts +2 -4
- package/build/commands/web/internal/updateStyleTag.js +32 -32
- package/build/commands/web/web.js +30 -79
- package/build/constants.d.ts +1 -0
- package/build/utils/setConstants.js +4 -2
- package/package.json +1 -1
- package/build/commands/web/internal/getWebServiceContent.d.ts +0 -2
|
@@ -44,10 +44,11 @@ var utils_1 = require("@sasjs/utils");
|
|
|
44
44
|
var config_1 = require("../../utils/config");
|
|
45
45
|
var path_1 = __importDefault(require("path"));
|
|
46
46
|
var jsdom_1 = __importDefault(require("jsdom"));
|
|
47
|
-
var sasjsout_1 = require("./internal/sasjsout");
|
|
48
47
|
var adjustIframeScript_1 = require("./internal/adjustIframeScript");
|
|
49
48
|
var createAssetServices_1 = require("./internal/createAssetServices");
|
|
50
49
|
var updateAllTags_1 = require("./internal/updateAllTags");
|
|
50
|
+
var sas9_1 = require("./internal/sas9");
|
|
51
|
+
var sasViya_1 = require("./internal/sasViya");
|
|
51
52
|
var exampleStreamConfig = {
|
|
52
53
|
streamWeb: true,
|
|
53
54
|
streamWebFolder: '/example/folder/path',
|
|
@@ -58,32 +59,32 @@ var exampleStreamConfig = {
|
|
|
58
59
|
function createWebAppServices(target) {
|
|
59
60
|
var _a, _b;
|
|
60
61
|
return __awaiter(this, void 0, void 0, function () {
|
|
61
|
-
var buildDestinationServicesFolder, streamConfig, _c, webSourcePathFull, indexHtmlPath, destinationPath, assetPathMap, indexHtml;
|
|
62
|
-
return __generator(this, function (
|
|
63
|
-
switch (
|
|
62
|
+
var buildDestinationServicesFolder, streamConfig, _c, webSourcePathFull, indexHtmlPath, destinationPath, assetPathMap, indexHtml, _d;
|
|
63
|
+
return __generator(this, function (_e) {
|
|
64
|
+
switch (_e.label) {
|
|
64
65
|
case 0:
|
|
65
66
|
buildDestinationServicesFolder = process.sasjsConstants.buildDestinationServicesFolder;
|
|
66
67
|
return [4 /*yield*/, (0, config_1.getStreamConfig)(target)];
|
|
67
68
|
case 1:
|
|
68
|
-
streamConfig =
|
|
69
|
+
streamConfig = _e.sent();
|
|
69
70
|
return [4 /*yield*/, validateStreamConfig(streamConfig)];
|
|
70
71
|
case 2:
|
|
71
|
-
_c =
|
|
72
|
+
_c = _e.sent(), webSourcePathFull = _c.webSourcePathFull, indexHtmlPath = _c.indexHtmlPath;
|
|
72
73
|
return [4 /*yield*/, createBuildDestinationFolder()];
|
|
73
74
|
case 3:
|
|
74
|
-
|
|
75
|
+
_e.sent();
|
|
75
76
|
destinationPath = path_1.default.join(buildDestinationServicesFolder, streamConfig.streamWebFolder);
|
|
76
77
|
return [4 /*yield*/, createTargetDestinationFolder(destinationPath)
|
|
77
78
|
// For server type SASjs, just need to copy webSourcePath
|
|
78
79
|
// to streamWebFolder, no need to create service files.
|
|
79
80
|
];
|
|
80
81
|
case 4:
|
|
81
|
-
|
|
82
|
+
_e.sent();
|
|
82
83
|
if (!(target.serverType === utils_1.ServerType.Sasjs)) return [3 /*break*/, 6];
|
|
83
84
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Copying web app files for target ".concat(target.name, "..."));
|
|
84
85
|
return [4 /*yield*/, (0, utils_1.copy)(webSourcePathFull, destinationPath)];
|
|
85
86
|
case 5:
|
|
86
|
-
|
|
87
|
+
_e.sent();
|
|
87
88
|
return [2 /*return*/];
|
|
88
89
|
case 6:
|
|
89
90
|
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Compiling web app services for target ".concat(target.name, "..."));
|
|
@@ -93,10 +94,10 @@ function createWebAppServices(target) {
|
|
|
93
94
|
return map;
|
|
94
95
|
})];
|
|
95
96
|
case 7:
|
|
96
|
-
assetPathMap =
|
|
97
|
+
assetPathMap = _e.sent();
|
|
97
98
|
return [4 /*yield*/, (0, utils_1.readFile)(indexHtmlPath).then(function (content) { return new jsdom_1.default.JSDOM(content); })];
|
|
98
99
|
case 8:
|
|
99
|
-
indexHtml =
|
|
100
|
+
indexHtml = _e.sent();
|
|
100
101
|
return [4 /*yield*/, (0, updateAllTags_1.updateAllTags)(indexHtml, {
|
|
101
102
|
webSourcePathFull: webSourcePathFull,
|
|
102
103
|
destinationPath: destinationPath,
|
|
@@ -104,18 +105,25 @@ function createWebAppServices(target) {
|
|
|
104
105
|
assetPathMap: assetPathMap
|
|
105
106
|
})];
|
|
106
107
|
case 9:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
_e.sent();
|
|
109
|
+
_d = target.serverType;
|
|
110
|
+
switch (_d) {
|
|
111
|
+
case utils_1.ServerType.SasViya: return [3 /*break*/, 10];
|
|
112
|
+
case utils_1.ServerType.Sas9: return [3 /*break*/, 12];
|
|
113
|
+
}
|
|
114
|
+
return [3 /*break*/, 14];
|
|
111
115
|
case 10:
|
|
112
|
-
|
|
113
|
-
return [
|
|
114
|
-
case 11:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
case 13:
|
|
116
|
+
indexHtml.window.document.body.innerHTML += adjustIframeScript_1.adjustIframeScript;
|
|
117
|
+
return [4 /*yield*/, (0, sasViya_1.createClickMeFile)(indexHtml.serialize(), streamConfig.streamServiceName)];
|
|
118
|
+
case 11:
|
|
119
|
+
_e.sent();
|
|
120
|
+
return [3 /*break*/, 15];
|
|
121
|
+
case 12: return [4 /*yield*/, (0, sas9_1.createClickMeService)(indexHtml.serialize(), streamConfig.streamServiceName)];
|
|
122
|
+
case 13:
|
|
123
|
+
_e.sent();
|
|
124
|
+
return [3 /*break*/, 15];
|
|
125
|
+
case 14: throw new Error("Server Type: ".concat(target.serverType, " is not supported for processing streaming index file."));
|
|
126
|
+
case 15: return [2 /*return*/];
|
|
119
127
|
}
|
|
120
128
|
});
|
|
121
129
|
});
|
|
@@ -193,60 +201,3 @@ function createTargetDestinationFolder(destinationPath) {
|
|
|
193
201
|
});
|
|
194
202
|
});
|
|
195
203
|
}
|
|
196
|
-
function createClickMeService(indexHtmlContent, fileName) {
|
|
197
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
198
|
-
var lines, clickMeServiceContent, buildDestinationServicesFolder;
|
|
199
|
-
return __generator(this, function (_a) {
|
|
200
|
-
switch (_a.label) {
|
|
201
|
-
case 0:
|
|
202
|
-
lines = indexHtmlContent.replace(/\r\n/g, '\n').split('\n');
|
|
203
|
-
clickMeServiceContent = "".concat(sasjsout_1.sasjsout, "\nfilename sasjs temp lrecl=99999999;\ndata _null_;\nfile sasjs;\n");
|
|
204
|
-
lines.forEach(function (line) {
|
|
205
|
-
var chunkedLines = (0, utils_1.chunk)(line);
|
|
206
|
-
if (chunkedLines.length === 1) {
|
|
207
|
-
if (chunkedLines[0].length == 0)
|
|
208
|
-
chunkedLines[0] = ' ';
|
|
209
|
-
clickMeServiceContent += "put '".concat(chunkedLines[0]
|
|
210
|
-
.split("'")
|
|
211
|
-
.join("''"), "';\n");
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
var combinedLines_1 = '';
|
|
215
|
-
chunkedLines.forEach(function (chunkedLine, index) {
|
|
216
|
-
var text = "put '".concat(chunkedLine.split("'").join("''"), "'");
|
|
217
|
-
if (index !== chunkedLines.length - 1) {
|
|
218
|
-
text += '@;\n';
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
text += ';\n';
|
|
222
|
-
}
|
|
223
|
-
combinedLines_1 += text;
|
|
224
|
-
});
|
|
225
|
-
clickMeServiceContent += combinedLines_1;
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
clickMeServiceContent += 'run;\n%sasjsout(HTML)';
|
|
229
|
-
buildDestinationServicesFolder = process.sasjsConstants.buildDestinationServicesFolder;
|
|
230
|
-
return [4 /*yield*/, (0, utils_1.createFile)(path_1.default.join(buildDestinationServicesFolder, "".concat(fileName, ".sas")), clickMeServiceContent)];
|
|
231
|
-
case 1:
|
|
232
|
-
_a.sent();
|
|
233
|
-
return [2 /*return*/];
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
function createClickMeFile(indexHtmlContent, fileName) {
|
|
239
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
240
|
-
var buildDestinationServicesFolder;
|
|
241
|
-
return __generator(this, function (_a) {
|
|
242
|
-
switch (_a.label) {
|
|
243
|
-
case 0:
|
|
244
|
-
buildDestinationServicesFolder = process.sasjsConstants.buildDestinationServicesFolder;
|
|
245
|
-
return [4 /*yield*/, (0, utils_1.createFile)(path_1.default.join(buildDestinationServicesFolder, "".concat(fileName, ".html")), indexHtmlContent)];
|
|
246
|
-
case 1:
|
|
247
|
-
_a.sent();
|
|
248
|
-
return [2 /*return*/];
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
});
|
|
252
|
-
}
|
package/build/constants.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ var utils_1 = require("./utils");
|
|
|
46
46
|
var utils_2 = require("@sasjs/utils");
|
|
47
47
|
exports.contextName = 'sasjs cli compute context';
|
|
48
48
|
var setConstants = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
49
|
-
var _a, configuration, isLocal, buildOutputFolder, buildResultsFolder, homeDir, buildSourceFolder, buildSourceDbFolder, buildDestinationFolder, buildDestinationServicesFolder, buildDestinationTestFolder, buildDestinationJobsFolder, buildDestinationDbFolder, buildDestinationDocsFolder, macroCorePath, buildDestinationResultsFolder, buildDestinationResultsLogsFolder, sas9CredentialsError, invalidSasError;
|
|
49
|
+
var _a, configuration, isLocal, buildOutputFolder, buildResultsFolder, homeDir, buildSourceFolder, buildSourceDbFolder, buildDestinationFolder, buildDestinationServicesFolder, buildDestinationTestFolder, buildDestinationJobsFolder, buildDestinationDbFolder, buildDestinationDocsFolder, macroCorePath, buildDestinationResultsFolder, buildDestinationResultsLogsFolder, sas9CredentialsError, invalidSasError, sas9GUID;
|
|
50
50
|
var _b, _c;
|
|
51
51
|
return __generator(this, function (_d) {
|
|
52
52
|
switch (_d.label) {
|
|
@@ -79,6 +79,7 @@ var setConstants = function () { return __awaiter(void 0, void 0, void 0, functi
|
|
|
79
79
|
'\n* SAS_PASSWORD' +
|
|
80
80
|
'\nPlease run "sasjs auth" for your specified target to apply the correct credentials.';
|
|
81
81
|
invalidSasError = 'Url specified does not contain a valid sas program. Please provide valid url.';
|
|
82
|
+
sas9GUID = 'pZKd6F95jECvRQlN0LCfdA==';
|
|
82
83
|
process.sasjsConstants = {
|
|
83
84
|
buildSourceFolder: buildSourceFolder,
|
|
84
85
|
buildSourceDbFolder: buildSourceDbFolder,
|
|
@@ -93,7 +94,8 @@ var setConstants = function () { return __awaiter(void 0, void 0, void 0, functi
|
|
|
93
94
|
macroCorePath: macroCorePath,
|
|
94
95
|
contextName: exports.contextName,
|
|
95
96
|
sas9CredentialsError: sas9CredentialsError,
|
|
96
|
-
invalidSasError: invalidSasError
|
|
97
|
+
invalidSasError: invalidSasError,
|
|
98
|
+
sas9GUID: sas9GUID
|
|
97
99
|
};
|
|
98
100
|
return [2 /*return*/];
|
|
99
101
|
}
|
package/package.json
CHANGED