@mintlify/scraping 4.0.175 → 4.0.177
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/__test__/fixtures/complexAsyncAPI.yml +257 -0
- package/__test__/fixtures/emptyAsyncAPI.yml +6 -0
- package/__test__/fixtures/simpleAsyncAPI.yml +110 -0
- package/__test__/fixtures/withTagsAsyncAPI.yml +135 -0
- package/__test__/generateAsyncApiPagesForDocsConfig.test.ts +138 -0
- package/bin/apiPages/common.js +1 -1
- package/bin/apiPages/common.js.map +1 -1
- package/bin/asyncapi/generateAsyncApiPagesForDocsConfig.d.ts +20 -0
- package/bin/asyncapi/generateAsyncApiPagesForDocsConfig.js +54 -0
- package/bin/asyncapi/generateAsyncApiPagesForDocsConfig.js.map +1 -0
- package/bin/asyncapi/processAsyncApiChannel.js +8 -6
- package/bin/asyncapi/processAsyncApiChannel.js.map +1 -1
- package/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/bin/index.js.map +1 -1
- package/bin/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/apiPages/common.ts +1 -1
- package/src/asyncapi/generateAsyncApiPagesForDocsConfig.ts +88 -0
- package/src/asyncapi/processAsyncApiChannel.ts +8 -6
- package/src/index.ts +1 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
asyncapi: 3.0.0
|
|
2
|
+
info:
|
|
3
|
+
title: User Service
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
description: This service handles user-related events and operations
|
|
6
|
+
license:
|
|
7
|
+
name: Apache 2.0
|
|
8
|
+
url: https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
servers:
|
|
11
|
+
production:
|
|
12
|
+
host: mqtt://api.example.com
|
|
13
|
+
protocol: mqtt
|
|
14
|
+
description: Production server
|
|
15
|
+
development:
|
|
16
|
+
host: mqtt://dev.example.com
|
|
17
|
+
protocol: mqtt
|
|
18
|
+
description: Development server
|
|
19
|
+
|
|
20
|
+
channels:
|
|
21
|
+
userEvents:
|
|
22
|
+
address: user/events
|
|
23
|
+
messages:
|
|
24
|
+
userCreatedMessage:
|
|
25
|
+
$ref: '#/components/messages/UserCreated'
|
|
26
|
+
userUpdatedMessage:
|
|
27
|
+
$ref: '#/components/messages/UserUpdated'
|
|
28
|
+
description: Used for broadcasting user creation and update events
|
|
29
|
+
userCommands:
|
|
30
|
+
address: user/commands
|
|
31
|
+
messages:
|
|
32
|
+
createUserMessage:
|
|
33
|
+
$ref: '#/components/messages/CreateUser'
|
|
34
|
+
updateUserMessage:
|
|
35
|
+
$ref: '#/components/messages/UpdateUser'
|
|
36
|
+
description: Used for sending commands to create or update users
|
|
37
|
+
notifications:
|
|
38
|
+
address: notifications
|
|
39
|
+
messages:
|
|
40
|
+
emailNotificationMessage:
|
|
41
|
+
$ref: '#/components/messages/EmailNotification'
|
|
42
|
+
description: Used for email notification events
|
|
43
|
+
|
|
44
|
+
operations:
|
|
45
|
+
# UserEvents channel operations - both send and receive on same channel
|
|
46
|
+
publishUserCreated:
|
|
47
|
+
action: send
|
|
48
|
+
channel:
|
|
49
|
+
$ref: '#/channels/userEvents'
|
|
50
|
+
messages:
|
|
51
|
+
- $ref: '#/channels/userEvents/messages/userCreatedMessage'
|
|
52
|
+
consumeUserCreated:
|
|
53
|
+
action: receive
|
|
54
|
+
channel:
|
|
55
|
+
$ref: '#/channels/userEvents'
|
|
56
|
+
messages:
|
|
57
|
+
- $ref: '#/channels/userEvents/messages/userCreatedMessage'
|
|
58
|
+
publishUserUpdated:
|
|
59
|
+
action: send
|
|
60
|
+
channel:
|
|
61
|
+
$ref: '#/channels/userEvents'
|
|
62
|
+
messages:
|
|
63
|
+
- $ref: '#/channels/userEvents/messages/userUpdatedMessage'
|
|
64
|
+
consumeUserUpdated:
|
|
65
|
+
action: receive
|
|
66
|
+
channel:
|
|
67
|
+
$ref: '#/channels/userEvents'
|
|
68
|
+
messages:
|
|
69
|
+
- $ref: '#/channels/userEvents/messages/userUpdatedMessage'
|
|
70
|
+
|
|
71
|
+
# UserCommands channel operations - both send and receive on same channel
|
|
72
|
+
sendCreateUserCommand:
|
|
73
|
+
action: send
|
|
74
|
+
channel:
|
|
75
|
+
$ref: '#/channels/userCommands'
|
|
76
|
+
messages:
|
|
77
|
+
- $ref: '#/channels/userCommands/messages/createUserMessage'
|
|
78
|
+
receiveCreateUserCommand:
|
|
79
|
+
action: receive
|
|
80
|
+
channel:
|
|
81
|
+
$ref: '#/channels/userCommands'
|
|
82
|
+
messages:
|
|
83
|
+
- $ref: '#/channels/userCommands/messages/createUserMessage'
|
|
84
|
+
sendUpdateUserCommand:
|
|
85
|
+
action: send
|
|
86
|
+
channel:
|
|
87
|
+
$ref: '#/channels/userCommands'
|
|
88
|
+
messages:
|
|
89
|
+
- $ref: '#/channels/userCommands/messages/updateUserMessage'
|
|
90
|
+
receiveUpdateUserCommand:
|
|
91
|
+
action: receive
|
|
92
|
+
channel:
|
|
93
|
+
$ref: '#/channels/userCommands'
|
|
94
|
+
messages:
|
|
95
|
+
- $ref: '#/channels/userCommands/messages/updateUserMessage'
|
|
96
|
+
|
|
97
|
+
# Notifications channel operations
|
|
98
|
+
sendEmailNotification:
|
|
99
|
+
action: send
|
|
100
|
+
channel:
|
|
101
|
+
$ref: '#/channels/notifications'
|
|
102
|
+
messages:
|
|
103
|
+
- $ref: '#/channels/notifications/messages/emailNotificationMessage'
|
|
104
|
+
receiveEmailNotification:
|
|
105
|
+
action: receive
|
|
106
|
+
channel:
|
|
107
|
+
$ref: '#/channels/notifications'
|
|
108
|
+
messages:
|
|
109
|
+
- $ref: '#/channels/notifications/messages/emailNotificationMessage'
|
|
110
|
+
|
|
111
|
+
components:
|
|
112
|
+
messages:
|
|
113
|
+
UserCreated:
|
|
114
|
+
name: userCreated
|
|
115
|
+
title: User created event
|
|
116
|
+
summary: Notification that a new user has been created
|
|
117
|
+
contentType: application/json
|
|
118
|
+
payload:
|
|
119
|
+
$ref: '#/components/schemas/UserCreatedPayload'
|
|
120
|
+
UserUpdated:
|
|
121
|
+
name: userUpdated
|
|
122
|
+
title: User updated event
|
|
123
|
+
summary: Notification that a user has been updated
|
|
124
|
+
contentType: application/json
|
|
125
|
+
payload:
|
|
126
|
+
$ref: '#/components/schemas/UserUpdatedPayload'
|
|
127
|
+
CreateUser:
|
|
128
|
+
name: createUser
|
|
129
|
+
title: Create user command
|
|
130
|
+
summary: Command to create a new user
|
|
131
|
+
contentType: application/json
|
|
132
|
+
payload:
|
|
133
|
+
$ref: '#/components/schemas/CreateUserPayload'
|
|
134
|
+
UpdateUser:
|
|
135
|
+
name: updateUser
|
|
136
|
+
title: Update user command
|
|
137
|
+
summary: Command to update an existing user
|
|
138
|
+
contentType: application/json
|
|
139
|
+
payload:
|
|
140
|
+
$ref: '#/components/schemas/UpdateUserPayload'
|
|
141
|
+
EmailNotification:
|
|
142
|
+
name: emailNotification
|
|
143
|
+
title: Email notification event
|
|
144
|
+
summary: Event indicating an email notification has been sent
|
|
145
|
+
contentType: application/json
|
|
146
|
+
payload:
|
|
147
|
+
$ref: '#/components/schemas/EmailNotificationPayload'
|
|
148
|
+
|
|
149
|
+
schemas:
|
|
150
|
+
UserCreatedPayload:
|
|
151
|
+
type: object
|
|
152
|
+
properties:
|
|
153
|
+
userId:
|
|
154
|
+
type: string
|
|
155
|
+
format: uuid
|
|
156
|
+
description: Unique identifier for the user
|
|
157
|
+
username:
|
|
158
|
+
type: string
|
|
159
|
+
description: Username of the created user
|
|
160
|
+
email:
|
|
161
|
+
type: string
|
|
162
|
+
format: email
|
|
163
|
+
description: Email address of the user
|
|
164
|
+
createdAt:
|
|
165
|
+
type: string
|
|
166
|
+
format: date-time
|
|
167
|
+
description: Timestamp when the user was created
|
|
168
|
+
required:
|
|
169
|
+
- userId
|
|
170
|
+
- username
|
|
171
|
+
- email
|
|
172
|
+
- createdAt
|
|
173
|
+
|
|
174
|
+
UserUpdatedPayload:
|
|
175
|
+
type: object
|
|
176
|
+
properties:
|
|
177
|
+
userId:
|
|
178
|
+
type: string
|
|
179
|
+
format: uuid
|
|
180
|
+
description: Unique identifier for the user
|
|
181
|
+
updatedFields:
|
|
182
|
+
type: array
|
|
183
|
+
items:
|
|
184
|
+
type: string
|
|
185
|
+
description: List of fields that were updated
|
|
186
|
+
updatedAt:
|
|
187
|
+
type: string
|
|
188
|
+
format: date-time
|
|
189
|
+
description: Timestamp when the user was updated
|
|
190
|
+
required:
|
|
191
|
+
- userId
|
|
192
|
+
- updatedFields
|
|
193
|
+
- updatedAt
|
|
194
|
+
|
|
195
|
+
CreateUserPayload:
|
|
196
|
+
type: object
|
|
197
|
+
properties:
|
|
198
|
+
username:
|
|
199
|
+
type: string
|
|
200
|
+
description: Username for the new user
|
|
201
|
+
email:
|
|
202
|
+
type: string
|
|
203
|
+
format: email
|
|
204
|
+
description: Email address for the new user
|
|
205
|
+
firstName:
|
|
206
|
+
type: string
|
|
207
|
+
description: First name of the user
|
|
208
|
+
lastName:
|
|
209
|
+
type: string
|
|
210
|
+
description: Last name of the user
|
|
211
|
+
required:
|
|
212
|
+
- username
|
|
213
|
+
- email
|
|
214
|
+
|
|
215
|
+
UpdateUserPayload:
|
|
216
|
+
type: object
|
|
217
|
+
properties:
|
|
218
|
+
userId:
|
|
219
|
+
type: string
|
|
220
|
+
format: uuid
|
|
221
|
+
description: Unique identifier for the user to update
|
|
222
|
+
firstName:
|
|
223
|
+
type: string
|
|
224
|
+
description: Updated first name
|
|
225
|
+
lastName:
|
|
226
|
+
type: string
|
|
227
|
+
description: Updated last name
|
|
228
|
+
email:
|
|
229
|
+
type: string
|
|
230
|
+
format: email
|
|
231
|
+
description: Updated email address
|
|
232
|
+
required:
|
|
233
|
+
- userId
|
|
234
|
+
|
|
235
|
+
EmailNotificationPayload:
|
|
236
|
+
type: object
|
|
237
|
+
properties:
|
|
238
|
+
recipient:
|
|
239
|
+
type: string
|
|
240
|
+
format: email
|
|
241
|
+
description: Email address of the recipient
|
|
242
|
+
subject:
|
|
243
|
+
type: string
|
|
244
|
+
description: Subject of the email
|
|
245
|
+
sentAt:
|
|
246
|
+
type: string
|
|
247
|
+
format: date-time
|
|
248
|
+
description: Timestamp when the email was sent
|
|
249
|
+
status:
|
|
250
|
+
type: string
|
|
251
|
+
enum: [sent, failed, delivered]
|
|
252
|
+
description: Delivery status of the email
|
|
253
|
+
required:
|
|
254
|
+
- recipient
|
|
255
|
+
- subject
|
|
256
|
+
- sentAt
|
|
257
|
+
- status
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
asyncapi: 3.0.0
|
|
2
|
+
info:
|
|
3
|
+
title: Account Service
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
description: This service is in charge of processing user accounts
|
|
6
|
+
license:
|
|
7
|
+
name: Apache 2.0
|
|
8
|
+
url: https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
servers:
|
|
11
|
+
production:
|
|
12
|
+
host: mqtt://api.example.com
|
|
13
|
+
protocol: mqtt
|
|
14
|
+
description: Production server
|
|
15
|
+
development:
|
|
16
|
+
host: mqtt://dev.example.com
|
|
17
|
+
protocol: mqtt
|
|
18
|
+
description: Development server
|
|
19
|
+
|
|
20
|
+
channels:
|
|
21
|
+
userSignedUp:
|
|
22
|
+
address: user/signedup
|
|
23
|
+
messages:
|
|
24
|
+
userSignedUpMessage:
|
|
25
|
+
$ref: '#/components/messages/UserSignedUp'
|
|
26
|
+
userDeleted:
|
|
27
|
+
address: user/deleted
|
|
28
|
+
messages:
|
|
29
|
+
userDeletedMessage:
|
|
30
|
+
$ref: '#/components/messages/UserDeleted'
|
|
31
|
+
|
|
32
|
+
operations:
|
|
33
|
+
sendUserSignedUp:
|
|
34
|
+
action: send
|
|
35
|
+
channel:
|
|
36
|
+
$ref: '#/channels/userSignedUp'
|
|
37
|
+
messages:
|
|
38
|
+
- $ref: '#/channels/userSignedUp/messages/userSignedUpMessage'
|
|
39
|
+
receiveUserSignedUp:
|
|
40
|
+
action: receive
|
|
41
|
+
channel:
|
|
42
|
+
$ref: '#/channels/userSignedUp'
|
|
43
|
+
messages:
|
|
44
|
+
- $ref: '#/channels/userSignedUp/messages/userSignedUpMessage'
|
|
45
|
+
sendUserDeleted:
|
|
46
|
+
action: send
|
|
47
|
+
channel:
|
|
48
|
+
$ref: '#/channels/userDeleted'
|
|
49
|
+
messages:
|
|
50
|
+
- $ref: '#/channels/userDeleted/messages/userDeletedMessage'
|
|
51
|
+
receiveUserDeleted:
|
|
52
|
+
action: receive
|
|
53
|
+
channel:
|
|
54
|
+
$ref: '#/channels/userDeleted'
|
|
55
|
+
messages:
|
|
56
|
+
- $ref: '#/channels/userDeleted/messages/userDeletedMessage'
|
|
57
|
+
|
|
58
|
+
components:
|
|
59
|
+
messages:
|
|
60
|
+
UserSignedUp:
|
|
61
|
+
name: userSignedUp
|
|
62
|
+
title: User signed up event
|
|
63
|
+
summary: Inform about a new user registration
|
|
64
|
+
contentType: application/json
|
|
65
|
+
payload:
|
|
66
|
+
$ref: '#/components/schemas/UserSignedUpPayload'
|
|
67
|
+
UserDeleted:
|
|
68
|
+
name: userDeleted
|
|
69
|
+
title: User deleted event
|
|
70
|
+
summary: Inform about a user deletion
|
|
71
|
+
contentType: application/json
|
|
72
|
+
payload:
|
|
73
|
+
$ref: '#/components/schemas/UserDeletedPayload'
|
|
74
|
+
|
|
75
|
+
schemas:
|
|
76
|
+
UserSignedUpPayload:
|
|
77
|
+
type: object
|
|
78
|
+
properties:
|
|
79
|
+
id:
|
|
80
|
+
type: string
|
|
81
|
+
format: uuid
|
|
82
|
+
description: User unique identifier
|
|
83
|
+
fullName:
|
|
84
|
+
type: string
|
|
85
|
+
description: User full name
|
|
86
|
+
email:
|
|
87
|
+
type: string
|
|
88
|
+
format: email
|
|
89
|
+
description: User email address
|
|
90
|
+
createdAt:
|
|
91
|
+
type: string
|
|
92
|
+
format: date-time
|
|
93
|
+
description: Datetime when the user was created
|
|
94
|
+
required:
|
|
95
|
+
- id
|
|
96
|
+
- email
|
|
97
|
+
|
|
98
|
+
UserDeletedPayload:
|
|
99
|
+
type: object
|
|
100
|
+
properties:
|
|
101
|
+
id:
|
|
102
|
+
type: string
|
|
103
|
+
format: uuid
|
|
104
|
+
description: User unique identifier
|
|
105
|
+
deletedAt:
|
|
106
|
+
type: string
|
|
107
|
+
format: date-time
|
|
108
|
+
description: Datetime when the user was deleted
|
|
109
|
+
required:
|
|
110
|
+
- id
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
asyncapi: 3.0.0
|
|
2
|
+
info:
|
|
3
|
+
title: Account Service
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
description: This service is in charge of processing user accounts
|
|
6
|
+
license:
|
|
7
|
+
name: Apache 2.0
|
|
8
|
+
url: https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
servers:
|
|
11
|
+
production:
|
|
12
|
+
host: mqtt://api.example.com
|
|
13
|
+
protocol: mqtt
|
|
14
|
+
description: Production server
|
|
15
|
+
development:
|
|
16
|
+
host: mqtt://dev.example.com
|
|
17
|
+
protocol: mqtt
|
|
18
|
+
description: Development server
|
|
19
|
+
|
|
20
|
+
channels:
|
|
21
|
+
userSignedUp:
|
|
22
|
+
address: user/signedup
|
|
23
|
+
messages:
|
|
24
|
+
userSignedUpMessage:
|
|
25
|
+
$ref: '#/components/messages/UserSignedUp'
|
|
26
|
+
tags:
|
|
27
|
+
- name: Users
|
|
28
|
+
userDeleted:
|
|
29
|
+
address: user/deleted
|
|
30
|
+
messages:
|
|
31
|
+
userDeletedMessage:
|
|
32
|
+
$ref: '#/components/messages/UserDeleted'
|
|
33
|
+
tags:
|
|
34
|
+
- name: Users
|
|
35
|
+
anotherChannel:
|
|
36
|
+
address: another/channel
|
|
37
|
+
messages:
|
|
38
|
+
anotherMessage:
|
|
39
|
+
$ref: '#/components/messages/AnotherMessage'
|
|
40
|
+
tags:
|
|
41
|
+
- name: Another
|
|
42
|
+
|
|
43
|
+
operations:
|
|
44
|
+
sendUserSignedUp:
|
|
45
|
+
action: send
|
|
46
|
+
channel:
|
|
47
|
+
$ref: '#/channels/userSignedUp'
|
|
48
|
+
messages:
|
|
49
|
+
- $ref: '#/channels/userSignedUp/messages/userSignedUpMessage'
|
|
50
|
+
receiveUserSignedUp:
|
|
51
|
+
action: receive
|
|
52
|
+
channel:
|
|
53
|
+
$ref: '#/channels/userSignedUp'
|
|
54
|
+
messages:
|
|
55
|
+
- $ref: '#/channels/userSignedUp/messages/userSignedUpMessage'
|
|
56
|
+
sendUserDeleted:
|
|
57
|
+
action: send
|
|
58
|
+
channel:
|
|
59
|
+
$ref: '#/channels/userDeleted'
|
|
60
|
+
messages:
|
|
61
|
+
- $ref: '#/channels/userDeleted/messages/userDeletedMessage'
|
|
62
|
+
receiveUserDeleted:
|
|
63
|
+
action: receive
|
|
64
|
+
channel:
|
|
65
|
+
$ref: '#/channels/userDeleted'
|
|
66
|
+
messages:
|
|
67
|
+
- $ref: '#/channels/userDeleted/messages/userDeletedMessage'
|
|
68
|
+
|
|
69
|
+
components:
|
|
70
|
+
messages:
|
|
71
|
+
UserSignedUp:
|
|
72
|
+
name: userSignedUp
|
|
73
|
+
title: User signed up event
|
|
74
|
+
summary: Inform about a new user registration
|
|
75
|
+
contentType: application/json
|
|
76
|
+
payload:
|
|
77
|
+
$ref: '#/components/schemas/UserSignedUpPayload'
|
|
78
|
+
UserDeleted:
|
|
79
|
+
name: userDeleted
|
|
80
|
+
title: User deleted event
|
|
81
|
+
summary: Inform about a user deletion
|
|
82
|
+
contentType: application/json
|
|
83
|
+
payload:
|
|
84
|
+
$ref: '#/components/schemas/UserDeletedPayload'
|
|
85
|
+
AnotherMessage:
|
|
86
|
+
name: anotherMessage
|
|
87
|
+
title: Another message
|
|
88
|
+
summary: Inform about another message
|
|
89
|
+
contentType: application/json
|
|
90
|
+
payload:
|
|
91
|
+
$ref: '#/components/schemas/AnotherMessagePayload'
|
|
92
|
+
|
|
93
|
+
schemas:
|
|
94
|
+
UserSignedUpPayload:
|
|
95
|
+
type: object
|
|
96
|
+
properties:
|
|
97
|
+
id:
|
|
98
|
+
type: string
|
|
99
|
+
format: uuid
|
|
100
|
+
description: User unique identifier
|
|
101
|
+
fullName:
|
|
102
|
+
type: string
|
|
103
|
+
description: User full name
|
|
104
|
+
email:
|
|
105
|
+
type: string
|
|
106
|
+
format: email
|
|
107
|
+
description: User email address
|
|
108
|
+
createdAt:
|
|
109
|
+
type: string
|
|
110
|
+
format: date-time
|
|
111
|
+
description: Datetime when the user was created
|
|
112
|
+
required:
|
|
113
|
+
- id
|
|
114
|
+
- email
|
|
115
|
+
|
|
116
|
+
UserDeletedPayload:
|
|
117
|
+
type: object
|
|
118
|
+
properties:
|
|
119
|
+
id:
|
|
120
|
+
type: string
|
|
121
|
+
format: uuid
|
|
122
|
+
description: User unique identifier
|
|
123
|
+
deletedAt:
|
|
124
|
+
type: string
|
|
125
|
+
format: date-time
|
|
126
|
+
description: Datetime when the user was deleted
|
|
127
|
+
required:
|
|
128
|
+
- id
|
|
129
|
+
|
|
130
|
+
AnotherMessagePayload:
|
|
131
|
+
type: object
|
|
132
|
+
properties:
|
|
133
|
+
id:
|
|
134
|
+
type: string
|
|
135
|
+
format: uuid
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { DEFAULT_WEBSOCKETS_GROUP_NAME } from '../src/apiPages/common.js';
|
|
2
|
+
import { generateAsyncApiPagesForDocsConfig } from '../src/asyncapi/generateAsyncApiPagesForDocsConfig.js';
|
|
3
|
+
|
|
4
|
+
vi.mock('path', async () => {
|
|
5
|
+
const originalModule = await vi.importActual<typeof import('path')>('path');
|
|
6
|
+
return {
|
|
7
|
+
...originalModule.posix,
|
|
8
|
+
default: {
|
|
9
|
+
...originalModule.posix,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
function getAsyncAPIFixturePath(filename: string): string {
|
|
15
|
+
const filePath = `./__test__/fixtures/${filename}`;
|
|
16
|
+
return filePath;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
describe(generateAsyncApiPagesForDocsConfig, () => {
|
|
20
|
+
it('should throw error for empty channels', async () => {
|
|
21
|
+
const emptyDoc = getAsyncAPIFixturePath('emptyAsyncAPI.yml');
|
|
22
|
+
await expect(generateAsyncApiPagesForDocsConfig(emptyDoc)).rejects.toThrow(
|
|
23
|
+
'No channels defined'
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should generate navigation structure for simple API with default group name', async () => {
|
|
28
|
+
const simpleDoc = getAsyncAPIFixturePath('simpleAsyncAPI.yml');
|
|
29
|
+
const result = await generateAsyncApiPagesForDocsConfig(simpleDoc, {
|
|
30
|
+
asyncApiFilePath: 'simpleAsyncAPI.yml',
|
|
31
|
+
version: '1.0.0',
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
expect(result.nav).toHaveLength(1);
|
|
35
|
+
expect(result.nav[0]).toHaveProperty('group', DEFAULT_WEBSOCKETS_GROUP_NAME);
|
|
36
|
+
expect(result.nav[0]).toHaveProperty('pages');
|
|
37
|
+
expect(result.decoratedNav).toHaveLength(1);
|
|
38
|
+
expect(result.decoratedNav[0]).toHaveProperty('group', DEFAULT_WEBSOCKETS_GROUP_NAME);
|
|
39
|
+
expect(result.decoratedNav[0]).toHaveProperty('pages');
|
|
40
|
+
const expectedPagesAcc = {
|
|
41
|
+
'websockets/usersignedup': {
|
|
42
|
+
asyncapi: '/simpleAsyncAPI.yml userSignedUp',
|
|
43
|
+
title: 'User signed up',
|
|
44
|
+
href: '/websockets/usersignedup',
|
|
45
|
+
description: '',
|
|
46
|
+
version: '1.0.0',
|
|
47
|
+
},
|
|
48
|
+
'websockets/userdeleted': {
|
|
49
|
+
asyncapi: '/simpleAsyncAPI.yml userDeleted',
|
|
50
|
+
title: 'User deleted',
|
|
51
|
+
href: '/websockets/userdeleted',
|
|
52
|
+
description: '',
|
|
53
|
+
version: '1.0.0',
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
expect(Object.keys(result.pagesAcc)).toHaveLength(2);
|
|
58
|
+
expect(result.pagesAcc).toEqual(expect.objectContaining(expectedPagesAcc));
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('should handle custom group names', async () => {
|
|
62
|
+
const withTags = getAsyncAPIFixturePath('withTagsAsyncAPI.yml');
|
|
63
|
+
const result = await generateAsyncApiPagesForDocsConfig(withTags, {
|
|
64
|
+
asyncApiFilePath: 'withTagsAsyncAPI.yml',
|
|
65
|
+
version: '1.0.0',
|
|
66
|
+
});
|
|
67
|
+
expect(result.nav).toHaveLength(2);
|
|
68
|
+
expect(result.nav[0]).toHaveProperty('group', 'Users');
|
|
69
|
+
expect(result.nav[1]).toHaveProperty('group', 'Another');
|
|
70
|
+
const expectedPagesAcc = {
|
|
71
|
+
'users/usersignedup': {
|
|
72
|
+
asyncapi: '/withTagsAsyncAPI.yml userSignedUp',
|
|
73
|
+
title: 'User signed up',
|
|
74
|
+
href: '/users/usersignedup',
|
|
75
|
+
description: '',
|
|
76
|
+
version: '1.0.0',
|
|
77
|
+
},
|
|
78
|
+
'users/userdeleted': {
|
|
79
|
+
asyncapi: '/withTagsAsyncAPI.yml userDeleted',
|
|
80
|
+
title: 'User deleted',
|
|
81
|
+
href: '/users/userdeleted',
|
|
82
|
+
description: '',
|
|
83
|
+
version: '1.0.0',
|
|
84
|
+
},
|
|
85
|
+
'another/anotherchannel': {
|
|
86
|
+
asyncapi: '/withTagsAsyncAPI.yml anotherChannel',
|
|
87
|
+
title: 'Another channel',
|
|
88
|
+
href: '/another/anotherchannel',
|
|
89
|
+
description: '',
|
|
90
|
+
version: '1.0.0',
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
expect(Object.keys(result.pagesAcc)).toHaveLength(3);
|
|
95
|
+
expect(result.pagesAcc).toEqual(expect.objectContaining(expectedPagesAcc));
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('should handle multiple paths and methods', async () => {
|
|
99
|
+
const complexDoc = getAsyncAPIFixturePath('complexAsyncAPI.yml');
|
|
100
|
+
const result = await generateAsyncApiPagesForDocsConfig(complexDoc, {
|
|
101
|
+
asyncApiFilePath: 'complexAsyncAPI.yml',
|
|
102
|
+
version: '1.0.0',
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
expect(result.nav).toHaveLength(1);
|
|
106
|
+
expect(result.nav[0]).toHaveProperty('group', DEFAULT_WEBSOCKETS_GROUP_NAME);
|
|
107
|
+
expect(result.nav[0]).toHaveProperty('pages');
|
|
108
|
+
expect(result.decoratedNav).toHaveLength(1);
|
|
109
|
+
expect(result.decoratedNav[0]).toHaveProperty('group', DEFAULT_WEBSOCKETS_GROUP_NAME);
|
|
110
|
+
expect(result.decoratedNav[0]).toHaveProperty('pages');
|
|
111
|
+
const expectedPagesAcc = {
|
|
112
|
+
'websockets/userevents': {
|
|
113
|
+
asyncapi: '/complexAsyncAPI.yml userEvents',
|
|
114
|
+
title: 'User events',
|
|
115
|
+
description: 'Used for broadcasting user creation and update events',
|
|
116
|
+
version: '1.0.0',
|
|
117
|
+
href: '/websockets/userevents',
|
|
118
|
+
},
|
|
119
|
+
'websockets/usercommands': {
|
|
120
|
+
asyncapi: '/complexAsyncAPI.yml userCommands',
|
|
121
|
+
title: 'User commands',
|
|
122
|
+
description: 'Used for sending commands to create or update users',
|
|
123
|
+
version: '1.0.0',
|
|
124
|
+
href: '/websockets/usercommands',
|
|
125
|
+
},
|
|
126
|
+
'websockets/notifications': {
|
|
127
|
+
asyncapi: '/complexAsyncAPI.yml notifications',
|
|
128
|
+
title: 'Notifications',
|
|
129
|
+
description: 'Used for email notification events',
|
|
130
|
+
version: '1.0.0',
|
|
131
|
+
href: '/websockets/notifications',
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
expect(Object.keys(result.pagesAcc)).toHaveLength(3);
|
|
136
|
+
expect(result.pagesAcc).toEqual(expect.objectContaining(expectedPagesAcc));
|
|
137
|
+
});
|
|
138
|
+
});
|
package/bin/apiPages/common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/apiPages/common.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,sBAAsB,GAAG,eAAe,CAAC;AACtD,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC;AACrD,MAAM,CAAC,MAAM,6BAA6B,GAAG,YAAY,CAAC;AAE1D,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,GAAyC,EACzC,YAAoB,sBAAsB,EACN,EAAE;IACtC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CACpB,CAAC,WAAW,EAAE,EAAE,CACd,OAAO,WAAW,KAAK,QAAQ,IAAI,OAAO,IAAI,WAAW,IAAI,WAAW,CAAC,KAAK,KAAK,SAAS,CAC/F,CAAC;IACF,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,CAAC,OAAO,IAAI,KAAK,CAAC,EAAE,CAAC;QAC/C,MAAM,QAAQ,GAAG;YACf,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,EAAE;SACV,CAAC;QACF,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnB,OAAO,QAAQ,CAAC,KAAK,CAAC;IACxB,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAC,KAAK,CAAC;IACrB,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,GAAY,EAAE,EAAE,CAC7D,GAAG;IACD,CAAC,CAAC,GAAG;SACA,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;SACpB,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,yBAAyB;SAClD,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;SACjB,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;SACjB,OAAO,CAAC,gBAAgB,EAAE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ify/common/asyncapi';
|
|
2
|
+
import { DecoratedNavigationPage } from '@mintlify/models';
|
|
3
|
+
import { DecoratedGroupsConfig, GroupsConfig } from '@mintlify/validation';
|
|
4
|
+
type GenerateAsyncApiPagesOptions = {
|
|
5
|
+
asyncApiFilePath?: string;
|
|
6
|
+
version?: string;
|
|
7
|
+
writeFiles?: boolean;
|
|
8
|
+
outDir?: string;
|
|
9
|
+
outDirBasePath?: string;
|
|
10
|
+
overwrite?: boolean;
|
|
11
|
+
};
|
|
12
|
+
type AsyncApiPageGenerationResult = {
|
|
13
|
+
nav: GroupsConfig;
|
|
14
|
+
decoratedNav: DecoratedGroupsConfig;
|
|
15
|
+
spec: AsyncAPIDocumentInterface;
|
|
16
|
+
pagesAcc: Record<string, DecoratedNavigationPage>;
|
|
17
|
+
isUrl: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare function generateAsyncApiPagesForDocsConfig(spec: AsyncAPIDocumentInterface | string | URL, opts?: GenerateAsyncApiPagesOptions): Promise<AsyncApiPageGenerationResult>;
|
|
20
|
+
export {};
|