@extk/expressive 0.7.1 → 0.9.0

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.d.mts CHANGED
@@ -4,6 +4,7 @@ import * as express_serve_static_core from 'express-serve-static-core';
4
4
  import { RouteParameters } from 'express-serve-static-core';
5
5
  import { HelmetOptions } from 'helmet';
6
6
  import morgan from 'morgan';
7
+ import { SwaggerUiOptions, SwaggerOptions } from 'swagger-ui-express';
7
8
 
8
9
  type ExpressRoute = string;
9
10
  type ExpressLocalsObj = Record<string, any>;
@@ -33,61 +34,85 @@ type Container = {
33
34
  alertHandler?: AlertHandler;
34
35
  };
35
36
 
37
+ type Nullable<T extends string> = T | [T, 'null'] | ['null', T];
36
38
  type NumericConfigs = {
37
39
  minimum?: number;
38
40
  maximum?: number;
39
- exclusiveMinimum?: boolean;
40
- exclusiveMaximum?: boolean;
41
+ exclusiveMinimum?: number;
42
+ exclusiveMaximum?: number;
41
43
  multipleOf?: number;
42
44
  };
43
45
  type NumberSchema = {
44
- type: 'number';
46
+ type: Nullable<'number'>;
45
47
  format?: 'float' | 'double';
46
48
  } & NumericConfigs;
47
49
  type IntegerSchema = {
48
- type: 'integer';
50
+ type: Nullable<'integer'>;
49
51
  format?: 'int32' | 'int64';
50
52
  } & NumericConfigs;
51
53
  type StringSchema = {
52
- type: 'string';
54
+ type: Nullable<'string'>;
53
55
  minLength?: number;
54
56
  maxLength?: number;
55
57
  format?: 'date' | 'date-time' | 'password' | 'byte' | 'binary' | 'email' | 'uuid' | 'uri' | 'hostname' | 'ipv4' | 'ipv6' | OtherString;
56
58
  pattern?: string;
57
59
  };
58
60
  type BooleanSchema = {
59
- type: 'boolean';
61
+ type: Nullable<'boolean'>;
62
+ };
63
+ type NullSchema = {
64
+ type: 'null';
60
65
  };
61
66
  type ArraySchema = {
62
- type: 'array';
63
- items: Partial<Schema>;
67
+ type: Nullable<'array'>;
68
+ items?: Schema;
64
69
  minItems?: number;
65
70
  maxItems?: number;
66
71
  uniqueItems?: boolean;
67
72
  };
68
73
  type ObjectSchema = {
69
- type: 'object';
74
+ type: Nullable<'object'>;
70
75
  properties?: Record<string, Schema>;
71
76
  required?: string[];
72
77
  additionalProperties?: boolean | Schema;
73
78
  minProperties?: number;
74
79
  maxProperties?: number;
75
80
  };
76
- type BaseSchema = ({
77
- nullable?: boolean;
78
- enum?: unknown[];
81
+ type Discriminator = {
82
+ propertyName: string;
83
+ mapping?: Record<string, string>;
84
+ };
85
+ type CommonSchemaProps = {
86
+ title?: string;
79
87
  description?: string;
88
+ example?: unknown;
80
89
  default?: unknown;
81
- } & (StringSchema | NumberSchema | IntegerSchema | BooleanSchema | ArraySchema | ObjectSchema)) | {
82
- $ref: string;
90
+ enum?: unknown[];
91
+ const?: unknown;
92
+ readOnly?: boolean;
93
+ writeOnly?: boolean;
94
+ deprecated?: boolean;
83
95
  };
84
- type Schema = BaseSchema | {
96
+ type BaseSchema = CommonSchemaProps & (StringSchema | NumberSchema | IntegerSchema | BooleanSchema | NullSchema | ArraySchema | ObjectSchema | {
97
+ $ref: string;
98
+ });
99
+ type Schema = // circular
100
+ BaseSchema | (CommonSchemaProps & {
85
101
  allOf: Schema[];
86
- } | {
102
+ discriminator?: Discriminator;
103
+ }) | (CommonSchemaProps & {
87
104
  anyOf: Schema[];
88
- } | {
105
+ discriminator?: Discriminator;
106
+ }) | (CommonSchemaProps & {
89
107
  oneOf: Schema[];
90
- } | OtherUnknown;
108
+ discriminator?: Discriminator;
109
+ }) | (CommonSchemaProps & {
110
+ not: Schema;
111
+ }) | (CommonSchemaProps & {
112
+ if: Schema;
113
+ then?: Schema;
114
+ else?: Schema;
115
+ }) | OtherUnknown;
91
116
  type Content = {
92
117
  description?: string;
93
118
  content?: Partial<Record<ContentType, {
@@ -95,7 +120,7 @@ type Content = {
95
120
  }>>;
96
121
  };
97
122
  type Param = {
98
- in: 'path' | 'query' | 'headers';
123
+ in: 'path' | 'query' | 'header' | 'cookie';
99
124
  name: string;
100
125
  description: string;
101
126
  required: boolean;
@@ -107,6 +132,7 @@ type Servers = {
107
132
  }[];
108
133
  type PathItem = {
109
134
  summary?: string;
135
+ description?: string;
110
136
  requestBody?: Content;
111
137
  parameters?: Param[];
112
138
  servers?: Servers;
@@ -116,13 +142,14 @@ type PathItem = {
116
142
  deprecated?: boolean;
117
143
  security?: AuthMethod[];
118
144
  };
145
+ /** { BearerAuth: [] } | { OAuth2: ['read', 'write'] } */
119
146
  type AuthMethod = Record<string, string[]>;
120
147
  type SecurityScheme = {
121
148
  type: 'http';
122
149
  scheme: 'basic' | 'bearer';
123
150
  } | {
124
151
  type: 'apiKey';
125
- in: 'header';
152
+ in: 'header' | 'query' | 'cookie';
126
153
  name: string;
127
154
  } | {
128
155
  type: 'openIdConnect';
@@ -161,14 +188,59 @@ type SwaggerConfig = {
161
188
  security?: AuthMethod[];
162
189
  };
163
190
 
164
- type SwaggerOptions = {
165
- path?: ExpressRoute;
166
- config: SwaggerConfig;
191
+ declare class SwaggerBuilder {
192
+ private swaggerDoc;
193
+ constructor(swaggerDoc: SwaggerConfig);
194
+ withInfo(info: SwaggerConfig['info']): this;
195
+ withServers(servers: Servers): this;
196
+ withSecuritySchemes(schemes: Record<string, SecurityScheme>): this;
197
+ withSchemas(schemas: Record<string, Schema>): this;
198
+ withDefaultSecurity(globalAuthMethods: AuthMethod[]): this;
199
+ }
200
+ declare function singleFileSchema(field?: string, required?: boolean): Content;
201
+ declare function formDataSchema(schema: Schema): Content;
202
+ declare function jsonSchema(schema: Schema): Content;
203
+ declare function jsonSchemaRef(name: string): Content;
204
+ declare function param(inP: Param['in'], id: string, schema: Schema, required?: boolean, description?: string, name?: string): Param;
205
+ declare function pathParam(id: string, schema: Schema, required?: boolean, description?: string, name?: string): Param;
206
+ declare function queryParam(id: string, schema: Schema, required?: boolean, description?: string, name?: string): Param;
207
+ declare function headerParam(id: string, schema: Schema, required?: boolean, description?: string, name?: string): Param;
208
+ declare const SWG: {
209
+ param: typeof param;
210
+ pathParam: typeof pathParam;
211
+ queryParam: typeof queryParam;
212
+ headerParam: typeof headerParam;
213
+ formDataSchema: typeof formDataSchema;
214
+ jsonSchema: typeof jsonSchema;
215
+ jsonSchemaRef: typeof jsonSchemaRef;
216
+ singleFileSchema: typeof singleFileSchema;
217
+ security: (name: string) => AuthMethod;
218
+ securitySchemes: {
219
+ readonly BasicAuth: () => SecurityScheme;
220
+ readonly BearerAuth: () => SecurityScheme;
221
+ readonly ApiKeyAuth: (headerName: string) => SecurityScheme;
222
+ readonly OpenID: (openIdConnectUrl: string) => SecurityScheme;
223
+ readonly OAuth2: (authorizationUrl: string, tokenUrl: string, scopes: Record<string, string>) => SecurityScheme;
224
+ };
225
+ };
226
+
227
+ type SwaggerRef = {
228
+ doc: SwaggerConfig | null;
229
+ };
230
+ type ExpressiveSwaggerOptions = {
231
+ path: ExpressRoute;
232
+ uiOpts?: SwaggerUiOptions;
233
+ options?: SwaggerOptions;
234
+ customCss?: string;
235
+ customfavIcon?: string;
236
+ swaggerUrl?: string;
237
+ customSiteTitle?: string;
167
238
  };
168
239
  declare class ServerBuilder {
169
240
  private app;
170
241
  private container;
171
- constructor(app: express__default.Express, container: Container);
242
+ private swaggerRef;
243
+ constructor(app: express__default.Express, container: Container, swaggerRef: SwaggerRef);
172
244
  build(): express__default.Express;
173
245
  withHelmet(options?: Readonly<HelmetOptions>): this;
174
246
  withQs(): this;
@@ -179,7 +251,7 @@ declare class ServerBuilder {
179
251
  * Helper function for fluent design
180
252
  */
181
253
  with(fn: (app: express__default.Express, container: Container) => void): this;
182
- withSwagger(swagger: SwaggerOptions, ...handlers: ExpressHandler[]): this;
254
+ withSwagger(configure: (builder: SwaggerBuilder) => void, opts: ExpressiveSwaggerOptions, ...handlers: ExpressHandler[]): this;
183
255
  }
184
256
 
185
257
  declare class ApiError extends Error {
@@ -226,41 +298,6 @@ declare class UserUnauthorizedError extends ApiError {
226
298
  constructor(message?: string);
227
299
  }
228
300
 
229
- declare class SwaggerBuilder {
230
- private swaggerDoc;
231
- constructor(swaggerDoc: SwaggerConfig);
232
- withInfo(info: SwaggerConfig['info']): this;
233
- withServers(servers: Servers): this;
234
- withSecuritySchemes(schemes: Record<string, SecurityScheme>): this;
235
- withSchemas(schemas: Record<string, Schema>): this;
236
- withDefaultSecurity(globalAuthMethods: AuthMethod[]): this;
237
- get(): SwaggerConfig;
238
- }
239
- declare function formDataSchema(schema: Schema): Content;
240
- declare function jsonSchema(schema: Schema): Content;
241
- declare function jsonSchemaRef(name: string): Content;
242
- declare function param(inP: Param['in'], id: string, schema: Schema, required?: boolean, description?: string, name?: string): Param;
243
- declare function pathParam(id: string, schema: Schema, required?: boolean, description?: string, name?: string): Param;
244
- declare function queryParam(id: string, schema: Schema, required?: boolean, description?: string, name?: string): Param;
245
- declare function headerParam(id: string, schema: Schema, required?: boolean, description?: string, name?: string): Param;
246
- declare const SWG: {
247
- param: typeof param;
248
- pathParam: typeof pathParam;
249
- queryParam: typeof queryParam;
250
- headerParam: typeof headerParam;
251
- formDataSchema: typeof formDataSchema;
252
- jsonSchema: typeof jsonSchema;
253
- jsonSchemaRef: typeof jsonSchemaRef;
254
- security: (name: string) => AuthMethod;
255
- securitySchemes: {
256
- readonly BasicAuth: () => SecurityScheme;
257
- readonly BearerAuth: () => SecurityScheme;
258
- readonly ApiKeyAuth: (headerName: string) => SecurityScheme;
259
- readonly OpenID: (openIdConnectUrl: string) => SecurityScheme;
260
- readonly OAuth2: (authorizationUrl: string, tokenUrl: string, scopes: Record<string, string>) => SecurityScheme;
261
- };
262
- };
263
-
264
301
  declare function parsePositiveInteger<T>(v: T, defaultValue: number, max?: number): number;
265
302
  declare function parseIdOrFail(v: unknown): number;
266
303
  declare function slugify(text: string): string;
@@ -289,7 +326,6 @@ declare class ApiResponse<T = undefined> {
289
326
  }
290
327
 
291
328
  declare function bootstrap(container: Container): {
292
- swaggerBuilder: () => SwaggerBuilder;
293
329
  silently: (fn: () => Promise<void> | void) => Promise<void>;
294
330
  getGlobalNotFoundMiddleware: (content?: string) => (_req: express.Request, res: express.Response, _next: express.NextFunction) => void;
295
331
  getApiNotFoundMiddleware: () => (req: express.Request, res: express.Response, _next: express.NextFunction) => void;
@@ -320,4 +356,4 @@ declare function bootstrap(container: Container): {
320
356
  };
321
357
  };
322
358
 
323
- export { type AlertHandler, ApiError, ApiErrorResponse, ApiResponse, type AuthMethod, BadRequestError, type Container, type Content, type ContentType, DuplicateError, type Env, type ExpressHandler, type ExpressLocalsObj, type ExpressRoute, FileTooBigError, ForbiddenError, type HttpMethod, InternalError, InvalidCredentialsError, InvalidFileTypeError, type Logger, NotFoundError, type OtherString, type OtherUnknown, type Pagination, type PaginationQuery, type Param, type PathItem, SWG, type Schema, SchemaValidationError, type SecurityScheme, type Servers, type SwaggerConfig, TokenExpiredError, TooManyRequestsError, UserUnauthorizedError, bootstrap, getEnvVar, getTmpDir, getTmpPath, isDev, isProd, parseDefaultPagination, parseIdOrFail, parsePositiveInteger, slugify };
359
+ export { type AlertHandler, ApiError, ApiErrorResponse, ApiResponse, type AuthMethod, BadRequestError, type Container, type Content, type ContentType, DuplicateError, type Env, type ExpressHandler, type ExpressLocalsObj, type ExpressRoute, FileTooBigError, ForbiddenError, type HttpMethod, InternalError, InvalidCredentialsError, InvalidFileTypeError, type Logger, NotFoundError, type OtherString, type OtherUnknown, type Pagination, type PaginationQuery, type Param, type PathItem, SWG, type Schema, SchemaValidationError, type SecurityScheme, type Servers, SwaggerBuilder, type SwaggerConfig, TokenExpiredError, TooManyRequestsError, UserUnauthorizedError, bootstrap, getEnvVar, getTmpDir, getTmpPath, isDev, isProd, parseDefaultPagination, parseIdOrFail, parsePositiveInteger, slugify };
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import * as express_serve_static_core from 'express-serve-static-core';
4
4
  import { RouteParameters } from 'express-serve-static-core';
5
5
  import { HelmetOptions } from 'helmet';
6
6
  import morgan from 'morgan';
7
+ import { SwaggerUiOptions, SwaggerOptions } from 'swagger-ui-express';
7
8
 
8
9
  type ExpressRoute = string;
9
10
  type ExpressLocalsObj = Record<string, any>;
@@ -33,61 +34,85 @@ type Container = {
33
34
  alertHandler?: AlertHandler;
34
35
  };
35
36
 
37
+ type Nullable<T extends string> = T | [T, 'null'] | ['null', T];
36
38
  type NumericConfigs = {
37
39
  minimum?: number;
38
40
  maximum?: number;
39
- exclusiveMinimum?: boolean;
40
- exclusiveMaximum?: boolean;
41
+ exclusiveMinimum?: number;
42
+ exclusiveMaximum?: number;
41
43
  multipleOf?: number;
42
44
  };
43
45
  type NumberSchema = {
44
- type: 'number';
46
+ type: Nullable<'number'>;
45
47
  format?: 'float' | 'double';
46
48
  } & NumericConfigs;
47
49
  type IntegerSchema = {
48
- type: 'integer';
50
+ type: Nullable<'integer'>;
49
51
  format?: 'int32' | 'int64';
50
52
  } & NumericConfigs;
51
53
  type StringSchema = {
52
- type: 'string';
54
+ type: Nullable<'string'>;
53
55
  minLength?: number;
54
56
  maxLength?: number;
55
57
  format?: 'date' | 'date-time' | 'password' | 'byte' | 'binary' | 'email' | 'uuid' | 'uri' | 'hostname' | 'ipv4' | 'ipv6' | OtherString;
56
58
  pattern?: string;
57
59
  };
58
60
  type BooleanSchema = {
59
- type: 'boolean';
61
+ type: Nullable<'boolean'>;
62
+ };
63
+ type NullSchema = {
64
+ type: 'null';
60
65
  };
61
66
  type ArraySchema = {
62
- type: 'array';
63
- items: Partial<Schema>;
67
+ type: Nullable<'array'>;
68
+ items?: Schema;
64
69
  minItems?: number;
65
70
  maxItems?: number;
66
71
  uniqueItems?: boolean;
67
72
  };
68
73
  type ObjectSchema = {
69
- type: 'object';
74
+ type: Nullable<'object'>;
70
75
  properties?: Record<string, Schema>;
71
76
  required?: string[];
72
77
  additionalProperties?: boolean | Schema;
73
78
  minProperties?: number;
74
79
  maxProperties?: number;
75
80
  };
76
- type BaseSchema = ({
77
- nullable?: boolean;
78
- enum?: unknown[];
81
+ type Discriminator = {
82
+ propertyName: string;
83
+ mapping?: Record<string, string>;
84
+ };
85
+ type CommonSchemaProps = {
86
+ title?: string;
79
87
  description?: string;
88
+ example?: unknown;
80
89
  default?: unknown;
81
- } & (StringSchema | NumberSchema | IntegerSchema | BooleanSchema | ArraySchema | ObjectSchema)) | {
82
- $ref: string;
90
+ enum?: unknown[];
91
+ const?: unknown;
92
+ readOnly?: boolean;
93
+ writeOnly?: boolean;
94
+ deprecated?: boolean;
83
95
  };
84
- type Schema = BaseSchema | {
96
+ type BaseSchema = CommonSchemaProps & (StringSchema | NumberSchema | IntegerSchema | BooleanSchema | NullSchema | ArraySchema | ObjectSchema | {
97
+ $ref: string;
98
+ });
99
+ type Schema = // circular
100
+ BaseSchema | (CommonSchemaProps & {
85
101
  allOf: Schema[];
86
- } | {
102
+ discriminator?: Discriminator;
103
+ }) | (CommonSchemaProps & {
87
104
  anyOf: Schema[];
88
- } | {
105
+ discriminator?: Discriminator;
106
+ }) | (CommonSchemaProps & {
89
107
  oneOf: Schema[];
90
- } | OtherUnknown;
108
+ discriminator?: Discriminator;
109
+ }) | (CommonSchemaProps & {
110
+ not: Schema;
111
+ }) | (CommonSchemaProps & {
112
+ if: Schema;
113
+ then?: Schema;
114
+ else?: Schema;
115
+ }) | OtherUnknown;
91
116
  type Content = {
92
117
  description?: string;
93
118
  content?: Partial<Record<ContentType, {
@@ -95,7 +120,7 @@ type Content = {
95
120
  }>>;
96
121
  };
97
122
  type Param = {
98
- in: 'path' | 'query' | 'headers';
123
+ in: 'path' | 'query' | 'header' | 'cookie';
99
124
  name: string;
100
125
  description: string;
101
126
  required: boolean;
@@ -107,6 +132,7 @@ type Servers = {
107
132
  }[];
108
133
  type PathItem = {
109
134
  summary?: string;
135
+ description?: string;
110
136
  requestBody?: Content;
111
137
  parameters?: Param[];
112
138
  servers?: Servers;
@@ -116,13 +142,14 @@ type PathItem = {
116
142
  deprecated?: boolean;
117
143
  security?: AuthMethod[];
118
144
  };
145
+ /** { BearerAuth: [] } | { OAuth2: ['read', 'write'] } */
119
146
  type AuthMethod = Record<string, string[]>;
120
147
  type SecurityScheme = {
121
148
  type: 'http';
122
149
  scheme: 'basic' | 'bearer';
123
150
  } | {
124
151
  type: 'apiKey';
125
- in: 'header';
152
+ in: 'header' | 'query' | 'cookie';
126
153
  name: string;
127
154
  } | {
128
155
  type: 'openIdConnect';
@@ -161,14 +188,59 @@ type SwaggerConfig = {
161
188
  security?: AuthMethod[];
162
189
  };
163
190
 
164
- type SwaggerOptions = {
165
- path?: ExpressRoute;
166
- config: SwaggerConfig;
191
+ declare class SwaggerBuilder {
192
+ private swaggerDoc;
193
+ constructor(swaggerDoc: SwaggerConfig);
194
+ withInfo(info: SwaggerConfig['info']): this;
195
+ withServers(servers: Servers): this;
196
+ withSecuritySchemes(schemes: Record<string, SecurityScheme>): this;
197
+ withSchemas(schemas: Record<string, Schema>): this;
198
+ withDefaultSecurity(globalAuthMethods: AuthMethod[]): this;
199
+ }
200
+ declare function singleFileSchema(field?: string, required?: boolean): Content;
201
+ declare function formDataSchema(schema: Schema): Content;
202
+ declare function jsonSchema(schema: Schema): Content;
203
+ declare function jsonSchemaRef(name: string): Content;
204
+ declare function param(inP: Param['in'], id: string, schema: Schema, required?: boolean, description?: string, name?: string): Param;
205
+ declare function pathParam(id: string, schema: Schema, required?: boolean, description?: string, name?: string): Param;
206
+ declare function queryParam(id: string, schema: Schema, required?: boolean, description?: string, name?: string): Param;
207
+ declare function headerParam(id: string, schema: Schema, required?: boolean, description?: string, name?: string): Param;
208
+ declare const SWG: {
209
+ param: typeof param;
210
+ pathParam: typeof pathParam;
211
+ queryParam: typeof queryParam;
212
+ headerParam: typeof headerParam;
213
+ formDataSchema: typeof formDataSchema;
214
+ jsonSchema: typeof jsonSchema;
215
+ jsonSchemaRef: typeof jsonSchemaRef;
216
+ singleFileSchema: typeof singleFileSchema;
217
+ security: (name: string) => AuthMethod;
218
+ securitySchemes: {
219
+ readonly BasicAuth: () => SecurityScheme;
220
+ readonly BearerAuth: () => SecurityScheme;
221
+ readonly ApiKeyAuth: (headerName: string) => SecurityScheme;
222
+ readonly OpenID: (openIdConnectUrl: string) => SecurityScheme;
223
+ readonly OAuth2: (authorizationUrl: string, tokenUrl: string, scopes: Record<string, string>) => SecurityScheme;
224
+ };
225
+ };
226
+
227
+ type SwaggerRef = {
228
+ doc: SwaggerConfig | null;
229
+ };
230
+ type ExpressiveSwaggerOptions = {
231
+ path: ExpressRoute;
232
+ uiOpts?: SwaggerUiOptions;
233
+ options?: SwaggerOptions;
234
+ customCss?: string;
235
+ customfavIcon?: string;
236
+ swaggerUrl?: string;
237
+ customSiteTitle?: string;
167
238
  };
168
239
  declare class ServerBuilder {
169
240
  private app;
170
241
  private container;
171
- constructor(app: express__default.Express, container: Container);
242
+ private swaggerRef;
243
+ constructor(app: express__default.Express, container: Container, swaggerRef: SwaggerRef);
172
244
  build(): express__default.Express;
173
245
  withHelmet(options?: Readonly<HelmetOptions>): this;
174
246
  withQs(): this;
@@ -179,7 +251,7 @@ declare class ServerBuilder {
179
251
  * Helper function for fluent design
180
252
  */
181
253
  with(fn: (app: express__default.Express, container: Container) => void): this;
182
- withSwagger(swagger: SwaggerOptions, ...handlers: ExpressHandler[]): this;
254
+ withSwagger(configure: (builder: SwaggerBuilder) => void, opts: ExpressiveSwaggerOptions, ...handlers: ExpressHandler[]): this;
183
255
  }
184
256
 
185
257
  declare class ApiError extends Error {
@@ -226,41 +298,6 @@ declare class UserUnauthorizedError extends ApiError {
226
298
  constructor(message?: string);
227
299
  }
228
300
 
229
- declare class SwaggerBuilder {
230
- private swaggerDoc;
231
- constructor(swaggerDoc: SwaggerConfig);
232
- withInfo(info: SwaggerConfig['info']): this;
233
- withServers(servers: Servers): this;
234
- withSecuritySchemes(schemes: Record<string, SecurityScheme>): this;
235
- withSchemas(schemas: Record<string, Schema>): this;
236
- withDefaultSecurity(globalAuthMethods: AuthMethod[]): this;
237
- get(): SwaggerConfig;
238
- }
239
- declare function formDataSchema(schema: Schema): Content;
240
- declare function jsonSchema(schema: Schema): Content;
241
- declare function jsonSchemaRef(name: string): Content;
242
- declare function param(inP: Param['in'], id: string, schema: Schema, required?: boolean, description?: string, name?: string): Param;
243
- declare function pathParam(id: string, schema: Schema, required?: boolean, description?: string, name?: string): Param;
244
- declare function queryParam(id: string, schema: Schema, required?: boolean, description?: string, name?: string): Param;
245
- declare function headerParam(id: string, schema: Schema, required?: boolean, description?: string, name?: string): Param;
246
- declare const SWG: {
247
- param: typeof param;
248
- pathParam: typeof pathParam;
249
- queryParam: typeof queryParam;
250
- headerParam: typeof headerParam;
251
- formDataSchema: typeof formDataSchema;
252
- jsonSchema: typeof jsonSchema;
253
- jsonSchemaRef: typeof jsonSchemaRef;
254
- security: (name: string) => AuthMethod;
255
- securitySchemes: {
256
- readonly BasicAuth: () => SecurityScheme;
257
- readonly BearerAuth: () => SecurityScheme;
258
- readonly ApiKeyAuth: (headerName: string) => SecurityScheme;
259
- readonly OpenID: (openIdConnectUrl: string) => SecurityScheme;
260
- readonly OAuth2: (authorizationUrl: string, tokenUrl: string, scopes: Record<string, string>) => SecurityScheme;
261
- };
262
- };
263
-
264
301
  declare function parsePositiveInteger<T>(v: T, defaultValue: number, max?: number): number;
265
302
  declare function parseIdOrFail(v: unknown): number;
266
303
  declare function slugify(text: string): string;
@@ -289,7 +326,6 @@ declare class ApiResponse<T = undefined> {
289
326
  }
290
327
 
291
328
  declare function bootstrap(container: Container): {
292
- swaggerBuilder: () => SwaggerBuilder;
293
329
  silently: (fn: () => Promise<void> | void) => Promise<void>;
294
330
  getGlobalNotFoundMiddleware: (content?: string) => (_req: express.Request, res: express.Response, _next: express.NextFunction) => void;
295
331
  getApiNotFoundMiddleware: () => (req: express.Request, res: express.Response, _next: express.NextFunction) => void;
@@ -320,4 +356,4 @@ declare function bootstrap(container: Container): {
320
356
  };
321
357
  };
322
358
 
323
- export { type AlertHandler, ApiError, ApiErrorResponse, ApiResponse, type AuthMethod, BadRequestError, type Container, type Content, type ContentType, DuplicateError, type Env, type ExpressHandler, type ExpressLocalsObj, type ExpressRoute, FileTooBigError, ForbiddenError, type HttpMethod, InternalError, InvalidCredentialsError, InvalidFileTypeError, type Logger, NotFoundError, type OtherString, type OtherUnknown, type Pagination, type PaginationQuery, type Param, type PathItem, SWG, type Schema, SchemaValidationError, type SecurityScheme, type Servers, type SwaggerConfig, TokenExpiredError, TooManyRequestsError, UserUnauthorizedError, bootstrap, getEnvVar, getTmpDir, getTmpPath, isDev, isProd, parseDefaultPagination, parseIdOrFail, parsePositiveInteger, slugify };
359
+ export { type AlertHandler, ApiError, ApiErrorResponse, ApiResponse, type AuthMethod, BadRequestError, type Container, type Content, type ContentType, DuplicateError, type Env, type ExpressHandler, type ExpressLocalsObj, type ExpressRoute, FileTooBigError, ForbiddenError, type HttpMethod, InternalError, InvalidCredentialsError, InvalidFileTypeError, type Logger, NotFoundError, type OtherString, type OtherUnknown, type Pagination, type PaginationQuery, type Param, type PathItem, SWG, type Schema, SchemaValidationError, type SecurityScheme, type Servers, SwaggerBuilder, type SwaggerConfig, TokenExpiredError, TooManyRequestsError, UserUnauthorizedError, bootstrap, getEnvVar, getTmpDir, getTmpPath, isDev, isProd, parseDefaultPagination, parseIdOrFail, parsePositiveInteger, slugify };