@sasjs/cli 3.0.3 → 3.0.4
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 +6 -2
- package/build/commands/add/addCredential.js +79 -47
- package/build/commands/add/addTarget.js +32 -20
- package/build/commands/add/internal/input.d.ts +7 -0
- package/build/commands/add/internal/input.js +53 -8
- package/build/commands/add/spec/addTarget.spec.js +78 -0
- package/build/commands/compile/internal/compileServiceFile.js +31 -14
- package/build/commands/create/spec/reactAppFiles.js +5 -5
- package/build/commands/deploy/spec/cbd.spec.js +19 -3
- package/build/commands/web/internal/getTags.d.ts +2 -1
- package/build/commands/web/internal/getTags.js +10 -12
- 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.d.ts +4 -0
- package/build/commands/web/internal/spec/updateLinkTag.spec.js +32 -0
- package/build/commands/web/internal/updateAllTags.js +33 -8
- package/build/commands/web/internal/updateLinkTag.d.ts +4 -0
- package/build/commands/web/internal/updateLinkTag.js +24 -0
- package/build/utils/auth.d.ts +10 -4
- package/build/utils/auth.js +17 -15
- package/build/utils/config.d.ts +1 -1
- package/build/utils/config.js +12 -14
- package/package.json +6 -12
- package/build/commands/web/internal/updateLinkHref.d.ts +0 -4
- package/build/commands/web/internal/updateLinkHref.js +0 -18
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Target, HttpsAgentOptions } from '@sasjs/utils/types';
|
|
2
2
|
import { TargetScope } from '../../types/targetScope';
|
|
3
3
|
/**
|
|
4
4
|
* Creates a .env file for the specified target.
|
|
@@ -10,6 +10,10 @@ import { TargetScope } from '../../types/targetScope';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const addCredential: (target: Target, insecure: boolean, targetScope: TargetScope) => Promise<Target>;
|
|
12
12
|
export declare const validateTargetName: (targetName: string) => string;
|
|
13
|
-
export declare const getTokens: (target: Target, client: string, secret: string, httpsAgentOptions?: HttpsAgentOptions | undefined) => Promise<
|
|
13
|
+
export declare const getTokens: (target: Target, client: string, secret: string, httpsAgentOptions?: HttpsAgentOptions | undefined) => Promise<{
|
|
14
|
+
access_token: string;
|
|
15
|
+
refresh_token: string;
|
|
16
|
+
}>;
|
|
14
17
|
export declare const createEnvFileForViya: (targetName: string, client: string, secret: string, accessToken: string, refreshToken: string) => Promise<void>;
|
|
15
18
|
export declare const createEnvFileForSas9: (targetName: string, userName: string, password: string) => Promise<void>;
|
|
19
|
+
export declare const createEnvFileForSasjs: (targetName: string, client: string, accessToken: string, refreshToken: string) => Promise<void>;
|
|
@@ -50,7 +50,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.createEnvFileForSas9 = exports.createEnvFileForViya = exports.getTokens = exports.validateTargetName = exports.addCredential = void 0;
|
|
53
|
+
exports.createEnvFileForSasjs = exports.createEnvFileForSas9 = exports.createEnvFileForViya = exports.getTokens = exports.validateTargetName = exports.addCredential = void 0;
|
|
54
54
|
var path_1 = __importDefault(require("path"));
|
|
55
55
|
var logger_1 = require("@sasjs/utils/logger");
|
|
56
56
|
var types_1 = require("@sasjs/utils/types");
|
|
@@ -69,66 +69,81 @@ var saveConfig_1 = require("./internal/saveConfig");
|
|
|
69
69
|
* @param {boolean} insecure- boolean to use insecure connection, default is false. lf true the server will not reject any connection which is not authorized with the list of supplied CAs
|
|
70
70
|
*/
|
|
71
71
|
var addCredential = function (target, insecure, targetScope) { return __awaiter(void 0, void 0, void 0, function () {
|
|
72
|
-
var httpsAgentOptions, serverUrl,
|
|
73
|
-
var
|
|
74
|
-
return __generator(this, function (
|
|
75
|
-
switch (
|
|
72
|
+
var httpsAgentOptions, serverUrl, filePath_1, _a, _b, client, secret, _c, access_token, refresh_token, _d, userName, password, client, _e, access_token, refresh_token, filePath;
|
|
73
|
+
var _f, _g, _h;
|
|
74
|
+
return __generator(this, function (_j) {
|
|
75
|
+
switch (_j.label) {
|
|
76
76
|
case 0:
|
|
77
77
|
httpsAgentOptions = insecure
|
|
78
78
|
? __assign(__assign({}, target.httpsAgentOptions), { allowInsecureRequests: true, rejectUnauthorized: false }) : target.httpsAgentOptions;
|
|
79
79
|
if (insecure)
|
|
80
|
-
(
|
|
80
|
+
(_f = process.logger) === null || _f === void 0 ? void 0 : _f.warn('Executing with insecure connection.');
|
|
81
81
|
if (!!target.serverUrl) return [3 /*break*/, 3];
|
|
82
82
|
return [4 /*yield*/, input_1.getAndValidateServerUrl(target)];
|
|
83
83
|
case 1:
|
|
84
|
-
serverUrl =
|
|
84
|
+
serverUrl = _j.sent();
|
|
85
85
|
target = new types_1.Target(__assign(__assign({}, target.toJson(false)), { serverUrl: serverUrl }));
|
|
86
86
|
return [4 /*yield*/, saveConfig_1.saveConfig(targetScope, target, false, false)];
|
|
87
87
|
case 2:
|
|
88
|
-
|
|
89
|
-
(
|
|
90
|
-
|
|
88
|
+
filePath_1 = _j.sent();
|
|
89
|
+
(_g = process.logger) === null || _g === void 0 ? void 0 : _g.info("Target configuration has been saved to " + filePath_1 + " .");
|
|
90
|
+
_j.label = 3;
|
|
91
91
|
case 3:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
_a = target.serverType;
|
|
93
|
+
switch (_a) {
|
|
94
|
+
case types_1.ServerType.SasViya: return [3 /*break*/, 4];
|
|
95
|
+
case types_1.ServerType.Sas9: return [3 /*break*/, 10];
|
|
96
|
+
case types_1.ServerType.Sasjs: return [3 /*break*/, 15];
|
|
97
|
+
}
|
|
98
|
+
return [3 /*break*/, 21];
|
|
99
|
+
case 4: return [4 /*yield*/, input_1.getCredentialsInputForViya(target.name)];
|
|
97
100
|
case 5:
|
|
98
|
-
_b =
|
|
99
|
-
|
|
100
|
-
return [4 /*yield*/, exports.createEnvFileForViya(target.name, client, secret, access_token, refresh_token)];
|
|
101
|
+
_b = _j.sent(), client = _b.client, secret = _b.secret;
|
|
102
|
+
return [4 /*yield*/, exports.getTokens(target, client, secret, httpsAgentOptions)];
|
|
101
103
|
case 6:
|
|
102
|
-
|
|
103
|
-
return [3 /*break*/, 8];
|
|
104
|
+
_c = _j.sent(), access_token = _c.access_token, refresh_token = _c.refresh_token;
|
|
105
|
+
if (!(targetScope === targetScope_1.TargetScope.Local)) return [3 /*break*/, 8];
|
|
106
|
+
return [4 /*yield*/, exports.createEnvFileForViya(target.name, client, secret, access_token, refresh_token)];
|
|
104
107
|
case 7:
|
|
108
|
+
_j.sent();
|
|
109
|
+
return [3 /*break*/, 9];
|
|
110
|
+
case 8:
|
|
105
111
|
target = new types_1.Target(__assign(__assign({}, target.toJson(false)), { authConfig: { client: client, secret: secret, access_token: access_token, refresh_token: refresh_token } }));
|
|
106
|
-
|
|
107
|
-
case
|
|
108
|
-
case
|
|
109
|
-
filePath = _h.sent();
|
|
110
|
-
(_f = process.logger) === null || _f === void 0 ? void 0 : _f.info("Target configuration has been saved to " + filePath + " .");
|
|
111
|
-
return [3 /*break*/, 17];
|
|
112
|
-
case 10:
|
|
113
|
-
if (!(target.serverType === types_1.ServerType.Sas9)) return [3 /*break*/, 16];
|
|
114
|
-
return [4 /*yield*/, input_1.getCredentialsInputSas9(target, targetScope)];
|
|
112
|
+
_j.label = 9;
|
|
113
|
+
case 9: return [3 /*break*/, 22];
|
|
114
|
+
case 10: return [4 /*yield*/, input_1.getCredentialsInputSas9(target, targetScope)];
|
|
115
115
|
case 11:
|
|
116
|
-
|
|
116
|
+
_d = _j.sent(), userName = _d.userName, password = _d.password;
|
|
117
117
|
if (!(targetScope === targetScope_1.TargetScope.Local)) return [3 /*break*/, 13];
|
|
118
118
|
return [4 /*yield*/, exports.createEnvFileForSas9(target.name, userName, password)];
|
|
119
119
|
case 12:
|
|
120
|
-
|
|
120
|
+
_j.sent();
|
|
121
121
|
return [3 /*break*/, 14];
|
|
122
122
|
case 13:
|
|
123
123
|
target = new types_1.Target(__assign(__assign({}, target.toJson(false)), { authConfigSas9: { userName: userName, password: password } }));
|
|
124
|
-
|
|
125
|
-
case 14: return [
|
|
126
|
-
case 15:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return [
|
|
130
|
-
case
|
|
131
|
-
|
|
124
|
+
_j.label = 14;
|
|
125
|
+
case 14: return [3 /*break*/, 22];
|
|
126
|
+
case 15: return [4 /*yield*/, input_1.getCredentialsInputSasjs(target)];
|
|
127
|
+
case 16:
|
|
128
|
+
client = (_j.sent()).client;
|
|
129
|
+
return [4 /*yield*/, exports.getTokens(target, client, '', httpsAgentOptions)];
|
|
130
|
+
case 17:
|
|
131
|
+
_e = _j.sent(), access_token = _e.access_token, refresh_token = _e.refresh_token;
|
|
132
|
+
if (!(targetScope === targetScope_1.TargetScope.Local)) return [3 /*break*/, 19];
|
|
133
|
+
return [4 /*yield*/, exports.createEnvFileForSasjs(target.name, client, access_token, refresh_token)];
|
|
134
|
+
case 18:
|
|
135
|
+
_j.sent();
|
|
136
|
+
return [3 /*break*/, 20];
|
|
137
|
+
case 19:
|
|
138
|
+
target = new types_1.Target(__assign(__assign({}, target.toJson(false)), { authConfig: { client: client, secret: '', access_token: access_token, refresh_token: refresh_token } }));
|
|
139
|
+
_j.label = 20;
|
|
140
|
+
case 20: return [3 /*break*/, 22];
|
|
141
|
+
case 21: throw new Error('Target contains invalid serverType. Possible types could be SASVIYA, SAS9 and SASJS');
|
|
142
|
+
case 22: return [4 /*yield*/, saveConfig_1.saveConfig(targetScope, target, false, false)];
|
|
143
|
+
case 23:
|
|
144
|
+
filePath = _j.sent();
|
|
145
|
+
(_h = process.logger) === null || _h === void 0 ? void 0 : _h.info("Target configuration has been saved to " + filePath + " .");
|
|
146
|
+
return [2 /*return*/, target];
|
|
132
147
|
}
|
|
133
148
|
});
|
|
134
149
|
}); };
|
|
@@ -146,25 +161,25 @@ var validateTargetName = function (targetName) {
|
|
|
146
161
|
};
|
|
147
162
|
exports.validateTargetName = validateTargetName;
|
|
148
163
|
var getTokens = function (target, client, secret, httpsAgentOptions) { return __awaiter(void 0, void 0, void 0, function () {
|
|
149
|
-
var adapter,
|
|
150
|
-
var
|
|
151
|
-
return __generator(this, function (
|
|
152
|
-
switch (
|
|
164
|
+
var adapter, _a, access_token, refresh_token;
|
|
165
|
+
var _b;
|
|
166
|
+
return __generator(this, function (_c) {
|
|
167
|
+
switch (_c.label) {
|
|
153
168
|
case 0:
|
|
154
169
|
adapter = new node_1.default({
|
|
155
170
|
serverUrl: target.serverUrl,
|
|
156
171
|
serverType: target.serverType,
|
|
157
172
|
httpsAgentOptions: httpsAgentOptions,
|
|
158
|
-
debug: ((
|
|
173
|
+
debug: ((_b = process.logger) === null || _b === void 0 ? void 0 : _b.logLevel) === logger_1.LogLevel.Debug
|
|
159
174
|
});
|
|
160
175
|
return [4 /*yield*/, auth_1.getNewAccessToken(adapter, client, secret, target).catch(function (e) {
|
|
161
176
|
var _a;
|
|
162
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error("An error has occurred while validating your credentials: " + e + "\nPlease check your Client ID and Client Secret and try again.\n");
|
|
177
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error("An error has occurred while validating your credentials: " + e + "\nPlease check your Client ID " + (target.serverType === types_1.ServerType.Sasjs ? '' : 'and Client Secret ') + "and try again.\n");
|
|
163
178
|
throw e;
|
|
164
179
|
})];
|
|
165
180
|
case 1:
|
|
166
|
-
|
|
167
|
-
return [2 /*return*/,
|
|
181
|
+
_a = _c.sent(), access_token = _a.access_token, refresh_token = _a.refresh_token;
|
|
182
|
+
return [2 /*return*/, { access_token: access_token, refresh_token: refresh_token }];
|
|
168
183
|
}
|
|
169
184
|
});
|
|
170
185
|
}); };
|
|
@@ -203,3 +218,20 @@ var createEnvFileForSas9 = function (targetName, userName, password) { return __
|
|
|
203
218
|
});
|
|
204
219
|
}); };
|
|
205
220
|
exports.createEnvFileForSas9 = createEnvFileForSas9;
|
|
221
|
+
var createEnvFileForSasjs = function (targetName, client, accessToken, refreshToken) { return __awaiter(void 0, void 0, void 0, function () {
|
|
222
|
+
var envFileContent, envFilePath;
|
|
223
|
+
var _a;
|
|
224
|
+
return __generator(this, function (_b) {
|
|
225
|
+
switch (_b.label) {
|
|
226
|
+
case 0:
|
|
227
|
+
envFileContent = "CLIENT=" + client + "\nACCESS_TOKEN=" + accessToken + "\nREFRESH_TOKEN=" + refreshToken + "\n";
|
|
228
|
+
envFilePath = path_1.default.join(process.projectDir, ".env." + targetName);
|
|
229
|
+
return [4 /*yield*/, utils_1.createFile(envFilePath, envFileContent)];
|
|
230
|
+
case 1:
|
|
231
|
+
_b.sent();
|
|
232
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("Environment file saved at " + envFilePath);
|
|
233
|
+
return [2 /*return*/];
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}); };
|
|
237
|
+
exports.createEnvFileForSasjs = createEnvFileForSasjs;
|
|
@@ -60,26 +60,32 @@ var addCredential_1 = require("./addCredential");
|
|
|
60
60
|
function addTarget(insecure) {
|
|
61
61
|
var _a, _b, _c;
|
|
62
62
|
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
-
var _d, scope, serverType, name, appLoc, serverUrl, existingTarget, saveWithDefaultValues, targetJson, target, filePath, _e, serverName, repositoryName, userName, password,
|
|
64
|
-
return __generator(this, function (
|
|
65
|
-
switch (
|
|
63
|
+
var _d, scope, serverType, name, appLoc, serverUrl, existingTarget, saveWithDefaultValues, targetJson, target, filePath, _e, _f, serverName, repositoryName, userName, password, _g, contextName, updatedViyaTarget, updatedSasjsTarget, isDefault;
|
|
64
|
+
return __generator(this, function (_h) {
|
|
65
|
+
switch (_h.label) {
|
|
66
66
|
case 0:
|
|
67
67
|
if (insecure)
|
|
68
68
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.warn('Executing with insecure connection.');
|
|
69
69
|
return [4 /*yield*/, input_1.getCommonFields()];
|
|
70
70
|
case 1:
|
|
71
|
-
_d =
|
|
71
|
+
_d = _h.sent(), scope = _d.scope, serverType = _d.serverType, name = _d.name, appLoc = _d.appLoc, serverUrl = _d.serverUrl, existingTarget = _d.existingTarget;
|
|
72
72
|
saveWithDefaultValues = !existingTarget;
|
|
73
73
|
targetJson = __assign(__assign({}, existingTarget), { name: name, serverType: serverType, serverUrl: serverUrl, appLoc: appLoc });
|
|
74
74
|
target = new types_1.Target(targetJson);
|
|
75
75
|
return [4 /*yield*/, saveConfig_1.saveConfig(scope, target, false, saveWithDefaultValues)];
|
|
76
76
|
case 2:
|
|
77
|
-
filePath =
|
|
77
|
+
filePath = _h.sent();
|
|
78
78
|
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Target configuration has been saved to " + filePath + " .");
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
_e = serverType;
|
|
80
|
+
switch (_e) {
|
|
81
|
+
case types_1.ServerType.Sas9: return [3 /*break*/, 3];
|
|
82
|
+
case types_1.ServerType.SasViya: return [3 /*break*/, 5];
|
|
83
|
+
case types_1.ServerType.Sasjs: return [3 /*break*/, 7];
|
|
84
|
+
}
|
|
85
|
+
return [3 /*break*/, 9];
|
|
86
|
+
case 3: return [4 /*yield*/, input_1.getAndValidateSas9Fields(target, scope)];
|
|
87
|
+
case 4:
|
|
88
|
+
_f = _h.sent(), serverName = _f.serverName, repositoryName = _f.repositoryName, userName = _f.userName, password = _f.password;
|
|
83
89
|
targetJson = __assign(__assign({}, targetJson), { serverName: serverName, repositoryName: repositoryName });
|
|
84
90
|
if (scope === targetScope_1.TargetScope.Local) {
|
|
85
91
|
addCredential_1.createEnvFileForSas9(name, userName, password);
|
|
@@ -87,10 +93,10 @@ function addTarget(insecure) {
|
|
|
87
93
|
else {
|
|
88
94
|
targetJson = __assign(__assign({}, targetJson), { authConfigSas9: { userName: userName, password: password } });
|
|
89
95
|
}
|
|
90
|
-
return [3 /*break*/,
|
|
91
|
-
case
|
|
92
|
-
case
|
|
93
|
-
|
|
96
|
+
return [3 /*break*/, 10];
|
|
97
|
+
case 5: return [4 /*yield*/, input_1.getAndValidateSasViyaFields(target, scope, serverUrl, insecure, addCredential_1.addCredential)];
|
|
98
|
+
case 6:
|
|
99
|
+
_g = _h.sent(), contextName = _g.contextName, updatedViyaTarget = _g.target;
|
|
94
100
|
targetJson = {
|
|
95
101
|
contextName: contextName,
|
|
96
102
|
deployConfig: {
|
|
@@ -98,14 +104,20 @@ function addTarget(insecure) {
|
|
|
98
104
|
deployScripts: []
|
|
99
105
|
}
|
|
100
106
|
};
|
|
101
|
-
targetJson = __assign(__assign({},
|
|
102
|
-
|
|
103
|
-
case
|
|
104
|
-
case 7:
|
|
105
|
-
isDefault = _g.sent();
|
|
106
|
-
return [4 /*yield*/, saveConfig_1.saveConfig(scope, new types_1.Target(targetJson), isDefault, saveWithDefaultValues)];
|
|
107
|
+
targetJson = __assign(__assign({}, updatedViyaTarget.toJson(false)), targetJson);
|
|
108
|
+
return [3 /*break*/, 10];
|
|
109
|
+
case 7: return [4 /*yield*/, input_1.getAndValidateSasjsFields(target, scope, insecure, addCredential_1.addCredential)];
|
|
107
110
|
case 8:
|
|
108
|
-
|
|
111
|
+
updatedSasjsTarget = (_h.sent()).target;
|
|
112
|
+
targetJson = updatedSasjsTarget.toJson(false);
|
|
113
|
+
return [3 /*break*/, 10];
|
|
114
|
+
case 9: throw new Error('Target contains invalid serverType. Possible types could be SASVIYA, SAS9 and SASJS');
|
|
115
|
+
case 10: return [4 /*yield*/, input_1.getIsDefault()];
|
|
116
|
+
case 11:
|
|
117
|
+
isDefault = _h.sent();
|
|
118
|
+
return [4 /*yield*/, saveConfig_1.saveConfig(scope, new types_1.Target(targetJson), isDefault, saveWithDefaultValues)];
|
|
119
|
+
case 12:
|
|
120
|
+
filePath = _h.sent();
|
|
109
121
|
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.info("Target configuration has been saved to " + filePath);
|
|
110
122
|
return [2 /*return*/, true];
|
|
111
123
|
}
|
|
@@ -9,14 +9,21 @@ export declare function getAndValidateSas9Fields(target: Target, scope: TargetSc
|
|
|
9
9
|
userName: string;
|
|
10
10
|
password: string;
|
|
11
11
|
}>;
|
|
12
|
+
export declare const shouldAuthenticate: () => Promise<boolean>;
|
|
12
13
|
export declare function getAndValidateSasViyaFields(target: Target, scope: TargetScope, serverUrl: string, insecure: boolean, authenticateCallback: (target: Target, insecure: boolean, targetScope: TargetScope) => Promise<Target>): Promise<{
|
|
13
14
|
contextName: string;
|
|
14
15
|
target: Target;
|
|
15
16
|
}>;
|
|
17
|
+
export declare function getAndValidateSasjsFields(target: Target, scope: TargetScope, insecure: boolean, authenticateCallback: (target: Target, insecure: boolean, targetScope: TargetScope) => Promise<Target>): Promise<{
|
|
18
|
+
target: Target;
|
|
19
|
+
}>;
|
|
16
20
|
export declare const getCredentialsInputForViya: (targetName: string) => Promise<{
|
|
17
21
|
client: string;
|
|
18
22
|
secret: string;
|
|
19
23
|
}>;
|
|
24
|
+
export declare const getCredentialsInputSasjs: (target: Target) => Promise<{
|
|
25
|
+
client: string;
|
|
26
|
+
}>;
|
|
20
27
|
export declare const getCredentialsInputSas9: (target: Target, scope: TargetScope) => Promise<{
|
|
21
28
|
userName: string;
|
|
22
29
|
password: string;
|
|
@@ -50,7 +50,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.getIsDefault = exports.getDefaultValues = exports.getCredentialsInputSas9 = exports.getCredentialsInputForViya = exports.getAndValidateSasViyaFields = exports.getAndValidateSas9Fields = exports.getAndValidateServerUrl = exports.getCommonFields = void 0;
|
|
53
|
+
exports.getIsDefault = exports.getDefaultValues = exports.getCredentialsInputSas9 = exports.getCredentialsInputSasjs = exports.getCredentialsInputForViya = exports.getAndValidateSasjsFields = exports.getAndValidateSasViyaFields = exports.shouldAuthenticate = exports.getAndValidateSas9Fields = exports.getAndValidateServerUrl = exports.getCommonFields = void 0;
|
|
54
54
|
var input_1 = require("@sasjs/utils/input");
|
|
55
55
|
var types_1 = require("@sasjs/utils/types");
|
|
56
56
|
var logger_1 = require("@sasjs/utils/logger");
|
|
@@ -134,11 +134,20 @@ function getAndValidateServerType() {
|
|
|
134
134
|
switch (_a.label) {
|
|
135
135
|
case 0: return [4 /*yield*/, input_1.getChoice('Please pick a server type: ', 'Please choose either option 1 or 2.', [
|
|
136
136
|
{ title: '1. SAS Viya', value: 1 },
|
|
137
|
-
{ title: '2. SAS 9', value: 2 }
|
|
137
|
+
{ title: '2. SAS 9', value: 2 },
|
|
138
|
+
{ title: '3. SAS JS', value: 3 }
|
|
138
139
|
])];
|
|
139
140
|
case 1:
|
|
140
141
|
serverType = _a.sent();
|
|
141
|
-
|
|
142
|
+
switch (serverType) {
|
|
143
|
+
case 1:
|
|
144
|
+
return [2 /*return*/, types_1.ServerType.SasViya];
|
|
145
|
+
case 2:
|
|
146
|
+
return [2 /*return*/, types_1.ServerType.Sas9];
|
|
147
|
+
default:
|
|
148
|
+
return [2 /*return*/, types_1.ServerType.Sasjs];
|
|
149
|
+
}
|
|
150
|
+
return [2 /*return*/];
|
|
142
151
|
}
|
|
143
152
|
});
|
|
144
153
|
});
|
|
@@ -177,7 +186,11 @@ function getAndValidateTargetName(serverType) {
|
|
|
177
186
|
return [2 /*return*/, true];
|
|
178
187
|
});
|
|
179
188
|
}); };
|
|
180
|
-
defaultName = serverType === types_1.ServerType.SasViya
|
|
189
|
+
defaultName = serverType === types_1.ServerType.SasViya
|
|
190
|
+
? 'viya'
|
|
191
|
+
: serverType === types_1.ServerType.Sas9
|
|
192
|
+
? 'sas9'
|
|
193
|
+
: 'server';
|
|
181
194
|
return [4 /*yield*/, input_1.getString('Please enter a target name: ', validator, defaultName)];
|
|
182
195
|
case 1:
|
|
183
196
|
targetName = _a.sent();
|
|
@@ -237,18 +250,21 @@ function getAndValidateSas9Fields(target, scope) {
|
|
|
237
250
|
});
|
|
238
251
|
}
|
|
239
252
|
exports.getAndValidateSas9Fields = getAndValidateSas9Fields;
|
|
253
|
+
var shouldAuthenticate = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
254
|
+
return [2 /*return*/, input_1.getConfirmation('Would you like to authenticate against this target?', true)];
|
|
255
|
+
}); }); };
|
|
256
|
+
exports.shouldAuthenticate = shouldAuthenticate;
|
|
240
257
|
function getAndValidateSasViyaFields(target, scope, serverUrl, insecure, authenticateCallback) {
|
|
241
258
|
var _a;
|
|
242
259
|
return __awaiter(this, void 0, void 0, function () {
|
|
243
|
-
var contextName,
|
|
260
|
+
var contextName, httpsAgentOptions, sasjs, contexts, contextNumberErrorMessage, contextNumber;
|
|
244
261
|
return __generator(this, function (_b) {
|
|
245
262
|
switch (_b.label) {
|
|
246
263
|
case 0:
|
|
247
264
|
contextName = 'SAS Job Execution compute context';
|
|
248
|
-
return [4 /*yield*/,
|
|
265
|
+
return [4 /*yield*/, exports.shouldAuthenticate()];
|
|
249
266
|
case 1:
|
|
250
|
-
|
|
251
|
-
if (!shouldAuthenticate) return [3 /*break*/, 8];
|
|
267
|
+
if (!_b.sent()) return [3 /*break*/, 8];
|
|
252
268
|
return [4 /*yield*/, authenticateCallback(target, insecure, scope)];
|
|
253
269
|
case 2:
|
|
254
270
|
target = _b.sent();
|
|
@@ -293,6 +309,23 @@ function getAndValidateSasViyaFields(target, scope, serverUrl, insecure, authent
|
|
|
293
309
|
});
|
|
294
310
|
}
|
|
295
311
|
exports.getAndValidateSasViyaFields = getAndValidateSasViyaFields;
|
|
312
|
+
function getAndValidateSasjsFields(target, scope, insecure, authenticateCallback) {
|
|
313
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
314
|
+
return __generator(this, function (_a) {
|
|
315
|
+
switch (_a.label) {
|
|
316
|
+
case 0: return [4 /*yield*/, exports.shouldAuthenticate()];
|
|
317
|
+
case 1:
|
|
318
|
+
if (!_a.sent()) return [3 /*break*/, 3];
|
|
319
|
+
return [4 /*yield*/, authenticateCallback(target, insecure, scope)];
|
|
320
|
+
case 2:
|
|
321
|
+
target = _a.sent();
|
|
322
|
+
_a.label = 3;
|
|
323
|
+
case 3: return [2 /*return*/, { target: target }];
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
exports.getAndValidateSasjsFields = getAndValidateSasjsFields;
|
|
296
329
|
function getAndValidateAppLoc(targetName, target) {
|
|
297
330
|
var _a;
|
|
298
331
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -326,6 +359,18 @@ var getCredentialsInputForViya = function (targetName) { return __awaiter(void 0
|
|
|
326
359
|
});
|
|
327
360
|
}); };
|
|
328
361
|
exports.getCredentialsInputForViya = getCredentialsInputForViya;
|
|
362
|
+
var getCredentialsInputSasjs = function (target) { return __awaiter(void 0, void 0, void 0, function () {
|
|
363
|
+
var client;
|
|
364
|
+
return __generator(this, function (_a) {
|
|
365
|
+
switch (_a.label) {
|
|
366
|
+
case 0: return [4 /*yield*/, input_1.getString('Please enter your Client ID: ', function (v) { return !!v || 'Client ID is required.'; }, exports.getDefaultValues(target.name).client)];
|
|
367
|
+
case 1:
|
|
368
|
+
client = _a.sent();
|
|
369
|
+
return [2 /*return*/, { client: client }];
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
}); };
|
|
373
|
+
exports.getCredentialsInputSasjs = getCredentialsInputSasjs;
|
|
329
374
|
var getCredentialsInputSas9 = function (target, scope) { return __awaiter(void 0, void 0, void 0, function () {
|
|
330
375
|
var targetName, name, result, userName, password;
|
|
331
376
|
var _a, _b, _c, _d;
|
|
@@ -81,6 +81,7 @@ describe('addTarget', function () {
|
|
|
81
81
|
var appName = "cli-tests-add-" + utils_1.generateTimestamp();
|
|
82
82
|
var viyaTargetName = "test-viya-" + utils_1.generateTimestamp();
|
|
83
83
|
var sas9TargetName = "test-sas9-" + utils_1.generateTimestamp();
|
|
84
|
+
var sasjsTargetName = "test-server-" + utils_1.generateTimestamp();
|
|
84
85
|
var globalTestTarget;
|
|
85
86
|
beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
86
87
|
return __generator(this, function (_a) {
|
|
@@ -164,6 +165,42 @@ describe('addTarget', function () {
|
|
|
164
165
|
}
|
|
165
166
|
});
|
|
166
167
|
}); });
|
|
168
|
+
it('should create a SASJS target in the local sasjsconfig.json file', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
169
|
+
var commonFields;
|
|
170
|
+
return __generator(this, function (_a) {
|
|
171
|
+
switch (_a.label) {
|
|
172
|
+
case 0:
|
|
173
|
+
commonFields = {
|
|
174
|
+
scope: targetScope_1.TargetScope.Local,
|
|
175
|
+
serverType: utils_1.ServerType.Sasjs,
|
|
176
|
+
name: sasjsTargetName,
|
|
177
|
+
appLoc: '/Public/app',
|
|
178
|
+
serverUrl: process.env.SASJS_SERVER_URL,
|
|
179
|
+
existingTarget: {}
|
|
180
|
+
};
|
|
181
|
+
jest
|
|
182
|
+
.spyOn(inputModule, 'getCommonFields')
|
|
183
|
+
.mockImplementation(function () { return Promise.resolve(commonFields); });
|
|
184
|
+
jest
|
|
185
|
+
.spyOn(inputModule, 'getIsDefault')
|
|
186
|
+
.mockImplementation(function () { return Promise.resolve(false); });
|
|
187
|
+
jest
|
|
188
|
+
.spyOn(inputModule, 'getAndValidateSasjsFields')
|
|
189
|
+
.mockImplementation(function () {
|
|
190
|
+
return Promise.resolve({
|
|
191
|
+
target: new utils_1.Target(commonFields)
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
return [4 /*yield*/, expect(addTarget_1.addTarget(false)).resolves.toEqual(true)];
|
|
195
|
+
case 1:
|
|
196
|
+
_a.sent();
|
|
197
|
+
return [4 /*yield*/, verifyTarget(commonFields, true)];
|
|
198
|
+
case 2:
|
|
199
|
+
_a.sent();
|
|
200
|
+
return [2 /*return*/];
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}); });
|
|
167
204
|
it('should create a SAS9 target in the local sasjsconfig.json file', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
168
205
|
var commonFields;
|
|
169
206
|
return __generator(this, function (_a) {
|
|
@@ -322,6 +359,47 @@ describe('addTarget', function () {
|
|
|
322
359
|
}
|
|
323
360
|
});
|
|
324
361
|
}); });
|
|
362
|
+
it('should update a SASJS target in the local sasjsconfig.json file', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
363
|
+
var buildSourceFolder, config, targetJson, commonFields;
|
|
364
|
+
return __generator(this, function (_a) {
|
|
365
|
+
switch (_a.label) {
|
|
366
|
+
case 0:
|
|
367
|
+
buildSourceFolder = process.sasjsConstants.buildSourceFolder;
|
|
368
|
+
return [4 /*yield*/, config_1.getConfiguration(path_1.default.join(buildSourceFolder, 'sasjs', 'sasjsconfig.json'))];
|
|
369
|
+
case 1:
|
|
370
|
+
config = _a.sent();
|
|
371
|
+
targetJson = (config.targets || []).find(function (t) { return t.name === 'server'; });
|
|
372
|
+
commonFields = {
|
|
373
|
+
scope: targetScope_1.TargetScope.Local,
|
|
374
|
+
serverType: utils_1.ServerType.Sasjs,
|
|
375
|
+
name: 'server',
|
|
376
|
+
appLoc: '/Public/app/new/location/2',
|
|
377
|
+
serverUrl: process.env.SASJS_SERVER_URL,
|
|
378
|
+
existingTarget: targetJson
|
|
379
|
+
};
|
|
380
|
+
jest
|
|
381
|
+
.spyOn(inputModule, 'getCommonFields')
|
|
382
|
+
.mockImplementation(function () { return Promise.resolve(commonFields); });
|
|
383
|
+
jest
|
|
384
|
+
.spyOn(inputModule, 'getIsDefault')
|
|
385
|
+
.mockImplementation(function () { return Promise.resolve(false); });
|
|
386
|
+
jest
|
|
387
|
+
.spyOn(inputModule, 'getAndValidateSasjsFields')
|
|
388
|
+
.mockImplementation(function () {
|
|
389
|
+
return Promise.resolve({
|
|
390
|
+
target: new utils_1.Target(__assign(__assign({}, targetJson), commonFields))
|
|
391
|
+
});
|
|
392
|
+
});
|
|
393
|
+
return [4 /*yield*/, expect(addTarget_1.addTarget(false)).resolves.toEqual(true)];
|
|
394
|
+
case 2:
|
|
395
|
+
_a.sent();
|
|
396
|
+
return [4 /*yield*/, verifyTarget(commonFields, true)];
|
|
397
|
+
case 3:
|
|
398
|
+
_a.sent();
|
|
399
|
+
return [2 /*return*/];
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
}); });
|
|
325
403
|
it('should update a target in the global .sasjsrc file', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
326
404
|
var commonFields;
|
|
327
405
|
return __generator(this, function (_a) {
|
|
@@ -70,9 +70,9 @@ function compileServiceFile(target, filePath, macroFolders, programFolders, prog
|
|
|
70
70
|
exports.compileServiceFile = compileServiceFile;
|
|
71
71
|
function getPreCodeForServicePack(serverType) {
|
|
72
72
|
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
-
var content, macroCorePath, _a, _b, _c, _d, _e, _f, _g;
|
|
74
|
-
return __generator(this, function (
|
|
75
|
-
switch (
|
|
73
|
+
var content, macroCorePath, _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
74
|
+
return __generator(this, function (_l) {
|
|
75
|
+
switch (_l.label) {
|
|
76
76
|
case 0:
|
|
77
77
|
content = '';
|
|
78
78
|
macroCorePath = config_1.getMacroCorePath();
|
|
@@ -82,20 +82,20 @@ function getPreCodeForServicePack(serverType) {
|
|
|
82
82
|
case types_1.ServerType.Sas9: return [3 /*break*/, 5];
|
|
83
83
|
case types_1.ServerType.Sasjs: return [3 /*break*/, 9];
|
|
84
84
|
}
|
|
85
|
-
return [3 /*break*/,
|
|
85
|
+
return [3 /*break*/, 13];
|
|
86
86
|
case 1:
|
|
87
87
|
_b = content;
|
|
88
88
|
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/base/mf_getuser.sas")];
|
|
89
89
|
case 2:
|
|
90
|
-
content = _b +
|
|
90
|
+
content = _b + _l.sent();
|
|
91
91
|
_c = content;
|
|
92
92
|
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/base/mp_jsonout.sas")];
|
|
93
93
|
case 3:
|
|
94
|
-
content = _c +
|
|
94
|
+
content = _c + _l.sent();
|
|
95
95
|
_d = content;
|
|
96
96
|
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/viya/mv_webout.sas")];
|
|
97
97
|
case 4:
|
|
98
|
-
content = _d +
|
|
98
|
+
content = _d + _l.sent();
|
|
99
99
|
content +=
|
|
100
100
|
'/* if calling viya service with _job param, _program will conflict */\n' +
|
|
101
101
|
'/* so we provide instead as __program */\n' +
|
|
@@ -104,28 +104,45 @@ function getPreCodeForServicePack(serverType) {
|
|
|
104
104
|
'%macro webout(action,ds,dslabel=,fmt=);\n' +
|
|
105
105
|
'%mv_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt)\n' +
|
|
106
106
|
'%mend;\n';
|
|
107
|
-
return [3 /*break*/,
|
|
107
|
+
return [3 /*break*/, 14];
|
|
108
108
|
case 5:
|
|
109
109
|
_e = content;
|
|
110
110
|
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/base/mf_getuser.sas")];
|
|
111
111
|
case 6:
|
|
112
|
-
content = _e +
|
|
112
|
+
content = _e + _l.sent();
|
|
113
113
|
_f = content;
|
|
114
114
|
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/base/mp_jsonout.sas")];
|
|
115
115
|
case 7:
|
|
116
|
-
content = _f +
|
|
116
|
+
content = _f + _l.sent();
|
|
117
117
|
_g = content;
|
|
118
118
|
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/meta/mm_webout.sas")];
|
|
119
119
|
case 8:
|
|
120
|
-
content = _g +
|
|
120
|
+
content = _g + _l.sent();
|
|
121
121
|
content +=
|
|
122
122
|
' %macro webout(action,ds,dslabel=,fmt=);\n' +
|
|
123
123
|
' %mm_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt)\n' +
|
|
124
124
|
' %mend;\n';
|
|
125
|
-
return [3 /*break*/,
|
|
126
|
-
case 9:
|
|
127
|
-
|
|
125
|
+
return [3 /*break*/, 14];
|
|
126
|
+
case 9:
|
|
127
|
+
_h = content;
|
|
128
|
+
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/base/mf_getuser.sas")];
|
|
129
|
+
case 10:
|
|
130
|
+
content = _h + _l.sent();
|
|
131
|
+
_j = content;
|
|
132
|
+
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/base/mp_jsonout.sas")];
|
|
128
133
|
case 11:
|
|
134
|
+
content = _j + _l.sent();
|
|
135
|
+
_k = content;
|
|
136
|
+
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/server/ms_webout.sas")];
|
|
137
|
+
case 12:
|
|
138
|
+
content = _k + _l.sent();
|
|
139
|
+
content +=
|
|
140
|
+
' %macro webout(action,ds,dslabel=,fmt=);\n' +
|
|
141
|
+
' %ms_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt)\n' +
|
|
142
|
+
' %mend;\n';
|
|
143
|
+
return [3 /*break*/, 14];
|
|
144
|
+
case 13: throw new error_1.ServerTypeError();
|
|
145
|
+
case 14:
|
|
129
146
|
content +=
|
|
130
147
|
'/* provide additional debug info */\n' +
|
|
131
148
|
'%global _program;\n' +
|
|
@@ -7,7 +7,10 @@ exports.reactAppFiles = {
|
|
|
7
7
|
{ fileName: 'package.json' },
|
|
8
8
|
{ fileName: 'package-lock.json' },
|
|
9
9
|
{ fileName: 'tsconfig.json' },
|
|
10
|
-
{ fileName: 'README.md' }
|
|
10
|
+
{ fileName: 'README.md' },
|
|
11
|
+
{ fileName: 'webpack.common.js' },
|
|
12
|
+
{ fileName: 'webpack.dev.js' },
|
|
13
|
+
{ fileName: 'webpack.prod.js' }
|
|
11
14
|
],
|
|
12
15
|
subFolders: [
|
|
13
16
|
{
|
|
@@ -36,12 +39,9 @@ exports.reactAppFiles = {
|
|
|
36
39
|
folderName: 'src',
|
|
37
40
|
files: [
|
|
38
41
|
{ fileName: 'App.scss' },
|
|
39
|
-
{ fileName: 'cached_data.ts' },
|
|
40
42
|
{ fileName: 'index.scss' },
|
|
41
43
|
{ fileName: 'index.tsx' },
|
|
42
|
-
{ fileName: 'logo.svg' }
|
|
43
|
-
{ fileName: 'react-app-env.d.ts' },
|
|
44
|
-
{ fileName: 'serviceWorker.ts' }
|
|
44
|
+
{ fileName: 'logo.svg' }
|
|
45
45
|
],
|
|
46
46
|
subFolders: [
|
|
47
47
|
{
|
|
@@ -47,6 +47,7 @@ var build_1 = require("../../build/build");
|
|
|
47
47
|
var deploy_1 = require("../deploy");
|
|
48
48
|
var utils_2 = require("./utils");
|
|
49
49
|
var config_1 = require("../../../utils/config");
|
|
50
|
+
var utils_3 = require("../../../utils");
|
|
50
51
|
describe('sasjs cbd with server type SASJS', function () {
|
|
51
52
|
var target;
|
|
52
53
|
var appName;
|
|
@@ -77,7 +78,7 @@ describe('sasjs cbd with server type SASJS', function () {
|
|
|
77
78
|
});
|
|
78
79
|
}); });
|
|
79
80
|
it("should deploy compile and build to sasjs/server", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
80
|
-
var sasjs, customTarget;
|
|
81
|
+
var sasjs, customTarget, macroCorePath, mf_getuser, mp_jsonout, ms_webout, webout;
|
|
81
82
|
return __generator(this, function (_a) {
|
|
82
83
|
switch (_a.label) {
|
|
83
84
|
case 0:
|
|
@@ -108,6 +109,19 @@ describe('sasjs cbd with server type SASJS', function () {
|
|
|
108
109
|
return [4 /*yield*/, deploy_1.deploy(customTarget, true, sasjs)];
|
|
109
110
|
case 4:
|
|
110
111
|
_a.sent();
|
|
112
|
+
macroCorePath = process.sasjsConstants.macroCorePath;
|
|
113
|
+
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/base/mf_getuser.sas")];
|
|
114
|
+
case 5:
|
|
115
|
+
mf_getuser = _a.sent();
|
|
116
|
+
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/base/mp_jsonout.sas")];
|
|
117
|
+
case 6:
|
|
118
|
+
mp_jsonout = _a.sent();
|
|
119
|
+
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/server/ms_webout.sas")];
|
|
120
|
+
case 7:
|
|
121
|
+
ms_webout = _a.sent();
|
|
122
|
+
webout = ' %macro webout(action,ds,dslabel=,fmt=);\n' +
|
|
123
|
+
' %ms_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt)\n' +
|
|
124
|
+
' %mend;\n';
|
|
111
125
|
expect(sasjs.deployToSASjs).toHaveBeenCalledWith({
|
|
112
126
|
members: [
|
|
113
127
|
{
|
|
@@ -121,12 +135,14 @@ describe('sasjs cbd with server type SASJS', function () {
|
|
|
121
135
|
{
|
|
122
136
|
name: 'appinit',
|
|
123
137
|
type: 'service',
|
|
124
|
-
code:
|
|
138
|
+
code: utils_3.removeComments("" + mf_getuser + mp_jsonout + ms_webout + webout +
|
|
139
|
+
'/* 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* Dependencies start;\n* Dependencies end;\n* Programs start;\n*Programs 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;')
|
|
125
140
|
},
|
|
126
141
|
{
|
|
127
142
|
name: 'getdata',
|
|
128
143
|
type: 'service',
|
|
129
|
-
code:
|
|
144
|
+
code: utils_3.removeComments("" + mf_getuser + mp_jsonout + ms_webout + webout +
|
|
145
|
+
'/* 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* Dependencies start;\n* Dependencies end;\n* Programs start;\n*Programs 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;')
|
|
130
146
|
}
|
|
131
147
|
]
|
|
132
148
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { JSDOM } from 'jsdom';
|
|
2
2
|
export declare const getScriptTags: (parsedHtml: JSDOM) => HTMLScriptElement[];
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const getStyleTags: (parsedHtml: JSDOM) => HTMLLinkElement[];
|
|
4
4
|
export declare const getFaviconTags: (parsedHtml: JSDOM) => HTMLLinkElement[];
|
|
5
|
+
export declare const getImgTags: (parsedHtml: JSDOM) => HTMLImageElement[];
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFaviconTags = exports.
|
|
3
|
+
exports.getImgTags = exports.getFaviconTags = exports.getStyleTags = exports.getScriptTags = void 0;
|
|
4
4
|
var getScriptTags = function (parsedHtml) {
|
|
5
|
-
return Array.from(parsedHtml.window.document.
|
|
5
|
+
return Array.from(parsedHtml.window.document.getElementsByTagName('script'));
|
|
6
6
|
};
|
|
7
7
|
exports.getScriptTags = getScriptTags;
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
return linkTags;
|
|
8
|
+
var getStyleTags = function (parsedHtml) {
|
|
9
|
+
return Array.from(parsedHtml.window.document.getElementsByTagName('link')).filter(function (s) { return s.getAttribute('rel') === 'stylesheet'; });
|
|
11
10
|
};
|
|
12
|
-
exports.
|
|
11
|
+
exports.getStyleTags = getStyleTags;
|
|
13
12
|
var getFaviconTags = function (parsedHtml) {
|
|
14
|
-
|
|
15
|
-
return s.getAttribute('rel') &&
|
|
16
|
-
s.getAttribute('rel') &&
|
|
17
|
-
s.getAttribute('rel').includes('icon');
|
|
18
|
-
});
|
|
19
|
-
return linkTags;
|
|
13
|
+
return Array.from(parsedHtml.window.document.getElementsByTagName('link')).filter(function (s) { var _a; return (_a = s.getAttribute('rel')) === null || _a === void 0 ? void 0 : _a.includes('icon'); });
|
|
20
14
|
};
|
|
21
15
|
exports.getFaviconTags = getFaviconTags;
|
|
16
|
+
var getImgTags = function (parsedHtml) {
|
|
17
|
+
return Array.from(parsedHtml.window.document.getElementsByTagName('img')).filter(function (s) { return s.getAttribute('src'); });
|
|
18
|
+
};
|
|
19
|
+
exports.getImgTags = getImgTags;
|
|
@@ -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\" name='_webout.png'\n contenttype='image/png' 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%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 %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,image/png));\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%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/* stream byte by byte */\n/* in SAS9, JS & CSS files are base64 encoded to avoid UTF8 issues in WLATIN1 metadata */\n%if &type=PNG or &type=ICO or &type=MP3 or &type=JS64 or &type=CSS64 or &type=WAV or &type=OGG\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
|
+
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\" name='_webout.png'\n contenttype='image/png' lrecl=2000000 recfm=n;\n %end;\n %else %if &type=JPG %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.jpg'\n contenttype='image/jpg' lrecl=2000000 recfm=n;\n %end;\n %else %if &type=JPEG %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.jpeg'\n contenttype='image/jpeg' 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%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 %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,image/png));\n %end;\n %else %if &type=JPG %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,image/jpg));\n %end;\n %else %if &type=JPEG %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,image/jpeg));\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%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/* stream byte by byte */\n/* in SAS9, JS & CSS files are base64 encoded to avoid UTF8 issues in WLATIN1 metadata */\n%if &type=PNG or &type=JPG or &type=JPEG or &type=ICO or &type=MP3 or &type=JS64 or &type=CSS64 or &type=WAV or &type=OGG\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\" name='_webout.png'\n contenttype='image/png' 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%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 %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,image/png));\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%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/* stream byte by byte */\n/* in SAS9, JS & CSS files are base64 encoded to avoid UTF8 issues in WLATIN1 metadata */\n%if &type=PNG or &type=ICO or &type=MP3 or &type=JS64 or &type=CSS64 or &type=WAV or &type=OGG\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;";
|
|
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\" name='_webout.png'\n contenttype='image/png' lrecl=2000000 recfm=n;\n %end;\n %else %if &type=JPG %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.jpg'\n contenttype='image/jpg' lrecl=2000000 recfm=n;\n %end;\n %else %if &type=JPEG %then %do;\n filename _webout filesrvc parenturi=\"&SYS_JES_JOB_URI\" name='_webout.jpeg'\n contenttype='image/jpeg' 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%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 %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,image/png));\n %end;\n %else %if &type=JPG %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,image/jpg));\n %end;\n %else %if &type=JPEG %then %do;\n %let rc=%sysfunc(stpsrv_header(Content-type,image/jpeg));\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%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/* stream byte by byte */\n/* in SAS9, JS & CSS files are base64 encoded to avoid UTF8 issues in WLATIN1 metadata */\n%if &type=PNG or &type=JPG or &type=JPEG or &type=ICO or &type=MP3 or &type=JS64 or &type=CSS64 or &type=WAV or &type=OGG\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;";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @jest-environment jsdom
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var updateLinkTag_1 = require("../updateLinkTag");
|
|
7
|
+
describe('updateLinkTag', function () {
|
|
8
|
+
it("should update href of link tag", function () {
|
|
9
|
+
var linkTag = document.createElement('link');
|
|
10
|
+
linkTag.setAttribute('href', './style.css');
|
|
11
|
+
var assetPathMap = [];
|
|
12
|
+
var sasProgramPath = '/SASJobExecution?_FILE=appLoc/services/streamWebFolder/style.css';
|
|
13
|
+
assetPathMap.push({
|
|
14
|
+
source: 'style.css',
|
|
15
|
+
target: sasProgramPath
|
|
16
|
+
});
|
|
17
|
+
updateLinkTag_1.updateLinkTag(linkTag, assetPathMap);
|
|
18
|
+
expect(linkTag.getAttribute('href')).toEqual(sasProgramPath);
|
|
19
|
+
});
|
|
20
|
+
it("should update src of image tag", function () {
|
|
21
|
+
var imgTag = document.createElement('img');
|
|
22
|
+
imgTag.setAttribute('src', './image.jpeg');
|
|
23
|
+
var assetPathMap = [];
|
|
24
|
+
var sasProgramPath = '/SASJobExecution?_FILE=appLoc/services/streamWebFolder/image.jpeg';
|
|
25
|
+
assetPathMap.push({
|
|
26
|
+
source: 'image.jpeg',
|
|
27
|
+
target: sasProgramPath
|
|
28
|
+
});
|
|
29
|
+
updateLinkTag_1.updateLinkTag(imgTag, assetPathMap, 'image');
|
|
30
|
+
expect(imgTag.getAttribute('src')).toEqual(sasProgramPath);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -35,16 +35,37 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
39
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
40
|
+
if (!m) return o;
|
|
41
|
+
var i = m.call(o), r, ar = [], e;
|
|
42
|
+
try {
|
|
43
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
44
|
+
}
|
|
45
|
+
catch (error) { e = { error: error }; }
|
|
46
|
+
finally {
|
|
47
|
+
try {
|
|
48
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
+
}
|
|
50
|
+
finally { if (e) throw e.error; }
|
|
51
|
+
}
|
|
52
|
+
return ar;
|
|
53
|
+
};
|
|
54
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
55
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
56
|
+
to[j] = from[i];
|
|
57
|
+
return to;
|
|
58
|
+
};
|
|
38
59
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
60
|
exports.updateAllTags = void 0;
|
|
40
61
|
var utils_1 = require("@sasjs/utils");
|
|
41
62
|
var getTags_1 = require("./getTags");
|
|
42
63
|
var updateScriptTag_1 = require("./updateScriptTag");
|
|
43
|
-
var
|
|
64
|
+
var updateLinkTag_1 = require("./updateLinkTag");
|
|
44
65
|
var updateAllTags = function (parsedHtml, _a) {
|
|
45
66
|
var webSourcePathFull = _a.webSourcePathFull, destinationPath = _a.destinationPath, serverType = _a.serverType, assetPathMap = _a.assetPathMap;
|
|
46
67
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
47
|
-
var assetsNotFound, scriptTags,
|
|
68
|
+
var assetsNotFound, scriptTags, styleTags, faviconTags, linkTags, imgTags, notFoundErrors;
|
|
48
69
|
return __generator(this, function (_b) {
|
|
49
70
|
switch (_b.label) {
|
|
50
71
|
case 0:
|
|
@@ -62,21 +83,25 @@ var updateAllTags = function (parsedHtml, _a) {
|
|
|
62
83
|
}); })];
|
|
63
84
|
case 1:
|
|
64
85
|
_b.sent();
|
|
65
|
-
|
|
66
|
-
|
|
86
|
+
styleTags = getTags_1.getStyleTags(parsedHtml);
|
|
87
|
+
faviconTags = getTags_1.getFaviconTags(parsedHtml);
|
|
88
|
+
linkTags = __spreadArray(__spreadArray([], __read(styleTags)), __read(faviconTags));
|
|
89
|
+
linkTags.forEach(function (tag) {
|
|
67
90
|
try {
|
|
68
|
-
|
|
91
|
+
updateLinkTag_1.updateLinkTag(tag, assetPathMap);
|
|
69
92
|
}
|
|
70
93
|
catch (error) {
|
|
94
|
+
console.log(tag, error);
|
|
71
95
|
assetsNotFound.push(error);
|
|
72
96
|
}
|
|
73
97
|
});
|
|
74
|
-
|
|
75
|
-
|
|
98
|
+
imgTags = getTags_1.getImgTags(parsedHtml);
|
|
99
|
+
imgTags.forEach(function (tag) {
|
|
76
100
|
try {
|
|
77
|
-
|
|
101
|
+
updateLinkTag_1.updateLinkTag(tag, assetPathMap, 'image');
|
|
78
102
|
}
|
|
79
103
|
catch (error) {
|
|
104
|
+
console.log(tag, error);
|
|
80
105
|
assetsNotFound.push(error);
|
|
81
106
|
}
|
|
82
107
|
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateLinkTag = void 0;
|
|
4
|
+
var updateLinkTag = function (linkTag, assetPathMap, tagType) {
|
|
5
|
+
if (tagType === void 0) { tagType = 'link'; }
|
|
6
|
+
var linkSourcePath = tagType === 'link'
|
|
7
|
+
? linkTag.getAttribute('href')
|
|
8
|
+
: linkTag.getAttribute('src');
|
|
9
|
+
if (!linkSourcePath)
|
|
10
|
+
return;
|
|
11
|
+
var isUrl = linkSourcePath.startsWith('http') || linkSourcePath.startsWith('//');
|
|
12
|
+
if (isUrl)
|
|
13
|
+
return;
|
|
14
|
+
var assetPath = assetPathMap.find(function (entry) {
|
|
15
|
+
return entry.source === linkSourcePath || "./" + entry.source === linkSourcePath;
|
|
16
|
+
});
|
|
17
|
+
if (!(assetPath === null || assetPath === void 0 ? void 0 : assetPath.target)) {
|
|
18
|
+
throw new Error("Unable to find file: " + linkSourcePath);
|
|
19
|
+
}
|
|
20
|
+
tagType === 'link'
|
|
21
|
+
? linkTag.setAttribute('href', assetPath.target)
|
|
22
|
+
: linkTag.setAttribute('src', assetPath.target);
|
|
23
|
+
};
|
|
24
|
+
exports.updateLinkTag = updateLinkTag;
|
package/build/utils/auth.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ServerType, Target } from '@sasjs/utils';
|
|
2
2
|
import SASjs from '@sasjs/adapter/node';
|
|
3
|
-
export declare
|
|
3
|
+
export declare const getAuthUrl: (serverType: ServerType, serverUrl: string, clientId: string) => string;
|
|
4
4
|
export declare function getAuthCode(authUrl: string): Promise<string>;
|
|
5
5
|
/**
|
|
6
6
|
* Checks if the Access Token is expired or is expiring in 1 hour. A default Access Token
|
|
@@ -18,5 +18,11 @@ export declare function isAccessTokenExpiring(token: string): boolean;
|
|
|
18
18
|
* @param {string} token- token string that will be evaluated
|
|
19
19
|
*/
|
|
20
20
|
export declare function isRefreshTokenExpiring(token?: string): boolean;
|
|
21
|
-
export declare function refreshTokens(sasjsInstance: SASjs, clientId: string, clientSecret: string, refreshToken: string): Promise<
|
|
22
|
-
|
|
21
|
+
export declare function refreshTokens(sasjsInstance: SASjs, clientId: string, clientSecret: string, refreshToken: string): Promise<{
|
|
22
|
+
access_token: string;
|
|
23
|
+
refresh_token: string;
|
|
24
|
+
}>;
|
|
25
|
+
export declare function getNewAccessToken(sasjsInstance: SASjs, clientId: string, clientSecret: string, target: Target): Promise<{
|
|
26
|
+
access_token: string;
|
|
27
|
+
refresh_token: string;
|
|
28
|
+
}>;
|
package/build/utils/auth.js
CHANGED
|
@@ -42,9 +42,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
42
42
|
exports.getNewAccessToken = exports.refreshTokens = exports.isRefreshTokenExpiring = exports.isAccessTokenExpiring = exports.getAuthCode = exports.getAuthUrl = void 0;
|
|
43
43
|
var utils_1 = require("@sasjs/utils");
|
|
44
44
|
var jwt_decode_1 = __importDefault(require("jwt-decode"));
|
|
45
|
-
function
|
|
46
|
-
return
|
|
47
|
-
|
|
45
|
+
var getAuthUrl = function (serverType, serverUrl, clientId) {
|
|
46
|
+
return serverType === utils_1.ServerType.Sasjs
|
|
47
|
+
? serverUrl + "/#/SASjsLogon?client_id=" + clientId + "&response_type=code"
|
|
48
|
+
: serverUrl + "/SASLogon/oauth/authorize?client_id=" + clientId + "&response_type=code";
|
|
49
|
+
};
|
|
48
50
|
exports.getAuthUrl = getAuthUrl;
|
|
49
51
|
function getAuthCode(authUrl) {
|
|
50
52
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -100,13 +102,13 @@ function isRefreshTokenExpiring(token) {
|
|
|
100
102
|
exports.isRefreshTokenExpiring = isRefreshTokenExpiring;
|
|
101
103
|
function refreshTokens(sasjsInstance, clientId, clientSecret, refreshToken) {
|
|
102
104
|
return __awaiter(this, void 0, void 0, function () {
|
|
103
|
-
var
|
|
104
|
-
return __generator(this, function (
|
|
105
|
-
switch (
|
|
105
|
+
var _a, access_token, refresh_token;
|
|
106
|
+
return __generator(this, function (_b) {
|
|
107
|
+
switch (_b.label) {
|
|
106
108
|
case 0: return [4 /*yield*/, sasjsInstance.refreshTokens(clientId, clientSecret, refreshToken)];
|
|
107
109
|
case 1:
|
|
108
|
-
|
|
109
|
-
return [2 /*return*/,
|
|
110
|
+
_a = _b.sent(), access_token = _a.access_token, refresh_token = _a.refresh_token;
|
|
111
|
+
return [2 /*return*/, { access_token: access_token, refresh_token: refresh_token }];
|
|
110
112
|
}
|
|
111
113
|
});
|
|
112
114
|
});
|
|
@@ -114,18 +116,18 @@ function refreshTokens(sasjsInstance, clientId, clientSecret, refreshToken) {
|
|
|
114
116
|
exports.refreshTokens = refreshTokens;
|
|
115
117
|
function getNewAccessToken(sasjsInstance, clientId, clientSecret, target) {
|
|
116
118
|
return __awaiter(this, void 0, void 0, function () {
|
|
117
|
-
var authUrl, authCode,
|
|
118
|
-
return __generator(this, function (
|
|
119
|
-
switch (
|
|
119
|
+
var authUrl, authCode, _a, access_token, refresh_token;
|
|
120
|
+
return __generator(this, function (_b) {
|
|
121
|
+
switch (_b.label) {
|
|
120
122
|
case 0:
|
|
121
|
-
authUrl = getAuthUrl(target.serverUrl, clientId);
|
|
123
|
+
authUrl = exports.getAuthUrl(target.serverType, target.serverUrl, clientId);
|
|
122
124
|
return [4 /*yield*/, getAuthCode(authUrl)];
|
|
123
125
|
case 1:
|
|
124
|
-
authCode =
|
|
126
|
+
authCode = _b.sent();
|
|
125
127
|
return [4 /*yield*/, sasjsInstance.getAccessToken(clientId, clientSecret, authCode)];
|
|
126
128
|
case 2:
|
|
127
|
-
|
|
128
|
-
return [2 /*return*/,
|
|
129
|
+
_a = _b.sent(), access_token = _a.access_token, refresh_token = _a.refresh_token;
|
|
130
|
+
return [2 /*return*/, { access_token: access_token, refresh_token: refresh_token }];
|
|
129
131
|
}
|
|
130
132
|
});
|
|
131
133
|
});
|
package/build/utils/config.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export declare function getMacroFolders(target?: Target): Promise<string[]>;
|
|
|
51
51
|
* @param {Target} target- the target to check stream configuration for.
|
|
52
52
|
*/
|
|
53
53
|
export declare function getStreamConfig(target?: Target): Promise<StreamConfig>;
|
|
54
|
-
export declare
|
|
54
|
+
export declare const getMacroCorePath: () => string;
|
|
55
55
|
/**
|
|
56
56
|
* Sanitizes app location string.
|
|
57
57
|
* @param {string} appLoc - app location
|
package/build/utils/config.js
CHANGED
|
@@ -691,10 +691,7 @@ function getStreamConfig(target) {
|
|
|
691
691
|
});
|
|
692
692
|
}
|
|
693
693
|
exports.getStreamConfig = getStreamConfig;
|
|
694
|
-
function
|
|
695
|
-
var macroCorePath = process.sasjsConstants.macroCorePath;
|
|
696
|
-
return macroCorePath;
|
|
697
|
-
}
|
|
694
|
+
var getMacroCorePath = function () { return process.sasjsConstants.macroCorePath; };
|
|
698
695
|
exports.getMacroCorePath = getMacroCorePath;
|
|
699
696
|
/**
|
|
700
697
|
* Sanitizes app location string.
|
|
@@ -761,7 +758,7 @@ exports.getProjectRoot = getProjectRoot;
|
|
|
761
758
|
function getAuthConfig(target) {
|
|
762
759
|
var _a, _b, _c, _d;
|
|
763
760
|
return __awaiter(this, void 0, void 0, function () {
|
|
764
|
-
var access_token, refresh_token, client, secret,
|
|
761
|
+
var access_token, refresh_token, client, secret, sasjs, tokens;
|
|
765
762
|
return __generator(this, function (_e) {
|
|
766
763
|
switch (_e.label) {
|
|
767
764
|
case 0:
|
|
@@ -811,18 +808,19 @@ function getAuthConfig(target) {
|
|
|
811
808
|
httpsAgentOptions: target.httpsAgentOptions,
|
|
812
809
|
serverType: target.serverType
|
|
813
810
|
});
|
|
811
|
+
tokens = void 0;
|
|
814
812
|
if (!auth_1.isRefreshTokenExpiring(refresh_token)) return [3 /*break*/, 4];
|
|
815
813
|
return [4 /*yield*/, auth_1.getNewAccessToken(sasjs, client, secret, target)];
|
|
816
814
|
case 3:
|
|
817
|
-
|
|
815
|
+
tokens = _e.sent();
|
|
818
816
|
return [3 /*break*/, 6];
|
|
819
817
|
case 4: return [4 /*yield*/, auth_1.refreshTokens(sasjs, client, secret, refresh_token)];
|
|
820
818
|
case 5:
|
|
821
|
-
|
|
819
|
+
tokens = _e.sent();
|
|
822
820
|
_e.label = 6;
|
|
823
821
|
case 6:
|
|
824
|
-
access_token = (
|
|
825
|
-
refresh_token = (
|
|
822
|
+
access_token = (tokens === null || tokens === void 0 ? void 0 : tokens.access_token) || access_token;
|
|
823
|
+
refresh_token = (tokens === null || tokens === void 0 ? void 0 : tokens.refresh_token) || refresh_token;
|
|
826
824
|
_e.label = 7;
|
|
827
825
|
case 7: return [2 /*return*/, {
|
|
828
826
|
access_token: access_token,
|
|
@@ -852,7 +850,7 @@ exports.getAuthConfig = getAuthConfig;
|
|
|
852
850
|
function getAccessToken(target, checkIfExpiring) {
|
|
853
851
|
if (checkIfExpiring === void 0) { checkIfExpiring = true; }
|
|
854
852
|
return __awaiter(this, void 0, void 0, function () {
|
|
855
|
-
var accessToken, sasjs, client, secret, refreshToken,
|
|
853
|
+
var accessToken, sasjs, client, secret, refreshToken, tokens;
|
|
856
854
|
return __generator(this, function (_a) {
|
|
857
855
|
switch (_a.label) {
|
|
858
856
|
case 0:
|
|
@@ -907,18 +905,18 @@ function getAccessToken(target, checkIfExpiring) {
|
|
|
907
905
|
(refreshToken.trim() === 'null' || refreshToken.trim() === 'undefined')
|
|
908
906
|
? undefined
|
|
909
907
|
: refreshToken;
|
|
910
|
-
|
|
908
|
+
tokens = void 0;
|
|
911
909
|
if (!auth_1.isRefreshTokenExpiring(refreshToken)) return [3 /*break*/, 4];
|
|
912
910
|
return [4 /*yield*/, auth_1.getNewAccessToken(sasjs, client, secret, target)];
|
|
913
911
|
case 3:
|
|
914
|
-
|
|
912
|
+
tokens = _a.sent();
|
|
915
913
|
return [3 /*break*/, 6];
|
|
916
914
|
case 4: return [4 /*yield*/, auth_1.refreshTokens(sasjs, client, secret, refreshToken)];
|
|
917
915
|
case 5:
|
|
918
|
-
|
|
916
|
+
tokens = _a.sent();
|
|
919
917
|
_a.label = 6;
|
|
920
918
|
case 6:
|
|
921
|
-
accessToken =
|
|
919
|
+
accessToken = tokens === null || tokens === void 0 ? void 0 : tokens.access_token;
|
|
922
920
|
_a.label = 7;
|
|
923
921
|
case 7: return [2 /*return*/, accessToken];
|
|
924
922
|
}
|
package/package.json
CHANGED
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"test:mocked": "jest --silent --runInBand --config=jest.config.js --coverage",
|
|
20
20
|
"semantic-release": "semantic-release -d",
|
|
21
21
|
"lint:fix": "npx prettier --write \"{src,test}/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"",
|
|
22
|
-
"lint": "npx prettier --check \"{src,test}/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\""
|
|
22
|
+
"lint": "npx prettier --check \"{src,test}/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"",
|
|
23
|
+
"prepare": "git rev-parse --git-dir && git config core.hooksPath ./.git-hooks || true"
|
|
23
24
|
},
|
|
24
25
|
"release": {
|
|
25
26
|
"branches": [
|
|
@@ -47,14 +48,9 @@
|
|
|
47
48
|
"publishConfig": {
|
|
48
49
|
"access": "public"
|
|
49
50
|
},
|
|
50
|
-
"config": {
|
|
51
|
-
"ghooks": {
|
|
52
|
-
"commit-msg": "validate-commit-msg"
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
51
|
"dependencies": {
|
|
56
52
|
"@sasjs/adapter": "3.0.0",
|
|
57
|
-
"@sasjs/core": "2.
|
|
53
|
+
"@sasjs/core": "2.54.1",
|
|
58
54
|
"@sasjs/lint": "1.11.2",
|
|
59
55
|
"@sasjs/utils": "2.34.1",
|
|
60
56
|
"chalk": "4.1.2",
|
|
@@ -90,9 +86,8 @@
|
|
|
90
86
|
"@types/xml": "1.0.6",
|
|
91
87
|
"babel-jest": "27.2.4",
|
|
92
88
|
"copyfiles": "2.4.1",
|
|
93
|
-
"ghooks": "2.0.4",
|
|
94
89
|
"jest": "27.2.4",
|
|
95
|
-
"jest-cli": "27.
|
|
90
|
+
"jest-cli": "27.3.1",
|
|
96
91
|
"jest-extended": "1.1.0",
|
|
97
92
|
"nodemon": "2.0.13",
|
|
98
93
|
"semantic-release": "17.4.7",
|
|
@@ -100,8 +95,7 @@
|
|
|
100
95
|
"ts-node": "10.2.1",
|
|
101
96
|
"tslib": "2.3.1",
|
|
102
97
|
"typescript": "4.3.5",
|
|
103
|
-
"util": "0.12.4"
|
|
104
|
-
"validate-commit-msg": "1.1.3"
|
|
98
|
+
"util": "0.12.4"
|
|
105
99
|
},
|
|
106
|
-
"version": "3.0.
|
|
100
|
+
"version": "3.0.4"
|
|
107
101
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
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;
|