@useherald/core 0.1.0 → 0.2.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/dist/index.d.ts +75 -3
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -81,8 +81,15 @@ interface Targets<C extends string = string> {
|
|
|
81
81
|
priority?: Priority;
|
|
82
82
|
/** Herald generates one when omitted. */
|
|
83
83
|
idempotencyKey?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Opaque tag for what this notification is about, e.g. `"lead:42"`. Not part of
|
|
86
|
+
* the idempotency key. Lets you `cancel({ subject })` and filter `listDeliveries`.
|
|
87
|
+
*/
|
|
88
|
+
subject?: string;
|
|
84
89
|
}
|
|
85
|
-
type DeliveryStatus = "pending" | "sending" | "sent" | "retry" | "dead" | "skipped";
|
|
90
|
+
type DeliveryStatus = "pending" | "sending" | "sent" | "retry" | "dead" | "skipped" | "cancelled";
|
|
91
|
+
/** Statuses a delivery never leaves on its own. Only these can be purged. */
|
|
92
|
+
type TerminalStatus = "sent" | "dead" | "skipped" | "cancelled";
|
|
86
93
|
/** What hooks receive after each attempt outcome. */
|
|
87
94
|
interface DeliveryInfo {
|
|
88
95
|
notificationId: string;
|
|
@@ -145,6 +152,8 @@ interface NewNotification {
|
|
|
145
152
|
payload: unknown;
|
|
146
153
|
priority: Priority;
|
|
147
154
|
idempotencyKey: string;
|
|
155
|
+
/** Plain nullable indexed column, e.g. `"lead:42"`. Never part of the idempotency key. */
|
|
156
|
+
subject: string | null;
|
|
148
157
|
/** Final channels per recipient, after preferences. Retries never change them. */
|
|
149
158
|
deliveries: readonly NewDelivery[];
|
|
150
159
|
}
|
|
@@ -154,6 +163,7 @@ interface NotificationRecord {
|
|
|
154
163
|
payload: unknown;
|
|
155
164
|
priority: Priority;
|
|
156
165
|
idempotencyKey: string;
|
|
166
|
+
subject: string | null;
|
|
157
167
|
createdAt: Date;
|
|
158
168
|
}
|
|
159
169
|
interface DeliveryRecord {
|
|
@@ -167,6 +177,7 @@ interface DeliveryRecord {
|
|
|
167
177
|
nextAttemptAt: Date | null;
|
|
168
178
|
leaseUntil: Date | null;
|
|
169
179
|
lastError: string | null;
|
|
180
|
+
createdAt: Date;
|
|
170
181
|
}
|
|
171
182
|
/** A delivery leased to this worker, with the notification data needed to render it. */
|
|
172
183
|
interface ClaimedDelivery extends DeliveryRecord {
|
|
@@ -183,6 +194,29 @@ type DeliveryResult = {
|
|
|
183
194
|
status: "dead";
|
|
184
195
|
error: string;
|
|
185
196
|
};
|
|
197
|
+
interface DeliveryQuery {
|
|
198
|
+
recipientId?: string;
|
|
199
|
+
event?: string;
|
|
200
|
+
channel?: string;
|
|
201
|
+
status?: DeliveryStatus;
|
|
202
|
+
subject?: string;
|
|
203
|
+
/** Inclusive lower bound on delivery `createdAt`. */
|
|
204
|
+
since?: Date;
|
|
205
|
+
/** Exclusive upper bound on delivery `createdAt`. */
|
|
206
|
+
until?: Date;
|
|
207
|
+
limit?: number;
|
|
208
|
+
/** Opaque. Pass the previous page's `nextCursor`. Keyset on (createdAt, id), newest first. */
|
|
209
|
+
cursor?: string;
|
|
210
|
+
}
|
|
211
|
+
/** A delivery with the notification fields an admin page needs. */
|
|
212
|
+
interface ListedDelivery extends DeliveryRecord {
|
|
213
|
+
event: string;
|
|
214
|
+
subject: string | null;
|
|
215
|
+
}
|
|
216
|
+
interface DeliveryPage {
|
|
217
|
+
items: ListedDelivery[];
|
|
218
|
+
nextCursor: string | null;
|
|
219
|
+
}
|
|
186
220
|
interface InboxItem {
|
|
187
221
|
id: string;
|
|
188
222
|
recipientId: string;
|
|
@@ -228,8 +262,42 @@ interface Store {
|
|
|
228
262
|
now: Date;
|
|
229
263
|
leaseMs: number;
|
|
230
264
|
}): Promise<ClaimedDelivery[]>;
|
|
231
|
-
/**
|
|
265
|
+
/**
|
|
266
|
+
* Record an attempt outcome: status, attempts, error; clears the lease.
|
|
267
|
+
* Must only apply to a row that is still `sending` (`WHERE status = 'sending'`);
|
|
268
|
+
* otherwise it is a silent no-op. This is what stops a late worker result from
|
|
269
|
+
* un-cancelling a row.
|
|
270
|
+
*/
|
|
232
271
|
recordResult(deliveryId: string, result: DeliveryResult): Promise<void>;
|
|
272
|
+
/**
|
|
273
|
+
* Admin and support visibility. Newest first, keyset-paginated on
|
|
274
|
+
* (createdAt, id), never by offset. Filters combine with AND.
|
|
275
|
+
*/
|
|
276
|
+
listDeliveries(q: DeliveryQuery): Promise<DeliveryPage>;
|
|
277
|
+
/**
|
|
278
|
+
* Re-queue a `dead` delivery: status `pending`, attempts reset to 0 (fresh
|
|
279
|
+
* retry budget), due now. Returns false if the delivery was not `dead`.
|
|
280
|
+
*/
|
|
281
|
+
retryDelivery(deliveryId: string): Promise<boolean>;
|
|
282
|
+
/**
|
|
283
|
+
* Cancel every `pending` or `retry` delivery of notifications with this
|
|
284
|
+
* subject. `sending` rows are already out the door and are left alone, as are
|
|
285
|
+
* terminal rows. Sets status `cancelled` (distinct from `skipped`).
|
|
286
|
+
* Returns the number of deliveries cancelled.
|
|
287
|
+
*/
|
|
288
|
+
cancel(q: {
|
|
289
|
+
subject: string;
|
|
290
|
+
}): Promise<number>;
|
|
291
|
+
/**
|
|
292
|
+
* Retention. Deletes deliveries created before `olderThan` whose status is
|
|
293
|
+
* terminal (default: all terminal statuses), then notifications left with no
|
|
294
|
+
* deliveries. Never deletes `pending`, `retry` or `sending` rows. Does not
|
|
295
|
+
* touch the inbox. Returns the number of deliveries deleted.
|
|
296
|
+
*/
|
|
297
|
+
purge(opts: {
|
|
298
|
+
olderThan: Date;
|
|
299
|
+
statuses?: readonly TerminalStatus[];
|
|
300
|
+
}): Promise<number>;
|
|
233
301
|
getNotification(id: string): Promise<{
|
|
234
302
|
notification: NotificationRecord;
|
|
235
303
|
deliveries: DeliveryRecord[];
|
|
@@ -237,6 +305,10 @@ interface Store {
|
|
|
237
305
|
inboxAdd(item: Omit<InboxItem, "id" | "createdAt" | "readAt">): Promise<InboxItem>;
|
|
238
306
|
inboxList(q: InboxQuery): Promise<InboxPage>;
|
|
239
307
|
inboxMarkRead(recipientId: string, ids: readonly string[]): Promise<void>;
|
|
308
|
+
/** Unread items for the bell badge. */
|
|
309
|
+
inboxUnreadCount(recipientId: string): Promise<number>;
|
|
310
|
+
/** Marks every unread item read. Returns the number of rows updated. */
|
|
311
|
+
inboxMarkAllRead(recipientId: string): Promise<number>;
|
|
240
312
|
/** Create or upgrade Herald's tables. Optional: apps may manage schema themselves. */
|
|
241
313
|
migrate?(): Promise<void>;
|
|
242
314
|
close?(): Promise<void>;
|
|
@@ -282,4 +354,4 @@ declare class HeraldError extends Error {
|
|
|
282
354
|
constructor(code: HeraldErrorCode, message: string);
|
|
283
355
|
}
|
|
284
356
|
|
|
285
|
-
export { type AllowedChannel, type Channel, type ChannelMap, type ClaimedDelivery, type DeliveryInfo, type DeliveryRecord, type DeliveryResult, type DeliveryStatus, type ErrorClass, type EventDef, type Herald, type HeraldConfig, HeraldError, type HeraldErrorCode, type Hooks, type InboxItem, type InboxPage, type InboxQuery, type Logger, type MessageOf, type NewDelivery, type NewNotification, type NotificationRecord, type PayloadOf, type Priority, type ProcessOptions, type ProcessSummary, type RawTarget, type RecipientRef, type ResolveAddress, type ResolvePreferences, type RetryPolicy, type SendContext, type SendResult, type Store, type Targets, createHerald, defaultRetry, defineEvent };
|
|
357
|
+
export { type AllowedChannel, type Channel, type ChannelMap, type ClaimedDelivery, type DeliveryInfo, type DeliveryPage, type DeliveryQuery, type DeliveryRecord, type DeliveryResult, type DeliveryStatus, type ErrorClass, type EventDef, type Herald, type HeraldConfig, HeraldError, type HeraldErrorCode, type Hooks, type InboxItem, type InboxPage, type InboxQuery, type ListedDelivery, type Logger, type MessageOf, type NewDelivery, type NewNotification, type NotificationRecord, type PayloadOf, type Priority, type ProcessOptions, type ProcessSummary, type RawTarget, type RecipientRef, type ResolveAddress, type ResolvePreferences, type RetryPolicy, type SendContext, type SendResult, type Store, type Targets, type TerminalStatus, createHerald, defaultRetry, defineEvent };
|
package/dist/index.js
CHANGED
|
@@ -16,12 +16,27 @@ var defaultRetry = {
|
|
|
16
16
|
jitter: true
|
|
17
17
|
};
|
|
18
18
|
var fn = (v) => typeof v === "function";
|
|
19
|
+
var STORE_METHODS = [
|
|
20
|
+
"enqueue",
|
|
21
|
+
"claim",
|
|
22
|
+
"recordResult",
|
|
23
|
+
"listDeliveries",
|
|
24
|
+
"retryDelivery",
|
|
25
|
+
"cancel",
|
|
26
|
+
"purge",
|
|
27
|
+
"getNotification",
|
|
28
|
+
"inboxAdd",
|
|
29
|
+
"inboxList",
|
|
30
|
+
"inboxMarkRead",
|
|
31
|
+
"inboxUnreadCount",
|
|
32
|
+
"inboxMarkAllRead"
|
|
33
|
+
];
|
|
19
34
|
function validate(config) {
|
|
20
35
|
const bad = (msg) => {
|
|
21
36
|
throw new HeraldError("invalid_config", msg);
|
|
22
37
|
};
|
|
23
38
|
const { store, channels, events } = config;
|
|
24
|
-
for (const m of
|
|
39
|
+
for (const m of STORE_METHODS) {
|
|
25
40
|
if (!fn(store?.[m]))
|
|
26
41
|
bad(`store.${m} is not a function`);
|
|
27
42
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts","../src/herald.ts","../src/events.ts"],"sourcesContent":["export type HeraldErrorCode =\n | \"invalid_config\"\n | \"unknown_event\"\n | \"channel_not_allowed\"\n | \"missing_template\"\n | \"not_implemented\";\n\n/** Every error Herald throws on its own behalf. Channel failures never surface through here. */\nexport class HeraldError extends Error {\n readonly code: HeraldErrorCode;\n\n constructor(code: HeraldErrorCode, message: string) {\n super(message);\n this.name = \"HeraldError\";\n this.code = code;\n }\n}\n","import type { Channel } from \"./channel.js\";\nimport { HeraldError } from \"./errors.js\";\nimport type { AllowedChannel, AnyEventDef, ChannelMap, Conform, PayloadOf } from \"./events.js\";\nimport type { InboxPage, InboxQuery, Store } from \"./store.js\";\nimport type {\n Hooks,\n Logger,\n ProcessOptions,\n ProcessSummary,\n ResolveAddress,\n ResolvePreferences,\n RetryPolicy,\n Targets,\n} from \"./types.js\";\n\nexport interface HeraldConfig<Ch extends ChannelMap, Ev extends Record<string, AnyEventDef>> {\n store: Store;\n channels: Ch;\n /** Each event must conform to the channel map: registered channels, matching message types. */\n events: Ev & { [E in keyof Ev]: Conform<Ev[E], Ch> };\n resolvePreferences?: ResolvePreferences;\n resolveAddress?: ResolveAddress;\n hooks?: Hooks;\n logger?: Logger;\n retry?: Partial<RetryPolicy>;\n /** Clock override for tests. */\n now?: () => Date;\n}\n\nexport interface Herald<Ev extends Record<string, AnyEventDef>> {\n /** Queue a notification. Resolves with its id; channel failures never reach the caller. */\n notify<E extends keyof Ev & string>(\n event: E,\n payload: PayloadOf<Ev[E]>,\n targets: Targets<AllowedChannel<Ev[E]>>,\n ): Promise<string>;\n /** Claim and deliver due work. The host schedules this (interval, cron, queue trigger). */\n processPending(opts?: ProcessOptions): Promise<ProcessSummary>;\n inbox: {\n list(q: InboxQuery): Promise<InboxPage>;\n markRead(recipientId: string, ids: readonly string[]): Promise<void>;\n };\n}\n\nexport const defaultRetry: RetryPolicy = {\n maxAttempts: 5,\n baseMs: 30_000,\n maxMs: 3_600_000,\n jitter: true,\n};\n\nconst fn = (v: unknown): boolean => typeof v === \"function\";\n\nfunction validate(config: HeraldConfig<ChannelMap, Record<string, AnyEventDef>>): void {\n const bad = (msg: string): never => {\n throw new HeraldError(\"invalid_config\", msg);\n };\n\n const { store, channels, events } = config;\n for (const m of
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/herald.ts","../src/events.ts"],"sourcesContent":["export type HeraldErrorCode =\n | \"invalid_config\"\n | \"unknown_event\"\n | \"channel_not_allowed\"\n | \"missing_template\"\n | \"not_implemented\";\n\n/** Every error Herald throws on its own behalf. Channel failures never surface through here. */\nexport class HeraldError extends Error {\n readonly code: HeraldErrorCode;\n\n constructor(code: HeraldErrorCode, message: string) {\n super(message);\n this.name = \"HeraldError\";\n this.code = code;\n }\n}\n","import type { Channel } from \"./channel.js\";\r\nimport { HeraldError } from \"./errors.js\";\r\nimport type { AllowedChannel, AnyEventDef, ChannelMap, Conform, PayloadOf } from \"./events.js\";\r\nimport type { InboxPage, InboxQuery, Store } from \"./store.js\";\r\nimport type {\r\n Hooks,\r\n Logger,\r\n ProcessOptions,\r\n ProcessSummary,\r\n ResolveAddress,\r\n ResolvePreferences,\r\n RetryPolicy,\r\n Targets,\r\n} from \"./types.js\";\r\n\r\nexport interface HeraldConfig<Ch extends ChannelMap, Ev extends Record<string, AnyEventDef>> {\r\n store: Store;\r\n channels: Ch;\r\n /** Each event must conform to the channel map: registered channels, matching message types. */\r\n events: Ev & { [E in keyof Ev]: Conform<Ev[E], Ch> };\r\n resolvePreferences?: ResolvePreferences;\r\n resolveAddress?: ResolveAddress;\r\n hooks?: Hooks;\r\n logger?: Logger;\r\n retry?: Partial<RetryPolicy>;\r\n /** Clock override for tests. */\r\n now?: () => Date;\r\n}\r\n\r\nexport interface Herald<Ev extends Record<string, AnyEventDef>> {\r\n /** Queue a notification. Resolves with its id; channel failures never reach the caller. */\r\n notify<E extends keyof Ev & string>(\r\n event: E,\r\n payload: PayloadOf<Ev[E]>,\r\n targets: Targets<AllowedChannel<Ev[E]>>,\r\n ): Promise<string>;\r\n /** Claim and deliver due work. The host schedules this (interval, cron, queue trigger). */\r\n processPending(opts?: ProcessOptions): Promise<ProcessSummary>;\r\n inbox: {\r\n list(q: InboxQuery): Promise<InboxPage>;\r\n markRead(recipientId: string, ids: readonly string[]): Promise<void>;\r\n };\r\n}\r\n\r\nexport const defaultRetry: RetryPolicy = {\r\n maxAttempts: 5,\r\n baseMs: 30_000,\r\n maxMs: 3_600_000,\r\n jitter: true,\r\n};\r\n\r\nconst fn = (v: unknown): boolean => typeof v === \"function\";\r\n\r\nconst STORE_METHODS = [\r\n \"enqueue\",\r\n \"claim\",\r\n \"recordResult\",\r\n \"listDeliveries\",\r\n \"retryDelivery\",\r\n \"cancel\",\r\n \"purge\",\r\n \"getNotification\",\r\n \"inboxAdd\",\r\n \"inboxList\",\r\n \"inboxMarkRead\",\r\n \"inboxUnreadCount\",\r\n \"inboxMarkAllRead\",\r\n] as const;\r\n\r\nfunction validate(config: HeraldConfig<ChannelMap, Record<string, AnyEventDef>>): void {\r\n const bad = (msg: string): never => {\r\n throw new HeraldError(\"invalid_config\", msg);\r\n };\r\n\r\n const { store, channels, events } = config;\r\n for (const m of STORE_METHODS) {\r\n if (!fn((store as unknown as Record<string, unknown> | undefined)?.[m]))\r\n bad(`store.${m} is not a function`);\r\n }\r\n\r\n for (const [name, ch] of Object.entries(channels ?? {})) {\r\n const c = ch as Channel | undefined;\r\n if (!c || !fn(c.send) || !fn(c.classifyError))\r\n bad(`channel \"${name}\" must implement send() and classifyError()`);\r\n }\r\n\r\n const names = Object.keys(events ?? {});\r\n if (names.length === 0) bad(\"at least one event is required\");\r\n\r\n for (const [event, def] of Object.entries(events)) {\r\n if (!def.channels?.length) bad(`event \"${event}\" must allow at least one channel`);\r\n for (const ch of def.channels) {\r\n if (!(ch in channels)) bad(`event \"${event}\" allows unregistered channel \"${ch}\"`);\r\n if (!fn((def.templates as Record<string, unknown> | undefined)?.[ch]))\r\n throw new HeraldError(\"missing_template\", `event \"${event}\" has no template for channel \"${ch}\"`);\r\n }\r\n for (const ch of Object.keys(def.templates ?? {})) {\r\n if (!def.channels.includes(ch))\r\n bad(`event \"${event}\" has a template for \"${ch}\" which is not in its allowed channels`);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Validates config at startup (missing templates, unregistered channels are\r\n * errors here, not at send time). Behavior lands in later releases: `notify`,\r\n * `processPending` and `inbox` are typed but throw `not_implemented` for now.\r\n */\r\nexport function createHerald<\r\n const Ch extends ChannelMap,\r\n Ev extends Record<string, AnyEventDef>,\r\n>(config: HeraldConfig<Ch, Ev>): Herald<Ev> {\r\n validate(config as unknown as HeraldConfig<ChannelMap, Record<string, AnyEventDef>>);\r\n\r\n const notImplemented = (what: string): never => {\r\n throw new HeraldError(\"not_implemented\", `${what} is not implemented yet`);\r\n };\r\n\r\n return {\r\n async notify(event, _payload, targets) {\r\n const def = config.events[event] as AnyEventDef | undefined;\r\n if (!def) throw new HeraldError(\"unknown_event\", `unknown event \"${event}\"`);\r\n for (const ch of targets.channels ?? []) {\r\n if (!def.channels.includes(ch))\r\n throw new HeraldError(\r\n \"channel_not_allowed\",\r\n `event \"${event}\" does not allow channel \"${ch}\"`,\r\n );\r\n }\r\n return notImplemented(\"notify()\");\r\n },\r\n async processPending() {\r\n return notImplemented(\"processPending()\");\r\n },\r\n inbox: {\r\n async list() {\r\n return notImplemented(\"inbox.list()\");\r\n },\r\n async markRead() {\r\n return notImplemented(\"inbox.markRead()\");\r\n },\r\n },\r\n };\r\n}\r\n","import type { Channel } from \"./channel.js\";\r\n\r\n/* eslint-disable @typescript-eslint/no-explicit-any -- `any` is how Channel<M, A> is matched regardless of its params */\r\nexport type ChannelMap = Record<string, Channel<any, any>>;\r\n\r\n/** The message type a channel expects from its templates. */\r\nexport type MessageOf<C> = C extends Channel<infer M, any> ? M : never;\r\n\r\n/**\r\n * An event: its allowed channels and one template per channel. `P` is the\r\n * payload type (type-only, via `__payload`); templates are plain functions.\r\n */\r\nexport interface EventDef<\r\n P = unknown,\r\n K extends string = string,\r\n T extends { readonly [C in K]: (payload: P) => unknown } = {\r\n readonly [C in K]: (payload: P) => unknown;\r\n },\r\n> {\r\n readonly channels: readonly K[];\r\n readonly templates: T;\r\n readonly __payload?: P;\r\n}\r\n\r\nexport type AnyEventDef = EventDef<any, string, any>;\r\nexport type PayloadOf<D> = D extends EventDef<infer P, any, any> ? P : never;\r\nexport type AllowedChannel<D> = D extends EventDef<any, infer K, any> ? K : never;\r\n\r\n/**\r\n * Curried so the payload type is explicit while channel names are inferred:\r\n * `defineEvent<{ name: string }>()({ channels: [\"slack\"], templates: { slack: (p) => ... } })`.\r\n */\r\nexport function defineEvent<P>() {\r\n return <const K extends string, T extends { [C in K]: (payload: P) => unknown }>(def: {\r\n channels: readonly K[];\r\n templates: T;\r\n }): EventDef<P, K, T> => def;\r\n}\r\n\r\n/**\r\n * What an event must look like against a concrete channel map: every allowed\r\n * channel is registered, and each template returns that channel's message type.\r\n */\r\nexport type Conform<D, Ch extends ChannelMap> =\r\n D extends EventDef<infer P, infer K, any>\r\n ? {\r\n readonly channels: readonly (K & keyof Ch)[];\r\n readonly templates: {\r\n readonly [C in K]: C extends keyof Ch ? (payload: P) => MessageOf<Ch[C]> : never;\r\n };\r\n }\r\n : never;\r\n"],"mappings":";AAQO,IAAM,cAAN,cAA0B,MAAM;AAAA,EAC5B;AAAA,EAET,YAAY,MAAuB,SAAiB;AAClD,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACd;AACF;;;AC4BO,IAAM,eAA4B;AAAA,EACvC,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AACV;AAEA,IAAM,KAAK,CAAC,MAAwB,OAAO,MAAM;AAEjD,IAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAAS,SAAS,QAAqE;AACrF,QAAM,MAAM,CAAC,QAAuB;AAClC,UAAM,IAAI,YAAY,kBAAkB,GAAG;AAAA,EAC7C;AAEA,QAAM,EAAE,OAAO,UAAU,OAAO,IAAI;AACpC,aAAW,KAAK,eAAe;AAC7B,QAAI,CAAC,GAAI,QAA2D,CAAC,CAAC;AACpE,UAAI,SAAS,CAAC,oBAAoB;AAAA,EACtC;AAEA,aAAW,CAAC,MAAM,EAAE,KAAK,OAAO,QAAQ,YAAY,CAAC,CAAC,GAAG;AACvD,UAAM,IAAI;AACV,QAAI,CAAC,KA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