@webitel/api-services 26.8.23 → 26.8.25

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/api-services",
3
- "version": "26.8.23",
3
+ "version": "26.8.25",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -68,8 +68,7 @@
68
68
  "typedoc-github-wiki-theme": "^2.1.0",
69
69
  "typescript": "5.8.2",
70
70
  "vue-i18n": "^11.2.8",
71
- "vue-tsc": "^2.2.10",
72
- "webitel-sdk": "^25.4.3"
71
+ "vue-tsc": "^2.2.10"
73
72
  },
74
73
  "dependencies": {
75
74
  "date-fns": "^4.1.0",
@@ -54,9 +54,11 @@ const getDevicesList = async (params: ApiParams) => {
54
54
  const requestParams = applyTransform(params, [
55
55
  merge(getDefaultGetParams()),
56
56
  starToSearch('search'),
57
+ starToSearch('q'),
57
58
  (params) => ({
58
59
  ...params,
59
- q: params.search,
60
+ // filtersManager may pass `q` (Path A) or legacy `search`
61
+ q: params.q ?? params.search,
60
62
  }),
61
63
  sanitize(listFieldsToSend),
62
64
  camelToSnake(),
@@ -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
  };
@@ -1,4 +1,3 @@
1
1
  export * from './getDefaultGetListResponse/getDefaultGetListResponse';
2
2
  export * from './getDefaultGetParams/getDefaultGetParams';
3
3
  export * from './getDefaultInstance/getDefaultInstance';
4
- export * from './getDefaultOpenAPIConfig/getDefaultOpenAPIConfig';
@@ -0,0 +1,70 @@
1
+ import type { ApiDevice } from '@webitel/api-services/gen/models';
2
+ import { z } from 'zod';
3
+
4
+ import { i18nIssue } from '../_shared/i18nIssue';
5
+ import { flexibleLookupSchema } from '../_shared/lookup.validations';
6
+ import type { ZodShape } from '../types';
7
+
8
+ const ipv4Regex =
9
+ /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/;
10
+
11
+ const macRegex = /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/;
12
+
13
+ const optionalIpSchema = z
14
+ .string()
15
+ .optional()
16
+ .default('')
17
+ .refine((value) => {
18
+ if (!value) return true;
19
+ if (value === '127.0.0.1' || value === '0.0.0.0') return false;
20
+ return ipv4Regex.test(value);
21
+ }, i18nIssue('ipValidator'));
22
+
23
+ const optionalMacSchema = z
24
+ .string()
25
+ .optional()
26
+ .default('')
27
+ .refine((value) => !value || macRegex.test(value), i18nIssue('macValidator'));
28
+
29
+ /**
30
+ * Device card schema.
31
+ *
32
+ * Password is required only when creating (`id` absent) — an empty password on
33
+ * update means "keep the current one" (see DevicesAPI.preRequestHandler).
34
+ */
35
+ export const deviceSchema = z
36
+ .object<ZodShape<ApiDevice>>({
37
+ id: z.string().optional(),
38
+ name: z.string().min(1).default(''),
39
+ account: z.string().min(1).default(''),
40
+ password: z.string().optional().default(''),
41
+ user: flexibleLookupSchema.optional().default({}),
42
+ ip: optionalIpSchema,
43
+ brand: z.string().optional().default(''),
44
+ model: z.string().optional().default(''),
45
+ mac: optionalMacSchema,
46
+ hotdesk: z.boolean().optional().default(false),
47
+ hotdesks: z.array(z.string()).optional().default([]),
48
+ })
49
+ .superRefine((data, ctx) => {
50
+ if (!data.id && !data.password) {
51
+ ctx.addIssue({
52
+ code: 'custom',
53
+ path: [
54
+ 'password',
55
+ ],
56
+ ...i18nIssue('required'),
57
+ });
58
+ }
59
+
60
+ const hotdesks = data.hotdesks as string[] | undefined;
61
+ if (data.hotdesk && hotdesks?.some((hotdesk) => !/\w+/.test(hotdesk))) {
62
+ ctx.addIssue({
63
+ code: 'custom',
64
+ path: [
65
+ 'hotdesks',
66
+ ],
67
+ ...i18nIssue('required'),
68
+ });
69
+ }
70
+ });
@@ -23,6 +23,7 @@ export * from './contactEmail/contactEmail.validations';
23
23
  export * from './contactGroup/contactGroup.validations';
24
24
  export * from './contactGroupCondition/contactGroupCondition.validations';
25
25
  export * from './contactPhone/contactPhone.validations';
26
+ export * from './device/device.validations';
26
27
  export * from './OAuth/OAuth.validations';
27
28
  export * from './onlineSkill/onlineSkill.validations';
28
29
  export * from './queue/queue.rules';