@webex/test-users 1.160.0 → 1.161.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/whistler.js CHANGED
@@ -108,6 +108,8 @@ function createTestUser() {
108
108
  var idbrokerUrl = options.idbrokerUrl || process.env.IDBROKER_BASE_URL;
109
109
  var orgId = options.orgId || process.env.WHISTLER_TEST_ORG_ID;
110
110
  var whistlerServiceUrl = options.whistlerServiceUrl || process.env.WHISTLER_API_SERVICE_URL;
111
+ var reservationGroup = options.reservationGroup,
112
+ userScopes = options.userScopes;
111
113
 
112
114
  if (!clientId) {
113
115
  throw new Error('options.clientId or process.env.WEBEX_CLIENT_ID must be defined');
@@ -135,7 +137,9 @@ function createTestUser() {
135
137
 
136
138
  if (!whistlerServiceUrl) {
137
139
  throw new Error('options.whistlerServiceUrl or process.env.WHISTLER_API_SERVICE_URL must be defined');
138
- }
140
+ } // For reservation groups and user scopes
141
+ // Please check https://confluence-eng-gpk2.cisco.com/conf/pages/viewpage.action?spaceKey=LOCUS&title=Whistler+APIs#WhistlerAPIs-GET/reservations/testUser
142
+
139
143
 
140
144
  return getClientCredentials({
141
145
  clientId: clientId,
@@ -147,7 +151,12 @@ function createTestUser() {
147
151
  }).then(function (authorization) {
148
152
  return (0, _httpCore.request)({
149
153
  method: 'GET',
150
- uri: "".concat(whistlerServiceUrl, "/reservations/testUser?isAccessTokenRequired=true"),
154
+ uri: "".concat(whistlerServiceUrl, "/reservations/testUser"),
155
+ qs: {
156
+ reservationGroup: reservationGroup,
157
+ userScopes: userScopes,
158
+ isAccessTokenRequired: true
159
+ },
151
160
  headers: {
152
161
  authorization: authorization
153
162
  }
@@ -1 +1 @@
1
- {"version":3,"names":["getClientCredentials","clientId","clientSecret","orgId","idbrokerUrl","machineAccount","machinePassword","method","uri","json","body","uid","password","then","res","form","assertion","BearerToken","grant_type","scope","self_contained_token","client_id","client_secret","headers","authorization","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","Error","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}) => 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) => 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 .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\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('options.machineAccount or process.env.WHISTLER_MACHINE_ACCOUNT must be defined');\n }\n\n if (!machinePassword) {\n throw new Error('options.machinePassword or process.env.WHISTLER_MACHINE_PASSWORD must be defined');\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('options.whistlerServiceUrl or process.env.WHISTLER_API_SERVICE_URL must be defined');\n }\n\n return getClientCredentials({\n clientId,\n clientSecret,\n machineAccount,\n machinePassword,\n idbrokerUrl,\n orgId\n })\n .then((authorization) => request({\n method: 'GET',\n uri: `${whistlerServiceUrl}/reservations/testUser?isAccessTokenRequired=true`,\n headers: {\n authorization\n }\n }))\n .then((res) => Object.assign({\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 * @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,OAOvB,uBAAQ;IACZC,MAAM,EAAE,MADI;IAEZC,GAAG,YAAKJ,WAAL,wBAA8BD,KAA9B,sCAFS;IAGZM,IAAI,EAAE,IAHM;IAIZC,IAAI,EAAE;MACJC,GAAG,EAAEN,cADD;MAEJO,QAAQ,EAAEN;IAFN;EAJM,CAAR,EASHO,IATG,CASE,UAACC,GAAD;IAAA,OAAS,uBAAQ;MACrBP,MAAM,EAAE,MADa;MAErBC,GAAG,YAAKJ,WAAL,gCAFkB;MAGrBK,IAAI,EAAE,IAHe;MAIrBM,IAAI,EAAE;QACJC,SAAS,EAAEF,G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MAG3BC,WAAW,EAAE9B,GAAG,CAACJ,IAAJ,CAAS8B,gBAAT,CAA0BK,aAHZ;MAI3BC,KAAK,EAAEhC,GAAG,CAACJ,IAAJ,CAAS8B,gBAAT,CAA0BO,aAJN;MAK3BC,cAAc,EAAElC,GAAG,CAACJ,IAAJ,CAASsC;IALE,CAAd,EAMZlC,GAAG,CAACJ,IAAJ,CAAS8B,gBANG,CAAT;EAAA,CAfD,CAAP;AAsBD;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASS,cAAT,GAAsC;EAAA,IAAdrB,OAAc,uEAAJ,EAAI;EAC3C,OAAO,uBAAQ;IACbrB,MAAM,EAAE,QADK;IAEbgB,OAAO,EAAE;MACPC,aAAa,mBAAYI,OAAO,CAACkB,KAApB;IADN,CAFI;IAKbtC,GAAG,EAAEoB,OAAO,CAACoB;EALA,CAAR,CAAP;AAOD"}
1
+ {"version":3,"names":["getClientCredentials","clientId","clientSecret","orgId","idbrokerUrl","machineAccount","machinePassword","method","uri","json","body","uid","password","then","res","form","assertion","BearerToken","grant_type","scope","self_contained_token","client_id","client_secret","headers","authorization","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}) => 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) => 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 .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('options.machineAccount or process.env.WHISTLER_MACHINE_ACCOUNT must be defined');\n }\n\n if (!machinePassword) {\n throw new Error('options.machinePassword or process.env.WHISTLER_MACHINE_PASSWORD must be defined');\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('options.whistlerServiceUrl or process.env.WHISTLER_API_SERVICE_URL must be defined');\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) => 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 .then((res) => Object.assign({\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 * @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,OAOvB,uBAAQ;IACZC,MAAM,EAAE,MADI;IAEZC,GAAG,YAAKJ,WAAL,wBAA8BD,KAA9B,sCAFS;IAGZM,IAAI,EAAE,IAHM;IAIZC,IAAI,EAAE;MACJC,GAAG,EAAEN,cADD;MAEJO,QAAQ,EAAEN;IAFN;EAJM,CAAR,EASHO,IATG,CASE,UAACC,GAAD;IAAA,OAAS,uBAAQ;MACrBP,MAAM,EAAE,MADa;MAErBC,GAAG,YAAKJ,WAAL,gCAFkB;MAGrBK,IAAI,EAAE,IAHe;MAIrBM,IAAI,EAAE;QACJC,SAAS,EAAEF,GAAG,CAACJ,IAAJ,CAASO,WADhB;QAEJC,UAAU,EAAE,+CAFR;QAGJC,KAAK,EAAE,gDAHH;QAIJC,oBAAoB,EAAE,IAJlB;QAKJC,SAAS,EAAEpB,QALP;QAMJqB,aAAa,EAAEpB;MANX,CAJe;MAYrBqB,OAAO,EAAE;QACP;QACA;QACA;QACA;QACAC,aAAa,EAAE,6BAAQvB,QAAR,cAAoBC,YAApB;MALR;IAZY,CAAR,CAAT;EAAA,CATF,EA6BHW,IA7BG,CA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3BC,KAAK,EAAEpC,GAAG,CAACJ,IAAJ,CAASkC,gBAAT,CAA0BO,aAJN;MAK3BC,cAAc,EAAEtC,GAAG,CAACJ,IAAJ,CAAS0C;IALE,CAAd,EAMZtC,GAAG,CAACJ,IAAJ,CAASkC,gBANG,CAAT;EAAA,CApBD,CAAP;AA2BD;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASS,cAAT,GAAsC;EAAA,IAAdzB,OAAc,uEAAJ,EAAI;EAC3C,OAAO,uBAAQ;IACbrB,MAAM,EAAE,QADK;IAEbgB,OAAO,EAAE;MACPC,aAAa,mBAAYI,OAAO,CAACsB,KAApB;IADN,CAFI;IAKb1C,GAAG,EAAEoB,OAAO,CAACwB;EALA,CAAR,CAAP;AAOD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/test-users",
3
- "version": "1.160.0",
3
+ "version": "1.161.0",
4
4
  "description": "Cisco Webex Test Users",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -20,7 +20,7 @@
20
20
  "uuid": "^3.3.2",
21
21
  "btoa": "^1.2.1",
22
22
  "node-random-name": "^1.0.1",
23
- "@webex/http-core": "1.160.0",
23
+ "@webex/http-core": "1.161.0",
24
24
  "envify": "^4.1.0"
25
25
  }
26
26
  }
package/src/whistler.js CHANGED
@@ -87,6 +87,7 @@ export default function createTestUser(options = {}) {
87
87
  const idbrokerUrl = options.idbrokerUrl || process.env.IDBROKER_BASE_URL;
88
88
  const orgId = options.orgId || process.env.WHISTLER_TEST_ORG_ID;
89
89
  const whistlerServiceUrl = options.whistlerServiceUrl || process.env.WHISTLER_API_SERVICE_URL;
90
+ const {reservationGroup, userScopes} = options;
90
91
 
91
92
  if (!clientId) {
92
93
  throw new Error('options.clientId or process.env.WEBEX_CLIENT_ID must be defined');
@@ -115,6 +116,8 @@ export default function createTestUser(options = {}) {
115
116
  throw new Error('options.whistlerServiceUrl or process.env.WHISTLER_API_SERVICE_URL must be defined');
116
117
  }
117
118
 
119
+ // For reservation groups and user scopes
120
+ // Please check https://confluence-eng-gpk2.cisco.com/conf/pages/viewpage.action?spaceKey=LOCUS&title=Whistler+APIs#WhistlerAPIs-GET/reservations/testUser
118
121
  return getClientCredentials({
119
122
  clientId,
120
123
  clientSecret,
@@ -125,7 +128,12 @@ export default function createTestUser(options = {}) {
125
128
  })
126
129
  .then((authorization) => request({
127
130
  method: 'GET',
128
- uri: `${whistlerServiceUrl}/reservations/testUser?isAccessTokenRequired=true`,
131
+ uri: `${whistlerServiceUrl}/reservations/testUser`,
132
+ qs: {
133
+ reservationGroup,
134
+ userScopes,
135
+ isAccessTokenRequired: true
136
+ },
129
137
  headers: {
130
138
  authorization
131
139
  }