@graphoria/server 0.1.0
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/LICENSE +201 -0
- package/NOTICE +10 -0
- package/README.md +129 -0
- package/cli.ts +105 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/src/ai/agent/agent.d.ts +37 -0
- package/dist/src/ai/agent/agent.d.ts.map +1 -0
- package/dist/src/ai/agent/index.d.ts +3 -0
- package/dist/src/ai/agent/index.d.ts.map +1 -0
- package/dist/src/ai/agent/providers/anthropic.d.ts +10 -0
- package/dist/src/ai/agent/providers/anthropic.d.ts.map +1 -0
- package/dist/src/ai/agent/providers/index.d.ts +8 -0
- package/dist/src/ai/agent/providers/index.d.ts.map +1 -0
- package/dist/src/ai/agent/providers/ollama.d.ts +11 -0
- package/dist/src/ai/agent/providers/ollama.d.ts.map +1 -0
- package/dist/src/ai/agent/providers/openai.d.ts +14 -0
- package/dist/src/ai/agent/providers/openai.d.ts.map +1 -0
- package/dist/src/ai/agent/types.d.ts +51 -0
- package/dist/src/ai/agent/types.d.ts.map +1 -0
- package/dist/src/ai/ask-field.test.d.ts +2 -0
- package/dist/src/ai/ask-field.test.d.ts.map +1 -0
- package/dist/src/ai/index.d.ts +7 -0
- package/dist/src/ai/index.d.ts.map +1 -0
- package/dist/src/ai/mcp/create-server.d.ts +14 -0
- package/dist/src/ai/mcp/create-server.d.ts.map +1 -0
- package/dist/src/ai/mcp/create-server.test.d.ts +2 -0
- package/dist/src/ai/mcp/create-server.test.d.ts.map +1 -0
- package/dist/src/ai/mcp/index.d.ts +13 -0
- package/dist/src/ai/mcp/index.d.ts.map +1 -0
- package/dist/src/ai/mcp/index.test.d.ts +2 -0
- package/dist/src/ai/mcp/index.test.d.ts.map +1 -0
- package/dist/src/ai/mcp/instructions.d.ts +2 -0
- package/dist/src/ai/mcp/instructions.d.ts.map +1 -0
- package/dist/src/ai/tools/agent.d.ts +4 -0
- package/dist/src/ai/tools/agent.d.ts.map +1 -0
- package/dist/src/ai/tools/agent.test.d.ts +2 -0
- package/dist/src/ai/tools/agent.test.d.ts.map +1 -0
- package/dist/src/ai/tools/core.d.ts +75 -0
- package/dist/src/ai/tools/core.d.ts.map +1 -0
- package/dist/src/ai/tools/query-data.d.ts +35 -0
- package/dist/src/ai/tools/query-data.d.ts.map +1 -0
- package/dist/src/analyzeQuery/analyzers/fragmentAnalyzer.d.ts +5 -0
- package/dist/src/analyzeQuery/analyzers/fragmentAnalyzer.d.ts.map +1 -0
- package/dist/src/analyzeQuery/analyzers/operationAnalyzer.d.ts +6 -0
- package/dist/src/analyzeQuery/analyzers/operationAnalyzer.d.ts.map +1 -0
- package/dist/src/analyzeQuery/analyzers/selectionAnalyzer.d.ts +6 -0
- package/dist/src/analyzeQuery/analyzers/selectionAnalyzer.d.ts.map +1 -0
- package/dist/src/analyzeQuery/analyzers/variableAnalyzer.d.ts +4 -0
- package/dist/src/analyzeQuery/analyzers/variableAnalyzer.d.ts.map +1 -0
- package/dist/src/analyzeQuery/depthLimit.d.ts +16 -0
- package/dist/src/analyzeQuery/depthLimit.d.ts.map +1 -0
- package/dist/src/analyzeQuery/depthLimit.test.d.ts +2 -0
- package/dist/src/analyzeQuery/depthLimit.test.d.ts.map +1 -0
- package/dist/src/analyzeQuery/directiveUtils.d.ts +4 -0
- package/dist/src/analyzeQuery/directiveUtils.d.ts.map +1 -0
- package/dist/src/analyzeQuery/directiveUtils.test.d.ts +2 -0
- package/dist/src/analyzeQuery/directiveUtils.test.d.ts.map +1 -0
- package/dist/src/analyzeQuery/index.d.ts +5 -0
- package/dist/src/analyzeQuery/index.d.ts.map +1 -0
- package/dist/src/analyzeQuery/index.test.d.ts +2 -0
- package/dist/src/analyzeQuery/index.test.d.ts.map +1 -0
- package/dist/src/analyzeQuery/resolveVariables.d.ts +71 -0
- package/dist/src/analyzeQuery/resolveVariables.d.ts.map +1 -0
- package/dist/src/analyzeQuery/resolveVariables.test.d.ts +2 -0
- package/dist/src/analyzeQuery/resolveVariables.test.d.ts.map +1 -0
- package/dist/src/analyzeQuery/staticValues.test.d.ts +2 -0
- package/dist/src/analyzeQuery/staticValues.test.d.ts.map +1 -0
- package/dist/src/analyzeQuery/typeUtils.d.ts +9 -0
- package/dist/src/analyzeQuery/typeUtils.d.ts.map +1 -0
- package/dist/src/analyzeQuery/types.d.ts +54 -0
- package/dist/src/analyzeQuery/types.d.ts.map +1 -0
- package/dist/src/analyzeQuery/valueExtractors.d.ts +4 -0
- package/dist/src/analyzeQuery/valueExtractors.d.ts.map +1 -0
- package/dist/src/authentication/duration.d.ts +14 -0
- package/dist/src/authentication/duration.d.ts.map +1 -0
- package/dist/src/authentication/duration.test.d.ts +2 -0
- package/dist/src/authentication/duration.test.d.ts.map +1 -0
- package/dist/src/authentication/index.d.ts +4 -0
- package/dist/src/authentication/index.d.ts.map +1 -0
- package/dist/src/authentication/index.test.d.ts +2 -0
- package/dist/src/authentication/index.test.d.ts.map +1 -0
- package/dist/src/authentication/jwt.d.ts +10 -0
- package/dist/src/authentication/jwt.d.ts.map +1 -0
- package/dist/src/authentication/jwt.test.d.ts +2 -0
- package/dist/src/authentication/jwt.test.d.ts.map +1 -0
- package/dist/src/authentication/paseto.d.ts +7 -0
- package/dist/src/authentication/paseto.d.ts.map +1 -0
- package/dist/src/authentication/paseto.test.d.ts +2 -0
- package/dist/src/authentication/paseto.test.d.ts.map +1 -0
- package/dist/src/authentication/tokenRepository.d.ts +14 -0
- package/dist/src/authentication/tokenRepository.d.ts.map +1 -0
- package/dist/src/authentication/tokenRepository.test.d.ts +2 -0
- package/dist/src/authentication/tokenRepository.test.d.ts.map +1 -0
- package/dist/src/authentication/types.d.ts +42 -0
- package/dist/src/authentication/types.d.ts.map +1 -0
- package/dist/src/cli/seedAuth.d.ts +4 -0
- package/dist/src/cli/seedAuth.d.ts.map +1 -0
- package/dist/src/cli/seedAuth.test.d.ts +2 -0
- package/dist/src/cli/seedAuth.test.d.ts.map +1 -0
- package/dist/src/cli/seedAuthArgs.d.ts +9 -0
- package/dist/src/cli/seedAuthArgs.d.ts.map +1 -0
- package/dist/src/config/helpers/cronHelper.d.ts +21 -0
- package/dist/src/config/helpers/cronHelper.d.ts.map +1 -0
- package/dist/src/config/helpers/cronHelper.test.d.ts +2 -0
- package/dist/src/config/helpers/cronHelper.test.d.ts.map +1 -0
- package/dist/src/config/helpers/index.d.ts +4 -0
- package/dist/src/config/helpers/index.d.ts.map +1 -0
- package/dist/src/config/helpers/operationHelper.d.ts +44 -0
- package/dist/src/config/helpers/operationHelper.d.ts.map +1 -0
- package/dist/src/config/helpers/queueHelper.d.ts +20 -0
- package/dist/src/config/helpers/queueHelper.d.ts.map +1 -0
- package/dist/src/config/helpers/queueHelper.test.d.ts +2 -0
- package/dist/src/config/helpers/queueHelper.test.d.ts.map +1 -0
- package/dist/src/config/index.d.ts +236 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/types/ai.d.ts +29 -0
- package/dist/src/config/types/ai.d.ts.map +1 -0
- package/dist/src/config/types/auth.d.ts +112 -0
- package/dist/src/config/types/auth.d.ts.map +1 -0
- package/dist/src/config/types/configuration.d.ts +61 -0
- package/dist/src/config/types/configuration.d.ts.map +1 -0
- package/dist/src/config/types/cron.d.ts +81 -0
- package/dist/src/config/types/cron.d.ts.map +1 -0
- package/dist/src/config/types/db.d.ts +210 -0
- package/dist/src/config/types/db.d.ts.map +1 -0
- package/dist/src/config/types/index.d.ts +17 -0
- package/dist/src/config/types/index.d.ts.map +1 -0
- package/dist/src/config/types/operation.d.ts +226 -0
- package/dist/src/config/types/operation.d.ts.map +1 -0
- package/dist/src/config/types/queue.d.ts +142 -0
- package/dist/src/config/types/queue.d.ts.map +1 -0
- package/dist/src/config/types/remote-rest.d.ts +18 -0
- package/dist/src/config/types/remote-rest.d.ts.map +1 -0
- package/dist/src/config/types/remote-schema.d.ts +27 -0
- package/dist/src/config/types/remote-schema.d.ts.map +1 -0
- package/dist/src/config/types/virtual-columns.d.ts +89 -0
- package/dist/src/config/types/virtual-columns.d.ts.map +1 -0
- package/dist/src/config/types/virtual-columns.test.d.ts +2 -0
- package/dist/src/config/types/virtual-columns.test.d.ts.map +1 -0
- package/dist/src/configuration/getSchemas/index.d.ts +867 -0
- package/dist/src/configuration/getSchemas/index.d.ts.map +1 -0
- package/dist/src/configuration/getSchemas/mergeEntities/index.d.ts +412 -0
- package/dist/src/configuration/getSchemas/mergeEntities/index.d.ts.map +1 -0
- package/dist/src/configuration/getSchemas/type-definition-generator/index.d.ts +16 -0
- package/dist/src/configuration/getSchemas/type-definition-generator/index.d.ts.map +1 -0
- package/dist/src/configuration/getSchemas/type-definition-generator/index.test.d.ts +2 -0
- package/dist/src/configuration/getSchemas/type-definition-generator/index.test.d.ts.map +1 -0
- package/dist/src/configuration/gql/buildExecute.d.ts +31 -0
- package/dist/src/configuration/gql/buildExecute.d.ts.map +1 -0
- package/dist/src/configuration/gql/buildExecute.test.d.ts +2 -0
- package/dist/src/configuration/gql/buildExecute.test.d.ts.map +1 -0
- package/dist/src/configuration/gql/gqlAuthOperations.d.ts +9 -0
- package/dist/src/configuration/gql/gqlAuthOperations.d.ts.map +1 -0
- package/dist/src/configuration/gql/gqlAuthOperations.test.d.ts +2 -0
- package/dist/src/configuration/gql/gqlAuthOperations.test.d.ts.map +1 -0
- package/dist/src/configuration/gql/handleGraphQLRequestFactory.d.ts +28 -0
- package/dist/src/configuration/gql/handleGraphQLRequestFactory.d.ts.map +1 -0
- package/dist/src/configuration/gql/handleGraphQLRequestFactory.test.d.ts +2 -0
- package/dist/src/configuration/gql/handleGraphQLRequestFactory.test.d.ts.map +1 -0
- package/dist/src/configuration/gql/handleGraphQLSubscriptionFactory.d.ts +19 -0
- package/dist/src/configuration/gql/handleGraphQLSubscriptionFactory.d.ts.map +1 -0
- package/dist/src/configuration/index.d.ts +719 -0
- package/dist/src/configuration/index.d.ts.map +1 -0
- package/dist/src/configuration/rest/generateOpenAPI.d.ts +19 -0
- package/dist/src/configuration/rest/generateOpenAPI.d.ts.map +1 -0
- package/dist/src/configuration/rest/handleRESTRequestFactory.d.ts +12 -0
- package/dist/src/configuration/rest/handleRESTRequestFactory.d.ts.map +1 -0
- package/dist/src/configuration/rest/handleRESTRequestFactory.test.d.ts +2 -0
- package/dist/src/configuration/rest/handleRESTRequestFactory.test.d.ts.map +1 -0
- package/dist/src/configuration/rest/index.d.ts +20 -0
- package/dist/src/configuration/rest/index.d.ts.map +1 -0
- package/dist/src/configuration/rest/openApiErrors.d.ts +71 -0
- package/dist/src/configuration/rest/openApiErrors.d.ts.map +1 -0
- package/dist/src/console/App.d.ts +3 -0
- package/dist/src/console/App.d.ts.map +1 -0
- package/dist/src/console/Login.d.ts +6 -0
- package/dist/src/console/Login.d.ts.map +1 -0
- package/dist/src/console/api.d.ts +17 -0
- package/dist/src/console/api.d.ts.map +1 -0
- package/dist/src/console/api.test.d.ts +2 -0
- package/dist/src/console/api.test.d.ts.map +1 -0
- package/dist/src/console/client.d.ts +67 -0
- package/dist/src/console/client.d.ts.map +1 -0
- package/dist/src/console/frontend.d.ts +8 -0
- package/dist/src/console/frontend.d.ts.map +1 -0
- package/dist/src/console/pages/ConfigPage.d.ts +2 -0
- package/dist/src/console/pages/ConfigPage.d.ts.map +1 -0
- package/dist/src/console/pages/RolesPage.d.ts +2 -0
- package/dist/src/console/pages/RolesPage.d.ts.map +1 -0
- package/dist/src/console/pages/StatusPage.d.ts +2 -0
- package/dist/src/console/pages/StatusPage.d.ts.map +1 -0
- package/dist/src/console/pages/TablesPage.d.ts +2 -0
- package/dist/src/console/pages/TablesPage.d.ts.map +1 -0
- package/dist/src/console/useApi.d.ts +8 -0
- package/dist/src/console/useApi.d.ts.map +1 -0
- package/dist/src/cron/index.d.ts +63 -0
- package/dist/src/cron/index.d.ts.map +1 -0
- package/dist/src/databases/auth/auth-operations.d.ts +11 -0
- package/dist/src/databases/auth/auth-operations.d.ts.map +1 -0
- package/dist/src/databases/auth/password.d.ts +3 -0
- package/dist/src/databases/auth/password.d.ts.map +1 -0
- package/dist/src/databases/auth/password.test.d.ts +2 -0
- package/dist/src/databases/auth/password.test.d.ts.map +1 -0
- package/dist/src/databases/common.d.ts +53 -0
- package/dist/src/databases/common.d.ts.map +1 -0
- package/dist/src/databases/common.test.d.ts +2 -0
- package/dist/src/databases/common.test.d.ts.map +1 -0
- package/dist/src/databases/core/executor.d.ts +10 -0
- package/dist/src/databases/core/executor.d.ts.map +1 -0
- package/dist/src/databases/core/executor.test.d.ts +2 -0
- package/dist/src/databases/core/executor.test.d.ts.map +1 -0
- package/dist/src/databases/core/function-mapping.d.ts +38 -0
- package/dist/src/databases/core/function-mapping.d.ts.map +1 -0
- package/dist/src/databases/core/identifier.d.ts +2 -0
- package/dist/src/databases/core/identifier.d.ts.map +1 -0
- package/dist/src/databases/core/identifier.test.d.ts +2 -0
- package/dist/src/databases/core/identifier.test.d.ts.map +1 -0
- package/dist/src/databases/core/query-builder.d.ts +64 -0
- package/dist/src/databases/core/query-builder.d.ts.map +1 -0
- package/dist/src/databases/core/query-builder.test.d.ts +2 -0
- package/dist/src/databases/core/query-builder.test.d.ts.map +1 -0
- package/dist/src/databases/directives.d.ts +16 -0
- package/dist/src/databases/directives.d.ts.map +1 -0
- package/dist/src/databases/directives.test.d.ts +2 -0
- package/dist/src/databases/directives.test.d.ts.map +1 -0
- package/dist/src/databases/engines/mssql/auth.d.ts +9 -0
- package/dist/src/databases/engines/mssql/auth.d.ts.map +1 -0
- package/dist/src/databases/engines/mssql/auth.test.d.ts +2 -0
- package/dist/src/databases/engines/mssql/auth.test.d.ts.map +1 -0
- package/dist/src/databases/engines/mssql/connection.d.ts +14 -0
- package/dist/src/databases/engines/mssql/connection.d.ts.map +1 -0
- package/dist/src/databases/engines/mssql/format.d.ts +5 -0
- package/dist/src/databases/engines/mssql/format.d.ts.map +1 -0
- package/dist/src/databases/engines/mssql/getStructure.d.ts +48 -0
- package/dist/src/databases/engines/mssql/getStructure.d.ts.map +1 -0
- package/dist/src/databases/engines/mssql/getViews.d.ts +7 -0
- package/dist/src/databases/engines/mssql/getViews.d.ts.map +1 -0
- package/dist/src/databases/engines/mssql/query/index.d.ts +7 -0
- package/dist/src/databases/engines/mssql/query/index.d.ts.map +1 -0
- package/dist/src/databases/engines/mssql/query/index.test.d.ts +2 -0
- package/dist/src/databases/engines/mssql/query/index.test.d.ts.map +1 -0
- package/dist/src/databases/engines/mysql/auth.d.ts +9 -0
- package/dist/src/databases/engines/mysql/auth.d.ts.map +1 -0
- package/dist/src/databases/engines/mysql/auth.test.d.ts +2 -0
- package/dist/src/databases/engines/mysql/auth.test.d.ts.map +1 -0
- package/dist/src/databases/engines/mysql/connection.d.ts +14 -0
- package/dist/src/databases/engines/mysql/connection.d.ts.map +1 -0
- package/dist/src/databases/engines/mysql/format.d.ts +5 -0
- package/dist/src/databases/engines/mysql/format.d.ts.map +1 -0
- package/dist/src/databases/engines/mysql/getStructure.d.ts +48 -0
- package/dist/src/databases/engines/mysql/getStructure.d.ts.map +1 -0
- package/dist/src/databases/engines/mysql/getViews.d.ts +7 -0
- package/dist/src/databases/engines/mysql/getViews.d.ts.map +1 -0
- package/dist/src/databases/engines/mysql/query/index.d.ts +7 -0
- package/dist/src/databases/engines/mysql/query/index.d.ts.map +1 -0
- package/dist/src/databases/engines/mysql/query/index.test.d.ts +2 -0
- package/dist/src/databases/engines/mysql/query/index.test.d.ts.map +1 -0
- package/dist/src/databases/engines/postgresql/auth.d.ts +9 -0
- package/dist/src/databases/engines/postgresql/auth.d.ts.map +1 -0
- package/dist/src/databases/engines/postgresql/auth.test.d.ts +2 -0
- package/dist/src/databases/engines/postgresql/auth.test.d.ts.map +1 -0
- package/dist/src/databases/engines/postgresql/connection.d.ts +14 -0
- package/dist/src/databases/engines/postgresql/connection.d.ts.map +1 -0
- package/dist/src/databases/engines/postgresql/format.d.ts +5 -0
- package/dist/src/databases/engines/postgresql/format.d.ts.map +1 -0
- package/dist/src/databases/engines/postgresql/getStructure.d.ts +48 -0
- package/dist/src/databases/engines/postgresql/getStructure.d.ts.map +1 -0
- package/dist/src/databases/engines/postgresql/getViews.d.ts +7 -0
- package/dist/src/databases/engines/postgresql/getViews.d.ts.map +1 -0
- package/dist/src/databases/engines/postgresql/query/index.d.ts +7 -0
- package/dist/src/databases/engines/postgresql/query/index.d.ts.map +1 -0
- package/dist/src/databases/engines/postgresql/query/index.test.d.ts +2 -0
- package/dist/src/databases/engines/postgresql/query/index.test.d.ts.map +1 -0
- package/dist/src/databases/engines/shared/claims.d.ts +2 -0
- package/dist/src/databases/engines/shared/claims.d.ts.map +1 -0
- package/dist/src/databases/engines/shared/types.d.ts +8 -0
- package/dist/src/databases/engines/shared/types.d.ts.map +1 -0
- package/dist/src/databases/high-level-operations.d.ts +146 -0
- package/dist/src/databases/high-level-operations.d.ts.map +1 -0
- package/dist/src/databases/high-level-operations.test.d.ts +2 -0
- package/dist/src/databases/high-level-operations.test.d.ts.map +1 -0
- package/dist/src/databases/index.d.ts +8 -0
- package/dist/src/databases/index.d.ts.map +1 -0
- package/dist/src/databases/metadata/structure.d.ts +56 -0
- package/dist/src/databases/metadata/structure.d.ts.map +1 -0
- package/dist/src/databases/schemaBuilder/convert.d.ts +2 -0
- package/dist/src/databases/schemaBuilder/convert.d.ts.map +1 -0
- package/dist/src/databases/schemaBuilder/generateCreateTable/index.d.ts +15 -0
- package/dist/src/databases/schemaBuilder/generateCreateTable/index.d.ts.map +1 -0
- package/dist/src/databases/schemaBuilder/generateCreateTable/index.test.d.ts +2 -0
- package/dist/src/databases/schemaBuilder/generateCreateTable/index.test.d.ts.map +1 -0
- package/dist/src/databases/schemaBuilder/generateCreateView/index.d.ts +18 -0
- package/dist/src/databases/schemaBuilder/generateCreateView/index.d.ts.map +1 -0
- package/dist/src/databases/schemaBuilder/generateInsert/index.d.ts +8 -0
- package/dist/src/databases/schemaBuilder/generateInsert/index.d.ts.map +1 -0
- package/dist/src/databases/schemaBuilder/generateInsert/index.test.d.ts +2 -0
- package/dist/src/databases/schemaBuilder/generateInsert/index.test.d.ts.map +1 -0
- package/dist/src/databases/schemaBuilder/generateSchemaCreation/index.d.ts +7 -0
- package/dist/src/databases/schemaBuilder/generateSchemaCreation/index.d.ts.map +1 -0
- package/dist/src/databases/schemaBuilder/generateSchemaCreation/index.test.d.ts +2 -0
- package/dist/src/databases/schemaBuilder/generateSchemaCreation/index.test.d.ts.map +1 -0
- package/dist/src/databases/schemaBuilder/mssqlToPostgres/convertView.d.ts +2 -0
- package/dist/src/databases/schemaBuilder/mssqlToPostgres/convertView.d.ts.map +1 -0
- package/dist/src/databases/schemaBuilder/utils.d.ts +8 -0
- package/dist/src/databases/schemaBuilder/utils.d.ts.map +1 -0
- package/dist/src/databases/sqlTypeUtils.d.ts +24 -0
- package/dist/src/databases/sqlTypeUtils.d.ts.map +1 -0
- package/dist/src/databases/sqlTypeUtils.test.d.ts +2 -0
- package/dist/src/databases/sqlTypeUtils.test.d.ts.map +1 -0
- package/dist/src/databases/transformers/data-transformers.d.ts +215 -0
- package/dist/src/databases/transformers/data-transformers.d.ts.map +1 -0
- package/dist/src/databases/transformers/data-transformers.test.d.ts +2 -0
- package/dist/src/databases/transformers/data-transformers.test.d.ts.map +1 -0
- package/dist/src/databases/transformers/genResolverName.d.ts +2 -0
- package/dist/src/databases/transformers/genResolverName.d.ts.map +1 -0
- package/dist/src/databases/transformers/genResolverName.test.d.ts +2 -0
- package/dist/src/databases/transformers/genResolverName.test.d.ts.map +1 -0
- package/dist/src/index.d.ts +139 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/logging/index.d.ts +21 -0
- package/dist/src/logging/index.d.ts.map +1 -0
- package/dist/src/queues/kafka.d.ts +22 -0
- package/dist/src/queues/kafka.d.ts.map +1 -0
- package/dist/src/queues/rabbitmq.d.ts +34 -0
- package/dist/src/queues/rabbitmq.d.ts.map +1 -0
- package/dist/src/queues/rabbitmq.test.d.ts +2 -0
- package/dist/src/queues/rabbitmq.test.d.ts.map +1 -0
- package/dist/src/remoteREST/index.d.ts +13 -0
- package/dist/src/remoteREST/index.d.ts.map +1 -0
- package/dist/src/remoteREST/parse.d.ts +8 -0
- package/dist/src/remoteREST/parse.d.ts.map +1 -0
- package/dist/src/remoteREST/parse.test.d.ts +2 -0
- package/dist/src/remoteREST/parse.test.d.ts.map +1 -0
- package/dist/src/remoteREST/proxy.d.ts +6 -0
- package/dist/src/remoteREST/proxy.d.ts.map +1 -0
- package/dist/src/remoteREST/proxy.test.d.ts +2 -0
- package/dist/src/remoteREST/proxy.test.d.ts.map +1 -0
- package/dist/src/remoteREST/transform.d.ts +8 -0
- package/dist/src/remoteREST/transform.d.ts.map +1 -0
- package/dist/src/remoteREST/transform.test.d.ts +2 -0
- package/dist/src/remoteREST/transform.test.d.ts.map +1 -0
- package/dist/src/remoteREST/types.d.ts +37 -0
- package/dist/src/remoteREST/types.d.ts.map +1 -0
- package/dist/src/remoteSchemas/index.d.ts +13 -0
- package/dist/src/remoteSchemas/index.d.ts.map +1 -0
- package/dist/src/remoteSchemas/introspect.d.ts +7 -0
- package/dist/src/remoteSchemas/introspect.d.ts.map +1 -0
- package/dist/src/remoteSchemas/introspect.test.d.ts +2 -0
- package/dist/src/remoteSchemas/introspect.test.d.ts.map +1 -0
- package/dist/src/remoteSchemas/proxy.d.ts +7 -0
- package/dist/src/remoteSchemas/proxy.d.ts.map +1 -0
- package/dist/src/remoteSchemas/proxy.test.d.ts +2 -0
- package/dist/src/remoteSchemas/proxy.test.d.ts.map +1 -0
- package/dist/src/remoteSchemas/transform.d.ts +9 -0
- package/dist/src/remoteSchemas/transform.d.ts.map +1 -0
- package/dist/src/remoteSchemas/transform.test.d.ts +2 -0
- package/dist/src/remoteSchemas/transform.test.d.ts.map +1 -0
- package/dist/src/remoteSchemas/types.d.ts +41 -0
- package/dist/src/remoteSchemas/types.d.ts.map +1 -0
- package/dist/src/singletons/ai.d.ts +25 -0
- package/dist/src/singletons/ai.d.ts.map +1 -0
- package/dist/src/singletons/ai.test.d.ts +2 -0
- package/dist/src/singletons/ai.test.d.ts.map +1 -0
- package/dist/src/singletons/authentication.d.ts +4 -0
- package/dist/src/singletons/authentication.d.ts.map +1 -0
- package/dist/src/singletons/cache/index.d.ts +5 -0
- package/dist/src/singletons/cache/index.d.ts.map +1 -0
- package/dist/src/singletons/cache/lruCacheStore.d.ts +12 -0
- package/dist/src/singletons/cache/lruCacheStore.d.ts.map +1 -0
- package/dist/src/singletons/cache/lruCacheStore.test.d.ts +2 -0
- package/dist/src/singletons/cache/lruCacheStore.test.d.ts.map +1 -0
- package/dist/src/singletons/cache/redisCacheStore.d.ts +16 -0
- package/dist/src/singletons/cache/redisCacheStore.d.ts.map +1 -0
- package/dist/src/singletons/cache/redisClient.d.ts +3 -0
- package/dist/src/singletons/cache/redisClient.d.ts.map +1 -0
- package/dist/src/singletons/cache/registry.d.ts +7 -0
- package/dist/src/singletons/cache/registry.d.ts.map +1 -0
- package/dist/src/singletons/cache/registry.test.d.ts +2 -0
- package/dist/src/singletons/cache/registry.test.d.ts.map +1 -0
- package/dist/src/singletons/cache/types.d.ts +8 -0
- package/dist/src/singletons/cache/types.d.ts.map +1 -0
- package/dist/src/singletons/cron.d.ts +69 -0
- package/dist/src/singletons/cron.d.ts.map +1 -0
- package/dist/src/singletons/databases.d.ts +27 -0
- package/dist/src/singletons/databases.d.ts.map +1 -0
- package/dist/src/singletons/databases.test.d.ts +2 -0
- package/dist/src/singletons/databases.test.d.ts.map +1 -0
- package/dist/src/singletons/env.d.ts +494 -0
- package/dist/src/singletons/env.d.ts.map +1 -0
- package/dist/src/singletons/queues.d.ts +17 -0
- package/dist/src/singletons/queues.d.ts.map +1 -0
- package/dist/src/subscriptions/index.d.ts +4 -0
- package/dist/src/subscriptions/index.d.ts.map +1 -0
- package/dist/src/subscriptions/strategies/database.d.ts +12 -0
- package/dist/src/subscriptions/strategies/database.d.ts.map +1 -0
- package/dist/src/subscriptions/strategies/index.d.ts +12 -0
- package/dist/src/subscriptions/strategies/index.d.ts.map +1 -0
- package/dist/src/subscriptions/strategies/queue.d.ts +11 -0
- package/dist/src/subscriptions/strategies/queue.d.ts.map +1 -0
- package/dist/src/subscriptions/types.d.ts +67 -0
- package/dist/src/subscriptions/types.d.ts.map +1 -0
- package/dist/src/subscriptions/utils/polling.d.ts +17 -0
- package/dist/src/subscriptions/utils/polling.d.ts.map +1 -0
- package/dist/src/types/common.d.ts +44 -0
- package/dist/src/types/common.d.ts.map +1 -0
- package/dist/src/types/configuration.d.ts +28 -0
- package/dist/src/types/configuration.d.ts.map +1 -0
- package/dist/src/types/db.d.ts +43 -0
- package/dist/src/types/db.d.ts.map +1 -0
- package/dist/src/types/env.d.ts +2302 -0
- package/dist/src/types/env.d.ts.map +1 -0
- package/dist/src/types/env.test.d.ts +2 -0
- package/dist/src/types/env.test.d.ts.map +1 -0
- package/dist/src/types/resolver.d.ts +121 -0
- package/dist/src/types/resolver.d.ts.map +1 -0
- package/dist/src/types/zod/ai.d.ts +6 -0
- package/dist/src/types/zod/ai.d.ts.map +1 -0
- package/dist/src/types/zod/auth.d.ts +76 -0
- package/dist/src/types/zod/auth.d.ts.map +1 -0
- package/dist/src/types/zod/configuration.d.ts +1278 -0
- package/dist/src/types/zod/configuration.d.ts.map +1 -0
- package/dist/src/types/zod/configuration.test.d.ts +2 -0
- package/dist/src/types/zod/configuration.test.d.ts.map +1 -0
- package/dist/src/types/zod/cron.d.ts +32 -0
- package/dist/src/types/zod/cron.d.ts.map +1 -0
- package/dist/src/types/zod/db.d.ts +441 -0
- package/dist/src/types/zod/db.d.ts.map +1 -0
- package/dist/src/types/zod/db.test.d.ts +2 -0
- package/dist/src/types/zod/db.test.d.ts.map +1 -0
- package/dist/src/types/zod/mcp.d.ts +6 -0
- package/dist/src/types/zod/mcp.d.ts.map +1 -0
- package/dist/src/types/zod/operation.d.ts +9 -0
- package/dist/src/types/zod/operation.d.ts.map +1 -0
- package/dist/src/types/zod/queue.d.ts +656 -0
- package/dist/src/types/zod/queue.d.ts.map +1 -0
- package/dist/src/types/zod/queue.test.d.ts +2 -0
- package/dist/src/types/zod/queue.test.d.ts.map +1 -0
- package/dist/src/types/zod/remoteREST.d.ts +6 -0
- package/dist/src/types/zod/remoteREST.d.ts.map +1 -0
- package/dist/src/types/zod/remoteSchema.d.ts +6 -0
- package/dist/src/types/zod/remoteSchema.d.ts.map +1 -0
- package/dist/src/utils/benchmark.d.ts +2 -0
- package/dist/src/utils/benchmark.d.ts.map +1 -0
- package/dist/src/utils/event-emitter.d.ts +19 -0
- package/dist/src/utils/event-emitter.d.ts.map +1 -0
- package/dist/src/utils/responses.d.ts +19 -0
- package/dist/src/utils/responses.d.ts.map +1 -0
- package/dist/src/utils/responses.test.d.ts +2 -0
- package/dist/src/utils/responses.test.d.ts.map +1 -0
- package/dist/src/utils/safeJSONParse.d.ts +2 -0
- package/dist/src/utils/safeJSONParse.d.ts.map +1 -0
- package/dist/src/utils/selection.d.ts +3 -0
- package/dist/src/utils/selection.d.ts.map +1 -0
- package/dist/src/utils/selection.test.d.ts +2 -0
- package/dist/src/utils/selection.test.d.ts.map +1 -0
- package/dist/src/utils/sessionVariables.d.ts +47 -0
- package/dist/src/utils/sessionVariables.d.ts.map +1 -0
- package/dist/src/utils/sessionVariables.test.d.ts +2 -0
- package/dist/src/utils/sessionVariables.test.d.ts.map +1 -0
- package/dist/src/utils/writeSchema.d.ts +3 -0
- package/dist/src/utils/writeSchema.d.ts.map +1 -0
- package/dist/standalone.d.ts +3 -0
- package/dist/standalone.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +119 -0
- package/playgrounds/console/index.html +25 -0
- package/playgrounds/graphiql/index.html +1144 -0
- package/playgrounds/scalar/index.html +19 -0
- package/src/ai/agent/agent.ts +222 -0
- package/src/ai/agent/index.ts +2 -0
- package/src/ai/agent/providers/anthropic.ts +113 -0
- package/src/ai/agent/providers/index.ts +62 -0
- package/src/ai/agent/providers/ollama.ts +128 -0
- package/src/ai/agent/providers/openai.ts +100 -0
- package/src/ai/agent/types.ts +65 -0
- package/src/ai/index.ts +8 -0
- package/src/ai/mcp/create-server.ts +444 -0
- package/src/ai/mcp/index.ts +80 -0
- package/src/ai/mcp/instructions.ts +103 -0
- package/src/ai/tools/agent.ts +111 -0
- package/src/ai/tools/core.ts +486 -0
- package/src/ai/tools/query-data.ts +109 -0
- package/src/analyzeQuery/analyzers/fragmentAnalyzer.ts +29 -0
- package/src/analyzeQuery/analyzers/operationAnalyzer.ts +50 -0
- package/src/analyzeQuery/analyzers/selectionAnalyzer.ts +135 -0
- package/src/analyzeQuery/analyzers/variableAnalyzer.ts +17 -0
- package/src/analyzeQuery/depthLimit.ts +124 -0
- package/src/analyzeQuery/directiveUtils.ts +99 -0
- package/src/analyzeQuery/index.ts +66 -0
- package/src/analyzeQuery/resolveVariables.ts +394 -0
- package/src/analyzeQuery/typeUtils.ts +47 -0
- package/src/analyzeQuery/types.ts +57 -0
- package/src/analyzeQuery/valueExtractors.ts +96 -0
- package/src/authentication/duration.ts +50 -0
- package/src/authentication/index.ts +34 -0
- package/src/authentication/jwt.ts +220 -0
- package/src/authentication/paseto.ts +256 -0
- package/src/authentication/tokenRepository.ts +75 -0
- package/src/authentication/types.ts +78 -0
- package/src/cli/seedAuth.ts +51 -0
- package/src/cli/seedAuthArgs.ts +50 -0
- package/src/config/helpers/cronHelper.ts +29 -0
- package/src/config/helpers/index.ts +8 -0
- package/src/config/helpers/operationHelper.ts +146 -0
- package/src/config/helpers/queueHelper.ts +27 -0
- package/src/config/index.ts +315 -0
- package/src/config/types/ai.ts +35 -0
- package/src/config/types/auth.ts +147 -0
- package/src/config/types/configuration.ts +69 -0
- package/src/config/types/cron.ts +140 -0
- package/src/config/types/db.ts +256 -0
- package/src/config/types/index.ts +129 -0
- package/src/config/types/operation.ts +253 -0
- package/src/config/types/queue.ts +172 -0
- package/src/config/types/remote-rest.ts +28 -0
- package/src/config/types/remote-schema.ts +39 -0
- package/src/config/types/virtual-columns.ts +157 -0
- package/src/configuration/getSchemas/index.ts +82 -0
- package/src/configuration/getSchemas/mergeEntities/index.ts +221 -0
- package/src/configuration/getSchemas/type-definition-generator/index.ts +511 -0
- package/src/configuration/gql/buildExecute.ts +54 -0
- package/src/configuration/gql/gqlAuthOperations.ts +150 -0
- package/src/configuration/gql/handleGraphQLRequestFactory.ts +415 -0
- package/src/configuration/gql/handleGraphQLSubscriptionFactory.ts +249 -0
- package/src/configuration/index.ts +138 -0
- package/src/configuration/rest/generateOpenAPI.ts +361 -0
- package/src/configuration/rest/handleRESTRequestFactory.ts +335 -0
- package/src/configuration/rest/index.ts +167 -0
- package/src/configuration/rest/openApiErrors.ts +106 -0
- package/src/console/api.ts +270 -0
- package/src/cron/index.ts +251 -0
- package/src/databases/auth/auth-operations.ts +36 -0
- package/src/databases/auth/password.ts +4 -0
- package/src/databases/common.ts +642 -0
- package/src/databases/core/executor.ts +97 -0
- package/src/databases/core/function-mapping.ts +176 -0
- package/src/databases/core/identifier.ts +8 -0
- package/src/databases/core/query-builder.ts +47 -0
- package/src/databases/directives.ts +112 -0
- package/src/databases/engines/mssql/auth.ts +112 -0
- package/src/databases/engines/mssql/connection.ts +151 -0
- package/src/databases/engines/mssql/format.ts +23 -0
- package/src/databases/engines/mssql/getStructure.ts +112 -0
- package/src/databases/engines/mssql/getViews.ts +17 -0
- package/src/databases/engines/mssql/query/index.ts +306 -0
- package/src/databases/engines/mysql/auth.ts +100 -0
- package/src/databases/engines/mysql/connection.ts +100 -0
- package/src/databases/engines/mysql/format.ts +23 -0
- package/src/databases/engines/mysql/getStructure.ts +116 -0
- package/src/databases/engines/mysql/getViews.ts +20 -0
- package/src/databases/engines/mysql/query/index.ts +291 -0
- package/src/databases/engines/postgresql/auth.ts +98 -0
- package/src/databases/engines/postgresql/connection.ts +99 -0
- package/src/databases/engines/postgresql/format.ts +23 -0
- package/src/databases/engines/postgresql/getStructure.ts +149 -0
- package/src/databases/engines/postgresql/getViews.ts +20 -0
- package/src/databases/engines/postgresql/query/index.ts +291 -0
- package/src/databases/engines/shared/claims.ts +26 -0
- package/src/databases/engines/shared/types.ts +7 -0
- package/src/databases/high-level-operations.ts +272 -0
- package/src/databases/index.ts +28 -0
- package/src/databases/metadata/structure.ts +12 -0
- package/src/databases/schemaBuilder/convert.ts +121 -0
- package/src/databases/schemaBuilder/generateCreateTable/index.ts +133 -0
- package/src/databases/schemaBuilder/generateCreateView/index.ts +101 -0
- package/src/databases/schemaBuilder/generateInsert/index.ts +47 -0
- package/src/databases/schemaBuilder/generateSchemaCreation/index.ts +29 -0
- package/src/databases/schemaBuilder/mssqlToPostgres/convertView.ts +47 -0
- package/src/databases/schemaBuilder/utils.ts +17 -0
- package/src/databases/sqlTypeUtils.ts +91 -0
- package/src/databases/transformers/data-transformers.ts +128 -0
- package/src/databases/transformers/genResolverName.ts +18 -0
- package/src/index.ts +461 -0
- package/src/logging/index.ts +69 -0
- package/src/queues/kafka.ts +409 -0
- package/src/queues/rabbitmq.ts +331 -0
- package/src/remoteREST/index.ts +46 -0
- package/src/remoteREST/parse.ts +68 -0
- package/src/remoteREST/proxy.ts +92 -0
- package/src/remoteREST/transform.ts +121 -0
- package/src/remoteREST/types.ts +38 -0
- package/src/remoteSchemas/index.ts +48 -0
- package/src/remoteSchemas/introspect.ts +44 -0
- package/src/remoteSchemas/proxy.ts +146 -0
- package/src/remoteSchemas/transform.ts +210 -0
- package/src/remoteSchemas/types.ts +43 -0
- package/src/singletons/ai.ts +91 -0
- package/src/singletons/authentication.ts +13 -0
- package/src/singletons/cache/index.ts +4 -0
- package/src/singletons/cache/lruCacheStore.ts +34 -0
- package/src/singletons/cache/redisCacheStore.ts +81 -0
- package/src/singletons/cache/redisClient.ts +12 -0
- package/src/singletons/cache/registry.ts +51 -0
- package/src/singletons/cache/types.ts +7 -0
- package/src/singletons/cron.ts +21 -0
- package/src/singletons/databases.ts +68 -0
- package/src/singletons/env.ts +3 -0
- package/src/singletons/queues.ts +101 -0
- package/src/subscriptions/index.ts +20 -0
- package/src/subscriptions/strategies/database.ts +68 -0
- package/src/subscriptions/strategies/index.ts +38 -0
- package/src/subscriptions/strategies/queue.ts +61 -0
- package/src/subscriptions/types.ts +74 -0
- package/src/subscriptions/utils/polling.ts +119 -0
- package/src/types/common.ts +57 -0
- package/src/types/configuration.ts +52 -0
- package/src/types/db.ts +87 -0
- package/src/types/env.ts +137 -0
- package/src/types/resolver.ts +181 -0
- package/src/types/zod/ai.ts +8 -0
- package/src/types/zod/auth.ts +96 -0
- package/src/types/zod/configuration.ts +46 -0
- package/src/types/zod/cron.ts +35 -0
- package/src/types/zod/db.ts +146 -0
- package/src/types/zod/mcp.ts +8 -0
- package/src/types/zod/operation.ts +37 -0
- package/src/types/zod/queue.ts +182 -0
- package/src/types/zod/remoteREST.ts +8 -0
- package/src/types/zod/remoteSchema.ts +11 -0
- package/src/utils/benchmark.ts +13 -0
- package/src/utils/event-emitter.ts +217 -0
- package/src/utils/responses.ts +42 -0
- package/src/utils/safeJSONParse.ts +10 -0
- package/src/utils/selection.ts +35 -0
- package/src/utils/sessionVariables.ts +131 -0
- package/src/utils/writeSchema.ts +13 -0
- package/standalone.ts +32 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { AnalysisResult, VariableDefinition } from "../../analyzeQuery/types";
|
|
2
|
+
import type { GetSchemaReturn } from "../../configuration/getSchemas";
|
|
3
|
+
import type { Database } from "../../types/configuration";
|
|
4
|
+
import type { DatabasePoller, QueryEventEmitter } from "../types";
|
|
5
|
+
|
|
6
|
+
import { executeQuery, executeQueryJSON, generateSQL } from "../../databases";
|
|
7
|
+
import { logger } from "../../logging";
|
|
8
|
+
|
|
9
|
+
export interface DatabasePollerConfig {
|
|
10
|
+
analysis: AnalysisResult;
|
|
11
|
+
variableDefinitions: VariableDefinition[];
|
|
12
|
+
variables: Record<string, unknown>;
|
|
13
|
+
schemaEntity: GetSchemaReturn;
|
|
14
|
+
subscriptionKey: string;
|
|
15
|
+
eventEmitter: QueryEventEmitter;
|
|
16
|
+
pollIntervalMs?: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Get the first field name from analysis
|
|
21
|
+
*/
|
|
22
|
+
const getFirstFieldName = (analysis: AnalysisResult): string | undefined => {
|
|
23
|
+
return analysis.operations[0]?.fields[0]?.name;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Compute hash of query results for change detection
|
|
28
|
+
*/
|
|
29
|
+
const getResultHash = async (
|
|
30
|
+
queryHash: string,
|
|
31
|
+
db: Database,
|
|
32
|
+
variableDefinitions: VariableDefinition[],
|
|
33
|
+
variables: Record<string, unknown>,
|
|
34
|
+
): Promise<string> => {
|
|
35
|
+
const hashResult = await executeQuery<{ ResultHash: string }>(
|
|
36
|
+
queryHash,
|
|
37
|
+
db,
|
|
38
|
+
variableDefinitions,
|
|
39
|
+
variables,
|
|
40
|
+
);
|
|
41
|
+
return Buffer.from(hashResult[0].ResultHash)?.toString("hex");
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Create a database poller that detects changes via hash comparison
|
|
46
|
+
*/
|
|
47
|
+
export const createDatabasePoller = async (
|
|
48
|
+
config: DatabasePollerConfig,
|
|
49
|
+
): Promise<DatabasePoller> => {
|
|
50
|
+
const {
|
|
51
|
+
analysis,
|
|
52
|
+
variableDefinitions,
|
|
53
|
+
variables,
|
|
54
|
+
schemaEntity,
|
|
55
|
+
subscriptionKey,
|
|
56
|
+
eventEmitter,
|
|
57
|
+
pollIntervalMs = 1000,
|
|
58
|
+
} = config;
|
|
59
|
+
|
|
60
|
+
const firstFieldName = getFirstFieldName(analysis);
|
|
61
|
+
const db = schemaEntity.queriesMap[firstFieldName!]!.db!;
|
|
62
|
+
|
|
63
|
+
// Generate SQL queries (data query and hash query)
|
|
64
|
+
const [[, queryData]] = generateSQL(schemaEntity, analysis, variables);
|
|
65
|
+
const [[, queryHash]] = generateSQL(schemaEntity, analysis, variables, true);
|
|
66
|
+
|
|
67
|
+
// Get initial hash and send initial data
|
|
68
|
+
let previousHash = await getResultHash(queryHash, db, variableDefinitions, variables);
|
|
69
|
+
|
|
70
|
+
eventEmitter.sendDataUpdate(subscriptionKey, {
|
|
71
|
+
data: await executeQueryJSON(queryData, db, variableDefinitions, variables),
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// Poll function that checks for changes
|
|
75
|
+
const log = logger("polling").child({ subscription: subscriptionKey });
|
|
76
|
+
const poll = async () => {
|
|
77
|
+
try {
|
|
78
|
+
const currentHash = await getResultHash(queryHash, db, variableDefinitions, variables);
|
|
79
|
+
|
|
80
|
+
if (currentHash !== previousHash) {
|
|
81
|
+
log.info(
|
|
82
|
+
{ changed: !!previousHash, operation: analysis.operations[0].name },
|
|
83
|
+
previousHash ? "data changed" : "initial fetch",
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
previousHash = currentHash;
|
|
87
|
+
|
|
88
|
+
eventEmitter.sendDataUpdate(subscriptionKey, {
|
|
89
|
+
data: await executeQueryJSON(queryData, db, variableDefinitions, variables),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
} catch (error) {
|
|
93
|
+
log.error({ err: error }, "polling failed");
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// Poller control
|
|
98
|
+
let stopped = false;
|
|
99
|
+
let scheduledTimeout: Timer;
|
|
100
|
+
|
|
101
|
+
const poller: DatabasePoller = {
|
|
102
|
+
start() {
|
|
103
|
+
if (stopped) return;
|
|
104
|
+
|
|
105
|
+
scheduledTimeout = setTimeout(() => {
|
|
106
|
+
poll();
|
|
107
|
+
poller.start();
|
|
108
|
+
}, pollIntervalMs);
|
|
109
|
+
|
|
110
|
+
return scheduledTimeout;
|
|
111
|
+
},
|
|
112
|
+
stop() {
|
|
113
|
+
stopped = true;
|
|
114
|
+
clearTimeout(scheduledTimeout);
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
return poller;
|
|
119
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { GqlQueryResult } from "../config";
|
|
2
|
+
import type { BunRequest } from "bun";
|
|
3
|
+
import type { DatabasesConnections, RepositoryMap } from "../singletons/databases";
|
|
4
|
+
import type { QueueManager } from "../singletons/queues";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* GraphQL query function type
|
|
8
|
+
* @param TReqOptional - Whether the request parameter is optional (true for cron jobs, false for operations)
|
|
9
|
+
*/
|
|
10
|
+
export type GqlQueryFn<TReqOptional extends boolean = false> = TReqOptional extends true
|
|
11
|
+
? <TReturn = unknown>(
|
|
12
|
+
query: string,
|
|
13
|
+
params?: Record<string, unknown>,
|
|
14
|
+
req?: BunRequest,
|
|
15
|
+
) => Promise<GqlQueryResult<TReturn>>
|
|
16
|
+
: <TReturn = unknown>(
|
|
17
|
+
query: string,
|
|
18
|
+
params: Record<string, unknown>,
|
|
19
|
+
req: BunRequest,
|
|
20
|
+
) => Promise<GqlQueryResult<TReturn>>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Base callback options containing gqlQuery and database connections
|
|
24
|
+
* Used by operations, cron jobs, and other callback-based features
|
|
25
|
+
*
|
|
26
|
+
* @param TReqOptional - Whether the request parameter in gqlQuery is optional
|
|
27
|
+
*/
|
|
28
|
+
export type CallbackOptions<TReqOptional extends boolean = false, TRepository = unknown> = {
|
|
29
|
+
/**
|
|
30
|
+
* Execute a GraphQL query against the server
|
|
31
|
+
*/
|
|
32
|
+
gqlQuery: GqlQueryFn<TReqOptional>;
|
|
33
|
+
/**
|
|
34
|
+
* Database connections available for direct database access
|
|
35
|
+
*/
|
|
36
|
+
databases: DatabasesConnections;
|
|
37
|
+
/**
|
|
38
|
+
* Queue manager for managing queues
|
|
39
|
+
*/
|
|
40
|
+
queues: QueueManager | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Custom database repository created from repository factory functions.
|
|
43
|
+
* Keys are database names, values are the result of the repository factory.
|
|
44
|
+
* Access with: repository["dbName"] to get the repository for that database.
|
|
45
|
+
*/
|
|
46
|
+
repository: RepositoryMap<TRepository>;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Callback options with required request parameter (for operations, REST handlers)
|
|
51
|
+
*/
|
|
52
|
+
export type OperationCallbackOptions<TRepository = unknown> = CallbackOptions<false, TRepository>;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Callback options with optional request parameter (for cron jobs, background tasks)
|
|
56
|
+
*/
|
|
57
|
+
export type BackgroundCallbackOptions<TRepository = unknown> = CallbackOptions<true, TRepository>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
import type { FilterCondition, OrderByClause } from "../config";
|
|
4
|
+
import type { ConfigurationZod } from "./zod/configuration";
|
|
5
|
+
|
|
6
|
+
// Re-export base types from the config module
|
|
7
|
+
export type { DirectionUnion, FilterCondition, OrderByClause, VirtualColumnType } from "../config";
|
|
8
|
+
|
|
9
|
+
export type Configuration = z.infer<typeof ConfigurationZod>;
|
|
10
|
+
|
|
11
|
+
export type Database = Configuration["databases"][number];
|
|
12
|
+
|
|
13
|
+
export type DatabaseType = Database["type"];
|
|
14
|
+
|
|
15
|
+
export type ConnectionInfo = Database["connection"];
|
|
16
|
+
|
|
17
|
+
export type ResolverNamePattern = Database["fieldNaming"];
|
|
18
|
+
|
|
19
|
+
export type Operations = Configuration["operations"];
|
|
20
|
+
|
|
21
|
+
export type Schema = NonNullable<Database["schema"]>;
|
|
22
|
+
export type Relationships = Schema["database"][""]["relationships"];
|
|
23
|
+
export type VirtualColumns = Schema["database"][""]["columns"];
|
|
24
|
+
|
|
25
|
+
export type VirtualColumn = VirtualColumns[number];
|
|
26
|
+
export type Relationship = Relationships[number];
|
|
27
|
+
|
|
28
|
+
export type Auth = Configuration["auth"];
|
|
29
|
+
export type Permissions = Auth["permissions"];
|
|
30
|
+
export type Role = Permissions[keyof Permissions];
|
|
31
|
+
|
|
32
|
+
export type TableFilter = {
|
|
33
|
+
filter?: FilterCondition;
|
|
34
|
+
orderBy?: OrderByClause[];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type MessageQueue = Configuration["queues"][number];
|
|
38
|
+
|
|
39
|
+
export type Publisher = MessageQueue["exchanges"][number]["publishers"][number];
|
|
40
|
+
|
|
41
|
+
export type Subscriber = MessageQueue["queues"][number];
|
|
42
|
+
|
|
43
|
+
export type CronJob = Configuration["cron"][number];
|
|
44
|
+
|
|
45
|
+
// Virtual-column builders live in the config module; re-export so existing
|
|
46
|
+
// server-internal imports (and @graphoria/server/config) keep resolving.
|
|
47
|
+
export {
|
|
48
|
+
virtualColumnFunction,
|
|
49
|
+
virtualColumnExpression,
|
|
50
|
+
createYAndNToBooleanMSSQL,
|
|
51
|
+
createOneToBooleanMSSQL,
|
|
52
|
+
} from "../config";
|
package/src/types/db.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
buildProcedureResolver,
|
|
5
|
+
buildRelationshipResolver,
|
|
6
|
+
buildTableResolver,
|
|
7
|
+
} from "../databases";
|
|
8
|
+
import type { TableFilter, VirtualColumn } from "./configuration";
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
DatabaseStructureZod,
|
|
12
|
+
StoredProcedureBaseZod,
|
|
13
|
+
StoredProcedureZod,
|
|
14
|
+
TableBaseZod,
|
|
15
|
+
TableColumnZod,
|
|
16
|
+
TableZod,
|
|
17
|
+
ViewZod,
|
|
18
|
+
VirtualColumnZod,
|
|
19
|
+
} from "./zod/db";
|
|
20
|
+
|
|
21
|
+
// Re-export VirtualColumnType from the config module
|
|
22
|
+
export type { VirtualColumnType } from "../config";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* TYPE HIERARCHY:
|
|
26
|
+
*
|
|
27
|
+
* 1. BASE TYPES (from database):
|
|
28
|
+
* - TableColumn: Raw column from DB (with isNullable transformed)
|
|
29
|
+
* - VirtualColumn: Column from configuration (with virtual/function/expression properties)
|
|
30
|
+
* - TableBase: Raw table structure
|
|
31
|
+
* - StoredProcedureBase: Raw stored procedure structure
|
|
32
|
+
*
|
|
33
|
+
* 2. ENRICHED TYPES (with computed properties):
|
|
34
|
+
* - Table: Base table + dashedName, dottedName, schemaName, etc.
|
|
35
|
+
* - StoredProcedure: Base SP + dashedName, dottedName, schemaName, etc.
|
|
36
|
+
*
|
|
37
|
+
* 3. RESOLVER TYPES (with database reference & resolver info):
|
|
38
|
+
* - TableResolver: Table + db, internalName, resolverName, relationships
|
|
39
|
+
* Note: columns can be TableColumn[] | VirtualColumn[] depending on configuration
|
|
40
|
+
* - ProcedureResolver: StoredProcedure + db, internalName, resolverName
|
|
41
|
+
* - RelationshipResolver: Relationship with full resolver naming
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
// Base types from database (raw structure)
|
|
45
|
+
export type TableColumn = z.output<typeof TableColumnZod>;
|
|
46
|
+
export type TableBase = z.output<typeof TableBaseZod>;
|
|
47
|
+
export type StoredProcedureBase = z.output<typeof StoredProcedureBaseZod>;
|
|
48
|
+
|
|
49
|
+
// Column type that can be either base or virtual
|
|
50
|
+
export type Column = TableColumn | VirtualColumn;
|
|
51
|
+
|
|
52
|
+
// Enriched types (with computed naming properties from Zod transforms)
|
|
53
|
+
export type Table = z.infer<typeof TableZod>;
|
|
54
|
+
export type StoredProcedure = z.infer<typeof StoredProcedureZod>;
|
|
55
|
+
|
|
56
|
+
// Resolver types (with database references and full application context)
|
|
57
|
+
// Note: These come from runtime functions since they depend on cross-table relationships
|
|
58
|
+
export type RelationshipResolver = ReturnType<typeof buildRelationshipResolver>;
|
|
59
|
+
type _TableResolver = ReturnType<typeof buildTableResolver>;
|
|
60
|
+
|
|
61
|
+
// Override columns to allow both TableColumn and VirtualColumn
|
|
62
|
+
export type TableResolver = Omit<_TableResolver, "columns"> & {
|
|
63
|
+
columns: Column[];
|
|
64
|
+
rolePermission?: TableFilter;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type ProcedureResolver = ReturnType<typeof buildProcedureResolver>;
|
|
68
|
+
|
|
69
|
+
// Database structure types
|
|
70
|
+
export type DatabaseStructure = z.infer<typeof DatabaseStructureZod>;
|
|
71
|
+
export type Tables = DatabaseStructure["tables"];
|
|
72
|
+
export type StoredProcedures = DatabaseStructure["storedProcedures"];
|
|
73
|
+
|
|
74
|
+
// Utility types
|
|
75
|
+
export type View = z.infer<typeof ViewZod>;
|
|
76
|
+
|
|
77
|
+
// Re-export Zod schemas for validation purposes
|
|
78
|
+
export {
|
|
79
|
+
DatabaseStructureZod,
|
|
80
|
+
StoredProcedureBaseZod,
|
|
81
|
+
StoredProcedureZod,
|
|
82
|
+
TableBaseZod,
|
|
83
|
+
TableColumnZod,
|
|
84
|
+
TableZod,
|
|
85
|
+
VirtualColumnZod,
|
|
86
|
+
ViewZod,
|
|
87
|
+
} from "./zod/db";
|
package/src/types/env.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
import { version } from "../../package.json";
|
|
4
|
+
import { ConfigurationZod } from "./zod/configuration";
|
|
5
|
+
|
|
6
|
+
export const EnvZod = z
|
|
7
|
+
.object({
|
|
8
|
+
PORT: z.coerce.number().default(3000),
|
|
9
|
+
NODE_ENV: z.string().default("DEVELOPMENT"),
|
|
10
|
+
ADMIN_SECRET: z.string(),
|
|
11
|
+
CONFIGURATION: z.union([z.string(), ConfigurationZod]).optional(),
|
|
12
|
+
ANONYMOUS_ROLE: z.string().default("anonymous"),
|
|
13
|
+
JWT_SECRET: z.string().optional().default(""),
|
|
14
|
+
JWT_EXPIRES_IN: z.string().default("5m"),
|
|
15
|
+
JWT_RT_EXPIRES_IN: z.string().default("7d"),
|
|
16
|
+
PASETO_LOCAL_KEY: z.string().optional().default(""),
|
|
17
|
+
PASETO_SECRET_KEY: z.string().optional().default(""),
|
|
18
|
+
PASETO_PUBLIC_KEY: z.string().optional().default(""),
|
|
19
|
+
AUTH_STRATEGY: z.enum(["jwt", "paseto_local", "paseto_public"]).optional(),
|
|
20
|
+
REDIS_URL: z.string().default("redis://localhost:6379"),
|
|
21
|
+
CACHE_STORE: z.enum(["memory", "redis"]).default("memory"),
|
|
22
|
+
REST_API_PREFIX: z.string().default("/rest"),
|
|
23
|
+
GRAPHQL_API_ENDPOINT: z.string().default("/graphql"),
|
|
24
|
+
ADMIN_SECRET_HEADER: z.string().default("x-admin-secret"),
|
|
25
|
+
AUTHORIZATION_HEADER: z.string().default("authorization"),
|
|
26
|
+
GRAPHIQL_ENDPOINT: z.string().default("/graphiql"),
|
|
27
|
+
SCALAR_ENDPOINT: z.string().default("/scalar"),
|
|
28
|
+
OPENAPI_ENDPOINT: z.string().default("/openapi.json"),
|
|
29
|
+
SUPERADMIN_ROLE: z.string().default("superadmin"),
|
|
30
|
+
// Boolean flags use stringbool, not coerce.boolean: Boolean("false") === true would flip them on
|
|
31
|
+
CONSOLE_ENABLED: z.stringbool().default(false),
|
|
32
|
+
CONSOLE_ENDPOINT: z.string().default("/_console"),
|
|
33
|
+
PREFIX: z.string().default(""),
|
|
34
|
+
CORS_ENABLED: z.stringbool().default(true),
|
|
35
|
+
PRINT_SCHEMAS: z.stringbool().default(false),
|
|
36
|
+
SCHEMAS_OUTPUT_DIR: z.string().default("./.graphoria/schemas"),
|
|
37
|
+
QUERY_ON_RESPONSE: z.stringbool().default(false),
|
|
38
|
+
MAX_QUERY_DEPTH: z.coerce.number().int().min(0).default(0),
|
|
39
|
+
AI_ENABLED: z.stringbool().optional(),
|
|
40
|
+
AI_GRAPHQL_ENABLED: z.stringbool().default(true),
|
|
41
|
+
AI_REST_ENABLED: z.stringbool().default(true),
|
|
42
|
+
AI_MCP_ENABLED: z.stringbool().optional(),
|
|
43
|
+
AI_MCP_ENDPOINT: z.string().default("/mcp"),
|
|
44
|
+
AI_MCP_REQUIRE_ADMIN_SECRET: z.stringbool().default(false),
|
|
45
|
+
AI_MCP_MAX_QUERY_DEPTH: z.coerce.number().int().min(0).optional(),
|
|
46
|
+
AI_MCP_DISABLED_TOOLS: z.string().default(""),
|
|
47
|
+
AI_MCP_DISABLED_RESOURCES: z.string().default(""),
|
|
48
|
+
AI_MCP_DISABLED_PROMPTS: z.string().default(""),
|
|
49
|
+
AI_SYSTEM_PROMPT: z.string().optional(),
|
|
50
|
+
AI_PROMPT_TEMPLATE: z.string().optional(),
|
|
51
|
+
})
|
|
52
|
+
.transform((env) => ({
|
|
53
|
+
port: env.PORT,
|
|
54
|
+
nodeEnv: env.NODE_ENV,
|
|
55
|
+
version,
|
|
56
|
+
configuration: env.CONFIGURATION,
|
|
57
|
+
prefix: env.PREFIX,
|
|
58
|
+
enableCors: env.CORS_ENABLED,
|
|
59
|
+
restApiPrefix: env.REST_API_PREFIX,
|
|
60
|
+
graphqlApiEndpoint: env.GRAPHQL_API_ENDPOINT,
|
|
61
|
+
graphiqlEndpoint: env.GRAPHIQL_ENDPOINT,
|
|
62
|
+
scalarEndpoint: env.SCALAR_ENDPOINT,
|
|
63
|
+
openApiEndpoint: env.OPENAPI_ENDPOINT,
|
|
64
|
+
authorizationHeader: env.AUTHORIZATION_HEADER,
|
|
65
|
+
anonymousRole: env.ANONYMOUS_ROLE,
|
|
66
|
+
authStrategy: env.AUTH_STRATEGY,
|
|
67
|
+
queryOnResponse: env.QUERY_ON_RESPONSE,
|
|
68
|
+
maxQueryDepth: env.MAX_QUERY_DEPTH,
|
|
69
|
+
admin: {
|
|
70
|
+
secret: env.ADMIN_SECRET,
|
|
71
|
+
header: env.ADMIN_SECRET_HEADER,
|
|
72
|
+
},
|
|
73
|
+
jwt: {
|
|
74
|
+
secret: env.JWT_SECRET,
|
|
75
|
+
expiresIn: env.JWT_EXPIRES_IN,
|
|
76
|
+
rtExpiresIn: env.JWT_RT_EXPIRES_IN,
|
|
77
|
+
},
|
|
78
|
+
paseto: {
|
|
79
|
+
localKey: env.PASETO_LOCAL_KEY,
|
|
80
|
+
secretKey: env.PASETO_SECRET_KEY,
|
|
81
|
+
publicKey: env.PASETO_PUBLIC_KEY,
|
|
82
|
+
},
|
|
83
|
+
cache: {
|
|
84
|
+
store: env.CACHE_STORE,
|
|
85
|
+
redisUrl: env.REDIS_URL,
|
|
86
|
+
},
|
|
87
|
+
schemas: {
|
|
88
|
+
print: env.PRINT_SCHEMAS,
|
|
89
|
+
outputDir: env.SCHEMAS_OUTPUT_DIR,
|
|
90
|
+
},
|
|
91
|
+
superadmin: {
|
|
92
|
+
role: env.SUPERADMIN_ROLE,
|
|
93
|
+
},
|
|
94
|
+
console: {
|
|
95
|
+
enabled: env.CONSOLE_ENABLED,
|
|
96
|
+
endpoint: env.CONSOLE_ENDPOINT,
|
|
97
|
+
},
|
|
98
|
+
ai: {
|
|
99
|
+
enabled: env.AI_ENABLED,
|
|
100
|
+
graphqlEnabled: env.AI_GRAPHQL_ENABLED,
|
|
101
|
+
restEnabled: env.AI_REST_ENABLED,
|
|
102
|
+
mcp: {
|
|
103
|
+
enabled: env.AI_MCP_ENABLED,
|
|
104
|
+
endpoint: env.AI_MCP_ENDPOINT,
|
|
105
|
+
requireAdminSecret: env.AI_MCP_REQUIRE_ADMIN_SECRET,
|
|
106
|
+
maxQueryDepth: env.AI_MCP_MAX_QUERY_DEPTH,
|
|
107
|
+
disabledTools: env.AI_MCP_DISABLED_TOOLS
|
|
108
|
+
? env.AI_MCP_DISABLED_TOOLS.split(",")
|
|
109
|
+
.map((s) => s.trim())
|
|
110
|
+
.filter(Boolean)
|
|
111
|
+
: [],
|
|
112
|
+
disabledResources: env.AI_MCP_DISABLED_RESOURCES
|
|
113
|
+
? env.AI_MCP_DISABLED_RESOURCES.split(",")
|
|
114
|
+
.map((s) => s.trim())
|
|
115
|
+
.filter(Boolean)
|
|
116
|
+
: [],
|
|
117
|
+
disabledPrompts: env.AI_MCP_DISABLED_PROMPTS
|
|
118
|
+
? env.AI_MCP_DISABLED_PROMPTS.split(",")
|
|
119
|
+
.map((s) => s.trim())
|
|
120
|
+
.filter(Boolean)
|
|
121
|
+
: [],
|
|
122
|
+
},
|
|
123
|
+
systemPrompt: env.AI_SYSTEM_PROMPT,
|
|
124
|
+
promptTemplate: env.AI_PROMPT_TEMPLATE,
|
|
125
|
+
},
|
|
126
|
+
}));
|
|
127
|
+
|
|
128
|
+
export type EnvInput = z.input<typeof EnvZod>;
|
|
129
|
+
export type Env = z.infer<typeof EnvZod> & {
|
|
130
|
+
logger?: import("pino").Logger | import("pino").LoggerOptions;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
declare module "bun" {
|
|
134
|
+
interface Env extends EnvInput {
|
|
135
|
+
VERSION?: string;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import type { RemoteRESTResolved, RemoteRESTRoute } from "../remoteREST/types";
|
|
2
|
+
import type { RemoteSchemaResolved } from "../remoteSchemas/types";
|
|
3
|
+
import type { Publisher } from "./configuration";
|
|
4
|
+
import type { ProcedureResolver, TableResolver } from "./db";
|
|
5
|
+
import type { TypedOperation } from "./zod/operation";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Entity source types - identifies where a resolver's data comes from
|
|
9
|
+
*/
|
|
10
|
+
export enum EntitySource {
|
|
11
|
+
/** Database table or view */
|
|
12
|
+
TABLE = "table",
|
|
13
|
+
/** Database stored procedure */
|
|
14
|
+
STORED_PROCEDURE = "stored_procedure",
|
|
15
|
+
/** Message queue (RabbitMQ, Kafka, etc.) */
|
|
16
|
+
QUEUE_PUBLISHER = "queue_publisher",
|
|
17
|
+
/** Authentication mutations (login, refresh, etc.) */
|
|
18
|
+
AUTH = "auth",
|
|
19
|
+
/** Custom operation handlers */
|
|
20
|
+
OPERATION = "operation",
|
|
21
|
+
/** Remote GraphQL schema */
|
|
22
|
+
REMOTE_SCHEMA = "remote_schema",
|
|
23
|
+
/** Remote REST API (OpenAPI) */
|
|
24
|
+
REMOTE_REST = "remote_rest",
|
|
25
|
+
/** AI agent query */
|
|
26
|
+
AI = "ai",
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Base resolver entry with source identification
|
|
31
|
+
*/
|
|
32
|
+
export type ResolverEntryBase = {
|
|
33
|
+
source: EntitySource;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Resolver entry for database tables
|
|
38
|
+
*/
|
|
39
|
+
export type TableResolverEntry = ResolverEntryBase & {
|
|
40
|
+
source: EntitySource.TABLE;
|
|
41
|
+
resolver: TableResolver;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Resolver entry for stored procedures
|
|
46
|
+
*/
|
|
47
|
+
export type StoredProcedureResolverEntry = ResolverEntryBase & {
|
|
48
|
+
source: EntitySource.STORED_PROCEDURE;
|
|
49
|
+
resolver: ProcedureResolver;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Resolver entry for message queues
|
|
54
|
+
*/
|
|
55
|
+
export type QueueResolverEntry = ResolverEntryBase & {
|
|
56
|
+
source: EntitySource.QUEUE_PUBLISHER;
|
|
57
|
+
resolver: Publisher;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Resolver entry for authentication operations
|
|
62
|
+
*/
|
|
63
|
+
export type AuthResolverEntry = ResolverEntryBase & {
|
|
64
|
+
source: EntitySource.AUTH;
|
|
65
|
+
resolver: {
|
|
66
|
+
name: string;
|
|
67
|
+
operation: "login" | "refresh" | "logout" | "register" | "me";
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Resolver entry for custom operations
|
|
73
|
+
*/
|
|
74
|
+
export type OperationResolverEntry = ResolverEntryBase & {
|
|
75
|
+
source: EntitySource.OPERATION;
|
|
76
|
+
// oxlint-disable-next-line typescript/no-explicit-any
|
|
77
|
+
resolver: TypedOperation<any, any, any>;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Resolver entry for remote schema fields
|
|
82
|
+
*/
|
|
83
|
+
export type RemoteSchemaResolverEntry = ResolverEntryBase & {
|
|
84
|
+
source: EntitySource.REMOTE_SCHEMA;
|
|
85
|
+
resolver: {
|
|
86
|
+
remoteSchema: RemoteSchemaResolved;
|
|
87
|
+
originalFieldName: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Resolver entry for remote REST API routes
|
|
93
|
+
*/
|
|
94
|
+
export type RemoteRESTResolverEntry = ResolverEntryBase & {
|
|
95
|
+
source: EntitySource.REMOTE_REST;
|
|
96
|
+
resolver: {
|
|
97
|
+
remoteREST: RemoteRESTResolved;
|
|
98
|
+
route: RemoteRESTRoute;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Resolver entry for the AI agent query
|
|
104
|
+
*/
|
|
105
|
+
export type AIResolverEntry = ResolverEntryBase & {
|
|
106
|
+
source: EntitySource.AI;
|
|
107
|
+
resolver: { name: string };
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Union type of all resolver entries
|
|
112
|
+
*/
|
|
113
|
+
export type ResolverEntry =
|
|
114
|
+
| TableResolverEntry
|
|
115
|
+
| StoredProcedureResolverEntry
|
|
116
|
+
| QueueResolverEntry
|
|
117
|
+
| AuthResolverEntry
|
|
118
|
+
| OperationResolverEntry
|
|
119
|
+
| RemoteSchemaResolverEntry
|
|
120
|
+
| RemoteRESTResolverEntry
|
|
121
|
+
| AIResolverEntry;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Registry type - plain object for fast access
|
|
125
|
+
*/
|
|
126
|
+
export type ResolverRegistry = Record<string, ResolverEntry>;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Helper to create typed resolver entries
|
|
130
|
+
*/
|
|
131
|
+
export const createResolverEntry = {
|
|
132
|
+
table: (resolver: TableResolver): TableResolverEntry => ({
|
|
133
|
+
source: EntitySource.TABLE,
|
|
134
|
+
resolver,
|
|
135
|
+
}),
|
|
136
|
+
|
|
137
|
+
storedProcedure: (resolver: ProcedureResolver): StoredProcedureResolverEntry => ({
|
|
138
|
+
source: EntitySource.STORED_PROCEDURE,
|
|
139
|
+
resolver,
|
|
140
|
+
}),
|
|
141
|
+
|
|
142
|
+
queuePublisher: (resolver: Publisher): QueueResolverEntry => ({
|
|
143
|
+
source: EntitySource.QUEUE_PUBLISHER,
|
|
144
|
+
resolver,
|
|
145
|
+
}),
|
|
146
|
+
|
|
147
|
+
auth: (
|
|
148
|
+
name: string,
|
|
149
|
+
operation: AuthResolverEntry["resolver"]["operation"],
|
|
150
|
+
): AuthResolverEntry => ({
|
|
151
|
+
source: EntitySource.AUTH,
|
|
152
|
+
resolver: { name, operation },
|
|
153
|
+
}),
|
|
154
|
+
|
|
155
|
+
// oxlint-disable-next-line typescript/no-explicit-any
|
|
156
|
+
operation: (resolver: TypedOperation<unknown, unknown, unknown>): OperationResolverEntry => ({
|
|
157
|
+
source: EntitySource.OPERATION,
|
|
158
|
+
resolver,
|
|
159
|
+
}),
|
|
160
|
+
|
|
161
|
+
remoteSchema: (
|
|
162
|
+
remoteSchema: RemoteSchemaResolved,
|
|
163
|
+
originalFieldName: string,
|
|
164
|
+
): RemoteSchemaResolverEntry => ({
|
|
165
|
+
source: EntitySource.REMOTE_SCHEMA,
|
|
166
|
+
resolver: { remoteSchema, originalFieldName },
|
|
167
|
+
}),
|
|
168
|
+
|
|
169
|
+
remoteREST: (
|
|
170
|
+
remoteREST: RemoteRESTResolved,
|
|
171
|
+
route: RemoteRESTRoute,
|
|
172
|
+
): RemoteRESTResolverEntry => ({
|
|
173
|
+
source: EntitySource.REMOTE_REST,
|
|
174
|
+
resolver: { remoteREST, route },
|
|
175
|
+
}),
|
|
176
|
+
|
|
177
|
+
ai: (name: string): AIResolverEntry => ({
|
|
178
|
+
source: EntitySource.AI,
|
|
179
|
+
resolver: { name },
|
|
180
|
+
}),
|
|
181
|
+
};
|