@lokalise/ragnarok-api-contracts 4.0.0 → 4.0.2
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.js +1 -1
- package/dist/common.js.map +1 -1
- package/dist/evaluation-contracts-v2.d.ts +249 -0
- package/dist/evaluation-contracts-v2.js +33 -0
- package/dist/evaluation-contracts-v2.js.map +1 -0
- package/dist/evaluation-contracts.d.ts +42 -4
- package/dist/evaluation-contracts.js +22 -7
- package/dist/evaluation-contracts.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/objects-v2.d.ts +598 -0
- package/dist/objects-v2.js +144 -0
- package/dist/objects-v2.js.map +1 -0
- package/dist/objects.d.ts +21 -0
- package/dist/objects.js +6 -0
- package/dist/objects.js.map +1 -1
- package/package.json +52 -51
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { METRICS_METADATA_SCHEMA } from "./objects.js";
|
|
3
|
+
/**
|
|
4
|
+
* V2 evaluation result objects.
|
|
5
|
+
*
|
|
6
|
+
* Unlike V1 (`objects.ts`), every metric carries coverage and reliability metadata so consumers
|
|
7
|
+
* can distinguish a perfect score from one computed on a degraded segment set, and can tell an
|
|
8
|
+
* unsupported locale pair apart from an integration outage.
|
|
9
|
+
*
|
|
10
|
+
* V1 schemas remain the source of truth for `/v1/...`; these are additive and used only by `/v2/...`.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Reliability classification of a single computed metric:
|
|
14
|
+
* - `perfect` — computed over the full comparable segment set (`computedSegments === comparableSegments`).
|
|
15
|
+
* - `degraded` — some segments were excluded, but the surviving set still meets the reliability threshold.
|
|
16
|
+
* - `failed` — too few comparable segments to be trustworthy (below the reliability threshold).
|
|
17
|
+
*/
|
|
18
|
+
export const METRIC_STATUS_SCHEMA = z
|
|
19
|
+
.enum(['perfect', 'degraded', 'failed'])
|
|
20
|
+
.describe('Reliability classification of the computed metric');
|
|
21
|
+
/**
|
|
22
|
+
* A single metric value paired with the coverage it was computed over and a reliability status.
|
|
23
|
+
*/
|
|
24
|
+
export const METRIC_RESULT_SCHEMA = z.object({
|
|
25
|
+
value: z.number().describe('The computed metric value'),
|
|
26
|
+
computedSegments: z
|
|
27
|
+
.number()
|
|
28
|
+
.int()
|
|
29
|
+
.min(0)
|
|
30
|
+
.describe('Number of segments that successfully contributed to this metric'),
|
|
31
|
+
comparableSegments: z
|
|
32
|
+
.number()
|
|
33
|
+
.int()
|
|
34
|
+
.min(0)
|
|
35
|
+
.describe('Number of segments in the comparable set for this metric after cross-configuration exclusion. ' +
|
|
36
|
+
'`computedSegments` is measured against this denominator to derive `status`.'),
|
|
37
|
+
status: METRIC_STATUS_SCHEMA,
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* V2 per-locale-pair metrics. Each metric is optional (a metric is omitted when it does not apply,
|
|
41
|
+
* e.g. BLEU for a pair with no corpus-level computation). The whole object is `null` on the
|
|
42
|
+
* locale-pair result when no metrics could be produced (see `LOCALE_PAIR_RESULT_V2_SCHEMA`).
|
|
43
|
+
*/
|
|
44
|
+
export const METRICS_V2_SCHEMA = z
|
|
45
|
+
.object({
|
|
46
|
+
exactMatch: METRIC_RESULT_SCHEMA.optional().describe('Rate of translations that exactly match the reference (0–1)'),
|
|
47
|
+
ter: METRIC_RESULT_SCHEMA.optional().describe('TER score measuring post-editing effort relative to reference length'),
|
|
48
|
+
bleu: METRIC_RESULT_SCHEMA.optional().describe('BLEU score measuring n-gram overlap with reference translations'),
|
|
49
|
+
meteor: METRIC_RESULT_SCHEMA.optional().describe('METEOR score measuring n-gram overlap with synonym and morphological variant support'),
|
|
50
|
+
chrf: METRIC_RESULT_SCHEMA.optional().describe('chrF score measuring character n-gram overlap with reference translations'),
|
|
51
|
+
})
|
|
52
|
+
.describe('Metrics for a single locale pair, each annotated with coverage and reliability');
|
|
53
|
+
/**
|
|
54
|
+
* Outcome of translating a locale pair within a run configuration:
|
|
55
|
+
* - `success` — all in-scope segments translated.
|
|
56
|
+
* - `partial_success` — some segments translated, some failed (metrics computed on the survivors).
|
|
57
|
+
* - `unsupported_locale_pair` — the integration does not support this pair; metrics are `null`. Does
|
|
58
|
+
* NOT cause cross-configuration exclusion (other configs are unaffected).
|
|
59
|
+
* - `integration_failure` — the integration failed to translate the pair (e.g. provider outage);
|
|
60
|
+
* metrics are `null` and the pair is excluded from all configs' comparable sets.
|
|
61
|
+
*/
|
|
62
|
+
export const TRANSLATION_STATUS_SCHEMA = z
|
|
63
|
+
.enum(['success', 'partial_success', 'unsupported_locale_pair', 'integration_failure'])
|
|
64
|
+
.describe('Translation outcome for this locale pair');
|
|
65
|
+
export const LOCALE_PAIR_RESULT_V2_SCHEMA = z
|
|
66
|
+
.object({
|
|
67
|
+
sourceLocale: z.string().describe('Source language locale'),
|
|
68
|
+
targetLocale: z.string().describe('Target language locale'),
|
|
69
|
+
totalSegments: z
|
|
70
|
+
.number()
|
|
71
|
+
.int()
|
|
72
|
+
.min(0)
|
|
73
|
+
.describe('Total number of segments in scope for this locale pair'),
|
|
74
|
+
translatedSegments: z
|
|
75
|
+
.number()
|
|
76
|
+
.int()
|
|
77
|
+
.min(0)
|
|
78
|
+
.describe('Number of segments that were successfully translated'),
|
|
79
|
+
translationStatus: TRANSLATION_STATUS_SCHEMA,
|
|
80
|
+
metrics: METRICS_V2_SCHEMA.nullable().describe('Metrics for this locale pair, or `null` when no metrics could be computed ' +
|
|
81
|
+
'(`unsupported_locale_pair` or `integration_failure`).'),
|
|
82
|
+
})
|
|
83
|
+
.describe('V2 evaluation metrics for a single locale pair, with coverage and translation outcome');
|
|
84
|
+
/**
|
|
85
|
+
* A reference to a locale pair, used to list pairs excluded from a global metric aggregate.
|
|
86
|
+
* Intentionally flat (no `reason`): the per-pair `translationStatus` already carries the cause.
|
|
87
|
+
*/
|
|
88
|
+
export const LOCALE_PAIR_REF_SCHEMA = z
|
|
89
|
+
.object({
|
|
90
|
+
sourceLocale: z.string().describe('Source language locale'),
|
|
91
|
+
targetLocale: z.string().describe('Target language locale'),
|
|
92
|
+
})
|
|
93
|
+
.describe('Reference to a locale pair');
|
|
94
|
+
/**
|
|
95
|
+
* A global (cross-locale-pair) aggregate for a single metric. Weighted by comparable segments and
|
|
96
|
+
* annotated with the locale pairs that were excluded from this metric's aggregation.
|
|
97
|
+
*/
|
|
98
|
+
export const GLOBAL_METRIC_RESULT_SCHEMA = z.object({
|
|
99
|
+
value: z.number().describe('The aggregated metric value across all included locale pairs'),
|
|
100
|
+
computedSegments: z
|
|
101
|
+
.number()
|
|
102
|
+
.int()
|
|
103
|
+
.min(0)
|
|
104
|
+
.describe('Total segments that contributed to this global metric'),
|
|
105
|
+
comparableSegments: z
|
|
106
|
+
.number()
|
|
107
|
+
.int()
|
|
108
|
+
.min(0)
|
|
109
|
+
.describe('Total comparable segments across all included locale pairs for this metric'),
|
|
110
|
+
status: METRIC_STATUS_SCHEMA,
|
|
111
|
+
excludedLocalePairs: z
|
|
112
|
+
.array(LOCALE_PAIR_REF_SCHEMA)
|
|
113
|
+
.describe('Locale pairs excluded from this metric (failed or non-comparable)'),
|
|
114
|
+
});
|
|
115
|
+
export const GLOBAL_METRICS_V2_SCHEMA = z
|
|
116
|
+
.object({
|
|
117
|
+
exactMatch: GLOBAL_METRIC_RESULT_SCHEMA.optional(),
|
|
118
|
+
ter: GLOBAL_METRIC_RESULT_SCHEMA.optional(),
|
|
119
|
+
bleu: GLOBAL_METRIC_RESULT_SCHEMA.optional(),
|
|
120
|
+
meteor: GLOBAL_METRIC_RESULT_SCHEMA.optional(),
|
|
121
|
+
chrf: GLOBAL_METRIC_RESULT_SCHEMA.optional(),
|
|
122
|
+
})
|
|
123
|
+
.describe('Per-metric global aggregates across all locale pairs');
|
|
124
|
+
export const CONFIGURATION_RESULT_V2_SCHEMA = z
|
|
125
|
+
.object({
|
|
126
|
+
configurationName: z.string().describe('Name of the run configuration'),
|
|
127
|
+
global: GLOBAL_METRICS_V2_SCHEMA.describe('Metrics aggregated across all locale pairs'),
|
|
128
|
+
resultsByLocalePair: z
|
|
129
|
+
.array(LOCALE_PAIR_RESULT_V2_SCHEMA)
|
|
130
|
+
.describe('Metrics per locale pair, including failed and unsupported pairs'),
|
|
131
|
+
})
|
|
132
|
+
.describe('V2 evaluation metrics for a single run configuration');
|
|
133
|
+
export const EVALUATION_V2_SCHEMA = z.object({
|
|
134
|
+
id: z.uuid().describe('Unique identifier of the evaluation request'),
|
|
135
|
+
ownerId: z.string().describe('Owner identifier (team ID or similar) for this evaluation'),
|
|
136
|
+
status: z.enum(['pending', 'completed', 'failed']).describe('Current status of the evaluation'),
|
|
137
|
+
metricsMetadata: METRICS_METADATA_SCHEMA.describe('Per-metric metadata for interpreting evaluation scores'),
|
|
138
|
+
results: z
|
|
139
|
+
.array(CONFIGURATION_RESULT_V2_SCHEMA)
|
|
140
|
+
.nullable()
|
|
141
|
+
.describe('Evaluation results per run configuration'),
|
|
142
|
+
metadata: z.record(z.string(), z.unknown()).nullable(),
|
|
143
|
+
});
|
|
144
|
+
//# sourceMappingURL=objects-v2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objects-v2.js","sourceRoot":"","sources":["../src/objects-v2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEtD;;;;;;;;GAQG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,IAAI,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;KACvC,QAAQ,CAAC,mDAAmD,CAAC,CAAA;AAIhE;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE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,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/dist/objects.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare const METRICS_SCHEMA: z.ZodObject<{
|
|
|
4
4
|
ter: z.ZodOptional<z.ZodNumber>;
|
|
5
5
|
bleu: z.ZodOptional<z.ZodNumber>;
|
|
6
6
|
meteor: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
chrf: z.ZodOptional<z.ZodNumber>;
|
|
7
8
|
}, z.core.$strip>;
|
|
8
9
|
export type Metrics = z.infer<typeof METRICS_SCHEMA>;
|
|
9
10
|
/**
|
|
@@ -14,6 +15,7 @@ export declare const ITEM_METRICS_SCHEMA: z.ZodObject<{
|
|
|
14
15
|
exactMatch: z.ZodOptional<z.ZodNumber>;
|
|
15
16
|
ter: z.ZodOptional<z.ZodNumber>;
|
|
16
17
|
meteor: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
chrf: z.ZodOptional<z.ZodNumber>;
|
|
17
19
|
}, z.core.$strip>;
|
|
18
20
|
export type ItemMetrics = z.infer<typeof ITEM_METRICS_SCHEMA>;
|
|
19
21
|
export declare const METRICS_METADATA_SCHEMA: z.ZodObject<{
|
|
@@ -41,6 +43,12 @@ export declare const METRICS_METADATA_SCHEMA: z.ZodObject<{
|
|
|
41
43
|
lower: "lower";
|
|
42
44
|
}>;
|
|
43
45
|
}, z.core.$strip>;
|
|
46
|
+
chrf: z.ZodObject<{
|
|
47
|
+
betterWhen: z.ZodEnum<{
|
|
48
|
+
higher: "higher";
|
|
49
|
+
lower: "lower";
|
|
50
|
+
}>;
|
|
51
|
+
}, z.core.$strip>;
|
|
44
52
|
}, z.core.$strip>;
|
|
45
53
|
export type MetricsMetadata = z.infer<typeof METRICS_METADATA_SCHEMA>;
|
|
46
54
|
export declare const METRICS_METADATA: MetricsMetadata;
|
|
@@ -52,6 +60,7 @@ export declare const LOCALE_PAIR_RESULT_SCHEMA: z.ZodObject<{
|
|
|
52
60
|
ter: z.ZodOptional<z.ZodNumber>;
|
|
53
61
|
bleu: z.ZodOptional<z.ZodNumber>;
|
|
54
62
|
meteor: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
chrf: z.ZodOptional<z.ZodNumber>;
|
|
55
64
|
}, z.core.$strip>;
|
|
56
65
|
}, z.core.$strip>;
|
|
57
66
|
export type LocalePairResult = z.infer<typeof LOCALE_PAIR_RESULT_SCHEMA>;
|
|
@@ -76,6 +85,7 @@ export declare const ITEM_TRANSLATION_BY_CONFIG_SCHEMA: z.ZodObject<{
|
|
|
76
85
|
exactMatch: z.ZodOptional<z.ZodNumber>;
|
|
77
86
|
ter: z.ZodOptional<z.ZodNumber>;
|
|
78
87
|
meteor: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
chrf: z.ZodOptional<z.ZodNumber>;
|
|
79
89
|
}, z.core.$strip>>;
|
|
80
90
|
error: z.ZodNullable<z.ZodObject<{
|
|
81
91
|
message: z.ZodString;
|
|
@@ -112,6 +122,7 @@ export declare const EVALUATION_ITEM_DETAIL_SCHEMA: z.ZodObject<{
|
|
|
112
122
|
exactMatch: z.ZodOptional<z.ZodNumber>;
|
|
113
123
|
ter: z.ZodOptional<z.ZodNumber>;
|
|
114
124
|
meteor: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
chrf: z.ZodOptional<z.ZodNumber>;
|
|
115
126
|
}, z.core.$strip>>;
|
|
116
127
|
error: z.ZodNullable<z.ZodObject<{
|
|
117
128
|
message: z.ZodString;
|
|
@@ -128,6 +139,7 @@ export declare const CONFIGURATION_RESULT_SCHEMA: z.ZodObject<{
|
|
|
128
139
|
ter: z.ZodOptional<z.ZodNumber>;
|
|
129
140
|
bleu: z.ZodOptional<z.ZodNumber>;
|
|
130
141
|
meteor: z.ZodOptional<z.ZodNumber>;
|
|
142
|
+
chrf: z.ZodOptional<z.ZodNumber>;
|
|
131
143
|
}, z.core.$strip>;
|
|
132
144
|
resultsByLocalePair: z.ZodArray<z.ZodObject<{
|
|
133
145
|
sourceLocale: z.ZodString;
|
|
@@ -137,6 +149,7 @@ export declare const CONFIGURATION_RESULT_SCHEMA: z.ZodObject<{
|
|
|
137
149
|
ter: z.ZodOptional<z.ZodNumber>;
|
|
138
150
|
bleu: z.ZodOptional<z.ZodNumber>;
|
|
139
151
|
meteor: z.ZodOptional<z.ZodNumber>;
|
|
152
|
+
chrf: z.ZodOptional<z.ZodNumber>;
|
|
140
153
|
}, z.core.$strip>;
|
|
141
154
|
}, z.core.$strip>>;
|
|
142
155
|
}, z.core.$strip>;
|
|
@@ -174,6 +187,12 @@ export declare const EVALUATION_SCHEMA: z.ZodObject<{
|
|
|
174
187
|
lower: "lower";
|
|
175
188
|
}>;
|
|
176
189
|
}, z.core.$strip>;
|
|
190
|
+
chrf: z.ZodObject<{
|
|
191
|
+
betterWhen: z.ZodEnum<{
|
|
192
|
+
higher: "higher";
|
|
193
|
+
lower: "lower";
|
|
194
|
+
}>;
|
|
195
|
+
}, z.core.$strip>;
|
|
177
196
|
}, z.core.$strip>;
|
|
178
197
|
results: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
179
198
|
configurationName: z.ZodString;
|
|
@@ -182,6 +201,7 @@ export declare const EVALUATION_SCHEMA: z.ZodObject<{
|
|
|
182
201
|
ter: z.ZodOptional<z.ZodNumber>;
|
|
183
202
|
bleu: z.ZodOptional<z.ZodNumber>;
|
|
184
203
|
meteor: z.ZodOptional<z.ZodNumber>;
|
|
204
|
+
chrf: z.ZodOptional<z.ZodNumber>;
|
|
185
205
|
}, z.core.$strip>;
|
|
186
206
|
resultsByLocalePair: z.ZodArray<z.ZodObject<{
|
|
187
207
|
sourceLocale: z.ZodString;
|
|
@@ -191,6 +211,7 @@ export declare const EVALUATION_SCHEMA: z.ZodObject<{
|
|
|
191
211
|
ter: z.ZodOptional<z.ZodNumber>;
|
|
192
212
|
bleu: z.ZodOptional<z.ZodNumber>;
|
|
193
213
|
meteor: z.ZodOptional<z.ZodNumber>;
|
|
214
|
+
chrf: z.ZodOptional<z.ZodNumber>;
|
|
194
215
|
}, z.core.$strip>;
|
|
195
216
|
}, z.core.$strip>>;
|
|
196
217
|
}, z.core.$strip>>>;
|
package/dist/objects.js
CHANGED
|
@@ -20,6 +20,10 @@ export const METRICS_SCHEMA = z.object({
|
|
|
20
20
|
.number()
|
|
21
21
|
.optional()
|
|
22
22
|
.describe('METEOR score measuring n-gram overlap with synonym and morphological variant support'),
|
|
23
|
+
chrf: z
|
|
24
|
+
.number()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe('chrF score measuring character n-gram overlap with reference translations'),
|
|
23
27
|
});
|
|
24
28
|
/**
|
|
25
29
|
* Per-item metrics: same as corpus-level Metrics but excludes BLEU,
|
|
@@ -37,6 +41,7 @@ export const METRICS_METADATA_SCHEMA = z
|
|
|
37
41
|
ter: METRIC_DIRECTION_SCHEMA,
|
|
38
42
|
bleu: METRIC_DIRECTION_SCHEMA,
|
|
39
43
|
meteor: METRIC_DIRECTION_SCHEMA,
|
|
44
|
+
chrf: METRIC_DIRECTION_SCHEMA,
|
|
40
45
|
})
|
|
41
46
|
.describe('Metadata about each metric, indicating whether a higher or lower value is better');
|
|
42
47
|
export const METRICS_METADATA = {
|
|
@@ -44,6 +49,7 @@ export const METRICS_METADATA = {
|
|
|
44
49
|
ter: { betterWhen: 'lower' },
|
|
45
50
|
bleu: { betterWhen: 'higher' },
|
|
46
51
|
meteor: { betterWhen: 'higher' },
|
|
52
|
+
chrf: { betterWhen: 'higher' },
|
|
47
53
|
};
|
|
48
54
|
export const LOCALE_PAIR_RESULT_SCHEMA = z
|
|
49
55
|
.object({
|
package/dist/objects.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objects.js","sourceRoot":"","sources":["../src/objects.ts"],"names":[],"mappings":"AAAA,OAAO,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kC,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,52 +1,53 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
2
|
+
"name": "@lokalise/ragnarok-api-contracts",
|
|
3
|
+
"version": "4.0.2",
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "Lokalise",
|
|
6
|
+
"url": "https://lokalise.com"
|
|
7
|
+
},
|
|
8
|
+
"description": "Ragnarok API contracts",
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git://github.com/lokalise/ragnarok.git",
|
|
13
|
+
"directory": "packages/ragnarok-api-contracts"
|
|
14
|
+
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=20"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "dist/index.js",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": "./dist/index.js",
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@biomejs/biome": "^2.4.16",
|
|
32
|
+
"@lokalise/biome-config": "^3.1.0",
|
|
33
|
+
"@lokalise/tsconfig": "^4.0.0",
|
|
34
|
+
"rimraf": "^6.1.3",
|
|
35
|
+
"typescript": "6.0.3"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"zod": "^4.4.1"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@lokalise/api-common": "^7.1.1",
|
|
42
|
+
"@lokalise/api-contracts": "^6.13.0",
|
|
43
|
+
"@lokalise/polyglot-sdk": "^24.3.1",
|
|
44
|
+
"@lokalise/supported-languages": "^3.2.0"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "rimraf dist && tsc -p tsconfig.build.json",
|
|
48
|
+
"lint": "biome check . && tsc",
|
|
49
|
+
"lint:fix": "biome check --write",
|
|
50
|
+
"package-version": "echo $npm_package_version",
|
|
51
|
+
"postversion": "biome check --write package.json"
|
|
52
|
+
}
|
|
53
|
+
}
|