@ama-sdk/client-fetch 12.3.0-prerelease.9 → 12.4.0-prerelease.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/cjs/api-fetch-client.js +18 -22
- package/cjs/plugins/abort/abort.spec.js +83 -81
- package/cjs/plugins/concurrent/concurrent.fetch.js +12 -20
- package/cjs/plugins/concurrent/concurrent.spec.js +99 -99
- package/cjs/plugins/keepalive/keepalive.request.js +7 -12
- package/cjs/plugins/keepalive/keepalive.spec.js +32 -34
- package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +15 -22
- package/cjs/plugins/mock-intercept/mock-intercept.spec.js +247 -239
- package/cjs/plugins/perf-metric/perf-metric.fetch.js +11 -18
- package/cjs/plugins/retry/retry.fetch.js +18 -27
- package/cjs/plugins/retry/retry.spec.js +233 -225
- package/cjs/plugins/timeout/timeout.fetch.js +13 -19
- package/cjs/plugins/timeout/timeout.spec.js +211 -205
- package/cjs/plugins/wait-for/wait-for.fetch.js +19 -29
- package/cjs/plugins/wait-for/wait-for.spec.js +211 -203
- package/esm2015/api-fetch-client.js +18 -22
- package/esm2015/plugins/abort/abort.spec.js +83 -81
- package/esm2015/plugins/concurrent/concurrent.fetch.js +12 -20
- package/esm2015/plugins/concurrent/concurrent.spec.js +99 -99
- package/esm2015/plugins/keepalive/keepalive.request.js +7 -12
- package/esm2015/plugins/keepalive/keepalive.spec.js +32 -34
- package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +15 -22
- package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +247 -239
- package/esm2015/plugins/perf-metric/perf-metric.fetch.js +11 -18
- package/esm2015/plugins/retry/retry.fetch.js +18 -27
- package/esm2015/plugins/retry/retry.spec.js +233 -225
- package/esm2015/plugins/timeout/timeout.fetch.js +13 -19
- package/esm2015/plugins/timeout/timeout.spec.js +211 -205
- package/esm2015/plugins/wait-for/wait-for.fetch.js +19 -29
- package/esm2015/plugins/wait-for/wait-for.spec.js +211 -203
- package/package.json +15 -15
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +11 -21
- package/src/api-fetch-client.d.ts +1 -1
- package/src/api-fetch-client.d.ts.map +1 -1
- package/src/api-fetch-client.js +2 -1
- package/src/api-fetch-client.js.map +1 -1
|
@@ -109,7 +109,7 @@ function _object_spread_props(target, source) {
|
|
|
109
109
|
return target;
|
|
110
110
|
}
|
|
111
111
|
function _ts_generator(thisArg, body) {
|
|
112
|
-
var f, y, t,
|
|
112
|
+
var f, y, t, _ = {
|
|
113
113
|
label: 0,
|
|
114
114
|
sent: function() {
|
|
115
115
|
if (t[0] & 1) throw t[1];
|
|
@@ -117,12 +117,8 @@ function _ts_generator(thisArg, body) {
|
|
|
117
117
|
},
|
|
118
118
|
trys: [],
|
|
119
119
|
ops: []
|
|
120
|
-
};
|
|
121
|
-
return g = {
|
|
122
|
-
next: verb(0),
|
|
123
|
-
"throw": verb(1),
|
|
124
|
-
"return": verb(2)
|
|
125
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
120
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
121
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
126
122
|
return this;
|
|
127
123
|
}), g;
|
|
128
124
|
function verb(n) {
|
|
@@ -135,7 +131,7 @@ function _ts_generator(thisArg, body) {
|
|
|
135
131
|
}
|
|
136
132
|
function step(op) {
|
|
137
133
|
if (f) throw new TypeError("Generator is already executing.");
|
|
138
|
-
while(_)try {
|
|
134
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
139
135
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
140
136
|
if (y = 0, t) op = [
|
|
141
137
|
op[0] & 2,
|
|
@@ -225,7 +221,6 @@ var KeepaliveRequest = /*#__PURE__*/ function() {
|
|
|
225
221
|
* https://bugs.chromium.org/p/chromium/issues/detail?id=835821
|
|
226
222
|
* To avoid this issue we do a fake fetch call to check whether we can activate it or not in the browser.
|
|
227
223
|
*/ function testKeepAlive() {
|
|
228
|
-
var _this = this;
|
|
229
224
|
return _async_to_generator(function() {
|
|
230
225
|
var customHeaders, e;
|
|
231
226
|
return _ts_generator(this, function(_state) {
|
|
@@ -250,14 +245,14 @@ var KeepaliveRequest = /*#__PURE__*/ function() {
|
|
|
250
245
|
];
|
|
251
246
|
case 2:
|
|
252
247
|
_state.sent();
|
|
253
|
-
|
|
248
|
+
this.active = true;
|
|
254
249
|
return [
|
|
255
250
|
3,
|
|
256
251
|
4
|
|
257
252
|
];
|
|
258
253
|
case 3:
|
|
259
254
|
e = _state.sent();
|
|
260
|
-
|
|
255
|
+
this.active = false;
|
|
261
256
|
return [
|
|
262
257
|
3,
|
|
263
258
|
4
|
|
@@ -268,7 +263,7 @@ var KeepaliveRequest = /*#__PURE__*/ function() {
|
|
|
268
263
|
];
|
|
269
264
|
}
|
|
270
265
|
});
|
|
271
|
-
})();
|
|
266
|
+
}).call(this);
|
|
272
267
|
}
|
|
273
268
|
},
|
|
274
269
|
{
|
|
@@ -33,7 +33,7 @@ function _async_to_generator(fn) {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
function _ts_generator(thisArg, body) {
|
|
36
|
-
var f, y, t,
|
|
36
|
+
var f, y, t, _ = {
|
|
37
37
|
label: 0,
|
|
38
38
|
sent: function() {
|
|
39
39
|
if (t[0] & 1) throw t[1];
|
|
@@ -41,12 +41,8 @@ function _ts_generator(thisArg, body) {
|
|
|
41
41
|
},
|
|
42
42
|
trys: [],
|
|
43
43
|
ops: []
|
|
44
|
-
};
|
|
45
|
-
return g = {
|
|
46
|
-
next: verb(0),
|
|
47
|
-
"throw": verb(1),
|
|
48
|
-
"return": verb(2)
|
|
49
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
44
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
45
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
50
46
|
return this;
|
|
51
47
|
}), g;
|
|
52
48
|
function verb(n) {
|
|
@@ -59,7 +55,7 @@ function _ts_generator(thisArg, body) {
|
|
|
59
55
|
}
|
|
60
56
|
function step(op) {
|
|
61
57
|
if (f) throw new TypeError("Generator is already executing.");
|
|
62
|
-
while(_)try {
|
|
58
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
63
59
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
64
60
|
if (y = 0, t) op = [
|
|
65
61
|
op[0] & 2,
|
|
@@ -133,30 +129,32 @@ describe('Keepalive Request Plugin', function() {
|
|
|
133
129
|
basePath: 'http://test.com/truc',
|
|
134
130
|
method: 'get'
|
|
135
131
|
};
|
|
136
|
-
it('keepalive should be set to true',
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
132
|
+
it('keepalive should be set to true', function() {
|
|
133
|
+
return _async_to_generator(function() {
|
|
134
|
+
var plugin, runner, keepalive;
|
|
135
|
+
return _ts_generator(this, function(_state) {
|
|
136
|
+
switch(_state.label){
|
|
137
|
+
case 0:
|
|
138
|
+
plugin = new _keepaliverequest.KeepaliveRequest(true);
|
|
139
|
+
runner = plugin.load();
|
|
140
|
+
return [
|
|
141
|
+
4,
|
|
142
|
+
runner.transform(options)
|
|
143
|
+
];
|
|
144
|
+
case 1:
|
|
145
|
+
_state.sent();
|
|
146
|
+
return [
|
|
147
|
+
4,
|
|
148
|
+
plugin.load().transform(options)
|
|
149
|
+
];
|
|
150
|
+
case 2:
|
|
151
|
+
keepalive = _state.sent().keepalive;
|
|
152
|
+
expect(keepalive).toBe(true);
|
|
153
|
+
return [
|
|
154
|
+
2
|
|
155
|
+
];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
})();
|
|
159
|
+
});
|
|
162
160
|
});
|
|
@@ -78,7 +78,7 @@ function _instanceof(left, right) {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
function _ts_generator(thisArg, body) {
|
|
81
|
-
var f, y, t,
|
|
81
|
+
var f, y, t, _ = {
|
|
82
82
|
label: 0,
|
|
83
83
|
sent: function() {
|
|
84
84
|
if (t[0] & 1) throw t[1];
|
|
@@ -86,12 +86,8 @@ function _ts_generator(thisArg, body) {
|
|
|
86
86
|
},
|
|
87
87
|
trys: [],
|
|
88
88
|
ops: []
|
|
89
|
-
};
|
|
90
|
-
return g = {
|
|
91
|
-
next: verb(0),
|
|
92
|
-
"throw": verb(1),
|
|
93
|
-
"return": verb(2)
|
|
94
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
89
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
90
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
95
91
|
return this;
|
|
96
92
|
}), g;
|
|
97
93
|
function verb(n) {
|
|
@@ -104,7 +100,7 @@ function _ts_generator(thisArg, body) {
|
|
|
104
100
|
}
|
|
105
101
|
function step(op) {
|
|
106
102
|
if (f) throw new TypeError("Generator is already executing.");
|
|
107
|
-
while(_)try {
|
|
103
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
108
104
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
109
105
|
if (y = 0, t) op = [
|
|
110
106
|
op[0] & 2,
|
|
@@ -183,22 +179,22 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
|
|
|
183
179
|
{
|
|
184
180
|
key: "load",
|
|
185
181
|
value: function load(context) {
|
|
182
|
+
var _this = this;
|
|
186
183
|
if (!context.apiClient.options.requestPlugins.some(function(plugin) {
|
|
187
184
|
return _instanceof(plugin, _core.MockInterceptRequest);
|
|
188
185
|
})) {
|
|
189
186
|
throw new Error('MockInterceptFetch plugin should be used only with the MockInterceptRequest plugin');
|
|
190
187
|
}
|
|
191
|
-
var _this = this;
|
|
192
188
|
return {
|
|
193
|
-
transform:
|
|
194
|
-
|
|
189
|
+
transform: function(fetchCall) {
|
|
190
|
+
return _async_to_generator(function() {
|
|
195
191
|
var responsePromise, delay, _tmp, resp, operationId, mock, response;
|
|
196
192
|
return _ts_generator(this, function(_state) {
|
|
197
193
|
switch(_state.label){
|
|
198
194
|
case 0:
|
|
199
195
|
return [
|
|
200
196
|
4,
|
|
201
|
-
|
|
197
|
+
this.options.adapter.initialize()
|
|
202
198
|
];
|
|
203
199
|
case 1:
|
|
204
200
|
_state.sent();
|
|
@@ -209,15 +205,15 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
|
|
|
209
205
|
responsePromise
|
|
210
206
|
];
|
|
211
207
|
}
|
|
212
|
-
if (!(typeof
|
|
208
|
+
if (!(typeof this.options.delayTiming !== 'undefined')) return [
|
|
213
209
|
3,
|
|
214
210
|
6
|
|
215
211
|
];
|
|
216
|
-
if (!(typeof
|
|
212
|
+
if (!(typeof this.options.delayTiming === 'number')) return [
|
|
217
213
|
3,
|
|
218
214
|
2
|
|
219
215
|
];
|
|
220
|
-
_tmp =
|
|
216
|
+
_tmp = this.options.delayTiming;
|
|
221
217
|
return [
|
|
222
218
|
3,
|
|
223
219
|
4
|
|
@@ -225,7 +221,7 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
|
|
|
225
221
|
case 2:
|
|
226
222
|
return [
|
|
227
223
|
4,
|
|
228
|
-
|
|
224
|
+
this.options.delayTiming(context)
|
|
229
225
|
];
|
|
230
226
|
case 3:
|
|
231
227
|
_tmp = _state.sent();
|
|
@@ -247,7 +243,7 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
|
|
|
247
243
|
case 6:
|
|
248
244
|
operationId = context.options.headers.get(_core.CUSTOM_MOCK_OPERATION_ID_HEADER);
|
|
249
245
|
try {
|
|
250
|
-
mock =
|
|
246
|
+
mock = this.options.adapter.getLatestMock(operationId);
|
|
251
247
|
if (!mock.getResponse) {
|
|
252
248
|
return [
|
|
253
249
|
2,
|
|
@@ -273,11 +269,8 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
|
|
|
273
269
|
];
|
|
274
270
|
}
|
|
275
271
|
});
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
return _ref.apply(this, arguments);
|
|
279
|
-
};
|
|
280
|
-
}()
|
|
272
|
+
}).call(_this);
|
|
273
|
+
}
|
|
281
274
|
};
|
|
282
275
|
}
|
|
283
276
|
}
|