@lokalise/polyglot-sdk 12.7.0 → 13.1.0

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 (41) hide show
  1. package/dist/index.d.ts +6 -6
  2. package/dist/index.js +10 -23
  3. package/dist/index.js.map +1 -1
  4. package/dist/sdk/PolyglotClient.d.ts +6 -6
  5. package/dist/sdk/PolyglotClient.js +8 -7
  6. package/dist/sdk/PolyglotClient.js.map +1 -1
  7. package/dist/sdk/schemas/common/asyncRequestSchemas.d.ts +6 -3
  8. package/dist/sdk/schemas/common/asyncRequestSchemas.js +5 -2
  9. package/dist/sdk/schemas/common/asyncRequestSchemas.js.map +1 -1
  10. package/dist/sdk/schemas/common/commonSchemas.d.ts +24 -0
  11. package/dist/sdk/schemas/common/commonSchemas.js +31 -1
  12. package/dist/sdk/schemas/common/commonSchemas.js.map +1 -1
  13. package/dist/sdk/schemas/common/errorSchemas.d.ts +85 -0
  14. package/dist/sdk/schemas/common/errorSchemas.js +29 -0
  15. package/dist/sdk/schemas/common/errorSchemas.js.map +1 -0
  16. package/dist/sdk/schemas/lqa/{lqaAsyncV1Schemas.d.ts → lqaAsyncSchemas.d.ts} +265 -11
  17. package/dist/sdk/schemas/lqa/{lqaAsyncV1Schemas.js → lqaAsyncSchemas.js} +14 -10
  18. package/dist/sdk/schemas/lqa/lqaAsyncSchemas.js.map +1 -0
  19. package/dist/sdk/schemas/lqa/lqaSyncV2Schemas.js +2 -2
  20. package/dist/sdk/schemas/lqa/lqaSyncV2Schemas.js.map +1 -1
  21. package/dist/sdk/schemas/translation/sharedSchemas.d.ts +154 -0
  22. package/dist/sdk/schemas/translation/sharedSchemas.js +32 -1
  23. package/dist/sdk/schemas/translation/sharedSchemas.js.map +1 -1
  24. package/dist/sdk/schemas/translation/{translateAsyncV2Schemas.d.ts → translateAsyncSchemas.d.ts} +404 -153
  25. package/dist/sdk/schemas/translation/translateAsyncSchemas.js +66 -0
  26. package/dist/sdk/schemas/translation/translateAsyncSchemas.js.map +1 -0
  27. package/dist/sdk/schemas/translation/{translateSyncV2Schemas.d.ts → translateSyncSchemas.d.ts} +157 -147
  28. package/dist/sdk/schemas/translation/translateSyncSchemas.js +46 -0
  29. package/dist/sdk/schemas/translation/translateSyncSchemas.js.map +1 -0
  30. package/dist/sdk/validation/isSegmentExceedingLengthLimit.d.ts +0 -1
  31. package/dist/sdk/validation/isSegmentExceedingLengthLimit.js +3 -3
  32. package/dist/sdk/validation/isSegmentExceedingLengthLimit.js.map +1 -1
  33. package/dist/sdk/validation/requestSizeLimit.d.ts +14 -0
  34. package/dist/sdk/validation/requestSizeLimit.js +36 -0
  35. package/dist/sdk/validation/requestSizeLimit.js.map +1 -0
  36. package/package.json +5 -5
  37. package/dist/sdk/schemas/lqa/lqaAsyncV1Schemas.js.map +0 -1
  38. package/dist/sdk/schemas/translation/translateAsyncV2Schemas.js +0 -85
  39. package/dist/sdk/schemas/translation/translateAsyncV2Schemas.js.map +0 -1
  40. package/dist/sdk/schemas/translation/translateSyncV2Schemas.js +0 -74
  41. package/dist/sdk/schemas/translation/translateSyncV2Schemas.js.map +0 -1
@@ -1,145 +1,7 @@
1
1
  import z from 'zod';
2
- export declare const TRANSLATE_ASYNC_V2_SEGMENT_SCHEMA: z.ZodObject<{
3
- id: z.ZodString;
4
- tmMatch: z.ZodOptional<z.ZodObject<{
5
- sourceValue: z.ZodString;
6
- translatedValue: z.ZodString;
7
- }, "strip", z.ZodTypeAny, {
8
- sourceValue: string;
9
- translatedValue: string;
10
- }, {
11
- sourceValue: string;
12
- translatedValue: string;
13
- }>>;
14
- value: z.ZodEffects<z.ZodString, string, string>;
15
- }, "strip", z.ZodTypeAny, {
16
- value: string;
17
- id: string;
18
- tmMatch?: {
19
- sourceValue: string;
20
- translatedValue: string;
21
- } | undefined;
22
- }, {
23
- value: string;
24
- id: string;
25
- tmMatch?: {
26
- sourceValue: string;
27
- translatedValue: string;
28
- } | undefined;
29
- }>;
30
- export declare const TRANSLATE_ASYNC_V2_CONTENT_UNIT_SCHEMA: z.ZodObject<{
31
- id: z.ZodString;
32
- context: z.ZodOptional<z.ZodObject<{
33
- description: z.ZodString;
34
- }, "strip", z.ZodTypeAny, {
35
- description: string;
36
- }, {
37
- description: string;
38
- }>>;
39
- characterLimit: z.ZodOptional<z.ZodNumber>;
40
- segments: z.ZodEffects<z.ZodArray<z.ZodObject<{
41
- id: z.ZodString;
42
- tmMatch: z.ZodOptional<z.ZodObject<{
43
- sourceValue: z.ZodString;
44
- translatedValue: z.ZodString;
45
- }, "strip", z.ZodTypeAny, {
46
- sourceValue: string;
47
- translatedValue: string;
48
- }, {
49
- sourceValue: string;
50
- translatedValue: string;
51
- }>>;
52
- value: z.ZodEffects<z.ZodString, string, string>;
53
- }, "strip", z.ZodTypeAny, {
54
- value: string;
55
- id: string;
56
- tmMatch?: {
57
- sourceValue: string;
58
- translatedValue: string;
59
- } | undefined;
60
- }, {
61
- value: string;
62
- id: string;
63
- tmMatch?: {
64
- sourceValue: string;
65
- translatedValue: string;
66
- } | undefined;
67
- }>, "atleastone">, [{
68
- value: string;
69
- id: string;
70
- tmMatch?: {
71
- sourceValue: string;
72
- translatedValue: string;
73
- } | undefined;
74
- }, ...{
75
- value: string;
76
- id: string;
77
- tmMatch?: {
78
- sourceValue: string;
79
- translatedValue: string;
80
- } | undefined;
81
- }[]], [{
82
- value: string;
83
- id: string;
84
- tmMatch?: {
85
- sourceValue: string;
86
- translatedValue: string;
87
- } | undefined;
88
- }, ...{
89
- value: string;
90
- id: string;
91
- tmMatch?: {
92
- sourceValue: string;
93
- translatedValue: string;
94
- } | undefined;
95
- }[]]>;
96
- }, "strip", z.ZodTypeAny, {
97
- id: string;
98
- segments: [{
99
- value: string;
100
- id: string;
101
- tmMatch?: {
102
- sourceValue: string;
103
- translatedValue: string;
104
- } | undefined;
105
- }, ...{
106
- value: string;
107
- id: string;
108
- tmMatch?: {
109
- sourceValue: string;
110
- translatedValue: string;
111
- } | undefined;
112
- }[]];
113
- context?: {
114
- description: string;
115
- } | undefined;
116
- characterLimit?: number | undefined;
117
- }, {
118
- id: string;
119
- segments: [{
120
- value: string;
121
- id: string;
122
- tmMatch?: {
123
- sourceValue: string;
124
- translatedValue: string;
125
- } | undefined;
126
- }, ...{
127
- value: string;
128
- id: string;
129
- tmMatch?: {
130
- sourceValue: string;
131
- translatedValue: string;
132
- } | undefined;
133
- }[]];
134
- context?: {
135
- description: string;
136
- } | undefined;
137
- characterLimit?: number | undefined;
138
- }>;
139
- export declare const TRANSLATE_ASYNC_V2_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<{
2
+ export declare const TRANSLATE_ASYNC_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<{
140
3
  originCorrelationId: z.ZodString;
141
4
  ownerId: z.ZodString;
142
- tenantId: z.ZodOptional<z.ZodString>;
143
5
  callbackUrl: z.ZodString;
144
6
  callbackToken: z.ZodString;
145
7
  }, {
@@ -322,7 +184,7 @@ export declare const TRANSLATE_ASYNC_V2_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z
322
184
  sourceValue: string;
323
185
  translatedValue: string;
324
186
  }>>;
325
- value: z.ZodEffects<z.ZodString, string, string>;
187
+ value: z.ZodString;
326
188
  }, "strip", z.ZodTypeAny, {
327
189
  value: string;
328
190
  id: string;
@@ -544,7 +406,6 @@ export declare const TRANSLATE_ASYNC_V2_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z
544
406
  }[]];
545
407
  targetLocale: string;
546
408
  pickIntegrationByScore: boolean;
547
- tenantId?: string | undefined;
548
409
  context?: {
549
410
  description?: string | undefined;
550
411
  styleGuide?: {
@@ -620,7 +481,6 @@ export declare const TRANSLATE_ASYNC_V2_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z
620
481
  characterLimit?: number | undefined;
621
482
  }[]];
622
483
  targetLocale: string;
623
- tenantId?: string | undefined;
624
484
  context?: {
625
485
  description?: string | undefined;
626
486
  styleGuide?: {
@@ -698,7 +558,6 @@ export declare const TRANSLATE_ASYNC_V2_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z
698
558
  }[]];
699
559
  targetLocale: string;
700
560
  pickIntegrationByScore: boolean;
701
- tenantId?: string | undefined;
702
561
  context?: {
703
562
  description?: string | undefined;
704
563
  styleGuide?: {
@@ -774,7 +633,6 @@ export declare const TRANSLATE_ASYNC_V2_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z
774
633
  characterLimit?: number | undefined;
775
634
  }[]];
776
635
  targetLocale: string;
777
- tenantId?: string | undefined;
778
636
  context?: {
779
637
  description?: string | undefined;
780
638
  styleGuide?: {
@@ -852,7 +710,6 @@ export declare const TRANSLATE_ASYNC_V2_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z
852
710
  }[]];
853
711
  targetLocale: string;
854
712
  pickIntegrationByScore: boolean;
855
- tenantId?: string | undefined;
856
713
  context?: {
857
714
  description?: string | undefined;
858
715
  styleGuide?: {
@@ -928,7 +785,158 @@ export declare const TRANSLATE_ASYNC_V2_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z
928
785
  characterLimit?: number | undefined;
929
786
  }[]];
930
787
  targetLocale: string;
931
- tenantId?: string | undefined;
788
+ context?: {
789
+ description?: string | undefined;
790
+ styleGuide?: {
791
+ targetAudience?: "general" | "technical" | "non-technical" | undefined;
792
+ toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
793
+ levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
794
+ generalRule?: "active-voice" | "passive-voice" | undefined;
795
+ } | {
796
+ text: string;
797
+ } | undefined;
798
+ glossary?: {
799
+ term: string;
800
+ description?: string | undefined;
801
+ translatable?: boolean | undefined;
802
+ forbidden?: boolean | undefined;
803
+ caseSensitive?: boolean | undefined;
804
+ translations?: {
805
+ locale: string;
806
+ translation: string;
807
+ description?: string | undefined;
808
+ }[] | undefined;
809
+ }[] | undefined;
810
+ targetPluralForms?: ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined;
811
+ } | undefined;
812
+ integration?: "Claude" | "ChatGPT-4" | "Gemini" | "DeepL" | "GoogleTranslate" | "MicrosoftTranslator" | undefined;
813
+ pickIntegrationByScore?: boolean | undefined;
814
+ }>, {
815
+ originCorrelationId: string;
816
+ ownerId: string;
817
+ callbackUrl: string;
818
+ callbackToken: string;
819
+ sourceLocale: string;
820
+ contentUnits: [{
821
+ id: string;
822
+ segments: [{
823
+ value: string;
824
+ id: string;
825
+ tmMatch?: {
826
+ sourceValue: string;
827
+ translatedValue: string;
828
+ } | undefined;
829
+ }, ...{
830
+ value: string;
831
+ id: string;
832
+ tmMatch?: {
833
+ sourceValue: string;
834
+ translatedValue: string;
835
+ } | undefined;
836
+ }[]];
837
+ context?: {
838
+ description: string;
839
+ } | undefined;
840
+ characterLimit?: number | undefined;
841
+ }, ...{
842
+ id: string;
843
+ segments: [{
844
+ value: string;
845
+ id: string;
846
+ tmMatch?: {
847
+ sourceValue: string;
848
+ translatedValue: string;
849
+ } | undefined;
850
+ }, ...{
851
+ value: string;
852
+ id: string;
853
+ tmMatch?: {
854
+ sourceValue: string;
855
+ translatedValue: string;
856
+ } | undefined;
857
+ }[]];
858
+ context?: {
859
+ description: string;
860
+ } | undefined;
861
+ characterLimit?: number | undefined;
862
+ }[]];
863
+ targetLocale: string;
864
+ pickIntegrationByScore: boolean;
865
+ context?: {
866
+ description?: string | undefined;
867
+ styleGuide?: {
868
+ targetAudience?: "general" | "technical" | "non-technical" | undefined;
869
+ toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
870
+ levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
871
+ generalRule?: "active-voice" | "passive-voice" | undefined;
872
+ } | {
873
+ text: string;
874
+ } | undefined;
875
+ glossary?: {
876
+ term: string;
877
+ translatable: boolean;
878
+ forbidden: boolean;
879
+ caseSensitive: boolean;
880
+ description?: string | undefined;
881
+ translations?: {
882
+ locale: string;
883
+ translation: string;
884
+ description?: string | undefined;
885
+ }[] | undefined;
886
+ }[] | undefined;
887
+ targetPluralForms?: ["many" | "zero" | "one" | "two" | "few" | "other", ...("many" | "zero" | "one" | "two" | "few" | "other")[]] | undefined;
888
+ } | undefined;
889
+ integration?: "Claude" | "ChatGPT-4" | "Gemini" | "DeepL" | "GoogleTranslate" | "MicrosoftTranslator" | undefined;
890
+ }, {
891
+ originCorrelationId: string;
892
+ ownerId: string;
893
+ callbackUrl: string;
894
+ callbackToken: string;
895
+ sourceLocale: string;
896
+ contentUnits: [{
897
+ id: string;
898
+ segments: [{
899
+ value: string;
900
+ id: string;
901
+ tmMatch?: {
902
+ sourceValue: string;
903
+ translatedValue: string;
904
+ } | undefined;
905
+ }, ...{
906
+ value: string;
907
+ id: string;
908
+ tmMatch?: {
909
+ sourceValue: string;
910
+ translatedValue: string;
911
+ } | undefined;
912
+ }[]];
913
+ context?: {
914
+ description: string;
915
+ } | undefined;
916
+ characterLimit?: number | undefined;
917
+ }, ...{
918
+ id: string;
919
+ segments: [{
920
+ value: string;
921
+ id: string;
922
+ tmMatch?: {
923
+ sourceValue: string;
924
+ translatedValue: string;
925
+ } | undefined;
926
+ }, ...{
927
+ value: string;
928
+ id: string;
929
+ tmMatch?: {
930
+ sourceValue: string;
931
+ translatedValue: string;
932
+ } | undefined;
933
+ }[]];
934
+ context?: {
935
+ description: string;
936
+ } | undefined;
937
+ characterLimit?: number | undefined;
938
+ }[]];
939
+ targetLocale: string;
932
940
  context?: {
933
941
  description?: string | undefined;
934
942
  styleGuide?: {
@@ -956,14 +964,14 @@ export declare const TRANSLATE_ASYNC_V2_BODY_SCHEMA: z.ZodEffects<z.ZodEffects<z
956
964
  integration?: "Claude" | "ChatGPT-4" | "Gemini" | "DeepL" | "GoogleTranslate" | "MicrosoftTranslator" | undefined;
957
965
  pickIntegrationByScore?: boolean | undefined;
958
966
  }>;
959
- export declare const TRANSLATE_ASYNC_V2_HEADERS_SCHEMA: z.ZodObject<{
967
+ export declare const TRANSLATE_ASYNC_HEADERS_SCHEMA: z.ZodObject<{
960
968
  'x-fake-processing': z.ZodOptional<z.ZodEffects<z.ZodBoolean, boolean, unknown>>;
961
969
  }, "strip", z.ZodTypeAny, {
962
970
  'x-fake-processing'?: boolean | undefined;
963
971
  }, {
964
972
  'x-fake-processing'?: unknown;
965
973
  }>;
966
- export declare const TRANSLATE_ASYNC_V2_RESPONSE_SCHEMA: z.ZodObject<{
974
+ export declare const TRANSLATE_ASYNC_RESPONSE_SCHEMA: z.ZodObject<{
967
975
  requestId: z.ZodString;
968
976
  expectedAt: z.ZodString;
969
977
  }, "strip", z.ZodTypeAny, {
@@ -1081,9 +1089,252 @@ export declare const TRANSLATE_ASYNC_V2_CALLBACK_SCHEMA: z.ZodObject<{
1081
1089
  details?: Record<string, unknown> | undefined;
1082
1090
  }[] | undefined;
1083
1091
  }>;
1084
- export type TranslateAsyncV2Body = z.infer<typeof TRANSLATE_ASYNC_V2_BODY_SCHEMA>;
1085
- export type TranslateAsyncV2Headers = z.infer<typeof TRANSLATE_ASYNC_V2_HEADERS_SCHEMA>;
1086
- export type TranslateAsyncV2Response = z.infer<typeof TRANSLATE_ASYNC_V2_RESPONSE_SCHEMA>;
1092
+ export declare const TRANSLATE_ASYNC_SUCCESS_SCHEMA: z.ZodObject<z.objectUtil.extendShape<{
1093
+ originCorrelationId: z.ZodString;
1094
+ data: z.ZodArray<z.ZodObject<{
1095
+ contentUnitId: z.ZodString;
1096
+ segmentId: z.ZodString;
1097
+ polyglotRefId: z.ZodString;
1098
+ integration: z.ZodString;
1099
+ translation: z.ZodString;
1100
+ score: z.ZodNullable<z.ZodNumber>;
1101
+ warnings: z.ZodOptional<z.ZodArray<z.ZodObject<{
1102
+ kind: z.ZodEnum<["EDITED_NON_TRANSLATABLE_CONTENT", "EDITED_ICU_PLURALS"]>;
1103
+ }, "strip", z.ZodTypeAny, {
1104
+ kind: "EDITED_NON_TRANSLATABLE_CONTENT" | "EDITED_ICU_PLURALS";
1105
+ }, {
1106
+ kind: "EDITED_NON_TRANSLATABLE_CONTENT" | "EDITED_ICU_PLURALS";
1107
+ }>, "many">>;
1108
+ }, "strip", z.ZodTypeAny, {
1109
+ translation: string;
1110
+ integration: string;
1111
+ contentUnitId: string;
1112
+ score: number | null;
1113
+ segmentId: string;
1114
+ polyglotRefId: string;
1115
+ warnings?: {
1116
+ kind: "EDITED_NON_TRANSLATABLE_CONTENT" | "EDITED_ICU_PLURALS";
1117
+ }[] | undefined;
1118
+ }, {
1119
+ translation: string;
1120
+ integration: string;
1121
+ contentUnitId: string;
1122
+ score: number | null;
1123
+ segmentId: string;
1124
+ polyglotRefId: string;
1125
+ warnings?: {
1126
+ kind: "EDITED_NON_TRANSLATABLE_CONTENT" | "EDITED_ICU_PLURALS";
1127
+ }[] | undefined;
1128
+ }>, "many">;
1129
+ errors: z.ZodOptional<z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
1130
+ message: z.ZodString;
1131
+ errorCode: z.ZodString;
1132
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1133
+ }, {
1134
+ contentUnitId: z.ZodString;
1135
+ segmentId: z.ZodString;
1136
+ polyglotRefId: z.ZodString;
1137
+ integration: z.ZodString;
1138
+ }>, "strip", z.ZodTypeAny, {
1139
+ message: string;
1140
+ errorCode: string;
1141
+ integration: string;
1142
+ contentUnitId: string;
1143
+ segmentId: string;
1144
+ polyglotRefId: string;
1145
+ details?: Record<string, unknown> | undefined;
1146
+ }, {
1147
+ message: string;
1148
+ errorCode: string;
1149
+ integration: string;
1150
+ contentUnitId: string;
1151
+ segmentId: string;
1152
+ polyglotRefId: string;
1153
+ details?: Record<string, unknown> | undefined;
1154
+ }>, "many">>;
1155
+ }, {
1156
+ status: z.ZodLiteral<"success">;
1157
+ }>, "strip", z.ZodTypeAny, {
1158
+ originCorrelationId: string;
1159
+ status: "success";
1160
+ data: {
1161
+ translation: string;
1162
+ integration: string;
1163
+ contentUnitId: string;
1164
+ score: number | null;
1165
+ segmentId: string;
1166
+ polyglotRefId: string;
1167
+ warnings?: {
1168
+ kind: "EDITED_NON_TRANSLATABLE_CONTENT" | "EDITED_ICU_PLURALS";
1169
+ }[] | undefined;
1170
+ }[];
1171
+ errors?: {
1172
+ message: string;
1173
+ errorCode: string;
1174
+ integration: string;
1175
+ contentUnitId: string;
1176
+ segmentId: string;
1177
+ polyglotRefId: string;
1178
+ details?: Record<string, unknown> | undefined;
1179
+ }[] | undefined;
1180
+ }, {
1181
+ originCorrelationId: string;
1182
+ status: "success";
1183
+ data: {
1184
+ translation: string;
1185
+ integration: string;
1186
+ contentUnitId: string;
1187
+ score: number | null;
1188
+ segmentId: string;
1189
+ polyglotRefId: string;
1190
+ warnings?: {
1191
+ kind: "EDITED_NON_TRANSLATABLE_CONTENT" | "EDITED_ICU_PLURALS";
1192
+ }[] | undefined;
1193
+ }[];
1194
+ errors?: {
1195
+ message: string;
1196
+ errorCode: string;
1197
+ integration: string;
1198
+ contentUnitId: string;
1199
+ segmentId: string;
1200
+ polyglotRefId: string;
1201
+ details?: Record<string, unknown> | undefined;
1202
+ }[] | undefined;
1203
+ }>;
1204
+ export declare const TRANSLATE_ASYNC_CALLBACK_SCHEMA: z.ZodDiscriminatedUnion<"status", [z.ZodObject<z.objectUtil.extendShape<{
1205
+ originCorrelationId: z.ZodString;
1206
+ data: z.ZodArray<z.ZodObject<{
1207
+ contentUnitId: z.ZodString;
1208
+ segmentId: z.ZodString;
1209
+ polyglotRefId: z.ZodString;
1210
+ integration: z.ZodString;
1211
+ translation: z.ZodString;
1212
+ score: z.ZodNullable<z.ZodNumber>;
1213
+ warnings: z.ZodOptional<z.ZodArray<z.ZodObject<{
1214
+ kind: z.ZodEnum<["EDITED_NON_TRANSLATABLE_CONTENT", "EDITED_ICU_PLURALS"]>;
1215
+ }, "strip", z.ZodTypeAny, {
1216
+ kind: "EDITED_NON_TRANSLATABLE_CONTENT" | "EDITED_ICU_PLURALS";
1217
+ }, {
1218
+ kind: "EDITED_NON_TRANSLATABLE_CONTENT" | "EDITED_ICU_PLURALS";
1219
+ }>, "many">>;
1220
+ }, "strip", z.ZodTypeAny, {
1221
+ translation: string;
1222
+ integration: string;
1223
+ contentUnitId: string;
1224
+ score: number | null;
1225
+ segmentId: string;
1226
+ polyglotRefId: string;
1227
+ warnings?: {
1228
+ kind: "EDITED_NON_TRANSLATABLE_CONTENT" | "EDITED_ICU_PLURALS";
1229
+ }[] | undefined;
1230
+ }, {
1231
+ translation: string;
1232
+ integration: string;
1233
+ contentUnitId: string;
1234
+ score: number | null;
1235
+ segmentId: string;
1236
+ polyglotRefId: string;
1237
+ warnings?: {
1238
+ kind: "EDITED_NON_TRANSLATABLE_CONTENT" | "EDITED_ICU_PLURALS";
1239
+ }[] | undefined;
1240
+ }>, "many">;
1241
+ errors: z.ZodOptional<z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
1242
+ message: z.ZodString;
1243
+ errorCode: z.ZodString;
1244
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1245
+ }, {
1246
+ contentUnitId: z.ZodString;
1247
+ segmentId: z.ZodString;
1248
+ polyglotRefId: z.ZodString;
1249
+ integration: z.ZodString;
1250
+ }>, "strip", z.ZodTypeAny, {
1251
+ message: string;
1252
+ errorCode: string;
1253
+ integration: string;
1254
+ contentUnitId: string;
1255
+ segmentId: string;
1256
+ polyglotRefId: string;
1257
+ details?: Record<string, unknown> | undefined;
1258
+ }, {
1259
+ message: string;
1260
+ errorCode: string;
1261
+ integration: string;
1262
+ contentUnitId: string;
1263
+ segmentId: string;
1264
+ polyglotRefId: string;
1265
+ details?: Record<string, unknown> | undefined;
1266
+ }>, "many">>;
1267
+ }, {
1268
+ status: z.ZodLiteral<"success">;
1269
+ }>, "strip", z.ZodTypeAny, {
1270
+ originCorrelationId: string;
1271
+ status: "success";
1272
+ data: {
1273
+ translation: string;
1274
+ integration: string;
1275
+ contentUnitId: string;
1276
+ score: number | null;
1277
+ segmentId: string;
1278
+ polyglotRefId: string;
1279
+ warnings?: {
1280
+ kind: "EDITED_NON_TRANSLATABLE_CONTENT" | "EDITED_ICU_PLURALS";
1281
+ }[] | undefined;
1282
+ }[];
1283
+ errors?: {
1284
+ message: string;
1285
+ errorCode: string;
1286
+ integration: string;
1287
+ contentUnitId: string;
1288
+ segmentId: string;
1289
+ polyglotRefId: string;
1290
+ details?: Record<string, unknown> | undefined;
1291
+ }[] | undefined;
1292
+ }, {
1293
+ originCorrelationId: string;
1294
+ status: "success";
1295
+ data: {
1296
+ translation: string;
1297
+ integration: string;
1298
+ contentUnitId: string;
1299
+ score: number | null;
1300
+ segmentId: string;
1301
+ polyglotRefId: string;
1302
+ warnings?: {
1303
+ kind: "EDITED_NON_TRANSLATABLE_CONTENT" | "EDITED_ICU_PLURALS";
1304
+ }[] | undefined;
1305
+ }[];
1306
+ errors?: {
1307
+ message: string;
1308
+ errorCode: string;
1309
+ integration: string;
1310
+ contentUnitId: string;
1311
+ segmentId: string;
1312
+ polyglotRefId: string;
1313
+ details?: Record<string, unknown> | undefined;
1314
+ }[] | undefined;
1315
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1316
+ message: z.ZodString;
1317
+ errorCode: z.ZodString;
1318
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1319
+ }, {
1320
+ status: z.ZodLiteral<"error">;
1321
+ originCorrelationId: z.ZodString;
1322
+ }>, "strip", z.ZodTypeAny, {
1323
+ originCorrelationId: string;
1324
+ message: string;
1325
+ status: "error";
1326
+ errorCode: string;
1327
+ details?: Record<string, unknown> | undefined;
1328
+ }, {
1329
+ originCorrelationId: string;
1330
+ message: string;
1331
+ status: "error";
1332
+ errorCode: string;
1333
+ details?: Record<string, unknown> | undefined;
1334
+ }>]>;
1335
+ export type TranslateAsyncBody = z.infer<typeof TRANSLATE_ASYNC_BODY_SCHEMA>;
1336
+ export type TranslateAsyncHeaders = z.infer<typeof TRANSLATE_ASYNC_HEADERS_SCHEMA>;
1337
+ export type TranslateAsyncResponse = z.infer<typeof TRANSLATE_ASYNC_RESPONSE_SCHEMA>;
1087
1338
  export type TranslateAsyncV2Callback = z.infer<typeof TRANSLATE_ASYNC_V2_CALLBACK_SCHEMA>;
1088
- export type TranslateAsyncV2ContentUnit = z.infer<typeof TRANSLATE_ASYNC_V2_CONTENT_UNIT_SCHEMA>;
1089
- export type TranslateAsyncV2Segment = z.infer<typeof TRANSLATE_ASYNC_V2_SEGMENT_SCHEMA>;
1339
+ export type TranslateAsyncSuccess = z.infer<typeof TRANSLATE_ASYNC_SUCCESS_SCHEMA>;
1340
+ export type TranslateAsyncCallback = z.infer<typeof TRANSLATE_ASYNC_CALLBACK_SCHEMA>;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TRANSLATE_ASYNC_CALLBACK_SCHEMA = exports.TRANSLATE_ASYNC_SUCCESS_SCHEMA = exports.TRANSLATE_ASYNC_V2_CALLBACK_SCHEMA = exports.TRANSLATE_ASYNC_RESPONSE_SCHEMA = exports.TRANSLATE_ASYNC_HEADERS_SCHEMA = exports.TRANSLATE_ASYNC_BODY_SCHEMA = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const zod_1 = tslib_1.__importDefault(require("zod"));
6
+ const asyncRequestSchemas_1 = require("../common/asyncRequestSchemas");
7
+ const commonSchemas_1 = require("../common/commonSchemas");
8
+ const translationContextSchemas_1 = require("../common/translationContextSchemas");
9
+ const sharedSchemas_1 = require("./sharedSchemas");
10
+ const CONTENT_UNITS_MAX_LENGTH = 50;
11
+ exports.TRANSLATE_ASYNC_BODY_SCHEMA = asyncRequestSchemas_1.ASYNC_REQUEST_SCHEMA.extend({
12
+ sourceLocale: commonSchemas_1.LOCALE_SCHEMA,
13
+ targetLocale: commonSchemas_1.LOCALE_SCHEMA,
14
+ integration: commonSchemas_1.REAL_INTEGRATION_ENGINE_SCHEMA.optional(),
15
+ pickIntegrationByScore: zod_1.default.boolean().default(false),
16
+ context: translationContextSchemas_1.TRANSLATION_CONTEXT_SCHEMA.optional(),
17
+ contentUnits: zod_1.default
18
+ .array(sharedSchemas_1.TRANSLATE_CONTENT_UNIT_SCHEMA)
19
+ .nonempty()
20
+ .max(CONTENT_UNITS_MAX_LENGTH)
21
+ .refine(...sharedSchemas_1.refineUniqueIds),
22
+ })
23
+ .refine(...sharedSchemas_1.refineDifferentSourceAndTargetLang)
24
+ .refine(...sharedSchemas_1.refineRequestSizeLimit)
25
+ .refine((data) => {
26
+ return !(data.integration && data.pickIntegrationByScore);
27
+ }, 'Forced integration cannot be specified when "pickIntegrationByScore" is enabled.');
28
+ exports.TRANSLATE_ASYNC_HEADERS_SCHEMA = commonSchemas_1.COMMON_REQUEST_HEADERS_SCHEMA;
29
+ exports.TRANSLATE_ASYNC_RESPONSE_SCHEMA = zod_1.default
30
+ .object({
31
+ requestId: zod_1.default.string().uuid(),
32
+ expectedAt: zod_1.default.string().datetime(),
33
+ })
34
+ .describe('Accepted for processing. Await the callback for the results.');
35
+ exports.TRANSLATE_ASYNC_V2_CALLBACK_SCHEMA = zod_1.default
36
+ .object({
37
+ originCorrelationId: zod_1.default.string(),
38
+ data: zod_1.default.array(zod_1.default.object({
39
+ contentUnitId: sharedSchemas_1.CONTENT_ID_PROP_SCHEMA,
40
+ segmentId: sharedSchemas_1.CONTENT_ID_PROP_SCHEMA,
41
+ polyglotRefId: zod_1.default.string(),
42
+ integration: zod_1.default.string(),
43
+ translation: zod_1.default.string(),
44
+ score: zod_1.default.number().nullable(),
45
+ warnings: sharedSchemas_1.SEGMENT_WARNINGS_SCHEMA.optional(),
46
+ })),
47
+ errors: zod_1.default
48
+ .array(commonSchemas_1.COMMON_ERROR_RESPONSE_SCHEMA.extend({
49
+ contentUnitId: sharedSchemas_1.CONTENT_ID_PROP_SCHEMA,
50
+ segmentId: sharedSchemas_1.CONTENT_ID_PROP_SCHEMA,
51
+ polyglotRefId: zod_1.default.string(),
52
+ integration: zod_1.default.string(),
53
+ }))
54
+ .optional(),
55
+ })
56
+ .describe('Callback with results.');
57
+ exports.TRANSLATE_ASYNC_SUCCESS_SCHEMA = exports.TRANSLATE_ASYNC_V2_CALLBACK_SCHEMA.extend({
58
+ status: zod_1.default.literal(asyncRequestSchemas_1.AsyncRequestCallbackStatusEnum.SUCCESS),
59
+ });
60
+ exports.TRANSLATE_ASYNC_CALLBACK_SCHEMA = zod_1.default
61
+ .discriminatedUnion('status', [
62
+ exports.TRANSLATE_ASYNC_SUCCESS_SCHEMA,
63
+ commonSchemas_1.COMMON_FAILED_OPERATION_CALLBACK_SCHEMA,
64
+ ])
65
+ .describe('Callback with results.');
66
+ //# sourceMappingURL=translateAsyncSchemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translateAsyncSchemas.js","sourceRoot":"","sources":["../../../../src/sdk/schemas/translation/translateAsyncSchemas.ts"],"names":[],"mappings":";;;;AAAA,sDAAmB;AACnB,uEAAoG;AACpG,2DAMgC;AAChC,mFAAgF;AAChF,mDAOwB;AAExB,MAAM,wBAAwB,GAAG,EAAE,CAAA;AAEtB,QAAA,2BAA2B,GAAG,0CAAoB,CAAC,MAAM,CAAC;IACrE,YAAY,EAAE,6BAAa;IAC3B,YAAY,EAAE,6BAAa;IAC3B,WAAW,EAAE,8CAA8B,CAAC,QAAQ,EAAE;IACtD,sBAAsB,EAAE,aAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAClD,OAAO,EAAE,sDAA0B,CAAC,QAAQ,EAAE;IAC9C,YAAY,EAAE,aAAC;SACZ,KAAK,CAAC,6CAA6B,CAAC;SACpC,QAAQ,EAAE;SACV,GAAG,CAAC,wBAAwB,CAAC;SAC7B,MAAM,CAAC,GAAG,+BAAe,CAAC;CAC9B,CAAC;KACC,MAAM,CAAC,GAAG,kDAAkC,CAAC;KAC7C,MAAM,CAAC,GAAG,sCAAsB,CAAC;KACjC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;IACf,OAAO,CAAC,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAA;AAC3D,CAAC,EAAE,kFAAkF,CAAC,CAAA;AAE3E,QAAA,8BAA8B,GAAG,6CAA6B,CAAA;AAE9D,QAAA,+BAA+B,GAAG,aAAC;KAC7C,MAAM,CAAC;IACN,SAAS,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC5B,UAAU,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC;KACD,QAAQ,CAAC,8DAA8D,CAAC,CAAA;AAE9D,QAAA,kCAAkC,GAAG,aAAC;KAChD,MAAM,CAAC;IACN,mBAAmB,EAAE,aAAC,CAAC,MAAM,EAAE;IAC/B,IAAI,EAAE,aAAC,CAAC,KAAK,CACX,aAAC,CAAC,MAAM,CAAC;QACP,aAAa,EAAE,sCAAsB;QACrC,SAAS,EAAE,sCAAsB;QACjC,aAAa,EAAE,aAAC,CAAC,MAAM,EAAE;QACzB,WAAW,EAAE,aAAC,CAAC,MAAM,EAAE;QACvB,WAAW,EAAE,aAAC,CAAC,MAAM,EAAE;QACvB,KAAK,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC5B,QAAQ,EAAE,uCAAuB,CAAC,QAAQ,EAAE;KAC7C,CAAC,CACH;IACD,MAAM,EAAE,aAAC;SACN,KAAK,CACJ,4CAA4B,CAAC,MAAM,CAAC;QAClC,aAAa,EAAE,sCAAsB;QACrC,SAAS,EAAE,sCAAsB;QACjC,aAAa,EAAE,aAAC,CAAC,MAAM,EAAE;QACzB,WAAW,EAAE,aAAC,CAAC,MAAM,EAAE;KACxB,CAAC,CACH;SACA,QAAQ,EAAE;CACd,CAAC;KACD,QAAQ,CAAC,wBAAwB,CAAC,CAAA;AAExB,QAAA,8BAA8B,GAAG,0CAAkC,CAAC,MAAM,CAAC;IACtF,MAAM,EAAE,aAAC,CAAC,OAAO,CAAC,oDAA8B,CAAC,OAAO,CAAC;CAC1D,CAAC,CAAA;AAEW,QAAA,+BAA+B,GAAG,aAAC;KAC7C,kBAAkB,CAAC,QAAQ,EAAE;IAC5B,sCAA8B;IAC9B,uDAAuC;CACxC,CAAC;KACD,QAAQ,CAAC,wBAAwB,CAAC,CAAA"}