@webex/plugin-people 2.59.2 → 2.59.3-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +6 -6
- package/README.md +50 -50
- package/babel.config.js +3 -3
- package/dist/config.js +6 -6
- package/dist/config.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/people-batcher.js +31 -31
- package/dist/people-batcher.js.map +1 -1
- package/dist/people.js +121 -121
- package/dist/people.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +15 -14
- package/process +1 -1
- package/src/config.js +17 -17
- package/src/index.js +14 -14
- package/src/people-batcher.js +91 -91
- package/src/people.js +200 -200
- package/test/integration/spec/people.js +170 -170
- package/test/unit/spec/people-batcher.js +106 -106
- package/test/unit/spec/people.js +26 -26
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/plugin-people",
|
|
3
|
-
"version": "2.59.2",
|
|
4
3
|
"description": "",
|
|
5
4
|
"license": "MIT",
|
|
6
5
|
"main": "dist/index.js",
|
|
@@ -21,30 +20,32 @@
|
|
|
21
20
|
},
|
|
22
21
|
"devDependencies": {
|
|
23
22
|
"@babel/core": "^7.17.10",
|
|
24
|
-
"@webex/babel-config-legacy": "
|
|
25
|
-
"@webex/eslint-config-legacy": "
|
|
26
|
-
"@webex/jest-config-legacy": "
|
|
27
|
-
"@webex/legacy-tools": "
|
|
28
|
-
"@webex/test-helper-chai": "2.59.
|
|
29
|
-
"@webex/test-helper-mocha": "2.59.
|
|
30
|
-
"@webex/test-helper-mock-webex": "2.59.
|
|
31
|
-
"@webex/test-helper-test-users": "2.59.
|
|
23
|
+
"@webex/babel-config-legacy": "^0.0.0",
|
|
24
|
+
"@webex/eslint-config-legacy": "^0.0.0",
|
|
25
|
+
"@webex/jest-config-legacy": "^0.0.0",
|
|
26
|
+
"@webex/legacy-tools": "^0.0.0",
|
|
27
|
+
"@webex/test-helper-chai": "^2.59.3-next.1",
|
|
28
|
+
"@webex/test-helper-mocha": "^2.59.3-next.1",
|
|
29
|
+
"@webex/test-helper-mock-webex": "^2.59.3-next.1",
|
|
30
|
+
"@webex/test-helper-test-users": "^2.59.3-next.1",
|
|
32
31
|
"eslint": "^8.24.0",
|
|
33
32
|
"prettier": "^2.7.1",
|
|
34
33
|
"sinon": "^9.2.4"
|
|
35
34
|
},
|
|
36
35
|
"dependencies": {
|
|
37
|
-
"@webex/common": "2.59.
|
|
38
|
-
"@webex/internal-plugin-mercury": "2.59.
|
|
39
|
-
"@webex/webex-core": "2.59.
|
|
36
|
+
"@webex/common": "^2.59.3-next.1",
|
|
37
|
+
"@webex/internal-plugin-mercury": "^2.59.3-next.1",
|
|
38
|
+
"@webex/webex-core": "^2.59.3-next.1"
|
|
40
39
|
},
|
|
41
40
|
"scripts": {
|
|
42
41
|
"build": "yarn build:src",
|
|
43
42
|
"build:src": "webex-legacy-tools build -dest \"./dist\" -src \"./src\" -js -ts -maps",
|
|
43
|
+
"deploy:npm": "yarn npm publish",
|
|
44
44
|
"test": "yarn test:style && yarn test:unit && yarn test:integration && yarn test:browser",
|
|
45
45
|
"test:browser:broken": "webex-legacy-tools test --integration --unit --runner karma",
|
|
46
46
|
"test:integration": "webex-legacy-tools test --integration --runner mocha",
|
|
47
47
|
"test:style": "eslint ./src/**/*.*",
|
|
48
48
|
"test:unit": "webex-legacy-tools test --unit --runner jest"
|
|
49
|
-
}
|
|
50
|
-
|
|
49
|
+
},
|
|
50
|
+
"version": "2.59.3-next.1"
|
|
51
|
+
}
|
package/process
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = {browser: true};
|
|
1
|
+
module.exports = {browser: true};
|
package/src/config.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
people: {
|
|
7
|
-
batcherWait: 100,
|
|
8
|
-
batcherMaxCalls: 10,
|
|
9
|
-
batcherMaxWait: 1500,
|
|
10
|
-
/**
|
|
11
|
-
* optional flag that requires Hydra to send every type field,
|
|
12
|
-
* even if the type is not "person" (e.g.: SX10, webhook_integration, etc.)
|
|
13
|
-
* @private
|
|
14
|
-
*/
|
|
15
|
-
showAllTypes: false,
|
|
16
|
-
},
|
|
17
|
-
};
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
people: {
|
|
7
|
+
batcherWait: 100,
|
|
8
|
+
batcherMaxCalls: 10,
|
|
9
|
+
batcherMaxWait: 1500,
|
|
10
|
+
/**
|
|
11
|
+
* optional flag that requires Hydra to send every type field,
|
|
12
|
+
* even if the type is not "person" (e.g.: SX10, webhook_integration, etc.)
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
showAllTypes: false,
|
|
16
|
+
},
|
|
17
|
+
};
|
package/src/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {registerPlugin} from '@webex/webex-core';
|
|
6
|
-
|
|
7
|
-
import People from './people';
|
|
8
|
-
import config from './config';
|
|
9
|
-
|
|
10
|
-
registerPlugin('people', People, {
|
|
11
|
-
config,
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
export {default} from './people';
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {registerPlugin} from '@webex/webex-core';
|
|
6
|
+
|
|
7
|
+
import People from './people';
|
|
8
|
+
import config from './config';
|
|
9
|
+
|
|
10
|
+
registerPlugin('people', People, {
|
|
11
|
+
config,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export {default} from './people';
|
package/src/people-batcher.js
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {Batcher} from '@webex/webex-core';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @class
|
|
9
|
-
* @ignore
|
|
10
|
-
*/
|
|
11
|
-
const PersonUUIDRequestBatcher = Batcher.extend({
|
|
12
|
-
namespace: 'People',
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @instance
|
|
16
|
-
* @memberof PersonUUIDRequestBatcher
|
|
17
|
-
* @param {HttpResponseObject} res
|
|
18
|
-
* @returns {Promise}
|
|
19
|
-
*/
|
|
20
|
-
handleHttpSuccess(res) {
|
|
21
|
-
const promises = res.body.items.map((personResponse) =>
|
|
22
|
-
this.handleItemSuccess(personResponse.id, personResponse)
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
if (res.body.notFoundIds) {
|
|
26
|
-
promises.concat(res.body.notFoundIds.map((id) => this.handleItemFailure(id)));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return Promise.all(promises);
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
handleItemFailure(id) {
|
|
33
|
-
return this.getDeferredForResponse(id).then((defer) => {
|
|
34
|
-
defer.reject(id);
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* @instance
|
|
40
|
-
* @memberof PersonUUIDRequestBatcher
|
|
41
|
-
* @param {string} email
|
|
42
|
-
* @param {Object} response
|
|
43
|
-
* @returns {Promise}
|
|
44
|
-
*/
|
|
45
|
-
handleItemSuccess(email, response) {
|
|
46
|
-
return this.getDeferredForResponse(email).then((defer) => {
|
|
47
|
-
defer.resolve(response);
|
|
48
|
-
});
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @instance
|
|
53
|
-
* @memberof PersonUUIDRequestBatcher
|
|
54
|
-
* @param {string} uuidOrHydraId
|
|
55
|
-
* @returns {Promise<string>}
|
|
56
|
-
*/
|
|
57
|
-
fingerprintRequest(uuidOrHydraId) {
|
|
58
|
-
const hydraId = this.webex.people.inferPersonIdFromUuid(uuidOrHydraId);
|
|
59
|
-
|
|
60
|
-
return Promise.resolve(hydraId);
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* @instance
|
|
65
|
-
* @memberof PersonUUIDRequestBatcher
|
|
66
|
-
* @param {string} hydraId
|
|
67
|
-
* @returns {Promise<string>}
|
|
68
|
-
*/
|
|
69
|
-
fingerprintResponse(hydraId) {
|
|
70
|
-
return Promise.resolve(hydraId);
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
prepareRequest(ids) {
|
|
74
|
-
return Promise.resolve(ids.join());
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* @instance
|
|
79
|
-
* @memberof PersonUUIDRequestBatcher
|
|
80
|
-
* @param {Object} ids
|
|
81
|
-
* @returns {Promise<HttpResponseObject>}
|
|
82
|
-
*/
|
|
83
|
-
submitHttpRequest(ids) {
|
|
84
|
-
return this.webex.request({
|
|
85
|
-
service: 'hydra',
|
|
86
|
-
resource: `people/?id=${ids}&showAllTypes=${this.config.showAllTypes}`,
|
|
87
|
-
});
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
export default PersonUUIDRequestBatcher;
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {Batcher} from '@webex/webex-core';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @class
|
|
9
|
+
* @ignore
|
|
10
|
+
*/
|
|
11
|
+
const PersonUUIDRequestBatcher = Batcher.extend({
|
|
12
|
+
namespace: 'People',
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @instance
|
|
16
|
+
* @memberof PersonUUIDRequestBatcher
|
|
17
|
+
* @param {HttpResponseObject} res
|
|
18
|
+
* @returns {Promise}
|
|
19
|
+
*/
|
|
20
|
+
handleHttpSuccess(res) {
|
|
21
|
+
const promises = res.body.items.map((personResponse) =>
|
|
22
|
+
this.handleItemSuccess(personResponse.id, personResponse)
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
if (res.body.notFoundIds) {
|
|
26
|
+
promises.concat(res.body.notFoundIds.map((id) => this.handleItemFailure(id)));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return Promise.all(promises);
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
handleItemFailure(id) {
|
|
33
|
+
return this.getDeferredForResponse(id).then((defer) => {
|
|
34
|
+
defer.reject(id);
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @instance
|
|
40
|
+
* @memberof PersonUUIDRequestBatcher
|
|
41
|
+
* @param {string} email
|
|
42
|
+
* @param {Object} response
|
|
43
|
+
* @returns {Promise}
|
|
44
|
+
*/
|
|
45
|
+
handleItemSuccess(email, response) {
|
|
46
|
+
return this.getDeferredForResponse(email).then((defer) => {
|
|
47
|
+
defer.resolve(response);
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @instance
|
|
53
|
+
* @memberof PersonUUIDRequestBatcher
|
|
54
|
+
* @param {string} uuidOrHydraId
|
|
55
|
+
* @returns {Promise<string>}
|
|
56
|
+
*/
|
|
57
|
+
fingerprintRequest(uuidOrHydraId) {
|
|
58
|
+
const hydraId = this.webex.people.inferPersonIdFromUuid(uuidOrHydraId);
|
|
59
|
+
|
|
60
|
+
return Promise.resolve(hydraId);
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @instance
|
|
65
|
+
* @memberof PersonUUIDRequestBatcher
|
|
66
|
+
* @param {string} hydraId
|
|
67
|
+
* @returns {Promise<string>}
|
|
68
|
+
*/
|
|
69
|
+
fingerprintResponse(hydraId) {
|
|
70
|
+
return Promise.resolve(hydraId);
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
prepareRequest(ids) {
|
|
74
|
+
return Promise.resolve(ids.join());
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @instance
|
|
79
|
+
* @memberof PersonUUIDRequestBatcher
|
|
80
|
+
* @param {Object} ids
|
|
81
|
+
* @returns {Promise<HttpResponseObject>}
|
|
82
|
+
*/
|
|
83
|
+
submitHttpRequest(ids) {
|
|
84
|
+
return this.webex.request({
|
|
85
|
+
service: 'hydra',
|
|
86
|
+
resource: `people/?id=${ids}&showAllTypes=${this.config.showAllTypes}`,
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
export default PersonUUIDRequestBatcher;
|