@better-giving/schemas 2.0.2 → 2.0.3
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/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +4 -1
- package/src/index.mts +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -26,8 +26,8 @@ export declare const $req_num_gt0: import("valibot").SchemaWithPipe<[import("val
|
|
|
26
26
|
export declare const $num_gt0_fn: ({ required, }?: {
|
|
27
27
|
required?: boolean;
|
|
28
28
|
}) => import("valibot").LazySchema<import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]> | import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">]> | import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">]>, import("valibot").TransformAction<string, number>, import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, "must be > 0">]>, import("valibot").TransformAction<number, string>]>>;
|
|
29
|
-
export declare const https_url: (
|
|
30
|
-
required?: boolean
|
|
29
|
+
export declare const https_url: (opts?: {
|
|
30
|
+
required?: boolean;
|
|
31
31
|
}) => import("valibot").LazySchema<import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]> | import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">]> | import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]>, import("valibot").TransformAction<string, string>, import("valibot").UrlAction<string, "invalid url">]>>;
|
|
32
32
|
export declare const segment_max_chars = 30;
|
|
33
33
|
export declare const segment: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]>, import("valibot").MaxLengthAction<string, 30, ({ requirement: r }: import("valibot").MaxLengthIssue<string, 30>) => string>, import("valibot").RegexAction<string, "should not be an id">, import("valibot").RegexAction<string, "allowed: numbers | letters | - | . | _ | ~">, import("valibot").ExcludesAction<string, "..", "should not contain double periods">, import("valibot").CustomSchema<string, "should not start with dot">, import("valibot").CustomSchema<string, "should not end with dot">]>;
|
package/dist/index.mjs
CHANGED
|
@@ -34,10 +34,10 @@ export const $num_gt0_fn = ({ required = false, } = {}) => {
|
|
|
34
34
|
return $req_num_gt0;
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
|
-
export const https_url = (
|
|
37
|
+
export const https_url = (opts) => {
|
|
38
38
|
return lazy((x) => {
|
|
39
39
|
if (!x)
|
|
40
|
-
return required ? $req : $;
|
|
40
|
+
return (opts?.required ?? false) ? $req : $;
|
|
41
41
|
return pipe($, transform((x) => (x.startsWith("https://") ? x : `https://${x}`)), url("invalid url"));
|
|
42
42
|
});
|
|
43
43
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-giving/schemas",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@better-giving/config": "1.1.2"
|
|
6
6
|
},
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
"peerDependencies": {
|
|
12
12
|
"valibot": "0.42.0"
|
|
13
13
|
},
|
|
14
|
+
"optionalDependencies": {
|
|
15
|
+
"date-fns": "4.1.0"
|
|
16
|
+
},
|
|
14
17
|
"exports": {
|
|
15
18
|
".": "./dist/index.mjs",
|
|
16
19
|
"./*": "./dist/*.mjs"
|
package/src/index.mts
CHANGED
|
@@ -80,9 +80,9 @@ export const $num_gt0_fn = ({
|
|
|
80
80
|
});
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
export const https_url = ({ required
|
|
83
|
+
export const https_url = (opts?: { required?: boolean }) => {
|
|
84
84
|
return lazy((x) => {
|
|
85
|
-
if (!x) return required ? $req : $;
|
|
85
|
+
if (!x) return (opts?.required ?? false) ? $req : $;
|
|
86
86
|
return pipe(
|
|
87
87
|
$,
|
|
88
88
|
transform((x) => (x.startsWith("https://") ? x : `https://${x}`)),
|