@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.
- package/dist/index.d.ts +6 -6
- package/dist/index.js +10 -23
- package/dist/index.js.map +1 -1
- package/dist/sdk/PolyglotClient.d.ts +6 -6
- package/dist/sdk/PolyglotClient.js +8 -7
- package/dist/sdk/PolyglotClient.js.map +1 -1
- package/dist/sdk/schemas/common/asyncRequestSchemas.d.ts +6 -3
- package/dist/sdk/schemas/common/asyncRequestSchemas.js +5 -2
- package/dist/sdk/schemas/common/asyncRequestSchemas.js.map +1 -1
- package/dist/sdk/schemas/common/commonSchemas.d.ts +24 -0
- package/dist/sdk/schemas/common/commonSchemas.js +31 -1
- package/dist/sdk/schemas/common/commonSchemas.js.map +1 -1
- package/dist/sdk/schemas/common/errorSchemas.d.ts +85 -0
- package/dist/sdk/schemas/common/errorSchemas.js +29 -0
- package/dist/sdk/schemas/common/errorSchemas.js.map +1 -0
- package/dist/sdk/schemas/lqa/{lqaAsyncV1Schemas.d.ts → lqaAsyncSchemas.d.ts} +265 -11
- package/dist/sdk/schemas/lqa/{lqaAsyncV1Schemas.js → lqaAsyncSchemas.js} +14 -10
- package/dist/sdk/schemas/lqa/lqaAsyncSchemas.js.map +1 -0
- package/dist/sdk/schemas/lqa/lqaSyncV2Schemas.js +2 -2
- package/dist/sdk/schemas/lqa/lqaSyncV2Schemas.js.map +1 -1
- package/dist/sdk/schemas/translation/sharedSchemas.d.ts +154 -0
- package/dist/sdk/schemas/translation/sharedSchemas.js +32 -1
- package/dist/sdk/schemas/translation/sharedSchemas.js.map +1 -1
- package/dist/sdk/schemas/translation/{translateAsyncV2Schemas.d.ts → translateAsyncSchemas.d.ts} +404 -153
- package/dist/sdk/schemas/translation/translateAsyncSchemas.js +66 -0
- package/dist/sdk/schemas/translation/translateAsyncSchemas.js.map +1 -0
- package/dist/sdk/schemas/translation/{translateSyncV2Schemas.d.ts → translateSyncSchemas.d.ts} +157 -147
- package/dist/sdk/schemas/translation/translateSyncSchemas.js +46 -0
- package/dist/sdk/schemas/translation/translateSyncSchemas.js.map +1 -0
- package/dist/sdk/validation/isSegmentExceedingLengthLimit.d.ts +0 -1
- package/dist/sdk/validation/isSegmentExceedingLengthLimit.js +3 -3
- package/dist/sdk/validation/isSegmentExceedingLengthLimit.js.map +1 -1
- package/dist/sdk/validation/requestSizeLimit.d.ts +14 -0
- package/dist/sdk/validation/requestSizeLimit.js +36 -0
- package/dist/sdk/validation/requestSizeLimit.js.map +1 -0
- package/package.json +5 -5
- package/dist/sdk/schemas/lqa/lqaAsyncV1Schemas.js.map +0 -1
- package/dist/sdk/schemas/translation/translateAsyncV2Schemas.js +0 -85
- package/dist/sdk/schemas/translation/translateAsyncV2Schemas.js.map +0 -1
- package/dist/sdk/schemas/translation/translateSyncV2Schemas.js +0 -74
- package/dist/sdk/schemas/translation/translateSyncV2Schemas.js.map +0 -1
|
@@ -196,10 +196,9 @@ declare const LQA_CONTENT_UNIT_SCHEMA: z.ZodObject<{
|
|
|
196
196
|
} | undefined;
|
|
197
197
|
characterLimit?: number | undefined;
|
|
198
198
|
}>;
|
|
199
|
-
export declare const
|
|
199
|
+
export declare const LQA_ASYNC_BODY_SCHEMA: z.ZodObject<z.objectUtil.extendShape<{
|
|
200
200
|
originCorrelationId: z.ZodString;
|
|
201
201
|
ownerId: z.ZodString;
|
|
202
|
-
tenantId: z.ZodOptional<z.ZodString>;
|
|
203
202
|
callbackUrl: z.ZodString;
|
|
204
203
|
callbackToken: z.ZodString;
|
|
205
204
|
}, {
|
|
@@ -577,7 +576,6 @@ export declare const LQA_ASYNC_V1_BODY_SCHEMA: z.ZodObject<z.objectUtil.extendSh
|
|
|
577
576
|
} | undefined;
|
|
578
577
|
characterLimit?: number | undefined;
|
|
579
578
|
}[]];
|
|
580
|
-
tenantId?: string | undefined;
|
|
581
579
|
context?: {
|
|
582
580
|
description?: string | undefined;
|
|
583
581
|
styleGuide?: {
|
|
@@ -684,7 +682,6 @@ export declare const LQA_ASYNC_V1_BODY_SCHEMA: z.ZodObject<z.objectUtil.extendSh
|
|
|
684
682
|
} | undefined;
|
|
685
683
|
characterLimit?: number | undefined;
|
|
686
684
|
}[]];
|
|
687
|
-
tenantId?: string | undefined;
|
|
688
685
|
context?: {
|
|
689
686
|
description?: string | undefined;
|
|
690
687
|
styleGuide?: {
|
|
@@ -711,14 +708,14 @@ export declare const LQA_ASYNC_V1_BODY_SCHEMA: z.ZodObject<z.objectUtil.extendSh
|
|
|
711
708
|
} | undefined;
|
|
712
709
|
integration?: "Claude" | "ChatGPT-4" | "Gemini" | undefined;
|
|
713
710
|
}>;
|
|
714
|
-
export declare const
|
|
711
|
+
export declare const LQA_ASYNC_HEADERS_SCHEMA: z.ZodObject<{
|
|
715
712
|
'x-fake-processing': z.ZodOptional<z.ZodEffects<z.ZodBoolean, boolean, unknown>>;
|
|
716
713
|
}, "strip", z.ZodTypeAny, {
|
|
717
714
|
'x-fake-processing'?: boolean | undefined;
|
|
718
715
|
}, {
|
|
719
716
|
'x-fake-processing'?: unknown;
|
|
720
717
|
}>;
|
|
721
|
-
export declare const
|
|
718
|
+
export declare const LQA_ASYNC_RESPONSE_SCHEMA: z.ZodObject<{
|
|
722
719
|
requestId: z.ZodString;
|
|
723
720
|
expectedAt: z.ZodString;
|
|
724
721
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -842,10 +839,267 @@ export declare const LQA_ASYNC_V1_CALLBACK_SCHEMA: z.ZodObject<{
|
|
|
842
839
|
details?: Record<string, unknown> | undefined;
|
|
843
840
|
}[] | undefined;
|
|
844
841
|
}>;
|
|
845
|
-
export
|
|
846
|
-
|
|
847
|
-
|
|
842
|
+
export declare const LQA_ASYNC_SUCCESS_SCHEMA: z.ZodObject<z.objectUtil.extendShape<{
|
|
843
|
+
originCorrelationId: z.ZodString;
|
|
844
|
+
data: z.ZodArray<z.ZodObject<{
|
|
845
|
+
contentUnitId: z.ZodString;
|
|
846
|
+
translationId: z.ZodString;
|
|
847
|
+
suggestion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
848
|
+
issues: z.ZodArray<z.ZodObject<{
|
|
849
|
+
category: z.ZodNativeEnum<{
|
|
850
|
+
readonly ACCURACY: "accuracy";
|
|
851
|
+
readonly FLUENCY: "fluency";
|
|
852
|
+
readonly TERMINOLOGY: "terminology";
|
|
853
|
+
readonly LOCALE_CONVENTION: "locale convention";
|
|
854
|
+
readonly STYLE: "style";
|
|
855
|
+
readonly CONSISTENCY: "consistency";
|
|
856
|
+
readonly COHERENCE: "coherence";
|
|
857
|
+
readonly DESIGN: "design";
|
|
858
|
+
readonly MARKUP: "markup";
|
|
859
|
+
readonly INTERNATIONALIZATION: "internationalization";
|
|
860
|
+
readonly VERITY: "verity";
|
|
861
|
+
}>;
|
|
862
|
+
severity: z.ZodNativeEnum<{
|
|
863
|
+
readonly NEUTRAL: "neutral";
|
|
864
|
+
readonly MINOR: "minor";
|
|
865
|
+
readonly MAJOR: "major";
|
|
866
|
+
readonly CRITICAL: "critical";
|
|
867
|
+
}>;
|
|
868
|
+
comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
869
|
+
}, "strip", z.ZodTypeAny, {
|
|
870
|
+
category: "accuracy" | "fluency" | "terminology" | "locale convention" | "style" | "consistency" | "coherence" | "design" | "markup" | "internationalization" | "verity";
|
|
871
|
+
severity: "neutral" | "minor" | "major" | "critical";
|
|
872
|
+
comment?: string | null | undefined;
|
|
873
|
+
}, {
|
|
874
|
+
category: "accuracy" | "fluency" | "terminology" | "locale convention" | "style" | "consistency" | "coherence" | "design" | "markup" | "internationalization" | "verity";
|
|
875
|
+
severity: "neutral" | "minor" | "major" | "critical";
|
|
876
|
+
comment?: string | null | undefined;
|
|
877
|
+
}>, "many">;
|
|
878
|
+
}, "strip", z.ZodTypeAny, {
|
|
879
|
+
contentUnitId: string;
|
|
880
|
+
translationId: string;
|
|
881
|
+
issues: {
|
|
882
|
+
category: "accuracy" | "fluency" | "terminology" | "locale convention" | "style" | "consistency" | "coherence" | "design" | "markup" | "internationalization" | "verity";
|
|
883
|
+
severity: "neutral" | "minor" | "major" | "critical";
|
|
884
|
+
comment?: string | null | undefined;
|
|
885
|
+
}[];
|
|
886
|
+
suggestion?: string | null | undefined;
|
|
887
|
+
}, {
|
|
888
|
+
contentUnitId: string;
|
|
889
|
+
translationId: string;
|
|
890
|
+
issues: {
|
|
891
|
+
category: "accuracy" | "fluency" | "terminology" | "locale convention" | "style" | "consistency" | "coherence" | "design" | "markup" | "internationalization" | "verity";
|
|
892
|
+
severity: "neutral" | "minor" | "major" | "critical";
|
|
893
|
+
comment?: string | null | undefined;
|
|
894
|
+
}[];
|
|
895
|
+
suggestion?: string | null | undefined;
|
|
896
|
+
}>, "many">;
|
|
897
|
+
errors: z.ZodOptional<z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
|
|
898
|
+
message: z.ZodString;
|
|
899
|
+
errorCode: z.ZodString;
|
|
900
|
+
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
901
|
+
}, {
|
|
902
|
+
contentUnitId: z.ZodString;
|
|
903
|
+
translationId: z.ZodString;
|
|
904
|
+
}>, "strip", z.ZodTypeAny, {
|
|
905
|
+
message: string;
|
|
906
|
+
errorCode: string;
|
|
907
|
+
contentUnitId: string;
|
|
908
|
+
translationId: string;
|
|
909
|
+
details?: Record<string, unknown> | undefined;
|
|
910
|
+
}, {
|
|
911
|
+
message: string;
|
|
912
|
+
errorCode: string;
|
|
913
|
+
contentUnitId: string;
|
|
914
|
+
translationId: string;
|
|
915
|
+
details?: Record<string, unknown> | undefined;
|
|
916
|
+
}>, "many">>;
|
|
917
|
+
}, {
|
|
918
|
+
status: z.ZodLiteral<"success">;
|
|
919
|
+
}>, "strip", z.ZodTypeAny, {
|
|
920
|
+
originCorrelationId: string;
|
|
921
|
+
status: "success";
|
|
922
|
+
data: {
|
|
923
|
+
contentUnitId: string;
|
|
924
|
+
translationId: string;
|
|
925
|
+
issues: {
|
|
926
|
+
category: "accuracy" | "fluency" | "terminology" | "locale convention" | "style" | "consistency" | "coherence" | "design" | "markup" | "internationalization" | "verity";
|
|
927
|
+
severity: "neutral" | "minor" | "major" | "critical";
|
|
928
|
+
comment?: string | null | undefined;
|
|
929
|
+
}[];
|
|
930
|
+
suggestion?: string | null | undefined;
|
|
931
|
+
}[];
|
|
932
|
+
errors?: {
|
|
933
|
+
message: string;
|
|
934
|
+
errorCode: string;
|
|
935
|
+
contentUnitId: string;
|
|
936
|
+
translationId: string;
|
|
937
|
+
details?: Record<string, unknown> | undefined;
|
|
938
|
+
}[] | undefined;
|
|
939
|
+
}, {
|
|
940
|
+
originCorrelationId: string;
|
|
941
|
+
status: "success";
|
|
942
|
+
data: {
|
|
943
|
+
contentUnitId: string;
|
|
944
|
+
translationId: string;
|
|
945
|
+
issues: {
|
|
946
|
+
category: "accuracy" | "fluency" | "terminology" | "locale convention" | "style" | "consistency" | "coherence" | "design" | "markup" | "internationalization" | "verity";
|
|
947
|
+
severity: "neutral" | "minor" | "major" | "critical";
|
|
948
|
+
comment?: string | null | undefined;
|
|
949
|
+
}[];
|
|
950
|
+
suggestion?: string | null | undefined;
|
|
951
|
+
}[];
|
|
952
|
+
errors?: {
|
|
953
|
+
message: string;
|
|
954
|
+
errorCode: string;
|
|
955
|
+
contentUnitId: string;
|
|
956
|
+
translationId: string;
|
|
957
|
+
details?: Record<string, unknown> | undefined;
|
|
958
|
+
}[] | undefined;
|
|
959
|
+
}>;
|
|
960
|
+
export declare const LQA_ASYNC_CALLBACK_SCHEMA: z.ZodDiscriminatedUnion<"status", [z.ZodObject<z.objectUtil.extendShape<{
|
|
961
|
+
originCorrelationId: z.ZodString;
|
|
962
|
+
data: z.ZodArray<z.ZodObject<{
|
|
963
|
+
contentUnitId: z.ZodString;
|
|
964
|
+
translationId: z.ZodString;
|
|
965
|
+
suggestion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
966
|
+
issues: z.ZodArray<z.ZodObject<{
|
|
967
|
+
category: z.ZodNativeEnum<{
|
|
968
|
+
readonly ACCURACY: "accuracy";
|
|
969
|
+
readonly FLUENCY: "fluency";
|
|
970
|
+
readonly TERMINOLOGY: "terminology";
|
|
971
|
+
readonly LOCALE_CONVENTION: "locale convention";
|
|
972
|
+
readonly STYLE: "style";
|
|
973
|
+
readonly CONSISTENCY: "consistency";
|
|
974
|
+
readonly COHERENCE: "coherence";
|
|
975
|
+
readonly DESIGN: "design";
|
|
976
|
+
readonly MARKUP: "markup";
|
|
977
|
+
readonly INTERNATIONALIZATION: "internationalization";
|
|
978
|
+
readonly VERITY: "verity";
|
|
979
|
+
}>;
|
|
980
|
+
severity: z.ZodNativeEnum<{
|
|
981
|
+
readonly NEUTRAL: "neutral";
|
|
982
|
+
readonly MINOR: "minor";
|
|
983
|
+
readonly MAJOR: "major";
|
|
984
|
+
readonly CRITICAL: "critical";
|
|
985
|
+
}>;
|
|
986
|
+
comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
987
|
+
}, "strip", z.ZodTypeAny, {
|
|
988
|
+
category: "accuracy" | "fluency" | "terminology" | "locale convention" | "style" | "consistency" | "coherence" | "design" | "markup" | "internationalization" | "verity";
|
|
989
|
+
severity: "neutral" | "minor" | "major" | "critical";
|
|
990
|
+
comment?: string | null | undefined;
|
|
991
|
+
}, {
|
|
992
|
+
category: "accuracy" | "fluency" | "terminology" | "locale convention" | "style" | "consistency" | "coherence" | "design" | "markup" | "internationalization" | "verity";
|
|
993
|
+
severity: "neutral" | "minor" | "major" | "critical";
|
|
994
|
+
comment?: string | null | undefined;
|
|
995
|
+
}>, "many">;
|
|
996
|
+
}, "strip", z.ZodTypeAny, {
|
|
997
|
+
contentUnitId: string;
|
|
998
|
+
translationId: string;
|
|
999
|
+
issues: {
|
|
1000
|
+
category: "accuracy" | "fluency" | "terminology" | "locale convention" | "style" | "consistency" | "coherence" | "design" | "markup" | "internationalization" | "verity";
|
|
1001
|
+
severity: "neutral" | "minor" | "major" | "critical";
|
|
1002
|
+
comment?: string | null | undefined;
|
|
1003
|
+
}[];
|
|
1004
|
+
suggestion?: string | null | undefined;
|
|
1005
|
+
}, {
|
|
1006
|
+
contentUnitId: string;
|
|
1007
|
+
translationId: string;
|
|
1008
|
+
issues: {
|
|
1009
|
+
category: "accuracy" | "fluency" | "terminology" | "locale convention" | "style" | "consistency" | "coherence" | "design" | "markup" | "internationalization" | "verity";
|
|
1010
|
+
severity: "neutral" | "minor" | "major" | "critical";
|
|
1011
|
+
comment?: string | null | undefined;
|
|
1012
|
+
}[];
|
|
1013
|
+
suggestion?: string | null | undefined;
|
|
1014
|
+
}>, "many">;
|
|
1015
|
+
errors: z.ZodOptional<z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
|
|
1016
|
+
message: z.ZodString;
|
|
1017
|
+
errorCode: z.ZodString;
|
|
1018
|
+
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1019
|
+
}, {
|
|
1020
|
+
contentUnitId: z.ZodString;
|
|
1021
|
+
translationId: z.ZodString;
|
|
1022
|
+
}>, "strip", z.ZodTypeAny, {
|
|
1023
|
+
message: string;
|
|
1024
|
+
errorCode: string;
|
|
1025
|
+
contentUnitId: string;
|
|
1026
|
+
translationId: string;
|
|
1027
|
+
details?: Record<string, unknown> | undefined;
|
|
1028
|
+
}, {
|
|
1029
|
+
message: string;
|
|
1030
|
+
errorCode: string;
|
|
1031
|
+
contentUnitId: string;
|
|
1032
|
+
translationId: string;
|
|
1033
|
+
details?: Record<string, unknown> | undefined;
|
|
1034
|
+
}>, "many">>;
|
|
1035
|
+
}, {
|
|
1036
|
+
status: z.ZodLiteral<"success">;
|
|
1037
|
+
}>, "strip", z.ZodTypeAny, {
|
|
1038
|
+
originCorrelationId: string;
|
|
1039
|
+
status: "success";
|
|
1040
|
+
data: {
|
|
1041
|
+
contentUnitId: string;
|
|
1042
|
+
translationId: string;
|
|
1043
|
+
issues: {
|
|
1044
|
+
category: "accuracy" | "fluency" | "terminology" | "locale convention" | "style" | "consistency" | "coherence" | "design" | "markup" | "internationalization" | "verity";
|
|
1045
|
+
severity: "neutral" | "minor" | "major" | "critical";
|
|
1046
|
+
comment?: string | null | undefined;
|
|
1047
|
+
}[];
|
|
1048
|
+
suggestion?: string | null | undefined;
|
|
1049
|
+
}[];
|
|
1050
|
+
errors?: {
|
|
1051
|
+
message: string;
|
|
1052
|
+
errorCode: string;
|
|
1053
|
+
contentUnitId: string;
|
|
1054
|
+
translationId: string;
|
|
1055
|
+
details?: Record<string, unknown> | undefined;
|
|
1056
|
+
}[] | undefined;
|
|
1057
|
+
}, {
|
|
1058
|
+
originCorrelationId: string;
|
|
1059
|
+
status: "success";
|
|
1060
|
+
data: {
|
|
1061
|
+
contentUnitId: string;
|
|
1062
|
+
translationId: string;
|
|
1063
|
+
issues: {
|
|
1064
|
+
category: "accuracy" | "fluency" | "terminology" | "locale convention" | "style" | "consistency" | "coherence" | "design" | "markup" | "internationalization" | "verity";
|
|
1065
|
+
severity: "neutral" | "minor" | "major" | "critical";
|
|
1066
|
+
comment?: string | null | undefined;
|
|
1067
|
+
}[];
|
|
1068
|
+
suggestion?: string | null | undefined;
|
|
1069
|
+
}[];
|
|
1070
|
+
errors?: {
|
|
1071
|
+
message: string;
|
|
1072
|
+
errorCode: string;
|
|
1073
|
+
contentUnitId: string;
|
|
1074
|
+
translationId: string;
|
|
1075
|
+
details?: Record<string, unknown> | undefined;
|
|
1076
|
+
}[] | undefined;
|
|
1077
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
1078
|
+
message: z.ZodString;
|
|
1079
|
+
errorCode: z.ZodString;
|
|
1080
|
+
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1081
|
+
}, {
|
|
1082
|
+
status: z.ZodLiteral<"error">;
|
|
1083
|
+
originCorrelationId: z.ZodString;
|
|
1084
|
+
}>, "strip", z.ZodTypeAny, {
|
|
1085
|
+
originCorrelationId: string;
|
|
1086
|
+
message: string;
|
|
1087
|
+
status: "error";
|
|
1088
|
+
errorCode: string;
|
|
1089
|
+
details?: Record<string, unknown> | undefined;
|
|
1090
|
+
}, {
|
|
1091
|
+
originCorrelationId: string;
|
|
1092
|
+
message: string;
|
|
1093
|
+
status: "error";
|
|
1094
|
+
errorCode: string;
|
|
1095
|
+
details?: Record<string, unknown> | undefined;
|
|
1096
|
+
}>]>;
|
|
1097
|
+
export type LqaAsyncBody = z.infer<typeof LQA_ASYNC_BODY_SCHEMA>;
|
|
1098
|
+
export type LqaAsyncHeaders = z.infer<typeof LQA_ASYNC_HEADERS_SCHEMA>;
|
|
1099
|
+
export type LqaAsyncResponse = z.infer<typeof LQA_ASYNC_RESPONSE_SCHEMA>;
|
|
848
1100
|
export type LqaAsyncV1CallbackBody = z.infer<typeof LQA_ASYNC_V1_CALLBACK_SCHEMA>;
|
|
849
|
-
export type
|
|
850
|
-
export type
|
|
1101
|
+
export type LqaAsyncSuccess = z.infer<typeof LQA_ASYNC_SUCCESS_SCHEMA>;
|
|
1102
|
+
export type LqaAsyncCallbackBody = z.infer<typeof LQA_ASYNC_CALLBACK_SCHEMA>;
|
|
1103
|
+
export type LqaAsyncContentUnit = z.infer<typeof LQA_CONTENT_UNIT_SCHEMA>;
|
|
1104
|
+
export type LqaAsyncSegment = z.infer<typeof LQA_SEGMENT_SCHEMA>;
|
|
851
1105
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LQA_ASYNC_V1_CALLBACK_SCHEMA = exports.
|
|
3
|
+
exports.LQA_ASYNC_CALLBACK_SCHEMA = exports.LQA_ASYNC_SUCCESS_SCHEMA = exports.LQA_ASYNC_V1_CALLBACK_SCHEMA = exports.LQA_ASYNC_RESPONSE_SCHEMA = exports.LQA_ASYNC_HEADERS_SCHEMA = exports.LQA_ASYNC_BODY_SCHEMA = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const zod_1 = tslib_1.__importDefault(require("zod"));
|
|
6
6
|
const asyncRequestSchemas_1 = require("../common/asyncRequestSchemas");
|
|
@@ -19,14 +19,14 @@ const LQA_TRANSLATION_SCHEMA = zod_1.default.object({
|
|
|
19
19
|
value: zod_1.default
|
|
20
20
|
.string()
|
|
21
21
|
.min(1)
|
|
22
|
-
.refine((value) => (0, isSegmentExceedingLengthLimit_1.isSegmentExceedingLengthLimit)(value), `Too long translation value, max length is ${
|
|
22
|
+
.refine((value) => (0, isSegmentExceedingLengthLimit_1.isSegmentExceedingLengthLimit)(value), `Too long translation value, max length is ${commonSchemas_1.SEGMENT_VALUE_MAX_LENGTH_DEFAULT} characters`)
|
|
23
23
|
.describe('Translation of this segment in target language'),
|
|
24
24
|
});
|
|
25
25
|
const LQA_SEGMENT_SCHEMA = zod_1.default.object({
|
|
26
26
|
sourceValue: zod_1.default
|
|
27
27
|
.string()
|
|
28
28
|
.min(1)
|
|
29
|
-
.refine((value) => (0, isSegmentExceedingLengthLimit_1.isSegmentExceedingLengthLimit)(value), `Too long segment value, max length is ${
|
|
29
|
+
.refine((value) => (0, isSegmentExceedingLengthLimit_1.isSegmentExceedingLengthLimit)(value), `Too long segment value, max length is ${commonSchemas_1.SEGMENT_VALUE_MAX_LENGTH_DEFAULT} characters`)
|
|
30
30
|
.describe('Text content of the segment in source language'),
|
|
31
31
|
translations: zod_1.default
|
|
32
32
|
.array(LQA_TRANSLATION_SCHEMA)
|
|
@@ -55,7 +55,7 @@ const LQA_CONTENT_UNIT_SCHEMA = zod_1.default.object({
|
|
|
55
55
|
.describe('List of segments to be reviewed'),
|
|
56
56
|
characterLimit: zod_1.default.number().optional(),
|
|
57
57
|
});
|
|
58
|
-
exports.
|
|
58
|
+
exports.LQA_ASYNC_BODY_SCHEMA = asyncRequestSchemas_1.ASYNC_REQUEST_SCHEMA.extend({
|
|
59
59
|
sourceLocale: commonSchemas_1.LOCALE_SCHEMA,
|
|
60
60
|
integration: commonSchemas_1.AI_INTEGRATION_ENGINE_SCHEMA.optional(),
|
|
61
61
|
context: translationContextSchemas_1.TRANSLATION_CONTEXT_SCHEMA.optional(),
|
|
@@ -65,15 +65,14 @@ exports.LQA_ASYNC_V1_BODY_SCHEMA = asyncRequestSchemas_1.ASYNC_REQUEST_SCHEMA.ex
|
|
|
65
65
|
.max(LQA_CONTENT_UNITS_MAX_LENGTH)
|
|
66
66
|
.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.'),
|
|
67
67
|
});
|
|
68
|
-
exports.
|
|
69
|
-
exports.
|
|
68
|
+
exports.LQA_ASYNC_HEADERS_SCHEMA = commonSchemas_1.COMMON_REQUEST_HEADERS_SCHEMA;
|
|
69
|
+
exports.LQA_ASYNC_RESPONSE_SCHEMA = zod_1.default
|
|
70
70
|
.object({
|
|
71
71
|
requestId: zod_1.default.string().uuid(),
|
|
72
72
|
expectedAt: zod_1.default.string().datetime(),
|
|
73
73
|
})
|
|
74
74
|
.describe('Accepted for processing. Await the callback for the results.');
|
|
75
|
-
exports.LQA_ASYNC_V1_CALLBACK_SCHEMA = zod_1.default
|
|
76
|
-
.object({
|
|
75
|
+
exports.LQA_ASYNC_V1_CALLBACK_SCHEMA = zod_1.default.object({
|
|
77
76
|
originCorrelationId: zod_1.default.string(),
|
|
78
77
|
data: zod_1.default.array(zod_1.default.object({
|
|
79
78
|
contentUnitId: LQA_CONTENT_UNIT_ID_SCHEMA,
|
|
@@ -91,6 +90,11 @@ exports.LQA_ASYNC_V1_CALLBACK_SCHEMA = zod_1.default
|
|
|
91
90
|
translationId: LQA_TRANSLATION_ID_SCHEMA,
|
|
92
91
|
}))
|
|
93
92
|
.optional(),
|
|
94
|
-
})
|
|
93
|
+
});
|
|
94
|
+
exports.LQA_ASYNC_SUCCESS_SCHEMA = exports.LQA_ASYNC_V1_CALLBACK_SCHEMA.extend({
|
|
95
|
+
status: zod_1.default.literal(asyncRequestSchemas_1.AsyncRequestCallbackStatusEnum.SUCCESS),
|
|
96
|
+
});
|
|
97
|
+
exports.LQA_ASYNC_CALLBACK_SCHEMA = zod_1.default
|
|
98
|
+
.discriminatedUnion('status', [exports.LQA_ASYNC_SUCCESS_SCHEMA, commonSchemas_1.COMMON_FAILED_OPERATION_CALLBACK_SCHEMA])
|
|
95
99
|
.describe('Callback with results.');
|
|
96
|
-
//# sourceMappingURL=
|
|
100
|
+
//# sourceMappingURL=lqaAsyncSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lqaAsyncSchemas.js","sourceRoot":"","sources":["../../../../src/sdk/schemas/lqa/lqaAsyncSchemas.ts"],"names":[],"mappings":";;;;AAAA,sDAAmB;AAEnB,uEAAoG;AACpG,2DAQgC;AAChC,mFAAgF;AAEhF,kGAA8F;AAC9F,mDAA4E;AAE5E,MAAM,mCAAmC,GAAG,EAAE,CAAA;AAC9C,MAAM,uCAAuC,GAAG,GAAG,CAAA;AACnD,MAAM,oCAAoC,GAAG,GAAG,CAAA;AAChD,MAAM,4BAA4B,GAAG,EAAE,CAAA;AAEvC,MAAM,yBAAyB,GAAG,aAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC,CAAA;AAEpG,MAAM,sBAAsB,GAAG,aAAC,CAAC,MAAM,CAAC;IACtC,EAAE,EAAE,yBAAyB;IAC7B,MAAM,EAAE,6BAAa;IACrB,KAAK,EAAE,aAAC;SACL,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,MAAM,CACL,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,6DAA6B,EAAC,KAAK,CAAC,EAC/C,6CAA6C,gDAAgC,aAAa,CAC3F;SACA,QAAQ,CAAC,gDAAgD,CAAC;CAC9D,CAAC,CAAA;AAEF,MAAM,kBAAkB,GAAG,aAAC,CAAC,MAAM,CAAC;IAClC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C,CAAC,OAAO,CAAC,oDAA8B,CAAC,OAAO,CAAC;CAC1D,CAAC,CAAA;AAEW,QAAA,yBAAyB,GAAG,aAAC;KACvC,kBAAkB,CAAC,QAAQ,EAAE,CAAC,gCAAwB,EAAE,uDAAuC,CAAC,CAAC;KACjG,QAAQ,CAAC,wBAAwB,CAAC,CAAA"}
|
|
@@ -18,14 +18,14 @@ const TRANSLATION_SCHEMA = zod_1.default.object({
|
|
|
18
18
|
value: zod_1.default
|
|
19
19
|
.string()
|
|
20
20
|
.min(1)
|
|
21
|
-
.refine((value) => (0, isSegmentExceedingLengthLimit_1.isSegmentExceedingLengthLimit)(value), `Too long translation value, max length is ${
|
|
21
|
+
.refine((value) => (0, isSegmentExceedingLengthLimit_1.isSegmentExceedingLengthLimit)(value), `Too long translation value, max length is ${commonSchemas_1.SEGMENT_VALUE_MAX_LENGTH_DEFAULT} characters`)
|
|
22
22
|
.describe('Translation of this segment in target language'),
|
|
23
23
|
});
|
|
24
24
|
const SEGMENT_SCHEMA = zod_1.default.object({
|
|
25
25
|
sourceValue: zod_1.default
|
|
26
26
|
.string()
|
|
27
27
|
.min(1)
|
|
28
|
-
.refine((value) => (0, isSegmentExceedingLengthLimit_1.isSegmentExceedingLengthLimit)(value), `Too long segment value, max length is ${
|
|
28
|
+
.refine((value) => (0, isSegmentExceedingLengthLimit_1.isSegmentExceedingLengthLimit)(value), `Too long segment value, max length is ${commonSchemas_1.SEGMENT_VALUE_MAX_LENGTH_DEFAULT} characters`)
|
|
29
29
|
.describe('Text content of the segment in source language'),
|
|
30
30
|
translations: zod_1.default
|
|
31
31
|
.array(TRANSLATION_SCHEMA)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lqaSyncV2Schemas.js","sourceRoot":"","sources":["../../../../src/sdk/schemas/lqa/lqaSyncV2Schemas.ts"],"names":[],"mappings":";;;;AAAA,sDAAmB;AAEnB,
|
|
1
|
+
{"version":3,"file":"lqaSyncV2Schemas.js","sourceRoot":"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EAAE;QACjC,MAAM,EAAE,aAAC,CAAC,KAAK,CACb,aAAC,CAAC,MAAM,CAAC;YACP,QAAQ,EAAE,aAAC,CAAC,UAAU,CAAC,oCAAoB,CAAC;YAC5C,QAAQ,EAAE,aAAC,CAAC,UAAU,CAAC,oCAAoB,CAAC;YAC5C,OAAO,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC/B,CAAC,CACH;KACF,CAAC,CACH;IACD,MAAM,EAAE,aAAC;SACN,KAAK,CACJ,4CAA4B,CAAC,MAAM,CAAC;QAClC,aAAa,EAAE,0BAA0B;QACzC,aAAa,EAAE,yBAAyB;KACzC,CAAC,CACH;SACA,QAAQ,EAAE;CACd,CAAC;KACD,QAAQ,CAAC,mCAAmC,CAAC,CAAA"}
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
|
+
import { type IntegrationEngineEnum } from '../common/commonSchemas';
|
|
3
|
+
export type ContentUnitLike = {
|
|
4
|
+
segments: {
|
|
5
|
+
value: string;
|
|
6
|
+
}[];
|
|
7
|
+
};
|
|
2
8
|
export declare const refineDifferentSourceAndTargetLang: readonly [(data: {
|
|
3
9
|
sourceLocale: string;
|
|
4
10
|
targetLocale: string;
|
|
5
11
|
}) => boolean, "The sourceLocale and targetLocale must be different."];
|
|
12
|
+
export declare const refineRequestSizeLimit: readonly [(data: {
|
|
13
|
+
contentUnits: ContentUnitLike[];
|
|
14
|
+
integration?: IntegrationEngineEnum;
|
|
15
|
+
}) => boolean, (data: {
|
|
16
|
+
integration?: IntegrationEngineEnum;
|
|
17
|
+
}) => {
|
|
18
|
+
message: string;
|
|
19
|
+
}];
|
|
6
20
|
export declare const refineUniqueIds: readonly [(data: {
|
|
7
21
|
id: string;
|
|
8
22
|
}[]) => boolean, "IDs must be unique within the collection"];
|
|
@@ -22,3 +36,143 @@ export declare const SEGMENT_WARNINGS_SCHEMA: z.ZodArray<z.ZodObject<{
|
|
|
22
36
|
}, {
|
|
23
37
|
kind: "EDITED_NON_TRANSLATABLE_CONTENT" | "EDITED_ICU_PLURALS";
|
|
24
38
|
}>, "many">;
|
|
39
|
+
export declare const CONTENT_ID_PROP_SCHEMA: z.ZodString;
|
|
40
|
+
export declare const TRANSLATE_SEGMENT_SCHEMA: 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.ZodString;
|
|
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
|
+
}>;
|
|
68
|
+
export declare const TRANSLATE_CONTENT_UNIT_SCHEMA: z.ZodObject<{
|
|
69
|
+
id: z.ZodString;
|
|
70
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
71
|
+
description: z.ZodString;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
description: string;
|
|
74
|
+
}, {
|
|
75
|
+
description: string;
|
|
76
|
+
}>>;
|
|
77
|
+
characterLimit: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
segments: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
79
|
+
id: z.ZodString;
|
|
80
|
+
tmMatch: z.ZodOptional<z.ZodObject<{
|
|
81
|
+
sourceValue: z.ZodString;
|
|
82
|
+
translatedValue: z.ZodString;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
sourceValue: string;
|
|
85
|
+
translatedValue: string;
|
|
86
|
+
}, {
|
|
87
|
+
sourceValue: string;
|
|
88
|
+
translatedValue: string;
|
|
89
|
+
}>>;
|
|
90
|
+
value: z.ZodString;
|
|
91
|
+
}, "strip", z.ZodTypeAny, {
|
|
92
|
+
value: string;
|
|
93
|
+
id: string;
|
|
94
|
+
tmMatch?: {
|
|
95
|
+
sourceValue: string;
|
|
96
|
+
translatedValue: string;
|
|
97
|
+
} | undefined;
|
|
98
|
+
}, {
|
|
99
|
+
value: string;
|
|
100
|
+
id: string;
|
|
101
|
+
tmMatch?: {
|
|
102
|
+
sourceValue: string;
|
|
103
|
+
translatedValue: string;
|
|
104
|
+
} | undefined;
|
|
105
|
+
}>, "atleastone">, [{
|
|
106
|
+
value: string;
|
|
107
|
+
id: string;
|
|
108
|
+
tmMatch?: {
|
|
109
|
+
sourceValue: string;
|
|
110
|
+
translatedValue: string;
|
|
111
|
+
} | undefined;
|
|
112
|
+
}, ...{
|
|
113
|
+
value: string;
|
|
114
|
+
id: string;
|
|
115
|
+
tmMatch?: {
|
|
116
|
+
sourceValue: string;
|
|
117
|
+
translatedValue: string;
|
|
118
|
+
} | undefined;
|
|
119
|
+
}[]], [{
|
|
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
|
+
}, "strip", z.ZodTypeAny, {
|
|
135
|
+
id: string;
|
|
136
|
+
segments: [{
|
|
137
|
+
value: string;
|
|
138
|
+
id: string;
|
|
139
|
+
tmMatch?: {
|
|
140
|
+
sourceValue: string;
|
|
141
|
+
translatedValue: string;
|
|
142
|
+
} | undefined;
|
|
143
|
+
}, ...{
|
|
144
|
+
value: string;
|
|
145
|
+
id: string;
|
|
146
|
+
tmMatch?: {
|
|
147
|
+
sourceValue: string;
|
|
148
|
+
translatedValue: string;
|
|
149
|
+
} | undefined;
|
|
150
|
+
}[]];
|
|
151
|
+
context?: {
|
|
152
|
+
description: string;
|
|
153
|
+
} | undefined;
|
|
154
|
+
characterLimit?: number | undefined;
|
|
155
|
+
}, {
|
|
156
|
+
id: string;
|
|
157
|
+
segments: [{
|
|
158
|
+
value: string;
|
|
159
|
+
id: string;
|
|
160
|
+
tmMatch?: {
|
|
161
|
+
sourceValue: string;
|
|
162
|
+
translatedValue: string;
|
|
163
|
+
} | undefined;
|
|
164
|
+
}, ...{
|
|
165
|
+
value: string;
|
|
166
|
+
id: string;
|
|
167
|
+
tmMatch?: {
|
|
168
|
+
sourceValue: string;
|
|
169
|
+
translatedValue: string;
|
|
170
|
+
} | undefined;
|
|
171
|
+
}[]];
|
|
172
|
+
context?: {
|
|
173
|
+
description: string;
|
|
174
|
+
} | undefined;
|
|
175
|
+
characterLimit?: number | undefined;
|
|
176
|
+
}>;
|
|
177
|
+
export type TranslateSegment = z.infer<typeof TRANSLATE_SEGMENT_SCHEMA>;
|
|
178
|
+
export type TranslateContentUnit = z.infer<typeof TRANSLATE_CONTENT_UNIT_SCHEMA>;
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SEGMENT_WARNINGS_SCHEMA = exports.SEGMENT_TRANSLATION_WARNING_SCHEMA = exports.TRANSLATION_QUALITY_WARNING_KINDS = exports.refineUniqueIds = exports.refineDifferentSourceAndTargetLang = void 0;
|
|
3
|
+
exports.TRANSLATE_CONTENT_UNIT_SCHEMA = exports.TRANSLATE_SEGMENT_SCHEMA = exports.CONTENT_ID_PROP_SCHEMA = exports.SEGMENT_WARNINGS_SCHEMA = exports.SEGMENT_TRANSLATION_WARNING_SCHEMA = exports.TRANSLATION_QUALITY_WARNING_KINDS = exports.refineUniqueIds = exports.refineRequestSizeLimit = exports.refineDifferentSourceAndTargetLang = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const zod_1 = tslib_1.__importDefault(require("zod"));
|
|
6
|
+
const requestSizeLimit_1 = require("../../validation/requestSizeLimit");
|
|
7
|
+
const commonSchemas_1 = require("../common/commonSchemas");
|
|
6
8
|
exports.refineDifferentSourceAndTargetLang = [
|
|
7
9
|
(data) => {
|
|
8
10
|
return data.sourceLocale !== data.targetLocale;
|
|
9
11
|
},
|
|
10
12
|
'The sourceLocale and targetLocale must be different.',
|
|
11
13
|
];
|
|
14
|
+
exports.refineRequestSizeLimit = [
|
|
15
|
+
(data) => (0, requestSizeLimit_1.isRequestSizeUnderLimit)(data.contentUnits, data.integration),
|
|
16
|
+
(data) => ({
|
|
17
|
+
message: `Request size too large, max is ${(0, requestSizeLimit_1.getRequestSizeLimit)(data.integration)} characters in total`,
|
|
18
|
+
}),
|
|
19
|
+
];
|
|
12
20
|
exports.refineUniqueIds = [
|
|
13
21
|
(data) => {
|
|
14
22
|
const ids = data.map(({ id }) => id);
|
|
@@ -24,4 +32,27 @@ exports.SEGMENT_TRANSLATION_WARNING_SCHEMA = zod_1.default.object({
|
|
|
24
32
|
kind: zod_1.default.enum(exports.TRANSLATION_QUALITY_WARNING_KINDS),
|
|
25
33
|
});
|
|
26
34
|
exports.SEGMENT_WARNINGS_SCHEMA = zod_1.default.array(exports.SEGMENT_TRANSLATION_WARNING_SCHEMA);
|
|
35
|
+
const ID_PROP_MAX_LENGTH = 100;
|
|
36
|
+
const CONTENT_UNIT_DESCRIPTION_MAX_LENGTH = 500;
|
|
37
|
+
const CONTENT_UNIT_SEGMENTS_MAX_LENGTH = 1000; // context -> https://lokalise.slack.com/archives/C07BVQEMCRJ/p1725002827265889
|
|
38
|
+
exports.CONTENT_ID_PROP_SCHEMA = zod_1.default.string().min(1).max(ID_PROP_MAX_LENGTH);
|
|
39
|
+
exports.TRANSLATE_SEGMENT_SCHEMA = zod_1.default.object({
|
|
40
|
+
id: exports.CONTENT_ID_PROP_SCHEMA,
|
|
41
|
+
tmMatch: commonSchemas_1.TM_MATCH_SCHEMA,
|
|
42
|
+
value: zod_1.default.string().min(1),
|
|
43
|
+
});
|
|
44
|
+
exports.TRANSLATE_CONTENT_UNIT_SCHEMA = zod_1.default.object({
|
|
45
|
+
id: exports.CONTENT_ID_PROP_SCHEMA,
|
|
46
|
+
context: zod_1.default
|
|
47
|
+
.object({
|
|
48
|
+
description: zod_1.default.string().min(1).max(CONTENT_UNIT_DESCRIPTION_MAX_LENGTH),
|
|
49
|
+
})
|
|
50
|
+
.optional(),
|
|
51
|
+
characterLimit: zod_1.default.number().optional(),
|
|
52
|
+
segments: zod_1.default
|
|
53
|
+
.array(exports.TRANSLATE_SEGMENT_SCHEMA)
|
|
54
|
+
.nonempty()
|
|
55
|
+
.max(CONTENT_UNIT_SEGMENTS_MAX_LENGTH)
|
|
56
|
+
.refine(...exports.refineUniqueIds),
|
|
57
|
+
});
|
|
27
58
|
//# sourceMappingURL=sharedSchemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedSchemas.js","sourceRoot":"","sources":["../../../../src/sdk/schemas/translation/sharedSchemas.ts"],"names":[],"mappings":";;;;AAAA,sDAAmB;
|
|
1
|
+
{"version":3,"file":"sharedSchemas.js","sourceRoot":"","sources":["../../../../src/sdk/schemas/translation/sharedSchemas.ts"],"names":[],"mappings":";;;;AAAA,sDAAmB;AACnB,wEAAgG;AAChG,2DAAqF;AAMxE,QAAA,kCAAkC,GAAG;IAChD,CAAC,IAAoD,EAAE,EAAE;QACvD,OAAO,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,YAAY,CAAA;I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