@webex/common 3.0.0-beta.8 → 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.
Files changed (95) hide show
  1. package/dist/base64.js +4 -18
  2. package/dist/base64.js.map +1 -1
  3. package/dist/browser-detection.js +0 -21
  4. package/dist/browser-detection.js.map +1 -1
  5. package/dist/capped-debounce.js +6 -16
  6. package/dist/capped-debounce.js.map +1 -1
  7. package/dist/check-required.js +0 -3
  8. package/dist/check-required.js.map +1 -1
  9. package/dist/constants.js +0 -2
  10. package/dist/constants.js.map +1 -1
  11. package/dist/defer.js +0 -7
  12. package/dist/defer.js.map +1 -1
  13. package/dist/deprecated.js +0 -5
  14. package/dist/deprecated.js.map +1 -1
  15. package/dist/event-envelope.js +16 -31
  16. package/dist/event-envelope.js.map +1 -1
  17. package/dist/events.js +3 -14
  18. package/dist/events.js.map +1 -1
  19. package/dist/exception.js +1 -28
  20. package/dist/exception.js.map +1 -1
  21. package/dist/in-browser/browser.js +0 -3
  22. package/dist/in-browser/browser.js.map +1 -1
  23. package/dist/in-browser/index.js +0 -4
  24. package/dist/in-browser/index.js.map +1 -1
  25. package/dist/in-browser/node.js +0 -3
  26. package/dist/in-browser/node.js.map +1 -1
  27. package/dist/index.js +1 -60
  28. package/dist/index.js.map +1 -1
  29. package/dist/isBuffer.js +0 -4
  30. package/dist/isBuffer.js.map +1 -1
  31. package/dist/make-state-datatype.js +4 -9
  32. package/dist/make-state-datatype.js.map +1 -1
  33. package/dist/one-flight.js +8 -30
  34. package/dist/one-flight.js.map +1 -1
  35. package/dist/patterns.js +0 -8
  36. package/dist/patterns.js.map +1 -1
  37. package/dist/resolve-with.js +0 -5
  38. package/dist/resolve-with.js.map +1 -1
  39. package/dist/retry.js +13 -39
  40. package/dist/retry.js.map +1 -1
  41. package/dist/tap.js +0 -5
  42. package/dist/tap.js.map +1 -1
  43. package/dist/template-container.js +10 -54
  44. package/dist/template-container.js.map +1 -1
  45. package/dist/types/base64.d.ts +38 -0
  46. package/dist/types/browser-detection.d.ts +8 -0
  47. package/dist/types/capped-debounce.d.ts +12 -0
  48. package/dist/types/check-required.d.ts +11 -0
  49. package/dist/types/constants.d.ts +76 -0
  50. package/dist/types/defer.d.ts +23 -0
  51. package/dist/types/deprecated.d.ts +7 -0
  52. package/dist/types/event-envelope.d.ts +13 -0
  53. package/dist/types/events.d.ts +15 -0
  54. package/dist/types/exception.d.ts +23 -0
  55. package/dist/types/in-browser/browser.d.ts +2 -0
  56. package/dist/types/in-browser/index.d.ts +1 -0
  57. package/dist/types/in-browser/node.d.ts +2 -0
  58. package/dist/types/index.d.ts +21 -0
  59. package/dist/types/isBuffer.d.ts +2 -0
  60. package/dist/types/make-state-datatype.d.ts +11 -0
  61. package/dist/types/one-flight.d.ts +9 -0
  62. package/dist/types/patterns.d.ts +8 -0
  63. package/dist/types/resolve-with.d.ts +22 -0
  64. package/dist/types/retry.d.ts +13 -0
  65. package/dist/types/tap.d.ts +17 -0
  66. package/dist/types/template-container.d.ts +59 -0
  67. package/dist/types/uuid-utils.d.ts +112 -0
  68. package/dist/types/while-in-flight.d.ts +7 -0
  69. package/dist/uuid-utils.js +12 -37
  70. package/dist/uuid-utils.js.map +1 -1
  71. package/dist/while-in-flight.js +0 -10
  72. package/dist/while-in-flight.js.map +1 -1
  73. package/package.json +3 -3
  74. package/src/base64.js +1 -1
  75. package/src/browser-detection.js +7 -6
  76. package/src/capped-debounce.js +2 -1
  77. package/src/constants.js +14 -14
  78. package/src/deprecated.js +3 -1
  79. package/src/event-envelope.js +25 -21
  80. package/src/events.js +1 -4
  81. package/src/exception.js +1 -2
  82. package/src/index.js +5 -7
  83. package/src/make-state-datatype.js +10 -6
  84. package/src/one-flight.js +1 -5
  85. package/src/patterns.js +5 -3
  86. package/src/retry.js +5 -6
  87. package/src/tap.js +6 -5
  88. package/src/template-container.js +3 -1
  89. package/src/uuid-utils.js +16 -16
  90. package/src/while-in-flight.js +12 -8
  91. package/test/unit/spec/capped-debounce.js +4 -1
  92. package/test/unit/spec/exception.js +1 -3
  93. package/test/unit/spec/one-flight.js +38 -55
  94. package/test/unit/spec/template-container.js +0 -1
  95. package/test/unit/spec/while-in-flight.js +8 -10
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Makes a promise-returning method retryable according to the specified backoff
3
+ * pattern
4
+ * @param {Object} options
5
+ * @param {boolean} options.backoff
6
+ * @param {number} options.delay
7
+ * @param {number} options.initialDelay
8
+ * @param {number} options.maxAttempts
9
+ * @param {number} options.maxDelay
10
+ *
11
+ * @returns {Function}
12
+ */
13
+ export default function retry(...params: any[]): Function;
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+ /**
5
+ * Injects code into a promise chain without modifying the promise chain's result
6
+ * @param {Function} fn
7
+ * @returns {Promise}
8
+ * @example
9
+ * function f() {
10
+ * return Promise.resolve(5);
11
+ * }
12
+ *
13
+ * f()
14
+ * .then(tap(() => 12))
15
+ * // => 5
16
+ */
17
+ export default function tap(fn: Function): Promise<any>;
@@ -0,0 +1,59 @@
1
+ export { make as default };
2
+ /**
3
+ * Factory which produces a multi-keyed container based on the provided set of
4
+ * constructors
5
+ * @param {mixed} containers
6
+ * @returns {Container}
7
+ */
8
+ declare function make(...containers: mixed): {
9
+ /**
10
+ * getter for .size
11
+ * @returns {number}
12
+ */
13
+ readonly size: number;
14
+ /**
15
+ * Identical to Container#set() but leads slightly more intuitive code when
16
+ * the container is based on a Set rather than a Map.
17
+ * @returns {Container}
18
+ */
19
+ add(...args: any[]): any;
20
+ /**
21
+ * Removes all items from the container
22
+ * @returns {undefined}
23
+ */
24
+ clear(): undefined;
25
+ /**
26
+ * Removes the specified item to the container
27
+ * @param {mixed} key
28
+ * @param {Array<mixed>} keys
29
+ * @returns {boolean}
30
+ */
31
+ delete(key: mixed, ...keys: Array<mixed>): boolean;
32
+ /**
33
+ * Retrieves the specified item from the container
34
+ * @param {mixed} key
35
+ * @param {Array<mixed>} keys
36
+ * @returns {mixed}
37
+ */
38
+ get(key: mixed, ...keys: Array<mixed>): mixed;
39
+ /**
40
+ * Indicates whether the container holds the specified item
41
+ * @param {mixed} key
42
+ * @param {Array<mixed>} keys
43
+ * @returns {Boolean}
44
+ */
45
+ has(...args: any[]): boolean;
46
+ /**
47
+ * Stores the specified item in the container
48
+ * @param {mixed} key
49
+ * @param {Array<mixed>} args
50
+ * @param {mixed} value
51
+ * @returns {Container}
52
+ */
53
+ set(...args: Array<mixed>): any;
54
+ /**
55
+ * @private
56
+ * @returns {string}
57
+ */
58
+ inspect(): string;
59
+ };
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Constructs a Hydra ID for a given UUID and type.
3
+ *
4
+ * @export
5
+ * @param {string} type one of PEOPLE, TEAM, ROOM
6
+ * @param {any} id identifying the "TYPE" object
7
+ * @param {string} cluster containing the "TYPE" object
8
+ * @returns {string}
9
+ */
10
+ export function constructHydraId(type?: string, id?: any, cluster?: string): string;
11
+ /**
12
+ * @typedef {Object} DeconstructedHydraId
13
+ * @property {UUID} id identifying the object
14
+ * @property {String} type of the object
15
+ * @property {String} cluster containing the object
16
+ */
17
+ /**
18
+ * Deconstructs a Hydra ID.
19
+ *
20
+ * @export
21
+ * @param {String} id Hydra style id
22
+ * @returns {DeconstructedHydraId} deconstructed id
23
+ */
24
+ export function deconstructHydraId(id: string): DeconstructedHydraId;
25
+ /**
26
+ * Constructs a Hydra ID for a message based on internal UUID
27
+ *
28
+ * @export
29
+ * @param {any} uuid
30
+ * @param {string} cluster containing the message
31
+ * @returns {string}
32
+ */
33
+ export function buildHydraMessageId(uuid: any, cluster: string): string;
34
+ /**
35
+ * Constructs a Hydra ID for a person based on internal UUID
36
+ *
37
+ * @export
38
+ * @param {any} uuid
39
+ * @param {string} cluster containing the person
40
+ * @returns {string}
41
+ */
42
+ export function buildHydraPersonId(uuid: any, cluster: string): string;
43
+ /**
44
+ * Constructs a Hydra ID for a room based on internal UUID
45
+ *
46
+ * @export
47
+ * @param {any} uuid
48
+ * @param {string} cluster containing the room
49
+ * @returns {string}
50
+ */
51
+ export function buildHydraRoomId(uuid: any, cluster: string): string;
52
+ /**
53
+ * Constructs a Hydra ID for an organization based on internal UUID
54
+ *
55
+ * @export
56
+ * @param {any} uuid
57
+ * @param {string} cluster containing the organization
58
+ * @returns {string}
59
+ */
60
+ export function buildHydraOrgId(uuid: any, cluster: string): string;
61
+ /**
62
+ * Constructs a Hydra ID for an membership based on an
63
+ * internal UUID for the person, and the space
64
+ *
65
+ * @export
66
+ * @param {any} personUUID
67
+ * @param {any} spaceUUID
68
+ * @param {string} cluster containing the membership
69
+ * @returns {string}
70
+ */
71
+ export function buildHydraMembershipId(personUUID: any, spaceUUID: any, cluster: string): string;
72
+ /**
73
+ * Returns a hydra cluster string based on a conversation url
74
+ * @private
75
+ * @memberof Messages
76
+ * @param {Object} webex sdk instance
77
+ * @param {String} conversationUrl url of space where activity took place
78
+ * @returns {String} string suitable for UUID -> public ID encoding
79
+ */
80
+ export function getHydraClusterString(webex: any, conversationUrl: string): string;
81
+ /**
82
+ * Returns a Hydra roomType based on conversation tags
83
+ *
84
+ * @export
85
+ * @param {arra} tags
86
+ * @param {any} spaceUUID
87
+ * @returns {string}
88
+ */
89
+ export function getHydraRoomType(tags: arra): string;
90
+ /**
91
+ * Returns file URLs for the activity, adhering to Hydra details,
92
+ * e.g., https://api.ciscospark.com/v1/contents/Y2lzY29zcGF...
93
+ * @see https://developer.webex.com/docs/api/v1/messages/get-message-details
94
+ * @param {Object} activity from mercury
95
+ * @param {string} cluster containing the files
96
+ * @returns {Array} file URLs
97
+ */
98
+ export function getHydraFiles(activity: any, cluster: string): any[];
99
+ export type DeconstructedHydraId = {
100
+ /**
101
+ * identifying the object
102
+ */
103
+ id: UUID;
104
+ /**
105
+ * of the object
106
+ */
107
+ type: string;
108
+ /**
109
+ * containing the object
110
+ */
111
+ cluster: string;
112
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * While the promise returned by the decorated is unfullfilled, sets, the
3
+ * specified boolean on the target class to `true`
4
+ * @param {string} param
5
+ * @returns {Function}
6
+ */
7
+ export default function whileInFlight(param: string): Function;
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
-
5
4
  _Object$defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
-
9
7
  exports.buildHydraMembershipId = buildHydraMembershipId;
10
8
  exports.buildHydraMessageId = buildHydraMessageId;
11
9
  exports.buildHydraOrgId = buildHydraOrgId;
@@ -16,16 +14,13 @@ exports.deconstructHydraId = deconstructHydraId;
16
14
  exports.getHydraClusterString = getHydraClusterString;
17
15
  exports.getHydraFiles = getHydraFiles;
18
16
  exports.getHydraRoomType = getHydraRoomType;
19
-
20
17
  var _base = require("./base64");
21
-
22
18
  var _constants = require("./constants");
23
-
24
19
  var hydraBaseUrl = 'https://api.ciscospark.com/v1';
25
-
26
20
  var isRequired = function isRequired() {
27
21
  throw Error('parameter is required');
28
22
  };
23
+
29
24
  /**
30
25
  * Constructs a Hydra ID for a given UUID and type.
31
26
  *
@@ -35,24 +30,20 @@ var isRequired = function isRequired() {
35
30
  * @param {string} cluster containing the "TYPE" object
36
31
  * @returns {string}
37
32
  */
38
-
39
-
40
33
  function constructHydraId() {
41
34
  var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : isRequired();
42
35
  var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isRequired();
43
36
  var cluster = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'us';
44
-
45
37
  if (!type.toUpperCase) {
46
38
  throw Error('"type" must be a string');
47
39
  }
48
-
49
40
  if (type === _constants.hydraTypes.PEOPLE || type === _constants.hydraTypes.ORGANIZATION) {
50
41
  // Cluster is always "us" for people and orgs
51
42
  return (0, _base.encode)("ciscospark://us/".concat(type.toUpperCase(), "/").concat(id));
52
43
  }
53
-
54
44
  return (0, _base.encode)("ciscospark://".concat(cluster, "/").concat(type.toUpperCase(), "/").concat(id));
55
45
  }
46
+
56
47
  /**
57
48
  * @typedef {Object} DeconstructedHydraId
58
49
  * @property {UUID} id identifying the object
@@ -67,8 +58,6 @@ function constructHydraId() {
67
58
  * @param {String} id Hydra style id
68
59
  * @returns {DeconstructedHydraId} deconstructed id
69
60
  */
70
-
71
-
72
61
  function deconstructHydraId(id) {
73
62
  var payload = (0, _base.decode)(id).split('/');
74
63
  return {
@@ -77,6 +66,7 @@ function deconstructHydraId(id) {
77
66
  cluster: payload.pop()
78
67
  };
79
68
  }
69
+
80
70
  /**
81
71
  * Constructs a Hydra ID for a message based on internal UUID
82
72
  *
@@ -85,11 +75,10 @@ function deconstructHydraId(id) {
85
75
  * @param {string} cluster containing the message
86
76
  * @returns {string}
87
77
  */
88
-
89
-
90
78
  function buildHydraMessageId(uuid, cluster) {
91
79
  return constructHydraId(_constants.hydraTypes.MESSAGE, uuid, cluster);
92
80
  }
81
+
93
82
  /**
94
83
  * Constructs a Hydra ID for a person based on internal UUID
95
84
  *
@@ -98,11 +87,10 @@ function buildHydraMessageId(uuid, cluster) {
98
87
  * @param {string} cluster containing the person
99
88
  * @returns {string}
100
89
  */
101
-
102
-
103
90
  function buildHydraPersonId(uuid, cluster) {
104
91
  return constructHydraId(_constants.hydraTypes.PEOPLE, uuid, cluster);
105
92
  }
93
+
106
94
  /**
107
95
  * Constructs a Hydra ID for a room based on internal UUID
108
96
  *
@@ -111,11 +99,10 @@ function buildHydraPersonId(uuid, cluster) {
111
99
  * @param {string} cluster containing the room
112
100
  * @returns {string}
113
101
  */
114
-
115
-
116
102
  function buildHydraRoomId(uuid, cluster) {
117
103
  return constructHydraId(_constants.hydraTypes.ROOM, uuid, cluster);
118
104
  }
105
+
119
106
  /**
120
107
  * Constructs a Hydra ID for an organization based on internal UUID
121
108
  *
@@ -124,11 +111,10 @@ function buildHydraRoomId(uuid, cluster) {
124
111
  * @param {string} cluster containing the organization
125
112
  * @returns {string}
126
113
  */
127
-
128
-
129
114
  function buildHydraOrgId(uuid, cluster) {
130
115
  return constructHydraId(_constants.hydraTypes.ORGANIZATION, uuid, cluster);
131
116
  }
117
+
132
118
  /**
133
119
  * Constructs a Hydra ID for an membership based on an
134
120
  * internal UUID for the person, and the space
@@ -139,11 +125,10 @@ function buildHydraOrgId(uuid, cluster) {
139
125
  * @param {string} cluster containing the membership
140
126
  * @returns {string}
141
127
  */
142
-
143
-
144
128
  function buildHydraMembershipId(personUUID, spaceUUID, cluster) {
145
129
  return constructHydraId(_constants.hydraTypes.MEMBERSHIP, "".concat(personUUID, ":").concat(spaceUUID), cluster);
146
130
  }
131
+
147
132
  /**
148
133
  * Returns a hydra cluster string based on a conversation url
149
134
  * @private
@@ -152,24 +137,19 @@ function buildHydraMembershipId(personUUID, spaceUUID, cluster) {
152
137
  * @param {String} conversationUrl url of space where activity took place
153
138
  * @returns {String} string suitable for UUID -> public ID encoding
154
139
  */
155
-
156
-
157
140
  function getHydraClusterString(webex, conversationUrl) {
158
141
  var internalClusterString = webex.internal.services.getClusterId(conversationUrl);
159
-
160
142
  if (internalClusterString.startsWith(_constants.INTERNAL_US_CLUSTER_NAME) || internalClusterString.startsWith(_constants.INTERNAL_US_INTEGRATION_CLUSTER_NAME)) {
161
143
  // Original US cluster is simply 'us' for backwards compatibility
162
144
  return 'us';
163
145
  }
164
-
165
146
  var clusterParts = internalClusterString.split(':');
166
-
167
147
  if (clusterParts.length < 3) {
168
148
  throw Error("Unable to determine cluster for convo: ".concat(conversationUrl));
169
149
  }
170
-
171
150
  return "".concat(clusterParts[0], ":").concat(clusterParts[1], ":").concat(clusterParts[2]);
172
151
  }
152
+
173
153
  /**
174
154
  * Returns a Hydra roomType based on conversation tags
175
155
  *
@@ -178,15 +158,13 @@ function getHydraClusterString(webex, conversationUrl) {
178
158
  * @param {any} spaceUUID
179
159
  * @returns {string}
180
160
  */
181
-
182
-
183
161
  function getHydraRoomType(tags) {
184
162
  if (tags.includes(_constants.SDK_EVENT.INTERNAL.ACTIVITY_TAG.ONE_ON_ONE)) {
185
163
  return _constants.SDK_EVENT.EXTERNAL.SPACE_TYPE.DIRECT;
186
164
  }
187
-
188
165
  return _constants.SDK_EVENT.EXTERNAL.SPACE_TYPE.GROUP;
189
166
  }
167
+
190
168
  /**
191
169
  * Returns file URLs for the activity, adhering to Hydra details,
192
170
  * e.g., https://api.ciscospark.com/v1/contents/Y2lzY29zcGF...
@@ -195,21 +173,18 @@ function getHydraRoomType(tags) {
195
173
  * @param {string} cluster containing the files
196
174
  * @returns {Array} file URLs
197
175
  */
198
-
199
-
200
176
  function getHydraFiles(activity, cluster) {
201
177
  var hydraFiles = [];
202
178
  var files = activity.object.files;
203
-
204
179
  if (files) {
205
- var items = files.items; // Note: Generated ID is dependent on file order.
180
+ var items = files.items;
206
181
 
182
+ // Note: Generated ID is dependent on file order.
207
183
  for (var i = 0; i < items.length; i += 1) {
208
184
  var contentId = constructHydraId(_constants.hydraTypes.CONTENT, "".concat(activity.id, "/").concat(i), cluster);
209
185
  hydraFiles.push("".concat(hydraBaseUrl, "/contents/").concat(contentId));
210
186
  }
211
187
  }
212
-
213
188
  return hydraFiles;
214
189
  }
215
190
  //# sourceMappingURL=uuid-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["hydraBaseUrl","isRequired","Error","constructHydraId","type","id","cluster","toUpperCase","hydraTypes","PEOPLE","ORGANIZATION","encode","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","length","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 {SDK_EVENT, hydraTypes, INTERNAL_US_CLUSTER_NAME, INTERNAL_US_INTEGRATION_CLUSTER_NAME} 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(\n type = isRequired(),\n id = isRequired(),\n cluster = 'us'\n) {\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,\n `${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 =\n webex.internal.services.getClusterId(conversationUrl);\n\n if ((internalClusterString.startsWith(INTERNAL_US_CLUSTER_NAME)) ||\n (internalClusterString.startsWith(INTERNAL_US_INTEGRATION_CLUSTER_NAME))) {\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 * @param {any} spaceUUID\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 =\n constructHydraId(hydraTypes.CONTENT, `${activity.id}/${i}`, cluster);\n\n hydraFiles.push(`${hydraBaseUrl}/contents/${contentId}`);\n }\n }\n\n return hydraFiles;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,YAAY,GAAG,+BAArB;;AAEA,IAAMC,UAAU,GAAG,SAAbA,UAAa,GAAM;EACvB,MAAMC,KAAK,CAAC,uBAAD,CAAX;AACD,CAFD;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,gBAAT,GAIL;EAAA,IAHAC,IAGA,uEAHOH,UAAU,EAGjB;EAAA,IAFAI,EAEA,uEAFKJ,UAAU,EAEf;EAAA,IADAK,OACA,uEADU,IACV;;EACA,IAAI,CAACF,IAAI,CAACG,WAAV,EAAuB;IACrB,MAAML,KAAK,CAAC,yBAAD,CAAX;EACD;;EAED,IAAKE,IAAI,KAAKI,qBAAA,CAAWC,MAArB,IAAiCL,IAAI,KAAKI,qBAAA,CAAWE,YAAzD,EAAwE;IACtE;IACA,OAAO,IAAAC,YAAA,4BAA0BP,IAAI,CAACG,WAAL,EAA1B,cAAgDF,EAAhD,EAAP;EACD;;EAED,OAAO,IAAAM,YAAA,yBAAuBL,OAAvB,cAAkC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M+C,UAAU,GAAG,EAAnB;EACA,IAAOC,KAAP,GAAgBF,QAAQ,CAACG,MAAzB,CAAOD,KAAP;;EAEA,IAAIA,KAAJ,EAAW;IACT,IAAOE,KAAP,GAAgBF,KAAhB,CAAOE,KAAP,CADS,CAGT;;IACA,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,KAAK,CAACjB,MAA1B,EAAkCkB,CAAC,IAAI,CAAvC,EAA0C;MACxC,IAAMC,SAAS,GACbvD,gBAAgB,CAACK,qBAAA,CAAWmD,OAAZ,YAAwBP,QAAQ,CAAC/C,EAAjC,cAAuCoD,CAAvC,GAA4CnD,OAA5C,CADlB;MAGA+C,UAAU,CAACO,IAAX,WAAmB5D,YAAnB,uBAA4C0D,SAA5C;IACD;EACF;;EAED,OAAOL,UAAP;AACD"}
1
+ {"version":3,"names":["hydraBaseUrl","isRequired","Error","constructHydraId","type","id","cluster","toUpperCase","hydraTypes","PEOPLE","ORGANIZATION","encode","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","length","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 * @param {any} spaceUUID\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;AACA;AAOA,IAAMA,YAAY,GAAG,+BAA+B;AAEpD,IAAMC,UAAU,GAAG,SAAbA,UAAU,GAAS;EACvB,MAAMC,KAAK,CAAC,uBAAuB,CAAC;AACtC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAgB,GAAyD;EAAA,IAAxDC,IAAI,uEAAGH,UAAU,EAAE;EAAA,IAAEI,EAAE,uEAAGJ,UAAU,EAAE;EAAA,IAAEK,OAAO,uEAAG,IAAI;EACrF,IAAI,CAACF,IAAI,CAACG,WAAW,EAAE;IACrB,MAAML,KAAK,CAAC,yBAAyB,CAAC;EACxC;EAEA,IAAIE,IAAI,KAAKI,qBAAU,CAACC,MAAM,IAAIL,IAAI,KAAKI,qBAAU,CAACE,YAAY,EAAE;IAClE;IACA,OAAO,IAAAC,YAAM,4BAAoBP,IAAI,CAACG,WAAW,EAAE,cAAIF,EAAE,EAAG;EAC9D;EAEA,OAAO,IAAAM,YAAM,yBAAiBL,OAAO,cAAIF,IAAI,CAACG,WAAW,EAAE,cAAIF,EAAE,EAAG;AACtE;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,kBAAkB,CAACP,EAAE,EAAE;EACrC,IAAMQ,OAAO,GAAG,IAAAC,YAAM,EAACT,EAAE,CAAC,CAACU,KAAK,CAAC,GAAG,CAAC;EAErC,OAAO;IACLV,EAAE,EAAEQ,OAAO,CAACG,GAAG,EAAE;IAC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AAI5D,YAAY,uBAAa0D,SAAS,EAAG;IAC1D;EACF;EAEA,OAAOL,UAAU;AACnB"}
@@ -1,23 +1,15 @@
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 = whileInFlight;
12
-
13
9
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
14
-
15
10
  var _apply = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/apply"));
16
-
17
11
  var _wrap2 = _interopRequireDefault(require("lodash/wrap"));
18
-
19
12
  var _tap = _interopRequireDefault(require("./tap"));
20
-
21
13
  /**
22
14
  * While the promise returned by the decorated is unfullfilled, sets, the
23
15
  * specified boolean on the target class to `true`
@@ -28,11 +20,9 @@ function whileInFlight(param) {
28
20
  return function whileInFlightDecorator(target, name, descriptor) {
29
21
  descriptor.value = (0, _wrap2.default)(descriptor.value, function whileInFlightExecutor(fn) {
30
22
  var _this = this;
31
-
32
23
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
33
24
  args[_key - 1] = arguments[_key];
34
25
  }
35
-
36
26
  return new _promise.default(function (resolve) {
37
27
  _this[param] = true;
38
28
  resolve((0, _apply.default)(fn, _this, args).then((0, _tap.default)(function () {
@@ -1 +1 @@
1
- {"version":3,"names":["whileInFlight","param","whileInFlightDecorator","target","name","descriptor","value","whileInFlightExecutor","fn","args","resolve","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(Reflect.apply(fn, this, args)\n .then(tap(() => {\n this[param] = false;\n }))\n .catch((reason) => {\n this[param] = false;\n\n return Promise.reject(reason);\n }));\n });\n });\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAQA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,aAAT,CAAuBC,KAAvB,EAA8B;EAC3C,OAAO,SAASC,sBAAT,CAAgCC,MAAhC,EAAwCC,IAAxC,EAA8CC,UAA9C,EAA0D;IAC/DA,UAAU,CAACC,KAAX,GAAmB,oBAAKD,UAAU,CAACC,KAAhB,EAAuB,SAASC,qBAAT,CAA+BC,EAA/B,EAA4C;MAAA;;MAAA,kCAANC,IAAM;QAANA,IAAM;MAAA;;MACpF,OAAO,qBAAY,UAACC,OAAD,EAAa;QAC9B,KAAI,CAACT,KAAD,CAAJ,GAAc,IAAd;QACAS,OAAO,CAAC,oBAAcF,EAAd,EAAkB,KAAlB,EAAwBC,IAAxB,EACLE,IADK,CACA,IAAAC,YAAA,EAAI,YAAM;UACd,KAAI,CAACX,KAAD,CAAJ,GAAc,KAAd;QACD,CAFK,CADA,EAILY,KAJK,CAIC,UAACC,MAAD,EAAY;UACjB,KAAI,CAACb,KAAD,CAAJ,GAAc,KAAd;UAEA,OAAO,iBAAQc,MAAR,CAAeD,MAAf,CAAP;QACD,CARK,CAAD,CAAP;MASD,CAXM,CAAP;IAYD,CAbkB,CAAnB;EAcD,CAfD;AAgBD"}
1
+ {"version":3,"names":["whileInFlight","param","whileInFlightDecorator","target","name","descriptor","value","whileInFlightExecutor","fn","args","resolve","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;AAEA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,aAAa,CAACC,KAAK,EAAE;EAC3C,OAAO,SAASC,sBAAsB,CAACC,MAAM,EAAEC,IAAI,EAAEC,UAAU,EAAE;IAC/DA,UAAU,CAACC,KAAK,GAAG,oBAAKD,UAAU,CAACC,KAAK,EAAE,SAASC,qBAAqB,CAACC,EAAE,EAAW;MAAA;MAAA,kCAANC,IAAI;QAAJA,IAAI;MAAA;MAClF,OAAO,qBAAY,UAACC,OAAO,EAAK;QAC9B,KAAI,CAACT,KAAK,CAAC,GAAG,IAAI;QAClBS,OAAO,CACL,oBAAcF,EAAE,EAAE,KAAI,EAAEC,IAAI,CAAC,CAC1BE,IAAI,CACH,IAAAC,YAAG,EAAC,YAAM;UACR,KAAI,CAACX,KAAK,CAAC,GAAG,KAAK;QACrB,CAAC,CAAC,CACH,CACAY,KAAK,CAAC,UAACC,MAAM,EAAK;UACjB,KAAI,CAACb,KAAK,CAAC,GAAG,KAAK;UAEnB,OAAO,iBAAQc,MAAM,CAACD,MAAM,CAAC;QAC/B,CAAC,CAAC,CACL;MACH,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC;AACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/common",
3
- "version": "3.0.0-beta.8",
3
+ "version": "3.0.0-bnr.0",
4
4
  "description": "Common utilities for Cisco Webex",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -25,8 +25,8 @@
25
25
  },
26
26
  "devDependencies": {
27
27
  "@sinonjs/fake-timers": "^6.0.1",
28
- "@webex/common": "3.0.0-beta.8",
29
- "@webex/test-helper-chai": "3.0.0-beta.8",
28
+ "@webex/common": "3.0.0-bnr.0",
29
+ "@webex/test-helper-chai": "3.0.0-bnr.0",
30
30
  "ampersand-state": "^5.0.3",
31
31
  "sinon": "^9.2.4"
32
32
  },
package/src/base64.js CHANGED
@@ -63,5 +63,5 @@ export default {
63
63
  toBase64Url,
64
64
  encode,
65
65
  decode,
66
- validate
66
+ validate,
67
67
  };
@@ -9,7 +9,7 @@ const mockDetectionObject = {
9
9
  /* eslint-enable global-require */
10
10
  getBrowserName: () => '',
11
11
  getBrowserVersion: () => '',
12
- isBrowser: () => false
12
+ isBrowser: () => false,
13
13
  };
14
14
 
15
15
  const createDetectionObject = (results) => {
@@ -26,11 +26,12 @@ const createDetectionObject = (results) => {
26
26
  getOSVersion,
27
27
  getBrowserName,
28
28
  getBrowserVersion,
29
- isBrowser
29
+ isBrowser,
30
30
  };
31
31
  };
32
32
 
33
- export default memoize((agent) => (agent || window.navigator?.userAgent ?
34
- createDetectionObject(bowser.getParser(agent || window.navigator.userAgent)) :
35
- mockDetectionObject
36
- ));
33
+ export default memoize((agent) =>
34
+ agent || window.navigator?.userAgent
35
+ ? createDetectionObject(bowser.getParser(agent || window.navigator.userAgent))
36
+ : mockDetectionObject
37
+ );
@@ -31,7 +31,8 @@ export default function debounce(fn, wait, options) {
31
31
 
32
32
  const {maxCalls, maxWait} = options;
33
33
  let count = 0;
34
- let maxWaitTimer, waitTimer;
34
+ let maxWaitTimer;
35
+ let waitTimer;
35
36
 
36
37
  return function wrapper() {
37
38
  count += 1;
package/src/constants.js CHANGED
@@ -4,7 +4,7 @@ export const SDK_EVENT = {
4
4
  ACTIVITY_FIELD: {
5
5
  ACTOR: 'actor',
6
6
  OBJECT: 'object',
7
- TARGET: 'target'
7
+ TARGET: 'target',
8
8
  },
9
9
  ACTIVITY_VERB: {
10
10
  ACKNOWLEDGE: 'acknowledge',
@@ -20,43 +20,43 @@ export const SDK_EVENT = {
20
20
  LOCK: 'lock',
21
21
  UNLOCK: 'unlock',
22
22
  HIDE: 'hide',
23
- UPDATE: 'update'
23
+ UPDATE: 'update',
24
24
  },
25
25
  ACTIVITY_TAG: {
26
26
  HIDDEN: 'HIDDEN',
27
27
  ONE_ON_ONE: 'ONE_ON_ONE',
28
- LOCKED: 'LOCKED'
29
- }
28
+ LOCKED: 'LOCKED',
29
+ },
30
30
  },
31
31
  EXTERNAL: {
32
32
  EVENT_TYPE: {
33
33
  CREATED: 'created',
34
34
  DELETED: 'deleted',
35
35
  UPDATED: 'updated',
36
- SEEN: 'seen'
36
+ SEEN: 'seen',
37
37
  },
38
38
  OWNER: {
39
39
  CREATOR: 'creator',
40
- ORG: 'org'
40
+ ORG: 'org',
41
41
  },
42
42
  STATUS: {
43
43
  ACTIVE: 'active',
44
- DISABLED: 'disabled'
44
+ DISABLED: 'disabled',
45
45
  },
46
46
  SPACE_TYPE: {
47
47
  DIRECT: 'direct',
48
- GROUP: 'group'
48
+ GROUP: 'group',
49
49
  },
50
50
  RESOURCE: {
51
51
  ATTACHMENT_ACTIONS: 'attachmentActions',
52
52
  MEMBERSHIPS: 'memberships',
53
53
  MESSAGES: 'messages',
54
- ROOMS: 'rooms'
54
+ ROOMS: 'rooms',
55
55
  },
56
56
  ATTACHMENTS: {
57
- CARD_CONTENT_TYPE: 'application/vnd.microsoft.card.adaptive'
58
- }
59
- }
57
+ CARD_CONTENT_TYPE: 'application/vnd.microsoft.card.adaptive',
58
+ },
59
+ },
60
60
  };
61
61
 
62
62
  export const hydraTypes = {
@@ -67,12 +67,12 @@ export const hydraTypes = {
67
67
  ORGANIZATION: 'ORGANIZATION',
68
68
  PEOPLE: 'PEOPLE',
69
69
  ROOM: 'ROOM',
70
- TEAM: 'TEAM'
70
+ TEAM: 'TEAM',
71
71
  };
72
72
 
73
73
  export const deviceType = {
74
74
  PROVISIONAL: 'PROVISIONAL',
75
- WEB: 'WEB'
75
+ WEB: 'WEB',
76
76
  };
77
77
 
78
78
  export const INTERNAL_US_CLUSTER_NAME = 'urn:TEAM:us-east-2_a';