@moneypot/hub 1.19.9 → 1.19.10
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/index.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ export type ServerOptions = {
|
|
|
35
35
|
enableChat?: boolean;
|
|
36
36
|
enablePlayground?: boolean;
|
|
37
37
|
port?: number;
|
|
38
|
+
superuserDatabaseUrl?: string;
|
|
39
|
+
postgraphileDatabaseUrl?: string;
|
|
38
40
|
};
|
|
39
41
|
export declare function startAndListen(options: ServerOptions): Promise<{
|
|
40
42
|
port: number;
|
package/dist/src/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { NODE_ENV, PORT, SUPERUSER_DATABASE_URL, DATABASE_URL, } from "./config.js";
|
|
2
2
|
import { logger } from "./logger.js";
|
|
3
3
|
import { createHubServer } from "./server/index.js";
|
|
4
4
|
export { HubGameConfigPlugin, } from "./plugins/hub-game-config-plugin.js";
|
|
@@ -25,14 +25,16 @@ export async function startAndListen(options) {
|
|
|
25
25
|
userDatabaseMigrationsPath: options.userDatabaseMigrationsPath,
|
|
26
26
|
});
|
|
27
27
|
const hubServer = createHubServer({
|
|
28
|
+
superuserDatabaseUrl: options.superuserDatabaseUrl ?? SUPERUSER_DATABASE_URL,
|
|
29
|
+
postgraphileDatabaseUrl: options.postgraphileDatabaseUrl ?? DATABASE_URL,
|
|
28
30
|
configureApp: options.configureApp,
|
|
29
31
|
plugins: options.plugins,
|
|
30
32
|
exportSchemaSDLPath: options.exportSchemaSDLPath,
|
|
31
33
|
extraPgSchemas: options.extraPgSchemas,
|
|
32
34
|
enableChat: options.enableChat ?? true,
|
|
33
35
|
enablePlayground: options.enablePlayground ?? true,
|
|
34
|
-
port: options.port ??
|
|
35
|
-
runProcessors:
|
|
36
|
+
port: options.port ?? PORT,
|
|
37
|
+
runProcessors: NODE_ENV !== "test",
|
|
36
38
|
});
|
|
37
39
|
if (process.env.NODE_ENV !== "test") {
|
|
38
40
|
const handler = () => {
|
|
@@ -29,7 +29,7 @@ export declare const requiredPlugins: readonly GraphileConfig.Plugin[];
|
|
|
29
29
|
export declare const defaultPlugins: readonly GraphileConfig.Plugin[];
|
|
30
30
|
import { HubGameConfigPlugin } from "../plugins/hub-game-config-plugin.js";
|
|
31
31
|
export type HubPlugin = GraphileConfig.Plugin | HubGameConfigPlugin;
|
|
32
|
-
export declare function createPreset({ plugins, exportSchemaSDLPath, extraPgSchemas, abortSignal, context, enableChat, enablePlayground, }: {
|
|
32
|
+
export declare function createPreset({ plugins, exportSchemaSDLPath, extraPgSchemas, abortSignal, context, enableChat, enablePlayground, postgraphileDatabaseUrl, }: {
|
|
33
33
|
plugins: readonly HubPlugin[];
|
|
34
34
|
exportSchemaSDLPath?: string;
|
|
35
35
|
extraPgSchemas: string[];
|
|
@@ -37,6 +37,7 @@ export declare function createPreset({ plugins, exportSchemaSDLPath, extraPgSche
|
|
|
37
37
|
context: ServerContext;
|
|
38
38
|
enableChat: boolean;
|
|
39
39
|
enablePlayground: boolean;
|
|
40
|
+
postgraphileDatabaseUrl: string;
|
|
40
41
|
}): {
|
|
41
42
|
preset: GraphileConfig.Preset;
|
|
42
43
|
pgService: GraphileConfig.PgServiceConfiguration<"@dataplan/pg/adaptors/pg">;
|
|
@@ -2,7 +2,7 @@ import "graphile-config";
|
|
|
2
2
|
import "postgraphile";
|
|
3
3
|
import { makePgService } from "postgraphile/adaptors/pg";
|
|
4
4
|
import { PostGraphileAmberPreset } from "postgraphile/presets/amber";
|
|
5
|
-
import
|
|
5
|
+
import { NODE_ENV } from "../config.js";
|
|
6
6
|
import { maskError } from "./handle-errors.js";
|
|
7
7
|
import * as db from "../db/index.js";
|
|
8
8
|
import { SmartTagsPlugin } from "../smart-tags.js";
|
|
@@ -53,11 +53,11 @@ export const requiredPlugins = [
|
|
|
53
53
|
customPgOmitArchivedPlugin("deleted"),
|
|
54
54
|
];
|
|
55
55
|
export const defaultPlugins = [
|
|
56
|
-
...(
|
|
56
|
+
...(NODE_ENV === "development" ? [DebugPlugin] : []),
|
|
57
57
|
...requiredPlugins,
|
|
58
58
|
];
|
|
59
59
|
import { HubGameConfigPlugin, isHubGameConfigPlugin, expandHubGameConfigPlugin, } from "../plugins/hub-game-config-plugin.js";
|
|
60
|
-
export function createPreset({ plugins, exportSchemaSDLPath, extraPgSchemas, abortSignal, context, enableChat, enablePlayground, }) {
|
|
60
|
+
export function createPreset({ plugins, exportSchemaSDLPath, extraPgSchemas, abortSignal, context, enableChat, enablePlayground, postgraphileDatabaseUrl, }) {
|
|
61
61
|
if (exportSchemaSDLPath) {
|
|
62
62
|
if (!exportSchemaSDLPath.startsWith("/")) {
|
|
63
63
|
throw new Error("exportSchemaSDLPath must be an absolute path");
|
|
@@ -93,7 +93,7 @@ export function createPreset({ plugins, exportSchemaSDLPath, extraPgSchemas, abo
|
|
|
93
93
|
mutablePlugins.push(HubChatCreateUserMessagePlugin, HubChatCreateSystemMessagePlugin, HubChatSubscriptionPlugin, HubChatMuteUserPlugin, HubChatUnmuteUserPlugin, HubChatAfterIdConditionPlugin, HubChatModManagementPlugin);
|
|
94
94
|
}
|
|
95
95
|
const pgService = makePgService({
|
|
96
|
-
connectionString:
|
|
96
|
+
connectionString: postgraphileDatabaseUrl,
|
|
97
97
|
schemas: [...extraPgSchemas, "hub"],
|
|
98
98
|
});
|
|
99
99
|
const preset = {
|
|
@@ -20,7 +20,7 @@ export type CreateHubServerOptions = {
|
|
|
20
20
|
enablePlayground: boolean;
|
|
21
21
|
port: number;
|
|
22
22
|
runProcessors: boolean;
|
|
23
|
-
superuserDatabaseUrl
|
|
24
|
-
postgraphileDatabaseUrl
|
|
23
|
+
superuserDatabaseUrl: string;
|
|
24
|
+
postgraphileDatabaseUrl: string;
|
|
25
25
|
};
|
|
26
26
|
export declare function createHubServer({ configureApp, plugins, exportSchemaSDLPath, extraPgSchemas, enableChat, enablePlayground, port, runProcessors, superuserDatabaseUrl, postgraphileDatabaseUrl, }: CreateHubServerOptions): HubServer;
|
package/dist/src/server/index.js
CHANGED
|
@@ -54,6 +54,7 @@ export function createHubServer({ configureApp, plugins, exportSchemaSDLPath, ex
|
|
|
54
54
|
});
|
|
55
55
|
const expressServer = createExpressServer(context);
|
|
56
56
|
const { preset, pgService } = createPreset({
|
|
57
|
+
postgraphileDatabaseUrl,
|
|
57
58
|
plugins: plugins ?? defaultPlugins,
|
|
58
59
|
exportSchemaSDLPath,
|
|
59
60
|
extraPgSchemas: extraPgSchemas ?? [],
|