@zimbra/api-client 87.1.0 → 89.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": "87.1.0",
4
+ "version": "89.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",
@@ -58,14 +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": "^2.4.11",
62
- "@rollup/plugin-babel": "^5.3.1",
62
+ "@graphql-codegen/typescript": "^4.0.1",
63
+ "@rollup/plugin-babel": "^6.0.4",
63
64
  "@rollup/plugin-commonjs": "^22.0.0",
65
+ "@rollup/plugin-graphql": "^1.1.0",
64
66
  "@rollup/plugin-node-resolve": "^13.3.0",
65
- "@rollup/plugin-typescript": "^8.3.2",
67
+ "@rollup/plugin-typescript": "^11.1.5",
66
68
  "@types/graphql": "^14.5.0",
67
69
  "@types/lodash": "^4.14.182",
68
- "@types/node": "^17.0.35",
70
+ "@types/node": "^20.10.4",
69
71
  "@types/whatwg-fetch": "^0.0.33",
70
72
  "babel-plugin-lodash": "^3.3.4",
71
73
  "chai": "^4.3.7",
@@ -73,19 +75,19 @@
73
75
  "cross-var": "^1.1.0",
74
76
  "husky": "^8.0.3",
75
77
  "is-ci": "^3.0.1",
76
- "lint-staged": "^13.2.0",
78
+ "lint-staged": "13.2.3",
77
79
  "mocha": "^10.2.0",
78
80
  "npm-run-all": "^4.1.5",
79
81
  "prettier": "^2.6.2",
80
82
  "rimraf": "^5.0.1",
81
83
  "rollup": "^2.75.0",
82
- "rollup-plugin-graphql": "^0.1.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": "^4.7.2",
90
+ "typescript": "^5.3.3",
89
91
  "uglify-js": "^3.15.5"
90
92
  }
91
93
  }
package/rollup.config.js CHANGED
@@ -1,26 +1,24 @@
1
1
  import babel from '@rollup/plugin-babel';
2
2
  import typescript from '@rollup/plugin-typescript';
3
- import graphql from 'rollup-plugin-graphql';
3
+ 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 pkg from './package.json';
7
+ import { visualizer } from 'rollup-plugin-visualizer';
8
8
 
9
- let FORMAT = process.env.FORMAT;
9
+ const FORMAT = process.env.FORMAT;
10
10
 
11
- // graphql-tools currently has a rollup build failure, so always call it an external until they fix it
12
- // otherwise, make all npm production dependencies external, plus their subpath usages
13
- // throughout the codebase, which rollup doesn't automatically pick up on
14
- let external = FORMAT==='es' ?
15
- Object.keys(pkg.dependencies)
16
- .concat(
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
  };
@@ -393,12 +393,12 @@ export class ZimbraBatchClient {
393
393
  singleRequest: true
394
394
  }).then(res => get(res, `${accountType}.0.id`));
395
395
 
396
- public addMessage = (options: AddMsgInput) => {
397
- const { folderId, content, meta } = get(options, 'message');
396
+ public addMessage = (message: AddMsgInput) => {
397
+ const { folderId, content, meta } = message;
398
398
  let flags, tags, tagNames, date;
399
399
 
400
400
  try {
401
- ({ flags, tags, tagNames, date } = JSON.parse(meta));
401
+ ({ flags, tags, tagNames, date } = meta && JSON.parse(meta));
402
402
  } catch (err) {}
403
403
 
404
404
  return this.jsonRequest({
@@ -641,7 +641,7 @@ export class ZimbraBatchClient {
641
641
  },
642
642
  singleRequest: true
643
643
  }).then(res => {
644
- const mappedResult = mapValuesDeep(res, coerceStringToBoolean);
644
+ const mappedResult: any = mapValuesDeep(res, coerceStringToBoolean);
645
645
  const {
646
646
  _attrs: { zimbraPrefWhenSentToAddresses, zimbraPrefWhenInFolderIds, ...restAttr },
647
647
  ...restIdentityProps
@@ -934,6 +934,16 @@ export class ZimbraBatchClient {
934
934
  singleRequest: true
935
935
  });
936
936
 
937
+ public getAccountDistributionLists = (attrs: String, ownerOf: number) =>
938
+ this.jsonRequest({
939
+ name: 'GetAccountDistributionLists',
940
+ body: {
941
+ attrs,
942
+ ownerOf
943
+ },
944
+ namespace: Namespace.Account
945
+ }).then(res => ({ dls: res?.dl || [] }));
946
+
937
947
  public getAppointment = (options: AppointmentOptions) =>
938
948
  this.jsonRequest({
939
949
  name: 'GetAppointment',
@@ -1045,7 +1055,19 @@ export class ZimbraBatchClient {
1045
1055
  offset
1046
1056
  },
1047
1057
  namespace: Namespace.Account
1048
- }).then(res => normalize(DlGroupMember)(get(res, 'groupMembers.0.groupMember') || []));
1058
+ }).then(res => {
1059
+ if (res?.dlm) {
1060
+ return res;
1061
+ } else {
1062
+ const result = {
1063
+ dlGroupMember:
1064
+ res?.groupMembers?.length && res.groupMembers[0]?.groupMember
1065
+ ? normalize(DlGroupMember)(res.groupMembers[0].groupMember)
1066
+ : []
1067
+ };
1068
+ return result;
1069
+ }
1070
+ });
1049
1071
 
1050
1072
  public getDocumentShareURL = (options: GetDocumentShareURLOptions) =>
1051
1073
  this.jsonRequest({