@sasjs/adapter 5.2.5 → 6.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/README.md +1 -0
- package/SASjs.d.ts +11 -1
- package/SASjs.js +31 -5
- package/SASjsApiClient.d.ts +10 -1
- package/SASjsApiClient.js +19 -13
- package/auth/AuthManager.d.ts +3 -1
- package/auth/AuthManager.js +4 -2
- package/auth/getAccessTokenForSasjs.d.ts +2 -1
- package/auth/getAccessTokenForSasjs.js +5 -3
- package/auth/getTokens.d.ts +3 -1
- package/auth/getTokens.js +5 -2
- package/auth/refreshTokensForSasjs.d.ts +2 -1
- package/auth/refreshTokensForSasjs.js +5 -3
- package/dist/minified_sas9.js +92 -5
- package/dist/sasjs-adapter.js +156 -30
- package/minified/sas9/SASjs.js +1 -1
- package/package.json +9 -7
- package/types/SASjsConfig.d.ts +6 -2
- package/types/SASjsConfig.js +6 -2
package/README.md
CHANGED
|
@@ -291,6 +291,7 @@ Configuration on the client side involves passing an object on startup, which ca
|
|
|
291
291
|
- `appLoc` - this is the folder (eg in metadata or SAS Drive) under which the SAS services are created.
|
|
292
292
|
- `serverType` - either `SAS9`, `SASVIYA` or `SASJS`. The `SASJS` server type is for use with [sasjs/server](https://github.com/sasjs/server).
|
|
293
293
|
- `serverUrl` - the location (including http protocol and port) of the SAS Server. Can be omitted, eg if serving directly from the SAS Web Server, or in streaming mode.
|
|
294
|
+
- `pathSASJS` - Only relevant when the serverType is `SASJS`. The path the SASjs Server API is mounted at - `/SASjsApi` by default, or `/api` to use the short spelling that sasjs/server also serves. Every SASjs Server route is addressed under this mount, including the stored-program endpoint at `<mount>/stp/execute`, which is not configurable.
|
|
294
295
|
- `debug` - if `true` then SAS Logs and extra debug information is returned.
|
|
295
296
|
- `verbose` - optional, if `true` then a summary of every HTTP response is logged.
|
|
296
297
|
- `loginMechanism` - either `Default` or `Redirected`. See [SAS Logon](#sas-logon) section.
|
package/SASjs.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export default class SASjs {
|
|
|
29
29
|
private sasViyaApiClient;
|
|
30
30
|
private sas9ApiClient;
|
|
31
31
|
private sasJSApiClient;
|
|
32
|
+
/** The mount the cached client was built for, so a change rebuilds it. */
|
|
33
|
+
private sasJSApiBasePath;
|
|
32
34
|
private fileUploader;
|
|
33
35
|
private authManager;
|
|
34
36
|
private requestClient;
|
|
@@ -242,7 +244,15 @@ export default class SASjs {
|
|
|
242
244
|
* Sets the SASjs configuration.
|
|
243
245
|
* @param config - SASjs configuration.
|
|
244
246
|
*/
|
|
245
|
-
setSASjsConfig(config: SASjsConfig): Promise<void>;
|
|
247
|
+
setSASjsConfig(config: Partial<SASjsConfig>): Promise<void>;
|
|
248
|
+
/**
|
|
249
|
+
* The mount every SASjs Server route sits under, read from `pathSASJS`.
|
|
250
|
+
*
|
|
251
|
+
* One knob: deploy, code execution, triggers, sessions, auth and the
|
|
252
|
+
* stored-program endpoint all hang off this, so they cannot end up on
|
|
253
|
+
* different mounts.
|
|
254
|
+
*/
|
|
255
|
+
private getApiBasePath;
|
|
246
256
|
/**
|
|
247
257
|
* Sets the debug state. Turning this on will enable additional logging in the adapter.
|
|
248
258
|
* @param value - boolean indicating debug state (on/off).
|
package/SASjs.js
CHANGED
|
@@ -14,6 +14,7 @@ const types_1 = require("./types");
|
|
|
14
14
|
const SASViyaApiClient_1 = require("./SASViyaApiClient");
|
|
15
15
|
const SAS9ApiClient_1 = require("./SAS9ApiClient");
|
|
16
16
|
const SASjsApiClient_1 = require("./SASjsApiClient");
|
|
17
|
+
const apiBasePath_1 = require("./apiBasePath");
|
|
17
18
|
const auth_1 = require("./auth");
|
|
18
19
|
const types_2 = require("@sasjs/utils/types");
|
|
19
20
|
const RequestClient_1 = require("./request/RequestClient");
|
|
@@ -21,7 +22,9 @@ const SasjsRequestClient_1 = require("./request/SasjsRequestClient");
|
|
|
21
22
|
const job_execution_1 = require("./job-execution");
|
|
22
23
|
const defaultConfig = {
|
|
23
24
|
serverUrl: '',
|
|
24
|
-
|
|
25
|
+
// The one name the adapter needs for SASjs Server: the mount its routes sit
|
|
26
|
+
// under. The stored-program endpoint under it is appended in the callers.
|
|
27
|
+
pathSASJS: apiBasePath_1.DEFAULT_PATH_SASJS,
|
|
25
28
|
pathSAS9: '/SASStoredProcess/do',
|
|
26
29
|
pathSASViya: '/SASJobExecution',
|
|
27
30
|
appLoc: '/Public/seedapp',
|
|
@@ -42,6 +45,8 @@ class SASjs {
|
|
|
42
45
|
this.sasViyaApiClient = null;
|
|
43
46
|
this.sas9ApiClient = null;
|
|
44
47
|
this.sasJSApiClient = null;
|
|
48
|
+
/** The mount the cached client was built for, so a change rebuilds it. */
|
|
49
|
+
this.sasJSApiBasePath = null;
|
|
45
50
|
this.fileUploader = null;
|
|
46
51
|
this.authManager = null;
|
|
47
52
|
this.requestClient = null;
|
|
@@ -433,6 +438,20 @@ class SASjs {
|
|
|
433
438
|
this.setupConfiguration();
|
|
434
439
|
});
|
|
435
440
|
}
|
|
441
|
+
/**
|
|
442
|
+
* The mount every SASjs Server route sits under, read from `pathSASJS`.
|
|
443
|
+
*
|
|
444
|
+
* One knob: deploy, code execution, triggers, sessions, auth and the
|
|
445
|
+
* stored-program endpoint all hang off this, so they cannot end up on
|
|
446
|
+
* different mounts.
|
|
447
|
+
*/
|
|
448
|
+
getApiBasePath() {
|
|
449
|
+
// Only a SASjs Server project has this mount; a Viya or SAS 9 project never
|
|
450
|
+
// reads the value.
|
|
451
|
+
if (this.sasjsConfig.serverType !== types_2.ServerType.Sasjs)
|
|
452
|
+
return apiBasePath_1.DEFAULT_API_BASE_PATH;
|
|
453
|
+
return (0, apiBasePath_1.apiBaseFromPathSASJS)(this.sasjsConfig.pathSASJS);
|
|
454
|
+
}
|
|
436
455
|
/**
|
|
437
456
|
* Sets the debug state. Turning this on will enable additional logging in the adapter.
|
|
438
457
|
* @param value - boolean indicating debug state (on/off).
|
|
@@ -709,13 +728,19 @@ class SASjs {
|
|
|
709
728
|
else {
|
|
710
729
|
this.requestClient.setConfig(this.sasjsConfig.serverUrl, this.sasjsConfig.httpsAgentOptions);
|
|
711
730
|
}
|
|
731
|
+
// A path the executors append `?_program=` to. Viya and SAS 9 name that
|
|
732
|
+
// endpoint outright, so their value is used as it stands; `pathSASJS` names
|
|
733
|
+
// the mount, and the endpoint under it is hard-coded here so a caller cannot
|
|
734
|
+
// point the two at different places.
|
|
735
|
+
const apiBasePath = this.getApiBasePath();
|
|
712
736
|
this.jobsPath =
|
|
713
737
|
this.sasjsConfig.serverType === types_2.ServerType.SasViya
|
|
714
738
|
? this.sasjsConfig.pathSASViya
|
|
715
739
|
: this.sasjsConfig.serverType === types_2.ServerType.Sas9
|
|
716
740
|
? this.sasjsConfig.pathSAS9
|
|
717
|
-
:
|
|
718
|
-
|
|
741
|
+
: // a root mount would otherwise compose '//stp/execute'
|
|
742
|
+
`${(0, apiBasePath_1.apiBasePrefix)(apiBasePath)}${apiBasePath_1.STP_EXECUTE_SUFFIX}`;
|
|
743
|
+
this.authManager = new auth_1.AuthManager(this.sasjsConfig.serverUrl, this.sasjsConfig.serverType, this.requestClient, this.resendWaitingRequests, apiBasePath);
|
|
719
744
|
if (this.sasjsConfig.serverType === types_2.ServerType.SasViya) {
|
|
720
745
|
if (this.sasViyaApiClient) {
|
|
721
746
|
this.sasViyaApiClient.setConfig(this.sasjsConfig.serverUrl, this.sasjsConfig.appLoc);
|
|
@@ -734,8 +759,9 @@ class SASjs {
|
|
|
734
759
|
}
|
|
735
760
|
}
|
|
736
761
|
if (this.sasjsConfig.serverType === types_2.ServerType.Sasjs) {
|
|
737
|
-
if (!this.sasJSApiClient) {
|
|
738
|
-
this.sasJSApiClient = new SASjsApiClient_1.SASjsApiClient(this.requestClient);
|
|
762
|
+
if (!this.sasJSApiClient || this.sasJSApiBasePath !== apiBasePath) {
|
|
763
|
+
this.sasJSApiClient = new SASjsApiClient_1.SASjsApiClient(this.requestClient, apiBasePath);
|
|
764
|
+
this.sasJSApiBasePath = apiBasePath;
|
|
739
765
|
}
|
|
740
766
|
}
|
|
741
767
|
this.fileUploader = new job_execution_1.FileUploader(this.sasjsConfig.serverUrl, this.sasjsConfig.serverType, this.jobsPath, this.requestClient);
|
package/SASjsApiClient.d.ts
CHANGED
|
@@ -23,7 +23,16 @@ export interface ScriptExecutionResult {
|
|
|
23
23
|
export declare const readSasjsState: StateReader;
|
|
24
24
|
export declare class SASjsApiClient {
|
|
25
25
|
private requestClient;
|
|
26
|
-
|
|
26
|
+
/** The mount, absolute: for the hrefs a caller composes onto serverUrl. */
|
|
27
|
+
private apiBase;
|
|
28
|
+
/**
|
|
29
|
+
* The same mount without the leading slash, for requestClient.
|
|
30
|
+
*
|
|
31
|
+
* Requests stay relative on purpose: a `serverUrl` may carry a path prefix
|
|
32
|
+
* (`https://host/sasjs`), and an absolute url would drop it.
|
|
33
|
+
*/
|
|
34
|
+
private apiPath;
|
|
35
|
+
constructor(requestClient: RequestClient, apiBasePath?: string);
|
|
27
36
|
private getAccessTokenForRequest;
|
|
28
37
|
/**
|
|
29
38
|
* Creates the folders and services at the given location `appLoc` on the given server `serverUrl`.
|
package/SASjsApiClient.js
CHANGED
|
@@ -22,6 +22,7 @@ const getAccessTokenForSasjs_1 = require("./auth/getAccessTokenForSasjs");
|
|
|
22
22
|
const refreshTokensForSasjs_1 = require("./auth/refreshTokensForSasjs");
|
|
23
23
|
const getTokens_1 = require("./auth/getTokens");
|
|
24
24
|
const isNode_1 = require("./utils/isNode");
|
|
25
|
+
const apiBasePath_1 = require("./apiBasePath");
|
|
25
26
|
/**
|
|
26
27
|
* How SASjs Server reports the state of a triggered program.
|
|
27
28
|
*
|
|
@@ -38,13 +39,18 @@ const readSasjsState = (body) => {
|
|
|
38
39
|
};
|
|
39
40
|
exports.readSasjsState = readSasjsState;
|
|
40
41
|
class SASjsApiClient {
|
|
41
|
-
constructor(requestClient) {
|
|
42
|
+
constructor(requestClient, apiBasePath = apiBasePath_1.DEFAULT_API_BASE_PATH) {
|
|
42
43
|
this.requestClient = requestClient;
|
|
44
|
+
this.apiBase = (0, apiBasePath_1.normaliseApiBasePath)(apiBasePath);
|
|
45
|
+
// sliced, not replaced with /^\/+/ - normalise already left at most one
|
|
46
|
+
this.apiPath = this.apiBase.startsWith('/')
|
|
47
|
+
? this.apiBase.slice(1)
|
|
48
|
+
: this.apiBase;
|
|
43
49
|
}
|
|
44
50
|
getAccessTokenForRequest(authConfig) {
|
|
45
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
52
|
if (authConfig) {
|
|
47
|
-
const { access_token } = yield (0, getTokens_1.getTokens)(this.requestClient, authConfig, types_1.ServerType.Sasjs);
|
|
53
|
+
const { access_token } = yield (0, getTokens_1.getTokens)(this.requestClient, authConfig, types_1.ServerType.Sasjs, undefined, this.apiBase);
|
|
48
54
|
return access_token;
|
|
49
55
|
}
|
|
50
56
|
});
|
|
@@ -60,7 +66,7 @@ class SASjsApiClient {
|
|
|
60
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
67
|
const access_token = yield this.getAccessTokenForRequest(authConfig);
|
|
62
68
|
dataJson.appLoc = dataJson.appLoc || appLoc;
|
|
63
|
-
const { result } = yield this.requestClient.post(
|
|
69
|
+
const { result } = yield this.requestClient.post(`${this.apiPath}/drive/deploy`, dataJson, access_token, undefined, {}, { maxContentLength: Infinity, maxBodyLength: Infinity });
|
|
64
70
|
return Promise.resolve(result);
|
|
65
71
|
});
|
|
66
72
|
}
|
|
@@ -83,7 +89,7 @@ class SASjsApiClient {
|
|
|
83
89
|
const formData = new form_data_1.default();
|
|
84
90
|
formData.append('file', file);
|
|
85
91
|
const contentType = `multipart/form-data; boundary=${formData.getBoundary()}`;
|
|
86
|
-
const { result } = yield this.requestClient.post(
|
|
92
|
+
const { result } = yield this.requestClient.post(`${this.apiPath}/drive/deploy/upload`, formData, access_token, contentType, {}, { maxContentLength: Infinity, maxBodyLength: Infinity });
|
|
87
93
|
return Promise.resolve(result);
|
|
88
94
|
});
|
|
89
95
|
}
|
|
@@ -96,7 +102,7 @@ class SASjsApiClient {
|
|
|
96
102
|
}
|
|
97
103
|
else
|
|
98
104
|
_program = `${appLoc}/${query._program}`;
|
|
99
|
-
const response = yield this.requestClient.post(
|
|
105
|
+
const response = yield this.requestClient.post(`${this.apiPath}/stp/execute`, Object.assign(Object.assign({ _debug: 131 }, query), { _program }), access_token);
|
|
100
106
|
return { result: response.result, log: response.log };
|
|
101
107
|
});
|
|
102
108
|
}
|
|
@@ -111,7 +117,7 @@ class SASjsApiClient {
|
|
|
111
117
|
const access_token = yield this.getAccessTokenForRequest(authConfig);
|
|
112
118
|
const executionResult = { log: '' };
|
|
113
119
|
yield this.requestClient
|
|
114
|
-
.post(
|
|
120
|
+
.post(`${this.apiPath}/code/execute`, { code, runTime }, access_token)
|
|
115
121
|
.then((res) => {
|
|
116
122
|
const { log, printOutput, result: webout } = res;
|
|
117
123
|
executionResult.log = log;
|
|
@@ -133,7 +139,7 @@ class SASjsApiClient {
|
|
|
133
139
|
*/
|
|
134
140
|
getAccessToken(clientId, authCode) {
|
|
135
141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136
|
-
return (0, getAccessTokenForSasjs_1.getAccessTokenForSasjs)(this.requestClient, clientId, authCode);
|
|
142
|
+
return (0, getAccessTokenForSasjs_1.getAccessTokenForSasjs)(this.requestClient, clientId, authCode, this.apiBase);
|
|
137
143
|
});
|
|
138
144
|
}
|
|
139
145
|
/**
|
|
@@ -176,7 +182,7 @@ class SASjsApiClient {
|
|
|
176
182
|
if (config.debug)
|
|
177
183
|
query.set('_debug', '131');
|
|
178
184
|
const { result } = yield this.requestClient
|
|
179
|
-
.post(
|
|
185
|
+
.post(`${this.apiPath}/stp/trigger?${query.toString()}`, {}, access_token)
|
|
180
186
|
.catch((err) => {
|
|
181
187
|
throw (0, error_1.prefixMessage)(err, 'Error while triggering the program. ');
|
|
182
188
|
});
|
|
@@ -192,17 +198,17 @@ class SASjsApiClient {
|
|
|
192
198
|
const links = [
|
|
193
199
|
{
|
|
194
200
|
rel: 'state',
|
|
195
|
-
href:
|
|
201
|
+
href: `${(0, apiBasePath_1.apiBasePrefix)(this.apiBase)}/session/${result.sessionId}/state`,
|
|
196
202
|
method: 'GET'
|
|
197
203
|
},
|
|
198
204
|
{
|
|
199
205
|
rel: 'log',
|
|
200
|
-
href:
|
|
206
|
+
href: `${(0, apiBasePath_1.apiBasePrefix)(this.apiBase)}/session/${result.sessionId}/log`,
|
|
201
207
|
method: 'GET'
|
|
202
208
|
},
|
|
203
209
|
{
|
|
204
210
|
rel: 'self',
|
|
205
|
-
href:
|
|
211
|
+
href: `${(0, apiBasePath_1.apiBasePrefix)(this.apiBase)}/session/${result.sessionId}`,
|
|
206
212
|
method: 'GET'
|
|
207
213
|
}
|
|
208
214
|
];
|
|
@@ -211,7 +217,7 @@ class SASjsApiClient {
|
|
|
211
217
|
return { job, log: '' };
|
|
212
218
|
const state = yield (0, pollJobState_1.pollJobState)(this.requestClient, job, !!config.debug, authConfig, pollOptions, undefined, onTokensRefreshed, types_1.ServerType.Sasjs, exports.readSasjsState);
|
|
213
219
|
const { result: log } = yield this.requestClient
|
|
214
|
-
.get(
|
|
220
|
+
.get(`${this.apiPath}/session/${result.sessionId}/log`, access_token, 'text/plain')
|
|
215
221
|
.catch(() => ({ result: '' }));
|
|
216
222
|
const finished = Object.assign(Object.assign({}, job), { state });
|
|
217
223
|
if (state === pollJobState_1.JobState.Failed || state === pollJobState_1.JobState.Error)
|
|
@@ -225,7 +231,7 @@ class SASjsApiClient {
|
|
|
225
231
|
*/
|
|
226
232
|
refreshTokens(refreshToken) {
|
|
227
233
|
return __awaiter(this, void 0, void 0, function* () {
|
|
228
|
-
return (0, refreshTokensForSasjs_1.refreshTokensForSasjs)(this.requestClient, refreshToken);
|
|
234
|
+
return (0, refreshTokensForSasjs_1.refreshTokensForSasjs)(this.requestClient, refreshToken, this.apiBase);
|
|
229
235
|
});
|
|
230
236
|
}
|
|
231
237
|
}
|
package/auth/AuthManager.d.ts
CHANGED
|
@@ -10,8 +10,10 @@ export declare class AuthManager {
|
|
|
10
10
|
userLongName: string;
|
|
11
11
|
private loginUrl;
|
|
12
12
|
private logoutUrl;
|
|
13
|
+
/** The mount the SASjs API answers on, normalised once. */
|
|
14
|
+
private apiBase;
|
|
13
15
|
private redirectedLoginUrl;
|
|
14
|
-
constructor(serverUrl: string, serverType: ServerType, requestClient: RequestClient, loginCallback: () => Promise<void
|
|
16
|
+
constructor(serverUrl: string, serverType: ServerType, requestClient: RequestClient, loginCallback: () => Promise<void>, apiBasePath?: string);
|
|
15
17
|
/**
|
|
16
18
|
* Opens Pop up window to SAS Login screen.
|
|
17
19
|
* And checks if user has finished login process.
|
package/auth/AuthManager.js
CHANGED
|
@@ -19,8 +19,9 @@ const verifySas9Login_1 = require("./verifySas9Login");
|
|
|
19
19
|
const verifySasViyaLogin_1 = require("./verifySasViyaLogin");
|
|
20
20
|
const _1 = require("./");
|
|
21
21
|
const host_1 = require("../utils/host");
|
|
22
|
+
const apiBasePath_1 = require("../apiBasePath");
|
|
22
23
|
class AuthManager {
|
|
23
|
-
constructor(serverUrl, serverType, requestClient, loginCallback) {
|
|
24
|
+
constructor(serverUrl, serverType, requestClient, loginCallback, apiBasePath = apiBasePath_1.DEFAULT_API_BASE_PATH) {
|
|
24
25
|
this.serverUrl = serverUrl;
|
|
25
26
|
this.serverType = serverType;
|
|
26
27
|
this.requestClient = requestClient;
|
|
@@ -68,6 +69,7 @@ class AuthManager {
|
|
|
68
69
|
: loginUrl.replace('/SASLogon/login.do', '/SASLogon/login');
|
|
69
70
|
}
|
|
70
71
|
};
|
|
72
|
+
this.apiBase = (0, apiBasePath_1.normaliseApiBasePath)(apiBasePath);
|
|
71
73
|
this.loginUrl = `/SASLogon/login`;
|
|
72
74
|
this.logoutUrl =
|
|
73
75
|
this.serverType === types_1.ServerType.Sas9
|
|
@@ -251,7 +253,7 @@ class AuthManager {
|
|
|
251
253
|
? `${this.serverUrl}/identities/users/@currentUser`
|
|
252
254
|
: this.serverType === types_1.ServerType.Sas9
|
|
253
255
|
? `${this.serverUrl}/SASStoredProcess`
|
|
254
|
-
: `${this.serverUrl}/
|
|
256
|
+
: `${this.serverUrl}${(0, apiBasePath_1.apiBasePrefix)(this.apiBase)}/session`;
|
|
255
257
|
const { result: loginResponse } = yield this.requestClient
|
|
256
258
|
.get(url, undefined, 'text/plain')
|
|
257
259
|
.catch((err) => {
|
|
@@ -4,8 +4,9 @@ import { RequestClient } from '../request/RequestClient';
|
|
|
4
4
|
* @param requestClient - the pre-configured HTTP request client
|
|
5
5
|
* @param clientId - the client ID to authenticate with.
|
|
6
6
|
* @param authCode - the auth code received from the server.
|
|
7
|
+
* @param apiBasePath - the path the API is mounted at, default `/SASjsApi`.
|
|
7
8
|
*/
|
|
8
|
-
export declare function getAccessTokenForSasjs(requestClient: RequestClient, clientId: string, authCode: string): Promise<{
|
|
9
|
+
export declare function getAccessTokenForSasjs(requestClient: RequestClient, clientId: string, authCode: string, apiBasePath?: string): Promise<{
|
|
9
10
|
access_token: string;
|
|
10
11
|
refresh_token: string;
|
|
11
12
|
}>;
|
|
@@ -13,15 +13,17 @@ exports.getAccessTokenForSasjs = getAccessTokenForSasjs;
|
|
|
13
13
|
const error_1 = require("@sasjs/utils/error");
|
|
14
14
|
const getTokenRequestErrorPrefix_1 = require("./getTokenRequestErrorPrefix");
|
|
15
15
|
const types_1 = require("@sasjs/utils/types");
|
|
16
|
+
const apiBasePath_1 = require("../apiBasePath");
|
|
16
17
|
/**
|
|
17
18
|
* Exchanges the auth code for an access token for the given client.
|
|
18
19
|
* @param requestClient - the pre-configured HTTP request client
|
|
19
20
|
* @param clientId - the client ID to authenticate with.
|
|
20
21
|
* @param authCode - the auth code received from the server.
|
|
22
|
+
* @param apiBasePath - the path the API is mounted at, default `/SASjsApi`.
|
|
21
23
|
*/
|
|
22
|
-
function getAccessTokenForSasjs(
|
|
23
|
-
return __awaiter(this,
|
|
24
|
-
const url =
|
|
24
|
+
function getAccessTokenForSasjs(requestClient_1, clientId_1, authCode_1) {
|
|
25
|
+
return __awaiter(this, arguments, void 0, function* (requestClient, clientId, authCode, apiBasePath = apiBasePath_1.DEFAULT_API_BASE_PATH) {
|
|
26
|
+
const url = `${(0, apiBasePath_1.apiBasePrefix)(apiBasePath)}/auth/token`;
|
|
25
27
|
const data = {
|
|
26
28
|
clientId,
|
|
27
29
|
code: authCode
|
package/auth/getTokens.d.ts
CHANGED
|
@@ -18,5 +18,7 @@ export type OnTokensRefreshed = (tokens: {
|
|
|
18
18
|
* @param serverType - server type for which refreshing the tokens, defaults to SASVIYA
|
|
19
19
|
* @param onTokensRefreshed - optional callback invoked with the rotated token
|
|
20
20
|
* pair after a successful internal refresh.
|
|
21
|
+
* @param apiBasePath - the path the SASjs API is mounted at, default `/SASjsApi`.
|
|
22
|
+
* Only used for `ServerType.Sasjs`.
|
|
21
23
|
*/
|
|
22
|
-
export declare function getTokens(requestClient: RequestClient, authConfig: AuthConfig, serverType?: ServerType, onTokensRefreshed?: OnTokensRefreshed): Promise<AuthConfig>;
|
|
24
|
+
export declare function getTokens(requestClient: RequestClient, authConfig: AuthConfig, serverType?: ServerType, onTokensRefreshed?: OnTokensRefreshed, apiBasePath?: string): Promise<AuthConfig>;
|
package/auth/getTokens.js
CHANGED
|
@@ -15,6 +15,7 @@ const types_1 = require("@sasjs/utils/types");
|
|
|
15
15
|
const refreshTokensForViya_1 = require("./refreshTokensForViya");
|
|
16
16
|
const refreshTokensForSasjs_1 = require("./refreshTokensForSasjs");
|
|
17
17
|
const host_1 = require("../utils/host");
|
|
18
|
+
const apiBasePath_1 = require("../apiBasePath");
|
|
18
19
|
/**
|
|
19
20
|
* Returns the auth configuration, refreshing the tokens if necessary.
|
|
20
21
|
* This function can only be used by Node, if a server type is SASVIYA.
|
|
@@ -23,9 +24,11 @@ const host_1 = require("../utils/host");
|
|
|
23
24
|
* @param serverType - server type for which refreshing the tokens, defaults to SASVIYA
|
|
24
25
|
* @param onTokensRefreshed - optional callback invoked with the rotated token
|
|
25
26
|
* pair after a successful internal refresh.
|
|
27
|
+
* @param apiBasePath - the path the SASjs API is mounted at, default `/SASjsApi`.
|
|
28
|
+
* Only used for `ServerType.Sasjs`.
|
|
26
29
|
*/
|
|
27
30
|
function getTokens(requestClient_1, authConfig_1) {
|
|
28
|
-
return __awaiter(this, arguments, void 0, function* (requestClient, authConfig, serverType = types_1.ServerType.SasViya, onTokensRefreshed) {
|
|
31
|
+
return __awaiter(this, arguments, void 0, function* (requestClient, authConfig, serverType = types_1.ServerType.SasViya, onTokensRefreshed, apiBasePath = apiBasePath_1.DEFAULT_API_BASE_PATH) {
|
|
29
32
|
const logger = (0, host_1.getLogger)();
|
|
30
33
|
// Note: client/secret are NOT mutated. The sas.cli public-client fallback
|
|
31
34
|
// is applied only to the refresh call itself, so a caller that round-trips
|
|
@@ -83,7 +86,7 @@ function getTokens(requestClient_1, authConfig_1) {
|
|
|
83
86
|
// with a missing secret is treated as a public client (empty secret).
|
|
84
87
|
const tokens = serverType === types_1.ServerType.SasViya
|
|
85
88
|
? yield (0, refreshTokensForViya_1.refreshTokensForViya)(requestClient, client || 'sas.cli', secret || '', refresh_token)
|
|
86
|
-
: yield (0, refreshTokensForSasjs_1.refreshTokensForSasjs)(requestClient, refresh_token);
|
|
89
|
+
: yield (0, refreshTokensForSasjs_1.refreshTokensForSasjs)(requestClient, refresh_token, apiBasePath);
|
|
87
90
|
({ access_token, refresh_token } = tokens);
|
|
88
91
|
// Viya refresh tokens are single-use/rotating. Callers throughout the
|
|
89
92
|
// compute-execution chain (executeOnComputeApi, pollJobState's poll
|
|
@@ -3,8 +3,9 @@ import { RequestClient } from '../request/RequestClient';
|
|
|
3
3
|
* Exchanges the refresh token for an access token for the given client.
|
|
4
4
|
* @param requestClient - the pre-configured HTTP request client
|
|
5
5
|
* @param refreshToken - the refresh token received from the server.
|
|
6
|
+
* @param apiBasePath - the path the API is mounted at, default `/SASjsApi`.
|
|
6
7
|
*/
|
|
7
|
-
export declare function refreshTokensForSasjs(requestClient: RequestClient, refreshToken: string): Promise<{
|
|
8
|
+
export declare function refreshTokensForSasjs(requestClient: RequestClient, refreshToken: string, apiBasePath?: string): Promise<{
|
|
8
9
|
access_token: string;
|
|
9
10
|
refresh_token: string;
|
|
10
11
|
}>;
|
|
@@ -13,14 +13,16 @@ exports.refreshTokensForSasjs = refreshTokensForSasjs;
|
|
|
13
13
|
const error_1 = require("@sasjs/utils/error");
|
|
14
14
|
const getTokenRequestErrorPrefix_1 = require("./getTokenRequestErrorPrefix");
|
|
15
15
|
const types_1 = require("@sasjs/utils/types");
|
|
16
|
+
const apiBasePath_1 = require("../apiBasePath");
|
|
16
17
|
/**
|
|
17
18
|
* Exchanges the refresh token for an access token for the given client.
|
|
18
19
|
* @param requestClient - the pre-configured HTTP request client
|
|
19
20
|
* @param refreshToken - the refresh token received from the server.
|
|
21
|
+
* @param apiBasePath - the path the API is mounted at, default `/SASjsApi`.
|
|
20
22
|
*/
|
|
21
|
-
function refreshTokensForSasjs(
|
|
22
|
-
return __awaiter(this,
|
|
23
|
-
const url =
|
|
23
|
+
function refreshTokensForSasjs(requestClient_1, refreshToken_1) {
|
|
24
|
+
return __awaiter(this, arguments, void 0, function* (requestClient, refreshToken, apiBasePath = apiBasePath_1.DEFAULT_API_BASE_PATH) {
|
|
25
|
+
const url = `${(0, apiBasePath_1.apiBasePrefix)(apiBasePath)}/auth/refresh`;
|
|
24
26
|
const headers = {
|
|
25
27
|
Authorization: 'Bearer ' + refreshToken
|
|
26
28
|
};
|
package/dist/minified_sas9.js
CHANGED
|
@@ -1169,6 +1169,87 @@ exports.isHttpsUri = isHttpsUri;
|
|
|
1169
1169
|
module.exports = typeof self === 'object' ? self.FormData : window.FormData;
|
|
1170
1170
|
|
|
1171
1171
|
|
|
1172
|
+
/***/ },
|
|
1173
|
+
|
|
1174
|
+
/***/ 6838
|
|
1175
|
+
(__unused_webpack_module, exports) {
|
|
1176
|
+
|
|
1177
|
+
"use strict";
|
|
1178
|
+
var __webpack_unused_export__;
|
|
1179
|
+
|
|
1180
|
+
__webpack_unused_export__ = ({ value: true });
|
|
1181
|
+
__webpack_unused_export__ = exports.apiBasePrefix = exports.normaliseApiBasePath = exports.DEFAULT_API_BASE_PATH = exports.STP_EXECUTE_SUFFIX = exports.DEFAULT_PATH_SASJS = void 0;
|
|
1182
|
+
/**
|
|
1183
|
+
* Where the SASjs Server API is mounted.
|
|
1184
|
+
*
|
|
1185
|
+
* This is the one name the adapter needs for a SASjs Server, and it is the same
|
|
1186
|
+
* kind of value as `pathSASViya` - a single path that says where this server
|
|
1187
|
+
* type's endpoints live. Servers from the release that introduced the short
|
|
1188
|
+
* paths answer `/api` as well, and a project may prefer that spelling for what
|
|
1189
|
+
* it shows in a URL, a log or a network panel.
|
|
1190
|
+
*/
|
|
1191
|
+
exports.DEFAULT_PATH_SASJS = '/SASjsApi';
|
|
1192
|
+
/** The stored-program endpoint under that mount. Hard-coded, not configurable. */
|
|
1193
|
+
exports.STP_EXECUTE_SUFFIX = '/stp/execute';
|
|
1194
|
+
/** The mount used by the URL builders when no config reaches them. */
|
|
1195
|
+
exports.DEFAULT_API_BASE_PATH = exports.DEFAULT_PATH_SASJS;
|
|
1196
|
+
/**
|
|
1197
|
+
* A base path the URL builders can concatenate with confidence: one leading
|
|
1198
|
+
* slash, no trailing one. `SASjsApi`, `/SASjsApi/` and ` /SASjsApi ` all mean
|
|
1199
|
+
* the same mount, and a trailing slash here would double up in every path.
|
|
1200
|
+
*/
|
|
1201
|
+
const normaliseApiBasePath = (path) => {
|
|
1202
|
+
const raw = (path || '').trim();
|
|
1203
|
+
// Absent and empty mean the default. A value of only slashes is the root
|
|
1204
|
+
// mount, and is a real deployment - a proxy that puts the API at the origin -
|
|
1205
|
+
// so the two are separated before the runs are stripped, or both would fold
|
|
1206
|
+
// into the default.
|
|
1207
|
+
if (!raw)
|
|
1208
|
+
return exports.DEFAULT_PATH_SASJS;
|
|
1209
|
+
// Scanned rather than matched with /^\/+|\/+$/ : a run of slashes makes that
|
|
1210
|
+
// pattern backtrack, which is the kind of input a config value can carry by
|
|
1211
|
+
// accident, and CodeQL flags it.
|
|
1212
|
+
let first = 0;
|
|
1213
|
+
while (first < raw.length && raw.charAt(first) === '/')
|
|
1214
|
+
first++;
|
|
1215
|
+
let last = raw.length;
|
|
1216
|
+
while (last > first && raw.charAt(last - 1) === '/')
|
|
1217
|
+
last--;
|
|
1218
|
+
const middle = raw.slice(first, last);
|
|
1219
|
+
return middle ? `/${middle}` : '/';
|
|
1220
|
+
};
|
|
1221
|
+
exports.normaliseApiBasePath = normaliseApiBasePath;
|
|
1222
|
+
/**
|
|
1223
|
+
* The mount as callers concatenate it.
|
|
1224
|
+
*
|
|
1225
|
+
* A root mount contributes nothing, so a URL built as
|
|
1226
|
+
* `${serverUrl}${apiBasePrefix(base)}/session` is `https://host/session` rather
|
|
1227
|
+
* than `https://host//session`. Every place that composes a path by hand uses
|
|
1228
|
+
* this, because a doubled slash is a different URL to a proxy.
|
|
1229
|
+
*/
|
|
1230
|
+
const apiBasePrefix = (base) => (0, exports.normaliseApiBasePath)(base) === '/' ? '' : (0, exports.normaliseApiBasePath)(base);
|
|
1231
|
+
exports.apiBasePrefix = apiBasePrefix;
|
|
1232
|
+
/**
|
|
1233
|
+
* The mount, read from `pathSASJS`.
|
|
1234
|
+
*
|
|
1235
|
+
* `pathSASJS` names the mount itself (`/SASjsApi`, `/api`); the stored-program
|
|
1236
|
+
* endpoint under it is `/stp/execute` and is appended by the code that calls it,
|
|
1237
|
+
* so there is one place a stub path can be got wrong instead of a config value
|
|
1238
|
+
* that has to agree with it.
|
|
1239
|
+
*
|
|
1240
|
+
* A value carrying the endpoint - `/api/stp/execute` - is accepted and read as
|
|
1241
|
+
* the mount it names, because that spelling appears in earlier documentation and
|
|
1242
|
+
* in bookmarks, and the two mean the same server.
|
|
1243
|
+
*/
|
|
1244
|
+
const apiBaseFromPathSASJS = (pathSASJS) => {
|
|
1245
|
+
const base = (0, exports.normaliseApiBasePath)(pathSASJS);
|
|
1246
|
+
if (base.endsWith(exports.STP_EXECUTE_SUFFIX))
|
|
1247
|
+
return base.slice(0, -exports.STP_EXECUTE_SUFFIX.length) || '/';
|
|
1248
|
+
return base;
|
|
1249
|
+
};
|
|
1250
|
+
__webpack_unused_export__ = apiBaseFromPathSASJS;
|
|
1251
|
+
|
|
1252
|
+
|
|
1172
1253
|
/***/ },
|
|
1173
1254
|
|
|
1174
1255
|
/***/ 7710
|
|
@@ -1196,8 +1277,9 @@ const verifySas9Login_1 = __webpack_require__(4257);
|
|
|
1196
1277
|
const verifySasViyaLogin_1 = __webpack_require__(5009);
|
|
1197
1278
|
const _1 = __webpack_require__(4879);
|
|
1198
1279
|
const host_1 = __webpack_require__(5334);
|
|
1280
|
+
const apiBasePath_1 = __webpack_require__(6838);
|
|
1199
1281
|
class AuthManager {
|
|
1200
|
-
constructor(serverUrl, serverType, requestClient, loginCallback) {
|
|
1282
|
+
constructor(serverUrl, serverType, requestClient, loginCallback, apiBasePath = apiBasePath_1.DEFAULT_API_BASE_PATH) {
|
|
1201
1283
|
this.serverUrl = serverUrl;
|
|
1202
1284
|
this.serverType = serverType;
|
|
1203
1285
|
this.requestClient = requestClient;
|
|
@@ -1245,6 +1327,7 @@ class AuthManager {
|
|
|
1245
1327
|
: loginUrl.replace('/SASLogon/login.do', '/SASLogon/login');
|
|
1246
1328
|
}
|
|
1247
1329
|
};
|
|
1330
|
+
this.apiBase = (0, apiBasePath_1.normaliseApiBasePath)(apiBasePath);
|
|
1248
1331
|
this.loginUrl = `/SASLogon/login`;
|
|
1249
1332
|
this.logoutUrl =
|
|
1250
1333
|
this.serverType === types_1.ServerType.Sas9
|
|
@@ -1428,7 +1511,7 @@ class AuthManager {
|
|
|
1428
1511
|
? `${this.serverUrl}/identities/users/@currentUser`
|
|
1429
1512
|
: this.serverType === types_1.ServerType.Sas9
|
|
1430
1513
|
? `${this.serverUrl}/SASStoredProcess`
|
|
1431
|
-
: `${this.serverUrl}/
|
|
1514
|
+
: `${this.serverUrl}${(0, apiBasePath_1.apiBasePrefix)(this.apiBase)}/session`;
|
|
1432
1515
|
const { result: loginResponse } = yield this.requestClient
|
|
1433
1516
|
.get(url, undefined, 'text/plain')
|
|
1434
1517
|
.catch((err) => {
|
|
@@ -1963,7 +2046,7 @@ const WebJobExecutor_1 = __webpack_require__(3215);
|
|
|
1963
2046
|
const ErrorResponse_1 = __webpack_require__(4845);
|
|
1964
2047
|
const defaultConfig = {
|
|
1965
2048
|
serverUrl: '',
|
|
1966
|
-
pathSASJS: '/SASjsApi
|
|
2049
|
+
pathSASJS: '/SASjsApi',
|
|
1967
2050
|
pathSAS9: '/SASStoredProcess/do',
|
|
1968
2051
|
pathSASViya: '/SASJobExecution',
|
|
1969
2052
|
appLoc: '/Public/seedapp',
|
|
@@ -3152,8 +3235,12 @@ class SASjsConfig {
|
|
|
3152
3235
|
*/
|
|
3153
3236
|
this.serverUrl = '';
|
|
3154
3237
|
/**
|
|
3155
|
-
* The
|
|
3156
|
-
*
|
|
3238
|
+
* The mount the SASjs Server API answers on.
|
|
3239
|
+
*
|
|
3240
|
+
* Defaults to '/SASjsApi'; '/api' selects the short spelling sasjs/server also
|
|
3241
|
+
* serves. The stored-program endpoint is not configurable: it is
|
|
3242
|
+
* `<mount>/stp/execute`, appended by the callers, so this value names the mount
|
|
3243
|
+
* and nothing else.
|
|
3157
3244
|
*/
|
|
3158
3245
|
this.pathSASJS = '';
|
|
3159
3246
|
/**
|
package/dist/sasjs-adapter.js
CHANGED
|
@@ -3908,6 +3908,7 @@ const types_1 = __webpack_require__(3574);
|
|
|
3908
3908
|
const SASViyaApiClient_1 = __webpack_require__(2015);
|
|
3909
3909
|
const SAS9ApiClient_1 = __webpack_require__(2831);
|
|
3910
3910
|
const SASjsApiClient_1 = __webpack_require__(5803);
|
|
3911
|
+
const apiBasePath_1 = __webpack_require__(6838);
|
|
3911
3912
|
const auth_1 = __webpack_require__(4879);
|
|
3912
3913
|
const types_2 = __webpack_require__(3631);
|
|
3913
3914
|
const RequestClient_1 = __webpack_require__(8816);
|
|
@@ -3915,7 +3916,9 @@ const SasjsRequestClient_1 = __webpack_require__(7560);
|
|
|
3915
3916
|
const job_execution_1 = __webpack_require__(1391);
|
|
3916
3917
|
const defaultConfig = {
|
|
3917
3918
|
serverUrl: '',
|
|
3918
|
-
|
|
3919
|
+
// The one name the adapter needs for SASjs Server: the mount its routes sit
|
|
3920
|
+
// under. The stored-program endpoint under it is appended in the callers.
|
|
3921
|
+
pathSASJS: apiBasePath_1.DEFAULT_PATH_SASJS,
|
|
3919
3922
|
pathSAS9: '/SASStoredProcess/do',
|
|
3920
3923
|
pathSASViya: '/SASJobExecution',
|
|
3921
3924
|
appLoc: '/Public/seedapp',
|
|
@@ -3936,6 +3939,8 @@ class SASjs {
|
|
|
3936
3939
|
this.sasViyaApiClient = null;
|
|
3937
3940
|
this.sas9ApiClient = null;
|
|
3938
3941
|
this.sasJSApiClient = null;
|
|
3942
|
+
/** The mount the cached client was built for, so a change rebuilds it. */
|
|
3943
|
+
this.sasJSApiBasePath = null;
|
|
3939
3944
|
this.fileUploader = null;
|
|
3940
3945
|
this.authManager = null;
|
|
3941
3946
|
this.requestClient = null;
|
|
@@ -4327,6 +4332,20 @@ class SASjs {
|
|
|
4327
4332
|
this.setupConfiguration();
|
|
4328
4333
|
});
|
|
4329
4334
|
}
|
|
4335
|
+
/**
|
|
4336
|
+
* The mount every SASjs Server route sits under, read from `pathSASJS`.
|
|
4337
|
+
*
|
|
4338
|
+
* One knob: deploy, code execution, triggers, sessions, auth and the
|
|
4339
|
+
* stored-program endpoint all hang off this, so they cannot end up on
|
|
4340
|
+
* different mounts.
|
|
4341
|
+
*/
|
|
4342
|
+
getApiBasePath() {
|
|
4343
|
+
// Only a SASjs Server project has this mount; a Viya or SAS 9 project never
|
|
4344
|
+
// reads the value.
|
|
4345
|
+
if (this.sasjsConfig.serverType !== types_2.ServerType.Sasjs)
|
|
4346
|
+
return apiBasePath_1.DEFAULT_API_BASE_PATH;
|
|
4347
|
+
return (0, apiBasePath_1.apiBaseFromPathSASJS)(this.sasjsConfig.pathSASJS);
|
|
4348
|
+
}
|
|
4330
4349
|
/**
|
|
4331
4350
|
* Sets the debug state. Turning this on will enable additional logging in the adapter.
|
|
4332
4351
|
* @param value - boolean indicating debug state (on/off).
|
|
@@ -4603,13 +4622,19 @@ class SASjs {
|
|
|
4603
4622
|
else {
|
|
4604
4623
|
this.requestClient.setConfig(this.sasjsConfig.serverUrl, this.sasjsConfig.httpsAgentOptions);
|
|
4605
4624
|
}
|
|
4625
|
+
// A path the executors append `?_program=` to. Viya and SAS 9 name that
|
|
4626
|
+
// endpoint outright, so their value is used as it stands; `pathSASJS` names
|
|
4627
|
+
// the mount, and the endpoint under it is hard-coded here so a caller cannot
|
|
4628
|
+
// point the two at different places.
|
|
4629
|
+
const apiBasePath = this.getApiBasePath();
|
|
4606
4630
|
this.jobsPath =
|
|
4607
4631
|
this.sasjsConfig.serverType === types_2.ServerType.SasViya
|
|
4608
4632
|
? this.sasjsConfig.pathSASViya
|
|
4609
4633
|
: this.sasjsConfig.serverType === types_2.ServerType.Sas9
|
|
4610
4634
|
? this.sasjsConfig.pathSAS9
|
|
4611
|
-
:
|
|
4612
|
-
|
|
4635
|
+
: // a root mount would otherwise compose '//stp/execute'
|
|
4636
|
+
`${(0, apiBasePath_1.apiBasePrefix)(apiBasePath)}${apiBasePath_1.STP_EXECUTE_SUFFIX}`;
|
|
4637
|
+
this.authManager = new auth_1.AuthManager(this.sasjsConfig.serverUrl, this.sasjsConfig.serverType, this.requestClient, this.resendWaitingRequests, apiBasePath);
|
|
4613
4638
|
if (this.sasjsConfig.serverType === types_2.ServerType.SasViya) {
|
|
4614
4639
|
if (this.sasViyaApiClient) {
|
|
4615
4640
|
this.sasViyaApiClient.setConfig(this.sasjsConfig.serverUrl, this.sasjsConfig.appLoc);
|
|
@@ -4628,8 +4653,9 @@ class SASjs {
|
|
|
4628
4653
|
}
|
|
4629
4654
|
}
|
|
4630
4655
|
if (this.sasjsConfig.serverType === types_2.ServerType.Sasjs) {
|
|
4631
|
-
if (!this.sasJSApiClient) {
|
|
4632
|
-
this.sasJSApiClient = new SASjsApiClient_1.SASjsApiClient(this.requestClient);
|
|
4656
|
+
if (!this.sasJSApiClient || this.sasJSApiBasePath !== apiBasePath) {
|
|
4657
|
+
this.sasJSApiClient = new SASjsApiClient_1.SASjsApiClient(this.requestClient, apiBasePath);
|
|
4658
|
+
this.sasJSApiBasePath = apiBasePath;
|
|
4633
4659
|
}
|
|
4634
4660
|
}
|
|
4635
4661
|
this.fileUploader = new job_execution_1.FileUploader(this.sasjsConfig.serverUrl, this.sasjsConfig.serverType, this.jobsPath, this.requestClient);
|
|
@@ -4726,6 +4752,7 @@ const getAccessTokenForSasjs_1 = __webpack_require__(9239);
|
|
|
4726
4752
|
const refreshTokensForSasjs_1 = __webpack_require__(6725);
|
|
4727
4753
|
const getTokens_1 = __webpack_require__(9609);
|
|
4728
4754
|
const isNode_1 = __webpack_require__(6308);
|
|
4755
|
+
const apiBasePath_1 = __webpack_require__(6838);
|
|
4729
4756
|
/**
|
|
4730
4757
|
* How SASjs Server reports the state of a triggered program.
|
|
4731
4758
|
*
|
|
@@ -4742,13 +4769,18 @@ const readSasjsState = (body) => {
|
|
|
4742
4769
|
};
|
|
4743
4770
|
exports.readSasjsState = readSasjsState;
|
|
4744
4771
|
class SASjsApiClient {
|
|
4745
|
-
constructor(requestClient) {
|
|
4772
|
+
constructor(requestClient, apiBasePath = apiBasePath_1.DEFAULT_API_BASE_PATH) {
|
|
4746
4773
|
this.requestClient = requestClient;
|
|
4774
|
+
this.apiBase = (0, apiBasePath_1.normaliseApiBasePath)(apiBasePath);
|
|
4775
|
+
// sliced, not replaced with /^\/+/ - normalise already left at most one
|
|
4776
|
+
this.apiPath = this.apiBase.startsWith('/')
|
|
4777
|
+
? this.apiBase.slice(1)
|
|
4778
|
+
: this.apiBase;
|
|
4747
4779
|
}
|
|
4748
4780
|
getAccessTokenForRequest(authConfig) {
|
|
4749
4781
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4750
4782
|
if (authConfig) {
|
|
4751
|
-
const { access_token } = yield (0, getTokens_1.getTokens)(this.requestClient, authConfig, types_1.ServerType.Sasjs);
|
|
4783
|
+
const { access_token } = yield (0, getTokens_1.getTokens)(this.requestClient, authConfig, types_1.ServerType.Sasjs, undefined, this.apiBase);
|
|
4752
4784
|
return access_token;
|
|
4753
4785
|
}
|
|
4754
4786
|
});
|
|
@@ -4764,7 +4796,7 @@ class SASjsApiClient {
|
|
|
4764
4796
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4765
4797
|
const access_token = yield this.getAccessTokenForRequest(authConfig);
|
|
4766
4798
|
dataJson.appLoc = dataJson.appLoc || appLoc;
|
|
4767
|
-
const { result } = yield this.requestClient.post(
|
|
4799
|
+
const { result } = yield this.requestClient.post(`${this.apiPath}/drive/deploy`, dataJson, access_token, undefined, {}, { maxContentLength: Infinity, maxBodyLength: Infinity });
|
|
4768
4800
|
return Promise.resolve(result);
|
|
4769
4801
|
});
|
|
4770
4802
|
}
|
|
@@ -4787,7 +4819,7 @@ class SASjsApiClient {
|
|
|
4787
4819
|
const formData = new form_data_1.default();
|
|
4788
4820
|
formData.append('file', file);
|
|
4789
4821
|
const contentType = `multipart/form-data; boundary=${formData.getBoundary()}`;
|
|
4790
|
-
const { result } = yield this.requestClient.post(
|
|
4822
|
+
const { result } = yield this.requestClient.post(`${this.apiPath}/drive/deploy/upload`, formData, access_token, contentType, {}, { maxContentLength: Infinity, maxBodyLength: Infinity });
|
|
4791
4823
|
return Promise.resolve(result);
|
|
4792
4824
|
});
|
|
4793
4825
|
}
|
|
@@ -4800,7 +4832,7 @@ class SASjsApiClient {
|
|
|
4800
4832
|
}
|
|
4801
4833
|
else
|
|
4802
4834
|
_program = `${appLoc}/${query._program}`;
|
|
4803
|
-
const response = yield this.requestClient.post(
|
|
4835
|
+
const response = yield this.requestClient.post(`${this.apiPath}/stp/execute`, Object.assign(Object.assign({ _debug: 131 }, query), { _program }), access_token);
|
|
4804
4836
|
return { result: response.result, log: response.log };
|
|
4805
4837
|
});
|
|
4806
4838
|
}
|
|
@@ -4815,7 +4847,7 @@ class SASjsApiClient {
|
|
|
4815
4847
|
const access_token = yield this.getAccessTokenForRequest(authConfig);
|
|
4816
4848
|
const executionResult = { log: '' };
|
|
4817
4849
|
yield this.requestClient
|
|
4818
|
-
.post(
|
|
4850
|
+
.post(`${this.apiPath}/code/execute`, { code, runTime }, access_token)
|
|
4819
4851
|
.then((res) => {
|
|
4820
4852
|
const { log, printOutput, result: webout } = res;
|
|
4821
4853
|
executionResult.log = log;
|
|
@@ -4837,7 +4869,7 @@ class SASjsApiClient {
|
|
|
4837
4869
|
*/
|
|
4838
4870
|
getAccessToken(clientId, authCode) {
|
|
4839
4871
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4840
|
-
return (0, getAccessTokenForSasjs_1.getAccessTokenForSasjs)(this.requestClient, clientId, authCode);
|
|
4872
|
+
return (0, getAccessTokenForSasjs_1.getAccessTokenForSasjs)(this.requestClient, clientId, authCode, this.apiBase);
|
|
4841
4873
|
});
|
|
4842
4874
|
}
|
|
4843
4875
|
/**
|
|
@@ -4880,7 +4912,7 @@ class SASjsApiClient {
|
|
|
4880
4912
|
if (config.debug)
|
|
4881
4913
|
query.set('_debug', '131');
|
|
4882
4914
|
const { result } = yield this.requestClient
|
|
4883
|
-
.post(
|
|
4915
|
+
.post(`${this.apiPath}/stp/trigger?${query.toString()}`, {}, access_token)
|
|
4884
4916
|
.catch((err) => {
|
|
4885
4917
|
throw (0, error_1.prefixMessage)(err, 'Error while triggering the program. ');
|
|
4886
4918
|
});
|
|
@@ -4896,17 +4928,17 @@ class SASjsApiClient {
|
|
|
4896
4928
|
const links = [
|
|
4897
4929
|
{
|
|
4898
4930
|
rel: 'state',
|
|
4899
|
-
href:
|
|
4931
|
+
href: `${(0, apiBasePath_1.apiBasePrefix)(this.apiBase)}/session/${result.sessionId}/state`,
|
|
4900
4932
|
method: 'GET'
|
|
4901
4933
|
},
|
|
4902
4934
|
{
|
|
4903
4935
|
rel: 'log',
|
|
4904
|
-
href:
|
|
4936
|
+
href: `${(0, apiBasePath_1.apiBasePrefix)(this.apiBase)}/session/${result.sessionId}/log`,
|
|
4905
4937
|
method: 'GET'
|
|
4906
4938
|
},
|
|
4907
4939
|
{
|
|
4908
4940
|
rel: 'self',
|
|
4909
|
-
href:
|
|
4941
|
+
href: `${(0, apiBasePath_1.apiBasePrefix)(this.apiBase)}/session/${result.sessionId}`,
|
|
4910
4942
|
method: 'GET'
|
|
4911
4943
|
}
|
|
4912
4944
|
];
|
|
@@ -4915,7 +4947,7 @@ class SASjsApiClient {
|
|
|
4915
4947
|
return { job, log: '' };
|
|
4916
4948
|
const state = yield (0, pollJobState_1.pollJobState)(this.requestClient, job, !!config.debug, authConfig, pollOptions, undefined, onTokensRefreshed, types_1.ServerType.Sasjs, exports.readSasjsState);
|
|
4917
4949
|
const { result: log } = yield this.requestClient
|
|
4918
|
-
.get(
|
|
4950
|
+
.get(`${this.apiPath}/session/${result.sessionId}/log`, access_token, 'text/plain')
|
|
4919
4951
|
.catch(() => ({ result: '' }));
|
|
4920
4952
|
const finished = Object.assign(Object.assign({}, job), { state });
|
|
4921
4953
|
if (state === pollJobState_1.JobState.Failed || state === pollJobState_1.JobState.Error)
|
|
@@ -4929,7 +4961,7 @@ class SASjsApiClient {
|
|
|
4929
4961
|
*/
|
|
4930
4962
|
refreshTokens(refreshToken) {
|
|
4931
4963
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4932
|
-
return (0, refreshTokensForSasjs_1.refreshTokensForSasjs)(this.requestClient, refreshToken);
|
|
4964
|
+
return (0, refreshTokensForSasjs_1.refreshTokensForSasjs)(this.requestClient, refreshToken, this.apiBase);
|
|
4933
4965
|
});
|
|
4934
4966
|
}
|
|
4935
4967
|
}
|
|
@@ -5950,6 +5982,87 @@ const writeStream = (stream, content) => __awaiter(void 0, void 0, void 0, funct
|
|
|
5950
5982
|
exports.writeStream = writeStream;
|
|
5951
5983
|
|
|
5952
5984
|
|
|
5985
|
+
/***/ },
|
|
5986
|
+
|
|
5987
|
+
/***/ 6838
|
|
5988
|
+
(__unused_webpack_module, exports) {
|
|
5989
|
+
|
|
5990
|
+
"use strict";
|
|
5991
|
+
var __webpack_unused_export__;
|
|
5992
|
+
|
|
5993
|
+
__webpack_unused_export__ = ({ value: true });
|
|
5994
|
+
exports.apiBaseFromPathSASJS = exports.apiBasePrefix = exports.normaliseApiBasePath = exports.DEFAULT_API_BASE_PATH = exports.STP_EXECUTE_SUFFIX = exports.DEFAULT_PATH_SASJS = void 0;
|
|
5995
|
+
/**
|
|
5996
|
+
* Where the SASjs Server API is mounted.
|
|
5997
|
+
*
|
|
5998
|
+
* This is the one name the adapter needs for a SASjs Server, and it is the same
|
|
5999
|
+
* kind of value as `pathSASViya` - a single path that says where this server
|
|
6000
|
+
* type's endpoints live. Servers from the release that introduced the short
|
|
6001
|
+
* paths answer `/api` as well, and a project may prefer that spelling for what
|
|
6002
|
+
* it shows in a URL, a log or a network panel.
|
|
6003
|
+
*/
|
|
6004
|
+
exports.DEFAULT_PATH_SASJS = '/SASjsApi';
|
|
6005
|
+
/** The stored-program endpoint under that mount. Hard-coded, not configurable. */
|
|
6006
|
+
exports.STP_EXECUTE_SUFFIX = '/stp/execute';
|
|
6007
|
+
/** The mount used by the URL builders when no config reaches them. */
|
|
6008
|
+
exports.DEFAULT_API_BASE_PATH = exports.DEFAULT_PATH_SASJS;
|
|
6009
|
+
/**
|
|
6010
|
+
* A base path the URL builders can concatenate with confidence: one leading
|
|
6011
|
+
* slash, no trailing one. `SASjsApi`, `/SASjsApi/` and ` /SASjsApi ` all mean
|
|
6012
|
+
* the same mount, and a trailing slash here would double up in every path.
|
|
6013
|
+
*/
|
|
6014
|
+
const normaliseApiBasePath = (path) => {
|
|
6015
|
+
const raw = (path || '').trim();
|
|
6016
|
+
// Absent and empty mean the default. A value of only slashes is the root
|
|
6017
|
+
// mount, and is a real deployment - a proxy that puts the API at the origin -
|
|
6018
|
+
// so the two are separated before the runs are stripped, or both would fold
|
|
6019
|
+
// into the default.
|
|
6020
|
+
if (!raw)
|
|
6021
|
+
return exports.DEFAULT_PATH_SASJS;
|
|
6022
|
+
// Scanned rather than matched with /^\/+|\/+$/ : a run of slashes makes that
|
|
6023
|
+
// pattern backtrack, which is the kind of input a config value can carry by
|
|
6024
|
+
// accident, and CodeQL flags it.
|
|
6025
|
+
let first = 0;
|
|
6026
|
+
while (first < raw.length && raw.charAt(first) === '/')
|
|
6027
|
+
first++;
|
|
6028
|
+
let last = raw.length;
|
|
6029
|
+
while (last > first && raw.charAt(last - 1) === '/')
|
|
6030
|
+
last--;
|
|
6031
|
+
const middle = raw.slice(first, last);
|
|
6032
|
+
return middle ? `/${middle}` : '/';
|
|
6033
|
+
};
|
|
6034
|
+
exports.normaliseApiBasePath = normaliseApiBasePath;
|
|
6035
|
+
/**
|
|
6036
|
+
* The mount as callers concatenate it.
|
|
6037
|
+
*
|
|
6038
|
+
* A root mount contributes nothing, so a URL built as
|
|
6039
|
+
* `${serverUrl}${apiBasePrefix(base)}/session` is `https://host/session` rather
|
|
6040
|
+
* than `https://host//session`. Every place that composes a path by hand uses
|
|
6041
|
+
* this, because a doubled slash is a different URL to a proxy.
|
|
6042
|
+
*/
|
|
6043
|
+
const apiBasePrefix = (base) => (0, exports.normaliseApiBasePath)(base) === '/' ? '' : (0, exports.normaliseApiBasePath)(base);
|
|
6044
|
+
exports.apiBasePrefix = apiBasePrefix;
|
|
6045
|
+
/**
|
|
6046
|
+
* The mount, read from `pathSASJS`.
|
|
6047
|
+
*
|
|
6048
|
+
* `pathSASJS` names the mount itself (`/SASjsApi`, `/api`); the stored-program
|
|
6049
|
+
* endpoint under it is `/stp/execute` and is appended by the code that calls it,
|
|
6050
|
+
* so there is one place a stub path can be got wrong instead of a config value
|
|
6051
|
+
* that has to agree with it.
|
|
6052
|
+
*
|
|
6053
|
+
* A value carrying the endpoint - `/api/stp/execute` - is accepted and read as
|
|
6054
|
+
* the mount it names, because that spelling appears in earlier documentation and
|
|
6055
|
+
* in bookmarks, and the two mean the same server.
|
|
6056
|
+
*/
|
|
6057
|
+
const apiBaseFromPathSASJS = (pathSASJS) => {
|
|
6058
|
+
const base = (0, exports.normaliseApiBasePath)(pathSASJS);
|
|
6059
|
+
if (base.endsWith(exports.STP_EXECUTE_SUFFIX))
|
|
6060
|
+
return base.slice(0, -exports.STP_EXECUTE_SUFFIX.length) || '/';
|
|
6061
|
+
return base;
|
|
6062
|
+
};
|
|
6063
|
+
exports.apiBaseFromPathSASJS = apiBaseFromPathSASJS;
|
|
6064
|
+
|
|
6065
|
+
|
|
5953
6066
|
/***/ },
|
|
5954
6067
|
|
|
5955
6068
|
/***/ 7710
|
|
@@ -5977,8 +6090,9 @@ const verifySas9Login_1 = __webpack_require__(4257);
|
|
|
5977
6090
|
const verifySasViyaLogin_1 = __webpack_require__(5009);
|
|
5978
6091
|
const _1 = __webpack_require__(4879);
|
|
5979
6092
|
const host_1 = __webpack_require__(5334);
|
|
6093
|
+
const apiBasePath_1 = __webpack_require__(6838);
|
|
5980
6094
|
class AuthManager {
|
|
5981
|
-
constructor(serverUrl, serverType, requestClient, loginCallback) {
|
|
6095
|
+
constructor(serverUrl, serverType, requestClient, loginCallback, apiBasePath = apiBasePath_1.DEFAULT_API_BASE_PATH) {
|
|
5982
6096
|
this.serverUrl = serverUrl;
|
|
5983
6097
|
this.serverType = serverType;
|
|
5984
6098
|
this.requestClient = requestClient;
|
|
@@ -6026,6 +6140,7 @@ class AuthManager {
|
|
|
6026
6140
|
: loginUrl.replace('/SASLogon/login.do', '/SASLogon/login');
|
|
6027
6141
|
}
|
|
6028
6142
|
};
|
|
6143
|
+
this.apiBase = (0, apiBasePath_1.normaliseApiBasePath)(apiBasePath);
|
|
6029
6144
|
this.loginUrl = `/SASLogon/login`;
|
|
6030
6145
|
this.logoutUrl =
|
|
6031
6146
|
this.serverType === types_1.ServerType.Sas9
|
|
@@ -6209,7 +6324,7 @@ class AuthManager {
|
|
|
6209
6324
|
? `${this.serverUrl}/identities/users/@currentUser`
|
|
6210
6325
|
: this.serverType === types_1.ServerType.Sas9
|
|
6211
6326
|
? `${this.serverUrl}/SASStoredProcess`
|
|
6212
|
-
: `${this.serverUrl}/
|
|
6327
|
+
: `${this.serverUrl}${(0, apiBasePath_1.apiBasePrefix)(this.apiBase)}/session`;
|
|
6213
6328
|
const { result: loginResponse } = yield this.requestClient
|
|
6214
6329
|
.get(url, undefined, 'text/plain')
|
|
6215
6330
|
.catch((err) => {
|
|
@@ -6284,15 +6399,17 @@ exports.getAccessTokenForSasjs = getAccessTokenForSasjs;
|
|
|
6284
6399
|
const error_1 = __webpack_require__(6340);
|
|
6285
6400
|
const getTokenRequestErrorPrefix_1 = __webpack_require__(1087);
|
|
6286
6401
|
const types_1 = __webpack_require__(3631);
|
|
6402
|
+
const apiBasePath_1 = __webpack_require__(6838);
|
|
6287
6403
|
/**
|
|
6288
6404
|
* Exchanges the auth code for an access token for the given client.
|
|
6289
6405
|
* @param requestClient - the pre-configured HTTP request client
|
|
6290
6406
|
* @param clientId - the client ID to authenticate with.
|
|
6291
6407
|
* @param authCode - the auth code received from the server.
|
|
6408
|
+
* @param apiBasePath - the path the API is mounted at, default `/SASjsApi`.
|
|
6292
6409
|
*/
|
|
6293
|
-
function getAccessTokenForSasjs(
|
|
6294
|
-
return __awaiter(this,
|
|
6295
|
-
const url =
|
|
6410
|
+
function getAccessTokenForSasjs(requestClient_1, clientId_1, authCode_1) {
|
|
6411
|
+
return __awaiter(this, arguments, void 0, function* (requestClient, clientId, authCode, apiBasePath = apiBasePath_1.DEFAULT_API_BASE_PATH) {
|
|
6412
|
+
const url = `${(0, apiBasePath_1.apiBasePrefix)(apiBasePath)}/auth/token`;
|
|
6296
6413
|
const data = {
|
|
6297
6414
|
clientId,
|
|
6298
6415
|
code: authCode
|
|
@@ -6476,6 +6593,7 @@ const types_1 = __webpack_require__(3631);
|
|
|
6476
6593
|
const refreshTokensForViya_1 = __webpack_require__(5747);
|
|
6477
6594
|
const refreshTokensForSasjs_1 = __webpack_require__(6725);
|
|
6478
6595
|
const host_1 = __webpack_require__(5334);
|
|
6596
|
+
const apiBasePath_1 = __webpack_require__(6838);
|
|
6479
6597
|
/**
|
|
6480
6598
|
* Returns the auth configuration, refreshing the tokens if necessary.
|
|
6481
6599
|
* This function can only be used by Node, if a server type is SASVIYA.
|
|
@@ -6484,9 +6602,11 @@ const host_1 = __webpack_require__(5334);
|
|
|
6484
6602
|
* @param serverType - server type for which refreshing the tokens, defaults to SASVIYA
|
|
6485
6603
|
* @param onTokensRefreshed - optional callback invoked with the rotated token
|
|
6486
6604
|
* pair after a successful internal refresh.
|
|
6605
|
+
* @param apiBasePath - the path the SASjs API is mounted at, default `/SASjsApi`.
|
|
6606
|
+
* Only used for `ServerType.Sasjs`.
|
|
6487
6607
|
*/
|
|
6488
6608
|
function getTokens(requestClient_1, authConfig_1) {
|
|
6489
|
-
return __awaiter(this, arguments, void 0, function* (requestClient, authConfig, serverType = types_1.ServerType.SasViya, onTokensRefreshed) {
|
|
6609
|
+
return __awaiter(this, arguments, void 0, function* (requestClient, authConfig, serverType = types_1.ServerType.SasViya, onTokensRefreshed, apiBasePath = apiBasePath_1.DEFAULT_API_BASE_PATH) {
|
|
6490
6610
|
const logger = (0, host_1.getLogger)();
|
|
6491
6611
|
// Note: client/secret are NOT mutated. The sas.cli public-client fallback
|
|
6492
6612
|
// is applied only to the refresh call itself, so a caller that round-trips
|
|
@@ -6544,7 +6664,7 @@ function getTokens(requestClient_1, authConfig_1) {
|
|
|
6544
6664
|
// with a missing secret is treated as a public client (empty secret).
|
|
6545
6665
|
const tokens = serverType === types_1.ServerType.SasViya
|
|
6546
6666
|
? yield (0, refreshTokensForViya_1.refreshTokensForViya)(requestClient, client || 'sas.cli', secret || '', refresh_token)
|
|
6547
|
-
: yield (0, refreshTokensForSasjs_1.refreshTokensForSasjs)(requestClient, refresh_token);
|
|
6667
|
+
: yield (0, refreshTokensForSasjs_1.refreshTokensForSasjs)(requestClient, refresh_token, apiBasePath);
|
|
6548
6668
|
({ access_token, refresh_token } = tokens);
|
|
6549
6669
|
// Viya refresh tokens are single-use/rotating. Callers throughout the
|
|
6550
6670
|
// compute-execution chain (executeOnComputeApi, pollJobState's poll
|
|
@@ -6784,14 +6904,16 @@ exports.refreshTokensForSasjs = refreshTokensForSasjs;
|
|
|
6784
6904
|
const error_1 = __webpack_require__(6340);
|
|
6785
6905
|
const getTokenRequestErrorPrefix_1 = __webpack_require__(1087);
|
|
6786
6906
|
const types_1 = __webpack_require__(3631);
|
|
6907
|
+
const apiBasePath_1 = __webpack_require__(6838);
|
|
6787
6908
|
/**
|
|
6788
6909
|
* Exchanges the refresh token for an access token for the given client.
|
|
6789
6910
|
* @param requestClient - the pre-configured HTTP request client
|
|
6790
6911
|
* @param refreshToken - the refresh token received from the server.
|
|
6912
|
+
* @param apiBasePath - the path the API is mounted at, default `/SASjsApi`.
|
|
6791
6913
|
*/
|
|
6792
|
-
function refreshTokensForSasjs(
|
|
6793
|
-
return __awaiter(this,
|
|
6794
|
-
const url =
|
|
6914
|
+
function refreshTokensForSasjs(requestClient_1, refreshToken_1) {
|
|
6915
|
+
return __awaiter(this, arguments, void 0, function* (requestClient, refreshToken, apiBasePath = apiBasePath_1.DEFAULT_API_BASE_PATH) {
|
|
6916
|
+
const url = `${(0, apiBasePath_1.apiBasePrefix)(apiBasePath)}/auth/refresh`;
|
|
6795
6917
|
const headers = {
|
|
6796
6918
|
Authorization: 'Bearer ' + refreshToken
|
|
6797
6919
|
};
|
|
@@ -9071,8 +9193,12 @@ class SASjsConfig {
|
|
|
9071
9193
|
*/
|
|
9072
9194
|
this.serverUrl = '';
|
|
9073
9195
|
/**
|
|
9074
|
-
* The
|
|
9075
|
-
*
|
|
9196
|
+
* The mount the SASjs Server API answers on.
|
|
9197
|
+
*
|
|
9198
|
+
* Defaults to '/SASjsApi'; '/api' selects the short spelling sasjs/server also
|
|
9199
|
+
* serves. The stored-program endpoint is not configurable: it is
|
|
9200
|
+
* `<mount>/stp/execute`, appended by the callers, so this value names the mount
|
|
9201
|
+
* and nothing else.
|
|
9076
9202
|
*/
|
|
9077
9203
|
this.pathSASJS = '';
|
|
9078
9204
|
/**
|
package/minified/sas9/SASjs.js
CHANGED
|
@@ -19,7 +19,7 @@ const WebJobExecutor_1 = require("./WebJobExecutor");
|
|
|
19
19
|
const ErrorResponse_1 = require("../../types/errors/ErrorResponse");
|
|
20
20
|
const defaultConfig = {
|
|
21
21
|
serverUrl: '',
|
|
22
|
-
pathSASJS: '/SASjsApi
|
|
22
|
+
pathSASJS: '/SASjsApi',
|
|
23
23
|
pathSAS9: '/SASStoredProcess/do',
|
|
24
24
|
pathSASViya: '/SASJobExecution',
|
|
25
25
|
appLoc: '/Public/seedapp',
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"scripts": {
|
|
6
6
|
"nodeVersionMessage": "echo \u001b[33m make sure you are running node lts version \u001b[0m",
|
|
7
7
|
"build": "npm run nodeVersionMessage && npx rimraf build node && npx tsc -p tsconfig.build.json && node createNodeEntry.js && node release/bundle-check.mjs --source-only && webpack && node release/bundle-check.mjs",
|
|
8
|
-
"package:lib": "npm run build &&
|
|
8
|
+
"package:lib": "npm run build && cp ./package.json ./README.md ./LICENSE ./DISCLOSURE build/ && cd build && npm pack",
|
|
9
9
|
"publish:lib": "npm run package:lib && cd build && npm stage publish",
|
|
10
10
|
"lint:fix": "npx prettier --log-level silent --write \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\" && npx prettier --log-level silent --write \"sasjs-tests/src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\" && npx prettier --log-level silent --write \"cypress/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\"",
|
|
11
11
|
"lint": "npx prettier --check \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\" && npx prettier --check \"sasjs-tests/src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\" && npx prettier --check \"cypress/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\"",
|
|
@@ -53,26 +53,25 @@
|
|
|
53
53
|
"@types/jest": "30.0.0",
|
|
54
54
|
"@types/node": "22.20.5",
|
|
55
55
|
"@types/pem": "1.14.4",
|
|
56
|
-
"copyfiles": "2.4.1",
|
|
57
56
|
"cors": "2.8.6",
|
|
58
57
|
"cypress": "16.2.0",
|
|
58
|
+
"deepmerge": "file:./vendor/deepmerge",
|
|
59
59
|
"dotenv": "18.0.9",
|
|
60
60
|
"express": "5.3.0",
|
|
61
|
+
"fast-check": "4.10.2",
|
|
61
62
|
"jest": "30.5.2",
|
|
62
63
|
"jest-environment-jsdom": "30.5.2",
|
|
63
64
|
"jest-extended": "7.0.0",
|
|
64
65
|
"pem": "1.14.8",
|
|
65
66
|
"prettier": "3.9.10",
|
|
67
|
+
"rimraf": "6.1.4",
|
|
66
68
|
"ts-jest": "29.4.15",
|
|
67
69
|
"ts-loader": "9.6.2",
|
|
68
|
-
"tslint": "6.1.3",
|
|
69
|
-
"tslint-config-prettier": "1.18.0",
|
|
70
70
|
"typedoc": "0.28.20",
|
|
71
71
|
"typedoc-plugin-rename-defaults": "0.7.3",
|
|
72
72
|
"typescript": "5.9.3",
|
|
73
73
|
"webpack": "5.112.2",
|
|
74
|
-
"webpack-cli": "7.2.3"
|
|
75
|
-
"rimraf": "6.1.4"
|
|
74
|
+
"webpack-cli": "7.2.3"
|
|
76
75
|
},
|
|
77
76
|
"main": "index.js",
|
|
78
77
|
"types": "index.d.ts",
|
|
@@ -112,9 +111,11 @@
|
|
|
112
111
|
"tough-cookie": "6.0.2"
|
|
113
112
|
},
|
|
114
113
|
"overrides": {
|
|
114
|
+
"deepmerge": "$deepmerge",
|
|
115
115
|
"es-define-property": "npm:@socketregistry/es-define-property@1.0.7",
|
|
116
116
|
"es-set-tostringtag": "npm:@socketregistry/es-set-tostringtag@1.0.10",
|
|
117
117
|
"function-bind": "npm:@socketregistry/function-bind@1.0.7",
|
|
118
|
+
"glob": "14.0.3",
|
|
118
119
|
"gopd": "npm:@socketregistry/gopd@1.0.7",
|
|
119
120
|
"has-symbols": "npm:@socketregistry/has-symbols@1.0.7",
|
|
120
121
|
"has-tostringtag": "npm:@socketregistry/has-tostringtag@1.0.7",
|
|
@@ -122,13 +123,14 @@
|
|
|
122
123
|
"is-core-module": "npm:@socketregistry/is-core-module@1.0.11",
|
|
123
124
|
"is-unicode-supported": "npm:@socketregistry/is-unicode-supported@1.0.5",
|
|
124
125
|
"isarray": "npm:@socketregistry/isarray@1.0.8",
|
|
126
|
+
"minimatch": "11.0.4",
|
|
125
127
|
"object-assign": "npm:@socketregistry/object-assign@1.0.5",
|
|
126
128
|
"path-parse": "npm:@socketregistry/path-parse@1.0.8",
|
|
127
129
|
"safe-buffer": "npm:@socketregistry/safe-buffer@1.0.9",
|
|
128
130
|
"safer-buffer": "npm:@socketregistry/safer-buffer@1.0.10",
|
|
129
131
|
"side-channel": "npm:@socketregistry/side-channel@1.0.10"
|
|
130
132
|
},
|
|
131
|
-
"version": "
|
|
133
|
+
"version": "6.0.0",
|
|
132
134
|
"engines": {
|
|
133
135
|
"node": ">=22"
|
|
134
136
|
},
|
package/types/SASjsConfig.d.ts
CHANGED
|
@@ -13,8 +13,12 @@ export declare class SASjsConfig {
|
|
|
13
13
|
*/
|
|
14
14
|
serverUrl: string;
|
|
15
15
|
/**
|
|
16
|
-
* The
|
|
17
|
-
*
|
|
16
|
+
* The mount the SASjs Server API answers on.
|
|
17
|
+
*
|
|
18
|
+
* Defaults to '/SASjsApi'; '/api' selects the short spelling sasjs/server also
|
|
19
|
+
* serves. The stored-program endpoint is not configurable: it is
|
|
20
|
+
* `<mount>/stp/execute`, appended by the callers, so this value names the mount
|
|
21
|
+
* and nothing else.
|
|
18
22
|
*/
|
|
19
23
|
pathSASJS: string;
|
|
20
24
|
/**
|
package/types/SASjsConfig.js
CHANGED
|
@@ -14,8 +14,12 @@ class SASjsConfig {
|
|
|
14
14
|
*/
|
|
15
15
|
this.serverUrl = '';
|
|
16
16
|
/**
|
|
17
|
-
* The
|
|
18
|
-
*
|
|
17
|
+
* The mount the SASjs Server API answers on.
|
|
18
|
+
*
|
|
19
|
+
* Defaults to '/SASjsApi'; '/api' selects the short spelling sasjs/server also
|
|
20
|
+
* serves. The stored-program endpoint is not configurable: it is
|
|
21
|
+
* `<mount>/stp/execute`, appended by the callers, so this value names the mount
|
|
22
|
+
* and nothing else.
|
|
19
23
|
*/
|
|
20
24
|
this.pathSASJS = '';
|
|
21
25
|
/**
|