@strapi/utils 5.13.1 → 5.15.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/dist/zod.js +4 -4
- package/dist/zod.js.map +1 -1
- package/dist/zod.mjs +4 -4
- package/dist/zod.mjs.map +1 -1
- package/package.json +5 -5
package/dist/zod.js
CHANGED
|
@@ -17,11 +17,11 @@ const validateZod = (schema)=>(data)=>{
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
const formatZodErrors = (zodError)=>({
|
|
20
|
-
errors: zodError.
|
|
20
|
+
errors: zodError.format((issue)=>{
|
|
21
21
|
return {
|
|
22
|
-
path:
|
|
23
|
-
message:
|
|
24
|
-
name:
|
|
22
|
+
path: issue.path,
|
|
23
|
+
message: issue.message,
|
|
24
|
+
name: issue.code
|
|
25
25
|
};
|
|
26
26
|
}),
|
|
27
27
|
message: 'Validation error'
|
package/dist/zod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.js","sources":["../src/zod.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { ValidationError } from './errors';\n\nexport const validateZod =\n <T extends z.ZodTypeAny>(schema: T) =>\n (data: unknown): z.TypeOf<T> => {\n try {\n return schema.parse(data);\n } catch (error) {\n if (error instanceof z.ZodError) {\n const { message, errors } = formatZodErrors(error);\n throw new ValidationError(message, { errors });\n }\n\n throw error;\n }\n };\n\nconst formatZodErrors = (zodError: z.ZodError) => ({\n errors: zodError.
|
|
1
|
+
{"version":3,"file":"zod.js","sources":["../src/zod.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { ValidationError } from './errors';\n\nexport const validateZod =\n <T extends z.ZodTypeAny>(schema: T) =>\n (data: unknown): z.TypeOf<T> => {\n try {\n return schema.parse(data);\n } catch (error) {\n if (error instanceof z.ZodError) {\n const { message, errors } = formatZodErrors(error);\n throw new ValidationError(message, { errors });\n }\n\n throw error;\n }\n };\n\nconst formatZodErrors = (zodError: z.ZodError) => ({\n errors: zodError.format((issue) => {\n return {\n path: issue.path,\n message: issue.message,\n name: issue.code,\n };\n }),\n message: 'Validation error',\n});\n"],"names":["validateZod","schema","data","parse","error","z","ZodError","message","errors","formatZodErrors","ValidationError","zodError","format","issue","path","name","code"],"mappings":";;;;;AAIaA,MAAAA,WAAAA,GACX,CAAyBC,MAAAA,GACzB,CAACC,IAAAA,GAAAA;QACC,IAAI;YACF,OAAOD,MAAAA,CAAOE,KAAK,CAACD,IAAAA,CAAAA;AACtB,SAAA,CAAE,OAAOE,KAAO,EAAA;YACd,IAAIA,KAAAA,YAAiBC,KAAEC,CAAAA,QAAQ,EAAE;AAC/B,gBAAA,MAAM,EAAEC,OAAO,UAAEC,QAAM,EAAE,GAAGC,eAAgBL,CAAAA,KAAAA,CAAAA;gBAC5C,MAAM,IAAIM,uBAAgBH,OAAS,EAAA;AAAEC,4BAAAA;AAAO,iBAAA,CAAA;AAC9C;YAEA,MAAMJ,KAAAA;AACR;;AAGJ,MAAMK,eAAAA,GAAkB,CAACE,QAAAA,IAA0B;QACjDH,MAAQG,EAAAA,QAAAA,CAASC,MAAM,CAAC,CAACC,KAAAA,GAAAA;YACvB,OAAO;AACLC,gBAAAA,IAAAA,EAAMD,MAAMC,IAAI;AAChBP,gBAAAA,OAAAA,EAASM,MAAMN,OAAO;AACtBQ,gBAAAA,IAAAA,EAAMF,MAAMG;AACd,aAAA;AACF,SAAA,CAAA;QACAT,OAAS,EAAA;KACX,CAAA;;;;"}
|
package/dist/zod.mjs
CHANGED
|
@@ -15,11 +15,11 @@ const validateZod = (schema)=>(data)=>{
|
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
const formatZodErrors = (zodError)=>({
|
|
18
|
-
errors: zodError.
|
|
18
|
+
errors: zodError.format((issue)=>{
|
|
19
19
|
return {
|
|
20
|
-
path:
|
|
21
|
-
message:
|
|
22
|
-
name:
|
|
20
|
+
path: issue.path,
|
|
21
|
+
message: issue.message,
|
|
22
|
+
name: issue.code
|
|
23
23
|
};
|
|
24
24
|
}),
|
|
25
25
|
message: 'Validation error'
|
package/dist/zod.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.mjs","sources":["../src/zod.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { ValidationError } from './errors';\n\nexport const validateZod =\n <T extends z.ZodTypeAny>(schema: T) =>\n (data: unknown): z.TypeOf<T> => {\n try {\n return schema.parse(data);\n } catch (error) {\n if (error instanceof z.ZodError) {\n const { message, errors } = formatZodErrors(error);\n throw new ValidationError(message, { errors });\n }\n\n throw error;\n }\n };\n\nconst formatZodErrors = (zodError: z.ZodError) => ({\n errors: zodError.
|
|
1
|
+
{"version":3,"file":"zod.mjs","sources":["../src/zod.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { ValidationError } from './errors';\n\nexport const validateZod =\n <T extends z.ZodTypeAny>(schema: T) =>\n (data: unknown): z.TypeOf<T> => {\n try {\n return schema.parse(data);\n } catch (error) {\n if (error instanceof z.ZodError) {\n const { message, errors } = formatZodErrors(error);\n throw new ValidationError(message, { errors });\n }\n\n throw error;\n }\n };\n\nconst formatZodErrors = (zodError: z.ZodError) => ({\n errors: zodError.format((issue) => {\n return {\n path: issue.path,\n message: issue.message,\n name: issue.code,\n };\n }),\n message: 'Validation error',\n});\n"],"names":["validateZod","schema","data","parse","error","z","ZodError","message","errors","formatZodErrors","ValidationError","zodError","format","issue","path","name","code"],"mappings":";;;AAIaA,MAAAA,WAAAA,GACX,CAAyBC,MAAAA,GACzB,CAACC,IAAAA,GAAAA;QACC,IAAI;YACF,OAAOD,MAAAA,CAAOE,KAAK,CAACD,IAAAA,CAAAA;AACtB,SAAA,CAAE,OAAOE,KAAO,EAAA;YACd,IAAIA,KAAAA,YAAiBC,CAAEC,CAAAA,QAAQ,EAAE;AAC/B,gBAAA,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGC,eAAgBL,CAAAA,KAAAA,CAAAA;gBAC5C,MAAM,IAAIM,gBAAgBH,OAAS,EAAA;AAAEC,oBAAAA;AAAO,iBAAA,CAAA;AAC9C;YAEA,MAAMJ,KAAAA;AACR;;AAGJ,MAAMK,eAAAA,GAAkB,CAACE,QAAAA,IAA0B;QACjDH,MAAQG,EAAAA,QAAAA,CAASC,MAAM,CAAC,CAACC,KAAAA,GAAAA;YACvB,OAAO;AACLC,gBAAAA,IAAAA,EAAMD,MAAMC,IAAI;AAChBP,gBAAAA,OAAAA,EAASM,MAAMN,OAAO;AACtBQ,gBAAAA,IAAAA,EAAMF,MAAMG;AACd,aAAA;AACF,SAAA,CAAA;QACAT,OAAS,EAAA;KACX,CAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/utils",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.15.0",
|
|
4
4
|
"description": "Shared utilities for the Strapi packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -56,17 +56,17 @@
|
|
|
56
56
|
"p-map": "4.0.0",
|
|
57
57
|
"preferred-pm": "3.1.2",
|
|
58
58
|
"yup": "0.32.9",
|
|
59
|
-
"zod": "
|
|
59
|
+
"zod": "3.24.2"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/http-errors": "2.0.4",
|
|
63
63
|
"@types/json-logic-js": "2.0.8",
|
|
64
64
|
"@types/koa": "2.13.4",
|
|
65
65
|
"@types/node": "18.19.24",
|
|
66
|
-
"eslint-config-custom": "5.
|
|
67
|
-
"koa": "2.
|
|
66
|
+
"eslint-config-custom": "5.15.0",
|
|
67
|
+
"koa": "2.16.1",
|
|
68
68
|
"koa-body": "6.0.1",
|
|
69
|
-
"tsconfig": "5.
|
|
69
|
+
"tsconfig": "5.15.0"
|
|
70
70
|
},
|
|
71
71
|
"engines": {
|
|
72
72
|
"node": ">=18.0.0 <=22.x.x",
|