@tsoa-next/runtime 8.0.4 → 8.0.5-dev.58.3748c499
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/config.d.ts +50 -45
- package/dist/decorators/customAttribute.d.ts +6 -0
- package/dist/decorators/customAttribute.js +6 -0
- package/dist/decorators/customAttribute.js.map +1 -1
- package/dist/decorators/deprecated.d.ts +1 -1
- package/dist/decorators/deprecated.js +1 -1
- package/dist/decorators/example.d.ts +6 -0
- package/dist/decorators/example.js +6 -0
- package/dist/decorators/example.js.map +1 -1
- package/dist/decorators/extension.d.ts +7 -0
- package/dist/decorators/extension.js +6 -0
- package/dist/decorators/extension.js.map +1 -1
- package/dist/decorators/methods.d.ts +7 -0
- package/dist/decorators/methods.js +7 -0
- package/dist/decorators/methods.js.map +1 -1
- package/dist/decorators/middlewares.d.ts +6 -7
- package/dist/decorators/middlewares.js +6 -7
- package/dist/decorators/middlewares.js.map +1 -1
- package/dist/decorators/operationid.d.ts +5 -0
- package/dist/decorators/operationid.js +5 -0
- package/dist/decorators/operationid.js.map +1 -1
- package/dist/decorators/parameter.d.ts +22 -24
- package/dist/decorators/parameter.js +22 -24
- package/dist/decorators/parameter.js.map +1 -1
- package/dist/decorators/response.d.ts +18 -3
- package/dist/decorators/response.js +18 -3
- package/dist/decorators/response.js.map +1 -1
- package/dist/decorators/route.d.ts +6 -1
- package/dist/decorators/route.js +6 -1
- package/dist/decorators/route.js.map +1 -1
- package/dist/decorators/security.d.ts +5 -2
- package/dist/decorators/security.js +5 -2
- package/dist/decorators/security.js.map +1 -1
- package/dist/decorators/specPath.d.ts +66 -0
- package/dist/decorators/specPath.js +68 -0
- package/dist/decorators/specPath.js.map +1 -0
- package/dist/decorators/tags.d.ts +5 -0
- package/dist/decorators/tags.js +5 -0
- package/dist/decorators/tags.js.map +1 -1
- package/dist/decorators/validate.d.ts +5 -0
- package/dist/decorators/validate.js +5 -0
- package/dist/decorators/validate.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces/controller.d.ts +7 -0
- package/dist/interfaces/controller.js +8 -0
- package/dist/interfaces/controller.js.map +1 -1
- package/dist/interfaces/iocModule.d.ts +4 -0
- package/dist/interfaces/response.d.ts +8 -0
- package/dist/metadataGeneration/tsoa.d.ts +1 -0
- package/dist/routeGeneration/additionalProps.d.ts +1 -0
- package/dist/routeGeneration/externalValidation.d.ts +3 -0
- package/dist/routeGeneration/externalValidation.js +1 -0
- package/dist/routeGeneration/externalValidation.js.map +1 -1
- package/dist/routeGeneration/specPathSupport.d.ts +32 -0
- package/dist/routeGeneration/specPathSupport.js +408 -0
- package/dist/routeGeneration/specPathSupport.js.map +1 -0
- package/dist/routeGeneration/templateHelpers.d.ts +14 -0
- package/dist/routeGeneration/templateHelpers.js +2 -0
- package/dist/routeGeneration/templateHelpers.js.map +1 -1
- package/dist/routeGeneration/templates/express/expressTemplateService.d.ts +1 -0
- package/dist/routeGeneration/templates/express/expressTemplateService.js +1 -0
- package/dist/routeGeneration/templates/express/expressTemplateService.js.map +1 -1
- package/dist/routeGeneration/templates/hapi/hapiTemplateService.d.ts +1 -0
- package/dist/routeGeneration/templates/hapi/hapiTemplateService.js +1 -0
- package/dist/routeGeneration/templates/hapi/hapiTemplateService.js.map +1 -1
- package/dist/routeGeneration/templates/koa/koaTemplateService.d.ts +1 -0
- package/dist/routeGeneration/templates/koa/koaTemplateService.js +1 -0
- package/dist/routeGeneration/templates/koa/koaTemplateService.js.map +1 -1
- package/dist/routeGeneration/templates/templateService.d.ts +6 -0
- package/dist/routeGeneration/templates/templateService.js +3 -0
- package/dist/routeGeneration/templates/templateService.js.map +1 -1
- package/dist/routeGeneration/tsoa-route.d.ts +12 -2
- package/dist/routeGeneration/tsoa-route.js +1 -2
- package/dist/routeGeneration/tsoa-route.js.map +1 -1
- package/dist/swagger/swagger.d.ts +1 -0
- package/dist/swagger/swagger.js +1 -0
- package/dist/swagger/swagger.js.map +1 -1
- package/dist/utils/pathUtils.d.ts +4 -0
- package/dist/utils/pathUtils.js +49 -0
- package/dist/utils/pathUtils.js.map +1 -0
- package/package.json +22 -2
|
@@ -15,99 +15,97 @@ exports.FormField = FormField;
|
|
|
15
15
|
exports.Consumes = Consumes;
|
|
16
16
|
const noop_1 = require("./noop");
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @param {string} [name] properties name in body object
|
|
18
|
+
* Binds the full HTTP request body to a controller parameter.
|
|
20
19
|
*/
|
|
21
20
|
function Body() {
|
|
22
21
|
return (0, noop_1.createNoopParameterDecorator)('body');
|
|
23
22
|
}
|
|
24
23
|
/**
|
|
25
|
-
*
|
|
24
|
+
* Binds a single property from the request body to a controller parameter.
|
|
26
25
|
*
|
|
27
|
-
* @param
|
|
26
|
+
* @param _name The property name to read from the request body. Defaults to the parameter name.
|
|
28
27
|
*/
|
|
29
28
|
function BodyProp(_name) {
|
|
30
29
|
return (0, noop_1.createNoopParameterDecorator)('body-prop');
|
|
31
30
|
}
|
|
32
31
|
/**
|
|
33
|
-
*
|
|
32
|
+
* Injects the underlying runtime request object.
|
|
34
33
|
*/
|
|
35
34
|
function Request() {
|
|
36
35
|
return (0, noop_1.createNoopParameterDecorator)('request');
|
|
37
36
|
}
|
|
38
37
|
/**
|
|
39
|
-
*
|
|
38
|
+
* Binds a property from the underlying runtime request object.
|
|
40
39
|
*
|
|
41
|
-
* @param
|
|
40
|
+
* @param _name The request property name to read. Defaults to the parameter name.
|
|
42
41
|
*/
|
|
43
42
|
function RequestProp(_name) {
|
|
44
43
|
return (0, noop_1.createNoopParameterDecorator)('request-prop');
|
|
45
44
|
}
|
|
46
45
|
/**
|
|
47
|
-
*
|
|
46
|
+
* Binds a path parameter from the request URL.
|
|
48
47
|
*
|
|
49
|
-
* @param
|
|
48
|
+
* @param _name The path parameter name. Defaults to the parameter name.
|
|
50
49
|
*/
|
|
51
50
|
function Path(_name) {
|
|
52
51
|
return (0, noop_1.createNoopParameterDecorator)('path');
|
|
53
52
|
}
|
|
54
53
|
/**
|
|
55
|
-
*
|
|
54
|
+
* Binds a query-string value to a controller parameter.
|
|
56
55
|
*
|
|
57
|
-
* @param
|
|
56
|
+
* @param _name The query parameter name. Defaults to the parameter name.
|
|
58
57
|
*/
|
|
59
58
|
function Query(_name) {
|
|
60
59
|
return (0, noop_1.createNoopParameterDecorator)('query');
|
|
61
60
|
}
|
|
62
61
|
/**
|
|
63
|
-
*
|
|
62
|
+
* Binds the entire query object to a single controller parameter.
|
|
64
63
|
*/
|
|
65
64
|
function Queries() {
|
|
66
65
|
return (0, noop_1.createNoopParameterDecorator)('queries');
|
|
67
66
|
}
|
|
68
67
|
/**
|
|
69
|
-
*
|
|
68
|
+
* Binds an HTTP header value to a controller parameter.
|
|
70
69
|
*
|
|
71
|
-
* @param
|
|
70
|
+
* @param _name The header name. Defaults to the parameter name.
|
|
72
71
|
*/
|
|
73
72
|
function Header(_name) {
|
|
74
73
|
return (0, noop_1.createNoopParameterDecorator)('header');
|
|
75
74
|
}
|
|
76
75
|
/**
|
|
77
|
-
*
|
|
76
|
+
* Marks a parameter as injected by user code so tsoa skips route-generation metadata for it.
|
|
78
77
|
*/
|
|
79
78
|
function Inject() {
|
|
80
79
|
return (0, noop_1.createNoopParameterDecorator)('inject');
|
|
81
80
|
}
|
|
82
81
|
/**
|
|
83
|
-
*
|
|
82
|
+
* Binds a single uploaded file from a multipart/form-data request.
|
|
84
83
|
*
|
|
85
|
-
* @param
|
|
84
|
+
* @param _name The multipart field name. Defaults to the parameter name.
|
|
86
85
|
*/
|
|
87
86
|
function UploadedFile(_name) {
|
|
88
87
|
return (0, noop_1.createNoopParameterDecorator)('uploaded-file');
|
|
89
88
|
}
|
|
90
89
|
/**
|
|
91
|
-
*
|
|
90
|
+
* Binds multiple uploaded files from a multipart/form-data request.
|
|
92
91
|
*
|
|
93
|
-
* @param
|
|
92
|
+
* @param _name The multipart field name. Defaults to the parameter name.
|
|
94
93
|
*/
|
|
95
94
|
function UploadedFiles(_name) {
|
|
96
95
|
return (0, noop_1.createNoopParameterDecorator)('uploaded-files');
|
|
97
96
|
}
|
|
98
97
|
/**
|
|
99
|
-
*
|
|
98
|
+
* Binds a regular multipart form field from a multipart/form-data request.
|
|
100
99
|
*
|
|
101
|
-
* @param
|
|
100
|
+
* @param _name The multipart field name. Defaults to the parameter name.
|
|
102
101
|
*/
|
|
103
102
|
function FormField(_name) {
|
|
104
103
|
return (0, noop_1.createNoopParameterDecorator)('form-field');
|
|
105
104
|
}
|
|
106
105
|
/**
|
|
107
|
-
* Overrides the
|
|
108
|
-
* Can be used on specific method.
|
|
109
|
-
* Can't be used on controller level.
|
|
106
|
+
* Overrides the media type used to document a request body for a single action.
|
|
110
107
|
*
|
|
108
|
+
* @param _value The request body media type, for example `application/json`.
|
|
111
109
|
* @link https://swagger.io/docs/specification/describing-request-body/
|
|
112
110
|
*/
|
|
113
111
|
function Consumes(_value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameter.js","sourceRoot":"","sources":["../../src/decorators/parameter.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"parameter.js","sourceRoot":"","sources":["../../src/decorators/parameter.ts"],"names":[],"mappings":";;AAKA,oBAEC;AAOD,4BAEC;AAKD,0BAEC;AAOD,kCAEC;AAOD,oBAEC;AAOD,sBAEC;AAKD,0BAEC;AAOD,wBAEC;AAKD,wBAEC;AAOD,oCAEC;AAOD,sCAEC;AAOD,8BAEC;AAQD,4BAEC;AA9GD,iCAAgF;AAEhF;;GAEG;AACH,SAAgB,IAAI;IAClB,OAAO,IAAA,mCAA4B,EAAC,MAAM,CAAC,CAAA;AAC7C,CAAC;AAED;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,KAAc;IACrC,OAAO,IAAA,mCAA4B,EAAC,WAAW,CAAC,CAAA;AAClD,CAAC;AAED;;GAEG;AACH,SAAgB,OAAO;IACrB,OAAO,IAAA,mCA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pStatusCode } from '../interfaces/response';
|
|
3
|
+
/**
|
|
4
|
+
* Declares the successful response status, description, and media types for an operation.
|
|
5
|
+
*
|
|
6
|
+
* @param _name The HTTP status code returned when the operation succeeds.
|
|
7
|
+
* @param _description The response description shown in the generated OpenAPI document.
|
|
8
|
+
* @param _produces The response media type or media types.
|
|
9
|
+
*/
|
|
3
10
|
export declare function SuccessResponse<HeaderType extends IsValidHeader<HeaderType> = object>(_name: string | number, _description?: string, _produces?: string | string[]): MethodDecorator;
|
|
11
|
+
/**
|
|
12
|
+
* Adds a documented response that can be attached to a method or a controller.
|
|
13
|
+
*
|
|
14
|
+
* @param _name The HTTP status code, OpenAPI response range, or `default`.
|
|
15
|
+
* @param _description The response description shown in the generated OpenAPI document.
|
|
16
|
+
* @param _example An example payload for the response schema.
|
|
17
|
+
* @param _produces The response media type or media types.
|
|
18
|
+
*/
|
|
4
19
|
export declare function Response<ExampleType, HeaderType extends IsValidHeader<HeaderType> = object>(_name: HttpStatusCodeLiteral | HttpStatusCodeStringLiteral | OtherValidOpenApiHttpStatusCode, _description?: string, _example?: ExampleType, _produces?: string | string[]): MethodDecorator & ClassDecorator;
|
|
5
20
|
/**
|
|
6
21
|
* Inject a library-agnostic responder function that can be used to construct type-checked (usually error-) responses.
|
|
7
22
|
*
|
|
8
|
-
*
|
|
23
|
+
* Annotate the parameter as `TsoaResponse<Status, Data, Headers>` so tsoa can infer the documented response.
|
|
9
24
|
*/
|
|
10
25
|
export declare function Res(): ParameterDecorator;
|
|
11
26
|
/**
|
|
12
|
-
* Overrides the
|
|
13
|
-
* Can be used on controller level or only for specific method
|
|
27
|
+
* Overrides the response media type on a controller or a single action.
|
|
14
28
|
*
|
|
29
|
+
* @param _value The response media type, for example `application/json`.
|
|
15
30
|
* @link https://swagger.io/docs/specification/media-types/
|
|
16
31
|
*/
|
|
17
32
|
export declare function Produces(_value: string): MethodDecorator & ClassDecorator;
|
|
@@ -5,24 +5,39 @@ exports.Response = Response;
|
|
|
5
5
|
exports.Res = Res;
|
|
6
6
|
exports.Produces = Produces;
|
|
7
7
|
const noop_1 = require("./noop");
|
|
8
|
+
/**
|
|
9
|
+
* Declares the successful response status, description, and media types for an operation.
|
|
10
|
+
*
|
|
11
|
+
* @param _name The HTTP status code returned when the operation succeeds.
|
|
12
|
+
* @param _description The response description shown in the generated OpenAPI document.
|
|
13
|
+
* @param _produces The response media type or media types.
|
|
14
|
+
*/
|
|
8
15
|
function SuccessResponse(_name, _description, _produces) {
|
|
9
16
|
return (0, noop_1.createNoopMethodDecorator)('success-response');
|
|
10
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Adds a documented response that can be attached to a method or a controller.
|
|
20
|
+
*
|
|
21
|
+
* @param _name The HTTP status code, OpenAPI response range, or `default`.
|
|
22
|
+
* @param _description The response description shown in the generated OpenAPI document.
|
|
23
|
+
* @param _example An example payload for the response schema.
|
|
24
|
+
* @param _produces The response media type or media types.
|
|
25
|
+
*/
|
|
11
26
|
function Response(_name, _description, _example, _produces) {
|
|
12
27
|
return (0, noop_1.createNoopClassMethodDecorator)('response');
|
|
13
28
|
}
|
|
14
29
|
/**
|
|
15
30
|
* Inject a library-agnostic responder function that can be used to construct type-checked (usually error-) responses.
|
|
16
31
|
*
|
|
17
|
-
*
|
|
32
|
+
* Annotate the parameter as `TsoaResponse<Status, Data, Headers>` so tsoa can infer the documented response.
|
|
18
33
|
*/
|
|
19
34
|
function Res() {
|
|
20
35
|
return (0, noop_1.createNoopParameterDecorator)('res');
|
|
21
36
|
}
|
|
22
37
|
/**
|
|
23
|
-
* Overrides the
|
|
24
|
-
* Can be used on controller level or only for specific method
|
|
38
|
+
* Overrides the response media type on a controller or a single action.
|
|
25
39
|
*
|
|
40
|
+
* @param _value The response media type, for example `application/json`.
|
|
26
41
|
* @link https://swagger.io/docs/specification/media-types/
|
|
27
42
|
*/
|
|
28
43
|
function Produces(_value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../src/decorators/response.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../src/decorators/response.ts"],"names":[],"mappings":";;AAWA,0CAEC;AAUD,4BAOC;AAOD,kBAEC;AAQD,4BAEC;AA/CD,iCAAgH;AAEhH;;;;;;GAMG;AACH,SAAgB,eAAe,CAAwD,KAAsB,EAAE,YAAqB,EAAE,SAA6B;IACjK,OAAO,IAAA,gCAAyB,EAAC,kBAAkB,CAAC,CAAA;AACtD,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,QAAQ,CACtB,KAA4F,EAC5F,YAAqB,EACrB,QAAsB,EACtB,SAA6B;IAE7B,OAAO,IAAA,qCAA8B,EAAC,UAAU,CAAC,CAAA;AACnD,CAAC;AAED;;;;GAIG;AACH,SAAgB,GAAG;IACjB,OAAO,IAAA,mCAA4B,EAAC,KAAK,CAAC,CAAA;AAC5C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,MAAc;IACrC,OAAO,IAAA,qCAA8B,EAAC,UAAU,CAAC,CAAA;AACnD,CAAC"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declares the base route path for a controller.
|
|
3
|
+
*
|
|
4
|
+
* @param _name The controller path segment relative to the configured API base path.
|
|
5
|
+
*/
|
|
1
6
|
export declare function Route(_name?: string): ClassDecorator;
|
|
2
7
|
/**
|
|
3
|
-
*
|
|
8
|
+
* Hides a controller, action, or parameter from generated OpenAPI metadata.
|
|
4
9
|
*/
|
|
5
10
|
export declare function Hidden(): ClassDecorator & MethodDecorator & ParameterDecorator;
|
package/dist/decorators/route.js
CHANGED
|
@@ -3,11 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Route = Route;
|
|
4
4
|
exports.Hidden = Hidden;
|
|
5
5
|
const noop_1 = require("./noop");
|
|
6
|
+
/**
|
|
7
|
+
* Declares the base route path for a controller.
|
|
8
|
+
*
|
|
9
|
+
* @param _name The controller path segment relative to the configured API base path.
|
|
10
|
+
*/
|
|
6
11
|
function Route(_name) {
|
|
7
12
|
return (0, noop_1.createNoopClassDecorator)('route');
|
|
8
13
|
}
|
|
9
14
|
/**
|
|
10
|
-
*
|
|
15
|
+
* Hides a controller, action, or parameter from generated OpenAPI metadata.
|
|
11
16
|
*/
|
|
12
17
|
function Hidden() {
|
|
13
18
|
return (0, noop_1.createNoopHiddenDecorator)('hidden');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../src/decorators/route.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../src/decorators/route.ts"],"names":[],"mappings":";;AAOA,sBAEC;AAKD,wBAEC;AAhBD,iCAA4E;AAE5E;;;;GAIG;AACH,SAAgB,KAAK,CAAC,KAAc;IAClC,OAAO,IAAA,+BAAwB,EAAC,OAAO,CAAC,CAAA;AAC1C,CAAC;AAED;;GAEG;AACH,SAAgB,MAAM;IACpB,OAAO,IAAA,gCAAyB,EAAC,QAAQ,CAAC,CAAA;AAC5C,CAAC"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Clears inherited security requirements for a controller or action.
|
|
3
3
|
*/
|
|
4
4
|
export declare function NoSecurity(): ClassDecorator & MethodDecorator;
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Declares the security requirement for a controller or action.
|
|
7
|
+
*
|
|
8
|
+
* @param _name The security scheme name, or a full security requirement object.
|
|
9
|
+
* @param _scopes OAuth scopes required by the scheme when `_name` is a string.
|
|
7
10
|
*/
|
|
8
11
|
export declare function Security(_name: string | {
|
|
9
12
|
[name: string]: string[];
|
|
@@ -4,13 +4,16 @@ exports.NoSecurity = NoSecurity;
|
|
|
4
4
|
exports.Security = Security;
|
|
5
5
|
const noop_1 = require("./noop");
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Clears inherited security requirements for a controller or action.
|
|
8
8
|
*/
|
|
9
9
|
function NoSecurity() {
|
|
10
10
|
return (0, noop_1.createNoopClassMethodDecorator)('no-security');
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Declares the security requirement for a controller or action.
|
|
14
|
+
*
|
|
15
|
+
* @param _name The security scheme name, or a full security requirement object.
|
|
16
|
+
* @param _scopes OAuth scopes required by the scheme when `_name` is a string.
|
|
14
17
|
*/
|
|
15
18
|
function Security(_name, _scopes) {
|
|
16
19
|
return (0, noop_1.createNoopClassMethodDecorator)('security');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.js","sourceRoot":"","sources":["../../src/decorators/security.ts"],"names":[],"mappings":";;AAKA,gCAEC;
|
|
1
|
+
{"version":3,"file":"security.js","sourceRoot":"","sources":["../../src/decorators/security.ts"],"names":[],"mappings":";;AAKA,gCAEC;AAQD,4BAEC;AAjBD,iCAAuD;AAEvD;;GAEG;AACH,SAAgB,UAAU;IACxB,OAAO,IAAA,qCAA8B,EAAC,aAAa,CAAC,CAAA;AACtD,CAAC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,KAA4C,EAAE,OAAkB;IACvF,OAAO,IAAA,qCAA8B,EAAC,UAAU,CAAC,CAAA;AACnD,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Readable } from 'node:stream';
|
|
2
|
+
import { Swagger } from '../swagger/swagger';
|
|
3
|
+
/** Supported runtimes for built-in {@link SpecPath} targets. */
|
|
4
|
+
export type SpecRuntime = 'express' | 'koa' | 'hapi';
|
|
5
|
+
/** Built-in documentation targets supported by {@link SpecPath}. */
|
|
6
|
+
export type BuiltinSpecPathTarget = 'json' | 'yaml' | 'swagger' | 'redoc' | 'rapidoc';
|
|
7
|
+
/** Serialized OpenAPI formats that can be requested from a {@link SpecGenerator}. */
|
|
8
|
+
export type SpecDocumentFormat = 'json' | 'yaml';
|
|
9
|
+
/** Response body types accepted from built-in and custom {@link SpecPath} handlers. */
|
|
10
|
+
export type SpecResponseValue = string | Readable;
|
|
11
|
+
/** Describes the runtime contract needed to rebuild an OpenAPI document on demand. */
|
|
12
|
+
export interface SpecGenerator {
|
|
13
|
+
getSpecObject(): Promise<Swagger.Spec>;
|
|
14
|
+
getSpecString(format: SpecDocumentFormat): Promise<string>;
|
|
15
|
+
}
|
|
16
|
+
/** Context passed to spec-response caches. */
|
|
17
|
+
export interface SpecCacheContext {
|
|
18
|
+
cacheKey: string;
|
|
19
|
+
controllerClass: object;
|
|
20
|
+
fullPath: string;
|
|
21
|
+
path: string;
|
|
22
|
+
runtime: SpecRuntime;
|
|
23
|
+
target: BuiltinSpecPathTarget | 'custom';
|
|
24
|
+
format?: SpecDocumentFormat | 'html';
|
|
25
|
+
}
|
|
26
|
+
/** Request-scoped context passed to custom {@link SpecPath} handlers. */
|
|
27
|
+
export interface SpecRequestContext extends SpecCacheContext {
|
|
28
|
+
request?: unknown;
|
|
29
|
+
response?: unknown;
|
|
30
|
+
getSpecObject(): Promise<Swagger.Spec>;
|
|
31
|
+
getSpecString(format: SpecDocumentFormat): Promise<string>;
|
|
32
|
+
}
|
|
33
|
+
/** Custom handler used by {@link SpecPath} to serve spec content. */
|
|
34
|
+
export type SpecResponseHandler = (context: SpecRequestContext) => SpecResponseValue | Promise<SpecResponseValue>;
|
|
35
|
+
/** Cache adapter used by {@link SpecPath} to memoize generated responses. */
|
|
36
|
+
export interface SpecCacheHandler {
|
|
37
|
+
get(context: SpecCacheContext): SpecResponseValue | Promise<SpecResponseValue | undefined> | undefined;
|
|
38
|
+
set(context: SpecCacheContext, value: string): void | Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
/** Route target supported by {@link SpecPath}. */
|
|
41
|
+
export type SpecPathTarget = BuiltinSpecPathTarget | SpecResponseHandler;
|
|
42
|
+
/** Cache strategy supported by {@link SpecPath}. */
|
|
43
|
+
export type SpecPathCache = 'none' | 'memory' | SpecCacheHandler;
|
|
44
|
+
/** Stored definition for a single declared {@link SpecPath}. */
|
|
45
|
+
export interface SpecPathDefinition {
|
|
46
|
+
path: string;
|
|
47
|
+
normalizedPath: string;
|
|
48
|
+
target: SpecPathTarget;
|
|
49
|
+
cache: SpecPathCache;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Registers a controller-local route that serves the generated OpenAPI document or a custom derived response.
|
|
53
|
+
*
|
|
54
|
+
* @param path The relative route path. Defaults to `spec`.
|
|
55
|
+
* @param target The built-in documentation target or a custom response handler.
|
|
56
|
+
* @param cache Cache strategy for generated responses. Defaults to in-memory caching.
|
|
57
|
+
*/
|
|
58
|
+
export declare function SpecPath(path?: string, target?: SpecPathTarget, cache?: SpecPathCache): ClassDecorator;
|
|
59
|
+
/** Returns the spec-path definitions declared on a controller. */
|
|
60
|
+
export declare function fetchSpecPaths(target: object): readonly SpecPathDefinition[];
|
|
61
|
+
/** Produces a human-readable summary of a spec-path definition for logging and diagnostics. */
|
|
62
|
+
export declare function describeSpecPath(specPath: SpecPathDefinition): {
|
|
63
|
+
cache: string;
|
|
64
|
+
path: string;
|
|
65
|
+
target: string;
|
|
66
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpecPath = SpecPath;
|
|
4
|
+
exports.fetchSpecPaths = fetchSpecPaths;
|
|
5
|
+
exports.describeSpecPath = describeSpecPath;
|
|
6
|
+
const pathUtils_1 = require("../utils/pathUtils");
|
|
7
|
+
const SPEC_PATHS_SYMBOL = Symbol.for('@tsoa-next/spec-paths');
|
|
8
|
+
function isBuiltinSpecTarget(target) {
|
|
9
|
+
return typeof target === 'string';
|
|
10
|
+
}
|
|
11
|
+
function getTargetDescription(target) {
|
|
12
|
+
return isBuiltinSpecTarget(target) ? target : 'custom handler';
|
|
13
|
+
}
|
|
14
|
+
function getCacheDescription(cache) {
|
|
15
|
+
return typeof cache === 'string' ? cache : 'custom cache';
|
|
16
|
+
}
|
|
17
|
+
function getExistingSpecPaths(target) {
|
|
18
|
+
const existing = Reflect.get(target, SPEC_PATHS_SYMBOL);
|
|
19
|
+
return existing ? [...existing] : [];
|
|
20
|
+
}
|
|
21
|
+
function defineSpecPaths(target, specPaths) {
|
|
22
|
+
Reflect.defineProperty(target, SPEC_PATHS_SYMBOL, {
|
|
23
|
+
configurable: true,
|
|
24
|
+
enumerable: false,
|
|
25
|
+
value: specPaths,
|
|
26
|
+
writable: true,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function normalizeSpecPath(path) {
|
|
30
|
+
return (0, pathUtils_1.normalisePath)(path ?? 'spec', '/');
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Registers a controller-local route that serves the generated OpenAPI document or a custom derived response.
|
|
34
|
+
*
|
|
35
|
+
* @param path The relative route path. Defaults to `spec`.
|
|
36
|
+
* @param target The built-in documentation target or a custom response handler.
|
|
37
|
+
* @param cache Cache strategy for generated responses. Defaults to in-memory caching.
|
|
38
|
+
*/
|
|
39
|
+
function SpecPath(path = 'spec', target = 'json', cache = 'memory') {
|
|
40
|
+
return classTarget => {
|
|
41
|
+
const normalizedPath = normalizeSpecPath(path);
|
|
42
|
+
const existing = getExistingSpecPaths(classTarget);
|
|
43
|
+
if (existing.some(specPath => specPath.normalizedPath === normalizedPath)) {
|
|
44
|
+
const className = typeof classTarget === 'function' && classTarget.name ? classTarget.name : 'anonymous controller';
|
|
45
|
+
throw new Error(`Duplicate @SpecPath('${path}') found on '${className}'. Multiple SpecPath decorators must resolve to unique paths.`);
|
|
46
|
+
}
|
|
47
|
+
existing.push({
|
|
48
|
+
cache,
|
|
49
|
+
normalizedPath,
|
|
50
|
+
path,
|
|
51
|
+
target,
|
|
52
|
+
});
|
|
53
|
+
defineSpecPaths(classTarget, existing);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** Returns the spec-path definitions declared on a controller. */
|
|
57
|
+
function fetchSpecPaths(target) {
|
|
58
|
+
return getExistingSpecPaths(target);
|
|
59
|
+
}
|
|
60
|
+
/** Produces a human-readable summary of a spec-path definition for logging and diagnostics. */
|
|
61
|
+
function describeSpecPath(specPath) {
|
|
62
|
+
return {
|
|
63
|
+
cache: getCacheDescription(specPath.cache),
|
|
64
|
+
path: specPath.path,
|
|
65
|
+
target: getTargetDescription(specPath.target),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=specPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specPath.js","sourceRoot":"","sources":["../../src/decorators/specPath.ts"],"names":[],"mappings":";;AAmGA,4BAmBC;AAGD,wCAEC;AAGD,4CAMC;AAlID,kDAAkD;AA0DlD,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;AAE7D,SAAS,mBAAmB,CAAC,MAAsB;IACjD,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAA;AACnC,CAAC;AAED,SAAS,oBAAoB,CAAC,MAAsB;IAClD,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAA;AAChE,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAoB;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAA;AAC3D,CAAC;AAED,SAAS,oBAAoB,CAAC,MAAc;IAC1C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAqC,CAAA;IAC3F,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AACtC,CAAC;AAED,SAAS,eAAe,CAAC,MAAc,EAAE,SAA+B;IACtE,OAAO,CAAC,cAAc,CAAC,MAAM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CAAC,KAAK,CAAC;QAC1C,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,MAAM,CAAC;KAC9C,CAAA;AACH,CAAC"}
|
package/dist/decorators/tags.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Tags = Tags;
|
|
4
|
+
/**
|
|
5
|
+
* Adds OpenAPI tags to a controller or action.
|
|
6
|
+
*
|
|
7
|
+
* @param _values One or more tag names to attach.
|
|
8
|
+
*/
|
|
4
9
|
function Tags(..._values) {
|
|
5
10
|
return () => {
|
|
6
11
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../src/decorators/tags.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../src/decorators/tags.ts"],"names":[],"mappings":";;AAKA,oBAIC;AATD;;;;GAIG;AACH,SAAgB,IAAI,CAAC,GAAG,OAAiB;IACvC,OAAO,GAAG,EAAE;QACV,OAAM;IACR,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -5,5 +5,10 @@ type ValidateDecoratorConfig = {
|
|
|
5
5
|
};
|
|
6
6
|
type DecoratorPropertyKey = string | symbol | undefined;
|
|
7
7
|
export declare function getParameterExternalValidatorMetadata(target: object, propertyKey: DecoratorPropertyKey, parameterIndex: number): ValidateDecoratorConfig | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Attaches external-schema validation metadata to a controller parameter.
|
|
10
|
+
*
|
|
11
|
+
* Supported forms are `@Validate(schema)`, `@Validate(kind, schema)`, and `@Validate({ kind, schema })`.
|
|
12
|
+
*/
|
|
8
13
|
export declare function Validate(...args: unknown[]): ParameterDecorator;
|
|
9
14
|
export {};
|
|
@@ -98,6 +98,11 @@ function getParameterExternalValidatorMetadata(target, propertyKey, parameterInd
|
|
|
98
98
|
}
|
|
99
99
|
return undefined;
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Attaches external-schema validation metadata to a controller parameter.
|
|
103
|
+
*
|
|
104
|
+
* Supported forms are `@Validate(schema)`, `@Validate(kind, schema)`, and `@Validate({ kind, schema })`.
|
|
105
|
+
*/
|
|
101
106
|
function Validate(...args) {
|
|
102
107
|
const normalized = normalizeValidateDecoratorArgs(args);
|
|
103
108
|
return (target, propertyKey, parameterIndex) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/decorators/validate.ts"],"names":[],"mappings":";;AAsHA,sFAeC;
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/decorators/validate.ts"],"names":[],"mappings":";;AAsHA,sFAeC;AAOD,4BAWC;AArJD,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAA;AACvE,MAAM,oBAAoB,GAAG,iBAAiB,CAAA;AAW9C,SAAS,kBAAkB,CAAC,MAAe;IACzC,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC1C,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,SAAS,GAAG,MAAiC,CAAA;IAEnD,IAAI,OAAO,SAAS,CAAC,SAAS,KAAK,UAAU,EAAE,CAAC;QAC9C,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK,UAAU,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK,UAAU,IAAI,OAAO,SAAS,CAAC,EAAE,KAAK,UAAU,EAAE,CAAC;QAC3H,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,IAAI,OAAO,SAAS,CAAC,YAAY,KAAK,UAAU,IAAI,OAAO,SAAS,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC7F,OAAO,KAAK,CAAA;IACd,CAA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aAAa,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAA;QAC5C,aAAa,CAAC,cAAc,CAAC,GAAG,UAAU,CAAA;QAC1C,KAAK,CAAC,SAAS,CAAC,GAAG,aAAa,CAAA;QAChC,OAAO,CAAC,cAAc,CAAC,qBAAqB,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IAC9D,CAAC,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './decorators/parameter';
|
|
|
10
10
|
export * from './decorators/response';
|
|
11
11
|
export * from './decorators/route';
|
|
12
12
|
export * from './decorators/security';
|
|
13
|
+
export * from './decorators/specPath';
|
|
13
14
|
export * from './decorators/tags';
|
|
14
15
|
export * from './decorators/validate';
|
|
15
16
|
export * from './interfaces/controller';
|
|
@@ -19,8 +20,10 @@ export * from './interfaces/response';
|
|
|
19
20
|
export * from './metadataGeneration/tsoa';
|
|
20
21
|
export * from './routeGeneration/additionalProps';
|
|
21
22
|
export * from './routeGeneration/externalValidation';
|
|
23
|
+
export * from './routeGeneration/specPathSupport';
|
|
22
24
|
export * from './routeGeneration/templateHelpers';
|
|
23
25
|
export * from './routeGeneration/templates';
|
|
24
26
|
export * from './routeGeneration/tsoa-route';
|
|
25
27
|
export * from './swagger/swagger';
|
|
26
28
|
export * from './utils/assertNever';
|
|
29
|
+
export * from './utils/pathUtils';
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ __exportStar(require("./decorators/parameter"), exports);
|
|
|
26
26
|
__exportStar(require("./decorators/response"), exports);
|
|
27
27
|
__exportStar(require("./decorators/route"), exports);
|
|
28
28
|
__exportStar(require("./decorators/security"), exports);
|
|
29
|
+
__exportStar(require("./decorators/specPath"), exports);
|
|
29
30
|
__exportStar(require("./decorators/tags"), exports);
|
|
30
31
|
__exportStar(require("./decorators/validate"), exports);
|
|
31
32
|
__exportStar(require("./interfaces/controller"), exports);
|
|
@@ -35,9 +36,11 @@ __exportStar(require("./interfaces/response"), exports);
|
|
|
35
36
|
__exportStar(require("./metadataGeneration/tsoa"), exports);
|
|
36
37
|
__exportStar(require("./routeGeneration/additionalProps"), exports);
|
|
37
38
|
__exportStar(require("./routeGeneration/externalValidation"), exports);
|
|
39
|
+
__exportStar(require("./routeGeneration/specPathSupport"), exports);
|
|
38
40
|
__exportStar(require("./routeGeneration/templateHelpers"), exports);
|
|
39
41
|
__exportStar(require("./routeGeneration/templates"), exports);
|
|
40
42
|
__exportStar(require("./routeGeneration/tsoa-route"), exports);
|
|
41
43
|
__exportStar(require("./swagger/swagger"), exports);
|
|
42
44
|
__exportStar(require("./utils/assertNever"), exports);
|
|
45
|
+
__exportStar(require("./utils/pathUtils"), exports);
|
|
43
46
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4BAAyB;AACzB,2CAAwB;AACxB,0DAAuC;AACvC,uDAAoC;AACpC,yDAAsC;AACtC,uDAAoC;AACpC,2DAAwC;AACxC,2DAAwC;AACxC,yDAAsC;AACtC,wDAAqC;AACrC,qDAAkC;AAClC,wDAAqC;AACrC,oDAAiC;AACjC,wDAAqC;AACrC,0DAAuC;AACvC,oDAAiC;AACjC,yDAAsC;AACtC,wDAAqC;AACrC,4DAAyC;AACzC,oEAAiD;AACjD,uEAAoD;AACpD,oEAAiD;AACjD,8DAA2C;AAC3C,+DAA4C;AAC5C,oDAAiC;AACjC,sDAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4BAAyB;AACzB,2CAAwB;AACxB,0DAAuC;AACvC,uDAAoC;AACpC,yDAAsC;AACtC,uDAAoC;AACpC,2DAAwC;AACxC,2DAAwC;AACxC,yDAAsC;AACtC,wDAAqC;AACrC,qDAAkC;AAClC,wDAAqC;AACrC,wDAAqC;AACrC,oDAAiC;AACjC,wDAAqC;AACrC,0DAAuC;AACvC,oDAAiC;AACjC,yDAAsC;AACtC,wDAAqC;AACrC,4DAAyC;AACzC,oEAAiD;AACjD,uEAAoD;AACpD,oEAAiD;AACjD,oEAAiD;AACjD,8DAA2C;AAC3C,+DAA4C;AAC5C,oDAAiC;AACjC,sDAAmC;AACnC,oDAAiC"}
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import type { OutgoingHttpHeaders } from 'node:http';
|
|
2
2
|
type HeaderNames = keyof OutgoingHttpHeaders;
|
|
3
3
|
type HeaderValue<H extends HeaderNames> = OutgoingHttpHeaders[H];
|
|
4
|
+
/**
|
|
5
|
+
* Base controller class that lets actions override the eventual status code and headers.
|
|
6
|
+
*/
|
|
4
7
|
export declare class Controller {
|
|
5
8
|
private statusCode?;
|
|
6
9
|
private headers;
|
|
10
|
+
/** Sets the HTTP status code that the generated route handler should return. */
|
|
7
11
|
setStatus(statusCode: number): void;
|
|
12
|
+
/** Returns the HTTP status code set through {@link setStatus}, if any. */
|
|
8
13
|
getStatus(): number | undefined;
|
|
9
14
|
setHeader<H extends HeaderNames>(name: H, value?: HeaderValue<H>): void;
|
|
10
15
|
setHeader(name: string, value?: string | string[]): void;
|
|
16
|
+
/** Returns a previously assigned response header value. */
|
|
11
17
|
getHeader(name: string): string | string[] | undefined;
|
|
18
|
+
/** Returns all response headers assigned on the controller instance. */
|
|
12
19
|
getHeaders(): {
|
|
13
20
|
[name: string]: string | string[] | undefined;
|
|
14
21
|
};
|
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Controller = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Base controller class that lets actions override the eventual status code and headers.
|
|
6
|
+
*/
|
|
4
7
|
class Controller {
|
|
5
8
|
statusCode = undefined;
|
|
6
9
|
headers = {};
|
|
10
|
+
/** Sets the HTTP status code that the generated route handler should return. */
|
|
7
11
|
setStatus(statusCode) {
|
|
8
12
|
this.statusCode = statusCode;
|
|
9
13
|
}
|
|
14
|
+
/** Returns the HTTP status code set through {@link setStatus}, if any. */
|
|
10
15
|
getStatus() {
|
|
11
16
|
return this.statusCode;
|
|
12
17
|
}
|
|
18
|
+
/** Stores a response header value that the generated route handler should emit. */
|
|
13
19
|
setHeader(name, value) {
|
|
14
20
|
this.headers[name] = value;
|
|
15
21
|
}
|
|
22
|
+
/** Returns a previously assigned response header value. */
|
|
16
23
|
getHeader(name) {
|
|
17
24
|
return this.headers[name];
|
|
18
25
|
}
|
|
26
|
+
/** Returns all response headers assigned on the controller instance. */
|
|
19
27
|
getHeaders() {
|
|
20
28
|
return this.headers;
|
|
21
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../src/interfaces/controller.ts"],"names":[],"mappings":";;;AAKA,MAAa,UAAU;IACb,UAAU,GAAY,SAAS,CAAA;IAC/B,OAAO,GAAG,EAAuD,CAAA;
|
|
1
|
+
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../src/interfaces/controller.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACH,MAAa,UAAU;IACb,UAAU,GAAY,SAAS,CAAA;IAC/B,OAAO,GAAG,EAAuD,CAAA;IAEzE,gFAAgF;IACzE,SAAS,CAAC,UAAkB;QACjC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;IAED,0EAA0E;IACnE,SAAS;QACd,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;IAKD,mFAAmF;IAC5E,SAAS,CAAC,IAAY,EAAE,KAAyB;QACtD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;IAC5B,CAAC;IAED,2DAA2D;IACpD,SAAS,CAAC,IAAY;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC;IAED,wEAAwE;IACjE,UAAU;QACf,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;CACF;AA/BD,gCA+BC"}
|