@warlock.js/notifications 5.34.0 → 5.34.2
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/llms-full.txt +28 -0
- package/llms.txt +1 -0
- package/package.json +7 -7
- package/skills/README.md +0 -23
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to `@warlock.js/notifications` are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). `@warlock.js/*` packages are released in lockstep — every package shares the same version number, so a version below may list only the changes that affected this package.
|
|
6
6
|
|
|
7
|
+
## 5.34.2 - 2026-10-19
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Point the README at the package skill index, remove the outdated loose catalog, and include orientation in generated LLM projections.
|
|
12
|
+
|
|
7
13
|
## 5.32.0 - 2026-10-18
|
|
8
14
|
|
|
9
15
|
### Upgrading
|
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ await inApp.markAsRead(user); // recipient-scoped — no IDOR
|
|
|
58
58
|
|
|
59
59
|
## Skills
|
|
60
60
|
|
|
61
|
-
The package ships `skills/<task>/SKILL.md` files describing every public surface. Browse the index at [`skills/
|
|
61
|
+
The package ships `skills/<task>/SKILL.md` files describing every public surface. Browse the index at [`skills/index.md`](./skills/index.md) or load them via `agent-kit`.
|
|
62
62
|
|
|
63
63
|
## License
|
|
64
64
|
|
package/llms-full.txt
CHANGED
|
@@ -4,6 +4,34 @@
|
|
|
4
4
|
|
|
5
5
|
> Generated artifact. Concatenates every SKILL.md and reference file under `@warlock.js/notifications/skills/`. Re-run `node scripts/generate-llms.mjs` after any change.
|
|
6
6
|
|
|
7
|
+
## Package orientation
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
description: 'Multi-channel notifications for Warlock: define once, send by mail, in-app database, or custom channels. Exports `defineNotification`, `notify`, `defineChannel`, `mailChannel`, `inApp`, `notificationColumns`, `notifications`, `bullmqQueue`, `heraldQueue`, `NotificationConfig`. Use for: "notify a user", "send order shipped by email and in-app", "unread notifications", "add a Slack or webhook channel", "queue notification delivery". Not this package: sending a plain email or mail templates → @warlock.js/core sendMail; background jobs → @warlock.js/queue.'
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# @warlock.js/notifications
|
|
14
|
+
|
|
15
|
+
An orchestrator over transports that already exist: one event, many recipients, any mix of channels, one render per channel. It is not a queue, template engine, or transport. `defineNotification` builds a reusable notification (`send`, `queue`, `only`); `notify.<channel>` does ad-hoc single-channel sends; `inApp` is the read side of the database channel. Server-only.
|
|
16
|
+
|
|
17
|
+
## The 80% path
|
|
18
|
+
|
|
19
|
+
1. Orient with `notifications-basics.md`.
|
|
20
|
+
2. Configure channels in `src/config/notifications.ts`: `configure-notifications.md`; create the table: `write-notification-migration.md`.
|
|
21
|
+
3. Define the notification with `via` and a renderer per channel: `define-notification.md`; one-off sends: `send-ad-hoc.md`.
|
|
22
|
+
4. Serve the inbox (list, mark read): `use-in-app.md`.
|
|
23
|
+
5. Custom channel: `define-channel.md`; deferred delivery: `queue-notifications.md`; sent/failed/skipped hooks: `observe-notifications.md`.
|
|
24
|
+
|
|
25
|
+
## Conventions and pitfalls
|
|
26
|
+
|
|
27
|
+
- The config is declarative; the connector registers its default export, so never call `setNotificationConfig` yourself.
|
|
28
|
+
- Channel names are typed through `NotificationChannels` declaration merging.
|
|
29
|
+
- `mailChannel` wraps core `sendMail`; use core directly for non-notification mail.
|
|
30
|
+
- Every send accepts `force` and `idempotencyKey`; preferences and rate limits are pluggable gates.
|
|
31
|
+
- `.queue()` needs a backend: `bullmqQueue` (with `@warlock.js/queue`) or `heraldQueue`.
|
|
32
|
+
- Do not value-import from client code.
|
|
33
|
+
|
|
34
|
+
|
|
7
35
|
## configure-notifications `@warlock.js/notifications/configure-notifications/SKILL.md`
|
|
8
36
|
|
|
9
37
|
---
|
package/llms.txt
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
## Skills
|
|
8
8
|
|
|
9
|
+
- [Package orientation](@warlock.js/notifications/skills/index.md): Multi-channel notifications for Warlock: define once, send by mail, in-app database, or custom channels. Exports `defineNotification`, `notify`, `defineChannel`, `mailChannel`, `inApp`, `notificationColumns`, `notifications`, `bullmqQueue`, `heraldQueue`, `NotificationConfig`. Use for: "notify a user", "send order shipped by email and in-app", "unread notifications", "add a Slack or webhook channel", "queue notification delivery". Not this package: sending a plain email or mail templates → @warlock.js/core sendMail; background jobs → @warlock.js/queue.
|
|
9
10
|
- [configure-notifications](@warlock.js/notifications/configure-notifications/SKILL.md): Wire `@warlock.js/notifications` via a declarative `src/config/notifications.ts` that exports a `NotificationConfig` default — the notifications connector registers it at boot, so app code never calls `setNotificationConfig`. `channels`: registry mapping name → factory result (`mailChannel`, `inApp.configure`, custom `defineChannel`); `queue`: optional `QueueDispatcher` (`.queue()` throws without it); `preferences`: optional `PreferenceProvider` (drops channels the recipient muted); `rateLimit`: optional `RateLimiter` (drops channels exceeding per-recipient budgets). Triggers: `config/notifications.ts`, `NotificationConfig`, `setNotificationConfig`, `getNotificationConfig`, `mailChannel`, `inApp.configure`, "configure notifications", "wire notifications at boot", "set preferences provider", "set rate limit"; typical import `import { type NotificationConfig, mailChannel, inApp } from "@warlock.js/notifications"`. Skip: building a reusable notification — the `define-notification` topic; the in-app read API — the `use-in-app` topic; adding a custom channel — the `define-channel` topic.
|
|
10
11
|
- [define-channel](@warlock.js/notifications/define-channel/SKILL.md): Add a custom notification channel — `defineChannel<P>({ name, route?, send })` returns a `Channel<P>` you register in the `channels` map of `setNotificationConfig`. `name` matches the key in `NotificationChannels` (extend via `declare module` for typing); `route(notifiable)` resolves the recipient's address (defaults to `{ id }` when omitted); `send({ payload, route, notifiable, options })` does the actual transport. Use for Slack/Discord/internal-webhook/anything else — `fetch`-based with NO SDK is the simplest variant. Channels that load a heavy SDK should follow the lazy-import pattern from the develop-feature playbook. Triggers: `defineChannel`, `Channel<P>`, "custom notification channel", "add discord channel", "slack channel", "webhook channel", "new channel type", `declare module "@warlock.js/notifications"`; typical import `import { defineChannel } from "@warlock.js/notifications"`. Skip: lazy-loading an optional SDK behind the channel — the `develop-warlock.js-feature` workspace skill; using built-in channels — the `configure-notifications` topic.
|
|
11
12
|
- [define-notification](@warlock.js/notifications/define-notification/SKILL.md): Build a reusable multi-channel notification with `defineNotification<Data>({ type, via, ...renderers })`. `type` is the stable identifier preference/rate-limit gates use AND defaults the database channel's `type`. `via` is `ChannelName[]` OR `(data, to) => ChannelName[]` for per-recipient channel selection. Renderers are `(data, to, ctx) => NotificationChannels[C]`; `ctx` carries `locale` + `meta` from `SendOptions`. The returned object exposes `.send(to|to[], data, options?)`, `.queue(to|to[], data, options?)`, and `.only(...channels)`. Per-recipient + per-channel `Promise.allSettled` isolates failures; the database channel's `type` is auto-defaulted from `def.type`; `SendOptions.idempotencyKey` is injected into the database payload. Triggers: `defineNotification`, `via`, "reusable notification", "multi-channel notification", "send through several channels at once", "render per channel", `RenderContext`, `def.type`; "force on a notification", "queue with delay"; typical import `import { defineNotification } from "@warlock.js/notifications"`. Skip: single-channel ad-hoc sends — the `send-ad-hoc` topic; adding a brand-new channel — the `define-channel` topic; observing dispatch outcomes — the `observe-notifications` topic.
|
package/package.json
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
"environment": "server"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@warlock.js/cache": "5.34.
|
|
9
|
-
"@warlock.js/cascade": "5.34.
|
|
10
|
-
"@warlock.js/core": "5.34.
|
|
11
|
-
"@warlock.js/logger": "5.34.
|
|
8
|
+
"@warlock.js/cache": "5.34.2",
|
|
9
|
+
"@warlock.js/cascade": "5.34.2",
|
|
10
|
+
"@warlock.js/core": "5.34.2",
|
|
11
|
+
"@warlock.js/logger": "5.34.2"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@warlock.js/herald": "5.34.
|
|
15
|
-
"@warlock.js/queue": "5.34.
|
|
14
|
+
"@warlock.js/herald": "5.34.2",
|
|
15
|
+
"@warlock.js/queue": "5.34.2"
|
|
16
16
|
},
|
|
17
17
|
"peerDependenciesMeta": {
|
|
18
18
|
"@warlock.js/herald": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
],
|
|
38
38
|
"author": "hassanzohdy",
|
|
39
39
|
"license": "MIT",
|
|
40
|
-
"version": "5.34.
|
|
40
|
+
"version": "5.34.2",
|
|
41
41
|
"main": "./cjs/index.cjs",
|
|
42
42
|
"module": "./esm/index.mjs",
|
|
43
43
|
"types": "./esm/index.d.mts",
|
package/skills/README.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# @warlock.js/notifications — skills
|
|
2
|
-
|
|
3
|
-
All cross-references use the form `@warlock.js/notifications/<skill>/SKILL.md`.
|
|
4
|
-
|
|
5
|
-
Skills are added as the package's public surface lands. Phase 0 (core dispatch) ships:
|
|
6
|
-
|
|
7
|
-
- (incoming) `notifications-basics/` — what the package is, when to reach for it, the mental model.
|
|
8
|
-
- (incoming) `define-notification/` — reusable multi-channel definitions; `via`, renderers, `(data, to, ctx)`.
|
|
9
|
-
- (incoming) `send-ad-hoc/` — `notify.<channel>` proxy + `notify.channel(name)` runtime form.
|
|
10
|
-
- (incoming) `configure-notifications/` — `config/notifications.ts`, `NotificationConfig`, `SendOptions`.
|
|
11
|
-
- (incoming) `define-channel/` — custom channels via `defineChannel` + `declare module`.
|
|
12
|
-
- (incoming) `use-in-app/` — `inApp.configure({model})`, `listUnread` / `markAsRead` / `markAsUnread`.
|
|
13
|
-
- (incoming) `write-notification-migration/` — `notificationColumns(Notification)`, named from the model's `columnMap`.
|
|
14
|
-
- (incoming) `observe-notifications/` — `notifications.on("sending" | "sent" | "failed" | "skipped", …)`.
|
|
15
|
-
- `queue-notifications/` — async `.queue()` via the herald-backed dispatcher + worker.
|
|
16
|
-
- (deferred — Phase 2, bridges) `gate-with-preferences/` — already covered in `configure-notifications`; promote if it grows.
|
|
17
|
-
- (deferred — Phase 2, bridges) `send-via-whatsapp/`, `send-via-telegram/`, `send-via-push/`, `send-via-slack/`.
|
|
18
|
-
|
|
19
|
-
Regenerate the LLM index after any change:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
node scripts/generate-llms.mjs
|
|
23
|
-
```
|