@ama-sdk/client-fetch 11.3.0-prerelease.33

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.
Files changed (157) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +33 -0
  3. package/cjs/api-fetch-client.js +581 -0
  4. package/cjs/fetch-plugin.js +4 -0
  5. package/cjs/plugins/abort/abort.fetch.js +84 -0
  6. package/cjs/plugins/abort/abort.spec.js +204 -0
  7. package/cjs/plugins/abort/index.js +18 -0
  8. package/cjs/plugins/concurrent/concurrent.fetch.js +263 -0
  9. package/cjs/plugins/concurrent/concurrent.spec.js +239 -0
  10. package/cjs/plugins/concurrent/index.js +18 -0
  11. package/cjs/plugins/index.js +25 -0
  12. package/cjs/plugins/keepalive/index.js +18 -0
  13. package/cjs/plugins/keepalive/keepalive.request.js +289 -0
  14. package/cjs/plugins/keepalive/keepalive.spec.js +162 -0
  15. package/cjs/plugins/mock-intercept/index.js +19 -0
  16. package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +288 -0
  17. package/cjs/plugins/mock-intercept/mock-intercept.interface.js +4 -0
  18. package/cjs/plugins/mock-intercept/mock-intercept.spec.js +445 -0
  19. package/cjs/plugins/perf-metric/index.js +18 -0
  20. package/cjs/plugins/perf-metric/perf-metric.fetch.js +371 -0
  21. package/cjs/plugins/perf-metric/perf-metric.probe.spec.js +60 -0
  22. package/cjs/plugins/retry/index.js +18 -0
  23. package/cjs/plugins/retry/retry.fetch.js +371 -0
  24. package/cjs/plugins/retry/retry.spec.js +348 -0
  25. package/cjs/plugins/timeout/index.js +18 -0
  26. package/cjs/plugins/timeout/timeout.fetch.js +320 -0
  27. package/cjs/plugins/timeout/timeout.spec.js +443 -0
  28. package/cjs/plugins/wait-for/index.js +18 -0
  29. package/cjs/plugins/wait-for/wait-for.fetch.js +350 -0
  30. package/cjs/plugins/wait-for/wait-for.spec.js +383 -0
  31. package/cjs/public_api.js +20 -0
  32. package/collection.json +11 -0
  33. package/esm2015/api-fetch-client.js +571 -0
  34. package/esm2015/fetch-plugin.js +4 -0
  35. package/esm2015/plugins/abort/abort.fetch.js +74 -0
  36. package/esm2015/plugins/abort/abort.spec.js +200 -0
  37. package/esm2015/plugins/abort/index.js +1 -0
  38. package/esm2015/plugins/concurrent/concurrent.fetch.js +255 -0
  39. package/esm2015/plugins/concurrent/concurrent.spec.js +235 -0
  40. package/esm2015/plugins/concurrent/index.js +1 -0
  41. package/esm2015/plugins/index.js +8 -0
  42. package/esm2015/plugins/keepalive/index.js +1 -0
  43. package/esm2015/plugins/keepalive/keepalive.request.js +281 -0
  44. package/esm2015/plugins/keepalive/keepalive.spec.js +158 -0
  45. package/esm2015/plugins/mock-intercept/index.js +2 -0
  46. package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +283 -0
  47. package/esm2015/plugins/mock-intercept/mock-intercept.interface.js +1 -0
  48. package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +441 -0
  49. package/esm2015/plugins/perf-metric/index.js +1 -0
  50. package/esm2015/plugins/perf-metric/perf-metric.fetch.js +363 -0
  51. package/esm2015/plugins/perf-metric/perf-metric.probe.spec.js +56 -0
  52. package/esm2015/plugins/retry/index.js +1 -0
  53. package/esm2015/plugins/retry/retry.fetch.js +363 -0
  54. package/esm2015/plugins/retry/retry.spec.js +344 -0
  55. package/esm2015/plugins/timeout/index.js +1 -0
  56. package/esm2015/plugins/timeout/timeout.fetch.js +310 -0
  57. package/esm2015/plugins/timeout/timeout.spec.js +439 -0
  58. package/esm2015/plugins/wait-for/index.js +1 -0
  59. package/esm2015/plugins/wait-for/wait-for.fetch.js +379 -0
  60. package/esm2015/plugins/wait-for/wait-for.spec.js +379 -0
  61. package/esm2015/public_api.js +3 -0
  62. package/package.json +196 -0
  63. package/schematics/ng-add/index.d.ts +8 -0
  64. package/schematics/ng-add/index.d.ts.map +1 -0
  65. package/schematics/ng-add/index.js +67 -0
  66. package/schematics/ng-add/migration/import-map.d.ts +6 -0
  67. package/schematics/ng-add/migration/import-map.d.ts.map +1 -0
  68. package/schematics/ng-add/migration/import-map.js +39 -0
  69. package/schematics/ng-add/schema.d.ts +6 -0
  70. package/schematics/ng-add/schema.d.ts.map +1 -0
  71. package/schematics/ng-add/schema.js +3 -0
  72. package/schematics/ng-add/schema.json +18 -0
  73. package/schematics/package.json +3 -0
  74. package/src/api-fetch-client.d.ts +46 -0
  75. package/src/api-fetch-client.d.ts.map +1 -0
  76. package/src/api-fetch-client.js +126 -0
  77. package/src/api-fetch-client.js.map +1 -0
  78. package/src/fetch-plugin.d.ts +38 -0
  79. package/src/fetch-plugin.d.ts.map +1 -0
  80. package/src/fetch-plugin.js +2 -0
  81. package/src/fetch-plugin.js.map +1 -0
  82. package/src/plugins/abort/abort.fetch.d.ts +66 -0
  83. package/src/plugins/abort/abort.fetch.d.ts.map +1 -0
  84. package/src/plugins/abort/abort.fetch.js +32 -0
  85. package/src/plugins/abort/abort.fetch.js.map +1 -0
  86. package/src/plugins/abort/index.d.ts +2 -0
  87. package/src/plugins/abort/index.d.ts.map +1 -0
  88. package/src/plugins/abort/index.js +2 -0
  89. package/src/plugins/abort/index.js.map +1 -0
  90. package/src/plugins/concurrent/concurrent.fetch.d.ts +33 -0
  91. package/src/plugins/concurrent/concurrent.fetch.d.ts.map +1 -0
  92. package/src/plugins/concurrent/concurrent.fetch.js +57 -0
  93. package/src/plugins/concurrent/concurrent.fetch.js.map +1 -0
  94. package/src/plugins/concurrent/index.d.ts +2 -0
  95. package/src/plugins/concurrent/index.d.ts.map +1 -0
  96. package/src/plugins/concurrent/index.js +2 -0
  97. package/src/plugins/concurrent/index.js.map +1 -0
  98. package/src/plugins/index.d.ts +9 -0
  99. package/src/plugins/index.d.ts.map +1 -0
  100. package/src/plugins/index.js +9 -0
  101. package/src/plugins/index.js.map +1 -0
  102. package/src/plugins/keepalive/index.d.ts +2 -0
  103. package/src/plugins/keepalive/index.d.ts.map +1 -0
  104. package/src/plugins/keepalive/index.js +2 -0
  105. package/src/plugins/keepalive/index.js.map +1 -0
  106. package/src/plugins/keepalive/keepalive.request.d.ts +18 -0
  107. package/src/plugins/keepalive/keepalive.request.d.ts.map +1 -0
  108. package/src/plugins/keepalive/keepalive.request.js +39 -0
  109. package/src/plugins/keepalive/keepalive.request.js.map +1 -0
  110. package/src/plugins/mock-intercept/index.d.ts +3 -0
  111. package/src/plugins/mock-intercept/index.d.ts.map +1 -0
  112. package/src/plugins/mock-intercept/index.js +3 -0
  113. package/src/plugins/mock-intercept/index.js.map +1 -0
  114. package/src/plugins/mock-intercept/mock-intercept.fetch.d.ts +15 -0
  115. package/src/plugins/mock-intercept/mock-intercept.fetch.d.ts.map +1 -0
  116. package/src/plugins/mock-intercept/mock-intercept.fetch.js +47 -0
  117. package/src/plugins/mock-intercept/mock-intercept.fetch.js.map +1 -0
  118. package/src/plugins/mock-intercept/mock-intercept.interface.d.ts +10 -0
  119. package/src/plugins/mock-intercept/mock-intercept.interface.d.ts.map +1 -0
  120. package/src/plugins/mock-intercept/mock-intercept.interface.js +2 -0
  121. package/src/plugins/mock-intercept/mock-intercept.interface.js.map +1 -0
  122. package/src/plugins/perf-metric/index.d.ts +2 -0
  123. package/src/plugins/perf-metric/index.d.ts.map +1 -0
  124. package/src/plugins/perf-metric/index.js +2 -0
  125. package/src/plugins/perf-metric/index.js.map +1 -0
  126. package/src/plugins/perf-metric/perf-metric.fetch.d.ts +133 -0
  127. package/src/plugins/perf-metric/perf-metric.fetch.d.ts.map +1 -0
  128. package/src/plugins/perf-metric/perf-metric.fetch.js +111 -0
  129. package/src/plugins/perf-metric/perf-metric.fetch.js.map +1 -0
  130. package/src/plugins/retry/index.d.ts +2 -0
  131. package/src/plugins/retry/index.d.ts.map +1 -0
  132. package/src/plugins/retry/index.js +2 -0
  133. package/src/plugins/retry/index.js.map +1 -0
  134. package/src/plugins/retry/retry.fetch.d.ts +53 -0
  135. package/src/plugins/retry/retry.fetch.d.ts.map +1 -0
  136. package/src/plugins/retry/retry.fetch.js +66 -0
  137. package/src/plugins/retry/retry.fetch.js.map +1 -0
  138. package/src/plugins/timeout/index.d.ts +2 -0
  139. package/src/plugins/timeout/index.d.ts.map +1 -0
  140. package/src/plugins/timeout/index.js +2 -0
  141. package/src/plugins/timeout/index.js.map +1 -0
  142. package/src/plugins/timeout/timeout.fetch.d.ts +47 -0
  143. package/src/plugins/timeout/timeout.fetch.d.ts.map +1 -0
  144. package/src/plugins/timeout/timeout.fetch.js +105 -0
  145. package/src/plugins/timeout/timeout.fetch.js.map +1 -0
  146. package/src/plugins/wait-for/index.d.ts +2 -0
  147. package/src/plugins/wait-for/index.d.ts.map +1 -0
  148. package/src/plugins/wait-for/index.js +2 -0
  149. package/src/plugins/wait-for/index.js.map +1 -0
  150. package/src/plugins/wait-for/wait-for.fetch.d.ts +78 -0
  151. package/src/plugins/wait-for/wait-for.fetch.d.ts.map +1 -0
  152. package/src/plugins/wait-for/wait-for.fetch.js +104 -0
  153. package/src/plugins/wait-for/wait-for.fetch.js.map +1 -0
  154. package/src/public_api.d.ts +4 -0
  155. package/src/public_api.d.ts.map +1 -0
  156. package/src/public_api.js +4 -0
  157. package/src/public_api.js.map +1 -0
@@ -0,0 +1,445 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ var _core = require("@ama-sdk/core");
6
+ var _mockinterceptfetch = require("./mock-intercept.fetch");
7
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
8
+ try {
9
+ var info = gen[key](arg);
10
+ var value = info.value;
11
+ } catch (error) {
12
+ reject(error);
13
+ return;
14
+ }
15
+ if (info.done) {
16
+ resolve(value);
17
+ } else {
18
+ Promise.resolve(value).then(_next, _throw);
19
+ }
20
+ }
21
+ function _async_to_generator(fn) {
22
+ return function() {
23
+ var self = this, args = arguments;
24
+ return new Promise(function(resolve, reject) {
25
+ var gen = fn.apply(self, args);
26
+ function _next(value) {
27
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
28
+ }
29
+ function _throw(err) {
30
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
31
+ }
32
+ _next(undefined);
33
+ });
34
+ };
35
+ }
36
+ function _define_property(obj, key, value) {
37
+ if (key in obj) {
38
+ Object.defineProperty(obj, key, {
39
+ value: value,
40
+ enumerable: true,
41
+ configurable: true,
42
+ writable: true
43
+ });
44
+ } else {
45
+ obj[key] = value;
46
+ }
47
+ return obj;
48
+ }
49
+ function _ts_generator(thisArg, body) {
50
+ var f, y, t, g, _ = {
51
+ label: 0,
52
+ sent: function() {
53
+ if (t[0] & 1) throw t[1];
54
+ return t[1];
55
+ },
56
+ trys: [],
57
+ ops: []
58
+ };
59
+ return g = {
60
+ next: verb(0),
61
+ "throw": verb(1),
62
+ "return": verb(2)
63
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
64
+ return this;
65
+ }), g;
66
+ function verb(n) {
67
+ return function(v) {
68
+ return step([
69
+ n,
70
+ v
71
+ ]);
72
+ };
73
+ }
74
+ function step(op) {
75
+ if (f) throw new TypeError("Generator is already executing.");
76
+ while(_)try {
77
+ 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;
78
+ if (y = 0, t) op = [
79
+ op[0] & 2,
80
+ t.value
81
+ ];
82
+ switch(op[0]){
83
+ case 0:
84
+ case 1:
85
+ t = op;
86
+ break;
87
+ case 4:
88
+ _.label++;
89
+ return {
90
+ value: op[1],
91
+ done: false
92
+ };
93
+ case 5:
94
+ _.label++;
95
+ y = op[1];
96
+ op = [
97
+ 0
98
+ ];
99
+ continue;
100
+ case 7:
101
+ op = _.ops.pop();
102
+ _.trys.pop();
103
+ continue;
104
+ default:
105
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
106
+ _ = 0;
107
+ continue;
108
+ }
109
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
110
+ _.label = op[1];
111
+ break;
112
+ }
113
+ if (op[0] === 6 && _.label < t[1]) {
114
+ _.label = t[1];
115
+ t = op;
116
+ break;
117
+ }
118
+ if (t && _.label < t[2]) {
119
+ _.label = t[2];
120
+ _.ops.push(op);
121
+ break;
122
+ }
123
+ if (t[2]) _.ops.pop();
124
+ _.trys.pop();
125
+ continue;
126
+ }
127
+ op = body.call(thisArg, _);
128
+ } catch (e) {
129
+ op = [
130
+ 6,
131
+ e
132
+ ];
133
+ y = 0;
134
+ } finally{
135
+ f = t = 0;
136
+ }
137
+ if (op[0] & 5) throw op[1];
138
+ return {
139
+ value: op[0] ? op[1] : void 0,
140
+ done: true
141
+ };
142
+ }
143
+ }
144
+ var testMock = {
145
+ mockData: {}
146
+ };
147
+ var getMockSpy = jest.fn().mockReturnValue(testMock);
148
+ var getLatestMockSpy = jest.fn().mockReturnValue(testMock);
149
+ var retrieveOperationIdSpy = jest.fn().mockReturnValue(Promise.resolve('testOperation'));
150
+ var initializeSpy = jest.fn().mockReturnValue(Promise.resolve());
151
+ var testMockAdapter = {
152
+ getMock: getMockSpy,
153
+ getLatestMock: getLatestMockSpy,
154
+ initialize: initializeSpy,
155
+ retrieveOperationId: retrieveOperationIdSpy
156
+ };
157
+ var requestPlugins = [
158
+ new _core.MockInterceptRequest({
159
+ adapter: new _core.SequentialMockAdapter([], {})
160
+ })
161
+ ];
162
+ var apiClient = {
163
+ options: {
164
+ requestPlugins: requestPlugins,
165
+ basePath: 'test',
166
+ replyPlugins: []
167
+ }
168
+ };
169
+ describe('Mock intercept', function() {
170
+ beforeEach(function() {
171
+ return jest.clearAllMocks();
172
+ });
173
+ describe('request plugin', function() {
174
+ it('should do nothing if disabled is true', /*#__PURE__*/ _async_to_generator(function() {
175
+ var plugin, originalRequest, loaded;
176
+ return _ts_generator(this, function(_state) {
177
+ switch(_state.label){
178
+ case 0:
179
+ plugin = new _core.MockInterceptRequest({
180
+ disabled: true,
181
+ adapter: testMockAdapter
182
+ });
183
+ originalRequest = {
184
+ method: 'get',
185
+ headers: new Headers({
186
+ test: 'true'
187
+ }),
188
+ basePath: 'myurl'
189
+ };
190
+ loaded = plugin.load();
191
+ return [
192
+ 4,
193
+ loaded.transform(originalRequest)
194
+ ];
195
+ case 1:
196
+ expect.apply(void 0, [
197
+ _state.sent()
198
+ ]).toEqual(originalRequest);
199
+ expect(initializeSpy).toHaveBeenCalled();
200
+ return [
201
+ 2
202
+ ];
203
+ }
204
+ });
205
+ }));
206
+ it('should not stringify provided api', /*#__PURE__*/ _async_to_generator(function() {
207
+ var plugin, loaded, originalRequest;
208
+ return _ts_generator(this, function(_state) {
209
+ switch(_state.label){
210
+ case 0:
211
+ plugin = new _core.MockInterceptRequest({
212
+ disabled: false,
213
+ adapter: testMockAdapter
214
+ });
215
+ loaded = plugin.load();
216
+ originalRequest = {
217
+ method: 'get',
218
+ headers: new Headers({
219
+ test: 'true'
220
+ }),
221
+ basePath: 'myurl',
222
+ api: 'should not exist'
223
+ };
224
+ return [
225
+ 4,
226
+ loaded.transform(originalRequest)
227
+ ];
228
+ case 1:
229
+ _state.sent();
230
+ expect(originalRequest.headers.has(_core.CUSTOM_MOCK_REQUEST_HEADER)).toBe(true);
231
+ expect(Object.keys(JSON.parse(originalRequest.headers.get(_core.CUSTOM_MOCK_REQUEST_HEADER)))).not.toContainEqual('api');
232
+ return [
233
+ 2
234
+ ];
235
+ }
236
+ });
237
+ }));
238
+ it('should intercept the request', /*#__PURE__*/ _async_to_generator(function() {
239
+ var plugin, originalRequest, loaded, transformed, res;
240
+ return _ts_generator(this, function(_state) {
241
+ switch(_state.label){
242
+ case 0:
243
+ // Disabled because Blob URL is not supported on NodeJS
244
+ plugin = new _core.MockInterceptRequest({
245
+ adapter: testMockAdapter
246
+ });
247
+ originalRequest = {
248
+ headers: new Headers({
249
+ test: 'true'
250
+ }),
251
+ basePath: 'myurl',
252
+ method: 'PATCH'
253
+ };
254
+ loaded = plugin.load();
255
+ return [
256
+ 4,
257
+ loaded.transform(originalRequest)
258
+ ];
259
+ case 1:
260
+ transformed = _state.sent();
261
+ return [
262
+ 4,
263
+ fetch(transformed.basePath, transformed)
264
+ ];
265
+ case 2:
266
+ return [
267
+ 4,
268
+ _state.sent().text()
269
+ ];
270
+ case 3:
271
+ res = _state.sent();
272
+ expect(getMockSpy).toHaveBeenCalled();
273
+ expect(res).toBe(JSON.stringify(testMock.mockData));
274
+ expect(initializeSpy).toHaveBeenCalled();
275
+ return [
276
+ 2
277
+ ];
278
+ }
279
+ });
280
+ }));
281
+ });
282
+ describe('fetch plugin', function() {
283
+ describe('when using an initialization function', function() {
284
+ var plugin;
285
+ var asyncMockAdapter;
286
+ beforeEach(function() {
287
+ asyncMockAdapter = {
288
+ initialize: initializeSpy,
289
+ getMock: getMockSpy,
290
+ getLatestMock: getLatestMockSpy,
291
+ retrieveOperationId: retrieveOperationIdSpy
292
+ };
293
+ plugin = new _mockinterceptfetch.MockInterceptFetch({
294
+ adapter: asyncMockAdapter
295
+ });
296
+ });
297
+ it('should call initialize fn', /*#__PURE__*/ _async_to_generator(function() {
298
+ var loadedPlugin, testData;
299
+ return _ts_generator(this, function(_state) {
300
+ switch(_state.label){
301
+ case 0:
302
+ loadedPlugin = plugin.load({
303
+ controller: jest.fn(),
304
+ fetchPlugins: [],
305
+ url: 'myurl',
306
+ apiClient: apiClient,
307
+ options: {
308
+ headers: new Headers(_define_property({}, _core.CUSTOM_MOCK_OPERATION_ID_HEADER, 'testOperation'))
309
+ }
310
+ });
311
+ testData = {
312
+ test: true
313
+ };
314
+ return [
315
+ 4,
316
+ loadedPlugin.transform(Promise.resolve(testData))
317
+ ];
318
+ case 1:
319
+ _state.sent();
320
+ expect(initializeSpy).toHaveBeenCalled();
321
+ expect(getMockSpy).not.toHaveBeenCalled();
322
+ expect(getLatestMockSpy).toHaveBeenCalledWith('testOperation');
323
+ return [
324
+ 2
325
+ ];
326
+ }
327
+ });
328
+ }));
329
+ it('should throw if there is no request plugin', function() {
330
+ var config = {
331
+ controller: jest.fn(),
332
+ fetchPlugins: [],
333
+ url: 'myurl',
334
+ apiClient: {
335
+ options: {
336
+ requestPlugins: []
337
+ }
338
+ },
339
+ options: {
340
+ headers: new Headers(_define_property({}, _core.CUSTOM_MOCK_OPERATION_ID_HEADER, 'testOperation'))
341
+ }
342
+ };
343
+ expect(function() {
344
+ return plugin.load(config);
345
+ }).toThrow();
346
+ });
347
+ });
348
+ });
349
+ describe('with delay', function() {
350
+ it('should delay the response of the specific number', /*#__PURE__*/ _async_to_generator(function() {
351
+ var plugin, loadedPlugin, callback, run;
352
+ return _ts_generator(this, function(_state) {
353
+ switch(_state.label){
354
+ case 0:
355
+ plugin = new _mockinterceptfetch.MockInterceptFetch({
356
+ adapter: testMockAdapter,
357
+ delayTiming: 700
358
+ });
359
+ loadedPlugin = plugin.load({
360
+ controller: jest.fn(),
361
+ fetchPlugins: [],
362
+ url: '',
363
+ apiClient: apiClient,
364
+ options: {
365
+ headers: new Headers(_define_property({}, _core.CUSTOM_MOCK_OPERATION_ID_HEADER, 'testOperation'))
366
+ }
367
+ });
368
+ callback = jest.fn();
369
+ run = loadedPlugin.transform(Promise.resolve({})).then(callback);
370
+ return [
371
+ 4,
372
+ jest.advanceTimersByTimeAsync(699)
373
+ ];
374
+ case 1:
375
+ _state.sent();
376
+ expect(callback).not.toHaveBeenCalled();
377
+ return [
378
+ 4,
379
+ jest.advanceTimersByTimeAsync(1)
380
+ ];
381
+ case 2:
382
+ _state.sent();
383
+ expect(callback).toHaveBeenCalled();
384
+ return [
385
+ 4,
386
+ run
387
+ ];
388
+ case 3:
389
+ _state.sent();
390
+ return [
391
+ 2
392
+ ];
393
+ }
394
+ });
395
+ }));
396
+ it('should delay the response based on callback', /*#__PURE__*/ _async_to_generator(function() {
397
+ var plugin, loadedPlugin, callback, run;
398
+ return _ts_generator(this, function(_state) {
399
+ switch(_state.label){
400
+ case 0:
401
+ plugin = new _mockinterceptfetch.MockInterceptFetch({
402
+ adapter: testMockAdapter,
403
+ delayTiming: function() {
404
+ return 800;
405
+ }
406
+ });
407
+ loadedPlugin = plugin.load({
408
+ controller: jest.fn(),
409
+ fetchPlugins: [],
410
+ url: '',
411
+ apiClient: apiClient,
412
+ options: {
413
+ headers: new Headers(_define_property({}, _core.CUSTOM_MOCK_OPERATION_ID_HEADER, 'testOperation'))
414
+ }
415
+ });
416
+ callback = jest.fn();
417
+ run = loadedPlugin.transform(Promise.resolve({})).then(callback);
418
+ return [
419
+ 4,
420
+ jest.advanceTimersByTimeAsync(799)
421
+ ];
422
+ case 1:
423
+ _state.sent();
424
+ expect(callback).not.toHaveBeenCalled();
425
+ return [
426
+ 4,
427
+ jest.advanceTimersByTimeAsync(1)
428
+ ];
429
+ case 2:
430
+ _state.sent();
431
+ expect(callback).toHaveBeenCalled();
432
+ return [
433
+ 4,
434
+ run
435
+ ];
436
+ case 3:
437
+ _state.sent();
438
+ return [
439
+ 2
440
+ ];
441
+ }
442
+ });
443
+ }));
444
+ });
445
+ });
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./perf-metric.fetch"), exports);
6
+ function _export_star(from, to) {
7
+ Object.keys(from).forEach(function(k) {
8
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
+ Object.defineProperty(to, k, {
10
+ enumerable: true,
11
+ get: function() {
12
+ return from[k];
13
+ }
14
+ });
15
+ }
16
+ });
17
+ return from;
18
+ }