@dangao/bun-server 1.8.3 → 1.10.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.
Files changed (88) hide show
  1. package/README.md +60 -6
  2. package/dist/core/application.d.ts +12 -0
  3. package/dist/core/application.d.ts.map +1 -1
  4. package/dist/core/server.d.ts +7 -0
  5. package/dist/core/server.d.ts.map +1 -1
  6. package/dist/events/event-module.d.ts +4 -0
  7. package/dist/events/event-module.d.ts.map +1 -1
  8. package/dist/events/types.d.ts +16 -0
  9. package/dist/events/types.d.ts.map +1 -1
  10. package/dist/index.js +4969 -4882
  11. package/docs/custom-decorators.md +1 -7
  12. package/docs/extensions.md +0 -2
  13. package/docs/guide.md +0 -1
  14. package/docs/zh/custom-decorators.md +1 -7
  15. package/docs/zh/extensions.md +0 -2
  16. package/docs/zh/guide.md +0 -1
  17. package/docs/zh/migration.md +0 -5
  18. package/package.json +4 -4
  19. package/src/core/application.ts +38 -0
  20. package/src/core/server.ts +9 -0
  21. package/src/events/event-module.ts +108 -0
  22. package/src/events/types.ts +19 -0
  23. package/tests/auth/auth-decorators.test.ts +0 -1
  24. package/tests/auth/oauth2-service.test.ts +0 -1
  25. package/tests/cache/cache-decorators-extended.test.ts +0 -1
  26. package/tests/cache/cache-decorators.test.ts +0 -1
  27. package/tests/cache/cache-interceptors.test.ts +0 -1
  28. package/tests/cache/cache-module.test.ts +0 -1
  29. package/tests/cache/cache-service-proxy.test.ts +0 -1
  30. package/tests/config/config-center-integration.test.ts +0 -1
  31. package/tests/config/config-module-extended.test.ts +0 -1
  32. package/tests/config/config-module.test.ts +0 -1
  33. package/tests/controller/controller.test.ts +0 -1
  34. package/tests/controller/param-binder.test.ts +0 -1
  35. package/tests/controller/path-combination.test.ts +0 -1
  36. package/tests/core/application.test.ts +34 -0
  37. package/tests/database/database-module.test.ts +0 -1
  38. package/tests/database/orm.test.ts +0 -1
  39. package/tests/database/postgres-mysql-integration.test.ts +0 -1
  40. package/tests/database/transaction.test.ts +0 -1
  41. package/tests/di/container.test.ts +0 -1
  42. package/tests/error/error-handler.test.ts +0 -1
  43. package/tests/events/event-decorators.test.ts +0 -1
  44. package/tests/events/event-listener-scanner.test.ts +0 -1
  45. package/tests/events/event-module.test.ts +0 -1
  46. package/tests/extensions/logger-module.test.ts +0 -1
  47. package/tests/health/health-module.test.ts +0 -1
  48. package/tests/integration/oauth2-e2e.test.ts +0 -1
  49. package/tests/integration/session-e2e.test.ts +0 -1
  50. package/tests/interceptor/base-interceptor.test.ts +0 -1
  51. package/tests/interceptor/builtin/cache-interceptor.test.ts +0 -1
  52. package/tests/interceptor/builtin/log-interceptor.test.ts +0 -1
  53. package/tests/interceptor/builtin/permission-interceptor.test.ts +0 -1
  54. package/tests/interceptor/interceptor-advanced-integration.test.ts +0 -1
  55. package/tests/interceptor/interceptor-chain.test.ts +0 -1
  56. package/tests/interceptor/interceptor-integration.test.ts +0 -1
  57. package/tests/interceptor/interceptor-metadata.test.ts +0 -1
  58. package/tests/interceptor/interceptor-registry.test.ts +0 -1
  59. package/tests/interceptor/perf/interceptor-performance.test.ts +0 -1
  60. package/tests/metrics/metrics-module.test.ts +0 -1
  61. package/tests/microservice/config-center.test.ts +0 -1
  62. package/tests/microservice/service-client-decorators.test.ts +0 -1
  63. package/tests/microservice/service-registry-decorators.test.ts +0 -1
  64. package/tests/microservice/service-registry.test.ts +0 -1
  65. package/tests/middleware/builtin/middleware-builtin-extended.test.ts +0 -1
  66. package/tests/middleware/builtin/rate-limit.test.ts +0 -1
  67. package/tests/middleware/middleware-decorators.test.ts +0 -1
  68. package/tests/middleware/middleware-pipeline.test.ts +0 -1
  69. package/tests/middleware/middleware.test.ts +0 -1
  70. package/tests/perf/optimization.test.ts +0 -1
  71. package/tests/queue/queue-decorators.test.ts +0 -1
  72. package/tests/queue/queue-module.test.ts +0 -1
  73. package/tests/queue/queue-service.test.ts +0 -1
  74. package/tests/router/router-decorators.test.ts +0 -1
  75. package/tests/router/router-extended.test.ts +0 -1
  76. package/tests/security/guards/guards-integration.test.ts +0 -1
  77. package/tests/security/guards/guards.test.ts +0 -1
  78. package/tests/security/guards/reflector.test.ts +0 -1
  79. package/tests/security/security-filter.test.ts +0 -1
  80. package/tests/security/security-module-extended.test.ts +0 -1
  81. package/tests/security/security-module.test.ts +0 -1
  82. package/tests/session/session-decorators.test.ts +0 -1
  83. package/tests/session/session-module.test.ts +0 -1
  84. package/tests/swagger/decorators.test.ts +0 -1
  85. package/tests/swagger/swagger-module.test.ts +0 -1
  86. package/tests/swagger/ui.test.ts +0 -1
  87. package/tests/validation/class-validator.test.ts +0 -1
  88. package/tests/validation/controller-validation.test.ts +0 -1
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import {
5
4
  Permission,
@@ -1,4 +1,3 @@
1
- import 'reflect-metadata';
2
1
  import { describe, expect, test, beforeEach, afterEach } from 'bun:test';
3
2
  import { Application } from '../../src/core/application';
4
3
  import { Controller, ControllerRegistry } from '../../src/controller/controller';
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import { InterceptorChain } from '../../src/interceptor/interceptor-chain';
5
4
  import type { Interceptor } from '../../src/interceptor/types';
@@ -1,4 +1,3 @@
1
- import 'reflect-metadata';
2
1
  import { describe, expect, test, beforeEach, afterEach } from 'bun:test';
3
2
  import { Application } from '../../src/core/application';
4
3
  import { Controller, ControllerRegistry } from '../../src/controller/controller';
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import { scanInterceptorMetadata } from '../../src/interceptor/metadata';
5
4
  import { InterceptorRegistry } from '../../src/interceptor/interceptor-registry';
@@ -1,4 +1,3 @@
1
- import 'reflect-metadata';
2
1
  import { describe, expect, test, beforeEach } from 'bun:test';
3
2
  import { InterceptorRegistry, INTERCEPTOR_REGISTRY_TOKEN } from '../../src/interceptor';
4
3
  import type { Interceptor } from '../../src/interceptor';
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import { PerformanceHarness } from '../../../src/testing/harness';
5
4
  import { InterceptorRegistry } from '../../../src/interceptor/interceptor-registry';
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import { Application } from '../../src/core/application';
5
4
  import { MetricsModule, MetricsCollector, createHttpMetricsMiddleware, type CustomMetric } from '../../src/metrics';
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
  import { ConfigCenterModule, CONFIG_CENTER_TOKEN, type ConfigCenter } from '../../src/microservice/config-center';
4
3
  import { Container } from '../../src/di/container';
5
4
  import { ModuleRegistry } from '../../src/di/module-registry';
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import {
5
4
  ServiceClient,
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import {
5
4
  ServiceRegistry,
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
  import { ServiceRegistryModule, SERVICE_REGISTRY_TOKEN, type ServiceRegistry } from '../../src/microservice/service-registry';
4
3
  import { MODULE_METADATA_KEY } from '../../src/di/module';
5
4
  import { ControllerRegistry } from '../../src/controller/controller';
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import { createCorsMiddleware } from '../../../src/middleware/builtin/cors';
5
4
  import { createLoggerMiddleware } from '../../../src/middleware/builtin/logger';
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import {
5
4
  MemoryRateLimitStore,
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import {
5
4
  UseMiddleware,
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import { MiddlewarePipeline, runMiddlewares } from '../../src/middleware/pipeline';
5
4
  import { Context } from '../../src/core/context';
@@ -1,4 +1,3 @@
1
- import 'reflect-metadata';
2
1
  import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
3
2
 
4
3
  import { Application } from '../../src/core/application';
@@ -5,7 +5,6 @@ import { MiddlewarePipeline } from '../../src/middleware/pipeline';
5
5
  import { Container } from '../../src/di/container';
6
6
  import { Injectable, Inject } from '../../src/di/decorators';
7
7
  import { PerformanceHarness } from '../../src/testing/harness';
8
- import 'reflect-metadata';
9
8
 
10
9
  /**
11
10
  * 性能优化验证测试
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import {
5
4
  Queue,
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach, afterEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import { MODULE_METADATA_KEY } from '../../src/di/module';
5
4
  import { Container } from '../../src/di/container';
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import { QueueService } from '../../src/queue/service';
5
4
  import type { QueueStore, Job, JobData, QueueModuleOptions } from '../../src/queue/types';
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import {
5
4
  GET,
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import { Router } from '../../src/router/router';
5
4
  import { RouteRegistry } from '../../src/router/registry';
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach, afterEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
  import { Application } from '../../../src/core/application';
4
3
  import { Controller } from '../../../src/controller';
5
4
  import { GET, POST } from '../../../src/router/decorators';
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
  import {
4
3
  UseGuards,
5
4
  Roles,
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import { Reflector, REFLECTOR_TOKEN } from '../../../src/security/guards/reflector';
5
4
 
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import {
5
4
  createSecurityFilter,
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach, afterEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import { SecurityModule } from '../../src/security/security-module';
5
4
  import { MODULE_METADATA_KEY } from '../../src/di/module';
@@ -3,7 +3,6 @@ import { SecurityModule } from '../../src/security/security-module';
3
3
  import { MODULE_METADATA_KEY } from '../../src/di/module';
4
4
  import { JWT_UTIL_TOKEN, OAUTH2_SERVICE_TOKEN } from '../../src/auth/controller';
5
5
  import { AuthenticationManager } from '../../src/security/authentication-manager';
6
- import 'reflect-metadata';
7
6
 
8
7
  describe('SecurityModule', () => {
9
8
  beforeEach(() => {
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import { Session, getSessionFromContext } from '../../src/session/decorators';
5
4
  import { SessionService } from '../../src/session/service';
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import { MODULE_METADATA_KEY } from '../../src/di/module';
5
4
  import { Container } from '../../src/di/container';
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test } from 'bun:test';
2
- import 'reflect-metadata';
3
2
  import {
4
3
  ApiTags,
5
4
  ApiOperation,
@@ -1,7 +1,6 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
2
  import { SwaggerModule } from '../../src/swagger/swagger-module';
3
3
  import { MODULE_METADATA_KEY } from '../../src/di/module';
4
- import 'reflect-metadata';
5
4
 
6
5
  describe('SwaggerModule', () => {
7
6
  beforeEach(() => {
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test, beforeEach } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import { createSwaggerUIMiddleware } from '../../src/swagger/ui';
5
4
  import { SwaggerExtension } from '../../src/swagger/swagger-extension';
@@ -1,5 +1,4 @@
1
1
  import { describe, expect, test } from 'bun:test';
2
- import 'reflect-metadata';
3
2
 
4
3
  import {
5
4
  ValidateClass,
@@ -1,4 +1,3 @@
1
- import 'reflect-metadata';
2
1
  import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
3
2
 
4
3
  import { Controller, ControllerRegistry } from '../../src/controller/controller';