@better-giving/endowment 1.0.28 → 1.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,7 @@ export declare const cloudsearchEndow: import("valibot").ObjectSchema<{
16
16
  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
17
  readonly published: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, never>;
18
18
  readonly fund_opt_in: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, never>;
19
+ readonly target: import("valibot").OptionalSchema<import("valibot").UnionSchema<[import("valibot").LiteralSchema<"smart", undefined>, import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TransformAction<string, number>, import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").TransformAction<number, string>]>], undefined>, never>;
19
20
  readonly id: import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>]>;
20
21
  readonly env: import("valibot").PicklistSchema<readonly ["staging", "production"], undefined>;
21
22
  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">]>;
@@ -23,7 +24,7 @@ export declare const cloudsearchEndow: import("valibot").ObjectSchema<{
23
24
  readonly claimed: import("valibot").BooleanSchema<undefined>;
24
25
  readonly kyc_donors_only: import("valibot").BooleanSchema<undefined>;
25
26
  }, undefined>;
26
- export declare const cloudSearchEndowFields: import("valibot").PicklistSchema<["name", "tagline", "card_img", "hq_country", "active_in_countries", "sdgs", "published", "fund_opt_in", "id", "env", "registration_number", "endow_designation", "claimed", "kyc_donors_only", "contributions_total", "contributions_count"], 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
28
  export declare const endowsQueryParams: import("valibot").ObjectSchema<{
28
29
  readonly query: import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TrimAction]>;
29
30
  readonly page: import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TransformAction<string, number>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>]>;
@@ -33,13 +34,17 @@ export declare const endowsQueryParams: import("valibot").ObjectSchema<{
33
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>;
34
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>;
35
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>;
36
- 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", "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<["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
38
  }, undefined>;
39
+ export interface CloudsearchEndowsQueryParamsObj extends InferInput<typeof endowsQueryParams> {
40
+ }
38
41
  export interface CloudsearchEndowsQueryParams extends InferInput<typeof endowsQueryParams> {
39
42
  }
43
+ export interface CloudsearchEndowsQueryParamsParsed extends InferOutput<typeof endowsQueryParams> {
44
+ }
40
45
  export interface CloudsearchEndow extends InferOutput<typeof cloudsearchEndow> {
41
46
  }
42
- type DocId = `${Environment}-${number}`;
47
+ export type DocId = `${Environment}-${number}`;
43
48
  interface Doc extends ToDoc<CloudsearchEndow> {
44
49
  documentId: DocId;
45
50
  _score: number;
@@ -23,6 +23,7 @@ export const cloudsearchEndow = object({
23
23
  "id",
24
24
  "published",
25
25
  "fund_opt_in",
26
+ "target",
26
27
  ]).entries,
27
28
  ...cloudsearchEndowFields.entries,
28
29
  });
package/dist/db.d.mts CHANGED
@@ -95,3 +95,4 @@ export declare namespace Media {
95
95
  }
96
96
  }
97
97
  }
98
+ export type DbRecord = Endow.DbRecord | Program.DbRecord;
package/dist/index.d.mts CHANGED
@@ -2,7 +2,7 @@ import type { CloudsearchEndow as EndowItem } from "./cloudsearch.mjs";
2
2
  import type { Media } from "./db.mjs";
3
3
  import type { Milestone, Program as ProgramShape } from "./schema.mjs";
4
4
  export type { Allocation, DonateMethodId, EndowDesignation, Endowment as Endow, EndowFields, EndowQueryParams, EndowUpdate, Environment, Increment, MediaQueryParams, MediaQueryParamsObj, MediaType, MediaUpdate, Milestone, MilestoneUpdate, NewMilestone, NewProgram, ProgramUpdate, SocialMediaURLs, UnSdgNum, } from "./schema.mjs";
5
- export type { CloudsearchEndow as EndowItem, CloudsearchEndowsQueryParams as EndowsQueryParams, } from "./cloudsearch.mjs";
5
+ export type { CloudsearchEndow as EndowItem, CloudsearchEndowsQueryParams as EndowsQueryParams, CloudsearchEndowsQueryParamsParsed as EndowsQueryParamsParsed, } from "./cloudsearch.mjs";
6
6
  /** client responsible on T depending on keys projected */
7
7
  export interface EndowsPage<T extends keyof EndowItem = keyof EndowItem> {
8
8
  items: Pick<EndowItem, T>[];
package/dist/schema.d.mts CHANGED
@@ -102,6 +102,7 @@ export declare const endowment: import("valibot").ObjectSchema<{
102
102
  label: string;
103
103
  }[], 4, undefined>]>, never>;
104
104
  readonly fund_opt_in: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, never>;
105
+ readonly target: import("valibot").OptionalSchema<import("valibot").UnionSchema<[import("valibot").LiteralSchema<"smart", undefined>, import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TransformAction<string, number>, import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").TransformAction<number, string>]>], undefined>, never>;
105
106
  /** endowment is not claimed if `false` only */
106
107
  readonly claimed: import("valibot").BooleanSchema<undefined>;
107
108
  readonly kyc_donors_only: import("valibot").BooleanSchema<undefined>;
@@ -157,6 +158,7 @@ export declare const endowUpdate: Omit<Omit<import("valibot").ObjectSchema<{
157
158
  label: string;
158
159
  }[], 4, undefined>]>, never>;
159
160
  readonly fund_opt_in: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, never>;
161
+ readonly target: import("valibot").OptionalSchema<import("valibot").UnionSchema<[import("valibot").LiteralSchema<"smart", undefined>, import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TransformAction<string, number>, import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").TransformAction<number, string>]>], undefined>, never>;
160
162
  /** endowment is not claimed if `false` only */
161
163
  readonly claimed: import("valibot").BooleanSchema<undefined>;
162
164
  readonly kyc_donors_only: import("valibot").BooleanSchema<undefined>;
@@ -212,6 +214,7 @@ export declare const endowUpdate: Omit<Omit<import("valibot").ObjectSchema<{
212
214
  label: string;
213
215
  }[], 4, undefined>]>, never>;
214
216
  readonly fund_opt_in: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, never>;
217
+ readonly target: import("valibot").OptionalSchema<import("valibot").UnionSchema<[import("valibot").LiteralSchema<"smart", undefined>, import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TransformAction<string, number>, import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").TransformAction<number, string>]>], undefined>, never>;
215
218
  /** endowment is not claimed if `false` only */
216
219
  readonly claimed: import("valibot").BooleanSchema<undefined>;
217
220
  readonly kyc_donors_only: import("valibot").BooleanSchema<undefined>;
@@ -224,7 +227,7 @@ export declare const endowUpdate: Omit<Omit<import("valibot").ObjectSchema<{
224
227
  }> | import("valibot").MaxLengthIssue<string, 30> | import("valibot").ExcludesIssue<string, ".."> | import("valibot").CustomIssue | import("valibot").NonEmptyIssue<string> | import("valibot").PicklistIssue | import("valibot").UrlIssue<string> | import("valibot").StartsWithIssue<string, "https://"> | import("valibot").MaxLengthIssue<string, 140> | import("valibot").ArrayIssue | import("valibot").NonEmptyIssue<string[]> | import("valibot").MinLengthIssue<(2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | import("valibot").MaxLengthIssue<string, 500> | import("valibot").BooleanIssue | import("valibot").MaxLengthIssue<{
225
228
  value: string;
226
229
  label: string;
227
- }[], 4>>): import("valibot").Dataset<{
230
+ }[], 4> | import("valibot").LiteralIssue | import("valibot").UnionIssue<import("valibot").StringIssue | import("valibot").NumberIssue | import("valibot").MinValueIssue<number, 0> | import("valibot").LiteralIssue>>): import("valibot").Dataset<{
228
231
  name: string;
229
232
  hq_country: string;
230
233
  active_in_countries: string[];
@@ -263,6 +266,7 @@ export declare const endowUpdate: Omit<Omit<import("valibot").ObjectSchema<{
263
266
  label: string;
264
267
  }[] | undefined;
265
268
  fund_opt_in?: boolean | undefined;
269
+ target?: string | undefined;
266
270
  }, import("valibot").StringIssue | import("valibot").RegexIssue<string> | import("valibot").NumberIssue | import("valibot").IntegerIssue<number> | import("valibot").MinValueIssue<number, 0> | import("valibot").MaxValueIssue<number, 100> | import("valibot").ObjectIssue | import("valibot").CheckIssue<{
267
271
  cash: number;
268
272
  liq: number;
@@ -270,7 +274,7 @@ export declare const endowUpdate: Omit<Omit<import("valibot").ObjectSchema<{
270
274
  }> | import("valibot").MaxLengthIssue<string, 30> | import("valibot").ExcludesIssue<string, ".."> | import("valibot").CustomIssue | import("valibot").NonEmptyIssue<string> | import("valibot").PicklistIssue | import("valibot").UrlIssue<string> | import("valibot").StartsWithIssue<string, "https://"> | import("valibot").MaxLengthIssue<string, 140> | import("valibot").ArrayIssue | import("valibot").NonEmptyIssue<string[]> | import("valibot").MinLengthIssue<(2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | import("valibot").MaxLengthIssue<string, 500> | import("valibot").BooleanIssue | import("valibot").MaxLengthIssue<{
271
275
  value: string;
272
276
  label: string;
273
- }[], 4>>;
277
+ }[], 4> | import("valibot").LiteralIssue | import("valibot").UnionIssue<import("valibot").StringIssue | import("valibot").NumberIssue | import("valibot").MinValueIssue<number, 0> | import("valibot").LiteralIssue>>;
274
278
  readonly _types?: {
275
279
  readonly input: {
276
280
  name: string;
@@ -311,6 +315,7 @@ export declare const endowUpdate: Omit<Omit<import("valibot").ObjectSchema<{
311
315
  label: string;
312
316
  }[] | undefined;
313
317
  fund_opt_in?: boolean | undefined;
318
+ target?: string | undefined;
314
319
  };
315
320
  readonly output: {
316
321
  name: string;
@@ -351,6 +356,7 @@ export declare const endowUpdate: Omit<Omit<import("valibot").ObjectSchema<{
351
356
  label: string;
352
357
  }[] | undefined;
353
358
  fund_opt_in?: boolean | undefined;
359
+ target?: string | undefined;
354
360
  };
355
361
  readonly issue: import("valibot").StringIssue | import("valibot").RegexIssue<string> | import("valibot").NumberIssue | import("valibot").IntegerIssue<number> | import("valibot").MinValueIssue<number, 0> | import("valibot").MaxValueIssue<number, 100> | import("valibot").ObjectIssue | import("valibot").CheckIssue<{
356
362
  cash: number;
@@ -359,7 +365,7 @@ export declare const endowUpdate: Omit<Omit<import("valibot").ObjectSchema<{
359
365
  }> | import("valibot").MaxLengthIssue<string, 30> | import("valibot").ExcludesIssue<string, ".."> | import("valibot").CustomIssue | import("valibot").NonEmptyIssue<string> | import("valibot").PicklistIssue | import("valibot").UrlIssue<string> | import("valibot").StartsWithIssue<string, "https://"> | import("valibot").MaxLengthIssue<string, 140> | import("valibot").ArrayIssue | import("valibot").NonEmptyIssue<string[]> | import("valibot").MinLengthIssue<(2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | import("valibot").MaxLengthIssue<string, 500> | import("valibot").BooleanIssue | import("valibot").MaxLengthIssue<{
360
366
  value: string;
361
367
  label: string;
362
- }[], 4>;
368
+ }[], 4> | import("valibot").LiteralIssue | import("valibot").UnionIssue<import("valibot").StringIssue | import("valibot").NumberIssue | import("valibot").MinValueIssue<number, 0> | import("valibot").LiteralIssue>;
363
369
  } | undefined;
364
370
  }, "_types" | "_run" | "entries"> & {
365
371
  readonly entries: {
@@ -397,6 +403,7 @@ export declare const endowUpdate: Omit<Omit<import("valibot").ObjectSchema<{
397
403
  label: string;
398
404
  }[], 4, undefined>]>, never>, never>;
399
405
  readonly fund_opt_in: import("valibot").OptionalSchema<import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, never>, never>;
406
+ readonly target: import("valibot").OptionalSchema<import("valibot").OptionalSchema<import("valibot").UnionSchema<[import("valibot").LiteralSchema<"smart", undefined>, import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").TransformAction<string, number>, import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, undefined>, import("valibot").TransformAction<number, string>]>], undefined>, never>, never>;
400
407
  readonly registration_number: import("valibot").OptionalSchema<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">]>, never>;
401
408
  readonly endow_designation: import("valibot").OptionalSchema<import("valibot").PicklistSchema<readonly ["Charity", "Religious Organization", "University", "Hospital", "Other"], undefined>, never>;
402
409
  readonly social_media_urls: import("valibot").OptionalSchema<import("valibot").ObjectSchema<{
@@ -416,7 +423,7 @@ export declare const endowUpdate: Omit<Omit<import("valibot").ObjectSchema<{
416
423
  }> | import("valibot").MaxLengthIssue<string, 30> | import("valibot").ExcludesIssue<string, ".."> | import("valibot").CustomIssue | import("valibot").NonEmptyIssue<string> | import("valibot").PicklistIssue | import("valibot").UrlIssue<string> | import("valibot").StartsWithIssue<string, "https://"> | import("valibot").MaxLengthIssue<string, 140> | import("valibot").ArrayIssue | import("valibot").NonEmptyIssue<string[]> | import("valibot").MinLengthIssue<(2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | import("valibot").MaxLengthIssue<string, 500> | import("valibot").BooleanIssue | import("valibot").MaxLengthIssue<{
417
424
  value: string;
418
425
  label: string;
419
- }[], 4>>): import("valibot").Dataset<{
426
+ }[], 4> | import("valibot").LiteralIssue | import("valibot").UnionIssue<import("valibot").StringIssue | import("valibot").NumberIssue | import("valibot").MinValueIssue<number, 0> | import("valibot").LiteralIssue>>): import("valibot").Dataset<{
420
427
  url?: string | undefined;
421
428
  slug?: string | undefined;
422
429
  name?: string | undefined;
@@ -444,6 +451,7 @@ export declare const endowUpdate: Omit<Omit<import("valibot").ObjectSchema<{
444
451
  label: string;
445
452
  }[] | undefined;
446
453
  fund_opt_in?: boolean | undefined;
454
+ target?: string | undefined;
447
455
  registration_number?: string | undefined;
448
456
  endow_designation?: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other" | undefined;
449
457
  social_media_urls?: {
@@ -462,7 +470,7 @@ export declare const endowUpdate: Omit<Omit<import("valibot").ObjectSchema<{
462
470
  }> | import("valibot").MaxLengthIssue<string, 30> | import("valibot").ExcludesIssue<string, ".."> | import("valibot").CustomIssue | import("valibot").NonEmptyIssue<string> | import("valibot").PicklistIssue | import("valibot").UrlIssue<string> | import("valibot").StartsWithIssue<string, "https://"> | import("valibot").MaxLengthIssue<string, 140> | import("valibot").ArrayIssue | import("valibot").NonEmptyIssue<string[]> | import("valibot").MinLengthIssue<(2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | import("valibot").MaxLengthIssue<string, 500> | import("valibot").BooleanIssue | import("valibot").MaxLengthIssue<{
463
471
  value: string;
464
472
  label: string;
465
- }[], 4>>;
473
+ }[], 4> | import("valibot").LiteralIssue | import("valibot").UnionIssue<import("valibot").StringIssue | import("valibot").NumberIssue | import("valibot").MinValueIssue<number, 0> | import("valibot").LiteralIssue>>;
466
474
  readonly _types?: {
467
475
  readonly input: {
468
476
  url?: string | undefined;
@@ -492,6 +500,7 @@ export declare const endowUpdate: Omit<Omit<import("valibot").ObjectSchema<{
492
500
  label: string;
493
501
  }[] | undefined;
494
502
  fund_opt_in?: boolean | undefined;
503
+ target?: string | undefined;
495
504
  registration_number?: string | undefined;
496
505
  endow_designation?: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other" | undefined;
497
506
  social_media_urls?: {
@@ -532,6 +541,7 @@ export declare const endowUpdate: Omit<Omit<import("valibot").ObjectSchema<{
532
541
  label: string;
533
542
  }[] | undefined;
534
543
  fund_opt_in?: boolean | undefined;
544
+ target?: string | undefined;
535
545
  registration_number?: string | undefined;
536
546
  endow_designation?: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other" | undefined;
537
547
  social_media_urls?: {
@@ -551,10 +561,10 @@ export declare const endowUpdate: Omit<Omit<import("valibot").ObjectSchema<{
551
561
  }> | import("valibot").MaxLengthIssue<string, 30> | import("valibot").ExcludesIssue<string, ".."> | import("valibot").CustomIssue | import("valibot").NonEmptyIssue<string> | import("valibot").PicklistIssue | import("valibot").UrlIssue<string> | import("valibot").StartsWithIssue<string, "https://"> | import("valibot").MaxLengthIssue<string, 140> | import("valibot").ArrayIssue | import("valibot").NonEmptyIssue<string[]> | import("valibot").MinLengthIssue<(2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17)[], 1> | import("valibot").MaxLengthIssue<string, 500> | import("valibot").BooleanIssue | import("valibot").MaxLengthIssue<{
552
562
  value: string;
553
563
  label: string;
554
- }[], 4>;
564
+ }[], 4> | import("valibot").LiteralIssue | import("valibot").UnionIssue<import("valibot").StringIssue | import("valibot").NumberIssue | import("valibot").MinValueIssue<number, 0> | import("valibot").LiteralIssue>;
555
565
  } | undefined;
556
566
  };
557
- export declare const endowFields: import("valibot").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", "id", "env", "registration_number", "endow_designation", "social_media_urls", "claimed", "kyc_donors_only", "fiscal_sponsored"], undefined>;
567
+ export declare const endowFields: import("valibot").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", "id", "env", "registration_number", "endow_designation", "social_media_urls", "claimed", "kyc_donors_only", "fiscal_sponsored"], undefined>;
558
568
  export interface Endowment extends InferOutput<typeof endowment> {
559
569
  }
560
570
  export interface EndowUpdate extends InferOutput<typeof endowUpdate> {
@@ -562,7 +572,7 @@ export interface EndowUpdate extends InferOutput<typeof endowUpdate> {
562
572
  export type EndowFields = InferOutput<typeof endowFields>;
563
573
  /** for ein path, only fields in reg-num/env gsi is available */
564
574
  export declare const endowQueryParams: import("valibot").ObjectSchema<{
565
- 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<["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", "id", "env", "registration_number", "endow_designation", "social_media_urls", "claimed", "kyc_donors_only", "fiscal_sponsored"], undefined>, undefined>]>, never>;
575
+ 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<["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", "id", "env", "registration_number", "endow_designation", "social_media_urls", "claimed", "kyc_donors_only", "fiscal_sponsored"], undefined>, undefined>]>, never>;
566
576
  }, undefined>;
567
577
  export interface EndowQueryParams extends InferInput<typeof endowQueryParams> {
568
578
  }
package/dist/schema.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { env, orgDesignation, unSdgNum } from "@better-giving/schemas";
2
2
  export { orgDesignation as endowDesignation, env, unSdgNum };
3
- import { url, array, base64, boolean, check, custom, excludes, filterItems, integer, isoTimestamp, keyof, lazy, maxLength, maxValue, minLength, minValue, nonEmpty, nullish, number, object, omit, optional, partial, picklist, pipe, regex, startsWith, string, transform, trim, uuid, } from "valibot";
3
+ import { url, array, base64, boolean, check, custom, excludes, filterItems, integer, isoTimestamp, keyof, lazy, literal, maxLength, maxValue, minLength, minValue, nonEmpty, nullish, number, object, omit, optional, partial, picklist, pipe, regex, startsWith, string, transform, trim, union, uuid, } from "valibot";
4
4
  export const str = pipe(string(), trim());
5
5
  export const csv = lazy((x) => {
6
6
  if (!x)
@@ -83,6 +83,11 @@ export const endowment = object({
83
83
  donateMethods: optional(array(donateMethodId)),
84
84
  increments: optional(pipe(array(increment), maxLength(MAX_NUM_INCREMENTS))),
85
85
  fund_opt_in: optional(boolean()),
86
+ target: optional(union([
87
+ literal("smart"),
88
+ // "0" - none, `${number}` - fixed
89
+ pipe(string(), transform((v) => +v), number(), minValue(0), transform((v) => v.toString())),
90
+ ])),
86
91
  /** endowment is not claimed if `false` only */
87
92
  claimed: boolean(),
88
93
  kyc_donors_only: boolean(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-giving/endowment",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "peerDependencies": {
5
5
  "@better-giving/schemas": "1.0.1",
6
6
  "@better-giving/types": "1.0.1",
@@ -9,7 +9,10 @@
9
9
  "devDependencies": {
10
10
  "@better-giving/config": "workspace:*"
11
11
  },
12
- "files": ["src", "dist"],
12
+ "files": [
13
+ "src",
14
+ "dist"
15
+ ],
13
16
  "exports": {
14
17
  ".": "./dist/index.mjs",
15
18
  "./schema": "./dist/schema.mjs",
@@ -51,6 +51,7 @@ export const cloudsearchEndow = object({
51
51
  "id",
52
52
  "published",
53
53
  "fund_opt_in",
54
+ "target",
54
55
  ]).entries,
55
56
  ...cloudsearchEndowFields.entries,
56
57
  });
@@ -80,13 +81,19 @@ export const endowsQueryParams = object({
80
81
  fields: optional(pipe(csvStrs, array(cloudSearchEndowFields))),
81
82
  });
82
83
 
84
+ export interface CloudsearchEndowsQueryParamsObj
85
+ extends InferInput<typeof endowsQueryParams> {}
86
+
83
87
  export interface CloudsearchEndowsQueryParams
84
88
  extends InferInput<typeof endowsQueryParams> {}
85
89
 
90
+ export interface CloudsearchEndowsQueryParamsParsed
91
+ extends InferOutput<typeof endowsQueryParams> {}
92
+
86
93
  export interface CloudsearchEndow
87
94
  extends InferOutput<typeof cloudsearchEndow> {}
88
95
 
89
- type DocId = `${Environment}-${number}`;
96
+ export type DocId = `${Environment}-${number}`;
90
97
 
91
98
  interface Doc extends ToDoc<CloudsearchEndow> {
92
99
  documentId: DocId;
package/src/db.mts CHANGED
@@ -121,3 +121,5 @@ export namespace Media {
121
121
  export interface DbRecord extends Keys, NonKeyAttributes {}
122
122
  }
123
123
  }
124
+
125
+ export type DbRecord = Endow.DbRecord | Program.DbRecord;
package/src/index.mts CHANGED
@@ -26,6 +26,7 @@ export type {
26
26
  export type {
27
27
  CloudsearchEndow as EndowItem,
28
28
  CloudsearchEndowsQueryParams as EndowsQueryParams,
29
+ CloudsearchEndowsQueryParamsParsed as EndowsQueryParamsParsed,
29
30
  } from "./cloudsearch.mjs";
30
31
 
31
32
  /** client responsible on T depending on keys projected */
package/src/schema.mts CHANGED
@@ -20,6 +20,7 @@ import {
20
20
  isoTimestamp,
21
21
  keyof,
22
22
  lazy,
23
+ literal,
23
24
  maxLength,
24
25
  maxValue,
25
26
  minLength,
@@ -38,6 +39,7 @@ import {
38
39
  string,
39
40
  transform,
40
41
  trim,
42
+ union,
41
43
  uuid,
42
44
  } from "valibot";
43
45
 
@@ -188,7 +190,19 @@ export const endowment = object({
188
190
  donateMethods: optional(array(donateMethodId)),
189
191
  increments: optional(pipe(array(increment), maxLength(MAX_NUM_INCREMENTS))),
190
192
  fund_opt_in: optional(boolean()),
191
-
193
+ target: optional(
194
+ union([
195
+ literal("smart"),
196
+ // "0" - none, `${number}` - fixed
197
+ pipe(
198
+ string(),
199
+ transform((v) => +v),
200
+ number(),
201
+ minValue(0),
202
+ transform((v) => v.toString())
203
+ ),
204
+ ])
205
+ ),
192
206
  /** endowment is not claimed if `false` only */
193
207
  claimed: boolean(),
194
208
  kyc_donors_only: boolean(),