@aloma.io/integration-sdk 3.3.80 → 3.3.82

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.
@@ -7,9 +7,10 @@ export declare abstract class AbstractController {
7
7
  protected fallback(arg: any): Promise<any>;
8
8
  protected endpoint(arg: any): Promise<any>;
9
9
  protected newTask(name: string, data: any): Promise<string>;
10
- protected getClient({ baseUrl, onResponse, }: {
10
+ protected getClient({ baseUrl, onResponse, customize }: {
11
11
  baseUrl: string;
12
12
  onResponse?: (response: any) => void;
13
+ customize?: (request: any) => void;
13
14
  }): Promise<any>;
14
15
  protected updateTask(name: string, data: any): Promise<string>;
15
16
  __endpoint(arg: any): Promise<any | null>;
@@ -15,7 +15,7 @@ export class AbstractController {
15
15
  async newTask(name, data) {
16
16
  throw new Error("not implemented");
17
17
  }
18
- getClient({ baseUrl, onResponse, }) {
18
+ getClient({ baseUrl, onResponse, customize }) {
19
19
  throw new Error("not implemented");
20
20
  }
21
21
  async updateTask(name, data) {
@@ -49,7 +49,7 @@ class Fetcher {
49
49
  if (customize)
50
50
  this.customize0 = customize;
51
51
  }
52
- async customize(options, args = {}) {
52
+ async customize(options = {}, args = {}) {
53
53
  if (this.customize0)
54
54
  await this.customize0(options, args);
55
55
  }
@@ -72,7 +72,10 @@ class Fetcher {
72
72
  retries = local.retry;
73
73
  const theURL = `${baseUrl?.endsWith("/") ? baseUrl : baseUrl + "/"}${url}`.replace(/\/\/+/gi, "/");
74
74
  try {
75
+ options.url = url;
75
76
  await local.customize(options, args);
77
+ url = options.url;
78
+ delete (options.url);
76
79
  if (!options?.headers || !options?.headers?.Accept) {
77
80
  options.headers = {
78
81
  ...options.headers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aloma.io/integration-sdk",
3
- "version": "3.3.80",
3
+ "version": "3.3.82",
4
4
  "description": "",
5
5
  "author": "aloma.io",
6
6
  "license": "Apache-2.0",
@@ -25,9 +25,11 @@ export abstract class AbstractController {
25
25
  protected getClient({
26
26
  baseUrl,
27
27
  onResponse,
28
+ customize
28
29
  }: {
29
30
  baseUrl: string;
30
31
  onResponse?: (response: any) => void;
32
+ customize?: (request: any) => void;
31
33
  }): Promise<any> {
32
34
  throw new Error("not implemented");
33
35
  }
@@ -58,7 +58,7 @@ class Fetcher {
58
58
  if (customize) this.customize0 = customize;
59
59
  }
60
60
 
61
- async customize(options, args = {}) {
61
+ async customize(options = {}, args = {}) {
62
62
  if (this.customize0) await this.customize0(options, args);
63
63
  }
64
64
 
@@ -90,7 +90,11 @@ class Fetcher {
90
90
  }${url}`.replace(/\/\/+/gi, "/");
91
91
 
92
92
  try {
93
+ options.url = url;
93
94
  await local.customize(options, args);
95
+
96
+ url = options.url;
97
+ delete(options.url);
94
98
 
95
99
  if (!options?.headers || !options?.headers?.Accept) {
96
100
  options.headers = {
@@ -219,6 +223,7 @@ class OAuthFetcher extends Fetcher {
219
223
 
220
224
  async customize(options, args = {}) {
221
225
  const local = this;
226
+
222
227
  if (this.customize0) await this.customize0(options, args);
223
228
 
224
229
  const token = await local.getToken(args.forceTokenRefresh);