@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
|
@@ -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,
|
|
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:
|
|
210
|
-
|
|
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
|
-
|
|
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
|
-
|
|
230
|
+
this.pool = this.pool.filter(function(call) {
|
|
236
231
|
return call !== fetchCall;
|
|
237
232
|
});
|
|
238
|
-
|
|
239
|
-
|
|
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
|
-
|
|
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,
|
|
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',
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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',
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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,
|
|
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',
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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 = {
|