@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.
- package/README.md +0 -3
- package/build/cli.js +4 -4
- package/build/cli.spec.js +6 -6
- package/build/commands/add/addCommand.js +2 -2
- package/build/commands/add/addCredential.js +27 -27
- package/build/commands/add/addTarget.js +10 -10
- package/build/commands/add/internal/input.js +30 -30
- package/build/commands/add/internal/saveConfig.js +2 -2
- package/build/commands/add/spec/addCommand.spec.js +24 -20
- package/build/commands/add/spec/addCredential.spec.js +14 -14
- package/build/commands/add/spec/addTarget.spec.js +22 -22
- package/build/commands/build/build.js +81 -77
- package/build/commands/build/buildCommand.js +3 -3
- package/build/commands/build/compileBuildCommand.js +4 -4
- package/build/commands/build/internal/config.js +8 -8
- package/build/commands/build/internal/getLaunchPageCode.js +2 -2
- package/build/commands/build/spec/build.spec.js +10 -10
- package/build/commands/build/spec/buildCommand.spec.js +16 -12
- package/build/commands/build/spec/cb.spec.server.js +18 -18
- package/build/commands/build/spec/compileBuildCommand.spec.js +17 -13
- package/build/commands/compile/compile.js +61 -61
- package/build/commands/compile/compileCommand.js +10 -10
- package/build/commands/compile/compileSingleFile.js +17 -17
- package/build/commands/compile/internal/checkCompileStatus.js +11 -11
- package/build/commands/compile/internal/compareFolders.js +11 -11
- package/build/commands/compile/internal/compileJobFile.js +3 -3
- package/build/commands/compile/internal/compileServiceFile.js +14 -14
- package/build/commands/compile/internal/compileTestFile.js +41 -37
- package/build/commands/compile/internal/getAllJobFolders.js +13 -9
- package/build/commands/compile/internal/getAllServiceFolders.js +13 -9
- package/build/commands/compile/internal/getServerType.js +1 -1
- package/build/commands/compile/internal/identifySasFile.js +2 -2
- package/build/commands/compile/internal/loadDependencies.js +5 -5
- package/build/commands/compile/internal/spec/compileTestFile.spec.js +40 -40
- package/build/commands/compile/spec/compareFolders.spec.js +27 -27
- package/build/commands/compile/spec/compile.spec.js +93 -93
- package/build/commands/compile/spec/compileCommand.spec.js +37 -33
- package/build/commands/compile/spec/compileJobFile.spec.js +11 -11
- package/build/commands/compile/spec/compileServiceFile.spec.js +11 -11
- package/build/commands/compile/spec/copyFilesToBuildFolder.spec.js +7 -7
- package/build/commands/compile/spec/loadDependencies.spec.js +30 -30
- package/build/commands/context/contextCommand.js +16 -16
- package/build/commands/context/create.js +1 -1
- package/build/commands/context/delete.js +2 -2
- package/build/commands/context/edit.js +1 -1
- package/build/commands/context/export.js +5 -5
- package/build/commands/context/internal/validateConfigPath.js +1 -1
- package/build/commands/context/list.js +4 -4
- package/build/commands/context/spec/contextCommand.spec.js +80 -76
- package/build/commands/context/spec/create.spec.js +3 -3
- package/build/commands/context/spec/delete.spec.js +3 -3
- package/build/commands/context/spec/edit.spec.js +3 -3
- package/build/commands/context/spec/export.spec.js +8 -8
- package/build/commands/context/spec/list.spec.js +5 -5
- package/build/commands/create/create.js +12 -12
- package/build/commands/create/createCommand.js +2 -2
- package/build/commands/create/internal/createReadme.js +2 -2
- package/build/commands/create/spec/create.spec.js +39 -39
- package/build/commands/create/spec/createCommand.spec.js +14 -10
- package/build/commands/db/db.js +22 -22
- package/build/commands/db/dbCommand.js +1 -1
- package/build/commands/db/spec/db.spec.js +8 -8
- package/build/commands/db/spec/dbCommand.spec.js +11 -7
- package/build/commands/deploy/compileBuildDeployCommand.js +6 -6
- package/build/commands/deploy/deploy.d.ts +7 -0
- package/build/commands/deploy/deploy.js +131 -81
- package/build/commands/deploy/deployCommand.js +2 -2
- package/build/commands/deploy/internal/getDeployScripts.js +14 -10
- package/build/commands/deploy/spec/cbd.spec.js +15 -15
- package/build/commands/deploy/spec/cbd.spec.server.js +40 -40
- package/build/commands/deploy/spec/compileBuildDeployCommand.spec.js +18 -14
- package/build/commands/deploy/spec/deployCommand.spec.js +15 -11
- package/build/commands/deploy/spec/getDeployScripts.spec.js +8 -8
- package/build/commands/deploy/spec/utils.js +17 -17
- package/build/commands/docs/docsCommand.js +7 -7
- package/build/commands/docs/generateDocs.js +33 -29
- package/build/commands/docs/generateDot.js +12 -8
- package/build/commands/docs/initDocs.js +1 -1
- package/build/commands/docs/internal/createDotFiles.js +6 -6
- package/build/commands/docs/internal/getDotFileContent.js +17 -17
- package/build/commands/docs/internal/getFileInputs.js +1 -1
- package/build/commands/docs/internal/getFileOutputs.js +1 -1
- package/build/commands/docs/internal/getFoldersForDocs.js +4 -4
- package/build/commands/docs/internal/populateNodeDictionary.js +1 -1
- package/build/commands/docs/spec/docsCommand.spec.js +25 -21
- package/build/commands/docs/spec/generateDocs.spec.js +60 -60
- package/build/commands/docs/spec/generateDot.spec.js +23 -23
- package/build/commands/docs/spec/getDocConfig.spec.js +2 -2
- package/build/commands/docs/spec/initDocs.spec.js +7 -7
- package/build/commands/flow/execute.js +8 -8
- package/build/commands/flow/flowCommand.js +5 -5
- package/build/commands/flow/internal/checkPredecessorDeadlock.js +11 -7
- package/build/commands/flow/internal/executeFlow.js +23 -23
- package/build/commands/flow/internal/failAllSuccessors.js +1 -1
- package/build/commands/flow/internal/generateFileName.js +2 -2
- package/build/commands/flow/internal/normalizeFilePath.js +1 -1
- package/build/commands/flow/internal/parseJobDetails.js +3 -3
- package/build/commands/flow/internal/printError.js +1 -1
- package/build/commands/flow/internal/saveLog.js +8 -8
- package/build/commands/flow/internal/saveToCsv.js +2 -2
- package/build/commands/flow/internal/spec/allFlowsCompleted.spec.js +4 -4
- package/build/commands/flow/internal/spec/checkPredecessorDeadlock.spec.js +4 -4
- package/build/commands/flow/internal/spec/executeFlow.spec.js +10 -10
- package/build/commands/flow/internal/spec/failAllSuccessors.spec.js +1 -1
- package/build/commands/flow/internal/spec/saveToCsv.spec.js +16 -16
- package/build/commands/flow/internal/spec/validateParams.spec.js +33 -33
- package/build/commands/flow/internal/validateParams.js +17 -17
- package/build/commands/flow/spec/flow.spec.js +1 -1
- package/build/commands/flow/spec/flow.spec.server.js +60 -60
- package/build/commands/flow/spec/flowCommand.spec.js +16 -12
- package/build/commands/folder/create.js +2 -2
- package/build/commands/folder/delete.js +2 -2
- package/build/commands/folder/folderCommand.js +11 -11
- package/build/commands/folder/move.js +2 -2
- package/build/commands/folder/spec/folder.spec.server.js +35 -35
- package/build/commands/folder/spec/folderCommand.spec.js +23 -19
- package/build/commands/help/help.js +50 -48
- package/build/commands/help/helpCommand.js +1 -1
- package/build/commands/help/spec/help.spec.js +8 -8
- package/build/commands/help/spec/helpCommand.spec.js +11 -7
- package/build/commands/init/init.js +7 -7
- package/build/commands/init/initCommand.js +1 -1
- package/build/commands/init/spec/init.spec.server.js +17 -17
- package/build/commands/init/spec/initCommand.spec.js +11 -7
- package/build/commands/job/internal/execute/sasjs.js +1 -1
- package/build/commands/job/internal/execute/viya.js +35 -35
- package/build/commands/job/internal/utils.js +6 -6
- package/build/commands/job/jobCommand.js +6 -6
- package/build/commands/job/spec/execute.spec.js +6 -6
- package/build/commands/job/spec/getContextName.spec.js +2 -2
- package/build/commands/job/spec/job.spec.server.js +53 -53
- package/build/commands/job/spec/jobCommand.spec.js +17 -13
- package/build/commands/lint/initLint.js +2 -2
- package/build/commands/lint/lintCommand.js +10 -10
- package/build/commands/lint/processLint.js +5 -5
- package/build/commands/lint/spec/lintCommand.spec.js +19 -15
- package/build/commands/request/request.js +16 -16
- package/build/commands/request/requestCommand.js +5 -5
- package/build/commands/request/spec/request.spec.server.js +71 -71
- package/build/commands/request/spec/requestCommand.spec.js +17 -13
- package/build/commands/run/run.js +23 -23
- package/build/commands/run/runCommand.js +2 -2
- package/build/commands/run/spec/run.spec.server.js +51 -51
- package/build/commands/run/spec/runCommand.spec.js +10 -6
- package/build/commands/servicepack/deploy.js +6 -6
- package/build/commands/servicepack/servicePackCommand.js +3 -3
- package/build/commands/servicepack/spec/servicepack.spec.server.js +6 -6
- package/build/commands/servicepack/spec/servicepackCommand.spec.js +10 -6
- package/build/commands/shared/createConfigFile.js +2 -2
- package/build/commands/shared/createFileStructure.js +6 -6
- package/build/commands/shared/createLintConfigFile.js +1 -1
- package/build/commands/shared/deployToSasViyaWithServicePack.js +4 -4
- package/build/commands/shared/fetchLogFileContent.js +10 -6
- package/build/commands/testing/internal/saveOutput.js +38 -34
- package/build/commands/testing/spec/testCommand.spec.js +17 -13
- package/build/commands/testing/spec/testing.spec.server.js +38 -38
- package/build/commands/testing/test.js +45 -41
- package/build/commands/testing/testCommand.js +2 -2
- package/build/commands/version/spec/version.spec.js +1 -1
- package/build/commands/version/spec/versionCommand.spec.js +11 -7
- package/build/commands/version/version.js +3 -3
- package/build/commands/version/versionCommand.js +2 -2
- package/build/commands/web/internal/createAssetServices.js +28 -24
- package/build/commands/web/internal/getWebServiceContent.js +6 -6
- package/build/commands/web/internal/sasjsout.d.ts +1 -1
- package/build/commands/web/internal/sasjsout.js +1 -1
- package/build/commands/web/internal/spec/updateLinkTag.spec.js +2 -2
- package/build/commands/web/internal/spec/updateScriptTag.spec.js +10 -10
- package/build/commands/web/internal/updateAllTags.js +19 -15
- package/build/commands/web/internal/updateLinkTag.js +2 -2
- package/build/commands/web/internal/updateScriptTag.js +6 -6
- package/build/commands/web/spec/web.spec.js +23 -23
- package/build/commands/web/spec/webCommand.spec.js +16 -12
- package/build/commands/web/web.js +25 -25
- package/build/commands/web/webCommand.js +3 -3
- package/build/types/command/commandBase.js +19 -15
- package/build/types/command/parse.js +1 -1
- package/build/types/command/spec/commandBase.spec.js +16 -12
- package/build/types/command/targetCommand.js +4 -4
- package/build/types/command/unalias.js +9 -5
- package/build/utils/auth.js +7 -7
- package/build/utils/config.js +56 -49
- package/build/utils/displayResult.js +4 -4
- package/build/utils/file.js +11 -11
- package/build/utils/fileStructures/builtFiles.js +2 -2
- package/build/utils/fileStructures/builtFilesCustom1.js +2 -2
- package/build/utils/getLogFilePath.js +1 -1
- package/build/utils/loadEnvVariables.js +3 -3
- package/build/utils/prefixAppLoc.js +1 -1
- package/build/utils/saveLog.js +7 -7
- package/build/utils/setConstants.js +4 -4
- package/build/utils/setProjectDir.js +2 -2
- package/build/utils/spec/config.spec.js +80 -80
- package/build/utils/spec/displayResult.spec.js +7 -7
- package/build/utils/spec/file.spec.js +15 -15
- package/build/utils/spec/removeComments.spec.js +11 -11
- package/build/utils/spec/setConstants.spec.js +3 -3
- package/build/utils/spec/utils.spec.js +55 -55
- package/build/utils/test.js +59 -59
- package/build/utils/utils.js +47 -43
- package/package.json +11 -11
|
@@ -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,
|
|
56
|
-
|
|
57
|
-
|
|
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,7 +76,7 @@ var createAssetServices = function (target, destinationPath, streamConfig) { ret
|
|
|
72
76
|
case 0:
|
|
73
77
|
webSourcePath = streamConfig.webSourcePath, streamWebFolder = streamConfig.streamWebFolder, assetPaths = streamConfig.assetPaths;
|
|
74
78
|
assetPathMap = [];
|
|
75
|
-
return [4 /*yield*/, utils_1.asyncForEach(__spreadArray([path_1.default.join(process.projectDir, webSourcePath)], __read((assetPaths !== null && assetPaths !== void 0 ? assetPaths : []))), function (assetPath) { return __awaiter(void 0, void 0, void 0, function () {
|
|
79
|
+
return [4 /*yield*/, (0, utils_1.asyncForEach)(__spreadArray([path_1.default.join(process.projectDir, webSourcePath)], __read((assetPaths !== null && assetPaths !== void 0 ? assetPaths : [])), false), function (assetPath) { return __awaiter(void 0, void 0, void 0, function () {
|
|
76
80
|
var fullAssetPath, assetPathExists, assetPathMapNested;
|
|
77
81
|
var _a;
|
|
78
82
|
return __generator(this, function (_b) {
|
|
@@ -83,24 +87,24 @@ var createAssetServices = function (target, destinationPath, streamConfig) { ret
|
|
|
83
87
|
: path_1.default.isAbsolute(webSourcePath)
|
|
84
88
|
? path_1.default.join(webSourcePath, assetPath)
|
|
85
89
|
: path_1.default.join(process.projectDir, webSourcePath, assetPath);
|
|
86
|
-
return [4 /*yield*/, utils_1.folderExists(fullAssetPath)];
|
|
90
|
+
return [4 /*yield*/, (0, utils_1.folderExists)(fullAssetPath)];
|
|
87
91
|
case 1:
|
|
88
92
|
assetPathExists = _b.sent();
|
|
89
93
|
if (!assetPathExists) {
|
|
90
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.warn("Assets path '"
|
|
94
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.warn("Assets path '".concat(fullAssetPath, "' present in 'streamConfig' doesn't exist."));
|
|
91
95
|
return [2 /*return*/];
|
|
92
96
|
}
|
|
93
97
|
return [4 /*yield*/, createAssetsServicesNested(target, streamWebFolder, fullAssetPath, destinationPath)];
|
|
94
98
|
case 2:
|
|
95
99
|
assetPathMapNested = _b.sent();
|
|
96
|
-
assetPathMap.push.apply(assetPathMap, __spreadArray([], __read(assetPathMapNested)));
|
|
100
|
+
assetPathMap.push.apply(assetPathMap, __spreadArray([], __read(assetPathMapNested), false));
|
|
97
101
|
return [2 /*return*/];
|
|
98
102
|
}
|
|
99
103
|
});
|
|
100
104
|
}); })];
|
|
101
105
|
case 1:
|
|
102
106
|
_a.sent();
|
|
103
|
-
return [2 /*return*/, lodash_uniqby_1.default(assetPathMap, 'source')];
|
|
107
|
+
return [2 /*return*/, (0, lodash_uniqby_1.default)(assetPathMap, 'source')];
|
|
104
108
|
}
|
|
105
109
|
});
|
|
106
110
|
}); };
|
|
@@ -111,10 +115,10 @@ var createAssetsServicesNested = function (target, streamWebFolder, fullAssetPat
|
|
|
111
115
|
switch (_a.label) {
|
|
112
116
|
case 0:
|
|
113
117
|
assetPathMap = [];
|
|
114
|
-
return [4 /*yield*/, utils_1.listFilesInFolder(fullAssetPath)];
|
|
118
|
+
return [4 /*yield*/, (0, utils_1.listFilesInFolder)(fullAssetPath)];
|
|
115
119
|
case 1:
|
|
116
120
|
filePaths = _a.sent();
|
|
117
|
-
return [4 /*yield*/, utils_1.asyncForEach(filePaths, function (filePath) { return __awaiter(void 0, void 0, void 0, function () {
|
|
121
|
+
return [4 /*yield*/, (0, utils_1.asyncForEach)(filePaths, function (filePath) { return __awaiter(void 0, void 0, void 0, function () {
|
|
118
122
|
var fullFileName, fileName, fileExtension, sourcePath, assetServiceUrl, fileName_1, assetServiceUrl;
|
|
119
123
|
return __generator(this, function (_a) {
|
|
120
124
|
switch (_a.label) {
|
|
@@ -127,7 +131,7 @@ var createAssetsServicesNested = function (target, streamWebFolder, fullAssetPat
|
|
|
127
131
|
if (!(fileName && fileExtension)) return [3 /*break*/, 4];
|
|
128
132
|
sourcePath = path_1.default.join(fullAssetPath, filePath);
|
|
129
133
|
if (!(target.serverType === utils_1.ServerType.SasViya)) return [3 /*break*/, 2];
|
|
130
|
-
return [4 /*yield*/, utils_1.copy(sourcePath, path_1.default.join(destinationPath, fullFileName))];
|
|
134
|
+
return [4 /*yield*/, (0, utils_1.copy)(sourcePath, path_1.default.join(destinationPath, fullFileName))];
|
|
131
135
|
case 1:
|
|
132
136
|
_a.sent();
|
|
133
137
|
assetServiceUrl = getAssetPath(target.appLoc, target.serverType, streamWebFolder, fullFileName);
|
|
@@ -151,25 +155,25 @@ var createAssetsServicesNested = function (target, streamWebFolder, fullAssetPat
|
|
|
151
155
|
}); })];
|
|
152
156
|
case 2:
|
|
153
157
|
_a.sent();
|
|
154
|
-
return [4 /*yield*/, utils_1.listSubFoldersInFolder(fullAssetPath)];
|
|
158
|
+
return [4 /*yield*/, (0, utils_1.listSubFoldersInFolder)(fullAssetPath)];
|
|
155
159
|
case 3:
|
|
156
160
|
folderNames = _a.sent();
|
|
157
|
-
return [4 /*yield*/, utils_1.asyncForEach(folderNames, function (folderName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
161
|
+
return [4 /*yield*/, (0, utils_1.asyncForEach)(folderNames, function (folderName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
158
162
|
var destinationPathNested, fullAssetPathNested, assetFolderMap;
|
|
159
163
|
return __generator(this, function (_a) {
|
|
160
164
|
switch (_a.label) {
|
|
161
165
|
case 0:
|
|
162
166
|
destinationPathNested = path_1.default.join(destinationPath, folderName);
|
|
163
167
|
fullAssetPathNested = path_1.default.join(fullAssetPath, folderName);
|
|
164
|
-
return [4 /*yield*/, utils_1.createFolder(destinationPathNested)];
|
|
168
|
+
return [4 /*yield*/, (0, utils_1.createFolder)(destinationPathNested)];
|
|
165
169
|
case 1:
|
|
166
170
|
_a.sent();
|
|
167
|
-
return [4 /*yield*/, createAssetsServicesNested(target, streamWebFolder
|
|
171
|
+
return [4 /*yield*/, createAssetsServicesNested(target, "".concat(streamWebFolder, "/").concat(folderName), fullAssetPathNested, destinationPathNested)];
|
|
168
172
|
case 2:
|
|
169
173
|
assetFolderMap = _a.sent();
|
|
170
174
|
assetFolderMap.forEach(function (entry) {
|
|
171
175
|
assetPathMap.push({
|
|
172
|
-
source: folderName
|
|
176
|
+
source: "".concat(folderName, "/").concat(entry.source),
|
|
173
177
|
target: entry.target
|
|
174
178
|
});
|
|
175
179
|
});
|
|
@@ -193,16 +197,16 @@ var generateAssetService = function (sourcePath, filePath, destinationPath, serv
|
|
|
193
197
|
fileName = path_1.default
|
|
194
198
|
.basename(filePath)
|
|
195
199
|
.replace(new RegExp(fileExtension + '$'), fileExtension.replace('.', '-'));
|
|
196
|
-
return [4 /*yield*/, utils_1.base64EncodeFile(sourcePath)];
|
|
200
|
+
return [4 /*yield*/, (0, utils_1.base64EncodeFile)(sourcePath)];
|
|
197
201
|
case 1:
|
|
198
202
|
base64string = _a.sent();
|
|
199
|
-
return [4 /*yield*/, getWebServiceContent_1.getWebServiceContent(base64string, fileType, serverType)];
|
|
203
|
+
return [4 /*yield*/, (0, getWebServiceContent_1.getWebServiceContent)(base64string, fileType, serverType)];
|
|
200
204
|
case 2:
|
|
201
205
|
serviceContent = _a.sent();
|
|
202
|
-
return [4 /*yield*/, utils_1.createFile(path_1.default.join(destinationPath, fileName
|
|
206
|
+
return [4 /*yield*/, (0, utils_1.createFile)(path_1.default.join(destinationPath, "".concat(fileName, ".sas")), serviceContent)];
|
|
203
207
|
case 3:
|
|
204
208
|
_a.sent();
|
|
205
|
-
return [2 /*return*/, fileName
|
|
209
|
+
return [2 /*return*/, "".concat(fileName, ".sas")];
|
|
206
210
|
}
|
|
207
211
|
});
|
|
208
212
|
}); };
|
|
@@ -213,7 +217,7 @@ var getAssetPath = function (appLoc, serverType, streamWebFolder, fileName) {
|
|
|
213
217
|
// for SAS 9 fileName is a program, with replacement in sasjsout.ts
|
|
214
218
|
// for Viya, fileName is a FILE, with replacement in build.sas only
|
|
215
219
|
serverType === utils_1.ServerType.SasViya
|
|
216
|
-
? "/SASJobExecution?_FILE="
|
|
217
|
-
: "/SASStoredProcess/?_PROGRAM=///"
|
|
218
|
-
return storedProcessPath
|
|
220
|
+
? "/SASJobExecution?_FILE=".concat(appLoc, "/services/").concat(streamWebFolder)
|
|
221
|
+
: "/SASStoredProcess/?_PROGRAM=///".concat(streamWebFolder);
|
|
222
|
+
return "".concat(storedProcessPath, "/").concat(fileName);
|
|
219
223
|
};
|
|
@@ -49,16 +49,16 @@ var getWebServiceContent = function (contentBase64, type, serverType) {
|
|
|
49
49
|
JS: 'JS64',
|
|
50
50
|
CSS: 'CSS64'
|
|
51
51
|
};
|
|
52
|
-
serviceContent = sasjsout_1.sasjsout
|
|
52
|
+
serviceContent = "".concat(sasjsout_1.sasjsout, "\nfilename sasjs temp lrecl=99999999;\ndata _null_;\nfile sasjs;\n");
|
|
53
53
|
lines.forEach(function (line) {
|
|
54
|
-
var chunkedLines = utils_1.chunk(line);
|
|
54
|
+
var chunkedLines = (0, utils_1.chunk)(line);
|
|
55
55
|
if (chunkedLines.length === 1) {
|
|
56
|
-
serviceContent += "put '"
|
|
56
|
+
serviceContent += "put '".concat(chunkedLines[0].split("'").join("''"), "';\n");
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
59
59
|
var combinedLines_1 = '';
|
|
60
60
|
chunkedLines.forEach(function (chunkedLine, index) {
|
|
61
|
-
var text = "put '"
|
|
61
|
+
var text = "put '".concat(chunkedLine.split("'").join("''"), "'");
|
|
62
62
|
if (index !== chunkedLines.length - 1) {
|
|
63
63
|
text += '@;\n';
|
|
64
64
|
}
|
|
@@ -71,10 +71,10 @@ var getWebServiceContent = function (contentBase64, type, serverType) {
|
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
if (serverType === utils_1.ServerType.Sas9 && typesToEncode.hasOwnProperty(type)) {
|
|
74
|
-
serviceContent += "\nrun;\n%sasjsout("
|
|
74
|
+
serviceContent += "\nrun;\n%sasjsout(".concat(typesToEncode[type], ")");
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
|
-
serviceContent += "\nrun;\n%sasjsout("
|
|
77
|
+
serviceContent += "\nrun;\n%sasjsout(".concat(type, ")");
|
|
78
78
|
}
|
|
79
79
|
return [2 /*return*/, serviceContent];
|
|
80
80
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const sasjsout = "\n%macro sasjsout(type,fref=sasjs);\n%global sysprocessmode SYS_JES_JOB_URI;\n%if \"&sysprocessmode\"=\"SAS Compute Server\" %then %do;\n %if &type=HTML %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name=\"_webout.json\"\n contenttype=\"text/html\";\n %end;\n %else %if &type=JS or &type=JS64 %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.js'\n contenttype='application/javascript';\n %end;\n %else %if &type=CSS or &type=CSS64 %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.css'\n contenttype='text/css';\n %end;\n %else %if &type=PNG %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\"
|
|
1
|
+
export declare const sasjsout = "\n%macro sasjsout(type,fref=sasjs);\n%global sysprocessmode SYS_JES_JOB_URI;\n%if \"&sysprocessmode\"=\"SAS Compute Server\" %then %do;\n %if &type=HTML %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name=\"_webout.json\"\n contenttype=\"text/html\";\n %end;\n %else %if &type=JS or &type=JS64 %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.js'\n contenttype='application/javascript';\n %end;\n %else %if &type=CSS or &type=CSS64 %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.css'\n contenttype='text/css';\n %end;\n %else %if &type=PNG or &type=GIF or &type=JPEG or &type=JPG %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\"\n name=\"_webout.%lowcase(&type)\"\n contenttype=\"image/%lowcase(&type)\" lrecl=2000000 recfm=n;\n %end;\n %else %if &type=ICO %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.ico'\n contenttype='image/vnd.microsoft.icon' lrecl=2000000 recfm=n;\n %end;\n %else %if &type=JSON %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.json'\n contenttype='application/json' lrecl=2000000 recfm=n;\n %end;\n %else %if &type=MP3 %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.mp3'\n contenttype='audio/mpeg' lrecl=2000000 recfm=n;\n %end;\n %else %if &type=WAV %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.wav'\n contenttype='audio/x-wav' lrecl=2000000 recfm=n;\n %end;\n %else %if &type=OGG %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.ogg'\n contenttype='audio/ogg' lrecl=2000000 recfm=n;\n %end;\n %else %if &type=WOFF or &type=WOFF2 or &type=TTF %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\"\n contenttype=\"font/%lowcase(&type)\";\n %end;\n %else %if &type=MP4 %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\"\n contenttype=\"video/mp4\";\n %end;\n%end;\n%else %do;\n %if &type=JS or &type=JS64 %then %do;\n %let rc=%sysfunc(stpsrv_header(\n Content-type,application/javascript%str(;)charset=UTF-8\n ));\n %end;\n %else %if &type=CSS or &type=CSS64 %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,text/css));\n %end;\n %else %if &type=PNG or &type=GIF or &type=JPEG or &type=JPG %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,image/%lowcase(&type)));\n %end;\n %else %if &type=ICO %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,image/vnd.microsoft.icon));\n %end;\n %else %if &type=JSON %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,application/json));\n %end;\n %else %if &type=MP3 %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,audio/mpeg));\n %end;\n %else %if &type=WAV %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,audio/x-wav));\n %end;\n %else %if &type=OGG %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,audio/ogg));\n %end;\n %else %if &type=WOFF or &type=WOFF2 or &type=TTF %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,font/%lowcase(&type)));\n %end;\n %else %if &type=MP4 %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,video/mp4));\n %end;\n%end;\n%if &type=HTML %then %do;\n /*\n We need to perform some substitutions -eg to get the APPLOC and SERVERTYPE.\n Therefore the developer should avoid writing lines that exceed 32k\n characters (eg base64 encoded images) as they will get truncated when passing\n through the datastep. This could of course be re-written using LUA, removing\n the length restriction. Pull requests are welcome!\n */\n filename _sjs temp;\n data _null_;\n file _sjs lrecl=32767 encoding='utf-8';\n infile &fref lrecl=32767;\n input;\n length appLoc expanded_path $1048;\n if _n_=1 then do;\n retain pgm \"&_program\" appLoc expanded_path;\n /* index is deployed in the /services/ folder under the appLoc */\n appLoc=substr(pgm,1,find(pgm,'/services/')-1);\n expanded_path=cats('?_PROGRAM=',appLoc,'/services/');\n end;\n if find(_infile_,' appLoc: ') then put ' appLoc: ' apploc:$quote1048. ',';\n else if find(_infile_,' serverType: ') then do;\n if symexist('_metaperson') then put ' serverType: \"SAS9\" ,';\n else put ' serverType: \"SASVIYA\" ,';\n end;\n else if find(_infile_,' hostUrl: ') then do;\n /* nothing - we are streaming, so remove to default as hostname */\n end;\n else do;\n length newline $32767;\n /* during SAS9 compilation, dependencies are assigned three slashes /// */\n newline=tranwrd(_infile_,'?_PROGRAM=///',cats(expanded_path));\n put newline;\n end;\n run;\n %let fref=_sjs;\n%end;\n\n/**\n * In SAS9, JS & CSS files are base64 encoded to avoid UTF8 issues in WLATIN1\n * metadata - so in this case, decode and stream byte by byte.\n * */\n%if &type=GIF or &type=PNG or &type=JPG or &type=JPEG or &type=ICO or &type=MP3\nor &type=JS64 or &type=CSS64 or &type=WAV or &type=OGG or &type=WOFF\nor &type=WOFF2 or &type=TTF or &type=MP4\n%then %do;\n data _null_;\n length filein 8 fileout 8;\n filein = fopen(\"&fref\",'I',4,'B');\n fileout = fopen(\"_webout\",'A',1,'B');\n char= '20'x;\n do while(fread(filein)=0);\n length raw $4 ;\n do i=1 to 4;\n rc=fget(filein,char,1);\n substr(raw,i,1)=char;\n end;\n rc = fput(fileout, input(raw,$base64X4.));\n rc =fwrite(fileout);\n end;\n rc = fclose(filein);\n rc = fclose(fileout);\n run;\n%end;\n%else %do;\n data _null_;\n length filein 8 fileid 8;\n filein = fopen(\"&fref\",'I',1,'B');\n fileid = fopen(\"_webout\",'A',1,'B');\n rec = '20'x;\n do while(fread(filein)=0);\n rc = fget(filein,rec,1);\n rc = fput(fileid, rec);\n rc =fwrite(fileid);\n end;\n rc = fclose(filein);\n rc = fclose(fileid);\n run;\n%end;\n%mend;";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sasjsout = void 0;
|
|
4
|
-
exports.sasjsout = "\n%macro sasjsout(type,fref=sasjs);\n%global sysprocessmode SYS_JES_JOB_URI;\n%if \"&sysprocessmode\"=\"SAS Compute Server\" %then %do;\n %if &type=HTML %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name=\"_webout.json\"\n contenttype=\"text/html\";\n %end;\n %else %if &type=JS or &type=JS64 %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.js'\n contenttype='application/javascript';\n %end;\n %else %if &type=CSS or &type=CSS64 %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.css'\n contenttype='text/css';\n %end;\n %else %if &type=PNG %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\"
|
|
4
|
+
exports.sasjsout = "\n%macro sasjsout(type,fref=sasjs);\n%global sysprocessmode SYS_JES_JOB_URI;\n%if \"&sysprocessmode\"=\"SAS Compute Server\" %then %do;\n %if &type=HTML %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name=\"_webout.json\"\n contenttype=\"text/html\";\n %end;\n %else %if &type=JS or &type=JS64 %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.js'\n contenttype='application/javascript';\n %end;\n %else %if &type=CSS or &type=CSS64 %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.css'\n contenttype='text/css';\n %end;\n %else %if &type=PNG or &type=GIF or &type=JPEG or &type=JPG %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\"\n name=\"_webout.%lowcase(&type)\"\n contenttype=\"image/%lowcase(&type)\" lrecl=2000000 recfm=n;\n %end;\n %else %if &type=ICO %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.ico'\n contenttype='image/vnd.microsoft.icon' lrecl=2000000 recfm=n;\n %end;\n %else %if &type=JSON %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.json'\n contenttype='application/json' lrecl=2000000 recfm=n;\n %end;\n %else %if &type=MP3 %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.mp3'\n contenttype='audio/mpeg' lrecl=2000000 recfm=n;\n %end;\n %else %if &type=WAV %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.wav'\n contenttype='audio/x-wav' lrecl=2000000 recfm=n;\n %end;\n %else %if &type=OGG %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.ogg'\n contenttype='audio/ogg' lrecl=2000000 recfm=n;\n %end;\n %else %if &type=WOFF or &type=WOFF2 or &type=TTF %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\"\n contenttype=\"font/%lowcase(&type)\";\n %end;\n %else %if &type=MP4 %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\"\n contenttype=\"video/mp4\";\n %end;\n%end;\n%else %do;\n %if &type=JS or &type=JS64 %then %do;\n %let rc=%sysfunc(stpsrv_header(\n Content-type,application/javascript%str(;)charset=UTF-8\n ));\n %end;\n %else %if &type=CSS or &type=CSS64 %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,text/css));\n %end;\n %else %if &type=PNG or &type=GIF or &type=JPEG or &type=JPG %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,image/%lowcase(&type)));\n %end;\n %else %if &type=ICO %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,image/vnd.microsoft.icon));\n %end;\n %else %if &type=JSON %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,application/json));\n %end;\n %else %if &type=MP3 %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,audio/mpeg));\n %end;\n %else %if &type=WAV %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,audio/x-wav));\n %end;\n %else %if &type=OGG %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,audio/ogg));\n %end;\n %else %if &type=WOFF or &type=WOFF2 or &type=TTF %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,font/%lowcase(&type)));\n %end;\n %else %if &type=MP4 %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,video/mp4));\n %end;\n%end;\n%if &type=HTML %then %do;\n /*\n We need to perform some substitutions -eg to get the APPLOC and SERVERTYPE.\n Therefore the developer should avoid writing lines that exceed 32k\n characters (eg base64 encoded images) as they will get truncated when passing\n through the datastep. This could of course be re-written using LUA, removing\n the length restriction. Pull requests are welcome!\n */\n filename _sjs temp;\n data _null_;\n file _sjs lrecl=32767 encoding='utf-8';\n infile &fref lrecl=32767;\n input;\n length appLoc expanded_path $1048;\n if _n_=1 then do;\n retain pgm \"&_program\" appLoc expanded_path;\n /* index is deployed in the /services/ folder under the appLoc */\n appLoc=substr(pgm,1,find(pgm,'/services/')-1);\n expanded_path=cats('?_PROGRAM=',appLoc,'/services/');\n end;\n if find(_infile_,' appLoc: ') then put ' appLoc: ' apploc:$quote1048. ',';\n else if find(_infile_,' serverType: ') then do;\n if symexist('_metaperson') then put ' serverType: \"SAS9\" ,';\n else put ' serverType: \"SASVIYA\" ,';\n end;\n else if find(_infile_,' hostUrl: ') then do;\n /* nothing - we are streaming, so remove to default as hostname */\n end;\n else do;\n length newline $32767;\n /* during SAS9 compilation, dependencies are assigned three slashes /// */\n newline=tranwrd(_infile_,'?_PROGRAM=///',cats(expanded_path));\n put newline;\n end;\n run;\n %let fref=_sjs;\n%end;\n\n/**\n * In SAS9, JS & CSS files are base64 encoded to avoid UTF8 issues in WLATIN1\n * metadata - so in this case, decode and stream byte by byte.\n * */\n%if &type=GIF or &type=PNG or &type=JPG or &type=JPEG or &type=ICO or &type=MP3\nor &type=JS64 or &type=CSS64 or &type=WAV or &type=OGG or &type=WOFF\nor &type=WOFF2 or &type=TTF or &type=MP4\n%then %do;\n data _null_;\n length filein 8 fileout 8;\n filein = fopen(\"&fref\",'I',4,'B');\n fileout = fopen(\"_webout\",'A',1,'B');\n char= '20'x;\n do while(fread(filein)=0);\n length raw $4 ;\n do i=1 to 4;\n rc=fget(filein,char,1);\n substr(raw,i,1)=char;\n end;\n rc = fput(fileout, input(raw,$base64X4.));\n rc =fwrite(fileout);\n end;\n rc = fclose(filein);\n rc = fclose(fileout);\n run;\n%end;\n%else %do;\n data _null_;\n length filein 8 fileid 8;\n filein = fopen(\"&fref\",'I',1,'B');\n fileid = fopen(\"_webout\",'A',1,'B');\n rec = '20'x;\n do while(fread(filein)=0);\n rc = fget(filein,rec,1);\n rc = fput(fileid, rec);\n rc =fwrite(fileid);\n end;\n rc = fclose(filein);\n rc = fclose(fileid);\n run;\n%end;\n%mend;";
|
|
@@ -14,7 +14,7 @@ describe('updateLinkTag', function () {
|
|
|
14
14
|
source: 'style.css',
|
|
15
15
|
target: sasProgramPath
|
|
16
16
|
});
|
|
17
|
-
updateLinkTag_1.updateLinkTag(linkTag, assetPathMap);
|
|
17
|
+
(0, updateLinkTag_1.updateLinkTag)(linkTag, assetPathMap);
|
|
18
18
|
expect(linkTag.getAttribute('href')).toEqual(sasProgramPath);
|
|
19
19
|
});
|
|
20
20
|
it("should update src of image tag", function () {
|
|
@@ -26,7 +26,7 @@ describe('updateLinkTag', function () {
|
|
|
26
26
|
source: 'image.jpeg',
|
|
27
27
|
target: sasProgramPath
|
|
28
28
|
});
|
|
29
|
-
updateLinkTag_1.updateLinkTag(imgTag, assetPathMap, 'image');
|
|
29
|
+
(0, updateLinkTag_1.updateLinkTag)(imgTag, assetPathMap, 'image');
|
|
30
30
|
expect(imgTag.getAttribute('src')).toEqual(sasProgramPath);
|
|
31
31
|
});
|
|
32
32
|
});
|
|
@@ -52,12 +52,12 @@ describe('updateScriptTag', function () {
|
|
|
52
52
|
return __generator(this, function (_a) {
|
|
53
53
|
switch (_a.label) {
|
|
54
54
|
case 0:
|
|
55
|
-
destinationPath = path_1.default.join(__dirname, "cli-test-web-updateScriptTag-"
|
|
56
|
-
return [4 /*yield*/, utils_1.createFolder(destinationPath)];
|
|
55
|
+
destinationPath = path_1.default.join(__dirname, "cli-test-web-updateScriptTag-".concat((0, utils_1.generateTimestamp)()));
|
|
56
|
+
return [4 /*yield*/, (0, utils_1.createFolder)(destinationPath)];
|
|
57
57
|
case 1:
|
|
58
58
|
_a.sent();
|
|
59
59
|
process.projectDir = destinationPath;
|
|
60
|
-
return [4 /*yield*/, utils_2.setConstants()];
|
|
60
|
+
return [4 /*yield*/, (0, utils_2.setConstants)()];
|
|
61
61
|
case 2:
|
|
62
62
|
_a.sent();
|
|
63
63
|
return [2 /*return*/];
|
|
@@ -67,7 +67,7 @@ describe('updateScriptTag', function () {
|
|
|
67
67
|
afterAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
68
68
|
return __generator(this, function (_a) {
|
|
69
69
|
switch (_a.label) {
|
|
70
|
-
case 0: return [4 /*yield*/, utils_1.deleteFolder(destinationPath)];
|
|
70
|
+
case 0: return [4 /*yield*/, (0, utils_1.deleteFolder)(destinationPath)];
|
|
71
71
|
case 1:
|
|
72
72
|
_a.sent();
|
|
73
73
|
return [2 /*return*/];
|
|
@@ -92,14 +92,14 @@ describe('updateScriptTag', function () {
|
|
|
92
92
|
source: script1Filename,
|
|
93
93
|
target: sasProgramScript1Path
|
|
94
94
|
});
|
|
95
|
-
return [4 /*yield*/, updateScriptTag_1.updateScriptTag(scriptTag, sourcePath, destinationPath, target.serverType, assetPathMap)];
|
|
95
|
+
return [4 /*yield*/, (0, updateScriptTag_1.updateScriptTag)(scriptTag, sourcePath, destinationPath, target.serverType, assetPathMap)];
|
|
96
96
|
case 1:
|
|
97
97
|
_a.sent();
|
|
98
98
|
expect(scriptTag.getAttribute('src')).toEqual(sasProgramScript1Path);
|
|
99
|
-
return [4 /*yield*/, utils_1.readFile(sasProgramScript1Path)];
|
|
99
|
+
return [4 /*yield*/, (0, utils_1.readFile)(sasProgramScript1Path)];
|
|
100
100
|
case 2:
|
|
101
101
|
content1 = _a.sent();
|
|
102
|
-
expect(content1).toEqual(expect.stringContaining("put '"
|
|
102
|
+
expect(content1).toEqual(expect.stringContaining("put '".concat(script1Base64)));
|
|
103
103
|
script2Filename = './script2.js';
|
|
104
104
|
script2SASProgramName = 'script2-js.sas';
|
|
105
105
|
script2Base64 = "O1snxKYnLCAnxpUnLCAn0qInLCAn0ronLCAn04cnLCAn1IonXQ";
|
|
@@ -109,14 +109,14 @@ describe('updateScriptTag', function () {
|
|
|
109
109
|
source: script2Filename,
|
|
110
110
|
target: sasProgramScript2Path
|
|
111
111
|
});
|
|
112
|
-
return [4 /*yield*/, updateScriptTag_1.updateScriptTag(scriptTag, sourcePath, destinationPath, target.serverType, assetPathMap)];
|
|
112
|
+
return [4 /*yield*/, (0, updateScriptTag_1.updateScriptTag)(scriptTag, sourcePath, destinationPath, target.serverType, assetPathMap)];
|
|
113
113
|
case 3:
|
|
114
114
|
_a.sent();
|
|
115
115
|
expect(scriptTag.getAttribute('src')).toEqual(sasProgramScript2Path);
|
|
116
|
-
return [4 /*yield*/, utils_1.readFile(sasProgramScript2Path)];
|
|
116
|
+
return [4 /*yield*/, (0, utils_1.readFile)(sasProgramScript2Path)];
|
|
117
117
|
case 4:
|
|
118
118
|
content2 = _a.sent();
|
|
119
|
-
expect(content2).toEqual(expect.stringContaining("put '"
|
|
119
|
+
expect(content2).toEqual(expect.stringContaining("put '".concat(script2Base64)));
|
|
120
120
|
return [2 /*return*/];
|
|
121
121
|
}
|
|
122
122
|
});
|
|
@@ -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,
|
|
56
|
-
|
|
57
|
-
|
|
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
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
64
|
exports.updateAllTags = void 0;
|
|
@@ -70,11 +74,11 @@ var updateAllTags = function (parsedHtml, _a) {
|
|
|
70
74
|
switch (_b.label) {
|
|
71
75
|
case 0:
|
|
72
76
|
assetsNotFound = [];
|
|
73
|
-
scriptTags = getTags_1.getScriptTags(parsedHtml);
|
|
74
|
-
return [4 /*yield*/, utils_1.asyncForEach(scriptTags, function (tag) { return __awaiter(void 0, void 0, void 0, function () {
|
|
77
|
+
scriptTags = (0, getTags_1.getScriptTags)(parsedHtml);
|
|
78
|
+
return [4 /*yield*/, (0, utils_1.asyncForEach)(scriptTags, function (tag) { return __awaiter(void 0, void 0, void 0, function () {
|
|
75
79
|
return __generator(this, function (_a) {
|
|
76
80
|
switch (_a.label) {
|
|
77
|
-
case 0: return [4 /*yield*/, updateScriptTag_1.updateScriptTag(tag, webSourcePathFull, destinationPath, serverType, assetPathMap).catch(function (e) { return assetsNotFound.push(e); })];
|
|
81
|
+
case 0: return [4 /*yield*/, (0, updateScriptTag_1.updateScriptTag)(tag, webSourcePathFull, destinationPath, serverType, assetPathMap).catch(function (e) { return assetsNotFound.push(e); })];
|
|
78
82
|
case 1:
|
|
79
83
|
_a.sent();
|
|
80
84
|
return [2 /*return*/];
|
|
@@ -83,22 +87,22 @@ var updateAllTags = function (parsedHtml, _a) {
|
|
|
83
87
|
}); })];
|
|
84
88
|
case 1:
|
|
85
89
|
_b.sent();
|
|
86
|
-
styleTags = getTags_1.getStyleTags(parsedHtml);
|
|
87
|
-
faviconTags = getTags_1.getFaviconTags(parsedHtml);
|
|
88
|
-
linkTags = __spreadArray(__spreadArray([], __read(styleTags)), __read(faviconTags));
|
|
90
|
+
styleTags = (0, getTags_1.getStyleTags)(parsedHtml);
|
|
91
|
+
faviconTags = (0, getTags_1.getFaviconTags)(parsedHtml);
|
|
92
|
+
linkTags = __spreadArray(__spreadArray([], __read(styleTags), false), __read(faviconTags), false);
|
|
89
93
|
linkTags.forEach(function (tag) {
|
|
90
94
|
try {
|
|
91
|
-
updateLinkTag_1.updateLinkTag(tag, assetPathMap);
|
|
95
|
+
(0, updateLinkTag_1.updateLinkTag)(tag, assetPathMap);
|
|
92
96
|
}
|
|
93
97
|
catch (error) {
|
|
94
98
|
console.log(tag, error);
|
|
95
99
|
assetsNotFound.push(error);
|
|
96
100
|
}
|
|
97
101
|
});
|
|
98
|
-
imgTags = getTags_1.getImgTags(parsedHtml);
|
|
102
|
+
imgTags = (0, getTags_1.getImgTags)(parsedHtml);
|
|
99
103
|
imgTags.forEach(function (tag) {
|
|
100
104
|
try {
|
|
101
|
-
updateLinkTag_1.updateLinkTag(tag, assetPathMap, 'image');
|
|
105
|
+
(0, updateLinkTag_1.updateLinkTag)(tag, assetPathMap, 'image');
|
|
102
106
|
}
|
|
103
107
|
catch (error) {
|
|
104
108
|
console.log(tag, error);
|
|
@@ -107,9 +111,9 @@ var updateAllTags = function (parsedHtml, _a) {
|
|
|
107
111
|
});
|
|
108
112
|
if (assetsNotFound.length) {
|
|
109
113
|
notFoundErrors = assetsNotFound
|
|
110
|
-
.map(function (e) { return "- "
|
|
114
|
+
.map(function (e) { return "- ".concat(e.message, "\n"); })
|
|
111
115
|
.join('');
|
|
112
|
-
throw new Error("Error(s) while preparing stream app:\n"
|
|
116
|
+
throw new Error("Error(s) while preparing stream app:\n".concat(notFoundErrors));
|
|
113
117
|
}
|
|
114
118
|
return [2 /*return*/];
|
|
115
119
|
}
|
|
@@ -12,10 +12,10 @@ var updateLinkTag = function (linkTag, assetPathMap, tagType) {
|
|
|
12
12
|
if (isUrl)
|
|
13
13
|
return;
|
|
14
14
|
var assetPath = assetPathMap.find(function (entry) {
|
|
15
|
-
return entry.source === linkSourcePath || "./"
|
|
15
|
+
return entry.source === linkSourcePath || "./".concat(entry.source) === linkSourcePath;
|
|
16
16
|
});
|
|
17
17
|
if (!(assetPath === null || assetPath === void 0 ? void 0 : assetPath.target)) {
|
|
18
|
-
throw new Error("Unable to find file: "
|
|
18
|
+
throw new Error("Unable to find file: ".concat(linkSourcePath));
|
|
19
19
|
}
|
|
20
20
|
tagType === 'link'
|
|
21
21
|
? linkTag.setAttribute('href', assetPath.target)
|
|
@@ -53,8 +53,8 @@ var updateScriptTag = function (tag, webSourcePathFull, destinationPath, serverT
|
|
|
53
53
|
isUrl = scriptPath && (scriptPath.startsWith('http') || scriptPath.startsWith('//'));
|
|
54
54
|
if (!scriptPath) return [3 /*break*/, 7];
|
|
55
55
|
if (!!isUrl) return [3 /*break*/, 7];
|
|
56
|
-
return [4 /*yield*/, utils_1.readFile(path_1.default.join(webSourcePathFull, scriptPath)).catch(function (_) {
|
|
57
|
-
throw new Error("Unable to find file: "
|
|
56
|
+
return [4 /*yield*/, (0, utils_1.readFile)(path_1.default.join(webSourcePathFull, scriptPath)).catch(function (_) {
|
|
57
|
+
throw new Error("Unable to find file: ".concat(scriptPath));
|
|
58
58
|
})];
|
|
59
59
|
case 1:
|
|
60
60
|
content_1 = _a.sent();
|
|
@@ -62,20 +62,20 @@ var updateScriptTag = function (tag, webSourcePathFull, destinationPath, serverT
|
|
|
62
62
|
content_1 = content_1.replace(new RegExp(pathEntry.source, 'g'), pathEntry.target);
|
|
63
63
|
});
|
|
64
64
|
if (!(serverType === utils_1.ServerType.SasViya)) return [3 /*break*/, 3];
|
|
65
|
-
return [4 /*yield*/, utils_1.createFile(path_1.default.join(destinationPath, scriptPath), content_1)];
|
|
65
|
+
return [4 /*yield*/, (0, utils_1.createFile)(path_1.default.join(destinationPath, scriptPath), content_1)];
|
|
66
66
|
case 2:
|
|
67
67
|
_a.sent();
|
|
68
68
|
return [3 /*break*/, 6];
|
|
69
|
-
case 3: return [4 /*yield*/, getWebServiceContent_1.getWebServiceContent(js_base64_1.encode(content_1), 'JS', serverType)];
|
|
69
|
+
case 3: return [4 /*yield*/, (0, getWebServiceContent_1.getWebServiceContent)((0, js_base64_1.encode)(content_1), 'JS', serverType)];
|
|
70
70
|
case 4:
|
|
71
71
|
serviceContent = _a.sent();
|
|
72
|
-
return [4 /*yield*/, utils_1.createFile(path_1.default.join(destinationPath, scriptPath.replace(/\.js$/, '-js')
|
|
72
|
+
return [4 /*yield*/, (0, utils_1.createFile)(path_1.default.join(destinationPath, "".concat(scriptPath.replace(/\.js$/, '-js'), ".sas")), serviceContent)];
|
|
73
73
|
case 5:
|
|
74
74
|
_a.sent();
|
|
75
75
|
_a.label = 6;
|
|
76
76
|
case 6:
|
|
77
77
|
tag.setAttribute('src', assetPathMap.find(function (entry) {
|
|
78
|
-
return entry.source === scriptPath || "./"
|
|
78
|
+
return entry.source === scriptPath || "./".concat(entry.source) === scriptPath;
|
|
79
79
|
}).target);
|
|
80
80
|
_a.label = 7;
|
|
81
81
|
case 7: return [2 /*return*/];
|
|
@@ -63,7 +63,7 @@ var webBuiltFilesSASVIYA = function (indexHtml) {
|
|
|
63
63
|
subFolders: [
|
|
64
64
|
{
|
|
65
65
|
folderName: 'services',
|
|
66
|
-
files: [{ fileName: indexHtml
|
|
66
|
+
files: [{ fileName: "".concat(indexHtml, ".html") }],
|
|
67
67
|
subFolders: [
|
|
68
68
|
{
|
|
69
69
|
folderName: 'webv',
|
|
@@ -89,7 +89,7 @@ var webBuiltFilesSAS9 = function (indexHtml) {
|
|
|
89
89
|
subFolders: [
|
|
90
90
|
{
|
|
91
91
|
folderName: 'services',
|
|
92
|
-
files: [{ fileName: indexHtml
|
|
92
|
+
files: [{ fileName: "".concat(indexHtml, ".sas") }],
|
|
93
93
|
subFolders: [
|
|
94
94
|
{
|
|
95
95
|
folderName: 'webv',
|
|
@@ -120,22 +120,22 @@ describe('sasjs web', function () {
|
|
|
120
120
|
return __generator(this, function (_a) {
|
|
121
121
|
switch (_a.label) {
|
|
122
122
|
case 0:
|
|
123
|
-
appName = "cli-test-web-minimal-"
|
|
124
|
-
return [4 /*yield*/, test_1.createTestMinimalApp(__dirname, appName)];
|
|
123
|
+
appName = "cli-test-web-minimal-".concat((0, utils_1.generateTimestamp)());
|
|
124
|
+
return [4 /*yield*/, (0, test_1.createTestMinimalApp)(__dirname, appName)];
|
|
125
125
|
case 1:
|
|
126
126
|
_a.sent();
|
|
127
|
-
return [4 /*yield*/, test_1.updateConfig({
|
|
127
|
+
return [4 /*yield*/, (0, test_1.updateConfig)({
|
|
128
128
|
streamConfig: __assign(__assign({}, streamConfig), { streamServiceName: undefined })
|
|
129
129
|
})];
|
|
130
130
|
case 2:
|
|
131
131
|
_a.sent();
|
|
132
|
-
return [4 /*yield*/, utils_1.createFile(path_1.default.join(__dirname, appName, streamConfig.webSourcePath, 'testing.js.map'), '')];
|
|
132
|
+
return [4 /*yield*/, (0, utils_1.createFile)(path_1.default.join(__dirname, appName, streamConfig.webSourcePath, 'testing.js.map'), '')];
|
|
133
133
|
case 3:
|
|
134
134
|
_a.sent();
|
|
135
|
-
return [4 /*yield*/, test_1.updateTarget({ streamConfig: undefined }, 'viya')];
|
|
135
|
+
return [4 /*yield*/, (0, test_1.updateTarget)({ streamConfig: undefined }, 'viya')];
|
|
136
136
|
case 4:
|
|
137
137
|
_a.sent();
|
|
138
|
-
return [4 /*yield*/, test_1.updateTarget({ serverUrl: undefined, streamConfig: undefined }, 'sas9')];
|
|
138
|
+
return [4 /*yield*/, (0, test_1.updateTarget)({ serverUrl: undefined, streamConfig: undefined }, 'sas9')];
|
|
139
139
|
case 5:
|
|
140
140
|
_a.sent();
|
|
141
141
|
return [2 /*return*/];
|
|
@@ -145,7 +145,7 @@ describe('sasjs web', function () {
|
|
|
145
145
|
afterAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
146
146
|
return __generator(this, function (_a) {
|
|
147
147
|
switch (_a.label) {
|
|
148
|
-
case 0: return [4 /*yield*/, test_1.removeTestApp(__dirname, appName)];
|
|
148
|
+
case 0: return [4 /*yield*/, (0, test_1.removeTestApp)(__dirname, appName)];
|
|
149
149
|
case 1:
|
|
150
150
|
_a.sent();
|
|
151
151
|
return [2 /*return*/];
|
|
@@ -156,13 +156,13 @@ describe('sasjs web', function () {
|
|
|
156
156
|
var viyaTarget;
|
|
157
157
|
return __generator(this, function (_a) {
|
|
158
158
|
switch (_a.label) {
|
|
159
|
-
case 0: return [4 /*yield*/, utils_2.findTargetInConfiguration('viya')];
|
|
159
|
+
case 0: return [4 /*yield*/, (0, utils_2.findTargetInConfiguration)('viya')];
|
|
160
160
|
case 1:
|
|
161
161
|
viyaTarget = (_a.sent()).target;
|
|
162
|
-
return [4 /*yield*/, expect(web_1.createWebAppServices(viyaTarget)).toResolve()];
|
|
162
|
+
return [4 /*yield*/, expect((0, web_1.createWebAppServices)(viyaTarget)).toResolve()];
|
|
163
163
|
case 2:
|
|
164
164
|
_a.sent();
|
|
165
|
-
return [4 /*yield*/, expect(test_1.verifyFolder(webBuiltFilesSASVIYA())).resolves.toEqual(true)];
|
|
165
|
+
return [4 /*yield*/, expect((0, test_1.verifyFolder)(webBuiltFilesSASVIYA())).resolves.toEqual(true)];
|
|
166
166
|
case 3:
|
|
167
167
|
_a.sent();
|
|
168
168
|
return [2 /*return*/];
|
|
@@ -173,13 +173,13 @@ describe('sasjs web', function () {
|
|
|
173
173
|
var sas9Target;
|
|
174
174
|
return __generator(this, function (_a) {
|
|
175
175
|
switch (_a.label) {
|
|
176
|
-
case 0: return [4 /*yield*/, utils_2.findTargetInConfiguration('sas9')];
|
|
176
|
+
case 0: return [4 /*yield*/, (0, utils_2.findTargetInConfiguration)('sas9')];
|
|
177
177
|
case 1:
|
|
178
178
|
sas9Target = (_a.sent()).target;
|
|
179
|
-
return [4 /*yield*/, expect(web_1.createWebAppServices(sas9Target)).toResolve()];
|
|
179
|
+
return [4 /*yield*/, expect((0, web_1.createWebAppServices)(sas9Target)).toResolve()];
|
|
180
180
|
case 2:
|
|
181
181
|
_a.sent();
|
|
182
|
-
return [4 /*yield*/, expect(test_1.verifyFolder(webBuiltFilesSAS9())).resolves.toEqual(true)];
|
|
182
|
+
return [4 /*yield*/, expect((0, test_1.verifyFolder)(webBuiltFilesSAS9())).resolves.toEqual(true)];
|
|
183
183
|
case 3:
|
|
184
184
|
_a.sent();
|
|
185
185
|
return [2 /*return*/];
|
|
@@ -192,19 +192,19 @@ describe('sasjs web', function () {
|
|
|
192
192
|
switch (_a.label) {
|
|
193
193
|
case 0:
|
|
194
194
|
streamServiceName = 'clickme_VIYA';
|
|
195
|
-
return [4 /*yield*/, test_1.updateTarget({
|
|
195
|
+
return [4 /*yield*/, (0, test_1.updateTarget)({
|
|
196
196
|
streamConfig: __assign(__assign({}, streamConfig), { streamServiceName: streamServiceName })
|
|
197
197
|
}, 'viya')];
|
|
198
198
|
case 1:
|
|
199
199
|
_a.sent();
|
|
200
|
-
return [4 /*yield*/, utils_2.findTargetInConfiguration('viya')];
|
|
200
|
+
return [4 /*yield*/, (0, utils_2.findTargetInConfiguration)('viya')];
|
|
201
201
|
case 2:
|
|
202
202
|
targetCustomServiceName = (_a.sent())
|
|
203
203
|
.target;
|
|
204
|
-
return [4 /*yield*/, expect(web_1.createWebAppServices(targetCustomServiceName)).toResolve()];
|
|
204
|
+
return [4 /*yield*/, expect((0, web_1.createWebAppServices)(targetCustomServiceName)).toResolve()];
|
|
205
205
|
case 3:
|
|
206
206
|
_a.sent();
|
|
207
|
-
return [4 /*yield*/, expect(test_1.verifyFolder(webBuiltFilesSASVIYA(streamServiceName))).resolves.toEqual(true)];
|
|
207
|
+
return [4 /*yield*/, expect((0, test_1.verifyFolder)(webBuiltFilesSASVIYA(streamServiceName))).resolves.toEqual(true)];
|
|
208
208
|
case 4:
|
|
209
209
|
_a.sent();
|
|
210
210
|
return [2 /*return*/];
|
|
@@ -217,19 +217,19 @@ describe('sasjs web', function () {
|
|
|
217
217
|
switch (_a.label) {
|
|
218
218
|
case 0:
|
|
219
219
|
streamServiceName = 'clickme_SAS9';
|
|
220
|
-
return [4 /*yield*/, test_1.updateTarget({
|
|
220
|
+
return [4 /*yield*/, (0, test_1.updateTarget)({
|
|
221
221
|
streamConfig: __assign(__assign({}, streamConfig), { streamServiceName: streamServiceName })
|
|
222
222
|
}, 'sas9')];
|
|
223
223
|
case 1:
|
|
224
224
|
_a.sent();
|
|
225
|
-
return [4 /*yield*/, utils_2.findTargetInConfiguration('sas9')];
|
|
225
|
+
return [4 /*yield*/, (0, utils_2.findTargetInConfiguration)('sas9')];
|
|
226
226
|
case 2:
|
|
227
227
|
targetCustomServiceName = (_a.sent())
|
|
228
228
|
.target;
|
|
229
|
-
return [4 /*yield*/, expect(web_1.createWebAppServices(targetCustomServiceName)).toResolve()];
|
|
229
|
+
return [4 /*yield*/, expect((0, web_1.createWebAppServices)(targetCustomServiceName)).toResolve()];
|
|
230
230
|
case 3:
|
|
231
231
|
_a.sent();
|
|
232
|
-
return [4 /*yield*/, expect(test_1.verifyFolder(webBuiltFilesSAS9(streamServiceName))).resolves.toEqual(true)];
|
|
232
|
+
return [4 /*yield*/, expect((0, test_1.verifyFolder)(webBuiltFilesSAS9(streamServiceName))).resolves.toEqual(true)];
|
|
233
233
|
case 4:
|
|
234
234
|
_a.sent();
|
|
235
235
|
return [2 /*return*/];
|