@zimbra/api-client 67.0.0 → 71.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/dist/schema.graphql +14 -0
- package/dist/src/apollo/offline-queue-link/index.d.ts +2 -2
- package/dist/src/batch-client/index.d.ts +1 -1
- package/dist/src/request/types.d.ts +1 -1
- package/dist/src/schema/generated-schema-types.d.ts +1077 -1066
- package/dist/zm-api-js-client.esm.js +1124 -1080
- package/dist/zm-api-js-client.esm.js.map +1 -1
- package/dist/zm-api-js-client.js +1 -1
- package/dist/zm-api-js-client.js.map +1 -1
- package/dist/zm-api-js-client.umd.js +1 -1
- package/dist/zm-api-js-client.umd.js.map +1 -1
- package/package-lock.json +2402 -5603
- package/package.json +29 -29
- package/src/apollo/offline-queue-link/index.ts +1 -1
- package/src/apollo/zimbra-in-memory-cache.ts +38 -0
- package/src/batch-client/index.ts +20 -5
- package/src/normalize/entities.ts +4 -1
- package/src/request/index.ts +2 -2
- package/src/request/types.ts +1 -1
- package/src/schema/generated-schema-types.ts +1126 -1114
- package/src/schema/schema.graphql +14 -0
- package/src/utils/normalize-email-addresses.ts +2 -1
- package/src/utils/normalize-mime-parts.ts +3 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zimbra/api-client",
|
|
3
3
|
"amdName": "zmApiJsClient",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "71.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",
|
|
@@ -44,51 +44,51 @@
|
|
|
44
44
|
]
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@apollo/client": "^3.
|
|
48
|
-
"dataloader": "^
|
|
49
|
-
"graphql": "^15.
|
|
50
|
-
"graphql-tools": "^
|
|
47
|
+
"@apollo/client": "^3.4.16",
|
|
48
|
+
"dataloader": "^2.0.0",
|
|
49
|
+
"graphql": "^15.6.1",
|
|
50
|
+
"graphql-tools": "^8.2.0",
|
|
51
51
|
"lodash": "^4.17.21",
|
|
52
|
-
"mitt": "^
|
|
52
|
+
"mitt": "^3.0.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@babel/cli": "^7.
|
|
56
|
-
"@babel/core": "^7.
|
|
57
|
-
"@babel/plugin-proposal-class-properties": "^7.
|
|
58
|
-
"@babel/preset-env": "^7.
|
|
59
|
-
"@babel/preset-typescript": "^7.
|
|
60
|
-
"@babel/register": "^7.
|
|
61
|
-
"@graphql-codegen/cli": "^
|
|
62
|
-
"@graphql-codegen/typescript": "^
|
|
63
|
-
"@rollup/plugin-babel": "^5.
|
|
64
|
-
"@rollup/plugin-commonjs": "^
|
|
65
|
-
"@rollup/plugin-node-resolve": "^
|
|
66
|
-
"@rollup/plugin-typescript": "^
|
|
55
|
+
"@babel/cli": "^7.15.7",
|
|
56
|
+
"@babel/core": "^7.15.8",
|
|
57
|
+
"@babel/plugin-proposal-class-properties": "^7.14.5",
|
|
58
|
+
"@babel/preset-env": "^7.15.8",
|
|
59
|
+
"@babel/preset-typescript": "^7.15.0",
|
|
60
|
+
"@babel/register": "^7.15.3",
|
|
61
|
+
"@graphql-codegen/cli": "^2.2.0",
|
|
62
|
+
"@graphql-codegen/typescript": "^2.2.2",
|
|
63
|
+
"@rollup/plugin-babel": "^5.3.0",
|
|
64
|
+
"@rollup/plugin-commonjs": "^21.0.0",
|
|
65
|
+
"@rollup/plugin-node-resolve": "^13.0.5",
|
|
66
|
+
"@rollup/plugin-typescript": "^8.2.5",
|
|
67
67
|
"@types/graphql": "^14.5.0",
|
|
68
|
-
"@types/lodash": "^4.14.
|
|
69
|
-
"@types/node": "^
|
|
68
|
+
"@types/lodash": "^4.14.175",
|
|
69
|
+
"@types/node": "^16.10.3",
|
|
70
70
|
"@types/whatwg-fetch": "^0.0.33",
|
|
71
71
|
"audit-ci": "^4.1.0",
|
|
72
72
|
"babel-plugin-lodash": "^3.3.4",
|
|
73
|
-
"chai": "^4.
|
|
73
|
+
"chai": "^4.3.4",
|
|
74
74
|
"copyfiles": "^2.4.1",
|
|
75
75
|
"cross-var": "^1.1.0",
|
|
76
76
|
"file-matcher": "^1.3.0",
|
|
77
|
-
"husky": "^
|
|
77
|
+
"husky": "^7.0.2",
|
|
78
78
|
"is-ci": "^3.0.0",
|
|
79
|
-
"lint-staged": "^11.
|
|
80
|
-
"mocha": "^
|
|
79
|
+
"lint-staged": "^11.2.0",
|
|
80
|
+
"mocha": "^9.1.2",
|
|
81
81
|
"npm-run-all": "^4.1.5",
|
|
82
|
-
"prettier": "^2.
|
|
82
|
+
"prettier": "^2.4.1",
|
|
83
83
|
"rimraf": "^3.0.2",
|
|
84
|
-
"rollup": "^2.
|
|
84
|
+
"rollup": "^2.58.0",
|
|
85
85
|
"rollup-plugin-graphql": "^0.1.0",
|
|
86
86
|
"rollup-plugin-local-resolve": "^1.0.7",
|
|
87
|
-
"tslib": "^2.
|
|
87
|
+
"tslib": "^2.3.1",
|
|
88
88
|
"tslint": "^5.20.1",
|
|
89
89
|
"tslint-config-prettier": "^1.18.0",
|
|
90
90
|
"tslint-plugin-prettier": "^2.3.0",
|
|
91
|
-
"typescript": "^4.
|
|
92
|
-
"uglify-js": "^3.
|
|
91
|
+
"typescript": "^4.4.3",
|
|
92
|
+
"uglify-js": "^3.14.2"
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -127,7 +127,7 @@ export class OfflineQueueLink extends ApolloLink {
|
|
|
127
127
|
// Returns a Promise that resolves after all operations are processed
|
|
128
128
|
// regardless of success.
|
|
129
129
|
retry = () =>
|
|
130
|
-
new Promise(resolve => {
|
|
130
|
+
new Promise<void>(resolve => {
|
|
131
131
|
let outstandingReqs = this.operationQueue.length;
|
|
132
132
|
if (!outstandingReqs) {
|
|
133
133
|
return resolve();
|
|
@@ -34,6 +34,11 @@ const dataIdFromObject = (object: any) => {
|
|
|
34
34
|
case 'ContactListMember':
|
|
35
35
|
// Contacts list members don't have ids
|
|
36
36
|
return `${object.type}:${object.value}`;
|
|
37
|
+
case 'MessageInfo':
|
|
38
|
+
if (object.part && object.part !== null) {
|
|
39
|
+
return `${defaultDataIdFromObject(object)}:${object.part}`;
|
|
40
|
+
}
|
|
41
|
+
return defaultDataIdFromObject(object);
|
|
37
42
|
default:
|
|
38
43
|
return defaultDataIdFromObject(object);
|
|
39
44
|
}
|
|
@@ -55,6 +60,39 @@ const typePolicies = {
|
|
|
55
60
|
merge: true
|
|
56
61
|
}
|
|
57
62
|
}
|
|
63
|
+
},
|
|
64
|
+
Contact: {
|
|
65
|
+
fields: {
|
|
66
|
+
attributes: {
|
|
67
|
+
merge: true
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
Conversation: {
|
|
72
|
+
fields: {
|
|
73
|
+
messages: {
|
|
74
|
+
// @TODO ideally we should write proper merge function here,
|
|
75
|
+
// but as our app is already handling at caller level
|
|
76
|
+
// we are just overwriting cache data here
|
|
77
|
+
merge: false
|
|
78
|
+
},
|
|
79
|
+
emailAddresses: {
|
|
80
|
+
// @TODO ideally we should write proper merge function here,
|
|
81
|
+
// but as our app is already handling at caller level
|
|
82
|
+
// we are just overwriting cache data here
|
|
83
|
+
merge: false
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
MessageInfo: {
|
|
88
|
+
fields: {
|
|
89
|
+
emailAddresses: {
|
|
90
|
+
// @TODO ideally we should write proper merge function here,
|
|
91
|
+
// but as our app is already handling at caller level
|
|
92
|
+
// we are just overwriting cache data here
|
|
93
|
+
merge: false
|
|
94
|
+
}
|
|
95
|
+
}
|
|
58
96
|
}
|
|
59
97
|
};
|
|
60
98
|
|
|
@@ -1027,6 +1027,20 @@ export class ZimbraBatchClient {
|
|
|
1027
1027
|
|
|
1028
1028
|
if (folders.folders) {
|
|
1029
1029
|
folders.folders = folders.folders.map(setUnreadDescendentFlag);
|
|
1030
|
+
|
|
1031
|
+
folders.folders = folders.folders.map((currentFolder: any) => {
|
|
1032
|
+
if (currentFolder.linkedFolders) {
|
|
1033
|
+
currentFolder.linkedFolders = currentFolder.linkedFolders.map((linkFolder: any) => {
|
|
1034
|
+
const { absFolderPath, oname, folders } = linkFolder;
|
|
1035
|
+
|
|
1036
|
+
if (oname && folders) {
|
|
1037
|
+
linkFolder.folders = updateAbsoluteFolderPath(oname, absFolderPath, folders);
|
|
1038
|
+
}
|
|
1039
|
+
return linkFolder;
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
return currentFolder;
|
|
1043
|
+
});
|
|
1030
1044
|
}
|
|
1031
1045
|
if (folders.linkedFolders) {
|
|
1032
1046
|
folders.linkedFolders = folders.linkedFolders.map(setUnreadDescendentFlag);
|
|
@@ -1129,7 +1143,7 @@ export class ZimbraBatchClient {
|
|
|
1129
1143
|
return mapValuesDeep(res, coerceStringToBoolean);
|
|
1130
1144
|
});
|
|
1131
1145
|
|
|
1132
|
-
public getMessage = ({ id, html, raw, header, read, max, ridZ }: GetMessageOptions) =>
|
|
1146
|
+
public getMessage = ({ id, html, raw, header, read, max, ridZ, part }: GetMessageOptions) =>
|
|
1133
1147
|
this.jsonRequest({
|
|
1134
1148
|
name: 'GetMsg',
|
|
1135
1149
|
body: {
|
|
@@ -1144,7 +1158,8 @@ export class ZimbraBatchClient {
|
|
|
1144
1158
|
// max body length (look for mp.truncated=1)
|
|
1145
1159
|
max: max || 250000,
|
|
1146
1160
|
raw: raw ? 1 : 0,
|
|
1147
|
-
...(ridZ && { ridZ: ridZ })
|
|
1161
|
+
...(ridZ && { ridZ: ridZ }),
|
|
1162
|
+
...(part && { part: part })
|
|
1148
1163
|
}
|
|
1149
1164
|
}
|
|
1150
1165
|
}).then(res => (res && res.m ? this.normalizeMessage(res.m[0]) : null));
|
|
@@ -1306,7 +1321,7 @@ export class ZimbraBatchClient {
|
|
|
1306
1321
|
password,
|
|
1307
1322
|
recoveryCode,
|
|
1308
1323
|
tokenType,
|
|
1309
|
-
persistAuthTokenCookie
|
|
1324
|
+
persistAuthTokenCookie,
|
|
1310
1325
|
twoFactorCode,
|
|
1311
1326
|
deviceTrusted,
|
|
1312
1327
|
csrfTokenSecured
|
|
@@ -1800,7 +1815,7 @@ export class ZimbraBatchClient {
|
|
|
1800
1815
|
});
|
|
1801
1816
|
};
|
|
1802
1817
|
|
|
1803
|
-
private batchDataHandler = (requests:
|
|
1818
|
+
private batchDataHandler = (requests: ReadonlyArray<RequestOptions>) =>
|
|
1804
1819
|
batchJsonRequest({
|
|
1805
1820
|
requests,
|
|
1806
1821
|
...this.getAdditionalRequestOptions()
|
|
@@ -1837,7 +1852,7 @@ export class ZimbraBatchClient {
|
|
|
1837
1852
|
}
|
|
1838
1853
|
};
|
|
1839
1854
|
|
|
1840
|
-
private dataHandler = (requests:
|
|
1855
|
+
private dataHandler = (requests: ReadonlyArray<JsonRequestOptions>) =>
|
|
1841
1856
|
jsonRequest({
|
|
1842
1857
|
...requests[0],
|
|
1843
1858
|
// check if login request then don't add csrfToken
|
|
@@ -104,6 +104,7 @@ const CalendarItemOrganizer = new Entity({
|
|
|
104
104
|
|
|
105
105
|
const commonFieldForMessageAndDocuments = {
|
|
106
106
|
d: 'date',
|
|
107
|
+
sd: 'senderDate',
|
|
107
108
|
f: 'flags',
|
|
108
109
|
l: 'folderId',
|
|
109
110
|
md: 'changeDate',
|
|
@@ -112,7 +113,8 @@ const commonFieldForMessageAndDocuments = {
|
|
|
112
113
|
s: 'size',
|
|
113
114
|
sf: 'sortField',
|
|
114
115
|
t: 'tags',
|
|
115
|
-
tn: 'tagNames'
|
|
116
|
+
tn: 'tagNames',
|
|
117
|
+
part: 'part'
|
|
116
118
|
};
|
|
117
119
|
|
|
118
120
|
const commonMessageFields = {
|
|
@@ -190,6 +192,7 @@ const ExistingAttachmentsInfo = new Entity({
|
|
|
190
192
|
const AttachmentsInfo = new Entity({
|
|
191
193
|
aid: 'attachmentId',
|
|
192
194
|
doc: 'documents',
|
|
195
|
+
m: 'messages',
|
|
193
196
|
mp: ['existingAttachments', ExistingAttachmentsInfo]
|
|
194
197
|
});
|
|
195
198
|
|
package/src/request/index.ts
CHANGED
|
@@ -54,7 +54,7 @@ function _responseParseHandler(response: Response): Promise<ParsedResponse> {
|
|
|
54
54
|
return response;
|
|
55
55
|
});
|
|
56
56
|
} catch (e) {
|
|
57
|
-
(response as ParsedResponse).parseError = e;
|
|
57
|
+
(response as ParsedResponse).parseError = <any>e;
|
|
58
58
|
return Promise.resolve(response);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -97,7 +97,7 @@ function faultError(response: ParsedResponse, faults: any) {
|
|
|
97
97
|
* Create one key per SOAP command name, with a value
|
|
98
98
|
* containing an array of the requests for that command.
|
|
99
99
|
*/
|
|
100
|
-
function batchBody(requests:
|
|
100
|
+
function batchBody(requests: ReadonlyArray<RequestOptions>) {
|
|
101
101
|
return reduce(
|
|
102
102
|
requests,
|
|
103
103
|
(body: { [key: string]: any }, request) => {
|
package/src/request/types.ts
CHANGED
|
@@ -39,7 +39,7 @@ export interface RequestOptions {
|
|
|
39
39
|
export interface JsonRequestOptions extends BaseRequestOptions, RequestOptions {}
|
|
40
40
|
|
|
41
41
|
export interface BatchRequestOptions extends BaseRequestOptions {
|
|
42
|
-
requests:
|
|
42
|
+
requests: ReadonlyArray<RequestOptions>;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export interface RequestResponse {
|