@veloxts/cli 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,29 @@
1
1
  # @veloxts/cli
2
2
 
3
+ ## 0.6.91
4
+
5
+ ### Patch Changes
6
+
7
+ - removed unused DI system
8
+ - Updated dependencies
9
+ - @veloxts/auth@0.6.91
10
+ - @veloxts/core@0.6.91
11
+ - @veloxts/orm@0.6.91
12
+ - @veloxts/router@0.6.91
13
+ - @veloxts/validation@0.6.91
14
+
15
+ ## 0.6.90
16
+
17
+ ### Patch Changes
18
+
19
+ - Dependencies updates – fix critical and high severity vulnerabilities
20
+ - Updated dependencies
21
+ - @veloxts/auth@0.6.90
22
+ - @veloxts/core@0.6.90
23
+ - @veloxts/orm@0.6.90
24
+ - @veloxts/router@0.6.90
25
+ - @veloxts/validation@0.6.90
26
+
3
27
  ## 0.6.89
4
28
 
5
29
  ### Patch Changes
@@ -235,7 +259,6 @@
235
259
  - ### feat(auth): Unified Adapter-Only Architecture
236
260
 
237
261
  **New Features:**
238
-
239
262
  - Add `JwtAdapter` implementing the `AuthAdapter` interface for unified JWT authentication
240
263
  - Add `jwtAuth()` convenience function for direct adapter usage with optional built-in routes (`/api/auth/refresh`, `/api/auth/logout`)
241
264
  - Add `AuthContext` discriminated union (`NativeAuthContext | AdapterAuthContext`) for type-safe auth mode handling
@@ -243,24 +266,20 @@
243
266
  - Add shared decoration utilities (`decorateAuth`, `setRequestAuth`, `checkDoubleRegistration`)
244
267
 
245
268
  **Architecture Changes:**
246
-
247
269
  - `authPlugin` now uses `JwtAdapter` internally - all authentication flows through the adapter pattern
248
270
  - Single code path for authentication (no more dual native/adapter modes)
249
271
  - `authContext.authMode` is now always `'adapter'` with `providerId='jwt'` when using `authPlugin`
250
272
 
251
273
  **Breaking Changes:**
252
-
253
274
  - Remove deprecated `LegacySessionConfig` interface (use `sessionMiddleware` instead)
254
275
  - Remove deprecated `session` field from `AuthConfig`
255
276
  - `User` interface no longer has index signature (extend via declaration merging)
256
277
 
257
278
  **Type Safety Improvements:**
258
-
259
279
  - `AuthContext` discriminated union enables exhaustive type narrowing based on `authMode`
260
280
  - Export `NativeAuthContext` and `AdapterAuthContext` types for explicit typing
261
281
 
262
282
  **Migration:**
263
-
264
283
  - Existing `authPlugin` usage remains backward-compatible
265
284
  - If checking `authContext.token`, use `authContext.session` instead (token stored in session for adapter mode)
266
285
 
@@ -282,12 +301,10 @@
282
301
  Addresses 9 user feedback items to improve DX, reduce boilerplate, and eliminate template duplications.
283
302
 
284
303
  ### Phase 1: Validation Helpers (`@veloxts/validation`)
285
-
286
304
  - Add `prismaDecimal()`, `prismaDecimalNullable()`, `prismaDecimalOptional()` for Prisma Decimal → number conversion
287
305
  - Add `dateToIso`, `dateToIsoNullable`, `dateToIsoOptional` aliases for consistency
288
306
 
289
307
  ### Phase 2: Template Deduplication (`@veloxts/auth`)
290
-
291
308
  - Export `createEnhancedTokenStore()` with token revocation and refresh token reuse detection
292
309
  - Export `parseUserRoles()` and `DEFAULT_ALLOWED_ROLES`
293
310
  - Fix memory leak: track pending timeouts for proper cleanup on `destroy()`
@@ -295,20 +312,17 @@
295
312
  - Fix jwtManager singleton pattern in templates
296
313
 
297
314
  ### Phase 3: Router Helpers (`@veloxts/router`)
298
-
299
315
  - Add `createRouter()` returning `{ collections, router }` for DRY setup
300
316
  - Add `toRouter()` for router-only use cases
301
317
  - Update all router templates to use `createRouter()`
302
318
 
303
319
  ### Phase 4: Guard Type Narrowing - Experimental (`@veloxts/auth`, `@veloxts/router`)
304
-
305
320
  - Add `NarrowingGuard` interface with phantom `_narrows` type
306
321
  - Add `authenticatedNarrow` and `hasRoleNarrow()` guards
307
322
  - Add `guardNarrow()` method to `ProcedureBuilder` for context narrowing
308
323
  - Enables `ctx.user` to be non-null after guard passes
309
324
 
310
325
  ### Phase 5: Documentation (`@veloxts/router`)
311
-
312
326
  - Document `.rest()` override patterns
313
327
  - Document `createRouter()` helper usage
314
328
  - Document `guardNarrow()` experimental API
@@ -1533,7 +1547,6 @@
1533
1547
  ### Patch Changes
1534
1548
 
1535
1549
  - Fix Prisma client generation in scaffolder
1536
-
1537
1550
  - Added automatic Prisma client generation after dependency installation in create-velox-app
1538
1551
  - Fixed database template to validate DATABASE_URL environment variable
1539
1552
  - Added alpha release warning to all package READMEs
@@ -125,6 +125,8 @@ async function collectSingleField(existingNames, fieldNumber, prefill) {
125
125
  placeholder: 'e.g., title, authorId, isPublished',
126
126
  initialValue: prefill?.name ?? '',
127
127
  validate: (value) => {
128
+ if (!value)
129
+ return 'Field name is required';
128
130
  const trimmed = value.trim();
129
131
  const error = validateFieldName(trimmed);
130
132
  if (error)
@@ -262,7 +264,7 @@ async function collectDefaultValue(fieldType, prefill) {
262
264
  placeholder,
263
265
  initialValue: prefill ?? '',
264
266
  validate: (value) => {
265
- if (!value.trim())
267
+ if (!value || !value.trim())
266
268
  return 'Default value is required';
267
269
  return validateDefaultValue(fieldType, value.trim());
268
270
  },
@@ -316,7 +318,7 @@ async function collectEnumDefinition(fieldName, prefill) {
316
318
  message: 'Enum type name (PascalCase)',
317
319
  placeholder: suggestedName,
318
320
  initialValue: prefill?.name ?? suggestedName,
319
- validate: validateEnumName,
321
+ validate: (value) => (value ? validateEnumName(value) : 'Enum name is required'),
320
322
  });
321
323
  if (p.isCancel(nameResult)) {
322
324
  return { enumDef: undefined, cancelled: true };
@@ -327,6 +329,8 @@ async function collectEnumDefinition(fieldName, prefill) {
327
329
  placeholder: 'e.g., draft, published, archived',
328
330
  initialValue: prefill?.values?.join(', ') ?? '',
329
331
  validate: (value) => {
332
+ if (!value)
333
+ return 'At least one enum value is required';
330
334
  const parsed = parseEnumValues(value);
331
335
  return validateEnumValues(parsed);
332
336
  },
@@ -11,7 +11,6 @@
11
11
  * velox make service user --crud # CRUD service with Prisma
12
12
  * velox make service order --events # Service with event emission
13
13
  * velox make service cache --cache # Service with caching
14
- * velox make service auth --inject # Injectable service (DI)
15
14
  */
16
15
  import { BaseGenerator } from '../base.js';
17
16
  import { type ServiceOptions } from '../templates/service.js';
@@ -11,7 +11,6 @@
11
11
  * velox make service user --crud # CRUD service with Prisma
12
12
  * velox make service order --events # Service with event emission
13
13
  * velox make service cache --cache # Service with caching
14
- * velox make service auth --inject # Injectable service (DI)
15
14
  */
16
15
  import { BaseGenerator } from '../base.js';
17
16
  import { getServiceInstructions, getServicePath, serviceTemplate, } from '../templates/service.js';
@@ -36,7 +35,6 @@ Examples:
36
35
  velox make service user --crud # CRUD service with Prisma
37
36
  velox make service order --events # Service with event emission
38
37
  velox make service cache --cache # Service with caching layer
39
- velox make service auth --inject # Injectable service (DI)
40
38
  `,
41
39
  aliases: ['svc', 'srv'],
42
40
  category: 'infrastructure',
@@ -63,13 +61,6 @@ Examples:
63
61
  type: 'boolean',
64
62
  default: false,
65
63
  },
66
- {
67
- name: 'inject',
68
- short: 'i',
69
- description: 'Generate injectable service for DI',
70
- type: 'boolean',
71
- default: false,
72
- },
73
64
  ];
74
65
  /**
75
66
  * Validate and transform raw options
@@ -79,7 +70,6 @@ Examples:
79
70
  crud: Boolean(raw.crud ?? false),
80
71
  cache: Boolean(raw.cache ?? false),
81
72
  events: Boolean(raw.events ?? false),
82
- injectable: Boolean(raw.inject ?? false),
83
73
  };
84
74
  }
85
75
  /**
@@ -11,8 +11,6 @@ export interface ServiceOptions {
11
11
  cache: boolean;
12
12
  /** Include event emitter */
13
13
  events: boolean;
14
- /** Generate injectable service (DI) */
15
- injectable: boolean;
16
14
  }
17
15
  /**
18
16
  * Get the path for a service file
@@ -20,16 +20,6 @@ export function getServicePath(entityName, _project) {
20
20
  */
21
21
  function generateCrudService(ctx) {
22
22
  const { entity, options } = ctx;
23
- const injectableDecorator = options.injectable
24
- ? `import { Injectable, Inject } from '@veloxts/core';
25
- import { DatabaseToken } from '@/di/tokens';
26
-
27
- @Injectable()
28
- `
29
- : '';
30
- const dbInjection = options.injectable
31
- ? ` constructor(@Inject(DatabaseToken) private readonly db: PrismaClient) {}`
32
- : ` constructor(private readonly db: PrismaClient) {}`;
33
23
  const cacheImports = options.cache
34
24
  ? `
35
25
  // Simple in-memory cache (use Redis in production)
@@ -115,7 +105,7 @@ const CACHE_TTL = 60 * 1000; // 1 minute
115
105
  */
116
106
 
117
107
  import type { PrismaClient } from '@prisma/client';
118
- ${injectableDecorator ? injectableDecorator : ''}${cacheImports}
108
+ ${cacheImports}
119
109
  // ============================================================================
120
110
  // Types
121
111
  // ============================================================================
@@ -153,8 +143,8 @@ interface List${entity.pascalPlural}Options {
153
143
  *
154
144
  * Encapsulates business logic for ${entity.humanReadable} CRUD operations.
155
145
  */
156
- ${injectableDecorator}export class ${entity.pascal}Service {
157
- ${dbInjection}
146
+ export class ${entity.pascal}Service {
147
+ constructor(private readonly db: PrismaClient) {}
158
148
 
159
149
  /**
160
150
  * Find ${entity.humanReadable} by ID
@@ -230,14 +220,7 @@ ${cacheHelpers}
230
220
  * Generate service with events
231
221
  */
232
222
  function generateEventService(ctx) {
233
- const { entity, options } = ctx;
234
- const injectableDecorator = options.injectable
235
- ? `import { Injectable, Inject } from '@veloxts/core';
236
- import { DatabaseToken } from '@/di/tokens';
237
-
238
- @Injectable()
239
- `
240
- : '';
223
+ const { entity } = ctx;
241
224
  return `/**
242
225
  * ${entity.pascal} Service
243
226
  *
@@ -246,7 +229,7 @@ import { DatabaseToken } from '@/di/tokens';
246
229
 
247
230
  import { EventEmitter } from 'node:events';
248
231
  import type { PrismaClient } from '@prisma/client';
249
- ${injectableDecorator}
232
+
250
233
  // ============================================================================
251
234
  // Types
252
235
  // ============================================================================
@@ -283,7 +266,7 @@ export type ${entity.pascal}Events = {
283
266
  /**
284
267
  * ${entity.pascal} service with event emission
285
268
  */
286
- ${injectableDecorator ? injectableDecorator : ''}export class ${entity.pascal}Service extends EventEmitter {
269
+ export class ${entity.pascal}Service extends EventEmitter {
287
270
  constructor(private readonly db: PrismaClient) {
288
271
  super();
289
272
  }
@@ -369,19 +352,13 @@ const ${entity.camel} = await service.create({ name: 'Example' });
369
352
  * Generate simple service template
370
353
  */
371
354
  function generateSimpleService(ctx) {
372
- const { entity, options } = ctx;
373
- const injectableImport = options.injectable
374
- ? `import { Injectable } from '@veloxts/core';
375
-
376
- @Injectable()
377
- `
378
- : '';
355
+ const { entity } = ctx;
379
356
  return `/**
380
357
  * ${entity.pascal} Service
381
358
  *
382
359
  * Business logic for ${entity.humanReadable} operations.
383
360
  */
384
- ${injectableImport}
361
+
385
362
  // ============================================================================
386
363
  // Types
387
364
  // ============================================================================
@@ -412,7 +389,7 @@ export interface Update${entity.pascal}Input {
412
389
  * Handles business logic for ${entity.humanReadable} operations.
413
390
  * Separate from procedures to allow reuse across different endpoints.
414
391
  */
415
- ${injectableImport ? '@Injectable()\n' : ''}export class ${entity.pascal}Service {
392
+ export class ${entity.pascal}Service {
416
393
  /**
417
394
  * Process ${entity.humanReadable} data
418
395
  *
@@ -461,7 +438,7 @@ ${injectableImport ? '@Injectable()\n' : ''}export class ${entity.pascal}Service
461
438
  /**
462
439
  * Singleton service instance
463
440
  *
464
- * Use this for simple cases without DI.
441
+ * Use this for simple cases, or instantiate manually for dependency injection.
465
442
  */
466
443
  export const ${entity.camel}Service = new ${entity.pascal}Service();
467
444
  `;
@@ -486,14 +463,8 @@ export const serviceTemplate = (ctx) => {
486
463
  // ============================================================================
487
464
  export function getServiceInstructions(entityName, options) {
488
465
  const lines = [`Your ${entityName} service has been created.`, '', 'Next steps:'];
489
- if (options.injectable) {
490
- lines.push(' 1. Register the service in your DI container');
491
- lines.push(' 2. Inject into procedures or other services');
492
- }
493
- else {
494
- lines.push(' 1. Import the service in your procedures');
495
- lines.push(` import { ${entityName}Service } from '@/services/${entityName.toLowerCase()}';`);
496
- }
466
+ lines.push(' 1. Import the service in your procedures');
467
+ lines.push(` import { ${entityName}Service } from '@/services/${entityName.toLowerCase()}';`);
497
468
  if (options.crud) {
498
469
  lines.push(' 2. Update the Prisma model name if different');
499
470
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veloxts/cli",
3
- "version": "0.6.89",
3
+ "version": "0.6.91",
4
4
  "description": "Developer tooling and CLI commands for VeloxTS framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -32,33 +32,33 @@
32
32
  }
33
33
  },
34
34
  "dependencies": {
35
- "@clack/prompts": "0.11.0",
36
- "commander": "14.0.2",
35
+ "@clack/prompts": "1.0.0",
36
+ "commander": "14.0.3",
37
37
  "dotenv": "17.2.3",
38
38
  "hot-hook": "0.4.0",
39
- "pg": "8.16.0",
39
+ "pg": "8.18.0",
40
40
  "picocolors": "1.1.1",
41
41
  "pluralize": "8.0.0",
42
42
  "tsx": "4.21.0",
43
- "yaml": "2.8.0",
44
- "@veloxts/core": "0.6.89",
45
- "@veloxts/orm": "0.6.89",
46
- "@veloxts/auth": "0.6.89",
47
- "@veloxts/router": "0.6.89",
48
- "@veloxts/validation": "0.6.89"
43
+ "yaml": "2.8.2",
44
+ "@veloxts/auth": "0.6.91",
45
+ "@veloxts/core": "0.6.91",
46
+ "@veloxts/orm": "0.6.91",
47
+ "@veloxts/router": "0.6.91",
48
+ "@veloxts/validation": "0.6.91"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@prisma/client": ">=7.0.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@prisma/client": "7.2.0",
55
- "@types/node": "25.0.3",
56
- "@types/pg": "8.15.4",
54
+ "@prisma/client": "7.3.0",
55
+ "@types/node": "25.1.0",
56
+ "@types/pg": "8.16.0",
57
57
  "@types/pluralize": "0.0.33",
58
- "@vitest/coverage-v8": "4.0.16",
58
+ "@vitest/coverage-v8": "4.0.18",
59
59
  "tsd": "0.33.0",
60
60
  "typescript": "5.9.3",
61
- "vitest": "4.0.16"
61
+ "vitest": "4.0.18"
62
62
  },
63
63
  "keywords": [
64
64
  "velox",