@moneypot/hub 1.20.0 → 1.20.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.
@@ -13,7 +13,7 @@ export const NODE_ENV = getEnvVariable("NODE_ENV", (value) => {
13
13
  });
14
14
  export const PORT = getEnvVariable("PORT", (value) => {
15
15
  const parsed = Number.parseInt(value, 10);
16
- if (!parsed || parsed <= 0 || !Number.isSafeInteger(parsed)) {
16
+ if (!Number.isSafeInteger(parsed) || parsed < 0 || isNaN(parsed)) {
17
17
  const DEFAULT_PORT = 4000;
18
18
  console.warn(`Warning: PORT missing or invalid, defaulting to ${DEFAULT_PORT}`);
19
19
  return DEFAULT_PORT;
@@ -3,7 +3,7 @@ import { DbUser, DbPlayerBalance, DbHashChain, DbCasino, DbExperience, DbCurrenc
3
3
  import { GraphQLClient } from "graphql-request";
4
4
  import { ServerOptions } from "../index.js";
5
5
  import type { QueryExecutor } from "../db/util.js";
6
- import { LiabilityConfigInternal } from "../liability/public/config.js";
6
+ import { LiabilityConfig } from "../liability/public/config.js";
7
7
  export { type QueryExecutor };
8
8
  export declare function uniqueTestId(): string;
9
9
  export type HubTestServer = {
@@ -65,7 +65,7 @@ export declare function getPlayerBalance(pgClient: QueryExecutor, { userId, expe
65
65
  currencyKey: DbCurrency["key"];
66
66
  }): Promise<DbPlayerBalance | null>;
67
67
  export declare function processOneDeadlinedLiability<RefType extends string>(dbPool: pg.Pool, { liabilityConfig, refType, refId, }: {
68
- liabilityConfig: LiabilityConfigInternal<RefType>;
68
+ liabilityConfig: LiabilityConfig<RefType>;
69
69
  refType: RefType;
70
70
  refId: string;
71
71
  }): Promise<void>;
@@ -176,13 +176,16 @@ export async function getPlayerBalance(pgClient, { userId, experienceId, currenc
176
176
  .then((row) => row ?? null);
177
177
  }
178
178
  export async function processOneDeadlinedLiability(dbPool, { liabilityConfig, refType, refId, }) {
179
+ if (!("_refTypes" in liabilityConfig)) {
180
+ throw new Error("liabilityConfig must be created via createLiabilityConfig()");
181
+ }
179
182
  await withPgPoolTransaction(dbPool, async (pgClient) => {
180
183
  const dbLiability = await dbGetLiabilityByRef(pgClient, { refType, refId });
181
184
  if (!dbLiability) {
182
185
  throw new Error(`Liability not found: refType=${refType}, refId=${refId}`);
183
186
  }
184
187
  return internalProcessOneDeadlinedLiability(pgClient, {
185
- liabilityConfig,
188
+ liabilityConfig: liabilityConfig,
186
189
  liabilityId: dbLiability.id,
187
190
  });
188
191
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneypot/hub",
3
- "version": "1.20.0",
3
+ "version": "1.20.2",
4
4
  "author": "moneypot.com",
5
5
  "homepage": "https://moneypot.com/hub",
6
6
  "keywords": [