@better-giving/donation 3.0.18 → 3.0.19

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.
@@ -1,5 +1,5 @@
1
1
  import { type QueryCommandInput } from "@aws-sdk/lib-dynamodb";
2
- import { Db } from "@better-giving/db";
2
+ import { Db, type TxType } from "@better-giving/db";
3
3
  import type { IPageKeyed } from "@better-giving/types/api";
4
4
  import type { IDonationFinal, IDonationFinalAttr, TExplicit } from "./interfaces.mjs";
5
5
  import type { IDonationsSearch, IPageOpts } from "./schema.mjs";
@@ -12,7 +12,7 @@ export declare class DonationsDb extends Db {
12
12
  transactionId: string;
13
13
  };
14
14
  item(id: string): Promise<IDonationFinal | undefined>;
15
- put_txi(data: TExplicit<IDonationFinalAttr>): Promise<import("@aws-sdk/lib-dynamodb").PutCommandOutput>;
15
+ put_txi(data: TExplicit<IDonationFinalAttr>): TxType["Put"];
16
16
  referred_by_q(referrer: string, opts?: IPageOpts): QueryCommandInput;
17
17
  referred_by(referrer: string, opts?: IPageOpts): Promise<IPageKeyed<IDonationFinal>>;
18
18
  list_to_npo(npo: number, opts?: IDonationsSearch & {
@@ -18,12 +18,11 @@ export class DonationsDb extends Db {
18
18
  return this.client.send(cmd).then((r) => r.Item);
19
19
  }
20
20
  put_txi(data) {
21
- const cmd = new PutCommand({
21
+ return {
22
22
  TableName: this.table,
23
23
  Item: data,
24
24
  ConditionExpression: `attribute_not_exists(${"transactionId"})`,
25
- });
26
- return this.client.send(cmd);
25
+ };
27
26
  }
28
27
  referred_by_q(referrer, opts) {
29
28
  const q = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-giving/donation",
3
- "version": "3.0.18",
3
+ "version": "3.0.19",
4
4
  "devDependencies": {
5
5
  "@better-giving/config": "1.1.2"
6
6
  },
@@ -4,7 +4,7 @@ import {
4
4
  QueryCommand,
5
5
  type QueryCommandInput,
6
6
  } from "@aws-sdk/lib-dynamodb";
7
- import { Db } from "@better-giving/db";
7
+ import { Db, type TxType } from "@better-giving/db";
8
8
  import type { IPageKeyed } from "@better-giving/types/api";
9
9
  import type {
10
10
  IDonationFinal,
@@ -39,13 +39,12 @@ export class DonationsDb extends Db {
39
39
  return this.client.send(cmd).then((r) => r.Item as any);
40
40
  }
41
41
 
42
- put_txi(data: TExplicit<IDonationFinalAttr>) {
43
- const cmd = new PutCommand({
42
+ put_txi(data: TExplicit<IDonationFinalAttr>): TxType["Put"] {
43
+ return {
44
44
  TableName: this.table,
45
45
  Item: data,
46
46
  ConditionExpression: `attribute_not_exists(${"transactionId" satisfies keyof IDonationFinalAttr})`,
47
- });
48
- return this.client.send(cmd);
47
+ };
49
48
  }
50
49
 
51
50
  referred_by_q(referrer: string, opts?: IPageOpts) {