@lokalise/polyglot-sdk 21.0.0 → 21.0.2

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 (40) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.js +2 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/sdk/helpers/removeUnicodeNullCharacters.d.ts +1 -0
  5. package/dist/sdk/helpers/removeUnicodeNullCharacters.js +4 -0
  6. package/dist/sdk/helpers/removeUnicodeNullCharacters.js.map +1 -0
  7. package/dist/sdk/schemas/common/commonSchemas.d.ts +19 -4
  8. package/dist/sdk/schemas/common/commonSchemas.js +23 -5
  9. package/dist/sdk/schemas/common/commonSchemas.js.map +1 -1
  10. package/dist/sdk/schemas/common/translationContextSchemas.d.ts +19 -19
  11. package/dist/sdk/schemas/common/translationContextSchemas.js +16 -8
  12. package/dist/sdk/schemas/common/translationContextSchemas.js.map +1 -1
  13. package/dist/sdk/schemas/lqa/commonSchemas.d.ts +330 -0
  14. package/dist/sdk/schemas/lqa/commonSchemas.js +69 -0
  15. package/dist/sdk/schemas/lqa/commonSchemas.js.map +1 -1
  16. package/dist/sdk/schemas/lqa/lqaAsyncSchemas.d.ts +118 -213
  17. package/dist/sdk/schemas/lqa/lqaAsyncSchemas.js +3 -51
  18. package/dist/sdk/schemas/lqa/lqaAsyncSchemas.js.map +1 -1
  19. package/dist/sdk/schemas/lqa/lqaSyncSchemas.d.ts +118 -214
  20. package/dist/sdk/schemas/lqa/lqaSyncSchemas.js +3 -51
  21. package/dist/sdk/schemas/lqa/lqaSyncSchemas.js.map +1 -1
  22. package/dist/sdk/schemas/translation/generateVariants.d.ts +15 -15
  23. package/dist/sdk/schemas/translation/generateVariants.js +7 -1
  24. package/dist/sdk/schemas/translation/generateVariants.js.map +1 -1
  25. package/dist/sdk/schemas/translation/rewriteTextSchemas.d.ts +156 -28
  26. package/dist/sdk/schemas/translation/rewriteTextSchemas.js +10 -3
  27. package/dist/sdk/schemas/translation/rewriteTextSchemas.js.map +1 -1
  28. package/dist/sdk/schemas/translation/sharedSchemas.d.ts +17 -18
  29. package/dist/sdk/schemas/translation/sharedSchemas.js +23 -24
  30. package/dist/sdk/schemas/translation/sharedSchemas.js.map +1 -1
  31. package/dist/sdk/schemas/translation/translateAsyncSchemas.d.ts +13 -13
  32. package/dist/sdk/schemas/translation/translateAsyncSchemas.js +2 -2
  33. package/dist/sdk/schemas/translation/translateAsyncSchemas.js.map +1 -1
  34. package/dist/sdk/schemas/translation/translateSyncSchemas.d.ts +252 -14
  35. package/dist/sdk/schemas/translation/translateSyncSchemas.js +11 -3
  36. package/dist/sdk/schemas/translation/translateSyncSchemas.js.map +1 -1
  37. package/dist/sdk/schemas/translation/translateTextSegmentSchemas.d.ts +11 -11
  38. package/dist/sdk/schemas/translation/translateTextSegmentSchemas.js +8 -7
  39. package/dist/sdk/schemas/translation/translateTextSegmentSchemas.js.map +1 -1
  40. package/package.json +6 -7
@@ -1,201 +1,5 @@
1
1
  import z from 'zod';
2
- declare const LQA_SEGMENT_SCHEMA: z.ZodObject<{
3
- sourceValue: z.ZodEffects<z.ZodString, string, string>;
4
- translations: z.ZodArray<z.ZodObject<{
5
- id: z.ZodString;
6
- locale: z.ZodEffects<z.ZodString, string, string>;
7
- value: z.ZodEffects<z.ZodString, string, string>;
8
- }, "strip", z.ZodTypeAny, {
9
- value: string;
10
- id: string;
11
- locale: string;
12
- }, {
13
- value: string;
14
- id: string;
15
- locale: string;
16
- }>, "atleastone">;
17
- tmMatch: z.ZodOptional<z.ZodObject<{
18
- sourceValue: z.ZodString;
19
- translatedValue: z.ZodString;
20
- }, "strip", z.ZodTypeAny, {
21
- sourceValue: string;
22
- translatedValue: string;
23
- }, {
24
- sourceValue: string;
25
- translatedValue: string;
26
- }>>;
27
- }, "strip", z.ZodTypeAny, {
28
- sourceValue: string;
29
- translations: [{
30
- value: string;
31
- id: string;
32
- locale: string;
33
- }, ...{
34
- value: string;
35
- id: string;
36
- locale: string;
37
- }[]];
38
- tmMatch?: {
39
- sourceValue: string;
40
- translatedValue: string;
41
- } | undefined;
42
- }, {
43
- sourceValue: string;
44
- translations: [{
45
- value: string;
46
- id: string;
47
- locale: string;
48
- }, ...{
49
- value: string;
50
- id: string;
51
- locale: string;
52
- }[]];
53
- tmMatch?: {
54
- sourceValue: string;
55
- translatedValue: string;
56
- } | undefined;
57
- }>;
58
- declare const LQA_CONTENT_UNIT_SCHEMA: z.ZodObject<{
59
- id: z.ZodString;
60
- context: z.ZodOptional<z.ZodObject<{
61
- description: z.ZodOptional<z.ZodString>;
62
- }, "strip", z.ZodTypeAny, {
63
- description?: string | undefined;
64
- }, {
65
- description?: string | undefined;
66
- }>>;
67
- segments: z.ZodArray<z.ZodObject<{
68
- sourceValue: z.ZodEffects<z.ZodString, string, string>;
69
- translations: z.ZodArray<z.ZodObject<{
70
- id: z.ZodString;
71
- locale: z.ZodEffects<z.ZodString, string, string>;
72
- value: z.ZodEffects<z.ZodString, string, string>;
73
- }, "strip", z.ZodTypeAny, {
74
- value: string;
75
- id: string;
76
- locale: string;
77
- }, {
78
- value: string;
79
- id: string;
80
- locale: string;
81
- }>, "atleastone">;
82
- tmMatch: z.ZodOptional<z.ZodObject<{
83
- sourceValue: z.ZodString;
84
- translatedValue: z.ZodString;
85
- }, "strip", z.ZodTypeAny, {
86
- sourceValue: string;
87
- translatedValue: string;
88
- }, {
89
- sourceValue: string;
90
- translatedValue: string;
91
- }>>;
92
- }, "strip", z.ZodTypeAny, {
93
- sourceValue: string;
94
- translations: [{
95
- value: string;
96
- id: string;
97
- locale: string;
98
- }, ...{
99
- value: string;
100
- id: string;
101
- locale: string;
102
- }[]];
103
- tmMatch?: {
104
- sourceValue: string;
105
- translatedValue: string;
106
- } | undefined;
107
- }, {
108
- sourceValue: string;
109
- translations: [{
110
- value: string;
111
- id: string;
112
- locale: string;
113
- }, ...{
114
- value: string;
115
- id: string;
116
- locale: string;
117
- }[]];
118
- tmMatch?: {
119
- sourceValue: string;
120
- translatedValue: string;
121
- } | undefined;
122
- }>, "atleastone">;
123
- characterLimit: z.ZodOptional<z.ZodNumber>;
124
- }, "strip", z.ZodTypeAny, {
125
- segments: [{
126
- sourceValue: string;
127
- translations: [{
128
- value: string;
129
- id: string;
130
- locale: string;
131
- }, ...{
132
- value: string;
133
- id: string;
134
- locale: string;
135
- }[]];
136
- tmMatch?: {
137
- sourceValue: string;
138
- translatedValue: string;
139
- } | undefined;
140
- }, ...{
141
- sourceValue: string;
142
- translations: [{
143
- value: string;
144
- id: string;
145
- locale: string;
146
- }, ...{
147
- value: string;
148
- id: string;
149
- locale: string;
150
- }[]];
151
- tmMatch?: {
152
- sourceValue: string;
153
- translatedValue: string;
154
- } | undefined;
155
- }[]];
156
- id: string;
157
- context?: {
158
- description?: string | undefined;
159
- } | undefined;
160
- characterLimit?: number | undefined;
161
- }, {
162
- segments: [{
163
- sourceValue: string;
164
- translations: [{
165
- value: string;
166
- id: string;
167
- locale: string;
168
- }, ...{
169
- value: string;
170
- id: string;
171
- locale: string;
172
- }[]];
173
- tmMatch?: {
174
- sourceValue: string;
175
- translatedValue: string;
176
- } | undefined;
177
- }, ...{
178
- sourceValue: string;
179
- translations: [{
180
- value: string;
181
- id: string;
182
- locale: string;
183
- }, ...{
184
- value: string;
185
- id: string;
186
- locale: string;
187
- }[]];
188
- tmMatch?: {
189
- sourceValue: string;
190
- translatedValue: string;
191
- } | undefined;
192
- }[]];
193
- id: string;
194
- context?: {
195
- description?: string | undefined;
196
- } | undefined;
197
- characterLimit?: number | undefined;
198
- }>;
2
+ export declare const LQA_CONTENT_UNITS_MAX_LENGTH = 50;
199
3
  export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
200
4
  originCorrelationId: z.ZodString;
201
5
  ownerId: z.ZodString;
@@ -210,9 +14,9 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
210
14
  readonly GEMINI: "Gemini";
211
15
  }>>;
212
16
  context: z.ZodOptional<z.ZodObject<{
213
- description: z.ZodOptional<z.ZodString>;
17
+ description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
214
18
  styleGuide: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
215
- text: z.ZodString;
19
+ text: z.ZodEffects<z.ZodString, string, string>;
216
20
  }, "strip", z.ZodTypeAny, {
217
21
  text: string;
218
22
  }, {
@@ -245,14 +49,14 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
245
49
  }>]>>;
246
50
  glossary: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
247
51
  term: z.ZodString;
248
- description: z.ZodOptional<z.ZodString>;
52
+ description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
249
53
  translatable: z.ZodDefault<z.ZodBoolean>;
250
54
  forbidden: z.ZodDefault<z.ZodBoolean>;
251
55
  caseSensitive: z.ZodDefault<z.ZodBoolean>;
252
56
  translations: z.ZodOptional<z.ZodArray<z.ZodObject<{
253
57
  locale: z.ZodEffects<z.ZodString, string, string>;
254
- translation: z.ZodString;
255
- description: z.ZodOptional<z.ZodString>;
58
+ translation: z.ZodEffects<z.ZodString, string, string>;
59
+ description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
256
60
  }, "strip", z.ZodTypeAny, {
257
61
  translation: string;
258
62
  locale: string;
@@ -309,8 +113,8 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
309
113
  }>, "many">>;
310
114
  targetPluralForms: z.ZodEffects<z.ZodEffects<z.ZodOptional<z.ZodArray<z.ZodEnum<["zero", "one", "two", "few", "many", "other"]>, "atleastone">>, ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined, ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined>, ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined, ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined>;
311
115
  translationExamples: z.ZodOptional<z.ZodArray<z.ZodObject<{
312
- sourceValue: z.ZodString;
313
- translatedValue: z.ZodString;
116
+ sourceValue: z.ZodEffects<z.ZodString, string, string>;
117
+ translatedValue: z.ZodEffects<z.ZodString, string, string>;
314
118
  }, "strip", z.ZodTypeAny, {
315
119
  sourceValue: string;
316
120
  translatedValue: string;
@@ -376,18 +180,18 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
376
180
  contentUnits: z.ZodArray<z.ZodObject<{
377
181
  id: z.ZodString;
378
182
  context: z.ZodOptional<z.ZodObject<{
379
- description: z.ZodOptional<z.ZodString>;
183
+ description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
380
184
  }, "strip", z.ZodTypeAny, {
381
185
  description?: string | undefined;
382
186
  }, {
383
187
  description?: string | undefined;
384
188
  }>>;
385
- segments: z.ZodArray<z.ZodObject<{
386
- sourceValue: z.ZodEffects<z.ZodString, string, string>;
189
+ segments: z.ZodArray<z.ZodEffects<z.ZodObject<{
190
+ sourceValue: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
387
191
  translations: z.ZodArray<z.ZodObject<{
388
192
  id: z.ZodString;
389
193
  locale: z.ZodEffects<z.ZodString, string, string>;
390
- value: z.ZodEffects<z.ZodString, string, string>;
194
+ value: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
391
195
  }, "strip", z.ZodTypeAny, {
392
196
  value: string;
393
197
  id: string;
@@ -398,8 +202,8 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
398
202
  locale: string;
399
203
  }>, "atleastone">;
400
204
  tmMatch: z.ZodOptional<z.ZodObject<{
401
- sourceValue: z.ZodString;
402
- translatedValue: z.ZodString;
205
+ sourceValue: z.ZodEffects<z.ZodString, string, string>;
206
+ translatedValue: z.ZodEffects<z.ZodString, string, string>;
403
207
  }, "strip", z.ZodTypeAny, {
404
208
  sourceValue: string;
405
209
  translatedValue: string;
@@ -407,6 +211,16 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
407
211
  sourceValue: string;
408
212
  translatedValue: string;
409
213
  }>>;
214
+ translationExamples: z.ZodOptional<z.ZodArray<z.ZodObject<{
215
+ sourceValue: z.ZodEffects<z.ZodString, string, string>;
216
+ translatedValue: z.ZodEffects<z.ZodString, string, string>;
217
+ }, "strip", z.ZodTypeAny, {
218
+ sourceValue: string;
219
+ translatedValue: string;
220
+ }, {
221
+ sourceValue: string;
222
+ translatedValue: string;
223
+ }>, "many">>;
410
224
  }, "strip", z.ZodTypeAny, {
411
225
  sourceValue: string;
412
226
  translations: [{
@@ -422,6 +236,10 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
422
236
  sourceValue: string;
423
237
  translatedValue: string;
424
238
  } | undefined;
239
+ translationExamples?: {
240
+ sourceValue: string;
241
+ translatedValue: string;
242
+ }[] | undefined;
425
243
  }, {
426
244
  sourceValue: string;
427
245
  translations: [{
@@ -437,6 +255,48 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
437
255
  sourceValue: string;
438
256
  translatedValue: string;
439
257
  } | undefined;
258
+ translationExamples?: {
259
+ sourceValue: string;
260
+ translatedValue: string;
261
+ }[] | undefined;
262
+ }>, {
263
+ sourceValue: string;
264
+ translations: [{
265
+ value: string;
266
+ id: string;
267
+ locale: string;
268
+ }, ...{
269
+ value: string;
270
+ id: string;
271
+ locale: string;
272
+ }[]];
273
+ tmMatch?: {
274
+ sourceValue: string;
275
+ translatedValue: string;
276
+ } | undefined;
277
+ translationExamples?: {
278
+ sourceValue: string;
279
+ translatedValue: string;
280
+ }[] | undefined;
281
+ }, {
282
+ sourceValue: string;
283
+ translations: [{
284
+ value: string;
285
+ id: string;
286
+ locale: string;
287
+ }, ...{
288
+ value: string;
289
+ id: string;
290
+ locale: string;
291
+ }[]];
292
+ tmMatch?: {
293
+ sourceValue: string;
294
+ translatedValue: string;
295
+ } | undefined;
296
+ translationExamples?: {
297
+ sourceValue: string;
298
+ translatedValue: string;
299
+ }[] | undefined;
440
300
  }>, "atleastone">;
441
301
  characterLimit: z.ZodOptional<z.ZodNumber>;
442
302
  }, "strip", z.ZodTypeAny, {
@@ -455,6 +315,10 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
455
315
  sourceValue: string;
456
316
  translatedValue: string;
457
317
  } | undefined;
318
+ translationExamples?: {
319
+ sourceValue: string;
320
+ translatedValue: string;
321
+ }[] | undefined;
458
322
  }, ...{
459
323
  sourceValue: string;
460
324
  translations: [{
@@ -470,6 +334,10 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
470
334
  sourceValue: string;
471
335
  translatedValue: string;
472
336
  } | undefined;
337
+ translationExamples?: {
338
+ sourceValue: string;
339
+ translatedValue: string;
340
+ }[] | undefined;
473
341
  }[]];
474
342
  id: string;
475
343
  context?: {
@@ -492,6 +360,10 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
492
360
  sourceValue: string;
493
361
  translatedValue: string;
494
362
  } | undefined;
363
+ translationExamples?: {
364
+ sourceValue: string;
365
+ translatedValue: string;
366
+ }[] | undefined;
495
367
  }, ...{
496
368
  sourceValue: string;
497
369
  translations: [{
@@ -507,6 +379,10 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
507
379
  sourceValue: string;
508
380
  translatedValue: string;
509
381
  } | undefined;
382
+ translationExamples?: {
383
+ sourceValue: string;
384
+ translatedValue: string;
385
+ }[] | undefined;
510
386
  }[]];
511
387
  id: string;
512
388
  context?: {
@@ -536,6 +412,10 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
536
412
  sourceValue: string;
537
413
  translatedValue: string;
538
414
  } | undefined;
415
+ translationExamples?: {
416
+ sourceValue: string;
417
+ translatedValue: string;
418
+ }[] | undefined;
539
419
  }, ...{
540
420
  sourceValue: string;
541
421
  translations: [{
@@ -551,6 +431,10 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
551
431
  sourceValue: string;
552
432
  translatedValue: string;
553
433
  } | undefined;
434
+ translationExamples?: {
435
+ sourceValue: string;
436
+ translatedValue: string;
437
+ }[] | undefined;
554
438
  }[]];
555
439
  id: string;
556
440
  context?: {
@@ -573,6 +457,10 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
573
457
  sourceValue: string;
574
458
  translatedValue: string;
575
459
  } | undefined;
460
+ translationExamples?: {
461
+ sourceValue: string;
462
+ translatedValue: string;
463
+ }[] | undefined;
576
464
  }, ...{
577
465
  sourceValue: string;
578
466
  translations: [{
@@ -588,6 +476,10 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
588
476
  sourceValue: string;
589
477
  translatedValue: string;
590
478
  } | undefined;
479
+ translationExamples?: {
480
+ sourceValue: string;
481
+ translatedValue: string;
482
+ }[] | undefined;
591
483
  }[]];
592
484
  id: string;
593
485
  context?: {
@@ -646,6 +538,10 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
646
538
  sourceValue: string;
647
539
  translatedValue: string;
648
540
  } | undefined;
541
+ translationExamples?: {
542
+ sourceValue: string;
543
+ translatedValue: string;
544
+ }[] | undefined;
649
545
  }, ...{
650
546
  sourceValue: string;
651
547
  translations: [{
@@ -661,6 +557,10 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
661
557
  sourceValue: string;
662
558
  translatedValue: string;
663
559
  } | undefined;
560
+ translationExamples?: {
561
+ sourceValue: string;
562
+ translatedValue: string;
563
+ }[] | undefined;
664
564
  }[]];
665
565
  id: string;
666
566
  context?: {
@@ -683,6 +583,10 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
683
583
  sourceValue: string;
684
584
  translatedValue: string;
685
585
  } | undefined;
586
+ translationExamples?: {
587
+ sourceValue: string;
588
+ translatedValue: string;
589
+ }[] | undefined;
686
590
  }, ...{
687
591
  sourceValue: string;
688
592
  translations: [{
@@ -698,6 +602,10 @@ export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<{
698
602
  sourceValue: string;
699
603
  translatedValue: string;
700
604
  } | undefined;
605
+ translationExamples?: {
606
+ sourceValue: string;
607
+ translatedValue: string;
608
+ }[] | undefined;
701
609
  }[]];
702
610
  id: string;
703
611
  context?: {
@@ -1016,6 +924,3 @@ export type LqaAsyncHeaders = z.infer<typeof LQA_ASYNC_HEADERS_SCHEMA>;
1016
924
  export type LqaAsyncResponse = z.infer<typeof LQA_ASYNC_RESPONSE_SCHEMA>;
1017
925
  export type LqaAsyncSuccess = z.infer<typeof LQA_ASYNC_SUCCESS_SCHEMA>;
1018
926
  export type LqaAsyncCallbackBody = z.infer<typeof LQA_ASYNC_CALLBACK_SCHEMA>;
1019
- export type LqaAsyncContentUnit = z.infer<typeof LQA_CONTENT_UNIT_SCHEMA>;
1020
- export type LqaAsyncSegment = z.infer<typeof LQA_SEGMENT_SCHEMA>;
1021
- export {};
@@ -1,57 +1,9 @@
1
1
  import z from 'zod';
2
2
  import { ASYNC_REQUEST_SCHEMA, AsyncRequestCallbackStatusEnum, } from "../common/asyncRequestSchemas.js";
3
- import { AI_INTEGRATION_ENGINE_SCHEMA, COMMON_ERROR_RESPONSE_SCHEMA, COMMON_FAILED_OPERATION_CALLBACK_SCHEMA, COMMON_REQUEST_HEADERS_SCHEMA, LOCALE_SCHEMA, SEGMENT_VALUE_MAX_LENGTH_DEFAULT, TM_MATCH_SCHEMA, } from "../common/commonSchemas.js";
3
+ import { AI_INTEGRATION_ENGINE_SCHEMA, COMMON_ERROR_RESPONSE_SCHEMA, COMMON_FAILED_OPERATION_CALLBACK_SCHEMA, COMMON_REQUEST_HEADERS_SCHEMA, LOCALE_SCHEMA, } from "../common/commonSchemas.js";
4
4
  import { TRANSLATION_CONTEXT_SCHEMA } from "../common/translationContextSchemas.js";
5
- import { isSegmentUnderLengthLimit } from "../../validation/isSegmentUnderLengthLimit.js";
6
- import { CONTENT_ID_PROP_SCHEMA } from "../translation/sharedSchemas.js";
7
- import { LqaIssueSeverityEnum } from "./commonSchemas.js";
8
- const LQA_SEGMENT_TRANSLATIONS_MAX_LENGTH = 10;
9
- const LQA_CONTENT_UNIT_DESCRIPTION_MAX_LENGTH = 32768;
10
- const LQA_CONTENT_UNIT_SEGMENTS_MAX_LENGTH = 500;
11
- const LQA_CONTENT_UNITS_MAX_LENGTH = 50;
12
- const LQA_TRANSLATION_ID_SCHEMA = CONTENT_ID_PROP_SCHEMA.describe('Unique ID of the segment translation');
13
- const LQA_TRANSLATION_SCHEMA = z.object({
14
- id: LQA_TRANSLATION_ID_SCHEMA,
15
- locale: LOCALE_SCHEMA,
16
- value: z
17
- .string()
18
- .min(1)
19
- .refine((value) => isSegmentUnderLengthLimit(value), `Too long translation value, max length is ${SEGMENT_VALUE_MAX_LENGTH_DEFAULT} characters`)
20
- .describe('Translation of this segment in target language'),
21
- });
22
- const LQA_SEGMENT_SCHEMA = z.object({
23
- sourceValue: z
24
- .string()
25
- .min(1)
26
- .refine((value) => isSegmentUnderLengthLimit(value), `Too long segment value, max length is ${SEGMENT_VALUE_MAX_LENGTH_DEFAULT} characters`)
27
- .describe('Text content of the segment in source language'),
28
- translations: z
29
- .array(LQA_TRANSLATION_SCHEMA)
30
- .nonempty()
31
- .max(LQA_SEGMENT_TRANSLATIONS_MAX_LENGTH)
32
- .describe('List of translations for this segment'),
33
- tmMatch: TM_MATCH_SCHEMA,
34
- });
35
- const LQA_CONTENT_UNIT_ID_SCHEMA = CONTENT_ID_PROP_SCHEMA.describe('Unique ID of the content unit');
36
- const LQA_CONTENT_UNIT_SCHEMA = z.object({
37
- id: LQA_CONTENT_UNIT_ID_SCHEMA,
38
- context: z
39
- .object({
40
- description: z
41
- .string()
42
- .min(1)
43
- .max(LQA_CONTENT_UNIT_DESCRIPTION_MAX_LENGTH)
44
- .describe('Unit description, something that applies to each segment in a unit. This will be passed as a helpful context to LLM calls')
45
- .optional(),
46
- })
47
- .optional(),
48
- segments: z
49
- .array(LQA_SEGMENT_SCHEMA)
50
- .nonempty()
51
- .max(LQA_CONTENT_UNIT_SEGMENTS_MAX_LENGTH)
52
- .describe('List of segments to be reviewed'),
53
- characterLimit: z.number().optional(),
54
- });
5
+ import { LQA_CONTENT_UNIT_ID_SCHEMA, LQA_CONTENT_UNIT_SCHEMA, LQA_TRANSLATION_ID_SCHEMA, LqaIssueSeverityEnum, } from "./commonSchemas.js";
6
+ export const LQA_CONTENT_UNITS_MAX_LENGTH = 50;
55
7
  export const LQA_ASYNC_BODY_SCHEMA = ASYNC_REQUEST_SCHEMA.extend({
56
8
  sourceLocale: LOCALE_SCHEMA,
57
9
  integration: AI_INTEGRATION_ENGINE_SCHEMA.optional(),
@@ -1 +1 @@
1
- {"version":3,"file":"lqaAsyncSchemas.js","sourceRoot":"","sources":["../../../../src/sdk/schemas/lqa/lqaAsyncSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,OAAO,EACL,oBAAoB,EACpB,8BAA8B,GAC/B,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,uCAAuC,EACvC,6BAA6B,EAC7B,aAAa,EACb,gCAAgC,EAChC,eAAe,GAChB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAA;AAEnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAA;AACzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAEzD,MAAM,mCAAmC,GAAG,EAAE,CAAA;AAC9C,MAAM,uCAAuC,GAAG,KAAK,CAAA;AACrD,MAAM,oCAAoC,GAAG,GAAG,CAAA;AAChD,MAAM,4BAA4B,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