@eventcatalog/create-eventcatalog 2.2.0 → 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 (31) hide show
  1. package/dist/index.js +20 -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/default/npmrc +1 -0
  16. package/templates/empty/npmrc +1 -0
  17. package/templates/index.ts +11 -0
  18. package/templates/openapi/Dockerfile +23 -0
  19. package/templates/openapi/README-template.md +1 -0
  20. package/templates/openapi/dockerignore +8 -0
  21. package/templates/openapi/eventcatalog.config.js +60 -0
  22. package/templates/openapi/eventcatalog.styles.css +1 -0
  23. package/templates/openapi/gitignore +24 -0
  24. package/templates/openapi/npmrc +1 -0
  25. package/templates/openapi/openapi-files/cart-api.yml +107 -0
  26. package/templates/openapi/openapi-files/order-api.yml +148 -0
  27. package/templates/openapi/openapi-files/order-history.yml +93 -0
  28. package/templates/openapi/openapi-files/payment-api.yml +74 -0
  29. package/templates/openapi/openapi-files/product-api.yml +68 -0
  30. package/templates/openapi/public/logo.png +0 -0
  31. package/templates/types.ts +1 -1
package/dist/index.js CHANGED
@@ -22466,7 +22466,7 @@ var import_os2 = __toESM(require("os"));
22466
22466
  var package_default = {
22467
22467
  name: "@eventcatalog/create-eventcatalog",
22468
22468
  description: "Create EventCatalog with one command",
22469
- version: "2.2.0",
22469
+ version: "2.2.2",
22470
22470
  bin: {
22471
22471
  "create-catalog": "./dist/index.js"
22472
22472
  },
@@ -22576,6 +22576,12 @@ var installTemplate = async ({
22576
22576
  const dependencies = [
22577
22577
  "@eventcatalog/core"
22578
22578
  ];
22579
+ if (template === "asyncapi") {
22580
+ dependencies.push("@eventcatalog/generator-asyncapi");
22581
+ }
22582
+ if (template === "openapi") {
22583
+ dependencies.push("@eventcatalog/generator-openapi");
22584
+ }
22579
22585
  const devDependencies = [];
22580
22586
  if (dependencies.length) {
22581
22587
  console.log();
@@ -22603,6 +22609,7 @@ var installTemplate = async ({
22603
22609
  switch (name) {
22604
22610
  case "env":
22605
22611
  case "gitignore":
22612
+ case "npmrc":
22606
22613
  case "dockerignore":
22607
22614
  case "eslintrc.json": {
22608
22615
  return ".".concat(name);
@@ -22640,11 +22647,12 @@ async function createApp({
22640
22647
  eslint,
22641
22648
  experimentalApp,
22642
22649
  organizationName: organizationName2,
22643
- initEmptyProject
22650
+ initEmptyProject,
22651
+ template: templateName
22644
22652
  }) {
22645
22653
  let repoInfo;
22646
22654
  const mode = typescript ? "ts" : "js";
22647
- const template = initEmptyProject ? "empty" : "default";
22655
+ const template = initEmptyProject ? "empty" : templateName || "default";
22648
22656
  const root = import_path10.default.resolve(appPath);
22649
22657
  if (!await isWriteable(import_path10.default.dirname(root))) {
22650
22658
  console.error(
@@ -22809,6 +22817,12 @@ var program = new import_commander.default.Command(package_default.name).version
22809
22817
 
22810
22818
  The organization name.
22811
22819
  `
22820
+ ).option(
22821
+ "--template [name]",
22822
+ `
22823
+
22824
+ The template to use.
22825
+ `
22812
22826
  ).option(
22813
22827
  "--empty",
22814
22828
  `
@@ -22866,6 +22880,7 @@ Run ${import_chalk5.default.cyan(`${program.name()} --help`)} to see all options
22866
22880
  organizationName = res.organizationName.trim();
22867
22881
  }
22868
22882
  }
22883
+ const template = program.template || "default";
22869
22884
  const resolvedProjectPath = import_path11.default.resolve(projectPath);
22870
22885
  const projectName = import_path11.default.basename(resolvedProjectPath);
22871
22886
  const { valid, problems } = validateNpmName(projectName);
@@ -22897,7 +22912,8 @@ Run ${import_chalk5.default.cyan(`${program.name()} --help`)} to see all options
22897
22912
  eslint: true,
22898
22913
  experimentalApp: false,
22899
22914
  organizationName,
22900
- initEmptyProject
22915
+ initEmptyProject,
22916
+ template
22901
22917
  });
22902
22918
  } catch (reason) {
22903
22919
  if (!(reason instanceof DownloadError)) {
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": "2.2.0",
4
+ "version": "2.2.2",
5
5
  "bin": {
6
6
  "create-catalog": "./dist/index.js"
7
7
  },
@@ -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,44 @@
1
+ UserSignedUp:
2
+ name: UserSignedUp
3
+ title: User signup
4
+ summary: Action to sign a user up.
5
+ description: A longer description of the signup process
6
+ contentType: application/json
7
+ payload:
8
+ type: object
9
+ properties:
10
+ fullName:
11
+ description: 'The full name of the user.'
12
+ type: string
13
+ example: 'John Doe'
14
+ email:
15
+ description: "User's email address."
16
+ type: string
17
+ format: email
18
+ example: 'john.doe@example.com'
19
+ password:
20
+ description: "User's account password."
21
+ type: string
22
+ format: password
23
+ minLength: 8
24
+ example: 'password123'
25
+ dateOfBirth:
26
+ description: "User's date of birth."
27
+ type: string
28
+ format: date
29
+ example: '1990-01-01'
30
+ phoneNumber:
31
+ description: "User's phone number (optional)."
32
+ type: string
33
+ pattern: "^\\+?[1-9]\\d{1,14}$"
34
+ example: '+1234567890'
35
+ termsAccepted:
36
+ description: 'Whether the user has accepted the terms and conditions.'
37
+ type: boolean
38
+ example: true
39
+ required:
40
+ - fullName
41
+ - email
42
+ - password
43
+ - termsAccepted
44
+ additionalProperties: false
@@ -0,0 +1,272 @@
1
+ asyncapi: 3.0.0
2
+ info:
3
+ title: Orders Service
4
+ version: 1.0.1
5
+ description: This service is in charge of processing orders
6
+
7
+ operations:
8
+ sendOrderCreated:
9
+ action: send
10
+ channel:
11
+ $ref: '#/channels/orderCreated'
12
+ messages:
13
+ - $ref: '#/channels/orderCreated/messages/OrderCreated'
14
+
15
+ sendOrderUpdated:
16
+ action: send
17
+ channel:
18
+ $ref: '#/channels/orderUpdated'
19
+ messages:
20
+ - $ref: '#/channels/orderUpdated/messages/OrderUpdated'
21
+
22
+ sendOrderCancelled:
23
+ action: send
24
+ channel:
25
+ $ref: '#/channels/orderCancelled'
26
+ messages:
27
+ - $ref: '#/channels/orderCancelled/messages/OrderCancelled'
28
+
29
+ sendOrderCompleted:
30
+ action: send
31
+ channel:
32
+ $ref: '#/channels/orderCompleted'
33
+ messages:
34
+ - $ref: '#/channels/orderCompleted/messages/OrderCompleted'
35
+
36
+ receivePaymentProcessed:
37
+ action: receive
38
+ channel:
39
+ $ref: '#/channels/paymentProcessed'
40
+ messages:
41
+ - $ref: '#/channels/paymentProcessed/messages/PaymentProcessed'
42
+
43
+ receiveInventoryReserved:
44
+ action: receive
45
+ channel:
46
+ $ref: '#/channels/inventoryReserved'
47
+ messages:
48
+ - $ref: '#/channels/inventoryReserved/messages/InventoryReserved'
49
+
50
+ receiveShipmentDelivered:
51
+ action: receive
52
+ channel:
53
+ $ref: '#/channels/shipmentDelivered'
54
+ messages:
55
+ - $ref: '#/channels/shipmentDelivered/messages/ShipmentDelivered'
56
+
57
+ channels:
58
+ orderCreated:
59
+ address: order/created
60
+ messages:
61
+ OrderCreated:
62
+ $ref: '#/components/messages/OrderCreated'
63
+
64
+ orderUpdated:
65
+ address: order/updated
66
+ messages:
67
+ OrderUpdated:
68
+ $ref: '#/components/messages/OrderUpdated'
69
+
70
+ orderCancelled:
71
+ address: order/cancelled
72
+ messages:
73
+ OrderCancelled:
74
+ $ref: '#/components/messages/OrderCancelled'
75
+
76
+ orderCompleted:
77
+ address: order/completed
78
+ messages:
79
+ OrderCompleted:
80
+ $ref: '#/components/messages/OrderCompleted'
81
+
82
+ paymentProcessed:
83
+ address: payment/processed
84
+ messages:
85
+ PaymentProcessed:
86
+ $ref: '#/components/messages/PaymentProcessed'
87
+
88
+ inventoryReserved:
89
+ address: inventory/reserved
90
+ messages:
91
+ InventoryReserved:
92
+ $ref: '#/components/messages/InventoryReserved'
93
+
94
+ shipmentDelivered:
95
+ address: shipment/delivered
96
+ messages:
97
+ ShipmentDelivered:
98
+ $ref: '#/components/messages/ShipmentDelivered'
99
+
100
+ components:
101
+ messages:
102
+ OrderCreated:
103
+ description: 'Event triggered when an order is created'
104
+ x-eventcatalog-message-type: event
105
+ headers:
106
+ type: object
107
+ properties:
108
+ ec-message-type:
109
+ type: string
110
+ default: event
111
+ description: Type of message for EventCatalog
112
+ payload:
113
+ type: object
114
+ properties:
115
+ orderId:
116
+ type: string
117
+ description: Unique identifier for the order
118
+ userId:
119
+ type: string
120
+ description: Unique identifier for the user who placed the order
121
+ totalAmount:
122
+ type: number
123
+ format: float
124
+ description: Total amount of the order
125
+ items:
126
+ type: array
127
+ description: List of items in the order
128
+ items:
129
+ type: object
130
+ properties:
131
+ itemId:
132
+ type: string
133
+ description: Unique identifier for the item
134
+ quantity:
135
+ type: integer
136
+ description: Quantity of the item ordered
137
+ price:
138
+ type: number
139
+ format: float
140
+ description: Price of the item
141
+
142
+ OrderUpdated:
143
+ description: 'Event triggered when an order is updated'
144
+ x-eventcatalog-message-type: event
145
+ headers:
146
+ type: object
147
+ properties:
148
+ ec-message-type:
149
+ type: string
150
+ default: event
151
+ description: Type of message for EventCatalog
152
+ payload:
153
+ type: object
154
+ properties:
155
+ orderId:
156
+ type: string
157
+ description: Unique identifier for the order
158
+ updatedFields:
159
+ type: object
160
+ description: Fields that were updated in the order
161
+ additionalProperties: true
162
+
163
+ OrderCancelled:
164
+ description: 'Event triggered when an order is cancelled'
165
+ x-eventcatalog-message-type: event
166
+ headers:
167
+ type: object
168
+ properties:
169
+ ec-message-type:
170
+ type: string
171
+ default: event
172
+ description: Type of message for EventCatalog
173
+ payload:
174
+ type: object
175
+ properties:
176
+ orderId:
177
+ type: string
178
+ description: Unique identifier for the order
179
+ reason:
180
+ type: string
181
+ description: Reason for the order cancellation
182
+
183
+ OrderCompleted:
184
+ description: 'Event triggered when an order is completed'
185
+ x-eventcatalog-message-type: event
186
+ headers:
187
+ type: object
188
+ properties:
189
+ ec-message-type:
190
+ type: string
191
+ default: event
192
+ description: Type of message for EventCatalog
193
+ payload:
194
+ type: object
195
+ properties:
196
+ orderId:
197
+ type: string
198
+ description: Unique identifier for the order
199
+ completionTime:
200
+ type: string
201
+ format: date-time
202
+ description: Time when the order was completed
203
+
204
+ PaymentProcessed:
205
+ description: 'Event triggered when a payment is processed'
206
+ x-eventcatalog-message-type: event
207
+ headers:
208
+ type: object
209
+ properties:
210
+ ec-message-type:
211
+ type: string
212
+ default: event
213
+ description: Type of message for EventCatalog
214
+ payload:
215
+ type: object
216
+ properties:
217
+ orderId:
218
+ type: string
219
+ description: Unique identifier for the order
220
+ paymentId:
221
+ type: string
222
+ description: Unique identifier for the payment
223
+ status:
224
+ type: string
225
+ description: Status of the payment
226
+
227
+ InventoryReserved:
228
+ description: 'Event triggered when inventory is reserved for an order'
229
+ x-eventcatalog-message-type: event
230
+ headers:
231
+ type: object
232
+ properties:
233
+ ec-message-type:
234
+ type: string
235
+ default: event
236
+ description: Type of message for EventCatalog
237
+ payload:
238
+ type: object
239
+ properties:
240
+ orderId:
241
+ type: string
242
+ description: Unique identifier for the order
243
+ reservationId:
244
+ type: string
245
+ description: Unique identifier for the inventory reservation
246
+ status:
247
+ type: string
248
+ description: Status of the inventory reservation
249
+
250
+ ShipmentDelivered:
251
+ description: 'Event triggered when a shipment is delivered'
252
+ x-eventcatalog-message-type: event
253
+ headers:
254
+ type: object
255
+ properties:
256
+ ec-message-type:
257
+ type: string
258
+ default: event
259
+ description: Type of message for EventCatalog
260
+ payload:
261
+ type: object
262
+ properties:
263
+ orderId:
264
+ type: string
265
+ description: Unique identifier for the order
266
+ shipmentId:
267
+ type: string
268
+ description: Unique identifier for the shipment
269
+ deliveryTime:
270
+ type: string
271
+ format: date-time
272
+ description: Time when the shipment was delivered
@@ -0,0 +1,245 @@
1
+ asyncapi: 3.0.0
2
+ info:
3
+ title: Payments Service
4
+ version: 1.0.2
5
+ description: This service handles the payment processing for various transactions.
6
+
7
+ operations:
8
+ sendPaymentInitiated:
9
+ action: send
10
+ channel:
11
+ $ref: '#/channels/paymentInitiated'
12
+ messages:
13
+ - $ref: '#/channels/paymentInitiated/messages/PaymentInitiated'
14
+
15
+ sendPaymentConfirmed:
16
+ action: send
17
+ channel:
18
+ $ref: '#/channels/paymentConfirmed'
19
+ messages:
20
+ - $ref: '#/channels/paymentConfirmed/messages/PaymentConfirmed'
21
+
22
+ sendPaymentFailed:
23
+ action: send
24
+ channel:
25
+ $ref: '#/channels/paymentFailed'
26
+ messages:
27
+ - $ref: '#/channels/paymentFailed/messages/PaymentFailed'
28
+
29
+ sendRefundInitiated:
30
+ action: send
31
+ channel:
32
+ $ref: '#/channels/refundInitiated'
33
+ messages:
34
+ - $ref: '#/channels/refundInitiated/messages/RefundInitiated'
35
+
36
+ sendRefundCompleted:
37
+ action: send
38
+ channel:
39
+ $ref: '#/channels/refundCompleted'
40
+ messages:
41
+ - $ref: '#/channels/refundCompleted/messages/RefundCompleted'
42
+
43
+ receiveTransactionVerified:
44
+ action: receive
45
+ channel:
46
+ $ref: '#/channels/transactionVerified'
47
+ messages:
48
+ - $ref: '#/channels/transactionVerified/messages/TransactionVerified'
49
+
50
+ channels:
51
+ paymentInitiated:
52
+ address: payment/initiated
53
+ messages:
54
+ PaymentInitiated:
55
+ $ref: '#/components/messages/PaymentInitiated'
56
+
57
+ paymentConfirmed:
58
+ address: payment/confirmed
59
+ messages:
60
+ PaymentConfirmed:
61
+ $ref: '#/components/messages/PaymentConfirmed'
62
+
63
+ paymentFailed:
64
+ address: payment/failed
65
+ messages:
66
+ PaymentFailed:
67
+ $ref: '#/components/messages/PaymentFailed'
68
+
69
+ refundInitiated:
70
+ address: refund/initiated
71
+ messages:
72
+ RefundInitiated:
73
+ $ref: '#/components/messages/RefundInitiated'
74
+
75
+ refundCompleted:
76
+ address: refund/completed
77
+ messages:
78
+ RefundCompleted:
79
+ $ref: '#/components/messages/RefundCompleted'
80
+
81
+ transactionVerified:
82
+ address: transaction/verified
83
+ messages:
84
+ TransactionVerified:
85
+ $ref: '#/components/messages/TransactionVerified'
86
+
87
+ components:
88
+ messages:
89
+ PaymentInitiated:
90
+ description: 'Event triggered when a payment is initiated'
91
+ x-eventcatalog-message-type: event
92
+ headers:
93
+ type: object
94
+ properties:
95
+ ec-message-type:
96
+ type: string
97
+ default: event
98
+ description: Type of message for EventCatalog
99
+ payload:
100
+ type: object
101
+ properties:
102
+ paymentId:
103
+ type: string
104
+ description: Unique identifier for the payment
105
+ orderId:
106
+ type: string
107
+ description: Unique identifier for the related order
108
+ amount:
109
+ type: number
110
+ format: float
111
+ description: Amount to be paid
112
+ currency:
113
+ type: string
114
+ description: Currency in which the payment is made
115
+
116
+ PaymentConfirmed:
117
+ description: 'Event triggered when a payment is confirmed'
118
+ x-eventcatalog-message-type: event
119
+ headers:
120
+ type: object
121
+ properties:
122
+ ec-message-type:
123
+ type: string
124
+ default: event
125
+ description: Type of message for EventCatalog
126
+ payload:
127
+ type: object
128
+ properties:
129
+ paymentId:
130
+ type: string
131
+ description: Unique identifier for the payment
132
+ orderId:
133
+ type: string
134
+ description: Unique identifier for the related order
135
+ confirmationTime:
136
+ type: string
137
+ format: date-time
138
+ description: Time when the payment was confirmed
139
+ status:
140
+ type: string
141
+ description: Status of the payment confirmation
142
+
143
+ PaymentFailed:
144
+ description: 'Event triggered when a payment fails'
145
+ x-eventcatalog-message-type: event
146
+ headers:
147
+ type: object
148
+ properties:
149
+ ec-message-type:
150
+ type: string
151
+ default: event
152
+ description: Type of message for EventCatalog
153
+ payload:
154
+ type: object
155
+ properties:
156
+ paymentId:
157
+ type: string
158
+ description: Unique identifier for the payment
159
+ orderId:
160
+ type: string
161
+ description: Unique identifier for the related order
162
+ failureReason:
163
+ type: string
164
+ description: Reason for the payment failure
165
+
166
+ RefundInitiated:
167
+ description: 'Event triggered when a refund is initiated'
168
+ x-eventcatalog-message-type: event
169
+ headers:
170
+ type: object
171
+ properties:
172
+ ec-message-type:
173
+ type: string
174
+ default: event
175
+ description: Type of message for EventCatalog
176
+ payload:
177
+ type: object
178
+ properties:
179
+ refundId:
180
+ type: string
181
+ description: Unique identifier for the refund
182
+ paymentId:
183
+ type: string
184
+ description: Unique identifier for the related payment
185
+ amount:
186
+ type: number
187
+ format: float
188
+ description: Amount to be refunded
189
+ currency:
190
+ type: string
191
+ description: Currency in which the refund is made
192
+ createdAt:
193
+ type: string
194
+ description: ISO Date String of when the refund was initiated
195
+
196
+ RefundCompleted:
197
+ description: 'Event triggered when a refund is completed'
198
+ x-eventcatalog-message-type: event
199
+ headers:
200
+ type: object
201
+ properties:
202
+ ec-message-type:
203
+ type: string
204
+ default: event
205
+ description: Type of message for EventCatalog
206
+ payload:
207
+ type: object
208
+ properties:
209
+ refundId:
210
+ type: string
211
+ description: Unique identifier for the refund
212
+ paymentId:
213
+ type: string
214
+ description: Unique identifier for the related payment
215
+ completionTime:
216
+ type: string
217
+ format: date-time
218
+ description: Time when the refund was completed
219
+ status:
220
+ type: string
221
+ description: Status of the refund process
222
+
223
+ TransactionVerified:
224
+ description: 'Command triggered when a transaction is verified'
225
+ x-eventcatalog-message-type: command
226
+ headers:
227
+ type: object
228
+ properties:
229
+ ec-message-type:
230
+ type: string
231
+ default: command
232
+ description: Type of message for EventCatalog
233
+ payload:
234
+ type: object
235
+ properties:
236
+ transactionId:
237
+ type: string
238
+ description: Unique identifier for the transaction
239
+ verificationTime:
240
+ type: string
241
+ format: date-time
242
+ description: Time when the transaction was verified
243
+ status:
244
+ type: string
245
+ description: Verification status of the transaction
@@ -0,0 +1,23 @@
1
+ asyncapi: 3.0.0
2
+ info:
3
+ title: USService
4
+ description: description
5
+ version: 1.1.0
6
+
7
+ channels:
8
+ randomChannel:
9
+ address: myAddress
10
+ messages:
11
+ UserSignup:
12
+ $ref: '#/components/schemas/UserSignedUp/schema'
13
+ operations:
14
+ sendNoise:
15
+ action: send
16
+ channel:
17
+ $ref: '#/channels/randomChannel'
18
+ components:
19
+ schemas:
20
+ UserSignedUp:
21
+ schemaFormat: 'application/schema+json;version=draft-07'
22
+ schema:
23
+ '$ref': './messages/user-signed-up.yml#/UserSignedUp'
@@ -0,0 +1,8 @@
1
+ .eventcatalog-core/
2
+ .git/
3
+ dist/
4
+ node_modules/
5
+ .gitignore
6
+ .dockerignore
7
+ Dockerfile
8
+ README.md