@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
|
@@ -106,7 +106,7 @@ function _object_spread_props(target, source) {
|
|
|
106
106
|
return target;
|
|
107
107
|
}
|
|
108
108
|
function _ts_generator(thisArg, body) {
|
|
109
|
-
var f, y, t,
|
|
109
|
+
var f, y, t, _ = {
|
|
110
110
|
label: 0,
|
|
111
111
|
sent: function() {
|
|
112
112
|
if (t[0] & 1) throw t[1];
|
|
@@ -114,12 +114,8 @@ function _ts_generator(thisArg, body) {
|
|
|
114
114
|
},
|
|
115
115
|
trys: [],
|
|
116
116
|
ops: []
|
|
117
|
-
};
|
|
118
|
-
return g = {
|
|
119
|
-
next: verb(0),
|
|
120
|
-
"throw": verb(1),
|
|
121
|
-
"return": verb(2)
|
|
122
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
117
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
118
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
123
119
|
return this;
|
|
124
120
|
}), g;
|
|
125
121
|
function verb(n) {
|
|
@@ -132,7 +128,7 @@ function _ts_generator(thisArg, body) {
|
|
|
132
128
|
}
|
|
133
129
|
function step(op) {
|
|
134
130
|
if (f) throw new TypeError("Generator is already executing.");
|
|
135
|
-
while(_)try {
|
|
131
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
136
132
|
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;
|
|
137
133
|
if (y = 0, t) op = [
|
|
138
134
|
op[0] & 2,
|
|
@@ -229,109 +225,107 @@ import { MockInterceptRequest } from './mock-intercept.request';
|
|
|
229
225
|
}
|
|
230
226
|
return {
|
|
231
227
|
transform: function(call) {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
return [
|
|
239
|
-
4,
|
|
240
|
-
_this1.options.adapter.initialize()
|
|
241
|
-
];
|
|
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(CUSTOM_MOCK_OPERATION_ID_HEADER)) {
|
|
228
|
+
return from(function() {
|
|
229
|
+
return _async_to_generator(function() {
|
|
230
|
+
var originalCall, delayTime, _tmp, operationId, mock, response;
|
|
231
|
+
return _ts_generator(this, function(_state) {
|
|
232
|
+
switch(_state.label){
|
|
233
|
+
case 0:
|
|
247
234
|
return [
|
|
248
|
-
|
|
249
|
-
|
|
235
|
+
4,
|
|
236
|
+
this.options.adapter.initialize()
|
|
250
237
|
];
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
if (!(typeof _this1.options.delayTiming === 'number')) return [
|
|
257
|
-
3,
|
|
258
|
-
2
|
|
259
|
-
];
|
|
260
|
-
_tmp = _this1.options.delayTiming;
|
|
261
|
-
return [
|
|
262
|
-
3,
|
|
263
|
-
4
|
|
264
|
-
];
|
|
265
|
-
case 2:
|
|
266
|
-
return [
|
|
267
|
-
4,
|
|
268
|
-
_this1.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(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(CUSTOM_MOCK_OPERATION_ID_HEADER);
|
|
283
|
-
try {
|
|
284
|
-
mock = _this1.options.adapter.getLatestMock(operationId);
|
|
285
|
-
if (!mock.getResponse) {
|
|
238
|
+
case 1:
|
|
239
|
+
_state.sent();
|
|
240
|
+
originalCall = call;
|
|
241
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- type of options is explicitly `any`
|
|
242
|
+
if (!context.options.headers || !_instanceof(context.options.headers, Headers) || !context.options.headers.has(CUSTOM_MOCK_OPERATION_ID_HEADER)) {
|
|
286
243
|
return [
|
|
287
244
|
2,
|
|
288
245
|
originalCall
|
|
289
246
|
];
|
|
290
247
|
}
|
|
291
|
-
|
|
248
|
+
if (!(typeof this.options.delayTiming !== 'undefined')) return [
|
|
249
|
+
3,
|
|
250
|
+
5
|
|
251
|
+
];
|
|
252
|
+
if (!(typeof this.options.delayTiming === 'number')) return [
|
|
253
|
+
3,
|
|
254
|
+
2
|
|
255
|
+
];
|
|
256
|
+
_tmp = this.options.delayTiming;
|
|
292
257
|
return [
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
var _ref = _async_to_generator(function(res) {
|
|
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 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
|
-
return function(res) {
|
|
318
|
-
return _ref.apply(this, arguments);
|
|
319
|
-
};
|
|
320
|
-
}()))
|
|
258
|
+
3,
|
|
259
|
+
4
|
|
321
260
|
];
|
|
322
|
-
|
|
323
|
-
|
|
261
|
+
case 2:
|
|
262
|
+
return [
|
|
263
|
+
4,
|
|
264
|
+
this.options.delayTiming(_object_spread_props(_object_spread({}, context), {
|
|
265
|
+
fetchPlugins: [],
|
|
266
|
+
options: context.requestOptions
|
|
267
|
+
}))
|
|
268
|
+
];
|
|
269
|
+
case 3:
|
|
270
|
+
_tmp = _state.sent();
|
|
271
|
+
_state.label = 4;
|
|
272
|
+
case 4:
|
|
273
|
+
delayTime = _tmp;
|
|
274
|
+
originalCall = originalCall.pipe(delay(delayTime));
|
|
275
|
+
_state.label = 5;
|
|
276
|
+
case 5:
|
|
277
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- type of options is explicitly `any`
|
|
278
|
+
operationId = context.options.headers.get(CUSTOM_MOCK_OPERATION_ID_HEADER);
|
|
279
|
+
try {
|
|
280
|
+
mock = this.options.adapter.getLatestMock(operationId);
|
|
281
|
+
if (!mock.getResponse) {
|
|
282
|
+
return [
|
|
283
|
+
2,
|
|
284
|
+
originalCall
|
|
285
|
+
];
|
|
286
|
+
}
|
|
287
|
+
response = mock.getResponse();
|
|
288
|
+
return [
|
|
289
|
+
2,
|
|
290
|
+
originalCall.pipe(mergeMap(function(res) {
|
|
291
|
+
return _async_to_generator(function() {
|
|
292
|
+
var body, responseCloned;
|
|
293
|
+
return _ts_generator(this, function(_state) {
|
|
294
|
+
switch(_state.label){
|
|
295
|
+
case 0:
|
|
296
|
+
return [
|
|
297
|
+
4,
|
|
298
|
+
response.json()
|
|
299
|
+
];
|
|
300
|
+
case 1:
|
|
301
|
+
body = _state.sent();
|
|
302
|
+
responseCloned = res.clone();
|
|
303
|
+
return [
|
|
304
|
+
2,
|
|
305
|
+
new HttpResponse(_object_spread_props(_object_spread({}, responseCloned), {
|
|
306
|
+
body: body,
|
|
307
|
+
url: responseCloned.url || undefined
|
|
308
|
+
}))
|
|
309
|
+
];
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
/* eslint-enable-next-line @typescript-eslint/no-unsafe-assignment */ })();
|
|
313
|
+
}))
|
|
314
|
+
];
|
|
315
|
+
} catch (e) {
|
|
316
|
+
(context.logger || console).error("Failed to retrieve the latest mock for Operation ID ".concat(operationId, ", fallback to default mock"));
|
|
317
|
+
return [
|
|
318
|
+
2,
|
|
319
|
+
originalCall
|
|
320
|
+
];
|
|
321
|
+
}
|
|
324
322
|
return [
|
|
325
|
-
2
|
|
326
|
-
originalCall
|
|
323
|
+
2
|
|
327
324
|
];
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
})()).pipe(mergeMap(function(res) {
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
}).call(_this);
|
|
328
|
+
}()).pipe(mergeMap(function(res) {
|
|
335
329
|
return res;
|
|
336
330
|
}));
|
|
337
331
|
}
|
|
@@ -67,7 +67,7 @@ function _instanceof(left, right) {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
function _ts_generator(thisArg, body) {
|
|
70
|
-
var f, y, t,
|
|
70
|
+
var f, y, t, _ = {
|
|
71
71
|
label: 0,
|
|
72
72
|
sent: function() {
|
|
73
73
|
if (t[0] & 1) throw t[1];
|
|
@@ -75,12 +75,8 @@ function _ts_generator(thisArg, body) {
|
|
|
75
75
|
},
|
|
76
76
|
trys: [],
|
|
77
77
|
ops: []
|
|
78
|
-
};
|
|
79
|
-
return g = {
|
|
80
|
-
next: verb(0),
|
|
81
|
-
"throw": verb(1),
|
|
82
|
-
"return": verb(2)
|
|
83
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
78
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
79
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
84
80
|
return this;
|
|
85
81
|
}), g;
|
|
86
82
|
function verb(n) {
|
|
@@ -93,7 +89,7 @@ function _ts_generator(thisArg, body) {
|
|
|
93
89
|
}
|
|
94
90
|
function step(op) {
|
|
95
91
|
if (f) throw new TypeError("Generator is already executing.");
|
|
96
|
-
while(_)try {
|
|
92
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
97
93
|
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;
|
|
98
94
|
if (y = 0, t) op = [
|
|
99
95
|
op[0] & 2,
|
|
@@ -180,22 +176,22 @@ import { MockInterceptRequest } from './mock-intercept.request';
|
|
|
180
176
|
{
|
|
181
177
|
key: "load",
|
|
182
178
|
value: function load(context) {
|
|
179
|
+
var _this = this;
|
|
183
180
|
if (!context.apiClient.options.requestPlugins.some(function(plugin) {
|
|
184
181
|
return _instanceof(plugin, MockInterceptRequest);
|
|
185
182
|
})) {
|
|
186
183
|
throw new Error('MockInterceptFetch plugin should be used only with the MockInterceptRequest plugin');
|
|
187
184
|
}
|
|
188
|
-
var _this = this;
|
|
189
185
|
return {
|
|
190
|
-
transform:
|
|
191
|
-
|
|
186
|
+
transform: function(fetchCall) {
|
|
187
|
+
return _async_to_generator(function() {
|
|
192
188
|
var responsePromise, delay, _tmp, resp, operationId, mock, response;
|
|
193
189
|
return _ts_generator(this, function(_state) {
|
|
194
190
|
switch(_state.label){
|
|
195
191
|
case 0:
|
|
196
192
|
return [
|
|
197
193
|
4,
|
|
198
|
-
|
|
194
|
+
this.options.adapter.initialize()
|
|
199
195
|
];
|
|
200
196
|
case 1:
|
|
201
197
|
_state.sent();
|
|
@@ -206,15 +202,15 @@ import { MockInterceptRequest } from './mock-intercept.request';
|
|
|
206
202
|
responsePromise
|
|
207
203
|
];
|
|
208
204
|
}
|
|
209
|
-
if (!(typeof
|
|
205
|
+
if (!(typeof this.options.delayTiming !== 'undefined')) return [
|
|
210
206
|
3,
|
|
211
207
|
6
|
|
212
208
|
];
|
|
213
|
-
if (!(typeof
|
|
209
|
+
if (!(typeof this.options.delayTiming === 'number')) return [
|
|
214
210
|
3,
|
|
215
211
|
2
|
|
216
212
|
];
|
|
217
|
-
_tmp =
|
|
213
|
+
_tmp = this.options.delayTiming;
|
|
218
214
|
return [
|
|
219
215
|
3,
|
|
220
216
|
4
|
|
@@ -222,7 +218,7 @@ import { MockInterceptRequest } from './mock-intercept.request';
|
|
|
222
218
|
case 2:
|
|
223
219
|
return [
|
|
224
220
|
4,
|
|
225
|
-
|
|
221
|
+
this.options.delayTiming(context)
|
|
226
222
|
];
|
|
227
223
|
case 3:
|
|
228
224
|
_tmp = _state.sent();
|
|
@@ -244,7 +240,7 @@ import { MockInterceptRequest } from './mock-intercept.request';
|
|
|
244
240
|
case 6:
|
|
245
241
|
operationId = context.options.headers.get(CUSTOM_MOCK_OPERATION_ID_HEADER);
|
|
246
242
|
try {
|
|
247
|
-
mock =
|
|
243
|
+
mock = this.options.adapter.getLatestMock(operationId);
|
|
248
244
|
if (!mock.getResponse) {
|
|
249
245
|
return [
|
|
250
246
|
2,
|
|
@@ -270,11 +266,8 @@ import { MockInterceptRequest } from './mock-intercept.request';
|
|
|
270
266
|
];
|
|
271
267
|
}
|
|
272
268
|
});
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
return _ref.apply(this, arguments);
|
|
276
|
-
};
|
|
277
|
-
}()
|
|
269
|
+
}).call(_this);
|
|
270
|
+
}
|
|
278
271
|
};
|
|
279
272
|
}
|
|
280
273
|
}
|
|
@@ -99,7 +99,7 @@ function _object_spread_props(target, source) {
|
|
|
99
99
|
return target;
|
|
100
100
|
}
|
|
101
101
|
function _ts_generator(thisArg, body) {
|
|
102
|
-
var f, y, t,
|
|
102
|
+
var f, y, t, _ = {
|
|
103
103
|
label: 0,
|
|
104
104
|
sent: function() {
|
|
105
105
|
if (t[0] & 1) throw t[1];
|
|
@@ -107,12 +107,8 @@ function _ts_generator(thisArg, body) {
|
|
|
107
107
|
},
|
|
108
108
|
trys: [],
|
|
109
109
|
ops: []
|
|
110
|
-
};
|
|
111
|
-
return g = {
|
|
112
|
-
next: verb(0),
|
|
113
|
-
"throw": verb(1),
|
|
114
|
-
"return": verb(2)
|
|
115
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
110
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
111
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
116
112
|
return this;
|
|
117
113
|
}), g;
|
|
118
114
|
function verb(n) {
|
|
@@ -125,7 +121,7 @@ function _ts_generator(thisArg, body) {
|
|
|
125
121
|
}
|
|
126
122
|
function step(op) {
|
|
127
123
|
if (f) throw new TypeError("Generator is already executing.");
|
|
128
|
-
while(_)try {
|
|
124
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
129
125
|
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;
|
|
130
126
|
if (y = 0, t) op = [
|
|
131
127
|
op[0] & 2,
|
|
@@ -214,19 +210,19 @@ import { CUSTOM_MOCK_OPERATION_ID_HEADER, CUSTOM_MOCK_REQUEST_HEADER } from './m
|
|
|
214
210
|
value: /** @inheritdoc */ function load() {
|
|
215
211
|
var _this = this;
|
|
216
212
|
return {
|
|
217
|
-
transform:
|
|
218
|
-
|
|
213
|
+
transform: function(data) {
|
|
214
|
+
return _async_to_generator(function() {
|
|
219
215
|
var requestOption, operationId, mock, text, blob, basePath, headers;
|
|
220
216
|
return _ts_generator(this, function(_state) {
|
|
221
217
|
switch(_state.label){
|
|
222
218
|
case 0:
|
|
223
219
|
return [
|
|
224
220
|
4,
|
|
225
|
-
|
|
221
|
+
this.options.adapter.initialize()
|
|
226
222
|
];
|
|
227
223
|
case 1:
|
|
228
224
|
_state.sent();
|
|
229
|
-
if (
|
|
225
|
+
if (this.options.disabled || this.options.filter && !this.options.filter(data)) {
|
|
230
226
|
return [
|
|
231
227
|
2,
|
|
232
228
|
data
|
|
@@ -238,11 +234,11 @@ import { CUSTOM_MOCK_OPERATION_ID_HEADER, CUSTOM_MOCK_REQUEST_HEADER } from './m
|
|
|
238
234
|
delete requestOption.api;
|
|
239
235
|
return [
|
|
240
236
|
4,
|
|
241
|
-
|
|
237
|
+
this.options.adapter.retrieveOperationId(requestOption)
|
|
242
238
|
];
|
|
243
239
|
case 2:
|
|
244
240
|
operationId = _state.sent();
|
|
245
|
-
mock =
|
|
241
|
+
mock = this.options.adapter.getMock(operationId);
|
|
246
242
|
text = JSON.stringify(mock.mockData);
|
|
247
243
|
blob = new Blob([
|
|
248
244
|
text
|
|
@@ -263,11 +259,8 @@ import { CUSTOM_MOCK_OPERATION_ID_HEADER, CUSTOM_MOCK_REQUEST_HEADER } from './m
|
|
|
263
259
|
];
|
|
264
260
|
}
|
|
265
261
|
});
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
return _ref.apply(this, arguments);
|
|
269
|
-
};
|
|
270
|
-
}()
|
|
262
|
+
}).call(_this);
|
|
263
|
+
}
|
|
271
264
|
};
|
|
272
265
|
}
|
|
273
266
|
}
|