diff --git a/src/batch-client/index.ts b/src/batch-client/index.ts index c514d83b6..d11bbeba9 100644 --- a/src/batch-client/index.ts +++ b/src/batch-client/index.ts @@ -214,16 +214,28 @@ export class ZimbraBatchClient { body: { sections: 'mbox,attrs,zimlets' } - }).then(res => ({ - ...res, - attrs: mapValuesDeep(res.attrs._attrs, coerceStringToBoolean), - ...(get(res, 'license.attr') && { - license: { - status: res.license.status, - attr: mapValuesDeep(res.license.attr, coerceStringToBoolean) - } - }) - })); + }).then(res => { + const { + attrs: { _attrs } + } = res; + + if (typeof _attrs.zimbraMailAlias === 'string') { + // Server returns `zimbraMailAlias` as `string` if only one alias is present, else returns as `array`. + // But Graphql can have only one type (using unions was not an option). + _attrs.zimbraMailAlias = [_attrs.zimbraMailAlias]; + } + + return { + ...res, + attrs: mapValuesDeep(_attrs, coerceStringToBoolean), + ...(get(res, 'license.attr') && { + license: { + status: res.license.status, + attr: mapValuesDeep(res.license.attr, coerceStringToBoolean) + } + }) + }; + }); public action = (type: ActionType, options: ActionOptions) => { const { ids, id, ...rest } = options; diff --git a/src/schema/generated-schema-types.ts b/src/schema/generated-schema-types.ts index fd7aaee66..0a9ad1cdc 100644 --- a/src/schema/generated-schema-types.ts +++ b/src/schema/generated-schema-types.ts @@ -73,6 +73,7 @@ export type AccountInfoAttrs = { zimbraFeatureTrustedDevicesEnabled?: Maybe; zimbraFeatureAppSpecificPasswordsEnabled?: Maybe; zimbraFeatureMailPriorityEnabled?: Maybe; + zimbraMailAlias?: Maybe>>; }; export enum AccountType { diff --git a/src/schema/schema.graphql b/src/schema/schema.graphql index 8bc39fc46..1e898c1bb 100644 --- a/src/schema/schema.graphql +++ b/src/schema/schema.graphql @@ -1155,6 +1155,7 @@ type AccountInfoAttrs { zimbraFeatureTrustedDevicesEnabled: Boolean zimbraFeatureAppSpecificPasswordsEnabled: Boolean zimbraFeatureMailPriorityEnabled: Boolean + zimbraMailAlias: [String] } type Identities {