@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,207 +1,10 @@
1
1
  import z from 'zod';
2
- declare const 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 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
- characterLimit: z.ZodOptional<z.ZodNumber>;
68
- segments: z.ZodArray<z.ZodObject<{
69
- sourceValue: z.ZodEffects<z.ZodString, string, string>;
70
- translations: z.ZodArray<z.ZodObject<{
71
- id: z.ZodString;
72
- locale: z.ZodEffects<z.ZodString, string, string>;
73
- value: z.ZodEffects<z.ZodString, string, string>;
74
- }, "strip", z.ZodTypeAny, {
75
- value: string;
76
- id: string;
77
- locale: string;
78
- }, {
79
- value: string;
80
- id: string;
81
- locale: string;
82
- }>, "atleastone">;
83
- tmMatch: z.ZodOptional<z.ZodObject<{
84
- sourceValue: z.ZodString;
85
- translatedValue: z.ZodString;
86
- }, "strip", z.ZodTypeAny, {
87
- sourceValue: string;
88
- translatedValue: string;
89
- }, {
90
- sourceValue: string;
91
- translatedValue: string;
92
- }>>;
93
- }, "strip", z.ZodTypeAny, {
94
- sourceValue: string;
95
- translations: [{
96
- value: string;
97
- id: string;
98
- locale: string;
99
- }, ...{
100
- value: string;
101
- id: string;
102
- locale: string;
103
- }[]];
104
- tmMatch?: {
105
- sourceValue: string;
106
- translatedValue: string;
107
- } | undefined;
108
- }, {
109
- sourceValue: string;
110
- translations: [{
111
- value: string;
112
- id: string;
113
- locale: string;
114
- }, ...{
115
- value: string;
116
- id: string;
117
- locale: string;
118
- }[]];
119
- tmMatch?: {
120
- sourceValue: string;
121
- translatedValue: string;
122
- } | undefined;
123
- }>, "atleastone">;
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
- }>;
199
2
  export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
200
3
  sourceLocale: z.ZodEffects<z.ZodString, string, string>;
201
4
  context: z.ZodOptional<z.ZodObject<{
202
- description: z.ZodOptional<z.ZodString>;
5
+ description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
203
6
  styleGuide: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
204
- text: z.ZodString;
7
+ text: z.ZodEffects<z.ZodString, string, string>;
205
8
  }, "strip", z.ZodTypeAny, {
206
9
  text: string;
207
10
  }, {
@@ -234,14 +37,14 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
234
37
  }>]>>;
235
38
  glossary: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
236
39
  term: z.ZodString;
237
- description: z.ZodOptional<z.ZodString>;
40
+ description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
238
41
  translatable: z.ZodDefault<z.ZodBoolean>;
239
42
  forbidden: z.ZodDefault<z.ZodBoolean>;
240
43
  caseSensitive: z.ZodDefault<z.ZodBoolean>;
241
44
  translations: z.ZodOptional<z.ZodArray<z.ZodObject<{
242
45
  locale: z.ZodEffects<z.ZodString, string, string>;
243
- translation: z.ZodString;
244
- description: z.ZodOptional<z.ZodString>;
46
+ translation: z.ZodEffects<z.ZodString, string, string>;
47
+ description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
245
48
  }, "strip", z.ZodTypeAny, {
246
49
  translation: string;
247
50
  locale: string;
@@ -298,8 +101,8 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
298
101
  }>, "many">>;
299
102
  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>;
300
103
  translationExamples: z.ZodOptional<z.ZodArray<z.ZodObject<{
301
- sourceValue: z.ZodString;
302
- translatedValue: z.ZodString;
104
+ sourceValue: z.ZodEffects<z.ZodString, string, string>;
105
+ translatedValue: z.ZodEffects<z.ZodString, string, string>;
303
106
  }, "strip", z.ZodTypeAny, {
304
107
  sourceValue: string;
305
108
  translatedValue: string;
@@ -371,19 +174,18 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
371
174
  contentUnits: z.ZodArray<z.ZodObject<{
372
175
  id: z.ZodString;
373
176
  context: z.ZodOptional<z.ZodObject<{
374
- description: z.ZodOptional<z.ZodString>;
177
+ description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
375
178
  }, "strip", z.ZodTypeAny, {
376
179
  description?: string | undefined;
377
180
  }, {
378
181
  description?: string | undefined;
379
182
  }>>;
380
- characterLimit: z.ZodOptional<z.ZodNumber>;
381
- segments: z.ZodArray<z.ZodObject<{
382
- sourceValue: z.ZodEffects<z.ZodString, string, string>;
183
+ segments: z.ZodArray<z.ZodEffects<z.ZodObject<{
184
+ sourceValue: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
383
185
  translations: z.ZodArray<z.ZodObject<{
384
186
  id: z.ZodString;
385
187
  locale: z.ZodEffects<z.ZodString, string, string>;
386
- value: z.ZodEffects<z.ZodString, string, string>;
188
+ value: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
387
189
  }, "strip", z.ZodTypeAny, {
388
190
  value: string;
389
191
  id: string;
@@ -394,8 +196,8 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
394
196
  locale: string;
395
197
  }>, "atleastone">;
396
198
  tmMatch: z.ZodOptional<z.ZodObject<{
397
- sourceValue: z.ZodString;
398
- translatedValue: z.ZodString;
199
+ sourceValue: z.ZodEffects<z.ZodString, string, string>;
200
+ translatedValue: z.ZodEffects<z.ZodString, string, string>;
399
201
  }, "strip", z.ZodTypeAny, {
400
202
  sourceValue: string;
401
203
  translatedValue: string;
@@ -403,6 +205,16 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
403
205
  sourceValue: string;
404
206
  translatedValue: string;
405
207
  }>>;
208
+ translationExamples: z.ZodOptional<z.ZodArray<z.ZodObject<{
209
+ sourceValue: z.ZodEffects<z.ZodString, string, string>;
210
+ translatedValue: z.ZodEffects<z.ZodString, string, string>;
211
+ }, "strip", z.ZodTypeAny, {
212
+ sourceValue: string;
213
+ translatedValue: string;
214
+ }, {
215
+ sourceValue: string;
216
+ translatedValue: string;
217
+ }>, "many">>;
406
218
  }, "strip", z.ZodTypeAny, {
407
219
  sourceValue: string;
408
220
  translations: [{
@@ -418,6 +230,48 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
418
230
  sourceValue: string;
419
231
  translatedValue: string;
420
232
  } | undefined;
233
+ translationExamples?: {
234
+ sourceValue: string;
235
+ translatedValue: string;
236
+ }[] | undefined;
237
+ }, {
238
+ sourceValue: string;
239
+ translations: [{
240
+ value: string;
241
+ id: string;
242
+ locale: string;
243
+ }, ...{
244
+ value: string;
245
+ id: string;
246
+ locale: string;
247
+ }[]];
248
+ tmMatch?: {
249
+ sourceValue: string;
250
+ translatedValue: string;
251
+ } | undefined;
252
+ translationExamples?: {
253
+ sourceValue: string;
254
+ translatedValue: string;
255
+ }[] | undefined;
256
+ }>, {
257
+ sourceValue: string;
258
+ translations: [{
259
+ value: string;
260
+ id: string;
261
+ locale: string;
262
+ }, ...{
263
+ value: string;
264
+ id: string;
265
+ locale: string;
266
+ }[]];
267
+ tmMatch?: {
268
+ sourceValue: string;
269
+ translatedValue: string;
270
+ } | undefined;
271
+ translationExamples?: {
272
+ sourceValue: string;
273
+ translatedValue: string;
274
+ }[] | undefined;
421
275
  }, {
422
276
  sourceValue: string;
423
277
  translations: [{
@@ -433,7 +287,12 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
433
287
  sourceValue: string;
434
288
  translatedValue: string;
435
289
  } | undefined;
290
+ translationExamples?: {
291
+ sourceValue: string;
292
+ translatedValue: string;
293
+ }[] | undefined;
436
294
  }>, "atleastone">;
295
+ characterLimit: z.ZodOptional<z.ZodNumber>;
437
296
  }, "strip", z.ZodTypeAny, {
438
297
  segments: [{
439
298
  sourceValue: string;
@@ -450,6 +309,10 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
450
309
  sourceValue: string;
451
310
  translatedValue: string;
452
311
  } | undefined;
312
+ translationExamples?: {
313
+ sourceValue: string;
314
+ translatedValue: string;
315
+ }[] | undefined;
453
316
  }, ...{
454
317
  sourceValue: string;
455
318
  translations: [{
@@ -465,6 +328,10 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
465
328
  sourceValue: string;
466
329
  translatedValue: string;
467
330
  } | undefined;
331
+ translationExamples?: {
332
+ sourceValue: string;
333
+ translatedValue: string;
334
+ }[] | undefined;
468
335
  }[]];
469
336
  id: string;
470
337
  context?: {
@@ -487,6 +354,10 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
487
354
  sourceValue: string;
488
355
  translatedValue: string;
489
356
  } | undefined;
357
+ translationExamples?: {
358
+ sourceValue: string;
359
+ translatedValue: string;
360
+ }[] | undefined;
490
361
  }, ...{
491
362
  sourceValue: string;
492
363
  translations: [{
@@ -502,6 +373,10 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
502
373
  sourceValue: string;
503
374
  translatedValue: string;
504
375
  } | undefined;
376
+ translationExamples?: {
377
+ sourceValue: string;
378
+ translatedValue: string;
379
+ }[] | undefined;
505
380
  }[]];
506
381
  id: string;
507
382
  context?: {
@@ -527,6 +402,10 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
527
402
  sourceValue: string;
528
403
  translatedValue: string;
529
404
  } | undefined;
405
+ translationExamples?: {
406
+ sourceValue: string;
407
+ translatedValue: string;
408
+ }[] | undefined;
530
409
  }, ...{
531
410
  sourceValue: string;
532
411
  translations: [{
@@ -542,6 +421,10 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
542
421
  sourceValue: string;
543
422
  translatedValue: string;
544
423
  } | undefined;
424
+ translationExamples?: {
425
+ sourceValue: string;
426
+ translatedValue: string;
427
+ }[] | undefined;
545
428
  }[]];
546
429
  id: string;
547
430
  context?: {
@@ -564,6 +447,10 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
564
447
  sourceValue: string;
565
448
  translatedValue: string;
566
449
  } | undefined;
450
+ translationExamples?: {
451
+ sourceValue: string;
452
+ translatedValue: string;
453
+ }[] | undefined;
567
454
  }, ...{
568
455
  sourceValue: string;
569
456
  translations: [{
@@ -579,6 +466,10 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
579
466
  sourceValue: string;
580
467
  translatedValue: string;
581
468
  } | undefined;
469
+ translationExamples?: {
470
+ sourceValue: string;
471
+ translatedValue: string;
472
+ }[] | undefined;
582
473
  }[]];
583
474
  id: string;
584
475
  context?: {
@@ -633,6 +524,10 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
633
524
  sourceValue: string;
634
525
  translatedValue: string;
635
526
  } | undefined;
527
+ translationExamples?: {
528
+ sourceValue: string;
529
+ translatedValue: string;
530
+ }[] | undefined;
636
531
  }, ...{
637
532
  sourceValue: string;
638
533
  translations: [{
@@ -648,6 +543,10 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
648
543
  sourceValue: string;
649
544
  translatedValue: string;
650
545
  } | undefined;
546
+ translationExamples?: {
547
+ sourceValue: string;
548
+ translatedValue: string;
549
+ }[] | undefined;
651
550
  }[]];
652
551
  id: string;
653
552
  context?: {
@@ -670,6 +569,10 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
670
569
  sourceValue: string;
671
570
  translatedValue: string;
672
571
  } | undefined;
572
+ translationExamples?: {
573
+ sourceValue: string;
574
+ translatedValue: string;
575
+ }[] | undefined;
673
576
  }, ...{
674
577
  sourceValue: string;
675
578
  translations: [{
@@ -685,6 +588,10 @@ export declare const LQA_SYNC_BODY_SCHEMA: z.ZodObject<{
685
588
  sourceValue: string;
686
589
  translatedValue: string;
687
590
  } | undefined;
591
+ translationExamples?: {
592
+ sourceValue: string;
593
+ translatedValue: string;
594
+ }[] | undefined;
688
595
  }[]];
689
596
  id: string;
690
597
  context?: {
@@ -849,6 +756,3 @@ export declare const LQA_SYNC_RESPONSE_SCHEMA: z.ZodObject<{
849
756
  export type LqaSyncBody = z.infer<typeof LQA_SYNC_BODY_SCHEMA>;
850
757
  export type LqaSyncHeaders = z.infer<typeof LQA_SYNC_HEADERS_SCHEMA>;
851
758
  export type LqaSyncResponse = z.infer<typeof LQA_SYNC_RESPONSE_SCHEMA>;
852
- export type LqaSyncContentUnit = z.infer<typeof CONTENT_UNIT_SCHEMA>;
853
- export type LqaSyncSegment = z.infer<typeof SEGMENT_SCHEMA>;
854
- export {};
@@ -1,62 +1,14 @@
1
1
  import z from 'zod';
2
- import { AI_INTEGRATION_ENGINE_SCHEMA, COMMON_ERROR_RESPONSE_SCHEMA, COMMON_REQUEST_HEADERS_SCHEMA, LOCALE_SCHEMA, SEGMENT_VALUE_MAX_LENGTH_DEFAULT, TM_MATCH_SCHEMA, } from "../common/commonSchemas.js";
2
+ import { AI_INTEGRATION_ENGINE_SCHEMA, COMMON_ERROR_RESPONSE_SCHEMA, COMMON_REQUEST_HEADERS_SCHEMA, LOCALE_SCHEMA, } from "../common/commonSchemas.js";
3
3
  import { TRANSLATION_CONTEXT_SCHEMA } from "../common/translationContextSchemas.js";
4
- import { isSegmentUnderLengthLimit } from "../../validation/isSegmentUnderLengthLimit.js";
5
- import { CONTENT_ID_PROP_SCHEMA } from "../translation/sharedSchemas.js";
6
- import { LqaIssueSeverityEnum } from "./commonSchemas.js";
7
- const LQA_SEGMENT_TRANSLATIONS_MAX_LENGTH = 10;
8
- const LQA_CONTENT_UNIT_DESCRIPTION_MAX_LENGTH = 32768;
9
- const LQA_CONTENT_UNIT_SEGMENTS_MAX_LENGTH = 500;
4
+ import { LQA_CONTENT_UNIT_ID_SCHEMA, LQA_CONTENT_UNIT_SCHEMA, LQA_TRANSLATION_ID_SCHEMA, LqaIssueSeverityEnum, } from "./commonSchemas.js";
10
5
  const LQA_CONTENT_UNITS_MAX_LENGTH = 1;
11
- const LQA_TRANSLATION_ID_SCHEMA = CONTENT_ID_PROP_SCHEMA.describe('Unique ID of the segment translation');
12
- const TRANSLATION_SCHEMA = z.object({
13
- id: LQA_TRANSLATION_ID_SCHEMA,
14
- locale: LOCALE_SCHEMA,
15
- value: z
16
- .string()
17
- .min(1)
18
- .refine((value) => isSegmentUnderLengthLimit(value), `Too long translation value, max length is ${SEGMENT_VALUE_MAX_LENGTH_DEFAULT} characters`)
19
- .describe('Translation of this segment in target language'),
20
- });
21
- const SEGMENT_SCHEMA = z.object({
22
- sourceValue: z
23
- .string()
24
- .min(1)
25
- .refine((value) => isSegmentUnderLengthLimit(value), `Too long segment value, max length is ${SEGMENT_VALUE_MAX_LENGTH_DEFAULT} characters`)
26
- .describe('Text content of the segment in source language'),
27
- translations: z
28
- .array(TRANSLATION_SCHEMA)
29
- .nonempty()
30
- .max(LQA_SEGMENT_TRANSLATIONS_MAX_LENGTH)
31
- .describe('List of translations for this segment'),
32
- tmMatch: TM_MATCH_SCHEMA,
33
- });
34
- const LQA_CONTENT_UNIT_ID_SCHEMA = CONTENT_ID_PROP_SCHEMA.describe('Unique ID of the content unit');
35
- const CONTENT_UNIT_SCHEMA = z.object({
36
- id: LQA_CONTENT_UNIT_ID_SCHEMA,
37
- context: z
38
- .object({
39
- description: z
40
- .string()
41
- .min(1)
42
- .max(LQA_CONTENT_UNIT_DESCRIPTION_MAX_LENGTH)
43
- .describe('Unit description, something that applies to each segment in a unit. This will be passed as a helpful context to LLM calls')
44
- .optional(),
45
- })
46
- .optional(),
47
- characterLimit: z.number().optional(),
48
- segments: z
49
- .array(SEGMENT_SCHEMA)
50
- .nonempty()
51
- .max(LQA_CONTENT_UNIT_SEGMENTS_MAX_LENGTH)
52
- .describe('List of segments to be reviewed'),
53
- });
54
6
  export const LQA_SYNC_BODY_SCHEMA = z.object({
55
7
  sourceLocale: LOCALE_SCHEMA,
56
8
  context: TRANSLATION_CONTEXT_SCHEMA.optional(),
57
9
  integration: AI_INTEGRATION_ENGINE_SCHEMA.optional(),
58
10
  contentUnits: z
59
- .array(CONTENT_UNIT_SCHEMA)
11
+ .array(LQA_CONTENT_UNIT_SCHEMA)
60
12
  .nonempty()
61
13
  .max(LQA_CONTENT_UNITS_MAX_LENGTH)
62
14
  .describe('A list of content units to be reviewed. Each unit might have 1 or more segments, but all segments in content unit are considered to be parts of the same piece of content.'),
@@ -1 +1 @@
1
- {"version":3,"file":"lqaSyncSchemas.js","sourceRoot":"","sources":["../../../../src/sdk/schemas/lqa/lqaSyncSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,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,GAAG,CAAC,CAAA;AAEtC,MAAM,yBAAyB,GAAG,sBAAsB,CAAC,QAAQ,CAC/D,sCAAsC,CACvC,CAAA;AAED,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,EAAE,EAAE,yBAAyB;IAC7B,MAAM,EAAE,aAAa;IACrB,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;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AAM,CAAC;YACP,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;YACpB,QAAQ,EAAE,CAAC,CAAC,UAAU,CAAC,oBAAoB,CAAC;YAC5C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC/B,CAAC,CACH;QACD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;KAClB,CAAC,CACH;IACD,MAAM,EAAE,CAAC;SACN,KAAK,CACJ,4BAA4B,CAAC,MAAM,CAAC;QAClC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;QACzB,aAAa,EAAE,0BAA0B;QACzC,aAAa,EAAE,yBAAyB;KACzC,CAAC,CACH;SACA,QAAQ,EAAE;CACd,CAAC;KACD,QAAQ,CAAC,mCAAmC,CAAC,CAAA"}
@@ -1,9 +1,9 @@
1
1
  import z from 'zod';
2
2
  export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
3
3
  assets: z.ZodOptional<z.ZodObject<{
4
- description: z.ZodOptional<z.ZodString>;
4
+ description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
5
5
  styleGuide: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
6
- text: z.ZodString;
6
+ text: z.ZodEffects<z.ZodString, string, string>;
7
7
  }, "strip", z.ZodTypeAny, {
8
8
  text: string;
9
9
  }, {
@@ -36,14 +36,14 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
36
36
  }>]>>;
37
37
  glossary: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
38
38
  term: z.ZodString;
39
- description: z.ZodOptional<z.ZodString>;
39
+ description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
40
40
  translatable: z.ZodDefault<z.ZodBoolean>;
41
41
  forbidden: z.ZodDefault<z.ZodBoolean>;
42
42
  caseSensitive: z.ZodDefault<z.ZodBoolean>;
43
43
  translations: z.ZodOptional<z.ZodArray<z.ZodObject<{
44
44
  locale: z.ZodEffects<z.ZodString, string, string>;
45
- translation: z.ZodString;
46
- description: z.ZodOptional<z.ZodString>;
45
+ translation: z.ZodEffects<z.ZodString, string, string>;
46
+ description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
47
47
  }, "strip", z.ZodTypeAny, {
48
48
  translation: string;
49
49
  locale: string;
@@ -100,8 +100,8 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
100
100
  }>, "many">>;
101
101
  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>;
102
102
  translationExamples: z.ZodOptional<z.ZodArray<z.ZodObject<{
103
- sourceValue: z.ZodString;
104
- translatedValue: z.ZodString;
103
+ sourceValue: z.ZodEffects<z.ZodString, string, string>;
104
+ translatedValue: z.ZodEffects<z.ZodString, string, string>;
105
105
  }, "strip", z.ZodTypeAny, {
106
106
  sourceValue: string;
107
107
  translatedValue: string;
@@ -165,9 +165,9 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
165
165
  targetPluralForms?: ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined;
166
166
  }>>;
167
167
  sourceLocale: z.ZodEffects<z.ZodString, string, string>;
168
- sourceValue: z.ZodString;
168
+ sourceValue: z.ZodEffects<z.ZodString, string, string>;
169
169
  targetLocale: z.ZodEffects<z.ZodString, string, string>;
170
- targetValue: z.ZodString;
170
+ targetValue: z.ZodEffects<z.ZodString, string, string>;
171
171
  integration: z.ZodOptional<z.ZodNativeEnum<{
172
172
  readonly FINETUNED_OPENAI: "FT-OpenAI";
173
173
  readonly CLAUDE: "Claude";
@@ -176,13 +176,13 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
176
176
  }>>;
177
177
  forceIntegration: z.ZodOptional<z.ZodBoolean>;
178
178
  history: z.ZodOptional<z.ZodArray<z.ZodObject<{
179
- values: z.ZodArray<z.ZodString, "atleastone">;
179
+ values: z.ZodEffects<z.ZodArray<z.ZodString, "atleastone">, string[], [string, ...string[]]>;
180
180
  mode: z.ZodPipeline<z.ZodString, z.ZodNativeEnum<{
181
181
  readonly REPHRASE: "rephrase";
182
182
  readonly SHORTEN: "shorten";
183
183
  }>>;
184
184
  }, "strip", z.ZodTypeAny, {
185
- values: [string, ...string[]];
185
+ values: string[];
186
186
  mode: "rephrase" | "shorten";
187
187
  }, {
188
188
  values: [string, ...string[]];
@@ -229,7 +229,7 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
229
229
  } | undefined;
230
230
  forceIntegration?: boolean | undefined;
231
231
  history?: {
232
- values: [string, ...string[]];
232
+ values: string[];
233
233
  mode: "rephrase" | "shorten";
234
234
  }[] | undefined;
235
235
  }, {
@@ -309,7 +309,7 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
309
309
  } | undefined;
310
310
  forceIntegration?: boolean | undefined;
311
311
  history?: {
312
- values: [string, ...string[]];
312
+ values: string[];
313
313
  mode: "rephrase" | "shorten";
314
314
  }[] | undefined;
315
315
  }, {
@@ -389,7 +389,7 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
389
389
  } | undefined;
390
390
  forceIntegration?: boolean | undefined;
391
391
  history?: {
392
- values: [string, ...string[]];
392
+ values: string[];
393
393
  mode: "rephrase" | "shorten";
394
394
  }[] | undefined;
395
395
  }, {
@@ -469,7 +469,7 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
469
469
  } | undefined;
470
470
  forceIntegration?: boolean | undefined;
471
471
  history?: {
472
- values: [string, ...string[]];
472
+ values: string[];
473
473
  mode: "rephrase" | "shorten";
474
474
  }[] | undefined;
475
475
  }, {