@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,50 @@
|
|
|
1
|
+
import { parseArgs } from "util";
|
|
2
|
+
|
|
3
|
+
export type SeedAuthArgs = {
|
|
4
|
+
user: string;
|
|
5
|
+
password: string;
|
|
6
|
+
role: string;
|
|
7
|
+
config: string;
|
|
8
|
+
claims?: Record<string, unknown>;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const parseClaims = (raw: string | undefined): Record<string, unknown> => {
|
|
12
|
+
if (!raw) return {};
|
|
13
|
+
try {
|
|
14
|
+
const parsed = JSON.parse(raw);
|
|
15
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
16
|
+
throw new Error("--claims must be a JSON object");
|
|
17
|
+
}
|
|
18
|
+
return parsed as Record<string, unknown>;
|
|
19
|
+
} catch (error) {
|
|
20
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
21
|
+
throw new Error(`Invalid --claims JSON: ${msg}`);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const parseSeedAuthArgs = (argv: string[]): SeedAuthArgs => {
|
|
26
|
+
const { values } = parseArgs({
|
|
27
|
+
args: argv,
|
|
28
|
+
options: {
|
|
29
|
+
user: { type: "string", short: "u" },
|
|
30
|
+
password: { type: "string", short: "p" },
|
|
31
|
+
role: { type: "string", short: "r" },
|
|
32
|
+
config: { type: "string", short: "c" },
|
|
33
|
+
claims: { type: "string" },
|
|
34
|
+
},
|
|
35
|
+
strict: true,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
if (!values.user) throw new Error("--user is required");
|
|
39
|
+
if (!values.password) throw new Error("--password is required");
|
|
40
|
+
if (!values.role) throw new Error("--role is required");
|
|
41
|
+
if (!values.config) throw new Error("--config is required");
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
user: values.user,
|
|
45
|
+
password: values.password,
|
|
46
|
+
role: values.role,
|
|
47
|
+
config: values.config,
|
|
48
|
+
claims: parseClaims(values.claims),
|
|
49
|
+
};
|
|
50
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { DefaultVariables, TypedCronJob } from "../types/cron";
|
|
2
|
+
|
|
3
|
+
import { createTypedCronJobZod } from "../types/cron";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Helper function to create a typed cron job with Zod validation
|
|
7
|
+
* Use this when you want runtime validation of the cron job configuration
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const cleanupJob = cron({
|
|
12
|
+
* name: "cleanup",
|
|
13
|
+
* pattern: "0 0 * * *",
|
|
14
|
+
* variables: { maxAge: 30 },
|
|
15
|
+
* onTick: async (gqlQuery, context) => {
|
|
16
|
+
* // context.variables is typed as { maxAge: number }
|
|
17
|
+
* const result = await gqlQuery(`mutation { deleteOld { affected_rows } }`);
|
|
18
|
+
* console.log(`Deleted ${result.data.affected_rows} rows`);
|
|
19
|
+
* },
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export const cron = <TVariables extends DefaultVariables>(
|
|
24
|
+
config: TypedCronJob<TVariables>,
|
|
25
|
+
): TypedCronJob<TVariables> => {
|
|
26
|
+
const schema = createTypedCronJobZod<TVariables>();
|
|
27
|
+
|
|
28
|
+
return schema.parse(config) as TypedCronJob<TVariables>;
|
|
29
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
DefaultInput,
|
|
5
|
+
HandlerOperation,
|
|
6
|
+
OperationHandler,
|
|
7
|
+
QueryOperation,
|
|
8
|
+
TypedOperation,
|
|
9
|
+
} from "../types/operation";
|
|
10
|
+
|
|
11
|
+
// ============================================================================
|
|
12
|
+
// Type-safe operation helper with overloads
|
|
13
|
+
// ============================================================================
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Helper type to infer input type from Zod schema
|
|
17
|
+
*/
|
|
18
|
+
type InferInput<TInputSchema> = TInputSchema extends z.ZodType<infer T> ? T : DefaultInput;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Helper type to infer output type from Zod schema
|
|
22
|
+
*/
|
|
23
|
+
type InferOutput<TOutputSchema> = TOutputSchema extends z.ZodType<infer T> ? T : unknown;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Config type for handler-based operations with inference
|
|
27
|
+
*/
|
|
28
|
+
type HandlerOperationConfig<
|
|
29
|
+
TRepository,
|
|
30
|
+
TInputSchema extends z.ZodType | undefined,
|
|
31
|
+
TOutputSchema extends z.ZodType | undefined,
|
|
32
|
+
TInitData,
|
|
33
|
+
> = Omit<
|
|
34
|
+
HandlerOperation<InferInput<TInputSchema>, InferOutput<TOutputSchema>, TInitData, TRepository>,
|
|
35
|
+
"handler" | "input" | "output"
|
|
36
|
+
> & {
|
|
37
|
+
input?: TInputSchema;
|
|
38
|
+
output?: TOutputSchema;
|
|
39
|
+
handler: OperationHandler<InferInput<TInputSchema>, InferOutput<TOutputSchema>, TRepository>;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Config type for query-based operations with inference
|
|
44
|
+
*/
|
|
45
|
+
type QueryOperationConfig<
|
|
46
|
+
TInputSchema extends z.ZodType | undefined,
|
|
47
|
+
TOutputSchema extends z.ZodType | undefined,
|
|
48
|
+
TInitData,
|
|
49
|
+
> = Omit<
|
|
50
|
+
QueryOperation<InferInput<TInputSchema>, InferOutput<TOutputSchema>, TInitData>,
|
|
51
|
+
"input" | "output"
|
|
52
|
+
> & {
|
|
53
|
+
input?: TInputSchema;
|
|
54
|
+
output?: TOutputSchema;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// Overload 1: Query-based operation (has `query`, no `handler`)
|
|
58
|
+
export function operation<
|
|
59
|
+
TInputSchema extends z.ZodType | undefined = undefined,
|
|
60
|
+
TOutputSchema extends z.ZodType | undefined = undefined,
|
|
61
|
+
TInitData = unknown,
|
|
62
|
+
>(
|
|
63
|
+
config: QueryOperationConfig<TInputSchema, TOutputSchema, TInitData>,
|
|
64
|
+
): QueryOperation<InferInput<TInputSchema>, InferOutput<TOutputSchema>, TInitData>;
|
|
65
|
+
|
|
66
|
+
// Overload 2: Handler-based operation without custom repository type (no generic provided)
|
|
67
|
+
export function operation<
|
|
68
|
+
TInputSchema extends z.ZodType | undefined = undefined,
|
|
69
|
+
TOutputSchema extends z.ZodType | undefined = undefined,
|
|
70
|
+
TInitData = unknown,
|
|
71
|
+
>(
|
|
72
|
+
config: HandlerOperationConfig<unknown, TInputSchema, TOutputSchema, TInitData>,
|
|
73
|
+
): HandlerOperation<InferInput<TInputSchema>, InferOutput<TOutputSchema>, TInitData, unknown>;
|
|
74
|
+
|
|
75
|
+
// Implementation
|
|
76
|
+
export function operation(config: unknown): unknown {
|
|
77
|
+
return config;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Creates a typed operation helper with custom repository type.
|
|
82
|
+
* Use this when you need typed access to repository in the handler.
|
|
83
|
+
*
|
|
84
|
+
* The generic is the databases map, keyed by database name (the same keys as
|
|
85
|
+
* `databases[].name`): at runtime `options.repository` holds one entry per
|
|
86
|
+
* database, so access a database's repository with `repository[dbName]`.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* type MainRepository = {
|
|
91
|
+
* users: { create: (data: UserInput) => Promise<User> };
|
|
92
|
+
* };
|
|
93
|
+
*
|
|
94
|
+
* const createUser = operation.typed<{ main: MainRepository }>()({
|
|
95
|
+
* input: z.object({ name: z.string(), email: z.string() }),
|
|
96
|
+
* handler: async ({ repository }, input) => {
|
|
97
|
+
* // repository is typed as { main: MainRepository }
|
|
98
|
+
* const user = await repository.main.users.create(input);
|
|
99
|
+
* return { id: user.id };
|
|
100
|
+
* },
|
|
101
|
+
* });
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
operation.typed = <TRepository>() => {
|
|
105
|
+
return <
|
|
106
|
+
TInputSchema extends z.ZodType | undefined = undefined,
|
|
107
|
+
TOutputSchema extends z.ZodType | undefined = undefined,
|
|
108
|
+
TInitData = unknown,
|
|
109
|
+
>(
|
|
110
|
+
config: HandlerOperationConfig<TRepository, TInputSchema, TOutputSchema, TInitData>,
|
|
111
|
+
): HandlerOperation<
|
|
112
|
+
InferInput<TInputSchema>,
|
|
113
|
+
InferOutput<TOutputSchema>,
|
|
114
|
+
TInitData,
|
|
115
|
+
TRepository
|
|
116
|
+
> => {
|
|
117
|
+
return config as HandlerOperation<
|
|
118
|
+
InferInput<TInputSchema>,
|
|
119
|
+
InferOutput<TOutputSchema>,
|
|
120
|
+
TInitData,
|
|
121
|
+
TRepository
|
|
122
|
+
>;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// ============================================================================
|
|
127
|
+
// Type utilities for operations
|
|
128
|
+
// ============================================================================
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Infer the input type from an operation
|
|
132
|
+
*/
|
|
133
|
+
export type InferOperationInput<T> =
|
|
134
|
+
T extends TypedOperation<infer TInput, unknown, unknown> ? TInput : never;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Infer the output type from an operation
|
|
138
|
+
*/
|
|
139
|
+
export type InferOperationOutput<T> =
|
|
140
|
+
T extends TypedOperation<unknown, infer TOutput, unknown> ? TOutput : never;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Infer the init data type from an operation
|
|
144
|
+
*/
|
|
145
|
+
export type InferOperationInitData<T> =
|
|
146
|
+
T extends TypedOperation<unknown, unknown, infer TInitData> ? TInitData : never;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { KafkaConfigInput, RabbitMQConfigInput } from "../../types/zod/queue";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Builder for a queue (RabbitMQ or Kafka) configuration. Adds the `type`
|
|
5
|
+
* discriminator so the rest of the config object can be written without it.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { queue } from "@graphoria/server/config";
|
|
10
|
+
*
|
|
11
|
+
* queues: [
|
|
12
|
+
* queue.rabbitmq({ name: "events", connection: "amqp://localhost" }),
|
|
13
|
+
* queue.kafka({ name: "events", connection: { brokers: ["localhost:9092"] } }),
|
|
14
|
+
* ];
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export const queue = {
|
|
18
|
+
rabbitmq: (config: Omit<RabbitMQConfigInput, "type">): RabbitMQConfigInput => ({
|
|
19
|
+
...config,
|
|
20
|
+
type: "rabbitmq",
|
|
21
|
+
}),
|
|
22
|
+
|
|
23
|
+
kafka: (config: Omit<KafkaConfigInput, "type">): KafkaConfigInput => ({
|
|
24
|
+
...config,
|
|
25
|
+
type: "kafka",
|
|
26
|
+
}),
|
|
27
|
+
};
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration-authoring surface for `graphoria.ts` files.
|
|
3
|
+
*
|
|
4
|
+
* Exposed as `@graphoria/server/config`: the full configuration API
|
|
5
|
+
* (helpers + types) plus the server-only runtime maps, so consumers can
|
|
6
|
+
* install `@graphoria/server` alone and import everything a config file
|
|
7
|
+
* needs from `@graphoria/server/config`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { operation, queue, z } from "@graphoria/server/config";
|
|
12
|
+
* import type { ConfigurationFn } from "@graphoria/server/config";
|
|
13
|
+
*
|
|
14
|
+
* const ping = operation({
|
|
15
|
+
* input: z.object({}),
|
|
16
|
+
* output: z.string(),
|
|
17
|
+
* handler: async () => "pong",
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
// oxlint-disable typescript/no-explicit-any
|
|
22
|
+
import { z } from "zod";
|
|
23
|
+
|
|
24
|
+
import type {
|
|
25
|
+
ConfigurationInput,
|
|
26
|
+
CreateOneToBooleanMSSQLFn,
|
|
27
|
+
CreateYAndNToBooleanMSSQLFn,
|
|
28
|
+
DefaultInput,
|
|
29
|
+
OperationCacheConfig,
|
|
30
|
+
OperationGraphQLConfig,
|
|
31
|
+
OperationHandler,
|
|
32
|
+
OperationOptions,
|
|
33
|
+
OperationRestConfig,
|
|
34
|
+
TypedOperation,
|
|
35
|
+
VirtualColumnExpressionFn,
|
|
36
|
+
VirtualColumnFunctionFn,
|
|
37
|
+
} from "./types";
|
|
38
|
+
|
|
39
|
+
// ============================================================================
|
|
40
|
+
// Operation Helper Function Type
|
|
41
|
+
// ============================================================================
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Helper type to infer the output type from a Zod schema
|
|
45
|
+
* Uses z.output to get the transformed/parsed output type
|
|
46
|
+
*/
|
|
47
|
+
type InferZodOutput<T> = T extends z.ZodType<infer O, any, any> ? O : never;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Infer TOutput from TOutputSchema
|
|
51
|
+
*/
|
|
52
|
+
type InferOutput<TOutputSchema> =
|
|
53
|
+
TOutputSchema extends z.ZodType<any> ? InferZodOutput<TOutputSchema> : unknown;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Type for the operation helper function provided by @graphoria/server.
|
|
57
|
+
*
|
|
58
|
+
* This uses a simplified approach where we accept any ZodObject for input/output
|
|
59
|
+
* and return TypedOperation with appropriate type inference.
|
|
60
|
+
*/
|
|
61
|
+
export type OperationFn = {
|
|
62
|
+
// Query operation overload - with input schema
|
|
63
|
+
<
|
|
64
|
+
TInputSchema extends z.ZodObject<any>,
|
|
65
|
+
TOutputSchema extends z.ZodType<any> | undefined = undefined,
|
|
66
|
+
TInitData = unknown,
|
|
67
|
+
>(config: {
|
|
68
|
+
/** GraphQL query to execute */
|
|
69
|
+
query: string;
|
|
70
|
+
/** Custom handler is not allowed with query */
|
|
71
|
+
handler?: never;
|
|
72
|
+
/** Description for documentation */
|
|
73
|
+
description?: string;
|
|
74
|
+
/** Input schema (Zod) */
|
|
75
|
+
input: TInputSchema;
|
|
76
|
+
/** Output schema (Zod) */
|
|
77
|
+
output?: TOutputSchema;
|
|
78
|
+
/** Hooks for initialization and request transformation */
|
|
79
|
+
hooks?: {
|
|
80
|
+
init?: (options: OperationOptions) => TInitData | Promise<TInitData>;
|
|
81
|
+
beforeRequest?: (
|
|
82
|
+
context: { input: z.infer<TInputSchema> },
|
|
83
|
+
initData: TInitData | undefined,
|
|
84
|
+
) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
85
|
+
afterRequest?: (context: {
|
|
86
|
+
output: InferOutput<TOutputSchema>;
|
|
87
|
+
}) => InferOutput<TOutputSchema> | Promise<InferOutput<TOutputSchema>>;
|
|
88
|
+
};
|
|
89
|
+
/** REST exposure configuration */
|
|
90
|
+
rest?: OperationRestConfig;
|
|
91
|
+
/** GraphQL exposure configuration (enabled by default) */
|
|
92
|
+
graphql?: OperationGraphQLConfig;
|
|
93
|
+
/** Cache configuration */
|
|
94
|
+
cache?: OperationCacheConfig;
|
|
95
|
+
}): TypedOperation<z.infer<TInputSchema>, InferOutput<TOutputSchema>, TInitData, unknown>;
|
|
96
|
+
|
|
97
|
+
// Query operation overload - without input schema
|
|
98
|
+
<TOutputSchema extends z.ZodType<any> | undefined = undefined, TInitData = unknown>(config: {
|
|
99
|
+
/** GraphQL query to execute */
|
|
100
|
+
query: string;
|
|
101
|
+
/** Custom handler is not allowed with query */
|
|
102
|
+
handler?: never;
|
|
103
|
+
/** Description for documentation */
|
|
104
|
+
description?: string;
|
|
105
|
+
/** Input schema (Zod) */
|
|
106
|
+
input?: undefined;
|
|
107
|
+
/** Output schema (Zod) */
|
|
108
|
+
output?: TOutputSchema;
|
|
109
|
+
/** Hooks for initialization and request transformation */
|
|
110
|
+
hooks?: {
|
|
111
|
+
init?: (options: OperationOptions) => TInitData | Promise<TInitData>;
|
|
112
|
+
beforeRequest?: (
|
|
113
|
+
context: { input: DefaultInput },
|
|
114
|
+
initData: TInitData | undefined,
|
|
115
|
+
) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
116
|
+
afterRequest?: (context: {
|
|
117
|
+
output: InferOutput<TOutputSchema>;
|
|
118
|
+
}) => InferOutput<TOutputSchema> | Promise<InferOutput<TOutputSchema>>;
|
|
119
|
+
};
|
|
120
|
+
/** REST exposure configuration */
|
|
121
|
+
rest?: OperationRestConfig;
|
|
122
|
+
/** GraphQL exposure configuration (enabled by default) */
|
|
123
|
+
graphql?: OperationGraphQLConfig;
|
|
124
|
+
/** Cache configuration */
|
|
125
|
+
cache?: OperationCacheConfig;
|
|
126
|
+
}): TypedOperation<DefaultInput, InferOutput<TOutputSchema>, TInitData, unknown>;
|
|
127
|
+
|
|
128
|
+
// Handler operation overload - with input schema
|
|
129
|
+
<
|
|
130
|
+
TInputSchema extends z.ZodObject<any>,
|
|
131
|
+
TOutputSchema extends z.ZodType<any> | undefined = undefined,
|
|
132
|
+
TInitData = unknown,
|
|
133
|
+
>(config: {
|
|
134
|
+
/** Query is not allowed with handler */
|
|
135
|
+
query?: never;
|
|
136
|
+
/** Custom handler function */
|
|
137
|
+
handler: OperationHandler<z.infer<TInputSchema>, InferOutput<TOutputSchema>, unknown>;
|
|
138
|
+
/** Description for documentation */
|
|
139
|
+
description?: string;
|
|
140
|
+
/** Input schema (Zod) */
|
|
141
|
+
input: TInputSchema;
|
|
142
|
+
/** Output schema (Zod) */
|
|
143
|
+
output?: TOutputSchema;
|
|
144
|
+
/** Hooks for initialization and request transformation */
|
|
145
|
+
hooks?: {
|
|
146
|
+
init?: (options: OperationOptions) => TInitData | Promise<TInitData>;
|
|
147
|
+
beforeRequest?: (
|
|
148
|
+
context: { input: z.infer<TInputSchema> },
|
|
149
|
+
initData: TInitData | undefined,
|
|
150
|
+
) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
151
|
+
afterRequest?: (context: {
|
|
152
|
+
output: InferOutput<TOutputSchema>;
|
|
153
|
+
}) => InferOutput<TOutputSchema> | Promise<InferOutput<TOutputSchema>>;
|
|
154
|
+
};
|
|
155
|
+
/** REST exposure configuration */
|
|
156
|
+
rest?: OperationRestConfig;
|
|
157
|
+
/** GraphQL exposure configuration (enabled by default) */
|
|
158
|
+
graphql?: OperationGraphQLConfig;
|
|
159
|
+
/** Cache configuration */
|
|
160
|
+
cache?: OperationCacheConfig;
|
|
161
|
+
}): TypedOperation<z.infer<TInputSchema>, InferOutput<TOutputSchema>, TInitData, unknown>;
|
|
162
|
+
|
|
163
|
+
// Handler operation overload - without input schema
|
|
164
|
+
<TOutputSchema extends z.ZodType<any> | undefined = undefined, TInitData = unknown>(config: {
|
|
165
|
+
/** Query is not allowed with handler */
|
|
166
|
+
query?: never;
|
|
167
|
+
/** Custom handler function */
|
|
168
|
+
handler: OperationHandler<DefaultInput, InferOutput<TOutputSchema>, unknown>;
|
|
169
|
+
/** Description for documentation */
|
|
170
|
+
description?: string;
|
|
171
|
+
/** Input schema (Zod) */
|
|
172
|
+
input?: undefined;
|
|
173
|
+
/** Output schema (Zod) */
|
|
174
|
+
output?: TOutputSchema;
|
|
175
|
+
/** Hooks for initialization and request transformation */
|
|
176
|
+
hooks?: {
|
|
177
|
+
init?: (options: OperationOptions) => TInitData | Promise<TInitData>;
|
|
178
|
+
beforeRequest?: (
|
|
179
|
+
context: { input: DefaultInput },
|
|
180
|
+
initData: TInitData | undefined,
|
|
181
|
+
) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
182
|
+
afterRequest?: (context: {
|
|
183
|
+
output: InferOutput<TOutputSchema>;
|
|
184
|
+
}) => InferOutput<TOutputSchema> | Promise<InferOutput<TOutputSchema>>;
|
|
185
|
+
};
|
|
186
|
+
/** REST exposure configuration */
|
|
187
|
+
rest?: OperationRestConfig;
|
|
188
|
+
/** GraphQL exposure configuration (enabled by default) */
|
|
189
|
+
graphql?: OperationGraphQLConfig;
|
|
190
|
+
/** Cache configuration */
|
|
191
|
+
cache?: OperationCacheConfig;
|
|
192
|
+
}): TypedOperation<DefaultInput, InferOutput<TOutputSchema>, TInitData, unknown>;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Creates a typed operation helper with custom repository type.
|
|
196
|
+
* Use this when you need typed access to repository in the handler.
|
|
197
|
+
*
|
|
198
|
+
* The generic is the databases map, keyed by database name; the handler's
|
|
199
|
+
* `options.repository` is that map, so access a repository as
|
|
200
|
+
* `repository[dbName]` (e.g. `repository.main`).
|
|
201
|
+
*/
|
|
202
|
+
typed: <TRepository>() => <
|
|
203
|
+
TInputSchema extends z.ZodObject<any>,
|
|
204
|
+
TOutputSchema extends z.ZodType<any> | undefined = undefined,
|
|
205
|
+
TInitData = unknown,
|
|
206
|
+
>(config: {
|
|
207
|
+
/** Query is not allowed with handler */
|
|
208
|
+
query?: never;
|
|
209
|
+
/** Custom handler function */
|
|
210
|
+
handler: OperationHandler<z.infer<TInputSchema>, InferOutput<TOutputSchema>, TRepository>;
|
|
211
|
+
/** Description for documentation */
|
|
212
|
+
description?: string;
|
|
213
|
+
/** Input schema (Zod) */
|
|
214
|
+
input: TInputSchema;
|
|
215
|
+
/** Output schema (Zod) */
|
|
216
|
+
output?: TOutputSchema;
|
|
217
|
+
/** Hooks for initialization and request transformation */
|
|
218
|
+
hooks?: {
|
|
219
|
+
init?: (options: OperationOptions) => TInitData | Promise<TInitData>;
|
|
220
|
+
beforeRequest?: (
|
|
221
|
+
context: { input: z.infer<TInputSchema> },
|
|
222
|
+
initData: TInitData | undefined,
|
|
223
|
+
) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
224
|
+
afterRequest?: (context: {
|
|
225
|
+
output: InferOutput<TOutputSchema>;
|
|
226
|
+
}) => InferOutput<TOutputSchema> | Promise<InferOutput<TOutputSchema>>;
|
|
227
|
+
};
|
|
228
|
+
/** REST exposure configuration */
|
|
229
|
+
rest?: OperationRestConfig;
|
|
230
|
+
/** GraphQL exposure configuration (enabled by default) */
|
|
231
|
+
graphql?: OperationGraphQLConfig;
|
|
232
|
+
/** Cache configuration */
|
|
233
|
+
cache?: OperationCacheConfig;
|
|
234
|
+
}) => TypedOperation<z.infer<TInputSchema>, InferOutput<TOutputSchema>, TInitData, TRepository>;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
// ============================================================================
|
|
238
|
+
// Configuration Helpers Type
|
|
239
|
+
// ============================================================================
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Configuration helpers object passed to the configuration function
|
|
243
|
+
*/
|
|
244
|
+
export type ConfigurationHelpers = {
|
|
245
|
+
/** Zod validation library instance */
|
|
246
|
+
z: typeof z;
|
|
247
|
+
/** Helper function to define operations */
|
|
248
|
+
operation: OperationFn;
|
|
249
|
+
/** Helper to create virtual columns from MSSQL 1/0 to boolean */
|
|
250
|
+
createOneToBooleanMSSQL: CreateOneToBooleanMSSQLFn;
|
|
251
|
+
/** Helper to create virtual columns from MSSQL Y/N to boolean */
|
|
252
|
+
createYAndNToBooleanMSSQL: CreateYAndNToBooleanMSSQLFn;
|
|
253
|
+
/** Helper to create virtual columns from SQL expressions */
|
|
254
|
+
virtualColumnExpression: VirtualColumnExpressionFn;
|
|
255
|
+
/** Helper to create virtual columns from SQL functions */
|
|
256
|
+
virtualColumnFunction: VirtualColumnFunctionFn;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Configuration function type that receives helpers and returns configuration
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* ```ts
|
|
264
|
+
* import type { ConfigurationFn } from "@graphoria/server/config";
|
|
265
|
+
*
|
|
266
|
+
* export default (({ z, operation, virtualColumnFunction }) => ({
|
|
267
|
+
* name: "My API",
|
|
268
|
+
* version: "1.0.0",
|
|
269
|
+
* databases: [...],
|
|
270
|
+
* operations: {
|
|
271
|
+
* getUsers: operation({
|
|
272
|
+
* query: `query { users { id name } }`,
|
|
273
|
+
* rest: { path: "/users" },
|
|
274
|
+
* }),
|
|
275
|
+
* },
|
|
276
|
+
* })) satisfies ConfigurationFn;
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
279
|
+
export type ConfigurationFn = (helpers: ConfigurationHelpers) => ConfigurationInput;
|
|
280
|
+
|
|
281
|
+
// Re-export all types
|
|
282
|
+
export * from "./types";
|
|
283
|
+
|
|
284
|
+
// Re-export helpers
|
|
285
|
+
export {
|
|
286
|
+
operation,
|
|
287
|
+
cron,
|
|
288
|
+
queue,
|
|
289
|
+
type InferOperationInput,
|
|
290
|
+
type InferOperationOutput,
|
|
291
|
+
type InferOperationInitData,
|
|
292
|
+
} from "./helpers";
|
|
293
|
+
|
|
294
|
+
// Re-export cron definition types
|
|
295
|
+
export {
|
|
296
|
+
DefaultVariablesSchema,
|
|
297
|
+
createTypedCronJobZod,
|
|
298
|
+
TypedCronJobZod,
|
|
299
|
+
type DefaultVariables,
|
|
300
|
+
type TickContext,
|
|
301
|
+
type TypedCronJob,
|
|
302
|
+
type CronJobType,
|
|
303
|
+
} from "./types/cron";
|
|
304
|
+
|
|
305
|
+
// Re-export zod for convenience
|
|
306
|
+
export { z } from "zod";
|
|
307
|
+
|
|
308
|
+
export const createApiResponse = <T extends z.ZodTypeAny>(dataSchema: T) =>
|
|
309
|
+
z.object({
|
|
310
|
+
status: z.string(),
|
|
311
|
+
data: dataSchema.optional(),
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
/** Runtime maps populated during boot: live connection pools and repositories. */
|
|
315
|
+
export type { RepositoryMap, DatabasesConnections } from "../singletons/databases";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Model Context Protocol (MCP) server configuration, nested under `ai.mcp`.
|
|
5
|
+
* When enabled, exposes a `/mcp` endpoint for LLM agents.
|
|
6
|
+
*/
|
|
7
|
+
export const MCPZod = z.object({
|
|
8
|
+
/** Whether the MCP server is enabled. Off by default. */
|
|
9
|
+
enabled: z.boolean().default(false),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/** Authoring type for MCP configuration */
|
|
13
|
+
export type MCPConfig = z.input<typeof MCPZod>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* AI agent configuration. Exposes an admin-only natural-language → database
|
|
17
|
+
* Q&A agent as a GraphQL `ask` query and a REST `POST` endpoint.
|
|
18
|
+
*
|
|
19
|
+
* The LLM provider, model, and API keys are read from environment variables
|
|
20
|
+
* (`LLM_PROVIDER`, `LLM_MODEL`, `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`,
|
|
21
|
+
* `DEEPSEEK_API_KEY`, `OLLAMA_HOST`), not from this config.
|
|
22
|
+
*/
|
|
23
|
+
export const AIZod = z.object({
|
|
24
|
+
/** Whether the AI agent is enabled. Off by default. */
|
|
25
|
+
enabled: z.boolean().default(false),
|
|
26
|
+
/** Overrides the built-in system prompt sent to the LLM. */
|
|
27
|
+
systemPrompt: z.string().optional(),
|
|
28
|
+
/** REST endpoint path for the agent (default: "/ai"). */
|
|
29
|
+
endpoint: z.string().default("/ai"),
|
|
30
|
+
/** Model Context Protocol (MCP) server. Off by default. See MCP.md. */
|
|
31
|
+
mcp: MCPZod.optional().default({ enabled: false }),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
/** Authoring type for AI configuration */
|
|
35
|
+
export type AIConfig = z.input<typeof AIZod>;
|