@eventcatalog/create-eventcatalog 2.2.1 → 2.2.2

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 (29) hide show
  1. package/dist/index.js +19 -4
  2. package/package.json +1 -1
  3. package/templates/asyncapi/Dockerfile +23 -0
  4. package/templates/asyncapi/README-template.md +1 -0
  5. package/templates/asyncapi/asyncapi-files/messages/user-signed-up.yml +44 -0
  6. package/templates/asyncapi/asyncapi-files/orders-service.yml +272 -0
  7. package/templates/asyncapi/asyncapi-files/payment-service.yml +245 -0
  8. package/templates/asyncapi/asyncapi-files/user-service.yml +23 -0
  9. package/templates/asyncapi/dockerignore +8 -0
  10. package/templates/asyncapi/eventcatalog.config.js +55 -0
  11. package/templates/asyncapi/eventcatalog.styles.css +1 -0
  12. package/templates/asyncapi/gitignore +24 -0
  13. package/templates/asyncapi/npmrc +1 -0
  14. package/templates/asyncapi/public/logo.png +0 -0
  15. package/templates/index.ts +10 -0
  16. package/templates/openapi/Dockerfile +23 -0
  17. package/templates/openapi/README-template.md +1 -0
  18. package/templates/openapi/dockerignore +8 -0
  19. package/templates/openapi/eventcatalog.config.js +60 -0
  20. package/templates/openapi/eventcatalog.styles.css +1 -0
  21. package/templates/openapi/gitignore +24 -0
  22. package/templates/openapi/npmrc +1 -0
  23. package/templates/openapi/openapi-files/cart-api.yml +107 -0
  24. package/templates/openapi/openapi-files/order-api.yml +148 -0
  25. package/templates/openapi/openapi-files/order-history.yml +93 -0
  26. package/templates/openapi/openapi-files/payment-api.yml +74 -0
  27. package/templates/openapi/openapi-files/product-api.yml +68 -0
  28. package/templates/openapi/public/logo.png +0 -0
  29. package/templates/types.ts +1 -1
@@ -0,0 +1,55 @@
1
+ import path from 'path';
2
+ import url from 'url';
3
+
4
+ const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
5
+
6
+ /** @type {import('@eventcatalog/core/bin/eventcatalog.config').Config} */
7
+ export default {
8
+ title: 'EventCatalog',
9
+ tagline: 'Discover, Explore and Document your Event Driven Architectures',
10
+ organizationName: '<organizationName>',
11
+ homepageLink: 'https://eventcatalog.dev/',
12
+ editUrl: 'https://github.com/boyney123/eventcatalog-demo/edit/master',
13
+ // By default set to false, add true to get urls ending in /
14
+ trailingSlash: false,
15
+ // Change to make the base url of the site different, by default https://{website}.com/docs,
16
+ // changing to /company would be https://{website}.com/company/docs,
17
+ base: '/',
18
+ logo: {
19
+ alt: 'EventCatalog Logo',
20
+ src: '/logo.png',
21
+ text: 'EventCatalog',
22
+ },
23
+ generators: [
24
+ [
25
+ '@eventcatalog/generator-asyncapi',
26
+ {
27
+ services: [
28
+ { path: path.join(__dirname, 'asyncapi-files', 'orders-service.yml'), id: 'Orders Service' },
29
+ ],
30
+ domain: { id: 'orders', name: 'Orders', version: '0.0.1' },
31
+ },
32
+ ],
33
+ [
34
+ '@eventcatalog/generator-asyncapi',
35
+ {
36
+ services: [
37
+ { path: path.join(__dirname, 'asyncapi-files', 'payment-service.yml'), id: 'Payment Service' },
38
+ ],
39
+ domain: { id: 'payment', name: 'Payment', version: '0.0.1' },
40
+ },
41
+ ],
42
+ [
43
+ '@eventcatalog/generator-asyncapi',
44
+ {
45
+ services: [
46
+ { path: path.join(__dirname, 'asyncapi-files', 'user-service.yml'), id: 'User Service' },
47
+ ],
48
+ domain: { id: 'user-domain', name: 'User Domain', version: '0.0.1' },
49
+ debug: true
50
+ },
51
+ ],
52
+ ],
53
+ // required random generated id used by eventcatalog
54
+ cId: '<cId>'
55
+ };
@@ -0,0 +1 @@
1
+ /* Custom styling support coming soon. */
@@ -0,0 +1,24 @@
1
+ # Dependencies
2
+ /node_modules
3
+
4
+ # Production
5
+ /build
6
+
7
+ # Generated files
8
+ .astro
9
+ out
10
+ dist
11
+
12
+
13
+ # Misc
14
+ .DS_Store
15
+ .env.local
16
+ .env.development.local
17
+ .env.test.local
18
+ .env.production.local
19
+
20
+ npm-debug.log*
21
+ yarn-debug.log*
22
+ yarn-error.log*
23
+
24
+ .eventcatalog-core
@@ -0,0 +1 @@
1
+ strict-peer-dependencies=false
@@ -72,6 +72,16 @@ export const installTemplate = async ({
72
72
  const dependencies = [
73
73
  "@eventcatalog/core"
74
74
  ] as any;
75
+
76
+ // if asyncapi is selected, add the asyncapi dependencies
77
+ if (template === "asyncapi") {
78
+ dependencies.push("@eventcatalog/generator-asyncapi");
79
+ }
80
+
81
+ if (template === "openapi") {
82
+ dependencies.push("@eventcatalog/generator-openapi");
83
+ }
84
+
75
85
  // "@myuser/my-package": "file:../lib"
76
86
  const devDependencies = [] as any;
77
87
 
@@ -0,0 +1,23 @@
1
+ ## Stage 1: Build the app
2
+ FROM node:lts AS build
3
+
4
+ WORKDIR /app
5
+
6
+ # Install dependencies
7
+ COPY package.json package-lock.json ./
8
+ RUN npm install
9
+
10
+ # Copy source code
11
+ COPY . .
12
+
13
+ # Fix for Astro in Docker: https://github.com/withastro/astro/issues/2596
14
+ ENV NODE_OPTIONS=--max_old_space_size=2048
15
+ # Build the app
16
+ RUN npm run build
17
+
18
+
19
+ ## Stage 2: Serve app with httpd server
20
+ FROM httpd:2.4
21
+
22
+ # Copy built app to serve
23
+ COPY --from=build /app/dist /usr/local/apache2/htdocs
@@ -0,0 +1 @@
1
+ # My Event Catalog
@@ -0,0 +1,8 @@
1
+ .eventcatalog-core/
2
+ .git/
3
+ dist/
4
+ node_modules/
5
+ .gitignore
6
+ .dockerignore
7
+ Dockerfile
8
+ README.md
@@ -0,0 +1,60 @@
1
+ import path from "path";
2
+ import url from "url";
3
+
4
+ const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
5
+
6
+ /** @type {import('@eventcatalog/core/bin/eventcatalog.config').Config} */
7
+ export default {
8
+ title: "EventCatalog",
9
+ tagline: "Discover, Explore and Document your Event Driven Architectures",
10
+ organizationName: '<organizationName>',
11
+ homepageLink: "https://eventcatalog.dev/",
12
+ editUrl: "https://github.com/boyney123/eventcatalog-demo/edit/master",
13
+ // By default set to false, add true to get urls ending in /
14
+ trailingSlash: false,
15
+ // Change to make the base url of the site different, by default https://{website}.com/docs,
16
+ // changing to /company would be https://{website}.com/company/docs,
17
+ base: "/",
18
+ // Customize the logo, add your logo to public/ folder
19
+ logo: {
20
+ alt: "EventCatalog Logo",
21
+ src: "/logo.png",
22
+ text: "EventCatalog",
23
+ },
24
+ generators: [
25
+ [
26
+ "@eventcatalog/generator-openapi",
27
+ {
28
+ services: [
29
+ { path: path.join(__dirname, "openapi-files", "product-api.yml") },
30
+ ],
31
+ domain: { id: "products", name: "Products", version: "0.0.1" },
32
+ },
33
+ ],
34
+ [
35
+ "@eventcatalog/generator-openapi",
36
+ {
37
+ services: [
38
+ { path: path.join(__dirname, "openapi-files", "order-api.yml"), id: 'order-service' },
39
+ { path: path.join(__dirname, "openapi-files", "order-history.yml"), id: 'order-history' },
40
+ ],
41
+ domain: {
42
+ id: "order-management",
43
+ name: "Order management",
44
+ version: "0.0.1",
45
+ },
46
+ },
47
+ ],
48
+ [
49
+ "@eventcatalog/generator-openapi",
50
+ {
51
+ services: [
52
+ { path: path.join(__dirname, "openapi-files", "payment-api.yml"), id: 'payment-service' },
53
+ ],
54
+ domain: { id: "payment", name: "Payment", version: "0.0.1" },
55
+ },
56
+ ],
57
+ ],
58
+ // required random generated id used by eventcatalog
59
+ cId: '<cId>'
60
+ };
@@ -0,0 +1 @@
1
+ /* Custom styling support coming soon. */
@@ -0,0 +1,24 @@
1
+ # Dependencies
2
+ /node_modules
3
+
4
+ # Production
5
+ /build
6
+
7
+ # Generated files
8
+ .astro
9
+ out
10
+ dist
11
+
12
+
13
+ # Misc
14
+ .DS_Store
15
+ .env.local
16
+ .env.development.local
17
+ .env.test.local
18
+ .env.production.local
19
+
20
+ npm-debug.log*
21
+ yarn-debug.log*
22
+ yarn-error.log*
23
+
24
+ .eventcatalog-core
@@ -0,0 +1 @@
1
+ strict-peer-dependencies=false
@@ -0,0 +1,107 @@
1
+ openapi: 3.0.0
2
+ info:
3
+ title: Cart API
4
+ description: API for managing shopping cart operations.
5
+ version: 1.0.0
6
+ servers:
7
+ - url: https://api.yourshoppingapp.com/cart
8
+ description: Cart API Server
9
+ paths:
10
+ /:
11
+ get:
12
+ summary: Retrieve shopping cart
13
+ description: Get the contents of the user's shopping cart.
14
+ x-eventcatalog-message-type: query
15
+ operationId: getCart
16
+ responses:
17
+ '200':
18
+ description: Shopping cart details
19
+ content:
20
+ application/json:
21
+ schema:
22
+ $ref: '#/components/schemas/Cart'
23
+ post:
24
+ summary: Add item to cart
25
+ description: Add a product to the shopping cart.
26
+ x-eventcatalog-message-type: command
27
+ requestBody:
28
+ description: Product information to add to the cart.
29
+ required: true
30
+ content:
31
+ application/json:
32
+ schema:
33
+ $ref: '#/components/schemas/CartItem'
34
+ responses:
35
+ '201':
36
+ description: Product added to cart
37
+ content:
38
+ application/json:
39
+ schema:
40
+ $ref: '#/components/schemas/Cart'
41
+ /{productId}:
42
+ patch:
43
+ summary: Update item quantity
44
+ description: Update the quantity of an item in the cart.
45
+ x-eventcatalog-message-type: command
46
+ operationId: updateCartItem
47
+ parameters:
48
+ - name: productId
49
+ in: path
50
+ required: true
51
+ schema:
52
+ type: string
53
+ requestBody:
54
+ description: Updated quantity
55
+ required: true
56
+ content:
57
+ application/json:
58
+ schema:
59
+ type: object
60
+ properties:
61
+ quantity:
62
+ type: integer
63
+ minimum: 1
64
+ responses:
65
+ '200':
66
+ description: Quantity updated
67
+ '404':
68
+ description: Product not found in cart
69
+ delete:
70
+ summary: Remove item from cart
71
+ description: Remove a product from the shopping cart.
72
+ x-eventcatalog-message-type: command
73
+ parameters:
74
+ - name: productId
75
+ in: path
76
+ required: true
77
+ schema:
78
+ type: string
79
+ responses:
80
+ '204':
81
+ description: Product removed from cart
82
+ components:
83
+ schemas:
84
+ Cart:
85
+ type: object
86
+ properties:
87
+ items:
88
+ type: array
89
+ items:
90
+ $ref: '#/components/schemas/CartItem'
91
+ CartItem:
92
+ type: object
93
+ properties:
94
+ productId:
95
+ type: string
96
+ name:
97
+ type: string
98
+ quantity:
99
+ type: integer
100
+ price:
101
+ type: number
102
+ format: float
103
+ required:
104
+ - productId
105
+ - name
106
+ - quantity
107
+ - price
@@ -0,0 +1,148 @@
1
+ openapi: 3.0.0
2
+ info:
3
+ title: Order API
4
+ description: API for managing orders in the shopping application.
5
+ version: 1.0.0
6
+ servers:
7
+ - url: https://api.yourshoppingapp.com/orders
8
+ description: Order API Server
9
+ paths:
10
+ /:
11
+ get:
12
+ summary: Get list of orders
13
+ description: Retrieve a list of all orders made by the user.
14
+ x-eventcatalog-message-type: query
15
+ operationId: listOrders
16
+ responses:
17
+ '200':
18
+ description: A list of orders
19
+ content:
20
+ application/json:
21
+ schema:
22
+ type: array
23
+ items:
24
+ $ref: '#/components/schemas/Order'
25
+ '500':
26
+ description: Internal server error
27
+ content:
28
+ application/json:
29
+ schema:
30
+ $ref: '#/components/schemas/ErrorResponse'
31
+ /{orderId}:
32
+ get:
33
+ summary: Get order by ID
34
+ description: Retrieve details of a specific order.
35
+ operationId: getOrderById
36
+ x-eventcatalog-message-type: query
37
+ parameters:
38
+ - name: orderId
39
+ in: path
40
+ required: true
41
+ schema:
42
+ type: string
43
+ responses:
44
+ '200':
45
+ description: Order details
46
+ content:
47
+ application/json:
48
+ schema:
49
+ $ref: '#/components/schemas/Order'
50
+ '404':
51
+ description: Order not found
52
+ content:
53
+ application/json:
54
+ schema:
55
+ $ref: '#/components/schemas/ErrorResponse'
56
+ '500':
57
+ description: Internal server error
58
+ content:
59
+ application/json:
60
+ schema:
61
+ $ref: '#/components/schemas/ErrorResponse'
62
+ patch:
63
+ summary: Update order status
64
+ description: Update the status of an order (e.g., cancel).
65
+ x-eventcatalog-message-type: command
66
+ parameters:
67
+ - name: orderId
68
+ in: path
69
+ required: true
70
+ schema:
71
+ type: string
72
+ requestBody:
73
+ description: Updated order status
74
+ required: true
75
+ content:
76
+ application/json:
77
+ schema:
78
+ type: object
79
+ properties:
80
+ status:
81
+ type: string
82
+ enum: [pending, shipped, delivered, canceled]
83
+ responses:
84
+ '200':
85
+ description: Order status updated
86
+ '404':
87
+ description: Order not found
88
+ content:
89
+ application/json:
90
+ schema:
91
+ $ref: '#/components/schemas/ErrorResponse'
92
+ '500':
93
+ description: Internal server error
94
+ content:
95
+ application/json:
96
+ schema:
97
+ $ref: '#/components/schemas/ErrorResponse'
98
+ components:
99
+ schemas:
100
+ Order:
101
+ type: object
102
+ properties:
103
+ id:
104
+ type: string
105
+ items:
106
+ type: array
107
+ items:
108
+ $ref: '#/components/schemas/CartItem'
109
+ status:
110
+ type: string
111
+ enum: [pending, shipped, delivered, canceled]
112
+ totalAmount:
113
+ type: number
114
+ format: float
115
+ required:
116
+ - id
117
+ - items
118
+ - status
119
+ - totalAmount
120
+ CartItem:
121
+ type: object
122
+ properties:
123
+ productId:
124
+ type: string
125
+ name:
126
+ type: string
127
+ quantity:
128
+ type: integer
129
+ price:
130
+ type: number
131
+ format: float
132
+ required:
133
+ - productId
134
+ - name
135
+ - quantity
136
+ - price
137
+ ErrorResponse:
138
+ type: object
139
+ properties:
140
+ code:
141
+ type: integer
142
+ description: Error code representing the issue
143
+ message:
144
+ type: string
145
+ description: A description of the error
146
+ required:
147
+ - code
148
+ - message
@@ -0,0 +1,93 @@
1
+ openapi: 3.0.0
2
+ info:
3
+ title: Order History API
4
+ description: API for retrieving a history of past orders.
5
+ version: 1.0.0
6
+ servers:
7
+ - url: https://api.yourshoppingapp.com/order-history
8
+ description: Order History API Server
9
+ paths:
10
+ /:
11
+ get:
12
+ summary: Retrieve order history
13
+ description: Fetch a list of past orders with optional filters like date range and status.
14
+ x-eventcatalog-message-type: query
15
+ operationId: getOrderHistory
16
+ parameters:
17
+ - name: startDate
18
+ in: query
19
+ description: Start date for the order history range (YYYY-MM-DD)
20
+ schema:
21
+ type: string
22
+ format: date
23
+ - name: endDate
24
+ in: query
25
+ description: End date for the order history range (YYYY-MM-DD)
26
+ schema:
27
+ type: string
28
+ format: date
29
+ - name: status
30
+ in: query
31
+ description: Filter orders by status (pending, shipped, delivered, canceled)
32
+ schema:
33
+ type: string
34
+ enum: [pending, shipped, delivered, canceled]
35
+ - name: customerId
36
+ in: query
37
+ description: Customer ID for retrieving specific customer order history (optional if authenticated user)
38
+ schema:
39
+ type: string
40
+ responses:
41
+ '200':
42
+ description: A list of past orders
43
+ content:
44
+ application/json:
45
+ schema:
46
+ type: array
47
+ items:
48
+ $ref: '#/components/schemas/Order'
49
+ '400':
50
+ description: Invalid date range or other input
51
+ components:
52
+ schemas:
53
+ Order:
54
+ type: object
55
+ properties:
56
+ id:
57
+ type: string
58
+ items:
59
+ type: array
60
+ items:
61
+ $ref: '#/components/schemas/CartItem'
62
+ status:
63
+ type: string
64
+ enum: [pending, shipped, delivered, canceled]
65
+ totalAmount:
66
+ type: number
67
+ format: float
68
+ orderDate:
69
+ type: string
70
+ format: date
71
+ required:
72
+ - id
73
+ - items
74
+ - status
75
+ - totalAmount
76
+ - orderDate
77
+ CartItem:
78
+ type: object
79
+ properties:
80
+ productId:
81
+ type: string
82
+ name:
83
+ type: string
84
+ quantity:
85
+ type: integer
86
+ price:
87
+ type: number
88
+ format: float
89
+ required:
90
+ - productId
91
+ - name
92
+ - quantity
93
+ - price
@@ -0,0 +1,74 @@
1
+ openapi: 3.0.0
2
+ info:
3
+ title: Payment API
4
+ description: API for handling payment transactions.
5
+ version: 1.0.0
6
+ servers:
7
+ - url: https://api.yourshoppingapp.com/payments
8
+ description: Payment API Server
9
+ paths:
10
+ /:
11
+ post:
12
+ summary: Initiate payment
13
+ description: Start a payment process for an order.
14
+ x-eventcatalog-message-type: command
15
+ operationId: initiatePayment
16
+ requestBody:
17
+ description: Payment details
18
+ required: true
19
+ content:
20
+ application/json:
21
+ schema:
22
+ $ref: '#/components/schemas/PaymentRequest'
23
+ responses:
24
+ '201':
25
+ description: Payment initiated
26
+ '400':
27
+ description: Invalid payment request
28
+ /{paymentId}:
29
+ get:
30
+ summary: Get payment status
31
+ operationId: getPaymentStatus
32
+ description: Check the status of a specific payment by its ID.
33
+ x-eventcatalog-message-type: query
34
+ parameters:
35
+ - name: paymentId
36
+ in: path
37
+ required: true
38
+ schema:
39
+ type: string
40
+ responses:
41
+ '200':
42
+ description: Payment status details
43
+ content:
44
+ application/json:
45
+ schema:
46
+ $ref: '#/components/schemas/PaymentStatus'
47
+ components:
48
+ schemas:
49
+ PaymentRequest:
50
+ type: object
51
+ properties:
52
+ orderId:
53
+ type: string
54
+ amount:
55
+ type: number
56
+ format: float
57
+ paymentMethod:
58
+ type: string
59
+ enum: [credit_card, paypal, bank_transfer]
60
+ required:
61
+ - orderId
62
+ - amount
63
+ - paymentMethod
64
+ PaymentStatus:
65
+ type: object
66
+ properties:
67
+ id:
68
+ type: string
69
+ status:
70
+ type: string
71
+ enum: [pending, successful, failed]
72
+ required:
73
+ - id
74
+ - status