@ama-sdk/core 12.5.0-prerelease.6 → 12.5.0-prerelease.7
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/clients/api-angular-client.js +41 -22
- package/cjs/clients/api-beacon-client.js +5 -1
- package/cjs/clients/api-fetch-client.js +41 -22
- package/cjs/plugins/mock-intercept/mock-intercept.angular.js +37 -15
- package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +38 -16
- package/esm2015/clients/api-angular-client.js +41 -22
- package/esm2015/clients/api-beacon-client.js +5 -1
- package/esm2015/clients/api-fetch-client.js +41 -22
- package/esm2015/fwk/core/base-api-constructor.js +1 -0
- package/esm2015/plugins/mock-intercept/mock-intercept.angular.js +37 -15
- package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +38 -16
- package/package.json +6 -6
- package/src/clients/api-angular-client.d.ts.map +1 -1
- package/src/clients/api-angular-client.js +2 -1
- package/src/clients/api-angular-client.js.map +1 -1
- package/src/clients/api-beacon-client.d.ts.map +1 -1
- package/src/clients/api-beacon-client.js +5 -1
- package/src/clients/api-beacon-client.js.map +1 -1
- package/src/clients/api-fetch-client.d.ts.map +1 -1
- package/src/clients/api-fetch-client.js +2 -1
- package/src/clients/api-fetch-client.js.map +1 -1
- package/src/fwk/core/base-api-constructor.d.ts +9 -5
- package/src/fwk/core/base-api-constructor.d.ts.map +1 -1
- package/src/fwk/core/base-api-constructor.js +1 -0
- package/src/fwk/core/base-api-constructor.js.map +1 -1
- package/src/plugins/core/reply-plugin.d.ts +1 -1
- package/src/plugins/core/reply-plugin.d.ts.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.angular.d.ts +1 -0
- package/src/plugins/mock-intercept/mock-intercept.angular.d.ts.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.angular.js +13 -2
- package/src/plugins/mock-intercept/mock-intercept.angular.js.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.fetch.d.ts +1 -0
- package/src/plugins/mock-intercept/mock-intercept.fetch.d.ts.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.fetch.js +13 -2
- package/src/plugins/mock-intercept/mock-intercept.fetch.js.map +1 -1
|
@@ -277,7 +277,7 @@ var ApiAngularClient = /*#__PURE__*/ function() {
|
|
|
277
277
|
key: "getRequestOptions",
|
|
278
278
|
value: /** @inheritdoc */ function getRequestOptions(requestOptionsParameters) {
|
|
279
279
|
return _async_to_generator(function() {
|
|
280
|
-
var opts, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, _requestOptionsParameters_api, err;
|
|
280
|
+
var opts, requestPlugins, _tmp, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, _requestOptionsParameters_api, err;
|
|
281
281
|
return _ts_generator(this, function(_state) {
|
|
282
282
|
switch(_state.label){
|
|
283
283
|
case 0:
|
|
@@ -287,23 +287,42 @@ var ApiAngularClient = /*#__PURE__*/ function() {
|
|
|
287
287
|
});
|
|
288
288
|
if (!this.options.requestPlugins) return [
|
|
289
289
|
3,
|
|
290
|
-
|
|
290
|
+
11
|
|
291
|
+
];
|
|
292
|
+
if (!(typeof this.options.requestPlugins === 'function')) return [
|
|
293
|
+
3,
|
|
294
|
+
2
|
|
295
|
+
];
|
|
296
|
+
return [
|
|
297
|
+
4,
|
|
298
|
+
this.options.requestPlugins(opts)
|
|
291
299
|
];
|
|
292
|
-
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
293
|
-
_state.label = 1;
|
|
294
300
|
case 1:
|
|
301
|
+
_tmp = _state.sent();
|
|
302
|
+
return [
|
|
303
|
+
3,
|
|
304
|
+
3
|
|
305
|
+
];
|
|
306
|
+
case 2:
|
|
307
|
+
_tmp = this.options.requestPlugins;
|
|
308
|
+
_state.label = 3;
|
|
309
|
+
case 3:
|
|
310
|
+
requestPlugins = _tmp;
|
|
311
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
312
|
+
_state.label = 4;
|
|
313
|
+
case 4:
|
|
295
314
|
_state.trys.push([
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
315
|
+
4,
|
|
316
|
+
9,
|
|
317
|
+
10,
|
|
318
|
+
11
|
|
300
319
|
]);
|
|
301
|
-
_iterator =
|
|
302
|
-
_state.label =
|
|
303
|
-
case
|
|
320
|
+
_iterator = requestPlugins[Symbol.iterator]();
|
|
321
|
+
_state.label = 5;
|
|
322
|
+
case 5:
|
|
304
323
|
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
305
324
|
3,
|
|
306
|
-
|
|
325
|
+
8
|
|
307
326
|
];
|
|
308
327
|
plugin = _step.value;
|
|
309
328
|
return [
|
|
@@ -313,29 +332,29 @@ var ApiAngularClient = /*#__PURE__*/ function() {
|
|
|
313
332
|
apiName: (_requestOptionsParameters_api = requestOptionsParameters.api) === null || _requestOptionsParameters_api === void 0 ? void 0 : _requestOptionsParameters_api.apiName
|
|
314
333
|
}).transform(opts)
|
|
315
334
|
];
|
|
316
|
-
case
|
|
335
|
+
case 6:
|
|
317
336
|
opts = _state.sent();
|
|
318
|
-
_state.label =
|
|
319
|
-
case
|
|
337
|
+
_state.label = 7;
|
|
338
|
+
case 7:
|
|
320
339
|
_iteratorNormalCompletion = true;
|
|
321
340
|
return [
|
|
322
341
|
3,
|
|
323
|
-
|
|
342
|
+
5
|
|
324
343
|
];
|
|
325
|
-
case
|
|
344
|
+
case 8:
|
|
326
345
|
return [
|
|
327
346
|
3,
|
|
328
|
-
|
|
347
|
+
11
|
|
329
348
|
];
|
|
330
|
-
case
|
|
349
|
+
case 9:
|
|
331
350
|
err = _state.sent();
|
|
332
351
|
_didIteratorError = true;
|
|
333
352
|
_iteratorError = err;
|
|
334
353
|
return [
|
|
335
354
|
3,
|
|
336
|
-
|
|
355
|
+
11
|
|
337
356
|
];
|
|
338
|
-
case
|
|
357
|
+
case 10:
|
|
339
358
|
try {
|
|
340
359
|
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
341
360
|
_iterator.return();
|
|
@@ -348,7 +367,7 @@ var ApiAngularClient = /*#__PURE__*/ function() {
|
|
|
348
367
|
return [
|
|
349
368
|
7
|
|
350
369
|
];
|
|
351
|
-
case
|
|
370
|
+
case 11:
|
|
352
371
|
return [
|
|
353
372
|
2,
|
|
354
373
|
opts
|
|
@@ -142,9 +142,13 @@ var ApiBeaconClient = /*#__PURE__*/ function() {
|
|
|
142
142
|
queryParams: (0, _apihelpers.filterUndefinedValues)(options.queryParams)
|
|
143
143
|
});
|
|
144
144
|
if (this.options.requestPlugins) {
|
|
145
|
+
var requestPlugins = typeof this.options.requestPlugins === 'function' ? this.options.requestPlugins(opts) : this.options.requestPlugins;
|
|
146
|
+
if (isPromise(requestPlugins)) {
|
|
147
|
+
throw new Error('Only a synchronous function is supported to return the list of Request Plugin for this Client');
|
|
148
|
+
}
|
|
145
149
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
146
150
|
try {
|
|
147
|
-
for(var _iterator =
|
|
151
|
+
for(var _iterator = requestPlugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
148
152
|
var plugin = _step.value;
|
|
149
153
|
var _options_api;
|
|
150
154
|
var changedOpt = plugin.load({
|
|
@@ -283,7 +283,7 @@ var ApiFetchClient = /*#__PURE__*/ function() {
|
|
|
283
283
|
key: "getRequestOptions",
|
|
284
284
|
value: /** @inheritdoc */ function getRequestOptions(requestOptionsParameters) {
|
|
285
285
|
return _async_to_generator(function() {
|
|
286
|
-
var opts, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, _requestOptionsParameters_api, err;
|
|
286
|
+
var opts, requestPlugins, _tmp, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, _requestOptionsParameters_api, err;
|
|
287
287
|
return _ts_generator(this, function(_state) {
|
|
288
288
|
switch(_state.label){
|
|
289
289
|
case 0:
|
|
@@ -293,23 +293,42 @@ var ApiFetchClient = /*#__PURE__*/ function() {
|
|
|
293
293
|
});
|
|
294
294
|
if (!this.options.requestPlugins) return [
|
|
295
295
|
3,
|
|
296
|
-
|
|
296
|
+
11
|
|
297
|
+
];
|
|
298
|
+
if (!(typeof this.options.requestPlugins === 'function')) return [
|
|
299
|
+
3,
|
|
300
|
+
2
|
|
301
|
+
];
|
|
302
|
+
return [
|
|
303
|
+
4,
|
|
304
|
+
this.options.requestPlugins(opts)
|
|
297
305
|
];
|
|
298
|
-
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
299
|
-
_state.label = 1;
|
|
300
306
|
case 1:
|
|
307
|
+
_tmp = _state.sent();
|
|
308
|
+
return [
|
|
309
|
+
3,
|
|
310
|
+
3
|
|
311
|
+
];
|
|
312
|
+
case 2:
|
|
313
|
+
_tmp = this.options.requestPlugins;
|
|
314
|
+
_state.label = 3;
|
|
315
|
+
case 3:
|
|
316
|
+
requestPlugins = _tmp;
|
|
317
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
318
|
+
_state.label = 4;
|
|
319
|
+
case 4:
|
|
301
320
|
_state.trys.push([
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
321
|
+
4,
|
|
322
|
+
9,
|
|
323
|
+
10,
|
|
324
|
+
11
|
|
306
325
|
]);
|
|
307
|
-
_iterator =
|
|
308
|
-
_state.label =
|
|
309
|
-
case
|
|
326
|
+
_iterator = requestPlugins[Symbol.iterator]();
|
|
327
|
+
_state.label = 5;
|
|
328
|
+
case 5:
|
|
310
329
|
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
311
330
|
3,
|
|
312
|
-
|
|
331
|
+
8
|
|
313
332
|
];
|
|
314
333
|
plugin = _step.value;
|
|
315
334
|
return [
|
|
@@ -319,29 +338,29 @@ var ApiFetchClient = /*#__PURE__*/ function() {
|
|
|
319
338
|
apiName: (_requestOptionsParameters_api = requestOptionsParameters.api) === null || _requestOptionsParameters_api === void 0 ? void 0 : _requestOptionsParameters_api.apiName
|
|
320
339
|
}).transform(opts)
|
|
321
340
|
];
|
|
322
|
-
case
|
|
341
|
+
case 6:
|
|
323
342
|
opts = _state.sent();
|
|
324
|
-
_state.label =
|
|
325
|
-
case
|
|
343
|
+
_state.label = 7;
|
|
344
|
+
case 7:
|
|
326
345
|
_iteratorNormalCompletion = true;
|
|
327
346
|
return [
|
|
328
347
|
3,
|
|
329
|
-
|
|
348
|
+
5
|
|
330
349
|
];
|
|
331
|
-
case
|
|
350
|
+
case 8:
|
|
332
351
|
return [
|
|
333
352
|
3,
|
|
334
|
-
|
|
353
|
+
11
|
|
335
354
|
];
|
|
336
|
-
case
|
|
355
|
+
case 9:
|
|
337
356
|
err = _state.sent();
|
|
338
357
|
_didIteratorError = true;
|
|
339
358
|
_iteratorError = err;
|
|
340
359
|
return [
|
|
341
360
|
3,
|
|
342
|
-
|
|
361
|
+
11
|
|
343
362
|
];
|
|
344
|
-
case
|
|
363
|
+
case 10:
|
|
345
364
|
try {
|
|
346
365
|
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
347
366
|
_iterator.return();
|
|
@@ -354,7 +373,7 @@ var ApiFetchClient = /*#__PURE__*/ function() {
|
|
|
354
373
|
return [
|
|
355
374
|
7
|
|
356
375
|
];
|
|
357
|
-
case
|
|
376
|
+
case 11:
|
|
358
377
|
return [
|
|
359
378
|
2,
|
|
360
379
|
opts
|
|
@@ -215,31 +215,53 @@ var MockInterceptAngular = /*#__PURE__*/ function() {
|
|
|
215
215
|
function MockInterceptAngular(options) {
|
|
216
216
|
_class_call_check(this, MockInterceptAngular);
|
|
217
217
|
_define_property(this, "options", void 0);
|
|
218
|
+
_define_property(this, "checkMockInterceptAngularPlugin", void 0);
|
|
218
219
|
this.options = options;
|
|
220
|
+
this.checkMockInterceptAngularPlugin = function(requestPlugins) {
|
|
221
|
+
if (!requestPlugins.some(function(plugin) {
|
|
222
|
+
return _instanceof(plugin, _mockinterceptrequest.MockInterceptRequest);
|
|
223
|
+
})) {
|
|
224
|
+
throw new Error('MockInterceptAngular plugin should be used only with the MockInterceptRequest plugin');
|
|
225
|
+
}
|
|
226
|
+
};
|
|
219
227
|
}
|
|
220
228
|
_create_class(MockInterceptAngular, [
|
|
221
229
|
{
|
|
222
230
|
key: "load",
|
|
223
231
|
value: function load(context) {
|
|
224
232
|
var _this = this;
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
throw new Error('MockInterceptAngular plugin should be used only with the MockInterceptRequest plugin');
|
|
233
|
+
var requestPlugins = typeof context.apiClient.options.requestPlugins === 'function' ? context.apiClient.options.requestPlugins(context.requestOptions) : context.apiClient.options.requestPlugins;
|
|
234
|
+
if (Array.isArray(requestPlugins)) {
|
|
235
|
+
this.checkMockInterceptAngularPlugin(requestPlugins);
|
|
229
236
|
}
|
|
230
237
|
return {
|
|
231
238
|
transform: function(call) {
|
|
232
239
|
return (0, _rxjs.from)(function() {
|
|
233
240
|
return _async_to_generator(function() {
|
|
234
|
-
var originalCall, delayTime, _tmp, operationId, mock, response;
|
|
241
|
+
var _, _1, originalCall, delayTime, _tmp, operationId, mock, response;
|
|
235
242
|
return _ts_generator(this, function(_state) {
|
|
236
243
|
switch(_state.label){
|
|
237
244
|
case 0:
|
|
245
|
+
if (!!Array.isArray(requestPlugins)) return [
|
|
246
|
+
3,
|
|
247
|
+
2
|
|
248
|
+
];
|
|
249
|
+
_1 = (_ = this).checkMockInterceptAngularPlugin;
|
|
238
250
|
return [
|
|
239
251
|
4,
|
|
240
|
-
|
|
252
|
+
requestPlugins
|
|
241
253
|
];
|
|
242
254
|
case 1:
|
|
255
|
+
_1.apply(_, [
|
|
256
|
+
_state.sent()
|
|
257
|
+
]);
|
|
258
|
+
_state.label = 2;
|
|
259
|
+
case 2:
|
|
260
|
+
return [
|
|
261
|
+
4,
|
|
262
|
+
this.options.adapter.initialize()
|
|
263
|
+
];
|
|
264
|
+
case 3:
|
|
243
265
|
_state.sent();
|
|
244
266
|
originalCall = call;
|
|
245
267
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- type of options is explicitly `any`
|
|
@@ -251,18 +273,18 @@ var MockInterceptAngular = /*#__PURE__*/ function() {
|
|
|
251
273
|
}
|
|
252
274
|
if (!(typeof this.options.delayTiming !== 'undefined')) return [
|
|
253
275
|
3,
|
|
254
|
-
|
|
276
|
+
7
|
|
255
277
|
];
|
|
256
278
|
if (!(typeof this.options.delayTiming === 'number')) return [
|
|
257
279
|
3,
|
|
258
|
-
|
|
280
|
+
4
|
|
259
281
|
];
|
|
260
282
|
_tmp = this.options.delayTiming;
|
|
261
283
|
return [
|
|
262
284
|
3,
|
|
263
|
-
|
|
285
|
+
6
|
|
264
286
|
];
|
|
265
|
-
case
|
|
287
|
+
case 4:
|
|
266
288
|
return [
|
|
267
289
|
4,
|
|
268
290
|
this.options.delayTiming(_object_spread_props(_object_spread({}, context), {
|
|
@@ -270,14 +292,14 @@ var MockInterceptAngular = /*#__PURE__*/ function() {
|
|
|
270
292
|
options: context.requestOptions
|
|
271
293
|
}))
|
|
272
294
|
];
|
|
273
|
-
case
|
|
295
|
+
case 5:
|
|
274
296
|
_tmp = _state.sent();
|
|
275
|
-
_state.label =
|
|
276
|
-
case
|
|
297
|
+
_state.label = 6;
|
|
298
|
+
case 6:
|
|
277
299
|
delayTime = _tmp;
|
|
278
300
|
originalCall = originalCall.pipe((0, _rxjs.delay)(delayTime));
|
|
279
|
-
_state.label =
|
|
280
|
-
case
|
|
301
|
+
_state.label = 7;
|
|
302
|
+
case 7:
|
|
281
303
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- type of options is explicitly `any`
|
|
282
304
|
operationId = context.options.headers.get(_mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER);
|
|
283
305
|
try {
|
|
@@ -174,30 +174,52 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
|
|
|
174
174
|
function MockInterceptFetch(options) {
|
|
175
175
|
_class_call_check(this, MockInterceptFetch);
|
|
176
176
|
_define_property(this, "options", void 0);
|
|
177
|
+
_define_property(this, "checkMockInterceptFetchPlugin", void 0);
|
|
177
178
|
this.options = options;
|
|
179
|
+
this.checkMockInterceptFetchPlugin = function(requestPlugins) {
|
|
180
|
+
if (!requestPlugins.some(function(plugin) {
|
|
181
|
+
return _instanceof(plugin, _mockinterceptrequest.MockInterceptRequest);
|
|
182
|
+
})) {
|
|
183
|
+
throw new Error('MockInterceptFetch plugin should be used only with the MockInterceptRequest plugin');
|
|
184
|
+
}
|
|
185
|
+
};
|
|
178
186
|
}
|
|
179
187
|
_create_class(MockInterceptFetch, [
|
|
180
188
|
{
|
|
181
189
|
key: "load",
|
|
182
190
|
value: function load(context) {
|
|
183
191
|
var _this = this;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
throw new Error('MockInterceptFetch plugin should be used only with the MockInterceptRequest plugin');
|
|
192
|
+
var requestPlugins = typeof context.apiClient.options.requestPlugins === 'function' ? context.apiClient.options.requestPlugins(context.requestOptions) : context.apiClient.options.requestPlugins;
|
|
193
|
+
if (Array.isArray(requestPlugins)) {
|
|
194
|
+
this.checkMockInterceptFetchPlugin(requestPlugins);
|
|
188
195
|
}
|
|
189
196
|
return {
|
|
190
197
|
transform: function(fetchCall) {
|
|
191
198
|
return _async_to_generator(function() {
|
|
192
|
-
var responsePromise, delay, _tmp, resp, operationId, mock, response;
|
|
199
|
+
var _, _1, responsePromise, delay, _tmp, resp, operationId, mock, response;
|
|
193
200
|
return _ts_generator(this, function(_state) {
|
|
194
201
|
switch(_state.label){
|
|
195
202
|
case 0:
|
|
203
|
+
if (!!Array.isArray(requestPlugins)) return [
|
|
204
|
+
3,
|
|
205
|
+
2
|
|
206
|
+
];
|
|
207
|
+
_1 = (_ = this).checkMockInterceptFetchPlugin;
|
|
196
208
|
return [
|
|
197
209
|
4,
|
|
198
|
-
|
|
210
|
+
requestPlugins
|
|
199
211
|
];
|
|
200
212
|
case 1:
|
|
213
|
+
_1.apply(_, [
|
|
214
|
+
_state.sent()
|
|
215
|
+
]);
|
|
216
|
+
_state.label = 2;
|
|
217
|
+
case 2:
|
|
218
|
+
return [
|
|
219
|
+
4,
|
|
220
|
+
this.options.adapter.initialize()
|
|
221
|
+
];
|
|
222
|
+
case 3:
|
|
201
223
|
_state.sent();
|
|
202
224
|
responsePromise = fetchCall;
|
|
203
225
|
if (!context.options.headers || !_instanceof(context.options.headers, Headers) || !context.options.headers.has(_mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER)) {
|
|
@@ -208,40 +230,40 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
|
|
|
208
230
|
}
|
|
209
231
|
if (!(typeof this.options.delayTiming !== 'undefined')) return [
|
|
210
232
|
3,
|
|
211
|
-
|
|
233
|
+
8
|
|
212
234
|
];
|
|
213
235
|
if (!(typeof this.options.delayTiming === 'number')) return [
|
|
214
236
|
3,
|
|
215
|
-
|
|
237
|
+
4
|
|
216
238
|
];
|
|
217
239
|
_tmp = this.options.delayTiming;
|
|
218
240
|
return [
|
|
219
241
|
3,
|
|
220
|
-
|
|
242
|
+
6
|
|
221
243
|
];
|
|
222
|
-
case
|
|
244
|
+
case 4:
|
|
223
245
|
return [
|
|
224
246
|
4,
|
|
225
247
|
this.options.delayTiming(context)
|
|
226
248
|
];
|
|
227
|
-
case
|
|
249
|
+
case 5:
|
|
228
250
|
_tmp = _state.sent();
|
|
229
|
-
_state.label =
|
|
230
|
-
case
|
|
251
|
+
_state.label = 6;
|
|
252
|
+
case 6:
|
|
231
253
|
delay = _tmp;
|
|
232
254
|
return [
|
|
233
255
|
4,
|
|
234
256
|
responsePromise
|
|
235
257
|
];
|
|
236
|
-
case
|
|
258
|
+
case 7:
|
|
237
259
|
resp = _state.sent();
|
|
238
260
|
responsePromise = new Promise(function(resolve) {
|
|
239
261
|
return setTimeout(resolve, delay);
|
|
240
262
|
}).then(function() {
|
|
241
263
|
return resp;
|
|
242
264
|
});
|
|
243
|
-
_state.label =
|
|
244
|
-
case
|
|
265
|
+
_state.label = 8;
|
|
266
|
+
case 8:
|
|
245
267
|
operationId = context.options.headers.get(_mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER);
|
|
246
268
|
try {
|
|
247
269
|
mock = this.options.adapter.getLatestMock(operationId);
|
|
@@ -270,7 +270,7 @@ var DEFAULT_OPTIONS = {
|
|
|
270
270
|
key: "getRequestOptions",
|
|
271
271
|
value: /** @inheritdoc */ function getRequestOptions(requestOptionsParameters) {
|
|
272
272
|
return _async_to_generator(function() {
|
|
273
|
-
var opts, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, _requestOptionsParameters_api, err;
|
|
273
|
+
var opts, requestPlugins, _tmp, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, _requestOptionsParameters_api, err;
|
|
274
274
|
return _ts_generator(this, function(_state) {
|
|
275
275
|
switch(_state.label){
|
|
276
276
|
case 0:
|
|
@@ -280,23 +280,42 @@ var DEFAULT_OPTIONS = {
|
|
|
280
280
|
});
|
|
281
281
|
if (!this.options.requestPlugins) return [
|
|
282
282
|
3,
|
|
283
|
-
|
|
283
|
+
11
|
|
284
|
+
];
|
|
285
|
+
if (!(typeof this.options.requestPlugins === 'function')) return [
|
|
286
|
+
3,
|
|
287
|
+
2
|
|
288
|
+
];
|
|
289
|
+
return [
|
|
290
|
+
4,
|
|
291
|
+
this.options.requestPlugins(opts)
|
|
284
292
|
];
|
|
285
|
-
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
286
|
-
_state.label = 1;
|
|
287
293
|
case 1:
|
|
294
|
+
_tmp = _state.sent();
|
|
295
|
+
return [
|
|
296
|
+
3,
|
|
297
|
+
3
|
|
298
|
+
];
|
|
299
|
+
case 2:
|
|
300
|
+
_tmp = this.options.requestPlugins;
|
|
301
|
+
_state.label = 3;
|
|
302
|
+
case 3:
|
|
303
|
+
requestPlugins = _tmp;
|
|
304
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
305
|
+
_state.label = 4;
|
|
306
|
+
case 4:
|
|
288
307
|
_state.trys.push([
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
308
|
+
4,
|
|
309
|
+
9,
|
|
310
|
+
10,
|
|
311
|
+
11
|
|
293
312
|
]);
|
|
294
|
-
_iterator =
|
|
295
|
-
_state.label =
|
|
296
|
-
case
|
|
313
|
+
_iterator = requestPlugins[Symbol.iterator]();
|
|
314
|
+
_state.label = 5;
|
|
315
|
+
case 5:
|
|
297
316
|
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
298
317
|
3,
|
|
299
|
-
|
|
318
|
+
8
|
|
300
319
|
];
|
|
301
320
|
plugin = _step.value;
|
|
302
321
|
return [
|
|
@@ -306,29 +325,29 @@ var DEFAULT_OPTIONS = {
|
|
|
306
325
|
apiName: (_requestOptionsParameters_api = requestOptionsParameters.api) === null || _requestOptionsParameters_api === void 0 ? void 0 : _requestOptionsParameters_api.apiName
|
|
307
326
|
}).transform(opts)
|
|
308
327
|
];
|
|
309
|
-
case
|
|
328
|
+
case 6:
|
|
310
329
|
opts = _state.sent();
|
|
311
|
-
_state.label =
|
|
312
|
-
case
|
|
330
|
+
_state.label = 7;
|
|
331
|
+
case 7:
|
|
313
332
|
_iteratorNormalCompletion = true;
|
|
314
333
|
return [
|
|
315
334
|
3,
|
|
316
|
-
|
|
335
|
+
5
|
|
317
336
|
];
|
|
318
|
-
case
|
|
337
|
+
case 8:
|
|
319
338
|
return [
|
|
320
339
|
3,
|
|
321
|
-
|
|
340
|
+
11
|
|
322
341
|
];
|
|
323
|
-
case
|
|
342
|
+
case 9:
|
|
324
343
|
err = _state.sent();
|
|
325
344
|
_didIteratorError = true;
|
|
326
345
|
_iteratorError = err;
|
|
327
346
|
return [
|
|
328
347
|
3,
|
|
329
|
-
|
|
348
|
+
11
|
|
330
349
|
];
|
|
331
|
-
case
|
|
350
|
+
case 10:
|
|
332
351
|
try {
|
|
333
352
|
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
334
353
|
_iterator.return();
|
|
@@ -341,7 +360,7 @@ var DEFAULT_OPTIONS = {
|
|
|
341
360
|
return [
|
|
342
361
|
7
|
|
343
362
|
];
|
|
344
|
-
case
|
|
363
|
+
case 11:
|
|
345
364
|
return [
|
|
346
365
|
2,
|
|
347
366
|
opts
|
|
@@ -135,9 +135,13 @@ var isPromise = function(value) {
|
|
|
135
135
|
queryParams: filterUndefinedValues(options.queryParams)
|
|
136
136
|
});
|
|
137
137
|
if (this.options.requestPlugins) {
|
|
138
|
+
var requestPlugins = typeof this.options.requestPlugins === 'function' ? this.options.requestPlugins(opts) : this.options.requestPlugins;
|
|
139
|
+
if (isPromise(requestPlugins)) {
|
|
140
|
+
throw new Error('Only a synchronous function is supported to return the list of Request Plugin for this Client');
|
|
141
|
+
}
|
|
138
142
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
139
143
|
try {
|
|
140
|
-
for(var _iterator =
|
|
144
|
+
for(var _iterator = requestPlugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
141
145
|
var plugin = _step.value;
|
|
142
146
|
var _options_api;
|
|
143
147
|
var changedOpt = plugin.load({
|