@eventcatalog/create-eventcatalog 4.3.12 → 4.3.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/dist/index.js +1 -1
- package/package.json +1 -1
- package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/commands/CreateProduct/examples/index.mdx +194 -0
- package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/commands/DeleteProduct/examples/index.mdx +161 -0
- package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/commands/UpdateProduct/examples/index.mdx +182 -0
- package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/events/ProductCreated/examples/index.mdx +227 -0
- package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/events/ProductDeleted/examples/index.mdx +175 -0
- package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/events/ProductUpdated/examples/index.mdx +205 -0
- package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/queries/GetProduct/examples/index.mdx +205 -0
- package/templates/default/domains/Catalog/systems/search-system/services/SearchAPI/queries/SearchProducts/examples/index.mdx +369 -0
- package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/commands/RegisterCustomer/examples/index.mdx +168 -0
- package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/commands/UpdateCustomer/examples/index.mdx +168 -0
- package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/events/CustomerRegistered/examples/index.mdx +201 -0
- package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/events/CustomerUpdated/examples/index.mdx +194 -0
- package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/queries/GetCustomer/examples/index.mdx +194 -0
- package/templates/default/domains/Customer/systems/identity-provider/services/OAuthAPI/commands/AuthenticateCustomer/examples/index.mdx +198 -0
- package/templates/default/domains/Customer/systems/identity-provider/services/OAuthAPI/events/CustomerAuthenticated/examples/index.mdx +276 -0
- package/templates/default/domains/Fulfilment/systems/carrier/services/CarrierTrackingAPI/events/ShipmentCreated/examples/index.mdx +184 -0
- package/templates/default/domains/Fulfilment/systems/carrier/services/CarrierTrackingAPI/events/ShipmentDelivered/examples/index.mdx +173 -0
- package/templates/default/domains/Fulfilment/systems/carrier/services/CarrierTrackingAPI/events/ShipmentFailed/examples/index.mdx +265 -0
- package/templates/default/domains/Fulfilment/systems/inventory-system/services/InventoryService/commands/ReleaseInventory/examples/index.mdx +246 -0
- package/templates/default/domains/Fulfilment/systems/inventory-system/services/InventoryService/events/InventoryReserved/examples/index.mdx +227 -0
- package/templates/default/domains/Fulfilment/systems/inventory-system/services/InventoryService/events/InventoryUnavailable/examples/index.mdx +229 -0
- package/templates/default/domains/Fulfilment/systems/inventory-system/services/InventoryService/queries/GetStockLevel/examples/index.mdx +186 -0
- package/templates/default/domains/Fulfilment/systems/shipping-system/services/CarrierAdapter/commands/CreateShipment/examples/index.mdx +206 -0
- package/templates/default/domains/Fulfilment/systems/warehouse-system/services/PickingWorker/events/OrderPacked/examples/index.mdx +172 -0
- package/templates/default/domains/Fulfilment/systems/warehouse-system/services/WarehouseService/events/OrderReadyForShipping/examples/index.mdx +208 -0
- package/templates/default/domains/Ordering/systems/checkout-system/services/CheckoutOrchestrator/commands/AuthorizePayment/examples/index.mdx +179 -0
- package/templates/default/domains/Ordering/systems/checkout-system/services/CheckoutOrchestrator/commands/ReserveInventory/examples/index.mdx +215 -0
- package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/commands/CancelOrder/examples/index.mdx +163 -0
- package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/commands/CreateOrder/examples/index.mdx +246 -0
- package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/events/OrderCancelled/examples/index.mdx +267 -0
- package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/events/OrderCompleted/examples/index.mdx +171 -0
- package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/events/OrderCreated/examples/index.mdx +190 -0
- package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/queries/GetOrder/examples/index.mdx +343 -0
- package/templates/default/domains/Payments/systems/fraud-detection/services/FraudAPI/events/FraudCheckFailed/examples/index.mdx +271 -0
- package/templates/default/domains/Payments/systems/fraud-detection/services/FraudAPI/events/FraudCheckPassed/examples/index.mdx +173 -0
- package/templates/default/domains/Payments/systems/payment-processing-system/services/PaymentWorker/events/PaymentRequested/examples/index.mdx +191 -0
- package/templates/default/domains/Payments/systems/payment-processing-system/services/PaymentWorker/events/RefundRequested/examples/index.mdx +194 -0
- package/templates/default/domains/Payments/systems/stripe/services/StripeWebhookEndpoint/events/PaymentFailed/examples/index.mdx +265 -0
- package/templates/default/domains/Payments/systems/stripe/services/StripeWebhookEndpoint/events/PaymentSucceeded/examples/index.mdx +190 -0
- package/templates/default/domains/Payments/systems/stripe/services/StripeWebhookEndpoint/events/RefundProcessed/examples/index.mdx +186 -0
- package/templates/default/domains/Reviews/services/RatingAggregator/events/rating-updated/examples/index.mdx +183 -0
- package/templates/default/domains/Reviews/services/ReviewAPI/commands/flag-review/examples/index.mdx +183 -0
- package/templates/default/domains/Reviews/services/ReviewAPI/commands/submit-review/examples/index.mdx +195 -0
- package/templates/default/domains/Reviews/services/ReviewAPI/commands/vote-review-helpful/examples/index.mdx +178 -0
- package/templates/default/domains/Reviews/services/ReviewAPI/events/review-flagged/examples/index.mdx +186 -0
- package/templates/default/domains/Reviews/services/ReviewAPI/events/review-helpful-voted/examples/index.mdx +177 -0
- package/templates/default/domains/Reviews/services/ReviewAPI/events/review-submitted/examples/index.mdx +194 -0
- package/templates/default/domains/Reviews/services/ReviewAPI/queries/get-product-reviews/examples/index.mdx +259 -0
- package/templates/default/domains/Reviews/services/ReviewModerationWorker/events/review-published/examples/index.mdx +183 -0
- package/templates/default/domains/Reviews/services/ReviewModerationWorker/events/review-rejected/examples/index.mdx +178 -0
- package/templates/default/domains/Shopping/systems/cart-system/services/CartAPI/commands/AddItemToCart/examples/index.mdx +171 -0
- package/templates/default/domains/Shopping/systems/cart-system/services/CartAPI/commands/CheckoutCart/examples/index.mdx +168 -0
- package/templates/default/domains/Shopping/systems/cart-system/services/CartAPI/commands/RemoveItemFromCart/examples/index.mdx +170 -0
- package/templates/default/domains/Shopping/systems/cart-system/services/CartAPI/events/CartCheckedOut/examples/index.mdx +275 -0
- package/templates/default/domains/Shopping/systems/promotion-system/services/PromotionService/commands/CalculateDiscount/examples/index.mdx +207 -0
- package/templates/default/domains/Shopping/systems/promotion-system/services/PromotionService/events/DiscountCalculated/examples/index.mdx +190 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
<Columns cols={2}>
|
|
2
|
+
|
|
3
|
+
<Column>
|
|
4
|
+
|
|
5
|
+
## 1. Publish a voucher discount
|
|
6
|
+
|
|
7
|
+
The Promotion Service has applied the `AUTUMN10` voucher to a cart. It publishes `DiscountCalculated` so the Cart System can price the cart and analytics can track voucher use.
|
|
8
|
+
|
|
9
|
+
### Payload details
|
|
10
|
+
|
|
11
|
+
- `eventId` and `occurredAt` identify the event and when the discount was calculated (UTC).
|
|
12
|
+
- `cartId` is the cart the discount applies to.
|
|
13
|
+
- `discount` is 1,000 pence in `GBP`.
|
|
14
|
+
- `appliedPromotions` lists the promotion that was used.
|
|
15
|
+
|
|
16
|
+
The discount is **1,000 pence (£10.00)**, 10% of a 10,000 pence subtotal.
|
|
17
|
+
|
|
18
|
+
### Using this example
|
|
19
|
+
|
|
20
|
+
Check that the cart is priced with a 1,000 pence discount and that analytics records one use of `AUTUMN10`.
|
|
21
|
+
|
|
22
|
+
The examples use a **fictional Acme Events SDK** to publish a payload matching the DiscountCalculated schema. The package names and publish methods are illustrative.
|
|
23
|
+
|
|
24
|
+
</Column>
|
|
25
|
+
|
|
26
|
+
<Column>
|
|
27
|
+
|
|
28
|
+
<CodeGroup dropdown>
|
|
29
|
+
|
|
30
|
+
```typescript publish-discount-calculated.ts
|
|
31
|
+
import { EventsClient } from '@acme/events';
|
|
32
|
+
import type { DiscountCalculated } from './schemas/discount-calculated';
|
|
33
|
+
|
|
34
|
+
const client = new EventsClient({
|
|
35
|
+
apiKey: process.env.ACME_API_KEY!,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const event: DiscountCalculated = {
|
|
39
|
+
eventId: 'b2e8f4a6-7c3d-4b9e-a1f5-3c6d8e0a2b47',
|
|
40
|
+
occurredAt: '2026-09-14T17:30:02Z',
|
|
41
|
+
cartId: 'a7c3e9f1-2b4d-4e6a-8f1c-3d5b7e9a1c24',
|
|
42
|
+
discount: 1000,
|
|
43
|
+
currency: 'GBP',
|
|
44
|
+
appliedPromotions: ['AUTUMN10'],
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
await client.publish('DiscountCalculated', event);
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```python publish_discount_calculated.py
|
|
51
|
+
import os
|
|
52
|
+
from acme_events import EventsClient
|
|
53
|
+
|
|
54
|
+
client = EventsClient(api_key=os.environ["ACME_API_KEY"])
|
|
55
|
+
|
|
56
|
+
event = {
|
|
57
|
+
"eventId": "b2e8f4a6-7c3d-4b9e-a1f5-3c6d8e0a2b47",
|
|
58
|
+
"occurredAt": "2026-09-14T17:30:02Z",
|
|
59
|
+
"cartId": "a7c3e9f1-2b4d-4e6a-8f1c-3d5b7e9a1c24",
|
|
60
|
+
"discount": 1000,
|
|
61
|
+
"currency": "GBP",
|
|
62
|
+
"appliedPromotions": ["AUTUMN10"],
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
client.publish("DiscountCalculated", event)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```java PublishDiscountCalculated.java
|
|
69
|
+
import com.acme.events.EventsClient;
|
|
70
|
+
import java.util.List;
|
|
71
|
+
import java.util.Map;
|
|
72
|
+
|
|
73
|
+
public class PublishDiscountCalculated {
|
|
74
|
+
public static void main(String[] args) {
|
|
75
|
+
var client = new EventsClient(
|
|
76
|
+
System.getenv("ACME_API_KEY")
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
var event = Map.of(
|
|
80
|
+
"eventId", "b2e8f4a6-7c3d-4b9e-a1f5-3c6d8e0a2b47",
|
|
81
|
+
"occurredAt", "2026-09-14T17:30:02Z",
|
|
82
|
+
"cartId", "a7c3e9f1-2b4d-4e6a-8f1c-3d5b7e9a1c24",
|
|
83
|
+
"discount", 1000,
|
|
84
|
+
"currency", "GBP",
|
|
85
|
+
"appliedPromotions", List.of("AUTUMN10")
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
client.publish("DiscountCalculated", event);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
</CodeGroup>
|
|
94
|
+
|
|
95
|
+
</Column>
|
|
96
|
+
|
|
97
|
+
</Columns>
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
<Columns cols={2}>
|
|
102
|
+
|
|
103
|
+
<Column>
|
|
104
|
+
|
|
105
|
+
## 2. Publish a zero discount
|
|
106
|
+
|
|
107
|
+
No promotion applies to a cart of two T-shirts, but the Promotion Service still publishes the result so every checkout has a matching discount record.
|
|
108
|
+
|
|
109
|
+
### Payload details
|
|
110
|
+
|
|
111
|
+
- `cartId` is the cart being priced.
|
|
112
|
+
- `discount` is `0` in `GBP`.
|
|
113
|
+
- `appliedPromotions` is omitted because nothing was applied.
|
|
114
|
+
|
|
115
|
+
### Using this example
|
|
116
|
+
|
|
117
|
+
Check that consumers handle a zero discount and a missing `appliedPromotions` list without errors.
|
|
118
|
+
|
|
119
|
+
The examples use a **fictional Acme Events SDK** to publish a payload matching the DiscountCalculated schema. The package names and publish methods are illustrative.
|
|
120
|
+
|
|
121
|
+
</Column>
|
|
122
|
+
|
|
123
|
+
<Column>
|
|
124
|
+
|
|
125
|
+
<CodeGroup dropdown>
|
|
126
|
+
|
|
127
|
+
```typescript publish-discount-calculated.ts
|
|
128
|
+
import { EventsClient } from '@acme/events';
|
|
129
|
+
import type { DiscountCalculated } from './schemas/discount-calculated';
|
|
130
|
+
|
|
131
|
+
const client = new EventsClient({
|
|
132
|
+
apiKey: process.env.ACME_API_KEY!,
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const event: DiscountCalculated = {
|
|
136
|
+
eventId: 'd9c5a1e7-4f2b-4d8c-9e6a-0b3f7c1d5e89',
|
|
137
|
+
occurredAt: '2026-09-11T08:12:43Z',
|
|
138
|
+
cartId: 'c1d2e3f4-5a6b-4c7d-8e9f-0a1b2c3d4e5f',
|
|
139
|
+
discount: 0,
|
|
140
|
+
currency: 'GBP',
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
await client.publish('DiscountCalculated', event);
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
```python publish_discount_calculated.py
|
|
147
|
+
import os
|
|
148
|
+
from acme_events import EventsClient
|
|
149
|
+
|
|
150
|
+
client = EventsClient(api_key=os.environ["ACME_API_KEY"])
|
|
151
|
+
|
|
152
|
+
event = {
|
|
153
|
+
"eventId": "d9c5a1e7-4f2b-4d8c-9e6a-0b3f7c1d5e89",
|
|
154
|
+
"occurredAt": "2026-09-11T08:12:43Z",
|
|
155
|
+
"cartId": "c1d2e3f4-5a6b-4c7d-8e9f-0a1b2c3d4e5f",
|
|
156
|
+
"discount": 0,
|
|
157
|
+
"currency": "GBP",
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
client.publish("DiscountCalculated", event)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
```java PublishDiscountCalculated.java
|
|
164
|
+
import com.acme.events.EventsClient;
|
|
165
|
+
import java.util.Map;
|
|
166
|
+
|
|
167
|
+
public class PublishDiscountCalculated {
|
|
168
|
+
public static void main(String[] args) {
|
|
169
|
+
var client = new EventsClient(
|
|
170
|
+
System.getenv("ACME_API_KEY")
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
var event = Map.of(
|
|
174
|
+
"eventId", "d9c5a1e7-4f2b-4d8c-9e6a-0b3f7c1d5e89",
|
|
175
|
+
"occurredAt", "2026-09-11T08:12:43Z",
|
|
176
|
+
"cartId", "c1d2e3f4-5a6b-4c7d-8e9f-0a1b2c3d4e5f",
|
|
177
|
+
"discount", 0,
|
|
178
|
+
"currency", "GBP"
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
client.publish("DiscountCalculated", event);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
</CodeGroup>
|
|
187
|
+
|
|
188
|
+
</Column>
|
|
189
|
+
|
|
190
|
+
</Columns>
|