@webex/internal-plugin-dss 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/dist/dss.js CHANGED
@@ -11,19 +11,23 @@ _Object$defineProperty(exports, "__esModule", {
11
11
  value: true
12
12
  });
13
13
  exports.default = void 0;
14
- var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
15
- var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
16
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
17
15
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
18
- var _get2 = _interopRequireDefault(require("lodash/get"));
19
- var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
20
- var _range2 = _interopRequireDefault(require("lodash/range"));
16
+ var _apply = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/apply"));
17
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
18
+ var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
21
19
  var _uuid = _interopRequireDefault(require("uuid"));
22
20
  var _webexCore = require("@webex/webex-core");
23
21
  require("@webex/internal-plugin-mercury");
22
+ var _lodash = require("lodash");
23
+ var _commonTimers = require("@webex/common-timers");
24
24
  var _constants = require("./constants");
25
- function ownKeys(object, enumerableOnly) { var keys = _Object$keys2(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
26
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
25
+ var _dssBatcher = _interopRequireDefault(require("./dss-batcher"));
26
+ var _dssErrors = require("./dss-errors");
27
+ function ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
28
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } /* eslint-disable no-underscore-dangle */ /*!
29
+ * Copyright (c) 2015-2022 Cisco Systems, Inc. See LICENSE file.
30
+ */ /* eslint-disable no-underscore-dangle */
27
31
  var DSS = _webexCore.WebexPlugin.extend({
28
32
  namespace: 'DSS',
29
33
  /**
@@ -33,6 +37,20 @@ var DSS = _webexCore.WebexPlugin.extend({
33
37
  * @memberof DSS
34
38
  */
35
39
  registered: false,
40
+ /**
41
+ * Initializer
42
+ * @private
43
+ * @param {Object} attrs
44
+ * @param {Object} options
45
+ * @returns {undefined}
46
+ */
47
+ initialize: function initialize() {
48
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
49
+ args[_key] = arguments[_key];
50
+ }
51
+ (0, _apply.default)(_webexCore.WebexPlugin.prototype.initialize, this, args);
52
+ this.batchers = {};
53
+ },
36
54
  /**
37
55
  * Explicitly sets up the DSS plugin by connecting to mercury, and listening for DSS events.
38
56
  * @returns {Promise}
@@ -100,6 +118,7 @@ var DSS = _webexCore.WebexPlugin.extend({
100
118
  this.webex.internal.mercury.off(_constants.DSS_SEARCH_MERCURY_EVENT);
101
119
  },
102
120
  /**
121
+ * constructs the event name based on request id
103
122
  * @param {UUID} requestId the id of the request
104
123
  * @returns {string}
105
124
  */
@@ -107,6 +126,7 @@ var DSS = _webexCore.WebexPlugin.extend({
107
126
  return "".concat(_constants.DSS_RESULT).concat(requestId);
108
127
  },
109
128
  /**
129
+ * Takes incoming data and triggers correct events
110
130
  * @param {Object} data the event data
111
131
  * @returns {undefined}
112
132
  */
@@ -118,36 +138,82 @@ var DSS = _webexCore.WebexPlugin.extend({
118
138
  * Makes the request to the directory service
119
139
  * @param {Object} options
120
140
  * @param {string} options.resource the URL to query
121
- * @param {string} options.params additional params for the body of the request
122
- * @param {string} options.dataPath to path to get the data in the result object
123
- * @returns {Promise} Resolves with an array of entities found
141
+ * @param {Mixed} options.params additional params for the body of the request
142
+ * @param {string} options.dataPath the path to get the data in the result object
143
+ * @param {string} [options.foundPath] the path to get the lookups of the found data
144
+ * @param {string} [options.notFoundPath] the path to get the lookups of the not found data
145
+ * @returns {Promise<Object>} result Resolves with an object
146
+ * @returns {Array} result.resultArray an array of entities found
147
+ * @returns {Array} result.foundArray an array of the lookups of the found entities (if foundPath provided)
148
+ * @returns {Array} result.notFoundArray an array of the lookups of the not found entities (if notFoundPath provided)
149
+ * @throws {DssTimeoutError} when server does not respond in the specified timeframe
124
150
  */
125
151
  _request: function _request(options) {
126
152
  var _this4 = this;
127
153
  var resource = options.resource,
128
154
  params = options.params,
129
- dataPath = options.dataPath;
155
+ dataPath = options.dataPath,
156
+ foundPath = options.foundPath,
157
+ notFoundPath = options.notFoundPath;
158
+ var timeout = this.config.requestTimeout;
130
159
  var requestId = _uuid.default.v4();
131
160
  var eventName = this._getResultEventName(requestId);
132
161
  var result = {};
133
162
  var expectedSeqNums;
134
- return new _promise.default(function (resolve) {
163
+ var notFoundArray;
164
+ return new _promise.default(function (resolve, reject) {
165
+ var timer = new _commonTimers.Timer(function () {
166
+ _this4.stopListening(_this4, eventName);
167
+ reject(new _dssErrors.DssTimeoutError({
168
+ requestId: requestId,
169
+ timeout: timeout,
170
+ resource: resource,
171
+ params: params
172
+ }));
173
+ }, timeout);
135
174
  _this4.listenTo(_this4, eventName, function (data) {
136
- var resultData = (0, _get2.default)(data, dataPath);
137
- result[data.sequence] = resultData;
175
+ timer.reset();
176
+ var resultData = (0, _lodash.get)(data, dataPath, []);
177
+ var found;
178
+ if (foundPath) {
179
+ found = (0, _lodash.get)(data, foundPath, []);
180
+ }
181
+ result[data.sequence] = foundPath ? {
182
+ resultData: resultData,
183
+ found: found
184
+ } : {
185
+ resultData: resultData
186
+ };
138
187
  if (data.finished) {
139
- expectedSeqNums = (0, _range2.default)(data.sequence + 1).map(String);
188
+ expectedSeqNums = (0, _lodash.range)(data.sequence + 1).map(String);
189
+ if (notFoundPath) {
190
+ notFoundArray = (0, _lodash.get)(data, notFoundPath, []);
191
+ }
140
192
  }
141
- var done = (0, _isEqual2.default)(expectedSeqNums, (0, _keys.default)(result));
193
+ var done = (0, _lodash.isEqual)(expectedSeqNums, (0, _keys.default)(result));
142
194
  if (done) {
195
+ timer.cancel();
143
196
  var resultArray = [];
197
+ var foundArray = [];
144
198
  expectedSeqNums.forEach(function (index) {
145
199
  var seqResult = result[index];
146
200
  if (seqResult) {
147
- resultArray.push.apply(resultArray, (0, _toConsumableArray2.default)(seqResult));
201
+ resultArray.push.apply(resultArray, (0, _toConsumableArray2.default)(seqResult.resultData));
202
+ if (foundPath) {
203
+ foundArray.push.apply(foundArray, (0, _toConsumableArray2.default)(seqResult.found));
204
+ }
148
205
  }
149
206
  });
150
- resolve(resultArray);
207
+ var resolveValue = {
208
+ resultArray: resultArray
209
+ };
210
+ if (foundPath) {
211
+ resolveValue.foundArray = foundArray;
212
+ }
213
+ if (notFoundPath) {
214
+ resolveValue.notFoundArray = notFoundArray;
215
+ }
216
+ resolve(resolveValue);
151
217
  _this4.stopListening(_this4, eventName);
152
218
  }
153
219
  });
@@ -160,54 +226,115 @@ var DSS = _webexCore.WebexPlugin.extend({
160
226
  requestId: requestId
161
227
  }, params)
162
228
  });
229
+ timer.start();
163
230
  });
164
231
  },
232
+ /**
233
+ * Uses a batcher to make the request to the directory service
234
+ * @param {Object} options
235
+ * @param {string} options.resource the URL to query
236
+ * @param {string} options.value the id or email to lookup
237
+ * @returns {Promise} Resolves with an array of entities found
238
+ * @throws {DssTimeoutError} when server does not respond in the specified timeframe
239
+ */
240
+ _batchedLookup: function _batchedLookup(options) {
241
+ var resource = options.resource,
242
+ lookupValue = options.lookupValue;
243
+ var dataPath = _constants.LOOKUP_DATA_PATH;
244
+ var entitiesFoundPath = _constants.LOOKUP_FOUND_PATH;
245
+ var entitiesNotFoundPath = _constants.LOOKUP_NOT_FOUND_PATH;
246
+ var requestKey = _constants.LOOKUP_REQUEST_KEY;
247
+ this.batchers[resource] = this.batchers[resource] || new _dssBatcher.default({
248
+ resource: resource,
249
+ dataPath: dataPath,
250
+ entitiesFoundPath: entitiesFoundPath,
251
+ entitiesNotFoundPath: entitiesNotFoundPath,
252
+ requestKey: requestKey,
253
+ parent: this
254
+ });
255
+ return this.batchers[resource].request(lookupValue);
256
+ },
165
257
  /**
166
258
  * Retrieves detailed information about an entity
167
259
  * @param {Object} options
168
260
  * @param {UUID} options.id the id of the entity to lookup
169
- * @returns {Promise} Resolves with an array of entities found
261
+ * @returns {Promise} Resolves with the entity found or null if not found
262
+ * @throws {DssTimeoutError} when server does not respond in the specified timeframe
170
263
  */
171
264
  lookupDetail: function lookupDetail(options) {
172
265
  var id = options.id;
266
+ var resource = "/lookup/orgid/".concat(this.webex.internal.device.orgId, "/identity/").concat(id, "/detail");
173
267
  return this._request({
174
- dataPath: 'lookupResult.entities',
175
- resource: "/lookup/orgid/".concat(this.webex.internal.device.orgId, "/identity/").concat(id, "/detail")
268
+ dataPath: _constants.LOOKUP_DATA_PATH,
269
+ foundPath: _constants.LOOKUP_FOUND_PATH,
270
+ resource: resource
271
+ }).then(function (_ref) {
272
+ var resultArray = _ref.resultArray,
273
+ foundArray = _ref.foundArray;
274
+ // TODO: find out what is actually returned!
275
+ if (foundArray[0] === id) {
276
+ return resultArray[0];
277
+ }
278
+ return null;
176
279
  });
177
280
  },
178
281
  /**
179
- * Retrieves basic information about a list entities within an organization
282
+ * Retrieves basic information about an entity within an organization
180
283
  * @param {Object} options
181
- * @param {UUID} options.ids the id of the entity to lookup
182
- * @param {UUID} options.entityProviderType the provider to query (optional)
183
- * @returns {Promise} Resolves with an array of entities found
284
+ * @param {UUID} options.id the id of the entity to lookup
285
+ * @param {UUID} [options.entityProviderType] the provider to query
286
+ * @param {Boolean} options.shouldBatch whether to batch the query, set to false for single immediate result (defaults to true)
287
+ * @returns {Promise} Resolves with the entity found or null if not found
288
+ * @throws {DssTimeoutError} when server does not respond in the specified timeframe
184
289
  */
185
290
  lookup: function lookup(options) {
186
- var ids = options.ids,
187
- entityProviderType = options.entityProviderType;
291
+ var id = options.id,
292
+ entityProviderType = options.entityProviderType,
293
+ _options$shouldBatch = options.shouldBatch,
294
+ shouldBatch = _options$shouldBatch === void 0 ? true : _options$shouldBatch;
188
295
  var resource = entityProviderType ? "/lookup/orgid/".concat(this.webex.internal.device.orgId, "/entityprovidertype/").concat(entityProviderType) : "/lookup/orgid/".concat(this.webex.internal.device.orgId, "/identities");
296
+ if (shouldBatch) {
297
+ return this._batchedLookup({
298
+ resource: resource,
299
+ lookupValue: id
300
+ });
301
+ }
189
302
  return this._request({
190
- dataPath: 'lookupResult.entities',
303
+ dataPath: _constants.LOOKUP_DATA_PATH,
304
+ foundPath: _constants.LOOKUP_FOUND_PATH,
191
305
  resource: resource,
192
- params: {
193
- lookupValues: ids
306
+ params: (0, _defineProperty2.default)({}, _constants.LOOKUP_REQUEST_KEY, [id])
307
+ }).then(function (_ref2) {
308
+ var resultArray = _ref2.resultArray,
309
+ foundArray = _ref2.foundArray;
310
+ if (foundArray[0] === id) {
311
+ return resultArray[0];
194
312
  }
313
+ return null;
195
314
  });
196
315
  },
197
316
  /**
198
- * Retrieves basic information about a list entities within an organization
317
+ * Retrieves basic information about an enitity within an organization
199
318
  * @param {Object} options
200
- * @param {UUID} options.emails the emails of the entities to lookup
201
- * @returns {Promise} Resolves with an array of entities found
319
+ * @param {UUID} options.email the email of the entity to lookup
320
+ * @returns {Promise} Resolves with the entity found or rejects if not found
321
+ * @throws {DssTimeoutError} when server does not respond in the specified timeframe
202
322
  */
203
323
  lookupByEmail: function lookupByEmail(options) {
204
- var emails = options.emails;
324
+ var email = options.email;
325
+ var resource = "/lookup/orgid/".concat(this.webex.internal.device.orgId, "/emails");
205
326
  return this._request({
206
- dataPath: 'lookupResult.entities',
207
- resource: "/lookup/orgid/".concat(this.webex.internal.device.orgId, "/emails"),
208
- params: {
209
- lookupValues: emails
327
+ dataPath: _constants.LOOKUP_DATA_PATH,
328
+ foundPath: _constants.LOOKUP_FOUND_PATH,
329
+ resource: resource,
330
+ params: (0, _defineProperty2.default)({}, _constants.LOOKUP_REQUEST_KEY, [email])
331
+ }).then(function (_ref3) {
332
+ var resultArray = _ref3.resultArray,
333
+ foundArray = _ref3.foundArray;
334
+ if (foundArray[0] === email) {
335
+ return resultArray[0];
210
336
  }
337
+ return null;
211
338
  });
212
339
  },
213
340
  /**
@@ -217,23 +344,51 @@ var DSS = _webexCore.WebexPlugin.extend({
217
344
  * @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
218
345
  * @param {number} options.resultSize The maximum number of results returned from each provider
219
346
  * @returns {Promise} Resolves with an array of entities found
347
+ * @throws {DssTimeoutError} when server does not respond in the specified timeframe
220
348
  */
221
349
  search: function search(options) {
222
350
  var requestedTypes = options.requestedTypes,
223
351
  resultSize = options.resultSize,
224
352
  queryString = options.queryString;
225
353
  return this._request({
226
- dataPath: 'directoryEntities',
354
+ dataPath: _constants.SEARCH_DATA_PATH,
227
355
  resource: "/search/orgid/".concat(this.webex.internal.device.orgId, "/entities"),
228
356
  params: {
229
357
  queryString: queryString,
230
358
  resultSize: resultSize,
231
359
  requestedTypes: requestedTypes
232
360
  }
361
+ }).then(function (_ref4) {
362
+ var resultArray = _ref4.resultArray;
363
+ return resultArray;
364
+ });
365
+ },
366
+ /**
367
+ * Search for information about places
368
+ * @param {Object} options
369
+ * @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.
370
+ * @param {number} options.resultSize The maximum number of results returned from each provider
371
+ * @returns {Promise} Resolves with an array of entities found
372
+ */
373
+ searchPlaces: function searchPlaces(options) {
374
+ var _this5 = this;
375
+ var resultSize = options.resultSize,
376
+ queryString = options.queryString,
377
+ isOnlySchedulableRooms = options.isOnlySchedulableRooms;
378
+ return this._request({
379
+ dataPath: 'directoryEntities',
380
+ resource: "/search/orgid/".concat(this.webex.internal.device.orgId, "/places"),
381
+ params: {
382
+ queryString: queryString,
383
+ resultSize: resultSize,
384
+ isOnlySchedulableRooms: isOnlySchedulableRooms
385
+ }
386
+ }).catch(function (error) {
387
+ _this5.logger.error("DSS->search place#ERROR, search place failure, ".concat(error.message));
388
+ return _promise.default.reject(error);
233
389
  });
234
390
  },
235
- version: "3.0.0-bnr.5"
391
+ version: "3.0.0"
236
392
  });
237
- var _default = DSS;
238
- exports.default = _default;
393
+ var _default = exports.default = DSS;
239
394
  //# sourceMappingURL=dss.js.map
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","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 {\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;AACA;AACA;AASA;AAQqB;AAAA;AAErB,IAAMA,GAAG,GAAGC,sBAAW,CAACC,MAAM,CAAC;EAC7BC,SAAS,EAAE,KAAK;EAEhB;AACF;AACA;AACA;AACA;AACA;EACEC,UAAU,EAAE,KAAK;EAEjB;AACF;AACA;AACA;AACA;AACA;EACEC,QAAQ,sBAAG;IAAA;IACT,IAAI,CAAC,IAAI,CAACC,KAAK,CAACC,YAAY,EAAE;MAC5B,IAAI,CAACC,MAAM,CAACC,KAAK,CAAC,+DAA+D,CAAC;MAElF,OAAO,iBAAQC,MAAM,CAAC,IAAIC,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1D;IAEA,IAAI,IAAI,CAACP,UAAU,EAAE;MACnB,IAAI,CAACI,MAAM,CAACI,IAAI,CAAC,mDAAmD,CAAC;MAErE,OAAO,iBAAQC,OAAO,EAAE;IAC1B;IAEA,OAAO,IAAI,CAACP,KAAK,CAACQ,QAAQ,CAACC,OAAO,CAC/BC,OAAO,EAAE,CACTC,IAAI,CAAC,YAAM;MACV,KAAI,CAACC,eAAe,EAAE;MACtB,KAAI,CAACC,OAAO,CAACC,yBAAc,CAAC;MAC5B,KAAI,CAAChB,UAAU,GAAG,IAAI;IACxB,CAAC,CAAC,CACDiB,KAAK,CAAC,UAACZ,KAAK,EAAK;MAChB,KAAI,CAACD,MAAM,CAACC,KAAK,oDAA6CA,KAAK,CAACa,OAAO,EAAG;MAE9E,OAAO,iBAAQZ,MAAM,CAACD,KAAK,CAAC;IAC9B,CAAC,CAAC;EACN,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEc,UAAU,wBAAG;IAAA;IACX,IAAI,CAA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G,aAAa,yBAACpC,OAA6B,EAAE;IAC3C,IAAOqC,MAAM,GAAIrC,OAAO,CAAjBqC,MAAM;IAEb,OAAO,IAAI,CAACtC,QAAQ,CAAC;MACnBI,QAAQ,EAAE,uBAAuB;MACjCF,QAAQ,0BAAmB,IAAI,CAAClC,KAAK,CAACQ,QAAQ,CAACuD,MAAM,CAACC,KAAK,YAAS;MACpE7B,MAAM,EAAE;QACNiC,YAAY,EAAEE;MAChB;IACF,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,MAAM,kBAACtC,OAAsB,EAAE;IAC7B,IAAOuC,cAAc,GAA6BvC,OAAO,CAAlDuC,cAAc;MAAEC,UAAU,GAAiBxC,OAAO,CAAlCwC,UAAU;MAAEC,WAAW,GAAIzC,OAAO,CAAtByC,WAAW;IAE9C,OAAO,IAAI,CAAC1C,QAAQ,CAAC;MACnBI,QAAQ,EAAE,mBAAmB;MAC7BF,QAAQ,0BAAmB,IAAI,CAAClC,KAAK,CAACQ,QAAQ,CAACuD,MAAM,CAACC,KAAK,cAAW;MACtE7B,MAAM,EAAE;QACNuC,WAAW,EAAXA,WAAW;QACXD,UAAU,EAAVA,UAAU;QACVD,cAAc,EAAdA;MACF;IACF,CAAC,CAAC;EACJ,CAAC;EAAA;AACH,CAAC,CAAC;AAAC,eAEY9E,GAAG;AAAA"}
1
+ {"version":3,"names":["_uuid","_interopRequireDefault","require","_webexCore","_lodash","_commonTimers","_constants","_dssBatcher","_dssErrors","ownKeys","e","r","t","_Object$keys2","_Object$getOwnPropertySymbols","o","filter","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","Object","forEach","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","DSS","WebexPlugin","extend","namespace","registered","initialize","_len","args","Array","_key","_apply","prototype","batchers","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","foundPath","notFoundPath","timeout","config","requestTimeout","uuid","v4","eventName","result","expectedSeqNums","notFoundArray","timer","Timer","stopListening","DssTimeoutError","listenTo","reset","resultData","get","found","sequence","finished","range","map","String","done","isEqual","_keys","cancel","resultArray","foundArray","index","seqResult","_toConsumableArray2","resolveValue","request","service","DSS_SERVICE_NAME","method","contentType","body","start","_batchedLookup","lookupValue","LOOKUP_DATA_PATH","entitiesFoundPath","LOOKUP_FOUND_PATH","entitiesNotFoundPath","LOOKUP_NOT_FOUND_PATH","requestKey","LOOKUP_REQUEST_KEY","DssBatcher","parent","lookupDetail","id","device","orgId","_ref","lookup","entityProviderType","_options$shouldBatch","shouldBatch","_ref2","lookupByEmail","email","_ref3","search","requestedTypes","resultSize","queryString","SEARCH_DATA_PATH","_ref4","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 */\n/* eslint-disable no-underscore-dangle */\nimport uuid from 'uuid';\nimport {WebexPlugin} from '@webex/webex-core';\nimport '@webex/internal-plugin-mercury';\nimport {range, isEqual, get} from 'lodash';\n\nimport {Timer} from '@webex/common-timers';\nimport type {\n SearchOptions,\n LookupDetailOptions,\n LookupOptions,\n LookupByEmailOptions,\n SearchPlaceOptions,\n} from './types';\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 LOOKUP_DATA_PATH,\n LOOKUP_FOUND_PATH,\n LOOKUP_NOT_FOUND_PATH,\n LOOKUP_REQUEST_KEY,\n SEARCH_DATA_PATH,\n} from './constants';\nimport DssBatcher from './dss-batcher';\nimport {DssTimeoutError} from './dss-errors';\nimport {BatcherOptions, RequestOptions, RequestResult} from './types';\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 * Initializer\n * @private\n * @param {Object} attrs\n * @param {Object} options\n * @returns {undefined}\n */\n initialize(...args) {\n Reflect.apply(WebexPlugin.prototype.initialize, this, args);\n this.batchers = {};\n },\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 * constructs the event name based on request id\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 * Takes incoming data and triggers correct events\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 {Mixed} options.params additional params for the body of the request\n * @param {string} options.dataPath the path to get the data in the result object\n * @param {string} [options.foundPath] the path to get the lookups of the found data\n * @param {string} [options.notFoundPath] the path to get the lookups of the not found data\n * @returns {Promise<Object>} result Resolves with an object\n * @returns {Array} result.resultArray an array of entities found\n * @returns {Array} result.foundArray an array of the lookups of the found entities (if foundPath provided)\n * @returns {Array} result.notFoundArray an array of the lookups of the not found entities (if notFoundPath provided)\n * @throws {DssTimeoutError} when server does not respond in the specified timeframe\n */\n _request(options: RequestOptions): Promise<RequestResult> {\n const {resource, params, dataPath, foundPath, notFoundPath} = options;\n\n const timeout = this.config.requestTimeout;\n const requestId = uuid.v4();\n const eventName = this._getResultEventName(requestId);\n const result = {};\n let expectedSeqNums: string[];\n let notFoundArray: unknown[];\n\n return new Promise((resolve, reject) => {\n const timer = new Timer(() => {\n this.stopListening(this, eventName);\n reject(new DssTimeoutError({requestId, timeout, resource, params}));\n }, timeout);\n\n this.listenTo(this, eventName, (data) => {\n timer.reset();\n const resultData = get(data, dataPath, []);\n let found;\n\n if (foundPath) {\n found = get(data, foundPath, []);\n }\n result[data.sequence] = foundPath ? {resultData, found} : {resultData};\n\n if (data.finished) {\n expectedSeqNums = range(data.sequence + 1).map(String);\n if (notFoundPath) {\n notFoundArray = get(data, notFoundPath, []);\n }\n }\n\n const done = isEqual(expectedSeqNums, Object.keys(result));\n\n if (done) {\n timer.cancel();\n\n const resultArray: any[] = [];\n const foundArray: any[] = [];\n\n expectedSeqNums.forEach((index) => {\n const seqResult = result[index];\n\n if (seqResult) {\n resultArray.push(...seqResult.resultData);\n if (foundPath) {\n foundArray.push(...seqResult.found);\n }\n }\n });\n const resolveValue: RequestResult = {\n resultArray,\n };\n\n if (foundPath) {\n resolveValue.foundArray = foundArray;\n }\n if (notFoundPath) {\n resolveValue.notFoundArray = notFoundArray;\n }\n resolve(resolveValue);\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 timer.start();\n });\n },\n\n /**\n * Uses a batcher to make the request to the directory service\n * @param {Object} options\n * @param {string} options.resource the URL to query\n * @param {string} options.value the id or email to lookup\n * @returns {Promise} Resolves with an array of entities found\n * @throws {DssTimeoutError} when server does not respond in the specified timeframe\n */\n _batchedLookup(options: BatcherOptions) {\n const {resource, lookupValue} = options;\n const dataPath = LOOKUP_DATA_PATH;\n const entitiesFoundPath = LOOKUP_FOUND_PATH;\n const entitiesNotFoundPath = LOOKUP_NOT_FOUND_PATH;\n const requestKey = LOOKUP_REQUEST_KEY;\n\n this.batchers[resource] =\n this.batchers[resource] ||\n new DssBatcher({\n resource,\n dataPath,\n entitiesFoundPath,\n entitiesNotFoundPath,\n requestKey,\n parent: this,\n });\n\n return this.batchers[resource].request(lookupValue);\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 the entity found or null if not found\n * @throws {DssTimeoutError} when server does not respond in the specified timeframe\n */\n lookupDetail(options: LookupDetailOptions) {\n const {id} = options;\n\n const resource = `/lookup/orgid/${this.webex.internal.device.orgId}/identity/${id}/detail`;\n\n return this._request({\n dataPath: LOOKUP_DATA_PATH,\n foundPath: LOOKUP_FOUND_PATH,\n resource,\n }).then(({resultArray, foundArray}) => {\n // TODO: find out what is actually returned!\n if (foundArray[0] === id) {\n return resultArray[0];\n }\n\n return null;\n });\n },\n\n /**\n * Retrieves basic information about an entity within an organization\n * @param {Object} options\n * @param {UUID} options.id the id of the entity to lookup\n * @param {UUID} [options.entityProviderType] the provider to query\n * @param {Boolean} options.shouldBatch whether to batch the query, set to false for single immediate result (defaults to true)\n * @returns {Promise} Resolves with the entity found or null if not found\n * @throws {DssTimeoutError} when server does not respond in the specified timeframe\n */\n lookup(options: LookupOptions) {\n const {id, entityProviderType, shouldBatch = true} = 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 if (shouldBatch) {\n return this._batchedLookup({\n resource,\n lookupValue: id,\n });\n }\n\n return this._request({\n dataPath: LOOKUP_DATA_PATH,\n foundPath: LOOKUP_FOUND_PATH,\n resource,\n params: {\n [LOOKUP_REQUEST_KEY]: [id],\n },\n }).then(({resultArray, foundArray}) => {\n if (foundArray[0] === id) {\n return resultArray[0];\n }\n\n return null;\n });\n },\n\n /**\n * Retrieves basic information about an enitity within an organization\n * @param {Object} options\n * @param {UUID} options.email the email of the entity to lookup\n * @returns {Promise} Resolves with the entity found or rejects if not found\n * @throws {DssTimeoutError} when server does not respond in the specified timeframe\n */\n lookupByEmail(options: LookupByEmailOptions) {\n const {email} = options;\n const resource = `/lookup/orgid/${this.webex.internal.device.orgId}/emails`;\n\n return this._request({\n dataPath: LOOKUP_DATA_PATH,\n foundPath: LOOKUP_FOUND_PATH,\n resource,\n params: {\n [LOOKUP_REQUEST_KEY]: [email],\n },\n }).then(({resultArray, foundArray}) => {\n if (foundArray[0] === email) {\n return resultArray[0];\n }\n\n return null;\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 * @throws {DssTimeoutError} when server does not respond in the specified timeframe\n */\n search(options: SearchOptions) {\n const {requestedTypes, resultSize, queryString} = options;\n\n return this._request({\n dataPath: SEARCH_DATA_PATH,\n resource: `/search/orgid/${this.webex.internal.device.orgId}/entities`,\n params: {\n queryString,\n resultSize,\n requestedTypes,\n },\n }).then(({resultArray}) => resultArray);\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":";;;;;;;;;;;;;;;;;;AAKA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACAA,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,aAAA,GAAAH,OAAA;AAQA,IAAAI,UAAA,GAAAJ,OAAA;AAcA,IAAAK,WAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,UAAA,GAA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ACA;EACE2C,YAAY,WAAAA,aAAC7E,OAA2B,EAAE;IAAA,IAAA8E,MAAA;IACxC,IAAOL,UAAU,GAAyCzE,OAAO,CAA1DyE,UAAU;MAAEC,WAAW,GAA4B1E,OAAO,CAA9C0E,WAAW;MAAEK,sBAAsB,GAAI/E,OAAO,CAAjC+E,sBAAsB;IAEtD,OAAO,IAAI,CAAChF,QAAQ,CAAC;MACnBK,QAAQ,EAAE,mBAAmB;MAC7BF,QAAQ,mBAAAtB,MAAA,CAAmB,IAAI,CAACjB,KAAK,CAACS,QAAQ,CAACwF,MAAM,CAACC,KAAK,YAAS;MACpE1D,MAAM,EAAE;QACNuE,WAAW,EAAXA,WAAW;QACXD,UAAU,EAAVA,UAAU;QACVM,sBAAsB,EAAtBA;MACF;IACF,CAAC,CAAC,CAACpG,KAAK,CAAC,UAACb,KAAK,EAAK;MAClBgH,MAAI,CAACjH,MAAM,CAACC,KAAK,mDAAAc,MAAA,CAAmDd,KAAK,CAACe,OAAO,CAAE,CAAC;MAEpF,OAAOd,QAAA,CAAAvB,OAAA,CAAQwB,MAAM,CAACF,KAAK,CAAC;IAC9B,CAAC,CAAC;EACJ,CAAC;EAAAkH,OAAA;AACH,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA1I,OAAA,GAEYI,GAAG"}
package/dist/index.js CHANGED
@@ -13,5 +13,8 @@ _Object$defineProperty(exports, "default", {
13
13
  });
14
14
  var _webexCore = require("@webex/webex-core");
15
15
  var _dss = _interopRequireDefault(require("./dss"));
16
- (0, _webexCore.registerInternalPlugin)('dss', _dss.default);
16
+ var _config = _interopRequireDefault(require("./config"));
17
+ (0, _webexCore.registerInternalPlugin)('dss', _dss.default, {
18
+ config: _config.default
19
+ });
17
20
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["registerInternalPlugin","DSS"],"sources":["index.ts"],"sourcesContent":["import {registerInternalPlugin} from '@webex/webex-core';\n\nimport DSS from './dss';\n\nregisterInternalPlugin('dss', DSS);\n\nexport {default} from './dss';\n"],"mappings":";;;;;;;;;;;;;AAAA;AAEA;AAEA,IAAAA,iCAAsB,EAAC,KAAK,EAAEC,YAAG,CAAC"}
1
+ {"version":3,"names":["_webexCore","require","_dss","_interopRequireDefault","_config","registerInternalPlugin","DSS","config"],"sources":["index.ts"],"sourcesContent":["import {registerInternalPlugin} from '@webex/webex-core';\n\nimport DSS from './dss';\nimport config from './config';\n\nregisterInternalPlugin('dss', DSS, {config});\n\nexport {default} from './dss';\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,iCAAsB,EAAC,KAAK,EAAEC,YAAG,EAAE;EAACC,MAAM,EAANA;AAAM,CAAC,CAAC"}
package/dist/types.js CHANGED
@@ -5,23 +5,20 @@ _Object$defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.SearchType = exports.EntityProviderType = void 0;
8
- // eslint-disable-next-line no-shadow
9
- var EntityProviderType;
10
- exports.EntityProviderType = EntityProviderType;
11
- (function (EntityProviderType) {
8
+ var EntityProviderType = exports.EntityProviderType = /*#__PURE__*/function (EntityProviderType) {
12
9
  EntityProviderType["CI_USER"] = "CI_USER";
13
10
  EntityProviderType["CI_MACHINE"] = "CI_MACHINE";
14
11
  EntityProviderType["CONTACTS"] = "CONTACTS";
15
12
  EntityProviderType["CSDM"] = "CSDM";
16
- })(EntityProviderType || (exports.EntityProviderType = EntityProviderType = {}));
13
+ return EntityProviderType;
14
+ }({});
17
15
  // eslint-disable-next-line no-shadow
18
- var SearchType;
19
- exports.SearchType = SearchType;
20
- (function (SearchType) {
16
+ var SearchType = exports.SearchType = /*#__PURE__*/function (SearchType) {
21
17
  SearchType["PERSON"] = "PERSON";
22
18
  SearchType["CALLING_SERVICE"] = "CALLING_SERVICE";
23
19
  SearchType["EXTERNAL_CALLING"] = "EXTERNAL_CALLING";
24
20
  SearchType["ROOM"] = "ROOM";
25
21
  SearchType["ROBOT"] = "ROBOT";
26
- })(SearchType || (exports.SearchType = SearchType = {}));
22
+ return SearchType;
23
+ }({});
27
24
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["EntityProviderType","SearchType"],"sources":["types.ts"],"sourcesContent":["export interface LookupDetailOptions {\n id: string;\n}\n\n// eslint-disable-next-line no-shadow\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\n// eslint-disable-next-line no-shadow\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":";;;;;;;AAIA;AAAA,IACYA,kBAAkB;AAAA;AAAA,WAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;AAAA,GAAlBA,kBAAkB,kCAAlBA,kBAAkB;AAgB9B;AAAA,IACYC,UAAU;AAAA;AAAA,WAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;AAAA,GAAVA,UAAU,0BAAVA,UAAU"}
1
+ {"version":3,"names":["EntityProviderType","exports","SearchType"],"sources":["types.ts"],"sourcesContent":["export interface RequestOptions {\n resource: string;\n dataPath: string;\n foundPath?: string;\n notFoundPath?: string;\n params?: Record<string, unknown>;\n}\n\nexport interface RequestResult {\n foundArray?: any[];\n notFoundArray?: any[];\n resultArray: any[];\n}\n\nexport 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 id: string;\n entityProviderType?: EntityProviderType;\n shouldBatch?: boolean;\n}\n\nexport interface LookupByEmailOptions {\n email: string;\n}\n\n// eslint-disable-next-line no-shadow\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 BatcherOptions {\n resource: string;\n lookupValue: string;\n}\n\nexport interface SearchPlaceOptions {\n resultSize: number;\n queryString: string;\n isOnlySchedulableRooms: boolean;\n}\n"],"mappings":";;;;;;;IAkBYA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;AAiB9B;AAAA,IACYE,UAAU,GAAAD,OAAA,CAAAC,UAAA,0BAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA"}
package/jest.config.js ADDED
@@ -0,0 +1,3 @@
1
+ const config = require('@webex/jest-config-legacy');
2
+
3
+ module.exports = config;
package/package.json CHANGED
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "name": "@webex/internal-plugin-dss",
3
- "version": "3.0.0-bnr.5",
4
3
  "description": "",
5
4
  "license": "MIT",
6
5
  "author": "Colin Read <coread@cisco.com>",
@@ -21,14 +20,34 @@
21
20
  ]
22
21
  },
23
22
  "dependencies": {
24
- "@webex/internal-plugin-mercury": "3.0.0-bnr.5",
25
- "@webex/webex-core": "3.0.0-bnr.5",
23
+ "@webex/common": "3.0.0",
24
+ "@webex/common-timers": "3.0.0",
25
+ "@webex/internal-plugin-mercury": "3.0.0",
26
+ "@webex/webex-core": "3.0.0",
26
27
  "lodash": "^4.17.21",
27
28
  "uuid": "^3.3.2"
28
29
  },
29
30
  "devDependencies": {
30
- "@webex/internal-plugin-dss": "3.0.0-bnr.5",
31
- "@webex/test-helper-chai": "3.0.0-bnr.5",
32
- "@webex/test-helper-mock-webex": "3.0.0-bnr.5"
33
- }
34
- }
31
+ "@babel/core": "^7.17.10",
32
+ "@webex/babel-config-legacy": "0.0.0",
33
+ "@webex/eslint-config-legacy": "0.0.0",
34
+ "@webex/jest-config-legacy": "0.0.0",
35
+ "@webex/legacy-tools": "0.0.0",
36
+ "@webex/test-helper-chai": "3.0.0",
37
+ "@webex/test-helper-mock-webex": "3.0.0",
38
+ "@webex/test-helper-test-users": "3.0.0",
39
+ "eslint": "^8.24.0",
40
+ "prettier": "^2.7.1",
41
+ "sinon": "^9.2.4"
42
+ },
43
+ "scripts": {
44
+ "build": "yarn build:src",
45
+ "build:src": "webex-legacy-tools build -dest \"./dist\" -src \"./src\" -js -ts -maps",
46
+ "deploy:npm": "yarn npm publish",
47
+ "test": "yarn test:style && yarn test:unit && yarn test:integration && yarn test:browser",
48
+ "test:browser": "webex-legacy-tools test --integration --runner karma",
49
+ "test:style": "eslint ./src/**/*.*",
50
+ "test:unit": "webex-legacy-tools test --unit --runner jest"
51
+ },
52
+ "version": "3.0.0"
53
+ }
package/process ADDED
@@ -0,0 +1 @@
1
+ module.exports = {browser: true};
package/src/config.ts ADDED
@@ -0,0 +1,31 @@
1
+ /*!
2
+ * Copyright (c) 2015-2022 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+
5
+ export default {
6
+ dss: {
7
+ /**
8
+ * Timeout before DSS request fails, in milliseconds.
9
+ * @type {Number}
10
+ */
11
+ requestTimeout: 6000,
12
+
13
+ /**
14
+ * Debounce wait (ms) before sending a dss request (gap between lookups that will trigger a request)
15
+ * @type {Number}
16
+ */
17
+ batcherWait: 50,
18
+
19
+ /**
20
+ * Maximum queue size before sending a dss request
21
+ * @type {Number}
22
+ */
23
+ batcherMaxCalls: 50,
24
+
25
+ /**
26
+ * Debounce max wait (ms) before sending a dss request (time from first lookup that will trigger a request)
27
+ * @type {Number}
28
+ */
29
+ batcherMaxWait: 150,
30
+ },
31
+ };
package/src/constants.ts CHANGED
@@ -12,3 +12,8 @@ export const SEARCH_TYPES = {
12
12
  ROOM: 'ROOM',
13
13
  ROBOT: 'ROBOT',
14
14
  };
15
+ export const LOOKUP_DATA_PATH = 'lookupResult.entities';
16
+ export const LOOKUP_FOUND_PATH = 'lookupResult.entitiesFound';
17
+ export const LOOKUP_NOT_FOUND_PATH = 'lookupResult.entitiesNotFound';
18
+ export const LOOKUP_REQUEST_KEY = 'lookupValues';
19
+ export const SEARCH_DATA_PATH = 'directoryEntities';