mastra 0.1.57-unstable.35 → 0.1.57-unstable.36

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 (97) hide show
  1. package/package.json +2 -16
  2. package/node_modules/express/History.md +0 -3647
  3. package/node_modules/express/LICENSE +0 -24
  4. package/node_modules/express/Readme.md +0 -260
  5. package/node_modules/express/index.js +0 -11
  6. package/node_modules/express/lib/application.js +0 -661
  7. package/node_modules/express/lib/express.js +0 -116
  8. package/node_modules/express/lib/middleware/init.js +0 -43
  9. package/node_modules/express/lib/middleware/query.js +0 -47
  10. package/node_modules/express/lib/request.js +0 -525
  11. package/node_modules/express/lib/response.js +0 -1179
  12. package/node_modules/express/lib/router/index.js +0 -673
  13. package/node_modules/express/lib/router/layer.js +0 -181
  14. package/node_modules/express/lib/router/route.js +0 -230
  15. package/node_modules/express/lib/utils.js +0 -303
  16. package/node_modules/express/lib/view.js +0 -182
  17. package/node_modules/express/package.json +0 -98
  18. package/node_modules/express-jsdoc-swagger/.all-contributorsrc +0 -168
  19. package/node_modules/express-jsdoc-swagger/.eslintignore +0 -6
  20. package/node_modules/express-jsdoc-swagger/.eslintrc.json +0 -37
  21. package/node_modules/express-jsdoc-swagger/CODE_OF_CONDUCT.md +0 -76
  22. package/node_modules/express-jsdoc-swagger/CONTRIBUTING.md +0 -55
  23. package/node_modules/express-jsdoc-swagger/LICENSE.md +0 -21
  24. package/node_modules/express-jsdoc-swagger/README.md +0 -376
  25. package/node_modules/express-jsdoc-swagger/commitlint.config.js +0 -24
  26. package/node_modules/express-jsdoc-swagger/config/default.js +0 -18
  27. package/node_modules/express-jsdoc-swagger/config/swaggerEvents.js +0 -5
  28. package/node_modules/express-jsdoc-swagger/consumers/getOnlyComments.js +0 -21
  29. package/node_modules/express-jsdoc-swagger/consumers/globFilesMatches.js +0 -50
  30. package/node_modules/express-jsdoc-swagger/consumers/jsdocInfo.js +0 -20
  31. package/node_modules/express-jsdoc-swagger/consumers/readFiles.js +0 -9
  32. package/node_modules/express-jsdoc-swagger/consumers/utils/getComments.js +0 -13
  33. package/node_modules/express-jsdoc-swagger/consumers/utils/readFile.js +0 -15
  34. package/node_modules/express-jsdoc-swagger/index.d.ts +0 -65
  35. package/node_modules/express-jsdoc-swagger/index.js +0 -60
  36. package/node_modules/express-jsdoc-swagger/package.json +0 -59
  37. package/node_modules/express-jsdoc-swagger/processSwagger.js +0 -45
  38. package/node_modules/express-jsdoc-swagger/swaggerEvents.js +0 -35
  39. package/node_modules/express-jsdoc-swagger/transforms/basic/contact.js +0 -18
  40. package/node_modules/express-jsdoc-swagger/transforms/basic/index.js +0 -10
  41. package/node_modules/express-jsdoc-swagger/transforms/basic/info.js +0 -26
  42. package/node_modules/express-jsdoc-swagger/transforms/basic/license.js +0 -14
  43. package/node_modules/express-jsdoc-swagger/transforms/basic/servers.js +0 -20
  44. package/node_modules/express-jsdoc-swagger/transforms/components/index.js +0 -130
  45. package/node_modules/express-jsdoc-swagger/transforms/index.js +0 -13
  46. package/node_modules/express-jsdoc-swagger/transforms/paths/content.js +0 -18
  47. package/node_modules/express-jsdoc-swagger/transforms/paths/examples.js +0 -98
  48. package/node_modules/express-jsdoc-swagger/transforms/paths/formParams.js +0 -40
  49. package/node_modules/express-jsdoc-swagger/transforms/paths/index.js +0 -127
  50. package/node_modules/express-jsdoc-swagger/transforms/paths/parameters.js +0 -80
  51. package/node_modules/express-jsdoc-swagger/transforms/paths/requestBody.js +0 -65
  52. package/node_modules/express-jsdoc-swagger/transforms/paths/responses.js +0 -55
  53. package/node_modules/express-jsdoc-swagger/transforms/paths/schema.js +0 -33
  54. package/node_modules/express-jsdoc-swagger/transforms/paths/security.js +0 -31
  55. package/node_modules/express-jsdoc-swagger/transforms/paths/validStatusCodes.js +0 -64
  56. package/node_modules/express-jsdoc-swagger/transforms/security/index.js +0 -18
  57. package/node_modules/express-jsdoc-swagger/transforms/tags/index.js +0 -41
  58. package/node_modules/express-jsdoc-swagger/transforms/utils/arrays.js +0 -12
  59. package/node_modules/express-jsdoc-swagger/transforms/utils/combineSchema.js +0 -67
  60. package/node_modules/express-jsdoc-swagger/transforms/utils/enumValues.js +0 -6
  61. package/node_modules/express-jsdoc-swagger/transforms/utils/errorMessage.js +0 -8
  62. package/node_modules/express-jsdoc-swagger/transforms/utils/formatDescription.js +0 -35
  63. package/node_modules/express-jsdoc-swagger/transforms/utils/formatExamples.js +0 -25
  64. package/node_modules/express-jsdoc-swagger/transforms/utils/generator.js +0 -6
  65. package/node_modules/express-jsdoc-swagger/transforms/utils/httpMethods.js +0 -18
  66. package/node_modules/express-jsdoc-swagger/transforms/utils/mapDescription.js +0 -5
  67. package/node_modules/express-jsdoc-swagger/transforms/utils/refSchema.js +0 -48
  68. package/node_modules/express-jsdoc-swagger/transforms/utils/setProperty.js +0 -25
  69. package/node_modules/express-jsdoc-swagger/transforms/utils/tags.js +0 -16
  70. package/node_modules/express-jsdoc-swagger/transforms/utils/validateTypes.js +0 -11
  71. package/node_modules/serverless-http/LICENSE.txt +0 -33
  72. package/node_modules/serverless-http/README.md +0 -117
  73. package/node_modules/serverless-http/lib/finish.js +0 -42
  74. package/node_modules/serverless-http/lib/framework/get-framework.js +0 -79
  75. package/node_modules/serverless-http/lib/provider/aws/clean-up-event.js +0 -98
  76. package/node_modules/serverless-http/lib/provider/aws/create-request.js +0 -110
  77. package/node_modules/serverless-http/lib/provider/aws/format-response.js +0 -45
  78. package/node_modules/serverless-http/lib/provider/aws/index.js +0 -15
  79. package/node_modules/serverless-http/lib/provider/aws/is-binary.js +0 -42
  80. package/node_modules/serverless-http/lib/provider/aws/sanitize-headers.js +0 -21
  81. package/node_modules/serverless-http/lib/provider/azure/clean-up-request.js +0 -41
  82. package/node_modules/serverless-http/lib/provider/azure/create-request.js +0 -45
  83. package/node_modules/serverless-http/lib/provider/azure/format-response.js +0 -18
  84. package/node_modules/serverless-http/lib/provider/azure/index.js +0 -13
  85. package/node_modules/serverless-http/lib/provider/azure/is-binary.js +0 -42
  86. package/node_modules/serverless-http/lib/provider/azure/sanitize-headers.js +0 -23
  87. package/node_modules/serverless-http/lib/provider/azure/set-cookie.json +0 -1
  88. package/node_modules/serverless-http/lib/provider/get-provider.js +0 -17
  89. package/node_modules/serverless-http/lib/request.js +0 -38
  90. package/node_modules/serverless-http/lib/response.js +0 -135
  91. package/node_modules/serverless-http/package.json +0 -93
  92. package/node_modules/serverless-http/serverless-http.d.ts +0 -41
  93. package/node_modules/serverless-http/serverless-http.js +0 -23
  94. package/node_modules/swagger-ui-express/LICENSE +0 -22
  95. package/node_modules/swagger-ui-express/README.md +0 -360
  96. package/node_modules/swagger-ui-express/index.js +0 -311
  97. package/node_modules/swagger-ui-express/package.json +0 -58
@@ -1,376 +0,0 @@
1
- ![npm](https://img.shields.io/npm/v/express-jsdoc-swagger)
2
- ![Node.js Package](https://github.com/BRIKEV/express-jsdoc-swagger/workflows/Build/badge.svg)
3
- [![Known Vulnerabilities](https://snyk.io/test/github/BRIKEV/express-jsdoc-swagger/badge.svg)](https://snyk.io/test/github/BRIKEV/express-jsdoc-swagger)
4
- [![Maintainability](https://api.codeclimate.com/v1/badges/6d5565df0c9c10e75b59/maintainability)](https://codeclimate.com/github/BRIKEV/express-jsdoc-swagger/maintainability)
5
- [![Test Coverage](https://api.codeclimate.com/v1/badges/6d5565df0c9c10e75b59/test_coverage)](https://codeclimate.com/github/BRIKEV/express-jsdoc-swagger/test_coverage)
6
- ![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)
7
- ![npm](https://img.shields.io/npm/dm/express-jsdoc-swagger)
8
-
9
- # express-jsdoc-swagger
10
-
11
- With this library, you can document your express endpoints using swagger [OpenAPI 3 Specification](https://swagger.io/specification/) without writing YAML or JSON. You can write comments similar to `jsdoc` on each endpoint, and the dependecy is going to create the swagger UI.
12
-
13
- ## Table of Contents
14
-
15
- 1. [Prerequisites](#Prerequisites)
16
- 2. [Installation](#Installation)
17
- 3. [Basic Usage](#Basic-Usage)
18
- 4. [Basic Examples](#Basic-Examples)
19
- - [Advanced examples](https://github.com/BRIKEV/express-jsdoc-swagger/tree/master/examples)
20
- - [Official docs](https://brikev.github.io/express-jsdoc-swagger-docs/#/)
21
- 5. [Validator](#Validator)
22
- 6. [VSCode extension](https://marketplace.visualstudio.com/items?itemName=brikev.express-jsdoc-swagger-snippets)
23
-
24
- ## Prerequisites
25
-
26
- This library assumes you are using:
27
-
28
- 1. [NodeJS](https://nodejs.org)
29
- 2. [Express.js](http://www.expressjs.com)
30
-
31
- ## Installation
32
-
33
- ```
34
- npm i express-jsdoc-swagger
35
- ```
36
-
37
- ## Basic Usage
38
-
39
- ```javascript
40
- // index.js file
41
- const express = require('express');
42
- const expressJSDocSwagger = require('express-jsdoc-swagger');
43
-
44
- const options = {
45
- info: {
46
- version: '1.0.0',
47
- title: 'Albums store',
48
- license: {
49
- name: 'MIT',
50
- },
51
- },
52
- security: {
53
- BasicAuth: {
54
- type: 'http',
55
- scheme: 'basic',
56
- },
57
- },
58
- // Base directory which we use to locate your JSDOC files
59
- baseDir: __dirname,
60
- // Glob pattern to find your jsdoc files (multiple patterns can be added in an array)
61
- filesPattern: './**/*.js',
62
- // URL where SwaggerUI will be rendered
63
- swaggerUIPath: '/api-docs',
64
- // Expose OpenAPI UI
65
- exposeSwaggerUI: true,
66
- // Expose Open API JSON Docs documentation in `apiDocsPath` path.
67
- exposeApiDocs: false,
68
- // Open API JSON Docs endpoint.
69
- apiDocsPath: '/v3/api-docs',
70
- // Set non-required fields as nullable by default
71
- notRequiredAsNullable: false,
72
- // You can customize your UI options.
73
- // you can extend swagger-ui-express config. You can checkout an example of this
74
- // in the `example/configuration/swaggerOptions.js`
75
- swaggerUiOptions: {},
76
- // multiple option in case you want more that one instance
77
- multiple: true,
78
- };
79
-
80
- const app = express();
81
- const PORT = 3000;
82
-
83
- expressJSDocSwagger(app)(options);
84
-
85
- /**
86
- * GET /api/v1
87
- * @summary This is the summary of the endpoint
88
- * @return {object} 200 - success response
89
- */
90
- app.get('/api/v1', (req, res) => res.json({
91
- success: true,
92
- }));
93
-
94
- app.listen(PORT, () => console.log(`Example app listening at http://localhost:${PORT}`));
95
- ```
96
-
97
- ## Basic Examples
98
-
99
- 1. Basic configuration options.
100
-
101
- ```javascript
102
- const options = {
103
- info: {
104
- version: '1.0.0',
105
- title: 'Albums store',
106
- license: {
107
- name: 'MIT',
108
- },
109
- },
110
- security: {
111
- BasicAuth: {
112
- type: 'http',
113
- scheme: 'basic',
114
- },
115
- },
116
- baseDir: __dirname,
117
- // Glob pattern to find your jsdoc files (multiple patterns can be added in an array)
118
- filesPattern: './**/*.js',
119
- };
120
- ```
121
-
122
- 2. Components definition
123
-
124
- ```javascript
125
- /**
126
- * A song type
127
- * @typedef {object} Song
128
- * @property {string} title.required - The title
129
- * @property {string} artist - The artist
130
- * @property {number} year - The year - double
131
- */
132
- ```
133
-
134
- 3. Endpoint which returns a `Songs` model array in the response.
135
-
136
- ```javascript
137
- /**
138
- * GET /api/v1/albums
139
- * @summary This is the summary of the endpoint
140
- * @tags album
141
- * @return {array<Song>} 200 - success response - application/json
142
- */
143
- app.get('/api/v1/albums', (req, res) => (
144
- res.json([{
145
- title: 'abum 1',
146
- }])
147
- ));
148
- ```
149
-
150
- 3. Endpoint PUT with body and path params which returns a `Songs` model array in the response.
151
-
152
- ```javascript
153
- /**
154
- * PUT /api/v1/albums/{id}
155
- * @summary Update album
156
- * @tags album
157
- * @param {string} name.path - name param description
158
- * @param {Song} request.body.required - songs info
159
- * @return {array<Song>} 200 - success response - application/json
160
- */
161
- app.put('/api/v1/albums/:id', (req, res) => (
162
- res.json([{
163
- title: 'abum 1',
164
- }])
165
- ));
166
- ```
167
-
168
- 4. Basic endpoint definition with tags, params and basic authentication
169
-
170
- ```javascript
171
- /**
172
- * GET /api/v1/album
173
- * @summary This is the summary of the endpoint
174
- * @security BasicAuth
175
- * @tags album
176
- * @param {string} name.query.required - name param description
177
- * @return {object} 200 - success response - application/json
178
- * @return {object} 400 - Bad request response
179
- */
180
- app.get('/api/v1/album', (req, res) => (
181
- res.json({
182
- title: 'abum 1',
183
- })
184
- ));
185
- ```
186
-
187
- 5. Basic endpoint definition with code example for response body
188
-
189
- ```javascript
190
- /**
191
- * GET /api/v1/albums
192
- * @summary This is the summary of the endpoint
193
- * @tags album
194
- * @return {array<Song>} 200 - success response - application/json
195
- * @example response - 200 - success response example
196
- * [
197
- * {
198
- * "title": "Bury the light",
199
- * "artist": "Casey Edwards ft. Victor Borba",
200
- * "year": 2020
201
- * }
202
- * ]
203
- */
204
- app.get('/api/v1/albums', (req, res) => (
205
- res.json([{
206
- title: 'track 1',
207
- }])
208
- ));
209
- ```
210
-
211
- You can find more examples [here](https://github.com/BRIKEV/express-jsdoc-swagger/tree/master/examples), or visit our [documentation](https://brikev.github.io/express-jsdoc-swagger-docs/#/).
212
-
213
-
214
- ## Validator
215
-
216
- We developed a new package works as a validator of your API endpoints and the documentation you create with this package. This package is [express-oas-validator](https://github.com/BRIKEV/express-oas-validator).
217
-
218
- **Example**
219
-
220
- Install using the node package registry:
221
-
222
- ```
223
- npm install --save express-oas-validator
224
- ```
225
-
226
- We have to wait until we have the full swagger schema to initiate the validator.
227
-
228
- ```js
229
- // validator.js
230
- const { init } = require('express-oas-validator');
231
-
232
- const validators = instance => new Promise((resolve, reject) => {
233
- instance.on('finish', (swaggerDef) => {
234
- const { validateRequest, validateResponse } = init(swaggerDef);
235
- resolve({ validateRequest, validateResponse });
236
- });
237
-
238
- instance.on('error', (error) => {
239
- reject(error);
240
- });
241
- });
242
-
243
- module.exports = validators;
244
-
245
- ```
246
-
247
- You can check out this also in our [example folder](https://github.com/BRIKEV/express-jsdoc-swagger/tree/master/examples/validator).
248
-
249
- ```js
250
- // index.js
251
- const express = require('express');
252
- const expressJSDocSwagger = require('express-jsdoc-swagger');
253
- const validator = require('./validator');
254
-
255
- const options = {
256
- info: {
257
- version: '1.0.0',
258
- title: 'Albums store',
259
- license: {
260
- name: 'MIT',
261
- },
262
- },
263
- filesPattern: './**.js',
264
- baseDir: __dirname,
265
- };
266
-
267
- const app = express();
268
- const instance = expressJSDocSwagger(app)(options);
269
-
270
- const serverApp = async () => {
271
- const { validateRequest, validateResponse } = await validator(instance);
272
- app.use(express.urlencoded({ extended: true }));
273
- app.use(express.json());
274
- /**
275
- * A song
276
- * @typedef {object} Song
277
- * @property {string} title.required - The title
278
- * @property {string} artist - The artist
279
- * @property {integer} year - The year
280
- */
281
-
282
- /**
283
- * POST /api/v1/songs
284
- * @param {Song} request.body.required - song info
285
- * @return {object} 200 - song response
286
- */
287
- app.post('/api/v1/songs', validateRequest(), (req, res) => res.send('You save a song!'));
288
-
289
- /**
290
- * POST /api/v1/name
291
- * @param {string} request.body.required - name body description
292
- * @return {object} 200 - song response
293
- */
294
- app.post('/api/v1/name', (req, res, next) => {
295
- try {
296
- // Validate response
297
- validateResponse('Error string', req);
298
- return res.send('Hello World!');
299
- } catch (error) {
300
- return next(error);
301
- }
302
- });
303
-
304
- /**
305
- * GET /api/v1/authors
306
- * @summary This is the summary or description of the endpoint
307
- * @param {string} name.query.required - name param description - enum:type1,type2
308
- * @param {array<string>} license.query - name param description
309
- * @return {object} 200 - success response - application/json
310
- */
311
- app.get('/api/v1/authors', validateRequest({ headers: false }), (req, res) => (
312
- res.json([{
313
- title: 'album 1',
314
- }])
315
- ));
316
-
317
- // eslint-disable-next-line no-unused-vars
318
- app.use((err, req, res, next) => {
319
- res.status(err.status).json(err);
320
- });
321
-
322
- return app;
323
- };
324
-
325
- const PORT = process.env.PORT || 4000;
326
-
327
- serverApp()
328
- .then(app =>
329
- app.listen(PORT, () =>
330
- console.log(`Listening PORT: ${PORT}`)
331
- ))
332
- .catch((err) => {
333
- console.error(err);
334
- process.exit(1);
335
- });
336
- ```
337
-
338
- You can visit our [documentation](https://brikev.github.io/express-jsdoc-swagger-docs/#/validator).
339
-
340
- ## Contributors ✨
341
-
342
- <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
343
- <!-- prettier-ignore-start -->
344
- <!-- markdownlint-disable -->
345
- <table>
346
- <tr>
347
- <td align="center"><a href="https://github.com/bri06"><img src="https://avatars0.githubusercontent.com/u/24435223?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Briam Martinez Escobar</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=bri06" title="Code">💻</a></td>
348
- <td align="center"><a href="https://twitter.com/kjmesc"><img src="https://avatars2.githubusercontent.com/u/12685053?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kevin Julián Martínez Escobar</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=kevinccbsg" title="Code">💻</a></td>
349
- <td align="center"><a href="https://github.com/hoonga"><img src="https://avatars3.githubusercontent.com/u/10708927?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Heung-yeon Oh</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=hoonga" title="Code">💻</a></td>
350
- <td align="center"><a href="https://github.com/LonelyPrincess"><img src="https://avatars1.githubusercontent.com/u/17673317?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sara Hernández</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=LonelyPrincess" title="Code">💻</a></td>
351
- <td align="center"><a href="http://servatj.me"><img src="https://avatars0.githubusercontent.com/u/3521485?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Josep Servat</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=servatj" title="Code">💻</a></td>
352
- <td align="center"><a href="https://github.com/thuydx55"><img src="https://avatars2.githubusercontent.com/u/1469984?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nick Dong</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=thuydx55" title="Code">💻</a></td>
353
- <td align="center"><a href="https://github.com/Stosiu"><img src="https://avatars1.githubusercontent.com/u/10252063?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Aleksander Stós</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=Stosiu" title="Code">💻</a></td>
354
- </tr>
355
- <tr>
356
- <td align="center"><a href="https://github.com/kdankert"><img src="https://avatars0.githubusercontent.com/u/46489624?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kjell Dankert</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=kdankert" title="Code">💻</a></td>
357
- <td align="center"><a href="https://github.com/juliendu11"><img src="https://avatars0.githubusercontent.com/u/18739442?v=4?s=100" width="100px;" alt=""/><br /><sub><b>juliendu11</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=juliendu11" title="Code">💻</a></td>
358
- <td align="center"><a href="https://me.io"><img src="https://avatars.githubusercontent.com/u/45731?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mohamed Meabed</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=meabed" title="Code">💻</a></td>
359
- <td align="center"><a href="https://github.com/ofarukaydin"><img src="https://avatars.githubusercontent.com/u/32788963?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Faruk Aydın</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=ofarukaydin" title="Code">💻</a></td>
360
- <td align="center"><a href="https://github.com/dahlmo"><img src="https://avatars.githubusercontent.com/u/23076026?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dahlmo</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=dahlmo" title="Code">💻</a></td>
361
- <td align="center"><a href="https://github.com/gandazgul"><img src="https://avatars.githubusercontent.com/u/108850?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Carlos Ravelo</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=gandazgul" title="Code">💻</a></td>
362
- <td align="center"><a href="https://github.com/paulish"><img src="https://avatars.githubusercontent.com/u/1762032?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Paul Ishenin</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=paulish" title="Code">💻</a></td>
363
- </tr>
364
- <tr>
365
- <td align="center"><a href="https://github.com/sbingner"><img src="https://avatars.githubusercontent.com/u/354533?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sam Bingner</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=sbingner" title="Code">💻</a></td>
366
- <td align="center"><a href="https://stackoverflow.com/users/5059657/alexander-staroselsky"><img src="https://avatars.githubusercontent.com/u/34102969?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alexander Staroselsky</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=alexstaroselsky" title="Code">💻</a></td>
367
- <td align="center"><a href="http://joelabrahamsson.com"><img src="https://avatars.githubusercontent.com/u/218986?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Joel Abrahamsson</b></sub></a><br /><a href="https://github.com/BRIKEV/express-jsdoc-swagger/commits?author=joelabrahamsson" title="Code">💻</a></td>
368
- </tr>
369
- </table>
370
-
371
- <!-- markdownlint-restore -->
372
- <!-- prettier-ignore-end -->
373
-
374
- <!-- ALL-CONTRIBUTORS-LIST:END -->
375
-
376
- This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
@@ -1,24 +0,0 @@
1
- /* Examples
2
- * chore: run tests on travis ci
3
- * fix(server): send cors headers
4
- * feat(blog): add comment section
5
- */
6
- /* Common Errors
7
- * subject must not be sentence-case, start-case, pascal-case, upper-case [subject-case]
8
- * type must be lower-case [type-case]
9
- * type must be one of
10
- * [build, chore, ci, docs, feat, fix, improvement, perf, refactor, revert, style, test]
11
- */
12
- /*
13
- * docs - Add or edit documentation.
14
- * feat - Implementation of new feature.
15
- * improvement - Enhancements on existing features.
16
- * fix - Changes that solve existing bugs in the application.
17
- * perf - Changes to improve the application's performance.
18
- * refactor - Code enhancements that do not alter the functionality.
19
- * style - Fix front end styles
20
- * test - Add or edit tests
21
- */
22
- module.exports = {
23
- extends: ['@commitlint/config-conventional'],
24
- };
@@ -1,18 +0,0 @@
1
- const expressJSDocSwaggerOptions = {
2
- // Absolute path of the application
3
- baseDir: __dirname,
4
- // Glob pattern to find your jsdoc files (multiple patterns can be added in an array)
5
- filesPattern: './**/*.js',
6
- // URL where SwaggerUI will be rendered
7
- swaggerUIPath: '/api-docs',
8
- // Expose OpenAPI UI
9
- exposeSwaggerUI: true,
10
- // Expose Open API JSON Docs documentation in `apiDocsPath` path.
11
- exposeApiDocs: false,
12
- // Open API JSON Docs endpoint.
13
- apiDocsPath: '/v3/api-docs',
14
- // Set non-required fields as nullable by default
15
- notRequiredAsNullable: false,
16
- };
17
-
18
- module.exports = expressJSDocSwaggerOptions;
@@ -1,5 +0,0 @@
1
- const swaggerEvents = options => ({
2
- multiple: options.multiple !== undefined ? options.multiple : false,
3
- });
4
-
5
- module.exports = swaggerEvents;
@@ -1,21 +0,0 @@
1
- const getComments = require('./utils/getComments');
2
-
3
- const flat = array => [].concat(...array);
4
-
5
- const trimComment = comment => comment.trim();
6
-
7
- const removeSimpleComments = comment => (comment[0] === '/' && comment[1] !== '/');
8
-
9
- const processComments = comment => {
10
- const trimedComments = trimComment(comment);
11
- return getComments(trimedComments);
12
- };
13
-
14
- const getOnlyComments = (files = []) => {
15
- if (!Array.isArray(files)) return [];
16
- const comments = files
17
- .map(processComments);
18
- return flat(comments).filter(removeSimpleComments);
19
- };
20
-
21
- module.exports = getOnlyComments;
@@ -1,50 +0,0 @@
1
- const glob = require('glob');
2
- const path = require('path');
3
-
4
- const DEFAULT_EXCLUDED_FOLDER = 'node_modules';
5
- const DEFAULT_GLOB_OPTIONS = { ignore: '**/node_modules/**' };
6
-
7
- const globFilesMatches = (baseDir, filesPattern, excludedFolder = DEFAULT_EXCLUDED_FOLDER) => (
8
- new Promise((resolve, reject) => {
9
- if (!baseDir || !filesPattern) {
10
- const error = new Error('baseDir and filePath are required');
11
- return reject(error);
12
- }
13
-
14
- if (!Array.isArray(filesPattern) && typeof filesPattern !== 'string') {
15
- const error = new Error('files pattern has to be a type of string');
16
- return reject(error);
17
- }
18
-
19
- if (Array.isArray(filesPattern)) {
20
- if (filesPattern.length === 0) {
21
- const error = new Error('if you submit an array of filesPattern it must contain at least one pattern');
22
- return reject(error);
23
- }
24
-
25
- if (filesPattern.some(pattern => typeof pattern !== 'string')) {
26
- const error = new Error('all file patterns have to be strings');
27
- return reject(error);
28
- }
29
- }
30
-
31
- try {
32
- let files;
33
- if (!Array.isArray(filesPattern)) {
34
- files = glob.sync(path.resolve(baseDir, filesPattern), DEFAULT_GLOB_OPTIONS);
35
- } else {
36
- files = filesPattern
37
- .map(pattern => glob.sync(path.resolve(baseDir, pattern), DEFAULT_EXCLUDED_FOLDER))
38
- .reduce((memo, it) => memo.concat(it), [])
39
- .filter((value, index, self) => self.indexOf(value) === index);
40
- }
41
-
42
- const filteredFiles = files.filter(file => !file.includes(excludedFolder));
43
- return resolve(filteredFiles);
44
- } catch (error) {
45
- return reject(error);
46
- }
47
- })
48
- );
49
-
50
- module.exports = globFilesMatches;
@@ -1,20 +0,0 @@
1
- const doctrine = require('doctrine');
2
-
3
- const jsdocInfo = (options = { unwrap: true }) => comments => {
4
- if (!comments || !Array.isArray(comments)) return [];
5
- return comments.map(comment => {
6
- const parsedValue = doctrine.parse(comment, options);
7
- const tags = parsedValue.tags.map(tag => ({
8
- ...tag,
9
- description: tag.description ? tag.description.replace('\n/', '').replace(/\/$/, '') : tag.description,
10
- }));
11
- const description = parsedValue.description.replace('/**\n', '').replace('\n/', '');
12
- return {
13
- ...parsedValue,
14
- tags,
15
- description,
16
- };
17
- });
18
- };
19
-
20
- module.exports = jsdocInfo;
@@ -1,9 +0,0 @@
1
- const readFile = require('./utils/readFile');
2
-
3
- const readFiles = files => {
4
- if (!files || !Array.isArray(files)) return Promise.resolve([]);
5
- const filesInfo = files.map(file => readFile(file));
6
- return Promise.all(filesInfo);
7
- };
8
-
9
- module.exports = readFiles;
@@ -1,13 +0,0 @@
1
- const COMMENTS_PATTERN = /((\/\*\*+[\s\S]*?\*\/)|(\/\*+.*\*\/)|^\/\/.*?[\r\n])[\r\n]*/gm;
2
- const BREAK_LINE = /\n/g;
3
-
4
- const getComments = text => {
5
- const comments = text.match(COMMENTS_PATTERN);
6
- if (comments) {
7
- const filterComments = comments.filter(comment => comment.match(BREAK_LINE));
8
- return filterComments.map(comment => comment.trim());
9
- }
10
- return [];
11
- };
12
-
13
- module.exports = getComments;
@@ -1,15 +0,0 @@
1
- const fs = require('fs');
2
-
3
- const readFile = path => (
4
- new Promise((resolve, reject) => {
5
- let data = '';
6
- const readStream = fs.createReadStream(path, 'utf8');
7
- readStream.on('data', chunk => {
8
- data += chunk;
9
- })
10
- .on('end', () => resolve(data))
11
- .on('error', error => reject(error));
12
- })
13
- );
14
-
15
- module.exports = readFile;
@@ -1,65 +0,0 @@
1
- // Type definitions for express-jsdoc-swagger
2
- // Project: https://github.com/BRIKEV/express-jsdoc-swagger
3
- // Definitions by: Kevin MArtínez <https://github.com/kevinccbsg>
4
- // Definitions: https://github.com/BRIKEV/express-jsdoc-swagger/index.d.ts
5
- // TypeScript Version: 3.9.7
6
-
7
- import { EventEmitter } from "events";
8
- import express from "express";
9
- import { SwaggerUiOptions } from "swagger-ui-express";
10
-
11
- interface ContactObject {
12
- name: string;
13
- url?: string;
14
- email?: string;
15
- }
16
-
17
- interface LicenseObject {
18
- name: string;
19
- url?: string;
20
- email?: string;
21
- }
22
-
23
- interface InfoObject {
24
- title: string;
25
- version: string;
26
- description?: string;
27
- termsOfService?: string;
28
- contact?: ContactObject;
29
- license?: LicenseObject;
30
- }
31
-
32
- interface SecurityObject {
33
- type: string;
34
- scheme: string;
35
- }
36
-
37
- interface Security {
38
- [key: string]: SecurityObject;
39
- }
40
-
41
- interface Servers {
42
- url: string;
43
- description: string;
44
- variables?: object;
45
- }
46
-
47
- interface Options {
48
- info: InfoObject;
49
- baseDir: string;
50
- filesPattern: string | string[];
51
- security?: Security;
52
- servers?: string[] | Servers[];
53
- exposeSwaggerUI?: boolean;
54
- swaggerUIPath?: string;
55
- exposeApiDocs?: boolean;
56
- apiDocsPath?: string;
57
- swaggerUiOptions?: SwaggerUiOptions;
58
- notRequiredAsNullable?: boolean;
59
- }
60
-
61
- type UserSwagger = Record<string, unknown>;
62
-
63
- type EventEmiterHandler = (options: Options, userSwagger?: UserSwagger) => EventEmitter;
64
-
65
- export default function expressJSDocSwagger(app: express.Application): EventEmiterHandler;