@zimbra/api-client 90.0.0 → 92.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zimbra/api-client",
3
3
  "amdName": "zmApiJsClient",
4
- "version": "90.0.0",
4
+ "version": "92.0.0",
5
5
  "description": "Zimbra JS API Client and GraphQL client for making requests against the Zimbra SOAP API.",
6
6
  "main": "dist/zm-api-js-client.js",
7
7
  "source": "index.ts",
@@ -37,6 +37,9 @@
37
37
  "graphql"
38
38
  ],
39
39
  "repository": "Zimbra/zm-api-js-client",
40
+ "engines": {
41
+ "node": ">=18.12.0"
42
+ },
40
43
  "license": "BSD-3-Clause",
41
44
  "lint-staged": {
42
45
  "**/*.ts": [
@@ -47,7 +50,7 @@
47
50
  "@apollo/client": "3.4.16",
48
51
  "@graphql-tools/schema": "^10.0.3",
49
52
  "dataloader": "^2.2.2",
50
- "graphql": "^15.8.0",
53
+ "graphql": "^16.9.0",
51
54
  "lodash": "^4.17.21",
52
55
  "mitt": "^3.0.0"
53
56
  },
@@ -75,7 +78,7 @@
75
78
  "cross-var": "^1.1.0",
76
79
  "husky": "^8.0.3",
77
80
  "is-ci": "^3.0.1",
78
- "lint-staged": "13.2.3",
81
+ "lint-staged": "15.2.8",
79
82
  "mocha": "^10.2.0",
80
83
  "npm-run-all": "^4.1.5",
81
84
  "prettier": "^2.6.2",
@@ -24,17 +24,17 @@ export class LocalBatchLink extends ApolloLink {
24
24
  let emittedResponse = false;
25
25
  Promise.all(
26
26
  operations.map((operation: Operation) => {
27
- const query = print(operation.query);
28
27
  const { operationName, variables = {} } = operation;
28
+ const params = {
29
+ schema: this.schema,
30
+ source: print(operation.query),
31
+ rootValue: null,
32
+ contextValue: operation.getContext() || options.context || {},
33
+ variableValues: variables,
34
+ operationName: operationName
35
+ };
29
36
 
30
- return graphql(
31
- this.schema,
32
- query,
33
- null,
34
- operation.getContext() || options.context || {},
35
- variables,
36
- operationName
37
- );
37
+ return graphql(params);
38
38
  })
39
39
  )
40
40
  .then((results: FetchResult[]) => {
@@ -5,3 +5,12 @@ export interface LocalBatchLinkOptions extends BatchLink.Options {
5
5
  context?: any;
6
6
  schema: GraphQLSchema;
7
7
  }
8
+
9
+ export interface EmailAddress {
10
+ __typename?: 'EmailAddress';
11
+ address?: string;
12
+ displayName?: string;
13
+ isGroup?: boolean | null;
14
+ name?: string;
15
+ type?: string;
16
+ }
@@ -1,5 +1,8 @@
1
1
  import { defaultDataIdFromObject, InMemoryCache, InMemoryCacheConfig } from '@apollo/client/core';
2
2
  import get from 'lodash/get';
3
+ import isEqual from 'lodash/isEqual';
4
+ import uniqWith from 'lodash/uniqWith';
5
+ import { EmailAddress } from './types';
3
6
 
4
7
  const dataIdFromPath = (result: any, path: string) => {
5
8
  if (result.__typename) {
@@ -93,10 +96,9 @@ const typePolicies = {
93
96
  MessageInfo: {
94
97
  fields: {
95
98
  emailAddresses: {
96
- // @TODO ideally we should write proper merge function here,
97
- // but as our app is already handling at caller level
98
- // we are just overwriting cache data here
99
- merge: false
99
+ merge(existing: EmailAddress[], incoming: EmailAddress[]) {
100
+ return uniqWith([...(existing || []), ...(incoming || [])], isEqual);
101
+ }
100
102
  }
101
103
  }
102
104
  }
@@ -103,6 +103,7 @@ import {
103
103
  import { mapValuesDeep } from '../utils/map-values-deep';
104
104
  import {
105
105
  normalizeCustomMetaDataAttrs,
106
+ normalizeHeaderAttrs,
106
107
  setCustomMetaDataBody
107
108
  } from '../utils/normalize-attrs-custommetadata';
108
109
  import { normalizeEmailAddresses } from '../utils/normalize-email-addresses';
@@ -171,6 +172,9 @@ function normalizeMessage(
171
172
  return entry;
172
173
  });
173
174
  }
175
+ if (message?._attrs) {
176
+ message._attrs = normalizeHeaderAttrs(message._attrs);
177
+ }
174
178
 
175
179
  let normalizedMessage = normalize(MessageInfo)(message);
176
180
  normalizedMessage = normalizedMessage && mapValuesDeep(normalizedMessage, coerceStringToBoolean);
@@ -948,13 +952,14 @@ export class ZimbraBatchClient {
948
952
  singleRequest: true
949
953
  }).then(Boolean);
950
954
 
951
- public freeBusy = ({ start, end, names }: FreeBusyOptions) =>
955
+ public freeBusy = ({ start, end, names, excludeUid }: FreeBusyOptions) =>
952
956
  this.jsonRequest({
953
957
  name: 'GetFreeBusy',
954
958
  body: {
955
959
  s: start,
956
960
  e: end,
957
- name: names.join(',')
961
+ name: names.join(','),
962
+ ...(excludeUid && { excludeUid })
958
963
  }
959
964
  }).then(res => normalize(FreeBusy)(res.usr));
960
965
 
@@ -75,6 +75,7 @@ export interface ZimbraClientOptions {
75
75
 
76
76
  export interface FreeBusyOptions {
77
77
  end: number;
78
+ excludeUid: string;
78
79
  names: Array<string>;
79
80
  start: number;
80
81
  }
@@ -124,6 +124,7 @@ export type AccountInfoAttrs = {
124
124
  zimbraFeatureRelatedContactsEnabled?: Maybe<Scalars['Boolean']['output']>;
125
125
  zimbraFeatureResetPasswordStatus?: Maybe<ResetPasswordStatus>;
126
126
  zimbraFeatureRetentionPolicyEnabled?: Maybe<Scalars['Boolean']['output']>;
127
+ zimbraFeatureSharedFolderMobileSyncEnabled?: Maybe<Scalars['Boolean']['output']>;
127
128
  zimbraFeatureSharingEnabled?: Maybe<Scalars['Boolean']['output']>;
128
129
  zimbraFeatureTaggingEnabled?: Maybe<Scalars['Boolean']['output']>;
129
130
  zimbraFeatureTasksEnabled?: Maybe<Scalars['Boolean']['output']>;
@@ -837,8 +838,11 @@ export type CancelRuleInfo = {
837
838
 
838
839
  export type ClientInfoAttributes = {
839
840
  __typename?: 'ClientInfoAttributes';
841
+ zimbraClassicWebClientDisabled?: Maybe<Scalars['Boolean']['output']>;
840
842
  zimbraFeatureResetPasswordStatus?: Maybe<ResetPasswordStatus>;
841
843
  zimbraHelpModernURL?: Maybe<Scalars['String']['output']>;
844
+ zimbraSkinLogoAppBanner?: Maybe<Scalars['String']['output']>;
845
+ zimbraSkinLogoLoginBanner?: Maybe<Scalars['String']['output']>;
842
846
  zimbraWebClientLoginURL?: Maybe<Scalars['String']['output']>;
843
847
  zimbraWebClientLogoutURL?: Maybe<Scalars['String']['output']>;
844
848
  zimbraWebClientSkipLogoff?: Maybe<Scalars['Boolean']['output']>;
@@ -1089,6 +1093,7 @@ export enum ContactType {
1089
1093
 
1090
1094
  export type Conversation = MailItem & {
1091
1095
  __typename?: 'Conversation';
1096
+ _attrs?: Maybe<Array<Maybe<CustomHeader>>>;
1092
1097
  changeDate?: Maybe<Scalars['Float']['output']>;
1093
1098
  conversationId?: Maybe<Scalars['ID']['output']>;
1094
1099
  date?: Maybe<Scalars['Float']['output']>;
@@ -1185,6 +1190,12 @@ export type Cursor = {
1185
1190
  sortVal?: InputMaybe<Scalars['String']['input']>;
1186
1191
  };
1187
1192
 
1193
+ export type CustomHeader = {
1194
+ __typename?: 'CustomHeader';
1195
+ key?: Maybe<Scalars['String']['output']>;
1196
+ value?: Maybe<Scalars['String']['output']>;
1197
+ };
1198
+
1188
1199
  export type CustomMetadata = {
1189
1200
  __typename?: 'CustomMetadata';
1190
1201
  meta?: Maybe<Array<Maybe<CustomMetadataMeta>>>;
@@ -2043,6 +2054,11 @@ export type HeaderConditionInput = {
2043
2054
  valueComparison?: InputMaybe<Scalars['String']['input']>;
2044
2055
  };
2045
2056
 
2057
+ export type HeaderInput = {
2058
+ _content?: InputMaybe<Scalars['String']['input']>;
2059
+ name?: InputMaybe<Scalars['String']['input']>;
2060
+ };
2061
+
2046
2062
  export type Hit = {
2047
2063
  __typename?: 'Hit';
2048
2064
  id?: Maybe<Scalars['String']['output']>;
@@ -2433,6 +2449,7 @@ export type MessageAttributes = {
2433
2449
 
2434
2450
  export type MessageInfo = MailItem & {
2435
2451
  __typename?: 'MessageInfo';
2452
+ _attrs?: Maybe<Array<Maybe<CustomHeader>>>;
2436
2453
  attachments?: Maybe<Array<Maybe<MimePart>>>;
2437
2454
  attributes?: Maybe<MessageAttributes>;
2438
2455
  autoSendTime?: Maybe<Scalars['Float']['output']>;
@@ -2575,6 +2592,7 @@ export type ModifyZimletPrefsResponse = {
2575
2592
 
2576
2593
  export type MsgWithGroupInfo = MailItem & {
2577
2594
  __typename?: 'MsgWithGroupInfo';
2595
+ _attrs?: Maybe<Array<Maybe<CustomHeader>>>;
2578
2596
  autoSendTime?: Maybe<Scalars['Float']['output']>;
2579
2597
  changeDate?: Maybe<Scalars['Float']['output']>;
2580
2598
  cif?: Maybe<Scalars['String']['output']>;
@@ -3491,6 +3509,7 @@ export type PreferencesInput = {
3491
3509
  zimbraPrefComposeFormat?: InputMaybe<Mode>;
3492
3510
  zimbraPrefDefaultCalendarId?: InputMaybe<Scalars['ID']['input']>;
3493
3511
  zimbraPrefDelegatedSendSaveTarget?: InputMaybe<PrefDelegatedSendSaveTarget>;
3512
+ zimbraPrefDeleteInviteOnReply?: InputMaybe<Scalars['Boolean']['input']>;
3494
3513
  zimbraPrefDisplayExternalImages?: InputMaybe<Scalars['Boolean']['input']>;
3495
3514
  zimbraPrefDisplayTimeInMailList?: InputMaybe<Scalars['Boolean']['input']>;
3496
3515
  zimbraPrefExternalSendersType?: InputMaybe<ExternalSendersType>;
@@ -3670,6 +3689,7 @@ export type QueryDownloadMessageArgs = {
3670
3689
 
3671
3690
  export type QueryFreeBusyArgs = {
3672
3691
  end?: InputMaybe<Scalars['Float']['input']>;
3692
+ excludeUid?: InputMaybe<Scalars['String']['input']>;
3673
3693
  names: Array<Scalars['String']['input']>;
3674
3694
  start?: InputMaybe<Scalars['Float']['input']>;
3675
3695
  };
@@ -3866,6 +3886,7 @@ export type QuerySearchArgs = {
3866
3886
  cursor?: InputMaybe<Cursor>;
3867
3887
  fetch?: InputMaybe<Scalars['String']['input']>;
3868
3888
  fullConversation?: InputMaybe<Scalars['Boolean']['input']>;
3889
+ header?: InputMaybe<Array<InputMaybe<MailItemHeaderInput>>>;
3869
3890
  inDumpster?: InputMaybe<Scalars['Boolean']['input']>;
3870
3891
  limit?: InputMaybe<Scalars['Int']['input']>;
3871
3892
  memberOf?: InputMaybe<Scalars['Boolean']['input']>;
@@ -4187,6 +4208,7 @@ export enum SearchType {
4187
4208
  Document = 'document',
4188
4209
  Message = 'message',
4189
4210
  Task = 'task',
4211
+ Unknown = 'unknown',
4190
4212
  Wiki = 'wiki'
4191
4213
  }
4192
4214
 
@@ -4205,6 +4227,7 @@ export type SendMessageInput = {
4205
4227
  entityId?: InputMaybe<Scalars['String']['input']>;
4206
4228
  flags?: InputMaybe<Scalars['String']['input']>;
4207
4229
  folderId?: InputMaybe<Scalars['ID']['input']>;
4230
+ header?: InputMaybe<Array<InputMaybe<HeaderInput>>>;
4208
4231
  id?: InputMaybe<Scalars['ID']['input']>;
4209
4232
  inReplyTo?: InputMaybe<Scalars['String']['input']>;
4210
4233
  inlineAttachments?: InputMaybe<Array<InputMaybe<MimePartInput>>>;
@@ -4248,6 +4271,7 @@ export enum SetRecoveryAccountOp {
4248
4271
 
4249
4272
  export type ShareInfo = {
4250
4273
  __typename?: 'ShareInfo';
4274
+ activeSyncDisabled?: Maybe<Scalars['Boolean']['output']>;
4251
4275
  folderId: Scalars['ID']['output'];
4252
4276
  folderPath?: Maybe<Scalars['String']['output']>;
4253
4277
  folderUuid?: Maybe<Scalars['String']['output']>;
@@ -202,6 +202,7 @@ enum SearchType {
202
202
  task
203
203
  wiki
204
204
  document
205
+ unknown
205
206
  }
206
207
 
207
208
  enum ContactType {
@@ -510,6 +511,9 @@ type ClientInfoAttributes {
510
511
  zimbraWebClientSkipLogoff: Boolean
511
512
  zimbraFeatureResetPasswordStatus: ResetPasswordStatus
512
513
  zimbraHelpModernURL: String
514
+ zimbraClassicWebClientDisabled: Boolean
515
+ zimbraSkinLogoLoginBanner: String
516
+ zimbraSkinLogoAppBanner: String
513
517
  }
514
518
 
515
519
  type ClientInfoType {
@@ -560,6 +564,7 @@ type MessageInfo implements MailItem {
560
564
  local: Boolean
561
565
  part: String
562
566
  meta: [CustomMetadataMeta]
567
+ _attrs: [CustomHeader]
563
568
  }
564
569
 
565
570
  type Conversation implements MailItem {
@@ -588,6 +593,7 @@ type Conversation implements MailItem {
588
593
  subscribe: [DLSubscribe] # dlSub
589
594
  replyType: String #rt
590
595
  meta: [CustomMetadataMeta]
596
+ _attrs: [CustomHeader]
591
597
  }
592
598
 
593
599
  type MsgWithGroupInfo implements MailItem {
@@ -604,6 +610,7 @@ type MsgWithGroupInfo implements MailItem {
604
610
  folderId: ID # l
605
611
  subject: String # su
606
612
  emailAddresses: [EmailAddress]
613
+ _attrs: [CustomHeader]
607
614
  excerpt: String # fr
608
615
  conversationId: ID # cid
609
616
  flags: String # f
@@ -1478,6 +1485,7 @@ type AccountInfoAttrs {
1478
1485
  zimbraFeatureFiltersEnabled: Boolean
1479
1486
  zimbraFeatureReadReceiptsEnabled: Boolean
1480
1487
  zimbraFeatureSharingEnabled: Boolean
1488
+ zimbraFeatureSharedFolderMobileSyncEnabled: Boolean
1481
1489
  zimbraFeatureManageZimlets: Boolean
1482
1490
  zimbraFeatureTwoFactorAuthAvailable: Boolean
1483
1491
  zimbraFeatureTwoFactorAuthRequired: Boolean
@@ -1782,6 +1790,11 @@ type SaveDraftResponse {
1782
1790
  message: [MessageInfo]
1783
1791
  }
1784
1792
 
1793
+ type CustomHeader {
1794
+ key: String
1795
+ value: String
1796
+ }
1797
+
1785
1798
  type CustomMetadataAttrs {
1786
1799
  key: String
1787
1800
  value: String
@@ -2072,6 +2085,7 @@ type ShareInfo {
2072
2085
  rights: String
2073
2086
  view: FolderView
2074
2087
  mid: ID
2088
+ activeSyncDisabled: Boolean
2075
2089
  }
2076
2090
 
2077
2091
  type MailboxMetadataAttrs {
@@ -2305,6 +2319,12 @@ input SendMessageInput {
2305
2319
  emailAddresses: [MailItemEmailAddressInput] #e
2306
2320
  attachments: [AttachmentInput] #attach
2307
2321
  inlineAttachments: [MimePartInput] #attach
2322
+ header: [HeaderInput] #header
2323
+ }
2324
+
2325
+ input HeaderInput {
2326
+ name: String #name
2327
+ _content: String #value
2308
2328
  }
2309
2329
 
2310
2330
  input SaveSMimeCertInputUpload {
@@ -2727,6 +2747,7 @@ input PreferencesInput {
2727
2747
  zimbraPrefPowerPasteEnabled: Boolean
2728
2748
  zimbraPrefDisplayTimeInMailList: Boolean
2729
2749
  zimbraPrefPrimaryTwoFactorAuthMethod: String
2750
+ zimbraPrefDeleteInviteOnReply: Boolean
2730
2751
  }
2731
2752
 
2732
2753
  input ModifyIdentityInput {
@@ -3455,7 +3476,7 @@ type Query {
3455
3476
  downloadDocument(id: ID!, url: String!): Attachment
3456
3477
  listDocumentRevisions(id: ID!, version: Int!, count: Int!): Document
3457
3478
  discoverRights(right: [DiscoverRightInput!]!): DiscoverRights
3458
- freeBusy(names: [String!]!, start: Float, end: Float): [FreeBusy]
3479
+ freeBusy(names: [String!]!, start: Float, end: Float, excludeUid: String): [FreeBusy]
3459
3480
  getContact(
3460
3481
  id: ID
3461
3482
  ids: [ID!]
@@ -3594,7 +3615,8 @@ type Query {
3594
3615
  sortBy: SortBy
3595
3616
  types: SearchType
3596
3617
  resultMode: String
3597
- inDumpster: Boolean
3618
+ inDumpster: Boolean,
3619
+ header: [MailItemHeaderInput]
3598
3620
  ): SearchResponse
3599
3621
 
3600
3622
  searchCalendarResources(
@@ -29,3 +29,12 @@ export function normalizeCustomMetaDataAttrs(data: any) {
29
29
  _attrs: attrs
30
30
  };
31
31
  }
32
+
33
+ export function normalizeHeaderAttrs(data: any) {
34
+ let attrs: any = [];
35
+
36
+ Object.keys(data).forEach(
37
+ key => typeof data[key] === 'string' && attrs.push({ key, value: data[key] })
38
+ );
39
+ return attrs;
40
+ }