@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.
Files changed (111) hide show
  1. package/cjs/clients/api-angular-client.js +13 -18
  2. package/cjs/clients/api-fetch-client.js +16 -21
  3. package/cjs/fwk/api.helpers.js +11 -11
  4. package/cjs/fwk/date.js +5 -5
  5. package/cjs/fwk/errors.js +7 -7
  6. package/cjs/fwk/mocks/alf-mock-adapter.js +58 -60
  7. package/cjs/fwk/mocks/base-mock-adapter.js +15 -19
  8. package/cjs/fwk/mocks/helpers.js +3 -3
  9. package/cjs/fwk/param-serialization.js +6 -6
  10. package/cjs/fwk/reviver.js +4 -4
  11. package/cjs/plugins/abort/abort.spec.js +83 -81
  12. package/cjs/plugins/additional-params/additional-params.request.js +18 -25
  13. package/cjs/plugins/additional-params/additional-params.spec.js +194 -186
  14. package/cjs/plugins/api-configuration-override/api-configuration-override.request.js +10 -17
  15. package/cjs/plugins/api-configuration-override/api-configuration-override.spec.js +83 -81
  16. package/cjs/plugins/api-key/api-key.request.js +12 -19
  17. package/cjs/plugins/api-key/api-key.spec.js +50 -50
  18. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +25 -36
  19. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +343 -327
  20. package/cjs/plugins/client-facts/client-facts.request.js +18 -25
  21. package/cjs/plugins/client-facts/client-facts.spec.js +218 -208
  22. package/cjs/plugins/concurrent/concurrent.fetch.js +12 -20
  23. package/cjs/plugins/concurrent/concurrent.spec.js +99 -99
  24. package/cjs/plugins/custom-info/custom-info.spec.js +90 -90
  25. package/cjs/plugins/fetch-cache/fetch-cache.spec.js +100 -98
  26. package/cjs/plugins/fetch-credentials/fetch-credentials.spec.js +60 -60
  27. package/cjs/plugins/json-token/json-token.spec.js +109 -107
  28. package/cjs/plugins/keepalive/keepalive.request.js +7 -12
  29. package/cjs/plugins/keepalive/keepalive.spec.js +32 -34
  30. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.helpers.js +11 -23
  31. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +18 -28
  32. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +212 -204
  33. package/cjs/plugins/mock-intercept/mock-intercept.angular.js +94 -100
  34. package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +15 -22
  35. package/cjs/plugins/mock-intercept/mock-intercept.interface.js +3 -3
  36. package/cjs/plugins/mock-intercept/mock-intercept.request.js +12 -19
  37. package/cjs/plugins/mock-intercept/mock-intercept.spec.js +245 -237
  38. package/cjs/plugins/perf-metric/perf-metric.fetch.js +11 -18
  39. package/cjs/plugins/pii-tokenizer/pii-tokenizer.request.js +19 -27
  40. package/cjs/plugins/pii-tokenizer/pii-tokenizer.spec.js +404 -386
  41. package/cjs/plugins/raw-response-info/raw-response-info.spec.js +67 -67
  42. package/cjs/plugins/retry/retry.fetch.js +18 -27
  43. package/cjs/plugins/retry/retry.spec.js +233 -225
  44. package/cjs/plugins/reviver/reviver.spec.js +88 -86
  45. package/cjs/plugins/session-id/session-id.spec.js +98 -94
  46. package/cjs/plugins/si-token/si-token.spec.js +27 -29
  47. package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +17 -24
  48. package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +199 -191
  49. package/cjs/plugins/timeout/timeout.fetch.js +16 -22
  50. package/cjs/plugins/timeout/timeout.spec.js +211 -205
  51. package/cjs/plugins/url-rewrite/url-rewrite.request.js +9 -16
  52. package/cjs/plugins/url-rewrite/url-rewrite.spec.js +48 -48
  53. package/cjs/plugins/wait-for/wait-for.fetch.js +19 -29
  54. package/cjs/plugins/wait-for/wait-for.spec.js +211 -203
  55. package/cjs/utils/crypto.js +15 -27
  56. package/cjs/utils/generic-api.js +9 -14
  57. package/cjs/utils/json-token.js +19 -26
  58. package/cjs/utils/json-token.spec.js +495 -497
  59. package/cjs/utils/mime-types.js +3 -3
  60. package/esm2015/clients/api-angular-client.js +13 -18
  61. package/esm2015/clients/api-fetch-client.js +16 -21
  62. package/esm2015/fwk/mocks/alf-mock-adapter.js +58 -60
  63. package/esm2015/fwk/mocks/base-mock-adapter.js +15 -19
  64. package/esm2015/plugins/abort/abort.spec.js +83 -81
  65. package/esm2015/plugins/additional-params/additional-params.request.js +15 -22
  66. package/esm2015/plugins/additional-params/additional-params.spec.js +194 -186
  67. package/esm2015/plugins/api-configuration-override/api-configuration-override.request.js +10 -17
  68. package/esm2015/plugins/api-configuration-override/api-configuration-override.spec.js +83 -81
  69. package/esm2015/plugins/api-key/api-key.request.js +12 -19
  70. package/esm2015/plugins/api-key/api-key.spec.js +50 -50
  71. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +21 -32
  72. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +343 -327
  73. package/esm2015/plugins/client-facts/client-facts.request.js +15 -22
  74. package/esm2015/plugins/client-facts/client-facts.spec.js +218 -208
  75. package/esm2015/plugins/concurrent/concurrent.fetch.js +12 -20
  76. package/esm2015/plugins/concurrent/concurrent.spec.js +99 -99
  77. package/esm2015/plugins/custom-info/custom-info.spec.js +90 -90
  78. package/esm2015/plugins/fetch-cache/fetch-cache.spec.js +100 -98
  79. package/esm2015/plugins/fetch-credentials/fetch-credentials.spec.js +60 -60
  80. package/esm2015/plugins/json-token/json-token.spec.js +109 -107
  81. package/esm2015/plugins/keepalive/keepalive.request.js +7 -12
  82. package/esm2015/plugins/keepalive/keepalive.spec.js +32 -34
  83. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.helpers.js +8 -20
  84. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +18 -28
  85. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +212 -204
  86. package/esm2015/plugins/mock-intercept/mock-intercept.angular.js +94 -100
  87. package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +15 -22
  88. package/esm2015/plugins/mock-intercept/mock-intercept.request.js +12 -19
  89. package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +245 -237
  90. package/esm2015/plugins/perf-metric/perf-metric.fetch.js +11 -18
  91. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +15 -23
  92. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.spec.js +404 -386
  93. package/esm2015/plugins/raw-response-info/raw-response-info.spec.js +67 -67
  94. package/esm2015/plugins/retry/retry.fetch.js +18 -27
  95. package/esm2015/plugins/retry/retry.spec.js +233 -225
  96. package/esm2015/plugins/reviver/reviver.spec.js +88 -86
  97. package/esm2015/plugins/session-id/session-id.spec.js +98 -94
  98. package/esm2015/plugins/si-token/si-token.spec.js +27 -29
  99. package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +17 -24
  100. package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +199 -191
  101. package/esm2015/plugins/timeout/timeout.fetch.js +13 -19
  102. package/esm2015/plugins/timeout/timeout.spec.js +211 -205
  103. package/esm2015/plugins/url-rewrite/url-rewrite.request.js +9 -16
  104. package/esm2015/plugins/url-rewrite/url-rewrite.spec.js +48 -48
  105. package/esm2015/plugins/wait-for/wait-for.fetch.js +19 -29
  106. package/esm2015/plugins/wait-for/wait-for.spec.js +211 -203
  107. package/esm2015/utils/crypto.js +8 -20
  108. package/esm2015/utils/generic-api.js +9 -14
  109. package/esm2015/utils/json-token.js +10 -17
  110. package/esm2015/utils/json-token.spec.js +495 -497
  111. package/package.json +6 -6
@@ -70,7 +70,7 @@ function _define_property(obj, key, value) {
70
70
  return obj;
71
71
  }
72
72
  function _ts_generator(thisArg, body) {
73
- var f, y, t, g, _ = {
73
+ var f, y, t, _ = {
74
74
  label: 0,
75
75
  sent: function() {
76
76
  if (t[0] & 1) throw t[1];
@@ -78,12 +78,8 @@ function _ts_generator(thisArg, body) {
78
78
  },
79
79
  trys: [],
80
80
  ops: []
81
- };
82
- return g = {
83
- next: verb(0),
84
- "throw": verb(1),
85
- "return": verb(2)
86
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
81
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
82
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
87
83
  return this;
88
84
  }), g;
89
85
  function verb(n) {
@@ -96,7 +92,7 @@ function _ts_generator(thisArg, body) {
96
92
  }
97
93
  function step(op) {
98
94
  if (f) throw new TypeError("Generator is already executing.");
99
- while(_)try {
95
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
100
96
  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;
101
97
  if (y = 0, t) op = [
102
98
  op[0] & 2,
@@ -199,20 +195,19 @@ var ConcurrentFetch = /*#__PURE__*/ function() {
199
195
  value: /** @inheritDoc */ function load(_context) {
200
196
  var _this = this;
201
197
  this.poolSize++;
202
- var _this1 = this;
203
198
  return {
204
199
  canStart: function() {
205
200
  return new Promise(function(resolve) {
206
201
  return _this.canStart() ? resolve(true) : _this.waitingResolvers.push(resolve);
207
202
  });
208
203
  },
209
- transform: /*#__PURE__*/ function() {
210
- var _ref = _async_to_generator(function(fetchCall) {
204
+ transform: function(fetchCall) {
205
+ return _async_to_generator(function() {
211
206
  var fetchResponse;
212
207
  return _ts_generator(this, function(_state) {
213
208
  switch(_state.label){
214
209
  case 0:
215
- _this1.pool.push(fetchCall);
210
+ this.pool.push(fetchCall);
216
211
  _state.label = 1;
217
212
  case 1:
218
213
  _state.trys.push([
@@ -232,11 +227,11 @@ var ConcurrentFetch = /*#__PURE__*/ function() {
232
227
  fetchResponse
233
228
  ];
234
229
  case 3:
235
- _this1.pool = _this1.pool.filter(function(call) {
230
+ this.pool = this.pool.filter(function(call) {
236
231
  return call !== fetchCall;
237
232
  });
238
- _this1.poolSize--;
239
- _this1.unstackResolve();
233
+ this.poolSize--;
234
+ this.unstackResolve();
240
235
  return [
241
236
  7
242
237
  ];
@@ -246,11 +241,8 @@ var ConcurrentFetch = /*#__PURE__*/ function() {
246
241
  ];
247
242
  }
248
243
  });
249
- });
250
- return function(fetchCall) {
251
- return _ref.apply(this, arguments);
252
- };
253
- }()
244
+ }).call(_this);
245
+ }
254
246
  };
255
247
  }
256
248
  }
@@ -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, g, _ = {
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,
@@ -128,27 +124,29 @@ function _ts_generator(thisArg, body) {
128
124
  }
129
125
  }
130
126
  describe('Concurrent Fetch Plugin', function() {
131
- it('should start if the limit is not reach', /*#__PURE__*/ _async_to_generator(function() {
132
- var plugin, runner, canStart;
133
- return _ts_generator(this, function(_state) {
134
- switch(_state.label){
135
- case 0:
136
- plugin = new _concurrentfetch.ConcurrentFetch(3);
137
- plugin.load({});
138
- runner = plugin.load({});
139
- return [
140
- 4,
141
- runner.canStart()
142
- ];
143
- case 1:
144
- canStart = _state.sent();
145
- expect(canStart).toBe(true);
146
- return [
147
- 2
148
- ];
149
- }
150
- });
151
- }));
127
+ it('should start if the limit is not reach', function() {
128
+ return _async_to_generator(function() {
129
+ var plugin, runner, canStart;
130
+ return _ts_generator(this, function(_state) {
131
+ switch(_state.label){
132
+ case 0:
133
+ plugin = new _concurrentfetch.ConcurrentFetch(3);
134
+ plugin.load({});
135
+ runner = plugin.load({});
136
+ return [
137
+ 4,
138
+ runner.canStart()
139
+ ];
140
+ case 1:
141
+ canStart = _state.sent();
142
+ expect(canStart).toBe(true);
143
+ return [
144
+ 2
145
+ ];
146
+ }
147
+ });
148
+ })();
149
+ });
152
150
  it('should retrieve the fetchcall in the pool', function() {
153
151
  var plugin = new _concurrentfetch.ConcurrentFetch(3);
154
152
  var call = new Promise(function(resolve) {
@@ -166,74 +164,76 @@ describe('Concurrent Fetch Plugin', function() {
166
164
  void plugin.load({}).transform(test);
167
165
  expect(plugin.pool[2]).toBe(test);
168
166
  });
169
- it('should start only when the pool is available', /*#__PURE__*/ _async_to_generator(function() {
170
- var plugin, resolves, call0, call1, result, runner1, canStart1, runner2, pCanStart2;
171
- return _ts_generator(this, function(_state) {
172
- switch(_state.label){
173
- case 0:
174
- plugin = new _concurrentfetch.ConcurrentFetch(2);
175
- resolves = [
176
- null,
177
- null
178
- ];
179
- call0 = new Promise(function(resolve) {
180
- return resolves[0] = resolve;
181
- });
182
- call1 = new Promise(function(resolve) {
183
- return resolves[1] = resolve;
184
- });
185
- result = {
186
- res: false
187
- };
188
- void plugin.load({}).transform(call0);
189
- runner1 = plugin.load({});
190
- canStart1 = runner1.canStart();
191
- return [
192
- 4,
193
- jest.runAllTimersAsync()
194
- ];
195
- case 1:
196
- _state.sent();
197
- return [
198
- 4,
199
- canStart1
200
- ];
201
- case 2:
202
- expect.apply(void 0, [
203
- _state.sent()
204
- ]).toBe(true);
205
- void runner1.transform(call1);
206
- runner2 = plugin.load({});
207
- pCanStart2 = runner2.canStart();
208
- return [
209
- 4,
210
- jest.runAllTimersAsync()
211
- ];
212
- case 3:
213
- _state.sent();
214
- expect(plugin.waitingResolvers.length).toBe(1);
215
- result.res = true;
216
- resolves[0]();
217
- return [
218
- 4,
219
- pCanStart2
220
- ];
221
- case 4:
222
- expect.apply(void 0, [
223
- _state.sent()
224
- ]).toBe(true);
225
- resolves[1]();
226
- return [
227
- 4,
228
- jest.advanceTimersByTimeAsync(500)
229
- ];
230
- case 5:
231
- _state.sent();
232
- expect(plugin.waitingResolvers.length).toBe(0);
233
- return [
234
- 2
235
- ];
236
- }
237
- });
238
- }));
167
+ it('should start only when the pool is available', function() {
168
+ return _async_to_generator(function() {
169
+ var plugin, resolves, call0, call1, result, runner1, canStart1, runner2, pCanStart2;
170
+ return _ts_generator(this, function(_state) {
171
+ switch(_state.label){
172
+ case 0:
173
+ plugin = new _concurrentfetch.ConcurrentFetch(2);
174
+ resolves = [
175
+ null,
176
+ null
177
+ ];
178
+ call0 = new Promise(function(resolve) {
179
+ return resolves[0] = resolve;
180
+ });
181
+ call1 = new Promise(function(resolve) {
182
+ return resolves[1] = resolve;
183
+ });
184
+ result = {
185
+ res: false
186
+ };
187
+ void plugin.load({}).transform(call0);
188
+ runner1 = plugin.load({});
189
+ canStart1 = runner1.canStart();
190
+ return [
191
+ 4,
192
+ jest.runAllTimersAsync()
193
+ ];
194
+ case 1:
195
+ _state.sent();
196
+ return [
197
+ 4,
198
+ canStart1
199
+ ];
200
+ case 2:
201
+ expect.apply(void 0, [
202
+ _state.sent()
203
+ ]).toBe(true);
204
+ void runner1.transform(call1);
205
+ runner2 = plugin.load({});
206
+ pCanStart2 = runner2.canStart();
207
+ return [
208
+ 4,
209
+ jest.runAllTimersAsync()
210
+ ];
211
+ case 3:
212
+ _state.sent();
213
+ expect(plugin.waitingResolvers.length).toBe(1);
214
+ result.res = true;
215
+ resolves[0]();
216
+ return [
217
+ 4,
218
+ pCanStart2
219
+ ];
220
+ case 4:
221
+ expect.apply(void 0, [
222
+ _state.sent()
223
+ ]).toBe(true);
224
+ resolves[1]();
225
+ return [
226
+ 4,
227
+ jest.advanceTimersByTimeAsync(500)
228
+ ];
229
+ case 5:
230
+ _state.sent();
231
+ expect(plugin.waitingResolvers.length).toBe(0);
232
+ return [
233
+ 2
234
+ ];
235
+ }
236
+ });
237
+ })();
238
+ });
239
239
  });
@@ -34,7 +34,7 @@ function _async_to_generator(fn) {
34
34
  };
35
35
  }
36
36
  function _ts_generator(thisArg, body) {
37
- var f, y, t, g, _ = {
37
+ var f, y, t, _ = {
38
38
  label: 0,
39
39
  sent: function() {
40
40
  if (t[0] & 1) throw t[1];
@@ -42,12 +42,8 @@ function _ts_generator(thisArg, body) {
42
42
  },
43
43
  trys: [],
44
44
  ops: []
45
- };
46
- return g = {
47
- next: verb(0),
48
- "throw": verb(1),
49
- "return": verb(2)
50
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
45
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
46
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
51
47
  return this;
52
48
  }), g;
53
49
  function verb(n) {
@@ -60,7 +56,7 @@ function _ts_generator(thisArg, body) {
60
56
  }
61
57
  function step(op) {
62
58
  if (f) throw new TypeError("Generator is already executing.");
63
- while(_)try {
59
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
64
60
  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;
65
61
  if (y = 0, t) op = [
66
62
  op[0] & 2,
@@ -129,88 +125,92 @@ function _ts_generator(thisArg, body) {
129
125
  }
130
126
  }
131
127
  describe('Custom info reply plugin', function() {
132
- it('should add the content of the custom information in the reply', /*#__PURE__*/ _async_to_generator(function() {
133
- var customInfo, plugin, runner, newData;
134
- return _ts_generator(this, function(_state) {
135
- switch(_state.label){
136
- case 0:
137
- customInfo = {
138
- key: 'value',
139
- nested: {
140
- field: 10
141
- }
142
- };
143
- plugin = new _custominforeply.CustomInfoReply(customInfo);
144
- runner = plugin.load({
145
- apiType: _api.ApiTypes.DEFAULT,
146
- response: {}
147
- });
148
- return [
149
- 4,
150
- runner.transform({})
151
- ];
152
- case 1:
153
- newData = _state.sent();
154
- expect(newData.customInfo).toEqual({
155
- key: 'value',
156
- nested: {
157
- field: 10
158
- }
159
- });
160
- return [
161
- 2
162
- ];
163
- }
164
- });
165
- }));
166
- it('should merge the contents of the two custom info', /*#__PURE__*/ _async_to_generator(function() {
167
- var customInfo1, plugin1, customInfo2, plugin2, runner1, runner2, newData, _;
168
- return _ts_generator(this, function(_state) {
169
- switch(_state.label){
170
- case 0:
171
- customInfo1 = {
172
- key0: 'dummy',
173
- key1: 'value'
174
- };
175
- plugin1 = new _custominforeply.CustomInfoReply(customInfo1);
176
- customInfo2 = {
177
- key1: 'override',
178
- key2: 42
179
- };
180
- plugin2 = new _custominforeply.CustomInfoReply(customInfo2);
181
- runner1 = plugin1.load({
182
- apiType: _api.ApiTypes.DEFAULT,
183
- response: {}
184
- });
185
- runner2 = plugin2.load({
186
- apiType: _api.ApiTypes.DEFAULT,
187
- response: {}
188
- });
189
- _ = runner2.transform;
190
- return [
191
- 4,
192
- runner1.transform({})
193
- ];
194
- case 1:
195
- return [
196
- 4,
197
- _.apply(runner2, [
198
- _state.sent()
199
- ])
200
- ];
201
- case 2:
202
- newData = _state.sent();
203
- expect(newData.customInfo).toEqual({
204
- key0: 'dummy',
205
- key1: 'override',
206
- key2: 42
207
- });
208
- return [
209
- 2
210
- ];
211
- }
212
- });
213
- }));
128
+ it('should add the content of the custom information in the reply', function() {
129
+ return _async_to_generator(function() {
130
+ var customInfo, plugin, runner, newData;
131
+ return _ts_generator(this, function(_state) {
132
+ switch(_state.label){
133
+ case 0:
134
+ customInfo = {
135
+ key: 'value',
136
+ nested: {
137
+ field: 10
138
+ }
139
+ };
140
+ plugin = new _custominforeply.CustomInfoReply(customInfo);
141
+ runner = plugin.load({
142
+ apiType: _api.ApiTypes.DEFAULT,
143
+ response: {}
144
+ });
145
+ return [
146
+ 4,
147
+ runner.transform({})
148
+ ];
149
+ case 1:
150
+ newData = _state.sent();
151
+ expect(newData.customInfo).toEqual({
152
+ key: 'value',
153
+ nested: {
154
+ field: 10
155
+ }
156
+ });
157
+ return [
158
+ 2
159
+ ];
160
+ }
161
+ });
162
+ })();
163
+ });
164
+ it('should merge the contents of the two custom info', function() {
165
+ return _async_to_generator(function() {
166
+ var customInfo1, plugin1, customInfo2, plugin2, runner1, runner2, newData, _;
167
+ return _ts_generator(this, function(_state) {
168
+ switch(_state.label){
169
+ case 0:
170
+ customInfo1 = {
171
+ key0: 'dummy',
172
+ key1: 'value'
173
+ };
174
+ plugin1 = new _custominforeply.CustomInfoReply(customInfo1);
175
+ customInfo2 = {
176
+ key1: 'override',
177
+ key2: 42
178
+ };
179
+ plugin2 = new _custominforeply.CustomInfoReply(customInfo2);
180
+ runner1 = plugin1.load({
181
+ apiType: _api.ApiTypes.DEFAULT,
182
+ response: {}
183
+ });
184
+ runner2 = plugin2.load({
185
+ apiType: _api.ApiTypes.DEFAULT,
186
+ response: {}
187
+ });
188
+ _ = runner2.transform;
189
+ return [
190
+ 4,
191
+ runner1.transform({})
192
+ ];
193
+ case 1:
194
+ return [
195
+ 4,
196
+ _.apply(runner2, [
197
+ _state.sent()
198
+ ])
199
+ ];
200
+ case 2:
201
+ newData = _state.sent();
202
+ expect(newData.customInfo).toEqual({
203
+ key0: 'dummy',
204
+ key1: 'override',
205
+ key2: 42
206
+ });
207
+ return [
208
+ 2
209
+ ];
210
+ }
211
+ });
212
+ })();
213
+ });
214
214
  it('should invalidate custom info', function() {
215
215
  var plugin = new _custominforeply.CustomInfoReply({});
216
216
  var data = {