@lokalise/glossary-api-contracts 0.8.0 → 0.10.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.
@@ -16,13 +16,12 @@ export declare const MAX_TAG_LENGTH = 128;
16
16
  export declare const MAX_TERM_TEXT_LENGTH = 256;
17
17
  export declare const MAX_LOCALE_LENGTH = 35;
18
18
  export declare const MAX_ATTRIBUTE_VALUE_LENGTH = 100;
19
- export declare const TERM_ATTRIBUTES_SCHEMA: z.ZodObject<{
20
- partOfSpeech: z.ZodOptional<z.ZodString>;
21
- gender: z.ZodOptional<z.ZodString>;
22
- plurals: z.ZodOptional<z.ZodString>;
23
- caseSensitive: z.ZodOptional<z.ZodString>;
24
- }, z.core.$strict>;
19
+ export declare const MAX_ATTRIBUTE_KEY_LENGTH = 50;
20
+ export declare const MAX_ATTRIBUTES_PER_TERM = 20;
21
+ export declare const TERM_FIELD_VALUE_SCHEMA: z.ZodString;
22
+ export declare const TERM_ATTRIBUTES_SCHEMA: z.ZodRecord<z.ZodString, z.ZodString>;
25
23
  export type TermAttributes = z.infer<typeof TERM_ATTRIBUTES_SCHEMA>;
24
+ export declare const CONCEPT_DESCRIPTION_SCHEMA: z.ZodString;
26
25
  export declare const CONCEPT_ID_SCHEMA: z.ZodUUID;
27
26
  export type ConceptId = z.infer<typeof CONCEPT_ID_SCHEMA>;
28
27
  export declare const TERM_ID_SCHEMA: z.ZodUUID;
@@ -45,16 +44,15 @@ export declare const TERM_SCHEMA: z.ZodObject<{
45
44
  }>;
46
45
  description: z.ZodNullable<z.ZodString>;
47
46
  authorId: z.ZodNullable<z.ZodUUID>;
48
- attributes: z.ZodObject<{
49
- partOfSpeech: z.ZodOptional<z.ZodString>;
50
- gender: z.ZodOptional<z.ZodString>;
51
- plurals: z.ZodOptional<z.ZodString>;
52
- caseSensitive: z.ZodOptional<z.ZodString>;
53
- }, z.core.$strict>;
47
+ partOfSpeech: z.ZodNullable<z.ZodString>;
48
+ gender: z.ZodNullable<z.ZodString>;
49
+ plurals: z.ZodNullable<z.ZodString>;
50
+ attributes: z.ZodRecord<z.ZodString, z.ZodString>;
54
51
  }, z.core.$strip>;
55
52
  export type Term = z.infer<typeof TERM_SCHEMA>;
56
53
  export declare const CONCEPT_SCHEMA: z.ZodObject<{
57
54
  id: z.ZodUUID;
55
+ description: z.ZodNullable<z.ZodString>;
58
56
  tags: z.ZodArray<z.ZodString>;
59
57
  terms: z.ZodArray<z.ZodObject<{
60
58
  id: z.ZodUUID;
@@ -72,12 +70,10 @@ export declare const CONCEPT_SCHEMA: z.ZodObject<{
72
70
  }>;
73
71
  description: z.ZodNullable<z.ZodString>;
74
72
  authorId: z.ZodNullable<z.ZodUUID>;
75
- attributes: z.ZodObject<{
76
- partOfSpeech: z.ZodOptional<z.ZodString>;
77
- gender: z.ZodOptional<z.ZodString>;
78
- plurals: z.ZodOptional<z.ZodString>;
79
- caseSensitive: z.ZodOptional<z.ZodString>;
80
- }, z.core.$strict>;
73
+ partOfSpeech: z.ZodNullable<z.ZodString>;
74
+ gender: z.ZodNullable<z.ZodString>;
75
+ plurals: z.ZodNullable<z.ZodString>;
76
+ attributes: z.ZodRecord<z.ZodString, z.ZodString>;
81
77
  }, z.core.$strip>>;
82
78
  }, z.core.$strip>;
83
79
  export type Concept = z.infer<typeof CONCEPT_SCHEMA>;
@@ -15,22 +15,34 @@ export const MAX_TERM_TEXT_LENGTH = 256;
15
15
  // RFC 5646 requires a protocol that limits a language tag to allow at least 35 characters.
16
16
  export const MAX_LOCALE_LENGTH = 35;
17
17
  export const MAX_ATTRIBUTE_VALUE_LENGTH = 100;
18
+ export const MAX_ATTRIBUTE_KEY_LENGTH = 50;
19
+ export const MAX_ATTRIBUTES_PER_TERM = 20;
18
20
  // A value has no control character of the Unicode category Cc, such as a tab or a line feed,
19
21
  // and no line separator (Zl) or paragraph separator (Zp). Such a character can break a prompt of
20
22
  // AI translation. The format characters of the category Cf stay, because some scripts need them.
21
- const ATTRIBUTE_VALUE_SCHEMA = z
23
+ // The optional fields of a term and the values of its attributes follow the same rule.
24
+ export const TERM_FIELD_VALUE_SCHEMA = z
22
25
  .string()
23
26
  .min(1)
24
27
  .max(MAX_ATTRIBUTE_VALUE_LENGTH)
25
28
  .regex(/^[^\p{Cc}\p{Zl}\p{Zp}]*$/u);
29
+ const ATTRIBUTE_KEY_SCHEMA = z
30
+ .string()
31
+ .min(1)
32
+ .max(MAX_ATTRIBUTE_KEY_LENGTH)
33
+ .regex(/^[A-Za-z0-9]*$/, 'An attribute key has only ASCII letters and digits');
26
34
  export const TERM_ATTRIBUTES_SCHEMA = z
27
- .strictObject({
28
- partOfSpeech: ATTRIBUTE_VALUE_SCHEMA.optional().describe('Part of speech of the term'),
29
- gender: ATTRIBUTE_VALUE_SCHEMA.optional().describe('Grammatical gender of the term'),
30
- plurals: ATTRIBUTE_VALUE_SCHEMA.optional().describe('Plural forms of the term'),
31
- caseSensitive: ATTRIBUTE_VALUE_SCHEMA.optional().describe('Whether a match keeps the case of the term'),
32
- })
33
- .describe('Optional fields of the term that Lokalise defines');
35
+ .record(ATTRIBUTE_KEY_SCHEMA, TERM_FIELD_VALUE_SCHEMA)
36
+ .refine((attributes) => Object.keys(attributes).length <= MAX_ATTRIBUTES_PER_TERM, `A term has at most ${MAX_ATTRIBUTES_PER_TERM} attributes`)
37
+ .describe('Other fields of the term, as a map from a key to a text value. The service does not know any key by name');
38
+ export const CONCEPT_DESCRIPTION_SCHEMA = z
39
+ .string()
40
+ .min(1)
41
+ .max(MAX_DESCRIPTION_LENGTH)
42
+ .regex(/^\S(?:[\s\S]*\S)?$/, 'The description must not start or end with whitespace')
43
+ // Postgres cannot store the null character in a text column.
44
+ .refine((description) => !description.includes('\u0000'), 'The description must not contain the null character')
45
+ .describe('Description of the concept, without whitespace at the start or the end, and without the null character.');
34
46
  export const CONCEPT_ID_SCHEMA = z.uuid().describe('ID of the concept');
35
47
  export const TERM_ID_SCHEMA = z.uuid().describe('ID of the term');
36
48
  // The field of the term schema adds `null` and the description.
@@ -43,10 +55,14 @@ export const TERM_SCHEMA = z.object({
43
55
  status: z.enum(TermStatusEnum).describe('Status of the term'),
44
56
  description: z.string().nullable().describe('Description of the term'),
45
57
  authorId: TERM_AUTHOR_ID_SCHEMA.nullable().describe('UUID of the user who wrote the term'),
58
+ partOfSpeech: TERM_FIELD_VALUE_SCHEMA.nullable().describe('Part of speech of the term, such as `noun`'),
59
+ gender: TERM_FIELD_VALUE_SCHEMA.nullable().describe('Grammatical gender of the term'),
60
+ plurals: TERM_FIELD_VALUE_SCHEMA.nullable().describe('Plural forms of the term'),
46
61
  attributes: TERM_ATTRIBUTES_SCHEMA,
47
62
  });
48
63
  export const CONCEPT_SCHEMA = z.object({
49
64
  id: CONCEPT_ID_SCHEMA,
65
+ description: z.string().nullable().describe('Description of the concept'),
50
66
  tags: z
51
67
  .array(z.string().min(1).max(MAX_TAG_LENGTH))
52
68
  .describe('Tags of the concept in byte order. Each tag applies to every term of the concept'),
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/api/contracts/concepts/common.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAA;AAEtB,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,gBAAgB,EAAE,kBAAkB;CAC5B,CAAA;AAGV,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,MAAM,EAAE,QAAQ;IAChB,YAAY,EAAE,cAAc;CACpB,CAAA;AAGV,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAA;AAE1C,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;AAEjC,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAA;AAEvC,2FAA2F;AAC3F,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAA;AAEnC,MAAM,C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AE,EAAE,iBAAiB;IACrB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IACzE,IAAI,EAAE,CAAC;SACJ,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;SAC5C,QAAQ,CAAC,kFAAkF,CAAC;IAC/F,KAAK,EAAE,CAAC;SACL,KAAK,CAAC,WAAW,CAAC;SAClB,QAAQ,CACP,4FAA4F,CAC7F;CACJ,CAAC,CAAA"}
@@ -10,6 +10,7 @@ export type ListConceptsRequestQuery = z.input<typeof LIST_CONCEPTS_REQUEST_QUER
10
10
  declare const LIST_CONCEPTS_RESPONSE_BODY_SCHEMA: z.ZodObject<{
11
11
  data: z.ZodArray<z.ZodObject<{
12
12
  id: z.ZodUUID;
13
+ description: z.ZodNullable<z.ZodString>;
13
14
  tags: z.ZodArray<z.ZodString>;
14
15
  terms: z.ZodArray<z.ZodObject<{
15
16
  id: z.ZodUUID;
@@ -27,12 +28,10 @@ declare const LIST_CONCEPTS_RESPONSE_BODY_SCHEMA: z.ZodObject<{
27
28
  }>;
28
29
  description: z.ZodNullable<z.ZodString>;
29
30
  authorId: z.ZodNullable<z.ZodUUID>;
30
- attributes: z.ZodObject<{
31
- partOfSpeech: z.ZodOptional<z.ZodString>;
32
- gender: z.ZodOptional<z.ZodString>;
33
- plurals: z.ZodOptional<z.ZodString>;
34
- caseSensitive: z.ZodOptional<z.ZodString>;
35
- }, z.core.$strict>;
31
+ partOfSpeech: z.ZodNullable<z.ZodString>;
32
+ gender: z.ZodNullable<z.ZodString>;
33
+ plurals: z.ZodNullable<z.ZodString>;
34
+ attributes: z.ZodRecord<z.ZodString, z.ZodString>;
36
35
  }, z.core.$strip>>;
37
36
  }, z.core.$strip>>;
38
37
  meta: z.ZodObject<{
@@ -74,6 +73,7 @@ export declare const listConceptsContract: Omit<{
74
73
  readonly 200: z.ZodObject<{
75
74
  data: z.ZodArray<z.ZodObject<{
76
75
  id: z.ZodUUID;
76
+ description: z.ZodNullable<z.ZodString>;
77
77
  tags: z.ZodArray<z.ZodString>;
78
78
  terms: z.ZodArray<z.ZodObject<{
79
79
  id: z.ZodUUID;
@@ -91,12 +91,10 @@ export declare const listConceptsContract: Omit<{
91
91
  }>;
92
92
  description: z.ZodNullable<z.ZodString>;
93
93
  authorId: z.ZodNullable<z.ZodUUID>;
94
- attributes: z.ZodObject<{
95
- partOfSpeech: z.ZodOptional<z.ZodString>;
96
- gender: z.ZodOptional<z.ZodString>;
97
- plurals: z.ZodOptional<z.ZodString>;
98
- caseSensitive: z.ZodOptional<z.ZodString>;
99
- }, z.core.$strict>;
94
+ partOfSpeech: z.ZodNullable<z.ZodString>;
95
+ gender: z.ZodNullable<z.ZodString>;
96
+ plurals: z.ZodNullable<z.ZodString>;
97
+ attributes: z.ZodRecord<z.ZodString, z.ZodString>;
100
98
  }, z.core.$strip>>;
101
99
  }, z.core.$strip>>;
102
100
  meta: z.ZodObject<{
@@ -0,0 +1,143 @@
1
+ import z from 'zod/v4';
2
+ declare const UPDATE_CONCEPT_REQUEST_BODY_SCHEMA: z.ZodObject<{
3
+ description: z.ZodNullable<z.ZodString>;
4
+ }, z.core.$strip>;
5
+ export type UpdateConceptRequestBody = z.infer<typeof UPDATE_CONCEPT_REQUEST_BODY_SCHEMA>;
6
+ declare const UPDATE_CONCEPT_RESPONSE_BODY_SCHEMA: z.ZodObject<{
7
+ id: z.ZodUUID;
8
+ description: z.ZodNullable<z.ZodString>;
9
+ tags: z.ZodArray<z.ZodString>;
10
+ terms: z.ZodArray<z.ZodObject<{
11
+ id: z.ZodUUID;
12
+ locale: z.ZodString;
13
+ text: z.ZodString;
14
+ kind: z.ZodEnum<{
15
+ readonly PREFERRED: 'preferred';
16
+ readonly ADMITTED: 'admitted';
17
+ readonly FORBIDDEN: 'forbidden';
18
+ readonly DO_NOT_TRANSLATE: 'do_not_translate';
19
+ }>;
20
+ status: z.ZodEnum<{
21
+ readonly ACTIVE: 'active';
22
+ readonly NEEDS_REVIEW: 'needs_review';
23
+ }>;
24
+ description: z.ZodNullable<z.ZodString>;
25
+ authorId: z.ZodNullable<z.ZodUUID>;
26
+ partOfSpeech: z.ZodNullable<z.ZodString>;
27
+ gender: z.ZodNullable<z.ZodString>;
28
+ plurals: z.ZodNullable<z.ZodString>;
29
+ attributes: z.ZodRecord<z.ZodString, z.ZodString>;
30
+ }, z.core.$strip>>;
31
+ }, z.core.$strip>;
32
+ export type UpdateConceptResponseBody = z.infer<typeof UPDATE_CONCEPT_RESPONSE_BODY_SCHEMA>;
33
+ export declare const updateConceptContract: Omit<{
34
+ readonly method: "patch";
35
+ readonly summary: "Change the description of a concept";
36
+ readonly description: "Sets the description of the concept, or removes it with `null`, and returns the concept with its tags and its terms.";
37
+ readonly tags: readonly ["Concepts"];
38
+ readonly visibility: "internal";
39
+ readonly requestPathParamsSchema: z.ZodObject<{
40
+ teamId: z.ZodUUID;
41
+ glossaryId: z.ZodUUID;
42
+ conceptId: z.ZodUUID;
43
+ }, z.core.$strip>;
44
+ readonly requestBodySchema: z.ZodObject<{
45
+ description: z.ZodNullable<z.ZodString>;
46
+ }, z.core.$strip>;
47
+ readonly requestHeaderSchema: z.ZodObject<{
48
+ authorization: z.ZodOptional<z.ZodString>;
49
+ }, z.core.$loose>;
50
+ readonly pathResolver: (params: {
51
+ teamId: string;
52
+ glossaryId: string;
53
+ conceptId: string;
54
+ }) => `/v1/teams/${string}/glossaries/${string}/concepts/${string}`;
55
+ readonly responsesByStatusCode: {
56
+ readonly 400: z.ZodObject<{
57
+ message: z.ZodString;
58
+ errorCode: z.ZodString;
59
+ details: z.ZodOptional<z.ZodUnknown>;
60
+ }, z.core.$strip>;
61
+ readonly 200: z.ZodObject<{
62
+ id: z.ZodUUID;
63
+ description: z.ZodNullable<z.ZodString>;
64
+ tags: z.ZodArray<z.ZodString>;
65
+ terms: z.ZodArray<z.ZodObject<{
66
+ id: z.ZodUUID;
67
+ locale: z.ZodString;
68
+ text: z.ZodString;
69
+ kind: z.ZodEnum<{
70
+ readonly PREFERRED: 'preferred';
71
+ readonly ADMITTED: 'admitted';
72
+ readonly FORBIDDEN: 'forbidden';
73
+ readonly DO_NOT_TRANSLATE: 'do_not_translate';
74
+ }>;
75
+ status: z.ZodEnum<{
76
+ readonly ACTIVE: 'active';
77
+ readonly NEEDS_REVIEW: 'needs_review';
78
+ }>;
79
+ description: z.ZodNullable<z.ZodString>;
80
+ authorId: z.ZodNullable<z.ZodUUID>;
81
+ partOfSpeech: z.ZodNullable<z.ZodString>;
82
+ gender: z.ZodNullable<z.ZodString>;
83
+ plurals: z.ZodNullable<z.ZodString>;
84
+ attributes: z.ZodRecord<z.ZodString, z.ZodString>;
85
+ }, z.core.$strip>>;
86
+ }, z.core.$strip>;
87
+ readonly '5xx': z.ZodObject<{
88
+ message: z.ZodString;
89
+ code: z.ZodString;
90
+ errorCode: z.ZodString;
91
+ details: z.ZodOptional<z.ZodUnknown>;
92
+ }, z.core.$strip>;
93
+ readonly 401: z.ZodType<{
94
+ message: string;
95
+ code: "INVALID_CREDENTIALS";
96
+ errorCode: "INVALID_CREDENTIALS";
97
+ } | {
98
+ message: string;
99
+ code: "EXPIRED_CREDENTIALS";
100
+ errorCode: "EXPIRED_CREDENTIALS";
101
+ }, unknown, z.core.$ZodTypeInternals<{
102
+ message: string;
103
+ code: "INVALID_CREDENTIALS";
104
+ errorCode: "INVALID_CREDENTIALS";
105
+ } | {
106
+ message: string;
107
+ code: "EXPIRED_CREDENTIALS";
108
+ errorCode: "EXPIRED_CREDENTIALS";
109
+ }, unknown>>;
110
+ readonly 403: z.ZodType<{
111
+ message: string;
112
+ code: "INSUFFICIENT_TEAM_ROLE";
113
+ errorCode: "INSUFFICIENT_TEAM_ROLE";
114
+ }, unknown, z.core.$ZodTypeInternals<{
115
+ message: string;
116
+ code: "INSUFFICIENT_TEAM_ROLE";
117
+ errorCode: "INSUFFICIENT_TEAM_ROLE";
118
+ }, unknown>>;
119
+ readonly 404: z.ZodType<{
120
+ message: string;
121
+ code: "GLOSSARY_NOT_FOUND";
122
+ errorCode: "GLOSSARY_NOT_FOUND";
123
+ } | {
124
+ message: string;
125
+ code: "CONCEPT_NOT_FOUND";
126
+ errorCode: "CONCEPT_NOT_FOUND";
127
+ }, unknown, z.core.$ZodTypeInternals<{
128
+ message: string;
129
+ code: "GLOSSARY_NOT_FOUND";
130
+ errorCode: "GLOSSARY_NOT_FOUND";
131
+ } | {
132
+ message: string;
133
+ code: "CONCEPT_NOT_FOUND";
134
+ errorCode: "CONCEPT_NOT_FOUND";
135
+ }, unknown>>;
136
+ };
137
+ readonly metadata: {
138
+ expertAllowedTeamRoles: import("../../auth.ts").ExpertTeamRole[];
139
+ };
140
+ }, "visibility"> & {
141
+ visibility: import("@lokalise/api-contracts").RouteVisibility;
142
+ };
143
+ export {};
@@ -0,0 +1,43 @@
1
+ import { defineApiContract } from '@lokalise/api-contracts';
2
+ import { mergeErrorSchemasByStatusCode } from '@lokalise/errors';
3
+ import z from 'zod/v4';
4
+ import { EXPERT_ADMIN_ROLES } from '../../auth.js';
5
+ import { CONCEPT_NOT_FOUND_ERROR_DEFINITION, GLOSSARY_NOT_FOUND_ERROR_DEFINITION, } from '../../errors/index.js';
6
+ import { OpenApiTags } from '../../open-api-tags.js';
7
+ import { AUTH_ERROR_RESPONSES, AUTH_HEADERS, INTERNAL_SERVER_ERROR_RESPONSE_SCHEMA, TEAM_ID_SCHEMA, } from '../common.js';
8
+ import { GLOSSARY_ID_SCHEMA } from '../glossaries/common.js';
9
+ import { CONCEPT_DESCRIPTION_SCHEMA, CONCEPT_ID_SCHEMA, CONCEPT_SCHEMA } from './common.js';
10
+ // PATCH /v1/teams/:teamId/glossaries/:glossaryId/concepts/:conceptId
11
+ const UPDATE_CONCEPT_REQUEST_PARAMS_SCHEMA = z.compile(z.object({
12
+ teamId: TEAM_ID_SCHEMA,
13
+ glossaryId: GLOSSARY_ID_SCHEMA,
14
+ conceptId: CONCEPT_ID_SCHEMA,
15
+ }));
16
+ const UPDATE_CONCEPT_REQUEST_BODY_SCHEMA = z.compile(z.object({
17
+ description: CONCEPT_DESCRIPTION_SCHEMA.nullable().describe('New description of the concept, or `null` to remove the description'),
18
+ }));
19
+ const UPDATE_CONCEPT_RESPONSE_BODY_SCHEMA = z.compile(CONCEPT_SCHEMA);
20
+ export const updateConceptContract = defineApiContract({
21
+ method: 'patch',
22
+ summary: 'Change the description of a concept',
23
+ description: 'Sets the description of the concept, or removes it with `null`, and returns the concept with its tags and its terms.',
24
+ tags: [OpenApiTags.Concepts.name],
25
+ visibility: 'internal',
26
+ requestPathParamsSchema: UPDATE_CONCEPT_REQUEST_PARAMS_SCHEMA,
27
+ requestBodySchema: UPDATE_CONCEPT_REQUEST_BODY_SCHEMA,
28
+ requestHeaderSchema: AUTH_HEADERS,
29
+ pathResolver: (params) => `/v1/teams/${params.teamId}/glossaries/${params.glossaryId}/concepts/${params.conceptId}`,
30
+ responsesByStatusCode: {
31
+ 200: UPDATE_CONCEPT_RESPONSE_BODY_SCHEMA,
32
+ ...AUTH_ERROR_RESPONSES,
33
+ ...mergeErrorSchemasByStatusCode([
34
+ GLOSSARY_NOT_FOUND_ERROR_DEFINITION,
35
+ CONCEPT_NOT_FOUND_ERROR_DEFINITION,
36
+ ]),
37
+ '5xx': INTERNAL_SERVER_ERROR_RESPONSE_SCHEMA,
38
+ },
39
+ metadata: {
40
+ expertAllowedTeamRoles: EXPERT_ADMIN_ROLES,
41
+ },
42
+ });
43
+ //# sourceMappingURL=update-concept.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-concept.js","sourceRoot":"","sources":["../../../../src/api/contracts/concepts/update-concept.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAA;AAChE,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AAM,CAAC,UAAU,aAAa,MAAM,CAAC,SAAS,EAAE;IAC3F,qBAAqB,EAAE;QACrB,GAAG,EAAE,mCAAmC;QACxC,GAAG,oBAAoB;QACvB,GAAG,6BAA6B,CAAC;YAC/B,mCAAmC;YACnC,kCAAkC;SACnC,CAAC;QACF,KAAK,EAAE,qCAAqC;KAC7C;IACD,QAAQ,EAAE;QACR,sBAAsB,EAAE,kBAAkB;KACL;CACxC,CAAC,CAAA"}
@@ -1,6 +1,7 @@
1
1
  export * from './common.ts';
2
2
  export * from './concepts/common.ts';
3
3
  export * from './concepts/list-concepts.ts';
4
+ export * from './concepts/update-concept.ts';
4
5
  export * from './glossaries/common.ts';
5
6
  export * from './glossaries/confirm-import-upload-completion.ts';
6
7
  export * from './glossaries/create-glossary.ts';
@@ -1,6 +1,7 @@
1
1
  export * from './common.js';
2
2
  export * from './concepts/common.js';
3
3
  export * from './concepts/list-concepts.js';
4
+ export * from './concepts/update-concept.js';
4
5
  export * from './glossaries/common.js';
5
6
  export * from './glossaries/confirm-import-upload-completion.js';
6
7
  export * from './glossaries/create-glossary.js';
@@ -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;AAC/C,cAAc,2CAA2C,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,8BAA8B,CAAA;AAC5C,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"}
@@ -18,6 +18,16 @@ export declare const GLOSSARY_NOT_FOUND_ERROR_DEFINITION: {
18
18
  errorCode: import("zod").ZodLiteral<"GLOSSARY_NOT_FOUND">;
19
19
  }, import("zod/v4/core").$strip>;
20
20
  };
21
+ export declare const CONCEPT_NOT_FOUND_ERROR_DEFINITION: {
22
+ readonly code: "CONCEPT_NOT_FOUND";
23
+ readonly type: "not-found";
24
+ } & {
25
+ schema: import("zod").ZodObject<{
26
+ message: import("zod").ZodString;
27
+ code: import("zod").ZodLiteral<"CONCEPT_NOT_FOUND">;
28
+ errorCode: import("zod").ZodLiteral<"CONCEPT_NOT_FOUND">;
29
+ }, import("zod/v4/core").$strip>;
30
+ };
21
31
  export declare const INVALID_IMPORT_FILE_ERROR_DEFINITION: {
22
32
  readonly code: "INVALID_IMPORT_FILE";
23
33
  readonly type: "bad-request";
@@ -8,6 +8,10 @@ export const GLOSSARY_NOT_FOUND_ERROR_DEFINITION = definePublicError({
8
8
  code: 'GLOSSARY_NOT_FOUND',
9
9
  type: ErrorType.NOT_FOUND,
10
10
  });
11
+ export const CONCEPT_NOT_FOUND_ERROR_DEFINITION = definePublicError({
12
+ code: 'CONCEPT_NOT_FOUND',
13
+ type: ErrorType.NOT_FOUND,
14
+ });
11
15
  export const INVALID_IMPORT_FILE_ERROR_DEFINITION = definePublicError({
12
16
  code: 'INVALID_IMPORT_FILE',
13
17
  type: ErrorType.BAD_REQUEST,
@@ -1 +1 @@
1
- {"version":3,"file":"glossaryErrors.js","sourceRoot":"","sources":["../../../src/api/errors/glossaryErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE/D,uFAA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QAAQ;CACzB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,mCAAmC,GAAG,iBAAiB,CAAC;IACnE,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,SAAS,CAAC,SAAS;CAC1B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,kCAAkC,GAAG,iBAAiB,CAAC;IAClE,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,SAAS,CAAC,SAAS;CAC1B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAAG,iBAAiB,CAAC;IACpE,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE,SAAS,CAAC,WAAW;CAC5B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,sCAAsC,GAAG,iBAAiB,CAAC;IACtE,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,SAAS,CAAC,WAAW;CAC5B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,0CAA0C,GAAG,iBAAiB,CAAC;IAC1E,IAAI,EAAE,2BAA2B;IACjC,IAAI,EAAE,SAAS,CAAC,WAAW;CAC5B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,iCAAiC,GAAG,iBAAiB,CAAC;IACjE,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,SAAS,CAAC,WAAW;CAC5B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,uCAAuC,GAAG,iBAAiB,CAAC;IACvE,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE,SAAS,CAAC,QAAQ;CACzB,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lokalise/glossary-api-contracts",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "API contracts of the Glossary service",
5
5
  "repository": {
6
6
  "type": "git",