@better-giving/fundraiser 1.0.5 → 1.0.7
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/cloudsearch.d.mts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/schema.d.mts +17 -13
- package/dist/schema.mjs +4 -1
- package/package.json +2 -1
- package/src/cloudsearch.mts +1 -7
- package/src/index.mts +8 -1
- package/src/schema.mts +11 -7
package/dist/cloudsearch.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ToDoc, ToHitFields, ToUpdate } from "@better-giving/types/cloudsearch";
|
|
2
2
|
import type { FundInternal, NewFund } from "./schema.mjs";
|
|
3
|
-
export interface CloudsearchFund extends Pick<NewFund, "name" | "description" | "logo" | "banner" | "featured" | "members" | "target">, Pick<FundInternal, "id" | "env" | "active" | "verified" | "donation_total_usd" | "
|
|
3
|
+
export interface CloudsearchFund extends Pick<NewFund, "name" | "description" | "logo" | "banner" | "featured" | "members" | "target">, Pick<FundInternal, "id" | "env" | "active" | "verified" | "donation_total_usd" | "creator"> {
|
|
4
4
|
/** iso | "9999-12-31T23:59:59.000Z" year 9999 */
|
|
5
5
|
expiration: string;
|
|
6
6
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CloudsearchFund as FundItem } from "./cloudsearch.mjs";
|
|
2
2
|
import type { FundInternal, NewFund } from "./schema.mjs";
|
|
3
|
-
export type { Environment } from "./schema.mjs";
|
|
3
|
+
export type { Environment, FundSettings, FundUpdate, FundsEndowMemberOfParams, FundsParams, NewFund, } from "./schema.mjs";
|
|
4
4
|
export type { FundItem };
|
|
5
5
|
export interface FundMember {
|
|
6
6
|
id: number;
|
package/dist/schema.d.mts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import type { DonateMethodId } from "@better-giving/schemas";
|
|
1
2
|
import type { Environment } from "@better-giving/types/list";
|
|
2
3
|
export type { Environment } from "@better-giving/types/list";
|
|
3
4
|
import { type InferOutput } from "valibot";
|
|
4
5
|
export declare const fundId: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").UuidAction<string, undefined>]>;
|
|
6
|
+
/** when fundraiser is created in the context of an NPO, all members of that NPO can edit the fundraiser */
|
|
7
|
+
export declare const npoOwner: import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>]>;
|
|
5
8
|
export declare const newFund: import("valibot").ObjectSchema<{
|
|
6
9
|
readonly name: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">]>;
|
|
7
10
|
readonly description: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">]>;
|
|
@@ -14,6 +17,7 @@ export declare const newFund: import("valibot").ObjectSchema<{
|
|
|
14
17
|
/** `"0"` - none, {"number"} = fixed */
|
|
15
18
|
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>;
|
|
16
19
|
readonly videos: import("valibot").ArraySchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").UrlAction<string, undefined>]>, undefined>;
|
|
20
|
+
readonly npoOwner: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>]>, never>;
|
|
17
21
|
}, undefined>;
|
|
18
22
|
export declare const fundUpdate: Omit<Omit<import("valibot").ObjectSchema<{
|
|
19
23
|
readonly name: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">]>;
|
|
@@ -27,6 +31,7 @@ export declare const fundUpdate: Omit<Omit<import("valibot").ObjectSchema<{
|
|
|
27
31
|
/** `"0"` - none, {"number"} = fixed */
|
|
28
32
|
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
33
|
readonly videos: import("valibot").ArraySchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").UrlAction<string, undefined>]>, undefined>;
|
|
34
|
+
readonly npoOwner: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>]>, never>;
|
|
30
35
|
}, undefined>, "_types" | "_run" | "entries"> & {
|
|
31
36
|
readonly entries: Pick<{
|
|
32
37
|
readonly name: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">]>;
|
|
@@ -40,8 +45,9 @@ export declare const fundUpdate: Omit<Omit<import("valibot").ObjectSchema<{
|
|
|
40
45
|
/** `"0"` - none, {"number"} = fixed */
|
|
41
46
|
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>;
|
|
42
47
|
readonly videos: import("valibot").ArraySchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").UrlAction<string, undefined>]>, undefined>;
|
|
48
|
+
readonly npoOwner: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>]>, never>;
|
|
43
49
|
}, "name" | "description" | "banner" | "logo" | "target" | "videos" | "featured">;
|
|
44
|
-
_run(dataset: import("valibot").Dataset<unknown, never>, config: import("valibot").Config<import("valibot").StringIssue | import("valibot").
|
|
50
|
+
_run(dataset: import("valibot").Dataset<unknown, never>, config: import("valibot").Config<import("valibot").StringIssue | import("valibot").NumberIssue | import("valibot").NonEmptyIssue<string> | import("valibot").UrlIssue<string> | import("valibot").ArrayIssue | import("valibot").BooleanIssue | 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").ObjectIssue>): import("valibot").Dataset<{
|
|
45
51
|
name: string;
|
|
46
52
|
description: string;
|
|
47
53
|
banner: string;
|
|
@@ -49,7 +55,7 @@ export declare const fundUpdate: Omit<Omit<import("valibot").ObjectSchema<{
|
|
|
49
55
|
target: string;
|
|
50
56
|
videos: string[];
|
|
51
57
|
featured: boolean;
|
|
52
|
-
}, import("valibot").StringIssue | import("valibot").
|
|
58
|
+
}, import("valibot").StringIssue | import("valibot").NumberIssue | import("valibot").NonEmptyIssue<string> | import("valibot").UrlIssue<string> | import("valibot").ArrayIssue | import("valibot").BooleanIssue | 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").ObjectIssue>;
|
|
53
59
|
readonly _types?: {
|
|
54
60
|
readonly input: {
|
|
55
61
|
name: string;
|
|
@@ -69,7 +75,7 @@ export declare const fundUpdate: Omit<Omit<import("valibot").ObjectSchema<{
|
|
|
69
75
|
videos: string[];
|
|
70
76
|
featured: boolean;
|
|
71
77
|
};
|
|
72
|
-
readonly issue: import("valibot").StringIssue | import("valibot").
|
|
78
|
+
readonly issue: import("valibot").StringIssue | import("valibot").NumberIssue | import("valibot").NonEmptyIssue<string> | import("valibot").UrlIssue<string> | import("valibot").ArrayIssue | import("valibot").BooleanIssue | 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").ObjectIssue;
|
|
73
79
|
} | undefined;
|
|
74
80
|
}, "_types" | "_run" | "entries"> & {
|
|
75
81
|
readonly entries: {
|
|
@@ -81,7 +87,7 @@ export declare const fundUpdate: Omit<Omit<import("valibot").ObjectSchema<{
|
|
|
81
87
|
readonly videos: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").UrlAction<string, undefined>]>, undefined>, never>;
|
|
82
88
|
readonly featured: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, never>;
|
|
83
89
|
};
|
|
84
|
-
_run(dataset: import("valibot").Dataset<unknown, never>, config: import("valibot").Config<import("valibot").StringIssue | import("valibot").
|
|
90
|
+
_run(dataset: import("valibot").Dataset<unknown, never>, config: import("valibot").Config<import("valibot").StringIssue | import("valibot").NumberIssue | import("valibot").NonEmptyIssue<string> | import("valibot").UrlIssue<string> | import("valibot").ArrayIssue | import("valibot").BooleanIssue | 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").ObjectIssue>): import("valibot").Dataset<{
|
|
85
91
|
name?: string | undefined;
|
|
86
92
|
description?: string | undefined;
|
|
87
93
|
banner?: string | undefined;
|
|
@@ -89,7 +95,7 @@ export declare const fundUpdate: Omit<Omit<import("valibot").ObjectSchema<{
|
|
|
89
95
|
target?: string | undefined;
|
|
90
96
|
videos?: string[] | undefined;
|
|
91
97
|
featured?: boolean | undefined;
|
|
92
|
-
}, import("valibot").StringIssue | import("valibot").
|
|
98
|
+
}, import("valibot").StringIssue | import("valibot").NumberIssue | import("valibot").NonEmptyIssue<string> | import("valibot").UrlIssue<string> | import("valibot").ArrayIssue | import("valibot").BooleanIssue | 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").ObjectIssue>;
|
|
93
99
|
readonly _types?: {
|
|
94
100
|
readonly input: {
|
|
95
101
|
name?: string | undefined;
|
|
@@ -109,7 +115,7 @@ export declare const fundUpdate: Omit<Omit<import("valibot").ObjectSchema<{
|
|
|
109
115
|
videos?: string[] | undefined;
|
|
110
116
|
featured?: boolean | undefined;
|
|
111
117
|
};
|
|
112
|
-
readonly issue: import("valibot").StringIssue | import("valibot").
|
|
118
|
+
readonly issue: import("valibot").StringIssue | import("valibot").NumberIssue | import("valibot").NonEmptyIssue<string> | import("valibot").UrlIssue<string> | import("valibot").ArrayIssue | import("valibot").BooleanIssue | 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").ObjectIssue;
|
|
113
119
|
} | undefined;
|
|
114
120
|
};
|
|
115
121
|
export declare const fundsParams: import("valibot").ObjectSchema<{
|
|
@@ -129,6 +135,10 @@ export interface FundsParams extends InferOutput<typeof fundsParams> {
|
|
|
129
135
|
}
|
|
130
136
|
export interface FundsEndowMemberOfParams extends InferOutput<typeof fundsEndowMemberOfParams> {
|
|
131
137
|
}
|
|
138
|
+
export interface FundSettings {
|
|
139
|
+
hide_bg_tip: boolean;
|
|
140
|
+
donateMethods?: DonateMethodId[];
|
|
141
|
+
}
|
|
132
142
|
export interface FundInternal {
|
|
133
143
|
/** uuid */
|
|
134
144
|
id: string;
|
|
@@ -138,13 +148,7 @@ export interface FundInternal {
|
|
|
138
148
|
verified: boolean;
|
|
139
149
|
/** to date received: initialized to `0` */
|
|
140
150
|
donation_total_usd: number;
|
|
141
|
-
/**
|
|
142
|
-
* approving NPO ids
|
|
143
|
-
* NPOs have a whitelist of fundraisers they support. thus, appears in their NPO profile page
|
|
144
|
-
* @default - [0]
|
|
145
|
-
* */
|
|
146
|
-
approvers: number[];
|
|
147
|
-
allow_bg_tip: boolean;
|
|
148
151
|
/** user email or better giving (if creator is bg-admin) */
|
|
149
152
|
creator: string;
|
|
153
|
+
settings: FundSettings;
|
|
150
154
|
}
|
package/dist/schema.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { url, array, boolean, integer, isoTimestamp, literal, maxLength, 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, email, } from "valibot";
|
|
2
2
|
const str = pipe(string(), trim());
|
|
3
3
|
export const fundId = pipe(str, uuid());
|
|
4
|
+
/** when fundraiser is created in the context of an NPO, all members of that NPO can edit the fundraiser */
|
|
5
|
+
export const npoOwner = pipe(number(), integer(), minValue(1));
|
|
4
6
|
export const newFund = object({
|
|
5
7
|
name: pipe(str, nonEmpty("required")),
|
|
6
8
|
description: pipe(str, nonEmpty("required")),
|
|
@@ -17,6 +19,7 @@ export const newFund = object({
|
|
|
17
19
|
pipe(string(), transform((v) => +v), number(), minValue(0), transform((v) => v.toString())),
|
|
18
20
|
]),
|
|
19
21
|
videos: array(pipe(str, url())),
|
|
22
|
+
npoOwner: optional(npoOwner),
|
|
20
23
|
});
|
|
21
24
|
export const fundUpdate = partial(pick(newFund, [
|
|
22
25
|
"name",
|
package/package.json
CHANGED
package/src/cloudsearch.mts
CHANGED
|
@@ -18,13 +18,7 @@ export interface CloudsearchFund
|
|
|
18
18
|
>,
|
|
19
19
|
Pick<
|
|
20
20
|
FundInternal,
|
|
21
|
-
| "
|
|
22
|
-
| "env"
|
|
23
|
-
| "active"
|
|
24
|
-
| "verified"
|
|
25
|
-
| "donation_total_usd"
|
|
26
|
-
| "approvers"
|
|
27
|
-
| "creator"
|
|
21
|
+
"id" | "env" | "active" | "verified" | "donation_total_usd" | "creator"
|
|
28
22
|
> {
|
|
29
23
|
/** iso | "9999-12-31T23:59:59.000Z" year 9999 */
|
|
30
24
|
expiration: string;
|
package/src/index.mts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { CloudsearchFund as FundItem } from "./cloudsearch.mjs";
|
|
2
2
|
import type { FundInternal, NewFund } from "./schema.mjs";
|
|
3
|
-
export type {
|
|
3
|
+
export type {
|
|
4
|
+
Environment,
|
|
5
|
+
FundSettings,
|
|
6
|
+
FundUpdate,
|
|
7
|
+
FundsEndowMemberOfParams,
|
|
8
|
+
FundsParams,
|
|
9
|
+
NewFund,
|
|
10
|
+
} from "./schema.mjs";
|
|
4
11
|
export type { FundItem };
|
|
5
12
|
|
|
6
13
|
export interface FundMember {
|
package/src/schema.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DonateMethodId } from "@better-giving/schemas";
|
|
1
2
|
import type { Environment } from "@better-giving/types/list";
|
|
2
3
|
export type { Environment } from "@better-giving/types/list";
|
|
3
4
|
import {
|
|
@@ -22,11 +23,14 @@ import {
|
|
|
22
23
|
trim,
|
|
23
24
|
union,
|
|
24
25
|
uuid,
|
|
26
|
+
email,
|
|
25
27
|
} from "valibot";
|
|
26
28
|
|
|
27
29
|
const str = pipe(string(), trim());
|
|
28
30
|
|
|
29
31
|
export const fundId = pipe(str, uuid());
|
|
32
|
+
/** when fundraiser is created in the context of an NPO, all members of that NPO can edit the fundraiser */
|
|
33
|
+
export const npoOwner = pipe(number(), integer(), minValue(1));
|
|
30
34
|
|
|
31
35
|
export const newFund = object({
|
|
32
36
|
name: pipe(str, nonEmpty("required")),
|
|
@@ -59,6 +63,7 @@ export const newFund = object({
|
|
|
59
63
|
),
|
|
60
64
|
]),
|
|
61
65
|
videos: array(pipe(str, url())),
|
|
66
|
+
npoOwner: optional(npoOwner),
|
|
62
67
|
});
|
|
63
68
|
|
|
64
69
|
export const fundUpdate = partial(
|
|
@@ -112,6 +117,11 @@ export interface FundsParams extends InferOutput<typeof fundsParams> {}
|
|
|
112
117
|
export interface FundsEndowMemberOfParams
|
|
113
118
|
extends InferOutput<typeof fundsEndowMemberOfParams> {}
|
|
114
119
|
|
|
120
|
+
export interface FundSettings {
|
|
121
|
+
hide_bg_tip: boolean;
|
|
122
|
+
donateMethods?: DonateMethodId[];
|
|
123
|
+
}
|
|
124
|
+
|
|
115
125
|
export interface FundInternal {
|
|
116
126
|
/** uuid */
|
|
117
127
|
id: string;
|
|
@@ -121,13 +131,7 @@ export interface FundInternal {
|
|
|
121
131
|
verified: boolean;
|
|
122
132
|
/** to date received: initialized to `0` */
|
|
123
133
|
donation_total_usd: number;
|
|
124
|
-
/**
|
|
125
|
-
* approving NPO ids
|
|
126
|
-
* NPOs have a whitelist of fundraisers they support. thus, appears in their NPO profile page
|
|
127
|
-
* @default - [0]
|
|
128
|
-
* */
|
|
129
|
-
approvers: number[];
|
|
130
|
-
allow_bg_tip: boolean;
|
|
131
134
|
/** user email or better giving (if creator is bg-admin) */
|
|
132
135
|
creator: string;
|
|
136
|
+
settings: FundSettings;
|
|
133
137
|
}
|