@webex/common 3.0.0-beta.9 → 3.0.0-bnr.0
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/dist/base64.js +4 -18
- package/dist/base64.js.map +1 -1
- package/dist/browser-detection.js +0 -21
- package/dist/browser-detection.js.map +1 -1
- package/dist/capped-debounce.js +6 -16
- package/dist/capped-debounce.js.map +1 -1
- package/dist/check-required.js +0 -3
- package/dist/check-required.js.map +1 -1
- package/dist/constants.js +0 -2
- package/dist/constants.js.map +1 -1
- package/dist/defer.js +0 -7
- package/dist/defer.js.map +1 -1
- package/dist/deprecated.js +0 -5
- package/dist/deprecated.js.map +1 -1
- package/dist/event-envelope.js +16 -31
- package/dist/event-envelope.js.map +1 -1
- package/dist/events.js +3 -14
- package/dist/events.js.map +1 -1
- package/dist/exception.js +1 -28
- package/dist/exception.js.map +1 -1
- package/dist/in-browser/browser.js +0 -3
- package/dist/in-browser/browser.js.map +1 -1
- package/dist/in-browser/index.js +0 -4
- package/dist/in-browser/index.js.map +1 -1
- package/dist/in-browser/node.js +0 -3
- package/dist/in-browser/node.js.map +1 -1
- package/dist/index.js +1 -60
- package/dist/index.js.map +1 -1
- package/dist/isBuffer.js +0 -4
- package/dist/isBuffer.js.map +1 -1
- package/dist/make-state-datatype.js +4 -9
- package/dist/make-state-datatype.js.map +1 -1
- package/dist/one-flight.js +8 -30
- package/dist/one-flight.js.map +1 -1
- package/dist/patterns.js +0 -8
- package/dist/patterns.js.map +1 -1
- package/dist/resolve-with.js +0 -5
- package/dist/resolve-with.js.map +1 -1
- package/dist/retry.js +13 -39
- package/dist/retry.js.map +1 -1
- package/dist/tap.js +0 -5
- package/dist/tap.js.map +1 -1
- package/dist/template-container.js +10 -54
- package/dist/template-container.js.map +1 -1
- package/dist/types/base64.d.ts +38 -0
- package/dist/types/browser-detection.d.ts +8 -0
- package/dist/types/capped-debounce.d.ts +12 -0
- package/dist/types/check-required.d.ts +11 -0
- package/dist/types/constants.d.ts +76 -0
- package/dist/types/defer.d.ts +23 -0
- package/dist/types/deprecated.d.ts +7 -0
- package/dist/types/event-envelope.d.ts +13 -0
- package/dist/types/events.d.ts +15 -0
- package/dist/types/exception.d.ts +23 -0
- package/dist/types/in-browser/browser.d.ts +2 -0
- package/dist/types/in-browser/index.d.ts +1 -0
- package/dist/types/in-browser/node.d.ts +2 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/isBuffer.d.ts +2 -0
- package/dist/types/make-state-datatype.d.ts +11 -0
- package/dist/types/one-flight.d.ts +9 -0
- package/dist/types/patterns.d.ts +8 -0
- package/dist/types/resolve-with.d.ts +22 -0
- package/dist/types/retry.d.ts +13 -0
- package/dist/types/tap.d.ts +17 -0
- package/dist/types/template-container.d.ts +59 -0
- package/dist/types/uuid-utils.d.ts +112 -0
- package/dist/types/while-in-flight.d.ts +7 -0
- package/dist/uuid-utils.js +12 -37
- package/dist/uuid-utils.js.map +1 -1
- package/dist/while-in-flight.js +0 -10
- package/dist/while-in-flight.js.map +1 -1
- package/package.json +3 -3
- package/src/base64.js +1 -1
- package/src/browser-detection.js +7 -6
- package/src/capped-debounce.js +2 -1
- package/src/constants.js +14 -14
- package/src/deprecated.js +3 -1
- package/src/event-envelope.js +25 -21
- package/src/events.js +1 -4
- package/src/exception.js +1 -2
- package/src/index.js +5 -7
- package/src/make-state-datatype.js +10 -6
- package/src/one-flight.js +1 -5
- package/src/patterns.js +5 -3
- package/src/retry.js +5 -6
- package/src/tap.js +6 -5
- package/src/template-container.js +3 -1
- package/src/uuid-utils.js +16 -16
- package/src/while-in-flight.js +12 -8
- package/test/unit/spec/capped-debounce.js +4 -1
- package/test/unit/spec/exception.js +1 -3
- package/test/unit/spec/one-flight.js +38 -55
- package/test/unit/spec/template-container.js +0 -1
- package/test/unit/spec/while-in-flight.js +8 -10
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
exports.default = make;
|
|
12
|
-
|
|
13
9
|
var _construct2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/construct"));
|
|
14
|
-
|
|
15
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
16
|
-
|
|
17
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
18
|
-
|
|
19
12
|
var _weakMap = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/weak-map"));
|
|
20
|
-
|
|
21
13
|
var _util = _interopRequireDefault(require("util"));
|
|
22
|
-
|
|
23
14
|
/*!
|
|
24
15
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
25
16
|
*/
|
|
@@ -34,7 +25,6 @@ function make() {
|
|
|
34
25
|
for (var _len = arguments.length, containers = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
35
26
|
containers[_key] = arguments[_key];
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
var TopContainer = containers.shift();
|
|
39
29
|
var data = new _weakMap.default();
|
|
40
30
|
var sizes = new _weakMap.default();
|
|
@@ -42,51 +32,48 @@ function make() {
|
|
|
42
32
|
var name = "(".concat([TopContainer.name].concat(containers.map(function (container) {
|
|
43
33
|
return container.name;
|
|
44
34
|
})).join(', '), ")");
|
|
35
|
+
|
|
45
36
|
/**
|
|
46
37
|
* Container that wraps an arbitrary set of tupples to their values
|
|
47
38
|
*/
|
|
48
|
-
|
|
49
39
|
var Container = /*#__PURE__*/function () {
|
|
50
40
|
/**
|
|
51
41
|
* @constructs Container
|
|
52
42
|
*/
|
|
53
43
|
function Container() {
|
|
54
44
|
(0, _classCallCheck2.default)(this, Container);
|
|
55
|
-
|
|
56
45
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
57
46
|
args[_key2] = arguments[_key2];
|
|
58
47
|
}
|
|
59
|
-
|
|
60
48
|
data.set(this, (0, _construct2.default)(TopContainer, args));
|
|
61
49
|
sizes.set(this, 0);
|
|
62
50
|
}
|
|
51
|
+
|
|
63
52
|
/**
|
|
64
53
|
* getter for .size
|
|
65
54
|
* @returns {number}
|
|
66
55
|
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
56
|
(0, _createClass2.default)(Container, [{
|
|
70
57
|
key: "size",
|
|
71
58
|
get: function get() {
|
|
72
59
|
return sizes.get(this);
|
|
73
60
|
}
|
|
61
|
+
|
|
74
62
|
/**
|
|
75
63
|
* Identical to Container#set() but leads slightly more intuitive code when
|
|
76
64
|
* the container is based on a Set rather than a Map.
|
|
77
65
|
* @returns {Container}
|
|
78
66
|
*/
|
|
79
|
-
|
|
80
67
|
}, {
|
|
81
68
|
key: "add",
|
|
82
69
|
value: function add() {
|
|
83
70
|
return this.set.apply(this, arguments);
|
|
84
71
|
}
|
|
72
|
+
|
|
85
73
|
/**
|
|
86
74
|
* Removes all items from the container
|
|
87
75
|
* @returns {undefined}
|
|
88
76
|
*/
|
|
89
|
-
|
|
90
77
|
}, {
|
|
91
78
|
key: "clear",
|
|
92
79
|
value: function clear() {
|
|
@@ -94,92 +81,78 @@ function make() {
|
|
|
94
81
|
sizes.set(this, 0);
|
|
95
82
|
return ret;
|
|
96
83
|
}
|
|
84
|
+
|
|
97
85
|
/**
|
|
98
86
|
* Removes the specified item to the container
|
|
99
87
|
* @param {mixed} key
|
|
100
88
|
* @param {Array<mixed>} keys
|
|
101
89
|
* @returns {boolean}
|
|
102
90
|
*/
|
|
103
|
-
|
|
104
91
|
}, {
|
|
105
92
|
key: "delete",
|
|
106
93
|
value: function _delete(key) {
|
|
107
94
|
var mine = data.get(this);
|
|
108
|
-
|
|
109
95
|
for (var _len3 = arguments.length, keys = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
110
96
|
keys[_key3 - 1] = arguments[_key3];
|
|
111
97
|
}
|
|
112
|
-
|
|
113
98
|
if (!keys.length) {
|
|
114
99
|
return mine.delete(key);
|
|
115
100
|
}
|
|
116
|
-
|
|
117
101
|
var next = mine.get(key);
|
|
118
|
-
|
|
119
102
|
if (!next) {
|
|
120
103
|
return false;
|
|
121
104
|
}
|
|
122
|
-
|
|
123
105
|
var ret = next.delete.apply(next, keys);
|
|
124
|
-
|
|
125
106
|
if (ret) {
|
|
126
107
|
sizes.set(this, sizes.get(this) - 1);
|
|
127
108
|
}
|
|
128
|
-
|
|
129
109
|
if (next.size === 0) {
|
|
130
110
|
mine.delete(key);
|
|
131
111
|
}
|
|
132
|
-
|
|
133
112
|
return ret;
|
|
134
113
|
}
|
|
114
|
+
|
|
135
115
|
/**
|
|
136
116
|
* Retrieves the specified item from the container
|
|
137
117
|
* @param {mixed} key
|
|
138
118
|
* @param {Array<mixed>} keys
|
|
139
119
|
* @returns {mixed}
|
|
140
120
|
*/
|
|
141
|
-
|
|
142
121
|
}, {
|
|
143
122
|
key: "get",
|
|
144
123
|
value: function get(key) {
|
|
145
124
|
var mine = data.get(this);
|
|
146
|
-
|
|
147
125
|
if (!mine.get) {
|
|
148
126
|
return mine;
|
|
149
127
|
}
|
|
150
|
-
|
|
151
128
|
for (var _len4 = arguments.length, keys = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
152
129
|
keys[_key4 - 1] = arguments[_key4];
|
|
153
130
|
}
|
|
154
|
-
|
|
155
131
|
if (!keys.length) {
|
|
156
132
|
return mine.get(key);
|
|
157
133
|
}
|
|
158
|
-
|
|
159
134
|
var next = mine.get(key);
|
|
160
|
-
|
|
161
135
|
if (!next) {
|
|
162
136
|
return undefined;
|
|
163
137
|
}
|
|
164
|
-
|
|
165
138
|
if (!next.get) {
|
|
166
139
|
return next;
|
|
167
140
|
}
|
|
168
|
-
|
|
169
141
|
return next.get.apply(next, keys);
|
|
170
142
|
}
|
|
143
|
+
|
|
171
144
|
/**
|
|
172
145
|
* Indicates whether the container holds the specified item
|
|
173
146
|
* @param {mixed} key
|
|
174
147
|
* @param {Array<mixed>} keys
|
|
175
148
|
* @returns {Boolean}
|
|
176
149
|
*/
|
|
177
|
-
|
|
178
150
|
}, {
|
|
179
151
|
key: "has",
|
|
180
152
|
value: function has() {
|
|
181
153
|
return typeof this.get.apply(this, arguments) !== 'undefined';
|
|
182
154
|
}
|
|
155
|
+
|
|
183
156
|
/**
|
|
184
157
|
* Stores the specified item in the container
|
|
185
158
|
* @param {mixed} key
|
|
@@ -187,53 +160,42 @@ function make() {
|
|
|
187
160
|
* @param {mixed} value
|
|
188
161
|
* @returns {Container}
|
|
189
162
|
*/
|
|
190
|
-
|
|
191
163
|
}, {
|
|
192
164
|
key: "set",
|
|
193
165
|
value: function set() {
|
|
194
166
|
var overwrite = false;
|
|
195
|
-
|
|
196
167
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
197
168
|
args[_key5] = arguments[_key5];
|
|
198
169
|
}
|
|
199
|
-
|
|
200
170
|
if (this.has.apply(this, args)) {
|
|
201
171
|
overwrite = true;
|
|
202
172
|
}
|
|
203
|
-
|
|
204
173
|
var mine = data.get(this);
|
|
205
174
|
var key = args.shift();
|
|
206
|
-
|
|
207
175
|
if (!mine.get) {
|
|
208
176
|
insert.apply(void 0, [mine, key].concat(args));
|
|
209
177
|
return this;
|
|
210
178
|
}
|
|
211
|
-
|
|
212
179
|
var next = mine.get(key);
|
|
213
|
-
|
|
214
180
|
if (!next) {
|
|
215
181
|
if (!ChildContainer) {
|
|
216
182
|
insert.apply(void 0, [mine, key].concat(args));
|
|
217
183
|
return this;
|
|
218
184
|
}
|
|
219
|
-
|
|
220
185
|
next = new ChildContainer();
|
|
221
186
|
insert(mine, key, next);
|
|
222
187
|
}
|
|
223
|
-
|
|
224
188
|
insert.apply(void 0, [next].concat(args));
|
|
225
|
-
|
|
226
189
|
if (!overwrite) {
|
|
227
190
|
sizes.set(this, sizes.get(this) + 1);
|
|
228
191
|
}
|
|
229
|
-
|
|
230
192
|
return this;
|
|
231
193
|
}
|
|
194
|
+
|
|
232
195
|
/**
|
|
233
196
|
* @private
|
|
234
197
|
* @returns {string}
|
|
235
198
|
*/
|
|
236
|
-
|
|
237
199
|
}, {
|
|
238
200
|
key: "inspect",
|
|
239
201
|
value: function inspect() {
|
|
@@ -244,9 +206,9 @@ function make() {
|
|
|
244
206
|
}]);
|
|
245
207
|
return Container;
|
|
246
208
|
}();
|
|
247
|
-
|
|
248
209
|
return Container;
|
|
249
210
|
}
|
|
211
|
+
|
|
250
212
|
/**
|
|
251
213
|
* Inserts into an arbitrary container
|
|
252
214
|
* @param {Map|WeakMap|Set|WeakSet} container
|
|
@@ -254,28 +216,22 @@ function make() {
|
|
|
254
216
|
* @private
|
|
255
217
|
* @returns {undefined}
|
|
256
218
|
*/
|
|
257
|
-
|
|
258
|
-
|
|
259
219
|
function insert(container) {
|
|
260
220
|
for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
|
|
261
221
|
args[_key6 - 1] = arguments[_key6];
|
|
262
222
|
}
|
|
263
|
-
|
|
264
223
|
if (container.add) {
|
|
265
224
|
container.add.apply(container, args);
|
|
266
225
|
return;
|
|
267
226
|
}
|
|
268
|
-
|
|
269
227
|
if (container.set) {
|
|
270
228
|
container.set.apply(container, args);
|
|
271
229
|
return;
|
|
272
230
|
}
|
|
273
|
-
|
|
274
231
|
if (container.push) {
|
|
275
232
|
container.push.apply(container, args);
|
|
276
233
|
return;
|
|
277
234
|
}
|
|
278
|
-
|
|
279
235
|
throw new TypeError('Could not determine how to insert into the specified container');
|
|
280
236
|
}
|
|
281
237
|
//# sourceMappingURL=template-container.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["make","containers","TopContainer","shift","data","sizes","ChildContainer","length","name","concat","map","container","join","Container","args","set","get","ret","clear","key","mine","keys","delete","next","size","undefined","overwrite","has","insert","util","inspect","depth","add","push","TypeError"],"sources":["template-container.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport util from 'util';\n\n/**\n * Factory which produces a multi-keyed container based on the provided set of\n * constructors\n * @param {mixed} containers\n * @returns {Container}\n */\nfunction make(...containers) {\n const TopContainer = containers.shift();\n\n const data = new WeakMap();\n const sizes = new WeakMap();\n\n const ChildContainer = containers.length > 1 ? make(...containers) : containers[0];\n\n const name = `(${[TopContainer.name].concat(containers.map((container) => container.name)).join(', ')})`;\n\n /**\n * Container that wraps an arbitrary set of tupples to their values\n */\n class Container {\n /**\n * @constructs Container\n */\n constructor(...args) {\n data.set(this, new TopContainer(...args));\n sizes.set(this, 0);\n }\n\n /**\n * getter for .size\n * @returns {number}\n */\n get size() {\n return sizes.get(this);\n }\n\n /**\n * Identical to Container#set() but leads slightly more intuitive code when\n * the container is based on a Set rather than a Map.\n * @returns {Container}\n */\n add(...args) {\n return this.set(...args);\n }\n\n /**\n * Removes all items from the container\n * @returns {undefined}\n */\n clear() {\n const ret = data.get(this).clear();\n\n sizes.set(this, 0);\n\n return ret;\n }\n\n /**\n * Removes the specified item to the container\n * @param {mixed} key\n * @param {Array<mixed>} keys\n * @returns {boolean}\n */\n delete(key, ...keys) {\n const mine = data.get(this);\n\n if (!keys.length) {\n return mine.delete(key);\n }\n\n const next = mine.get(key);\n\n if (!next) {\n return false;\n }\n\n const ret = next.delete(...keys);\n\n if (ret) {\n sizes.set(this, sizes.get(this) - 1);\n }\n\n if (next.size === 0) {\n mine.delete(key);\n }\n\n return ret;\n }\n\n /**\n * Retrieves the specified item from the container\n * @param {mixed} key\n * @param {Array<mixed>} keys\n * @returns {mixed}\n */\n get(key, ...keys) {\n const mine = data.get(this);\n\n if (!mine.get) {\n return mine;\n }\n\n if (!keys.length) {\n return mine.get(key);\n }\n\n const next = mine.get(key);\n\n if (!next) {\n return undefined;\n }\n\n if (!next.get) {\n return next;\n }\n\n return next.get(...keys);\n }\n\n /**\n * Indicates whether the container holds the specified item\n * @param {mixed} key\n * @param {Array<mixed>} keys\n * @returns {Boolean}\n */\n has(...args) {\n return typeof this.get(...args) !== 'undefined';\n }\n\n /**\n * Stores the specified item in the container\n * @param {mixed} key\n * @param {Array<mixed>} args\n * @param {mixed} value\n * @returns {Container}\n */\n set(...args) {\n let overwrite = false;\n\n if (this.has(...args)) {\n overwrite = true;\n }\n const mine = data.get(this);\n\n const key = args.shift();\n\n if (!mine.get) {\n insert(mine, key, ...args);\n\n return this;\n }\n\n let next = mine.get(key);\n\n if (!next) {\n if (!ChildContainer) {\n insert(mine, key, ...args);\n\n return this;\n }\n next = new ChildContainer();\n insert(mine, key, next);\n }\n insert(next, ...args);\n\n if (!overwrite) {\n sizes.set(this, sizes.get(this) + 1);\n }\n\n return this;\n }\n\n /**\n * @private\n * @returns {string}\n */\n inspect() {\n return `Container${name} {\n ${util.inspect(data.get(this), {depth: null})}\n}`;\n }\n }\n\n return Container;\n}\n\n/**\n * Inserts into an arbitrary container\n * @param {Map|WeakMap|Set|WeakSet} container\n * @param {Array<mixed>} args\n * @private\n * @returns {undefined}\n */\nfunction insert(container, ...args) {\n if (container.add) {\n container.add(...args);\n\n return;\n }\n\n if (container.set) {\n container.set(...args);\n\n return;\n }\n\n if (container.push) {\n container.push(...args);\n\n return;\n }\n throw new TypeError('Could not determine how to insert into the specified container');\n}\nexport {make as default};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["make","containers","TopContainer","shift","data","sizes","ChildContainer","length","name","concat","map","container","join","Container","args","set","get","ret","clear","key","mine","keys","delete","next","size","undefined","overwrite","has","insert","util","inspect","depth","add","push","TypeError"],"sources":["template-container.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport util from 'util';\n\n/**\n * Factory which produces a multi-keyed container based on the provided set of\n * constructors\n * @param {mixed} containers\n * @returns {Container}\n */\nfunction make(...containers) {\n const TopContainer = containers.shift();\n\n const data = new WeakMap();\n const sizes = new WeakMap();\n\n const ChildContainer = containers.length > 1 ? make(...containers) : containers[0];\n\n const name = `(${[TopContainer.name]\n .concat(containers.map((container) => container.name))\n .join(', ')})`;\n\n /**\n * Container that wraps an arbitrary set of tupples to their values\n */\n class Container {\n /**\n * @constructs Container\n */\n constructor(...args) {\n data.set(this, new TopContainer(...args));\n sizes.set(this, 0);\n }\n\n /**\n * getter for .size\n * @returns {number}\n */\n get size() {\n return sizes.get(this);\n }\n\n /**\n * Identical to Container#set() but leads slightly more intuitive code when\n * the container is based on a Set rather than a Map.\n * @returns {Container}\n */\n add(...args) {\n return this.set(...args);\n }\n\n /**\n * Removes all items from the container\n * @returns {undefined}\n */\n clear() {\n const ret = data.get(this).clear();\n\n sizes.set(this, 0);\n\n return ret;\n }\n\n /**\n * Removes the specified item to the container\n * @param {mixed} key\n * @param {Array<mixed>} keys\n * @returns {boolean}\n */\n delete(key, ...keys) {\n const mine = data.get(this);\n\n if (!keys.length) {\n return mine.delete(key);\n }\n\n const next = mine.get(key);\n\n if (!next) {\n return false;\n }\n\n const ret = next.delete(...keys);\n\n if (ret) {\n sizes.set(this, sizes.get(this) - 1);\n }\n\n if (next.size === 0) {\n mine.delete(key);\n }\n\n return ret;\n }\n\n /**\n * Retrieves the specified item from the container\n * @param {mixed} key\n * @param {Array<mixed>} keys\n * @returns {mixed}\n */\n get(key, ...keys) {\n const mine = data.get(this);\n\n if (!mine.get) {\n return mine;\n }\n\n if (!keys.length) {\n return mine.get(key);\n }\n\n const next = mine.get(key);\n\n if (!next) {\n return undefined;\n }\n\n if (!next.get) {\n return next;\n }\n\n return next.get(...keys);\n }\n\n /**\n * Indicates whether the container holds the specified item\n * @param {mixed} key\n * @param {Array<mixed>} keys\n * @returns {Boolean}\n */\n has(...args) {\n return typeof this.get(...args) !== 'undefined';\n }\n\n /**\n * Stores the specified item in the container\n * @param {mixed} key\n * @param {Array<mixed>} args\n * @param {mixed} value\n * @returns {Container}\n */\n set(...args) {\n let overwrite = false;\n\n if (this.has(...args)) {\n overwrite = true;\n }\n const mine = data.get(this);\n\n const key = args.shift();\n\n if (!mine.get) {\n insert(mine, key, ...args);\n\n return this;\n }\n\n let next = mine.get(key);\n\n if (!next) {\n if (!ChildContainer) {\n insert(mine, key, ...args);\n\n return this;\n }\n next = new ChildContainer();\n insert(mine, key, next);\n }\n insert(next, ...args);\n\n if (!overwrite) {\n sizes.set(this, sizes.get(this) + 1);\n }\n\n return this;\n }\n\n /**\n * @private\n * @returns {string}\n */\n inspect() {\n return `Container${name} {\n ${util.inspect(data.get(this), {depth: null})}\n}`;\n }\n }\n\n return Container;\n}\n\n/**\n * Inserts into an arbitrary container\n * @param {Map|WeakMap|Set|WeakSet} container\n * @param {Array<mixed>} args\n * @private\n * @returns {undefined}\n */\nfunction insert(container, ...args) {\n if (container.add) {\n container.add(...args);\n\n return;\n }\n\n if (container.set) {\n container.set(...args);\n\n return;\n }\n\n if (container.push) {\n container.push(...args);\n\n return;\n }\n throw new TypeError('Could not determine how to insert into the specified container');\n}\nexport {make as default};\n"],"mappings":";;;;;;;;;;;;AAIA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,IAAI,GAAgB;EAAA,kCAAZC,UAAU;IAAVA,UAAU;EAAA;EACzB,IAAMC,YAAY,GAAGD,UAAU,CAACE,KAAK,EAAE;EAEvC,IAAMC,IAAI,GAAG,sBAAa;EAC1B,IAAMC,KAAK,GAAG,sBAAa;EAE3B,IAAMC,cAAc,GAAGL,UAAU,CAACM,MAAM,GAAG,CAAC,GAAGP,IAAI,eAAIC,UAAU,CAAC,GAAGA,UAAU,CAAC,CAAC,CAAC;EAElF,IAAMO,IAAI,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,SAAS,CAACqB,GAAG,OAAbrB,SAAS,EAAQG,IAAI,CAAC;IAEtB;EACF;EAEA,IAAIH,SAAS,CAACI,GAAG,EAAE;IACjBJ,SAAS,CAACI,GAAG,OAAbJ,SAAS,EAAQG,IAAI,CAAC;IAEtB;EACF;EAEA,IAAIH,SAAS,CAACsB,IAAI,EAAE;IAClBtB,SAAS,CAACsB,IAAI,OAAdtB,SAAS,EAASG,IAAI,CAAC;IAEvB;EACF;EACA,MAAM,IAAIoB,SAAS,CAAC,gEAAgE,CAAC;AACvF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string from a base64url-encoded string
|
|
3
|
+
* @param {string} str
|
|
4
|
+
* @returns {string}
|
|
5
|
+
*/
|
|
6
|
+
export function fromBase64url(str: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Converts a string to a base64url-encoded string. It also accepts a buffer
|
|
9
|
+
* @param {string|buffer} str
|
|
10
|
+
* @returns {string}
|
|
11
|
+
*/
|
|
12
|
+
export function toBase64Url(str: any): string;
|
|
13
|
+
/**
|
|
14
|
+
* Converts a string to a base64url-encoded string. It also accepts a buffer
|
|
15
|
+
* @param {string|buffer} str
|
|
16
|
+
* @returns {string}
|
|
17
|
+
*/
|
|
18
|
+
export function encode(str: string | buffer): string;
|
|
19
|
+
/**
|
|
20
|
+
* Converts a string from a base64url-encoded string
|
|
21
|
+
* @param {string} str
|
|
22
|
+
* @returns {string}
|
|
23
|
+
*/
|
|
24
|
+
export function decode(str: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Indicates if the provided string is, in fact, a base64 string
|
|
27
|
+
* @param {String} str
|
|
28
|
+
* @returns {Boolean}
|
|
29
|
+
*/
|
|
30
|
+
export function validate(str: string): boolean;
|
|
31
|
+
declare namespace _default {
|
|
32
|
+
export { fromBase64url };
|
|
33
|
+
export { toBase64Url };
|
|
34
|
+
export { encode };
|
|
35
|
+
export { decode };
|
|
36
|
+
export { validate };
|
|
37
|
+
}
|
|
38
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Behaves like debounce, but additionally executes after a number of calls are
|
|
6
|
+
* attempted, rather than just time
|
|
7
|
+
* @param {Function} fn
|
|
8
|
+
* @param {Number} wait
|
|
9
|
+
* @param {Object} options
|
|
10
|
+
* @returns {Function}
|
|
11
|
+
*/
|
|
12
|
+
export default function debounce(fn: Function, wait: number, options: any): Function;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Check object for the specified keys
|
|
6
|
+
* @param {Array<string>} keys
|
|
7
|
+
* @param {Object} object
|
|
8
|
+
* @returns {undefined}
|
|
9
|
+
* @throws Error
|
|
10
|
+
*/
|
|
11
|
+
export default function checkRequired(keys: Array<string>, object: any): undefined;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export namespace SDK_EVENT {
|
|
2
|
+
namespace INTERNAL {
|
|
3
|
+
const WEBEX_ACTIVITY: string;
|
|
4
|
+
namespace ACTIVITY_FIELD {
|
|
5
|
+
const ACTOR: string;
|
|
6
|
+
const OBJECT: string;
|
|
7
|
+
const TARGET: string;
|
|
8
|
+
}
|
|
9
|
+
namespace ACTIVITY_VERB {
|
|
10
|
+
const ACKNOWLEDGE: string;
|
|
11
|
+
const CARD_ACTION: string;
|
|
12
|
+
const CREATE: string;
|
|
13
|
+
const POST: string;
|
|
14
|
+
const SHARE: string;
|
|
15
|
+
const DELETE: string;
|
|
16
|
+
const ADD: string;
|
|
17
|
+
const LEAVE: string;
|
|
18
|
+
const ADD_MODERATOR: string;
|
|
19
|
+
const REMOVE_MODERATOR: string;
|
|
20
|
+
const LOCK: string;
|
|
21
|
+
const UNLOCK: string;
|
|
22
|
+
const HIDE: string;
|
|
23
|
+
const UPDATE: string;
|
|
24
|
+
}
|
|
25
|
+
namespace ACTIVITY_TAG {
|
|
26
|
+
const HIDDEN: string;
|
|
27
|
+
const ONE_ON_ONE: string;
|
|
28
|
+
const LOCKED: string;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
namespace EXTERNAL {
|
|
32
|
+
namespace EVENT_TYPE {
|
|
33
|
+
const CREATED: string;
|
|
34
|
+
const DELETED: string;
|
|
35
|
+
const UPDATED: string;
|
|
36
|
+
const SEEN: string;
|
|
37
|
+
}
|
|
38
|
+
namespace OWNER {
|
|
39
|
+
const CREATOR: string;
|
|
40
|
+
const ORG: string;
|
|
41
|
+
}
|
|
42
|
+
namespace STATUS {
|
|
43
|
+
const ACTIVE: string;
|
|
44
|
+
const DISABLED: string;
|
|
45
|
+
}
|
|
46
|
+
namespace SPACE_TYPE {
|
|
47
|
+
const DIRECT: string;
|
|
48
|
+
const GROUP: string;
|
|
49
|
+
}
|
|
50
|
+
namespace RESOURCE {
|
|
51
|
+
const ATTACHMENT_ACTIONS: string;
|
|
52
|
+
const MEMBERSHIPS: string;
|
|
53
|
+
const MESSAGES: string;
|
|
54
|
+
const ROOMS: string;
|
|
55
|
+
}
|
|
56
|
+
namespace ATTACHMENTS {
|
|
57
|
+
const CARD_CONTENT_TYPE: string;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export namespace hydraTypes {
|
|
62
|
+
const ATTACHMENT_ACTION: string;
|
|
63
|
+
const CONTENT: string;
|
|
64
|
+
const MEMBERSHIP: string;
|
|
65
|
+
const MESSAGE: string;
|
|
66
|
+
const ORGANIZATION: string;
|
|
67
|
+
const PEOPLE: string;
|
|
68
|
+
const ROOM: string;
|
|
69
|
+
const TEAM: string;
|
|
70
|
+
}
|
|
71
|
+
export namespace deviceType {
|
|
72
|
+
const PROVISIONAL: string;
|
|
73
|
+
const WEB: string;
|
|
74
|
+
}
|
|
75
|
+
export const INTERNAL_US_CLUSTER_NAME: "urn:TEAM:us-east-2_a";
|
|
76
|
+
export const INTERNAL_US_INTEGRATION_CLUSTER_NAME: "urn:TEAM:us-east-1_int13";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Creates a new `Defer`red object,
|
|
6
|
+
* @returns {Defer}
|
|
7
|
+
*/
|
|
8
|
+
export default function Defer(): Defer;
|
|
9
|
+
export default class Defer {
|
|
10
|
+
promise: Promise<any>;
|
|
11
|
+
/**
|
|
12
|
+
* @instance
|
|
13
|
+
* @memberof Defer
|
|
14
|
+
* @type {function}
|
|
15
|
+
*/
|
|
16
|
+
resolve: Function;
|
|
17
|
+
/**
|
|
18
|
+
* @instance
|
|
19
|
+
* @memberof Defer
|
|
20
|
+
* @type {function}
|
|
21
|
+
*/
|
|
22
|
+
reject: Function;
|
|
23
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a 'webhook' envelope to wrap Webex events in
|
|
3
|
+
* @param {object} webex - sdk object
|
|
4
|
+
* @param {string} resource - resource to create an envelope for
|
|
5
|
+
* @returns {object} - Returns a promise of an event envelope object
|
|
6
|
+
*/
|
|
7
|
+
export function createEventEnvelope(webex: object, resource: string): object;
|
|
8
|
+
/**
|
|
9
|
+
* Stores SDK users info in the sdk object if it doesn't already exist
|
|
10
|
+
* @param {object} webex - sdk object
|
|
11
|
+
* @returns {Promise} - Returns a promise that user info will be available
|
|
12
|
+
*/
|
|
13
|
+
export function ensureMyIdIsAvailable(webex: object): Promise<any>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proxies the event binding methods of emitter onto proxy
|
|
3
|
+
* @param {EventEmitter|EventEmitterProxy} emitter
|
|
4
|
+
* @param {mixed} proxy (probably a promise)
|
|
5
|
+
* @returns {EventEmitter} Returns the source emitter to ease use in promise chains
|
|
6
|
+
*/
|
|
7
|
+
export function proxyEvents(emitter: EventEmitter | EventEmitterProxy, proxy: mixed): EventEmitter;
|
|
8
|
+
/**
|
|
9
|
+
* Given a list of events, fires them on drain when they're emitted from source
|
|
10
|
+
* @param {Array|string} events
|
|
11
|
+
* @param {EventEmitter} source
|
|
12
|
+
* @param {EventEmitter} drain
|
|
13
|
+
* @returns {undefined}
|
|
14
|
+
*/
|
|
15
|
+
export function transferEvents(events: any[] | string, source: EventEmitter, drain: EventEmitter): undefined;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Base Exception class
|
|
6
|
+
*/
|
|
7
|
+
export default class Exception extends Error {
|
|
8
|
+
static defaultMessage: string;
|
|
9
|
+
/**
|
|
10
|
+
* Generates the value assigned to `this.message`. You'll probably want to
|
|
11
|
+
* override this in your custom Exception
|
|
12
|
+
* @param {mixed} args
|
|
13
|
+
* @returns {string}
|
|
14
|
+
*/
|
|
15
|
+
static parse(...args: mixed): string;
|
|
16
|
+
/**
|
|
17
|
+
* constructor
|
|
18
|
+
* @param {mixed} args
|
|
19
|
+
* @returns {Exception}
|
|
20
|
+
*/
|
|
21
|
+
constructor(...args: mixed);
|
|
22
|
+
message: any;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./node";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { default as base64 } from "./base64";
|
|
2
|
+
export { default as isBuffer } from "./isBuffer";
|
|
3
|
+
export { default as cappedDebounce } from "./capped-debounce";
|
|
4
|
+
export { default as checkRequired } from "./check-required";
|
|
5
|
+
export { default as Defer } from "./defer";
|
|
6
|
+
export { default as makeStateDataType } from "./make-state-datatype";
|
|
7
|
+
export { default as make } from "./template-container";
|
|
8
|
+
export { default as oneFlight } from "./one-flight";
|
|
9
|
+
export { default as patterns } from "./patterns";
|
|
10
|
+
export { default as resolveWith } from "./resolve-with";
|
|
11
|
+
export { default as retry } from "./retry";
|
|
12
|
+
export { default as tap } from "./tap";
|
|
13
|
+
export { default as whileInFlight } from "./while-in-flight";
|
|
14
|
+
export { default as Exception } from "./exception";
|
|
15
|
+
export { default as deprecated } from "./deprecated";
|
|
16
|
+
export { default as inBrowser } from "./in-browser";
|
|
17
|
+
export { default as BrowserDetection } from "./browser-detection";
|
|
18
|
+
export { proxyEvents, transferEvents } from "./events";
|
|
19
|
+
export { createEventEnvelope, ensureMyIdIsAvailable } from "./event-envelope";
|
|
20
|
+
export { deviceType, hydraTypes, SDK_EVENT, INTERNAL_US_CLUSTER_NAME, INTERNAL_US_INTEGRATION_CLUSTER_NAME } from "./constants";
|
|
21
|
+
export { buildHydraMembershipId, buildHydraMessageId, buildHydraOrgId, buildHydraPersonId, buildHydraRoomId, getHydraRoomType, getHydraClusterString, getHydraFiles, constructHydraId, deconstructHydraId } from "./uuid-utils";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Creates an ampersand state object that wires its event handlers like a an
|
|
6
|
+
* ampersand child
|
|
7
|
+
* @param {Function} Constructor
|
|
8
|
+
* @param {string} name
|
|
9
|
+
* @returns {Object}
|
|
10
|
+
*/
|
|
11
|
+
export default function makeStateDataType(Constructor: Function, name: string): any;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @memberof Util
|
|
3
|
+
* @param {Object} options
|
|
4
|
+
* @param {Function} options.keyFactory
|
|
5
|
+
* @param {boolean} options.cacheFailures
|
|
6
|
+
* @param {boolean} options.cacheSuccesses
|
|
7
|
+
* @returns {Function}
|
|
8
|
+
*/
|
|
9
|
+
export default function oneFlight(...params: any[]): Function;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Sugar method for returning the desired object at the end of a promise chain
|
|
6
|
+
* @param {any} object the item with which to resolve the promise chain
|
|
7
|
+
* @returns {function}
|
|
8
|
+
* @example
|
|
9
|
+
* var item = {
|
|
10
|
+
* prop: 2
|
|
11
|
+
* };
|
|
12
|
+
* Promise
|
|
13
|
+
* .resolve(item.prop)
|
|
14
|
+
* .then(resolveWith(item))
|
|
15
|
+
* .then(function(res) {
|
|
16
|
+
* require('assert').deepEqual(res, {prop:2});
|
|
17
|
+
* return 'success'
|
|
18
|
+
* })
|
|
19
|
+
* // => success
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
export default function resolveWith(object: any): Function;
|