@crossdelta/platform-sdk 0.3.37 → 0.3.38
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 +12 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -198,14 +198,22 @@ import { handleEvent } from '@crossdelta/cloudevents'
|
|
|
198
198
|
import { z } from 'zod'
|
|
199
199
|
|
|
200
200
|
const OrderCreatedSchema = z.object({
|
|
201
|
-
type: z.literal('orders.created'),
|
|
202
201
|
orderId: z.string(),
|
|
203
202
|
total: z.number(),
|
|
204
203
|
})
|
|
205
204
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
205
|
+
// Export type for use in use-cases
|
|
206
|
+
export type OrderCreatedEvent = z.infer<typeof OrderCreatedSchema>
|
|
207
|
+
|
|
208
|
+
export default handleEvent(
|
|
209
|
+
{
|
|
210
|
+
schema: OrderCreatedSchema,
|
|
211
|
+
type: 'orders.created',
|
|
212
|
+
},
|
|
213
|
+
async (data) => {
|
|
214
|
+
await sendNotification(data)
|
|
215
|
+
},
|
|
216
|
+
)
|
|
209
217
|
```
|
|
210
218
|
|
|
211
219
|
**📚 Learn more:** See `services/nats/README.md` in your workspace for monitoring, configuration, and JetStream details.
|