@webitel/api-services 26.12.15 → 26.12.17

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.
@@ -0,0 +1,11 @@
1
+ import type { EngineRegion } from '@webitel/api-services/gen/models';
2
+ import { z } from 'zod';
3
+
4
+ import { filledLookupSchema } from '../_shared/lookup.validations';
5
+ import type { ZodShape } from '../types';
6
+
7
+ export const regionSchema = z.object<ZodShape<EngineRegion>>({
8
+ name: z.string().min(1),
9
+ timezone: filledLookupSchema,
10
+ description: z.string().optional().default(''),
11
+ });
@@ -0,0 +1,47 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
3
+ import { textToSpeechSchema } from '../textToSpeech.validations';
4
+
5
+ const filled = {
6
+ name: 'greeting',
7
+ profile: {
8
+ id: '1',
9
+ name: 'Google',
10
+ },
11
+ text: 'Hello',
12
+ };
13
+
14
+ const failedPaths = (value: unknown) =>
15
+ textToSpeechSchema
16
+ .safeParse(value)
17
+ .error?.issues.map((issue) => issue.path.join('.'));
18
+
19
+ describe('textToSpeechSchema', () => {
20
+ it('accepts a filled draft', () => {
21
+ expect(textToSpeechSchema.safeParse(filled).success).toBe(true);
22
+ });
23
+
24
+ it('requires a name and a text', () => {
25
+ expect(
26
+ failedPaths({
27
+ ...filled,
28
+ name: '',
29
+ text: '',
30
+ }),
31
+ ).toEqual([
32
+ 'name',
33
+ 'text',
34
+ ]);
35
+ });
36
+
37
+ it('reports an empty profile on its id', () => {
38
+ expect(
39
+ failedPaths({
40
+ ...filled,
41
+ profile: {},
42
+ }),
43
+ ).toEqual([
44
+ 'profile.id',
45
+ ]);
46
+ });
47
+ });
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+
3
+ import { requiredLookupSchema } from '../_shared/lookup.validations';
4
+
5
+ /** [Claude] The media "Text-to-Speech" popup: the fields a file can't be generated without. */
6
+ export const textToSpeechSchema = z.object({
7
+ name: z.string().min(1),
8
+ profile: requiredLookupSchema,
9
+ text: z.string().min(1),
10
+ });