create-velox-app 0.4.3 → 0.4.5
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/dist/cli.js +0 -0
- package/dist/index.js +21 -14
- package/dist/index.js.map +1 -1
- package/dist/templates/auth.d.ts +6 -3
- package/dist/templates/auth.d.ts.map +1 -1
- package/dist/templates/auth.js +56 -1112
- package/dist/templates/auth.js.map +1 -1
- package/dist/templates/compiler.d.ts +68 -0
- package/dist/templates/compiler.d.ts.map +1 -0
- package/dist/templates/compiler.js +149 -0
- package/dist/templates/compiler.js.map +1 -0
- package/dist/templates/default.d.ts +5 -2
- package/dist/templates/default.d.ts.map +1 -1
- package/dist/templates/default.js +51 -509
- package/dist/templates/default.js.map +1 -1
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +19 -10
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/placeholders.d.ts +70 -0
- package/dist/templates/placeholders.d.ts.map +1 -0
- package/dist/templates/placeholders.js +145 -0
- package/dist/templates/placeholders.js.map +1 -0
- package/dist/templates/shared/index.d.ts +9 -0
- package/dist/templates/shared/index.d.ts.map +1 -0
- package/dist/templates/shared/index.js +9 -0
- package/dist/templates/shared/index.js.map +1 -0
- package/dist/templates/shared/root.d.ts +14 -0
- package/dist/templates/shared/root.d.ts.map +1 -0
- package/dist/templates/shared/root.js +43 -0
- package/dist/templates/shared/root.js.map +1 -0
- package/dist/templates/shared/web-base.d.ts +18 -0
- package/dist/templates/shared/web-base.d.ts.map +1 -0
- package/dist/templates/shared/web-base.js +63 -0
- package/dist/templates/shared/web-base.js.map +1 -0
- package/dist/templates/shared/web-styles.d.ts +10 -0
- package/dist/templates/shared/web-styles.d.ts.map +1 -0
- package/dist/templates/shared/web-styles.js +26 -0
- package/dist/templates/shared/web-styles.js.map +1 -0
- package/dist/templates/shared.d.ts +2 -13
- package/dist/templates/shared.d.ts.map +1 -1
- package/dist/templates/shared.js +2 -289
- package/dist/templates/shared.js.map +1 -1
- package/dist/templates/source/api/config/app.d.ts +13 -0
- package/dist/templates/source/api/config/app.d.ts.map +1 -0
- package/dist/templates/source/api/config/app.js +14 -0
- package/dist/templates/source/api/config/app.js.map +1 -0
- package/dist/templates/source/api/config/auth.d.ts +34 -0
- package/dist/templates/source/api/config/auth.d.ts.map +1 -0
- package/dist/templates/source/api/config/auth.js +165 -0
- package/dist/templates/source/api/config/auth.js.map +1 -0
- package/dist/templates/source/api/config/index.auth.d.ts +6 -0
- package/dist/templates/source/api/config/index.auth.d.ts.map +1 -0
- package/dist/templates/source/api/config/index.auth.js +6 -0
- package/dist/templates/source/api/config/index.auth.js.map +1 -0
- package/dist/templates/source/api/config/index.default.d.ts +5 -0
- package/dist/templates/source/api/config/index.default.d.ts.map +1 -0
- package/dist/templates/source/api/config/index.default.js +5 -0
- package/dist/templates/source/api/config/index.default.js.map +1 -0
- package/dist/templates/source/api/database/index.d.ts +9 -0
- package/dist/templates/source/api/database/index.d.ts.map +1 -0
- package/dist/templates/source/api/database/index.js +18 -0
- package/dist/templates/source/api/database/index.js.map +1 -0
- package/dist/templates/source/api/index.auth.d.ts +5 -0
- package/dist/templates/source/api/index.auth.d.ts.map +1 -0
- package/dist/templates/source/api/index.auth.js +59 -0
- package/dist/templates/source/api/index.auth.js.map +1 -0
- package/dist/templates/source/api/index.default.d.ts +5 -0
- package/dist/templates/source/api/index.default.d.ts.map +1 -0
- package/dist/templates/source/api/index.default.js +56 -0
- package/dist/templates/source/api/index.default.js.map +1 -0
- package/dist/templates/source/api/prisma.config.d.ts +9 -0
- package/dist/templates/source/api/prisma.config.d.ts.map +1 -0
- package/dist/templates/source/api/prisma.config.js +15 -0
- package/dist/templates/source/api/prisma.config.js.map +1 -0
- package/dist/templates/source/api/procedures/auth.d.ts +14 -0
- package/dist/templates/source/api/procedures/auth.d.ts.map +1 -0
- package/dist/templates/source/api/procedures/auth.js +221 -0
- package/dist/templates/source/api/procedures/auth.js.map +1 -0
- package/dist/templates/source/api/procedures/health.d.ts +5 -0
- package/dist/templates/source/api/procedures/health.d.ts.map +1 -0
- package/dist/templates/source/api/procedures/health.js +21 -0
- package/dist/templates/source/api/procedures/health.js.map +1 -0
- package/dist/templates/source/api/procedures/index.auth.d.ts +7 -0
- package/dist/templates/source/api/procedures/index.auth.d.ts.map +1 -0
- package/dist/templates/source/api/procedures/index.auth.js +7 -0
- package/dist/templates/source/api/procedures/index.auth.js.map +1 -0
- package/dist/templates/source/api/procedures/index.default.d.ts +6 -0
- package/dist/templates/source/api/procedures/index.default.d.ts.map +1 -0
- package/dist/templates/source/api/procedures/index.default.js +6 -0
- package/dist/templates/source/api/procedures/index.default.js.map +1 -0
- package/dist/templates/source/api/procedures/users.auth.d.ts +7 -0
- package/dist/templates/source/api/procedures/users.auth.d.ts.map +1 -0
- package/dist/templates/source/api/procedures/users.auth.js +111 -0
- package/dist/templates/source/api/procedures/users.auth.js.map +1 -0
- package/dist/templates/source/api/procedures/users.default.d.ts +5 -0
- package/dist/templates/source/api/procedures/users.default.d.ts.map +1 -0
- package/dist/templates/source/api/procedures/users.default.js +86 -0
- package/dist/templates/source/api/procedures/users.default.js.map +1 -0
- package/dist/templates/source/api/schemas/index.d.ts +5 -0
- package/dist/templates/source/api/schemas/index.d.ts.map +1 -0
- package/dist/templates/source/api/schemas/index.js +5 -0
- package/dist/templates/source/api/schemas/index.js.map +1 -0
- package/dist/templates/source/api/schemas/user.d.ts +11 -0
- package/dist/templates/source/api/schemas/user.d.ts.map +1 -0
- package/dist/templates/source/api/schemas/user.js +20 -0
- package/dist/templates/source/api/schemas/user.js.map +1 -0
- package/dist/templates/source/api/tsup.config.d.ts +3 -0
- package/dist/templates/source/api/tsup.config.d.ts.map +1 -0
- package/dist/templates/source/api/tsup.config.js +10 -0
- package/dist/templates/source/api/tsup.config.js.map +1 -0
- package/dist/templates/source/web/main.d.ts +9 -0
- package/dist/templates/source/web/main.d.ts.map +1 -0
- package/dist/templates/source/web/main.js +27 -0
- package/dist/templates/source/web/main.js.map +1 -0
- package/dist/templates/source/web/routes/__root.d.ts +2 -0
- package/dist/templates/source/web/routes/__root.d.ts.map +1 -0
- package/dist/templates/source/web/routes/__root.js +28 -0
- package/dist/templates/source/web/routes/__root.js.map +1 -0
- package/dist/templates/source/web/routes/about.d.ts +2 -0
- package/dist/templates/source/web/routes/about.d.ts.map +1 -0
- package/dist/templates/source/web/routes/about.js +33 -0
- package/dist/templates/source/web/routes/about.js.map +1 -0
- package/dist/templates/source/web/routes/index.auth.d.ts +2 -0
- package/dist/templates/source/web/routes/index.auth.d.ts.map +1 -0
- package/dist/templates/source/web/routes/index.auth.js +159 -0
- package/dist/templates/source/web/routes/index.auth.js.map +1 -0
- package/dist/templates/source/web/routes/index.default.d.ts +2 -0
- package/dist/templates/source/web/routes/index.default.d.ts.map +1 -0
- package/dist/templates/source/web/routes/index.default.js +60 -0
- package/dist/templates/source/web/routes/index.default.js.map +1 -0
- package/dist/templates/source/web/vite.config.d.ts +3 -0
- package/dist/templates/source/web/vite.config.d.ts.map +1 -0
- package/dist/templates/source/web/vite.config.js +22 -0
- package/dist/templates/source/web/vite.config.js.map +1 -0
- package/package.json +11 -9
- package/src/templates/source/api/config/app.ts +13 -0
- package/src/templates/source/api/config/auth.ts +202 -0
- package/src/templates/source/api/config/database.ts +22 -0
- package/src/templates/source/api/env.auth +22 -0
- package/src/templates/source/api/env.default +13 -0
- package/src/templates/source/api/index.auth.ts +30 -0
- package/src/templates/source/api/index.default.ts +27 -0
- package/src/templates/source/api/package.auth.json +40 -0
- package/src/templates/source/api/package.default.json +38 -0
- package/src/templates/source/api/prisma/schema.auth.prisma +30 -0
- package/src/templates/source/api/prisma/schema.default.prisma +28 -0
- package/src/templates/source/api/prisma.config.ts +15 -0
- package/src/templates/source/api/procedures/auth.ts +285 -0
- package/src/templates/source/api/procedures/health.ts +24 -0
- package/src/templates/source/api/procedures/users.auth.ts +170 -0
- package/src/templates/source/api/procedures/users.default.ts +119 -0
- package/src/templates/source/api/schemas/user.ts +29 -0
- package/src/templates/source/api/tsconfig.json +12 -0
- package/src/templates/source/api/tsup.config.ts +10 -0
- package/src/templates/source/root/CLAUDE.auth.md +148 -0
- package/src/templates/source/root/CLAUDE.default.md +128 -0
- package/src/templates/source/root/README.md +72 -0
- package/src/templates/source/root/gitignore +37 -0
- package/src/templates/source/root/package.json +17 -0
- package/src/templates/source/root/pnpm-workspace.yaml +2 -0
- package/src/templates/source/root/tsconfig.json +19 -0
- package/src/templates/source/web/App.module.css +282 -0
- package/src/templates/source/web/favicon.svg +12 -0
- package/src/templates/source/web/index.html +13 -0
- package/src/templates/source/web/main.tsx +38 -0
- package/src/templates/source/web/package.json +26 -0
- package/src/templates/source/web/routes/__root.tsx +31 -0
- package/src/templates/source/web/routes/about.tsx +36 -0
- package/src/templates/source/web/routes/index.auth.tsx +230 -0
- package/src/templates/source/web/routes/index.default.tsx +79 -0
- package/src/templates/source/web/styles/global.css +90 -0
- package/src/templates/source/web/tsconfig.json +24 -0
- package/src/templates/source/web/vite.config.ts +22 -0
- package/LICENSE +0 -21
|
@@ -1,539 +1,81 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Default Template (
|
|
2
|
+
* Default Template (Full-Stack)
|
|
3
|
+
*
|
|
4
|
+
* Full-stack workspace template with:
|
|
5
|
+
* - apps/api: REST API with user CRUD operations
|
|
6
|
+
* - apps/web: React frontend with TanStack Router
|
|
3
7
|
*
|
|
4
|
-
* Basic REST API template with user CRUD operations.
|
|
5
8
|
* No authentication - suitable for internal APIs or as a starting point.
|
|
6
9
|
*/
|
|
7
|
-
import {
|
|
10
|
+
import { compileTemplate } from './compiler.js';
|
|
11
|
+
import { DEFAULT_CONFIG } from './placeholders.js';
|
|
12
|
+
import { generateRootFiles, generateWebBaseFiles, generateWebStyleFiles } from './shared/index.js';
|
|
8
13
|
// ============================================================================
|
|
9
|
-
//
|
|
14
|
+
// API Template Compilation
|
|
10
15
|
// ============================================================================
|
|
11
|
-
function
|
|
12
|
-
return
|
|
13
|
-
name: config.projectName,
|
|
14
|
-
version: '0.0.1',
|
|
15
|
-
description: 'A VeloxTS application',
|
|
16
|
-
type: 'module',
|
|
17
|
-
main: 'dist/index.js',
|
|
18
|
-
scripts: {
|
|
19
|
-
build: 'tsup',
|
|
20
|
-
start: 'node dist/index.js',
|
|
21
|
-
dev: 'tsx watch src/index.ts',
|
|
22
|
-
'type-check': 'tsc --noEmit',
|
|
23
|
-
clean: "node -e \"require('fs').rmSync('dist',{recursive:true,force:true});require('fs').rmSync('tsconfig.tsbuildinfo',{force:true})\"",
|
|
24
|
-
'db:generate': 'prisma generate',
|
|
25
|
-
'db:push': 'prisma db push',
|
|
26
|
-
'db:studio': 'prisma studio',
|
|
27
|
-
postinstall: 'prisma generate',
|
|
28
|
-
},
|
|
29
|
-
dependencies: {
|
|
30
|
-
'@fastify/static': '^8.3.0',
|
|
31
|
-
'@prisma/adapter-better-sqlite3': '^7.1.0',
|
|
32
|
-
'@prisma/client': '^7.1.0',
|
|
33
|
-
'@veloxts/velox': `^${VELOXTS_VERSION}`,
|
|
34
|
-
'better-sqlite3': '^12.5.0',
|
|
35
|
-
dotenv: '^17.2.3',
|
|
36
|
-
zod: '^3.24.4',
|
|
37
|
-
},
|
|
38
|
-
devDependencies: {
|
|
39
|
-
prisma: '^7.1.0',
|
|
40
|
-
tsup: '^8.5.1',
|
|
41
|
-
tsx: '^4.21.0',
|
|
42
|
-
typescript: '^5.9.3',
|
|
43
|
-
},
|
|
44
|
-
}, null, 2);
|
|
16
|
+
function generateApiPackageJson(config) {
|
|
17
|
+
return compileTemplate('api/package.default.json', config);
|
|
45
18
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// ============================================================================
|
|
49
|
-
function generateEnvExample() {
|
|
50
|
-
return `# Database URL
|
|
51
|
-
# SQLite (local development):
|
|
52
|
-
DATABASE_URL="file:./dev.db"
|
|
53
|
-
# PostgreSQL (production):
|
|
54
|
-
# DATABASE_URL="postgresql://user:password@localhost:5432/myapp"
|
|
55
|
-
|
|
56
|
-
# Server Configuration
|
|
57
|
-
PORT=3210
|
|
58
|
-
HOST=0.0.0.0
|
|
59
|
-
NODE_ENV=development
|
|
60
|
-
|
|
61
|
-
# API Configuration
|
|
62
|
-
API_PREFIX=/api
|
|
63
|
-
`;
|
|
19
|
+
function generateApiTsConfig() {
|
|
20
|
+
return compileTemplate('api/tsconfig.json', DEFAULT_CONFIG);
|
|
64
21
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
// ============================================================================
|
|
68
|
-
function generatePrismaSchema() {
|
|
69
|
-
return `// Prisma Schema
|
|
70
|
-
//
|
|
71
|
-
// This schema defines the database structure.
|
|
72
|
-
// Using SQLite for simplicity - easily swap to PostgreSQL for production.
|
|
73
|
-
|
|
74
|
-
generator client {
|
|
75
|
-
provider = "prisma-client"
|
|
76
|
-
output = "../src/generated/prisma"
|
|
22
|
+
function generateApiTsupConfig() {
|
|
23
|
+
return compileTemplate('api/tsup.config.ts', DEFAULT_CONFIG);
|
|
77
24
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
provider = "sqlite"
|
|
25
|
+
function generateEnvExample(config) {
|
|
26
|
+
return compileTemplate('api/env.default', config);
|
|
81
27
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
// User Model
|
|
85
|
-
// ============================================================================
|
|
86
|
-
|
|
87
|
-
/// User model for basic CRUD demonstration
|
|
88
|
-
model User {
|
|
89
|
-
id String @id @default(uuid())
|
|
90
|
-
name String
|
|
91
|
-
email String @unique
|
|
92
|
-
createdAt DateTime @default(now())
|
|
93
|
-
updatedAt DateTime @updatedAt
|
|
94
|
-
|
|
95
|
-
@@map("users")
|
|
28
|
+
function generatePrismaSchema() {
|
|
29
|
+
return compileTemplate('api/prisma/schema.default.prisma', DEFAULT_CONFIG);
|
|
96
30
|
}
|
|
97
|
-
|
|
31
|
+
function generatePrismaConfig() {
|
|
32
|
+
return compileTemplate('api/prisma.config.ts', DEFAULT_CONFIG);
|
|
98
33
|
}
|
|
99
|
-
// ============================================================================
|
|
100
|
-
// Source Files
|
|
101
|
-
// ============================================================================
|
|
102
34
|
function generateIndexTs() {
|
|
103
|
-
return
|
|
104
|
-
* Application Entry Point
|
|
105
|
-
*/
|
|
106
|
-
|
|
107
|
-
import 'dotenv/config';
|
|
108
|
-
|
|
109
|
-
import fastifyStatic from '@fastify/static';
|
|
110
|
-
import {
|
|
111
|
-
veloxApp,
|
|
112
|
-
VELOX_VERSION,
|
|
113
|
-
databasePlugin,
|
|
114
|
-
rest,
|
|
115
|
-
getRouteSummary,
|
|
116
|
-
} from '@veloxts/velox';
|
|
117
|
-
import path from 'node:path';
|
|
118
|
-
|
|
119
|
-
import { config } from './config/index.js';
|
|
120
|
-
import { prisma } from './database/index.js';
|
|
121
|
-
import { healthProcedures } from './procedures/health.js';
|
|
122
|
-
import { userProcedures } from './procedures/users.js';
|
|
123
|
-
|
|
124
|
-
// ============================================================================
|
|
125
|
-
// Application Bootstrap
|
|
126
|
-
// ============================================================================
|
|
127
|
-
|
|
128
|
-
async function createApp() {
|
|
129
|
-
const app = await veloxApp({
|
|
130
|
-
port: config.port,
|
|
131
|
-
host: config.host,
|
|
132
|
-
logger: config.logger,
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
// Register database plugin
|
|
136
|
-
await app.register(databasePlugin({ client: prisma }));
|
|
137
|
-
|
|
138
|
-
// Register static file serving for frontend
|
|
139
|
-
await app.server.register(fastifyStatic, {
|
|
140
|
-
root: path.join(process.cwd(), 'public'),
|
|
141
|
-
prefix: '/',
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
// Register all procedures
|
|
145
|
-
const collections = [healthProcedures, userProcedures];
|
|
146
|
-
app.routes(rest(collections, { prefix: config.apiPrefix }));
|
|
147
|
-
|
|
148
|
-
return { app, collections };
|
|
35
|
+
return compileTemplate('api/index.default.ts', DEFAULT_CONFIG);
|
|
149
36
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const divider = '═'.repeat(50);
|
|
153
|
-
|
|
154
|
-
console.log(\`\\n\${divider}\`);
|
|
155
|
-
console.log(\` VeloxTS Application v\${VELOX_VERSION}\`);
|
|
156
|
-
console.log(\` Environment: \${config.env}\`);
|
|
157
|
-
console.log(divider);
|
|
158
|
-
|
|
159
|
-
// Print registered routes
|
|
160
|
-
const routes = getRouteSummary(collections);
|
|
161
|
-
console.log('\\n📍 Registered Routes:\\n');
|
|
162
|
-
|
|
163
|
-
for (const route of routes) {
|
|
164
|
-
const method = route.method.padEnd(6);
|
|
165
|
-
const path = route.path.padEnd(25);
|
|
166
|
-
console.log(\` \${method} \${path} → \${route.namespace}.\${route.procedure}\`);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
console.log(\`\\n\${divider}\`);
|
|
170
|
-
console.log(\` Frontend: http://localhost:\${config.port}\`);
|
|
171
|
-
console.log(\` REST API: http://localhost:\${config.port}\${config.apiPrefix}\`);
|
|
172
|
-
console.log(\`\${divider}\\n\`);
|
|
37
|
+
function generateConfigApp(config) {
|
|
38
|
+
return compileTemplate('api/config/app.ts', config);
|
|
173
39
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
try {
|
|
177
|
-
const { app, collections } = await createApp();
|
|
178
|
-
await app.start();
|
|
179
|
-
printBanner(collections);
|
|
180
|
-
} catch (error) {
|
|
181
|
-
console.error('Failed to start application:', error);
|
|
182
|
-
process.exit(1);
|
|
183
|
-
}
|
|
40
|
+
function generateConfigDatabase() {
|
|
41
|
+
return compileTemplate('api/config/database.ts', DEFAULT_CONFIG);
|
|
184
42
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
`;
|
|
188
|
-
}
|
|
189
|
-
function generateDatabaseIndex() {
|
|
190
|
-
return `/**
|
|
191
|
-
* Database Client (Prisma 7.x)
|
|
192
|
-
*
|
|
193
|
-
* Prisma 7 requires:
|
|
194
|
-
* - Generated client from custom output path
|
|
195
|
-
* - Driver adapter for database connections
|
|
196
|
-
*/
|
|
197
|
-
|
|
198
|
-
import { PrismaBetterSqlite3 } from '@prisma/adapter-better-sqlite3';
|
|
199
|
-
|
|
200
|
-
import { PrismaClient } from '../generated/prisma/client.js';
|
|
201
|
-
|
|
202
|
-
// Validate DATABASE_URL is set
|
|
203
|
-
if (!process.env.DATABASE_URL) {
|
|
204
|
-
throw new Error('DATABASE_URL environment variable is required');
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// Create SQLite adapter with database URL from environment
|
|
208
|
-
const adapter = new PrismaBetterSqlite3({ url: process.env.DATABASE_URL });
|
|
209
|
-
|
|
210
|
-
// Export configured Prisma client
|
|
211
|
-
export const prisma = new PrismaClient({ adapter });
|
|
212
|
-
`;
|
|
213
|
-
}
|
|
214
|
-
function generateProceduresIndex() {
|
|
215
|
-
return `/**
|
|
216
|
-
* Procedure Exports
|
|
217
|
-
*/
|
|
218
|
-
|
|
219
|
-
export * from './health.js';
|
|
220
|
-
export * from './users.js';
|
|
221
|
-
`;
|
|
43
|
+
function generateHealthProcedures() {
|
|
44
|
+
return compileTemplate('api/procedures/health.ts', DEFAULT_CONFIG);
|
|
222
45
|
}
|
|
223
46
|
function generateUserProcedures() {
|
|
224
|
-
return
|
|
225
|
-
* User Procedures
|
|
226
|
-
*/
|
|
227
|
-
|
|
228
|
-
import { defineProcedures, procedure, paginationInputSchema, z } from '@veloxts/velox';
|
|
229
|
-
|
|
230
|
-
import { CreateUserInput, UpdateUserInput, UserSchema } from '../schemas/user.js';
|
|
231
|
-
|
|
232
|
-
// Database types
|
|
233
|
-
interface DbUser {
|
|
234
|
-
id: string;
|
|
235
|
-
name: string;
|
|
236
|
-
email: string;
|
|
237
|
-
createdAt: Date;
|
|
238
|
-
updatedAt: Date;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
interface DbClient {
|
|
242
|
-
user: {
|
|
243
|
-
findUnique: (args: { where: { id: string } }) => Promise<DbUser | null>;
|
|
244
|
-
findMany: (args?: { skip?: number; take?: number }) => Promise<DbUser[]>;
|
|
245
|
-
create: (args: { data: { name: string; email: string } }) => Promise<DbUser>;
|
|
246
|
-
update: (args: { where: { id: string }; data: { name?: string; email?: string } }) => Promise<DbUser>;
|
|
247
|
-
delete: (args: { where: { id: string } }) => Promise<DbUser>;
|
|
248
|
-
count: () => Promise<number>;
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
function getDb(ctx: { db: unknown }): DbClient {
|
|
253
|
-
return ctx.db as DbClient;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
function toUserResponse(dbUser: DbUser) {
|
|
257
|
-
return {
|
|
258
|
-
id: dbUser.id,
|
|
259
|
-
name: dbUser.name,
|
|
260
|
-
email: dbUser.email,
|
|
261
|
-
createdAt: dbUser.createdAt.toISOString(),
|
|
262
|
-
updatedAt: dbUser.updatedAt.toISOString(),
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
export const userProcedures = defineProcedures('users', {
|
|
267
|
-
getUser: procedure()
|
|
268
|
-
.input(z.object({ id: z.string().uuid() }))
|
|
269
|
-
.output(UserSchema.nullable())
|
|
270
|
-
.query(async ({ input, ctx }) => {
|
|
271
|
-
const db = getDb(ctx);
|
|
272
|
-
const user = await db.user.findUnique({ where: { id: input.id } });
|
|
273
|
-
return user ? toUserResponse(user) : null;
|
|
274
|
-
}),
|
|
275
|
-
|
|
276
|
-
listUsers: procedure()
|
|
277
|
-
.input(paginationInputSchema.optional())
|
|
278
|
-
.output(
|
|
279
|
-
z.object({
|
|
280
|
-
data: z.array(UserSchema),
|
|
281
|
-
meta: z.object({
|
|
282
|
-
page: z.number(),
|
|
283
|
-
limit: z.number(),
|
|
284
|
-
total: z.number(),
|
|
285
|
-
}),
|
|
286
|
-
})
|
|
287
|
-
)
|
|
288
|
-
.query(async ({ input, ctx }) => {
|
|
289
|
-
const db = getDb(ctx);
|
|
290
|
-
const page = input?.page ?? 1;
|
|
291
|
-
const limit = input?.limit ?? 10;
|
|
292
|
-
const skip = (page - 1) * limit;
|
|
293
|
-
|
|
294
|
-
const [dbUsers, total] = await Promise.all([
|
|
295
|
-
db.user.findMany({ skip, take: limit }),
|
|
296
|
-
db.user.count(),
|
|
297
|
-
]);
|
|
298
|
-
|
|
299
|
-
return {
|
|
300
|
-
data: dbUsers.map(toUserResponse),
|
|
301
|
-
meta: { page, limit, total },
|
|
302
|
-
};
|
|
303
|
-
}),
|
|
304
|
-
|
|
305
|
-
createUser: procedure()
|
|
306
|
-
.input(CreateUserInput)
|
|
307
|
-
.output(UserSchema)
|
|
308
|
-
.mutation(async ({ input, ctx }) => {
|
|
309
|
-
const db = getDb(ctx);
|
|
310
|
-
const user = await db.user.create({ data: input });
|
|
311
|
-
return toUserResponse(user);
|
|
312
|
-
}),
|
|
313
|
-
|
|
314
|
-
updateUser: procedure()
|
|
315
|
-
.input(z.object({ id: z.string().uuid() }).merge(UpdateUserInput))
|
|
316
|
-
.output(UserSchema)
|
|
317
|
-
.mutation(async ({ input, ctx }) => {
|
|
318
|
-
const db = getDb(ctx);
|
|
319
|
-
const { id, ...data } = input;
|
|
320
|
-
const user = await db.user.update({ where: { id }, data });
|
|
321
|
-
return toUserResponse(user);
|
|
322
|
-
}),
|
|
323
|
-
|
|
324
|
-
patchUser: procedure()
|
|
325
|
-
.input(z.object({ id: z.string().uuid() }).merge(UpdateUserInput))
|
|
326
|
-
.output(UserSchema)
|
|
327
|
-
.mutation(async ({ input, ctx }) => {
|
|
328
|
-
const db = getDb(ctx);
|
|
329
|
-
const { id, ...data } = input;
|
|
330
|
-
const user = await db.user.update({ where: { id }, data });
|
|
331
|
-
return toUserResponse(user);
|
|
332
|
-
}),
|
|
333
|
-
|
|
334
|
-
deleteUser: procedure()
|
|
335
|
-
.input(z.object({ id: z.string().uuid() }))
|
|
336
|
-
.output(z.object({ success: z.boolean() }))
|
|
337
|
-
.mutation(async ({ input, ctx }) => {
|
|
338
|
-
const db = getDb(ctx);
|
|
339
|
-
await db.user.delete({ where: { id: input.id } });
|
|
340
|
-
return { success: true };
|
|
341
|
-
}),
|
|
342
|
-
});
|
|
343
|
-
`;
|
|
344
|
-
}
|
|
345
|
-
function generateSchemasIndex() {
|
|
346
|
-
return `/**
|
|
347
|
-
* Schema Exports
|
|
348
|
-
*/
|
|
349
|
-
|
|
350
|
-
export * from './user.js';
|
|
351
|
-
`;
|
|
47
|
+
return compileTemplate('api/procedures/users.default.ts', DEFAULT_CONFIG);
|
|
352
48
|
}
|
|
353
49
|
function generateUserSchema() {
|
|
354
|
-
return
|
|
355
|
-
* User Schemas
|
|
356
|
-
*/
|
|
357
|
-
|
|
358
|
-
import { createIdSchema, emailSchema, z } from '@veloxts/velox';
|
|
359
|
-
|
|
360
|
-
export const UserSchema = z.object({
|
|
361
|
-
id: createIdSchema('uuid'),
|
|
362
|
-
name: z.string().min(1).max(100),
|
|
363
|
-
email: emailSchema,
|
|
364
|
-
createdAt: z.coerce.date().transform((d) => d.toISOString()),
|
|
365
|
-
updatedAt: z.coerce.date().transform((d) => d.toISOString()),
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
export type User = z.infer<typeof UserSchema>;
|
|
369
|
-
|
|
370
|
-
export const CreateUserInput = z.object({
|
|
371
|
-
name: z.string().min(1).max(100),
|
|
372
|
-
email: emailSchema,
|
|
373
|
-
});
|
|
374
|
-
|
|
375
|
-
export type CreateUserData = z.infer<typeof CreateUserInput>;
|
|
376
|
-
|
|
377
|
-
export const UpdateUserInput = z.object({
|
|
378
|
-
name: z.string().min(1).max(100).optional(),
|
|
379
|
-
email: emailSchema.optional(),
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
export type UpdateUserData = z.infer<typeof UpdateUserInput>;
|
|
383
|
-
`;
|
|
384
|
-
}
|
|
385
|
-
// ============================================================================
|
|
386
|
-
// CLAUDE.md
|
|
387
|
-
// ============================================================================
|
|
388
|
-
function generateClaudeMd(config) {
|
|
389
|
-
return `# CLAUDE.md
|
|
390
|
-
|
|
391
|
-
This file provides guidance to Claude Code and other AI assistants when working with this VeloxTS project.
|
|
392
|
-
|
|
393
|
-
## Project Overview
|
|
394
|
-
|
|
395
|
-
**${config.projectName}** is a VeloxTS application - a TypeScript full-stack framework built on Fastify, tRPC, Prisma, and Zod.
|
|
396
|
-
|
|
397
|
-
**Key Characteristics:**
|
|
398
|
-
- Type safety without code generation (direct type imports)
|
|
399
|
-
- Hybrid API: tRPC for internal, REST for external
|
|
400
|
-
- Convention over configuration
|
|
401
|
-
- Laravel-inspired developer experience
|
|
402
|
-
|
|
403
|
-
## Commands
|
|
404
|
-
|
|
405
|
-
\`\`\`bash
|
|
406
|
-
${config.packageManager} dev # Start development server with hot reload
|
|
407
|
-
${config.packageManager} build # Build for production
|
|
408
|
-
${config.packageManager} start # Run production server
|
|
409
|
-
${config.packageManager} db:push # Push database schema changes
|
|
410
|
-
${config.packageManager} db:generate # Regenerate Prisma client
|
|
411
|
-
${config.packageManager} db:studio # Open Prisma Studio GUI
|
|
412
|
-
${config.packageManager} type-check # Run TypeScript type checking
|
|
413
|
-
\`\`\`
|
|
414
|
-
|
|
415
|
-
## Project Structure
|
|
416
|
-
|
|
417
|
-
\`\`\`
|
|
418
|
-
src/
|
|
419
|
-
├── config/ # Application configuration
|
|
420
|
-
├── database/ # Prisma client setup
|
|
421
|
-
├── procedures/ # API procedures (business logic)
|
|
422
|
-
├── schemas/ # Zod validation schemas
|
|
423
|
-
├── generated/ # Generated Prisma client (git-ignored)
|
|
424
|
-
└── index.ts # Application entry point
|
|
425
|
-
|
|
426
|
-
prisma/
|
|
427
|
-
└── schema.prisma # Database schema
|
|
428
|
-
|
|
429
|
-
public/ # Static files served at /
|
|
430
|
-
\`\`\`
|
|
431
|
-
|
|
432
|
-
## Procedure Naming Conventions
|
|
433
|
-
|
|
434
|
-
Procedure names automatically map to HTTP methods and routes:
|
|
435
|
-
|
|
436
|
-
| Procedure Name | HTTP Method | Route | Status Code |
|
|
437
|
-
|----------------|-------------|-------|-------------|
|
|
438
|
-
| \`getUser\` | GET | \`/users/:id\` | 200 |
|
|
439
|
-
| \`listUsers\` | GET | \`/users\` | 200 |
|
|
440
|
-
| \`findUsers\` | GET | \`/users\` | 200 |
|
|
441
|
-
| \`createUser\` | POST | \`/users\` | 201 |
|
|
442
|
-
| \`addUser\` | POST | \`/users\` | 201 |
|
|
443
|
-
| \`updateUser\` | PUT | \`/users/:id\` | 200 |
|
|
444
|
-
| \`editUser\` | PUT | \`/users/:id\` | 200 |
|
|
445
|
-
| \`patchUser\` | PATCH | \`/users/:id\` | 200 |
|
|
446
|
-
| \`deleteUser\` | DELETE | \`/users/:id\` | 200/204 |
|
|
447
|
-
| \`removeUser\` | DELETE | \`/users/:id\` | 200/204 |
|
|
448
|
-
|
|
449
|
-
## Creating a New Procedure
|
|
450
|
-
|
|
451
|
-
\`\`\`typescript
|
|
452
|
-
// src/procedures/posts.ts
|
|
453
|
-
import { defineProcedures, procedure, z } from '@veloxts/velox';
|
|
454
|
-
|
|
455
|
-
export const postProcedures = defineProcedures('posts', {
|
|
456
|
-
// GET /api/posts/:id
|
|
457
|
-
getPost: procedure()
|
|
458
|
-
.input(z.object({ id: z.string().uuid() }))
|
|
459
|
-
.output(PostSchema)
|
|
460
|
-
.query(async ({ input, ctx }) => {
|
|
461
|
-
return ctx.db.post.findUnique({ where: { id: input.id } });
|
|
462
|
-
}),
|
|
463
|
-
|
|
464
|
-
// POST /api/posts
|
|
465
|
-
createPost: procedure()
|
|
466
|
-
.input(CreatePostSchema)
|
|
467
|
-
.output(PostSchema)
|
|
468
|
-
.mutation(async ({ input, ctx }) => {
|
|
469
|
-
return ctx.db.post.create({ data: input });
|
|
470
|
-
}),
|
|
471
|
-
});
|
|
472
|
-
\`\`\`
|
|
473
|
-
|
|
474
|
-
Then register in \`src/procedures/index.ts\` and add to collections in \`src/index.ts\`.
|
|
475
|
-
|
|
476
|
-
## Type Safety
|
|
477
|
-
|
|
478
|
-
VeloxTS provides end-to-end type safety without code generation:
|
|
479
|
-
|
|
480
|
-
- **Zod schemas** define validation and infer TypeScript types
|
|
481
|
-
- **Procedures** chain \`.input()\` and \`.output()\` for full type inference
|
|
482
|
-
- **Context** provides typed access to database (\`ctx.db\`)
|
|
483
|
-
- Import types directly: \`import type { User } from './schemas/user.js'\`
|
|
484
|
-
|
|
485
|
-
## Database (Prisma)
|
|
486
|
-
|
|
487
|
-
- Schema: \`prisma/schema.prisma\`
|
|
488
|
-
- Config: \`prisma.config.ts\` (Prisma 7.x style)
|
|
489
|
-
- Client: Generated to \`src/generated/prisma/\`
|
|
490
|
-
- Access via context: \`ctx.db.user.findMany()\`
|
|
491
|
-
|
|
492
|
-
After schema changes:
|
|
493
|
-
\`\`\`bash
|
|
494
|
-
${config.packageManager} db:push # Apply changes to database
|
|
495
|
-
${config.packageManager} db:generate # Regenerate client types
|
|
496
|
-
\`\`\`
|
|
497
|
-
|
|
498
|
-
## Environment Variables
|
|
499
|
-
|
|
500
|
-
Configured in \`.env\`:
|
|
501
|
-
- \`DATABASE_URL\` - Database connection string
|
|
502
|
-
- \`PORT\` - Server port (default: 3210)
|
|
503
|
-
- \`HOST\` - Server host (default: 0.0.0.0)
|
|
504
|
-
- \`NODE_ENV\` - Environment (development/production)
|
|
505
|
-
- \`API_PREFIX\` - API route prefix (default: /api)
|
|
506
|
-
|
|
507
|
-
## Code Style
|
|
508
|
-
|
|
509
|
-
- Use Zod for all input/output validation
|
|
510
|
-
- Keep procedures focused - one operation per procedure
|
|
511
|
-
- Use descriptive names following conventions
|
|
512
|
-
- Colocate schemas with their procedures when simple
|
|
513
|
-
- Extract to \`src/schemas/\` when shared across procedures
|
|
514
|
-
`;
|
|
50
|
+
return compileTemplate('api/schemas/user.ts', DEFAULT_CONFIG);
|
|
515
51
|
}
|
|
516
52
|
// ============================================================================
|
|
517
53
|
// Default Template Generator
|
|
518
54
|
// ============================================================================
|
|
519
55
|
export function generateDefaultTemplate(config) {
|
|
520
56
|
const files = [
|
|
521
|
-
//
|
|
522
|
-
{ path: 'package.json', content:
|
|
523
|
-
{ path: '.
|
|
524
|
-
{ path: '.
|
|
525
|
-
{ path: '
|
|
57
|
+
// API package files
|
|
58
|
+
{ path: 'apps/api/package.json', content: generateApiPackageJson(config) },
|
|
59
|
+
{ path: 'apps/api/tsconfig.json', content: generateApiTsConfig() },
|
|
60
|
+
{ path: 'apps/api/tsup.config.ts', content: generateApiTsupConfig() },
|
|
61
|
+
{ path: 'apps/api/prisma.config.ts', content: generatePrismaConfig() },
|
|
62
|
+
{ path: 'apps/api/.env.example', content: generateEnvExample(config) },
|
|
63
|
+
{ path: 'apps/api/.env', content: generateEnvExample(config) },
|
|
526
64
|
// Prisma
|
|
527
|
-
{ path: 'prisma/schema.prisma', content: generatePrismaSchema() },
|
|
528
|
-
// Source files
|
|
529
|
-
{ path: 'src/index.ts', content: generateIndexTs() },
|
|
530
|
-
{ path: 'src/
|
|
531
|
-
{ path: 'src/
|
|
532
|
-
{ path: 'src/procedures/
|
|
533
|
-
{ path: 'src/
|
|
534
|
-
{ path: 'src/schemas/user.ts', content: generateUserSchema() },
|
|
65
|
+
{ path: 'apps/api/prisma/schema.prisma', content: generatePrismaSchema() },
|
|
66
|
+
// API Source files
|
|
67
|
+
{ path: 'apps/api/src/index.ts', content: generateIndexTs() },
|
|
68
|
+
{ path: 'apps/api/src/config/app.ts', content: generateConfigApp(config) },
|
|
69
|
+
{ path: 'apps/api/src/config/database.ts', content: generateConfigDatabase() },
|
|
70
|
+
{ path: 'apps/api/src/procedures/health.ts', content: generateHealthProcedures() },
|
|
71
|
+
{ path: 'apps/api/src/procedures/users.ts', content: generateUserProcedures() },
|
|
72
|
+
{ path: 'apps/api/src/schemas/user.ts', content: generateUserSchema() },
|
|
535
73
|
];
|
|
536
|
-
// Add
|
|
537
|
-
|
|
74
|
+
// Add root workspace files
|
|
75
|
+
const rootFiles = generateRootFiles(config, false);
|
|
76
|
+
// Add web package files
|
|
77
|
+
const webBaseFiles = generateWebBaseFiles(config, false);
|
|
78
|
+
const webStyleFiles = generateWebStyleFiles();
|
|
79
|
+
return [...files, ...rootFiles, ...webBaseFiles, ...webStyleFiles];
|
|
538
80
|
}
|
|
539
81
|
//# sourceMappingURL=default.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../src/templates/default.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../src/templates/default.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAGnG,+EAA+E;AAC/E,2BAA2B;AAC3B,+EAA+E;AAE/E,SAAS,sBAAsB,CAAC,MAAsB;IACpD,OAAO,eAAe,CAAC,0BAA0B,EAAE,MAAM,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,mBAAmB;IAC1B,OAAO,eAAe,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,qBAAqB;IAC5B,OAAO,eAAe,CAAC,oBAAoB,EAAE,cAAc,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAsB;IAChD,OAAO,eAAe,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,oBAAoB;IAC3B,OAAO,eAAe,CAAC,kCAAkC,EAAE,cAAc,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,oBAAoB;IAC3B,OAAO,eAAe,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,eAAe;IACtB,OAAO,eAAe,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAsB;IAC/C,OAAO,eAAe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B,eAAe,EACf,eAAe,EACf,iBAAiB,GAClB,CAAC;AAMF;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,YAAY,EAAE,CAO5E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,YAAY,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,iBAAiB,GAClB,CAAC;AAMF;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,YAAY,EAAE,CAO5E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,YAAY,GAAG,MAAM,EAAE,CAuBxE"}
|
package/dist/templates/index.js
CHANGED
|
@@ -30,16 +30,25 @@ export function generateTemplateFiles(config) {
|
|
|
30
30
|
* Get directories that need to be created for the template
|
|
31
31
|
*/
|
|
32
32
|
export function getTemplateDirectories(_template) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
'
|
|
37
|
-
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
33
|
+
// Workspace-based directory structure
|
|
34
|
+
return [
|
|
35
|
+
// Root
|
|
36
|
+
'apps',
|
|
37
|
+
// API package
|
|
38
|
+
'apps/api',
|
|
39
|
+
'apps/api/src',
|
|
40
|
+
'apps/api/src/config',
|
|
41
|
+
'apps/api/src/database',
|
|
42
|
+
'apps/api/src/procedures',
|
|
43
|
+
'apps/api/src/schemas',
|
|
44
|
+
'apps/api/prisma',
|
|
45
|
+
// Web package
|
|
46
|
+
'apps/web',
|
|
47
|
+
'apps/web/src',
|
|
48
|
+
'apps/web/src/routes',
|
|
49
|
+
'apps/web/src/styles',
|
|
50
|
+
'apps/web/src/components',
|
|
51
|
+
'apps/web/public',
|
|
41
52
|
];
|
|
42
|
-
// All templates use the same directory structure currently
|
|
43
|
-
return baseDirectories;
|
|
44
53
|
}
|
|
45
54
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,+EAA+E;AAC/E,aAAa;AACb,+EAA+E;AAE/E,OAAO,EAAE,eAAe,EAAE,CAAC;AAU3B,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,iBAAiB,GAClB,CAAC;AAEF,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,M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qB;QACrB,uBAAuB;QACvB,yBAAyB;QACzB,sBAAsB;QACtB,iBAAiB;QAEjB,cAAc;QACd,UAAU;QACV,cAAc;QACd,qBAAqB;QACrB,qBAAqB;QACrB,yBAAyB;QACzB,iBAAiB;KAClB,CAAC;AACJ,CAAC"}
|