@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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/api-services",
3
- "version": "26.12.15",
3
+ "version": "26.12.17",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,4 +1,3 @@
1
- import axios from 'axios';
2
1
  import { getMediaFileService } from '../../../gen-wire';
3
2
  import {
4
3
  getDefaultGetListResponse,
@@ -14,17 +13,22 @@ import {
14
13
  snakeToCamel,
15
14
  starToSearch,
16
15
  } from '../../transformers';
17
- import type {
18
- ApiId,
19
- ApiParams,
20
- DeleteItemParams,
21
- GetItemParams,
22
- } from '../_shared/types';
16
+ import type { ApiId, ApiParams, DeleteItemParams } from '../_shared/types';
23
17
 
24
18
  const instance = getDefaultInstance();
25
19
 
26
- const token = localStorage.getItem('access-token');
27
- const baseUrl = import.meta.env.VITE_API_URL;
20
+ /** [Claude] The app passes these: the API base URL and token are its concern, not this package's */
21
+ export type MediaUrlAuth = {
22
+ baseUrl: string;
23
+ accessToken: string;
24
+ };
25
+
26
+ /** [Claude] For `src`/`href` targets (players, links) that can't send the auth header */
27
+ const withAccessToken = (
28
+ path: string,
29
+ { baseUrl, accessToken }: MediaUrlAuth,
30
+ query = '',
31
+ ) => `${baseUrl}${path}?access_token=${accessToken}${query}`;
28
32
 
29
33
  const getMediaList = async (params: ApiParams) => {
30
34
  const requestParams = applyTransform(params, [
@@ -62,34 +66,9 @@ const getMediaList = async (params: ApiParams) => {
62
66
  }
63
67
  };
64
68
 
65
- const getMedia = async ({ itemId }: GetItemParams) => {
66
- const url = `${baseUrl}/storage/media/${itemId}/stream?access_token=${token}`;
67
- try {
68
- return await instance.get(url);
69
- } catch (err) {
70
- throw applyTransform(err, [
71
- notify,
72
- ]);
73
- }
74
- };
75
-
76
- export const downloadMedia = async (id: ApiId) => {
77
- const url = `${baseUrl}/storage/media/${id}/download?access_token=${token}`;
78
- try {
79
- return await instance.get(url);
80
- } catch (err) {
81
- throw applyTransform(err, [
82
- notify,
83
- ]);
84
- }
85
- };
86
-
87
69
  export const downloadFile = async (id: ApiId, fileName = '') => {
88
- const accessToken = localStorage.getItem('access-token'); // after auth token variable is null
89
- const url = `/storage/file/${id}/download?access_token=${accessToken}`;
90
-
91
70
  try {
92
- const response = await instance.get(url, {
71
+ const response = await instance.get(`/storage/file/${id}/download`, {
93
72
  responseType: 'blob',
94
73
  });
95
74
 
@@ -113,46 +92,69 @@ export const downloadFile = async (id: ApiId, fileName = '') => {
113
92
  export const getCallMediaUrl = (
114
93
  id: ApiId,
115
94
  {
95
+ auth,
116
96
  download = false,
117
97
  }: {
98
+ auth: MediaUrlAuth;
118
99
  download?: boolean;
119
- } = {},
120
- ) => {
121
- const accessToken = localStorage.getItem('access-token');
122
- return `${baseUrl}/storage/recordings/${id}/${download ? 'download' : 'stream'}?access_token=${accessToken}`;
123
- };
124
-
125
- export const getMediaStreamUrl = (id: ApiId) => {
126
- const accessToken = localStorage.getItem('access-token');
127
- return `${baseUrl}/storage/media/${id}/stream?access_token=${accessToken}`;
128
- };
129
-
130
- export const getMediaUrl = (id: ApiId, isThumb: boolean = false) => {
131
- const accessToken = localStorage.getItem('access-token'); // after auth token variable is null
132
- const url = `${baseUrl}/storage/file/${id}/stream?access_token=${accessToken}&fetch_thumbnail=${isThumb}`;
133
- return url;
134
- };
100
+ },
101
+ ) =>
102
+ withAccessToken(
103
+ `/storage/recordings/${id}/${download ? 'download' : 'stream'}`,
104
+ auth,
105
+ );
135
106
 
136
- const addMediaInstance = axios.create({
137
- headers: {
138
- 'content-type': 'multipart/form-data',
107
+ export const getMediaStreamUrl = (
108
+ id: ApiId,
109
+ {
110
+ auth,
111
+ }: {
112
+ auth: MediaUrlAuth;
139
113
  },
140
- });
114
+ ) => withAccessToken(`/storage/media/${id}/stream`, auth);
141
115
 
142
- const addMedia = async (params: ApiParams) => {
143
- const url = `${baseUrl}/storage/media?access_token=${token}`;
116
+ export const getMediaDownloadUrl = (
117
+ id: ApiId,
118
+ {
119
+ auth,
120
+ }: {
121
+ auth: MediaUrlAuth;
122
+ },
123
+ ) => withAccessToken(`/storage/media/${id}/download`, auth);
144
124
 
125
+ export const getMediaUrl = (
126
+ id: ApiId,
127
+ {
128
+ auth,
129
+ isThumb = false,
130
+ }: {
131
+ auth: MediaUrlAuth;
132
+ isThumb?: boolean;
133
+ },
134
+ ) =>
135
+ withAccessToken(
136
+ `/storage/file/${id}/stream`,
137
+ auth,
138
+ `&fetch_thumbnail=${isThumb}`,
139
+ );
140
+
141
+ /** [Claude] All files in one request, one notification; fields named `file[n]` as the old dropzone upload sent them */
142
+ const uploadMedia = async (files: File[]) => {
145
143
  const formData = new FormData();
146
- formData.append('file', params.itemInstance);
144
+ files.forEach((file, index) => {
145
+ formData.append(`file[${index}]`, file);
146
+ });
147
+
147
148
  try {
148
- const response = await addMediaInstance.post(url, formData);
149
- applyTransform(response, [
150
- notify(() => ({
151
- type: 'success',
152
- text: 'Successfully added',
153
- })),
149
+ const response = await instance.post('/storage/media', formData);
150
+ return applyTransform(response.data, [
151
+ notify(({ callback }) =>
152
+ callback({
153
+ type: 'success',
154
+ text: 'Successfully added',
155
+ }),
156
+ ),
154
157
  ]);
155
- return response;
156
158
  } catch (err) {
157
159
  throw applyTransform(err, [
158
160
  notify,
@@ -160,6 +162,37 @@ const addMedia = async (params: ApiParams) => {
160
162
  }
161
163
  };
162
164
 
165
+ export type TextToSpeechParams = {
166
+ profileId: string;
167
+ textType: string;
168
+ language: string;
169
+ voice: string;
170
+ format: string;
171
+ text: string;
172
+ };
173
+
174
+ /** [Claude] Synthesizes audio from text without storing it; save the blob with `upload` */
175
+ const generateTts = async (params: TextToSpeechParams): Promise<Blob> => {
176
+ try {
177
+ const response = await instance.get('/storage/tts/stream', {
178
+ params: applyTransform(params, [
179
+ camelToSnake(),
180
+ ]),
181
+ responseType: 'blob',
182
+ });
183
+ return response.data;
184
+ } catch (err) {
185
+ throw applyTransform(err, [
186
+ notify(({ callback }) =>
187
+ callback({
188
+ type: 'error',
189
+ text: `Failed to process Text-to-Speech: ${err}`,
190
+ }),
191
+ ),
192
+ ]);
193
+ }
194
+ };
195
+
163
196
  const deleteMedia = async ({ id }: DeleteItemParams) => {
164
197
  try {
165
198
  const response = await getMediaFileService().deleteMediaFile(String(id));
@@ -183,8 +216,8 @@ const getMediaLookup = (params: Parameters<typeof getMediaList>[0]) =>
183
216
 
184
217
  export const MediaAPI = {
185
218
  getList: getMediaList,
186
- get: getMedia,
187
- add: addMedia,
219
+ upload: uploadMedia,
220
+ generateTts,
188
221
  delete: deleteMedia,
189
222
  getLookup: getMediaLookup,
190
223
  };
@@ -18,26 +18,21 @@ import type {
18
18
  } from '../_shared/types';
19
19
 
20
20
  const getRegionsList = async (params: ApiParams) => {
21
- const requestParams = applyTransform(params, [
21
+ const { page, size, search, sort, fields, id } = applyTransform(params, [
22
22
  merge(getDefaultGetParams()),
23
23
  starToSearch('search'),
24
- camelToSnake(),
25
- (params) => ({
26
- ...params,
27
- q: params.search,
28
- }),
29
- sanitize([
30
- 'page',
31
- 'size',
32
- 'q',
33
- 'sort',
34
- 'fields',
35
- 'id',
36
- ]),
37
24
  ]);
38
25
 
39
26
  try {
40
- const response = await getRegionService().searchRegion(requestParams);
27
+ const response = await getRegionService().searchRegion({
28
+ page,
29
+ size,
30
+ // [Claude] the generated param is `q`; `search` is what the datalist store sends
31
+ q: search,
32
+ sort,
33
+ fields,
34
+ id,
35
+ });
41
36
  const { items, next } = applyTransform(response.data, [
42
37
  snakeToCamel(),
43
38
  merge(getDefaultGetListResponse()),
@@ -0,0 +1,336 @@
1
+ /**
2
+ * [Claude] Google voice names a TTS profile accepts; a form filters them by the
3
+ * language prefix (e.g. `uk-UA`). Moved from webitel-flow-diagram and the admin
4
+ * media page, which kept their own copies.
5
+ */
6
+ export const TtsGoogleVoiceList = [
7
+ 'ro-RO-Wavenet-A',
8
+ 'ms-MY-Standard-A',
9
+ 'ms-MY-Standard-B',
10
+ 'ms-MY-Standard-C',
11
+ 'ms-MY-Standard-D',
12
+ 'id-ID-Standard-A',
13
+ 'id-ID-Standard-B',
14
+ 'id-ID-Standard-C',
15
+ 'id-ID-Standard-D',
16
+ 'nl-BE-Standard-A',
17
+ 'nl-BE-Standard-B',
18
+ 'nl-NL-Standard-B',
19
+ 'nl-NL-Standard-C',
20
+ 'nl-NL-Standard-D',
21
+ 'nl-NL-Standard-E',
22
+ 'nl-NL-Standard-A',
23
+ 'fil-PH-Standard-B',
24
+ 'fil-PH-Standard-C',
25
+ 'fil-PH-Standard-D',
26
+ 'fil-PH-Standard-A',
27
+ 'yue-HK-Standard-A',
28
+ 'yue-HK-Standard-B',
29
+ 'yue-HK-Standard-C',
30
+ 'yue-HK-Standard-D',
31
+ 'fr-FR-Standard-A',
32
+ 'fr-FR-Standard-B',
33
+ 'fr-FR-Standard-C',
34
+ 'fr-FR-Standard-D',
35
+ 'de-DE-Standard-E',
36
+ 'de-DE-Standard-A',
37
+ 'de-DE-Standard-B',
38
+ 'de-DE-Standard-C',
39
+ 'de-DE-Standard-D',
40
+ 'de-DE-Standard-F',
41
+ 'fr-CA-Standard-A',
42
+ 'fr-CA-Standard-B',
43
+ 'fr-CA-Standard-C',
44
+ 'fr-CA-Standard-D',
45
+ 'it-IT-Standard-B',
46
+ 'it-IT-Standard-C',
47
+ 'it-IT-Standard-D',
48
+ 'en-AU-Standard-A',
49
+ 'en-AU-Standard-B',
50
+ 'en-AU-Standard-C',
51
+ 'en-AU-Standard-D',
52
+ 'en-GB-Standard-A',
53
+ 'en-GB-Standard-B',
54
+ 'en-GB-Standard-C',
55
+ 'en-GB-Standard-D',
56
+ 'en-GB-Standard-F',
57
+ 'cs-CZ-Standard-A',
58
+ 'el-GR-Standard-A',
59
+ 'pt-BR-Standard-A',
60
+ 'es-US-Standard-A',
61
+ 'es-US-Standard-B',
62
+ 'es-US-Standard-C',
63
+ 'th-TH-Standard-A',
64
+ 'bn-IN-Standard-A',
65
+ 'bn-IN-Standard-B',
66
+ 'en-IN-Standard-D',
67
+ 'en-IN-Standard-A',
68
+ 'en-IN-Standard-B',
69
+ 'en-IN-Standard-C',
70
+ 'gu-IN-Standard-A',
71
+ 'gu-IN-Standard-B',
72
+ 'hi-IN-Standard-D',
73
+ 'hi-IN-Standard-A',
74
+ 'hi-IN-Standard-B',
75
+ 'hi-IN-Standard-C',
76
+ 'kn-IN-Standard-A',
77
+ 'kn-IN-Standard-B',
78
+ 'ml-IN-Standard-A',
79
+ 'ml-IN-Standard-B',
80
+ 'ta-IN-Standard-A',
81
+ 'ta-IN-Standard-B',
82
+ 'te-IN-Standard-A',
83
+ 'te-IN-Standard-B',
84
+ 'pa-IN-Standard-A',
85
+ 'pa-IN-Standard-B',
86
+ 'pa-IN-Standard-C',
87
+ 'pa-IN-Standard-D',
88
+ 'da-DK-Standard-A',
89
+ 'da-DK-Standard-C',
90
+ 'da-DK-Standard-D',
91
+ 'da-DK-Standard-E',
92
+ 'fi-FI-Standard-A',
93
+ 'is-is-Standard-A',
94
+ 'sv-SE-Standard-A',
95
+ 'nb-NO-Standard-A',
96
+ 'nb-NO-Standard-B',
97
+ 'nb-NO-Standard-C',
98
+ 'nb-NO-Standard-D',
99
+ 'nb-no-Standard-E',
100
+ 'pt-PT-Standard-A',
101
+ 'pt-PT-Standard-B',
102
+ 'pt-PT-Standard-C',
103
+ 'pt-PT-Standard-D',
104
+ 'af-ZA-Standard-A',
105
+ 'bg-bg-Standard-A',
106
+ 'hu-HU-Standard-A',
107
+ 'lv-lv-Standard-A',
108
+ 'pl-PL-Standard-E',
109
+ 'ro-RO-Standard-A',
110
+ 'sk-SK-Standard-A',
111
+ 'sr-rs-Standard-A',
112
+ 'uk-UA-Chirp3-HD-Achernar',
113
+ 'uk-UA-Chirp3-HD-Achird',
114
+ 'uk-UA-Chirp3-HD-Algenib',
115
+ 'uk-UA-Chirp3-HD-Algieba',
116
+ 'uk-UA-Chirp3-HD-Alnilam',
117
+ 'uk-UA-Chirp3-HD-Autonoe',
118
+ 'uk-UA-Chirp3-HD-Callirrhoe',
119
+ 'uk-UA-Chirp3-HD-Despina',
120
+ 'uk-UA-Chirp3-HD-Enceladus',
121
+ 'uk-UA-Chirp3-HD-Erinome',
122
+ 'uk-UA-Chirp3-HD-Gacrux',
123
+ 'uk-UA-Chirp3-HD-Iapetus',
124
+ 'uk-UA-Chirp3-HD-Laomedeia',
125
+ 'uk-UA-Chirp3-HD-Pulcherrima',
126
+ 'uk-UA-Chirp3-HD-Rasalgethi',
127
+ 'uk-UA-Chirp3-HD-Sadachbia',
128
+ 'uk-UA-Chirp3-HD-Sadaltager',
129
+ 'uk-UA-Chirp3-HD-Schedar',
130
+ 'uk-UA-Chirp3-HD-Sulafat',
131
+ 'uk-UA-Chirp3-HD-Umbriel',
132
+ 'uk-UA-Chirp3-HD-Vindemiatrix',
133
+ 'uk-UA-Chirp3-HD-Zubenelgenubi',
134
+ 'uk-UA-Standard-B',
135
+ 'uk-UA-Wavenet-B',
136
+ 'pl-PL-Standard-A',
137
+ 'pl-PL-Standard-B',
138
+ 'pl-PL-Standard-C',
139
+ 'pl-PL-Standard-D',
140
+ 'tr-TR-Standard-B',
141
+ 'tr-TR-Standard-C',
142
+ 'tr-TR-Standard-D',
143
+ 'tr-TR-Standard-E',
144
+ 'tr-TR-Standard-A',
145
+ 'ca-es-Standard-A',
146
+ 'es-ES-Standard-C',
147
+ 'es-ES-Standard-D',
148
+ 'es-ES-Standard-B',
149
+ 'es-ES-Standard-A',
150
+ 'ar-XA-Standard-A',
151
+ 'ar-XA-Standard-B',
152
+ 'ar-XA-Standard-C',
153
+ 'ar-XA-Standard-D',
154
+ 'fr-FR-Standard-E',
155
+ 'it-IT-Standard-A',
156
+ 'ru-RU-Standard-E',
157
+ 'ru-RU-Standard-A',
158
+ 'ru-RU-Standard-B',
159
+ 'ru-RU-Standard-C',
160
+ 'ru-RU-Standard-D',
161
+ 'en-US-Standard-A',
162
+ 'en-US-Standard-B',
163
+ 'en-US-Standard-C',
164
+ 'en-US-Standard-D',
165
+ 'en-US-Standard-E',
166
+ 'en-US-Standard-F',
167
+ 'en-US-Standard-G',
168
+ 'en-US-Standard-H',
169
+ 'en-US-Standard-I',
170
+ 'en-US-Standard-J',
171
+ 'cmn-CN-Standard-C',
172
+ 'cmn-CN-Standard-B',
173
+ 'cmn-CN-Standard-A',
174
+ 'cmn-CN-Standard-D',
175
+ 'ja-JP-Standard-A',
176
+ 'ja-JP-Standard-B',
177
+ 'ja-JP-Standard-C',
178
+ 'ja-JP-Standard-D',
179
+ 'cmn-TW-Standard-A',
180
+ 'cmn-TW-Standard-B',
181
+ 'cmn-TW-Standard-C',
182
+ 'ko-KR-Standard-B',
183
+ 'ko-KR-Standard-C',
184
+ 'ko-KR-Standard-D',
185
+ 'ko-KR-Standard-A',
186
+ 'vi-VN-Standard-A',
187
+ 'vi-VN-Standard-B',
188
+ 'vi-VN-Standard-C',
189
+ 'vi-VN-Standard-D',
190
+ 'ar-XA-Wavenet-A',
191
+ 'ar-XA-Wavenet-B',
192
+ 'ar-XA-Wavenet-C',
193
+ 'ar-XA-Wavenet-D',
194
+ 'bn-IN-Wavenet-A',
195
+ 'bn-IN-Wavenet-B',
196
+ 'en-GB-Wavenet-A',
197
+ 'en-GB-Wavenet-B',
198
+ 'en-GB-Wavenet-C',
199
+ 'en-GB-Wavenet-D',
200
+ 'en-GB-Wavenet-F',
201
+ 'fr-CA-Wavenet-A',
202
+ 'fr-CA-Wavenet-B',
203
+ 'fr-CA-Wavenet-C',
204
+ 'fr-CA-Wavenet-D',
205
+ 'en-US-Wavenet-G',
206
+ 'en-US-Wavenet-H',
207
+ 'en-US-Wavenet-I',
208
+ 'en-US-Wavenet-J',
209
+ 'en-US-Wavenet-A',
210
+ 'en-US-Wavenet-B',
211
+ 'en-US-Wavenet-C',
212
+ 'en-US-Wavenet-D',
213
+ 'en-US-Wavenet-E',
214
+ 'en-US-Wavenet-F',
215
+ 'es-ES-Wavenet-C',
216
+ 'es-ES-Wavenet-D',
217
+ 'es-ES-Wavenet-B',
218
+ 'fi-FI-Wavenet-A',
219
+ 'gu-IN-Wavenet-A',
220
+ 'gu-IN-Wavenet-B',
221
+ 'ja-JP-Wavenet-B',
222
+ 'ja-JP-Wavenet-C',
223
+ 'ja-JP-Wavenet-D',
224
+ 'ja-JP-Wavenet-A',
225
+ 'kn-IN-Wavenet-A',
226
+ 'kn-IN-Wavenet-B',
227
+ 'ml-IN-Wavenet-A',
228
+ 'ml-IN-Wavenet-B',
229
+ 'sv-SE-Wavenet-A',
230
+ 'ta-IN-Wavenet-A',
231
+ 'ta-IN-Wavenet-B',
232
+ 'tr-TR-Wavenet-B',
233
+ 'tr-TR-Wavenet-C',
234
+ 'tr-TR-Wavenet-D',
235
+ 'tr-TR-Wavenet-E',
236
+ 'tr-TR-Wavenet-A',
237
+ 'ms-MY-Wavenet-A',
238
+ 'ms-MY-Wavenet-B',
239
+ 'ms-MY-Wavenet-C',
240
+ 'ms-MY-Wavenet-D',
241
+ 'pa-IN-Wavenet-A',
242
+ 'pa-IN-Wavenet-B',
243
+ 'pa-IN-Wavenet-C',
244
+ 'pa-IN-Wavenet-D',
245
+ 'cs-CZ-Wavenet-A',
246
+ 'de-DE-Wavenet-F',
247
+ 'de-DE-Wavenet-A',
248
+ 'de-DE-Wavenet-B',
249
+ 'de-DE-Wavenet-C',
250
+ 'de-DE-Wavenet-D',
251
+ 'de-DE-Wavenet-E',
252
+ 'en-AU-Wavenet-A',
253
+ 'en-AU-Wavenet-B',
254
+ 'en-AU-Wavenet-C',
255
+ 'en-AU-Wavenet-D',
256
+ 'en-IN-Wavenet-D',
257
+ 'en-IN-Wavenet-A',
258
+ 'en-IN-Wavenet-B',
259
+ 'en-IN-Wavenet-C',
260
+ 'es-US-Wavenet-A',
261
+ 'es-US-Wavenet-B',
262
+ 'es-US-Wavenet-C',
263
+ 'fr-FR-Wavenet-E',
264
+ 'fr-FR-Wavenet-A',
265
+ 'fr-FR-Wavenet-B',
266
+ 'fr-FR-Wavenet-C',
267
+ 'fr-FR-Wavenet-D',
268
+ 'hi-IN-Wavenet-D',
269
+ 'hi-IN-Wavenet-A',
270
+ 'hi-IN-Wavenet-B',
271
+ 'hi-IN-Wavenet-C',
272
+ 'id-ID-Wavenet-D',
273
+ 'id-ID-Wavenet-A',
274
+ 'id-ID-Wavenet-B',
275
+ 'id-ID-Wavenet-C',
276
+ 'it-IT-Wavenet-A',
277
+ 'it-IT-Wavenet-B',
278
+ 'it-IT-Wavenet-C',
279
+ 'it-IT-Wavenet-D',
280
+ 'ko-KR-Wavenet-A',
281
+ 'ko-KR-Wavenet-B',
282
+ 'ko-KR-Wavenet-C',
283
+ 'ko-KR-Wavenet-D',
284
+ 'ru-RU-Wavenet-E',
285
+ 'ru-RU-Wavenet-A',
286
+ 'ru-RU-Wavenet-B',
287
+ 'ru-RU-Wavenet-C',
288
+ 'ru-RU-Wavenet-D',
289
+ 'uk-UA-Wavenet-A',
290
+ 'cmn-CN-Wavenet-A',
291
+ 'cmn-CN-Wavenet-B',
292
+ 'cmn-CN-Wavenet-C',
293
+ 'cmn-CN-Wavenet-D',
294
+ 'cmn-TW-Wavenet-A',
295
+ 'cmn-TW-Wavenet-B',
296
+ 'cmn-TW-Wavenet-C',
297
+ 'da-DK-Wavenet-C',
298
+ 'da-DK-Wavenet-D',
299
+ 'da-DK-Wavenet-E',
300
+ 'da-DK-Wavenet-A',
301
+ 'el-GR-Wavenet-A',
302
+ 'fil-PH-Wavenet-A',
303
+ 'fil-PH-Wavenet-B',
304
+ 'fil-PH-Wavenet-C',
305
+ 'fil-PH-Wavenet-D',
306
+ 'hu-HU-Wavenet-A',
307
+ 'nb-NO-Wavenet-A',
308
+ 'nb-NO-Wavenet-B',
309
+ 'nb-NO-Wavenet-C',
310
+ 'nb-NO-Wavenet-D',
311
+ 'nb-no-Wavenet-E',
312
+ 'nl-BE-Wavenet-A',
313
+ 'nl-BE-Wavenet-B',
314
+ 'nl-NL-Wavenet-B',
315
+ 'nl-NL-Wavenet-C',
316
+ 'nl-NL-Wavenet-D',
317
+ 'nl-NL-Wavenet-A',
318
+ 'nl-NL-Wavenet-E',
319
+ 'pt-PT-Wavenet-A',
320
+ 'pt-PT-Wavenet-B',
321
+ 'pt-PT-Wavenet-C',
322
+ 'pt-PT-Wavenet-D',
323
+ 'sk-SK-Wavenet-A',
324
+ 'vi-VN-Wavenet-A',
325
+ 'vi-VN-Wavenet-B',
326
+ 'vi-VN-Wavenet-C',
327
+ 'vi-VN-Wavenet-D',
328
+ 'pl-PL-Wavenet-A',
329
+ 'pl-PL-Wavenet-B',
330
+ 'pl-PL-Wavenet-C',
331
+ 'pl-PL-Wavenet-E',
332
+ 'pl-PL-Wavenet-D',
333
+ 'pt-BR-Wavenet-A',
334
+ ] as const;
335
+
336
+ export type TtsGoogleVoice = (typeof TtsGoogleVoiceList)[number];
@@ -0,0 +1,7 @@
1
+ export const TtsMicrosoftVoice = {
2
+ Male: 'Male',
3
+ Female: 'Female',
4
+ } as const;
5
+
6
+ export type TtsMicrosoftVoice =
7
+ (typeof TtsMicrosoftVoice)[keyof typeof TtsMicrosoftVoice];
@@ -0,0 +1,6 @@
1
+ export const TtsTextType = {
2
+ Text: 'text',
3
+ Ssml: 'ssml',
4
+ } as const;
5
+
6
+ export type TtsTextType = (typeof TtsTextType)[keyof typeof TtsTextType];
@@ -15,10 +15,14 @@ import { RelativeDatetimeValue } from './RelativeDatetimeValue/RelativeDatetimeV
15
15
  import { ResourceCidType } from './ResourceCidType/ResourceCidType';
16
16
  import { ResourceIgnoreEarlyMedia } from './ResourceIgnoreEarlyMedia/ResourceIgnoreEarlyMedia';
17
17
  import { TimeBaseScore } from './TimeBaseScore/TimeBaseScore';
18
+ import { TtsGoogleVoiceList } from './TtsGoogleVoice/TtsGoogleVoice';
19
+ import { TtsMicrosoftVoice } from './TtsMicrosoftVoice/TtsMicrosoftVoice';
20
+ import { TtsTextType } from './TtsTextType/TtsTextType';
18
21
  import { TypesResourceStrategy } from './TypesResourceStrategy/TypesResourceStrategy';
19
22
  import { UrlProtocol } from './UrlProtocol/UrlProtocol';
20
23
  import { UserPresenceStatus } from './UserPresenceStatus/UserPresenceStatus';
21
24
 
25
+ export type { TtsGoogleVoice } from './TtsGoogleVoice/TtsGoogleVoice';
22
26
  export {
23
27
  AgentStatus,
24
28
  CallReportingStatus,
@@ -36,6 +40,9 @@ export {
36
40
  ResourceCidType,
37
41
  ResourceIgnoreEarlyMedia,
38
42
  TimeBaseScore,
43
+ TtsGoogleVoiceList,
44
+ TtsMicrosoftVoice,
45
+ TtsTextType,
39
46
  TypesResourceStrategy,
40
47
  UrlProtocol,
41
48
  UserPresenceStatus,
@@ -49,6 +49,7 @@ export * from './queueMember/memberCommunication.validations';
49
49
  export * from './queueMember/queueMember.validations';
50
50
  export * from './queueResGroup/queueResGroup.validations';
51
51
  export * from './queueSkill/queueSkill.validations';
52
+ export * from './region/region.validations';
52
53
  export * from './resource/resource.validations';
53
54
  export * from './resourceDisplay/resourceDisplay.validations';
54
55
  export * from './resourceGroup/resourceGroup.validations';
@@ -61,6 +62,7 @@ export * from './team/team.validations';
61
62
  export * from './teamAgent/teamAgent.validations';
62
63
  export * from './teamFlow/teamFlow.validations';
63
64
  export * from './teamHook/teamHook.validations';
65
+ export * from './textToSpeech/textToSpeech.validations';
64
66
  export * from './typeExtension/typeExtension.validations';
65
67
  export * from './types';
66
68
  export * from './user/user.validations';
@@ -0,0 +1,32 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
3
+ import { regionSchema } from '../region.validations';
4
+
5
+ const issuePaths = (value: Record<string, unknown>) =>
6
+ regionSchema
7
+ .safeParse(value)
8
+ .error?.issues.map((issue) => issue.path.join('.')) ?? [];
9
+
10
+ describe('regionSchema', () => {
11
+ it('requires a name and a timezone', () => {
12
+ const paths = issuePaths({
13
+ name: '',
14
+ timezone: {},
15
+ });
16
+
17
+ expect(paths).toContain('name');
18
+ expect(paths).toContain('timezone.id');
19
+ });
20
+
21
+ it('accepts a filled region', () => {
22
+ expect(
23
+ regionSchema.safeParse({
24
+ name: 'Kyiv',
25
+ timezone: {
26
+ id: 1,
27
+ name: 'Europe/Kyiv',
28
+ },
29
+ }).success,
30
+ ).toBe(true);
31
+ });
32
+ });