@ama-sdk/core 12.1.8 → 12.1.11
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 +13 -18
- package/cjs/clients/api-fetch-client.js +16 -21
- package/cjs/fwk/api.helpers.js +11 -11
- package/cjs/fwk/date.js +5 -5
- package/cjs/fwk/errors.js +7 -7
- package/cjs/fwk/mocks/alf-mock-adapter.js +58 -60
- package/cjs/fwk/mocks/base-mock-adapter.js +15 -19
- package/cjs/fwk/mocks/helpers.js +3 -3
- package/cjs/fwk/param-serialization.js +6 -6
- package/cjs/fwk/reviver.js +4 -4
- package/cjs/plugins/abort/abort.spec.js +83 -81
- package/cjs/plugins/additional-params/additional-params.request.js +18 -25
- package/cjs/plugins/additional-params/additional-params.spec.js +194 -186
- package/cjs/plugins/api-configuration-override/api-configuration-override.request.js +10 -17
- package/cjs/plugins/api-configuration-override/api-configuration-override.spec.js +83 -81
- package/cjs/plugins/api-key/api-key.request.js +12 -19
- package/cjs/plugins/api-key/api-key.spec.js +50 -50
- package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +25 -36
- package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +343 -327
- package/cjs/plugins/client-facts/client-facts.request.js +18 -25
- package/cjs/plugins/client-facts/client-facts.spec.js +218 -208
- package/cjs/plugins/concurrent/concurrent.fetch.js +12 -20
- package/cjs/plugins/concurrent/concurrent.spec.js +99 -99
- package/cjs/plugins/custom-info/custom-info.spec.js +90 -90
- package/cjs/plugins/fetch-cache/fetch-cache.spec.js +100 -98
- package/cjs/plugins/fetch-credentials/fetch-credentials.spec.js +60 -60
- package/cjs/plugins/json-token/json-token.spec.js +109 -107
- package/cjs/plugins/keepalive/keepalive.request.js +7 -12
- package/cjs/plugins/keepalive/keepalive.spec.js +32 -34
- package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.helpers.js +11 -23
- package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +18 -28
- package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +212 -204
- package/cjs/plugins/mock-intercept/mock-intercept.angular.js +94 -100
- package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +15 -22
- package/cjs/plugins/mock-intercept/mock-intercept.interface.js +3 -3
- package/cjs/plugins/mock-intercept/mock-intercept.request.js +12 -19
- package/cjs/plugins/mock-intercept/mock-intercept.spec.js +245 -237
- package/cjs/plugins/perf-metric/perf-metric.fetch.js +11 -18
- package/cjs/plugins/pii-tokenizer/pii-tokenizer.request.js +19 -27
- package/cjs/plugins/pii-tokenizer/pii-tokenizer.spec.js +404 -386
- package/cjs/plugins/raw-response-info/raw-response-info.spec.js +67 -67
- package/cjs/plugins/retry/retry.fetch.js +18 -27
- package/cjs/plugins/retry/retry.spec.js +233 -225
- package/cjs/plugins/reviver/reviver.spec.js +88 -86
- package/cjs/plugins/session-id/session-id.spec.js +98 -94
- package/cjs/plugins/si-token/si-token.spec.js +27 -29
- package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +17 -24
- package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +199 -191
- package/cjs/plugins/timeout/timeout.fetch.js +16 -22
- package/cjs/plugins/timeout/timeout.spec.js +211 -205
- package/cjs/plugins/url-rewrite/url-rewrite.request.js +9 -16
- package/cjs/plugins/url-rewrite/url-rewrite.spec.js +48 -48
- package/cjs/plugins/wait-for/wait-for.fetch.js +19 -29
- package/cjs/plugins/wait-for/wait-for.spec.js +211 -203
- package/cjs/utils/crypto.js +15 -27
- package/cjs/utils/generic-api.js +9 -14
- package/cjs/utils/json-token.js +19 -26
- package/cjs/utils/json-token.spec.js +495 -497
- package/cjs/utils/mime-types.js +3 -3
- package/esm2015/clients/api-angular-client.js +13 -18
- package/esm2015/clients/api-fetch-client.js +16 -21
- package/esm2015/fwk/mocks/alf-mock-adapter.js +58 -60
- package/esm2015/fwk/mocks/base-mock-adapter.js +15 -19
- package/esm2015/plugins/abort/abort.spec.js +83 -81
- package/esm2015/plugins/additional-params/additional-params.request.js +15 -22
- package/esm2015/plugins/additional-params/additional-params.spec.js +194 -186
- package/esm2015/plugins/api-configuration-override/api-configuration-override.request.js +10 -17
- package/esm2015/plugins/api-configuration-override/api-configuration-override.spec.js +83 -81
- package/esm2015/plugins/api-key/api-key.request.js +12 -19
- package/esm2015/plugins/api-key/api-key.spec.js +50 -50
- package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +21 -32
- package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +343 -327
- package/esm2015/plugins/client-facts/client-facts.request.js +15 -22
- package/esm2015/plugins/client-facts/client-facts.spec.js +218 -208
- package/esm2015/plugins/concurrent/concurrent.fetch.js +12 -20
- package/esm2015/plugins/concurrent/concurrent.spec.js +99 -99
- package/esm2015/plugins/custom-info/custom-info.spec.js +90 -90
- package/esm2015/plugins/fetch-cache/fetch-cache.spec.js +100 -98
- package/esm2015/plugins/fetch-credentials/fetch-credentials.spec.js +60 -60
- package/esm2015/plugins/json-token/json-token.spec.js +109 -107
- package/esm2015/plugins/keepalive/keepalive.request.js +7 -12
- package/esm2015/plugins/keepalive/keepalive.spec.js +32 -34
- package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.helpers.js +8 -20
- package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +18 -28
- package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +212 -204
- package/esm2015/plugins/mock-intercept/mock-intercept.angular.js +94 -100
- package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +15 -22
- package/esm2015/plugins/mock-intercept/mock-intercept.request.js +12 -19
- package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +245 -237
- package/esm2015/plugins/perf-metric/perf-metric.fetch.js +11 -18
- package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +15 -23
- package/esm2015/plugins/pii-tokenizer/pii-tokenizer.spec.js +404 -386
- package/esm2015/plugins/raw-response-info/raw-response-info.spec.js +67 -67
- package/esm2015/plugins/retry/retry.fetch.js +18 -27
- package/esm2015/plugins/retry/retry.spec.js +233 -225
- package/esm2015/plugins/reviver/reviver.spec.js +88 -86
- package/esm2015/plugins/session-id/session-id.spec.js +98 -94
- package/esm2015/plugins/si-token/si-token.spec.js +27 -29
- package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +17 -24
- package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +199 -191
- package/esm2015/plugins/timeout/timeout.fetch.js +13 -19
- package/esm2015/plugins/timeout/timeout.spec.js +211 -205
- package/esm2015/plugins/url-rewrite/url-rewrite.request.js +9 -16
- package/esm2015/plugins/url-rewrite/url-rewrite.spec.js +48 -48
- package/esm2015/plugins/wait-for/wait-for.fetch.js +19 -29
- package/esm2015/plugins/wait-for/wait-for.spec.js +211 -203
- package/esm2015/utils/crypto.js +8 -20
- package/esm2015/utils/generic-api.js +9 -14
- package/esm2015/utils/json-token.js +10 -17
- package/esm2015/utils/json-token.spec.js +495 -497
- package/package.json +6 -6
|
@@ -120,7 +120,7 @@ function _object_spread_props(target, source) {
|
|
|
120
120
|
return target;
|
|
121
121
|
}
|
|
122
122
|
function _ts_generator(thisArg, body) {
|
|
123
|
-
var f, y, t,
|
|
123
|
+
var f, y, t, _ = {
|
|
124
124
|
label: 0,
|
|
125
125
|
sent: function() {
|
|
126
126
|
if (t[0] & 1) throw t[1];
|
|
@@ -128,12 +128,8 @@ function _ts_generator(thisArg, body) {
|
|
|
128
128
|
},
|
|
129
129
|
trys: [],
|
|
130
130
|
ops: []
|
|
131
|
-
};
|
|
132
|
-
return g = {
|
|
133
|
-
next: verb(0),
|
|
134
|
-
"throw": verb(1),
|
|
135
|
-
"return": verb(2)
|
|
136
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
131
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
132
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
137
133
|
return this;
|
|
138
134
|
}), g;
|
|
139
135
|
function verb(n) {
|
|
@@ -146,7 +142,7 @@ function _ts_generator(thisArg, body) {
|
|
|
146
142
|
}
|
|
147
143
|
function step(op) {
|
|
148
144
|
if (f) throw new TypeError("Generator is already executing.");
|
|
149
|
-
while(_)try {
|
|
145
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
150
146
|
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;
|
|
151
147
|
if (y = 0, t) op = [
|
|
152
148
|
op[0] & 2,
|
|
@@ -233,109 +229,107 @@ var MockInterceptAngular = /*#__PURE__*/ function() {
|
|
|
233
229
|
}
|
|
234
230
|
return {
|
|
235
231
|
transform: function(call) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
return [
|
|
243
|
-
4,
|
|
244
|
-
_this1.options.adapter.initialize()
|
|
245
|
-
];
|
|
246
|
-
case 1:
|
|
247
|
-
_state.sent();
|
|
248
|
-
originalCall = call;
|
|
249
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- type of options is explicitly `any`
|
|
250
|
-
if (!context.options.headers || !_instanceof(context.options.headers, Headers) || !context.options.headers.has(_mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER)) {
|
|
232
|
+
return (0, _rxjs.from)(function() {
|
|
233
|
+
return _async_to_generator(function() {
|
|
234
|
+
var originalCall, delayTime, _tmp, operationId, mock, response;
|
|
235
|
+
return _ts_generator(this, function(_state) {
|
|
236
|
+
switch(_state.label){
|
|
237
|
+
case 0:
|
|
251
238
|
return [
|
|
252
|
-
|
|
253
|
-
|
|
239
|
+
4,
|
|
240
|
+
this.options.adapter.initialize()
|
|
254
241
|
];
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
if (!(typeof _this1.options.delayTiming === 'number')) return [
|
|
261
|
-
3,
|
|
262
|
-
2
|
|
263
|
-
];
|
|
264
|
-
_tmp = _this1.options.delayTiming;
|
|
265
|
-
return [
|
|
266
|
-
3,
|
|
267
|
-
4
|
|
268
|
-
];
|
|
269
|
-
case 2:
|
|
270
|
-
return [
|
|
271
|
-
4,
|
|
272
|
-
_this1.options.delayTiming(_object_spread_props(_object_spread({}, context), {
|
|
273
|
-
fetchPlugins: [],
|
|
274
|
-
options: context.requestOptions
|
|
275
|
-
}))
|
|
276
|
-
];
|
|
277
|
-
case 3:
|
|
278
|
-
_tmp = _state.sent();
|
|
279
|
-
_state.label = 4;
|
|
280
|
-
case 4:
|
|
281
|
-
delayTime = _tmp;
|
|
282
|
-
originalCall = originalCall.pipe((0, _rxjs.delay)(delayTime));
|
|
283
|
-
_state.label = 5;
|
|
284
|
-
case 5:
|
|
285
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- type of options is explicitly `any`
|
|
286
|
-
operationId = context.options.headers.get(_mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER);
|
|
287
|
-
try {
|
|
288
|
-
mock = _this1.options.adapter.getLatestMock(operationId);
|
|
289
|
-
if (!mock.getResponse) {
|
|
242
|
+
case 1:
|
|
243
|
+
_state.sent();
|
|
244
|
+
originalCall = call;
|
|
245
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- type of options is explicitly `any`
|
|
246
|
+
if (!context.options.headers || !_instanceof(context.options.headers, Headers) || !context.options.headers.has(_mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER)) {
|
|
290
247
|
return [
|
|
291
248
|
2,
|
|
292
249
|
originalCall
|
|
293
250
|
];
|
|
294
251
|
}
|
|
295
|
-
|
|
252
|
+
if (!(typeof this.options.delayTiming !== 'undefined')) return [
|
|
253
|
+
3,
|
|
254
|
+
5
|
|
255
|
+
];
|
|
256
|
+
if (!(typeof this.options.delayTiming === 'number')) return [
|
|
257
|
+
3,
|
|
258
|
+
2
|
|
259
|
+
];
|
|
260
|
+
_tmp = this.options.delayTiming;
|
|
296
261
|
return [
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
var _ref = _async_to_generator(function(res) {
|
|
300
|
-
var body, responseCloned;
|
|
301
|
-
return _ts_generator(this, function(_state) {
|
|
302
|
-
switch(_state.label){
|
|
303
|
-
case 0:
|
|
304
|
-
return [
|
|
305
|
-
4,
|
|
306
|
-
response.json()
|
|
307
|
-
];
|
|
308
|
-
case 1:
|
|
309
|
-
body = _state.sent();
|
|
310
|
-
responseCloned = res.clone();
|
|
311
|
-
return [
|
|
312
|
-
2,
|
|
313
|
-
new _http.HttpResponse(_object_spread_props(_object_spread({}, responseCloned), {
|
|
314
|
-
body: body,
|
|
315
|
-
url: responseCloned.url || undefined
|
|
316
|
-
}))
|
|
317
|
-
];
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
/* eslint-enable-next-line @typescript-eslint/no-unsafe-assignment */ });
|
|
321
|
-
return function(res) {
|
|
322
|
-
return _ref.apply(this, arguments);
|
|
323
|
-
};
|
|
324
|
-
}()))
|
|
262
|
+
3,
|
|
263
|
+
4
|
|
325
264
|
];
|
|
326
|
-
|
|
327
|
-
|
|
265
|
+
case 2:
|
|
266
|
+
return [
|
|
267
|
+
4,
|
|
268
|
+
this.options.delayTiming(_object_spread_props(_object_spread({}, context), {
|
|
269
|
+
fetchPlugins: [],
|
|
270
|
+
options: context.requestOptions
|
|
271
|
+
}))
|
|
272
|
+
];
|
|
273
|
+
case 3:
|
|
274
|
+
_tmp = _state.sent();
|
|
275
|
+
_state.label = 4;
|
|
276
|
+
case 4:
|
|
277
|
+
delayTime = _tmp;
|
|
278
|
+
originalCall = originalCall.pipe((0, _rxjs.delay)(delayTime));
|
|
279
|
+
_state.label = 5;
|
|
280
|
+
case 5:
|
|
281
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- type of options is explicitly `any`
|
|
282
|
+
operationId = context.options.headers.get(_mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER);
|
|
283
|
+
try {
|
|
284
|
+
mock = this.options.adapter.getLatestMock(operationId);
|
|
285
|
+
if (!mock.getResponse) {
|
|
286
|
+
return [
|
|
287
|
+
2,
|
|
288
|
+
originalCall
|
|
289
|
+
];
|
|
290
|
+
}
|
|
291
|
+
response = mock.getResponse();
|
|
292
|
+
return [
|
|
293
|
+
2,
|
|
294
|
+
originalCall.pipe((0, _rxjs.mergeMap)(function(res) {
|
|
295
|
+
return _async_to_generator(function() {
|
|
296
|
+
var body, responseCloned;
|
|
297
|
+
return _ts_generator(this, function(_state) {
|
|
298
|
+
switch(_state.label){
|
|
299
|
+
case 0:
|
|
300
|
+
return [
|
|
301
|
+
4,
|
|
302
|
+
response.json()
|
|
303
|
+
];
|
|
304
|
+
case 1:
|
|
305
|
+
body = _state.sent();
|
|
306
|
+
responseCloned = res.clone();
|
|
307
|
+
return [
|
|
308
|
+
2,
|
|
309
|
+
new _http.HttpResponse(_object_spread_props(_object_spread({}, responseCloned), {
|
|
310
|
+
body: body,
|
|
311
|
+
url: responseCloned.url || undefined
|
|
312
|
+
}))
|
|
313
|
+
];
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
/* eslint-enable-next-line @typescript-eslint/no-unsafe-assignment */ })();
|
|
317
|
+
}))
|
|
318
|
+
];
|
|
319
|
+
} catch (e) {
|
|
320
|
+
(context.logger || console).error("Failed to retrieve the latest mock for Operation ID ".concat(operationId, ", fallback to default mock"));
|
|
321
|
+
return [
|
|
322
|
+
2,
|
|
323
|
+
originalCall
|
|
324
|
+
];
|
|
325
|
+
}
|
|
328
326
|
return [
|
|
329
|
-
2
|
|
330
|
-
originalCall
|
|
327
|
+
2
|
|
331
328
|
];
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
})()).pipe((0, _rxjs.mergeMap)(function(res) {
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
}).call(_this);
|
|
332
|
+
}()).pipe((0, _rxjs.mergeMap)(function(res) {
|
|
339
333
|
return res;
|
|
340
334
|
}));
|
|
341
335
|
}
|
|
@@ -79,7 +79,7 @@ function _instanceof(left, right) {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
function _ts_generator(thisArg, body) {
|
|
82
|
-
var f, y, t,
|
|
82
|
+
var f, y, t, _ = {
|
|
83
83
|
label: 0,
|
|
84
84
|
sent: function() {
|
|
85
85
|
if (t[0] & 1) throw t[1];
|
|
@@ -87,12 +87,8 @@ function _ts_generator(thisArg, body) {
|
|
|
87
87
|
},
|
|
88
88
|
trys: [],
|
|
89
89
|
ops: []
|
|
90
|
-
};
|
|
91
|
-
return g = {
|
|
92
|
-
next: verb(0),
|
|
93
|
-
"throw": verb(1),
|
|
94
|
-
"return": verb(2)
|
|
95
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
90
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
91
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
96
92
|
return this;
|
|
97
93
|
}), g;
|
|
98
94
|
function verb(n) {
|
|
@@ -105,7 +101,7 @@ function _ts_generator(thisArg, body) {
|
|
|
105
101
|
}
|
|
106
102
|
function step(op) {
|
|
107
103
|
if (f) throw new TypeError("Generator is already executing.");
|
|
108
|
-
while(_)try {
|
|
104
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
109
105
|
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;
|
|
110
106
|
if (y = 0, t) op = [
|
|
111
107
|
op[0] & 2,
|
|
@@ -184,22 +180,22 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
|
|
|
184
180
|
{
|
|
185
181
|
key: "load",
|
|
186
182
|
value: function load(context) {
|
|
183
|
+
var _this = this;
|
|
187
184
|
if (!context.apiClient.options.requestPlugins.some(function(plugin) {
|
|
188
185
|
return _instanceof(plugin, _mockinterceptrequest.MockInterceptRequest);
|
|
189
186
|
})) {
|
|
190
187
|
throw new Error('MockInterceptFetch plugin should be used only with the MockInterceptRequest plugin');
|
|
191
188
|
}
|
|
192
|
-
var _this = this;
|
|
193
189
|
return {
|
|
194
|
-
transform:
|
|
195
|
-
|
|
190
|
+
transform: function(fetchCall) {
|
|
191
|
+
return _async_to_generator(function() {
|
|
196
192
|
var responsePromise, delay, _tmp, resp, operationId, mock, response;
|
|
197
193
|
return _ts_generator(this, function(_state) {
|
|
198
194
|
switch(_state.label){
|
|
199
195
|
case 0:
|
|
200
196
|
return [
|
|
201
197
|
4,
|
|
202
|
-
|
|
198
|
+
this.options.adapter.initialize()
|
|
203
199
|
];
|
|
204
200
|
case 1:
|
|
205
201
|
_state.sent();
|
|
@@ -210,15 +206,15 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
|
|
|
210
206
|
responsePromise
|
|
211
207
|
];
|
|
212
208
|
}
|
|
213
|
-
if (!(typeof
|
|
209
|
+
if (!(typeof this.options.delayTiming !== 'undefined')) return [
|
|
214
210
|
3,
|
|
215
211
|
6
|
|
216
212
|
];
|
|
217
|
-
if (!(typeof
|
|
213
|
+
if (!(typeof this.options.delayTiming === 'number')) return [
|
|
218
214
|
3,
|
|
219
215
|
2
|
|
220
216
|
];
|
|
221
|
-
_tmp =
|
|
217
|
+
_tmp = this.options.delayTiming;
|
|
222
218
|
return [
|
|
223
219
|
3,
|
|
224
220
|
4
|
|
@@ -226,7 +222,7 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
|
|
|
226
222
|
case 2:
|
|
227
223
|
return [
|
|
228
224
|
4,
|
|
229
|
-
|
|
225
|
+
this.options.delayTiming(context)
|
|
230
226
|
];
|
|
231
227
|
case 3:
|
|
232
228
|
_tmp = _state.sent();
|
|
@@ -248,7 +244,7 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
|
|
|
248
244
|
case 6:
|
|
249
245
|
operationId = context.options.headers.get(_mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER);
|
|
250
246
|
try {
|
|
251
|
-
mock =
|
|
247
|
+
mock = this.options.adapter.getLatestMock(operationId);
|
|
252
248
|
if (!mock.getResponse) {
|
|
253
249
|
return [
|
|
254
250
|
2,
|
|
@@ -274,11 +270,8 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
|
|
|
274
270
|
];
|
|
275
271
|
}
|
|
276
272
|
});
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
return _ref.apply(this, arguments);
|
|
280
|
-
};
|
|
281
|
-
}()
|
|
273
|
+
}).call(_this);
|
|
274
|
+
}
|
|
282
275
|
};
|
|
283
276
|
}
|
|
284
277
|
}
|
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
CUSTOM_MOCK_OPERATION_ID_HEADER
|
|
12
|
+
get CUSTOM_MOCK_OPERATION_ID_HEADER () {
|
|
13
13
|
return CUSTOM_MOCK_OPERATION_ID_HEADER;
|
|
14
14
|
},
|
|
15
|
-
CUSTOM_MOCK_REQUEST_HEADER
|
|
15
|
+
get CUSTOM_MOCK_REQUEST_HEADER () {
|
|
16
16
|
return CUSTOM_MOCK_REQUEST_HEADER;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -110,7 +110,7 @@ function _object_spread_props(target, source) {
|
|
|
110
110
|
return target;
|
|
111
111
|
}
|
|
112
112
|
function _ts_generator(thisArg, body) {
|
|
113
|
-
var f, y, t,
|
|
113
|
+
var f, y, t, _ = {
|
|
114
114
|
label: 0,
|
|
115
115
|
sent: function() {
|
|
116
116
|
if (t[0] & 1) throw t[1];
|
|
@@ -118,12 +118,8 @@ function _ts_generator(thisArg, body) {
|
|
|
118
118
|
},
|
|
119
119
|
trys: [],
|
|
120
120
|
ops: []
|
|
121
|
-
};
|
|
122
|
-
return g = {
|
|
123
|
-
next: verb(0),
|
|
124
|
-
"throw": verb(1),
|
|
125
|
-
"return": verb(2)
|
|
126
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
121
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
122
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
127
123
|
return this;
|
|
128
124
|
}), g;
|
|
129
125
|
function verb(n) {
|
|
@@ -136,7 +132,7 @@ function _ts_generator(thisArg, body) {
|
|
|
136
132
|
}
|
|
137
133
|
function step(op) {
|
|
138
134
|
if (f) throw new TypeError("Generator is already executing.");
|
|
139
|
-
while(_)try {
|
|
135
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
140
136
|
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;
|
|
141
137
|
if (y = 0, t) op = [
|
|
142
138
|
op[0] & 2,
|
|
@@ -222,19 +218,19 @@ var MockInterceptRequest = /*#__PURE__*/ function() {
|
|
|
222
218
|
value: /** @inheritdoc */ function load() {
|
|
223
219
|
var _this = this;
|
|
224
220
|
return {
|
|
225
|
-
transform:
|
|
226
|
-
|
|
221
|
+
transform: function(data) {
|
|
222
|
+
return _async_to_generator(function() {
|
|
227
223
|
var requestOption, operationId, mock, text, blob, basePath, headers;
|
|
228
224
|
return _ts_generator(this, function(_state) {
|
|
229
225
|
switch(_state.label){
|
|
230
226
|
case 0:
|
|
231
227
|
return [
|
|
232
228
|
4,
|
|
233
|
-
|
|
229
|
+
this.options.adapter.initialize()
|
|
234
230
|
];
|
|
235
231
|
case 1:
|
|
236
232
|
_state.sent();
|
|
237
|
-
if (
|
|
233
|
+
if (this.options.disabled || this.options.filter && !this.options.filter(data)) {
|
|
238
234
|
return [
|
|
239
235
|
2,
|
|
240
236
|
data
|
|
@@ -246,11 +242,11 @@ var MockInterceptRequest = /*#__PURE__*/ function() {
|
|
|
246
242
|
delete requestOption.api;
|
|
247
243
|
return [
|
|
248
244
|
4,
|
|
249
|
-
|
|
245
|
+
this.options.adapter.retrieveOperationId(requestOption)
|
|
250
246
|
];
|
|
251
247
|
case 2:
|
|
252
248
|
operationId = _state.sent();
|
|
253
|
-
mock =
|
|
249
|
+
mock = this.options.adapter.getMock(operationId);
|
|
254
250
|
text = JSON.stringify(mock.mockData);
|
|
255
251
|
blob = new Blob([
|
|
256
252
|
text
|
|
@@ -271,11 +267,8 @@ var MockInterceptRequest = /*#__PURE__*/ function() {
|
|
|
271
267
|
];
|
|
272
268
|
}
|
|
273
269
|
});
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
return _ref.apply(this, arguments);
|
|
277
|
-
};
|
|
278
|
-
}()
|
|
270
|
+
}).call(_this);
|
|
271
|
+
}
|
|
279
272
|
};
|
|
280
273
|
}
|
|
281
274
|
}
|