@scalar/nestjs-api-reference 0.3.182 → 0.3.184
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/README.md +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +11 -3
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ npm install @scalar/nestjs-api-reference
|
|
|
15
15
|
|
|
16
16
|
## Usage
|
|
17
17
|
|
|
18
|
-
[Set up NestJS](https://docs.nestjs.com/first-steps) and [set up NestJS Swagger](https://docs.nestjs.com/openapi/introduction) and pass an OpenAPI/Swagger
|
|
18
|
+
[Set up NestJS](https://docs.nestjs.com/first-steps) and [set up NestJS Swagger](https://docs.nestjs.com/openapi/introduction) and pass an OpenAPI/Swagger document to the `apiReference` middleware:
|
|
19
19
|
|
|
20
20
|
```ts
|
|
21
21
|
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'
|
package/dist/index.cjs
CHANGED
|
@@ -128,13 +128,13 @@ function apiReference(options) {
|
|
|
128
128
|
</html>
|
|
129
129
|
`;
|
|
130
130
|
if (options.withFastify) {
|
|
131
|
-
return (
|
|
131
|
+
return (_req, res) => {
|
|
132
132
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
133
133
|
res.write(content);
|
|
134
134
|
res.end();
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
|
-
return (
|
|
137
|
+
return (_req, res) => {
|
|
138
138
|
res.send(content);
|
|
139
139
|
};
|
|
140
140
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReferenceConfiguration } from '@scalar/types/legacy';
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
3
|
import { FastifyRequest } from 'fastify';
|
|
4
|
-
import { ServerResponse } from 'http';
|
|
4
|
+
import { ServerResponse } from 'node:http';
|
|
5
5
|
|
|
6
6
|
type NestJSReferenceConfiguration = ReferenceConfiguration & {
|
|
7
7
|
withFastify?: boolean;
|
|
@@ -21,6 +21,6 @@ declare const ApiReference: (options: ApiReferenceOptions) => string;
|
|
|
21
21
|
/**
|
|
22
22
|
* The HTML template to render the API Reference.
|
|
23
23
|
*/
|
|
24
|
-
declare function apiReference(options: NestJSReferenceConfiguration): ((
|
|
24
|
+
declare function apiReference(options: NestJSReferenceConfiguration): ((_req: FastifyRequest, res: ServerResponse) => void) | ((_req: Request, res: Response) => void);
|
|
25
25
|
|
|
26
26
|
export { ApiReference, type ApiReferenceOptions, type NestJSReferenceConfiguration, apiReference, customThemeCSS };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReferenceConfiguration } from '@scalar/types/legacy';
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
3
|
import { FastifyRequest } from 'fastify';
|
|
4
|
-
import { ServerResponse } from 'http';
|
|
4
|
+
import { ServerResponse } from 'node:http';
|
|
5
5
|
|
|
6
6
|
type NestJSReferenceConfiguration = ReferenceConfiguration & {
|
|
7
7
|
withFastify?: boolean;
|
|
@@ -21,6 +21,6 @@ declare const ApiReference: (options: ApiReferenceOptions) => string;
|
|
|
21
21
|
/**
|
|
22
22
|
* The HTML template to render the API Reference.
|
|
23
23
|
*/
|
|
24
|
-
declare function apiReference(options: NestJSReferenceConfiguration): ((
|
|
24
|
+
declare function apiReference(options: NestJSReferenceConfiguration): ((_req: FastifyRequest, res: ServerResponse) => void) | ((_req: Request, res: Response) => void);
|
|
25
25
|
|
|
26
26
|
export { ApiReference, type ApiReferenceOptions, type NestJSReferenceConfiguration, apiReference, customThemeCSS };
|
package/dist/index.js
CHANGED
|
@@ -100,13 +100,13 @@ function apiReference(options) {
|
|
|
100
100
|
</html>
|
|
101
101
|
`;
|
|
102
102
|
if (options.withFastify) {
|
|
103
|
-
return (
|
|
103
|
+
return (_req, res) => {
|
|
104
104
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
105
105
|
res.write(content);
|
|
106
106
|
res.end();
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
return (
|
|
109
|
+
return (_req, res) => {
|
|
110
110
|
res.send(content);
|
|
111
111
|
};
|
|
112
112
|
}
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"url": "git+https://github.com/scalar/scalar.git",
|
|
11
11
|
"directory": "integrations/nestjs"
|
|
12
12
|
},
|
|
13
|
-
"version": "0.3.
|
|
13
|
+
"version": "0.3.184",
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=18"
|
|
16
16
|
},
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
],
|
|
35
35
|
"module": "dist/index.js",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@scalar/types": "0.0.
|
|
37
|
+
"@scalar/types": "0.0.34"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/express": "^4.17.21",
|
|
@@ -43,10 +43,18 @@
|
|
|
43
43
|
"tsup": "^7.2.0",
|
|
44
44
|
"vite": "^5.4.10",
|
|
45
45
|
"vitest": "^1.6.0",
|
|
46
|
-
"@scalar/api-reference": "1.25.
|
|
46
|
+
"@scalar/api-reference": "1.25.121"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsup ./src/index.ts --format esm,cjs --dts",
|
|
50
|
+
"build:express": "cd playground/nestjs-api-reference-express && pnpm build",
|
|
51
|
+
"build:fastify": "cd playground/nestjs-api-reference-fastify && pnpm build",
|
|
52
|
+
"dev:express": "cd playground/nestjs-api-reference-express && pnpm dev",
|
|
53
|
+
"dev:fastify": "cd playground/nestjs-api-reference-fastify && pnpm dev",
|
|
54
|
+
"docker:build-express": "docker build --build-arg BASE_IMAGE=scalar-base -t nestjs-api-reference-express -f playground/nestjs-api-reference-express/Dockerfile .",
|
|
55
|
+
"docker:build-fastify": "docker build --build-arg BASE_IMAGE=scalar-base -t nestjs-api-reference-fastify -f playground/nestjs-api-reference-fastify/Dockerfile .",
|
|
56
|
+
"docker:run-express": "docker run -p 5056:5056 nestjs-api-reference-express",
|
|
57
|
+
"docker:run-fastify": "docker run -p 5057:5057 nestjs-api-reference-fastify",
|
|
50
58
|
"lint:check": "eslint .",
|
|
51
59
|
"lint:fix": "eslint . --fix",
|
|
52
60
|
"test": "vitest run",
|