@webex/common 2.59.3-next.1 → 2.59.4
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/.eslintrc.js +6 -6
- package/README.md +42 -42
- package/babel.config.js +3 -3
- package/dist/base64.js +22 -22
- package/dist/base64.js.map +1 -1
- package/dist/browser-detection.js.map +1 -1
- package/dist/capped-debounce.js +12 -12
- package/dist/capped-debounce.js.map +1 -1
- package/dist/check-required.js +8 -8
- package/dist/check-required.js.map +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/defer.js +13 -13
- package/dist/defer.js.map +1 -1
- package/dist/deprecated.js +5 -5
- package/dist/deprecated.js.map +1 -1
- package/dist/event-envelope.js +11 -11
- package/dist/event-envelope.js.map +1 -1
- package/dist/events.js +15 -15
- package/dist/events.js.map +1 -1
- package/dist/exception.js +13 -13
- package/dist/exception.js.map +1 -1
- package/dist/in-browser/browser.js +2 -2
- package/dist/in-browser/browser.js.map +1 -1
- package/dist/in-browser/index.js.map +1 -1
- package/dist/in-browser/node.js +2 -2
- package/dist/in-browser/node.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/isBuffer.js +6 -6
- package/dist/isBuffer.js.map +1 -1
- package/dist/make-state-datatype.js +14 -14
- package/dist/make-state-datatype.js.map +1 -1
- package/dist/one-flight.js +13 -13
- package/dist/one-flight.js.map +1 -1
- package/dist/patterns.js +30 -30
- package/dist/patterns.js.map +1 -1
- package/dist/resolve-with.js +19 -19
- package/dist/resolve-with.js.map +1 -1
- package/dist/retry.js +17 -17
- package/dist/retry.js.map +1 -1
- package/dist/tap.js +14 -14
- package/dist/tap.js.map +1 -1
- package/dist/template-container.js +51 -51
- package/dist/template-container.js.map +1 -1
- package/dist/uuid-utils.js +76 -76
- package/dist/uuid-utils.js.map +1 -1
- package/dist/while-in-flight.js +5 -5
- package/dist/while-in-flight.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +11 -12
- package/process +1 -1
- package/src/base64.js +67 -67
- package/src/browser-detection.js +37 -37
- package/src/capped-debounce.js +65 -65
- package/src/check-required.js +18 -18
- package/src/constants.js +79 -79
- package/src/defer.js +24 -24
- package/src/deprecated.js +19 -19
- package/src/event-envelope.js +54 -54
- package/src/events.js +55 -55
- package/src/exception.js +45 -45
- package/src/in-browser/browser.js +5 -5
- package/src/in-browser/index.js +11 -11
- package/src/in-browser/node.js +5 -5
- package/src/index.js +44 -44
- package/src/isBuffer.js +12 -12
- package/src/make-state-datatype.js +91 -91
- package/src/one-flight.js +89 -89
- package/src/patterns.js +51 -51
- package/src/resolve-with.js +27 -27
- package/src/retry.js +124 -124
- package/src/tap.js +25 -25
- package/src/template-container.js +222 -222
- package/src/uuid-utils.js +189 -189
- package/src/while-in-flight.js +38 -38
- package/test/unit/spec/capped-debounce.js +103 -103
- package/test/unit/spec/common.js +42 -42
- package/test/unit/spec/exception.js +102 -102
- package/test/unit/spec/one-flight.js +211 -211
- package/test/unit/spec/template-container.js +81 -81
- package/test/unit/spec/while-in-flight.js +70 -70
|
@@ -11,15 +11,15 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/he
|
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
12
12
|
var _weakMap = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/weak-map"));
|
|
13
13
|
var _util = _interopRequireDefault(require("util"));
|
|
14
|
-
/*!
|
|
15
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
14
|
+
/*!
|
|
15
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Factory which produces a multi-keyed container based on the provided set of
|
|
20
|
-
* constructors
|
|
21
|
-
* @param {mixed} containers
|
|
22
|
-
* @returns {Container}
|
|
18
|
+
/**
|
|
19
|
+
* Factory which produces a multi-keyed container based on the provided set of
|
|
20
|
+
* constructors
|
|
21
|
+
* @param {mixed} containers
|
|
22
|
+
* @returns {Container}
|
|
23
23
|
*/
|
|
24
24
|
function make() {
|
|
25
25
|
for (var _len = arguments.length, containers = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -33,12 +33,12 @@ function make() {
|
|
|
33
33
|
return container.name;
|
|
34
34
|
})).join(', '), ")");
|
|
35
35
|
|
|
36
|
-
/**
|
|
37
|
-
* Container that wraps an arbitrary set of tupples to their values
|
|
36
|
+
/**
|
|
37
|
+
* Container that wraps an arbitrary set of tupples to their values
|
|
38
38
|
*/
|
|
39
39
|
var Container = /*#__PURE__*/function () {
|
|
40
|
-
/**
|
|
41
|
-
* @constructs Container
|
|
40
|
+
/**
|
|
41
|
+
* @constructs Container
|
|
42
42
|
*/
|
|
43
43
|
function Container() {
|
|
44
44
|
(0, _classCallCheck2.default)(this, Container);
|
|
@@ -49,9 +49,9 @@ function make() {
|
|
|
49
49
|
sizes.set(this, 0);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
/**
|
|
53
|
-
* getter for .size
|
|
54
|
-
* @returns {number}
|
|
52
|
+
/**
|
|
53
|
+
* getter for .size
|
|
54
|
+
* @returns {number}
|
|
55
55
|
*/
|
|
56
56
|
(0, _createClass2.default)(Container, [{
|
|
57
57
|
key: "size",
|
|
@@ -59,10 +59,10 @@ function make() {
|
|
|
59
59
|
return sizes.get(this);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
/**
|
|
63
|
-
* Identical to Container#set() but leads slightly more intuitive code when
|
|
64
|
-
* the container is based on a Set rather than a Map.
|
|
65
|
-
* @returns {Container}
|
|
62
|
+
/**
|
|
63
|
+
* Identical to Container#set() but leads slightly more intuitive code when
|
|
64
|
+
* the container is based on a Set rather than a Map.
|
|
65
|
+
* @returns {Container}
|
|
66
66
|
*/
|
|
67
67
|
}, {
|
|
68
68
|
key: "add",
|
|
@@ -70,9 +70,9 @@ function make() {
|
|
|
70
70
|
return this.set.apply(this, arguments);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
/**
|
|
74
|
-
* Removes all items from the container
|
|
75
|
-
* @returns {undefined}
|
|
73
|
+
/**
|
|
74
|
+
* Removes all items from the container
|
|
75
|
+
* @returns {undefined}
|
|
76
76
|
*/
|
|
77
77
|
}, {
|
|
78
78
|
key: "clear",
|
|
@@ -82,11 +82,11 @@ function make() {
|
|
|
82
82
|
return ret;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
/**
|
|
86
|
-
* Removes the specified item to the container
|
|
87
|
-
* @param {mixed} key
|
|
88
|
-
* @param {Array<mixed>} keys
|
|
89
|
-
* @returns {boolean}
|
|
85
|
+
/**
|
|
86
|
+
* Removes the specified item to the container
|
|
87
|
+
* @param {mixed} key
|
|
88
|
+
* @param {Array<mixed>} keys
|
|
89
|
+
* @returns {boolean}
|
|
90
90
|
*/
|
|
91
91
|
}, {
|
|
92
92
|
key: "delete",
|
|
@@ -112,11 +112,11 @@ function make() {
|
|
|
112
112
|
return ret;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
/**
|
|
116
|
-
* Retrieves the specified item from the container
|
|
117
|
-
* @param {mixed} key
|
|
118
|
-
* @param {Array<mixed>} keys
|
|
119
|
-
* @returns {mixed}
|
|
115
|
+
/**
|
|
116
|
+
* Retrieves the specified item from the container
|
|
117
|
+
* @param {mixed} key
|
|
118
|
+
* @param {Array<mixed>} keys
|
|
119
|
+
* @returns {mixed}
|
|
120
120
|
*/
|
|
121
121
|
}, {
|
|
122
122
|
key: "get",
|
|
@@ -141,11 +141,11 @@ function make() {
|
|
|
141
141
|
return next.get.apply(next, keys);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
/**
|
|
145
|
-
* Indicates whether the container holds the specified item
|
|
146
|
-
* @param {mixed} key
|
|
147
|
-
* @param {Array<mixed>} keys
|
|
148
|
-
* @returns {Boolean}
|
|
144
|
+
/**
|
|
145
|
+
* Indicates whether the container holds the specified item
|
|
146
|
+
* @param {mixed} key
|
|
147
|
+
* @param {Array<mixed>} keys
|
|
148
|
+
* @returns {Boolean}
|
|
149
149
|
*/
|
|
150
150
|
}, {
|
|
151
151
|
key: "has",
|
|
@@ -153,12 +153,12 @@ function make() {
|
|
|
153
153
|
return typeof this.get.apply(this, arguments) !== 'undefined';
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
/**
|
|
157
|
-
* Stores the specified item in the container
|
|
158
|
-
* @param {mixed} key
|
|
159
|
-
* @param {Array<mixed>} args
|
|
160
|
-
* @param {mixed} value
|
|
161
|
-
* @returns {Container}
|
|
156
|
+
/**
|
|
157
|
+
* Stores the specified item in the container
|
|
158
|
+
* @param {mixed} key
|
|
159
|
+
* @param {Array<mixed>} args
|
|
160
|
+
* @param {mixed} value
|
|
161
|
+
* @returns {Container}
|
|
162
162
|
*/
|
|
163
163
|
}, {
|
|
164
164
|
key: "set",
|
|
@@ -192,9 +192,9 @@ function make() {
|
|
|
192
192
|
return this;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
/**
|
|
196
|
-
* @private
|
|
197
|
-
* @returns {string}
|
|
195
|
+
/**
|
|
196
|
+
* @private
|
|
197
|
+
* @returns {string}
|
|
198
198
|
*/
|
|
199
199
|
}, {
|
|
200
200
|
key: "inspect",
|
|
@@ -209,12 +209,12 @@ function make() {
|
|
|
209
209
|
return Container;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
/**
|
|
213
|
-
* Inserts into an arbitrary container
|
|
214
|
-
* @param {Map|WeakMap|Set|WeakSet} container
|
|
215
|
-
* @param {Array<mixed>} args
|
|
216
|
-
* @private
|
|
217
|
-
* @returns {undefined}
|
|
212
|
+
/**
|
|
213
|
+
* Inserts into an arbitrary container
|
|
214
|
+
* @param {Map|WeakMap|Set|WeakSet} container
|
|
215
|
+
* @param {Array<mixed>} args
|
|
216
|
+
* @private
|
|
217
|
+
* @returns {undefined}
|
|
218
218
|
*/
|
|
219
219
|
function insert(container) {
|
|
220
220
|
for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_util","_interopRequireDefault","require","make","_len","arguments","length","containers","Array","_key","TopContainer","shift","data","_weakMap","default","sizes","ChildContainer","apply","name","concat","map","container","join","Container","_classCallCheck2","_len2","args","_key2","set","_construct2","_createClass2","key","get","value","add","clear","ret","_delete","mine","_len3","keys","_key3","delete","next","size","_len4","_key4","undefined","has","overwrite","_len5","_key5","insert","inspect","util","depth","_len6","_key6","push","TypeError"],"sources":["template-container.js"],"sourcesContent":["/*!\r\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\r\n */\r\n\r\nimport util from 'util';\r\n\r\n/**\r\n * Factory which produces a multi-keyed container based on the provided set of\r\n * constructors\r\n * @param {mixed} containers\r\n * @returns {Container}\r\n */\r\nfunction make(...containers) {\r\n const TopContainer = containers.shift();\r\n\r\n const data = new WeakMap();\r\n const sizes = new WeakMap();\r\n\r\n const ChildContainer = containers.length > 1 ? make(...containers) : containers[0];\r\n\r\n const name = `(${[TopContainer.name]\r\n .concat(containers.map((container) => container.name))\r\n .join(', ')})`;\r\n\r\n /**\r\n * Container that wraps an arbitrary set of tupples to their values\r\n */\r\n class Container {\r\n /**\r\n * @constructs Container\r\n */\r\n constructor(...args) {\r\n data.set(this, new TopContainer(...args));\r\n sizes.set(this, 0);\r\n }\r\n\r\n /**\r\n * getter for .size\r\n * @returns {number}\r\n */\r\n get size() {\r\n return sizes.get(this);\r\n }\r\n\r\n /**\r\n * Identical to Container#set() but leads slightly more intuitive code when\r\n * the container is based on a Set rather than a Map.\r\n * @returns {Container}\r\n */\r\n add(...args) {\r\n return this.set(...args);\r\n }\r\n\r\n /**\r\n * Removes all items from the container\r\n * @returns {undefined}\r\n */\r\n clear() {\r\n const ret = data.get(this).clear();\r\n\r\n sizes.set(this, 0);\r\n\r\n return ret;\r\n }\r\n\r\n /**\r\n * Removes the specified item to the container\r\n * @param {mixed} key\r\n * @param {Array<mixed>} keys\r\n * @returns {boolean}\r\n */\r\n delete(key, ...keys) {\r\n const mine = data.get(this);\r\n\r\n if (!keys.length) {\r\n return mine.delete(key);\r\n }\r\n\r\n const next = mine.get(key);\r\n\r\n if (!next) {\r\n return false;\r\n }\r\n\r\n const ret = next.delete(...keys);\r\n\r\n if (ret) {\r\n sizes.set(this, sizes.get(this) - 1);\r\n }\r\n\r\n if (next.size === 0) {\r\n mine.delete(key);\r\n }\r\n\r\n return ret;\r\n }\r\n\r\n /**\r\n * Retrieves the specified item from the container\r\n * @param {mixed} key\r\n * @param {Array<mixed>} keys\r\n * @returns {mixed}\r\n */\r\n get(key, ...keys) {\r\n const mine = data.get(this);\r\n\r\n if (!mine.get) {\r\n return mine;\r\n }\r\n\r\n if (!keys.length) {\r\n return mine.get(key);\r\n }\r\n\r\n const next = mine.get(key);\r\n\r\n if (!next) {\r\n return undefined;\r\n }\r\n\r\n if (!next.get) {\r\n return next;\r\n }\r\n\r\n return next.get(...keys);\r\n }\r\n\r\n /**\r\n * Indicates whether the container holds the specified item\r\n * @param {mixed} key\r\n * @param {Array<mixed>} keys\r\n * @returns {Boolean}\r\n */\r\n has(...args) {\r\n return typeof this.get(...args) !== 'undefined';\r\n }\r\n\r\n /**\r\n * Stores the specified item in the container\r\n * @param {mixed} key\r\n * @param {Array<mixed>} args\r\n * @param {mixed} value\r\n * @returns {Container}\r\n */\r\n set(...args) {\r\n let overwrite = false;\r\n\r\n if (this.has(...args)) {\r\n overwrite = true;\r\n }\r\n const mine = data.get(this);\r\n\r\n const key = args.shift();\r\n\r\n if (!mine.get) {\r\n insert(mine, key, ...args);\r\n\r\n return this;\r\n }\r\n\r\n let next = mine.get(key);\r\n\r\n if (!next) {\r\n if (!ChildContainer) {\r\n insert(mine, key, ...args);\r\n\r\n return this;\r\n }\r\n next = new ChildContainer();\r\n insert(mine, key, next);\r\n }\r\n insert(next, ...args);\r\n\r\n if (!overwrite) {\r\n sizes.set(this, sizes.get(this) + 1);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * @private\r\n * @returns {string}\r\n */\r\n inspect() {\r\n return `Container${name} {\r\n ${util.inspect(data.get(this), {depth: null})}\r\n}`;\r\n }\r\n }\r\n\r\n return Container;\r\n}\r\n\r\n/**\r\n * Inserts into an arbitrary container\r\n * @param {Map|WeakMap|Set|WeakSet} container\r\n * @param {Array<mixed>} args\r\n * @private\r\n * @returns {undefined}\r\n */\r\nfunction insert(container, ...args) {\r\n if (container.add) {\r\n container.add(...args);\r\n\r\n return;\r\n }\r\n\r\n if (container.set) {\r\n container.set(...args);\r\n\r\n return;\r\n }\r\n\r\n if (container.push) {\r\n container.push(...args);\r\n\r\n return;\r\n }\r\n throw new TypeError('Could not determine how to insert into the specified container');\r\n}\r\nexport {make as default};\r\n"],"mappings":";;;;;;;;;;;;AAIA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,IAAIA,CAAA,EAAgB;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAZC,UAAU,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAVF,UAAU,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EACzB,IAAMC,YAAY,GAAGH,UAAU,CAACI,KAAK,EAAE;EAEvC,IAAMC,IAAI,GAAG,IAAAC,QAAA,CAAAC,OAAA,EAAa;EAC1B,IAAMC,KAAK,GAAG,IAAAF,QAAA,CAAAC,OAAA,EAAa;EAE3B,IAAME,cAAc,GAAGT,UAAU,CAACD,MAAM,GAAG,CAAC,GAAGH,IAAI,CAAAc,KAAA,SAAIV,UAAU,CAAC,GAAGA,UAAU,CAAC,CAAC,CAAC;EAElF,IAAMW,IAAI,OAAAC,MAAA,CAAO,CAACT,YA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B,IAAI,OAAAlB,KAAA,CAAAgD,KAAA,OAAAA,KAAA,WAAAC,KAAA,MAAAA,KAAA,GAAAD,KAAA,EAAAC,KAAA;IAAJ/B,IAAI,CAAA+B,KAAA,QAAApD,SAAA,CAAAoD,KAAA;EAAA;EAChC,IAAIpC,SAAS,CAACa,GAAG,EAAE;IACjBb,SAAS,CAACa,GAAG,CAAAjB,KAAA,CAAbI,SAAS,EAAQK,IAAI,CAAC;IAEtB;EACF;EAEA,IAAIL,SAAS,CAACO,GAAG,EAAE;IACjBP,SAAS,CAACO,GAAG,CAAAX,KAAA,CAAbI,SAAS,EAAQK,IAAI,CAAC;IAEtB;EACF;EAEA,IAAIL,SAAS,CAACqC,IAAI,EAAE;IAClBrC,SAAS,CAACqC,IAAI,CAAAzC,KAAA,CAAdI,SAAS,EAASK,IAAI,CAAC;IAEvB;EACF;EACA,MAAM,IAAIiC,SAAS,CAAC,gEAAgE,CAAC;AACvF"}
|
|
1
|
+
{"version":3,"names":["_util","_interopRequireDefault","require","make","_len","arguments","length","containers","Array","_key","TopContainer","shift","data","_weakMap","default","sizes","ChildContainer","apply","name","concat","map","container","join","Container","_classCallCheck2","_len2","args","_key2","set","_construct2","_createClass2","key","get","value","add","clear","ret","_delete","mine","_len3","keys","_key3","delete","next","size","_len4","_key4","undefined","has","overwrite","_len5","_key5","insert","inspect","util","depth","_len6","_key6","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,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,IAAIA,CAAA,EAAgB;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAZC,UAAU,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAVF,UAAU,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EACzB,IAAMC,YAAY,GAAGH,UAAU,CAACI,KAAK,EAAE;EAEvC,IAAMC,IAAI,GAAG,IAAAC,QAAA,CAAAC,OAAA,EAAa;EAC1B,IAAMC,KAAK,GAAG,IAAAF,QAAA,CAAAC,OAAA,EAAa;EAE3B,IAAME,cAAc,GAAGT,UAAU,CAACD,MAAM,GAAG,CAAC,GAAGH,IAAI,CAAAc,KAAA,SAAIV,UAAU,CAAC,GAAGA,UAAU,CAAC,CAAC,CAAC;EAElF,IAAMW,IAAI,OAAAC,MAAA,CAAO,CAACT,YAAY,CAACQ,IAAI,CAAC,CACjCC,MAAM,CAACZ,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,KAAA,WAAAC,KAAA,MAAAA,KAAA,GAAAD,KAAA,EAAAC,KAAA;IAAJ/B,IAAI,CAAA+B,KAAA,QAAApD,SAAA,CAAAoD,KAAA;EAAA;EAChC,IAAIpC,SAAS,CAACa,GAAG,EAAE;IACjBb,SAAS,CAACa,GAAG,CAAAjB,KAAA,CAAbI,SAAS,EAAQK,IAAI,CAAC;IAEtB;EACF;EAEA,IAAIL,SAAS,CAACO,GAAG,EAAE;IACjBP,SAAS,CAACO,GAAG,CAAAX,KAAA,CAAbI,SAAS,EAAQK,IAAI,CAAC;IAEtB;EACF;EAEA,IAAIL,SAAS,CAACqC,IAAI,EAAE;IAClBrC,SAAS,CAACqC,IAAI,CAAAzC,KAAA,CAAdI,SAAS,EAASK,IAAI,CAAC;IAEvB;EACF;EACA,MAAM,IAAIiC,SAAS,CAAC,gEAAgE,CAAC;AACvF"}
|
package/dist/uuid-utils.js
CHANGED
|
@@ -21,14 +21,14 @@ var isRequired = function isRequired() {
|
|
|
21
21
|
throw Error('parameter is required');
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
* Constructs a Hydra ID for a given UUID and type.
|
|
26
|
-
*
|
|
27
|
-
* @export
|
|
28
|
-
* @param {string} type one of PEOPLE, TEAM, ROOM
|
|
29
|
-
* @param {any} id identifying the "TYPE" object
|
|
30
|
-
* @param {string} cluster containing the "TYPE" object
|
|
31
|
-
* @returns {string}
|
|
24
|
+
/**
|
|
25
|
+
* Constructs a Hydra ID for a given UUID and type.
|
|
26
|
+
*
|
|
27
|
+
* @export
|
|
28
|
+
* @param {string} type one of PEOPLE, TEAM, ROOM
|
|
29
|
+
* @param {any} id identifying the "TYPE" object
|
|
30
|
+
* @param {string} cluster containing the "TYPE" object
|
|
31
|
+
* @returns {string}
|
|
32
32
|
*/
|
|
33
33
|
function constructHydraId() {
|
|
34
34
|
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : isRequired();
|
|
@@ -44,19 +44,19 @@ function constructHydraId() {
|
|
|
44
44
|
return (0, _base.encode)("ciscospark://".concat(cluster, "/").concat(type.toUpperCase(), "/").concat(id));
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
/**
|
|
48
|
-
* @typedef {Object} DeconstructedHydraId
|
|
49
|
-
* @property {UUID} id identifying the object
|
|
50
|
-
* @property {String} type of the object
|
|
51
|
-
* @property {String} cluster containing the object
|
|
47
|
+
/**
|
|
48
|
+
* @typedef {Object} DeconstructedHydraId
|
|
49
|
+
* @property {UUID} id identifying the object
|
|
50
|
+
* @property {String} type of the object
|
|
51
|
+
* @property {String} cluster containing the object
|
|
52
52
|
*/
|
|
53
53
|
|
|
54
|
-
/**
|
|
55
|
-
* Deconstructs a Hydra ID.
|
|
56
|
-
*
|
|
57
|
-
* @export
|
|
58
|
-
* @param {String} id Hydra style id
|
|
59
|
-
* @returns {DeconstructedHydraId} deconstructed id
|
|
54
|
+
/**
|
|
55
|
+
* Deconstructs a Hydra ID.
|
|
56
|
+
*
|
|
57
|
+
* @export
|
|
58
|
+
* @param {String} id Hydra style id
|
|
59
|
+
* @returns {DeconstructedHydraId} deconstructed id
|
|
60
60
|
*/
|
|
61
61
|
function deconstructHydraId(id) {
|
|
62
62
|
var payload = (0, _base.decode)(id).split('/');
|
|
@@ -67,75 +67,75 @@ function deconstructHydraId(id) {
|
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
/**
|
|
71
|
-
* Constructs a Hydra ID for a message based on internal UUID
|
|
72
|
-
*
|
|
73
|
-
* @export
|
|
74
|
-
* @param {any} uuid
|
|
75
|
-
* @param {string} cluster containing the message
|
|
76
|
-
* @returns {string}
|
|
70
|
+
/**
|
|
71
|
+
* Constructs a Hydra ID for a message based on internal UUID
|
|
72
|
+
*
|
|
73
|
+
* @export
|
|
74
|
+
* @param {any} uuid
|
|
75
|
+
* @param {string} cluster containing the message
|
|
76
|
+
* @returns {string}
|
|
77
77
|
*/
|
|
78
78
|
function buildHydraMessageId(uuid, cluster) {
|
|
79
79
|
return constructHydraId(_constants.hydraTypes.MESSAGE, uuid, cluster);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
/**
|
|
83
|
-
* Constructs a Hydra ID for a person based on internal UUID
|
|
84
|
-
*
|
|
85
|
-
* @export
|
|
86
|
-
* @param {any} uuid
|
|
87
|
-
* @param {string} cluster containing the person
|
|
88
|
-
* @returns {string}
|
|
82
|
+
/**
|
|
83
|
+
* Constructs a Hydra ID for a person based on internal UUID
|
|
84
|
+
*
|
|
85
|
+
* @export
|
|
86
|
+
* @param {any} uuid
|
|
87
|
+
* @param {string} cluster containing the person
|
|
88
|
+
* @returns {string}
|
|
89
89
|
*/
|
|
90
90
|
function buildHydraPersonId(uuid, cluster) {
|
|
91
91
|
return constructHydraId(_constants.hydraTypes.PEOPLE, uuid, cluster);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
/**
|
|
95
|
-
* Constructs a Hydra ID for a room based on internal UUID
|
|
96
|
-
*
|
|
97
|
-
* @export
|
|
98
|
-
* @param {any} uuid
|
|
99
|
-
* @param {string} cluster containing the room
|
|
100
|
-
* @returns {string}
|
|
94
|
+
/**
|
|
95
|
+
* Constructs a Hydra ID for a room based on internal UUID
|
|
96
|
+
*
|
|
97
|
+
* @export
|
|
98
|
+
* @param {any} uuid
|
|
99
|
+
* @param {string} cluster containing the room
|
|
100
|
+
* @returns {string}
|
|
101
101
|
*/
|
|
102
102
|
function buildHydraRoomId(uuid, cluster) {
|
|
103
103
|
return constructHydraId(_constants.hydraTypes.ROOM, uuid, cluster);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
/**
|
|
107
|
-
* Constructs a Hydra ID for an organization based on internal UUID
|
|
108
|
-
*
|
|
109
|
-
* @export
|
|
110
|
-
* @param {any} uuid
|
|
111
|
-
* @param {string} cluster containing the organization
|
|
112
|
-
* @returns {string}
|
|
106
|
+
/**
|
|
107
|
+
* Constructs a Hydra ID for an organization based on internal UUID
|
|
108
|
+
*
|
|
109
|
+
* @export
|
|
110
|
+
* @param {any} uuid
|
|
111
|
+
* @param {string} cluster containing the organization
|
|
112
|
+
* @returns {string}
|
|
113
113
|
*/
|
|
114
114
|
function buildHydraOrgId(uuid, cluster) {
|
|
115
115
|
return constructHydraId(_constants.hydraTypes.ORGANIZATION, uuid, cluster);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
/**
|
|
119
|
-
* Constructs a Hydra ID for an membership based on an
|
|
120
|
-
* internal UUID for the person, and the space
|
|
121
|
-
*
|
|
122
|
-
* @export
|
|
123
|
-
* @param {any} personUUID
|
|
124
|
-
* @param {any} spaceUUID
|
|
125
|
-
* @param {string} cluster containing the membership
|
|
126
|
-
* @returns {string}
|
|
118
|
+
/**
|
|
119
|
+
* Constructs a Hydra ID for an membership based on an
|
|
120
|
+
* internal UUID for the person, and the space
|
|
121
|
+
*
|
|
122
|
+
* @export
|
|
123
|
+
* @param {any} personUUID
|
|
124
|
+
* @param {any} spaceUUID
|
|
125
|
+
* @param {string} cluster containing the membership
|
|
126
|
+
* @returns {string}
|
|
127
127
|
*/
|
|
128
128
|
function buildHydraMembershipId(personUUID, spaceUUID, cluster) {
|
|
129
129
|
return constructHydraId(_constants.hydraTypes.MEMBERSHIP, "".concat(personUUID, ":").concat(spaceUUID), cluster);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
/**
|
|
133
|
-
* Returns a hydra cluster string based on a conversation url
|
|
134
|
-
* @private
|
|
135
|
-
* @memberof Messages
|
|
136
|
-
* @param {Object} webex sdk instance
|
|
137
|
-
* @param {String} conversationUrl url of space where activity took place
|
|
138
|
-
* @returns {String} string suitable for UUID -> public ID encoding
|
|
132
|
+
/**
|
|
133
|
+
* Returns a hydra cluster string based on a conversation url
|
|
134
|
+
* @private
|
|
135
|
+
* @memberof Messages
|
|
136
|
+
* @param {Object} webex sdk instance
|
|
137
|
+
* @param {String} conversationUrl url of space where activity took place
|
|
138
|
+
* @returns {String} string suitable for UUID -> public ID encoding
|
|
139
139
|
*/
|
|
140
140
|
function getHydraClusterString(webex, conversationUrl) {
|
|
141
141
|
var internalClusterString = webex.internal.services.getClusterId(conversationUrl);
|
|
@@ -150,12 +150,12 @@ function getHydraClusterString(webex, conversationUrl) {
|
|
|
150
150
|
return "".concat(clusterParts[0], ":").concat(clusterParts[1], ":").concat(clusterParts[2]);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
/**
|
|
154
|
-
* Returns a Hydra roomType based on conversation tags
|
|
155
|
-
*
|
|
156
|
-
* @export
|
|
157
|
-
* @param {arra} tags
|
|
158
|
-
* @returns {string}
|
|
153
|
+
/**
|
|
154
|
+
* Returns a Hydra roomType based on conversation tags
|
|
155
|
+
*
|
|
156
|
+
* @export
|
|
157
|
+
* @param {arra} tags
|
|
158
|
+
* @returns {string}
|
|
159
159
|
*/
|
|
160
160
|
function getHydraRoomType(tags) {
|
|
161
161
|
if (tags.includes(_constants.SDK_EVENT.INTERNAL.ACTIVITY_TAG.ONE_ON_ONE)) {
|
|
@@ -164,13 +164,13 @@ function getHydraRoomType(tags) {
|
|
|
164
164
|
return _constants.SDK_EVENT.EXTERNAL.SPACE_TYPE.GROUP;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
/**
|
|
168
|
-
* Returns file URLs for the activity, adhering to Hydra details,
|
|
169
|
-
* e.g., https://api.ciscospark.com/v1/contents/Y2lzY29zcGF...
|
|
170
|
-
* @see https://developer.webex.com/docs/api/v1/messages/get-message-details
|
|
171
|
-
* @param {Object} activity from mercury
|
|
172
|
-
* @param {string} cluster containing the files
|
|
173
|
-
* @returns {Array} file URLs
|
|
167
|
+
/**
|
|
168
|
+
* Returns file URLs for the activity, adhering to Hydra details,
|
|
169
|
+
* e.g., https://api.ciscospark.com/v1/contents/Y2lzY29zcGF...
|
|
170
|
+
* @see https://developer.webex.com/docs/api/v1/messages/get-message-details
|
|
171
|
+
* @param {Object} activity from mercury
|
|
172
|
+
* @param {string} cluster containing the files
|
|
173
|
+
* @returns {Array} file URLs
|
|
174
174
|
*/
|
|
175
175
|
function getHydraFiles(activity, cluster) {
|
|
176
176
|
var hydraFiles = [];
|
package/dist/uuid-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_base","require","_constants","hydraBaseUrl","isRequired","Error","constructHydraId","type","arguments","length","undefined","id","cluster","toUpperCase","hydraTypes","PEOPLE","ORGANIZATION","encode","concat","deconstructHydraId","payload","decode","split","pop","buildHydraMessageId","uuid","MESSAGE","buildHydraPersonId","buildHydraRoomId","ROOM","buildHydraOrgId","buildHydraMembershipId","personUUID","spaceUUID","MEMBERSHIP","getHydraClusterString","webex","conversationUrl","internalClusterString","internal","services","getClusterId","startsWith","INTERNAL_US_CLUSTER_NAME","INTERNAL_US_INTEGRATION_CLUSTER_NAME","clusterParts","getHydraRoomType","tags","includes","SDK_EVENT","INTERNAL","ACTIVITY_TAG","ONE_ON_ONE","EXTERNAL","SPACE_TYPE","DIRECT","GROUP","getHydraFiles","activity","hydraFiles","files","object","items","i","contentId","CONTENT","push"],"sources":["uuid-utils.js"],"sourcesContent":["import {encode, decode} from './base64';\r\nimport {\r\n SDK_EVENT,\r\n hydraTypes,\r\n INTERNAL_US_CLUSTER_NAME,\r\n INTERNAL_US_INTEGRATION_CLUSTER_NAME,\r\n} from './constants';\r\n\r\nconst hydraBaseUrl = 'https://api.ciscospark.com/v1';\r\n\r\nconst isRequired = () => {\r\n throw Error('parameter is required');\r\n};\r\n\r\n/**\r\n * Constructs a Hydra ID for a given UUID and type.\r\n *\r\n * @export\r\n * @param {string} type one of PEOPLE, TEAM, ROOM\r\n * @param {any} id identifying the \"TYPE\" object\r\n * @param {string} cluster containing the \"TYPE\" object\r\n * @returns {string}\r\n */\r\nexport function constructHydraId(type = isRequired(), id = isRequired(), cluster = 'us') {\r\n if (!type.toUpperCase) {\r\n throw Error('\"type\" must be a string');\r\n }\r\n\r\n if (type === hydraTypes.PEOPLE || type === hydraTypes.ORGANIZATION) {\r\n // Cluster is always \"us\" for people and orgs\r\n return encode(`ciscospark://us/${type.toUpperCase()}/${id}`);\r\n }\r\n\r\n return encode(`ciscospark://${cluster}/${type.toUpperCase()}/${id}`);\r\n}\r\n\r\n/**\r\n * @typedef {Object} DeconstructedHydraId\r\n * @property {UUID} id identifying the object\r\n * @property {String} type of the object\r\n * @property {String} cluster containing the object\r\n */\r\n\r\n/**\r\n * Deconstructs a Hydra ID.\r\n *\r\n * @export\r\n * @param {String} id Hydra style id\r\n * @returns {DeconstructedHydraId} deconstructed id\r\n */\r\nexport function deconstructHydraId(id) {\r\n const payload = decode(id).split('/');\r\n\r\n return {\r\n id: payload.pop(),\r\n type: payload.pop(),\r\n cluster: payload.pop(),\r\n };\r\n}\r\n\r\n/**\r\n * Constructs a Hydra ID for a message based on internal UUID\r\n *\r\n * @export\r\n * @param {any} uuid\r\n * @param {string} cluster containing the message\r\n * @returns {string}\r\n */\r\nexport function buildHydraMessageId(uuid, cluster) {\r\n return constructHydraId(hydraTypes.MESSAGE, uuid, cluster);\r\n}\r\n\r\n/**\r\n * Constructs a Hydra ID for a person based on internal UUID\r\n *\r\n * @export\r\n * @param {any} uuid\r\n * @param {string} cluster containing the person\r\n * @returns {string}\r\n */\r\nexport function buildHydraPersonId(uuid, cluster) {\r\n return constructHydraId(hydraTypes.PEOPLE, uuid, cluster);\r\n}\r\n\r\n/**\r\n * Constructs a Hydra ID for a room based on internal UUID\r\n *\r\n * @export\r\n * @param {any} uuid\r\n * @param {string} cluster containing the room\r\n * @returns {string}\r\n */\r\nexport function buildHydraRoomId(uuid, cluster) {\r\n return constructHydraId(hydraTypes.ROOM, uuid, cluster);\r\n}\r\n\r\n/**\r\n * Constructs a Hydra ID for an organization based on internal UUID\r\n *\r\n * @export\r\n * @param {any} uuid\r\n * @param {string} cluster containing the organization\r\n * @returns {string}\r\n */\r\nexport function buildHydraOrgId(uuid, cluster) {\r\n return constructHydraId(hydraTypes.ORGANIZATION, uuid, cluster);\r\n}\r\n\r\n/**\r\n * Constructs a Hydra ID for an membership based on an\r\n * internal UUID for the person, and the space\r\n *\r\n * @export\r\n * @param {any} personUUID\r\n * @param {any} spaceUUID\r\n * @param {string} cluster containing the membership\r\n * @returns {string}\r\n */\r\nexport function buildHydraMembershipId(personUUID, spaceUUID, cluster) {\r\n return constructHydraId(hydraTypes.MEMBERSHIP, `${personUUID}:${spaceUUID}`, cluster);\r\n}\r\n\r\n/**\r\n * Returns a hydra cluster string based on a conversation url\r\n * @private\r\n * @memberof Messages\r\n * @param {Object} webex sdk instance\r\n * @param {String} conversationUrl url of space where activity took place\r\n * @returns {String} string suitable for UUID -> public ID encoding\r\n */\r\nexport function getHydraClusterString(webex, conversationUrl) {\r\n const internalClusterString = webex.internal.services.getClusterId(conversationUrl);\r\n\r\n if (\r\n internalClusterString.startsWith(INTERNAL_US_CLUSTER_NAME) ||\r\n internalClusterString.startsWith(INTERNAL_US_INTEGRATION_CLUSTER_NAME)\r\n ) {\r\n // Original US cluster is simply 'us' for backwards compatibility\r\n return 'us';\r\n }\r\n const clusterParts = internalClusterString.split(':');\r\n\r\n if (clusterParts.length < 3) {\r\n throw Error(`Unable to determine cluster for convo: ${conversationUrl}`);\r\n }\r\n\r\n return `${clusterParts[0]}:${clusterParts[1]}:${clusterParts[2]}`;\r\n}\r\n\r\n/**\r\n * Returns a Hydra roomType based on conversation tags\r\n *\r\n * @export\r\n * @param {arra} tags\r\n * @returns {string}\r\n */\r\nexport function getHydraRoomType(tags) {\r\n if (tags.includes(SDK_EVENT.INTERNAL.ACTIVITY_TAG.ONE_ON_ONE)) {\r\n return SDK_EVENT.EXTERNAL.SPACE_TYPE.DIRECT;\r\n }\r\n\r\n return SDK_EVENT.EXTERNAL.SPACE_TYPE.GROUP;\r\n}\r\n\r\n/**\r\n * Returns file URLs for the activity, adhering to Hydra details,\r\n * e.g., https://api.ciscospark.com/v1/contents/Y2lzY29zcGF...\r\n * @see https://developer.webex.com/docs/api/v1/messages/get-message-details\r\n * @param {Object} activity from mercury\r\n * @param {string} cluster containing the files\r\n * @returns {Array} file URLs\r\n */\r\nexport function getHydraFiles(activity, cluster) {\r\n const hydraFiles = [];\r\n const {files} = activity.object;\r\n\r\n if (files) {\r\n const {items} = files;\r\n\r\n // Note: Generated ID is dependent on file order.\r\n for (let i = 0; i < items.length; i += 1) {\r\n const contentId = constructHydraId(hydraTypes.CONTENT, `${activity.id}/${i}`, cluster);\r\n\r\n hydraFiles.push(`${hydraBaseUrl}/contents/${contentId}`);\r\n }\r\n }\r\n\r\n return hydraFiles;\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAOA,IAAME,YAAY,GAAG,+BAA+B;AAEpD,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAA,EAAS;EACvB,MAAMC,KAAK,CAAC,uBAAuB,CAAC;AACtC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAAA,EAAyD;EAAA,IAAxDC,IAAI,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGJ,UAAU,EAAE;EAAA,IAAEO,EAAE,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGJ,UAAU,EAAE;EAAA,IAAEQ,OAAO,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EACrF,IAAI,CAACD,IAAI,CAACM,WAAW,EAAE;IACrB,MAAMR,KAAK,CAAC,yBAAyB,CAAC;EACxC;EAEA,IAAIE,IAAI,KAAKO,qBAAU,CAACC,MAAM,IAAIR,IAAI,KAAKO,qBAAU,CAACE,YAAY,EAAE;IAClE;IACA,OAAO,IAAAC,YAAM,qBAAAC,MAAA,CAAoBX,IAAI,CAACM,WAAW,EAAE,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ACA;AACA;AACA;AACA;AACA;AACO,SAASC,aAAaA,CAACC,QAAQ,EAAE9C,OAAO,EAAE;EAC/C,IAAM+C,UAAU,GAAG,EAAE;EACrB,IAAOC,KAAK,GAAIF,QAAQ,CAACG,MAAM,CAAxBD,KAAK;EAEZ,IAAIA,KAAK,EAAE;IACT,IAAOE,KAAK,GAAIF,KAAK,CAAdE,KAAK;;IAEZ;IACA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,KAAK,CAACrD,MAAM,EAAEsD,CAAC,IAAI,CAAC,EAAE;MACxC,IAAMC,SAAS,GAAG1D,gBAAgB,CAACQ,qBAAU,CAACmD,OAAO,KAAA/C,MAAA,CAAKwC,QAAQ,CAAC/C,EAAE,OAAAO,MAAA,CAAI6C,CAAC,GAAInD,OAAO,CAAC;MAEtF+C,UAAU,CAACO,IAAI,IAAAhD,MAAA,CAAIf,YAAY,gBAAAe,MAAA,CAAa8C,SAAS,EAAG;IAC1D;EACF;EAEA,OAAOL,UAAU;AACnB"}
|
|
1
|
+
{"version":3,"names":["_base","require","_constants","hydraBaseUrl","isRequired","Error","constructHydraId","type","arguments","length","undefined","id","cluster","toUpperCase","hydraTypes","PEOPLE","ORGANIZATION","encode","concat","deconstructHydraId","payload","decode","split","pop","buildHydraMessageId","uuid","MESSAGE","buildHydraPersonId","buildHydraRoomId","ROOM","buildHydraOrgId","buildHydraMembershipId","personUUID","spaceUUID","MEMBERSHIP","getHydraClusterString","webex","conversationUrl","internalClusterString","internal","services","getClusterId","startsWith","INTERNAL_US_CLUSTER_NAME","INTERNAL_US_INTEGRATION_CLUSTER_NAME","clusterParts","getHydraRoomType","tags","includes","SDK_EVENT","INTERNAL","ACTIVITY_TAG","ONE_ON_ONE","EXTERNAL","SPACE_TYPE","DIRECT","GROUP","getHydraFiles","activity","hydraFiles","files","object","items","i","contentId","CONTENT","push"],"sources":["uuid-utils.js"],"sourcesContent":["import {encode, decode} from './base64';\nimport {\n SDK_EVENT,\n hydraTypes,\n INTERNAL_US_CLUSTER_NAME,\n INTERNAL_US_INTEGRATION_CLUSTER_NAME,\n} from './constants';\n\nconst hydraBaseUrl = 'https://api.ciscospark.com/v1';\n\nconst isRequired = () => {\n throw Error('parameter is required');\n};\n\n/**\n * Constructs a Hydra ID for a given UUID and type.\n *\n * @export\n * @param {string} type one of PEOPLE, TEAM, ROOM\n * @param {any} id identifying the \"TYPE\" object\n * @param {string} cluster containing the \"TYPE\" object\n * @returns {string}\n */\nexport function constructHydraId(type = isRequired(), id = isRequired(), cluster = 'us') {\n if (!type.toUpperCase) {\n throw Error('\"type\" must be a string');\n }\n\n if (type === hydraTypes.PEOPLE || type === hydraTypes.ORGANIZATION) {\n // Cluster is always \"us\" for people and orgs\n return encode(`ciscospark://us/${type.toUpperCase()}/${id}`);\n }\n\n return encode(`ciscospark://${cluster}/${type.toUpperCase()}/${id}`);\n}\n\n/**\n * @typedef {Object} DeconstructedHydraId\n * @property {UUID} id identifying the object\n * @property {String} type of the object\n * @property {String} cluster containing the object\n */\n\n/**\n * Deconstructs a Hydra ID.\n *\n * @export\n * @param {String} id Hydra style id\n * @returns {DeconstructedHydraId} deconstructed id\n */\nexport function deconstructHydraId(id) {\n const payload = decode(id).split('/');\n\n return {\n id: payload.pop(),\n type: payload.pop(),\n cluster: payload.pop(),\n };\n}\n\n/**\n * Constructs a Hydra ID for a message based on internal UUID\n *\n * @export\n * @param {any} uuid\n * @param {string} cluster containing the message\n * @returns {string}\n */\nexport function buildHydraMessageId(uuid, cluster) {\n return constructHydraId(hydraTypes.MESSAGE, uuid, cluster);\n}\n\n/**\n * Constructs a Hydra ID for a person based on internal UUID\n *\n * @export\n * @param {any} uuid\n * @param {string} cluster containing the person\n * @returns {string}\n */\nexport function buildHydraPersonId(uuid, cluster) {\n return constructHydraId(hydraTypes.PEOPLE, uuid, cluster);\n}\n\n/**\n * Constructs a Hydra ID for a room based on internal UUID\n *\n * @export\n * @param {any} uuid\n * @param {string} cluster containing the room\n * @returns {string}\n */\nexport function buildHydraRoomId(uuid, cluster) {\n return constructHydraId(hydraTypes.ROOM, uuid, cluster);\n}\n\n/**\n * Constructs a Hydra ID for an organization based on internal UUID\n *\n * @export\n * @param {any} uuid\n * @param {string} cluster containing the organization\n * @returns {string}\n */\nexport function buildHydraOrgId(uuid, cluster) {\n return constructHydraId(hydraTypes.ORGANIZATION, uuid, cluster);\n}\n\n/**\n * Constructs a Hydra ID for an membership based on an\n * internal UUID for the person, and the space\n *\n * @export\n * @param {any} personUUID\n * @param {any} spaceUUID\n * @param {string} cluster containing the membership\n * @returns {string}\n */\nexport function buildHydraMembershipId(personUUID, spaceUUID, cluster) {\n return constructHydraId(hydraTypes.MEMBERSHIP, `${personUUID}:${spaceUUID}`, cluster);\n}\n\n/**\n * Returns a hydra cluster string based on a conversation url\n * @private\n * @memberof Messages\n * @param {Object} webex sdk instance\n * @param {String} conversationUrl url of space where activity took place\n * @returns {String} string suitable for UUID -> public ID encoding\n */\nexport function getHydraClusterString(webex, conversationUrl) {\n const internalClusterString = webex.internal.services.getClusterId(conversationUrl);\n\n if (\n internalClusterString.startsWith(INTERNAL_US_CLUSTER_NAME) ||\n internalClusterString.startsWith(INTERNAL_US_INTEGRATION_CLUSTER_NAME)\n ) {\n // Original US cluster is simply 'us' for backwards compatibility\n return 'us';\n }\n const clusterParts = internalClusterString.split(':');\n\n if (clusterParts.length < 3) {\n throw Error(`Unable to determine cluster for convo: ${conversationUrl}`);\n }\n\n return `${clusterParts[0]}:${clusterParts[1]}:${clusterParts[2]}`;\n}\n\n/**\n * Returns a Hydra roomType based on conversation tags\n *\n * @export\n * @param {arra} tags\n * @returns {string}\n */\nexport function getHydraRoomType(tags) {\n if (tags.includes(SDK_EVENT.INTERNAL.ACTIVITY_TAG.ONE_ON_ONE)) {\n return SDK_EVENT.EXTERNAL.SPACE_TYPE.DIRECT;\n }\n\n return SDK_EVENT.EXTERNAL.SPACE_TYPE.GROUP;\n}\n\n/**\n * Returns file URLs for the activity, adhering to Hydra details,\n * e.g., https://api.ciscospark.com/v1/contents/Y2lzY29zcGF...\n * @see https://developer.webex.com/docs/api/v1/messages/get-message-details\n * @param {Object} activity from mercury\n * @param {string} cluster containing the files\n * @returns {Array} file URLs\n */\nexport function getHydraFiles(activity, cluster) {\n const hydraFiles = [];\n const {files} = activity.object;\n\n if (files) {\n const {items} = files;\n\n // Note: Generated ID is dependent on file order.\n for (let i = 0; i < items.length; i += 1) {\n const contentId = constructHydraId(hydraTypes.CONTENT, `${activity.id}/${i}`, cluster);\n\n hydraFiles.push(`${hydraBaseUrl}/contents/${contentId}`);\n }\n }\n\n return hydraFiles;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAOA,IAAME,YAAY,GAAG,+BAA+B;AAEpD,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAA,EAAS;EACvB,MAAMC,KAAK,CAAC,uBAAuB,CAAC;AACtC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAAA,EAAyD;EAAA,IAAxDC,IAAI,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGJ,UAAU,EAAE;EAAA,IAAEO,EAAE,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGJ,UAAU,EAAE;EAAA,IAAEQ,OAAO,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EACrF,IAAI,CAACD,IAAI,CAACM,WAAW,EAAE;IACrB,MAAMR,KAAK,CAAC,yBAAyB,CAAC;EACxC;EAEA,IAAIE,IAAI,KAAKO,qBAAU,CAACC,MAAM,IAAIR,IAAI,KAAKO,qBAAU,CAACE,YAAY,EAAE;IAClE;IACA,OAAO,IAAAC,YAAM,qBAA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AAU,CAACE,KAAK;AAC5C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,aAAaA,CAACC,QAAQ,EAAE9C,OAAO,EAAE;EAC/C,IAAM+C,UAAU,GAAG,EAAE;EACrB,IAAOC,KAAK,GAAIF,QAAQ,CAACG,MAAM,CAAxBD,KAAK;EAEZ,IAAIA,KAAK,EAAE;IACT,IAAOE,KAAK,GAAIF,KAAK,CAAdE,KAAK;;IAEZ;IACA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,KAAK,CAACrD,MAAM,EAAEsD,CAAC,IAAI,CAAC,EAAE;MACxC,IAAMC,SAAS,GAAG1D,gBAAgB,CAACQ,qBAAU,CAACmD,OAAO,KAAA/C,MAAA,CAAKwC,QAAQ,CAAC/C,EAAE,OAAAO,MAAA,CAAI6C,CAAC,GAAInD,OAAO,CAAC;MAEtF+C,UAAU,CAACO,IAAI,IAAAhD,MAAA,CAAIf,YAAY,gBAAAe,MAAA,CAAa8C,SAAS,EAAG;IAC1D;EACF;EAEA,OAAOL,UAAU;AACnB"}
|
package/dist/while-in-flight.js
CHANGED
|
@@ -10,11 +10,11 @@ var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/pr
|
|
|
10
10
|
var _apply = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/apply"));
|
|
11
11
|
var _wrap2 = _interopRequireDefault(require("lodash/wrap"));
|
|
12
12
|
var _tap = _interopRequireDefault(require("./tap"));
|
|
13
|
-
/**
|
|
14
|
-
* While the promise returned by the decorated is unfullfilled, sets, the
|
|
15
|
-
* specified boolean on the target class to `true`
|
|
16
|
-
* @param {string} param
|
|
17
|
-
* @returns {Function}
|
|
13
|
+
/**
|
|
14
|
+
* While the promise returned by the decorated is unfullfilled, sets, the
|
|
15
|
+
* specified boolean on the target class to `true`
|
|
16
|
+
* @param {string} param
|
|
17
|
+
* @returns {Function}
|
|
18
18
|
*/
|
|
19
19
|
function whileInFlight(param) {
|
|
20
20
|
return function whileInFlightDecorator(target, name, descriptor) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_tap","_interopRequireDefault","require","whileInFlight","param","whileInFlightDecorator","target","name","descriptor","value","_wrap2","default","whileInFlightExecutor","fn","_this","_len","arguments","length","args","Array","_key","_promise","resolve","_apply","then","tap","catch","reason","reject"],"sources":["while-in-flight.js"],"sourcesContent":["/*!\
|
|
1
|
+
{"version":3,"names":["_tap","_interopRequireDefault","require","whileInFlight","param","whileInFlightDecorator","target","name","descriptor","value","_wrap2","default","whileInFlightExecutor","fn","_this","_len","arguments","length","args","Array","_key","_promise","resolve","_apply","then","tap","catch","reason","reject"],"sources":["while-in-flight.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint no-invalid-this: [0] */\n\nimport {wrap} from 'lodash';\n\nimport tap from './tap';\n\n/**\n * While the promise returned by the decorated is unfullfilled, sets, the\n * specified boolean on the target class to `true`\n * @param {string} param\n * @returns {Function}\n */\nexport default function whileInFlight(param) {\n return function whileInFlightDecorator(target, name, descriptor) {\n descriptor.value = wrap(descriptor.value, function whileInFlightExecutor(fn, ...args) {\n return new Promise((resolve) => {\n this[param] = true;\n resolve(\n Reflect.apply(fn, this, args)\n .then(\n tap(() => {\n this[param] = false;\n })\n )\n .catch((reason) => {\n this[param] = false;\n\n return Promise.reject(reason);\n })\n );\n });\n });\n };\n}\n"],"mappings":";;;;;;;;;;;AAQA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,aAAaA,CAACC,KAAK,EAAE;EAC3C,OAAO,SAASC,sBAAsBA,CAACC,MAAM,EAAEC,IAAI,EAAEC,UAAU,EAAE;IAC/DA,UAAU,CAACC,KAAK,GAAG,IAAAC,MAAA,CAAAC,OAAA,EAAKH,UAAU,CAACC,KAAK,EAAE,SAASG,qBAAqBA,CAACC,EAAE,EAAW;MAAA,IAAAC,KAAA;MAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAANC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,OAAAA,IAAA,WAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;QAAJF,IAAI,CAAAE,IAAA,QAAAJ,SAAA,CAAAI,IAAA;MAAA;MAClF,OAAO,IAAAC,QAAA,CAAAV,OAAA,CAAY,UAACW,OAAO,EAAK;QAC9BR,KAAI,CAACV,KAAK,CAAC,GAAG,IAAI;QAClBkB,OAAO,CACL,IAAAC,MAAA,CAAAZ,OAAA,EAAcE,EAAE,EAAEC,KAAI,EAAEI,IAAI,CAAC,CAC1BM,IAAI,CACH,IAAAC,YAAG,EAAC,YAAM;UACRX,KAAI,CAACV,KAAK,CAAC,GAAG,KAAK;QACrB,CAAC,CAAC,CACH,CACAsB,KAAK,CAAC,UAACC,MAAM,EAAK;UACjBb,KAAI,CAACV,KAAK,CAAC,GAAG,KAAK;UAEnB,OAAOiB,QAAA,CAAAV,OAAA,CAAQiB,MAAM,CAACD,MAAM,CAAC;QAC/B,CAAC,CAAC,CACL;MACH,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC;AACH"}
|
package/jest.config.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const config = require('@webex/jest-config-legacy');
|
|
2
|
-
|
|
3
|
-
module.exports = config;
|
|
1
|
+
const config = require('@webex/jest-config-legacy');
|
|
2
|
+
|
|
3
|
+
module.exports = config;
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/common",
|
|
3
|
+
"version": "2.59.4",
|
|
3
4
|
"description": "Common utilities for Cisco Webex",
|
|
4
5
|
"license": "MIT",
|
|
5
6
|
"main": "dist/index.js",
|
|
@@ -25,14 +26,14 @@
|
|
|
25
26
|
"devDependencies": {
|
|
26
27
|
"@babel/core": "^7.17.10",
|
|
27
28
|
"@sinonjs/fake-timers": "^6.0.1",
|
|
28
|
-
"@webex/babel-config-legacy": "
|
|
29
|
-
"@webex/eslint-config-legacy": "
|
|
30
|
-
"@webex/jest-config-legacy": "
|
|
31
|
-
"@webex/legacy-tools": "
|
|
32
|
-
"@webex/test-helper-chai": "
|
|
33
|
-
"@webex/test-helper-mocha": "
|
|
34
|
-
"@webex/test-helper-mock-webex": "
|
|
35
|
-
"@webex/test-helper-test-users": "
|
|
29
|
+
"@webex/babel-config-legacy": "2.59.4",
|
|
30
|
+
"@webex/eslint-config-legacy": "2.59.4",
|
|
31
|
+
"@webex/jest-config-legacy": "2.59.4",
|
|
32
|
+
"@webex/legacy-tools": "2.59.4",
|
|
33
|
+
"@webex/test-helper-chai": "2.59.4",
|
|
34
|
+
"@webex/test-helper-mocha": "2.59.4",
|
|
35
|
+
"@webex/test-helper-mock-webex": "2.59.4",
|
|
36
|
+
"@webex/test-helper-test-users": "2.59.4",
|
|
36
37
|
"ampersand-state": "^5.0.3",
|
|
37
38
|
"eslint": "^8.24.0",
|
|
38
39
|
"prettier": "^2.7.1",
|
|
@@ -50,12 +51,10 @@
|
|
|
50
51
|
"scripts": {
|
|
51
52
|
"build": "yarn build:src",
|
|
52
53
|
"build:src": "webex-legacy-tools build -dest \"./dist\" -src \"./src\" -js -ts -maps",
|
|
53
|
-
"deploy:npm": "yarn npm publish",
|
|
54
54
|
"test": "yarn test:style && yarn test:unit && yarn test:integration && yarn test:browser",
|
|
55
55
|
"test:browser": "webex-legacy-tools test --integration --unit --runner karma",
|
|
56
56
|
"test:integration": "webex-legacy-tools test --integration --runner mocha",
|
|
57
57
|
"test:style": "eslint ./src/**/*.*",
|
|
58
58
|
"test:unit": "webex-legacy-tools test --unit --runner jest"
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
}
|
|
59
|
+
}
|
|
60
|
+
}
|
package/process
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = {browser: true};
|
|
1
|
+
module.exports = {browser: true};
|