@webex/internal-plugin-dss 3.0.0-beta.136 → 3.0.0-beta.138

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/config.js ADDED
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
+ _Object$defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ /*!
9
+ * Copyright (c) 2015-2022 Cisco Systems, Inc. See LICENSE file.
10
+ */
11
+ var _default = {
12
+ dss: {
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
+ * Maximum queue size before sending a dss request
20
+ * @type {Number}
21
+ */
22
+ batcherMaxCalls: 50,
23
+ /**
24
+ * Debounce max wait (ms) before sending a dss request (time from first lookup that will trigger a request)
25
+ * @type {Number}
26
+ */
27
+ batcherMaxWait: 150
28
+ }
29
+ };
30
+ exports.default = _default;
31
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["dss","batcherWait","batcherMaxCalls","batcherMaxWait"],"sources":["config.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2022 Cisco Systems, Inc. See LICENSE file.\n */\n\nexport default {\n dss: {\n /**\n * Debounce wait (ms) before sending a dss request (gap between lookups that will trigger a request)\n * @type {Number}\n */\n batcherWait: 50,\n\n /**\n * Maximum queue size before sending a dss request\n * @type {Number}\n */\n batcherMaxCalls: 50,\n\n /**\n * Debounce max wait (ms) before sending a dss request (time from first lookup that will trigger a request)\n * @type {Number}\n */\n batcherMaxWait: 150,\n },\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAFA,eAIe;EACbA,GAAG,EAAE;IACH;AACJ;AACA;AACA;IACIC,WAAW,EAAE,EAAE;IAEf;AACJ;AACA;AACA;IACIC,eAAe,EAAE,EAAE;IAEnB;AACJ;AACA;AACA;IACIC,cAAc,EAAE;EAClB;AACF,CAAC;AAAA"}
package/dist/constants.js CHANGED
@@ -4,7 +4,7 @@ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/defi
4
4
  _Object$defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.SEARCH_TYPES = exports.DSS_UNREGISTERED = exports.DSS_SERVICE_NAME = exports.DSS_SEARCH_MERCURY_EVENT = exports.DSS_RESULT = exports.DSS_REGISTERED = exports.DSS_LOOKUP_RESULT = exports.DSS_LOOKUP_MERCURY_EVENT = void 0;
7
+ exports.SEARCH_TYPES = exports.SEARCH_DATA_PATH = exports.LOOKUP_REQUEST_KEY = exports.LOOKUP_NOT_FOUND_PATH = exports.LOOKUP_FOUND_PATH = exports.LOOKUP_DATA_PATH = exports.DSS_UNREGISTERED = exports.DSS_SERVICE_NAME = exports.DSS_SEARCH_MERCURY_EVENT = exports.DSS_RESULT = exports.DSS_REGISTERED = exports.DSS_LOOKUP_RESULT = exports.DSS_LOOKUP_MERCURY_EVENT = void 0;
8
8
  var DSS_REGISTERED = 'dss:registered';
9
9
  exports.DSS_REGISTERED = DSS_REGISTERED;
10
10
  var DSS_UNREGISTERED = 'dss:unregistered';
@@ -27,4 +27,14 @@ var SEARCH_TYPES = {
27
27
  ROBOT: 'ROBOT'
28
28
  };
29
29
  exports.SEARCH_TYPES = SEARCH_TYPES;
30
+ var LOOKUP_DATA_PATH = 'lookupResult.entities';
31
+ exports.LOOKUP_DATA_PATH = LOOKUP_DATA_PATH;
32
+ var LOOKUP_FOUND_PATH = 'lookupResult.entitiesFound';
33
+ exports.LOOKUP_FOUND_PATH = LOOKUP_FOUND_PATH;
34
+ var LOOKUP_NOT_FOUND_PATH = 'lookupResult.entitiesNotFound';
35
+ exports.LOOKUP_NOT_FOUND_PATH = LOOKUP_NOT_FOUND_PATH;
36
+ var LOOKUP_REQUEST_KEY = 'lookupValues';
37
+ exports.LOOKUP_REQUEST_KEY = LOOKUP_REQUEST_KEY;
38
+ var SEARCH_DATA_PATH = 'directoryEntities';
39
+ exports.SEARCH_DATA_PATH = SEARCH_DATA_PATH;
30
40
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DSS_REGISTERED","DSS_UNREGISTERED","DSS_LOOKUP_MERCURY_EVENT","DSS_SEARCH_MERCURY_EVENT","DSS_LOOKUP_RESULT","DSS_RESULT","DSS_SERVICE_NAME","SEARCH_TYPES","PERSON","CALLING_SERVICE","EXTERNAL_CALLING","ROOM","ROBOT"],"sources":["constants.ts"],"sourcesContent":["export const DSS_REGISTERED = 'dss:registered';\nexport const DSS_UNREGISTERED = 'dss:unregistered';\nexport const DSS_LOOKUP_MERCURY_EVENT = 'event:directory.lookup';\nexport const DSS_SEARCH_MERCURY_EVENT = 'event:directory.search';\nexport const DSS_LOOKUP_RESULT = 'dss:lookup.result';\nexport const DSS_RESULT = 'dss:result';\nexport const DSS_SERVICE_NAME = 'directorySearch';\nexport const SEARCH_TYPES = {\n PERSON: 'PERSON',\n CALLING_SERVICE: 'CALLING_SERVICE',\n EXTERNAL_CALLING: 'EXTERNAL_CALLING',\n ROOM: 'ROOM',\n ROBOT: 'ROBOT',\n};\n"],"mappings":";;;;;;;AAAO,IAAMA,cAAc,GAAG,gBAAgB;AAAC;AACxC,IAAMC,gBAAgB,GAAG,kBAAkB;AAAC;AAC5C,IAAMC,wBAAwB,GAAG,wBAAwB;AAAC;AAC1D,IAAMC,wBAAwB,GAAG,wBAAwB;AAAC;AAC1D,IAAMC,iBAAiB,GAAG,mBAAmB;AAAC;AAC9C,IAAMC,UAAU,GAAG,YAAY;AAAC;AAChC,IAAMC,gBAAgB,GAAG,iBAAiB;AAAC;AAC3C,IAAMC,YAAY,GAAG;EAC1BC,MAAM,EAAE,QAAQ;EAChBC,eAAe,EAAE,iBAAiB;EAClCC,gBAAgB,EAAE,kBAAkB;EACpCC,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE;AACT,CAAC;AAAC"}
1
+ {"version":3,"names":["DSS_REGISTERED","DSS_UNREGISTERED","DSS_LOOKUP_MERCURY_EVENT","DSS_SEARCH_MERCURY_EVENT","DSS_LOOKUP_RESULT","DSS_RESULT","DSS_SERVICE_NAME","SEARCH_TYPES","PERSON","CALLING_SERVICE","EXTERNAL_CALLING","ROOM","ROBOT","LOOKUP_DATA_PATH","LOOKUP_FOUND_PATH","LOOKUP_NOT_FOUND_PATH","LOOKUP_REQUEST_KEY","SEARCH_DATA_PATH"],"sources":["constants.ts"],"sourcesContent":["export const DSS_REGISTERED = 'dss:registered';\nexport const DSS_UNREGISTERED = 'dss:unregistered';\nexport const DSS_LOOKUP_MERCURY_EVENT = 'event:directory.lookup';\nexport const DSS_SEARCH_MERCURY_EVENT = 'event:directory.search';\nexport const DSS_LOOKUP_RESULT = 'dss:lookup.result';\nexport const DSS_RESULT = 'dss:result';\nexport const DSS_SERVICE_NAME = 'directorySearch';\nexport const SEARCH_TYPES = {\n PERSON: 'PERSON',\n CALLING_SERVICE: 'CALLING_SERVICE',\n EXTERNAL_CALLING: 'EXTERNAL_CALLING',\n ROOM: 'ROOM',\n ROBOT: 'ROBOT',\n};\nexport const LOOKUP_DATA_PATH = 'lookupResult.entities';\nexport const LOOKUP_FOUND_PATH = 'lookupResult.entitiesFound';\nexport const LOOKUP_NOT_FOUND_PATH = 'lookupResult.entitiesNotFound';\nexport const LOOKUP_REQUEST_KEY = 'lookupValues';\nexport const SEARCH_DATA_PATH = 'directoryEntities';\n"],"mappings":";;;;;;;AAAO,IAAMA,cAAc,GAAG,gBAAgB;AAAC;AACxC,IAAMC,gBAAgB,GAAG,kBAAkB;AAAC;AAC5C,IAAMC,wBAAwB,GAAG,wBAAwB;AAAC;AAC1D,IAAMC,wBAAwB,GAAG,wBAAwB;AAAC;AAC1D,IAAMC,iBAAiB,GAAG,mBAAmB;AAAC;AAC9C,IAAMC,UAAU,GAAG,YAAY;AAAC;AAChC,IAAMC,gBAAgB,GAAG,iBAAiB;AAAC;AAC3C,IAAMC,YAAY,GAAG;EAC1BC,MAAM,EAAE,QAAQ;EAChBC,eAAe,EAAE,iBAAiB;EAClCC,gBAAgB,EAAE,kBAAkB;EACpCC,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE;AACT,CAAC;AAAC;AACK,IAAMC,gBAAgB,GAAG,uBAAuB;AAAC;AACjD,IAAMC,iBAAiB,GAAG,4BAA4B;AAAC;AACvD,IAAMC,qBAAqB,GAAG,+BAA+B;AAAC;AAC9D,IAAMC,kBAAkB,GAAG,cAAc;AAAC;AAC1C,IAAMC,gBAAgB,GAAG,mBAAmB;AAAC"}
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
+ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
10
+ var _webexCore = require("@webex/webex-core");
11
+ /*!
12
+ * Copyright (c) 2015-2022 Cisco Systems, Inc. See LICENSE file.
13
+ */
14
+ /* eslint-disable no-underscore-dangle */
15
+
16
+ /**
17
+ * @class
18
+ */
19
+ var DssBatcher = _webexCore.Batcher.extend({
20
+ namespace: 'DSS',
21
+ props: {
22
+ resource: {
23
+ type: 'string',
24
+ required: true,
25
+ setOnce: true,
26
+ allowNull: false
27
+ },
28
+ dataPath: {
29
+ type: 'string',
30
+ required: true,
31
+ setOnce: true,
32
+ allowNull: false
33
+ },
34
+ entitiesFoundPath: {
35
+ type: 'string',
36
+ required: true,
37
+ setOnce: true,
38
+ allowNull: false
39
+ },
40
+ entitiesNotFoundPath: {
41
+ type: 'string',
42
+ required: true,
43
+ setOnce: true,
44
+ allowNull: false
45
+ },
46
+ requestKey: {
47
+ type: 'string',
48
+ required: true,
49
+ setOnce: true,
50
+ allowNull: false
51
+ }
52
+ },
53
+ /**
54
+ * Submits the DSS request
55
+ * @param {Object} payload
56
+ * @returns {Promise<Array>}
57
+ */
58
+ submitHttpRequest: function submitHttpRequest(payload) {
59
+ return this.parent._request({
60
+ dataPath: this.dataPath,
61
+ foundPath: this.entitiesFoundPath,
62
+ notFoundPath: this.entitiesNotFoundPath,
63
+ resource: this.resource,
64
+ params: {
65
+ lookupValues: payload
66
+ }
67
+ });
68
+ },
69
+ /**
70
+ * Actions taken when the http request returns a success
71
+ * @param {Promise<Array>} res
72
+ * @returns {Promise<undefined>}
73
+ */
74
+ handleHttpSuccess: function handleHttpSuccess(res) {
75
+ var _this = this;
76
+ var successItems = res.foundArray.map(function (requestValue, index) {
77
+ return {
78
+ requestValue: requestValue,
79
+ entity: res.resultArray[index]
80
+ };
81
+ });
82
+ var failureItems = res.notFoundArray.map(function (requestValue) {
83
+ return {
84
+ requestValue: requestValue,
85
+ entity: null
86
+ };
87
+ });
88
+ return _promise.default.all(successItems.concat(failureItems).map(function (item) {
89
+ return _this.acceptItem(item);
90
+ }));
91
+ },
92
+ /**
93
+ * Checks if the item was found
94
+ * @param {Object} item
95
+ * @returns {Promise<Boolean>}
96
+ */
97
+ didItemFail: function didItemFail(item) {
98
+ return _promise.default.resolve(item.entity === null);
99
+ },
100
+ /**
101
+ * Finds the Defer for the specified item and resolves its promise with null
102
+ * @param {Object} item
103
+ * @returns {Promise<undefined>}
104
+ */
105
+ handleItemFailure: function handleItemFailure(item) {
106
+ return this.getDeferredForResponse(item).then(function (defer) {
107
+ defer.resolve(null);
108
+ });
109
+ },
110
+ /**
111
+ * Finds the Defer for the specified item and resolves its promise
112
+ * @param {Object} item
113
+ * @returns {Promise<undefined>}
114
+ */
115
+ handleItemSuccess: function handleItemSuccess(item) {
116
+ return this.getDeferredForResponse(item).then(function (defer) {
117
+ defer.resolve(item.entity);
118
+ });
119
+ },
120
+ /**
121
+ * Returns a promise with the unique key for the item
122
+ * @param {Object} item
123
+ * @returns {Promise}
124
+ */
125
+ fingerprintRequest: function fingerprintRequest(item) {
126
+ return _promise.default.resolve(item);
127
+ },
128
+ /**
129
+ * Returns a promise with the unique key for the item
130
+ * @param {Object} item
131
+ * @returns {Promise}
132
+ */
133
+ fingerprintResponse: function fingerprintResponse(item) {
134
+ return _promise.default.resolve(item.requestValue);
135
+ }
136
+ });
137
+ var _default = DssBatcher;
138
+ exports.default = _default;
139
+ //# sourceMappingURL=dss-batcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DssBatcher","Batcher","extend","namespace","props","resource","type","required","setOnce","allowNull","dataPath","entitiesFoundPath","entitiesNotFoundPath","requestKey","submitHttpRequest","payload","parent","_request","foundPath","notFoundPath","params","lookupValues","handleHttpSuccess","res","successItems","foundArray","map","requestValue","index","entity","resultArray","failureItems","notFoundArray","all","concat","item","acceptItem","didItemFail","resolve","handleItemFailure","getDeferredForResponse","then","defer","handleItemSuccess","fingerprintRequest","fingerprintResponse"],"sources":["dss-batcher.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2022 Cisco Systems, Inc. See LICENSE file.\n */\n/* eslint-disable no-underscore-dangle */\n\nimport {Batcher} from '@webex/webex-core';\n\n/**\n * @class\n */\nconst DssBatcher = Batcher.extend({\n namespace: 'DSS',\n\n props: {\n resource: {\n type: 'string',\n required: true,\n setOnce: true,\n allowNull: false,\n },\n dataPath: {\n type: 'string',\n required: true,\n setOnce: true,\n allowNull: false,\n },\n entitiesFoundPath: {\n type: 'string',\n required: true,\n setOnce: true,\n allowNull: false,\n },\n entitiesNotFoundPath: {\n type: 'string',\n required: true,\n setOnce: true,\n allowNull: false,\n },\n requestKey: {\n type: 'string',\n required: true,\n setOnce: true,\n allowNull: false,\n },\n },\n\n /**\n * Submits the DSS request\n * @param {Object} payload\n * @returns {Promise<Array>}\n */\n submitHttpRequest(payload) {\n return this.parent._request({\n dataPath: this.dataPath,\n foundPath: this.entitiesFoundPath,\n notFoundPath: this.entitiesNotFoundPath,\n resource: this.resource,\n params: {\n lookupValues: payload,\n },\n });\n },\n\n /**\n * Actions taken when the http request returns a success\n * @param {Promise<Array>} res\n * @returns {Promise<undefined>}\n */\n handleHttpSuccess(res) {\n const successItems = res.foundArray.map((requestValue, index) => ({\n requestValue,\n entity: res.resultArray[index],\n }));\n const failureItems = res.notFoundArray.map((requestValue) => ({requestValue, entity: null}));\n\n return Promise.all(successItems.concat(failureItems).map((item) => this.acceptItem(item)));\n },\n\n /**\n * Checks if the item was found\n * @param {Object} item\n * @returns {Promise<Boolean>}\n */\n didItemFail(item) {\n return Promise.resolve(item.entity === null);\n },\n\n /**\n * Finds the Defer for the specified item and resolves its promise with null\n * @param {Object} item\n * @returns {Promise<undefined>}\n */\n handleItemFailure(item) {\n return this.getDeferredForResponse(item).then((defer) => {\n defer.resolve(null);\n });\n },\n\n /**\n * Finds the Defer for the specified item and resolves its promise\n * @param {Object} item\n * @returns {Promise<undefined>}\n */\n handleItemSuccess(item) {\n return this.getDeferredForResponse(item).then((defer) => {\n defer.resolve(item.entity);\n });\n },\n\n /**\n * Returns a promise with the unique key for the item\n * @param {Object} item\n * @returns {Promise}\n */\n fingerprintRequest(item) {\n return Promise.resolve(item);\n },\n\n /**\n * Returns a promise with the unique key for the item\n * @param {Object} item\n * @returns {Promise}\n */\n fingerprintResponse(item) {\n return Promise.resolve(item.requestValue);\n },\n});\n\nexport default DssBatcher;\n"],"mappings":";;;;;;;;;AAKA;AALA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA,IAAMA,UAAU,GAAGC,kBAAO,CAACC,MAAM,CAAC;EAChCC,SAAS,EAAE,KAAK;EAEhBC,KAAK,EAAE;IACLC,QAAQ,EAAE;MACRC,IAAI,EAAE,QAAQ;MACdC,QAAQ,EAAE,IAAI;MACdC,OAAO,EAAE,IAAI;MACbC,SAAS,EAAE;IACb,CAAC;IACDC,QAAQ,EAAE;MACRJ,IAAI,EAAE,QAAQ;MACdC,QAAQ,EAAE,IAAI;MACdC,OAAO,EAAE,I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M,CAACH,YAAY,CAAC,CAACL,GAAG,CAAC,UAACS,IAAI;MAAA,OAAK,KAAI,CAACC,UAAU,CAACD,IAAI,CAAC;IAAA,EAAC,CAAC;EAC5F,CAAC;EAED;AACF;AACA;AACA;AACA;EACEE,WAAW,uBAACF,IAAI,EAAE;IAChB,OAAO,iBAAQG,OAAO,CAACH,IAAI,CAACN,MAAM,KAAK,IAAI,CAAC;EAC9C,CAAC;EAED;AACF;AACA;AACA;AACA;EACEU,iBAAiB,6BAACJ,IAAI,EAAE;IACtB,OAAO,IAAI,CAACK,sBAAsB,CAACL,IAAI,CAAC,CAACM,IAAI,CAAC,UAACC,KAAK,EAAK;MACvDA,KAAK,CAACJ,OAAO,CAAC,IAAI,CAAC;IACrB,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;EACEK,iBAAiB,6BAACR,IAAI,EAAE;IACtB,OAAO,IAAI,CAACK,sBAAsB,CAACL,IAAI,CAAC,CAACM,IAAI,CAAC,UAACC,KAAK,EAAK;MACvDA,KAAK,CAACJ,OAAO,CAACH,IAAI,CAACN,MAAM,CAAC;IAC5B,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;EACEe,kBAAkB,8BAACT,IAAI,EAAE;IACvB,OAAO,iBAAQG,OAAO,CAACH,IAAI,CAAC;EAC9B,CAAC;EAED;AACF;AACA;AACA;AACA;EACEU,mBAAmB,+BAACV,IAAI,EAAE;IACxB,OAAO,iBAAQG,OAAO,CAACH,IAAI,CAACR,YAAY,CAAC;EAC3C;AACF,CAAC,CAAC;AAAC,eAEY3B,UAAU;AAAA"}
package/dist/dss.js CHANGED
@@ -11,6 +11,7 @@ _Object$defineProperty(exports, "__esModule", {
11
11
  value: true
12
12
  });
13
13
  exports.default = void 0;
14
+ var _apply = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/apply"));
14
15
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
15
16
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
16
17
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
@@ -22,6 +23,7 @@ var _uuid = _interopRequireDefault(require("uuid"));
22
23
  var _webexCore = require("@webex/webex-core");
23
24
  require("@webex/internal-plugin-mercury");
24
25
  var _constants = require("./constants");
26
+ var _dssBatcher = _interopRequireDefault(require("./dss-batcher"));
25
27
  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
28
  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; }
27
29
  var DSS = _webexCore.WebexPlugin.extend({
@@ -33,6 +35,20 @@ var DSS = _webexCore.WebexPlugin.extend({
33
35
  * @memberof DSS
34
36
  */
35
37
  registered: false,
38
+ /**
39
+ * Initializer
40
+ * @private
41
+ * @param {Object} attrs
42
+ * @param {Object} options
43
+ * @returns {undefined}
44
+ */
45
+ initialize: function initialize() {
46
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
47
+ args[_key] = arguments[_key];
48
+ }
49
+ (0, _apply.default)(_webexCore.WebexPlugin.prototype.initialize, this, args);
50
+ this.batchers = {};
51
+ },
36
52
  /**
37
53
  * Explicitly sets up the DSS plugin by connecting to mercury, and listening for DSS events.
38
54
  * @returns {Promise}
@@ -100,6 +116,7 @@ var DSS = _webexCore.WebexPlugin.extend({
100
116
  this.webex.internal.mercury.off(_constants.DSS_SEARCH_MERCURY_EVENT);
101
117
  },
102
118
  /**
119
+ * constructs the event name based on request id
103
120
  * @param {UUID} requestId the id of the request
104
121
  * @returns {string}
105
122
  */
@@ -107,6 +124,7 @@ var DSS = _webexCore.WebexPlugin.extend({
107
124
  return "".concat(_constants.DSS_RESULT).concat(requestId);
108
125
  },
109
126
  /**
127
+ * Takes incoming data and triggers correct events
110
128
  * @param {Object} data the event data
111
129
  * @returns {undefined}
112
130
  */
@@ -119,35 +137,68 @@ var DSS = _webexCore.WebexPlugin.extend({
119
137
  * @param {Object} options
120
138
  * @param {string} options.resource the URL to query
121
139
  * @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
140
+ * @param {string} options.dataPath the path to get the data in the result object
141
+ * @param {string} options.foundPath the path to get the lookups of the found data (optional)
142
+ * @param {string} options.notFoundPath the path to get the lookups of the not found data (optional)
143
+ * @returns {Promise<Object>} result Resolves with an object
144
+ * @returns {Array} result.resultArray an array of entities found
145
+ * @returns {Array} result.foundArray an array of the lookups of the found entities (if foundPath provided)
146
+ * @returns {Array} result.notFoundArray an array of the lookups of the not found entities (if notFoundPath provided)
124
147
  */
125
148
  _request: function _request(options) {
126
149
  var _this4 = this;
127
150
  var resource = options.resource,
128
151
  params = options.params,
129
- dataPath = options.dataPath;
152
+ dataPath = options.dataPath,
153
+ foundPath = options.foundPath,
154
+ notFoundPath = options.notFoundPath;
130
155
  var requestId = _uuid.default.v4();
131
156
  var eventName = this._getResultEventName(requestId);
132
157
  var result = {};
133
158
  var expectedSeqNums;
159
+ var notFoundArray;
134
160
  return new _promise.default(function (resolve) {
135
161
  _this4.listenTo(_this4, eventName, function (data) {
136
- var resultData = (0, _get2.default)(data, dataPath);
137
- result[data.sequence] = resultData;
162
+ var resultData = (0, _get2.default)(data, dataPath, []);
163
+ var found;
164
+ if (foundPath) {
165
+ found = (0, _get2.default)(data, foundPath, []);
166
+ }
167
+ result[data.sequence] = foundPath ? {
168
+ resultData: resultData,
169
+ found: found
170
+ } : {
171
+ resultData: resultData
172
+ };
138
173
  if (data.finished) {
139
174
  expectedSeqNums = (0, _range2.default)(data.sequence + 1).map(String);
175
+ if (notFoundPath) {
176
+ notFoundArray = (0, _get2.default)(data, notFoundPath, []);
177
+ }
140
178
  }
141
179
  var done = (0, _isEqual2.default)(expectedSeqNums, (0, _keys.default)(result));
142
180
  if (done) {
143
181
  var resultArray = [];
182
+ var foundArray = [];
144
183
  expectedSeqNums.forEach(function (index) {
145
184
  var seqResult = result[index];
146
185
  if (seqResult) {
147
- resultArray.push.apply(resultArray, (0, _toConsumableArray2.default)(seqResult));
186
+ resultArray.push.apply(resultArray, (0, _toConsumableArray2.default)(seqResult.resultData));
187
+ if (foundPath) {
188
+ foundArray.push.apply(foundArray, (0, _toConsumableArray2.default)(seqResult.found));
189
+ }
148
190
  }
149
191
  });
150
- resolve(resultArray);
192
+ var resolveValue = {
193
+ resultArray: resultArray
194
+ };
195
+ if (foundPath) {
196
+ resolveValue.foundArray = foundArray;
197
+ }
198
+ if (notFoundPath) {
199
+ resolveValue.notFoundArray = notFoundArray;
200
+ }
201
+ resolve(resolveValue);
151
202
  _this4.stopListening(_this4, eventName);
152
203
  }
153
204
  });
@@ -162,52 +213,108 @@ var DSS = _webexCore.WebexPlugin.extend({
162
213
  });
163
214
  });
164
215
  },
216
+ /**
217
+ * Uses a batcher to make the request to the directory service
218
+ * @param {Object} options
219
+ * @param {string} options.resource the URL to query
220
+ * @param {string} options.value the id or email to lookup
221
+ * @returns {Promise} Resolves with an array of entities found
222
+ */
223
+ _batchedLookup: function _batchedLookup(options) {
224
+ var resource = options.resource,
225
+ lookupValue = options.lookupValue;
226
+ var dataPath = _constants.LOOKUP_DATA_PATH;
227
+ var entitiesFoundPath = _constants.LOOKUP_FOUND_PATH;
228
+ var entitiesNotFoundPath = _constants.LOOKUP_NOT_FOUND_PATH;
229
+ var requestKey = _constants.LOOKUP_REQUEST_KEY;
230
+ this.batchers[resource] = this.batchers[resource] || new _dssBatcher.default({
231
+ resource: resource,
232
+ dataPath: dataPath,
233
+ entitiesFoundPath: entitiesFoundPath,
234
+ entitiesNotFoundPath: entitiesNotFoundPath,
235
+ requestKey: requestKey,
236
+ parent: this
237
+ });
238
+ return this.batchers[resource].request(lookupValue);
239
+ },
165
240
  /**
166
241
  * Retrieves detailed information about an entity
167
242
  * @param {Object} options
168
243
  * @param {UUID} options.id the id of the entity to lookup
169
- * @returns {Promise} Resolves with an array of entities found
244
+ * @returns {Promise} Resolves with the entity found or null if not found
170
245
  */
171
246
  lookupDetail: function lookupDetail(options) {
172
247
  var id = options.id;
248
+ var resource = "/lookup/orgid/".concat(this.webex.internal.device.orgId, "/identity/").concat(id, "/detail");
173
249
  return this._request({
174
- dataPath: 'lookupResult.entities',
175
- resource: "/lookup/orgid/".concat(this.webex.internal.device.orgId, "/identity/").concat(id, "/detail")
250
+ dataPath: _constants.LOOKUP_DATA_PATH,
251
+ foundPath: _constants.LOOKUP_FOUND_PATH,
252
+ resource: resource
253
+ }).then(function (_ref) {
254
+ var resultArray = _ref.resultArray,
255
+ foundArray = _ref.foundArray;
256
+ // TODO: find out what is actually returned!
257
+ if (foundArray[0] === id) {
258
+ return resultArray[0];
259
+ }
260
+ return null;
176
261
  });
177
262
  },
178
263
  /**
179
- * Retrieves basic information about a list entities within an organization
264
+ * Retrieves basic information about an entity within an organization
180
265
  * @param {Object} options
181
- * @param {UUID} options.ids the id of the entity to lookup
266
+ * @param {UUID} options.id the id of the entity to lookup
182
267
  * @param {UUID} options.entityProviderType the provider to query (optional)
183
- * @returns {Promise} Resolves with an array of entities found
268
+ * @param {Boolean} options.shouldBatch whether to batch the query, set to false for single immediate result (defaults to true)
269
+ * @returns {Promise} Resolves with the entity found or null if not found
184
270
  */
185
271
  lookup: function lookup(options) {
186
- var ids = options.ids,
187
- entityProviderType = options.entityProviderType;
272
+ var id = options.id,
273
+ entityProviderType = options.entityProviderType,
274
+ _options$shouldBatch = options.shouldBatch,
275
+ shouldBatch = _options$shouldBatch === void 0 ? true : _options$shouldBatch;
188
276
  var resource = entityProviderType ? "/lookup/orgid/".concat(this.webex.internal.device.orgId, "/entityprovidertype/").concat(entityProviderType) : "/lookup/orgid/".concat(this.webex.internal.device.orgId, "/identities");
277
+ if (shouldBatch) {
278
+ return this._batchedLookup({
279
+ resource: resource,
280
+ lookupValue: id
281
+ });
282
+ }
189
283
  return this._request({
190
- dataPath: 'lookupResult.entities',
284
+ dataPath: _constants.LOOKUP_DATA_PATH,
285
+ foundPath: _constants.LOOKUP_FOUND_PATH,
191
286
  resource: resource,
192
- params: {
193
- lookupValues: ids
287
+ params: (0, _defineProperty2.default)({}, _constants.LOOKUP_REQUEST_KEY, [id])
288
+ }).then(function (_ref2) {
289
+ var resultArray = _ref2.resultArray,
290
+ foundArray = _ref2.foundArray;
291
+ if (foundArray[0] === id) {
292
+ return resultArray[0];
194
293
  }
294
+ return null;
195
295
  });
196
296
  },
197
297
  /**
198
- * Retrieves basic information about a list entities within an organization
298
+ * Retrieves basic information about an enitity within an organization
199
299
  * @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
300
+ * @param {UUID} options.email the email of the entity to lookup
301
+ * @returns {Promise} Resolves with the entity found or rejects if not found
202
302
  */
203
303
  lookupByEmail: function lookupByEmail(options) {
204
- var emails = options.emails;
304
+ var email = options.email;
305
+ var resource = "/lookup/orgid/".concat(this.webex.internal.device.orgId, "/emails");
205
306
  return this._request({
206
- dataPath: 'lookupResult.entities',
207
- resource: "/lookup/orgid/".concat(this.webex.internal.device.orgId, "/emails"),
208
- params: {
209
- lookupValues: emails
307
+ dataPath: _constants.LOOKUP_DATA_PATH,
308
+ foundPath: _constants.LOOKUP_FOUND_PATH,
309
+ resource: resource,
310
+ params: (0, _defineProperty2.default)({}, _constants.LOOKUP_REQUEST_KEY, [email])
311
+ }).then(function (_ref3) {
312
+ var resultArray = _ref3.resultArray,
313
+ foundArray = _ref3.foundArray;
314
+ if (foundArray[0] === email) {
315
+ return resultArray[0];
210
316
  }
317
+ return null;
211
318
  });
212
319
  },
213
320
  /**
@@ -223,16 +330,19 @@ var DSS = _webexCore.WebexPlugin.extend({
223
330
  resultSize = options.resultSize,
224
331
  queryString = options.queryString;
225
332
  return this._request({
226
- dataPath: 'directoryEntities',
333
+ dataPath: _constants.SEARCH_DATA_PATH,
227
334
  resource: "/search/orgid/".concat(this.webex.internal.device.orgId, "/entities"),
228
335
  params: {
229
336
  queryString: queryString,
230
337
  resultSize: resultSize,
231
338
  requestedTypes: requestedTypes
232
339
  }
340
+ }).then(function (_ref4) {
341
+ var resultArray = _ref4.resultArray;
342
+ return resultArray;
233
343
  });
234
344
  },
235
- version: "3.0.0-beta.136"
345
+ version: "3.0.0-beta.138"
236
346
  });
237
347
  var _default = DSS;
238
348
  exports.default = _default;
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 */\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 type {\n SearchOptions,\n LookupDetailOptions,\n LookupOptions,\n LookupByEmailOptions,\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} 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":";;;;;;;;;;;;;;;;;;;;AAKA;AACA;AACA;AASA;AAQqB;AAAA;AAErB,IAAMA,GAAG,GAAGC,sBAAW,C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,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":["DSS","WebexPlugin","extend","namespace","registered","initialize","args","prototype","batchers","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","foundPath","notFoundPath","uuid","v4","eventName","result","expectedSeqNums","notFoundArray","listenTo","resultData","found","sequence","finished","map","String","done","resultArray","foundArray","forEach","index","seqResult","push","resolveValue","stopListening","request","service","DSS_SERVICE_NAME","method","contentType","body","_batchedLookup","lookupValue","LOOKUP_DATA_PATH","entitiesFoundPath","LOOKUP_FOUND_PATH","entitiesNotFoundPath","LOOKUP_NOT_FOUND_PATH","requestKey","LOOKUP_REQUEST_KEY","DssBatcher","parent","lookupDetail","id","device","orgId","lookup","entityProviderType","shouldBatch","lookupByEmail","email","search","requestedTypes","resultSize","queryString","SEARCH_DATA_PATH"],"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 type {\n SearchOptions,\n LookupDetailOptions,\n LookupOptions,\n LookupByEmailOptions,\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';\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 {string} 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 (optional)\n * @param {string} options.notFoundPath the path to get the lookups of the not found data (optional)\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 */\n _request(options) {\n const {resource, params, dataPath, foundPath, notFoundPath} = options;\n\n const requestId = uuid.v4();\n const eventName = this._getResultEventName(requestId);\n const result = {};\n let expectedSeqNums;\n let notFoundArray;\n\n return new Promise((resolve) => {\n this.listenTo(this, eventName, (data) => {\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 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: {resultArray: any[]; foundArray?: any[]; notFoundArray?: any[]} = {\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 });\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 */\n _batchedLookup(options) {\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 */\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 (optional)\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 */\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 */\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 */\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\nexport default DSS;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAKA;AACA;AACA;AASA;AAcA;AAAuC;AAAA;AAEvC,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;AACA;EACEC,UAAU,wBAAU;IAAA,kCAANC,IAAI;MAAJA,IAAI;IAAA;IAChB,oBAAcL,sBAAW,CAACM,SAAS,CAACF,UAAU,EAAE,IAAI,EAAEC,IAAI,CAAC;IAC3D,IAAI,CAACE,QAAQ,GAAG,CAAC,CAAC;EACpB,CAAC;EAED;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;M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AAE;IAC7B,IAAOuD,cAAc,GAA6BvD,OAAO,CAAlDuD,cAAc;MAAEC,UAAU,GAAiBxD,OAAO,CAAlCwD,UAAU;MAAEC,WAAW,GAAIzD,OAAO,CAAtByD,WAAW;IAE9C,OAAO,IAAI,CAAC1D,QAAQ,CAAC;MACnBI,QAAQ,EAAEuD,2BAAgB;MAC1BzD,QAAQ,0BAAmB,IAAI,CAAClC,KAAK,CAACQ,QAAQ,CAACwE,MAAM,CAACC,KAAK,cAAW;MACtE9C,MAAM,EAAE;QACNuD,WAAW,EAAXA,WAAW;QACXD,UAAU,EAAVA,UAAU;QACVD,cAAc,EAAdA;MACF;IACF,CAAC,CAAC,CAAC7E,IAAI,CAAC;MAAA,IAAE0C,WAAW,SAAXA,WAAW;MAAA,OAAMA,WAAW;IAAA,EAAC;EACzC,CAAC;EAAA;AACH,CAAC,CAAC;AAAC,eAEY/D,GAAG;AAAA"}
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":["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;AAEA;AACA;AAEA,IAAAA,iCAAsB,EAAC,KAAK,EAAEC,YAAG,EAAE;EAACC,MAAM,EAANA;AAAM,CAAC,CAAC"}
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","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 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"],"mappings":";;;;;;;AAIA;AAAA,IACYA,kBAAkB;AAAA;AAAA,WAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;AAAA,GAAlBA,kBAAkB,kCAAlBA,kBAAkB;AAiB9B;AAAA,IACYC,UAAU;AAAA;AAAA,WAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;AAAA,GAAVA,UAAU,0BAAVA,UAAU"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/internal-plugin-dss",
3
- "version": "3.0.0-beta.136",
3
+ "version": "3.0.0-beta.138",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": "Colin Read <coread@cisco.com>",
@@ -21,16 +21,16 @@
21
21
  ]
22
22
  },
23
23
  "dependencies": {
24
- "@webex/internal-plugin-mercury": "3.0.0-beta.136",
25
- "@webex/webex-core": "3.0.0-beta.136",
24
+ "@webex/internal-plugin-mercury": "3.0.0-beta.138",
25
+ "@webex/webex-core": "3.0.0-beta.138",
26
26
  "lodash": "^4.17.21",
27
27
  "uuid": "^3.3.2"
28
28
  },
29
29
  "devDependencies": {
30
- "@webex/common": "3.0.0-beta.136",
31
- "@webex/internal-plugin-dss": "3.0.0-beta.136",
32
- "@webex/test-helper-chai": "3.0.0-beta.136",
33
- "@webex/test-helper-mock-webex": "3.0.0-beta.136",
30
+ "@webex/common": "3.0.0-beta.138",
31
+ "@webex/internal-plugin-dss": "3.0.0-beta.138",
32
+ "@webex/test-helper-chai": "3.0.0-beta.138",
33
+ "@webex/test-helper-mock-webex": "3.0.0-beta.138",
34
34
  "sinon": "^9.2.4"
35
35
  }
36
36
  }