@zimbra/api-client 70.0.0 → 74.0.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.
@@ -30,6 +30,7 @@ import {
30
30
  PreferencesInput,
31
31
  PropertiesInput,
32
32
  RevokeRightsInput,
33
+ SaveSMimeCertInputUpload,
33
34
  SearchFolderInput,
34
35
  SendMessageInput,
35
36
  ShareNotificationInput,
@@ -54,6 +55,7 @@ import {
54
55
  ClientInfoInput,
55
56
  CreateFolderOptions,
56
57
  CreateSearchFolderOptions,
58
+ DiscoverRightOptions,
57
59
  ExternalAccountDeleteInput,
58
60
  ExternalAccountModifyInput,
59
61
  FreeBusyOptions,
@@ -103,7 +105,7 @@ export function createZimbraSchema(options: ZimbraSchemaOptions): {
103
105
  autoComplete: (_, variables) => client.autoComplete(variables as AutoCompleteOptions),
104
106
  autoCompleteGAL: (_, variables) =>
105
107
  client.autoCompleteGAL(variables as AutoCompleteGALOptions),
106
- discoverRights: client.discoverRights,
108
+ discoverRights: (_, variables) => client.discoverRights(variables as DiscoverRightOptions),
107
109
  downloadAttachment: (_, variables) => client.downloadAttachment(variables),
108
110
  downloadDocument: (_, variables) => client.downloadDocument(variables),
109
111
  downloadMessage: (_, variables, context = {}) => {
@@ -169,6 +171,7 @@ export function createZimbraSchema(options: ZimbraSchemaOptions): {
169
171
  getSearchFolder: client.getSearchFolder,
170
172
  getSMimePublicCerts: (_, variables) =>
171
173
  client.getSMimePublicCerts(variables as GetSMimePublicCertsOptions),
174
+ getSMimeCertInfo: client.getSMimeCertInfo,
172
175
  getTrustedDevices: client.getTrustedDevices,
173
176
  getDeviceStatus: client.getDeviceStatus,
174
177
  getWorkingHours: (_, variables) => client.getWorkingHours(variables as WorkingHoursOptions),
@@ -368,11 +371,15 @@ export function createZimbraSchema(options: ZimbraSchemaOptions): {
368
371
  message as SendMessageInput,
369
372
  accountName as string
370
373
  ),
371
- sendMessage: (_, { message, accountName }, context = {}) =>
374
+ sendMessage: (_, { message, accountName, sign = false, encrypt = false }, context = {}) =>
372
375
  (context.local ? localStoreClient : client).sendMessage(
373
376
  message as SendMessageInput,
374
- accountName as string
377
+ accountName as string,
378
+ sign as Boolean,
379
+ encrypt as Boolean
375
380
  ),
381
+ saveSMimeCert: (_, { upload, password }) =>
382
+ client.saveSMimeCert(upload as SaveSMimeCertInputUpload, password as string),
376
383
  sendDeliveryReport: (_, { messageId }) => client.sendDeliveryReport(messageId),
377
384
  uploadMessage: (_, { value }) => client.uploadMessage(value),
378
385
  createTask: (_, { task }) => client.createTask(task as CalendarItemInput),
@@ -1,3 +1,12 @@
1
+ /** List of content type not show as attachment */
2
+ const ignoreContentTypeToShowAsAttachment = [
3
+ 'application/pkcs7-signature',
4
+ 'application/x-pkcs7-signature',
5
+ 'message/delivery-status', // present in Undelivered mail
6
+ 'message/disposition-notification', // present in read-receipt response
7
+ 'xml/x-zimbra-share' // present in folder share message
8
+ ];
9
+
1
10
  function normalizeCid(cid: string) {
2
11
  return cid.replace(/[<>]/g, '');
3
12
  }
@@ -144,9 +153,7 @@ export function normalizeMimeParts(
144
153
  if (!isBody && type.split('/')[0] !== 'multipart') {
145
154
  let mode = disposition === 'inline' ? 'inlineAttachments' : 'attachments';
146
155
 
147
-
148
- part.contentType !== 'application/pkcs7-signature' &&
149
- part.contentType !== 'application/x-pkcs7-signature' &&
156
+ !ignoreContentTypeToShowAsAttachment.includes(part.contentType) &&
150
157
  (acc[mode] || (acc[mode] = [])).push(processAttachment(part, mode));
151
158
 
152
159
  if (isDesktop) {
@@ -65,6 +65,7 @@ const supportedContactAttributes = [
65
65
  'website',
66
66
  'notes',
67
67
  'image',
68
+ 'thumbnailPhoto',
68
69
  'userCertificate',
69
70
  'assistantPhone',
70
71
  'callbackPhone',
@@ -79,7 +80,26 @@ const supportedContactAttributes = [
79
80
  'fileAs',
80
81
  'type'
81
82
  ];
82
- export function createContactBody(data: any) {
83
+
84
+ const ignoreAttributes = [
85
+ 'modifyTimeStamp',
86
+ 'createTimeStamp',
87
+ 'zimbraId',
88
+ 'objectClass',
89
+ 'zimbraMailForwardingAddress',
90
+ 'zimbraAccountCalendarUserType',
91
+ 'zimbraCalResLocationDisplayName',
92
+ 'zimbraCalResType',
93
+ 'cardOwner',
94
+ 'homeCardMessage',
95
+ 'homePhotoURL',
96
+ 'workCardMessage',
97
+ 'workPhotoURL',
98
+ 'firstLast',
99
+ 'vcardXProps',
100
+ 'imagepart'
101
+ ];
102
+ export function createContactBody(data: any, isDesktop: Boolean) {
83
103
  const { attributes, ...rest } = data;
84
104
  const contactAttrs = <Object[]>[];
85
105
 
@@ -87,7 +107,7 @@ export function createContactBody(data: any) {
87
107
  key !== 'other'
88
108
  ? contactAttrs.push({
89
109
  name: key,
90
- [key === 'image' ? 'aid' : 'content']: val
110
+ [key === 'image' || (!isDesktop && key === 'userCertificate') ? 'aid' : 'content']: val
91
111
  })
92
112
  : forEach(val, otherValue =>
93
113
  contactAttrs.push({
@@ -129,7 +149,7 @@ export function normalizeOtherAttr(data: any) {
129
149
  }
130
150
 
131
151
  Object.keys(contact._attrs)
132
- .filter(key => !supportedContactAttributes.includes(key))
152
+ .filter(key => !supportedContactAttributes.includes(key) && !ignoreAttributes.includes(key))
133
153
  .forEach(
134
154
  key =>
135
155
  typeof contact._attrs[key] === 'string' &&