@lokalise/ragnarok-api-contracts 0.0.2 → 0.1.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/LICENSE CHANGED
@@ -1,13 +1,13 @@
1
- Copyright 2026 Lokalise, Inc.
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
1
+ Copyright 2026 Lokalise, Inc.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
13
  limitations under the License.
package/README.md CHANGED
@@ -1,22 +1,22 @@
1
- # @lokalise/ragnarok-api-contracts
2
-
3
- API contracts for the Lokalise Ragnarok Service.
4
- This package provides type-safe, validated API route definitions using Zod schemas.
5
-
6
- ## Installation
7
-
8
- ```bash
9
- npm install @lokalise/ragnarok-api-contracts
10
- ```
11
-
12
- ### Peer Dependencies
13
-
14
- This package requires `zod` as a peer dependency:
15
-
16
- ```bash
17
- npm install zod@^4.0.0
18
- ```
19
-
20
- ## License
21
-
22
- Apache-2.0
1
+ # @lokalise/ragnarok-api-contracts
2
+
3
+ API contracts for the Lokalise Ragnarok Service.
4
+ This package provides type-safe, validated API route definitions using Zod schemas.
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ npm install @lokalise/ragnarok-api-contracts
10
+ ```
11
+
12
+ ### Peer Dependencies
13
+
14
+ This package requires `zod` as a peer dependency:
15
+
16
+ ```bash
17
+ npm install zod@^4.0.0
18
+ ```
19
+
20
+ ## License
21
+
22
+ Apache-2.0
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ export declare const AUTH_HEADERS: z.ZodObject<{
3
+ authorization: z.ZodString;
4
+ }, z.core.$strip>;
5
+ export declare const WEBHOOK_SCHEMA: z.ZodObject<{
6
+ url: z.ZodURL;
7
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
8
+ }, z.core.$strip>;
package/dist/common.js ADDED
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ export const AUTH_HEADERS = z.object({
3
+ authorization: z.string(),
4
+ });
5
+ export const WEBHOOK_SCHEMA = z
6
+ .object({
7
+ url: z
8
+ .url()
9
+ .max(2048)
10
+ .describe('The URL to which the webhook will be sent as HTTP POST request once the job has finished.'),
11
+ headers: z
12
+ .record(z
13
+ .string()
14
+ .regex(/^[A-Za-z0-9-]+$/, {
15
+ message: 'Header names must contain only letters, numbers, and dashes',
16
+ })
17
+ .max(128)
18
+ .describe('The HTTP header name (e.g., Authorization, X-Custom-Id)'), z.string().min(1).max(2048).describe('The HTTP header value; must be a non-empty string'))
19
+ .optional()
20
+ .describe('Additional headers to include in the webhook request.'),
21
+ })
22
+ .describe('Configuration for sending a webhook callback when the job completes.');
23
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,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,cAAc,GAAG,CAAC;KAC5B,MAAM,CAAC;IACN,GAAG,EAAE,CAAC;SACH,GAAG,EAAE;SACL,GAAG,CAAC,IAAI,CAAC;SACT,QAAQ,CACP,2FAA2F,CAC5F;IACH,OAAO,EAAE,CAAC;SACP,MAAM,CACL,CAAC;SACE,MAAM,EAAE;SACR,KAAK,CAAC,iBAAiB,EAAE;QACxB,OAAO,EAAE,6DAA6D;KACvE,CAAC;SACD,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,CAAC,yDAAyD,CAAC,EACtE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,mDAAmD,CAAC,CAC1F;SACA,QAAQ,EAAE;SACV,QAAQ,CAAC,uDAAuD,CAAC;CACrE,CAAC;KACD,QAAQ,CAAC,sEAAsE,CAAC,CAAA"}
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ declare const GET_EVALUATION_SCHEMA: z.ZodObject<{
3
+ evaluationId: z.ZodUUID;
4
+ }, z.core.$strip>;
5
+ export type GetEvaluationParams = z.infer<typeof GET_EVALUATION_SCHEMA>;
6
+ export declare const getEvaluation: import("@lokalise/api-contracts").GetRouteDefinition<z.ZodObject<{
7
+ id: z.ZodUUID;
8
+ ownerId: z.ZodString;
9
+ }, z.core.$strip>, z.ZodObject<{
10
+ evaluationId: z.ZodUUID;
11
+ }, z.core.$strip>, undefined, z.ZodObject<{
12
+ authorization: z.ZodString;
13
+ }, z.core.$strip>, undefined, false, false, undefined>;
14
+ export declare const postScheduleEvaluation: import("@lokalise/api-contracts").PayloadRouteDefinition<z.ZodObject<{
15
+ correlationId: z.ZodString;
16
+ datasets: z.ZodRecord<z.ZodString, z.ZodURL>;
17
+ webhook: z.ZodObject<{
18
+ url: z.ZodURL;
19
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
20
+ }, z.core.$strip>;
21
+ }, z.core.$strip>, z.ZodObject<{
22
+ evaluationId: z.ZodUUID;
23
+ }, z.core.$strip>, undefined, undefined, z.ZodObject<{
24
+ authorization: z.ZodString;
25
+ }, z.core.$strip>, undefined, false, false, undefined>;
26
+ export {};
@@ -0,0 +1,35 @@
1
+ import { buildGetRoute, buildPayloadRoute } from '@lokalise/api-contracts';
2
+ import { z } from 'zod';
3
+ import { AUTH_HEADERS, WEBHOOK_SCHEMA } from "./common.js";
4
+ import { EVALUATION_SCHEMA } from "./objects.js";
5
+ const GET_EVALUATION_SCHEMA = z.object({
6
+ evaluationId: z.uuid().describe('The unique identifier of the evaluation to retrieve.'),
7
+ });
8
+ export const getEvaluation = buildGetRoute({
9
+ pathResolver: (params) => `/v1/evaluations/${params.evaluationId}`,
10
+ description: 'Retrieve evaluation by id',
11
+ requestPathParamsSchema: GET_EVALUATION_SCHEMA,
12
+ requestHeaderSchema: AUTH_HEADERS,
13
+ successResponseBodySchema: EVALUATION_SCHEMA,
14
+ });
15
+ export const postScheduleEvaluation = buildPayloadRoute({
16
+ method: 'post',
17
+ pathResolver: () => '/v1/evaluations',
18
+ description: 'Schedule evaluation',
19
+ requestHeaderSchema: AUTH_HEADERS,
20
+ requestBodySchema: z.object({
21
+ correlationId: z
22
+ .string()
23
+ .describe('A unique identifier to correlate this evaluation with external systems and enforce idempotency.'),
24
+ datasets: z
25
+ .record(z.string(), z.url())
26
+ .describe('List of the dataset file URLs to be evaluated, keyed by a unique id. Must be in a special format within a JSONL container file.'),
27
+ webhook: WEBHOOK_SCHEMA,
28
+ }),
29
+ successResponseBodySchema: z.object({
30
+ evaluationId: z
31
+ .uuid()
32
+ .describe('The unique identifier of the scheduled evaluation. Use it to retrieve the evaluation results later.'),
33
+ }),
34
+ });
35
+ //# sourceMappingURL=evaluation-contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluation-contracts.js","sourceRoot":"","sources":["../src/evaluation-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC1E,OAAO,EAAE,CAAC,EAAE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0 +1,3 @@
1
+ export * from "./evaluation-contracts.js";
2
+ export * from "./objects.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,cAAc,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+ export declare const EVALUATION_SCHEMA: z.ZodObject<{
3
+ id: z.ZodUUID;
4
+ ownerId: z.ZodString;
5
+ }, z.core.$strip>;
6
+ export type Evaluation = z.infer<typeof EVALUATION_SCHEMA>;
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+ export const EVALUATION_SCHEMA = z.object({
3
+ id: z.uuid(),
4
+ ownerId: z.string(),
5
+ });
6
+ //# sourceMappingURL=objects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objects.js","sourceRoot":"","sources":["../src/objects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE;IACZ,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "@lokalise/ragnarok-api-contracts",
3
- "version": "0.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
- "scripts": {
31
- "build": "rimraf dist && tsc -p tsconfig.build.json",
32
- "lint": "biome check . && tsc",
33
- "lint:fix": "biome check --write",
34
- "package-version": "echo $npm_package_version",
35
- "postversion": "biome check --write package.json"
36
- },
37
- "devDependencies": {
38
- "@biomejs/biome": "^2.3.8",
39
- "@lokalise/biome-config": "^3.1.0",
40
- "@lokalise/tsconfig": "^3.0.0",
41
- "rimraf": "^6.0.1",
42
- "typescript": "5.9.3"
43
- },
44
- "peerDependencies": {
45
- "zod": "^4.0.0"
46
- },
47
- "dependencies": {
48
- "@lokalise/api-contracts": "^6.1.0"
49
- }
50
- }
1
+ {
2
+ "name": "@lokalise/ragnarok-api-contracts",
3
+ "version": "0.1.0",
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
+ "scripts": {
31
+ "build": "rimraf dist && tsc -p tsconfig.build.json",
32
+ "lint": "biome check . && tsc",
33
+ "lint:fix": "biome check --write",
34
+ "package-version": "echo $npm_package_version",
35
+ "postversion": "biome check --write package.json"
36
+ },
37
+ "devDependencies": {
38
+ "@biomejs/biome": "^2.3.8",
39
+ "@lokalise/biome-config": "^3.1.0",
40
+ "@lokalise/tsconfig": "^3.0.0",
41
+ "rimraf": "^6.0.1",
42
+ "typescript": "5.9.3"
43
+ },
44
+ "peerDependencies": {
45
+ "zod": "^4.0.0"
46
+ },
47
+ "dependencies": {
48
+ "@lokalise/api-contracts": "^6.1.0"
49
+ }
50
+ }