@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
package/LICENSE CHANGED
@@ -19,13 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
-
23
- ---
24
-
25
- Note: Source code within the following directories is licensed under the
26
- EventCatalog Commercial License and is NOT covered by the MIT License above:
27
-
28
- - `packages/core/eventcatalog/src/enterprise/`
29
- - `packages/core/src/federation/`
30
-
31
- See the `LICENSE` file in each directory for the full terms.
package/dist/index.js CHANGED
@@ -29835,7 +29835,7 @@ var import_os2 = __toESM(require("os"));
29835
29835
  var package_default = {
29836
29836
  name: "@eventcatalog/create-eventcatalog",
29837
29837
  description: "Create EventCatalog with one command",
29838
- version: "4.3.12",
29838
+ version: "4.3.14-beta.0",
29839
29839
  license: "MIT",
29840
29840
  bin: {
29841
29841
  "create-catalog": "./dist/index.js"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eventcatalog/create-eventcatalog",
3
3
  "description": "Create EventCatalog with one command",
4
- "version": "4.3.12",
4
+ "version": "4.3.14-beta.0",
5
5
  "license": "MIT",
6
6
  "bin": {
7
7
  "create-catalog": "./dist/index.js"
@@ -52,3 +52,7 @@ EventCatalog gives AI tools structured context about your domains, services, mes
52
52
  ## Found a Problem?
53
53
 
54
54
  Open an issue on [GitHub](https://github.com/event-catalog/generators).
55
+
56
+ ## License
57
+
58
+ This catalog is built with [EventCatalog](https://www.eventcatalog.dev). EventCatalog 5.0.0 and later is licensed under the [Business Source License 1.1](https://github.com/event-catalog/eventcatalog/blob/main/LICENSE), which covers production use of EventCatalog itself. Your catalog's content (your documentation, schemas and configuration) is yours. See the [license FAQ](https://www.eventcatalog.dev/license-faq) for what's included.
@@ -61,3 +61,7 @@ npx skills add event-catalog/skills
61
61
  ## Found a Problem?
62
62
 
63
63
  Open an issue on [GitHub](https://github.com/event-catalog/eventcatalog/issues).
64
+
65
+ ## License
66
+
67
+ This catalog is built with [EventCatalog](https://www.eventcatalog.dev). EventCatalog 5.0.0 and later is licensed under the [Business Source License 1.1](https://github.com/event-catalog/eventcatalog/blob/main/LICENSE), which covers production use of EventCatalog itself. Your catalog's content (your documentation, schemas and configuration) is yours. See the [license FAQ](https://www.eventcatalog.dev/license-faq) for what's included.
@@ -1,8 +1,3 @@
1
- # EventCatalog Scale License Key, if you want to unlock the scale features
2
- # You can get a 14 day trial license key from https://eventcatalog.cloud
3
-
4
- EVENTCATALOG_SCALE_LICENSE_KEY=
5
-
6
1
  # Optional key if you are using EventCatalog Chat with OpenAI Models.
7
2
  # You need to set `output` to `server` in your eventcatalog.config.js file.
8
3
  # See documentation for more details: https://www.eventcatalog.dev/features/ai-assistant
@@ -53,3 +53,7 @@ EventCatalog gives AI tools structured context about your domains, services, mes
53
53
  ## Found a Problem?
54
54
 
55
55
  Open an issue on [GitHub](https://github.com/event-catalog/generators).
56
+
57
+ ## License
58
+
59
+ This catalog is built with [EventCatalog](https://www.eventcatalog.dev). EventCatalog 5.0.0 and later is licensed under the [Business Source License 1.1](https://github.com/event-catalog/eventcatalog/blob/main/LICENSE), which covers production use of EventCatalog itself. Your catalog's content (your documentation, schemas and configuration) is yours. See the [license FAQ](https://www.eventcatalog.dev/license-faq) for what's included.
@@ -62,3 +62,7 @@ npx skills add event-catalog/skills
62
62
  ## Found a Problem?
63
63
 
64
64
  Open an issue on [GitHub](https://github.com/event-catalog/eventcatalog/issues).
65
+
66
+ ## License
67
+
68
+ This catalog is built with [EventCatalog](https://www.eventcatalog.dev). EventCatalog 5.0.0 and later is licensed under the [Business Source License 1.1](https://github.com/event-catalog/eventcatalog/blob/main/LICENSE), which covers production use of EventCatalog itself. Your catalog's content (your documentation, schemas and configuration) is yours. See the [license FAQ](https://www.eventcatalog.dev/license-faq) for what's included.
@@ -0,0 +1,194 @@
1
+ <Columns cols={2}>
2
+
3
+ <Column>
4
+
5
+ ## 1. Create a draft product with required fields only
6
+
7
+ A merchandiser adds a new cap to the catalog with only the fields the Product API needs. Because `status` is left out, the product is stored as a draft and the Product API publishes a ProductCreated event.
8
+
9
+ ### Payload details
10
+
11
+ - `sku` is `CAP-LOGO-NVY`. It must be unique across the catalog; a clash returns `409`.
12
+ - `name` is the display name shown to shoppers.
13
+ - `price` is `1499` in minor units, with `currency` set to `GBP`.
14
+ - `status` is omitted, so the Product API defaults it to `DRAFT`.
15
+ - `description` and `category` are optional and can be added later with UpdateProduct.
16
+
17
+ The price is **1,499 pence (£14.99)**.
18
+
19
+ ### Using this example
20
+
21
+ A handler should accept this command, default the status to `DRAFT`, return `201` and publish a ProductCreated event whose `product.status` is `DRAFT`.
22
+
23
+ The examples use a **fictional Acme Events SDK** to send a payload matching the CreateProduct schema. The package names and send methods are illustrative.
24
+
25
+ </Column>
26
+
27
+ <Column>
28
+
29
+ <CodeGroup dropdown>
30
+
31
+ ```typescript send-create-product.ts
32
+ import { EventsClient } from '@acme/events';
33
+ import type { CreateProduct } from './schemas/create-product';
34
+
35
+ const client = new EventsClient({
36
+ apiKey: process.env.ACME_API_KEY!,
37
+ });
38
+
39
+ const command: CreateProduct = {
40
+ sku: 'CAP-LOGO-NVY',
41
+ name: 'Embroidered Logo Cap',
42
+ price: 1499,
43
+ currency: 'GBP',
44
+ };
45
+
46
+ await client.send('CreateProduct', command);
47
+ ```
48
+
49
+ ```python send_create_product.py
50
+ import os
51
+ from acme_events import EventsClient
52
+
53
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
54
+
55
+ command = {
56
+ "sku": "CAP-LOGO-NVY",
57
+ "name": "Embroidered Logo Cap",
58
+ "price": 1499,
59
+ "currency": "GBP",
60
+ }
61
+
62
+ client.send("CreateProduct", command)
63
+ ```
64
+
65
+ ```java SendCreateProduct.java
66
+ import com.acme.events.EventsClient;
67
+ import java.util.Map;
68
+
69
+ public class SendCreateProduct {
70
+ public static void main(String[] args) {
71
+ var client = new EventsClient(
72
+ System.getenv("ACME_API_KEY")
73
+ );
74
+
75
+ var command = Map.of(
76
+ "sku", "CAP-LOGO-NVY",
77
+ "name", "Embroidered Logo Cap",
78
+ "price", 1499,
79
+ "currency", "GBP"
80
+ );
81
+
82
+ client.send("CreateProduct", command);
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. Create an active product with every field
100
+
101
+ The new hoodie is ready to sell, so it is created with a description, category and `ACTIVE` status in one request. It becomes searchable once the Search System indexes the resulting ProductCreated event.
102
+
103
+ ### Payload details
104
+
105
+ - `sku` is `HOODIE-ZIP-GRY-L` (zip hoodie, grey, large).
106
+ - `description` holds the long-form copy for the product page.
107
+ - `category` is `hoodies`, which the Search System uses for filtering.
108
+ - `status` is `ACTIVE`, so the product skips the draft stage and goes live straight away.
109
+ - `price` is `4999` in minor units, with `currency` set to `GBP`.
110
+
111
+ The price is **4,999 pence (£49.99)**.
112
+
113
+ ### Using this example
114
+
115
+ Check that every optional field is stored exactly as sent and copied into the ProductCreated event, and that `status` is `ACTIVE` rather than the default.
116
+
117
+ The examples use a **fictional Acme Events SDK** to send a payload matching the CreateProduct schema. The package names and send methods are illustrative.
118
+
119
+ </Column>
120
+
121
+ <Column>
122
+
123
+ <CodeGroup dropdown>
124
+
125
+ ```typescript send-create-product.ts
126
+ import { EventsClient } from '@acme/events';
127
+ import type { CreateProduct } from './schemas/create-product';
128
+
129
+ const client = new EventsClient({
130
+ apiKey: process.env.ACME_API_KEY!,
131
+ });
132
+
133
+ const command: CreateProduct = {
134
+ sku: 'HOODIE-ZIP-GRY-L',
135
+ name: 'Heavyweight Zip Hoodie',
136
+ description: 'Brushed-back cotton hoodie with a full-length zip.',
137
+ price: 4999,
138
+ currency: 'GBP',
139
+ category: 'hoodies',
140
+ status: 'ACTIVE',
141
+ };
142
+
143
+ await client.send('CreateProduct', command);
144
+ ```
145
+
146
+ ```python send_create_product.py
147
+ import os
148
+ from acme_events import EventsClient
149
+
150
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
151
+
152
+ command = {
153
+ "sku": "HOODIE-ZIP-GRY-L",
154
+ "name": "Heavyweight Zip Hoodie",
155
+ "description": "Brushed-back cotton hoodie with a full-length zip.",
156
+ "price": 4999,
157
+ "currency": "GBP",
158
+ "category": "hoodies",
159
+ "status": "ACTIVE",
160
+ }
161
+
162
+ client.send("CreateProduct", command)
163
+ ```
164
+
165
+ ```java SendCreateProduct.java
166
+ import com.acme.events.EventsClient;
167
+ import java.util.Map;
168
+
169
+ public class SendCreateProduct {
170
+ public static void main(String[] args) {
171
+ var client = new EventsClient(
172
+ System.getenv("ACME_API_KEY")
173
+ );
174
+
175
+ var command = Map.of(
176
+ "sku", "HOODIE-ZIP-GRY-L",
177
+ "name", "Heavyweight Zip Hoodie",
178
+ "description", "Brushed-back cotton hoodie with a full-length zip.",
179
+ "price", 4999,
180
+ "currency", "GBP",
181
+ "category", "hoodies",
182
+ "status", "ACTIVE"
183
+ );
184
+
185
+ client.send("CreateProduct", command);
186
+ }
187
+ }
188
+ ```
189
+
190
+ </CodeGroup>
191
+
192
+ </Column>
193
+
194
+ </Columns>
@@ -0,0 +1,161 @@
1
+ <Columns cols={2}>
2
+
3
+ <Column>
4
+
5
+ ## 1. Delete a product without a reason
6
+
7
+ An admin removes a bucket hat listing that was added by mistake. No reason is given, so only the product identifier is sent. On success the Product API returns `204` and publishes a ProductDeleted event.
8
+
9
+ ### Payload details
10
+
11
+ - `productId` identifies the product to remove and matches the `{productId}` in the request path.
12
+ - `reason` is optional and is left out here.
13
+
14
+ ### Using this example
15
+
16
+ Check that the product is removed, `204` is returned and the ProductDeleted event has no `reason`. Sending the same command again should return `404`.
17
+
18
+ The examples use a **fictional Acme Events SDK** to send a payload matching the DeleteProduct schema. The package names and send methods are illustrative.
19
+
20
+ </Column>
21
+
22
+ <Column>
23
+
24
+ <CodeGroup dropdown>
25
+
26
+ ```typescript send-delete-product.ts
27
+ import { EventsClient } from '@acme/events';
28
+ import type { DeleteProduct } from './schemas/delete-product';
29
+
30
+ const client = new EventsClient({
31
+ apiKey: process.env.ACME_API_KEY!,
32
+ });
33
+
34
+ const command: DeleteProduct = {
35
+ productId: 'e4f6a8b0-2c4d-4e6f-8a0b-1c3d5e7f9a12',
36
+ };
37
+
38
+ await client.send('DeleteProduct', command);
39
+ ```
40
+
41
+ ```python send_delete_product.py
42
+ import os
43
+ from acme_events import EventsClient
44
+
45
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
46
+
47
+ command = {
48
+ "productId": "e4f6a8b0-2c4d-4e6f-8a0b-1c3d5e7f9a12",
49
+ }
50
+
51
+ client.send("DeleteProduct", command)
52
+ ```
53
+
54
+ ```java SendDeleteProduct.java
55
+ import com.acme.events.EventsClient;
56
+ import java.util.Map;
57
+
58
+ public class SendDeleteProduct {
59
+ public static void main(String[] args) {
60
+ var client = new EventsClient(
61
+ System.getenv("ACME_API_KEY")
62
+ );
63
+
64
+ var command = Map.of(
65
+ "productId", "e4f6a8b0-2c4d-4e6f-8a0b-1c3d5e7f9a12"
66
+ );
67
+
68
+ client.send("DeleteProduct", command);
69
+ }
70
+ }
71
+ ```
72
+
73
+ </CodeGroup>
74
+
75
+ </Column>
76
+
77
+ </Columns>
78
+
79
+ ---
80
+
81
+ <Columns cols={2}>
82
+
83
+ <Column>
84
+
85
+ ## 2. Retire a discontinued product
86
+
87
+ The Tie-Dye T-Shirt has sold out and will not be restocked, so it is removed from the catalog with the reason `DISCONTINUED`.
88
+
89
+ ### Payload details
90
+
91
+ - `productId` identifies the Tie-Dye T-Shirt.
92
+ - `reason` is `DISCONTINUED`. The allowed values are `DISCONTINUED`, `DUPLICATE`, `MERCHANT_REQUEST` and `OTHER`.
93
+ - The reason is passed on in the ProductDeleted event for downstream systems and reporting.
94
+
95
+ ### Using this example
96
+
97
+ Check that `reason` is carried through to the ProductDeleted event, so consumers can tell a discontinued line from, for example, a duplicate listing.
98
+
99
+ The examples use a **fictional Acme Events SDK** to send a payload matching the DeleteProduct schema. The package names and send methods are illustrative.
100
+
101
+ </Column>
102
+
103
+ <Column>
104
+
105
+ <CodeGroup dropdown>
106
+
107
+ ```typescript send-delete-product.ts
108
+ import { EventsClient } from '@acme/events';
109
+ import type { DeleteProduct } from './schemas/delete-product';
110
+
111
+ const client = new EventsClient({
112
+ apiKey: process.env.ACME_API_KEY!,
113
+ });
114
+
115
+ const command: DeleteProduct = {
116
+ productId: '5c7e9a1b-3d5f-4a7c-9e1b-2d4f6a8c0e35',
117
+ reason: 'DISCONTINUED',
118
+ };
119
+
120
+ await client.send('DeleteProduct', command);
121
+ ```
122
+
123
+ ```python send_delete_product.py
124
+ import os
125
+ from acme_events import EventsClient
126
+
127
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
128
+
129
+ command = {
130
+ "productId": "5c7e9a1b-3d5f-4a7c-9e1b-2d4f6a8c0e35",
131
+ "reason": "DISCONTINUED",
132
+ }
133
+
134
+ client.send("DeleteProduct", command)
135
+ ```
136
+
137
+ ```java SendDeleteProduct.java
138
+ import com.acme.events.EventsClient;
139
+ import java.util.Map;
140
+
141
+ public class SendDeleteProduct {
142
+ public static void main(String[] args) {
143
+ var client = new EventsClient(
144
+ System.getenv("ACME_API_KEY")
145
+ );
146
+
147
+ var command = Map.of(
148
+ "productId", "5c7e9a1b-3d5f-4a7c-9e1b-2d4f6a8c0e35",
149
+ "reason", "DISCONTINUED"
150
+ );
151
+
152
+ client.send("DeleteProduct", command);
153
+ }
154
+ }
155
+ ```
156
+
157
+ </CodeGroup>
158
+
159
+ </Column>
160
+
161
+ </Columns>
@@ -0,0 +1,182 @@
1
+ <Columns cols={2}>
2
+
3
+ <Column>
4
+
5
+ ## 1. Reduce the price of a T-shirt
6
+
7
+ The Classic Crew Neck T-Shirt is marked down for a weekend promotion. Only the price fields are sent, so the rest of the product stays as it is, and the Product API publishes a ProductUpdated event with the new price.
8
+
9
+ ### Payload details
10
+
11
+ - `productId` identifies the T-shirt and matches the `{productId}` in the request path.
12
+ - `price` is `1499` in minor units, replacing the previous price of `1999`.
13
+ - `currency` is sent with the price so the new amount is unambiguous.
14
+ - `name`, `description`, `category` and `status` are not sent, so they do not change.
15
+
16
+ The new price is **1,499 pence (£14.99)**, a reduction of **500 pence (£5.00)** from £19.99.
17
+
18
+ ### Using this example
19
+
20
+ Check that only `price` and `currency` change on the stored product, and that the ProductUpdated event lists just those two fields in `changes`.
21
+
22
+ The examples use a **fictional Acme Events SDK** to send a payload matching the UpdateProduct schema. The package names and send methods are illustrative.
23
+
24
+ </Column>
25
+
26
+ <Column>
27
+
28
+ <CodeGroup dropdown>
29
+
30
+ ```typescript send-update-product.ts
31
+ import { EventsClient } from '@acme/events';
32
+ import type { UpdateProduct } from './schemas/update-product';
33
+
34
+ const client = new EventsClient({
35
+ apiKey: process.env.ACME_API_KEY!,
36
+ });
37
+
38
+ const command: UpdateProduct = {
39
+ productId: '4c8e2a6f-1d3b-4f5a-9e7c-0b2d4f6a8c13',
40
+ price: 1499,
41
+ currency: 'GBP',
42
+ };
43
+
44
+ await client.send('UpdateProduct', command);
45
+ ```
46
+
47
+ ```python send_update_product.py
48
+ import os
49
+ from acme_events import EventsClient
50
+
51
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
52
+
53
+ command = {
54
+ "productId": "4c8e2a6f-1d3b-4f5a-9e7c-0b2d4f6a8c13",
55
+ "price": 1499,
56
+ "currency": "GBP",
57
+ }
58
+
59
+ client.send("UpdateProduct", command)
60
+ ```
61
+
62
+ ```java SendUpdateProduct.java
63
+ import com.acme.events.EventsClient;
64
+ import java.util.Map;
65
+
66
+ public class SendUpdateProduct {
67
+ public static void main(String[] args) {
68
+ var client = new EventsClient(
69
+ System.getenv("ACME_API_KEY")
70
+ );
71
+
72
+ var command = Map.of(
73
+ "productId", "4c8e2a6f-1d3b-4f5a-9e7c-0b2d4f6a8c13",
74
+ "price", 1499,
75
+ "currency", "GBP"
76
+ );
77
+
78
+ client.send("UpdateProduct", command);
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. Launch a draft product with final copy
96
+
97
+ The Embroidered Logo Cap was created as a draft. Before launch, the merchandiser renames it, adds its description and category, and moves it to `ACTIVE` in a single update.
98
+
99
+ ### Payload details
100
+
101
+ - `productId` identifies the draft cap.
102
+ - `name` adds the colour to the display name.
103
+ - `description` and `category` are set for the first time; `category` is `caps`.
104
+ - `status` changes from `DRAFT` to `ACTIVE`, making the cap visible to shoppers.
105
+ - `price` and `currency` are not sent, so the cap stays at 1,499 pence (£14.99).
106
+
107
+ ### Using this example
108
+
109
+ A handler should apply all four fields in one write, return `200` and publish a single ProductUpdated event whose `changes` contains the same four fields.
110
+
111
+ The examples use a **fictional Acme Events SDK** to send a payload matching the UpdateProduct schema. The package names and send methods are illustrative.
112
+
113
+ </Column>
114
+
115
+ <Column>
116
+
117
+ <CodeGroup dropdown>
118
+
119
+ ```typescript send-update-product.ts
120
+ import { EventsClient } from '@acme/events';
121
+ import type { UpdateProduct } from './schemas/update-product';
122
+
123
+ const client = new EventsClient({
124
+ apiKey: process.env.ACME_API_KEY!,
125
+ });
126
+
127
+ const command: UpdateProduct = {
128
+ productId: 'a7c4e2d9-1b3f-4c8a-8e5d-2f6b9a0c3d71',
129
+ name: 'Embroidered Logo Cap - Navy',
130
+ description: 'Six-panel cotton twill cap with an adjustable strap.',
131
+ category: 'caps',
132
+ status: 'ACTIVE',
133
+ };
134
+
135
+ await client.send('UpdateProduct', command);
136
+ ```
137
+
138
+ ```python send_update_product.py
139
+ import os
140
+ from acme_events import EventsClient
141
+
142
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
143
+
144
+ command = {
145
+ "productId": "a7c4e2d9-1b3f-4c8a-8e5d-2f6b9a0c3d71",
146
+ "name": "Embroidered Logo Cap - Navy",
147
+ "description": "Six-panel cotton twill cap with an adjustable strap.",
148
+ "category": "caps",
149
+ "status": "ACTIVE",
150
+ }
151
+
152
+ client.send("UpdateProduct", command)
153
+ ```
154
+
155
+ ```java SendUpdateProduct.java
156
+ import com.acme.events.EventsClient;
157
+ import java.util.Map;
158
+
159
+ public class SendUpdateProduct {
160
+ public static void main(String[] args) {
161
+ var client = new EventsClient(
162
+ System.getenv("ACME_API_KEY")
163
+ );
164
+
165
+ var command = Map.of(
166
+ "productId", "a7c4e2d9-1b3f-4c8a-8e5d-2f6b9a0c3d71",
167
+ "name", "Embroidered Logo Cap - Navy",
168
+ "description", "Six-panel cotton twill cap with an adjustable strap.",
169
+ "category", "caps",
170
+ "status", "ACTIVE"
171
+ );
172
+
173
+ client.send("UpdateProduct", command);
174
+ }
175
+ }
176
+ ```
177
+
178
+ </CodeGroup>
179
+
180
+ </Column>
181
+
182
+ </Columns>