@better-giving/endowment 2.0.1 → 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.
@@ -8,10 +8,8 @@ export declare const cloudsearchEndowFields: import("valibot").ObjectSchema<{
8
8
  export declare const cloudsearchEndow: import("valibot").ObjectSchema<{
9
9
  readonly contributions_total: import("valibot").NumberSchema<undefined>;
10
10
  readonly contributions_count: import("valibot").NumberSchema<undefined>;
11
- readonly name: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">]>;
12
11
  readonly tagline: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").MaxLengthAction<string, 140, undefined>]>, never>;
13
12
  readonly card_img: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").UrlAction<string, undefined>]>, never>;
14
- readonly hq_country: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">]>;
15
13
  readonly active_in_countries: import("valibot").SchemaWithPipe<[import("valibot").ArraySchema<import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, undefined>, import("valibot").NonEmptyAction<string[], "required">]>;
16
14
  readonly sdgs: import("valibot").SchemaWithPipe<[import("valibot").ArraySchema<import("valibot").PicklistSchema<readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], undefined>, undefined>, import("valibot").MinLengthAction<(2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1, undefined>]>;
17
15
  readonly published: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, never>;
@@ -20,21 +18,23 @@ export declare const cloudsearchEndow: import("valibot").ObjectSchema<{
20
18
  readonly id: import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>]>;
21
19
  readonly env: import("valibot").PicklistSchema<readonly ["staging", "production"], undefined>;
22
20
  readonly registration_number: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">, import("valibot").RegexAction<string, "must only contain letters and numbers">]>;
21
+ readonly name: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">]>;
23
22
  readonly endow_designation: import("valibot").PicklistSchema<readonly ["Charity", "Religious Organization", "University", "Hospital", "Other"], undefined>;
23
+ readonly hq_country: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">]>;
24
24
  readonly claimed: import("valibot").BooleanSchema<undefined>;
25
25
  readonly kyc_donors_only: import("valibot").BooleanSchema<undefined>;
26
26
  }, undefined>;
27
- export declare const cloudSearchEndowFields: import("valibot").PicklistSchema<["name", "tagline", "card_img", "hq_country", "active_in_countries", "sdgs", "published", "fund_opt_in", "target", "id", "env", "registration_number", "endow_designation", "claimed", "kyc_donors_only", "contributions_total", "contributions_count"], undefined>;
27
+ export declare const cloudSearchEndowFields: import("valibot").PicklistSchema<["tagline", "card_img", "active_in_countries", "sdgs", "published", "fund_opt_in", "target", "id", "env", "registration_number", "name", "endow_designation", "hq_country", "claimed", "kyc_donors_only", "contributions_total", "contributions_count"], undefined>;
28
28
  export declare const endowsQueryParams: import("valibot").ObjectSchema<{
29
29
  readonly query: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, never>;
30
- readonly page: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TransformAction<string, number>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>]>, never>;
30
+ 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").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>]>]>, never>;
31
31
  readonly endow_designation: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").LazySchema<import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]> | import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").RegexAction<string, "invalid csv">]>>, import("valibot").TransformAction<string, string[]>, import("valibot").FilterItemsAction<string[]>]>, import("valibot").ArraySchema<import("valibot").PicklistSchema<readonly ["Charity", "Religious Organization", "University", "Hospital", "Other"], undefined>, undefined>]>, never>;
32
32
  readonly sdgs: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").LazySchema<import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]> | import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").RegexAction<string, "invalid csv">]>>, import("valibot").TransformAction<string, string[]>, import("valibot").FilterItemsAction<string[]>]>, import("valibot").MapItemsAction<string[], number>, import("valibot").ArraySchema<import("valibot").PicklistSchema<readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], undefined>, undefined>]>, never>;
33
33
  readonly kyc_only: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").LazySchema<import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]> | import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").RegexAction<string, "invalid csv">]>>, import("valibot").TransformAction<string, string[]>, import("valibot").FilterItemsAction<string[]>]>, import("valibot").MapItemsAction<string[], boolean>, import("valibot").ArraySchema<import("valibot").BooleanSchema<undefined>, undefined>]>, never>;
34
34
  readonly fund_opt_in: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").LazySchema<import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]> | import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").RegexAction<string, "invalid csv">]>>, import("valibot").TransformAction<string, string[]>, import("valibot").FilterItemsAction<string[]>]>, import("valibot").MapItemsAction<string[], boolean>, import("valibot").ArraySchema<import("valibot").BooleanSchema<undefined>, undefined>]>, never>;
35
35
  readonly claimed: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").LazySchema<import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]> | import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").RegexAction<string, "invalid csv">]>>, import("valibot").TransformAction<string, string[]>, import("valibot").FilterItemsAction<string[]>]>, import("valibot").MapItemsAction<string[], boolean>, import("valibot").ArraySchema<import("valibot").BooleanSchema<undefined>, undefined>]>, never>;
36
36
  readonly countries: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").LazySchema<import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]> | import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").RegexAction<string, "invalid csv">]>>, import("valibot").TransformAction<string, string[]>, import("valibot").FilterItemsAction<string[]>]>, import("valibot").ArraySchema<import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, undefined>]>, never>;
37
- readonly fields: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").LazySchema<import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]> | import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").RegexAction<string, "invalid csv">]>>, import("valibot").TransformAction<string, string[]>, import("valibot").FilterItemsAction<string[]>]>, import("valibot").ArraySchema<import("valibot").PicklistSchema<["name", "tagline", "card_img", "hq_country", "active_in_countries", "sdgs", "published", "fund_opt_in", "target", "id", "env", "registration_number", "endow_designation", "claimed", "kyc_donors_only", "contributions_total", "contributions_count"], undefined>, undefined>]>, never>;
37
+ readonly fields: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").LazySchema<import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]> | import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>, import("valibot").RegexAction<string, "invalid csv">]>>, import("valibot").TransformAction<string, string[]>, import("valibot").FilterItemsAction<string[]>]>, import("valibot").ArraySchema<import("valibot").PicklistSchema<["tagline", "card_img", "active_in_countries", "sdgs", "published", "fund_opt_in", "target", "id", "env", "registration_number", "name", "endow_designation", "hq_country", "claimed", "kyc_donors_only", "contributions_total", "contributions_count"], undefined>, undefined>]>, never>;
38
38
  }, undefined>;
39
39
  export interface CloudsearchEndowsQueryParamsObj extends InferInput<typeof endowsQueryParams> {
40
40
  }
@@ -1,6 +1,6 @@
1
- import { orgDesignation, unSdgNum } from "@better-giving/schemas";
1
+ import { $int_gte1, org_designation, unsdg_num } from "@better-giving/schemas";
2
2
  import { array, boolean, integer, keyof, mapItems, minValue, number, object, optional, pick, pipe, string, transform, } from "valibot";
3
- import { csvStrs, endowment, str } from "./schema.mjs";
3
+ import { csvStrs, endowment, $ } from "./schema.mjs";
4
4
  const boolCsv = pipe(csvStrs, mapItems((x) => x === "true"), array(boolean()));
5
5
  export const cloudsearchEndowFields = object({
6
6
  contributions_total: number(),
@@ -29,13 +29,13 @@ export const cloudsearchEndow = object({
29
29
  });
30
30
  export const cloudSearchEndowFields = keyof(cloudsearchEndow);
31
31
  export const endowsQueryParams = object({
32
- query: optional(str),
33
- page: optional(pipe(string(), transform((x) => +x), integer(), minValue(1))),
34
- endow_designation: optional(pipe(csvStrs, array(orgDesignation))),
35
- sdgs: optional(pipe(csvStrs, mapItems((x) => +x), array(unSdgNum))),
32
+ query: optional($),
33
+ page: optional($int_gte1),
34
+ endow_designation: optional(pipe(csvStrs, array(org_designation))),
35
+ sdgs: optional(pipe(csvStrs, mapItems((x) => +x), array(unsdg_num))),
36
36
  kyc_only: optional(boolCsv),
37
37
  fund_opt_in: optional(boolCsv),
38
38
  claimed: optional(boolCsv),
39
- countries: optional(pipe(csvStrs, array(str))),
39
+ countries: optional(pipe(csvStrs, array($))),
40
40
  fields: optional(pipe(csvStrs, array(cloudSearchEndowFields))),
41
41
  });
package/dist/db.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Ensure } from "@better-giving/types/utils";
2
- import type { EndowId, Endowment as EndowmentShape, Environment, MediaId, MediaType, Milestone as MilestoneShape, MilestoneId, Program as ProgramShape, ProgramId } from "./schema.mjs";
3
- export type { EndowId, SocialMediaURLs, Allocation, Increment, EndowDesignation, Environment, ProgramId, } from "./schema.mjs";
2
+ import type { Endowment as EndowmentShape, Environment, MediaId, MediaType, Milestone as MilestoneShape, MilestoneId, Program as ProgramShape, ProgramId } from "./schema.mjs";
3
+ export type { SocialMediaURLs, Allocation, Increment, EndowDesignation, Environment, ProgramId, } from "./schema.mjs";
4
4
  export declare const endowGsi: {
5
5
  readonly regnumEnv: "regnum-env-gsi";
6
6
  readonly slugEnv: "slug-env-gsi";
@@ -16,7 +16,7 @@ export declare namespace EndowCount {
16
16
  }
17
17
  export declare namespace Endow {
18
18
  type Keys = {
19
- PK: `Endow#${EndowId}`;
19
+ PK: `Endow#${number}`;
20
20
  SK: Environment;
21
21
  };
22
22
  type NonKeyAttributes = EndowmentShape & {
@@ -75,7 +75,7 @@ export declare namespace Milestone {
75
75
  }
76
76
  export declare namespace Media {
77
77
  interface Keys {
78
- PK: `Endow#${EndowId}#${Environment}`;
78
+ PK: `Endow#${number}#${Environment}`;
79
79
  SK: `Media#${MediaId}`;
80
80
  }
81
81
  /** "0" - featured (goes before 1), "1" - not-featured */
package/dist/schema.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { donateMethodId, donateMethodIds, env, orgDesignation, unSdgNum } from "@better-giving/schemas";
1
+ import { donate_method_id, donate_method_ids, env, org_designation, unsdg_num, $int_gte1, int_gte1, $, $req_num_gt0, $req } from "@better-giving/schemas";
2
2
  export { type OrgDesignation as EndowDesignation, type Environment, type UnSdgNum, type DonateMethodId, https_url, } from "@better-giving/schemas";
3
- export { orgDesignation as endowDesignation, env, unSdgNum, donateMethodId, donateMethodIds, };
3
+ export { org_designation as endow_designation, env, unsdg_num, donate_method_id, donate_method_ids, $int_gte1, int_gte1, $, $req_num_gt0, $req, };
4
4
  import * as v from "valibot";
5
- export declare const str: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
5
+ export declare const min_payout_amount = 50;
6
6
  export declare const csv: v.LazySchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]> | v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.RegexAction<string, "invalid csv">]>>;
7
7
  export declare const csvStrs: v.SchemaWithPipe<[v.LazySchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]> | v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.RegexAction<string, "invalid csv">]>>, v.TransformAction<string, string[]>, v.FilterItemsAction<string[]>]>;
8
8
  export declare const allocation: v.SchemaWithPipe<[v.ObjectSchema<{
@@ -16,9 +16,6 @@ export declare const allocation: v.SchemaWithPipe<[v.ObjectSchema<{
16
16
  }, "must total to 100">]>;
17
17
  export interface Allocation extends v.InferOutput<typeof allocation> {
18
18
  }
19
- export declare const int_id: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
20
- export type EndowId = v.InferOutput<typeof int_id>;
21
- export declare const endowIdParam: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TransformAction<string, number>, v.SchemaWithPipe<[v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>]>;
22
19
  export declare const segmentMaxChars = 30;
23
20
  export declare const segment: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 30, ({ requirement: r }: v.MaxLengthIssue<string, 30>) => string>, v.RegexAction<string, "should not be an id">, v.RegexAction<string, "allowed: numbers | letters | - | . | _ | ~">, v.ExcludesAction<string, "..", "should not contain double periods">, v.CustomSchema<string, "should not start with dot">, v.CustomSchema<string, "should not end with dot">]>;
24
21
  export declare const slug: v.LazySchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]> | v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 30, ({ requirement: r }: v.MaxLengthIssue<string, 30>) => string>, v.RegexAction<string, "should not be an id">, v.RegexAction<string, "allowed: numbers | letters | - | . | _ | ~">, v.ExcludesAction<string, "..", "should not contain double periods">, v.CustomSchema<string, "should not start with dot">, v.CustomSchema<string, "should not end with dot">]>>;
@@ -36,13 +33,13 @@ export declare const social_media_urls: v.ObjectSchema<{
36
33
  export interface SocialMediaURLs extends v.InferOutput<typeof social_media_urls> {
37
34
  }
38
35
  export declare const MAX_RECEIPT_MSG_CHAR = 500;
39
- export declare const incrementVal: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">, v.TransformAction<string, number>, v.NumberSchema<"must be a number">, v.MinValueAction<number, 0, "must be greater than 0">, v.TransformAction<number, string>]>;
36
+ export declare const incrementVal: v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, v.TransformAction<string, number>, v.NumberSchema<"invalid number">, v.MinValueAction<number, 0, "must be > 0">, v.TransformAction<number, string>]>, v.TransformAction<string, string>]>;
40
37
  export declare const MAX_NUM_INCREMENTS = 4;
41
38
  export declare const incrementLabelMaxChars = 60;
42
39
  export declare const taglineMaxChars = 140;
43
40
  export declare const incrementLabel: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
44
41
  export declare const increment: v.ObjectSchema<{
45
- readonly value: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">, v.TransformAction<string, number>, v.NumberSchema<"must be a number">, v.MinValueAction<number, 0, "must be greater than 0">, v.TransformAction<number, string>]>;
42
+ readonly value: v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, v.TransformAction<string, number>, v.NumberSchema<"invalid number">, v.MinValueAction<number, 0, "must be > 0">, v.TransformAction<number, string>]>, v.TransformAction<string, string>]>;
46
43
  readonly label: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
47
44
  }, undefined>;
48
45
  export interface Increment extends v.InferOutput<typeof increment> {
@@ -90,7 +87,7 @@ export declare const endowment: v.ObjectSchema<{
90
87
  }, "must total to 100">]>, never>;
91
88
  readonly donateMethods: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["stripe", "crypto", "daf", "stocks"], undefined>, undefined>, never>;
92
89
  readonly increments: v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
93
- readonly value: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">, v.TransformAction<string, number>, v.NumberSchema<"must be a number">, v.MinValueAction<number, 0, "must be greater than 0">, v.TransformAction<number, string>]>;
90
+ readonly value: v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, v.TransformAction<string, number>, v.NumberSchema<"invalid number">, v.MinValueAction<number, 0, "must be > 0">, v.TransformAction<number, string>]>, v.TransformAction<string, string>]>;
94
91
  readonly label: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
95
92
  }, undefined>, undefined>, v.MaxLengthAction<{
96
93
  value: string;
@@ -106,6 +103,7 @@ export declare const endowment: v.ObjectSchema<{
106
103
  readonly referrer: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, never>;
107
104
  readonly referrer_expiry: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.IsoTimestampAction<string, undefined>]>, never>;
108
105
  readonly w_form: v.OptionalSchema<v.StringSchema<undefined>, never>;
106
+ readonly payout_minimum: v.OptionalSchema<v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 50, undefined>]>, never>;
109
107
  }, undefined>;
110
108
  export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
111
109
  readonly id: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
@@ -150,7 +148,7 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
150
148
  }, "must total to 100">]>, never>;
151
149
  readonly donateMethods: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["stripe", "crypto", "daf", "stocks"], undefined>, undefined>, never>;
152
150
  readonly increments: v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
153
- readonly value: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">, v.TransformAction<string, number>, v.NumberSchema<"must be a number">, v.MinValueAction<number, 0, "must be greater than 0">, v.TransformAction<number, string>]>;
151
+ readonly value: v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, v.TransformAction<string, number>, v.NumberSchema<"invalid number">, v.MinValueAction<number, 0, "must be > 0">, v.TransformAction<number, string>]>, v.TransformAction<string, string>]>;
154
152
  readonly label: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
155
153
  }, undefined>, undefined>, v.MaxLengthAction<{
156
154
  value: string;
@@ -166,7 +164,8 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
166
164
  readonly referrer: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, never>;
167
165
  readonly referrer_expiry: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.IsoTimestampAction<string, undefined>]>, never>;
168
166
  readonly w_form: v.OptionalSchema<v.StringSchema<undefined>, never>;
169
- }, undefined>, "_types" | "_run" | "entries"> & {
167
+ readonly payout_minimum: v.OptionalSchema<v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 50, undefined>]>, never>;
168
+ }, undefined>, "_run" | "_types" | "entries"> & {
170
169
  readonly entries: Omit<{
171
170
  readonly id: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
172
171
  readonly env: v.PicklistSchema<readonly ["staging", "production"], undefined>;
@@ -210,7 +209,7 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
210
209
  }, "must total to 100">]>, never>;
211
210
  readonly donateMethods: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["stripe", "crypto", "daf", "stocks"], undefined>, undefined>, never>;
212
211
  readonly increments: v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
213
- readonly value: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">, v.TransformAction<string, number>, v.NumberSchema<"must be a number">, v.MinValueAction<number, 0, "must be greater than 0">, v.TransformAction<number, string>]>;
212
+ readonly value: v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, v.TransformAction<string, number>, v.NumberSchema<"invalid number">, v.MinValueAction<number, 0, "must be > 0">, v.TransformAction<number, string>]>, v.TransformAction<string, string>]>;
214
213
  readonly label: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
215
214
  }, undefined>, undefined>, v.MaxLengthAction<{
216
215
  value: string;
@@ -226,6 +225,7 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
226
225
  readonly referrer: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, never>;
227
226
  readonly referrer_expiry: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.IsoTimestampAction<string, undefined>]>, never>;
228
227
  readonly w_form: v.OptionalSchema<v.StringSchema<undefined>, never>;
228
+ readonly payout_minimum: v.OptionalSchema<v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 50, undefined>]>, never>;
229
229
  }, "id" | "env" | "claimed" | "kyc_donors_only" | "fiscal_sponsored">;
230
230
  _run(dataset: v.Dataset<unknown, never>, config: v.Config<v.StringIssue | v.RegexIssue<string> | v.NumberIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 0> | v.MaxValueIssue<number, 100> | v.ObjectIssue | v.CheckIssue<{
231
231
  cash: number;
@@ -234,13 +234,13 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
234
234
  }> | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.CustomIssue | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.MaxLengthIssue<string, 60> | v.PicklistIssue | 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<{
235
235
  value: string;
236
236
  label: string;
237
- }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string>>): v.Dataset<{
238
- name: string;
239
- hq_country: string;
237
+ }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>>): v.Dataset<{
240
238
  active_in_countries: string[];
241
239
  sdgs: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[];
242
240
  registration_number: string;
241
+ name: string;
243
242
  endow_designation: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other";
243
+ hq_country: string;
244
244
  social_media_urls: {
245
245
  facebook?: string | undefined;
246
246
  twitter?: string | undefined;
@@ -278,6 +278,7 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
278
278
  referrer?: string | undefined;
279
279
  referrer_expiry?: string | undefined;
280
280
  w_form?: string | undefined;
281
+ payout_minimum?: number | undefined;
281
282
  }, v.StringIssue | v.RegexIssue<string> | v.NumberIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 0> | v.MaxValueIssue<number, 100> | v.ObjectIssue | v.CheckIssue<{
282
283
  cash: number;
283
284
  liq: number;
@@ -285,15 +286,15 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
285
286
  }> | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.CustomIssue | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.MaxLengthIssue<string, 60> | v.PicklistIssue | 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<{
286
287
  value: string;
287
288
  label: string;
288
- }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string>>;
289
+ }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>>;
289
290
  readonly _types?: {
290
291
  readonly input: {
291
- name: string;
292
- hq_country: string;
293
292
  active_in_countries: string[];
294
293
  sdgs: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[];
295
294
  registration_number: string;
295
+ name: string;
296
296
  endow_designation: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other";
297
+ hq_country: string;
297
298
  social_media_urls: {
298
299
  facebook?: string | undefined;
299
300
  twitter?: string | undefined;
@@ -331,14 +332,15 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
331
332
  referrer?: string | undefined;
332
333
  referrer_expiry?: string | undefined;
333
334
  w_form?: string | undefined;
335
+ payout_minimum?: number | undefined;
334
336
  };
335
337
  readonly output: {
336
- name: string;
337
- hq_country: string;
338
338
  active_in_countries: string[];
339
339
  sdgs: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[];
340
340
  registration_number: string;
341
+ name: string;
341
342
  endow_designation: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other";
343
+ hq_country: string;
342
344
  social_media_urls: {
343
345
  facebook?: string | undefined;
344
346
  twitter?: string | undefined;
@@ -376,6 +378,7 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
376
378
  referrer?: string | undefined;
377
379
  referrer_expiry?: string | undefined;
378
380
  w_form?: string | undefined;
381
+ payout_minimum?: number | undefined;
379
382
  };
380
383
  readonly issue: v.StringIssue | v.RegexIssue<string> | v.NumberIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 0> | v.MaxValueIssue<number, 100> | v.ObjectIssue | v.CheckIssue<{
381
384
  cash: number;
@@ -384,19 +387,17 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
384
387
  }> | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.CustomIssue | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.MaxLengthIssue<string, 60> | v.PicklistIssue | 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<{
385
388
  value: string;
386
389
  label: string;
387
- }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string>;
390
+ }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>;
388
391
  } | undefined;
389
- }, "_types" | "_run" | "entries"> & {
392
+ }, "_run" | "_types" | "entries"> & {
390
393
  readonly entries: {
391
394
  readonly url: v.OptionalSchema<v.OptionalSchema<v.LazySchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]> | v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]> | v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.TransformAction<string, string>, v.UrlAction<string, "invalid url">]>>, never>, never>;
392
395
  readonly slug: v.OptionalSchema<v.OptionalSchema<v.LazySchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]> | v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 30, ({ requirement: r }: v.MaxLengthIssue<string, 30>) => string>, v.RegexAction<string, "should not be an id">, v.RegexAction<string, "allowed: numbers | letters | - | . | _ | ~">, v.ExcludesAction<string, "..", "should not contain double periods">, v.CustomSchema<string, "should not start with dot">, v.CustomSchema<string, "should not end with dot">]>>, never>, never>;
393
- readonly name: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, never>;
394
396
  readonly overview: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>, never>;
395
397
  readonly tagline: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 140, undefined>]>, never>, never>;
396
398
  readonly image: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UrlAction<string, undefined>]>, never>, never>;
397
399
  readonly logo: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UrlAction<string, undefined>]>, never>, never>;
398
400
  readonly card_img: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UrlAction<string, undefined>]>, never>, never>;
399
- readonly hq_country: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, never>;
400
401
  readonly active_in_countries: v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.NonEmptyAction<string[], "required">]>, never>;
401
402
  readonly street_address: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>, never>;
402
403
  readonly sdgs: v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.PicklistSchema<readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], undefined>, undefined>, v.MinLengthAction<(2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1, undefined>]>, never>;
@@ -415,7 +416,7 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
415
416
  }, "must total to 100">]>, never>, never>;
416
417
  readonly donateMethods: v.OptionalSchema<v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["stripe", "crypto", "daf", "stocks"], undefined>, undefined>, never>, never>;
417
418
  readonly increments: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
418
- readonly value: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">, v.TransformAction<string, number>, v.NumberSchema<"must be a number">, v.MinValueAction<number, 0, "must be greater than 0">, v.TransformAction<number, string>]>;
419
+ readonly value: v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, v.TransformAction<string, number>, v.NumberSchema<"invalid number">, v.MinValueAction<number, 0, "must be > 0">, v.TransformAction<number, string>]>, v.TransformAction<string, string>]>;
419
420
  readonly label: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
420
421
  }, undefined>, undefined>, v.MaxLengthAction<{
421
422
  value: string;
@@ -427,8 +428,11 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
427
428
  readonly referrer: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, never>, never>;
428
429
  readonly referrer_expiry: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.IsoTimestampAction<string, undefined>]>, never>, never>;
429
430
  readonly w_form: v.OptionalSchema<v.OptionalSchema<v.StringSchema<undefined>, never>, never>;
431
+ readonly payout_minimum: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 50, undefined>]>, never>, never>;
430
432
  readonly registration_number: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">, v.RegexAction<string, "must only contain letters and numbers">]>, never>;
433
+ readonly name: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, never>;
431
434
  readonly endow_designation: v.OptionalSchema<v.PicklistSchema<readonly ["Charity", "Religious Organization", "University", "Hospital", "Other"], undefined>, never>;
435
+ readonly hq_country: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, never>;
432
436
  readonly social_media_urls: v.OptionalSchema<v.ObjectSchema<{
433
437
  readonly facebook: v.OptionalSchema<v.LazySchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]> | v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]> | v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.TransformAction<string, string>, v.UrlAction<string, "invalid url">]>>, never>;
434
438
  readonly twitter: v.OptionalSchema<v.LazySchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]> | v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]> | v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.TransformAction<string, string>, v.UrlAction<string, "invalid url">]>>, never>;
@@ -446,16 +450,14 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
446
450
  }> | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.CustomIssue | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.MaxLengthIssue<string, 60> | v.PicklistIssue | 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<{
447
451
  value: string;
448
452
  label: string;
449
- }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string>>): v.Dataset<{
453
+ }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>>): v.Dataset<{
450
454
  url?: string | undefined;
451
455
  slug?: string | undefined;
452
- name?: string | undefined;
453
456
  overview?: string | undefined;
454
457
  tagline?: string | undefined;
455
458
  image?: string | undefined;
456
459
  logo?: string | undefined;
457
460
  card_img?: string | undefined;
458
- hq_country?: string | undefined;
459
461
  active_in_countries?: string[] | undefined;
460
462
  street_address?: string | undefined;
461
463
  sdgs?: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[] | undefined;
@@ -479,8 +481,11 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
479
481
  referrer?: string | undefined;
480
482
  referrer_expiry?: string | undefined;
481
483
  w_form?: string | undefined;
484
+ payout_minimum?: number | undefined;
482
485
  registration_number?: string | undefined;
486
+ name?: string | undefined;
483
487
  endow_designation?: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other" | undefined;
488
+ hq_country?: string | undefined;
484
489
  social_media_urls?: {
485
490
  facebook?: string | undefined;
486
491
  twitter?: string | undefined;
@@ -497,18 +502,16 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
497
502
  }> | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.CustomIssue | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.MaxLengthIssue<string, 60> | v.PicklistIssue | 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<{
498
503
  value: string;
499
504
  label: string;
500
- }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string>>;
505
+ }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>>;
501
506
  readonly _types?: {
502
507
  readonly input: {
503
508
  url?: string | undefined;
504
509
  slug?: string | undefined;
505
- name?: string | undefined;
506
510
  overview?: string | undefined;
507
511
  tagline?: string | undefined;
508
512
  image?: string | undefined;
509
513
  logo?: string | undefined;
510
514
  card_img?: string | undefined;
511
- hq_country?: string | undefined;
512
515
  active_in_countries?: string[] | undefined;
513
516
  street_address?: string | undefined;
514
517
  sdgs?: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[] | undefined;
@@ -532,8 +535,11 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
532
535
  referrer?: string | undefined;
533
536
  referrer_expiry?: string | undefined;
534
537
  w_form?: string | undefined;
538
+ payout_minimum?: number | undefined;
535
539
  registration_number?: string | undefined;
540
+ name?: string | undefined;
536
541
  endow_designation?: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other" | undefined;
542
+ hq_country?: string | undefined;
537
543
  social_media_urls?: {
538
544
  facebook?: string | undefined;
539
545
  twitter?: string | undefined;
@@ -547,13 +553,11 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
547
553
  readonly output: {
548
554
  url?: string | undefined;
549
555
  slug?: string | undefined;
550
- name?: string | undefined;
551
556
  overview?: string | undefined;
552
557
  tagline?: string | undefined;
553
558
  image?: string | undefined;
554
559
  logo?: string | undefined;
555
560
  card_img?: string | undefined;
556
- hq_country?: string | undefined;
557
561
  active_in_countries?: string[] | undefined;
558
562
  street_address?: string | undefined;
559
563
  sdgs?: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[] | undefined;
@@ -577,8 +581,11 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
577
581
  referrer?: string | undefined;
578
582
  referrer_expiry?: string | undefined;
579
583
  w_form?: string | undefined;
584
+ payout_minimum?: number | undefined;
580
585
  registration_number?: string | undefined;
586
+ name?: string | undefined;
581
587
  endow_designation?: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other" | undefined;
588
+ hq_country?: string | undefined;
582
589
  social_media_urls?: {
583
590
  facebook?: string | undefined;
584
591
  twitter?: string | undefined;
@@ -596,10 +603,10 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
596
603
  }> | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.CustomIssue | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.MaxLengthIssue<string, 60> | v.PicklistIssue | 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<{
597
604
  value: string;
598
605
  label: string;
599
- }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string>;
606
+ }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>;
600
607
  } | undefined;
601
608
  };
602
- export declare const endowFields: v.PicklistSchema<["url", "slug", "name", "overview", "tagline", "image", "logo", "card_img", "hq_country", "active_in_countries", "street_address", "sdgs", "receiptMsg", "hide_bg_tip", "published", "progDonationsAllowed", "allocation", "donateMethods", "increments", "fund_opt_in", "target", "referral_id", "referrer", "referrer_expiry", "w_form", "id", "env", "registration_number", "endow_designation", "social_media_urls", "claimed", "kyc_donors_only", "fiscal_sponsored"], undefined>;
609
+ export declare const endowFields: v.PicklistSchema<["url", "slug", "overview", "tagline", "image", "logo", "card_img", "active_in_countries", "street_address", "sdgs", "receiptMsg", "hide_bg_tip", "published", "progDonationsAllowed", "allocation", "donateMethods", "increments", "fund_opt_in", "target", "referral_id", "referrer", "referrer_expiry", "w_form", "payout_minimum", "id", "env", "registration_number", "name", "endow_designation", "hq_country", "social_media_urls", "claimed", "kyc_donors_only", "fiscal_sponsored"], undefined>;
603
610
  export interface Endowment extends v.InferOutput<typeof endowment> {
604
611
  }
605
612
  export interface EndowUpdate extends v.InferOutput<typeof endowUpdate> {
@@ -607,7 +614,7 @@ export interface EndowUpdate extends v.InferOutput<typeof endowUpdate> {
607
614
  export type EndowFields = v.InferOutput<typeof endowFields>;
608
615
  /** for ein path, only fields in reg-num/env gsi is available */
609
616
  export declare const endowQueryParams: v.ObjectSchema<{
610
- readonly fields: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.LazySchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]> | v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.RegexAction<string, "invalid csv">]>>, v.TransformAction<string, string[]>, v.FilterItemsAction<string[]>]>, v.ArraySchema<v.PicklistSchema<["url", "slug", "name", "overview", "tagline", "image", "logo", "card_img", "hq_country", "active_in_countries", "street_address", "sdgs", "receiptMsg", "hide_bg_tip", "published", "progDonationsAllowed", "allocation", "donateMethods", "increments", "fund_opt_in", "target", "referral_id", "referrer", "referrer_expiry", "w_form", "id", "env", "registration_number", "endow_designation", "social_media_urls", "claimed", "kyc_donors_only", "fiscal_sponsored"], undefined>, undefined>]>, never>;
617
+ readonly fields: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.LazySchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]> | v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.RegexAction<string, "invalid csv">]>>, v.TransformAction<string, string[]>, v.FilterItemsAction<string[]>]>, v.ArraySchema<v.PicklistSchema<["url", "slug", "overview", "tagline", "image", "logo", "card_img", "active_in_countries", "street_address", "sdgs", "receiptMsg", "hide_bg_tip", "published", "progDonationsAllowed", "allocation", "donateMethods", "increments", "fund_opt_in", "target", "referral_id", "referrer", "referrer_expiry", "w_form", "payout_minimum", "id", "env", "registration_number", "name", "endow_designation", "hq_country", "social_media_urls", "claimed", "kyc_donors_only", "fiscal_sponsored"], undefined>, undefined>]>, never>;
611
618
  }, undefined>;
612
619
  export interface EndowQueryParams extends v.InferInput<typeof endowQueryParams> {
613
620
  }
@@ -626,7 +633,7 @@ export declare const milestoneUpdate: Omit<v.ObjectSchema<{
626
633
  readonly title: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
627
634
  readonly description: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
628
635
  readonly media: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UrlAction<string, undefined>]>, never>;
629
- }, undefined>, "_types" | "_run" | "entries"> & {
636
+ }, undefined>, "_run" | "_types" | "entries"> & {
630
637
  readonly entries: {
631
638
  readonly date: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.IsoTimestampAction<string, undefined>]>, never>;
632
639
  readonly title: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
@@ -712,7 +719,7 @@ export declare const programUpdate: Omit<Omit<v.ObjectSchema<{
712
719
  description: string;
713
720
  media?: string | undefined;
714
721
  }[], 24, undefined>]>;
715
- }, undefined>, "_types" | "_run" | "entries"> & {
722
+ }, undefined>, "_run" | "_types" | "entries"> & {
716
723
  readonly entries: Omit<{
717
724
  readonly title: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
718
725
  readonly description: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
@@ -752,7 +759,7 @@ export declare const programUpdate: Omit<Omit<v.ObjectSchema<{
752
759
  };
753
760
  readonly issue: v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.ObjectIssue | v.UrlIssue<string>;
754
761
  } | undefined;
755
- }, "_types" | "_run" | "entries"> & {
762
+ }, "_run" | "_types" | "entries"> & {
756
763
  readonly entries: {
757
764
  readonly title: v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>;
758
765
  readonly description: v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>;
@@ -792,7 +799,7 @@ export declare const mediaUrl: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchem
792
799
  * so that media is automatically sorted by date
793
800
  * @see https://github.com/segmentio/ksuid
794
801
  * */
795
- export declare const mediaKsuid: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
802
+ export declare const mediaKsuid: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]>;
796
803
  export declare const mediaTypes: readonly ["album", "article", "video"];
797
804
  export declare const mediaType: v.PicklistSchema<readonly ["album", "article", "video"], undefined>;
798
805
  export type MediaType = v.InferOutput<typeof mediaType>;
@@ -807,7 +814,7 @@ export declare const mediaQueryParams: v.ObjectSchema<{
807
814
  readonly type: v.OptionalSchema<v.PicklistSchema<readonly ["album", "article", "video"], undefined>, never>;
808
815
  readonly nextPageKey: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.Base64Action<string, undefined>]>, never>;
809
816
  readonly featured: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.TransformAction<string, boolean>, v.BooleanSchema<undefined>]>, never>;
810
- readonly limit: v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, never>;
817
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TransformAction<string, number>, v.SchemaWithPipe<[v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>]>, never>;
811
818
  }, undefined>;
812
819
  export interface MediaQueryParams extends v.InferInput<typeof mediaQueryParams> {
813
820
  }
package/dist/schema.mjs CHANGED
@@ -1,12 +1,12 @@
1
- import { donateMethodId, donateMethodIds, env, https_url, orgDesignation, unSdgNum, } from "@better-giving/schemas";
1
+ import { donate_method_id, donate_method_ids, env, https_url, org_designation, unsdg_num, $int_gte1, int_gte1, $, $req_num_gt0, $req, } from "@better-giving/schemas";
2
2
  export { https_url, } from "@better-giving/schemas";
3
- export { orgDesignation as endowDesignation, env, unSdgNum, donateMethodId, donateMethodIds, };
3
+ export { org_designation as endow_designation, env, unsdg_num, donate_method_id, donate_method_ids, $int_gte1, int_gte1, $, $req_num_gt0, $req, };
4
4
  import * as v from "valibot";
5
- export const str = v.pipe(v.string(), v.trim());
5
+ export const min_payout_amount = 50;
6
6
  export const csv = v.lazy((x) => {
7
7
  if (!x)
8
- return str;
9
- return v.pipe(str, v.regex(/^[^,]+(?:,[^,]+)*$/, "invalid csv"));
8
+ return $;
9
+ return v.pipe($, v.regex(/^[^,]+(?:,[^,]+)*$/, "invalid csv"));
10
10
  });
11
11
  export const csvStrs = v.pipe(csv, v.transform((x) => x.split(",")), v.filterItems((x) => x.length > 0));
12
12
  const pct = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(100));
@@ -15,17 +15,15 @@ export const allocation = v.pipe(v.object({
15
15
  liq: pct,
16
16
  lock: pct,
17
17
  }), v.check((x) => x.cash + x.liq + x.lock === 100, "must total to 100"));
18
- export const int_id = v.pipe(v.number(), v.integer(), v.minValue(1));
19
- export const endowIdParam = v.pipe(v.string(), v.transform((x) => +x), int_id);
20
18
  export const segmentMaxChars = 30;
21
- export const segment = v.pipe(str, v.maxLength(segmentMaxChars, ({ requirement: r }) => `cannot exceed ${r} chars`),
19
+ export const segment = v.pipe($, v.maxLength(segmentMaxChars, ({ requirement: r }) => `cannot exceed ${r} chars`),
22
20
  //must not be id-like
23
21
  v.regex(/^(?!^\d+$)/, "should not be an id"),
24
22
  //valid characters
25
23
  v.regex(/^[a-zA-Z0-9-._~]+$/, "allowed: numbers | letters | - | . | _ | ~"), v.excludes("..", "should not contain double periods"), v.custom((x) => !x.startsWith("."), "should not start with dot"), v.custom((x) => !x.endsWith("."), "should not end with dot"));
26
- export const slug = v.lazy((x) => (x ? segment : str));
27
- export const reg_number = v.pipe(str, v.nonEmpty("required"), v.regex(/^[a-zA-Z0-9]+$/, "must only contain letters and numbers"));
28
- export const _url = v.pipe(str, v.url());
24
+ export const slug = v.lazy((x) => (x ? segment : $));
25
+ export const reg_number = v.pipe($, v.nonEmpty("required"), v.regex(/^[a-zA-Z0-9]+$/, "must only contain letters and numbers"));
26
+ export const _url = v.pipe($, v.url());
29
27
  export const social_media_urls = v.object({
30
28
  facebook: v.optional(https_url(false)),
31
29
  twitter: v.optional(https_url(false)),
@@ -36,44 +34,44 @@ export const social_media_urls = v.object({
36
34
  tiktok: v.optional(https_url(false)),
37
35
  });
38
36
  export const MAX_RECEIPT_MSG_CHAR = 500;
39
- export const incrementVal = v.pipe(str, v.nonEmpty("required"), v.transform((x) => +x), v.number("must be a number"), v.minValue(0, "must be greater than 0"),
37
+ export const incrementVal = v.pipe($req_num_gt0,
40
38
  //parsed output
41
39
  v.transform((x) => x.toString()));
42
40
  export const MAX_NUM_INCREMENTS = 4;
43
41
  export const incrementLabelMaxChars = 60;
44
42
  export const taglineMaxChars = 140;
45
- export const incrementLabel = v.pipe(str, v.maxLength(incrementLabelMaxChars, ({ requirement: r }) => `cannot exceed ${r} characters`));
43
+ export const incrementLabel = v.pipe($, v.maxLength(incrementLabelMaxChars, ({ requirement: r }) => `cannot exceed ${r} characters`));
46
44
  export const increment = v.object({
47
45
  value: incrementVal,
48
46
  label: incrementLabel,
49
47
  });
50
48
  export const endowment = v.object({
51
- id: int_id,
49
+ id: int_gte1,
52
50
  env,
53
51
  slug: v.optional(slug),
54
52
  registration_number: reg_number,
55
- name: v.pipe(str, v.nonEmpty("required")),
56
- endow_designation: orgDesignation,
57
- overview: v.optional(str),
58
- tagline: v.optional(v.pipe(str, v.maxLength(taglineMaxChars))),
53
+ name: $req,
54
+ endow_designation: org_designation,
55
+ overview: v.optional($),
56
+ tagline: v.optional(v.pipe($, v.maxLength(taglineMaxChars))),
59
57
  image: v.optional(_url),
60
58
  logo: v.optional(_url),
61
59
  card_img: v.optional(_url),
62
- hq_country: v.pipe(str, v.nonEmpty("required")),
63
- active_in_countries: v.pipe(v.array(str), v.nonEmpty("required")),
64
- street_address: v.optional(str),
60
+ hq_country: $req,
61
+ active_in_countries: v.pipe(v.array($), v.nonEmpty("required")),
62
+ street_address: v.optional($),
65
63
  social_media_urls,
66
64
  /** website */
67
65
  url: v.optional(https_url(false)),
68
- sdgs: v.pipe(v.array(unSdgNum), v.minLength(1)),
69
- receiptMsg: v.optional(v.pipe(str, v.maxLength(MAX_RECEIPT_MSG_CHAR))),
66
+ sdgs: v.pipe(v.array(unsdg_num), v.minLength(1)),
67
+ receiptMsg: v.optional(v.pipe($, v.maxLength(MAX_RECEIPT_MSG_CHAR))),
70
68
  //can be optional, default false and need not be explicit
71
69
  hide_bg_tip: v.optional(v.boolean()),
72
70
  published: v.optional(v.boolean()),
73
71
  /** allowed by default */
74
72
  progDonationsAllowed: v.optional(v.boolean()),
75
73
  allocation: v.optional(allocation),
76
- donateMethods: v.optional(v.array(donateMethodId)),
74
+ donateMethods: v.optional(v.array(donate_method_id)),
77
75
  increments: v.optional(v.pipe(v.array(increment), v.maxLength(MAX_NUM_INCREMENTS))),
78
76
  fund_opt_in: v.optional(v.boolean()),
79
77
  target: v.optional(v.union([
@@ -85,10 +83,11 @@ export const endowment = v.object({
85
83
  claimed: v.boolean(),
86
84
  kyc_donors_only: v.boolean(),
87
85
  fiscal_sponsored: v.boolean(),
88
- referral_id: v.optional(v.pipe(str, v.nonEmpty("required"))),
89
- referrer: v.optional(v.pipe(str, v.nonEmpty("required"))),
90
- referrer_expiry: v.optional(v.pipe(str, v.isoTimestamp())),
86
+ referral_id: v.optional($req),
87
+ referrer: v.optional($req),
88
+ referrer_expiry: v.optional(v.pipe($, v.isoTimestamp())),
91
89
  w_form: v.optional(v.string()),
90
+ payout_minimum: v.optional(v.pipe(v.number(), v.minValue(min_payout_amount))),
92
91
  });
93
92
  export const endowUpdate = v.partial(v.omit(endowment, [
94
93
  "id",
@@ -103,19 +102,19 @@ export const endowQueryParams = v.object({
103
102
  fields: v.optional(v.pipe(csvStrs, v.array(endowFields))),
104
103
  });
105
104
  const amnt = v.pipe(v.number(), v.minValue(0));
106
- export const programId = v.pipe(str, v.uuid());
107
- export const milestoneId = v.pipe(str, v.uuid());
105
+ export const programId = v.pipe($, v.uuid());
106
+ export const milestoneId = v.pipe($, v.uuid());
108
107
  export const newMilestone = v.object({
109
- date: v.pipe(str, v.isoTimestamp()),
110
- title: str,
111
- description: str,
108
+ date: v.pipe($, v.isoTimestamp()),
109
+ title: $,
110
+ description: $,
112
111
  media: v.optional(_url),
113
112
  });
114
113
  export const milestoneUpdate = v.partial(newMilestone, ["date"]);
115
114
  export const milestone = v.object({ ...newMilestone.entries, id: milestoneId });
116
115
  export const newProgram = v.object({
117
- title: str,
118
- description: str,
116
+ title: $,
117
+ description: $,
119
118
  banner: v.optional(_url),
120
119
  /** null unsets target */
121
120
  targetRaise: v.nullish(amnt),
@@ -128,12 +127,12 @@ export const program = v.object({
128
127
  id: programId,
129
128
  });
130
129
  export const programUpdate = v.partial(v.omit(newProgram, ["milestones"]));
131
- export const mediaUrl = v.pipe(str, v.url());
130
+ export const mediaUrl = v.pipe($, v.url());
132
131
  /**
133
132
  * so that media is automatically sorted by date
134
133
  * @see https://github.com/segmentio/ksuid
135
134
  * */
136
- export const mediaKsuid = v.pipe(str, v.nonEmpty() /** base62? */);
135
+ export const mediaKsuid = $req; // base62;
137
136
  export const mediaTypes = ["album", "article", "video"];
138
137
  export const mediaType = v.picklist(mediaTypes);
139
138
  export const mediaUpdate = v.object({
@@ -142,7 +141,7 @@ export const mediaUpdate = v.object({
142
141
  });
143
142
  export const mediaQueryParams = v.object({
144
143
  type: v.optional(mediaType),
145
- nextPageKey: v.optional(v.pipe(str, v.base64())),
146
- featured: v.optional(v.pipe(str, v.transform((x) => Boolean(x)), v.boolean())),
147
- limit: v.optional(v.pipe(v.string(), v.transform((x) => +x), v.number(), v.integer(), v.minValue(1))),
144
+ nextPageKey: v.optional(v.pipe($, v.base64())),
145
+ featured: v.optional(v.pipe($, v.transform((x) => Boolean(x)), v.boolean())),
146
+ limit: v.optional(v.pipe(v.string(), v.transform((x) => +x), int_gte1)),
148
147
  });
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@better-giving/endowment",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "peerDependencies": {
5
- "@better-giving/schemas": "1.2.0",
5
+ "@better-giving/schemas": "1.2.2",
6
6
  "@better-giving/types": "1.1.7",
7
7
  "valibot": "0.42.0"
8
8
  },
@@ -1,4 +1,4 @@
1
- import { orgDesignation, unSdgNum } from "@better-giving/schemas";
1
+ import { $int_gte1, org_designation, unsdg_num } from "@better-giving/schemas";
2
2
  import type {
3
3
  ToDoc,
4
4
  ToHitFields,
@@ -21,7 +21,7 @@ import {
21
21
  string,
22
22
  transform,
23
23
  } from "valibot";
24
- import { type Environment, csvStrs, endowment, str } from "./schema.mjs";
24
+ import { type Environment, csvStrs, endowment, $ } from "./schema.mjs";
25
25
 
26
26
  const boolCsv = pipe(
27
27
  csvStrs,
@@ -59,27 +59,20 @@ export const cloudsearchEndow = object({
59
59
  export const cloudSearchEndowFields = keyof(cloudsearchEndow);
60
60
 
61
61
  export const endowsQueryParams = object({
62
- query: optional(str),
63
- page: optional(
64
- pipe(
65
- string(),
66
- transform((x) => +x),
67
- integer(),
68
- minValue(1)
69
- )
70
- ),
71
- endow_designation: optional(pipe(csvStrs, array(orgDesignation))),
62
+ query: optional($),
63
+ page: optional($int_gte1),
64
+ endow_designation: optional(pipe(csvStrs, array(org_designation))),
72
65
  sdgs: optional(
73
66
  pipe(
74
67
  csvStrs,
75
68
  mapItems((x) => +x),
76
- array(unSdgNum)
69
+ array(unsdg_num)
77
70
  )
78
71
  ),
79
72
  kyc_only: optional(boolCsv),
80
73
  fund_opt_in: optional(boolCsv),
81
74
  claimed: optional(boolCsv),
82
- countries: optional(pipe(csvStrs, array(str))),
75
+ countries: optional(pipe(csvStrs, array($))),
83
76
  fields: optional(pipe(csvStrs, array(cloudSearchEndowFields))),
84
77
  });
85
78
 
package/src/db.mts CHANGED
@@ -1,6 +1,5 @@
1
1
  import type { Ensure } from "@better-giving/types/utils";
2
2
  import type {
3
- EndowId,
4
3
  Endowment as EndowmentShape,
5
4
  Environment,
6
5
  MediaId,
@@ -11,7 +10,6 @@ import type {
11
10
  ProgramId,
12
11
  } from "./schema.mjs";
13
12
  export type {
14
- EndowId,
15
13
  SocialMediaURLs,
16
14
  Allocation,
17
15
  Increment,
@@ -37,7 +35,7 @@ export namespace EndowCount {
37
35
 
38
36
  export namespace Endow {
39
37
  export type Keys = {
40
- PK: `Endow#${EndowId}`;
38
+ PK: `Endow#${number}`;
41
39
  SK: Environment;
42
40
  };
43
41
 
@@ -101,7 +99,7 @@ export namespace Milestone {
101
99
 
102
100
  export namespace Media {
103
101
  export interface Keys {
104
- PK: `Endow#${EndowId}#${Environment}`;
102
+ PK: `Endow#${number}#${Environment}`;
105
103
  SK: `Media#${MediaId}`;
106
104
  }
107
105
 
package/src/schema.mts CHANGED
@@ -1,10 +1,15 @@
1
1
  import {
2
- donateMethodId,
3
- donateMethodIds,
2
+ donate_method_id,
3
+ donate_method_ids,
4
4
  env,
5
5
  https_url,
6
- orgDesignation,
7
- unSdgNum,
6
+ org_designation,
7
+ unsdg_num,
8
+ $int_gte1,
9
+ int_gte1,
10
+ $,
11
+ $req_num_gt0,
12
+ $req,
8
13
  } from "@better-giving/schemas";
9
14
  export {
10
15
  type OrgDesignation as EndowDesignation,
@@ -14,18 +19,24 @@ export {
14
19
  https_url,
15
20
  } from "@better-giving/schemas";
16
21
  export {
17
- orgDesignation as endowDesignation,
22
+ org_designation as endow_designation,
18
23
  env,
19
- unSdgNum,
20
- donateMethodId,
21
- donateMethodIds,
24
+ unsdg_num,
25
+ donate_method_id,
26
+ donate_method_ids,
27
+ $int_gte1,
28
+ int_gte1,
29
+ $,
30
+ $req_num_gt0,
31
+ $req,
22
32
  };
23
33
  import * as v from "valibot";
24
34
 
25
- export const str = v.pipe(v.string(), v.trim());
35
+ export const min_payout_amount = 50;
36
+
26
37
  export const csv = v.lazy((x) => {
27
- if (!x) return str;
28
- return v.pipe(str, v.regex(/^[^,]+(?:,[^,]+)*$/, "invalid csv"));
38
+ if (!x) return $;
39
+ return v.pipe($, v.regex(/^[^,]+(?:,[^,]+)*$/, "invalid csv"));
29
40
  });
30
41
  export const csvStrs = v.pipe(
31
42
  csv,
@@ -45,17 +56,9 @@ export const allocation = v.pipe(
45
56
 
46
57
  export interface Allocation extends v.InferOutput<typeof allocation> {}
47
58
 
48
- export const int_id = v.pipe(v.number(), v.integer(), v.minValue(1));
49
- export type EndowId = v.InferOutput<typeof int_id>;
50
- export const endowIdParam = v.pipe(
51
- v.string(),
52
- v.transform((x) => +x),
53
- int_id
54
- );
55
-
56
59
  export const segmentMaxChars = 30;
57
60
  export const segment = v.pipe(
58
- str,
61
+ $,
59
62
  v.maxLength(
60
63
  segmentMaxChars,
61
64
  ({ requirement: r }) => `cannot exceed ${r} chars`
@@ -69,14 +72,14 @@ export const segment = v.pipe(
69
72
  v.custom((x) => !(x as string).endsWith("."), "should not end with dot")
70
73
  );
71
74
 
72
- export const slug = v.lazy((x) => (x ? segment : str));
75
+ export const slug = v.lazy((x) => (x ? segment : $));
73
76
 
74
77
  export const reg_number = v.pipe(
75
- str,
78
+ $,
76
79
  v.nonEmpty("required"),
77
80
  v.regex(/^[a-zA-Z0-9]+$/, "must only contain letters and numbers")
78
81
  );
79
- export const _url = v.pipe(str, v.url());
82
+ export const _url = v.pipe($, v.url());
80
83
 
81
84
  export const social_media_urls = v.object({
82
85
  facebook: v.optional(https_url(false)),
@@ -94,11 +97,7 @@ export interface SocialMediaURLs
94
97
  export const MAX_RECEIPT_MSG_CHAR = 500;
95
98
 
96
99
  export const incrementVal = v.pipe(
97
- str,
98
- v.nonEmpty("required"),
99
- v.transform((x) => +x),
100
- v.number("must be a number"),
101
- v.minValue(0, "must be greater than 0"),
100
+ $req_num_gt0,
102
101
  //parsed output
103
102
  v.transform((x) => x.toString())
104
103
  );
@@ -108,7 +107,7 @@ export const incrementLabelMaxChars = 60;
108
107
  export const taglineMaxChars = 140;
109
108
 
110
109
  export const incrementLabel = v.pipe(
111
- str,
110
+ $,
112
111
  v.maxLength(
113
112
  incrementLabelMaxChars,
114
113
  ({ requirement: r }) => `cannot exceed ${r} characters`
@@ -123,25 +122,25 @@ export const increment = v.object({
123
122
  export interface Increment extends v.InferOutput<typeof increment> {}
124
123
 
125
124
  export const endowment = v.object({
126
- id: int_id,
125
+ id: int_gte1,
127
126
  env,
128
127
  slug: v.optional(slug),
129
128
  registration_number: reg_number,
130
- name: v.pipe(str, v.nonEmpty("required")),
131
- endow_designation: orgDesignation,
132
- overview: v.optional(str),
133
- tagline: v.optional(v.pipe(str, v.maxLength(taglineMaxChars))),
129
+ name: $req,
130
+ endow_designation: org_designation,
131
+ overview: v.optional($),
132
+ tagline: v.optional(v.pipe($, v.maxLength(taglineMaxChars))),
134
133
  image: v.optional(_url),
135
134
  logo: v.optional(_url),
136
135
  card_img: v.optional(_url),
137
- hq_country: v.pipe(str, v.nonEmpty("required")),
138
- active_in_countries: v.pipe(v.array(str), v.nonEmpty("required")),
139
- street_address: v.optional(str),
136
+ hq_country: $req,
137
+ active_in_countries: v.pipe(v.array($), v.nonEmpty("required")),
138
+ street_address: v.optional($),
140
139
  social_media_urls,
141
140
  /** website */
142
141
  url: v.optional(https_url(false)),
143
- sdgs: v.pipe(v.array(unSdgNum), v.minLength(1)),
144
- receiptMsg: v.optional(v.pipe(str, v.maxLength(MAX_RECEIPT_MSG_CHAR))),
142
+ sdgs: v.pipe(v.array(unsdg_num), v.minLength(1)),
143
+ receiptMsg: v.optional(v.pipe($, v.maxLength(MAX_RECEIPT_MSG_CHAR))),
145
144
  //can be optional, default false and need not be explicit
146
145
  hide_bg_tip: v.optional(v.boolean()),
147
146
  published: v.optional(v.boolean()),
@@ -149,7 +148,7 @@ export const endowment = v.object({
149
148
  progDonationsAllowed: v.optional(v.boolean()),
150
149
 
151
150
  allocation: v.optional(allocation),
152
- donateMethods: v.optional(v.array(donateMethodId)),
151
+ donateMethods: v.optional(v.array(donate_method_id)),
153
152
  increments: v.optional(
154
153
  v.pipe(v.array(increment), v.maxLength(MAX_NUM_INCREMENTS))
155
154
  ),
@@ -171,10 +170,11 @@ export const endowment = v.object({
171
170
  claimed: v.boolean(),
172
171
  kyc_donors_only: v.boolean(),
173
172
  fiscal_sponsored: v.boolean(),
174
- referral_id: v.optional(v.pipe(str, v.nonEmpty("required"))),
175
- referrer: v.optional(v.pipe(str, v.nonEmpty("required"))),
176
- referrer_expiry: v.optional(v.pipe(str, v.isoTimestamp())),
173
+ referral_id: v.optional($req),
174
+ referrer: v.optional($req),
175
+ referrer_expiry: v.optional(v.pipe($, v.isoTimestamp())),
177
176
  w_form: v.optional(v.string()),
177
+ payout_minimum: v.optional(v.pipe(v.number(), v.minValue(min_payout_amount))),
178
178
  });
179
179
 
180
180
  export const endowUpdate = v.partial(
@@ -201,15 +201,15 @@ export interface EndowQueryParams
201
201
  extends v.InferInput<typeof endowQueryParams> {}
202
202
 
203
203
  const amnt = v.pipe(v.number(), v.minValue(0));
204
- export const programId = v.pipe(str, v.uuid());
204
+ export const programId = v.pipe($, v.uuid());
205
205
  export type ProgramId = v.InferOutput<typeof programId>;
206
- export const milestoneId = v.pipe(str, v.uuid());
206
+ export const milestoneId = v.pipe($, v.uuid());
207
207
  export type MilestoneId = v.InferOutput<typeof milestoneId>;
208
208
 
209
209
  export const newMilestone = v.object({
210
- date: v.pipe(str, v.isoTimestamp()),
211
- title: str,
212
- description: str,
210
+ date: v.pipe($, v.isoTimestamp()),
211
+ title: $,
212
+ description: $,
213
213
  media: v.optional(_url),
214
214
  });
215
215
 
@@ -222,8 +222,8 @@ export const milestone = v.object({ ...newMilestone.entries, id: milestoneId });
222
222
  export interface Milestone extends v.InferOutput<typeof milestone> {}
223
223
 
224
224
  export const newProgram = v.object({
225
- title: str,
226
- description: str,
225
+ title: $,
226
+ description: $,
227
227
  banner: v.optional(_url),
228
228
  /** null unsets target */
229
229
  targetRaise: v.nullish(amnt),
@@ -243,12 +243,12 @@ export interface NewProgram extends v.InferOutput<typeof newProgram> {}
243
243
  export interface Program extends v.InferOutput<typeof program> {}
244
244
  export interface ProgramUpdate extends v.InferOutput<typeof programUpdate> {}
245
245
 
246
- export const mediaUrl = v.pipe(str, v.url());
246
+ export const mediaUrl = v.pipe($, v.url());
247
247
  /**
248
248
  * so that media is automatically sorted by date
249
249
  * @see https://github.com/segmentio/ksuid
250
250
  * */
251
- export const mediaKsuid = v.pipe(str, v.nonEmpty() /** base62? */);
251
+ export const mediaKsuid = $req; // base62;
252
252
  export const mediaTypes = ["album", "article", "video"] as const;
253
253
  export const mediaType = v.picklist(mediaTypes);
254
254
  export type MediaType = v.InferOutput<typeof mediaType>;
@@ -263,10 +263,10 @@ export type MediaId = v.InferOutput<typeof mediaKsuid>;
263
263
 
264
264
  export const mediaQueryParams = v.object({
265
265
  type: v.optional(mediaType),
266
- nextPageKey: v.optional(v.pipe(str, v.base64())),
266
+ nextPageKey: v.optional(v.pipe($, v.base64())),
267
267
  featured: v.optional(
268
268
  v.pipe(
269
- str,
269
+ $,
270
270
  v.transform((x) => Boolean(x)),
271
271
  v.boolean()
272
272
  )
@@ -275,9 +275,7 @@ export const mediaQueryParams = v.object({
275
275
  v.pipe(
276
276
  v.string(),
277
277
  v.transform((x) => +x),
278
- v.number(),
279
- v.integer(),
280
- v.minValue(1)
278
+ int_gte1
281
279
  )
282
280
  ),
283
281
  });