@shopgate/pwa-core 7.30.0-alpha.7 → 7.30.0-alpha.8

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 (85) hide show
  1. package/classes/AppCommand/index.js +115 -11
  2. package/classes/AppCommand/spec.js +260 -6
  3. package/classes/AppCommandRequest/index.js +129 -20
  4. package/classes/AppPermissionsRequest/AppPermissionsRequest.js +45 -7
  5. package/classes/AppPermissionsRequest/GetAppPermissionsRequest.js +48 -9
  6. package/classes/AppPermissionsRequest/RequestAppPermissionsRequest.js +54 -9
  7. package/classes/Bridge/index.js +34 -4
  8. package/classes/Bridge/spec.js +24 -1
  9. package/classes/BrightnessRequest/index.js +59 -10
  10. package/classes/BrightnessRequest/spec.js +111 -6
  11. package/classes/BrowserConnector/index.js +180 -26
  12. package/classes/Conditioner/index.js +74 -8
  13. package/classes/Conditioner/spec.js +75 -1
  14. package/classes/DataRequest/index.js +116 -13
  15. package/classes/DevServerBridge/index.js +86 -9
  16. package/classes/DevServerBridge/spec.js +231 -14
  17. package/classes/ErrorManager/index.js +144 -20
  18. package/classes/ErrorManager/spec.js +244 -2
  19. package/classes/Event/index.js +101 -15
  20. package/classes/HttpRequest/index.js +182 -21
  21. package/classes/PipelineDependencies/index.js +42 -6
  22. package/classes/PipelineDependencies/spec.js +46 -3
  23. package/classes/PipelineManager/index.js +517 -71
  24. package/classes/PipelineManager/spec.js +733 -15
  25. package/classes/PipelineRequest/index.js +167 -19
  26. package/classes/PipelineRequest/mock.js +118 -21
  27. package/classes/PipelineRequest/spec.js +333 -2
  28. package/classes/PipelineSequence/index.js +34 -6
  29. package/classes/Request/index.js +61 -13
  30. package/classes/RequestBuffer/index.js +43 -6
  31. package/classes/RequestManager/index.js +216 -33
  32. package/classes/RequestManager/spec.js +188 -1
  33. package/classes/Scanner/index.js +246 -67
  34. package/classes/ScannerEvent/index.js +23 -9
  35. package/classes/ScannerEventHandler/index.js +39 -16
  36. package/classes/ScannerEventListener/index.js +84 -24
  37. package/classes/ScannerManager/ScanProcessingError.js +11 -3
  38. package/classes/ScannerManager/index.js +133 -21
  39. package/classes/WebStorageRequest/index.js +76 -9
  40. package/commands/analyticsSetCustomValues.js +8 -2
  41. package/commands/appPermissions.js +10 -3
  42. package/commands/brightness.js +33 -5
  43. package/commands/broadcastEvent.js +8 -2
  44. package/commands/cleanTab.js +11 -3
  45. package/commands/closeInAppBrowser.js +22 -2
  46. package/commands/flushTab.js +8 -2
  47. package/commands/getWebStorageEntry.js +11 -2
  48. package/commands/hideMenuBar.js +8 -2
  49. package/commands/hideNavigationBar.js +8 -2
  50. package/commands/hideSplashScreen.js +8 -2
  51. package/commands/onload.js +13 -3
  52. package/commands/openAppSettings.js +8 -2
  53. package/commands/openPage.js +8 -2
  54. package/commands/openPageExtern.js +8 -2
  55. package/commands/performCommandsAfterDelay.js +11 -3
  56. package/commands/plotProjects.js +65 -7
  57. package/commands/popTabToRoot.js +11 -3
  58. package/commands/registerEvents.js +10 -2
  59. package/commands/scanner.js +76 -7
  60. package/commands/setCookie.js +8 -2
  61. package/commands/setDebugLoggingEnabled.js +8 -2
  62. package/commands/setScrollingEnabled.js +7 -2
  63. package/commands/setWebStorageEntry.js +8 -2
  64. package/commands/shareItem.js +18 -2
  65. package/commands/showNavigationBar.js +8 -2
  66. package/commands/showTab.js +13 -2
  67. package/commands/unifiedTracking.js +128 -30
  68. package/constants/AppCommands.js +6 -1
  69. package/constants/AppEvents.js +9 -1
  70. package/constants/AppPermissions.js +57 -13
  71. package/constants/Command.js +1 -1
  72. package/constants/ErrorHandleTypes.js +2 -1
  73. package/constants/ErrorManager.js +15 -1
  74. package/constants/Pipeline.js +52 -17
  75. package/constants/ProcessTypes.js +3 -1
  76. package/constants/RequestManagerModes.js +19 -7
  77. package/constants/RequestTypes.js +2 -1
  78. package/constants/Scanner.js +39 -10
  79. package/constants/Trilean.js +6 -1
  80. package/emitters/ui.js +2 -1
  81. package/helpers/index.js +66 -8
  82. package/helpers/logGroup.js +56 -8
  83. package/helpers/version.js +216 -22
  84. package/index.js +60 -5
  85. package/package.json +1 -1
@@ -1,2 +1,333 @@
1
- import PipelineRequest,{DEFAULT_VERSION,DEFAULT_RETRIES,DEFAULT_MAX_RETRIES,DEFAULT_INPUT,DEFAULT_TIMEOUT,DEFAULT_MAX_TIMEOUT,DEFAULT_PROCESSED,DEFAULT_HANDLE_ERROR}from'.';import*as processTypes from"../../constants/ProcessTypes";import*as errorHandleTypes from"../../constants/ErrorHandleTypes";var request;var mockedWarn=jest.fn();jest.mock("../../helpers",function(){return{logger:{warn:function warn(){return mockedWarn.apply(void 0,arguments);}}};});describe('PipelineRequest',function(){beforeEach(function(){request=new PipelineRequest('testPipeline');jest.clearAllMocks();});it('should throw if no pipeline name is set',function(done){try{// eslint-disable-next-line no-new
2
- new PipelineRequest();done('Did not throw');}catch(e){done();}});it('should be instanciatable',function(){expect(request instanceof PipelineRequest).toBe(true);});it('has a default version',function(){expect(request.version).toEqual(DEFAULT_VERSION);});it('has a default input',function(){expect(request.input).toEqual(DEFAULT_INPUT);});it('has trusted set to false by default',function(){expect(request.trusted).toEqual(false);});it('has a default retries',function(){expect(request.retries).toEqual(DEFAULT_RETRIES);});it('has a default timeout',function(){expect(request.timeout).toEqual(DEFAULT_TIMEOUT);});it('has a default process handling',function(){expect(request.process).toEqual(DEFAULT_PROCESSED);});it('has a default error handling',function(){expect(request.handleErrors).toEqual(DEFAULT_HANDLE_ERROR);});describe('setVersion()',function(){it('should throw if input is not a number',function(done){try{request.setVersion('a string');done('Did not throw');}catch(e){done();}});it('should throw if it is a negative number',function(done){try{request.setVersion(-1);done('Did not throw');}catch(e){done();}});it('should throw if the value is 0',function(done){try{request.setVersion(0);done('Did not throw');}catch(e){done();}});it('should set to default if no parameter supplied',function(){request.setVersion();expect(request.version).toEqual(DEFAULT_VERSION);});it('should set the new timeout',function(){request.setVersion(2);expect(request.version).toEqual(2);});it('should return a class instance',function(){var value=request.setVersion(2);expect(value instanceof PipelineRequest).toEqual(true);});});describe('setInput()',function(){it('should throw if input is a string',function(done){try{request.setInput('some input');done('Did not throw');}catch(e){done();}});it('should throw if input is a number',function(done){try{request.setInput(123);done('Did not throw');}catch(e){done();}});it('should throw if input is an array',function(done){try{request.setInput(['some value']);done('Did not throw');}catch(e){done();}});it('should set to default if no parameter supplied',function(){request.setInput();expect(request.input).toEqual(DEFAULT_INPUT);});it('should set the new input',function(){var input={someKey:'someValue'};request.setInput(input);expect(request.input).toEqual(input);});it('should return a class instance',function(){var value=request.setInput();expect(value instanceof PipelineRequest).toEqual(true);});});describe('setTrusted()',function(){it('is false by default',function(){expect(request.trusted).toEqual(false);});it('should set it to true',function(){request.setTrusted();expect(request.trusted).toEqual(true);});});describe('setRetries()',function(){it('should throw if input it not a number',function(done){try{request.setRetries('a string');done('Did not throw');}catch(e){done();}});it('should throw if its a negative number',function(done){try{request.setRetries(-1);done('Did not throw');}catch(e){done();}});it('should throw if the value is above max',function(done){try{request.setRetries(DEFAULT_MAX_RETRIES+1);done('Did not throw');}catch(e){done();}});it('should set to default if no parameter supplied',function(){request.setRetries();expect(request.retries).toEqual(DEFAULT_RETRIES);});it('should set the new retries amount',function(){request.setRetries(3);expect(request.retries).toEqual(3);});it('should return a class instance',function(){var value=request.setRetries(2);expect(value instanceof PipelineRequest).toEqual(true);});});describe('setTimeout()',function(){it('should throw if input it not a number',function(done){try{request.setTimeout('a string');done('Did not throw');}catch(e){done();}});it('should throw if its a negative number',function(done){try{request.setTimeout(-1);done('Did not throw');}catch(e){done();}});it('should throw if the value is above max',function(done){try{request.setTimeout(DEFAULT_MAX_TIMEOUT+1000);done('Did not throw');}catch(e){done();}});it('should set to default if no parameter supplied',function(){request.setTimeout();expect(request.timeout).toEqual(DEFAULT_TIMEOUT);});it('should set the new timeout',function(){request.setTimeout(2000);expect(request.timeout).toEqual(2000);});it('should return a class instance',function(){var value=request.setTimeout(2);expect(value instanceof PipelineRequest).toEqual(true);});});describe('setResponseProcessed()',function(){it('should throw if input is a number',function(done){try{request.setResponseProcessed(123);done('Did not throw');}catch(e){done();}});it('should throw if input is an array',function(done){try{request.setResponseProcessed(['some value']);done('Did not throw');}catch(e){done();}});it('should throw if input is an object',function(done){try{request.setResponseProcessed({someKey:'someValue'});done('Did not throw');}catch(e){done();}});it('should throw if input not one of the possible values',function(done){try{request.setResponseProcessed('SOME_WEIRD_THING');done('Did not throw');}catch(e){done();}});it('should set to default if no parameter supplied',function(){request.setResponseProcessed();expect(request.process).toEqual(DEFAULT_PROCESSED);});it('should set the new process',function(){request.setResponseProcessed(processTypes.PROCESS_LAST);expect(request.process).toEqual(processTypes.PROCESS_LAST);});it('should return a class instance',function(){var value=request.setResponseProcessed();expect(value instanceof PipelineRequest).toEqual(true);});});describe('setHandleErrors()',function(){it('should throw if input is a number',function(done){try{request.setHandleErrors(123);done('Did not throw');}catch(e){done();}});it('should throw if input is an array',function(done){try{request.setHandleErrors(['some value']);done('Did not throw');}catch(e){done();}});it('should throw if input is an object',function(done){try{request.setHandleErrors({someKey:'someValue'});done('Did not throw');}catch(e){done();}});it('should throw if input not one of the possible values',function(done){try{request.setHandleErrors('SOME_WEIRD_THING');done('Did not throw');}catch(e){done();}});it('should set to default if no parameter supplied',function(){request.setHandleErrors();expect(request.handleErrors).toEqual(DEFAULT_HANDLE_ERROR);});it('should set the new process',function(){request.setHandleErrors(errorHandleTypes.ERROR_HANDLE_SUPPRESS);expect(request.handleErrors).toEqual(errorHandleTypes.ERROR_HANDLE_SUPPRESS);});it('should return a class instance',function(){var value=request.setHandleErrors();expect(value instanceof PipelineRequest).toEqual(true);});});describe('setHandleErrors()',function(){it('should set a blacklist of error codes to be not handled',function(){var codes=['ETEST1','ETEST2'];request.setErrorBlacklist(codes);expect(request.errorBlacklist).toEqual(codes);});});describe('deprecation',function(){it('setSuppressErrors',function(){request.setSuppressErrors(true);expect(request.handleErrors).toEqual(errorHandleTypes.ERROR_HANDLE_SUPPRESS);request.setSuppressErrors(false);expect(request.handleErrors).toEqual(DEFAULT_HANDLE_ERROR);expect(mockedWarn).toHaveBeenCalledTimes(2);expect(mockedWarn).toHaveBeenCalledWith('Deprecated: setSuppressErrors() will be removed. Use setHandleErrors() instead!');});it('setHandledErrors',function(){var codes=['ETEST'];request.setHandledErrors(codes);expect(request.errorBlacklist).toEqual(codes);expect(mockedWarn).toHaveBeenCalledTimes(1);expect(mockedWarn).toHaveBeenCalledWith('Deprecated: setHandledErrors() will be removed in favor of setErrorBlacklist()!');});});});
1
+ import PipelineRequest, { DEFAULT_VERSION, DEFAULT_RETRIES, DEFAULT_MAX_RETRIES, DEFAULT_INPUT, DEFAULT_TIMEOUT, DEFAULT_MAX_TIMEOUT, DEFAULT_PROCESSED, DEFAULT_HANDLE_ERROR } from '.';
2
+ import * as processTypes from "../../constants/ProcessTypes";
3
+ import * as errorHandleTypes from "../../constants/ErrorHandleTypes";
4
+ let request;
5
+ const mockedWarn = jest.fn();
6
+ jest.mock("../../helpers", () => ({
7
+ logger: {
8
+ warn: (...args) => mockedWarn(...args)
9
+ }
10
+ }));
11
+ describe('PipelineRequest', () => {
12
+ beforeEach(() => {
13
+ request = new PipelineRequest('testPipeline');
14
+ jest.clearAllMocks();
15
+ });
16
+ it('should throw if no pipeline name is set', done => {
17
+ try {
18
+ // eslint-disable-next-line no-new
19
+ new PipelineRequest();
20
+ done('Did not throw');
21
+ } catch (e) {
22
+ done();
23
+ }
24
+ });
25
+ it('should be instanciatable', () => {
26
+ expect(request instanceof PipelineRequest).toBe(true);
27
+ });
28
+ it('has a default version', () => {
29
+ expect(request.version).toEqual(DEFAULT_VERSION);
30
+ });
31
+ it('has a default input', () => {
32
+ expect(request.input).toEqual(DEFAULT_INPUT);
33
+ });
34
+ it('has trusted set to false by default', () => {
35
+ expect(request.trusted).toEqual(false);
36
+ });
37
+ it('has a default retries', () => {
38
+ expect(request.retries).toEqual(DEFAULT_RETRIES);
39
+ });
40
+ it('has a default timeout', () => {
41
+ expect(request.timeout).toEqual(DEFAULT_TIMEOUT);
42
+ });
43
+ it('has a default process handling', () => {
44
+ expect(request.process).toEqual(DEFAULT_PROCESSED);
45
+ });
46
+ it('has a default error handling', () => {
47
+ expect(request.handleErrors).toEqual(DEFAULT_HANDLE_ERROR);
48
+ });
49
+ describe('setVersion()', () => {
50
+ it('should throw if input is not a number', done => {
51
+ try {
52
+ request.setVersion('a string');
53
+ done('Did not throw');
54
+ } catch (e) {
55
+ done();
56
+ }
57
+ });
58
+ it('should throw if it is a negative number', done => {
59
+ try {
60
+ request.setVersion(-1);
61
+ done('Did not throw');
62
+ } catch (e) {
63
+ done();
64
+ }
65
+ });
66
+ it('should throw if the value is 0', done => {
67
+ try {
68
+ request.setVersion(0);
69
+ done('Did not throw');
70
+ } catch (e) {
71
+ done();
72
+ }
73
+ });
74
+ it('should set to default if no parameter supplied', () => {
75
+ request.setVersion();
76
+ expect(request.version).toEqual(DEFAULT_VERSION);
77
+ });
78
+ it('should set the new timeout', () => {
79
+ request.setVersion(2);
80
+ expect(request.version).toEqual(2);
81
+ });
82
+ it('should return a class instance', () => {
83
+ const value = request.setVersion(2);
84
+ expect(value instanceof PipelineRequest).toEqual(true);
85
+ });
86
+ });
87
+ describe('setInput()', () => {
88
+ it('should throw if input is a string', done => {
89
+ try {
90
+ request.setInput('some input');
91
+ done('Did not throw');
92
+ } catch (e) {
93
+ done();
94
+ }
95
+ });
96
+ it('should throw if input is a number', done => {
97
+ try {
98
+ request.setInput(123);
99
+ done('Did not throw');
100
+ } catch (e) {
101
+ done();
102
+ }
103
+ });
104
+ it('should throw if input is an array', done => {
105
+ try {
106
+ request.setInput(['some value']);
107
+ done('Did not throw');
108
+ } catch (e) {
109
+ done();
110
+ }
111
+ });
112
+ it('should set to default if no parameter supplied', () => {
113
+ request.setInput();
114
+ expect(request.input).toEqual(DEFAULT_INPUT);
115
+ });
116
+ it('should set the new input', () => {
117
+ const input = {
118
+ someKey: 'someValue'
119
+ };
120
+ request.setInput(input);
121
+ expect(request.input).toEqual(input);
122
+ });
123
+ it('should return a class instance', () => {
124
+ const value = request.setInput();
125
+ expect(value instanceof PipelineRequest).toEqual(true);
126
+ });
127
+ });
128
+ describe('setTrusted()', () => {
129
+ it('is false by default', () => {
130
+ expect(request.trusted).toEqual(false);
131
+ });
132
+ it('should set it to true', () => {
133
+ request.setTrusted();
134
+ expect(request.trusted).toEqual(true);
135
+ });
136
+ });
137
+ describe('setRetries()', () => {
138
+ it('should throw if input it not a number', done => {
139
+ try {
140
+ request.setRetries('a string');
141
+ done('Did not throw');
142
+ } catch (e) {
143
+ done();
144
+ }
145
+ });
146
+ it('should throw if its a negative number', done => {
147
+ try {
148
+ request.setRetries(-1);
149
+ done('Did not throw');
150
+ } catch (e) {
151
+ done();
152
+ }
153
+ });
154
+ it('should throw if the value is above max', done => {
155
+ try {
156
+ request.setRetries(DEFAULT_MAX_RETRIES + 1);
157
+ done('Did not throw');
158
+ } catch (e) {
159
+ done();
160
+ }
161
+ });
162
+ it('should set to default if no parameter supplied', () => {
163
+ request.setRetries();
164
+ expect(request.retries).toEqual(DEFAULT_RETRIES);
165
+ });
166
+ it('should set the new retries amount', () => {
167
+ request.setRetries(3);
168
+ expect(request.retries).toEqual(3);
169
+ });
170
+ it('should return a class instance', () => {
171
+ const value = request.setRetries(2);
172
+ expect(value instanceof PipelineRequest).toEqual(true);
173
+ });
174
+ });
175
+ describe('setTimeout()', () => {
176
+ it('should throw if input it not a number', done => {
177
+ try {
178
+ request.setTimeout('a string');
179
+ done('Did not throw');
180
+ } catch (e) {
181
+ done();
182
+ }
183
+ });
184
+ it('should throw if its a negative number', done => {
185
+ try {
186
+ request.setTimeout(-1);
187
+ done('Did not throw');
188
+ } catch (e) {
189
+ done();
190
+ }
191
+ });
192
+ it('should throw if the value is above max', done => {
193
+ try {
194
+ request.setTimeout(DEFAULT_MAX_TIMEOUT + 1000);
195
+ done('Did not throw');
196
+ } catch (e) {
197
+ done();
198
+ }
199
+ });
200
+ it('should set to default if no parameter supplied', () => {
201
+ request.setTimeout();
202
+ expect(request.timeout).toEqual(DEFAULT_TIMEOUT);
203
+ });
204
+ it('should set the new timeout', () => {
205
+ request.setTimeout(2000);
206
+ expect(request.timeout).toEqual(2000);
207
+ });
208
+ it('should return a class instance', () => {
209
+ const value = request.setTimeout(2);
210
+ expect(value instanceof PipelineRequest).toEqual(true);
211
+ });
212
+ });
213
+ describe('setResponseProcessed()', () => {
214
+ it('should throw if input is a number', done => {
215
+ try {
216
+ request.setResponseProcessed(123);
217
+ done('Did not throw');
218
+ } catch (e) {
219
+ done();
220
+ }
221
+ });
222
+ it('should throw if input is an array', done => {
223
+ try {
224
+ request.setResponseProcessed(['some value']);
225
+ done('Did not throw');
226
+ } catch (e) {
227
+ done();
228
+ }
229
+ });
230
+ it('should throw if input is an object', done => {
231
+ try {
232
+ request.setResponseProcessed({
233
+ someKey: 'someValue'
234
+ });
235
+ done('Did not throw');
236
+ } catch (e) {
237
+ done();
238
+ }
239
+ });
240
+ it('should throw if input not one of the possible values', done => {
241
+ try {
242
+ request.setResponseProcessed('SOME_WEIRD_THING');
243
+ done('Did not throw');
244
+ } catch (e) {
245
+ done();
246
+ }
247
+ });
248
+ it('should set to default if no parameter supplied', () => {
249
+ request.setResponseProcessed();
250
+ expect(request.process).toEqual(DEFAULT_PROCESSED);
251
+ });
252
+ it('should set the new process', () => {
253
+ request.setResponseProcessed(processTypes.PROCESS_LAST);
254
+ expect(request.process).toEqual(processTypes.PROCESS_LAST);
255
+ });
256
+ it('should return a class instance', () => {
257
+ const value = request.setResponseProcessed();
258
+ expect(value instanceof PipelineRequest).toEqual(true);
259
+ });
260
+ });
261
+ describe('setHandleErrors()', () => {
262
+ it('should throw if input is a number', done => {
263
+ try {
264
+ request.setHandleErrors(123);
265
+ done('Did not throw');
266
+ } catch (e) {
267
+ done();
268
+ }
269
+ });
270
+ it('should throw if input is an array', done => {
271
+ try {
272
+ request.setHandleErrors(['some value']);
273
+ done('Did not throw');
274
+ } catch (e) {
275
+ done();
276
+ }
277
+ });
278
+ it('should throw if input is an object', done => {
279
+ try {
280
+ request.setHandleErrors({
281
+ someKey: 'someValue'
282
+ });
283
+ done('Did not throw');
284
+ } catch (e) {
285
+ done();
286
+ }
287
+ });
288
+ it('should throw if input not one of the possible values', done => {
289
+ try {
290
+ request.setHandleErrors('SOME_WEIRD_THING');
291
+ done('Did not throw');
292
+ } catch (e) {
293
+ done();
294
+ }
295
+ });
296
+ it('should set to default if no parameter supplied', () => {
297
+ request.setHandleErrors();
298
+ expect(request.handleErrors).toEqual(DEFAULT_HANDLE_ERROR);
299
+ });
300
+ it('should set the new process', () => {
301
+ request.setHandleErrors(errorHandleTypes.ERROR_HANDLE_SUPPRESS);
302
+ expect(request.handleErrors).toEqual(errorHandleTypes.ERROR_HANDLE_SUPPRESS);
303
+ });
304
+ it('should return a class instance', () => {
305
+ const value = request.setHandleErrors();
306
+ expect(value instanceof PipelineRequest).toEqual(true);
307
+ });
308
+ });
309
+ describe('setHandleErrors()', () => {
310
+ it('should set a blacklist of error codes to be not handled', () => {
311
+ const codes = ['ETEST1', 'ETEST2'];
312
+ request.setErrorBlacklist(codes);
313
+ expect(request.errorBlacklist).toEqual(codes);
314
+ });
315
+ });
316
+ describe('deprecation', () => {
317
+ it('setSuppressErrors', () => {
318
+ request.setSuppressErrors(true);
319
+ expect(request.handleErrors).toEqual(errorHandleTypes.ERROR_HANDLE_SUPPRESS);
320
+ request.setSuppressErrors(false);
321
+ expect(request.handleErrors).toEqual(DEFAULT_HANDLE_ERROR);
322
+ expect(mockedWarn).toHaveBeenCalledTimes(2);
323
+ expect(mockedWarn).toHaveBeenCalledWith('Deprecated: setSuppressErrors() will be removed. Use setHandleErrors() instead!');
324
+ });
325
+ it('setHandledErrors', () => {
326
+ const codes = ['ETEST'];
327
+ request.setHandledErrors(codes);
328
+ expect(request.errorBlacklist).toEqual(codes);
329
+ expect(mockedWarn).toHaveBeenCalledTimes(1);
330
+ expect(mockedWarn).toHaveBeenCalledWith('Deprecated: setHandledErrors() will be removed in favor of setErrorBlacklist()!');
331
+ });
332
+ });
333
+ });
@@ -1,14 +1,42 @@
1
- function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}/**
1
+ /**
2
2
  * A sequence of pipeline requests.
3
- */var PipelineSequence=/*#__PURE__*/function(){/**
3
+ */
4
+ class PipelineSequence {
5
+ /**
4
6
  * Constructor.
5
- */function PipelineSequence(){_classCallCheck(this,PipelineSequence);this.sequence=[];}/**
7
+ */
8
+ constructor() {
9
+ this.sequence = [];
10
+ }
11
+
12
+ /**
6
13
  * Adds a new serial to the sequence.
7
14
  * @param {string} serial The pipeline request serial.
8
- */return _createClass(PipelineSequence,[{key:"set",value:function set(serial){var index=this.sequence.indexOf(serial);if(index<0){this.sequence.push(serial);}}/**
15
+ */
16
+ set(serial) {
17
+ const index = this.sequence.indexOf(serial);
18
+ if (index < 0) {
19
+ this.sequence.push(serial);
20
+ }
21
+ }
22
+
23
+ /**
9
24
  * Returns the sequence.
10
25
  * @return {Array}
11
- */},{key:"get",value:function get(){return this.sequence;}/**
26
+ */
27
+ get() {
28
+ return this.sequence;
29
+ }
30
+
31
+ /**
12
32
  * Removes a serial from the sequence.
13
33
  * @param {string} serial The pipeline request serial.
14
- */},{key:"remove",value:function remove(serial){var index=this.sequence.indexOf(serial);if(index>=0){this.sequence.splice(index,1);}}}]);}();export default new PipelineSequence();
34
+ */
35
+ remove(serial) {
36
+ const index = this.sequence.indexOf(serial);
37
+ if (index >= 0) {
38
+ this.sequence.splice(index, 1);
39
+ }
40
+ }
41
+ }
42
+ export default new PipelineSequence();
@@ -1,26 +1,74 @@
1
- function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import CryptoJs from'crypto-js';import RequestManager from"../RequestManager";import{logger}from"../../helpers";// The default request manager does not cache or treat requests in any special way.
2
- var defaultRequestManager=new RequestManager();/**
1
+ import CryptoJs from 'crypto-js';
2
+ import RequestManager from "../RequestManager";
3
+ import { logger } from "../../helpers";
4
+
5
+ // The default request manager does not cache or treat requests in any special way.
6
+ const defaultRequestManager = new RequestManager();
7
+
8
+ /**
3
9
  * The request class.
4
- */var Request=/*#__PURE__*/function(){/**
10
+ */
11
+ class Request {
12
+ /**
5
13
  * The constructor.
6
14
  * @param {RequestManager} [manager] The manager for this request.
7
- */function Request(manager){var _this=this;_classCallCheck(this,Request);/**
8
- * Creates the event callback name from the data request serial.
9
- * @param {string} callbackKey The callback key to use.
10
- */_defineProperty(this,"createEventCallbackName",function(callbackKey){_this.callbackName="".concat(callbackKey,":").concat(_this.serial);});this.serial=null;this.callbackName='';this.manager=manager||defaultRequestManager;}/**
15
+ */
16
+ constructor(manager) {
17
+ /**
18
+ * Creates the event callback name from the data request serial.
19
+ * @param {string} callbackKey The callback key to use.
20
+ */
21
+ this.createEventCallbackName = callbackKey => {
22
+ this.callbackName = `${callbackKey}:${this.serial}`;
23
+ };
24
+ this.serial = null;
25
+ this.callbackName = '';
26
+ this.manager = manager || defaultRequestManager;
27
+ }
28
+
29
+ /**
11
30
  * @return {boolean} Whether there are pending requests of this type.
12
- */return _createClass(Request,[{key:"hasPendingRequests",value:function hasPendingRequests(){return this.manager.pendingRequests>0;}/**
31
+ */
32
+ hasPendingRequests() {
33
+ return this.manager.pendingRequests > 0;
34
+ }
35
+
36
+ /**
13
37
  * Generates the serial for this data request.
14
38
  * @param {string} serialKey The serial key.
15
- */},{key:"createSerial",value:function createSerial(serialKey){if(!this.serial){this.serial=CryptoJs.MD5("".concat(serialKey).concat(Date.now()+Math.random())).toString();}}},{key:"getEventCallbackName",value:/**
39
+ */
40
+ createSerial(serialKey) {
41
+ if (!this.serial) {
42
+ this.serial = CryptoJs.MD5(`${serialKey}${Date.now() + Math.random()}`).toString();
43
+ }
44
+ }
45
+ /**
16
46
  * Returns the event callback name.
17
47
  * @returns {string}
18
- */function getEventCallbackName(){return this.callbackName;}/**
48
+ */
49
+ getEventCallbackName() {
50
+ return this.callbackName;
51
+ }
52
+
53
+ /**
19
54
  * Dispatches the request.
20
55
  * @return {Promise} A promise that is fulfilled when a response is received for this request.
21
- */},{key:"dispatch",value:function dispatch(){var _this2=this;return new Promise(function(resolve,reject){_this2.manager.handleDispatch(_this2,resolve,reject);});}/**
56
+ */
57
+ dispatch() {
58
+ return new Promise((resolve, reject) => {
59
+ this.manager.handleDispatch(this, resolve, reject);
60
+ });
61
+ }
62
+
63
+ /**
22
64
  * On timeout log error. Can be overridden by child classes.
23
65
  * @param {Function} resolve The resolve() callback of the request promise.
24
66
  * @param {Function} reject The reject() callback of the request promise.
25
- */},{key:"onTimeout",value:function onTimeout(resolve,reject){// eslint-disable-line class-methods-use-this
26
- logger.error('Request timeout');reject('Request timeout');}}]);}();export default Request;
67
+ */
68
+ onTimeout(resolve, reject) {
69
+ // eslint-disable-line class-methods-use-this
70
+ logger.error('Request timeout');
71
+ reject('Request timeout');
72
+ }
73
+ }
74
+ export default Request;
@@ -1,16 +1,53 @@
1
- function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import{logger}from"../../helpers";var REQUEST_BUFFER='RequestBuffer';/**
1
+ import { logger } from "../../helpers";
2
+ const REQUEST_BUFFER = 'RequestBuffer';
3
+
4
+ /**
2
5
  * The RequestBuffer class.
3
6
  * It stores instances of performing request.
4
- */var RequestBuffer=/*#__PURE__*/function(){function RequestBuffer(){_classCallCheck(this,RequestBuffer);// Holds the ongoing requests.
5
- _defineProperty(this,"requests",{});}return _createClass(RequestBuffer,[{key:"add",value:/**
7
+ */
8
+ class RequestBuffer {
9
+ constructor() {
10
+ // Holds the ongoing requests.
11
+ this.requests = {};
12
+ }
13
+ /**
6
14
  * Adds a new data request to the buffer store.
7
15
  * @param {Object} req The request to store.
8
16
  * @param {string} serial The serial for the request.
9
- */function add(req,serial){var request=this.requests[serial];if(request){logger.error("".concat(REQUEST_BUFFER,": a request with the serial '").concat(serial,"' already exists!"));return;}this.requests[serial]=req;}/**
17
+ */
18
+ add(req, serial) {
19
+ const request = this.requests[serial];
20
+ if (request) {
21
+ logger.error(`${REQUEST_BUFFER}: a request with the serial '${serial}' already exists!`);
22
+ return;
23
+ }
24
+ this.requests[serial] = req;
25
+ }
26
+
27
+ /**
10
28
  * Retrieves a data request from the buffer.
11
29
  * @param {string} serial The serial for the request.
12
30
  * @returns {DataRequest}
13
- */},{key:"get",value:function get(serial){var request=this.requests[serial];if(!request){logger.error("".concat(REQUEST_BUFFER,": no stored request for the serial '").concat(serial,"' found!"));return null;}return request;}/**
31
+ */
32
+ get(serial) {
33
+ const request = this.requests[serial];
34
+ if (!request) {
35
+ logger.error(`${REQUEST_BUFFER}: no stored request for the serial '${serial}' found!`);
36
+ return null;
37
+ }
38
+ return request;
39
+ }
40
+
41
+ /**
14
42
  * Removes the data request from the buffer.
15
43
  * @param {string} serial The serial for the request.
16
- */},{key:"remove",value:function remove(serial){try{delete this.requests[serial];}catch(e){logger.error(e);}}}]);}();export default new RequestBuffer();
44
+ */
45
+ remove(serial) {
46
+ try {
47
+ delete this.requests[serial];
48
+ } catch (e) {
49
+ logger.error(e);
50
+ }
51
+ }
52
+ }
53
+ export default new RequestBuffer();