@better-giving/endowment 4.0.29 → 4.0.30
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 +1 -1
- package/dist/schema.d.mts +30 -28
- package/dist/schema.mjs +3 -17
- package/package.json +3 -3
- package/src/index.mts +0 -1
- package/src/schema.mts +11 -38
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type * from "./interfaces.mjs";
|
|
2
2
|
export { NpoDb } from "./db.mjs";
|
|
3
|
-
export type { IAllocation,
|
|
3
|
+
export type { IAllocation, IMediaSearch, IMediaSearchObj, IMediaUpdate, IMilestone, IMilestoneNew, IMilestoneUpdate, INpo, INpoFields, INpoItem, INpoUpdate, IProgram, IProgramDb, IProgramNew, IProgramUpdate, ISocialMediaURLs, TMediaType, INposSearch, INposSearchObj, } from "./schema.mjs";
|
package/dist/schema.d.mts
CHANGED
|
@@ -28,17 +28,7 @@ export declare const social_media_urls: v.ObjectSchema<{
|
|
|
28
28
|
export interface ISocialMediaURLs extends v.InferOutput<typeof social_media_urls> {
|
|
29
29
|
}
|
|
30
30
|
export declare const MAX_RECEIPT_MSG_CHAR = 500;
|
|
31
|
-
export declare const increment_val: v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, v.TransformAction<string, number>, v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, "must be > 0">]>, v.TransformAction<number, string>]>, v.TransformAction<string, string>]>;
|
|
32
|
-
export declare const MAX_NUM_INCREMENTS = 4;
|
|
33
|
-
export declare const increment_label_max_chars = 60;
|
|
34
31
|
export declare const tagline_max_chars = 140;
|
|
35
|
-
export declare const increment_label: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
|
|
36
|
-
export declare const increment: v.ObjectSchema<{
|
|
37
|
-
readonly value: v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, v.TransformAction<string, number>, v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, "must be > 0">]>, v.TransformAction<number, string>]>, v.TransformAction<string, string>]>;
|
|
38
|
-
readonly label: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
|
|
39
|
-
}, undefined>;
|
|
40
|
-
export interface IIncrement extends v.InferOutput<typeof increment> {
|
|
41
|
-
}
|
|
42
32
|
export declare const npo: v.ObjectSchema<{
|
|
43
33
|
readonly id: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
44
34
|
readonly env: v.PicklistSchema<readonly ["staging", "production"], undefined>;
|
|
@@ -82,12 +72,15 @@ export declare const npo: v.ObjectSchema<{
|
|
|
82
72
|
}, "must total to 100">]>, never>;
|
|
83
73
|
readonly donateMethods: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["stripe", "crypto", "daf", "stocks"], "required">, undefined>, never>;
|
|
84
74
|
readonly increments: v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
|
|
85
|
-
readonly value:
|
|
86
|
-
readonly label:
|
|
75
|
+
readonly value: import("valibot").SchemaWithPipe<[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>]>, import("valibot").TransformAction<string, string>]>;
|
|
76
|
+
readonly label: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]>, import("valibot").MaxLengthAction<string, 60, ({ requirement: r }: import("valibot").MaxLengthIssue<string, 60>) => string>]>;
|
|
87
77
|
}, undefined>, undefined>, v.MaxLengthAction<{
|
|
88
78
|
value: string;
|
|
89
79
|
label: string;
|
|
90
|
-
}[], 4,
|
|
80
|
+
}[], 4, ({ requirement }: v.MaxLengthIssue<{
|
|
81
|
+
value: string;
|
|
82
|
+
label: string;
|
|
83
|
+
}[], 4>) => string>]>, never>;
|
|
91
84
|
readonly fund_opt_in: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
92
85
|
readonly target: v.OptionalSchema<v.UnionSchema<[v.LiteralSchema<"smart", undefined>, v.SchemaWithPipe<[v.StringSchema<undefined>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, string>]>], undefined>, never>;
|
|
93
86
|
/** endowment is not claimed if `false` only */
|
|
@@ -143,12 +136,15 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
|
|
|
143
136
|
}, "must total to 100">]>, never>;
|
|
144
137
|
readonly donateMethods: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["stripe", "crypto", "daf", "stocks"], "required">, undefined>, never>;
|
|
145
138
|
readonly increments: v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
|
|
146
|
-
readonly value:
|
|
147
|
-
readonly label:
|
|
139
|
+
readonly value: import("valibot").SchemaWithPipe<[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>]>, import("valibot").TransformAction<string, string>]>;
|
|
140
|
+
readonly label: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]>, import("valibot").MaxLengthAction<string, 60, ({ requirement: r }: import("valibot").MaxLengthIssue<string, 60>) => string>]>;
|
|
148
141
|
}, undefined>, undefined>, v.MaxLengthAction<{
|
|
149
142
|
value: string;
|
|
150
143
|
label: string;
|
|
151
|
-
}[], 4,
|
|
144
|
+
}[], 4, ({ requirement }: v.MaxLengthIssue<{
|
|
145
|
+
value: string;
|
|
146
|
+
label: string;
|
|
147
|
+
}[], 4>) => string>]>, never>;
|
|
152
148
|
readonly fund_opt_in: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
153
149
|
readonly target: v.OptionalSchema<v.UnionSchema<[v.LiteralSchema<"smart", undefined>, v.SchemaWithPipe<[v.StringSchema<undefined>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, string>]>], undefined>, never>;
|
|
154
150
|
/** endowment is not claimed if `false` only */
|
|
@@ -204,12 +200,15 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
|
|
|
204
200
|
}, "must total to 100">]>, never>;
|
|
205
201
|
readonly donateMethods: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["stripe", "crypto", "daf", "stocks"], "required">, undefined>, never>;
|
|
206
202
|
readonly increments: v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
|
|
207
|
-
readonly value:
|
|
208
|
-
readonly label:
|
|
203
|
+
readonly value: import("valibot").SchemaWithPipe<[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>]>, import("valibot").TransformAction<string, string>]>;
|
|
204
|
+
readonly label: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]>, import("valibot").MaxLengthAction<string, 60, ({ requirement: r }: import("valibot").MaxLengthIssue<string, 60>) => string>]>;
|
|
209
205
|
}, undefined>, undefined>, v.MaxLengthAction<{
|
|
210
206
|
value: string;
|
|
211
207
|
label: string;
|
|
212
|
-
}[], 4,
|
|
208
|
+
}[], 4, ({ requirement }: v.MaxLengthIssue<{
|
|
209
|
+
value: string;
|
|
210
|
+
label: string;
|
|
211
|
+
}[], 4>) => string>]>, never>;
|
|
213
212
|
readonly fund_opt_in: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
214
213
|
readonly target: v.OptionalSchema<v.UnionSchema<[v.LiteralSchema<"smart", undefined>, v.SchemaWithPipe<[v.StringSchema<undefined>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, string>]>], undefined>, never>;
|
|
215
214
|
/** endowment is not claimed if `false` only */
|
|
@@ -226,7 +225,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
|
|
|
226
225
|
cash: number;
|
|
227
226
|
liq: number;
|
|
228
227
|
lock: number;
|
|
229
|
-
}> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.
|
|
228
|
+
}> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.PicklistIssue | v.CustomIssue | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.MaxLengthIssue<string, 140> | v.ArrayIssue | v.NonEmptyIssue<string[]> | v.MinLengthIssue<(2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | v.MaxLengthIssue<string, 500> | v.BooleanIssue | v.MaxLengthIssue<string, 60> | v.MaxLengthIssue<{
|
|
230
229
|
value: string;
|
|
231
230
|
label: string;
|
|
232
231
|
}[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>>): v.Dataset<{
|
|
@@ -278,7 +277,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
|
|
|
278
277
|
cash: number;
|
|
279
278
|
liq: number;
|
|
280
279
|
lock: number;
|
|
281
|
-
}> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.
|
|
280
|
+
}> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.PicklistIssue | v.CustomIssue | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.MaxLengthIssue<string, 140> | v.ArrayIssue | v.NonEmptyIssue<string[]> | v.MinLengthIssue<(2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | v.MaxLengthIssue<string, 500> | v.BooleanIssue | v.MaxLengthIssue<string, 60> | v.MaxLengthIssue<{
|
|
282
281
|
value: string;
|
|
283
282
|
label: string;
|
|
284
283
|
}[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>>;
|
|
@@ -379,7 +378,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
|
|
|
379
378
|
cash: number;
|
|
380
379
|
liq: number;
|
|
381
380
|
lock: number;
|
|
382
|
-
}> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.
|
|
381
|
+
}> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.PicklistIssue | v.CustomIssue | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.MaxLengthIssue<string, 140> | v.ArrayIssue | v.NonEmptyIssue<string[]> | v.MinLengthIssue<(2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | v.MaxLengthIssue<string, 500> | v.BooleanIssue | v.MaxLengthIssue<string, 60> | v.MaxLengthIssue<{
|
|
383
382
|
value: string;
|
|
384
383
|
label: string;
|
|
385
384
|
}[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>;
|
|
@@ -411,12 +410,15 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
|
|
|
411
410
|
}, "must total to 100">]>, never>, never>;
|
|
412
411
|
readonly donateMethods: v.OptionalSchema<v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["stripe", "crypto", "daf", "stocks"], "required">, undefined>, never>, never>;
|
|
413
412
|
readonly increments: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
|
|
414
|
-
readonly value:
|
|
415
|
-
readonly label:
|
|
413
|
+
readonly value: import("valibot").SchemaWithPipe<[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>]>, import("valibot").TransformAction<string, string>]>;
|
|
414
|
+
readonly label: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]>, import("valibot").MaxLengthAction<string, 60, ({ requirement: r }: import("valibot").MaxLengthIssue<string, 60>) => string>]>;
|
|
416
415
|
}, undefined>, undefined>, v.MaxLengthAction<{
|
|
417
416
|
value: string;
|
|
418
417
|
label: string;
|
|
419
|
-
}[], 4,
|
|
418
|
+
}[], 4, ({ requirement }: v.MaxLengthIssue<{
|
|
419
|
+
value: string;
|
|
420
|
+
label: string;
|
|
421
|
+
}[], 4>) => string>]>, never>, never>;
|
|
420
422
|
readonly fund_opt_in: v.OptionalSchema<v.OptionalSchema<v.BooleanSchema<undefined>, never>, never>;
|
|
421
423
|
readonly target: v.OptionalSchema<v.OptionalSchema<v.UnionSchema<[v.LiteralSchema<"smart", undefined>, v.SchemaWithPipe<[v.StringSchema<undefined>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, string>]>], undefined>, never>, never>;
|
|
422
424
|
readonly referral_id: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, never>, never>;
|
|
@@ -442,7 +444,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
|
|
|
442
444
|
cash: number;
|
|
443
445
|
liq: number;
|
|
444
446
|
lock: number;
|
|
445
|
-
}> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.
|
|
447
|
+
}> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.PicklistIssue | v.CustomIssue | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.MaxLengthIssue<string, 140> | v.ArrayIssue | v.NonEmptyIssue<string[]> | v.MinLengthIssue<(2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | v.MaxLengthIssue<string, 500> | v.BooleanIssue | v.MaxLengthIssue<string, 60> | v.MaxLengthIssue<{
|
|
446
448
|
value: string;
|
|
447
449
|
label: string;
|
|
448
450
|
}[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>>): v.Dataset<{
|
|
@@ -494,7 +496,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
|
|
|
494
496
|
cash: number;
|
|
495
497
|
liq: number;
|
|
496
498
|
lock: number;
|
|
497
|
-
}> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.
|
|
499
|
+
}> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.PicklistIssue | v.CustomIssue | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.MaxLengthIssue<string, 140> | v.ArrayIssue | v.NonEmptyIssue<string[]> | v.MinLengthIssue<(2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | v.MaxLengthIssue<string, 500> | v.BooleanIssue | v.MaxLengthIssue<string, 60> | v.MaxLengthIssue<{
|
|
498
500
|
value: string;
|
|
499
501
|
label: string;
|
|
500
502
|
}[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>>;
|
|
@@ -595,7 +597,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
|
|
|
595
597
|
cash: number;
|
|
596
598
|
liq: number;
|
|
597
599
|
lock: number;
|
|
598
|
-
}> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.
|
|
600
|
+
}> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.PicklistIssue | v.CustomIssue | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.MaxLengthIssue<string, 140> | v.ArrayIssue | v.NonEmptyIssue<string[]> | v.MinLengthIssue<(2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | v.MaxLengthIssue<string, 500> | v.BooleanIssue | v.MaxLengthIssue<string, 60> | v.MaxLengthIssue<{
|
|
599
601
|
value: string;
|
|
600
602
|
label: string;
|
|
601
603
|
}[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>;
|
package/dist/schema.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $, $int_gte1, $req,
|
|
1
|
+
import { $, $int_gte1, $req, donate_method_id, env, https_url, increment, int_gte1, MAX_NUM_INCREMENTS, target, org_designation, slug, unsdg_num, } from "@better-giving/schemas";
|
|
2
2
|
export { $, $req, $req_num_gt0, donate_method_id, env, https_url, int_gte1, $int_gte1, org_designation, slug, unsdg_num, } from "@better-giving/schemas";
|
|
3
3
|
import * as v from "valibot";
|
|
4
4
|
export const min_payout_amount = 50;
|
|
@@ -26,17 +26,7 @@ export const social_media_urls = v.object({
|
|
|
26
26
|
tiktok: v.optional(https_url({})),
|
|
27
27
|
});
|
|
28
28
|
export const MAX_RECEIPT_MSG_CHAR = 500;
|
|
29
|
-
export const increment_val = v.pipe($req_num_gt0,
|
|
30
|
-
//parsed output
|
|
31
|
-
v.transform((x) => x.toString()));
|
|
32
|
-
export const MAX_NUM_INCREMENTS = 4;
|
|
33
|
-
export const increment_label_max_chars = 60;
|
|
34
29
|
export const tagline_max_chars = 140;
|
|
35
|
-
export const increment_label = v.pipe($, v.maxLength(increment_label_max_chars, ({ requirement: r }) => `cannot exceed ${r} characters`));
|
|
36
|
-
export const increment = v.object({
|
|
37
|
-
value: increment_val,
|
|
38
|
-
label: increment_label,
|
|
39
|
-
});
|
|
40
30
|
export const npo = v.object({
|
|
41
31
|
id: int_gte1,
|
|
42
32
|
env,
|
|
@@ -64,13 +54,9 @@ export const npo = v.object({
|
|
|
64
54
|
progDonationsAllowed: v.optional(v.boolean()),
|
|
65
55
|
allocation: v.optional(allocation),
|
|
66
56
|
donateMethods: v.optional(v.array(donate_method_id)),
|
|
67
|
-
increments: v.optional(v.pipe(v.array(increment), v.maxLength(MAX_NUM_INCREMENTS))),
|
|
57
|
+
increments: v.optional(v.pipe(v.array(increment), v.maxLength(MAX_NUM_INCREMENTS, ({ requirement }) => `cannot have more than ${requirement} increments`))),
|
|
68
58
|
fund_opt_in: v.optional(v.boolean()),
|
|
69
|
-
target: v.optional(
|
|
70
|
-
v.literal("smart"),
|
|
71
|
-
// "0" - none, `${number}` - fixed
|
|
72
|
-
v.pipe(v.string(), v.transform((v) => +v), v.number(), v.minValue(0), v.transform((v) => v.toString())),
|
|
73
|
-
])),
|
|
59
|
+
target: v.optional(target),
|
|
74
60
|
/** endowment is not claimed if `false` only */
|
|
75
61
|
claimed: v.boolean(),
|
|
76
62
|
kyc_donors_only: v.boolean(),
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-giving/endowment",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.30",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"ksuid": "3.0.0"
|
|
6
6
|
},
|
|
7
7
|
"peerDependencies": {
|
|
8
|
-
"@better-giving/schemas": "2.0.3",
|
|
9
8
|
"@better-giving/types": "1.1.8",
|
|
10
9
|
"@better-giving/db": "2.0.6",
|
|
11
10
|
"@aws-sdk/lib-dynamodb": "3.485.0",
|
|
12
|
-
"valibot": "0.42.0"
|
|
11
|
+
"valibot": "0.42.0",
|
|
12
|
+
"@better-giving/schemas": "2.0.4"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@better-giving/config": "1.1.2"
|
package/src/index.mts
CHANGED
package/src/schema.mts
CHANGED
|
@@ -2,11 +2,13 @@ import {
|
|
|
2
2
|
$,
|
|
3
3
|
$int_gte1,
|
|
4
4
|
$req,
|
|
5
|
-
$req_num_gt0,
|
|
6
5
|
donate_method_id,
|
|
7
6
|
env,
|
|
8
7
|
https_url,
|
|
8
|
+
increment,
|
|
9
9
|
int_gte1,
|
|
10
|
+
MAX_NUM_INCREMENTS,
|
|
11
|
+
target,
|
|
10
12
|
org_designation,
|
|
11
13
|
slug,
|
|
12
14
|
unsdg_num,
|
|
@@ -72,31 +74,8 @@ export interface ISocialMediaURLs
|
|
|
72
74
|
|
|
73
75
|
export const MAX_RECEIPT_MSG_CHAR = 500;
|
|
74
76
|
|
|
75
|
-
export const increment_val = v.pipe(
|
|
76
|
-
$req_num_gt0,
|
|
77
|
-
//parsed output
|
|
78
|
-
v.transform((x) => x.toString())
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
export const MAX_NUM_INCREMENTS = 4;
|
|
82
|
-
export const increment_label_max_chars = 60;
|
|
83
77
|
export const tagline_max_chars = 140;
|
|
84
78
|
|
|
85
|
-
export const increment_label = v.pipe(
|
|
86
|
-
$,
|
|
87
|
-
v.maxLength(
|
|
88
|
-
increment_label_max_chars,
|
|
89
|
-
({ requirement: r }) => `cannot exceed ${r} characters`
|
|
90
|
-
)
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
export const increment = v.object({
|
|
94
|
-
value: increment_val,
|
|
95
|
-
label: increment_label,
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
export interface IIncrement extends v.InferOutput<typeof increment> {}
|
|
99
|
-
|
|
100
79
|
export const npo = v.object({
|
|
101
80
|
id: int_gte1,
|
|
102
81
|
env,
|
|
@@ -126,22 +105,16 @@ export const npo = v.object({
|
|
|
126
105
|
allocation: v.optional(allocation),
|
|
127
106
|
donateMethods: v.optional(v.array(donate_method_id)),
|
|
128
107
|
increments: v.optional(
|
|
129
|
-
v.pipe(
|
|
108
|
+
v.pipe(
|
|
109
|
+
v.array(increment),
|
|
110
|
+
v.maxLength(
|
|
111
|
+
MAX_NUM_INCREMENTS,
|
|
112
|
+
({ requirement }) => `cannot have more than ${requirement} increments`
|
|
113
|
+
)
|
|
114
|
+
)
|
|
130
115
|
),
|
|
131
116
|
fund_opt_in: v.optional(v.boolean()),
|
|
132
|
-
target: v.optional(
|
|
133
|
-
v.union([
|
|
134
|
-
v.literal("smart"),
|
|
135
|
-
// "0" - none, `${number}` - fixed
|
|
136
|
-
v.pipe(
|
|
137
|
-
v.string(),
|
|
138
|
-
v.transform((v) => +v),
|
|
139
|
-
v.number(),
|
|
140
|
-
v.minValue(0),
|
|
141
|
-
v.transform((v) => v.toString())
|
|
142
|
-
),
|
|
143
|
-
])
|
|
144
|
-
),
|
|
117
|
+
target: v.optional(target),
|
|
145
118
|
/** endowment is not claimed if `false` only */
|
|
146
119
|
claimed: v.boolean(),
|
|
147
120
|
kyc_donors_only: v.boolean(),
|