@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,183 @@
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
+ // 创建 PostGraphile 配置
17
+ function createPostGraphileConfig(options) {
18
+ const { port, nodeEnv, graphqlEndpoint, enableSubscriptions, enableCors, availableTables } = options;
19
+ // 构建GraphQL和WebSocket端点URL
20
+ const baseUrl = `http://localhost:${port}`;
21
+ const graphqlUrl = `${baseUrl}${graphqlEndpoint}`;
22
+ const subscriptionUrl = enableSubscriptions === 'true' ? `ws://localhost:${port}${graphqlEndpoint}` : undefined;
23
+ // 创建插件钩子以支持WebSocket和订阅
24
+ const pluginHook = (0, postgraphile_1.makePluginHook)([pg_pubsub_1.default]);
25
+ const config = {
26
+ // 基础配置 - 关闭默认GraphiQL
27
+ graphiql: false,
28
+ enhanceGraphiql: false,
29
+ showErrorStack: nodeEnv === 'development',
30
+ extendedErrors: nodeEnv === 'development' ? ['hint', 'detail', 'errcode'] : [],
31
+ // 功能配置 - 启用订阅
32
+ subscriptions: enableSubscriptions === 'true',
33
+ live: enableSubscriptions === 'true', // 启用live功能以支持订阅
34
+ enableQueryBatching: true,
35
+ enableCors: enableCors === 'true',
36
+ // 添加插件钩子以支持WebSocket
37
+ pluginHook,
38
+ // 禁用所有mutation功能 - 只保留查询和订阅
39
+ disableDefaultMutations: true,
40
+ // Schema 配置
41
+ dynamicJson: true,
42
+ setofFunctionsContainNulls: false,
43
+ ignoreRBAC: false,
44
+ ignoreIndexes: true,
45
+ // 日志控制配置
46
+ // 通过环境变量控制SQL查询日志: DISABLE_QUERY_LOG=true 禁用查询日志
47
+ disableQueryLog: process.env.DISABLE_QUERY_LOG === 'true' ||
48
+ (nodeEnv === 'production' && process.env.ENABLE_QUERY_LOG !== 'true'),
49
+ // 启用查询执行计划解释(仅开发环境)
50
+ allowExplain: nodeEnv === 'development',
51
+ // 监控PostgreSQL变化(仅开发环境)
52
+ watchPg: nodeEnv === 'development',
53
+ // GraphQL查询超时设置
54
+ queryTimeout: parseInt(process.env.QUERY_TIMEOUT || '30000'),
55
+ // GraphQL 端点 - 明确指定路由
56
+ graphqlRoute: graphqlEndpoint,
57
+ graphiqlRoute: '/graphiql', // GraphiQL界面路由
58
+ // 添加自定义插件
59
+ appendPlugins: [
60
+ query_filter_1.QueryFilterPlugin, // 必须在SimpleNamingPlugin之前执行
61
+ pg_simplify_inflector_1.default, // 简化字段名,去掉ByXxxAndYyy后缀
62
+ simple_naming_1.SimpleNamingPlugin, // 已修复字段丢失问题
63
+ postgraphile_plugin_connection_filter_1.default,
64
+ all_fields_filter_plugin_1.AllFieldsFilterPlugin
65
+ ],
66
+ // Connection Filter 插件的高级配置选项
67
+ graphileBuildOptions: {
68
+ // 启用所有支持的操作符
69
+ connectionFilterAllowedOperators: [
70
+ 'isNull',
71
+ 'equalTo',
72
+ 'notEqualTo',
73
+ 'distinctFrom',
74
+ 'notDistinctFrom',
75
+ 'lessThan',
76
+ 'lessThanOrEqualTo',
77
+ 'greaterThan',
78
+ 'greaterThanOrEqualTo',
79
+ 'in',
80
+ 'notIn',
81
+ 'like',
82
+ 'notLike',
83
+ 'ilike',
84
+ 'notIlike',
85
+ 'similarTo',
86
+ 'notSimilarTo',
87
+ 'includes',
88
+ 'notIncludes',
89
+ 'includesInsensitive',
90
+ 'notIncludesInsensitive',
91
+ 'startsWith',
92
+ 'notStartsWith',
93
+ 'startsWithInsensitive',
94
+ 'notStartsWithInsensitive',
95
+ 'endsWith',
96
+ 'notEndsWith',
97
+ 'endsWithInsensitive',
98
+ 'notEndsWithInsensitive'
99
+ ],
100
+ // 支持所有字段类型的过滤 - 明确允许所有类型
101
+ connectionFilterAllowedFieldTypes: [
102
+ 'String',
103
+ 'Int',
104
+ 'Float',
105
+ 'Boolean',
106
+ 'ID',
107
+ 'Date',
108
+ 'Time',
109
+ 'Datetime',
110
+ 'JSON',
111
+ 'BigInt'
112
+ ],
113
+ // 启用逻辑操作符 (and, or, not)
114
+ connectionFilterLogicalOperators: true,
115
+ // 启用关系过滤
116
+ connectionFilterRelations: true,
117
+ // 启用计算列过滤
118
+ connectionFilterComputedColumns: true,
119
+ // 启用数组过滤
120
+ connectionFilterArrays: true,
121
+ // 启用函数过滤
122
+ connectionFilterSetofFunctions: true,
123
+ // 允许空输入和空对象输入
124
+ connectionFilterAllowNullInput: true,
125
+ connectionFilterAllowEmptyObjectInput: true
126
+ },
127
+ // 只包含检测到的表
128
+ includeExtensionResources: false,
129
+ // 排除不需要的表
130
+ ignoreTable: (tableName) => {
131
+ // 如果没有检测到任何表,允许所有表
132
+ if (availableTables.length === 0) {
133
+ return false;
134
+ }
135
+ // 否则只包含检测到的表
136
+ return !availableTables.includes(tableName);
137
+ },
138
+ // 导出 schema(开发环境)
139
+ exportGqlSchemaPath: nodeEnv === 'development' ? 'sui-indexer-schema.graphql' : undefined
140
+ };
141
+ // 如果启用订阅,添加额外的PostgreSQL订阅配置
142
+ if (enableSubscriptions === 'true') {
143
+ return {
144
+ ...config,
145
+ // 使用专用数据库连接用于订阅
146
+ ownerConnectionString: options.databaseUrl,
147
+ // WebSocket配置
148
+ websocketMiddlewares: [],
149
+ // PostgreSQL设置 - 为订阅优化
150
+ pgSettings: {
151
+ statement_timeout: '30s',
152
+ // 为订阅设置适当的事务隔离级别
153
+ default_transaction_isolation: 'read committed'
154
+ },
155
+ // 连接失败时重试
156
+ retryOnInitFail: true,
157
+ // 性能优化
158
+ pgDefaultRole: undefined,
159
+ jwtSecret: undefined,
160
+ // 开发环境的额外配置
161
+ ...(nodeEnv === 'development' && {
162
+ queryCache: true,
163
+ allowExplain: true
164
+ })
165
+ };
166
+ }
167
+ return config;
168
+ }
169
+ // 导出增强版playground的HTML生成器
170
+ function createPlaygroundHtml(options) {
171
+ const { port, graphqlEndpoint, enableSubscriptions, availableTables } = options;
172
+ // 构建GraphQL和WebSocket端点URL
173
+ const baseUrl = `http://localhost:${port}`;
174
+ const graphqlUrl = `${baseUrl}${graphqlEndpoint}`;
175
+ const subscriptionUrl = enableSubscriptions === 'true' ? `ws://localhost:${port}${graphqlEndpoint}` : undefined;
176
+ return (0, enhanced_playground_1.createEnhancedPlayground)({
177
+ url: graphqlUrl,
178
+ subscriptionUrl,
179
+ title: 'Sui Indexer GraphQL Playground',
180
+ subtitle: `强大的GraphQL API | 已发现 ${availableTables.length} 个表 | ${enableSubscriptions === 'true' ? '支持实时订阅' : '实时订阅已禁用'}`
181
+ })(null, null, {});
182
+ }
183
+ //# sourceMappingURL=postgraphile-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgraphile-config.js","sourceRoot":"","sources":["../../src/plugins/postgraphile-config.ts"],"names":[],"mappings":";;;;;AAoBA,4DAyLC;AAGD,oDAiBC;AAjOD,iDAAmD;AACnD,mDAAqD;AACrD,yEAAmE;AACnE,+DAAiE;AACjE,kHAA2E;AAC3E,oGAAgF;AAChF,+CAA8C;AAC9C,oEAA2C;AAY3C,qBAAqB;AACrB,SAAgB,wBAAwB,CAAC,OAAkC;IACzE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,UAAU,EAAE,eAAe,EAAE,GACxF,OAAO,C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C,CAAC,CAAC,kBAAkB,IAAI,GAAG,eAAe,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAE1F,OAAO,IAAA,8CAAwB,EAAC;QAC9B,GAAG,EAAE,UAAU;QACf,eAAe;QACf,KAAK,EAAE,gCAAgC;QACvC,QAAQ,EAAE,wBAAwB,eAAe,CAAC,MAAM,SACtD,mBAAmB,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAC9C,EAAE;KACH,CAAC,CAAC,IAAW,EAAE,IAAW,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Plugin } from 'postgraphile';
2
+ export declare const QueryFilterPlugin: Plugin;
3
+ export default QueryFilterPlugin;
4
+ //# sourceMappingURL=query-filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-filter.d.ts","sourceRoot":"","sources":["../../src/plugins/query-filter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,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,4 @@
1
+ import { Plugin } from 'postgraphile';
2
+ export declare const SimpleNamingPlugin: Plugin;
3
+ export default SimpleNamingPlugin;
4
+ //# sourceMappingURL=simple-naming.d.ts.map
@@ -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,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,kBAAkB,CAAC,CAAC;QAE3D,8BAA8B;QAC9B,MAAM,SAAS,GAA2B,EAAE,CAAC;QAE7C,kBAAkB,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YAC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B,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 sui-rust-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 sui-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;QAChF,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;QACnF,OAAO;;aAEA,KAAK,CAAC,UAAU;;yCAEY,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM;2CAC5B,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;;;GAG9D,CAAC;IACA,CAAC,CAAC;SACD,IAAI,CAAC,EAAE,CAAC,CAAC;IAEZ,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6FAsHG,MAAM,CAAC,MACT;;OAGE,mBAAmB,KAAK,OAAO;QAC7B,CAAC,CAAC;;;;;MAKV;QACQ,CAAC,CAAC;;8CAE8B,mBAAmB,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU;;MAG3F;;;iBAGO,eAAe;;;;;;;;;;yDAUyB,mBAAmB,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI;;;;;;;;;2BASzE,OAAO;oBACd,IAAI;+BACO,MAAM;oBACjB,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU;6BACrC,mBAAmB,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU;;;;;;OAM7E,SAAS;;;;;;;;;iEAUF,mBAAmB,KAAK,MAAM,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,EACzD;;;QAGJ,mBAAmB,KAAK,MAAM,CAAC,CAAC,CAAC,0DAA0D,CAAC,CAAC,CAAC,EAAE;;;;;EAKtG,CAAC;AACH,CAAC"}
@@ -0,0 +1,32 @@
1
+ interface TableInfo {
2
+ tableName: string;
3
+ fullTableName: string;
4
+ columns: ColumnInfo[];
5
+ primaryKeys: string[];
6
+ statistics?: {
7
+ rowCount: number;
8
+ totalSize: string;
9
+ tableSize: string;
10
+ };
11
+ generatedAt?: string;
12
+ }
13
+ interface ColumnInfo {
14
+ columnName: string;
15
+ dataType: string;
16
+ isNullable: boolean;
17
+ defaultValue?: any;
18
+ maxLength?: number;
19
+ precision?: number;
20
+ scale?: number;
21
+ }
22
+ /**
23
+ * Generate pre-built table information - called at server startup
24
+ */
25
+ export declare function generateStoreTablesInfo(pgPool: any): Promise<Record<string, TableInfo>>;
26
+ /**
27
+ * Simplified tools plugin - only provides basic query functionality, let PostGraphile's built-in listen subscriptions work normally
28
+ */
29
+ export declare function createUniversalSubscriptionsPlugin(preGeneratedTables?: Record<string, TableInfo>): import("postgraphile").Plugin;
30
+ export declare const UniversalSubscriptionsPlugin: import("postgraphile").Plugin;
31
+ export {};
32
+ //# sourceMappingURL=universal-subscriptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"universal-subscriptions.d.ts","sourceRoot":"","sources":["../src/universal-subscriptions.ts"],"names":[],"mappings":"AAIA,UAAU,SAAS;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,CAAC,EAAE;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,UAAU;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAkDD;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAW7F;AAED;;GAEG;AACH,wBAAgB,kCAAkC,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,iCAyEhG;AAGD,eAAO,MAAM,4BAA4B,+BAAuC,CAAC"}