@lokalise/polyglot-sdk 19.1.0 → 20.0.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 +22 -22
- package/dist/index.js +20 -20
- package/dist/index.js.map +1 -1
- package/dist/sdk/PolyglotClient.d.ts +7 -7
- package/dist/sdk/PolyglotClient.js +6 -6
- package/dist/sdk/helpers/htmlEscaping.d.ts +1 -1
- package/dist/sdk/helpers/htmlEscaping.js +2 -2
- package/dist/sdk/helpers/nonTranslatableContentHelper.d.ts +1 -1
- package/dist/sdk/helpers/nonTranslatableContentHelper.js +1 -1
- package/dist/sdk/helpers/nonTranslatableContentWrappers.d.ts +1 -1
- package/dist/sdk/helpers/nonTranslatableContentWrappers.js +2 -2
- package/dist/sdk/schemas/common/asyncRequestSchemas.d.ts +1 -1
- package/dist/sdk/schemas/common/commonSchemas.d.ts +38 -21
- package/dist/sdk/schemas/common/commonSchemas.js +24 -5
- package/dist/sdk/schemas/common/commonSchemas.js.map +1 -1
- package/dist/sdk/schemas/common/errorSchemas.d.ts +16 -21
- package/dist/sdk/schemas/common/errorSchemas.js +1 -1
- package/dist/sdk/schemas/common/translationContextSchemas.d.ts +0 -11
- package/dist/sdk/schemas/common/translationContextSchemas.js +2 -6
- package/dist/sdk/schemas/common/translationContextSchemas.js.map +1 -1
- package/dist/sdk/schemas/lqa/commonSchemas.d.ts +1 -1
- package/dist/sdk/schemas/lqa/lqaAsyncSchemas.d.ts +21 -20
- package/dist/sdk/schemas/lqa/lqaAsyncSchemas.js +8 -7
- package/dist/sdk/schemas/lqa/lqaAsyncSchemas.js.map +1 -1
- package/dist/sdk/schemas/lqa/lqaSyncSchemas.d.ts +12 -11
- package/dist/sdk/schemas/lqa/lqaSyncSchemas.js +7 -6
- package/dist/sdk/schemas/lqa/lqaSyncSchemas.js.map +1 -1
- package/dist/sdk/schemas/translation/generateVariants.d.ts +15 -14
- package/dist/sdk/schemas/translation/generateVariants.js +3 -3
- package/dist/sdk/schemas/translation/rewriteTextSchemas.d.ts +37 -35
- package/dist/sdk/schemas/translation/rewriteTextSchemas.js +4 -4
- package/dist/sdk/schemas/translation/sharedSchemas.d.ts +117 -4
- package/dist/sdk/schemas/translation/sharedSchemas.js +21 -5
- package/dist/sdk/schemas/translation/sharedSchemas.js.map +1 -1
- package/dist/sdk/schemas/translation/translateAsyncSchemas.d.ts +306 -41
- package/dist/sdk/schemas/translation/translateAsyncSchemas.js +5 -5
- package/dist/sdk/schemas/translation/translateSyncSchemas.d.ts +254 -21
- package/dist/sdk/schemas/translation/translateSyncSchemas.js +4 -4
- package/dist/sdk/schemas/translation/translateTextSegmentSchemas.d.ts +21 -31
- package/dist/sdk/schemas/translation/translateTextSegmentSchemas.js +4 -4
- package/dist/sdk/schemas/translation/translateTextSegmentSchemas.js.map +1 -1
- package/dist/sdk/validation/isSegmentUnderLengthLimit.d.ts +1 -1
- package/dist/sdk/validation/isSegmentUnderLengthLimit.js +3 -3
- package/dist/sdk/validation/requestSizeLimit.d.ts +2 -2
- package/dist/sdk/validation/requestSizeLimit.js +2 -2
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
export { PolyglotClient } from './sdk/PolyglotClient.
|
|
2
|
-
export { PolyglotError } from './sdk/errors/PolyglotError.
|
|
3
|
-
export type { ClientOptions, PolyglotClientConfig } from './sdk/types/client.
|
|
4
|
-
export * from './sdk/schemas/common/asyncRequestSchemas.
|
|
5
|
-
export * from './sdk/schemas/common/commonSchemas.
|
|
6
|
-
export * from './sdk/schemas/common/errorSchemas.
|
|
7
|
-
export { TRANSLATION_CONTEXT_SCHEMA, isStructuredStyleGuide, } from './sdk/schemas/common/translationContextSchemas.
|
|
8
|
-
export type { StructuredStyleGuide, FreeformStyleGuide, StyleGuideData, GlossaryTerm, TranslationContext, TextRewritingContext,
|
|
9
|
-
export { LqaIssueSeverityEnum } from './sdk/schemas/lqa/commonSchemas.
|
|
10
|
-
export * from './sdk/schemas/lqa/lqaAsyncSchemas.
|
|
11
|
-
export * from './sdk/schemas/lqa/lqaSyncSchemas.
|
|
12
|
-
export * from './sdk/schemas/translation/generateVariants.
|
|
13
|
-
export * from './sdk/schemas/translation/rewriteTextSchemas.
|
|
14
|
-
export * from './sdk/schemas/translation/translateSyncSchemas.
|
|
15
|
-
export * from './sdk/schemas/translation/translateAsyncSchemas.
|
|
16
|
-
export * from './sdk/schemas/translation/translateTextSegmentSchemas.
|
|
17
|
-
export * from './sdk/schemas/translation/sharedSchemas.
|
|
18
|
-
export { isSegmentUnderLengthLimit, isSegmentUnderLengthLimit as isSegmentExceedingLengthLimit, } from './sdk/validation/isSegmentUnderLengthLimit.
|
|
19
|
-
export { getRequestSizeLimit, isRequestSizeUnderLimit } from './sdk/validation/requestSizeLimit.
|
|
20
|
-
export * from './sdk/helpers/htmlEscaping.
|
|
21
|
-
export * from './sdk/helpers/nonTranslatableContentHelper.
|
|
22
|
-
export * from './sdk/helpers/nonTranslatableContentWrappers.
|
|
1
|
+
export { PolyglotClient } from './sdk/PolyglotClient.ts';
|
|
2
|
+
export { PolyglotError } from './sdk/errors/PolyglotError.ts';
|
|
3
|
+
export type { ClientOptions, PolyglotClientConfig } from './sdk/types/client.ts';
|
|
4
|
+
export * from './sdk/schemas/common/asyncRequestSchemas.ts';
|
|
5
|
+
export * from './sdk/schemas/common/commonSchemas.ts';
|
|
6
|
+
export * from './sdk/schemas/common/errorSchemas.ts';
|
|
7
|
+
export { TRANSLATION_CONTEXT_SCHEMA, isStructuredStyleGuide, } from './sdk/schemas/common/translationContextSchemas.ts';
|
|
8
|
+
export type { StructuredStyleGuide, FreeformStyleGuide, StyleGuideData, GlossaryTerm, TranslationContext, TextRewritingContext, } from './sdk/schemas/common/translationContextSchemas.ts';
|
|
9
|
+
export { LqaIssueSeverityEnum } from './sdk/schemas/lqa/commonSchemas.ts';
|
|
10
|
+
export * from './sdk/schemas/lqa/lqaAsyncSchemas.ts';
|
|
11
|
+
export * from './sdk/schemas/lqa/lqaSyncSchemas.ts';
|
|
12
|
+
export * from './sdk/schemas/translation/generateVariants.ts';
|
|
13
|
+
export * from './sdk/schemas/translation/rewriteTextSchemas.ts';
|
|
14
|
+
export * from './sdk/schemas/translation/translateSyncSchemas.ts';
|
|
15
|
+
export * from './sdk/schemas/translation/translateAsyncSchemas.ts';
|
|
16
|
+
export * from './sdk/schemas/translation/translateTextSegmentSchemas.ts';
|
|
17
|
+
export * from './sdk/schemas/translation/sharedSchemas.ts';
|
|
18
|
+
export { isSegmentUnderLengthLimit, isSegmentUnderLengthLimit as isSegmentExceedingLengthLimit, } from './sdk/validation/isSegmentUnderLengthLimit.ts';
|
|
19
|
+
export { getRequestSizeLimit, isRequestSizeUnderLimit } from './sdk/validation/requestSizeLimit.ts';
|
|
20
|
+
export * from './sdk/helpers/htmlEscaping.ts';
|
|
21
|
+
export * from './sdk/helpers/nonTranslatableContentHelper.ts';
|
|
22
|
+
export * from './sdk/helpers/nonTranslatableContentWrappers.ts';
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export { PolyglotClient } from
|
|
2
|
-
export { PolyglotError } from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export { TRANSLATION_CONTEXT_SCHEMA, isStructuredStyleGuide, } from
|
|
7
|
-
export { LqaIssueSeverityEnum } from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export { isSegmentUnderLengthLimit, isSegmentUnderLengthLimit as isSegmentExceedingLengthLimit, } from
|
|
17
|
-
export { getRequestSizeLimit, isRequestSizeUnderLimit } from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
1
|
+
export { PolyglotClient } from "./sdk/PolyglotClient.js";
|
|
2
|
+
export { PolyglotError } from "./sdk/errors/PolyglotError.js";
|
|
3
|
+
export * from "./sdk/schemas/common/asyncRequestSchemas.js";
|
|
4
|
+
export * from "./sdk/schemas/common/commonSchemas.js";
|
|
5
|
+
export * from "./sdk/schemas/common/errorSchemas.js";
|
|
6
|
+
export { TRANSLATION_CONTEXT_SCHEMA, isStructuredStyleGuide, } from "./sdk/schemas/common/translationContextSchemas.js";
|
|
7
|
+
export { LqaIssueSeverityEnum } from "./sdk/schemas/lqa/commonSchemas.js";
|
|
8
|
+
export * from "./sdk/schemas/lqa/lqaAsyncSchemas.js";
|
|
9
|
+
export * from "./sdk/schemas/lqa/lqaSyncSchemas.js";
|
|
10
|
+
export * from "./sdk/schemas/translation/generateVariants.js";
|
|
11
|
+
export * from "./sdk/schemas/translation/rewriteTextSchemas.js";
|
|
12
|
+
export * from "./sdk/schemas/translation/translateSyncSchemas.js";
|
|
13
|
+
export * from "./sdk/schemas/translation/translateAsyncSchemas.js";
|
|
14
|
+
export * from "./sdk/schemas/translation/translateTextSegmentSchemas.js";
|
|
15
|
+
export * from "./sdk/schemas/translation/sharedSchemas.js";
|
|
16
|
+
export { isSegmentUnderLengthLimit, isSegmentUnderLengthLimit as isSegmentExceedingLengthLimit, } from "./sdk/validation/isSegmentUnderLengthLimit.js";
|
|
17
|
+
export { getRequestSizeLimit, isRequestSizeUnderLimit } from "./sdk/validation/requestSizeLimit.js";
|
|
18
|
+
export * from "./sdk/helpers/htmlEscaping.js";
|
|
19
|
+
export * from "./sdk/helpers/nonTranslatableContentHelper.js";
|
|
20
|
+
export * from "./sdk/helpers/nonTranslatableContentWrappers.js";
|
|
21
21
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAG7D,cAAc,6CAA6C,CAAA;AAE3D,cAAc,uCAAuC,CAAA;AACrD,cAAc,sCAAsC,CAAA;AACpD,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,mDAAmD,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAG7D,cAAc,6CAA6C,CAAA;AAE3D,cAAc,uCAAuC,CAAA;AACrD,cAAc,sCAAsC,CAAA;AACpD,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,mDAAmD,CAAA;AAU1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAA;AACzE,cAAc,sCAAsC,CAAA;AACpD,cAAc,qCAAqC,CAAA;AACnD,cAAc,+CAA+C,CAAA;AAC7D,cAAc,iDAAiD,CAAA;AAC/D,cAAc,mDAAmD,CAAA;AACjE,cAAc,oDAAoD,CAAA;AAClE,cAAc,0DAA0D,CAAA;AACxE,cAAc,4CAA4C,CAAA;AAE1D,OAAO,EACL,yBAAyB,EACzB,yBAAyB,IAAI,6BAA6B,GAC3D,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAEnG,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+CAA+C,CAAA;AAC7D,cAAc,iDAAiD,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Either } from '@lokalise/node-core';
|
|
2
2
|
import { InternalError } from '@lokalise/node-core';
|
|
3
|
-
import { PolyglotError } from './errors/PolyglotError.
|
|
4
|
-
import { type LqaAsyncBody, type LqaAsyncResponse } from './schemas/lqa/lqaAsyncSchemas.
|
|
5
|
-
import type { LqaSyncBody, LqaSyncResponse } from './schemas/lqa/lqaSyncSchemas.
|
|
6
|
-
import type { GenerateVariantsBody, GenerateVariantsResponse } from './schemas/translation/generateVariants.
|
|
7
|
-
import type { TranslateAsyncBody, TranslateAsyncResponse } from './schemas/translation/translateAsyncSchemas.
|
|
8
|
-
import { type TranslateSyncBody, type TranslateSyncResponse } from './schemas/translation/translateSyncSchemas.
|
|
9
|
-
import type { ClientOptions, PolyglotClientConfig } from './types/client.
|
|
3
|
+
import { PolyglotError } from './errors/PolyglotError.ts';
|
|
4
|
+
import { type LqaAsyncBody, type LqaAsyncResponse } from './schemas/lqa/lqaAsyncSchemas.ts';
|
|
5
|
+
import type { LqaSyncBody, LqaSyncResponse } from './schemas/lqa/lqaSyncSchemas.ts';
|
|
6
|
+
import type { GenerateVariantsBody, GenerateVariantsResponse } from './schemas/translation/generateVariants.ts';
|
|
7
|
+
import type { TranslateAsyncBody, TranslateAsyncResponse } from './schemas/translation/translateAsyncSchemas.ts';
|
|
8
|
+
import { type TranslateSyncBody, type TranslateSyncResponse } from './schemas/translation/translateSyncSchemas.ts';
|
|
9
|
+
import type { ClientOptions, PolyglotClientConfig } from './types/client.ts';
|
|
10
10
|
type InstrumentationOutput<T> = Either<PolyglotError | InternalError, T>;
|
|
11
11
|
export declare class PolyglotClient {
|
|
12
12
|
private readonly client;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { buildClient, isResponseStatusError, sendPost } from '@lokalise/backend-http-client';
|
|
2
2
|
import { InternalError } from '@lokalise/node-core';
|
|
3
3
|
import pino from 'pino';
|
|
4
|
-
import { PolyglotError } from
|
|
5
|
-
import { LQA_ASYNC_RESPONSE_SCHEMA, } from
|
|
6
|
-
import { LQA_SYNC_RESPONSE_SCHEMA } from
|
|
7
|
-
import { GENERATE_VARIANTS_RESPONSE_SCHEMA } from
|
|
8
|
-
import { TRANSLATE_ASYNC_RESPONSE_SCHEMA } from
|
|
9
|
-
import { TRANSLATE_SYNC_RESPONSE_SCHEMA, } from
|
|
4
|
+
import { PolyglotError } from "./errors/PolyglotError.js";
|
|
5
|
+
import { LQA_ASYNC_RESPONSE_SCHEMA, } from "./schemas/lqa/lqaAsyncSchemas.js";
|
|
6
|
+
import { LQA_SYNC_RESPONSE_SCHEMA } from "./schemas/lqa/lqaSyncSchemas.js";
|
|
7
|
+
import { GENERATE_VARIANTS_RESPONSE_SCHEMA } from "./schemas/translation/generateVariants.js";
|
|
8
|
+
import { TRANSLATE_ASYNC_RESPONSE_SCHEMA } from "./schemas/translation/translateAsyncSchemas.js";
|
|
9
|
+
import { TRANSLATE_SYNC_RESPONSE_SCHEMA, } from "./schemas/translation/translateSyncSchemas.js";
|
|
10
10
|
const DEFAULT_CLIENT_OPTIONS = {
|
|
11
11
|
timeout: 30000,
|
|
12
12
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type IntegrationEngineEnum } from '../schemas/common/commonSchemas.
|
|
1
|
+
import { type IntegrationEngineEnum } from '../schemas/common/commonSchemas.ts';
|
|
2
2
|
export declare const handleHtmlEscape: (text: string, integration?: IntegrationEngineEnum) => string;
|
|
3
3
|
export declare const handleHtmlUnescape: (text: string, integration?: IntegrationEngineEnum) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { escape as escapeHtml, unescape as unescapeHtml } from 'html-escaper';
|
|
2
|
-
import { MtIntegrationEngineEnum, } from
|
|
3
|
-
import { isEnumValue } from
|
|
2
|
+
import { MtIntegrationEngineEnum, } from "../schemas/common/commonSchemas.js";
|
|
3
|
+
import { isEnumValue } from "./isEnumValue.js";
|
|
4
4
|
const isHtmlEscapingNeededByMtIntegration = {
|
|
5
5
|
[MtIntegrationEngineEnum.DEEPL]: true,
|
|
6
6
|
[MtIntegrationEngineEnum.GOOGLE_TRANSLATE]: true,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NON_TRANSLATABLE_END_TAG, NON_TRANSLATABLE_START_TAG, } from '@lokalise/non-translatable-markup';
|
|
2
|
-
import { getWrapperByIntegration } from
|
|
2
|
+
import { getWrapperByIntegration } from "./nonTranslatableContentWrappers.js";
|
|
3
3
|
export const NON_TRANSLATABLE_REGION_REGEX = new RegExp(String.raw `${NON_TRANSLATABLE_START_TAG}[\s\S]*?${NON_TRANSLATABLE_END_TAG}`, 'g');
|
|
4
4
|
/**
|
|
5
5
|
* Extracts matches from a string using a regular expression
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MtIntegrationEngineEnum, } from
|
|
2
|
-
import { isEnumValue } from
|
|
1
|
+
import { MtIntegrationEngineEnum, } from "../schemas/common/commonSchemas.js";
|
|
2
|
+
import { isEnumValue } from "./isEnumValue.js";
|
|
3
3
|
const createWrapperMatchingRegexp = (tagWithAttributes) => {
|
|
4
4
|
const tag = tagWithAttributes.trim().split(' ').shift();
|
|
5
5
|
return new RegExp(String.raw `<${tagWithAttributes} id=\\*["'](\d+)\\*["']>([\s\S]*?)</${tag}>`, 'g');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
|
-
import type { ObjectValues } from '../../types/common.
|
|
2
|
+
import type { ObjectValues } from '../../types/common.ts';
|
|
3
3
|
export declare const ORIGIN_CORRELATION_ID_SCHEMA: z.ZodString;
|
|
4
4
|
export declare const OWNER_ID_SCHEMA: z.ZodString;
|
|
5
5
|
export declare const TENANT_ID_SCHEMA: z.ZodString;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
|
-
import type { ObjectValues } from '../../types/common.
|
|
2
|
+
import type { ObjectValues } from '../../types/common.ts';
|
|
3
3
|
export declare const FinetunedIntegrationEngineEnum: {
|
|
4
4
|
readonly FINETUNED_OPENAI: "FT-OpenAI";
|
|
5
5
|
};
|
|
@@ -7,16 +7,21 @@ export type FinetunedIntegrationEngineEnum = ObjectValues<typeof FinetunedIntegr
|
|
|
7
7
|
export declare const AiIntegrationEngineEnum: {
|
|
8
8
|
readonly FINETUNED_OPENAI: "FT-OpenAI";
|
|
9
9
|
readonly CLAUDE: "Claude";
|
|
10
|
-
readonly
|
|
10
|
+
readonly GPT: "GPT";
|
|
11
11
|
readonly GEMINI: "Gemini";
|
|
12
12
|
};
|
|
13
13
|
export type AiIntegrationEngineEnum = ObjectValues<typeof AiIntegrationEngineEnum>;
|
|
14
|
-
export declare const
|
|
15
|
-
readonly FINETUNED_OPENAI: "FT-OpenAI";
|
|
16
|
-
readonly CLAUDE: "Claude";
|
|
14
|
+
export declare const DeprecatedAiIntegrationEngineEnum: {
|
|
17
15
|
readonly CHAT_GPT4: "ChatGPT-4";
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
};
|
|
17
|
+
export type DeprecatedAiIntegrationEngineEnum = ObjectValues<typeof DeprecatedAiIntegrationEngineEnum>;
|
|
18
|
+
export declare const AI_INTEGRATION_ENGINE_SCHEMA: z.ZodEffects<z.ZodNativeEnum<{
|
|
19
|
+
CHAT_GPT4: "ChatGPT-4";
|
|
20
|
+
FINETUNED_OPENAI: "FT-OpenAI";
|
|
21
|
+
CLAUDE: "Claude";
|
|
22
|
+
GPT: "GPT";
|
|
23
|
+
GEMINI: "Gemini";
|
|
24
|
+
}>, "FT-OpenAI" | "Claude" | "GPT" | "Gemini", "FT-OpenAI" | "Claude" | "GPT" | "Gemini" | "ChatGPT-4">;
|
|
20
25
|
export declare const MtIntegrationEngineEnum: {
|
|
21
26
|
readonly DEEPL: "DeepL";
|
|
22
27
|
readonly GOOGLE_TRANSLATE: "GoogleTranslate";
|
|
@@ -31,22 +36,23 @@ export declare const MT_INTEGRATION_ENGINE_SCHEMA: z.ZodNativeEnum<{
|
|
|
31
36
|
export declare const RealIntegrationEngineEnum: {
|
|
32
37
|
readonly FINETUNED_OPENAI: "FT-OpenAI";
|
|
33
38
|
readonly CLAUDE: "Claude";
|
|
34
|
-
readonly
|
|
39
|
+
readonly GPT: "GPT";
|
|
35
40
|
readonly GEMINI: "Gemini";
|
|
36
41
|
readonly DEEPL: "DeepL";
|
|
37
42
|
readonly GOOGLE_TRANSLATE: "GoogleTranslate";
|
|
38
43
|
readonly MICROSOFT_TRANSLATOR: "MicrosoftTranslator";
|
|
39
44
|
};
|
|
40
45
|
export type RealIntegrationEngineEnum = ObjectValues<typeof RealIntegrationEngineEnum>;
|
|
41
|
-
export declare const REAL_INTEGRATION_ENGINE_SCHEMA: z.ZodNativeEnum<{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
export declare const REAL_INTEGRATION_ENGINE_SCHEMA: z.ZodEffects<z.ZodNativeEnum<{
|
|
47
|
+
CHAT_GPT4: "ChatGPT-4";
|
|
48
|
+
FINETUNED_OPENAI: "FT-OpenAI";
|
|
49
|
+
CLAUDE: "Claude";
|
|
50
|
+
GPT: "GPT";
|
|
51
|
+
GEMINI: "Gemini";
|
|
52
|
+
DEEPL: "DeepL";
|
|
53
|
+
GOOGLE_TRANSLATE: "GoogleTranslate";
|
|
54
|
+
MICROSOFT_TRANSLATOR: "MicrosoftTranslator";
|
|
55
|
+
}>, "FT-OpenAI" | "Claude" | "GPT" | "Gemini" | "DeepL" | "GoogleTranslate" | "MicrosoftTranslator", "FT-OpenAI" | "Claude" | "GPT" | "Gemini" | "ChatGPT-4" | "DeepL" | "GoogleTranslate" | "MicrosoftTranslator">;
|
|
50
56
|
export declare const FORCE_INTEGRATION_SCHEMA: z.ZodBoolean;
|
|
51
57
|
export declare const refineIntegrationIsPresent: readonly [(data: {
|
|
52
58
|
integration?: string;
|
|
@@ -56,7 +62,7 @@ export declare const IntegrationEngineEnum: {
|
|
|
56
62
|
readonly FAKE: "Fake";
|
|
57
63
|
readonly FINETUNED_OPENAI: "FT-OpenAI";
|
|
58
64
|
readonly CLAUDE: "Claude";
|
|
59
|
-
readonly
|
|
65
|
+
readonly GPT: "GPT";
|
|
60
66
|
readonly GEMINI: "Gemini";
|
|
61
67
|
readonly DEEPL: "DeepL";
|
|
62
68
|
readonly GOOGLE_TRANSLATE: "GoogleTranslate";
|
|
@@ -77,14 +83,14 @@ export declare const COMMON_ERROR_RESPONSE_SCHEMA: z.ZodObject<{
|
|
|
77
83
|
details?: Record<string, unknown> | undefined;
|
|
78
84
|
}>;
|
|
79
85
|
export type CommonErrorResponse = z.infer<typeof COMMON_ERROR_RESPONSE_SCHEMA>;
|
|
80
|
-
export declare const COMMON_FAILED_OPERATION_CALLBACK_SCHEMA: z.ZodObject<
|
|
86
|
+
export declare const COMMON_FAILED_OPERATION_CALLBACK_SCHEMA: z.ZodObject<{
|
|
81
87
|
message: z.ZodString;
|
|
82
88
|
errorCode: z.ZodString;
|
|
83
89
|
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
84
|
-
}
|
|
90
|
+
} & {
|
|
85
91
|
status: z.ZodLiteral<"error">;
|
|
86
92
|
originCorrelationId: z.ZodString;
|
|
87
|
-
}
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
88
94
|
originCorrelationId: string;
|
|
89
95
|
message: string;
|
|
90
96
|
status: "error";
|
|
@@ -117,6 +123,17 @@ export declare const TM_MATCH_SCHEMA: z.ZodOptional<z.ZodObject<{
|
|
|
117
123
|
sourceValue: string;
|
|
118
124
|
translatedValue: string;
|
|
119
125
|
}>>;
|
|
126
|
+
export declare const TRANSLATION_EXAMPLE_SCHEMA: z.ZodObject<{
|
|
127
|
+
sourceValue: z.ZodString;
|
|
128
|
+
translatedValue: z.ZodString;
|
|
129
|
+
}, "strip", z.ZodTypeAny, {
|
|
130
|
+
sourceValue: string;
|
|
131
|
+
translatedValue: string;
|
|
132
|
+
}, {
|
|
133
|
+
sourceValue: string;
|
|
134
|
+
translatedValue: string;
|
|
135
|
+
}>;
|
|
136
|
+
export type TranslationExample = z.infer<typeof TRANSLATION_EXAMPLE_SCHEMA>;
|
|
120
137
|
export declare const SEGMENT_VALUE_MAX_LENGTH_DEFAULT = 16384;
|
|
121
138
|
export declare const REQUEST_SIZE_LIMIT_MAP: Record<IntegrationEngineEnum, number>;
|
|
122
139
|
declare const JSON_PRIMITIVE_DATA_SCHEMA: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
import { isSupportedLocale } from '@lokalise/supported-languages';
|
|
2
2
|
import { toBooleanPreprocessor } from '@lokalise/zod-extras';
|
|
3
3
|
import z from 'zod';
|
|
4
|
-
import { AsyncRequestCallbackStatusEnum } from
|
|
4
|
+
import { AsyncRequestCallbackStatusEnum } from "./asyncRequestSchemas.js";
|
|
5
5
|
export const FinetunedIntegrationEngineEnum = {
|
|
6
6
|
FINETUNED_OPENAI: 'FT-OpenAI',
|
|
7
7
|
};
|
|
8
8
|
export const AiIntegrationEngineEnum = {
|
|
9
9
|
CLAUDE: 'Claude',
|
|
10
|
-
|
|
10
|
+
GPT: 'GPT',
|
|
11
11
|
GEMINI: 'Gemini',
|
|
12
12
|
...FinetunedIntegrationEngineEnum,
|
|
13
13
|
};
|
|
14
|
+
export const DeprecatedAiIntegrationEngineEnum = {
|
|
15
|
+
CHAT_GPT4: 'ChatGPT-4', // ChatGPT-4 is depreciated in favour of GPT
|
|
16
|
+
};
|
|
14
17
|
export const AI_INTEGRATION_ENGINE_SCHEMA = z
|
|
15
|
-
.nativeEnum(AiIntegrationEngineEnum)
|
|
18
|
+
.nativeEnum({ ...AiIntegrationEngineEnum, ...DeprecatedAiIntegrationEngineEnum })
|
|
19
|
+
.transform((val) => {
|
|
20
|
+
if (val === DeprecatedAiIntegrationEngineEnum.CHAT_GPT4) {
|
|
21
|
+
return AiIntegrationEngineEnum.GPT;
|
|
22
|
+
}
|
|
23
|
+
return val;
|
|
24
|
+
})
|
|
16
25
|
.describe('Indicates which integration should be used to process the request');
|
|
17
26
|
export const MtIntegrationEngineEnum = {
|
|
18
27
|
DEEPL: 'DeepL',
|
|
@@ -27,7 +36,13 @@ export const RealIntegrationEngineEnum = {
|
|
|
27
36
|
...AiIntegrationEngineEnum,
|
|
28
37
|
};
|
|
29
38
|
export const REAL_INTEGRATION_ENGINE_SCHEMA = z
|
|
30
|
-
.nativeEnum(RealIntegrationEngineEnum)
|
|
39
|
+
.nativeEnum({ ...RealIntegrationEngineEnum, ...DeprecatedAiIntegrationEngineEnum })
|
|
40
|
+
.transform((val) => {
|
|
41
|
+
if (val === DeprecatedAiIntegrationEngineEnum.CHAT_GPT4) {
|
|
42
|
+
return AiIntegrationEngineEnum.GPT;
|
|
43
|
+
}
|
|
44
|
+
return val;
|
|
45
|
+
})
|
|
31
46
|
.describe('Indicates which integration should be used to process the request (preferably)');
|
|
32
47
|
export const FORCE_INTEGRATION_SCHEMA = z
|
|
33
48
|
.boolean()
|
|
@@ -76,6 +91,10 @@ export const TM_MATCH_SCHEMA = z
|
|
|
76
91
|
})
|
|
77
92
|
.optional()
|
|
78
93
|
.describe('When defined, the translation will attempt to follow the provided sourceValue and translatedValue translation example');
|
|
94
|
+
export const TRANSLATION_EXAMPLE_SCHEMA = z.object({
|
|
95
|
+
sourceValue: z.string().min(1).max(50_000),
|
|
96
|
+
translatedValue: z.string().min(1).max(50_000),
|
|
97
|
+
});
|
|
79
98
|
export const SEGMENT_VALUE_MAX_LENGTH_DEFAULT = 16384;
|
|
80
99
|
export const REQUEST_SIZE_LIMIT_MAP = {
|
|
81
100
|
/**
|
|
@@ -101,7 +120,7 @@ export const REQUEST_SIZE_LIMIT_MAP = {
|
|
|
101
120
|
*/
|
|
102
121
|
[IntegrationEngineEnum.GEMINI]: SEGMENT_VALUE_MAX_LENGTH_DEFAULT,
|
|
103
122
|
[IntegrationEngineEnum.CLAUDE]: SEGMENT_VALUE_MAX_LENGTH_DEFAULT,
|
|
104
|
-
[IntegrationEngineEnum.
|
|
123
|
+
[IntegrationEngineEnum.GPT]: SEGMENT_VALUE_MAX_LENGTH_DEFAULT,
|
|
105
124
|
[IntegrationEngineEnum.FINETUNED_OPENAI]: SEGMENT_VALUE_MAX_LENGTH_DEFAULT,
|
|
106
125
|
[IntegrationEngineEnum.FAKE]: SEGMENT_VALUE_MAX_LENGTH_DEFAULT,
|
|
107
126
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commonSchemas.js","sourceRoot":"","sources":["../../../../src/sdk/schemas/common/commonSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,CAAC,MAAM,KAAK,CAAA;AAGnB,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAA;AAEzE,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,gBAAgB,EAAE,WAAW;CACrB,CAAA;AAGV,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,MAAM,EAAE,QAAQ;IAChB,
|
|
1
|
+
{"version":3,"file":"commonSchemas.js","sourceRoot":"","sources":["../../../../src/sdk/schemas/common/commonSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,CAAC,MAAM,KAAK,CAAA;AAGnB,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAA;AAEzE,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,gBAAgB,EAAE,WAAW;CACrB,CAAA;AAGV,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,GAAG,8BAA8B;CACzB,CAAA;AAGV,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,SAAS,EAAE,WAAW,EAAE,4CAA4C;CAC5D,CAAA;AAKV,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC;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,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;AAK3F,MAAM,gBAAgB,GAAwB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACxD,CAAC,CAAC,KAAK,CAAC,CAAC,0BAA0B,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAC7F,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,CAAC,gBAAgB,CAAC;KACxB,QAAQ,CAAC,qEAAqE,CAAC;KAC/E,QAAQ,EAAE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
|
-
import type { ObjectValues } from '../../types/common.
|
|
2
|
+
import type { ObjectValues } from '../../types/common.ts';
|
|
3
3
|
export declare const ErrorCodeEnum: {
|
|
4
4
|
readonly ValidationError: "VALIDATION_ERROR";
|
|
5
5
|
readonly ContextNotSupportedError: "CONTEXT_NOT_SUPPORTED";
|
|
@@ -8,13 +8,12 @@ export declare const ErrorCodeEnum: {
|
|
|
8
8
|
readonly LanguagePairNotSupportedError: "LANGUAGE_PAIR_NOT_SUPPORTED";
|
|
9
9
|
};
|
|
10
10
|
export type ErrorCodeEnum = ObjectValues<typeof ErrorCodeEnum>;
|
|
11
|
-
export declare const VALIDATION_ERROR_SCHEMA: z.ZodObject<
|
|
11
|
+
export declare const VALIDATION_ERROR_SCHEMA: z.ZodObject<{
|
|
12
12
|
message: z.ZodString;
|
|
13
|
-
errorCode: z.ZodString;
|
|
14
13
|
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
15
|
-
}
|
|
14
|
+
} & {
|
|
16
15
|
errorCode: z.ZodLiteral<"VALIDATION_ERROR">;
|
|
17
|
-
}
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
17
|
message: string;
|
|
19
18
|
errorCode: "VALIDATION_ERROR";
|
|
20
19
|
details?: Record<string, unknown> | undefined;
|
|
@@ -23,13 +22,12 @@ export declare const VALIDATION_ERROR_SCHEMA: z.ZodObject<z.objectUtil.extendSha
|
|
|
23
22
|
errorCode: "VALIDATION_ERROR";
|
|
24
23
|
details?: Record<string, unknown> | undefined;
|
|
25
24
|
}>;
|
|
26
|
-
export declare const CONTEXT_NOT_SUPPORTED_ERROR_SCHEMA: z.ZodObject<
|
|
25
|
+
export declare const CONTEXT_NOT_SUPPORTED_ERROR_SCHEMA: z.ZodObject<{
|
|
27
26
|
message: z.ZodString;
|
|
28
|
-
errorCode: z.ZodString;
|
|
29
27
|
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
30
|
-
}
|
|
28
|
+
} & {
|
|
31
29
|
errorCode: z.ZodLiteral<"CONTEXT_NOT_SUPPORTED">;
|
|
32
|
-
}
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
31
|
message: string;
|
|
34
32
|
errorCode: "CONTEXT_NOT_SUPPORTED";
|
|
35
33
|
details?: Record<string, unknown> | undefined;
|
|
@@ -38,13 +36,12 @@ export declare const CONTEXT_NOT_SUPPORTED_ERROR_SCHEMA: z.ZodObject<z.objectUti
|
|
|
38
36
|
errorCode: "CONTEXT_NOT_SUPPORTED";
|
|
39
37
|
details?: Record<string, unknown> | undefined;
|
|
40
38
|
}>;
|
|
41
|
-
export declare const INTEGRATION_NOT_AVAILABLE_ERROR_SCHEMA: z.ZodObject<
|
|
39
|
+
export declare const INTEGRATION_NOT_AVAILABLE_ERROR_SCHEMA: z.ZodObject<{
|
|
42
40
|
message: z.ZodString;
|
|
43
|
-
errorCode: z.ZodString;
|
|
44
41
|
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
45
|
-
}
|
|
42
|
+
} & {
|
|
46
43
|
errorCode: z.ZodLiteral<"INTEGRATION_NOT_AVAILABLE_ERROR">;
|
|
47
|
-
}
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
45
|
message: string;
|
|
49
46
|
errorCode: "INTEGRATION_NOT_AVAILABLE_ERROR";
|
|
50
47
|
details?: Record<string, unknown> | undefined;
|
|
@@ -53,13 +50,12 @@ export declare const INTEGRATION_NOT_AVAILABLE_ERROR_SCHEMA: z.ZodObject<z.objec
|
|
|
53
50
|
errorCode: "INTEGRATION_NOT_AVAILABLE_ERROR";
|
|
54
51
|
details?: Record<string, unknown> | undefined;
|
|
55
52
|
}>;
|
|
56
|
-
export declare const INTEGRATION_NOT_ENABLED_ERROR_SCHEMA: z.ZodObject<
|
|
53
|
+
export declare const INTEGRATION_NOT_ENABLED_ERROR_SCHEMA: z.ZodObject<{
|
|
57
54
|
message: z.ZodString;
|
|
58
|
-
errorCode: z.ZodString;
|
|
59
55
|
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
60
|
-
}
|
|
56
|
+
} & {
|
|
61
57
|
errorCode: z.ZodLiteral<"INTEGRATION_NOT_ENABLED_ERROR">;
|
|
62
|
-
}
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
63
59
|
message: string;
|
|
64
60
|
errorCode: "INTEGRATION_NOT_ENABLED_ERROR";
|
|
65
61
|
details?: Record<string, unknown> | undefined;
|
|
@@ -68,13 +64,12 @@ export declare const INTEGRATION_NOT_ENABLED_ERROR_SCHEMA: z.ZodObject<z.objectU
|
|
|
68
64
|
errorCode: "INTEGRATION_NOT_ENABLED_ERROR";
|
|
69
65
|
details?: Record<string, unknown> | undefined;
|
|
70
66
|
}>;
|
|
71
|
-
export declare const LANGUAGE_PAIR_NOT_SUPPORTED_ERROR_SCHEMA: z.ZodObject<
|
|
67
|
+
export declare const LANGUAGE_PAIR_NOT_SUPPORTED_ERROR_SCHEMA: z.ZodObject<{
|
|
72
68
|
message: z.ZodString;
|
|
73
|
-
errorCode: z.ZodString;
|
|
74
69
|
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
75
|
-
}
|
|
70
|
+
} & {
|
|
76
71
|
errorCode: z.ZodLiteral<"LANGUAGE_PAIR_NOT_SUPPORTED">;
|
|
77
|
-
}
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
78
73
|
message: string;
|
|
79
74
|
errorCode: "LANGUAGE_PAIR_NOT_SUPPORTED";
|
|
80
75
|
details?: Record<string, unknown> | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
|
-
import { COMMON_ERROR_RESPONSE_SCHEMA } from
|
|
2
|
+
import { COMMON_ERROR_RESPONSE_SCHEMA } from "./commonSchemas.js";
|
|
3
3
|
export const ErrorCodeEnum = {
|
|
4
4
|
ValidationError: 'VALIDATION_ERROR',
|
|
5
5
|
ContextNotSupportedError: 'CONTEXT_NOT_SUPPORTED',
|
|
@@ -133,17 +133,6 @@ export declare const GLOSSARY_TERM_SCHEMA: z.ZodEffects<z.ZodObject<{
|
|
|
133
133
|
}[] | undefined;
|
|
134
134
|
}>;
|
|
135
135
|
export type GlossaryTerm = z.infer<typeof GLOSSARY_TERM_SCHEMA>;
|
|
136
|
-
export declare const TRANSLATION_EXAMPLE_SCHEMA: z.ZodObject<{
|
|
137
|
-
sourceValue: z.ZodString;
|
|
138
|
-
translatedValue: z.ZodString;
|
|
139
|
-
}, "strip", z.ZodTypeAny, {
|
|
140
|
-
sourceValue: string;
|
|
141
|
-
translatedValue: string;
|
|
142
|
-
}, {
|
|
143
|
-
sourceValue: string;
|
|
144
|
-
translatedValue: string;
|
|
145
|
-
}>;
|
|
146
|
-
export type TranslationExample = z.infer<typeof TRANSLATION_EXAMPLE_SCHEMA>;
|
|
147
136
|
export declare const TRANSLATION_CONTEXT_SCHEMA: z.ZodObject<{
|
|
148
137
|
description: z.ZodOptional<z.ZodString>;
|
|
149
138
|
styleGuide: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
|
-
import { LOCALE_SCHEMA } from
|
|
2
|
+
import { LOCALE_SCHEMA, TRANSLATION_EXAMPLE_SCHEMA } from "./commonSchemas.js";
|
|
3
3
|
// ------------------------------------------
|
|
4
4
|
// Style guide
|
|
5
5
|
// ------------------------------------------
|
|
@@ -66,10 +66,6 @@ export const GLOSSARY_TERM_SCHEMA = z
|
|
|
66
66
|
.refine(({ translations, translatable, forbidden, caseSensitive }) => !!translations || !translatable || caseSensitive || forbidden, {
|
|
67
67
|
message: 'You should either provide `translations` for the term or mark it as `translatable: false`, `caseSensitive: true`, or `forbidden: true`',
|
|
68
68
|
});
|
|
69
|
-
export const TRANSLATION_EXAMPLE_SCHEMA = z.object({
|
|
70
|
-
sourceValue: z.string().min(1).max(50_000),
|
|
71
|
-
translatedValue: z.string().min(1).max(50_000),
|
|
72
|
-
});
|
|
73
69
|
export const TRANSLATION_CONTEXT_SCHEMA = z
|
|
74
70
|
.object({
|
|
75
71
|
description: z
|
|
@@ -89,7 +85,7 @@ export const TRANSLATION_CONTEXT_SCHEMA = z
|
|
|
89
85
|
translationExamples: z
|
|
90
86
|
.array(TRANSLATION_EXAMPLE_SCHEMA)
|
|
91
87
|
.optional()
|
|
92
|
-
.describe('When defined, the translation will attempt to follow the provided sourceValue and translatedValue translation example'),
|
|
88
|
+
.describe('This field is deprecated, please use "translationExamples" at the "segment" level instead. When defined, the translation will attempt to follow the provided sourceValue and translatedValue translation example'),
|
|
93
89
|
})
|
|
94
90
|
.describe('Helpful translation context');
|
|
95
91
|
export const TEXT_REWRITING_CONTEXT = TRANSLATION_CONTEXT_SCHEMA.omit({ targetPluralForms: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translationContextSchemas.js","sourceRoot":"","sources":["../../../../src/sdk/schemas/common/translationContextSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"translationContextSchemas.js","sourceRoot":"","sources":["../../../../src/sdk/schemas/common/translationContextSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,OAAO,EAAE,aAAa,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAA;AAE9E,6CAA6C;AAC7C,cAAc;AACd,6CAA6C;AAE7C,MAAM,6BAA6B,GAAG,CAAC;KACpC,MAAM,CAAC;IACN,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC5E,WAAW,EAAE,CAAC;SACX,IAAI,CAAC,CAAC,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;SACxE,QAAQ,EAAE;IACb,gBAAgB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE;IACtE,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC,QAAQ,EAAE;CAClE,CAAC;KACD,QAAQ,CAAC,gDAAgD,CAAC;KAC1D,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,sBAAsB,CAAC,UAAU,CAAC,EAAE;IAC1D,OAAO,EAAE,4CAA4C;CACtD,CAAC,CAAA;AAIJ,MAAM,2BAA2B,GAAG,CAAC;KAClC,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iEAAiE,CAAC;CAC7F,CAAC;KACD,QAAQ,CAAC,2BAA2B,CAAC,CAAA;AAIxC,MAAM,kBA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