@sasjs/adapter 3.6.1 → 3.7.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.
@@ -35,10 +35,11 @@ export interface HttpClient {
35
35
  export declare class RequestClient implements HttpClient {
36
36
  protected baseUrl: string;
37
37
  private requests;
38
+ private requestsLimit;
38
39
  protected csrfToken: CsrfToken;
39
40
  protected fileUploadCsrfToken: CsrfToken | undefined;
40
41
  protected httpClient: AxiosInstance;
41
- constructor(baseUrl: string, httpsAgentOptions?: https.AgentOptions);
42
+ constructor(baseUrl: string, httpsAgentOptions?: https.AgentOptions, requestsLimit?: number);
42
43
  setConfig(baseUrl: string, httpsAgentOptions?: https.AgentOptions): void;
43
44
  saveLocalStorageToken(accessToken: string, refreshToken: string): void;
44
45
  getCsrfToken(type?: 'general' | 'file'): CsrfToken | undefined;
@@ -60,7 +60,7 @@ export declare class SASjsConfig {
60
60
  */
61
61
  useComputeApi: boolean | null;
62
62
  /**
63
- * Optional settings to configure HTTPS Agent.
63
+ * Optional setting to configure HTTPS Agent.
64
64
  * By providing `key`, `cert`, `ca` to connect with server
65
65
  * Other options can be set `rejectUnauthorized` and `requestCert`
66
66
  */
@@ -69,6 +69,11 @@ export declare class SASjsConfig {
69
69
  * Supported login mechanisms are - Redirected and Default
70
70
  */
71
71
  loginMechanism: LoginMechanism;
72
+ /**
73
+ * Optional setting to configure request history limit. Increasing this limit
74
+ * may affect browser performance, especially with debug (logs) enabled.
75
+ */
76
+ requestHistoryLimit?: number;
72
77
  }
73
78
  export declare enum LoginMechanism {
74
79
  Default = "Default",
package/package.json CHANGED
@@ -80,5 +80,5 @@
80
80
  "https": "1.0.0",
81
81
  "tough-cookie": "4.0.0"
82
82
  },
83
- "version": "3.6.1"
83
+ "version": "3.7.0"
84
84
  }
@@ -35,10 +35,11 @@ export interface HttpClient {
35
35
  export declare class RequestClient implements HttpClient {
36
36
  protected baseUrl: string;
37
37
  private requests;
38
+ private requestsLimit;
38
39
  protected csrfToken: CsrfToken;
39
40
  protected fileUploadCsrfToken: CsrfToken | undefined;
40
41
  protected httpClient: AxiosInstance;
41
- constructor(baseUrl: string, httpsAgentOptions?: https.AgentOptions);
42
+ constructor(baseUrl: string, httpsAgentOptions?: https.AgentOptions, requestsLimit?: number);
42
43
  setConfig(baseUrl: string, httpsAgentOptions?: https.AgentOptions): void;
43
44
  saveLocalStorageToken(accessToken: string, refreshToken: string): void;
44
45
  getCsrfToken(type?: 'general' | 'file'): CsrfToken | undefined;
package/src/SASjs.ts CHANGED
@@ -1034,7 +1034,8 @@ export default class SASjs {
1034
1034
  : RequestClient
1035
1035
  this.requestClient = new RequestClientClass(
1036
1036
  this.sasjsConfig.serverUrl,
1037
- this.sasjsConfig.httpsAgentOptions
1037
+ this.sasjsConfig.httpsAgentOptions,
1038
+ this.sasjsConfig.requestHistoryLimit
1038
1039
  )
1039
1040
  } else {
1040
1041
  this.requestClient.setConfig(
@@ -56,6 +56,7 @@ export interface HttpClient {
56
56
 
57
57
  export class RequestClient implements HttpClient {
58
58
  private requests: SASjsRequest[] = []
59
+ private requestsLimit: number = 10
59
60
 
60
61
  protected csrfToken: CsrfToken = { headerName: '', value: '' }
61
62
  protected fileUploadCsrfToken: CsrfToken | undefined
@@ -63,9 +64,11 @@ export class RequestClient implements HttpClient {
63
64
 
64
65
  constructor(
65
66
  protected baseUrl: string,
66
- httpsAgentOptions?: https.AgentOptions
67
+ httpsAgentOptions?: https.AgentOptions,
68
+ requestsLimit?: number
67
69
  ) {
68
70
  this.createHttpClient(baseUrl, httpsAgentOptions)
71
+ if (requestsLimit) this.requestsLimit = requestsLimit
69
72
  }
70
73
 
71
74
  public setConfig(baseUrl: string, httpsAgentOptions?: https.AgentOptions) {
@@ -149,7 +152,7 @@ export class RequestClient implements HttpClient {
149
152
  SASWORK: sasWork
150
153
  })
151
154
 
152
- if (this.requests.length > 20) {
155
+ if (this.requests.length > this.requestsLimit) {
153
156
  this.requests.splice(0, 1)
154
157
  }
155
158
  }
@@ -60,7 +60,7 @@ export class SASjsConfig {
60
60
  */
61
61
  useComputeApi: boolean | null = null
62
62
  /**
63
- * Optional settings to configure HTTPS Agent.
63
+ * Optional setting to configure HTTPS Agent.
64
64
  * By providing `key`, `cert`, `ca` to connect with server
65
65
  * Other options can be set `rejectUnauthorized` and `requestCert`
66
66
  */
@@ -69,6 +69,11 @@ export class SASjsConfig {
69
69
  * Supported login mechanisms are - Redirected and Default
70
70
  */
71
71
  loginMechanism: LoginMechanism = LoginMechanism.Default
72
+ /**
73
+ * Optional setting to configure request history limit. Increasing this limit
74
+ * may affect browser performance, especially with debug (logs) enabled.
75
+ */
76
+ requestHistoryLimit?: number = 10
72
77
  }
73
78
 
74
79
  export enum LoginMechanism {
@@ -60,7 +60,7 @@ export declare class SASjsConfig {
60
60
  */
61
61
  useComputeApi: boolean | null;
62
62
  /**
63
- * Optional settings to configure HTTPS Agent.
63
+ * Optional setting to configure HTTPS Agent.
64
64
  * By providing `key`, `cert`, `ca` to connect with server
65
65
  * Other options can be set `rejectUnauthorized` and `requestCert`
66
66
  */
@@ -69,6 +69,11 @@ export declare class SASjsConfig {
69
69
  * Supported login mechanisms are - Redirected and Default
70
70
  */
71
71
  loginMechanism: LoginMechanism;
72
+ /**
73
+ * Optional setting to configure request history limit. Increasing this limit
74
+ * may affect browser performance, especially with debug (logs) enabled.
75
+ */
76
+ requestHistoryLimit?: number;
72
77
  }
73
78
  export declare enum LoginMechanism {
74
79
  Default = "Default",