@webex/internal-plugin-calendar 3.0.0-beta.123 → 3.0.0-beta.124
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/calendar.js +17 -7
- package/dist/calendar.js.map +1 -1
- package/package.json +10 -10
- package/src/calendar.js +17 -6
- package/test/unit/spec/calendar.js +25 -4
package/dist/calendar.js
CHANGED
|
@@ -231,15 +231,25 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
231
231
|
});
|
|
232
232
|
},
|
|
233
233
|
/**
|
|
234
|
-
* Retrieves an array of meeting participants for the meeting
|
|
235
|
-
* @param {String}
|
|
234
|
+
* Retrieves an array of meeting participants for the meeting participantsUrl
|
|
235
|
+
* @param {String} participantsUrl
|
|
236
236
|
* @returns {Promise} Resolves with an object of meeting participants
|
|
237
237
|
*/
|
|
238
|
-
getParticipants: function getParticipants(
|
|
238
|
+
getParticipants: function getParticipants(participantsUrl) {
|
|
239
239
|
return this.request({
|
|
240
240
|
method: 'GET',
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
uri: participantsUrl
|
|
242
|
+
});
|
|
243
|
+
},
|
|
244
|
+
/**
|
|
245
|
+
* get meeting notes using notesUrl from meeting object.
|
|
246
|
+
* @param {String} notesUrl
|
|
247
|
+
* @returns {Promise} Resolves with an object of meeting notes
|
|
248
|
+
*/
|
|
249
|
+
getNotesByUrl: function getNotesByUrl(notesUrl) {
|
|
250
|
+
return this.request({
|
|
251
|
+
method: 'GET',
|
|
252
|
+
uri: notesUrl
|
|
243
253
|
});
|
|
244
254
|
},
|
|
245
255
|
/**
|
|
@@ -274,7 +284,7 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
274
284
|
var promises = [];
|
|
275
285
|
meetingObjects.forEach(function (meeting) {
|
|
276
286
|
if (!meeting.encryptedParticipants) {
|
|
277
|
-
promises.push(_this4.getParticipants(meeting.
|
|
287
|
+
promises.push(_this4.getParticipants(meeting.participantsUrl).then(function (notesResponse) {
|
|
278
288
|
meeting.encryptedParticipants = notesResponse.body.encryptedParticipants;
|
|
279
289
|
}));
|
|
280
290
|
}
|
|
@@ -284,7 +294,7 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
284
294
|
});
|
|
285
295
|
});
|
|
286
296
|
},
|
|
287
|
-
version: "3.0.0-beta.
|
|
297
|
+
version: "3.0.0-beta.124"
|
|
288
298
|
});
|
|
289
299
|
var _default = Calendar;
|
|
290
300
|
exports.default = _default;
|
package/dist/calendar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Calendar","WebexPlugin","extend","namespace","registered","register","webex","canAuthorize","logger","error","reject","Error","info","resolve","internal","device","then","mercury","connect","listenForEvents","trigger","CALENDAR_REGISTERED","catch","message","unregister","stopListeningForEvents","disconnect","CALENDAR_UNREGISTERED","on","envelope","_handleCreate","data","_handleUpdate","_handleDelete","off","id","CalendarCollection","set","calendarMeetingExternal","CALENDAR_UPDATED","get","CALENDAR_CREATE","item","remove","CALENDAR_DELETE","syncCalendar","options","fromDate","config","toDate","list","res","setAll","getAll","getByType","key","value","includes","getBy","processMeetingEvent","event","transform","getParticipants","request","method","service","resource","btoa","getNotes","qs","meetingObjects","body","items","promises","forEach","meeting","encryptedParticipants","push","notesResponse","all"],"sources":["calendar.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/**\n * Calendar Item Create Event\n * Emitted when a calendar item has been added\n * @event calendar:meeting:create\n * @instance\n * @memberof Calendar\n */\n\n/**\n * Calendar Item Update Event\n * Emitted when a calendar item has been updated\n * @event calendar:meeting:update\n * @instance\n * @memberof Calendar\n */\n\n/**\n * Calendar Item Update Event\n * Emitted when a calendar item has been deleted\n * @event calendar:meeting:delete\n * @instance\n * @memberof Calendar\n */\n\n/**\n * Calendar Registered Event\n * Emitted when the calendar instance has been registered and listening\n * @event calendar:registered\n * @instance\n * @memberof Calendar\n */\n\n/**\n * Calendar Registered Event\n * Emitted when the calendar instance has been registered and listening\n * @event calendar:unregistered\n * @instance\n * @memberof Calendar\n */\n\nimport btoa from 'btoa';\nimport {WebexPlugin} from '@webex/webex-core';\n\nimport CalendarCollection from './collection';\nimport {\n CALENDAR_REGISTERED,\n CALENDAR_UNREGISTERED,\n CALENDAR_DELETE,\n CALENDAR_CREATE,\n CALENDAR_UPDATED,\n} from './constants';\n\nconst Calendar = WebexPlugin.extend({\n namespace: 'Calendar',\n\n /**\n * registered value indicating events registration is successful\n * @instance\n * @type {Boolean}\n * @memberof Calendar\n */\n registered: false,\n\n /**\n * Explicitly sets up the calendar plugin by registering\n * the device, connecting to mercury, and listening for calendar events.\n * @returns {Promise}\n * @public\n * @memberof Calendar\n */\n register() {\n if (!this.webex.canAuthorize) {\n this.logger.error('calendar->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('calendar->register#INFO, Calendar plugin already registered');\n\n return Promise.resolve();\n }\n\n return this.webex.internal.device\n .register()\n .then(() => this.webex.internal.mercury.connect())\n .then(() => {\n this.listenForEvents();\n this.trigger(CALENDAR_REGISTERED);\n this.registered = true;\n })\n .catch((error) => {\n this.logger.error(`calendar->register#ERROR, Unable to register, ${error.message}`);\n\n return Promise.reject(error);\n });\n },\n\n /**\n * Explicitly tears down the calendar plugin by deregistering\n * the device, disconnecting from mercury, and stops listening to calendar events\n *\n * @returns {Promise}\n * @public\n * @memberof Calendar\n */\n unregister() {\n if (!this.registered) {\n this.logger.info('calendar->unregister#INFO, Calendar plugin already unregistered');\n\n return Promise.resolve();\n }\n\n this.stopListeningForEvents();\n\n return this.webex.internal.mercury\n .disconnect()\n .then(() => this.webex.internal.device.unregister())\n .then(() => {\n this.trigger(CALENDAR_UNREGISTERED);\n this.registered = false;\n });\n },\n\n /**\n * registers for calendar events through mercury\n * @returns {undefined}\n * @private\n */\n listenForEvents() {\n // Calendar mercury events listener\n this.webex.internal.mercury.on('event:calendar.meeting.create', (envelope) => {\n this._handleCreate(envelope.data);\n });\n this.webex.internal.mercury.on('event:calendar.meeting.update', (envelope) => {\n this._handleUpdate(envelope.data);\n });\n this.webex.internal.mercury.on('event:calendar.meeting.create.minimal', (envelope) => {\n this._handleCreate(envelope.data);\n });\n this.webex.internal.mercury.on('event:calendar.meeting.update.minimal', (envelope) => {\n this._handleUpdate(envelope.data);\n });\n this.webex.internal.mercury.on('event:calendar.meeting.delete', (envelope) => {\n this._handleDelete(envelope.data);\n });\n },\n\n /**\n * unregisteres all the calendar events from mercury\n * @returns {undefined}\n * @private\n */\n stopListeningForEvents() {\n this.webex.internal.mercury.off('event:calendar.meeting.create');\n this.webex.internal.mercury.off('event:calendar.meeting.create.minimal');\n this.webex.internal.mercury.off('event:calendar.meeting.update');\n this.webex.internal.mercury.off('event:calendar.meeting.update.minimal');\n this.webex.internal.mercury.off('event:calendar.meeting.delete');\n },\n\n /**\n * handles update events, triggers after collection updates\n * @param {Object} data\n * @returns {undefined}\n * @private\n */\n _handleUpdate(data) {\n const id = CalendarCollection.set(data.calendarMeetingExternal);\n\n this.trigger(CALENDAR_UPDATED, CalendarCollection.get(id));\n },\n\n /**\n * handles create events, triggers after collection updates\n * @param {Object} data\n * @returns {undefined}\n * @private\n */\n _handleCreate(data) {\n const id = CalendarCollection.set(data.calendarMeetingExternal);\n\n this.trigger(CALENDAR_CREATE, CalendarCollection.get(id));\n },\n\n /**\n * handles delete events, triggers after collection updates\n * @param {Object} data\n * @returns {undefined}\n * @private\n */\n _handleDelete(data) {\n const item = CalendarCollection.remove(data.calendarMeetingExternal.id);\n\n this.trigger(CALENDAR_DELETE, item);\n },\n\n /**\n * Retrieves a collection of calendars based on the request parameters\n * Defaults to 1 day before and 7 days ahead\n * @param {Object} options\n * @param {Date} options.fromDate the start of the time range\n * @param {Date} options.toDate the end of the time range\n * @returns {Promise} Resolves with an array of calendars\n */\n syncCalendar(options = {fromDate: this.config.fromDate, toDate: this.config.toDate}) {\n return this.list({fromDate: options.fromDate, toDate: options.toDate}).then((res) => {\n CalendarCollection.setAll(res);\n\n return CalendarCollection.getAll();\n });\n },\n /**\n * get the calendar item that has a matching value\n * @param {String} key meeting property\n * @param {Any} value the meeting property to match\n * @returns {Object}\n */\n getByType(key, value) {\n if (['spaceURI', 'spaceMeetURL', 'conversationId'].includes(key)) {\n return CalendarCollection.getBy(key, value);\n }\n throw new Error('key must be one of, spaceURI, spaceMeetURL, or conversationId');\n },\n\n /**\n * gets all the calendar items that have been populated\n * @returns {Object}\n */\n getAll() {\n return CalendarCollection.getAll();\n },\n\n /**\n * Decrypts an encrypted incoming calendar event\n * @param {Object} event\n * @returns {Promise} Resolves with a decrypted calendar event\n */\n processMeetingEvent(event) {\n return this.webex.transform('inbound', event).then(() => event);\n },\n\n /**\n * Retrieves an array of meeting participants for the meeting id\n * @param {String} id\n * @returns {Promise} Resolves with an object of meeting participants\n */\n getParticipants(id) {\n return this.request({\n method: 'GET',\n service: 'calendar',\n resource: `calendarEvents/${btoa(id)}/participants`,\n });\n },\n\n /**\n * Retrieves a collection of meetings based on the request parameters\n * @param {String} id\n * @returns {Promise} Resolves with an object of meeting notes\n */\n getNotes(id) {\n return this.request({\n method: 'GET',\n service: 'calendar',\n resource: `calendarEvents/${btoa(id)}/notes`,\n });\n },\n\n /**\n * Retrieves a collection of meetings based on the request parameters\n * @param {Object} options\n * @param {Date} options.fromDate the start of the time range\n * @param {Date} options.toDate the end of the time range\n * @returns {Promise} Resolves with an array of meetings\n */\n list(options) {\n options = options || {};\n\n return this.webex\n .request({\n method: 'GET',\n service: 'calendar',\n resource: 'calendarEvents',\n qs: options,\n })\n .then((res) => {\n const meetingObjects = res.body.items;\n const promises = [];\n\n meetingObjects.forEach((meeting) => {\n if (!meeting.encryptedParticipants) {\n promises.push(\n this.getParticipants(meeting.id).then((notesResponse) => {\n meeting.encryptedParticipants = notesResponse.body.encryptedParticipants;\n })\n );\n }\n });\n\n return Promise.all(promises).then(() => meetingObjects);\n });\n },\n});\n\nexport default Calendar;\n"],"mappings":";;;;;;;;;AA4CA;AACA;AAEA;AACA;AAhDA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA,IAAMA,QAAQ,GAAGC,sBAAW,CAACC,MAAM,CAAC;EAClCC,SAAS,EAAE,UAAU;EAErB;AACF;AACA;AACA;AACA;AACA;EACEC,UAAU,EAAE,KAAK;EAEjB;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,QAAQ,sBAAG;IAAA;IACT,IAAI,CAAC,IAAI,CAACC,KAAK,CAACC,YAAY,EAAE;MAC5B,IAAI,CAACC,MAAM,CAACC,KAAK,CAAC,oEAAoE,CAAC;MAEvF,OAAO,iBAAQC,MAAM,CAAC,IAAIC,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1D;IAEA,IAAI,IAAI,CAACP,UAAU,EAAE;MACnB,IAAI,CAACI,MAAM,CAACI,IAAI,CAAC,6DAA6D,CAAC;MAE/E,OAAO,iBAAQC,OAAO,EAAE;IAC1B;IAEA,OAAO,IAAI,CAACP,KAAK,CAACQ,QAAQ,CAACC,MAAM,CAC9BV,QAAQ,EAAE,CACVW,IAAI,CAAC;MAAA,OAAM,KAAI,CAACV,KAAK,CAACQ,QAAQ,CAACG,OAAO,CAACC,OAAO,EAAE;IAAA,EAAC,CACjDF,IAAI,CAAC,YAAM;MACV,KAAI,CAACG,eAAe,EAAE;MACtB,KAAI,CAACC,OAAO,CAACC,8BAAmB,CAAC;MACjC,KAAI,CAACjB,UAAU,GAAG,IAAI;IACxB,CAAC,CAAC,CACDkB,KAAK,CAAC,UAACb,KAAK,EAAK;MAChB,KAAI,CAACD,MAAM,CAACC,KAAK,yDAAkDA,KAAK,CAACc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CAAC,UAAC8D,aAAa,EAAK;YACvDH,OAAO,CAACC,qBAAqB,GAAGE,aAAa,CAACP,IAAI,CAACK,qBAAqB;UAC1E,CAAC,CAAC,CACH;QACH;MACF,CAAC,CAAC;MAEF,OAAO,iBAAQG,GAAG,CAACN,QAAQ,CAAC,CAACzD,IAAI,CAAC;QAAA,OAAMsD,cAAc;MAAA,EAAC;IACzD,CAAC,CAAC;EACN,CAAC;EAAA;AACH,CAAC,CAAC;AAAC,eAEYtE,QAAQ;AAAA"}
|
|
1
|
+
{"version":3,"names":["Calendar","WebexPlugin","extend","namespace","registered","register","webex","canAuthorize","logger","error","reject","Error","info","resolve","internal","device","then","mercury","connect","listenForEvents","trigger","CALENDAR_REGISTERED","catch","message","unregister","stopListeningForEvents","disconnect","CALENDAR_UNREGISTERED","on","envelope","_handleCreate","data","_handleUpdate","_handleDelete","off","id","CalendarCollection","set","calendarMeetingExternal","CALENDAR_UPDATED","get","CALENDAR_CREATE","item","remove","CALENDAR_DELETE","syncCalendar","options","fromDate","config","toDate","list","res","setAll","getAll","getByType","key","value","includes","getBy","processMeetingEvent","event","transform","getParticipants","participantsUrl","request","method","uri","getNotesByUrl","notesUrl","getNotes","service","resource","btoa","qs","meetingObjects","body","items","promises","forEach","meeting","encryptedParticipants","push","notesResponse","all"],"sources":["calendar.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/**\n * Calendar Item Create Event\n * Emitted when a calendar item has been added\n * @event calendar:meeting:create\n * @instance\n * @memberof Calendar\n */\n\n/**\n * Calendar Item Update Event\n * Emitted when a calendar item has been updated\n * @event calendar:meeting:update\n * @instance\n * @memberof Calendar\n */\n\n/**\n * Calendar Item Update Event\n * Emitted when a calendar item has been deleted\n * @event calendar:meeting:delete\n * @instance\n * @memberof Calendar\n */\n\n/**\n * Calendar Registered Event\n * Emitted when the calendar instance has been registered and listening\n * @event calendar:registered\n * @instance\n * @memberof Calendar\n */\n\n/**\n * Calendar Registered Event\n * Emitted when the calendar instance has been registered and listening\n * @event calendar:unregistered\n * @instance\n * @memberof Calendar\n */\n\nimport btoa from 'btoa';\nimport {WebexPlugin} from '@webex/webex-core';\n\nimport CalendarCollection from './collection';\nimport {\n CALENDAR_REGISTERED,\n CALENDAR_UNREGISTERED,\n CALENDAR_DELETE,\n CALENDAR_CREATE,\n CALENDAR_UPDATED,\n} from './constants';\n\nconst Calendar = WebexPlugin.extend({\n namespace: 'Calendar',\n\n /**\n * registered value indicating events registration is successful\n * @instance\n * @type {Boolean}\n * @memberof Calendar\n */\n registered: false,\n\n /**\n * Explicitly sets up the calendar plugin by registering\n * the device, connecting to mercury, and listening for calendar events.\n * @returns {Promise}\n * @public\n * @memberof Calendar\n */\n register() {\n if (!this.webex.canAuthorize) {\n this.logger.error('calendar->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('calendar->register#INFO, Calendar plugin already registered');\n\n return Promise.resolve();\n }\n\n return this.webex.internal.device\n .register()\n .then(() => this.webex.internal.mercury.connect())\n .then(() => {\n this.listenForEvents();\n this.trigger(CALENDAR_REGISTERED);\n this.registered = true;\n })\n .catch((error) => {\n this.logger.error(`calendar->register#ERROR, Unable to register, ${error.message}`);\n\n return Promise.reject(error);\n });\n },\n\n /**\n * Explicitly tears down the calendar plugin by deregistering\n * the device, disconnecting from mercury, and stops listening to calendar events\n *\n * @returns {Promise}\n * @public\n * @memberof Calendar\n */\n unregister() {\n if (!this.registered) {\n this.logger.info('calendar->unregister#INFO, Calendar plugin already unregistered');\n\n return Promise.resolve();\n }\n\n this.stopListeningForEvents();\n\n return this.webex.internal.mercury\n .disconnect()\n .then(() => this.webex.internal.device.unregister())\n .then(() => {\n this.trigger(CALENDAR_UNREGISTERED);\n this.registered = false;\n });\n },\n\n /**\n * registers for calendar events through mercury\n * @returns {undefined}\n * @private\n */\n listenForEvents() {\n // Calendar mercury events listener\n this.webex.internal.mercury.on('event:calendar.meeting.create', (envelope) => {\n this._handleCreate(envelope.data);\n });\n this.webex.internal.mercury.on('event:calendar.meeting.update', (envelope) => {\n this._handleUpdate(envelope.data);\n });\n this.webex.internal.mercury.on('event:calendar.meeting.create.minimal', (envelope) => {\n this._handleCreate(envelope.data);\n });\n this.webex.internal.mercury.on('event:calendar.meeting.update.minimal', (envelope) => {\n this._handleUpdate(envelope.data);\n });\n this.webex.internal.mercury.on('event:calendar.meeting.delete', (envelope) => {\n this._handleDelete(envelope.data);\n });\n },\n\n /**\n * unregisteres all the calendar events from mercury\n * @returns {undefined}\n * @private\n */\n stopListeningForEvents() {\n this.webex.internal.mercury.off('event:calendar.meeting.create');\n this.webex.internal.mercury.off('event:calendar.meeting.create.minimal');\n this.webex.internal.mercury.off('event:calendar.meeting.update');\n this.webex.internal.mercury.off('event:calendar.meeting.update.minimal');\n this.webex.internal.mercury.off('event:calendar.meeting.delete');\n },\n\n /**\n * handles update events, triggers after collection updates\n * @param {Object} data\n * @returns {undefined}\n * @private\n */\n _handleUpdate(data) {\n const id = CalendarCollection.set(data.calendarMeetingExternal);\n\n this.trigger(CALENDAR_UPDATED, CalendarCollection.get(id));\n },\n\n /**\n * handles create events, triggers after collection updates\n * @param {Object} data\n * @returns {undefined}\n * @private\n */\n _handleCreate(data) {\n const id = CalendarCollection.set(data.calendarMeetingExternal);\n\n this.trigger(CALENDAR_CREATE, CalendarCollection.get(id));\n },\n\n /**\n * handles delete events, triggers after collection updates\n * @param {Object} data\n * @returns {undefined}\n * @private\n */\n _handleDelete(data) {\n const item = CalendarCollection.remove(data.calendarMeetingExternal.id);\n\n this.trigger(CALENDAR_DELETE, item);\n },\n\n /**\n * Retrieves a collection of calendars based on the request parameters\n * Defaults to 1 day before and 7 days ahead\n * @param {Object} options\n * @param {Date} options.fromDate the start of the time range\n * @param {Date} options.toDate the end of the time range\n * @returns {Promise} Resolves with an array of calendars\n */\n syncCalendar(options = {fromDate: this.config.fromDate, toDate: this.config.toDate}) {\n return this.list({fromDate: options.fromDate, toDate: options.toDate}).then((res) => {\n CalendarCollection.setAll(res);\n\n return CalendarCollection.getAll();\n });\n },\n /**\n * get the calendar item that has a matching value\n * @param {String} key meeting property\n * @param {Any} value the meeting property to match\n * @returns {Object}\n */\n getByType(key, value) {\n if (['spaceURI', 'spaceMeetURL', 'conversationId'].includes(key)) {\n return CalendarCollection.getBy(key, value);\n }\n throw new Error('key must be one of, spaceURI, spaceMeetURL, or conversationId');\n },\n\n /**\n * gets all the calendar items that have been populated\n * @returns {Object}\n */\n getAll() {\n return CalendarCollection.getAll();\n },\n\n /**\n * Decrypts an encrypted incoming calendar event\n * @param {Object} event\n * @returns {Promise} Resolves with a decrypted calendar event\n */\n processMeetingEvent(event) {\n return this.webex.transform('inbound', event).then(() => event);\n },\n\n /**\n * Retrieves an array of meeting participants for the meeting participantsUrl\n * @param {String} participantsUrl\n * @returns {Promise} Resolves with an object of meeting participants\n */\n getParticipants(participantsUrl) {\n return this.request({\n method: 'GET',\n uri: participantsUrl,\n });\n },\n\n /**\n * get meeting notes using notesUrl from meeting object.\n * @param {String} notesUrl\n * @returns {Promise} Resolves with an object of meeting notes\n */\n getNotesByUrl(notesUrl) {\n return this.request({\n method: 'GET',\n uri: notesUrl,\n });\n },\n\n /**\n * Retrieves a collection of meetings based on the request parameters\n * @param {String} id\n * @returns {Promise} Resolves with an object of meeting notes\n */\n getNotes(id) {\n return this.request({\n method: 'GET',\n service: 'calendar',\n resource: `calendarEvents/${btoa(id)}/notes`,\n });\n },\n\n /**\n * Retrieves a collection of meetings based on the request parameters\n * @param {Object} options\n * @param {Date} options.fromDate the start of the time range\n * @param {Date} options.toDate the end of the time range\n * @returns {Promise} Resolves with an array of meetings\n */\n list(options) {\n options = options || {};\n\n return this.webex\n .request({\n method: 'GET',\n service: 'calendar',\n resource: 'calendarEvents',\n qs: options,\n })\n .then((res) => {\n const meetingObjects = res.body.items;\n const promises = [];\n\n meetingObjects.forEach((meeting) => {\n if (!meeting.encryptedParticipants) {\n promises.push(\n this.getParticipants(meeting.participantsUrl).then((notesResponse) => {\n meeting.encryptedParticipants = notesResponse.body.encryptedParticipants;\n })\n );\n }\n });\n\n return Promise.all(promises).then(() => meetingObjects);\n });\n },\n});\n\nexport default Calendar;\n"],"mappings":";;;;;;;;;AA4CA;AACA;AAEA;AACA;AAhDA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA,IAAMA,QAAQ,GAAGC,sBAAW,CAACC,MAAM,CAAC;EAClCC,SAAS,EAAE,UAAU;EAErB;AACF;AACA;AACA;AACA;AACA;EACEC,UAAU,EAAE,KAAK;EAEjB;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,QAAQ,sBAAG;IAAA;IACT,IAAI,CAAC,IAAI,CAACC,KAAK,CAACC,YAAY,EAAE;MAC5B,IAAI,CAACC,MAAM,CAACC,KAAK,CAAC,oEAAoE,CAAC;MAEvF,OAAO,iBAAQC,MAAM,CAAC,IAAIC,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1D;IAEA,IAAI,IAAI,CAACP,UAAU,EAAE;MACnB,IAAI,CAACI,MAAM,CAACI,IAAI,CAAC,6DAA6D,CAAC;MAE/E,OAAO,iBAAQC,OAAO,EAAE;IAC1B;IAEA,OAAO,IAAI,CAACP,KAAK,CAACQ,QAAQ,CAACC,MAAM,CAC9BV,QAAQ,EAAE,CACVW,IAAI,CAAC;MAAA,OAAM,KAAI,CAACV,KAAK,CAACQ,QAAQ,CAACG,OAAO,CAACC,OAAO,EAAE;IAAA,EAAC,CACjDF,IAAI,CAAC,YAAM;MACV,KAAI,CAACG,eAAe,EAAE;MACtB,KAAI,CAACC,OAAO,CAACC,8BAAmB,CAAC;MACjC,KAAI,CAACj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CAACC,KAAK;MACrC,IAAMC,QAAQ,GAAG,EAAE;MAEnBH,cAAc,CAACI,OAAO,CAAC,UAACC,OAAO,EAAK;QAClC,IAAI,CAACA,OAAO,CAACC,qBAAqB,EAAE;UAClCH,QAAQ,CAACI,IAAI,CACX,MAAI,CAACnB,eAAe,CAACiB,OAAO,CAAChB,eAAe,CAAC,CAAC/C,IAAI,CAAC,UAACkE,aAAa,EAAK;YACpEH,OAAO,CAACC,qBAAqB,GAAGE,aAAa,CAACP,IAAI,CAACK,qBAAqB;UAC1E,CAAC,CAAC,CACH;QACH;MACF,CAAC,CAAC;MAEF,OAAO,iBAAQG,GAAG,CAACN,QAAQ,CAAC,CAAC7D,IAAI,CAAC;QAAA,OAAM0D,cAAc;MAAA,EAAC;IACzD,CAAC,CAAC;EACN,CAAC;EAAA;AACH,CAAC,CAAC;AAAC,eAEY1E,QAAQ;AAAA"}
|
package/package.json
CHANGED
|
@@ -19,20 +19,20 @@
|
|
|
19
19
|
"envify"
|
|
20
20
|
]
|
|
21
21
|
},
|
|
22
|
-
"version": "3.0.0-beta.
|
|
22
|
+
"version": "3.0.0-beta.124",
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@webex/test-helper-chai": "3.0.0-beta.
|
|
25
|
-
"@webex/test-helper-mock-webex": "3.0.0-beta.
|
|
26
|
-
"@webex/test-helper-retry": "3.0.0-beta.
|
|
27
|
-
"@webex/test-helper-test-users": "3.0.0-beta.
|
|
24
|
+
"@webex/test-helper-chai": "3.0.0-beta.124",
|
|
25
|
+
"@webex/test-helper-mock-webex": "3.0.0-beta.124",
|
|
26
|
+
"@webex/test-helper-retry": "3.0.0-beta.124",
|
|
27
|
+
"@webex/test-helper-test-users": "3.0.0-beta.124",
|
|
28
28
|
"sinon": "^9.2.4"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@webex/internal-plugin-calendar": "3.0.0-beta.
|
|
32
|
-
"@webex/internal-plugin-conversation": "3.0.0-beta.
|
|
33
|
-
"@webex/internal-plugin-device": "3.0.0-beta.
|
|
34
|
-
"@webex/internal-plugin-encryption": "3.0.0-beta.
|
|
35
|
-
"@webex/webex-core": "3.0.0-beta.
|
|
31
|
+
"@webex/internal-plugin-calendar": "3.0.0-beta.124",
|
|
32
|
+
"@webex/internal-plugin-conversation": "3.0.0-beta.124",
|
|
33
|
+
"@webex/internal-plugin-device": "3.0.0-beta.124",
|
|
34
|
+
"@webex/internal-plugin-encryption": "3.0.0-beta.124",
|
|
35
|
+
"@webex/webex-core": "3.0.0-beta.124",
|
|
36
36
|
"btoa": "^1.2.1",
|
|
37
37
|
"lodash": "^4.17.21",
|
|
38
38
|
"uuid": "^3.3.2"
|
package/src/calendar.js
CHANGED
|
@@ -245,15 +245,26 @@ const Calendar = WebexPlugin.extend({
|
|
|
245
245
|
},
|
|
246
246
|
|
|
247
247
|
/**
|
|
248
|
-
* Retrieves an array of meeting participants for the meeting
|
|
249
|
-
* @param {String}
|
|
248
|
+
* Retrieves an array of meeting participants for the meeting participantsUrl
|
|
249
|
+
* @param {String} participantsUrl
|
|
250
250
|
* @returns {Promise} Resolves with an object of meeting participants
|
|
251
251
|
*/
|
|
252
|
-
getParticipants(
|
|
252
|
+
getParticipants(participantsUrl) {
|
|
253
253
|
return this.request({
|
|
254
254
|
method: 'GET',
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
uri: participantsUrl,
|
|
256
|
+
});
|
|
257
|
+
},
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* get meeting notes using notesUrl from meeting object.
|
|
261
|
+
* @param {String} notesUrl
|
|
262
|
+
* @returns {Promise} Resolves with an object of meeting notes
|
|
263
|
+
*/
|
|
264
|
+
getNotesByUrl(notesUrl) {
|
|
265
|
+
return this.request({
|
|
266
|
+
method: 'GET',
|
|
267
|
+
uri: notesUrl,
|
|
257
268
|
});
|
|
258
269
|
},
|
|
259
270
|
|
|
@@ -294,7 +305,7 @@ const Calendar = WebexPlugin.extend({
|
|
|
294
305
|
meetingObjects.forEach((meeting) => {
|
|
295
306
|
if (!meeting.encryptedParticipants) {
|
|
296
307
|
promises.push(
|
|
297
|
-
this.getParticipants(meeting.
|
|
308
|
+
this.getParticipants(meeting.participantsUrl).then((notesResponse) => {
|
|
298
309
|
meeting.encryptedParticipants = notesResponse.body.encryptedParticipants;
|
|
299
310
|
})
|
|
300
311
|
);
|
|
@@ -291,7 +291,7 @@ describe('internal-plugin-calendar', () => {
|
|
|
291
291
|
});
|
|
292
292
|
|
|
293
293
|
describe('#getParticipants()', () => {
|
|
294
|
-
const
|
|
294
|
+
const uri = 'participantsUrl';
|
|
295
295
|
|
|
296
296
|
it('should fetch the meeting participants', async () => {
|
|
297
297
|
webex.request = sinon.stub().returns(
|
|
@@ -302,13 +302,34 @@ describe('internal-plugin-calendar', () => {
|
|
|
302
302
|
})
|
|
303
303
|
);
|
|
304
304
|
|
|
305
|
-
const res = await webex.internal.calendar.getParticipants(
|
|
305
|
+
const res = await webex.internal.calendar.getParticipants(uri);
|
|
306
306
|
|
|
307
307
|
assert.equal(res.body.encryptedParticipants.length, 1);
|
|
308
308
|
assert.calledWith(webex.request, {
|
|
309
309
|
method: 'GET',
|
|
310
|
-
|
|
311
|
-
|
|
310
|
+
uri,
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
describe('#getNotesByUrl()', () => {
|
|
316
|
+
const uri = 'notesUrl';
|
|
317
|
+
|
|
318
|
+
it('should fetch the meeting notes', async () => {
|
|
319
|
+
webex.request = sinon.stub().returns(
|
|
320
|
+
Promise.resolve({
|
|
321
|
+
body: {
|
|
322
|
+
encryptedParticipants: ['participant1'],
|
|
323
|
+
},
|
|
324
|
+
})
|
|
325
|
+
);
|
|
326
|
+
|
|
327
|
+
const res = await webex.internal.calendar.getNotesByUrl(uri);
|
|
328
|
+
|
|
329
|
+
assert.equal(res.body.encryptedParticipants.length, 1);
|
|
330
|
+
assert.calledWith(webex.request, {
|
|
331
|
+
method: 'GET',
|
|
332
|
+
uri,
|
|
312
333
|
});
|
|
313
334
|
});
|
|
314
335
|
});
|