@edirect/documentation 11.0.65 → 11.0.66

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 (43) hide show
  1. package/package.json +9 -27
  2. package/dist/README.md +0 -197
  3. package/dist/package.json +0 -29
  4. package/dist/tsconfig.lib.tsbuildinfo +0 -1
  5. /package/{dist/src → src}/documentation-root.controller.d.ts +0 -0
  6. /package/{dist/src → src}/documentation-root.controller.d.ts.map +0 -0
  7. /package/{dist/src → src}/documentation-root.controller.js +0 -0
  8. /package/{dist/src → src}/documentation.constants.d.ts +0 -0
  9. /package/{dist/src → src}/documentation.constants.d.ts.map +0 -0
  10. /package/{dist/src → src}/documentation.constants.js +0 -0
  11. /package/{dist/src → src}/documentation.controller.d.ts +0 -0
  12. /package/{dist/src → src}/documentation.controller.d.ts.map +0 -0
  13. /package/{dist/src → src}/documentation.controller.js +0 -0
  14. /package/{dist/src → src}/documentation.module.d.ts +0 -0
  15. /package/{dist/src → src}/documentation.module.d.ts.map +0 -0
  16. /package/{dist/src → src}/documentation.module.js +0 -0
  17. /package/{dist/src → src}/documentation.service.d.ts +0 -0
  18. /package/{dist/src → src}/documentation.service.d.ts.map +0 -0
  19. /package/{dist/src → src}/documentation.service.js +0 -0
  20. /package/{dist/src → src}/documentation.viewer.d.ts +0 -0
  21. /package/{dist/src → src}/documentation.viewer.d.ts.map +0 -0
  22. /package/{dist/src → src}/documentation.viewer.js +0 -0
  23. /package/{dist/src → src}/index.d.ts +0 -0
  24. /package/{dist/src → src}/index.d.ts.map +0 -0
  25. /package/{dist/src → src}/index.js +0 -0
  26. /package/{dist/src → src}/renderers/index.d.ts +0 -0
  27. /package/{dist/src → src}/renderers/index.d.ts.map +0 -0
  28. /package/{dist/src → src}/renderers/index.js +0 -0
  29. /package/{dist/src → src}/renderers/redoc.d.ts +0 -0
  30. /package/{dist/src → src}/renderers/redoc.d.ts.map +0 -0
  31. /package/{dist/src → src}/renderers/redoc.js +0 -0
  32. /package/{dist/src → src}/renderers/scalar.d.ts +0 -0
  33. /package/{dist/src → src}/renderers/scalar.d.ts.map +0 -0
  34. /package/{dist/src → src}/renderers/scalar.js +0 -0
  35. /package/{dist/src → src}/renderers/shared.d.ts +0 -0
  36. /package/{dist/src → src}/renderers/shared.d.ts.map +0 -0
  37. /package/{dist/src → src}/renderers/shared.js +0 -0
  38. /package/{dist/src → src}/renderers/swagger-ui.d.ts +0 -0
  39. /package/{dist/src → src}/renderers/swagger-ui.d.ts.map +0 -0
  40. /package/{dist/src → src}/renderers/swagger-ui.js +0 -0
  41. /package/{dist/src → src}/types/documentation.options.d.ts +0 -0
  42. /package/{dist/src → src}/types/documentation.options.d.ts.map +0 -0
  43. /package/{dist/src → src}/types/documentation.options.js +0 -0
package/package.json CHANGED
@@ -1,20 +1,19 @@
1
1
  {
2
2
  "name": "@edirect/documentation",
3
- "version": "11.0.65",
4
- "packageScope": "@edirect",
5
- "main": "./dist/src/index.js",
6
- "types": "./dist/src/index.d.ts",
3
+ "version": "11.0.66",
4
+ "main": "./src/index.js",
5
+ "types": "./src/index.d.ts",
7
6
  "exports": {
8
7
  ".": {
9
- "import": "./dist/src/index.js",
10
- "default": "./dist/src/index.js",
11
- "require": "./dist/src/index.js",
12
- "types": "./dist/src/index.d.ts"
8
+ "import": "./src/index.js",
9
+ "default": "./src/index.js",
10
+ "require": "./src/index.js",
11
+ "types": "./src/index.d.ts"
13
12
  },
14
13
  "./package.json": "./package.json"
15
14
  },
16
15
  "files": [
17
- "dist"
16
+ "src"
18
17
  ],
19
18
  "dependencies": {
20
19
  "@nestjs/common": "^11.2.1",
@@ -23,25 +22,8 @@
23
22
  "tslib": "^2.8.1"
24
23
  },
25
24
  "devDependencies": {
26
- "@nestjs/core": "11.2.1",
27
25
  "@types/express": "^5.0.6",
28
26
  "@types/node": "^26.2.0"
29
27
  },
30
- "nx": {
31
- "name": "@edirect/documentation",
32
- "targets": {
33
- "build": {
34
- "executor": "@nx/js:tsc",
35
- "options": {
36
- "main": "{workspaceRoot}/packages/edirect-documentation/src/index.ts",
37
- "tsConfig": "{workspaceRoot}/packages/edirect-documentation/tsconfig.lib.json",
38
- "outputPath": "{workspaceRoot}/packages/edirect-documentation/dist",
39
- "assets": [
40
- "{workspaceRoot}/packages/edirect-documentation/package.json",
41
- "{workspaceRoot}/packages/edirect-documentation/README.md"
42
- ]
43
- }
44
- }
45
- }
46
- }
28
+ "type": "commonjs"
47
29
  }
package/dist/README.md DELETED
@@ -1,197 +0,0 @@
1
- # @edirect/documentation
2
-
3
- Self-contained NestJS module that serves **code-first** OpenAPI documentation at `/docs`, with a
4
- bolttech app bar and pluggable renderers.
5
-
6
- - **Multi-renderer** — Redoc (default), Scalar, or Swagger UI, picked per service.
7
- - **Version switching** — declare multiple API versions; the viewer renders a version dropdown.
8
- - **Deprecated badge** — mark a version `deprecated` and it shows an amber badge in the app bar.
9
- - **bolttech app bar** — one slim, sticky bar shared across renderers: logo, workspace breadcrumb,
10
- environment badge, version switch, support link, and OpenAPI download.
11
- - **Code-first** — specs are generated lazily from the live Nest application via `@nestjs/swagger`;
12
- no hand-written OpenAPI files to maintain.
13
-
14
- ## Installation
15
-
16
- ```bash
17
- pnpm add @edirect/documentation
18
- ```
19
-
20
- Peer libraries used at runtime (already present in any Nest service): `@nestjs/common`,
21
- `@nestjs/swagger`, `express`.
22
-
23
- ## Quick start
24
-
25
- The module is `@Global`. Register it in your `AppModule`, then bind the running app once after
26
- bootstrap so declarative versions can be generated lazily.
27
-
28
- ```ts
29
- // app.module.ts
30
- import { Module } from '@nestjs/common';
31
- import { DocumentationModule } from '@edirect/documentation';
32
-
33
- @Module({
34
- imports: [
35
- DocumentationModule.forRoot({
36
- title: 'Messaging Service',
37
- workspace: 'Shared Services',
38
- support: 'shared-services@bolttech.io',
39
- versions: [
40
- { slug: 'v2', label: 'v2', version: '2.0', isDefault: true, paths: ['/v2'] },
41
- ],
42
- }),
43
- ],
44
- })
45
- export class AppModule {}
46
- ```
47
-
48
- ```ts
49
- // main.ts
50
- import { NestFactory } from '@nestjs/core';
51
- import { DocumentationService } from '@edirect/documentation';
52
- import { AppModule } from './app.module';
53
-
54
- async function bootstrap() {
55
- const app = await NestFactory.create(AppModule);
56
-
57
- // REQUIRED — without this the declarative versions cannot be generated.
58
- app.get(DocumentationService).useApp(app);
59
-
60
- await app.listen(3000);
61
- }
62
- bootstrap();
63
- ```
64
-
65
- Open `http://localhost:3000/docs`.
66
-
67
- ### Async configuration
68
-
69
- Use `forRootAsync` when options depend on config/DI. Because the resolved `root` value is unknown at
70
- module-build time, opt into the `/` route with `mountRoot: true`.
71
-
72
- ```ts
73
- DocumentationModule.forRootAsync({
74
- imports: [ConfigModule],
75
- inject: [ConfigService],
76
- mountRoot: true, // only needed if you want root: 'redirect' | 'serve'
77
- useFactory: (config: ConfigService) => ({
78
- enabled: config.get('DOCS_ENABLED') !== 'false',
79
- title: config.get('SERVICE_NAME'),
80
- root: 'redirect',
81
- versions: [{ slug: 'v2', isDefault: true, paths: ['/v2'] }],
82
- }),
83
- });
84
- ```
85
-
86
- ## Routes
87
-
88
- | Route | Description |
89
- | --- | --- |
90
- | `GET /docs` | HTML viewer (renderer of your choice). Honors `?spec=<slug>` to switch version. |
91
- | `GET /docs/spec` | JSON index of registered specs (`{ default, specs: [{ slug, url, ... }] }`). |
92
- | `GET /docs/spec/:slug` | OpenAPI JSON for a spec, with `ETag` + `Cache-Control` and `304` support. |
93
- | `GET /` | Only when `root` is `redirect` or `serve` (and `mountRoot: true` for async). |
94
-
95
- When `enabled: false`, every docs route responds `404`.
96
-
97
- ## Options
98
-
99
- | Option | Type | Default | Description |
100
- | --- | --- | --- | --- |
101
- | `enabled` | `boolean` | `true` | Master switch. `false` → all docs routes return `404`. |
102
- | `title` | `string` | `'API Documentation'` | Page title and OpenAPI `info.title`. |
103
- | `description` | `string` | — | Default description for generated versions. |
104
- | `workspace` | `string` | — | Domain/workspace shown before the title in the breadcrumb. |
105
- | `support` | `string` | — | Support email or URL shown in the app bar. |
106
- | `renderer` | `'redoc' \| 'scalar' \| 'swagger-ui'` | `'redoc'` | Which viewer to render. |
107
- | `logo` | `{ url; altText? }` | bolttech logo | Brand logo in the app bar. |
108
- | `brand.accent` | `string` (hex or CSS keyword) | bolttech cyan `#00bac7` | Accent color; validated, invalid values are ignored. |
109
- | `bearerAuth` | `boolean` | `true` | Adds a bearer security scheme to every generated version. |
110
- | `servers` | `string[]` | — | Servers advertised in every generated version. |
111
- | `root` | `'off' \| 'redirect' \| 'serve'` | `'off'` | `/` behavior. Default never claims `/`. |
112
- | `versions` | `DocumentationVersionOptions[]` | — | Declarative versions, generated lazily from the app. |
113
- | `specs` | `DocumentationSpec[]` | — | Pre-built OpenAPI documents registered as-is. |
114
-
115
- `DocumentationVersionOptions`: `slug` (required), `label`, `description`, `version`, `order`,
116
- `isDefault`, `enabled`, `deprecated`, `paths` (keep only routes under these prefixes), `include`
117
- (restrict generation to given Nest modules), `configure(builder)` (customize the `DocumentBuilder`).
118
-
119
- > Note: the actual runtime defaults are `renderer: 'redoc'` and `root: 'off'`.
120
-
121
- ## Recipes
122
-
123
- ### Multiple versions
124
-
125
- ```ts
126
- DocumentationModule.forRoot({
127
- title: 'Policy Service',
128
- versions: [
129
- { slug: 'v2', label: 'v2', version: '2.0', order: 1, isDefault: true, paths: ['/v2'] },
130
- { slug: 'v1', label: 'v1', version: '1.0', order: 2, deprecated: true, paths: ['/v1'] },
131
- ],
132
- });
133
- ```
134
-
135
- ### Mark a version deprecated
136
-
137
- Set `deprecated: true` on the version — the app bar shows an amber **Deprecated** badge when that
138
- version is selected.
139
-
140
- ### Custom accent / logo / workspace
141
-
142
- ```ts
143
- DocumentationModule.forRoot({
144
- workspace: 'Payments',
145
- brand: { accent: '#7c3aed' },
146
- logo: { url: 'https://example.com/logo.svg', altText: 'Acme' },
147
- versions: [{ slug: 'v2', isDefault: true }],
148
- });
149
- ```
150
-
151
- ### Turn off in production
152
-
153
- ```ts
154
- DocumentationModule.forRoot({
155
- enabled: process.env.NODE_ENV !== 'production',
156
- versions: [{ slug: 'v2', isDefault: true }],
157
- });
158
- ```
159
-
160
- ### Redirect root to the docs
161
-
162
- ```ts
163
- DocumentationModule.forRoot({ root: 'redirect', versions: [{ slug: 'v2', isDefault: true }] });
164
- // forRootAsync: also pass `mountRoot: true`.
165
- ```
166
-
167
- ### Pre-built spec (escape hatch)
168
-
169
- ```ts
170
- DocumentationModule.forRoot({
171
- specs: [
172
- {
173
- slug: 'partner',
174
- label: 'Partner API',
175
- isDefault: true,
176
- document: () => loadPartnerOpenApi(), // OpenAPIObject or a (possibly async) factory
177
- },
178
- ],
179
- });
180
- ```
181
-
182
- ## Security notes
183
-
184
- - **Pinned CDN + SRI** — Redoc `2.5.3`, Scalar `1.62.1`, and `swagger-ui-dist` `5.32.8` are loaded
185
- from jsDelivr at fixed versions with Subresource Integrity hashes (see `renderers/shared.ts`,
186
- `CDN`). Versions cannot drift to `latest`, and a compromised CDN cannot inject script. **When
187
- bumping a renderer, change the version and the `integrity` hash together.**
188
- - **`noindex`** — the viewer emits `<meta name="robots" content="noindex, nofollow">`.
189
- - **`enabled` gate** — set `enabled: false` to make every docs route return `404` (e.g. production).
190
- - **Auth** — the module does not gate `/docs` itself. If docs should require authentication, the
191
- consumer scopes them in its own auth middleware/guard.
192
-
193
- ## Gotcha
194
-
195
- `app.get(DocumentationService).useApp(app)` is **required** in `main.ts`. Declarative `versions`
196
- are generated lazily from the live app — without `useApp`, they cannot be built and the service logs
197
- a warning shortly after boot. (`specs` registered as pre-built documents do not need it.)
package/dist/package.json DELETED
@@ -1,29 +0,0 @@
1
- {
2
- "name": "@edirect/documentation",
3
- "version": "11.0.65",
4
- "main": "./dist/src/index.js",
5
- "types": "./dist/src/index.d.ts",
6
- "exports": {
7
- ".": {
8
- "import": "./dist/src/index.js",
9
- "default": "./dist/src/index.js",
10
- "require": "./dist/src/index.js",
11
- "types": "./dist/src/index.d.ts"
12
- },
13
- "./package.json": "./package.json"
14
- },
15
- "files": [
16
- "dist"
17
- ],
18
- "dependencies": {
19
- "@nestjs/common": "^11.2.1",
20
- "@nestjs/swagger": "11.4.7",
21
- "express": "5.2.1",
22
- "tslib": "^2.8.1"
23
- },
24
- "devDependencies": {
25
- "@types/express": "^5.0.6",
26
- "@types/node": "^26.2.0"
27
- },
28
- "type": "commonjs"
29
- }
@@ -1 +0,0 @@
1
- {"version":"5.9.3"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes