@aloma.io/integration-sdk 3.3.78 → 3.3.80
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/build/internal/index.mjs +11 -4
- package/package.json +1 -1
- package/src/internal/index.mjs +9 -4
package/build/internal/index.mjs
CHANGED
@@ -42,12 +42,17 @@ const unwrap = async (ret, options) => {
|
|
42
42
|
}
|
43
43
|
};
|
44
44
|
class Fetcher {
|
45
|
-
constructor({ retry = 5, baseUrl, onResponse }) {
|
45
|
+
constructor({ retry = 5, baseUrl, onResponse, customize }) {
|
46
46
|
this.retry = retry;
|
47
47
|
this.baseUrl = baseUrl;
|
48
48
|
this.onResponse = onResponse;
|
49
|
+
if (customize)
|
50
|
+
this.customize0 = customize;
|
51
|
+
}
|
52
|
+
async customize(options, args = {}) {
|
53
|
+
if (this.customize0)
|
54
|
+
await this.customize0(options, args);
|
49
55
|
}
|
50
|
-
async customize(options, args = {}) { }
|
51
56
|
async onError(e, url, options, retries, args, rateLimit) {
|
52
57
|
var local = this;
|
53
58
|
return new Promise((resolve, reject) => {
|
@@ -113,8 +118,8 @@ class Fetcher {
|
|
113
118
|
}
|
114
119
|
}
|
115
120
|
class OAuthFetcher extends Fetcher {
|
116
|
-
constructor({ oauth, retry = 5, getToken, baseUrl, onResponse }) {
|
117
|
-
super({ retry, baseUrl, onResponse });
|
121
|
+
constructor({ oauth, retry = 5, getToken, baseUrl, onResponse, customize }) {
|
122
|
+
super({ retry, baseUrl, onResponse, customize });
|
118
123
|
this.oauth = oauth;
|
119
124
|
this._getToken = getToken;
|
120
125
|
}
|
@@ -166,6 +171,8 @@ class OAuthFetcher extends Fetcher {
|
|
166
171
|
}
|
167
172
|
async customize(options, args = {}) {
|
168
173
|
const local = this;
|
174
|
+
if (this.customize0)
|
175
|
+
await this.customize0(options, args);
|
169
176
|
const token = await local.getToken(args.forceTokenRefresh);
|
170
177
|
options.headers = {
|
171
178
|
...options.headers,
|
package/package.json
CHANGED
package/src/internal/index.mjs
CHANGED
@@ -51,13 +51,16 @@ const unwrap = async (ret, options) => {
|
|
51
51
|
};
|
52
52
|
|
53
53
|
class Fetcher {
|
54
|
-
constructor({ retry = 5, baseUrl, onResponse }) {
|
54
|
+
constructor({ retry = 5, baseUrl, onResponse, customize }) {
|
55
55
|
this.retry = retry;
|
56
56
|
this.baseUrl = baseUrl;
|
57
57
|
this.onResponse = onResponse;
|
58
|
+
if (customize) this.customize0 = customize;
|
58
59
|
}
|
59
60
|
|
60
|
-
async customize(options, args = {}) {
|
61
|
+
async customize(options, args = {}) {
|
62
|
+
if (this.customize0) await this.customize0(options, args);
|
63
|
+
}
|
61
64
|
|
62
65
|
async onError(e, url, options, retries, args, rateLimit) {
|
63
66
|
var local = this;
|
@@ -146,8 +149,8 @@ class Fetcher {
|
|
146
149
|
}
|
147
150
|
|
148
151
|
class OAuthFetcher extends Fetcher {
|
149
|
-
constructor({ oauth, retry = 5, getToken, baseUrl, onResponse }) {
|
150
|
-
super({ retry, baseUrl, onResponse });
|
152
|
+
constructor({ oauth, retry = 5, getToken, baseUrl, onResponse, customize}) {
|
153
|
+
super({ retry, baseUrl, onResponse, customize });
|
151
154
|
|
152
155
|
this.oauth = oauth;
|
153
156
|
this._getToken = getToken;
|
@@ -216,6 +219,8 @@ class OAuthFetcher extends Fetcher {
|
|
216
219
|
|
217
220
|
async customize(options, args = {}) {
|
218
221
|
const local = this;
|
222
|
+
if (this.customize0) await this.customize0(options, args);
|
223
|
+
|
219
224
|
const token = await local.getToken(args.forceTokenRefresh);
|
220
225
|
|
221
226
|
options.headers = {
|