@useherald/core 0.0.1 → 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.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,285 @@
1
- declare const version = "0.0.0";
1
+ interface SendContext {
2
+ /** Stable per delivery across retries. Pass to providers that dedupe. */
3
+ idempotencyKey: string;
4
+ /** 1-based attempt number. */
5
+ attempt: number;
6
+ /** Aborts when the processing time budget runs out. */
7
+ signal?: AbortSignal;
8
+ }
9
+ interface SendResult {
10
+ providerId?: string;
11
+ }
12
+ interface ErrorClass {
13
+ /** `false` = permanent, the delivery goes straight to `dead`. */
14
+ retryable: boolean;
15
+ /** From e.g. a Slack 429 `Retry-After`. Overrides backoff when present. */
16
+ retryAfterMs?: number;
17
+ }
18
+ /**
19
+ * One delivery mechanism. `send` throws on failure; the engine asks
20
+ * `classifyError` whether to retry. Adapters own that classification.
21
+ */
22
+ interface Channel<TMessage = unknown, TAddress = unknown> {
23
+ readonly name: string;
24
+ send(message: TMessage, to: TAddress, ctx: SendContext): Promise<SendResult>;
25
+ classifyError(err: unknown): ErrorClass;
26
+ }
2
27
 
3
- export { version };
28
+ type ChannelMap = Record<string, Channel<any, any>>;
29
+ /** The message type a channel expects from its templates. */
30
+ type MessageOf<C> = C extends Channel<infer M, any> ? M : never;
31
+ /**
32
+ * An event: its allowed channels and one template per channel. `P` is the
33
+ * payload type (type-only, via `__payload`); templates are plain functions.
34
+ */
35
+ interface EventDef<P = unknown, K extends string = string, T extends {
36
+ readonly [C in K]: (payload: P) => unknown;
37
+ } = {
38
+ readonly [C in K]: (payload: P) => unknown;
39
+ }> {
40
+ readonly channels: readonly K[];
41
+ readonly templates: T;
42
+ readonly __payload?: P;
43
+ }
44
+ type AnyEventDef = EventDef<any, string, any>;
45
+ type PayloadOf<D> = D extends EventDef<infer P, any, any> ? P : never;
46
+ type AllowedChannel<D> = D extends EventDef<any, infer K, any> ? K : never;
47
+ /**
48
+ * Curried so the payload type is explicit while channel names are inferred:
49
+ * `defineEvent<{ name: string }>()({ channels: ["slack"], templates: { slack: (p) => ... } })`.
50
+ */
51
+ declare function defineEvent<P>(): <const K extends string, T extends { [C in K]: (payload: P) => unknown; }>(def: {
52
+ channels: readonly K[];
53
+ templates: T;
54
+ }) => EventDef<P, K, T>;
55
+ /**
56
+ * What an event must look like against a concrete channel map: every allowed
57
+ * channel is registered, and each template returns that channel's message type.
58
+ */
59
+ type Conform<D, Ch extends ChannelMap> = D extends EventDef<infer P, infer K, any> ? {
60
+ readonly channels: readonly (K & keyof Ch)[];
61
+ readonly templates: {
62
+ readonly [C in K]: C extends keyof Ch ? (payload: P) => MessageOf<Ch[C]> : never;
63
+ };
64
+ } : never;
65
+
66
+ type Priority = "normal" | "critical";
67
+ /** The app's own recipient. Herald only needs a stable id; apps carry extra fields freely. */
68
+ interface RecipientRef {
69
+ id: string;
70
+ }
71
+ /** A destination given directly, bypassing address resolution (e.g. a Slack channel id). */
72
+ interface RawTarget<C extends string = string> {
73
+ channel: C;
74
+ address: unknown;
75
+ }
76
+ interface Targets<C extends string = string> {
77
+ to: ReadonlyArray<RecipientRef | RawTarget<C>>;
78
+ /** Subset of the event's allowed channels. Omitted = all of them. */
79
+ channels?: readonly C[];
80
+ /** `critical` bypasses recipient preferences. */
81
+ priority?: Priority;
82
+ /** Herald generates one when omitted. */
83
+ idempotencyKey?: string;
84
+ }
85
+ type DeliveryStatus = "pending" | "sending" | "sent" | "retry" | "dead" | "skipped";
86
+ /** What hooks receive after each attempt outcome. */
87
+ interface DeliveryInfo {
88
+ notificationId: string;
89
+ deliveryId: string;
90
+ event: string;
91
+ channel: string;
92
+ recipientId?: string;
93
+ attempt: number;
94
+ error?: unknown;
95
+ }
96
+ interface Hooks {
97
+ onSent?(info: DeliveryInfo): void | Promise<void>;
98
+ onFailed?(info: DeliveryInfo & {
99
+ nextAttemptAt: Date;
100
+ }): void | Promise<void>;
101
+ onDead?(info: DeliveryInfo): void | Promise<void>;
102
+ }
103
+ interface Logger {
104
+ debug(msg: string, meta?: Record<string, unknown>): void;
105
+ info(msg: string, meta?: Record<string, unknown>): void;
106
+ warn(msg: string, meta?: Record<string, unknown>): void;
107
+ error(msg: string, meta?: Record<string, unknown>): void;
108
+ }
109
+ interface RetryPolicy {
110
+ /** Total attempts including the first. Default 5. */
111
+ maxAttempts: number;
112
+ /** First retry delay. Doubles each attempt. Default 30_000. */
113
+ baseMs: number;
114
+ /** Delay ceiling. Default 3_600_000. */
115
+ maxMs: number;
116
+ /** Randomize delays to avoid thundering herds. Default true. */
117
+ jitter: boolean;
118
+ }
119
+ /** Narrows channels per recipient. Called once per `notify()` with all recipients. Never adds channels. */
120
+ type ResolvePreferences = (recipients: readonly RecipientRef[], event: string) => Promise<ReadonlyMap<string, readonly string[]>> | ReadonlyMap<string, readonly string[]>;
121
+ /** Maps a recipient to a channel address. `null` skips that delivery (recorded as `skipped`). */
122
+ type ResolveAddress = (recipient: RecipientRef, channel: string) => Promise<unknown | null> | unknown | null;
123
+ interface ProcessOptions {
124
+ /** Max deliveries to claim this call. Default 50. */
125
+ batchSize?: number;
126
+ /** Stop starting new sends after this many ms (fits function timeouts). Default 20_000. */
127
+ budgetMs?: number;
128
+ }
129
+ interface ProcessSummary {
130
+ claimed: number;
131
+ sent: number;
132
+ retried: number;
133
+ dead: number;
134
+ }
135
+
136
+ interface NewDelivery {
137
+ channel: string;
138
+ /** Resolved address, or the raw target's address. `null` when resolution skipped it. */
139
+ address: unknown;
140
+ recipientId?: string;
141
+ status: "pending" | "skipped";
142
+ }
143
+ interface NewNotification {
144
+ event: string;
145
+ payload: unknown;
146
+ priority: Priority;
147
+ idempotencyKey: string;
148
+ /** Final channels per recipient, after preferences. Retries never change them. */
149
+ deliveries: readonly NewDelivery[];
150
+ }
151
+ interface NotificationRecord {
152
+ id: string;
153
+ event: string;
154
+ payload: unknown;
155
+ priority: Priority;
156
+ idempotencyKey: string;
157
+ createdAt: Date;
158
+ }
159
+ interface DeliveryRecord {
160
+ id: string;
161
+ notificationId: string;
162
+ channel: string;
163
+ address: unknown;
164
+ recipientId?: string;
165
+ status: DeliveryStatus;
166
+ attempts: number;
167
+ nextAttemptAt: Date | null;
168
+ leaseUntil: Date | null;
169
+ lastError: string | null;
170
+ }
171
+ /** A delivery leased to this worker, with the notification data needed to render it. */
172
+ interface ClaimedDelivery extends DeliveryRecord {
173
+ notification: NotificationRecord;
174
+ }
175
+ type DeliveryResult = {
176
+ status: "sent";
177
+ providerId?: string;
178
+ } | {
179
+ status: "retry";
180
+ nextAttemptAt: Date;
181
+ error: string;
182
+ } | {
183
+ status: "dead";
184
+ error: string;
185
+ };
186
+ interface InboxItem {
187
+ id: string;
188
+ recipientId: string;
189
+ notificationId: string;
190
+ title: string;
191
+ body: string;
192
+ data?: unknown;
193
+ createdAt: Date;
194
+ readAt: Date | null;
195
+ }
196
+ interface InboxQuery {
197
+ recipientId: string;
198
+ unreadOnly?: boolean;
199
+ limit?: number;
200
+ cursor?: string;
201
+ }
202
+ interface InboxPage {
203
+ items: InboxItem[];
204
+ nextCursor: string | null;
205
+ }
206
+ /**
207
+ * Persistence contract. Herald never sees a driver type. A store never sees
208
+ * templates, channels or preferences.
209
+ */
210
+ interface Store {
211
+ /**
212
+ * Atomically insert the notification and its delivery rows. Unique on
213
+ * `idempotencyKey`: a repeat returns the existing id with `created: false`.
214
+ */
215
+ enqueue(n: NewNotification): Promise<{
216
+ id: string;
217
+ created: boolean;
218
+ }>;
219
+ /**
220
+ * Lease up to `limit` deliveries that are due (`pending`/`retry` with
221
+ * `nextAttemptAt <= now`) or whose lease expired. Sets `leaseUntil = now + leaseMs`
222
+ * and status `sending`. Concurrent callers must never receive the same row
223
+ * (Postgres: `FOR UPDATE SKIP LOCKED`). Lease expiry is what makes a killed
224
+ * worker's rows reappear: delivery is at-least-once.
225
+ */
226
+ claim(opts: {
227
+ limit: number;
228
+ now: Date;
229
+ leaseMs: number;
230
+ }): Promise<ClaimedDelivery[]>;
231
+ /** Record an attempt outcome: status, attempts, error; clears the lease. */
232
+ recordResult(deliveryId: string, result: DeliveryResult): Promise<void>;
233
+ getNotification(id: string): Promise<{
234
+ notification: NotificationRecord;
235
+ deliveries: DeliveryRecord[];
236
+ } | null>;
237
+ inboxAdd(item: Omit<InboxItem, "id" | "createdAt" | "readAt">): Promise<InboxItem>;
238
+ inboxList(q: InboxQuery): Promise<InboxPage>;
239
+ inboxMarkRead(recipientId: string, ids: readonly string[]): Promise<void>;
240
+ /** Create or upgrade Herald's tables. Optional: apps may manage schema themselves. */
241
+ migrate?(): Promise<void>;
242
+ close?(): Promise<void>;
243
+ }
244
+
245
+ interface HeraldConfig<Ch extends ChannelMap, Ev extends Record<string, AnyEventDef>> {
246
+ store: Store;
247
+ channels: Ch;
248
+ /** Each event must conform to the channel map: registered channels, matching message types. */
249
+ events: Ev & {
250
+ [E in keyof Ev]: Conform<Ev[E], Ch>;
251
+ };
252
+ resolvePreferences?: ResolvePreferences;
253
+ resolveAddress?: ResolveAddress;
254
+ hooks?: Hooks;
255
+ logger?: Logger;
256
+ retry?: Partial<RetryPolicy>;
257
+ /** Clock override for tests. */
258
+ now?: () => Date;
259
+ }
260
+ interface Herald<Ev extends Record<string, AnyEventDef>> {
261
+ /** Queue a notification. Resolves with its id; channel failures never reach the caller. */
262
+ notify<E extends keyof Ev & string>(event: E, payload: PayloadOf<Ev[E]>, targets: Targets<AllowedChannel<Ev[E]>>): Promise<string>;
263
+ /** Claim and deliver due work. The host schedules this (interval, cron, queue trigger). */
264
+ processPending(opts?: ProcessOptions): Promise<ProcessSummary>;
265
+ inbox: {
266
+ list(q: InboxQuery): Promise<InboxPage>;
267
+ markRead(recipientId: string, ids: readonly string[]): Promise<void>;
268
+ };
269
+ }
270
+ declare const defaultRetry: RetryPolicy;
271
+ /**
272
+ * Validates config at startup (missing templates, unregistered channels are
273
+ * errors here, not at send time). Behavior lands in later releases: `notify`,
274
+ * `processPending` and `inbox` are typed but throw `not_implemented` for now.
275
+ */
276
+ declare function createHerald<const Ch extends ChannelMap, Ev extends Record<string, AnyEventDef>>(config: HeraldConfig<Ch, Ev>): Herald<Ev>;
277
+
278
+ type HeraldErrorCode = "invalid_config" | "unknown_event" | "channel_not_allowed" | "missing_template" | "not_implemented";
279
+ /** Every error Herald throws on its own behalf. Channel failures never surface through here. */
280
+ declare class HeraldError extends Error {
281
+ readonly code: HeraldErrorCode;
282
+ constructor(code: HeraldErrorCode, message: string);
283
+ }
284
+
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 };
package/dist/index.js CHANGED
@@ -1,6 +1,90 @@
1
- // src/index.ts
2
- var version = "0.0.0";
1
+ // src/errors.ts
2
+ var HeraldError = class extends Error {
3
+ code;
4
+ constructor(code, message) {
5
+ super(message);
6
+ this.name = "HeraldError";
7
+ this.code = code;
8
+ }
9
+ };
10
+
11
+ // src/herald.ts
12
+ var defaultRetry = {
13
+ maxAttempts: 5,
14
+ baseMs: 3e4,
15
+ maxMs: 36e5,
16
+ jitter: true
17
+ };
18
+ var fn = (v) => typeof v === "function";
19
+ function validate(config) {
20
+ const bad = (msg) => {
21
+ throw new HeraldError("invalid_config", msg);
22
+ };
23
+ const { store, channels, events } = config;
24
+ for (const m of ["enqueue", "claim", "recordResult"]) {
25
+ if (!fn(store?.[m]))
26
+ bad(`store.${m} is not a function`);
27
+ }
28
+ for (const [name, ch] of Object.entries(channels ?? {})) {
29
+ const c = ch;
30
+ if (!c || !fn(c.send) || !fn(c.classifyError))
31
+ bad(`channel "${name}" must implement send() and classifyError()`);
32
+ }
33
+ const names = Object.keys(events ?? {});
34
+ if (names.length === 0) bad("at least one event is required");
35
+ for (const [event, def] of Object.entries(events)) {
36
+ if (!def.channels?.length) bad(`event "${event}" must allow at least one channel`);
37
+ for (const ch of def.channels) {
38
+ if (!(ch in channels)) bad(`event "${event}" allows unregistered channel "${ch}"`);
39
+ if (!fn(def.templates?.[ch]))
40
+ throw new HeraldError("missing_template", `event "${event}" has no template for channel "${ch}"`);
41
+ }
42
+ for (const ch of Object.keys(def.templates ?? {})) {
43
+ if (!def.channels.includes(ch))
44
+ bad(`event "${event}" has a template for "${ch}" which is not in its allowed channels`);
45
+ }
46
+ }
47
+ }
48
+ function createHerald(config) {
49
+ validate(config);
50
+ const notImplemented = (what) => {
51
+ throw new HeraldError("not_implemented", `${what} is not implemented yet`);
52
+ };
53
+ return {
54
+ async notify(event, _payload, targets) {
55
+ const def = config.events[event];
56
+ if (!def) throw new HeraldError("unknown_event", `unknown event "${event}"`);
57
+ for (const ch of targets.channels ?? []) {
58
+ if (!def.channels.includes(ch))
59
+ throw new HeraldError(
60
+ "channel_not_allowed",
61
+ `event "${event}" does not allow channel "${ch}"`
62
+ );
63
+ }
64
+ return notImplemented("notify()");
65
+ },
66
+ async processPending() {
67
+ return notImplemented("processPending()");
68
+ },
69
+ inbox: {
70
+ async list() {
71
+ return notImplemented("inbox.list()");
72
+ },
73
+ async markRead() {
74
+ return notImplemented("inbox.markRead()");
75
+ }
76
+ }
77
+ };
78
+ }
79
+
80
+ // src/events.ts
81
+ function defineEvent() {
82
+ return (def) => def;
83
+ }
3
84
  export {
4
- version
85
+ HeraldError,
86
+ createHerald,
87
+ defaultRetry,
88
+ defineEvent
5
89
  };
6
90
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// ponytail: placeholder so build/test/release run for real; replaced in PRD 1\nexport const version = \"0.0.0\";\n"],"mappings":";AACO,IAAM,UAAU;","names":[]}
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 [\"enqueue\", \"claim\", \"recordResult\"] as const) {\n if (!fn((store as unknown as Record<string, unknown> | undefined)?.[m]))\n bad(`store.${m} is not a function`);\n }\n\n for (const [name, ch] of Object.entries(channels ?? {})) {\n const c = ch as Channel | undefined;\n if (!c || !fn(c.send) || !fn(c.classifyError))\n bad(`channel \"${name}\" must implement send() and classifyError()`);\n }\n\n const names = Object.keys(events ?? {});\n if (names.length === 0) bad(\"at least one event is required\");\n\n for (const [event, def] of Object.entries(events)) {\n if (!def.channels?.length) bad(`event \"${event}\" must allow at least one channel`);\n for (const ch of def.channels) {\n if (!(ch in channels)) bad(`event \"${event}\" allows unregistered channel \"${ch}\"`);\n if (!fn((def.templates as Record<string, unknown> | undefined)?.[ch]))\n throw new HeraldError(\"missing_template\", `event \"${event}\" has no template for channel \"${ch}\"`);\n }\n for (const ch of Object.keys(def.templates ?? {})) {\n if (!def.channels.includes(ch))\n bad(`event \"${event}\" has a template for \"${ch}\" which is not in its allowed channels`);\n }\n }\n}\n\n/**\n * Validates config at startup (missing templates, unregistered channels are\n * errors here, not at send time). Behavior lands in later releases: `notify`,\n * `processPending` and `inbox` are typed but throw `not_implemented` for now.\n */\nexport function createHerald<\n const Ch extends ChannelMap,\n Ev extends Record<string, AnyEventDef>,\n>(config: HeraldConfig<Ch, Ev>): Herald<Ev> {\n validate(config as unknown as HeraldConfig<ChannelMap, Record<string, AnyEventDef>>);\n\n const notImplemented = (what: string): never => {\n throw new HeraldError(\"not_implemented\", `${what} is not implemented yet`);\n };\n\n return {\n async notify(event, _payload, targets) {\n const def = config.events[event] as AnyEventDef | undefined;\n if (!def) throw new HeraldError(\"unknown_event\", `unknown event \"${event}\"`);\n for (const ch of targets.channels ?? []) {\n if (!def.channels.includes(ch))\n throw new HeraldError(\n \"channel_not_allowed\",\n `event \"${event}\" does not allow channel \"${ch}\"`,\n );\n }\n return notImplemented(\"notify()\");\n },\n async processPending() {\n return notImplemented(\"processPending()\");\n },\n inbox: {\n async list() {\n return notImplemented(\"inbox.list()\");\n },\n async markRead() {\n return notImplemented(\"inbox.markRead()\");\n },\n },\n };\n}\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,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,CAAC,WAAW,SAAS,cAAc,GAAY;AAC7D,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,KAAK,CAAC,GAAG,EAAE,IAAI,KAAK,CAAC,GAAG,EAAE,aAAa;AAC1C,UAAI,YAAY,IAAI,6CAA6C;AAAA,EACrE;AAEA,QAAM,QAAQ,OAAO,KAAK,UAAU,CAAC,CAAC;AACtC,MAAI,MAAM,WAAW,EAAG,KAAI,gCAAgC;AAE5D,aAAW,CAAC,OAAO,GAAG,KAAK,OAAO,QAAQ,MAAM,GAAG;AACjD,QAAI,CAAC,IAAI,UAAU,OAAQ,KAAI,UAAU,KAAK,mCAAmC;AACjF,eAAW,MAAM,IAAI,UAAU;AAC7B,UAAI,EAAE,MAAM,UAAW,KAAI,UAAU,KAAK,kCAAkC,EAAE,GAAG;AACjF,UAAI,CAAC,GAAI,IAAI,YAAoD,EAAE,CAAC;AAClE,cAAM,IAAI,YAAY,oBAAoB,UAAU,KAAK,kCAAkC,EAAE,GAAG;AAAA,IACpG;AACA,eAAW,MAAM,OAAO,KAAK,IAAI,aAAa,CAAC,CAAC,GAAG;AACjD,UAAI,CAAC,IAAI,SAAS,SAAS,EAAE;AAC3B,YAAI,UAAU,KAAK,yBAAyB,EAAE,wCAAwC;AAAA,IAC1F;AAAA,EACF;AACF;AAOO,SAAS,aAGd,QAA0C;AAC1C,WAAS,MAA0E;AAEnF,QAAM,iBAAiB,CAAC,SAAwB;AAC9C,UAAM,IAAI,YAAY,mBAAmB,GAAG,IAAI,yBAAyB;AAAA,EAC3E;AAEA,SAAO;AAAA,IACL,MAAM,OAAO,OAAO,UAAU,SAAS;AACrC,YAAM,MAAM,OAAO,OAAO,KAAK;AAC/B,UAAI,CAAC,IAAK,OAAM,IAAI,YAAY,iBAAiB,kBAAkB,KAAK,GAAG;AAC3E,iBAAW,MAAM,QAAQ,YAAY,CAAC,GAAG;AACvC,YAAI,CAAC,IAAI,SAAS,SAAS,EAAE;AAC3B,gBAAM,IAAI;AAAA,YACR;AAAA,YACA,UAAU,KAAK,6BAA6B,EAAE;AAAA,UAChD;AAAA,MACJ;AACA,aAAO,eAAe,UAAU;AAAA,IAClC;AAAA,IACA,MAAM,iBAAiB;AACrB,aAAO,eAAe,kBAAkB;AAAA,IAC1C;AAAA,IACA,OAAO;AAAA,MACL,MAAM,OAAO;AACX,eAAO,eAAe,cAAc;AAAA,MACtC;AAAA,MACA,MAAM,WAAW;AACf,eAAO,eAAe,kBAAkB;AAAA,MAC1C;AAAA,IACF;AAAA,EACF;AACF;;;AC/FO,SAAS,cAAiB;AAC/B,SAAO,CAA0E,QAGxD;AAC3B;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useherald/core",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "description": "Storage-agnostic notification handler for Node/TypeScript.",
5
5
  "type": "module",
6
6
  "sideEffects": false,