@better-giving/donation 3.0.5 → 3.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/donation-msgs-db.d.mts +2 -2
- package/dist/donation-msgs-db.mjs +1 -1
- package/dist/donations-db.d.mts +6 -2
- package/dist/donations-db.mjs +11 -1
- package/dist/onhold-db.d.mts +1 -1
- package/dist/onhold-db.mjs +1 -1
- package/dist/schema.mjs +1 -1
- package/dist/subscriptions-db.d.mts +1 -1
- package/package.json +1 -1
- package/src/donation-msgs-db.mts +3 -3
- package/src/donations-db.mts +22 -6
- package/src/onhold-db.mts +7 -7
- package/src/schema.mts +1 -1
- package/src/subscriptions-db.mts +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Db } from "@better-giving/db";
|
|
2
2
|
import type { ISODate } from "@better-giving/types/alias";
|
|
3
|
-
import type { Environment } from "@better-giving/types/list";
|
|
4
|
-
import type { IPageOpts } from "./schema.mjs";
|
|
5
3
|
import type { IPageKeyed } from "@better-giving/types/api";
|
|
4
|
+
import type { Environment } from "@better-giving/types/list";
|
|
6
5
|
import type { IPublicDonor } from "./interfaces.mjs";
|
|
6
|
+
import type { IPageOpts } from "./schema.mjs";
|
|
7
7
|
export type DMKey = `DM#${string}`;
|
|
8
8
|
export declare class DonationDonorsDb extends Db {
|
|
9
9
|
static readonly table = "donation_messages";
|
package/dist/donations-db.d.mts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { Db } from "@better-giving/db";
|
|
2
|
-
import type { IDonationFinal, IDonationFinalAttr, TExplicit } from "./interfaces.mjs";
|
|
3
1
|
import { type QueryCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import { Db } from "@better-giving/db";
|
|
4
3
|
import type { IPageKeyed } from "@better-giving/types/api";
|
|
4
|
+
import type { IDonationFinal, IDonationFinalAttr, TExplicit } from "./interfaces.mjs";
|
|
5
5
|
import type { IDonationsSearch } from "./schema.mjs";
|
|
6
6
|
export declare class DonationsDb extends Db {
|
|
7
7
|
static readonly table = "Donations";
|
|
8
8
|
static readonly gsi_referrer$settled_date = "Referrer-FinalizedDate_index";
|
|
9
9
|
static readonly gsi_npo$settled_date = "npo-settled_date-gsi";
|
|
10
10
|
static readonly gsi_email$tx_date = "email-tx_date-gsii";
|
|
11
|
+
key(id: string): {
|
|
12
|
+
transactionId: string;
|
|
13
|
+
};
|
|
14
|
+
item(id: string): Promise<IDonationFinal | undefined>;
|
|
11
15
|
put_txi(data: TExplicit<IDonationFinalAttr>): Promise<import("@aws-sdk/lib-dynamodb").PutCommandOutput>;
|
|
12
16
|
referred_by_q(referrer: string): Promise<QueryCommandInput>;
|
|
13
17
|
list_to_npo(npo: number, opts?: IDonationsSearch & {
|
package/dist/donations-db.mjs
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
+
import { GetCommand, PutCommand, QueryCommand, } from "@aws-sdk/lib-dynamodb";
|
|
1
2
|
import { Db } from "@better-giving/db";
|
|
2
|
-
import { PutCommand, QueryCommand, } from "@aws-sdk/lib-dynamodb";
|
|
3
3
|
export class DonationsDb extends Db {
|
|
4
4
|
static table = "Donations";
|
|
5
5
|
static gsi_referrer$settled_date = "Referrer-FinalizedDate_index";
|
|
6
6
|
static gsi_npo$settled_date = "npo-settled_date-gsi";
|
|
7
7
|
static gsi_email$tx_date = "email-tx_date-gsii";
|
|
8
|
+
key(id) {
|
|
9
|
+
return { transactionId: id };
|
|
10
|
+
}
|
|
11
|
+
async item(id) {
|
|
12
|
+
const cmd = new GetCommand({
|
|
13
|
+
TableName: DonationsDb.table,
|
|
14
|
+
Key: this.key(id),
|
|
15
|
+
});
|
|
16
|
+
return this.client.send(cmd).then((r) => r.Item);
|
|
17
|
+
}
|
|
8
18
|
async put_txi(data) {
|
|
9
19
|
const cmd = new PutCommand({
|
|
10
20
|
TableName: DonationsDb.table,
|
package/dist/onhold-db.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Db, type TxType } from "@better-giving/db";
|
|
2
|
+
import type { IPageKeyed } from "@better-giving/types/api";
|
|
2
3
|
import type { IDonationOnHold, IDonationOnHoldAttr, TExplicit } from "./interfaces.mjs";
|
|
3
4
|
import type { IDonationsSearch } from "./schema.mjs";
|
|
4
|
-
import type { IPageKeyed } from "@better-giving/types/api";
|
|
5
5
|
export declare class OnHoldDonationsDb extends Db {
|
|
6
6
|
static readonly table = "on_hold_donations";
|
|
7
7
|
static readonly gsi_email$tx_date = "email-tx_date-gsi";
|
package/dist/onhold-db.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Db, UpdateBuilder } from "@better-giving/db";
|
|
2
1
|
import { GetCommand, PutCommand, QueryCommand, UpdateCommand, } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import { Db, UpdateBuilder } from "@better-giving/db";
|
|
3
3
|
export class OnHoldDonationsDb extends Db {
|
|
4
4
|
static table = "on_hold_donations";
|
|
5
5
|
static gsi_email$tx_date = "email-tx_date-gsi";
|
package/dist/schema.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $int_gte1 } from "@better-giving/schemas";
|
|
2
|
-
import { iso_date, startOfDay
|
|
2
|
+
import { endOfDay, iso_date, startOfDay } from "@better-giving/schemas/date";
|
|
3
3
|
import * as v from "valibot";
|
|
4
4
|
export const frequencies = ["one-time", "recurring"];
|
|
5
5
|
export const frequency = v.picklist(frequencies, "Please select donation frequency");
|
package/package.json
CHANGED
package/src/donation-msgs-db.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { QueryCommand } from "@aws-sdk/lib-dynamodb";
|
|
1
2
|
import { Db } from "@better-giving/db";
|
|
2
3
|
import type { ISODate } from "@better-giving/types/alias";
|
|
3
|
-
import type { Environment } from "@better-giving/types/list";
|
|
4
|
-
import type { IPageOpts } from "./schema.mjs";
|
|
5
|
-
import { QueryCommand } from "@aws-sdk/lib-dynamodb";
|
|
6
4
|
import type { IPageKeyed } from "@better-giving/types/api";
|
|
5
|
+
import type { Environment } from "@better-giving/types/list";
|
|
7
6
|
import type { IPublicDonor } from "./interfaces.mjs";
|
|
7
|
+
import type { IPageOpts } from "./schema.mjs";
|
|
8
8
|
|
|
9
9
|
export type DMKey = `DM#${string}`;
|
|
10
10
|
|
package/src/donations-db.mts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { Db } from "@better-giving/db";
|
|
2
|
-
import type {
|
|
3
|
-
IDonationFinal,
|
|
4
|
-
IDonationFinalAttr,
|
|
5
|
-
TExplicit,
|
|
6
|
-
} from "./interfaces.mjs";
|
|
7
1
|
import {
|
|
2
|
+
GetCommand,
|
|
8
3
|
PutCommand,
|
|
9
4
|
QueryCommand,
|
|
10
5
|
type QueryCommandInput,
|
|
11
6
|
} from "@aws-sdk/lib-dynamodb";
|
|
7
|
+
import { Db } from "@better-giving/db";
|
|
12
8
|
import type { IPageKeyed } from "@better-giving/types/api";
|
|
9
|
+
import type {
|
|
10
|
+
IDonationFinal,
|
|
11
|
+
IDonationFinalAttr,
|
|
12
|
+
TExplicit,
|
|
13
|
+
} from "./interfaces.mjs";
|
|
13
14
|
import type { IDonationsSearch } from "./schema.mjs";
|
|
14
15
|
|
|
15
16
|
type K = keyof IDonationFinalAttr;
|
|
@@ -20,6 +21,21 @@ export class DonationsDb extends Db {
|
|
|
20
21
|
static readonly gsi_npo$settled_date = "npo-settled_date-gsi";
|
|
21
22
|
static readonly gsi_email$tx_date = "email-tx_date-gsii";
|
|
22
23
|
|
|
24
|
+
key(id: string) {
|
|
25
|
+
return { transactionId: id } satisfies Pick<
|
|
26
|
+
IDonationFinalAttr,
|
|
27
|
+
"transactionId"
|
|
28
|
+
>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async item(id: string): Promise<IDonationFinal | undefined> {
|
|
32
|
+
const cmd = new GetCommand({
|
|
33
|
+
TableName: DonationsDb.table,
|
|
34
|
+
Key: this.key(id),
|
|
35
|
+
});
|
|
36
|
+
return this.client.send(cmd).then((r) => r.Item as any);
|
|
37
|
+
}
|
|
38
|
+
|
|
23
39
|
async put_txi(data: TExplicit<IDonationFinalAttr>) {
|
|
24
40
|
const cmd = new PutCommand({
|
|
25
41
|
TableName: DonationsDb.table,
|
package/src/onhold-db.mts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Db, UpdateBuilder, type TxType } from "@better-giving/db";
|
|
2
|
-
import type {
|
|
3
|
-
IDonationOnHold,
|
|
4
|
-
IDonationOnHoldAttr,
|
|
5
|
-
TExplicit,
|
|
6
|
-
} from "./interfaces.mjs";
|
|
7
1
|
import {
|
|
8
2
|
GetCommand,
|
|
9
3
|
PutCommand,
|
|
10
4
|
QueryCommand,
|
|
11
5
|
UpdateCommand,
|
|
12
6
|
} from "@aws-sdk/lib-dynamodb";
|
|
13
|
-
import type
|
|
7
|
+
import { Db, type TxType, UpdateBuilder } from "@better-giving/db";
|
|
14
8
|
import type { IPageKeyed } from "@better-giving/types/api";
|
|
9
|
+
import type {
|
|
10
|
+
IDonationOnHold,
|
|
11
|
+
IDonationOnHoldAttr,
|
|
12
|
+
TExplicit,
|
|
13
|
+
} from "./interfaces.mjs";
|
|
14
|
+
import type { IDonationsSearch } from "./schema.mjs";
|
|
15
15
|
|
|
16
16
|
type K = keyof IDonationOnHoldAttr;
|
|
17
17
|
|
package/src/schema.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $int_gte1 } from "@better-giving/schemas";
|
|
2
|
-
import { iso_date, startOfDay
|
|
2
|
+
import { endOfDay, iso_date, startOfDay } from "@better-giving/schemas/date";
|
|
3
3
|
import * as v from "valibot";
|
|
4
4
|
export const frequencies = ["one-time", "recurring"] as const;
|
|
5
5
|
export const frequency = v.picklist(
|
package/src/subscriptions-db.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ISubscription } from "./interfaces.mjs";
|
|
2
1
|
import {
|
|
3
2
|
DeleteCommand,
|
|
4
3
|
PutCommand,
|
|
5
4
|
UpdateCommand,
|
|
6
5
|
} from "@aws-sdk/lib-dynamodb";
|
|
7
6
|
import { Db, UpdateBuilder } from "@better-giving/db";
|
|
7
|
+
import type { ISubscription } from "./interfaces.mjs";
|
|
8
8
|
|
|
9
9
|
type K = keyof ISubscription;
|
|
10
10
|
export class SubsDb extends Db {
|