@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,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createPostGraphileConfig = createPostGraphileConfig;
|
|
7
|
+
exports.createPlaygroundHtml = createPlaygroundHtml;
|
|
8
|
+
const query_filter_1 = require("./query-filter");
|
|
9
|
+
const simple_naming_1 = require("./simple-naming");
|
|
10
|
+
const all_fields_filter_plugin_1 = require("./all-fields-filter-plugin");
|
|
11
|
+
const enhanced_playground_1 = require("./enhanced-playground");
|
|
12
|
+
const postgraphile_plugin_connection_filter_1 = __importDefault(require("postgraphile-plugin-connection-filter"));
|
|
13
|
+
const pg_simplify_inflector_1 = __importDefault(require("@graphile-contrib/pg-simplify-inflector"));
|
|
14
|
+
const postgraphile_1 = require("postgraphile");
|
|
15
|
+
const pg_pubsub_1 = __importDefault(require("@graphile/pg-pubsub"));
|
|
16
|
+
// Create PostGraphile configuration
|
|
17
|
+
function createPostGraphileConfig(options) {
|
|
18
|
+
const { port, nodeEnv, graphqlEndpoint, enableSubscriptions, enableCors, availableTables } = options;
|
|
19
|
+
// Build GraphQL and WebSocket endpoint URLs
|
|
20
|
+
const baseUrl = `http://localhost:${port}`;
|
|
21
|
+
const _graphqlUrl = `${baseUrl}${graphqlEndpoint}`;
|
|
22
|
+
const _subscriptionUrl = enableSubscriptions === 'true' ? `ws://localhost:${port}${graphqlEndpoint}` : undefined;
|
|
23
|
+
// Create plugin hook to support WebSocket and subscriptions
|
|
24
|
+
const pluginHook = (0, postgraphile_1.makePluginHook)([pg_pubsub_1.default]);
|
|
25
|
+
const config = {
|
|
26
|
+
// Basic configuration - disable default GraphiQL
|
|
27
|
+
graphiql: false,
|
|
28
|
+
enhanceGraphiql: false,
|
|
29
|
+
showErrorStack: nodeEnv === 'development',
|
|
30
|
+
extendedErrors: nodeEnv === 'development' ? ['hint', 'detail', 'errcode'] : [],
|
|
31
|
+
// Feature configuration - enable subscriptions
|
|
32
|
+
subscriptions: enableSubscriptions === 'true',
|
|
33
|
+
live: enableSubscriptions === 'true', // Enable live functionality to support subscriptions
|
|
34
|
+
enableQueryBatching: true,
|
|
35
|
+
enableCors: enableCors === 'true',
|
|
36
|
+
// Add plugin hook to support WebSocket
|
|
37
|
+
pluginHook,
|
|
38
|
+
// Disable all mutation functionality - only keep queries and subscriptions
|
|
39
|
+
disableDefaultMutations: true,
|
|
40
|
+
// Schema configuration
|
|
41
|
+
dynamicJson: true,
|
|
42
|
+
setofFunctionsContainNulls: false,
|
|
43
|
+
ignoreRBAC: false,
|
|
44
|
+
ignoreIndexes: true,
|
|
45
|
+
// Log control configuration
|
|
46
|
+
// Control SQL query logs through CLI parameters
|
|
47
|
+
disableQueryLog: options.disableQueryLog || (nodeEnv === 'production' && !options.enableQueryLog),
|
|
48
|
+
// Enable query execution plan explanation (development environment only)
|
|
49
|
+
allowExplain: nodeEnv === 'development',
|
|
50
|
+
// Monitor PostgreSQL changes (development environment only)
|
|
51
|
+
watchPg: nodeEnv === 'development',
|
|
52
|
+
// GraphQL query timeout setting
|
|
53
|
+
queryTimeout: options.queryTimeout,
|
|
54
|
+
// GraphQL endpoint - explicitly specify route
|
|
55
|
+
graphqlRoute: graphqlEndpoint,
|
|
56
|
+
graphiqlRoute: '/graphiql', // GraphiQL interface route
|
|
57
|
+
// Add custom plugins
|
|
58
|
+
appendPlugins: [
|
|
59
|
+
query_filter_1.QueryFilterPlugin, // Must execute before SimpleNamingPlugin
|
|
60
|
+
pg_simplify_inflector_1.default, // Simplify field names, remove ByXxxAndYyy suffixes
|
|
61
|
+
simple_naming_1.SimpleNamingPlugin, // Fixed field loss issue
|
|
62
|
+
postgraphile_plugin_connection_filter_1.default,
|
|
63
|
+
all_fields_filter_plugin_1.AllFieldsFilterPlugin
|
|
64
|
+
],
|
|
65
|
+
// Advanced configuration options for Connection Filter plugin
|
|
66
|
+
graphileBuildOptions: {
|
|
67
|
+
// Enable logical operators (and, or, not)
|
|
68
|
+
connectionFilterLogicalOperators: true,
|
|
69
|
+
// Enable relationship filtering
|
|
70
|
+
connectionFilterRelations: true,
|
|
71
|
+
// Enable computed column filtering
|
|
72
|
+
connectionFilterComputedColumns: true,
|
|
73
|
+
// Enable array filtering
|
|
74
|
+
connectionFilterArrays: true,
|
|
75
|
+
// Enable function filtering
|
|
76
|
+
connectionFilterSetofFunctions: true,
|
|
77
|
+
// Allow null input and empty object input
|
|
78
|
+
connectionFilterAllowNullInput: true,
|
|
79
|
+
connectionFilterAllowEmptyObjectInput: true
|
|
80
|
+
},
|
|
81
|
+
// Only include detected tables
|
|
82
|
+
includeExtensionResources: false,
|
|
83
|
+
// Exclude unnecessary tables
|
|
84
|
+
ignoreTable: (tableName) => {
|
|
85
|
+
// If no tables detected, allow all tables
|
|
86
|
+
if (availableTables.length === 0) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
// Otherwise only include detected tables
|
|
90
|
+
return !availableTables.includes(tableName);
|
|
91
|
+
},
|
|
92
|
+
// Export schema (development environment)
|
|
93
|
+
exportGqlSchemaPath: nodeEnv === 'development' ? 'sui-indexer-schema.graphql' : undefined
|
|
94
|
+
};
|
|
95
|
+
// If subscriptions are enabled, add additional PostgreSQL subscription configuration
|
|
96
|
+
if (enableSubscriptions === 'true') {
|
|
97
|
+
return {
|
|
98
|
+
...config,
|
|
99
|
+
// Use dedicated subscription connection pool
|
|
100
|
+
ownerConnectionString: options.databaseUrl,
|
|
101
|
+
// WebSocket configuration
|
|
102
|
+
websocketMiddlewares: [],
|
|
103
|
+
// PostgreSQL settings - optimized for long-running subscriptions
|
|
104
|
+
pgSettings: {
|
|
105
|
+
statement_timeout: '0', // No timeout for subscription queries
|
|
106
|
+
idle_in_transaction_session_timeout: '0', // Allow long transactions
|
|
107
|
+
default_transaction_isolation: 'read committed'
|
|
108
|
+
},
|
|
109
|
+
// Retry on connection failure
|
|
110
|
+
retryOnInitFail: true,
|
|
111
|
+
// Performance optimization for subscriptions
|
|
112
|
+
pgDefaultRole: undefined,
|
|
113
|
+
jwtSecret: undefined,
|
|
114
|
+
// Additional configuration for development environment
|
|
115
|
+
...(nodeEnv === 'development' && {
|
|
116
|
+
queryCache: false, // Disable cache for real-time data
|
|
117
|
+
allowExplain: true
|
|
118
|
+
})
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
return config;
|
|
122
|
+
}
|
|
123
|
+
// Export enhanced playground HTML generator
|
|
124
|
+
function createPlaygroundHtml(options) {
|
|
125
|
+
const { graphqlEndpoint, enableSubscriptions, availableTables } = options;
|
|
126
|
+
// Use relative URLs so playground connects to the same domain as the server
|
|
127
|
+
const graphqlUrl = graphqlEndpoint;
|
|
128
|
+
const subscriptionUrl = enableSubscriptions === 'true' ? graphqlEndpoint : undefined;
|
|
129
|
+
return (0, enhanced_playground_1.createEnhancedPlayground)({
|
|
130
|
+
url: graphqlUrl,
|
|
131
|
+
subscriptionUrl,
|
|
132
|
+
title: 'Sui Indexer GraphQL Playground',
|
|
133
|
+
subtitle: `Powerful GraphQL API | ${availableTables.length} tables discovered | ${enableSubscriptions === 'true'
|
|
134
|
+
? 'Real-time subscriptions supported'
|
|
135
|
+
: 'Real-time subscriptions disabled'}`
|
|
136
|
+
})(null, null, {});
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=postgraphile-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgraphile-config.js","sourceRoot":"","sources":["../../src/plugins/postgraphile-config.ts"],"names":[],"mappings":";;;;;AAwBA,4DAyIC;AAGD,oDAiBC;AArLD,iDAAmD;AACnD,mDAAqD;AACrD,yEAAmE;AACnE,+DAAiE;AACjE,kHAA2E;AAC3E,oGAAgF;AAChF,+CAA8C;AAC9C,oEAA2C;AAgB3C,oCAAoC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E,MAAM,cAAc,CAAC;AAGtC,eAAO,MAAM,iBAAiB,EAAE,MA2C/B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QueryFilterPlugin = void 0;
|
|
4
|
+
// Query filter plugin - only keep useful table-related queries
|
|
5
|
+
const QueryFilterPlugin = (builder) => {
|
|
6
|
+
// Filter query fields
|
|
7
|
+
builder.hook('GraphQLObjectType:fields', (fields, build, context) => {
|
|
8
|
+
const { scope: { isRootQuery } } = context;
|
|
9
|
+
if (!isRootQuery) {
|
|
10
|
+
return fields;
|
|
11
|
+
}
|
|
12
|
+
// Define query types to keep
|
|
13
|
+
const allowedQueries = new Set();
|
|
14
|
+
// Get all table-related queries
|
|
15
|
+
Object.keys(fields).forEach((fieldName) => {
|
|
16
|
+
// Keep PostGraphile required system fields
|
|
17
|
+
if (['query', 'nodeId', 'node'].includes(fieldName)) {
|
|
18
|
+
allowedQueries.add(fieldName);
|
|
19
|
+
}
|
|
20
|
+
// Keep store table-related queries
|
|
21
|
+
if (fieldName.match(/^(allStore|store)/i)) {
|
|
22
|
+
allowedQueries.add(fieldName);
|
|
23
|
+
}
|
|
24
|
+
// Keep table_fields table queries
|
|
25
|
+
if (fieldName.match(/^(allTable|table)/i)) {
|
|
26
|
+
allowedQueries.add(fieldName);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
// Filter fields, only keep allowed queries
|
|
30
|
+
const filteredFields = {};
|
|
31
|
+
Object.keys(fields).forEach((fieldName) => {
|
|
32
|
+
if (allowedQueries.has(fieldName)) {
|
|
33
|
+
filteredFields[fieldName] = fields[fieldName];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
// console.log('🔍 Filtered query fields:', Object.keys(filteredFields));
|
|
37
|
+
return filteredFields;
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
exports.QueryFilterPlugin = QueryFilterPlugin;
|
|
41
|
+
exports.default = exports.QueryFilterPlugin;
|
|
42
|
+
//# sourceMappingURL=query-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-filter.js","sourceRoot":"","sources":["../../src/plugins/query-filter.ts"],"names":[],"mappings":";;;AAGA,+DAA+D;AACxD,MAAM,iBAAiB,GAAW,CAAC,OAAO,EAAE,EAAE;IACnD,sBAAsB;IACtB,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAClE,MAAM,EACJ,KAAK,EAAE,EAAE,WAAW,EAAE,EACvB,GAAG,OAAO,CAAC;QAEZ,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,6BAA6B;QAC7B,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;QAEzC,gCAAgC;QAChC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YACxC,2CAA2C;YAC3C,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;gBACpD,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAChC,CAAC;YAED,mCAAmC;YACnC,IAAI,SAAS,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE,CAAC;gBAC1C,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAChC,CAAC;YAED,kCAAkC;YAClC,IAAI,SAAS,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE,CAAC;gBAC1C,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAChC,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,2CAA2C;QAC3C,MAAM,cAAc,GAAkB,EAAE,CAAC;QACzC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YACxC,IAAI,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;gBAClC,cAAc,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;YAChD,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,yEAAyE;QACzE,OAAO,cAAc,CAAC;IACxB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AA3CW,QAAA,iBAAiB,qBA2C5B;AAEF,kBAAe,yBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-naming.d.ts","sourceRoot":"","sources":["../../src/plugins/simple-naming.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,eAAO,MAAM,kBAAkB,EAAE,MAoGhC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SimpleNamingPlugin = void 0;
|
|
4
|
+
const SimpleNamingPlugin = (builder) => {
|
|
5
|
+
// Rename query fields
|
|
6
|
+
builder.hook('GraphQLObjectType:fields', (fields, build, context) => {
|
|
7
|
+
const { scope: { isRootQuery } } = context;
|
|
8
|
+
if (!isRootQuery) {
|
|
9
|
+
return fields;
|
|
10
|
+
}
|
|
11
|
+
// Create renamed field mapping
|
|
12
|
+
const renamedFields = {};
|
|
13
|
+
const originalFieldNames = Object.keys(fields);
|
|
14
|
+
console.log('🔍 Original field list:', originalFieldNames);
|
|
15
|
+
// For tracking rename mapping
|
|
16
|
+
const renameMap = {};
|
|
17
|
+
originalFieldNames.forEach((fieldName) => {
|
|
18
|
+
let newFieldName = fieldName;
|
|
19
|
+
// Remove "all" prefix, but keep system fields
|
|
20
|
+
if (fieldName.startsWith('all') &&
|
|
21
|
+
!['allRows', 'allTableFields'].includes(fieldName) // Extend reserved list
|
|
22
|
+
) {
|
|
23
|
+
// allStoreAccounts -> storeAccounts
|
|
24
|
+
// allStoreEncounters -> storeEncounters
|
|
25
|
+
newFieldName = fieldName.replace(/^all/, '');
|
|
26
|
+
// First letter to lowercase, maintain camelCase
|
|
27
|
+
if (newFieldName.length > 0) {
|
|
28
|
+
newFieldName = newFieldName.charAt(0).toLowerCase() + newFieldName.slice(1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// Remove "store" prefix (note lowercase s, because it's already processed above)
|
|
32
|
+
if (newFieldName.startsWith('store') && newFieldName !== 'store') {
|
|
33
|
+
// storeAccounts -> accounts
|
|
34
|
+
// storeAccount -> account
|
|
35
|
+
// storeEncounters -> encounters
|
|
36
|
+
// storeEncounter -> encounter
|
|
37
|
+
const withoutStore = newFieldName.replace(/^store/, '');
|
|
38
|
+
// First letter to lowercase, maintain camelCase
|
|
39
|
+
if (withoutStore.length > 0) {
|
|
40
|
+
const finalName = withoutStore.charAt(0).toLowerCase() + withoutStore.slice(1);
|
|
41
|
+
// Check if field name conflict will occur
|
|
42
|
+
if (!renamedFields[finalName] && !originalFieldNames.includes(finalName)) {
|
|
43
|
+
newFieldName = finalName;
|
|
44
|
+
}
|
|
45
|
+
// If conflict, keep original name (remove all but keep store)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Check if final field name will conflict
|
|
49
|
+
if (renamedFields[newFieldName]) {
|
|
50
|
+
console.warn(`⚠️ Field name conflict: ${newFieldName}, keeping original name ${fieldName}`);
|
|
51
|
+
newFieldName = fieldName; // Keep original name to avoid conflict
|
|
52
|
+
}
|
|
53
|
+
renameMap[fieldName] = newFieldName;
|
|
54
|
+
renamedFields[newFieldName] = fields[fieldName];
|
|
55
|
+
});
|
|
56
|
+
const renamedCount = Object.entries(renameMap).filter(([old, newName]) => old !== newName).length;
|
|
57
|
+
const finalFieldNames = Object.keys(renamedFields);
|
|
58
|
+
console.log('🔄 Field rename statistics:', {
|
|
59
|
+
'Original field count': originalFieldNames.length,
|
|
60
|
+
'Final field count': finalFieldNames.length,
|
|
61
|
+
'Renamed field count': renamedCount
|
|
62
|
+
});
|
|
63
|
+
if (renamedCount > 0) {
|
|
64
|
+
console.log('📝 Rename mapping:', Object.entries(renameMap)
|
|
65
|
+
.filter(([old, newName]) => old !== newName)
|
|
66
|
+
.reduce((acc, [old, newName]) => ({ ...acc, [old]: newName }), {}));
|
|
67
|
+
}
|
|
68
|
+
// Ensure field count is not lost
|
|
69
|
+
if (finalFieldNames.length !== originalFieldNames.length) {
|
|
70
|
+
console.error('❌ Fields lost! Original:', originalFieldNames.length, 'Final:', finalFieldNames.length);
|
|
71
|
+
// If fields are lost, return original fields to avoid breakage
|
|
72
|
+
return fields;
|
|
73
|
+
}
|
|
74
|
+
return renamedFields;
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
exports.SimpleNamingPlugin = SimpleNamingPlugin;
|
|
78
|
+
exports.default = exports.SimpleNamingPlugin;
|
|
79
|
+
//# sourceMappingURL=simple-naming.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-naming.js","sourceRoot":"","sources":["../../src/plugins/simple-naming.ts"],"names":[],"mappings":";;;AAEO,MAAM,kBAAkB,GAAW,CAAC,OAAO,EAAE,EAAE;IACpD,sBAAsB;IACtB,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAClE,MAAM,EACJ,KAAK,EAAE,EAAE,WAAW,EAAE,EACvB,GAAG,OAAO,CAAC;QAEZ,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,+BAA+B;QAC/B,MAAM,aAAa,GAAkB,EAAE,CAAC;QACxC,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE/C,OAA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AAE,CAAC,EAAE,EAAE,CAAC,CACrE,CAAC;QACJ,CAAC;QAED,iCAAiC;QACjC,IAAI,eAAe,CAAC,MAAM,KAAK,kBAAkB,CAAC,MAAM,EAAE,CAAC;YACzD,OAAO,CAAC,KAAK,CACX,0BAA0B,EAC1B,kBAAkB,CAAC,MAAM,EACzB,QAAQ,EACR,eAAe,CAAC,MAAM,CACvB,CAAC;YACF,+DAA+D;YAC/D,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,OAAO,aAAa,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AApGW,QAAA,kBAAkB,sBAoG7B;AAEF,kBAAe,0BAAkB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DynamicTable } from './database-introspector';
|
|
2
|
+
export interface WelcomePageConfig {
|
|
3
|
+
port: string | number;
|
|
4
|
+
graphqlEndpoint: string;
|
|
5
|
+
nodeEnv: string;
|
|
6
|
+
schema: string;
|
|
7
|
+
enableCors: string;
|
|
8
|
+
enableSubscriptions: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function createWelcomePage(tables: DynamicTable[], config: WelcomePageConfig): string;
|
|
11
|
+
//# sourceMappingURL=welcome-page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"welcome-page.d.ts","sourceRoot":"","sources":["../../src/plugins/welcome-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAGD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,iBAAiB,GAAG,MAAM,CA6M3F"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createWelcomePage = createWelcomePage;
|
|
4
|
+
// Create custom welcome page
|
|
5
|
+
function createWelcomePage(tables, config) {
|
|
6
|
+
const { port, graphqlEndpoint, nodeEnv, schema, enableCors, enableSubscriptions } = config;
|
|
7
|
+
const tableList = tables
|
|
8
|
+
.map((table) => {
|
|
9
|
+
const keyFields = table.fields.filter((f) => f.is_key).map((f) => f.field_name);
|
|
10
|
+
const valueFields = table.fields.filter((f) => !f.is_key).map((f) => f.field_name);
|
|
11
|
+
return `
|
|
12
|
+
<div class="table-info">
|
|
13
|
+
<h3>📊 ${table.table_name}</h3>
|
|
14
|
+
<div class="fields">
|
|
15
|
+
<div><strong>Key Fields:</strong> ${keyFields.join(', ') || 'None'}</div>
|
|
16
|
+
<div><strong>Value Fields:</strong> ${valueFields.join(', ')}</div>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
`;
|
|
20
|
+
})
|
|
21
|
+
.join('');
|
|
22
|
+
return `
|
|
23
|
+
<!DOCTYPE html>
|
|
24
|
+
<html>
|
|
25
|
+
<head>
|
|
26
|
+
<title>🚀 Sui Indexer GraphQL API</title>
|
|
27
|
+
<meta charset="utf-8">
|
|
28
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
29
|
+
<style>
|
|
30
|
+
body {
|
|
31
|
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
32
|
+
margin: 0;
|
|
33
|
+
padding: 20px;
|
|
34
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
35
|
+
color: #333;
|
|
36
|
+
min-height: 100vh;
|
|
37
|
+
}
|
|
38
|
+
.container {
|
|
39
|
+
max-width: 1200px;
|
|
40
|
+
margin: 0 auto;
|
|
41
|
+
background: white;
|
|
42
|
+
padding: 40px;
|
|
43
|
+
border-radius: 16px;
|
|
44
|
+
box-shadow: 0 20px 40px rgba(0,0,0,0.1);
|
|
45
|
+
}
|
|
46
|
+
h1 {
|
|
47
|
+
color: #2c3e50;
|
|
48
|
+
text-align: center;
|
|
49
|
+
margin-bottom: 10px;
|
|
50
|
+
font-size: 2.5em;
|
|
51
|
+
}
|
|
52
|
+
.subtitle {
|
|
53
|
+
text-align: center;
|
|
54
|
+
color: #7f8c8d;
|
|
55
|
+
margin-bottom: 40px;
|
|
56
|
+
font-size: 1.2em;
|
|
57
|
+
}
|
|
58
|
+
.link {
|
|
59
|
+
display: inline-block;
|
|
60
|
+
margin: 10px;
|
|
61
|
+
padding: 15px 25px;
|
|
62
|
+
background: linear-gradient(135deg, #74b9ff, #0984e3);
|
|
63
|
+
color: white;
|
|
64
|
+
text-decoration: none;
|
|
65
|
+
border-radius: 8px;
|
|
66
|
+
text-align: center;
|
|
67
|
+
font-weight: 500;
|
|
68
|
+
transition: transform 0.2s ease;
|
|
69
|
+
}
|
|
70
|
+
.link:hover {
|
|
71
|
+
transform: translateY(-2px);
|
|
72
|
+
box-shadow: 0 8px 15px rgba(116, 185, 255, 0.4);
|
|
73
|
+
}
|
|
74
|
+
.status {
|
|
75
|
+
color: #00b894;
|
|
76
|
+
font-weight: bold;
|
|
77
|
+
text-align: center;
|
|
78
|
+
font-size: 1.1em;
|
|
79
|
+
margin: 20px 0;
|
|
80
|
+
}
|
|
81
|
+
.warning {
|
|
82
|
+
background: #ffeaa7;
|
|
83
|
+
border-left: 4px solid #fdcb6e;
|
|
84
|
+
padding: 15px;
|
|
85
|
+
margin: 20px 0;
|
|
86
|
+
border-radius: 4px;
|
|
87
|
+
}
|
|
88
|
+
.warning h4 {
|
|
89
|
+
margin-top: 0;
|
|
90
|
+
color: #e17055;
|
|
91
|
+
}
|
|
92
|
+
.table-info {
|
|
93
|
+
background: #f8f9fa;
|
|
94
|
+
padding: 20px;
|
|
95
|
+
margin: 15px 0;
|
|
96
|
+
border-radius: 8px;
|
|
97
|
+
border-left: 4px solid #74b9ff;
|
|
98
|
+
}
|
|
99
|
+
.table-info h3 {
|
|
100
|
+
margin: 0 0 10px 0;
|
|
101
|
+
color: #2c3e50;
|
|
102
|
+
}
|
|
103
|
+
.fields div {
|
|
104
|
+
margin: 5px 0;
|
|
105
|
+
color: #555;
|
|
106
|
+
}
|
|
107
|
+
.info-grid {
|
|
108
|
+
display: grid;
|
|
109
|
+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
|
110
|
+
gap: 20px;
|
|
111
|
+
margin: 30px 0;
|
|
112
|
+
}
|
|
113
|
+
.info-card {
|
|
114
|
+
background: #f8f9fa;
|
|
115
|
+
padding: 20px;
|
|
116
|
+
border-radius: 8px;
|
|
117
|
+
border: 1px solid #e9ecef;
|
|
118
|
+
}
|
|
119
|
+
.info-card h3 {
|
|
120
|
+
color: #495057;
|
|
121
|
+
margin-top: 0;
|
|
122
|
+
}
|
|
123
|
+
.center {
|
|
124
|
+
text-align: center;
|
|
125
|
+
}
|
|
126
|
+
.highlight {
|
|
127
|
+
background: linear-gradient(135deg, #fdcb6e, #e17055);
|
|
128
|
+
color: white;
|
|
129
|
+
padding: 2px 8px;
|
|
130
|
+
border-radius: 4px;
|
|
131
|
+
font-weight: 500;
|
|
132
|
+
}
|
|
133
|
+
</style>
|
|
134
|
+
</head>
|
|
135
|
+
<body>
|
|
136
|
+
<div class="container">
|
|
137
|
+
<h1>🚀 Sui Indexer GraphQL API</h1>
|
|
138
|
+
<p class="subtitle">Dynamically scan database, automatically generate GraphQL API</p>
|
|
139
|
+
<p class="status">● Server Status: Running Normally | Scanned <span class="highlight">${tables.length}</span> tables</p>
|
|
140
|
+
|
|
141
|
+
${enableSubscriptions === 'false'
|
|
142
|
+
? `
|
|
143
|
+
<div class="warning">
|
|
144
|
+
<h4>⚠️ WebSocket subscription feature is temporarily disabled</h4>
|
|
145
|
+
<p>Currently fixing subscription configuration issues. Basic GraphQL query and mutation functions work perfectly.</p>
|
|
146
|
+
</div>
|
|
147
|
+
`
|
|
148
|
+
: `
|
|
149
|
+
<div class="status">
|
|
150
|
+
<p>📡 Real-time subscription feature: ${enableSubscriptions === 'true' ? 'Enabled' : 'Disabled'}</p>
|
|
151
|
+
</div>
|
|
152
|
+
`}
|
|
153
|
+
|
|
154
|
+
<div class="center">
|
|
155
|
+
<a href="${graphqlEndpoint}" class="link">📊 GraphQL API</a>
|
|
156
|
+
<a href="/playground" class="link">🎮 Enhanced GraphQL Playground</a>
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
<div class="info-grid">
|
|
160
|
+
<div class="info-card">
|
|
161
|
+
<h3>🎯 Core Features</h3>
|
|
162
|
+
<ul>
|
|
163
|
+
<li>✨ Auto-scan dubhe-indexer database</li>
|
|
164
|
+
<li>🔄 Dynamically generate GraphQL schema</li>
|
|
165
|
+
<li>📡 Support real-time subscription features ${enableSubscriptions === 'true' ? '✅' : '⚠️'}</li>
|
|
166
|
+
<li>🚀 Complete CRUD operations</li>
|
|
167
|
+
<li>🛡️ PostGraphile powerful features</li>
|
|
168
|
+
</ul>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<div class="info-card">
|
|
172
|
+
<h3>📊 Server Information</h3>
|
|
173
|
+
<ul>
|
|
174
|
+
<li>Environment: ${nodeEnv}</li>
|
|
175
|
+
<li>Port: ${port}</li>
|
|
176
|
+
<li>Database Schema: ${schema}</li>
|
|
177
|
+
<li>CORS: ${enableCors === 'true' ? 'Enabled' : 'Disabled'}</li>
|
|
178
|
+
<li>Subscriptions: ${enableSubscriptions === 'true' ? 'Enabled' : 'Disabled'}</li>
|
|
179
|
+
</ul>
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
<h2>📋 Detected Data Tables</h2>
|
|
184
|
+
${tableList}
|
|
185
|
+
|
|
186
|
+
<div style="margin-top: 40px; padding: 20px; background: #e3f2fd; border-radius: 8px;">
|
|
187
|
+
<h3>💡 Usage Tips</h3>
|
|
188
|
+
<p>1. Visit <strong>Enhanced GraphQL Playground</strong> for better query experience</p>
|
|
189
|
+
<p> • 📊 Visual Schema Explorer - Click-to-build queries</p>
|
|
190
|
+
<p> • 🎨 Modern UI interface and enhanced code highlighting</p>
|
|
191
|
+
<p> • 📝 Code export feature - Generate client code in multiple languages</p>
|
|
192
|
+
<p> • ⌨️ Keyboard shortcuts support - Ctrl/Cmd+Enter to execute queries</p>
|
|
193
|
+
<p>2. All tables support standard GraphQL query, mutation${enableSubscriptions === 'true' ? ' and subscription' : ''} operations</p>
|
|
194
|
+
<p>3. Dynamic tables (store_*) automatically generate fields based on table_fields metadata</p>
|
|
195
|
+
<p>4. System tables provide core data access for dubhe-indexer</p>
|
|
196
|
+
${enableSubscriptions === 'true' ? '<p>5. Use WebSocket for real-time data subscriptions</p>' : ''}
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
</body>
|
|
200
|
+
</html>
|
|
201
|
+
`;
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=welcome-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"welcome-page.js","sourceRoot":"","sources":["../../src/plugins/welcome-page.ts"],"names":[],"mappings":";;AAYA,8CA6MC;AA9MD,6BAA6B;AAC7B,SAAgB,iBAAiB,CAAC,MAAsB,EAAE,MAAyB;IACjF,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,GAAG,MAAM,CAAC;IAE3F,MAAM,SAAS,GAAG,MAAM;SACrB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACb,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC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;;;;;EAKtG,CAAC;AACH,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ServerConfig {
|
|
2
|
+
port: string;
|
|
3
|
+
databaseUrl: string;
|
|
4
|
+
schema: string;
|
|
5
|
+
endpoint: string;
|
|
6
|
+
cors: boolean;
|
|
7
|
+
subscriptions: boolean;
|
|
8
|
+
env: string;
|
|
9
|
+
debug: boolean;
|
|
10
|
+
queryTimeout: number;
|
|
11
|
+
maxConnections: number;
|
|
12
|
+
heartbeatInterval: number;
|
|
13
|
+
enableMetrics: boolean;
|
|
14
|
+
enableLiveQueries: boolean;
|
|
15
|
+
enablePgSubscriptions: boolean;
|
|
16
|
+
enableNativeWebSocket: boolean;
|
|
17
|
+
realtimePort?: number;
|
|
18
|
+
debugNotifications: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const startServer: (config: ServerConfig) => Promise<void>;
|
|
21
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AA2BA,MAAM,WAAW,YAAY;IAE3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,aAAa,EAAE,OAAO,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IAGZ,KAAK,EAAE,OAAO,CAAC;IAGf,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,OAAO,CAAC;IAGvB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAGD,eAAO,MAAM,WAAW,GAAU,QAAQ,YAAY,KAAG,OAAO,CAAC,IAAI,CA0QpE,CAAC"}
|