@moneypot/hub 1.10.0-dev.1 → 1.10.0

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/README.md CHANGED
@@ -76,6 +76,16 @@ insert into hub.api_key default values returning key;
76
76
 
77
77
  ## Changelog
78
78
 
79
+ ### 1.10.x
80
+
81
+ - Migrated database-related "globals" into a `ServerContext` object.
82
+ - Changed `configureApp(app: ExpressServer)` to `configureApp(args: { app: ExpressServer, context: ServerContext })`
83
+ - In a postgraphile plugin, you can access the superuser database pool via `const $superuserPool = context().get("superuserPool");`
84
+
85
+ ### 1.9.x
86
+
87
+ - Added a required risk policy to `makeOutcomeBet` and a reusable `validateRisk` function that can be used in custom bet plugins / endpoints to decide how much bankroll you want to risk on a bet.
88
+
79
89
  ### 1.8.x
80
90
 
81
91
  - Added [pino](https://getpino.io) for logging.
@@ -21,8 +21,12 @@ export { MakeOutcomeBetPlugin, type OutcomeBetConfigMap, type OutcomeBetConfig,
21
21
  export { validateRisk, type RiskPolicy, type RiskPolicyArgs, type RiskLimits, } from "./risk-policy.js";
22
22
  export type PluginContext = Grafast.Context;
23
23
  export { defaultPlugins, type PluginIdentity, type UserSessionContext, } from "./server/graphile.config.js";
24
+ export type ConfigureAppArgs = {
25
+ app: Express;
26
+ context: ServerContext;
27
+ };
24
28
  export type ServerOptions = {
25
- configureApp?: (app: Express) => void;
29
+ configureApp?: (args: ConfigureAppArgs) => void;
26
30
  plugins?: readonly GraphileConfig.Plugin[];
27
31
  extraPgSchemas?: string[];
28
32
  exportSchemaSDLPath?: string;
@@ -57,7 +57,7 @@ export function createHubServer({ configureApp, plugins, exportSchemaSDLPath, ex
57
57
  const pgl = postgraphile.default(preset);
58
58
  const serv = pgl.createServ(grafserv);
59
59
  if (configureApp) {
60
- configureApp(expressServer);
60
+ configureApp({ app: expressServer, context });
61
61
  }
62
62
  const nodeServer = createNodeServer(expressServer);
63
63
  nodeServer.on("error", (e) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneypot/hub",
3
- "version": "1.10.0-dev.1",
3
+ "version": "1.10.0",
4
4
  "author": "moneypot.com",
5
5
  "homepage": "https://moneypot.com/hub",
6
6
  "keywords": [