@veloxts/cli 0.6.31 → 0.6.52
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 +252 -0
- package/dist/cli.js +2 -0
- package/dist/commands/schedule.d.ts +14 -0
- package/dist/commands/schedule.js +324 -0
- package/dist/generators/generators/event.d.ts +35 -0
- package/dist/generators/generators/event.js +99 -0
- package/dist/generators/generators/index.d.ts +5 -0
- package/dist/generators/generators/index.js +15 -0
- package/dist/generators/generators/job.d.ts +36 -0
- package/dist/generators/generators/job.js +98 -0
- package/dist/generators/generators/mail.d.ts +36 -0
- package/dist/generators/generators/mail.js +90 -0
- package/dist/generators/generators/storage.d.ts +35 -0
- package/dist/generators/generators/storage.js +104 -0
- package/dist/generators/generators/task.d.ts +36 -0
- package/dist/generators/generators/task.js +99 -0
- package/dist/generators/templates/event.d.ts +21 -0
- package/dist/generators/templates/event.js +410 -0
- package/dist/generators/templates/job.d.ts +23 -0
- package/dist/generators/templates/job.js +352 -0
- package/dist/generators/templates/mail.d.ts +21 -0
- package/dist/generators/templates/mail.js +411 -0
- package/dist/generators/templates/storage.d.ts +23 -0
- package/dist/generators/templates/storage.js +556 -0
- package/dist/generators/templates/task.d.ts +33 -0
- package/dist/generators/templates/task.js +189 -0
- package/package.json +8 -6
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event Generator
|
|
3
|
+
*
|
|
4
|
+
* Scaffolds event-related files for VeloxTS applications.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* velox make event <name> [options]
|
|
8
|
+
*
|
|
9
|
+
* Examples:
|
|
10
|
+
* velox make event user-registered # Broadcastable event
|
|
11
|
+
* velox make event order-created --listener # Event listener
|
|
12
|
+
* velox make event notifications --channel # Channel with authorization
|
|
13
|
+
*/
|
|
14
|
+
import { BaseGenerator } from '../base.js';
|
|
15
|
+
import { eventTemplate, getEventInstructions, getEventPath, } from '../templates/event.js';
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// Generator Implementation
|
|
18
|
+
// ============================================================================
|
|
19
|
+
/**
|
|
20
|
+
* Event generator - creates event-related files
|
|
21
|
+
*/
|
|
22
|
+
export class EventGenerator extends BaseGenerator {
|
|
23
|
+
metadata = {
|
|
24
|
+
name: 'event',
|
|
25
|
+
description: 'Generate event definitions, listeners, and channels',
|
|
26
|
+
longDescription: `
|
|
27
|
+
Scaffold event-related files for VeloxTS applications using @veloxts/events.
|
|
28
|
+
|
|
29
|
+
Events enable real-time communication between backend and frontend, as well as
|
|
30
|
+
internal event-driven architecture patterns.
|
|
31
|
+
|
|
32
|
+
Variants:
|
|
33
|
+
- Broadcast (default): Event definition with WebSocket broadcasting
|
|
34
|
+
- Listener: Event handler for responding to dispatched events
|
|
35
|
+
- Channel: WebSocket channel configuration with authorization
|
|
36
|
+
|
|
37
|
+
Examples:
|
|
38
|
+
velox make event user-registered # Broadcastable event
|
|
39
|
+
velox make event order-created --listener # Event listener
|
|
40
|
+
velox make event notifications --channel # Channel with authorization
|
|
41
|
+
`,
|
|
42
|
+
aliases: ['ev', 'broadcast'],
|
|
43
|
+
category: 'infrastructure',
|
|
44
|
+
};
|
|
45
|
+
options = [
|
|
46
|
+
{
|
|
47
|
+
name: 'listener',
|
|
48
|
+
short: 'l',
|
|
49
|
+
description: 'Generate event listener/handler',
|
|
50
|
+
type: 'boolean',
|
|
51
|
+
default: false,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'channel',
|
|
55
|
+
short: 'c',
|
|
56
|
+
description: 'Generate channel configuration with authorization',
|
|
57
|
+
type: 'boolean',
|
|
58
|
+
default: false,
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
/**
|
|
62
|
+
* Validate and transform raw options
|
|
63
|
+
*/
|
|
64
|
+
validateOptions(raw) {
|
|
65
|
+
const listener = Boolean(raw.listener ?? false);
|
|
66
|
+
const channel = Boolean(raw.channel ?? false);
|
|
67
|
+
// Ensure only one variant is selected
|
|
68
|
+
if (listener && channel) {
|
|
69
|
+
throw new Error('Cannot use both --listener and --channel options. Choose one variant per generator call.');
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
listener,
|
|
73
|
+
channel,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Generate event files
|
|
78
|
+
*/
|
|
79
|
+
async generate(config) {
|
|
80
|
+
const context = this.createContext(config);
|
|
81
|
+
const files = [];
|
|
82
|
+
// Generate event file
|
|
83
|
+
const eventContent = eventTemplate(context);
|
|
84
|
+
files.push({
|
|
85
|
+
path: getEventPath(config.entityName, config.project, config.options),
|
|
86
|
+
content: eventContent,
|
|
87
|
+
});
|
|
88
|
+
return {
|
|
89
|
+
files,
|
|
90
|
+
postInstructions: getEventInstructions(config.entityName, config.options),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Factory function for creating an EventGenerator instance
|
|
96
|
+
*/
|
|
97
|
+
export function createEventGenerator() {
|
|
98
|
+
return new EventGenerator();
|
|
99
|
+
}
|
|
@@ -4,10 +4,13 @@
|
|
|
4
4
|
* Re-exports all built-in generators and provides auto-registration.
|
|
5
5
|
*/
|
|
6
6
|
export { ActionGenerator, createActionGenerator } from './action.js';
|
|
7
|
+
export { createEventGenerator, EventGenerator } from './event.js';
|
|
7
8
|
export { createExceptionGenerator, ExceptionGenerator } from './exception.js';
|
|
8
9
|
export { createFactoryGenerator, FactoryGenerator } from './factory.js';
|
|
9
10
|
export { createGuardGenerator, GuardGenerator } from './guard.js';
|
|
11
|
+
export { createJobGenerator, JobGenerator } from './job.js';
|
|
10
12
|
export { createLayoutGenerator, LayoutGenerator } from './layout.js';
|
|
13
|
+
export { createMailGenerator, MailGenerator } from './mail.js';
|
|
11
14
|
export { createMiddlewareGenerator, MiddlewareGenerator } from './middleware.js';
|
|
12
15
|
export { createMigrationGenerator, MigrationGenerator } from './migration.js';
|
|
13
16
|
export { createModelGenerator, ModelGenerator } from './model.js';
|
|
@@ -18,6 +21,8 @@ export { createResourceGenerator, ResourceGenerator } from './resource.js';
|
|
|
18
21
|
export { createSchemaGenerator, SchemaGenerator } from './schema.js';
|
|
19
22
|
export { createSeederGenerator, SeederGenerator } from './seeder.js';
|
|
20
23
|
export { createServiceGenerator, ServiceGenerator } from './service.js';
|
|
24
|
+
export { createStorageGenerator, StorageGenerator } from './storage.js';
|
|
25
|
+
export { createTaskGenerator, TaskGenerator } from './task.js';
|
|
21
26
|
export { createTestGenerator, TestGenerator } from './test.js';
|
|
22
27
|
/**
|
|
23
28
|
* Register all built-in generators with the global registry.
|
|
@@ -5,10 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { registerGenerator } from '../registry.js';
|
|
7
7
|
import { createActionGenerator } from './action.js';
|
|
8
|
+
import { createEventGenerator } from './event.js';
|
|
8
9
|
import { createExceptionGenerator } from './exception.js';
|
|
9
10
|
import { createFactoryGenerator } from './factory.js';
|
|
10
11
|
import { createGuardGenerator } from './guard.js';
|
|
12
|
+
import { createJobGenerator } from './job.js';
|
|
11
13
|
import { createLayoutGenerator } from './layout.js';
|
|
14
|
+
import { createMailGenerator } from './mail.js';
|
|
12
15
|
import { createMiddlewareGenerator } from './middleware.js';
|
|
13
16
|
import { createMigrationGenerator } from './migration.js';
|
|
14
17
|
import { createModelGenerator } from './model.js';
|
|
@@ -19,15 +22,20 @@ import { createResourceGenerator } from './resource.js';
|
|
|
19
22
|
import { createSchemaGenerator } from './schema.js';
|
|
20
23
|
import { createSeederGenerator } from './seeder.js';
|
|
21
24
|
import { createServiceGenerator } from './service.js';
|
|
25
|
+
import { createStorageGenerator } from './storage.js';
|
|
26
|
+
import { createTaskGenerator } from './task.js';
|
|
22
27
|
import { createTestGenerator } from './test.js';
|
|
23
28
|
// ============================================================================
|
|
24
29
|
// Generator Exports
|
|
25
30
|
// ============================================================================
|
|
26
31
|
export { ActionGenerator, createActionGenerator } from './action.js';
|
|
32
|
+
export { createEventGenerator, EventGenerator } from './event.js';
|
|
27
33
|
export { createExceptionGenerator, ExceptionGenerator } from './exception.js';
|
|
28
34
|
export { createFactoryGenerator, FactoryGenerator } from './factory.js';
|
|
29
35
|
export { createGuardGenerator, GuardGenerator } from './guard.js';
|
|
36
|
+
export { createJobGenerator, JobGenerator } from './job.js';
|
|
30
37
|
export { createLayoutGenerator, LayoutGenerator } from './layout.js';
|
|
38
|
+
export { createMailGenerator, MailGenerator } from './mail.js';
|
|
31
39
|
export { createMiddlewareGenerator, MiddlewareGenerator } from './middleware.js';
|
|
32
40
|
export { createMigrationGenerator, MigrationGenerator } from './migration.js';
|
|
33
41
|
export { createModelGenerator, ModelGenerator } from './model.js';
|
|
@@ -38,6 +46,8 @@ export { createResourceGenerator, ResourceGenerator } from './resource.js';
|
|
|
38
46
|
export { createSchemaGenerator, SchemaGenerator } from './schema.js';
|
|
39
47
|
export { createSeederGenerator, SeederGenerator } from './seeder.js';
|
|
40
48
|
export { createServiceGenerator, ServiceGenerator } from './service.js';
|
|
49
|
+
export { createStorageGenerator, StorageGenerator } from './storage.js';
|
|
50
|
+
export { createTaskGenerator, TaskGenerator } from './task.js';
|
|
41
51
|
export { createTestGenerator, TestGenerator } from './test.js';
|
|
42
52
|
// ============================================================================
|
|
43
53
|
// Auto-Registration
|
|
@@ -71,6 +81,11 @@ export function registerBuiltinGenerators() {
|
|
|
71
81
|
registerGenerator(createMiddlewareGenerator());
|
|
72
82
|
registerGenerator(createServiceGenerator());
|
|
73
83
|
registerGenerator(createExceptionGenerator());
|
|
84
|
+
registerGenerator(createJobGenerator());
|
|
85
|
+
registerGenerator(createMailGenerator());
|
|
86
|
+
registerGenerator(createStorageGenerator());
|
|
87
|
+
registerGenerator(createEventGenerator());
|
|
88
|
+
registerGenerator(createTaskGenerator());
|
|
74
89
|
// Register auth generators
|
|
75
90
|
registerGenerator(createGuardGenerator());
|
|
76
91
|
registerGenerator(createPolicyGenerator());
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Job Generator
|
|
3
|
+
*
|
|
4
|
+
* Scaffolds background job files for VeloxTS applications.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* velox make job <name> [options]
|
|
8
|
+
*
|
|
9
|
+
* Examples:
|
|
10
|
+
* velox make job send-email # Simple job
|
|
11
|
+
* velox make job process-payment --queue # Job with custom queue
|
|
12
|
+
* velox make job import-data --retry # Job with retry configuration
|
|
13
|
+
* velox make job batch-export --progress # Job with progress tracking
|
|
14
|
+
*/
|
|
15
|
+
import { BaseGenerator } from '../base.js';
|
|
16
|
+
import { type JobOptions } from '../templates/job.js';
|
|
17
|
+
import type { GeneratorConfig, GeneratorMetadata, GeneratorOption, GeneratorOutput } from '../types.js';
|
|
18
|
+
/**
|
|
19
|
+
* Job generator - creates background job files
|
|
20
|
+
*/
|
|
21
|
+
export declare class JobGenerator extends BaseGenerator<JobOptions> {
|
|
22
|
+
readonly metadata: GeneratorMetadata;
|
|
23
|
+
readonly options: ReadonlyArray<GeneratorOption>;
|
|
24
|
+
/**
|
|
25
|
+
* Validate and transform raw options
|
|
26
|
+
*/
|
|
27
|
+
validateOptions(raw: Record<string, unknown>): JobOptions;
|
|
28
|
+
/**
|
|
29
|
+
* Generate job files
|
|
30
|
+
*/
|
|
31
|
+
generate(config: GeneratorConfig<JobOptions>): Promise<GeneratorOutput>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Factory function for creating a JobGenerator instance
|
|
35
|
+
*/
|
|
36
|
+
export declare function createJobGenerator(): JobGenerator;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Job Generator
|
|
3
|
+
*
|
|
4
|
+
* Scaffolds background job files for VeloxTS applications.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* velox make job <name> [options]
|
|
8
|
+
*
|
|
9
|
+
* Examples:
|
|
10
|
+
* velox make job send-email # Simple job
|
|
11
|
+
* velox make job process-payment --queue # Job with custom queue
|
|
12
|
+
* velox make job import-data --retry # Job with retry configuration
|
|
13
|
+
* velox make job batch-export --progress # Job with progress tracking
|
|
14
|
+
*/
|
|
15
|
+
import { BaseGenerator } from '../base.js';
|
|
16
|
+
import { getJobInstructions, getJobPath, jobTemplate } from '../templates/job.js';
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// Generator Implementation
|
|
19
|
+
// ============================================================================
|
|
20
|
+
/**
|
|
21
|
+
* Job generator - creates background job files
|
|
22
|
+
*/
|
|
23
|
+
export class JobGenerator extends BaseGenerator {
|
|
24
|
+
metadata = {
|
|
25
|
+
name: 'job',
|
|
26
|
+
description: 'Generate background job definitions',
|
|
27
|
+
longDescription: `
|
|
28
|
+
Scaffold background job definitions for VeloxTS applications.
|
|
29
|
+
|
|
30
|
+
Jobs are background tasks that run asynchronously using the @veloxts/queue package.
|
|
31
|
+
They support retry logic, progress tracking, and custom queue assignment.
|
|
32
|
+
|
|
33
|
+
Examples:
|
|
34
|
+
velox make job send-email # Simple job
|
|
35
|
+
velox make job process-payment --queue # Job with custom queue
|
|
36
|
+
velox make job import-data --retry # Job with retry configuration
|
|
37
|
+
velox make job batch-export --progress # Job with progress tracking
|
|
38
|
+
`,
|
|
39
|
+
aliases: ['j'],
|
|
40
|
+
category: 'infrastructure',
|
|
41
|
+
};
|
|
42
|
+
options = [
|
|
43
|
+
{
|
|
44
|
+
name: 'queue',
|
|
45
|
+
short: 'q',
|
|
46
|
+
description: 'Generate job with custom queue assignment',
|
|
47
|
+
type: 'boolean',
|
|
48
|
+
default: false,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'retry',
|
|
52
|
+
short: 'r',
|
|
53
|
+
description: 'Generate job with retry/backoff configuration',
|
|
54
|
+
type: 'boolean',
|
|
55
|
+
default: false,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'progress',
|
|
59
|
+
short: 'p',
|
|
60
|
+
description: 'Generate job with progress tracking',
|
|
61
|
+
type: 'boolean',
|
|
62
|
+
default: false,
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
/**
|
|
66
|
+
* Validate and transform raw options
|
|
67
|
+
*/
|
|
68
|
+
validateOptions(raw) {
|
|
69
|
+
return {
|
|
70
|
+
queue: Boolean(raw.queue ?? false),
|
|
71
|
+
retry: Boolean(raw.retry ?? false),
|
|
72
|
+
progress: Boolean(raw.progress ?? false),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Generate job files
|
|
77
|
+
*/
|
|
78
|
+
async generate(config) {
|
|
79
|
+
const context = this.createContext(config);
|
|
80
|
+
const files = [];
|
|
81
|
+
// Generate job file
|
|
82
|
+
const jobContent = jobTemplate(context);
|
|
83
|
+
files.push({
|
|
84
|
+
path: getJobPath(config.entityName, config.project),
|
|
85
|
+
content: jobContent,
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
files,
|
|
89
|
+
postInstructions: getJobInstructions(config.entityName, config.options),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Factory function for creating a JobGenerator instance
|
|
95
|
+
*/
|
|
96
|
+
export function createJobGenerator() {
|
|
97
|
+
return new JobGenerator();
|
|
98
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mail Generator
|
|
3
|
+
*
|
|
4
|
+
* Scaffolds email template files for VeloxTS applications.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* velox make mail <name> [options]
|
|
8
|
+
*
|
|
9
|
+
* Examples:
|
|
10
|
+
* velox make mail welcome # React Email template
|
|
11
|
+
* velox make mail password-reset # React Email template
|
|
12
|
+
* velox make mail notification --text # Plain text email
|
|
13
|
+
* velox make mail invoice --attachment # Email with attachments
|
|
14
|
+
*/
|
|
15
|
+
import { BaseGenerator } from '../base.js';
|
|
16
|
+
import { type MailOptions } from '../templates/mail.js';
|
|
17
|
+
import type { GeneratorConfig, GeneratorMetadata, GeneratorOption, GeneratorOutput } from '../types.js';
|
|
18
|
+
/**
|
|
19
|
+
* Mail generator - creates email template files
|
|
20
|
+
*/
|
|
21
|
+
export declare class MailGenerator extends BaseGenerator<MailOptions> {
|
|
22
|
+
readonly metadata: GeneratorMetadata;
|
|
23
|
+
readonly options: ReadonlyArray<GeneratorOption>;
|
|
24
|
+
/**
|
|
25
|
+
* Validate and transform raw options
|
|
26
|
+
*/
|
|
27
|
+
validateOptions(raw: Record<string, unknown>): MailOptions;
|
|
28
|
+
/**
|
|
29
|
+
* Generate mail template files
|
|
30
|
+
*/
|
|
31
|
+
generate(config: GeneratorConfig<MailOptions>): Promise<GeneratorOutput>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Factory function for creating a MailGenerator instance
|
|
35
|
+
*/
|
|
36
|
+
export declare function createMailGenerator(): MailGenerator;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mail Generator
|
|
3
|
+
*
|
|
4
|
+
* Scaffolds email template files for VeloxTS applications.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* velox make mail <name> [options]
|
|
8
|
+
*
|
|
9
|
+
* Examples:
|
|
10
|
+
* velox make mail welcome # React Email template
|
|
11
|
+
* velox make mail password-reset # React Email template
|
|
12
|
+
* velox make mail notification --text # Plain text email
|
|
13
|
+
* velox make mail invoice --attachment # Email with attachments
|
|
14
|
+
*/
|
|
15
|
+
import { BaseGenerator } from '../base.js';
|
|
16
|
+
import { getMailInstructions, getMailPath, mailTemplate, } from '../templates/mail.js';
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// Generator Implementation
|
|
19
|
+
// ============================================================================
|
|
20
|
+
/**
|
|
21
|
+
* Mail generator - creates email template files
|
|
22
|
+
*/
|
|
23
|
+
export class MailGenerator extends BaseGenerator {
|
|
24
|
+
metadata = {
|
|
25
|
+
name: 'mail',
|
|
26
|
+
description: 'Generate email templates with React Email',
|
|
27
|
+
longDescription: `
|
|
28
|
+
Scaffold email templates for VeloxTS applications using React Email.
|
|
29
|
+
|
|
30
|
+
Email templates use React components to build beautiful, responsive emails
|
|
31
|
+
with type-safe data validation via Zod schemas.
|
|
32
|
+
|
|
33
|
+
Examples:
|
|
34
|
+
velox make mail welcome # React Email template
|
|
35
|
+
velox make mail password-reset # React Email template
|
|
36
|
+
velox make mail notification --text # Plain text email
|
|
37
|
+
velox make mail invoice --attachment # Email with attachment support
|
|
38
|
+
`,
|
|
39
|
+
aliases: ['email', 'em'],
|
|
40
|
+
category: 'infrastructure',
|
|
41
|
+
};
|
|
42
|
+
options = [
|
|
43
|
+
{
|
|
44
|
+
name: 'text',
|
|
45
|
+
short: 't',
|
|
46
|
+
description: 'Generate plain text email (no React)',
|
|
47
|
+
type: 'boolean',
|
|
48
|
+
default: false,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'attachment',
|
|
52
|
+
short: 'a',
|
|
53
|
+
description: 'Generate email with attachment support',
|
|
54
|
+
type: 'boolean',
|
|
55
|
+
default: false,
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
/**
|
|
59
|
+
* Validate and transform raw options
|
|
60
|
+
*/
|
|
61
|
+
validateOptions(raw) {
|
|
62
|
+
return {
|
|
63
|
+
text: Boolean(raw.text ?? false),
|
|
64
|
+
attachment: Boolean(raw.attachment ?? false),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Generate mail template files
|
|
69
|
+
*/
|
|
70
|
+
async generate(config) {
|
|
71
|
+
const context = this.createContext(config);
|
|
72
|
+
const files = [];
|
|
73
|
+
// Generate mail template file
|
|
74
|
+
const mailContent = mailTemplate(context);
|
|
75
|
+
files.push({
|
|
76
|
+
path: getMailPath(config.entityName, config.project, config.options),
|
|
77
|
+
content: mailContent,
|
|
78
|
+
});
|
|
79
|
+
return {
|
|
80
|
+
files,
|
|
81
|
+
postInstructions: getMailInstructions(config.entityName, config.options),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Factory function for creating a MailGenerator instance
|
|
87
|
+
*/
|
|
88
|
+
export function createMailGenerator() {
|
|
89
|
+
return new MailGenerator();
|
|
90
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage Generator
|
|
3
|
+
*
|
|
4
|
+
* Scaffolds storage configuration and upload handler files for VeloxTS applications.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* velox make storage <name> [options]
|
|
8
|
+
*
|
|
9
|
+
* Examples:
|
|
10
|
+
* velox make storage avatar # Local filesystem storage
|
|
11
|
+
* velox make storage document --s3 # S3/R2/MinIO storage
|
|
12
|
+
* velox make storage file --upload # File upload handler
|
|
13
|
+
*/
|
|
14
|
+
import { BaseGenerator } from '../base.js';
|
|
15
|
+
import { type StorageOptions } from '../templates/storage.js';
|
|
16
|
+
import type { GeneratorConfig, GeneratorMetadata, GeneratorOption, GeneratorOutput } from '../types.js';
|
|
17
|
+
/**
|
|
18
|
+
* Storage generator - creates storage configuration and upload handlers
|
|
19
|
+
*/
|
|
20
|
+
export declare class StorageGenerator extends BaseGenerator<StorageOptions> {
|
|
21
|
+
readonly metadata: GeneratorMetadata;
|
|
22
|
+
readonly options: ReadonlyArray<GeneratorOption>;
|
|
23
|
+
/**
|
|
24
|
+
* Validate and transform raw options
|
|
25
|
+
*/
|
|
26
|
+
validateOptions(raw: Record<string, unknown>): StorageOptions;
|
|
27
|
+
/**
|
|
28
|
+
* Generate storage configuration or upload handler files
|
|
29
|
+
*/
|
|
30
|
+
generate(config: GeneratorConfig<StorageOptions>): Promise<GeneratorOutput>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Factory function for creating a StorageGenerator instance
|
|
34
|
+
*/
|
|
35
|
+
export declare function createStorageGenerator(): StorageGenerator;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage Generator
|
|
3
|
+
*
|
|
4
|
+
* Scaffolds storage configuration and upload handler files for VeloxTS applications.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* velox make storage <name> [options]
|
|
8
|
+
*
|
|
9
|
+
* Examples:
|
|
10
|
+
* velox make storage avatar # Local filesystem storage
|
|
11
|
+
* velox make storage document --s3 # S3/R2/MinIO storage
|
|
12
|
+
* velox make storage file --upload # File upload handler
|
|
13
|
+
*/
|
|
14
|
+
import { BaseGenerator } from '../base.js';
|
|
15
|
+
import { getStorageInstructions, getStoragePath, storageTemplate, } from '../templates/storage.js';
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// Generator Implementation
|
|
18
|
+
// ============================================================================
|
|
19
|
+
/**
|
|
20
|
+
* Storage generator - creates storage configuration and upload handlers
|
|
21
|
+
*/
|
|
22
|
+
export class StorageGenerator extends BaseGenerator {
|
|
23
|
+
metadata = {
|
|
24
|
+
name: 'storage',
|
|
25
|
+
description: 'Generate storage configurations and upload handlers',
|
|
26
|
+
longDescription: `
|
|
27
|
+
Scaffold storage configurations and file upload handlers for VeloxTS applications.
|
|
28
|
+
|
|
29
|
+
Storage configurations support local filesystem, S3-compatible object storage (AWS S3,
|
|
30
|
+
Cloudflare R2, MinIO), and complete upload/download handlers with validation.
|
|
31
|
+
|
|
32
|
+
Examples:
|
|
33
|
+
velox make storage avatar # Local filesystem storage config
|
|
34
|
+
velox make storage document --s3 # S3/R2/MinIO storage config
|
|
35
|
+
velox make storage file --upload # Upload handler with storage integration
|
|
36
|
+
velox make storage media --local # Explicit local storage
|
|
37
|
+
`,
|
|
38
|
+
aliases: ['st', 'store'],
|
|
39
|
+
category: 'infrastructure',
|
|
40
|
+
};
|
|
41
|
+
options = [
|
|
42
|
+
{
|
|
43
|
+
name: 'local',
|
|
44
|
+
short: 'l',
|
|
45
|
+
description: 'Generate local filesystem storage configuration (default)',
|
|
46
|
+
type: 'boolean',
|
|
47
|
+
default: false,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 's3',
|
|
51
|
+
description: 'Generate S3/R2/MinIO storage configuration',
|
|
52
|
+
type: 'boolean',
|
|
53
|
+
default: false,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'upload',
|
|
57
|
+
short: 'u',
|
|
58
|
+
description: 'Generate file upload handler with storage integration',
|
|
59
|
+
type: 'boolean',
|
|
60
|
+
default: false,
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
/**
|
|
64
|
+
* Validate and transform raw options
|
|
65
|
+
*/
|
|
66
|
+
validateOptions(raw) {
|
|
67
|
+
const local = Boolean(raw.local ?? false);
|
|
68
|
+
const s3 = Boolean(raw.s3 ?? false);
|
|
69
|
+
const upload = Boolean(raw.upload ?? false);
|
|
70
|
+
// Validate mutually exclusive options
|
|
71
|
+
const optionCount = [local, s3, upload].filter(Boolean).length;
|
|
72
|
+
if (optionCount > 1) {
|
|
73
|
+
throw new Error('Options --local, --s3, and --upload are mutually exclusive. Choose one.');
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
local,
|
|
77
|
+
s3,
|
|
78
|
+
upload,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Generate storage configuration or upload handler files
|
|
83
|
+
*/
|
|
84
|
+
async generate(config) {
|
|
85
|
+
const context = this.createContext(config);
|
|
86
|
+
const files = [];
|
|
87
|
+
// Generate storage file
|
|
88
|
+
const storageContent = storageTemplate(context);
|
|
89
|
+
files.push({
|
|
90
|
+
path: getStoragePath(config.entityName, config.project, config.options),
|
|
91
|
+
content: storageContent,
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
files,
|
|
95
|
+
postInstructions: getStorageInstructions(config.entityName, config.options),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Factory function for creating a StorageGenerator instance
|
|
101
|
+
*/
|
|
102
|
+
export function createStorageGenerator() {
|
|
103
|
+
return new StorageGenerator();
|
|
104
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task Generator
|
|
3
|
+
*
|
|
4
|
+
* Scaffolds scheduled task files for VeloxTS applications.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* velox make task <name> [options]
|
|
8
|
+
*
|
|
9
|
+
* Examples:
|
|
10
|
+
* velox make task cleanup-tokens # Simple daily task
|
|
11
|
+
* velox make task send-digest --callbacks # Task with success/failure callbacks
|
|
12
|
+
* velox make task backup-db --no-overlap # Task that prevents overlapping runs
|
|
13
|
+
* velox make task report --constraints # Task with time/day constraints
|
|
14
|
+
*/
|
|
15
|
+
import { BaseGenerator } from '../base.js';
|
|
16
|
+
import { type TaskOptions } from '../templates/task.js';
|
|
17
|
+
import type { GeneratorConfig, GeneratorMetadata, GeneratorOption, GeneratorOutput } from '../types.js';
|
|
18
|
+
/**
|
|
19
|
+
* Task generator - creates scheduled task files
|
|
20
|
+
*/
|
|
21
|
+
export declare class TaskGenerator extends BaseGenerator<TaskOptions> {
|
|
22
|
+
readonly metadata: GeneratorMetadata;
|
|
23
|
+
readonly options: ReadonlyArray<GeneratorOption>;
|
|
24
|
+
/**
|
|
25
|
+
* Validate and transform raw options
|
|
26
|
+
*/
|
|
27
|
+
validateOptions(raw: Record<string, unknown>): TaskOptions;
|
|
28
|
+
/**
|
|
29
|
+
* Generate task files
|
|
30
|
+
*/
|
|
31
|
+
generate(config: GeneratorConfig<TaskOptions>): Promise<GeneratorOutput>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Factory function for creating a TaskGenerator instance
|
|
35
|
+
*/
|
|
36
|
+
export declare function createTaskGenerator(): TaskGenerator;
|