prisma-generator-express 1.18.0 → 1.20.0

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.
Files changed (76) hide show
  1. package/README.md +399 -194
  2. package/dist/bin.d.ts +2 -0
  3. package/dist/bin.js +1 -1
  4. package/dist/bin.js.map +1 -1
  5. package/dist/client/encodeQueryParams.d.ts +1 -0
  6. package/dist/client/encodeQueryParams.js +33 -0
  7. package/dist/client/encodeQueryParams.js.map +1 -0
  8. package/dist/constants.d.ts +1 -0
  9. package/dist/copy/misc.d.ts +5 -0
  10. package/dist/copy/misc.js +52 -0
  11. package/dist/copy/misc.js.map +1 -0
  12. package/dist/generators/generateImportPrismaStatement.d.ts +3 -0
  13. package/dist/generators/generateImportPrismaStatement.js +55 -0
  14. package/dist/generators/generateImportPrismaStatement.js.map +1 -0
  15. package/dist/generators/generateQueryBuilderHelper.d.ts +2 -0
  16. package/dist/generators/generateQueryBuilderHelper.js +139 -0
  17. package/dist/generators/generateQueryBuilderHelper.js.map +1 -0
  18. package/dist/generators/generateRouter.d.ts +6 -0
  19. package/dist/generators/generateRouter.js +340 -0
  20. package/dist/generators/generateRouter.js.map +1 -0
  21. package/dist/generators/generateUnifiedDocs.d.ts +1 -0
  22. package/dist/generators/generateUnifiedDocs.js +171 -0
  23. package/dist/generators/generateUnifiedDocs.js.map +1 -0
  24. package/dist/generators/generateUnifiedHandler.d.ts +6 -0
  25. package/dist/generators/generateUnifiedHandler.js +444 -0
  26. package/dist/generators/generateUnifiedHandler.js.map +1 -0
  27. package/dist/generators/generateUnifiedScalarUI.d.ts +5 -0
  28. package/dist/generators/generateUnifiedScalarUI.js +1390 -0
  29. package/dist/generators/generateUnifiedScalarUI.js.map +1 -0
  30. package/dist/index.d.ts +1 -0
  31. package/dist/index.js +80 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/utils/copyFiles.d.ts +6 -0
  34. package/dist/utils/copyFiles.js +123 -21
  35. package/dist/utils/copyFiles.js.map +1 -1
  36. package/dist/utils/strings.d.ts +2 -0
  37. package/dist/utils/writeFileSafely.d.ts +10 -0
  38. package/dist/utils/writeFileSafely.js +86 -14
  39. package/dist/utils/writeFileSafely.js.map +1 -1
  40. package/package.json +59 -28
  41. package/src/bin.ts +1 -1
  42. package/src/client/encodeQueryParams.ts +56 -0
  43. package/src/copy/buildModelOpenApi.ts +1569 -0
  44. package/src/copy/misc.ts +21 -0
  45. package/src/copy/operationDefinitions.ts +96 -0
  46. package/src/copy/parseQueryParams.ts +36 -21
  47. package/src/copy/routeConfig.ts +68 -28
  48. package/src/generators/generateImportPrismaStatement.ts +78 -0
  49. package/src/generators/generateQueryBuilderHelper.ts +138 -0
  50. package/src/generators/generateRouter.ts +352 -0
  51. package/src/generators/generateUnifiedDocs.ts +168 -0
  52. package/src/generators/generateUnifiedHandler.ts +469 -0
  53. package/src/generators/generateUnifiedScalarUI.ts +1409 -0
  54. package/src/index.ts +100 -0
  55. package/src/utils/copyFiles.ts +123 -16
  56. package/src/utils/writeFileSafely.ts +79 -25
  57. package/dist/generator.js +0 -47
  58. package/dist/generator.js.map +0 -1
  59. package/dist/helpers/generateImportPrismaStatement.js +0 -25
  60. package/dist/helpers/generateImportPrismaStatement.js.map +0 -1
  61. package/dist/helpers/generateOperation.js +0 -471
  62. package/dist/helpers/generateOperation.js.map +0 -1
  63. package/dist/helpers/generateRouteFile.js +0 -210
  64. package/dist/helpers/generateRouteFile.js.map +0 -1
  65. package/dist/utils/formatFile.js +0 -26
  66. package/dist/utils/formatFile.js.map +0 -1
  67. package/src/copy/encodeQueryParams.spec.ts +0 -303
  68. package/src/copy/encodeQueryParams.ts +0 -44
  69. package/src/copy/misc.spec.ts +0 -62
  70. package/src/copy/parseQueryParams.spec.ts +0 -187
  71. package/src/copy/transformZod.spec.ts +0 -763
  72. package/src/generator.ts +0 -54
  73. package/src/helpers/generateImportPrismaStatement.ts +0 -38
  74. package/src/helpers/generateOperation.ts +0 -515
  75. package/src/helpers/generateRouteFile.ts +0 -213
  76. package/src/utils/formatFile.ts +0 -22
@@ -0,0 +1,444 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateUnifiedHandler = generateUnifiedHandler;
4
+ function generateUnifiedHandler(options) {
5
+ const { model, prismaImportStatement } = options;
6
+ const modelName = model.name;
7
+ const modelNameLower = modelName.charAt(0).toLowerCase() + modelName.slice(1);
8
+ const importPath = prismaImportStatement.match(/from ['"](.+?)['"]/)?.[1] || '';
9
+ return `
10
+ import { Prisma, PrismaClient } from '${importPath}'
11
+ import { Request, Response, NextFunction } from 'express'
12
+ import { sanitizeKeys } from '../misc'
13
+
14
+ let _speedExtension: ((opts: any) => any) | null = null
15
+
16
+ const _prismasqlModule = 'prisma-' + 'sql'
17
+ const _prismasqlReady = (async () => {
18
+ try {
19
+ const mod = await import(_prismasqlModule)
20
+ _speedExtension = mod.speedExtension ?? mod.default?.speedExtension ?? null
21
+ } catch (err: any) {
22
+ const code = err?.code
23
+ if (code !== 'MODULE_NOT_FOUND' && code !== 'ERR_MODULE_NOT_FOUND') {
24
+ console.warn('[prisma-generator-express] prisma-sql initialization failed:', err)
25
+ }
26
+ }
27
+ })()
28
+
29
+ const _extendedClients = new WeakMap<object, WeakMap<object, PrismaClient>>()
30
+
31
+ const DISTINCT_COUNT_LIMIT = 100000
32
+
33
+ export class HttpError extends Error {
34
+ status: number
35
+ constructor(status: number, message: string) {
36
+ super(message)
37
+ this.name = 'HttpError'
38
+ this.status = status
39
+ }
40
+ }
41
+
42
+ const PRISMA_ERROR_MAP: Record<string, { status: number; message: string }> = {
43
+ P2000: { status: 400, message: 'Value too long for column' },
44
+ P2001: { status: 404, message: 'Record not found' },
45
+ P2002: { status: 409, message: 'Unique constraint violation' },
46
+ P2003: { status: 400, message: 'Foreign key constraint failed' },
47
+ P2004: { status: 400, message: 'Constraint failed on the database' },
48
+ P2005: { status: 400, message: 'Invalid field value' },
49
+ P2006: { status: 400, message: 'Invalid value provided' },
50
+ P2007: { status: 400, message: 'Data validation error' },
51
+ P2008: { status: 400, message: 'Failed to parse the query' },
52
+ P2009: { status: 400, message: 'Failed to validate the query' },
53
+ P2010: { status: 500, message: 'Raw query failed' },
54
+ P2011: { status: 400, message: 'Null constraint violation' },
55
+ P2012: { status: 400, message: 'Missing required value' },
56
+ P2013: { status: 400, message: 'Missing required argument' },
57
+ P2014: { status: 400, message: 'Required relation violation' },
58
+ P2015: { status: 404, message: 'Related record not found' },
59
+ P2016: { status: 400, message: 'Query interpretation error' },
60
+ P2017: { status: 400, message: 'Records not connected' },
61
+ P2018: { status: 404, message: 'Required connected record not found' },
62
+ P2019: { status: 400, message: 'Input error' },
63
+ P2020: { status: 400, message: 'Value out of range for the field type' },
64
+ P2021: { status: 500, message: 'Table does not exist in the database' },
65
+ P2022: { status: 500, message: 'Column does not exist in the database' },
66
+ P2023: { status: 500, message: 'Inconsistent column data' },
67
+ P2024: { status: 503, message: 'Connection pool timeout' },
68
+ P2025: { status: 404, message: 'Record not found' },
69
+ P2026: { status: 501, message: 'Feature not supported by the current database provider' },
70
+ P2028: { status: 500, message: 'Transaction API error' },
71
+ P2030: { status: 400, message: 'Cannot find a fulltext index for the search' },
72
+ P2033: { status: 400, message: 'Number out of range for the field type' },
73
+ P2034: { status: 409, message: 'Transaction conflict, please retry' },
74
+ }
75
+
76
+ async function getExtendedClient(req: Request): Promise<PrismaClient> {
77
+ const base = (req as any).prisma as PrismaClient
78
+ if (!base) {
79
+ throw new HttpError(500, 'PrismaClient not found on request. Set req.prisma in middleware.')
80
+ }
81
+
82
+ await _prismasqlReady
83
+
84
+ if (!_speedExtension) return base
85
+
86
+ const connector = (req as any).postgres || (req as any).sqlite
87
+ if (!connector) return base
88
+
89
+ if (typeof connector === 'object' && connector !== null) {
90
+ const innerMap = _extendedClients.get(connector)
91
+ if (innerMap) {
92
+ const cached = innerMap.get(base)
93
+ if (cached) return cached
94
+ }
95
+ }
96
+
97
+ try {
98
+ const extended = base.$extends(_speedExtension({
99
+ postgres: (req as any).postgres,
100
+ sqlite: (req as any).sqlite,
101
+ debug: process.env.DEBUG === 'true'
102
+ })) as unknown as PrismaClient
103
+
104
+ if (typeof connector === 'object' && connector !== null) {
105
+ let innerMap = _extendedClients.get(connector)
106
+ if (!innerMap) {
107
+ innerMap = new WeakMap<object, PrismaClient>()
108
+ _extendedClients.set(connector, innerMap)
109
+ }
110
+ innerMap.set(base, extended)
111
+ }
112
+
113
+ return extended
114
+ } catch (error) {
115
+ console.warn('[speedExtension] Failed to initialize, using base client:', error)
116
+ return base
117
+ }
118
+ }
119
+
120
+ function handleError(error: unknown, next: NextFunction): void {
121
+ if (error instanceof HttpError) {
122
+ next(error)
123
+ return
124
+ }
125
+
126
+ if (error && typeof error === 'object' && 'name' in error && error.name === 'ShapeError') {
127
+ next(new HttpError(400, (error as Error).message))
128
+ return
129
+ }
130
+
131
+ if (error && typeof error === 'object' && 'name' in error && error.name === 'CallerError') {
132
+ next(new HttpError(400, (error as Error).message))
133
+ return
134
+ }
135
+
136
+ if (error && typeof error === 'object' && 'name' in error && error.name === 'PolicyError') {
137
+ next(new HttpError(403, (error as Error).message))
138
+ return
139
+ }
140
+
141
+ if (error && typeof error === 'object' && 'code' in error) {
142
+ const code = (error as any).code as string
143
+ const mapped = PRISMA_ERROR_MAP[code]
144
+ if (mapped) {
145
+ next(new HttpError(mapped.status, mapped.message))
146
+ return
147
+ }
148
+ if (typeof code === 'string' && code.startsWith('P')) {
149
+ next(new HttpError(500, 'Database operation failed'))
150
+ return
151
+ }
152
+ }
153
+
154
+ if (error && typeof error === 'object' && 'name' in error) {
155
+ const name = (error as any).name
156
+ if (name === 'PrismaClientValidationError') {
157
+ next(new HttpError(400, 'Invalid query parameters'))
158
+ return
159
+ }
160
+ }
161
+
162
+ console.error('[prisma-generator-express] Unhandled error:', error)
163
+ next(new HttpError(500, 'Internal server error'))
164
+ }
165
+
166
+ function safeParseBody(req: Request): Record<string, any> {
167
+ const body = req.body
168
+ if (!body || typeof body !== 'object' || Array.isArray(body)) {
169
+ throw new HttpError(400, 'Request body must be a JSON object')
170
+ }
171
+ return sanitizeKeys(body as Record<string, any>)
172
+ }
173
+
174
+ function requireBodyField(body: Record<string, any>, field: string): void {
175
+ if (!(field in body) || body[field] === undefined) {
176
+ throw new HttpError(400, 'Missing required field: ' + field)
177
+ }
178
+ }
179
+
180
+ function applyPaginationLimits(query: Record<string, any>, res: Response): Record<string, any> {
181
+ const routeConfig = res.locals.routeConfig
182
+ const pagination = routeConfig?.pagination
183
+ if (!pagination) return query
184
+
185
+ const result = { ...query }
186
+
187
+ if (result.take === undefined && pagination.defaultLimit !== undefined) {
188
+ result.take = pagination.defaultLimit
189
+ }
190
+
191
+ if (pagination.maxLimit !== undefined && result.take !== undefined) {
192
+ const takeNum = Number(result.take)
193
+ if (Math.abs(takeNum) > pagination.maxLimit) {
194
+ result.take = takeNum < 0 ? -pagination.maxLimit : pagination.maxLimit
195
+ }
196
+ }
197
+
198
+ return result
199
+ }
200
+
201
+ function normalizeDistinct(value: unknown): string[] {
202
+ if (typeof value === 'string') return [value]
203
+ if (Array.isArray(value)) return value.filter((v): v is string => typeof v === 'string')
204
+ return []
205
+ }
206
+
207
+ function assertGuard(delegate: any): void {
208
+ if (typeof delegate.guard !== 'function') {
209
+ throw new HttpError(500, 'Guard shapes require prisma-guard extension on PrismaClient. Install: npm install prisma-guard, then extend your client with guardExtension().')
210
+ }
211
+ }
212
+
213
+ ${generateReadHandlers(modelName, modelNameLower)}
214
+
215
+ ${generateWriteHandlers(modelName, modelNameLower)}
216
+ `;
217
+ }
218
+ function generateReadHandlers(modelName, modelNameLower) {
219
+ const standardReadOps = [
220
+ 'findFirst',
221
+ 'findUnique',
222
+ 'findUniqueOrThrow',
223
+ 'findFirstOrThrow',
224
+ 'count',
225
+ 'aggregate',
226
+ 'groupBy',
227
+ ];
228
+ const standardHandlers = standardReadOps
229
+ .map((op) => {
230
+ const functionName = `${modelName}${op.charAt(0).toUpperCase() + op.slice(1)}`;
231
+ return `
232
+ export async function ${functionName}(
233
+ req: Request,
234
+ res: Response,
235
+ next: NextFunction
236
+ ) {
237
+ try {
238
+ const query = res.locals.parsedQuery || {}
239
+ const extended = await getExtendedClient(req)
240
+ const shape = res.locals.guardShape
241
+
242
+ let data
243
+ if (shape) {
244
+ assertGuard(extended.${modelNameLower})
245
+ const caller = res.locals.guardCaller
246
+ data = await extended.${modelNameLower}.guard(shape, caller).${op}(query)
247
+ } else {
248
+ data = await extended.${modelNameLower}.${op}(query)
249
+ }
250
+
251
+ res.locals.data = data
252
+ next()
253
+ } catch (error: unknown) {
254
+ handleError(error, next)
255
+ }
256
+ }
257
+ `;
258
+ })
259
+ .join('\n');
260
+ const findManyHandler = `
261
+ export async function ${modelName}FindMany(
262
+ req: Request,
263
+ res: Response,
264
+ next: NextFunction
265
+ ) {
266
+ try {
267
+ const rawQuery = res.locals.parsedQuery || {}
268
+ const query = applyPaginationLimits(rawQuery, res)
269
+ const extended = await getExtendedClient(req)
270
+ const shape = res.locals.guardShape
271
+
272
+ let data
273
+ if (shape) {
274
+ assertGuard(extended.${modelNameLower})
275
+ const caller = res.locals.guardCaller
276
+ data = await extended.${modelNameLower}.guard(shape, caller).findMany(query)
277
+ } else {
278
+ data = await extended.${modelNameLower}.findMany(query)
279
+ }
280
+
281
+ res.locals.data = data
282
+ next()
283
+ } catch (error: unknown) {
284
+ handleError(error, next)
285
+ }
286
+ }
287
+ `;
288
+ return findManyHandler + '\n' + standardHandlers;
289
+ }
290
+ function generateWriteHandlers(modelName, modelNameLower) {
291
+ const writeOps = [
292
+ { name: 'Create', method: 'create' },
293
+ { name: 'CreateMany', method: 'createMany' },
294
+ { name: 'CreateManyAndReturn', method: 'createManyAndReturn' },
295
+ { name: 'Update', method: 'update' },
296
+ {
297
+ name: 'UpdateMany',
298
+ method: 'updateMany',
299
+ requiredFields: ['where', 'data'],
300
+ },
301
+ {
302
+ name: 'UpdateManyAndReturn',
303
+ method: 'updateManyAndReturn',
304
+ requiredFields: ['where', 'data'],
305
+ },
306
+ { name: 'Delete', method: 'delete' },
307
+ { name: 'DeleteMany', method: 'deleteMany', requiredFields: ['where'] },
308
+ { name: 'Upsert', method: 'upsert' },
309
+ ];
310
+ return (writeOps
311
+ .map((op) => {
312
+ const functionName = `${modelName}${op.name}`;
313
+ const validationLines = (op.requiredFields || [])
314
+ .map((field) => ` requireBodyField(body, '${field}')`)
315
+ .join('\n');
316
+ return `
317
+ export async function ${functionName}(req: Request, res: Response, next: NextFunction) {
318
+ try {
319
+ const body = safeParseBody(req)
320
+ ${validationLines ? validationLines + '\n' : ''} const extended = await getExtendedClient(req)
321
+ const shape = res.locals.guardShape
322
+
323
+ let data
324
+ if (shape) {
325
+ assertGuard(extended.${modelNameLower})
326
+ const caller = res.locals.guardCaller
327
+ data = await extended.${modelNameLower}.guard(shape, caller).${op.method}(body)
328
+ } else {
329
+ data = await extended.${modelNameLower}.${op.method}(body)
330
+ }
331
+
332
+ res.locals.data = data
333
+ next()
334
+ } catch (error: unknown) {
335
+ handleError(error, next)
336
+ }
337
+ }
338
+ `;
339
+ })
340
+ .join('\n') +
341
+ `
342
+
343
+ async function countForPagination(
344
+ delegate: any,
345
+ query: Record<string, any>,
346
+ shape: Record<string, any> | undefined,
347
+ caller: string | undefined,
348
+ ): Promise<number> {
349
+ const distinctFields = normalizeDistinct(query.distinct)
350
+ const hasDistinct = distinctFields.length > 0
351
+
352
+ if (hasDistinct) {
353
+ const selectField = distinctFields[0]
354
+ const distinctArgs: Record<string, any> = {
355
+ where: query.where,
356
+ distinct: distinctFields,
357
+ select: { [selectField]: true },
358
+ take: DISTINCT_COUNT_LIMIT + 1,
359
+ }
360
+
361
+ const results = shape
362
+ ? await delegate.guard(shape, caller).findMany(distinctArgs)
363
+ : await delegate.findMany(distinctArgs)
364
+
365
+ if (results.length > DISTINCT_COUNT_LIMIT) {
366
+ console.warn('[prisma-generator-express] Distinct count exceeds ' + DISTINCT_COUNT_LIMIT + ', falling back to approximate total')
367
+ const countArgs: Record<string, any> = {}
368
+ if (query.where) countArgs.where = query.where
369
+ return shape
370
+ ? await delegate.guard(shape, caller).count(countArgs)
371
+ : await delegate.count(countArgs)
372
+ }
373
+
374
+ return results.length
375
+ }
376
+
377
+ const countArgs: Record<string, any> = {}
378
+ if (query.where) countArgs.where = query.where
379
+
380
+ return shape
381
+ ? await delegate.guard(shape, caller).count(countArgs)
382
+ : await delegate.count(countArgs)
383
+ }
384
+
385
+ export async function ${modelName}FindManyPaginated(req: Request, res: Response, next: NextFunction) {
386
+ try {
387
+ const rawQuery = res.locals.parsedQuery || {}
388
+ const query = applyPaginationLimits(rawQuery, res)
389
+ const extended = await getExtendedClient(req)
390
+ const shape = res.locals.guardShape
391
+ const caller = res.locals.guardCaller
392
+
393
+ if (shape) {
394
+ assertGuard(extended.${modelNameLower})
395
+ }
396
+
397
+ let items: any[]
398
+ let total: number
399
+
400
+ if (typeof extended.$transaction === 'function') {
401
+ try {
402
+ const txResult = await extended.$transaction(async (tx: any) => {
403
+ const d = shape
404
+ ? await tx.${modelNameLower}.guard(shape, caller).findMany(query)
405
+ : await tx.${modelNameLower}.findMany(query)
406
+ const t = await countForPagination(tx.${modelNameLower}, query, shape, caller)
407
+ return { d, t }
408
+ })
409
+ items = txResult.d
410
+ total = txResult.t
411
+ } catch (txError: any) {
412
+ if (
413
+ txError?.message?.includes?.('interactive transactions') ||
414
+ txError?.code === 'P2028'
415
+ ) {
416
+ console.warn('[prisma-generator-express] Interactive transactions not available, pagination queries are non-atomic')
417
+ items = shape
418
+ ? await extended.${modelNameLower}.guard(shape, caller).findMany(query)
419
+ : await extended.${modelNameLower}.findMany(query)
420
+ total = await countForPagination(extended.${modelNameLower}, query, shape, caller)
421
+ } else {
422
+ throw txError
423
+ }
424
+ }
425
+ } else {
426
+ items = shape
427
+ ? await extended.${modelNameLower}.guard(shape, caller).findMany(query)
428
+ : await extended.${modelNameLower}.findMany(query)
429
+ total = await countForPagination(extended.${modelNameLower}, query, shape, caller)
430
+ }
431
+
432
+ const skip = (query.skip as number) ?? 0
433
+ const absTake = Math.abs((query.take as number) ?? items.length)
434
+ const hasMore = items.length >= absTake && skip + items.length < total
435
+
436
+ res.locals.data = { data: items, total, hasMore }
437
+ next()
438
+ } catch (error: unknown) {
439
+ handleError(error, next)
440
+ }
441
+ }
442
+ `);
443
+ }
444
+ //# sourceMappingURL=generateUnifiedHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateUnifiedHandler.js","sourceRoot":"","sources":["../../src/generators/generateUnifiedHandler.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,5 @@
1
+ import { DMMF } from '@prisma/generator-helper';
2
+ export declare function generateScalarUIHandler(options: {
3
+ model: DMMF.Model;
4
+ enums: DMMF.DatamodelEnum[];
5
+ }): string;