@webex/internal-plugin-dss 2.26.2 → 2.28.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/README.md CHANGED
@@ -48,6 +48,12 @@ webex.internal.dss.lookupDetail({id: <entity-uuid>}).then((results) => {})
48
48
  // Get information on multiple identities
49
49
  webex.internal.dss.lookup({ids: [<entity-uuid-1>, <entity-uuid-2>]}).then((results) => {})
50
50
 
51
+ // If you know the entity provider, you can speed up the query
52
+ webex.internal.dss.lookup({
53
+ ids: [<entity-uuid-1>, <entity-uuid-2>],
54
+ entityProviderType: 'CI_USER'
55
+ }).then((results) => {})
56
+
51
57
  // Get information on entities by querying their email addresses
52
58
  webex.internal.dss.lookupByEmail(
53
59
  {emails: ['email1@example.com', 'email2@example.com']}
package/dist/dss.js CHANGED
@@ -231,13 +231,16 @@ var DSS = _webexCore.WebexPlugin.extend({
231
231
  * Retrieves basic information about a list entities within an organization
232
232
  * @param {Object} options
233
233
  * @param {UUID} options.ids the id of the entity to lookup
234
+ * @param {UUID} options.entityProviderType the provider to query (optional)
234
235
  * @returns {Promise} Resolves with an array of entities found
235
236
  */
236
237
  lookup: function lookup(options) {
237
- var ids = options.ids;
238
+ var ids = options.ids,
239
+ entityProviderType = options.entityProviderType;
240
+ var resource = entityProviderType ? "/lookup/orgid/".concat(this.webex.internal.device.orgId, "/entityprovidertype/").concat(entityProviderType) : "/lookup/orgid/".concat(this.webex.internal.device.orgId, "/identities");
238
241
  return this._request({
239
242
  dataPath: 'lookupResult.entities',
240
- resource: "/lookup/orgid/".concat(this.webex.internal.device.orgId, "/identities"),
243
+ resource: resource,
241
244
  params: {
242
245
  lookupValues: ids
243
246
  }
@@ -283,7 +286,7 @@ var DSS = _webexCore.WebexPlugin.extend({
283
286
  }
284
287
  });
285
288
  },
286
- version: "2.26.2"
289
+ version: "2.28.0"
287
290
  });
288
291
 
289
292
  var _default = DSS;
package/dist/dss.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["DSS","WebexPlugin","extend","namespace","registered","register","webex","canAuthorize","logger","error","reject","Error","info","resolve","internal","mercury","connect","then","listenForEvents","trigger","DSS_REGISTERED","catch","message","unregister","stopListeningForEvents","disconnect","DSS_UNREGISTERED","on","DSS_LOOKUP_MERCURY_EVENT","envelope","_handleEvent","data","DSS_SEARCH_MERCURY_EVENT","off","_getResultEventName","requestId","DSS_RESULT","DSS_LOOKUP_RESULT","_request","options","resource","params","dataPath","uuid","v4","eventName","result","expectedSeqNums","listenTo","resultData","sequence","finished","map","String","done","resultArray","forEach","index","seqResult","push","stopListening","request","service","DSS_SERVICE_NAME","method","contentType","body","lookupDetail","id","device","orgId","lookup","ids","lookupValues","lookupByEmail","emails","search","requestedTypes","resultSize","queryString"],"sources":["dss.ts"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\n/*!\n * Copyright (c) 2015-2022 Cisco Systems, Inc. See LICENSE file.\n */\nimport uuid from 'uuid';\nimport {WebexPlugin} from '@webex/webex-core';\nimport '@webex/internal-plugin-mercury';\nimport {range, isEqual, get} from 'lodash';\nimport type {SearchOptions, LookupDetailOptions, LookupOptions, LookupByEmailOptions} from './types';\n\nimport {\n DSS_REGISTERED,\n DSS_UNREGISTERED,\n DSS_LOOKUP_MERCURY_EVENT,\n DSS_LOOKUP_RESULT,\n DSS_SERVICE_NAME,\n DSS_SEARCH_MERCURY_EVENT,\n DSS_RESULT,\n} from './constants';\n\nconst DSS = WebexPlugin.extend({\n namespace: 'DSS',\n\n /**\n * registered value indicating events registration is successful\n * @instance\n * @type {Boolean}\n * @memberof DSS\n */\n registered: false,\n\n /**\n * Explicitly sets up the DSS plugin by connecting to mercury, and listening for DSS events.\n * @returns {Promise}\n * @public\n * @memberof DSS\n */\n register() {\n if (!this.webex.canAuthorize) {\n this.logger.error('DSS->register#ERROR, Unable to register, SDK cannot authorize');\n\n return Promise.reject(new Error('SDK cannot authorize'));\n }\n\n if (this.registered) {\n this.logger.info('dss->register#INFO, DSS plugin already registered');\n\n return Promise.resolve();\n }\n\n return this.webex.internal.mercury.connect()\n .then(() => {\n this.listenForEvents();\n this.trigger(DSS_REGISTERED);\n this.registered = true;\n })\n .catch((error) => {\n this.logger.error(`DSS->register#ERROR, Unable to register, ${error.message}`);\n\n return Promise.reject(error);\n });\n },\n\n /**\n * Explicitly tears down the DSS plugin by disconnecting from mercury, and stops listening to DSS events\n * @returns {Promise}\n * @public\n * @memberof DSS\n */\n unregister() {\n if (!this.registered) {\n this.logger.info('DSS->unregister#INFO, DSS plugin already unregistered');\n\n return Promise.resolve();\n }\n\n this.stopListeningForEvents();\n\n return this.webex.internal.mercury.disconnect()\n .then(() => {\n this.trigger(DSS_UNREGISTERED);\n this.registered = false;\n });\n },\n\n /**\n * registers for DSS events through mercury\n * @returns {undefined}\n * @private\n */\n listenForEvents() {\n this.webex.internal.mercury.on(DSS_LOOKUP_MERCURY_EVENT, (envelope) => {\n this._handleEvent(envelope.data);\n });\n this.webex.internal.mercury.on(DSS_SEARCH_MERCURY_EVENT, (envelope) => {\n this._handleEvent(envelope.data);\n });\n },\n\n /**\n * unregisteres all the DSS events from mercury\n * @returns {undefined}\n * @private\n */\n stopListeningForEvents() {\n this.webex.internal.mercury.off(DSS_LOOKUP_MERCURY_EVENT);\n this.webex.internal.mercury.off(DSS_SEARCH_MERCURY_EVENT);\n },\n\n /**\n * @param {UUID} requestId the id of the request\n * @returns {string}\n */\n _getResultEventName(requestId) {\n return `${DSS_RESULT}${requestId}`;\n },\n\n /**\n * @param {Object} data the event data\n * @returns {undefined}\n */\n _handleEvent(data) {\n this.trigger(this._getResultEventName(data.requestId), data);\n this.trigger(DSS_LOOKUP_RESULT, data);\n },\n\n /**\n * Makes the request to the directory service\n * @param {Object} options\n * @param {string} options.resource the URL to query\n * @param {string} options.params additional params for the body of the request\n * @param {string} options.dataPath to path to get the data in the result object\n * @returns {Promise} Resolves with an array of entities found\n */\n _request(options) {\n const {resource, params, dataPath} = options;\n\n const requestId = uuid.v4();\n const eventName = this._getResultEventName(requestId);\n const result = {};\n let expectedSeqNums;\n\n return new Promise((resolve) => {\n this.listenTo(this, eventName, (data) => {\n const resultData = get(data, dataPath);\n\n result[data.sequence] = resultData;\n\n if (data.finished) {\n expectedSeqNums = range(data.sequence + 1).map(String);\n }\n\n const done = isEqual(expectedSeqNums, Object.keys(result));\n\n if (done) {\n const resultArray = [];\n expectedSeqNums.forEach((index) => {\n const seqResult = result[index];\n if (seqResult) {\n resultArray.push(...seqResult);\n }\n })\n\n resolve(resultArray);\n this.stopListening(this, eventName);\n }\n });\n this.webex.request({\n service: DSS_SERVICE_NAME,\n resource,\n method: 'POST',\n contentType: 'application/json',\n body: {requestId, ...params}\n });\n });\n },\n\n /**\n * Retrieves detailed information about an entity\n * @param {Object} options\n * @param {UUID} options.id the id of the entity to lookup\n * @returns {Promise} Resolves with an array of entities found\n */\n lookupDetail(options: LookupDetailOptions) {\n const {id} = options;\n\n return this._request({\n dataPath: 'lookupResult.entities',\n resource: `/lookup/orgid/${this.webex.internal.device.orgId}/identity/${id}/detail`\n });\n },\n\n /**\n * Retrieves basic information about a list entities within an organization\n * @param {Object} options\n * @param {UUID} options.ids the id of the entity to lookup\n * @returns {Promise} Resolves with an array of entities found\n */\n lookup(options: LookupOptions) {\n const {ids} = options;\n\n return this._request({\n dataPath: 'lookupResult.entities',\n resource: `/lookup/orgid/${this.webex.internal.device.orgId}/identities`,\n params: {\n lookupValues: ids,\n }\n });\n },\n\n /**\n * Retrieves basic information about a list entities within an organization\n * @param {Object} options\n * @param {UUID} options.emails the emails of the entities to lookup\n * @returns {Promise} Resolves with an array of entities found\n */\n lookupByEmail(options: LookupByEmailOptions) {\n const {emails} = options;\n\n return this._request({\n dataPath: 'lookupResult.entities',\n resource: `/lookup/orgid/${this.webex.internal.device.orgId}/emails`,\n params: {\n lookupValues: emails,\n }\n });\n },\n\n /**\n * Search for information about entities\n * @param {Object} options\n * @param {SearchType[]} options.requestedTypes an array of search types from: PERSON, CALLING_SERVICE, EXTERNAL_CALLING, ROOM, ROBOT\n * @param {string[]} options.queryString A query string that will be transformed into a Directory search filter query. It is used to search the following fields: username, givenName, familyName, displayName and email\n * @param {number} options.resultSize The maximum number of results returned from each provider\n * @returns {Promise} Resolves with an array of entities found\n */\n search(options: SearchOptions) {\n const {\n requestedTypes, resultSize, queryString\n } = options;\n\n return this._request({\n dataPath: 'directoryEntities',\n resource: `/search/orgid/${this.webex.internal.device.orgId}/entities`,\n params: {\n queryString,\n resultSize,\n requestedTypes\n }\n });\n }\n\n});\n\nexport default DSS;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;;AACA;;AACA;;AAIA;;;;;;AAUA,IAAMA,GAAG,GAAGC,sBAAA,CAAYC,MAAZ,CAAmB;EAC7BC,SAAS,EAAE,KADkB;;EAG7B;AACF;AACA;AACA;AACA;AACA;EACEC,UAAU,EAAE,KATiB;;EAW7B;AACF;AACA;AACA;AACA;AACA;EACEC,QAjB6B,sBAiBlB;IAAA;;IACT,IAAI,CAAC,KAAKC,KAAL,CAAWC,YAAhB,EAA8B;MAC5B,KAAKC,MAAL,CAAYC,KAAZ,CAAkB,+DAAlB;MAEA,OAAO,iBAAQC,MAAR,CAAe,IAAIC,KAAJ,CAAU,sBAAV,CAAf,CAAP;IACD;;IAED,IAAI,KAAKP,UAAT,EAAqB;MACnB,KAAKI,MAAL,CAAYI,IAAZ,CAAiB,mDAAjB;MAEA,OAAO,iBAAQC,OAAR,EAAP;IACD;;IAED,OAAO,KAAKP,KAAL,CAAWQ,QAAX,CAAoBC,OAApB,CAA4BC,OAA5B,GACJC,IADI,CACC,YAAM;MACV,KAAI,CAACC,eAAL;;MACA,KAAI,CAACC,OAAL,CAAaC,yBAAb;;MACA,KAAI,CAAChB,UAAL,GAAkB,IAAlB;IACD,CALI,EAMJiB,KANI,CAME,UAACZ,KAAD,EAAW;MAChB,KAAI,CAACD,MAAL,CAAYC,KAAZ,oDAA8DA,KAAK,CAAC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EE,aApM6B,yBAoMfnC,OApMe,EAoMgB;IAC3C,IAAOoC,MAAP,GAAiBpC,OAAjB,CAAOoC,MAAP;IAEA,OAAO,KAAKrC,QAAL,CAAc;MACnBI,QAAQ,EAAE,uBADS;MAEnBF,QAAQ,0BAAmB,KAAKlC,KAAL,CAAWQ,QAAX,CAAoBuD,MAApB,CAA2BC,KAA9C,YAFW;MAGnB7B,MAAM,EAAE;QACNgC,YAAY,EAAEE;MADR;IAHW,CAAd,CAAP;EAOD,CA9M4B;;EAgN7B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,MAxN6B,kBAwNtBrC,OAxNsB,EAwNE;IAC7B,IACEsC,cADF,GAEItC,OAFJ,CACEsC,cADF;IAAA,IACkBC,UADlB,GAEIvC,OAFJ,CACkBuC,UADlB;IAAA,IAC8BC,WAD9B,GAEIxC,OAFJ,CAC8BwC,WAD9B;IAIA,OAAO,KAAKzC,QAAL,CAAc;MACnBI,QAAQ,EAAE,mBADS;MAEnBF,QAAQ,0BAAmB,KAAKlC,KAAL,CAAWQ,QAAX,CAAoBuD,MAApB,CAA2BC,KAA9C,cAFW;MAGnB7B,MAAM,EAAE;QACNsC,WAAW,EAAXA,WADM;QAEND,UAAU,EAAVA,UAFM;QAGND,cAAc,EAAdA;MAHM;IAHW,CAAd,CAAP;EASD,CAtO4B;EAAA;AAAA,CAAnB,CAAZ;;eA0Oe7E,G"}
1
+ {"version":3,"names":["DSS","WebexPlugin","extend","namespace","registered","register","webex","canAuthorize","logger","error","reject","Error","info","resolve","internal","mercury","connect","then","listenForEvents","trigger","DSS_REGISTERED","catch","message","unregister","stopListeningForEvents","disconnect","DSS_UNREGISTERED","on","DSS_LOOKUP_MERCURY_EVENT","envelope","_handleEvent","data","DSS_SEARCH_MERCURY_EVENT","off","_getResultEventName","requestId","DSS_RESULT","DSS_LOOKUP_RESULT","_request","options","resource","params","dataPath","uuid","v4","eventName","result","expectedSeqNums","listenTo","resultData","sequence","finished","map","String","done","resultArray","forEach","index","seqResult","push","stopListening","request","service","DSS_SERVICE_NAME","method","contentType","body","lookupDetail","id","device","orgId","lookup","ids","entityProviderType","lookupValues","lookupByEmail","emails","search","requestedTypes","resultSize","queryString"],"sources":["dss.ts"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\n/*!\n * Copyright (c) 2015-2022 Cisco Systems, Inc. See LICENSE file.\n */\nimport uuid from 'uuid';\nimport {WebexPlugin} from '@webex/webex-core';\nimport '@webex/internal-plugin-mercury';\nimport {range, isEqual, get} from 'lodash';\nimport type {SearchOptions, LookupDetailOptions, LookupOptions, LookupByEmailOptions} from './types';\n\nimport {\n DSS_REGISTERED,\n DSS_UNREGISTERED,\n DSS_LOOKUP_MERCURY_EVENT,\n DSS_LOOKUP_RESULT,\n DSS_SERVICE_NAME,\n DSS_SEARCH_MERCURY_EVENT,\n DSS_RESULT,\n} from './constants';\n\nconst DSS = WebexPlugin.extend({\n namespace: 'DSS',\n\n /**\n * registered value indicating events registration is successful\n * @instance\n * @type {Boolean}\n * @memberof DSS\n */\n registered: false,\n\n /**\n * Explicitly sets up the DSS plugin by connecting to mercury, and listening for DSS events.\n * @returns {Promise}\n * @public\n * @memberof DSS\n */\n register() {\n if (!this.webex.canAuthorize) {\n this.logger.error('DSS->register#ERROR, Unable to register, SDK cannot authorize');\n\n return Promise.reject(new Error('SDK cannot authorize'));\n }\n\n if (this.registered) {\n this.logger.info('dss->register#INFO, DSS plugin already registered');\n\n return Promise.resolve();\n }\n\n return this.webex.internal.mercury.connect()\n .then(() => {\n this.listenForEvents();\n this.trigger(DSS_REGISTERED);\n this.registered = true;\n })\n .catch((error) => {\n this.logger.error(`DSS->register#ERROR, Unable to register, ${error.message}`);\n\n return Promise.reject(error);\n });\n },\n\n /**\n * Explicitly tears down the DSS plugin by disconnecting from mercury, and stops listening to DSS events\n * @returns {Promise}\n * @public\n * @memberof DSS\n */\n unregister() {\n if (!this.registered) {\n this.logger.info('DSS->unregister#INFO, DSS plugin already unregistered');\n\n return Promise.resolve();\n }\n\n this.stopListeningForEvents();\n\n return this.webex.internal.mercury.disconnect()\n .then(() => {\n this.trigger(DSS_UNREGISTERED);\n this.registered = false;\n });\n },\n\n /**\n * registers for DSS events through mercury\n * @returns {undefined}\n * @private\n */\n listenForEvents() {\n this.webex.internal.mercury.on(DSS_LOOKUP_MERCURY_EVENT, (envelope) => {\n this._handleEvent(envelope.data);\n });\n this.webex.internal.mercury.on(DSS_SEARCH_MERCURY_EVENT, (envelope) => {\n this._handleEvent(envelope.data);\n });\n },\n\n /**\n * unregisteres all the DSS events from mercury\n * @returns {undefined}\n * @private\n */\n stopListeningForEvents() {\n this.webex.internal.mercury.off(DSS_LOOKUP_MERCURY_EVENT);\n this.webex.internal.mercury.off(DSS_SEARCH_MERCURY_EVENT);\n },\n\n /**\n * @param {UUID} requestId the id of the request\n * @returns {string}\n */\n _getResultEventName(requestId) {\n return `${DSS_RESULT}${requestId}`;\n },\n\n /**\n * @param {Object} data the event data\n * @returns {undefined}\n */\n _handleEvent(data) {\n this.trigger(this._getResultEventName(data.requestId), data);\n this.trigger(DSS_LOOKUP_RESULT, data);\n },\n\n /**\n * Makes the request to the directory service\n * @param {Object} options\n * @param {string} options.resource the URL to query\n * @param {string} options.params additional params for the body of the request\n * @param {string} options.dataPath to path to get the data in the result object\n * @returns {Promise} Resolves with an array of entities found\n */\n _request(options) {\n const {resource, params, dataPath} = options;\n\n const requestId = uuid.v4();\n const eventName = this._getResultEventName(requestId);\n const result = {};\n let expectedSeqNums;\n\n return new Promise((resolve) => {\n this.listenTo(this, eventName, (data) => {\n const resultData = get(data, dataPath);\n\n result[data.sequence] = resultData;\n\n if (data.finished) {\n expectedSeqNums = range(data.sequence + 1).map(String);\n }\n\n const done = isEqual(expectedSeqNums, Object.keys(result));\n\n if (done) {\n const resultArray = [];\n expectedSeqNums.forEach((index) => {\n const seqResult = result[index];\n if (seqResult) {\n resultArray.push(...seqResult);\n }\n })\n\n resolve(resultArray);\n this.stopListening(this, eventName);\n }\n });\n this.webex.request({\n service: DSS_SERVICE_NAME,\n resource,\n method: 'POST',\n contentType: 'application/json',\n body: {requestId, ...params}\n });\n });\n },\n\n /**\n * Retrieves detailed information about an entity\n * @param {Object} options\n * @param {UUID} options.id the id of the entity to lookup\n * @returns {Promise} Resolves with an array of entities found\n */\n lookupDetail(options: LookupDetailOptions) {\n const {id} = options;\n\n return this._request({\n dataPath: 'lookupResult.entities',\n resource: `/lookup/orgid/${this.webex.internal.device.orgId}/identity/${id}/detail`\n });\n },\n\n /**\n * Retrieves basic information about a list entities within an organization\n * @param {Object} options\n * @param {UUID} options.ids the id of the entity to lookup\n * @param {UUID} options.entityProviderType the provider to query (optional)\n * @returns {Promise} Resolves with an array of entities found\n */\n lookup(options: LookupOptions) {\n const {ids, entityProviderType} = options;\n\n const resource = entityProviderType ? `/lookup/orgid/${this.webex.internal.device.orgId}/entityprovidertype/${entityProviderType}` : `/lookup/orgid/${this.webex.internal.device.orgId}/identities`;\n\n return this._request({\n dataPath: 'lookupResult.entities',\n resource,\n params: {\n lookupValues: ids,\n }\n });\n },\n\n /**\n * Retrieves basic information about a list entities within an organization\n * @param {Object} options\n * @param {UUID} options.emails the emails of the entities to lookup\n * @returns {Promise} Resolves with an array of entities found\n */\n lookupByEmail(options: LookupByEmailOptions) {\n const {emails} = options;\n\n return this._request({\n dataPath: 'lookupResult.entities',\n resource: `/lookup/orgid/${this.webex.internal.device.orgId}/emails`,\n params: {\n lookupValues: emails,\n }\n });\n },\n\n /**\n * Search for information about entities\n * @param {Object} options\n * @param {SearchType[]} options.requestedTypes an array of search types from: PERSON, CALLING_SERVICE, EXTERNAL_CALLING, ROOM, ROBOT\n * @param {string[]} options.queryString A query string that will be transformed into a Directory search filter query. It is used to search the following fields: username, givenName, familyName, displayName and email\n * @param {number} options.resultSize The maximum number of results returned from each provider\n * @returns {Promise} Resolves with an array of entities found\n */\n search(options: SearchOptions) {\n const {\n requestedTypes, resultSize, queryString\n } = options;\n\n return this._request({\n dataPath: 'directoryEntities',\n resource: `/search/orgid/${this.webex.internal.device.orgId}/entities`,\n params: {\n queryString,\n resultSize,\n requestedTypes\n }\n });\n }\n\n});\n\nexport default DSS;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;;AACA;;AACA;;AAIA;;;;;;AAUA,IAAMA,GAAG,GAAGC,sBAAA,CAAYC,MAAZ,CAAmB;EAC7BC,SAAS,EAAE,KADkB;;EAG7B;AACF;AACA;AACA;AACA;AACA;EACEC,UAAU,EAAE,KATiB;;EAW7B;AACF;AACA;AACA;AACA;AACA;EACEC,QAjB6B,sBAiBlB;IAAA;;IACT,IAAI,CAAC,KAAKC,KAAL,CAAWC,YAAhB,EAA8B;MAC5B,KAAKC,MAAL,CAAYC,KAAZ,CAAkB,+DAAlB;MAEA,OAAO,iBAAQC,MAAR,CAAe,IAAIC,KAAJ,CAAU,sBAAV,CAAf,CAAP;IACD;;IAED,IAAI,KAAKP,UAAT,EAAqB;MACnB,KAAKI,MAAL,CAAYI,IAAZ,CAAiB,mDAAjB;MAEA,OAAO,iBAAQC,OAAR,EAAP;IACD;;IAED,OAAO,KAAKP,KAAL,CAAWQ,QAAX,CAAoBC,OAApB,CAA4BC,OAA5B,GACJC,IADI,CACC,YAAM;MACV,KAAI,CAACC,eAAL;;MACA,KAAI,CAACC,OAAL,CAAaC,yBAAb;;MACA,KAAI,CAAChB,UAAL,GAAkB,IAAlB;IACD,CALI,EAMJiB,KANI,CAME,UAACZ,KAAD,EAAW;MAChB,KAAI,CAACD,MAAL,CAAYC,KAAZ,oDAA8DA,KAAK,CAACa,OAApE;;MAEA,OAAO,iBAAQZ,MAAR,CAAeD,KAAf,CAAP;IACD,CAVI,CAAP;EAWD,CAzC4B;;EA2C7B;AACF;AACA;AACA;AACA;AACA;EACEc,UAjD6B,wBAiDhB;IAAA;;IACX,IAAI,CAAC,KAAKnB,UAAV,EAAsB;MACpB,KAAKI,MAAL,CAAYI,IAAZ,CAAiB,uDAA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B;IAC3C,IAAOqC,MAAP,GAAiBrC,OAAjB,CAAOqC,MAAP;IAEA,OAAO,KAAKtC,QAAL,CAAc;MACnBI,QAAQ,EAAE,uBADS;MAEnBF,QAAQ,0BAAmB,KAAKlC,KAAL,CAAWQ,QAAX,CAAoBuD,MAApB,CAA2BC,KAA9C,YAFW;MAGnB7B,MAAM,EAAE;QACNiC,YAAY,EAAEE;MADR;IAHW,CAAd,CAAP;EAOD,CAjN4B;;EAmN7B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,MA3N6B,kBA2NtBtC,OA3NsB,EA2NE;IAC7B,IACEuC,cADF,GAEIvC,OAFJ,CACEuC,cADF;IAAA,IACkBC,UADlB,GAEIxC,OAFJ,CACkBwC,UADlB;IAAA,IAC8BC,WAD9B,GAEIzC,OAFJ,CAC8ByC,WAD9B;IAIA,OAAO,KAAK1C,QAAL,CAAc;MACnBI,QAAQ,EAAE,mBADS;MAEnBF,QAAQ,0BAAmB,KAAKlC,KAAL,CAAWQ,QAAX,CAAoBuD,MAApB,CAA2BC,KAA9C,cAFW;MAGnB7B,MAAM,EAAE;QACNuC,WAAW,EAAXA,WADM;QAEND,UAAU,EAAVA,UAFM;QAGND,cAAc,EAAdA;MAHM;IAHW,CAAd,CAAP;EASD,CAzO4B;EAAA;AAAA,CAAnB,CAAZ;;eA6Oe9E,G"}
package/dist/types.js CHANGED
@@ -6,7 +6,17 @@ _Object$defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
 
9
- exports.SearchType = void 0;
9
+ exports.SearchType = exports.EntityProviderType = void 0;
10
+ var EntityProviderType;
11
+ exports.EntityProviderType = EntityProviderType;
12
+
13
+ (function (EntityProviderType) {
14
+ EntityProviderType["CI_USER"] = "CI_USER";
15
+ EntityProviderType["CI_MACHINE"] = "CI_MACHINE";
16
+ EntityProviderType["CONTACTS"] = "CONTACTS";
17
+ EntityProviderType["CSDM"] = "CSDM";
18
+ })(EntityProviderType || (exports.EntityProviderType = EntityProviderType = {}));
19
+
10
20
  var SearchType;
11
21
  exports.SearchType = SearchType;
12
22
 
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["SearchType"],"sources":["types.ts"],"sourcesContent":["export interface LookupDetailOptions {\n id: string;\n}\n\nexport interface LookupOptions {\n ids: string[];\n}\n\nexport interface LookupByEmailOptions {\n emails: string[];\n}\n\nexport enum SearchType {\n PERSON = 'PERSON', \n CALLING_SERVICE = 'CALLING_SERVICE',\n EXTERNAL_CALLING = 'EXTERNAL_CALLING',\n ROOM = 'ROOM',\n ROBOT = 'ROBOT'\n}\n\nexport interface SearchOptions {\n requestedTypes: SearchType[],\n resultSize: number,\n queryString: string,\n}\n"],"mappings":";;;;;;;;;IAYYA,U;;;WAAAA,U;EAAAA,U;EAAAA,U;EAAAA,U;EAAAA,U;EAAAA,U;GAAAA,U,0BAAAA,U"}
1
+ {"version":3,"names":["EntityProviderType","SearchType"],"sources":["types.ts"],"sourcesContent":["export interface LookupDetailOptions {\n id: string;\n}\n\nexport enum EntityProviderType {\n CI_USER = 'CI_USER',\n CI_MACHINE ='CI_MACHINE',\n CONTACTS = 'CONTACTS',\n CSDM = 'CSDM'\n}\n\nexport interface LookupOptions {\n ids: string[];\n entityProviderType?: EntityProviderType;\n}\n\nexport interface LookupByEmailOptions {\n emails: string[];\n}\n\nexport enum SearchType {\n PERSON = 'PERSON', \n CALLING_SERVICE = 'CALLING_SERVICE',\n EXTERNAL_CALLING = 'EXTERNAL_CALLING',\n ROOM = 'ROOM',\n ROBOT = 'ROBOT'\n}\n\nexport interface SearchOptions {\n requestedTypes: SearchType[],\n resultSize: number,\n queryString: string,\n}\n"],"mappings":";;;;;;;;;IAIYA,kB;;;WAAAA,kB;EAAAA,kB;EAAAA,kB;EAAAA,kB;EAAAA,kB;GAAAA,kB,kCAAAA,kB;;IAgBAC,U;;;WAAAA,U;EAAAA,U;EAAAA,U;EAAAA,U;EAAAA,U;EAAAA,U;GAAAA,U,0BAAAA,U"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/internal-plugin-dss",
3
- "version": "2.26.2",
3
+ "version": "2.28.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": "Colin Read <coread@cisco.com>",
@@ -17,10 +17,10 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@babel/runtime-corejs2": "^7.14.8",
20
- "@webex/webex-core": "2.26.2",
20
+ "@webex/webex-core": "2.28.0",
21
21
  "lodash": "^4.17.21",
22
22
  "uuid": "^3.3.2",
23
- "@webex/internal-plugin-mercury": "2.26.2",
23
+ "@webex/internal-plugin-mercury": "2.28.0",
24
24
  "envify": "^4.1.0"
25
25
  }
26
26
  }
package/src/dss.ts CHANGED
@@ -194,14 +194,17 @@ const DSS = WebexPlugin.extend({
194
194
  * Retrieves basic information about a list entities within an organization
195
195
  * @param {Object} options
196
196
  * @param {UUID} options.ids the id of the entity to lookup
197
+ * @param {UUID} options.entityProviderType the provider to query (optional)
197
198
  * @returns {Promise} Resolves with an array of entities found
198
199
  */
199
200
  lookup(options: LookupOptions) {
200
- const {ids} = options;
201
+ const {ids, entityProviderType} = options;
202
+
203
+ const resource = entityProviderType ? `/lookup/orgid/${this.webex.internal.device.orgId}/entityprovidertype/${entityProviderType}` : `/lookup/orgid/${this.webex.internal.device.orgId}/identities`;
201
204
 
202
205
  return this._request({
203
206
  dataPath: 'lookupResult.entities',
204
- resource: `/lookup/orgid/${this.webex.internal.device.orgId}/identities`,
207
+ resource,
205
208
  params: {
206
209
  lookupValues: ids,
207
210
  }
package/src/types.ts CHANGED
@@ -2,8 +2,16 @@ export interface LookupDetailOptions {
2
2
  id: string;
3
3
  }
4
4
 
5
+ export enum EntityProviderType {
6
+ CI_USER = 'CI_USER',
7
+ CI_MACHINE ='CI_MACHINE',
8
+ CONTACTS = 'CONTACTS',
9
+ CSDM = 'CSDM'
10
+ }
11
+
5
12
  export interface LookupOptions {
6
13
  ids: string[];
14
+ entityProviderType?: EntityProviderType;
7
15
  }
8
16
 
9
17
  export interface LookupByEmailOptions {
@@ -195,6 +195,25 @@ describe("plugin-dss", () => {
195
195
  expect(result).to.equal("some return value");
196
196
  });
197
197
 
198
+ it("calls _request correctly with entityProviderType", async () => {
199
+ webex.internal.device.orgId = "userOrgId";
200
+ webex.internal.dss._request = sinon
201
+ .stub()
202
+ .returns(Promise.resolve("some return value"));
203
+
204
+ const result = await webex.internal.dss.lookup({ ids: ["id1", "id2"], entityProviderType: 'CI_USER' });
205
+ expect(webex.internal.dss._request.getCall(0).args).to.deep.equal([
206
+ {
207
+ dataPath: "lookupResult.entities",
208
+ resource: '/lookup/orgid/userOrgId/entityprovidertype/CI_USER',
209
+ params: {
210
+ lookupValues: ["id1", "id2"],
211
+ },
212
+ },
213
+ ]);
214
+ expect(result).to.equal("some return value");
215
+ });
216
+
198
217
  it("works correctly", async () => {
199
218
  await testRequest({
200
219
  method: "lookup",