@tristan2828/ui-foundation 4.56.0 → 4.57.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.
|
@@ -80,6 +80,30 @@ Scope it to the signed-in user, as Widgets are.
|
|
|
80
80
|
package's `reminders` only with its `Reminder` model (imported, or the
|
|
81
81
|
job run without a model). So an app without push, or with its own
|
|
82
82
|
table, gets neither from `create_all` or autogenerate.
|
|
83
|
+
- **Channels beyond push** (email, a phone-alert app): hand the job a
|
|
84
|
+
sender per channel, and it still decides what's due and stamps it once.
|
|
85
|
+
A sender is `async def send(session, reminder)`: it returns `None` when
|
|
86
|
+
sent, or a `ChannelResult` ("sent", "failed" with its `error`, or
|
|
87
|
+
"skipped"), and an exception it raises is a failed result. `channels`
|
|
88
|
+
picks a reminder's channels (every one when left out; push is
|
|
89
|
+
`"push"`), and `on_sent` sees each reminder's results before its stamp
|
|
90
|
+
is committed, so a last-sent time per channel lands with it:
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
reminders.register(
|
|
94
|
+
model=MyReminder,
|
|
95
|
+
senders={"email": send_email},
|
|
96
|
+
channels=lambda r: r.channels.split(","),
|
|
97
|
+
on_sent=stamp_channels, # async (session, reminder, results)
|
|
98
|
+
)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
One failed channel doesn't stop the others; it's sent to error
|
|
102
|
+
reporting, and the reminder is done for the day either way (a channel
|
|
103
|
+
that's down isn't tried again every minute). A sender reads the session
|
|
104
|
+
but doesn't write it. `run_due_reminders` (same arguments) returns
|
|
105
|
+
each reminder's results, for a script or a test; a sender named
|
|
106
|
+
`"push"` replaces the package's.
|
|
83
107
|
- **Something else to send?** Call `send_push` from the app's own code or
|
|
84
108
|
job: a message when a long task finishes, a daily summary. The `url` is
|
|
85
109
|
always the app's own path.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tristan2828/ui-foundation",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.57.0",
|
|
4
4
|
"description": "Shared UI foundation for contract-first, database-backed React apps: shadcn primitives, DataTable/EntityForm composites, auth, the gateway error seam, design tokens, lint rules and the AI playbook.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|