@lokalise/polyglot-sdk 6.1.0 → 8.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 +5 -0
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/sdk/PolyglotClient.d.ts +6 -9
- package/dist/sdk/PolyglotClient.js +4 -22
- 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 +279 -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/asyncTranslationV2Schemas.d.ts +1059 -0
- package/dist/sdk/schemas/translation/asyncTranslationV2Schemas.js +87 -0
- package/dist/sdk/schemas/translation/asyncTranslationV2Schemas.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/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 -12
- package/dist/sdk/segmentUtils.js.map +0 -1
|
@@ -0,0 +1,279 @@
|
|
|
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 type RequestContext = z.infer<typeof REQUEST_CONTEXT_SCHEMA>;
|
|
279
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REQUEST_CONTEXT_SCHEMA = exports.GLOSSARY_TERM_SCHEMA = void 0;
|
|
4
|
+
exports.isStructuredStyleGuide = isStructuredStyleGuide;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const zod_1 = tslib_1.__importDefault(require("zod"));
|
|
7
|
+
const commonSchemas_1 = require("./commonSchemas");
|
|
8
|
+
// ------------------------------------------
|
|
9
|
+
// Style guide
|
|
10
|
+
// ------------------------------------------
|
|
11
|
+
const STRUCTURED_STYLE_GUIDE_SCHEMA = zod_1.default
|
|
12
|
+
.object({
|
|
13
|
+
targetAudience: zod_1.default.enum(['general', 'technical', 'non-technical']).optional(),
|
|
14
|
+
toneOfVoice: zod_1.default
|
|
15
|
+
.enum(['friendly', 'empowering', 'informative', 'supportive', 'elegant'])
|
|
16
|
+
.optional(),
|
|
17
|
+
levelOfFormality: zod_1.default.enum(['informal', 'formal', 'neutral']).optional(),
|
|
18
|
+
generalRule: zod_1.default.enum(['active-voice', 'passive-voice']).optional(),
|
|
19
|
+
})
|
|
20
|
+
.describe('Structured style guide with predefined options')
|
|
21
|
+
.refine((styleGuide) => isStructuredStyleGuide(styleGuide), {
|
|
22
|
+
message: 'At least one of the fields must be defined',
|
|
23
|
+
});
|
|
24
|
+
const FREEFORM_STYLE_GUIDE_SCHEMA = zod_1.default
|
|
25
|
+
.object({
|
|
26
|
+
text: zod_1.default.string().describe('Styleguide text which will be directly included into the prompt'),
|
|
27
|
+
})
|
|
28
|
+
.describe('Freeform style guide text');
|
|
29
|
+
const STYLE_GUIDE_SCHEMA = zod_1.default
|
|
30
|
+
.union([FREEFORM_STYLE_GUIDE_SCHEMA, STRUCTURED_STYLE_GUIDE_SCHEMA])
|
|
31
|
+
.describe('General style guide to be applied to the request, can be either freeform text or structured set of choices');
|
|
32
|
+
function isStructuredStyleGuide(guide) {
|
|
33
|
+
return (guide.targetAudience !== undefined ||
|
|
34
|
+
guide.toneOfVoice !== undefined ||
|
|
35
|
+
guide.levelOfFormality !== undefined ||
|
|
36
|
+
guide.generalRule !== undefined);
|
|
37
|
+
}
|
|
38
|
+
// ------------------------------------------
|
|
39
|
+
// Glossary
|
|
40
|
+
// ------------------------------------------
|
|
41
|
+
exports.GLOSSARY_TERM_SCHEMA = zod_1.default
|
|
42
|
+
.object({
|
|
43
|
+
term: zod_1.default.string().min(1).describe('Term text in source language'),
|
|
44
|
+
description: zod_1.default
|
|
45
|
+
.string()
|
|
46
|
+
.min(1)
|
|
47
|
+
.describe('An explanation of your term that will help provide the context of what your term means to the translation engine e.g. `router` is in reference to `network`. This can help provide more relevant translations for your content.')
|
|
48
|
+
.optional(),
|
|
49
|
+
translatable: zod_1.default
|
|
50
|
+
.boolean()
|
|
51
|
+
.describe('Should the term be translated or preserved as-is in the target language')
|
|
52
|
+
.default(true),
|
|
53
|
+
forbidden: zod_1.default.boolean().describe('Should the term be avoided in translations').default(false),
|
|
54
|
+
caseSensitive: zod_1.default
|
|
55
|
+
.boolean()
|
|
56
|
+
.describe('Whether the term is case-sensitive. For example, acronyms like PNG or BMP can be marked as case-sensitive')
|
|
57
|
+
.default(false),
|
|
58
|
+
translations: zod_1.default
|
|
59
|
+
.array(zod_1.default.object({
|
|
60
|
+
locale: commonSchemas_1.LOCALE_SCHEMA,
|
|
61
|
+
translation: zod_1.default.string().describe('Term translation in target language').min(1),
|
|
62
|
+
description: zod_1.default
|
|
63
|
+
.string()
|
|
64
|
+
.describe('Additional explanation for the term translation')
|
|
65
|
+
.optional(),
|
|
66
|
+
}))
|
|
67
|
+
.describe('List of objects providing language-specific information about the glossary term')
|
|
68
|
+
.optional(),
|
|
69
|
+
})
|
|
70
|
+
.describe('Glossary term')
|
|
71
|
+
.refine(({ translations, translatable, forbidden }) => !!translations || !translatable || forbidden, {
|
|
72
|
+
message: 'You should either provide `translations` for the term or mark it as `translatable: false` (or `forbidden: true`)',
|
|
73
|
+
});
|
|
74
|
+
exports.REQUEST_CONTEXT_SCHEMA = zod_1.default
|
|
75
|
+
.object({
|
|
76
|
+
description: zod_1.default
|
|
77
|
+
.string()
|
|
78
|
+
.min(1)
|
|
79
|
+
.describe('any helpful description that applies to the whole request. E.g. project description')
|
|
80
|
+
.optional(),
|
|
81
|
+
styleGuide: STYLE_GUIDE_SCHEMA.optional(),
|
|
82
|
+
glossary: zod_1.default.array(exports.GLOSSARY_TERM_SCHEMA).describe('List of glossary terms').optional(),
|
|
83
|
+
})
|
|
84
|
+
.describe('Helpful translation context');
|
|
85
|
+
//# sourceMappingURL=requestContextSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestContextSchemas.js","sourceRoot":"","sources":["../../../../src/sdk/schemas/common/requestContextSchemas.ts"],"names":[],"mappings":";;;AAwCA,wDASC;;AAjDD,sDAAmB;AAEnB,mDAA+C;AAE/C,6CAA6C;AAC7C,cAAc;AACd,6CAA6C;AAE7C,MAAM,6BAA6B,GAAG,aAAC;KACpC,MA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