@brickkit/core 0.8.1 → 0.9.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/README.md CHANGED
@@ -74,7 +74,7 @@ const api = createBrickClient({ baseUrl: "http://localhost:4000", contract });
74
74
  const pages = await api.page.list({ limit: 10 });
75
75
  ```
76
76
 
77
- The generated contract contains browser-safe route metadata and inferred input/output/error types. It honors custom action paths and methods, encodes path parameters, and removes them from the remaining payload. No backend handlers are bundled. See the CLI README and `www/content/docs/(brick)/typed-client.mdx` for Vite setup and error handling.
77
+ The generated contract contains browser-safe route metadata and inferred input/output/error types. It honors custom action paths and methods, encodes path parameters, and removes them from the remaining payload. No backend handlers are bundled. See the CLI README and the [typed client guide](https://brickkit.dev/docs/typed-client) for Vite setup and error handling.
78
78
 
79
79
  ## MCP tools
80
80
 
@@ -160,6 +160,31 @@ app.all(
160
160
  `brick dev` registers a provider and sends the spans to its dashboard, so apps
161
161
  there need `telemetry: true` too.
162
162
 
163
+ ## Events
164
+
165
+ Generated CRUD writes can record an event in the same transaction as the row, and
166
+ Brick delivers it to your listeners after the commit, retrying one that fails.
167
+ Add `outboxTable()` to the database, define a listener, and pass it to `brick()`.
168
+
169
+ ```ts
170
+ import { brick, defineListener, outboxTable } from "@brickkit/core";
171
+
172
+ export const outbox = outboxTable("postgres");
173
+
174
+ const welcome = defineListener({
175
+ name: "welcome-email",
176
+ on: "user.create",
177
+ run: async ({ payload, deliveryId }) => {
178
+ await mailer.sendWelcome(payload.row.email, { idempotencyKey: deliveryId });
179
+ },
180
+ });
181
+
182
+ export default brick({ services, events: { listeners: [welcome] } });
183
+ ```
184
+
185
+ Delivery is at least once, so use `deliveryId` as an idempotency key. An app
186
+ without `events` behaves as before. See the [Events guide](https://brickkit.dev/docs/events).
187
+
163
188
  ## TanStack Query options
164
189
 
165
190
  Install `@tanstack/query-core` v5 alongside your framework's TanStack Query package.