@webex/plugin-people 3.0.0-bnr.5 → 3.0.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.
- package/.eslintrc.js +6 -0
- package/babel.config.js +3 -0
- package/dist/config.js +1 -2
- package/dist/config.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/people-batcher.js +1 -2
- package/dist/people-batcher.js.map +1 -1
- package/dist/people.js +5 -4
- package/dist/people.js.map +1 -1
- package/jest.config.js +3 -0
- package/package.json +26 -10
- package/process +1 -0
- package/test/integration/spec/people.js +2 -1
- package/dist/plugin-people.d.ts +0 -7
- package/dist/tsdoc-metadata.json +0 -11
- package/dist/types/config.d.ts +0 -9
- package/dist/types/index.d.ts +0 -1
- package/dist/types/people-batcher.d.ts +0 -6
- package/dist/types/people.d.ts +0 -30
package/.eslintrc.js
ADDED
package/babel.config.js
ADDED
package/dist/config.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
/*!
|
|
9
9
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
10
10
|
*/
|
|
11
|
-
var _default = {
|
|
11
|
+
var _default = exports.default = {
|
|
12
12
|
people: {
|
|
13
13
|
batcherWait: 100,
|
|
14
14
|
batcherMaxCalls: 10,
|
|
@@ -21,5 +21,4 @@ var _default = {
|
|
|
21
21
|
showAllTypes: false
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
exports.default = _default;
|
|
25
24
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["people","batcherWait","batcherMaxCalls","batcherMaxWait","showAllTypes"],"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,
|
|
1
|
+
{"version":3,"names":["_default","exports","default","people","batcherWait","batcherMaxCalls","batcherMaxWait","showAllTypes"],"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,GAAAC,OAAA,CAAAC,OAAA,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"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["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;AAEA;AACA;AAPA;AACA;AACA;;AAOA,
|
|
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"}
|
package/dist/people-batcher.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PersonUUIDRequestBatcher","Batcher","extend","namespace","handleHttpSuccess","res","promises","body","items","map","personResponse","handleItemSuccess","id","notFoundIds","concat","handleItemFailure","all","getDeferredForResponse","then","defer","reject","email","response","resolve","fingerprintRequest","uuidOrHydraId","hydraId","webex","people","inferPersonIdFromUuid","fingerprintResponse","prepareRequest","ids","join","submitHttpRequest","request","service","resource","config","showAllTypes"],"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;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA,
|
|
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,CAC3D,CAAC;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,CAAC,CAAC,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,GAAAC,OAAA,CAAA1B,OAAA,GAEYlB,wBAAwB"}
|
package/dist/people.js
CHANGED
|
@@ -14,6 +14,9 @@ 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
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
19
|
+
*/
|
|
17
20
|
/**
|
|
18
21
|
* @typedef {Object} PersonObject
|
|
19
22
|
* @property {string} id - (server generated) Unique identifier for the person
|
|
@@ -21,7 +24,6 @@ var _obj;
|
|
|
21
24
|
* @property {string} displayName - Display name of the person
|
|
22
25
|
* @property {isoDate} created - (server generated) The date and time that the person was created
|
|
23
26
|
*/
|
|
24
|
-
|
|
25
27
|
/**
|
|
26
28
|
* @class
|
|
27
29
|
*/
|
|
@@ -191,8 +193,7 @@ var People = _webexCore.WebexPlugin.extend((_obj = {
|
|
|
191
193
|
return res.body;
|
|
192
194
|
});
|
|
193
195
|
},
|
|
194
|
-
version: "3.0.0
|
|
196
|
+
version: "3.0.0"
|
|
195
197
|
}, ((0, _applyDecoratedDescriptor2.default)(_obj, "_getMe", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, "_getMe"), _obj)), _obj));
|
|
196
|
-
var _default = People;
|
|
197
|
-
exports.default = _default;
|
|
198
|
+
var _default = exports.default = People;
|
|
198
199
|
//# sourceMappingURL=people.js.map
|
package/dist/people.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["People","WebexPlugin","extend","namespace","children","batcher","PeopleBatcher","get","person","reject","Error","_getMe","id","personId","request","list","options","peopleIds","all","map","service","resource","qs","then","res","Page","webex","inferPersonIdFromUuid","base64","decode","includes","err","encode","body","oneFlight"],"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;AACA;AAEA;AAA6C;
|
|
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;AAP7C;AACA;AACA;AAOA;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,CAAC,CAAC;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,CAAE,CAAC;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,CASX,CAAC;AAAC,IAAA4C,QAAA,GAAAC,OAAA,CAAAlC,OAAA,GAEYV,MAAM"}
|
package/jest.config.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/plugin-people",
|
|
3
|
-
"version": "3.0.0-bnr.5",
|
|
4
3
|
"description": "",
|
|
5
4
|
"license": "MIT",
|
|
6
5
|
"main": "dist/index.js",
|
|
@@ -20,15 +19,32 @@
|
|
|
20
19
|
]
|
|
21
20
|
},
|
|
22
21
|
"devDependencies": {
|
|
23
|
-
"@
|
|
24
|
-
"@webex/
|
|
25
|
-
"@webex/
|
|
22
|
+
"@babel/core": "^7.17.10",
|
|
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": "3.0.0",
|
|
28
|
+
"@webex/test-helper-mocha": "3.0.0",
|
|
29
|
+
"@webex/test-helper-mock-webex": "3.0.0",
|
|
30
|
+
"@webex/test-helper-test-users": "3.0.0",
|
|
31
|
+
"eslint": "^8.24.0",
|
|
32
|
+
"prettier": "^2.7.1",
|
|
26
33
|
"sinon": "^9.2.4"
|
|
27
34
|
},
|
|
28
35
|
"dependencies": {
|
|
29
|
-
"@webex/common": "3.0.0
|
|
30
|
-
"@webex/internal-plugin-mercury": "3.0.0
|
|
31
|
-
"@webex/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
"@webex/common": "3.0.0",
|
|
37
|
+
"@webex/internal-plugin-mercury": "3.0.0",
|
|
38
|
+
"@webex/webex-core": "3.0.0"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "yarn build:src",
|
|
42
|
+
"build:src": "webex-legacy-tools build -dest \"./dist\" -src \"./src\" -js -ts -maps",
|
|
43
|
+
"deploy:npm": "yarn npm publish",
|
|
44
|
+
"test": "yarn test:style && yarn test:unit && yarn test:integration && yarn test:browser",
|
|
45
|
+
"test:browser:broken": "webex-legacy-tools test --integration --runner karma",
|
|
46
|
+
"test:style": "eslint ./src/**/*.*",
|
|
47
|
+
"test:unit": "webex-legacy-tools test --unit --runner jest"
|
|
48
|
+
},
|
|
49
|
+
"version": "3.0.0"
|
|
50
|
+
}
|
package/process
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {browser: true};
|
|
@@ -97,7 +97,8 @@ describe('plugin-people', function () {
|
|
|
97
97
|
assert.equal(person.emails[0], mccoy.email);
|
|
98
98
|
}));
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
// SPARK-413317
|
|
101
|
+
it.skip('returns a list of people matching name', () =>
|
|
101
102
|
spock.webex.people.list({displayName: mccoy.name}).then((peopleResponse) => {
|
|
102
103
|
assert.isAbove(peopleResponse.items.length, 0);
|
|
103
104
|
let isMccoyFound = false;
|
package/dist/plugin-people.d.ts
DELETED
package/dist/tsdoc-metadata.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
-
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
-
{
|
|
4
|
-
"tsdocVersion": "0.12",
|
|
5
|
-
"toolPackages": [
|
|
6
|
-
{
|
|
7
|
-
"packageName": "@microsoft/api-extractor",
|
|
8
|
-
"packageVersion": "7.34.4"
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|
package/dist/types/config.d.ts
DELETED
package/dist/types/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./people";
|
package/dist/types/people.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export default People;
|
|
2
|
-
export type PersonObject = {
|
|
3
|
-
/**
|
|
4
|
-
* - (server generated) Unique identifier for the person
|
|
5
|
-
*/
|
|
6
|
-
id: string;
|
|
7
|
-
/**
|
|
8
|
-
* - Email addresses of the person
|
|
9
|
-
*/
|
|
10
|
-
emails: Array<email>;
|
|
11
|
-
/**
|
|
12
|
-
* - Display name of the person
|
|
13
|
-
*/
|
|
14
|
-
displayName: string;
|
|
15
|
-
/**
|
|
16
|
-
* - (server generated) The date and time that the person was created
|
|
17
|
-
*/
|
|
18
|
-
created: isoDate;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* @typedef {Object} PersonObject
|
|
22
|
-
* @property {string} id - (server generated) Unique identifier for the person
|
|
23
|
-
* @property {Array<email>} emails - Email addresses of the person
|
|
24
|
-
* @property {string} displayName - Display name of the person
|
|
25
|
-
* @property {isoDate} created - (server generated) The date and time that the person was created
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* @class
|
|
29
|
-
*/
|
|
30
|
-
declare const People: any;
|