@webex/plugin-people 2.59.1 → 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/.eslintrc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const config = {
|
|
2
|
-
root: true,
|
|
3
|
-
extends: ['@webex/eslint-config-legacy'],
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
module.exports = config;
|
|
1
|
+
const config = {
|
|
2
|
+
root: true,
|
|
3
|
+
extends: ['@webex/eslint-config-legacy'],
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
module.exports = config;
|
package/README.md
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
# @webex/plugin-people
|
|
2
|
-
|
|
3
|
-
[](https://github.com/RichardLitt/standard-readme)
|
|
4
|
-
|
|
5
|
-
> People plugin for the Cisco Webex JS SDK.
|
|
6
|
-
|
|
7
|
-
- [Install](#install)
|
|
8
|
-
- [Usage](#usage)
|
|
9
|
-
- [Contribute](#contribute)
|
|
10
|
-
- [Maintainers](#maintainers)
|
|
11
|
-
- [License](#license)
|
|
12
|
-
|
|
13
|
-
## Install
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install --save @webex/plugin-people
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
This is a plugin for the Cisco Webex JS SDK . Please see our [developer portal](https://developer.webex.com/) and the [API docs](https://webex.github.io/webex-js-sdk/api/) for full details.
|
|
22
|
-
|
|
23
|
-
## Install
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npm install --save @webex/plugin-people
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Usage
|
|
30
|
-
|
|
31
|
-
```js
|
|
32
|
-
const Webex = require('webex');
|
|
33
|
-
|
|
34
|
-
const webex = Webex.init();
|
|
35
|
-
webex.people.get(id).then((people) => {
|
|
36
|
-
console.log(people);
|
|
37
|
-
});
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Maintainers
|
|
41
|
-
|
|
42
|
-
This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
|
|
43
|
-
|
|
44
|
-
## Contribute
|
|
45
|
-
|
|
46
|
-
Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
|
|
47
|
-
|
|
48
|
-
## License
|
|
49
|
-
|
|
50
|
-
© 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
|
|
1
|
+
# @webex/plugin-people
|
|
2
|
+
|
|
3
|
+
[](https://github.com/RichardLitt/standard-readme)
|
|
4
|
+
|
|
5
|
+
> People plugin for the Cisco Webex JS SDK.
|
|
6
|
+
|
|
7
|
+
- [Install](#install)
|
|
8
|
+
- [Usage](#usage)
|
|
9
|
+
- [Contribute](#contribute)
|
|
10
|
+
- [Maintainers](#maintainers)
|
|
11
|
+
- [License](#license)
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install --save @webex/plugin-people
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
This is a plugin for the Cisco Webex JS SDK . Please see our [developer portal](https://developer.webex.com/) and the [API docs](https://webex.github.io/webex-js-sdk/api/) for full details.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install --save @webex/plugin-people
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
const Webex = require('webex');
|
|
33
|
+
|
|
34
|
+
const webex = Webex.init();
|
|
35
|
+
webex.people.get(id).then((people) => {
|
|
36
|
+
console.log(people);
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Maintainers
|
|
41
|
+
|
|
42
|
+
This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
|
|
43
|
+
|
|
44
|
+
## Contribute
|
|
45
|
+
|
|
46
|
+
Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
© 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
|
package/babel.config.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const babelConfigLegacy = require('@webex/babel-config-legacy');
|
|
2
|
-
|
|
3
|
-
module.exports = babelConfigLegacy;
|
|
1
|
+
const babelConfigLegacy = require('@webex/babel-config-legacy');
|
|
2
|
+
|
|
3
|
+
module.exports = babelConfigLegacy;
|
package/dist/config.js
CHANGED
|
@@ -5,18 +5,18 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
/*!
|
|
9
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
8
|
+
/*!
|
|
9
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
10
10
|
*/
|
|
11
11
|
var _default = {
|
|
12
12
|
people: {
|
|
13
13
|
batcherWait: 100,
|
|
14
14
|
batcherMaxCalls: 10,
|
|
15
15
|
batcherMaxWait: 1500,
|
|
16
|
-
/**
|
|
17
|
-
* optional flag that requires Hydra to send every type field,
|
|
18
|
-
* even if the type is not "person" (e.g.: SX10, webhook_integration, etc.)
|
|
19
|
-
* @private
|
|
16
|
+
/**
|
|
17
|
+
* optional flag that requires Hydra to send every type field,
|
|
18
|
+
* even if the type is not "person" (e.g.: SX10, webhook_integration, etc.)
|
|
19
|
+
* @private
|
|
20
20
|
*/
|
|
21
21
|
showAllTypes: false
|
|
22
22
|
}
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_default","people","batcherWait","batcherMaxCalls","batcherMaxWait","showAllTypes","exports","default"],"sources":["config.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nexport default {\n people: {\n batcherWait: 100,\n batcherMaxCalls: 10,\n batcherMaxWait: 1500,\n /**\n * optional flag that requires Hydra to send every type field,\n * even if the type is not \"person\" (e.g.: SX10, webhook_integration, etc.)\n * @private\n */\n showAllTypes: false,\n },\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAFA,IAAAA,QAAA,GAIe;EACbC,MAAM,EAAE;IACNC,WAAW,EAAE,GAAG;IAChBC,eAAe,EAAE,EAAE;IACnBC,cAAc,EAAE,IAAI;IACpB;AACJ;AACA;AACA;AACA;IACIC,YAAY,EAAE;EAChB;AACF,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAP,QAAA"}
|
|
1
|
+
{"version":3,"names":["_default","people","batcherWait","batcherMaxCalls","batcherMaxWait","showAllTypes","exports","default"],"sources":["config.js"],"sourcesContent":["/*!\r\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\r\n */\r\n\r\nexport default {\r\n people: {\r\n batcherWait: 100,\r\n batcherMaxCalls: 10,\r\n batcherMaxWait: 1500,\r\n /**\r\n * optional flag that requires Hydra to send every type field,\r\n * even if the type is not \"person\" (e.g.: SX10, webhook_integration, etc.)\r\n * @private\r\n */\r\n showAllTypes: false,\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAFA,IAAAA,QAAA,GAIe;EACbC,MAAM,EAAE;IACNC,WAAW,EAAE,GAAG;IAChBC,eAAe,EAAE,EAAE;IACnBC,cAAc,EAAE,IAAI;IACpB;AACJ;AACA;AACA;AACA;IACIC,YAAY,EAAE;EAChB;AACF,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAP,QAAA"}
|
package/dist/index.js
CHANGED
|
@@ -14,8 +14,8 @@ _Object$defineProperty(exports, "default", {
|
|
|
14
14
|
var _webexCore = require("@webex/webex-core");
|
|
15
15
|
var _people = _interopRequireDefault(require("./people"));
|
|
16
16
|
var _config = _interopRequireDefault(require("./config"));
|
|
17
|
-
/*!
|
|
18
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
17
|
+
/*!
|
|
18
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
(0, _webexCore.registerPlugin)('people', _people.default, {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_webexCore","require","_people","_interopRequireDefault","_config","registerPlugin","People","config"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {registerPlugin} from '@webex/webex-core';\n\nimport People from './people';\nimport config from './config';\n\nregisterPlugin('people', People, {\n config,\n});\n\nexport {default} from './people';\n"],"mappings":";;;;;;;;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AAPA;AACA;AACA;;AAOA,IAAAI,yBAAc,EAAC,QAAQ,EAAEC,eAAM,EAAE;EAC/BC,MAAM,EAANA;AACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"names":["_webexCore","require","_people","_interopRequireDefault","_config","registerPlugin","People","config"],"sources":["index.js"],"sourcesContent":["/*!\r\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\r\n */\r\n\r\nimport {registerPlugin} from '@webex/webex-core';\r\n\r\nimport People from './people';\r\nimport config from './config';\r\n\r\nregisterPlugin('people', People, {\r\n config,\r\n});\r\n\r\nexport {default} from './people';\r\n"],"mappings":";;;;;;;;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AAPA;AACA;AACA;;AAOA,IAAAI,yBAAc,EAAC,QAAQ,EAAEC,eAAM,EAAE;EAC/BC,MAAM,EAANA;AACF,CAAC,CAAC"}
|
package/dist/people-batcher.js
CHANGED
|
@@ -8,21 +8,21 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
10
10
|
var _webexCore = require("@webex/webex-core");
|
|
11
|
-
/*!
|
|
12
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
11
|
+
/*!
|
|
12
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* @class
|
|
17
|
-
* @ignore
|
|
15
|
+
/**
|
|
16
|
+
* @class
|
|
17
|
+
* @ignore
|
|
18
18
|
*/
|
|
19
19
|
var PersonUUIDRequestBatcher = _webexCore.Batcher.extend({
|
|
20
20
|
namespace: 'People',
|
|
21
|
-
/**
|
|
22
|
-
* @instance
|
|
23
|
-
* @memberof PersonUUIDRequestBatcher
|
|
24
|
-
* @param {HttpResponseObject} res
|
|
25
|
-
* @returns {Promise}
|
|
21
|
+
/**
|
|
22
|
+
* @instance
|
|
23
|
+
* @memberof PersonUUIDRequestBatcher
|
|
24
|
+
* @param {HttpResponseObject} res
|
|
25
|
+
* @returns {Promise}
|
|
26
26
|
*/
|
|
27
27
|
handleHttpSuccess: function handleHttpSuccess(res) {
|
|
28
28
|
var _this = this;
|
|
@@ -41,33 +41,33 @@ var PersonUUIDRequestBatcher = _webexCore.Batcher.extend({
|
|
|
41
41
|
defer.reject(id);
|
|
42
42
|
});
|
|
43
43
|
},
|
|
44
|
-
/**
|
|
45
|
-
* @instance
|
|
46
|
-
* @memberof PersonUUIDRequestBatcher
|
|
47
|
-
* @param {string} email
|
|
48
|
-
* @param {Object} response
|
|
49
|
-
* @returns {Promise}
|
|
44
|
+
/**
|
|
45
|
+
* @instance
|
|
46
|
+
* @memberof PersonUUIDRequestBatcher
|
|
47
|
+
* @param {string} email
|
|
48
|
+
* @param {Object} response
|
|
49
|
+
* @returns {Promise}
|
|
50
50
|
*/
|
|
51
51
|
handleItemSuccess: function handleItemSuccess(email, response) {
|
|
52
52
|
return this.getDeferredForResponse(email).then(function (defer) {
|
|
53
53
|
defer.resolve(response);
|
|
54
54
|
});
|
|
55
55
|
},
|
|
56
|
-
/**
|
|
57
|
-
* @instance
|
|
58
|
-
* @memberof PersonUUIDRequestBatcher
|
|
59
|
-
* @param {string} uuidOrHydraId
|
|
60
|
-
* @returns {Promise<string>}
|
|
56
|
+
/**
|
|
57
|
+
* @instance
|
|
58
|
+
* @memberof PersonUUIDRequestBatcher
|
|
59
|
+
* @param {string} uuidOrHydraId
|
|
60
|
+
* @returns {Promise<string>}
|
|
61
61
|
*/
|
|
62
62
|
fingerprintRequest: function fingerprintRequest(uuidOrHydraId) {
|
|
63
63
|
var hydraId = this.webex.people.inferPersonIdFromUuid(uuidOrHydraId);
|
|
64
64
|
return _promise.default.resolve(hydraId);
|
|
65
65
|
},
|
|
66
|
-
/**
|
|
67
|
-
* @instance
|
|
68
|
-
* @memberof PersonUUIDRequestBatcher
|
|
69
|
-
* @param {string} hydraId
|
|
70
|
-
* @returns {Promise<string>}
|
|
66
|
+
/**
|
|
67
|
+
* @instance
|
|
68
|
+
* @memberof PersonUUIDRequestBatcher
|
|
69
|
+
* @param {string} hydraId
|
|
70
|
+
* @returns {Promise<string>}
|
|
71
71
|
*/
|
|
72
72
|
fingerprintResponse: function fingerprintResponse(hydraId) {
|
|
73
73
|
return _promise.default.resolve(hydraId);
|
|
@@ -75,11 +75,11 @@ var PersonUUIDRequestBatcher = _webexCore.Batcher.extend({
|
|
|
75
75
|
prepareRequest: function prepareRequest(ids) {
|
|
76
76
|
return _promise.default.resolve(ids.join());
|
|
77
77
|
},
|
|
78
|
-
/**
|
|
79
|
-
* @instance
|
|
80
|
-
* @memberof PersonUUIDRequestBatcher
|
|
81
|
-
* @param {Object} ids
|
|
82
|
-
* @returns {Promise<HttpResponseObject>}
|
|
78
|
+
/**
|
|
79
|
+
* @instance
|
|
80
|
+
* @memberof PersonUUIDRequestBatcher
|
|
81
|
+
* @param {Object} ids
|
|
82
|
+
* @returns {Promise<HttpResponseObject>}
|
|
83
83
|
*/
|
|
84
84
|
submitHttpRequest: function submitHttpRequest(ids) {
|
|
85
85
|
return this.webex.request({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_webexCore","require","PersonUUIDRequestBatcher","Batcher","extend","namespace","handleHttpSuccess","res","_this","promises","body","items","map","personResponse","handleItemSuccess","id","notFoundIds","concat","handleItemFailure","_promise","default","all","getDeferredForResponse","then","defer","reject","email","response","resolve","fingerprintRequest","uuidOrHydraId","hydraId","webex","people","inferPersonIdFromUuid","fingerprintResponse","prepareRequest","ids","join","submitHttpRequest","request","service","resource","config","showAllTypes","_default","exports"],"sources":["people-batcher.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Batcher} from '@webex/webex-core';\n\n/**\n * @class\n * @ignore\n */\nconst PersonUUIDRequestBatcher = Batcher.extend({\n namespace: 'People',\n\n /**\n * @instance\n * @memberof PersonUUIDRequestBatcher\n * @param {HttpResponseObject} res\n * @returns {Promise}\n */\n handleHttpSuccess(res) {\n const promises = res.body.items.map((personResponse) =>\n this.handleItemSuccess(personResponse.id, personResponse)\n );\n\n if (res.body.notFoundIds) {\n promises.concat(res.body.notFoundIds.map((id) => this.handleItemFailure(id)));\n }\n\n return Promise.all(promises);\n },\n\n handleItemFailure(id) {\n return this.getDeferredForResponse(id).then((defer) => {\n defer.reject(id);\n });\n },\n\n /**\n * @instance\n * @memberof PersonUUIDRequestBatcher\n * @param {string} email\n * @param {Object} response\n * @returns {Promise}\n */\n handleItemSuccess(email, response) {\n return this.getDeferredForResponse(email).then((defer) => {\n defer.resolve(response);\n });\n },\n\n /**\n * @instance\n * @memberof PersonUUIDRequestBatcher\n * @param {string} uuidOrHydraId\n * @returns {Promise<string>}\n */\n fingerprintRequest(uuidOrHydraId) {\n const hydraId = this.webex.people.inferPersonIdFromUuid(uuidOrHydraId);\n\n return Promise.resolve(hydraId);\n },\n\n /**\n * @instance\n * @memberof PersonUUIDRequestBatcher\n * @param {string} hydraId\n * @returns {Promise<string>}\n */\n fingerprintResponse(hydraId) {\n return Promise.resolve(hydraId);\n },\n\n prepareRequest(ids) {\n return Promise.resolve(ids.join());\n },\n\n /**\n * @instance\n * @memberof PersonUUIDRequestBatcher\n * @param {Object} ids\n * @returns {Promise<HttpResponseObject>}\n */\n submitHttpRequest(ids) {\n return this.webex.request({\n service: 'hydra',\n resource: `people/?id=${ids}&showAllTypes=${this.config.showAllTypes}`,\n });\n },\n});\n\nexport default PersonUUIDRequestBatcher;\n"],"mappings":";;;;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA,IAAMC,wBAAwB,GAAGC,kBAAO,CAACC,MAAM,CAAC;EAC9CC,SAAS,EAAE,QAAQ;EAEnB;AACF;AACA;AACA;AACA;AACA;EACEC,iBAAiB,WAAAA,kBAACC,GAAG,EAAE;IAAA,IAAAC,KAAA;IACrB,IAAMC,QAAQ,GAAGF,GAAG,CAACG,IAAI,CAACC,KAAK,CAACC,GAAG,CAAC,UAACC,cAAc;MAAA,OACjDL,KAAI,CAACM,iBAAiB,CAACD,cAAc,CAACE,EAAE,EAAEF,cAAc,CAAC;IAAA,EAC1D;IAED,IAAIN,GAAG,CAACG,IAAI,CAACM,WAAW,EAAE;MACxBP,QAAQ,CAACQ,MAAM,CAACV,GAAG,CAACG,IAAI,CAACM,WAAW,CAACJ,GAAG,CAAC,UAACG,EAAE;QAAA,OAAKP,KAAI,CAACU,iBAAiB,CAACH,EAAE,CAAC;MAAA,EAAC,CAAC;IAC/E;IAEA,OAAOI,QAAA,CAAAC,OAAA,CAAQC,GAAG,CAACZ,QAAQ,CAAC;EAC9B,CAAC;EAEDS,iBAAiB,WAAAA,kBAACH,EAAE,EAAE;IACpB,OAAO,IAAI,CAACO,sBAAsB,CAACP,EAAE,CAAC,CAACQ,IAAI,CAAC,UAACC,KAAK,EAAK;MACrDA,KAAK,CAACC,MAAM,CAACV,EAAE,CAAC;IAClB,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;EACED,iBAAiB,WAAAA,kBAACY,KAAK,EAAEC,QAAQ,EAAE;IACjC,OAAO,IAAI,CAACL,sBAAsB,CAACI,KAAK,CAAC,CAACH,IAAI,CAAC,UAACC,KAAK,EAAK;MACxDA,KAAK,CAACI,OAAO,CAACD,QAAQ,CAAC;IACzB,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEE,kBAAkB,WAAAA,mBAACC,aAAa,EAAE;IAChC,IAAMC,OAAO,GAAG,IAAI,CAACC,KAAK,CAACC,MAAM,CAACC,qBAAqB,CAACJ,aAAa,CAAC;IAEtE,OAAOX,QAAA,CAAAC,OAAA,CAAQQ,OAAO,CAACG,OAAO,CAAC;EACjC,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEI,mBAAmB,WAAAA,oBAACJ,OAAO,EAAE;IAC3B,OAAOZ,QAAA,CAAAC,OAAA,CAAQQ,OAAO,CAACG,OAAO,CAAC;EACjC,CAAC;EAEDK,cAAc,WAAAA,eAACC,GAAG,EAAE;IAClB,OAAOlB,QAAA,CAAAC,OAAA,CAAQQ,OAAO,CAACS,GAAG,CAACC,IAAI,EAAE,CAAC;EACpC,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEC,iBAAiB,WAAAA,kBAACF,GAAG,EAAE;IACrB,OAAO,IAAI,CAACL,KAAK,CAACQ,OAAO,CAAC;MACxBC,OAAO,EAAE,OAAO;MAChBC,QAAQ,gBAAAzB,MAAA,CAAgBoB,GAAG,oBAAApB,MAAA,CAAiB,IAAI,CAAC0B,MAAM,CAACC,YAAY;IACtE,CAAC,CAAC;EACJ;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAEY3C,wBAAwB;AAAA4C,OAAA,CAAA1B,OAAA,GAAAyB,QAAA"}
|
|
1
|
+
{"version":3,"names":["_webexCore","require","PersonUUIDRequestBatcher","Batcher","extend","namespace","handleHttpSuccess","res","_this","promises","body","items","map","personResponse","handleItemSuccess","id","notFoundIds","concat","handleItemFailure","_promise","default","all","getDeferredForResponse","then","defer","reject","email","response","resolve","fingerprintRequest","uuidOrHydraId","hydraId","webex","people","inferPersonIdFromUuid","fingerprintResponse","prepareRequest","ids","join","submitHttpRequest","request","service","resource","config","showAllTypes","_default","exports"],"sources":["people-batcher.js"],"sourcesContent":["/*!\r\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\r\n */\r\n\r\nimport {Batcher} from '@webex/webex-core';\r\n\r\n/**\r\n * @class\r\n * @ignore\r\n */\r\nconst PersonUUIDRequestBatcher = Batcher.extend({\r\n namespace: 'People',\r\n\r\n /**\r\n * @instance\r\n * @memberof PersonUUIDRequestBatcher\r\n * @param {HttpResponseObject} res\r\n * @returns {Promise}\r\n */\r\n handleHttpSuccess(res) {\r\n const promises = res.body.items.map((personResponse) =>\r\n this.handleItemSuccess(personResponse.id, personResponse)\r\n );\r\n\r\n if (res.body.notFoundIds) {\r\n promises.concat(res.body.notFoundIds.map((id) => this.handleItemFailure(id)));\r\n }\r\n\r\n return Promise.all(promises);\r\n },\r\n\r\n handleItemFailure(id) {\r\n return this.getDeferredForResponse(id).then((defer) => {\r\n defer.reject(id);\r\n });\r\n },\r\n\r\n /**\r\n * @instance\r\n * @memberof PersonUUIDRequestBatcher\r\n * @param {string} email\r\n * @param {Object} response\r\n * @returns {Promise}\r\n */\r\n handleItemSuccess(email, response) {\r\n return this.getDeferredForResponse(email).then((defer) => {\r\n defer.resolve(response);\r\n });\r\n },\r\n\r\n /**\r\n * @instance\r\n * @memberof PersonUUIDRequestBatcher\r\n * @param {string} uuidOrHydraId\r\n * @returns {Promise<string>}\r\n */\r\n fingerprintRequest(uuidOrHydraId) {\r\n const hydraId = this.webex.people.inferPersonIdFromUuid(uuidOrHydraId);\r\n\r\n return Promise.resolve(hydraId);\r\n },\r\n\r\n /**\r\n * @instance\r\n * @memberof PersonUUIDRequestBatcher\r\n * @param {string} hydraId\r\n * @returns {Promise<string>}\r\n */\r\n fingerprintResponse(hydraId) {\r\n return Promise.resolve(hydraId);\r\n },\r\n\r\n prepareRequest(ids) {\r\n return Promise.resolve(ids.join());\r\n },\r\n\r\n /**\r\n * @instance\r\n * @memberof PersonUUIDRequestBatcher\r\n * @param {Object} ids\r\n * @returns {Promise<HttpResponseObject>}\r\n */\r\n submitHttpRequest(ids) {\r\n return this.webex.request({\r\n service: 'hydra',\r\n resource: `people/?id=${ids}&showAllTypes=${this.config.showAllTypes}`,\r\n });\r\n },\r\n});\r\n\r\nexport default PersonUUIDRequestBatcher;\r\n"],"mappings":";;;;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA,IAAMC,wBAAwB,GAAGC,kBAAO,CAACC,MAAM,CAAC;EAC9CC,SAAS,EAAE,QAAQ;EAEnB;AACF;AACA;AACA;AACA;AACA;EACEC,iBAAiB,WAAAA,kBAACC,GAAG,EAAE;IAAA,IAAAC,KAAA;IACrB,IAAMC,QAAQ,GAAGF,GAAG,CAACG,IAAI,CAACC,KAAK,CAACC,GAAG,CAAC,UAACC,cAAc;MAAA,OACjDL,KAAI,CAACM,iBAAiB,CAACD,cAAc,CAACE,EAAE,EAAEF,cAAc,CAAC;IAAA,EAC1D;IAED,IAAIN,GAAG,CAACG,IAAI,CAACM,WAAW,EAAE;MACxBP,QAAQ,CAACQ,MAAM,CAACV,GAAG,CAACG,IAAI,CAACM,WAAW,CAACJ,GAAG,CAAC,UAACG,EAAE;QAAA,OAAKP,KAAI,CAACU,iBAAiB,CAACH,EAAE,CAAC;MAAA,EAAC,CAAC;IAC/E;IAEA,OAAOI,QAAA,CAAAC,OAAA,CAAQC,GAAG,CAACZ,QAAQ,CAAC;EAC9B,CAAC;EAEDS,iBAAiB,WAAAA,kBAACH,EAAE,EAAE;IACpB,OAAO,IAAI,CAACO,sBAAsB,CAACP,EAAE,CAAC,CAACQ,IAAI,CAAC,UAACC,KAAK,EAAK;MACrDA,KAAK,CAACC,MAAM,CAACV,EAAE,CAAC;IAClB,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;EACED,iBAAiB,WAAAA,kBAACY,KAAK,EAAEC,QAAQ,EAAE;IACjC,OAAO,IAAI,CAACL,sBAAsB,CAACI,KAAK,CAAC,CAACH,IAAI,CAAC,UAACC,KAAK,EAAK;MACxDA,KAAK,CAACI,OAAO,CAACD,QAAQ,CAAC;IACzB,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEE,kBAAkB,WAAAA,mBAACC,aAAa,EAAE;IAChC,IAAMC,OAAO,GAAG,IAAI,CAACC,KAAK,CAACC,MAAM,CAACC,qBAAqB,CAACJ,aAAa,CAAC;IAEtE,OAAOX,QAAA,CAAAC,OAAA,CAAQQ,OAAO,CAACG,OAAO,CAAC;EACjC,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEI,mBAAmB,WAAAA,oBAACJ,OAAO,EAAE;IAC3B,OAAOZ,QAAA,CAAAC,OAAA,CAAQQ,OAAO,CAACG,OAAO,CAAC;EACjC,CAAC;EAEDK,cAAc,WAAAA,eAACC,GAAG,EAAE;IAClB,OAAOlB,QAAA,CAAAC,OAAA,CAAQQ,OAAO,CAACS,GAAG,CAACC,IAAI,EAAE,CAAC;EACpC,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEC,iBAAiB,WAAAA,kBAACF,GAAG,EAAE;IACrB,OAAO,IAAI,CAACL,KAAK,CAACQ,OAAO,CAAC;MACxBC,OAAO,EAAE,OAAO;MAChBC,QAAQ,gBAAAzB,MAAA,CAAgBoB,GAAG,oBAAApB,MAAA,CAAiB,IAAI,CAAC0B,MAAM,CAACC,YAAY;IACtE,CAAC,CAAC;EACJ;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAEY3C,wBAAwB;AAAA4C,OAAA,CAAA1B,OAAA,GAAAyB,QAAA"}
|
package/dist/people.js
CHANGED
|
@@ -14,51 +14,51 @@ var _webexCore = require("@webex/webex-core");
|
|
|
14
14
|
var _common = require("@webex/common");
|
|
15
15
|
var _peopleBatcher = _interopRequireDefault(require("./people-batcher"));
|
|
16
16
|
var _obj;
|
|
17
|
-
/**
|
|
18
|
-
* @typedef {Object} PersonObject
|
|
19
|
-
* @property {string} id - (server generated) Unique identifier for the person
|
|
20
|
-
* @property {Array<email>} emails - Email addresses of the person
|
|
21
|
-
* @property {string} displayName - Display name of the person
|
|
22
|
-
* @property {isoDate} created - (server generated) The date and time that the person was created
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {Object} PersonObject
|
|
19
|
+
* @property {string} id - (server generated) Unique identifier for the person
|
|
20
|
+
* @property {Array<email>} emails - Email addresses of the person
|
|
21
|
+
* @property {string} displayName - Display name of the person
|
|
22
|
+
* @property {isoDate} created - (server generated) The date and time that the person was created
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
/**
|
|
26
|
-
* @class
|
|
25
|
+
/**
|
|
26
|
+
* @class
|
|
27
27
|
*/
|
|
28
28
|
var People = _webexCore.WebexPlugin.extend((_obj = {
|
|
29
29
|
namespace: 'People',
|
|
30
30
|
children: {
|
|
31
31
|
batcher: _peopleBatcher.default
|
|
32
32
|
},
|
|
33
|
-
/**
|
|
34
|
-
* Returns a single person by ID
|
|
35
|
-
* @instance
|
|
36
|
-
* @memberof People
|
|
37
|
-
* @param {PersonObject|uuid|string} person
|
|
38
|
-
* @returns {Promise<PersonObject>}
|
|
39
|
-
* @example
|
|
40
|
-
* webex.rooms.create({title: 'Get Person Example'})
|
|
41
|
-
* .then(function(room) {
|
|
42
|
-
* return webex.memberships.create({
|
|
43
|
-
* personEmail: 'alice@example.com',
|
|
44
|
-
* roomId: room.id
|
|
45
|
-
* });
|
|
46
|
-
* })
|
|
47
|
-
* .then(function(membership) {
|
|
48
|
-
* return webex.people.get(membership.personId);
|
|
49
|
-
* })
|
|
50
|
-
* .then(function(alice) {
|
|
51
|
-
* var assert = require('assert');
|
|
52
|
-
* assert(alice.id);
|
|
53
|
-
* assert(Array.isArray(alice.emails));
|
|
54
|
-
* assert.equal(alice.emails.filter(function(email) {
|
|
55
|
-
* return email === 'alice@example.com';
|
|
56
|
-
* }).length, 1);
|
|
57
|
-
* assert(alice.displayName);
|
|
58
|
-
* assert(alice.created);
|
|
59
|
-
* return 'success';
|
|
60
|
-
* });
|
|
61
|
-
* // => success
|
|
33
|
+
/**
|
|
34
|
+
* Returns a single person by ID
|
|
35
|
+
* @instance
|
|
36
|
+
* @memberof People
|
|
37
|
+
* @param {PersonObject|uuid|string} person
|
|
38
|
+
* @returns {Promise<PersonObject>}
|
|
39
|
+
* @example
|
|
40
|
+
* webex.rooms.create({title: 'Get Person Example'})
|
|
41
|
+
* .then(function(room) {
|
|
42
|
+
* return webex.memberships.create({
|
|
43
|
+
* personEmail: 'alice@example.com',
|
|
44
|
+
* roomId: room.id
|
|
45
|
+
* });
|
|
46
|
+
* })
|
|
47
|
+
* .then(function(membership) {
|
|
48
|
+
* return webex.people.get(membership.personId);
|
|
49
|
+
* })
|
|
50
|
+
* .then(function(alice) {
|
|
51
|
+
* var assert = require('assert');
|
|
52
|
+
* assert(alice.id);
|
|
53
|
+
* assert(Array.isArray(alice.emails));
|
|
54
|
+
* assert.equal(alice.emails.filter(function(email) {
|
|
55
|
+
* return email === 'alice@example.com';
|
|
56
|
+
* }).length, 1);
|
|
57
|
+
* assert(alice.displayName);
|
|
58
|
+
* assert(alice.created);
|
|
59
|
+
* return 'success';
|
|
60
|
+
* });
|
|
61
|
+
* // => success
|
|
62
62
|
*/
|
|
63
63
|
get: function get(person) {
|
|
64
64
|
if (!person) {
|
|
@@ -70,84 +70,84 @@ var People = _webexCore.WebexPlugin.extend((_obj = {
|
|
|
70
70
|
var id = person.personId || person.id || person;
|
|
71
71
|
return this.batcher.request(id);
|
|
72
72
|
},
|
|
73
|
-
/**
|
|
74
|
-
* Returns a list of people
|
|
75
|
-
* @instance
|
|
76
|
-
* @memberof People
|
|
77
|
-
* @param {Object | uuid[]} options or array of uuids
|
|
78
|
-
* @param {email} options.email - Returns people with an email that contains this string
|
|
79
|
-
* @param {string} options.displayName - Returns people with a name that contains this string
|
|
80
|
-
* @param {bool} showAllTypes optional flag that requires Hydra to send every type field,
|
|
81
|
-
* even if the type is not "person" (e.g.: SX10, webhook_integration, etc.)
|
|
82
|
-
* @returns {Promise<Page<PersonObject>>}
|
|
83
|
-
* @example
|
|
84
|
-
* var room;
|
|
85
|
-
* webex.rooms.create({title: 'List People Example'})
|
|
86
|
-
* .then(function(r) {
|
|
87
|
-
* room = r;
|
|
88
|
-
* return webex.memberships.create({
|
|
89
|
-
* personEmail: 'alice@example.com',
|
|
90
|
-
* roomId: room.id
|
|
91
|
-
* });
|
|
92
|
-
* })
|
|
93
|
-
* .then(function() {
|
|
94
|
-
* return webex.memberships.create({
|
|
95
|
-
* personEmail: 'bob@example.com',
|
|
96
|
-
* roomId: room.id
|
|
97
|
-
* });
|
|
98
|
-
* })
|
|
99
|
-
* .then(function() {
|
|
100
|
-
* return webex.people.list({email: 'alice@example.com'});
|
|
101
|
-
* })
|
|
102
|
-
* .then(function(people) {
|
|
103
|
-
* var assert = require('assert');
|
|
104
|
-
* assert.equal(people.length, 1);
|
|
105
|
-
* var person = people.items[0];
|
|
106
|
-
* assert(person.id);
|
|
107
|
-
* assert(Array.isArray(person.emails));
|
|
108
|
-
* assert(person.displayName);
|
|
109
|
-
* assert(person.created);
|
|
110
|
-
* return 'success';
|
|
111
|
-
* });
|
|
112
|
-
* // => success
|
|
113
|
-
* @example <caption>Example usage of array method</caption>
|
|
114
|
-
* var room;
|
|
115
|
-
* var aliceId;
|
|
116
|
-
* var bobId;
|
|
117
|
-
* webex.rooms.create({title: 'List People Array Example'})
|
|
118
|
-
* .then(function(r) {
|
|
119
|
-
* room = r;
|
|
120
|
-
* return webex.memberships.create({
|
|
121
|
-
* personEmail: 'alice@example.com',
|
|
122
|
-
* roomId: room.id
|
|
123
|
-
* });
|
|
124
|
-
* })
|
|
125
|
-
* .then(function(membership) {
|
|
126
|
-
* aliceId = membership.personId;
|
|
127
|
-
* })
|
|
128
|
-
* .then(function() {
|
|
129
|
-
* return webex.memberships.create({
|
|
130
|
-
* personEmail: 'bob@example.com',
|
|
131
|
-
* roomId: room.id
|
|
132
|
-
* });
|
|
133
|
-
* })
|
|
134
|
-
* .then(function(membership) {
|
|
135
|
-
* bobId = membership.personId;
|
|
136
|
-
* })
|
|
137
|
-
* .then(function() {
|
|
138
|
-
* return webex.people.list([aliceId, bobId]);
|
|
139
|
-
* })
|
|
140
|
-
* .then(function(people) {
|
|
141
|
-
* var assert = require('assert');
|
|
142
|
-
* assert.equal(people.length, 2);
|
|
143
|
-
* var person = people.items[0];
|
|
144
|
-
* assert(person.id);
|
|
145
|
-
* assert(Array.isArray(person.emails));
|
|
146
|
-
* assert(person.displayName);
|
|
147
|
-
* assert(person.created);
|
|
148
|
-
* return 'success';
|
|
149
|
-
* });
|
|
150
|
-
* // => success
|
|
73
|
+
/**
|
|
74
|
+
* Returns a list of people
|
|
75
|
+
* @instance
|
|
76
|
+
* @memberof People
|
|
77
|
+
* @param {Object | uuid[]} options or array of uuids
|
|
78
|
+
* @param {email} options.email - Returns people with an email that contains this string
|
|
79
|
+
* @param {string} options.displayName - Returns people with a name that contains this string
|
|
80
|
+
* @param {bool} showAllTypes optional flag that requires Hydra to send every type field,
|
|
81
|
+
* even if the type is not "person" (e.g.: SX10, webhook_integration, etc.)
|
|
82
|
+
* @returns {Promise<Page<PersonObject>>}
|
|
83
|
+
* @example
|
|
84
|
+
* var room;
|
|
85
|
+
* webex.rooms.create({title: 'List People Example'})
|
|
86
|
+
* .then(function(r) {
|
|
87
|
+
* room = r;
|
|
88
|
+
* return webex.memberships.create({
|
|
89
|
+
* personEmail: 'alice@example.com',
|
|
90
|
+
* roomId: room.id
|
|
91
|
+
* });
|
|
92
|
+
* })
|
|
93
|
+
* .then(function() {
|
|
94
|
+
* return webex.memberships.create({
|
|
95
|
+
* personEmail: 'bob@example.com',
|
|
96
|
+
* roomId: room.id
|
|
97
|
+
* });
|
|
98
|
+
* })
|
|
99
|
+
* .then(function() {
|
|
100
|
+
* return webex.people.list({email: 'alice@example.com'});
|
|
101
|
+
* })
|
|
102
|
+
* .then(function(people) {
|
|
103
|
+
* var assert = require('assert');
|
|
104
|
+
* assert.equal(people.length, 1);
|
|
105
|
+
* var person = people.items[0];
|
|
106
|
+
* assert(person.id);
|
|
107
|
+
* assert(Array.isArray(person.emails));
|
|
108
|
+
* assert(person.displayName);
|
|
109
|
+
* assert(person.created);
|
|
110
|
+
* return 'success';
|
|
111
|
+
* });
|
|
112
|
+
* // => success
|
|
113
|
+
* @example <caption>Example usage of array method</caption>
|
|
114
|
+
* var room;
|
|
115
|
+
* var aliceId;
|
|
116
|
+
* var bobId;
|
|
117
|
+
* webex.rooms.create({title: 'List People Array Example'})
|
|
118
|
+
* .then(function(r) {
|
|
119
|
+
* room = r;
|
|
120
|
+
* return webex.memberships.create({
|
|
121
|
+
* personEmail: 'alice@example.com',
|
|
122
|
+
* roomId: room.id
|
|
123
|
+
* });
|
|
124
|
+
* })
|
|
125
|
+
* .then(function(membership) {
|
|
126
|
+
* aliceId = membership.personId;
|
|
127
|
+
* })
|
|
128
|
+
* .then(function() {
|
|
129
|
+
* return webex.memberships.create({
|
|
130
|
+
* personEmail: 'bob@example.com',
|
|
131
|
+
* roomId: room.id
|
|
132
|
+
* });
|
|
133
|
+
* })
|
|
134
|
+
* .then(function(membership) {
|
|
135
|
+
* bobId = membership.personId;
|
|
136
|
+
* })
|
|
137
|
+
* .then(function() {
|
|
138
|
+
* return webex.people.list([aliceId, bobId]);
|
|
139
|
+
* })
|
|
140
|
+
* .then(function(people) {
|
|
141
|
+
* var assert = require('assert');
|
|
142
|
+
* assert.equal(people.length, 2);
|
|
143
|
+
* var person = people.items[0];
|
|
144
|
+
* assert(person.id);
|
|
145
|
+
* assert(Array.isArray(person.emails));
|
|
146
|
+
* assert(person.displayName);
|
|
147
|
+
* assert(person.created);
|
|
148
|
+
* return 'success';
|
|
149
|
+
* });
|
|
150
|
+
* // => success
|
|
151
151
|
*/
|
|
152
152
|
list: function list(options) {
|
|
153
153
|
var _this = this;
|
|
@@ -165,11 +165,11 @@ var People = _webexCore.WebexPlugin.extend((_obj = {
|
|
|
165
165
|
return new _webexCore.Page(res, _this.webex);
|
|
166
166
|
});
|
|
167
167
|
},
|
|
168
|
-
/**
|
|
169
|
-
* Converts a uuid to a hydra id without a network dip.
|
|
170
|
-
* @param {string} id
|
|
171
|
-
* @private
|
|
172
|
-
* @returns {string}
|
|
168
|
+
/**
|
|
169
|
+
* Converts a uuid to a hydra id without a network dip.
|
|
170
|
+
* @param {string} id
|
|
171
|
+
* @private
|
|
172
|
+
* @returns {string}
|
|
173
173
|
*/
|
|
174
174
|
inferPersonIdFromUuid: function inferPersonIdFromUuid(id) {
|
|
175
175
|
// base64.validate seems to return true for uuids, so we need a different
|
|
@@ -191,7 +191,7 @@ var People = _webexCore.WebexPlugin.extend((_obj = {
|
|
|
191
191
|
return res.body;
|
|
192
192
|
});
|
|
193
193
|
},
|
|
194
|
-
version: "2.59.
|
|
194
|
+
version: "2.59.0"
|
|
195
195
|
}, ((0, _applyDecoratedDescriptor2.default)(_obj, "_getMe", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, "_getMe"), _obj)), _obj));
|
|
196
196
|
var _default = People;
|
|
197
197
|
exports.default = _default;
|
package/dist/people.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_webexCore","require","_common","_peopleBatcher","_interopRequireDefault","_obj","People","WebexPlugin","extend","namespace","children","batcher","PeopleBatcher","get","person","_promise","default","reject","Error","_getMe","id","personId","request","list","options","_this","_isArray","peopleIds","all","map","service","resource","qs","then","res","Page","webex","inferPersonIdFromUuid","base64","decode","includes","err","encode","concat","body","version","_applyDecoratedDescriptor2","oneFlight","_getOwnPropertyDescriptor","_default","exports"],"sources":["people.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {WebexPlugin, Page} from '@webex/webex-core';\nimport {base64, oneFlight} from '@webex/common';\n\nimport PeopleBatcher from './people-batcher';\n\n/**\n * @typedef {Object} PersonObject\n * @property {string} id - (server generated) Unique identifier for the person\n * @property {Array<email>} emails - Email addresses of the person\n * @property {string} displayName - Display name of the person\n * @property {isoDate} created - (server generated) The date and time that the person was created\n */\n\n/**\n * @class\n */\nconst People = WebexPlugin.extend({\n namespace: 'People',\n\n children: {\n batcher: PeopleBatcher,\n },\n /**\n * Returns a single person by ID\n * @instance\n * @memberof People\n * @param {PersonObject|uuid|string} person\n * @returns {Promise<PersonObject>}\n * @example\n * webex.rooms.create({title: 'Get Person Example'})\n * .then(function(room) {\n * return webex.memberships.create({\n * personEmail: 'alice@example.com',\n * roomId: room.id\n * });\n * })\n * .then(function(membership) {\n * return webex.people.get(membership.personId);\n * })\n * .then(function(alice) {\n * var assert = require('assert');\n * assert(alice.id);\n * assert(Array.isArray(alice.emails));\n * assert.equal(alice.emails.filter(function(email) {\n * return email === 'alice@example.com';\n * }).length, 1);\n * assert(alice.displayName);\n * assert(alice.created);\n * return 'success';\n * });\n * // => success\n */\n get(person) {\n if (!person) {\n return Promise.reject(new Error('A person with an id is required'));\n }\n if (person === 'me') {\n return this._getMe();\n }\n const id = person.personId || person.id || person;\n\n return this.batcher.request(id);\n },\n\n /**\n * Returns a list of people\n * @instance\n * @memberof People\n * @param {Object | uuid[]} options or array of uuids\n * @param {email} options.email - Returns people with an email that contains this string\n * @param {string} options.displayName - Returns people with a name that contains this string\n * @param {bool} showAllTypes optional flag that requires Hydra to send every type field,\n * even if the type is not \"person\" (e.g.: SX10, webhook_integration, etc.)\n * @returns {Promise<Page<PersonObject>>}\n * @example\n * var room;\n * webex.rooms.create({title: 'List People Example'})\n * .then(function(r) {\n * room = r;\n * return webex.memberships.create({\n * personEmail: 'alice@example.com',\n * roomId: room.id\n * });\n * })\n * .then(function() {\n * return webex.memberships.create({\n * personEmail: 'bob@example.com',\n * roomId: room.id\n * });\n * })\n * .then(function() {\n * return webex.people.list({email: 'alice@example.com'});\n * })\n * .then(function(people) {\n * var assert = require('assert');\n * assert.equal(people.length, 1);\n * var person = people.items[0];\n * assert(person.id);\n * assert(Array.isArray(person.emails));\n * assert(person.displayName);\n * assert(person.created);\n * return 'success';\n * });\n * // => success\n * @example <caption>Example usage of array method</caption>\n * var room;\n * var aliceId;\n * var bobId;\n * webex.rooms.create({title: 'List People Array Example'})\n * .then(function(r) {\n * room = r;\n * return webex.memberships.create({\n * personEmail: 'alice@example.com',\n * roomId: room.id\n * });\n * })\n * .then(function(membership) {\n * aliceId = membership.personId;\n * })\n * .then(function() {\n * return webex.memberships.create({\n * personEmail: 'bob@example.com',\n * roomId: room.id\n * });\n * })\n * .then(function(membership) {\n * bobId = membership.personId;\n * })\n * .then(function() {\n * return webex.people.list([aliceId, bobId]);\n * })\n * .then(function(people) {\n * var assert = require('assert');\n * assert.equal(people.length, 2);\n * var person = people.items[0];\n * assert(person.id);\n * assert(Array.isArray(person.emails));\n * assert(person.displayName);\n * assert(person.created);\n * return 'success';\n * });\n * // => success\n */\n list(options) {\n if (Array.isArray(options)) {\n const peopleIds = options;\n\n return Promise.all(peopleIds.map((personId) => this.batcher.request(personId)));\n }\n\n return this.request({\n service: 'hydra',\n resource: 'people',\n qs: options,\n }).then((res) => new Page(res, this.webex));\n },\n\n /**\n * Converts a uuid to a hydra id without a network dip.\n * @param {string} id\n * @private\n * @returns {string}\n */\n inferPersonIdFromUuid(id) {\n // base64.validate seems to return true for uuids, so we need a different\n // check\n try {\n if (base64.decode(id).includes('ciscospark://')) {\n return id;\n }\n } catch (err) {\n // ignore\n }\n\n return base64.encode(`ciscospark://us/PEOPLE/${id}`);\n },\n\n /**\n * Fetches the current user from the /people/me endpoint\n * @instance\n * @memberof People\n * @private\n * @returns {Promise<PersonObject>}\n */\n @oneFlight\n _getMe() {\n return this.webex\n .request({\n service: 'hydra',\n resource: 'people/me',\n })\n .then((res) => res.body);\n },\n});\n\nexport default People;\n"],"mappings":";;;;;;;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,cAAA,GAAAC,sBAAA,CAAAH,OAAA;AAA6C,IAAAI,IAAA;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAMC,MAAM,GAAGC,sBAAW,CAACC,MAAM,EAAAH,IAAA,GAAC;EAChCI,SAAS,EAAE,QAAQ;EAEnBC,QAAQ,EAAE;IACRC,OAAO,EAAEC;EACX,CAAC;EACD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,GAAG,WAAAA,IAACC,MAAM,EAAE;IACV,IAAI,CAACA,MAAM,EAAE;MACX,OAAOC,QAAA,CAAAC,OAAA,CAAQC,MAAM,CAAC,IAAIC,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrE;IACA,IAAIJ,MAAM,KAAK,IAAI,EAAE;MACnB,OAAO,IAAI,CAACK,MAAM,EAAE;IACtB;IACA,IAAMC,EAAE,GAAGN,MAAM,CAACO,QAAQ,IAAIP,MAAM,CAACM,EAAE,IAAIN,MAAM;IAEjD,OAAO,IAAI,CAACH,OAAO,CAACW,OAAO,CAACF,EAAE,CAAC;EACjC,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEG,IAAI,WAAAA,KAACC,OAAO,EAAE;IAAA,IAAAC,KAAA;IACZ,IAAI,IAAAC,QAAA,CAAAV,OAAA,EAAcQ,OAAO,CAAC,EAAE;MAC1B,IAAMG,SAAS,GAAGH,OAAO;MAEzB,OAAOT,QAAA,CAAAC,OAAA,CAAQY,GAAG,CAACD,SAAS,CAACE,GAAG,CAAC,UAACR,QAAQ;QAAA,OAAKI,KAAI,CAACd,OAAO,CAACW,OAAO,CAACD,QAAQ,CAAC;MAAA,EAAC,CAAC;IACjF;IAEA,OAAO,IAAI,CAACC,OAAO,CAAC;MAClBQ,OAAO,EAAE,OAAO;MAChBC,QAAQ,EAAE,QAAQ;MAClBC,EAAE,EAAER;IACN,CAAC,CAAC,CAACS,IAAI,CAAC,UAACC,GAAG;MAAA,OAAK,IAAIC,eAAI,CAACD,GAAG,EAAET,KAAI,CAACW,KAAK,CAAC;IAAA,EAAC;EAC7C,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEC,qBAAqB,WAAAA,sBAACjB,EAAE,EAAE;IACxB;IACA;IACA,IAAI;MACF,IAAIkB,cAAM,CAACC,MAAM,CAACnB,EAAE,CAAC,CAACoB,QAAQ,CAAC,eAAe,CAAC,EAAE;QAC/C,OAAOpB,EAAE;MACX;IACF,CAAC,CAAC,OAAOqB,GAAG,EAAE;MACZ;IAAA;IAGF,OAAOH,cAAM,CAACI,MAAM,2BAAAC,MAAA,CAA2BvB,EAAE,EAAG;EACtD,CAAC;EAUDD,MAAM,WAAAA,OAAA,EAAG;IACP,OAAO,IAAI,CAACiB,KAAK,CACdd,OAAO,CAAC;MACPQ,OAAO,EAAE,OAAO;MAChBC,QAAQ,EAAE;IACZ,CAAC,CAAC,CACDE,IAAI,CAAC,UAACC,GAAG;MAAA,OAAKA,GAAG,CAACU,IAAI;IAAA,EAAC;EAC5B,CAAC;EAAAC,OAAA;AACH,CAAC,OAAAC,0BAAA,CAAA9B,OAAA,EAAAX,IAAA,aATE0C,iBAAS,OAAAC,yBAAA,CAAAhC,OAAA,EAAAX,IAAA,aAAAA,IAAA,IAAAA,IAAA,EASV;AAAC,IAAA4C,QAAA,GAEY3C,MAAM;AAAA4C,OAAA,CAAAlC,OAAA,GAAAiC,QAAA"}
|
|
1
|
+
{"version":3,"names":["_webexCore","require","_common","_peopleBatcher","_interopRequireDefault","_obj","People","WebexPlugin","extend","namespace","children","batcher","PeopleBatcher","get","person","_promise","default","reject","Error","_getMe","id","personId","request","list","options","_this","_isArray","peopleIds","all","map","service","resource","qs","then","res","Page","webex","inferPersonIdFromUuid","base64","decode","includes","err","encode","concat","body","version","_applyDecoratedDescriptor2","oneFlight","_getOwnPropertyDescriptor","_default","exports"],"sources":["people.js"],"sourcesContent":["/*!\r\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\r\n */\r\n\r\nimport {WebexPlugin, Page} from '@webex/webex-core';\r\nimport {base64, oneFlight} from '@webex/common';\r\n\r\nimport PeopleBatcher from './people-batcher';\r\n\r\n/**\r\n * @typedef {Object} PersonObject\r\n * @property {string} id - (server generated) Unique identifier for the person\r\n * @property {Array<email>} emails - Email addresses of the person\r\n * @property {string} displayName - Display name of the person\r\n * @property {isoDate} created - (server generated) The date and time that the person was created\r\n */\r\n\r\n/**\r\n * @class\r\n */\r\nconst People = WebexPlugin.extend({\r\n namespace: 'People',\r\n\r\n children: {\r\n batcher: PeopleBatcher,\r\n },\r\n /**\r\n * Returns a single person by ID\r\n * @instance\r\n * @memberof People\r\n * @param {PersonObject|uuid|string} person\r\n * @returns {Promise<PersonObject>}\r\n * @example\r\n * webex.rooms.create({title: 'Get Person Example'})\r\n * .then(function(room) {\r\n * return webex.memberships.create({\r\n * personEmail: 'alice@example.com',\r\n * roomId: room.id\r\n * });\r\n * })\r\n * .then(function(membership) {\r\n * return webex.people.get(membership.personId);\r\n * })\r\n * .then(function(alice) {\r\n * var assert = require('assert');\r\n * assert(alice.id);\r\n * assert(Array.isArray(alice.emails));\r\n * assert.equal(alice.emails.filter(function(email) {\r\n * return email === 'alice@example.com';\r\n * }).length, 1);\r\n * assert(alice.displayName);\r\n * assert(alice.created);\r\n * return 'success';\r\n * });\r\n * // => success\r\n */\r\n get(person) {\r\n if (!person) {\r\n return Promise.reject(new Error('A person with an id is required'));\r\n }\r\n if (person === 'me') {\r\n return this._getMe();\r\n }\r\n const id = person.personId || person.id || person;\r\n\r\n return this.batcher.request(id);\r\n },\r\n\r\n /**\r\n * Returns a list of people\r\n * @instance\r\n * @memberof People\r\n * @param {Object | uuid[]} options or array of uuids\r\n * @param {email} options.email - Returns people with an email that contains this string\r\n * @param {string} options.displayName - Returns people with a name that contains this string\r\n * @param {bool} showAllTypes optional flag that requires Hydra to send every type field,\r\n * even if the type is not \"person\" (e.g.: SX10, webhook_integration, etc.)\r\n * @returns {Promise<Page<PersonObject>>}\r\n * @example\r\n * var room;\r\n * webex.rooms.create({title: 'List People Example'})\r\n * .then(function(r) {\r\n * room = r;\r\n * return webex.memberships.create({\r\n * personEmail: 'alice@example.com',\r\n * roomId: room.id\r\n * });\r\n * })\r\n * .then(function() {\r\n * return webex.memberships.create({\r\n * personEmail: 'bob@example.com',\r\n * roomId: room.id\r\n * });\r\n * })\r\n * .then(function() {\r\n * return webex.people.list({email: 'alice@example.com'});\r\n * })\r\n * .then(function(people) {\r\n * var assert = require('assert');\r\n * assert.equal(people.length, 1);\r\n * var person = people.items[0];\r\n * assert(person.id);\r\n * assert(Array.isArray(person.emails));\r\n * assert(person.displayName);\r\n * assert(person.created);\r\n * return 'success';\r\n * });\r\n * // => success\r\n * @example <caption>Example usage of array method</caption>\r\n * var room;\r\n * var aliceId;\r\n * var bobId;\r\n * webex.rooms.create({title: 'List People Array Example'})\r\n * .then(function(r) {\r\n * room = r;\r\n * return webex.memberships.create({\r\n * personEmail: 'alice@example.com',\r\n * roomId: room.id\r\n * });\r\n * })\r\n * .then(function(membership) {\r\n * aliceId = membership.personId;\r\n * })\r\n * .then(function() {\r\n * return webex.memberships.create({\r\n * personEmail: 'bob@example.com',\r\n * roomId: room.id\r\n * });\r\n * })\r\n * .then(function(membership) {\r\n * bobId = membership.personId;\r\n * })\r\n * .then(function() {\r\n * return webex.people.list([aliceId, bobId]);\r\n * })\r\n * .then(function(people) {\r\n * var assert = require('assert');\r\n * assert.equal(people.length, 2);\r\n * var person = people.items[0];\r\n * assert(person.id);\r\n * assert(Array.isArray(person.emails));\r\n * assert(person.displayName);\r\n * assert(person.created);\r\n * return 'success';\r\n * });\r\n * // => success\r\n */\r\n list(options) {\r\n if (Array.isArray(options)) {\r\n const peopleIds = options;\r\n\r\n return Promise.all(peopleIds.map((personId) => this.batcher.request(personId)));\r\n }\r\n\r\n return this.request({\r\n service: 'hydra',\r\n resource: 'people',\r\n qs: options,\r\n }).then((res) => new Page(res, this.webex));\r\n },\r\n\r\n /**\r\n * Converts a uuid to a hydra id without a network dip.\r\n * @param {string} id\r\n * @private\r\n * @returns {string}\r\n */\r\n inferPersonIdFromUuid(id) {\r\n // base64.validate seems to return true for uuids, so we need a different\r\n // check\r\n try {\r\n if (base64.decode(id).includes('ciscospark://')) {\r\n return id;\r\n }\r\n } catch (err) {\r\n // ignore\r\n }\r\n\r\n return base64.encode(`ciscospark://us/PEOPLE/${id}`);\r\n },\r\n\r\n /**\r\n * Fetches the current user from the /people/me endpoint\r\n * @instance\r\n * @memberof People\r\n * @private\r\n * @returns {Promise<PersonObject>}\r\n */\r\n @oneFlight\r\n _getMe() {\r\n return this.webex\r\n .request({\r\n service: 'hydra',\r\n resource: 'people/me',\r\n })\r\n .then((res) => res.body);\r\n },\r\n});\r\n\r\nexport default People;\r\n"],"mappings":";;;;;;;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,cAAA,GAAAC,sBAAA,CAAAH,OAAA;AAA6C,IAAAI,IAAA;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAMC,MAAM,GAAGC,sBAAW,CAACC,MAAM,EAAAH,IAAA,GAAC;EAChCI,SAAS,EAAE,QAAQ;EAEnBC,QAAQ,EAAE;IACRC,OAAO,EAAEC;EACX,CAAC;EACD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,GAAG,WAAAA,IAACC,MAAM,EAAE;IACV,IAAI,CAACA,MAAM,EAAE;MACX,OAAOC,QAAA,CAAAC,OAAA,CAAQC,MAAM,CAAC,IAAIC,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrE;IACA,IAAIJ,MAAM,KAAK,IAAI,EAAE;MACnB,OAAO,IAAI,CAACK,MAAM,EAAE;IACtB;IACA,IAAMC,EAAE,GAAGN,MAAM,CAACO,QAAQ,IAAIP,MAAM,CAACM,EAAE,IAAIN,MAAM;IAEjD,OAAO,IAAI,CAACH,OAAO,CAACW,OAAO,CAACF,EAAE,CAAC;EACjC,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEG,IAAI,WAAAA,KAACC,OAAO,EAAE;IAAA,IAAAC,KAAA;IACZ,IAAI,IAAAC,QAAA,CAAAV,OAAA,EAAcQ,OAAO,CAAC,EAAE;MAC1B,IAAMG,SAAS,GAAGH,OAAO;MAEzB,OAAOT,QAAA,CAAAC,OAAA,CAAQY,GAAG,CAACD,SAAS,CAACE,GAAG,CAAC,UAACR,QAAQ;QAAA,OAAKI,KAAI,CAACd,OAAO,CAACW,OAAO,CAACD,QAAQ,CAAC;MAAA,EAAC,CAAC;IACjF;IAEA,OAAO,IAAI,CAACC,OAAO,CAAC;MAClBQ,OAAO,EAAE,OAAO;MAChBC,QAAQ,EAAE,QAAQ;MAClBC,EAAE,EAAER;IACN,CAAC,CAAC,CAACS,IAAI,CAAC,UAACC,GAAG;MAAA,OAAK,IAAIC,eAAI,CAACD,GAAG,EAAET,KAAI,CAACW,KAAK,CAAC;IAAA,EAAC;EAC7C,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEC,qBAAqB,WAAAA,sBAACjB,EAAE,EAAE;IACxB;IACA;IACA,IAAI;MACF,IAAIkB,cAAM,CAACC,MAAM,CAACnB,EAAE,CAAC,CAACoB,QAAQ,CAAC,eAAe,CAAC,EAAE;QAC/C,OAAOpB,EAAE;MACX;IACF,CAAC,CAAC,OAAOqB,GAAG,EAAE;MACZ;IAAA;IAGF,OAAOH,cAAM,CAACI,MAAM,2BAAAC,MAAA,CAA2BvB,EAAE,EAAG;EACtD,CAAC;EAUDD,MAAM,WAAAA,OAAA,EAAG;IACP,OAAO,IAAI,CAACiB,KAAK,CACdd,OAAO,CAAC;MACPQ,OAAO,EAAE,OAAO;MAChBC,QAAQ,EAAE;IACZ,CAAC,CAAC,CACDE,IAAI,CAAC,UAACC,GAAG;MAAA,OAAKA,GAAG,CAACU,IAAI;IAAA,EAAC;EAC5B,CAAC;EAAAC,OAAA;AACH,CAAC,OAAAC,0BAAA,CAAA9B,OAAA,EAAAX,IAAA,aATE0C,iBAAS,OAAAC,yBAAA,CAAAhC,OAAA,EAAAX,IAAA,aAAAA,IAAA,IAAAA,IAAA,EASV;AAAC,IAAA4C,QAAA,GAEY3C,MAAM;AAAA4C,OAAA,CAAAlC,OAAA,GAAAiC,QAAA"}
|
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;
|