@webitel/api-services 26.8.22 → 26.8.24
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 +1 -1
- package/src/api/clients/pdfServices/pdfServices.ts +88 -0
- package/src/validations/queue/__tests__/queue.validations.spec.ts +15 -0
- package/src/validations/queue/queue.validations.ts +9 -2
- package/types/.tsbuildinfo +1 -1
- package/types/api/clients/pdfServices/pdfServices.d.ts +12 -0
package/package.json
CHANGED
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
CreateCallExportBody,
|
|
8
8
|
CreateScreenrecordingExportBody,
|
|
9
9
|
DownloadCallArchiveQueryParams,
|
|
10
|
+
DownloadScreenrecordingArchiveQueryParams,
|
|
11
|
+
DownloadScreenshotArchiveQueryParams,
|
|
10
12
|
getPdfService,
|
|
11
13
|
ListCallExportsQueryParams,
|
|
12
14
|
ListScreenrecordingExportsQueryParams,
|
|
@@ -189,6 +191,90 @@ const downloadCallArchive = async ({
|
|
|
189
191
|
}
|
|
190
192
|
};
|
|
191
193
|
|
|
194
|
+
const downloadScreenrecordingArchive = async ({
|
|
195
|
+
agentId,
|
|
196
|
+
fileIds,
|
|
197
|
+
from,
|
|
198
|
+
to,
|
|
199
|
+
}: {
|
|
200
|
+
agentId: ApiId;
|
|
201
|
+
fileIds?: (string | number)[];
|
|
202
|
+
from?: string | number;
|
|
203
|
+
to?: string | number;
|
|
204
|
+
}) => {
|
|
205
|
+
const fieldsToSend = getShallowFieldsToSendFromZodSchema(
|
|
206
|
+
DownloadScreenrecordingArchiveQueryParams,
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
const params = applyTransform(
|
|
210
|
+
{
|
|
211
|
+
fileIds,
|
|
212
|
+
from,
|
|
213
|
+
to,
|
|
214
|
+
},
|
|
215
|
+
[
|
|
216
|
+
sanitizeToWire(fieldsToSend),
|
|
217
|
+
camelToSnake(),
|
|
218
|
+
],
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
try {
|
|
222
|
+
return await getPdfService().downloadScreenrecordingArchive(
|
|
223
|
+
String(agentId),
|
|
224
|
+
params,
|
|
225
|
+
{
|
|
226
|
+
responseType: 'blob',
|
|
227
|
+
},
|
|
228
|
+
);
|
|
229
|
+
} catch (err) {
|
|
230
|
+
throw applyTransform(err, [
|
|
231
|
+
notify,
|
|
232
|
+
]);
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
const downloadScreenshotArchive = async ({
|
|
237
|
+
agentId,
|
|
238
|
+
fileIds,
|
|
239
|
+
from,
|
|
240
|
+
to,
|
|
241
|
+
}: {
|
|
242
|
+
agentId: ApiId;
|
|
243
|
+
fileIds?: (string | number)[];
|
|
244
|
+
from?: string | number;
|
|
245
|
+
to?: string | number;
|
|
246
|
+
}) => {
|
|
247
|
+
const fieldsToSend = getShallowFieldsToSendFromZodSchema(
|
|
248
|
+
DownloadScreenshotArchiveQueryParams,
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
const params = applyTransform(
|
|
252
|
+
{
|
|
253
|
+
fileIds,
|
|
254
|
+
from,
|
|
255
|
+
to,
|
|
256
|
+
},
|
|
257
|
+
[
|
|
258
|
+
sanitizeToWire(fieldsToSend),
|
|
259
|
+
camelToSnake(),
|
|
260
|
+
],
|
|
261
|
+
);
|
|
262
|
+
|
|
263
|
+
try {
|
|
264
|
+
return await getPdfService().downloadScreenshotArchive(
|
|
265
|
+
String(agentId),
|
|
266
|
+
params,
|
|
267
|
+
{
|
|
268
|
+
responseType: 'blob',
|
|
269
|
+
},
|
|
270
|
+
);
|
|
271
|
+
} catch (err) {
|
|
272
|
+
throw applyTransform(err, [
|
|
273
|
+
notify,
|
|
274
|
+
]);
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
|
|
192
278
|
const deleteExport = async (id: ApiId) => {
|
|
193
279
|
try {
|
|
194
280
|
const response = await getPdfService().deleteExport(String(id));
|
|
@@ -208,5 +294,7 @@ export const PdfServicesAPI = {
|
|
|
208
294
|
createCallExport,
|
|
209
295
|
listCallExports,
|
|
210
296
|
downloadCallArchive,
|
|
297
|
+
downloadScreenrecordingArchive,
|
|
298
|
+
downloadScreenshotArchive,
|
|
211
299
|
delete: deleteExport,
|
|
212
300
|
};
|
|
@@ -118,6 +118,21 @@ describe('queueSchema', () => {
|
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
+
/** A message here would reach the ui untranslated. WTEL-10294 */
|
|
122
|
+
it('reports a below-minimum number as too_small, without a message', () => {
|
|
123
|
+
const queue = validQueueFor(QueueType.INBOUND_QUEUE);
|
|
124
|
+
queue.priority = -1;
|
|
125
|
+
|
|
126
|
+
const issue = queueSchema
|
|
127
|
+
.safeParse(queue)
|
|
128
|
+
.error?.issues.find((i) => i.path.join('.') === 'priority');
|
|
129
|
+
|
|
130
|
+
expect(issue).toMatchObject({
|
|
131
|
+
code: 'too_small',
|
|
132
|
+
minimum: 0,
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
|
|
121
136
|
/** Vuelidate's `required` treats 0 and false as filled; ours must too. */
|
|
122
137
|
it('treats a zero priority as filled rather than missing', () => {
|
|
123
138
|
const queue = validQueueFor(QueueType.INBOUND_QUEUE);
|
|
@@ -88,10 +88,17 @@ export const queueSchema = queueSchemaBase.superRefine((queue, ctx) => {
|
|
|
88
88
|
// an absent optional field is the `required` rules' business, not this one
|
|
89
89
|
if (value === undefined || value === null || value === '') continue;
|
|
90
90
|
if (Number(value) < min) {
|
|
91
|
+
/**
|
|
92
|
+
* `too_small`, not a message: a message wins over the app's error
|
|
93
|
+
* map, the only thing that translates. WTEL-10294
|
|
94
|
+
*/
|
|
91
95
|
ctx.addIssue({
|
|
92
|
-
code: '
|
|
96
|
+
code: 'too_small',
|
|
97
|
+
origin: 'number',
|
|
98
|
+
minimum: min,
|
|
99
|
+
inclusive: true,
|
|
100
|
+
input: value,
|
|
93
101
|
path: path.split('.'),
|
|
94
|
-
message: `Value must be ${min} or greater`,
|
|
95
102
|
});
|
|
96
103
|
}
|
|
97
104
|
}
|