@webex/internal-plugin-dss 3.0.0-beta.3 → 3.0.0-beta.300
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 +36 -0
- package/dist/config.js.map +1 -0
- package/dist/constants.js +11 -3
- package/dist/constants.js.map +1 -1
- package/dist/dss-batcher.js +139 -0
- package/dist/dss-batcher.js.map +1 -0
- package/dist/dss-errors.js +50 -0
- package/dist/dss-errors.js.map +1 -0
- package/dist/dss.js +194 -93
- package/dist/dss.js.map +1 -1
- package/dist/index.js +4 -7
- package/dist/index.js.map +1 -1
- package/dist/types.js +1 -5
- package/dist/types.js.map +1 -1
- package/package.json +9 -6
- package/src/config.ts +31 -0
- package/src/constants.ts +5 -0
- package/src/dss-batcher.ts +129 -0
- package/src/dss-errors.ts +36 -0
- package/src/dss.ts +211 -52
- package/src/index.ts +2 -1
- package/src/types.ts +36 -9
- package/test/unit/spec/dss-batcher.ts +139 -0
- package/test/unit/spec/dss.ts +1082 -172
package/dist/dss.js
CHANGED
|
@@ -1,54 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$keys2 = require("@babel/runtime-corejs2/core-js/object/keys");
|
|
4
|
-
|
|
5
4
|
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
|
|
6
|
-
|
|
7
5
|
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
|
|
8
|
-
|
|
9
6
|
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
|
|
10
|
-
|
|
11
7
|
var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
|
|
12
|
-
|
|
13
8
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
14
|
-
|
|
15
9
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
16
|
-
|
|
17
10
|
_Object$defineProperty(exports, "__esModule", {
|
|
18
11
|
value: true
|
|
19
12
|
});
|
|
20
|
-
|
|
21
13
|
exports.default = void 0;
|
|
22
|
-
|
|
14
|
+
var _apply = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/apply"));
|
|
23
15
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
24
|
-
|
|
25
16
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
|
|
26
|
-
|
|
27
17
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
28
|
-
|
|
29
18
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
|
|
30
|
-
|
|
31
19
|
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
32
|
-
|
|
33
20
|
var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
|
|
34
|
-
|
|
35
21
|
var _range2 = _interopRequireDefault(require("lodash/range"));
|
|
36
|
-
|
|
37
22
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
38
|
-
|
|
39
23
|
var _webexCore = require("@webex/webex-core");
|
|
40
|
-
|
|
41
24
|
require("@webex/internal-plugin-mercury");
|
|
42
|
-
|
|
25
|
+
var _commonTimers = require("@webex/common-timers");
|
|
43
26
|
var _constants = require("./constants");
|
|
44
|
-
|
|
27
|
+
var _dssBatcher = _interopRequireDefault(require("./dss-batcher"));
|
|
28
|
+
var _dssErrors = require("./dss-errors");
|
|
45
29
|
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; }
|
|
46
|
-
|
|
47
30
|
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; }
|
|
48
|
-
|
|
49
31
|
var DSS = _webexCore.WebexPlugin.extend({
|
|
50
32
|
namespace: 'DSS',
|
|
51
|
-
|
|
52
33
|
/**
|
|
53
34
|
* registered value indicating events registration is successful
|
|
54
35
|
* @instance
|
|
@@ -56,7 +37,20 @@ var DSS = _webexCore.WebexPlugin.extend({
|
|
|
56
37
|
* @memberof DSS
|
|
57
38
|
*/
|
|
58
39
|
registered: false,
|
|
59
|
-
|
|
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
|
+
},
|
|
60
54
|
/**
|
|
61
55
|
* Explicitly sets up the DSS plugin by connecting to mercury, and listening for DSS events.
|
|
62
56
|
* @returns {Promise}
|
|
@@ -65,30 +59,23 @@ var DSS = _webexCore.WebexPlugin.extend({
|
|
|
65
59
|
*/
|
|
66
60
|
register: function register() {
|
|
67
61
|
var _this = this;
|
|
68
|
-
|
|
69
62
|
if (!this.webex.canAuthorize) {
|
|
70
63
|
this.logger.error('DSS->register#ERROR, Unable to register, SDK cannot authorize');
|
|
71
64
|
return _promise.default.reject(new Error('SDK cannot authorize'));
|
|
72
65
|
}
|
|
73
|
-
|
|
74
66
|
if (this.registered) {
|
|
75
67
|
this.logger.info('dss->register#INFO, DSS plugin already registered');
|
|
76
68
|
return _promise.default.resolve();
|
|
77
69
|
}
|
|
78
|
-
|
|
79
70
|
return this.webex.internal.mercury.connect().then(function () {
|
|
80
71
|
_this.listenForEvents();
|
|
81
|
-
|
|
82
72
|
_this.trigger(_constants.DSS_REGISTERED);
|
|
83
|
-
|
|
84
73
|
_this.registered = true;
|
|
85
74
|
}).catch(function (error) {
|
|
86
75
|
_this.logger.error("DSS->register#ERROR, Unable to register, ".concat(error.message));
|
|
87
|
-
|
|
88
76
|
return _promise.default.reject(error);
|
|
89
77
|
});
|
|
90
78
|
},
|
|
91
|
-
|
|
92
79
|
/**
|
|
93
80
|
* Explicitly tears down the DSS plugin by disconnecting from mercury, and stops listening to DSS events
|
|
94
81
|
* @returns {Promise}
|
|
@@ -97,20 +84,16 @@ var DSS = _webexCore.WebexPlugin.extend({
|
|
|
97
84
|
*/
|
|
98
85
|
unregister: function unregister() {
|
|
99
86
|
var _this2 = this;
|
|
100
|
-
|
|
101
87
|
if (!this.registered) {
|
|
102
88
|
this.logger.info('DSS->unregister#INFO, DSS plugin already unregistered');
|
|
103
89
|
return _promise.default.resolve();
|
|
104
90
|
}
|
|
105
|
-
|
|
106
91
|
this.stopListeningForEvents();
|
|
107
92
|
return this.webex.internal.mercury.disconnect().then(function () {
|
|
108
93
|
_this2.trigger(_constants.DSS_UNREGISTERED);
|
|
109
|
-
|
|
110
94
|
_this2.registered = false;
|
|
111
95
|
});
|
|
112
96
|
},
|
|
113
|
-
|
|
114
97
|
/**
|
|
115
98
|
* registers for DSS events through mercury
|
|
116
99
|
* @returns {undefined}
|
|
@@ -118,7 +101,6 @@ var DSS = _webexCore.WebexPlugin.extend({
|
|
|
118
101
|
*/
|
|
119
102
|
listenForEvents: function listenForEvents() {
|
|
120
103
|
var _this3 = this;
|
|
121
|
-
|
|
122
104
|
this.webex.internal.mercury.on(_constants.DSS_LOOKUP_MERCURY_EVENT, function (envelope) {
|
|
123
105
|
_this3._handleEvent(envelope.data);
|
|
124
106
|
});
|
|
@@ -126,7 +108,6 @@ var DSS = _webexCore.WebexPlugin.extend({
|
|
|
126
108
|
_this3._handleEvent(envelope.data);
|
|
127
109
|
});
|
|
128
110
|
},
|
|
129
|
-
|
|
130
111
|
/**
|
|
131
112
|
* unregisteres all the DSS events from mercury
|
|
132
113
|
* @returns {undefined}
|
|
@@ -136,16 +117,16 @@ var DSS = _webexCore.WebexPlugin.extend({
|
|
|
136
117
|
this.webex.internal.mercury.off(_constants.DSS_LOOKUP_MERCURY_EVENT);
|
|
137
118
|
this.webex.internal.mercury.off(_constants.DSS_SEARCH_MERCURY_EVENT);
|
|
138
119
|
},
|
|
139
|
-
|
|
140
120
|
/**
|
|
121
|
+
* constructs the event name based on request id
|
|
141
122
|
* @param {UUID} requestId the id of the request
|
|
142
123
|
* @returns {string}
|
|
143
124
|
*/
|
|
144
125
|
_getResultEventName: function _getResultEventName(requestId) {
|
|
145
126
|
return "".concat(_constants.DSS_RESULT).concat(requestId);
|
|
146
127
|
},
|
|
147
|
-
|
|
148
128
|
/**
|
|
129
|
+
* Takes incoming data and triggers correct events
|
|
149
130
|
* @param {Object} data the event data
|
|
150
131
|
* @returns {undefined}
|
|
151
132
|
*/
|
|
@@ -153,54 +134,89 @@ var DSS = _webexCore.WebexPlugin.extend({
|
|
|
153
134
|
this.trigger(this._getResultEventName(data.requestId), data);
|
|
154
135
|
this.trigger(_constants.DSS_LOOKUP_RESULT, data);
|
|
155
136
|
},
|
|
156
|
-
|
|
157
137
|
/**
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
138
|
+
* Makes the request to the directory service
|
|
139
|
+
* @param {Object} options
|
|
140
|
+
* @param {string} options.resource the URL to query
|
|
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
|
|
150
|
+
*/
|
|
165
151
|
_request: function _request(options) {
|
|
166
152
|
var _this4 = this;
|
|
167
|
-
|
|
168
153
|
var resource = options.resource,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
154
|
+
params = options.params,
|
|
155
|
+
dataPath = options.dataPath,
|
|
156
|
+
foundPath = options.foundPath,
|
|
157
|
+
notFoundPath = options.notFoundPath;
|
|
158
|
+
var timeout = this.config.requestTimeout;
|
|
172
159
|
var requestId = _uuid.default.v4();
|
|
173
|
-
|
|
174
160
|
var eventName = this._getResultEventName(requestId);
|
|
175
|
-
|
|
176
161
|
var result = {};
|
|
177
162
|
var expectedSeqNums;
|
|
178
|
-
|
|
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);
|
|
179
174
|
_this4.listenTo(_this4, eventName, function (data) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
175
|
+
timer.reset();
|
|
176
|
+
var resultData = (0, _get2.default)(data, dataPath, []);
|
|
177
|
+
var found;
|
|
178
|
+
if (foundPath) {
|
|
179
|
+
found = (0, _get2.default)(data, foundPath, []);
|
|
180
|
+
}
|
|
181
|
+
result[data.sequence] = foundPath ? {
|
|
182
|
+
resultData: resultData,
|
|
183
|
+
found: found
|
|
184
|
+
} : {
|
|
185
|
+
resultData: resultData
|
|
186
|
+
};
|
|
183
187
|
if (data.finished) {
|
|
184
188
|
expectedSeqNums = (0, _range2.default)(data.sequence + 1).map(String);
|
|
189
|
+
if (notFoundPath) {
|
|
190
|
+
notFoundArray = (0, _get2.default)(data, notFoundPath, []);
|
|
191
|
+
}
|
|
185
192
|
}
|
|
186
|
-
|
|
187
193
|
var done = (0, _isEqual2.default)(expectedSeqNums, (0, _keys.default)(result));
|
|
188
|
-
|
|
189
194
|
if (done) {
|
|
195
|
+
timer.cancel();
|
|
190
196
|
var resultArray = [];
|
|
197
|
+
var foundArray = [];
|
|
191
198
|
expectedSeqNums.forEach(function (index) {
|
|
192
199
|
var seqResult = result[index];
|
|
193
|
-
|
|
194
200
|
if (seqResult) {
|
|
195
|
-
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
|
+
}
|
|
196
205
|
}
|
|
197
206
|
});
|
|
198
|
-
|
|
199
|
-
|
|
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);
|
|
200
217
|
_this4.stopListening(_this4, eventName);
|
|
201
218
|
}
|
|
202
219
|
});
|
|
203
|
-
|
|
204
220
|
_this4.webex.request({
|
|
205
221
|
service: _constants.DSS_SERVICE_NAME,
|
|
206
222
|
resource: resource,
|
|
@@ -210,60 +226,117 @@ var DSS = _webexCore.WebexPlugin.extend({
|
|
|
210
226
|
requestId: requestId
|
|
211
227
|
}, params)
|
|
212
228
|
});
|
|
229
|
+
timer.start();
|
|
213
230
|
});
|
|
214
231
|
},
|
|
215
|
-
|
|
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
|
+
},
|
|
216
257
|
/**
|
|
217
258
|
* Retrieves detailed information about an entity
|
|
218
259
|
* @param {Object} options
|
|
219
260
|
* @param {UUID} options.id the id of the entity to lookup
|
|
220
|
-
* @returns {Promise} Resolves with
|
|
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
|
|
221
263
|
*/
|
|
222
264
|
lookupDetail: function lookupDetail(options) {
|
|
223
265
|
var id = options.id;
|
|
266
|
+
var resource = "/lookup/orgid/".concat(this.webex.internal.device.orgId, "/identity/").concat(id, "/detail");
|
|
224
267
|
return this._request({
|
|
225
|
-
dataPath:
|
|
226
|
-
|
|
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;
|
|
227
279
|
});
|
|
228
280
|
},
|
|
229
|
-
|
|
230
281
|
/**
|
|
231
|
-
* Retrieves basic information about
|
|
282
|
+
* Retrieves basic information about an entity within an organization
|
|
232
283
|
* @param {Object} options
|
|
233
|
-
* @param {UUID} options.
|
|
234
|
-
* @param {UUID} options.entityProviderType the provider to query
|
|
235
|
-
* @
|
|
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
|
|
236
289
|
*/
|
|
237
290
|
lookup: function lookup(options) {
|
|
238
|
-
var
|
|
239
|
-
|
|
291
|
+
var id = options.id,
|
|
292
|
+
entityProviderType = options.entityProviderType,
|
|
293
|
+
_options$shouldBatch = options.shouldBatch,
|
|
294
|
+
shouldBatch = _options$shouldBatch === void 0 ? true : _options$shouldBatch;
|
|
240
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
|
+
}
|
|
241
302
|
return this._request({
|
|
242
|
-
dataPath:
|
|
303
|
+
dataPath: _constants.LOOKUP_DATA_PATH,
|
|
304
|
+
foundPath: _constants.LOOKUP_FOUND_PATH,
|
|
243
305
|
resource: resource,
|
|
244
|
-
params: {
|
|
245
|
-
|
|
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];
|
|
246
312
|
}
|
|
313
|
+
return null;
|
|
247
314
|
});
|
|
248
315
|
},
|
|
249
|
-
|
|
250
316
|
/**
|
|
251
|
-
* Retrieves basic information about
|
|
317
|
+
* Retrieves basic information about an enitity within an organization
|
|
252
318
|
* @param {Object} options
|
|
253
|
-
* @param {UUID} options.
|
|
254
|
-
* @returns {Promise} Resolves with
|
|
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
|
|
255
322
|
*/
|
|
256
323
|
lookupByEmail: function lookupByEmail(options) {
|
|
257
|
-
var
|
|
324
|
+
var email = options.email;
|
|
325
|
+
var resource = "/lookup/orgid/".concat(this.webex.internal.device.orgId, "/emails");
|
|
258
326
|
return this._request({
|
|
259
|
-
dataPath:
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
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];
|
|
263
336
|
}
|
|
337
|
+
return null;
|
|
264
338
|
});
|
|
265
339
|
},
|
|
266
|
-
|
|
267
340
|
/**
|
|
268
341
|
* Search for information about entities
|
|
269
342
|
* @param {Object} options
|
|
@@ -271,24 +344,52 @@ var DSS = _webexCore.WebexPlugin.extend({
|
|
|
271
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
|
|
272
345
|
* @param {number} options.resultSize The maximum number of results returned from each provider
|
|
273
346
|
* @returns {Promise} Resolves with an array of entities found
|
|
347
|
+
* @throws {DssTimeoutError} when server does not respond in the specified timeframe
|
|
274
348
|
*/
|
|
275
349
|
search: function search(options) {
|
|
276
350
|
var requestedTypes = options.requestedTypes,
|
|
277
|
-
|
|
278
|
-
|
|
351
|
+
resultSize = options.resultSize,
|
|
352
|
+
queryString = options.queryString;
|
|
279
353
|
return this._request({
|
|
280
|
-
dataPath:
|
|
354
|
+
dataPath: _constants.SEARCH_DATA_PATH,
|
|
281
355
|
resource: "/search/orgid/".concat(this.webex.internal.device.orgId, "/entities"),
|
|
282
356
|
params: {
|
|
283
357
|
queryString: queryString,
|
|
284
358
|
resultSize: resultSize,
|
|
285
359
|
requestedTypes: requestedTypes
|
|
286
360
|
}
|
|
361
|
+
}).then(function (_ref4) {
|
|
362
|
+
var resultArray = _ref4.resultArray;
|
|
363
|
+
return resultArray;
|
|
287
364
|
});
|
|
288
365
|
},
|
|
289
|
-
|
|
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);
|
|
389
|
+
});
|
|
390
|
+
},
|
|
391
|
+
version: "3.0.0-beta.300"
|
|
290
392
|
});
|
|
291
|
-
|
|
292
393
|
var _default = DSS;
|
|
293
394
|
exports.default = _default;
|
|
294
395
|
//# 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 {SearchOptions, LookupDetailOptions, LookupOptions, LookupByEmailOptions} from './types';\n\nimport {\n DSS_REGISTERED,\n DSS_UNREGISTERED,\n DSS_LOOKUP_MERCURY_EVENT,\n DSS_LOOKUP_RESULT,\n DSS_SERVICE_NAME,\n DSS_SEARCH_MERCURY_EVENT,\n DSS_RESULT,\n} from './constants';\n\nconst DSS = WebexPlugin.extend({\n namespace: 'DSS',\n\n /**\n * registered value indicating events registration is successful\n * @instance\n * @type {Boolean}\n * @memberof DSS\n */\n registered: false,\n\n /**\n * Explicitly sets up the DSS plugin by connecting to mercury, and listening for DSS events.\n * @returns {Promise}\n * @public\n * @memberof DSS\n */\n register() {\n if (!this.webex.canAuthorize) {\n this.logger.error('DSS->register#ERROR, Unable to register, SDK cannot authorize');\n\n return Promise.reject(new Error('SDK cannot authorize'));\n }\n\n if (this.registered) {\n this.logger.info('dss->register#INFO, DSS plugin already registered');\n\n return Promise.resolve();\n }\n\n return this.webex.internal.mercury.connect()\n .then(() => {\n this.listenForEvents();\n this.trigger(DSS_REGISTERED);\n this.registered = true;\n })\n .catch((error) => {\n this.logger.error(`DSS->register#ERROR, Unable to register, ${error.message}`);\n\n return Promise.reject(error);\n });\n },\n\n /**\n * Explicitly tears down the DSS plugin by disconnecting from mercury, and stops listening to DSS events\n * @returns {Promise}\n * @public\n * @memberof DSS\n */\n unregister() {\n if (!this.registered) {\n this.logger.info('DSS->unregister#INFO, DSS plugin already unregistered');\n\n return Promise.resolve();\n }\n\n this.stopListeningForEvents();\n\n return this.webex.internal.mercury.disconnect()\n .then(() => {\n this.trigger(DSS_UNREGISTERED);\n this.registered = false;\n });\n },\n\n /**\n * registers for DSS events through mercury\n * @returns {undefined}\n * @private\n */\n listenForEvents() {\n this.webex.internal.mercury.on(DSS_LOOKUP_MERCURY_EVENT, (envelope) => {\n this._handleEvent(envelope.data);\n });\n this.webex.internal.mercury.on(DSS_SEARCH_MERCURY_EVENT, (envelope) => {\n this._handleEvent(envelope.data);\n });\n },\n\n /**\n * unregisteres all the DSS events from mercury\n * @returns {undefined}\n * @private\n */\n stopListeningForEvents() {\n this.webex.internal.mercury.off(DSS_LOOKUP_MERCURY_EVENT);\n this.webex.internal.mercury.off(DSS_SEARCH_MERCURY_EVENT);\n },\n\n /**\n * @param {UUID} requestId the id of the request\n * @returns {string}\n */\n _getResultEventName(requestId) {\n return `${DSS_RESULT}${requestId}`;\n },\n\n /**\n * @param {Object} data the event data\n * @returns {undefined}\n */\n _handleEvent(data) {\n this.trigger(this._getResultEventName(data.requestId), data);\n this.trigger(DSS_LOOKUP_RESULT, data);\n },\n\n /**\n * Makes the request to the directory service\n * @param {Object} options\n * @param {string} options.resource the URL to query\n * @param {string} options.params additional params for the body of the request\n * @param {string} options.dataPath to path to get the data in the result object\n * @returns {Promise} Resolves with an array of entities found\n */\n _request(options) {\n const {resource, params, dataPath} = options;\n\n const requestId = uuid.v4();\n const eventName = this._getResultEventName(requestId);\n const result = {};\n let expectedSeqNums;\n\n return new Promise((resolve) => {\n this.listenTo(this, eventName, (data) => {\n const resultData = get(data, dataPath);\n\n result[data.sequence] = resultData;\n\n if (data.finished) {\n expectedSeqNums = range(data.sequence + 1).map(String);\n }\n\n const done = isEqual(expectedSeqNums, Object.keys(result));\n\n if (done) {\n const resultArray = [];\n expectedSeqNums.forEach((index) => {\n const seqResult = result[index];\n if (seqResult) {\n resultArray.push(...seqResult);\n }\n })\n\n resolve(resultArray);\n this.stopListening(this, eventName);\n }\n });\n this.webex.request({\n service: DSS_SERVICE_NAME,\n resource,\n method: 'POST',\n contentType: 'application/json',\n body: {requestId, ...params}\n });\n });\n },\n\n /**\n * Retrieves detailed information about an entity\n * @param {Object} options\n * @param {UUID} options.id the id of the entity to lookup\n * @returns {Promise} Resolves with an array of entities found\n */\n lookupDetail(options: LookupDetailOptions) {\n const {id} = options;\n\n return this._request({\n dataPath: 'lookupResult.entities',\n resource: `/lookup/orgid/${this.webex.internal.device.orgId}/identity/${id}/detail`\n });\n },\n\n /**\n * Retrieves basic information about a list entities within an organization\n * @param {Object} options\n * @param {UUID} options.ids the id of the entity to lookup\n * @param {UUID} options.entityProviderType the provider to query (optional)\n * @returns {Promise} Resolves with an array of entities found\n */\n lookup(options: LookupOptions) {\n const {ids, entityProviderType} = options;\n\n const resource = entityProviderType ? `/lookup/orgid/${this.webex.internal.device.orgId}/entityprovidertype/${entityProviderType}` : `/lookup/orgid/${this.webex.internal.device.orgId}/identities`;\n\n return this._request({\n dataPath: 'lookupResult.entities',\n resource,\n params: {\n lookupValues: ids,\n }\n });\n },\n\n /**\n * Retrieves basic information about a list entities within an organization\n * @param {Object} options\n * @param {UUID} options.emails the emails of the entities to lookup\n * @returns {Promise} Resolves with an array of entities found\n */\n lookupByEmail(options: LookupByEmailOptions) {\n const {emails} = options;\n\n return this._request({\n dataPath: 'lookupResult.entities',\n resource: `/lookup/orgid/${this.webex.internal.device.orgId}/emails`,\n params: {\n lookupValues: emails,\n }\n });\n },\n\n /**\n * Search for information about entities\n * @param {Object} options\n * @param {SearchType[]} options.requestedTypes an array of search types from: PERSON, CALLING_SERVICE, EXTERNAL_CALLING, ROOM, ROBOT\n * @param {string[]} options.queryString A query string that will be transformed into a Directory search filter query. It is used to search the following fields: username, givenName, familyName, displayName and email\n * @param {number} options.resultSize The maximum number of results returned from each provider\n * @returns {Promise} Resolves with an array of entities found\n */\n search(options: SearchOptions) {\n const {\n requestedTypes, resultSize, queryString\n } = options;\n\n return this._request({\n dataPath: 'directoryEntities',\n resource: `/search/orgid/${this.webex.internal.device.orgId}/entities`,\n params: {\n queryString,\n resultSize,\n requestedTypes\n }\n });\n }\n\n});\n\nexport default DSS;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;;AACA;;AACA;;AAIA;;;;;;AAUA,IAAMA,GAAG,GAAGC,sBAAA,CAAYC,MAAZ,CAAmB;EAC7BC,SAAS,EAAE,KADkB;;EAG7B;AACF;AACA;AACA;AACA;AACA;EACEC,UAAU,EAAE,KATiB;;EAW7B;AACF;AACA;AACA;AACA;AACA;EACEC,QAjB6B,sBAiBlB;IAAA;;IACT,IAAI,CAAC,KAAKC,KAAL,CAAWC,YAAhB,EAA8B;MAC5B,KAAKC,MAAL,CAAYC,KAAZ,CAAkB,+DAAlB;MAEA,OAAO,iBAAQC,MAAR,CAAe,IAAIC,KAAJ,CAAU,sBAAV,CAAf,CAAP;IACD;;IAED,IAAI,KAAKP,UAAT,EAAqB;MACnB,KAAKI,MAAL,CAAYI,IAAZ,CAAiB,mDAAjB;MAEA,OAAO,iBAAQC,OAAR,EAAP;IACD;;IAED,OAAO,KAAKP,KAAL,CAAWQ,QAAX,CAAoBC,OAApB,CAA4BC,OAA5B,GACJC,IADI,CACC,YAAM;MACV,KAAI,CAACC,eAAL;;MACA,KAAI,CAACC,OAAL,CAAaC,yBAAb;;MACA,KAAI,CAAChB,UAAL,GAAkB,IAAlB;IACD,CALI,EAMJiB,KANI,CAME,UAACZ,KAAD,EAAW;MAChB,KAAI,CAACD,MAAL,CAAYC,KAAZ,oDAA8DA,KAAK,CAACa,OAApE;;MAEA,OAAO,iBAAQZ,MAAR,CAAeD,KAAf,CAAP;IACD,CAVI,CAAP;EAWD,CAzC4B;;EA2C7B;AACF;AACA;AACA;AACA;AACA;EACEc,UAjD6B,wBAiDhB;IAAA;;IACX,IAAI,CAAC,KAAKnB,UAAV,EAAsB;MACpB,KAAKI,MAAL,CAAYI,IAAZ,CAAiB,uDAAjB;MAEA,OAAO,iBAAQC,OA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AiBrC,OAAjB,CAAOqC,MAAP;IAEA,OAAO,KAAKtC,QAAL,CAAc;MACnBI,QAAQ,EAAE,uBADS;MAEnBF,QAAQ,0BAAmB,KAAKlC,KAAL,CAAWQ,QAAX,CAAoBuD,MAApB,CAA2BC,KAA9C,YAFW;MAGnB7B,MAAM,EAAE;QACNiC,YAAY,EAAEE;MADR;IAHW,CAAd,CAAP;EAOD,CAjN4B;;EAmN7B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,MA3N6B,kBA2NtBtC,OA3NsB,EA2NE;IAC7B,IACEuC,cADF,GAEIvC,OAFJ,CACEuC,cADF;IAAA,IACkBC,UADlB,GAEIxC,OAFJ,CACkBwC,UADlB;IAAA,IAC8BC,WAD9B,GAEIzC,OAFJ,CAC8ByC,WAD9B;IAIA,OAAO,KAAK1C,QAAL,CAAc;MACnBI,QAAQ,EAAE,mBADS;MAEnBF,QAAQ,0BAAmB,KAAKlC,KAAL,CAAWQ,QAAX,CAAoBuD,MAApB,CAA2BC,KAA9C,cAFW;MAGnB7B,MAAM,EAAE;QACNuC,WAAW,EAAXA,WADM;QAEND,UAAU,EAAVA,UAFM;QAGND,cAAc,EAAdA;MAHM;IAHW,CAAd,CAAP;EASD,CAzO4B;EAAA;AAAA,CAAnB,CAAZ;;eA6Oe9E,G"}
|
|
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","timeout","config","requestTimeout","uuid","v4","eventName","result","expectedSeqNums","notFoundArray","timer","Timer","stopListening","DssTimeoutError","listenTo","reset","resultData","found","sequence","finished","map","String","done","cancel","resultArray","foundArray","forEach","index","seqResult","push","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","lookup","entityProviderType","shouldBatch","lookupByEmail","email","search","requestedTypes","resultSize","queryString","SEARCH_DATA_PATH","searchPlaces","isOnlySchedulableRooms"],"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;AACA;AACA;AAGA;AAQA;AAcA;AACA;AAA6C;AAAA;AAG7C,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;MAElF,OAAO,iBAAQC,MAAM,CAAC,IAAIC,KAAK,CAAC,s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AACtE,QAAQ,CAAC;MACnBI,QAAQ,EAAE,mBAAmB;MAC7BF,QAAQ,0BAAmB,IAAI,CAAClC,KAAK,CAACQ,QAAQ,CAACiF,MAAM,CAACC,KAAK,YAAS;MACpEvD,MAAM,EAAE;QACNgE,WAAW,EAAXA,WAAW;QACXD,UAAU,EAAVA,UAAU;QACVI,sBAAsB,EAAtBA;MACF;IACF,CAAC,CAAC,CAACvF,KAAK,CAAC,UAACZ,KAAK,EAAK;MAClB,MAAI,CAACD,MAAM,CAACC,KAAK,0DAAmDA,KAAK,CAACa,OAAO,EAAG;MAEpF,OAAO,iBAAQZ,MAAM,CAACD,KAAK,CAAC;IAC9B,CAAC,CAAC;EACJ,CAAC;EAAA;AACH,CAAC,CAAC;AAAC,eAEYb,GAAG;AAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
_Object$defineProperty(exports, "default", {
|
|
12
9
|
enumerable: true,
|
|
13
10
|
get: function get() {
|
|
14
11
|
return _dss.default;
|
|
15
12
|
}
|
|
16
13
|
});
|
|
17
|
-
|
|
18
14
|
var _webexCore = require("@webex/webex-core");
|
|
19
|
-
|
|
20
15
|
var _dss = _interopRequireDefault(require("./dss"));
|
|
21
|
-
|
|
22
|
-
(0, _webexCore.registerInternalPlugin)('dss', _dss.default
|
|
16
|
+
var _config = _interopRequireDefault(require("./config"));
|
|
17
|
+
(0, _webexCore.registerInternalPlugin)('dss', _dss.default, {
|
|
18
|
+
config: _config.default
|
|
19
|
+
});
|
|
23
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":"
|
|
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
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
|
|
9
7
|
exports.SearchType = exports.EntityProviderType = void 0;
|
|
10
8
|
var EntityProviderType;
|
|
11
9
|
exports.EntityProviderType = EntityProviderType;
|
|
12
|
-
|
|
13
10
|
(function (EntityProviderType) {
|
|
14
11
|
EntityProviderType["CI_USER"] = "CI_USER";
|
|
15
12
|
EntityProviderType["CI_MACHINE"] = "CI_MACHINE";
|
|
16
13
|
EntityProviderType["CONTACTS"] = "CONTACTS";
|
|
17
14
|
EntityProviderType["CSDM"] = "CSDM";
|
|
18
15
|
})(EntityProviderType || (exports.EntityProviderType = EntityProviderType = {}));
|
|
19
|
-
|
|
16
|
+
// eslint-disable-next-line no-shadow
|
|
20
17
|
var SearchType;
|
|
21
18
|
exports.SearchType = SearchType;
|
|
22
|
-
|
|
23
19
|
(function (SearchType) {
|
|
24
20
|
SearchType["PERSON"] = "PERSON";
|
|
25
21
|
SearchType["CALLING_SERVICE"] = "CALLING_SERVICE";
|
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\nexport enum EntityProviderType {\n CI_USER = 'CI_USER',\n CI_MACHINE ='CI_MACHINE',\n CONTACTS = 'CONTACTS',\n CSDM = 'CSDM'
|
|
1
|
+
{"version":3,"names":["EntityProviderType","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;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"}
|