@zimbra/api-client 87.0.0 → 88.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,8 +1,9 @@
1
1
  {
2
2
  "name": "@zimbra/api-client",
3
3
  "amdName": "zmApiJsClient",
4
- "version": "87.0.0",
4
+ "version": "88.0.0",
5
5
  "description": "Zimbra JS API Client and GraphQL client for making requests against the Zimbra SOAP API.",
6
+ "main": "dist/zm-api-js-client.js",
6
7
  "source": "index.ts",
7
8
  "module": "dist/zm-api-js-client.esm.js",
8
9
  "umd:main": "dist/zm-api-js-client.umd.js",
@@ -17,9 +18,11 @@
17
18
  "build": "npm-run-all clean generateSchemaTypes rollup:* -p build:ts minify:* copySchema",
18
19
  "build:ts": "tsc --emitDeclarationOnly --declaration --outDir \"dist\"",
19
20
  "copySchema": "copyfiles -f src/schema/schema.graphql dist",
21
+ "rollup:cjs": "cross-var rollup -c rollup.config.js -m -f cjs -n $npm_package_amdName $npm_package_source -o $npm_package_main",
20
22
  "rollup:umd": "cross-var rollup -c rollup.config.js -m -f umd -n $npm_package_amdName $npm_package_source -o $npm_package_umd_main",
21
23
  "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
24
  "linkedBuild": "npm run rollup:esm -- --watch",
25
+ "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",
23
26
  "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",
24
27
  "size": "echo \"Gzipped Size: $(gzip-size $npm_package_main | pretty-bytes)\"",
25
28
  "prepublishOnly": "npm test && npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags",
@@ -57,7 +60,10 @@
57
60
  "@graphql-codegen/cli": "^2.6.2",
58
61
  "@graphql-codegen/typescript": "^2.4.11",
59
62
  "@rollup/plugin-babel": "^5.3.1",
60
- "@rollup/plugin-typescript": "^8.3.2",
63
+ "@rollup/plugin-commonjs": "^22.0.0",
64
+ "@rollup/plugin-node-resolve": "^13.3.0",
65
+ "@rollup/plugin-graphql": "^1.1.0",
66
+ "@rollup/plugin-typescript": "^11.1.5",
61
67
  "@types/graphql": "^14.5.0",
62
68
  "@types/lodash": "^4.14.182",
63
69
  "@types/node": "^17.0.35",
@@ -68,15 +74,13 @@
68
74
  "cross-var": "^1.1.0",
69
75
  "husky": "^8.0.3",
70
76
  "is-ci": "^3.0.1",
71
- "lint-staged": "^13.2.0",
77
+ "lint-staged": "13.2.3",
72
78
  "mocha": "^10.2.0",
73
79
  "npm-run-all": "^4.1.5",
74
80
  "prettier": "^2.6.2",
75
81
  "rimraf": "^5.0.1",
76
82
  "rollup": "^2.75.0",
77
- "rollup-plugin-graphql": "^0.1.0",
78
83
  "rollup-plugin-local-resolve": "^1.0.7",
79
- "rollup-plugin-visualizer": "^5.9.2",
80
84
  "tslib": "^2.5.0",
81
85
  "tslint": "^6.1.3",
82
86
  "tslint-config-prettier": "^1.18.0",
package/rollup.config.js CHANGED
@@ -1,8 +1,9 @@
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
- import { visualizer } from 'rollup-plugin-visualizer';
5
+ import nodeResolve from '@rollup/plugin-node-resolve';
6
+ import commonjs from '@rollup/plugin-commonjs';
6
7
  import pkg from './package.json';
7
8
 
8
9
  let FORMAT = process.env.FORMAT;
@@ -10,10 +11,13 @@ let FORMAT = process.env.FORMAT;
10
11
  // graphql-tools currently has a rollup build failure, so always call it an external until they fix it
11
12
  // otherwise, make all npm production dependencies external, plus their subpath usages
12
13
  // throughout the codebase, which rollup doesn't automatically pick up on
13
- let external = (Object.keys(pkg.dependencies) || [])
14
- .concat(
15
- ['castArray', 'get','isError', 'isObject', 'mapValues', 'reduce', 'omitBy', 'uniqBy', 'concat', 'uniqBy', 'differenceBy', 'forEach'].map(v => 'lodash/'+v)
16
- );
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
+ [];
20
+
17
21
 
18
22
  export default {
19
23
  external,
@@ -21,13 +25,16 @@ export default {
21
25
  plugins: [
22
26
  graphql(),
23
27
  localResolve(),
28
+ nodeResolve({
29
+ extensions: [ '.js', '.ts', '.json' ]
30
+ }),
31
+ commonjs(),
24
32
  typescript(),
25
33
  babel({
26
34
  extensions: ['.ts'],
27
35
  exclude: 'node_modules/**',
28
36
  babelHelpers: 'bundled'
29
- }),
30
- visualizer()
37
+ })
31
38
  ],
32
39
  output: {
33
40
  exports: FORMAT==='es' ? null : 'named'
@@ -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({
@@ -96,6 +96,7 @@ export type AccountInfoAttrs = {
96
96
  zimbraFeatureChangePasswordEnabled?: Maybe<Scalars['Boolean']>;
97
97
  zimbraFeatureConversationsEnabled?: Maybe<Scalars['Boolean']>;
98
98
  zimbraFeatureDiscardInFiltersEnabled?: Maybe<Scalars['Boolean']>;
99
+ zimbraFeatureDistributionListExpandMembersEnabled?: Maybe<Scalars['Boolean']>;
99
100
  zimbraFeatureDocumentEditingEnabled?: Maybe<Scalars['Boolean']>;
100
101
  zimbraFeatureExportFolderEnabled?: Maybe<Scalars['Boolean']>;
101
102
  zimbraFeatureFiltersEnabled?: Maybe<Scalars['Boolean']>;
@@ -601,6 +602,7 @@ export type CalendarItemAttendee = {
601
602
  export type CalendarItemAttendeesInput = {
602
603
  address: Scalars['String'];
603
604
  calendarUserType?: InputMaybe<Scalars['String']>;
605
+ isGroup?: InputMaybe<Scalars['Boolean']>;
604
606
  name?: InputMaybe<Scalars['String']>;
605
607
  participationStatus?: InputMaybe<ParticipationStatus>;
606
608
  role?: InputMaybe<ParticipationRole>;
@@ -1200,6 +1202,38 @@ export type CustomMetadataMeta = {
1200
1202
  section?: Maybe<Scalars['String']>;
1201
1203
  };
1202
1204
 
1205
+ export type DlDetails = {
1206
+ __typename?: 'DLDetails';
1207
+ dlGroupMember?: Maybe<Array<Maybe<DlGroupMember>>>;
1208
+ dlm?: Maybe<Array<Maybe<Dlm>>>;
1209
+ more?: Maybe<Scalars['Boolean']>;
1210
+ total?: Maybe<Scalars['Int']>;
1211
+ };
1212
+
1213
+ export type Dls = {
1214
+ __typename?: 'DLS';
1215
+ _attrs?: Maybe<DlsAttrs>;
1216
+ d?: Maybe<Scalars['String']>;
1217
+ dynamic?: Maybe<Scalars['Boolean']>;
1218
+ id?: Maybe<Scalars['String']>;
1219
+ isMember?: Maybe<Scalars['Boolean']>;
1220
+ isOwner?: Maybe<Scalars['Boolean']>;
1221
+ name?: Maybe<Scalars['String']>;
1222
+ ref?: Maybe<Scalars['String']>;
1223
+ };
1224
+
1225
+ export type DlsAttrs = {
1226
+ __typename?: 'DLSAttrs';
1227
+ zimbraDistributionListSubscriptionPolicy?: Maybe<Scalars['String']>;
1228
+ zimbraDistributionListUnsubscriptionPolicy?: Maybe<Scalars['String']>;
1229
+ zimbraHideInGal?: Maybe<Scalars['String']>;
1230
+ };
1231
+
1232
+ export type DlsDetails = {
1233
+ __typename?: 'DLSDetails';
1234
+ dls?: Maybe<Array<Maybe<Dls>>>;
1235
+ };
1236
+
1203
1237
  export type DataSource = {
1204
1238
  __typename?: 'DataSource';
1205
1239
  connectionType?: Maybe<Scalars['String']>;
@@ -1302,6 +1336,11 @@ export type DlGroupMember = {
1302
1336
  name?: Maybe<Scalars['String']>;
1303
1337
  };
1304
1338
 
1339
+ export type Dlm = {
1340
+ __typename?: 'Dlm';
1341
+ _content?: Maybe<Scalars['String']>;
1342
+ };
1343
+
1305
1344
  export type Document = {
1306
1345
  __typename?: 'Document';
1307
1346
  acl?: Maybe<Acl>;
@@ -1358,6 +1397,7 @@ export type EmailAddress = {
1358
1397
  __typename?: 'EmailAddress';
1359
1398
  address?: Maybe<Scalars['String']>;
1360
1399
  displayName?: Maybe<Scalars['String']>;
1400
+ isGroup?: Maybe<Scalars['Boolean']>;
1361
1401
  name?: Maybe<Scalars['String']>;
1362
1402
  type?: Maybe<Scalars['String']>;
1363
1403
  };
@@ -1480,6 +1520,13 @@ export type ExternalAccountTestResponse = {
1480
1520
  success: Scalars['Boolean'];
1481
1521
  };
1482
1522
 
1523
+ export enum ExternalSendersType {
1524
+ All = 'ALL',
1525
+ Allnotinab = 'ALLNOTINAB',
1526
+ Inab = 'INAB',
1527
+ Insd = 'INSD'
1528
+ }
1529
+
1483
1530
  export type FileIntoAction = {
1484
1531
  __typename?: 'FileIntoAction';
1485
1532
  copy?: Maybe<Scalars['Boolean']>;
@@ -3232,6 +3279,7 @@ export type Preferences = {
3232
3279
  zimbraPrefDeleteInviteOnReply?: Maybe<Scalars['Boolean']>;
3233
3280
  zimbraPrefDisplayExternalImages?: Maybe<Scalars['Boolean']>;
3234
3281
  zimbraPrefDisplayTimeInMailList?: Maybe<Scalars['Boolean']>;
3282
+ zimbraPrefExternalSendersType?: Maybe<ExternalSendersType>;
3235
3283
  zimbraPrefGroupMailBy?: Maybe<Scalars['String']>;
3236
3284
  zimbraPrefHtmlEditorDefaultFontColor?: Maybe<Scalars['String']>;
3237
3285
  zimbraPrefHtmlEditorDefaultFontFamily?: Maybe<Scalars['String']>;
@@ -3293,6 +3341,7 @@ export type PreferencesInput = {
3293
3341
  zimbraPrefDelegatedSendSaveTarget?: InputMaybe<PrefDelegatedSendSaveTarget>;
3294
3342
  zimbraPrefDisplayExternalImages?: InputMaybe<Scalars['Boolean']>;
3295
3343
  zimbraPrefDisplayTimeInMailList?: InputMaybe<Scalars['Boolean']>;
3344
+ zimbraPrefExternalSendersType?: InputMaybe<ExternalSendersType>;
3296
3345
  zimbraPrefGroupMailBy?: InputMaybe<Scalars['String']>;
3297
3346
  zimbraPrefHtmlEditorDefaultFontColor?: InputMaybe<Scalars['String']>;
3298
3347
  zimbraPrefHtmlEditorDefaultFontFamily?: InputMaybe<Scalars['String']>;
@@ -3371,6 +3420,7 @@ export type Query = {
3371
3420
  downloadDocument?: Maybe<Attachment>;
3372
3421
  downloadMessage?: Maybe<SMimeMessage>;
3373
3422
  freeBusy?: Maybe<Array<Maybe<FreeBusy>>>;
3423
+ getAccountDistributionLists?: Maybe<DlsDetails>;
3374
3424
  getAppSpecificPasswords?: Maybe<AppSpecificPasswordsResponse>;
3375
3425
  getAppointment?: Maybe<GetAppointmentResponse>;
3376
3426
  getAppointments?: Maybe<SearchResponse>;
@@ -3381,7 +3431,7 @@ export type Query = {
3381
3431
  getCustomMetadata?: Maybe<CustomMetadata>;
3382
3432
  getDataSources: DataSources;
3383
3433
  getDeviceStatus?: Maybe<Array<Maybe<Device>>>;
3384
- getDistributionListMembers?: Maybe<Array<Maybe<DlGroupMember>>>;
3434
+ getDistributionListMembers?: Maybe<DlDetails>;
3385
3435
  getDocumentShareURL?: Maybe<GetDocumentShareUrlResponse>;
3386
3436
  getFilterRules?: Maybe<Array<Maybe<Filter>>>;
3387
3437
  getFolder?: Maybe<Folder>;
@@ -3470,6 +3520,12 @@ export type QueryFreeBusyArgs = {
3470
3520
  };
3471
3521
 
3472
3522
 
3523
+ export type QueryGetAccountDistributionListsArgs = {
3524
+ attrs?: InputMaybe<Scalars['String']>;
3525
+ ownerOf?: InputMaybe<Scalars['Int']>;
3526
+ };
3527
+
3528
+
3473
3529
  export type QueryGetAppointmentArgs = {
3474
3530
  id: Scalars['ID'];
3475
3531
  };
@@ -20,6 +20,13 @@ enum SortBy {
20
20
  sizeDesc
21
21
  }
22
22
 
23
+ enum ExternalSendersType {
24
+ ALL
25
+ ALLNOTINAB
26
+ INAB
27
+ INSD
28
+ }
29
+
23
30
  enum ShareInputAction {
24
31
  edit
25
32
  revoke
@@ -448,7 +455,8 @@ type EmailAddress {
448
455
  address: String
449
456
  name: String
450
457
  type: String
451
- displayName: String
458
+ displayName: String,
459
+ isGroup: Boolean
452
460
  }
453
461
 
454
462
  type ShareNotification {
@@ -1165,11 +1173,43 @@ type DlAttrs {
1165
1173
  lastName: String
1166
1174
  }
1167
1175
 
1176
+ type Dlm {
1177
+ _content: String
1178
+ }
1179
+
1168
1180
  type DlGroupMember {
1169
1181
  name: String
1170
1182
  attributes: DlAttrs
1171
1183
  }
1172
1184
 
1185
+ type DLSAttrs {
1186
+ zimbraDistributionListSubscriptionPolicy: String
1187
+ zimbraDistributionListUnsubscriptionPolicy: String
1188
+ zimbraHideInGal: String
1189
+ }
1190
+
1191
+ type DLS {
1192
+ d: String
1193
+ dynamic: Boolean
1194
+ id: String
1195
+ isMember: Boolean
1196
+ isOwner: Boolean
1197
+ name: String
1198
+ ref: String
1199
+ _attrs: DLSAttrs
1200
+ }
1201
+
1202
+ type DLSDetails {
1203
+ dls: [DLS]
1204
+ }
1205
+
1206
+ type DLDetails {
1207
+ dlm: [Dlm]
1208
+ dlGroupMember: [DlGroupMember]
1209
+ more: Boolean,
1210
+ total: Int
1211
+ }
1212
+
1173
1213
  type HabGroup {
1174
1214
  name: String
1175
1215
  id: String
@@ -1401,6 +1441,7 @@ type AccountInfoAttrs {
1401
1441
  zimbraFeatureImportFolderEnabled: Boolean
1402
1442
  zimbraFeatureExportFolderEnabled: Boolean
1403
1443
  zimbraFeatureGroupCalendarEnabled: Boolean
1444
+ zimbraFeatureDistributionListExpandMembersEnabled: Boolean
1404
1445
  }
1405
1446
 
1406
1447
  type AccountCos {
@@ -1511,6 +1552,7 @@ type Preferences {
1511
1552
  zimbraPrefDeleteInviteOnReply: Boolean
1512
1553
  zimbraPrefDelegatedSendSaveTarget: PrefDelegatedSendSaveTarget
1513
1554
  zimbraPrefDisplayExternalImages: Boolean
1555
+ zimbraPrefExternalSendersType: ExternalSendersType
1514
1556
  zimbraPrefGroupMailBy: String
1515
1557
  zimbraPrefMailPollingInterval: String
1516
1558
  zimbraPrefMailRequestReadReceipts: Boolean
@@ -2279,6 +2321,7 @@ input CalendarItemAttendeesInput {
2279
2321
  address: String!
2280
2322
  name: String
2281
2323
  calendarUserType: String
2324
+ isGroup: Boolean
2282
2325
  }
2283
2326
 
2284
2327
  type CalendarItemAlarmTriggerRelative {
@@ -2556,6 +2599,7 @@ input PreferencesInput {
2556
2599
  zimbraPrefCalendarAlwaysShowMiniCal: Boolean
2557
2600
  zimbraPrefComposeDirection: String
2558
2601
  zimbraPrefComposeFormat: Mode
2602
+ zimbraPrefExternalSendersType: ExternalSendersType
2559
2603
  zimbraPrefHtmlEditorDefaultFontColor: String
2560
2604
  zimbraPrefHtmlEditorDefaultFontFamily: String
2561
2605
  zimbraPrefHtmlEditorDefaultFontSize: String
@@ -3336,11 +3380,15 @@ type Query {
3336
3380
  local: Boolean
3337
3381
  ): Folder
3338
3382
  getHAB(habRootGroupId: ID): HabGroup
3383
+ getAccountDistributionLists(
3384
+ attrs: String
3385
+ ownerOf: Int
3386
+ ): DLSDetails
3339
3387
  getDistributionListMembers(
3340
3388
  limit: Int
3341
3389
  offset: Int
3342
3390
  dl: String
3343
- ): [DlGroupMember]
3391
+ ): DLDetails
3344
3392
  getCustomMetadata(id: ID!, section: String): CustomMetadata
3345
3393
  getMailboxMetadata(section: String): MailboxMetadata
3346
3394
  getMessage(
@@ -3639,4 +3687,4 @@ type Mutation {
3639
3687
  schema {
3640
3688
  query: Query
3641
3689
  mutation: Mutation
3642
- }
3690
+ }
@@ -142,6 +142,8 @@ export function createZimbraSchema(options: ZimbraSchemaOptions): {
142
142
  return client.getFolder(variables as GetFolderOptions);
143
143
  },
144
144
  getHAB: (_, { habRootGroupId }) => client.getHAB(habRootGroupId),
145
+ getAccountDistributionLists: (_, { attrs, ownerOf }) =>
146
+ client.getAccountDistributionLists(attrs, ownerOf),
145
147
  getDistributionListMembers: (_, { limit, offset, dl }) =>
146
148
  client.getDistributionListMembers(limit, offset, dl),
147
149
  getAppointment: (_: any, variables) =>
@@ -220,12 +222,13 @@ export function createZimbraSchema(options: ZimbraSchemaOptions): {
220
222
  },
221
223
  addMessage: (_, variables, context = {}) => {
222
224
  const { local } = context;
225
+ const { message } = variables;
223
226
 
224
227
  if (local) {
225
228
  return localStoreClient.addMessage(variables as AddMsgInput);
226
229
  }
227
230
 
228
- return client.addMessage(variables as AddMsgInput);
231
+ return client.addMessage(message as AddMsgInput);
229
232
  },
230
233
  applyFilterRules: (_, variables) =>
231
234
  client.applyFilterRules(variables as ApplyFilterRulesOptions),