@webitel/api-services 26.8.71 → 26.8.72

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 (39) hide show
  1. package/package.json +1 -1
  2. package/src/api/clients/outboundResources/outboundResources.ts +44 -81
  3. package/src/api/clients/outboundResources/resourceDisplays.ts +106 -32
  4. package/src/enums/ResourceCidType/ResourceCidType.ts +8 -0
  5. package/src/enums/ResourceIgnoreEarlyMedia/ResourceIgnoreEarlyMedia.ts +9 -0
  6. package/src/enums/index.ts +4 -0
  7. package/src/locale/en/en.ts +4 -0
  8. package/src/locale/es/es.ts +4 -0
  9. package/src/locale/kz/kz.ts +4 -0
  10. package/src/locale/pl/pl.ts +4 -0
  11. package/src/locale/ro/ro.ts +4 -0
  12. package/src/locale/ru/ru.ts +4 -0
  13. package/src/locale/uk/uk.ts +4 -0
  14. package/src/locale/uz/uz.ts +4 -0
  15. package/src/locale/vi/vi.ts +4 -0
  16. package/src/validations/index.ts +2 -0
  17. package/src/validations/resource/__tests__/resource.validations.spec.ts +102 -0
  18. package/src/validations/resource/resource.validations.ts +28 -0
  19. package/src/validations/resourceDisplay/__tests__/resourceDisplay.validations.spec.ts +45 -0
  20. package/src/validations/resourceDisplay/resourceDisplay.validations.ts +9 -0
  21. package/types/.tsbuildinfo +1 -1
  22. package/types/api/clients/outboundResources/outboundResources.d.ts +2 -7
  23. package/types/api/clients/outboundResources/resourceDisplays.d.ts +7 -1
  24. package/types/enums/ResourceCidType/ResourceCidType.d.ts +6 -0
  25. package/types/enums/ResourceIgnoreEarlyMedia/ResourceIgnoreEarlyMedia.d.ts +7 -0
  26. package/types/enums/index.d.ts +3 -1
  27. package/types/locale/en/en.d.ts +3 -0
  28. package/types/locale/es/es.d.ts +3 -0
  29. package/types/locale/index.d.ts +27 -0
  30. package/types/locale/kz/kz.d.ts +3 -0
  31. package/types/locale/pl/pl.d.ts +3 -0
  32. package/types/locale/ro/ro.d.ts +3 -0
  33. package/types/locale/ru/ru.d.ts +3 -0
  34. package/types/locale/uk/uk.d.ts +3 -0
  35. package/types/locale/uz/uz.d.ts +3 -0
  36. package/types/locale/vi/vi.d.ts +3 -0
  37. package/types/validations/index.d.ts +2 -0
  38. package/types/validations/resource/resource.validations.d.ts +26 -0
  39. package/types/validations/resourceDisplay/resourceDisplay.validations.d.ts +5 -0
@@ -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
+ });