veloce-ts 1.0.0 → 1.2.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 (69) hide show
  1. package/CHANGELOG.md +115 -19
  2. package/README.md +30 -9
  3. package/dist/cjs/src/auth/index.js +2 -2
  4. package/dist/cjs/src/auth/index.js.map +3 -3
  5. package/dist/cjs/src/cli/index.js +257 -95
  6. package/dist/cjs/src/cli/index.js.map +4 -4
  7. package/dist/cjs/src/docs/index.js +3 -3
  8. package/dist/cjs/src/docs/index.js.map +4 -4
  9. package/dist/cjs/src/errors/index.js +24 -24
  10. package/dist/cjs/src/errors/index.js.map +6 -5
  11. package/dist/cjs/src/graphql/index.js +16 -16
  12. package/dist/cjs/src/graphql/index.js.map +4 -4
  13. package/dist/cjs/src/index.js +64 -62
  14. package/dist/cjs/src/index.js.map +18 -12
  15. package/dist/cjs/src/plugins/index.js +23 -23
  16. package/dist/cjs/src/plugins/index.js.map +6 -6
  17. package/dist/cjs/src/testing/index.js +34 -32
  18. package/dist/cjs/src/testing/index.js.map +11 -6
  19. package/dist/esm/src/auth/index.js +2 -2
  20. package/dist/esm/src/auth/index.js.map +3 -3
  21. package/dist/esm/src/cli/index.js +257 -95
  22. package/dist/esm/src/cli/index.js.map +4 -4
  23. package/dist/esm/src/docs/index.js +3 -3
  24. package/dist/esm/src/docs/index.js.map +4 -4
  25. package/dist/esm/src/errors/index.js +24 -24
  26. package/dist/esm/src/errors/index.js.map +6 -5
  27. package/dist/esm/src/graphql/index.js +15 -15
  28. package/dist/esm/src/graphql/index.js.map +4 -4
  29. package/dist/esm/src/index.js +64 -62
  30. package/dist/esm/src/index.js.map +18 -12
  31. package/dist/esm/src/plugins/index.js +23 -23
  32. package/dist/esm/src/plugins/index.js.map +6 -6
  33. package/dist/esm/src/testing/index.js +34 -32
  34. package/dist/esm/src/testing/index.js.map +11 -6
  35. package/dist/types/cli/commands/generate.d.ts.map +1 -1
  36. package/dist/types/core/application.d.ts +15 -0
  37. package/dist/types/core/application.d.ts.map +1 -1
  38. package/dist/types/core/interceptor-manager.d.ts +16 -0
  39. package/dist/types/core/interceptor-manager.d.ts.map +1 -0
  40. package/dist/types/core/router-compiler.d.ts +5 -1
  41. package/dist/types/core/router-compiler.d.ts.map +1 -1
  42. package/dist/types/decorators/extras.d.ts +20 -0
  43. package/dist/types/decorators/extras.d.ts.map +1 -0
  44. package/dist/types/decorators/stream.d.ts +5 -0
  45. package/dist/types/decorators/stream.d.ts.map +1 -0
  46. package/dist/types/docs/openapi-generator.d.ts +2 -2
  47. package/dist/types/docs/openapi-generator.d.ts.map +1 -1
  48. package/dist/types/docs/zod-to-json-schema.d.ts.map +1 -1
  49. package/dist/types/errors/exception-filter.d.ts +12 -0
  50. package/dist/types/errors/exception-filter.d.ts.map +1 -0
  51. package/dist/types/errors/index.d.ts +2 -0
  52. package/dist/types/errors/index.d.ts.map +1 -1
  53. package/dist/types/events/event-bus.d.ts +14 -0
  54. package/dist/types/events/event-bus.d.ts.map +1 -0
  55. package/dist/types/events/index.d.ts +2 -0
  56. package/dist/types/events/index.d.ts.map +1 -0
  57. package/dist/types/graphql/plugin.d.ts +12 -0
  58. package/dist/types/graphql/plugin.d.ts.map +1 -1
  59. package/dist/types/graphql/schema-builder.d.ts +4 -5
  60. package/dist/types/graphql/schema-builder.d.ts.map +1 -1
  61. package/dist/types/index.d.ts +7 -0
  62. package/dist/types/index.d.ts.map +1 -1
  63. package/dist/types/testing/index.d.ts +1 -0
  64. package/dist/types/testing/index.d.ts.map +1 -1
  65. package/dist/types/testing/isolate.d.ts +12 -0
  66. package/dist/types/testing/isolate.d.ts.map +1 -0
  67. package/dist/types/types/index.d.ts +2 -0
  68. package/dist/types/types/index.d.ts.map +1 -1
  69. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -7,6 +7,102 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.0] - 2026-06-27
11
+
12
+ ### Added
13
+
14
+ - **CLI code generation** (`veloce generate`): scaffold controllers, services, modules, resolvers, DTOs, middleware, and plugins with a single command. `veloce new <name>` creates a full project with correct tsconfig and dependencies.
15
+ ```bash
16
+ veloce generate module school # controller + service + dto + barrel
17
+ veloce generate controller users # @Controller with full CRUD stubs
18
+ veloce generate resolver product # @Resolver with @GQLQuery/@GQLMutation
19
+ veloce generate plugin cache # Plugin interface implementation
20
+ ```
21
+
22
+ - **Graceful shutdown** (`app.onShutdown()`): register async cleanup handlers executed on SIGTERM/SIGINT in reverse order, with a configurable timeout (default 30 s).
23
+ ```typescript
24
+ app.onShutdown(async () => { await db.end(); });
25
+ app.setShutdownTimeout(10_000);
26
+ ```
27
+
28
+ - **Exception filters** (`@Catch`, `app.useFilter()`): centralised error handling per error class — no more try/catch in every controller.
29
+ ```typescript
30
+ @Catch(DrizzleError)
31
+ class DBFilter implements ExceptionFilter {
32
+ catch(err: DrizzleError, c: Context) { return c.json({ error: 'DB error' }, 500); }
33
+ }
34
+ app.useFilter(new DBFilter());
35
+ ```
36
+
37
+ - **Interceptors** (`@UseInterceptor`, `app.useInterceptor()`): AOP middleware around handlers — logging, caching, retries, transforms.
38
+ ```typescript
39
+ app.useInterceptor(new LoggingInterceptor());
40
+ @UseInterceptor(CacheInterceptor)
41
+ @Get('/users') async getUsers() { ... }
42
+ ```
43
+
44
+ - **Streaming responses** (`@SSE()`, `@Stream(contentType)`): return `AsyncGenerator` from any handler for SSE or raw byte streams.
45
+ ```typescript
46
+ @Get('/events') @SSE()
47
+ async* stream() { yield { data: 'ping' }; }
48
+
49
+ @Get('/export.csv') @Stream('text/csv')
50
+ async* csv() { yield 'id,name\n'; yield* rows; }
51
+ ```
52
+
53
+ - **Event bus** (`EventBus`, `globalEvents`): lightweight in-process pub/sub with `on`, `once`, `off`, async `emit`, and `emitSync`.
54
+ ```typescript
55
+ globalEvents.on('user.created', async ({ userId }) => { ... });
56
+ await globalEvents.emit('user.created', { userId });
57
+ ```
58
+
59
+ - **Extra decorators**:
60
+ - `@Throttle(limit, windowMs)` — per-endpoint rate limit override
61
+ - `@ApiVersion('v2')` — prefix route with version segment
62
+ - `@ResponseHeader(name, value)` — set response header declaratively
63
+ - `@Redirect(url, status?)` — 301/302/307/308 redirect
64
+ - `@Deprecated(message?)` — marks route in OpenAPI + emits warning
65
+
66
+ - **Test isolation utilities** (`veloce-ts/testing`): `isolate()` resets shared singleton state between bun test files; `compileTestApp(app)` compiles and returns the Hono instance in one call.
67
+
68
+ - **OpenAPI 3.1** output: `openapi: '3.1.0'`, `jsonSchemaDialect` field, `nullable: true` replaced with JSON Schema 2020-12 type arrays (`{ type: ['string', 'null'] }`), full `oneOf` fallback for complex unions.
69
+
70
+ - **Benchmarks suite** (`benchmarks/`): `bun run benchmark` runs autocannon against veloce-ts, Hono, and Fastify across hello/json/params/validation routes and prints a comparison table.
71
+
72
+ ### Fixed
73
+
74
+ - GraphQL templates in `veloce new` used `@Query`/`@Mutation` (wrong) — corrected to `@GQLQuery`/`@GQLMutation` with proper `veloce-ts/graphql` imports.
75
+
76
+ ## [1.0.1] - 2026-06-26
77
+
78
+ ### Fixed
79
+
80
+ - **GraphQL decorator pipeline wired up.** `@Resolver`, `@GQLQuery`, `@GQLMutation`, `@GQLSubscription`, and `@Arg` decorators now correctly connect to `GraphQLPlugin`. Previously the decorators wrote metadata using local symbols that `GraphQLSchemaBuilder` never read — the schema was always empty.
81
+
82
+ Pass resolver classes to the plugin via the new `resolvers` option:
83
+ ```typescript
84
+ app.usePlugin(new GraphQLPlugin({ resolvers: [UserResolver, PostResolver] }));
85
+ ```
86
+ Or register them with `app.include()` before calling `usePlugin()`:
87
+ ```typescript
88
+ app.include(UserResolver);
89
+ app.usePlugin(new GraphQLPlugin());
90
+ ```
91
+
92
+ - **`PermissionManager.revokePermission()` bug fixed.** When called without a `resourceId`, the filter condition `resourceId ? p.resourceId !== resourceId : true` always returned `true` (kept all records, removed nothing). Now correctly removes all permissions for the user+resource pair when no `resourceId` is specified.
93
+
94
+ - **`app.include()` now recognises `@Resolver` classes.** Previously silently ignored — now registers resolver metadata into `MetadataRegistry` so `GraphQLPlugin` can pick it up automatically.
95
+
96
+ ### Added
97
+
98
+ - **89 new tests** (507 total, 0 failures) covering:
99
+ - GraphQL decorator metadata pipeline end-to-end
100
+ - `app.include()` + `resolvers: []` option merge
101
+ - `PermissionPlugin` construction, `PermissionManager` unit logic, management route auth guards
102
+ - `HealthCheckPlugin` `/health`, `/ready`, `/live` endpoints, custom check logic, `HealthCheckers` factory
103
+ - `OAuthPlugin` route behavior, `BaseOAuthProvider`/`GoogleOAuthProvider`/`GitHubOAuthProvider`, `OAuthStateManager`, `PKCEUtils`
104
+ - Logger (`createLogger`, `getLogger`, `initializeLogger`, `createChildLogger`, child context propagation)
105
+
10
106
  ## [1.0.0] - 2026-06-26
11
107
 
12
108
  First stable release. Establishes a frozen public API with semver guarantees going forward.
@@ -830,22 +926,22 @@ This release brings powerful performance optimization features to Veloce-TS:
830
926
  - CLI tooling
831
927
  - Testing utilities
832
928
 
833
- [Unreleased]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v1.0.0...HEAD
834
- [1.0.0]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.4.18...v1.0.0
835
- [0.4.18]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.4.10...v0.4.18
836
- [0.4.10]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.4.9...v0.4.10
837
- [0.4.0]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.3.3...v0.4.0
838
- [0.3.3]: https://github.com/AlfredoMejia3001/veloce-ts/releases/tag/v0.3.3
839
- [0.3.2]: https://github.com/AlfredoMejia3001/veloce-ts/releases/tag/v0.3.2
840
- [0.3.1]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.3.0...v0.3.1
841
- [0.2.2]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.2.1...v0.2.2
842
- [0.2.1]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.2.0...v0.2.1
843
- [0.2.0]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.7...v0.2.0
844
- [0.1.7]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.6...v0.1.7
845
- [0.1.6]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.5...v0.1.6
846
- [0.1.5]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.4...v0.1.5
847
- [0.1.4]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.3...v0.1.4
848
- [0.1.3]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.2...v0.1.3
849
- [0.1.2]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.1...v0.1.2
850
- [0.1.1]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.0...v0.1.1
851
- [0.1.0]: https://github.com/AlfredoMejia3001/veloce-ts/releases/tag/v0.1.0
929
+ [Unreleased]: https://github.com/ExcessHawk/veloce-ts/compare/v1.0.0...HEAD
930
+ [1.0.0]: https://github.com/ExcessHawk/veloce-ts/compare/v0.4.18...v1.0.0
931
+ [0.4.18]: https://github.com/ExcessHawk/veloce-ts/compare/v0.4.10...v0.4.18
932
+ [0.4.10]: https://github.com/ExcessHawk/veloce-ts/compare/v0.4.9...v0.4.10
933
+ [0.4.0]: https://github.com/ExcessHawk/veloce-ts/compare/v0.3.3...v0.4.0
934
+ [0.3.3]: https://github.com/ExcessHawk/veloce-ts/releases/tag/v0.3.3
935
+ [0.3.2]: https://github.com/ExcessHawk/veloce-ts/releases/tag/v0.3.2
936
+ [0.3.1]: https://github.com/ExcessHawk/veloce-ts/compare/v0.3.0...v0.3.1
937
+ [0.2.2]: https://github.com/ExcessHawk/veloce-ts/compare/v0.2.1...v0.2.2
938
+ [0.2.1]: https://github.com/ExcessHawk/veloce-ts/compare/v0.2.0...v0.2.1
939
+ [0.2.0]: https://github.com/ExcessHawk/veloce-ts/compare/v0.1.7...v0.2.0
940
+ [0.1.7]: https://github.com/ExcessHawk/veloce-ts/compare/v0.1.6...v0.1.7
941
+ [0.1.6]: https://github.com/ExcessHawk/veloce-ts/compare/v0.1.5...v0.1.6
942
+ [0.1.5]: https://github.com/ExcessHawk/veloce-ts/compare/v0.1.4...v0.1.5
943
+ [0.1.4]: https://github.com/ExcessHawk/veloce-ts/compare/v0.1.3...v0.1.4
944
+ [0.1.3]: https://github.com/ExcessHawk/veloce-ts/compare/v0.1.2...v0.1.3
945
+ [0.1.2]: https://github.com/ExcessHawk/veloce-ts/compare/v0.1.1...v0.1.2
946
+ [0.1.1]: https://github.com/ExcessHawk/veloce-ts/compare/v0.1.0...v0.1.1
947
+ [0.1.0]: https://github.com/ExcessHawk/veloce-ts/releases/tag/v0.1.0
package/README.md CHANGED
@@ -14,7 +14,7 @@
14
14
  [![Bun](https://img.shields.io/badge/Bun-1.0+-black.svg)](https://bun.sh/)
15
15
  [![Documentation](https://img.shields.io/badge/docs-online-brightgreen.svg)](https://docs.veloce-ts.com)
16
16
 
17
- [Documentation](https://docs.veloce-ts.com) • [Examples](https://docs.veloce-ts.com/guides/getting-started) • [API Reference](https://docs.veloce-ts.com/reference/api-reference)
17
+ [Documentation](https://docs.veloce-ts.com) • [Examples](https://docs.veloce-ts.com/en/guides/getting-started) • [API Reference](https://docs.veloce-ts.com/en/reference/api-reference)
18
18
 
19
19
  ---
20
20
 
@@ -243,7 +243,7 @@ app.listen(3000);
243
243
  <summary><b>WebSocket Support</b></summary>
244
244
 
245
245
  ```typescript
246
- import { WebSocket, OnConnect, OnMessage, OnDisconnect } from 'veloce-ts';
246
+ import { WebSocket, OnConnect, OnMessage, OnDisconnect, WebSocketConnection } from 'veloce-ts';
247
247
  import { z } from 'zod';
248
248
 
249
249
  const MessageSchema = z.object({
@@ -496,11 +496,32 @@ app.usePlugin(new OpenAPIPlugin({
496
496
  docsPath: '/docs',
497
497
  }));
498
498
 
499
- // GraphQL support
499
+ // GraphQL support — pass resolver classes via the resolvers option
500
+ import { Resolver, GQLQuery, GQLMutation, Arg } from 'veloce-ts/graphql';
501
+ import { z } from 'zod';
502
+
503
+ @Resolver('user')
504
+ class UserResolver {
505
+ @GQLQuery('getUser')
506
+ async getUser(@Arg('id', z.string()) id: string) {
507
+ return { id, name: 'Alice' };
508
+ }
509
+
510
+ @GQLMutation('createUser')
511
+ async createUser(@Arg('name', z.string()) name: string) {
512
+ return { id: '1', name };
513
+ }
514
+ }
515
+
500
516
  app.usePlugin(new GraphQLPlugin({
501
517
  path: '/graphql',
502
518
  playground: true,
519
+ resolvers: [UserResolver], // pass all @Resolver classes here
503
520
  }));
521
+
522
+ // Alternatively, register via app.include() before usePlugin():
523
+ // app.include(UserResolver);
524
+ // app.usePlugin(new GraphQLPlugin({ playground: true }));
504
525
  ```
505
526
 
506
527
  ## 🌐 Multi-Runtime Support
@@ -543,16 +564,16 @@ Directional priorities—not a release calendar. Items may ship in a different o
543
564
 
544
565
  **Completed in v0.4.18:** Security audit of auth routes, JWT blacklist correctness, MetadataCompiler cache isolation fix, ORM lazy-loading for optional peer deps, 375-test suite, internal micro-benchmarks.
545
566
 
546
- For the latest shipped changes, see [CHANGELOG](CHANGELOG.md). Discussion and proposals: [GitHub Discussions](https://github.com/AlfredoMejia3001/veloce-ts/discussions).
567
+ For the latest shipped changes, see [CHANGELOG](CHANGELOG.md). Discussion and proposals: [GitHub Discussions](https://github.com/ExcessHawk/veloce-ts/discussions).
547
568
 
548
569
  ## 📖 Documentation
549
570
 
550
571
  | Resource | Description |
551
572
  |----------|-------------|
552
573
  | [📚 Full Documentation](https://docs.veloce-ts.com) | Complete guides and API reference |
553
- | [⚠️ Limitations & roadmap](https://docs.veloce-ts.com/guides/limitations-and-roadmap/) | Known gaps and planned direction |
554
- | [💡 Examples & Guides](https://docs.veloce-ts.com/guides/getting-started) | Tutorials and code examples |
555
- | [🔧 API Reference](https://docs.veloce-ts.com/reference/api-reference) | Detailed API documentation |
574
+ | [⚠️ Limitations & roadmap](https://docs.veloce-ts.com/en/guides/limitations-and-roadmap/) | Known gaps and planned direction |
575
+ | [💡 Examples & Guides](https://docs.veloce-ts.com/en/guides/getting-started) | Tutorials and code examples |
576
+ | [🔧 API Reference](https://docs.veloce-ts.com/en/reference/api-reference) | Detailed API documentation |
556
577
 
557
578
  ## ⚙️ Requirements
558
579
 
@@ -587,7 +608,7 @@ For the latest shipped changes, see [CHANGELOG](CHANGELOG.md). Discussion and pr
587
608
  - 🔌 Plugin system and extensibility
588
609
 
589
610
  ### Alfredo Mejia - Project Founder
590
- **[@AlfredoMejia3001](https://github.com/AlfredoMejia3001)** - Project founder and maintainer
611
+ **[@ExcessHawk](https://github.com/ExcessHawk)** - Project founder and maintainer
591
612
 
592
613
  ---
593
614
 
@@ -610,7 +631,7 @@ Built with ❤️ using:
610
631
 
611
632
  <div align="center">
612
633
 
613
- **[⭐ Star us on GitHub](https://github.com/AlfredoMejia3001/veloce-ts)** • **[📖 Read the Docs](https://docs.veloce-ts.com)** • **[💬 Join Discussions](https://github.com/AlfredoMejia3001/veloce-ts/discussions)**
634
+ **[⭐ Star us on GitHub](https://github.com/ExcessHawk/veloce-ts)** • **[📖 Read the Docs](https://docs.veloce-ts.com)** • **[💬 Join Discussions](https://github.com/ExcessHawk/veloce-ts/discussions)**
614
635
 
615
636
  Made with ⚡ by the Veloce team
616
637