@moneypot/hub 1.9.0-dev.1 → 1.9.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { access, context, object, ObjectStep, sideEffect, } from "postgraphile/grafast";
|
|
2
2
|
import { gql, makeExtendSchemaPlugin } from "postgraphile/utils";
|
|
3
|
-
import
|
|
3
|
+
import * as z from "zod";
|
|
4
4
|
import { GraphQLError } from "graphql";
|
|
5
5
|
import { DbHashKind, dbLockPlayerBalanceAndHouseBankroll, exactlyOneRow, maybeOneRow, superuserPool, withPgPoolTransaction, } from "../db/index.js";
|
|
6
6
|
import { assert } from "tsafe";
|
|
@@ -65,8 +65,8 @@ const BetConfigsSchema = z.record(BetKindSchema, z.object({
|
|
|
65
65
|
.optional(),
|
|
66
66
|
}));
|
|
67
67
|
const RiskLimitsSchema = z.object({
|
|
68
|
-
maxWager: z.number().finite().int().positive(),
|
|
69
|
-
maxPayout: z.number().finite().int().positive(),
|
|
68
|
+
maxWager: z.number().finite().int().positive().optional(),
|
|
69
|
+
maxPayout: z.number().finite().int().positive().optional(),
|
|
70
70
|
});
|
|
71
71
|
export function MakeOutcomeBetPlugin({ betConfigs }) {
|
|
72
72
|
BetConfigsSchema.parse(betConfigs);
|
|
@@ -202,7 +202,8 @@ export function MakeOutcomeBetPlugin({ betConfigs }) {
|
|
|
202
202
|
})
|
|
203
203
|
: {});
|
|
204
204
|
if (!riskLimitsResult.success) {
|
|
205
|
-
|
|
205
|
+
logger.error(riskLimitsResult.error, "Invalid risk policy");
|
|
206
|
+
throw new GraphQLError("Invalid risk policy");
|
|
206
207
|
}
|
|
207
208
|
const riskLimits = riskLimitsResult.data;
|
|
208
209
|
if (riskLimits.maxWager != null &&
|