@eventcatalog/create-eventcatalog 2.0.6 → 2.0.8
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/Orders/changelog.md +7 -0
- package/templates/default/domains/Orders/index.md +7 -0
- package/templates/default/domains/Payment/index.md +5 -0
- package/templates/default/events/Inventory/InventoryAdjusted/changelog.md +68 -0
- package/templates/default/events/Inventory/InventoryAdjusted/schema.json +15 -34
- package/templates/default/events/Inventory/InventoryAdjusted/versioned/0.0.1/changelog.md +30 -0
- package/templates/default/events/Inventory/InventoryAdjusted/versioned/0.0.3/changelog.md +26 -0
- package/templates/default/flows/Payment/PaymentProcessed/index.md +81 -0
- package/templates/default/flows/Subscriptions/CancelSubscription/index.md +68 -0
- package/templates/default/flows/Subscriptions/CancelSubscription/versioned/0.0.1/index.md +49 -0
- package/templates/default/services/InventoryService/0.0.1/index.md +36 -0
- package/templates/default/services/InventoryService/changelog.md +7 -0
package/dist/index.js
CHANGED
|
@@ -22654,7 +22654,7 @@ function validateNpmName(name) {
|
|
|
22654
22654
|
var package_default = {
|
|
22655
22655
|
name: "@eventcatalog/create-eventcatalog",
|
|
22656
22656
|
description: "Create EventCatalog with one command",
|
|
22657
|
-
version: "2.0.
|
|
22657
|
+
version: "2.0.8",
|
|
22658
22658
|
bin: {
|
|
22659
22659
|
"create-catalog": "./dist/index.js"
|
|
22660
22660
|
},
|
package/package.json
CHANGED
|
@@ -46,4 +46,11 @@ sequenceDiagram
|
|
|
46
46
|
OrdersService->>InventoryService: Update Inventory
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
## Flows
|
|
50
|
+
|
|
51
|
+
### Cancel Subscription flow
|
|
52
|
+
Documented flow when a user cancels their subscription.
|
|
53
|
+
|
|
54
|
+
<Flow id="CancelSubscription" version="latest" includeKey={false} />
|
|
55
|
+
|
|
49
56
|
|
|
@@ -22,3 +22,8 @@ The Payment Domain encompasses all services and components related to handling f
|
|
|
22
22
|
## Bounded context
|
|
23
23
|
|
|
24
24
|
<NodeGraph />
|
|
25
|
+
|
|
26
|
+
### Payment processing flow
|
|
27
|
+
Documented flow when a user makes a payment within the order domain
|
|
28
|
+
|
|
29
|
+
<Flow id="PaymentFlow" version="latest" includeKey={false} />
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2024-08-01
|
|
3
|
+
badges:
|
|
4
|
+
- content: ⭐️ JSON Schema
|
|
5
|
+
backgroundColor: purple
|
|
6
|
+
textColor: purple
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
### Added support for JSON Schema
|
|
10
|
+
|
|
11
|
+
InventoryAdjusted uses Avro but now also supports JSON Draft 7.
|
|
12
|
+
|
|
13
|
+
```json title="Employee JSON Draft"
|
|
14
|
+
// labeled-line-markers.jsx
|
|
15
|
+
{
|
|
16
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
17
|
+
"type": "object",
|
|
18
|
+
"title": "Employee",
|
|
19
|
+
"properties": {
|
|
20
|
+
"Name": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"Age": {
|
|
24
|
+
"type": "integer"
|
|
25
|
+
},
|
|
26
|
+
"Town": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"required": ["Name", "Age", "Town"]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Using it with our Kafka Cluster
|
|
36
|
+
|
|
37
|
+
## 1. Create a new topic
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
# Create a topic named 'employee_topic'
|
|
41
|
+
kafka-topics.sh --create --topic employee_topic --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Step 2: Prepare the JSON Message
|
|
45
|
+
|
|
46
|
+
Create a JSON file named `employee.json` with the following content:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"Name": "John Doe",
|
|
51
|
+
"Age": 30,
|
|
52
|
+
"Town": "Springfield"
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Step 3: Produce the Message to Kafka Topic
|
|
57
|
+
|
|
58
|
+
Use the Kafka producer CLI to send the JSON message:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
cat employee.json | kafka-console-producer.sh --topic employee_topic --bootstrap-server localhost:9092
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Step 4: Verify the Message (Optional)
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
kafka-console-consumer.sh --topic employee_topic --from-beginning --bootstrap-server localhost:9092
|
|
68
|
+
```
|
|
@@ -1,36 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"type": "string",
|
|
9
|
-
"description": "The name of the employee"
|
|
10
|
-
},
|
|
11
|
-
"Age": {
|
|
12
|
-
"type": "integer",
|
|
13
|
-
"description": "The age of the employee"
|
|
14
|
-
},
|
|
15
|
-
"Department": {
|
|
16
|
-
"type": "string",
|
|
17
|
-
"description": "The department where the employee works"
|
|
18
|
-
},
|
|
19
|
-
"Position": {
|
|
20
|
-
"type": "string",
|
|
21
|
-
"description": "The position or title of the employee within the department"
|
|
22
|
-
},
|
|
23
|
-
"Salary": {
|
|
24
|
-
"type": "number",
|
|
25
|
-
"format": "double",
|
|
26
|
-
"description": "The salary of the employee"
|
|
27
|
-
},
|
|
28
|
-
"JoinDate": {
|
|
29
|
-
"type": "string",
|
|
30
|
-
"format": "date",
|
|
31
|
-
"description": "The date when the employee joined the company"
|
|
32
|
-
}
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"title": "Employee",
|
|
5
|
+
"properties": {
|
|
6
|
+
"Name": {
|
|
7
|
+
"type": "string"
|
|
33
8
|
},
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
9
|
+
"Age": {
|
|
10
|
+
"type": "integer"
|
|
11
|
+
},
|
|
12
|
+
"Town": {
|
|
13
|
+
"type": "string"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"required": ["Name", "Age", "Town"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2024-07-01
|
|
3
|
+
badges:
|
|
4
|
+
- content: Breaking change
|
|
5
|
+
backgroundColor: red
|
|
6
|
+
textColor: red
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
### Removed fields from schema, added new owners
|
|
10
|
+
|
|
11
|
+
`Gender` property has been removed from the Schema of the event
|
|
12
|
+
|
|
13
|
+
Also added the [full stackers](/docs/teams/full-stack) team as owners of this event
|
|
14
|
+
|
|
15
|
+
```diff lang="json"
|
|
16
|
+
{
|
|
17
|
+
"type" : "record",
|
|
18
|
+
"namespace" : "Tutorialspoint",
|
|
19
|
+
"name" : "Employee",
|
|
20
|
+
"fields" : [
|
|
21
|
+
{ "name" : "Name" , "type" : "string" },
|
|
22
|
+
{ "name" : "Age" , "type" : "int" },
|
|
23
|
+
- { "name" : "Gender" , "type" : "string" },
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2024-07-11
|
|
3
|
+
badges:
|
|
4
|
+
- content: New field
|
|
5
|
+
backgroundColor: green
|
|
6
|
+
textColor: green
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
### Added new field to schema
|
|
10
|
+
|
|
11
|
+
We added the new town property to the schema for downstream consumers.
|
|
12
|
+
|
|
13
|
+
```json ins={"New: Added new Town property to schema:":9-10}
|
|
14
|
+
// labeled-line-markers.jsx
|
|
15
|
+
{
|
|
16
|
+
"type" : "record",
|
|
17
|
+
"namespace" : "Tutorialspoint",
|
|
18
|
+
"name" : "Employee",
|
|
19
|
+
"fields" : [
|
|
20
|
+
{ "name" : "Name" , "type" : "string" },
|
|
21
|
+
{ "name" : "Age" , "type" : "int" },
|
|
22
|
+
|
|
23
|
+
{ "name" : "Town" , "type" : "string" },
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
```
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: PaymentFlow
|
|
3
|
+
name: Payment Flow for customers
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
summary: Business flow for processing payments in an e-commerce platform
|
|
6
|
+
steps:
|
|
7
|
+
- id: "customer_place_order"
|
|
8
|
+
title: Customer places order
|
|
9
|
+
next_step: "place_order_request"
|
|
10
|
+
- id: "place_order_request"
|
|
11
|
+
title: Place order
|
|
12
|
+
message:
|
|
13
|
+
id: PlaceOrder
|
|
14
|
+
version: 0.0.1
|
|
15
|
+
next_step:
|
|
16
|
+
id: "payment_initiated"
|
|
17
|
+
label: Initiate payment
|
|
18
|
+
- id: "payment_initiated"
|
|
19
|
+
title: Payment Initiated
|
|
20
|
+
message:
|
|
21
|
+
id: PaymentInitiated
|
|
22
|
+
version: 0.0.1
|
|
23
|
+
next_steps:
|
|
24
|
+
- "payment_processed"
|
|
25
|
+
- "payment_failed"
|
|
26
|
+
- id: "payment_processed"
|
|
27
|
+
title: Payment Processed
|
|
28
|
+
message:
|
|
29
|
+
id: PaymentProcessed
|
|
30
|
+
version: 0.0.1
|
|
31
|
+
next_steps:
|
|
32
|
+
- id: "adjust_inventory"
|
|
33
|
+
label: Adjust inventory
|
|
34
|
+
- id: "send_custom_notification"
|
|
35
|
+
label: Notify customer
|
|
36
|
+
- id: "payment_failed"
|
|
37
|
+
title: Payment Failed
|
|
38
|
+
type: node
|
|
39
|
+
next_steps:
|
|
40
|
+
- id: "failure_notification"
|
|
41
|
+
label: Notify customer of failure
|
|
42
|
+
- id: "retry_payment"
|
|
43
|
+
label: Retry payment
|
|
44
|
+
- id: "adjust_inventory"
|
|
45
|
+
title: Inventory Adjusted
|
|
46
|
+
message:
|
|
47
|
+
id: InventoryAdjusted
|
|
48
|
+
version: 1.0.1
|
|
49
|
+
next_step:
|
|
50
|
+
id: "payment_complete"
|
|
51
|
+
label: Complete order
|
|
52
|
+
- id: "send_custom_notification"
|
|
53
|
+
title: Customer Notified of Payment
|
|
54
|
+
type: node
|
|
55
|
+
next_step:
|
|
56
|
+
id: "payment_complete"
|
|
57
|
+
label: Complete order
|
|
58
|
+
- id: "failure_notification"
|
|
59
|
+
title: Customer Notified of Failure
|
|
60
|
+
type: node
|
|
61
|
+
- id: "retry_payment"
|
|
62
|
+
title: Retry Payment
|
|
63
|
+
type: node
|
|
64
|
+
next_step:
|
|
65
|
+
id: "payment_initiated"
|
|
66
|
+
label: Retry payment process
|
|
67
|
+
- id: "payment_complete"
|
|
68
|
+
title: Payment Complete
|
|
69
|
+
message:
|
|
70
|
+
id: PaymentComplete
|
|
71
|
+
version: 0.0.2
|
|
72
|
+
next_step:
|
|
73
|
+
id: "order-complete"
|
|
74
|
+
label: Order completed
|
|
75
|
+
- id: "order-complete"
|
|
76
|
+
title: Order Completed
|
|
77
|
+
type: node
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### Flow of feature
|
|
81
|
+
<NodeGraph/>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: "CancelSubscription"
|
|
3
|
+
name: "User Cancels Subscription"
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
summary: "Flow for when a user has cancelled a subscription"
|
|
6
|
+
steps:
|
|
7
|
+
- id: "cancel_subscription_initiated"
|
|
8
|
+
title: "Cancels Subscription"
|
|
9
|
+
summary: "User cancels their subscription"
|
|
10
|
+
actor:
|
|
11
|
+
name: "User"
|
|
12
|
+
next_step:
|
|
13
|
+
id: "cancel_subscription_request"
|
|
14
|
+
label: "Initiate subscription cancellation"
|
|
15
|
+
|
|
16
|
+
- id: "cancel_subscription_request"
|
|
17
|
+
title: "Cancel Subscription"
|
|
18
|
+
message:
|
|
19
|
+
id: "CancelSubscription"
|
|
20
|
+
version: "0.0.1"
|
|
21
|
+
next_step:
|
|
22
|
+
id: "subscription_service"
|
|
23
|
+
label: "Proceed to subscription service"
|
|
24
|
+
|
|
25
|
+
- id: "stripe_integration"
|
|
26
|
+
title: "Stripe"
|
|
27
|
+
externalSystem:
|
|
28
|
+
name: "Stripe"
|
|
29
|
+
summary: "3rd party payment system"
|
|
30
|
+
url: "https://stripe.com/"
|
|
31
|
+
next_step:
|
|
32
|
+
id: "subscription_service"
|
|
33
|
+
label: "Return to subscription service"
|
|
34
|
+
|
|
35
|
+
- id: "subscription_service"
|
|
36
|
+
title: "Subscription Service"
|
|
37
|
+
service:
|
|
38
|
+
id: "SubscriptionService"
|
|
39
|
+
version: "0.0.1"
|
|
40
|
+
next_steps:
|
|
41
|
+
- id: "stripe_integration"
|
|
42
|
+
label: "Cancel subscription via Stripe"
|
|
43
|
+
- id: "subscription_cancelled"
|
|
44
|
+
label: "Successful cancellation"
|
|
45
|
+
- id: "subscription_rejected"
|
|
46
|
+
label: "Failed cancellation"
|
|
47
|
+
|
|
48
|
+
- id: "subscription_cancelled"
|
|
49
|
+
title: "Subscription has been Cancelled"
|
|
50
|
+
message:
|
|
51
|
+
id: "UserSubscriptionCancelled"
|
|
52
|
+
version: "0.0.1"
|
|
53
|
+
next_step:
|
|
54
|
+
id: "notification_service"
|
|
55
|
+
label: "Email customer"
|
|
56
|
+
|
|
57
|
+
- id: "subscription_rejected"
|
|
58
|
+
title: "Subscription cancellation has been rejected"
|
|
59
|
+
|
|
60
|
+
- id: "notification_service"
|
|
61
|
+
title: "Notifications Service"
|
|
62
|
+
service:
|
|
63
|
+
id: "NotificationService"
|
|
64
|
+
version: "0.0.2"
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
<NodeGraph />
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: "CancelSubscription"
|
|
3
|
+
name: "User Cancels Subscription"
|
|
4
|
+
version: "0.0.1"
|
|
5
|
+
summary: "Flow for when a user has cancelled a subscription"
|
|
6
|
+
steps:
|
|
7
|
+
- id: "cancel_subscription_initiated"
|
|
8
|
+
title: "Cancels Subscription"
|
|
9
|
+
summary: "User cancels their subscription"
|
|
10
|
+
actor:
|
|
11
|
+
name: "User"
|
|
12
|
+
next_step:
|
|
13
|
+
id: "cancel_subscription_request"
|
|
14
|
+
label: "Initiate subscription cancellation"
|
|
15
|
+
|
|
16
|
+
- id: "cancel_subscription_request"
|
|
17
|
+
title: "Cancel Subscription"
|
|
18
|
+
message:
|
|
19
|
+
id: "CancelSubscription"
|
|
20
|
+
version: "0.0.1"
|
|
21
|
+
next_step:
|
|
22
|
+
id: "subscription_service"
|
|
23
|
+
label: "Proceed to subscription service"
|
|
24
|
+
|
|
25
|
+
- id: "stripe_integration"
|
|
26
|
+
title: "Stripe"
|
|
27
|
+
externalSystem:
|
|
28
|
+
name: "Stripe"
|
|
29
|
+
summary: "3rd party payment system"
|
|
30
|
+
url: "https://stripe.com/"
|
|
31
|
+
next_step:
|
|
32
|
+
id: "subscription_service"
|
|
33
|
+
label: "Return to subscription service"
|
|
34
|
+
|
|
35
|
+
- id: "subscription_service"
|
|
36
|
+
title: "Subscription Service"
|
|
37
|
+
service:
|
|
38
|
+
id: "SubscriptionService"
|
|
39
|
+
version: "0.0.1"
|
|
40
|
+
next_steps:
|
|
41
|
+
- id: "stripe_integration"
|
|
42
|
+
label: "Cancel subscription via Stripe"
|
|
43
|
+
- id: "subscription_cancelled"
|
|
44
|
+
label: "Successful cancellation"
|
|
45
|
+
- id: "subscription_rejected"
|
|
46
|
+
label: "Failed cancellation"
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
<NodeGraph />
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: InventoryService
|
|
3
|
+
version: 0.0.2
|
|
4
|
+
name: Inventory Service
|
|
5
|
+
summary: |
|
|
6
|
+
Service that handles the inventory
|
|
7
|
+
owners:
|
|
8
|
+
- dboyne
|
|
9
|
+
- full-stack
|
|
10
|
+
- mobile-devs
|
|
11
|
+
receives:
|
|
12
|
+
- id: OrderConfirmed
|
|
13
|
+
version: 0.0.1
|
|
14
|
+
- id: OrderCancelled
|
|
15
|
+
version: 0.0.1
|
|
16
|
+
- id: OrderAmended
|
|
17
|
+
version: 0.0.1
|
|
18
|
+
- id: UpdateInventory
|
|
19
|
+
version: 0.0.3
|
|
20
|
+
sends:
|
|
21
|
+
- id: InventoryAdjusted
|
|
22
|
+
version: 0.0.4
|
|
23
|
+
- id: OutOfStock
|
|
24
|
+
version: 0.0.3
|
|
25
|
+
repository:
|
|
26
|
+
language: JavaScript
|
|
27
|
+
url: https://github.com/boyney123/pretend-shipping-service
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Overview
|
|
31
|
+
|
|
32
|
+
The Inventory Service is a critical component of the system responsible for managing product stock levels, tracking inventory movements, and ensuring product availability. It interacts with other services to maintain accurate inventory records and supports operations such as order fulfillment, restocking, and inventory audits.
|
|
33
|
+
|
|
34
|
+
## Architecture diagram
|
|
35
|
+
|
|
36
|
+
<NodeGraph title="Hello world" />
|