@webex/internal-plugin-dss 2.55.0 → 2.56.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/dist/dss.js CHANGED
@@ -232,7 +232,32 @@ var DSS = _webexCore.WebexPlugin.extend({
232
232
  }
233
233
  });
234
234
  },
235
- version: "2.55.0"
235
+ /**
236
+ * Search for information about places
237
+ * @param {Object} options
238
+ * @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: placeName, displayName.
239
+ * @param {number} options.resultSize The maximum number of results returned from each provider
240
+ * @returns {Promise} Resolves with an array of entities found
241
+ */
242
+ searchPlaces: function searchPlaces(options) {
243
+ var _this5 = this;
244
+ var resultSize = options.resultSize,
245
+ queryString = options.queryString,
246
+ isOnlySchedulableRooms = options.isOnlySchedulableRooms;
247
+ return this._request({
248
+ dataPath: 'directoryEntities',
249
+ resource: "/search/orgid/".concat(this.webex.internal.device.orgId, "/places"),
250
+ params: {
251
+ queryString: queryString,
252
+ resultSize: resultSize,
253
+ isOnlySchedulableRooms: isOnlySchedulableRooms
254
+ }
255
+ }).catch(function (error) {
256
+ _this5.logger.error("DSS->search place#ERROR, search place failure, ".concat(error.message));
257
+ return _promise.default.reject(error);
258
+ });
259
+ },
260
+ version: "2.56.0"
236
261
  });
237
262
  var _default = DSS;
238
263
  exports.default = _default;
package/dist/dss.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_uuid","_interopRequireDefault","require","_webexCore","_constants","ownKeys","object","enumerableOnly","keys","_Object$keys2","_Object$getOwnPropertySymbols","symbols","filter","sym","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","Object","forEach","key","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","DSS","WebexPlugin","extend","namespace","registered","register","_this","webex","canAuthorize","logger","error","_promise","reject","Error","info","resolve","internal","mercury","connect","then","listenForEvents","trigger","DSS_REGISTERED","catch","concat","message","unregister","_this2","stopListeningForEvents","disconnect","DSS_UNREGISTERED","_this3","on","DSS_LOOKUP_MERCURY_EVENT","envelope","_handleEvent","data","DSS_SEARCH_MERCURY_EVENT","off","_getResultEventName","requestId","DSS_RESULT","DSS_LOOKUP_RESULT","_request","options","_this4","resource","params","dataPath","uuid","v4","eventName","result","expectedSeqNums","listenTo","resultData","_get2","sequence","finished","_range2","map","String","done","_isEqual2","_keys","resultArray","index","seqResult","_toConsumableArray2","stopListening","request","service","DSS_SERVICE_NAME","method","contentType","body","lookupDetail","id","device","orgId","lookup","ids","entityProviderType","lookupValues","lookupByEmail","emails","search","requestedTypes","resultSize","queryString","version","_default","exports"],"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 {\n SearchOptions,\n LookupDetailOptions,\n LookupOptions,\n LookupByEmailOptions,\n} 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\n .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().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\n ? `/lookup/orgid/${this.webex.internal.device.orgId}/entityprovidertype/${entityProviderType}`\n : `/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 {requestedTypes, resultSize, queryString} = 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\nexport default DSS;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAIA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACAA,OAAA;AASA,IAAAE,UAAA,GAAAF,OAAA;AAQqB,SAAAG,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,aAAA,CAAAH,MAAA,OAAAI,6BAAA,QAAAC,OAAA,GAAAD,6BAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAC,gCAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAmB,MAAA,CAAAD,MAAA,OAAAE,OAAA,WAAAC,GAAA,QAAAC,gBAAA,CAAAC,OAAA,EAAAT,MAAA,EAAAO,GAAA,EAAAH,MAAA,CAAAG,GAAA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Q,CAAC8D,MAAM,CAACC,KAAK,cAAW;MACtEhC,MAAM,EAAE;QACN0C,WAAW,EAAXA,WAAW;QACXD,UAAU,EAAVA,UAAU;QACVD,cAAc,EAAdA;MACF;IACF,CAAC,CAAC;EACJ,CAAC;EAAAG,OAAA;AACH,CAAC,CAAC;AAAC,IAAAC,QAAA,GAEY3F,GAAG;AAAA4F,OAAA,CAAAhG,OAAA,GAAA+F,QAAA"}
1
+ {"version":3,"names":["_uuid","_interopRequireDefault","require","_webexCore","_constants","ownKeys","object","enumerableOnly","keys","_Object$keys2","_Object$getOwnPropertySymbols","symbols","filter","sym","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","Object","forEach","key","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","DSS","WebexPlugin","extend","namespace","registered","register","_this","webex","canAuthorize","logger","error","_promise","reject","Error","info","resolve","internal","mercury","connect","then","listenForEvents","trigger","DSS_REGISTERED","catch","concat","message","unregister","_this2","stopListeningForEvents","disconnect","DSS_UNREGISTERED","_this3","on","DSS_LOOKUP_MERCURY_EVENT","envelope","_handleEvent","data","DSS_SEARCH_MERCURY_EVENT","off","_getResultEventName","requestId","DSS_RESULT","DSS_LOOKUP_RESULT","_request","options","_this4","resource","params","dataPath","uuid","v4","eventName","result","expectedSeqNums","listenTo","resultData","_get2","sequence","finished","_range2","map","String","done","_isEqual2","_keys","resultArray","index","seqResult","_toConsumableArray2","stopListening","request","service","DSS_SERVICE_NAME","method","contentType","body","lookupDetail","id","device","orgId","lookup","ids","entityProviderType","lookupValues","lookupByEmail","emails","search","requestedTypes","resultSize","queryString","searchPlaces","_this5","isOnlySchedulableRooms","version","_default","exports"],"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 {\n SearchOptions,\n LookupDetailOptions,\n LookupOptions,\n LookupByEmailOptions,\n SearchPlaceOptions,\n} 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\n .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().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\n ? `/lookup/orgid/${this.webex.internal.device.orgId}/entityprovidertype/${entityProviderType}`\n : `/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 {requestedTypes, resultSize, queryString} = 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 * Search for information about places\n * @param {Object} options\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: placeName, displayName.\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 searchPlaces(options: SearchPlaceOptions) {\n const {resultSize, queryString, isOnlySchedulableRooms} = options;\n\n return this._request({\n dataPath: 'directoryEntities',\n resource: `/search/orgid/${this.webex.internal.device.orgId}/places`,\n params: {\n queryString,\n resultSize,\n isOnlySchedulableRooms,\n },\n }).catch((error) => {\n this.logger.error(`DSS->search place#ERROR, search place failure, ${error.message}`);\n\n return Promise.reject(error);\n });\n },\n});\n\nexport default DSS;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAIA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACAA,OAAA;AAUA,IAAAE,UAAA,GAAAF,OAAA;AAQqB,SAAAG,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,aAAA,CAAAH,MAAA,OAAAI,6BAAA,QAAAC,OAAA,GAAAD,6BAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAC,gCAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAmB,MAAA,CAAAD,MAAA,OAAAE,OAAA,WAAAC,GAAA,QAAAC,gBAAA,CAAAC,OAAA,EAAAT,MAAA,EAAAO,GAAA,EAAAH,MAAA,CAAAG,GAAA,SAAAG,iCAAA,GAAAC,wBAAA,CAAAX,MAAA,EAAAU,iCAAA,CAAAN,MAAA,KAAAlB,OAAA,CAAAmB,MAAA,CAAAD,MAAA,GAAAE,OAAA,WAAAC,GAAA,IAAAK,sBAAA,CAAAZ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;EAED;AACF;AACA;AACA;AACA;AACA;AACA;EACEG,YAAY,WAAAA,aAAC9C,OAA2B,EAAE;IAAA,IAAA+C,MAAA;IACxC,IAAOH,UAAU,GAAyC5C,OAAO,CAA1D4C,UAAU;MAAEC,WAAW,GAA4B7C,OAAO,CAA9C6C,WAAW;MAAEG,sBAAsB,GAAIhD,OAAO,CAAjCgD,sBAAsB;IAEtD,OAAO,IAAI,CAACjD,QAAQ,CAAC;MACnBK,QAAQ,EAAE,mBAAmB;MAC7BF,QAAQ,mBAAAtB,MAAA,CAAmB,IAAI,CAACjB,KAAK,CAACS,QAAQ,CAAC8D,MAAM,CAACC,KAAK,YAAS;MACpEhC,MAAM,EAAE;QACN0C,WAAW,EAAXA,WAAW;QACXD,UAAU,EAAVA,UAAU;QACVI,sBAAsB,EAAtBA;MACF;IACF,CAAC,CAAC,CAACrE,KAAK,CAAC,UAACb,KAAK,EAAK;MAClBiF,MAAI,CAAClF,MAAM,CAACC,KAAK,mDAAAc,MAAA,CAAmDd,KAAK,CAACe,OAAO,EAAG;MAEpF,OAAOd,QAAA,CAAAf,OAAA,CAAQgB,MAAM,CAACF,KAAK,CAAC;IAC9B,CAAC,CAAC;EACJ,CAAC;EAAAmF,OAAA;AACH,CAAC,CAAC;AAAC,IAAAC,QAAA,GAEY9F,GAAG;AAAA+F,OAAA,CAAAnG,OAAA,GAAAkG,QAAA"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["EntityProviderType","exports","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,kBAAkB;AAAAC,OAAA,CAAAD,kBAAA,GAAAA,kBAAA;AAAA,WAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;AAAA,GAAlBA,kBAAkB,KAAAC,OAAA,CAAAD,kBAAA,GAAlBA,kBAAkB;AAAA,IAgBlBE,UAAU;AAAAD,OAAA,CAAAC,UAAA,GAAAA,UAAA;AAAA,WAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;AAAA,GAAVA,UAAU,KAAAD,OAAA,CAAAC,UAAA,GAAVA,UAAU"}
1
+ {"version":3,"names":["EntityProviderType","exports","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\nexport interface SearchPlaceOptions {\n resultSize: number;\n queryString: string;\n isOnlySchedulableRooms: boolean;\n}\n"],"mappings":";;;;;;;IAIYA,kBAAkB;AAAAC,OAAA,CAAAD,kBAAA,GAAAA,kBAAA;AAAA,WAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;AAAA,GAAlBA,kBAAkB,KAAAC,OAAA,CAAAD,kBAAA,GAAlBA,kBAAkB;AAAA,IAgBlBE,UAAU;AAAAD,OAAA,CAAAC,UAAA,GAAAA,UAAA;AAAA,WAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;AAAA,GAAVA,UAAU,KAAAD,OAAA,CAAAC,UAAA,GAAVA,UAAU"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/internal-plugin-dss",
3
- "version": "2.55.0",
3
+ "version": "2.56.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": "Colin Read <coread@cisco.com>",
@@ -21,21 +21,21 @@
21
21
  ]
22
22
  },
23
23
  "dependencies": {
24
- "@webex/internal-plugin-mercury": "2.55.0",
25
- "@webex/webex-core": "2.55.0",
24
+ "@webex/internal-plugin-mercury": "2.56.0",
25
+ "@webex/webex-core": "2.56.0",
26
26
  "lodash": "^4.17.21",
27
27
  "uuid": "^3.3.2"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@babel/core": "^7.17.10",
31
- "@webex/babel-config-legacy": "2.55.0",
32
- "@webex/eslint-config-legacy": "2.55.0",
33
- "@webex/jest-config-legacy": "2.55.0",
34
- "@webex/legacy-tools": "2.55.0",
35
- "@webex/test-helper-chai": "2.55.0",
36
- "@webex/test-helper-mocha": "2.55.0",
37
- "@webex/test-helper-mock-webex": "2.55.0",
38
- "@webex/test-helper-test-users": "2.55.0",
31
+ "@webex/babel-config-legacy": "2.56.0",
32
+ "@webex/eslint-config-legacy": "2.56.0",
33
+ "@webex/jest-config-legacy": "2.56.0",
34
+ "@webex/legacy-tools": "2.56.0",
35
+ "@webex/test-helper-chai": "2.56.0",
36
+ "@webex/test-helper-mocha": "2.56.0",
37
+ "@webex/test-helper-mock-webex": "2.56.0",
38
+ "@webex/test-helper-test-users": "2.56.0",
39
39
  "eslint": "^8.24.0",
40
40
  "prettier": "^2.7.1"
41
41
  },
package/src/dss.ts CHANGED
@@ -11,6 +11,7 @@ import type {
11
11
  LookupDetailOptions,
12
12
  LookupOptions,
13
13
  LookupByEmailOptions,
14
+ SearchPlaceOptions,
14
15
  } from './types';
15
16
 
16
17
  import {
@@ -257,6 +258,31 @@ const DSS = WebexPlugin.extend({
257
258
  },
258
259
  });
259
260
  },
261
+
262
+ /**
263
+ * Search for information about places
264
+ * @param {Object} options
265
+ * @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: placeName, displayName.
266
+ * @param {number} options.resultSize The maximum number of results returned from each provider
267
+ * @returns {Promise} Resolves with an array of entities found
268
+ */
269
+ searchPlaces(options: SearchPlaceOptions) {
270
+ const {resultSize, queryString, isOnlySchedulableRooms} = options;
271
+
272
+ return this._request({
273
+ dataPath: 'directoryEntities',
274
+ resource: `/search/orgid/${this.webex.internal.device.orgId}/places`,
275
+ params: {
276
+ queryString,
277
+ resultSize,
278
+ isOnlySchedulableRooms,
279
+ },
280
+ }).catch((error) => {
281
+ this.logger.error(`DSS->search place#ERROR, search place failure, ${error.message}`);
282
+
283
+ return Promise.reject(error);
284
+ });
285
+ },
260
286
  });
261
287
 
262
288
  export default DSS;
package/src/types.ts CHANGED
@@ -31,3 +31,9 @@ export interface SearchOptions {
31
31
  resultSize: number;
32
32
  queryString: string;
33
33
  }
34
+
35
+ export interface SearchPlaceOptions {
36
+ resultSize: number;
37
+ queryString: string;
38
+ isOnlySchedulableRooms: boolean;
39
+ }
@@ -356,5 +356,48 @@ describe('plugin-dss', () => {
356
356
  expect(result).to.deep.equal(['data0', 'data1', 'data2']);
357
357
  });
358
358
  });
359
+ describe('#searchPlaces', () => {
360
+ it('calls _request correctly', async () => {
361
+ webex.internal.device.orgId = 'userOrgId';
362
+ webex.internal.dss._request = sinon.stub().returns(Promise.resolve('some return value'));
363
+
364
+ const result = await webex.internal.dss.searchPlaces({
365
+ resultSize: 100,
366
+ queryString: 'query',
367
+ isOnlySchedulableRooms: true,
368
+ });
369
+ expect(webex.internal.dss._request.getCall(0).args).to.deep.equal([
370
+ {
371
+ dataPath: 'directoryEntities',
372
+ resource: '/search/orgid/userOrgId/places',
373
+ params: {
374
+ queryString: 'query',
375
+ resultSize: 100,
376
+ isOnlySchedulableRooms: true,
377
+ },
378
+ },
379
+ ]);
380
+ expect(result).to.equal('some return value');
381
+ });
382
+
383
+ it('works correctly', async () => {
384
+ await testRequest({
385
+ method: 'searchPlaces',
386
+ event: 'event:directory.search',
387
+ dataPath: 'directoryEntities',
388
+ resource: '/search/orgid/userOrgId/places',
389
+ params: {
390
+ isOnlySchedulableRooms: true,
391
+ resultSize: 100,
392
+ queryString: 'query',
393
+ },
394
+ bodyParams: {
395
+ isOnlySchedulableRooms: true,
396
+ resultSize: 100,
397
+ queryString: 'query',
398
+ },
399
+ });
400
+ });
401
+ });
359
402
  });
360
403
  });