@moneypot/hub 1.19.1 → 1.19.3

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.
@@ -61,6 +61,11 @@ export function startWebsocketProcessor({ casinoId, graphqlUrl, signal, controll
61
61
  return true;
62
62
  },
63
63
  keepAlive: 1_000,
64
+ retryWait: async (retries) => {
65
+ const baseDelay = Math.min(1000 * Math.pow(2, retries), 30_000);
66
+ const jitter = Math.floor(Math.random() * 10_000);
67
+ await new Promise((resolve) => setTimeout(resolve, baseDelay + jitter));
68
+ },
64
69
  });
65
70
  client.on("connected", () => {
66
71
  logger.info(`[websocketProcessor] Connected to websocket ${graphqlUrl}`);
@@ -37,4 +37,7 @@ export declare function createPreset({ plugins, exportSchemaSDLPath, extraPgSche
37
37
  context: ServerContext;
38
38
  enableChat: boolean;
39
39
  enablePlayground: boolean;
40
- }): GraphileConfig.Preset;
40
+ }): {
41
+ preset: GraphileConfig.Preset;
42
+ pgService: GraphileConfig.PgServiceConfiguration<"@dataplan/pg/adaptors/pg">;
43
+ };
@@ -91,15 +91,14 @@ export function createPreset({ plugins, exportSchemaSDLPath, extraPgSchemas, abo
91
91
  if (enableChat) {
92
92
  mutablePlugins.push(HubChatCreateUserMessagePlugin, HubChatCreateSystemMessagePlugin, HubChatSubscriptionPlugin, HubChatMuteUserPlugin, HubChatUnmuteUserPlugin, HubChatAfterIdConditionPlugin, HubChatModManagementPlugin);
93
93
  }
94
+ const pgService = makePgService({
95
+ connectionString: config.DATABASE_URL,
96
+ schemas: [...extraPgSchemas, "hub"],
97
+ });
94
98
  const preset = {
95
99
  extends: [PostGraphileAmberPreset],
96
100
  disablePlugins: ["NodePlugin"],
97
- pgServices: [
98
- makePgService({
99
- connectionString: config.DATABASE_URL,
100
- schemas: [...extraPgSchemas, "hub"],
101
- }),
102
- ],
101
+ pgServices: [pgService],
103
102
  schema: {
104
103
  dontSwallowErrors: true,
105
104
  exportSchemaSDLPath,
@@ -175,7 +174,7 @@ export function createPreset({ plugins, exportSchemaSDLPath, extraPgSchemas, abo
175
174
  },
176
175
  plugins: mutablePlugins,
177
176
  };
178
- return preset;
177
+ return { preset, pgService };
179
178
  }
180
179
  function getSessionIdFromWebsocketCtx(ws) {
181
180
  const value = ws.normalizedConnectionParams?.authorization;
@@ -46,7 +46,7 @@ function createExpressServer(context) {
46
46
  }
47
47
  export function createHubServer({ configureApp, plugins, exportSchemaSDLPath, extraPgSchemas, abortSignal, context, enableChat, enablePlayground, port, }) {
48
48
  const expressServer = createExpressServer(context);
49
- const preset = createPreset({
49
+ const { preset, pgService } = createPreset({
50
50
  plugins: plugins ?? defaultPlugins,
51
51
  exportSchemaSDLPath,
52
52
  extraPgSchemas: extraPgSchemas ?? [],
@@ -78,10 +78,12 @@ export function createHubServer({ configureApp, plugins, exportSchemaSDLPath, ex
78
78
  });
79
79
  },
80
80
  shutdown: async () => {
81
+ nodeServer.closeAllConnections();
82
+ await pgService.release?.();
83
+ await pgl.release();
81
84
  await new Promise((resolve) => {
82
85
  nodeServer.close(() => resolve());
83
86
  });
84
- await pgl.release();
85
87
  },
86
88
  };
87
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneypot/hub",
3
- "version": "1.19.1",
3
+ "version": "1.19.3",
4
4
  "author": "moneypot.com",
5
5
  "homepage": "https://moneypot.com/hub",
6
6
  "keywords": [
@@ -48,47 +48,50 @@
48
48
  "build-dashboard": "cd ./dashboard && pnpm run build && rm -rf ../dist/dashboard && cp -Rv dist ../dist/dashboard",
49
49
  "test:startup": "dropdb --if-exists hub-test && createdb hub-test && SUPERUSER_DATABASE_URL=postgres://localhost:5432/hub-test DATABASE_URL=postgres://localhost:5432/hub-test tsx src/test-startup.ts",
50
50
  "test": "vitest run",
51
- "test:watch": "vitest"
51
+ "test:watch": "vitest",
52
+ "test:bail": "pnpm test -- --bail --silent --reporter=basic 2>&1 | head -25"
52
53
  },
53
54
  "dependencies": {
54
- "@graphile-contrib/pg-omit-archived": "^4.0.0-rc.1",
55
+ "@graphile-contrib/pg-omit-archived": "4.0.0-rc.1",
55
56
  "@moneypot/hash-herald": "^1.0.0",
56
57
  "@moneypot/pg-upgrade-schema": "^2.1.0",
57
- "@noble/curves": "^1.5.0",
58
58
  "dotenv": "^17.2.3",
59
- "express": "^5.0.1",
60
- "graphql": "^16.8.1",
61
- "graphql-request": "^7.0.0",
62
- "graphql-ws": "^6.0.5",
63
- "jose": "^6.0.11",
64
- "pg": "^8.12.0",
65
- "pg-connection-string": "^2.6.4",
59
+ "express": "^5.2.1",
60
+ "graphql": "^16.12.0",
61
+ "graphql-request": "^7.4.0",
62
+ "graphql-ws": "^6.0.6",
63
+ "jose": "^6.1.3",
64
+ "pg": "^8.16.3",
65
+ "pg-connection-string": "^2.9.1",
66
66
  "pino": "^10.1.0",
67
- "postgraphile": "^5.0.0-rc.3",
68
- "tsafe": "^1.6.6",
69
- "zod": "^4.1.12"
67
+ "postgraphile": "5.0.0-rc.3",
68
+ "tsafe": "^1.8.12",
69
+ "zod": "^4.1.13"
70
70
  },
71
71
  "devDependencies": {
72
- "@eslint/js": "^9.8.0",
72
+ "@eslint/js": "^9.39.2",
73
73
  "@graphql-codegen/cli": "^6.1.0",
74
74
  "@graphql-codegen/client-preset": "^5.2.1",
75
75
  "@graphql-typed-document-node/core": "^3.2.0",
76
- "@types/express": "^5.0.0",
77
- "@types/node": "^25.0.0",
78
- "@types/pg": "^8.11.5",
79
- "@types/supertest": "^6.0.2",
80
- "eslint": "^9.8.0",
81
- "globals": "^16.0.0",
82
- "pino-pretty": "^13.0.0",
83
- "prettier": "^3.6.2",
84
- "supertest": "^7.0.0",
85
- "tsx": "^4.20.3",
86
- "typescript": "^5.4.5",
87
- "typescript-eslint": "^8.0.1",
76
+ "@types/express": "^5.0.6",
77
+ "@types/node": "^25.0.1",
78
+ "@types/pg": "^8.16.0",
79
+ "@types/supertest": "^6.0.3",
80
+ "eslint": "^9.39.2",
81
+ "globals": "^16.5.0",
82
+ "pino-pretty": "^13.1.3",
83
+ "prettier": "^3.7.4",
84
+ "supertest": "^7.1.4",
85
+ "tsx": "^4.21.0",
86
+ "typescript": "^5.9.3",
87
+ "typescript-eslint": "^8.49.0",
88
88
  "vitest": "^4.0.15"
89
89
  },
90
90
  "peerDependencies": {
91
91
  "graphile-config": "^1.0.0-rc.2"
92
92
  },
93
+ "optionalDependencies": {
94
+ "@moneypot/server": "file:../moneypot-server"
95
+ },
93
96
  "license": "UNLICENSED"
94
97
  }