@zimbra/api-client 100.1.0 → 100.1.1-PREAPPS-9077.6dad12e.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/dist/schema.graphql +9 -2
- package/dist/src/batch-client/index.d.ts +17 -17
- package/dist/src/batch-client/types.d.ts +11 -11
- package/dist/src/request/types.d.ts +2 -2
- package/dist/src/schema/generated-schema-types.d.ts +9 -4
- package/dist/src/utils/normalize-attrs-custommetadata.d.ts +1 -1
- package/dist/src/utils/normalize-otherAttribute-contact.d.ts +1 -1
- package/dist/zm-api-js-client.esm.js +144 -134
- package/dist/zm-api-js-client.esm.js.map +1 -1
- package/dist/zm-api-js-client.js +2 -2
- package/dist/zm-api-js-client.js.map +1 -1
- package/dist/zm-api-js-client.umd.js +2 -2
- package/dist/zm-api-js-client.umd.js.map +1 -1
- package/eslint.config.mjs +10 -0
- package/package.json +9 -9
- package/src/batch-client/index.ts +57 -64
- package/src/batch-client/types.ts +11 -11
- package/src/normalize/index.ts +1 -1
- package/src/request/index.ts +20 -8
- package/src/request/types.ts +2 -2
- package/src/schema/generated-schema-types.ts +10 -4
- package/src/schema/schema.graphql +9 -2
- package/src/schema/schema.ts +6 -4
- package/src/utils/normalize-attrs-custommetadata.ts +1 -1
- package/src/utils/normalize-mime-parts.ts +10 -6
- package/src/utils/normalize-otherAttribute-contact.ts +2 -2
- package/.prettierrc +0 -6
- package/package-lock.json +0 -10036
- 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-9077.6dad12e.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": "
|
|
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",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
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
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
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",
|
|
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"
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
},
|
|
43
43
|
"license": "BSD-3-Clause",
|
|
44
44
|
"lint-staged": {
|
|
45
|
-
"**/*.ts": [
|
|
46
|
-
"
|
|
45
|
+
"**/*.{ts, tsx}": [
|
|
46
|
+
"eslint"
|
|
47
47
|
]
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
@@ -72,23 +72,23 @@
|
|
|
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": "^1.0.0",
|
|
75
77
|
"babel-plugin-lodash": "^3.3.4",
|
|
76
78
|
"chai": "^4.5.0",
|
|
77
79
|
"copyfiles": "^2.4.1",
|
|
78
80
|
"cross-var": "^1.1.0",
|
|
81
|
+
"eslint": "^9.0.0",
|
|
79
82
|
"husky": "^9.1.7",
|
|
80
83
|
"lint-staged": "15.2.8",
|
|
81
84
|
"mocha": "^10.8.2",
|
|
82
85
|
"npm-run-all": "^4.1.5",
|
|
83
86
|
"prettier": "^2.6.2",
|
|
84
87
|
"rimraf": "^5.0.1",
|
|
85
|
-
"rollup": "^2.
|
|
88
|
+
"rollup": "^2.80.0",
|
|
86
89
|
"rollup-plugin-local-resolve": "^1.0.7",
|
|
87
90
|
"rollup-plugin-visualizer": "^5.11.0",
|
|
88
91
|
"tslib": "^2.5.0",
|
|
89
|
-
"tslint": "^6.1.3",
|
|
90
|
-
"tslint-config-prettier": "^1.18.0",
|
|
91
|
-
"tslint-plugin-prettier": "^2.3.0",
|
|
92
92
|
"typescript": "^5.3.3",
|
|
93
93
|
"uglify-js": "^3.15.5"
|
|
94
94
|
}
|
|
@@ -372,7 +372,7 @@ export class ZimbraBatchClient {
|
|
|
372
372
|
};
|
|
373
373
|
});
|
|
374
374
|
|
|
375
|
-
public accountOnlyRemoteWipeSync = (deviceId:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
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
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
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
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
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
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
1963
|
-
encrypt:
|
|
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:
|
|
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:
|
|
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:
|
|
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: [
|
|
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:
|
|
183
|
+
descEnabled: boolean;
|
|
184
184
|
id: string;
|
|
185
185
|
l: string;
|
|
186
186
|
name: string;
|
|
187
187
|
upload: UploadDocument;
|
|
188
|
-
ver:
|
|
188
|
+
ver: number;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
export interface SearchOptions {
|
|
192
|
-
calExpandInstEnd?:
|
|
193
|
-
calExpandInstStart?:
|
|
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?:
|
|
214
|
-
op?:
|
|
215
|
-
value?:
|
|
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?:
|
|
232
|
-
internal?:
|
|
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?:
|
|
271
|
+
recursive?: boolean;
|
|
272
272
|
rgb?: string;
|
|
273
273
|
tagNames?: string;
|
|
274
274
|
}
|
package/src/normalize/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EntityMapping, EntityMappingValue, NormalizedKey } from './types';
|
|
2
2
|
|
|
3
|
-
function normalizeKey(key: string, schema: Entity, inverse:
|
|
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
|
|
package/src/request/index.ts
CHANGED
|
@@ -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]
|
|
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]
|
|
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]
|
|
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
|
|
package/src/request/types.ts
CHANGED
|
@@ -19,14 +19,14 @@ export interface BaseRequestOptions {
|
|
|
19
19
|
authToken?: string;
|
|
20
20
|
credentials?: RequestCredentials;
|
|
21
21
|
csrfToken?: string | null;
|
|
22
|
-
encrypt?:
|
|
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?:
|
|
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
|
-
|
|
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
|
|
2840
|
-
|
|
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']>;
|
|
@@ -181,6 +181,11 @@ enum AddressType {
|
|
|
181
181
|
rf # resent-from
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
+
enum ConversationOrderBy {
|
|
185
|
+
dateAsc
|
|
186
|
+
dateDesc
|
|
187
|
+
}
|
|
188
|
+
|
|
184
189
|
# https://github.com/Zimbra/zm-mailbox/blob/develop/store/docs/acl.md
|
|
185
190
|
enum GranteeType {
|
|
186
191
|
usr # Zimbra User
|
|
@@ -1719,6 +1724,7 @@ type Preferences {
|
|
|
1719
1724
|
zimbraPrefPop3DownloadSince: String
|
|
1720
1725
|
zimbraPrefPop3IncludeSpam: Boolean
|
|
1721
1726
|
zimbraPrefPop3DeleteOption: Pop3DeleteOption
|
|
1727
|
+
zimbraPrefConversationOrder: ConversationOrderBy
|
|
1722
1728
|
}
|
|
1723
1729
|
|
|
1724
1730
|
type GetAppointmentResponse {
|
|
@@ -2673,7 +2679,7 @@ input FolderActionChangeColorInput {
|
|
|
2673
2679
|
color: Int!
|
|
2674
2680
|
}
|
|
2675
2681
|
|
|
2676
|
-
# Special case of FolderAction for `
|
|
2682
|
+
# Special case of FolderAction for `checkCalendars` resolver
|
|
2677
2683
|
input FolderActionCheckCalendarInput {
|
|
2678
2684
|
id: ID!
|
|
2679
2685
|
value: Boolean
|
|
@@ -2809,6 +2815,7 @@ input PreferencesInput {
|
|
|
2809
2815
|
zimbraPrefPop3DownloadSince: String
|
|
2810
2816
|
zimbraPrefPop3IncludeSpam: Boolean
|
|
2811
2817
|
zimbraPrefPop3DeleteOption: Pop3DeleteOption
|
|
2818
|
+
zimbraPrefConversationOrder: ConversationOrderBy
|
|
2812
2819
|
}
|
|
2813
2820
|
|
|
2814
2821
|
input ModifyIdentityInput {
|
|
@@ -3750,7 +3757,7 @@ type Mutation {
|
|
|
3750
3757
|
content: String
|
|
3751
3758
|
contentType: String
|
|
3752
3759
|
): ProfileImageChangeResponse
|
|
3753
|
-
|
|
3760
|
+
checkCalendars(actions: [FolderActionCheckCalendarInput!]): [ActionOpResponse]
|
|
3754
3761
|
contactAction(
|
|
3755
3762
|
id: ID
|
|
3756
3763
|
ids: [ID!]
|
package/src/schema/schema.ts
CHANGED
|
@@ -283,8 +283,10 @@ export function createZimbraSchema(options: ZimbraSchemaOptions): {
|
|
|
283
283
|
client.createMountpoint(variables as CreateMountpointInput),
|
|
284
284
|
deleteAppointment: (_, { appointment }) =>
|
|
285
285
|
client.deleteAppointment(appointment as DeleteAppointmentInput),
|
|
286
|
-
|
|
287
|
-
|
|
286
|
+
checkCalendars: (
|
|
287
|
+
_,
|
|
288
|
+
variables: { actions: FolderActionCheckCalendarInput[] }
|
|
289
|
+
): Promise<ActionOpResponse[]> => client.checkCalendars(variables.actions),
|
|
288
290
|
counterAppointment: (_, { counterAppointmentInvite }) =>
|
|
289
291
|
client.counterAppointment(counterAppointmentInvite as CounterAppointmentInput),
|
|
290
292
|
createCalendar: (_, { name, color, url, parentFolderId }) =>
|
|
@@ -389,8 +391,8 @@ export function createZimbraSchema(options: ZimbraSchemaOptions): {
|
|
|
389
391
|
(context.local ? localStoreClient : client).sendMessage(
|
|
390
392
|
message as SendMessageInput,
|
|
391
393
|
accountName as string,
|
|
392
|
-
sign as
|
|
393
|
-
encrypt as
|
|
394
|
+
sign as boolean,
|
|
395
|
+
encrypt as boolean
|
|
394
396
|
),
|
|
395
397
|
saveSMimeCert: (_, { upload, password }) =>
|
|
396
398
|
client.saveSMimeCert(upload as SaveSMimeCertInputUpload, password as string),
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/** List of content type not show as attachment */
|
|
2
2
|
const ignoreContentTypeToShowAsAttachment = [
|
|
3
|
-
'application/pkcs7-signature',
|
|
4
|
-
'application/x-pkcs7-signature',
|
|
5
3
|
'message/delivery-status', // present in Undelivered mail
|
|
6
4
|
'message/disposition-notification', // present in read-receipt response
|
|
7
5
|
'xml/x-zimbra-share' // present in folder share message
|
|
@@ -87,16 +85,16 @@ export function normalizeMimeParts(
|
|
|
87
85
|
if (forcedContentDisposition === 'attachments') {
|
|
88
86
|
attachment.contentDisposition = 'attachment';
|
|
89
87
|
} else if (forcedContentDisposition === 'inlineAttachments') {
|
|
90
|
-
attachment.contentDisposition
|
|
88
|
+
attachment.contentDisposition = 'inline';
|
|
91
89
|
}
|
|
92
90
|
}
|
|
93
91
|
|
|
94
92
|
attachment.contentId = attachment.contentId
|
|
95
93
|
? normalizeCid(attachment.contentId)
|
|
96
94
|
: ~normalizeType(attachment.contentType).indexOf('image/') &&
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
attachment.contentDisposition === 'inline'
|
|
96
|
+
? `AUTO-GEN-CID-${attachment.messageId}-${attachment.part}-${attachment.size}`
|
|
97
|
+
: undefined;
|
|
100
98
|
|
|
101
99
|
return attachment;
|
|
102
100
|
};
|
|
@@ -186,6 +184,12 @@ export function normalizeMimeParts(
|
|
|
186
184
|
if (!isBody && type.split('/')[0] !== 'multipart') {
|
|
187
185
|
let mode = isInline ? 'inlineAttachments' : 'attachments';
|
|
188
186
|
|
|
187
|
+
// If inline but NOT an image, treat as regular attachment
|
|
188
|
+
if (isInline && !type.startsWith('image/')) {
|
|
189
|
+
mode = 'attachments';
|
|
190
|
+
part.contentDisposition = 'attachment';
|
|
191
|
+
}
|
|
192
|
+
|
|
189
193
|
!ignoreContentTypeToShowAsAttachment.includes(part.contentType) &&
|
|
190
194
|
(acc[mode] || (acc[mode] = [])).push(processAttachment(part, mode));
|
|
191
195
|
|
|
@@ -96,9 +96,9 @@ const ignoreAttributes = [
|
|
|
96
96
|
'vcardXProps',
|
|
97
97
|
'imagepart'
|
|
98
98
|
];
|
|
99
|
-
export function createContactBody(data: any, isDesktop:
|
|
99
|
+
export function createContactBody(data: any, isDesktop: boolean) {
|
|
100
100
|
const { attributes, ...rest } = data;
|
|
101
|
-
const contactAttrs = <
|
|
101
|
+
const contactAttrs = <object[]>[];
|
|
102
102
|
|
|
103
103
|
for (const [key, val] of Object.entries(attributes)) {
|
|
104
104
|
if (key !== 'other') {
|