@moneypot/hub 1.3.0-dev.11 → 1.3.0-dev.13
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/hash-chain/db-hash-chain.js +1 -1
- package/dist/src/plugins/hub-make-outcome-bet.d.ts +10 -10
- package/dist/src/plugins/hub-make-outcome-bet.js +5 -5
- package/dist/src/plugins/hub-outcome-input-non-null-fields.d.ts +18 -0
- package/dist/src/plugins/hub-outcome-input-non-null-fields.js +20 -0
- package/dist/src/server/graphile.config.js +2 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { exactlyOneRow, maybeOneRow, } from "../db/index.js";
|
|
2
2
|
import { assert } from "tsafe";
|
|
3
3
|
export async function dbLockHubHashChain(pgClient, { userId, experienceId, casinoId, hashChainId, }) {
|
|
4
|
-
assert(pgClient._inTransaction, "
|
|
4
|
+
assert(pgClient._inTransaction, "dbLockHubHashChain must be called in a transaction");
|
|
5
5
|
return pgClient
|
|
6
6
|
.query(`
|
|
7
7
|
SELECT *
|
|
@@ -4,11 +4,11 @@ declare const OutcomeSchema: z.ZodObject<{
|
|
|
4
4
|
weight: z.ZodNumber;
|
|
5
5
|
profit: z.ZodNumber;
|
|
6
6
|
}, "strict", z.ZodTypeAny, {
|
|
7
|
-
weight: number;
|
|
8
7
|
profit: number;
|
|
9
|
-
}, {
|
|
10
8
|
weight: number;
|
|
9
|
+
}, {
|
|
11
10
|
profit: number;
|
|
11
|
+
weight: number;
|
|
12
12
|
}>;
|
|
13
13
|
declare const InputSchema: z.ZodObject<{
|
|
14
14
|
kind: z.ZodString;
|
|
@@ -18,23 +18,23 @@ declare const InputSchema: z.ZodObject<{
|
|
|
18
18
|
weight: z.ZodNumber;
|
|
19
19
|
profit: z.ZodNumber;
|
|
20
20
|
}, "strict", z.ZodTypeAny, {
|
|
21
|
-
weight: number;
|
|
22
21
|
profit: number;
|
|
23
|
-
}, {
|
|
24
22
|
weight: number;
|
|
23
|
+
}, {
|
|
25
24
|
profit: number;
|
|
26
|
-
}>, "many">, {
|
|
27
25
|
weight: number;
|
|
26
|
+
}>, "many">, {
|
|
28
27
|
profit: number;
|
|
29
|
-
}[], {
|
|
30
28
|
weight: number;
|
|
29
|
+
}[], {
|
|
31
30
|
profit: number;
|
|
32
|
-
}[]>, {
|
|
33
31
|
weight: number;
|
|
32
|
+
}[]>, {
|
|
34
33
|
profit: number;
|
|
35
|
-
}[], {
|
|
36
34
|
weight: number;
|
|
35
|
+
}[], {
|
|
37
36
|
profit: number;
|
|
37
|
+
weight: number;
|
|
38
38
|
}[]>;
|
|
39
39
|
hashChainId: z.ZodString;
|
|
40
40
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
@@ -44,8 +44,8 @@ declare const InputSchema: z.ZodObject<{
|
|
|
44
44
|
kind: string;
|
|
45
45
|
wager: number;
|
|
46
46
|
outcomes: {
|
|
47
|
-
weight: number;
|
|
48
47
|
profit: number;
|
|
48
|
+
weight: number;
|
|
49
49
|
}[];
|
|
50
50
|
metadata?: Record<string, any> | undefined;
|
|
51
51
|
}, {
|
|
@@ -54,8 +54,8 @@ declare const InputSchema: z.ZodObject<{
|
|
|
54
54
|
kind: string;
|
|
55
55
|
wager: number;
|
|
56
56
|
outcomes: {
|
|
57
|
-
weight: number;
|
|
58
57
|
profit: number;
|
|
58
|
+
weight: number;
|
|
59
59
|
}[];
|
|
60
60
|
metadata?: Record<string, any> | undefined;
|
|
61
61
|
}>;
|
|
@@ -78,11 +78,11 @@ export function MakeOutcomeBetPlugin({ betConfigs }) {
|
|
|
78
78
|
metadata: JSON
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
type
|
|
81
|
+
type HubMakeOutcomeBetSuccess {
|
|
82
82
|
bet: HubOutcomeBet!
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
union HubMakeOutcomeBetResult =
|
|
85
|
+
union HubMakeOutcomeBetResult = HubMakeOutcomeBetSuccess | HubBadHashChainError
|
|
86
86
|
|
|
87
87
|
type HubMakeOutcomeBetPayload {
|
|
88
88
|
result: HubMakeOutcomeBetResult!
|
|
@@ -340,7 +340,7 @@ export function MakeOutcomeBetPlugin({ betConfigs }) {
|
|
|
340
340
|
})
|
|
341
341
|
.then(exactlyOneRow);
|
|
342
342
|
return {
|
|
343
|
-
__typename: "
|
|
343
|
+
__typename: "HubMakeOutcomeBetSuccess",
|
|
344
344
|
betId: bet.id,
|
|
345
345
|
};
|
|
346
346
|
});
|
|
@@ -350,7 +350,7 @@ export function MakeOutcomeBetPlugin({ betConfigs }) {
|
|
|
350
350
|
});
|
|
351
351
|
},
|
|
352
352
|
},
|
|
353
|
-
|
|
353
|
+
HubMakeOutcomeBetSuccess: {
|
|
354
354
|
__assertStep: ObjectStep,
|
|
355
355
|
bet($data) {
|
|
356
356
|
const $betId = access($data, "betId");
|
|
@@ -362,7 +362,7 @@ export function MakeOutcomeBetPlugin({ betConfigs }) {
|
|
|
362
362
|
result($data) {
|
|
363
363
|
const $result = $data.get("result");
|
|
364
364
|
return polymorphicBranch($result, {
|
|
365
|
-
|
|
365
|
+
HubMakeOutcomeBetSuccess: {},
|
|
366
366
|
HubBadHashChainError: {},
|
|
367
367
|
});
|
|
368
368
|
},
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GraphQLInputFieldConfig } from "graphql";
|
|
2
|
+
export declare const HubOutcomeInputNonNullFieldsPlugin: {
|
|
3
|
+
name: string;
|
|
4
|
+
version: string;
|
|
5
|
+
description: string;
|
|
6
|
+
schema: {
|
|
7
|
+
hooks: {
|
|
8
|
+
GraphQLInputObjectType_fields_field: (field: GraphQLInputFieldConfig, build: any, context: any) => {
|
|
9
|
+
type: any;
|
|
10
|
+
description?: import("graphql/jsutils/Maybe.js").Maybe<string>;
|
|
11
|
+
defaultValue?: unknown;
|
|
12
|
+
deprecationReason?: import("graphql/jsutils/Maybe.js").Maybe<string>;
|
|
13
|
+
extensions?: import("graphql/jsutils/Maybe.js").Maybe<Readonly<import("graphql").GraphQLInputFieldExtensions>>;
|
|
14
|
+
astNode?: import("graphql/jsutils/Maybe.js").Maybe<import("graphql").InputValueDefinitionNode>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const HubOutcomeInputNonNullFieldsPlugin = {
|
|
2
|
+
name: "HubOutcomeInputNonNullFieldsPlugin",
|
|
3
|
+
version: "0.0.0",
|
|
4
|
+
description: "Specifies that HubOutcomeInput fields are non-null",
|
|
5
|
+
schema: {
|
|
6
|
+
hooks: {
|
|
7
|
+
GraphQLInputObjectType_fields_field: (field, build, context) => {
|
|
8
|
+
const { scope: { fieldName }, } = context;
|
|
9
|
+
if (context.scope.pgCodec?.name === "hubOutcome" &&
|
|
10
|
+
["profit", "weight"].includes(fieldName)) {
|
|
11
|
+
return {
|
|
12
|
+
...field,
|
|
13
|
+
type: new build.graphql.GraphQLNonNull(field.type),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return field;
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -23,6 +23,7 @@ import { HubCurrentXPlugin } from "../plugins/hub-current-x.js";
|
|
|
23
23
|
import { HubCreateHashChainPlugin } from "../hash-chain/plugins/hub-create-hash-chain.js";
|
|
24
24
|
import { HubBadHashChainErrorPlugin } from "../hash-chain/plugins/hub-bad-hash-chain-error.js";
|
|
25
25
|
import { HubUserActiveHashChainPlugin } from "../hash-chain/plugins/hub-user-active-hash-chain.js";
|
|
26
|
+
import { HubOutcomeInputNonNullFieldsPlugin } from "../plugins/hub-outcome-input-non-null-fields.js";
|
|
26
27
|
export const requiredPlugins = [
|
|
27
28
|
SmartTagsPlugin,
|
|
28
29
|
IdToNodeIdPlugin,
|
|
@@ -38,6 +39,7 @@ export const requiredPlugins = [
|
|
|
38
39
|
export const defaultPlugins = [
|
|
39
40
|
...(config.NODE_ENV === "development" ? [DebugPlugin] : []),
|
|
40
41
|
...requiredPlugins,
|
|
42
|
+
HubOutcomeInputNonNullFieldsPlugin,
|
|
41
43
|
HubBadHashChainErrorPlugin,
|
|
42
44
|
HubCreateHashChainPlugin,
|
|
43
45
|
HubUserActiveHashChainPlugin,
|