@warlock.js/notifications 5.24.0 → 5.26.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/CHANGELOG.md +12 -0
- package/cjs/index.cjs +1 -1
- package/cjs/rabbitmq-driver-DvWaCPES.cjs +3 -0
- package/cjs/{src-DbAWktJm.cjs → src-BVlqtCR2.cjs} +22 -6
- package/cjs/src-BVlqtCR2.cjs.map +1 -0
- package/esm/herald/src/communicators/broker-registry.mjs.map +1 -1
- package/esm/herald/src/communicators/broker.mjs.map +1 -1
- package/esm/herald/src/drivers/rabbitmq/rabbitmq-channel.mjs.map +1 -1
- package/esm/herald/src/drivers/rabbitmq/rabbitmq-driver.mjs.map +1 -1
- package/esm/herald/src/message-managers/prepare-consumer-subscription.mjs.map +1 -1
- package/esm/herald/src/utils/connect-to-broker.mjs.map +1 -1
- package/esm/seal/src/config.mjs.map +1 -1
- package/esm/seal/src/factory/validate.mjs.map +1 -1
- package/esm/seal/src/factory/validators.mjs +1 -1
- package/esm/seal/src/factory/validators.mjs.map +1 -1
- package/esm/seal/src/helpers/date-helpers.mjs.map +1 -1
- package/esm/seal/src/helpers/get-field-value.mjs.map +1 -1
- package/esm/seal/src/helpers/path-helpers.mjs.map +1 -1
- package/esm/seal/src/mutators/array-mutators.mjs.map +1 -1
- package/esm/seal/src/mutators/date-mutators.mjs.map +1 -1
- package/esm/seal/src/mutators/number-mutators.mjs.map +1 -1
- package/esm/seal/src/mutators/object-mutators.mjs.map +1 -1
- package/esm/seal/src/mutators/scalar-mutators.mjs.map +1 -1
- package/esm/seal/src/mutators/string-mutators.mjs.map +1 -1
- package/esm/seal/src/rules/array/array-rules.mjs.map +1 -1
- package/esm/seal/src/rules/color/color-rules.mjs.map +1 -1
- package/esm/seal/src/rules/common/enum.mjs.map +1 -1
- package/esm/seal/src/rules/common/equals-field-rules.mjs.map +1 -1
- package/esm/seal/src/rules/common/type-rules.mjs.map +1 -1
- package/esm/seal/src/rules/conditional/forbidden-if-rules.mjs.map +1 -1
- package/esm/seal/src/rules/conditional/present-if-rules.mjs.map +1 -1
- package/esm/seal/src/rules/conditional/present-unless-rules.mjs.map +1 -1
- package/esm/seal/src/rules/conditional/present-with-rules.mjs.map +1 -1
- package/esm/seal/src/rules/conditional/present-without-rules.mjs.map +1 -1
- package/esm/seal/src/rules/conditional/required-if-rules.mjs.map +1 -1
- package/esm/seal/src/rules/conditional/required-unless-rules.mjs.map +1 -1
- package/esm/seal/src/rules/conditional/required-with-rules.mjs.map +1 -1
- package/esm/seal/src/rules/conditional/required-without-rules.mjs.map +1 -1
- package/esm/seal/src/rules/core/equal.mjs.map +1 -1
- package/esm/seal/src/rules/core/forbidden.mjs.map +1 -1
- package/esm/seal/src/rules/core/required.mjs.map +1 -1
- package/esm/seal/src/rules/core/union.mjs.map +1 -1
- package/esm/seal/src/rules/core/when.mjs.map +1 -1
- package/esm/seal/src/rules/date/date-comparison-rules.mjs.map +1 -1
- package/esm/seal/src/rules/date/date-day-rules.mjs.map +1 -1
- package/esm/seal/src/rules/date/date-field-comparison-rules.mjs.map +1 -1
- package/esm/seal/src/rules/date/date-period-rules.mjs.map +1 -1
- package/esm/seal/src/rules/date/date-relative-rules.mjs.map +1 -1
- package/esm/seal/src/rules/date/date-special-rules.mjs.map +1 -1
- package/esm/seal/src/rules/date/date.mjs.map +1 -1
- package/esm/seal/src/rules/length/length-rules.mjs.map +1 -1
- package/esm/seal/src/rules/number/number-rules.mjs.map +1 -1
- package/esm/seal/src/rules/scalar/accepted-rule.mjs.map +1 -1
- package/esm/seal/src/rules/scalar/declined-rule.mjs.map +1 -1
- package/esm/seal/src/rules/string/alpha.mjs.map +1 -1
- package/esm/seal/src/rules/string/credit-card.mjs.map +1 -1
- package/esm/seal/src/rules/string/email.mjs.map +1 -1
- package/esm/seal/src/rules/string/pattern.mjs.map +1 -1
- package/esm/seal/src/rules/string/string-comparison.mjs.map +1 -1
- package/esm/seal/src/rules/string/strong-password-rule.mjs.map +1 -1
- package/esm/seal/src/rules/string/url.mjs.map +1 -1
- package/esm/seal/src/rules/string/without-whitespace.mjs.map +1 -1
- package/esm/seal/src/types/date-types.mjs.map +1 -1
- package/esm/seal/src/validators/any-validator.mjs.map +1 -1
- package/esm/seal/src/validators/array-validator.mjs +1 -0
- package/esm/seal/src/validators/array-validator.mjs.map +1 -1
- package/esm/seal/src/validators/base-validator.mjs +12 -1
- package/esm/seal/src/validators/base-validator.mjs.map +1 -1
- package/esm/seal/src/validators/boolean-validator.mjs +1 -0
- package/esm/seal/src/validators/boolean-validator.mjs.map +1 -1
- package/esm/seal/src/validators/date-validator.mjs +1 -0
- package/esm/seal/src/validators/date-validator.mjs.map +1 -1
- package/esm/seal/src/validators/float-validator.mjs.map +1 -1
- package/esm/seal/src/validators/int-validator.mjs.map +1 -1
- package/esm/seal/src/validators/literal-validator.mjs +1 -3
- package/esm/seal/src/validators/literal-validator.mjs.map +1 -1
- package/esm/seal/src/validators/methods/equality-conditional-methods.mjs.map +1 -1
- package/esm/seal/src/validators/methods/forbidden-methods.mjs.map +1 -1
- package/esm/seal/src/validators/methods/present-methods.mjs.map +1 -1
- package/esm/seal/src/validators/methods/required-methods.mjs.map +1 -1
- package/esm/seal/src/validators/number-validator.mjs +1 -0
- package/esm/seal/src/validators/number-validator.mjs.map +1 -1
- package/esm/seal/src/validators/numeric-validator.mjs.map +1 -1
- package/esm/seal/src/validators/object-validator.mjs +1 -1
- package/esm/seal/src/validators/object-validator.mjs.map +1 -1
- package/esm/seal/src/validators/record-validator.mjs.map +1 -1
- package/esm/seal/src/validators/scalar-validator.mjs +1 -0
- package/esm/seal/src/validators/scalar-validator.mjs.map +1 -1
- package/esm/seal/src/validators/string-validator.mjs.map +1 -1
- package/esm/seal/src/validators/tuple-validator.mjs.map +1 -1
- package/esm/seal/src/validators/union-validator.mjs.map +1 -1
- package/llms-full.txt +901 -891
- package/package.json +7 -7
- package/skills/configure-notifications/SKILL.md +138 -138
- package/skills/define-channel/SKILL.md +107 -107
- package/skills/define-notification/SKILL.md +133 -133
- package/skills/observe-notifications/SKILL.md +66 -66
- package/skills/queue-notifications/SKILL.md +110 -110
- package/skills/send-ad-hoc/SKILL.md +95 -95
- package/skills/use-in-app/SKILL.md +172 -172
- package/skills/write-notification-migration/SKILL.md +66 -66
- package/cjs/rabbitmq-driver-C0o3Pz15.cjs +0 -3
- package/cjs/src-DbAWktJm.cjs.map +0 -1
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: write-notification-migration
|
|
1
|
+
---
|
|
2
|
+
name: write-notification-migration
|
|
3
3
|
description: 'Create the notifications table with the `notificationColumns(Notification)` factory + cascade `Migration.create`. Column NAMES come from the model''s `columnMap` (recipient / tenant / readAt / isRead); the fixed columns are `type` / `title` / `body` / `payload` / `idempotency_key`. Set `{ idType: "bigint" }` for integer-key apps; UUID remains the default. Read-state follows columnMap presence: `readAt` → nullable timestamp, `isRead` → indexed boolean, both → both. Defaults to `user_id` + `read_at` when no columnMap. Spread + extend for extras (FK references, composite indexes). Triggers: `notificationColumns`, `Migration.create` for notifications, "create the notifications table", "notification migration", "add organization_id to notifications", `is_read` column, `read_at` column, `idempotency_key` column; typical import `import { Migration } from "@warlock.js/cascade"; import { notificationColumns } from "@warlock.js/notifications"`. Skip: generic cascade migration writing — `@warlock.js/cascade/write-migration/SKILL.md`; the model itself — `@warlock.js/notifications/use-in-app/SKILL.md`.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Write the notifications migration
|
|
7
|
-
|
|
8
|
-
The package ships no table or migration (thin eject). You own the migration; the package gives you a column factory that names columns from your model's `columnMap`, so it's one line.
|
|
9
|
-
|
|
10
|
-
> `npx warlock add notifications` scaffolds this migration (+ the model) for you. Reach for this skill when you need to customize columns or add extras.
|
|
11
|
-
|
|
12
|
-
## Common case — one line
|
|
13
|
-
|
|
14
|
-
```ts title="src/app/notifications/migrations/01-01-2026_00-00-00-notifications.migration.ts"
|
|
15
|
-
import { Migration } from "@warlock.js/cascade";
|
|
16
|
-
import { notificationColumns } from "@warlock.js/notifications";
|
|
17
|
-
import { Notification } from "../notification.model";
|
|
18
|
-
|
|
19
|
-
export default Migration.create(Notification, notificationColumns(Notification));
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
`notificationColumns(Notification)` reads the model's `columnMap` and returns the
|
|
23
|
-
matching columns:
|
|
24
|
-
|
|
25
|
-
| columnMap | Columns |
|
|
26
|
-
|---|---|
|
|
27
|
-
| _(none / default)_ | `user_id`, `type`, `title`, `body`, `payload`, `read_at`, `idempotency_key` |
|
|
28
|
-
| `{ tenant: "organization_id", readAt: "read_at" }` | adds `organization_id`; read_at-only |
|
|
29
|
-
| `{ isRead: "is_read" }` | swaps `read_at` for `is_read` (indexed boolean) |
|
|
30
|
-
| `{ isRead: "is_read", readAt: "read_at" }` | both read-state columns |
|
|
31
|
-
|
|
32
|
-
The recipient / tenant / read-state column NAMES come from `columnMap`; `type` /
|
|
33
|
-
`title` / `body` / `payload` / `idempotency_key` are fixed. `id` / `createdAt` /
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Write the notifications migration
|
|
7
|
+
|
|
8
|
+
The package ships no table or migration (thin eject). You own the migration; the package gives you a column factory that names columns from your model's `columnMap`, so it's one line.
|
|
9
|
+
|
|
10
|
+
> `npx warlock add notifications` scaffolds this migration (+ the model) for you. Reach for this skill when you need to customize columns or add extras.
|
|
11
|
+
|
|
12
|
+
## Common case — one line
|
|
13
|
+
|
|
14
|
+
```ts title="src/app/notifications/migrations/01-01-2026_00-00-00-notifications.migration.ts"
|
|
15
|
+
import { Migration } from "@warlock.js/cascade";
|
|
16
|
+
import { notificationColumns } from "@warlock.js/notifications";
|
|
17
|
+
import { Notification } from "../notification.model";
|
|
18
|
+
|
|
19
|
+
export default Migration.create(Notification, notificationColumns(Notification));
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`notificationColumns(Notification)` reads the model's `columnMap` and returns the
|
|
23
|
+
matching columns:
|
|
24
|
+
|
|
25
|
+
| columnMap | Columns |
|
|
26
|
+
|---|---|
|
|
27
|
+
| _(none / default)_ | `user_id`, `type`, `title`, `body`, `payload`, `read_at`, `idempotency_key` |
|
|
28
|
+
| `{ tenant: "organization_id", readAt: "read_at" }` | adds `organization_id`; read_at-only |
|
|
29
|
+
| `{ isRead: "is_read" }` | swaps `read_at` for `is_read` (indexed boolean) |
|
|
30
|
+
| `{ isRead: "is_read", readAt: "read_at" }` | both read-state columns |
|
|
31
|
+
|
|
32
|
+
The recipient / tenant / read-state column NAMES come from `columnMap`; `type` /
|
|
33
|
+
`title` / `body` / `payload` / `idempotency_key` are fixed. `id` / `createdAt` /
|
|
34
34
|
`updatedAt` are added automatically by cascade.
|
|
35
35
|
|
|
36
36
|
## Match your app's identifier type
|
|
@@ -42,39 +42,39 @@ identifier column the factory creates:
|
|
|
42
42
|
```ts
|
|
43
43
|
export default Migration.create(Notification, notificationColumns(Notification, { idType: "bigint" }));
|
|
44
44
|
```
|
|
45
|
-
|
|
46
|
-
## With extras — spread + extend
|
|
47
|
-
|
|
48
|
-
Add your own columns — a category, a source channel, a tenant id, anything:
|
|
49
|
-
|
|
50
|
-
```ts
|
|
51
|
-
import { Migration, string } from "@warlock.js/cascade";
|
|
52
|
-
import { notificationColumns } from "@warlock.js/notifications";
|
|
53
|
-
import { Notification } from "../notification.model";
|
|
54
|
-
|
|
45
|
+
|
|
46
|
+
## With extras — spread + extend
|
|
47
|
+
|
|
48
|
+
Add your own columns — a category, a source channel, a tenant id, anything:
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { Migration, string } from "@warlock.js/cascade";
|
|
52
|
+
import { notificationColumns } from "@warlock.js/notifications";
|
|
53
|
+
import { Notification } from "../notification.model";
|
|
54
|
+
|
|
55
55
|
export default Migration.create(Notification, {
|
|
56
56
|
...notificationColumns(Notification, { idType: "bigint" }),
|
|
57
|
-
category: string().index().nullable(),
|
|
58
|
-
});
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Mirror any extra column in the model `schema`. To make it filterable, add a method to a custom repository (see `use-in-app/SKILL.md`).
|
|
62
|
-
|
|
63
|
-
## Column naming follows `columnMap`
|
|
64
|
-
|
|
65
|
-
The factory does NOT guess names from the driver — it reads the model's `columnMap`. To match a different convention (e.g. MongoDB camelCase), name the columns there and the migration follows:
|
|
66
|
-
|
|
67
|
-
```ts
|
|
68
|
-
class Notification extends DatabaseNotification {
|
|
69
|
-
public static columnMap = { recipient: "userId", readAt: "readAt" };
|
|
70
|
-
}
|
|
71
|
-
// → notificationColumns(Notification) emits `userId` + `readAt`
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Without a model passed, defaults to `user_id` + `read_at` (read_at-only). See [`use-in-app/SKILL.md`](../use-in-app/SKILL.md) for the full `columnMap` shape.
|
|
75
|
-
|
|
76
|
-
## See also
|
|
77
|
-
|
|
78
|
-
- [`use-in-app/SKILL.md`](../use-in-app/SKILL.md) — the model + repository the migration backs.
|
|
79
|
-
- [`@warlock.js/cascade/write-migration/SKILL.md`](../../../cascade/skills/write-migration/SKILL.md) — generic Cascade migration form, `Migration.alter`, etc.
|
|
80
|
-
- [`@warlock.js/cascade/manage-data-sources/SKILL.md`](../../../cascade/skills/manage-data-sources/SKILL.md) — multi-data-source setup.
|
|
57
|
+
category: string().index().nullable(),
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Mirror any extra column in the model `schema`. To make it filterable, add a method to a custom repository (see `use-in-app/SKILL.md`).
|
|
62
|
+
|
|
63
|
+
## Column naming follows `columnMap`
|
|
64
|
+
|
|
65
|
+
The factory does NOT guess names from the driver — it reads the model's `columnMap`. To match a different convention (e.g. MongoDB camelCase), name the columns there and the migration follows:
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
class Notification extends DatabaseNotification {
|
|
69
|
+
public static columnMap = { recipient: "userId", readAt: "readAt" };
|
|
70
|
+
}
|
|
71
|
+
// → notificationColumns(Notification) emits `userId` + `readAt`
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Without a model passed, defaults to `user_id` + `read_at` (read_at-only). See [`use-in-app/SKILL.md`](../use-in-app/SKILL.md) for the full `columnMap` shape.
|
|
75
|
+
|
|
76
|
+
## See also
|
|
77
|
+
|
|
78
|
+
- [`use-in-app/SKILL.md`](../use-in-app/SKILL.md) — the model + repository the migration backs.
|
|
79
|
+
- [`@warlock.js/cascade/write-migration/SKILL.md`](../../../cascade/skills/write-migration/SKILL.md) — generic Cascade migration form, `Migration.alter`, etc.
|
|
80
|
+
- [`@warlock.js/cascade/manage-data-sources/SKILL.md`](../../../cascade/skills/manage-data-sources/SKILL.md) — multi-data-source setup.
|