veloce-ts 0.1.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/CHANGELOG.md +43 -0
- package/LICENSE +21 -0
- package/README.md +442 -0
- package/bin/veloce.ts +2 -0
- package/dist/cjs/src/cli/index.js +425 -0
- package/dist/cjs/src/cli/index.js.map +22 -0
- package/dist/cjs/src/docs/index.js +7 -0
- package/dist/cjs/src/docs/index.js.map +55 -0
- package/dist/cjs/src/errors/index.js +4 -0
- package/dist/cjs/src/errors/index.js.map +12 -0
- package/dist/cjs/src/graphql/index.js +83 -0
- package/dist/cjs/src/graphql/index.js.map +24 -0
- package/dist/cjs/src/index.js +126 -0
- package/dist/cjs/src/index.js.map +108 -0
- package/dist/cjs/src/middleware/index.js +3 -0
- package/dist/cjs/src/middleware/index.js.map +12 -0
- package/dist/cjs/src/plugins/index.js +125 -0
- package/dist/cjs/src/plugins/index.js.map +67 -0
- package/dist/cjs/src/testing/index.js +17 -0
- package/dist/cjs/src/testing/index.js.map +54 -0
- package/dist/cjs/src/types/index.js +3 -0
- package/dist/cjs/src/types/index.js.map +16 -0
- package/dist/cjs/src/validation/index.js +3 -0
- package/dist/cjs/src/validation/index.js.map +19 -0
- package/dist/cjs/src/websocket/index.js +3 -0
- package/dist/cjs/src/websocket/index.js.map +12 -0
- package/dist/esm/chunk-0zxhx5b8.js +7 -0
- package/dist/esm/chunk-0zxhx5b8.js.map +10 -0
- package/dist/esm/chunk-159eqj8q.js +5 -0
- package/dist/esm/chunk-159eqj8q.js.map +12 -0
- package/dist/esm/chunk-1hqjkm44.js +5 -0
- package/dist/esm/chunk-1hqjkm44.js.map +11 -0
- package/dist/esm/chunk-2q6s8v3j.js +6 -0
- package/dist/esm/chunk-2q6s8v3j.js.map +10 -0
- package/dist/esm/chunk-42h6trpf.js +5 -0
- package/dist/esm/chunk-42h6trpf.js.map +9 -0
- package/dist/esm/chunk-82f2j0k2.js +60 -0
- package/dist/esm/chunk-82f2j0k2.js.map +10 -0
- package/dist/esm/chunk-8wrnr45g.js +338 -0
- package/dist/esm/chunk-8wrnr45g.js.map +10 -0
- package/dist/esm/chunk-9p6d0t33.js +5 -0
- package/dist/esm/chunk-9p6d0t33.js.map +10 -0
- package/dist/esm/chunk-awven6dt.js +4 -0
- package/dist/esm/chunk-awven6dt.js.map +16 -0
- package/dist/esm/chunk-gv5n8ddb.js +18 -0
- package/dist/esm/chunk-gv5n8ddb.js.map +10 -0
- package/dist/esm/chunk-pn7z890c.js +72 -0
- package/dist/esm/chunk-pn7z890c.js.map +13 -0
- package/dist/esm/chunk-qfsjy9bg.js +7 -0
- package/dist/esm/chunk-qfsjy9bg.js.map +10 -0
- package/dist/esm/chunk-vkkzgaf7.js +5 -0
- package/dist/esm/chunk-vkkzgaf7.js.map +12 -0
- package/dist/esm/src/cli/index.js +30 -0
- package/dist/esm/src/cli/index.js.map +18 -0
- package/dist/esm/src/docs/index.js +8 -0
- package/dist/esm/src/docs/index.js.map +48 -0
- package/dist/esm/src/errors/index.js +4 -0
- package/dist/esm/src/errors/index.js.map +9 -0
- package/dist/esm/src/graphql/index.js +4 -0
- package/dist/esm/src/graphql/index.js.map +9 -0
- package/dist/esm/src/index.js +4 -0
- package/dist/esm/src/index.js.map +16 -0
- package/dist/esm/src/middleware/index.js +4 -0
- package/dist/esm/src/middleware/index.js.map +9 -0
- package/dist/esm/src/plugins/index.js +42 -0
- package/dist/esm/src/plugins/index.js.map +10 -0
- package/dist/esm/src/testing/index.js +4 -0
- package/dist/esm/src/testing/index.js.map +39 -0
- package/dist/esm/src/types/index.js +4 -0
- package/dist/esm/src/types/index.js.map +9 -0
- package/dist/esm/src/validation/index.js +4 -0
- package/dist/esm/src/validation/index.js.map +9 -0
- package/dist/esm/src/websocket/index.js +4 -0
- package/dist/esm/src/websocket/index.js.map +9 -0
- package/dist/types/adapters/base.d.ts +24 -0
- package/dist/types/adapters/base.d.ts.map +1 -0
- package/dist/types/adapters/express.d.ts +44 -0
- package/dist/types/adapters/express.d.ts.map +1 -0
- package/dist/types/adapters/hono.d.ts +44 -0
- package/dist/types/adapters/hono.d.ts.map +1 -0
- package/dist/types/cli/commands/build.d.ts +3 -0
- package/dist/types/cli/commands/build.d.ts.map +1 -0
- package/dist/types/cli/commands/dev.d.ts +3 -0
- package/dist/types/cli/commands/dev.d.ts.map +1 -0
- package/dist/types/cli/commands/generate.d.ts +3 -0
- package/dist/types/cli/commands/generate.d.ts.map +1 -0
- package/dist/types/cli/commands/new.d.ts +3 -0
- package/dist/types/cli/commands/new.d.ts.map +1 -0
- package/dist/types/cli/index.d.ts +3 -0
- package/dist/types/cli/index.d.ts.map +1 -0
- package/dist/types/core/application.d.ts +268 -0
- package/dist/types/core/application.d.ts.map +1 -0
- package/dist/types/core/compiled-metadata.d.ts +58 -0
- package/dist/types/core/compiled-metadata.d.ts.map +1 -0
- package/dist/types/core/metadata.d.ts +175 -0
- package/dist/types/core/metadata.d.ts.map +1 -0
- package/dist/types/core/plugin.d.ts +63 -0
- package/dist/types/core/plugin.d.ts.map +1 -0
- package/dist/types/core/router-compiler.d.ts +61 -0
- package/dist/types/core/router-compiler.d.ts.map +1 -0
- package/dist/types/decorators/dependencies.d.ts +28 -0
- package/dist/types/decorators/dependencies.d.ts.map +1 -0
- package/dist/types/decorators/docs.d.ts +38 -0
- package/dist/types/decorators/docs.d.ts.map +1 -0
- package/dist/types/decorators/graphql.d.ts +126 -0
- package/dist/types/decorators/graphql.d.ts.map +1 -0
- package/dist/types/decorators/http.d.ts +74 -0
- package/dist/types/decorators/http.d.ts.map +1 -0
- package/dist/types/decorators/middleware.d.ts +30 -0
- package/dist/types/decorators/middleware.d.ts.map +1 -0
- package/dist/types/decorators/params.d.ts +82 -0
- package/dist/types/decorators/params.d.ts.map +1 -0
- package/dist/types/decorators/websocket.d.ts +61 -0
- package/dist/types/decorators/websocket.d.ts.map +1 -0
- package/dist/types/dependencies/container.d.ts +93 -0
- package/dist/types/dependencies/container.d.ts.map +1 -0
- package/dist/types/docs/index.d.ts +3 -0
- package/dist/types/docs/index.d.ts.map +1 -0
- package/dist/types/docs/openapi-generator.d.ts +50 -0
- package/dist/types/docs/openapi-generator.d.ts.map +1 -0
- package/dist/types/docs/zod-to-json-schema.d.ts +46 -0
- package/dist/types/docs/zod-to-json-schema.d.ts.map +1 -0
- package/dist/types/errors/exceptions.d.ts +48 -0
- package/dist/types/errors/exceptions.d.ts.map +1 -0
- package/dist/types/errors/handler.d.ts +61 -0
- package/dist/types/errors/handler.d.ts.map +1 -0
- package/dist/types/errors/index.d.ts +7 -0
- package/dist/types/errors/index.d.ts.map +1 -0
- package/dist/types/graphql/index.d.ts +4 -0
- package/dist/types/graphql/index.d.ts.map +1 -0
- package/dist/types/graphql/plugin.d.ts +60 -0
- package/dist/types/graphql/plugin.d.ts.map +1 -0
- package/dist/types/graphql/schema-builder.d.ts +46 -0
- package/dist/types/graphql/schema-builder.d.ts.map +1 -0
- package/dist/types/graphql/zod-to-graphql.d.ts +22 -0
- package/dist/types/graphql/zod-to-graphql.d.ts.map +1 -0
- package/dist/types/index.d.ts +34 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/middleware/compression.d.ts +7 -0
- package/dist/types/middleware/compression.d.ts.map +1 -0
- package/dist/types/middleware/cors.d.ts +7 -0
- package/dist/types/middleware/cors.d.ts.map +1 -0
- package/dist/types/middleware/index.d.ts +4 -0
- package/dist/types/middleware/index.d.ts.map +1 -0
- package/dist/types/middleware/rate-limit.d.ts +7 -0
- package/dist/types/middleware/rate-limit.d.ts.map +1 -0
- package/dist/types/plugins/index.d.ts +4 -0
- package/dist/types/plugins/index.d.ts.map +1 -0
- package/dist/types/plugins/openapi.d.ts +23 -0
- package/dist/types/plugins/openapi.d.ts.map +1 -0
- package/dist/types/responses/response.d.ts +200 -0
- package/dist/types/responses/response.d.ts.map +1 -0
- package/dist/types/testing/helpers.d.ts +98 -0
- package/dist/types/testing/helpers.d.ts.map +1 -0
- package/dist/types/testing/index.d.ts +4 -0
- package/dist/types/testing/index.d.ts.map +1 -0
- package/dist/types/testing/test-client.d.ts +86 -0
- package/dist/types/testing/test-client.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +232 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/validation/exceptions.d.ts +25 -0
- package/dist/types/validation/exceptions.d.ts.map +1 -0
- package/dist/types/validation/index.d.ts +3 -0
- package/dist/types/validation/index.d.ts.map +1 -0
- package/dist/types/validation/validator.d.ts +54 -0
- package/dist/types/validation/validator.d.ts.map +1 -0
- package/dist/types/websocket/connection.d.ts +51 -0
- package/dist/types/websocket/connection.d.ts.map +1 -0
- package/dist/types/websocket/index.d.ts +4 -0
- package/dist/types/websocket/index.d.ts.map +1 -0
- package/dist/types/websocket/manager.d.ts +82 -0
- package/dist/types/websocket/manager.d.ts.map +1 -0
- package/dist/types/websocket/plugin.d.ts +51 -0
- package/dist/types/websocket/plugin.d.ts.map +1 -0
- package/package.json +149 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { Provider, Scope, Context, ProviderConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Dependency Injection Container
|
|
4
|
+
* Manages dependency lifecycle with support for singleton, request, and transient scopes
|
|
5
|
+
*
|
|
6
|
+
* Performance optimizations:
|
|
7
|
+
* - Singleton instances cached globally for reuse across all requests
|
|
8
|
+
* - Request-scoped instances cached per-request using WeakMap for automatic cleanup
|
|
9
|
+
* - Provider name cache to avoid repeated string operations
|
|
10
|
+
* - Fast-path for already resolved singletons
|
|
11
|
+
*/
|
|
12
|
+
export declare class DIContainer {
|
|
13
|
+
private singletons;
|
|
14
|
+
private requestScoped;
|
|
15
|
+
private providers;
|
|
16
|
+
private resolutionStack;
|
|
17
|
+
private providerNameCache;
|
|
18
|
+
private stats;
|
|
19
|
+
/**
|
|
20
|
+
* Register a provider with optional configuration
|
|
21
|
+
* @param provider - Class or factory function to provide the dependency
|
|
22
|
+
* @param config - Configuration including scope and factory
|
|
23
|
+
*/
|
|
24
|
+
register(provider: Provider, config?: ProviderConfig): void;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve a dependency with the specified scope
|
|
27
|
+
* Optimized with fast-path for cached singletons and request-scoped instances
|
|
28
|
+
*
|
|
29
|
+
* @param provider - The provider to resolve
|
|
30
|
+
* @param options - Resolution options including scope and context
|
|
31
|
+
* @returns The resolved dependency instance
|
|
32
|
+
*/
|
|
33
|
+
resolve<T>(provider: Provider<T>, options?: {
|
|
34
|
+
scope?: Scope;
|
|
35
|
+
context?: Context;
|
|
36
|
+
}): Promise<T>;
|
|
37
|
+
/**
|
|
38
|
+
* Build a detailed circular dependency error message
|
|
39
|
+
* Uses cached provider names for performance
|
|
40
|
+
*/
|
|
41
|
+
private buildCircularDependencyMessage;
|
|
42
|
+
/**
|
|
43
|
+
* Create a new instance of the provider
|
|
44
|
+
* @param provider - The provider to instantiate
|
|
45
|
+
* @param config - Provider configuration
|
|
46
|
+
* @param context - Optional context for request-scoped dependencies
|
|
47
|
+
* @returns The created instance
|
|
48
|
+
*/
|
|
49
|
+
private create;
|
|
50
|
+
/**
|
|
51
|
+
* Resolve nested dependencies for an instance
|
|
52
|
+
* This method can be extended to support constructor injection
|
|
53
|
+
* @param instance - The instance to resolve dependencies for
|
|
54
|
+
* @param context - Optional context for request-scoped dependencies
|
|
55
|
+
*/
|
|
56
|
+
private resolveNestedDependencies;
|
|
57
|
+
/**
|
|
58
|
+
* Get a human-readable name for a provider (for error messages)
|
|
59
|
+
* Uses cache to avoid repeated string operations
|
|
60
|
+
*
|
|
61
|
+
* @param provider - The provider to get the name for
|
|
62
|
+
* @returns A string representation of the provider
|
|
63
|
+
*/
|
|
64
|
+
private getProviderName;
|
|
65
|
+
/**
|
|
66
|
+
* Clear all cached instances (useful for testing)
|
|
67
|
+
*/
|
|
68
|
+
clear(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Clear request-scoped cache for a specific context
|
|
71
|
+
* This is automatically handled by WeakMap garbage collection,
|
|
72
|
+
* but can be called explicitly for immediate cleanup
|
|
73
|
+
*/
|
|
74
|
+
clearRequestScope(context: Context): void;
|
|
75
|
+
/**
|
|
76
|
+
* Get dependency resolution statistics (useful for monitoring and debugging)
|
|
77
|
+
* Returns cache hit rates and creation counts
|
|
78
|
+
*/
|
|
79
|
+
getStats(): {
|
|
80
|
+
singletonHits: number;
|
|
81
|
+
singletonMisses: number;
|
|
82
|
+
singletonHitRate: number;
|
|
83
|
+
requestHits: number;
|
|
84
|
+
requestMisses: number;
|
|
85
|
+
requestHitRate: number;
|
|
86
|
+
transientCreations: number;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Reset statistics (useful for testing)
|
|
90
|
+
*/
|
|
91
|
+
resetStats(): void;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../../src/dependencies/container.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAS,MAAM,UAAU,CAAC;AAEhF;;;;;;;;;GASG;AACH,qBAAa,WAAW;IAEtB,OAAO,CAAC,UAAU,CAAiC;IAGnD,OAAO,CAAC,aAAa,CAAuD;IAG5E,OAAO,CAAC,SAAS,CAA4C;IAG7D,OAAO,CAAC,eAAe,CAA4B;IAGnD,OAAO,CAAC,iBAAiB,CAA4C;IAGrE,OAAO,CAAC,KAAK,CAMX;IAEF;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI;IAI3D;;;;;;;OAOG;IACG,OAAO,CAAC,CAAC,EACb,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EACrB,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,KAAK,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,GAC7C,OAAO,CAAC,CAAC,CAAC;IAgFb;;;OAGG;IACH,OAAO,CAAC,8BAA8B;IAOtC;;;;;;OAMG;YACW,MAAM;IAiCpB;;;;;OAKG;YACW,yBAAyB;IAOvC;;;;;;OAMG;IACH,OAAO,CAAC,eAAe;IAwBvB;;OAEG;IACH,KAAK,IAAI,IAAI;IAQb;;;;OAIG;IACH,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAIzC;;;OAGG;IACH,QAAQ,IAAI;QACV,aAAa,EAAE,MAAM,CAAC;QACtB,eAAe,EAAE,MAAM,CAAC;QACxB,gBAAgB,EAAE,MAAM,CAAC;QACzB,WAAW,EAAE,MAAM,CAAC;QACpB,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;QACvB,kBAAkB,EAAE,MAAM,CAAC;KAC5B;IAsBD;;OAEG;IACH,UAAU,IAAI,IAAI;CASnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/docs/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { OpenAPISpec, OpenAPIOptions } from '../types';
|
|
2
|
+
import type { MetadataRegistry } from '../core/metadata';
|
|
3
|
+
/**
|
|
4
|
+
* OpenAPIGenerator generates OpenAPI 3.0 specification from route metadata
|
|
5
|
+
*/
|
|
6
|
+
export declare class OpenAPIGenerator {
|
|
7
|
+
private metadata;
|
|
8
|
+
private options;
|
|
9
|
+
private converter?;
|
|
10
|
+
constructor(metadata: MetadataRegistry, options?: OpenAPIOptions);
|
|
11
|
+
/**
|
|
12
|
+
* Generate complete OpenAPI 3.0 specification
|
|
13
|
+
*/
|
|
14
|
+
generate(): OpenAPISpec;
|
|
15
|
+
/**
|
|
16
|
+
* Add a single route to the OpenAPI specification
|
|
17
|
+
*/
|
|
18
|
+
private addRouteToSpec;
|
|
19
|
+
/**
|
|
20
|
+
* Extract parameters (query, path, header, cookie) from route metadata
|
|
21
|
+
*/
|
|
22
|
+
private extractParameters;
|
|
23
|
+
/**
|
|
24
|
+
* Extract request body from @Body parameters
|
|
25
|
+
*/
|
|
26
|
+
private extractRequestBody;
|
|
27
|
+
/**
|
|
28
|
+
* Extract responses from route metadata
|
|
29
|
+
*/
|
|
30
|
+
private extractResponses;
|
|
31
|
+
/**
|
|
32
|
+
* Convert FastAPI-TS path format to OpenAPI format
|
|
33
|
+
* Converts :param to {param}
|
|
34
|
+
*/
|
|
35
|
+
private convertPathToOpenAPI;
|
|
36
|
+
/**
|
|
37
|
+
* Convert parameter metadata to OpenAPI parameter object
|
|
38
|
+
*/
|
|
39
|
+
private parameterToOpenAPI;
|
|
40
|
+
/**
|
|
41
|
+
* Convert Zod schema to OpenAPI schema
|
|
42
|
+
* Uses our custom converter that handles reusable schemas
|
|
43
|
+
*/
|
|
44
|
+
private zodToOpenAPISchema;
|
|
45
|
+
/**
|
|
46
|
+
* Get default response description for status code
|
|
47
|
+
*/
|
|
48
|
+
private getDefaultResponseDescription;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=openapi-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi-generator.d.ts","sourceRoot":"","sources":["../../../src/docs/openapi-generator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EAIX,cAAc,EACf,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIzD;;GAEG;AACH,qBAAa,gBAAgB;IAKzB,OAAO,CAAC,QAAQ;IAJlB,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,SAAS,CAAC,CAA2B;gBAGnC,QAAQ,EAAE,gBAAgB,EAClC,OAAO,CAAC,EAAE,cAAc;IAY1B;;OAEG;IACH,QAAQ,IAAI,WAAW;IA2BvB;;OAEG;IACH,OAAO,CAAC,cAAc;IA0CtB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAezB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAiB1B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA0DxB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAI5B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA4C1B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAO1B;;OAEG;IACH,OAAO,CAAC,6BAA6B;CAetC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ZodSchema } from 'zod';
|
|
2
|
+
import type { OpenAPISpec } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Convert Zod schema to JSON Schema format
|
|
5
|
+
* Handles primitive types, objects, arrays, unions, and generates reusable schemas
|
|
6
|
+
*/
|
|
7
|
+
export declare class ZodToJsonSchemaConverter {
|
|
8
|
+
private spec;
|
|
9
|
+
private generatedSchemas;
|
|
10
|
+
constructor(spec: OpenAPISpec);
|
|
11
|
+
/**
|
|
12
|
+
* Convert a Zod schema to JSON Schema
|
|
13
|
+
* Automatically generates reusable schemas in components/schemas for complex types
|
|
14
|
+
*/
|
|
15
|
+
convert(schema: ZodSchema, options?: {
|
|
16
|
+
name?: string;
|
|
17
|
+
reusable?: boolean;
|
|
18
|
+
}): any;
|
|
19
|
+
/**
|
|
20
|
+
* Convert schema inline (not as a reusable component)
|
|
21
|
+
*/
|
|
22
|
+
private convertInline;
|
|
23
|
+
/**
|
|
24
|
+
* Convert schema to a reusable component and return a $ref
|
|
25
|
+
*/
|
|
26
|
+
private convertToReusableSchema;
|
|
27
|
+
/**
|
|
28
|
+
* Determine if a schema should be converted to a reusable component
|
|
29
|
+
* Complex objects and arrays should be reusable
|
|
30
|
+
*/
|
|
31
|
+
private shouldBeReusable;
|
|
32
|
+
/**
|
|
33
|
+
* Generate a unique schema name
|
|
34
|
+
*/
|
|
35
|
+
private generateSchemaName;
|
|
36
|
+
/**
|
|
37
|
+
* Reset the schema counter (useful for testing)
|
|
38
|
+
*/
|
|
39
|
+
static resetCounter(): void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Helper function to convert Zod schema to JSON Schema
|
|
43
|
+
* This is a simpler interface for one-off conversions
|
|
44
|
+
*/
|
|
45
|
+
export declare function zodToJsonSchema(schema: ZodSchema, spec?: OpenAPISpec): any;
|
|
46
|
+
//# sourceMappingURL=zod-to-json-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod-to-json-schema.d.ts","sourceRoot":"","sources":["../../../src/docs/zod-to-json-schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAS5C;;;GAGG;AACH,qBAAa,wBAAwB;IACnC,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,gBAAgB,CAA0B;gBAEtC,IAAI,EAAE,WAAW;IAI7B;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,GAAG;IAehF;;OAEG;IACH,OAAO,CAAC,aAAa;IAcrB;;OAEG;IACH,OAAO,CAAC,uBAAuB;IA6B/B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IA0BxB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAI1B;;OAEG;IACH,MAAM,CAAC,YAAY,IAAI,IAAI;CAG5B;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,GAAG,CAsB1E"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base HTTP exception class
|
|
3
|
+
* All HTTP exceptions should extend this class
|
|
4
|
+
* Provides consistent error response format
|
|
5
|
+
*/
|
|
6
|
+
export declare class HTTPException extends Error {
|
|
7
|
+
statusCode: number;
|
|
8
|
+
details?: any | undefined;
|
|
9
|
+
constructor(statusCode: number, message: string, details?: any | undefined);
|
|
10
|
+
/**
|
|
11
|
+
* Convert exception to JSON format for HTTP response
|
|
12
|
+
* @returns Object with error details
|
|
13
|
+
*/
|
|
14
|
+
toJSON(): any;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 404 Not Found exception
|
|
18
|
+
* Thrown when a requested resource cannot be found
|
|
19
|
+
*/
|
|
20
|
+
export declare class NotFoundException extends HTTPException {
|
|
21
|
+
constructor(message?: string, details?: any);
|
|
22
|
+
toJSON(): any;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 401 Unauthorized exception
|
|
26
|
+
* Thrown when authentication is required but not provided or invalid
|
|
27
|
+
*/
|
|
28
|
+
export declare class UnauthorizedException extends HTTPException {
|
|
29
|
+
constructor(message?: string, details?: any);
|
|
30
|
+
toJSON(): any;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 403 Forbidden exception
|
|
34
|
+
* Thrown when user is authenticated but doesn't have permission
|
|
35
|
+
*/
|
|
36
|
+
export declare class ForbiddenException extends HTTPException {
|
|
37
|
+
constructor(message?: string, details?: any);
|
|
38
|
+
toJSON(): any;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 400 Bad Request exception
|
|
42
|
+
* Thrown when the request is malformed or invalid
|
|
43
|
+
*/
|
|
44
|
+
export declare class BadRequestException extends HTTPException {
|
|
45
|
+
constructor(message?: string, details?: any);
|
|
46
|
+
toJSON(): any;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=exceptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions.d.ts","sourceRoot":"","sources":["../../../src/errors/exceptions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,KAAK;IAE7B,UAAU,EAAE,MAAM;IAElB,OAAO,CAAC,EAAE,GAAG;gBAFb,UAAU,EAAE,MAAM,EACzB,OAAO,EAAE,MAAM,EACR,OAAO,CAAC,EAAE,GAAG,YAAA;IAWtB;;;OAGG;IACH,MAAM;CAOP;AAED;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,aAAa;gBACtC,OAAO,GAAE,MAAoB,EAAE,OAAO,CAAC,EAAE,GAAG;IAKxD,MAAM;CAOP;AAED;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,aAAa;gBAC1C,OAAO,GAAE,MAAuB,EAAE,OAAO,CAAC,EAAE,GAAG;IAK3D,MAAM;CAOP;AAED;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,aAAa;gBACvC,OAAO,GAAE,MAAoB,EAAE,OAAO,CAAC,EAAE,GAAG;IAKxD,MAAM;CAOP;AAED;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,aAAa;gBACxC,OAAO,GAAE,MAAsB,EAAE,OAAO,CAAC,EAAE,GAAG;IAK1D,MAAM;CAOP"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Context } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Custom error handler function type
|
|
4
|
+
* Allows users to provide their own error handling logic
|
|
5
|
+
*/
|
|
6
|
+
export type CustomErrorHandler = (error: Error, c: Context) => Response | Promise<Response>;
|
|
7
|
+
/**
|
|
8
|
+
* ErrorHandler processes all errors that occur during request handling
|
|
9
|
+
* Provides consistent error responses and handles different error types appropriately
|
|
10
|
+
*/
|
|
11
|
+
export declare class ErrorHandler {
|
|
12
|
+
private customHandler?;
|
|
13
|
+
private isDevelopment;
|
|
14
|
+
constructor(customHandler?: CustomErrorHandler);
|
|
15
|
+
/**
|
|
16
|
+
* Set a custom error handler
|
|
17
|
+
* @param handler - Custom error handling function
|
|
18
|
+
*/
|
|
19
|
+
setCustomHandler(handler: CustomErrorHandler): void;
|
|
20
|
+
/**
|
|
21
|
+
* Main error handling method
|
|
22
|
+
* Processes all error types and returns appropriate HTTP responses
|
|
23
|
+
* @param error - The error that occurred
|
|
24
|
+
* @param c - Hono context object
|
|
25
|
+
* @returns HTTP response with error details
|
|
26
|
+
*/
|
|
27
|
+
handle(error: Error, c: Context): Promise<Response>;
|
|
28
|
+
/**
|
|
29
|
+
* Handle validation exceptions (422 Unprocessable Entity)
|
|
30
|
+
* @param error - ValidationException instance
|
|
31
|
+
* @param c - Hono context
|
|
32
|
+
* @returns JSON response with validation error details
|
|
33
|
+
*/
|
|
34
|
+
private handleValidationException;
|
|
35
|
+
/**
|
|
36
|
+
* Handle HTTP exceptions (4xx, 5xx)
|
|
37
|
+
* @param error - HTTPException instance
|
|
38
|
+
* @param c - Hono context
|
|
39
|
+
* @returns JSON response with error details
|
|
40
|
+
*/
|
|
41
|
+
private handleHTTPException;
|
|
42
|
+
/**
|
|
43
|
+
* Handle generic/unexpected errors (500 Internal Server Error)
|
|
44
|
+
* Hides internal details in production, shows stack trace in development
|
|
45
|
+
* @param error - Generic Error instance
|
|
46
|
+
* @param c - Hono context
|
|
47
|
+
* @returns JSON response with error details
|
|
48
|
+
*/
|
|
49
|
+
private handleGenericError;
|
|
50
|
+
/**
|
|
51
|
+
* Check if running in development mode
|
|
52
|
+
* @returns true if in development mode
|
|
53
|
+
*/
|
|
54
|
+
isDevelopmentMode(): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Set development mode manually (useful for testing)
|
|
57
|
+
* @param isDev - Whether to enable development mode
|
|
58
|
+
*/
|
|
59
|
+
setDevelopmentMode(isDev: boolean): void;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/errors/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAIxC;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE5F;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,aAAa,CAAC,CAAqB;IAC3C,OAAO,CAAC,aAAa,CAAU;gBAEnB,aAAa,CAAC,EAAE,kBAAkB;IAK9C;;;OAGG;IACH,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAInD;;;;;;OAMG;IACG,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;IAyBzD;;;;;OAKG;IACH,OAAO,CAAC,yBAAyB;IAejC;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IA4B3B;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;IAgC1B;;;OAGG;IACH,iBAAiB,IAAI,OAAO;IAI5B;;;OAGG;IACH,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;CAGzC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error handling exports
|
|
3
|
+
* Provides all exception classes and error handler
|
|
4
|
+
*/
|
|
5
|
+
export { HTTPException, NotFoundException, UnauthorizedException, ForbiddenException, BadRequestException } from './exceptions.js';
|
|
6
|
+
export { ErrorHandler } from './handler.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/graphql/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Plugin } from '../core/plugin';
|
|
2
|
+
import type { VeloceTS } from '../core/application';
|
|
3
|
+
/**
|
|
4
|
+
* GraphQL Plugin Options
|
|
5
|
+
*/
|
|
6
|
+
export interface GraphQLPluginOptions {
|
|
7
|
+
/** Path to serve GraphQL endpoint (default: /graphql) */
|
|
8
|
+
path?: string;
|
|
9
|
+
/** Path to serve GraphQL Playground (default: /graphql/playground) */
|
|
10
|
+
playgroundPath?: string;
|
|
11
|
+
/** Enable GraphQL Playground in development (default: true) */
|
|
12
|
+
playground?: boolean;
|
|
13
|
+
/** Custom context factory function */
|
|
14
|
+
context?: (request: any) => Promise<any> | any;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* GraphQLPlugin enables GraphQL support with decorators and Zod validation
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const app = new VeloceTS();
|
|
22
|
+
* app.usePlugin(new GraphQLPlugin({
|
|
23
|
+
* path: '/graphql',
|
|
24
|
+
* playground: true
|
|
25
|
+
* }));
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare class GraphQLPlugin implements Plugin {
|
|
29
|
+
name: string;
|
|
30
|
+
version: string;
|
|
31
|
+
private options;
|
|
32
|
+
private schema?;
|
|
33
|
+
constructor(options?: GraphQLPluginOptions);
|
|
34
|
+
install(app: VeloceTS): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Handle GraphQL POST request
|
|
37
|
+
*/
|
|
38
|
+
private handleGraphQLRequest;
|
|
39
|
+
/**
|
|
40
|
+
* Execute a GraphQL operation
|
|
41
|
+
*/
|
|
42
|
+
private executeGraphQL;
|
|
43
|
+
/**
|
|
44
|
+
* Execute a GraphQL operation (simplified implementation)
|
|
45
|
+
* In production, this should use graphql-js or similar library
|
|
46
|
+
*/
|
|
47
|
+
private executeOperation;
|
|
48
|
+
/**
|
|
49
|
+
* Render GraphQL Playground HTML
|
|
50
|
+
*/
|
|
51
|
+
private renderPlayground;
|
|
52
|
+
/**
|
|
53
|
+
* Get the generated schema (useful for testing)
|
|
54
|
+
*/
|
|
55
|
+
getSchema(): {
|
|
56
|
+
typeDefs: string;
|
|
57
|
+
resolvers: any;
|
|
58
|
+
} | undefined;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/graphql/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAIpD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,sEAAsE;IACtE,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,sCAAsC;IACtC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;CAChD;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,aAAc,YAAW,MAAM;IAC1C,IAAI,SAAa;IACjB,OAAO,SAAW;IAElB,OAAO,CAAC,OAAO,CAAiC;IAChD,OAAO,CAAC,MAAM,CAAC,CAAuC;gBAE1C,OAAO,CAAC,EAAE,oBAAoB;IASpC,OAAO,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IA2D3C;;OAEG;YACW,oBAAoB;IAclC;;OAEG;YACW,cAAc;IAuC5B;;;OAGG;YACW,gBAAgB;IAoB9B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA+CxB;;OAEG;IACH,SAAS;kBA9MoB,MAAM;mBAAa,GAAG;;CAiNpD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { MetadataRegistry } from '../core/metadata';
|
|
2
|
+
import type { DIContainer } from '../dependencies/container';
|
|
3
|
+
import type { Context } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* GraphQL Schema Builder
|
|
6
|
+
* Generates GraphQL schema from decorator metadata
|
|
7
|
+
*/
|
|
8
|
+
export declare class GraphQLSchemaBuilder {
|
|
9
|
+
private metadata;
|
|
10
|
+
private container;
|
|
11
|
+
private validationEngine;
|
|
12
|
+
private customTypes;
|
|
13
|
+
constructor(metadata: MetadataRegistry, container: DIContainer);
|
|
14
|
+
/**
|
|
15
|
+
* Build the complete GraphQL schema
|
|
16
|
+
*/
|
|
17
|
+
build(): GraphQLSchemaDefinition;
|
|
18
|
+
/**
|
|
19
|
+
* Build a field definition string
|
|
20
|
+
*/
|
|
21
|
+
private buildFieldDefinition;
|
|
22
|
+
/**
|
|
23
|
+
* Build resolvers object with validation and DI
|
|
24
|
+
*/
|
|
25
|
+
private buildResolvers;
|
|
26
|
+
/**
|
|
27
|
+
* Create a resolver function with validation and DI
|
|
28
|
+
*/
|
|
29
|
+
private createResolverFunction;
|
|
30
|
+
}
|
|
31
|
+
export interface GraphQLSchemaDefinition {
|
|
32
|
+
typeDefs: string;
|
|
33
|
+
resolvers: GraphQLResolvers;
|
|
34
|
+
}
|
|
35
|
+
export interface GraphQLResolvers {
|
|
36
|
+
Query?: Record<string, GraphQLResolverFn>;
|
|
37
|
+
Mutation?: Record<string, GraphQLResolverFn>;
|
|
38
|
+
Subscription?: Record<string, GraphQLResolverFn>;
|
|
39
|
+
}
|
|
40
|
+
export type GraphQLResolverFn = (parent: any, args: any, context: GraphQLContext, info: any) => any | Promise<any>;
|
|
41
|
+
export interface GraphQLContext {
|
|
42
|
+
request: Context;
|
|
43
|
+
user?: any;
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=schema-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-builder.d.ts","sourceRoot":"","sources":["../../../src/graphql/schema-builder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAiD,OAAO,EAAE,MAAM,UAAU,CAAC;AAKvF;;;GAGG;AACH,qBAAa,oBAAoB;IAK7B,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,SAAS;IALnB,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,WAAW,CAAkC;gBAG3C,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,EAAE,WAAW;IAKhC;;OAEG;IACH,KAAK,IAAI,uBAAuB;IAmEhC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IA2C5B;;OAEG;IACH,OAAO,CAAC,cAAc;IA+BtB;;OAEG;IACH,OAAO,CAAC,sBAAsB;CAgD/B;AAMD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,gBAAgB,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAClD;AAED,MAAM,MAAM,iBAAiB,GAAG,CAC9B,MAAM,EAAE,GAAG,EACX,IAAI,EAAE,GAAG,EACT,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,GAAG,KACN,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AAExB,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ZodSchema } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Convert a Zod schema to a GraphQL type string
|
|
4
|
+
*/
|
|
5
|
+
export declare function zodToGraphQLType(schema: ZodSchema): string;
|
|
6
|
+
/**
|
|
7
|
+
* Check if a Zod schema is nullable/optional
|
|
8
|
+
*/
|
|
9
|
+
export declare function isNullable(schema: ZodSchema): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Get the default value from a Zod schema
|
|
12
|
+
*/
|
|
13
|
+
export declare function getDefaultValue(schema: ZodSchema): any;
|
|
14
|
+
/**
|
|
15
|
+
* Generate GraphQL object type definition from Zod object schema
|
|
16
|
+
*/
|
|
17
|
+
export declare function zodObjectToGraphQLType(name: string, schema: ZodSchema): string;
|
|
18
|
+
/**
|
|
19
|
+
* Generate GraphQL input type definition from Zod object schema
|
|
20
|
+
*/
|
|
21
|
+
export declare function zodObjectToGraphQLInput(name: string, schema: ZodSchema): string;
|
|
22
|
+
//# sourceMappingURL=zod-to-graphql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod-to-graphql.d.ts","sourceRoot":"","sources":["../../../src/graphql/zod-to-graphql.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,KAAK,CAAC;AAGjD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAiF1D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAYrD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,GAAG,CAetD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,MAAM,CAmB9E;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,MAAM,CA2B/E"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
export { VeloceTS } from './core/application';
|
|
3
|
+
export { VeloceTS as Veloce } from './core/application';
|
|
4
|
+
export { VeloceTS as FastAPITS } from './core/application';
|
|
5
|
+
export { MetadataRegistry } from './core/metadata';
|
|
6
|
+
export { RouterCompiler } from './core/router-compiler';
|
|
7
|
+
export { MetadataCompiler, type CompiledRouteMetadata } from './core/compiled-metadata';
|
|
8
|
+
export * from './decorators/http';
|
|
9
|
+
export * from './decorators/params';
|
|
10
|
+
export * from './decorators/dependencies';
|
|
11
|
+
export * from './decorators/middleware';
|
|
12
|
+
export * from './decorators/docs';
|
|
13
|
+
export * from './decorators/websocket';
|
|
14
|
+
export * from './decorators/graphql';
|
|
15
|
+
export { ValidationEngine } from './validation/validator';
|
|
16
|
+
export { ValidationException } from './validation/exceptions';
|
|
17
|
+
export { DIContainer } from './dependencies/container';
|
|
18
|
+
export * from './responses/response';
|
|
19
|
+
export * from './errors/exceptions';
|
|
20
|
+
export { ErrorHandler } from './errors/handler';
|
|
21
|
+
export * from './middleware';
|
|
22
|
+
export type { Plugin } from './core/plugin';
|
|
23
|
+
export { PluginManager } from './core/plugin';
|
|
24
|
+
export * from './plugins';
|
|
25
|
+
export * from './websocket';
|
|
26
|
+
export * from './graphql';
|
|
27
|
+
export { OpenAPIGenerator } from './docs/openapi-generator';
|
|
28
|
+
export { ZodToJsonSchemaConverter, zodToJsonSchema } from './docs/zod-to-json-schema';
|
|
29
|
+
export * from './adapters/base';
|
|
30
|
+
export { HonoAdapter } from './adapters/hono';
|
|
31
|
+
export { ExpressAdapter } from './adapters/express';
|
|
32
|
+
export * from './types';
|
|
33
|
+
export * from './testing';
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,kBAAkB,CAAC;AAG1B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,QAAQ,IAAI,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGxF,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AAGrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,cAAc,sBAAsB,CAAC;AAGrC,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,cAAc,cAAc,CAAC;AAG7B,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,cAAc,WAAW,CAAC;AAG1B,cAAc,aAAa,CAAC;AAG5B,cAAc,WAAW,CAAC;AAG1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAGtF,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,cAAc,SAAS,CAAC;AAGxB,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Middleware, CompressionOptions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Create compression middleware
|
|
4
|
+
* Compresses responses with gzip or brotli based on Accept-Encoding header
|
|
5
|
+
*/
|
|
6
|
+
export declare function createCompressionMiddleware(options?: CompressionOptions): Middleware;
|
|
7
|
+
//# sourceMappingURL=compression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compression.d.ts","sourceRoot":"","sources":["../../../src/middleware/compression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,UAAU,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAExE;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,UAAU,CAmJpF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Middleware, CorsOptions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Create CORS middleware with configurable options
|
|
4
|
+
* Handles preflight requests and adds appropriate CORS headers
|
|
5
|
+
*/
|
|
6
|
+
export declare function createCorsMiddleware(options?: CorsOptions): Middleware;
|
|
7
|
+
//# sourceMappingURL=cors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cors.d.ts","sourceRoot":"","sources":["../../../src/middleware/cors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEjE;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,UAAU,CAsDtE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/middleware/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Middleware, RateLimitOptions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Create rate limiting middleware
|
|
4
|
+
* Tracks requests per IP/key and returns 429 when limit exceeded
|
|
5
|
+
*/
|
|
6
|
+
export declare function createRateLimitMiddleware(options: RateLimitOptions): Middleware;
|
|
7
|
+
//# sourceMappingURL=rate-limit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rate-limit.d.ts","sourceRoot":"","sources":["../../../src/middleware/rate-limit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,UAAU,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAUtE;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,gBAAgB,GAAG,UAAU,CA6E/E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Plugin } from '../core/plugin';
|
|
2
|
+
import type { VeloceTS } from '../core/application';
|
|
3
|
+
import type { OpenAPIOptions } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* OpenAPIPlugin generates OpenAPI 3.0 specification from route metadata
|
|
6
|
+
* and serves Swagger UI for interactive API documentation
|
|
7
|
+
*/
|
|
8
|
+
export declare class OpenAPIPlugin implements Plugin {
|
|
9
|
+
name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
private options;
|
|
12
|
+
constructor(options?: OpenAPIOptions);
|
|
13
|
+
install(app: VeloceTS): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Generate OpenAPI 3.0 specification from application metadata
|
|
16
|
+
*/
|
|
17
|
+
private generateSpec;
|
|
18
|
+
/**
|
|
19
|
+
* Render Swagger UI HTML
|
|
20
|
+
*/
|
|
21
|
+
private renderSwaggerUI;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=openapi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../../src/plugins/openapi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C;;;GAGG;AACH,qBAAa,aAAc,YAAW,MAAM;IAC1C,IAAI,SAAa;IACjB,OAAO,SAAW;IAElB,OAAO,CAAC,OAAO,CAA2B;gBAE9B,OAAO,CAAC,EAAE,cAAc;IAW9B,OAAO,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAmC3C;;OAEG;IACH,OAAO,CAAC,YAAY;IAMpB;;OAEG;IACH,OAAO,CAAC,eAAe;CAyCxB"}
|