@better-giving/endowment 4.0.28 → 4.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.
package/dist/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
1
  export type * from "./interfaces.mjs";
2
2
  export { NpoDb } from "./db.mjs";
3
- export type { IAllocation, IIncrement, IMediaSearch, IMediaSearchObj, IMediaUpdate, IMilestone, IMilestoneNew, IMilestoneUpdate, INpo, INpoFields, INpoItem, INpoUpdate, IProgram, IProgramDb, IProgramNew, IProgramUpdate, ISocialMediaURLs, TMediaType, INposSearch, INposSearchObj, } from "./schema.mjs";
3
+ export type { IAllocation, IMediaSearch, IMediaSearchObj, IMediaUpdate, IMilestone, IMilestoneNew, IMilestoneUpdate, INpo, INpoFields, INpoItem, INpoUpdate, IProgram, IProgramDb, IProgramNew, IProgramUpdate, ISocialMediaURLs, TMediaType, INposSearch, INposSearchObj, } from "./schema.mjs";
package/dist/schema.d.mts CHANGED
@@ -28,17 +28,7 @@ export declare const social_media_urls: v.ObjectSchema<{
28
28
  export interface ISocialMediaURLs extends v.InferOutput<typeof social_media_urls> {
29
29
  }
30
30
  export declare const MAX_RECEIPT_MSG_CHAR = 500;
31
- export declare const increment_val: v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, v.TransformAction<string, number>, v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, "must be > 0">]>, v.TransformAction<number, string>]>, v.TransformAction<string, string>]>;
32
- export declare const MAX_NUM_INCREMENTS = 4;
33
- export declare const increment_label_max_chars = 60;
34
31
  export declare const tagline_max_chars = 140;
35
- export declare const increment_label: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
36
- export declare const increment: v.ObjectSchema<{
37
- readonly value: v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, v.TransformAction<string, number>, v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, "must be > 0">]>, v.TransformAction<number, string>]>, v.TransformAction<string, string>]>;
38
- readonly label: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
39
- }, undefined>;
40
- export interface IIncrement extends v.InferOutput<typeof increment> {
41
- }
42
32
  export declare const npo: v.ObjectSchema<{
43
33
  readonly id: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
44
34
  readonly env: v.PicklistSchema<readonly ["staging", "production"], undefined>;
@@ -82,12 +72,15 @@ export declare const npo: v.ObjectSchema<{
82
72
  }, "must total to 100">]>, never>;
83
73
  readonly donateMethods: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["stripe", "crypto", "daf", "stocks"], "required">, undefined>, never>;
84
74
  readonly increments: v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
85
- readonly value: v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, v.TransformAction<string, number>, v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, "must be > 0">]>, v.TransformAction<number, string>]>, v.TransformAction<string, string>]>;
86
- readonly label: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
75
+ readonly value: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">]>, import("valibot").TransformAction<string, number>, import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, "must be > 0">]>, import("valibot").TransformAction<number, string>]>, import("valibot").TransformAction<string, string>]>;
76
+ readonly label: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]>, import("valibot").MaxLengthAction<string, 60, ({ requirement: r }: import("valibot").MaxLengthIssue<string, 60>) => string>]>;
87
77
  }, undefined>, undefined>, v.MaxLengthAction<{
88
78
  value: string;
89
79
  label: string;
90
- }[], 4, undefined>]>, never>;
80
+ }[], 4, ({ requirement }: v.MaxLengthIssue<{
81
+ value: string;
82
+ label: string;
83
+ }[], 4>) => string>]>, never>;
91
84
  readonly fund_opt_in: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
92
85
  readonly target: v.OptionalSchema<v.UnionSchema<[v.LiteralSchema<"smart", undefined>, v.SchemaWithPipe<[v.StringSchema<undefined>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, string>]>], undefined>, never>;
93
86
  /** endowment is not claimed if `false` only */
@@ -143,12 +136,15 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
143
136
  }, "must total to 100">]>, never>;
144
137
  readonly donateMethods: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["stripe", "crypto", "daf", "stocks"], "required">, undefined>, never>;
145
138
  readonly increments: v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
146
- readonly value: v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, v.TransformAction<string, number>, v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, "must be > 0">]>, v.TransformAction<number, string>]>, v.TransformAction<string, string>]>;
147
- readonly label: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
139
+ readonly value: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">]>, import("valibot").TransformAction<string, number>, import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, "must be > 0">]>, import("valibot").TransformAction<number, string>]>, import("valibot").TransformAction<string, string>]>;
140
+ readonly label: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]>, import("valibot").MaxLengthAction<string, 60, ({ requirement: r }: import("valibot").MaxLengthIssue<string, 60>) => string>]>;
148
141
  }, undefined>, undefined>, v.MaxLengthAction<{
149
142
  value: string;
150
143
  label: string;
151
- }[], 4, undefined>]>, never>;
144
+ }[], 4, ({ requirement }: v.MaxLengthIssue<{
145
+ value: string;
146
+ label: string;
147
+ }[], 4>) => string>]>, never>;
152
148
  readonly fund_opt_in: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
153
149
  readonly target: v.OptionalSchema<v.UnionSchema<[v.LiteralSchema<"smart", undefined>, v.SchemaWithPipe<[v.StringSchema<undefined>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, string>]>], undefined>, never>;
154
150
  /** endowment is not claimed if `false` only */
@@ -204,12 +200,15 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
204
200
  }, "must total to 100">]>, never>;
205
201
  readonly donateMethods: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["stripe", "crypto", "daf", "stocks"], "required">, undefined>, never>;
206
202
  readonly increments: v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
207
- readonly value: v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, v.TransformAction<string, number>, v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, "must be > 0">]>, v.TransformAction<number, string>]>, v.TransformAction<string, string>]>;
208
- readonly label: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
203
+ readonly value: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">]>, import("valibot").TransformAction<string, number>, import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, "must be > 0">]>, import("valibot").TransformAction<number, string>]>, import("valibot").TransformAction<string, string>]>;
204
+ readonly label: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]>, import("valibot").MaxLengthAction<string, 60, ({ requirement: r }: import("valibot").MaxLengthIssue<string, 60>) => string>]>;
209
205
  }, undefined>, undefined>, v.MaxLengthAction<{
210
206
  value: string;
211
207
  label: string;
212
- }[], 4, undefined>]>, never>;
208
+ }[], 4, ({ requirement }: v.MaxLengthIssue<{
209
+ value: string;
210
+ label: string;
211
+ }[], 4>) => string>]>, never>;
213
212
  readonly fund_opt_in: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
214
213
  readonly target: v.OptionalSchema<v.UnionSchema<[v.LiteralSchema<"smart", undefined>, v.SchemaWithPipe<[v.StringSchema<undefined>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, string>]>], undefined>, never>;
215
214
  /** endowment is not claimed if `false` only */
@@ -226,7 +225,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
226
225
  cash: number;
227
226
  liq: number;
228
227
  lock: number;
229
- }> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.MaxLengthIssue<string, 60> | 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<{
228
+ }> | 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<{
230
229
  value: string;
231
230
  label: string;
232
231
  }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>>): v.Dataset<{
@@ -278,7 +277,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
278
277
  cash: number;
279
278
  liq: number;
280
279
  lock: number;
281
- }> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.MaxLengthIssue<string, 60> | 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<{
280
+ }> | 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<{
282
281
  value: string;
283
282
  label: string;
284
283
  }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>>;
@@ -379,7 +378,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
379
378
  cash: number;
380
379
  liq: number;
381
380
  lock: number;
382
- }> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.MaxLengthIssue<string, 60> | 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<{
381
+ }> | 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<{
383
382
  value: string;
384
383
  label: string;
385
384
  }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>;
@@ -411,12 +410,15 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
411
410
  }, "must total to 100">]>, never>, never>;
412
411
  readonly donateMethods: v.OptionalSchema<v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["stripe", "crypto", "daf", "stocks"], "required">, undefined>, never>, never>;
413
412
  readonly increments: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.ArraySchema<v.ObjectSchema<{
414
- readonly value: v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, v.TransformAction<string, number>, v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, "must be > 0">]>, v.TransformAction<number, string>]>, v.TransformAction<string, string>]>;
415
- readonly label: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.MaxLengthAction<string, 60, ({ requirement: r }: v.MaxLengthIssue<string, 60>) => string>]>;
413
+ readonly value: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]>, import("valibot").NonEmptyAction<string, "required">]>, import("valibot").TransformAction<string, number>, import("valibot").SchemaWithPipe<[import("valibot").NumberSchema<undefined>, import("valibot").MinValueAction<number, 0, "must be > 0">]>, import("valibot").TransformAction<number, string>]>, import("valibot").TransformAction<string, string>]>;
414
+ readonly label: import("valibot").SchemaWithPipe<[import("valibot").SchemaWithPipe<[import("valibot").StringSchema<"required">, import("valibot").TrimAction]>, import("valibot").MaxLengthAction<string, 60, ({ requirement: r }: import("valibot").MaxLengthIssue<string, 60>) => string>]>;
416
415
  }, undefined>, undefined>, v.MaxLengthAction<{
417
416
  value: string;
418
417
  label: string;
419
- }[], 4, undefined>]>, never>, never>;
418
+ }[], 4, ({ requirement }: v.MaxLengthIssue<{
419
+ value: string;
420
+ label: string;
421
+ }[], 4>) => string>]>, never>, never>;
420
422
  readonly fund_opt_in: v.OptionalSchema<v.OptionalSchema<v.BooleanSchema<undefined>, never>, never>;
421
423
  readonly target: v.OptionalSchema<v.OptionalSchema<v.UnionSchema<[v.LiteralSchema<"smart", undefined>, v.SchemaWithPipe<[v.StringSchema<undefined>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.TransformAction<number, string>]>], undefined>, never>, never>;
422
424
  readonly referral_id: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<"required">, v.TrimAction]>, v.NonEmptyAction<string, "required">]>, never>, never>;
@@ -442,7 +444,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
442
444
  cash: number;
443
445
  liq: number;
444
446
  lock: number;
445
- }> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.MaxLengthIssue<string, 60> | 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<{
447
+ }> | 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<{
446
448
  value: string;
447
449
  label: string;
448
450
  }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>>): v.Dataset<{
@@ -494,7 +496,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
494
496
  cash: number;
495
497
  liq: number;
496
498
  lock: number;
497
- }> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.MaxLengthIssue<string, 60> | 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<{
499
+ }> | 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<{
498
500
  value: string;
499
501
  label: string;
500
502
  }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>>;
@@ -595,7 +597,7 @@ export declare const npo_update: Omit<Omit<v.ObjectSchema<{
595
597
  cash: number;
596
598
  liq: number;
597
599
  lock: number;
598
- }> | v.NonEmptyIssue<string> | v.UrlIssue<string> | v.MaxLengthIssue<string, 60> | 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<{
600
+ }> | 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<{
599
601
  value: string;
600
602
  label: string;
601
603
  }[], 4> | v.LiteralIssue | v.UnionIssue<v.StringIssue | v.NumberIssue | v.MinValueIssue<number, 0> | v.LiteralIssue> | v.IsoTimestampIssue<string> | v.MinValueIssue<number, 50>;
package/dist/schema.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $, $int_gte1, $req, $req_num_gt0, donate_method_id, env, https_url, int_gte1, org_designation, slug, unsdg_num, } from "@better-giving/schemas";
1
+ import { $, $int_gte1, $req, donate_method_id, env, https_url, increment, int_gte1, MAX_NUM_INCREMENTS, target, org_designation, slug, unsdg_num, } from "@better-giving/schemas";
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;
@@ -17,26 +17,16 @@ export const allocation = v.pipe(v.object({
17
17
  export const reg_number = v.pipe($, v.nonEmpty("required"), v.regex(/^[a-zA-Z0-9]+$/, "must only contain letters and numbers"));
18
18
  export const _url = v.pipe($, v.url());
19
19
  export const social_media_urls = v.object({
20
- facebook: v.optional(https_url(false)),
21
- twitter: v.optional(https_url(false)),
22
- linkedin: v.optional(https_url(false)),
23
- discord: v.optional(https_url(false)),
24
- instagram: v.optional(https_url(false)),
25
- youtube: v.optional(https_url(false)),
26
- tiktok: v.optional(https_url(false)),
20
+ facebook: v.optional(https_url({})),
21
+ twitter: v.optional(https_url({})),
22
+ linkedin: v.optional(https_url({})),
23
+ discord: v.optional(https_url({})),
24
+ instagram: v.optional(https_url({})),
25
+ youtube: v.optional(https_url({})),
26
+ tiktok: v.optional(https_url({})),
27
27
  });
28
28
  export const MAX_RECEIPT_MSG_CHAR = 500;
29
- export const increment_val = v.pipe($req_num_gt0,
30
- //parsed output
31
- v.transform((x) => x.toString()));
32
- export const MAX_NUM_INCREMENTS = 4;
33
- export const increment_label_max_chars = 60;
34
29
  export const tagline_max_chars = 140;
35
- export const increment_label = v.pipe($, v.maxLength(increment_label_max_chars, ({ requirement: r }) => `cannot exceed ${r} characters`));
36
- export const increment = v.object({
37
- value: increment_val,
38
- label: increment_label,
39
- });
40
30
  export const npo = v.object({
41
31
  id: int_gte1,
42
32
  env,
@@ -54,7 +44,7 @@ export const npo = v.object({
54
44
  street_address: v.optional($),
55
45
  social_media_urls,
56
46
  /** website */
57
- url: v.optional(https_url(false)),
47
+ url: v.optional(https_url({})),
58
48
  sdgs: v.pipe(v.array(unsdg_num), v.minLength(1)),
59
49
  receiptMsg: v.optional(v.pipe($, v.maxLength(MAX_RECEIPT_MSG_CHAR))),
60
50
  //can be optional, default false and need not be explicit
@@ -64,13 +54,9 @@ export const npo = v.object({
64
54
  progDonationsAllowed: v.optional(v.boolean()),
65
55
  allocation: v.optional(allocation),
66
56
  donateMethods: v.optional(v.array(donate_method_id)),
67
- increments: v.optional(v.pipe(v.array(increment), v.maxLength(MAX_NUM_INCREMENTS))),
57
+ increments: v.optional(v.pipe(v.array(increment), v.maxLength(MAX_NUM_INCREMENTS, ({ requirement }) => `cannot have more than ${requirement} increments`))),
68
58
  fund_opt_in: v.optional(v.boolean()),
69
- target: v.optional(v.union([
70
- v.literal("smart"),
71
- // "0" - none, `${number}` - fixed
72
- v.pipe(v.string(), v.transform((v) => +v), v.number(), v.minValue(0), v.transform((v) => v.toString())),
73
- ])),
59
+ target: v.optional(target),
74
60
  /** endowment is not claimed if `false` only */
75
61
  claimed: v.boolean(),
76
62
  kyc_donors_only: v.boolean(),
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@better-giving/endowment",
3
- "version": "4.0.28",
3
+ "version": "4.0.30",
4
4
  "dependencies": {
5
5
  "ksuid": "3.0.0"
6
6
  },
7
7
  "peerDependencies": {
8
- "@better-giving/schemas": "2.0.2",
9
8
  "@better-giving/types": "1.1.8",
10
9
  "@better-giving/db": "2.0.6",
11
10
  "@aws-sdk/lib-dynamodb": "3.485.0",
12
- "valibot": "0.42.0"
11
+ "valibot": "0.42.0",
12
+ "@better-giving/schemas": "2.0.4"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@better-giving/config": "1.1.2"
package/src/index.mts CHANGED
@@ -2,7 +2,6 @@ export type * from "./interfaces.mjs";
2
2
  export { NpoDb } from "./db.mjs";
3
3
  export type {
4
4
  IAllocation,
5
- IIncrement,
6
5
  IMediaSearch,
7
6
  IMediaSearchObj,
8
7
  IMediaUpdate,
package/src/schema.mts CHANGED
@@ -2,11 +2,13 @@ import {
2
2
  $,
3
3
  $int_gte1,
4
4
  $req,
5
- $req_num_gt0,
6
5
  donate_method_id,
7
6
  env,
8
7
  https_url,
8
+ increment,
9
9
  int_gte1,
10
+ MAX_NUM_INCREMENTS,
11
+ target,
10
12
  org_designation,
11
13
  slug,
12
14
  unsdg_num,
@@ -58,13 +60,13 @@ export const reg_number = v.pipe(
58
60
  export const _url = v.pipe($, v.url());
59
61
 
60
62
  export const social_media_urls = v.object({
61
- facebook: v.optional(https_url(false)),
62
- twitter: v.optional(https_url(false)),
63
- linkedin: v.optional(https_url(false)),
64
- discord: v.optional(https_url(false)),
65
- instagram: v.optional(https_url(false)),
66
- youtube: v.optional(https_url(false)),
67
- tiktok: v.optional(https_url(false)),
63
+ facebook: v.optional(https_url({})),
64
+ twitter: v.optional(https_url({})),
65
+ linkedin: v.optional(https_url({})),
66
+ discord: v.optional(https_url({})),
67
+ instagram: v.optional(https_url({})),
68
+ youtube: v.optional(https_url({})),
69
+ tiktok: v.optional(https_url({})),
68
70
  });
69
71
 
70
72
  export interface ISocialMediaURLs
@@ -72,31 +74,8 @@ export interface ISocialMediaURLs
72
74
 
73
75
  export const MAX_RECEIPT_MSG_CHAR = 500;
74
76
 
75
- export const increment_val = v.pipe(
76
- $req_num_gt0,
77
- //parsed output
78
- v.transform((x) => x.toString())
79
- );
80
-
81
- export const MAX_NUM_INCREMENTS = 4;
82
- export const increment_label_max_chars = 60;
83
77
  export const tagline_max_chars = 140;
84
78
 
85
- export const increment_label = v.pipe(
86
- $,
87
- v.maxLength(
88
- increment_label_max_chars,
89
- ({ requirement: r }) => `cannot exceed ${r} characters`
90
- )
91
- );
92
-
93
- export const increment = v.object({
94
- value: increment_val,
95
- label: increment_label,
96
- });
97
-
98
- export interface IIncrement extends v.InferOutput<typeof increment> {}
99
-
100
79
  export const npo = v.object({
101
80
  id: int_gte1,
102
81
  env,
@@ -114,7 +93,7 @@ export const npo = v.object({
114
93
  street_address: v.optional($),
115
94
  social_media_urls,
116
95
  /** website */
117
- url: v.optional(https_url(false)),
96
+ url: v.optional(https_url({})),
118
97
  sdgs: v.pipe(v.array(unsdg_num), v.minLength(1)),
119
98
  receiptMsg: v.optional(v.pipe($, v.maxLength(MAX_RECEIPT_MSG_CHAR))),
120
99
  //can be optional, default false and need not be explicit
@@ -126,22 +105,16 @@ export const npo = v.object({
126
105
  allocation: v.optional(allocation),
127
106
  donateMethods: v.optional(v.array(donate_method_id)),
128
107
  increments: v.optional(
129
- v.pipe(v.array(increment), v.maxLength(MAX_NUM_INCREMENTS))
108
+ v.pipe(
109
+ v.array(increment),
110
+ v.maxLength(
111
+ MAX_NUM_INCREMENTS,
112
+ ({ requirement }) => `cannot have more than ${requirement} increments`
113
+ )
114
+ )
130
115
  ),
131
116
  fund_opt_in: v.optional(v.boolean()),
132
- target: v.optional(
133
- v.union([
134
- v.literal("smart"),
135
- // "0" - none, `${number}` - fixed
136
- v.pipe(
137
- v.string(),
138
- v.transform((v) => +v),
139
- v.number(),
140
- v.minValue(0),
141
- v.transform((v) => v.toString())
142
- ),
143
- ])
144
- ),
117
+ target: v.optional(target),
145
118
  /** endowment is not claimed if `false` only */
146
119
  claimed: v.boolean(),
147
120
  kyc_donors_only: v.boolean(),