@eventcatalog/create-eventcatalog 0.0.2 → 0.1.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.
@@ -0,0 +1,17 @@
1
+ var kafka = require('kafka-node'),
2
+ Consumer = kafka.Consumer,
3
+ client = new kafka.KafkaClient(),
4
+ consumer = new Consumer(
5
+ client,
6
+ [
7
+ { topic: 't', partition: 0 },
8
+ { topic: 'AddedItemToCart', partition: 1 },
9
+ ],
10
+ {
11
+ autoCommit: false,
12
+ }
13
+ );
14
+
15
+ consumer.on('message', function (message) {
16
+ console.log(message);
17
+ });
@@ -27,4 +27,6 @@ We have a frontend application that allows users to buy things from our store. T
27
27
 
28
28
  <Mermaid />
29
29
 
30
+ <EventExamples title="How to trigger event" />
31
+
30
32
  <Schema />
@@ -37,7 +37,7 @@
37
37
  "type": "number",
38
38
  "description": "How many items the user wants to add to their shopping cart",
39
39
  "minimum": 1,
40
- "maximum": 100,
40
+ "maximum": 1000,
41
41
  "default": 1
42
42
  }
43
43
  }
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: AddedItemToCart
3
+ version: 0.0.1
4
+ summary: |
5
+ Holds information about what the user added to their shopping cart.
6
+ producers:
7
+ - Basket Service
8
+ consumers:
9
+ - Data Lake
10
+ domains:
11
+ - Shop
12
+ owners:
13
+ - dboyne
14
+ - mSmith
15
+ ---
16
+
17
+ <Admonition>When firing this event make sure you set the `correlation-id` in the headers. Our schemas have standard metadata make sure you read and follow it.</Admonition>
18
+
19
+ ### Details
20
+
21
+ This event can be triggered multiple times per customer. Everytime the customer adds an item to their shopping cart this event will be triggered.
22
+
23
+ We have a frontend application that allows users to buy things from our store. This front end interacts directly with the `Basket Service` to add items to the cart. The `Basket Service` will raise the events.
24
+
25
+
26
+ ### Consumer / Producer Diagram
27
+
28
+ <Mermaid />
29
+
30
+ <Schema />
@@ -0,0 +1,46 @@
1
+ {
2
+ "$id": "https://example.com/AddedItemToCart.json",
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "title": "AddedItemToCart",
5
+ "type": "object",
6
+ "properties": {
7
+ "metadata": {
8
+ "type": "object",
9
+ "properties": {
10
+ "correlationId": {
11
+ "type": "string",
12
+ "description": "The ID of the user"
13
+ },
14
+ "domain": {
15
+ "type": "string",
16
+ "description": "The domain of the event"
17
+ },
18
+ "service": {
19
+ "type": "string",
20
+ "description": "The name of the service that triggered the event"
21
+ }
22
+ },
23
+ "required": ["correlationId", "domain"]
24
+ },
25
+ "data": {
26
+ "type": "object",
27
+ "properties": {
28
+ "userId": {
29
+ "type": "string",
30
+ "description": "The ID of the user"
31
+ },
32
+ "itemId": {
33
+ "type": "string",
34
+ "description": "The ID of the shopping item"
35
+ },
36
+ "quantity": {
37
+ "type": "number",
38
+ "description": "How many items the user wants to add to their shopping cart",
39
+ "minimum": 1,
40
+ "maximum": 100,
41
+ "default": 1
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
@@ -3,10 +3,12 @@
3
3
 
4
4
  # Production
5
5
  /build
6
+ /public/schemas
6
7
 
7
8
  # Generated files
8
9
  .next
9
10
 
11
+
10
12
  # Misc
11
13
  .DS_Store
12
14
  .env.local
package/dist/gitignore CHANGED
@@ -3,10 +3,12 @@
3
3
 
4
4
  # Production
5
5
  /build
6
+ /public/schemas
6
7
 
7
8
  # Generated files
8
9
  .next
9
10
 
11
+
10
12
  # Misc
11
13
  .DS_Store
12
14
  .env.local