@webiny/utils 6.0.0 → 6.1.0-beta.1
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/createZodError.js +0 -1
- package/createZodError.js.map +1 -1
- package/package.json +8 -8
package/createZodError.js
CHANGED
package/createZodError.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WebinyError","generateAlphaNumericId","createValidationErrorData","error","invalidFields","issues","reduce","collection","issue","name","path","join","code","key","message","data","
|
|
1
|
+
{"version":3,"names":["WebinyError","generateAlphaNumericId","createValidationErrorData","error","invalidFields","issues","reduce","collection","issue","name","path","join","code","key","message","data","createZodError"],"sources":["createZodError.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { ZodError } from \"zod\";\nimport { generateAlphaNumericId } from \"~/generateId.js\";\n\ninterface OutputError {\n code: string;\n data: Record<string, any> | null;\n message: string;\n}\n\nexport interface OutputErrors {\n [key: string]: OutputError;\n}\n\nconst createValidationErrorData = (error: ZodError) => {\n return {\n invalidFields: error.issues.reduce<OutputErrors>((collection, issue) => {\n const name = issue.path.join(\".\");\n if (!name && !issue.code) {\n return collection;\n }\n\n const key =\n name ||\n issue.path.join(\".\") ||\n issue.message ||\n issue.code ||\n generateAlphaNumericId();\n collection[key] = {\n code: issue.code,\n message: issue.message,\n data: {\n path: issue.path\n }\n };\n\n return collection;\n }, {})\n };\n};\n\nexport const createZodError = (error: ZodError) => {\n return new WebinyError({\n message: `Validation failed.`,\n code: \"VALIDATION_FAILED_INVALID_FIELDS\",\n data: createValidationErrorData(error)\n });\n};\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AAEvC,SAASC,sBAAsB;AAY/B,MAAMC,yBAAyB,GAAIC,KAAe,IAAK;EACnD,OAAO;IACHC,aAAa,EAAED,KAAK,CAACE,MAAM,CAACC,MAAM,CAAe,CAACC,UAAU,EAAEC,KAAK,KAAK;MACpE,MAAMC,IAAI,GAAGD,KAAK,CAACE,IAAI,CAACC,IAAI,CAAC,GAAG,CAAC;MACjC,IAAI,CAACF,IAAI,IAAI,CAACD,KAAK,CAACI,IAAI,EAAE;QACtB,OAAOL,UAAU;MACrB;MAEA,MAAMM,GAAG,GACLJ,IAAI,IACJD,KAAK,CAACE,IAAI,CAACC,IAAI,CAAC,GAAG,CAAC,IACpBH,KAAK,CAACM,OAAO,IACbN,KAAK,CAACI,IAAI,IACVX,sBAAsB,CAAC,CAAC;MAC5BM,UAAU,CAACM,GAAG,CAAC,GAAG;QACdD,IAAI,EAAEJ,KAAK,CAACI,IAAI;QAChBE,OAAO,EAAEN,KAAK,CAACM,OAAO;QACtBC,IAAI,EAAE;UACFL,IAAI,EAAEF,KAAK,CAACE;QAChB;MACJ,CAAC;MAED,OAAOH,UAAU;IACrB,CAAC,EAAE,CAAC,CAAC;EACT,CAAC;AACL,CAAC;AAED,OAAO,MAAMS,cAAc,GAAIb,KAAe,IAAK;EAC/C,OAAO,IAAIH,WAAW,CAAC;IACnBc,OAAO,EAAE,oBAAoB;IAC7BF,IAAI,EAAE,kCAAkC;IACxCG,IAAI,EAAEb,yBAAyB,CAACC,KAAK;EACzC,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/utils",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.1.0-beta.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -17,20 +17,20 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@noble/hashes": "2.0.1",
|
|
20
|
-
"@webiny/error": "6.0.
|
|
21
|
-
"@webiny/plugins": "6.0.
|
|
20
|
+
"@webiny/error": "6.1.0-beta.1",
|
|
21
|
+
"@webiny/plugins": "6.1.0-beta.1",
|
|
22
22
|
"bson-objectid": "2.0.4",
|
|
23
23
|
"jsonpack": "1.1.5",
|
|
24
|
-
"nanoid": "5.1.
|
|
24
|
+
"nanoid": "5.1.7",
|
|
25
25
|
"nanoid-dictionary": "5.0.0",
|
|
26
26
|
"p-retry": "7.1.1",
|
|
27
|
-
"zod": "3.
|
|
27
|
+
"zod": "4.3.6"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@webiny/build-tools": "6.0.
|
|
30
|
+
"@webiny/build-tools": "6.1.0-beta.1",
|
|
31
31
|
"rimraf": "6.1.3",
|
|
32
32
|
"typescript": "5.9.3",
|
|
33
|
-
"vitest": "4.
|
|
33
|
+
"vitest": "4.1.2"
|
|
34
34
|
},
|
|
35
35
|
"adio": {
|
|
36
36
|
"ignore": {
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
]
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "3c1293ba17a14f239fb1cbf5d80cd66846849309"
|
|
43
43
|
}
|