@0xobelisk/graphql-server 1.2.0-pre.100
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/.turbo/turbo-build.log +8 -0
- package/DUAL_POOL_CONFIG.md +188 -0
- package/Dockerfile +35 -0
- package/LICENSE +92 -0
- package/README.md +487 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +206 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/subscription-config.d.ts +80 -0
- package/dist/config/subscription-config.d.ts.map +1 -0
- package/dist/config/subscription-config.js +158 -0
- package/dist/config/subscription-config.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/all-fields-filter-plugin.d.ts +4 -0
- package/dist/plugins/all-fields-filter-plugin.d.ts.map +1 -0
- package/dist/plugins/all-fields-filter-plugin.js +132 -0
- package/dist/plugins/all-fields-filter-plugin.js.map +1 -0
- package/dist/plugins/database-introspector.d.ts +23 -0
- package/dist/plugins/database-introspector.d.ts.map +1 -0
- package/dist/plugins/database-introspector.js +96 -0
- package/dist/plugins/database-introspector.js.map +1 -0
- package/dist/plugins/enhanced-playground.d.ts +9 -0
- package/dist/plugins/enhanced-playground.d.ts.map +1 -0
- package/dist/plugins/enhanced-playground.js +113 -0
- package/dist/plugins/enhanced-playground.js.map +1 -0
- package/dist/plugins/enhanced-server-manager.d.ts +29 -0
- package/dist/plugins/enhanced-server-manager.d.ts.map +1 -0
- package/dist/plugins/enhanced-server-manager.js +262 -0
- package/dist/plugins/enhanced-server-manager.js.map +1 -0
- package/dist/plugins/index.d.ts +9 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +26 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/postgraphile-config.d.ts +94 -0
- package/dist/plugins/postgraphile-config.d.ts.map +1 -0
- package/dist/plugins/postgraphile-config.js +138 -0
- package/dist/plugins/postgraphile-config.js.map +1 -0
- package/dist/plugins/query-filter.d.ts +4 -0
- package/dist/plugins/query-filter.d.ts.map +1 -0
- package/dist/plugins/query-filter.js +42 -0
- package/dist/plugins/query-filter.js.map +1 -0
- package/dist/plugins/simple-naming.d.ts +4 -0
- package/dist/plugins/simple-naming.d.ts.map +1 -0
- package/dist/plugins/simple-naming.js +79 -0
- package/dist/plugins/simple-naming.js.map +1 -0
- package/dist/plugins/welcome-page.d.ts +11 -0
- package/dist/plugins/welcome-page.d.ts.map +1 -0
- package/dist/plugins/welcome-page.js +203 -0
- package/dist/plugins/welcome-page.js.map +1 -0
- package/dist/server.d.ts +21 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +265 -0
- package/dist/server.js.map +1 -0
- package/dist/universal-subscriptions.d.ts +32 -0
- package/dist/universal-subscriptions.d.ts.map +1 -0
- package/dist/universal-subscriptions.js +318 -0
- package/dist/universal-subscriptions.js.map +1 -0
- package/dist/utils/logger/index.d.ts +80 -0
- package/dist/utils/logger/index.d.ts.map +1 -0
- package/dist/utils/logger/index.js +230 -0
- package/dist/utils/logger/index.js.map +1 -0
- package/docker-compose.yml +46 -0
- package/eslint.config.mjs +3 -0
- package/package.json +78 -0
- package/src/cli.ts +232 -0
- package/src/config/subscription-config.ts +243 -0
- package/src/index.ts +11 -0
- package/src/plugins/README.md +138 -0
- package/src/plugins/all-fields-filter-plugin.ts +158 -0
- package/src/plugins/database-introspector.ts +126 -0
- package/src/plugins/enhanced-playground.ts +121 -0
- package/src/plugins/enhanced-server-manager.ts +314 -0
- package/src/plugins/index.ts +9 -0
- package/src/plugins/postgraphile-config.ts +182 -0
- package/src/plugins/query-filter.ts +50 -0
- package/src/plugins/simple-naming.ts +105 -0
- package/src/plugins/welcome-page.ts +218 -0
- package/src/server.ts +324 -0
- package/src/universal-subscriptions.ts +397 -0
- package/src/utils/logger/README.md +209 -0
- package/src/utils/logger/index.ts +275 -0
- package/sui-indexer-schema.graphql +3691 -0
- package/tsconfig.json +28 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Enhanced GraphQL Playground plugin
|
|
3
|
+
// Provides better visual experience based on GraphiQL and Explorer plugin
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.createEnhancedPlayground = createEnhancedPlayground;
|
|
6
|
+
function createEnhancedPlayground(options) {
|
|
7
|
+
return (_req, _res, _config) => {
|
|
8
|
+
// This content is sourced from https://github.com/graphql/graphiql/blob/main/examples/graphiql-cdn/index.html
|
|
9
|
+
return `<!--
|
|
10
|
+
* Copyright (c) 2025 GraphQL Contributors
|
|
11
|
+
* All rights reserved.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
-->
|
|
16
|
+
<!doctype html>
|
|
17
|
+
<html lang="en">
|
|
18
|
+
<head>
|
|
19
|
+
<meta charset="UTF-8" />
|
|
20
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
21
|
+
<title>GraphiQL 5 with React 19 and GraphiQL Explorer</title>
|
|
22
|
+
<style>
|
|
23
|
+
body {
|
|
24
|
+
margin: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#graphiql {
|
|
28
|
+
height: 100dvh;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.loading {
|
|
32
|
+
height: 100%;
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
font-size: 4rem;
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
39
|
+
<link rel="stylesheet" href="https://esm.sh/graphiql/dist/style.css" />
|
|
40
|
+
<link
|
|
41
|
+
rel="stylesheet"
|
|
42
|
+
href="https://esm.sh/@graphiql/plugin-explorer/dist/style.css"
|
|
43
|
+
/>
|
|
44
|
+
<!-- Note: the ?standalone flag bundles the module along with all of its 'dependencies', excluding peerDependencies', into a single JavaScript file. -->
|
|
45
|
+
<script type="importmap">
|
|
46
|
+
{
|
|
47
|
+
"imports": {
|
|
48
|
+
"react": "https://esm.sh/react@19.1.0",
|
|
49
|
+
"react/jsx-runtime": "https://esm.sh/react@19.1.0/jsx-runtime",
|
|
50
|
+
|
|
51
|
+
"react-dom": "https://esm.sh/react-dom@19.1.0",
|
|
52
|
+
"react-dom/client": "https://esm.sh/react-dom@19.1.0/client",
|
|
53
|
+
|
|
54
|
+
"graphiql": "https://esm.sh/graphiql?standalone&external=react,react-dom,@graphiql/react,graphql",
|
|
55
|
+
"@graphiql/plugin-explorer": "https://esm.sh/@graphiql/plugin-explorer?standalone&external=react,@graphiql/react,graphql",
|
|
56
|
+
"@graphiql/react": "https://esm.sh/@graphiql/react?standalone&external=react,react-dom,graphql",
|
|
57
|
+
|
|
58
|
+
"@graphiql/toolkit": "https://esm.sh/@graphiql/toolkit?standalone&external=graphql",
|
|
59
|
+
"graphql": "https://esm.sh/graphql@16.11.0"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</script>
|
|
63
|
+
<script type="module">
|
|
64
|
+
// Import React and ReactDOM
|
|
65
|
+
import React from 'react';
|
|
66
|
+
import ReactDOM from 'react-dom/client';
|
|
67
|
+
// Import GraphiQL and the Explorer plugin
|
|
68
|
+
import { GraphiQL, HISTORY_PLUGIN } from 'graphiql';
|
|
69
|
+
import { createGraphiQLFetcher } from '@graphiql/toolkit';
|
|
70
|
+
import { explorerPlugin } from '@graphiql/plugin-explorer';
|
|
71
|
+
|
|
72
|
+
import createJSONWorker from 'https://esm.sh/monaco-editor/esm/vs/language/json/json.worker.js?worker';
|
|
73
|
+
import createGraphQLWorker from 'https://esm.sh/monaco-graphql/esm/graphql.worker.js?worker';
|
|
74
|
+
import createEditorWorker from 'https://esm.sh/monaco-editor/esm/vs/editor/editor.worker.js?worker';
|
|
75
|
+
|
|
76
|
+
globalThis.MonacoEnvironment = {
|
|
77
|
+
getWorker(_workerId, label) {
|
|
78
|
+
console.info('MonacoEnvironment.getWorker', { label });
|
|
79
|
+
switch (label) {
|
|
80
|
+
case 'json':
|
|
81
|
+
return createJSONWorker();
|
|
82
|
+
case 'graphql':
|
|
83
|
+
return createGraphQLWorker();
|
|
84
|
+
}
|
|
85
|
+
return createEditorWorker();
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const fetcher = createGraphiQLFetcher(${JSON.stringify(options)});
|
|
90
|
+
const plugins = [HISTORY_PLUGIN, explorerPlugin()];
|
|
91
|
+
|
|
92
|
+
function App() {
|
|
93
|
+
return React.createElement(GraphiQL, {
|
|
94
|
+
fetcher,
|
|
95
|
+
plugins,
|
|
96
|
+
defaultEditorToolsVisibility: true,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const container = document.getElementById('graphiql');
|
|
101
|
+
const root = ReactDOM.createRoot(container);
|
|
102
|
+
root.render(React.createElement(App));
|
|
103
|
+
</script>
|
|
104
|
+
</head>
|
|
105
|
+
<body>
|
|
106
|
+
<div id="graphiql">
|
|
107
|
+
<div class="loading">Loading…</div>
|
|
108
|
+
</div>
|
|
109
|
+
</body>
|
|
110
|
+
</html>`;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=enhanced-playground.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enhanced-playground.js","sourceRoot":"","sources":["../../src/plugins/enhanced-playground.ts"],"names":[],"mappings":";AAAA,qCAAqC;AACrC,0EAA0E;;AAW1E,4DA4GC;AA5GD,SAAgB,wBAAwB,CACtC,OAA0B;IAE1B,OAAO,CAAC,IAAqB,EAAE,IAAoB,EAAE,OAAa,EAAE,EAAE;QACpE,8GAA8G;QAC9G,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0DAgF+C,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;oBAqB7D,CAAC;IACnB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Server as HttpServer } from 'http';
|
|
2
|
+
import { Pool } from 'pg';
|
|
3
|
+
import { WelcomePageConfig } from './welcome-page';
|
|
4
|
+
import { PostGraphileConfigOptions } from './postgraphile-config';
|
|
5
|
+
import type { DynamicTable } from './database-introspector';
|
|
6
|
+
export interface EnhancedServerConfig {
|
|
7
|
+
postgraphileMiddleware: any;
|
|
8
|
+
pgPool: Pool;
|
|
9
|
+
tableNames: string[];
|
|
10
|
+
databaseUrl: string;
|
|
11
|
+
allTables: DynamicTable[];
|
|
12
|
+
welcomeConfig: WelcomePageConfig;
|
|
13
|
+
postgraphileConfigOptions: PostGraphileConfigOptions;
|
|
14
|
+
}
|
|
15
|
+
export declare class EnhancedServerManager {
|
|
16
|
+
private config;
|
|
17
|
+
private app;
|
|
18
|
+
private httpServer;
|
|
19
|
+
private pgPool;
|
|
20
|
+
constructor();
|
|
21
|
+
private createExpressApp;
|
|
22
|
+
createEnhancedServer(serverConfig: EnhancedServerConfig): Promise<HttpServer>;
|
|
23
|
+
startServer(): Promise<void>;
|
|
24
|
+
private logServerStatus;
|
|
25
|
+
private getSubscriptionStatus;
|
|
26
|
+
quickShutdown(): Promise<void>;
|
|
27
|
+
gracefulShutdown(pgPool: Pool): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=enhanced-server-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enhanced-server-manager.d.ts","sourceRoot":"","sources":["../../src/plugins/enhanced-server-manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAC;AAE1D,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAI1B,OAAO,EAAqB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAwB,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,WAAW,oBAAoB;IACnC,sBAAsB,EAAE,GAAG,CAAC;IAC5B,MAAM,EAAE,IAAI,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,aAAa,EAAE,iBAAiB,CAAC;IACjC,yBAAyB,EAAE,yBAAyB,CAAC;CACtD;AAED,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,GAAG,CAAwB;IACnC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,MAAM,CAAqB;;IAOnC,OAAO,CAAC,gBAAgB;IA+IlB,oBAAoB,CAAC,YAAY,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC;IAqC7E,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBlC,OAAO,CAAC,eAAe;IA2BvB,OAAO,CAAC,qBAAqB;IASvB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAY9B,gBAAgB,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAgCpD"}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Express server manager - using Express framework and PostgreSQL subscriptions
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.EnhancedServerManager = void 0;
|
|
8
|
+
const express_1 = __importDefault(require("express"));
|
|
9
|
+
const http_1 = require("http");
|
|
10
|
+
const cors_1 = __importDefault(require("cors"));
|
|
11
|
+
const postgraphile_1 = require("postgraphile");
|
|
12
|
+
const subscription_config_1 = require("../config/subscription-config");
|
|
13
|
+
const logger_1 = require("../utils/logger");
|
|
14
|
+
const welcome_page_1 = require("./welcome-page");
|
|
15
|
+
const postgraphile_config_1 = require("./postgraphile-config");
|
|
16
|
+
class EnhancedServerManager {
|
|
17
|
+
config;
|
|
18
|
+
app = null;
|
|
19
|
+
httpServer = null;
|
|
20
|
+
pgPool = null;
|
|
21
|
+
constructor() {
|
|
22
|
+
this.config = subscription_config_1.subscriptionConfig.getConfig();
|
|
23
|
+
}
|
|
24
|
+
// Create Express application
|
|
25
|
+
createExpressApp(serverConfig) {
|
|
26
|
+
const { postgraphileMiddleware, allTables, welcomeConfig, postgraphileConfigOptions } = serverConfig;
|
|
27
|
+
const app = (0, express_1.default)();
|
|
28
|
+
// Middleware configuration
|
|
29
|
+
app.use((0, cors_1.default)({
|
|
30
|
+
origin: '*',
|
|
31
|
+
methods: ['GET', 'POST', 'OPTIONS'],
|
|
32
|
+
allowedHeaders: ['Content-Type', 'Authorization']
|
|
33
|
+
}));
|
|
34
|
+
// Request logging middleware
|
|
35
|
+
app.use((req, res, next) => {
|
|
36
|
+
const startTime = Date.now();
|
|
37
|
+
res.on('finish', () => {
|
|
38
|
+
(0, logger_1.logExpress)(req.method, req.path, res.statusCode, startTime, {
|
|
39
|
+
userAgent: req.get('user-agent')?.substring(0, 50)
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
next();
|
|
43
|
+
});
|
|
44
|
+
// Route configuration
|
|
45
|
+
// Root path - welcome page
|
|
46
|
+
app.get('/', (req, res) => {
|
|
47
|
+
res.set('Content-Type', 'text/html; charset=utf-8');
|
|
48
|
+
res.send((0, welcome_page_1.createWelcomePage)(allTables, welcomeConfig));
|
|
49
|
+
});
|
|
50
|
+
// GraphQL Playground
|
|
51
|
+
app.get('/playground', (req, res) => {
|
|
52
|
+
res.set('Content-Type', 'text/html; charset=utf-8');
|
|
53
|
+
res.send((0, postgraphile_config_1.createPlaygroundHtml)(postgraphileConfigOptions));
|
|
54
|
+
});
|
|
55
|
+
// Redirect old GraphiQL paths
|
|
56
|
+
app.get('/graphiql*', (req, res) => {
|
|
57
|
+
logger_1.serverLogger.info('Redirecting old GraphiQL path', {
|
|
58
|
+
from: req.path,
|
|
59
|
+
to: '/playground'
|
|
60
|
+
});
|
|
61
|
+
res.redirect(301, '/playground');
|
|
62
|
+
});
|
|
63
|
+
// Health check endpoint
|
|
64
|
+
app.get('/health', (req, res) => {
|
|
65
|
+
res.json({
|
|
66
|
+
status: 'healthy',
|
|
67
|
+
subscriptions: this.getSubscriptionStatus(),
|
|
68
|
+
timestamp: new Date().toISOString()
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
// Subscription configuration endpoint
|
|
72
|
+
app.get('/subscription-config', (req, res) => {
|
|
73
|
+
res.json(subscription_config_1.subscriptionConfig.generateClientConfig());
|
|
74
|
+
});
|
|
75
|
+
// Configuration documentation endpoint
|
|
76
|
+
app.get('/subscription-docs', (req, res) => {
|
|
77
|
+
res.set('Content-Type', 'text/plain');
|
|
78
|
+
res.send(subscription_config_1.subscriptionConfig.generateDocumentation());
|
|
79
|
+
});
|
|
80
|
+
// Add connection pool status endpoint
|
|
81
|
+
app.get('/pool-status', (req, res) => {
|
|
82
|
+
if (this.pgPool) {
|
|
83
|
+
const poolStatus = {
|
|
84
|
+
totalCount: this.pgPool.totalCount,
|
|
85
|
+
idleCount: this.pgPool.idleCount,
|
|
86
|
+
waitingCount: this.pgPool.waitingCount,
|
|
87
|
+
maxConnections: this.pgPool.options.max || 'Not set',
|
|
88
|
+
minConnections: this.pgPool.options.min || 'Not set'
|
|
89
|
+
};
|
|
90
|
+
res.json({
|
|
91
|
+
status: 'ok',
|
|
92
|
+
connectionPool: poolStatus,
|
|
93
|
+
strategy: 'single-pool-unified',
|
|
94
|
+
operations: ['query', 'mutation', 'subscription'],
|
|
95
|
+
timestamp: new Date().toISOString(),
|
|
96
|
+
uptime: process.uptime(),
|
|
97
|
+
memory: process.memoryUsage()
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
res.status(503).json({
|
|
102
|
+
status: 'error',
|
|
103
|
+
message: 'Connection pool not available'
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
// PostGraphile middleware - mount at root path, let PostGraphile handle routing itself
|
|
108
|
+
app.use((req, res, next) => {
|
|
109
|
+
// Check if PostGraphile middleware exists
|
|
110
|
+
if (!postgraphileMiddleware) {
|
|
111
|
+
console.error('❌ PostGraphile middleware is null!');
|
|
112
|
+
if (req.path.startsWith('/graphql')) {
|
|
113
|
+
res.status(500).json({
|
|
114
|
+
error: 'PostGraphile middleware not properly initialized'
|
|
115
|
+
});
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
next();
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
try {
|
|
122
|
+
postgraphileMiddleware(req, res, next);
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
console.error('❌ PostGraphile middleware execution error:', error);
|
|
126
|
+
if (req.path.startsWith('/graphql')) {
|
|
127
|
+
res.status(500).json({
|
|
128
|
+
error: 'PostGraphile execution error',
|
|
129
|
+
details: error instanceof Error ? error.message : String(error)
|
|
130
|
+
});
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
next();
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
// Error handling middleware
|
|
137
|
+
app.use((err, req, res, _next) => {
|
|
138
|
+
logger_1.serverLogger.error('Express error handling', err, {
|
|
139
|
+
url: req.originalUrl,
|
|
140
|
+
method: req.method,
|
|
141
|
+
userAgent: req.get('user-agent')?.substring(0, 50)
|
|
142
|
+
});
|
|
143
|
+
res.status(500).send('Internal Server Error');
|
|
144
|
+
});
|
|
145
|
+
return app;
|
|
146
|
+
}
|
|
147
|
+
// Create and configure HTTP server
|
|
148
|
+
async createEnhancedServer(serverConfig) {
|
|
149
|
+
const { postgraphileMiddleware, pgPool } = serverConfig;
|
|
150
|
+
// Store pool references for monitoring
|
|
151
|
+
this.pgPool = pgPool;
|
|
152
|
+
// Create Express application
|
|
153
|
+
this.app = this.createExpressApp(serverConfig);
|
|
154
|
+
// Create HTTP server
|
|
155
|
+
this.httpServer = (0, http_1.createServer)(this.app);
|
|
156
|
+
// Enable PostgreSQL subscriptions and WebSocket support
|
|
157
|
+
if (this.config.capabilities.pgSubscriptions) {
|
|
158
|
+
(0, postgraphile_1.enhanceHttpServerWithSubscriptions)(this.httpServer, postgraphileMiddleware, {
|
|
159
|
+
// Enable WebSocket transport
|
|
160
|
+
graphqlRoute: '/graphql'
|
|
161
|
+
});
|
|
162
|
+
logger_1.systemLogger.info('✅ PostgreSQL subscriptions and WebSocket enabled', {
|
|
163
|
+
pgSubscriptions: this.config.capabilities.pgSubscriptions,
|
|
164
|
+
webSocket: true
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
logger_1.serverLogger.info('🚀 Express server creation completed', {
|
|
168
|
+
framework: 'Express',
|
|
169
|
+
graphqlPort: this.config.graphqlPort,
|
|
170
|
+
capabilities: {
|
|
171
|
+
pgSubscriptions: this.config.capabilities.pgSubscriptions
|
|
172
|
+
},
|
|
173
|
+
recommendedMethod: 'pg-subscriptions'
|
|
174
|
+
});
|
|
175
|
+
return this.httpServer;
|
|
176
|
+
}
|
|
177
|
+
// Start server
|
|
178
|
+
async startServer() {
|
|
179
|
+
if (!this.httpServer) {
|
|
180
|
+
throw new Error('Server not created, please call createEnhancedServer() first');
|
|
181
|
+
}
|
|
182
|
+
return new Promise((resolve, reject) => {
|
|
183
|
+
this.httpServer.listen(this.config.graphqlPort, (err) => {
|
|
184
|
+
if (err) {
|
|
185
|
+
reject(err);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
this.logServerStatus();
|
|
189
|
+
resolve();
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
// Log server status
|
|
194
|
+
logServerStatus() {
|
|
195
|
+
const clientConfig = subscription_config_1.subscriptionConfig.generateClientConfig();
|
|
196
|
+
logger_1.serverLogger.info('🎉 Express GraphQL server started successfully!', {
|
|
197
|
+
port: this.config.graphqlPort,
|
|
198
|
+
framework: 'Express',
|
|
199
|
+
endpoints: {
|
|
200
|
+
home: `http://localhost:${this.config.graphqlPort}/`,
|
|
201
|
+
playground: `http://localhost:${this.config.graphqlPort}/playground`,
|
|
202
|
+
graphql: clientConfig.graphqlEndpoint,
|
|
203
|
+
subscription: clientConfig.subscriptionEndpoint,
|
|
204
|
+
health: `http://localhost:${this.config.graphqlPort}/health`,
|
|
205
|
+
config: `http://localhost:${this.config.graphqlPort}/subscription-config`,
|
|
206
|
+
docs: `http://localhost:${this.config.graphqlPort}/subscription-docs`
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
// Display main access links
|
|
210
|
+
console.log('\n' + '🌟'.repeat(30));
|
|
211
|
+
console.log('🏠 Homepage: ' + `http://localhost:${this.config.graphqlPort}/`);
|
|
212
|
+
console.log('🎮 Playground: ' + `http://localhost:${this.config.graphqlPort}/playground`);
|
|
213
|
+
console.log('🔗 GraphQL: ' + clientConfig.graphqlEndpoint);
|
|
214
|
+
console.log('📡 WebSocket: ' + clientConfig.subscriptionEndpoint);
|
|
215
|
+
console.log('🌟'.repeat(30) + '\n');
|
|
216
|
+
}
|
|
217
|
+
// Get subscription status
|
|
218
|
+
getSubscriptionStatus() {
|
|
219
|
+
return {
|
|
220
|
+
enabled: this.config.capabilities.pgSubscriptions,
|
|
221
|
+
method: 'pg-subscriptions',
|
|
222
|
+
config: subscription_config_1.subscriptionConfig.generateClientConfig()
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
// Quick shutdown
|
|
226
|
+
async quickShutdown() {
|
|
227
|
+
logger_1.systemLogger.info('🛑 Starting quick shutdown of Express server...');
|
|
228
|
+
if (this.httpServer) {
|
|
229
|
+
this.httpServer.close();
|
|
230
|
+
logger_1.systemLogger.info('✅ HTTP server closed');
|
|
231
|
+
}
|
|
232
|
+
logger_1.systemLogger.info('🎯 Express server quick shutdown completed');
|
|
233
|
+
}
|
|
234
|
+
// Graceful shutdown
|
|
235
|
+
async gracefulShutdown(pgPool) {
|
|
236
|
+
logger_1.systemLogger.info('🛑 Starting graceful shutdown of Express server...');
|
|
237
|
+
const shutdownPromises = [];
|
|
238
|
+
// Close HTTP server
|
|
239
|
+
if (this.httpServer) {
|
|
240
|
+
shutdownPromises.push(new Promise((resolve) => {
|
|
241
|
+
this.httpServer.close(() => {
|
|
242
|
+
logger_1.systemLogger.info('✅ HTTP server closed');
|
|
243
|
+
resolve();
|
|
244
|
+
});
|
|
245
|
+
}));
|
|
246
|
+
}
|
|
247
|
+
// Close database connection pool
|
|
248
|
+
shutdownPromises.push(pgPool.end().then(() => {
|
|
249
|
+
logger_1.systemLogger.info('✅ Database connection pool closed');
|
|
250
|
+
}));
|
|
251
|
+
try {
|
|
252
|
+
await Promise.all(shutdownPromises);
|
|
253
|
+
logger_1.systemLogger.info('🎯 Express server graceful shutdown completed');
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
logger_1.systemLogger.error('❌ Error occurred during shutdown process', error);
|
|
257
|
+
throw error;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
exports.EnhancedServerManager = EnhancedServerManager;
|
|
262
|
+
//# sourceMappingURL=enhanced-server-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enhanced-server-manager.js","sourceRoot":"","sources":["../../src/plugins/enhanced-server-manager.ts"],"names":[],"mappings":";AAAA,gFAAgF;;;;;;AAEhF,sDAA8D;AAC9D,+BAA0D;AAC1D,gDAAwB;AAExB,+CAAkE;AAClE,uEAAuF;AACvF,4CAAyE;AACzE,iDAAsE;AACtE,+DAAwF;AAaxF,MAAa,qBAAqB;IACxB,MAAM,CAA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C;YACpB,gBAAgB,CAAC,IAAI,CACnB,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBACtB,IAAI,CAAC,UAAW,CAAC,KAAK,CAAC,GAAG,EAAE;oBAC1B,qBAAY,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;oBAC1C,OAAO,EAAE,CAAC;gBACZ,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CACH,CAAC;QACJ,CAAC;QAED,iCAAiC;QACjC,gBAAgB,CAAC,IAAI,CACnB,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;YACrB,qBAAY,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QACzD,CAAC,CAAC,CACH,CAAC;QAEF,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;YACpC,qBAAY,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;QACrE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,qBAAY,CAAC,KAAK,CAAC,0CAA0C,EAAE,KAAK,CAAC,CAAC;YACtE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAlSD,sDAkSC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './database-introspector';
|
|
2
|
+
export * from './welcome-page';
|
|
3
|
+
export * from './postgraphile-config';
|
|
4
|
+
export * from './query-filter';
|
|
5
|
+
export * from './simple-naming';
|
|
6
|
+
export * from './all-fields-filter-plugin';
|
|
7
|
+
export * from './enhanced-server-manager';
|
|
8
|
+
export * from './enhanced-playground';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AACA,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// Unified export entry point for plugins
|
|
18
|
+
__exportStar(require("./database-introspector"), exports);
|
|
19
|
+
__exportStar(require("./welcome-page"), exports);
|
|
20
|
+
__exportStar(require("./postgraphile-config"), exports);
|
|
21
|
+
__exportStar(require("./query-filter"), exports);
|
|
22
|
+
__exportStar(require("./simple-naming"), exports);
|
|
23
|
+
__exportStar(require("./all-fields-filter-plugin"), exports);
|
|
24
|
+
__exportStar(require("./enhanced-server-manager"), exports);
|
|
25
|
+
__exportStar(require("./enhanced-playground"), exports);
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAyC;AACzC,0DAAwC;AACxC,iDAA+B;AAC/B,wDAAsC;AACtC,iDAA+B;AAC/B,kDAAgC;AAChC,6DAA2C;AAC3C,4DAA0C;AAC1C,wDAAsC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export interface PostGraphileConfigOptions {
|
|
2
|
+
port: string | number;
|
|
3
|
+
nodeEnv: string;
|
|
4
|
+
graphqlEndpoint: string;
|
|
5
|
+
enableSubscriptions: string;
|
|
6
|
+
enableCors: string;
|
|
7
|
+
databaseUrl: string;
|
|
8
|
+
availableTables: string[];
|
|
9
|
+
disableQueryLog: boolean;
|
|
10
|
+
enableQueryLog: boolean;
|
|
11
|
+
queryTimeout: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function createPostGraphileConfig(options: PostGraphileConfigOptions): {
|
|
14
|
+
graphiql: boolean;
|
|
15
|
+
enhanceGraphiql: boolean;
|
|
16
|
+
showErrorStack: boolean;
|
|
17
|
+
extendedErrors: string[];
|
|
18
|
+
subscriptions: boolean;
|
|
19
|
+
live: boolean;
|
|
20
|
+
enableQueryBatching: boolean;
|
|
21
|
+
enableCors: boolean;
|
|
22
|
+
pluginHook: import("postgraphile/build/postgraphile/pluginHook").PluginHookFn;
|
|
23
|
+
disableDefaultMutations: boolean;
|
|
24
|
+
dynamicJson: boolean;
|
|
25
|
+
setofFunctionsContainNulls: boolean;
|
|
26
|
+
ignoreRBAC: boolean;
|
|
27
|
+
ignoreIndexes: boolean;
|
|
28
|
+
disableQueryLog: boolean;
|
|
29
|
+
allowExplain: boolean;
|
|
30
|
+
watchPg: boolean;
|
|
31
|
+
queryTimeout: number;
|
|
32
|
+
graphqlRoute: string;
|
|
33
|
+
graphiqlRoute: string;
|
|
34
|
+
appendPlugins: import("postgraphile").Plugin[];
|
|
35
|
+
graphileBuildOptions: {
|
|
36
|
+
connectionFilterLogicalOperators: boolean;
|
|
37
|
+
connectionFilterRelations: boolean;
|
|
38
|
+
connectionFilterComputedColumns: boolean;
|
|
39
|
+
connectionFilterArrays: boolean;
|
|
40
|
+
connectionFilterSetofFunctions: boolean;
|
|
41
|
+
connectionFilterAllowNullInput: boolean;
|
|
42
|
+
connectionFilterAllowEmptyObjectInput: boolean;
|
|
43
|
+
};
|
|
44
|
+
includeExtensionResources: boolean;
|
|
45
|
+
ignoreTable: (tableName: string) => boolean;
|
|
46
|
+
exportGqlSchemaPath: string | undefined;
|
|
47
|
+
} | {
|
|
48
|
+
queryCache?: boolean | undefined;
|
|
49
|
+
allowExplain: boolean;
|
|
50
|
+
ownerConnectionString: string;
|
|
51
|
+
websocketMiddlewares: never[];
|
|
52
|
+
pgSettings: {
|
|
53
|
+
statement_timeout: string;
|
|
54
|
+
idle_in_transaction_session_timeout: string;
|
|
55
|
+
default_transaction_isolation: string;
|
|
56
|
+
};
|
|
57
|
+
retryOnInitFail: boolean;
|
|
58
|
+
pgDefaultRole: undefined;
|
|
59
|
+
jwtSecret: undefined;
|
|
60
|
+
graphiql: boolean;
|
|
61
|
+
enhanceGraphiql: boolean;
|
|
62
|
+
showErrorStack: boolean;
|
|
63
|
+
extendedErrors: string[];
|
|
64
|
+
subscriptions: boolean;
|
|
65
|
+
live: boolean;
|
|
66
|
+
enableQueryBatching: boolean;
|
|
67
|
+
enableCors: boolean;
|
|
68
|
+
pluginHook: import("postgraphile/build/postgraphile/pluginHook").PluginHookFn;
|
|
69
|
+
disableDefaultMutations: boolean;
|
|
70
|
+
dynamicJson: boolean;
|
|
71
|
+
setofFunctionsContainNulls: boolean;
|
|
72
|
+
ignoreRBAC: boolean;
|
|
73
|
+
ignoreIndexes: boolean;
|
|
74
|
+
disableQueryLog: boolean;
|
|
75
|
+
watchPg: boolean;
|
|
76
|
+
queryTimeout: number;
|
|
77
|
+
graphqlRoute: string;
|
|
78
|
+
graphiqlRoute: string;
|
|
79
|
+
appendPlugins: import("postgraphile").Plugin[];
|
|
80
|
+
graphileBuildOptions: {
|
|
81
|
+
connectionFilterLogicalOperators: boolean;
|
|
82
|
+
connectionFilterRelations: boolean;
|
|
83
|
+
connectionFilterComputedColumns: boolean;
|
|
84
|
+
connectionFilterArrays: boolean;
|
|
85
|
+
connectionFilterSetofFunctions: boolean;
|
|
86
|
+
connectionFilterAllowNullInput: boolean;
|
|
87
|
+
connectionFilterAllowEmptyObjectInput: boolean;
|
|
88
|
+
};
|
|
89
|
+
includeExtensionResources: boolean;
|
|
90
|
+
ignoreTable: (tableName: string) => boolean;
|
|
91
|
+
exportGqlSchemaPath: string | undefined;
|
|
92
|
+
};
|
|
93
|
+
export declare function createPlaygroundHtml(options: PostGraphileConfigOptions): string;
|
|
94
|
+
//# sourceMappingURL=postgraphile-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgraphile-config.d.ts","sourceRoot":"","sources":["../../src/plugins/postgraphile-config.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,EAAE,CAAC;IAE1B,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;CACtB;AAGD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BA2F9C,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAAN,MAAM;;EA8ClC;AAGD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,yBAAyB,GAAG,MAAM,CAiB/E"}
|