@0xobelisk/graphql-server 1.2.0-pre.24

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.
Files changed (79) hide show
  1. package/Dockerfile +31 -0
  2. package/EXPRESS_MIGRATION.md +176 -0
  3. package/LICENSE +92 -0
  4. package/README.md +908 -0
  5. package/dist/config/subscription-config.d.ts +47 -0
  6. package/dist/config/subscription-config.d.ts.map +1 -0
  7. package/dist/config/subscription-config.js +133 -0
  8. package/dist/config/subscription-config.js.map +1 -0
  9. package/dist/index.d.ts +2 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +217 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/plugins/all-fields-filter-plugin.d.ts +4 -0
  14. package/dist/plugins/all-fields-filter-plugin.d.ts.map +1 -0
  15. package/dist/plugins/all-fields-filter-plugin.js +132 -0
  16. package/dist/plugins/all-fields-filter-plugin.js.map +1 -0
  17. package/dist/plugins/database-introspector.d.ts +23 -0
  18. package/dist/plugins/database-introspector.d.ts.map +1 -0
  19. package/dist/plugins/database-introspector.js +96 -0
  20. package/dist/plugins/database-introspector.js.map +1 -0
  21. package/dist/plugins/enhanced-playground.d.ts +9 -0
  22. package/dist/plugins/enhanced-playground.d.ts.map +1 -0
  23. package/dist/plugins/enhanced-playground.js +97 -0
  24. package/dist/plugins/enhanced-playground.js.map +1 -0
  25. package/dist/plugins/enhanced-server-manager.d.ts +28 -0
  26. package/dist/plugins/enhanced-server-manager.d.ts.map +1 -0
  27. package/dist/plugins/enhanced-server-manager.js +232 -0
  28. package/dist/plugins/enhanced-server-manager.js.map +1 -0
  29. package/dist/plugins/index.d.ts +9 -0
  30. package/dist/plugins/index.d.ts.map +1 -0
  31. package/dist/plugins/index.js +26 -0
  32. package/dist/plugins/index.js.map +1 -0
  33. package/dist/plugins/postgraphile-config.d.ts +94 -0
  34. package/dist/plugins/postgraphile-config.d.ts.map +1 -0
  35. package/dist/plugins/postgraphile-config.js +183 -0
  36. package/dist/plugins/postgraphile-config.js.map +1 -0
  37. package/dist/plugins/query-filter.d.ts +4 -0
  38. package/dist/plugins/query-filter.d.ts.map +1 -0
  39. package/dist/plugins/query-filter.js +42 -0
  40. package/dist/plugins/query-filter.js.map +1 -0
  41. package/dist/plugins/simple-naming.d.ts +4 -0
  42. package/dist/plugins/simple-naming.d.ts.map +1 -0
  43. package/dist/plugins/simple-naming.js +79 -0
  44. package/dist/plugins/simple-naming.js.map +1 -0
  45. package/dist/plugins/welcome-page.d.ts +11 -0
  46. package/dist/plugins/welcome-page.d.ts.map +1 -0
  47. package/dist/plugins/welcome-page.js +203 -0
  48. package/dist/plugins/welcome-page.js.map +1 -0
  49. package/dist/universal-subscriptions.d.ts +32 -0
  50. package/dist/universal-subscriptions.d.ts.map +1 -0
  51. package/dist/universal-subscriptions.js +318 -0
  52. package/dist/universal-subscriptions.js.map +1 -0
  53. package/dist/utils/logger/index.d.ts +80 -0
  54. package/dist/utils/logger/index.d.ts.map +1 -0
  55. package/dist/utils/logger/index.js +232 -0
  56. package/dist/utils/logger/index.js.map +1 -0
  57. package/docker-compose.yml +87 -0
  58. package/package.json +71 -0
  59. package/server.log +62 -0
  60. package/src/config/subscription-config.ts +186 -0
  61. package/src/index.ts +239 -0
  62. package/src/plugins/README.md +123 -0
  63. package/src/plugins/all-fields-filter-plugin.ts +158 -0
  64. package/src/plugins/database-introspector.ts +126 -0
  65. package/src/plugins/enhanced-playground.ts +105 -0
  66. package/src/plugins/enhanced-server-manager.ts +282 -0
  67. package/src/plugins/index.ts +9 -0
  68. package/src/plugins/postgraphile-config.ts +226 -0
  69. package/src/plugins/query-filter.ts +50 -0
  70. package/src/plugins/simple-naming.ts +105 -0
  71. package/src/plugins/welcome-page.ts +218 -0
  72. package/src/universal-subscriptions.ts +397 -0
  73. package/src/utils/logger/README.md +193 -0
  74. package/src/utils/logger/index.ts +315 -0
  75. package/sui-indexer-schema.graphql +1004 -0
  76. package/test-express.js +124 -0
  77. package/test_listen_subscription.js +121 -0
  78. package/test_notification.js +63 -0
  79. package/tsconfig.json +28 -0
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DatabaseIntrospector = void 0;
4
+ // Scan database table structure
5
+ class DatabaseIntrospector {
6
+ pool;
7
+ schema;
8
+ constructor(pool, schema = 'public') {
9
+ this.pool = pool;
10
+ this.schema = schema;
11
+ }
12
+ // Get all dynamically created store_* tables
13
+ async getStoreTables() {
14
+ const result = await this.pool.query(`
15
+ SELECT table_name
16
+ FROM information_schema.tables
17
+ WHERE table_schema = $1
18
+ AND table_name LIKE 'store_%'
19
+ ORDER BY table_name
20
+ `, [this.schema]);
21
+ return result.rows.map((row) => row.table_name);
22
+ }
23
+ // Get system tables (dubhe related tables)
24
+ async getSystemTables() {
25
+ const result = await this.pool.query(`
26
+ SELECT table_name
27
+ FROM information_schema.tables
28
+ WHERE table_schema = $1
29
+ AND (table_name = 'table_fields')
30
+ ORDER BY table_name
31
+ `, [this.schema]);
32
+ return result.rows.map((row) => row.table_name);
33
+ }
34
+ // Get dynamic table field information from table_fields table
35
+ async getDynamicTableFields(tableName) {
36
+ // Extract table name (remove store_ prefix)
37
+ const baseTableName = tableName.replace('store_', '');
38
+ const result = await this.pool.query(`
39
+ SELECT field_name, field_type, field_index, is_key
40
+ FROM table_fields
41
+ WHERE table_name = $1
42
+ ORDER BY is_key DESC, field_index ASC
43
+ `, [baseTableName]);
44
+ return result.rows;
45
+ }
46
+ // Get field information from system tables
47
+ async getSystemTableFields(tableName) {
48
+ const result = await this.pool.query(`
49
+ SELECT
50
+ column_name as field_name,
51
+ data_type as field_type,
52
+ ordinal_position as field_index,
53
+ CASE WHEN column_name = 'entity_id' THEN true ELSE false END as is_key
54
+ FROM information_schema.columns
55
+ WHERE table_schema = $1 AND table_name = $2
56
+ ORDER BY ordinal_position
57
+ `, [this.schema, tableName]);
58
+ return result.rows;
59
+ }
60
+ // Get complete information for all tables
61
+ async getAllTables() {
62
+ const storeTables = await this.getStoreTables();
63
+ const systemTables = await this.getSystemTables();
64
+ const allTables = [];
65
+ // Process dynamic tables
66
+ for (const tableName of storeTables) {
67
+ const fields = await this.getDynamicTableFields(tableName);
68
+ allTables.push({
69
+ table_name: tableName,
70
+ fields
71
+ });
72
+ }
73
+ // Process system tables
74
+ for (const tableName of systemTables) {
75
+ const fields = await this.getSystemTableFields(tableName);
76
+ allTables.push({
77
+ table_name: tableName,
78
+ fields
79
+ });
80
+ }
81
+ return allTables;
82
+ }
83
+ // Test database connection
84
+ async testConnection() {
85
+ try {
86
+ await this.pool.query('SELECT NOW() as current_time');
87
+ return true;
88
+ }
89
+ catch (error) {
90
+ console.error('Database connection test failed:', error);
91
+ return false;
92
+ }
93
+ }
94
+ }
95
+ exports.DatabaseIntrospector = DatabaseIntrospector;
96
+ //# sourceMappingURL=database-introspector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database-introspector.js","sourceRoot":"","sources":["../../src/plugins/database-introspector.ts"],"names":[],"mappings":";;;AAeA,gCAAgC;AAChC,MAAa,oBAAoB;IACX;IAAoB;IAAxC,YAAoB,IAAU,EAAU,SAAiB,QAAQ;QAA7C,SAAI,GAAJ,IAAI,CAAM;QAAU,WAAM,GAAN,MAAM,CAAmB;IAAG,CAAC;IAErE,6CAA6C;IAC7C,KAAK,CAAC,cAAc;QAClB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAClC;;;;;;GAMH,EACG,CAAC,IAAI,CAAC,MAAM,CAAC,CACd,CAAC;QAEF,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAClD,CAAC;IAED,2CAA2C;IAC3C,KAAK,CAAC,eAAe;QACnB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAClC;;;;;;GAMH,EACG,CAAC,IAAI,C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AC,oBAAoB,CAAC,SAAS,CAAC,CAAC;YAC1D,SAAS,CAAC,IAAI,CAAC;gBACb,UAAU,EAAE,SAAS;gBACrB,MAAM;aACP,CAAC,CAAC;QACL,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,2BAA2B;IAC3B,KAAK,CAAC,cAAc;QAClB,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;YACtD,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;YACzD,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AA7GD,oDA6GC"}
@@ -0,0 +1,9 @@
1
+ import type { IncomingMessage, ServerResponse } from 'http';
2
+ export interface PlaygroundOptions {
3
+ url: string;
4
+ subscriptionUrl?: string;
5
+ title?: string;
6
+ subtitle?: string;
7
+ }
8
+ export declare function createEnhancedPlayground(options: PlaygroundOptions): (req: IncomingMessage, res: ServerResponse, config?: any) => string;
9
+ //# sourceMappingURL=enhanced-playground.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enhanced-playground.d.ts","sourceRoot":"","sources":["../../src/plugins/enhanced-playground.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAE5D,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,iBAAiB,GACzB,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,GAAG,KAAK,MAAM,CA0FrE"}
@@ -0,0 +1,97 @@
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
+ return `
9
+
10
+ <!--
11
+ * Copyright (c) 2021 GraphQL Contributors
12
+ * All rights reserved.
13
+ *
14
+ * This source code is licensed under the license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ -->
17
+ <!doctype html>
18
+ <html lang="en">
19
+ <head>
20
+ <title>Dubhe Playground</title>
21
+ <style>
22
+ body {
23
+ height: 100%;
24
+ margin: 0;
25
+ width: 100%;
26
+ overflow: hidden;
27
+ }
28
+
29
+ #graphiql {
30
+ height: 100vh;
31
+ }
32
+
33
+ :global(.graphiql-explorer-root > div:first-child) {
34
+ /* Remove the 2nd horizontal scroll bar */
35
+ overflow: hidden !important;
36
+ }
37
+ </style>
38
+ <!--
39
+ This GraphiQL example depends on Promise and fetch, which are available in
40
+ modern browsers, but can be "polyfilled" for older browsers.
41
+ GraphiQL itself depends on React DOM.
42
+ If you do not want to rely on a CDN, you can host these files locally or
43
+ include them directly in your favored resource bundler.
44
+ -->
45
+ <script
46
+ crossorigin
47
+ src="https://unpkg.com/react@18/umd/react.production.min.js"
48
+ ></script>
49
+ <script
50
+ crossorigin
51
+ src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"
52
+ ></script>
53
+ <!--
54
+ These two files can be found in the npm module, however you may wish to
55
+ copy them directly into your environment, or perhaps include them in your
56
+ favored resource bundler.
57
+ -->
58
+ <script
59
+ src="https://unpkg.com/graphiql/graphiql.min.js"
60
+ type="application/javascript"
61
+ ></script>
62
+ <link rel="stylesheet" href="https://unpkg.com/graphiql/graphiql.min.css" />
63
+ <!--
64
+ These are imports for the GraphIQL Explorer plugin.
65
+ -->
66
+ <script
67
+ src="https://unpkg.com/@graphiql/plugin-explorer/dist/index.umd.js"
68
+ crossorigin
69
+ ></script>
70
+
71
+ <link
72
+ rel="stylesheet"
73
+ href="https://unpkg.com/@graphiql/plugin-explorer/dist/style.css"
74
+ />
75
+ </head>
76
+
77
+ <body>
78
+ <div id="graphiql">Loading...</div>
79
+ <script>
80
+ const root = ReactDOM.createRoot(document.getElementById('graphiql'));
81
+ const fetcher = GraphiQL.createFetcher(${JSON.stringify(options)});
82
+ const explorerPlugin = GraphiQLPluginExplorer.explorerPlugin({
83
+ showAttribution: true,
84
+ });
85
+ root.render(
86
+ React.createElement(GraphiQL, {
87
+ fetcher,
88
+ defaultEditorToolsVisibility: true,
89
+ plugins: [explorerPlugin],
90
+ }),
91
+ );
92
+ </script>
93
+ </body>
94
+ </html>`;
95
+ };
96
+ }
97
+ //# 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,4DA4FC;AA5FD,SAAgB,wBAAwB,CACtC,OAA0B;IAE1B,OAAO,CAAC,IAAqB,EAAE,IAAoB,EAAE,OAAa,EAAE,EAAE;QACpE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CAyEoC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;;;;;;;;;;;;;QAa9D,CAAC;IACP,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,28 @@
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
+ constructor();
20
+ private createExpressApp;
21
+ createEnhancedServer(serverConfig: EnhancedServerConfig): Promise<HttpServer>;
22
+ startServer(): Promise<void>;
23
+ private logServerStatus;
24
+ private getSubscriptionStatus;
25
+ quickShutdown(): Promise<void>;
26
+ gracefulShutdown(pgPool: Pool): Promise<void>;
27
+ }
28
+ //# 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;;IAO7C,OAAO,CAAC,gBAAgB;IAmHlB,oBAAoB,CAAC,YAAY,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC;IAkC7E,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,232 @@
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
+ constructor() {
21
+ this.config = subscription_config_1.subscriptionConfig.getConfig();
22
+ }
23
+ // Create Express application
24
+ createExpressApp(serverConfig) {
25
+ const { postgraphileMiddleware, allTables, welcomeConfig, postgraphileConfigOptions } = serverConfig;
26
+ const app = (0, express_1.default)();
27
+ // Middleware configuration
28
+ app.use((0, cors_1.default)({
29
+ origin: '*',
30
+ methods: ['GET', 'POST', 'OPTIONS'],
31
+ allowedHeaders: ['Content-Type', 'Authorization']
32
+ }));
33
+ // Request logging middleware
34
+ app.use((req, res, next) => {
35
+ const startTime = Date.now();
36
+ res.on('finish', () => {
37
+ (0, logger_1.logExpress)(req.method, req.path, res.statusCode, startTime, {
38
+ userAgent: req.get('user-agent')?.substring(0, 50)
39
+ });
40
+ });
41
+ next();
42
+ });
43
+ // Route configuration
44
+ // Root path - welcome page
45
+ app.get('/', (req, res) => {
46
+ res.set('Content-Type', 'text/html; charset=utf-8');
47
+ res.send((0, welcome_page_1.createWelcomePage)(allTables, welcomeConfig));
48
+ });
49
+ // GraphQL Playground
50
+ app.get('/playground', (req, res) => {
51
+ res.set('Content-Type', 'text/html; charset=utf-8');
52
+ res.send((0, postgraphile_config_1.createPlaygroundHtml)(postgraphileConfigOptions));
53
+ });
54
+ // Redirect old GraphiQL paths
55
+ app.get('/graphiql*', (req, res) => {
56
+ logger_1.serverLogger.info('Redirecting old GraphiQL path', {
57
+ from: req.path,
58
+ to: '/playground'
59
+ });
60
+ res.redirect(301, '/playground');
61
+ });
62
+ // Health check endpoint
63
+ app.get('/health', (req, res) => {
64
+ res.json({
65
+ status: 'healthy',
66
+ subscriptions: this.getSubscriptionStatus(),
67
+ timestamp: new Date().toISOString()
68
+ });
69
+ });
70
+ // Subscription configuration endpoint
71
+ app.get('/subscription-config', (req, res) => {
72
+ res.json(subscription_config_1.subscriptionConfig.generateClientConfig());
73
+ });
74
+ // Configuration documentation endpoint
75
+ app.get('/subscription-docs', (req, res) => {
76
+ res.set('Content-Type', 'text/plain');
77
+ res.send(subscription_config_1.subscriptionConfig.generateDocumentation());
78
+ });
79
+ // PostGraphile middleware - mount at root path, let PostGraphile handle routing itself
80
+ app.use((req, res, next) => {
81
+ // Check if PostGraphile middleware exists
82
+ if (!postgraphileMiddleware) {
83
+ console.error('❌ PostGraphile middleware is null!');
84
+ if (req.path.startsWith('/graphql')) {
85
+ res.status(500).json({
86
+ error: 'PostGraphile middleware not properly initialized'
87
+ });
88
+ return;
89
+ }
90
+ next();
91
+ return;
92
+ }
93
+ try {
94
+ postgraphileMiddleware(req, res, next);
95
+ }
96
+ catch (error) {
97
+ console.error('❌ PostGraphile middleware execution error:', error);
98
+ if (req.path.startsWith('/graphql')) {
99
+ res.status(500).json({
100
+ error: 'PostGraphile execution error',
101
+ details: error instanceof Error ? error.message : String(error)
102
+ });
103
+ return;
104
+ }
105
+ next();
106
+ }
107
+ });
108
+ // Error handling middleware
109
+ app.use((err, req, res, next) => {
110
+ logger_1.serverLogger.error('Express error handling', err, {
111
+ url: req.originalUrl,
112
+ method: req.method,
113
+ userAgent: req.get('user-agent')?.substring(0, 50)
114
+ });
115
+ res.status(500).send('Internal Server Error');
116
+ });
117
+ return app;
118
+ }
119
+ // Create and configure HTTP server
120
+ async createEnhancedServer(serverConfig) {
121
+ const { postgraphileMiddleware } = serverConfig;
122
+ // Create Express application
123
+ this.app = this.createExpressApp(serverConfig);
124
+ // Create HTTP server
125
+ this.httpServer = (0, http_1.createServer)(this.app);
126
+ // Enable PostgreSQL subscriptions and WebSocket support
127
+ if (this.config.capabilities.pgSubscriptions) {
128
+ (0, postgraphile_1.enhanceHttpServerWithSubscriptions)(this.httpServer, postgraphileMiddleware, {
129
+ // Enable WebSocket transport
130
+ graphqlRoute: '/graphql'
131
+ });
132
+ logger_1.systemLogger.info('✅ PostgreSQL subscriptions and WebSocket enabled', {
133
+ pgSubscriptions: this.config.capabilities.pgSubscriptions,
134
+ webSocket: true
135
+ });
136
+ }
137
+ logger_1.serverLogger.info('🚀 Express server creation completed', {
138
+ framework: 'Express',
139
+ graphqlPort: this.config.graphqlPort,
140
+ capabilities: {
141
+ pgSubscriptions: this.config.capabilities.pgSubscriptions
142
+ },
143
+ recommendedMethod: 'pg-subscriptions'
144
+ });
145
+ return this.httpServer;
146
+ }
147
+ // Start server
148
+ async startServer() {
149
+ if (!this.httpServer) {
150
+ throw new Error('Server not created, please call createEnhancedServer() first');
151
+ }
152
+ return new Promise((resolve, reject) => {
153
+ this.httpServer.listen(this.config.graphqlPort, (err) => {
154
+ if (err) {
155
+ reject(err);
156
+ return;
157
+ }
158
+ this.logServerStatus();
159
+ resolve();
160
+ });
161
+ });
162
+ }
163
+ // Log server status
164
+ logServerStatus() {
165
+ const clientConfig = subscription_config_1.subscriptionConfig.generateClientConfig();
166
+ logger_1.serverLogger.info('🎉 Express GraphQL server started successfully!', {
167
+ port: this.config.graphqlPort,
168
+ framework: 'Express',
169
+ endpoints: {
170
+ home: `http://localhost:${this.config.graphqlPort}/`,
171
+ playground: `http://localhost:${this.config.graphqlPort}/playground`,
172
+ graphql: clientConfig.graphqlEndpoint,
173
+ subscription: clientConfig.subscriptionEndpoint,
174
+ health: `http://localhost:${this.config.graphqlPort}/health`,
175
+ config: `http://localhost:${this.config.graphqlPort}/subscription-config`,
176
+ docs: `http://localhost:${this.config.graphqlPort}/subscription-docs`
177
+ }
178
+ });
179
+ // Display main access links
180
+ console.log('\n' + '🌟'.repeat(30));
181
+ console.log('🏠 Homepage: ' + `http://localhost:${this.config.graphqlPort}/`);
182
+ console.log('🎮 Playground: ' + `http://localhost:${this.config.graphqlPort}/playground`);
183
+ console.log('🔗 GraphQL: ' + clientConfig.graphqlEndpoint);
184
+ console.log('📡 WebSocket: ' + clientConfig.subscriptionEndpoint);
185
+ console.log('🌟'.repeat(30) + '\n');
186
+ }
187
+ // Get subscription status
188
+ getSubscriptionStatus() {
189
+ return {
190
+ enabled: this.config.capabilities.pgSubscriptions,
191
+ method: 'pg-subscriptions',
192
+ config: subscription_config_1.subscriptionConfig.generateClientConfig()
193
+ };
194
+ }
195
+ // Quick shutdown
196
+ async quickShutdown() {
197
+ logger_1.systemLogger.info('🛑 Starting quick shutdown of Express server...');
198
+ if (this.httpServer) {
199
+ this.httpServer.close();
200
+ logger_1.systemLogger.info('✅ HTTP server closed');
201
+ }
202
+ logger_1.systemLogger.info('🎯 Express server quick shutdown completed');
203
+ }
204
+ // Graceful shutdown
205
+ async gracefulShutdown(pgPool) {
206
+ logger_1.systemLogger.info('🛑 Starting graceful shutdown of Express server...');
207
+ const shutdownPromises = [];
208
+ // Close HTTP server
209
+ if (this.httpServer) {
210
+ shutdownPromises.push(new Promise((resolve) => {
211
+ this.httpServer.close(() => {
212
+ logger_1.systemLogger.info('✅ HTTP server closed');
213
+ resolve();
214
+ });
215
+ }));
216
+ }
217
+ // Close database connection pool
218
+ shutdownPromises.push(pgPool.end().then(() => {
219
+ logger_1.systemLogger.info('✅ Database connection pool closed');
220
+ }));
221
+ try {
222
+ await Promise.all(shutdownPromises);
223
+ logger_1.systemLogger.info('🎯 Express server graceful shutdown completed');
224
+ }
225
+ catch (error) {
226
+ logger_1.systemLogger.error('❌ Error occurred during shutdown process', error);
227
+ throw error;
228
+ }
229
+ }
230
+ }
231
+ exports.EnhancedServerManager = EnhancedServerManager;
232
+ //# 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,CAAqB;IAC3B,GAAG,GAAmB,IAAI,CAAC;IAC3B,UAAU,GAAsB,IAAI,CAAC;IAE7C;QACE,IAAI,CAAC,MAAM,GAAG,wCAAkB,CAAC,SAAS,EAAE,CAAC;IAC/C,CAAC;IAED,6BAA6B;IACrB,gBAAgB,CAAC,YAAkC;QACzD,MAAM,EAAE,sBAAsB,EAAE,SAAS,EAAE,aAAa,EAAE,yBAAyB,EAAE,GACnF,YAAY,CAAC;QAEf,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;QAEtB,2BAA2B;QAC3B,GAAG,CAAC,GAAG,CACL,IAAA,cAAI,EAAC;YACH,MAAM,EAAE,GAAG;YACX,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC;YACnC,cAAc,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC;SAClD,CAAC,CACH,CAAC;QAEF,6BAA6B;QAC7B,GAAG,CAAC,GAAG,CAAC,CAAC,GAAY,EAAE,GAAa,EAAE,IAAI,EAAE,EAAE;YAC5C,MAAM,SA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AgB,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;AAlQD,sDAkQC"}
@@ -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
+ // 插件统一导出入口
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,WAAW;AACX,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
+ }
10
+ export declare function createPostGraphileConfig(options: PostGraphileConfigOptions): {
11
+ graphiql: boolean;
12
+ enhanceGraphiql: boolean;
13
+ showErrorStack: boolean;
14
+ extendedErrors: string[];
15
+ subscriptions: boolean;
16
+ live: boolean;
17
+ enableQueryBatching: boolean;
18
+ enableCors: boolean;
19
+ pluginHook: import("postgraphile/build/postgraphile/pluginHook").PluginHookFn;
20
+ disableDefaultMutations: boolean;
21
+ dynamicJson: boolean;
22
+ setofFunctionsContainNulls: boolean;
23
+ ignoreRBAC: boolean;
24
+ ignoreIndexes: boolean;
25
+ disableQueryLog: boolean;
26
+ allowExplain: boolean;
27
+ watchPg: boolean;
28
+ queryTimeout: number;
29
+ graphqlRoute: string;
30
+ graphiqlRoute: string;
31
+ appendPlugins: import("postgraphile").Plugin[];
32
+ graphileBuildOptions: {
33
+ connectionFilterAllowedOperators: string[];
34
+ connectionFilterAllowedFieldTypes: string[];
35
+ connectionFilterLogicalOperators: boolean;
36
+ connectionFilterRelations: boolean;
37
+ connectionFilterComputedColumns: boolean;
38
+ connectionFilterArrays: boolean;
39
+ connectionFilterSetofFunctions: boolean;
40
+ connectionFilterAllowNullInput: boolean;
41
+ connectionFilterAllowEmptyObjectInput: boolean;
42
+ };
43
+ includeExtensionResources: boolean;
44
+ ignoreTable: (tableName: string) => boolean;
45
+ exportGqlSchemaPath: string | undefined;
46
+ } | {
47
+ queryCache?: boolean | undefined;
48
+ allowExplain: boolean;
49
+ ownerConnectionString: string;
50
+ websocketMiddlewares: never[];
51
+ pgSettings: {
52
+ statement_timeout: string;
53
+ default_transaction_isolation: string;
54
+ };
55
+ retryOnInitFail: boolean;
56
+ pgDefaultRole: undefined;
57
+ jwtSecret: undefined;
58
+ graphiql: boolean;
59
+ enhanceGraphiql: boolean;
60
+ showErrorStack: boolean;
61
+ extendedErrors: string[];
62
+ subscriptions: boolean;
63
+ live: boolean;
64
+ enableQueryBatching: boolean;
65
+ enableCors: boolean;
66
+ pluginHook: import("postgraphile/build/postgraphile/pluginHook").PluginHookFn;
67
+ disableDefaultMutations: boolean;
68
+ dynamicJson: boolean;
69
+ setofFunctionsContainNulls: boolean;
70
+ ignoreRBAC: boolean;
71
+ ignoreIndexes: boolean;
72
+ disableQueryLog: boolean;
73
+ watchPg: boolean;
74
+ queryTimeout: number;
75
+ graphqlRoute: string;
76
+ graphiqlRoute: string;
77
+ appendPlugins: import("postgraphile").Plugin[];
78
+ graphileBuildOptions: {
79
+ connectionFilterAllowedOperators: string[];
80
+ connectionFilterAllowedFieldTypes: string[];
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;CAC3B;AAGD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BA2I9C,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAAN,MAAM;;EA8ClC;AAGD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,yBAAyB,GAAG,MAAM,CAiB/E"}