@lokalise/glossary-api-contracts 0.9.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,12 +16,10 @@ 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>;
26
24
  export declare const CONCEPT_DESCRIPTION_SCHEMA: z.ZodString;
27
25
  export declare const CONCEPT_ID_SCHEMA: z.ZodUUID;
@@ -46,12 +44,10 @@ export declare const TERM_SCHEMA: z.ZodObject<{
46
44
  }>;
47
45
  description: z.ZodNullable<z.ZodString>;
48
46
  authorId: z.ZodNullable<z.ZodUUID>;
49
- attributes: z.ZodObject<{
50
- partOfSpeech: z.ZodOptional<z.ZodString>;
51
- gender: z.ZodOptional<z.ZodString>;
52
- plurals: z.ZodOptional<z.ZodString>;
53
- caseSensitive: z.ZodOptional<z.ZodString>;
54
- }, 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>;
55
51
  }, z.core.$strip>;
56
52
  export type Term = z.infer<typeof TERM_SCHEMA>;
57
53
  export declare const CONCEPT_SCHEMA: z.ZodObject<{
@@ -74,12 +70,10 @@ export declare const CONCEPT_SCHEMA: z.ZodObject<{
74
70
  }>;
75
71
  description: z.ZodNullable<z.ZodString>;
76
72
  authorId: z.ZodNullable<z.ZodUUID>;
77
- attributes: z.ZodObject<{
78
- partOfSpeech: z.ZodOptional<z.ZodString>;
79
- gender: z.ZodOptional<z.ZodString>;
80
- plurals: z.ZodOptional<z.ZodString>;
81
- caseSensitive: z.ZodOptional<z.ZodString>;
82
- }, 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>;
83
77
  }, z.core.$strip>>;
84
78
  }, z.core.$strip>;
85
79
  export type Concept = z.infer<typeof CONCEPT_SCHEMA>;
@@ -15,22 +15,26 @@ 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');
34
38
  export const CONCEPT_DESCRIPTION_SCHEMA = z
35
39
  .string()
36
40
  .min(1)
@@ -51,6 +55,9 @@ export const TERM_SCHEMA = z.object({
51
55
  status: z.enum(TermStatusEnum).describe('Status of the term'),
52
56
  description: z.string().nullable().describe('Description of the term'),
53
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'),
54
61
  attributes: TERM_ATTRIBUTES_SCHEMA,
55
62
  });
56
63
  export const CONCEPT_SCHEMA = z.object({
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/api/contracts/concepts/common.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CAAC,kFAAkF,CAAC;IAC/F,KAAK,EAAE,CAAC;SACL,KAAK,CAAC,WAAW,CAAC;SAClB,QAAQ,CACP,4FAA4F,CAC7F;CACJ,CAAC,CAAA"}
@@ -28,12 +28,10 @@ declare const LIST_CONCEPTS_RESPONSE_BODY_SCHEMA: z.ZodObject<{
28
28
  }>;
29
29
  description: z.ZodNullable<z.ZodString>;
30
30
  authorId: z.ZodNullable<z.ZodUUID>;
31
- attributes: z.ZodObject<{
32
- partOfSpeech: z.ZodOptional<z.ZodString>;
33
- gender: z.ZodOptional<z.ZodString>;
34
- plurals: z.ZodOptional<z.ZodString>;
35
- caseSensitive: z.ZodOptional<z.ZodString>;
36
- }, 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>;
37
35
  }, z.core.$strip>>;
38
36
  }, z.core.$strip>>;
39
37
  meta: z.ZodObject<{
@@ -93,12 +91,10 @@ export declare const listConceptsContract: Omit<{
93
91
  }>;
94
92
  description: z.ZodNullable<z.ZodString>;
95
93
  authorId: z.ZodNullable<z.ZodUUID>;
96
- attributes: z.ZodObject<{
97
- partOfSpeech: z.ZodOptional<z.ZodString>;
98
- gender: z.ZodOptional<z.ZodString>;
99
- plurals: z.ZodOptional<z.ZodString>;
100
- caseSensitive: z.ZodOptional<z.ZodString>;
101
- }, 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>;
102
98
  }, z.core.$strip>>;
103
99
  }, z.core.$strip>>;
104
100
  meta: z.ZodObject<{
@@ -23,12 +23,10 @@ declare const UPDATE_CONCEPT_RESPONSE_BODY_SCHEMA: z.ZodObject<{
23
23
  }>;
24
24
  description: z.ZodNullable<z.ZodString>;
25
25
  authorId: z.ZodNullable<z.ZodUUID>;
26
- attributes: z.ZodObject<{
27
- partOfSpeech: z.ZodOptional<z.ZodString>;
28
- gender: z.ZodOptional<z.ZodString>;
29
- plurals: z.ZodOptional<z.ZodString>;
30
- caseSensitive: z.ZodOptional<z.ZodString>;
31
- }, z.core.$strict>;
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>;
32
30
  }, z.core.$strip>>;
33
31
  }, z.core.$strip>;
34
32
  export type UpdateConceptResponseBody = z.infer<typeof UPDATE_CONCEPT_RESPONSE_BODY_SCHEMA>;
@@ -80,12 +78,10 @@ export declare const updateConceptContract: Omit<{
80
78
  }>;
81
79
  description: z.ZodNullable<z.ZodString>;
82
80
  authorId: z.ZodNullable<z.ZodUUID>;
83
- attributes: z.ZodObject<{
84
- partOfSpeech: z.ZodOptional<z.ZodString>;
85
- gender: z.ZodOptional<z.ZodString>;
86
- plurals: z.ZodOptional<z.ZodString>;
87
- caseSensitive: z.ZodOptional<z.ZodString>;
88
- }, z.core.$strict>;
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>;
89
85
  }, z.core.$strip>>;
90
86
  }, z.core.$strip>;
91
87
  readonly '5xx': z.ZodObject<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lokalise/glossary-api-contracts",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "API contracts of the Glossary service",
5
5
  "repository": {
6
6
  "type": "git",