@eventcatalog/create-eventcatalog 4.3.12 → 4.3.14-beta.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.
Files changed (72) hide show
  1. package/LICENSE +0 -10
  2. package/dist/index.js +1 -1
  3. package/package.json +1 -1
  4. package/templates/amazon-api-gateway/README-template.md +4 -0
  5. package/templates/asyncapi/README-template.md +4 -0
  6. package/templates/asyncapi/env +0 -5
  7. package/templates/confluent/README-template.md +4 -0
  8. package/templates/default/README-template.md +4 -0
  9. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/commands/CreateProduct/examples/index.mdx +194 -0
  10. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/commands/DeleteProduct/examples/index.mdx +161 -0
  11. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/commands/UpdateProduct/examples/index.mdx +182 -0
  12. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/events/ProductCreated/examples/index.mdx +227 -0
  13. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/events/ProductDeleted/examples/index.mdx +175 -0
  14. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/events/ProductUpdated/examples/index.mdx +205 -0
  15. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/queries/GetProduct/examples/index.mdx +205 -0
  16. package/templates/default/domains/Catalog/systems/search-system/services/SearchAPI/queries/SearchProducts/examples/index.mdx +369 -0
  17. package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/commands/RegisterCustomer/examples/index.mdx +168 -0
  18. package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/commands/UpdateCustomer/examples/index.mdx +168 -0
  19. package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/events/CustomerRegistered/examples/index.mdx +201 -0
  20. package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/events/CustomerUpdated/examples/index.mdx +194 -0
  21. package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/queries/GetCustomer/examples/index.mdx +194 -0
  22. package/templates/default/domains/Customer/systems/identity-provider/services/OAuthAPI/commands/AuthenticateCustomer/examples/index.mdx +198 -0
  23. package/templates/default/domains/Customer/systems/identity-provider/services/OAuthAPI/events/CustomerAuthenticated/examples/index.mdx +276 -0
  24. package/templates/default/domains/Fulfilment/systems/carrier/services/CarrierTrackingAPI/events/ShipmentCreated/examples/index.mdx +184 -0
  25. package/templates/default/domains/Fulfilment/systems/carrier/services/CarrierTrackingAPI/events/ShipmentDelivered/examples/index.mdx +173 -0
  26. package/templates/default/domains/Fulfilment/systems/carrier/services/CarrierTrackingAPI/events/ShipmentFailed/examples/index.mdx +265 -0
  27. package/templates/default/domains/Fulfilment/systems/inventory-system/services/InventoryService/commands/ReleaseInventory/examples/index.mdx +246 -0
  28. package/templates/default/domains/Fulfilment/systems/inventory-system/services/InventoryService/events/InventoryReserved/examples/index.mdx +227 -0
  29. package/templates/default/domains/Fulfilment/systems/inventory-system/services/InventoryService/events/InventoryUnavailable/examples/index.mdx +229 -0
  30. package/templates/default/domains/Fulfilment/systems/inventory-system/services/InventoryService/queries/GetStockLevel/examples/index.mdx +186 -0
  31. package/templates/default/domains/Fulfilment/systems/shipping-system/services/CarrierAdapter/commands/CreateShipment/examples/index.mdx +206 -0
  32. package/templates/default/domains/Fulfilment/systems/warehouse-system/services/PickingWorker/events/OrderPacked/examples/index.mdx +172 -0
  33. package/templates/default/domains/Fulfilment/systems/warehouse-system/services/WarehouseService/events/OrderReadyForShipping/examples/index.mdx +208 -0
  34. package/templates/default/domains/Ordering/systems/checkout-system/services/CheckoutOrchestrator/commands/AuthorizePayment/examples/index.mdx +179 -0
  35. package/templates/default/domains/Ordering/systems/checkout-system/services/CheckoutOrchestrator/commands/ReserveInventory/examples/index.mdx +215 -0
  36. package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/commands/CancelOrder/examples/index.mdx +163 -0
  37. package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/commands/CreateOrder/examples/index.mdx +246 -0
  38. package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/events/OrderCancelled/examples/index.mdx +267 -0
  39. package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/events/OrderCompleted/examples/index.mdx +171 -0
  40. package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/events/OrderCreated/examples/index.mdx +190 -0
  41. package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/queries/GetOrder/examples/index.mdx +343 -0
  42. package/templates/default/domains/Payments/systems/fraud-detection/services/FraudAPI/events/FraudCheckFailed/examples/index.mdx +271 -0
  43. package/templates/default/domains/Payments/systems/fraud-detection/services/FraudAPI/events/FraudCheckPassed/examples/index.mdx +173 -0
  44. package/templates/default/domains/Payments/systems/payment-processing-system/services/PaymentWorker/events/PaymentRequested/examples/index.mdx +191 -0
  45. package/templates/default/domains/Payments/systems/payment-processing-system/services/PaymentWorker/events/RefundRequested/examples/index.mdx +194 -0
  46. package/templates/default/domains/Payments/systems/stripe/services/StripeWebhookEndpoint/events/PaymentFailed/examples/index.mdx +265 -0
  47. package/templates/default/domains/Payments/systems/stripe/services/StripeWebhookEndpoint/events/PaymentSucceeded/examples/index.mdx +190 -0
  48. package/templates/default/domains/Payments/systems/stripe/services/StripeWebhookEndpoint/events/RefundProcessed/examples/index.mdx +186 -0
  49. package/templates/default/domains/Reviews/services/RatingAggregator/events/rating-updated/examples/index.mdx +183 -0
  50. package/templates/default/domains/Reviews/services/ReviewAPI/commands/flag-review/examples/index.mdx +183 -0
  51. package/templates/default/domains/Reviews/services/ReviewAPI/commands/submit-review/examples/index.mdx +195 -0
  52. package/templates/default/domains/Reviews/services/ReviewAPI/commands/vote-review-helpful/examples/index.mdx +178 -0
  53. package/templates/default/domains/Reviews/services/ReviewAPI/events/review-flagged/examples/index.mdx +186 -0
  54. package/templates/default/domains/Reviews/services/ReviewAPI/events/review-helpful-voted/examples/index.mdx +177 -0
  55. package/templates/default/domains/Reviews/services/ReviewAPI/events/review-submitted/examples/index.mdx +194 -0
  56. package/templates/default/domains/Reviews/services/ReviewAPI/queries/get-product-reviews/examples/index.mdx +259 -0
  57. package/templates/default/domains/Reviews/services/ReviewModerationWorker/events/review-published/examples/index.mdx +183 -0
  58. package/templates/default/domains/Reviews/services/ReviewModerationWorker/events/review-rejected/examples/index.mdx +178 -0
  59. package/templates/default/domains/Shopping/systems/cart-system/services/CartAPI/commands/AddItemToCart/examples/index.mdx +171 -0
  60. package/templates/default/domains/Shopping/systems/cart-system/services/CartAPI/commands/CheckoutCart/examples/index.mdx +168 -0
  61. package/templates/default/domains/Shopping/systems/cart-system/services/CartAPI/commands/RemoveItemFromCart/examples/index.mdx +170 -0
  62. package/templates/default/domains/Shopping/systems/cart-system/services/CartAPI/events/CartCheckedOut/examples/index.mdx +275 -0
  63. package/templates/default/domains/Shopping/systems/promotion-system/services/PromotionService/commands/CalculateDiscount/examples/index.mdx +207 -0
  64. package/templates/default/domains/Shopping/systems/promotion-system/services/PromotionService/events/DiscountCalculated/examples/index.mdx +190 -0
  65. package/templates/default/env +0 -5
  66. package/templates/empty/README-template.md +4 -0
  67. package/templates/empty/env +0 -5
  68. package/templates/eventbridge/README-template.md +4 -0
  69. package/templates/graphql/README-template.md +4 -0
  70. package/templates/graphql/env +0 -5
  71. package/templates/openapi/README-template.md +4 -0
  72. package/templates/openapi/env +0 -5
@@ -0,0 +1,276 @@
1
+ <Columns cols={2}>
2
+
3
+ <Column>
4
+
5
+ ## 1. Publish a password sign-in
6
+
7
+ A customer signed in on the web storefront with their email and password. The OAuth API publishes this event so auditing and security monitoring can record the sign-in.
8
+
9
+ ### Payload details
10
+
11
+ - `eventId` is a unique UUID for this event, and `occurredAt` is the ISO-8601 UTC time of the sign-in.
12
+ - `customerId` identifies the customer who signed in.
13
+ - `method` is `PASSWORD`, meaning the customer used their email and password.
14
+ - `ipAddress` is the IPv4 address the sign-in came from.
15
+
16
+ ### Using this example
17
+
18
+ Use this to check that audit consumers store the `method` and `ipAddress`, and that security monitoring can compare the address with the customer's usual locations.
19
+
20
+ The examples use a **fictional Acme Events SDK** to publish a payload matching the CustomerAuthenticated schema. The package names and publish methods are illustrative.
21
+
22
+ </Column>
23
+
24
+ <Column>
25
+
26
+ <CodeGroup dropdown>
27
+
28
+ ```typescript publish-customer-authenticated.ts
29
+ import { EventsClient } from '@acme/events';
30
+ import type { CustomerAuthenticated } from './schemas/customer-authenticated';
31
+
32
+ const client = new EventsClient({
33
+ apiKey: process.env.ACME_API_KEY!,
34
+ });
35
+
36
+ const event: CustomerAuthenticated = {
37
+ eventId: '0d2f4b6a-8c1e-4a3b-9d5f-7e9a1c3b5d48',
38
+ occurredAt: '2026-09-18T19:41:07Z',
39
+ customerId: '3f2b8c1e-7a4d-4e9b-9c21-5d8e6f0a1b2c',
40
+ method: 'PASSWORD',
41
+ ipAddress: '203.0.113.24',
42
+ };
43
+
44
+ await client.publish('CustomerAuthenticated', event);
45
+ ```
46
+
47
+ ```python publish_customer_authenticated.py
48
+ import os
49
+ from acme_events import EventsClient
50
+
51
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
52
+
53
+ event = {
54
+ "eventId": "0d2f4b6a-8c1e-4a3b-9d5f-7e9a1c3b5d48",
55
+ "occurredAt": "2026-09-18T19:41:07Z",
56
+ "customerId": "3f2b8c1e-7a4d-4e9b-9c21-5d8e6f0a1b2c",
57
+ "method": "PASSWORD",
58
+ "ipAddress": "203.0.113.24",
59
+ }
60
+
61
+ client.publish("CustomerAuthenticated", event)
62
+ ```
63
+
64
+ ```java PublishCustomerAuthenticated.java
65
+ import com.acme.events.EventsClient;
66
+ import java.util.Map;
67
+
68
+ public class PublishCustomerAuthenticated {
69
+ public static void main(String[] args) {
70
+ var client = new EventsClient(
71
+ System.getenv("ACME_API_KEY")
72
+ );
73
+
74
+ var event = Map.of(
75
+ "eventId", "0d2f4b6a-8c1e-4a3b-9d5f-7e9a1c3b5d48",
76
+ "occurredAt", "2026-09-18T19:41:07Z",
77
+ "customerId", "3f2b8c1e-7a4d-4e9b-9c21-5d8e6f0a1b2c",
78
+ "method", "PASSWORD",
79
+ "ipAddress", "203.0.113.24"
80
+ );
81
+
82
+ client.publish("CustomerAuthenticated", event);
83
+ }
84
+ }
85
+ ```
86
+
87
+ </CodeGroup>
88
+
89
+ </Column>
90
+
91
+ </Columns>
92
+
93
+ ---
94
+
95
+ <Columns cols={2}>
96
+
97
+ <Column>
98
+
99
+ ## 2. Publish a single sign-on sign-in
100
+
101
+ A customer signed in through a third-party single sign-on provider. The sign-in was relayed by the provider, so the OAuth API has no client IP address to report.
102
+
103
+ ### Payload details
104
+
105
+ - `eventId` and `occurredAt` identify this event and when the sign-in happened.
106
+ - `customerId` identifies the customer who signed in.
107
+ - `method` is `SSO`.
108
+ - `ipAddress` is optional and is omitted here.
109
+
110
+ ### Using this example
111
+
112
+ Use this to check that consumers accept an event with no `ipAddress` and still record the sign-in against the customer.
113
+
114
+ The examples use a **fictional Acme Events SDK** to publish a payload matching the CustomerAuthenticated schema. The package names and publish methods are illustrative.
115
+
116
+ </Column>
117
+
118
+ <Column>
119
+
120
+ <CodeGroup dropdown>
121
+
122
+ ```typescript publish-customer-authenticated.ts
123
+ import { EventsClient } from '@acme/events';
124
+ import type { CustomerAuthenticated } from './schemas/customer-authenticated';
125
+
126
+ const client = new EventsClient({
127
+ apiKey: process.env.ACME_API_KEY!,
128
+ });
129
+
130
+ const event: CustomerAuthenticated = {
131
+ eventId: 'b8d0f2a4-6e8c-4b1d-a3f5-0c2e4a6b8d59',
132
+ occurredAt: '2026-09-20T07:15:52Z',
133
+ customerId: 'c9a4e2f7-1b3d-4c8e-a5f6-7d2e9b0c4a13',
134
+ method: 'SSO',
135
+ };
136
+
137
+ await client.publish('CustomerAuthenticated', event);
138
+ ```
139
+
140
+ ```python publish_customer_authenticated.py
141
+ import os
142
+ from acme_events import EventsClient
143
+
144
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
145
+
146
+ event = {
147
+ "eventId": "b8d0f2a4-6e8c-4b1d-a3f5-0c2e4a6b8d59",
148
+ "occurredAt": "2026-09-20T07:15:52Z",
149
+ "customerId": "c9a4e2f7-1b3d-4c8e-a5f6-7d2e9b0c4a13",
150
+ "method": "SSO",
151
+ }
152
+
153
+ client.publish("CustomerAuthenticated", event)
154
+ ```
155
+
156
+ ```java PublishCustomerAuthenticated.java
157
+ import com.acme.events.EventsClient;
158
+ import java.util.Map;
159
+
160
+ public class PublishCustomerAuthenticated {
161
+ public static void main(String[] args) {
162
+ var client = new EventsClient(
163
+ System.getenv("ACME_API_KEY")
164
+ );
165
+
166
+ var event = Map.of(
167
+ "eventId", "b8d0f2a4-6e8c-4b1d-a3f5-0c2e4a6b8d59",
168
+ "occurredAt", "2026-09-20T07:15:52Z",
169
+ "customerId", "c9a4e2f7-1b3d-4c8e-a5f6-7d2e9b0c4a13",
170
+ "method", "SSO"
171
+ );
172
+
173
+ client.publish("CustomerAuthenticated", event);
174
+ }
175
+ }
176
+ ```
177
+
178
+ </CodeGroup>
179
+
180
+ </Column>
181
+
182
+ </Columns>
183
+
184
+ ---
185
+
186
+ <Columns cols={2}>
187
+
188
+ <Column>
189
+
190
+ ## 3. Publish a multi-factor sign-in
191
+
192
+ A customer signed in from a new phone and completed a one-time code challenge. Security monitoring treats multi-factor sign-ins from new devices as lower risk than a password alone.
193
+
194
+ ### Payload details
195
+
196
+ - `eventId` and `occurredAt` identify this event and when the sign-in happened.
197
+ - `customerId` is the same customer as in example 1.
198
+ - `method` is `MFA`, meaning a second factor was verified as well as the password.
199
+ - `ipAddress` is an IPv6 address, which the schema accepts as a plain string.
200
+
201
+ ### Using this example
202
+
203
+ Use this to check that consumers handle every `method` value (`PASSWORD`, `SSO` and `MFA`) and store IPv6 addresses without truncating them.
204
+
205
+ The examples use a **fictional Acme Events SDK** to publish a payload matching the CustomerAuthenticated schema. The package names and publish methods are illustrative.
206
+
207
+ </Column>
208
+
209
+ <Column>
210
+
211
+ <CodeGroup dropdown>
212
+
213
+ ```typescript publish-customer-authenticated.ts
214
+ import { EventsClient } from '@acme/events';
215
+ import type { CustomerAuthenticated } from './schemas/customer-authenticated';
216
+
217
+ const client = new EventsClient({
218
+ apiKey: process.env.ACME_API_KEY!,
219
+ });
220
+
221
+ const event: CustomerAuthenticated = {
222
+ eventId: '2a4c6e8f-0b1d-4c3e-8f5a-7b9d1e3f5a60',
223
+ occurredAt: '2026-09-21T12:30:44Z',
224
+ customerId: '3f2b8c1e-7a4d-4e9b-9c21-5d8e6f0a1b2c',
225
+ method: 'MFA',
226
+ ipAddress: '2001:db8:85a3::8a2e:370:7334',
227
+ };
228
+
229
+ await client.publish('CustomerAuthenticated', event);
230
+ ```
231
+
232
+ ```python publish_customer_authenticated.py
233
+ import os
234
+ from acme_events import EventsClient
235
+
236
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
237
+
238
+ event = {
239
+ "eventId": "2a4c6e8f-0b1d-4c3e-8f5a-7b9d1e3f5a60",
240
+ "occurredAt": "2026-09-21T12:30:44Z",
241
+ "customerId": "3f2b8c1e-7a4d-4e9b-9c21-5d8e6f0a1b2c",
242
+ "method": "MFA",
243
+ "ipAddress": "2001:db8:85a3::8a2e:370:7334",
244
+ }
245
+
246
+ client.publish("CustomerAuthenticated", event)
247
+ ```
248
+
249
+ ```java PublishCustomerAuthenticated.java
250
+ import com.acme.events.EventsClient;
251
+ import java.util.Map;
252
+
253
+ public class PublishCustomerAuthenticated {
254
+ public static void main(String[] args) {
255
+ var client = new EventsClient(
256
+ System.getenv("ACME_API_KEY")
257
+ );
258
+
259
+ var event = Map.of(
260
+ "eventId", "2a4c6e8f-0b1d-4c3e-8f5a-7b9d1e3f5a60",
261
+ "occurredAt", "2026-09-21T12:30:44Z",
262
+ "customerId", "3f2b8c1e-7a4d-4e9b-9c21-5d8e6f0a1b2c",
263
+ "method", "MFA",
264
+ "ipAddress", "2001:db8:85a3::8a2e:370:7334"
265
+ );
266
+
267
+ client.publish("CustomerAuthenticated", event);
268
+ }
269
+ }
270
+ ```
271
+
272
+ </CodeGroup>
273
+
274
+ </Column>
275
+
276
+ </Columns>
@@ -0,0 +1,184 @@
1
+ <Columns cols={2}>
2
+
3
+ <Column>
4
+
5
+ ## 1. Publish a shipment with a delivery estimate
6
+
7
+ The Carrier Tracking API publishes this event after it accepts a `CreateShipment` command. Acme Inc consumes it to send the customer a tracking number and an expected delivery date.
8
+
9
+ ### Payload details
10
+
11
+ - `shipmentId` is the carrier's ID for the shipment; `orderId` links it to the order.
12
+ - `trackingNumber` is the number the customer uses on the carrier's tracking page.
13
+ - `carrier` is `Royal Mail`.
14
+ - `estimatedDelivery` is a calendar date (`YYYY-MM-DD`), not a timestamp.
15
+ - `createdAt` is the UTC time the carrier created the shipment.
16
+
17
+ ### Using this example
18
+
19
+ A consumer should store the tracking number against the order and show `estimatedDelivery` in the dispatch email.
20
+
21
+ The examples use a **fictional Acme Events SDK** to publish a payload matching the ShipmentCreated schema. The package names and publish methods are illustrative.
22
+
23
+ </Column>
24
+
25
+ <Column>
26
+
27
+ <CodeGroup dropdown>
28
+
29
+ ```typescript publish-shipment-created.ts
30
+ import { EventsClient } from '@acme/events';
31
+ import type { ShipmentCreated } from './schemas/shipment-created';
32
+
33
+ const client = new EventsClient({
34
+ apiKey: process.env.ACME_API_KEY!,
35
+ });
36
+
37
+ const event: ShipmentCreated = {
38
+ shipmentId: '1d7f4a9c-2e8b-4b5d-9a3c-6e0f8b2d4c79',
39
+ orderId: '3f2b8c1e-7a4d-4e9b-9c21-5d8e6f0a1b27',
40
+ trackingNumber: 'RM482913765GB',
41
+ carrier: 'Royal Mail',
42
+ estimatedDelivery: '2026-09-15',
43
+ createdAt: '2026-09-14T10:05:33Z',
44
+ };
45
+
46
+ await client.publish('ShipmentCreated', event);
47
+ ```
48
+
49
+ ```python publish_shipment_created.py
50
+ import os
51
+ from acme_events import EventsClient
52
+
53
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
54
+
55
+ event = {
56
+ "shipmentId": "1d7f4a9c-2e8b-4b5d-9a3c-6e0f8b2d4c79",
57
+ "orderId": "3f2b8c1e-7a4d-4e9b-9c21-5d8e6f0a1b27",
58
+ "trackingNumber": "RM482913765GB",
59
+ "carrier": "Royal Mail",
60
+ "estimatedDelivery": "2026-09-15",
61
+ "createdAt": "2026-09-14T10:05:33Z",
62
+ }
63
+
64
+ client.publish("ShipmentCreated", event)
65
+ ```
66
+
67
+ ```java PublishShipmentCreated.java
68
+ import com.acme.events.EventsClient;
69
+ import java.util.Map;
70
+
71
+ public class PublishShipmentCreated {
72
+ public static void main(String[] args) {
73
+ var client = new EventsClient(
74
+ System.getenv("ACME_API_KEY")
75
+ );
76
+
77
+ var event = Map.of(
78
+ "shipmentId", "1d7f4a9c-2e8b-4b5d-9a3c-6e0f8b2d4c79",
79
+ "orderId", "3f2b8c1e-7a4d-4e9b-9c21-5d8e6f0a1b27",
80
+ "trackingNumber", "RM482913765GB",
81
+ "carrier", "Royal Mail",
82
+ "estimatedDelivery", "2026-09-15",
83
+ "createdAt", "2026-09-14T10:05:33Z"
84
+ );
85
+
86
+ client.publish("ShipmentCreated", event);
87
+ }
88
+ }
89
+ ```
90
+
91
+ </CodeGroup>
92
+
93
+ </Column>
94
+
95
+ </Columns>
96
+
97
+ ---
98
+
99
+ <Columns cols={2}>
100
+
101
+ <Column>
102
+
103
+ ## 2. Publish a shipment with only the required fields
104
+
105
+ Some carriers do not return a carrier name or a delivery estimate when they create a shipment. The event then carries only the IDs, the tracking number and the time.
106
+
107
+ ### Payload details
108
+
109
+ - `shipmentId`, `orderId`, `trackingNumber` and `createdAt` are the only required fields.
110
+ - `carrier` and `estimatedDelivery` are omitted, not set to null.
111
+
112
+ ### Using this example
113
+
114
+ Use this payload to check that the dispatch email still sends when there is no `estimatedDelivery` to show.
115
+
116
+ The examples use a **fictional Acme Events SDK** to publish a payload matching the ShipmentCreated schema. The package names and publish methods are illustrative.
117
+
118
+ </Column>
119
+
120
+ <Column>
121
+
122
+ <CodeGroup dropdown>
123
+
124
+ ```typescript publish-shipment-created.ts
125
+ import { EventsClient } from '@acme/events';
126
+ import type { ShipmentCreated } from './schemas/shipment-created';
127
+
128
+ const client = new EventsClient({
129
+ apiKey: process.env.ACME_API_KEY!,
130
+ });
131
+
132
+ const event: ShipmentCreated = {
133
+ shipmentId: '9a2c6e8f-4b1d-4d7a-8e5c-3f9b0a6d2e14',
134
+ orderId: 'c7e41d92-5b3a-4f86-a1d4-8e2f9b6c0d53',
135
+ trackingNumber: 'JD0146000062518374',
136
+ createdAt: '2026-09-14T11:41:09Z',
137
+ };
138
+
139
+ await client.publish('ShipmentCreated', event);
140
+ ```
141
+
142
+ ```python publish_shipment_created.py
143
+ import os
144
+ from acme_events import EventsClient
145
+
146
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
147
+
148
+ event = {
149
+ "shipmentId": "9a2c6e8f-4b1d-4d7a-8e5c-3f9b0a6d2e14",
150
+ "orderId": "c7e41d92-5b3a-4f86-a1d4-8e2f9b6c0d53",
151
+ "trackingNumber": "JD0146000062518374",
152
+ "createdAt": "2026-09-14T11:41:09Z",
153
+ }
154
+
155
+ client.publish("ShipmentCreated", event)
156
+ ```
157
+
158
+ ```java PublishShipmentCreated.java
159
+ import com.acme.events.EventsClient;
160
+ import java.util.Map;
161
+
162
+ public class PublishShipmentCreated {
163
+ public static void main(String[] args) {
164
+ var client = new EventsClient(
165
+ System.getenv("ACME_API_KEY")
166
+ );
167
+
168
+ var event = Map.of(
169
+ "shipmentId", "9a2c6e8f-4b1d-4d7a-8e5c-3f9b0a6d2e14",
170
+ "orderId", "c7e41d92-5b3a-4f86-a1d4-8e2f9b6c0d53",
171
+ "trackingNumber", "JD0146000062518374",
172
+ "createdAt", "2026-09-14T11:41:09Z"
173
+ );
174
+
175
+ client.publish("ShipmentCreated", event);
176
+ }
177
+ }
178
+ ```
179
+
180
+ </CodeGroup>
181
+
182
+ </Column>
183
+
184
+ </Columns>
@@ -0,0 +1,173 @@
1
+ <Columns cols={2}>
2
+
3
+ <Column>
4
+
5
+ ## 1. Publish a signed-for delivery
6
+
7
+ The Carrier Tracking API publishes this event when the driver hands the parcel to the customer and captures a signature. Acme Inc consumes it to close the order and ask for feedback.
8
+
9
+ ### Payload details
10
+
11
+ - `shipmentId` and `orderId` link the delivery to the shipment and the order.
12
+ - `deliveredAt` is the UTC time of the delivery scan.
13
+ - `signedBy` is the name the driver captured at the door.
14
+
15
+ ### Using this example
16
+
17
+ A consumer should mark the order as delivered and can show `signedBy` on the order history page.
18
+
19
+ The examples use a **fictional Acme Events SDK** to publish a payload matching the ShipmentDelivered schema. The package names and publish methods are illustrative.
20
+
21
+ </Column>
22
+
23
+ <Column>
24
+
25
+ <CodeGroup dropdown>
26
+
27
+ ```typescript publish-shipment-delivered.ts
28
+ import { EventsClient } from '@acme/events';
29
+ import type { ShipmentDelivered } from './schemas/shipment-delivered';
30
+
31
+ const client = new EventsClient({
32
+ apiKey: process.env.ACME_API_KEY!,
33
+ });
34
+
35
+ const event: ShipmentDelivered = {
36
+ shipmentId: '1d7f4a9c-2e8b-4b5d-9a3c-6e0f8b2d4c79',
37
+ orderId: '3f2b8c1e-7a4d-4e9b-9c21-5d8e6f0a1b27',
38
+ deliveredAt: '2026-09-15T13:26:41Z',
39
+ signedBy: 'Priya Shah',
40
+ };
41
+
42
+ await client.publish('ShipmentDelivered', event);
43
+ ```
44
+
45
+ ```python publish_shipment_delivered.py
46
+ import os
47
+ from acme_events import EventsClient
48
+
49
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
50
+
51
+ event = {
52
+ "shipmentId": "1d7f4a9c-2e8b-4b5d-9a3c-6e0f8b2d4c79",
53
+ "orderId": "3f2b8c1e-7a4d-4e9b-9c21-5d8e6f0a1b27",
54
+ "deliveredAt": "2026-09-15T13:26:41Z",
55
+ "signedBy": "Priya Shah",
56
+ }
57
+
58
+ client.publish("ShipmentDelivered", event)
59
+ ```
60
+
61
+ ```java PublishShipmentDelivered.java
62
+ import com.acme.events.EventsClient;
63
+ import java.util.Map;
64
+
65
+ public class PublishShipmentDelivered {
66
+ public static void main(String[] args) {
67
+ var client = new EventsClient(
68
+ System.getenv("ACME_API_KEY")
69
+ );
70
+
71
+ var event = Map.of(
72
+ "shipmentId", "1d7f4a9c-2e8b-4b5d-9a3c-6e0f8b2d4c79",
73
+ "orderId", "3f2b8c1e-7a4d-4e9b-9c21-5d8e6f0a1b27",
74
+ "deliveredAt", "2026-09-15T13:26:41Z",
75
+ "signedBy", "Priya Shah"
76
+ );
77
+
78
+ client.publish("ShipmentDelivered", event);
79
+ }
80
+ }
81
+ ```
82
+
83
+ </CodeGroup>
84
+
85
+ </Column>
86
+
87
+ </Columns>
88
+
89
+ ---
90
+
91
+ <Columns cols={2}>
92
+
93
+ <Column>
94
+
95
+ ## 2. Publish a delivery left without a signature
96
+
97
+ When a parcel goes through the letterbox or is left in a safe place, no signature is captured. The event then has only the required fields.
98
+
99
+ ### Payload details
100
+
101
+ - `shipmentId`, `orderId` and `deliveredAt` are the only required fields.
102
+ - `signedBy` is omitted, not set to null or an empty string.
103
+
104
+ ### Using this example
105
+
106
+ Use this payload to check that consumers close the order without a `signedBy` value and do not show an empty name to the customer.
107
+
108
+ The examples use a **fictional Acme Events SDK** to publish a payload matching the ShipmentDelivered schema. The package names and publish methods are illustrative.
109
+
110
+ </Column>
111
+
112
+ <Column>
113
+
114
+ <CodeGroup dropdown>
115
+
116
+ ```typescript publish-shipment-delivered.ts
117
+ import { EventsClient } from '@acme/events';
118
+ import type { ShipmentDelivered } from './schemas/shipment-delivered';
119
+
120
+ const client = new EventsClient({
121
+ apiKey: process.env.ACME_API_KEY!,
122
+ });
123
+
124
+ const event: ShipmentDelivered = {
125
+ shipmentId: '9a2c6e8f-4b1d-4d7a-8e5c-3f9b0a6d2e14',
126
+ orderId: 'c7e41d92-5b3a-4f86-a1d4-8e2f9b6c0d53',
127
+ deliveredAt: '2026-09-16T10:04:55Z',
128
+ };
129
+
130
+ await client.publish('ShipmentDelivered', event);
131
+ ```
132
+
133
+ ```python publish_shipment_delivered.py
134
+ import os
135
+ from acme_events import EventsClient
136
+
137
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
138
+
139
+ event = {
140
+ "shipmentId": "9a2c6e8f-4b1d-4d7a-8e5c-3f9b0a6d2e14",
141
+ "orderId": "c7e41d92-5b3a-4f86-a1d4-8e2f9b6c0d53",
142
+ "deliveredAt": "2026-09-16T10:04:55Z",
143
+ }
144
+
145
+ client.publish("ShipmentDelivered", event)
146
+ ```
147
+
148
+ ```java PublishShipmentDelivered.java
149
+ import com.acme.events.EventsClient;
150
+ import java.util.Map;
151
+
152
+ public class PublishShipmentDelivered {
153
+ public static void main(String[] args) {
154
+ var client = new EventsClient(
155
+ System.getenv("ACME_API_KEY")
156
+ );
157
+
158
+ var event = Map.of(
159
+ "shipmentId", "9a2c6e8f-4b1d-4d7a-8e5c-3f9b0a6d2e14",
160
+ "orderId", "c7e41d92-5b3a-4f86-a1d4-8e2f9b6c0d53",
161
+ "deliveredAt", "2026-09-16T10:04:55Z"
162
+ );
163
+
164
+ client.publish("ShipmentDelivered", event);
165
+ }
166
+ }
167
+ ```
168
+
169
+ </CodeGroup>
170
+
171
+ </Column>
172
+
173
+ </Columns>