@better-giving/fundraiser 1.0.0-rc.1 → 1.0.0-rc.10
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 +7 -2
- package/dist/schema.d.mts +27 -17
- package/dist/schema.mjs +9 -5
- package/package.json +4 -9
- package/src/index.mts +8 -17
- package/src/schema.mts +28 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Fields as FundItem } from "./cloudsearch.mjs";
|
|
2
|
+
import type { DbRecord } from "./db.mjs";
|
|
3
|
+
export type { FundItem };
|
|
2
4
|
export interface FundMember {
|
|
3
5
|
id: number;
|
|
4
6
|
name: string;
|
|
@@ -7,5 +9,8 @@ export interface FundMember {
|
|
|
7
9
|
export interface SingleFund extends Omit<DbRecord, "PK" | "SK" | "members"> {
|
|
8
10
|
members: FundMember[];
|
|
9
11
|
}
|
|
10
|
-
export interface
|
|
12
|
+
export interface FundsPage {
|
|
13
|
+
items: FundItem[];
|
|
14
|
+
page: number;
|
|
15
|
+
numPages: number;
|
|
11
16
|
}
|
package/dist/schema.d.mts
CHANGED
|
@@ -9,11 +9,14 @@ export declare const newFund: import("valibot").ObjectSchema<{
|
|
|
9
9
|
readonly banner: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").UrlAction<string, undefined>]>;
|
|
10
10
|
readonly logo: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").UrlAction<string, undefined>]>;
|
|
11
11
|
/** endowment ids */
|
|
12
|
-
readonly members: import("valibot").ArraySchema<import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>]>, undefined>;
|
|
12
|
+
readonly members: import("valibot").SchemaWithPipe<[import("valibot").ArraySchema<import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>]>, undefined>, import("valibot").NonEmptyAction<number[], undefined>, import("valibot").MaxLengthAction<number[], 10, undefined>]>;
|
|
13
13
|
readonly featured: import("valibot").BooleanSchema<undefined>;
|
|
14
14
|
readonly expiration: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").IsoTimestampAction<string, "invalid date">, import("valibot").MinValueAction<string, string, undefined>]>, never>;
|
|
15
|
+
readonly settings: import("valibot").ObjectSchema<{
|
|
16
|
+
readonly allowBgTip: import("valibot").BooleanSchema<undefined>;
|
|
17
|
+
}, undefined>;
|
|
15
18
|
/** `"0"` - none, {"number"} = fixed */
|
|
16
|
-
readonly target: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"smart", undefined>, import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").TransformAction<number, string>]>], undefined>;
|
|
19
|
+
readonly target: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"smart", undefined>, import("valibot").SchemaWithPipe<[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>;
|
|
17
20
|
}, undefined>;
|
|
18
21
|
export declare const fundUpdate: Omit<Omit<import("valibot").ObjectSchema<{
|
|
19
22
|
readonly name: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">]>;
|
|
@@ -21,11 +24,14 @@ export declare const fundUpdate: Omit<Omit<import("valibot").ObjectSchema<{
|
|
|
21
24
|
readonly banner: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").UrlAction<string, undefined>]>;
|
|
22
25
|
readonly logo: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").UrlAction<string, undefined>]>;
|
|
23
26
|
/** endowment ids */
|
|
24
|
-
readonly members: import("valibot").ArraySchema<import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>]>, undefined>;
|
|
27
|
+
readonly members: import("valibot").SchemaWithPipe<[import("valibot").ArraySchema<import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>]>, undefined>, import("valibot").NonEmptyAction<number[], undefined>, import("valibot").MaxLengthAction<number[], 10, undefined>]>;
|
|
25
28
|
readonly featured: import("valibot").BooleanSchema<undefined>;
|
|
26
29
|
readonly expiration: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").IsoTimestampAction<string, "invalid date">, import("valibot").MinValueAction<string, string, undefined>]>, never>;
|
|
30
|
+
readonly settings: import("valibot").ObjectSchema<{
|
|
31
|
+
readonly allowBgTip: import("valibot").BooleanSchema<undefined>;
|
|
32
|
+
}, undefined>;
|
|
27
33
|
/** `"0"` - none, {"number"} = fixed */
|
|
28
|
-
readonly target: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"smart", undefined>, import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").TransformAction<number, string>]>], undefined>;
|
|
34
|
+
readonly target: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"smart", undefined>, import("valibot").SchemaWithPipe<[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>;
|
|
29
35
|
}, undefined>, "_types" | "_run" | "entries"> & {
|
|
30
36
|
readonly entries: Pick<{
|
|
31
37
|
readonly name: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">]>;
|
|
@@ -33,27 +39,30 @@ export declare const fundUpdate: Omit<Omit<import("valibot").ObjectSchema<{
|
|
|
33
39
|
readonly banner: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").UrlAction<string, undefined>]>;
|
|
34
40
|
readonly logo: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").UrlAction<string, undefined>]>;
|
|
35
41
|
/** endowment ids */
|
|
36
|
-
readonly members: import("valibot").ArraySchema<import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>]>, undefined>;
|
|
42
|
+
readonly members: import("valibot").SchemaWithPipe<[import("valibot").ArraySchema<import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>]>, undefined>, import("valibot").NonEmptyAction<number[], undefined>, import("valibot").MaxLengthAction<number[], 10, undefined>]>;
|
|
37
43
|
readonly featured: import("valibot").BooleanSchema<undefined>;
|
|
38
44
|
readonly expiration: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").IsoTimestampAction<string, "invalid date">, import("valibot").MinValueAction<string, string, undefined>]>, never>;
|
|
45
|
+
readonly settings: import("valibot").ObjectSchema<{
|
|
46
|
+
readonly allowBgTip: import("valibot").BooleanSchema<undefined>;
|
|
47
|
+
}, undefined>;
|
|
39
48
|
/** `"0"` - none, {"number"} = fixed */
|
|
40
|
-
readonly target: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"smart", undefined>, import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").TransformAction<number, string>]>], undefined>;
|
|
49
|
+
readonly target: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"smart", undefined>, import("valibot").SchemaWithPipe<[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>;
|
|
41
50
|
}, "name" | "description" | "banner" | "logo" | "target" | "featured">;
|
|
42
|
-
_run(dataset: import("valibot").Dataset<unknown, never>, config: import("valibot").Config<import("valibot").StringIssue | import("valibot").BooleanIssue | import("valibot").NonEmptyIssue<string> | import("valibot").UrlIssue<string> | import("valibot").NumberIssue | import("valibot").LiteralIssue | import("valibot").MinValueIssue<number, 0> | import("valibot").UnionIssue<import("valibot").
|
|
51
|
+
_run(dataset: import("valibot").Dataset<unknown, never>, config: import("valibot").Config<import("valibot").StringIssue | import("valibot").BooleanIssue | import("valibot").NonEmptyIssue<string> | import("valibot").UrlIssue<string> | import("valibot").NumberIssue | import("valibot").ObjectIssue | import("valibot").LiteralIssue | import("valibot").MinValueIssue<number, 0> | import("valibot").UnionIssue<import("valibot").StringIssue | import("valibot").NumberIssue | import("valibot").LiteralIssue | import("valibot").MinValueIssue<number, 0>>>): import("valibot").Dataset<{
|
|
43
52
|
name: string;
|
|
44
53
|
description: string;
|
|
45
54
|
banner: string;
|
|
46
55
|
logo: string;
|
|
47
56
|
target: string;
|
|
48
57
|
featured: boolean;
|
|
49
|
-
}, import("valibot").StringIssue | import("valibot").BooleanIssue | import("valibot").NonEmptyIssue<string> | import("valibot").UrlIssue<string> | import("valibot").NumberIssue | import("valibot").LiteralIssue | import("valibot").MinValueIssue<number, 0> | import("valibot").UnionIssue<import("valibot").
|
|
58
|
+
}, import("valibot").StringIssue | import("valibot").BooleanIssue | import("valibot").NonEmptyIssue<string> | import("valibot").UrlIssue<string> | import("valibot").NumberIssue | import("valibot").ObjectIssue | import("valibot").LiteralIssue | import("valibot").MinValueIssue<number, 0> | import("valibot").UnionIssue<import("valibot").StringIssue | import("valibot").NumberIssue | import("valibot").LiteralIssue | import("valibot").MinValueIssue<number, 0>>>;
|
|
50
59
|
readonly _types?: {
|
|
51
60
|
readonly input: {
|
|
52
61
|
name: string;
|
|
53
62
|
description: string;
|
|
54
63
|
banner: string;
|
|
55
64
|
logo: string;
|
|
56
|
-
target:
|
|
65
|
+
target: string;
|
|
57
66
|
featured: boolean;
|
|
58
67
|
};
|
|
59
68
|
readonly output: {
|
|
@@ -64,7 +73,7 @@ export declare const fundUpdate: Omit<Omit<import("valibot").ObjectSchema<{
|
|
|
64
73
|
target: string;
|
|
65
74
|
featured: boolean;
|
|
66
75
|
};
|
|
67
|
-
readonly issue: import("valibot").StringIssue | import("valibot").BooleanIssue | import("valibot").NonEmptyIssue<string> | import("valibot").UrlIssue<string> | import("valibot").NumberIssue | import("valibot").LiteralIssue | import("valibot").MinValueIssue<number, 0> | import("valibot").UnionIssue<import("valibot").
|
|
76
|
+
readonly issue: import("valibot").StringIssue | import("valibot").BooleanIssue | import("valibot").NonEmptyIssue<string> | import("valibot").UrlIssue<string> | import("valibot").NumberIssue | import("valibot").ObjectIssue | import("valibot").LiteralIssue | import("valibot").MinValueIssue<number, 0> | import("valibot").UnionIssue<import("valibot").StringIssue | import("valibot").NumberIssue | import("valibot").LiteralIssue | import("valibot").MinValueIssue<number, 0>>;
|
|
68
77
|
} | undefined;
|
|
69
78
|
}, "_types" | "_run" | "entries"> & {
|
|
70
79
|
readonly entries: {
|
|
@@ -72,24 +81,24 @@ export declare const fundUpdate: Omit<Omit<import("valibot").ObjectSchema<{
|
|
|
72
81
|
readonly description: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">]>, never>;
|
|
73
82
|
readonly banner: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").UrlAction<string, undefined>]>, never>;
|
|
74
83
|
readonly logo: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").UrlAction<string, undefined>]>, never>;
|
|
75
|
-
readonly target: import("valibot").OptionalSchema<import("valibot").UnionSchema<[import("valibot").LiteralSchema<"smart", undefined>, import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").TransformAction<number, string>]>], undefined>, never>;
|
|
84
|
+
readonly target: import("valibot").OptionalSchema<import("valibot").UnionSchema<[import("valibot").LiteralSchema<"smart", undefined>, import("valibot").SchemaWithPipe<[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>, never>;
|
|
76
85
|
readonly featured: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, never>;
|
|
77
86
|
};
|
|
78
|
-
_run(dataset: import("valibot").Dataset<unknown, never>, config: import("valibot").Config<import("valibot").StringIssue | import("valibot").BooleanIssue | import("valibot").NonEmptyIssue<string> | import("valibot").UrlIssue<string> | import("valibot").NumberIssue | import("valibot").LiteralIssue | import("valibot").MinValueIssue<number, 0> | import("valibot").UnionIssue<import("valibot").
|
|
87
|
+
_run(dataset: import("valibot").Dataset<unknown, never>, config: import("valibot").Config<import("valibot").StringIssue | import("valibot").BooleanIssue | import("valibot").NonEmptyIssue<string> | import("valibot").UrlIssue<string> | import("valibot").NumberIssue | import("valibot").ObjectIssue | import("valibot").LiteralIssue | import("valibot").MinValueIssue<number, 0> | import("valibot").UnionIssue<import("valibot").StringIssue | import("valibot").NumberIssue | import("valibot").LiteralIssue | import("valibot").MinValueIssue<number, 0>>>): import("valibot").Dataset<{
|
|
79
88
|
name?: string | undefined;
|
|
80
89
|
description?: string | undefined;
|
|
81
90
|
banner?: string | undefined;
|
|
82
91
|
logo?: string | undefined;
|
|
83
92
|
target?: string | undefined;
|
|
84
93
|
featured?: boolean | undefined;
|
|
85
|
-
}, import("valibot").StringIssue | import("valibot").BooleanIssue | import("valibot").NonEmptyIssue<string> | import("valibot").UrlIssue<string> | import("valibot").NumberIssue | import("valibot").LiteralIssue | import("valibot").MinValueIssue<number, 0> | import("valibot").UnionIssue<import("valibot").
|
|
94
|
+
}, import("valibot").StringIssue | import("valibot").BooleanIssue | import("valibot").NonEmptyIssue<string> | import("valibot").UrlIssue<string> | import("valibot").NumberIssue | import("valibot").ObjectIssue | import("valibot").LiteralIssue | import("valibot").MinValueIssue<number, 0> | import("valibot").UnionIssue<import("valibot").StringIssue | import("valibot").NumberIssue | import("valibot").LiteralIssue | import("valibot").MinValueIssue<number, 0>>>;
|
|
86
95
|
readonly _types?: {
|
|
87
96
|
readonly input: {
|
|
88
97
|
name?: string | undefined;
|
|
89
98
|
description?: string | undefined;
|
|
90
99
|
banner?: string | undefined;
|
|
91
100
|
logo?: string | undefined;
|
|
92
|
-
target?:
|
|
101
|
+
target?: string | undefined;
|
|
93
102
|
featured?: boolean | undefined;
|
|
94
103
|
};
|
|
95
104
|
readonly output: {
|
|
@@ -100,16 +109,17 @@ export declare const fundUpdate: Omit<Omit<import("valibot").ObjectSchema<{
|
|
|
100
109
|
target?: string | undefined;
|
|
101
110
|
featured?: boolean | undefined;
|
|
102
111
|
};
|
|
103
|
-
readonly issue: import("valibot").StringIssue | import("valibot").BooleanIssue | import("valibot").NonEmptyIssue<string> | import("valibot").UrlIssue<string> | import("valibot").NumberIssue | import("valibot").LiteralIssue | import("valibot").MinValueIssue<number, 0> | import("valibot").UnionIssue<import("valibot").
|
|
112
|
+
readonly issue: import("valibot").StringIssue | import("valibot").BooleanIssue | import("valibot").NonEmptyIssue<string> | import("valibot").UrlIssue<string> | import("valibot").NumberIssue | import("valibot").ObjectIssue | import("valibot").LiteralIssue | import("valibot").MinValueIssue<number, 0> | import("valibot").UnionIssue<import("valibot").StringIssue | import("valibot").NumberIssue | import("valibot").LiteralIssue | import("valibot").MinValueIssue<number, 0>>;
|
|
104
113
|
} | undefined;
|
|
105
114
|
};
|
|
106
115
|
export declare const fundsParams: import("valibot").ObjectSchema<{
|
|
107
116
|
/** search text */
|
|
108
117
|
readonly query: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, never>;
|
|
109
|
-
|
|
118
|
+
/** input str: from url */
|
|
119
|
+
readonly page: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").TransformAction<string, number>, import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>]>, never>;
|
|
110
120
|
}, undefined>;
|
|
111
121
|
export declare const fundsEndowMemberOfParams: import("valibot").ObjectSchema<{
|
|
112
|
-
readonly npoProfileFeatured: import("valibot").BooleanSchema<undefined>;
|
|
122
|
+
readonly npoProfileFeatured: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").TransformAction<string, boolean>, import("valibot").BooleanSchema<undefined>]>, never>;
|
|
113
123
|
}, undefined>;
|
|
114
124
|
export interface NewFund extends InferOutput<typeof newFund> {
|
|
115
125
|
}
|
package/dist/schema.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { url, array, boolean, integer, isoTimestamp, literal, minValue, nonEmpty, number, object, optional, partial, pick, pipe, string, transform, trim, union, uuid, } from "valibot";
|
|
1
|
+
import { url, array, boolean, integer, isoTimestamp, literal, maxLength, minValue, nonEmpty, number, object, optional, partial, pick, pipe, string, transform, trim, union, uuid, } from "valibot";
|
|
2
2
|
const str = pipe(string(), trim());
|
|
3
3
|
export const fundId = pipe(str, uuid());
|
|
4
4
|
export const settings = object({
|
|
@@ -10,21 +10,23 @@ export const newFund = object({
|
|
|
10
10
|
banner: pipe(str, url()),
|
|
11
11
|
logo: pipe(str, url()),
|
|
12
12
|
/** endowment ids */
|
|
13
|
-
members: array(pipe(number(), integer(), minValue(1))),
|
|
13
|
+
members: pipe(array(pipe(number(), integer(), minValue(1))), nonEmpty(), maxLength(10)),
|
|
14
14
|
featured: boolean(),
|
|
15
15
|
expiration: optional(pipe(str, isoTimestamp("invalid date"), minValue(new Date().toISOString()) //created each parsing
|
|
16
16
|
)),
|
|
17
|
+
settings,
|
|
17
18
|
/** `"0"` - none, {"number"} = fixed */
|
|
18
19
|
target: union([
|
|
19
20
|
literal("smart"),
|
|
20
|
-
pipe(number(), minValue(0), transform((v) => v.toString())),
|
|
21
|
+
pipe(string(), transform((v) => +v), number(), minValue(0), transform((v) => v.toString())),
|
|
21
22
|
]),
|
|
22
23
|
});
|
|
23
24
|
export const fundUpdate = partial(pick(newFund, ["name", "description", "banner", "logo", "featured", "target"]));
|
|
24
25
|
export const fundsParams = object({
|
|
25
26
|
/** search text */
|
|
26
27
|
query: optional(str),
|
|
27
|
-
|
|
28
|
+
/** input str: from url */
|
|
29
|
+
page: optional(pipe(str, transform((x) => +x), number(), integer(), minValue(1))),
|
|
28
30
|
});
|
|
29
31
|
export const fundsEndowMemberOfParams = object({
|
|
30
32
|
/*
|
|
@@ -32,6 +34,8 @@ export const fundsEndowMemberOfParams = object({
|
|
|
32
34
|
* and is approved:
|
|
33
35
|
* either pre-approval in creation (creator has endow credential)
|
|
34
36
|
* or creator has no credential but later npo approved
|
|
37
|
+
*
|
|
38
|
+
* input str: from url
|
|
35
39
|
*/
|
|
36
|
-
npoProfileFeatured: boolean(),
|
|
40
|
+
npoProfileFeatured: optional(pipe(str, transform((x) => x === "true"), boolean())),
|
|
37
41
|
});
|
package/package.json
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-giving/fundraiser",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
4
|
-
"dependencies": {
|
|
5
|
-
"valibot": "0.42.0"
|
|
6
|
-
},
|
|
3
|
+
"version": "1.0.0-rc.10",
|
|
7
4
|
"peerDependencies": {
|
|
8
|
-
"
|
|
5
|
+
"@better-giving/types": "1.0.1"
|
|
9
6
|
},
|
|
10
7
|
"devDependencies": {
|
|
11
|
-
"@better-giving/config": "workspace:*"
|
|
12
|
-
"@better-giving/types": "workspace:*"
|
|
8
|
+
"@better-giving/config": "workspace:*"
|
|
13
9
|
},
|
|
14
10
|
"files": [
|
|
15
11
|
"src",
|
|
@@ -23,7 +19,6 @@
|
|
|
23
19
|
},
|
|
24
20
|
"scripts": {
|
|
25
21
|
"publish": "npm publish --access public",
|
|
26
|
-
"build": "
|
|
27
|
-
"type-chek": "tsc --noEmit"
|
|
22
|
+
"build": "tsc --outDir dist"
|
|
28
23
|
}
|
|
29
24
|
}
|
package/src/index.mts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Fields as FundItem } from "./cloudsearch.mjs";
|
|
2
|
+
import type { DbRecord } from "./db.mjs";
|
|
3
|
+
export type { FundItem };
|
|
2
4
|
|
|
3
5
|
export interface FundMember {
|
|
4
6
|
id: number;
|
|
@@ -10,19 +12,8 @@ export interface SingleFund extends Omit<DbRecord, "PK" | "SK" | "members"> {
|
|
|
10
12
|
members: FundMember[];
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
export interface
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
| "description"
|
|
19
|
-
| "env"
|
|
20
|
-
| "logo"
|
|
21
|
-
| "featured"
|
|
22
|
-
| "active"
|
|
23
|
-
| "verified"
|
|
24
|
-
| "donation_total_usd"
|
|
25
|
-
| "members"
|
|
26
|
-
| "target"
|
|
27
|
-
| "approvers"
|
|
28
|
-
> {}
|
|
15
|
+
export interface FundsPage {
|
|
16
|
+
items: FundItem[];
|
|
17
|
+
page: number;
|
|
18
|
+
numPages: number;
|
|
19
|
+
}
|
package/src/schema.mts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
integer,
|
|
7
7
|
isoTimestamp,
|
|
8
8
|
literal,
|
|
9
|
+
maxLength,
|
|
9
10
|
minValue,
|
|
10
11
|
nonEmpty,
|
|
11
12
|
number,
|
|
@@ -35,7 +36,11 @@ export const newFund = object({
|
|
|
35
36
|
banner: pipe(str, url()),
|
|
36
37
|
logo: pipe(str, url()),
|
|
37
38
|
/** endowment ids */
|
|
38
|
-
members:
|
|
39
|
+
members: pipe(
|
|
40
|
+
array(pipe(number(), integer(), minValue(1))),
|
|
41
|
+
nonEmpty(),
|
|
42
|
+
maxLength(10)
|
|
43
|
+
),
|
|
39
44
|
featured: boolean(),
|
|
40
45
|
expiration: optional(
|
|
41
46
|
pipe(
|
|
@@ -44,10 +49,13 @@ export const newFund = object({
|
|
|
44
49
|
minValue(new Date().toISOString()) //created each parsing
|
|
45
50
|
)
|
|
46
51
|
),
|
|
52
|
+
settings,
|
|
47
53
|
/** `"0"` - none, {"number"} = fixed */
|
|
48
54
|
target: union([
|
|
49
55
|
literal("smart"),
|
|
50
56
|
pipe(
|
|
57
|
+
string(),
|
|
58
|
+
transform((v) => +v),
|
|
51
59
|
number(),
|
|
52
60
|
minValue(0),
|
|
53
61
|
transform((v) => v.toString())
|
|
@@ -62,7 +70,16 @@ export const fundUpdate = partial(
|
|
|
62
70
|
export const fundsParams = object({
|
|
63
71
|
/** search text */
|
|
64
72
|
query: optional(str),
|
|
65
|
-
|
|
73
|
+
/** input str: from url */
|
|
74
|
+
page: optional(
|
|
75
|
+
pipe(
|
|
76
|
+
str,
|
|
77
|
+
transform((x) => +x),
|
|
78
|
+
number(),
|
|
79
|
+
integer(),
|
|
80
|
+
minValue(1)
|
|
81
|
+
)
|
|
82
|
+
),
|
|
66
83
|
});
|
|
67
84
|
|
|
68
85
|
export const fundsEndowMemberOfParams = object({
|
|
@@ -71,8 +88,16 @@ export const fundsEndowMemberOfParams = object({
|
|
|
71
88
|
* and is approved:
|
|
72
89
|
* either pre-approval in creation (creator has endow credential)
|
|
73
90
|
* or creator has no credential but later npo approved
|
|
91
|
+
*
|
|
92
|
+
* input str: from url
|
|
74
93
|
*/
|
|
75
|
-
npoProfileFeatured:
|
|
94
|
+
npoProfileFeatured: optional(
|
|
95
|
+
pipe(
|
|
96
|
+
str,
|
|
97
|
+
transform((x) => x === "true"),
|
|
98
|
+
boolean()
|
|
99
|
+
)
|
|
100
|
+
),
|
|
76
101
|
});
|
|
77
102
|
|
|
78
103
|
export interface NewFund extends InferOutput<typeof newFund> {}
|