@veloxts/cli 0.6.90 → 0.6.92
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.92
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat(storage): add provider factories, lifecycle hooks, and presigned uploads
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @veloxts/auth@0.6.92
|
|
10
|
+
- @veloxts/core@0.6.92
|
|
11
|
+
- @veloxts/orm@0.6.92
|
|
12
|
+
- @veloxts/router@0.6.92
|
|
13
|
+
- @veloxts/validation@0.6.92
|
|
14
|
+
|
|
15
|
+
## 0.6.91
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- removed unused DI system
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
- @veloxts/auth@0.6.91
|
|
22
|
+
- @veloxts/core@0.6.91
|
|
23
|
+
- @veloxts/orm@0.6.91
|
|
24
|
+
- @veloxts/router@0.6.91
|
|
25
|
+
- @veloxts/validation@0.6.91
|
|
26
|
+
|
|
3
27
|
## 0.6.90
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -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
|
/**
|
|
@@ -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
|
-
${
|
|
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
|
-
|
|
157
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
490
|
-
|
|
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.
|
|
3
|
+
"version": "0.6.92",
|
|
4
4
|
"description": "Developer tooling and CLI commands for VeloxTS framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"pluralize": "8.0.0",
|
|
42
42
|
"tsx": "4.21.0",
|
|
43
43
|
"yaml": "2.8.2",
|
|
44
|
-
"@veloxts/
|
|
45
|
-
"@veloxts/
|
|
46
|
-
"@veloxts/router": "0.6.
|
|
47
|
-
"@veloxts/
|
|
48
|
-
"@veloxts/
|
|
44
|
+
"@veloxts/core": "0.6.92",
|
|
45
|
+
"@veloxts/validation": "0.6.92",
|
|
46
|
+
"@veloxts/router": "0.6.92",
|
|
47
|
+
"@veloxts/orm": "0.6.92",
|
|
48
|
+
"@veloxts/auth": "0.6.92"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@prisma/client": ">=7.0.0"
|