@questpie/openapi 3.0.19 → 3.0.21

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/server.d.mts CHANGED
@@ -1,186 +1,2 @@
1
- import * as questpie0 from "questpie";
2
-
3
- //#region src/types.d.ts
4
- /**
5
- * Configuration for OpenAPI spec generation.
6
- */
7
- interface OpenApiConfig {
8
- /** OpenAPI info object */
9
- info?: {
10
- title?: string;
11
- version?: string;
12
- description?: string;
13
- };
14
- /** Server definitions */
15
- servers?: Array<{
16
- url: string;
17
- description?: string;
18
- }>;
19
- /** Base path for routes (must match your adapter basePath) */
20
- basePath?: string;
21
- /** Exclude specific collections or globals from the spec */
22
- exclude?: {
23
- collections?: string[];
24
- globals?: string[];
25
- };
26
- /** Include auth endpoints in the spec */
27
- auth?: boolean;
28
- /** Include search endpoints in the spec */
29
- search?: boolean;
30
- }
31
- /**
32
- * Scalar UI configuration options.
33
- */
34
- interface ScalarConfig {
35
- /** Theme for Scalar UI */
36
- theme?: string;
37
- /** Page title override */
38
- title?: string;
39
- /** Custom CSS */
40
- customCss?: string;
41
- /** Hide the "Download OpenAPI Spec" button */
42
- hideDownloadButton?: boolean;
43
- /** Default HTTP client for code samples */
44
- defaultHttpClient?: {
45
- targetKey: string;
46
- clientKey: string;
47
- };
48
- }
49
- /**
50
- * Configuration for the OpenAPI module.
51
- * Export from `config/openapi.ts` via `openApiConfig()`.
52
- */
53
- interface OpenApiModuleConfig extends OpenApiConfig {
54
- /** Scalar UI options */
55
- scalar?: ScalarConfig;
56
- /** Path for the JSON spec route (default: "openapi.json") */
57
- specPath?: string;
58
- /** Path for the Scalar UI docs route (default: "docs") */
59
- docsPath?: string;
60
- }
61
- /**
62
- * OpenAPI 3.1 spec (simplified type — full spec is a plain object).
63
- */
64
- type OpenApiSpec = {
65
- openapi: "3.1.0";
66
- info: {
67
- title: string;
68
- version: string;
69
- description?: string;
70
- };
71
- servers?: Array<{
72
- url: string;
73
- description?: string;
74
- }>;
75
- paths: Record<string, Record<string, PathOperation>>;
76
- components: {
77
- schemas: Record<string, unknown>;
78
- securitySchemes?: Record<string, unknown>;
79
- };
80
- tags?: Array<{
81
- name: string;
82
- description?: string;
83
- }>;
84
- security?: Array<Record<string, string[]>>;
85
- };
86
- interface PathOperation {
87
- operationId?: string;
88
- summary?: string;
89
- description?: string;
90
- tags?: string[];
91
- parameters?: unknown[];
92
- requestBody?: unknown;
93
- responses: Record<string, unknown>;
94
- security?: Array<Record<string, string[]>>;
95
- }
96
- //#endregion
97
- //#region src/server.d.ts
98
-
99
- /**
100
- * Identity factory for `config/openapi.ts` — provides type inference.
101
- *
102
- * @example
103
- * ```ts
104
- * // config/openapi.ts
105
- * import { openApiConfig } from "@questpie/openapi";
106
- *
107
- * export default openApiConfig({
108
- * info: { title: "My API", version: "1.0.0" },
109
- * scalar: { theme: "purple" },
110
- * });
111
- * ```
112
- */
113
- declare function openApiConfig(config: OpenApiModuleConfig): OpenApiModuleConfig;
114
- /**
115
- * Generate a complete OpenAPI 3.1 spec from a QUESTPIE app instance.
116
- * Routes are read from `app.config.routes` automatically.
117
- *
118
- * @example
119
- * ```ts
120
- * import { generateOpenApiSpec } from "@questpie/openapi";
121
- *
122
- * const spec = generateOpenApiSpec(app, {
123
- * info: { title: "My API", version: "1.0.0" },
124
- * });
125
- * ```
126
- */
127
- declare function generateOpenApiSpec(app: unknown, config?: OpenApiConfig): OpenApiSpec;
128
- /**
129
- * Create a route that serves the OpenAPI 3.1 JSON spec.
130
- * Place in your `routes/` directory for automatic discovery.
131
- *
132
- * Spec is lazy-generated on first request and cached with ETag.
133
- * Config is read from `config/openapi.ts` at request time, or from
134
- * explicit parameter if provided.
135
- *
136
- * @example
137
- * ```ts title="routes/openapi-spec.ts"
138
- * import { openApiRoute } from "@questpie/openapi";
139
- *
140
- * export default openApiRoute();
141
- * ```
142
- */
143
- declare function openApiRoute(config?: OpenApiConfig): questpie0.RawRouteDefinition<questpie0.JsonRouteParams>;
144
- /**
145
- * Create a route that serves the Scalar interactive API docs.
146
- * Place in your `routes/` directory for automatic discovery.
147
- *
148
- * @example
149
- * ```ts title="routes/docs.ts"
150
- * import { docsRoute } from "@questpie/openapi";
151
- *
152
- * export default docsRoute();
153
- * ```
154
- */
155
- declare function docsRoute(config?: OpenApiConfig & {
156
- scalar?: ScalarConfig;
157
- }): questpie0.RawRouteDefinition<questpie0.JsonRouteParams>;
158
- /**
159
- * OpenAPI module — registers spec + docs routes.
160
- *
161
- * Routes are served as:
162
- * - `GET /api/openapi.json` — OpenAPI 3.1 JSON spec
163
- * - `GET /api/docs` — Scalar interactive API reference
164
- *
165
- * Configure via `config/openapi.ts`:
166
- * ```ts
167
- * import { openApiConfig } from "@questpie/openapi";
168
- * export default openApiConfig({ info: { title: "My API", version: "1.0.0" } });
169
- * ```
170
- *
171
- * @example Static (reads config from config/openapi.ts):
172
- * ```ts title="questpie/server/modules.ts"
173
- * import { openApiModule } from "@questpie/openapi";
174
- * export default [openApiModule] as const;
175
- * ```
176
- */
177
- declare const openApiModule: {
178
- name: "questpie-openapi";
179
- plugin: questpie0.CodegenPlugin;
180
- routes: {
181
- "openapi.json": questpie0.RawRouteDefinition<questpie0.JsonRouteParams>;
182
- docs: questpie0.RawRouteDefinition<questpie0.JsonRouteParams>;
183
- };
184
- };
185
- //#endregion
186
- export { type OpenApiConfig, type OpenApiModuleConfig, type OpenApiSpec, type ScalarConfig, openApiModule as default, openApiModule, docsRoute, generateOpenApiSpec, openApiConfig, openApiRoute };
1
+ import { a as openApiRoute, c as OpenApiSpec, i as openApiModule, l as ScalarConfig, n as generateOpenApiSpec, o as OpenApiConfig, r as openApiConfig, s as OpenApiModuleConfig, t as docsRoute } from "./server-C8504hNI.mjs";
2
+ export { OpenApiConfig, OpenApiModuleConfig, OpenApiSpec, ScalarConfig, openApiModule as default, openApiModule, docsRoute, generateOpenApiSpec, openApiConfig, openApiRoute };