@veloxts/core 0.6.89 → 0.6.91

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @veloxts/core
2
2
 
3
+ ## 0.6.91
4
+
5
+ ### Patch Changes
6
+
7
+ - removed unused DI system
8
+
9
+ ## 0.6.90
10
+
11
+ ### Patch Changes
12
+
13
+ - Dependencies updates – fix critical and high severity vulnerabilities
14
+
3
15
  ## 0.6.89
4
16
 
5
17
  ### Patch Changes
@@ -121,7 +133,6 @@
121
133
  - ### feat(auth): Unified Adapter-Only Architecture
122
134
 
123
135
  **New Features:**
124
-
125
136
  - Add `JwtAdapter` implementing the `AuthAdapter` interface for unified JWT authentication
126
137
  - Add `jwtAuth()` convenience function for direct adapter usage with optional built-in routes (`/api/auth/refresh`, `/api/auth/logout`)
127
138
  - Add `AuthContext` discriminated union (`NativeAuthContext | AdapterAuthContext`) for type-safe auth mode handling
@@ -129,24 +140,20 @@
129
140
  - Add shared decoration utilities (`decorateAuth`, `setRequestAuth`, `checkDoubleRegistration`)
130
141
 
131
142
  **Architecture Changes:**
132
-
133
143
  - `authPlugin` now uses `JwtAdapter` internally - all authentication flows through the adapter pattern
134
144
  - Single code path for authentication (no more dual native/adapter modes)
135
145
  - `authContext.authMode` is now always `'adapter'` with `providerId='jwt'` when using `authPlugin`
136
146
 
137
147
  **Breaking Changes:**
138
-
139
148
  - Remove deprecated `LegacySessionConfig` interface (use `sessionMiddleware` instead)
140
149
  - Remove deprecated `session` field from `AuthConfig`
141
150
  - `User` interface no longer has index signature (extend via declaration merging)
142
151
 
143
152
  **Type Safety Improvements:**
144
-
145
153
  - `AuthContext` discriminated union enables exhaustive type narrowing based on `authMode`
146
154
  - Export `NativeAuthContext` and `AdapterAuthContext` types for explicit typing
147
155
 
148
156
  **Migration:**
149
-
150
157
  - Existing `authPlugin` usage remains backward-compatible
151
158
  - If checking `authContext.token`, use `authContext.session` instead (token stored in session for adapter mode)
152
159
 
@@ -161,12 +168,10 @@
161
168
  Addresses 9 user feedback items to improve DX, reduce boilerplate, and eliminate template duplications.
162
169
 
163
170
  ### Phase 1: Validation Helpers (`@veloxts/validation`)
164
-
165
171
  - Add `prismaDecimal()`, `prismaDecimalNullable()`, `prismaDecimalOptional()` for Prisma Decimal → number conversion
166
172
  - Add `dateToIso`, `dateToIsoNullable`, `dateToIsoOptional` aliases for consistency
167
173
 
168
174
  ### Phase 2: Template Deduplication (`@veloxts/auth`)
169
-
170
175
  - Export `createEnhancedTokenStore()` with token revocation and refresh token reuse detection
171
176
  - Export `parseUserRoles()` and `DEFAULT_ALLOWED_ROLES`
172
177
  - Fix memory leak: track pending timeouts for proper cleanup on `destroy()`
@@ -174,20 +179,17 @@
174
179
  - Fix jwtManager singleton pattern in templates
175
180
 
176
181
  ### Phase 3: Router Helpers (`@veloxts/router`)
177
-
178
182
  - Add `createRouter()` returning `{ collections, router }` for DRY setup
179
183
  - Add `toRouter()` for router-only use cases
180
184
  - Update all router templates to use `createRouter()`
181
185
 
182
186
  ### Phase 4: Guard Type Narrowing - Experimental (`@veloxts/auth`, `@veloxts/router`)
183
-
184
187
  - Add `NarrowingGuard` interface with phantom `_narrows` type
185
188
  - Add `authenticatedNarrow` and `hasRoleNarrow()` guards
186
189
  - Add `guardNarrow()` method to `ProcedureBuilder` for context narrowing
187
190
  - Enables `ctx.user` to be non-null after guard passes
188
191
 
189
192
  ### Phase 5: Documentation (`@veloxts/router`)
190
-
191
193
  - Document `.rest()` override patterns
192
194
  - Document `createRouter()` helper usage
193
195
  - Document `guardNarrow()` experimental API
@@ -794,7 +796,6 @@
794
796
  ### Patch Changes
795
797
 
796
798
  - Fix Prisma client generation in scaffolder
797
-
798
799
  - Added automatic Prisma client generation after dependency installation in create-velox-app
799
800
  - Fixed database template to validate DATABASE_URL environment variable
800
801
  - Added alpha release warning to all package READMEs
package/GUIDE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @veloxts/core
2
2
 
3
- Core foundation for VeloxTS Framework providing application bootstrap, plugin system, and dependency injection.
3
+ Core foundation for VeloxTS Framework providing application bootstrap, plugin system, and error handling.
4
4
 
5
5
  ## Installation
6
6
 
@@ -76,54 +76,6 @@ declare module '@veloxts/core' {
76
76
  // Now ctx.db is available with full type safety
77
77
  ```
78
78
 
79
- ## Dependency Injection
80
-
81
- VeloxTS provides a powerful DI container for managing service dependencies:
82
-
83
- ```typescript
84
- import { Injectable, Inject, Scope, singleton, scoped } from '@veloxts/core';
85
-
86
- @Injectable()
87
- class UserService {
88
- constructor(private db: PrismaClient) {}
89
-
90
- async getUser(id: string) {
91
- return this.db.user.findUniqueOrThrow({ where: { id } });
92
- }
93
- }
94
-
95
- // Register services
96
- app.container.register(singleton(UserService));
97
-
98
- // Resolve in procedures
99
- const userService = app.container.resolve(UserService);
100
- ```
101
-
102
- ### Lifecycle Scopes
103
-
104
- - `Scope.SINGLETON` - One instance for entire application
105
- - `Scope.REQUEST` - One instance per HTTP request
106
- - `Scope.TRANSIENT` - New instance every time
107
-
108
- ### Succinct Helpers
109
-
110
- ```typescript
111
- import { singleton, scoped, transient, value, factory } from '@veloxts/core';
112
-
113
- // Class services
114
- app.container.register(singleton(ConfigService));
115
- app.container.register(scoped(UserContext));
116
- app.container.register(transient(RequestLogger));
117
-
118
- // Values
119
- app.container.register(value(CONFIG, { port: 3030 }));
120
-
121
- // Factories
122
- app.container.register(
123
- factory(DATABASE, (config) => new PrismaClient({ url: config.dbUrl }), [ConfigService])
124
- );
125
- ```
126
-
127
79
  ## Error Handling
128
80
 
129
81
  Use structured error classes for consistent API responses:
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **Early Preview (v0.6.x)** - APIs are stabilizing but may still change. Do not use in production yet.
4
4
 
5
- Core foundation package for VeloxTS Framework - provides the Fastify wrapper, plugin system, dependency injection container, and base context. Learn more at [@veloxts/velox](https://www.npmjs.com/package/@veloxts/velox).
5
+ Core foundation package for VeloxTS Framework - provides the Fastify wrapper, plugin system, error handling, and base context. Learn more at [@veloxts/velox](https://www.npmjs.com/package/@veloxts/velox).
6
6
 
7
7
  ## License
8
8
 
package/dist/app.d.ts CHANGED
@@ -4,7 +4,6 @@
4
4
  * @module app
5
5
  */
6
6
  import { type FastifyInstance, type FastifyPluginAsync } from 'fastify';
7
- import { type Container } from './di/index.js';
8
7
  import type { PluginOptions, VeloxPlugin } from './plugin.js';
9
8
  import type { StaticOptions } from './plugins/static.js';
10
9
  import type { ShutdownHandler } from './types.js';
@@ -40,7 +39,6 @@ export declare class VeloxApp {
40
39
  private readonly _server;
41
40
  private readonly _config;
42
41
  private readonly _lifecycle;
43
- private readonly _container;
44
42
  private _isRunning;
45
43
  private _address;
46
44
  /**
@@ -72,36 +70,6 @@ export declare class VeloxApp {
72
70
  * Application configuration (readonly, frozen)
73
71
  */
74
72
  get config(): FrozenVeloxAppConfig;
75
- /**
76
- * DI container for the application
77
- *
78
- * Provides access to the dependency injection container.
79
- * Use this to register services and resolve dependencies.
80
- *
81
- * @example
82
- * ```typescript
83
- * import { Injectable, createStringToken } from '@veloxts/core';
84
- *
85
- * const DATABASE = createStringToken<DatabaseClient>('DATABASE');
86
- *
87
- * @Injectable()
88
- * class UserService {
89
- * constructor(@Inject(DATABASE) private db: DatabaseClient) {}
90
- * }
91
- *
92
- * // Register services
93
- * app.container.register({
94
- * provide: DATABASE,
95
- * useFactory: () => createDatabaseClient()
96
- * });
97
- *
98
- * app.container.register({
99
- * provide: UserService,
100
- * useClass: UserService
101
- * });
102
- * ```
103
- */
104
- get container(): Container;
105
73
  /**
106
74
  * Check if server is currently running
107
75
  */
package/dist/app.js CHANGED
@@ -6,7 +6,6 @@
6
6
  import fastify from 'fastify';
7
7
  import fp from 'fastify-plugin';
8
8
  import { setupContextHook } from './context.js';
9
- import { container } from './di/index.js';
10
9
  import { isVeloxError, VeloxError } from './errors.js';
11
10
  import { isFastifyPlugin, isVeloxPlugin, validatePluginMetadata } from './plugin.js';
12
11
  import { requestLogger } from './plugins/request-logger.js';
@@ -38,7 +37,6 @@ export class VeloxApp {
38
37
  _server;
39
38
  _config;
40
39
  _lifecycle;
41
- _container;
42
40
  _isRunning = false;
43
41
  _address = null;
44
42
  /**
@@ -60,10 +58,6 @@ export class VeloxApp {
60
58
  this._server = fastify(fastifyOptions);
61
59
  // Initialize lifecycle manager
62
60
  this._lifecycle = new LifecycleManager();
63
- // Use global container by default
64
- this._container = container;
65
- // Attach container to Fastify for request-scoped services
66
- this._container.attachToFastify(this._server);
67
61
  // Set up context decorator
68
62
  this._setupContext();
69
63
  // Set up error handling
@@ -101,38 +95,6 @@ export class VeloxApp {
101
95
  get config() {
102
96
  return this._config;
103
97
  }
104
- /**
105
- * DI container for the application
106
- *
107
- * Provides access to the dependency injection container.
108
- * Use this to register services and resolve dependencies.
109
- *
110
- * @example
111
- * ```typescript
112
- * import { Injectable, createStringToken } from '@veloxts/core';
113
- *
114
- * const DATABASE = createStringToken<DatabaseClient>('DATABASE');
115
- *
116
- * @Injectable()
117
- * class UserService {
118
- * constructor(@Inject(DATABASE) private db: DatabaseClient) {}
119
- * }
120
- *
121
- * // Register services
122
- * app.container.register({
123
- * provide: DATABASE,
124
- * useFactory: () => createDatabaseClient()
125
- * });
126
- *
127
- * app.container.register({
128
- * provide: UserService,
129
- * useClass: UserService
130
- * });
131
- * ```
132
- */
133
- get container() {
134
- return this._container;
135
- }
136
98
  /**
137
99
  * Check if server is currently running
138
100
  */
package/dist/index.d.ts CHANGED
@@ -1,13 +1,12 @@
1
1
  /**
2
2
  * @veloxts/core - Foundation package for the VeloxTS framework
3
3
  *
4
- * Provides the core Fastify wrapper, plugin system, base context,
5
- * and dependency injection container that all other framework
6
- * packages build upon.
4
+ * Provides the core Fastify wrapper, plugin system, and base context
5
+ * that all other framework packages build upon.
7
6
  *
8
7
  * @example
9
8
  * ```typescript
10
- * import { velox, definePlugin, Container, Injectable } from '@veloxts/core';
9
+ * import { velox, definePlugin } from '@veloxts/core';
11
10
  *
12
11
  * const app = await velox({ port: 3030 });
13
12
  * await app.start();
@@ -15,7 +14,6 @@
15
14
  *
16
15
  * @module @veloxts/core
17
16
  */
18
- import 'reflect-metadata';
19
17
  /** VeloxTS framework version */
20
18
  export declare const VELOX_VERSION: string;
21
19
  export type { FastifyLoggerOptions, FastifyReply, FastifyRequest } from 'fastify';
@@ -23,8 +21,6 @@ export type { StartOptions } from './app.js';
23
21
  export { VeloxApp, velox, veloxApp } from './app.js';
24
22
  export type { BaseContext } from './context.js';
25
23
  export { createContext, isContext, setupContextHook, setupTestContext } from './context.js';
26
- export type { AbstractClass, ClassConstructor, ClassProvider, ContainerOptions, ExistingProvider, FactoryProvider, InjectableOptions, InjectionToken, Provider, ResolutionContext, StringToken, SymbolToken, TokenType, ValueProvider, } from './di/index.js';
27
- export { asClass, asExisting, asFactory, asValue, Container, container, factory, getConstructorTokens, getExplicitInjectTokens, getInjectableScope, getOptionalParams, getTokenName, Inject, Injectable, isClassProvider, isClassToken, isExistingProvider, isFactoryProvider, isInjectable, isStringToken, isSymbolToken, isValueProvider, makeInjectable, Optional, Scope, ScopeManager, scoped, setInjectTokens, singleton, token, transient, validateProvider, validateToken, value, } from './di/index.js';
28
24
  export type { ErrorCode, ErrorResponse, GenericErrorResponse, InterpolationVars, NotFoundErrorResponse, ValidationErrorResponse, VeloxCoreErrorCode, VeloxErrorCode, VeloxErrorCodeRegistry, } from './errors.js';
29
25
  export { assertNever, ConfigurationError, fail, isConfigurationError, isNotFoundError, isNotFoundErrorResponse, isValidationError, isValidationErrorResponse, isVeloxError, isVeloxFailure, logDeprecation, logWarning, NotFoundError, ValidationError, VeloxError, VeloxFailure, } from './errors.js';
30
26
  export type { InferPluginOptions, PluginMetadata, PluginOptions, VeloxPlugin } from './plugin.js';
package/dist/index.js CHANGED
@@ -1,13 +1,12 @@
1
1
  /**
2
2
  * @veloxts/core - Foundation package for the VeloxTS framework
3
3
  *
4
- * Provides the core Fastify wrapper, plugin system, base context,
5
- * and dependency injection container that all other framework
6
- * packages build upon.
4
+ * Provides the core Fastify wrapper, plugin system, and base context
5
+ * that all other framework packages build upon.
7
6
  *
8
7
  * @example
9
8
  * ```typescript
10
- * import { velox, definePlugin, Container, Injectable } from '@veloxts/core';
9
+ * import { velox, definePlugin } from '@veloxts/core';
11
10
  *
12
11
  * const app = await velox({ port: 3030 });
13
12
  * await app.start();
@@ -15,8 +14,6 @@
15
14
  *
16
15
  * @module @veloxts/core
17
16
  */
18
- // Import reflect-metadata for decorator support
19
- import 'reflect-metadata';
20
17
  import { createRequire } from 'node:module';
21
18
  // Read version from package.json dynamically
22
19
  const require = createRequire(import.meta.url);
@@ -25,8 +22,6 @@ const packageJson = require('../package.json');
25
22
  export const VELOX_VERSION = packageJson.version ?? '0.0.0-unknown';
26
23
  export { VeloxApp, velox, veloxApp } from './app.js';
27
24
  export { createContext, isContext, setupContextHook, setupTestContext } from './context.js';
28
- // Dependency Injection
29
- export { asClass, asExisting, asFactory, asValue, Container, container, factory, getConstructorTokens, getExplicitInjectTokens, getInjectableScope, getOptionalParams, getTokenName, Inject, Injectable, isClassProvider, isClassToken, isExistingProvider, isFactoryProvider, isInjectable, isStringToken, isSymbolToken, isValueProvider, makeInjectable, Optional, Scope, ScopeManager, scoped, setInjectTokens, singleton, token, transient, validateProvider, validateToken, value, } from './di/index.js';
30
25
  export { assertNever, ConfigurationError,
31
26
  // Elegant error creation API
32
27
  fail, isConfigurationError, isNotFoundError, isNotFoundErrorResponse, isValidationError, isValidationErrorResponse, isVeloxError, isVeloxFailure,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@veloxts/core",
3
- "version": "0.6.89",
4
- "description": "Fastify wrapper, DI container, and plugin system for VeloxTS framework",
3
+ "version": "0.6.91",
4
+ "description": "Fastify wrapper and plugin system for VeloxTS framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -9,10 +9,6 @@
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
11
  "import": "./dist/index.js"
12
- },
13
- "./di": {
14
- "types": "./dist/di/index.d.ts",
15
- "import": "./dist/di/index.js"
16
12
  }
17
13
  },
18
14
  "files": [
@@ -33,10 +29,9 @@
33
29
  }
34
30
  },
35
31
  "dependencies": {
36
- "fastify": "5.6.2",
32
+ "fastify": "5.7.2",
37
33
  "fastify-plugin": "5.1.0",
38
- "picocolors": "1.1.1",
39
- "reflect-metadata": "0.2.2"
34
+ "picocolors": "1.1.1"
40
35
  },
41
36
  "peerDependencies": {
42
37
  "@fastify/static": ">=8.0.0"
@@ -47,11 +42,11 @@
47
42
  }
48
43
  },
49
44
  "devDependencies": {
50
- "@fastify/static": "8.3.0",
51
- "@types/node": "25.0.3",
52
- "@vitest/coverage-v8": "4.0.16",
45
+ "@fastify/static": "9.0.0",
46
+ "@types/node": "25.1.0",
47
+ "@vitest/coverage-v8": "4.0.18",
53
48
  "typescript": "5.9.3",
54
- "vitest": "4.0.16"
49
+ "vitest": "4.0.18"
55
50
  },
56
51
  "keywords": [
57
52
  "velox",