@sasjs/adapter 4.9.1 → 4.10.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/SessionManager.d.ts +1 -0
- package/api/viya/{executeScript.d.ts → executeOnComputeApi.d.ts} +2 -2
- package/api/viya/pollJobState.d.ts +21 -1
- package/index-dev.js +2 -2
- package/index.js +1 -1
- package/minified_sas9.js +1 -1
- package/node/SessionManager.d.ts +1 -0
- package/node/api/viya/{executeScript.d.ts → executeOnComputeApi.d.ts} +2 -2
- package/node/api/viya/pollJobState.d.ts +21 -1
- package/node/index.js +1 -1
- package/node/types/Session.d.ts +18 -1
- package/package.json +1 -1
- package/src/SASViyaApiClient.ts +2 -2
- package/src/SessionManager.ts +27 -16
- package/src/api/viya/{executeScript.ts → executeOnComputeApi.ts} +24 -28
- package/src/api/viya/pollJobState.ts +54 -6
- package/src/api/viya/spec/mockResponses.ts +5 -3
- package/src/types/Session.ts +20 -1
- package/types/Session.d.ts +18 -1
package/SessionManager.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare class SessionManager {
|
|
|
5
5
|
private contextName;
|
|
6
6
|
private requestClient;
|
|
7
7
|
private loggedErrors;
|
|
8
|
+
private sessionStateLinkError;
|
|
8
9
|
constructor(serverUrl: string, contextName: string, requestClient: RequestClient);
|
|
9
10
|
private sessions;
|
|
10
11
|
private currentContext;
|
|
@@ -3,7 +3,7 @@ import { PollOptions } from '../..';
|
|
|
3
3
|
import { RequestClient } from '../../request/RequestClient';
|
|
4
4
|
import { SessionManager } from '../../SessionManager';
|
|
5
5
|
/**
|
|
6
|
-
* Executes
|
|
6
|
+
* Executes SAS program on the current SAS Viya server using Compute API.
|
|
7
7
|
* @param jobPath - the path to the file being submitted for execution.
|
|
8
8
|
* @param linesOfCode - an array of code lines to execute.
|
|
9
9
|
* @param contextName - the context to execute the code in.
|
|
@@ -16,4 +16,4 @@ import { SessionManager } from '../../SessionManager';
|
|
|
16
16
|
* @param printPid - a boolean that indicates whether the function should print (PID) of the started job.
|
|
17
17
|
* @param variables - an object that represents macro variables.
|
|
18
18
|
*/
|
|
19
|
-
export declare function
|
|
19
|
+
export declare function executeOnComputeApi(requestClient: RequestClient, sessionManager: SessionManager, rootFolderName: string, jobPath: string, linesOfCode: string[], contextName: string, authConfig?: AuthConfig, data?: any, debug?: boolean, expectWebout?: boolean, waitForResult?: boolean, pollOptions?: PollOptions, printPid?: boolean, variables?: MacroVar): Promise<any>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AuthConfig } from '@sasjs/utils/types';
|
|
2
2
|
import { Job, PollOptions } from '../..';
|
|
3
3
|
import { RequestClient } from '../../request/RequestClient';
|
|
4
|
+
import { WriteStream, JobSessionManager } from '../../types';
|
|
4
5
|
export declare enum JobState {
|
|
5
6
|
Completed = "completed",
|
|
6
7
|
Running = "running",
|
|
@@ -31,6 +32,25 @@ export declare enum JobState {
|
|
|
31
32
|
* { maxPollCount: 500, pollInterval: 30000 }, // approximately ~50.5 mins (including time to get response (~300ms))
|
|
32
33
|
* { maxPollCount: 3400, pollInterval: 60000 } // approximately ~3015 mins (~125 hours) (including time to get response (~300ms))
|
|
33
34
|
* ]
|
|
35
|
+
* @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.
|
|
34
36
|
* @returns - a promise which resolves with a job state
|
|
35
37
|
*/
|
|
36
|
-
export declare function pollJobState(requestClient: RequestClient, postedJob: Job, debug: boolean, authConfig?: AuthConfig, pollOptions?: PollOptions): Promise<JobState>;
|
|
38
|
+
export declare function pollJobState(requestClient: RequestClient, postedJob: Job, debug: boolean, authConfig?: AuthConfig, pollOptions?: PollOptions, jobSessionManager?: JobSessionManager): Promise<JobState>;
|
|
39
|
+
/**
|
|
40
|
+
* Polls job state.
|
|
41
|
+
* @param requestClient - the pre-configured HTTP request client.
|
|
42
|
+
* @param postedJob - the relative or absolute path to the job.
|
|
43
|
+
* @param currentState - current job state.
|
|
44
|
+
* @param debug - sets the _debug flag in the job arguments.
|
|
45
|
+
* @param pollCount - current poll count.
|
|
46
|
+
* @param pollOptions - an object containing maxPollCount, pollInterval, streamLog and logFolderPath.
|
|
47
|
+
* @param authConfig - an access token, refresh token, client and secret for an authorized user.
|
|
48
|
+
* @param streamLog - indicates if job log should be streamed.
|
|
49
|
+
* @param logStream - job log stream.
|
|
50
|
+
* @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
|
+
* @returns - a promise which resolves with a job state
|
|
52
|
+
*/
|
|
53
|
+
export declare const doPoll: (requestClient: RequestClient, postedJob: Job, currentState: JobState, debug: boolean, pollCount: number, pollOptions: PollOptions, authConfig?: AuthConfig, streamLog?: boolean, logStream?: WriteStream, jobSessionManager?: JobSessionManager) => Promise<{
|
|
54
|
+
state: JobState;
|
|
55
|
+
pollCount: number;
|
|
56
|
+
}>;
|