@sasjs/adapter 5.1.2 → 5.2.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/ContextManager.js +2 -2
- package/README.md +14 -0
- package/SAS9ApiClient.d.ts +2 -3
- package/SAS9ApiClient.js +2 -2
- package/SASViyaApiClient.d.ts +0 -1
- package/SASViyaApiClient.js +11 -11
- package/SASjs.d.ts +6 -2
- package/SASjs.js +36 -28
- package/SASjsApiClient.d.ts +40 -6
- package/SASjsApiClient.js +103 -3
- package/SessionManager.js +1 -1
- package/api/viya/executeOnComputeApi.js +9 -10
- package/api/viya/pollJobState.d.ts +26 -3
- package/api/viya/pollJobState.js +29 -13
- package/api/viya/saveLog.js +1 -2
- package/api/viya/uploadTables.js +1 -2
- package/auth/AuthManager.js +2 -2
- package/auth/getAccessTokenForSasjs.js +1 -2
- package/auth/getAccessTokenForViya.js +1 -2
- package/auth/getTokens.js +3 -4
- package/auth/openWebPage.js +3 -4
- package/auth/refreshTokensForSasjs.js +1 -2
- package/auth/refreshTokensForViya.js +1 -2
- package/auth/verifySas9Login.js +1 -2
- package/auth/verifySasViyaLogin.js +3 -3
- package/dist/minified_sas9.js +103 -43
- package/dist/sasjs-adapter.js +7449 -7783
- package/job-execution/JesJobExecutor.js +2 -2
- package/job-execution/Sas9JobExecutor.d.ts +5 -1
- package/job-execution/Sas9JobExecutor.js +5 -0
- package/job-execution/SasjsJobExecutor.js +2 -2
- package/job-execution/WebJobExecutor.js +3 -3
- package/minified/sas9/SASjs.js +6 -6
- package/minified/sas9/WebJobExecutor.js +2 -2
- package/package.json +18 -17
- package/request/RequestClient.d.ts +1 -2
- package/request/RequestClient.js +10 -10
- package/request/Sas9RequestClient.d.ts +22 -5
- package/request/Sas9RequestClient.js +90 -22
- package/types/SASjsConfig.d.ts +0 -1
- package/types/SASjsConfig.js +1 -1
- package/types/Session.js +1 -1
- package/types/WriteStream.d.ts +0 -2
- package/types/errors/UnsafeRedirectError.d.ts +15 -0
- package/types/errors/UnsafeRedirectError.js +24 -0
- package/types/errors/index.d.ts +1 -0
- package/types/errors/index.js +1 -0
- package/utils/appendExtraResponseAttributes.js +1 -2
- package/utils/asyncForEach.js +1 -2
- package/utils/isIeOrEdge.js +1 -2
- package/utils/validateInput.d.ts +1 -1
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
import { AuthConfig } from '@sasjs/utils/types';
|
|
1
|
+
import { AuthConfig, ServerType } from '@sasjs/utils/types';
|
|
2
2
|
import { Job, PollOptions } from '../..';
|
|
3
3
|
import { OnTokensRefreshed } from '../../auth/getTokens';
|
|
4
4
|
import { RequestClient } from '../../request/RequestClient';
|
|
5
5
|
import { WriteStream, JobSessionManager } from '../../types';
|
|
6
|
+
/**
|
|
7
|
+
* How a caller's server reports the state of a job.
|
|
8
|
+
*
|
|
9
|
+
* The poller follows a job's `state` link and hands the body to this function,
|
|
10
|
+
* so a server that answers differently - or has states of its own - says so at
|
|
11
|
+
* the call site rather than teaching this module about itself.
|
|
12
|
+
*/
|
|
13
|
+
export type StateReader = (body: unknown) => JobState;
|
|
14
|
+
/**
|
|
15
|
+
* The Viya compute API answers the state link with plain text: the state name,
|
|
16
|
+
* padded with a newline.
|
|
17
|
+
*/
|
|
18
|
+
export declare const readViyaState: StateReader;
|
|
6
19
|
export declare enum JobState {
|
|
7
20
|
Completed = "completed",
|
|
8
21
|
Running = "running",
|
|
@@ -13,6 +26,16 @@ export declare enum JobState {
|
|
|
13
26
|
Error = "error"
|
|
14
27
|
}
|
|
15
28
|
/**
|
|
29
|
+
* Polls a job that carries `links`, following the one with `rel === 'state'`
|
|
30
|
+
* until it stops being running, pending or unavailable.
|
|
31
|
+
*
|
|
32
|
+
* The shape it follows is the Viya compute API's - that is where the `state`
|
|
33
|
+
* link, the `?_action=wait` query and the parent-session health check come from
|
|
34
|
+
* - but the shape itself is now a contract two servers answer: SASjs Server
|
|
35
|
+
* returns the same links for a triggered program, so the same poll loop drives
|
|
36
|
+
* both. What differs between them is how the state body is read, and that is a
|
|
37
|
+
* `StateReader` the caller supplies rather than something this module decides.
|
|
38
|
+
*
|
|
16
39
|
* Polls job status using default or provided poll options.
|
|
17
40
|
* @param requestClient - the pre-configured HTTP request client.
|
|
18
41
|
* @param postedJob - the relative or absolute path to the job.
|
|
@@ -36,7 +59,7 @@ export declare enum JobState {
|
|
|
36
59
|
* @param jobSessionManager - job session object containing session object and an instance of Session Manager. Job session object is used to periodically (every 10th job state poll) check parent session state.
|
|
37
60
|
* @returns - a promise which resolves with a job state
|
|
38
61
|
*/
|
|
39
|
-
export declare function pollJobState(requestClient: RequestClient, postedJob: Job, debug: boolean, authConfig?: AuthConfig, pollOptions?: PollOptions, jobSessionManager?: JobSessionManager, onTokensRefreshed?: OnTokensRefreshed): Promise<JobState>;
|
|
62
|
+
export declare function pollJobState(requestClient: RequestClient, postedJob: Job, debug: boolean, authConfig?: AuthConfig, pollOptions?: PollOptions, jobSessionManager?: JobSessionManager, onTokensRefreshed?: OnTokensRefreshed, serverType?: ServerType, readState?: StateReader): Promise<JobState>;
|
|
40
63
|
/**
|
|
41
64
|
* Polls job state.
|
|
42
65
|
* @param requestClient - the pre-configured HTTP request client.
|
|
@@ -51,7 +74,7 @@ export declare function pollJobState(requestClient: RequestClient, postedJob: Jo
|
|
|
51
74
|
* @param jobSessionManager - job session object containing session object and an instance of Session Manager. Job session object is used to periodically (every 10th job state poll) check parent session state. Session state is considered healthy if it is equal to 'running' or 'idle'.
|
|
52
75
|
* @returns - a promise which resolves with a job state
|
|
53
76
|
*/
|
|
54
|
-
export declare const doPoll: (requestClient: RequestClient, postedJob: Job, currentState: JobState, debug: boolean, pollCount: number, pollOptions: PollOptions, authConfig?: AuthConfig, streamLog?: boolean, logStream?: WriteStream, jobSessionManager?: JobSessionManager, onTokensRefreshed?: OnTokensRefreshed) => Promise<{
|
|
77
|
+
export declare const doPoll: (requestClient: RequestClient, postedJob: Job, currentState: JobState, debug: boolean, pollCount: number, pollOptions: PollOptions, authConfig?: AuthConfig, streamLog?: boolean, logStream?: WriteStream, jobSessionManager?: JobSessionManager, onTokensRefreshed?: OnTokensRefreshed, serverType?: ServerType, readState?: StateReader) => Promise<{
|
|
55
78
|
state: JobState;
|
|
56
79
|
pollCount: number;
|
|
57
80
|
}>;
|
package/api/viya/pollJobState.js
CHANGED
|
@@ -9,13 +9,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.doPoll = exports.
|
|
12
|
+
exports.doPoll = exports.JobState = exports.readViyaState = void 0;
|
|
13
|
+
exports.pollJobState = pollJobState;
|
|
13
14
|
const types_1 = require("@sasjs/utils/types");
|
|
14
15
|
const getTokens_1 = require("../../auth/getTokens");
|
|
15
16
|
const errors_1 = require("../../types/errors");
|
|
16
17
|
const types_2 = require("../../types");
|
|
17
18
|
const utils_1 = require("../../utils");
|
|
18
19
|
const host_1 = require("../../utils/host");
|
|
20
|
+
/**
|
|
21
|
+
* The Viya compute API answers the state link with plain text: the state name,
|
|
22
|
+
* padded with a newline.
|
|
23
|
+
*/
|
|
24
|
+
const readViyaState = (body) => String(body !== null && body !== void 0 ? body : '').trim();
|
|
25
|
+
exports.readViyaState = readViyaState;
|
|
19
26
|
var JobState;
|
|
20
27
|
(function (JobState) {
|
|
21
28
|
JobState["Completed"] = "completed";
|
|
@@ -25,8 +32,18 @@ var JobState;
|
|
|
25
32
|
JobState["NoState"] = "";
|
|
26
33
|
JobState["Failed"] = "failed";
|
|
27
34
|
JobState["Error"] = "error";
|
|
28
|
-
})(JobState
|
|
35
|
+
})(JobState || (exports.JobState = JobState = {}));
|
|
29
36
|
/**
|
|
37
|
+
* Polls a job that carries `links`, following the one with `rel === 'state'`
|
|
38
|
+
* until it stops being running, pending or unavailable.
|
|
39
|
+
*
|
|
40
|
+
* The shape it follows is the Viya compute API's - that is where the `state`
|
|
41
|
+
* link, the `?_action=wait` query and the parent-session health check come from
|
|
42
|
+
* - but the shape itself is now a contract two servers answer: SASjs Server
|
|
43
|
+
* returns the same links for a triggered program, so the same poll loop drives
|
|
44
|
+
* both. What differs between them is how the state body is read, and that is a
|
|
45
|
+
* `StateReader` the caller supplies rather than something this module decides.
|
|
46
|
+
*
|
|
30
47
|
* Polls job status using default or provided poll options.
|
|
31
48
|
* @param requestClient - the pre-configured HTTP request client.
|
|
32
49
|
* @param postedJob - the relative or absolute path to the job.
|
|
@@ -50,8 +67,8 @@ var JobState;
|
|
|
50
67
|
* @param jobSessionManager - job session object containing session object and an instance of Session Manager. Job session object is used to periodically (every 10th job state poll) check parent session state.
|
|
51
68
|
* @returns - a promise which resolves with a job state
|
|
52
69
|
*/
|
|
53
|
-
function pollJobState(
|
|
54
|
-
return __awaiter(this,
|
|
70
|
+
function pollJobState(requestClient_1, postedJob_1, debug_1, authConfig_1, pollOptions_1, jobSessionManager_1, onTokensRefreshed_1) {
|
|
71
|
+
return __awaiter(this, arguments, void 0, function* (requestClient, postedJob, debug, authConfig, pollOptions, jobSessionManager, onTokensRefreshed, serverType = types_1.ServerType.SasViya, readState = exports.readViyaState) {
|
|
55
72
|
const logger = (0, host_1.getLogger)();
|
|
56
73
|
const streamLog = (pollOptions === null || pollOptions === void 0 ? void 0 : pollOptions.streamLog) || false;
|
|
57
74
|
const defaultPollStrategy = [
|
|
@@ -83,7 +100,7 @@ function pollJobState(requestClient, postedJob, debug, authConfig, pollOptions,
|
|
|
83
100
|
if (!stateLink) {
|
|
84
101
|
throw new Error(`Job state link was not found.`);
|
|
85
102
|
}
|
|
86
|
-
let currentState = yield getJobState(requestClient, postedJob, JobState.NoState, debug, authConfig).catch((err) => {
|
|
103
|
+
let currentState = yield getJobState(requestClient, postedJob, JobState.NoState, debug, authConfig, serverType, readState).catch((err) => {
|
|
87
104
|
logger.error(`Error fetching job state from ${stateLink.href}. Starting poll, assuming job to be running.`, err);
|
|
88
105
|
return JobState.Unavailable;
|
|
89
106
|
});
|
|
@@ -96,7 +113,7 @@ function pollJobState(requestClient, postedJob, debug, authConfig, pollOptions,
|
|
|
96
113
|
const { getFileStream } = require('./getFileStream');
|
|
97
114
|
logFileStream = yield getFileStream(postedJob, pollOptions.logFolderPath);
|
|
98
115
|
}
|
|
99
|
-
let result = yield (0, exports.doPoll)(requestClient, postedJob, currentState, debug, pollCount, pollOptions, authConfig, streamLog, logFileStream, jobSessionManager, onTokensRefreshed);
|
|
116
|
+
let result = yield (0, exports.doPoll)(requestClient, postedJob, currentState, debug, pollCount, pollOptions, authConfig, streamLog, logFileStream, jobSessionManager, onTokensRefreshed, serverType, readState);
|
|
100
117
|
currentState = result.state;
|
|
101
118
|
pollCount = result.pollCount;
|
|
102
119
|
if (!needsRetry(currentState) ||
|
|
@@ -110,7 +127,7 @@ function pollJobState(requestClient, postedJob, debug, authConfig, pollOptions,
|
|
|
110
127
|
if (pollOptions) {
|
|
111
128
|
defaultPollOptions.logFolderPath = pollOptions.logFolderPath;
|
|
112
129
|
}
|
|
113
|
-
result = yield (0, exports.doPoll)(requestClient, postedJob, currentState, debug, pollCount, defaultPollOptions, authConfig, streamLog, logFileStream, jobSessionManager, onTokensRefreshed);
|
|
130
|
+
result = yield (0, exports.doPoll)(requestClient, postedJob, currentState, debug, pollCount, defaultPollOptions, authConfig, streamLog, logFileStream, jobSessionManager, onTokensRefreshed, serverType, readState);
|
|
114
131
|
currentState = result.state;
|
|
115
132
|
pollCount = result.pollCount;
|
|
116
133
|
}
|
|
@@ -119,19 +136,18 @@ function pollJobState(requestClient, postedJob, debug, authConfig, pollOptions,
|
|
|
119
136
|
return currentState;
|
|
120
137
|
});
|
|
121
138
|
}
|
|
122
|
-
|
|
123
|
-
const getJobState = (requestClient, job, currentState, debug, authConfig, onTokensRefreshed) => __awaiter(void 0, void 0, void 0, function* () {
|
|
139
|
+
const getJobState = (requestClient_1, job_1, currentState_1, debug_1, authConfig_1, ...args_1) => __awaiter(void 0, [requestClient_1, job_1, currentState_1, debug_1, authConfig_1, ...args_1], void 0, function* (requestClient, job, currentState, debug, authConfig, serverType = types_1.ServerType.SasViya, readState = exports.readViyaState, onTokensRefreshed) {
|
|
124
140
|
const stateLink = job.links.find((l) => l.rel === 'state');
|
|
125
141
|
if (needsRetry(currentState)) {
|
|
126
142
|
let tokens;
|
|
127
143
|
if (authConfig)
|
|
128
|
-
tokens = yield (0, getTokens_1.getTokens)(requestClient, authConfig,
|
|
144
|
+
tokens = yield (0, getTokens_1.getTokens)(requestClient, authConfig, serverType, onTokensRefreshed);
|
|
129
145
|
const { result: jobState } = yield requestClient
|
|
130
146
|
.get(`${stateLink.href}?_action=wait&wait=300`, tokens === null || tokens === void 0 ? void 0 : tokens.access_token, 'text/plain', {}, debug)
|
|
131
147
|
.catch((err) => {
|
|
132
148
|
throw new errors_1.JobStatePollError(job.id, err);
|
|
133
149
|
});
|
|
134
|
-
return jobState
|
|
150
|
+
return readState(jobState);
|
|
135
151
|
}
|
|
136
152
|
else {
|
|
137
153
|
return currentState;
|
|
@@ -155,7 +171,7 @@ const needsRetry = (state) => state === JobState.Running ||
|
|
|
155
171
|
* @param jobSessionManager - job session object containing session object and an instance of Session Manager. Job session object is used to periodically (every 10th job state poll) check parent session state. Session state is considered healthy if it is equal to 'running' or 'idle'.
|
|
156
172
|
* @returns - a promise which resolves with a job state
|
|
157
173
|
*/
|
|
158
|
-
const doPoll = (
|
|
174
|
+
const doPoll = (requestClient_1, postedJob_1, currentState_1, debug_1, pollCount_1, pollOptions_1, authConfig_1, streamLog_1, logStream_1, jobSessionManager_1, onTokensRefreshed_1, ...args_1) => __awaiter(void 0, [requestClient_1, postedJob_1, currentState_1, debug_1, pollCount_1, pollOptions_1, authConfig_1, streamLog_1, logStream_1, jobSessionManager_1, onTokensRefreshed_1, ...args_1], void 0, function* (requestClient, postedJob, currentState, debug, pollCount, pollOptions, authConfig, streamLog, logStream, jobSessionManager, onTokensRefreshed, serverType = types_1.ServerType.SasViya, readState = exports.readViyaState) {
|
|
159
175
|
var _a, _b;
|
|
160
176
|
const { maxPollCount, pollInterval } = pollOptions;
|
|
161
177
|
const logger = (0, host_1.getLogger)();
|
|
@@ -189,7 +205,7 @@ const doPoll = (requestClient, postedJob, currentState, debug, pollCount, pollOp
|
|
|
189
205
|
throw new errors_1.JobStatePollError(jobId, new Error(sessionError));
|
|
190
206
|
}
|
|
191
207
|
}
|
|
192
|
-
state = yield getJobState(requestClient, postedJob, state, debug, authConfig, onTokensRefreshed).catch((err) => {
|
|
208
|
+
state = yield getJobState(requestClient, postedJob, state, debug, authConfig, serverType, readState, onTokensRefreshed).catch((err) => {
|
|
193
209
|
errorCount++;
|
|
194
210
|
if (pollCount >= maxPollCount || errorCount >= maxErrorCount) {
|
|
195
211
|
throw err;
|
package/api/viya/saveLog.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.saveLog =
|
|
12
|
+
exports.saveLog = saveLog;
|
|
13
13
|
const utils_1 = require("../../utils");
|
|
14
14
|
const writeStream_1 = require("./writeStream");
|
|
15
15
|
const host_1 = require("../../utils/host");
|
|
@@ -42,4 +42,3 @@ function saveLog(job, requestClient, startLine, endLine, logFileStream, accessTo
|
|
|
42
42
|
yield (0, writeStream_1.writeStream)(logFileStream, log || '');
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
exports.saveLog = saveLog;
|
package/api/viya/uploadTables.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.uploadTables =
|
|
12
|
+
exports.uploadTables = uploadTables;
|
|
13
13
|
const error_1 = require("@sasjs/utils/error");
|
|
14
14
|
const convertToCsv_1 = require("../../utils/convertToCsv");
|
|
15
15
|
/**
|
|
@@ -42,4 +42,3 @@ function uploadTables(requestClient, data, accessToken) {
|
|
|
42
42
|
return uploadedFiles;
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
exports.uploadTables = uploadTables;
|
package/auth/AuthManager.js
CHANGED
|
@@ -81,8 +81,8 @@ class AuthManager {
|
|
|
81
81
|
* Opens Pop up window to SAS Login screen.
|
|
82
82
|
* And checks if user has finished login process.
|
|
83
83
|
*/
|
|
84
|
-
redirectedLogIn(
|
|
85
|
-
return __awaiter(this,
|
|
84
|
+
redirectedLogIn(_a) {
|
|
85
|
+
return __awaiter(this, arguments, void 0, function* ({ onLoggedOut }) {
|
|
86
86
|
const { isLoggedIn: isLoggedInAlready, userName: currentSessionUserName, userLongName: currentSessionUserLongName } = yield this.fetchUserName();
|
|
87
87
|
if (isLoggedInAlready) {
|
|
88
88
|
const logger = (0, host_1.getLogger)();
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getAccessTokenForSasjs =
|
|
12
|
+
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");
|
|
@@ -40,4 +40,3 @@ function getAccessTokenForSasjs(requestClient, clientId, authCode) {
|
|
|
40
40
|
});
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
exports.getAccessTokenForSasjs = getAccessTokenForSasjs;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getAccessTokenForViya =
|
|
12
|
+
exports.getAccessTokenForViya = getAccessTokenForViya;
|
|
13
13
|
const types_1 = require("@sasjs/utils/types");
|
|
14
14
|
const error_1 = require("@sasjs/utils/error");
|
|
15
15
|
const errors_1 = require("../types/errors");
|
|
@@ -51,4 +51,3 @@ function getAccessTokenForViya(requestClient, clientId, clientSecret, authCode)
|
|
|
51
51
|
return authResponse;
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
exports.getAccessTokenForViya = getAccessTokenForViya;
|
package/auth/getTokens.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getTokens =
|
|
12
|
+
exports.getTokens = getTokens;
|
|
13
13
|
const auth_1 = require("@sasjs/utils/auth");
|
|
14
14
|
const types_1 = require("@sasjs/utils/types");
|
|
15
15
|
const refreshTokensForViya_1 = require("./refreshTokensForViya");
|
|
@@ -24,8 +24,8 @@ const host_1 = require("../utils/host");
|
|
|
24
24
|
* @param onTokensRefreshed - optional callback invoked with the rotated token
|
|
25
25
|
* pair after a successful internal refresh.
|
|
26
26
|
*/
|
|
27
|
-
function getTokens(
|
|
28
|
-
return __awaiter(this,
|
|
27
|
+
function getTokens(requestClient_1, authConfig_1) {
|
|
28
|
+
return __awaiter(this, arguments, void 0, function* (requestClient, authConfig, serverType = types_1.ServerType.SasViya, onTokensRefreshed) {
|
|
29
29
|
const logger = (0, host_1.getLogger)();
|
|
30
30
|
// Note: client/secret are NOT mutated. The sas.cli public-client fallback
|
|
31
31
|
// is applied only to the refresh call itself, so a caller that round-trips
|
|
@@ -107,4 +107,3 @@ function getTokens(requestClient, authConfig, serverType = types_1.ServerType.Sa
|
|
|
107
107
|
return { access_token, refresh_token, client, secret };
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
exports.getTokens = getTokens;
|
package/auth/openWebPage.js
CHANGED
|
@@ -9,11 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.openWebPage =
|
|
12
|
+
exports.openWebPage = openWebPage;
|
|
13
13
|
const loginPrompt_1 = require("../utils/loginPrompt");
|
|
14
14
|
const defaultWindowFeatures = { width: 500, height: 600 };
|
|
15
|
-
function openWebPage(
|
|
16
|
-
return __awaiter(this,
|
|
15
|
+
function openWebPage(url_1) {
|
|
16
|
+
return __awaiter(this, arguments, void 0, function* (url, windowName = '', WindowFeatures = defaultWindowFeatures, onLoggedOut) {
|
|
17
17
|
const { width, height } = WindowFeatures;
|
|
18
18
|
const left = screen.width / 2 - width / 2;
|
|
19
19
|
const top = screen.height / 2 - height / 2;
|
|
@@ -28,4 +28,3 @@ function openWebPage(url, windowName = '', WindowFeatures = defaultWindowFeature
|
|
|
28
28
|
return loginPopup;
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
exports.openWebPage = openWebPage;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.refreshTokensForSasjs =
|
|
12
|
+
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");
|
|
@@ -39,4 +39,3 @@ function refreshTokensForSasjs(requestClient, refreshToken) {
|
|
|
39
39
|
return authResponse;
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
exports.refreshTokensForSasjs = refreshTokensForSasjs;
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.refreshTokensForViya =
|
|
15
|
+
exports.refreshTokensForViya = refreshTokensForViya;
|
|
16
16
|
const types_1 = require("@sasjs/utils/types");
|
|
17
17
|
const error_1 = require("@sasjs/utils/error");
|
|
18
18
|
const form_data_1 = __importDefault(require("form-data"));
|
|
@@ -50,4 +50,3 @@ function refreshTokensForViya(requestClient, clientId, clientSecret, refreshToke
|
|
|
50
50
|
return authResponse;
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
exports.refreshTokensForViya = refreshTokensForViya;
|
package/auth/verifySas9Login.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.verifySas9Login =
|
|
12
|
+
exports.verifySas9Login = verifySas9Login;
|
|
13
13
|
const utils_1 = require("../utils");
|
|
14
14
|
const _1 = require("./");
|
|
15
15
|
function verifySas9Login(loginPopup) {
|
|
@@ -29,4 +29,3 @@ function verifySas9Login(loginPopup) {
|
|
|
29
29
|
return { isLoggedIn };
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
exports.verifySas9Login = verifySas9Login;
|
|
@@ -9,12 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.isLoggedInSASVIYA =
|
|
12
|
+
exports.isLoggedInSASVIYA = void 0;
|
|
13
|
+
exports.verifySasViyaLogin = verifySasViyaLogin;
|
|
13
14
|
const utils_1 = require("../utils");
|
|
14
15
|
const _1 = require("./");
|
|
15
16
|
function verifySasViyaLogin(loginPopup) {
|
|
16
|
-
var _a, _b;
|
|
17
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
var _a, _b;
|
|
18
19
|
let isLoggedIn = false;
|
|
19
20
|
let startTime = new Date();
|
|
20
21
|
let elapsedSeconds = 0;
|
|
@@ -39,6 +40,5 @@ function verifySasViyaLogin(loginPopup) {
|
|
|
39
40
|
return { isLoggedIn: isLoggedIn && isAuthorized };
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
|
-
exports.verifySasViyaLogin = verifySasViyaLogin;
|
|
43
43
|
const isLoggedInSASVIYA = () => document.cookie.includes('Current-User') && document.cookie.includes('userId');
|
|
44
44
|
exports.isLoggedInSASVIYA = isLoggedInSASVIYA;
|