@better-giving/endowment 2.0.2 → 2.0.4

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, MilestoneId, Milestone as MilestoneShape, ProgramId, Program as ProgramShape } 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,9 +1,8 @@
1
- import { donateMethodId, donateMethodIds, env, orgDesignation, unSdgNum } from "@better-giving/schemas";
1
+ import { $, $int_gte1, $req, $req_num_gt0, donate_method_id, donate_method_ids, env, int_gte1, org_designation, unsdg_num } 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
5
  export declare const min_payout_amount = 50;
6
- export declare const str: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
7
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">]>>;
8
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[]>]>;
9
8
  export declare const allocation: v.SchemaWithPipe<[v.ObjectSchema<{
@@ -17,9 +16,6 @@ export declare const allocation: v.SchemaWithPipe<[v.ObjectSchema<{
17
16
  }, "must total to 100">]>;
18
17
  export interface Allocation extends v.InferOutput<typeof allocation> {
19
18
  }
20
- export declare const int_id: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
21
- export type EndowId = v.InferOutput<typeof int_id>;
22
- 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>]>]>;
23
19
  export declare const segmentMaxChars = 30;
24
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">]>;
25
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">]>>;
@@ -37,13 +33,13 @@ export declare const social_media_urls: v.ObjectSchema<{
37
33
  export interface SocialMediaURLs extends v.InferOutput<typeof social_media_urls> {
38
34
  }
39
35
  export declare const MAX_RECEIPT_MSG_CHAR = 500;
40
- 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>]>;
41
37
  export declare const MAX_NUM_INCREMENTS = 4;
42
38
  export declare const incrementLabelMaxChars = 60;
43
39
  export declare const taglineMaxChars = 140;
44
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>]>;
45
41
  export declare const increment: v.ObjectSchema<{
46
- 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>]>;
47
43
  readonly label: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
48
44
  }, undefined>;
49
45
  export interface Increment extends v.InferOutput<typeof increment> {
@@ -91,7 +87,7 @@ export declare const endowment: v.ObjectSchema<{
91
87
  }, "must total to 100">]>, never>;
92
88
  readonly donateMethods: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["stripe", "crypto", "daf", "stocks"], undefined>, undefined>, never>;
93
89
  readonly increments: v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
94
- 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>]>;
95
91
  readonly label: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
96
92
  }, undefined>, undefined>, v.MaxLengthAction<{
97
93
  value: string;
@@ -152,7 +148,7 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
152
148
  }, "must total to 100">]>, never>;
153
149
  readonly donateMethods: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["stripe", "crypto", "daf", "stocks"], undefined>, undefined>, never>;
154
150
  readonly increments: v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
155
- 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>]>;
156
152
  readonly label: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
157
153
  }, undefined>, undefined>, v.MaxLengthAction<{
158
154
  value: string;
@@ -169,7 +165,7 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
169
165
  readonly referrer_expiry: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.IsoTimestampAction<string, undefined>]>, never>;
170
166
  readonly w_form: v.OptionalSchema<v.StringSchema<undefined>, never>;
171
167
  readonly payout_minimum: v.OptionalSchema<v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 50, undefined>]>, never>;
172
- }, undefined>, "_types" | "_run" | "entries"> & {
168
+ }, undefined>, "_run" | "_types" | "entries"> & {
173
169
  readonly entries: Omit<{
174
170
  readonly id: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
175
171
  readonly env: v.PicklistSchema<readonly ["staging", "production"], undefined>;
@@ -213,7 +209,7 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
213
209
  }, "must total to 100">]>, never>;
214
210
  readonly donateMethods: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["stripe", "crypto", "daf", "stocks"], undefined>, undefined>, never>;
215
211
  readonly increments: v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
216
- 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>]>;
217
213
  readonly label: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
218
214
  }, undefined>, undefined>, v.MaxLengthAction<{
219
215
  value: string;
@@ -239,12 +235,12 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
239
235
  value: string;
240
236
  label: string;
241
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<{
242
- name: string;
243
- hq_country: string;
244
238
  active_in_countries: string[];
245
239
  sdgs: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[];
246
240
  registration_number: string;
241
+ name: string;
247
242
  endow_designation: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other";
243
+ hq_country: string;
248
244
  social_media_urls: {
249
245
  facebook?: string | undefined;
250
246
  twitter?: string | undefined;
@@ -293,12 +289,12 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
293
289
  }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>>;
294
290
  readonly _types?: {
295
291
  readonly input: {
296
- name: string;
297
- hq_country: string;
298
292
  active_in_countries: string[];
299
293
  sdgs: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[];
300
294
  registration_number: string;
295
+ name: string;
301
296
  endow_designation: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other";
297
+ hq_country: string;
302
298
  social_media_urls: {
303
299
  facebook?: string | undefined;
304
300
  twitter?: string | undefined;
@@ -339,12 +335,12 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
339
335
  payout_minimum?: number | undefined;
340
336
  };
341
337
  readonly output: {
342
- name: string;
343
- hq_country: string;
344
338
  active_in_countries: string[];
345
339
  sdgs: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[];
346
340
  registration_number: string;
341
+ name: string;
347
342
  endow_designation: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other";
343
+ hq_country: string;
348
344
  social_media_urls: {
349
345
  facebook?: string | undefined;
350
346
  twitter?: string | undefined;
@@ -393,17 +389,15 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
393
389
  label: string;
394
390
  }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>;
395
391
  } | undefined;
396
- }, "_types" | "_run" | "entries"> & {
392
+ }, "_run" | "_types" | "entries"> & {
397
393
  readonly entries: {
398
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>;
399
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>;
400
- readonly name: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, never>;
401
396
  readonly overview: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>, never>;
402
397
  readonly tagline: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 140, undefined>]>, never>, never>;
403
398
  readonly image: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UrlAction<string, undefined>]>, never>, never>;
404
399
  readonly logo: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UrlAction<string, undefined>]>, never>, never>;
405
400
  readonly card_img: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UrlAction<string, undefined>]>, never>, never>;
406
- readonly hq_country: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, never>;
407
401
  readonly active_in_countries: v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.NonEmptyAction<string[], "required">]>, never>;
408
402
  readonly street_address: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>, never>;
409
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>;
@@ -422,7 +416,7 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
422
416
  }, "must total to 100">]>, never>, never>;
423
417
  readonly donateMethods: v.OptionalSchema<v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["stripe", "crypto", "daf", "stocks"], undefined>, undefined>, never>, never>;
424
418
  readonly increments: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
425
- 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>]>;
426
420
  readonly label: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
427
421
  }, undefined>, undefined>, v.MaxLengthAction<{
428
422
  value: string;
@@ -436,7 +430,9 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
436
430
  readonly w_form: v.OptionalSchema<v.OptionalSchema<v.StringSchema<undefined>, never>, never>;
437
431
  readonly payout_minimum: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 50, undefined>]>, never>, never>;
438
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>;
439
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>;
440
436
  readonly social_media_urls: v.OptionalSchema<v.ObjectSchema<{
441
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>;
442
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>;
@@ -457,13 +453,11 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
457
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<{
458
454
  url?: string | undefined;
459
455
  slug?: string | undefined;
460
- name?: string | undefined;
461
456
  overview?: string | undefined;
462
457
  tagline?: string | undefined;
463
458
  image?: string | undefined;
464
459
  logo?: string | undefined;
465
460
  card_img?: string | undefined;
466
- hq_country?: string | undefined;
467
461
  active_in_countries?: string[] | undefined;
468
462
  street_address?: string | undefined;
469
463
  sdgs?: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[] | undefined;
@@ -489,7 +483,9 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
489
483
  w_form?: string | undefined;
490
484
  payout_minimum?: number | undefined;
491
485
  registration_number?: string | undefined;
486
+ name?: string | undefined;
492
487
  endow_designation?: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other" | undefined;
488
+ hq_country?: string | undefined;
493
489
  social_media_urls?: {
494
490
  facebook?: string | undefined;
495
491
  twitter?: string | undefined;
@@ -511,13 +507,11 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
511
507
  readonly input: {
512
508
  url?: string | undefined;
513
509
  slug?: string | undefined;
514
- name?: string | undefined;
515
510
  overview?: string | undefined;
516
511
  tagline?: string | undefined;
517
512
  image?: string | undefined;
518
513
  logo?: string | undefined;
519
514
  card_img?: string | undefined;
520
- hq_country?: string | undefined;
521
515
  active_in_countries?: string[] | undefined;
522
516
  street_address?: string | undefined;
523
517
  sdgs?: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[] | undefined;
@@ -543,7 +537,9 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
543
537
  w_form?: string | undefined;
544
538
  payout_minimum?: number | undefined;
545
539
  registration_number?: string | undefined;
540
+ name?: string | undefined;
546
541
  endow_designation?: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other" | undefined;
542
+ hq_country?: string | undefined;
547
543
  social_media_urls?: {
548
544
  facebook?: string | undefined;
549
545
  twitter?: string | undefined;
@@ -557,13 +553,11 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
557
553
  readonly output: {
558
554
  url?: string | undefined;
559
555
  slug?: string | undefined;
560
- name?: string | undefined;
561
556
  overview?: string | undefined;
562
557
  tagline?: string | undefined;
563
558
  image?: string | undefined;
564
559
  logo?: string | undefined;
565
560
  card_img?: string | undefined;
566
- hq_country?: string | undefined;
567
561
  active_in_countries?: string[] | undefined;
568
562
  street_address?: string | undefined;
569
563
  sdgs?: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[] | undefined;
@@ -589,7 +583,9 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
589
583
  w_form?: string | undefined;
590
584
  payout_minimum?: number | undefined;
591
585
  registration_number?: string | undefined;
586
+ name?: string | undefined;
592
587
  endow_designation?: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other" | undefined;
588
+ hq_country?: string | undefined;
593
589
  social_media_urls?: {
594
590
  facebook?: string | undefined;
595
591
  twitter?: string | undefined;
@@ -610,7 +606,7 @@ export declare const endowUpdate: Omit<Omit<v.ObjectSchema<{
610
606
  }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>;
611
607
  } | undefined;
612
608
  };
613
- 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", "payout_minimum", "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>;
614
610
  export interface Endowment extends v.InferOutput<typeof endowment> {
615
611
  }
616
612
  export interface EndowUpdate extends v.InferOutput<typeof endowUpdate> {
@@ -618,7 +614,7 @@ export interface EndowUpdate extends v.InferOutput<typeof endowUpdate> {
618
614
  export type EndowFields = v.InferOutput<typeof endowFields>;
619
615
  /** for ein path, only fields in reg-num/env gsi is available */
620
616
  export declare const endowQueryParams: v.ObjectSchema<{
621
- 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", "payout_minimum", "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>;
622
618
  }, undefined>;
623
619
  export interface EndowQueryParams extends v.InferInput<typeof endowQueryParams> {
624
620
  }
@@ -637,7 +633,7 @@ export declare const milestoneUpdate: Omit<v.ObjectSchema<{
637
633
  readonly title: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
638
634
  readonly description: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
639
635
  readonly media: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UrlAction<string, undefined>]>, never>;
640
- }, undefined>, "_types" | "_run" | "entries"> & {
636
+ }, undefined>, "_run" | "_types" | "entries"> & {
641
637
  readonly entries: {
642
638
  readonly date: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.IsoTimestampAction<string, undefined>]>, never>;
643
639
  readonly title: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
@@ -723,7 +719,7 @@ export declare const programUpdate: Omit<Omit<v.ObjectSchema<{
723
719
  description: string;
724
720
  media?: string | undefined;
725
721
  }[], 24, undefined>]>;
726
- }, undefined>, "_types" | "_run" | "entries"> & {
722
+ }, undefined>, "_run" | "_types" | "entries"> & {
727
723
  readonly entries: Omit<{
728
724
  readonly title: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
729
725
  readonly description: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
@@ -763,7 +759,7 @@ export declare const programUpdate: Omit<Omit<v.ObjectSchema<{
763
759
  };
764
760
  readonly issue: v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.ObjectIssue | v.UrlIssue<string>;
765
761
  } | undefined;
766
- }, "_types" | "_run" | "entries"> & {
762
+ }, "_run" | "_types" | "entries"> & {
767
763
  readonly entries: {
768
764
  readonly title: v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>;
769
765
  readonly description: v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>;
@@ -803,7 +799,7 @@ export declare const mediaUrl: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchem
803
799
  * so that media is automatically sorted by date
804
800
  * @see https://github.com/segmentio/ksuid
805
801
  * */
806
- 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">]>;
807
803
  export declare const mediaTypes: readonly ["album", "article", "video"];
808
804
  export declare const mediaType: v.PicklistSchema<readonly ["album", "article", "video"], undefined>;
809
805
  export type MediaType = v.InferOutput<typeof mediaType>;
@@ -818,7 +814,7 @@ export declare const mediaQueryParams: v.ObjectSchema<{
818
814
  readonly type: v.OptionalSchema<v.PicklistSchema<readonly ["album", "article", "video"], undefined>, never>;
819
815
  readonly nextPageKey: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.Base64Action<string, undefined>]>, never>;
820
816
  readonly featured: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.TransformAction<string, boolean>, v.BooleanSchema<undefined>]>, never>;
821
- 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>;
822
818
  }, undefined>;
823
819
  export interface MediaQueryParams extends v.InferInput<typeof mediaQueryParams> {
824
820
  }
package/dist/schema.mjs CHANGED
@@ -1,13 +1,12 @@
1
- import { donateMethodId, donateMethodIds, env, https_url, orgDesignation, unSdgNum, } from "@better-giving/schemas";
1
+ import { $, $int_gte1, $req, $req_num_gt0, donate_method_id, donate_method_ids, env, https_url, int_gte1, org_designation, unsdg_num, } 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
5
  export const min_payout_amount = 50;
6
- export const str = v.pipe(v.string(), v.trim());
7
6
  export const csv = v.lazy((x) => {
8
7
  if (!x)
9
- return str;
10
- return v.pipe(str, v.regex(/^[^,]+(?:,[^,]+)*$/, "invalid csv"));
8
+ return $;
9
+ return v.pipe($, v.regex(/^[^,]+(?:,[^,]+)*$/, "invalid csv"));
11
10
  });
12
11
  export const csvStrs = v.pipe(csv, v.transform((x) => x.split(",")), v.filterItems((x) => x.length > 0));
13
12
  const pct = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(100));
@@ -16,17 +15,15 @@ export const allocation = v.pipe(v.object({
16
15
  liq: pct,
17
16
  lock: pct,
18
17
  }), v.check((x) => x.cash + x.liq + x.lock === 100, "must total to 100"));
19
- export const int_id = v.pipe(v.number(), v.integer(), v.minValue(1));
20
- export const endowIdParam = v.pipe(v.string(), v.transform((x) => +x), int_id);
21
18
  export const segmentMaxChars = 30;
22
- 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`),
23
20
  //must not be id-like
24
21
  v.regex(/^(?!^\d+$)/, "should not be an id"),
25
22
  //valid characters
26
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"));
27
- export const slug = v.lazy((x) => (x ? segment : str));
28
- export const reg_number = v.pipe(str, v.nonEmpty("required"), v.regex(/^[a-zA-Z0-9]+$/, "must only contain letters and numbers"));
29
- 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());
30
27
  export const social_media_urls = v.object({
31
28
  facebook: v.optional(https_url(false)),
32
29
  twitter: v.optional(https_url(false)),
@@ -37,44 +34,44 @@ export const social_media_urls = v.object({
37
34
  tiktok: v.optional(https_url(false)),
38
35
  });
39
36
  export const MAX_RECEIPT_MSG_CHAR = 500;
40
- 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,
41
38
  //parsed output
42
39
  v.transform((x) => x.toString()));
43
40
  export const MAX_NUM_INCREMENTS = 4;
44
41
  export const incrementLabelMaxChars = 60;
45
42
  export const taglineMaxChars = 140;
46
- 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`));
47
44
  export const increment = v.object({
48
45
  value: incrementVal,
49
46
  label: incrementLabel,
50
47
  });
51
48
  export const endowment = v.object({
52
- id: int_id,
49
+ id: int_gte1,
53
50
  env,
54
51
  slug: v.optional(slug),
55
52
  registration_number: reg_number,
56
- name: v.pipe(str, v.nonEmpty("required")),
57
- endow_designation: orgDesignation,
58
- overview: v.optional(str),
59
- 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))),
60
57
  image: v.optional(_url),
61
58
  logo: v.optional(_url),
62
59
  card_img: v.optional(_url),
63
- hq_country: v.pipe(str, v.nonEmpty("required")),
64
- active_in_countries: v.pipe(v.array(str), v.nonEmpty("required")),
65
- 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($),
66
63
  social_media_urls,
67
64
  /** website */
68
65
  url: v.optional(https_url(false)),
69
- sdgs: v.pipe(v.array(unSdgNum), v.minLength(1)),
70
- 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))),
71
68
  //can be optional, default false and need not be explicit
72
69
  hide_bg_tip: v.optional(v.boolean()),
73
70
  published: v.optional(v.boolean()),
74
71
  /** allowed by default */
75
72
  progDonationsAllowed: v.optional(v.boolean()),
76
73
  allocation: v.optional(allocation),
77
- donateMethods: v.optional(v.array(donateMethodId)),
74
+ donateMethods: v.optional(v.array(donate_method_id)),
78
75
  increments: v.optional(v.pipe(v.array(increment), v.maxLength(MAX_NUM_INCREMENTS))),
79
76
  fund_opt_in: v.optional(v.boolean()),
80
77
  target: v.optional(v.union([
@@ -86,9 +83,9 @@ export const endowment = v.object({
86
83
  claimed: v.boolean(),
87
84
  kyc_donors_only: v.boolean(),
88
85
  fiscal_sponsored: v.boolean(),
89
- referral_id: v.optional(v.pipe(str, v.nonEmpty("required"))),
90
- referrer: v.optional(v.pipe(str, v.nonEmpty("required"))),
91
- 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())),
92
89
  w_form: v.optional(v.string()),
93
90
  payout_minimum: v.optional(v.pipe(v.number(), v.minValue(min_payout_amount))),
94
91
  });
@@ -105,19 +102,19 @@ export const endowQueryParams = v.object({
105
102
  fields: v.optional(v.pipe(csvStrs, v.array(endowFields))),
106
103
  });
107
104
  const amnt = v.pipe(v.number(), v.minValue(0));
108
- export const programId = v.pipe(str, v.uuid());
109
- export const milestoneId = v.pipe(str, v.uuid());
105
+ export const programId = v.pipe($, v.uuid());
106
+ export const milestoneId = v.pipe($, v.uuid());
110
107
  export const newMilestone = v.object({
111
- date: v.pipe(str, v.isoTimestamp()),
112
- title: str,
113
- description: str,
108
+ date: v.pipe($, v.isoTimestamp()),
109
+ title: $,
110
+ description: $,
114
111
  media: v.optional(_url),
115
112
  });
116
113
  export const milestoneUpdate = v.partial(newMilestone, ["date"]);
117
114
  export const milestone = v.object({ ...newMilestone.entries, id: milestoneId });
118
115
  export const newProgram = v.object({
119
- title: str,
120
- description: str,
116
+ title: $,
117
+ description: $,
121
118
  banner: v.optional(_url),
122
119
  /** null unsets target */
123
120
  targetRaise: v.nullish(amnt),
@@ -130,12 +127,12 @@ export const program = v.object({
130
127
  id: programId,
131
128
  });
132
129
  export const programUpdate = v.partial(v.omit(newProgram, ["milestones"]));
133
- export const mediaUrl = v.pipe(str, v.url());
130
+ export const mediaUrl = v.pipe($, v.url());
134
131
  /**
135
132
  * so that media is automatically sorted by date
136
133
  * @see https://github.com/segmentio/ksuid
137
134
  * */
138
- export const mediaKsuid = v.pipe(str, v.nonEmpty() /** base62? */);
135
+ export const mediaKsuid = $req; // base62;
139
136
  export const mediaTypes = ["album", "article", "video"];
140
137
  export const mediaType = v.picklist(mediaTypes);
141
138
  export const mediaUpdate = v.object({
@@ -144,7 +141,7 @@ export const mediaUpdate = v.object({
144
141
  });
145
142
  export const mediaQueryParams = v.object({
146
143
  type: v.optional(mediaType),
147
- nextPageKey: v.optional(v.pipe(str, v.base64())),
148
- featured: v.optional(v.pipe(str, v.transform((x) => Boolean(x)), v.boolean())),
149
- 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)),
150
147
  });
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@better-giving/endowment",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "peerDependencies": {
5
- "@better-giving/schemas": "1.2.0",
6
- "@better-giving/types": "1.1.7",
5
+ "@better-giving/schemas": "1.2.2",
6
+ "@better-giving/types": "1.1.8",
7
7
  "valibot": "0.42.0"
8
8
  },
9
9
  "devDependencies": {
@@ -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,17 +1,15 @@
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,
7
6
  MediaType,
8
- Milestone as MilestoneShape,
9
7
  MilestoneId,
10
- Program as ProgramShape,
8
+ Milestone as MilestoneShape,
11
9
  ProgramId,
10
+ Program as ProgramShape,
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
+ $,
3
+ $int_gte1,
4
+ $req,
5
+ $req_num_gt0,
6
+ donate_method_id,
7
+ donate_method_ids,
4
8
  env,
5
9
  https_url,
6
- orgDesignation,
7
- unSdgNum,
10
+ int_gte1,
11
+ org_designation,
12
+ unsdg_num,
8
13
  } from "@better-giving/schemas";
9
14
  export {
10
15
  type OrgDesignation as EndowDesignation,
@@ -14,20 +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
35
  export const min_payout_amount = 50;
26
36
 
27
- export const str = v.pipe(v.string(), v.trim());
28
37
  export const csv = v.lazy((x) => {
29
- if (!x) return str;
30
- return v.pipe(str, v.regex(/^[^,]+(?:,[^,]+)*$/, "invalid csv"));
38
+ if (!x) return $;
39
+ return v.pipe($, v.regex(/^[^,]+(?:,[^,]+)*$/, "invalid csv"));
31
40
  });
32
41
  export const csvStrs = v.pipe(
33
42
  csv,
@@ -47,17 +56,9 @@ export const allocation = v.pipe(
47
56
 
48
57
  export interface Allocation extends v.InferOutput<typeof allocation> {}
49
58
 
50
- export const int_id = v.pipe(v.number(), v.integer(), v.minValue(1));
51
- export type EndowId = v.InferOutput<typeof int_id>;
52
- export const endowIdParam = v.pipe(
53
- v.string(),
54
- v.transform((x) => +x),
55
- int_id
56
- );
57
-
58
59
  export const segmentMaxChars = 30;
59
60
  export const segment = v.pipe(
60
- str,
61
+ $,
61
62
  v.maxLength(
62
63
  segmentMaxChars,
63
64
  ({ requirement: r }) => `cannot exceed ${r} chars`
@@ -71,14 +72,14 @@ export const segment = v.pipe(
71
72
  v.custom((x) => !(x as string).endsWith("."), "should not end with dot")
72
73
  );
73
74
 
74
- export const slug = v.lazy((x) => (x ? segment : str));
75
+ export const slug = v.lazy((x) => (x ? segment : $));
75
76
 
76
77
  export const reg_number = v.pipe(
77
- str,
78
+ $,
78
79
  v.nonEmpty("required"),
79
80
  v.regex(/^[a-zA-Z0-9]+$/, "must only contain letters and numbers")
80
81
  );
81
- export const _url = v.pipe(str, v.url());
82
+ export const _url = v.pipe($, v.url());
82
83
 
83
84
  export const social_media_urls = v.object({
84
85
  facebook: v.optional(https_url(false)),
@@ -96,11 +97,7 @@ export interface SocialMediaURLs
96
97
  export const MAX_RECEIPT_MSG_CHAR = 500;
97
98
 
98
99
  export const incrementVal = v.pipe(
99
- str,
100
- v.nonEmpty("required"),
101
- v.transform((x) => +x),
102
- v.number("must be a number"),
103
- v.minValue(0, "must be greater than 0"),
100
+ $req_num_gt0,
104
101
  //parsed output
105
102
  v.transform((x) => x.toString())
106
103
  );
@@ -110,7 +107,7 @@ export const incrementLabelMaxChars = 60;
110
107
  export const taglineMaxChars = 140;
111
108
 
112
109
  export const incrementLabel = v.pipe(
113
- str,
110
+ $,
114
111
  v.maxLength(
115
112
  incrementLabelMaxChars,
116
113
  ({ requirement: r }) => `cannot exceed ${r} characters`
@@ -125,25 +122,25 @@ export const increment = v.object({
125
122
  export interface Increment extends v.InferOutput<typeof increment> {}
126
123
 
127
124
  export const endowment = v.object({
128
- id: int_id,
125
+ id: int_gte1,
129
126
  env,
130
127
  slug: v.optional(slug),
131
128
  registration_number: reg_number,
132
- name: v.pipe(str, v.nonEmpty("required")),
133
- endow_designation: orgDesignation,
134
- overview: v.optional(str),
135
- 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))),
136
133
  image: v.optional(_url),
137
134
  logo: v.optional(_url),
138
135
  card_img: v.optional(_url),
139
- hq_country: v.pipe(str, v.nonEmpty("required")),
140
- active_in_countries: v.pipe(v.array(str), v.nonEmpty("required")),
141
- 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($),
142
139
  social_media_urls,
143
140
  /** website */
144
141
  url: v.optional(https_url(false)),
145
- sdgs: v.pipe(v.array(unSdgNum), v.minLength(1)),
146
- 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))),
147
144
  //can be optional, default false and need not be explicit
148
145
  hide_bg_tip: v.optional(v.boolean()),
149
146
  published: v.optional(v.boolean()),
@@ -151,7 +148,7 @@ export const endowment = v.object({
151
148
  progDonationsAllowed: v.optional(v.boolean()),
152
149
 
153
150
  allocation: v.optional(allocation),
154
- donateMethods: v.optional(v.array(donateMethodId)),
151
+ donateMethods: v.optional(v.array(donate_method_id)),
155
152
  increments: v.optional(
156
153
  v.pipe(v.array(increment), v.maxLength(MAX_NUM_INCREMENTS))
157
154
  ),
@@ -173,9 +170,9 @@ export const endowment = v.object({
173
170
  claimed: v.boolean(),
174
171
  kyc_donors_only: v.boolean(),
175
172
  fiscal_sponsored: v.boolean(),
176
- referral_id: v.optional(v.pipe(str, v.nonEmpty("required"))),
177
- referrer: v.optional(v.pipe(str, v.nonEmpty("required"))),
178
- 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())),
179
176
  w_form: v.optional(v.string()),
180
177
  payout_minimum: v.optional(v.pipe(v.number(), v.minValue(min_payout_amount))),
181
178
  });
@@ -204,15 +201,15 @@ export interface EndowQueryParams
204
201
  extends v.InferInput<typeof endowQueryParams> {}
205
202
 
206
203
  const amnt = v.pipe(v.number(), v.minValue(0));
207
- export const programId = v.pipe(str, v.uuid());
204
+ export const programId = v.pipe($, v.uuid());
208
205
  export type ProgramId = v.InferOutput<typeof programId>;
209
- export const milestoneId = v.pipe(str, v.uuid());
206
+ export const milestoneId = v.pipe($, v.uuid());
210
207
  export type MilestoneId = v.InferOutput<typeof milestoneId>;
211
208
 
212
209
  export const newMilestone = v.object({
213
- date: v.pipe(str, v.isoTimestamp()),
214
- title: str,
215
- description: str,
210
+ date: v.pipe($, v.isoTimestamp()),
211
+ title: $,
212
+ description: $,
216
213
  media: v.optional(_url),
217
214
  });
218
215
 
@@ -225,8 +222,8 @@ export const milestone = v.object({ ...newMilestone.entries, id: milestoneId });
225
222
  export interface Milestone extends v.InferOutput<typeof milestone> {}
226
223
 
227
224
  export const newProgram = v.object({
228
- title: str,
229
- description: str,
225
+ title: $,
226
+ description: $,
230
227
  banner: v.optional(_url),
231
228
  /** null unsets target */
232
229
  targetRaise: v.nullish(amnt),
@@ -246,12 +243,12 @@ export interface NewProgram extends v.InferOutput<typeof newProgram> {}
246
243
  export interface Program extends v.InferOutput<typeof program> {}
247
244
  export interface ProgramUpdate extends v.InferOutput<typeof programUpdate> {}
248
245
 
249
- export const mediaUrl = v.pipe(str, v.url());
246
+ export const mediaUrl = v.pipe($, v.url());
250
247
  /**
251
248
  * so that media is automatically sorted by date
252
249
  * @see https://github.com/segmentio/ksuid
253
250
  * */
254
- export const mediaKsuid = v.pipe(str, v.nonEmpty() /** base62? */);
251
+ export const mediaKsuid = $req; // base62;
255
252
  export const mediaTypes = ["album", "article", "video"] as const;
256
253
  export const mediaType = v.picklist(mediaTypes);
257
254
  export type MediaType = v.InferOutput<typeof mediaType>;
@@ -266,10 +263,10 @@ export type MediaId = v.InferOutput<typeof mediaKsuid>;
266
263
 
267
264
  export const mediaQueryParams = v.object({
268
265
  type: v.optional(mediaType),
269
- nextPageKey: v.optional(v.pipe(str, v.base64())),
266
+ nextPageKey: v.optional(v.pipe($, v.base64())),
270
267
  featured: v.optional(
271
268
  v.pipe(
272
- str,
269
+ $,
273
270
  v.transform((x) => Boolean(x)),
274
271
  v.boolean()
275
272
  )
@@ -278,9 +275,7 @@ export const mediaQueryParams = v.object({
278
275
  v.pipe(
279
276
  v.string(),
280
277
  v.transform((x) => +x),
281
- v.number(),
282
- v.integer(),
283
- v.minValue(1)
278
+ int_gte1
284
279
  )
285
280
  ),
286
281
  });