@zimbra/api-client 88.0.0 → 90.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 +158 -12
- package/dist/src/batch-client/index.d.ts +8 -4
- package/dist/src/normalize/entities.d.ts +2 -0
- package/dist/src/schema/generated-schema-types.d.ts +1897 -1724
- package/dist/zm-api-js-client.esm.js +7599 -9542
- package/dist/zm-api-js-client.esm.js.map +1 -1
- package/dist/zm-api-js-client.js +5 -10
- package/dist/zm-api-js-client.js.map +1 -1
- package/dist/zm-api-js-client.umd.js +6 -11
- package/dist/zm-api-js-client.umd.js.map +1 -1
- package/package-lock.json +1339 -386
- package/package.json +9 -7
- package/rollup.config.js +13 -14
- package/src/batch-client/index.ts +112 -20
- package/src/normalize/entities.ts +12 -0
- package/src/schema/generated-schema-types.ts +1907 -1724
- package/src/schema/schema.graphql +158 -12
- package/src/schema/schema.ts +12 -3
- package/src/utils/normalize-mime-parts.ts +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zimbra/api-client",
|
|
3
3
|
"amdName": "zmApiJsClient",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "90.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",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"clean": "rimraf dist",
|
|
18
18
|
"build": "npm-run-all clean generateSchemaTypes rollup:* -p build:ts minify:* copySchema",
|
|
19
19
|
"build:ts": "tsc --emitDeclarationOnly --declaration --outDir \"dist\"",
|
|
20
|
+
"build:analyze": "visualize=true npm run build",
|
|
20
21
|
"copySchema": "copyfiles -f src/schema/schema.graphql dist",
|
|
21
22
|
"rollup:cjs": "cross-var rollup -c rollup.config.js -m -f cjs -n $npm_package_amdName $npm_package_source -o $npm_package_main",
|
|
22
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",
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
46
47
|
"@apollo/client": "3.4.16",
|
|
47
|
-
"@graphql-tools/schema": "^
|
|
48
|
+
"@graphql-tools/schema": "^10.0.3",
|
|
48
49
|
"dataloader": "^2.2.2",
|
|
49
50
|
"graphql": "^15.8.0",
|
|
50
51
|
"lodash": "^4.17.21",
|
|
@@ -58,15 +59,15 @@
|
|
|
58
59
|
"@babel/preset-typescript": "^7.17.12",
|
|
59
60
|
"@babel/register": "^7.17.7",
|
|
60
61
|
"@graphql-codegen/cli": "^2.6.2",
|
|
61
|
-
"@graphql-codegen/typescript": "^
|
|
62
|
-
"@rollup/plugin-babel": "^
|
|
62
|
+
"@graphql-codegen/typescript": "^4.0.1",
|
|
63
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
63
64
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
64
|
-
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
65
65
|
"@rollup/plugin-graphql": "^1.1.0",
|
|
66
|
+
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
66
67
|
"@rollup/plugin-typescript": "^11.1.5",
|
|
67
68
|
"@types/graphql": "^14.5.0",
|
|
68
69
|
"@types/lodash": "^4.14.182",
|
|
69
|
-
"@types/node": "^
|
|
70
|
+
"@types/node": "^20.10.4",
|
|
70
71
|
"@types/whatwg-fetch": "^0.0.33",
|
|
71
72
|
"babel-plugin-lodash": "^3.3.4",
|
|
72
73
|
"chai": "^4.3.7",
|
|
@@ -81,11 +82,12 @@
|
|
|
81
82
|
"rimraf": "^5.0.1",
|
|
82
83
|
"rollup": "^2.75.0",
|
|
83
84
|
"rollup-plugin-local-resolve": "^1.0.7",
|
|
85
|
+
"rollup-plugin-visualizer": "^5.11.0",
|
|
84
86
|
"tslib": "^2.5.0",
|
|
85
87
|
"tslint": "^6.1.3",
|
|
86
88
|
"tslint-config-prettier": "^1.18.0",
|
|
87
89
|
"tslint-plugin-prettier": "^2.3.0",
|
|
88
|
-
"typescript": "^
|
|
90
|
+
"typescript": "^5.3.3",
|
|
89
91
|
"uglify-js": "^3.15.5"
|
|
90
92
|
}
|
|
91
93
|
}
|
package/rollup.config.js
CHANGED
|
@@ -4,23 +4,21 @@ import graphql from '@rollup/plugin-graphql';
|
|
|
4
4
|
import localResolve from 'rollup-plugin-local-resolve';
|
|
5
5
|
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
6
6
|
import commonjs from '@rollup/plugin-commonjs';
|
|
7
|
-
import
|
|
7
|
+
import { visualizer } from 'rollup-plugin-visualizer';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const FORMAT = process.env.FORMAT;
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
['castArray', 'get','isError', 'isObject', 'mapValues', 'reduce', 'omitBy', 'uniqBy', 'concat', 'uniqBy', 'differenceBy', 'forEach'].map(v => 'lodash/'+v),
|
|
18
|
-
['graphql']) :
|
|
19
|
-
[];
|
|
11
|
+
const externalDeps = [
|
|
12
|
+
'@apollo/client',
|
|
13
|
+
'graphql',
|
|
14
|
+
'lodash',
|
|
15
|
+
'mitt'
|
|
16
|
+
];
|
|
20
17
|
|
|
18
|
+
const getExternalDeps = id => externalDeps.find(pkgName => id.includes('/node_modules/' + pkgName + '/'));
|
|
21
19
|
|
|
22
20
|
export default {
|
|
23
|
-
external,
|
|
21
|
+
...(FORMAT==='es' && { external: getExternalDeps }),
|
|
24
22
|
context: 'commonjsGlobal', // what should "this" be at the top level when it is used by another module
|
|
25
23
|
plugins: [
|
|
26
24
|
graphql(),
|
|
@@ -34,9 +32,10 @@ export default {
|
|
|
34
32
|
extensions: ['.ts'],
|
|
35
33
|
exclude: 'node_modules/**',
|
|
36
34
|
babelHelpers: 'bundled'
|
|
37
|
-
})
|
|
35
|
+
}),
|
|
36
|
+
...(process.env.visualize ? [visualizer({ open: true }) ] : [])
|
|
38
37
|
],
|
|
39
38
|
output: {
|
|
40
39
|
exports: FORMAT==='es' ? null : 'named'
|
|
41
|
-
}
|
|
40
|
+
}
|
|
42
41
|
};
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
CreateMountpointRequest,
|
|
23
23
|
CreateSignatureRequest,
|
|
24
24
|
DiscoverRightsResponse,
|
|
25
|
+
DLActionEntity,
|
|
25
26
|
DlGroupMember,
|
|
26
27
|
DocumentActionData,
|
|
27
28
|
Filter,
|
|
@@ -67,6 +68,7 @@ import {
|
|
|
67
68
|
CreateTagInput,
|
|
68
69
|
DeleteAppointmentInput,
|
|
69
70
|
DeleteIdentityInput,
|
|
71
|
+
DistributionListActionInput,
|
|
70
72
|
EnableTwoFactorAuthInput,
|
|
71
73
|
ExternalAccountAddInput,
|
|
72
74
|
ExternalAccountImportInput,
|
|
@@ -87,6 +89,7 @@ import {
|
|
|
87
89
|
SaveSMimeCertInputUpload,
|
|
88
90
|
SearchFolderInput,
|
|
89
91
|
SendMessageInput,
|
|
92
|
+
SendTwoFactorAuthCodeInput,
|
|
90
93
|
ShareNotificationInput,
|
|
91
94
|
SignatureInput,
|
|
92
95
|
WhiteBlackListInput,
|
|
@@ -333,30 +336,37 @@ export class ZimbraBatchClient {
|
|
|
333
336
|
body: {
|
|
334
337
|
sections: 'mbox,attrs,zimlets,props'
|
|
335
338
|
}
|
|
336
|
-
}).then(res =>
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
339
|
+
}).then(res => {
|
|
340
|
+
const {
|
|
341
|
+
zimbraMailAlias,
|
|
342
|
+
zimbraTwoFactorAuthMethodAllowed,
|
|
343
|
+
zimbraTwoFactorAuthMethodEnabled
|
|
344
|
+
} = res?.attrs?._attrs || {};
|
|
345
|
+
return {
|
|
346
|
+
...res,
|
|
347
|
+
attrs: {
|
|
348
|
+
...mapValuesDeep(res?.attrs?._attrs, coerceStringToBoolean),
|
|
349
|
+
zimbraMailAlias: [].concat(zimbraMailAlias || []),
|
|
350
|
+
zimbraTwoFactorAuthMethodAllowed: [].concat(zimbraTwoFactorAuthMethodAllowed || []),
|
|
351
|
+
zimbraTwoFactorAuthMethodEnabled: [].concat(zimbraTwoFactorAuthMethodEnabled || [])
|
|
352
|
+
},
|
|
353
|
+
...(res?.license?.attr && {
|
|
354
|
+
license: {
|
|
355
|
+
status: res.license.status,
|
|
356
|
+
attr: mapValuesDeep(res.license.attr, coerceStringToBoolean)
|
|
357
|
+
}
|
|
358
|
+
}),
|
|
359
|
+
zimlets: {
|
|
360
|
+
zimlet: res?.zimlets?.zimlet?.map(({ zimlet, zimletContext, zimletConfig }: any) => ({
|
|
352
361
|
zimlet,
|
|
353
362
|
zimletContext,
|
|
354
363
|
...(zimletConfig && {
|
|
355
364
|
zimletConfig: normalize(ZimletConfigEntity)(zimletConfig)
|
|
356
365
|
})
|
|
357
366
|
}))
|
|
358
|
-
|
|
359
|
-
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
});
|
|
360
370
|
|
|
361
371
|
public accountOnlyRemoteWipeSync = (deviceId: String) =>
|
|
362
372
|
this.jsonRequest({
|
|
@@ -757,10 +767,15 @@ export class ZimbraBatchClient {
|
|
|
757
767
|
singleRequest: true
|
|
758
768
|
}).then(Boolean);
|
|
759
769
|
|
|
760
|
-
public disableTwoFactorAuth = () =>
|
|
770
|
+
public disableTwoFactorAuth = (method: string) =>
|
|
761
771
|
this.jsonRequest({
|
|
762
772
|
name: 'DisableTwoFactorAuth',
|
|
763
773
|
namespace: Namespace.Account,
|
|
774
|
+
body: {
|
|
775
|
+
method: {
|
|
776
|
+
_content: method
|
|
777
|
+
}
|
|
778
|
+
},
|
|
764
779
|
singleRequest: true
|
|
765
780
|
}).then(Boolean);
|
|
766
781
|
|
|
@@ -783,6 +798,16 @@ export class ZimbraBatchClient {
|
|
|
783
798
|
singleRequest: true
|
|
784
799
|
}).then(Boolean);
|
|
785
800
|
|
|
801
|
+
public distributionListAction = ({ action, dl }: DistributionListActionInput) =>
|
|
802
|
+
this.jsonRequest({
|
|
803
|
+
name: 'DistributionListAction',
|
|
804
|
+
body: {
|
|
805
|
+
action: denormalize(DLActionEntity)(action),
|
|
806
|
+
dl
|
|
807
|
+
},
|
|
808
|
+
namespace: Namespace.Account
|
|
809
|
+
}).then(Boolean);
|
|
810
|
+
|
|
786
811
|
public documentAction = (options: ActionOptions) =>
|
|
787
812
|
this.documentActionResponse(ActionType.document, options);
|
|
788
813
|
|
|
@@ -826,6 +851,8 @@ export class ZimbraBatchClient {
|
|
|
826
851
|
|
|
827
852
|
public enableTwoFactorAuth = ({
|
|
828
853
|
name,
|
|
854
|
+
email,
|
|
855
|
+
method,
|
|
829
856
|
password,
|
|
830
857
|
authToken,
|
|
831
858
|
twoFactorCode,
|
|
@@ -838,6 +865,16 @@ export class ZimbraBatchClient {
|
|
|
838
865
|
name: {
|
|
839
866
|
_content: name
|
|
840
867
|
},
|
|
868
|
+
...(email && {
|
|
869
|
+
email: {
|
|
870
|
+
_content: email
|
|
871
|
+
}
|
|
872
|
+
}),
|
|
873
|
+
...(method && {
|
|
874
|
+
method: {
|
|
875
|
+
_content: method
|
|
876
|
+
}
|
|
877
|
+
}),
|
|
841
878
|
...(password && {
|
|
842
879
|
password: {
|
|
843
880
|
_content: password
|
|
@@ -1044,6 +1081,20 @@ export class ZimbraBatchClient {
|
|
|
1044
1081
|
namespace: Namespace.Sync
|
|
1045
1082
|
}).then(res => get(res, 'device') || []);
|
|
1046
1083
|
|
|
1084
|
+
public getDistributionList = (dl: String, needOwners: Boolean, needRights: String, by: String) =>
|
|
1085
|
+
this.jsonRequest({
|
|
1086
|
+
name: 'GetDistributionList',
|
|
1087
|
+
body: {
|
|
1088
|
+
dl: {
|
|
1089
|
+
by,
|
|
1090
|
+
_content: dl
|
|
1091
|
+
},
|
|
1092
|
+
needOwners,
|
|
1093
|
+
needRights
|
|
1094
|
+
},
|
|
1095
|
+
namespace: Namespace.Account
|
|
1096
|
+
});
|
|
1097
|
+
|
|
1047
1098
|
public getDistributionListMembers = (limit: String, offset: String, dl: String) =>
|
|
1048
1099
|
this.jsonRequest({
|
|
1049
1100
|
name: 'GetDistributionListMembers',
|
|
@@ -1451,7 +1502,19 @@ export class ZimbraBatchClient {
|
|
|
1451
1502
|
...(deviceTrusted && { deviceTrusted })
|
|
1452
1503
|
},
|
|
1453
1504
|
namespace: Namespace.Account
|
|
1454
|
-
}).then(res =>
|
|
1505
|
+
}).then(res => {
|
|
1506
|
+
const zimbraTwoFactorAuthMethodAllowed = (
|
|
1507
|
+
res?.zimbraTwoFactorAuthMethodAllowed?.method || []
|
|
1508
|
+
).map((m: any) => m._content);
|
|
1509
|
+
const zimbraTwoFactorAuthMethodEnabled = (
|
|
1510
|
+
res?.zimbraTwoFactorAuthMethodEnabled?.method || []
|
|
1511
|
+
).map((m: any) => m._content);
|
|
1512
|
+
return {
|
|
1513
|
+
...mapValuesDeep(res, coerceStringToBoolean),
|
|
1514
|
+
...(zimbraTwoFactorAuthMethodAllowed && { zimbraTwoFactorAuthMethodAllowed }),
|
|
1515
|
+
...(zimbraTwoFactorAuthMethodEnabled && { zimbraTwoFactorAuthMethodEnabled })
|
|
1516
|
+
};
|
|
1517
|
+
});
|
|
1455
1518
|
|
|
1456
1519
|
public logout = () =>
|
|
1457
1520
|
this.jsonRequest({
|
|
@@ -1855,6 +1918,22 @@ export class ZimbraBatchClient {
|
|
|
1855
1918
|
singleRequest: true
|
|
1856
1919
|
}).then(Boolean);
|
|
1857
1920
|
|
|
1921
|
+
public sendTwoFactorAuthCode = ({ action, authToken }: SendTwoFactorAuthCodeInput) => {
|
|
1922
|
+
return this.jsonRequest({
|
|
1923
|
+
name: 'SendTwoFactorAuthCode',
|
|
1924
|
+
namespace: Namespace.Account,
|
|
1925
|
+
body: {
|
|
1926
|
+
action: {
|
|
1927
|
+
_content: action
|
|
1928
|
+
},
|
|
1929
|
+
authToken: {
|
|
1930
|
+
_content: authToken
|
|
1931
|
+
}
|
|
1932
|
+
},
|
|
1933
|
+
singleRequest: true
|
|
1934
|
+
});
|
|
1935
|
+
};
|
|
1936
|
+
|
|
1858
1937
|
public setCsrfToken = (csrfToken: string) => {
|
|
1859
1938
|
this.csrfToken = csrfToken;
|
|
1860
1939
|
};
|
|
@@ -1899,6 +1978,19 @@ export class ZimbraBatchClient {
|
|
|
1899
1978
|
singleRequest: true
|
|
1900
1979
|
}).then(Boolean);
|
|
1901
1980
|
|
|
1981
|
+
public subscribeDistributionList = (op: String, by: String, dl: String) =>
|
|
1982
|
+
this.jsonRequest({
|
|
1983
|
+
name: 'SubscribeDistributionList',
|
|
1984
|
+
body: {
|
|
1985
|
+
dl: {
|
|
1986
|
+
by,
|
|
1987
|
+
_content: dl
|
|
1988
|
+
},
|
|
1989
|
+
op
|
|
1990
|
+
},
|
|
1991
|
+
namespace: Namespace.Account
|
|
1992
|
+
}).then(res => res.status || '');
|
|
1993
|
+
|
|
1902
1994
|
public taskFolders = () =>
|
|
1903
1995
|
this.jsonRequest({
|
|
1904
1996
|
name: 'GetFolder',
|
|
@@ -243,6 +243,7 @@ const commonMailItemFields = {
|
|
|
243
243
|
inv: ['invitations', InviteInfo],
|
|
244
244
|
mp: ['mimeParts', MimePart],
|
|
245
245
|
shr: 'share',
|
|
246
|
+
dlSubs: 'subscribe',
|
|
246
247
|
su: 'subject',
|
|
247
248
|
origid: 'origId',
|
|
248
249
|
attach: ['attachments', AttachmentsInfo],
|
|
@@ -775,3 +776,14 @@ export const ActionData = new Entity({
|
|
|
775
776
|
export const DocumentActionData = new Entity({
|
|
776
777
|
action: ['action', ActionData]
|
|
777
778
|
});
|
|
779
|
+
|
|
780
|
+
export const DLActionAttrEntity = new Entity({
|
|
781
|
+
n: 'attributeName',
|
|
782
|
+
_content: 'content'
|
|
783
|
+
});
|
|
784
|
+
|
|
785
|
+
export const DLActionEntity = new Entity({
|
|
786
|
+
op: 'operation',
|
|
787
|
+
a: ['attributes', DLActionAttrEntity],
|
|
788
|
+
dlm: 'distributionListMembers'
|
|
789
|
+
});
|