@inflatable-cookie/longhorn 0.1.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.
Files changed (178) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +38 -0
  3. package/package.json +205 -0
  4. package/src/agent-control/index.ts +20 -0
  5. package/src/agent-control/inject.ts +4 -0
  6. package/src/agent-control/shim.ts +722 -0
  7. package/src/bridge/direct.ts +22 -0
  8. package/src/bridge/generated/fields.ts +32 -0
  9. package/src/bridge/generated/protocol.ts +218 -0
  10. package/src/bridge/generated/variant-fields.ts +10 -0
  11. package/src/bridge/index.ts +15 -0
  12. package/src/bridge/job.ts +51 -0
  13. package/src/bridge/loopback.ts +84 -0
  14. package/src/bridge/operation.ts +166 -0
  15. package/src/bridge/router.ts +71 -0
  16. package/src/bridge/runtime/connection.ts +318 -0
  17. package/src/bridge/runtime/policy.ts +89 -0
  18. package/src/bridge/runtime/retry.ts +60 -0
  19. package/src/bridge/runtime.ts +3 -0
  20. package/src/bridge/session.ts +67 -0
  21. package/src/bridge/stream/connection.ts +146 -0
  22. package/src/bridge/stream/source.ts +61 -0
  23. package/src/bridge/stream/tracker.ts +109 -0
  24. package/src/bridge/stream.ts +6 -0
  25. package/src/bridge/supervision.ts +204 -0
  26. package/src/bridge/validation/base.ts +164 -0
  27. package/src/bridge/validation/jobs.ts +105 -0
  28. package/src/bridge/validation/negotiation.ts +242 -0
  29. package/src/bridge/validation/operations.ts +213 -0
  30. package/src/bridge/validation/streams.ts +47 -0
  31. package/src/bridge/validation.ts +5 -0
  32. package/src/commands/client.ts +124 -0
  33. package/src/commands/controller.ts +411 -0
  34. package/src/commands/generated/fields.ts +43 -0
  35. package/src/commands/generated/protocol.ts +876 -0
  36. package/src/commands/generated/variant-fields.ts +88 -0
  37. package/src/commands/index.ts +13 -0
  38. package/src/commands/keyboard.ts +361 -0
  39. package/src/commands/ports.ts +82 -0
  40. package/src/commands/projectors.ts +306 -0
  41. package/src/commands/validation.ts +444 -0
  42. package/src/config/client.ts +215 -0
  43. package/src/config/generated/base.ts +714 -0
  44. package/src/config/generated/fields.ts +54 -0
  45. package/src/config/generated/label-template.ts +14 -0
  46. package/src/config/generated/labels.ts +30 -0
  47. package/src/config/generated/protocol.ts +3 -0
  48. package/src/config/generated/restore.ts +658 -0
  49. package/src/config/generated/variant-fields.ts +129 -0
  50. package/src/config/index.ts +12 -0
  51. package/src/config/names.ts +19 -0
  52. package/src/config/validation/commands.ts +155 -0
  53. package/src/config/validation/outcomes.ts +243 -0
  54. package/src/config/validation/primitives.ts +174 -0
  55. package/src/config/validation/projection.ts +351 -0
  56. package/src/config/validation.ts +7 -0
  57. package/src/core/connection.ts +252 -0
  58. package/src/core/index.ts +2 -0
  59. package/src/core/transport.ts +24 -0
  60. package/src/history/client.ts +65 -0
  61. package/src/history/controller.ts +385 -0
  62. package/src/history/direct.ts +21 -0
  63. package/src/history/generated/fields.ts +18 -0
  64. package/src/history/generated/protocol.ts +389 -0
  65. package/src/history/generated/variant-fields.ts +27 -0
  66. package/src/history/index.ts +13 -0
  67. package/src/history/ports.ts +31 -0
  68. package/src/history/serialized.ts +38 -0
  69. package/src/history/validation.ts +334 -0
  70. package/src/history-tree/client.ts +16 -0
  71. package/src/history-tree/controller.ts +199 -0
  72. package/src/history-tree/direct.ts +3 -0
  73. package/src/history-tree/generated/fields.ts +26 -0
  74. package/src/history-tree/generated/protocol.ts +711 -0
  75. package/src/history-tree/generated/variant-fields.ts +39 -0
  76. package/src/history-tree/index.ts +13 -0
  77. package/src/history-tree/ports.ts +43 -0
  78. package/src/history-tree/serialized.ts +15 -0
  79. package/src/history-tree/validation.ts +269 -0
  80. package/src/layout/generated/protocol.ts +289 -0
  81. package/src/layout/index.ts +4 -0
  82. package/src/layout/ratio.ts +22 -0
  83. package/src/layout/validation.ts +110 -0
  84. package/src/layout/visibility.ts +30 -0
  85. package/src/licence/client.ts +32 -0
  86. package/src/licence/controller.ts +301 -0
  87. package/src/licence/direct.ts +3 -0
  88. package/src/licence/generated/fields.ts +17 -0
  89. package/src/licence/generated/key-conformance.json +42 -0
  90. package/src/licence/generated/protocol.ts +249 -0
  91. package/src/licence/generated/variant-fields.ts +34 -0
  92. package/src/licence/index.ts +14 -0
  93. package/src/licence/key.ts +125 -0
  94. package/src/licence/ports.ts +39 -0
  95. package/src/licence/serialized.ts +13 -0
  96. package/src/licence/validation.ts +226 -0
  97. package/src/native-content/client.ts +474 -0
  98. package/src/native-content/direct.ts +16 -0
  99. package/src/native-content/generated/fields.ts +32 -0
  100. package/src/native-content/generated/protocol.ts +498 -0
  101. package/src/native-content/generated/variant-fields.ts +77 -0
  102. package/src/native-content/index.ts +12 -0
  103. package/src/native-content/ports.ts +46 -0
  104. package/src/native-content/serialized.ts +50 -0
  105. package/src/native-content/validation/base.ts +194 -0
  106. package/src/native-content/validation/messages.ts +192 -0
  107. package/src/native-content/validation/state.ts +404 -0
  108. package/src/native-content/validation.ts +7 -0
  109. package/src/notifications/client.ts +106 -0
  110. package/src/notifications/controller.ts +240 -0
  111. package/src/notifications/direct.ts +12 -0
  112. package/src/notifications/generated/fields.ts +19 -0
  113. package/src/notifications/generated/labels.ts +20 -0
  114. package/src/notifications/generated/protocol.ts +522 -0
  115. package/src/notifications/generated/variant-fields.ts +37 -0
  116. package/src/notifications/index.ts +16 -0
  117. package/src/notifications/ports.ts +22 -0
  118. package/src/notifications/serialized.ts +27 -0
  119. package/src/notifications/toast.ts +41 -0
  120. package/src/notifications/tone.ts +27 -0
  121. package/src/notifications/validation.ts +246 -0
  122. package/src/operation/bridge.ts +168 -0
  123. package/src/operation/client.ts +167 -0
  124. package/src/operation/controller.ts +321 -0
  125. package/src/operation/direct.ts +15 -0
  126. package/src/operation/generated/fields.ts +20 -0
  127. package/src/operation/generated/labels.ts +15 -0
  128. package/src/operation/generated/protocol.ts +762 -0
  129. package/src/operation/generated/variant-fields.ts +60 -0
  130. package/src/operation/index.ts +14 -0
  131. package/src/operation/ports.ts +29 -0
  132. package/src/operation/serialized.ts +39 -0
  133. package/src/operation/validation.ts +479 -0
  134. package/src/settings/client.ts +142 -0
  135. package/src/settings/connection.ts +246 -0
  136. package/src/settings/generated/fields.ts +34 -0
  137. package/src/settings/generated/protocol.ts +668 -0
  138. package/src/settings/generated/variant-fields.ts +26 -0
  139. package/src/settings/index.ts +12 -0
  140. package/src/settings/names.ts +8 -0
  141. package/src/settings/registry.ts +141 -0
  142. package/src/settings/validation/authority.ts +66 -0
  143. package/src/settings/validation/command.ts +165 -0
  144. package/src/settings/validation/error.ts +33 -0
  145. package/src/settings/validation/primitives.ts +203 -0
  146. package/src/settings/validation/projection.ts +50 -0
  147. package/src/settings/validation/registry.ts +170 -0
  148. package/src/settings/validation.ts +4 -0
  149. package/src/surface-transfer/client.ts +54 -0
  150. package/src/surface-transfer/generated/fields.ts +12 -0
  151. package/src/surface-transfer/generated/protocol.ts +61 -0
  152. package/src/surface-transfer/generated/variant-fields.ts +30 -0
  153. package/src/surface-transfer/index.ts +9 -0
  154. package/src/surface-transfer/validation.ts +209 -0
  155. package/src/surfaces/client.ts +140 -0
  156. package/src/surfaces/generated/fields.ts +19 -0
  157. package/src/surfaces/generated/protocol.ts +217 -0
  158. package/src/surfaces/generated/variant-fields.ts +42 -0
  159. package/src/surfaces/index.ts +9 -0
  160. package/src/surfaces/validation.ts +199 -0
  161. package/src/transfer/client.ts +133 -0
  162. package/src/transfer/connection.ts +87 -0
  163. package/src/transfer/generated/fields.ts +23 -0
  164. package/src/transfer/generated/protocol.ts +171 -0
  165. package/src/transfer/generated/variant-fields.ts +45 -0
  166. package/src/transfer/index.ts +11 -0
  167. package/src/transfer/payload.ts +71 -0
  168. package/src/transfer/validation.ts +282 -0
  169. package/src/update/client.ts +29 -0
  170. package/src/update/controller.ts +255 -0
  171. package/src/update/direct.ts +3 -0
  172. package/src/update/generated/fields.ts +14 -0
  173. package/src/update/generated/protocol.ts +238 -0
  174. package/src/update/generated/variant-fields.ts +44 -0
  175. package/src/update/index.ts +14 -0
  176. package/src/update/ports.ts +36 -0
  177. package/src/update/serialized.ts +12 -0
  178. package/src/update/validation.ts +191 -0
@@ -0,0 +1,240 @@
1
+ import { isNewerNotificationSnapshot, NotificationClient, type NotificationSubscription } from "./client.ts";
2
+ import {
3
+ NOTIFICATION_PROTOCOL_VERSION,
4
+ type NotificationActionProjection,
5
+ type NotificationId,
6
+ type NotificationMutationResult,
7
+ type NotificationRecordProjection,
8
+ type NotificationRejection,
9
+ type NotificationRequestId,
10
+ type NotificationSnapshot,
11
+ } from "./generated/protocol.ts";
12
+ import { notificationSeverityTone, type NotificationStatusTone } from "./tone.ts";
13
+ import { toastAction, toastTitle } from "./toast.ts";
14
+
15
+ import type { NotificationPort } from "./ports.ts";
16
+
17
+ export type NotificationControllerStatus = { readonly kind: "idle" } | { readonly kind: "loading" } | { readonly kind: "ready" } | { readonly kind: "failed"; readonly error: unknown };
18
+ export type NotificationPendingKind = "markSeen" | "dismiss" | "action";
19
+
20
+ export interface NotificationPendingCommand {
21
+ readonly requestId: NotificationRequestId;
22
+ readonly notificationId: NotificationId;
23
+ readonly kind: NotificationPendingKind;
24
+ }
25
+
26
+ export interface NotificationCommandRejection extends NotificationPendingCommand { readonly rejection: NotificationRejection; }
27
+ export interface NotificationCommandFailure extends NotificationPendingCommand { readonly error: unknown; }
28
+
29
+ export interface NotificationActionInvocation {
30
+ readonly notificationId: NotificationId;
31
+ readonly sourceId: string;
32
+ readonly referenceId: string;
33
+ }
34
+
35
+ export interface NotificationActionExecutor {
36
+ admitAndExecute(invocation: NotificationActionInvocation): Promise<void>;
37
+ }
38
+
39
+ export interface NotificationToastProjection {
40
+ readonly id: string;
41
+ readonly notificationId: NotificationId;
42
+ readonly title: string;
43
+ readonly description: string;
44
+ readonly tone: NotificationStatusTone;
45
+ readonly action?: NotificationActionProjection;
46
+ }
47
+
48
+ export interface NotificationControllerOptions {
49
+ readonly port: NotificationPort;
50
+ readonly pageSize?: number;
51
+ readonly toast?: { readonly select: (record: NotificationRecordProjection) => boolean };
52
+ readonly actions?: NotificationActionExecutor;
53
+ }
54
+
55
+ export class NotificationController {
56
+ readonly client: NotificationClient;
57
+ readonly observers = new Set<() => void>();
58
+ readonly pending = new Map<NotificationRequestId, NotificationPendingCommand>();
59
+ readonly pageSize: number;
60
+ readonly toastSelector: ((record: NotificationRecordProjection) => boolean) | undefined;
61
+ readonly actionExecutor: NotificationActionExecutor | undefined;
62
+ status: NotificationControllerStatus = { kind: "idle" };
63
+ snapshot: NotificationSnapshot | undefined;
64
+ records: NotificationRecordProjection[] = [];
65
+ toasts: NotificationToastProjection[] = [];
66
+ selectedNotificationId: NotificationId | undefined;
67
+ commandRejection: NotificationCommandRejection | undefined;
68
+ commandFailure: NotificationCommandFailure | undefined;
69
+ subscription: NotificationSubscription | undefined;
70
+ started = false;
71
+ lifecycleRevision = 0;
72
+ toastSequence = 0;
73
+
74
+ constructor(options: NotificationControllerOptions) {
75
+ this.client = new NotificationClient(options.port);
76
+ this.pageSize = options.pageSize ?? 100;
77
+ this.toastSelector = options.toast?.select;
78
+ this.actionExecutor = options.actions;
79
+ }
80
+
81
+ get selected(): NotificationRecordProjection | undefined { return this.records.find((record) => record.notificationId === this.selectedNotificationId); }
82
+ get hasMore(): boolean { return this.snapshot?.page.hasMore ?? false; }
83
+ get pendingCommands(): readonly NotificationPendingCommand[] { return [...this.pending.values()]; }
84
+
85
+ observe(observer: () => void): () => void { this.observers.add(observer); return () => this.observers.delete(observer); }
86
+
87
+ async start(): Promise<void> {
88
+ if (this.started) return;
89
+ this.started = true;
90
+ const lifecycle = ++this.lifecycleRevision;
91
+ this.setStatus({ kind: "loading" });
92
+ const subscription = this.client.subscribe(
93
+ (snapshot) => { if (this.isCurrent(lifecycle)) this.install(snapshot); },
94
+ ({ error }) => { if (this.isCurrent(lifecycle)) this.setStatus({ kind: "failed", error }); },
95
+ this.pageSize,
96
+ );
97
+ this.subscription = subscription;
98
+ try {
99
+ await subscription.ready;
100
+ if (this.isCurrent(lifecycle)) this.setStatus({ kind: "ready" });
101
+ } catch (error) {
102
+ if (this.isCurrent(lifecycle)) this.setStatus({ kind: "failed", error });
103
+ }
104
+ }
105
+
106
+ async stop(): Promise<void> {
107
+ this.started = false;
108
+ this.lifecycleRevision += 1;
109
+ const subscription = this.subscription;
110
+ this.subscription = undefined;
111
+ this.snapshot = undefined;
112
+ this.records = [];
113
+ this.toasts = [];
114
+ this.selectedNotificationId = undefined;
115
+ this.pending.clear();
116
+ this.commandFailure = undefined;
117
+ this.commandRejection = undefined;
118
+ this.setStatus({ kind: "idle" });
119
+ if (subscription !== undefined) await subscription.dispose();
120
+ }
121
+
122
+ select(notificationId: NotificationId | undefined): void {
123
+ if (notificationId !== undefined && !this.records.some((record) => record.notificationId === notificationId)) throw new NotificationControllerUnknownRecordError(notificationId);
124
+ this.selectedNotificationId = notificationId;
125
+ this.notify();
126
+ }
127
+
128
+ async loadMore(): Promise<void> {
129
+ const current = this.requireSnapshot();
130
+ if (!current.page.hasMore) return;
131
+ const next = (await this.client.snapshot(this.records.length, this.pageSize)).snapshot;
132
+ if (next.authority.authorityId !== current.authority.authorityId || next.authority.authorityEpoch !== current.authority.authorityEpoch || next.ledgerRevision !== current.ledgerRevision) {
133
+ this.install(next);
134
+ return;
135
+ }
136
+ const known = new Set(this.records.map((record) => record.notificationId));
137
+ this.records = [...this.records, ...next.page.records.filter((record) => !known.has(record.notificationId))];
138
+ this.snapshot = { ...current, page: { ...current.page, hasMore: next.page.hasMore, records: [...this.records] } };
139
+ this.notify();
140
+ }
141
+
142
+ markSeen(notificationId: NotificationId): Promise<NotificationMutationResult> { return this.mutateRecord(notificationId, "markSeen"); }
143
+ dismiss(notificationId: NotificationId): Promise<NotificationMutationResult> { return this.mutateRecord(notificationId, "dismiss"); }
144
+
145
+ dismissToast(id: string): void {
146
+ const next = this.toasts.filter((toast) => toast.id !== id);
147
+ if (next.length === this.toasts.length) return;
148
+ this.toasts = next;
149
+ this.notify();
150
+ }
151
+
152
+ async invokeAction(notificationId: NotificationId, referenceId: string): Promise<void> {
153
+ const record = this.requireRecord(notificationId);
154
+ const action = record.draft.actions.find((candidate) => candidate.referenceId === referenceId);
155
+ if (action === undefined) throw new NotificationControllerUnknownActionError(notificationId, referenceId);
156
+ if (this.actionExecutor === undefined) throw new NotificationControllerActionUnavailableError();
157
+ const pending = { requestId: this.client.nextRequestId(), notificationId, kind: "action" as const };
158
+ await this.runPending(pending, async () => {
159
+ await this.actionExecutor?.admitAndExecute({ notificationId, sourceId: record.draft.sourceId, referenceId: action.referenceId });
160
+ });
161
+ }
162
+
163
+ isPending(notificationId: NotificationId, kind: NotificationPendingKind): boolean {
164
+ return [...this.pending.values()].some((item) => item.notificationId === notificationId && item.kind === kind);
165
+ }
166
+
167
+ private async mutateRecord(notificationId: NotificationId, kind: "markSeen" | "dismiss"): Promise<NotificationMutationResult> {
168
+ const snapshot = this.requireSnapshot();
169
+ this.requireRecord(notificationId);
170
+ const command = {
171
+ kind,
172
+ requestId: this.client.nextRequestId(),
173
+ protocolVersion: NOTIFICATION_PROTOCOL_VERSION,
174
+ authority: snapshot.authority,
175
+ expectedLedgerRevision: snapshot.ledgerRevision,
176
+ notificationId,
177
+ } as const;
178
+ return this.runPending({ requestId: command.requestId, notificationId, kind }, async () => {
179
+ const result = await this.client.mutate(command);
180
+ this.install(result.snapshot);
181
+ if (result.status === "rejected") this.commandRejection = { requestId: command.requestId, notificationId, kind, rejection: result.rejection };
182
+ return result;
183
+ });
184
+ }
185
+
186
+ private async runPending<Result>(pending: NotificationPendingCommand, run: () => Promise<Result>): Promise<Result> {
187
+ if (this.isPending(pending.notificationId, pending.kind)) throw new NotificationControllerCommandPendingError(pending.notificationId, pending.kind);
188
+ const lifecycle = this.lifecycleRevision;
189
+ this.pending.set(pending.requestId, pending);
190
+ this.commandFailure = undefined;
191
+ this.commandRejection = undefined;
192
+ this.notify();
193
+ try { return await run(); }
194
+ catch (error) {
195
+ if (this.isCurrent(lifecycle)) this.commandFailure = { ...pending, error };
196
+ throw error;
197
+ } finally {
198
+ if (this.isCurrent(lifecycle)) { this.pending.delete(pending.requestId); this.notify(); }
199
+ }
200
+ }
201
+
202
+ private install(candidate: NotificationSnapshot): void {
203
+ if (!isNewerNotificationSnapshot(candidate, this.snapshot)) return;
204
+ const previous = this.snapshot;
205
+ this.snapshot = candidate;
206
+ this.records = [...candidate.page.records];
207
+ if (previous !== undefined && this.toastSelector !== undefined) {
208
+ const existing = new Set(this.toasts.map((toast) => toast.notificationId));
209
+ const fresh = candidate.page.records.filter((record) => record.readState === "unseen" && record.lastChangedLedgerRevision > previous.ledgerRevision && this.toastSelector?.(record) === true && !existing.has(record.notificationId));
210
+ this.toasts = [...this.toasts, ...fresh.map((record) => this.projectToast(record))];
211
+ }
212
+ const retained = new Set(this.records.map((record) => record.notificationId));
213
+ this.toasts = this.toasts.filter((toast) => retained.has(toast.notificationId));
214
+ if (this.selectedNotificationId !== undefined && !retained.has(this.selectedNotificationId)) this.selectedNotificationId = undefined;
215
+ this.notify();
216
+ }
217
+
218
+ private projectToast(record: NotificationRecordProjection): NotificationToastProjection {
219
+ return {
220
+ id: `notification-toast:${++this.toastSequence}`,
221
+ notificationId: record.notificationId,
222
+ title: toastTitle(record.draft),
223
+ description: record.draft.summary,
224
+ tone: notificationSeverityTone(record.draft.severity),
225
+ action: toastAction(record.draft),
226
+ };
227
+ }
228
+
229
+ private requireSnapshot(): NotificationSnapshot { if (!this.started || this.snapshot === undefined) throw new NotificationControllerUnavailableError(); return this.snapshot; }
230
+ private requireRecord(id: NotificationId): NotificationRecordProjection { const record = this.records.find((candidate) => candidate.notificationId === id); if (record === undefined) throw new NotificationControllerUnknownRecordError(id); return record; }
231
+ private isCurrent(revision: number): boolean { return this.started && this.lifecycleRevision === revision; }
232
+ private setStatus(status: NotificationControllerStatus): void { this.status = status; this.notify(); }
233
+ private notify(): void { for (const observer of this.observers) observer(); }
234
+ }
235
+
236
+ export class NotificationControllerUnavailableError extends Error { constructor() { super("notification controller is not ready"); this.name = "NotificationControllerUnavailableError"; } }
237
+ export class NotificationControllerUnknownRecordError extends Error { constructor(readonly notificationId: string) { super(`unknown notification: ${notificationId}`); this.name = "NotificationControllerUnknownRecordError"; } }
238
+ export class NotificationControllerUnknownActionError extends Error { constructor(readonly notificationId: string, readonly referenceId: string) { super(`unknown notification action ${referenceId} on ${notificationId}`); this.name = "NotificationControllerUnknownActionError"; } }
239
+ export class NotificationControllerActionUnavailableError extends Error { constructor() { super("notification action executor is not configured"); this.name = "NotificationControllerActionUnavailableError"; } }
240
+ export class NotificationControllerCommandPendingError extends Error { constructor(readonly notificationId: string, readonly kind: NotificationPendingKind) { super(`notification ${kind} already pending for ${notificationId}`); this.name = "NotificationControllerCommandPendingError"; } }
@@ -0,0 +1,12 @@
1
+ import type { NotificationPort } from "./ports.ts";
2
+
3
+ export interface DirectNotificationHandlers {
4
+ readonly snapshot: NotificationPort["snapshot"];
5
+ readonly mutate: NotificationPort["mutate"];
6
+ readonly listen?: NotificationPort["listen"];
7
+ readonly nextRequestId: NotificationPort["nextRequestId"];
8
+ }
9
+
10
+ export function createDirectNotificationPort(handlers: DirectNotificationHandlers): NotificationPort {
11
+ return { ...handlers };
12
+ }
@@ -0,0 +1,19 @@
1
+ // @generated by `effigy generate:notifications`; do not edit.
2
+ // Allowed field names per protocol type, from the Rust structs.
3
+ // A `record()` given one of these rejects unknown and missing keys —
4
+ // contract 010's Boundary Validation Target.
5
+
6
+ export const NOTIFICATIONS_FIELDS: Record<string, readonly string[]> = {
7
+ "NotificationAuthorityProjection": ["authorityId", "authorityEpoch"],
8
+ "NotificationActionProjection": ["referenceId", "label"],
9
+ "NotificationDraftProjection": ["sourceId", "severity", "title", "summary", "causeId", "actions", "replacementKey", "producerToken", "retentionClass", "presentationTimeUnixMs"],
10
+ "NotificationRecordProjection": ["notificationId", "draft", "sequence", "lastChangedLedgerRevision", "readState", "encodedMetadataWeight"],
11
+ "NotificationLedgerLimitsProjection": ["maximumNotifications", "maximumEncodedWeight"],
12
+ "NotificationPageProjection": ["offset", "totalCount", "hasMore", "records"],
13
+ "NotificationSnapshot": ["protocolVersion", "authority", "ledgerRevision", "limits", "retainedCount", "unseenCount", "retainedEncodedWeight", "prunedCount", "page"],
14
+ "NotificationSnapshotQuery": ["protocolVersion", "requestId", "offset", "limit"],
15
+ "NotificationSnapshotResponse": ["requestId", "snapshot"],
16
+ "NotificationRemovalProjection": ["record", "reason"],
17
+ "NotificationRejection": ["code", "detail", "refreshRequired"],
18
+ "NotificationChangedEvent": ["protocolVersion", "requestId", "authority", "previousLedgerRevision", "committedLedgerRevision", "affectedNotificationIds", "kind"],
19
+ };
@@ -0,0 +1,20 @@
1
+ // @generated by `effigy generate:notifications`; do not edit.
2
+ // Wording lives in Rust, on the enum that owns it. A label edited here is
3
+ // a label that disagrees with the native surface.
4
+
5
+ import type { NotificationSeverityProjection } from "./protocol.ts";
6
+
7
+ export const NOTIFICATION_SEVERITY_LABELS: Record<NotificationSeverityProjection, string> = {
8
+ info: "Information",
9
+ success: "Success",
10
+ warning: "Warning",
11
+ error: "Error",
12
+ critical: "Critical",
13
+ };
14
+
15
+ /** Title prefixes for severities the tone cannot distinguish. */
16
+ export const NOTIFICATION_SEVERITY_TITLE_PREFIXES: Partial<
17
+ Record<NotificationSeverityProjection, string>
18
+ > = {
19
+ critical: "Critical: ",
20
+ };