@sasjs/adapter 4.6.0 → 4.8.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/README.md CHANGED
@@ -151,7 +151,11 @@ The `request()` method also has optional parameters such as a config object and
151
151
 
152
152
  The response object will contain returned tables and columns. Table names are always lowercase, and column names uppercase.
153
153
 
154
- The adapter will also cache the logs (if debug enabled) and even the work tables. For performance, it is best to keep debug mode off.
154
+ The adapter will also cache the logs (if debug enabled) and even the work tables. For performance, it is best to keep debug mode off.
155
+
156
+ ### Verbose Mode
157
+
158
+ Set `verbose` to `true` to enable verbose mode that logs a summary of every HTTP response. Verbose mode can be disabled by calling `disableVerboseMode` method or enabled by `enableVerboseMode` method. Verbose mode can also be enabled/disabled by `startComputeJob` method.
155
159
 
156
160
  ### Session Manager
157
161
 
@@ -273,6 +277,7 @@ Configuration on the client side involves passing an object on startup, which ca
273
277
  * `serverType` - either `SAS9`, `SASVIYA` or `SASJS`. The `SASJS` server type is for use with [sasjs/server](https://github.com/sasjs/server).
274
278
  * `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.
275
279
  * `debug` - if `true` then SAS Logs and extra debug information is returned.
280
+ * `verbose` - optional, if `true` then a summary of every HTTP response is logged.
276
281
  * `loginMechanism` - either `Default` or `Redirected`. See [SAS Logon](#sas-logon) section.
277
282
  * `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.
278
283
  * `contextName` - Compute context on which the requests will be called. If missing or not provided, defaults to `Job Execution Compute context`.
package/SASjs.d.ts CHANGED
@@ -4,6 +4,7 @@ import { SASViyaApiClient } from './SASViyaApiClient';
4
4
  import { SASjsAuthResponse } from './SASjsApiClient';
5
5
  import { MacroVar, AuthConfig, ExtraResponseAttributes, SasAuthResponse, AuthConfigSas9 } from '@sasjs/utils/types';
6
6
  import { LoginOptions, LoginResult } from './types/Login';
7
+ import { AxiosResponse } from 'axios';
7
8
  interface ExecuteScriptParams {
8
9
  linesOfCode: string[];
9
10
  fileName?: string;
@@ -308,8 +309,9 @@ export default class SASjs {
308
309
  * @param pollOptions - an object that represents poll interval(milliseconds) and maximum amount of attempts. Object example: { maxPollCount: 24 * 60 * 60, pollInterval: 1000 }. More information available at src/api/viya/pollJobState.ts.
309
310
  * @param printPid - a boolean that indicates whether the function should print (PID) of the started job.
310
311
  * @param variables - an object that represents macro variables.
312
+ * @param verboseMode - boolean to enable verbose mode (log every HTTP response).
311
313
  */
312
- startComputeJob(sasJob: string, data: any, config?: any, authConfig?: AuthConfig, waitForResult?: boolean, pollOptions?: PollOptions, printPid?: boolean, variables?: MacroVar): Promise<any>;
314
+ startComputeJob(sasJob: string, data: any, config?: any, authConfig?: AuthConfig, waitForResult?: boolean, pollOptions?: PollOptions, printPid?: boolean, variables?: MacroVar, verboseMode?: boolean): Promise<any>;
313
315
  private resendWaitingRequests;
314
316
  /**
315
317
  * Fetches content of the log file
@@ -326,5 +328,15 @@ export default class SASjs {
326
328
  private setupConfiguration;
327
329
  private createFoldersAndServices;
328
330
  private isMethodSupported;
331
+ /**
332
+ * Enables verbose mode that will log a summary of every HTTP response.
333
+ * @param successCallBack - function that should be triggered on every HTTP response with the status 2**.
334
+ * @param errorCallBack - function that should be triggered on every HTTP response with the status different from 2**.
335
+ */
336
+ enableVerboseMode(successCallBack?: (response: AxiosResponse) => AxiosResponse, errorCallBack?: (response: AxiosResponse) => AxiosResponse): void;
337
+ /**
338
+ * Turns off verbose mode to log every HTTP response.
339
+ */
340
+ disableVerboseMode(): void;
329
341
  }
330
342
  export {};