@webex/common 3.0.0-beta.2 → 3.0.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base64.js +4 -18
- package/dist/base64.js.map +1 -1
- package/dist/browser-detection.js +0 -21
- package/dist/browser-detection.js.map +1 -1
- package/dist/capped-debounce.js +6 -16
- package/dist/capped-debounce.js.map +1 -1
- package/dist/check-required.js +0 -3
- package/dist/check-required.js.map +1 -1
- package/dist/constants.js +0 -2
- package/dist/constants.js.map +1 -1
- package/dist/defer.js +0 -7
- package/dist/defer.js.map +1 -1
- package/dist/deprecated.js +0 -5
- package/dist/deprecated.js.map +1 -1
- package/dist/event-envelope.js +16 -31
- package/dist/event-envelope.js.map +1 -1
- package/dist/events.js +3 -14
- package/dist/events.js.map +1 -1
- package/dist/exception.js +1 -28
- package/dist/exception.js.map +1 -1
- package/dist/in-browser/browser.js +0 -3
- package/dist/in-browser/browser.js.map +1 -1
- package/dist/in-browser/index.js +0 -4
- package/dist/in-browser/index.js.map +1 -1
- package/dist/in-browser/node.js +0 -3
- package/dist/in-browser/node.js.map +1 -1
- package/dist/index.js +1 -60
- package/dist/index.js.map +1 -1
- package/dist/isBuffer.js +0 -4
- package/dist/isBuffer.js.map +1 -1
- package/dist/make-state-datatype.js +4 -9
- package/dist/make-state-datatype.js.map +1 -1
- package/dist/one-flight.js +8 -30
- package/dist/one-flight.js.map +1 -1
- package/dist/patterns.js +0 -8
- package/dist/patterns.js.map +1 -1
- package/dist/resolve-with.js +0 -5
- package/dist/resolve-with.js.map +1 -1
- package/dist/retry.js +13 -39
- package/dist/retry.js.map +1 -1
- package/dist/tap.js +0 -5
- package/dist/tap.js.map +1 -1
- package/dist/template-container.js +10 -54
- package/dist/template-container.js.map +1 -1
- package/dist/uuid-utils.js +12 -37
- package/dist/uuid-utils.js.map +1 -1
- package/dist/while-in-flight.js +0 -10
- package/dist/while-in-flight.js.map +1 -1
- package/package.json +3 -3
- package/src/base64.js +1 -1
- package/src/browser-detection.js +7 -6
- package/src/capped-debounce.js +2 -1
- package/src/constants.js +14 -14
- package/src/deprecated.js +3 -1
- package/src/event-envelope.js +25 -21
- package/src/events.js +1 -4
- package/src/exception.js +1 -2
- package/src/index.js +5 -7
- package/src/make-state-datatype.js +10 -6
- package/src/one-flight.js +1 -5
- package/src/patterns.js +5 -3
- package/src/retry.js +5 -6
- package/src/tap.js +6 -5
- package/src/template-container.js +3 -1
- package/src/uuid-utils.js +16 -16
- package/src/while-in-flight.js +12 -8
- package/test/unit/spec/capped-debounce.js +4 -1
- package/test/unit/spec/exception.js +1 -3
- package/test/unit/spec/one-flight.js +38 -55
- package/test/unit/spec/template-container.js +0 -1
- package/test/unit/spec/while-in-flight.js +8 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/common",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.20",
|
|
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.
|
|
29
|
-
"@webex/test-helper-chai": "3.0.0-beta.
|
|
28
|
+
"@webex/common": "3.0.0-beta.20",
|
|
29
|
+
"@webex/test-helper-chai": "3.0.0-beta.20",
|
|
30
30
|
"ampersand-state": "^5.0.3",
|
|
31
31
|
"sinon": "^9.2.4"
|
|
32
32
|
},
|
package/src/base64.js
CHANGED
package/src/browser-detection.js
CHANGED
|
@@ -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) =>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
export default memoize((agent) =>
|
|
34
|
+
agent || window.navigator?.userAgent
|
|
35
|
+
? createDetectionObject(bowser.getParser(agent || window.navigator.userAgent))
|
|
36
|
+
: mockDetectionObject
|
|
37
|
+
);
|
package/src/capped-debounce.js
CHANGED
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';
|
package/src/deprecated.js
CHANGED
|
@@ -9,7 +9,9 @@ import {deprecated} from 'core-decorators';
|
|
|
9
9
|
* @returns {function}
|
|
10
10
|
*/
|
|
11
11
|
function emptyDecorator() {
|
|
12
|
-
return function noop() {
|
|
12
|
+
return function noop() {
|
|
13
|
+
/* eslint no-empty:[0] */
|
|
14
|
+
};
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
const exportedDeprecated = process.env.NODE_ENV === 'production' ? emptyDecorator : deprecated;
|
package/src/event-envelope.js
CHANGED
|
@@ -12,21 +12,26 @@ import {SDK_EVENT} from './constants';
|
|
|
12
12
|
*/
|
|
13
13
|
export function createEventEnvelope(webex, resource) {
|
|
14
14
|
return ensureMyIdIsAvailable(webex)
|
|
15
|
-
.then(() =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
.then(() =>
|
|
16
|
+
Promise.resolve({
|
|
17
|
+
createdBy: webex.internal.me.id,
|
|
18
|
+
orgId: webex.internal.me.orgId,
|
|
19
|
+
resource,
|
|
20
|
+
// id -- webhook id concept does not correlate to SDK socket event
|
|
21
|
+
// name -- webhook name concept does not correlate to SDK socket event
|
|
22
|
+
// targetUrl -- targetUrl concept does not correlate to SDK socket event
|
|
23
|
+
// secret -- secret concept does not correlate to SDK socket event
|
|
24
|
+
ownedBy: SDK_EVENT.EXTERNAL.OWNER.CREATOR,
|
|
25
|
+
status: SDK_EVENT.EXTERNAL.STATUS.ACTIVE,
|
|
26
|
+
created: new Date().toISOString(),
|
|
27
|
+
data: {},
|
|
28
|
+
})
|
|
29
|
+
)
|
|
30
|
+
.catch((e) => {
|
|
31
|
+
Promise.reject(
|
|
32
|
+
new Error(`Unable to get person info for ${resource} \
|
|
33
|
+
event envelope: ${e.message}`)
|
|
34
|
+
);
|
|
30
35
|
});
|
|
31
36
|
}
|
|
32
37
|
|
|
@@ -37,14 +42,13 @@ event envelope: ${e.message}`));
|
|
|
37
42
|
*/
|
|
38
43
|
export async function ensureMyIdIsAvailable(webex) {
|
|
39
44
|
// If we don't have it, save info about our user
|
|
40
|
-
if (
|
|
45
|
+
if ('me' in webex.internal) {
|
|
41
46
|
return Promise.resolve();
|
|
42
47
|
}
|
|
43
48
|
|
|
44
|
-
return webex.people.get('me')
|
|
45
|
-
.
|
|
46
|
-
webex.internal.me = person;
|
|
49
|
+
return webex.people.get('me').then((person) => {
|
|
50
|
+
webex.internal.me = person;
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
return Promise.resolve();
|
|
53
|
+
});
|
|
50
54
|
}
|
package/src/events.js
CHANGED
|
@@ -11,10 +11,7 @@ import {isArray} from 'lodash';
|
|
|
11
11
|
* @returns {EventEmitter} Returns the source emitter to ease use in promise chains
|
|
12
12
|
*/
|
|
13
13
|
export function proxyEvents(emitter, proxy) {
|
|
14
|
-
[
|
|
15
|
-
'on',
|
|
16
|
-
'once'
|
|
17
|
-
].forEach((key) => {
|
|
14
|
+
['on', 'once'].forEach((key) => {
|
|
18
15
|
proxy[key] = (...args) => {
|
|
19
16
|
emitter[key](...args);
|
|
20
17
|
|
package/src/exception.js
CHANGED
package/src/index.js
CHANGED
|
@@ -10,11 +10,9 @@ export {default as Defer} from './defer';
|
|
|
10
10
|
export {default as makeStateDataType} from './make-state-datatype';
|
|
11
11
|
export {default as make} from './template-container';
|
|
12
12
|
export {default as oneFlight} from './one-flight';
|
|
13
|
-
export {default as patterns} from './patterns
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
transferEvents
|
|
17
|
-
} from './events';
|
|
13
|
+
export {default as patterns} from './patterns';
|
|
14
|
+
|
|
15
|
+
export {proxyEvents, transferEvents} from './events';
|
|
18
16
|
export {createEventEnvelope, ensureMyIdIsAvailable} from './event-envelope';
|
|
19
17
|
export {default as resolveWith} from './resolve-with';
|
|
20
18
|
export {default as retry} from './retry';
|
|
@@ -28,7 +26,7 @@ export {
|
|
|
28
26
|
hydraTypes,
|
|
29
27
|
SDK_EVENT,
|
|
30
28
|
INTERNAL_US_CLUSTER_NAME,
|
|
31
|
-
INTERNAL_US_INTEGRATION_CLUSTER_NAME
|
|
29
|
+
INTERNAL_US_INTEGRATION_CLUSTER_NAME,
|
|
32
30
|
} from './constants';
|
|
33
31
|
|
|
34
32
|
export {default as BrowserDetection} from './browser-detection';
|
|
@@ -42,5 +40,5 @@ export {
|
|
|
42
40
|
getHydraClusterString,
|
|
43
41
|
getHydraFiles,
|
|
44
42
|
constructHydraId,
|
|
45
|
-
deconstructHydraId
|
|
43
|
+
deconstructHydraId,
|
|
46
44
|
} from './uuid-utils';
|
|
@@ -36,7 +36,7 @@ export default function makeStateDataType(Constructor, name) {
|
|
|
36
36
|
|
|
37
37
|
return {
|
|
38
38
|
val: newVal,
|
|
39
|
-
type: name
|
|
39
|
+
type: name,
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -46,7 +46,7 @@ export default function makeStateDataType(Constructor, name) {
|
|
|
46
46
|
// instance.
|
|
47
47
|
return {
|
|
48
48
|
val: newVal ? new Constructor(newVal, {parent: this}) : undefined,
|
|
49
|
-
type: name
|
|
49
|
+
type: name,
|
|
50
50
|
};
|
|
51
51
|
},
|
|
52
52
|
compare: function compare(currentValue, newVal) {
|
|
@@ -57,13 +57,17 @@ export default function makeStateDataType(Constructor, name) {
|
|
|
57
57
|
// if this has changed we want to also handle
|
|
58
58
|
// event propagation
|
|
59
59
|
if (previousVal) {
|
|
60
|
-
this.stopListening(
|
|
60
|
+
this.stopListening(
|
|
61
|
+
previousVal,
|
|
62
|
+
'all',
|
|
63
|
+
this._getCachedEventBubblingHandler(attributeName)
|
|
64
|
+
);
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
if (newVal) {
|
|
64
68
|
this.listenTo(newVal, 'all', this._getCachedEventBubblingHandler(attributeName));
|
|
65
69
|
}
|
|
66
|
-
}
|
|
70
|
+
},
|
|
67
71
|
},
|
|
68
72
|
prop: {
|
|
69
73
|
/**
|
|
@@ -81,7 +85,7 @@ export default function makeStateDataType(Constructor, name) {
|
|
|
81
85
|
|
|
82
86
|
return false;
|
|
83
87
|
},
|
|
84
|
-
type: name
|
|
85
|
-
}
|
|
88
|
+
type: name,
|
|
89
|
+
},
|
|
86
90
|
};
|
|
87
91
|
}
|
package/src/one-flight.js
CHANGED
|
@@ -28,11 +28,7 @@ export default function oneFlight(...params) {
|
|
|
28
28
|
|
|
29
29
|
const options = params[0] || {};
|
|
30
30
|
|
|
31
|
-
const {
|
|
32
|
-
cacheFailures,
|
|
33
|
-
cacheSuccesses,
|
|
34
|
-
keyFactory
|
|
35
|
-
} = options;
|
|
31
|
+
const {cacheFailures, cacheSuccesses, keyFactory} = options;
|
|
36
32
|
|
|
37
33
|
return oneFlightDecorator;
|
|
38
34
|
|
package/src/patterns.js
CHANGED
|
@@ -18,7 +18,8 @@ export default {
|
|
|
18
18
|
*
|
|
19
19
|
* @type {RegExp}
|
|
20
20
|
*/
|
|
21
|
-
email:
|
|
21
|
+
email:
|
|
22
|
+
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Regular expression that validates an ambiguous string contains emails
|
|
@@ -27,7 +28,8 @@ export default {
|
|
|
27
28
|
*
|
|
28
29
|
* @type {RegExp}
|
|
29
30
|
*/
|
|
30
|
-
containsEmails:
|
|
31
|
+
containsEmails:
|
|
32
|
+
/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/g,
|
|
31
33
|
|
|
32
34
|
/**
|
|
33
35
|
* Matches a UUID
|
|
@@ -45,5 +47,5 @@ export default {
|
|
|
45
47
|
* Same as this.uuid but allows for surrounding characters
|
|
46
48
|
* @type {RegExp}
|
|
47
49
|
*/
|
|
48
|
-
execUuid: /[a-f\d]{8}(?:-[a-f\d]{4}){3}-[a-f\d]{12}
|
|
50
|
+
execUuid: /[a-f\d]{8}(?:-[a-f\d]{4}){3}-[a-f\d]{12}/,
|
|
49
51
|
};
|
package/src/retry.js
CHANGED
|
@@ -24,11 +24,11 @@ import backoff from 'backoff';
|
|
|
24
24
|
export default function retry(...params) {
|
|
25
25
|
let options = params[0] || {};
|
|
26
26
|
|
|
27
|
-
options =
|
|
27
|
+
options = {...options};
|
|
28
28
|
defaults(options, {
|
|
29
29
|
backoff: true,
|
|
30
30
|
delay: 1,
|
|
31
|
-
maxAttempts: 3
|
|
31
|
+
maxAttempts: 3,
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
let strategyOptions;
|
|
@@ -36,13 +36,12 @@ export default function retry(...params) {
|
|
|
36
36
|
if (options.backoff) {
|
|
37
37
|
strategyOptions = {
|
|
38
38
|
initialDelay: options.delay,
|
|
39
|
-
maxDelay: options.maxDelay
|
|
39
|
+
maxDelay: options.maxDelay,
|
|
40
40
|
};
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
41
|
+
} else {
|
|
43
42
|
strategyOptions = {
|
|
44
43
|
initialDelay: 1,
|
|
45
|
-
maxDelay: 1
|
|
44
|
+
maxDelay: 1,
|
|
46
45
|
};
|
|
47
46
|
}
|
|
48
47
|
|
package/src/tap.js
CHANGED
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
* // => 5
|
|
17
17
|
*/
|
|
18
18
|
export default function tap(fn) {
|
|
19
|
-
return (r) =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
return (r) =>
|
|
20
|
+
new Promise((resolve) => {
|
|
21
|
+
resolve(fn(r));
|
|
22
|
+
})
|
|
23
|
+
.then(() => r)
|
|
24
|
+
.catch(() => r);
|
|
24
25
|
}
|
|
@@ -18,7 +18,9 @@ function make(...containers) {
|
|
|
18
18
|
|
|
19
19
|
const ChildContainer = containers.length > 1 ? make(...containers) : containers[0];
|
|
20
20
|
|
|
21
|
-
const name = `(${[TopContainer.name]
|
|
21
|
+
const name = `(${[TopContainer.name]
|
|
22
|
+
.concat(containers.map((container) => container.name))
|
|
23
|
+
.join(', ')})`;
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
26
|
* Container that wraps an arbitrary set of tupples to their values
|
package/src/uuid-utils.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import {encode, decode} from './base64';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
SDK_EVENT,
|
|
4
|
+
hydraTypes,
|
|
5
|
+
INTERNAL_US_CLUSTER_NAME,
|
|
6
|
+
INTERNAL_US_INTEGRATION_CLUSTER_NAME,
|
|
7
|
+
} from './constants';
|
|
3
8
|
|
|
4
9
|
const hydraBaseUrl = 'https://api.ciscospark.com/v1';
|
|
5
10
|
|
|
@@ -16,16 +21,12 @@ const isRequired = () => {
|
|
|
16
21
|
* @param {string} cluster containing the "TYPE" object
|
|
17
22
|
* @returns {string}
|
|
18
23
|
*/
|
|
19
|
-
export function constructHydraId(
|
|
20
|
-
type = isRequired(),
|
|
21
|
-
id = isRequired(),
|
|
22
|
-
cluster = 'us'
|
|
23
|
-
) {
|
|
24
|
+
export function constructHydraId(type = isRequired(), id = isRequired(), cluster = 'us') {
|
|
24
25
|
if (!type.toUpperCase) {
|
|
25
26
|
throw Error('"type" must be a string');
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
if (
|
|
29
|
+
if (type === hydraTypes.PEOPLE || type === hydraTypes.ORGANIZATION) {
|
|
29
30
|
// Cluster is always "us" for people and orgs
|
|
30
31
|
return encode(`ciscospark://us/${type.toUpperCase()}/${id}`);
|
|
31
32
|
}
|
|
@@ -53,7 +54,7 @@ export function deconstructHydraId(id) {
|
|
|
53
54
|
return {
|
|
54
55
|
id: payload.pop(),
|
|
55
56
|
type: payload.pop(),
|
|
56
|
-
cluster: payload.pop()
|
|
57
|
+
cluster: payload.pop(),
|
|
57
58
|
};
|
|
58
59
|
}
|
|
59
60
|
|
|
@@ -116,8 +117,7 @@ export function buildHydraOrgId(uuid, cluster) {
|
|
|
116
117
|
* @returns {string}
|
|
117
118
|
*/
|
|
118
119
|
export function buildHydraMembershipId(personUUID, spaceUUID, cluster) {
|
|
119
|
-
return constructHydraId(hydraTypes.MEMBERSHIP,
|
|
120
|
-
`${personUUID}:${spaceUUID}`, cluster);
|
|
120
|
+
return constructHydraId(hydraTypes.MEMBERSHIP, `${personUUID}:${spaceUUID}`, cluster);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
/**
|
|
@@ -129,11 +129,12 @@ export function buildHydraMembershipId(personUUID, spaceUUID, cluster) {
|
|
|
129
129
|
* @returns {String} string suitable for UUID -> public ID encoding
|
|
130
130
|
*/
|
|
131
131
|
export function getHydraClusterString(webex, conversationUrl) {
|
|
132
|
-
const internalClusterString =
|
|
133
|
-
webex.internal.services.getClusterId(conversationUrl);
|
|
132
|
+
const internalClusterString = webex.internal.services.getClusterId(conversationUrl);
|
|
134
133
|
|
|
135
|
-
if (
|
|
136
|
-
|
|
134
|
+
if (
|
|
135
|
+
internalClusterString.startsWith(INTERNAL_US_CLUSTER_NAME) ||
|
|
136
|
+
internalClusterString.startsWith(INTERNAL_US_INTEGRATION_CLUSTER_NAME)
|
|
137
|
+
) {
|
|
137
138
|
// Original US cluster is simply 'us' for backwards compatibility
|
|
138
139
|
return 'us';
|
|
139
140
|
}
|
|
@@ -179,8 +180,7 @@ export function getHydraFiles(activity, cluster) {
|
|
|
179
180
|
|
|
180
181
|
// Note: Generated ID is dependent on file order.
|
|
181
182
|
for (let i = 0; i < items.length; i += 1) {
|
|
182
|
-
const contentId =
|
|
183
|
-
constructHydraId(hydraTypes.CONTENT, `${activity.id}/${i}`, cluster);
|
|
183
|
+
const contentId = constructHydraId(hydraTypes.CONTENT, `${activity.id}/${i}`, cluster);
|
|
184
184
|
|
|
185
185
|
hydraFiles.push(`${hydraBaseUrl}/contents/${contentId}`);
|
|
186
186
|
}
|
package/src/while-in-flight.js
CHANGED
|
@@ -19,15 +19,19 @@ export default function whileInFlight(param) {
|
|
|
19
19
|
descriptor.value = wrap(descriptor.value, function whileInFlightExecutor(fn, ...args) {
|
|
20
20
|
return new Promise((resolve) => {
|
|
21
21
|
this[param] = true;
|
|
22
|
-
resolve(
|
|
23
|
-
.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
resolve(
|
|
23
|
+
Reflect.apply(fn, this, args)
|
|
24
|
+
.then(
|
|
25
|
+
tap(() => {
|
|
26
|
+
this[param] = false;
|
|
27
|
+
})
|
|
28
|
+
)
|
|
29
|
+
.catch((reason) => {
|
|
30
|
+
this[param] = false;
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
return Promise.reject(reason);
|
|
33
|
+
})
|
|
34
|
+
);
|
|
31
35
|
});
|
|
32
36
|
});
|
|
33
37
|
};
|
|
@@ -32,7 +32,10 @@ describe('common', () => {
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
it('requires a `maxCalls`', () => {
|
|
35
|
-
assert.throws(
|
|
35
|
+
assert.throws(
|
|
36
|
+
cappedDebounce.bind(null, sinon.spy(), 5, {maxWait: 10}),
|
|
37
|
+
/`options.maxCalls` is required/
|
|
38
|
+
);
|
|
36
39
|
});
|
|
37
40
|
|
|
38
41
|
it('returns a function that will execute once it stops being invoked for `wait` ms', () => {
|
|
@@ -14,9 +14,7 @@ describe('common', () => {
|
|
|
14
14
|
static defaultMessage = 'no parser';
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
class DerivedNoParserException extends NoParserException {
|
|
18
|
-
|
|
19
|
-
}
|
|
17
|
+
class DerivedNoParserException extends NoParserException {}
|
|
20
18
|
|
|
21
19
|
class StaticBadParserException extends DerivedNoParserException {
|
|
22
20
|
static parse() {
|