@webex/internal-plugin-calendar 3.0.0-bnr.5 → 3.0.0-next.1
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/.eslintrc.js +6 -0
- package/babel.config.js +3 -0
- package/dist/calendar.decrypt.helper.js +8 -3
- package/dist/calendar.decrypt.helper.js.map +1 -1
- package/dist/calendar.encrypt.helper.js +11 -8
- package/dist/calendar.encrypt.helper.js.map +1 -1
- package/dist/calendar.js +236 -33
- package/dist/calendar.js.map +1 -1
- package/dist/collection.js +3 -4
- package/dist/collection.js.map +1 -1
- package/dist/config.js +1 -2
- package/dist/config.js.map +1 -1
- package/dist/constants.js +6 -12
- package/dist/constants.js.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/util.js +3 -4
- package/dist/util.js.map +1 -1
- package/jest.config.js +3 -0
- package/package.json +28 -13
- package/process +1 -0
- package/src/calendar.decrypt.helper.js +121 -0
- package/src/calendar.encrypt.helper.js +98 -0
- package/src/calendar.js +223 -17
- package/src/index.js +27 -3
- package/test/unit/spec/calendar.decrypt.helper.js +145 -0
- package/test/unit/spec/calendar.encrypt.helper.js +52 -0
- package/test/unit/spec/calendar.js +211 -47
- package/dist/internal-plugin-calendar.d.ts +0 -4
- package/dist/tsdoc-metadata.json +0 -11
- package/dist/types/calendar.d.ts +0 -2
- package/dist/types/collection.d.ts +0 -58
- package/dist/types/config.d.ts +0 -7
- package/dist/types/constants.d.ts +0 -6
- package/dist/types/index.d.ts +0 -1
- package/dist/types/util.d.ts +0 -15
package/.eslintrc.js
ADDED
package/babel.config.js
ADDED
|
@@ -7,6 +7,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
10
|
+
var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
|
|
10
11
|
var _decryptTextProp = function _decryptTextProp(ctx, name, key, object) {
|
|
11
12
|
if (!object[name]) {
|
|
12
13
|
return _promise.default.resolve();
|
|
@@ -35,10 +36,15 @@ var DecryptHelper = {
|
|
|
35
36
|
return _promise.default.all([_decryptTextProp(ctx, 'encryptedEmailAddress', data.encryptionKeyUrl, participant), _decryptTextProp(ctx, 'encryptedName', data.encryptionKeyUrl, participant)]);
|
|
36
37
|
}) : [];
|
|
37
38
|
|
|
39
|
+
// Decrypt encryptedScheduleFor properties if meeting object contains SOB
|
|
40
|
+
var decryptedScheduleFor = _promise.default.all((0, _values.default)(data.encryptedScheduleFor || {}).flatMap(function (item) {
|
|
41
|
+
return [_decryptTextProp(ctx, 'encryptedEmail', data.encryptionKeyUrl, item), _decryptTextProp(ctx, 'encryptedDisplayName', data.encryptionKeyUrl, item)];
|
|
42
|
+
}));
|
|
43
|
+
|
|
38
44
|
// Decrypt meetingJoinInfo properties if meeting object contains meetingJoinInfo
|
|
39
45
|
var decryptedMeetingJoinInfo = data.meetingJoinInfo ? _promise.default.all([_decryptTextProp(ctx, 'meetingJoinURI', data.encryptionKeyUrl, data.meetingJoinInfo), _decryptTextProp(ctx, 'meetingJoinURL', data.encryptionKeyUrl, data.meetingJoinInfo)]) : [];
|
|
40
46
|
var decryptedOrganizer = data.encryptedOrganizer ? _promise.default.all([_decryptTextProp(ctx, 'encryptedEmailAddress', data.encryptionKeyUrl, data.encryptedOrganizer), _decryptTextProp(ctx, 'encryptedName', data.encryptionKeyUrl, data.encryptedOrganizer)]) : [];
|
|
41
|
-
return _promise.default.all([_decryptTextProp(ctx, 'encryptedSubject', data.encryptionKeyUrl, data), _decryptTextProp(ctx, 'encryptedLocation', data.encryptionKeyUrl, data), _decryptTextProp(ctx, 'encryptedNotes', data.encryptionKeyUrl, data), _decryptTextProp(ctx, 'webexURI', data.encryptionKeyUrl, data), _decryptTextProp(ctx, 'webexURL', data.encryptionKeyUrl, data), _decryptTextProp(ctx, 'spaceMeetURL', data.encryptionKeyUrl, data), _decryptTextProp(ctx, 'spaceURI', data.encryptionKeyUrl, data), _decryptTextProp(ctx, 'spaceURL', data.encryptionKeyUrl, data)].concat(decryptedOrganizer, decryptedParticipants, decryptedMeetingJoinInfo));
|
|
47
|
+
return _promise.default.all([_decryptTextProp(ctx, 'encryptedSubject', data.encryptionKeyUrl, data), _decryptTextProp(ctx, 'encryptedLocation', data.encryptionKeyUrl, data), _decryptTextProp(ctx, 'encryptedNotes', data.encryptionKeyUrl, data), _decryptTextProp(ctx, 'webexURI', data.encryptionKeyUrl, data), _decryptTextProp(ctx, 'webexURL', data.encryptionKeyUrl, data), _decryptTextProp(ctx, 'spaceMeetURL', data.encryptionKeyUrl, data), _decryptTextProp(ctx, 'spaceURI', data.encryptionKeyUrl, data), _decryptTextProp(ctx, 'spaceURL', data.encryptionKeyUrl, data)].concat(decryptedOrganizer, decryptedParticipants, decryptedScheduleFor, decryptedMeetingJoinInfo));
|
|
42
48
|
},
|
|
43
49
|
/**
|
|
44
50
|
* Decrypt free-busy response
|
|
@@ -62,6 +68,5 @@ var DecryptHelper = {
|
|
|
62
68
|
return _promise.default.all([].concat(calendarFreeBusyItems));
|
|
63
69
|
}
|
|
64
70
|
};
|
|
65
|
-
var _default = DecryptHelper;
|
|
66
|
-
exports.default = _default;
|
|
71
|
+
var _default = exports.default = DecryptHelper;
|
|
67
72
|
//# sourceMappingURL=calendar.decrypt.helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_decryptTextProp","ctx","name","key","object","_promise","default","resolve","webex","internal","encryption","decryptText","uri","then","plaintext","DecryptHelper","decryptSchedulerDataResponse","data","encryptionKeyUrl","decryptedParticipants","encryptedParticipants","map","participant","all","decryptedMeetingJoinInfo","meetingJoinInfo","decryptedOrganizer","encryptedOrganizer","concat","decryptFreeBusyResponse","calendarFreeBusyScheduleResponse","calendarFreeBusyItems","calendarFreeBusyItem","_default","exports"],"sources":["calendar.decrypt.helper.js"],"sourcesContent":["const _decryptTextProp = (ctx, name, key, object) => {\n if (!object[name]) {\n return Promise.resolve();\n }\n\n return ctx.webex.internal.encryption\n .decryptText(key.uri || key, object[name])\n .then((plaintext) => {\n object[name] = plaintext;\n });\n};\n\nconst DecryptHelper = {\n /**\n * Decrypt scheduler data response\n * @param {object} [ctx] context\n * @param {object} [data] scheduler data response\n * @returns {Promise} Resolves with decrypted response\n * */\n decryptSchedulerDataResponse: (ctx, data) => {\n if (!data) {\n return Promise.resolve();\n }\n\n if (!data.encryptionKeyUrl) {\n return Promise.resolve();\n }\n\n // Decrypt participant properties if meeting object contains participants\n const decryptedParticipants = data.encryptedParticipants\n ? data.encryptedParticipants.map((participant) =>\n Promise.all([\n _decryptTextProp(ctx, 'encryptedEmailAddress', data.encryptionKeyUrl, participant),\n _decryptTextProp(ctx, 'encryptedName', data.encryptionKeyUrl, participant),\n ])\n )\n : [];\n\n // Decrypt meetingJoinInfo properties if meeting object contains meetingJoinInfo\n const decryptedMeetingJoinInfo = data.meetingJoinInfo\n ? Promise.all([\n _decryptTextProp(ctx, 'meetingJoinURI', data.encryptionKeyUrl, data.meetingJoinInfo),\n _decryptTextProp(ctx, 'meetingJoinURL', data.encryptionKeyUrl, data.meetingJoinInfo),\n ])\n : [];\n\n const decryptedOrganizer = data.encryptedOrganizer\n ? Promise.all([\n _decryptTextProp(\n ctx,\n 'encryptedEmailAddress',\n data.encryptionKeyUrl,\n data.encryptedOrganizer\n ),\n _decryptTextProp(ctx, 'encryptedName', data.encryptionKeyUrl, data.encryptedOrganizer),\n ])\n : [];\n\n return Promise.all(\n [\n _decryptTextProp(ctx, 'encryptedSubject', data.encryptionKeyUrl, data),\n _decryptTextProp(ctx, 'encryptedLocation', data.encryptionKeyUrl, data),\n _decryptTextProp(ctx, 'encryptedNotes', data.encryptionKeyUrl, data),\n _decryptTextProp(ctx, 'webexURI', data.encryptionKeyUrl, data),\n _decryptTextProp(ctx, 'webexURL', data.encryptionKeyUrl, data),\n _decryptTextProp(ctx, 'spaceMeetURL', data.encryptionKeyUrl, data),\n _decryptTextProp(ctx, 'spaceURI', data.encryptionKeyUrl, data),\n _decryptTextProp(ctx, 'spaceURL', data.encryptionKeyUrl, data),\n ].concat(decryptedOrganizer
|
|
1
|
+
{"version":3,"names":["_decryptTextProp","ctx","name","key","object","_promise","default","resolve","webex","internal","encryption","decryptText","uri","then","plaintext","DecryptHelper","decryptSchedulerDataResponse","data","encryptionKeyUrl","decryptedParticipants","encryptedParticipants","map","participant","all","decryptedScheduleFor","_values","encryptedScheduleFor","flatMap","item","decryptedMeetingJoinInfo","meetingJoinInfo","decryptedOrganizer","encryptedOrganizer","concat","decryptFreeBusyResponse","calendarFreeBusyScheduleResponse","calendarFreeBusyItems","calendarFreeBusyItem","_default","exports"],"sources":["calendar.decrypt.helper.js"],"sourcesContent":["const _decryptTextProp = (ctx, name, key, object) => {\n if (!object[name]) {\n return Promise.resolve();\n }\n\n return ctx.webex.internal.encryption\n .decryptText(key.uri || key, object[name])\n .then((plaintext) => {\n object[name] = plaintext;\n });\n};\n\nconst DecryptHelper = {\n /**\n * Decrypt scheduler data response\n * @param {object} [ctx] context\n * @param {object} [data] scheduler data response\n * @returns {Promise} Resolves with decrypted response\n * */\n decryptSchedulerDataResponse: (ctx, data) => {\n if (!data) {\n return Promise.resolve();\n }\n\n if (!data.encryptionKeyUrl) {\n return Promise.resolve();\n }\n\n // Decrypt participant properties if meeting object contains participants\n const decryptedParticipants = data.encryptedParticipants\n ? data.encryptedParticipants.map((participant) =>\n Promise.all([\n _decryptTextProp(ctx, 'encryptedEmailAddress', data.encryptionKeyUrl, participant),\n _decryptTextProp(ctx, 'encryptedName', data.encryptionKeyUrl, participant),\n ])\n )\n : [];\n\n // Decrypt encryptedScheduleFor properties if meeting object contains SOB\n const decryptedScheduleFor = Promise.all(\n Object.values(data.encryptedScheduleFor || {}).flatMap((item) => [\n _decryptTextProp(ctx, 'encryptedEmail', data.encryptionKeyUrl, item),\n _decryptTextProp(ctx, 'encryptedDisplayName', data.encryptionKeyUrl, item),\n ])\n );\n\n // Decrypt meetingJoinInfo properties if meeting object contains meetingJoinInfo\n const decryptedMeetingJoinInfo = data.meetingJoinInfo\n ? Promise.all([\n _decryptTextProp(ctx, 'meetingJoinURI', data.encryptionKeyUrl, data.meetingJoinInfo),\n _decryptTextProp(ctx, 'meetingJoinURL', data.encryptionKeyUrl, data.meetingJoinInfo),\n ])\n : [];\n\n const decryptedOrganizer = data.encryptedOrganizer\n ? Promise.all([\n _decryptTextProp(\n ctx,\n 'encryptedEmailAddress',\n data.encryptionKeyUrl,\n data.encryptedOrganizer\n ),\n _decryptTextProp(ctx, 'encryptedName', data.encryptionKeyUrl, data.encryptedOrganizer),\n ])\n : [];\n\n return Promise.all(\n [\n _decryptTextProp(ctx, 'encryptedSubject', data.encryptionKeyUrl, data),\n _decryptTextProp(ctx, 'encryptedLocation', data.encryptionKeyUrl, data),\n _decryptTextProp(ctx, 'encryptedNotes', data.encryptionKeyUrl, data),\n _decryptTextProp(ctx, 'webexURI', data.encryptionKeyUrl, data),\n _decryptTextProp(ctx, 'webexURL', data.encryptionKeyUrl, data),\n _decryptTextProp(ctx, 'spaceMeetURL', data.encryptionKeyUrl, data),\n _decryptTextProp(ctx, 'spaceURI', data.encryptionKeyUrl, data),\n _decryptTextProp(ctx, 'spaceURL', data.encryptionKeyUrl, data),\n ].concat(\n decryptedOrganizer,\n decryptedParticipants,\n decryptedScheduleFor,\n decryptedMeetingJoinInfo\n )\n );\n },\n /**\n * Decrypt free-busy response\n * @param {object} [ctx] context\n * @param {object} [data] free-busy response\n * @returns {Promise} Resolves with decrypted response\n * */\n decryptFreeBusyResponse: (ctx, data) => {\n if (!data) {\n return Promise.resolve();\n }\n\n if (!data.calendarFreeBusyScheduleResponse) {\n return Promise.resolve();\n }\n\n if (!data.calendarFreeBusyScheduleResponse.encryptionKeyUrl) {\n return Promise.resolve();\n }\n\n const calendarFreeBusyItems = data.calendarFreeBusyScheduleResponse.calendarFreeBusyItems\n ? data.calendarFreeBusyScheduleResponse.calendarFreeBusyItems.map((calendarFreeBusyItem) =>\n Promise.all([\n _decryptTextProp(\n ctx,\n 'email',\n data.calendarFreeBusyScheduleResponse.encryptionKeyUrl,\n calendarFreeBusyItem\n ),\n ])\n )\n : [];\n\n return Promise.all([].concat(calendarFreeBusyItems));\n },\n};\n\nexport default DecryptHelper;\n"],"mappings":";;;;;;;;;;AAAA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,GAAG,EAAEC,IAAI,EAAEC,GAAG,EAAEC,MAAM,EAAK;EACnD,IAAI,CAACA,MAAM,CAACF,IAAI,CAAC,EAAE;IACjB,OAAOG,QAAA,CAAAC,OAAA,CAAQC,OAAO,CAAC,CAAC;EAC1B;EAEA,OAAON,GAAG,CAACO,KAAK,CAACC,QAAQ,CAACC,UAAU,CACjCC,WAAW,CAACR,GAAG,CAACS,GAAG,IAAIT,GAAG,EAAEC,MAAM,CAACF,IAAI,CAAC,CAAC,CACzCW,IAAI,CAAC,UAACC,SAAS,EAAK;IACnBV,MAAM,CAACF,IAAI,CAAC,GAAGY,SAAS;EAC1B,CAAC,CAAC;AACN,CAAC;AAED,IAAMC,aAAa,GAAG;EACpB;AACF;AACA;AACA;AACA;AACA;EACEC,4BAA4B,EAAE,SAAAA,6BAACf,GAAG,EAAEgB,IAAI,EAAK;IAC3C,IAAI,CAACA,IAAI,EAAE;MACT,OAAOZ,QAAA,CAAAC,OAAA,CAAQC,OAAO,CAAC,CAAC;IAC1B;IAEA,IAAI,CAACU,IAAI,CAACC,gBAAgB,EAAE;MAC1B,OAAOb,QAAA,CAAAC,OAAA,CAAQC,OAAO,CAAC,CAAC;IAC1B;;IAEA;IACA,IAAMY,qBAAqB,GAAGF,IAAI,CAACG,qBAAqB,GACpDH,IAAI,CAACG,qBAAqB,CAACC,GAAG,CAAC,UAACC,WAAW;MAAA,OACzCjB,QAAA,CAAAC,OAAA,CAAQiB,GAAG,CAAC,CACVvB,gBAAgB,CA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C,CAACjB,gBAAgB,EAAE;MAC3D,OAAOb,QAAA,CAAAC,OAAA,CAAQC,OAAO,CAAC,CAAC;IAC1B;IAEA,IAAM6B,qBAAqB,GAAGnB,IAAI,CAACkB,gCAAgC,CAACC,qBAAqB,GACrFnB,IAAI,CAACkB,gCAAgC,CAACC,qBAAqB,CAACf,GAAG,CAAC,UAACgB,oBAAoB;MAAA,OACnFhC,QAAA,CAAAC,OAAA,CAAQiB,GAAG,CAAC,CACVvB,gBAAgB,CACdC,GAAG,EACH,OAAO,EACPgB,IAAI,CAACkB,gCAAgC,CAACjB,gBAAgB,EACtDmB,oBACF,CAAC,CACF,CAAC;IAAA,CACJ,CAAC,GACD,EAAE;IAEN,OAAOhC,QAAA,CAAAC,OAAA,CAAQiB,GAAG,CAAC,EAAE,CAACU,MAAM,CAACG,qBAAqB,CAAC,CAAC;EACtD;AACF,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAjC,OAAA,GAEaS,aAAa"}
|
|
@@ -8,8 +8,8 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
10
10
|
var _assign = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/assign"));
|
|
11
|
-
var
|
|
12
|
-
var
|
|
11
|
+
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/is-array"));
|
|
12
|
+
var _lodash = require("lodash");
|
|
13
13
|
var _encryptTextProp = function _encryptTextProp(ctx, name, key, object) {
|
|
14
14
|
if (!object[name]) {
|
|
15
15
|
return _promise.default.resolve();
|
|
@@ -32,7 +32,7 @@ var _encryptFreeBusyPayload = function _encryptFreeBusyPayload(data, ctx) {
|
|
|
32
32
|
encryptionKeyUrl: ctx.encryptionKeyUrl
|
|
33
33
|
});
|
|
34
34
|
var promises = [];
|
|
35
|
-
if (data.emails && (0,
|
|
35
|
+
if (data.emails && (0, _isArray.default)(data.emails)) {
|
|
36
36
|
data.emails.map(function (item, index) {
|
|
37
37
|
return promises.push(ctx.webex.internal.encryption.encryptText(data.encryptionKeyUrl, item).then(function (encryptText) {
|
|
38
38
|
data.emails[index] = encryptText;
|
|
@@ -55,30 +55,33 @@ var EncryptHelper = {
|
|
|
55
55
|
return ctx.webex.internal.encryption.kms.createUnboundKeys({
|
|
56
56
|
count: 1
|
|
57
57
|
}).then(function (keys) {
|
|
58
|
-
var key = (0,
|
|
58
|
+
var key = (0, _lodash.isArray)(keys) ? keys[0] : keys;
|
|
59
59
|
ctx.encryptionKeyUrl = key.uri;
|
|
60
60
|
return _encryptCalendarEventPayload(data, ctx);
|
|
61
61
|
});
|
|
62
62
|
},
|
|
63
63
|
/**
|
|
64
|
-
* Encrypt free-busy request payload
|
|
64
|
+
* Encrypt free-busy request payload, if request payload only includes the sensitive data, like email, need to encrypt these reqeust parameters, and playload includes encrypt url.
|
|
65
|
+
* Otherwise, don't encrypt playload and without encrypt url,Due to calendar serivce will vaild both encrypt url and sensitive that are both present. if not, will return 400 bad reqeust to caller.
|
|
65
66
|
* @param {object} [ctx] context
|
|
66
67
|
* @param {object} [data] free busy payload data
|
|
67
68
|
* @returns {Promise} Resolves with encrypted request payload
|
|
68
69
|
* */
|
|
69
70
|
encryptFreeBusyRequest: function encryptFreeBusyRequest(ctx, data) {
|
|
71
|
+
if (!data.emails || !(0, _isArray.default)(data.emails)) {
|
|
72
|
+
return _promise.default.resolve();
|
|
73
|
+
}
|
|
70
74
|
if (ctx.encryptionKeyUrl) {
|
|
71
75
|
return _encryptFreeBusyPayload(data, ctx);
|
|
72
76
|
}
|
|
73
77
|
return ctx.webex.internal.encryption.kms.createUnboundKeys({
|
|
74
78
|
count: 1
|
|
75
79
|
}).then(function (keys) {
|
|
76
|
-
var key = (0,
|
|
80
|
+
var key = (0, _lodash.isArray)(keys) ? keys[0] : keys;
|
|
77
81
|
ctx.encryptionKeyUrl = key.uri;
|
|
78
82
|
return _encryptFreeBusyPayload(data, ctx);
|
|
79
83
|
});
|
|
80
84
|
}
|
|
81
85
|
};
|
|
82
|
-
var _default = EncryptHelper;
|
|
83
|
-
exports.default = _default;
|
|
86
|
+
var _default = exports.default = EncryptHelper;
|
|
84
87
|
//# sourceMappingURL=calendar.encrypt.helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_encryptTextProp","ctx","name","key","object","_promise","default","resolve","webex","internal","encryption","encryptText","uri","then","ciphertext","_encryptCalendarEventPayload","data","_assign","encryptionKeyUrl","encryptedAttendees","attendees","map","attendee","all","concat","_encryptFreeBusyPayload","promises","emails","
|
|
1
|
+
{"version":3,"names":["_lodash","require","_encryptTextProp","ctx","name","key","object","_promise","default","resolve","webex","internal","encryption","encryptText","uri","then","ciphertext","_encryptCalendarEventPayload","data","_assign","encryptionKeyUrl","encryptedAttendees","attendees","map","attendee","all","concat","_encryptFreeBusyPayload","promises","emails","_isArray","item","index","push","EncryptHelper","encryptCalendarEventRequest","kms","createUnboundKeys","count","keys","isArray","encryptFreeBusyRequest","_default","exports"],"sources":["calendar.encrypt.helper.js"],"sourcesContent":["import {isArray} from 'lodash';\n\nconst _encryptTextProp = (ctx, name, key, object) => {\n if (!object[name]) {\n return Promise.resolve();\n }\n\n return ctx.webex.internal.encryption\n .encryptText(key.uri || key, object[name])\n .then((ciphertext) => {\n object[name] = ciphertext;\n });\n};\n\nconst _encryptCalendarEventPayload = (data, ctx) => {\n Object.assign(data, {encryptionKeyUrl: ctx.encryptionKeyUrl});\n\n const encryptedAttendees = data.attendees\n ? data.attendees.map((attendee) =>\n Promise.all([\n _encryptTextProp(ctx, 'displayName', data.encryptionKeyUrl, attendee),\n _encryptTextProp(ctx, 'email', data.encryptionKeyUrl, attendee),\n ])\n )\n : [];\n\n return Promise.all(\n [\n _encryptTextProp(ctx, 'subject', data.encryptionKeyUrl, data),\n _encryptTextProp(ctx, 'notes', data.encryptionKeyUrl, data),\n _encryptTextProp(ctx, 'webexOptions', data.encryptionKeyUrl, data),\n ].concat([encryptedAttendees])\n );\n};\n\nconst _encryptFreeBusyPayload = (data, ctx) => {\n Object.assign(data, {encryptionKeyUrl: ctx.encryptionKeyUrl});\n\n const promises = [];\n if (data.emails && Array.isArray(data.emails)) {\n data.emails.map((item, index) =>\n promises.push(\n ctx.webex.internal.encryption\n .encryptText(data.encryptionKeyUrl, item)\n .then((encryptText) => {\n data.emails[index] = encryptText;\n })\n )\n );\n }\n\n return Promise.all(promises);\n};\n\nconst EncryptHelper = {\n /**\n * Encrypt create / update calendar event request payload\n * @param {object} [ctx] context\n * @param {object} [data] meeting payload data\n * @returns {Promise} Resolves with encrypted request payload\n * */\n encryptCalendarEventRequest: (ctx, data) => {\n if (ctx.encryptionKeyUrl) {\n return _encryptCalendarEventPayload(data, ctx);\n }\n\n return ctx.webex.internal.encryption.kms.createUnboundKeys({count: 1}).then((keys) => {\n const key = isArray(keys) ? keys[0] : keys;\n ctx.encryptionKeyUrl = key.uri;\n\n return _encryptCalendarEventPayload(data, ctx);\n });\n },\n /**\n * Encrypt free-busy request payload, if request payload only includes the sensitive data, like email, need to encrypt these reqeust parameters, and playload includes encrypt url.\n * Otherwise, don't encrypt playload and without encrypt url,Due to calendar serivce will vaild both encrypt url and sensitive that are both present. if not, will return 400 bad reqeust to caller.\n * @param {object} [ctx] context\n * @param {object} [data] free busy payload data\n * @returns {Promise} Resolves with encrypted request payload\n * */\n encryptFreeBusyRequest: (ctx, data) => {\n if (!data.emails || !Array.isArray(data.emails)) {\n return Promise.resolve();\n }\n if (ctx.encryptionKeyUrl) {\n return _encryptFreeBusyPayload(data, ctx);\n }\n\n return ctx.webex.internal.encryption.kms.createUnboundKeys({count: 1}).then((keys) => {\n const key = isArray(keys) ? keys[0] : keys;\n ctx.encryptionKeyUrl = key.uri;\n\n return _encryptFreeBusyPayload(data, ctx);\n });\n },\n};\n\nexport default EncryptHelper;\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAA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 -7,10 +7,13 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
10
|
-
var
|
|
10
|
+
var _lodash = require("lodash");
|
|
11
|
+
var _common = require("@webex/common");
|
|
11
12
|
var _webexCore = require("@webex/webex-core");
|
|
12
13
|
var _collection = _interopRequireDefault(require("./collection"));
|
|
13
14
|
var _constants = require("./constants");
|
|
15
|
+
var _calendarEncrypt = _interopRequireDefault(require("./calendar.encrypt.helper"));
|
|
16
|
+
var _calendarDecrypt = _interopRequireDefault(require("./calendar.decrypt.helper"));
|
|
14
17
|
/*!
|
|
15
18
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
16
19
|
*/
|
|
@@ -64,6 +67,62 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
64
67
|
* @memberof Calendar
|
|
65
68
|
*/
|
|
66
69
|
registered: false,
|
|
70
|
+
/**
|
|
71
|
+
* Cache all rpc event request locally
|
|
72
|
+
* */
|
|
73
|
+
rpcEventRequests: [],
|
|
74
|
+
/**
|
|
75
|
+
* Cache KMS encryptionKeyUrl
|
|
76
|
+
* */
|
|
77
|
+
encryptionKeyUrl: null,
|
|
78
|
+
/**
|
|
79
|
+
* Pre-fetch a KMS encryption key url to improve performance.
|
|
80
|
+
* Waits for the user to be authorized and skips if an unverified guest.
|
|
81
|
+
* @private
|
|
82
|
+
* @returns {void}
|
|
83
|
+
*/
|
|
84
|
+
prefetchEncryptionKey: function prefetchEncryptionKey() {
|
|
85
|
+
var _this = this;
|
|
86
|
+
if (!this.webex.canAuthorize) {
|
|
87
|
+
this.listenToOnce(this.webex, 'change:canAuthorize', function () {
|
|
88
|
+
_this.prefetchEncryptionKey();
|
|
89
|
+
});
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (this.webex.credentials.isUnverifiedGuest) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
this.webex.internal.encryption.kms.createUnboundKeys({
|
|
96
|
+
count: 1
|
|
97
|
+
}).then(function (keys) {
|
|
98
|
+
var key = (0, _lodash.isArray)(keys) ? keys[0] : keys;
|
|
99
|
+
_this.encryptionKeyUrl = key ? key.uri : null;
|
|
100
|
+
_this.logger.info('calendar->bind a KMS encryption key url');
|
|
101
|
+
_this.webex.internal.encryption.getKey(_this.encryptionKeyUrl, {
|
|
102
|
+
onBehalfOf: null
|
|
103
|
+
}).then(function (retrievedKey) {
|
|
104
|
+
_this.encryptionKeyUrl = retrievedKey ? retrievedKey.uri : null;
|
|
105
|
+
_this.logger.info('calendar->retrieve the KMS encryption key url and cache it');
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
/**
|
|
110
|
+
* WebexPlugin initialize method. This triggers once Webex has completed its
|
|
111
|
+
* initialization workflow.
|
|
112
|
+
*
|
|
113
|
+
* If the plugin is meant to perform startup actions, place them in this
|
|
114
|
+
* `initialize()` method instead of the `constructor()` method.
|
|
115
|
+
* @private
|
|
116
|
+
* @returns {void}
|
|
117
|
+
*/
|
|
118
|
+
initialize: function initialize() {
|
|
119
|
+
var _this2 = this;
|
|
120
|
+
// Used to perform actions after webex is fully qualified and ready for
|
|
121
|
+
// operation.
|
|
122
|
+
this.listenToOnce(this.webex, 'ready', function () {
|
|
123
|
+
_this2.prefetchEncryptionKey();
|
|
124
|
+
});
|
|
125
|
+
},
|
|
67
126
|
/**
|
|
68
127
|
* Explicitly sets up the calendar plugin by registering
|
|
69
128
|
* the device, connecting to mercury, and listening for calendar events.
|
|
@@ -72,7 +131,7 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
72
131
|
* @memberof Calendar
|
|
73
132
|
*/
|
|
74
133
|
register: function register() {
|
|
75
|
-
var
|
|
134
|
+
var _this3 = this;
|
|
76
135
|
if (!this.webex.canAuthorize) {
|
|
77
136
|
this.logger.error('calendar->register#ERROR, Unable to register, SDK cannot authorize');
|
|
78
137
|
return _promise.default.reject(new Error('SDK cannot authorize'));
|
|
@@ -82,13 +141,13 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
82
141
|
return _promise.default.resolve();
|
|
83
142
|
}
|
|
84
143
|
return this.webex.internal.device.register().then(function () {
|
|
85
|
-
return
|
|
144
|
+
return _this3.webex.internal.mercury.connect();
|
|
86
145
|
}).then(function () {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
146
|
+
_this3.listenForEvents();
|
|
147
|
+
_this3.trigger(_constants.CALENDAR_REGISTERED);
|
|
148
|
+
_this3.registered = true;
|
|
90
149
|
}).catch(function (error) {
|
|
91
|
-
|
|
150
|
+
_this3.logger.error("calendar->register#ERROR, Unable to register, ".concat(error.message));
|
|
92
151
|
return _promise.default.reject(error);
|
|
93
152
|
});
|
|
94
153
|
},
|
|
@@ -101,17 +160,17 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
101
160
|
* @memberof Calendar
|
|
102
161
|
*/
|
|
103
162
|
unregister: function unregister() {
|
|
104
|
-
var
|
|
163
|
+
var _this4 = this;
|
|
105
164
|
if (!this.registered) {
|
|
106
165
|
this.logger.info('calendar->unregister#INFO, Calendar plugin already unregistered');
|
|
107
166
|
return _promise.default.resolve();
|
|
108
167
|
}
|
|
109
168
|
this.stopListeningForEvents();
|
|
110
169
|
return this.webex.internal.mercury.disconnect().then(function () {
|
|
111
|
-
return
|
|
170
|
+
return _this4.webex.internal.device.unregister();
|
|
112
171
|
}).then(function () {
|
|
113
|
-
|
|
114
|
-
|
|
172
|
+
_this4.trigger(_constants.CALENDAR_UNREGISTERED);
|
|
173
|
+
_this4.registered = false;
|
|
115
174
|
});
|
|
116
175
|
},
|
|
117
176
|
/**
|
|
@@ -120,22 +179,25 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
120
179
|
* @private
|
|
121
180
|
*/
|
|
122
181
|
listenForEvents: function listenForEvents() {
|
|
123
|
-
var
|
|
182
|
+
var _this5 = this;
|
|
124
183
|
// Calendar mercury events listener
|
|
125
184
|
this.webex.internal.mercury.on('event:calendar.meeting.create', function (envelope) {
|
|
126
|
-
|
|
185
|
+
_this5._handleCreate(envelope.data);
|
|
127
186
|
});
|
|
128
187
|
this.webex.internal.mercury.on('event:calendar.meeting.update', function (envelope) {
|
|
129
|
-
|
|
188
|
+
_this5._handleUpdate(envelope.data);
|
|
130
189
|
});
|
|
131
190
|
this.webex.internal.mercury.on('event:calendar.meeting.create.minimal', function (envelope) {
|
|
132
|
-
|
|
191
|
+
_this5._handleCreate(envelope.data);
|
|
133
192
|
});
|
|
134
193
|
this.webex.internal.mercury.on('event:calendar.meeting.update.minimal', function (envelope) {
|
|
135
|
-
|
|
194
|
+
_this5._handleUpdate(envelope.data);
|
|
136
195
|
});
|
|
137
196
|
this.webex.internal.mercury.on('event:calendar.meeting.delete', function (envelope) {
|
|
138
|
-
|
|
197
|
+
_this5._handleDelete(envelope.data);
|
|
198
|
+
});
|
|
199
|
+
this.webex.internal.mercury.on('event:calendar.free_busy', function (envelope) {
|
|
200
|
+
_this5._handleFreeBusy(envelope.data);
|
|
139
201
|
});
|
|
140
202
|
},
|
|
141
203
|
/**
|
|
@@ -149,6 +211,7 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
149
211
|
this.webex.internal.mercury.off('event:calendar.meeting.update');
|
|
150
212
|
this.webex.internal.mercury.off('event:calendar.meeting.update.minimal');
|
|
151
213
|
this.webex.internal.mercury.off('event:calendar.meeting.delete');
|
|
214
|
+
this.webex.internal.mercury.off('event:calendar.free_busy');
|
|
152
215
|
},
|
|
153
216
|
/**
|
|
154
217
|
* handles update events, triggers after collection updates
|
|
@@ -180,6 +243,30 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
180
243
|
var item = _collection.default.remove(data.calendarMeetingExternal.id);
|
|
181
244
|
this.trigger(_constants.CALENDAR_DELETE, item);
|
|
182
245
|
},
|
|
246
|
+
/**
|
|
247
|
+
* handles free_busy events
|
|
248
|
+
* @param {Object} data
|
|
249
|
+
* @returns {undefined}
|
|
250
|
+
* @private
|
|
251
|
+
*/
|
|
252
|
+
_handleFreeBusy: function _handleFreeBusy(data) {
|
|
253
|
+
var _this6 = this;
|
|
254
|
+
_calendarDecrypt.default.decryptFreeBusyResponse(this, data).then(function () {
|
|
255
|
+
var response = {};
|
|
256
|
+
if (data && data.calendarFreeBusyScheduleResponse) {
|
|
257
|
+
response = data.calendarFreeBusyScheduleResponse;
|
|
258
|
+
}
|
|
259
|
+
if (response && response.requestId && response.requestId in _this6.rpcEventRequests) {
|
|
260
|
+
_this6.logger.log("webex.internal.calendar - receive requests, requestId: ".concat(response.requestId));
|
|
261
|
+
delete response.encryptionKeyUrl;
|
|
262
|
+
var resolve = _this6.rpcEventRequests[response.requestId].resolve;
|
|
263
|
+
resolve(response);
|
|
264
|
+
delete _this6.rpcEventRequests[response.requestId];
|
|
265
|
+
} else {
|
|
266
|
+
_this6.logger.log('webex.internal.calendar - receive other requests.');
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
},
|
|
183
270
|
/**
|
|
184
271
|
* Retrieves a collection of calendars based on the request parameters
|
|
185
272
|
* Defaults to 1 day before and 7 days ahead
|
|
@@ -231,15 +318,25 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
231
318
|
});
|
|
232
319
|
},
|
|
233
320
|
/**
|
|
234
|
-
* Retrieves an array of meeting participants for the meeting
|
|
235
|
-
* @param {String}
|
|
321
|
+
* Retrieves an array of meeting participants for the meeting participantsUrl
|
|
322
|
+
* @param {String} participantsUrl
|
|
236
323
|
* @returns {Promise} Resolves with an object of meeting participants
|
|
237
324
|
*/
|
|
238
|
-
getParticipants: function getParticipants(
|
|
325
|
+
getParticipants: function getParticipants(participantsUrl) {
|
|
239
326
|
return this.request({
|
|
240
327
|
method: 'GET',
|
|
241
|
-
|
|
242
|
-
|
|
328
|
+
uri: participantsUrl
|
|
329
|
+
});
|
|
330
|
+
},
|
|
331
|
+
/**
|
|
332
|
+
* get meeting notes using notesUrl from meeting object.
|
|
333
|
+
* @param {String} notesUrl
|
|
334
|
+
* @returns {Promise} Resolves with an object of meeting notes
|
|
335
|
+
*/
|
|
336
|
+
getNotesByUrl: function getNotesByUrl(notesUrl) {
|
|
337
|
+
return this.request({
|
|
338
|
+
method: 'GET',
|
|
339
|
+
uri: notesUrl
|
|
243
340
|
});
|
|
244
341
|
},
|
|
245
342
|
/**
|
|
@@ -251,7 +348,7 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
251
348
|
return this.request({
|
|
252
349
|
method: 'GET',
|
|
253
350
|
service: 'calendar',
|
|
254
|
-
resource: "calendarEvents/".concat(
|
|
351
|
+
resource: "calendarEvents/".concat(_common.base64.encode(id), "/notes")
|
|
255
352
|
});
|
|
256
353
|
},
|
|
257
354
|
/**
|
|
@@ -262,7 +359,7 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
262
359
|
* @returns {Promise} Resolves with an array of meetings
|
|
263
360
|
*/
|
|
264
361
|
list: function list(options) {
|
|
265
|
-
var
|
|
362
|
+
var _this7 = this;
|
|
266
363
|
options = options || {};
|
|
267
364
|
return this.webex.request({
|
|
268
365
|
method: 'GET',
|
|
@@ -273,13 +370,8 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
273
370
|
var meetingObjects = res.body.items;
|
|
274
371
|
var promises = [];
|
|
275
372
|
meetingObjects.forEach(function (meeting) {
|
|
276
|
-
if (!meeting.encryptedNotes) {
|
|
277
|
-
promises.push(_this4.getNotes(meeting.id).then(function (notesResponse) {
|
|
278
|
-
meeting.encryptedNotes = notesResponse.body && notesResponse.body.encryptedNotes;
|
|
279
|
-
}));
|
|
280
|
-
}
|
|
281
373
|
if (!meeting.encryptedParticipants) {
|
|
282
|
-
promises.push(
|
|
374
|
+
promises.push(_this7.getParticipants(meeting.participantsUrl).then(function (notesResponse) {
|
|
283
375
|
meeting.encryptedParticipants = notesResponse.body.encryptedParticipants;
|
|
284
376
|
}));
|
|
285
377
|
}
|
|
@@ -289,8 +381,119 @@ var Calendar = _webexCore.WebexPlugin.extend({
|
|
|
289
381
|
});
|
|
290
382
|
});
|
|
291
383
|
},
|
|
292
|
-
|
|
384
|
+
/**
|
|
385
|
+
* Create calendar event
|
|
386
|
+
* @param {object} [data] meeting payload data
|
|
387
|
+
* @param {object} [query] the query parameters for specific usage
|
|
388
|
+
* @returns {Promise} Resolves with creating calendar event response
|
|
389
|
+
* */
|
|
390
|
+
createCalendarEvent: function createCalendarEvent(data, query) {
|
|
391
|
+
var _this8 = this;
|
|
392
|
+
return _calendarEncrypt.default.encryptCalendarEventRequest(this, data).then(function () {
|
|
393
|
+
return _this8.request({
|
|
394
|
+
method: 'POST',
|
|
395
|
+
service: 'calendar',
|
|
396
|
+
body: data,
|
|
397
|
+
resource: 'calendarEvents/sync',
|
|
398
|
+
qs: query || {}
|
|
399
|
+
});
|
|
400
|
+
});
|
|
401
|
+
},
|
|
402
|
+
/**
|
|
403
|
+
* Update calendar event
|
|
404
|
+
* @param {string} [id] calendar event id
|
|
405
|
+
* @param {object} [data] meeting payload data
|
|
406
|
+
* @param {object} [query] the query parameters for specific usage
|
|
407
|
+
* @returns {Promise} Resolves with updating calendar event response
|
|
408
|
+
* */
|
|
409
|
+
updateCalendarEvent: function updateCalendarEvent(id, data, query) {
|
|
410
|
+
var _this9 = this;
|
|
411
|
+
return _calendarEncrypt.default.encryptCalendarEventRequest(this, data).then(function () {
|
|
412
|
+
return _this9.request({
|
|
413
|
+
method: 'PATCH',
|
|
414
|
+
service: 'calendar',
|
|
415
|
+
body: data,
|
|
416
|
+
resource: "calendarEvents/".concat(_common.base64.encode(id), "/sync"),
|
|
417
|
+
qs: query || {}
|
|
418
|
+
});
|
|
419
|
+
});
|
|
420
|
+
},
|
|
421
|
+
/**
|
|
422
|
+
* Delete calendar event
|
|
423
|
+
* @param {string} [id] calendar event id
|
|
424
|
+
* @param {object} [query] the query parameters for specific usage
|
|
425
|
+
* @returns {Promise} Resolves with deleting calendar event response
|
|
426
|
+
* */
|
|
427
|
+
deleteCalendarEvent: function deleteCalendarEvent(id, query) {
|
|
428
|
+
return this.request({
|
|
429
|
+
method: 'DELETE',
|
|
430
|
+
service: 'calendar',
|
|
431
|
+
resource: "calendarEvents/".concat(_common.base64.encode(id), "/sync"),
|
|
432
|
+
qs: query || {}
|
|
433
|
+
});
|
|
434
|
+
},
|
|
435
|
+
/**
|
|
436
|
+
* @typedef QuerySchedulerDataOptions
|
|
437
|
+
* @param {string} [siteName] it is site full url, must have. Example: ccctest.dmz.webex.com
|
|
438
|
+
* @param {string} [id] it is seriesOrOccurrenceId. If present, the series/occurrence meeting ID to fetch data for.
|
|
439
|
+
* Example: 040000008200E00074C5B7101A82E008000000004A99F11A0841D9010000000000000000100000009EE499D4A71C1A46B51494C70EC7BFE5
|
|
440
|
+
* @param {string} [clientMeetingId] If present, the client meeting UUID to fetch data for.
|
|
441
|
+
* Example: 7f318aa9-887c-6e94-802a-8dc8e6eb1a0a
|
|
442
|
+
* @param {string} [scheduleTemplateId] it template id.
|
|
443
|
+
* @param {string} [sessionTypeId] it session type id.
|
|
444
|
+
* @param {string} [organizerCIUserId] required in schedule-on-behalf case. It is the organizer's CI UUID.
|
|
445
|
+
* @param {boolean} [usmPreference]
|
|
446
|
+
* @param {string} [webexMeetingId] webex side meeting UUID
|
|
447
|
+
* @param {string} [eventId] event ID.
|
|
448
|
+
* @param {string} [icalUid] icalendar UUID.
|
|
449
|
+
* @param {string} [thirdPartyType] third part type, such as: Microsoft
|
|
450
|
+
*/
|
|
451
|
+
/**
|
|
452
|
+
* Get scheduler data from calendar service
|
|
453
|
+
* @param {QuerySchedulerDataOptions} [query] the command parameters for fetching scheduler data.
|
|
454
|
+
* @returns {Promise} Resolves with a decrypted scheduler data
|
|
455
|
+
* */
|
|
456
|
+
getSchedulerData: function getSchedulerData(query) {
|
|
457
|
+
var _this10 = this;
|
|
458
|
+
return this.request({
|
|
459
|
+
method: 'GET',
|
|
460
|
+
service: 'calendar',
|
|
461
|
+
resource: 'schedulerData',
|
|
462
|
+
qs: query || {}
|
|
463
|
+
}).then(function (response) {
|
|
464
|
+
return _calendarDecrypt.default.decryptSchedulerDataResponse(_this10, response.body).then(function () {
|
|
465
|
+
return response;
|
|
466
|
+
});
|
|
467
|
+
});
|
|
468
|
+
},
|
|
469
|
+
/**
|
|
470
|
+
* Get free busy status from calendar service
|
|
471
|
+
* @param {Object} [data] the command parameters for fetching free busy status.
|
|
472
|
+
* @param {object} [query] the query parameters for specific usage
|
|
473
|
+
* @returns {Promise} Resolves with a decrypted response
|
|
474
|
+
* */
|
|
475
|
+
getFreeBusy: function getFreeBusy(data, query) {
|
|
476
|
+
var _this11 = this;
|
|
477
|
+
return _calendarEncrypt.default.encryptFreeBusyRequest(this, data).then(function () {
|
|
478
|
+
return _this11.request({
|
|
479
|
+
method: 'POST',
|
|
480
|
+
service: 'calendar',
|
|
481
|
+
body: data,
|
|
482
|
+
resource: 'freebusy',
|
|
483
|
+
qs: query || {}
|
|
484
|
+
});
|
|
485
|
+
}).then(function () {
|
|
486
|
+
return new _promise.default(function (resolve, reject) {
|
|
487
|
+
_this11.rpcEventRequests[data.requestId] = {
|
|
488
|
+
resolve: resolve,
|
|
489
|
+
reject: reject
|
|
490
|
+
};
|
|
491
|
+
});
|
|
492
|
+
}).catch(function (error) {
|
|
493
|
+
throw error;
|
|
494
|
+
});
|
|
495
|
+
},
|
|
496
|
+
version: "3.0.0-next.1"
|
|
293
497
|
});
|
|
294
|
-
var _default = Calendar;
|
|
295
|
-
exports.default = _default;
|
|
498
|
+
var _default = exports.default = Calendar;
|
|
296
499
|
//# sourceMappingURL=calendar.js.map
|