@sasjs/adapter 3.10.3 → 3.10.6
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 +14 -6
- package/SASjs.d.ts +1 -4
- package/auth/AuthManager.d.ts +2 -5
- package/index.js +2 -2
- package/node/SASjs.d.ts +1 -4
- package/node/auth/AuthManager.d.ts +2 -5
- package/node/index.js +2 -2
- package/node/utils/convertToCsv.d.ts +5 -0
- package/package.json +2 -2
- package/src/auth/AuthManager.ts +2 -12
- package/src/file/generateTableUploadForm.ts +3 -2
- package/src/request/RequestClient.ts +7 -0
- package/src/utils/convertToCsv.ts +11 -1
- package/src/utils/formatDataForRequest.ts +4 -3
- package/utils/convertToCsv.d.ts +5 -0
package/README.md
CHANGED
|
@@ -94,10 +94,10 @@ const sasJs = new SASjs({your config})
|
|
|
94
94
|
More on the config later.
|
|
95
95
|
|
|
96
96
|
### SAS Logon
|
|
97
|
-
All authentication from the adapter is done against SASLogon. There are two approaches that can be taken, which are configured using the `
|
|
97
|
+
All authentication from the adapter is done against SASLogon. There are two approaches that can be taken, which are configured using the `loginMechanism` attribute of the sasJs config object (above):
|
|
98
98
|
|
|
99
|
-
* `
|
|
100
|
-
* `
|
|
99
|
+
* `loginMechanism:'Redirected'` - this approach enables authentication through a SASLogon window, supporting complex authentication flows (such as 2FA) and avoids the need to handle passwords in the application itself. The styling of the window can be modified using CSS.
|
|
100
|
+
* `loginMechanism:'Default'` - this approach requires that the username and password are captured, and used within the `.login()` method. This can be helpful for development, or automated testing.
|
|
101
101
|
|
|
102
102
|
Sample code for logging in with the `Default` approach:
|
|
103
103
|
|
|
@@ -125,7 +125,11 @@ sasJs.request("/path/to/my/service", dataObject)
|
|
|
125
125
|
})
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
-
We supply the path to the SAS service, and a data object.
|
|
128
|
+
We supply the path to the SAS service, and a data object.
|
|
129
|
+
|
|
130
|
+
If the path starts with a `/` then it should be a full path to the service. If there is no leading `/` then it is relative to the `appLoc`.
|
|
131
|
+
|
|
132
|
+
The data object can be null (for services with no input), or can contain one or more "tables" in the following format:
|
|
129
133
|
|
|
130
134
|
```javascript
|
|
131
135
|
let dataObject={
|
|
@@ -141,7 +145,9 @@ let dataObject={
|
|
|
141
145
|
};
|
|
142
146
|
```
|
|
143
147
|
|
|
144
|
-
|
|
148
|
+
These tables (`tablewith2cols1row` and `tablewith1col2rows`) will be created in SAS WORK after running `%webout(FETCH)` in your SAS service.
|
|
149
|
+
|
|
150
|
+
The `request()` method also has optional parameters such as a config object and a callback login function.
|
|
145
151
|
|
|
146
152
|
The response object will contain returned tables and columns. Table names are always lowercase, and column names uppercase.
|
|
147
153
|
|
|
@@ -248,6 +254,8 @@ Where an entire column is made up of special missing numerics, there would be no
|
|
|
248
254
|
%webout(OBJ,a,missing=STRING,showmeta=YES)
|
|
249
255
|
```
|
|
250
256
|
|
|
257
|
+
The `%webout()` macro itself is just a wrapper for the [mp_jsonout](https://core.sasjs.io/mp__jsonout_8sas.html) macro.
|
|
258
|
+
|
|
251
259
|
## Configuration
|
|
252
260
|
|
|
253
261
|
Configuration on the client side involves passing an object on startup, which can also be passed with each request. Technical documentation on the SASjsConfig class is available [here](https://adapter.sasjs.io/classes/types.sasjsconfig.html). The main config items are:
|
|
@@ -256,7 +264,7 @@ Configuration on the client side involves passing an object on startup, which ca
|
|
|
256
264
|
* `serverType` - either `SAS9`, `SASVIYA` or `SASJS`. The `SASJS` server type is for use with [sasjs/server](https://github.com/sasjs/server).
|
|
257
265
|
* `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.
|
|
258
266
|
* `debug` - if `true` then SAS Logs and extra debug information is returned.
|
|
259
|
-
* `
|
|
267
|
+
* `loginMechanism` - either `Default` or `Redirected`. See [SAS Logon](#sas-logon) section.
|
|
260
268
|
* `useComputeApi` - Only relevant when the serverType is `SASVIYA`. If `true` the [Compute API](#using-the-compute-api) is used. If `false` the [JES API](#using-the-jes-api) is used. If `null` or `undefined` the [Web](#using-jes-web-app) approach is used.
|
|
261
269
|
* `contextName` - Compute context on which the requests will be called. If missing or not provided, defaults to `Job Execution Compute context`.
|
|
262
270
|
* `requestHistoryLimit` - Request history limit. Increasing this limit may affect browser performance, especially with debug (logs) enabled. Default is 10.
|
package/SASjs.d.ts
CHANGED
|
@@ -233,10 +233,7 @@ export default class SASjs {
|
|
|
233
233
|
/**
|
|
234
234
|
* Logs out of the configured SAS server.
|
|
235
235
|
*/
|
|
236
|
-
logOut(): Promise<boolean
|
|
237
|
-
result: unknown;
|
|
238
|
-
etag: string;
|
|
239
|
-
}>;
|
|
236
|
+
logOut(): Promise<boolean>;
|
|
240
237
|
/**
|
|
241
238
|
* Uploads a file to the given service.
|
|
242
239
|
* @param sasJob - the path to the SAS program (ultimately resolves to
|
package/auth/AuthManager.d.ts
CHANGED
|
@@ -44,10 +44,7 @@ export declare class AuthManager {
|
|
|
44
44
|
private setLoginUrl;
|
|
45
45
|
/**
|
|
46
46
|
* Logs out of the configured SAS server.
|
|
47
|
-
*
|
|
47
|
+
*
|
|
48
48
|
*/
|
|
49
|
-
logOut(): Promise<boolean
|
|
50
|
-
result: unknown;
|
|
51
|
-
etag: string;
|
|
52
|
-
}>;
|
|
49
|
+
logOut(): Promise<boolean>;
|
|
53
50
|
}
|