prisma-generator-express 1.15.0 → 1.16.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.
- package/README.md +0 -2
- package/dist/helpers/generateAggregate.js +4 -9
- package/dist/helpers/generateAggregate.js.map +1 -1
- package/dist/helpers/generateCount.js +4 -9
- package/dist/helpers/generateCount.js.map +1 -1
- package/dist/helpers/generateCreate.js +4 -9
- package/dist/helpers/generateCreate.js.map +1 -1
- package/dist/helpers/generateCreateMany.js +4 -9
- package/dist/helpers/generateCreateMany.js.map +1 -1
- package/dist/helpers/generateDelete.js +4 -9
- package/dist/helpers/generateDelete.js.map +1 -1
- package/dist/helpers/generateDeleteMany.js +4 -9
- package/dist/helpers/generateDeleteMany.js.map +1 -1
- package/dist/helpers/generateFindFirst.js +4 -9
- package/dist/helpers/generateFindFirst.js.map +1 -1
- package/dist/helpers/generateFindMany.js +4 -9
- package/dist/helpers/generateFindMany.js.map +1 -1
- package/dist/helpers/generateFindUnique.js +4 -9
- package/dist/helpers/generateFindUnique.js.map +1 -1
- package/dist/helpers/generateGroupBy.js +4 -9
- package/dist/helpers/generateGroupBy.js.map +1 -1
- package/dist/helpers/generateRouteFile.js +28 -28
- package/dist/helpers/generateUpdate.js +4 -9
- package/dist/helpers/generateUpdate.js.map +1 -1
- package/dist/helpers/generateUpdateMany.js +4 -9
- package/dist/helpers/generateUpdateMany.js.map +1 -1
- package/dist/helpers/generateUpsert.js +4 -9
- package/dist/helpers/generateUpsert.js.map +1 -1
- package/dist/utils/strings.js +3 -3
- package/dist/utils/strings.js.map +1 -1
- package/package.json +6 -6
- package/src/copy/routeConfig.ts +2 -2
- package/src/helpers/generateAggregate.ts +5 -10
- package/src/helpers/generateCount.ts +5 -10
- package/src/helpers/generateCreate.ts +5 -10
- package/src/helpers/generateCreateMany.ts +5 -10
- package/src/helpers/generateDelete.ts +5 -10
- package/src/helpers/generateDeleteMany.ts +5 -10
- package/src/helpers/generateFindFirst.ts +5 -10
- package/src/helpers/generateFindMany.ts +5 -10
- package/src/helpers/generateFindUnique.ts +5 -10
- package/src/helpers/generateGroupBy.ts +5 -10
- package/src/helpers/generateRouteFile.ts +28 -28
- package/src/helpers/generateUpdate.ts +5 -10
- package/src/helpers/generateUpdateMany.ts +5 -10
- package/src/helpers/generateUpsert.ts +5 -10
- package/src/utils/strings.ts +1 -1
package/README.md
CHANGED
|
@@ -133,7 +133,6 @@ const addPrisma: RequestHandler = (
|
|
|
133
133
|
next: NextFunction,
|
|
134
134
|
) => {
|
|
135
135
|
req.prisma = prisma
|
|
136
|
-
// req.omitOutputValidation = true (output validation is not required if you use `select` instead of `include`)
|
|
137
136
|
next()
|
|
138
137
|
}
|
|
139
138
|
|
|
@@ -210,7 +209,6 @@ The following properties can be attached to the `req` object to control the beha
|
|
|
210
209
|
| `prisma` | PrismaClient | An instance of PrismaClient that allows the middleware to interact with your database. |
|
|
211
210
|
| `passToNext` | boolean | Optional, if `true` - the result of a Prisma request will be passed to the next middleware as `if (req.locals) req.locals.data` |
|
|
212
211
|
| `outputValidation` | ZodTypeAny | (Optional) A Zod schema used to validate the data returned from the Prisma query before sending it to the client. |
|
|
213
|
-
| `omitOutputValidation` | Boolean | (Optional) A flag that, if set to `true`, disables output validation even if a Zod schema is provided. |
|
|
214
212
|
|
|
215
213
|
## Router Schema
|
|
216
214
|
|
|
@@ -19,7 +19,6 @@ interface AggregateRequest extends Request {
|
|
|
19
19
|
prisma: PrismaClient;
|
|
20
20
|
query: Partial<${argsTypeName}> & ParsedQs;
|
|
21
21
|
outputValidation?: ZodTypeAny;
|
|
22
|
-
omitOutputValidation?: boolean;
|
|
23
22
|
locals?: {
|
|
24
23
|
outputValidator?: ValidatorConfig;
|
|
25
24
|
};
|
|
@@ -31,13 +30,9 @@ export async function ${functionName}(req: AggregateRequest, res: Response, next
|
|
|
31
30
|
try {
|
|
32
31
|
const outputValidator = res.locals.outputValidator?.schema || req.outputValidation;
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
throw new Error('Output validation schema or omission flag must be provided.');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const result = await req.prisma.${(0, strings_1.lowercaseFirstLetter)(modelName)}.aggregate(req.query as ${argsTypeName});
|
|
33
|
+
const result = await req.prisma.${(0, strings_1.toPascalCase)(modelName)}.aggregate(req.query as ${argsTypeName});
|
|
39
34
|
|
|
40
|
-
if (
|
|
35
|
+
if (outputValidator) {
|
|
41
36
|
const validationResult = outputValidator.safeParse(result);
|
|
42
37
|
if (validationResult.success) {
|
|
43
38
|
return res.status(200).json(validationResult.data);
|
|
@@ -47,8 +42,8 @@ export async function ${functionName}(req: AggregateRequest, res: Response, next
|
|
|
47
42
|
} else {
|
|
48
43
|
return res.status(200).json(result);
|
|
49
44
|
}
|
|
50
|
-
} catch
|
|
51
|
-
|
|
45
|
+
} catch(error: unknown) {
|
|
46
|
+
next(error)
|
|
52
47
|
}
|
|
53
48
|
}`;
|
|
54
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateAggregate.js","sourceRoot":"","sources":["../../src/helpers/generateAggregate.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"generateAggregate.js","sourceRoot":"","sources":["../../src/helpers/generateAggregate.ts"],"names":[],"mappings":";;;AACA,8CAA2D;AASpD,MAAM,yBAAyB,GAAG,CAAC,OAGzC,EAAU,EAAE;IACX,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAA;IAChD,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAA;IAC5B,MAAM,YAAY,GAAG,GAAG,SAAS,WAAW,CAAA;IAC5C,MAAM,YAAY,GAAG,UAAU,IAAA,oBAAU,EAAC,SAAS,CAAC,eAAe,CAAA;IAEnE,OAAO;EACP,qBAAqB;;;;;;;;;mBASJ,YAAY;;;;;;;kFAOmD,YAAY;;wBAEtE,YAAY;;;;sCAIE,IAAA,sBAAY,EAAC,SAAS,CAAC,2BAA2B,YAAY;;;;;;;;;;;;;;;EAelG,CAAA;AACF,CAAC,CAAA;AAhDY,QAAA,yBAAyB,6BAgDrC"}
|
|
@@ -18,7 +18,6 @@ interface CountRequest extends Request {
|
|
|
18
18
|
prisma: PrismaClient;
|
|
19
19
|
query: Partial<${argsTypeName}> & ParsedQs;
|
|
20
20
|
outputValidation?: ZodTypeAny;
|
|
21
|
-
omitOutputValidation?: boolean;
|
|
22
21
|
locals?: {
|
|
23
22
|
outputValidator?: ZodTypeAny;
|
|
24
23
|
};
|
|
@@ -30,13 +29,9 @@ export async function ${functionName}(req: CountRequest, res: Response, next: Ne
|
|
|
30
29
|
try {
|
|
31
30
|
const outputValidator = req.locals?.outputValidator || req.outputValidation;
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
throw new Error('Output validation schema or omission flag must be provided.');
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const result = await req.prisma.${(0, strings_1.lowercaseFirstLetter)(modelName)}.count(req.query as ${argsTypeName});
|
|
32
|
+
const result = await req.prisma.${(0, strings_1.toPascalCase)(modelName)}.count(req.query as ${argsTypeName});
|
|
38
33
|
|
|
39
|
-
if (
|
|
34
|
+
if (outputValidator) {
|
|
40
35
|
const validationResult = outputValidator.safeParse(result);
|
|
41
36
|
if (validationResult.success) {
|
|
42
37
|
return res.status(200).json(validationResult.data);
|
|
@@ -46,8 +41,8 @@ export async function ${functionName}(req: CountRequest, res: Response, next: Ne
|
|
|
46
41
|
} else {
|
|
47
42
|
return res.status(200).json(result);
|
|
48
43
|
}
|
|
49
|
-
} catch
|
|
50
|
-
|
|
44
|
+
} catch(error: unknown) {
|
|
45
|
+
next(error)
|
|
51
46
|
}
|
|
52
47
|
}`;
|
|
53
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateCount.js","sourceRoot":"","sources":["../../src/helpers/generateCount.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"generateCount.js","sourceRoot":"","sources":["../../src/helpers/generateCount.ts"],"names":[],"mappings":";;;AACA,8CAA+C;AASxC,MAAM,qBAAqB,GAAG,CAAC,OAGrC,EAAU,EAAE;IACX,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAA;IAChD,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAA;IAC5B,MAAM,YAAY,GAAG,GAAG,SAAS,OAAO,CAAA;IACxC,MAAM,YAAY,GAAG,UAAU,SAAS,WAAW,CAAA;IAEnD,OAAO;EACP,qBAAqB;;;;;;;;mBAQJ,YAAY;;;;;;;;;wBASP,YAAY;;;;sCAIE,IAAA,sBAAY,EAAC,SAAS,CAAC,uBAAuB,YAAY;;;;;;;;;;;;;;;EAe9F,CAAA;AACF,CAAC,CAAA;AA/CY,QAAA,qBAAqB,yBA+CjC"}
|
|
@@ -17,7 +17,6 @@ interface CreateRequest extends Request {
|
|
|
17
17
|
prisma: PrismaClient;
|
|
18
18
|
body: ${argsTypeName};
|
|
19
19
|
outputValidation?: ZodTypeAny;
|
|
20
|
-
omitOutputValidation?: boolean;
|
|
21
20
|
locals?: {
|
|
22
21
|
outputValidator?: ZodTypeAny;
|
|
23
22
|
};
|
|
@@ -29,13 +28,9 @@ export async function ${functionName}(req: CreateRequest, res: Response, next: N
|
|
|
29
28
|
try {
|
|
30
29
|
const outputValidator = req.locals?.outputValidator || req.outputValidation;
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
throw new Error('Output validation schema or omission flag must be provided.');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const data = await req.prisma.${(0, strings_1.lowercaseFirstLetter)(modelName)}.create(req.body);
|
|
31
|
+
const data = await req.prisma.${(0, strings_1.toPascalCase)(modelName)}.create(req.body);
|
|
37
32
|
|
|
38
|
-
if (
|
|
33
|
+
if (outputValidator) {
|
|
39
34
|
const validationResult = outputValidator.safeParse(data);
|
|
40
35
|
if (validationResult.success) {
|
|
41
36
|
return res.status(201).json(validationResult.data);
|
|
@@ -45,8 +40,8 @@ export async function ${functionName}(req: CreateRequest, res: Response, next: N
|
|
|
45
40
|
} else {
|
|
46
41
|
return res.status(201).json(data);
|
|
47
42
|
}
|
|
48
|
-
} catch
|
|
49
|
-
|
|
43
|
+
} catch(error: unknown) {
|
|
44
|
+
next(error)
|
|
50
45
|
}
|
|
51
46
|
}`;
|
|
52
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateCreate.js","sourceRoot":"","sources":["../../src/helpers/generateCreate.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"generateCreate.js","sourceRoot":"","sources":["../../src/helpers/generateCreate.ts"],"names":[],"mappings":";;;AACA,8CAA+C;AAQxC,MAAM,sBAAsB,GAAG,CAAC,OAGtC,EAAU,EAAE;IACX,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAA;IAChD,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAA;IAC5B,MAAM,YAAY,GAAG,GAAG,SAAS,QAAQ,CAAA;IACzC,MAAM,YAAY,GAAG,UAAU,SAAS,YAAY,CAAA;IAEpD,OAAO;EACP,qBAAqB;;;;;;;UAOb,YAAY;;;;;;;uEAOiD,YAAY;;wBAE3D,YAAY;;;;oCAIA,IAAA,sBAAY,EAAC,SAAS,CAAC;;;;;;;;;;;;;;;EAezD,CAAA;AACF,CAAC,CAAA;AA9CY,QAAA,sBAAsB,0BA8ClC"}
|
|
@@ -17,7 +17,6 @@ interface CreateManyRequest extends Request {
|
|
|
17
17
|
prisma: PrismaClient;
|
|
18
18
|
body: ${argsTypeName};
|
|
19
19
|
outputValidation?: ZodTypeAny;
|
|
20
|
-
omitOutputValidation?: boolean;
|
|
21
20
|
locals?: {
|
|
22
21
|
outputValidator?: ZodTypeAny;
|
|
23
22
|
};
|
|
@@ -29,13 +28,9 @@ export async function ${functionName}(req: CreateManyRequest, res: Response, nex
|
|
|
29
28
|
try {
|
|
30
29
|
const outputValidator = req.locals?.outputValidator || req.outputValidation;
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
throw new Error('Output validation schema or omission flag must be provided.');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const data = await req.prisma.${(0, strings_1.lowercaseFirstLetter)(modelName)}.createMany(req.body);
|
|
31
|
+
const data = await req.prisma.${(0, strings_1.toPascalCase)(modelName)}.createMany(req.body);
|
|
37
32
|
|
|
38
|
-
if (
|
|
33
|
+
if (outputValidator) {
|
|
39
34
|
const validationResult = outputValidator.safeParse(data);
|
|
40
35
|
if (validationResult.success) {
|
|
41
36
|
return res.status(201).json(validationResult.data);
|
|
@@ -45,8 +40,8 @@ export async function ${functionName}(req: CreateManyRequest, res: Response, nex
|
|
|
45
40
|
} else {
|
|
46
41
|
return res.status(201).json(data);
|
|
47
42
|
}
|
|
48
|
-
} catch
|
|
49
|
-
|
|
43
|
+
} catch(error: unknown) {
|
|
44
|
+
next(error)
|
|
50
45
|
}
|
|
51
46
|
}`;
|
|
52
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateCreateMany.js","sourceRoot":"","sources":["../../src/helpers/generateCreateMany.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"generateCreateMany.js","sourceRoot":"","sources":["../../src/helpers/generateCreateMany.ts"],"names":[],"mappings":";;;AACA,8CAA+C;AAOxC,MAAM,0BAA0B,GAAG,CAAC,OAG1C,EAAU,EAAE;IACX,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAA;IAChD,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAA;IAC5B,MAAM,YAAY,GAAG,GAAG,SAAS,YAAY,CAAA;IAC7C,MAAM,YAAY,GAAG,UAAU,SAAS,gBAAgB,CAAA;IAExD,OAAO;EACP,qBAAqB;;;;;;;UAOb,YAAY;;;;;;;2EAOqD,YAAY;;wBAE/D,YAAY;;;;oCAIA,IAAA,sBAAY,EAAC,SAAS,CAAC;;;;;;;;;;;;;;;EAezD,CAAA;AACF,CAAC,CAAA;AA9CY,QAAA,0BAA0B,8BA8CtC"}
|
|
@@ -17,7 +17,6 @@ interface DeleteRequest extends Request {
|
|
|
17
17
|
prisma: PrismaClient;
|
|
18
18
|
body: ${argsTypeName};
|
|
19
19
|
outputValidation?: ZodTypeAny;
|
|
20
|
-
omitOutputValidation?: boolean;
|
|
21
20
|
locals?: {
|
|
22
21
|
outputValidator?: ZodTypeAny;
|
|
23
22
|
};
|
|
@@ -29,13 +28,9 @@ export async function ${functionName}(req: DeleteRequest, res: Response, next: N
|
|
|
29
28
|
try {
|
|
30
29
|
const outputValidator = req.locals?.outputValidator || req.outputValidation;
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
throw new Error('Output validation schema or omission flag must be provided.');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const data = await req.prisma.${(0, strings_1.lowercaseFirstLetter)(modelName)}.delete(req.body);
|
|
31
|
+
const data = await req.prisma.${(0, strings_1.toPascalCase)(modelName)}.delete(req.body);
|
|
37
32
|
|
|
38
|
-
if (
|
|
33
|
+
if (outputValidator) {
|
|
39
34
|
const validationResult = outputValidator.safeParse(data);
|
|
40
35
|
if (validationResult.success) {
|
|
41
36
|
return res.status(200).json(validationResult.data);
|
|
@@ -45,8 +40,8 @@ export async function ${functionName}(req: DeleteRequest, res: Response, next: N
|
|
|
45
40
|
} else {
|
|
46
41
|
return res.status(200).json(data);
|
|
47
42
|
}
|
|
48
|
-
} catch
|
|
49
|
-
|
|
43
|
+
} catch(error: unknown) {
|
|
44
|
+
next(error)
|
|
50
45
|
}
|
|
51
46
|
}`;
|
|
52
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateDelete.js","sourceRoot":"","sources":["../../src/helpers/generateDelete.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"generateDelete.js","sourceRoot":"","sources":["../../src/helpers/generateDelete.ts"],"names":[],"mappings":";;;AACA,8CAA+C;AASxC,MAAM,sBAAsB,GAAG,CAAC,OAGtC,EAAU,EAAE;IACX,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAA;IAChD,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAA;IAC5B,MAAM,YAAY,GAAG,GAAG,SAAS,QAAQ,CAAA;IACzC,MAAM,YAAY,GAAG,UAAU,SAAS,YAAY,CAAA;IAEpD,OAAO;EACP,qBAAqB;;;;;;;UAOb,YAAY;;;;;;;uEAOiD,YAAY;;wBAE3D,YAAY;;;;oCAIA,IAAA,sBAAY,EAAC,SAAS,CAAC;;;;;;;;;;;;;;;EAezD,CAAA;AACF,CAAC,CAAA;AA9CY,QAAA,sBAAsB,0BA8ClC"}
|
|
@@ -17,7 +17,6 @@ interface DeleteManyRequest extends Request {
|
|
|
17
17
|
prisma: PrismaClient;
|
|
18
18
|
body: ${argsTypeName};
|
|
19
19
|
outputValidation?: ZodTypeAny;
|
|
20
|
-
omitOutputValidation?: boolean;
|
|
21
20
|
locals?: {
|
|
22
21
|
outputValidator?: ZodTypeAny;
|
|
23
22
|
};
|
|
@@ -29,13 +28,9 @@ export async function ${functionName}(req: DeleteManyRequest, res: Response, nex
|
|
|
29
28
|
try {
|
|
30
29
|
const outputValidator = req.locals?.outputValidator || req.outputValidation;
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
throw new Error('Output validation schema or omission flag must be provided.');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const result = await req.prisma.${(0, strings_1.lowercaseFirstLetter)(modelName)}.deleteMany(req.body);
|
|
31
|
+
const result = await req.prisma.${(0, strings_1.toPascalCase)(modelName)}.deleteMany(req.body);
|
|
37
32
|
|
|
38
|
-
if (
|
|
33
|
+
if (outputValidator) {
|
|
39
34
|
const validationResult = outputValidator.safeParse(result);
|
|
40
35
|
if (validationResult.success) {
|
|
41
36
|
return res.status(200).json(validationResult.data);
|
|
@@ -45,8 +40,8 @@ export async function ${functionName}(req: DeleteManyRequest, res: Response, nex
|
|
|
45
40
|
} else {
|
|
46
41
|
return res.status(200).json(result);
|
|
47
42
|
}
|
|
48
|
-
} catch
|
|
49
|
-
|
|
43
|
+
} catch(error: unknown) {
|
|
44
|
+
next(error)
|
|
50
45
|
}
|
|
51
46
|
}`;
|
|
52
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateDeleteMany.js","sourceRoot":"","sources":["../../src/helpers/generateDeleteMany.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"generateDeleteMany.js","sourceRoot":"","sources":["../../src/helpers/generateDeleteMany.ts"],"names":[],"mappings":";;;AACA,8CAA+C;AASxC,MAAM,0BAA0B,GAAG,CAAC,OAG1C,EAAU,EAAE;IACX,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAA;IAChD,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAA;IAC5B,MAAM,YAAY,GAAG,GAAG,SAAS,YAAY,CAAA;IAC7C,MAAM,YAAY,GAAG,UAAU,SAAS,gBAAgB,CAAA;IAExD,OAAO;EACP,qBAAqB;;;;;;;UAOb,YAAY;;;;;;;2EAOqD,YAAY;;wBAE/D,YAAY;;;;sCAIE,IAAA,sBAAY,EAAC,SAAS,CAAC;;;;;;;;;;;;;;;EAe3D,CAAA;AACF,CAAC,CAAA;AA9CY,QAAA,0BAA0B,8BA8CtC"}
|
|
@@ -21,7 +21,6 @@ export interface FindFirstRequest extends Request {
|
|
|
21
21
|
prisma: PrismaClient;
|
|
22
22
|
query: ${queryTypeName} & ParsedQs;
|
|
23
23
|
outputValidation?: ZodTypeAny;
|
|
24
|
-
omitOutputValidation?: boolean;
|
|
25
24
|
passToNext?: boolean;
|
|
26
25
|
locals?: {
|
|
27
26
|
data?: ${modelName} | null
|
|
@@ -34,15 +33,11 @@ export async function ${functionName}(req: FindFirstRequest, res: Response, next
|
|
|
34
33
|
try {
|
|
35
34
|
const outputValidator = req.locals?.outputValidator || req.outputValidation;
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
throw new Error('Output validation schema or omission flag must be provided.');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const data = await req.prisma.${(0, strings_1.lowercaseFirstLetter)(modelName)}.findFirst(req.query as ${queryTypeName});
|
|
36
|
+
const data = await req.prisma.${(0, strings_1.toPascalCase)(modelName)}.findFirst(req.query as ${queryTypeName});
|
|
42
37
|
if (req.passToNext) {
|
|
43
38
|
if (req.locals) req.locals.data = data;
|
|
44
39
|
next();
|
|
45
|
-
} else if (
|
|
40
|
+
} else if (outputValidator) {
|
|
46
41
|
const validationResult = outputValidator.safeParse(data);
|
|
47
42
|
if (validationResult.success) {
|
|
48
43
|
return res.status(200).json(validationResult.data);
|
|
@@ -52,8 +47,8 @@ export async function ${functionName}(req: FindFirstRequest, res: Response, next
|
|
|
52
47
|
} else {
|
|
53
48
|
return res.status(200).json(data);
|
|
54
49
|
}
|
|
55
|
-
} catch
|
|
56
|
-
|
|
50
|
+
} catch(error: unknown) {
|
|
51
|
+
next(error)
|
|
57
52
|
}
|
|
58
53
|
}`;
|
|
59
54
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateFindFirst.js","sourceRoot":"","sources":["../../src/helpers/generateFindFirst.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"generateFindFirst.js","sourceRoot":"","sources":["../../src/helpers/generateFindFirst.ts"],"names":[],"mappings":";;;AACA,8CAA+C;AAOxC,MAAM,yBAAyB,GAAG,CAAC,OAGzC,EAAU,EAAE;IACX,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAA;IAChD,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAA;IAC5B,MAAM,YAAY,GAAG,GAAG,SAAS,WAAW,CAAA;IAC5C,MAAM,aAAa,GAAG,UAAU,SAAS,eAAe,CAAA;IAExD,OAAO;EACP,qBAAqB,CAAC,OAAO,CAAC,YAAY,EAAE,aAAa,SAAS,IAAI,CAAC;;;;;;;;;;;WAW9D,aAAa;;;;aAIX,SAAS;;;;+EAIyD,aAAa;;wBAEpE,YAAY;;;;oCAIA,IAAA,sBAAY,EAAC,SAAS,CAAC,2BAA2B,aAAa;;;;;;;;;;;;;;;;;EAiBjG,CAAA;AACF,CAAC,CAAA;AArDY,QAAA,yBAAyB,6BAqDrC"}
|
|
@@ -21,7 +21,6 @@ export interface FindManyRequest extends Request {
|
|
|
21
21
|
prisma: PrismaClient;
|
|
22
22
|
query: ${queryTypeName} & ParsedQs;
|
|
23
23
|
outputValidation?: ZodTypeAny;
|
|
24
|
-
omitOutputValidation?: boolean;
|
|
25
24
|
passToNext?: boolean;
|
|
26
25
|
locals?: {
|
|
27
26
|
data?: ${modelName}[]
|
|
@@ -34,15 +33,11 @@ export async function ${functionName}(req: FindManyRequest, res: Response, next:
|
|
|
34
33
|
try {
|
|
35
34
|
const outputValidator = req.locals?.outputValidator || req.outputValidation;
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
throw new Error('Output validation schema or omission flag must be provided.');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const data = await req.prisma.${(0, strings_1.lowercaseFirstLetter)(modelName)}.findMany(req.query as ${queryTypeName});
|
|
36
|
+
const data = await req.prisma.${(0, strings_1.toPascalCase)(modelName)}.findMany(req.query as ${queryTypeName});
|
|
42
37
|
if (req.passToNext) {
|
|
43
38
|
if (req.locals) req.locals.data = data;
|
|
44
39
|
next();
|
|
45
|
-
} else if (
|
|
40
|
+
} else if (outputValidator) {
|
|
46
41
|
const validationResult = outputValidator.safeParse(data);
|
|
47
42
|
if (validationResult.success) {
|
|
48
43
|
return res.status(200).json(validationResult.data);
|
|
@@ -52,8 +47,8 @@ export async function ${functionName}(req: FindManyRequest, res: Response, next:
|
|
|
52
47
|
} else {
|
|
53
48
|
return res.status(200).json(data);
|
|
54
49
|
}
|
|
55
|
-
} catch
|
|
56
|
-
|
|
50
|
+
} catch(error: unknown) {
|
|
51
|
+
next(error)
|
|
57
52
|
}
|
|
58
53
|
}`;
|
|
59
54
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateFindMany.js","sourceRoot":"","sources":["../../src/helpers/generateFindMany.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"generateFindMany.js","sourceRoot":"","sources":["../../src/helpers/generateFindMany.ts"],"names":[],"mappings":";;;AACA,8CAA+C;AAOxC,MAAM,wBAAwB,GAAG,CAAC,OAGxC,EAAU,EAAE;IACX,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAA;IAChD,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAA;IAC5B,MAAM,YAAY,GAAG,GAAG,SAAS,UAAU,CAAA;IAC3C,MAAM,aAAa,GAAG,UAAU,SAAS,cAAc,CAAA;IAEvD,OAAO;EACP,qBAAqB,CAAC,OAAO,CAAC,YAAY,EAAE,aAAa,SAAS,IAAI,CAAC;;;;;;;;;;;WAW9D,aAAa;;;;aAIX,SAAS;;;;8EAIwD,aAAa;;wBAEnE,YAAY;;;;oCAIA,IAAA,sBAAY,EAAC,SAAS,CAAC,0BAA0B,aAAa;;;;;;;;;;;;;;;;;EAiBhG,CAAA;AACF,CAAC,CAAA;AArDY,QAAA,wBAAwB,4BAqDpC"}
|
|
@@ -21,7 +21,6 @@ export interface FindUniqueRequest extends Request {
|
|
|
21
21
|
prisma: PrismaClient;
|
|
22
22
|
query: ${queryTypeName} & ParsedQs;
|
|
23
23
|
outputValidation?: ZodTypeAny;
|
|
24
|
-
omitOutputValidation?: boolean;
|
|
25
24
|
passToNext?: boolean;
|
|
26
25
|
locals?: {
|
|
27
26
|
data?: ${modelName} | null
|
|
@@ -34,15 +33,11 @@ export async function ${functionName}(req: FindUniqueRequest, res: Response, nex
|
|
|
34
33
|
try {
|
|
35
34
|
const outputValidator = req.locals?.outputValidator || req.outputValidation;
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
throw new Error('Output validation schema or omission flag must be provided.');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const data = await req.prisma.${(0, strings_1.lowercaseFirstLetter)(modelName)}.findUnique(req.query as ${queryTypeName});
|
|
36
|
+
const data = await req.prisma.${(0, strings_1.toPascalCase)(modelName)}.findUnique(req.query as ${queryTypeName});
|
|
42
37
|
if (req.passToNext) {
|
|
43
38
|
if (req.locals) req.locals.data = data;
|
|
44
39
|
next();
|
|
45
|
-
} else if (
|
|
40
|
+
} else if (outputValidator) {
|
|
46
41
|
const validationResult = outputValidator.safeParse(data);
|
|
47
42
|
if (validationResult.success) {
|
|
48
43
|
return res.status(200).json(validationResult.data);
|
|
@@ -52,8 +47,8 @@ export async function ${functionName}(req: FindUniqueRequest, res: Response, nex
|
|
|
52
47
|
} else {
|
|
53
48
|
return res.status(200).json(data);
|
|
54
49
|
}
|
|
55
|
-
} catch
|
|
56
|
-
|
|
50
|
+
} catch(error: unknown) {
|
|
51
|
+
next(error)
|
|
57
52
|
}
|
|
58
53
|
}`;
|
|
59
54
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateFindUnique.js","sourceRoot":"","sources":["../../src/helpers/generateFindUnique.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"generateFindUnique.js","sourceRoot":"","sources":["../../src/helpers/generateFindUnique.ts"],"names":[],"mappings":";;;AACA,8CAA+C;AAOxC,MAAM,0BAA0B,GAAG,CAAC,OAG1C,EAAU,EAAE;IACX,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAA;IAChD,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAA;IAC5B,MAAM,YAAY,GAAG,GAAG,SAAS,YAAY,CAAA;IAC7C,MAAM,aAAa,GAAG,UAAU,SAAS,gBAAgB,CAAA;IAEzD,OAAO;EACP,qBAAqB,CAAC,OAAO,CAAC,YAAY,EAAE,aAAa,SAAS,IAAI,CAAC;;;;;;;;;;;WAW9D,aAAa;;;;aAIX,SAAS;;;;gFAI0D,aAAa;;wBAErE,YAAY;;;;oCAIA,IAAA,sBAAY,EAAC,SAAS,CAAC,4BAA4B,aAAa;;;;;;;;;;;;;;;;;EAiBlG,CAAA;AACF,CAAC,CAAA;AArDY,QAAA,0BAA0B,8BAqDtC"}
|
|
@@ -18,7 +18,6 @@ interface GroupByRequest extends Request {
|
|
|
18
18
|
prisma: PrismaClient;
|
|
19
19
|
query: Partial<${argsTypeName}> & ParsedQs;
|
|
20
20
|
outputValidation?: ZodTypeAny;
|
|
21
|
-
omitOutputValidation?: boolean;
|
|
22
21
|
locals?: {
|
|
23
22
|
outputValidator?: ZodTypeAny;
|
|
24
23
|
};
|
|
@@ -30,14 +29,10 @@ export async function ${functionName}(req: GroupByRequest, res: Response, next:
|
|
|
30
29
|
try {
|
|
31
30
|
const outputValidator = req.locals?.outputValidator || req.outputValidation;
|
|
32
31
|
|
|
33
|
-
if (!outputValidator && !req.omitOutputValidation) {
|
|
34
|
-
throw new Error('Output validation schema or omission flag must be provided.');
|
|
35
|
-
}
|
|
36
|
-
|
|
37
32
|
// @ts-ignore
|
|
38
|
-
const result = await req.prisma.${(0, strings_1.
|
|
33
|
+
const result = await req.prisma.${(0, strings_1.toPascalCase)(modelName)}.groupBy(req.query);
|
|
39
34
|
|
|
40
|
-
if (
|
|
35
|
+
if (outputValidator) {
|
|
41
36
|
const validationResult = outputValidator.safeParse(result);
|
|
42
37
|
if (validationResult.success) {
|
|
43
38
|
return res.status(200).json(validationResult.data);
|
|
@@ -47,8 +42,8 @@ export async function ${functionName}(req: GroupByRequest, res: Response, next:
|
|
|
47
42
|
} else {
|
|
48
43
|
return res.status(200).json(result);
|
|
49
44
|
}
|
|
50
|
-
} catch
|
|
51
|
-
|
|
45
|
+
} catch(error: unknown) {
|
|
46
|
+
next(error)
|
|
52
47
|
}
|
|
53
48
|
}`;
|
|
54
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateGroupBy.js","sourceRoot":"","sources":["../../src/helpers/generateGroupBy.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"generateGroupBy.js","sourceRoot":"","sources":["../../src/helpers/generateGroupBy.ts"],"names":[],"mappings":";;;AACA,8CAA+C;AAUxC,MAAM,uBAAuB,GAAG,CAAC,OAGvC,EAAU,EAAE;IACX,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAA;IAChD,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAA;IAC5B,MAAM,YAAY,GAAG,GAAG,SAAS,SAAS,CAAA;IAC1C,MAAM,YAAY,GAAG,UAAU,SAAS,aAAa,CAAA;IAErD,OAAO;EACP,qBAAqB;;;;;;;;mBAQJ,YAAY;;;;;;;;;wBASP,YAAY;;;;;sCAKE,IAAA,sBAAY,EAAC,SAAS,CAAC;;;;;;;;;;;;;;;EAe3D,CAAA;AACF,CAAC,CAAA;AAhDY,QAAA,uBAAuB,2BAgDnC"}
|
|
@@ -28,8 +28,8 @@ import { parseQueryParams } from "../parseQueryParams";
|
|
|
28
28
|
const defaultBeforeAfter = {
|
|
29
29
|
before: [] as RequestHandler[],
|
|
30
30
|
after: [] as RequestHandler[],
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
inputValidator: undefined,
|
|
32
|
+
outputValidator: undefined,
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
/**
|
|
@@ -81,104 +81,104 @@ export function ${routerFunctionName}(config: RouteConfig<RequestHandler>) {
|
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
if (config.enableAll || config?.findFirst) {
|
|
84
|
-
const { before = [], after = [],
|
|
85
|
-
setupRoute('/first', 'get', before, ${modelName}FindFirst as RequestHandler,
|
|
84
|
+
const { before = [], after = [], inputValidator, outputValidator) = config.findFirst || defaultBeforeAfter;
|
|
85
|
+
setupRoute('/first', 'get', before, ${modelName}FindFirst as RequestHandler, inputValidator, outputValidator);
|
|
86
86
|
if (after.length) {
|
|
87
87
|
router.use(basePath + '/first', ...after);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
if (config.enableAll || config?.findMany) {
|
|
92
|
-
const { before = [], after = [],
|
|
93
|
-
setupRoute('/', 'get', before, ${modelName}FindMany as RequestHandler,
|
|
92
|
+
const { before = [], after = [], inputValidator, outputValidator) = config.findMany || defaultBeforeAfter;
|
|
93
|
+
setupRoute('/', 'get', before, ${modelName}FindMany as RequestHandler, inputValidator, outputValidator);
|
|
94
94
|
if (after.length) {
|
|
95
95
|
router.use(basePath + '/', ...after);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
if (config.enableAll || config?.findUnique) {
|
|
100
|
-
const { before = [], after = [],
|
|
101
|
-
setupRoute('/:id', 'get', before, ${modelName}FindUnique as any,
|
|
100
|
+
const { before = [], after = [], inputValidator, outputValidator) = config.findUnique || defaultBeforeAfter;
|
|
101
|
+
setupRoute('/:id', 'get', before, ${modelName}FindUnique as any, inputValidator, outputValidator);
|
|
102
102
|
if (after.length) {
|
|
103
103
|
router.use(basePath + '/:id', ...after);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
if (config.enableAll || config?.create) {
|
|
108
|
-
const { before = [], after = [],
|
|
109
|
-
setupRoute('/', 'post', before, ${modelName}Create as RequestHandler,
|
|
108
|
+
const { before = [], after = [], inputValidator, outputValidator) = config.create || defaultBeforeAfter;
|
|
109
|
+
setupRoute('/', 'post', before, ${modelName}Create as RequestHandler, inputValidator, outputValidator);
|
|
110
110
|
if (after.length) {
|
|
111
111
|
router.use(basePath + '/', ...after);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
if (config.enableAll || config?.createMany) {
|
|
116
|
-
const { before = [], after = [],
|
|
117
|
-
setupRoute('/many', 'post', before, ${modelName}CreateMany as RequestHandler,
|
|
116
|
+
const { before = [], after = [], inputValidator, outputValidator) = config.createMany || defaultBeforeAfter;
|
|
117
|
+
setupRoute('/many', 'post', before, ${modelName}CreateMany as RequestHandler, inputValidator, outputValidator);
|
|
118
118
|
if (after.length) {
|
|
119
119
|
router.use(basePath + '/many', ...after);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
if (config.enableAll || config?.update) {
|
|
124
|
-
const { before = [], after = [],
|
|
125
|
-
setupRoute('/', 'put', before, ${modelName}Update as RequestHandler,
|
|
124
|
+
const { before = [], after = [], inputValidator, outputValidator) = config.update || defaultBeforeAfter;
|
|
125
|
+
setupRoute('/', 'put', before, ${modelName}Update as RequestHandler, inputValidator, outputValidator);
|
|
126
126
|
if (after.length) {
|
|
127
127
|
router.use(basePath + '/', ...after);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
if (config.enableAll || config?.updateMany) {
|
|
132
|
-
const { before = [], after = [],
|
|
133
|
-
setupRoute('/many', 'put', before, ${modelName}UpdateMany as RequestHandler,
|
|
132
|
+
const { before = [], after = [], inputValidator, outputValidator) = config.updateMany || defaultBeforeAfter;
|
|
133
|
+
setupRoute('/many', 'put', before, ${modelName}UpdateMany as RequestHandler, inputValidator, outputValidator);
|
|
134
134
|
if (after.length) {
|
|
135
135
|
router.use(basePath + '/many', ...after);
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
if (config.enableAll || config?.upsert) {
|
|
140
|
-
const { before = [], after = [],
|
|
141
|
-
setupRoute('/', 'patch', before, ${modelName}Upsert as RequestHandler,
|
|
140
|
+
const { before = [], after = [], inputValidator, outputValidator) = config.upsert || defaultBeforeAfter;
|
|
141
|
+
setupRoute('/', 'patch', before, ${modelName}Upsert as RequestHandler, inputValidator, outputValidator);
|
|
142
142
|
if (after.length) {
|
|
143
143
|
router.use(basePath + '/', ...after);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
if (config.enableAll || config?.delete) {
|
|
148
|
-
const { before = [], after = [],
|
|
149
|
-
setupRoute('/', 'delete', before, ${modelName}Delete as RequestHandler,
|
|
148
|
+
const { before = [], after = [], inputValidator, outputValidator) = config.delete || defaultBeforeAfter;
|
|
149
|
+
setupRoute('/', 'delete', before, ${modelName}Delete as RequestHandler, inputValidator, outputValidator);
|
|
150
150
|
if (after.length) {
|
|
151
151
|
router.use(basePath + '/', ...after);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
if (config.enableAll || config?.deleteMany) {
|
|
156
|
-
const { before = [], after = [],
|
|
157
|
-
setupRoute('/many', 'delete', before, ${modelName}DeleteMany as RequestHandler,
|
|
156
|
+
const { before = [], after = [], inputValidator, outputValidator) = config.deleteMany || defaultBeforeAfter;
|
|
157
|
+
setupRoute('/many', 'delete', before, ${modelName}DeleteMany as RequestHandler, inputValidator, outputValidator);
|
|
158
158
|
if (after.length) {
|
|
159
159
|
router.use(basePath + '/many', ...after);
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
if (config.enableAll || config?.aggregate) {
|
|
164
|
-
const { before = [], after = [],
|
|
165
|
-
setupRoute('/aggregate', 'get', before, ${modelName}Aggregate as RequestHandler,
|
|
164
|
+
const { before = [], after = [], inputValidator, outputValidator) = config.aggregate || defaultBeforeAfter;
|
|
165
|
+
setupRoute('/aggregate', 'get', before, ${modelName}Aggregate as RequestHandler, inputValidator, outputValidator);
|
|
166
166
|
if (after.length) {
|
|
167
167
|
router.use(basePath + '/aggregate', ...after);
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
if (config.enableAll || config?.count) {
|
|
172
|
-
const { before = [], after = [],
|
|
173
|
-
setupRoute('/count', 'get', before, ${modelName}Count as RequestHandler,
|
|
172
|
+
const { before = [], after = [], inputValidator, outputValidator) = config.count || defaultBeforeAfter;
|
|
173
|
+
setupRoute('/count', 'get', before, ${modelName}Count as RequestHandler, inputValidator, outputValidator);
|
|
174
174
|
if (after.length) {
|
|
175
175
|
router.use(basePath + '/count', ...after);
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
if (config.enableAll || config?.groupBy) {
|
|
180
|
-
const { before = [], after = [],
|
|
181
|
-
setupRoute('/groupby', 'get', before, ${modelName}GroupBy as RequestHandler,
|
|
180
|
+
const { before = [], after = [], inputValidator, outputValidator) = config.groupBy || defaultBeforeAfter;
|
|
181
|
+
setupRoute('/groupby', 'get', before, ${modelName}GroupBy as RequestHandler, inputValidator, outputValidator);
|
|
182
182
|
if (after.length) {
|
|
183
183
|
router.use(basePath + '/groupby', ...after);
|
|
184
184
|
}
|
|
@@ -17,7 +17,6 @@ interface UpdateRequest extends Request {
|
|
|
17
17
|
prisma: PrismaClient;
|
|
18
18
|
body: ${argsTypeName};
|
|
19
19
|
outputValidation?: ZodTypeAny;
|
|
20
|
-
omitOutputValidation?: boolean;
|
|
21
20
|
locals?: {
|
|
22
21
|
outputValidator?: ZodTypeAny;
|
|
23
22
|
};
|
|
@@ -29,13 +28,9 @@ export async function ${functionName}(req: UpdateRequest, res: Response, next: N
|
|
|
29
28
|
try {
|
|
30
29
|
const outputValidator = req.locals?.outputValidator || req.outputValidation;
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
throw new Error('Output validation schema or omission flag must be provided.');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const data = await req.prisma.${(0, strings_1.lowercaseFirstLetter)(modelName)}.update(req.body);
|
|
31
|
+
const data = await req.prisma.${(0, strings_1.toPascalCase)(modelName)}.update(req.body);
|
|
37
32
|
|
|
38
|
-
if (
|
|
33
|
+
if (outputValidator) {
|
|
39
34
|
const validationResult = outputValidator.safeParse(data);
|
|
40
35
|
if (validationResult.success) {
|
|
41
36
|
return res.status(200).json(validationResult.data);
|
|
@@ -45,8 +40,8 @@ export async function ${functionName}(req: UpdateRequest, res: Response, next: N
|
|
|
45
40
|
} else {
|
|
46
41
|
return res.status(200).json(data);
|
|
47
42
|
}
|
|
48
|
-
} catch
|
|
49
|
-
|
|
43
|
+
} catch(error: unknown) {
|
|
44
|
+
next(error)
|
|
50
45
|
}
|
|
51
46
|
}`;
|
|
52
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateUpdate.js","sourceRoot":"","sources":["../../src/helpers/generateUpdate.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"generateUpdate.js","sourceRoot":"","sources":["../../src/helpers/generateUpdate.ts"],"names":[],"mappings":";;;AACA,8CAA+C;AAQxC,MAAM,sBAAsB,GAAG,CAAC,OAGtC,EAAU,EAAE;IACX,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAA;IAChD,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAA;IAC5B,MAAM,YAAY,GAAG,GAAG,SAAS,QAAQ,CAAA;IACzC,MAAM,YAAY,GAAG,UAAU,SAAS,YAAY,CAAA;IAEpD,OAAO;EACP,qBAAqB;;;;;;;UAOb,YAAY;;;;;;;uEAOiD,YAAY;;wBAE3D,YAAY;;;;oCAIA,IAAA,sBAAY,EAAC,SAAS,CAAC;;;;;;;;;;;;;;;EAezD,CAAA;AACF,CAAC,CAAA;AA9CY,QAAA,sBAAsB,0BA8ClC"}
|