@lokalise/polyglot-sdk 17.0.0 → 17.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 (32) hide show
  1. package/dist/index.d.ts +3 -1
  2. package/dist/index.js +2 -0
  3. package/dist/index.js.map +1 -1
  4. package/dist/sdk/helpers/htmlEscaping.d.ts +3 -0
  5. package/dist/sdk/helpers/htmlEscaping.js +26 -0
  6. package/dist/sdk/helpers/htmlEscaping.js.map +1 -0
  7. package/dist/sdk/helpers/isEnumValue.d.ts +1 -0
  8. package/dist/sdk/helpers/isEnumValue.js +8 -0
  9. package/dist/sdk/helpers/isEnumValue.js.map +1 -0
  10. package/dist/sdk/schemas/common/commonSchemas.d.ts +9 -0
  11. package/dist/sdk/schemas/common/commonSchemas.js +6 -1
  12. package/dist/sdk/schemas/common/commonSchemas.js.map +1 -1
  13. package/dist/sdk/schemas/common/translationContextSchemas.d.ts +48 -0
  14. package/dist/sdk/schemas/common/translationContextSchemas.js +9 -1
  15. package/dist/sdk/schemas/common/translationContextSchemas.js.map +1 -1
  16. package/dist/sdk/schemas/lqa/lqaAsyncSchemas.d.ts +29 -2
  17. package/dist/sdk/schemas/lqa/lqaSyncSchemas.d.ts +29 -2
  18. package/dist/sdk/schemas/translation/generateVariants.d.ts +60 -17
  19. package/dist/sdk/schemas/translation/generateVariants.js +1 -1
  20. package/dist/sdk/schemas/translation/rewriteTextSchemas.d.ts +121 -17
  21. package/dist/sdk/schemas/translation/rewriteTextSchemas.js +1 -1
  22. package/dist/sdk/schemas/translation/sharedSchemas.d.ts +34 -5
  23. package/dist/sdk/schemas/translation/sharedSchemas.js +30 -8
  24. package/dist/sdk/schemas/translation/sharedSchemas.js.map +1 -1
  25. package/dist/sdk/schemas/translation/translateAsyncSchemas.d.ts +59 -8
  26. package/dist/sdk/schemas/translation/translateSyncSchemas.d.ts +49 -6
  27. package/dist/sdk/schemas/translation/translateTextSegmentSchemas.d.ts +698 -0
  28. package/dist/sdk/schemas/translation/translateTextSegmentSchemas.js +38 -0
  29. package/dist/sdk/schemas/translation/translateTextSegmentSchemas.js.map +1 -0
  30. package/dist/sdk/validation/isSegmentUnderLengthLimit.js +3 -1
  31. package/dist/sdk/validation/isSegmentUnderLengthLimit.js.map +1 -1
  32. package/package.json +7 -6
@@ -99,6 +99,16 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
99
99
  }[] | undefined;
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
+ translationExamples: z.ZodOptional<z.ZodArray<z.ZodObject<{
103
+ sourceValue: z.ZodString;
104
+ translatedValue: z.ZodString;
105
+ }, "strip", z.ZodTypeAny, {
106
+ sourceValue: string;
107
+ translatedValue: string;
108
+ }, {
109
+ sourceValue: string;
110
+ translatedValue: string;
111
+ }>, "many">>;
102
112
  }, "strip", z.ZodTypeAny, {
103
113
  description?: string | undefined;
104
114
  styleGuide?: {
@@ -122,6 +132,10 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
122
132
  }[] | undefined;
123
133
  }[] | undefined;
124
134
  targetPluralForms?: ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined;
135
+ translationExamples?: {
136
+ sourceValue: string;
137
+ translatedValue: string;
138
+ }[] | undefined;
125
139
  }, {
126
140
  description?: string | undefined;
127
141
  styleGuide?: {
@@ -145,12 +159,17 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
145
159
  }[] | undefined;
146
160
  }[] | undefined;
147
161
  targetPluralForms?: ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined;
162
+ translationExamples?: {
163
+ sourceValue: string;
164
+ translatedValue: string;
165
+ }[] | undefined;
148
166
  }>>;
149
167
  sourceLocale: z.ZodEffects<z.ZodString, string, string>;
150
168
  sourceValue: z.ZodString;
151
169
  targetLocale: z.ZodEffects<z.ZodString, string, string>;
152
170
  targetValue: z.ZodString;
153
171
  integration: z.ZodOptional<z.ZodNativeEnum<{
172
+ readonly FINETUNED_OPENAI: "FT-OpenAI";
154
173
  readonly CLAUDE: "Claude";
155
174
  readonly CHAT_GPT4: "ChatGPT-4";
156
175
  readonly GEMINI: "Gemini";
@@ -158,27 +177,27 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
158
177
  history: z.ZodOptional<z.ZodArray<z.ZodObject<{
159
178
  values: z.ZodArray<z.ZodString, "atleastone">;
160
179
  mode: z.ZodPipeline<z.ZodString, z.ZodNativeEnum<{
161
- readonly REPHRASE: "REPHRASE";
162
- readonly SHORTEN: "SHORTEN";
180
+ readonly REPHRASE: "rephrase";
181
+ readonly SHORTEN: "shorten";
163
182
  }>>;
164
183
  }, "strip", z.ZodTypeAny, {
165
184
  values: [string, ...string[]];
166
- mode: "REPHRASE" | "SHORTEN";
185
+ mode: "rephrase" | "shorten";
167
186
  }, {
168
187
  values: [string, ...string[]];
169
188
  mode: string;
170
189
  }>, "many">>;
171
190
  mode: z.ZodPipeline<z.ZodString, z.ZodNativeEnum<{
172
- readonly REPHRASE: "REPHRASE";
173
- readonly SHORTEN: "SHORTEN";
191
+ readonly REPHRASE: "rephrase";
192
+ readonly SHORTEN: "shorten";
174
193
  }>>;
175
194
  }, "strip", z.ZodTypeAny, {
176
195
  sourceValue: string;
177
- mode: "REPHRASE" | "SHORTEN";
196
+ mode: "rephrase" | "shorten";
178
197
  sourceLocale: string;
179
198
  targetLocale: string;
180
199
  targetValue: string;
181
- integration?: "Claude" | "ChatGPT-4" | "Gemini" | undefined;
200
+ integration?: "FT-OpenAI" | "Claude" | "ChatGPT-4" | "Gemini" | undefined;
182
201
  assets?: {
183
202
  description?: string | undefined;
184
203
  styleGuide?: {
@@ -202,10 +221,14 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
202
221
  }[] | undefined;
203
222
  }[] | undefined;
204
223
  targetPluralForms?: ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined;
224
+ translationExamples?: {
225
+ sourceValue: string;
226
+ translatedValue: string;
227
+ }[] | undefined;
205
228
  } | undefined;
206
229
  history?: {
207
230
  values: [string, ...string[]];
208
- mode: "REPHRASE" | "SHORTEN";
231
+ mode: "rephrase" | "shorten";
209
232
  }[] | undefined;
210
233
  }, {
211
234
  sourceValue: string;
@@ -213,7 +236,7 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
213
236
  sourceLocale: string;
214
237
  targetLocale: string;
215
238
  targetValue: string;
216
- integration?: "Claude" | "ChatGPT-4" | "Gemini" | undefined;
239
+ integration?: "FT-OpenAI" | "Claude" | "ChatGPT-4" | "Gemini" | undefined;
217
240
  assets?: {
218
241
  description?: string | undefined;
219
242
  styleGuide?: {
@@ -237,6 +260,10 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
237
260
  }[] | undefined;
238
261
  }[] | undefined;
239
262
  targetPluralForms?: ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined;
263
+ translationExamples?: {
264
+ sourceValue: string;
265
+ translatedValue: string;
266
+ }[] | undefined;
240
267
  } | undefined;
241
268
  history?: {
242
269
  values: [string, ...string[]];
@@ -244,11 +271,11 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
244
271
  }[] | undefined;
245
272
  }>, {
246
273
  sourceValue: string;
247
- mode: "REPHRASE" | "SHORTEN";
274
+ mode: "rephrase" | "shorten";
248
275
  sourceLocale: string;
249
276
  targetLocale: string;
250
277
  targetValue: string;
251
- integration?: "Claude" | "ChatGPT-4" | "Gemini" | undefined;
278
+ integration?: "FT-OpenAI" | "Claude" | "ChatGPT-4" | "Gemini" | undefined;
252
279
  assets?: {
253
280
  description?: string | undefined;
254
281
  styleGuide?: {
@@ -272,10 +299,14 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
272
299
  }[] | undefined;
273
300
  }[] | undefined;
274
301
  targetPluralForms?: ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined;
302
+ translationExamples?: {
303
+ sourceValue: string;
304
+ translatedValue: string;
305
+ }[] | undefined;
275
306
  } | undefined;
276
307
  history?: {
277
308
  values: [string, ...string[]];
278
- mode: "REPHRASE" | "SHORTEN";
309
+ mode: "rephrase" | "shorten";
279
310
  }[] | undefined;
280
311
  }, {
281
312
  sourceValue: string;
@@ -283,7 +314,7 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
283
314
  sourceLocale: string;
284
315
  targetLocale: string;
285
316
  targetValue: string;
286
- integration?: "Claude" | "ChatGPT-4" | "Gemini" | undefined;
317
+ integration?: "FT-OpenAI" | "Claude" | "ChatGPT-4" | "Gemini" | undefined;
287
318
  assets?: {
288
319
  description?: string | undefined;
289
320
  styleGuide?: {
@@ -307,6 +338,10 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
307
338
  }[] | undefined;
308
339
  }[] | undefined;
309
340
  targetPluralForms?: ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined;
341
+ translationExamples?: {
342
+ sourceValue: string;
343
+ translatedValue: string;
344
+ }[] | undefined;
310
345
  } | undefined;
311
346
  history?: {
312
347
  values: [string, ...string[]];
@@ -314,11 +349,11 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
314
349
  }[] | undefined;
315
350
  }>, {
316
351
  sourceValue: string;
317
- mode: "REPHRASE" | "SHORTEN";
352
+ mode: "rephrase" | "shorten";
318
353
  sourceLocale: string;
319
354
  targetLocale: string;
320
355
  targetValue: string;
321
- integration?: "Claude" | "ChatGPT-4" | "Gemini" | undefined;
356
+ integration?: "FT-OpenAI" | "Claude" | "ChatGPT-4" | "Gemini" | undefined;
322
357
  assets?: {
323
358
  description?: string | undefined;
324
359
  styleGuide?: {
@@ -342,10 +377,14 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
342
377
  }[] | undefined;
343
378
  }[] | undefined;
344
379
  targetPluralForms?: ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined;
380
+ translationExamples?: {
381
+ sourceValue: string;
382
+ translatedValue: string;
383
+ }[] | undefined;
345
384
  } | undefined;
346
385
  history?: {
347
386
  values: [string, ...string[]];
348
- mode: "REPHRASE" | "SHORTEN";
387
+ mode: "rephrase" | "shorten";
349
388
  }[] | undefined;
350
389
  }, {
351
390
  sourceValue: string;
@@ -353,7 +392,7 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
353
392
  sourceLocale: string;
354
393
  targetLocale: string;
355
394
  targetValue: string;
356
- integration?: "Claude" | "ChatGPT-4" | "Gemini" | undefined;
395
+ integration?: "FT-OpenAI" | "Claude" | "ChatGPT-4" | "Gemini" | undefined;
357
396
  assets?: {
358
397
  description?: string | undefined;
359
398
  styleGuide?: {
@@ -377,6 +416,10 @@ export declare const GENERATE_VARIANTS_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.
377
416
  }[] | undefined;
378
417
  }[] | undefined;
379
418
  targetPluralForms?: ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined;
419
+ translationExamples?: {
420
+ sourceValue: string;
421
+ translatedValue: string;
422
+ }[] | undefined;
380
423
  } | undefined;
381
424
  history?: {
382
425
  values: [string, ...string[]];
@@ -22,7 +22,7 @@ exports.GENERATE_VARIANTS_BODY_SCHEMA = zod_1.default
22
22
  .optional(),
23
23
  mode: zod_1.default
24
24
  .string()
25
- .toUpperCase()
25
+ .toLowerCase()
26
26
  .pipe(zod_1.default.nativeEnum(sharedSchemas_1.VariantsModeEnum))
27
27
  .describe('A specific way of how a new variant is generated. If `rephrase`, it simply gets reworded, if `shorten` - AI tries to also make the translation shorter.'),
28
28
  })
@@ -100,6 +100,16 @@ export declare const REWRITE_TEXT_SEGMENT_BODY_SCHEMA: z.ZodEffects<z.ZodObject<
100
100
  }[] | undefined;
101
101
  }>, "many">>;
102
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>;
103
+ translationExamples: z.ZodOptional<z.ZodArray<z.ZodObject<{
104
+ sourceValue: z.ZodString;
105
+ translatedValue: z.ZodString;
106
+ }, "strip", z.ZodTypeAny, {
107
+ sourceValue: string;
108
+ translatedValue: string;
109
+ }, {
110
+ sourceValue: string;
111
+ translatedValue: string;
112
+ }>, "many">>;
103
113
  }, "targetPluralForms">, "strip", z.ZodTypeAny, {
104
114
  description?: string | undefined;
105
115
  styleGuide?: {
@@ -122,6 +132,10 @@ export declare const REWRITE_TEXT_SEGMENT_BODY_SCHEMA: z.ZodEffects<z.ZodObject<
122
132
  description?: string | undefined;
123
133
  }[] | undefined;
124
134
  }[] | undefined;
135
+ translationExamples?: {
136
+ sourceValue: string;
137
+ translatedValue: string;
138
+ }[] | undefined;
125
139
  }, {
126
140
  description?: string | undefined;
127
141
  styleGuide?: {
@@ -144,6 +158,10 @@ export declare const REWRITE_TEXT_SEGMENT_BODY_SCHEMA: z.ZodEffects<z.ZodObject<
144
158
  description?: string | undefined;
145
159
  }[] | undefined;
146
160
  }[] | undefined;
161
+ translationExamples?: {
162
+ sourceValue: string;
163
+ translatedValue: string;
164
+ }[] | undefined;
147
165
  }>>;
148
166
  assets: z.ZodOptional<z.ZodObject<Omit<{
149
167
  description: z.ZodOptional<z.ZodString>;
@@ -244,6 +262,16 @@ export declare const REWRITE_TEXT_SEGMENT_BODY_SCHEMA: z.ZodEffects<z.ZodObject<
244
262
  }[] | undefined;
245
263
  }>, "many">>;
246
264
  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>;
265
+ translationExamples: z.ZodOptional<z.ZodArray<z.ZodObject<{
266
+ sourceValue: z.ZodString;
267
+ translatedValue: z.ZodString;
268
+ }, "strip", z.ZodTypeAny, {
269
+ sourceValue: string;
270
+ translatedValue: string;
271
+ }, {
272
+ sourceValue: string;
273
+ translatedValue: string;
274
+ }>, "many">>;
247
275
  }, "targetPluralForms">, "strip", z.ZodTypeAny, {
248
276
  description?: string | undefined;
249
277
  styleGuide?: {
@@ -266,6 +294,10 @@ export declare const REWRITE_TEXT_SEGMENT_BODY_SCHEMA: z.ZodEffects<z.ZodObject<
266
294
  description?: string | undefined;
267
295
  }[] | undefined;
268
296
  }[] | undefined;
297
+ translationExamples?: {
298
+ sourceValue: string;
299
+ translatedValue: string;
300
+ }[] | undefined;
269
301
  }, {
270
302
  description?: string | undefined;
271
303
  styleGuide?: {
@@ -288,10 +320,15 @@ export declare const REWRITE_TEXT_SEGMENT_BODY_SCHEMA: z.ZodEffects<z.ZodObject<
288
320
  description?: string | undefined;
289
321
  }[] | undefined;
290
322
  }[] | undefined;
323
+ translationExamples?: {
324
+ sourceValue: string;
325
+ translatedValue: string;
326
+ }[] | undefined;
291
327
  }>>;
292
328
  locale: z.ZodEffects<z.ZodString, string, string>;
293
329
  value: z.ZodString;
294
330
  integration: z.ZodOptional<z.ZodNativeEnum<{
331
+ readonly FINETUNED_OPENAI: "FT-OpenAI";
295
332
  readonly CLAUDE: "Claude";
296
333
  readonly CHAT_GPT4: "ChatGPT-4";
297
334
  readonly GEMINI: "Gemini";
@@ -299,24 +336,24 @@ export declare const REWRITE_TEXT_SEGMENT_BODY_SCHEMA: z.ZodEffects<z.ZodObject<
299
336
  history: z.ZodOptional<z.ZodArray<z.ZodObject<{
300
337
  values: z.ZodArray<z.ZodString, "atleastone">;
301
338
  mode: z.ZodPipeline<z.ZodString, z.ZodNativeEnum<{
302
- readonly REPHRASE: "REPHRASE";
303
- readonly SHORTEN: "SHORTEN";
339
+ readonly REPHRASE: "rephrase";
340
+ readonly SHORTEN: "shorten";
304
341
  }>>;
305
342
  }, "strip", z.ZodTypeAny, {
306
343
  values: [string, ...string[]];
307
- mode: "REPHRASE" | "SHORTEN";
344
+ mode: "rephrase" | "shorten";
308
345
  }, {
309
346
  values: [string, ...string[]];
310
347
  mode: string;
311
348
  }>, "many">>;
312
349
  mode: z.ZodPipeline<z.ZodString, z.ZodNativeEnum<{
313
- readonly REPHRASE: "REPHRASE";
314
- readonly SHORTEN: "SHORTEN";
350
+ readonly REPHRASE: "rephrase";
351
+ readonly SHORTEN: "shorten";
315
352
  }>>;
316
353
  }, "strip", z.ZodTypeAny, {
317
354
  value: string;
318
355
  locale: string;
319
- mode: "REPHRASE" | "SHORTEN";
356
+ mode: "rephrase" | "shorten";
320
357
  context?: {
321
358
  description?: string | undefined;
322
359
  styleGuide?: {
@@ -339,8 +376,12 @@ export declare const REWRITE_TEXT_SEGMENT_BODY_SCHEMA: z.ZodEffects<z.ZodObject<
339
376
  description?: string | undefined;
340
377
  }[] | undefined;
341
378
  }[] | undefined;
379
+ translationExamples?: {
380
+ sourceValue: string;
381
+ translatedValue: string;
382
+ }[] | undefined;
342
383
  } | undefined;
343
- integration?: "Claude" | "ChatGPT-4" | "Gemini" | undefined;
384
+ integration?: "FT-OpenAI" | "Claude" | "ChatGPT-4" | "Gemini" | undefined;
344
385
  assets?: {
345
386
  description?: string | undefined;
346
387
  styleGuide?: {
@@ -363,10 +404,14 @@ export declare const REWRITE_TEXT_SEGMENT_BODY_SCHEMA: z.ZodEffects<z.ZodObject<
363
404
  description?: string | undefined;
364
405
  }[] | undefined;
365
406
  }[] | undefined;
407
+ translationExamples?: {
408
+ sourceValue: string;
409
+ translatedValue: string;
410
+ }[] | undefined;
366
411
  } | undefined;
367
412
  history?: {
368
413
  values: [string, ...string[]];
369
- mode: "REPHRASE" | "SHORTEN";
414
+ mode: "rephrase" | "shorten";
370
415
  }[] | undefined;
371
416
  }, {
372
417
  value: string;
@@ -394,8 +439,12 @@ export declare const REWRITE_TEXT_SEGMENT_BODY_SCHEMA: z.ZodEffects<z.ZodObject<
394
439
  description?: string | undefined;
395
440
  }[] | undefined;
396
441
  }[] | undefined;
442
+ translationExamples?: {
443
+ sourceValue: string;
444
+ translatedValue: string;
445
+ }[] | undefined;
397
446
  } | undefined;
398
- integration?: "Claude" | "ChatGPT-4" | "Gemini" | undefined;
447
+ integration?: "FT-OpenAI" | "Claude" | "ChatGPT-4" | "Gemini" | undefined;
399
448
  assets?: {
400
449
  description?: string | undefined;
401
450
  styleGuide?: {
@@ -418,6 +467,10 @@ export declare const REWRITE_TEXT_SEGMENT_BODY_SCHEMA: z.ZodEffects<z.ZodObject<
418
467
  description?: string | undefined;
419
468
  }[] | undefined;
420
469
  }[] | undefined;
470
+ translationExamples?: {
471
+ sourceValue: string;
472
+ translatedValue: string;
473
+ }[] | undefined;
421
474
  } | undefined;
422
475
  history?: {
423
476
  values: [string, ...string[]];
@@ -426,7 +479,7 @@ export declare const REWRITE_TEXT_SEGMENT_BODY_SCHEMA: z.ZodEffects<z.ZodObject<
426
479
  }>, {
427
480
  value: string;
428
481
  locale: string;
429
- mode: "REPHRASE" | "SHORTEN";
482
+ mode: "rephrase" | "shorten";
430
483
  context?: {
431
484
  description?: string | undefined;
432
485
  styleGuide?: {
@@ -449,8 +502,12 @@ export declare const REWRITE_TEXT_SEGMENT_BODY_SCHEMA: z.ZodEffects<z.ZodObject<
449
502
  description?: string | undefined;
450
503
  }[] | undefined;
451
504
  }[] | undefined;
505
+ translationExamples?: {
506
+ sourceValue: string;
507
+ translatedValue: string;
508
+ }[] | undefined;
452
509
  } | undefined;
453
- integration?: "Claude" | "ChatGPT-4" | "Gemini" | undefined;
510
+ integration?: "FT-OpenAI" | "Claude" | "ChatGPT-4" | "Gemini" | undefined;
454
511
  assets?: {
455
512
  description?: string | undefined;
456
513
  styleGuide?: {
@@ -473,10 +530,14 @@ export declare const REWRITE_TEXT_SEGMENT_BODY_SCHEMA: z.ZodEffects<z.ZodObject<
473
530
  description?: string | undefined;
474
531
  }[] | undefined;
475
532
  }[] | undefined;
533
+ translationExamples?: {
534
+ sourceValue: string;
535
+ translatedValue: string;
536
+ }[] | undefined;
476
537
  } | undefined;
477
538
  history?: {
478
539
  values: [string, ...string[]];
479
- mode: "REPHRASE" | "SHORTEN";
540
+ mode: "rephrase" | "shorten";
480
541
  }[] | undefined;
481
542
  }, {
482
543
  value: string;
@@ -504,8 +565,12 @@ export declare const REWRITE_TEXT_SEGMENT_BODY_SCHEMA: z.ZodEffects<z.ZodObject<
504
565
  description?: string | undefined;
505
566
  }[] | undefined;
506
567
  }[] | undefined;
568
+ translationExamples?: {
569
+ sourceValue: string;
570
+ translatedValue: string;
571
+ }[] | undefined;
507
572
  } | undefined;
508
- integration?: "Claude" | "ChatGPT-4" | "Gemini" | undefined;
573
+ integration?: "FT-OpenAI" | "Claude" | "ChatGPT-4" | "Gemini" | undefined;
509
574
  assets?: {
510
575
  description?: string | undefined;
511
576
  styleGuide?: {
@@ -528,6 +593,10 @@ export declare const REWRITE_TEXT_SEGMENT_BODY_SCHEMA: z.ZodEffects<z.ZodObject<
528
593
  description?: string | undefined;
529
594
  }[] | undefined;
530
595
  }[] | undefined;
596
+ translationExamples?: {
597
+ sourceValue: string;
598
+ translatedValue: string;
599
+ }[] | undefined;
531
600
  } | undefined;
532
601
  history?: {
533
602
  values: [string, ...string[]];
@@ -571,6 +640,7 @@ export declare const REWRITE_TEXT_ASYNC_BODY_SCHEMA: z.ZodEffects<z.ZodObject<z.
571
640
  }, {
572
641
  locale: z.ZodEffects<z.ZodString, string, string>;
573
642
  integration: z.ZodOptional<z.ZodNativeEnum<{
643
+ readonly FINETUNED_OPENAI: "FT-OpenAI";
574
644
  readonly CLAUDE: "Claude";
575
645
  readonly CHAT_GPT4: "ChatGPT-4";
576
646
  readonly GEMINI: "Gemini";
@@ -674,6 +744,16 @@ export declare const REWRITE_TEXT_ASYNC_BODY_SCHEMA: z.ZodEffects<z.ZodObject<z.
674
744
  }[] | undefined;
675
745
  }>, "many">>;
676
746
  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>;
747
+ translationExamples: z.ZodOptional<z.ZodArray<z.ZodObject<{
748
+ sourceValue: z.ZodString;
749
+ translatedValue: z.ZodString;
750
+ }, "strip", z.ZodTypeAny, {
751
+ sourceValue: string;
752
+ translatedValue: string;
753
+ }, {
754
+ sourceValue: string;
755
+ translatedValue: string;
756
+ }>, "many">>;
677
757
  }, "targetPluralForms">, "strip", z.ZodTypeAny, {
678
758
  description?: string | undefined;
679
759
  styleGuide?: {
@@ -696,6 +776,10 @@ export declare const REWRITE_TEXT_ASYNC_BODY_SCHEMA: z.ZodEffects<z.ZodObject<z.
696
776
  description?: string | undefined;
697
777
  }[] | undefined;
698
778
  }[] | undefined;
779
+ translationExamples?: {
780
+ sourceValue: string;
781
+ translatedValue: string;
782
+ }[] | undefined;
699
783
  }, {
700
784
  description?: string | undefined;
701
785
  styleGuide?: {
@@ -718,6 +802,10 @@ export declare const REWRITE_TEXT_ASYNC_BODY_SCHEMA: z.ZodEffects<z.ZodObject<z.
718
802
  description?: string | undefined;
719
803
  }[] | undefined;
720
804
  }[] | undefined;
805
+ translationExamples?: {
806
+ sourceValue: string;
807
+ translatedValue: string;
808
+ }[] | undefined;
721
809
  }>>;
722
810
  contentUnits: z.ZodEffects<z.ZodArray<z.ZodObject<{
723
811
  id: z.ZodString;
@@ -885,8 +973,12 @@ export declare const REWRITE_TEXT_ASYNC_BODY_SCHEMA: z.ZodEffects<z.ZodObject<z.
885
973
  description?: string | undefined;
886
974
  }[] | undefined;
887
975
  }[] | undefined;
976
+ translationExamples?: {
977
+ sourceValue: string;
978
+ translatedValue: string;
979
+ }[] | undefined;
888
980
  } | undefined;
889
- integration?: "Claude" | "ChatGPT-4" | "Gemini" | undefined;
981
+ integration?: "FT-OpenAI" | "Claude" | "ChatGPT-4" | "Gemini" | undefined;
890
982
  }, {
891
983
  originCorrelationId: string;
892
984
  ownerId: string;
@@ -942,8 +1034,12 @@ export declare const REWRITE_TEXT_ASYNC_BODY_SCHEMA: z.ZodEffects<z.ZodObject<z.
942
1034
  description?: string | undefined;
943
1035
  }[] | undefined;
944
1036
  }[] | undefined;
1037
+ translationExamples?: {
1038
+ sourceValue: string;
1039
+ translatedValue: string;
1040
+ }[] | undefined;
945
1041
  } | undefined;
946
- integration?: "Claude" | "ChatGPT-4" | "Gemini" | undefined;
1042
+ integration?: "FT-OpenAI" | "Claude" | "ChatGPT-4" | "Gemini" | undefined;
947
1043
  }>, {
948
1044
  originCorrelationId: string;
949
1045
  ownerId: string;
@@ -999,8 +1095,12 @@ export declare const REWRITE_TEXT_ASYNC_BODY_SCHEMA: z.ZodEffects<z.ZodObject<z.
999
1095
  description?: string | undefined;
1000
1096
  }[] | undefined;
1001
1097
  }[] | undefined;
1098
+ translationExamples?: {
1099
+ sourceValue: string;
1100
+ translatedValue: string;
1101
+ }[] | undefined;
1002
1102
  } | undefined;
1003
- integration?: "Claude" | "ChatGPT-4" | "Gemini" | undefined;
1103
+ integration?: "FT-OpenAI" | "Claude" | "ChatGPT-4" | "Gemini" | undefined;
1004
1104
  }, {
1005
1105
  originCorrelationId: string;
1006
1106
  ownerId: string;
@@ -1056,8 +1156,12 @@ export declare const REWRITE_TEXT_ASYNC_BODY_SCHEMA: z.ZodEffects<z.ZodObject<z.
1056
1156
  description?: string | undefined;
1057
1157
  }[] | undefined;
1058
1158
  }[] | undefined;
1159
+ translationExamples?: {
1160
+ sourceValue: string;
1161
+ translatedValue: string;
1162
+ }[] | undefined;
1059
1163
  } | undefined;
1060
- integration?: "Claude" | "ChatGPT-4" | "Gemini" | undefined;
1164
+ integration?: "FT-OpenAI" | "Claude" | "ChatGPT-4" | "Gemini" | undefined;
1061
1165
  }>;
1062
1166
  export declare const REWRITE_TEXT_ASYNC_HEADERS_SCHEMA: z.ZodObject<{
1063
1167
  'x-fake-processing': z.ZodOptional<z.ZodEffects<z.ZodBoolean, boolean, unknown>>;
@@ -20,7 +20,7 @@ exports.REWRITE_TEXT_SEGMENT_BODY_SCHEMA = zod_1.default
20
20
  .optional(),
21
21
  mode: zod_1.default
22
22
  .string()
23
- .toUpperCase()
23
+ .toLowerCase()
24
24
  .pipe(zod_1.default.nativeEnum(sharedSchemas_1.VariantsModeEnum))
25
25
  .describe('A specific way of how a new variant is generated. If `rephrase`, it simply gets reworded, if `shorten` - AI tries to also make the translation shorter.'),
26
26
  })
@@ -10,6 +10,10 @@ export declare const refineDifferentSourceAndTargetLang: readonly [(data: {
10
10
  sourceLocale: string;
11
11
  targetLocale: string;
12
12
  }) => boolean, "The sourceLocale and targetLocale must be different."];
13
+ export declare const refineHistoryIsPresent: readonly [(data: {
14
+ history?: HistoryEntry[];
15
+ mode: TranslateModeEnum;
16
+ }) => boolean | undefined, "History must be present for \"rephrase\" and \"shorten\" modes, and must contain at least one \"translate\" entry"];
13
17
  export declare const refineSingleSegmentSizeLimit: readonly [(data: {
14
18
  value?: string;
15
19
  sourceValue?: string;
@@ -46,6 +50,7 @@ export declare const SEGMENT_WARNINGS_SCHEMA: z.ZodArray<z.ZodObject<{
46
50
  }, {
47
51
  kind: "EDITED_NON_TRANSLATABLE_CONTENT" | "EDITED_ICU_PLURALS";
48
52
  }>, "many">;
53
+ export declare const CONTENT_UNIT_DESCRIPTION_MAX_LENGTH = 32768;
49
54
  export declare const CONTENT_ID_PROP_SCHEMA: z.ZodString;
50
55
  export declare const TRANSLATE_SEGMENT_SCHEMA: z.ZodObject<{
51
56
  id: z.ZodString;
@@ -264,21 +269,45 @@ export type RewriteContentUnit = z.infer<typeof REWRITE_CONTENT_UNIT_SCHEMA>;
264
269
  * Variant generation
265
270
  */
266
271
  export declare const VariantsModeEnum: {
267
- readonly REPHRASE: "REPHRASE";
268
- readonly SHORTEN: "SHORTEN";
272
+ readonly REPHRASE: "rephrase";
273
+ readonly SHORTEN: "shorten";
269
274
  };
270
275
  export type VariantsModeEnum = ObjectValues<typeof VariantsModeEnum>;
276
+ export declare const TranslateModeEnum: {
277
+ readonly REPHRASE: "rephrase";
278
+ readonly SHORTEN: "shorten";
279
+ readonly TRANSLATE: "translate";
280
+ };
281
+ export type TranslateModeEnum = ObjectValues<typeof TranslateModeEnum>;
271
282
  export declare const HISTORY_REQUEST_SCHEMA: z.ZodObject<{
272
283
  values: z.ZodArray<z.ZodString, "atleastone">;
273
284
  mode: z.ZodPipeline<z.ZodString, z.ZodNativeEnum<{
274
- readonly REPHRASE: "REPHRASE";
275
- readonly SHORTEN: "SHORTEN";
285
+ readonly REPHRASE: "rephrase";
286
+ readonly SHORTEN: "shorten";
276
287
  }>>;
277
288
  }, "strip", z.ZodTypeAny, {
278
289
  values: [string, ...string[]];
279
- mode: "REPHRASE" | "SHORTEN";
290
+ mode: "rephrase" | "shorten";
280
291
  }, {
281
292
  values: [string, ...string[]];
282
293
  mode: string;
283
294
  }>;
284
295
  export type History = z.infer<typeof HISTORY_REQUEST_SCHEMA>;
296
+ /**
297
+ * This is an updated version for history entry object, which will eventually replace HISTORY_REQUEST_SCHEMA
298
+ */
299
+ export declare const HISTORY_ENTRY_SCHEMA: z.ZodObject<{
300
+ mode: z.ZodNativeEnum<{
301
+ readonly REPHRASE: "rephrase";
302
+ readonly SHORTEN: "shorten";
303
+ readonly TRANSLATE: "translate";
304
+ }>;
305
+ value: z.ZodString;
306
+ }, "strip", z.ZodTypeAny, {
307
+ value: string;
308
+ mode: "rephrase" | "shorten" | "translate";
309
+ }, {
310
+ value: string;
311
+ mode: "rephrase" | "shorten" | "translate";
312
+ }>;
313
+ export type HistoryEntry = z.infer<typeof HISTORY_ENTRY_SCHEMA>;