@crossdelta/platform-sdk 0.3.22 → 0.3.23
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 +38 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -156,6 +156,43 @@ my-platform/
|
|
|
156
156
|
|
|
157
157
|
---
|
|
158
158
|
|
|
159
|
+
## ⚡ Event-Driven Architecture
|
|
160
|
+
|
|
161
|
+
Built on **CloudEvents** and **NATS JetStream** using **[`@crossdelta/cloudevents`](https://github.com/orderboss/platform/tree/main/packages/cloudevents)**:
|
|
162
|
+
|
|
163
|
+
- 🎯 **Type-safe event handlers** with Zod schemas
|
|
164
|
+
- 🔄 **Auto-discovery** of event handlers (`*.event.ts` files)
|
|
165
|
+
- 📦 **Publisher/Consumer patterns** out of the box
|
|
166
|
+
- 🚀 **Production-ready** NATS JetStream integration
|
|
167
|
+
|
|
168
|
+
**Publish events:**
|
|
169
|
+
```typescript
|
|
170
|
+
import { publish } from '@crossdelta/cloudevents'
|
|
171
|
+
|
|
172
|
+
await publish('orders.created', { orderId: 'ord_123', total: 99.99 })
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Consume events (auto-discovered):**
|
|
176
|
+
```typescript
|
|
177
|
+
// services/notifications/src/handlers/order-created.event.ts
|
|
178
|
+
import { handleEvent } from '@crossdelta/cloudevents'
|
|
179
|
+
import { z } from 'zod'
|
|
180
|
+
|
|
181
|
+
const OrderCreatedSchema = z.object({
|
|
182
|
+
type: z.literal('orders.created'),
|
|
183
|
+
orderId: z.string(),
|
|
184
|
+
total: z.number(),
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
export default handleEvent(OrderCreatedSchema, async (data) => {
|
|
188
|
+
await sendNotification(data)
|
|
189
|
+
})
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
<br />
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
159
196
|
## 🛠 CLI Commands
|
|
160
197
|
|
|
161
198
|
<details>
|
|
@@ -247,22 +284,9 @@ GitHub Secrets:
|
|
|
247
284
|
- Pulumi CLI
|
|
248
285
|
- Docker (for local Supabase/NATS)
|
|
249
286
|
|
|
250
|
-
<br />
|
|
251
|
-
|
|
252
|
-
---
|
|
253
|
-
|
|
254
|
-
## � Community & Support
|
|
255
|
-
|
|
256
|
-
- 📖 [Full Documentation](https://github.com/orderboss/platform/tree/main/packages/platform-sdk/docs)
|
|
257
|
-
- 🐛 [Report Issues](https://github.com/orderboss/platform/issues)
|
|
258
|
-
- 💡 [Feature Requests](https://github.com/orderboss/platform/discussions)
|
|
259
|
-
- 📦 [npm Package](https://www.npmjs.com/package/@crossdelta/platform-sdk)
|
|
260
|
-
- ⭐ [Star on GitHub](https://github.com/orderboss/platform)
|
|
261
|
-
|
|
262
|
-
<br />
|
|
263
287
|
|
|
264
288
|
---
|
|
265
289
|
|
|
266
|
-
##
|
|
290
|
+
## 📄 License
|
|
267
291
|
|
|
268
292
|
MIT © Crossdelta
|