Update valibot, finally
Signed-off-by: Nicole Mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -30,11 +30,14 @@ const emojiSchema = v.pipe(v.string(), v.emoji());
|
||||
const mimeSchema = v.pipe(v.string(), v.regex(/^\w+\/[-+.\w]+$/));
|
||||
|
||||
/** valibot schema to force the value into an object, if it isn't already. */
|
||||
const coerceObject = <T extends v.ObjectEntries>(shape: T) =>
|
||||
v.pipe(
|
||||
v.any(),
|
||||
v.transform((input) => typeof input === 'object' && input !== null ? input : {}),
|
||||
v.object(shape),
|
||||
);
|
||||
const coerceObject = <T extends v.ObjectEntries>(shape: T): v.ObjectSchema<T, undefined> =>
|
||||
v.optional(
|
||||
v.pipe(
|
||||
v.any(),
|
||||
v.transform((input) => typeof input === 'object' && input !== null ? input : {}),
|
||||
v.object(shape),
|
||||
),
|
||||
{},
|
||||
) as any;
|
||||
|
||||
export { filteredArray, emojiSchema, datetimeSchema, dateSchema, mimeSchema, coerceObject };
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pl-api",
|
||||
"version": "1.0.0-rc.65",
|
||||
"version": "1.0.0-rc.66",
|
||||
"type": "module",
|
||||
"homepage": "https://github.com/mkljczk/pl-fe/tree/develop/packages/pl-api",
|
||||
"repository": {
|
||||
@ -49,7 +49,7 @@
|
||||
"object-to-formdata": "^4.5.1",
|
||||
"query-string": "^9.1.1",
|
||||
"semver": "^7.7.1",
|
||||
"valibot": "^1.0.0-beta.12"
|
||||
"valibot": "^1.1.0"
|
||||
},
|
||||
"module": "./dist/main.es.js",
|
||||
"types": "dist/main.d.ts",
|
||||
|
||||
@ -2875,10 +2875,10 @@ uri-js@^4.2.2, uri-js@^4.4.1:
|
||||
dependencies:
|
||||
punycode "^2.1.0"
|
||||
|
||||
valibot@^1.0.0-beta.12:
|
||||
version "1.0.0-beta.12"
|
||||
resolved "https://registry.yarnpkg.com/valibot/-/valibot-1.0.0-beta.12.tgz#7c0457c8b86b47c3b04fe66e990a589c79eae96a"
|
||||
integrity sha512-j3WIxJ0pmUFMfdfUECn3YnZPYOiG0yHYcFEa/+RVgo0I+MXE3ToLt7gNRLtY5pwGfgNmsmhenGZfU5suu9ijUA==
|
||||
valibot@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/valibot/-/valibot-1.1.0.tgz#873bb1af9e1577391690307bfe0520bd1360ec2d"
|
||||
integrity sha512-Nk8lX30Qhu+9txPYTwM0cFlWLdPFsFr6LblzqIySfbZph9+BFsAHsNvHOymEviUepeIW6KFHzpX8TKhbptBXXw==
|
||||
|
||||
vite-plugin-dts@^4.5.0:
|
||||
version "4.5.0"
|
||||
|
||||
Reference in New Issue
Block a user