@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,96 @@
|
|
|
1
|
+
import { isString } from "es-toolkit";
|
|
2
|
+
|
|
3
|
+
import { AuthConfigZod } from "../../config";
|
|
4
|
+
import type { TableFilter } from "../configuration";
|
|
5
|
+
|
|
6
|
+
// Re-export base types and schemas from the config module
|
|
7
|
+
export type {
|
|
8
|
+
DirectionUnion,
|
|
9
|
+
OrderByClause,
|
|
10
|
+
FilterCondition,
|
|
11
|
+
TablePermission,
|
|
12
|
+
RolePermission,
|
|
13
|
+
AuthConfig,
|
|
14
|
+
} from "../../config";
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
DirectionUnionZod,
|
|
18
|
+
OrderByClauseZod,
|
|
19
|
+
FilterConditionZod,
|
|
20
|
+
TablePermissionZod,
|
|
21
|
+
RolePermissionZod,
|
|
22
|
+
AuthConfigZod,
|
|
23
|
+
} from "../../config";
|
|
24
|
+
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// Permissions Normalization Transform
|
|
27
|
+
// ============================================================================
|
|
28
|
+
|
|
29
|
+
type TablePermissionsDictionary = Record<
|
|
30
|
+
string,
|
|
31
|
+
{
|
|
32
|
+
columns: "ALL" | string[];
|
|
33
|
+
} & TableFilter
|
|
34
|
+
>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Auth schema with permissions-dictionary normalization.
|
|
38
|
+
* The transform normalizes tables from the three accepted input forms
|
|
39
|
+
* (string[], "ALL", Record<string, "ALL" | TablePermission>) into a single
|
|
40
|
+
* consistent runtime shape: either "ALL" or Record<string, { columns, ... }>.
|
|
41
|
+
*/
|
|
42
|
+
export const AuthZod = AuthConfigZod.transform((val) => {
|
|
43
|
+
if (!val) return undefined;
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
...val,
|
|
47
|
+
permissions: Object.fromEntries(
|
|
48
|
+
Object.entries(val.permissions).map(([role, perms]) => {
|
|
49
|
+
let tablesComputed: "ALL" | TablePermissionsDictionary = {};
|
|
50
|
+
|
|
51
|
+
if (isString(perms.tables) && perms.tables === "ALL") {
|
|
52
|
+
tablesComputed = "ALL";
|
|
53
|
+
} else if (Array.isArray(perms.tables)) {
|
|
54
|
+
tablesComputed = perms.tables.reduce<TablePermissionsDictionary>(
|
|
55
|
+
(acc, table) => ({
|
|
56
|
+
...acc,
|
|
57
|
+
[table.toLowerCase()]: { columns: "ALL" },
|
|
58
|
+
}),
|
|
59
|
+
{},
|
|
60
|
+
);
|
|
61
|
+
} else if (typeof perms.tables === "object" && perms.tables !== null) {
|
|
62
|
+
tablesComputed = Object.fromEntries(
|
|
63
|
+
Object.entries(perms.tables).map(([table, tablePerms]) => {
|
|
64
|
+
if (isString(tablePerms) && tablePerms === "ALL") {
|
|
65
|
+
return [table.toLowerCase(), { columns: "ALL" }];
|
|
66
|
+
} else if (
|
|
67
|
+
typeof tablePerms === "object" &&
|
|
68
|
+
tablePerms !== null &&
|
|
69
|
+
"columns" in tablePerms
|
|
70
|
+
) {
|
|
71
|
+
return [
|
|
72
|
+
table.toLowerCase(),
|
|
73
|
+
{
|
|
74
|
+
columns: tablePerms.columns,
|
|
75
|
+
filter: tablePerms.filter,
|
|
76
|
+
orderBy: tablePerms.orderBy,
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
} else {
|
|
80
|
+
return [table.toLowerCase(), { columns: "ALL" }];
|
|
81
|
+
}
|
|
82
|
+
}),
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return [
|
|
87
|
+
role,
|
|
88
|
+
{
|
|
89
|
+
...perms,
|
|
90
|
+
tables: tablesComputed,
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
}),
|
|
94
|
+
),
|
|
95
|
+
};
|
|
96
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
import { TokenStrategyZod } from "../../config";
|
|
4
|
+
import { AIZod } from "./ai";
|
|
5
|
+
import { AuthZod } from "./auth";
|
|
6
|
+
import { TypedCronJobZod } from "./cron";
|
|
7
|
+
import { DatabaseConnectionZod } from "./db";
|
|
8
|
+
import { OperationsZod } from "./operation";
|
|
9
|
+
import { QueueConfigZod } from "./queue";
|
|
10
|
+
import { RemoteRESTConfigZod } from "./remoteREST";
|
|
11
|
+
import { RemoteSchemaConfigZod } from "./remoteSchema";
|
|
12
|
+
|
|
13
|
+
export const ConfigurationZod = z
|
|
14
|
+
.object({
|
|
15
|
+
name: z.string(),
|
|
16
|
+
version: z.string(),
|
|
17
|
+
tokenStrategy: TokenStrategyZod.optional().default("jwt"),
|
|
18
|
+
databases: z.array(DatabaseConnectionZod).default([]),
|
|
19
|
+
queues: z.array(QueueConfigZod).optional().default([]),
|
|
20
|
+
cron: z.array(TypedCronJobZod).optional().default([]),
|
|
21
|
+
operations: OperationsZod.optional().default({}),
|
|
22
|
+
auth: AuthZod,
|
|
23
|
+
remoteSchemas: z.array(RemoteSchemaConfigZod).optional().default([]),
|
|
24
|
+
remoteREST: z.array(RemoteRESTConfigZod).optional().default([]),
|
|
25
|
+
ai: AIZod.optional().default({ enabled: false, endpoint: "/ai", mcp: { enabled: false } }),
|
|
26
|
+
})
|
|
27
|
+
.refine(
|
|
28
|
+
(data) => {
|
|
29
|
+
if (!data.auth?.enabled) return true;
|
|
30
|
+
|
|
31
|
+
return data.auth?.enabled && data.databases.find((db) => db.name === data.auth?.database);
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
message: "Database to store auth information is not found",
|
|
35
|
+
path: ["auth", "database"],
|
|
36
|
+
},
|
|
37
|
+
)
|
|
38
|
+
.transform((data) => ({
|
|
39
|
+
...data,
|
|
40
|
+
// Pre-calculate enabled databases during parsing
|
|
41
|
+
enabledDatabases: data.databases.filter((d) => d.enabled),
|
|
42
|
+
auth: {
|
|
43
|
+
...data.auth!,
|
|
44
|
+
databaseEntity: data.databases.find((db) => db.name === data.auth!.database)!,
|
|
45
|
+
},
|
|
46
|
+
}));
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TypedCronJobZod as BaseTypedCronJobZod } from "../../config";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
import type { DefaultVariables, TickContext } from "../../config";
|
|
5
|
+
import type { BackgroundCallbackOptions } from "../common";
|
|
6
|
+
|
|
7
|
+
// Re-export definition types from config package
|
|
8
|
+
export {
|
|
9
|
+
DefaultVariablesSchema,
|
|
10
|
+
createTypedCronJobZod,
|
|
11
|
+
type DefaultVariables,
|
|
12
|
+
type TickContext,
|
|
13
|
+
type TypedCronJob,
|
|
14
|
+
type CronJobType,
|
|
15
|
+
} from "../../config";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Tick callback function type - receives options object with gqlQuery and databases
|
|
19
|
+
* This is server-specific because it references runtime types (BackgroundCallbackOptions)
|
|
20
|
+
*/
|
|
21
|
+
export type TickCallback<TVariables = DefaultVariables> = (
|
|
22
|
+
options: BackgroundCallbackOptions,
|
|
23
|
+
context: TickContext<TVariables>,
|
|
24
|
+
response?: { data: unknown; errors?: unknown[] },
|
|
25
|
+
) => Promise<void> | void;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Server-specific Zod schema that extends the config schema with onTick callback
|
|
29
|
+
*/
|
|
30
|
+
export const TypedCronJobZod = BaseTypedCronJobZod.extend({
|
|
31
|
+
/**
|
|
32
|
+
* Optional callback function executed on each tick
|
|
33
|
+
*/
|
|
34
|
+
onTick: z.custom<TickCallback>().optional(),
|
|
35
|
+
});
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
BunSQLConnectionOptionsZod,
|
|
5
|
+
DatabaseConnectionZod,
|
|
6
|
+
DatabaseSchemaConfigZod,
|
|
7
|
+
MSSQLConnectionOptionsZod,
|
|
8
|
+
TableRelationshipZod as TableRelationshipBaseZod,
|
|
9
|
+
} from "../../config";
|
|
10
|
+
import { genResolverName } from "../../databases/transformers/genResolverName";
|
|
11
|
+
|
|
12
|
+
// Re-export base types and schemas from the config module
|
|
13
|
+
export type {
|
|
14
|
+
BunSQLConnectionOptions,
|
|
15
|
+
DatabaseConfig,
|
|
16
|
+
DatabaseConnection,
|
|
17
|
+
DatabaseSchemaConfig,
|
|
18
|
+
DatabaseType,
|
|
19
|
+
MSSQLConnectionOptions,
|
|
20
|
+
TableRelationship,
|
|
21
|
+
TableSchemaConfig,
|
|
22
|
+
} from "../../config";
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
BunSQLConnectionOptionsZod,
|
|
26
|
+
DatabaseConnectionZod,
|
|
27
|
+
DatabaseSchemaConfigZod,
|
|
28
|
+
MSSQLConnectionOptionsZod,
|
|
29
|
+
VirtualColumnZod,
|
|
30
|
+
} from "../../config";
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Base column schema from database queries.
|
|
34
|
+
* Handles the isNullable type conversion (number to boolean) that different databases return.
|
|
35
|
+
*/
|
|
36
|
+
export const TableColumnZod = z
|
|
37
|
+
.object({
|
|
38
|
+
name: z.string(),
|
|
39
|
+
dataType: z.string(),
|
|
40
|
+
isNullable: z.union([z.boolean(), z.number()]),
|
|
41
|
+
description: z.string().nullable().optional(),
|
|
42
|
+
})
|
|
43
|
+
.transform((val) => ({
|
|
44
|
+
name: val.name,
|
|
45
|
+
dataType: val.dataType,
|
|
46
|
+
isNullable: typeof val.isNullable === "boolean" ? val.isNullable : val.isNullable === 1,
|
|
47
|
+
description: val.description ?? null,
|
|
48
|
+
}));
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Table relationship schema with computed dashedName property.
|
|
52
|
+
* Extends the base config schema with a dashedName transform for introspection use.
|
|
53
|
+
*/
|
|
54
|
+
export const TableRelationshipEnhancedZod = TableRelationshipBaseZod.transform((rel) => ({
|
|
55
|
+
...rel,
|
|
56
|
+
dashedName: `${rel.schema}_${rel.name}`,
|
|
57
|
+
}));
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Base table schema from database queries (before enhancement).
|
|
61
|
+
* Contains raw database structure.
|
|
62
|
+
*/
|
|
63
|
+
export const TableBaseZod = z.object({
|
|
64
|
+
schema: z.string(),
|
|
65
|
+
name: z.string(),
|
|
66
|
+
entityType: z.union([z.literal("table"), z.literal("view")]),
|
|
67
|
+
tableDescription: z.string().nullable().optional(),
|
|
68
|
+
columns: z.array(TableColumnZod),
|
|
69
|
+
foreignKeys: z.array(TableRelationshipEnhancedZod),
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Enrichment function that adds computed properties to tables.
|
|
74
|
+
* Called during Zod transformation.
|
|
75
|
+
*/
|
|
76
|
+
export const enrichTable = (table: z.output<typeof TableBaseZod>) => ({
|
|
77
|
+
...table,
|
|
78
|
+
dashedName: `${table.schema}_${table.name}`,
|
|
79
|
+
dashedNameLS: `${table.schema}_${table.name}`.toLowerCase(),
|
|
80
|
+
dottedName: `${table.schema}.${table.name}`,
|
|
81
|
+
dottedQuotedName: `"${table.schema}"."${table.name}"`,
|
|
82
|
+
schemaName: genResolverName(table.schema, table.name, table.entityType),
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Table schema with enriched properties (dashedName, dottedName, etc.).
|
|
87
|
+
* This is the primary table type used throughout the application.
|
|
88
|
+
*/
|
|
89
|
+
export const TableZod = TableBaseZod.transform(enrichTable);
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Stored procedure parameter schema.
|
|
93
|
+
*/
|
|
94
|
+
export const StoredProcedureParameterZod = z.object({
|
|
95
|
+
name: z.string(),
|
|
96
|
+
dataType: z.string().nullable(),
|
|
97
|
+
maxLength: z.number(),
|
|
98
|
+
precision: z.number(),
|
|
99
|
+
scale: z.number(),
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Base stored procedure schema from database queries (before enhancement).
|
|
104
|
+
* Contains raw database structure.
|
|
105
|
+
*/
|
|
106
|
+
export const StoredProcedureBaseZod = z.object({
|
|
107
|
+
schema: z.string(),
|
|
108
|
+
name: z.string(),
|
|
109
|
+
signature: z.string().optional(),
|
|
110
|
+
type: z.string().optional(),
|
|
111
|
+
parameters: z.array(StoredProcedureParameterZod),
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Stored procedure schema with enriched naming properties.
|
|
116
|
+
* Adds dashedName, dottedName, and other computed fields for consistent naming across the app.
|
|
117
|
+
* Uses signature for unique identification when function overloading exists.
|
|
118
|
+
*/
|
|
119
|
+
export const StoredProcedureZod = StoredProcedureBaseZod.transform((sp) => {
|
|
120
|
+
const signatureSuffix = sp.signature ? `_${sp.signature.replace(/[^a-zA-Z0-9]/g, "_")}` : "";
|
|
121
|
+
const signatureSuffixClean = signatureSuffix.replace(/_+/g, "_").replace(/_$/, "");
|
|
122
|
+
return {
|
|
123
|
+
...sp,
|
|
124
|
+
dashedName: `${sp.schema}_${sp.name}${signatureSuffixClean}`,
|
|
125
|
+
dashedNameLS: `${sp.schema}_${sp.name}${signatureSuffixClean}`.toLowerCase(),
|
|
126
|
+
dottedName: `${sp.schema}.${sp.name}`,
|
|
127
|
+
dottedQuotedName: `"${sp.schema}"."${sp.name}"`,
|
|
128
|
+
schemaName: genResolverName(sp.schema, sp.name + signatureSuffixClean, "sp"),
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Database structure schema returned from database queries.
|
|
134
|
+
* Contains both tables and stored procedures with their enriched properties.
|
|
135
|
+
*/
|
|
136
|
+
export const DatabaseStructureZod = z.object({
|
|
137
|
+
tables: z.array(TableZod).default([]),
|
|
138
|
+
storedProcedures: z.array(StoredProcedureZod).default([]),
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// View schema
|
|
142
|
+
export const ViewZod = z.object({
|
|
143
|
+
schema: z.string(),
|
|
144
|
+
name: z.string(),
|
|
145
|
+
definition: z.string(),
|
|
146
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { BackgroundCallbackOptions } from "../common";
|
|
2
|
+
|
|
3
|
+
// Re-export base types from the config module
|
|
4
|
+
export type {
|
|
5
|
+
DefaultInput,
|
|
6
|
+
BeforeRequestContext,
|
|
7
|
+
AfterRequestContext,
|
|
8
|
+
OperationRestConfig,
|
|
9
|
+
OperationGraphQLConfig,
|
|
10
|
+
OperationCacheConfig,
|
|
11
|
+
OperationInitHook,
|
|
12
|
+
OperationBeforeRequestHook,
|
|
13
|
+
OperationAfterRequestHook,
|
|
14
|
+
OperationHandler,
|
|
15
|
+
BaseOperation,
|
|
16
|
+
QueryOperation,
|
|
17
|
+
HandlerOperation,
|
|
18
|
+
TypedOperation,
|
|
19
|
+
GqlQueryResult,
|
|
20
|
+
Operation,
|
|
21
|
+
Operations,
|
|
22
|
+
} from "../../config";
|
|
23
|
+
|
|
24
|
+
// Re-export Zod schemas from config
|
|
25
|
+
export {
|
|
26
|
+
OperationRestConfigZod,
|
|
27
|
+
OperationGraphQLConfigZod,
|
|
28
|
+
OperationCacheConfigZod,
|
|
29
|
+
OperationZod,
|
|
30
|
+
OperationsZod,
|
|
31
|
+
} from "../../config";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Options passed to operation handlers and hooks
|
|
35
|
+
* This is the runtime version with fully typed Bun-specific options
|
|
36
|
+
*/
|
|
37
|
+
export type OperationOptions<TRepository = unknown> = BackgroundCallbackOptions<TRepository>;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
BaseQueueConfigZod,
|
|
5
|
+
KafkaConnectionZod,
|
|
6
|
+
PublisherConfigZod,
|
|
7
|
+
RabbitMQConnectionZod,
|
|
8
|
+
ReconnectConfigZod,
|
|
9
|
+
SubscriberConfigZod,
|
|
10
|
+
TopicConfigZod,
|
|
11
|
+
} from "../../config";
|
|
12
|
+
import type { CacheContext, SubscriberHandler } from "../../config";
|
|
13
|
+
|
|
14
|
+
// Re-export base types and schemas from the config module
|
|
15
|
+
export type {
|
|
16
|
+
ReconnectConfig,
|
|
17
|
+
PublisherConfig,
|
|
18
|
+
SubscriberConfig,
|
|
19
|
+
TopicConfig,
|
|
20
|
+
CacheContext,
|
|
21
|
+
SubscriberHandler,
|
|
22
|
+
RabbitMQConnection,
|
|
23
|
+
KafkaConnection,
|
|
24
|
+
} from "../../config";
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
ReconnectConfigZod,
|
|
28
|
+
PublisherConfigZod,
|
|
29
|
+
SubscriberConfigZod,
|
|
30
|
+
TopicConfigZod,
|
|
31
|
+
BaseQueueConfigZod,
|
|
32
|
+
RabbitMQConnectionZod,
|
|
33
|
+
KafkaConnectionZod,
|
|
34
|
+
} from "../../config";
|
|
35
|
+
|
|
36
|
+
// ============================================================================
|
|
37
|
+
// RabbitMQ Configuration (extends base)
|
|
38
|
+
// ============================================================================
|
|
39
|
+
|
|
40
|
+
const RabbitMQConfigZod = BaseQueueConfigZod.extend({
|
|
41
|
+
type: z.literal("rabbitmq"),
|
|
42
|
+
/** Connection config or AMQP URL string */
|
|
43
|
+
connection: z.union([z.url(), RabbitMQConnectionZod]),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// ============================================================================
|
|
47
|
+
// Kafka Configuration (extends base)
|
|
48
|
+
// ============================================================================
|
|
49
|
+
|
|
50
|
+
const KafkaConfigZod = BaseQueueConfigZod.extend({
|
|
51
|
+
type: z.literal("kafka"),
|
|
52
|
+
/** Connection config or broker string "host:port" */
|
|
53
|
+
connection: z.union([z.string(), KafkaConnectionZod]),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// ============================================================================
|
|
57
|
+
// Union Type with Transform for Backward Compatibility
|
|
58
|
+
// ============================================================================
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Transforms user-facing flat config (publishers/subscribers/topics) into
|
|
62
|
+
* the internal runtime shape with derived exchanges[] and queues[] arrays.
|
|
63
|
+
*/
|
|
64
|
+
const transformQueueConfig = <T extends z.infer<typeof BaseQueueConfigZod>>(
|
|
65
|
+
config: T,
|
|
66
|
+
): T & {
|
|
67
|
+
exchanges: Array<{
|
|
68
|
+
name: string;
|
|
69
|
+
type: "topic" | "direct" | "fanout" | "headers";
|
|
70
|
+
options?: { durable?: boolean; autoDelete?: boolean };
|
|
71
|
+
publishers: Array<{
|
|
72
|
+
name: string;
|
|
73
|
+
resolverName: string;
|
|
74
|
+
routingKey: string;
|
|
75
|
+
options?: { persistent?: boolean; headers?: Record<string, string> };
|
|
76
|
+
}>;
|
|
77
|
+
}>;
|
|
78
|
+
queues: Array<{
|
|
79
|
+
name: string;
|
|
80
|
+
queue?: string;
|
|
81
|
+
groupId?: string;
|
|
82
|
+
bindings: Array<{ exchange: string; pattern: string }>;
|
|
83
|
+
queueOptions?: { durable?: boolean; autoDelete?: boolean };
|
|
84
|
+
handler?: SubscriberHandler;
|
|
85
|
+
}>;
|
|
86
|
+
} => {
|
|
87
|
+
// Group publishers by topic to create exchanges
|
|
88
|
+
const topicPublishers = new Map<
|
|
89
|
+
string,
|
|
90
|
+
Array<{ key: string; config: (typeof config.publishers)[string] }>
|
|
91
|
+
>();
|
|
92
|
+
|
|
93
|
+
Object.entries(config.publishers).forEach(([key, pub]) => {
|
|
94
|
+
const existing = topicPublishers.get(pub.topic) || [];
|
|
95
|
+
existing.push({ key, config: pub });
|
|
96
|
+
topicPublishers.set(pub.topic, existing);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Create exchanges from topics
|
|
100
|
+
const exchanges = Array.from(topicPublishers.entries()).map(([topic, pubs]) => {
|
|
101
|
+
const topicConfig = config.topics[topic];
|
|
102
|
+
return {
|
|
103
|
+
name: topic,
|
|
104
|
+
type: topicConfig?.type || ("topic" as const),
|
|
105
|
+
options: topicConfig
|
|
106
|
+
? { durable: topicConfig.durable, autoDelete: topicConfig.autoDelete }
|
|
107
|
+
: undefined,
|
|
108
|
+
publishers: pubs.map((p) => ({
|
|
109
|
+
name: p.key,
|
|
110
|
+
resolverName: `${config.name}_${p.key}`,
|
|
111
|
+
routingKey: p.config.routingKey || "",
|
|
112
|
+
options: {
|
|
113
|
+
persistent: p.config.persistent,
|
|
114
|
+
headers: p.config.headers,
|
|
115
|
+
},
|
|
116
|
+
})),
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// Create queues from subscribers
|
|
121
|
+
const queues = Object.entries(config.subscribers).map(([key, sub]) => ({
|
|
122
|
+
name: key,
|
|
123
|
+
queue: sub.queue,
|
|
124
|
+
groupId: sub.group,
|
|
125
|
+
bindings: [{ exchange: sub.topic, pattern: sub.pattern }],
|
|
126
|
+
queueOptions: {
|
|
127
|
+
durable: sub.durable,
|
|
128
|
+
autoDelete: sub.autoDelete,
|
|
129
|
+
},
|
|
130
|
+
handler: sub.handler,
|
|
131
|
+
}));
|
|
132
|
+
|
|
133
|
+
return {
|
|
134
|
+
...config,
|
|
135
|
+
exchanges,
|
|
136
|
+
queues,
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const RabbitMQConfigTransformed = RabbitMQConfigZod.transform(transformQueueConfig);
|
|
141
|
+
const KafkaConfigTransformed = KafkaConfigZod.transform(transformQueueConfig);
|
|
142
|
+
|
|
143
|
+
export const QueueConfigZod = z.discriminatedUnion("type", [
|
|
144
|
+
RabbitMQConfigTransformed,
|
|
145
|
+
KafkaConfigTransformed,
|
|
146
|
+
]);
|
|
147
|
+
|
|
148
|
+
export type QueueConfig = z.infer<typeof QueueConfigZod>;
|
|
149
|
+
export type RabbitMQConfig = z.infer<typeof RabbitMQConfigTransformed>;
|
|
150
|
+
export type KafkaConfig = z.infer<typeof KafkaConfigTransformed>;
|
|
151
|
+
|
|
152
|
+
/** Pre-transform input types — the shape users write in graphoria.ts */
|
|
153
|
+
export type RabbitMQConfigInput = z.input<typeof RabbitMQConfigTransformed>;
|
|
154
|
+
export type KafkaConfigInput = z.input<typeof KafkaConfigTransformed>;
|
|
155
|
+
|
|
156
|
+
// ============================================================================
|
|
157
|
+
// Transform helpers — Convert simplified config to internal format
|
|
158
|
+
// ============================================================================
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Derives unique topics from publishers and subscribers
|
|
162
|
+
*/
|
|
163
|
+
export const deriveTopics = (config: QueueConfig): string[] => {
|
|
164
|
+
const topics = new Set<string>();
|
|
165
|
+
|
|
166
|
+
Object.values(config.publishers).forEach((pub) => topics.add(pub.topic));
|
|
167
|
+
Object.values(config.subscribers).forEach((sub) => topics.add(sub.topic));
|
|
168
|
+
|
|
169
|
+
return Array.from(topics);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Get publisher resolver name
|
|
174
|
+
*/
|
|
175
|
+
export const getPublisherResolverName = (queueName: string, publisherKey: string): string =>
|
|
176
|
+
`${queueName}_${publisherKey}`;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Get subscriber resolver name
|
|
180
|
+
*/
|
|
181
|
+
export const getSubscriberResolverName = (queueName: string, subscriberKey: string): string =>
|
|
182
|
+
`${queueName}_${subscriberKey}`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
RemoteSchemaConfigZod,
|
|
5
|
+
RemoteSchemaIntrospectionConfigZod,
|
|
6
|
+
} from "../../config/types/remote-schema";
|
|
7
|
+
|
|
8
|
+
export { RemoteSchemaConfigZod, RemoteSchemaIntrospectionConfigZod };
|
|
9
|
+
|
|
10
|
+
/** Runtime (z.output) type for remote schema config */
|
|
11
|
+
export type RemoteSchemaConfig = z.output<typeof RemoteSchemaConfigZod>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { logger } from "../logging";
|
|
2
|
+
|
|
3
|
+
export const benchmark = async <T>(fn: () => Promise<T>): Promise<T> => {
|
|
4
|
+
const start = Bun.nanoseconds();
|
|
5
|
+
|
|
6
|
+
const result = await fn();
|
|
7
|
+
|
|
8
|
+
const finish = Bun.nanoseconds();
|
|
9
|
+
|
|
10
|
+
logger("benchmark").debug({ durationMs: (finish - start) / 1e6 }, "execution time");
|
|
11
|
+
|
|
12
|
+
return result;
|
|
13
|
+
};
|