@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,147 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// Base Zod Schemas for Auth Configuration
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// These are the pre-transform base schemas — the single source of truth for
|
|
7
|
+
// auth config authoring types. The permissions-dictionary normalization
|
|
8
|
+
// transform stays in types/zod/auth.ts.
|
|
9
|
+
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Shared Primitives
|
|
12
|
+
// ============================================================================
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Direction for ORDER BY clause
|
|
16
|
+
*/
|
|
17
|
+
export const DirectionUnionZod = z.enum([
|
|
18
|
+
"ASC",
|
|
19
|
+
"DESC",
|
|
20
|
+
"ASC_NULLS_FIRST",
|
|
21
|
+
"ASC_NULLS_LAST",
|
|
22
|
+
"DESC_NULLS_FIRST",
|
|
23
|
+
"DESC_NULLS_LAST",
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
export type DirectionUnion = z.input<typeof DirectionUnionZod>;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Order by clause for role-based default ordering
|
|
30
|
+
*/
|
|
31
|
+
export const OrderByClauseZod = z.object({
|
|
32
|
+
column: z.string(),
|
|
33
|
+
direction: DirectionUnionZod,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export type OrderByClause = z.input<typeof OrderByClauseZod>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Filter condition — matches GraphQL where argument structure.
|
|
40
|
+
* Supports operators: eq, neq, gt, gte, lt, lte, like, in, is_null, not_null.
|
|
41
|
+
*/
|
|
42
|
+
export const FilterConditionZod = z.record(z.string(), z.record(z.string(), z.unknown()));
|
|
43
|
+
|
|
44
|
+
export type FilterCondition = z.input<typeof FilterConditionZod>;
|
|
45
|
+
|
|
46
|
+
// ============================================================================
|
|
47
|
+
// Permission Schemas
|
|
48
|
+
// ============================================================================
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Table-level permission configuration
|
|
52
|
+
*/
|
|
53
|
+
export const TablePermissionZod = z.object({
|
|
54
|
+
/** Allowed columns — "ALL" or array of column names */
|
|
55
|
+
columns: z.union([z.literal("ALL"), z.array(z.string())]),
|
|
56
|
+
/** Role-based query filtering (WHERE clause) */
|
|
57
|
+
filter: FilterConditionZod.optional(),
|
|
58
|
+
/** Role-based default ordering (ORDER BY clause) */
|
|
59
|
+
orderBy: z.array(OrderByClauseZod).optional(),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export type TablePermission = z.input<typeof TablePermissionZod>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Permission configuration for a role
|
|
66
|
+
*/
|
|
67
|
+
export const RolePermissionZod = z
|
|
68
|
+
.object({
|
|
69
|
+
/** Tables accessible by this role */
|
|
70
|
+
tables: z
|
|
71
|
+
.union([
|
|
72
|
+
z.array(z.string()),
|
|
73
|
+
z.literal("ALL"),
|
|
74
|
+
z.record(z.string(), z.union([z.literal("ALL"), TablePermissionZod])),
|
|
75
|
+
])
|
|
76
|
+
.optional()
|
|
77
|
+
.default([]),
|
|
78
|
+
/** Stored procedures accessible by this role */
|
|
79
|
+
storedProcedures: z
|
|
80
|
+
.union([z.array(z.string()), z.literal("ALL")])
|
|
81
|
+
.optional()
|
|
82
|
+
.default([]),
|
|
83
|
+
/** Queues accessible by this role */
|
|
84
|
+
queues: z
|
|
85
|
+
.union([z.array(z.string()), z.literal("ALL")])
|
|
86
|
+
.optional()
|
|
87
|
+
.default([]),
|
|
88
|
+
/** Operations accessible by this role */
|
|
89
|
+
operations: z
|
|
90
|
+
.union([z.array(z.string()), z.literal("ALL")])
|
|
91
|
+
.optional()
|
|
92
|
+
.default([]),
|
|
93
|
+
/** Remote schemas accessible by this role */
|
|
94
|
+
remoteSchemas: z
|
|
95
|
+
.union([z.array(z.string()), z.literal("ALL")])
|
|
96
|
+
.optional()
|
|
97
|
+
.default([]),
|
|
98
|
+
/** Remote REST APIs accessible by this role */
|
|
99
|
+
remoteREST: z
|
|
100
|
+
.union([z.array(z.string()), z.literal("ALL")])
|
|
101
|
+
.optional()
|
|
102
|
+
.default([]),
|
|
103
|
+
})
|
|
104
|
+
.default({
|
|
105
|
+
tables: [],
|
|
106
|
+
storedProcedures: [],
|
|
107
|
+
queues: [],
|
|
108
|
+
operations: [],
|
|
109
|
+
remoteSchemas: [],
|
|
110
|
+
remoteREST: [],
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
export type RolePermission = z.input<typeof RolePermissionZod>;
|
|
114
|
+
|
|
115
|
+
// ============================================================================
|
|
116
|
+
// Auth Config Schema
|
|
117
|
+
// ============================================================================
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Authentication configuration
|
|
121
|
+
*/
|
|
122
|
+
export const AuthConfigZod = z
|
|
123
|
+
.object({
|
|
124
|
+
/** Whether authentication is enabled */
|
|
125
|
+
enabled: z.boolean(),
|
|
126
|
+
/** Database name where auth tables are stored */
|
|
127
|
+
database: z.string(),
|
|
128
|
+
/** Schema name for auth tables (default: "auth") */
|
|
129
|
+
schema: z.string().optional().default("auth"),
|
|
130
|
+
/**
|
|
131
|
+
* Whether Graphoria should run CREATE SCHEMA / TABLE IF NOT EXISTS for the
|
|
132
|
+
* auth user table on every boot. Default: false.
|
|
133
|
+
*/
|
|
134
|
+
autoCreateTables: z.boolean().optional().default(false),
|
|
135
|
+
/** Permissions per role */
|
|
136
|
+
permissions: z.record(z.string(), RolePermissionZod).optional().default({}),
|
|
137
|
+
})
|
|
138
|
+
.optional()
|
|
139
|
+
.default({
|
|
140
|
+
enabled: false,
|
|
141
|
+
database: "",
|
|
142
|
+
schema: "auth",
|
|
143
|
+
autoCreateTables: false,
|
|
144
|
+
permissions: {},
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
export type AuthConfig = z.input<typeof AuthConfigZod>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { SQL } from "bun";
|
|
2
|
+
import type { ConnectionPool } from "mssql";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import type { AIConfig } from "./ai";
|
|
5
|
+
import type { AuthConfig } from "./auth";
|
|
6
|
+
import type { CronJobConfig } from "./cron";
|
|
7
|
+
import type { AnyDatabaseConfig } from "./db";
|
|
8
|
+
import type { TypedOperation } from "./operation";
|
|
9
|
+
import type { QueueConfig } from "./queue";
|
|
10
|
+
import type { RemoteRESTConfig } from "./remote-rest";
|
|
11
|
+
import type { RemoteSchemaConfig } from "./remote-schema";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Union of supported database connection types
|
|
15
|
+
*/
|
|
16
|
+
export type DatabaseConnectionInstance = SQL | ConnectionPool;
|
|
17
|
+
|
|
18
|
+
// ============================================================================
|
|
19
|
+
// Token Strategy
|
|
20
|
+
// ============================================================================
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Token strategy for authentication
|
|
24
|
+
* - "jwt": JSON Web Tokens (default)
|
|
25
|
+
* - "paseto_local": PASETO v4.local (symmetric encryption)
|
|
26
|
+
* - "paseto_public": PASETO v4.public (public-key signatures)
|
|
27
|
+
*/
|
|
28
|
+
export const TokenStrategyZod = z.enum(["jwt", "paseto_local", "paseto_public"]);
|
|
29
|
+
|
|
30
|
+
export type TokenStrategy = z.input<typeof TokenStrategyZod>;
|
|
31
|
+
|
|
32
|
+
// ============================================================================
|
|
33
|
+
// Configuration Input Type
|
|
34
|
+
// ============================================================================
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Full configuration input type for Graphoria
|
|
38
|
+
*/
|
|
39
|
+
export type ConfigurationInput = {
|
|
40
|
+
/** Project name */
|
|
41
|
+
name: string;
|
|
42
|
+
/** Project version */
|
|
43
|
+
version: string;
|
|
44
|
+
/**
|
|
45
|
+
* Token strategy: "jwt" (default), "paseto_local", or "paseto_public"
|
|
46
|
+
*
|
|
47
|
+
* When using PASETO, set the corresponding environment variables:
|
|
48
|
+
* - paseto_local: PASETO_LOCAL_KEY (k4.local.xxx format)
|
|
49
|
+
* - paseto_public: PASETO_SECRET_KEY (k4.secret.xxx) + PASETO_PUBLIC_KEY (k4.public.xxx)
|
|
50
|
+
*/
|
|
51
|
+
tokenStrategy?: TokenStrategy;
|
|
52
|
+
/** Database connections */
|
|
53
|
+
databases?: AnyDatabaseConfig[];
|
|
54
|
+
/** Message queues (RabbitMQ, Kafka) */
|
|
55
|
+
queues?: QueueConfig[];
|
|
56
|
+
/** Cron jobs */
|
|
57
|
+
cron?: CronJobConfig[];
|
|
58
|
+
/** Operations - unified handlers for REST + GraphQL */
|
|
59
|
+
// oxlint-disable-next-line typescript/no-explicit-any
|
|
60
|
+
operations?: Record<string, TypedOperation<any, any, any, any>>;
|
|
61
|
+
/** Authentication configuration */
|
|
62
|
+
auth?: AuthConfig;
|
|
63
|
+
/** Remote GraphQL schemas to merge into the API */
|
|
64
|
+
remoteSchemas?: RemoteSchemaConfig[];
|
|
65
|
+
/** Remote REST APIs (OpenAPI) to proxy under /rest */
|
|
66
|
+
remoteREST?: RemoteRESTConfig[];
|
|
67
|
+
/** AI agent (admin-only NL → database Q&A) + MCP server. Off by default. */
|
|
68
|
+
ai?: AIConfig;
|
|
69
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default variables type
|
|
5
|
+
*/
|
|
6
|
+
export const DefaultVariablesSchema = z.record(z.string(), z.unknown());
|
|
7
|
+
|
|
8
|
+
export type DefaultVariables = z.infer<typeof DefaultVariablesSchema>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Context passed to the tick callback
|
|
12
|
+
*/
|
|
13
|
+
export type TickContext<TVariables = DefaultVariables> = {
|
|
14
|
+
name: string;
|
|
15
|
+
pattern: string;
|
|
16
|
+
variables: TVariables;
|
|
17
|
+
executionCount: number;
|
|
18
|
+
nextRun: Date | null;
|
|
19
|
+
previousRun: Date | null;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Cron job tick callback
|
|
24
|
+
*/
|
|
25
|
+
export type CronTickCallback<TVariables = Record<string, unknown>> = (
|
|
26
|
+
options: {
|
|
27
|
+
gqlQuery: <TReturn = unknown>(
|
|
28
|
+
query: string,
|
|
29
|
+
params?: Record<string, unknown>,
|
|
30
|
+
req?: unknown,
|
|
31
|
+
) => Promise<{ data: TReturn; errors?: unknown[] }>;
|
|
32
|
+
databases: unknown;
|
|
33
|
+
queues: unknown;
|
|
34
|
+
repository: Record<string, unknown>;
|
|
35
|
+
},
|
|
36
|
+
context: TickContext<TVariables>,
|
|
37
|
+
response?: { data: unknown; errors?: unknown[] },
|
|
38
|
+
) => Promise<void> | void;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Generic Zod schema factory for typed cron jobs
|
|
42
|
+
* This allows TypeScript to infer the variables type
|
|
43
|
+
*/
|
|
44
|
+
export const createTypedCronJobZod = <TVariables extends DefaultVariables>() =>
|
|
45
|
+
z.object({
|
|
46
|
+
/**
|
|
47
|
+
* Unique name/identifier for the cron job
|
|
48
|
+
*/
|
|
49
|
+
name: z.string().min(1, "Cron job name is required"),
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Cron pattern or ISO 8601 date string
|
|
53
|
+
* Examples:
|
|
54
|
+
* - "0 0 * * *" (daily at midnight)
|
|
55
|
+
* - "*\/5 * * * *" (every 5 minutes)
|
|
56
|
+
* - "2024-01-23T00:00:00" (specific date/time)
|
|
57
|
+
*/
|
|
58
|
+
pattern: z.string().min(1, "Cron pattern is required"),
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Optional GraphQL query to execute when the cron job runs
|
|
62
|
+
* If not provided, you must use the gqlQuery function in onTick callback
|
|
63
|
+
*/
|
|
64
|
+
query: z.string().optional(),
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Optional variables to pass to the GraphQL query
|
|
68
|
+
*/
|
|
69
|
+
variables: z.custom<TVariables>().optional(),
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Optional timezone (e.g., "America/New_York", "Europe/Stockholm")
|
|
73
|
+
*/
|
|
74
|
+
timezone: z.string().optional(),
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Whether the job should be paused from start
|
|
78
|
+
*/
|
|
79
|
+
paused: z.boolean().optional().default(false),
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Maximum number of times the job should run
|
|
83
|
+
*/
|
|
84
|
+
maxRuns: z.number().int().positive().optional(),
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Minimum number of seconds between triggers
|
|
88
|
+
*/
|
|
89
|
+
interval: z.number().int().nonnegative().optional(),
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* ISO 8601 formatted datetime to start the job
|
|
93
|
+
*/
|
|
94
|
+
startAt: z.string().optional(),
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* ISO 8601 formatted datetime to stop the job
|
|
98
|
+
*/
|
|
99
|
+
stopAt: z.string().optional(),
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Enable over-run protection (blocks new triggers while old one is in progress)
|
|
103
|
+
*/
|
|
104
|
+
protect: z.boolean().optional(),
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Whether to catch errors silently or handle them
|
|
108
|
+
*/
|
|
109
|
+
catchErrors: z.boolean().optional().default(true),
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Context to pass along with the cron job (for logging, etc.)
|
|
113
|
+
*/
|
|
114
|
+
context: z.record(z.string(), z.any()).optional(),
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Callback executed on each tick
|
|
118
|
+
*/
|
|
119
|
+
onTick: z.custom<CronTickCallback<TVariables>>().optional(),
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
export const TypedCronJobZod = createTypedCronJobZod();
|
|
123
|
+
|
|
124
|
+
export type CronJobType = z.input<typeof TypedCronJobZod>;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Typed cron job definition
|
|
128
|
+
*/
|
|
129
|
+
export type TypedCronJob<TVariables = DefaultVariables> = Omit<
|
|
130
|
+
CronJobType,
|
|
131
|
+
"variables" | "onTick"
|
|
132
|
+
> & {
|
|
133
|
+
variables?: TVariables;
|
|
134
|
+
onTick?: CronTickCallback<TVariables>;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Cron job configuration (alias of TypedCronJob, kept for the public config surface)
|
|
139
|
+
*/
|
|
140
|
+
export type CronJobConfig<TVariables = DefaultVariables> = TypedCronJob<TVariables>;
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
import type { SQL } from "bun";
|
|
4
|
+
import type { ConnectionPool } from "mssql";
|
|
5
|
+
|
|
6
|
+
import { VirtualColumnZod } from "./virtual-columns";
|
|
7
|
+
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Base Zod Schemas for Database Configuration
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// These are the base schemas — the single source of truth for database config
|
|
12
|
+
// authoring types. Introspection-only schemas (TableZod, DatabaseStructureZod,
|
|
13
|
+
// etc.) stay in types/zod/db.ts.
|
|
14
|
+
|
|
15
|
+
// ============================================================================
|
|
16
|
+
// Database Type
|
|
17
|
+
// ============================================================================
|
|
18
|
+
|
|
19
|
+
export type DatabaseType = "mssql" | "pg" | "mysql";
|
|
20
|
+
|
|
21
|
+
// ============================================================================
|
|
22
|
+
// Table Relationship (config shape, no transform)
|
|
23
|
+
// ============================================================================
|
|
24
|
+
|
|
25
|
+
export const TableRelationshipZod = z.object({
|
|
26
|
+
schema: z.string(),
|
|
27
|
+
name: z.string(),
|
|
28
|
+
columns: z.array(z.object({ source: z.string(), target: z.string() })),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export type TableRelationship = z.input<typeof TableRelationshipZod>;
|
|
32
|
+
|
|
33
|
+
// ============================================================================
|
|
34
|
+
// Table Schema Config
|
|
35
|
+
// ============================================================================
|
|
36
|
+
|
|
37
|
+
export const TableSchemaConfigZod = z.object({
|
|
38
|
+
columns: z.array(VirtualColumnZod).optional().default([]),
|
|
39
|
+
relationships: z.array(TableRelationshipZod).optional().default([]),
|
|
40
|
+
/** Overrides the table description from the database */
|
|
41
|
+
description: z.string().optional(),
|
|
42
|
+
/** Overrides column descriptions from the database, keyed by column name */
|
|
43
|
+
columnDescriptions: z.record(z.string(), z.string()).optional().default({}),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export type TableSchemaConfig = z.input<typeof TableSchemaConfigZod>;
|
|
47
|
+
|
|
48
|
+
// ============================================================================
|
|
49
|
+
// Database Schema Config
|
|
50
|
+
// ============================================================================
|
|
51
|
+
|
|
52
|
+
export const DatabaseSchemaConfigZod = z.object({
|
|
53
|
+
database: z
|
|
54
|
+
.record(
|
|
55
|
+
z.string(),
|
|
56
|
+
TableSchemaConfigZod.optional()
|
|
57
|
+
.default({
|
|
58
|
+
columns: [],
|
|
59
|
+
relationships: [],
|
|
60
|
+
columnDescriptions: {},
|
|
61
|
+
})
|
|
62
|
+
.catch({
|
|
63
|
+
columns: [],
|
|
64
|
+
relationships: [],
|
|
65
|
+
columnDescriptions: {},
|
|
66
|
+
}),
|
|
67
|
+
)
|
|
68
|
+
.optional()
|
|
69
|
+
.default({}),
|
|
70
|
+
excludedTables: z.array(z.string()).optional().default([]),
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export type DatabaseSchemaConfig = z.input<typeof DatabaseSchemaConfigZod>;
|
|
74
|
+
|
|
75
|
+
// ============================================================================
|
|
76
|
+
// Connection Options
|
|
77
|
+
// ============================================================================
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Connection pool and transport options for PostgreSQL and MySQL (Bun SQL).
|
|
81
|
+
* All timeout values are in seconds.
|
|
82
|
+
*/
|
|
83
|
+
export const BunSQLConnectionOptionsZod = z.object({
|
|
84
|
+
/** Maximum number of connections in the pool */
|
|
85
|
+
max: z.number().int().positive().default(10),
|
|
86
|
+
/** Maximum time in seconds a connection can be idle before being closed */
|
|
87
|
+
idleTimeout: z.number().nonnegative().default(30),
|
|
88
|
+
/** Maximum time in seconds to wait when establishing a connection */
|
|
89
|
+
connectionTimeout: z.number().nonnegative().default(30),
|
|
90
|
+
/** Maximum lifetime in seconds of a connection */
|
|
91
|
+
maxLifetime: z.number().nonnegative().default(3600),
|
|
92
|
+
/** Whether to use TLS/SSL for the connection */
|
|
93
|
+
tls: z.boolean().default(false),
|
|
94
|
+
/** Automatic creation of prepared statements (default: true) */
|
|
95
|
+
prepare: z.boolean().default(true),
|
|
96
|
+
/** Return values outside i32 range as BigInts instead of strings (default: false) */
|
|
97
|
+
bigint: z.boolean().default(false),
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
export type BunSQLConnectionOptions = z.input<typeof BunSQLConnectionOptionsZod>;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Connection pool and transport options for MSSQL.
|
|
104
|
+
* All timeout values are in seconds (converted to milliseconds internally).
|
|
105
|
+
*/
|
|
106
|
+
export const MSSQLConnectionOptionsZod = z.object({
|
|
107
|
+
/** Connection pool options */
|
|
108
|
+
pool: z
|
|
109
|
+
.object({
|
|
110
|
+
/** Maximum number of connections in the pool */
|
|
111
|
+
max: z.number().int().positive().default(10),
|
|
112
|
+
/** Minimum number of connections in the pool */
|
|
113
|
+
min: z.number().int().nonnegative().default(0),
|
|
114
|
+
/** Maximum time in seconds a connection can be idle before being closed */
|
|
115
|
+
idleTimeout: z.number().nonnegative().default(30),
|
|
116
|
+
})
|
|
117
|
+
.default({
|
|
118
|
+
max: 10,
|
|
119
|
+
min: 0,
|
|
120
|
+
idleTimeout: 30,
|
|
121
|
+
}),
|
|
122
|
+
/** Maximum time in seconds to wait when establishing a connection */
|
|
123
|
+
connectionTimeout: z.number().nonnegative().default(30),
|
|
124
|
+
/** Maximum time in seconds to wait for a request to complete */
|
|
125
|
+
requestTimeout: z.number().nonnegative().default(30),
|
|
126
|
+
/** Whether to encrypt the connection */
|
|
127
|
+
encrypt: z.boolean().default(false),
|
|
128
|
+
/** Whether to trust the server certificate without validation */
|
|
129
|
+
trustServerCertificate: z.boolean().default(false),
|
|
130
|
+
/** Whether to use Windows Authentication (trusted connection) */
|
|
131
|
+
trustedConnection: z.boolean().default(false),
|
|
132
|
+
/** Whether to automatically parse JSON responses */
|
|
133
|
+
parseJSON: z.boolean().default(true),
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
export type MSSQLConnectionOptions = z.input<typeof MSSQLConnectionOptionsZod>;
|
|
137
|
+
|
|
138
|
+
// ============================================================================
|
|
139
|
+
// Generic Types (hand-written — generics can't be inferred from Zod)
|
|
140
|
+
// The `type: "pg"` narrowing of `onConnect` / `repository` is load-bearing.
|
|
141
|
+
// ============================================================================
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Maps database type to the corresponding native connection type.
|
|
145
|
+
* SQL for Bun/PostgreSQL/MySQL, ConnectionPool for MSSQL.
|
|
146
|
+
*/
|
|
147
|
+
export type DatabaseConnectionForType<T extends DatabaseType> = T extends "pg" | "mysql"
|
|
148
|
+
? SQL
|
|
149
|
+
: T extends "mssql"
|
|
150
|
+
? ConnectionPool
|
|
151
|
+
: never;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Custom repository factory function type.
|
|
155
|
+
* Accepts the native connection typed per engine.
|
|
156
|
+
*/
|
|
157
|
+
export type CustomRepositoryFactory<T extends DatabaseType = DatabaseType> = (
|
|
158
|
+
connection: DatabaseConnectionForType<T>,
|
|
159
|
+
) => unknown;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Handler invoked once at startup after the database connection is established.
|
|
163
|
+
* Receives the live connection (typed per engine) and the database config.
|
|
164
|
+
* Throwing aborts server boot.
|
|
165
|
+
*/
|
|
166
|
+
export type OnConnectHandler<T extends DatabaseType = DatabaseType> = (
|
|
167
|
+
connection: DatabaseConnectionForType<T>,
|
|
168
|
+
db: DatabaseConfig<T>,
|
|
169
|
+
) => void | Promise<void>;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Maps database type to the corresponding connection options type.
|
|
173
|
+
*/
|
|
174
|
+
export type ConnectionOptionsForType<T extends DatabaseType> = T extends "pg" | "mysql"
|
|
175
|
+
? BunSQLConnectionOptions
|
|
176
|
+
: T extends "mssql"
|
|
177
|
+
? MSSQLConnectionOptions
|
|
178
|
+
: never;
|
|
179
|
+
|
|
180
|
+
// ============================================================================
|
|
181
|
+
// Database Connection Zod Schema
|
|
182
|
+
// ============================================================================
|
|
183
|
+
|
|
184
|
+
export const DatabaseConnectionZod = z.object({
|
|
185
|
+
/** Unique name for the database connection */
|
|
186
|
+
name: z.string(),
|
|
187
|
+
/** Whether the database is enabled */
|
|
188
|
+
enabled: z.boolean(),
|
|
189
|
+
/** Database type */
|
|
190
|
+
type: z.union([z.literal("mssql"), z.literal("pg"), z.literal("mysql")]),
|
|
191
|
+
/** Connection configuration */
|
|
192
|
+
connection: z.object({
|
|
193
|
+
host: z.string(),
|
|
194
|
+
port: z.number(),
|
|
195
|
+
user: z.string(),
|
|
196
|
+
password: z.string(),
|
|
197
|
+
database: z.string(),
|
|
198
|
+
}),
|
|
199
|
+
/** Field naming pattern (default: "{schema}_{name}") */
|
|
200
|
+
fieldNaming: z.string().optional().default("{schema}_{name}"),
|
|
201
|
+
/** Factory function to create custom database repository */
|
|
202
|
+
repository: z.custom<CustomRepositoryFactory>().optional(),
|
|
203
|
+
/** Handler run once at startup against the connected database */
|
|
204
|
+
onConnect: z.custom<OnConnectHandler>().optional(),
|
|
205
|
+
/** Schema configuration (virtual columns, relationships, excluded tables) */
|
|
206
|
+
schema: DatabaseSchemaConfigZod.optional(),
|
|
207
|
+
/** Optional connection pool and transport options */
|
|
208
|
+
connectionOptions: z.union([BunSQLConnectionOptionsZod, MSSQLConnectionOptionsZod]).optional(),
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
// ============================================================================
|
|
212
|
+
// Database Config (hand-written generic wrapper over z.input field inventory)
|
|
213
|
+
// The generic `T` narrowing of `onConnect` / `repository` / `connectionOptions`
|
|
214
|
+
// is load-bearing — Zod can't express this narrowing.
|
|
215
|
+
// ============================================================================
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Database connection shape (derived from the Zod schema).
|
|
219
|
+
*/
|
|
220
|
+
export type DatabaseConnection = z.input<typeof DatabaseConnectionZod>["connection"];
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Database configuration with engine-type narrowing.
|
|
224
|
+
*/
|
|
225
|
+
export type DatabaseConfig<T extends DatabaseType = DatabaseType> = {
|
|
226
|
+
/** Unique name for the database connection */
|
|
227
|
+
name: string;
|
|
228
|
+
/** Whether the database is enabled */
|
|
229
|
+
enabled: boolean;
|
|
230
|
+
/** Database type */
|
|
231
|
+
type: T;
|
|
232
|
+
/** Connection configuration */
|
|
233
|
+
connection: DatabaseConnection;
|
|
234
|
+
/** Field naming pattern (default: "{schema}_{name}") */
|
|
235
|
+
fieldNaming?: string;
|
|
236
|
+
/** Factory function to create custom database repository */
|
|
237
|
+
repository?: CustomRepositoryFactory<T>;
|
|
238
|
+
/** Handler run once at startup against the connected database */
|
|
239
|
+
onConnect?: OnConnectHandler<T>;
|
|
240
|
+
/** Schema configuration (virtual columns, relationships, excluded tables) */
|
|
241
|
+
schema?: DatabaseSchemaConfig;
|
|
242
|
+
/** Optional connection pool and transport options */
|
|
243
|
+
connectionOptions?: ConnectionOptionsForType<T>;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
// ============================================================================
|
|
247
|
+
// Discriminated Union
|
|
248
|
+
// ============================================================================
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Discriminated union of all database configs — allows proper type narrowing
|
|
252
|
+
* for repository function parameter based on the database type field.
|
|
253
|
+
*/
|
|
254
|
+
export type AnyDatabaseConfig = {
|
|
255
|
+
[K in DatabaseType]: DatabaseConfig<K>;
|
|
256
|
+
}[DatabaseType];
|