@iveri/contracts 0.151.0 → 0.152.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/README.md CHANGED
@@ -214,7 +214,9 @@ needs a string in the _recipient's_ language. `Locale`, `Namespace`, `Message` w
214
214
  surface the translator panel is written against, with `TranslationStatus` and `VariableType`.
215
215
  `TranslationMemory` (what other messages already say for the same source text) and
216
216
  `TranslationConsistencyPage` (source texts translated more than one way in a locale) are the
217
- translator aids, with `TranslationMatchKind`.
217
+ translator aids, with `TranslationMatchKind`; `GlossaryTerm` (a source word or phrase with its
218
+ preferred translation per locale, or kept as it is) is the third, and a consistency group names the
219
+ glossary term its source text is.
218
220
 
219
221
  `Locale` is a row rather than an enum on purpose — see the type's own note. Nothing in the
220
222
  platform branches on _which_ language a string is in, so encoding the set in a type would make
@@ -322,6 +324,11 @@ Conduit's outbox.
322
324
  `UniboxAgents` under `@iveri/contracts/unibox`, so the inbox picks agents by name.
323
325
  - Version `0.139.0` adds a trainer's notes on a member: `GymTrainerNote`, `GymTrainerNotes`, `SaveGymTrainerNoteRequest`,
324
326
  `GymMyTrainerNote` and the `GymRefusal` member `not-their-trainer` under `@iveri/contracts/gym`.
327
+ - Version `0.152.0` adds the glossary shapes under `@iveri/contracts/localization` (`GlossaryTerm`,
328
+ `GlossaryTermTranslation`, `GlossaryTermList`, `CreateGlossaryTermBody`, `UpdateGlossaryTermBody`,
329
+ `TranslationConsistencyGlossary`; `TranslationConsistencyGroup.glossary` and
330
+ `TranslationConsistencyVariant.isPreferred`), and the poll-closed activity kind with how a poll ended under
331
+ `@iveri/contracts/social`.
325
332
  - Version `0.151.0` adds `link` on `InAppNotification`, a path inside the app an inbox row opens.
326
333
  - Version `0.150.0` adds polls on Ezo posts under `@iveri/contracts/social`: `SocialPoll`, `CreateSocialPollRequest`, `VoteSocialPollRequest`,
327
334
  `poll` on `SocialPost` and on creating one, `SocialCaseEvidencePoll` on a case's evidence, and the poll refusals.
@@ -0,0 +1,60 @@
1
+ import type { IsoDateTime } from '../../type/iso-date-time.type.js';
2
+ import type { Nullable } from '../../type/nil.type.js';
3
+ import type { UUID } from '../../type/uuid.type.js';
4
+ /** How a glossary term is preferably written in one locale. */
5
+ export interface GlossaryTermTranslation {
6
+ /** A tenant locale code, lowercased. Never the source locale: the term itself is the source text. */
7
+ localeCode: string;
8
+ /** Plain text, not ICU: a term is a word or a short phrase, never a message with placeholders. */
9
+ value: string;
10
+ }
11
+ /**
12
+ * One word or short phrase of the source language and how the workspace prefers to translate it.
13
+ *
14
+ * A translator's tool. It informs and never acts: nothing rewrites a translation to match a term,
15
+ * and nothing refuses a save or a release because a translation does not use it. A Russian
16
+ * `Войти` beside a glossary entry reading `Вход` is a question for the translator, not an error.
17
+ */
18
+ export interface GlossaryTerm {
19
+ id: UUID;
20
+ /** As the translator wrote it, in the source locale. Unique in the tenant ignoring case and spacing. */
21
+ term: string;
22
+ /** When to use it, what to avoid. Free text for the next translator. */
23
+ note: Nullable<string>;
24
+ /**
25
+ * Kept as it is in every language — a brand or product name such as `Baasi`. Such a term has
26
+ * no translations; its preferred form in every locale is the term itself.
27
+ */
28
+ doNotTranslate: boolean;
29
+ /** One per locale that has a preferred translation, ordered by locale code. */
30
+ translations: GlossaryTermTranslation[];
31
+ createdAt: IsoDateTime;
32
+ updatedAt: IsoDateTime;
33
+ }
34
+ /**
35
+ * `GET /api/v1/glossary/terms`. The whole glossary, ordered by term.
36
+ *
37
+ * Unpaged on purpose: a workspace keeps hundreds of terms, not millions, and the editor matches
38
+ * every message on screen against all of them. The service refuses a term past its limit rather
39
+ * than letting the list grow past what a client can hold.
40
+ */
41
+ export interface GlossaryTermList {
42
+ items: GlossaryTerm[];
43
+ /** How many terms the workspace may hold. */
44
+ limit: number;
45
+ }
46
+ /** `POST /api/v1/glossary/terms`. */
47
+ export interface CreateGlossaryTermBody {
48
+ term: string;
49
+ note?: Nullable<string>;
50
+ doNotTranslate?: boolean;
51
+ /** Refused alongside `doNotTranslate: true`, which has no translations. */
52
+ translations?: GlossaryTermTranslation[];
53
+ }
54
+ /** `PATCH /api/v1/glossary/terms/:id`. `translations`, when sent, replaces the whole set. */
55
+ export interface UpdateGlossaryTermBody {
56
+ term?: string;
57
+ note?: Nullable<string>;
58
+ doNotTranslate?: boolean;
59
+ translations?: GlossaryTermTranslation[];
60
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  export * from './bundle.type.js';
2
+ export * from './glossary.type.js';
2
3
  export * from './locale.type.js';
3
4
  export * from './message.type.js';
4
5
  export * from './namespace.type.js';
@@ -1,4 +1,5 @@
1
1
  export * from './bundle.type.js';
2
+ export * from './glossary.type.js';
2
3
  export * from './locale.type.js';
3
4
  export * from './message.type.js';
4
5
  export * from './namespace.type.js';
@@ -1,4 +1,6 @@
1
+ import type { Nullable } from '../../type/nil.type.js';
1
2
  import type { Paginated } from '../../type/paginated.type.js';
3
+ import type { UUID } from '../../type/uuid.type.js';
2
4
  import type { TranslationMatchKind } from './translation-match-kind.enum.js';
3
5
  import type { TranslationStatus } from './translation-status.enum.js';
4
6
  /** One message that carries a given translation: where to find it, and how far along it is. */
@@ -49,6 +51,24 @@ export interface TranslationConsistencyVariant {
49
51
  useCount: number;
50
52
  /** At most twenty of the messages, approved ones first. */
51
53
  uses: TranslationUse[];
54
+ /**
55
+ * Whether this spelling is the glossary's preferred translation (whitespace collapsed, case
56
+ * kept). Always false when the group has no glossary term or the term has no translation here.
57
+ */
58
+ isPreferred: boolean;
59
+ }
60
+ /** The glossary term a consistency group's source text is, so the review can start from it. */
61
+ export interface TranslationConsistencyGlossary {
62
+ termId: UUID;
63
+ /** The term as the glossary writes it. */
64
+ term: string;
65
+ doNotTranslate: boolean;
66
+ /**
67
+ * The preferred translation in the report's locale: the term itself when it is not translated,
68
+ * null when the glossary has none for this locale yet.
69
+ */
70
+ preferred: Nullable<string>;
71
+ note: Nullable<string>;
52
72
  }
53
73
  /**
54
74
  * One source text that the workspace translates into one locale in more than one way.
@@ -64,9 +84,16 @@ export interface TranslationConsistencyGroup {
64
84
  messageCount: number;
65
85
  /** Most used first. Always two or more. */
66
86
  variants: TranslationConsistencyVariant[];
87
+ /**
88
+ * The glossary term whose text this source text is, compared ignoring case and spacing, or null.
89
+ * Only a whole source text counts here; a term inside a longer sentence is the editor's to show.
90
+ */
91
+ glossary: Nullable<TranslationConsistencyGlossary>;
67
92
  }
68
93
  /**
69
- * `GET /api/v1/translation-consistency?localeCode=&namespaceKey=`.
94
+ * `GET /api/v1/translation-consistency?localeCode=&namespaceKey=&glossaryOnly=`.
95
+ *
96
+ * `glossaryOnly=true` keeps the groups whose source text is a glossary term.
70
97
  *
71
98
  * Groups ordered by how many messages they touch. With `namespaceKey`, only groups with at least
72
99
  * one message in that namespace — but each group still lists every variant in the workspace,
@@ -13,6 +13,7 @@ export * from './social-member-status.enum.js';
13
13
  export * from './social-member.type.js';
14
14
  export * from './social-moderation-reason.enum.js';
15
15
  export * from './social-moderation.type.js';
16
+ export * from './social-poll-outcome.enum.js';
16
17
  export * from './social-poll.type.js';
17
18
  export * from './social-post.type.js';
18
19
  export * from './social-refusal.enum.js';
@@ -13,6 +13,7 @@ export * from './social-member-status.enum.js';
13
13
  export * from './social-member.type.js';
14
14
  export * from './social-moderation-reason.enum.js';
15
15
  export * from './social-moderation.type.js';
16
+ export * from './social-poll-outcome.enum.js';
16
17
  export * from './social-poll.type.js';
17
18
  export * from './social-post.type.js';
18
19
  export * from './social-refusal.enum.js';
@@ -9,5 +9,7 @@ export declare enum SocialActivityKind {
9
9
  FOLLOW_REQUESTED = "follow-requested",
10
10
  FOLLOW_ACCEPTED = "follow-accepted",
11
11
  /** Staff decided something about this member or what they posted. */
12
- MODERATION_NOTICE = "moderation-notice"
12
+ MODERATION_NOTICE = "moderation-notice",
13
+ /** The member's own poll has closed. Only its author is told, once. */
14
+ POLL_CLOSED = "poll-closed"
13
15
  }
@@ -11,4 +11,6 @@ export var SocialActivityKind;
11
11
  SocialActivityKind["FOLLOW_ACCEPTED"] = "follow-accepted";
12
12
  /** Staff decided something about this member or what they posted. */
13
13
  SocialActivityKind["MODERATION_NOTICE"] = "moderation-notice";
14
+ /** The member's own poll has closed. Only its author is told, once. */
15
+ SocialActivityKind["POLL_CLOSED"] = "poll-closed";
14
16
  })(SocialActivityKind || (SocialActivityKind = {}));
@@ -3,6 +3,16 @@ import type { Nullable } from '../../type/nil.type.js';
3
3
  import type { UUID } from '../../type/uuid.type.js';
4
4
  import type { SocialActivityKind } from './social-activity-kind.enum.js';
5
5
  import type { SocialMemberCard } from './social-member.type.js';
6
+ import type { SocialPollOutcome } from './social-poll-outcome.enum.js';
7
+ /**
8
+ * How the author's poll ended, read when the line is, so it agrees with the post. Names no voter and
9
+ * carries no count beyond what the author already sees on their own poll.
10
+ */
11
+ export interface SocialActivityPollResult {
12
+ outcome: SocialPollOutcome;
13
+ /** The answer with the most votes; null on a tie or when nobody voted. */
14
+ leadingAnswer: Nullable<string>;
15
+ }
6
16
  /** One line of activity, which can stand for many people doing the same thing. */
7
17
  export interface SocialActivityItem {
8
18
  id: UUID;
@@ -16,6 +26,8 @@ export interface SocialActivityItem {
16
26
  excerpt: Nullable<string>;
17
27
  /** For a moderation notice, the decision it announces. */
18
28
  noticeId: Nullable<UUID>;
29
+ /** For a closed poll, how it ended; null on every other kind. */
30
+ pollResult: Nullable<SocialActivityPollResult>;
19
31
  latestAt: IsoDateTime;
20
32
  isRead: boolean;
21
33
  }
@@ -0,0 +1,9 @@
1
+ /** How a closed poll ended, for the line telling its author. */
2
+ export declare enum SocialPollOutcome {
3
+ /** One answer has more votes than any other. */
4
+ LEADER = "leader",
5
+ /** Two or more answers share the most votes. */
6
+ TIE = "tie",
7
+ /** Nobody voted. */
8
+ NO_VOTES = "no-votes"
9
+ }
@@ -0,0 +1,10 @@
1
+ /** How a closed poll ended, for the line telling its author. */
2
+ export var SocialPollOutcome;
3
+ (function (SocialPollOutcome) {
4
+ /** One answer has more votes than any other. */
5
+ SocialPollOutcome["LEADER"] = "leader";
6
+ /** Two or more answers share the most votes. */
7
+ SocialPollOutcome["TIE"] = "tie";
8
+ /** Nobody voted. */
9
+ SocialPollOutcome["NO_VOTES"] = "no-votes";
10
+ })(SocialPollOutcome || (SocialPollOutcome = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iveri/contracts",
3
- "version": "0.151.0",
3
+ "version": "0.152.0",
4
4
  "description": "Wire contracts shared by every Iveri backend and frontend. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {