@codemation/host 0.0.1
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/README.md +75 -0
- package/dist/CodemationConfig-XCkSV2dj.d.ts +168 -0
- package/dist/CodemationConsumerConfigLoader-Dmm2TzAA.d.ts +61 -0
- package/dist/CodemationConsumerConfigLoader-scS_RQMy.js +334 -0
- package/dist/CodemationConsumerConfigLoader-scS_RQMy.js.map +1 -0
- package/dist/CodemationFrontendBootstrapRequest-CE6DjOWJ.js +5768 -0
- package/dist/CodemationFrontendBootstrapRequest-CE6DjOWJ.js.map +1 -0
- package/dist/CodemationPluginListMerger-BNmaoXQL.js +49 -0
- package/dist/CodemationPluginListMerger-BNmaoXQL.js.map +1 -0
- package/dist/CodemationPluginListMerger-BRYqEk0y.d.ts +793 -0
- package/dist/CodemationWhitelabelConfig-DgbjgtrR.d.ts +48 -0
- package/dist/ConsoleLogger-ClPU7jtc.js +35 -0
- package/dist/ConsoleLogger-ClPU7jtc.js.map +1 -0
- package/dist/CredentialServices-BKBGe7l3.js +1030 -0
- package/dist/CredentialServices-BKBGe7l3.js.map +1 -0
- package/dist/CredentialServices-DpDpm8mL.d.ts +291 -0
- package/dist/LogLevelPolicy-4cq9z0TI.d.ts +37 -0
- package/dist/PrismaMigrationDeployer-B1E_gYz7.js +8212 -0
- package/dist/PrismaMigrationDeployer-B1E_gYz7.js.map +1 -0
- package/dist/ServerLoggerFactory-BRHxIDS7.js +340 -0
- package/dist/ServerLoggerFactory-BRHxIDS7.js.map +1 -0
- package/dist/WorkflowViewContracts-DCLpTn25.d.ts +47 -0
- package/dist/chunk-7V6ThxGB.js +39 -0
- package/dist/client-Yh7-CQud.d.ts +21995 -0
- package/dist/client.d.ts +12 -0
- package/dist/client.js +15 -0
- package/dist/client.js.map +1 -0
- package/dist/consumer.d.ts +5 -0
- package/dist/consumer.js +7 -0
- package/dist/credentials.d.ts +50 -0
- package/dist/credentials.js +11 -0
- package/dist/credentials.js.map +1 -0
- package/dist/decorate-B-N_5S4p.js +10 -0
- package/dist/decorateParam-BTcc3KNk.js +15 -0
- package/dist/devServerSidecar.d.ts +52 -0
- package/dist/devServerSidecar.js +131 -0
- package/dist/devServerSidecar.js.map +1 -0
- package/dist/index-Bs4F1IsC.d.ts +1044 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +14 -0
- package/dist/nextServer.d.ts +89 -0
- package/dist/nextServer.js +127 -0
- package/dist/nextServer.js.map +1 -0
- package/dist/persistenceServer-K5eqlZm3.d.ts +36 -0
- package/dist/persistenceServer-W9uRw0dJ.js +19 -0
- package/dist/persistenceServer-W9uRw0dJ.js.map +1 -0
- package/dist/persistenceServer.d.ts +6 -0
- package/dist/persistenceServer.js +6 -0
- package/dist/server-BBdsATju.d.ts +132 -0
- package/dist/server-BiHSuA13.js +175 -0
- package/dist/server-BiHSuA13.js.map +1 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.js +13 -0
- package/package.json +152 -0
- package/playwright.config.ts +74 -0
- package/prisma/migrations/20260315063514_init/migration.sql +16 -0
- package/prisma/migrations/20260316090000_workflow_debugger_overlay/migration.sql +9 -0
- package/prisma/migrations/20260317120000_trigger_state_store/migration.sql +3 -0
- package/prisma/migrations/20260317153000_trigger_setup_state/migration.sql +8 -0
- package/prisma/migrations/20260318110000_credentials_v2/migration.sql +49 -0
- package/prisma/migrations/20260319110000_credential_oauth2_material/migration.sql +28 -0
- package/prisma/migrations/20260319200000_codemation_auth_tables/migration.sql +56 -0
- package/prisma/migrations/20260320140000_user_invites_account_status/migration.sql +20 -0
- package/prisma/migrations/20260325120000_workflow_activation/migration.sql +8 -0
- package/prisma/migrations/migration_lock.toml +3 -0
- package/prisma/schema.prisma +179 -0
- package/prisma.config.ts +12 -0
- package/scripts/ensure-prisma-runtime-sourcemaps.mjs +42 -0
- package/scripts/integration-database-global-setup.mjs +30 -0
- package/src/application/ApplicationRequestError.ts +12 -0
- package/src/application/auth/AuthenticatedPrincipal.ts +5 -0
- package/src/application/auth/SessionVerifier.ts +5 -0
- package/src/application/binary/OverlayPinnedBinaryUploadService.ts +119 -0
- package/src/application/binary/RunBinaryAttachmentLookupService.ts +139 -0
- package/src/application/binary/RunStateBinaryStorageKeysCollector.ts +57 -0
- package/src/application/bus/Command.ts +3 -0
- package/src/application/bus/CommandBus.ts +5 -0
- package/src/application/bus/CommandHandler.ts +5 -0
- package/src/application/bus/DomainEvent.ts +1 -0
- package/src/application/bus/DomainEventBus.ts +5 -0
- package/src/application/bus/DomainEventHandler.ts +5 -0
- package/src/application/bus/Query.ts +3 -0
- package/src/application/bus/QueryBus.ts +5 -0
- package/src/application/bus/QueryHandler.ts +5 -0
- package/src/application/commands/AcceptUserInviteCommand.ts +10 -0
- package/src/application/commands/AcceptUserInviteCommandHandler.ts +19 -0
- package/src/application/commands/CopyRunToWorkflowDebuggerCommand.ts +14 -0
- package/src/application/commands/CopyRunToWorkflowDebuggerCommandHandler.ts +56 -0
- package/src/application/commands/CreateCredentialInstanceCommand.ts +9 -0
- package/src/application/commands/CreateCredentialInstanceCommandHandler.ts +28 -0
- package/src/application/commands/CredentialCommandHandlers.ts +10 -0
- package/src/application/commands/DeleteCredentialInstanceCommand.ts +7 -0
- package/src/application/commands/DeleteCredentialInstanceCommandHandler.ts +27 -0
- package/src/application/commands/HandleWebhookInvocationCommand.ts +12 -0
- package/src/application/commands/HandleWebhookInvocationCommandHandler.ts +42 -0
- package/src/application/commands/InviteUserCommand.ts +12 -0
- package/src/application/commands/InviteUserCommandHandler.ts +22 -0
- package/src/application/commands/RegenerateUserInviteCommand.ts +12 -0
- package/src/application/commands/RegenerateUserInviteCommandHandler.ts +24 -0
- package/src/application/commands/ReplaceMutableRunWorkflowSnapshotCommand.ts +12 -0
- package/src/application/commands/ReplaceMutableRunWorkflowSnapshotCommandHandler.ts +47 -0
- package/src/application/commands/ReplaceWorkflowDebuggerOverlayCommand.ts +14 -0
- package/src/application/commands/ReplaceWorkflowDebuggerOverlayCommandHandler.ts +35 -0
- package/src/application/commands/ReplayWorkflowNodeCommand.ts +12 -0
- package/src/application/commands/ReplayWorkflowNodeCommandHandler.ts +164 -0
- package/src/application/commands/SetPinnedNodeInputCommand.ts +13 -0
- package/src/application/commands/SetPinnedNodeInputCommandHandler.ts +50 -0
- package/src/application/commands/SetWorkflowActivationCommand.ts +10 -0
- package/src/application/commands/SetWorkflowActivationCommandHandler.ts +39 -0
- package/src/application/commands/StartWorkflowRunCommand.ts +8 -0
- package/src/application/commands/StartWorkflowRunCommandHandler.ts +286 -0
- package/src/application/commands/TestCredentialInstanceCommand.ts +9 -0
- package/src/application/commands/TestCredentialInstanceCommandHandler.ts +28 -0
- package/src/application/commands/UpdateCredentialInstanceCommand.ts +12 -0
- package/src/application/commands/UpdateCredentialInstanceCommandHandler.ts +28 -0
- package/src/application/commands/UpdateUserAccountStatusCommand.ts +12 -0
- package/src/application/commands/UpdateUserAccountStatusCommandHandler.ts +24 -0
- package/src/application/commands/UploadOverlayPinnedBinaryCommand.ts +16 -0
- package/src/application/commands/UploadOverlayPinnedBinaryCommandHandler.ts +31 -0
- package/src/application/commands/UpsertCredentialBindingCommand.ts +11 -0
- package/src/application/commands/UpsertCredentialBindingCommandHandler.ts +28 -0
- package/src/application/commands/UpsertLocalBootstrapUserCommand.ts +12 -0
- package/src/application/commands/UpsertLocalBootstrapUserCommandHandler.ts +24 -0
- package/src/application/commands/UserAccountCommandHandlers.ts +10 -0
- package/src/application/contracts/CredentialContractsRegistry.ts +88 -0
- package/src/application/contracts/RunContracts.ts +41 -0
- package/src/application/contracts/WorkflowDebuggerContracts.ts +12 -0
- package/src/application/contracts/WorkflowViewContracts.ts +40 -0
- package/src/application/contracts/WorkflowWebsocketMessage.ts +8 -0
- package/src/application/contracts/userDirectoryContracts.types.ts +60 -0
- package/src/application/dev/BootRuntimeSnapshotHolder.ts +19 -0
- package/src/application/dev/BootRuntimeSummary.types.ts +11 -0
- package/src/application/dev/DevBootstrapSummaryAssembler.ts +84 -0
- package/src/application/dev/DevBootstrapSummaryJson.types.ts +9 -0
- package/src/application/logging/LogFilter.ts +7 -0
- package/src/application/logging/Logger.ts +10 -0
- package/src/application/mapping/DataMapper.ts +3 -0
- package/src/application/mapping/WorkflowDefinitionMapper.ts +171 -0
- package/src/application/mapping/WorkflowPolicyUiPresentationFactory.ts +39 -0
- package/src/application/queries/CredentialQueryHandlers.ts +12 -0
- package/src/application/queries/GetCredentialFieldEnvStatusQuery.ts +5 -0
- package/src/application/queries/GetCredentialFieldEnvStatusQueryHandler.ts +52 -0
- package/src/application/queries/GetCredentialInstanceQuery.ts +9 -0
- package/src/application/queries/GetCredentialInstanceQueryHandler.ts +27 -0
- package/src/application/queries/GetCredentialInstanceWithSecretsQuery.ts +9 -0
- package/src/application/queries/GetCredentialInstanceWithSecretsQueryHandler.ts +27 -0
- package/src/application/queries/GetRunBinaryAttachmentQuery.ts +11 -0
- package/src/application/queries/GetRunBinaryAttachmentQueryHandler.ts +23 -0
- package/src/application/queries/GetRunStateQuery.ts +8 -0
- package/src/application/queries/GetRunStateQueryHandler.ts +21 -0
- package/src/application/queries/GetWorkflowCredentialHealthQuery.ts +9 -0
- package/src/application/queries/GetWorkflowCredentialHealthQueryHandler.ts +27 -0
- package/src/application/queries/GetWorkflowDebuggerOverlayQuery.ts +8 -0
- package/src/application/queries/GetWorkflowDebuggerOverlayQueryHandler.ts +28 -0
- package/src/application/queries/GetWorkflowDetailQuery.ts +8 -0
- package/src/application/queries/GetWorkflowDetailQueryHandler.ts +24 -0
- package/src/application/queries/GetWorkflowOverlayBinaryAttachmentQuery.ts +11 -0
- package/src/application/queries/GetWorkflowOverlayBinaryAttachmentQueryHandler.ts +23 -0
- package/src/application/queries/GetWorkflowSummariesQuery.ts +4 -0
- package/src/application/queries/GetWorkflowSummariesQueryHandler.ts +23 -0
- package/src/application/queries/ListCredentialInstancesQuery.ts +5 -0
- package/src/application/queries/ListCredentialInstancesQueryHandler.ts +27 -0
- package/src/application/queries/ListCredentialTypesQuery.ts +5 -0
- package/src/application/queries/ListCredentialTypesQueryHandler.ts +28 -0
- package/src/application/queries/ListUserAccountsQuery.ts +5 -0
- package/src/application/queries/ListUserAccountsQueryHandler.ts +22 -0
- package/src/application/queries/ListWorkflowRunsQuery.ts +8 -0
- package/src/application/queries/ListWorkflowRunsQueryHandler.ts +21 -0
- package/src/application/queries/UserAccountQueryHandlers.ts +4 -0
- package/src/application/queries/VerifyUserInviteQuery.ts +9 -0
- package/src/application/queries/VerifyUserInviteQueryHandler.ts +21 -0
- package/src/application/runs/WorkflowRunRetentionPruneScheduler.ts +98 -0
- package/src/application/websocket/WorkflowRunEventWebsocketRelay.ts +36 -0
- package/src/application/websocket/WorkflowWebsocketPublisher.ts +5 -0
- package/src/application/workflows/WebhookEndpointPathValidator.ts +35 -0
- package/src/application/workflows/WorkflowDebuggerOverlayStateFactory.ts +122 -0
- package/src/applicationTokens.ts +72 -0
- package/src/bootstrap/CodemationBootstrapRequest.ts +27 -0
- package/src/bootstrap/CodemationContainerFactory.ts +310 -0
- package/src/bootstrap/CodemationContainerRegistration.ts +23 -0
- package/src/bootstrap/CodemationContainerRegistrationRegistrar.ts +42 -0
- package/src/bootstrap/CodemationFrontendBootstrapRequest.ts +16 -0
- package/src/bootstrap/CodemationWorkerBootstrapRequest.ts +19 -0
- package/src/bootstrap/PreparedCodemationRuntime.ts +37 -0
- package/src/bootstrap/PreparedCodemationRuntimeFactory.ts +308 -0
- package/src/bootstrap/boot/CliRuntimeBootService.ts +27 -0
- package/src/bootstrap/boot/FrontendRuntimeBootService.ts +86 -0
- package/src/bootstrap/boot/WorkerRuntimeBootService.ts +64 -0
- package/src/bootstrap/runtime/AppConfigFactory.ts +57 -0
- package/src/bootstrap/runtime/ResolvedImplementationSelectionFactory.ts +118 -0
- package/src/client.ts +3 -0
- package/src/codemationApplication.ts +311 -0
- package/src/consumer.ts +4 -0
- package/src/credentials.ts +24 -0
- package/src/devServerSidecar.ts +10 -0
- package/src/domain/credentials/CredentialBindingService.ts +139 -0
- package/src/domain/credentials/CredentialFieldEnvOverlayService.ts +60 -0
- package/src/domain/credentials/CredentialInstanceService.ts +391 -0
- package/src/domain/credentials/CredentialMaterialResolver.ts +55 -0
- package/src/domain/credentials/CredentialRuntimeMaterialService.ts +39 -0
- package/src/domain/credentials/CredentialSecretCipher.ts +70 -0
- package/src/domain/credentials/CredentialServices.ts +145 -0
- package/src/domain/credentials/CredentialSessionServiceImpl.ts +119 -0
- package/src/domain/credentials/CredentialTestService.ts +73 -0
- package/src/domain/credentials/CredentialTypeRegistryImpl.ts +29 -0
- package/src/domain/credentials/OAuth2ConnectServiceFactory.ts +396 -0
- package/src/domain/credentials/OAuth2ProviderRegistry.ts +75 -0
- package/src/domain/credentials/WorkflowCredentialNodeResolver.ts +246 -0
- package/src/domain/runs/WorkflowRunRepository.ts +11 -0
- package/src/domain/users/UserAccountServiceRegistry.ts +315 -0
- package/src/domain/users/userLoginMethodLabels.types.ts +29 -0
- package/src/domain/workflows/WorkflowActivationPreflight.ts +32 -0
- package/src/domain/workflows/WorkflowActivationPreflightRules.ts +77 -0
- package/src/domain/workflows/WorkflowActivationRepository.ts +9 -0
- package/src/domain/workflows/WorkflowDebuggerOverlayRepository.ts +7 -0
- package/src/domain/workflows/WorkflowDebuggerOverlayState.ts +8 -0
- package/src/domain/workflows/WorkflowDefinitionRepository.ts +11 -0
- package/src/index.ts +58 -0
- package/src/infrastructure/auth/AuthJsSessionVerifier.ts +26 -0
- package/src/infrastructure/auth/DevelopmentSessionBypassVerifier.ts +12 -0
- package/src/infrastructure/binary/BinaryBodyNodeReadableFactory.ts +22 -0
- package/src/infrastructure/binary/CountingSha256Transform.ts +26 -0
- package/src/infrastructure/binary/LocalFilesystemBinaryStorageRegistry.ts +86 -0
- package/src/infrastructure/config/CodemationPluginRegistrar.ts +44 -0
- package/src/infrastructure/credentials/FrameworkBuiltinCredentialTypesRegistrar.ts +21 -0
- package/src/infrastructure/credentials/OpenAiApiKeyCredentialHealthTester.ts +89 -0
- package/src/infrastructure/credentials/OpenAiApiKeyCredentialShapes.types.ts +15 -0
- package/src/infrastructure/credentials/OpenAiApiKeyCredentialTypeFactory.ts +47 -0
- package/src/infrastructure/di/HandlesCommandRegistry.ts +24 -0
- package/src/infrastructure/di/HandlesDomainEventRegistry.ts +24 -0
- package/src/infrastructure/di/HandlesQueryRegistry.ts +24 -0
- package/src/infrastructure/di/InMemoryCommandBus.ts +47 -0
- package/src/infrastructure/di/InMemoryDomainEventBus.ts +47 -0
- package/src/infrastructure/di/InMemoryQueryBus.ts +45 -0
- package/src/infrastructure/ids/CodemationIdFactory.ts +12 -0
- package/src/infrastructure/logging/BrowserLogger.ts +1 -0
- package/src/infrastructure/logging/BrowserLoggerFactory.ts +14 -0
- package/src/infrastructure/logging/ConsoleLogger.ts +41 -0
- package/src/infrastructure/logging/FilteringLogger.ts +38 -0
- package/src/infrastructure/logging/LogLevelPolicy.ts +148 -0
- package/src/infrastructure/logging/LogLevelPolicyFactory.ts +16 -0
- package/src/infrastructure/logging/PerformanceLogPolicy.ts +10 -0
- package/src/infrastructure/logging/PerformanceLogPolicyFactory.ts +14 -0
- package/src/infrastructure/logging/ServerLogger.ts +1 -0
- package/src/infrastructure/logging/ServerLoggerFactory.ts +28 -0
- package/src/infrastructure/persistence/CodemationPostgresPrismaClientFactory.ts +9 -0
- package/src/infrastructure/persistence/CredentialPersistenceStore.ts +139 -0
- package/src/infrastructure/persistence/DatabasePersistenceResolver.ts +91 -0
- package/src/infrastructure/persistence/InMemoryTriggerSetupStateRepository.ts +23 -0
- package/src/infrastructure/persistence/InMemoryWorkflowActivationRepository.ts +18 -0
- package/src/infrastructure/persistence/InMemoryWorkflowDebuggerOverlayRepository.ts +16 -0
- package/src/infrastructure/persistence/InMemoryWorkflowRunRepository.ts +94 -0
- package/src/infrastructure/persistence/PrismaClientFactory.ts +26 -0
- package/src/infrastructure/persistence/PrismaCredentialStore.ts +368 -0
- package/src/infrastructure/persistence/PrismaMigrationDeployer.ts +184 -0
- package/src/infrastructure/persistence/PrismaTriggerSetupStateRepository.ts +68 -0
- package/src/infrastructure/persistence/PrismaWorkflowActivationRepository.ts +36 -0
- package/src/infrastructure/persistence/PrismaWorkflowDebuggerOverlayRepository.ts +65 -0
- package/src/infrastructure/persistence/PrismaWorkflowRunRepository.ts +243 -0
- package/src/infrastructure/persistence/RuntimeWorkflowActivationPolicy.ts +27 -0
- package/src/infrastructure/persistence/SchedulerPersistenceCompatibilityValidator.ts +20 -0
- package/src/infrastructure/persistence/WorkflowDefinitionRepositoryAdapter.ts +31 -0
- package/src/infrastructure/persistence/WorkflowRunRepository.ts +46 -0
- package/src/infrastructure/persistence/generated/prisma/client.d.ts +1 -0
- package/src/infrastructure/persistence/generated/prisma/default.d.ts +1 -0
- package/src/infrastructure/persistence/generated/prisma/edge.d.ts +1 -0
- package/src/infrastructure/persistence/generated/prisma/index.d.ts +4766 -0
- package/src/infrastructure/persistence/generated/prisma/package.json +144 -0
- package/src/infrastructure/persistence/generated/prisma/query_compiler_fast_bg.wasm +0 -0
- package/src/infrastructure/persistence/generated/prisma/runtime/client.d.ts +3358 -0
- package/src/infrastructure/persistence/generated/prisma/runtime/index-browser.d.ts +90 -0
- package/src/infrastructure/persistence/generated/prisma/schema.prisma +35 -0
- package/src/infrastructure/persistence/generated/prisma/wasm-edge-light-loader.mjs +5 -0
- package/src/infrastructure/persistence/generated/prisma/wasm-worker-loader.mjs +5 -0
- package/src/infrastructure/persistence/generated/prisma-client/client.d.ts +1 -0
- package/src/infrastructure/persistence/generated/prisma-client/client.js +5 -0
- package/src/infrastructure/persistence/generated/prisma-client/default.d.ts +1 -0
- package/src/infrastructure/persistence/generated/prisma-client/default.js +5 -0
- package/src/infrastructure/persistence/generated/prisma-client/edge.d.ts +1 -0
- package/src/infrastructure/persistence/generated/prisma-client/edge.js +299 -0
- package/src/infrastructure/persistence/generated/prisma-client/index-browser.js +325 -0
- package/src/infrastructure/persistence/generated/prisma-client/index.d.ts +21623 -0
- package/src/infrastructure/persistence/generated/prisma-client/index.js +299 -0
- package/src/infrastructure/persistence/generated/prisma-client/package.json +144 -0
- package/src/infrastructure/persistence/generated/prisma-client/query_compiler_fast_bg.js +2 -0
- package/src/infrastructure/persistence/generated/prisma-client/query_compiler_fast_bg.wasm +0 -0
- package/src/infrastructure/persistence/generated/prisma-client/query_compiler_fast_bg.wasm-base64.js +2 -0
- package/src/infrastructure/persistence/generated/prisma-client/runtime/client.d.ts +3358 -0
- package/src/infrastructure/persistence/generated/prisma-client/runtime/client.js +86 -0
- package/src/infrastructure/persistence/generated/prisma-client/runtime/client.js.map +1 -0
- package/src/infrastructure/persistence/generated/prisma-client/runtime/index-browser.d.ts +90 -0
- package/src/infrastructure/persistence/generated/prisma-client/runtime/index-browser.js +6 -0
- package/src/infrastructure/persistence/generated/prisma-client/runtime/index-browser.js.map +1 -0
- package/src/infrastructure/persistence/generated/prisma-client/runtime/wasm-compiler-edge.js +76 -0
- package/src/infrastructure/persistence/generated/prisma-client/runtime/wasm-compiler-edge.js.map +1 -0
- package/src/infrastructure/persistence/generated/prisma-client/schema.prisma +179 -0
- package/src/infrastructure/persistence/generated/prisma-client/wasm-edge-light-loader.mjs +5 -0
- package/src/infrastructure/persistence/generated/prisma-client/wasm-worker-loader.mjs +5 -0
- package/src/infrastructure/runtime/LiveWorkflowRepository.ts +14 -0
- package/src/infrastructure/runtime/WorkerRuntimeScheduler.ts +35 -0
- package/src/infrastructure/server/http/ServerHttpRouteParams.ts +1 -0
- package/src/infrastructure/webhooks/RequestToWebhookItemMapper.ts +128 -0
- package/src/nextServer.ts +31 -0
- package/src/persistenceServer.ts +5 -0
- package/src/presentation/config/AppConfig.ts +25 -0
- package/src/presentation/config/CodemationAppContext.ts +19 -0
- package/src/presentation/config/CodemationApplicationFacade.ts +5 -0
- package/src/presentation/config/CodemationAuthConfig.ts +31 -0
- package/src/presentation/config/CodemationClassToken.ts +3 -0
- package/src/presentation/config/CodemationConfig.ts +86 -0
- package/src/presentation/config/CodemationConfigNormalizer.ts +179 -0
- package/src/presentation/config/CodemationLogConfig.ts +22 -0
- package/src/presentation/config/CodemationPackageManifest.ts +9 -0
- package/src/presentation/config/CodemationPlugin.ts +20 -0
- package/src/presentation/config/CodemationPluginListMerger.ts +46 -0
- package/src/presentation/config/CodemationWhitelabelConfig.ts +9 -0
- package/src/presentation/config/CodemationWorkflowDiscovery.ts +3 -0
- package/src/presentation/http/ApiPaths.ts +165 -0
- package/src/presentation/http/CodemationServerGatewayFactory.ts +120 -0
- package/src/presentation/http/HttpRequestJsonBodyReader.ts +12 -0
- package/src/presentation/http/ServerHttpErrorResponseFactory.ts +33 -0
- package/src/presentation/http/ServerHttpRouteParams.ts +1 -0
- package/src/presentation/http/hono/CodemationHonoApiAppFactory.ts +64 -0
- package/src/presentation/http/hono/HonoApiRouteRegistrar.ts +5 -0
- package/src/presentation/http/hono/HonoHttpAnonymousRoutePolicyRegistry.ts +27 -0
- package/src/presentation/http/hono/registrars/BinaryHonoApiRouteRegistrar.ts +21 -0
- package/src/presentation/http/hono/registrars/CredentialHonoApiRouteRegistrar.ts +34 -0
- package/src/presentation/http/hono/registrars/DevHonoApiRouteRegistrar.ts +17 -0
- package/src/presentation/http/hono/registrars/OAuth2HonoApiRouteRegistrar.ts +18 -0
- package/src/presentation/http/hono/registrars/RunHonoApiRouteRegistrar.ts +31 -0
- package/src/presentation/http/hono/registrars/UserHonoApiRouteRegistrar.ts +24 -0
- package/src/presentation/http/hono/registrars/WebhookHonoApiRouteRegistrar.ts +23 -0
- package/src/presentation/http/hono/registrars/WhitelabelHonoApiRouteRegistrar.ts +18 -0
- package/src/presentation/http/hono/registrars/WorkflowHonoApiRouteRegistrar.ts +33 -0
- package/src/presentation/http/routeHandlers/BinaryHttpRouteHandlerFactory.ts +101 -0
- package/src/presentation/http/routeHandlers/CredentialHttpRouteHandler.ts +129 -0
- package/src/presentation/http/routeHandlers/DevBootstrapSummaryHttpRouteHandler.ts +21 -0
- package/src/presentation/http/routeHandlers/OAuth2HttpRouteHandlerFactory.ts +129 -0
- package/src/presentation/http/routeHandlers/RunHttpRouteHandler.ts +82 -0
- package/src/presentation/http/routeHandlers/UserHttpRouteHandlerFactory.ts +109 -0
- package/src/presentation/http/routeHandlers/WebhookHttpRouteHandler.ts +42 -0
- package/src/presentation/http/routeHandlers/WhitelabelLogoHttpRouteHandler.ts +96 -0
- package/src/presentation/http/routeHandlers/WorkflowHttpRouteHandler.ts +104 -0
- package/src/presentation/server/CodemationConsumerAppResolver.ts +82 -0
- package/src/presentation/server/CodemationConsumerConfigExportsResolver.ts +33 -0
- package/src/presentation/server/CodemationConsumerConfigLoader.ts +270 -0
- package/src/presentation/server/CodemationPluginDiscovery.ts +151 -0
- package/src/presentation/server/CodemationTsyringeParamInfoReader.ts +26 -0
- package/src/presentation/server/CodemationTsyringeTypeInfoRegistrar.ts +121 -0
- package/src/presentation/server/DevelopmentRuntimeRouteGuard.ts +59 -0
- package/src/presentation/server/DiscoveredWorkflowsEmptyMessageFactory.ts +11 -0
- package/src/presentation/server/WorkflowDefinitionExportsResolver.ts +24 -0
- package/src/presentation/server/WorkflowDiscoveryPathSegmentsComputer.ts +53 -0
- package/src/presentation/server/WorkflowModulePathFinder.ts +47 -0
- package/src/presentation/websocket/WorkflowWebsocketServer.ts +169 -0
- package/src/server.ts +14 -0
- package/tsconfig.json +10 -0
- package/vitest.shared.ts +45 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
generator client {
|
|
2
|
+
provider = "prisma-client-js"
|
|
3
|
+
output = "../src/infrastructure/persistence/generated/prisma-client"
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
datasource db {
|
|
7
|
+
provider = "postgresql"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
model Run {
|
|
11
|
+
runId String @id @map("run_id")
|
|
12
|
+
workflowId String @map("workflow_id")
|
|
13
|
+
startedAt String @map("started_at")
|
|
14
|
+
status String
|
|
15
|
+
parentJson String? @map("parent_json")
|
|
16
|
+
executionOptionsJson String? @map("execution_options_json")
|
|
17
|
+
updatedAt String @map("updated_at")
|
|
18
|
+
stateJson String @map("state_json")
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
model WorkflowDebuggerOverlay {
|
|
22
|
+
workflowId String @id @map("workflow_id")
|
|
23
|
+
updatedAt String @map("updated_at")
|
|
24
|
+
copiedFromRunId String? @map("copied_from_run_id")
|
|
25
|
+
stateJson String @map("state_json")
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
model WorkflowActivation {
|
|
29
|
+
workflowId String @id @map("workflow_id")
|
|
30
|
+
isActive Boolean @default(false) @map("is_active")
|
|
31
|
+
updatedAt String @map("updated_at")
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
model TriggerSetupState {
|
|
35
|
+
workflowId String @map("workflow_id")
|
|
36
|
+
nodeId String @map("node_id")
|
|
37
|
+
updatedAt String @map("updated_at")
|
|
38
|
+
stateJson String @map("state_json")
|
|
39
|
+
|
|
40
|
+
@@id([workflowId, nodeId])
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
model CredentialInstance {
|
|
44
|
+
instanceId String @id @map("instance_id")
|
|
45
|
+
typeId String @map("type_id")
|
|
46
|
+
displayName String @map("display_name")
|
|
47
|
+
sourceKind String @map("source_kind")
|
|
48
|
+
publicConfigJson String @map("public_config_json")
|
|
49
|
+
secretRefJson String @map("secret_ref_json")
|
|
50
|
+
tagsJson String @map("tags_json")
|
|
51
|
+
setupStatus String @map("setup_status")
|
|
52
|
+
createdAt String @map("created_at")
|
|
53
|
+
updatedAt String @map("updated_at")
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
model CredentialSecretMaterial {
|
|
57
|
+
instanceId String @id @map("instance_id")
|
|
58
|
+
encryptedJson String @map("encrypted_json")
|
|
59
|
+
encryptionKeyId String @map("encryption_key_id")
|
|
60
|
+
schemaVersion Int @map("schema_version")
|
|
61
|
+
updatedAt String @map("updated_at")
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
model CredentialOAuth2Material {
|
|
65
|
+
instanceId String @id @map("instance_id")
|
|
66
|
+
encryptedJson String @map("encrypted_json")
|
|
67
|
+
encryptionKeyId String @map("encryption_key_id")
|
|
68
|
+
schemaVersion Int @map("schema_version")
|
|
69
|
+
providerId String @map("provider_id")
|
|
70
|
+
connectedEmail String? @map("connected_email")
|
|
71
|
+
connectedAt String? @map("connected_at")
|
|
72
|
+
scopesJson String @map("scopes_json")
|
|
73
|
+
updatedAt String @map("updated_at")
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
model CredentialOAuth2State {
|
|
77
|
+
state String @id
|
|
78
|
+
instanceId String @map("instance_id")
|
|
79
|
+
codeVerifier String? @map("code_verifier")
|
|
80
|
+
providerId String? @map("provider_id")
|
|
81
|
+
requestedScopesJson String @map("requested_scopes_json")
|
|
82
|
+
createdAt String @map("created_at")
|
|
83
|
+
expiresAt String @map("expires_at")
|
|
84
|
+
|
|
85
|
+
@@index([instanceId])
|
|
86
|
+
@@index([expiresAt])
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
model CredentialBinding {
|
|
90
|
+
workflowId String @map("workflow_id")
|
|
91
|
+
nodeId String @map("node_id")
|
|
92
|
+
slotKey String @map("slot_key")
|
|
93
|
+
instanceId String @map("instance_id")
|
|
94
|
+
updatedAt String @map("updated_at")
|
|
95
|
+
|
|
96
|
+
@@id([workflowId, nodeId, slotKey])
|
|
97
|
+
@@index([instanceId])
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
model CredentialTestResult {
|
|
101
|
+
testId String @id @map("test_id")
|
|
102
|
+
instanceId String @map("instance_id")
|
|
103
|
+
status String
|
|
104
|
+
message String?
|
|
105
|
+
detailsJson String @map("details_json")
|
|
106
|
+
testedAt String @map("tested_at")
|
|
107
|
+
expiresAt String? @map("expires_at")
|
|
108
|
+
|
|
109
|
+
@@index([instanceId, testedAt])
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/// Auth.js / NextAuth user directory (JWT sessions; optional OAuth linking)
|
|
113
|
+
model User {
|
|
114
|
+
id String @id @default(cuid())
|
|
115
|
+
name String?
|
|
116
|
+
email String? @unique
|
|
117
|
+
emailVerified DateTime? @map("email_verified")
|
|
118
|
+
image String?
|
|
119
|
+
passwordHash String? @map("password_hash")
|
|
120
|
+
/// invited | active | inactive (local directory / invite flow)
|
|
121
|
+
accountStatus String @default("active") @map("account_status")
|
|
122
|
+
accounts Account[]
|
|
123
|
+
sessions Session[]
|
|
124
|
+
invites UserInvite[]
|
|
125
|
+
|
|
126
|
+
@@map("codemation_auth_user")
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
model UserInvite {
|
|
130
|
+
id String @id @default(cuid())
|
|
131
|
+
userId String @map("user_id")
|
|
132
|
+
tokenHash String @unique @map("token_hash")
|
|
133
|
+
expiresAt DateTime @map("expires_at")
|
|
134
|
+
createdAt DateTime @map("created_at")
|
|
135
|
+
revokedAt DateTime? @map("revoked_at")
|
|
136
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
137
|
+
|
|
138
|
+
@@index([userId])
|
|
139
|
+
@@map("codemation_auth_user_invite")
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
model Account {
|
|
143
|
+
id String @id @default(cuid())
|
|
144
|
+
userId String @map("user_id")
|
|
145
|
+
type String
|
|
146
|
+
provider String
|
|
147
|
+
providerAccountId String @map("provider_account_id")
|
|
148
|
+
refresh_token String? @db.Text
|
|
149
|
+
access_token String? @db.Text
|
|
150
|
+
expires_at Int?
|
|
151
|
+
token_type String?
|
|
152
|
+
scope String? @db.Text
|
|
153
|
+
id_token String? @db.Text
|
|
154
|
+
session_state String?
|
|
155
|
+
|
|
156
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
157
|
+
|
|
158
|
+
@@unique([provider, providerAccountId])
|
|
159
|
+
@@map("codemation_auth_account")
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
model Session {
|
|
163
|
+
id String @id @default(cuid())
|
|
164
|
+
sessionToken String @unique @map("session_token")
|
|
165
|
+
userId String @map("user_id")
|
|
166
|
+
expires DateTime
|
|
167
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
168
|
+
|
|
169
|
+
@@map("codemation_auth_session")
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
model VerificationToken {
|
|
173
|
+
identifier String
|
|
174
|
+
token String
|
|
175
|
+
expires DateTime
|
|
176
|
+
|
|
177
|
+
@@unique([identifier, token])
|
|
178
|
+
@@map("codemation_auth_verification_token")
|
|
179
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { WorkflowDefinition } from "@codemation/core";
|
|
2
|
+
import { InMemoryLiveWorkflowRepository } from "@codemation/core";
|
|
3
|
+
import type { AIAgentConnectionWorkflowExpander } from "@codemation/core-nodes";
|
|
4
|
+
|
|
5
|
+
/** Host-owned mutable workflow repository; expands AI agent connections before registration. */
|
|
6
|
+
export class LiveWorkflowRepository extends InMemoryLiveWorkflowRepository {
|
|
7
|
+
constructor(private readonly connectionExpander: AIAgentConnectionWorkflowExpander) {
|
|
8
|
+
super();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
setWorkflows(workflows: ReadonlyArray<WorkflowDefinition>): void {
|
|
12
|
+
super.setWorkflows(workflows.map((workflow) => this.connectionExpander.expand(workflow)));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
BinaryStorage,
|
|
3
|
+
CredentialSessionService,
|
|
4
|
+
EngineExecutionLimitsPolicy,
|
|
5
|
+
NodeActivationContinuation,
|
|
6
|
+
NodeExecutionScheduler,
|
|
7
|
+
NodeResolver,
|
|
8
|
+
WorkflowExecutionRepository,
|
|
9
|
+
WorkflowDefinition,
|
|
10
|
+
WorkflowId,
|
|
11
|
+
} from "@codemation/core";
|
|
12
|
+
|
|
13
|
+
export type WorkerRuntimeHandle = Readonly<{
|
|
14
|
+
stop: () => Promise<void>;
|
|
15
|
+
}>;
|
|
16
|
+
|
|
17
|
+
export interface WorkerRuntimeScheduler extends NodeExecutionScheduler {
|
|
18
|
+
createWorker(
|
|
19
|
+
args: Readonly<{
|
|
20
|
+
queues: ReadonlyArray<string>;
|
|
21
|
+
workflowsById: ReadonlyMap<WorkflowId, WorkflowDefinition>;
|
|
22
|
+
nodeResolver: NodeResolver;
|
|
23
|
+
credentialSessions: CredentialSessionService;
|
|
24
|
+
workflowExecutionRepository: WorkflowExecutionRepository;
|
|
25
|
+
continuation: NodeActivationContinuation;
|
|
26
|
+
binaryStorage?: BinaryStorage;
|
|
27
|
+
workflows?: unknown;
|
|
28
|
+
now?: () => Date;
|
|
29
|
+
/** When set, must match the host engine policy so worker execution contexts use the same limits as `runtime.engineExecutionLimits`. */
|
|
30
|
+
executionLimitsPolicy?: EngineExecutionLimitsPolicy;
|
|
31
|
+
}>,
|
|
32
|
+
): WorkerRuntimeHandle;
|
|
33
|
+
|
|
34
|
+
close(): Promise<void>;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ServerHttpRouteParams } from "../../../presentation/http/ServerHttpRouteParams";
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ActivationIdFactory,
|
|
3
|
+
BinaryAttachment,
|
|
4
|
+
BinaryBody,
|
|
5
|
+
BinaryStorage,
|
|
6
|
+
Item,
|
|
7
|
+
ItemBinary,
|
|
8
|
+
RunIdFactory,
|
|
9
|
+
WebhookInvocationMatch,
|
|
10
|
+
} from "@codemation/core";
|
|
11
|
+
import { CoreTokens, DefaultExecutionBinaryService, inject, injectable } from "@codemation/core";
|
|
12
|
+
|
|
13
|
+
@injectable()
|
|
14
|
+
export class RequestToWebhookItemMapper {
|
|
15
|
+
constructor(
|
|
16
|
+
@inject(CoreTokens.BinaryStorage)
|
|
17
|
+
private readonly binaryStorage: BinaryStorage,
|
|
18
|
+
@inject(CoreTokens.RunIdFactory)
|
|
19
|
+
private readonly runIdFactory: RunIdFactory,
|
|
20
|
+
@inject(CoreTokens.ActivationIdFactory)
|
|
21
|
+
private readonly activationIdFactory: ActivationIdFactory,
|
|
22
|
+
) {}
|
|
23
|
+
|
|
24
|
+
async map(request: Request, match: WebhookInvocationMatch): Promise<Item> {
|
|
25
|
+
const url = new URL(request.url);
|
|
26
|
+
const contentType = request.headers.get("content-type") ?? "";
|
|
27
|
+
if (contentType.toLowerCase().includes("multipart/form-data")) {
|
|
28
|
+
return await this.mapMultipart(request, match, url);
|
|
29
|
+
}
|
|
30
|
+
const bodyText = await request.text();
|
|
31
|
+
const parsedJsonBody = this.parseJsonBody(bodyText, request, match.parseJsonBody);
|
|
32
|
+
const body = parsedJsonBody.didParse ? parsedJsonBody.raw : this.resolveBody(bodyText);
|
|
33
|
+
const json = parsedJsonBody.didParse ? parsedJsonBody.value : undefined;
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
json: {
|
|
37
|
+
headers: this.toHeaders(request),
|
|
38
|
+
...(body === undefined ? {} : { body }),
|
|
39
|
+
...(json === undefined ? {} : { json }),
|
|
40
|
+
method: request.method.toUpperCase(),
|
|
41
|
+
url: request.url,
|
|
42
|
+
query: this.toQuery(url),
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private async mapMultipart(request: Request, match: WebhookInvocationMatch, url: URL): Promise<Item> {
|
|
48
|
+
const formData = await request.formData();
|
|
49
|
+
const ingressRunId = `webhook-ingress-${this.runIdFactory.makeRunId()}`;
|
|
50
|
+
const ingressActivationId = `webhook-ingress-${this.activationIdFactory.makeActivationId()}`;
|
|
51
|
+
const binaryService = new DefaultExecutionBinaryService(
|
|
52
|
+
this.binaryStorage,
|
|
53
|
+
match.workflowId,
|
|
54
|
+
ingressRunId,
|
|
55
|
+
() => new Date(),
|
|
56
|
+
);
|
|
57
|
+
const nodeBinary = binaryService.forNode({
|
|
58
|
+
nodeId: match.nodeId,
|
|
59
|
+
activationId: ingressActivationId,
|
|
60
|
+
});
|
|
61
|
+
const formFields: Record<string, string> = {};
|
|
62
|
+
const binaryParts: Record<string, BinaryAttachment> = {};
|
|
63
|
+
for (const [key, value] of formData as unknown as Iterable<[string, string | File]>) {
|
|
64
|
+
if (value instanceof File) {
|
|
65
|
+
const attachment = await nodeBinary.attach({
|
|
66
|
+
name: key,
|
|
67
|
+
body: value.stream() as BinaryBody,
|
|
68
|
+
mimeType: value.type || "application/octet-stream",
|
|
69
|
+
filename: value.name,
|
|
70
|
+
});
|
|
71
|
+
binaryParts[key] = attachment;
|
|
72
|
+
} else {
|
|
73
|
+
formFields[key] = value;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const binary: ItemBinary | undefined = Object.keys(binaryParts).length > 0 ? binaryParts : undefined;
|
|
77
|
+
return {
|
|
78
|
+
json: {
|
|
79
|
+
headers: this.toHeaders(request),
|
|
80
|
+
method: request.method.toUpperCase(),
|
|
81
|
+
url: request.url,
|
|
82
|
+
query: this.toQuery(url),
|
|
83
|
+
formFields,
|
|
84
|
+
},
|
|
85
|
+
binary,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private parseJsonBody(
|
|
90
|
+
bodyText: string,
|
|
91
|
+
request: Request,
|
|
92
|
+
parseJsonBody: ((body: unknown) => unknown) | undefined,
|
|
93
|
+
): Readonly<{ didParse: boolean; raw?: unknown; value?: unknown }> {
|
|
94
|
+
if (!bodyText) return { didParse: false };
|
|
95
|
+
if (!parseJsonBody && !this.isJsonRequest(request)) return { didParse: false };
|
|
96
|
+
|
|
97
|
+
const raw = JSON.parse(bodyText) as unknown;
|
|
98
|
+
return {
|
|
99
|
+
didParse: true,
|
|
100
|
+
raw,
|
|
101
|
+
value: parseJsonBody ? parseJsonBody(raw) : raw,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
private isJsonRequest(request: Request): boolean {
|
|
106
|
+
return request.headers.get("content-type")?.toLowerCase().includes("application/json") ?? false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private resolveBody(bodyText: string): string | undefined {
|
|
110
|
+
return bodyText ? bodyText : undefined;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private toHeaders(request: Request): Record<string, string> {
|
|
114
|
+
const headers: Record<string, string> = {};
|
|
115
|
+
request.headers.forEach((value, key) => {
|
|
116
|
+
headers[key] = value;
|
|
117
|
+
});
|
|
118
|
+
return headers;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
private toQuery(url: URL): Record<string, string> {
|
|
122
|
+
const query: Record<string, string> = {};
|
|
123
|
+
url.searchParams.forEach((value, key) => {
|
|
124
|
+
query[key] = value;
|
|
125
|
+
});
|
|
126
|
+
return query;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type { DevBootstrapSummaryJson } from "./application/dev/DevBootstrapSummaryJson.types";
|
|
2
|
+
export type { LogFilter } from "./application/logging/LogFilter";
|
|
3
|
+
export type { Logger, LoggerFactory } from "./application/logging/Logger";
|
|
4
|
+
export { FilteringLogger } from "./infrastructure/logging/FilteringLogger";
|
|
5
|
+
export { logLevelPolicyFactory, LogLevelPolicyFactory } from "./infrastructure/logging/LogLevelPolicyFactory";
|
|
6
|
+
export { PerformanceLogPolicy } from "./infrastructure/logging/PerformanceLogPolicy";
|
|
7
|
+
export {
|
|
8
|
+
performanceLogPolicyFactory,
|
|
9
|
+
PerformanceLogPolicyFactory,
|
|
10
|
+
} from "./infrastructure/logging/PerformanceLogPolicyFactory";
|
|
11
|
+
export { ServerLoggerFactory } from "./infrastructure/logging/ServerLoggerFactory";
|
|
12
|
+
export { RunBinaryAttachmentLookupService } from "./application/binary/RunBinaryAttachmentLookupService";
|
|
13
|
+
export { WorkflowDefinitionMapper } from "./application/mapping/WorkflowDefinitionMapper";
|
|
14
|
+
export { WorkflowPolicyUiPresentationFactory } from "./application/mapping/WorkflowPolicyUiPresentationFactory";
|
|
15
|
+
export { WorkflowRunRetentionPruneScheduler } from "./application/runs/WorkflowRunRetentionPruneScheduler";
|
|
16
|
+
export { ApplicationTokens } from "./applicationTokens";
|
|
17
|
+
export { CodemationApplication } from "./codemationApplication";
|
|
18
|
+
export { CodemationBootstrapRequest } from "./bootstrap/CodemationBootstrapRequest";
|
|
19
|
+
export { CodemationFrontendBootstrapRequest } from "./bootstrap/CodemationFrontendBootstrapRequest";
|
|
20
|
+
export { CodemationWorkerBootstrapRequest } from "./bootstrap/CodemationWorkerBootstrapRequest";
|
|
21
|
+
export { CodemationPluginListMerger } from "./presentation/config/CodemationPluginListMerger";
|
|
22
|
+
export { CredentialBindingService, CredentialInstanceService } from "./domain/credentials/CredentialServices";
|
|
23
|
+
export { RequestToWebhookItemMapper } from "./infrastructure/webhooks/RequestToWebhookItemMapper";
|
|
24
|
+
export { CodemationHonoApiApp } from "./presentation/http/hono/CodemationHonoApiAppFactory";
|
|
25
|
+
export { BinaryHttpRouteHandler } from "./presentation/http/routeHandlers/BinaryHttpRouteHandlerFactory";
|
|
26
|
+
export { CredentialHttpRouteHandler } from "./presentation/http/routeHandlers/CredentialHttpRouteHandler";
|
|
27
|
+
export { OAuth2HttpRouteHandler } from "./presentation/http/routeHandlers/OAuth2HttpRouteHandlerFactory";
|
|
28
|
+
export { RunHttpRouteHandler } from "./presentation/http/routeHandlers/RunHttpRouteHandler";
|
|
29
|
+
export { WebhookHttpRouteHandler } from "./presentation/http/routeHandlers/WebhookHttpRouteHandler";
|
|
30
|
+
export { WorkflowHttpRouteHandler } from "./presentation/http/routeHandlers/WorkflowHttpRouteHandler";
|
|
31
|
+
export { WorkflowWebsocketServer } from "./presentation/websocket/WorkflowWebsocketServer";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { CodemationPostgresPrismaClientFactory } from "./infrastructure/persistence/CodemationPostgresPrismaClientFactory";
|
|
2
|
+
export { DatabasePersistenceResolver } from "./infrastructure/persistence/DatabasePersistenceResolver";
|
|
3
|
+
export type { ResolvedDatabasePersistence } from "./infrastructure/persistence/DatabasePersistenceResolver";
|
|
4
|
+
export { PrismaMigrationDeployer } from "./infrastructure/persistence/PrismaMigrationDeployer";
|
|
5
|
+
export { PrismaClient } from "./infrastructure/persistence/generated/prisma-client/client.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CodemationDatabaseConfig, CodemationEventBusKind, CodemationSchedulerKind } from "./CodemationConfig";
|
|
2
|
+
import type { CodemationAuthConfig } from "./CodemationAuthConfig";
|
|
3
|
+
import type { CodemationWhitelabelConfig } from "./CodemationWhitelabelConfig";
|
|
4
|
+
|
|
5
|
+
export interface AppConfig {
|
|
6
|
+
readonly consumerRoot: string;
|
|
7
|
+
readonly repoRoot: string;
|
|
8
|
+
readonly env: Readonly<NodeJS.ProcessEnv>;
|
|
9
|
+
readonly workflowSources: ReadonlyArray<string>;
|
|
10
|
+
readonly databaseUrl?: string;
|
|
11
|
+
readonly database?: CodemationDatabaseConfig;
|
|
12
|
+
readonly scheduler: Readonly<{
|
|
13
|
+
kind: CodemationSchedulerKind;
|
|
14
|
+
queuePrefix?: string;
|
|
15
|
+
workerQueues: ReadonlyArray<string>;
|
|
16
|
+
redisUrl?: string;
|
|
17
|
+
}>;
|
|
18
|
+
readonly eventing: Readonly<{
|
|
19
|
+
kind: CodemationEventBusKind;
|
|
20
|
+
queuePrefix?: string;
|
|
21
|
+
redisUrl?: string;
|
|
22
|
+
}>;
|
|
23
|
+
readonly auth?: CodemationAuthConfig;
|
|
24
|
+
readonly whitelabel: CodemationWhitelabelConfig;
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AnyCredentialType, Container, TypeToken, WorkflowDefinition } from "@codemation/core";
|
|
2
|
+
import type { AppConfig } from "./AppConfig";
|
|
3
|
+
import type { CodemationClassToken } from "./CodemationClassToken";
|
|
4
|
+
|
|
5
|
+
export interface CodemationRegistrationContextBase {
|
|
6
|
+
readonly appConfig?: AppConfig;
|
|
7
|
+
|
|
8
|
+
registerCredentialType(type: AnyCredentialType): void;
|
|
9
|
+
registerNode<TValue>(token: TypeToken<TValue>, implementation?: CodemationClassToken<TValue>): void;
|
|
10
|
+
registerValue<TValue>(token: TypeToken<TValue>, value: TValue): void;
|
|
11
|
+
registerClass<TValue>(token: TypeToken<TValue>, implementation: CodemationClassToken<TValue>): void;
|
|
12
|
+
registerFactory<TValue>(token: TypeToken<TValue>, factory: (container: Container) => TValue): void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface CodemationAppContext extends CodemationRegistrationContextBase {
|
|
16
|
+
registerWorkflow(workflow: WorkflowDefinition): void;
|
|
17
|
+
registerWorkflows(workflows: ReadonlyArray<WorkflowDefinition>): void;
|
|
18
|
+
discoverWorkflows(...directories: ReadonlyArray<string>): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consumer-declared authentication profile for the hosted UI + HTTP API.
|
|
3
|
+
* NextAuth / Auth.js wires concrete providers from this configuration plus environment secrets.
|
|
4
|
+
*/
|
|
5
|
+
export type CodemationAuthKind = "local" | "oauth" | "oidc";
|
|
6
|
+
|
|
7
|
+
export interface CodemationAuthOAuthProviderConfig {
|
|
8
|
+
readonly provider: "google" | "github" | "microsoft-entra-id";
|
|
9
|
+
readonly clientIdEnv: string;
|
|
10
|
+
readonly clientSecretEnv: string;
|
|
11
|
+
/** Microsoft Entra ID tenant; environment variable name whose value is the tenant ID. */
|
|
12
|
+
readonly tenantIdEnv?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface CodemationAuthOidcProviderConfig {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly issuer: string;
|
|
18
|
+
readonly clientIdEnv: string;
|
|
19
|
+
readonly clientSecretEnv: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface CodemationAuthConfig {
|
|
23
|
+
readonly kind: CodemationAuthKind;
|
|
24
|
+
/**
|
|
25
|
+
* When true and NODE_ENV is not production, the API accepts requests without a real session
|
|
26
|
+
* (synthetic principal only — never honored in production).
|
|
27
|
+
*/
|
|
28
|
+
readonly allowUnauthenticatedInDevelopment?: boolean;
|
|
29
|
+
readonly oauth?: ReadonlyArray<CodemationAuthOAuthProviderConfig>;
|
|
30
|
+
readonly oidc?: ReadonlyArray<CodemationAuthOidcProviderConfig>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { AnyCredentialType, EngineExecutionLimitsPolicyConfig, WorkflowDefinition } from "@codemation/core";
|
|
2
|
+
import type { CodemationAuthConfig } from "./CodemationAuthConfig";
|
|
3
|
+
import type { CodemationAppContext } from "./CodemationAppContext";
|
|
4
|
+
import type { CodemationPlugin } from "./CodemationPlugin";
|
|
5
|
+
import type { CodemationLogConfig } from "./CodemationLogConfig";
|
|
6
|
+
import type { CodemationWhitelabelConfig } from "./CodemationWhitelabelConfig";
|
|
7
|
+
import type { CodemationWorkflowDiscovery } from "./CodemationWorkflowDiscovery";
|
|
8
|
+
|
|
9
|
+
export type CodemationEventBusKind = "memory" | "redis";
|
|
10
|
+
export type CodemationSchedulerKind = "local" | "bullmq";
|
|
11
|
+
export type CodemationDatabaseKind = "postgresql" | "pglite";
|
|
12
|
+
|
|
13
|
+
export interface CodemationDatabaseConfig {
|
|
14
|
+
readonly kind?: CodemationDatabaseKind;
|
|
15
|
+
/** TCP PostgreSQL URL when `kind` is `postgresql` (or omitted with a postgres URL). */
|
|
16
|
+
readonly url?: string;
|
|
17
|
+
/** Directory for embedded PGlite data when `kind` is `pglite`. Relative paths resolve from the consumer app root. */
|
|
18
|
+
readonly pgliteDataDir?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CodemationEventBusConfig {
|
|
22
|
+
readonly kind?: CodemationEventBusKind;
|
|
23
|
+
readonly redisUrl?: string;
|
|
24
|
+
readonly queuePrefix?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface CodemationSchedulerConfig {
|
|
28
|
+
readonly kind?: CodemationSchedulerKind;
|
|
29
|
+
readonly queuePrefix?: string;
|
|
30
|
+
readonly workerQueues?: ReadonlyArray<string>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type CodemationAppSchedulerKind = "inline" | "queue";
|
|
34
|
+
|
|
35
|
+
export interface CodemationAppSchedulerConfig {
|
|
36
|
+
readonly kind?: CodemationAppSchedulerKind;
|
|
37
|
+
readonly queuePrefix?: string;
|
|
38
|
+
readonly workerQueues?: ReadonlyArray<string>;
|
|
39
|
+
readonly redisUrl?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Optional overrides for engine execution limits (activation budget and subworkflow depth caps).
|
|
44
|
+
* Omitted fields keep framework defaults. Advanced users can bind `CoreTokens.EngineExecutionLimitsPolicy` for full control.
|
|
45
|
+
*/
|
|
46
|
+
export type CodemationEngineExecutionLimitsConfig = Readonly<Partial<EngineExecutionLimitsPolicyConfig>>;
|
|
47
|
+
|
|
48
|
+
export interface CodemationAppDefinition {
|
|
49
|
+
readonly frontendPort?: number;
|
|
50
|
+
readonly databaseUrl?: string;
|
|
51
|
+
readonly database?: CodemationDatabaseConfig;
|
|
52
|
+
readonly scheduler?: CodemationAppSchedulerConfig;
|
|
53
|
+
readonly auth?: CodemationAuthConfig;
|
|
54
|
+
readonly whitelabel?: CodemationWhitelabelConfig;
|
|
55
|
+
readonly log?: CodemationLogConfig;
|
|
56
|
+
readonly engineExecutionLimits?: CodemationEngineExecutionLimitsConfig;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface CodemationApplicationRuntimeConfig {
|
|
60
|
+
readonly frontendPort?: number;
|
|
61
|
+
readonly database?: CodemationDatabaseConfig;
|
|
62
|
+
readonly eventBus?: CodemationEventBusConfig;
|
|
63
|
+
readonly scheduler?: CodemationSchedulerConfig;
|
|
64
|
+
/** Merged with engine defaults when building the execution limits policy (API + workers). */
|
|
65
|
+
readonly engineExecutionLimits?: CodemationEngineExecutionLimitsConfig;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface CodemationConfig {
|
|
69
|
+
readonly app?: CodemationAppDefinition;
|
|
70
|
+
readonly register?: (context: CodemationAppContext) => void;
|
|
71
|
+
readonly runtime?: CodemationApplicationRuntimeConfig;
|
|
72
|
+
readonly workflows?: ReadonlyArray<WorkflowDefinition>;
|
|
73
|
+
readonly workflowDiscovery?: CodemationWorkflowDiscovery;
|
|
74
|
+
readonly plugins?: ReadonlyArray<CodemationPlugin>;
|
|
75
|
+
/** Consumer-defined `CredentialType` entries (see `@codemation/core`), applied when the host loads config. */
|
|
76
|
+
readonly credentialTypes?: ReadonlyArray<AnyCredentialType>;
|
|
77
|
+
/** Optional shell whitelabel (product name, logo path). */
|
|
78
|
+
readonly whitelabel?: CodemationWhitelabelConfig;
|
|
79
|
+
/** Required for production hosts; optional only when using development bypass (never in production). */
|
|
80
|
+
readonly auth?: CodemationAuthConfig;
|
|
81
|
+
/**
|
|
82
|
+
* Namespace-level log filters (first matching rule wins). Unmatched namespaces use `CODEMATION_LOG_LEVEL` / defaults.
|
|
83
|
+
* Omit to keep env-only behavior.
|
|
84
|
+
*/
|
|
85
|
+
readonly log?: CodemationLogConfig;
|
|
86
|
+
}
|