@better-giving/schemas 2.1.0 → 2.3.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/index.d.mts +4 -0
- package/dist/index.mjs +4 -1
- package/package.json +4 -4
- package/src/index.mts +16 -0
package/dist/index.d.mts
CHANGED
|
@@ -43,3 +43,7 @@ export declare const increment: import("valibot").ObjectSchema<{
|
|
|
43
43
|
export interface IIncrement extends InferOutput<typeof increment> {
|
|
44
44
|
}
|
|
45
45
|
export declare const target: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"smart", undefined>, import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").TransformAction<string, number>, import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").TransformAction<number, string>]>], undefined>;
|
|
46
|
+
export declare const frequencies: readonly ["one-time", "monthly", "weekly", "annual"];
|
|
47
|
+
export declare const frequency: import("valibot").PicklistSchema<readonly ["one-time", "monthly", "weekly", "annual"], "Please select donation frequency">;
|
|
48
|
+
export declare const frequency_opts: import("valibot").SchemaWithPipe<readonly [import("valibot").ArraySchema<import("valibot").PicklistSchema<readonly ["one-time", "monthly", "weekly", "annual"], "Please select donation frequency">, undefined>, import("valibot").TransformAction<("one-time" | "monthly" | "weekly" | "annual")[], ("one-time" | "monthly" | "weekly" | "annual")[]>, import("valibot").MinLengthAction<("one-time" | "monthly" | "weekly" | "annual")[], 1, "at least one frequency must be selected">]>;
|
|
49
|
+
export type TFrequency = InferOutput<typeof frequency>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { url, custom, excludes, integer, lazy, literal, maxLength, minValue, nonEmpty, number, object, picklist, pipe, regex, string, transform, trim, union, } from "valibot";
|
|
1
|
+
import { url, custom, excludes, integer, lazy, literal, maxLength, minValue, nonEmpty, number, object, picklist, pipe, regex, string, transform, trim, union, array, minLength, } from "valibot";
|
|
2
2
|
export const file_obj = object({
|
|
3
3
|
name: string(),
|
|
4
4
|
publicUrl: pipe(string(), url()),
|
|
@@ -63,3 +63,6 @@ export const target = union([
|
|
|
63
63
|
// "0" - none, `${number}` - fixed
|
|
64
64
|
pipe(string(), transform((v) => +v), number(), minValue(0), transform((v) => v.toString())),
|
|
65
65
|
]);
|
|
66
|
+
export const frequencies = ["one-time", "monthly", "weekly", "annual"];
|
|
67
|
+
export const frequency = picklist(frequencies, "Please select donation frequency");
|
|
68
|
+
export const frequency_opts = pipe(array(frequency), transform((x) => Array.from(new Set(x))), minLength(1, "at least one frequency must be selected"));
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-giving/schemas",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"devDependencies": {
|
|
5
|
-
"@better-giving/config": "1.
|
|
5
|
+
"@better-giving/config": "^1.0.0"
|
|
6
6
|
},
|
|
7
7
|
"files": [
|
|
8
8
|
"src",
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"peerDependencies": {
|
|
12
|
-
"valibot": "1.
|
|
12
|
+
"valibot": "^1.0.0"
|
|
13
13
|
},
|
|
14
14
|
"optionalDependencies": {
|
|
15
|
-
"date-fns": "4.
|
|
15
|
+
"date-fns": "^4.0.0"
|
|
16
16
|
},
|
|
17
17
|
"exports": {
|
|
18
18
|
".": "./dist/index.mjs",
|
package/src/index.mts
CHANGED
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
transform,
|
|
19
19
|
trim,
|
|
20
20
|
union,
|
|
21
|
+
array,
|
|
22
|
+
minLength,
|
|
21
23
|
} from "valibot";
|
|
22
24
|
|
|
23
25
|
export const file_obj = object({
|
|
@@ -146,3 +148,17 @@ export const target = union([
|
|
|
146
148
|
transform((v) => v.toString())
|
|
147
149
|
),
|
|
148
150
|
]);
|
|
151
|
+
|
|
152
|
+
export const frequencies = ["one-time", "monthly", "weekly", "annual"] as const;
|
|
153
|
+
export const frequency = picklist(
|
|
154
|
+
frequencies,
|
|
155
|
+
"Please select donation frequency"
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
export const frequency_opts = pipe(
|
|
159
|
+
array(frequency),
|
|
160
|
+
transform((x) => Array.from(new Set(x))),
|
|
161
|
+
minLength(1, "at least one frequency must be selected")
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
export type TFrequency = InferOutput<typeof frequency>;
|