@better-giving/endowment 4.0.35 → 4.0.37

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
@@ -97,6 +97,7 @@ export declare class NpoDb extends Db {
97
97
  referrer_expiry?: string | undefined;
98
98
  w_form?: string | undefined;
99
99
  payout_minimum?: number | undefined;
100
+ donor_address_required?: boolean | undefined;
100
101
  PK: string;
101
102
  SK: import("@better-giving/types/list").Environment;
102
103
  };
@@ -145,6 +146,7 @@ export declare class NpoDb extends Db {
145
146
  npo_programs(id: number): Promise<IProgramDb[]>;
146
147
  npo_program_put(npo: number, content: IProgramNew): Promise<string>;
147
148
  npo_prog_del_txis(npo: number, prog: string): Promise<TxItems>;
149
+ npo_prog_contrib_update_txi(npo: number, prog: string, amount: number): TxType["Update"];
148
150
  npo_prog_del(npo: number, prog: string): Promise<import("@aws-sdk/lib-dynamodb").TransactWriteCommandOutput>;
149
151
  npo_prog_update(npo: number, prog: string, update: IProgramUpdate): Promise<Record<string, any> | undefined>;
150
152
  }
package/dist/db.mjs CHANGED
@@ -402,6 +402,20 @@ export class NpoDb extends Db {
402
402
  }
403
403
  return txs.all;
404
404
  }
405
+ npo_prog_contrib_update_txi(npo, prog, amount) {
406
+ return {
407
+ TableName: NpoDb.table,
408
+ Key: this.key_npo_program(prog, npo),
409
+ UpdateExpression: "SET #x = if_not_exists(#x, :zero) + :amt",
410
+ ExpressionAttributeValues: {
411
+ ":amt": amount,
412
+ ":zero": 0,
413
+ },
414
+ ExpressionAttributeNames: {
415
+ "#x": "totalDonations",
416
+ },
417
+ };
418
+ }
405
419
  async npo_prog_del(npo, prog) {
406
420
  const txs = await this.npo_prog_del_txis(npo, prog);
407
421
  const cmd = new TransactWriteCommand({
package/dist/npo.mjs CHANGED
@@ -33,4 +33,5 @@ export const npo_fields = {
33
33
  referral_id: "",
34
34
  w_form: "",
35
35
  payout_minimum: "",
36
+ donor_address_required: "",
36
37
  };
package/dist/schema.d.mts CHANGED
@@ -92,6 +92,7 @@ export declare const npo: v.ObjectSchema<{
92
92
  readonly referrer_expiry: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.IsoTimestampAction<string, undefined>]>, never>;
93
93
  readonly w_form: v.OptionalSchema<v.StringSchema<undefined>, never>;
94
94
  readonly payout_minimum: v.OptionalSchema<v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 50, undefined>]>, never>;
95
+ readonly donor_address_required: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
95
96
  }, undefined>;
96
97
  export declare const npo_update: Omit<Omit<v.ObjectSchema<{
97
98
  readonly id: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
@@ -156,6 +157,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
156
157
  readonly referrer_expiry: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.IsoTimestampAction<string, undefined>]>, never>;
157
158
  readonly w_form: v.OptionalSchema<v.StringSchema<undefined>, never>;
158
159
  readonly payout_minimum: v.OptionalSchema<v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 50, undefined>]>, never>;
160
+ readonly donor_address_required: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
159
161
  }, undefined>, "_run" | "_types" | "entries"> & {
160
162
  readonly entries: Omit<{
161
163
  readonly id: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
@@ -220,6 +222,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
220
222
  readonly referrer_expiry: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.IsoTimestampAction<string, undefined>]>, never>;
221
223
  readonly w_form: v.OptionalSchema<v.StringSchema<undefined>, never>;
222
224
  readonly payout_minimum: v.OptionalSchema<v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 50, undefined>]>, never>;
225
+ readonly donor_address_required: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
223
226
  }, "id" | "env" | "claimed" | "kyc_donors_only" | "fiscal_sponsored">;
224
227
  _run(dataset: v.Dataset<unknown, never>, config: v.Config<v.StringIssue | v.RegexIssue<string> | v.NumberIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 0> | v.MaxValueIssue<number, 100> | v.ObjectIssue | v.CheckIssue<{
225
228
  cash: number;
@@ -273,6 +276,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
273
276
  referrer_expiry?: string | undefined;
274
277
  w_form?: string | undefined;
275
278
  payout_minimum?: number | undefined;
279
+ donor_address_required?: boolean | undefined;
276
280
  }, v.StringIssue | v.RegexIssue<string> | v.NumberIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 0> | v.MaxValueIssue<number, 100> | v.ObjectIssue | v.CheckIssue<{
277
281
  cash: number;
278
282
  liq: number;
@@ -327,6 +331,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
327
331
  referrer_expiry?: string | undefined;
328
332
  w_form?: string | undefined;
329
333
  payout_minimum?: number | undefined;
334
+ donor_address_required?: boolean | undefined;
330
335
  };
331
336
  readonly output: {
332
337
  active_in_countries: string[];
@@ -373,6 +378,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
373
378
  referrer_expiry?: string | undefined;
374
379
  w_form?: string | undefined;
375
380
  payout_minimum?: number | undefined;
381
+ donor_address_required?: boolean | undefined;
376
382
  };
377
383
  readonly issue: v.StringIssue | v.RegexIssue<string> | v.NumberIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 0> | v.MaxValueIssue<number, 100> | v.ObjectIssue | v.CheckIssue<{
378
384
  cash: number;
@@ -426,6 +432,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
426
432
  readonly referrer_expiry: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.IsoTimestampAction<string, undefined>]>, never>, never>;
427
433
  readonly w_form: v.OptionalSchema<v.OptionalSchema<v.StringSchema<undefined>, never>, never>;
428
434
  readonly payout_minimum: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 50, undefined>]>, never>, never>;
435
+ readonly donor_address_required: v.OptionalSchema<v.OptionalSchema<v.BooleanSchema<undefined>, never>, never>;
429
436
  readonly registration_number: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">, v.RegexAction<string, "must only contain letters and numbers">]>, never>;
430
437
  readonly name: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, never>;
431
438
  readonly endow_designation: v.OptionalSchema<v.PicklistSchema<readonly ["Charity", "Religious Organization", "University", "Hospital", "Other"], "required">, never>;
@@ -479,6 +486,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
479
486
  referrer_expiry?: string | undefined;
480
487
  w_form?: string | undefined;
481
488
  payout_minimum?: number | undefined;
489
+ donor_address_required?: boolean | undefined;
482
490
  registration_number?: string | undefined;
483
491
  name?: string | undefined;
484
492
  endow_designation?: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other" | undefined;
@@ -533,6 +541,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
533
541
  referrer_expiry?: string | undefined;
534
542
  w_form?: string | undefined;
535
543
  payout_minimum?: number | undefined;
544
+ donor_address_required?: boolean | undefined;
536
545
  registration_number?: string | undefined;
537
546
  name?: string | undefined;
538
547
  endow_designation?: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other" | undefined;
@@ -579,6 +588,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
579
588
  referrer_expiry?: string | undefined;
580
589
  w_form?: string | undefined;
581
590
  payout_minimum?: number | undefined;
591
+ donor_address_required?: boolean | undefined;
582
592
  registration_number?: string | undefined;
583
593
  name?: string | undefined;
584
594
  endow_designation?: "Charity" | "Religious Organization" | "University" | "Hospital" | "Other" | undefined;
@@ -603,7 +613,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
603
613
  }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>;
604
614
  } | undefined;
605
615
  };
606
- 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", "id", "env", "registration_number", "name", "endow_designation", "hq_country", "social_media_urls", "claimed", "kyc_donors_only", "fiscal_sponsored"], undefined>;
616
+ 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>;
607
617
  export interface INpo extends v.InferOutput<typeof npo> {
608
618
  }
609
619
  export interface INpoUpdate extends v.InferOutput<typeof npo_update> {
@@ -611,7 +621,7 @@ export interface INpoUpdate extends v.InferOutput<typeof npo_update> {
611
621
  export type INpoFields = v.InferOutput<typeof npo_fields>;
612
622
  /** for ein path, only fields in reg-num/env gsi is available */
613
623
  export declare const npo_search: v.ObjectSchema<{
614
- readonly fields: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.LazySchema<v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]> | v.SchemaWithPipe<[v.SchemaWithPipe<[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", "id", "env", "registration_number", "name", "endow_designation", "hq_country", "social_media_urls", "claimed", "kyc_donors_only", "fiscal_sponsored"], undefined>, undefined>]>, never>;
624
+ readonly fields: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.LazySchema<v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]> | v.SchemaWithPipe<[v.SchemaWithPipe<[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>]>, never>;
615
625
  }, undefined>;
616
626
  export interface INposSearch extends v.InferInput<typeof npo_search> {
617
627
  }
package/dist/schema.mjs CHANGED
@@ -66,6 +66,7 @@ export const npo = v.object({
66
66
  referrer_expiry: v.optional(v.pipe($, v.isoTimestamp())),
67
67
  w_form: v.optional(v.string()),
68
68
  payout_minimum: v.optional(v.pipe(v.number(), v.minValue(min_payout_amount))),
69
+ donor_address_required: v.optional(v.boolean()),
69
70
  });
70
71
  export const npo_update = v.partial(v.omit(npo, ["id", "claimed", "kyc_donors_only", "env", "fiscal_sponsored"]));
71
72
  export const npo_fields = v.keyof(npo);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-giving/endowment",
3
- "version": "4.0.35",
3
+ "version": "4.0.37",
4
4
  "dependencies": {
5
5
  "ksuid": "3.0.0"
6
6
  },
package/src/db.mts CHANGED
@@ -514,6 +514,25 @@ export class NpoDb extends Db {
514
514
  return txs.all;
515
515
  }
516
516
 
517
+ npo_prog_contrib_update_txi(
518
+ npo: number,
519
+ prog: string,
520
+ amount: number
521
+ ): TxType["Update"] {
522
+ return {
523
+ TableName: NpoDb.table,
524
+ Key: this.key_npo_program(prog, npo),
525
+ UpdateExpression: "SET #x = if_not_exists(#x, :zero) + :amt",
526
+ ExpressionAttributeValues: {
527
+ ":amt": amount,
528
+ ":zero": 0,
529
+ },
530
+ ExpressionAttributeNames: {
531
+ "#x": "totalDonations" satisfies keyof IProgram,
532
+ },
533
+ };
534
+ }
535
+
517
536
  async npo_prog_del(npo: number, prog: string) {
518
537
  const txs = await this.npo_prog_del_txis(npo, prog);
519
538
  const cmd = new TransactWriteCommand({
package/src/npo.mts CHANGED
@@ -35,4 +35,5 @@ export const npo_fields: { [K in keyof Required<INpo>]: "" } = {
35
35
  referral_id: "",
36
36
  w_form: "",
37
37
  payout_minimum: "",
38
+ donor_address_required: "",
38
39
  };
package/src/schema.mts CHANGED
@@ -124,6 +124,7 @@ export const npo = v.object({
124
124
  referrer_expiry: v.optional(v.pipe($, v.isoTimestamp())),
125
125
  w_form: v.optional(v.string()),
126
126
  payout_minimum: v.optional(v.pipe(v.number(), v.minValue(min_payout_amount))),
127
+ donor_address_required: v.optional(v.boolean()),
127
128
  });
128
129
 
129
130
  export const npo_update = v.partial(