@better-giving/endowment 4.0.5 → 4.0.7
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/cloudsearch.mjs +6 -6
- package/dist/schema.d.mts +3 -4
- package/dist/schema.mjs +5 -5
- package/package.json +1 -1
- package/src/cloudsearch.mts +6 -6
- package/src/schema.mts +13 -20
package/dist/cloudsearch.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { $int_gte1, org_designation, unsdg_num } from "@better-giving/schemas";
|
|
2
2
|
import { array, boolean, keyof, mapItems, number, object, optional, pick, pipe, } from "valibot";
|
|
3
|
-
import { $,
|
|
4
|
-
const boolCsv = pipe(
|
|
3
|
+
import { $, csv_strs, npo } from "./schema.mjs";
|
|
4
|
+
const boolCsv = pipe(csv_strs, mapItems((x) => x === "true"), array(boolean()));
|
|
5
5
|
export const cloudsearchEndowFields = object({
|
|
6
6
|
contributions_total: number(),
|
|
7
7
|
contributions_count: number(),
|
|
@@ -31,11 +31,11 @@ export const cloudSearchEndowFields = keyof(cloudsearchEndow);
|
|
|
31
31
|
export const endowsQueryParams = object({
|
|
32
32
|
query: optional($),
|
|
33
33
|
page: optional($int_gte1),
|
|
34
|
-
endow_designation: optional(pipe(
|
|
35
|
-
sdgs: optional(pipe(
|
|
34
|
+
endow_designation: optional(pipe(csv_strs, array(org_designation))),
|
|
35
|
+
sdgs: optional(pipe(csv_strs, mapItems((x) => +x), array(unsdg_num))),
|
|
36
36
|
kyc_only: optional(boolCsv),
|
|
37
37
|
fund_opt_in: optional(boolCsv),
|
|
38
38
|
claimed: optional(boolCsv),
|
|
39
|
-
countries: optional(pipe(
|
|
40
|
-
fields: optional(pipe(
|
|
39
|
+
countries: optional(pipe(csv_strs, array($))),
|
|
40
|
+
fields: optional(pipe(csv_strs, array(cloudSearchEndowFields))),
|
|
41
41
|
});
|
package/dist/schema.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export { org_designation as endow_designation, env, unsdg_num, donate_method_id, donate_method_ids, $int_gte1, int_gte1, $, $req_num_gt0, $req, slug, };
|
|
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";
|
|
3
2
|
import * as v from "valibot";
|
|
4
3
|
export declare const min_payout_amount = 50;
|
|
5
4
|
export declare const csv: v.LazySchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]> | v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.RegexAction<string, "invalid csv">]>>;
|
|
6
|
-
export declare const
|
|
5
|
+
export declare const csv_strs: v.SchemaWithPipe<[v.LazySchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]> | v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.RegexAction<string, "invalid csv">]>>, v.TransformAction<string, string[]>, v.FilterItemsAction<string[]>]>;
|
|
7
6
|
export declare const allocation: v.SchemaWithPipe<[v.ObjectSchema<{
|
|
8
7
|
readonly cash: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 100, undefined>]>;
|
|
9
8
|
readonly liq: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 100, undefined>]>;
|
|
@@ -810,7 +809,7 @@ export declare const media_search: v.ObjectSchema<{
|
|
|
810
809
|
readonly type: v.OptionalSchema<v.PicklistSchema<readonly ["album", "article", "video"], undefined>, never>;
|
|
811
810
|
readonly next: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.Base64Action<string, undefined>]>, never>;
|
|
812
811
|
readonly featured: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.TransformAction<string, boolean>, v.BooleanSchema<undefined>]>, never>;
|
|
813
|
-
readonly limit: v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TransformAction<string, number>, v.SchemaWithPipe<[v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>]>, never>;
|
|
812
|
+
readonly limit: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.TransformAction<string, number>, v.SchemaWithPipe<[v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>]>, never>;
|
|
814
813
|
}, undefined>;
|
|
815
814
|
export interface IMediaSearch extends v.InferInput<typeof media_search> {
|
|
816
815
|
}
|
package/dist/schema.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $, $
|
|
2
|
-
export {
|
|
1
|
+
import { $, $req, $req_num_gt0, donate_method_id, env, https_url, int_gte1, $int_gte1, org_designation, slug, unsdg_num, } from "@better-giving/schemas";
|
|
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
5
|
export const csv = v.lazy((x) => {
|
|
@@ -7,7 +7,7 @@ export const csv = v.lazy((x) => {
|
|
|
7
7
|
return $;
|
|
8
8
|
return v.pipe($, v.regex(/^[^,]+(?:,[^,]+)*$/, "invalid csv"));
|
|
9
9
|
});
|
|
10
|
-
export const
|
|
10
|
+
export const csv_strs = v.pipe(csv, v.transform((x) => x.split(",")), v.filterItems((x) => x.length > 0));
|
|
11
11
|
const pct = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(100));
|
|
12
12
|
export const allocation = v.pipe(v.object({
|
|
13
13
|
cash: pct,
|
|
@@ -85,7 +85,7 @@ export const npo_update = v.partial(v.omit(npo, ["id", "claimed", "kyc_donors_on
|
|
|
85
85
|
export const npo_fields = v.keyof(npo);
|
|
86
86
|
/** for ein path, only fields in reg-num/env gsi is available */
|
|
87
87
|
export const npo_search = v.object({
|
|
88
|
-
fields: v.optional(v.pipe(
|
|
88
|
+
fields: v.optional(v.pipe(csv_strs, v.array(npo_fields))),
|
|
89
89
|
});
|
|
90
90
|
const amnt = v.pipe(v.number(), v.minValue(0));
|
|
91
91
|
export const program_id = v.pipe($, v.uuid());
|
|
@@ -132,5 +132,5 @@ export const media_search = v.object({
|
|
|
132
132
|
type: v.optional(media_type),
|
|
133
133
|
next: v.optional(v.pipe($, v.base64())),
|
|
134
134
|
featured: v.optional(v.pipe($, v.transform((x) => Boolean(x)), v.boolean())),
|
|
135
|
-
limit: v.optional(
|
|
135
|
+
limit: v.optional($int_gte1),
|
|
136
136
|
});
|
package/package.json
CHANGED
package/src/cloudsearch.mts
CHANGED
|
@@ -18,10 +18,10 @@ import {
|
|
|
18
18
|
pick,
|
|
19
19
|
pipe,
|
|
20
20
|
} from "valibot";
|
|
21
|
-
import { $,
|
|
21
|
+
import { $, csv_strs, npo } from "./schema.mjs";
|
|
22
22
|
|
|
23
23
|
const boolCsv = pipe(
|
|
24
|
-
|
|
24
|
+
csv_strs,
|
|
25
25
|
mapItems((x) => x === "true"),
|
|
26
26
|
array(boolean())
|
|
27
27
|
);
|
|
@@ -58,10 +58,10 @@ export const cloudSearchEndowFields = keyof(cloudsearchEndow);
|
|
|
58
58
|
export const endowsQueryParams = object({
|
|
59
59
|
query: optional($),
|
|
60
60
|
page: optional($int_gte1),
|
|
61
|
-
endow_designation: optional(pipe(
|
|
61
|
+
endow_designation: optional(pipe(csv_strs, array(org_designation))),
|
|
62
62
|
sdgs: optional(
|
|
63
63
|
pipe(
|
|
64
|
-
|
|
64
|
+
csv_strs,
|
|
65
65
|
mapItems((x) => +x),
|
|
66
66
|
array(unsdg_num)
|
|
67
67
|
)
|
|
@@ -69,8 +69,8 @@ export const endowsQueryParams = object({
|
|
|
69
69
|
kyc_only: optional(boolCsv),
|
|
70
70
|
fund_opt_in: optional(boolCsv),
|
|
71
71
|
claimed: optional(boolCsv),
|
|
72
|
-
countries: optional(pipe(
|
|
73
|
-
fields: optional(pipe(
|
|
72
|
+
countries: optional(pipe(csv_strs, array($))),
|
|
73
|
+
fields: optional(pipe(csv_strs, array(cloudSearchEndowFields))),
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
export interface CloudsearchEndowsQueryParamsObj
|
package/src/schema.mts
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
2
|
$,
|
|
3
|
-
$int_gte1,
|
|
4
3
|
$req,
|
|
5
4
|
$req_num_gt0,
|
|
6
5
|
donate_method_id,
|
|
7
|
-
donate_method_ids,
|
|
8
6
|
env,
|
|
9
7
|
https_url,
|
|
10
8
|
int_gte1,
|
|
9
|
+
$int_gte1,
|
|
11
10
|
org_designation,
|
|
12
11
|
slug,
|
|
13
12
|
unsdg_num,
|
|
14
13
|
} from "@better-giving/schemas";
|
|
15
14
|
export {
|
|
16
|
-
org_designation as endow_designation,
|
|
17
|
-
env,
|
|
18
|
-
unsdg_num,
|
|
19
|
-
donate_method_id,
|
|
20
|
-
donate_method_ids,
|
|
21
|
-
$int_gte1,
|
|
22
|
-
int_gte1,
|
|
23
15
|
$,
|
|
24
|
-
$req_num_gt0,
|
|
25
16
|
$req,
|
|
17
|
+
$req_num_gt0,
|
|
18
|
+
donate_method_id,
|
|
19
|
+
env,
|
|
20
|
+
https_url,
|
|
21
|
+
int_gte1,
|
|
22
|
+
$int_gte1,
|
|
23
|
+
org_designation,
|
|
26
24
|
slug,
|
|
27
|
-
|
|
25
|
+
unsdg_num,
|
|
26
|
+
} from "@better-giving/schemas";
|
|
28
27
|
import * as v from "valibot";
|
|
29
28
|
|
|
30
29
|
export const min_payout_amount = 50;
|
|
@@ -33,7 +32,7 @@ export const csv = v.lazy((x) => {
|
|
|
33
32
|
if (!x) return $;
|
|
34
33
|
return v.pipe($, v.regex(/^[^,]+(?:,[^,]+)*$/, "invalid csv"));
|
|
35
34
|
});
|
|
36
|
-
export const
|
|
35
|
+
export const csv_strs = v.pipe(
|
|
37
36
|
csv,
|
|
38
37
|
v.transform((x) => x.split(",")),
|
|
39
38
|
v.filterItems((x) => x.length > 0)
|
|
@@ -165,7 +164,7 @@ export type INpoFields = v.InferOutput<typeof npo_fields>;
|
|
|
165
164
|
|
|
166
165
|
/** for ein path, only fields in reg-num/env gsi is available */
|
|
167
166
|
export const npo_search = v.object({
|
|
168
|
-
fields: v.optional(v.pipe(
|
|
167
|
+
fields: v.optional(v.pipe(csv_strs, v.array(npo_fields))),
|
|
169
168
|
});
|
|
170
169
|
|
|
171
170
|
export interface INposSearch extends v.InferInput<typeof npo_search> {}
|
|
@@ -243,13 +242,7 @@ export const media_search = v.object({
|
|
|
243
242
|
v.boolean()
|
|
244
243
|
)
|
|
245
244
|
),
|
|
246
|
-
limit: v.optional(
|
|
247
|
-
v.pipe(
|
|
248
|
-
v.string(),
|
|
249
|
-
v.transform((x) => +x),
|
|
250
|
-
int_gte1
|
|
251
|
-
)
|
|
252
|
-
),
|
|
245
|
+
limit: v.optional($int_gte1),
|
|
253
246
|
});
|
|
254
247
|
export interface IMediaSearch extends v.InferInput<typeof media_search> {}
|
|
255
248
|
export interface IMediaSearchObj extends v.InferOutput<typeof media_search> {}
|