@lokalise/ragnarok-api-contracts 2.2.0 → 2.4.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/common.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ export declare const LOCALE_SCHEMA: z.ZodString;
2
3
  export declare const AUTH_HEADERS: z.ZodObject<{
3
4
  authorization: z.ZodString;
4
5
  }, z.core.$strip>;
package/dist/common.js CHANGED
@@ -1,5 +1,11 @@
1
1
  import { RealIntegrationEngineEnum } from '@lokalise/polyglot-sdk';
2
+ import { isSupportedLocale } from '@lokalise/supported-languages';
2
3
  import { z } from 'zod';
4
+ export const LOCALE_SCHEMA = z
5
+ .string()
6
+ .min(1)
7
+ .describe('Language locale tag, e.g. `en-US`')
8
+ .refine(isSupportedLocale, { message: 'Invalid locale' });
3
9
  export const AUTH_HEADERS = z.object({
4
10
  authorization: z.string(),
5
11
  });
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;CAC1B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;KAC/B,QAAQ,CAAC,qEAAqE,CAAC,CAAA;AAIlF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC;KACtC,MAAM,CAAC;IACN,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC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;
9
9
  status: z.ZodEnum<{
10
- pending: "pending";
11
10
  completed: "completed";
12
11
  failed: "failed";
12
+ pending: "pending";
13
13
  }>;
14
- resultByConfigurationName: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
14
+ metricsMetadata: z.ZodObject<{
15
+ exactMatch: z.ZodObject<{
16
+ betterWhen: z.ZodEnum<{
17
+ higher: "higher";
18
+ lower: "lower";
19
+ }>;
20
+ }, z.core.$strip>;
21
+ ter: z.ZodObject<{
22
+ betterWhen: z.ZodEnum<{
23
+ higher: "higher";
24
+ lower: "lower";
25
+ }>;
26
+ }, z.core.$strip>;
27
+ bleu: z.ZodObject<{
28
+ betterWhen: z.ZodEnum<{
29
+ higher: "higher";
30
+ lower: "lower";
31
+ }>;
32
+ }, z.core.$strip>;
33
+ meteor: z.ZodObject<{
34
+ betterWhen: z.ZodEnum<{
35
+ higher: "higher";
36
+ lower: "lower";
37
+ }>;
38
+ }, z.core.$strip>;
39
+ }, z.core.$strip>;
40
+ results: z.ZodNullable<z.ZodArray<z.ZodObject<{
41
+ configurationName: z.ZodString;
15
42
  global: z.ZodObject<{
16
- referenceTranslationScore: z.ZodOptional<z.ZodNumber>;
17
- actualTranslationScore: z.ZodOptional<z.ZodNumber>;
18
- perfectMatch: z.ZodOptional<z.ZodNumber>;
19
- translationErrorRate: z.ZodOptional<z.ZodNumber>;
43
+ exactMatch: z.ZodOptional<z.ZodNumber>;
44
+ ter: z.ZodOptional<z.ZodNumber>;
20
45
  bleu: z.ZodOptional<z.ZodNumber>;
21
46
  meteor: z.ZodOptional<z.ZodNumber>;
22
47
  }, z.core.$strip>;
23
- byLanguagePair: z.ZodRecord<z.ZodString, z.ZodObject<{
24
- referenceTranslationScore: z.ZodOptional<z.ZodNumber>;
25
- actualTranslationScore: z.ZodOptional<z.ZodNumber>;
26
- perfectMatch: z.ZodOptional<z.ZodNumber>;
27
- translationErrorRate: z.ZodOptional<z.ZodNumber>;
28
- bleu: z.ZodOptional<z.ZodNumber>;
29
- meteor: z.ZodOptional<z.ZodNumber>;
48
+ resultsByLocalePair: z.ZodArray<z.ZodObject<{
49
+ sourceLocale: z.ZodString;
50
+ targetLocale: z.ZodString;
51
+ metrics: z.ZodObject<{
52
+ exactMatch: z.ZodOptional<z.ZodNumber>;
53
+ ter: z.ZodOptional<z.ZodNumber>;
54
+ bleu: z.ZodOptional<z.ZodNumber>;
55
+ meteor: z.ZodOptional<z.ZodNumber>;
56
+ }, z.core.$strip>;
30
57
  }, z.core.$strip>>;
31
58
  }, z.core.$strip>>>;
32
59
  metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -39,26 +66,53 @@ export declare const getEvaluation: import("@lokalise/api-contracts").GetRouteDe
39
66
  id: z.ZodUUID;
40
67
  ownerId: z.ZodString;
41
68
  status: z.ZodEnum<{
42
- pending: "pending";
43
69
  completed: "completed";
44
70
  failed: "failed";
71
+ pending: "pending";
45
72
  }>;
46
- resultByConfigurationName: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
73
+ metricsMetadata: z.ZodObject<{
74
+ exactMatch: z.ZodObject<{
75
+ betterWhen: z.ZodEnum<{
76
+ higher: "higher";
77
+ lower: "lower";
78
+ }>;
79
+ }, z.core.$strip>;
80
+ ter: z.ZodObject<{
81
+ betterWhen: z.ZodEnum<{
82
+ higher: "higher";
83
+ lower: "lower";
84
+ }>;
85
+ }, z.core.$strip>;
86
+ bleu: z.ZodObject<{
87
+ betterWhen: z.ZodEnum<{
88
+ higher: "higher";
89
+ lower: "lower";
90
+ }>;
91
+ }, z.core.$strip>;
92
+ meteor: z.ZodObject<{
93
+ betterWhen: z.ZodEnum<{
94
+ higher: "higher";
95
+ lower: "lower";
96
+ }>;
97
+ }, z.core.$strip>;
98
+ }, z.core.$strip>;
99
+ results: z.ZodNullable<z.ZodArray<z.ZodObject<{
100
+ configurationName: z.ZodString;
47
101
  global: z.ZodObject<{
48
- referenceTranslationScore: z.ZodOptional<z.ZodNumber>;
49
- actualTranslationScore: z.ZodOptional<z.ZodNumber>;
50
- perfectMatch: z.ZodOptional<z.ZodNumber>;
51
- translationErrorRate: z.ZodOptional<z.ZodNumber>;
102
+ exactMatch: z.ZodOptional<z.ZodNumber>;
103
+ ter: z.ZodOptional<z.ZodNumber>;
52
104
  bleu: z.ZodOptional<z.ZodNumber>;
53
105
  meteor: z.ZodOptional<z.ZodNumber>;
54
106
  }, z.core.$strip>;
55
- byLanguagePair: z.ZodRecord<z.ZodString, z.ZodObject<{
56
- referenceTranslationScore: z.ZodOptional<z.ZodNumber>;
57
- actualTranslationScore: z.ZodOptional<z.ZodNumber>;
58
- perfectMatch: z.ZodOptional<z.ZodNumber>;
59
- translationErrorRate: z.ZodOptional<z.ZodNumber>;
60
- bleu: z.ZodOptional<z.ZodNumber>;
61
- meteor: z.ZodOptional<z.ZodNumber>;
107
+ resultsByLocalePair: z.ZodArray<z.ZodObject<{
108
+ sourceLocale: z.ZodString;
109
+ targetLocale: z.ZodString;
110
+ metrics: z.ZodObject<{
111
+ exactMatch: z.ZodOptional<z.ZodNumber>;
112
+ ter: z.ZodOptional<z.ZodNumber>;
113
+ bleu: z.ZodOptional<z.ZodNumber>;
114
+ meteor: z.ZodOptional<z.ZodNumber>;
115
+ }, z.core.$strip>;
62
116
  }, z.core.$strip>>;
63
117
  }, z.core.$strip>>>;
64
118
  metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -154,4 +208,101 @@ export declare const postScheduleEvaluation: import("@lokalise/api-contracts").P
154
208
  evaluationId: z.ZodUUID;
155
209
  }, z.core.$strip>;
156
210
  }>;
211
+ declare const GET_EVALUATION_ITEMS_PARAMS_SCHEMA: z.ZodObject<{
212
+ evaluationId: z.ZodUUID;
213
+ }, z.core.$strip>;
214
+ export type GetEvaluationItemsParams = z.infer<typeof GET_EVALUATION_ITEMS_PARAMS_SCHEMA>;
215
+ declare const GET_EVALUATION_ITEMS_QUERY_SCHEMA: z.ZodObject<{
216
+ before: z.ZodOptional<z.ZodString>;
217
+ after: z.ZodOptional<z.ZodString>;
218
+ 'filter-target-locale': z.ZodOptional<z.ZodString>;
219
+ limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
220
+ }, z.core.$strip>;
221
+ export type GetEvaluationItemsQuery = z.infer<typeof GET_EVALUATION_ITEMS_QUERY_SCHEMA>;
222
+ export declare const getEvaluationItems: import("@lokalise/api-contracts").GetRouteDefinition<z.ZodObject<{
223
+ data: z.ZodArray<z.ZodObject<{
224
+ itemId: z.ZodUUID;
225
+ externalId: z.ZodString;
226
+ sourceLocale: z.ZodString;
227
+ targetLocale: z.ZodString;
228
+ sourceValue: z.ZodString;
229
+ referenceTranslation: z.ZodString;
230
+ description: z.ZodNullable<z.ZodString>;
231
+ translationExamples: z.ZodArray<z.ZodObject<{
232
+ sourceValue: z.ZodString;
233
+ translatedValue: z.ZodString;
234
+ }, z.core.$strip>>;
235
+ translations: z.ZodArray<z.ZodObject<{
236
+ configurationName: z.ZodString;
237
+ status: z.ZodEnum<{
238
+ translating: "translating";
239
+ translated: "translated";
240
+ scoring: "scoring";
241
+ scored: "scored";
242
+ completed: "completed";
243
+ failed: "failed";
244
+ }>;
245
+ actualTranslation: z.ZodNullable<z.ZodString>;
246
+ actualScore: z.ZodNullable<z.ZodNumber>;
247
+ error: z.ZodNullable<z.ZodObject<{
248
+ message: z.ZodString;
249
+ errorCode: z.ZodString;
250
+ details: z.ZodOptional<z.ZodAny>;
251
+ }, z.core.$strip>>;
252
+ }, z.core.$strip>>;
253
+ }, z.core.$strip>>;
254
+ meta: z.ZodObject<{
255
+ count: z.ZodNumber;
256
+ cursor: z.ZodOptional<z.ZodString>;
257
+ hasMore: z.ZodOptional<z.ZodBoolean>;
258
+ }, z.core.$strip>;
259
+ }, z.core.$strip>, z.ZodObject<{
260
+ evaluationId: z.ZodUUID;
261
+ }, z.core.$strip>, z.ZodObject<{
262
+ before: z.ZodOptional<z.ZodString>;
263
+ after: z.ZodOptional<z.ZodString>;
264
+ 'filter-target-locale': z.ZodOptional<z.ZodString>;
265
+ limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
266
+ }, z.core.$strip>, z.ZodObject<{
267
+ authorization: z.ZodString;
268
+ }, z.core.$strip>, undefined, false, false, {
269
+ 200: z.ZodObject<{
270
+ data: z.ZodArray<z.ZodObject<{
271
+ itemId: z.ZodUUID;
272
+ externalId: z.ZodString;
273
+ sourceLocale: z.ZodString;
274
+ targetLocale: z.ZodString;
275
+ sourceValue: z.ZodString;
276
+ referenceTranslation: z.ZodString;
277
+ description: z.ZodNullable<z.ZodString>;
278
+ translationExamples: z.ZodArray<z.ZodObject<{
279
+ sourceValue: z.ZodString;
280
+ translatedValue: z.ZodString;
281
+ }, z.core.$strip>>;
282
+ translations: z.ZodArray<z.ZodObject<{
283
+ configurationName: z.ZodString;
284
+ status: z.ZodEnum<{
285
+ translating: "translating";
286
+ translated: "translated";
287
+ scoring: "scoring";
288
+ scored: "scored";
289
+ completed: "completed";
290
+ failed: "failed";
291
+ }>;
292
+ actualTranslation: z.ZodNullable<z.ZodString>;
293
+ actualScore: z.ZodNullable<z.ZodNumber>;
294
+ error: z.ZodNullable<z.ZodObject<{
295
+ message: z.ZodString;
296
+ errorCode: z.ZodString;
297
+ details: z.ZodOptional<z.ZodAny>;
298
+ }, z.core.$strip>>;
299
+ }, z.core.$strip>>;
300
+ }, z.core.$strip>>;
301
+ meta: z.ZodObject<{
302
+ count: z.ZodNumber;
303
+ cursor: z.ZodOptional<z.ZodString>;
304
+ hasMore: z.ZodOptional<z.ZodBoolean>;
305
+ }, z.core.$strip>;
306
+ }, z.core.$strip>;
307
+ }>;
157
308
  export {};
@@ -1,7 +1,8 @@
1
+ import { OPTIONAL_PAGINATION_CONFIG_SCHEMA, paginatedResponseSchema } from '@lokalise/api-common';
1
2
  import { buildRestContract } from '@lokalise/api-contracts';
2
3
  import { z } from 'zod';
3
- import { AUTH_HEADERS, INTEGRATION_INPUT_SCHEMA, METADATA_SCHEMA, WEBHOOK_SCHEMA, } from "./common.js";
4
- import { EVALUATION_SCHEMA } from "./objects.js";
4
+ import { AUTH_HEADERS, INTEGRATION_INPUT_SCHEMA, LOCALE_SCHEMA, METADATA_SCHEMA, WEBHOOK_SCHEMA, } from "./common.js";
5
+ import { EVALUATION_ITEM_DETAIL_SCHEMA, EVALUATION_SCHEMA } from "./objects.js";
5
6
  const GET_EVALUATION_PARAMS_SCHEMA = z.object({
6
7
  evaluationId: z.uuid().describe('The unique identifier of the evaluation to retrieve.'),
7
8
  });
@@ -91,4 +92,24 @@ export const postScheduleEvaluation = buildRestContract({
91
92
  202: SCHEDULE_EVALUATION_RESPONSE_SCHEMA,
92
93
  },
93
94
  });
95
+ // === Get Evaluation Items ===
96
+ const GET_EVALUATION_ITEMS_PARAMS_SCHEMA = z.object({
97
+ evaluationId: z.uuid().describe('The unique identifier of the evaluation'),
98
+ });
99
+ const GET_EVALUATION_ITEMS_QUERY_SCHEMA = OPTIONAL_PAGINATION_CONFIG_SCHEMA.extend({
100
+ 'filter-target-locale': LOCALE_SCHEMA.optional().describe('Filter by target locale (BCP-47)'),
101
+ limit: z.coerce.number().int().min(1).max(200).optional().default(50).describe('Page size'),
102
+ });
103
+ export const getEvaluationItems = buildRestContract({
104
+ method: 'get',
105
+ pathResolver: ({ evaluationId }) => `/v1/evaluations/${evaluationId}/items`,
106
+ description: 'Retrieve evaluation items with translations and per-item metrics',
107
+ requestPathParamsSchema: GET_EVALUATION_ITEMS_PARAMS_SCHEMA,
108
+ requestQuerySchema: GET_EVALUATION_ITEMS_QUERY_SCHEMA,
109
+ requestHeaderSchema: AUTH_HEADERS,
110
+ successResponseBodySchema: paginatedResponseSchema(EVALUATION_ITEM_DETAIL_SCHEMA),
111
+ responseSchemasByStatusCode: {
112
+ 200: paginatedResponseSchema(EVALUATION_ITEM_DETAIL_SCHEMA),
113
+ },
114
+ });
94
115
  //# sourceMappingURL=evaluation-contracts.js.map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EAAE,kCAAkC;IAC3D,kBAAkB,EAAE,iCAAiC;IACrD,mBAAmB,EAAE,YAAY;IACjC,yBAAyB,EAAE,uBAAuB,CAAC,6BAA6B,CAAC;IACjF,2BAA2B,EAAE;QAC3B,GAAG,EAAE,uBAAuB,CAAC,6BAA6B,CAAC;KAC5D;CACF,CAAC,CAAA"}
package/dist/objects.d.ts CHANGED
@@ -1,75 +1,177 @@
1
1
  import { z } from 'zod';
2
2
  export declare const METRICS_SCHEMA: z.ZodObject<{
3
- referenceTranslationScore: z.ZodOptional<z.ZodNumber>;
4
- actualTranslationScore: z.ZodOptional<z.ZodNumber>;
5
- perfectMatch: z.ZodOptional<z.ZodNumber>;
6
- translationErrorRate: z.ZodOptional<z.ZodNumber>;
3
+ exactMatch: z.ZodOptional<z.ZodNumber>;
4
+ ter: z.ZodOptional<z.ZodNumber>;
7
5
  bleu: z.ZodOptional<z.ZodNumber>;
8
6
  meteor: z.ZodOptional<z.ZodNumber>;
9
7
  }, z.core.$strip>;
10
8
  export type Metrics = z.infer<typeof METRICS_SCHEMA>;
11
- export declare const CONFIGURATION_RESULT_SCHEMA: z.ZodObject<{
12
- global: z.ZodObject<{
13
- referenceTranslationScore: z.ZodOptional<z.ZodNumber>;
14
- actualTranslationScore: z.ZodOptional<z.ZodNumber>;
15
- perfectMatch: z.ZodOptional<z.ZodNumber>;
16
- translationErrorRate: z.ZodOptional<z.ZodNumber>;
17
- bleu: z.ZodOptional<z.ZodNumber>;
18
- meteor: z.ZodOptional<z.ZodNumber>;
9
+ export declare const METRICS_METADATA_SCHEMA: z.ZodObject<{
10
+ exactMatch: z.ZodObject<{
11
+ betterWhen: z.ZodEnum<{
12
+ higher: "higher";
13
+ lower: "lower";
14
+ }>;
15
+ }, z.core.$strip>;
16
+ ter: z.ZodObject<{
17
+ betterWhen: z.ZodEnum<{
18
+ higher: "higher";
19
+ lower: "lower";
20
+ }>;
19
21
  }, z.core.$strip>;
20
- byLanguagePair: z.ZodRecord<z.ZodString, z.ZodObject<{
21
- referenceTranslationScore: z.ZodOptional<z.ZodNumber>;
22
- actualTranslationScore: z.ZodOptional<z.ZodNumber>;
23
- perfectMatch: z.ZodOptional<z.ZodNumber>;
24
- translationErrorRate: z.ZodOptional<z.ZodNumber>;
22
+ bleu: z.ZodObject<{
23
+ betterWhen: z.ZodEnum<{
24
+ higher: "higher";
25
+ lower: "lower";
26
+ }>;
27
+ }, z.core.$strip>;
28
+ meteor: z.ZodObject<{
29
+ betterWhen: z.ZodEnum<{
30
+ higher: "higher";
31
+ lower: "lower";
32
+ }>;
33
+ }, z.core.$strip>;
34
+ }, z.core.$strip>;
35
+ export type MetricsMetadata = z.infer<typeof METRICS_METADATA_SCHEMA>;
36
+ export declare const METRICS_METADATA: MetricsMetadata;
37
+ export declare const LOCALE_PAIR_RESULT_SCHEMA: z.ZodObject<{
38
+ sourceLocale: z.ZodString;
39
+ targetLocale: z.ZodString;
40
+ metrics: z.ZodObject<{
41
+ exactMatch: z.ZodOptional<z.ZodNumber>;
42
+ ter: z.ZodOptional<z.ZodNumber>;
25
43
  bleu: z.ZodOptional<z.ZodNumber>;
26
44
  meteor: z.ZodOptional<z.ZodNumber>;
45
+ }, z.core.$strip>;
46
+ }, z.core.$strip>;
47
+ export type LocalePairResult = z.infer<typeof LOCALE_PAIR_RESULT_SCHEMA>;
48
+ export declare const TRANSLATION_EXAMPLE_SCHEMA: z.ZodObject<{
49
+ sourceValue: z.ZodString;
50
+ translatedValue: z.ZodString;
51
+ }, z.core.$strip>;
52
+ export type TranslationExample = z.infer<typeof TRANSLATION_EXAMPLE_SCHEMA>;
53
+ export declare const ITEM_TRANSLATION_BY_CONFIG_SCHEMA: z.ZodObject<{
54
+ configurationName: z.ZodString;
55
+ status: z.ZodEnum<{
56
+ translating: "translating";
57
+ translated: "translated";
58
+ scoring: "scoring";
59
+ scored: "scored";
60
+ completed: "completed";
61
+ failed: "failed";
62
+ }>;
63
+ actualTranslation: z.ZodNullable<z.ZodString>;
64
+ actualScore: z.ZodNullable<z.ZodNumber>;
65
+ error: z.ZodNullable<z.ZodObject<{
66
+ message: z.ZodString;
67
+ errorCode: z.ZodString;
68
+ details: z.ZodOptional<z.ZodAny>;
27
69
  }, z.core.$strip>>;
28
70
  }, z.core.$strip>;
29
- export type ConfigurationResult = z.infer<typeof CONFIGURATION_RESULT_SCHEMA>;
30
- export declare const RESULT_BY_CONFIGURATION_NAME_SCHEMA: z.ZodRecord<z.ZodString, z.ZodObject<{
71
+ export type ItemTranslationByConfig = z.infer<typeof ITEM_TRANSLATION_BY_CONFIG_SCHEMA>;
72
+ export declare const EVALUATION_ITEM_DETAIL_SCHEMA: z.ZodObject<{
73
+ itemId: z.ZodUUID;
74
+ externalId: z.ZodString;
75
+ sourceLocale: z.ZodString;
76
+ targetLocale: z.ZodString;
77
+ sourceValue: z.ZodString;
78
+ referenceTranslation: z.ZodString;
79
+ description: z.ZodNullable<z.ZodString>;
80
+ translationExamples: z.ZodArray<z.ZodObject<{
81
+ sourceValue: z.ZodString;
82
+ translatedValue: z.ZodString;
83
+ }, z.core.$strip>>;
84
+ translations: z.ZodArray<z.ZodObject<{
85
+ configurationName: z.ZodString;
86
+ status: z.ZodEnum<{
87
+ translating: "translating";
88
+ translated: "translated";
89
+ scoring: "scoring";
90
+ scored: "scored";
91
+ completed: "completed";
92
+ failed: "failed";
93
+ }>;
94
+ actualTranslation: z.ZodNullable<z.ZodString>;
95
+ actualScore: z.ZodNullable<z.ZodNumber>;
96
+ error: z.ZodNullable<z.ZodObject<{
97
+ message: z.ZodString;
98
+ errorCode: z.ZodString;
99
+ details: z.ZodOptional<z.ZodAny>;
100
+ }, z.core.$strip>>;
101
+ }, z.core.$strip>>;
102
+ }, z.core.$strip>;
103
+ export type EvaluationItemDetail = z.infer<typeof EVALUATION_ITEM_DETAIL_SCHEMA>;
104
+ export declare const CONFIGURATION_RESULT_SCHEMA: z.ZodObject<{
105
+ configurationName: z.ZodString;
31
106
  global: z.ZodObject<{
32
- referenceTranslationScore: z.ZodOptional<z.ZodNumber>;
33
- actualTranslationScore: z.ZodOptional<z.ZodNumber>;
34
- perfectMatch: z.ZodOptional<z.ZodNumber>;
35
- translationErrorRate: z.ZodOptional<z.ZodNumber>;
107
+ exactMatch: z.ZodOptional<z.ZodNumber>;
108
+ ter: z.ZodOptional<z.ZodNumber>;
36
109
  bleu: z.ZodOptional<z.ZodNumber>;
37
110
  meteor: z.ZodOptional<z.ZodNumber>;
38
111
  }, z.core.$strip>;
39
- byLanguagePair: z.ZodRecord<z.ZodString, z.ZodObject<{
40
- referenceTranslationScore: z.ZodOptional<z.ZodNumber>;
41
- actualTranslationScore: z.ZodOptional<z.ZodNumber>;
42
- perfectMatch: z.ZodOptional<z.ZodNumber>;
43
- translationErrorRate: z.ZodOptional<z.ZodNumber>;
44
- bleu: z.ZodOptional<z.ZodNumber>;
45
- meteor: z.ZodOptional<z.ZodNumber>;
112
+ resultsByLocalePair: z.ZodArray<z.ZodObject<{
113
+ sourceLocale: z.ZodString;
114
+ targetLocale: z.ZodString;
115
+ metrics: z.ZodObject<{
116
+ exactMatch: z.ZodOptional<z.ZodNumber>;
117
+ ter: z.ZodOptional<z.ZodNumber>;
118
+ bleu: z.ZodOptional<z.ZodNumber>;
119
+ meteor: z.ZodOptional<z.ZodNumber>;
120
+ }, z.core.$strip>;
46
121
  }, z.core.$strip>>;
47
- }, z.core.$strip>>;
48
- export type ResultByConfigurationName = z.infer<typeof RESULT_BY_CONFIGURATION_NAME_SCHEMA>;
122
+ }, z.core.$strip>;
123
+ export type ConfigurationResult = z.infer<typeof CONFIGURATION_RESULT_SCHEMA>;
49
124
  export declare const EVALUATION_SCHEMA: z.ZodObject<{
50
125
  id: z.ZodUUID;
51
126
  ownerId: z.ZodString;
52
127
  status: z.ZodEnum<{
53
- pending: "pending";
54
128
  completed: "completed";
55
129
  failed: "failed";
130
+ pending: "pending";
56
131
  }>;
57
- resultByConfigurationName: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
132
+ metricsMetadata: z.ZodObject<{
133
+ exactMatch: z.ZodObject<{
134
+ betterWhen: z.ZodEnum<{
135
+ higher: "higher";
136
+ lower: "lower";
137
+ }>;
138
+ }, z.core.$strip>;
139
+ ter: z.ZodObject<{
140
+ betterWhen: z.ZodEnum<{
141
+ higher: "higher";
142
+ lower: "lower";
143
+ }>;
144
+ }, z.core.$strip>;
145
+ bleu: z.ZodObject<{
146
+ betterWhen: z.ZodEnum<{
147
+ higher: "higher";
148
+ lower: "lower";
149
+ }>;
150
+ }, z.core.$strip>;
151
+ meteor: z.ZodObject<{
152
+ betterWhen: z.ZodEnum<{
153
+ higher: "higher";
154
+ lower: "lower";
155
+ }>;
156
+ }, z.core.$strip>;
157
+ }, z.core.$strip>;
158
+ results: z.ZodNullable<z.ZodArray<z.ZodObject<{
159
+ configurationName: z.ZodString;
58
160
  global: z.ZodObject<{
59
- referenceTranslationScore: z.ZodOptional<z.ZodNumber>;
60
- actualTranslationScore: z.ZodOptional<z.ZodNumber>;
61
- perfectMatch: z.ZodOptional<z.ZodNumber>;
62
- translationErrorRate: z.ZodOptional<z.ZodNumber>;
161
+ exactMatch: z.ZodOptional<z.ZodNumber>;
162
+ ter: z.ZodOptional<z.ZodNumber>;
63
163
  bleu: z.ZodOptional<z.ZodNumber>;
64
164
  meteor: z.ZodOptional<z.ZodNumber>;
65
165
  }, z.core.$strip>;
66
- byLanguagePair: z.ZodRecord<z.ZodString, z.ZodObject<{
67
- referenceTranslationScore: z.ZodOptional<z.ZodNumber>;
68
- actualTranslationScore: z.ZodOptional<z.ZodNumber>;
69
- perfectMatch: z.ZodOptional<z.ZodNumber>;
70
- translationErrorRate: z.ZodOptional<z.ZodNumber>;
71
- bleu: z.ZodOptional<z.ZodNumber>;
72
- meteor: z.ZodOptional<z.ZodNumber>;
166
+ resultsByLocalePair: z.ZodArray<z.ZodObject<{
167
+ sourceLocale: z.ZodString;
168
+ targetLocale: z.ZodString;
169
+ metrics: z.ZodObject<{
170
+ exactMatch: z.ZodOptional<z.ZodNumber>;
171
+ ter: z.ZodOptional<z.ZodNumber>;
172
+ bleu: z.ZodOptional<z.ZodNumber>;
173
+ meteor: z.ZodOptional<z.ZodNumber>;
174
+ }, z.core.$strip>;
73
175
  }, z.core.$strip>>;
74
176
  }, z.core.$strip>>>;
75
177
  metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
package/dist/objects.js CHANGED
@@ -1,18 +1,14 @@
1
+ import { COMMON_ERROR_RESPONSE_SCHEMA } from '@lokalise/api-common';
1
2
  import { z } from 'zod';
2
3
  export const METRICS_SCHEMA = z.object({
3
- referenceTranslationScore: z
4
- .number()
5
- .optional()
6
- .describe('Average LQA score of reference translations'),
7
- actualTranslationScore: z
8
- .number()
9
- .optional()
10
- .describe('Average LQA score of actual (generated) translations'),
11
- perfectMatch: z
4
+ // TODO bring it back and adjust it once we align on ai scoring metrics
5
+ // referenceTranslationScore: z.number().optional().describe('Average LQA score of reference translations'),
6
+ // actualTranslationScore: z.number().optional().describe('Average LQA score of actual (generated) translations'),
7
+ exactMatch: z
12
8
  .number()
13
9
  .optional()
14
10
  .describe('Rate of translations that exactly match the reference (0–1)'),
15
- translationErrorRate: z
11
+ ter: z
16
12
  .number()
17
13
  .optional()
18
14
  .describe('TER score measuring post-editing effort relative to reference length'),
@@ -20,24 +16,83 @@ export const METRICS_SCHEMA = z.object({
20
16
  .number()
21
17
  .optional()
22
18
  .describe('BLEU score measuring n-gram overlap with reference translations'),
23
- meteor: z.number().optional().describe('METEOR score measuring translation quality'),
19
+ meteor: z
20
+ .number()
21
+ .optional()
22
+ .describe('METEOR score measuring n-gram overlap with synonym and morphological variant support'),
23
+ });
24
+ const METRIC_DIRECTION_SCHEMA = z.object({
25
+ betterWhen: z
26
+ .enum(['higher', 'lower'])
27
+ .describe('Whether a higher or lower score indicates better translation quality'),
28
+ });
29
+ export const METRICS_METADATA_SCHEMA = z
30
+ .object({
31
+ exactMatch: METRIC_DIRECTION_SCHEMA,
32
+ ter: METRIC_DIRECTION_SCHEMA,
33
+ bleu: METRIC_DIRECTION_SCHEMA,
34
+ meteor: METRIC_DIRECTION_SCHEMA,
35
+ })
36
+ .describe('Metadata about each metric, indicating whether a higher or lower value is better');
37
+ export const METRICS_METADATA = {
38
+ exactMatch: { betterWhen: 'higher' },
39
+ ter: { betterWhen: 'lower' },
40
+ bleu: { betterWhen: 'higher' },
41
+ meteor: { betterWhen: 'higher' },
42
+ };
43
+ export const LOCALE_PAIR_RESULT_SCHEMA = z
44
+ .object({
45
+ sourceLocale: z.string().describe('Source language locale'),
46
+ targetLocale: z.string().describe('Target language locale'),
47
+ metrics: METRICS_SCHEMA.describe('Metrics for this locale pair'),
48
+ })
49
+ .describe('Evaluation metrics for a single locale pair');
50
+ // === Evaluation Items Detail Schemas ===
51
+ export const TRANSLATION_EXAMPLE_SCHEMA = z.object({
52
+ sourceValue: z.string().describe('Source text of the example'),
53
+ translatedValue: z.string().describe('Translated text of the example'),
54
+ });
55
+ export const ITEM_TRANSLATION_BY_CONFIG_SCHEMA = z.object({
56
+ configurationName: z.string().describe('Name of the run configuration'),
57
+ status: z
58
+ .enum(['translating', 'translated', 'scoring', 'scored', 'completed', 'failed'])
59
+ .describe('Current status of this translation'),
60
+ actualTranslation: z.string().nullable().describe('Generated translation text'),
61
+ actualScore: z.number().nullable().describe('LQA score of the generated translation'),
62
+ error: COMMON_ERROR_RESPONSE_SCHEMA.nullable().describe('Error details if status is failed'),
63
+ });
64
+ export const EVALUATION_ITEM_DETAIL_SCHEMA = z.object({
65
+ itemId: z.uuid().describe('Unique identifier of the evaluation item'),
66
+ externalId: z.string().describe('Caller-provided external identifier'),
67
+ sourceLocale: z.string().describe('Source locale (BCP-47)'),
68
+ targetLocale: z.string().describe('Target locale (BCP-47)'),
69
+ sourceValue: z.string().describe('Source text to translate'),
70
+ referenceTranslation: z.string().describe('Expected reference translation'),
71
+ description: z.string().nullable().describe('Per-item context or description'),
72
+ translationExamples: z
73
+ .array(TRANSLATION_EXAMPLE_SCHEMA)
74
+ .describe('Translation examples attached to this item'),
75
+ translations: z
76
+ .array(ITEM_TRANSLATION_BY_CONFIG_SCHEMA)
77
+ .describe('Translation results per run configuration'),
24
78
  });
79
+ // === Aggregated Metrics Schemas ===
25
80
  export const CONFIGURATION_RESULT_SCHEMA = z
26
81
  .object({
27
- global: METRICS_SCHEMA.describe('Metrics aggregated across all language pairs'),
28
- byLanguagePair: z
29
- .record(z.string(), METRICS_SCHEMA)
30
- .describe('Metrics per language pair, keyed by "source->target" (e.g. "en-GB->pl-PL")'),
82
+ configurationName: z.string().describe('Name of the run configuration'),
83
+ global: METRICS_SCHEMA.describe('Metrics aggregated across all locale pairs'),
84
+ resultsByLocalePair: z.array(LOCALE_PAIR_RESULT_SCHEMA).describe('Metrics per locale pair'),
31
85
  })
32
86
  .describe('Evaluation metrics for a single run configuration');
33
- export const RESULT_BY_CONFIGURATION_NAME_SCHEMA = z
34
- .record(z.string(), CONFIGURATION_RESULT_SCHEMA)
35
- .describe('Evaluation results grouped by configuration name');
36
87
  export const EVALUATION_SCHEMA = z.object({
37
88
  id: z.uuid().describe('Unique identifier of the evaluation request'),
38
89
  ownerId: z.string().describe('Owner identifier (team ID or similar) for this evaluation'),
39
90
  status: z.enum(['pending', 'completed', 'failed']).describe('Current status of the evaluation'),
40
- resultByConfigurationName: RESULT_BY_CONFIGURATION_NAME_SCHEMA.nullable(),
91
+ metricsMetadata: METRICS_METADATA_SCHEMA.describe('Per-metric metadata for interpreting evaluation scores'),
92
+ results: z
93
+ .array(CONFIGURATION_RESULT_SCHEMA)
94
+ .nullable()
95
+ .describe('Evaluation results per run configuration'),
41
96
  metadata: z.record(z.string(), z.unknown()).nullable(),
42
97
  });
43
98
  //# sourceMappingURL=objects.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"objects.js","sourceRoot":"","sources":["../src/objects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM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MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC;KACzC,MAAM,CAAC;IACN,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IACvE,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,4CAA4C,CAAC;IAC7E,mBAAmB,EAAE,CAAC,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC,QAAQ,CAAC,yBAAyB,CAAC;CAC5F,CAAC;KACD,QAAQ,CAAC,mDAAmD,CAAC,CAAA;AAIhE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;IACpE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2DAA2D,CAAC;IACzF,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IAC/F,eAAe,EAAE,uBAAuB,CAAC,QAAQ,CAC/C,wDAAwD,CACzD;IACD,OAAO,EAAE,CAAC;SACP,KAAK,CAAC,2BAA2B,CAAC;SAClC,QAAQ,EAAE;SACV,QAAQ,CAAC,0CAA0C,CAAC;IACvD,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CACvD,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lokalise/ragnarok-api-contracts",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "author": {
5
5
  "name": "Lokalise",
6
6
  "url": "https://lokalise.com"
@@ -35,7 +35,8 @@
35
35
  "postversion": "biome check --write package.json"
36
36
  },
37
37
  "devDependencies": {
38
- "@biomejs/biome": "^2.4.6",
38
+ "@biomejs/biome": "^2.4.8",
39
+ "@lokalise/api-common": "^6.1.2",
39
40
  "@lokalise/biome-config": "^3.1.0",
40
41
  "@lokalise/tsconfig": "^3.0.0",
41
42
  "rimraf": "^6.1.3",
@@ -45,6 +46,7 @@
45
46
  "zod": "^4.0.0"
46
47
  },
47
48
  "dependencies": {
48
- "@lokalise/api-contracts": "^6.6.0"
49
+ "@lokalise/api-contracts": "^6.7.0",
50
+ "@lokalise/supported-languages": "^3.1.1"
49
51
  }
50
52
  }