@sasjs/adapter 2.12.0 → 3.1.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/SAS9ApiClient.d.ts +3 -1
- package/SASViyaApiClient.d.ts +7 -1
- package/SASjs.d.ts +9 -7
- package/auth/AuthManager.d.ts +7 -2
- package/index.js +2 -2
- package/job-execution/Sas9JobExecutor.d.ts +6 -5
- package/node/SAS9ApiClient.d.ts +3 -1
- package/node/SASViyaApiClient.d.ts +7 -1
- package/node/SASjs.d.ts +9 -7
- package/node/auth/AuthManager.d.ts +7 -2
- package/node/index.js +2 -2
- package/node/job-execution/Sas9JobExecutor.d.ts +6 -5
- package/node/request/RequestClient.d.ts +4 -2
- package/node/request/Sas9RequestClient.d.ts +3 -1
- package/node/types/ExecuteScript.d.ts +0 -1
- package/node/types/SASjsConfig.d.ts +11 -4
- package/node/utils/createAxiosInstance.d.ts +3 -0
- package/node/utils/getValidJson.d.ts +1 -1
- package/node/utils/index.d.ts +1 -0
- package/node/utils/parseViyaDebugResponse.d.ts +1 -1
- package/package.json +10 -6
- package/request/RequestClient.d.ts +4 -2
- package/request/Sas9RequestClient.d.ts +3 -1
- package/src/SAS9ApiClient.ts +3 -2
- package/src/SASjs.ts +17 -12
- package/src/auth/AuthManager.ts +23 -10
- package/src/auth/getAccessToken.ts +1 -1
- package/src/job-execution/Sas9JobExecutor.ts +36 -5
- package/src/job-execution/WebJobExecutor.ts +18 -3
- package/src/request/RequestClient.ts +23 -20
- package/src/request/Sas9RequestClient.ts +3 -2
- package/src/test/SAS_server_app.ts +38 -0
- package/src/types/ExecuteScript.ts +0 -1
- package/src/types/SASjsConfig.ts +10 -4
- package/src/utils/createAxiosInstance.ts +7 -0
- package/src/utils/getValidJson.ts +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/parseWeboutResponse.ts +1 -1
- package/test/RequestClient.spec.d.ts +1 -0
- package/test/SAS_server_app.d.ts +10 -0
- package/types/ExecuteScript.d.ts +0 -1
- package/types/SASjsConfig.d.ts +11 -4
- package/utils/createAxiosInstance.d.ts +3 -0
- package/utils/getValidJson.d.ts +1 -1
- package/utils/index.d.ts +1 -0
- package/utils/parseViyaDebugResponse.d.ts +1 -1
- package/CHANGELOG.md +0 -213
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import express = require('express')
|
|
2
|
+
|
|
3
|
+
export const app = express()
|
|
4
|
+
|
|
5
|
+
export const mockedAuthResponse = {
|
|
6
|
+
access_token: 'access_token',
|
|
7
|
+
token_type: 'bearer',
|
|
8
|
+
id_token: 'id_token',
|
|
9
|
+
refresh_token: 'refresh_token',
|
|
10
|
+
expires_in: 43199,
|
|
11
|
+
scope: 'openid',
|
|
12
|
+
jti: 'jti'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
app.get('/', function (req: any, res: any) {
|
|
16
|
+
res.send('Hello World')
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
app.post('/SASLogon/oauth/token', function (req: any, res: any) {
|
|
20
|
+
let valid = true
|
|
21
|
+
// capture the encoded form data
|
|
22
|
+
req.on('data', (data: any) => {
|
|
23
|
+
const resData = data.toString()
|
|
24
|
+
|
|
25
|
+
if (resData.includes('incorrect')) valid = false
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
// send a response when finished reading
|
|
29
|
+
// the encoded form data
|
|
30
|
+
req.on('end', () => {
|
|
31
|
+
if (valid) res.status(200).send(mockedAuthResponse)
|
|
32
|
+
else
|
|
33
|
+
res.status(401).send({
|
|
34
|
+
error: 'unauthorized',
|
|
35
|
+
error_description: 'Bad credentials'
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
})
|
package/src/types/SASjsConfig.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as https from 'https'
|
|
1
2
|
import { ServerType } from '@sasjs/utils/types'
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -11,6 +12,11 @@ export class SASjsConfig {
|
|
|
11
12
|
* streamed.
|
|
12
13
|
*/
|
|
13
14
|
serverUrl: string = ''
|
|
15
|
+
/**
|
|
16
|
+
* The location of the STP Process Web Application. By default the adapter
|
|
17
|
+
* will use '/SASjsApi/stp/execute' on SAS JS.
|
|
18
|
+
*/
|
|
19
|
+
pathSASJS?: string = ''
|
|
14
20
|
/**
|
|
15
21
|
* The location of the Stored Process Web Application. By default the adapter
|
|
16
22
|
* will use '/SASStoredProcess/do' on SAS 9.
|
|
@@ -54,11 +60,11 @@ export class SASjsConfig {
|
|
|
54
60
|
*/
|
|
55
61
|
useComputeApi: boolean | null = null
|
|
56
62
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
63
|
+
* Optional settings to configure HTTPS Agent.
|
|
64
|
+
* By providing `key`, `cert`, `ca` to connect with server
|
|
65
|
+
* Other options can be set `rejectUnauthorized` and `requestCert`
|
|
60
66
|
*/
|
|
61
|
-
|
|
67
|
+
httpsAgentOptions?: https.AgentOptions
|
|
62
68
|
/**
|
|
63
69
|
* Supported login mechanisms are - Redirected and Default
|
|
64
70
|
*/
|
|
@@ -4,7 +4,7 @@ import { JsonParseArrayError, InvalidJsonError } from '../types/errors'
|
|
|
4
4
|
* if string passed then parse the string to json else if throw error for all other types unless it is not a valid json object.
|
|
5
5
|
* @param str - string to check.
|
|
6
6
|
*/
|
|
7
|
-
export const getValidJson = (str: string | object) => {
|
|
7
|
+
export const getValidJson = (str: string | object): object => {
|
|
8
8
|
try {
|
|
9
9
|
if (str === null || str === undefined) throw new InvalidJsonError()
|
|
10
10
|
|
package/src/utils/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WeboutResponseError } from '../types/errors'
|
|
2
2
|
|
|
3
|
-
export const parseWeboutResponse = (response: string, url?: string) => {
|
|
3
|
+
export const parseWeboutResponse = (response: string, url?: string): string => {
|
|
4
4
|
let sasResponse = ''
|
|
5
5
|
|
|
6
6
|
if (response.includes('>>weboutBEGIN<<')) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const app: import("express-serve-static-core").Express;
|
|
2
|
+
export declare const mockedAuthResponse: {
|
|
3
|
+
access_token: string;
|
|
4
|
+
token_type: string;
|
|
5
|
+
id_token: string;
|
|
6
|
+
refresh_token: string;
|
|
7
|
+
expires_in: number;
|
|
8
|
+
scope: string;
|
|
9
|
+
jti: string;
|
|
10
|
+
};
|
package/types/ExecuteScript.d.ts
CHANGED
package/types/SASjsConfig.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import * as https from 'https';
|
|
1
3
|
import { ServerType } from '@sasjs/utils/types';
|
|
2
4
|
/**
|
|
3
5
|
* Specifies the configuration for the SASjs instance - eg where and how to
|
|
@@ -10,6 +12,11 @@ export declare class SASjsConfig {
|
|
|
10
12
|
* streamed.
|
|
11
13
|
*/
|
|
12
14
|
serverUrl: string;
|
|
15
|
+
/**
|
|
16
|
+
* The location of the STP Process Web Application. By default the adapter
|
|
17
|
+
* will use '/SASjsApi/stp/execute' on SAS JS.
|
|
18
|
+
*/
|
|
19
|
+
pathSASJS?: string;
|
|
13
20
|
/**
|
|
14
21
|
* The location of the Stored Process Web Application. By default the adapter
|
|
15
22
|
* will use '/SASStoredProcess/do' on SAS 9.
|
|
@@ -53,11 +60,11 @@ export declare class SASjsConfig {
|
|
|
53
60
|
*/
|
|
54
61
|
useComputeApi: boolean | null;
|
|
55
62
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
63
|
+
* Optional settings to configure HTTPS Agent.
|
|
64
|
+
* By providing `key`, `cert`, `ca` to connect with server
|
|
65
|
+
* Other options can be set `rejectUnauthorized` and `requestCert`
|
|
59
66
|
*/
|
|
60
|
-
|
|
67
|
+
httpsAgentOptions?: https.AgentOptions;
|
|
61
68
|
/**
|
|
62
69
|
* Supported login mechanisms are - Redirected and Default
|
|
63
70
|
*/
|
package/utils/getValidJson.d.ts
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* if string passed then parse the string to json else if throw error for all other types unless it is not a valid json object.
|
|
3
3
|
* @param str - string to check.
|
|
4
4
|
*/
|
|
5
|
-
export declare const getValidJson: (str: string | object) =>
|
|
5
|
+
export declare const getValidJson: (str: string | object) => object;
|
package/utils/index.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ import { RequestClient } from '../request/RequestClient';
|
|
|
9
9
|
* @param serverUrl
|
|
10
10
|
* @returns
|
|
11
11
|
*/
|
|
12
|
-
export declare const parseSasViyaDebugResponse: (response: string, requestClient: RequestClient, serverUrl: string) => Promise<
|
|
12
|
+
export declare const parseSasViyaDebugResponse: (response: string, requestClient: RequestClient, serverUrl: string) => Promise<object>;
|
package/CHANGELOG.md
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
Since March 2020 the changelog is managed by github releases - see [https://github.com/sasjs/adapter/releases](https://github.com/sasjs/adapter/releases).
|
|
4
|
-
|
|
5
|
-
## Changes up to 5th March 2020
|
|
6
|
-
|
|
7
|
-
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
8
|
-
|
|
9
|
-
<a name="1.9.0"></a>
|
|
10
|
-
# [1.9.0](https://github.com/macropeople/sasjs/compare/v1.8.0...v1.9.0) (2020-03-05)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
### Bug Fixes
|
|
14
|
-
|
|
15
|
-
* special chars regex, csv function improvements ([5c8e3fe](https://github.com/macropeople/sasjs/commit/5c8e3fe))
|
|
16
|
-
* splitting tests in different files ([95e1d8b](https://github.com/macropeople/sasjs/commit/95e1d8b))
|
|
17
|
-
* switching crlfs to lfs in values ([277cf3f](https://github.com/macropeople/sasjs/commit/277cf3f))
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
### Features
|
|
21
|
-
|
|
22
|
-
* fixing tests to fit adapter behaviour ([6146189](https://github.com/macropeople/sasjs/commit/6146189))
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<a name="1.8.0"></a>
|
|
27
|
-
# [1.8.0](https://github.com/macropeople/sasjs/compare/v1.7.2...v1.8.0) (2020-03-03)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Bug Fixes
|
|
31
|
-
|
|
32
|
-
* parsing error from response ([ff5fa1b](https://github.com/macropeople/sasjs/commit/ff5fa1b))
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
### Features
|
|
36
|
-
|
|
37
|
-
* update SASjs configuration after initializaton ([ee1255c](https://github.com/macropeople/sasjs/commit/ee1255c))
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<a name="1.7.2"></a>
|
|
42
|
-
## [1.7.2](https://github.com/macropeople/sasjs/compare/v1.7.1...v1.7.2) (2020-03-02)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<a name="1.7.1"></a>
|
|
47
|
-
## [1.7.1](https://github.com/macropeople/sasjs/compare/v1.7.0...v1.7.1) (2020-03-02)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
### Bug Fixes
|
|
51
|
-
|
|
52
|
-
* header data types, empty numerics ([c95c9fc](https://github.com/macropeople/sasjs/commit/c95c9fc))
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
<a name="1.7.0"></a>
|
|
57
|
-
# [1.7.0](https://github.com/macropeople/sasjs/compare/v1.6.5...v1.7.0) (2020-03-01)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
### Bug Fixes
|
|
61
|
-
|
|
62
|
-
* adapter upgrade ([7c221dc](https://github.com/macropeople/sasjs/commit/7c221dc))
|
|
63
|
-
* failing test ([12b29b0](https://github.com/macropeople/sasjs/commit/12b29b0))
|
|
64
|
-
* retry on redirect only with SAS9 ([69d08e5](https://github.com/macropeople/sasjs/commit/69d08e5))
|
|
65
|
-
* test rewrite ([aeb636b](https://github.com/macropeople/sasjs/commit/aeb636b))
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
### Features
|
|
69
|
-
|
|
70
|
-
* tests for sasjs, also bumping cypress version and setting cypress tsconfig to ES6 (we'll be using cypress browsers) ([e8193c1](https://github.com/macropeople/sasjs/commit/e8193c1))
|
|
71
|
-
* tests for sasjs, also bumping cypress version and setting cypress tsconfig to ES6 (we'll be using cypress browsers) ([a197344](https://github.com/macropeople/sasjs/commit/a197344))
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
<a name="1.6.5"></a>
|
|
76
|
-
## [1.6.5](https://github.com/macropeople/sasjs/compare/v1.6.4...v1.6.5) (2020-03-01)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
<a name="1.6.4"></a>
|
|
81
|
-
## [1.6.4](https://github.com/macropeople/sasjs/compare/v1.6.3...v1.6.4) (2020-03-01)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
<a name="1.6.3"></a>
|
|
86
|
-
## [1.6.3](https://github.com/macropeople/sasjs/compare/v1.6.2...v1.6.3) (2020-02-26)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
### Bug Fixes
|
|
90
|
-
|
|
91
|
-
* always check session before trying to log in ([6f256ac](https://github.com/macropeople/sasjs/commit/6f256ac))
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
<a name="1.6.2"></a>
|
|
96
|
-
## [1.6.2](https://github.com/macropeople/sasjs/compare/v1.6.1...v1.6.2) (2020-02-26)
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
### Bug Fixes
|
|
100
|
-
|
|
101
|
-
* SAS9 response fix ([4917d38](https://github.com/macropeople/sasjs/commit/4917d38))
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
<a name="1.6.1"></a>
|
|
106
|
-
## [1.6.1](https://github.com/macropeople/sasjs/compare/v1.6.0...v1.6.1) (2020-02-23)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
<a name="1.6.0"></a>
|
|
111
|
-
# [1.6.0](https://github.com/macropeople/sasjs/compare/v1.5.4...v1.6.0) (2020-02-23)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
### Features
|
|
115
|
-
|
|
116
|
-
* adding sasjs JS file in dist folder ([a4d7e87](https://github.com/macropeople/sasjs/commit/a4d7e87))
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
<a name="1.5.4"></a>
|
|
121
|
-
## [1.5.4](https://github.com/macropeople/sasjs/compare/v1.5.3...v1.5.4) (2020-02-22)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
### Bug Fixes
|
|
125
|
-
|
|
126
|
-
* splice log only if there is a log in Viya ([d72a987](https://github.com/macropeople/sasjs/commit/d72a987))
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
<a name="1.5.3"></a>
|
|
131
|
-
## [1.5.3](https://github.com/macropeople/sasjs/compare/v1.5.2...v1.5.3) (2020-02-22)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
### Bug Fixes
|
|
135
|
-
|
|
136
|
-
* capturing and parsing program code in Viya, plus replacement of console logs with console errors ([f4d6ac7](https://github.com/macropeople/sasjs/commit/f4d6ac7))
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
<a name="1.5.2"></a>
|
|
141
|
-
## [1.5.2](https://github.com/macropeople/sasjs/compare/v1.5.1...v1.5.2) (2020-02-22)
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
<a name="1.5.1"></a>
|
|
146
|
-
## [1.5.1](https://github.com/macropeople/sasjs/compare/v1.5.0...v1.5.1) (2020-02-21)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
### Bug Fixes
|
|
150
|
-
|
|
151
|
-
* parse code only when log is available ([92fadff](https://github.com/macropeople/sasjs/commit/92fadff))
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
<a name="1.5.0"></a>
|
|
156
|
-
# [1.5.0](https://github.com/macropeople/sasjs/compare/v1.4.2...v1.5.0) (2020-02-21)
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
### Bug Fixes
|
|
160
|
-
|
|
161
|
-
* fetch login form data if not available ([d7e7b2f](https://github.com/macropeople/sasjs/commit/d7e7b2f))
|
|
162
|
-
* revert unnecessary change ([34ed2a0](https://github.com/macropeople/sasjs/commit/34ed2a0))
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
### Features
|
|
166
|
-
|
|
167
|
-
* add checkSession API ([dc170fe](https://github.com/macropeople/sasjs/commit/dc170fe))
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
<a name="1.4.2"></a>
|
|
172
|
-
## [1.4.2](https://github.com/macropeople/sasjs/compare/v1.4.0...v1.4.2) (2020-02-20)
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
### Bug Fixes
|
|
176
|
-
|
|
177
|
-
* premature assignment of loginLink ([0c8a967](https://github.com/macropeople/sasjs/commit/0c8a967))
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
<a name="1.4.0"></a>
|
|
182
|
-
# [1.4.0](https://github.com/macropeople/sasjs/compare/v1.3.0...v1.4.0) (2020-02-20)
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
### Bug Fixes
|
|
186
|
-
|
|
187
|
-
* putting param export in right place ([6372ea2](https://github.com/macropeople/sasjs/commit/6372ea2))
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
### Features
|
|
191
|
-
|
|
192
|
-
* switching from file based upload to params for Viya. Fixes [#13](https://github.com/macropeople/sasjs/issues/13) ([2aeba78](https://github.com/macropeople/sasjs/commit/2aeba78))
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
<a name="1.3.0"></a>
|
|
197
|
-
# 1.3.0 (2020-02-17)
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
### Bug Fixes
|
|
201
|
-
|
|
202
|
-
* closes #issue6 ([efe1510](https://github.com/macropeople/sasjs/commit/efe1510)), closes [#issue6](https://github.com/macropeople/sasjs/issues/issue6)
|
|
203
|
-
* add setter for debug state ([10945a6](https://github.com/macropeople/sasjs/commit/10945a6))
|
|
204
|
-
* config renaming ([f8ace78](https://github.com/macropeople/sasjs/commit/f8ace78))
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
### Features
|
|
208
|
-
|
|
209
|
-
* adding MIT license ([ef19e2a](https://github.com/macropeople/sasjs/commit/ef19e2a))
|
|
210
|
-
* add parsing of source and generated code from response ([892122a](https://github.com/macropeople/sasjs/commit/892122a))
|
|
211
|
-
* add support for SAS9 responses ([96c31c8](https://github.com/macropeople/sasjs/commit/96c31c8))
|
|
212
|
-
* code of conduct ([cf31ce6](https://github.com/macropeople/sasjs/commit/cf31ce6))
|
|
213
|
-
* initial commit ([6957dac](https://github.com/macropeople/sasjs/commit/6957dac))
|