@lokalise/polyglot-sdk 6.0.1 → 7.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 +2 -0
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/sdk/PolyglotClient.d.ts +4 -8
- package/dist/sdk/PolyglotClient.js +3 -21
- package/dist/sdk/PolyglotClient.js.map +1 -1
- package/dist/sdk/schemas/common/asyncRequestSchemas.d.ts +25 -0
- package/dist/sdk/schemas/common/asyncRequestSchemas.js +37 -0
- package/dist/sdk/schemas/common/asyncRequestSchemas.js.map +1 -0
- package/dist/sdk/schemas/common/commonSchemas.d.ts +68 -0
- package/dist/sdk/schemas/common/commonSchemas.js +61 -0
- package/dist/sdk/schemas/common/commonSchemas.js.map +1 -0
- package/dist/sdk/schemas/common/requestContextSchemas.d.ts +278 -0
- package/dist/sdk/schemas/common/requestContextSchemas.js +85 -0
- package/dist/sdk/schemas/common/requestContextSchemas.js.map +1 -0
- package/dist/sdk/schemas/translation/sharedSchemas.d.ts +4 -0
- package/dist/sdk/schemas/translation/sharedSchemas.js +10 -0
- package/dist/sdk/schemas/translation/sharedSchemas.js.map +1 -0
- package/dist/sdk/schemas/translation/syncTranslationV2Schemas.d.ts +707 -0
- package/dist/sdk/schemas/translation/syncTranslationV2Schemas.js +65 -0
- package/dist/sdk/schemas/translation/syncTranslationV2Schemas.js.map +1 -0
- package/dist/sdk/types/requests.d.ts +2 -0
- package/package.json +11 -10
- package/dist/sdk/polyglotChunkHandler.d.ts +0 -7
- package/dist/sdk/polyglotChunkHandler.js +0 -48
- package/dist/sdk/polyglotChunkHandler.js.map +0 -1
- package/dist/sdk/segmentUtils.d.ts +0 -2
- package/dist/sdk/segmentUtils.js +0 -13
- package/dist/sdk/segmentUtils.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,3 +4,5 @@ export * from './sdk/types/client';
|
|
|
4
4
|
export * from './sdk/types/requests';
|
|
5
5
|
export * from './sdk/types/responses';
|
|
6
6
|
export * from './sdk/types/callbacks';
|
|
7
|
+
export { SYNC_TRANSLATION_V2_BODY_SCHEMA, SYNC_TRANSLATION_V2_HEADERS_SCHEMA, SYNC_TRANSLATION_V2_RESPONSE_SCHEMA, } from './sdk/schemas/translation/syncTranslationV2Schemas';
|
|
8
|
+
export type { SyncTranslationV2Body, SyncTranslationV2Headers, SyncTranslationV2Response, } from './sdk/schemas/translation/syncTranslationV2Schemas';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PolyglotError = exports.PolyglotClient = void 0;
|
|
3
|
+
exports.SYNC_TRANSLATION_V2_RESPONSE_SCHEMA = exports.SYNC_TRANSLATION_V2_HEADERS_SCHEMA = exports.SYNC_TRANSLATION_V2_BODY_SCHEMA = exports.PolyglotError = exports.PolyglotClient = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
var PolyglotClient_1 = require("./sdk/PolyglotClient");
|
|
6
6
|
Object.defineProperty(exports, "PolyglotClient", { enumerable: true, get: function () { return PolyglotClient_1.PolyglotClient; } });
|
|
@@ -10,4 +10,8 @@ tslib_1.__exportStar(require("./sdk/types/client"), exports);
|
|
|
10
10
|
tslib_1.__exportStar(require("./sdk/types/requests"), exports);
|
|
11
11
|
tslib_1.__exportStar(require("./sdk/types/responses"), exports);
|
|
12
12
|
tslib_1.__exportStar(require("./sdk/types/callbacks"), exports);
|
|
13
|
+
var syncTranslationV2Schemas_1 = require("./sdk/schemas/translation/syncTranslationV2Schemas");
|
|
14
|
+
Object.defineProperty(exports, "SYNC_TRANSLATION_V2_BODY_SCHEMA", { enumerable: true, get: function () { return syncTranslationV2Schemas_1.SYNC_TRANSLATION_V2_BODY_SCHEMA; } });
|
|
15
|
+
Object.defineProperty(exports, "SYNC_TRANSLATION_V2_HEADERS_SCHEMA", { enumerable: true, get: function () { return syncTranslationV2Schemas_1.SYNC_TRANSLATION_V2_HEADERS_SCHEMA; } });
|
|
16
|
+
Object.defineProperty(exports, "SYNC_TRANSLATION_V2_RESPONSE_SCHEMA", { enumerable: true, get: function () { return syncTranslationV2Schemas_1.SYNC_TRANSLATION_V2_RESPONSE_SCHEMA; } });
|
|
13
17
|
//# 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,uDAAqD;AAA5C,gHAAA,cAAc,OAAA;AACvB,4DAA0D;AAAjD,8GAAA,aAAa,OAAA;AACtB,6DAAkC;AAClC,+DAAoC;AACpC,gEAAqC;AACrC,gEAAqC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,uDAAqD;AAA5C,gHAAA,cAAc,OAAA;AACvB,4DAA0D;AAAjD,8GAAA,aAAa,OAAA;AACtB,6DAAkC;AAClC,+DAAoC;AACpC,gEAAqC;AACrC,gEAAqC;AAErC,+FAI2D;AAHzD,2IAAA,+BAA+B,OAAA;AAC/B,8IAAA,kCAAkC,OAAA;AAClC,+IAAA,mCAAmC,OAAA"}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import type { Either } from '@lokalise/node-core';
|
|
2
2
|
import type { RequestResult } from 'undici-retry';
|
|
3
|
+
import type { SyncTranslationV2Body, SyncTranslationV2Response } from './schemas/translation/syncTranslationV2Schemas';
|
|
3
4
|
import type { ClientOptions, ClientOptionsWithRequestContext, PolyglotClientConfig } from './types/client';
|
|
4
|
-
import type { GenerateVariantsRequest, LqaAsyncRequestBody, LqaSyncRequestBody, ScoreTranslationsRequest, TranslateAsyncRequestBody
|
|
5
|
-
import type {
|
|
5
|
+
import type { GenerateVariantsRequest, LqaAsyncRequestBody, LqaSyncRequestBody, ScoreTranslationsRequest, TranslateAsyncRequestBody } from './types/requests';
|
|
6
|
+
import type { LqaSyncResponse, ScoreTranslationsResponse, TranslateAsyncResponse } from './types/responses';
|
|
6
7
|
export declare class PolyglotClient {
|
|
7
8
|
private readonly client;
|
|
8
9
|
private readonly clientHeaders;
|
|
9
10
|
private readonly retryConfig;
|
|
10
11
|
private readonly logger?;
|
|
11
12
|
constructor({ baseUrl, jwtToken, retryConfig, logger }: PolyglotClientConfig);
|
|
12
|
-
/**
|
|
13
|
-
* Translates segments in content units via /translate-sync API. Will chunk the request automatically into batches if
|
|
14
|
-
* the amount of segments exceeds synchronous API limits and will yield the results separately.
|
|
15
|
-
*/
|
|
16
|
-
translateSyncIterative(request: TranslateSyncRequest, options?: ClientOptions): AsyncGenerator<PolyglotClientSyncIterativeResponse<ContentUnitTranslationResponse>>;
|
|
17
13
|
/**
|
|
18
14
|
* Re-translates a given translation pair and provides several different variants. Can take previously generated
|
|
19
15
|
* variants as an input - in attempt to avoid repetition.
|
|
@@ -23,7 +19,7 @@ export declare class PolyglotClient {
|
|
|
23
19
|
* Scores passed translations
|
|
24
20
|
*/
|
|
25
21
|
scoreTranslations(request: ScoreTranslationsRequest, options?: ClientOptions): Promise<ScoreTranslationsResponse>;
|
|
26
|
-
|
|
22
|
+
translateSync(requestBody: SyncTranslationV2Body, options?: ClientOptions): Promise<RequestResult<SyncTranslationV2Response>>;
|
|
27
23
|
translateAsync(requestBody: TranslateAsyncRequestBody, options: ClientOptionsWithRequestContext): Promise<Either<Error, TranslateAsyncResponse>>;
|
|
28
24
|
lqaAsync(requestBody: LqaAsyncRequestBody, options: ClientOptionsWithRequestContext): Promise<Either<Error, TranslateAsyncResponse>>;
|
|
29
25
|
lqaSync(requestBody: LqaSyncRequestBody, options: ClientOptionsWithRequestContext): Promise<RequestResult<LqaSyncResponse>>;
|
|
@@ -4,8 +4,6 @@ exports.PolyglotClient = void 0;
|
|
|
4
4
|
const node_core_1 = require("@lokalise/node-core");
|
|
5
5
|
const typeUtils_1 = require("@lokalise/node-core/dist/src/utils/typeUtils");
|
|
6
6
|
const PolyglotError_1 = require("./errors/PolyglotError");
|
|
7
|
-
const polyglotChunkHandler_1 = require("./polyglotChunkHandler");
|
|
8
|
-
const segmentUtils_1 = require("./segmentUtils");
|
|
9
7
|
const DEFAULT_CLIENT_OPTIONS = {
|
|
10
8
|
timeout: 30000,
|
|
11
9
|
};
|
|
@@ -42,20 +40,6 @@ class PolyglotClient {
|
|
|
42
40
|
};
|
|
43
41
|
this.logger = logger;
|
|
44
42
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Translates segments in content units via /translate-sync API. Will chunk the request automatically into batches if
|
|
47
|
-
* the amount of segments exceeds synchronous API limits and will yield the results separately.
|
|
48
|
-
*/
|
|
49
|
-
async *translateSyncIterative(request, options = DEFAULT_CLIENT_OPTIONS) {
|
|
50
|
-
const resolvedOptions = resolveOptions(options);
|
|
51
|
-
const chunks = (0, polyglotChunkHandler_1.getChunkedTranslationRequest)(request);
|
|
52
|
-
for (const requestChunked of chunks) {
|
|
53
|
-
yield {
|
|
54
|
-
response: await this.callTranslateSyncApi(requestChunked, resolvedOptions),
|
|
55
|
-
segmentIdsProcessedByContentUnitId: (0, segmentUtils_1.groupTranslationSegmentIdsProcessedByContentUnitId)(requestChunked.contentUnits),
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
43
|
/**
|
|
60
44
|
* Re-translates a given translation pair and provides several different variants. Can take previously generated
|
|
61
45
|
* variants as an input - in attempt to avoid repetition.
|
|
@@ -118,11 +102,11 @@ class PolyglotClient {
|
|
|
118
102
|
});
|
|
119
103
|
return response.body;
|
|
120
104
|
}
|
|
121
|
-
async
|
|
105
|
+
async translateSync(requestBody, options = DEFAULT_CLIENT_OPTIONS) {
|
|
122
106
|
const resolvedOptions = resolveOptions(options);
|
|
123
107
|
const requestLabel = 'Translate synchronously (Polyglot)';
|
|
124
|
-
|
|
125
|
-
return (0, node_core_1.sendPost)(this.client, '/
|
|
108
|
+
return await this.wrapWithInstrumentation(() => {
|
|
109
|
+
return (0, node_core_1.sendPost)(this.client, '/v2/content/actions/translate-sync', requestBody, {
|
|
126
110
|
reqContext: resolvedOptions.reqContext,
|
|
127
111
|
retryConfig: this.retryConfig,
|
|
128
112
|
timeout: resolvedOptions.timeout,
|
|
@@ -136,14 +120,12 @@ class PolyglotClient {
|
|
|
136
120
|
requestLabel,
|
|
137
121
|
callMetadata: {
|
|
138
122
|
...resolvedOptions.metadata,
|
|
139
|
-
languagePair: `${request.sourceLocale} to ${request.targetLocale}`,
|
|
140
123
|
fakeProcessing: JSON.stringify(resolvedOptions.fakeProcessing),
|
|
141
124
|
reqContext: JSON.stringify({
|
|
142
125
|
reqId: resolvedOptions.reqContext?.reqId,
|
|
143
126
|
}),
|
|
144
127
|
},
|
|
145
128
|
});
|
|
146
|
-
return result.body.contentUnits;
|
|
147
129
|
}
|
|
148
130
|
async translateAsync(requestBody, options) {
|
|
149
131
|
const result = await this.callAsyncApi('/v1/content/actions/translate-async', requestBody, options, 'Translate asynchronously (Polyglot)');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolyglotClient.js","sourceRoot":"","sources":["../../src/sdk/PolyglotClient.ts"],"names":[],"mappings":";;;AACA,mDAO4B;AAE5B,4EAAsE;AAKtE,0DAAsD;
|
|
1
|
+
{"version":3,"file":"PolyglotClient.js","sourceRoot":"","sources":["../../src/sdk/PolyglotClient.ts"],"names":[],"mappings":";;;AACA,mDAO4B;AAE5B,4EAAsE;AAKtE,0DAAsD;AA0BtD,MAAM,sBAAsB,GAAkB;IAC5C,OAAO,EAAE,KAAK;CACf,CAAA;AAED,SAAS,cAAc,CAAC,OAAsB;IAC5C,OAAO;QACL,GAAG,OAAO;QACV,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC,OAAO;KAC9F,CAA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,CAAC,MAAM,EAAE,IAAI,CAAC;gBAChB,GAAG,YAAY;gBACf,UAAU;gBACV,GAAG,EAAE,aAAa,YAAY,EAAE;gBAChC,QAAQ,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS;aACxC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAEO,SAAS,CAAC,CAAU;QAC1B,IAAI,KAAwB,CAAA;QAC5B,IAAI,IAAA,mBAAO,EAAC,CAAC,CAAC,EAAE,CAAC;YACf,KAAK,GAAG,IAAA,iCAAqB,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,6BAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC7D,CAAC;aAAM,CAAC;YACN,KAAK,GAAG,IAAI,yBAAa,CAAC;gBACxB,OAAO,EAAE,eAAe;gBACxB,SAAS,EAAE,eAAe;gBAC1B,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;aACtC,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,KAAK,CAAA;IACd,CAAC;CACF;AA7UD,wCA6UC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const ORIGIN_CORRELATION_ID_SCHEMA: z.ZodString;
|
|
3
|
+
export declare const OWNER_ID_SCHEMA: z.ZodString;
|
|
4
|
+
export declare const TENANT_ID_SCHEMA: z.ZodString;
|
|
5
|
+
export declare const CALLBACK_URL_SCHEMA: z.ZodString;
|
|
6
|
+
export declare const CALLBACK_TOKEN_SCHEMA: z.ZodString;
|
|
7
|
+
export declare const ASYNC_REQUEST_SCHEMA: z.ZodObject<{
|
|
8
|
+
originCorrelationId: z.ZodString;
|
|
9
|
+
ownerId: z.ZodString;
|
|
10
|
+
tenantId: z.ZodString;
|
|
11
|
+
callbackUrl: z.ZodString;
|
|
12
|
+
callbackToken: z.ZodString;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
originCorrelationId: string;
|
|
15
|
+
tenantId: string;
|
|
16
|
+
ownerId: string;
|
|
17
|
+
callbackUrl: string;
|
|
18
|
+
callbackToken: string;
|
|
19
|
+
}, {
|
|
20
|
+
originCorrelationId: string;
|
|
21
|
+
tenantId: string;
|
|
22
|
+
ownerId: string;
|
|
23
|
+
callbackUrl: string;
|
|
24
|
+
callbackToken: string;
|
|
25
|
+
}>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ASYNC_REQUEST_SCHEMA = exports.CALLBACK_TOKEN_SCHEMA = exports.CALLBACK_URL_SCHEMA = exports.TENANT_ID_SCHEMA = exports.OWNER_ID_SCHEMA = exports.ORIGIN_CORRELATION_ID_SCHEMA = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const zod_1 = tslib_1.__importDefault(require("zod"));
|
|
6
|
+
exports.ORIGIN_CORRELATION_ID_SCHEMA = zod_1.default
|
|
7
|
+
.string()
|
|
8
|
+
.min(1)
|
|
9
|
+
.max(100)
|
|
10
|
+
.describe('A unique identifier for a client-side request, returned in the callback body to match the callback with the original request.');
|
|
11
|
+
exports.OWNER_ID_SCHEMA = zod_1.default
|
|
12
|
+
.string()
|
|
13
|
+
.uuid()
|
|
14
|
+
.describe('ID of a hierarchical entity owning this portion of data, e.g. a `projectId` or a `workspaceId`');
|
|
15
|
+
exports.TENANT_ID_SCHEMA = zod_1.default
|
|
16
|
+
.string()
|
|
17
|
+
.min(1)
|
|
18
|
+
.max(20)
|
|
19
|
+
.describe('ID of a system consuming Polyglot API, e.g. `autopilot`');
|
|
20
|
+
exports.CALLBACK_URL_SCHEMA = zod_1.default
|
|
21
|
+
.string()
|
|
22
|
+
.url()
|
|
23
|
+
.max(2048)
|
|
24
|
+
.describe('The URL to which the callback should be sent as HTTP POST request once the job has finished');
|
|
25
|
+
exports.CALLBACK_TOKEN_SCHEMA = zod_1.default
|
|
26
|
+
.string()
|
|
27
|
+
.min(1)
|
|
28
|
+
.max(2048)
|
|
29
|
+
.describe('A security token that will be included in the callback request as a `Authorization` Bearer header for authentication and verification purposes');
|
|
30
|
+
exports.ASYNC_REQUEST_SCHEMA = zod_1.default.object({
|
|
31
|
+
originCorrelationId: exports.ORIGIN_CORRELATION_ID_SCHEMA,
|
|
32
|
+
ownerId: exports.OWNER_ID_SCHEMA,
|
|
33
|
+
tenantId: exports.TENANT_ID_SCHEMA,
|
|
34
|
+
callbackUrl: exports.CALLBACK_URL_SCHEMA,
|
|
35
|
+
callbackToken: exports.CALLBACK_TOKEN_SCHEMA,
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=asyncRequestSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asyncRequestSchemas.js","sourceRoot":"","sources":["../../../../src/sdk/schemas/common/asyncRequestSchemas.ts"],"names":[],"mappings":";;;;AAAA,sDAAmB;AAEN,QAAA,4BAA4B,GAAG,aAAC;KAC1C,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,QAAQ,CACP,+HAA+H,CAChI,CAAA;AAEU,QAAA,eAAe,GAAG,aAAC;KAC7B,MAAM,EAAE;KACR,IAAI,EAAE;KACN,QAAQ,CACP,gGAAgG,CACjG,CAAA;AAEU,QAAA,gBAAgB,GAAG,aAAC;KAC9B,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,EAAE,CAAC;KACP,QAAQ,CAAC,yDAAyD,CAAC,CAAA;AAEzD,QAAA,mBAAmB,GAAG,aAAC;KACjC,MAAM,EAAE;KACR,GAAG,EAAE;KACL,GAAG,CAAC,IAAI,CAAC;KACT,QAAQ,CACP,6FAA6F,CAC9F,CAAA;AAEU,QAAA,qBAAqB,GAAG,aAAC;KACnC,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,IAAI,CAAC;KACT,QAAQ,CACP,gJAAgJ,CACjJ,CAAA;AAEU,QAAA,oBAAoB,GAAG,aAAC,CAAC,MAAM,CAAC;IAC3C,mBAAmB,EAAE,oCAA4B;IACjD,OAAO,EAAE,uBAAe;IACxB,QAAQ,EAAE,wBAAgB;IAC1B,WAAW,EAAE,2BAAmB;IAChC,aAAa,EAAE,6BAAqB;CACrC,CAAC,CAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const AiIntegrationEngineEnum: {
|
|
3
|
+
readonly CLAUDE: "Claude";
|
|
4
|
+
readonly CHAT_GPT4: "ChatGPT-4";
|
|
5
|
+
readonly GEMINI: "Gemini";
|
|
6
|
+
};
|
|
7
|
+
export declare const AI_INTEGRATION_ENGINE_SCHEMA: z.ZodNativeEnum<{
|
|
8
|
+
readonly CLAUDE: "Claude";
|
|
9
|
+
readonly CHAT_GPT4: "ChatGPT-4";
|
|
10
|
+
readonly GEMINI: "Gemini";
|
|
11
|
+
}>;
|
|
12
|
+
export declare const MtIntegrationEngineEnum: {
|
|
13
|
+
readonly DEEPL: "DeepL";
|
|
14
|
+
readonly GOOGLE_TRANSLATE: "GoogleTranslate";
|
|
15
|
+
readonly MICROSOFT_TRANSLATOR: "MicrosoftTranslator";
|
|
16
|
+
};
|
|
17
|
+
export declare const MT_INTEGRATION_ENGINE_SCHEMA: z.ZodNativeEnum<{
|
|
18
|
+
readonly DEEPL: "DeepL";
|
|
19
|
+
readonly GOOGLE_TRANSLATE: "GoogleTranslate";
|
|
20
|
+
readonly MICROSOFT_TRANSLATOR: "MicrosoftTranslator";
|
|
21
|
+
}>;
|
|
22
|
+
export declare const RealIntegrationEngineEnum: {
|
|
23
|
+
readonly CLAUDE: "Claude";
|
|
24
|
+
readonly CHAT_GPT4: "ChatGPT-4";
|
|
25
|
+
readonly GEMINI: "Gemini";
|
|
26
|
+
readonly DEEPL: "DeepL";
|
|
27
|
+
readonly GOOGLE_TRANSLATE: "GoogleTranslate";
|
|
28
|
+
readonly MICROSOFT_TRANSLATOR: "MicrosoftTranslator";
|
|
29
|
+
};
|
|
30
|
+
export declare const REAL_INTEGRATION_ENGINE_SCHEMA: z.ZodNativeEnum<{
|
|
31
|
+
readonly CLAUDE: "Claude";
|
|
32
|
+
readonly CHAT_GPT4: "ChatGPT-4";
|
|
33
|
+
readonly GEMINI: "Gemini";
|
|
34
|
+
readonly DEEPL: "DeepL";
|
|
35
|
+
readonly GOOGLE_TRANSLATE: "GoogleTranslate";
|
|
36
|
+
readonly MICROSOFT_TRANSLATOR: "MicrosoftTranslator";
|
|
37
|
+
}>;
|
|
38
|
+
export declare const COMMON_ERROR_RESPONSE_SCHEMA: z.ZodObject<{
|
|
39
|
+
message: z.ZodString;
|
|
40
|
+
errorCode: z.ZodString;
|
|
41
|
+
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
message: string;
|
|
44
|
+
errorCode: string;
|
|
45
|
+
details?: Record<string, unknown> | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
message: string;
|
|
48
|
+
errorCode: string;
|
|
49
|
+
details?: Record<string, unknown> | undefined;
|
|
50
|
+
}>;
|
|
51
|
+
export declare const COMMON_REQUEST_HEADERS_SCHEMA: z.ZodObject<{
|
|
52
|
+
'x-fake-processing': z.ZodOptional<z.ZodEffects<z.ZodBoolean, boolean, unknown>>;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
'x-fake-processing'?: boolean | undefined;
|
|
55
|
+
}, {
|
|
56
|
+
'x-fake-processing'?: unknown;
|
|
57
|
+
}>;
|
|
58
|
+
export declare const LOCALE_SCHEMA: z.ZodEffects<z.ZodString, string, string>;
|
|
59
|
+
export declare const TM_MATCH_SCHEMA: z.ZodOptional<z.ZodObject<{
|
|
60
|
+
sourceValue: z.ZodString;
|
|
61
|
+
translatedValue: z.ZodString;
|
|
62
|
+
}, "strip", z.ZodTypeAny, {
|
|
63
|
+
sourceValue: string;
|
|
64
|
+
translatedValue: string;
|
|
65
|
+
}, {
|
|
66
|
+
sourceValue: string;
|
|
67
|
+
translatedValue: string;
|
|
68
|
+
}>>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TM_MATCH_SCHEMA = exports.LOCALE_SCHEMA = exports.COMMON_REQUEST_HEADERS_SCHEMA = exports.COMMON_ERROR_RESPONSE_SCHEMA = exports.REAL_INTEGRATION_ENGINE_SCHEMA = exports.RealIntegrationEngineEnum = exports.MT_INTEGRATION_ENGINE_SCHEMA = exports.MtIntegrationEngineEnum = exports.AI_INTEGRATION_ENGINE_SCHEMA = exports.AiIntegrationEngineEnum = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const supported_languages_1 = require("@lokalise/supported-languages");
|
|
6
|
+
const zod_extras_1 = require("@lokalise/zod-extras");
|
|
7
|
+
const zod_1 = tslib_1.__importDefault(require("zod"));
|
|
8
|
+
exports.AiIntegrationEngineEnum = {
|
|
9
|
+
CLAUDE: 'Claude',
|
|
10
|
+
CHAT_GPT4: 'ChatGPT-4',
|
|
11
|
+
GEMINI: 'Gemini',
|
|
12
|
+
};
|
|
13
|
+
exports.AI_INTEGRATION_ENGINE_SCHEMA = zod_1.default
|
|
14
|
+
.nativeEnum(exports.AiIntegrationEngineEnum)
|
|
15
|
+
.describe('Indicates which integration should be used to process the request');
|
|
16
|
+
exports.MtIntegrationEngineEnum = {
|
|
17
|
+
DEEPL: 'DeepL',
|
|
18
|
+
GOOGLE_TRANSLATE: 'GoogleTranslate',
|
|
19
|
+
MICROSOFT_TRANSLATOR: 'MicrosoftTranslator',
|
|
20
|
+
};
|
|
21
|
+
exports.MT_INTEGRATION_ENGINE_SCHEMA = zod_1.default
|
|
22
|
+
.nativeEnum(exports.MtIntegrationEngineEnum)
|
|
23
|
+
.describe('Indicates which integration should be used to process the request');
|
|
24
|
+
exports.RealIntegrationEngineEnum = {
|
|
25
|
+
...exports.MtIntegrationEngineEnum,
|
|
26
|
+
...exports.AiIntegrationEngineEnum,
|
|
27
|
+
};
|
|
28
|
+
exports.REAL_INTEGRATION_ENGINE_SCHEMA = zod_1.default
|
|
29
|
+
.nativeEnum(exports.RealIntegrationEngineEnum)
|
|
30
|
+
.describe('Indicates which integration should be used to process the request');
|
|
31
|
+
exports.COMMON_ERROR_RESPONSE_SCHEMA = zod_1.default
|
|
32
|
+
.object({
|
|
33
|
+
message: zod_1.default.string().describe('Error message'),
|
|
34
|
+
errorCode: zod_1.default.string().describe('Error-specific code'),
|
|
35
|
+
details: zod_1.default
|
|
36
|
+
.record(zod_1.default.string(), zod_1.default.unknown())
|
|
37
|
+
.describe('A set of error-specific details to help to identify the cause')
|
|
38
|
+
.optional(),
|
|
39
|
+
})
|
|
40
|
+
.describe('Error details for unsuccessful operation');
|
|
41
|
+
exports.COMMON_REQUEST_HEADERS_SCHEMA = zod_1.default.object({
|
|
42
|
+
'x-fake-processing': zod_1.default
|
|
43
|
+
.preprocess(zod_extras_1.toBooleanPreprocessor, zod_1.default.boolean())
|
|
44
|
+
.describe('If passed as true, it will provide “faked” results instead of calling real integrations.')
|
|
45
|
+
.optional(),
|
|
46
|
+
});
|
|
47
|
+
exports.LOCALE_SCHEMA = zod_1.default
|
|
48
|
+
.string()
|
|
49
|
+
.min(1)
|
|
50
|
+
.describe('Language locale tag, e.g. `sr-Latn-CS`')
|
|
51
|
+
.refine(supported_languages_1.isSupportedLocale, {
|
|
52
|
+
message: 'Invalid locale',
|
|
53
|
+
});
|
|
54
|
+
exports.TM_MATCH_SCHEMA = zod_1.default
|
|
55
|
+
.object({
|
|
56
|
+
sourceValue: zod_1.default.string().min(1).max(5000),
|
|
57
|
+
translatedValue: zod_1.default.string().min(1).max(5000),
|
|
58
|
+
})
|
|
59
|
+
.optional()
|
|
60
|
+
.describe('When defined, the translation will attempt to follow the provided sourceValue and translatedValue translation example');
|
|
61
|
+
//# sourceMappingURL=commonSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonSchemas.js","sourceRoot":"","sources":["../../../../src/sdk/schemas/common/commonSchemas.ts"],"names":[],"mappings":";;;;AAAA,uEAAiE;AACjE,qDAA4D;AAC5D,sDAAmB;AAEN,QAAA,uBAAuB,GAAG;IACrC,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;CACR,CAAA;AAEG,QAAA,4BAA4B,GAAG,aAAC;KAC1C,UAAU,CAAC,+BAAuB,CAAC;KACnC,QAAQ,CAAC,mEAAmE,CAAC,CAAA;AAEnE,QAAA,uBAAuB,GAAG;IACrC,KAAK,EAAE,OAAO;IACd,gBAAgB,EAAE,iBAAiB;IACnC,oBAAoB,EAAE,qBAAqB;CACnC,CAAA;AAEG,QAAA,4BAA4B,GAAG,aAAC;KAC1C,UAAU,CAAC,+BAAuB,CAAC;KACnC,QAAQ,CAAC,mEAAmE,CAAC,CAAA;AAEnE,QAAA,yBAAyB,GAAG;IACvC,GAAG,+BAAuB;IAC1B,GAAG,+BAAuB;CAClB,CAAA;AAEG,QAAA,8BAA8B,GAAG,aAAC;KAC5C,UAAU,CAAC,iCAAyB,CAAC;KACrC,QAAQ,CAAC,mEAAmE,CAAC,CAAA;AAEnE,QAAA,4BAA4B,GAAG,aAAC;KAC1C,MAAM,CAAC;IACN,OAAO,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;IAC7C,SAAS,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IACrD,OAAO,EAAE,aAAC;SACP,MAAM,CAAC,aAAC,CAAC,MAAM,EAAE,EAAE,aAAC,CAAC,OAAO,EAAE,CAAC;SAC/B,QAAQ,CAAC,+DAA+D,CAAC;SACzE,QAAQ,EAAE;CACd,CAAC;KACD,QAAQ,CAAC,0CAA0C,CAAC,CAAA;AAE1C,QAAA,6BAA6B,GAAG,aAAC,CAAC,MAAM,CAAC;IACpD,mBAAmB,EAAE,aAAC;SACnB,UAAU,CAAC,kCAAqB,EAAE,aAAC,CAAC,OAAO,EAAE,CAAC;SAC9C,QAAQ,CACP,0FAA0F,CAC3F;SACA,QAAQ,EAAE;CACd,CAAC,CAAA;AAEW,QAAA,aAAa,GAAG,aAAC;KAC3B,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,QAAQ,CAAC,wCAAwC,CAAC;KAClD,MAAM,CAAC,uCAAiB,EAAE;IACzB,OAAO,EAAE,gBAAgB;CAC1B,CAAC,CAAA;AAES,QAAA,eAAe,GAAG,aAAC;KAC7B,MAAM,CAAC;IACN,WAAW,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IACxC,eAAe,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;CAC7C,CAAC;KACD,QAAQ,EAAE;KACV,QAAQ,CACP,uHAAuH,CACxH,CAAA"}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
declare const STRUCTURED_STYLE_GUIDE_SCHEMA: z.ZodEffects<z.ZodObject<{
|
|
3
|
+
targetAudience: z.ZodOptional<z.ZodEnum<["general", "technical", "non-technical"]>>;
|
|
4
|
+
toneOfVoice: z.ZodOptional<z.ZodEnum<["friendly", "empowering", "informative", "supportive", "elegant"]>>;
|
|
5
|
+
levelOfFormality: z.ZodOptional<z.ZodEnum<["informal", "formal", "neutral"]>>;
|
|
6
|
+
generalRule: z.ZodOptional<z.ZodEnum<["active-voice", "passive-voice"]>>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
targetAudience?: "general" | "technical" | "non-technical" | undefined;
|
|
9
|
+
toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
|
|
10
|
+
levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
|
|
11
|
+
generalRule?: "active-voice" | "passive-voice" | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
targetAudience?: "general" | "technical" | "non-technical" | undefined;
|
|
14
|
+
toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
|
|
15
|
+
levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
|
|
16
|
+
generalRule?: "active-voice" | "passive-voice" | undefined;
|
|
17
|
+
}>, {
|
|
18
|
+
targetAudience?: "general" | "technical" | "non-technical" | undefined;
|
|
19
|
+
toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
|
|
20
|
+
levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
|
|
21
|
+
generalRule?: "active-voice" | "passive-voice" | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
targetAudience?: "general" | "technical" | "non-technical" | undefined;
|
|
24
|
+
toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
|
|
25
|
+
levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
|
|
26
|
+
generalRule?: "active-voice" | "passive-voice" | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
export type StructuredStyleGuide = z.infer<typeof STRUCTURED_STYLE_GUIDE_SCHEMA>;
|
|
29
|
+
declare const FREEFORM_STYLE_GUIDE_SCHEMA: z.ZodObject<{
|
|
30
|
+
text: z.ZodString;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
text: string;
|
|
33
|
+
}, {
|
|
34
|
+
text: string;
|
|
35
|
+
}>;
|
|
36
|
+
export type FreeformStyleGuide = z.infer<typeof FREEFORM_STYLE_GUIDE_SCHEMA>;
|
|
37
|
+
declare const STYLE_GUIDE_SCHEMA: z.ZodUnion<[z.ZodObject<{
|
|
38
|
+
text: z.ZodString;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
text: string;
|
|
41
|
+
}, {
|
|
42
|
+
text: string;
|
|
43
|
+
}>, z.ZodEffects<z.ZodObject<{
|
|
44
|
+
targetAudience: z.ZodOptional<z.ZodEnum<["general", "technical", "non-technical"]>>;
|
|
45
|
+
toneOfVoice: z.ZodOptional<z.ZodEnum<["friendly", "empowering", "informative", "supportive", "elegant"]>>;
|
|
46
|
+
levelOfFormality: z.ZodOptional<z.ZodEnum<["informal", "formal", "neutral"]>>;
|
|
47
|
+
generalRule: z.ZodOptional<z.ZodEnum<["active-voice", "passive-voice"]>>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
targetAudience?: "general" | "technical" | "non-technical" | undefined;
|
|
50
|
+
toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
|
|
51
|
+
levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
|
|
52
|
+
generalRule?: "active-voice" | "passive-voice" | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
targetAudience?: "general" | "technical" | "non-technical" | undefined;
|
|
55
|
+
toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
|
|
56
|
+
levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
|
|
57
|
+
generalRule?: "active-voice" | "passive-voice" | undefined;
|
|
58
|
+
}>, {
|
|
59
|
+
targetAudience?: "general" | "technical" | "non-technical" | undefined;
|
|
60
|
+
toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
|
|
61
|
+
levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
|
|
62
|
+
generalRule?: "active-voice" | "passive-voice" | undefined;
|
|
63
|
+
}, {
|
|
64
|
+
targetAudience?: "general" | "technical" | "non-technical" | undefined;
|
|
65
|
+
toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
|
|
66
|
+
levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
|
|
67
|
+
generalRule?: "active-voice" | "passive-voice" | undefined;
|
|
68
|
+
}>]>;
|
|
69
|
+
export type StyleGuideData = z.infer<typeof STYLE_GUIDE_SCHEMA>;
|
|
70
|
+
export declare function isStructuredStyleGuide(guide: Record<string, unknown>): guide is StructuredStyleGuide;
|
|
71
|
+
export declare const GLOSSARY_TERM_SCHEMA: z.ZodEffects<z.ZodObject<{
|
|
72
|
+
term: z.ZodString;
|
|
73
|
+
description: z.ZodOptional<z.ZodString>;
|
|
74
|
+
translatable: z.ZodDefault<z.ZodBoolean>;
|
|
75
|
+
forbidden: z.ZodDefault<z.ZodBoolean>;
|
|
76
|
+
caseSensitive: z.ZodDefault<z.ZodBoolean>;
|
|
77
|
+
translations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
78
|
+
locale: z.ZodEffects<z.ZodString, string, string>;
|
|
79
|
+
translation: z.ZodString;
|
|
80
|
+
description: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
locale: string;
|
|
83
|
+
translation: string;
|
|
84
|
+
description?: string | undefined;
|
|
85
|
+
}, {
|
|
86
|
+
locale: string;
|
|
87
|
+
translation: string;
|
|
88
|
+
description?: string | undefined;
|
|
89
|
+
}>, "many">>;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
term: string;
|
|
92
|
+
translatable: boolean;
|
|
93
|
+
forbidden: boolean;
|
|
94
|
+
caseSensitive: boolean;
|
|
95
|
+
description?: string | undefined;
|
|
96
|
+
translations?: {
|
|
97
|
+
locale: string;
|
|
98
|
+
translation: string;
|
|
99
|
+
description?: string | undefined;
|
|
100
|
+
}[] | undefined;
|
|
101
|
+
}, {
|
|
102
|
+
term: string;
|
|
103
|
+
description?: string | undefined;
|
|
104
|
+
translatable?: boolean | undefined;
|
|
105
|
+
forbidden?: boolean | undefined;
|
|
106
|
+
caseSensitive?: boolean | undefined;
|
|
107
|
+
translations?: {
|
|
108
|
+
locale: string;
|
|
109
|
+
translation: string;
|
|
110
|
+
description?: string | undefined;
|
|
111
|
+
}[] | undefined;
|
|
112
|
+
}>, {
|
|
113
|
+
term: string;
|
|
114
|
+
translatable: boolean;
|
|
115
|
+
forbidden: boolean;
|
|
116
|
+
caseSensitive: boolean;
|
|
117
|
+
description?: string | undefined;
|
|
118
|
+
translations?: {
|
|
119
|
+
locale: string;
|
|
120
|
+
translation: string;
|
|
121
|
+
description?: string | undefined;
|
|
122
|
+
}[] | undefined;
|
|
123
|
+
}, {
|
|
124
|
+
term: string;
|
|
125
|
+
description?: string | undefined;
|
|
126
|
+
translatable?: boolean | undefined;
|
|
127
|
+
forbidden?: boolean | undefined;
|
|
128
|
+
caseSensitive?: boolean | undefined;
|
|
129
|
+
translations?: {
|
|
130
|
+
locale: string;
|
|
131
|
+
translation: string;
|
|
132
|
+
description?: string | undefined;
|
|
133
|
+
}[] | undefined;
|
|
134
|
+
}>;
|
|
135
|
+
export declare const REQUEST_CONTEXT_SCHEMA: z.ZodObject<{
|
|
136
|
+
description: z.ZodOptional<z.ZodString>;
|
|
137
|
+
styleGuide: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
138
|
+
text: z.ZodString;
|
|
139
|
+
}, "strip", z.ZodTypeAny, {
|
|
140
|
+
text: string;
|
|
141
|
+
}, {
|
|
142
|
+
text: string;
|
|
143
|
+
}>, z.ZodEffects<z.ZodObject<{
|
|
144
|
+
targetAudience: z.ZodOptional<z.ZodEnum<["general", "technical", "non-technical"]>>;
|
|
145
|
+
toneOfVoice: z.ZodOptional<z.ZodEnum<["friendly", "empowering", "informative", "supportive", "elegant"]>>;
|
|
146
|
+
levelOfFormality: z.ZodOptional<z.ZodEnum<["informal", "formal", "neutral"]>>;
|
|
147
|
+
generalRule: z.ZodOptional<z.ZodEnum<["active-voice", "passive-voice"]>>;
|
|
148
|
+
}, "strip", z.ZodTypeAny, {
|
|
149
|
+
targetAudience?: "general" | "technical" | "non-technical" | undefined;
|
|
150
|
+
toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
|
|
151
|
+
levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
|
|
152
|
+
generalRule?: "active-voice" | "passive-voice" | undefined;
|
|
153
|
+
}, {
|
|
154
|
+
targetAudience?: "general" | "technical" | "non-technical" | undefined;
|
|
155
|
+
toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
|
|
156
|
+
levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
|
|
157
|
+
generalRule?: "active-voice" | "passive-voice" | undefined;
|
|
158
|
+
}>, {
|
|
159
|
+
targetAudience?: "general" | "technical" | "non-technical" | undefined;
|
|
160
|
+
toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
|
|
161
|
+
levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
|
|
162
|
+
generalRule?: "active-voice" | "passive-voice" | undefined;
|
|
163
|
+
}, {
|
|
164
|
+
targetAudience?: "general" | "technical" | "non-technical" | undefined;
|
|
165
|
+
toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
|
|
166
|
+
levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
|
|
167
|
+
generalRule?: "active-voice" | "passive-voice" | undefined;
|
|
168
|
+
}>]>>;
|
|
169
|
+
glossary: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
170
|
+
term: z.ZodString;
|
|
171
|
+
description: z.ZodOptional<z.ZodString>;
|
|
172
|
+
translatable: z.ZodDefault<z.ZodBoolean>;
|
|
173
|
+
forbidden: z.ZodDefault<z.ZodBoolean>;
|
|
174
|
+
caseSensitive: z.ZodDefault<z.ZodBoolean>;
|
|
175
|
+
translations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
176
|
+
locale: z.ZodEffects<z.ZodString, string, string>;
|
|
177
|
+
translation: z.ZodString;
|
|
178
|
+
description: z.ZodOptional<z.ZodString>;
|
|
179
|
+
}, "strip", z.ZodTypeAny, {
|
|
180
|
+
locale: string;
|
|
181
|
+
translation: string;
|
|
182
|
+
description?: string | undefined;
|
|
183
|
+
}, {
|
|
184
|
+
locale: string;
|
|
185
|
+
translation: string;
|
|
186
|
+
description?: string | undefined;
|
|
187
|
+
}>, "many">>;
|
|
188
|
+
}, "strip", z.ZodTypeAny, {
|
|
189
|
+
term: string;
|
|
190
|
+
translatable: boolean;
|
|
191
|
+
forbidden: boolean;
|
|
192
|
+
caseSensitive: boolean;
|
|
193
|
+
description?: string | undefined;
|
|
194
|
+
translations?: {
|
|
195
|
+
locale: string;
|
|
196
|
+
translation: string;
|
|
197
|
+
description?: string | undefined;
|
|
198
|
+
}[] | undefined;
|
|
199
|
+
}, {
|
|
200
|
+
term: string;
|
|
201
|
+
description?: string | undefined;
|
|
202
|
+
translatable?: boolean | undefined;
|
|
203
|
+
forbidden?: boolean | undefined;
|
|
204
|
+
caseSensitive?: boolean | undefined;
|
|
205
|
+
translations?: {
|
|
206
|
+
locale: string;
|
|
207
|
+
translation: string;
|
|
208
|
+
description?: string | undefined;
|
|
209
|
+
}[] | undefined;
|
|
210
|
+
}>, {
|
|
211
|
+
term: string;
|
|
212
|
+
translatable: boolean;
|
|
213
|
+
forbidden: boolean;
|
|
214
|
+
caseSensitive: boolean;
|
|
215
|
+
description?: string | undefined;
|
|
216
|
+
translations?: {
|
|
217
|
+
locale: string;
|
|
218
|
+
translation: string;
|
|
219
|
+
description?: string | undefined;
|
|
220
|
+
}[] | undefined;
|
|
221
|
+
}, {
|
|
222
|
+
term: string;
|
|
223
|
+
description?: string | undefined;
|
|
224
|
+
translatable?: boolean | undefined;
|
|
225
|
+
forbidden?: boolean | undefined;
|
|
226
|
+
caseSensitive?: boolean | undefined;
|
|
227
|
+
translations?: {
|
|
228
|
+
locale: string;
|
|
229
|
+
translation: string;
|
|
230
|
+
description?: string | undefined;
|
|
231
|
+
}[] | undefined;
|
|
232
|
+
}>, "many">>;
|
|
233
|
+
}, "strip", z.ZodTypeAny, {
|
|
234
|
+
description?: string | undefined;
|
|
235
|
+
styleGuide?: {
|
|
236
|
+
targetAudience?: "general" | "technical" | "non-technical" | undefined;
|
|
237
|
+
toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
|
|
238
|
+
levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
|
|
239
|
+
generalRule?: "active-voice" | "passive-voice" | undefined;
|
|
240
|
+
} | {
|
|
241
|
+
text: string;
|
|
242
|
+
} | undefined;
|
|
243
|
+
glossary?: {
|
|
244
|
+
term: string;
|
|
245
|
+
translatable: boolean;
|
|
246
|
+
forbidden: boolean;
|
|
247
|
+
caseSensitive: boolean;
|
|
248
|
+
description?: string | undefined;
|
|
249
|
+
translations?: {
|
|
250
|
+
locale: string;
|
|
251
|
+
translation: string;
|
|
252
|
+
description?: string | undefined;
|
|
253
|
+
}[] | undefined;
|
|
254
|
+
}[] | undefined;
|
|
255
|
+
}, {
|
|
256
|
+
description?: string | undefined;
|
|
257
|
+
styleGuide?: {
|
|
258
|
+
targetAudience?: "general" | "technical" | "non-technical" | undefined;
|
|
259
|
+
toneOfVoice?: "friendly" | "empowering" | "informative" | "supportive" | "elegant" | undefined;
|
|
260
|
+
levelOfFormality?: "informal" | "formal" | "neutral" | undefined;
|
|
261
|
+
generalRule?: "active-voice" | "passive-voice" | undefined;
|
|
262
|
+
} | {
|
|
263
|
+
text: string;
|
|
264
|
+
} | undefined;
|
|
265
|
+
glossary?: {
|
|
266
|
+
term: string;
|
|
267
|
+
description?: string | undefined;
|
|
268
|
+
translatable?: boolean | undefined;
|
|
269
|
+
forbidden?: boolean | undefined;
|
|
270
|
+
caseSensitive?: boolean | undefined;
|
|
271
|
+
translations?: {
|
|
272
|
+
locale: string;
|
|
273
|
+
translation: string;
|
|
274
|
+
description?: string | undefined;
|
|
275
|
+
}[] | undefined;
|
|
276
|
+
}[] | undefined;
|
|
277
|
+
}>;
|
|
278
|
+
export {};
|