@moneypot/hub 1.20.0-dev.1 → 1.20.0-dev.2
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/src/db/util.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { QueryResult, QueryResultRow } from "pg";
|
|
2
2
|
import { PgClientResult } from "postgraphile/@dataplan/pg";
|
|
3
3
|
import * as pg from "pg";
|
|
4
|
-
|
|
4
|
+
import { Prettify } from "../util.js";
|
|
5
|
+
export type QueryExecutor = Prettify<Pick<pg.Pool, "query"> | Pick<pg.ClientBase, "query">>;
|
|
5
6
|
type ResultType<T> = PgClientResult<T> | QueryResult<T extends QueryResultRow ? T : never>;
|
|
6
7
|
export declare function maybeOneRow<T>(result: ResultType<T>): T | undefined;
|
|
7
8
|
export declare function exactlyOneRow<T>(result: ResultType<T>): T;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DbLockedHouseBankrollWithAvailable, DbLockedPlayerBalance, PgClientInTransaction } from "../../db/index.js";
|
|
2
2
|
import { Branded } from "../../util.js";
|
|
3
|
-
import type { DbLiability } from "../types.js";
|
|
4
|
-
import { dbCreateLiability, dbResolveLiabilityByRef } from "./db.js";
|
|
3
|
+
import type { DbLiability, NewLiability } from "../types.js";
|
|
5
4
|
export type DbLockedLiability<RefType extends string = string> = DbLiability & {
|
|
6
5
|
ref_type: RefType;
|
|
7
6
|
};
|
|
@@ -23,8 +22,14 @@ export declare function createLiabilityConfig<RefType extends string>(refTypes:
|
|
|
23
22
|
[K in RefType]: LiabilityRefTypeConfig<K>;
|
|
24
23
|
}, options?: Partial<LiabilityConfigOptions>): LiabilityConfig<RefType>;
|
|
25
24
|
export type LiabilityConfig<RefType extends string> = {
|
|
26
|
-
dbCreateLiability:
|
|
27
|
-
|
|
25
|
+
dbCreateLiability: <T extends RefType>(pgClient: PgClientInTransaction, args: NewLiability<T>) => Promise<DbLiability & {
|
|
26
|
+
ref_type: T;
|
|
27
|
+
}>;
|
|
28
|
+
dbResolveLiabilityByRef: <T extends RefType>(pgClient: PgClientInTransaction, args: {
|
|
29
|
+
refType: T;
|
|
30
|
+
refId: string;
|
|
31
|
+
lockedBankrollId: string;
|
|
32
|
+
}) => Promise<boolean>;
|
|
28
33
|
};
|
|
29
34
|
export type LiabilityConfigOptions = {
|
|
30
35
|
pollIntervalMs: number;
|
package/dist/src/util.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ declare const BRAND: unique symbol;
|
|
|
3
3
|
export type Branded<Brand, T> = T & {
|
|
4
4
|
readonly [BRAND]: Brand;
|
|
5
5
|
};
|
|
6
|
+
export type Prettify<T> = {
|
|
7
|
+
[K in keyof T]: T[K];
|
|
8
|
+
} & {};
|
|
6
9
|
export declare function isUuid(input: any): boolean;
|
|
7
10
|
export type Result<V, E> = {
|
|
8
11
|
ok: true;
|