@stacksjs/bun-router 0.0.2

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.
Files changed (131) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +397 -0
  3. package/bin/cli.ts +9 -0
  4. package/dist/auth.d.ts +77 -0
  5. package/dist/cache/lru-cache.d.ts +88 -0
  6. package/dist/cache/middleware-memoization.d.ts +101 -0
  7. package/dist/cache/route-cache-warmer.d.ts +125 -0
  8. package/dist/cache/sqlite-cache.d.ts +114 -0
  9. package/dist/cache/streaming-cache.d.ts +86 -0
  10. package/dist/chunk-r15a48wc.js +25448 -0
  11. package/dist/cli/colors.d.ts +12 -0
  12. package/dist/cli/index.d.ts +10 -0
  13. package/dist/cli/middleware.d.ts +31 -0
  14. package/dist/cli/openapi.d.ts +17 -0
  15. package/dist/cli/router.d.ts +15 -0
  16. package/dist/cli/routes.d.ts +30 -0
  17. package/dist/cli/utils.d.ts +68 -0
  18. package/dist/cli.d.ts +0 -0
  19. package/dist/cli.js +3195 -0
  20. package/dist/config.d.ts +274 -0
  21. package/dist/container/container.d.ts +141 -0
  22. package/dist/container/contextual-binding.d.ts +112 -0
  23. package/dist/container/decorators.d.ts +114 -0
  24. package/dist/container/service-provider.d.ts +221 -0
  25. package/dist/development/hot-reload.d.ts +129 -0
  26. package/dist/development/index.d.ts +144 -0
  27. package/dist/development/performance-profiler.d.ts +152 -0
  28. package/dist/development/route-debugger.d.ts +102 -0
  29. package/dist/development/route-inspector.d.ts +142 -0
  30. package/dist/development/typescript-utilities.d.ts +116 -0
  31. package/dist/docs.d.ts +10 -0
  32. package/dist/errors/circuit-breaker.d.ts +138 -0
  33. package/dist/errors/error-handler.d.ts +57 -0
  34. package/dist/errors/error-reporting.d.ts +135 -0
  35. package/dist/errors/exceptions.d.ts +178 -0
  36. package/dist/errors/graceful-degradation.d.ts +130 -0
  37. package/dist/errors/index.d.ts +6 -0
  38. package/dist/errors/router-errors.d.ts +97 -0
  39. package/dist/file-serving/static-files.d.ts +98 -0
  40. package/dist/index.d.ts +10 -0
  41. package/dist/index.js +13417 -0
  42. package/dist/middleware/auth.d.ts +34 -0
  43. package/dist/middleware/content_security_policy.d.ts +54 -0
  44. package/dist/middleware/cors.d.ts +5 -0
  45. package/dist/middleware/csrf.d.ts +7 -0
  46. package/dist/middleware/ddos_protection.d.ts +47 -0
  47. package/dist/middleware/file_security.d.ts +23 -0
  48. package/dist/middleware/file_upload.d.ts +41 -0
  49. package/dist/middleware/helmet.d.ts +54 -0
  50. package/dist/middleware/index.d.ts +55 -0
  51. package/dist/middleware/input_validation.d.ts +46 -0
  52. package/dist/middleware/json_body.d.ts +4 -0
  53. package/dist/middleware/performance_alerting.d.ts +88 -0
  54. package/dist/middleware/performance_dashboard.d.ts +97 -0
  55. package/dist/middleware/performance_monitor.d.ts +236 -0
  56. package/dist/middleware/pipeline.d.ts +90 -0
  57. package/dist/middleware/rate_limit.d.ts +33 -0
  58. package/dist/middleware/request_id.d.ts +4 -0
  59. package/dist/middleware/request_signing.d.ts +96 -0
  60. package/dist/middleware/request_tracer.d.ts +76 -0
  61. package/dist/middleware/response_cache.d.ts +90 -0
  62. package/dist/middleware/security.d.ts +70 -0
  63. package/dist/middleware/security_suite.d.ts +46 -0
  64. package/dist/middleware/session.d.ts +7 -0
  65. package/dist/model-binding/index.d.ts +17 -0
  66. package/dist/model-binding/model-middleware.d.ts +80 -0
  67. package/dist/model-binding/model-registry.d.ts +125 -0
  68. package/dist/model-binding.d.ts +123 -0
  69. package/dist/model-resolver-factory.d.ts +31 -0
  70. package/dist/observability/correlation.d.ts +131 -0
  71. package/dist/observability/health-checks.d.ts +129 -0
  72. package/dist/observability/index.d.ts +92 -0
  73. package/dist/observability/integration.d.ts +112 -0
  74. package/dist/observability/metrics.d.ts +135 -0
  75. package/dist/observability/tracing.d.ts +112 -0
  76. package/dist/optimization/bun-utilities.d.ts +106 -0
  77. package/dist/query-builder-integration.d.ts +24 -0
  78. package/dist/request/enhanced-request.d.ts +143 -0
  79. package/dist/request/macros.d.ts +267 -0
  80. package/dist/response/macros.d.ts +207 -0
  81. package/dist/response/response-factory.d.ts +93 -0
  82. package/dist/router/file-based-routing.d.ts +40 -0
  83. package/dist/router/file-streaming.d.ts +6 -0
  84. package/dist/router/fluent-router.d.ts +179 -0
  85. package/dist/router/fluent-routing.d.ts +198 -0
  86. package/dist/router/group-organization.d.ts +5 -0
  87. package/dist/router/handler-resolver.d.ts +13 -0
  88. package/dist/router/http-methods.d.ts +10 -0
  89. package/dist/router/index.d.ts +114 -0
  90. package/dist/router/middleware-integration.d.ts +86 -0
  91. package/dist/router/middleware.d.ts +5 -0
  92. package/dist/router/model-binding.d.ts +7 -0
  93. package/dist/router/optimized-route-matching.d.ts +6 -0
  94. package/dist/router/route-building.d.ts +5 -0
  95. package/dist/router/route-compiler.d.ts +67 -0
  96. package/dist/router/route-matching.d.ts +5 -0
  97. package/dist/router/route-trie.d.ts +69 -0
  98. package/dist/router/router.d.ts +133 -0
  99. package/dist/router/server.d.ts +5 -0
  100. package/dist/router/validation-integration.d.ts +116 -0
  101. package/dist/router/view-rendering.d.ts +5 -0
  102. package/dist/router/websocket.d.ts +5 -0
  103. package/dist/routing/route-caching.d.ts +105 -0
  104. package/dist/routing/route-throttling.d.ts +112 -0
  105. package/dist/routing/subdomain-routing.d.ts +159 -0
  106. package/dist/streaming/index.d.ts +15 -0
  107. package/dist/streaming/sse-handler.d.ts +81 -0
  108. package/dist/streaming/stream-handler.d.ts +81 -0
  109. package/dist/testing/auth-testing.d.ts +107 -0
  110. package/dist/testing/file-upload-testing.d.ts +139 -0
  111. package/dist/testing/index.d.ts +10 -0
  112. package/dist/testing/middleware-testing.d.ts +99 -0
  113. package/dist/testing/model-binding-testing.d.ts +132 -0
  114. package/dist/testing/performance-testing.d.ts +202 -0
  115. package/dist/testing/test-client.d.ts +58 -0
  116. package/dist/testing/test-request.d.ts +43 -0
  117. package/dist/testing/test-response.d.ts +45 -0
  118. package/dist/testing/types.d.ts +206 -0
  119. package/dist/testing/websocket-testing.d.ts +170 -0
  120. package/dist/types/controller-types.d.ts +303 -0
  121. package/dist/types/core.d.ts +526 -0
  122. package/dist/types/middleware-types.d.ts +315 -0
  123. package/dist/types/request-response-augmentation.d.ts +373 -0
  124. package/dist/types/route-inference.d.ts +287 -0
  125. package/dist/types.d.ts +1620 -0
  126. package/dist/utils/index.d.ts +1 -0
  127. package/dist/utils/query-preservation.d.ts +31 -0
  128. package/dist/utils.d.ts +69 -0
  129. package/dist/validation/validator.d.ts +169 -0
  130. package/dist/websocket/clustering.d.ts +114 -0
  131. package/package.json +81 -0
@@ -0,0 +1,12 @@
1
+ export declare const chalk: {
2
+ red: (text: string) => unknown;
3
+ green: (text: string) => unknown;
4
+ yellow: (text: string) => unknown;
5
+ blue: (text: string) => unknown;
6
+ cyan: (text: string) => unknown;
7
+ white: (text: string) => unknown;
8
+ gray: (text: string) => unknown;
9
+ bold: (text: string) => unknown;
10
+ dim: (text: string) => unknown;
11
+ hex: (_color: string) => unknown
12
+ };
@@ -0,0 +1,10 @@
1
+ import { CLI } from '@stacksjs/clapp';
2
+ /**
3
+ * Create and configure the CLI
4
+ */
5
+ export declare function createCLI(): CLI;
6
+ export * from './middleware';
7
+ export * from './openapi';
8
+ export * from './router';
9
+ export * from './routes';
10
+ export * from './utils';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Generate TypeScript types for middleware configurations
3
+ */
4
+ export declare function generateMiddlewareTypes(outputPath: string): Promise<void>;
5
+ /**
6
+ * Generate middleware type mappings for user project
7
+ */
8
+ export declare function generateMiddlewareMap(directoryPath: string, outputPath: string): Promise<void>;
9
+ /**
10
+ * Watch for changes in the directory and regenerate middleware map
11
+ */
12
+ export declare function watchDirectoryForMiddleware(directoryPath: string, outputPath: string): Promise<void>;
13
+ /**
14
+ * Watch for changes in the middleware directory and regenerate types
15
+ */
16
+ export declare function watchMiddlewareDirectory(outputPath: string): Promise<void>;
17
+ /**
18
+ * Options for the middleware:types command
19
+ */
20
+ export declare interface GenerateMiddlewareTypesOptions {
21
+ output?: string
22
+ watch?: boolean
23
+ }
24
+ /**
25
+ * Options for the middleware:map command
26
+ */
27
+ export declare interface MapMiddlewareOptions {
28
+ output?: string
29
+ dir?: string
30
+ watch?: boolean
31
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Generate OpenAPI specification for API routes
3
+ */
4
+ export declare function generateOpenAPISpec(options: OpenAPIOptions): Promise<void>;
5
+ /**
6
+ * Options for the openapi command
7
+ */
8
+ export declare interface OpenAPIOptions {
9
+ output?: string
10
+ title?: string
11
+ version?: string
12
+ description?: string
13
+ basePath?: string
14
+ servers?: string
15
+ tags?: boolean
16
+ security?: boolean
17
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Generate TypeScript types for router extensions
3
+ */
4
+ export declare function generateRouterTypes(outputPath: string): Promise<void>;
5
+ /**
6
+ * Watch for changes in router files and regenerate types
7
+ */
8
+ export declare function watchRouterFiles(outputPath: string): Promise<void>;
9
+ /**
10
+ * Options for the router:types command
11
+ */
12
+ export declare interface GenerateRouterTypesOptions {
13
+ output?: string
14
+ watch?: boolean
15
+ }
@@ -0,0 +1,30 @@
1
+ import path from 'node:path';
2
+ /**
3
+ * Display all registered routes in a formatted table
4
+ */
5
+ export declare function displayRoutes(options: RouteListOptions): Promise<void>;
6
+ /**
7
+ * Generate TypeScript types for route names
8
+ */
9
+ export declare function generateRouteTypes(outputPath: string): Promise<void>;
10
+ /**
11
+ * Watch for changes in the routes directory and regenerate types
12
+ */
13
+ export declare function watchRoutesDirectory(outputPath: string): Promise<void>;
14
+ /**
15
+ * Options for the route:list command
16
+ */
17
+ export declare interface RouteListOptions {
18
+ verbose?: boolean
19
+ extraVerbose?: boolean
20
+ path?: string
21
+ exceptVendor?: boolean
22
+ onlyVendor?: boolean
23
+ }
24
+ /**
25
+ * Options for the route:types command
26
+ */
27
+ export declare interface GenerateRouteTypesOptions {
28
+ output?: string
29
+ watch?: boolean
30
+ }
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Load router instance from the application
3
+ */
4
+ export declare function loadRouter(): Promise<any>;
5
+ /**
6
+ * Setup a debounced file watcher
7
+ */
8
+ export declare function setupDebouncedWatcher(callback: () => Promise<void>, _debounceTime?: any): { timeoutId: NodeJS.Timeout | null };
9
+ /**
10
+ * Utility to get method color for console output
11
+ */
12
+ export declare function getMethodColor(method: string): string;
13
+ /**
14
+ * Pad a string to a specified length
15
+ */
16
+ export declare function padString(str: string, length: number): string;
17
+ /**
18
+ * Check router health and configuration
19
+ */
20
+ export declare function checkRouterHealth(options: { verbose?: boolean }): Promise<void>;
21
+ /**
22
+ * Test routes by making HTTP requests
23
+ */
24
+ export declare function testRoutes(options: {
25
+ baseUrl?: string
26
+ filter?: string
27
+ method?: string
28
+ timeout?: number
29
+ }): Promise<void>;
30
+ /**
31
+ * Debug route matching for a specific path
32
+ */
33
+ export declare function debugRoute(path: string, options: {
34
+ method?: string
35
+ verbose?: boolean
36
+ }): Promise<void>;
37
+ /**
38
+ * Clear route caches
39
+ */
40
+ export declare function clearCaches(options: { stats?: boolean }): Promise<void>;
41
+ /**
42
+ * Validate route definitions and configuration
43
+ */
44
+ export declare function validateRoutes(options: {
45
+ strict?: boolean
46
+ fix?: boolean
47
+ }): Promise<void>;
48
+ /**
49
+ * Formats console output with consistent styling
50
+ */
51
+ export declare const format: {
52
+ success: (message: string) => any;
53
+ info: (message: string) => any;
54
+ warning: (message: string) => any;
55
+ error: (message: string) => any;
56
+ dim: (message: string) => any;
57
+ bold: (message: string) => any
58
+ };
59
+ /**
60
+ * Logger for CLI commands with consistent styling
61
+ */
62
+ export declare const logger: {
63
+ success: (message: string) => any;
64
+ info: (message: string) => any;
65
+ warning: (message: string) => any;
66
+ error: (message: string) => any;
67
+ debug: (message: string) => any
68
+ };
package/dist/cli.d.ts ADDED
File without changes