@better-giving/endowment 6.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/db.d.mts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { Db, type TxItems, type TxType, type UpdateComps } from "@better-giving/db";
2
- import type { IMedia, IMediaPage, INpoReferredBy, INpoWithRegNum, INpoWithRid, TBinFlag, TNpoDbKeys, TNpoDbProjectedTo } from "./interfaces.mjs";
2
+ import type { IMedia, IMediaPage, INpoReferredBy, INpoWithKeyword, INpoWithRegNum, INpoWithRid, TBinFlag, TNpoDbKeys, TNpoDbProjectedTo } from "./interfaces.mjs";
3
3
  import type { IMediaSearchObj, IMediaUpdate, IMilestone, IMilestoneNew, IMilestoneUpdate, INpo, INpoUpdate, IProgram, IProgramDb, IProgramNew, IProgramUpdate, TMediaType } from "./schema.mjs";
4
4
  export declare class NpoDb extends Db {
5
5
  static readonly table = "endowments_v3";
6
6
  static readonly slug_env_gsi: "slug-env-gsi";
7
7
  static readonly regnum_env_gsi: "regnum-env-gsi";
8
+ static readonly keyword_env_gsi: "keyword-env-gsi";
8
9
  key_npo(id: number): {
9
10
  PK: string;
10
11
  SK: import("@better-giving/types/list").Environment;
@@ -25,11 +26,11 @@ export declare class NpoDb extends Db {
25
26
  PK: string;
26
27
  SK: string;
27
28
  };
28
- gsi1_npo(id: string): {
29
+ gsi1_npo_ref_by_key(id: string): {
29
30
  gsi1PK: string;
30
31
  gsi1SK: import("@better-giving/types/list").Environment;
31
32
  };
32
- gsi2_npo(id: string): {
33
+ gsi2_npo_w_rid_key(id: string): {
33
34
  gsi2PK: string;
34
35
  gsi2SK: string;
35
36
  };
@@ -42,6 +43,7 @@ export declare class NpoDb extends Db {
42
43
  npo_media(npo: number, opts: IMediaSearchObj): Promise<IMediaPage>;
43
44
  npo_referred_by(id: string): Promise<INpoReferredBy[]>;
44
45
  npo_with_rid(id: string): Promise<INpoWithRid | undefined>;
46
+ npo_with_keyword(keyword: string, env?: import("@better-giving/types/list").Environment): Promise<INpoWithKeyword | undefined>;
45
47
  npo_with_regnum(regnum: string, country?: string): Promise<INpoWithRegNum | undefined>;
46
48
  npo_record(data: INpo): {
47
49
  gsi2PK?: string | undefined;
@@ -51,6 +53,7 @@ export declare class NpoDb extends Db {
51
53
  id: number;
52
54
  env: "staging" | "production";
53
55
  slug?: string | undefined;
56
+ keyword?: string | undefined;
54
57
  registration_number: string;
55
58
  name: string;
56
59
  endow_designation: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other";
@@ -72,7 +75,7 @@ export declare class NpoDb extends Db {
72
75
  tiktok?: string | undefined;
73
76
  };
74
77
  url?: string | undefined;
75
- sdgs: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[];
78
+ sdgs: (2 | 1 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[];
76
79
  receiptMsg?: string | undefined;
77
80
  hide_bg_tip?: boolean | undefined;
78
81
  published?: boolean | undefined;
package/dist/db.mjs CHANGED
@@ -9,6 +9,7 @@ export class NpoDb extends Db {
9
9
  static table = "endowments_v3";
10
10
  static slug_env_gsi = "slug-env-gsi";
11
11
  static regnum_env_gsi = "regnum-env-gsi";
12
+ static keyword_env_gsi = "keyword-env-gsi";
12
13
  key_npo(id) {
13
14
  return {
14
15
  PK: `Endow#${id}`,
@@ -39,13 +40,13 @@ export class NpoDb extends Db {
39
40
  SK: `Media#${ksuid}`,
40
41
  };
41
42
  }
42
- gsi1_npo(id) {
43
+ gsi1_npo_ref_by_key(id) {
43
44
  return {
44
45
  gsi1PK: `ReferredBy#${id}`,
45
46
  gsi1SK: this.env,
46
47
  };
47
48
  }
48
- gsi2_npo(id) {
49
+ gsi2_npo_w_rid_key(id) {
49
50
  return {
50
51
  gsi2PK: `Rid#${id}`,
51
52
  gsi2SK: `Rid#${id}`,
@@ -109,7 +110,7 @@ export class NpoDb extends Db {
109
110
  IndexName: "gsi1",
110
111
  KeyConditionExpression: "#pk = :pk",
111
112
  ExpressionAttributeValues: {
112
- ":pk": this.gsi1_npo(id).gsi1PK,
113
+ ":pk": this.gsi1_npo_ref_by_key(id).gsi1PK,
113
114
  },
114
115
  ExpressionAttributeNames: { "#pk": "gsi1PK" },
115
116
  });
@@ -122,7 +123,26 @@ export class NpoDb extends Db {
122
123
  IndexName: "gsi2",
123
124
  KeyConditionExpression: "gsi2PK = :pk",
124
125
  ExpressionAttributeValues: {
125
- ":pk": this.gsi2_npo(id).gsi2PK,
126
+ ":pk": this.gsi2_npo_w_rid_key(id).gsi2PK,
127
+ },
128
+ Limit: 1,
129
+ });
130
+ const { Items = [] } = await this.client.send(cmd);
131
+ const i = Items[0];
132
+ return i && this.sans_keys(i);
133
+ }
134
+ async npo_with_keyword(keyword, env = this.env) {
135
+ const cmd = new QueryCommand({
136
+ TableName: NpoDb.table,
137
+ IndexName: NpoDb.keyword_env_gsi,
138
+ KeyConditionExpression: "#kw = :kw AND #env = :env",
139
+ ExpressionAttributeNames: {
140
+ "#kw": "keyword",
141
+ "#env": "env",
142
+ },
143
+ ExpressionAttributeValues: {
144
+ ":kw": keyword,
145
+ ":env": env,
126
146
  },
127
147
  Limit: 1,
128
148
  });
@@ -156,8 +176,8 @@ export class NpoDb extends Db {
156
176
  return {
157
177
  ...this.key_npo(data.id),
158
178
  ...data,
159
- ...(data.referrer ? this.gsi1_npo(data.referrer) : {}),
160
- ...(data.referral_id ? this.gsi2_npo(data.referral_id) : {}),
179
+ ...(data.referrer ? this.gsi1_npo_ref_by_key(data.referrer) : {}),
180
+ ...(data.referral_id ? this.gsi2_npo_w_rid_key(data.referral_id) : {}),
161
181
  };
162
182
  }
163
183
  npo_prog_record(npo, data) {
@@ -0,0 +1,7 @@
1
+ import type { TId } from "./interfaces.mjs";
2
+ export declare const is_id: (id: TId) => id is {
3
+ id: number | string;
4
+ };
5
+ export declare const is_slug: (id: TId) => id is {
6
+ slug: string;
7
+ };
@@ -0,0 +1,6 @@
1
+ export const is_id = (id) => {
2
+ return "id" in id;
3
+ };
4
+ export const is_slug = (id) => {
5
+ return "slug" in id;
6
+ };
@@ -18,6 +18,8 @@ export interface INpoReferredBy extends Ensure<INpo, "referrer" | "referrer_expi
18
18
  }
19
19
  export interface INpoWithRid extends Ensure<INpo, "referral_id"> {
20
20
  }
21
+ export interface INpoWithKeyword extends Ensure<INpo, "keyword"> {
22
+ }
21
23
  export interface INpoWithRegNum extends Pick<INpo, "registration_number" | "env" | "claimed" | "name" | "hq_country" | "id"> {
22
24
  }
23
25
  export interface IMedia extends Required<IMediaUpdate> {
package/dist/npo.mjs CHANGED
@@ -18,6 +18,7 @@ export const npo_fields = {
18
18
  tagline: "",
19
19
  url: "",
20
20
  slug: "",
21
+ keyword: "",
21
22
  claimed: "",
22
23
  card_img: "",
23
24
  progDonationsAllowed: "",
package/dist/schema.d.mts CHANGED
@@ -1,6 +1,8 @@
1
1
  export { $, $req, $req_num_gt0, donate_method_id, env, https_url, int_gte1, $int_gte1, org_designation, slug, unsdg_num, } from "@better-giving/schemas";
2
2
  import * as v from "valibot";
3
3
  export declare const min_payout_amount = 50;
4
+ /** used for text to give */
5
+ export declare const keyword: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">, v.ToLowerCaseAction, v.MaxLengthAction<string, 10, ({ requirement: r }: v.MaxLengthIssue<string, 10>) => string>, v.RegexAction<string, "must be letters only">]>;
4
6
  export declare const csv: v.LazySchema<v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]> | v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.RegexAction<string, "invalid csv">]>>;
5
7
  export declare const csv_strs: v.SchemaWithPipe<readonly [v.LazySchema<v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]> | v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.RegexAction<string, "invalid csv">]>>, v.TransformAction<string, string[]>, v.FilterItemsAction<string[]>]>;
6
8
  export declare const allocation: v.SchemaWithPipe<readonly [v.ObjectSchema<{
@@ -33,6 +35,7 @@ export declare const npo: v.ObjectSchema<{
33
35
  readonly id: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
34
36
  readonly env: v.PicklistSchema<readonly ["staging", "production"], undefined>;
35
37
  readonly slug: v.OptionalSchema<v.LazySchema<v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]> | v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.MaxLengthAction<string, 30, ({ requirement: r }: import("valibot").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">]>>, undefined>;
38
+ readonly keyword: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">, v.ToLowerCaseAction, v.MaxLengthAction<string, 10, ({ requirement: r }: v.MaxLengthIssue<string, 10>) => string>, v.RegexAction<string, "must be letters only">]>, undefined>;
36
39
  readonly registration_number: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">, v.RegexAction<string, "must only contain letters and numbers">]>;
37
40
  readonly name: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">]>;
38
41
  readonly endow_designation: v.PicklistSchema<readonly ["Charity", "Religious Organization", "University", "Hospital", "Other"], "required">;
@@ -55,7 +58,7 @@ export declare const npo: v.ObjectSchema<{
55
58
  }, undefined>;
56
59
  /** website */
57
60
  readonly url: v.OptionalSchema<v.LazySchema<v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]> | v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">]> | v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.TransformAction<string, string>, v.UrlAction<string, "invalid url">]>>, undefined>;
58
- readonly sdgs: v.SchemaWithPipe<readonly [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>]>;
61
+ readonly sdgs: v.SchemaWithPipe<readonly [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 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1, undefined>]>;
59
62
  readonly receiptMsg: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.MaxLengthAction<string, 500, undefined>]>, undefined>;
60
63
  readonly hide_bg_tip: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
61
64
  readonly published: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
@@ -98,6 +101,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
98
101
  readonly id: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
99
102
  readonly env: v.PicklistSchema<readonly ["staging", "production"], undefined>;
100
103
  readonly slug: v.OptionalSchema<v.LazySchema<v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]> | v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.MaxLengthAction<string, 30, ({ requirement: r }: import("valibot").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">]>>, undefined>;
104
+ readonly keyword: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">, v.ToLowerCaseAction, v.MaxLengthAction<string, 10, ({ requirement: r }: v.MaxLengthIssue<string, 10>) => string>, v.RegexAction<string, "must be letters only">]>, undefined>;
101
105
  readonly registration_number: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">, v.RegexAction<string, "must only contain letters and numbers">]>;
102
106
  readonly name: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">]>;
103
107
  readonly endow_designation: v.PicklistSchema<readonly ["Charity", "Religious Organization", "University", "Hospital", "Other"], "required">;
@@ -120,7 +124,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
120
124
  }, undefined>;
121
125
  /** website */
122
126
  readonly url: v.OptionalSchema<v.LazySchema<v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]> | v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">]> | v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.TransformAction<string, string>, v.UrlAction<string, "invalid url">]>>, undefined>;
123
- readonly sdgs: v.SchemaWithPipe<readonly [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>]>;
127
+ readonly sdgs: v.SchemaWithPipe<readonly [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 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1, undefined>]>;
124
128
  readonly receiptMsg: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.MaxLengthAction<string, 500, undefined>]>, undefined>;
125
129
  readonly hide_bg_tip: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
126
130
  readonly published: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
@@ -158,11 +162,12 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
158
162
  readonly w_form: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
159
163
  readonly payout_minimum: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 50, undefined>]>, undefined>;
160
164
  readonly donor_address_required: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
161
- }, undefined>, "~standard" | "~run" | "~types" | "entries"> & {
165
+ }, undefined>, "~types" | "~run" | "~standard" | "entries"> & {
162
166
  readonly entries: Omit<{
163
167
  readonly id: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
164
168
  readonly env: v.PicklistSchema<readonly ["staging", "production"], undefined>;
165
169
  readonly slug: v.OptionalSchema<v.LazySchema<v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]> | v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.MaxLengthAction<string, 30, ({ requirement: r }: import("valibot").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">]>>, undefined>;
170
+ readonly keyword: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">, v.ToLowerCaseAction, v.MaxLengthAction<string, 10, ({ requirement: r }: v.MaxLengthIssue<string, 10>) => string>, v.RegexAction<string, "must be letters only">]>, undefined>;
166
171
  readonly registration_number: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">, v.RegexAction<string, "must only contain letters and numbers">]>;
167
172
  readonly name: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">]>;
168
173
  readonly endow_designation: v.PicklistSchema<readonly ["Charity", "Religious Organization", "University", "Hospital", "Other"], "required">;
@@ -185,7 +190,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
185
190
  }, undefined>;
186
191
  /** website */
187
192
  readonly url: v.OptionalSchema<v.LazySchema<v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]> | v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">]> | v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.TransformAction<string, string>, v.UrlAction<string, "invalid url">]>>, undefined>;
188
- readonly sdgs: v.SchemaWithPipe<readonly [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>]>;
193
+ readonly sdgs: v.SchemaWithPipe<readonly [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 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1, undefined>]>;
189
194
  readonly receiptMsg: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.MaxLengthAction<string, 500, undefined>]>, undefined>;
190
195
  readonly hide_bg_tip: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
191
196
  readonly published: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
@@ -227,6 +232,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
227
232
  readonly "~standard": v.StandardProps<{
228
233
  url?: string | undefined;
229
234
  slug?: string | undefined;
235
+ keyword?: string | undefined;
230
236
  overview?: string | undefined;
231
237
  tagline?: string | undefined;
232
238
  image?: string | undefined;
@@ -234,7 +240,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
234
240
  card_img?: string | undefined;
235
241
  active_in_countries: string[];
236
242
  street_address?: string | undefined;
237
- sdgs: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[];
243
+ sdgs: (2 | 1 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[];
238
244
  receiptMsg?: string | undefined;
239
245
  hide_bg_tip?: boolean | undefined;
240
246
  published?: boolean | undefined;
@@ -273,6 +279,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
273
279
  }, {
274
280
  url?: string | undefined;
275
281
  slug?: string | undefined;
282
+ keyword?: string | undefined;
276
283
  overview?: string | undefined;
277
284
  tagline?: string | undefined;
278
285
  image?: string | undefined;
@@ -280,7 +287,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
280
287
  card_img?: string | undefined;
281
288
  active_in_countries: string[];
282
289
  street_address?: string | undefined;
283
- sdgs: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[];
290
+ sdgs: (2 | 1 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[];
284
291
  receiptMsg?: string | undefined;
285
292
  hide_bg_tip?: boolean | undefined;
286
293
  published?: boolean | undefined;
@@ -320,6 +327,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
320
327
  readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
321
328
  url?: string | undefined;
322
329
  slug?: string | undefined;
330
+ keyword?: string | undefined;
323
331
  overview?: string | undefined;
324
332
  tagline?: string | undefined;
325
333
  image?: string | undefined;
@@ -327,7 +335,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
327
335
  card_img?: string | undefined;
328
336
  active_in_countries: string[];
329
337
  street_address?: string | undefined;
330
- sdgs: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[];
338
+ sdgs: (2 | 1 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[];
331
339
  receiptMsg?: string | undefined;
332
340
  hide_bg_tip?: boolean | undefined;
333
341
  published?: boolean | undefined;
@@ -363,11 +371,11 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
363
371
  youtube?: string | undefined;
364
372
  tiktok?: string | undefined;
365
373
  };
366
- }, v.StringIssue | v.RegexIssue<string> | v.NumberIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 0> | v.MaxValueIssue<number, 100> | v.ObjectIssue | v.CheckIssue<{
374
+ }, v.StringIssue | v.NonEmptyIssue<string> | v.MaxLengthIssue<string, 10> | v.RegexIssue<string> | v.NumberIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 0> | v.MaxValueIssue<number, 100> | v.ObjectIssue | v.CheckIssue<{
367
375
  cash: number;
368
376
  liq: number;
369
377
  lock: number;
370
- }> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.PicklistIssue | v.CustomIssue | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.MaxLengthIssue<string, 140> | v.ArrayIssue | v.NonEmptyIssue<string[]> | v.MinLengthIssue<(2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | v.MaxLengthIssue<string, 500> | v.BooleanIssue | v.MaxLengthIssue<string, 60> | v.MaxLengthIssue<{
378
+ }> | v.UrlIssue<string> | v.PicklistIssue | v.CustomIssue | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.MaxLengthIssue<string, 140> | v.ArrayIssue | v.NonEmptyIssue<string[]> | v.MinLengthIssue<(2 | 1 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | v.MaxLengthIssue<string, 500> | v.BooleanIssue | v.MaxLengthIssue<string, 60> | v.MaxLengthIssue<{
371
379
  value: string;
372
380
  label: string;
373
381
  }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>>;
@@ -375,6 +383,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
375
383
  readonly input: {
376
384
  url?: string | undefined;
377
385
  slug?: string | undefined;
386
+ keyword?: string | undefined;
378
387
  overview?: string | undefined;
379
388
  tagline?: string | undefined;
380
389
  image?: string | undefined;
@@ -382,7 +391,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
382
391
  card_img?: string | undefined;
383
392
  active_in_countries: string[];
384
393
  street_address?: string | undefined;
385
- sdgs: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[];
394
+ sdgs: (2 | 1 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[];
386
395
  receiptMsg?: string | undefined;
387
396
  hide_bg_tip?: boolean | undefined;
388
397
  published?: boolean | undefined;
@@ -422,6 +431,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
422
431
  readonly output: {
423
432
  url?: string | undefined;
424
433
  slug?: string | undefined;
434
+ keyword?: string | undefined;
425
435
  overview?: string | undefined;
426
436
  tagline?: string | undefined;
427
437
  image?: string | undefined;
@@ -429,7 +439,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
429
439
  card_img?: string | undefined;
430
440
  active_in_countries: string[];
431
441
  street_address?: string | undefined;
432
- sdgs: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[];
442
+ sdgs: (2 | 1 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[];
433
443
  receiptMsg?: string | undefined;
434
444
  hide_bg_tip?: boolean | undefined;
435
445
  published?: boolean | undefined;
@@ -466,19 +476,20 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
466
476
  tiktok?: string | undefined;
467
477
  };
468
478
  };
469
- readonly issue: v.StringIssue | v.RegexIssue<string> | v.NumberIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 0> | v.MaxValueIssue<number, 100> | v.ObjectIssue | v.CheckIssue<{
479
+ readonly issue: v.StringIssue | v.NonEmptyIssue<string> | v.MaxLengthIssue<string, 10> | v.RegexIssue<string> | v.NumberIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 0> | v.MaxValueIssue<number, 100> | v.ObjectIssue | v.CheckIssue<{
470
480
  cash: number;
471
481
  liq: number;
472
482
  lock: number;
473
- }> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.PicklistIssue | v.CustomIssue | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.MaxLengthIssue<string, 140> | v.ArrayIssue | v.NonEmptyIssue<string[]> | v.MinLengthIssue<(2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | v.MaxLengthIssue<string, 500> | v.BooleanIssue | v.MaxLengthIssue<string, 60> | v.MaxLengthIssue<{
483
+ }> | v.UrlIssue<string> | v.PicklistIssue | v.CustomIssue | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.MaxLengthIssue<string, 140> | v.ArrayIssue | v.NonEmptyIssue<string[]> | v.MinLengthIssue<(2 | 1 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | v.MaxLengthIssue<string, 500> | v.BooleanIssue | v.MaxLengthIssue<string, 60> | v.MaxLengthIssue<{
474
484
  value: string;
475
485
  label: string;
476
486
  }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>;
477
487
  } | undefined;
478
- }, "~standard" | "~run" | "~types" | "entries"> & {
488
+ }, "~types" | "~run" | "~standard" | "entries"> & {
479
489
  readonly entries: {
480
490
  readonly url: v.OptionalSchema<v.OptionalSchema<v.LazySchema<v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]> | v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">]> | v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.TransformAction<string, string>, v.UrlAction<string, "invalid url">]>>, undefined>, undefined>;
481
491
  readonly slug: v.OptionalSchema<v.OptionalSchema<v.LazySchema<v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]> | v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.MaxLengthAction<string, 30, ({ requirement: r }: import("valibot").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">]>>, undefined>, undefined>;
492
+ readonly keyword: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">, v.ToLowerCaseAction, v.MaxLengthAction<string, 10, ({ requirement: r }: v.MaxLengthIssue<string, 10>) => string>, v.RegexAction<string, "must be letters only">]>, undefined>, undefined>;
482
493
  readonly overview: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, undefined>, undefined>;
483
494
  readonly tagline: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.MaxLengthAction<string, 140, undefined>]>, undefined>, undefined>;
484
495
  readonly image: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.UrlAction<string, undefined>]>, undefined>, undefined>;
@@ -486,7 +497,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
486
497
  readonly card_img: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.UrlAction<string, undefined>]>, undefined>, undefined>;
487
498
  readonly active_in_countries: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, undefined>, v.NonEmptyAction<string[], "required">]>, undefined>;
488
499
  readonly street_address: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, undefined>, undefined>;
489
- readonly sdgs: v.OptionalSchema<v.SchemaWithPipe<readonly [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>]>, undefined>;
500
+ readonly sdgs: v.OptionalSchema<v.SchemaWithPipe<readonly [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 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1, undefined>]>, undefined>;
490
501
  readonly receiptMsg: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.MaxLengthAction<string, 500, undefined>]>, undefined>, undefined>;
491
502
  readonly hide_bg_tip: v.OptionalSchema<v.OptionalSchema<v.BooleanSchema<undefined>, undefined>, undefined>;
492
503
  readonly published: v.OptionalSchema<v.OptionalSchema<v.BooleanSchema<undefined>, undefined>, undefined>;
@@ -536,6 +547,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
536
547
  readonly "~standard": v.StandardProps<{
537
548
  url?: string | undefined;
538
549
  slug?: string | undefined;
550
+ keyword?: string | undefined;
539
551
  overview?: string | undefined;
540
552
  tagline?: string | undefined;
541
553
  image?: string | undefined;
@@ -543,7 +555,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
543
555
  card_img?: string | undefined;
544
556
  active_in_countries?: string[] | undefined;
545
557
  street_address?: string | undefined;
546
- sdgs?: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[] | undefined;
558
+ sdgs?: (2 | 1 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[] | undefined;
547
559
  receiptMsg?: string | undefined;
548
560
  hide_bg_tip?: boolean | undefined;
549
561
  published?: boolean | undefined;
@@ -582,6 +594,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
582
594
  }, {
583
595
  url?: string | undefined;
584
596
  slug?: string | undefined;
597
+ keyword?: string | undefined;
585
598
  overview?: string | undefined;
586
599
  tagline?: string | undefined;
587
600
  image?: string | undefined;
@@ -589,7 +602,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
589
602
  card_img?: string | undefined;
590
603
  active_in_countries?: string[] | undefined;
591
604
  street_address?: string | undefined;
592
- sdgs?: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[] | undefined;
605
+ sdgs?: (2 | 1 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[] | undefined;
593
606
  receiptMsg?: string | undefined;
594
607
  hide_bg_tip?: boolean | undefined;
595
608
  published?: boolean | undefined;
@@ -629,6 +642,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
629
642
  readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
630
643
  url?: string | undefined;
631
644
  slug?: string | undefined;
645
+ keyword?: string | undefined;
632
646
  overview?: string | undefined;
633
647
  tagline?: string | undefined;
634
648
  image?: string | undefined;
@@ -636,7 +650,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
636
650
  card_img?: string | undefined;
637
651
  active_in_countries?: string[] | undefined;
638
652
  street_address?: string | undefined;
639
- sdgs?: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[] | undefined;
653
+ sdgs?: (2 | 1 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[] | undefined;
640
654
  receiptMsg?: string | undefined;
641
655
  hide_bg_tip?: boolean | undefined;
642
656
  published?: boolean | undefined;
@@ -672,11 +686,11 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
672
686
  youtube?: string | undefined;
673
687
  tiktok?: string | undefined;
674
688
  } | undefined;
675
- }, v.StringIssue | v.RegexIssue<string> | v.NumberIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 0> | v.MaxValueIssue<number, 100> | v.ObjectIssue | v.CheckIssue<{
689
+ }, v.StringIssue | v.NonEmptyIssue<string> | v.MaxLengthIssue<string, 10> | v.RegexIssue<string> | v.NumberIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 0> | v.MaxValueIssue<number, 100> | v.ObjectIssue | v.CheckIssue<{
676
690
  cash: number;
677
691
  liq: number;
678
692
  lock: number;
679
- }> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.PicklistIssue | v.CustomIssue | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.MaxLengthIssue<string, 140> | v.ArrayIssue | v.NonEmptyIssue<string[]> | v.MinLengthIssue<(2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | v.MaxLengthIssue<string, 500> | v.BooleanIssue | v.MaxLengthIssue<string, 60> | v.MaxLengthIssue<{
693
+ }> | v.UrlIssue<string> | v.PicklistIssue | v.CustomIssue | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.MaxLengthIssue<string, 140> | v.ArrayIssue | v.NonEmptyIssue<string[]> | v.MinLengthIssue<(2 | 1 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | v.MaxLengthIssue<string, 500> | v.BooleanIssue | v.MaxLengthIssue<string, 60> | v.MaxLengthIssue<{
680
694
  value: string;
681
695
  label: string;
682
696
  }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>>;
@@ -684,6 +698,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
684
698
  readonly input: {
685
699
  url?: string | undefined;
686
700
  slug?: string | undefined;
701
+ keyword?: string | undefined;
687
702
  overview?: string | undefined;
688
703
  tagline?: string | undefined;
689
704
  image?: string | undefined;
@@ -691,7 +706,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
691
706
  card_img?: string | undefined;
692
707
  active_in_countries?: string[] | undefined;
693
708
  street_address?: string | undefined;
694
- sdgs?: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[] | undefined;
709
+ sdgs?: (2 | 1 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[] | undefined;
695
710
  receiptMsg?: string | undefined;
696
711
  hide_bg_tip?: boolean | undefined;
697
712
  published?: boolean | undefined;
@@ -731,6 +746,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
731
746
  readonly output: {
732
747
  url?: string | undefined;
733
748
  slug?: string | undefined;
749
+ keyword?: string | undefined;
734
750
  overview?: string | undefined;
735
751
  tagline?: string | undefined;
736
752
  image?: string | undefined;
@@ -738,7 +754,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
738
754
  card_img?: string | undefined;
739
755
  active_in_countries?: string[] | undefined;
740
756
  street_address?: string | undefined;
741
- sdgs?: (2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[] | undefined;
757
+ sdgs?: (2 | 1 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[] | undefined;
742
758
  receiptMsg?: string | undefined;
743
759
  hide_bg_tip?: boolean | undefined;
744
760
  published?: boolean | undefined;
@@ -775,17 +791,17 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
775
791
  tiktok?: string | undefined;
776
792
  } | undefined;
777
793
  };
778
- readonly issue: v.StringIssue | v.RegexIssue<string> | v.NumberIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 0> | v.MaxValueIssue<number, 100> | v.ObjectIssue | v.CheckIssue<{
794
+ readonly issue: v.StringIssue | v.NonEmptyIssue<string> | v.MaxLengthIssue<string, 10> | v.RegexIssue<string> | v.NumberIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 0> | v.MaxValueIssue<number, 100> | v.ObjectIssue | v.CheckIssue<{
779
795
  cash: number;
780
796
  liq: number;
781
797
  lock: number;
782
- }> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.PicklistIssue | v.CustomIssue | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.MaxLengthIssue<string, 140> | v.ArrayIssue | v.NonEmptyIssue<string[]> | v.MinLengthIssue<(2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | v.MaxLengthIssue<string, 500> | v.BooleanIssue | v.MaxLengthIssue<string, 60> | v.MaxLengthIssue<{
798
+ }> | v.UrlIssue<string> | v.PicklistIssue | v.CustomIssue | v.MaxLengthIssue<string, 30> | v.ExcludesIssue<string, ".."> | v.MaxLengthIssue<string, 140> | v.ArrayIssue | v.NonEmptyIssue<string[]> | v.MinLengthIssue<(2 | 1 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | v.MaxLengthIssue<string, 500> | v.BooleanIssue | v.MaxLengthIssue<string, 60> | v.MaxLengthIssue<{
783
799
  value: string;
784
800
  label: string;
785
801
  }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>;
786
802
  } | undefined;
787
803
  };
788
- export declare const npo_fields: 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", "donor_address_required", "id", "env", "registration_number", "name", "endow_designation", "hq_country", "social_media_urls", "claimed", "kyc_donors_only", "fiscal_sponsored"], undefined>;
804
+ export declare const npo_fields: v.PicklistSchema<["url", "slug", "keyword", "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", "donor_address_required", "id", "env", "registration_number", "name", "endow_designation", "hq_country", "social_media_urls", "claimed", "kyc_donors_only", "fiscal_sponsored"], undefined>;
789
805
  export interface INpo extends v.InferOutput<typeof npo> {
790
806
  }
791
807
  export interface INpoUpdate extends v.InferOutput<typeof npo_update> {
@@ -793,7 +809,7 @@ export interface INpoUpdate extends v.InferOutput<typeof npo_update> {
793
809
  export type INpoFields = v.InferOutput<typeof npo_fields>;
794
810
  /** for ein path, only fields in reg-num/env gsi is available */
795
811
  export declare const npo_search: v.ObjectSchema<{
796
- readonly fields: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.LazySchema<v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]> | v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, 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", "donor_address_required", "id", "env", "registration_number", "name", "endow_designation", "hq_country", "social_media_urls", "claimed", "kyc_donors_only", "fiscal_sponsored"], undefined>, undefined>]>, undefined>;
812
+ readonly fields: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.LazySchema<v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]> | v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.RegexAction<string, "invalid csv">]>>, v.TransformAction<string, string[]>, v.FilterItemsAction<string[]>]>, v.ArraySchema<v.PicklistSchema<["url", "slug", "keyword", "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", "donor_address_required", "id", "env", "registration_number", "name", "endow_designation", "hq_country", "social_media_urls", "claimed", "kyc_donors_only", "fiscal_sponsored"], undefined>, undefined>]>, undefined>;
797
813
  }, undefined>;
798
814
  export interface INposSearch extends v.InferInput<typeof npo_search> {
799
815
  }
@@ -810,7 +826,7 @@ export declare const milestone_update: Omit<v.ObjectSchema<{
810
826
  readonly title: v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>;
811
827
  readonly description: v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>;
812
828
  readonly media: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.UrlAction<string, undefined>]>, undefined>;
813
- }, undefined>, "~standard" | "~run" | "~types" | "entries"> & {
829
+ }, undefined>, "~types" | "~run" | "~standard" | "entries"> & {
814
830
  readonly entries: {
815
831
  readonly date: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.IsoTimestampAction<string, undefined>]>, undefined>;
816
832
  readonly title: v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>;
@@ -907,7 +923,7 @@ export declare const program_update: Omit<Omit<v.ObjectSchema<{
907
923
  description: string;
908
924
  media?: string | undefined;
909
925
  }[], 24, undefined>]>;
910
- }, undefined>, "~standard" | "~run" | "~types" | "entries"> & {
926
+ }, undefined>, "~types" | "~run" | "~standard" | "entries"> & {
911
927
  readonly entries: Omit<{
912
928
  readonly title: v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>;
913
929
  readonly description: v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>;
@@ -958,7 +974,7 @@ export declare const program_update: Omit<Omit<v.ObjectSchema<{
958
974
  };
959
975
  readonly issue: v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.ObjectIssue | v.UrlIssue<string>;
960
976
  } | undefined;
961
- }, "~standard" | "~run" | "~types" | "entries"> & {
977
+ }, "~types" | "~run" | "~standard" | "entries"> & {
962
978
  readonly entries: {
963
979
  readonly title: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, undefined>;
964
980
  readonly description: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, undefined>;
@@ -1039,7 +1055,7 @@ export declare const npo_item: v.ObjectSchema<{
1039
1055
  readonly tagline: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.MaxLengthAction<string, 140, undefined>]>, undefined>;
1040
1056
  readonly card_img: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, v.UrlAction<string, undefined>]>, undefined>;
1041
1057
  readonly active_in_countries: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<"required">, v.TrimAction]>, undefined>, v.NonEmptyAction<string[], "required">]>;
1042
- readonly sdgs: v.SchemaWithPipe<readonly [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>]>;
1058
+ readonly sdgs: v.SchemaWithPipe<readonly [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 | 10 | 5 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1, undefined>]>;
1043
1059
  readonly published: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
1044
1060
  readonly fund_opt_in: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
1045
1061
  readonly target: v.OptionalSchema<v.UnionSchema<[v.LiteralSchema<"smart", undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, string>]>], undefined>, undefined>;
package/dist/schema.mjs CHANGED
@@ -2,6 +2,8 @@ import { $, $int_gte1, $req, MAX_NUM_INCREMENTS, donate_method_id, env, https_ur
2
2
  export { $, $req, $req_num_gt0, donate_method_id, env, https_url, int_gte1, $int_gte1, org_designation, slug, unsdg_num, } from "@better-giving/schemas";
3
3
  import * as v from "valibot";
4
4
  export const min_payout_amount = 50;
5
+ /** used for text to give */
6
+ export const keyword = v.pipe($, v.nonEmpty("required"), v.toLowerCase(), v.maxLength(10, ({ requirement: r }) => `max ${r} characters`), v.regex(/^[a-z]+$/, "must be letters only"));
5
7
  export const csv = v.lazy((x) => {
6
8
  if (!x)
7
9
  return $;
@@ -31,6 +33,7 @@ export const npo = v.object({
31
33
  id: int_gte1,
32
34
  env,
33
35
  slug: v.optional(slug),
36
+ keyword: v.optional(keyword),
34
37
  registration_number: reg_number,
35
38
  name: $req,
36
39
  endow_designation: org_designation,
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@better-giving/endowment",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "dependencies": {
5
5
  "ksuid": "3.0.0"
6
6
  },
7
7
  "peerDependencies": {
8
- "@better-giving/schemas": "2.2.0",
9
- "@better-giving/types": "1.1.8",
10
- "@better-giving/db": "2.1.0",
11
- "@aws-sdk/lib-dynamodb": "3.957.0",
12
- "valibot": "1.2.0"
8
+ "@better-giving/schemas": "^2.0.0",
9
+ "@better-giving/types": "^1.0.0",
10
+ "@better-giving/db": "^2.0.0",
11
+ "@aws-sdk/lib-dynamodb": "^3.900.0",
12
+ "valibot": "^1.0.0"
13
13
  },
14
14
  "devDependencies": {
15
- "@better-giving/config": "1.1.2"
15
+ "@better-giving/config": "^1.0.0"
16
16
  },
17
17
  "files": [
18
18
  "src",
package/src/db.mts CHANGED
@@ -23,6 +23,7 @@ import type {
23
23
  IMediaDb,
24
24
  IMediaPage,
25
25
  INpoReferredBy,
26
+ INpoWithKeyword,
26
27
  INpoWithRegNum,
27
28
  INpoWithRid,
28
29
  TBinFlag,
@@ -50,6 +51,7 @@ export class NpoDb extends Db {
50
51
  static readonly table = "endowments_v3";
51
52
  static readonly slug_env_gsi = "slug-env-gsi" as const;
52
53
  static readonly regnum_env_gsi = "regnum-env-gsi" as const;
54
+ static readonly keyword_env_gsi = "keyword-env-gsi" as const;
53
55
  key_npo(id: number) {
54
56
  return {
55
57
  PK: `Endow#${id}`,
@@ -83,14 +85,14 @@ export class NpoDb extends Db {
83
85
  };
84
86
  }
85
87
 
86
- gsi1_npo(id: string) {
88
+ gsi1_npo_ref_by_key(id: string) {
87
89
  return {
88
90
  gsi1PK: `ReferredBy#${id}`,
89
91
  gsi1SK: this.env,
90
92
  };
91
93
  }
92
94
 
93
- gsi2_npo(id: string) {
95
+ gsi2_npo_w_rid_key(id: string) {
94
96
  return {
95
97
  gsi2PK: `Rid#${id}`,
96
98
  gsi2SK: `Rid#${id}`,
@@ -164,7 +166,7 @@ export class NpoDb extends Db {
164
166
  IndexName: "gsi1",
165
167
  KeyConditionExpression: "#pk = :pk",
166
168
  ExpressionAttributeValues: {
167
- ":pk": this.gsi1_npo(id).gsi1PK,
169
+ ":pk": this.gsi1_npo_ref_by_key(id).gsi1PK,
168
170
  },
169
171
  ExpressionAttributeNames: { "#pk": "gsi1PK" },
170
172
  });
@@ -178,7 +180,7 @@ export class NpoDb extends Db {
178
180
  IndexName: "gsi2",
179
181
  KeyConditionExpression: "gsi2PK = :pk",
180
182
  ExpressionAttributeValues: {
181
- ":pk": this.gsi2_npo(id).gsi2PK,
183
+ ":pk": this.gsi2_npo_w_rid_key(id).gsi2PK,
182
184
  },
183
185
  Limit: 1,
184
186
  });
@@ -186,6 +188,29 @@ export class NpoDb extends Db {
186
188
  const i = Items[0];
187
189
  return i && this.sans_keys(i);
188
190
  }
191
+ async npo_with_keyword(
192
+ keyword: string,
193
+ env = this.env
194
+ ): Promise<INpoWithKeyword | undefined> {
195
+ const cmd = new QueryCommand({
196
+ TableName: NpoDb.table,
197
+ IndexName: NpoDb.keyword_env_gsi,
198
+ KeyConditionExpression: "#kw = :kw AND #env = :env",
199
+ ExpressionAttributeNames: {
200
+ "#kw": "keyword" satisfies TNpoDbKeys,
201
+ "#env": "env" satisfies TNpoDbKeys,
202
+ },
203
+ ExpressionAttributeValues: {
204
+ ":kw": keyword,
205
+ ":env": env,
206
+ },
207
+ Limit: 1,
208
+ });
209
+
210
+ const { Items = [] } = await this.client.send(cmd);
211
+ const i = Items[0];
212
+ return i && this.sans_keys(i);
213
+ }
189
214
 
190
215
  async npo_with_regnum(
191
216
  regnum: string,
@@ -219,8 +244,8 @@ export class NpoDb extends Db {
219
244
  return {
220
245
  ...this.key_npo(data.id),
221
246
  ...data,
222
- ...(data.referrer ? this.gsi1_npo(data.referrer) : {}),
223
- ...(data.referral_id ? this.gsi2_npo(data.referral_id) : {}),
247
+ ...(data.referrer ? this.gsi1_npo_ref_by_key(data.referrer) : {}),
248
+ ...(data.referral_id ? this.gsi2_npo_w_rid_key(data.referral_id) : {}),
224
249
  };
225
250
  }
226
251
 
@@ -27,6 +27,7 @@ export interface INpoReferredBy
27
27
  extends Ensure<INpo, "referrer" | "referrer_expiry"> {}
28
28
 
29
29
  export interface INpoWithRid extends Ensure<INpo, "referral_id"> {}
30
+ export interface INpoWithKeyword extends Ensure<INpo, "keyword"> {}
30
31
 
31
32
  export interface INpoWithRegNum
32
33
  extends Pick<
package/src/npo.mts CHANGED
@@ -20,6 +20,7 @@ export const npo_fields: { [K in keyof Required<INpo>]: "" } = {
20
20
  tagline: "",
21
21
  url: "",
22
22
  slug: "",
23
+ keyword: "",
23
24
  claimed: "",
24
25
  card_img: "",
25
26
  progDonationsAllowed: "",
package/src/schema.mts CHANGED
@@ -30,6 +30,15 @@ import * as v from "valibot";
30
30
 
31
31
  export const min_payout_amount = 50;
32
32
 
33
+ /** used for text to give */
34
+ export const keyword = v.pipe(
35
+ $,
36
+ v.nonEmpty("required"),
37
+ v.toLowerCase(),
38
+ v.maxLength(10, ({ requirement: r }) => `max ${r} characters`),
39
+ v.regex(/^[a-z]+$/, "must be letters only")
40
+ );
41
+
33
42
  export const csv = v.lazy((x) => {
34
43
  if (!x) return $;
35
44
  return v.pipe($, v.regex(/^[^,]+(?:,[^,]+)*$/, "invalid csv"));
@@ -80,6 +89,7 @@ export const npo = v.object({
80
89
  id: int_gte1,
81
90
  env,
82
91
  slug: v.optional(slug),
92
+ keyword: v.optional(keyword),
83
93
  registration_number: reg_number,
84
94
  name: $req,
85
95
  endow_designation: org_designation,