@lokalise/projects-engine-contracts 2.0.3 → 2.0.8

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/README.md CHANGED
@@ -26,6 +26,10 @@ This package is published to NPM automatically when a PR that modifies `packages
26
26
 
27
27
  Every PR touching this package **must** carry exactly one of these labels (enforced by CI).
28
28
 
29
+ ## Peer dependencies
30
+
31
+ This package requires `zod@^4.0.0` as a peer dependency.
32
+
29
33
  ## Installation
30
34
 
31
35
  ```bash
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Public API router definition for getting the list of projects for a given workspace
3
+ */
4
+ export declare const getProjectsListContract: import("@lokalise/api-contracts").GetRouteDefinition<import("zod").ZodObject<{
5
+ data: import("zod").ZodObject<{
6
+ projects: import("zod").ZodArray<import("zod").ZodObject<{
7
+ projectId: import("zod").ZodString;
8
+ uuid: import("zod").ZodGUID;
9
+ name: import("zod").ZodString;
10
+ baseLanguage: import("zod").ZodObject<{
11
+ projectLanguageId: import("zod").ZodNumber;
12
+ languageId: import("zod").ZodNumber;
13
+ languageIso: import("zod").ZodString;
14
+ projectLanguageUuid: import("zod").ZodGUID;
15
+ }, import("zod/v4/core").$strip>;
16
+ targetLanguages: import("zod").ZodArray<import("zod").ZodObject<{
17
+ projectLanguageId: import("zod").ZodNumber;
18
+ languageId: import("zod").ZodNumber;
19
+ languageIso: import("zod").ZodString;
20
+ projectLanguageUuid: import("zod").ZodGUID;
21
+ }, import("zod/v4/core").$strip>>;
22
+ translationSettings: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
23
+ workflowType: import("zod").ZodIntersection<import("zod").ZodEnum<{
24
+ readonly AI_ONLY: "AI_ONLY";
25
+ readonly AI_HUMAN_REVIEW: "AI_HUMAN_REVIEW";
26
+ }>, import("zod").ZodLiteral<"AI_HUMAN_REVIEW">>;
27
+ reviewThreshold: import("zod").ZodEnum<{
28
+ readonly FULL_REVIEW: "FULL_REVIEW";
29
+ readonly CRITICAL_MAJOR_MINOR: "CRITICAL_MAJOR_MINOR";
30
+ readonly CRITICAL_MAJOR: "CRITICAL_MAJOR";
31
+ readonly CRITICAL: "CRITICAL";
32
+ }>;
33
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
34
+ workflowType: import("zod").ZodIntersection<import("zod").ZodEnum<{
35
+ readonly AI_ONLY: "AI_ONLY";
36
+ readonly AI_HUMAN_REVIEW: "AI_HUMAN_REVIEW";
37
+ }>, import("zod").ZodLiteral<"AI_ONLY">>;
38
+ reviewThreshold: import("zod").ZodNull;
39
+ }, import("zod/v4/core").$strip>]>;
40
+ contentSourceType: import("zod").ZodEnum<{
41
+ readonly contentful: "contentful-native";
42
+ readonly googleDrive: "google-drive";
43
+ readonly strapi: "strapi";
44
+ readonly webflowNew: "webflow-new";
45
+ readonly FILE: "file";
46
+ }>;
47
+ }, import("zod/v4/core").$strip>>;
48
+ }, import("zod/v4/core").$strip>;
49
+ meta: import("zod").ZodObject<{
50
+ count: import("zod").ZodNumber;
51
+ }, import("zod/v4/core").$strip>;
52
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
53
+ workspaceId: import("zod").ZodGUID;
54
+ }, import("zod/v4/core").$strip>, undefined, import("zod").ZodObject<{
55
+ authorization: import("zod").ZodString;
56
+ }, import("zod/v4/core").$strip>, undefined, false, false, undefined>;
@@ -0,0 +1,13 @@
1
+ import { buildGetRoute } from '@lokalise/api-contracts';
2
+ import { AUTH_HEADERS, GET_PROJECTS_LIST_PATH_PARAMS_SCHEMA, GET_PROJECTS_LIST_SUCCESS_RESPONSE_BODY, } from './schemas.js';
3
+ /**
4
+ * Public API router definition for getting the list of projects for a given workspace
5
+ */
6
+ export const getProjectsListContract = buildGetRoute({
7
+ pathResolver: (params) => `/v1/workspaces/${params.workspaceId}/projects/list`,
8
+ description: 'Get projects list',
9
+ requestHeaderSchema: AUTH_HEADERS,
10
+ requestPathParamsSchema: GET_PROJECTS_LIST_PATH_PARAMS_SCHEMA,
11
+ successResponseBodySchema: GET_PROJECTS_LIST_SUCCESS_RESPONSE_BODY,
12
+ });
13
+ //# sourceMappingURL=projectsContracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectsContracts.js","sourceRoot":"","sources":["../../src/apiContracts/projectsContracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EACL,YAAY,EACZ,oCAAoC,EACpC,uCAAuC,GACxC,MAAM,cAAc,CAAA;AAErB;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAC;IACnD,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,kBAAkB,MAAM,CAAC,WAAW,gBAAgB;IAC9E,WAAW,EAAE,mBAAmB;IAChC,mBAAmB,EAAE,YAAY;IACjC,uBAAuB,EAAE,oCAAoC;IAC7D,yBAAyB,EAAE,uCAAuC;CACnE,CAAC,CAAA"}
@@ -0,0 +1,63 @@
1
+ import { z } from 'zod/v4';
2
+ export declare const AUTH_HEADERS: z.ZodObject<{
3
+ authorization: z.ZodString;
4
+ }, z.core.$strip>;
5
+ export type AuthHeaders = z.infer<typeof AUTH_HEADERS>;
6
+ export declare const GET_PROJECTS_LIST_PATH_PARAMS_SCHEMA: z.ZodObject<{
7
+ workspaceId: z.ZodGUID;
8
+ }, z.core.$strip>;
9
+ export type GetProjectsListPathParams = z.infer<typeof GET_PROJECTS_LIST_PATH_PARAMS_SCHEMA>;
10
+ export declare const PROJECTS_LIST_RESPONSE_META_SCHEMA: z.ZodObject<{
11
+ count: z.ZodNumber;
12
+ }, z.core.$strip>;
13
+ export type ProjectsListResponseMeta = z.infer<typeof PROJECTS_LIST_RESPONSE_META_SCHEMA>;
14
+ export declare const GET_PROJECTS_LIST_SUCCESS_RESPONSE_BODY: z.ZodObject<{
15
+ data: z.ZodObject<{
16
+ projects: z.ZodArray<z.ZodObject<{
17
+ projectId: z.ZodString;
18
+ uuid: z.ZodGUID;
19
+ name: z.ZodString;
20
+ baseLanguage: z.ZodObject<{
21
+ projectLanguageId: z.ZodNumber;
22
+ languageId: z.ZodNumber;
23
+ languageIso: z.ZodString;
24
+ projectLanguageUuid: z.ZodGUID;
25
+ }, z.core.$strip>;
26
+ targetLanguages: z.ZodArray<z.ZodObject<{
27
+ projectLanguageId: z.ZodNumber;
28
+ languageId: z.ZodNumber;
29
+ languageIso: z.ZodString;
30
+ projectLanguageUuid: z.ZodGUID;
31
+ }, z.core.$strip>>;
32
+ translationSettings: z.ZodUnion<readonly [z.ZodObject<{
33
+ workflowType: z.ZodIntersection<z.ZodEnum<{
34
+ readonly AI_ONLY: "AI_ONLY";
35
+ readonly AI_HUMAN_REVIEW: "AI_HUMAN_REVIEW";
36
+ }>, z.ZodLiteral<"AI_HUMAN_REVIEW">>;
37
+ reviewThreshold: z.ZodEnum<{
38
+ readonly FULL_REVIEW: "FULL_REVIEW";
39
+ readonly CRITICAL_MAJOR_MINOR: "CRITICAL_MAJOR_MINOR";
40
+ readonly CRITICAL_MAJOR: "CRITICAL_MAJOR";
41
+ readonly CRITICAL: "CRITICAL";
42
+ }>;
43
+ }, z.core.$strip>, z.ZodObject<{
44
+ workflowType: z.ZodIntersection<z.ZodEnum<{
45
+ readonly AI_ONLY: "AI_ONLY";
46
+ readonly AI_HUMAN_REVIEW: "AI_HUMAN_REVIEW";
47
+ }>, z.ZodLiteral<"AI_ONLY">>;
48
+ reviewThreshold: z.ZodNull;
49
+ }, z.core.$strip>]>;
50
+ contentSourceType: z.ZodEnum<{
51
+ readonly contentful: "contentful-native";
52
+ readonly googleDrive: "google-drive";
53
+ readonly strapi: "strapi";
54
+ readonly webflowNew: "webflow-new";
55
+ readonly FILE: "file";
56
+ }>;
57
+ }, z.core.$strip>>;
58
+ }, z.core.$strip>;
59
+ meta: z.ZodObject<{
60
+ count: z.ZodNumber;
61
+ }, z.core.$strip>;
62
+ }, z.core.$strip>;
63
+ export type GetProjectsListSuccessResponse = z.infer<typeof GET_PROJECTS_LIST_SUCCESS_RESPONSE_BODY>;
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod/v4';
2
+ import { PROJECT_SCHEMA } from '../project/schemas.js';
3
+ export const AUTH_HEADERS = z.object({
4
+ authorization: z.string().describe('Authorization header'),
5
+ });
6
+ // GET PROJECTS LIST
7
+ export const GET_PROJECTS_LIST_PATH_PARAMS_SCHEMA = z.object({
8
+ workspaceId: z.guid(),
9
+ });
10
+ export const PROJECTS_LIST_RESPONSE_META_SCHEMA = z.object({
11
+ count: z.number(),
12
+ });
13
+ export const GET_PROJECTS_LIST_SUCCESS_RESPONSE_BODY = z.object({
14
+ data: z.object({ projects: z.array(PROJECT_SCHEMA) }),
15
+ meta: PROJECTS_LIST_RESPONSE_META_SCHEMA,
16
+ });
17
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/apiContracts/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;CAC3D,CAAC,CAAA;AAGF,oBAAoB;AACpB,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3D,WAAW,EAAE,CAAC,CAAC,IAAI,EAAE;CACtB,CAAC,CAAA;AAGF,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CAAC;IACzD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;CAClB,CAAC,CAAA;AAGF,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9D,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC;IACrD,IAAI,EAAE,kCAAkC;CACzC,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './apiContracts/projectsContracts.js';
2
+ export * from './apiContracts/schemas.js';
3
+ export * from './project/schemas.js';
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './apiContracts/projectsContracts.js';
2
+ export * from './apiContracts/schemas.js';
3
+ export * from './project/schemas.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAA;AACnD,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA"}
@@ -0,0 +1,61 @@
1
+ import { WorkflowTypeEnum } from '@lokalise/translation-storage-api-schemas';
2
+ import { z } from 'zod/v4';
3
+ export { WorkflowTypeEnum };
4
+ export declare const ContentSourceEnum: {
5
+ readonly contentful: "contentful-native";
6
+ readonly googleDrive: "google-drive";
7
+ readonly strapi: "strapi";
8
+ readonly webflowNew: "webflow-new";
9
+ readonly FILE: "file";
10
+ };
11
+ export type ContentSourceType = (typeof ContentSourceEnum)[keyof typeof ContentSourceEnum];
12
+ export declare const LANGUAGE_SCHEMA: z.ZodObject<{
13
+ projectLanguageId: z.ZodNumber;
14
+ languageId: z.ZodNumber;
15
+ languageIso: z.ZodString;
16
+ projectLanguageUuid: z.ZodGUID;
17
+ }, z.core.$strip>;
18
+ export type Language = z.infer<typeof LANGUAGE_SCHEMA>;
19
+ export declare const PROJECT_SCHEMA: z.ZodObject<{
20
+ projectId: z.ZodString;
21
+ uuid: z.ZodGUID;
22
+ name: z.ZodString;
23
+ baseLanguage: z.ZodObject<{
24
+ projectLanguageId: z.ZodNumber;
25
+ languageId: z.ZodNumber;
26
+ languageIso: z.ZodString;
27
+ projectLanguageUuid: z.ZodGUID;
28
+ }, z.core.$strip>;
29
+ targetLanguages: z.ZodArray<z.ZodObject<{
30
+ projectLanguageId: z.ZodNumber;
31
+ languageId: z.ZodNumber;
32
+ languageIso: z.ZodString;
33
+ projectLanguageUuid: z.ZodGUID;
34
+ }, z.core.$strip>>;
35
+ translationSettings: z.ZodUnion<readonly [z.ZodObject<{
36
+ workflowType: z.ZodIntersection<z.ZodEnum<{
37
+ readonly AI_ONLY: "AI_ONLY";
38
+ readonly AI_HUMAN_REVIEW: "AI_HUMAN_REVIEW";
39
+ }>, z.ZodLiteral<"AI_HUMAN_REVIEW">>;
40
+ reviewThreshold: z.ZodEnum<{
41
+ readonly FULL_REVIEW: "FULL_REVIEW";
42
+ readonly CRITICAL_MAJOR_MINOR: "CRITICAL_MAJOR_MINOR";
43
+ readonly CRITICAL_MAJOR: "CRITICAL_MAJOR";
44
+ readonly CRITICAL: "CRITICAL";
45
+ }>;
46
+ }, z.core.$strip>, z.ZodObject<{
47
+ workflowType: z.ZodIntersection<z.ZodEnum<{
48
+ readonly AI_ONLY: "AI_ONLY";
49
+ readonly AI_HUMAN_REVIEW: "AI_HUMAN_REVIEW";
50
+ }>, z.ZodLiteral<"AI_ONLY">>;
51
+ reviewThreshold: z.ZodNull;
52
+ }, z.core.$strip>]>;
53
+ contentSourceType: z.ZodEnum<{
54
+ readonly contentful: "contentful-native";
55
+ readonly googleDrive: "google-drive";
56
+ readonly strapi: "strapi";
57
+ readonly webflowNew: "webflow-new";
58
+ readonly FILE: "file";
59
+ }>;
60
+ }, z.core.$strip>;
61
+ export type Project = z.infer<typeof PROJECT_SCHEMA>;
@@ -0,0 +1,36 @@
1
+ import { IntegrationEnum } from '@lokalise/content-type-app-engine-contracts';
2
+ import { REVIEW_THRESHOLD_SCHEMA, WORKFLOW_TYPE_SCHEMA, WorkflowTypeEnum, } from '@lokalise/translation-storage-api-schemas';
3
+ import { z } from 'zod/v4';
4
+ // =============================================================================
5
+ // BASE SCHEMAS - Reusable building blocks
6
+ // =============================================================================
7
+ export { WorkflowTypeEnum };
8
+ export const ContentSourceEnum = {
9
+ FILE: 'file',
10
+ ...IntegrationEnum,
11
+ };
12
+ export const LANGUAGE_SCHEMA = z.object({
13
+ projectLanguageId: z.number(),
14
+ languageId: z.number(),
15
+ languageIso: z.string(),
16
+ projectLanguageUuid: z.guid(),
17
+ });
18
+ export const PROJECT_SCHEMA = z.object({
19
+ projectId: z.string(),
20
+ uuid: z.guid(),
21
+ name: z.string(),
22
+ baseLanguage: LANGUAGE_SCHEMA,
23
+ targetLanguages: z.array(LANGUAGE_SCHEMA),
24
+ translationSettings: z.union([
25
+ z.object({
26
+ workflowType: WORKFLOW_TYPE_SCHEMA.and(z.literal(WorkflowTypeEnum.AI_HUMAN_REVIEW)),
27
+ reviewThreshold: REVIEW_THRESHOLD_SCHEMA,
28
+ }),
29
+ z.object({
30
+ workflowType: WORKFLOW_TYPE_SCHEMA.and(z.literal(WorkflowTypeEnum.AI_ONLY)),
31
+ reviewThreshold: z.null(),
32
+ }),
33
+ ]),
34
+ contentSourceType: z.enum(ContentSourceEnum),
35
+ });
36
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/project/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAA;AAC7E,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,2CAA2C,CAAA;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,gFAAgF;AAChF,0CAA0C;AAC1C,gFAAgF;AAEhF,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAE3B,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,MAAM;IACZ,GAAG,eAAe;CACV,CAAA;AAGV,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC7B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,mBAAmB,EAAE,CAAC,CAAC,IAAI,EAAE;CAC9B,CAAC,CAAA;AAGF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,YAAY,EAAE,eAAe;IAC7B,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;IACzC,mBAAmB,EAAE,CAAC,CAAC,KAAK,CAAC;QAC3B,CAAC,CAAC,MAAM,CAAC;YACP,YAAY,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;YACnF,eAAe,EAAE,uBAAuB;SACzC,CAAC;QACF,CAAC,CAAC,MAAM,CAAC;YACP,YAAY,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;YAC3E,eAAe,EAAE,CAAC,CAAC,IAAI,EAAE;SAC1B,CAAC;KACH,CAAC;IACF,iBAAiB,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC;CAC7C,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lokalise/projects-engine-contracts",
3
- "version": "2.0.3",
3
+ "version": "2.0.8",
4
4
  "description": "API contracts and shared schemas for the Projects Engine service",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -11,10 +11,19 @@
11
11
  ".": "./dist/index.js",
12
12
  "./package.json": "./package.json"
13
13
  },
14
+ "license": "Apache-2.0",
14
15
  "private": false,
15
16
  "publishConfig": {
16
- "access": "public"
17
+ "access": "public",
18
+ "provenance": false
17
19
  },
20
+ "homepage": "https://github.com/lokalise/projects-engine",
21
+ "keywords": [
22
+ "projects",
23
+ "contracts",
24
+ "api",
25
+ "schemas"
26
+ ],
18
27
  "sideEffects": false,
19
28
  "scripts": {
20
29
  "build": "rimraf dist && tsc --project tsconfig.build.json",
@@ -24,11 +33,13 @@
24
33
  "test:ci": "npm run lint && npm run test:coverage",
25
34
  "lint": "biome check . && tsc",
26
35
  "lint:fix": "biome check --write",
36
+ "prepublishOnly": "npm run build",
37
+ "postversion": "biome check --write package.json",
27
38
  "package-version": "echo $npm_package_version"
28
39
  },
29
40
  "repository": {
30
41
  "type": "git",
31
- "url": "git://github.com/lokalise/projects-engine.git"
42
+ "url": "git+https://github.com/lokalise/projects-engine.git"
32
43
  },
33
44
  "dependencies": {
34
45
  "@lokalise/api-contracts": "^6.7.0",