@sasjs/cli 2.38.6 → 3.0.0
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/add/addCredential.d.ts +2 -2
- package/build/commands/add/addCredential.js +26 -28
- package/build/commands/add/internal/input.js +15 -2
- package/build/commands/build/build.d.ts +1 -1
- package/build/commands/build/build.js +67 -56
- package/build/commands/build/internal/getLaunchPageCode.js +2 -1
- package/build/commands/compile/compile.js +18 -22
- package/build/commands/compile/internal/checkCompileStatus.js +6 -8
- package/build/commands/compile/internal/compileServiceFile.js +16 -15
- package/build/commands/compile/spec/loadDependencies.spec.js +3 -3
- package/build/commands/context/contextCommand.js +5 -5
- package/build/commands/deploy/deploy.d.ts +2 -1
- package/build/commands/deploy/deploy.js +92 -46
- package/build/commands/deploy/spec/cbd.spec.d.ts +1 -0
- package/build/commands/deploy/spec/cbd.spec.js +141 -0
- package/build/commands/deploy/spec/cbd.spec.server.js +6 -57
- package/build/commands/deploy/spec/utils.d.ts +6 -0
- package/build/commands/deploy/spec/utils.js +242 -0
- package/build/commands/docs/internal/getDocConfig.js +8 -3
- package/build/commands/docs/spec/generateDot.spec.js +0 -1
- package/build/commands/docs/spec/getDocConfig.spec.d.ts +1 -0
- package/build/commands/docs/spec/getDocConfig.spec.js +27 -0
- package/build/commands/flow/flowCommand.js +1 -1
- package/build/commands/flow/spec/flow.spec.server.js +1 -1
- package/build/commands/folder/folderCommand.js +2 -2
- package/build/commands/folder/spec/folder.spec.server.js +1 -1
- package/build/commands/job/internal/execute/index.d.ts +2 -0
- package/build/commands/job/internal/execute/index.js +14 -0
- package/build/commands/job/internal/execute/sasjs.d.ts +8 -0
- package/build/commands/job/internal/execute/sasjs.js +69 -0
- package/build/commands/job/{execute.d.ts → internal/execute/viya.d.ts} +1 -1
- package/build/commands/job/{execute.js → internal/execute/viya.js} +29 -68
- package/build/commands/job/internal/utils.d.ts +1 -0
- package/build/commands/job/internal/utils.js +81 -0
- package/build/commands/job/jobCommand.d.ts +2 -1
- package/build/commands/job/jobCommand.js +65 -23
- package/build/commands/job/spec/execute.spec.js +41 -21
- package/build/commands/job/spec/getContextName.spec.js +1 -1
- package/build/commands/job/spec/job.spec.server.js +4 -4
- package/build/commands/job/spec/jobCommand.spec.js +10 -10
- package/build/commands/request/request.js +1 -1
- package/build/commands/run/run.js +2 -2
- package/build/commands/servicepack/spec/servicepack.spec.server.js +0 -1
- package/build/commands/shared/dependencies.js +6 -9
- package/build/commands/shared/deployToSasViyaWithServicePack.js +1 -1
- package/build/commands/testing/test.js +1 -1
- package/build/commands/web/internal/createAssetServices.d.ts +5 -0
- package/build/commands/web/internal/createAssetServices.js +219 -0
- package/build/commands/web/internal/getTags.d.ts +4 -0
- package/build/commands/web/internal/getTags.js +21 -0
- package/build/commands/web/internal/getWebServiceContent.d.ts +2 -0
- package/build/commands/web/internal/getWebServiceContent.js +84 -0
- package/build/commands/web/{spec → internal/spec}/testFiles/script1.d.ts +0 -0
- package/build/commands/web/{spec → internal/spec}/testFiles/script1.js +0 -0
- package/build/commands/web/{spec → internal/spec}/testFiles/script2.d.ts +0 -0
- package/build/commands/web/{spec → internal/spec}/testFiles/script2.js +0 -0
- package/build/commands/web/{spec/updateTagSource.spec.d.ts → internal/spec/updateScriptTag.spec.d.ts} +0 -0
- package/build/commands/web/{spec/updateTagSource.spec.js → internal/spec/updateScriptTag.spec.js} +7 -7
- package/build/commands/web/internal/updateAllTags.d.ts +13 -0
- package/build/commands/web/internal/updateAllTags.js +94 -0
- package/build/commands/web/internal/updateLinkHref.d.ts +4 -0
- package/build/commands/web/internal/updateLinkHref.js +18 -0
- package/build/commands/web/internal/updateScriptTag.d.ts +5 -0
- package/build/commands/web/internal/updateScriptTag.js +85 -0
- package/build/commands/web/web.d.ts +0 -4
- package/build/commands/web/web.js +64 -378
- package/build/config.json +3 -1
- package/build/utils/config.d.ts +1 -1
- package/build/utils/config.js +106 -71
- package/build/utils/file.d.ts +1 -1
- package/build/utils/file.js +1 -1
- package/build/utils/spec/removeComments.spec.d.ts +1 -1
- package/build/utils/spec/removeComments.spec.js +1 -1
- package/build/utils/test.js +1 -1
- package/build/utils/utils.d.ts +1 -0
- package/build/utils/utils.js +8 -2
- package/package.json +14 -14
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.updateAllTags = void 0;
|
|
40
|
+
var utils_1 = require("@sasjs/utils");
|
|
41
|
+
var getTags_1 = require("./getTags");
|
|
42
|
+
var updateScriptTag_1 = require("./updateScriptTag");
|
|
43
|
+
var updateLinkHref_1 = require("./updateLinkHref");
|
|
44
|
+
var updateAllTags = function (parsedHtml, _a) {
|
|
45
|
+
var webSourcePathFull = _a.webSourcePathFull, destinationPath = _a.destinationPath, serverType = _a.serverType, assetPathMap = _a.assetPathMap;
|
|
46
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
47
|
+
var assetsNotFound, scriptTags, linkTags, faviconTags, notFoundErrors;
|
|
48
|
+
return __generator(this, function (_b) {
|
|
49
|
+
switch (_b.label) {
|
|
50
|
+
case 0:
|
|
51
|
+
assetsNotFound = [];
|
|
52
|
+
scriptTags = getTags_1.getScriptTags(parsedHtml);
|
|
53
|
+
return [4 /*yield*/, utils_1.asyncForEach(scriptTags, function (tag) { return __awaiter(void 0, void 0, void 0, function () {
|
|
54
|
+
return __generator(this, function (_a) {
|
|
55
|
+
switch (_a.label) {
|
|
56
|
+
case 0: return [4 /*yield*/, updateScriptTag_1.updateScriptTag(tag, webSourcePathFull, destinationPath, serverType, assetPathMap).catch(function (e) { return assetsNotFound.push(e); })];
|
|
57
|
+
case 1:
|
|
58
|
+
_a.sent();
|
|
59
|
+
return [2 /*return*/];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}); })];
|
|
63
|
+
case 1:
|
|
64
|
+
_b.sent();
|
|
65
|
+
linkTags = getTags_1.getLinkTags(parsedHtml);
|
|
66
|
+
linkTags.forEach(function (linkTag) {
|
|
67
|
+
try {
|
|
68
|
+
updateLinkHref_1.updateLinkHref(linkTag, assetPathMap);
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
assetsNotFound.push(error);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
faviconTags = getTags_1.getFaviconTags(parsedHtml);
|
|
75
|
+
faviconTags.forEach(function (faviconTag) {
|
|
76
|
+
try {
|
|
77
|
+
updateLinkHref_1.updateLinkHref(faviconTag, assetPathMap);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
assetsNotFound.push(error);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
if (assetsNotFound.length) {
|
|
84
|
+
notFoundErrors = assetsNotFound
|
|
85
|
+
.map(function (e) { return "- " + e.message + "\n"; })
|
|
86
|
+
.join('');
|
|
87
|
+
throw new Error("Error(s) while preparing stream app:\n" + notFoundErrors);
|
|
88
|
+
}
|
|
89
|
+
return [2 /*return*/];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
exports.updateAllTags = updateAllTags;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateLinkHref = void 0;
|
|
4
|
+
var updateLinkHref = function (linkTag, assetPathMap) {
|
|
5
|
+
var linkSourcePath = linkTag.getAttribute('href') || '';
|
|
6
|
+
var isUrl = linkSourcePath.startsWith('http') || linkSourcePath.startsWith('//');
|
|
7
|
+
if (!isUrl) {
|
|
8
|
+
var assetPath = assetPathMap.find(function (entry) {
|
|
9
|
+
return entry.source === linkSourcePath ||
|
|
10
|
+
"./" + entry.source === linkSourcePath;
|
|
11
|
+
});
|
|
12
|
+
if (!(assetPath === null || assetPath === void 0 ? void 0 : assetPath.target)) {
|
|
13
|
+
throw new Error("Unable to find file: " + linkSourcePath);
|
|
14
|
+
}
|
|
15
|
+
linkTag.setAttribute('href', assetPath.target);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
exports.updateLinkHref = updateLinkHref;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.updateScriptTag = void 0;
|
|
43
|
+
var path_1 = __importDefault(require("path"));
|
|
44
|
+
var utils_1 = require("@sasjs/utils");
|
|
45
|
+
var js_base64_1 = require("js-base64");
|
|
46
|
+
var getWebServiceContent_1 = require("./getWebServiceContent");
|
|
47
|
+
var updateScriptTag = function (tag, webSourcePathFull, destinationPath, serverType, assetPathMap) { return __awaiter(void 0, void 0, void 0, function () {
|
|
48
|
+
var scriptPath, isUrl, content_1, serviceContent;
|
|
49
|
+
return __generator(this, function (_a) {
|
|
50
|
+
switch (_a.label) {
|
|
51
|
+
case 0:
|
|
52
|
+
scriptPath = tag.getAttribute('src');
|
|
53
|
+
isUrl = scriptPath && (scriptPath.startsWith('http') || scriptPath.startsWith('//'));
|
|
54
|
+
if (!scriptPath) return [3 /*break*/, 7];
|
|
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: " + scriptPath);
|
|
58
|
+
})];
|
|
59
|
+
case 1:
|
|
60
|
+
content_1 = _a.sent();
|
|
61
|
+
assetPathMap.forEach(function (pathEntry) {
|
|
62
|
+
content_1 = content_1.replace(new RegExp(pathEntry.source, 'g'), pathEntry.target);
|
|
63
|
+
});
|
|
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)];
|
|
66
|
+
case 2:
|
|
67
|
+
_a.sent();
|
|
68
|
+
return [3 /*break*/, 6];
|
|
69
|
+
case 3: return [4 /*yield*/, getWebServiceContent_1.getWebServiceContent(js_base64_1.encode(content_1), 'JS', serverType)];
|
|
70
|
+
case 4:
|
|
71
|
+
serviceContent = _a.sent();
|
|
72
|
+
return [4 /*yield*/, utils_1.createFile(path_1.default.join(destinationPath, scriptPath.replace(/\.js$/, '-js') + ".sas"), serviceContent)];
|
|
73
|
+
case 5:
|
|
74
|
+
_a.sent();
|
|
75
|
+
_a.label = 6;
|
|
76
|
+
case 6:
|
|
77
|
+
tag.setAttribute('src', assetPathMap.find(function (entry) {
|
|
78
|
+
return entry.source === scriptPath || "./" + entry.source === scriptPath;
|
|
79
|
+
}).target);
|
|
80
|
+
_a.label = 7;
|
|
81
|
+
case 7: return [2 /*return*/];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}); };
|
|
85
|
+
exports.updateScriptTag = updateScriptTag;
|
|
@@ -1,6 +1,2 @@
|
|
|
1
1
|
import { Target } from '@sasjs/utils';
|
|
2
2
|
export declare function createWebAppServices(target: Target): Promise<void>;
|
|
3
|
-
export declare function updateTagSource(tag: HTMLLinkElement, webAppSourcePath: string, destinationPath: string, target: Target, assetPathMap: {
|
|
4
|
-
source: string;
|
|
5
|
-
target: string;
|
|
6
|
-
}[]): Promise<void>;
|