@veloxts/cli 0.7.2 → 0.7.4

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.
@@ -0,0 +1,219 @@
1
+ /**
2
+ * Sync Command Types
3
+ *
4
+ * Shared type definitions for the `velox sync` pipeline.
5
+ * The sync command reads a Prisma schema and generates Zod schemas +
6
+ * CRUD procedures for all models through a 5-stage pipeline:
7
+ * analyze -> detect -> prompt -> plan -> generate.
8
+ */
9
+ /**
10
+ * Rich metadata about a Prisma model, produced by the analyzer stage.
11
+ *
12
+ * Contains all information needed by downstream stages to generate
13
+ * schemas and procedures for this model.
14
+ */
15
+ export interface SyncModelInfo {
16
+ /** PascalCase model name (e.g., "User", "BlogPost") */
17
+ readonly name: string;
18
+ /** All scalar fields on the model */
19
+ readonly fields: readonly SyncFieldInfo[];
20
+ /** All relation fields with classification */
21
+ readonly relations: readonly SyncRelationInfo[];
22
+ /** True if the model is a many-to-many join table */
23
+ readonly isJoinTable: boolean;
24
+ /** Whether the model has createdAt/updatedAt timestamp fields */
25
+ readonly hasTimestamps: boolean;
26
+ /** Compound unique constraints (each constraint is a list of field names) */
27
+ readonly uniqueConstraints: readonly (readonly string[])[];
28
+ }
29
+ /**
30
+ * A scalar field with sync-specific flags.
31
+ *
32
+ * Flags like `isAutoManaged` and `isSensitive` drive which fields
33
+ * are included in create/update schemas and which are omitted or
34
+ * redacted in output schemas.
35
+ */
36
+ export interface SyncFieldInfo {
37
+ /** Field name as declared in the Prisma schema */
38
+ readonly name: string;
39
+ /** Prisma type (e.g., "String", "Int", "DateTime", "Boolean") */
40
+ readonly type: string;
41
+ /** Whether the field is optional in Prisma (marked with ?) */
42
+ readonly isOptional: boolean;
43
+ /** Whether this field is the primary key (@id) */
44
+ readonly isId: boolean;
45
+ /** Whether this field has a @unique constraint */
46
+ readonly isUnique: boolean;
47
+ /** Whether the field has a @default value */
48
+ readonly hasDefault: boolean;
49
+ /** String representation of the default value, if any */
50
+ readonly defaultValue: string | undefined;
51
+ /** True for auto-managed fields: id, createdAt, updatedAt, deletedAt */
52
+ readonly isAutoManaged: boolean;
53
+ /** True for sensitive fields: password, secret, token, hash */
54
+ readonly isSensitive: boolean;
55
+ /** True if this field is a foreign key pointing to the User model */
56
+ readonly isUserForeignKey: boolean;
57
+ }
58
+ /**
59
+ * A relation field with its classified kind.
60
+ *
61
+ * The kind determines how the relation is represented in generated
62
+ * procedures (e.g., belongsTo includes the foreign key, hasMany
63
+ * supports nested includes).
64
+ */
65
+ export interface SyncRelationInfo {
66
+ /** Relation field name as declared in the Prisma schema */
67
+ readonly name: string;
68
+ /** PascalCase name of the related model */
69
+ readonly relatedModel: string;
70
+ /** Relation kind: belongsTo (FK on this model), hasMany, or hasOne */
71
+ readonly kind: 'belongsTo' | 'hasMany' | 'hasOne';
72
+ /** Foreign key field name on this model (only for belongsTo) */
73
+ readonly foreignKey: string | undefined;
74
+ }
75
+ /**
76
+ * Map of existing generated files discovered by the detector stage.
77
+ *
78
+ * Used by the prompter to determine whether a model needs generation,
79
+ * regeneration, or can be skipped.
80
+ */
81
+ export interface ExistingCodeMap {
82
+ /** Map of modelName -> absolute file path for existing procedure files */
83
+ readonly procedures: ReadonlyMap<string, string>;
84
+ /** Map of modelName -> absolute file path for existing schema files */
85
+ readonly schemas: ReadonlyMap<string, string>;
86
+ }
87
+ /**
88
+ * CRUD operation choices for a single model.
89
+ *
90
+ * Each boolean indicates whether the corresponding procedure
91
+ * should be generated.
92
+ */
93
+ export interface CrudChoices {
94
+ /** Generate a get-by-id query */
95
+ readonly get: boolean;
96
+ /** Generate a list-all query */
97
+ readonly list: boolean;
98
+ /** Generate a create mutation */
99
+ readonly create: boolean;
100
+ /** Generate an update mutation */
101
+ readonly update: boolean;
102
+ /** Generate a delete mutation */
103
+ readonly delete: boolean;
104
+ }
105
+ /**
106
+ * User's choices for a single model, collected by the prompter stage.
107
+ *
108
+ * Drives what the planner produces for this model.
109
+ */
110
+ export interface ModelChoices {
111
+ /** PascalCase model name */
112
+ readonly model: string;
113
+ /** What to do with this model's files */
114
+ readonly action: 'generate' | 'regenerate' | 'skip';
115
+ /** Output strategy: plain .output() or resource schema with visibility tiers */
116
+ readonly outputStrategy: 'output' | 'resource';
117
+ /** Which CRUD operations to generate */
118
+ readonly crud: CrudChoices;
119
+ /** Relation names to include in the Zod schema (nested object shapes) */
120
+ readonly schemaRelations: readonly string[];
121
+ /** Relation names to include via Prisma `include` in procedure queries */
122
+ readonly includeRelations: readonly string[];
123
+ /** Per-field visibility tiers (only when outputStrategy is 'resource') */
124
+ readonly fieldVisibility: ReadonlyMap<string, 'public' | 'authenticated' | 'admin'> | undefined;
125
+ }
126
+ /**
127
+ * Complete generation plan produced by the planner stage.
128
+ *
129
+ * Contains all files to create/overwrite and registrations to add.
130
+ * The generator stage consumes this plan without further decision-making.
131
+ */
132
+ export interface SyncPlan {
133
+ /** Schema files to generate */
134
+ readonly schemas: readonly SchemaFilePlan[];
135
+ /** Procedure files to generate */
136
+ readonly procedures: readonly ProcedureFilePlan[];
137
+ /** Router registration entries to add */
138
+ readonly registrations: readonly RegistrationPlan[];
139
+ }
140
+ /**
141
+ * Plan for generating a single Zod schema file.
142
+ */
143
+ export interface SchemaFilePlan {
144
+ /** Model metadata from the analyzer */
145
+ readonly model: SyncModelInfo;
146
+ /** Absolute path where the schema file will be written */
147
+ readonly outputPath: string;
148
+ /** Whether to use plain output or resource schema with visibility tiers */
149
+ readonly outputStrategy: 'output' | 'resource';
150
+ /** Fields to include in create/update input schemas */
151
+ readonly fields: readonly SyncFieldInfo[];
152
+ /** All fields on the model (for output/resource schema generation) */
153
+ readonly allFields: readonly SyncFieldInfo[];
154
+ /** Relations to include as nested shapes in the schema */
155
+ readonly relations: readonly SyncRelationInfo[];
156
+ /** Per-field visibility tiers (only when outputStrategy is 'resource') */
157
+ readonly fieldVisibility: ReadonlyMap<string, 'public' | 'authenticated' | 'admin'> | undefined;
158
+ /** Whether this is a new file or an overwrite of an existing file */
159
+ readonly action: 'create' | 'overwrite';
160
+ }
161
+ /**
162
+ * Plan for generating a single procedure file.
163
+ */
164
+ export interface ProcedureFilePlan {
165
+ /** Model metadata from the analyzer */
166
+ readonly model: SyncModelInfo;
167
+ /** Absolute path where the procedure file will be written */
168
+ readonly outputPath: string;
169
+ /** Relative import path from the procedure file to the schema file */
170
+ readonly schemaImportPath: string;
171
+ /** Whether to use plain output or resource schema with visibility tiers */
172
+ readonly outputStrategy: 'output' | 'resource';
173
+ /** Which CRUD operations to generate */
174
+ readonly crud: CrudChoices;
175
+ /** Relation names to include via Prisma `include` in queries */
176
+ readonly includeRelations: readonly string[];
177
+ /** Whether this is a new file or an overwrite of an existing file */
178
+ readonly action: 'create' | 'overwrite';
179
+ }
180
+ /**
181
+ * Plan for registering a procedure collection in the router.
182
+ */
183
+ export interface RegistrationPlan {
184
+ /** Variable name for the procedure collection (e.g., "userProcedures") */
185
+ readonly procedureVarName: string;
186
+ /** Entity name used for route prefix (e.g., "users") */
187
+ readonly entityName: string;
188
+ /** Import path for the procedure file (e.g., "./procedures/users.js") */
189
+ readonly importPath: string;
190
+ }
191
+ /**
192
+ * Result summary from the generator stage.
193
+ *
194
+ * Tracks which files were created, overwritten, skipped, or errored
195
+ * for display in the CLI output.
196
+ */
197
+ export interface SyncResult {
198
+ /** Files that were newly created */
199
+ readonly created: readonly string[];
200
+ /** Files that were overwritten */
201
+ readonly overwritten: readonly string[];
202
+ /** Files that were skipped (user chose to skip or already up-to-date) */
203
+ readonly skipped: readonly string[];
204
+ /** Procedure collections that were registered in the router */
205
+ readonly registered: readonly string[];
206
+ /** Error messages for files that failed to generate */
207
+ readonly errors: readonly string[];
208
+ }
209
+ /**
210
+ * CLI options for the `velox sync` command.
211
+ */
212
+ export interface SyncCommandOptions {
213
+ /** Preview changes without writing any files */
214
+ readonly dryRun: boolean;
215
+ /** Skip confirmation prompts and overwrite existing files */
216
+ readonly force: boolean;
217
+ /** Skip automatic router registration of generated procedures */
218
+ readonly skipRegistration: boolean;
219
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Sync Command Types
3
+ *
4
+ * Shared type definitions for the `velox sync` pipeline.
5
+ * The sync command reads a Prisma schema and generates Zod schemas +
6
+ * CRUD procedures for all models through a 5-stage pipeline:
7
+ * analyze -> detect -> prompt -> plan -> generate.
8
+ */
9
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veloxts/cli",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
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/core": "0.7.2",
45
- "@veloxts/auth": "0.7.2",
46
- "@veloxts/orm": "0.7.2",
47
- "@veloxts/router": "0.7.2",
48
- "@veloxts/validation": "0.7.2"
44
+ "@veloxts/core": "0.7.4",
45
+ "@veloxts/auth": "0.7.4",
46
+ "@veloxts/router": "0.7.4",
47
+ "@veloxts/orm": "0.7.4",
48
+ "@veloxts/validation": "0.7.4"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@prisma/client": ">=7.0.0"