@sasjs/adapter 2.11.0 → 2.11.4

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 CHANGED
@@ -36,7 +36,7 @@ Ok ok. Deploy this [example.html](https://raw.githubusercontent.com/sasjs/adapte
36
36
 
37
37
  The backend part can be deployed as follows:
38
38
 
39
- ```
39
+ ```sas
40
40
  %let appLoc=/Public/app/readme; /* Metadata or Viya Folder per SASjs config */
41
41
  filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
42
42
  %inc mc; /* compile macros (can also be downloaded & compiled seperately) */
@@ -85,11 +85,11 @@ let sasJs = new SASjs.default(
85
85
  );
86
86
  ```
87
87
  If you've installed it via NPM, you can import it as a default import like so:
88
- ```
88
+ ```js
89
89
  import SASjs from '@sasjs/adapter';
90
90
  ```
91
91
  You can then instantiate it with:
92
- ```
92
+ ```js
93
93
  const sasJs = new SASjs({your config})
94
94
  ```
95
95
 
@@ -119,6 +119,7 @@ sasJs.request("/path/to/my/service", dataObject)
119
119
  console.log(response.tablewith2cols1row[0].COL1.value)
120
120
  })
121
121
  ```
122
+
122
123
  We supply the path to the SAS service, and a data object. The data object can be null (for services with no input), or can contain one or more tables in the following format:
123
124
 
124
125
  ```javascript
@@ -146,6 +147,7 @@ The adapter will also cache the logs (if debug enabled) and even the work tables
146
147
  The SAS side is handled by a number of macros in the [macro core](https://github.com/sasjs/core) library.
147
148
 
148
149
  The following snippet shows the process of SAS tables arriving / leaving:
150
+
149
151
  ```sas
150
152
  /* fetch all input tables sent from frontend - they arrive as work tables */
151
153
  %webout(FETCH)
@@ -161,7 +163,6 @@ run;
161
163
  %webout(OBJ,tables,fmt=N) /* unformatted (raw) data */
162
164
  %webout(OBJ,tables,label=newtable) /* rename tables on export */
163
165
  %webout(CLOSE) /* close the JSON and send some extra useful variables too */
164
-
165
166
  ```
166
167
 
167
168
  ## Configuration
@@ -172,6 +173,7 @@ Configuration on the client side involves passing an object on startup, which ca
172
173
  * `serverType` - either `SAS9` or `SASVIYA`.
173
174
  * `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.
174
175
  * `debug` - if `true` then SAS Logs and extra debug information is returned.
176
+ * `LoginMechanism` - either `Default` or `Redirected`. If `Redirected` then authentication occurs through the injection of an additional screen, which contains the SASLogon prompt. This allows for more complex authentication flows (such as 2FA) and avoids the need to handle passwords in the application itself. The styling of the redirect flow can also be modified. If left at "Default" then the developer must capture the username and password and use these with the `.login()` method.
175
177
  * `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.
176
178
  * `contextName` - Compute context on which the requests will be called. If missing or not provided, defaults to `Job Execution Compute context`.
177
179
 
@@ -196,7 +198,7 @@ Here we are running Jobs using the Job Execution Service except this time we are
196
198
 
197
199
  This approach (`useComputeApi: false`) also ensures that jobs are displayed in Environment Manager.
198
200
 
199
- ```
201
+ ```json
200
202
  {
201
203
  appLoc:"/Your/Path",
202
204
  serverType:"SASVIYA",
@@ -210,12 +212,12 @@ This approach is by far the fastest, as a result of the optimisations we have bu
210
212
 
211
213
  With this approach (`useComputeApi: true`), the requests/logs will _not_ appear in the list in Environment manager.
212
214
 
213
- ```
215
+ ```json
214
216
  {
215
217
  appLoc:"/Your/Path",
216
218
  serverType:"SASVIYA",
217
219
  useComputeApi: true,
218
- contextName: 'yourComputeContext'
220
+ contextName: "yourComputeContext"
219
221
  }
220
222
  ```
221
223
 
@@ -16,6 +16,13 @@ export declare class SASViyaApiClient {
16
16
  private sessionManager;
17
17
  private contextManager;
18
18
  private folderMap;
19
+ /**
20
+ * A helper method used to call appendRequest method of RequestClient
21
+ * @param response - response from sasjs request
22
+ * @param program - name of program
23
+ * @param debug - a boolean that indicates whether debug was enabled or not
24
+ */
25
+ appendRequest(response: any, program: string, debug: boolean): void;
19
26
  get debug(): boolean;
20
27
  set debug(value: boolean);
21
28
  /**
package/SASjs.d.ts CHANGED
@@ -219,9 +219,18 @@ export default class SASjs {
219
219
  * Process). Is prepended at runtime with the value of `appLoc`.
220
220
  * @param files - array of files to be uploaded, including File object and file name.
221
221
  * @param params - request URL parameters.
222
- * @param overrideSasjsConfig - object to override existing config (optional)
222
+ * @param config - provide any changes to the config here, for instance to
223
+ * enable/disable `debug`. Any change provided will override the global config,
224
+ * for that particular function call.
225
+ * @param loginRequiredCallback - a function that is called if the
226
+ * user is not logged in (eg to display a login form). The request will be
227
+ * resubmitted after successful login.
223
228
  */
224
- uploadFile(sasJob: string, files: UploadFile[], params: any, overrideSasjsConfig?: any): Promise<any>;
229
+ uploadFile(sasJob: string, files: UploadFile[], params: {
230
+ [key: string]: any;
231
+ } | null, config?: {
232
+ [key: string]: any;
233
+ }, loginRequiredCallback?: () => any): Promise<unknown>;
225
234
  /**
226
235
  * Makes a request to the SAS Service specified in `SASjob`. The response
227
236
  * object will always contain table names in lowercase, and column names in
@@ -304,6 +313,10 @@ export default class SASjs {
304
313
  * @param accessToken - an access token for an authorized user.
305
314
  */
306
315
  fetchLogFileContent(logUrl: string, accessToken?: string): Promise<string>;
316
+ /**
317
+ * this method returns an array of SASjsRequest
318
+ * @returns SASjsRequest[]
319
+ */
307
320
  getSasRequests(): import("./types").SASjsRequest[];
308
321
  clearSasRequests(): void;
309
322
  private setupConfiguration;