@crossdelta/platform-sdk 0.5.11 → 0.5.13
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
|
@@ -403,7 +403,7 @@ export async function sendNotification(data: OrderCreatedEvent): Promise<void> {
|
|
|
403
403
|
// services/notifications/src/index.ts
|
|
404
404
|
import '@crossdelta/telemetry' // Must be first import
|
|
405
405
|
|
|
406
|
-
import { consumeJetStreamEvents } from '@crossdelta/cloudevents
|
|
406
|
+
import { consumeJetStreamEvents } from '@crossdelta/cloudevents'
|
|
407
407
|
import { Hono } from 'hono'
|
|
408
408
|
|
|
409
409
|
const port = Number(process.env.PORT || process.env.NOTIFICATIONS_PORT) || 4002
|
|
@@ -574,14 +574,21 @@ export default handleEvent(
|
|
|
574
574
|
|
|
575
575
|
## 🔧 Configuration Example
|
|
576
576
|
|
|
577
|
+
Define infrastructure in `infra/services/*.ts` using [`@crossdelta/infrastructure`](https://www.npmjs.com/package/@crossdelta/infrastructure):
|
|
578
|
+
|
|
577
579
|
```ts
|
|
580
|
+
import { ports } from '@crossdelta/infrastructure'
|
|
578
581
|
import type { K8sServiceConfig } from '@crossdelta/infrastructure'
|
|
579
582
|
|
|
580
583
|
export const config: K8sServiceConfig = {
|
|
581
584
|
name: 'orders',
|
|
582
|
-
|
|
585
|
+
ports: ports().http(4001).build(),
|
|
583
586
|
replicas: 1,
|
|
584
|
-
healthCheck: {
|
|
587
|
+
healthCheck: { httpPath: '/health' },
|
|
588
|
+
resources: {
|
|
589
|
+
requests: { cpu: '50m', memory: '64Mi' },
|
|
590
|
+
limits: { cpu: '150m', memory: '128Mi' },
|
|
591
|
+
},
|
|
585
592
|
env: {
|
|
586
593
|
DATABASE_URL: databaseUrl,
|
|
587
594
|
NATS_URL: natsUrl,
|
|
@@ -589,6 +596,8 @@ export const config: K8sServiceConfig = {
|
|
|
589
596
|
}
|
|
590
597
|
```
|
|
591
598
|
|
|
599
|
+
**📖 See the [Infrastructure Package Docs](https://www.npmjs.com/package/@crossdelta/infrastructure) for advanced configuration options.**
|
|
600
|
+
|
|
592
601
|
<br />
|
|
593
602
|
|
|
594
603
|
---
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "@crossdelta/cloudevents",
|
|
4
4
|
"description": "Type-safe event-driven microservices with NATS and Zod validation",
|
|
5
5
|
"link": "https://www.npmjs.com/package/@crossdelta/cloudevents",
|
|
6
|
-
"install": ["@crossdelta/cloudevents@^0.3.
|
|
6
|
+
"install": ["@crossdelta/cloudevents@^0.3.4", "zod@^4.0.0"],
|
|
7
7
|
"run": [],
|
|
8
8
|
"initial": true
|
|
9
9
|
},
|
|
@@ -70,7 +70,7 @@ Rules:
|
|
|
70
70
|
```ts
|
|
71
71
|
import '@crossdelta/telemetry'
|
|
72
72
|
|
|
73
|
-
import { consumeJetStreamEvents } from '@crossdelta/cloudevents
|
|
73
|
+
import { consumeJetStreamEvents } from '@crossdelta/cloudevents'
|
|
74
74
|
import { Hono } from 'hono'
|
|
75
75
|
|
|
76
76
|
const port = Number(process.env.PORT || process.env.MY_SERVICE_PORT) || 4003
|
|
@@ -152,7 +152,7 @@ Start consumption in `src/index.ts` (NOT in a separate file):
|
|
|
152
152
|
// src/index.ts - complete example with event consumption
|
|
153
153
|
import '@crossdelta/telemetry'
|
|
154
154
|
|
|
155
|
-
import { consumeJetStreamEvents } from '@crossdelta/cloudevents
|
|
155
|
+
import { consumeJetStreamEvents } from '@crossdelta/cloudevents'
|
|
156
156
|
import { Hono } from 'hono'
|
|
157
157
|
|
|
158
158
|
const port = Number(process.env.PORT || process.env.NOTIFICATIONS_PORT) || 4002
|