@better-giving/donation 3.0.24 → 3.0.26
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/donations-db.d.mts +2 -0
- package/dist/donations-db.mjs +25 -2
- package/dist/onhold-db.d.mts +1 -0
- package/dist/onhold-db.mjs +11 -0
- package/package.json +1 -1
- package/src/donations-db.mts +33 -2
- package/src/onhold-db.mts +15 -0
package/dist/donations-db.d.mts
CHANGED
|
@@ -13,6 +13,8 @@ export declare class DonationsDb extends Db {
|
|
|
13
13
|
};
|
|
14
14
|
item(id: string): Promise<IDonationFinal | undefined>;
|
|
15
15
|
put_txi(data: IDonationFinalAttr): TxType["Put"];
|
|
16
|
+
update(id: string, data: Partial<Omit<IDonationFinalAttr, "transactionId">>): Promise<IDonationFinal>;
|
|
17
|
+
update_txi(id: string, data: Partial<Omit<IDonationFinalAttr, "transactionId">>): Promise<TxType["Update"]>;
|
|
16
18
|
referred_by_q(referrer: string, opts?: IPageOpts): QueryCommandInput;
|
|
17
19
|
referred_by(referrer: string, opts?: IPageOpts): Promise<IPageKeyed<IDonationFinal>>;
|
|
18
20
|
list_to_npo(npo: number, opts?: IDonationsSearch & {
|
package/dist/donations-db.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GetCommand,
|
|
2
|
-
import { Db } from "@better-giving/db";
|
|
1
|
+
import { GetCommand, QueryCommand, UpdateCommand, } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import { Db, UpdateBuilder } from "@better-giving/db";
|
|
3
3
|
export class DonationsDb extends Db {
|
|
4
4
|
static gsi_referrer$settled_date = "Referrer-FinalizedDate_Index";
|
|
5
5
|
static gsi_npo$settled_date = "npo-settled_date-gsi";
|
|
@@ -24,6 +24,29 @@ export class DonationsDb extends Db {
|
|
|
24
24
|
ConditionExpression: `attribute_not_exists(${"transactionId"})`,
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
+
async update(id, data) {
|
|
28
|
+
const upd8 = new UpdateBuilder();
|
|
29
|
+
for (const k in data) {
|
|
30
|
+
upd8.set(k, data[k]);
|
|
31
|
+
}
|
|
32
|
+
const cmd = new UpdateCommand({
|
|
33
|
+
TableName: this.table,
|
|
34
|
+
Key: this.key(id),
|
|
35
|
+
...upd8.collect(),
|
|
36
|
+
});
|
|
37
|
+
return this.client.send(cmd).then((r) => r.Attributes);
|
|
38
|
+
}
|
|
39
|
+
async update_txi(id, data) {
|
|
40
|
+
const upd8 = new UpdateBuilder();
|
|
41
|
+
for (const k in data) {
|
|
42
|
+
upd8.set(k, data[k]);
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
TableName: this.table,
|
|
46
|
+
Key: this.key(id),
|
|
47
|
+
...upd8.collect(),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
27
50
|
referred_by_q(referrer, opts) {
|
|
28
51
|
const q = {
|
|
29
52
|
TableName: this.table,
|
package/dist/onhold-db.d.mts
CHANGED
|
@@ -10,6 +10,7 @@ export declare class OnHoldDonationsDb extends Db {
|
|
|
10
10
|
};
|
|
11
11
|
put(data: IDonationOnHoldAttr): Promise<import("@aws-sdk/lib-dynamodb").PutCommandOutput>;
|
|
12
12
|
update(id: string, data: Partial<Omit<IDonationOnHoldAttr, "transactionId">>): Promise<IDonationOnHold>;
|
|
13
|
+
update_txi(id: string, data: Partial<Omit<IDonationOnHoldAttr, "transactionId">>): Promise<TxType["Update"]>;
|
|
13
14
|
item(id: string): Promise<IDonationOnHold | undefined>;
|
|
14
15
|
put_txi(data: IDonationOnHoldAttr): Promise<import("@aws-sdk/lib-dynamodb").PutCommandOutput>;
|
|
15
16
|
del_txi(id: string): TxType["Delete"];
|
package/dist/onhold-db.mjs
CHANGED
|
@@ -30,6 +30,17 @@ export class OnHoldDonationsDb extends Db {
|
|
|
30
30
|
});
|
|
31
31
|
return this.client.send(cmd).then((r) => r.Attributes);
|
|
32
32
|
}
|
|
33
|
+
async update_txi(id, data) {
|
|
34
|
+
const upd8 = new UpdateBuilder();
|
|
35
|
+
for (const k in data) {
|
|
36
|
+
upd8.set(k, data[k]);
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
TableName: this.table,
|
|
40
|
+
Key: this.key(id),
|
|
41
|
+
...upd8.collect(),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
33
44
|
async item(id) {
|
|
34
45
|
const cmd = new GetCommand({
|
|
35
46
|
TableName: this.table,
|
package/package.json
CHANGED
package/src/donations-db.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GetCommand,
|
|
3
|
-
PutCommand,
|
|
4
3
|
QueryCommand,
|
|
5
4
|
type QueryCommandInput,
|
|
5
|
+
UpdateCommand,
|
|
6
6
|
} from "@aws-sdk/lib-dynamodb";
|
|
7
|
-
import { Db, type TxType } from "@better-giving/db";
|
|
7
|
+
import { Db, type TxType, UpdateBuilder } from "@better-giving/db";
|
|
8
8
|
import type { IPageKeyed } from "@better-giving/types/api";
|
|
9
9
|
import type { IDonationFinal, IDonationFinalAttr } from "./interfaces.mjs";
|
|
10
10
|
import type { IDonationsSearch, IPageOpts } from "./schema.mjs";
|
|
@@ -43,6 +43,37 @@ export class DonationsDb extends Db {
|
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
async update(
|
|
47
|
+
id: string,
|
|
48
|
+
data: Partial<Omit<IDonationFinalAttr, "transactionId">>
|
|
49
|
+
): Promise<IDonationFinal> {
|
|
50
|
+
const upd8 = new UpdateBuilder();
|
|
51
|
+
for (const k in data) {
|
|
52
|
+
upd8.set(k, (data as any)[k]);
|
|
53
|
+
}
|
|
54
|
+
const cmd = new UpdateCommand({
|
|
55
|
+
TableName: this.table,
|
|
56
|
+
Key: this.key(id),
|
|
57
|
+
...upd8.collect(),
|
|
58
|
+
});
|
|
59
|
+
return this.client.send(cmd).then((r) => r.Attributes as any);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async update_txi(
|
|
63
|
+
id: string,
|
|
64
|
+
data: Partial<Omit<IDonationFinalAttr, "transactionId">>
|
|
65
|
+
): Promise<TxType["Update"]> {
|
|
66
|
+
const upd8 = new UpdateBuilder();
|
|
67
|
+
for (const k in data) {
|
|
68
|
+
upd8.set(k as K, (data as any)[k]);
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
TableName: this.table,
|
|
72
|
+
Key: this.key(id),
|
|
73
|
+
...upd8.collect(),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
46
77
|
referred_by_q(referrer: string, opts?: IPageOpts) {
|
|
47
78
|
const q: QueryCommandInput = {
|
|
48
79
|
TableName: this.table,
|
package/src/onhold-db.mts
CHANGED
|
@@ -53,6 +53,21 @@ export class OnHoldDonationsDb extends Db {
|
|
|
53
53
|
return this.client.send(cmd).then((r) => r.Attributes as any);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
async update_txi(
|
|
57
|
+
id: string,
|
|
58
|
+
data: Partial<Omit<IDonationOnHoldAttr, "transactionId">>
|
|
59
|
+
): Promise<TxType["Update"]> {
|
|
60
|
+
const upd8 = new UpdateBuilder();
|
|
61
|
+
for (const k in data) {
|
|
62
|
+
upd8.set(k as K, (data as any)[k]);
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
TableName: this.table,
|
|
66
|
+
Key: this.key(id),
|
|
67
|
+
...upd8.collect(),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
56
71
|
async item(id: string): Promise<IDonationOnHold | undefined> {
|
|
57
72
|
const cmd = new GetCommand({
|
|
58
73
|
TableName: this.table,
|