@webitel/api-services 26.8.71 → 26.8.73

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.
Files changed (45) hide show
  1. package/package.json +1 -1
  2. package/src/api/clients/fileServices/__tests__/fileServices.spec.ts +20 -0
  3. package/src/api/clients/fileServices/fileServices.ts +53 -0
  4. package/src/api/clients/outboundResources/outboundResources.ts +44 -81
  5. package/src/api/clients/outboundResources/resourceDisplays.ts +106 -32
  6. package/src/api/clients/pdfServices/__tests__/downloadCallScreenrecordingArchive.spec.ts +60 -0
  7. package/src/api/clients/pdfServices/pdfServices.ts +42 -0
  8. package/src/enums/ResourceCidType/ResourceCidType.ts +8 -0
  9. package/src/enums/ResourceIgnoreEarlyMedia/ResourceIgnoreEarlyMedia.ts +9 -0
  10. package/src/enums/index.ts +4 -0
  11. package/src/locale/en/en.ts +4 -0
  12. package/src/locale/es/es.ts +4 -0
  13. package/src/locale/kz/kz.ts +4 -0
  14. package/src/locale/pl/pl.ts +4 -0
  15. package/src/locale/ro/ro.ts +4 -0
  16. package/src/locale/ru/ru.ts +4 -0
  17. package/src/locale/uk/uk.ts +4 -0
  18. package/src/locale/uz/uz.ts +4 -0
  19. package/src/locale/vi/vi.ts +4 -0
  20. package/src/validations/index.ts +2 -0
  21. package/src/validations/resource/__tests__/resource.validations.spec.ts +102 -0
  22. package/src/validations/resource/resource.validations.ts +28 -0
  23. package/src/validations/resourceDisplay/__tests__/resourceDisplay.validations.spec.ts +45 -0
  24. package/src/validations/resourceDisplay/resourceDisplay.validations.ts +9 -0
  25. package/types/.tsbuildinfo +1 -1
  26. package/types/api/clients/fileServices/fileServices.d.ts +8 -1
  27. package/types/api/clients/outboundResources/outboundResources.d.ts +2 -7
  28. package/types/api/clients/outboundResources/resourceDisplays.d.ts +7 -1
  29. package/types/api/clients/pdfServices/pdfServices.d.ts +4 -1
  30. package/types/enums/ResourceCidType/ResourceCidType.d.ts +6 -0
  31. package/types/enums/ResourceIgnoreEarlyMedia/ResourceIgnoreEarlyMedia.d.ts +7 -0
  32. package/types/enums/index.d.ts +3 -1
  33. package/types/locale/en/en.d.ts +3 -0
  34. package/types/locale/es/es.d.ts +3 -0
  35. package/types/locale/index.d.ts +27 -0
  36. package/types/locale/kz/kz.d.ts +3 -0
  37. package/types/locale/pl/pl.d.ts +3 -0
  38. package/types/locale/ro/ro.d.ts +3 -0
  39. package/types/locale/ru/ru.d.ts +3 -0
  40. package/types/locale/uk/uk.d.ts +3 -0
  41. package/types/locale/uz/uz.d.ts +3 -0
  42. package/types/locale/vi/vi.d.ts +3 -0
  43. package/types/validations/index.d.ts +2 -0
  44. package/types/validations/resource/resource.validations.d.ts +26 -0
  45. package/types/validations/resourceDisplay/resourceDisplay.validations.d.ts +5 -0
@@ -2,6 +2,10 @@ import type { MessageContext } from 'vue-i18n';
2
2
 
3
3
  export default {
4
4
  backendErrors: {
5
+ ccOutboundResource: {
6
+ validatePhoneNumber: ({ linked }: MessageContext) =>
7
+ `El archivo contiene números incorrectos. ${linked('validation.phoneNumberSymbolsValidator')}`,
8
+ },
5
9
  contacts: {
6
10
  search: {
7
11
  filters: {
@@ -2,6 +2,10 @@ import type { MessageContext } from 'vue-i18n';
2
2
 
3
3
  export default {
4
4
  backendErrors: {
5
+ ccOutboundResource: {
6
+ validatePhoneNumber: ({ linked }: MessageContext) =>
7
+ `Файлда қате нөмірлер бар. ${linked('validation.phoneNumberSymbolsValidator')}`,
8
+ },
5
9
  contacts: {
6
10
  search: {
7
11
  filters: {
@@ -2,6 +2,10 @@ import type { MessageContext } from 'vue-i18n';
2
2
 
3
3
  export default {
4
4
  backendErrors: {
5
+ ccOutboundResource: {
6
+ validatePhoneNumber: ({ linked }: MessageContext) =>
7
+ `Plik zawiera nieprawidłowe numery. ${linked('validation.phoneNumberSymbolsValidator')}`,
8
+ },
5
9
  contacts: {
6
10
  search: {
7
11
  filters: {
@@ -2,6 +2,10 @@ import type { MessageContext } from 'vue-i18n';
2
2
 
3
3
  export default {
4
4
  backendErrors: {
5
+ ccOutboundResource: {
6
+ validatePhoneNumber: ({ linked }: MessageContext) =>
7
+ `Fișierul conține numere incorecte. ${linked('validation.phoneNumberSymbolsValidator')}`,
8
+ },
5
9
  contacts: {
6
10
  search: {
7
11
  filters: {
@@ -2,6 +2,10 @@ import type { MessageContext } from 'vue-i18n';
2
2
 
3
3
  export default {
4
4
  backendErrors: {
5
+ ccOutboundResource: {
6
+ validatePhoneNumber: ({ linked }: MessageContext) =>
7
+ `Файл содержит некорректные номера. ${linked('validation.phoneNumberSymbolsValidator')}`,
8
+ },
5
9
  contacts: {
6
10
  search: {
7
11
  filters: {
@@ -2,6 +2,10 @@ import type { MessageContext } from 'vue-i18n';
2
2
 
3
3
  export default {
4
4
  backendErrors: {
5
+ ccOutboundResource: {
6
+ validatePhoneNumber: ({ linked }: MessageContext) =>
7
+ `Файл містить некоректні номери. ${linked('validation.phoneNumberSymbolsValidator')}`,
8
+ },
5
9
  contacts: {
6
10
  search: {
7
11
  filters: {
@@ -2,6 +2,10 @@ import type { MessageContext } from 'vue-i18n';
2
2
 
3
3
  export default {
4
4
  backendErrors: {
5
+ ccOutboundResource: {
6
+ validatePhoneNumber: ({ linked }: MessageContext) =>
7
+ `Faylda noto'g'ri raqamlar mavjud. ${linked('validation.phoneNumberSymbolsValidator')}`,
8
+ },
5
9
  contacts: {
6
10
  search: {
7
11
  filters: {
@@ -2,6 +2,10 @@ import type { MessageContext } from 'vue-i18n';
2
2
 
3
3
  export default {
4
4
  backendErrors: {
5
+ ccOutboundResource: {
6
+ validatePhoneNumber: ({ linked }: MessageContext) =>
7
+ `Tệp chứa số không hợp lệ. ${linked('validation.phoneNumberSymbolsValidator')}`,
8
+ },
5
9
  contacts: {
6
10
  search: {
7
11
  filters: {
@@ -45,6 +45,8 @@ export * from './queueMember/memberCommunication.validations';
45
45
  export * from './queueMember/queueMember.validations';
46
46
  export * from './queueResGroup/queueResGroup.validations';
47
47
  export * from './queueSkill/queueSkill.validations';
48
+ export * from './resource/resource.validations';
49
+ export * from './resourceDisplay/resourceDisplay.validations';
48
50
  export * from './resourceGroup/resourceGroup.validations';
49
51
  export * from './resourceInGroup/resourceInGroup.validations';
50
52
  export * from './sla/sla.validations';
@@ -0,0 +1,102 @@
1
+ import { getDefaultsFromZodSchema } from '@webitel/api-services/gen/utils';
2
+ import { describe, expect, it } from 'vitest';
3
+
4
+ import { resourceSchema } from '../resource.validations';
5
+
6
+ const filledResource = {
7
+ name: 'Resource',
8
+ gateway: {
9
+ id: 1,
10
+ name: 'Gateway',
11
+ },
12
+ rps: 10,
13
+ limit: 10,
14
+ maxSuccessivelyErrors: 2,
15
+ };
16
+
17
+ const issuePaths = (value: Record<string, unknown>) =>
18
+ resourceSchema
19
+ .safeParse(value)
20
+ .error?.issues.map((issue) => issue.path.join('.')) ?? [];
21
+
22
+ describe('resourceSchema', () => {
23
+ it('seeds a new resource with the defaults the form expects', () => {
24
+ expect(getDefaultsFromZodSchema(resourceSchema, {})).toMatchObject({
25
+ name: '',
26
+ rps: 10,
27
+ limit: 10,
28
+ description: '',
29
+ maxSuccessivelyErrors: 2,
30
+ errorIds: [],
31
+ patterns: [],
32
+ failureDialDelay: 0,
33
+ parameters: {
34
+ cidType: '',
35
+ ignoreEarlyMedia: '',
36
+ },
37
+ });
38
+ });
39
+
40
+ it('accepts a filled resource', () => {
41
+ expect(resourceSchema.safeParse(filledResource).success).toBe(true);
42
+ });
43
+
44
+ it('requires a name, a gateway, rps, limit and max successive errors', () => {
45
+ const paths = issuePaths({
46
+ name: '',
47
+ gateway: {},
48
+ rps: null,
49
+ limit: null,
50
+ maxSuccessivelyErrors: null,
51
+ });
52
+
53
+ expect(paths).toEqual(
54
+ expect.arrayContaining([
55
+ 'name',
56
+ 'gateway',
57
+ 'rps',
58
+ 'limit',
59
+ 'maxSuccessivelyErrors',
60
+ ]),
61
+ );
62
+ });
63
+
64
+ it('keeps rps and limit within their ranges', () => {
65
+ expect(
66
+ issuePaths({
67
+ ...filledResource,
68
+ rps: 1001,
69
+ limit: 5001,
70
+ }),
71
+ ).toEqual([
72
+ 'rps',
73
+ 'limit',
74
+ ]);
75
+ expect(
76
+ issuePaths({
77
+ ...filledResource,
78
+ rps: -2,
79
+ limit: -2,
80
+ }),
81
+ ).toEqual([
82
+ 'rps',
83
+ 'limit',
84
+ ]);
85
+ expect(
86
+ issuePaths({
87
+ ...filledResource,
88
+ rps: -1,
89
+ limit: -1,
90
+ }),
91
+ ).toEqual([]);
92
+ });
93
+
94
+ it('lets the failure dial delay be cleared', () => {
95
+ expect(
96
+ resourceSchema.safeParse({
97
+ ...filledResource,
98
+ failureDialDelay: null,
99
+ }).success,
100
+ ).toBe(true);
101
+ });
102
+ });
@@ -0,0 +1,28 @@
1
+ import type { EngineOutboundResource } from '@webitel/api-services/gen/models';
2
+ import { z } from 'zod';
3
+
4
+ import { clearableNumberSchema } from '../_shared/clearableNumber.validations';
5
+ import { filledLookupSchema } from '../_shared/lookup.validations';
6
+ import type { ZodShape } from '../types';
7
+
8
+ export const resourceSchema = z.object<ZodShape<EngineOutboundResource>>({
9
+ name: z.string().min(1).default(''),
10
+ gateway: filledLookupSchema,
11
+ rps: z.number().min(-1).max(1000).default(10),
12
+ limit: z.number().min(-1).max(5000).default(10),
13
+ description: z.string().optional().default(''),
14
+ maxSuccessivelyErrors: z.number().default(2),
15
+ errorIds: z.array(z.string()).optional().default([]),
16
+ patterns: z.array(z.string()).optional().default([]),
17
+ failureDialDelay: clearableNumberSchema.default(0),
18
+ parameters: z
19
+ .object({
20
+ cidType: z.string().optional().default(''),
21
+ ignoreEarlyMedia: z.string().optional().default(''),
22
+ })
23
+ .optional()
24
+ .default({
25
+ cidType: '',
26
+ ignoreEarlyMedia: '',
27
+ }),
28
+ });
@@ -0,0 +1,45 @@
1
+ import { getDefaultsFromZodSchema } from '@webitel/api-services/gen/utils';
2
+ import { describe, expect, it } from 'vitest';
3
+
4
+ import { resourceDisplaySchema } from '../resourceDisplay.validations';
5
+
6
+ const issuePaths = (value: Record<string, unknown>) =>
7
+ resourceDisplaySchema
8
+ .safeParse(value)
9
+ .error?.issues.map((issue) => issue.path.join('.')) ?? [];
10
+
11
+ describe('resourceDisplaySchema', () => {
12
+ it('seeds a new number with an empty display', () => {
13
+ expect(getDefaultsFromZodSchema(resourceDisplaySchema, {})).toMatchObject({
14
+ display: '',
15
+ });
16
+ });
17
+
18
+ it('requires a number', () => {
19
+ expect(
20
+ issuePaths({
21
+ display: '',
22
+ }),
23
+ ).toEqual([
24
+ 'display',
25
+ ]);
26
+ });
27
+
28
+ it('rejects symbols a number cannot dial', () => {
29
+ expect(
30
+ issuePaths({
31
+ display: '380 44 123',
32
+ }),
33
+ ).toEqual([
34
+ 'display',
35
+ ]);
36
+ });
37
+
38
+ it('accepts a dialable number', () => {
39
+ expect(
40
+ resourceDisplaySchema.safeParse({
41
+ display: '+380441234567',
42
+ }).success,
43
+ ).toBe(true);
44
+ });
45
+ });
@@ -0,0 +1,9 @@
1
+ import type { EngineResourceDisplay } from '@webitel/api-services/gen/models';
2
+ import { z } from 'zod';
3
+
4
+ import { phoneNumberSchema } from '../_shared/phoneNumber.validations';
5
+ import type { ZodShape } from '../types';
6
+
7
+ export const resourceDisplaySchema = z.object<ZodShape<EngineResourceDisplay>>({
8
+ display: phoneNumberSchema.default(''),
9
+ });