@sasjs/adapter 4.8.0 → 4.9.1

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
@@ -155,7 +155,7 @@ The adapter will also cache the logs (if debug enabled) and even the work tables
155
155
 
156
156
  ### Verbose Mode
157
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.
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 also supports `bleached` mode that disables extra colors in req/res summary. To enable `bleached` verbose mode, pass `verbose` equal to `bleached` while instantiating an instance of `RequestClient` or to `setVerboseMode` method. Verbose mode can also be enabled/disabled by `startComputeJob` method.
159
159
 
160
160
  ### Session Manager
161
161
 
package/SASjs.d.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  /// <reference types="node" />
2
- import { SASjsConfig, UploadFile, EditContextInput, PollOptions } from './types';
2
+ import { SASjsConfig, UploadFile, EditContextInput, PollOptions, VerboseMode, LoginOptions, LoginResult, ExecutionQuery } from './types';
3
3
  import { SASViyaApiClient } from './SASViyaApiClient';
4
4
  import { SASjsAuthResponse } from './SASjsApiClient';
5
5
  import { MacroVar, AuthConfig, ExtraResponseAttributes, SasAuthResponse, AuthConfigSas9 } from '@sasjs/utils/types';
6
- import { LoginOptions, LoginResult } from './types/Login';
7
- import { AxiosResponse } from 'axios';
6
+ import { AxiosResponse, AxiosError } from 'axios';
8
7
  interface ExecuteScriptParams {
9
8
  linesOfCode: string[];
10
9
  fileName?: string;
@@ -45,6 +44,17 @@ export default class SASjs {
45
44
  * @param debug - (optional) if true, global debug config will be overriden
46
45
  */
47
46
  executeScript({ linesOfCode, fileName, contextName, runTime, authConfig, authConfigSas9, debug }: ExecuteScriptParams): Promise<any>;
47
+ /**
48
+ * Executes job on SASJS server.
49
+ * @param query - an object containing job path and debug level.
50
+ * @param appLoc - an application path.
51
+ * @param authConfig - an object for authentication.
52
+ * @returns a promise that resolves into job execution result and log.
53
+ */
54
+ executeJob(query: ExecutionQuery, appLoc: string, authConfig?: AuthConfig): Promise<{
55
+ result: any;
56
+ log: any;
57
+ } | undefined>;
48
58
  /**
49
59
  * Gets compute contexts.
50
60
  * @param accessToken - an access token for an authorised user.
@@ -217,7 +227,7 @@ export default class SASjs {
217
227
  * Checks whether a session is active, or login is required.
218
228
  * @returns - a promise which resolves with an object containing two values - a boolean `isLoggedIn`, and a string `userName`.
219
229
  */
220
- checkSession(): Promise<import("./types/Login").LoginResultInternal>;
230
+ checkSession(): Promise<import("./types").LoginResultInternal>;
221
231
  /**
222
232
  * Logs into the SAS server with the supplied credentials.
223
233
  * @param username - a string representing the username.
@@ -309,9 +319,9 @@ export default class SASjs {
309
319
  * @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.
310
320
  * @param printPid - a boolean that indicates whether the function should print (PID) of the started job.
311
321
  * @param variables - an object that represents macro variables.
312
- * @param verboseMode - boolean to enable verbose mode (log every HTTP response).
322
+ * @param verboseMode - boolean or a string equal to 'bleached' to enable verbose mode (log every HTTP response).
313
323
  */
314
- startComputeJob(sasJob: string, data: any, config?: any, authConfig?: AuthConfig, waitForResult?: boolean, pollOptions?: PollOptions, printPid?: boolean, variables?: MacroVar, verboseMode?: boolean): Promise<any>;
324
+ startComputeJob(sasJob: string, data: any, config?: any, authConfig?: AuthConfig, waitForResult?: boolean, pollOptions?: PollOptions, printPid?: boolean, variables?: MacroVar, verboseMode?: VerboseMode): Promise<any>;
315
325
  private resendWaitingRequests;
316
326
  /**
317
327
  * Fetches content of the log file
@@ -333,10 +343,15 @@ export default class SASjs {
333
343
  * @param successCallBack - function that should be triggered on every HTTP response with the status 2**.
334
344
  * @param errorCallBack - function that should be triggered on every HTTP response with the status different from 2**.
335
345
  */
336
- enableVerboseMode(successCallBack?: (response: AxiosResponse) => AxiosResponse, errorCallBack?: (response: AxiosResponse) => AxiosResponse): void;
346
+ enableVerboseMode(successCallBack?: (response: AxiosResponse | AxiosError) => AxiosResponse, errorCallBack?: (response: AxiosResponse | AxiosError) => AxiosResponse): void;
337
347
  /**
338
348
  * Turns off verbose mode to log every HTTP response.
339
349
  */
340
350
  disableVerboseMode(): void;
351
+ /**
352
+ * Sets verbose mode.
353
+ * @param verboseMode - value of the verbose mode, can be true, false or bleached(without extra colors).
354
+ */
355
+ setVerboseMode: (verboseMode: VerboseMode) => void;
341
356
  }
342
357
  export {};