@sasjs/adapter 3.7.7 → 3.7.8
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 +12 -5
- package/index.js +2 -2
- package/node/index.js +2 -2
- package/package.json +1 -1
- package/src/auth/getAccessTokenForViya.ts +7 -17
package/README.md
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
|
|
21
21
|
SASjs is a open-source framework for building Web Apps on SAS® platforms. You can use as much or as little of it as you like. This repository contains the JS adapter, the part that handles the to/from SAS communication on the client side. There are 3 ways to install it:
|
|
22
22
|
|
|
23
|
-
1 - `npm install @sasjs/adapter` - for use in a
|
|
23
|
+
1 - `npm install @sasjs/adapter` - for use in a nodeJS project (recommended)
|
|
24
24
|
|
|
25
|
-
2 - [Download](https://cdn.jsdelivr.net/npm/@sasjs/adapter@
|
|
25
|
+
2 - [Download](https://cdn.jsdelivr.net/npm/@sasjs/adapter@3/index.min.js) and use a copy of the latest JS file
|
|
26
26
|
|
|
27
27
|
3 - Reference directly from the CDN - in which case click [here](https://www.jsdelivr.com/package/npm/@sasjs/adapter?tab=collection) and select "SRI" to get the script tag with the integrity hash.
|
|
28
28
|
|
|
@@ -96,7 +96,12 @@ const sasJs = new SASjs({your config})
|
|
|
96
96
|
More on the config later.
|
|
97
97
|
|
|
98
98
|
### SAS Logon
|
|
99
|
-
|
|
99
|
+
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):
|
|
100
|
+
|
|
101
|
+
* `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.
|
|
102
|
+
* `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.
|
|
103
|
+
|
|
104
|
+
Sample code for logging in with the `Default` approach:
|
|
100
105
|
|
|
101
106
|
```javascript
|
|
102
107
|
sasJs.logIn('USERNAME','PASSWORD'
|
|
@@ -109,6 +114,8 @@ sasJs.logIn('USERNAME','PASSWORD'
|
|
|
109
114
|
}
|
|
110
115
|
```
|
|
111
116
|
|
|
117
|
+
More examples of using authentication, and more, can be found in the [SASjs Seed Apps](https://github.com/search?q=topic%3Asasjs-app+org%3Asasjs+fork%3Atrue) on github.
|
|
118
|
+
|
|
112
119
|
### Request / Response
|
|
113
120
|
A simple request can be sent to SAS in the following fashion:
|
|
114
121
|
|
|
@@ -247,11 +254,11 @@ Where an entire column is made up of special missing numerics, there would be no
|
|
|
247
254
|
|
|
248
255
|
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:
|
|
249
256
|
|
|
250
|
-
* `appLoc` - this is the folder under which the SAS services
|
|
257
|
+
* `appLoc` - this is the folder (eg in metadata or SAS Drive) under which the SAS services are created.
|
|
251
258
|
* `serverType` - either `SAS9`, `SASVIYA` or `SASJS`. The `SASJS` server type is for use with [sasjs/server](https://github.com/sasjs/server).
|
|
252
259
|
* `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.
|
|
253
260
|
* `debug` - if `true` then SAS Logs and extra debug information is returned.
|
|
254
|
-
* `LoginMechanism` - either `Default` or `Redirected`.
|
|
261
|
+
* `LoginMechanism` - either `Default` or `Redirected`. See [SAS Logon](#sas-logon) section.
|
|
255
262
|
* `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.
|
|
256
263
|
* `contextName` - Compute context on which the requests will be called. If missing or not provided, defaults to `Job Execution Compute context`.
|
|
257
264
|
* `requestHistoryLimit` - Request history limit. Increasing this limit may affect browser performance, especially with debug (logs) enabled. Default is 10.
|