@webex/common 2.59.1 → 2.59.3-next.1

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 (80) hide show
  1. package/.eslintrc.js +6 -6
  2. package/README.md +42 -42
  3. package/babel.config.js +3 -3
  4. package/dist/base64.js +22 -22
  5. package/dist/base64.js.map +1 -1
  6. package/dist/browser-detection.js.map +1 -1
  7. package/dist/capped-debounce.js +12 -12
  8. package/dist/capped-debounce.js.map +1 -1
  9. package/dist/check-required.js +8 -8
  10. package/dist/check-required.js.map +1 -1
  11. package/dist/constants.js.map +1 -1
  12. package/dist/defer.js +13 -13
  13. package/dist/defer.js.map +1 -1
  14. package/dist/deprecated.js +5 -5
  15. package/dist/deprecated.js.map +1 -1
  16. package/dist/event-envelope.js +11 -11
  17. package/dist/event-envelope.js.map +1 -1
  18. package/dist/events.js +15 -15
  19. package/dist/events.js.map +1 -1
  20. package/dist/exception.js +13 -13
  21. package/dist/exception.js.map +1 -1
  22. package/dist/in-browser/browser.js +2 -2
  23. package/dist/in-browser/browser.js.map +1 -1
  24. package/dist/in-browser/index.js.map +1 -1
  25. package/dist/in-browser/node.js +2 -2
  26. package/dist/in-browser/node.js.map +1 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/isBuffer.js +6 -6
  29. package/dist/isBuffer.js.map +1 -1
  30. package/dist/make-state-datatype.js +14 -14
  31. package/dist/make-state-datatype.js.map +1 -1
  32. package/dist/one-flight.js +13 -13
  33. package/dist/one-flight.js.map +1 -1
  34. package/dist/patterns.js +30 -30
  35. package/dist/patterns.js.map +1 -1
  36. package/dist/resolve-with.js +19 -19
  37. package/dist/resolve-with.js.map +1 -1
  38. package/dist/retry.js +17 -17
  39. package/dist/retry.js.map +1 -1
  40. package/dist/tap.js +14 -14
  41. package/dist/tap.js.map +1 -1
  42. package/dist/template-container.js +51 -51
  43. package/dist/template-container.js.map +1 -1
  44. package/dist/uuid-utils.js +76 -76
  45. package/dist/uuid-utils.js.map +1 -1
  46. package/dist/while-in-flight.js +5 -5
  47. package/dist/while-in-flight.js.map +1 -1
  48. package/jest.config.js +3 -3
  49. package/package.json +12 -11
  50. package/process +1 -1
  51. package/src/base64.js +67 -67
  52. package/src/browser-detection.js +37 -37
  53. package/src/capped-debounce.js +65 -65
  54. package/src/check-required.js +18 -18
  55. package/src/constants.js +79 -79
  56. package/src/defer.js +24 -24
  57. package/src/deprecated.js +19 -19
  58. package/src/event-envelope.js +54 -54
  59. package/src/events.js +55 -55
  60. package/src/exception.js +45 -45
  61. package/src/in-browser/browser.js +5 -5
  62. package/src/in-browser/index.js +11 -11
  63. package/src/in-browser/node.js +5 -5
  64. package/src/index.js +44 -44
  65. package/src/isBuffer.js +12 -12
  66. package/src/make-state-datatype.js +91 -91
  67. package/src/one-flight.js +89 -89
  68. package/src/patterns.js +51 -51
  69. package/src/resolve-with.js +27 -27
  70. package/src/retry.js +124 -124
  71. package/src/tap.js +25 -25
  72. package/src/template-container.js +222 -222
  73. package/src/uuid-utils.js +189 -189
  74. package/src/while-in-flight.js +38 -38
  75. package/test/unit/spec/capped-debounce.js +103 -103
  76. package/test/unit/spec/common.js +42 -42
  77. package/test/unit/spec/exception.js +102 -102
  78. package/test/unit/spec/one-flight.js +211 -211
  79. package/test/unit/spec/template-container.js +81 -81
  80. package/test/unit/spec/while-in-flight.js +70 -70
@@ -1,70 +1,70 @@
1
- /*!
2
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
- */
4
-
5
- import {Defer, whileInFlight} from '@webex/common';
6
- import AmpState from 'ampersand-state';
7
- import {assert} from '@webex/test-helper-chai';
8
-
9
- describe('common', () => {
10
- describe('@whileInFlight()', () => {
11
- const State = AmpState.extend({
12
- session: {
13
- isSucceeding: {
14
- default: false,
15
- type: 'boolean',
16
- },
17
- isFailing: {
18
- default: false,
19
- type: 'boolean',
20
- },
21
- success: {
22
- default() {
23
- return new Defer();
24
- },
25
- type: 'any',
26
- },
27
- failure: {
28
- default() {
29
- return new Defer();
30
- },
31
- type: 'any',
32
- },
33
- },
34
-
35
- @whileInFlight('isSucceeding')
36
- willSucceed() {
37
- return this.success.promise;
38
- },
39
-
40
- @whileInFlight('isFailing')
41
- willFail() {
42
- return this.failure.promise;
43
- },
44
- });
45
-
46
- it('sets the specified param to true while the decorated function is in flight', () => {
47
- const s = new State();
48
-
49
- assert.isFalse(s.isSucceeding);
50
- const ps = s.willSucceed();
51
-
52
- assert.isTrue(s.isSucceeding);
53
- s.success.resolve();
54
-
55
- return ps.then(() => assert.isFalse(s.isSucceeding));
56
- });
57
-
58
- it('sets the specified param back to false even when the decorated function fails', () => {
59
- const s = new State();
60
-
61
- assert.isFalse(s.isFailing);
62
- const ps = s.willFail();
63
-
64
- assert.isTrue(s.isFailing);
65
- s.failure.reject(new Error('fail'));
66
-
67
- return assert.isRejected(ps).then(() => assert.isFalse(s.isFailing));
68
- });
69
- });
70
- });
1
+ /*!
2
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+
5
+ import {Defer, whileInFlight} from '@webex/common';
6
+ import AmpState from 'ampersand-state';
7
+ import {assert} from '@webex/test-helper-chai';
8
+
9
+ describe('common', () => {
10
+ describe('@whileInFlight()', () => {
11
+ const State = AmpState.extend({
12
+ session: {
13
+ isSucceeding: {
14
+ default: false,
15
+ type: 'boolean',
16
+ },
17
+ isFailing: {
18
+ default: false,
19
+ type: 'boolean',
20
+ },
21
+ success: {
22
+ default() {
23
+ return new Defer();
24
+ },
25
+ type: 'any',
26
+ },
27
+ failure: {
28
+ default() {
29
+ return new Defer();
30
+ },
31
+ type: 'any',
32
+ },
33
+ },
34
+
35
+ @whileInFlight('isSucceeding')
36
+ willSucceed() {
37
+ return this.success.promise;
38
+ },
39
+
40
+ @whileInFlight('isFailing')
41
+ willFail() {
42
+ return this.failure.promise;
43
+ },
44
+ });
45
+
46
+ it('sets the specified param to true while the decorated function is in flight', () => {
47
+ const s = new State();
48
+
49
+ assert.isFalse(s.isSucceeding);
50
+ const ps = s.willSucceed();
51
+
52
+ assert.isTrue(s.isSucceeding);
53
+ s.success.resolve();
54
+
55
+ return ps.then(() => assert.isFalse(s.isSucceeding));
56
+ });
57
+
58
+ it('sets the specified param back to false even when the decorated function fails', () => {
59
+ const s = new State();
60
+
61
+ assert.isFalse(s.isFailing);
62
+ const ps = s.willFail();
63
+
64
+ assert.isTrue(s.isFailing);
65
+ s.failure.reject(new Error('fail'));
66
+
67
+ return assert.isRejected(ps).then(() => assert.isFalse(s.isFailing));
68
+ });
69
+ });
70
+ });