@zimbra/api-client 100.1.0 → 100.1.1-PREAPPS-9149.3419da8.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.
Files changed (37) hide show
  1. package/dist/schema.graphql +9 -2
  2. package/dist/src/apollo/local-batch-link.d.ts +1 -1
  3. package/dist/src/apollo/offline-queue-link/index.d.ts +2 -2
  4. package/dist/src/apollo/offline-queue-link/types.d.ts +3 -3
  5. package/dist/src/batch-client/index.d.ts +17 -17
  6. package/dist/src/batch-client/types.d.ts +11 -11
  7. package/dist/src/request/types.d.ts +2 -2
  8. package/dist/src/schema/generated-schema-types.d.ts +9 -4
  9. package/dist/src/utils/normalize-attrs-custommetadata.d.ts +1 -1
  10. package/dist/src/utils/normalize-otherAttribute-contact.d.ts +1 -1
  11. package/dist/zm-api-js-client.esm.js +3862 -3808
  12. package/dist/zm-api-js-client.esm.js.map +1 -1
  13. package/dist/zm-api-js-client.js +14 -10
  14. package/dist/zm-api-js-client.js.map +1 -1
  15. package/dist/zm-api-js-client.umd.js +14 -10
  16. package/dist/zm-api-js-client.umd.js.map +1 -1
  17. package/eslint.config.mjs +10 -0
  18. package/package.json +17 -18
  19. package/rollup.config.js +4 -1
  20. package/src/apollo/local-batch-link.ts +2 -2
  21. package/src/apollo/offline-queue-link/index.ts +3 -10
  22. package/src/apollo/offline-queue-link/types.ts +3 -3
  23. package/src/apollo/zimbra-error-link.ts +11 -7
  24. package/src/batch-client/index.ts +57 -64
  25. package/src/batch-client/types.ts +11 -11
  26. package/src/normalize/index.ts +1 -1
  27. package/src/request/index.ts +20 -8
  28. package/src/request/types.ts +2 -2
  29. package/src/schema/generated-schema-types.ts +10 -4
  30. package/src/schema/schema.graphql +9 -2
  31. package/src/schema/schema.ts +6 -4
  32. package/src/utils/normalize-attrs-custommetadata.ts +1 -1
  33. package/src/utils/normalize-mime-parts.ts +10 -6
  34. package/src/utils/normalize-otherAttribute-contact.ts +2 -2
  35. package/.prettierrc +0 -6
  36. package/package-lock.json +0 -10036
  37. package/tslint.json +0 -20
@@ -0,0 +1,10 @@
1
+ import { tsEslintConfig } from "@zimbra/eslint-config/typescript";
2
+
3
+ const customIgnores = ["src/schema/generated-schema-types.ts"];
4
+
5
+ export default [
6
+ ...tsEslintConfig.map(cfg => ({
7
+ ...cfg,
8
+ ignores: [...(cfg.ignores || []), ...customIgnores],
9
+ }))
10
+ ];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zimbra/api-client",
3
3
  "amdName": "zmApiJsClient",
4
- "version": "100.1.0",
4
+ "version": "100.1.1-PREAPPS-9149.3419da8.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",
@@ -10,7 +10,7 @@
10
10
  "types": "dist/index.d.ts",
11
11
  "scripts": {
12
12
  "generateSchemaTypes": "rimraf src/schema/generated-schema-types.ts && graphql-codegen",
13
- "lint": "tslint --project .",
13
+ "lint": "eslint --config eslint.config.mjs .",
14
14
  "lint:fix": "npm run lint -- --fix",
15
15
  "test:unit": "BABEL_ENV=test mocha --require ./babelRegisterConfig.js test/**/*.js",
16
16
  "test:watch": "npm run test:unit -- --watch",
@@ -19,14 +19,14 @@
19
19
  "build:ts": "tsc --emitDeclarationOnly --declaration --outDir \"dist\"",
20
20
  "build:analyze": "visualize=true npm run build",
21
21
  "copySchema": "copyfiles -f src/schema/schema.graphql dist",
22
- "rollup:cjs": "cross-var rollup -c rollup.config.js -m -f cjs -n $npm_package_amdName $npm_package_source -o $npm_package_main",
23
- "rollup:umd": "cross-var rollup -c rollup.config.js -m -f umd -n $npm_package_amdName $npm_package_source -o $npm_package_umd_main",
24
- "rollup:esm": "cross-var rollup -c rollup.config.js -m -f es --environment FORMAT:es -n $npm_package_amdName $npm_package_source -o $npm_package_module",
22
+ "rollup:cjs": "rollup -c rollup.config.js -m -f cjs -n zmApiJsClient index.ts -o dist/zm-api-js-client.js",
23
+ "rollup:umd": "rollup -c rollup.config.js -m -f umd -n zmApiJsClient index.ts -o dist/zm-api-js-client.umd.js",
24
+ "rollup:esm": "rollup -c rollup.config.js -m -f es --environment FORMAT:es -n zmApiJsClient index.ts -o dist/zm-api-js-client.esm.js",
25
25
  "linkedBuild": "npm run rollup:esm -- --watch",
26
- "minify:cjs": "cross-var uglifyjs $npm_package_main -c pure_getters,pure_funcs=classCallCheck -m toplevel,reserved=['_createClass'] --keep-fnames -o $npm_package_main --source-map content=$npm_package_main.map,url=zm-api-js-client.js.map,filename=$npm_package_main.map",
27
- "minify:umd": "cross-var uglifyjs $npm_package_umd_main -c pure_getters,pure_funcs=classCallCheck -m toplevel,reserved=['_createClass'] --keep-fnames -o $npm_package_umd_main --source-map content=$npm_package_umd_main.map,url=zm-api-js-client.umd.js.map,filename=$npm_package_umd_main.map",
28
- "size": "echo \"Gzipped Size: $(gzip-size $npm_package_main | pretty-bytes)\"",
29
- "prepublishOnly": "npm test && npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags",
26
+ "minify:cjs": "uglifyjs dist/zm-api-js-client.js -c pure_getters,pure_funcs=classCallCheck -m toplevel,reserved=['_createClass'] --keep-fnames -o dist/zm-api-js-client.js --source-map content=dist/zm-api-js-client.js.map,url=zm-api-js-client.js.map,filename=dist/zm-api-js-client.js.map",
27
+ "minify:umd": "uglifyjs dist/zm-api-js-client.umd.js -c pure_getters,pure_funcs=classCallCheck -m toplevel,reserved=['_createClass'] --keep-fnames -o dist/zm-api-js-client.umd.js --source-map content=dist/zm-api-js-client.umd.js.map,url=zm-api-js-client.umd.js.map,filename=dist/zm-api-js-client.umd.js.map",
28
+ "size": "echo \"Gzipped Size: $(gzip-size dist/zm-api-js-client.js | pretty-bytes)\"",
29
+ "prepublishOnly": "if [ \"$CI\" != \"true\" ]; then npm test && npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags; fi",
30
30
  "publish:beta": "npm publish --tag=beta",
31
31
  "security:audit": "npx audit-ci@^6 --moderate --report-type summary --pass-enoaudit --skip-dev",
32
32
  "prepare": "husky || true"
@@ -38,16 +38,16 @@
38
38
  ],
39
39
  "repository": "Zimbra/zm-api-js-client",
40
40
  "engines": {
41
- "node": ">=18.12.0"
41
+ "node": "^25.9.0"
42
42
  },
43
43
  "license": "BSD-3-Clause",
44
44
  "lint-staged": {
45
- "**/*.ts": [
46
- "tslint"
45
+ "**/*.{ts, tsx}": [
46
+ "eslint"
47
47
  ]
48
48
  },
49
49
  "dependencies": {
50
- "@apollo/client": "^3.14.0",
50
+ "@apollo/client": "^3.10.8",
51
51
  "@graphql-tools/schema": "^10.0.25",
52
52
  "dataloader": "^2.2.2",
53
53
  "es-toolkit": "^1.39.10",
@@ -72,23 +72,22 @@
72
72
  "@types/lodash": "^4.14.182",
73
73
  "@types/node": "^20.10.4",
74
74
  "@types/whatwg-fetch": "^0.0.33",
75
+ "@typescript-eslint/eslint-plugin": "^8.50.1",
76
+ "@zimbra/eslint-config": "git+https://github.com/Zimbra/zm-eslint-config.git#PREAPPS-9149",
75
77
  "babel-plugin-lodash": "^3.3.4",
76
78
  "chai": "^4.5.0",
77
79
  "copyfiles": "^2.4.1",
78
- "cross-var": "^1.1.0",
80
+ "eslint": "^9.0.0",
79
81
  "husky": "^9.1.7",
80
82
  "lint-staged": "15.2.8",
81
83
  "mocha": "^10.8.2",
82
84
  "npm-run-all": "^4.1.5",
83
85
  "prettier": "^2.6.2",
84
86
  "rimraf": "^5.0.1",
85
- "rollup": "^2.75.0",
87
+ "rollup": "^2.80.0",
86
88
  "rollup-plugin-local-resolve": "^1.0.7",
87
89
  "rollup-plugin-visualizer": "^5.11.0",
88
90
  "tslib": "^2.5.0",
89
- "tslint": "^6.1.3",
90
- "tslint-config-prettier": "^1.18.0",
91
- "tslint-plugin-prettier": "^2.3.0",
92
91
  "typescript": "^5.3.3",
93
92
  "uglify-js": "^3.15.5"
94
93
  }
package/rollup.config.js CHANGED
@@ -18,6 +18,7 @@ const externalDeps = [
18
18
  const getExternalDeps = id => externalDeps.find(pkgName => id.includes('/node_modules/' + pkgName + '/'));
19
19
 
20
20
  export default {
21
+ input: 'index.ts',
21
22
  ...(FORMAT==='es' && { external: getExternalDeps }),
22
23
  context: 'commonjsGlobal', // what should "this" be at the top level when it is used by another module
23
24
  plugins: [
@@ -36,6 +37,8 @@ export default {
36
37
  ...(process.env.visualize ? [visualizer({ open: true }) ] : [])
37
38
  ],
38
39
  output: {
39
- exports: FORMAT==='es' ? null : 'named'
40
+ format: FORMAT || 'cjs',
41
+ exports: FORMAT==='es' ? null : 'named',
42
+ sourcemap: true
40
43
  }
41
44
  };
@@ -56,7 +56,7 @@ export class LocalBatchLink extends ApolloLink {
56
56
  });
57
57
  }
58
58
 
59
- request(operation: Operation): Observable<FetchResult> | null {
60
- return this.batcher.request(operation);
59
+ request(operation: Operation, forward: any) {
60
+ return this.batcher.request(operation, forward);
61
61
  }
62
62
  }
@@ -1,11 +1,4 @@
1
- import {
2
- ApolloLink,
3
- FetchResult,
4
- NextLink,
5
- Observable,
6
- Observer,
7
- Operation
8
- } from '@apollo/client/core';
1
+ import { ApolloLink, FetchResult, Observable, Operation } from '@apollo/client/core';
9
2
 
10
3
  import { SyncOfflineOperations } from '../sync-offline-operations';
11
4
  import { OfflineQueueLinkOptions, OperationEntry, StorageProvider } from './types';
@@ -101,7 +94,7 @@ export class OfflineQueueLink extends ApolloLink {
101
94
 
102
95
  purge = () => Promise.resolve(this.storage.removeItem(this.storeKey));
103
96
 
104
- request(operation: Operation, forward: NextLink) {
97
+ request(operation: Operation, forward: any) {
105
98
  const { skipQueue, cancelQueues, offlineQueueName, local } = operation.getContext();
106
99
 
107
100
  const isForwarding = this.isOpen || local || skipQueue || hasSensitiveVariables(operation);
@@ -112,7 +105,7 @@ export class OfflineQueueLink extends ApolloLink {
112
105
  return forward(operation);
113
106
  }
114
107
 
115
- return new Observable<FetchResult>((observer: Observer<FetchResult>) => {
108
+ return new Observable<FetchResult>(observer => {
116
109
  const entry = {
117
110
  operation,
118
111
  forward,
@@ -1,4 +1,4 @@
1
- import { FetchResult, NextLink, Observer, Operation } from '@apollo/client/core';
1
+ import { Operation } from '@apollo/client/core';
2
2
 
3
3
  export interface OfflineQueueLinkOptions {
4
4
  isOpen?: boolean;
@@ -8,8 +8,8 @@ export interface OfflineQueueLinkOptions {
8
8
 
9
9
  export type OperationEntry = {
10
10
  cancelQuery?: string;
11
- forward: NextLink;
12
- observer: Observer<FetchResult>;
11
+ forward: any;
12
+ observer: any;
13
13
  offlineQuery?: string;
14
14
  operation: Operation;
15
15
  };
@@ -4,11 +4,14 @@ class ZimbraErrorLink extends ErrorLink {
4
4
  handlers: any[] = [];
5
5
 
6
6
  constructor() {
7
- super(({ graphQLErrors, networkError }) => {
8
- graphQLErrors &&
9
- graphQLErrors.map((error: any) => {
10
- const { message, ...rest } = error;
11
- const originalError = error.originalError;
7
+ super(error => {
8
+ const { graphQLErrors, networkError } = error;
9
+ // Handle GraphQL errors
10
+ const errorList = graphQLErrors || (networkError as any)?.errors || [];
11
+ if (errorList && errorList.length > 0) {
12
+ errorList.map((graphQLError: any) => {
13
+ const { message, ...rest } = graphQLError;
14
+ const originalError = graphQLError.originalError;
12
15
  const errorCode = (originalError as any)?.faults?.[0]?.Detail?.Error?.Code || '';
13
16
 
14
17
  this.executeHandlers({
@@ -18,11 +21,12 @@ class ZimbraErrorLink extends ErrorLink {
18
21
  ...rest
19
22
  });
20
23
  });
21
-
22
- networkError &&
24
+ } else if (networkError) {
25
+ // Handle network error
23
26
  this.executeHandlers({
24
27
  message: `[Network error]: ${networkError}`
25
28
  });
29
+ }
26
30
  });
27
31
  }
28
32
 
@@ -372,7 +372,7 @@ export class ZimbraBatchClient {
372
372
  };
373
373
  });
374
374
 
375
- public accountOnlyRemoteWipeSync = (deviceId: String) =>
375
+ public accountOnlyRemoteWipeSync = (deviceId: string) =>
376
376
  this.jsonRequest({
377
377
  name: 'AccountOnlyRemoteWipe',
378
378
  namespace: Namespace.Sync,
@@ -433,7 +433,7 @@ export class ZimbraBatchClient {
433
433
  }).then(normalize(MessageInfo));
434
434
  };
435
435
 
436
- public allowDeviceSync = (deviceId: String) =>
436
+ public allowDeviceSync = (deviceId: string) =>
437
437
  this.jsonRequest({
438
438
  name: 'AllowDevice',
439
439
  namespace: Namespace.Sync,
@@ -476,7 +476,7 @@ export class ZimbraBatchClient {
476
476
  body: options
477
477
  }).then(res => normalize(AutoCompleteGALResponse)(res));
478
478
 
479
- public blockDeviceSync = (deviceId: String) =>
479
+ public blockDeviceSync = (deviceId: string) =>
480
480
  this.jsonRequest({
481
481
  name: 'BlockDevice',
482
482
  namespace: Namespace.Sync,
@@ -487,7 +487,7 @@ export class ZimbraBatchClient {
487
487
  }
488
488
  });
489
489
 
490
- public cancelPendingAccountOnlyRemoteWipeSync = (deviceId: String) =>
490
+ public cancelPendingAccountOnlyRemoteWipeSync = (deviceId: string) =>
491
491
  this.jsonRequest({
492
492
  name: 'CancelPendingAccountOnlyRemoteWipe',
493
493
  namespace: Namespace.Sync,
@@ -498,7 +498,7 @@ export class ZimbraBatchClient {
498
498
  }
499
499
  });
500
500
 
501
- public cancelPendingRemoteWipeSync = (deviceId: String) =>
501
+ public cancelPendingRemoteWipeSync = (deviceId: string) =>
502
502
  this.jsonRequest({
503
503
  name: 'CancelPendingRemoteWipe',
504
504
  namespace: Namespace.Sync,
@@ -567,19 +567,34 @@ export class ZimbraBatchClient {
567
567
  }
568
568
  };
569
569
 
570
- public checkCalendar = ({
571
- id,
572
- value
573
- }: FolderActionCheckCalendarInput): Promise<ActionOpResponse> => {
570
+ public checkCalendars = (
571
+ actions: FolderActionCheckCalendarInput[]
572
+ ): Promise<ActionOpResponse[]> => {
573
+ const folderActions = actions.map(action => ({
574
+ _jsns: 'urn:zimbraMail',
575
+ action: {
576
+ id: action.id,
577
+ op: action.value ? 'check' : '!check'
578
+ }
579
+ }));
580
+
574
581
  return this.jsonRequest({
575
582
  name: ActionType.folder,
576
- body: {
577
- action: {
578
- id,
579
- op: value ? 'check' : '!check'
580
- }
581
- },
582
- singleRequest: true
583
+ body: folderActions
584
+ }).then(res => {
585
+ const data = res.body;
586
+
587
+ if (Array.isArray(data?.action)) {
588
+ return data.action.map((item: any) => ({
589
+ __typename: 'ActionOpResponse',
590
+ action: {
591
+ __typename: 'ActionOpResponseData',
592
+ id: item.id,
593
+ op: item.op
594
+ }
595
+ }));
596
+ }
597
+ return [];
583
598
  });
584
599
  };
585
600
 
@@ -928,41 +943,19 @@ export class ZimbraBatchClient {
928
943
  });
929
944
 
930
945
  public endSessionBeaconRequest = (options: JsonRequestOptions) => {
931
- const body = {
932
- Body: {
933
- EndSessionRequest: {
934
- _jsns: Namespace.Account
935
- }
946
+ this.jsonRequest({
947
+ name: 'EndSession',
948
+ namespace: Namespace.Account,
949
+ singleRequest: true,
950
+ headers: {
951
+ 'Content-Type': 'application/json',
952
+ 'X-Zimbra-Csrf-Token': this.csrfToken || ''
936
953
  },
937
- Header: {
938
- context: {
939
- _jsns: Namespace.All,
940
- account: {
941
- by: 'name',
942
- _content: options.accountName
943
- },
944
- session: {
945
- id: this.sessionId,
946
- _content: this.sessionId
947
- },
948
- userAgent: this.userAgent
949
- }
950
- }
951
- };
952
-
953
- try {
954
- fetch(`${this.origin}/service/soap`, {
955
- method: 'POST',
956
- keepalive: true,
957
- headers: {
958
- 'Content-Type': 'application/json',
959
- 'X-Zimbra-Csrf-Token': this.csrfToken || ''
960
- },
961
- body: JSON.stringify(body)
962
- });
963
- } catch (e) {
964
- throw new Error('Error on endSessionBeaconRequest request' + e);
965
- }
954
+ accountName: options.accountName,
955
+ sessionId: this.sessionId,
956
+ userAgent: this.userAgent,
957
+ fetchOptions: { keepalive: true }
958
+ });
966
959
  };
967
960
 
968
961
  public folderAction = (options: ActionOptions) => this.action(ActionType.folder, options);
@@ -992,7 +985,7 @@ export class ZimbraBatchClient {
992
985
  }
993
986
  }).then(res => normalize(FreeBusy)(res.usr));
994
987
 
995
- public generateScratchCodes = (username: String) =>
988
+ public generateScratchCodes = (username: string) =>
996
989
  this.jsonRequest({
997
990
  name: 'GenerateScratchCodes',
998
991
  namespace: Namespace.Account,
@@ -1005,7 +998,7 @@ export class ZimbraBatchClient {
1005
998
  singleRequest: true
1006
999
  });
1007
1000
 
1008
- public getAccountDistributionLists = (attrs: String, ownerOf: number) =>
1001
+ public getAccountDistributionLists = (attrs: string, ownerOf: number) =>
1009
1002
  this.jsonRequest({
1010
1003
  name: 'GetAccountDistributionLists',
1011
1004
  body: {
@@ -1115,7 +1108,7 @@ export class ZimbraBatchClient {
1115
1108
  namespace: Namespace.Sync
1116
1109
  }).then(res => res?.device || []);
1117
1110
 
1118
- public getDistributionList = (dl: String, needOwners: Boolean, needRights: String, by: String) =>
1111
+ public getDistributionList = (dl: string, needOwners: boolean, needRights: string, by: string) =>
1119
1112
  this.jsonRequest({
1120
1113
  name: 'GetDistributionList',
1121
1114
  body: {
@@ -1129,7 +1122,7 @@ export class ZimbraBatchClient {
1129
1122
  namespace: Namespace.Account
1130
1123
  });
1131
1124
 
1132
- public getDistributionListMembers = (limit: String, offset: String, dl: String) =>
1125
+ public getDistributionListMembers = (limit: string, offset: string, dl: string) =>
1133
1126
  this.jsonRequest({
1134
1127
  name: 'GetDistributionListMembers',
1135
1128
  body: {
@@ -1228,7 +1221,7 @@ export class ZimbraBatchClient {
1228
1221
  */
1229
1222
 
1230
1223
  if (folder.view === FolderView.Contact) {
1231
- (folder.userId = folder.id), (folder.id = `${ownerZimbraId}:${sharedItemId}`);
1224
+ ((folder.userId = folder.id), (folder.id = `${ownerZimbraId}:${sharedItemId}`));
1232
1225
  }
1233
1226
  if (oname && folders) {
1234
1227
  folder.folders = updateAbsoluteFolderPath(oname, absFolderPath, folders);
@@ -1401,7 +1394,7 @@ export class ZimbraBatchClient {
1401
1394
  body: denormalize(GetRightsRequest)(options)
1402
1395
  }).then(normalize(AccountRights));
1403
1396
 
1404
- public getScratchCodes = (username: String) =>
1397
+ public getScratchCodes = (username: string) =>
1405
1398
  this.jsonRequest({
1406
1399
  name: 'GetScratchCodes',
1407
1400
  namespace: Namespace.Account,
@@ -1765,7 +1758,7 @@ export class ZimbraBatchClient {
1765
1758
  singleRequest: true
1766
1759
  }).then(Boolean);
1767
1760
 
1768
- public quarantineDeviceSync = (deviceId: String) =>
1761
+ public quarantineDeviceSync = (deviceId: string) =>
1769
1762
  this.jsonRequest({
1770
1763
  name: 'QuarantineDevice',
1771
1764
  namespace: Namespace.Sync,
@@ -1796,7 +1789,7 @@ export class ZimbraBatchClient {
1796
1789
  }
1797
1790
  }).then(resp => resp.relatedContacts.relatedContact);
1798
1791
 
1799
- public remoteWipeSync = (deviceId: String) =>
1792
+ public remoteWipeSync = (deviceId: string) =>
1800
1793
  this.jsonRequest({
1801
1794
  name: 'RemoteWipe',
1802
1795
  namespace: Namespace.Sync,
@@ -1807,7 +1800,7 @@ export class ZimbraBatchClient {
1807
1800
  }
1808
1801
  });
1809
1802
 
1810
- public removeDeviceSync = (deviceId: String) =>
1803
+ public removeDeviceSync = (deviceId: string) =>
1811
1804
  this.jsonRequest({
1812
1805
  name: 'RemoveDevice',
1813
1806
  namespace: Namespace.Sync,
@@ -1959,8 +1952,8 @@ export class ZimbraBatchClient {
1959
1952
  public sendMessage = (
1960
1953
  message: SendMessageInput,
1961
1954
  accountName: string,
1962
- sign: Boolean,
1963
- encrypt: Boolean
1955
+ sign: boolean,
1956
+ encrypt: boolean
1964
1957
  ) =>
1965
1958
  this.jsonRequest({
1966
1959
  name: !(sign || encrypt) ? 'SendMsg' : 'SendSecureMsg',
@@ -2019,7 +2012,7 @@ export class ZimbraBatchClient {
2019
2012
  singleRequest: true
2020
2013
  }).then(Boolean);
2021
2014
 
2022
- public setUserAgent = (userAgent: Object) => {
2015
+ public setUserAgent = (userAgent: object) => {
2023
2016
  this.userAgent = userAgent;
2024
2017
  };
2025
2018
 
@@ -2042,7 +2035,7 @@ export class ZimbraBatchClient {
2042
2035
  singleRequest: true
2043
2036
  }).then(Boolean);
2044
2037
 
2045
- public subscribeDistributionList = (op: String, by: String, dl: String) =>
2038
+ public subscribeDistributionList = (op: string, by: string, dl: string) =>
2046
2039
  this.jsonRequest({
2047
2040
  name: 'SubscribeDistributionList',
2048
2041
  body: {
@@ -2203,7 +2196,7 @@ export class ZimbraBatchClient {
2203
2196
  /**
2204
2197
  * These options are included on every request.
2205
2198
  */
2206
- private getAdditionalRequestOptions = (addCsrfToken: Boolean = true) => ({
2199
+ private getAdditionalRequestOptions = (addCsrfToken: boolean = true) => ({
2207
2200
  jwtToken: this.jwtToken,
2208
2201
  ...(addCsrfToken && {
2209
2202
  csrfToken: this.csrfToken
@@ -151,7 +151,7 @@ export interface GetMailItemOptions {
151
151
  header?: Array<MailItemHeader>;
152
152
  html?: boolean;
153
153
  id: string;
154
- ids: [String];
154
+ ids: [string];
155
155
  isLocal?: boolean;
156
156
  max?: number;
157
157
  needExp?: boolean;
@@ -180,17 +180,17 @@ export interface AppointmentOptions {
180
180
  export interface SaveDocumentInput {
181
181
  content: string;
182
182
  ct: string;
183
- descEnabled: Boolean;
183
+ descEnabled: boolean;
184
184
  id: string;
185
185
  l: string;
186
186
  name: string;
187
187
  upload: UploadDocument;
188
- ver: Number;
188
+ ver: number;
189
189
  }
190
190
 
191
191
  export interface SearchOptions {
192
- calExpandInstEnd?: Number;
193
- calExpandInstStart?: Number;
192
+ calExpandInstEnd?: number;
193
+ calExpandInstStart?: number;
194
194
  cursor?: Cursor;
195
195
  fetch?: string;
196
196
  fullConversation?: boolean;
@@ -210,9 +210,9 @@ export interface SearchOptions {
210
210
  }
211
211
 
212
212
  export interface SearchCalendarResourcesCondition {
213
- attr?: String;
214
- op?: String;
215
- value?: String;
213
+ attr?: string;
214
+ op?: string;
215
+ value?: string;
216
216
  }
217
217
  export interface SearchCalendarResourcesOptions {
218
218
  attrs?: string;
@@ -228,8 +228,8 @@ export interface SearchCalendarResourcesOptions {
228
228
 
229
229
  export interface ShareInfoOptions {
230
230
  grantee?: Grantee;
231
- includeSelf?: Boolean;
232
- internal?: Boolean;
231
+ includeSelf?: boolean;
232
+ internal?: boolean;
233
233
  owner?: Owner;
234
234
  }
235
235
 
@@ -268,7 +268,7 @@ export interface ActionOptions {
268
268
  isLocal?: boolean;
269
269
  name?: string;
270
270
  op: string;
271
- recursive?: Boolean;
271
+ recursive?: boolean;
272
272
  rgb?: string;
273
273
  tagNames?: string;
274
274
  }
@@ -1,6 +1,6 @@
1
1
  import { EntityMapping, EntityMappingValue, NormalizedKey } from './types';
2
2
 
3
- function normalizeKey(key: string, schema: Entity, inverse: Boolean = false): NormalizedKey {
3
+ function normalizeKey(key: string, schema: Entity, inverse: boolean = false): NormalizedKey {
4
4
  const getKey = inverse ? schema.inverseKey : schema.key;
5
5
  const schemaValue = getKey(key);
6
6
 
@@ -21,6 +21,11 @@ export function setCustomFetch(httpRequestAPI: any) {
21
21
  }
22
22
 
23
23
  function soapCommandBody(options: RequestOptions) {
24
+ // If the request body is already the array of actions, return it directly
25
+ if (Array.isArray(options.body)) {
26
+ return options.body;
27
+ }
28
+
24
29
  return {
25
30
  _jsns: options.namespace || Namespace.Mail,
26
31
  ...options.body
@@ -97,15 +102,18 @@ function faultError(response: ParsedResponse, faults: any) {
97
102
  */
98
103
  function batchBody(requests: ReadonlyArray<RequestOptions>) {
99
104
  const body: { [key: string]: any } = {};
100
-
101
105
  for (const request of requests) {
102
106
  const key = `${request.name}Request`;
103
107
  const value = soapCommandBody(request);
104
108
 
105
- if (body[key]) {
106
- body[key].push(value);
109
+ if (!body[key]) {
110
+ body[key] = [];
111
+ }
112
+
113
+ if (Array.isArray(value)) {
114
+ body[key].push(...value);
107
115
  } else {
108
- body[key] = [value];
116
+ body[key].push(value);
109
117
  }
110
118
  }
111
119
 
@@ -229,15 +237,19 @@ export function jsonRequest(requestOptions: JsonRequestOptions): Promise<Request
229
237
  options.headers['Cookie'] = `ZM_AUTH_TOKEN=${requestOptions.authToken}`;
230
238
  }
231
239
 
232
- const body = {
233
- [soapRequestName]: soapCommandBody(options)
234
- };
240
+ const body =
241
+ requestOptions.body && requestOptions.body[soapRequestName]
242
+ ? requestOptions.body
243
+ : { [soapRequestName]: soapCommandBody(options) };
235
244
 
236
245
  let fetchOptions;
237
246
 
238
247
  if (requestOptions.fetchOptions) {
239
248
  fetchOptions = {
240
- signal: requestOptions.fetchOptions.signal
249
+ signal: requestOptions.fetchOptions.signal,
250
+ ...(requestOptions.fetchOptions.keepalive && {
251
+ keepalive: requestOptions.fetchOptions.keepalive
252
+ })
241
253
  };
242
254
  }
243
255
 
@@ -19,14 +19,14 @@ export interface BaseRequestOptions {
19
19
  authToken?: string;
20
20
  credentials?: RequestCredentials;
21
21
  csrfToken?: string | null;
22
- encrypt?: Boolean;
22
+ encrypt?: boolean;
23
23
  fetchOptions?: any;
24
24
  headers?: any;
25
25
  jwtToken?: string | null;
26
26
  origin?: string;
27
27
  sessionId?: SessionId;
28
28
  sessionSeq?: SessionSeq;
29
- sign?: Boolean;
29
+ sign?: boolean;
30
30
  singleRequest?: boolean;
31
31
  soapPathname?: string;
32
32
  userAgent?: UserAgent;
@@ -1151,6 +1151,11 @@ export type ConversationConditionInput = {
1151
1151
  where?: InputMaybe<Scalars['String']['input']>;
1152
1152
  };
1153
1153
 
1154
+ export enum ConversationOrderBy {
1155
+ DateAsc = 'dateAsc',
1156
+ DateDesc = 'dateDesc'
1157
+ }
1158
+
1154
1159
  export type CounterAppointmentInput = {
1155
1160
  componentNum?: InputMaybe<Scalars['Int']['input']>;
1156
1161
  id?: InputMaybe<Scalars['ID']['input']>;
@@ -2669,7 +2674,7 @@ export type Mutation = {
2669
2674
  cancelTask?: Maybe<Scalars['Boolean']['output']>;
2670
2675
  changeFolderColor?: Maybe<Scalars['Boolean']['output']>;
2671
2676
  changePassword?: Maybe<AuthResponse>;
2672
- checkCalendar?: Maybe<ActionOpResponse>;
2677
+ checkCalendars?: Maybe<Array<Maybe<ActionOpResponse>>>;
2673
2678
  contactAction?: Maybe<ActionOpResponse>;
2674
2679
  conversationAction?: Maybe<Scalars['Boolean']['output']>;
2675
2680
  counterAppointment?: Maybe<Scalars['Boolean']['output']>;
@@ -2836,9 +2841,8 @@ export type MutationChangePasswordArgs = {
2836
2841
  };
2837
2842
 
2838
2843
 
2839
- export type MutationCheckCalendarArgs = {
2840
- id: Scalars['ID']['input'];
2841
- value: Scalars['Boolean']['input'];
2844
+ export type MutationCheckCalendarsArgs = {
2845
+ actions?: InputMaybe<Array<FolderActionCheckCalendarInput>>;
2842
2846
  };
2843
2847
 
2844
2848
 
@@ -3486,6 +3490,7 @@ export type Preferences = {
3486
3490
  zimbraPrefClientType?: Maybe<PrefClientType>;
3487
3491
  zimbraPrefComposeDirection?: Maybe<Scalars['String']['output']>;
3488
3492
  zimbraPrefComposeFormat?: Maybe<Mode>;
3493
+ zimbraPrefConversationOrder?: Maybe<ConversationOrderBy>;
3489
3494
  zimbraPrefDefaultCalendarId?: Maybe<Scalars['ID']['output']>;
3490
3495
  zimbraPrefDelegatedSendSaveTarget?: Maybe<PrefDelegatedSendSaveTarget>;
3491
3496
  zimbraPrefDeleteInviteOnReply?: Maybe<Scalars['Boolean']['output']>;
@@ -3558,6 +3563,7 @@ export type PreferencesInput = {
3558
3563
  zimbraPrefClientType?: InputMaybe<PrefClientType>;
3559
3564
  zimbraPrefComposeDirection?: InputMaybe<Scalars['String']['input']>;
3560
3565
  zimbraPrefComposeFormat?: InputMaybe<Mode>;
3566
+ zimbraPrefConversationOrder?: InputMaybe<ConversationOrderBy>;
3561
3567
  zimbraPrefDefaultCalendarId?: InputMaybe<Scalars['ID']['input']>;
3562
3568
  zimbraPrefDelegatedSendSaveTarget?: InputMaybe<PrefDelegatedSendSaveTarget>;
3563
3569
  zimbraPrefDeleteInviteOnReply?: InputMaybe<Scalars['Boolean']['input']>;