inviton-backduck 1.0.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/LICENSE +21 -0
- package/README.md +302 -0
- package/dist/apidoc/api-doc-generator.d.ts +58 -0
- package/dist/apidoc/api-doc-generator.d.ts.map +1 -0
- package/dist/apidoc/api-doc-generator.js +201 -0
- package/dist/apidoc/api-doc-generator.js.map +1 -0
- package/dist/apidoc/config.d.ts +153 -0
- package/dist/apidoc/config.d.ts.map +1 -0
- package/dist/apidoc/config.js +254 -0
- package/dist/apidoc/config.js.map +1 -0
- package/dist/apidoc/controller-parser.d.ts +208 -0
- package/dist/apidoc/controller-parser.d.ts.map +1 -0
- package/dist/apidoc/controller-parser.js +686 -0
- package/dist/apidoc/controller-parser.js.map +1 -0
- package/dist/apidoc/html-generator.d.ts +290 -0
- package/dist/apidoc/html-generator.d.ts.map +1 -0
- package/dist/apidoc/html-generator.js +2295 -0
- package/dist/apidoc/html-generator.js.map +1 -0
- package/dist/apidoc/index.d.ts +20 -0
- package/dist/apidoc/index.d.ts.map +1 -0
- package/dist/apidoc/index.js +16 -0
- package/dist/apidoc/index.js.map +1 -0
- package/dist/apidoc/openapi-builder.d.ts +169 -0
- package/dist/apidoc/openapi-builder.d.ts.map +1 -0
- package/dist/apidoc/openapi-builder.js +634 -0
- package/dist/apidoc/openapi-builder.js.map +1 -0
- package/dist/apidoc/parameterGeneratorRegistry.d.ts +20 -0
- package/dist/apidoc/parameterGeneratorRegistry.d.ts.map +1 -0
- package/dist/apidoc/parameterGeneratorRegistry.js +6 -0
- package/dist/apidoc/parameterGeneratorRegistry.js.map +1 -0
- package/dist/apidoc/test-type-resolver.d.ts +2 -0
- package/dist/apidoc/test-type-resolver.d.ts.map +1 -0
- package/dist/apidoc/test-type-resolver.js +6 -0
- package/dist/apidoc/test-type-resolver.js.map +1 -0
- package/dist/apidoc/type-resolver.d.ts +266 -0
- package/dist/apidoc/type-resolver.d.ts.map +1 -0
- package/dist/apidoc/type-resolver.js +1226 -0
- package/dist/apidoc/type-resolver.js.map +1 -0
- package/dist/apidoc/verify-type-resolution.d.ts +3 -0
- package/dist/apidoc/verify-type-resolution.d.ts.map +1 -0
- package/dist/apidoc/verify-type-resolution.js +29 -0
- package/dist/apidoc/verify-type-resolution.js.map +1 -0
- package/dist/bun/bunRouter.d.ts +70 -0
- package/dist/bun/bunRouter.d.ts.map +1 -0
- package/dist/bun/bunRouter.js +324 -0
- package/dist/bun/bunRouter.js.map +1 -0
- package/dist/bun/bunServer.d.ts +72 -0
- package/dist/bun/bunServer.d.ts.map +1 -0
- package/dist/bun/bunServer.js +218 -0
- package/dist/bun/bunServer.js.map +1 -0
- package/dist/bun/bunStaticFiles.d.ts +76 -0
- package/dist/bun/bunStaticFiles.d.ts.map +1 -0
- package/dist/bun/bunStaticFiles.js +251 -0
- package/dist/bun/bunStaticFiles.js.map +1 -0
- package/dist/bun/index.d.ts +7 -0
- package/dist/bun/index.d.ts.map +1 -0
- package/dist/bun/index.js +7 -0
- package/dist/bun/index.js.map +1 -0
- package/dist/data-contracts.d.ts +132 -0
- package/dist/data-contracts.d.ts.map +1 -0
- package/dist/data-contracts.js +2 -0
- package/dist/data-contracts.js.map +1 -0
- package/dist/decorators.d.ts +75 -0
- package/dist/decorators.d.ts.map +1 -0
- package/dist/decorators.js +101 -0
- package/dist/decorators.js.map +1 -0
- package/dist/express/expressFrontendRouter.d.ts +17 -0
- package/dist/express/expressFrontendRouter.d.ts.map +1 -0
- package/dist/express/expressFrontendRouter.js +33 -0
- package/dist/express/expressFrontendRouter.js.map +1 -0
- package/dist/express/expressRouter.d.ts +25 -0
- package/dist/express/expressRouter.d.ts.map +1 -0
- package/dist/express/expressRouter.js +150 -0
- package/dist/express/expressRouter.js.map +1 -0
- package/dist/express/index.d.ts +6 -0
- package/dist/express/index.d.ts.map +1 -0
- package/dist/express/index.js +6 -0
- package/dist/express/index.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/router.d.ts +162 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +350 -0
- package/dist/router.js.map +1 -0
- package/dist/runtime-detect.d.ts +20 -0
- package/dist/runtime-detect.d.ts.map +1 -0
- package/dist/runtime-detect.js +20 -0
- package/dist/runtime-detect.js.map +1 -0
- package/dist/server.d.ts +126 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +181 -0
- package/dist/server.js.map +1 -0
- package/dist/utils.d.ts +83 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +157 -0
- package/dist/utils.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for API Documentation Generator
|
|
3
|
+
*/
|
|
4
|
+
export declare class ApiDocConfig {
|
|
5
|
+
/** API metadata for OpenAPI info section */
|
|
6
|
+
static readonly title = "GoPass E-Shop API";
|
|
7
|
+
static readonly version = "1.0.0";
|
|
8
|
+
static readonly description = "API documentation for the GoPass e-commerce platform";
|
|
9
|
+
static readonly contact: {
|
|
10
|
+
name: string;
|
|
11
|
+
email: string;
|
|
12
|
+
};
|
|
13
|
+
/** Server URLs for different environments */
|
|
14
|
+
static readonly servers: {
|
|
15
|
+
development: {
|
|
16
|
+
url: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
staging: {
|
|
20
|
+
url: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
production: {
|
|
24
|
+
url: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
/** Base paths for API routes */
|
|
29
|
+
static readonly basePaths: {
|
|
30
|
+
shop: string;
|
|
31
|
+
admin: string;
|
|
32
|
+
};
|
|
33
|
+
/** Output directory paths (relative to server directory) */
|
|
34
|
+
static readonly output: {
|
|
35
|
+
/** Base directory for generated documentation */
|
|
36
|
+
baseDir: string;
|
|
37
|
+
/** Swagger UI output directory */
|
|
38
|
+
swaggerDir: string;
|
|
39
|
+
/** HTML documentation output directory */
|
|
40
|
+
htmlDir: string;
|
|
41
|
+
/** OpenAPI spec filename */
|
|
42
|
+
specFilename: string;
|
|
43
|
+
};
|
|
44
|
+
/** File patterns for controller discovery */
|
|
45
|
+
static readonly patterns: {
|
|
46
|
+
/** Pattern to find controller files */
|
|
47
|
+
controllerFiles: string;
|
|
48
|
+
/** Pattern to find router files */
|
|
49
|
+
routerFiles: string;
|
|
50
|
+
/** Pattern to find service interface files */
|
|
51
|
+
serviceInterfaceFiles: string;
|
|
52
|
+
/** Pattern to find args/dto files */
|
|
53
|
+
argsFiles: string;
|
|
54
|
+
};
|
|
55
|
+
/** Source directories (relative to server directory) */
|
|
56
|
+
static readonly sourceDirectories: {
|
|
57
|
+
/** Shop API controllers directory */
|
|
58
|
+
shopApi: string;
|
|
59
|
+
/** Admin API controllers directory */
|
|
60
|
+
adminApi: string;
|
|
61
|
+
/** Services directory */
|
|
62
|
+
services: string;
|
|
63
|
+
};
|
|
64
|
+
/** HTTP method mappings from controller method names */
|
|
65
|
+
static readonly httpMethodMappings: Record<string, string>;
|
|
66
|
+
/** Decorator names to look for */
|
|
67
|
+
static readonly decorators: {
|
|
68
|
+
route: string;
|
|
69
|
+
shopAuth: string;
|
|
70
|
+
shopEnterpriseAuth: string;
|
|
71
|
+
adminAuth: string;
|
|
72
|
+
rateLimit: string;
|
|
73
|
+
webMethod: string;
|
|
74
|
+
};
|
|
75
|
+
/** TypeScript types that need special handling in OpenAPI schema */
|
|
76
|
+
static readonly specialTypes: Record<string, object>;
|
|
77
|
+
/** Security scheme configuration for OpenAPI */
|
|
78
|
+
static readonly securitySchemes: {
|
|
79
|
+
shopApiAuth: {
|
|
80
|
+
type: "apiKey";
|
|
81
|
+
name: string;
|
|
82
|
+
in: "header";
|
|
83
|
+
description: string;
|
|
84
|
+
};
|
|
85
|
+
bearerAuth: {
|
|
86
|
+
type: "http";
|
|
87
|
+
scheme: string;
|
|
88
|
+
bearerFormat: string;
|
|
89
|
+
description: string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
/** Tag descriptions for endpoint grouping */
|
|
93
|
+
static readonly tagDescriptions: Record<string, string>;
|
|
94
|
+
/** Getting Started section content configuration */
|
|
95
|
+
static readonly gettingStarted: {
|
|
96
|
+
/** Introduction paragraph shown after the lead description */
|
|
97
|
+
introText: string;
|
|
98
|
+
/** API interfaces available (shown in URI structure table) */
|
|
99
|
+
apiInterfaces: {
|
|
100
|
+
name: string;
|
|
101
|
+
description: string;
|
|
102
|
+
}[];
|
|
103
|
+
/** Example resources for documentation */
|
|
104
|
+
exampleResources: string[];
|
|
105
|
+
/** HTTP headers configuration */
|
|
106
|
+
httpHeaders: {
|
|
107
|
+
name: string;
|
|
108
|
+
description: string;
|
|
109
|
+
example: string;
|
|
110
|
+
}[];
|
|
111
|
+
/** Authentication methods configuration */
|
|
112
|
+
authentication: {
|
|
113
|
+
/** Bearer token authentication details */
|
|
114
|
+
bearerToken: {
|
|
115
|
+
title: string;
|
|
116
|
+
description: string;
|
|
117
|
+
steps: string[];
|
|
118
|
+
};
|
|
119
|
+
/** API key authentication details */
|
|
120
|
+
apiKey: {
|
|
121
|
+
title: string;
|
|
122
|
+
description: string;
|
|
123
|
+
steps: string[];
|
|
124
|
+
note: string;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Get the current environment mode
|
|
130
|
+
*/
|
|
131
|
+
static getMode: () => "development" | "production";
|
|
132
|
+
/**
|
|
133
|
+
* Get the appropriate server URL based on current environment
|
|
134
|
+
*/
|
|
135
|
+
static getCurrentServerUrl: () => string;
|
|
136
|
+
/**
|
|
137
|
+
* Get absolute path for output directory
|
|
138
|
+
*/
|
|
139
|
+
static getOutputPath: (serverDir: string, type: "swagger" | "html") => string;
|
|
140
|
+
/**
|
|
141
|
+
* Get absolute path for source directory
|
|
142
|
+
*/
|
|
143
|
+
static getSourcePath: (serverDir: string, type: "shopApi" | "adminApi" | "services") => string;
|
|
144
|
+
/**
|
|
145
|
+
* Get HTTP method from controller method name
|
|
146
|
+
*/
|
|
147
|
+
static getHttpMethod: (methodName: string) => string | null;
|
|
148
|
+
/**
|
|
149
|
+
* Get OpenAPI schema for special TypeScript types
|
|
150
|
+
*/
|
|
151
|
+
static getSpecialTypeSchema: (typeName: string) => object | null;
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/apidoc/config.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,qBAAa,YAAY;IACxB,4CAA4C;IAC5C,MAAM,CAAC,QAAQ,CAAC,KAAK,uBAAuB;IAC5C,MAAM,CAAC,QAAQ,CAAC,OAAO,WAAW;IAClC,MAAM,CAAC,QAAQ,CAAC,WAAW,0DAA0D;IACrF,MAAM,CAAC,QAAQ,CAAC,OAAO;;;MAGrB;IAEF,6CAA6C;IAC7C,MAAM,CAAC,QAAQ,CAAC,OAAO;;;;;;;;;;;;;MAarB;IAEF,gCAAgC;IAChC,MAAM,CAAC,QAAQ,CAAC,SAAS;;;MAGvB;IAEF,4DAA4D;IAC5D,MAAM,CAAC,QAAQ,CAAC,MAAM;QACrB,iDAAiD;;QAEjD,kCAAkC;;QAElC,0CAA0C;;QAE1C,4BAA4B;;MAE3B;IAEF,6CAA6C;IAC7C,MAAM,CAAC,QAAQ,CAAC,QAAQ;QACvB,uCAAuC;;QAEvC,mCAAmC;;QAEnC,8CAA8C;;QAE9C,qCAAqC;;MAEpC;IAEF,wDAAwD;IACxD,MAAM,CAAC,QAAQ,CAAC,iBAAiB;QAChC,qCAAqC;;QAErC,sCAAsC;;QAEtC,yBAAyB;;MAExB;IAEF,wDAAwD;IACxD,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAA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|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Configuration for API Documentation Generator
|
|
8
|
+
*/
|
|
9
|
+
export class ApiDocConfig {
|
|
10
|
+
/** API metadata for OpenAPI info section */
|
|
11
|
+
static title = 'GoPass E-Shop API';
|
|
12
|
+
static version = '1.0.0';
|
|
13
|
+
static description = 'API documentation for the GoPass e-commerce platform';
|
|
14
|
+
static contact = {
|
|
15
|
+
name: 'GoPass Development Team',
|
|
16
|
+
email: 'dev@gopass.sk',
|
|
17
|
+
};
|
|
18
|
+
/** Server URLs for different environments */
|
|
19
|
+
static servers = {
|
|
20
|
+
development: {
|
|
21
|
+
url: 'http://localhost:5492',
|
|
22
|
+
description: 'Development server',
|
|
23
|
+
},
|
|
24
|
+
staging: {
|
|
25
|
+
url: 'https://staging.gopass.sk',
|
|
26
|
+
description: 'Staging server',
|
|
27
|
+
},
|
|
28
|
+
production: {
|
|
29
|
+
url: 'https://api.gopass.sk',
|
|
30
|
+
description: 'Production server',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
/** Base paths for API routes */
|
|
34
|
+
static basePaths = {
|
|
35
|
+
shop: '/api/shop',
|
|
36
|
+
admin: '/api/admin',
|
|
37
|
+
};
|
|
38
|
+
/** Output directory paths (relative to server directory) */
|
|
39
|
+
static output = {
|
|
40
|
+
/** Base directory for generated documentation */
|
|
41
|
+
baseDir: 'src/apidoc',
|
|
42
|
+
/** Swagger UI output directory */
|
|
43
|
+
swaggerDir: 'src/apidoc/swagger',
|
|
44
|
+
/** HTML documentation output directory */
|
|
45
|
+
htmlDir: 'src/apidoc/default',
|
|
46
|
+
/** OpenAPI spec filename */
|
|
47
|
+
specFilename: 'openapi.json',
|
|
48
|
+
};
|
|
49
|
+
/** File patterns for controller discovery */
|
|
50
|
+
static patterns = {
|
|
51
|
+
/** Pattern to find controller files */
|
|
52
|
+
controllerFiles: '**/*Controller.ts',
|
|
53
|
+
/** Pattern to find router files */
|
|
54
|
+
routerFiles: '**/_router.ts',
|
|
55
|
+
/** Pattern to find service interface files */
|
|
56
|
+
serviceInterfaceFiles: '**/*.interface.ts',
|
|
57
|
+
/** Pattern to find args/dto files */
|
|
58
|
+
argsFiles: '**/args/*.ts',
|
|
59
|
+
};
|
|
60
|
+
/** Source directories (relative to server directory) */
|
|
61
|
+
static sourceDirectories = {
|
|
62
|
+
/** Shop API controllers directory */
|
|
63
|
+
shopApi: 'src/api/shop',
|
|
64
|
+
/** Admin API controllers directory */
|
|
65
|
+
adminApi: 'src/api/admin',
|
|
66
|
+
/** Services directory */
|
|
67
|
+
services: 'src/services',
|
|
68
|
+
};
|
|
69
|
+
/** HTTP method mappings from controller method names */
|
|
70
|
+
static httpMethodMappings = {
|
|
71
|
+
get: 'GET',
|
|
72
|
+
getAll: 'GET',
|
|
73
|
+
post: 'POST',
|
|
74
|
+
put: 'PUT',
|
|
75
|
+
patch: 'PATCH',
|
|
76
|
+
delete: 'DELETE',
|
|
77
|
+
};
|
|
78
|
+
/** Decorator names to look for */
|
|
79
|
+
static decorators = {
|
|
80
|
+
route: 'Route',
|
|
81
|
+
shopAuth: 'ShopApiAuth',
|
|
82
|
+
shopEnterpriseAuth: 'ShopApiEnterpriseAuth',
|
|
83
|
+
adminAuth: 'AdminApiAuth',
|
|
84
|
+
rateLimit: 'RequestRateLimit',
|
|
85
|
+
webMethod: 'WebMethod',
|
|
86
|
+
};
|
|
87
|
+
/** TypeScript types that need special handling in OpenAPI schema */
|
|
88
|
+
static specialTypes = {
|
|
89
|
+
'Temporal.PlainDateTime': {
|
|
90
|
+
type: 'string',
|
|
91
|
+
format: 'date-time',
|
|
92
|
+
description: 'ISO 8601 date-time string',
|
|
93
|
+
},
|
|
94
|
+
'Temporal.PlainDate': {
|
|
95
|
+
type: 'string',
|
|
96
|
+
format: 'date',
|
|
97
|
+
description: 'ISO 8601 date string',
|
|
98
|
+
},
|
|
99
|
+
'Temporal.PlainTime': {
|
|
100
|
+
type: 'string',
|
|
101
|
+
format: 'time',
|
|
102
|
+
description: 'ISO 8601 time string',
|
|
103
|
+
},
|
|
104
|
+
'Temporal.Instant': {
|
|
105
|
+
type: 'string',
|
|
106
|
+
format: 'date-time',
|
|
107
|
+
description: 'ISO 8601 instant string',
|
|
108
|
+
},
|
|
109
|
+
'Date': {
|
|
110
|
+
type: 'string',
|
|
111
|
+
format: 'date-time',
|
|
112
|
+
description: 'JavaScript Date object serialized as ISO 8601 string',
|
|
113
|
+
},
|
|
114
|
+
'Buffer': {
|
|
115
|
+
type: 'string',
|
|
116
|
+
format: 'binary',
|
|
117
|
+
description: 'Binary data',
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
/** Security scheme configuration for OpenAPI */
|
|
121
|
+
static securitySchemes = {
|
|
122
|
+
shopApiAuth: {
|
|
123
|
+
type: 'apiKey',
|
|
124
|
+
name: 'x-gp-apikey',
|
|
125
|
+
in: 'header',
|
|
126
|
+
description: 'API key passed via x-gp-apikey header for shop authentication',
|
|
127
|
+
},
|
|
128
|
+
bearerAuth: {
|
|
129
|
+
type: 'http',
|
|
130
|
+
scheme: 'bearer',
|
|
131
|
+
bearerFormat: 'JWT',
|
|
132
|
+
description: 'JWT Bearer token authentication',
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
/** Tag descriptions for endpoint grouping */
|
|
136
|
+
static tagDescriptions = {
|
|
137
|
+
cart: 'Shopping cart operations',
|
|
138
|
+
auth: 'Authentication and authorization',
|
|
139
|
+
order: 'Order management',
|
|
140
|
+
product: 'Product catalog and search',
|
|
141
|
+
user: 'User profile and preferences',
|
|
142
|
+
payment: 'Payment processing',
|
|
143
|
+
delivery: 'Delivery options and shipping',
|
|
144
|
+
voucher: 'Voucher and discount codes',
|
|
145
|
+
content: 'CMS content and pages',
|
|
146
|
+
resort: 'Resort and location information',
|
|
147
|
+
};
|
|
148
|
+
/** Getting Started section content configuration */
|
|
149
|
+
static gettingStarted = {
|
|
150
|
+
/** Introduction paragraph shown after the lead description */
|
|
151
|
+
introText: `The GoPass API allows you to integrate your applications with our e-commerce platform.
|
|
152
|
+
You can use the API to manage shopping carts, process orders, handle user authentication,
|
|
153
|
+
and access product information.`,
|
|
154
|
+
/** API interfaces available (shown in URI structure table) */
|
|
155
|
+
apiInterfaces: [
|
|
156
|
+
{ name: 'shop', description: 'Customer-facing shop API' },
|
|
157
|
+
{ name: 'admin', description: 'Admin backoffice API' },
|
|
158
|
+
],
|
|
159
|
+
/** Example resources for documentation */
|
|
160
|
+
exampleResources: [
|
|
161
|
+
'cart',
|
|
162
|
+
'auth',
|
|
163
|
+
'products',
|
|
164
|
+
],
|
|
165
|
+
/** HTTP headers configuration */
|
|
166
|
+
httpHeaders: [
|
|
167
|
+
{
|
|
168
|
+
name: 'Content-Type',
|
|
169
|
+
description: 'Media type of the request body (required for POST/PUT)',
|
|
170
|
+
example: 'application/json',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: 'Authorization',
|
|
174
|
+
description: 'Authentication token for protected endpoints (user sessions)',
|
|
175
|
+
example: 'Bearer {token}',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: 'x-gp-apikey',
|
|
179
|
+
description: 'API key for enterprise-level operations and system integrations',
|
|
180
|
+
example: '{api-key}',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: 'Accept-Language',
|
|
184
|
+
description: 'Preferred language for response content',
|
|
185
|
+
example: 'sk, en;q=0.8',
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
/** Authentication methods configuration */
|
|
189
|
+
authentication: {
|
|
190
|
+
/** Bearer token authentication details */
|
|
191
|
+
bearerToken: {
|
|
192
|
+
title: 'Bearer Token (User Sessions)',
|
|
193
|
+
description: 'For user-facing operations, authenticate using a Bearer token:',
|
|
194
|
+
steps: [
|
|
195
|
+
'Call the <code>/api/shop/auth/login</code> endpoint with valid credentials',
|
|
196
|
+
'Use the returned token in subsequent requests',
|
|
197
|
+
'Include the token in the <code>Authorization: Bearer {token}</code> header',
|
|
198
|
+
],
|
|
199
|
+
},
|
|
200
|
+
/** API key authentication details */
|
|
201
|
+
apiKey: {
|
|
202
|
+
title: 'API Key (Enterprise Integrations)',
|
|
203
|
+
description: 'For enterprise-level operations and system integrations, use an API key:',
|
|
204
|
+
steps: [
|
|
205
|
+
'Obtain an API key from the system administrator',
|
|
206
|
+
'Include the key in the <code>x-gp-apikey: {api-key}</code> header',
|
|
207
|
+
],
|
|
208
|
+
note: 'API keys are typically used for server-to-server communication, automated processes, and third-party integrations.',
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Get the current environment mode
|
|
214
|
+
*/
|
|
215
|
+
static getMode = () => getEnv().NODE_ENV || 'development';
|
|
216
|
+
/**
|
|
217
|
+
* Get the appropriate server URL based on current environment
|
|
218
|
+
*/
|
|
219
|
+
static getCurrentServerUrl = () => {
|
|
220
|
+
const mode = ApiDocConfig.getMode();
|
|
221
|
+
if (mode === 'production') {
|
|
222
|
+
return ApiDocConfig.servers.production.url;
|
|
223
|
+
}
|
|
224
|
+
return ApiDocConfig.servers.development.url;
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* Get absolute path for output directory
|
|
228
|
+
*/
|
|
229
|
+
static getOutputPath = (serverDir, type) => {
|
|
230
|
+
const outputDir = type === 'swagger' ? ApiDocConfig.output.swaggerDir : ApiDocConfig.output.htmlDir;
|
|
231
|
+
return path.join(serverDir, outputDir);
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Get absolute path for source directory
|
|
235
|
+
*/
|
|
236
|
+
static getSourcePath = (serverDir, type) => path.join(serverDir, ApiDocConfig.sourceDirectories[type]);
|
|
237
|
+
/**
|
|
238
|
+
* Get HTTP method from controller method name
|
|
239
|
+
*/
|
|
240
|
+
static getHttpMethod = (methodName) => {
|
|
241
|
+
const lowerName = methodName.toLowerCase();
|
|
242
|
+
for (const [pattern, method,] of Object.entries(ApiDocConfig.httpMethodMappings)) {
|
|
243
|
+
if (lowerName === pattern.toLowerCase()) {
|
|
244
|
+
return method;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return null;
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Get OpenAPI schema for special TypeScript types
|
|
251
|
+
*/
|
|
252
|
+
static getSpecialTypeSchema = (typeName) => ApiDocConfig.specialTypes[typeName] || null;
|
|
253
|
+
}
|
|
254
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/apidoc/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,MAAM,GAAG,GAAG,EAAE;IACnB,MAAM,GAAG,GAAG,CAAC,OAAO,IAAI,EAAE,CAAQ,CAAC;IACnC,OAAO,GAAG,CAAC,GAAG,CAAC;AAChB,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,YAAY;IACxB,4CAA4C;IAC5C,MAAM,CAAU,KAAK,GAAG,mBAAmB,CAAC;IAC5C,MAAM,CAAU,OAAO,GAAG,OAAO,CAAC;IAClC,MAAM,CAAU,WAAW,GAAG,sDAAsD,CAAC;IACrF,MAAM,CAAU,OAAO,GAAG;QACzB,IAAI,EAAE,yBAAyB;QAC/B,KAAK,EAAE,eAAe;KACtB,CAAC;IAEF,6CAA6C;IAC7C,MAAM,CAAU,OAAO,GAAG;QACzB,WAAW,EAAE;YACZ,GAAG,EAAE,uBAAuB;YAC5B,WAAW,EAAE,oBAAoB;SACjC;QACD,OAAO,EAAE;YACR,GAAG,EAAE,2BAA2B;YAChC,WAAW,EAAE,gBAAgB;SAC7B;QACD,UAAU,EAAE;YACX,GAAG,EAAE,uBAAuB;YAC5B,WAAW,EAAE,mBAAmB;SAChC;KACD,CAAC;IAEF,gCAAgC;IAChC,MAAM,CAAU,SAAS,GAAG;QAC3B,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,YAAY;KACn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ts-morph';
|
|
2
|
+
import type { TypeResolver } from './type-resolver';
|
|
3
|
+
/**
|
|
4
|
+
* Endpoint information with full path
|
|
5
|
+
*/
|
|
6
|
+
export interface EndpointInfo {
|
|
7
|
+
/** Controller class name */
|
|
8
|
+
className: string;
|
|
9
|
+
/** Route path from @Route decorator */
|
|
10
|
+
routePath: string;
|
|
11
|
+
/** Full API path including router hierarchy */
|
|
12
|
+
fullPath: string;
|
|
13
|
+
/** Full file path to controller */
|
|
14
|
+
filePath: string;
|
|
15
|
+
/** Tag for grouping */
|
|
16
|
+
tag: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Parsed authentication information from @ShopApiAuth decorator
|
|
20
|
+
*/
|
|
21
|
+
export interface AuthInfo {
|
|
22
|
+
/** Whether authentication decorator is present */
|
|
23
|
+
hasAuth: boolean;
|
|
24
|
+
/** Whether login is required */
|
|
25
|
+
requiresLogin: boolean;
|
|
26
|
+
/** Whether verified account is required */
|
|
27
|
+
requiresVerifiedAccount: boolean;
|
|
28
|
+
/** Whether this endpoint is enterprise-only (uses ShopApiEnterpriseAuth decorator) */
|
|
29
|
+
isEnterpriseOnly: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Information about a controller method (endpoint)
|
|
33
|
+
*/
|
|
34
|
+
export interface MethodInfo {
|
|
35
|
+
/** Method name (get, post, etc.) */
|
|
36
|
+
name: string;
|
|
37
|
+
/** HTTP method (GET, POST, etc.) */
|
|
38
|
+
httpMethod: string;
|
|
39
|
+
/** Authentication information */
|
|
40
|
+
auth: AuthInfo;
|
|
41
|
+
/** Request type name */
|
|
42
|
+
requestType: string | null;
|
|
43
|
+
/** Response type name */
|
|
44
|
+
responseType: string | null;
|
|
45
|
+
/** JSDoc description */
|
|
46
|
+
description: string | null;
|
|
47
|
+
/** Description extracted from service interface method JSDoc */
|
|
48
|
+
serviceDescription: string | null;
|
|
49
|
+
/** Description extracted from @param JSDoc tag for the request parameter */
|
|
50
|
+
paramDescription: string | null;
|
|
51
|
+
/** Extra parameter generator info (from @extraParameters JSDoc tag); when set, OpenAPI will include parameters from the named generator */
|
|
52
|
+
extraParameterGenerator: {
|
|
53
|
+
name: string;
|
|
54
|
+
args: (string | number)[];
|
|
55
|
+
} | null;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Parsed controller information
|
|
59
|
+
*/
|
|
60
|
+
export interface ControllerInfo {
|
|
61
|
+
/** Controller class name */
|
|
62
|
+
className: string;
|
|
63
|
+
/** Route path from @Route decorator */
|
|
64
|
+
routePath: string;
|
|
65
|
+
/** Full file path */
|
|
66
|
+
filePath: string;
|
|
67
|
+
/** Relative file path from server directory */
|
|
68
|
+
relativePath: string;
|
|
69
|
+
/** Methods in the controller */
|
|
70
|
+
methods: MethodInfo[];
|
|
71
|
+
/** Tag/group name derived from directory structure */
|
|
72
|
+
tag: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Mapping from controller method to service interface method
|
|
76
|
+
*/
|
|
77
|
+
export interface ServiceMethodMapping {
|
|
78
|
+
/** Service interface type name (e.g., "ICartService") */
|
|
79
|
+
interfaceType: string;
|
|
80
|
+
/** Import path to the service interface */
|
|
81
|
+
interfaceImportPath: string;
|
|
82
|
+
/** Service method name that is called (e.g., "validateCart") */
|
|
83
|
+
methodName: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Parser for TypeScript controller files using ts-morph
|
|
87
|
+
*/
|
|
88
|
+
export declare class ControllerParser {
|
|
89
|
+
private project;
|
|
90
|
+
private serverDir;
|
|
91
|
+
private routerCache;
|
|
92
|
+
private controllerPathCache;
|
|
93
|
+
private typeResolver;
|
|
94
|
+
constructor(serverDir: string);
|
|
95
|
+
/**
|
|
96
|
+
* Add a source file to the project by file path
|
|
97
|
+
* @param filePath The path to the TS source file
|
|
98
|
+
* @returns The added SourceFile object
|
|
99
|
+
*/
|
|
100
|
+
addSourceFileAtPath(filePath: string): SourceFile;
|
|
101
|
+
/**
|
|
102
|
+
* Set the TypeResolver instance for extracting service method JSDoc
|
|
103
|
+
*/
|
|
104
|
+
setTypeResolver(typeResolver: TypeResolver): void;
|
|
105
|
+
/**
|
|
106
|
+
* Parse endpoint info by controller class name
|
|
107
|
+
*/
|
|
108
|
+
parseEndpoint(controllerClassName: string, apiType?: 'shopApi' | 'adminApi'): EndpointInfo | null;
|
|
109
|
+
/**
|
|
110
|
+
* Build cache of controller -> full path mappings by traversing router hierarchy
|
|
111
|
+
*/
|
|
112
|
+
private buildControllerPathCache;
|
|
113
|
+
/**
|
|
114
|
+
* Recursively traverse router hierarchy and build controller path mappings
|
|
115
|
+
*/
|
|
116
|
+
private traverseRouterHierarchy;
|
|
117
|
+
/**
|
|
118
|
+
* Parse a _router.ts file to extract router.use() and router.registerController() calls
|
|
119
|
+
*/
|
|
120
|
+
private parseRouterFile;
|
|
121
|
+
/**
|
|
122
|
+
* Parse import statements from a source file
|
|
123
|
+
*/
|
|
124
|
+
private parseImports;
|
|
125
|
+
/**
|
|
126
|
+
* Resolve a relative import path to an absolute file path
|
|
127
|
+
*/
|
|
128
|
+
private resolveImportPath;
|
|
129
|
+
/**
|
|
130
|
+
* Normalize path by removing duplicate slashes and ensuring single leading slash
|
|
131
|
+
*/
|
|
132
|
+
private normalizePath;
|
|
133
|
+
/**
|
|
134
|
+
* Discover all controller files in the shop API directory
|
|
135
|
+
*/
|
|
136
|
+
discoverControllers(apiType?: 'shopApi' | 'adminApi'): string[];
|
|
137
|
+
/**
|
|
138
|
+
* Parse a single controller file
|
|
139
|
+
*/
|
|
140
|
+
parseController(filePath: string): ControllerInfo | null;
|
|
141
|
+
/**
|
|
142
|
+
* Parse all controllers in the shop API
|
|
143
|
+
*/
|
|
144
|
+
parseAllControllers(apiType?: 'shopApi' | 'adminApi'): ControllerInfo[];
|
|
145
|
+
/**
|
|
146
|
+
* Extract the route path from @Route decorator
|
|
147
|
+
*/
|
|
148
|
+
private extractRouteDecorator;
|
|
149
|
+
/**
|
|
150
|
+
* Extract methods from a controller class
|
|
151
|
+
*/
|
|
152
|
+
private extractMethods;
|
|
153
|
+
/**
|
|
154
|
+
* Extract authentication decorator information
|
|
155
|
+
*/
|
|
156
|
+
private extractAuthDecorator;
|
|
157
|
+
/**
|
|
158
|
+
* Extract request and response types from method signature
|
|
159
|
+
*/
|
|
160
|
+
private extractMethodTypes;
|
|
161
|
+
/**
|
|
162
|
+
* Extract JSDoc description from a method
|
|
163
|
+
*/
|
|
164
|
+
private extractJsDocDescription;
|
|
165
|
+
/**
|
|
166
|
+
* Extract @param description from a method's JSDoc
|
|
167
|
+
* Returns the description of the first parameter (typically 'args')
|
|
168
|
+
*/
|
|
169
|
+
private extractJsDocParams;
|
|
170
|
+
/**
|
|
171
|
+
* Extract service method mapping from a controller method
|
|
172
|
+
* Parses the method body to find container.get<InterfaceType>() and service.methodName() calls
|
|
173
|
+
*/
|
|
174
|
+
extractServiceMethodMapping(method: MethodDeclaration, sourceFile: SourceFile): ServiceMethodMapping | null;
|
|
175
|
+
/**
|
|
176
|
+
* Extract string argument from decorator
|
|
177
|
+
*/
|
|
178
|
+
private extractDecoratorStringArg;
|
|
179
|
+
/**
|
|
180
|
+
* Extract object argument from decorator
|
|
181
|
+
*/
|
|
182
|
+
private extractDecoratorObjectArg;
|
|
183
|
+
/**
|
|
184
|
+
* Find files recursively matching a pattern
|
|
185
|
+
*/
|
|
186
|
+
private findFilesRecursive;
|
|
187
|
+
/**
|
|
188
|
+
* Walk directory recursively
|
|
189
|
+
*/
|
|
190
|
+
private walkDirectory;
|
|
191
|
+
/**
|
|
192
|
+
* Convert glob pattern to regex
|
|
193
|
+
*/
|
|
194
|
+
private globToRegex;
|
|
195
|
+
/**
|
|
196
|
+
* Infer route from controller class name
|
|
197
|
+
*/
|
|
198
|
+
private inferRouteFromClassName;
|
|
199
|
+
/**
|
|
200
|
+
* Extract tag from file path
|
|
201
|
+
*/
|
|
202
|
+
private extractTagFromPath;
|
|
203
|
+
/**
|
|
204
|
+
* Clean type name by removing import paths and generics from common wrappers
|
|
205
|
+
*/
|
|
206
|
+
private cleanTypeName;
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=controller-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller-parser.d.ts","sourceRoot":"","sources":["../../src/apidoc/controller-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA+B,iBAAiB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA4CpD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACxB,kDAAkD;IAClD,OAAO,EAAE,OAAO,CAAC;IACjB,gCAAgC;IAChC,aAAa,EAAE,OAAO,CAAC;IACvB,2CAA2C;IAC3C,uBAAuB,EAAE,OAAO,CAAC;IACjC,sFAAsF;IACtF,gBAAgB,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,IAAI,EAAE,QAAQ,CAAC;IACf,wBAAwB;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,yBAAyB;IACzB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,wBAAwB;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,gEAAgE;IAChE,kBA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