@webex/test-users 3.0.0-beta.15 → 3.0.0-beta.16
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/index.js +9 -61
- package/dist/index.js.map +1 -1
- package/dist/whistler.js +11 -34
- package/dist/whistler.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,76 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _typeof = require("@babel/runtime-corejs2/helpers/typeof");
|
|
4
|
-
|
|
5
4
|
var _Object$keys = require("@babel/runtime-corejs2/core-js/object/keys");
|
|
6
|
-
|
|
7
5
|
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
|
|
8
|
-
|
|
9
6
|
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
|
|
10
|
-
|
|
11
7
|
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
|
|
12
|
-
|
|
13
8
|
var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
|
|
14
|
-
|
|
15
9
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
16
|
-
|
|
17
10
|
var _WeakMap = require("@babel/runtime-corejs2/core-js/weak-map");
|
|
18
|
-
|
|
19
11
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
20
|
-
|
|
21
12
|
_Object$defineProperty(exports, "__esModule", {
|
|
22
13
|
value: true
|
|
23
14
|
});
|
|
24
|
-
|
|
25
15
|
exports.createTestUser = createTestUser;
|
|
26
|
-
|
|
27
16
|
_Object$defineProperty(exports, "createWhistlerTestUser", {
|
|
28
17
|
enumerable: true,
|
|
29
18
|
get: function get() {
|
|
30
19
|
return _whistler.default;
|
|
31
20
|
}
|
|
32
21
|
});
|
|
33
|
-
|
|
34
22
|
exports.loginTestUser = loginTestUser;
|
|
35
23
|
exports.removeTestUser = removeTestUser;
|
|
36
|
-
|
|
37
24
|
_Object$defineProperty(exports, "removeWhistlerTestUser", {
|
|
38
25
|
enumerable: true,
|
|
39
26
|
get: function get() {
|
|
40
27
|
return _whistler.removeTestUser;
|
|
41
28
|
}
|
|
42
29
|
});
|
|
43
|
-
|
|
44
30
|
var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/now"));
|
|
45
|
-
|
|
46
31
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
47
|
-
|
|
48
32
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
49
|
-
|
|
50
33
|
var _defaultsDeep2 = _interopRequireDefault(require("lodash/defaultsDeep"));
|
|
51
|
-
|
|
52
34
|
var _assert = _interopRequireDefault(require("assert"));
|
|
53
|
-
|
|
54
35
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
55
|
-
|
|
56
36
|
var _btoa = _interopRequireDefault(require("btoa"));
|
|
57
|
-
|
|
58
37
|
var _nodeRandomName = _interopRequireDefault(require("node-random-name"));
|
|
59
|
-
|
|
60
38
|
var _httpCore = require("@webex/http-core");
|
|
61
|
-
|
|
62
39
|
var _whistler = _interopRequireWildcard(require("./whistler"));
|
|
63
|
-
|
|
64
40
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
65
|
-
|
|
66
41
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
67
|
-
|
|
68
42
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(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; }
|
|
69
|
-
|
|
70
43
|
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; }
|
|
71
|
-
|
|
72
44
|
var BASE_PATH_SECURE = '/users/test_users_s';
|
|
73
45
|
var BASE_PATH = '/users/test_users';
|
|
46
|
+
|
|
74
47
|
/**
|
|
75
48
|
* Computes `expires` and `refresh_token_expires` from `expires_in` and
|
|
76
49
|
* `refresh_token_expires_in` and creates an `authorization` string.
|
|
@@ -78,27 +51,22 @@ var BASE_PATH = '/users/test_users';
|
|
|
78
51
|
* @private
|
|
79
52
|
* @returns {Object}
|
|
80
53
|
*/
|
|
81
|
-
|
|
82
54
|
function fixToken(token) {
|
|
83
55
|
var now = (0, _now.default)();
|
|
84
|
-
|
|
85
56
|
if (token.expires_in && !token.expires) {
|
|
86
57
|
token.expires = now + token.expires_in * 1000;
|
|
87
58
|
}
|
|
88
|
-
|
|
89
59
|
if (token.refresh_token_expires_in && !token.refresh_token_expires) {
|
|
90
60
|
/* eslint camelcase: [0] */
|
|
91
61
|
token.refresh_token_expires = now + token.refresh_token_expires_in * 1000;
|
|
92
62
|
}
|
|
93
|
-
|
|
94
63
|
if (token.token_type && token.access_token) {
|
|
95
64
|
token.authorization = "".concat(token.token_type, " ").concat(token.access_token);
|
|
96
65
|
}
|
|
97
|
-
|
|
98
66
|
return token;
|
|
99
67
|
}
|
|
100
|
-
|
|
101
68
|
var clientToken;
|
|
69
|
+
|
|
102
70
|
/**
|
|
103
71
|
* Fetches credentials to talk to the test_users_s endpoint
|
|
104
72
|
*
|
|
@@ -110,16 +78,13 @@ var clientToken;
|
|
|
110
78
|
* @private
|
|
111
79
|
* @returns {String}
|
|
112
80
|
*/
|
|
113
|
-
|
|
114
81
|
function getClientCredentials(_ref) {
|
|
115
82
|
var clientId = _ref.clientId,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
83
|
+
clientSecret = _ref.clientSecret,
|
|
84
|
+
idbrokerUrl = _ref.idbrokerUrl;
|
|
119
85
|
if (clientToken) {
|
|
120
86
|
return _promise.default.resolve(clientToken);
|
|
121
87
|
}
|
|
122
|
-
|
|
123
88
|
return (0, _httpCore.request)({
|
|
124
89
|
method: 'POST',
|
|
125
90
|
uri: "".concat(idbrokerUrl, "/idb/oauth2/v1/access_token"),
|
|
@@ -144,6 +109,7 @@ function getClientCredentials(_ref) {
|
|
|
144
109
|
return clientToken;
|
|
145
110
|
});
|
|
146
111
|
}
|
|
112
|
+
|
|
147
113
|
/**
|
|
148
114
|
* Makes a request authorized with client credentials
|
|
149
115
|
* @param {Object} options
|
|
@@ -154,8 +120,6 @@ function getClientCredentials(_ref) {
|
|
|
154
120
|
* @private
|
|
155
121
|
* @returns {Promise<HttpResponseObject>}
|
|
156
122
|
*/
|
|
157
|
-
|
|
158
|
-
|
|
159
123
|
function requestWithAuth(options) {
|
|
160
124
|
return getClientCredentials(options.body).then(function (authorization) {
|
|
161
125
|
options.headers = options.headers || {};
|
|
@@ -163,6 +127,7 @@ function requestWithAuth(options) {
|
|
|
163
127
|
return (0, _httpCore.request)(options);
|
|
164
128
|
});
|
|
165
129
|
}
|
|
130
|
+
|
|
166
131
|
/**
|
|
167
132
|
* @typedef {Object} AccessTokenObject
|
|
168
133
|
* @property {string} token.access_token
|
|
@@ -213,31 +178,24 @@ function requestWithAuth(options) {
|
|
|
213
178
|
* @param {CreateUserOptions} options
|
|
214
179
|
* @returns {Promise.<TestUserObject>}
|
|
215
180
|
*/
|
|
216
|
-
|
|
217
|
-
|
|
218
181
|
function createTestUser() {
|
|
219
182
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
220
183
|
var clientId = options.clientId || process.env.WEBEX_CLIENT_ID;
|
|
221
184
|
var clientSecret = options.clientSecret || process.env.WEBEX_CLIENT_SECRET;
|
|
222
185
|
var idbrokerUrl = options.idbrokerUrl || process.env.IDBROKER_BASE_URL;
|
|
223
186
|
var cigServiceUrl = options.cigServiceUrl || process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL || process.env.WEBEX_TEST_USERS_CONVERSATION_SERVICE_URL;
|
|
224
|
-
|
|
225
187
|
if (!clientId) {
|
|
226
188
|
throw new Error('options.clientId or process.env.WEBEX_CLIENT_ID must be defined');
|
|
227
189
|
}
|
|
228
|
-
|
|
229
190
|
if (!clientSecret) {
|
|
230
191
|
throw new Error('options.clientSecret or process.env.WEBEX_CLIENT_SECRET must be defined');
|
|
231
192
|
}
|
|
232
|
-
|
|
233
193
|
if (!idbrokerUrl) {
|
|
234
194
|
throw new Error('options.idbrokerUrl or process.env.IDBROKER_BASE_URL must be defined');
|
|
235
195
|
}
|
|
236
|
-
|
|
237
196
|
if (!cigServiceUrl) {
|
|
238
197
|
throw new Error('options.cigServiceUrl or process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL must be defined');
|
|
239
198
|
}
|
|
240
|
-
|
|
241
199
|
var body = {
|
|
242
200
|
authCodeOnly: options.authCodeOnly,
|
|
243
201
|
clientId: clientId,
|
|
@@ -269,6 +227,7 @@ function createTestUser() {
|
|
|
269
227
|
});
|
|
270
228
|
});
|
|
271
229
|
}
|
|
230
|
+
|
|
272
231
|
/**
|
|
273
232
|
* Exchanges a user name/password for an access token
|
|
274
233
|
* @param {Object} options
|
|
@@ -280,25 +239,19 @@ function createTestUser() {
|
|
|
280
239
|
* @param {string} options.cigServiceUrl
|
|
281
240
|
* @returns {Promise.<AccessTokenObject>}
|
|
282
241
|
*/
|
|
283
|
-
|
|
284
|
-
|
|
285
242
|
function loginTestUser(options) {
|
|
286
243
|
var clientId = options.clientId || process.env.WEBEX_CLIENT_ID;
|
|
287
244
|
var clientSecret = options.clientSecret || process.env.WEBEX_CLIENT_SECRET;
|
|
288
245
|
var cigServiceUrl = options.cigServiceUrl || process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL || process.env.WEBEX_TEST_USERS_CONVERSATION_SERVICE_URL;
|
|
289
|
-
|
|
290
246
|
if (!clientId) {
|
|
291
247
|
throw new Error('options.clientId or process.env.WEBEX_CLIENT_ID must be defined');
|
|
292
248
|
}
|
|
293
|
-
|
|
294
249
|
if (!clientSecret) {
|
|
295
250
|
throw new Error('options.clientSecret or process.env.WEBEX_CLIENT_SECRET must be defined');
|
|
296
251
|
}
|
|
297
|
-
|
|
298
252
|
if (!cigServiceUrl) {
|
|
299
253
|
throw new Error('options.cigServiceUrl or process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL must be defined');
|
|
300
254
|
}
|
|
301
|
-
|
|
302
255
|
return (0, _httpCore.request)({
|
|
303
256
|
method: 'POST',
|
|
304
257
|
uri: "".concat(cigServiceUrl).concat(BASE_PATH, "/login"),
|
|
@@ -311,6 +264,7 @@ function loginTestUser(options) {
|
|
|
311
264
|
return fixToken(res.body);
|
|
312
265
|
});
|
|
313
266
|
}
|
|
267
|
+
|
|
314
268
|
/**
|
|
315
269
|
* Removes a test user
|
|
316
270
|
* @param {Object} options
|
|
@@ -321,27 +275,21 @@ function loginTestUser(options) {
|
|
|
321
275
|
* @param {string} [options.token.refresh_token]
|
|
322
276
|
* @returns {Promise}
|
|
323
277
|
*/
|
|
324
|
-
|
|
325
|
-
|
|
326
278
|
function removeTestUser() {
|
|
327
279
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
328
280
|
var cigServiceUrl = options.cigServiceUrl || process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL || process.env.WEBEX_TEST_USERS_CONVERSATION_SERVICE_URL;
|
|
329
|
-
|
|
330
281
|
if (!cigServiceUrl) {
|
|
331
282
|
throw new Error('options.cigServiceUrl or process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL must be defined');
|
|
332
283
|
}
|
|
333
|
-
|
|
334
284
|
if (!options.id) {
|
|
335
285
|
return _promise.default.reject(new Error('options.id is required'));
|
|
336
286
|
}
|
|
337
|
-
|
|
338
287
|
if (!options.token) {
|
|
339
288
|
return loginTestUser(options).then(function (token) {
|
|
340
289
|
options.token = token;
|
|
341
290
|
return removeTestUser(options);
|
|
342
291
|
});
|
|
343
292
|
}
|
|
344
|
-
|
|
345
293
|
(0, _assert.default)(options.token.authorization, 'options.token.authorization must be defined');
|
|
346
294
|
return (0, _httpCore.request)({
|
|
347
295
|
method: 'POST',
|
|
@@ -355,8 +303,8 @@ function removeTestUser() {
|
|
|
355
303
|
refresh_token: options.token.refresh_token,
|
|
356
304
|
user_type: options.userType || 'PERSON'
|
|
357
305
|
/* eslint-enable camelcase */
|
|
358
|
-
|
|
359
306
|
},
|
|
307
|
+
|
|
360
308
|
uri: "".concat(cigServiceUrl).concat(BASE_PATH, "/delete")
|
|
361
309
|
});
|
|
362
310
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BASE_PATH_SECURE","BASE_PATH","fixToken","token","now","expires_in","expires","refresh_token_expires_in","refresh_token_expires","token_type","access_token","authorization","clientToken","getClientCredentials","clientId","clientSecret","idbrokerUrl","resolve","request","method","uri","json","form","grant_type","scope","client_id","client_secret","headers","btoa","then","res","body","requestWithAuth","options","createTestUser","process","env","WEBEX_CLIENT_ID","WEBEX_CLIENT_SECRET","IDBROKER_BASE_URL","cigServiceUrl","WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL","WEBEX_TEST_USERS_CONVERSATION_SERVICE_URL","Error","authCodeOnly","displayName","randomName","emailTemplate","emailAddress","entitlements","machineType","orgId","password","uuid","v4","roles","scopes","WEBEX_SCOPE","type","user","email","name","loginTestUser","removeTestUser","id","reject","assert","user_id","refresh_token","user_type","userType"],"sources":["index.js"],"sourcesContent":["import assert from 'assert';\n\nimport uuid from 'uuid';\nimport btoa from 'btoa';\nimport _ from 'lodash';\nimport randomName from 'node-random-name';\nimport {request} from '@webex/http-core';\n\nconst BASE_PATH_SECURE = '/users/test_users_s';\nconst BASE_PATH = '/users/test_users';\n\n/**\n * Computes `expires` and `refresh_token_expires` from `expires_in` and\n * `refresh_token_expires_in` and creates an `authorization` string.\n * @param {Object} token\n * @private\n * @returns {Object}\n */\nfunction fixToken(token) {\n const now = Date.now();\n\n if (token.expires_in && !token.expires) {\n token.expires = now + token.expires_in * 1000;\n }\n\n if (token.refresh_token_expires_in && !token.refresh_token_expires) {\n /* eslint camelcase: [0] */\n token.refresh_token_expires = now + token.refresh_token_expires_in * 1000;\n }\n\n if (token.token_type && token.access_token) {\n token.authorization = `${token.token_type} ${token.access_token}`;\n }\n\n return token;\n}\n\nlet clientToken;\n\n/**\n * Fetches credentials to talk to the test_users_s endpoint\n *\n * Caches result in `clientToken` variable for multiple runs\n * @param {Object} options\n * @param {string} options.clientId\n * @param {string} options.clientSecret\n * @param {string} options.idbrokerUrl\n * @private\n * @returns {String}\n */\nfunction getClientCredentials({clientId, clientSecret, idbrokerUrl}) {\n if (clientToken) {\n return Promise.resolve(clientToken);\n }\n\n return request({\n method: 'POST',\n uri: `${idbrokerUrl}/idb/oauth2/v1/access_token`,\n json: true,\n form: {\n grant_type: 'client_credentials',\n scope: 'Identity:SCIM webexsquare:get_conversation',\n client_id: clientId,\n client_secret: clientSecret,\n },\n headers: {\n // Note: we can't request's auth hash here because this endpoint expects\n // us to send the auth header *without including \"Basic \"* before the\n // token string\n authorization: btoa(`${clientId}:${clientSecret}`),\n },\n })\n .then((res) => {\n const token = fixToken(res.body);\n\n return `${token.token_type} ${token.access_token}`;\n })\n .then((token) => {\n clientToken = token;\n\n return clientToken;\n });\n}\n\n/**\n * Makes a request authorized with client credentials\n * @param {Object} options\n * @param {Object} options.body\n * @param {string} options.body.clientId\n * @param {string} options.body.clientSecret\n * @param {string} options.body.idbrokerUrl\n * @private\n * @returns {Promise<HttpResponseObject>}\n */\nfunction requestWithAuth(options) {\n return getClientCredentials(options.body).then((authorization) => {\n options.headers = options.headers || {};\n options.headers.authorization = authorization;\n\n return request(options);\n });\n}\n\n/**\n * @typedef {Object} AccessTokenObject\n * @property {string} token.access_token\n * @property {Number} token.expires_in\n * @property {string} token.token_type\n * @property {string} token.refresh_token\n * @property {Number} token.refresh_token_expires_in\n * @property {string} token.expires\n * @property {string} token.refresh_token_expires\n */\n\n/**\n * @typedef {Object} CreateUserOptions\n * @property {boolean} [authCodeOnly] generates auth_code\n * @param {string} [clientId] defaults to WEBEX_CLIENT_ID\n * @param {string} [clientSecret] defaults to WEBEX_CLIENT_SECRET\n * @param {string} [cigServiceUrl] defaults to WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL\n * @property {string} [displayName]\n * @property {string} [emailAddress]\n * @property {Array.<string>} [entitlements]\n * @param {string} [idbrokerUrl] defaults to IDBROKER_BASE_URL\n * @property {string} [machineType] used when creating a machine user/device\n * @property {string} [orgId] organization ID to create the user under\n * @property {string} [password] defaults to a random password\n * @property {string} [roles] defaults to []\n * @property {string} [scope] defaults to WEBEX_SCOPE\n * @property {string} [type] used to create a machine\n */\n\n/**\n * @typedef {Object} TestUserObject\n * @property {string} password\n * @property {string} emailAddress\n * @property {string} displayName\n * @property {string} id\n * @property {string} userName\n * @property {string} email\n * @property {string} name\n * @property {string} givenName\n * @property {string} type\n * @property {Array.<string>} entitlements\n * @property {string} orgId\n * @property {AccessTokenObject} token\n */\n\n/**\n * Creates a test user\n * @param {CreateUserOptions} options\n * @returns {Promise.<TestUserObject>}\n */\nexport function createTestUser(options = {}) {\n const clientId = options.clientId || process.env.WEBEX_CLIENT_ID;\n const clientSecret = options.clientSecret || process.env.WEBEX_CLIENT_SECRET;\n const idbrokerUrl = options.idbrokerUrl || process.env.IDBROKER_BASE_URL;\n const cigServiceUrl =\n options.cigServiceUrl ||\n process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL ||\n process.env.WEBEX_TEST_USERS_CONVERSATION_SERVICE_URL;\n\n if (!clientId) {\n throw new Error('options.clientId or process.env.WEBEX_CLIENT_ID must be defined');\n }\n\n if (!clientSecret) {\n throw new Error('options.clientSecret or process.env.WEBEX_CLIENT_SECRET must be defined');\n }\n\n if (!idbrokerUrl) {\n throw new Error('options.idbrokerUrl or process.env.IDBROKER_BASE_URL must be defined');\n }\n\n if (!cigServiceUrl) {\n throw new Error(\n 'options.cigServiceUrl or process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL must be defined'\n );\n }\n\n const body = {\n authCodeOnly: options.authCodeOnly,\n clientId,\n clientSecret,\n displayName: options.displayName || randomName(),\n emailTemplate: options.emailAddress,\n entitlements: options.entitlements || [\n 'spark',\n 'squaredCallInitiation',\n 'squaredRoomModeration',\n 'squaredInviter',\n 'webExSquared',\n ],\n idbrokerUrl,\n machineType: options.machineType,\n orgId: options.orgId,\n // The five characters on the end are to hit all the password requirements\n password: options.password || `${uuid.v4()}zAY1*`,\n roles: options.roles || [],\n scopes: options.scope || process.env.WEBEX_SCOPE,\n type: options.type,\n };\n\n return requestWithAuth({\n method: 'POST',\n uri: `${cigServiceUrl}${BASE_PATH_SECURE}`,\n json: true,\n body,\n }).then((res) => ({\n password: body.password,\n emailAddress: res.body.user.email,\n displayName: res.body.user.name,\n ...res.body.user,\n token: fixToken(res.body.token),\n }));\n}\n\n/**\n * Exchanges a user name/password for an access token\n * @param {Object} options\n * @param {string} options.id\n * @param {string} options.email\n * @param {string} options.password\n * @param {string} options.clientId\n * @param {string} options.clientSecret\n * @param {string} options.cigServiceUrl\n * @returns {Promise.<AccessTokenObject>}\n */\nexport function loginTestUser(options) {\n const clientId = options.clientId || process.env.WEBEX_CLIENT_ID;\n const clientSecret = options.clientSecret || process.env.WEBEX_CLIENT_SECRET;\n const cigServiceUrl =\n options.cigServiceUrl ||\n process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL ||\n process.env.WEBEX_TEST_USERS_CONVERSATION_SERVICE_URL;\n\n if (!clientId) {\n throw new Error('options.clientId or process.env.WEBEX_CLIENT_ID must be defined');\n }\n\n if (!clientSecret) {\n throw new Error('options.clientSecret or process.env.WEBEX_CLIENT_SECRET must be defined');\n }\n\n if (!cigServiceUrl) {\n throw new Error(\n 'options.cigServiceUrl or process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL must be defined'\n );\n }\n\n return request({\n method: 'POST',\n uri: `${cigServiceUrl}${BASE_PATH}/login`,\n json: true,\n body: _.defaultsDeep(options, {\n clientId,\n clientSecret,\n }),\n }).then((res) => fixToken(res.body));\n}\n\n/**\n * Removes a test user\n * @param {Object} options\n * @param {string} options.id user id to remove\n * @param {string} options.cigServiceUrl\n * @param {Object} options.token\n * @param {string} options.token.authorization\n * @param {string} [options.token.refresh_token]\n * @returns {Promise}\n */\nexport function removeTestUser(options = {}) {\n const cigServiceUrl =\n options.cigServiceUrl ||\n process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL ||\n process.env.WEBEX_TEST_USERS_CONVERSATION_SERVICE_URL;\n\n if (!cigServiceUrl) {\n throw new Error(\n 'options.cigServiceUrl or process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL must be defined'\n );\n }\n\n if (!options.id) {\n return Promise.reject(new Error('options.id is required'));\n }\n\n if (!options.token) {\n return loginTestUser(options).then((token) => {\n options.token = token;\n\n return removeTestUser(options);\n });\n }\n\n assert(options.token.authorization, 'options.token.authorization must be defined');\n\n return request({\n method: 'POST',\n json: true,\n headers: {\n authorization: options.token.authorization,\n },\n body: {\n /* eslint-disable camelcase */\n user_id: options.id,\n refresh_token: options.token.refresh_token,\n user_type: options.userType || 'PERSON',\n /* eslint-enable camelcase */\n },\n uri: `${cigServiceUrl}${BASE_PATH}/delete`,\n });\n}\n\nexport {\n default as createWhistlerTestUser,\n removeTestUser as removeWhistlerTestUser,\n} from './whistler';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AAEA;;AACA;;AAoTA;;;;;;;;;;AAlTA,IAAMA,gBAAgB,GAAG,qBAAzB;AACA,IAAMC,SAAS,GAAG,mBAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,QAAT,CAAkBC,KAAlB,EAAyB;EACvB,IAAMC,GAAG,GAAG,mBAAZ;;EAEA,IAAID,KAAK,CAACE,UAAN,IAAoB,CAACF,KAAK,CAACG,OAA/B,EAAwC;IACtCH,KAAK,CAACG,OAAN,GAAgBF,GAAG,GAAGD,KAAK,CAACE,UAAN,GAAmB,IAAzC;EACD;;EAED,IAAIF,KAAK,CAACI,wBAAN,IAAkC,CAACJ,KAAK,CAACK,qBAA7C,EAAoE;IAClE;IACAL,KAAK,CAACK,qBAAN,GAA8BJ,GAAG,GAAGD,KAAK,CAACI,wBAAN,GAAiC,IAArE;EACD;;EAED,IAAIJ,KAAK,CAACM,UAAN,IAAoBN,KAAK,CAACO,YAA9B,EAA4C;IAC1CP,KAAK,CAACQ,aAAN,aAAyBR,KAAK,CAACM,UAA/B,cAA6CN,KAAK,CAACO,YA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ClB,MAAM,IAAIG,KAAJ,CACJ,8FADI,CAAN;EAGD;;EAED,IAAI,CAACV,OAAO,CAAC+B,EAAb,EAAiB;IACf,OAAO,iBAAQC,MAAR,CAAe,IAAItB,KAAJ,CAAU,wBAAV,CAAf,CAAP;EACD;;EAED,IAAI,CAACV,OAAO,CAAC9B,KAAb,EAAoB;IAClB,OAAO2D,aAAa,CAAC7B,OAAD,CAAb,CAAuBJ,IAAvB,CAA4B,UAAC1B,KAAD,EAAW;MAC5C8B,OAAO,CAAC9B,KAAR,GAAgBA,KAAhB;MAEA,OAAO4D,cAAc,CAAC9B,OAAD,CAArB;IACD,CAJM,CAAP;EAKD;;EAED,IAAAiC,eAAA,EAAOjC,OAAO,CAAC9B,KAAR,CAAcQ,aAArB,EAAoC,6CAApC;EAEA,OAAO,IAAAO,iBAAA,EAAQ;IACbC,MAAM,EAAE,MADK;IAEbE,IAAI,EAAE,IAFO;IAGbM,OAAO,EAAE;MACPhB,aAAa,EAAEsB,OAAO,CAAC9B,KAAR,CAAcQ;IADtB,CAHI;IAMboB,IAAI,EAAE;MACJ;MACAoC,OAAO,EAAElC,OAAO,CAAC+B,EAFb;MAGJI,aAAa,EAAEnC,OAAO,CAAC9B,KAAR,CAAciE,aAHzB;MAIJC,SAAS,EAAEpC,OAAO,CAACqC,QAAR,IAAoB;MAC/B;;IALI,CANO;IAablD,GAAG,YAAKoB,aAAL,SAAqBvC,SAArB;EAbU,CAAR,CAAP;AAeD"}
|
|
1
|
+
{"version":3,"names":["BASE_PATH_SECURE","BASE_PATH","fixToken","token","now","expires_in","expires","refresh_token_expires_in","refresh_token_expires","token_type","access_token","authorization","clientToken","getClientCredentials","clientId","clientSecret","idbrokerUrl","resolve","request","method","uri","json","form","grant_type","scope","client_id","client_secret","headers","btoa","then","res","body","requestWithAuth","options","createTestUser","process","env","WEBEX_CLIENT_ID","WEBEX_CLIENT_SECRET","IDBROKER_BASE_URL","cigServiceUrl","WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL","WEBEX_TEST_USERS_CONVERSATION_SERVICE_URL","Error","authCodeOnly","displayName","randomName","emailTemplate","emailAddress","entitlements","machineType","orgId","password","uuid","v4","roles","scopes","WEBEX_SCOPE","type","user","email","name","loginTestUser","removeTestUser","id","reject","assert","user_id","refresh_token","user_type","userType"],"sources":["index.js"],"sourcesContent":["import assert from 'assert';\n\nimport uuid from 'uuid';\nimport btoa from 'btoa';\nimport _ from 'lodash';\nimport randomName from 'node-random-name';\nimport {request} from '@webex/http-core';\n\nconst BASE_PATH_SECURE = '/users/test_users_s';\nconst BASE_PATH = '/users/test_users';\n\n/**\n * Computes `expires` and `refresh_token_expires` from `expires_in` and\n * `refresh_token_expires_in` and creates an `authorization` string.\n * @param {Object} token\n * @private\n * @returns {Object}\n */\nfunction fixToken(token) {\n const now = Date.now();\n\n if (token.expires_in && !token.expires) {\n token.expires = now + token.expires_in * 1000;\n }\n\n if (token.refresh_token_expires_in && !token.refresh_token_expires) {\n /* eslint camelcase: [0] */\n token.refresh_token_expires = now + token.refresh_token_expires_in * 1000;\n }\n\n if (token.token_type && token.access_token) {\n token.authorization = `${token.token_type} ${token.access_token}`;\n }\n\n return token;\n}\n\nlet clientToken;\n\n/**\n * Fetches credentials to talk to the test_users_s endpoint\n *\n * Caches result in `clientToken` variable for multiple runs\n * @param {Object} options\n * @param {string} options.clientId\n * @param {string} options.clientSecret\n * @param {string} options.idbrokerUrl\n * @private\n * @returns {String}\n */\nfunction getClientCredentials({clientId, clientSecret, idbrokerUrl}) {\n if (clientToken) {\n return Promise.resolve(clientToken);\n }\n\n return request({\n method: 'POST',\n uri: `${idbrokerUrl}/idb/oauth2/v1/access_token`,\n json: true,\n form: {\n grant_type: 'client_credentials',\n scope: 'Identity:SCIM webexsquare:get_conversation',\n client_id: clientId,\n client_secret: clientSecret,\n },\n headers: {\n // Note: we can't request's auth hash here because this endpoint expects\n // us to send the auth header *without including \"Basic \"* before the\n // token string\n authorization: btoa(`${clientId}:${clientSecret}`),\n },\n })\n .then((res) => {\n const token = fixToken(res.body);\n\n return `${token.token_type} ${token.access_token}`;\n })\n .then((token) => {\n clientToken = token;\n\n return clientToken;\n });\n}\n\n/**\n * Makes a request authorized with client credentials\n * @param {Object} options\n * @param {Object} options.body\n * @param {string} options.body.clientId\n * @param {string} options.body.clientSecret\n * @param {string} options.body.idbrokerUrl\n * @private\n * @returns {Promise<HttpResponseObject>}\n */\nfunction requestWithAuth(options) {\n return getClientCredentials(options.body).then((authorization) => {\n options.headers = options.headers || {};\n options.headers.authorization = authorization;\n\n return request(options);\n });\n}\n\n/**\n * @typedef {Object} AccessTokenObject\n * @property {string} token.access_token\n * @property {Number} token.expires_in\n * @property {string} token.token_type\n * @property {string} token.refresh_token\n * @property {Number} token.refresh_token_expires_in\n * @property {string} token.expires\n * @property {string} token.refresh_token_expires\n */\n\n/**\n * @typedef {Object} CreateUserOptions\n * @property {boolean} [authCodeOnly] generates auth_code\n * @param {string} [clientId] defaults to WEBEX_CLIENT_ID\n * @param {string} [clientSecret] defaults to WEBEX_CLIENT_SECRET\n * @param {string} [cigServiceUrl] defaults to WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL\n * @property {string} [displayName]\n * @property {string} [emailAddress]\n * @property {Array.<string>} [entitlements]\n * @param {string} [idbrokerUrl] defaults to IDBROKER_BASE_URL\n * @property {string} [machineType] used when creating a machine user/device\n * @property {string} [orgId] organization ID to create the user under\n * @property {string} [password] defaults to a random password\n * @property {string} [roles] defaults to []\n * @property {string} [scope] defaults to WEBEX_SCOPE\n * @property {string} [type] used to create a machine\n */\n\n/**\n * @typedef {Object} TestUserObject\n * @property {string} password\n * @property {string} emailAddress\n * @property {string} displayName\n * @property {string} id\n * @property {string} userName\n * @property {string} email\n * @property {string} name\n * @property {string} givenName\n * @property {string} type\n * @property {Array.<string>} entitlements\n * @property {string} orgId\n * @property {AccessTokenObject} token\n */\n\n/**\n * Creates a test user\n * @param {CreateUserOptions} options\n * @returns {Promise.<TestUserObject>}\n */\nexport function createTestUser(options = {}) {\n const clientId = options.clientId || process.env.WEBEX_CLIENT_ID;\n const clientSecret = options.clientSecret || process.env.WEBEX_CLIENT_SECRET;\n const idbrokerUrl = options.idbrokerUrl || process.env.IDBROKER_BASE_URL;\n const cigServiceUrl =\n options.cigServiceUrl ||\n process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL ||\n process.env.WEBEX_TEST_USERS_CONVERSATION_SERVICE_URL;\n\n if (!clientId) {\n throw new Error('options.clientId or process.env.WEBEX_CLIENT_ID must be defined');\n }\n\n if (!clientSecret) {\n throw new Error('options.clientSecret or process.env.WEBEX_CLIENT_SECRET must be defined');\n }\n\n if (!idbrokerUrl) {\n throw new Error('options.idbrokerUrl or process.env.IDBROKER_BASE_URL must be defined');\n }\n\n if (!cigServiceUrl) {\n throw new Error(\n 'options.cigServiceUrl or process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL must be defined'\n );\n }\n\n const body = {\n authCodeOnly: options.authCodeOnly,\n clientId,\n clientSecret,\n displayName: options.displayName || randomName(),\n emailTemplate: options.emailAddress,\n entitlements: options.entitlements || [\n 'spark',\n 'squaredCallInitiation',\n 'squaredRoomModeration',\n 'squaredInviter',\n 'webExSquared',\n ],\n idbrokerUrl,\n machineType: options.machineType,\n orgId: options.orgId,\n // The five characters on the end are to hit all the password requirements\n password: options.password || `${uuid.v4()}zAY1*`,\n roles: options.roles || [],\n scopes: options.scope || process.env.WEBEX_SCOPE,\n type: options.type,\n };\n\n return requestWithAuth({\n method: 'POST',\n uri: `${cigServiceUrl}${BASE_PATH_SECURE}`,\n json: true,\n body,\n }).then((res) => ({\n password: body.password,\n emailAddress: res.body.user.email,\n displayName: res.body.user.name,\n ...res.body.user,\n token: fixToken(res.body.token),\n }));\n}\n\n/**\n * Exchanges a user name/password for an access token\n * @param {Object} options\n * @param {string} options.id\n * @param {string} options.email\n * @param {string} options.password\n * @param {string} options.clientId\n * @param {string} options.clientSecret\n * @param {string} options.cigServiceUrl\n * @returns {Promise.<AccessTokenObject>}\n */\nexport function loginTestUser(options) {\n const clientId = options.clientId || process.env.WEBEX_CLIENT_ID;\n const clientSecret = options.clientSecret || process.env.WEBEX_CLIENT_SECRET;\n const cigServiceUrl =\n options.cigServiceUrl ||\n process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL ||\n process.env.WEBEX_TEST_USERS_CONVERSATION_SERVICE_URL;\n\n if (!clientId) {\n throw new Error('options.clientId or process.env.WEBEX_CLIENT_ID must be defined');\n }\n\n if (!clientSecret) {\n throw new Error('options.clientSecret or process.env.WEBEX_CLIENT_SECRET must be defined');\n }\n\n if (!cigServiceUrl) {\n throw new Error(\n 'options.cigServiceUrl or process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL must be defined'\n );\n }\n\n return request({\n method: 'POST',\n uri: `${cigServiceUrl}${BASE_PATH}/login`,\n json: true,\n body: _.defaultsDeep(options, {\n clientId,\n clientSecret,\n }),\n }).then((res) => fixToken(res.body));\n}\n\n/**\n * Removes a test user\n * @param {Object} options\n * @param {string} options.id user id to remove\n * @param {string} options.cigServiceUrl\n * @param {Object} options.token\n * @param {string} options.token.authorization\n * @param {string} [options.token.refresh_token]\n * @returns {Promise}\n */\nexport function removeTestUser(options = {}) {\n const cigServiceUrl =\n options.cigServiceUrl ||\n process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL ||\n process.env.WEBEX_TEST_USERS_CONVERSATION_SERVICE_URL;\n\n if (!cigServiceUrl) {\n throw new Error(\n 'options.cigServiceUrl or process.env.WEBEX_TEST_USERS_CI_GATEWAY_SERVICE_URL must be defined'\n );\n }\n\n if (!options.id) {\n return Promise.reject(new Error('options.id is required'));\n }\n\n if (!options.token) {\n return loginTestUser(options).then((token) => {\n options.token = token;\n\n return removeTestUser(options);\n });\n }\n\n assert(options.token.authorization, 'options.token.authorization must be defined');\n\n return request({\n method: 'POST',\n json: true,\n headers: {\n authorization: options.token.authorization,\n },\n body: {\n /* eslint-disable camelcase */\n user_id: options.id,\n refresh_token: options.token.refresh_token,\n user_type: options.userType || 'PERSON',\n /* eslint-enable camelcase */\n },\n uri: `${cigServiceUrl}${BASE_PATH}/delete`,\n });\n}\n\nexport {\n default as createWhistlerTestUser,\n removeTestUser as removeWhistlerTestUser,\n} from './whistler';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAEA;AACA;AAEA;AACA;AAoTA;AAGoB;AAAA;AAAA;AAAA;AArTpB,IAAMA,gBAAgB,GAAG,qBAAqB;AAC9C,IAAMC,SAAS,GAAG,mBAAmB;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,QAAQ,CAACC,KAAK,EAAE;EACvB,IAAMC,GAAG,GAAG,mBAAU;EAEtB,IAAID,KAAK,CAACE,UAAU,IAAI,CAACF,KAAK,CAACG,OAAO,EAAE;IACtCH,KAAK,CAACG,OAAO,GAAGF,GAAG,GAAGD,KAAK,CAACE,UAAU,GAAG,IAAI;EAC/C;EAEA,IAAIF,KAAK,CAACI,wBAAwB,IAAI,CAACJ,KAAK,CAACK,qBAAqB,EAAE;IAClE;IACAL,KAAK,CAACK,qBAAqB,GAAGJ,GAAG,GAAGD,KAAK,CAACI,wBAAwB,GAAG,IAAI;EAC3E;EAEA,IAAIJ,KAAK,CAACM,UAAU,IAAIN,KAAK,CAACO,YAAY,EAAE;IAC1CP,KAAK,CAACQ,aAAa,aAAMR,KAAK,CAACM,UAAU,cAAIN,KAAK,CAACO,YAAY,CAAE;EACnE;EAEA,OAAOP,KAAK;AACd;AAEA,IAAIS,WAAW;;AAEf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,oBAAoB,OAAwC;EAAA,IAAtCC,QAAQ,QAARA,QAAQ;IAAEC,YAAY,QAAZA,YAAY;IAAEC,WAAW,QAAXA,WAAW;EAChE,IAAIJ,WAAW,EAAE;IACf,OAAO,iBAAQK,OAAO,CAACL,WAAW,C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,OAAO,CAAC;IAChC,CAAC,CAAC;EACJ;EAEA,IAAAiC,eAAM,EAACjC,OAAO,CAAC9B,KAAK,CAACQ,aAAa,EAAE,6CAA6C,CAAC;EAElF,OAAO,IAAAO,iBAAO,EAAC;IACbC,MAAM,EAAE,MAAM;IACdE,IAAI,EAAE,IAAI;IACVM,OAAO,EAAE;MACPhB,aAAa,EAAEsB,OAAO,CAAC9B,KAAK,CAACQ;IAC/B,CAAC;IACDoB,IAAI,EAAE;MACJ;MACAoC,OAAO,EAAElC,OAAO,CAAC+B,EAAE;MACnBI,aAAa,EAAEnC,OAAO,CAAC9B,KAAK,CAACiE,aAAa;MAC1CC,SAAS,EAAEpC,OAAO,CAACqC,QAAQ,IAAI;MAC/B;IACF,CAAC;;IACDlD,GAAG,YAAKoB,aAAa,SAAGvC,SAAS;EACnC,CAAC,CAAC;AACJ"}
|
package/dist/whistler.js
CHANGED
|
@@ -1,36 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$keys = 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 = createTestUser;
|
|
22
14
|
exports.removeTestUser = removeTestUser;
|
|
23
|
-
|
|
24
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
25
|
-
|
|
26
16
|
var _btoa = _interopRequireDefault(require("btoa"));
|
|
27
|
-
|
|
28
17
|
var _httpCore = require("@webex/http-core");
|
|
29
|
-
|
|
30
18
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(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; }
|
|
31
|
-
|
|
32
19
|
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; }
|
|
33
|
-
|
|
34
20
|
/**
|
|
35
21
|
* Fetches credentials/access_token to talk to the whistler endpoint
|
|
36
22
|
*
|
|
@@ -46,11 +32,11 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
46
32
|
*/
|
|
47
33
|
var getClientCredentials = function getClientCredentials(_ref) {
|
|
48
34
|
var clientId = _ref.clientId,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
35
|
+
clientSecret = _ref.clientSecret,
|
|
36
|
+
orgId = _ref.orgId,
|
|
37
|
+
idbrokerUrl = _ref.idbrokerUrl,
|
|
38
|
+
machineAccount = _ref.machineAccount,
|
|
39
|
+
machinePassword = _ref.machinePassword;
|
|
54
40
|
return (0, _httpCore.request)({
|
|
55
41
|
method: 'POST',
|
|
56
42
|
uri: "".concat(idbrokerUrl, "/idb/token/").concat(orgId, "/v2/actions/GetBearerToken/invoke"),
|
|
@@ -84,6 +70,7 @@ var getClientCredentials = function getClientCredentials(_ref) {
|
|
|
84
70
|
return "".concat(res.body.token_type, " ").concat(res.body.access_token);
|
|
85
71
|
});
|
|
86
72
|
};
|
|
73
|
+
|
|
87
74
|
/**
|
|
88
75
|
* @typedef {Object} TestUserObject
|
|
89
76
|
* @property {string} password
|
|
@@ -111,8 +98,6 @@ var getClientCredentials = function getClientCredentials(_ref) {
|
|
|
111
98
|
* @param {CreateUserOptions} options
|
|
112
99
|
* @returns {Promise.<TestUserObject>}
|
|
113
100
|
*/
|
|
114
|
-
|
|
115
|
-
|
|
116
101
|
function createTestUser() {
|
|
117
102
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
118
103
|
var clientId = options.clientId || process.env.WEBEX_CLIENT_ID;
|
|
@@ -123,38 +108,31 @@ function createTestUser() {
|
|
|
123
108
|
var orgId = options.orgId || process.env.WHISTLER_TEST_ORG_ID;
|
|
124
109
|
var whistlerServiceUrl = options.whistlerServiceUrl || process.env.WHISTLER_API_SERVICE_URL;
|
|
125
110
|
var reservationGroup = options.reservationGroup,
|
|
126
|
-
|
|
127
|
-
|
|
111
|
+
userScopes = options.userScopes;
|
|
128
112
|
if (!clientId) {
|
|
129
113
|
throw new Error('options.clientId or process.env.WEBEX_CLIENT_ID must be defined');
|
|
130
114
|
}
|
|
131
|
-
|
|
132
115
|
if (!clientSecret) {
|
|
133
116
|
throw new Error('options.clientSecret or process.env.WEBEX_CLIENT_SECRET must be defined');
|
|
134
117
|
}
|
|
135
|
-
|
|
136
118
|
if (!machineAccount) {
|
|
137
119
|
throw new Error('options.machineAccount or process.env.WHISTLER_MACHINE_ACCOUNT must be defined');
|
|
138
120
|
}
|
|
139
|
-
|
|
140
121
|
if (!machinePassword) {
|
|
141
122
|
throw new Error('options.machinePassword or process.env.WHISTLER_MACHINE_PASSWORD must be defined');
|
|
142
123
|
}
|
|
143
|
-
|
|
144
124
|
if (!idbrokerUrl) {
|
|
145
125
|
throw new Error('options.idbrokerUrl or process.env.IDBROKER_BASE_URL must be defined');
|
|
146
126
|
}
|
|
147
|
-
|
|
148
127
|
if (!orgId) {
|
|
149
128
|
throw new Error('options.orgId or process.env.WHISTLER_TEST_ORG_ID must be defined');
|
|
150
129
|
}
|
|
151
|
-
|
|
152
130
|
if (!whistlerServiceUrl) {
|
|
153
131
|
throw new Error('options.whistlerServiceUrl or process.env.WHISTLER_API_SERVICE_URL must be defined');
|
|
154
|
-
}
|
|
155
|
-
// Please check https://confluence-eng-gpk2.cisco.com/conf/pages/viewpage.action?spaceKey=LOCUS&title=Whistler+APIs#WhistlerAPIs-GET/reservations/testUser
|
|
156
|
-
|
|
132
|
+
}
|
|
157
133
|
|
|
134
|
+
// For reservation groups and user scopes
|
|
135
|
+
// Please check https://confluence-eng-gpk2.cisco.com/conf/pages/viewpage.action?spaceKey=LOCUS&title=Whistler+APIs#WhistlerAPIs-GET/reservations/testUser
|
|
158
136
|
return getClientCredentials({
|
|
159
137
|
clientId: clientId,
|
|
160
138
|
clientSecret: clientSecret,
|
|
@@ -185,13 +163,12 @@ function createTestUser() {
|
|
|
185
163
|
}, res.body.responseMetaData);
|
|
186
164
|
});
|
|
187
165
|
}
|
|
166
|
+
|
|
188
167
|
/**
|
|
189
168
|
*
|
|
190
169
|
* @param {Object} options
|
|
191
170
|
* @returns {Promise}
|
|
192
171
|
*/
|
|
193
|
-
|
|
194
|
-
|
|
195
172
|
function removeTestUser() {
|
|
196
173
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
197
174
|
return (0, _httpCore.request)({
|
package/dist/whistler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getClientCredentials","clientId","clientSecret","orgId","idbrokerUrl","machineAccount","machinePassword","request","method","uri","json","body","uid","password","then","res","form","assertion","BearerToken","grant_type","scope","self_contained_token","client_id","client_secret","headers","authorization","btoa","token_type","access_token","createTestUser","options","process","env","WEBEX_CLIENT_ID","WEBEX_CLIENT_SECRET","WHISTLER_MACHINE_ACCOUNT","WHISTLER_MACHINE_PASSWORD","IDBROKER_BASE_URL","WHISTLER_TEST_ORG_ID","whistlerServiceUrl","WHISTLER_API_SERVICE_URL","reservationGroup","userScopes","Error","qs","isAccessTokenRequired","responseMetaData","ciPassword","emailAddress","name","displayName","webExUserName","token","ciAccessToken","reservationUrl","removeTestUser"],"sources":["whistler.js"],"sourcesContent":["import btoa from 'btoa';\nimport {request} from '@webex/http-core';\n\n/**\n * Fetches credentials/access_token to talk to the whistler endpoint\n *\n * @param {Object} options\n * @param {string} options.clientId\n * @param {string} options.clientSecret\n * @param {string} options.idbrokerUrl\n * @param {string} options.orgId\n * @param {string} options.machineAccount\n * @param {string} options.machinePassword\n * @private\n * @returns {Promise<string>}\n */\nconst getClientCredentials = ({\n clientId,\n clientSecret,\n orgId,\n idbrokerUrl,\n machineAccount,\n machinePassword,\n}) =>\n request({\n method: 'POST',\n uri: `${idbrokerUrl}/idb/token/${orgId}/v2/actions/GetBearerToken/invoke`,\n json: true,\n body: {\n uid: machineAccount,\n password: machinePassword,\n },\n })\n .then((res) =>\n request({\n method: 'POST',\n uri: `${idbrokerUrl}/idb/oauth2/v1/access_token`,\n json: true,\n form: {\n assertion: res.body.BearerToken,\n grant_type: 'urn:ietf:params:oauth:grant-type:saml2-bearer',\n scope: 'webexsquare:get_conversation webexsquare:admin',\n self_contained_token: true,\n client_id: clientId,\n client_secret: clientSecret,\n },\n headers: {\n // Note: we can't request's auth hash here because this endpoint expects\n // us to send the auth header *without including \"Basic \"* before the\n // token string\n // authorization: `Basic + ${btoa(`${clientId}:${clientSecret}`)}`\n authorization: btoa(`${clientId}:${clientSecret}`),\n },\n })\n )\n .then((res) => `${res.body.token_type} ${res.body.access_token}`);\n\n/**\n * @typedef {Object} TestUserObject\n * @property {string} password\n * @property {string} emailAddress\n * @property {string} displayName\n * @property {string} token\n * @property {string} reservationUrl\n * @property {object} responseMetaData - whistler given properties\n */\n\n/**\n * @typedef {Object} CreateUserOptions\n * @param {Object} [options]\n * @param {string} [whistlerServiceUrl] defaults to WHISTLER_API_SERVICE_URL\n * @param {string} [options.clientId] defaults to WEBEX_CLIENT_ID\n * @param {string} [options.clientSecret] defaults to WEBEX_CLIENT_SECRET\n * @param {string} [options.idbrokerUrl] defaults to IDBROKER_BASE_URL\n * @param {string} [options.orgId] organization ID to create the user under\n * @param {string} [options.machineAccount] defaults to WHISTLER_MACHINE_ACCOUNT\n * @param {string} [options.machinePassword] defaults to WHISTLER_MACHINE_PASSWORD\n */\n\n/**\n * Creates a test user\n * @param {CreateUserOptions} options\n * @returns {Promise.<TestUserObject>}\n */\nexport default function createTestUser(options = {}) {\n const clientId = options.clientId || process.env.WEBEX_CLIENT_ID;\n const clientSecret = options.clientSecret || process.env.WEBEX_CLIENT_SECRET;\n const machineAccount = options.machineAccount || process.env.WHISTLER_MACHINE_ACCOUNT;\n const machinePassword = options.machinePassword || process.env.WHISTLER_MACHINE_PASSWORD;\n const idbrokerUrl = options.idbrokerUrl || process.env.IDBROKER_BASE_URL;\n const orgId = options.orgId || process.env.WHISTLER_TEST_ORG_ID;\n const whistlerServiceUrl = options.whistlerServiceUrl || process.env.WHISTLER_API_SERVICE_URL;\n const {reservationGroup, userScopes} = options;\n\n if (!clientId) {\n throw new Error('options.clientId or process.env.WEBEX_CLIENT_ID must be defined');\n }\n\n if (!clientSecret) {\n throw new Error('options.clientSecret or process.env.WEBEX_CLIENT_SECRET must be defined');\n }\n\n if (!machineAccount) {\n throw new Error(\n 'options.machineAccount or process.env.WHISTLER_MACHINE_ACCOUNT must be defined'\n );\n }\n\n if (!machinePassword) {\n throw new Error(\n 'options.machinePassword or process.env.WHISTLER_MACHINE_PASSWORD must be defined'\n );\n }\n if (!idbrokerUrl) {\n throw new Error('options.idbrokerUrl or process.env.IDBROKER_BASE_URL must be defined');\n }\n\n if (!orgId) {\n throw new Error('options.orgId or process.env.WHISTLER_TEST_ORG_ID must be defined');\n }\n\n if (!whistlerServiceUrl) {\n throw new Error(\n 'options.whistlerServiceUrl or process.env.WHISTLER_API_SERVICE_URL must be defined'\n );\n }\n\n // For reservation groups and user scopes\n // Please check https://confluence-eng-gpk2.cisco.com/conf/pages/viewpage.action?spaceKey=LOCUS&title=Whistler+APIs#WhistlerAPIs-GET/reservations/testUser\n return getClientCredentials({\n clientId,\n clientSecret,\n machineAccount,\n machinePassword,\n idbrokerUrl,\n orgId,\n })\n .then((authorization) =>\n request({\n method: 'GET',\n uri: `${whistlerServiceUrl}/reservations/testUser`,\n qs: {\n reservationGroup,\n userScopes,\n isAccessTokenRequired: true,\n },\n headers: {\n authorization,\n },\n })\n )\n .then((res) => ({\n password: res.body.responseMetaData.ciPassword,\n emailAddress: res.body.responseMetaData.name,\n displayName: res.body.responseMetaData.webExUserName,\n token: res.body.responseMetaData.ciAccessToken,\n reservationUrl: res.body.reservationUrl,\n ...res.body.responseMetaData,\n }));\n}\n\n/**\n *\n * @param {Object} options\n * @returns {Promise}\n */\nexport function removeTestUser(options = {}) {\n return request({\n method: 'DELETE',\n headers: {\n authorization: `Bearer ${options.token}`,\n },\n uri: options.reservationUrl,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,oBAAoB,GAAG,SAAvBA,oBAAuB;EAAA,IAC3BC,QAD2B,QAC3BA,QAD2B;EAAA,IAE3BC,YAF2B,QAE3BA,YAF2B;EAAA,IAG3BC,KAH2B,QAG3BA,KAH2B;EAAA,IAI3BC,WAJ2B,QAI3BA,WAJ2B;EAAA,IAK3BC,cAL2B,QAK3BA,cAL2B;EAAA,IAM3BC,eAN2B,QAM3BA,eAN2B;EAAA,OAQ3B,IAAAC,iB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word","request","method","uri","json","body","uid","password","then","res","form","assertion","BearerToken","grant_type","scope","self_contained_token","client_id","client_secret","headers","authorization","btoa","token_type","access_token","createTestUser","options","process","env","WEBEX_CLIENT_ID","WEBEX_CLIENT_SECRET","WHISTLER_MACHINE_ACCOUNT","WHISTLER_MACHINE_PASSWORD","IDBROKER_BASE_URL","WHISTLER_TEST_ORG_ID","whistlerServiceUrl","WHISTLER_API_SERVICE_URL","reservationGroup","userScopes","Error","qs","isAccessTokenRequired","responseMetaData","ciPassword","emailAddress","name","displayName","webExUserName","token","ciAccessToken","reservationUrl","removeTestUser"],"sources":["whistler.js"],"sourcesContent":["import btoa from 'btoa';\nimport {request} from '@webex/http-core';\n\n/**\n * Fetches credentials/access_token to talk to the whistler endpoint\n *\n * @param {Object} options\n * @param {string} options.clientId\n * @param {string} options.clientSecret\n * @param {string} options.idbrokerUrl\n * @param {string} options.orgId\n * @param {string} options.machineAccount\n * @param {string} options.machinePassword\n * @private\n * @returns {Promise<string>}\n */\nconst getClientCredentials = ({\n clientId,\n clientSecret,\n orgId,\n idbrokerUrl,\n machineAccount,\n machinePassword,\n}) =>\n request({\n method: 'POST',\n uri: `${idbrokerUrl}/idb/token/${orgId}/v2/actions/GetBearerToken/invoke`,\n json: true,\n body: {\n uid: machineAccount,\n password: machinePassword,\n },\n })\n .then((res) =>\n request({\n method: 'POST',\n uri: `${idbrokerUrl}/idb/oauth2/v1/access_token`,\n json: true,\n form: {\n assertion: res.body.BearerToken,\n grant_type: 'urn:ietf:params:oauth:grant-type:saml2-bearer',\n scope: 'webexsquare:get_conversation webexsquare:admin',\n self_contained_token: true,\n client_id: clientId,\n client_secret: clientSecret,\n },\n headers: {\n // Note: we can't request's auth hash here because this endpoint expects\n // us to send the auth header *without including \"Basic \"* before the\n // token string\n // authorization: `Basic + ${btoa(`${clientId}:${clientSecret}`)}`\n authorization: btoa(`${clientId}:${clientSecret}`),\n },\n })\n )\n .then((res) => `${res.body.token_type} ${res.body.access_token}`);\n\n/**\n * @typedef {Object} TestUserObject\n * @property {string} password\n * @property {string} emailAddress\n * @property {string} displayName\n * @property {string} token\n * @property {string} reservationUrl\n * @property {object} responseMetaData - whistler given properties\n */\n\n/**\n * @typedef {Object} CreateUserOptions\n * @param {Object} [options]\n * @param {string} [whistlerServiceUrl] defaults to WHISTLER_API_SERVICE_URL\n * @param {string} [options.clientId] defaults to WEBEX_CLIENT_ID\n * @param {string} [options.clientSecret] defaults to WEBEX_CLIENT_SECRET\n * @param {string} [options.idbrokerUrl] defaults to IDBROKER_BASE_URL\n * @param {string} [options.orgId] organization ID to create the user under\n * @param {string} [options.machineAccount] defaults to WHISTLER_MACHINE_ACCOUNT\n * @param {string} [options.machinePassword] defaults to WHISTLER_MACHINE_PASSWORD\n */\n\n/**\n * Creates a test user\n * @param {CreateUserOptions} options\n * @returns {Promise.<TestUserObject>}\n */\nexport default function createTestUser(options = {}) {\n const clientId = options.clientId || process.env.WEBEX_CLIENT_ID;\n const clientSecret = options.clientSecret || process.env.WEBEX_CLIENT_SECRET;\n const machineAccount = options.machineAccount || process.env.WHISTLER_MACHINE_ACCOUNT;\n const machinePassword = options.machinePassword || process.env.WHISTLER_MACHINE_PASSWORD;\n const idbrokerUrl = options.idbrokerUrl || process.env.IDBROKER_BASE_URL;\n const orgId = options.orgId || process.env.WHISTLER_TEST_ORG_ID;\n const whistlerServiceUrl = options.whistlerServiceUrl || process.env.WHISTLER_API_SERVICE_URL;\n const {reservationGroup, userScopes} = options;\n\n if (!clientId) {\n throw new Error('options.clientId or process.env.WEBEX_CLIENT_ID must be defined');\n }\n\n if (!clientSecret) {\n throw new Error('options.clientSecret or process.env.WEBEX_CLIENT_SECRET must be defined');\n }\n\n if (!machineAccount) {\n throw new Error(\n 'options.machineAccount or process.env.WHISTLER_MACHINE_ACCOUNT must be defined'\n );\n }\n\n if (!machinePassword) {\n throw new Error(\n 'options.machinePassword or process.env.WHISTLER_MACHINE_PASSWORD must be defined'\n );\n }\n if (!idbrokerUrl) {\n throw new Error('options.idbrokerUrl or process.env.IDBROKER_BASE_URL must be defined');\n }\n\n if (!orgId) {\n throw new Error('options.orgId or process.env.WHISTLER_TEST_ORG_ID must be defined');\n }\n\n if (!whistlerServiceUrl) {\n throw new Error(\n 'options.whistlerServiceUrl or process.env.WHISTLER_API_SERVICE_URL must be defined'\n );\n }\n\n // For reservation groups and user scopes\n // Please check https://confluence-eng-gpk2.cisco.com/conf/pages/viewpage.action?spaceKey=LOCUS&title=Whistler+APIs#WhistlerAPIs-GET/reservations/testUser\n return getClientCredentials({\n clientId,\n clientSecret,\n machineAccount,\n machinePassword,\n idbrokerUrl,\n orgId,\n })\n .then((authorization) =>\n request({\n method: 'GET',\n uri: `${whistlerServiceUrl}/reservations/testUser`,\n qs: {\n reservationGroup,\n userScopes,\n isAccessTokenRequired: true,\n },\n headers: {\n authorization,\n },\n })\n )\n .then((res) => ({\n password: res.body.responseMetaData.ciPassword,\n emailAddress: res.body.responseMetaData.name,\n displayName: res.body.responseMetaData.webExUserName,\n token: res.body.responseMetaData.ciAccessToken,\n reservationUrl: res.body.reservationUrl,\n ...res.body.responseMetaData,\n }));\n}\n\n/**\n *\n * @param {Object} options\n * @returns {Promise}\n */\nexport function removeTestUser(options = {}) {\n return request({\n method: 'DELETE',\n headers: {\n authorization: `Bearer ${options.token}`,\n },\n uri: options.reservationUrl,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AAAyC;AAAA;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,oBAAoB,GAAG,SAAvBA,oBAAoB;EAAA,IACxBC,QAAQ,QAARA,QAAQ;IACRC,YAAY,QAAZA,YAAY;IACZC,KAAK,QAALA,KAAK;IACLC,WAAW,QAAXA,WAAW;IACXC,cAAc,QAAdA,cAAc;IACdC,eAAe,QAAfA,eAAe;EAAA,OAEf,IAAAC,iBAAO,EAAC;IACNC,MAAM,EAAE,MAAM;IACdC,GAAG,YA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EAALA;EACF,CAAC,CAAC,CACCW,IAAI,CAAC,UAACW,aAAa;IAAA,OAClB,IAAAlB,iBAAO,EAAC;MACNC,MAAM,EAAE,KAAK;MACbC,GAAG,YAAK8B,kBAAkB,2BAAwB;MAClDK,EAAE,EAAE;QACFH,gBAAgB,EAAhBA,gBAAgB;QAChBC,UAAU,EAAVA,UAAU;QACVG,qBAAqB,EAAE;MACzB,CAAC;MACDrB,OAAO,EAAE;QACPC,aAAa,EAAbA;MACF;IACF,CAAC,CAAC;EAAA,EACH,CACAX,IAAI,CAAC,UAACC,GAAG;IAAA;MACRF,QAAQ,EAAEE,GAAG,CAACJ,IAAI,CAACmC,gBAAgB,CAACC,UAAU;MAC9CC,YAAY,EAAEjC,GAAG,CAACJ,IAAI,CAACmC,gBAAgB,CAACG,IAAI;MAC5CC,WAAW,EAAEnC,GAAG,CAACJ,IAAI,CAACmC,gBAAgB,CAACK,aAAa;MACpDC,KAAK,EAAErC,GAAG,CAACJ,IAAI,CAACmC,gBAAgB,CAACO,aAAa;MAC9CC,cAAc,EAAEvC,GAAG,CAACJ,IAAI,CAAC2C;IAAc,GACpCvC,GAAG,CAACJ,IAAI,CAACmC,gBAAgB;EAAA,CAC5B,CAAC;AACP;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASS,cAAc,GAAe;EAAA,IAAdzB,OAAO,uEAAG,CAAC,CAAC;EACzC,OAAO,IAAAvB,iBAAO,EAAC;IACbC,MAAM,EAAE,QAAQ;IAChBgB,OAAO,EAAE;MACPC,aAAa,mBAAYK,OAAO,CAACsB,KAAK;IACxC,CAAC;IACD3C,GAAG,EAAEqB,OAAO,CAACwB;EACf,CAAC,CAAC;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/test-users",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.16",
|
|
4
4
|
"description": "Cisco Webex Test Users",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"chai-as-promised": "^7.1.1"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@webex/http-core": "3.0.0-beta.
|
|
28
|
-
"@webex/test-helper-mocha": "3.0.0-beta.
|
|
29
|
-
"@webex/test-users": "3.0.0-beta.
|
|
27
|
+
"@webex/http-core": "3.0.0-beta.16",
|
|
28
|
+
"@webex/test-helper-mocha": "3.0.0-beta.16",
|
|
29
|
+
"@webex/test-users": "3.0.0-beta.16",
|
|
30
30
|
"btoa": "^1.2.1",
|
|
31
31
|
"lodash": "^4.17.21",
|
|
32
32
|
"node-random-name": "^1.0.1",
|