@zimbra/api-client 98.0.0 → 100.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/.babelrc.json +1 -2
- package/dist/schema.graphql +37 -3
- package/dist/src/apollo/local-batch-link.d.ts +0 -1
- package/dist/src/apollo/offline-queue-link/index.d.ts +1 -4
- package/dist/src/batch-client/index.d.ts +4 -1
- package/dist/src/batch-client/types.d.ts +2 -1
- package/dist/src/normalize/entities.d.ts +1 -0
- package/dist/src/normalize/index.d.ts +1 -1
- package/dist/src/request/types.d.ts +0 -1
- package/dist/src/schema/generated-schema-types.d.ts +38 -2
- package/dist/src/utils/map-values-deep.d.ts +1 -0
- package/dist/zm-api-js-client.esm.js +660 -355
- package/dist/zm-api-js-client.esm.js.map +1 -1
- package/dist/zm-api-js-client.js +8 -8
- package/dist/zm-api-js-client.js.map +1 -1
- package/dist/zm-api-js-client.umd.js +8 -8
- package/dist/zm-api-js-client.umd.js.map +1 -1
- package/package-lock.json +832 -1399
- package/package.json +6 -6
- package/rollup.config.js +1 -1
- package/src/apollo/offline-queue-link/util.ts +1 -2
- package/src/apollo/zimbra-error-link.ts +4 -3
- package/src/apollo/zimbra-in-memory-cache.ts +38 -8
- package/src/batch-client/index.ts +74 -44
- package/src/batch-client/types.ts +2 -1
- package/src/normalize/entities.ts +10 -3
- package/src/normalize/index.ts +42 -39
- package/src/request/index.ts +36 -48
- package/src/request/types.ts +0 -1
- package/src/schema/generated-schema-types.ts +41 -2
- package/src/schema/schema.graphql +37 -3
- package/src/schema/schema.ts +3 -2
- package/src/schema/session-handler.ts +1 -2
- package/src/utils/map-values-deep.ts +10 -2
- package/src/utils/normalize-attrs-custommetadata.ts +5 -6
- package/src/utils/normalize-otherAttribute-contact.ts +29 -19
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import differenceBy from 'lodash/differenceBy';
|
|
3
|
-
import forEach from 'lodash/forEach';
|
|
1
|
+
import { differenceBy } from 'es-toolkit';
|
|
4
2
|
import { denormalize } from '../normalize';
|
|
5
3
|
import { ContactInputRequest } from '../normalize/entities';
|
|
6
4
|
|
|
@@ -102,19 +100,29 @@ export function createContactBody(data: any, isDesktop: Boolean) {
|
|
|
102
100
|
const { attributes, ...rest } = data;
|
|
103
101
|
const contactAttrs = <Object[]>[];
|
|
104
102
|
|
|
105
|
-
|
|
106
|
-
key !== 'other'
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
103
|
+
for (const [key, val] of Object.entries(attributes)) {
|
|
104
|
+
if (key !== 'other') {
|
|
105
|
+
contactAttrs.push({
|
|
106
|
+
name: key,
|
|
107
|
+
[key === 'image' || (!isDesktop && key === 'userCertificate') ? 'aid' : 'content']: val
|
|
108
|
+
});
|
|
109
|
+
} else if (Array.isArray(val)) {
|
|
110
|
+
for (const otherValue of val) {
|
|
111
|
+
if (
|
|
112
|
+
typeof otherValue === 'object' &&
|
|
113
|
+
otherValue !== null &&
|
|
114
|
+
'key' in otherValue &&
|
|
115
|
+
'value' in otherValue
|
|
116
|
+
) {
|
|
117
|
+
const { key: otherKey, value: otherVal } = otherValue as { key: string; value: unknown };
|
|
112
118
|
contactAttrs.push({
|
|
113
|
-
name:
|
|
114
|
-
_content:
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
name: otherKey,
|
|
120
|
+
_content: otherVal
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
118
126
|
return {
|
|
119
127
|
cn: denormalize(ContactInputRequest)({
|
|
120
128
|
...rest,
|
|
@@ -162,15 +170,17 @@ export function normalizeOtherAttr(data: any) {
|
|
|
162
170
|
(a: any, b: any) => Number(a.key.match(/(\d+)/g)[0]) - Number(b.key.match(/(\d+)/g)[0])
|
|
163
171
|
);
|
|
164
172
|
|
|
165
|
-
const remainingOtherAttribute = differenceBy(
|
|
166
|
-
|
|
167
|
-
|
|
173
|
+
const remainingOtherAttribute = differenceBy(
|
|
174
|
+
other || [],
|
|
175
|
+
otherAttributewithCustomKey || [],
|
|
176
|
+
(item: any) => item.key
|
|
177
|
+
).sort((a: any, b: any) => a.key.localeCompare(b.key));
|
|
168
178
|
|
|
169
179
|
return {
|
|
170
180
|
...contact,
|
|
171
181
|
_attrs: {
|
|
172
182
|
...contact._attrs,
|
|
173
|
-
other:
|
|
183
|
+
other: (otherAttributewithCustomKey || []).concat(remainingOtherAttribute || [])
|
|
174
184
|
}
|
|
175
185
|
};
|
|
176
186
|
});
|