flowdoc-gen 0.1.2 → 0.1.4
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/dist/index.cjs +1412 -0
- package/dist/index.d.cts +148 -0
- package/package.json +2 -1
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { Request, Response, NextFunction } from 'express';
|
|
2
|
+
|
|
3
|
+
type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
|
|
4
|
+
type ParameterLocation = "path" | "query" | "header" | "cookie";
|
|
5
|
+
type SchemaType = "string" | "number" | "integer" | "boolean" | "object" | "array" | "null";
|
|
6
|
+
interface JsonSchema {
|
|
7
|
+
type?: SchemaType | SchemaType[];
|
|
8
|
+
format?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
example?: unknown;
|
|
11
|
+
enum?: unknown[];
|
|
12
|
+
properties?: Record<string, JsonSchema>;
|
|
13
|
+
items?: JsonSchema;
|
|
14
|
+
required?: string[];
|
|
15
|
+
additionalProperties?: boolean | JsonSchema;
|
|
16
|
+
anyOf?: JsonSchema[];
|
|
17
|
+
oneOf?: JsonSchema[];
|
|
18
|
+
allOf?: JsonSchema[];
|
|
19
|
+
nullable?: boolean;
|
|
20
|
+
minimum?: number;
|
|
21
|
+
maximum?: number;
|
|
22
|
+
minLength?: number;
|
|
23
|
+
maxLength?: number;
|
|
24
|
+
minItems?: number;
|
|
25
|
+
maxItems?: number;
|
|
26
|
+
pattern?: string;
|
|
27
|
+
title?: string;
|
|
28
|
+
default?: unknown;
|
|
29
|
+
}
|
|
30
|
+
interface RouteParameter {
|
|
31
|
+
name: string;
|
|
32
|
+
in: ParameterLocation;
|
|
33
|
+
required: boolean;
|
|
34
|
+
schema: JsonSchema;
|
|
35
|
+
description?: string;
|
|
36
|
+
example?: unknown;
|
|
37
|
+
}
|
|
38
|
+
interface RequestBody {
|
|
39
|
+
required: boolean;
|
|
40
|
+
description?: string;
|
|
41
|
+
content: {
|
|
42
|
+
"application/json"?: {
|
|
43
|
+
schema: JsonSchema;
|
|
44
|
+
};
|
|
45
|
+
"multipart/form-data"?: {
|
|
46
|
+
schema: JsonSchema;
|
|
47
|
+
};
|
|
48
|
+
"application/x-www-form-urlencoded"?: {
|
|
49
|
+
schema: JsonSchema;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
interface ResponseBody {
|
|
54
|
+
description: string;
|
|
55
|
+
content?: {
|
|
56
|
+
"application/json"?: {
|
|
57
|
+
schema: JsonSchema;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
interface RouteDoc {
|
|
62
|
+
method: HttpMethod;
|
|
63
|
+
path: string;
|
|
64
|
+
summary?: string;
|
|
65
|
+
description?: string;
|
|
66
|
+
tags: string[];
|
|
67
|
+
parameters: RouteParameter[];
|
|
68
|
+
requestBody?: RequestBody;
|
|
69
|
+
responses: Record<string, ResponseBody>;
|
|
70
|
+
deprecated?: boolean;
|
|
71
|
+
security?: Array<Record<string, string[]>>;
|
|
72
|
+
middleware?: string[];
|
|
73
|
+
}
|
|
74
|
+
interface ApiGroup {
|
|
75
|
+
name: string;
|
|
76
|
+
description?: string;
|
|
77
|
+
routes: RouteDoc[];
|
|
78
|
+
}
|
|
79
|
+
interface FlowDocSpec {
|
|
80
|
+
info: {
|
|
81
|
+
title: string;
|
|
82
|
+
version: string;
|
|
83
|
+
description?: string;
|
|
84
|
+
baseUrl: string;
|
|
85
|
+
};
|
|
86
|
+
auth?: {
|
|
87
|
+
type: "bearer" | "apiKey" | "basic" | "oauth2";
|
|
88
|
+
headerName?: string;
|
|
89
|
+
queryName?: string;
|
|
90
|
+
};
|
|
91
|
+
groups: ApiGroup[];
|
|
92
|
+
generatedAt: string;
|
|
93
|
+
sourceFramework: "express" | "nestjs";
|
|
94
|
+
}
|
|
95
|
+
interface FlowDocConfig {
|
|
96
|
+
name: string;
|
|
97
|
+
version?: string;
|
|
98
|
+
description?: string;
|
|
99
|
+
framework: "express" | "nestjs";
|
|
100
|
+
entry: string;
|
|
101
|
+
baseUrl?: string;
|
|
102
|
+
auth?: FlowDocSpec["auth"];
|
|
103
|
+
output?: string;
|
|
104
|
+
theme?: {
|
|
105
|
+
brand?: string;
|
|
106
|
+
logo?: string;
|
|
107
|
+
darkMode?: boolean;
|
|
108
|
+
};
|
|
109
|
+
groups?: Record<string, string[]>;
|
|
110
|
+
exclude?: string[];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
interface GenerateOptions {
|
|
114
|
+
config?: string;
|
|
115
|
+
output?: string;
|
|
116
|
+
quiet?: boolean;
|
|
117
|
+
}
|
|
118
|
+
declare const generate: (opts?: GenerateOptions) => Promise<FlowDocSpec>;
|
|
119
|
+
|
|
120
|
+
interface ServeOptions extends GenerateOptions {
|
|
121
|
+
port?: number;
|
|
122
|
+
noOpen?: boolean;
|
|
123
|
+
watch?: boolean;
|
|
124
|
+
}
|
|
125
|
+
declare const serve: (opts?: ServeOptions) => Promise<void>;
|
|
126
|
+
|
|
127
|
+
declare const init: (cwd?: string) => void;
|
|
128
|
+
|
|
129
|
+
interface FlowDocMiddlewareOptions {
|
|
130
|
+
/** Path to flowdoc.config.ts — defaults to auto-discovery from cwd */
|
|
131
|
+
config?: string;
|
|
132
|
+
/** Route prefix the middleware is mounted at — used only for the HTML shell */
|
|
133
|
+
path?: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Express middleware that serves flowdoc docs at whatever route you mount it on.
|
|
137
|
+
* baseUrl is auto-derived from each incoming request — no manual config needed.
|
|
138
|
+
*
|
|
139
|
+
* Usage:
|
|
140
|
+
* import { flowdoc } from "flowdoc";
|
|
141
|
+
* app.use("/docs", flowdoc());
|
|
142
|
+
*/
|
|
143
|
+
declare const flowdoc: (opts?: FlowDocMiddlewareOptions) => (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
144
|
+
|
|
145
|
+
/** Type-safe config helper — use in flowdoc.config.ts */
|
|
146
|
+
declare const defineConfig: (config: FlowDocConfig) => FlowDocConfig;
|
|
147
|
+
|
|
148
|
+
export { type FlowDocConfig, type FlowDocMiddlewareOptions, type FlowDocSpec, type GenerateOptions, type JsonSchema, type RouteDoc, type ServeOptions, defineConfig, flowdoc, generate, init, serve };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowdoc-gen",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Auto-generate beautiful API documentation from your Express codebase — no annotations required",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
13
|
"import": "./dist/index.js",
|
|
14
|
+
"require": "./dist/index.cjs",
|
|
14
15
|
"types": "./dist/index.d.ts"
|
|
15
16
|
}
|
|
16
17
|
},
|