@lokalise/glossary-api-contracts 0.7.0 → 0.8.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.
@@ -0,0 +1,88 @@
1
+ import z from 'zod/v4';
2
+ export declare const MAX_GLOSSARY_IDS_PER_BATCH = 100;
3
+ declare const RETRIEVE_GLOSSARIES_BATCH_REQUEST_BODY_SCHEMA: z.ZodObject<{
4
+ glossaryIds: z.ZodArray<z.ZodUUID>;
5
+ }, z.core.$strip>;
6
+ export type RetrieveGlossariesBatchRequestBody = z.infer<typeof RETRIEVE_GLOSSARIES_BATCH_REQUEST_BODY_SCHEMA>;
7
+ declare const BATCH_GLOSSARY_SCHEMA: z.ZodObject<{
8
+ id: z.ZodUUID;
9
+ name: z.ZodString;
10
+ }, z.core.$strip>;
11
+ export type BatchGlossary = z.infer<typeof BATCH_GLOSSARY_SCHEMA>;
12
+ declare const RETRIEVE_GLOSSARIES_BATCH_RESPONSE_BODY_SCHEMA: z.ZodObject<{
13
+ data: z.ZodArray<z.ZodObject<{
14
+ id: z.ZodUUID;
15
+ name: z.ZodString;
16
+ }, z.core.$strip>>;
17
+ }, z.core.$strip>;
18
+ export type RetrieveGlossariesBatchResponseBody = z.infer<typeof RETRIEVE_GLOSSARIES_BATCH_RESPONSE_BODY_SCHEMA>;
19
+ export declare const retrieveGlossariesBatchContract: Omit<{
20
+ readonly method: "post";
21
+ readonly summary: "Read the glossaries of a team for a list of IDs";
22
+ readonly description: "Returns the ID and the name of the glossaries of a team, filtered by IDs and sorted by name, regardless of case. The service compares the IDs regardless of case, and the response has each ID in lower case. The response has a glossary one time when the list repeats its ID. The response does not have an entry for an ID that is not a glossary of the team.";
23
+ readonly tags: readonly ["Glossaries"];
24
+ readonly visibility: "internal";
25
+ readonly requestPathParamsSchema: z.ZodObject<{
26
+ teamId: z.ZodUUID;
27
+ }, z.core.$strip>;
28
+ readonly requestBodySchema: z.ZodObject<{
29
+ glossaryIds: z.ZodArray<z.ZodUUID>;
30
+ }, z.core.$strip>;
31
+ readonly requestHeaderSchema: z.ZodObject<{
32
+ authorization: z.ZodOptional<z.ZodString>;
33
+ }, z.core.$loose>;
34
+ readonly pathResolver: (params: {
35
+ teamId: string;
36
+ }) => `/v1/teams/${string}/glossaries/batch`;
37
+ readonly responsesByStatusCode: {
38
+ readonly 400: z.ZodObject<{
39
+ message: z.ZodString;
40
+ errorCode: z.ZodString;
41
+ details: z.ZodOptional<z.ZodUnknown>;
42
+ }, z.core.$strip>;
43
+ readonly 200: z.ZodObject<{
44
+ data: z.ZodArray<z.ZodObject<{
45
+ id: z.ZodUUID;
46
+ name: z.ZodString;
47
+ }, z.core.$strip>>;
48
+ }, z.core.$strip>;
49
+ readonly '5xx': z.ZodObject<{
50
+ message: z.ZodString;
51
+ code: z.ZodString;
52
+ errorCode: z.ZodString;
53
+ details: z.ZodOptional<z.ZodUnknown>;
54
+ }, z.core.$strip>;
55
+ readonly 401: z.ZodType<{
56
+ message: string;
57
+ code: "INVALID_CREDENTIALS";
58
+ errorCode: "INVALID_CREDENTIALS";
59
+ } | {
60
+ message: string;
61
+ code: "EXPIRED_CREDENTIALS";
62
+ errorCode: "EXPIRED_CREDENTIALS";
63
+ }, unknown, z.core.$ZodTypeInternals<{
64
+ message: string;
65
+ code: "INVALID_CREDENTIALS";
66
+ errorCode: "INVALID_CREDENTIALS";
67
+ } | {
68
+ message: string;
69
+ code: "EXPIRED_CREDENTIALS";
70
+ errorCode: "EXPIRED_CREDENTIALS";
71
+ }, unknown>>;
72
+ readonly 403: z.ZodType<{
73
+ message: string;
74
+ code: "INSUFFICIENT_TEAM_ROLE";
75
+ errorCode: "INSUFFICIENT_TEAM_ROLE";
76
+ }, unknown, z.core.$ZodTypeInternals<{
77
+ message: string;
78
+ code: "INSUFFICIENT_TEAM_ROLE";
79
+ errorCode: "INSUFFICIENT_TEAM_ROLE";
80
+ }, unknown>>;
81
+ };
82
+ readonly metadata: {
83
+ expertAllowedTeamRoles: import("../../auth.ts").ExpertTeamRole[];
84
+ };
85
+ }, "visibility"> & {
86
+ visibility: import("@lokalise/api-contracts").RouteVisibility;
87
+ };
88
+ export {};
@@ -0,0 +1,44 @@
1
+ import { defineApiContract } from '@lokalise/api-contracts';
2
+ import z from 'zod/v4';
3
+ import { EXPERT_ADMIN_ROLES } from '../../auth.js';
4
+ import { OpenApiTags } from '../../open-api-tags.js';
5
+ import { AUTH_ERROR_RESPONSES, AUTH_HEADERS, INTERNAL_SERVER_ERROR_RESPONSE_SCHEMA, TEAM_ID_SCHEMA, } from '../common.js';
6
+ import { GLOSSARY_ID_SCHEMA, GLOSSARY_SCHEMA } from './common.js';
7
+ // POST /v1/teams/:teamId/glossaries/batch
8
+ const RETRIEVE_GLOSSARIES_BATCH_REQUEST_PARAMS_SCHEMA = z.compile(z.object({
9
+ teamId: TEAM_ID_SCHEMA,
10
+ }));
11
+ export const MAX_GLOSSARY_IDS_PER_BATCH = 100;
12
+ const RETRIEVE_GLOSSARIES_BATCH_REQUEST_BODY_SCHEMA = z.compile(z.object({
13
+ glossaryIds: z
14
+ .array(GLOSSARY_ID_SCHEMA)
15
+ .min(1)
16
+ .max(MAX_GLOSSARY_IDS_PER_BATCH)
17
+ .describe('IDs of the glossaries to read. The limit counts a repeated ID each time.'),
18
+ }));
19
+ const BATCH_GLOSSARY_SCHEMA = GLOSSARY_SCHEMA.pick({ id: true, name: true });
20
+ const RETRIEVE_GLOSSARIES_BATCH_RESPONSE_BODY_SCHEMA = z.compile(z.object({
21
+ data: z
22
+ .array(BATCH_GLOSSARY_SCHEMA)
23
+ .describe('Glossaries of the team with the IDs, by name, regardless of case'),
24
+ }));
25
+ export const retrieveGlossariesBatchContract = defineApiContract({
26
+ method: 'post',
27
+ summary: 'Read the glossaries of a team for a list of IDs',
28
+ description: 'Returns the ID and the name of the glossaries of a team, filtered by IDs and sorted by name, regardless of case. The service compares the IDs regardless of case, and the response has each ID in lower case. The response has a glossary one time when the list repeats its ID. The response does not have an entry for an ID that is not a glossary of the team.',
29
+ tags: [OpenApiTags.Glossaries.name],
30
+ visibility: 'internal',
31
+ requestPathParamsSchema: RETRIEVE_GLOSSARIES_BATCH_REQUEST_PARAMS_SCHEMA,
32
+ requestBodySchema: RETRIEVE_GLOSSARIES_BATCH_REQUEST_BODY_SCHEMA,
33
+ requestHeaderSchema: AUTH_HEADERS,
34
+ pathResolver: (params) => `/v1/teams/${params.teamId}/glossaries/batch`,
35
+ responsesByStatusCode: {
36
+ 200: RETRIEVE_GLOSSARIES_BATCH_RESPONSE_BODY_SCHEMA,
37
+ ...AUTH_ERROR_RESPONSES,
38
+ '5xx': INTERNAL_SERVER_ERROR_RESPONSE_SCHEMA,
39
+ },
40
+ metadata: {
41
+ expertAllowedTeamRoles: EXPERT_ADMIN_ROLES,
42
+ },
43
+ });
44
+ //# sourceMappingURL=retrieve-glossaries-batch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retrieve-glossaries-batch.js","sourceRoot":"","sources":["../../../../src/api/contracts/glossaries/retrieve-glossaries-batch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,CAAC,MAAM,QAAQ,CAAA;AACtB,OAAO,EAAE,kBAAkB,EAAoC,MAAM,eAAe,CAAA;AACpF,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,qCAAqC,EACrC,cAAc,GACf,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAEjE,0CAA0C;AAC1C,MAAM,+CAA+C,GAAG,CAAC,CAAC,OAAO,CAC/D,CAAC,CAAC,MAAM,CAAC;IACP,MAAM,EAAE,cAAc;CACvB,CAAC,CACH,CAAA;AAED,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAA;AAE7C,MAAM,6CAA6C,GAAG,CAAC,CAAC,OAAO,CAC7D,CAAC,CAAC,MAAM,CAAC;IACP,WAAW,EAAE,CAAC;SACX,KAAK,CAAC,kBAAkB,CAAC;SACzB,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,0BAA0B,CAAC;SAC/B,QAAQ,CAAC,0EAA0E,CAAC;CACxF,CAAC,CACH,CAAA;AAKD,MAAM,qBAAqB,GAAG,eAAe,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;AAG5E,MAAM,8CAA8C,GAAG,CAAC,CAAC,OAAO,CAC9D,CAAC,CAAC,MAAM,CAAC;IACP,IAAI,EAAE,CAAC;SACJ,KAAK,CAAC,qBAAqB,CAAC;SAC5B,QAAQ,CAAC,kEAAkE,CAAC;CAChF,CAAC,CACH,CAAA;AAKD,MAAM,CAAC,MAAM,+BAA+B,GAAG,iBAAiB,CAAC;IAC/D,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,iDAAiD;IAC1D,WAAW,EACT,oWAAoW;IACtW,IAAI,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC;IACnC,UAAU,EAAE,UAAU;IACtB,uBAAuB,EAAE,+CAA+C;IACxE,iBAAiB,EAAE,6CAA6C;IAChE,mBAAmB,EAAE,YAAY;IACjC,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,MAAM,CAAC,MAAM,mBAAmB;IACvE,qBAAqB,EAAE;QACrB,GAAG,EAAE,8CAA8C;QACnD,GAAG,oBAAoB;QACvB,KAAK,EAAE,qCAAqC;KAC7C;IACD,QAAQ,EAAE;QACR,sBAAsB,EAAE,kBAAkB;KACL;CACxC,CAAC,CAAA"}
@@ -7,3 +7,4 @@ export * from './glossaries/create-glossary.ts';
7
7
  export * from './glossaries/create-import-upload-form.ts';
8
8
  export * from './glossaries/get-glossary.ts';
9
9
  export * from './glossaries/list-glossaries.ts';
10
+ export * from './glossaries/retrieve-glossaries-batch.ts';
@@ -7,4 +7,5 @@ export * from './glossaries/create-glossary.js';
7
7
  export * from './glossaries/create-import-upload-form.js';
8
8
  export * from './glossaries/get-glossary.js';
9
9
  export * from './glossaries/list-glossaries.js';
10
+ export * from './glossaries/retrieve-glossaries-batch.js';
10
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/contracts/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,wBAAwB,CAAA;AACtC,cAAc,kDAAkD,CAAA;AAChE,cAAc,iCAAiC,CAAA;AAC/C,cAAc,2CAA2C,CAAA;AACzD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,iCAAiC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/contracts/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,wBAAwB,CAAA;AACtC,cAAc,kDAAkD,CAAA;AAChE,cAAc,iCAAiC,CAAA;AAC/C,cAAc,2CAA2C,CAAA;AACzD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,2CAA2C,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lokalise/glossary-api-contracts",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "API contracts of the Glossary service",
5
5
  "repository": {
6
6
  "type": "git",