@aotter/mantle-runtime 0.0.11-alpha.11
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 +202 -0
- package/README.md +14 -0
- package/dist/domain/index.d.ts +4 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/index.js +4 -0
- package/dist/domain/index.js.map +1 -0
- package/dist/domain/model/EntryRow.d.ts +59 -0
- package/dist/domain/model/EntryRow.d.ts.map +1 -0
- package/dist/domain/model/EntryRow.js +42 -0
- package/dist/domain/model/EntryRow.js.map +1 -0
- package/dist/domain/model/HandlerContext.d.ts +65 -0
- package/dist/domain/model/HandlerContext.d.ts.map +1 -0
- package/dist/domain/model/HandlerContext.js +2 -0
- package/dist/domain/model/HandlerContext.js.map +1 -0
- package/dist/domain/model/SeoMeta.d.ts +49 -0
- package/dist/domain/model/SeoMeta.d.ts.map +1 -0
- package/dist/domain/model/SeoMeta.js +2 -0
- package/dist/domain/model/SeoMeta.js.map +1 -0
- package/dist/domain/model/TemplateRegistry.d.ts +47 -0
- package/dist/domain/model/TemplateRegistry.d.ts.map +1 -0
- package/dist/domain/model/TemplateRegistry.js +17 -0
- package/dist/domain/model/TemplateRegistry.js.map +1 -0
- package/dist/domain/model/index.d.ts +7 -0
- package/dist/domain/model/index.d.ts.map +1 -0
- package/dist/domain/model/index.js +6 -0
- package/dist/domain/model/index.js.map +1 -0
- package/dist/domain/port/AssetServer.d.ts +21 -0
- package/dist/domain/port/AssetServer.d.ts.map +1 -0
- package/dist/domain/port/AssetServer.js +2 -0
- package/dist/domain/port/AssetServer.js.map +1 -0
- package/dist/domain/port/Clock.d.ts +13 -0
- package/dist/domain/port/Clock.d.ts.map +1 -0
- package/dist/domain/port/Clock.js +2 -0
- package/dist/domain/port/Clock.js.map +1 -0
- package/dist/domain/port/DatabaseDriver.d.ts +91 -0
- package/dist/domain/port/DatabaseDriver.d.ts.map +1 -0
- package/dist/domain/port/DatabaseDriver.js +2 -0
- package/dist/domain/port/DatabaseDriver.js.map +1 -0
- package/dist/domain/port/DeferredHookDispatcher.d.ts +55 -0
- package/dist/domain/port/DeferredHookDispatcher.d.ts.map +1 -0
- package/dist/domain/port/DeferredHookDispatcher.js +16 -0
- package/dist/domain/port/DeferredHookDispatcher.js.map +1 -0
- package/dist/domain/port/EmailSender.d.ts +31 -0
- package/dist/domain/port/EmailSender.d.ts.map +1 -0
- package/dist/domain/port/EmailSender.js +2 -0
- package/dist/domain/port/EmailSender.js.map +1 -0
- package/dist/domain/port/EntryRepository.d.ts +132 -0
- package/dist/domain/port/EntryRepository.d.ts.map +1 -0
- package/dist/domain/port/EntryRepository.js +2 -0
- package/dist/domain/port/EntryRepository.js.map +1 -0
- package/dist/domain/port/HandlerRegistry.d.ts +38 -0
- package/dist/domain/port/HandlerRegistry.d.ts.map +1 -0
- package/dist/domain/port/HandlerRegistry.js +27 -0
- package/dist/domain/port/HandlerRegistry.js.map +1 -0
- package/dist/domain/port/IdGenerator.d.ts +28 -0
- package/dist/domain/port/IdGenerator.d.ts.map +1 -0
- package/dist/domain/port/IdGenerator.js +5 -0
- package/dist/domain/port/IdGenerator.js.map +1 -0
- package/dist/domain/port/KvCache.d.ts +34 -0
- package/dist/domain/port/KvCache.d.ts.map +1 -0
- package/dist/domain/port/KvCache.js +2 -0
- package/dist/domain/port/KvCache.js.map +1 -0
- package/dist/domain/port/LifecycleHookRunner.d.ts +41 -0
- package/dist/domain/port/LifecycleHookRunner.d.ts.map +1 -0
- package/dist/domain/port/LifecycleHookRunner.js +2 -0
- package/dist/domain/port/LifecycleHookRunner.js.map +1 -0
- package/dist/domain/port/MediaStorage.d.ts +102 -0
- package/dist/domain/port/MediaStorage.d.ts.map +1 -0
- package/dist/domain/port/MediaStorage.js +2 -0
- package/dist/domain/port/MediaStorage.js.map +1 -0
- package/dist/domain/port/PublishOrchestrator.d.ts +25 -0
- package/dist/domain/port/PublishOrchestrator.d.ts.map +1 -0
- package/dist/domain/port/PublishOrchestrator.js +2 -0
- package/dist/domain/port/PublishOrchestrator.js.map +1 -0
- package/dist/domain/port/SiteConfigRepository.d.ts +27 -0
- package/dist/domain/port/SiteConfigRepository.d.ts.map +1 -0
- package/dist/domain/port/SiteConfigRepository.js +2 -0
- package/dist/domain/port/SiteConfigRepository.js.map +1 -0
- package/dist/domain/port/index.d.ts +30 -0
- package/dist/domain/port/index.d.ts.map +1 -0
- package/dist/domain/port/index.js +5 -0
- package/dist/domain/port/index.js.map +1 -0
- package/dist/domain/service/AbsoluteUrl.d.ts +6 -0
- package/dist/domain/service/AbsoluteUrl.d.ts.map +1 -0
- package/dist/domain/service/AbsoluteUrl.js +33 -0
- package/dist/domain/service/AbsoluteUrl.js.map +1 -0
- package/dist/domain/service/AuthPredicateEvaluator.d.ts +29 -0
- package/dist/domain/service/AuthPredicateEvaluator.d.ts.map +1 -0
- package/dist/domain/service/AuthPredicateEvaluator.js +48 -0
- package/dist/domain/service/AuthPredicateEvaluator.js.map +1 -0
- package/dist/domain/service/BuiltinProjector.d.ts +50 -0
- package/dist/domain/service/BuiltinProjector.d.ts.map +1 -0
- package/dist/domain/service/BuiltinProjector.js +61 -0
- package/dist/domain/service/BuiltinProjector.js.map +1 -0
- package/dist/domain/service/EntrySeoSupport.d.ts +27 -0
- package/dist/domain/service/EntrySeoSupport.d.ts.map +1 -0
- package/dist/domain/service/EntrySeoSupport.js +13 -0
- package/dist/domain/service/EntrySeoSupport.js.map +1 -0
- package/dist/domain/service/HtmlRenderer.d.ts +32 -0
- package/dist/domain/service/HtmlRenderer.d.ts.map +1 -0
- package/dist/domain/service/HtmlRenderer.js +38 -0
- package/dist/domain/service/HtmlRenderer.js.map +1 -0
- package/dist/domain/service/LocaleNegotiator.d.ts +29 -0
- package/dist/domain/service/LocaleNegotiator.d.ts.map +1 -0
- package/dist/domain/service/LocaleNegotiator.js +62 -0
- package/dist/domain/service/LocaleNegotiator.js.map +1 -0
- package/dist/domain/service/MarkdownSerializer.d.ts +48 -0
- package/dist/domain/service/MarkdownSerializer.d.ts.map +1 -0
- package/dist/domain/service/MarkdownSerializer.js +109 -0
- package/dist/domain/service/MarkdownSerializer.js.map +1 -0
- package/dist/domain/service/McpToolNaming.d.ts +12 -0
- package/dist/domain/service/McpToolNaming.d.ts.map +1 -0
- package/dist/domain/service/McpToolNaming.js +14 -0
- package/dist/domain/service/McpToolNaming.js.map +1 -0
- package/dist/domain/service/Pagination.d.ts +15 -0
- package/dist/domain/service/Pagination.d.ts.map +1 -0
- package/dist/domain/service/Pagination.js +29 -0
- package/dist/domain/service/Pagination.js.map +1 -0
- package/dist/domain/service/PathMatcher.d.ts +15 -0
- package/dist/domain/service/PathMatcher.d.ts.map +1 -0
- package/dist/domain/service/PathMatcher.js +54 -0
- package/dist/domain/service/PathMatcher.js.map +1 -0
- package/dist/domain/service/PreviewBanner.d.ts +10 -0
- package/dist/domain/service/PreviewBanner.d.ts.map +1 -0
- package/dist/domain/service/PreviewBanner.js +37 -0
- package/dist/domain/service/PreviewBanner.js.map +1 -0
- package/dist/domain/service/PublicPathResolver.d.ts +41 -0
- package/dist/domain/service/PublicPathResolver.d.ts.map +1 -0
- package/dist/domain/service/PublicPathResolver.js +24 -0
- package/dist/domain/service/PublicPathResolver.js.map +1 -0
- package/dist/domain/service/PublishKeys.d.ts +42 -0
- package/dist/domain/service/PublishKeys.d.ts.map +1 -0
- package/dist/domain/service/PublishKeys.js +69 -0
- package/dist/domain/service/PublishKeys.js.map +1 -0
- package/dist/domain/service/SeoMetaComposer.d.ts +47 -0
- package/dist/domain/service/SeoMetaComposer.d.ts.map +1 -0
- package/dist/domain/service/SeoMetaComposer.js +174 -0
- package/dist/domain/service/SeoMetaComposer.js.map +1 -0
- package/dist/domain/service/SitemapSerializer.d.ts +19 -0
- package/dist/domain/service/SitemapSerializer.d.ts.map +1 -0
- package/dist/domain/service/SitemapSerializer.js +27 -0
- package/dist/domain/service/SitemapSerializer.js.map +1 -0
- package/dist/domain/service/TriggerIndex.d.ts +27 -0
- package/dist/domain/service/TriggerIndex.d.ts.map +1 -0
- package/dist/domain/service/TriggerIndex.js +52 -0
- package/dist/domain/service/TriggerIndex.js.map +1 -0
- package/dist/domain/service/ViewParamCoercer.d.ts +20 -0
- package/dist/domain/service/ViewParamCoercer.d.ts.map +1 -0
- package/dist/domain/service/ViewParamCoercer.js +82 -0
- package/dist/domain/service/ViewParamCoercer.js.map +1 -0
- package/dist/domain/service/ViewSqlCompiler.d.ts +29 -0
- package/dist/domain/service/ViewSqlCompiler.d.ts.map +1 -0
- package/dist/domain/service/ViewSqlCompiler.js +147 -0
- package/dist/domain/service/ViewSqlCompiler.js.map +1 -0
- package/dist/domain/service/index.d.ts +28 -0
- package/dist/domain/service/index.d.ts.map +1 -0
- package/dist/domain/service/index.js +28 -0
- package/dist/domain/service/index.js.map +1 -0
- package/dist/domain/service/io/EntryWriteGuard.d.ts +19 -0
- package/dist/domain/service/io/EntryWriteGuard.d.ts.map +1 -0
- package/dist/domain/service/io/EntryWriteGuard.js +109 -0
- package/dist/domain/service/io/EntryWriteGuard.js.map +1 -0
- package/dist/domain/service/io/JoinedEntryReader.d.ts +33 -0
- package/dist/domain/service/io/JoinedEntryReader.d.ts.map +1 -0
- package/dist/domain/service/io/JoinedEntryReader.js +95 -0
- package/dist/domain/service/io/JoinedEntryReader.js.map +1 -0
- package/dist/domain/service/io/PublishedEntries.d.ts +69 -0
- package/dist/domain/service/io/PublishedEntries.d.ts.map +1 -0
- package/dist/domain/service/io/PublishedEntries.js +116 -0
- package/dist/domain/service/io/PublishedEntries.js.map +1 -0
- package/dist/domain/service/io/index.d.ts +9 -0
- package/dist/domain/service/io/index.d.ts.map +1 -0
- package/dist/domain/service/io/index.js +9 -0
- package/dist/domain/service/io/index.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/boot/canonicalMigrations.d.ts +9 -0
- package/dist/infrastructure/boot/canonicalMigrations.d.ts.map +1 -0
- package/dist/infrastructure/boot/canonicalMigrations.js +162 -0
- package/dist/infrastructure/boot/canonicalMigrations.js.map +1 -0
- package/dist/infrastructure/boot/index.d.ts +2 -0
- package/dist/infrastructure/boot/index.d.ts.map +1 -0
- package/dist/infrastructure/boot/index.js +2 -0
- package/dist/infrastructure/boot/index.js.map +1 -0
- package/dist/infrastructure/http/DiagnosticResponse.d.ts +12 -0
- package/dist/infrastructure/http/DiagnosticResponse.d.ts.map +1 -0
- package/dist/infrastructure/http/DiagnosticResponse.js +14 -0
- package/dist/infrastructure/http/DiagnosticResponse.js.map +1 -0
- package/dist/infrastructure/http/index.d.ts +2 -0
- package/dist/infrastructure/http/index.d.ts.map +1 -0
- package/dist/infrastructure/http/index.js +2 -0
- package/dist/infrastructure/http/index.js.map +1 -0
- package/dist/infrastructure/index.d.ts +12 -0
- package/dist/infrastructure/index.d.ts.map +1 -0
- package/dist/infrastructure/index.js +12 -0
- package/dist/infrastructure/index.js.map +1 -0
- package/dist/infrastructure/mcp/McpJsonRpcDispatcher.d.ts +60 -0
- package/dist/infrastructure/mcp/McpJsonRpcDispatcher.d.ts.map +1 -0
- package/dist/infrastructure/mcp/McpJsonRpcDispatcher.js +281 -0
- package/dist/infrastructure/mcp/McpJsonRpcDispatcher.js.map +1 -0
- package/dist/infrastructure/mcp/McpResponses.d.ts +14 -0
- package/dist/infrastructure/mcp/McpResponses.d.ts.map +1 -0
- package/dist/infrastructure/mcp/McpResponses.js +49 -0
- package/dist/infrastructure/mcp/McpResponses.js.map +1 -0
- package/dist/infrastructure/mcp/McpToolCatalog.d.ts +68 -0
- package/dist/infrastructure/mcp/McpToolCatalog.d.ts.map +1 -0
- package/dist/infrastructure/mcp/McpToolCatalog.js +231 -0
- package/dist/infrastructure/mcp/McpToolCatalog.js.map +1 -0
- package/dist/infrastructure/mcp/index.d.ts +4 -0
- package/dist/infrastructure/mcp/index.d.ts.map +1 -0
- package/dist/infrastructure/mcp/index.js +4 -0
- package/dist/infrastructure/mcp/index.js.map +1 -0
- package/dist/infrastructure/persistence/DatabaseEntryRepository.d.ts +35 -0
- package/dist/infrastructure/persistence/DatabaseEntryRepository.d.ts.map +1 -0
- package/dist/infrastructure/persistence/DatabaseEntryRepository.js +228 -0
- package/dist/infrastructure/persistence/DatabaseEntryRepository.js.map +1 -0
- package/dist/infrastructure/persistence/DatabaseSiteConfigRepository.d.ts +12 -0
- package/dist/infrastructure/persistence/DatabaseSiteConfigRepository.d.ts.map +1 -0
- package/dist/infrastructure/persistence/DatabaseSiteConfigRepository.js +101 -0
- package/dist/infrastructure/persistence/DatabaseSiteConfigRepository.js.map +1 -0
- package/dist/infrastructure/persistence/LifecycleHookingEntryRepository.d.ts +74 -0
- package/dist/infrastructure/persistence/LifecycleHookingEntryRepository.d.ts.map +1 -0
- package/dist/infrastructure/persistence/LifecycleHookingEntryRepository.js +208 -0
- package/dist/infrastructure/persistence/LifecycleHookingEntryRepository.js.map +1 -0
- package/dist/infrastructure/persistence/index.d.ts +4 -0
- package/dist/infrastructure/persistence/index.d.ts.map +1 -0
- package/dist/infrastructure/persistence/index.js +4 -0
- package/dist/infrastructure/persistence/index.js.map +1 -0
- package/dist/infrastructure/render/HtmlPublishOrchestrator.d.ts +34 -0
- package/dist/infrastructure/render/HtmlPublishOrchestrator.d.ts.map +1 -0
- package/dist/infrastructure/render/HtmlPublishOrchestrator.js +116 -0
- package/dist/infrastructure/render/HtmlPublishOrchestrator.js.map +1 -0
- package/dist/infrastructure/render/index.d.ts +2 -0
- package/dist/infrastructure/render/index.d.ts.map +1 -0
- package/dist/infrastructure/render/index.js +2 -0
- package/dist/infrastructure/render/index.js.map +1 -0
- package/dist/runtime.d.ts +132 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +142 -0
- package/dist/runtime.js.map +1 -0
- package/dist/usecase/boot/ValidateBootUseCase.d.ts +57 -0
- package/dist/usecase/boot/ValidateBootUseCase.d.ts.map +1 -0
- package/dist/usecase/boot/ValidateBootUseCase.js +181 -0
- package/dist/usecase/boot/ValidateBootUseCase.js.map +1 -0
- package/dist/usecase/boot/index.d.ts +2 -0
- package/dist/usecase/boot/index.d.ts.map +1 -0
- package/dist/usecase/boot/index.js +2 -0
- package/dist/usecase/boot/index.js.map +1 -0
- package/dist/usecase/content/ArchiveUseCase.d.ts +20 -0
- package/dist/usecase/content/ArchiveUseCase.d.ts.map +1 -0
- package/dist/usecase/content/ArchiveUseCase.js +47 -0
- package/dist/usecase/content/ArchiveUseCase.js.map +1 -0
- package/dist/usecase/content/ContentPublishEffects.d.ts +11 -0
- package/dist/usecase/content/ContentPublishEffects.d.ts.map +1 -0
- package/dist/usecase/content/ContentPublishEffects.js +21 -0
- package/dist/usecase/content/ContentPublishEffects.js.map +1 -0
- package/dist/usecase/content/CreateDraftUseCase.d.ts +22 -0
- package/dist/usecase/content/CreateDraftUseCase.d.ts.map +1 -0
- package/dist/usecase/content/CreateDraftUseCase.js +61 -0
- package/dist/usecase/content/CreateDraftUseCase.js.map +1 -0
- package/dist/usecase/content/DeleteEntryUseCase.d.ts +20 -0
- package/dist/usecase/content/DeleteEntryUseCase.d.ts.map +1 -0
- package/dist/usecase/content/DeleteEntryUseCase.js +34 -0
- package/dist/usecase/content/DeleteEntryUseCase.js.map +1 -0
- package/dist/usecase/content/GetEntryUseCase.d.ts +13 -0
- package/dist/usecase/content/GetEntryUseCase.d.ts.map +1 -0
- package/dist/usecase/content/GetEntryUseCase.js +24 -0
- package/dist/usecase/content/GetEntryUseCase.js.map +1 -0
- package/dist/usecase/content/ListEntriesUseCase.d.ts +39 -0
- package/dist/usecase/content/ListEntriesUseCase.d.ts.map +1 -0
- package/dist/usecase/content/ListEntriesUseCase.js +58 -0
- package/dist/usecase/content/ListEntriesUseCase.js.map +1 -0
- package/dist/usecase/content/RequestPublishUseCase.d.ts +30 -0
- package/dist/usecase/content/RequestPublishUseCase.d.ts.map +1 -0
- package/dist/usecase/content/RequestPublishUseCase.js +111 -0
- package/dist/usecase/content/RequestPublishUseCase.js.map +1 -0
- package/dist/usecase/content/UnpublishUseCase.d.ts +19 -0
- package/dist/usecase/content/UnpublishUseCase.d.ts.map +1 -0
- package/dist/usecase/content/UnpublishUseCase.js +46 -0
- package/dist/usecase/content/UnpublishUseCase.js.map +1 -0
- package/dist/usecase/content/UpdateDraftUseCase.d.ts +20 -0
- package/dist/usecase/content/UpdateDraftUseCase.d.ts.map +1 -0
- package/dist/usecase/content/UpdateDraftUseCase.js +86 -0
- package/dist/usecase/content/UpdateDraftUseCase.js.map +1 -0
- package/dist/usecase/content/diagnostics.d.ts +26 -0
- package/dist/usecase/content/diagnostics.d.ts.map +1 -0
- package/dist/usecase/content/diagnostics.js +100 -0
- package/dist/usecase/content/diagnostics.js.map +1 -0
- package/dist/usecase/content/index.d.ts +15 -0
- package/dist/usecase/content/index.d.ts.map +1 -0
- package/dist/usecase/content/index.js +15 -0
- package/dist/usecase/content/index.js.map +1 -0
- package/dist/usecase/dto/content/index.d.ts +73 -0
- package/dist/usecase/dto/content/index.d.ts.map +1 -0
- package/dist/usecase/dto/content/index.js +2 -0
- package/dist/usecase/dto/content/index.js.map +1 -0
- package/dist/usecase/dto/index.d.ts +13 -0
- package/dist/usecase/dto/index.d.ts.map +1 -0
- package/dist/usecase/dto/index.js +13 -0
- package/dist/usecase/dto/index.js.map +1 -0
- package/dist/usecase/dto/lifecycle/index.d.ts +15 -0
- package/dist/usecase/dto/lifecycle/index.d.ts.map +1 -0
- package/dist/usecase/dto/lifecycle/index.js +2 -0
- package/dist/usecase/dto/lifecycle/index.js.map +1 -0
- package/dist/usecase/dto/media/index.d.ts +32 -0
- package/dist/usecase/dto/media/index.d.ts.map +1 -0
- package/dist/usecase/dto/media/index.js +8 -0
- package/dist/usecase/dto/media/index.js.map +1 -0
- package/dist/usecase/dto/procedure/index.d.ts +37 -0
- package/dist/usecase/dto/procedure/index.d.ts.map +1 -0
- package/dist/usecase/dto/procedure/index.js +2 -0
- package/dist/usecase/dto/procedure/index.js.map +1 -0
- package/dist/usecase/dto/render/ComposeEntrySeoMetaRequest.d.ts +14 -0
- package/dist/usecase/dto/render/ComposeEntrySeoMetaRequest.d.ts.map +1 -0
- package/dist/usecase/dto/render/ComposeEntrySeoMetaRequest.js +2 -0
- package/dist/usecase/dto/render/ComposeEntrySeoMetaRequest.js.map +1 -0
- package/dist/usecase/dto/render/ComposeLlmsTxtRequest.d.ts +8 -0
- package/dist/usecase/dto/render/ComposeLlmsTxtRequest.d.ts.map +1 -0
- package/dist/usecase/dto/render/ComposeLlmsTxtRequest.js +2 -0
- package/dist/usecase/dto/render/ComposeLlmsTxtRequest.js.map +1 -0
- package/dist/usecase/dto/render/ComposeSitemapRequest.d.ts +11 -0
- package/dist/usecase/dto/render/ComposeSitemapRequest.d.ts.map +1 -0
- package/dist/usecase/dto/render/ComposeSitemapRequest.js +2 -0
- package/dist/usecase/dto/render/ComposeSitemapRequest.js.map +1 -0
- package/dist/usecase/dto/render/PreviewEntryRequest.d.ts +27 -0
- package/dist/usecase/dto/render/PreviewEntryRequest.d.ts.map +1 -0
- package/dist/usecase/dto/render/PreviewEntryRequest.js +2 -0
- package/dist/usecase/dto/render/PreviewEntryRequest.js.map +1 -0
- package/dist/usecase/dto/render/RenderEntryLiveRequest.d.ts +17 -0
- package/dist/usecase/dto/render/RenderEntryLiveRequest.d.ts.map +1 -0
- package/dist/usecase/dto/render/RenderEntryLiveRequest.js +2 -0
- package/dist/usecase/dto/render/RenderEntryLiveRequest.js.map +1 -0
- package/dist/usecase/dto/render/RenderListLiveRequest.d.ts +11 -0
- package/dist/usecase/dto/render/RenderListLiveRequest.d.ts.map +1 -0
- package/dist/usecase/dto/render/RenderListLiveRequest.js +2 -0
- package/dist/usecase/dto/render/RenderListLiveRequest.js.map +1 -0
- package/dist/usecase/dto/render/index.d.ts +7 -0
- package/dist/usecase/dto/render/index.d.ts.map +1 -0
- package/dist/usecase/dto/render/index.js +7 -0
- package/dist/usecase/dto/render/index.js.map +1 -0
- package/dist/usecase/dto/view/ExecuteViewRequest.d.ts +16 -0
- package/dist/usecase/dto/view/ExecuteViewRequest.d.ts.map +1 -0
- package/dist/usecase/dto/view/ExecuteViewRequest.js +2 -0
- package/dist/usecase/dto/view/ExecuteViewRequest.js.map +1 -0
- package/dist/usecase/dto/view/index.d.ts +2 -0
- package/dist/usecase/dto/view/index.d.ts.map +1 -0
- package/dist/usecase/dto/view/index.js +2 -0
- package/dist/usecase/dto/view/index.js.map +1 -0
- package/dist/usecase/index.d.ts +16 -0
- package/dist/usecase/index.d.ts.map +1 -0
- package/dist/usecase/index.js +16 -0
- package/dist/usecase/index.js.map +1 -0
- package/dist/usecase/lifecycle/RunDeferredHookUseCase.d.ts +26 -0
- package/dist/usecase/lifecycle/RunDeferredHookUseCase.d.ts.map +1 -0
- package/dist/usecase/lifecycle/RunDeferredHookUseCase.js +44 -0
- package/dist/usecase/lifecycle/RunDeferredHookUseCase.js.map +1 -0
- package/dist/usecase/lifecycle/RunLifecycleHooksUseCase.d.ts +38 -0
- package/dist/usecase/lifecycle/RunLifecycleHooksUseCase.d.ts.map +1 -0
- package/dist/usecase/lifecycle/RunLifecycleHooksUseCase.js +67 -0
- package/dist/usecase/lifecycle/RunLifecycleHooksUseCase.js.map +1 -0
- package/dist/usecase/lifecycle/index.d.ts +3 -0
- package/dist/usecase/lifecycle/index.d.ts.map +1 -0
- package/dist/usecase/lifecycle/index.js +3 -0
- package/dist/usecase/lifecycle/index.js.map +1 -0
- package/dist/usecase/media/CommitMediaUploadUseCase.d.ts +15 -0
- package/dist/usecase/media/CommitMediaUploadUseCase.d.ts.map +1 -0
- package/dist/usecase/media/CommitMediaUploadUseCase.js +43 -0
- package/dist/usecase/media/CommitMediaUploadUseCase.js.map +1 -0
- package/dist/usecase/media/CreateMediaUploadUseCase.d.ts +18 -0
- package/dist/usecase/media/CreateMediaUploadUseCase.d.ts.map +1 -0
- package/dist/usecase/media/CreateMediaUploadUseCase.js +71 -0
- package/dist/usecase/media/CreateMediaUploadUseCase.js.map +1 -0
- package/dist/usecase/media/PendingUploadRecord.d.ts +17 -0
- package/dist/usecase/media/PendingUploadRecord.d.ts.map +1 -0
- package/dist/usecase/media/PendingUploadRecord.js +2 -0
- package/dist/usecase/media/PendingUploadRecord.js.map +1 -0
- package/dist/usecase/media/diagnostics.d.ts +15 -0
- package/dist/usecase/media/diagnostics.d.ts.map +1 -0
- package/dist/usecase/media/diagnostics.js +88 -0
- package/dist/usecase/media/diagnostics.js.map +1 -0
- package/dist/usecase/media/index.d.ts +4 -0
- package/dist/usecase/media/index.d.ts.map +1 -0
- package/dist/usecase/media/index.js +4 -0
- package/dist/usecase/media/index.js.map +1 -0
- package/dist/usecase/media/mediaAllowlist.d.ts +30 -0
- package/dist/usecase/media/mediaAllowlist.d.ts.map +1 -0
- package/dist/usecase/media/mediaAllowlist.js +53 -0
- package/dist/usecase/media/mediaAllowlist.js.map +1 -0
- package/dist/usecase/procedure/InvokeBuiltinUseCase.d.ts +43 -0
- package/dist/usecase/procedure/InvokeBuiltinUseCase.d.ts.map +1 -0
- package/dist/usecase/procedure/InvokeBuiltinUseCase.js +202 -0
- package/dist/usecase/procedure/InvokeBuiltinUseCase.js.map +1 -0
- package/dist/usecase/procedure/InvokeProcedureUseCase.d.ts +50 -0
- package/dist/usecase/procedure/InvokeProcedureUseCase.d.ts.map +1 -0
- package/dist/usecase/procedure/InvokeProcedureUseCase.js +191 -0
- package/dist/usecase/procedure/InvokeProcedureUseCase.js.map +1 -0
- package/dist/usecase/procedure/index.d.ts +3 -0
- package/dist/usecase/procedure/index.d.ts.map +1 -0
- package/dist/usecase/procedure/index.js +3 -0
- package/dist/usecase/procedure/index.js.map +1 -0
- package/dist/usecase/render/ComposeEntrySeoMetaUseCase.d.ts +25 -0
- package/dist/usecase/render/ComposeEntrySeoMetaUseCase.d.ts.map +1 -0
- package/dist/usecase/render/ComposeEntrySeoMetaUseCase.js +55 -0
- package/dist/usecase/render/ComposeEntrySeoMetaUseCase.js.map +1 -0
- package/dist/usecase/render/ComposeLlmsTxtUseCase.d.ts +19 -0
- package/dist/usecase/render/ComposeLlmsTxtUseCase.d.ts.map +1 -0
- package/dist/usecase/render/ComposeLlmsTxtUseCase.js +40 -0
- package/dist/usecase/render/ComposeLlmsTxtUseCase.js.map +1 -0
- package/dist/usecase/render/ComposeSitemapUseCase.d.ts +15 -0
- package/dist/usecase/render/ComposeSitemapUseCase.d.ts.map +1 -0
- package/dist/usecase/render/ComposeSitemapUseCase.js +29 -0
- package/dist/usecase/render/ComposeSitemapUseCase.js.map +1 -0
- package/dist/usecase/render/PreviewEntryUseCase.d.ts +26 -0
- package/dist/usecase/render/PreviewEntryUseCase.d.ts.map +1 -0
- package/dist/usecase/render/PreviewEntryUseCase.js +69 -0
- package/dist/usecase/render/PreviewEntryUseCase.js.map +1 -0
- package/dist/usecase/render/RenderEntryLiveUseCase.d.ts +35 -0
- package/dist/usecase/render/RenderEntryLiveUseCase.d.ts.map +1 -0
- package/dist/usecase/render/RenderEntryLiveUseCase.js +59 -0
- package/dist/usecase/render/RenderEntryLiveUseCase.js.map +1 -0
- package/dist/usecase/render/RenderListLiveUseCase.d.ts +23 -0
- package/dist/usecase/render/RenderListLiveUseCase.d.ts.map +1 -0
- package/dist/usecase/render/RenderListLiveUseCase.js +41 -0
- package/dist/usecase/render/RenderListLiveUseCase.js.map +1 -0
- package/dist/usecase/render/index.d.ts +7 -0
- package/dist/usecase/render/index.d.ts.map +1 -0
- package/dist/usecase/render/index.js +10 -0
- package/dist/usecase/render/index.js.map +1 -0
- package/dist/usecase/view/ExecuteViewUseCase.d.ts +31 -0
- package/dist/usecase/view/ExecuteViewUseCase.d.ts.map +1 -0
- package/dist/usecase/view/ExecuteViewUseCase.js +78 -0
- package/dist/usecase/view/ExecuteViewUseCase.js.map +1 -0
- package/dist/usecase/view/index.d.ts +2 -0
- package/dist/usecase/view/index.d.ts.map +1 -0
- package/dist/usecase/view/index.js +2 -0
- package/dist/usecase/view/index.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Clock.js","sourceRoot":"","sources":["../../../src/domain/port/Clock.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,WAAW,GAAU,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `DatabaseDriver` — runtime's adapter-agnostic interface to
|
|
3
|
+
* persistent relational state. The canonical tables (`entries`,
|
|
4
|
+
* `revisions`, `approvals`, `users`, `staff`, `sessions`,
|
|
5
|
+
* `site_config`) live behind this
|
|
6
|
+
* surface; the runtime never sees `D1Database`, `Pool` (postgres),
|
|
7
|
+
* or any concrete driver.
|
|
8
|
+
*
|
|
9
|
+
* The shape is intentionally close to D1's API (which is itself close
|
|
10
|
+
* to the SQLite C API) — that's the smallest common denominator
|
|
11
|
+
* across the adapters we expect to ship. Adapters wrap their native
|
|
12
|
+
* driver to this shape:
|
|
13
|
+
*
|
|
14
|
+
* - `mantle-cloudflare` wraps `env.DB` (D1) directly (1:1 surface).
|
|
15
|
+
* - A future Postgres adapter wraps `pg` to the same shape.
|
|
16
|
+
* - The test harness ships an in-memory impl in `test/fakes/`.
|
|
17
|
+
*
|
|
18
|
+
* See ADR-0011 § DatabaseDriver for the rationale (and the alternatives
|
|
19
|
+
* — mega-port, function-injection, plugin packages — that were
|
|
20
|
+
* rejected). Renamed from `DatabasePort` per the clean-architecture
|
|
21
|
+
* naming convention (no `Port` suffix; ports are discoverable by
|
|
22
|
+
* package alone).
|
|
23
|
+
*/
|
|
24
|
+
export interface DatabaseDriver {
|
|
25
|
+
/** Build a parameterised statement. Bind values then execute. */
|
|
26
|
+
prepare(sql: string): PreparedStatement;
|
|
27
|
+
/** Execute multiple statements atomically. Adapters guarantee
|
|
28
|
+
* all-or-nothing semantics — a child-row delete + parent delete
|
|
29
|
+
* can't half-land. */
|
|
30
|
+
batch(stmts: ReadonlyArray<PreparedStatement>): Promise<readonly BatchResult[]>;
|
|
31
|
+
/** Migration runner — the runtime's `bootInit` invokes
|
|
32
|
+
* `migrations.runAll()` once per isolate. Adapters supply the
|
|
33
|
+
* storage; the runtime supplies the canonical migration list. */
|
|
34
|
+
readonly migrations: MigrationRunner;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Parameterised statement. Adapters return their native prepared-
|
|
38
|
+
* statement object cast to this shape, so `bind` reuses native binding
|
|
39
|
+
* and `first` / `all` / `run` map to the driver's typed accessors.
|
|
40
|
+
*/
|
|
41
|
+
export interface PreparedStatement {
|
|
42
|
+
/** Bind parameters in `?` order. Returns a new statement; original
|
|
43
|
+
* is unchanged so a single prepared shape can be reused with
|
|
44
|
+
* different bindings. */
|
|
45
|
+
bind(...params: ReadonlyArray<unknown>): PreparedStatement;
|
|
46
|
+
/** Run and return the first row, typed by `T`. `null` when empty. */
|
|
47
|
+
first<T = Record<string, unknown>>(): Promise<T | null>;
|
|
48
|
+
/** Run and return all rows. */
|
|
49
|
+
all<T = Record<string, unknown>>(): Promise<readonly T[]>;
|
|
50
|
+
/** Run and return only rowcount-style metadata. Use `first` / `all`
|
|
51
|
+
* for selects; this is for INSERT/UPDATE/DELETE that don't RETURNING. */
|
|
52
|
+
run(): Promise<RunResult>;
|
|
53
|
+
}
|
|
54
|
+
export interface RunResult {
|
|
55
|
+
readonly success: boolean;
|
|
56
|
+
readonly meta: {
|
|
57
|
+
readonly changes: number;
|
|
58
|
+
readonly lastRowId?: number | string;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface BatchResult {
|
|
62
|
+
readonly success: boolean;
|
|
63
|
+
readonly meta: {
|
|
64
|
+
readonly changes: number;
|
|
65
|
+
};
|
|
66
|
+
readonly results?: readonly Record<string, unknown>[];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Migration runner contract. The adapter implements this against its
|
|
70
|
+
* driver; the runtime calls `runAll(migrations)` once per isolate at
|
|
71
|
+
* boot. Migration order is the array index — runtime supplies the
|
|
72
|
+
* canonical list (see `infrastructure/boot/canonicalMigrations.ts`);
|
|
73
|
+
* adapter just executes.
|
|
74
|
+
*
|
|
75
|
+
* The runner records applied migrations in a `_migrations` table so
|
|
76
|
+
* subsequent boots are idempotent.
|
|
77
|
+
*/
|
|
78
|
+
export interface MigrationRunner {
|
|
79
|
+
runAll(migrations: ReadonlyArray<Migration>): Promise<void>;
|
|
80
|
+
}
|
|
81
|
+
export interface Migration {
|
|
82
|
+
/** Stable ordinal — never reused, never renamed. Adapter records
|
|
83
|
+
* this in `_migrations` for idempotency. */
|
|
84
|
+
readonly id: string;
|
|
85
|
+
/** Free-form description for boot logs. */
|
|
86
|
+
readonly description: string;
|
|
87
|
+
/** SQL DDL / DML to apply. Adapters split on `;` if their driver
|
|
88
|
+
* doesn't accept multi-statement scripts. */
|
|
89
|
+
readonly sql: string;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=DatabaseDriver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatabaseDriver.d.ts","sourceRoot":"","sources":["../../../src/domain/port/DatabaseDriver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAC;IACxC;;2BAEuB;IACvB,KAAK,CAAC,KAAK,EAAE,aAAa,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,SAAS,WAAW,EAAE,CAAC,CAAC;IAChF;;sEAEkE;IAClE,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC;CACtC;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC;;8BAE0B;IAC1B,IAAI,CAAC,GAAG,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,iBAAiB,CAAC;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../src/domain/port/DatabaseDriver.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { LifecycleHook, StaffRole } from "@aotter/mantle-spec";
|
|
2
|
+
import type { EntryRow } from "../model/EntryRow.js";
|
|
3
|
+
import type { HandlerContext } from "../model/HandlerContext.js";
|
|
4
|
+
/**
|
|
5
|
+
* Optional adapter port for delivering `after_*` lifecycle hooks
|
|
6
|
+
* out-of-band — later, in a separate invocation, with durability
|
|
7
|
+
* across isolate death. The adapter's consume-side handler rehydrates
|
|
8
|
+
* the envelope and drives `CmsRuntime.runDeferredHook`. Absent a
|
|
9
|
+
* dispatcher, the decorator's `fireAfter` ladder downgrades to
|
|
10
|
+
* `ctx.waitUntil` then inline-await.
|
|
11
|
+
*
|
|
12
|
+
* Contract: a thrown rejection from `enqueue` is treated as a hard
|
|
13
|
+
* delivery failure — the decorator catches it and downgrades to the
|
|
14
|
+
* next rung. Adapters should swallow transient errors they can
|
|
15
|
+
* tolerate themselves; only escalate when the hook genuinely cannot
|
|
16
|
+
* be deferred.
|
|
17
|
+
*/
|
|
18
|
+
export interface DeferredHookDispatcher {
|
|
19
|
+
enqueue(envelope: DeferredHookEnvelope): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Wire envelope for a deferred `after_*` lifecycle hook. Carries
|
|
23
|
+
* everything the consume side needs to reconstruct the original
|
|
24
|
+
* `RunLifecycleHookRequest` without re-reading the database.
|
|
25
|
+
*
|
|
26
|
+
* `entry` is the row at fire time — for `after_delete` the row is
|
|
27
|
+
* already gone from the DB, so the envelope must carry it. For other
|
|
28
|
+
* `after_*` hooks the row also matches what the in-process firing path
|
|
29
|
+
* would have seen, avoiding read-skew with subsequent mutations.
|
|
30
|
+
*
|
|
31
|
+
* `ctxSnapshot` carries enough identity to rebuild a `HandlerContext`
|
|
32
|
+
* with the original actor's user/staff fields. `waitUntil` is dropped —
|
|
33
|
+
* the consume invocation owns its own request lifetime — and `env` is
|
|
34
|
+
* filled from the consume-side adapter binding.
|
|
35
|
+
*/
|
|
36
|
+
export interface DeferredHookEnvelope {
|
|
37
|
+
readonly hook: LifecycleHook;
|
|
38
|
+
readonly schema: string;
|
|
39
|
+
readonly entry: EntryRow;
|
|
40
|
+
readonly originalInput?: unknown;
|
|
41
|
+
readonly ctxSnapshot: CtxSnapshot | null;
|
|
42
|
+
}
|
|
43
|
+
export interface CtxSnapshot {
|
|
44
|
+
readonly userId: string | null;
|
|
45
|
+
readonly staffId: string | null;
|
|
46
|
+
readonly staffRole: StaffRole | null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Capture identity from a `HandlerContext` into the wire-friendly
|
|
50
|
+
* `CtxSnapshot`. Returns `null` for fully anonymous contexts so the
|
|
51
|
+
* envelope stays small. Lives next to `CtxSnapshot` so the producer
|
|
52
|
+
* (decorator) and consumer (use case) share one source of truth.
|
|
53
|
+
*/
|
|
54
|
+
export declare function ctxSnapshotFrom(ctx: HandlerContext): CtxSnapshot | null;
|
|
55
|
+
//# sourceMappingURL=DeferredHookDispatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeferredHookDispatcher.d.ts","sourceRoot":"","sources":["../../../src/domain/port/DeferredHookDispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,QAAQ,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxD;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;CAC1C;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;CACtC;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,cAAc,GAAG,WAAW,GAAG,IAAI,CAOvE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capture identity from a `HandlerContext` into the wire-friendly
|
|
3
|
+
* `CtxSnapshot`. Returns `null` for fully anonymous contexts so the
|
|
4
|
+
* envelope stays small. Lives next to `CtxSnapshot` so the producer
|
|
5
|
+
* (decorator) and consumer (use case) share one source of truth.
|
|
6
|
+
*/
|
|
7
|
+
export function ctxSnapshotFrom(ctx) {
|
|
8
|
+
if (!ctx.user && !ctx.staff)
|
|
9
|
+
return null;
|
|
10
|
+
return {
|
|
11
|
+
userId: ctx.user?.id ?? null,
|
|
12
|
+
staffId: ctx.staff?.id ?? null,
|
|
13
|
+
staffRole: ctx.staff?.role ?? null,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=DeferredHookDispatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeferredHookDispatcher.js","sourceRoot":"","sources":["../../../src/domain/port/DeferredHookDispatcher.ts"],"names":[],"mappings":"AAmDA;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,GAAmB;IACjD,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACzC,OAAO;QACL,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,IAAI;QAC5B,OAAO,EAAE,GAAG,CAAC,KAAK,EAAE,EAAE,IAAI,IAAI;QAC9B,SAAS,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,IAAI,IAAI;KACnC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional transactional-email sender port. Lives in runtime/domain/port
|
|
3
|
+
* so the contract stays adapter-portable (Resend / Postmark / SendGrid /
|
|
4
|
+
* SMTP all implement this one interface). Not required for v0.1.0 boot —
|
|
5
|
+
* features opt in (Better Auth email-OTP / magic-link, receipts, etc.).
|
|
6
|
+
*
|
|
7
|
+
* The SDK does not own body templates. `locale` (BCP 47) is the contract:
|
|
8
|
+
* the sender decides how to branch (template lookup, i18next, single
|
|
9
|
+
* language). For Better Auth flows the adapter resolves locale from the
|
|
10
|
+
* request's `Accept-Language`, falling back to the site's canonical locale.
|
|
11
|
+
*
|
|
12
|
+
* `category` lets a sender split into per-template lanes without re-parsing
|
|
13
|
+
* the subject — e.g. `"auth.email-otp.sign-in"` vs
|
|
14
|
+
* `"auth.email-otp.email-verification"`.
|
|
15
|
+
*/
|
|
16
|
+
export interface EmailSender {
|
|
17
|
+
send(args: EmailSendArgs): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export interface EmailSendArgs {
|
|
20
|
+
readonly to: string;
|
|
21
|
+
readonly subject: string;
|
|
22
|
+
/** Plain-text body — always required so non-HTML clients work. */
|
|
23
|
+
readonly text: string;
|
|
24
|
+
/** Optional HTML body. */
|
|
25
|
+
readonly html?: string;
|
|
26
|
+
/** BCP 47 locale the recipient is expected to read. */
|
|
27
|
+
readonly locale: string;
|
|
28
|
+
/** Optional categorization for templating / deliverability segmentation. */
|
|
29
|
+
readonly category?: string;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=EmailSender.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmailSender.d.ts","sourceRoot":"","sources":["../../../src/domain/port/EmailSender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0BAA0B;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,uDAAuD;IACvD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmailSender.js","sourceRoot":"","sources":["../../../src/domain/port/EmailSender.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { ContentState } from "@aotter/mantle-spec";
|
|
2
|
+
import type { EntryRow } from "../model/EntryRow.js";
|
|
3
|
+
import type { HandlerContext } from "../model/HandlerContext.js";
|
|
4
|
+
/**
|
|
5
|
+
* `EntryRepository` — chokepoint for every entry mutation. Content-op
|
|
6
|
+
* use cases, MCP handlers, and builtin Procedure handlers all route
|
|
7
|
+
* writes through this interface so OCC, status guards, and lifecycle
|
|
8
|
+
* hooks have exactly one place to enforce them.
|
|
9
|
+
*
|
|
10
|
+
* Concrete impls: `DatabaseDriver`-backed
|
|
11
|
+
* (`infrastructure/persistence/DatabaseEntryRepository`) +
|
|
12
|
+
* `LifecycleHookingEntryRepository` decorator that wraps it. Test
|
|
13
|
+
* harness ships an in-memory fake in `test/fakes/`.
|
|
14
|
+
*
|
|
15
|
+
* Renamed from `EntryStore` per the clean-architecture naming
|
|
16
|
+
* convention (`*Repository` for data access).
|
|
17
|
+
*/
|
|
18
|
+
export interface EntryRepository {
|
|
19
|
+
create(args: CreateEntryArgs): Promise<EntryRow>;
|
|
20
|
+
get(id: string): Promise<EntryRow | null>;
|
|
21
|
+
/** Throws `EntryVersionConflict` on OCC mismatch. */
|
|
22
|
+
update(args: UpdateEntryArgs): Promise<EntryRow>;
|
|
23
|
+
/** Cascades to revisions + approvals child rows for the entry id. */
|
|
24
|
+
delete(args: DeleteEntryArgs): Promise<{
|
|
25
|
+
readonly removed: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
/** Throws `EntryVersionConflict` on OCC mismatch. */
|
|
28
|
+
archive(args: ArchiveEntryArgs): Promise<EntryRow>;
|
|
29
|
+
/** Status flip without data update. `expectedStatus`, when set,
|
|
30
|
+
* atomically asserts pre-flip status to prevent races (e.g. a
|
|
31
|
+
* concurrent publish while we try to archive). Bumps version.
|
|
32
|
+
* Throws `EntryStatusConflict` on guard mismatch. */
|
|
33
|
+
transitionStatus(args: TransitionStatusArgs): Promise<EntryRow>;
|
|
34
|
+
/** List entries in a collection, optionally filtered by status.
|
|
35
|
+
* Pass `cursor` from a previous `ListEntriesResult.nextCursor` to
|
|
36
|
+
* fetch the next page. Pagination matters because D1 silently
|
|
37
|
+
* truncates responses past ~10 MB; without it, large collections
|
|
38
|
+
* return partial pages indistinguishable from "no more rows". */
|
|
39
|
+
list(args: ListEntriesArgs): Promise<ListEntriesResult>;
|
|
40
|
+
/** Find one entry by a top-level JSON data field. Used for runtime
|
|
41
|
+
* referential checks such as `Schema.spec.translates`. */
|
|
42
|
+
findByDataField(args: FindEntryByDataFieldArgs): Promise<EntryRow | null>;
|
|
43
|
+
/** Find one entry by a composite set of top-level JSON data fields.
|
|
44
|
+
* Used to enforce `Schema.spec.uniqueIndexes` at the shared
|
|
45
|
+
* authoring chokepoint. */
|
|
46
|
+
findByDataFields(args: FindEntryByDataFieldsArgs): Promise<EntryRow | null>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Hook-related fields shared by every mutating chokepoint args type.
|
|
50
|
+
* The persistence-layer impl ignores these; the
|
|
51
|
+
* `LifecycleHookingEntryRepository` decorator reads them to fire
|
|
52
|
+
* before_/after_ Triggers with the right ctx + original input.
|
|
53
|
+
*
|
|
54
|
+
* `hookContext` defaults to an anonymous `HandlerContext` in the
|
|
55
|
+
* decorator when callers don't supply one (test paths, internal
|
|
56
|
+
* boot-time writes).
|
|
57
|
+
*
|
|
58
|
+
* `collection` is required on every mutation other than `create` so
|
|
59
|
+
* the decorator can short-circuit hook firing on no-hook Schemas
|
|
60
|
+
* without paying an extra `inner.get(id)` round-trip just to learn
|
|
61
|
+
* the row's collection. Callers always know the collection at write
|
|
62
|
+
* time (use cases hold the schema; MCP carries it in the request).
|
|
63
|
+
*/
|
|
64
|
+
export interface MutationHookFields {
|
|
65
|
+
readonly hookContext?: HandlerContext;
|
|
66
|
+
readonly originalInput?: unknown;
|
|
67
|
+
}
|
|
68
|
+
export interface CreateEntryArgs extends MutationHookFields {
|
|
69
|
+
readonly id: string;
|
|
70
|
+
readonly collection: string;
|
|
71
|
+
readonly status: ContentState;
|
|
72
|
+
readonly data: Record<string, unknown>;
|
|
73
|
+
readonly authorId: string | null;
|
|
74
|
+
readonly now: number;
|
|
75
|
+
}
|
|
76
|
+
export interface UpdateEntryArgs extends MutationHookFields {
|
|
77
|
+
readonly id: string;
|
|
78
|
+
readonly collection: string;
|
|
79
|
+
readonly expectedVersion: number;
|
|
80
|
+
readonly data: Record<string, unknown>;
|
|
81
|
+
readonly now: number;
|
|
82
|
+
}
|
|
83
|
+
export interface DeleteEntryArgs extends MutationHookFields {
|
|
84
|
+
readonly id: string;
|
|
85
|
+
readonly collection: string;
|
|
86
|
+
}
|
|
87
|
+
export interface ArchiveEntryArgs extends MutationHookFields {
|
|
88
|
+
readonly id: string;
|
|
89
|
+
readonly collection: string;
|
|
90
|
+
readonly expectedVersion: number;
|
|
91
|
+
readonly now: number;
|
|
92
|
+
}
|
|
93
|
+
export interface TransitionStatusArgs extends MutationHookFields {
|
|
94
|
+
readonly id: string;
|
|
95
|
+
readonly collection: string;
|
|
96
|
+
readonly to: ContentState;
|
|
97
|
+
readonly expectedStatus?: ContentState;
|
|
98
|
+
/** OCC guard. Impls must add `AND version = ?` and throw
|
|
99
|
+
* `EntryVersionConflict` on miss, so a concurrent UpdateDraft
|
|
100
|
+
* between caller-side validation and the flip cannot publish
|
|
101
|
+
* stale data. */
|
|
102
|
+
readonly expectedVersion?: number;
|
|
103
|
+
readonly now: number;
|
|
104
|
+
}
|
|
105
|
+
export interface ListEntriesArgs {
|
|
106
|
+
readonly collection: string;
|
|
107
|
+
readonly status?: ContentState;
|
|
108
|
+
readonly limit?: number;
|
|
109
|
+
/** Opaque continuation token from a prior `ListEntriesResult.nextCursor`.
|
|
110
|
+
* Caller must round-trip without interpreting; format is impl-defined. */
|
|
111
|
+
readonly cursor?: string;
|
|
112
|
+
}
|
|
113
|
+
export interface ListEntriesResult {
|
|
114
|
+
readonly rows: readonly EntryRow[];
|
|
115
|
+
/** Present when there may be more rows beyond this page. Undefined
|
|
116
|
+
* signals "this is the last page". Pass back as `cursor` to
|
|
117
|
+
* continue. */
|
|
118
|
+
readonly nextCursor?: string;
|
|
119
|
+
}
|
|
120
|
+
export interface FindEntryByDataFieldArgs {
|
|
121
|
+
readonly collection: string;
|
|
122
|
+
readonly status?: ContentState;
|
|
123
|
+
readonly field: string;
|
|
124
|
+
readonly value: unknown;
|
|
125
|
+
}
|
|
126
|
+
export interface FindEntryByDataFieldsArgs {
|
|
127
|
+
readonly collection: string;
|
|
128
|
+
readonly status?: ContentState;
|
|
129
|
+
readonly fields: Readonly<Record<string, unknown>>;
|
|
130
|
+
readonly excludeId?: string;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=EntryRepository.d.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],"names":[],"mappings":""}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AnyHandler, HandlerFn } from "../model/HandlerContext.js";
|
|
2
|
+
/**
|
|
3
|
+
* Handler registry keyed by `Procedure.handler.ref`. Consumers call
|
|
4
|
+
* `register` at boot — typically via the `handlers` option of
|
|
5
|
+
* `createCmsRuntime` — and the dispatcher resolves per request via
|
|
6
|
+
* `get`.
|
|
7
|
+
*
|
|
8
|
+
* The registry is a usecase-level port: use cases (specifically
|
|
9
|
+
* `InvokeProcedureUseCase`) depend on it; the consumer's
|
|
10
|
+
* `clam.config.ts` populates it. Lives here in `domain/port/` (not
|
|
11
|
+
* `usecase/port/`) because the implementation IS the port — there's
|
|
12
|
+
* no separate adapter for it.
|
|
13
|
+
*
|
|
14
|
+
* Boot-time fail-fast (Loop 3 of the SDK authoring contract,
|
|
15
|
+
* ADR-0007) verifies every Procedure's `handler.ref` resolves to a
|
|
16
|
+
* registered function before the runtime accepts traffic.
|
|
17
|
+
*/
|
|
18
|
+
export interface HandlerRegistry {
|
|
19
|
+
register<I, O>(ref: string, fn: HandlerFn<I, O>): void;
|
|
20
|
+
get(ref: string): AnyHandler | undefined;
|
|
21
|
+
has(ref: string): boolean;
|
|
22
|
+
/** Snapshot of registered refs — used by the boot validator to
|
|
23
|
+
* enumerate `candidates` on `HANDLER_NOT_REGISTERED` diagnostics. */
|
|
24
|
+
list(): readonly string[];
|
|
25
|
+
}
|
|
26
|
+
export declare class InMemoryHandlerRegistry implements HandlerRegistry {
|
|
27
|
+
private readonly map;
|
|
28
|
+
register<I, O>(ref: string, fn: HandlerFn<I, O>): void;
|
|
29
|
+
get(ref: string): AnyHandler | undefined;
|
|
30
|
+
has(ref: string): boolean;
|
|
31
|
+
list(): readonly string[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Convenience factory: build a registry from a record of handlers.
|
|
35
|
+
* Equivalent to calling `register()` for each entry.
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildHandlerRegistry(handlers: Readonly<Record<string, AnyHandler>>): HandlerRegistry;
|
|
38
|
+
//# sourceMappingURL=HandlerRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HandlerRegistry.d.ts","sourceRoot":"","sources":["../../../src/domain/port/HandlerRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACV,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;IACvD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;IACzC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B;0EACsE;IACtE,IAAI,IAAI,SAAS,MAAM,EAAE,CAAC;CAC3B;AAED,qBAAa,uBAAwB,YAAW,eAAe;IAC7D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAiC;IAErD,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI;IAItD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAIxC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,IAAI,IAAI,SAAS,MAAM,EAAE;CAG1B;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAC7C,eAAe,CAMjB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export class InMemoryHandlerRegistry {
|
|
2
|
+
map = new Map();
|
|
3
|
+
register(ref, fn) {
|
|
4
|
+
this.map.set(ref, fn);
|
|
5
|
+
}
|
|
6
|
+
get(ref) {
|
|
7
|
+
return this.map.get(ref);
|
|
8
|
+
}
|
|
9
|
+
has(ref) {
|
|
10
|
+
return this.map.has(ref);
|
|
11
|
+
}
|
|
12
|
+
list() {
|
|
13
|
+
return [...this.map.keys()];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Convenience factory: build a registry from a record of handlers.
|
|
18
|
+
* Equivalent to calling `register()` for each entry.
|
|
19
|
+
*/
|
|
20
|
+
export function buildHandlerRegistry(handlers) {
|
|
21
|
+
const r = new InMemoryHandlerRegistry();
|
|
22
|
+
for (const [ref, fn] of Object.entries(handlers)) {
|
|
23
|
+
r.register(ref, fn);
|
|
24
|
+
}
|
|
25
|
+
return r;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=HandlerRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HandlerRegistry.js","sourceRoot":"","sources":["../../../src/domain/port/HandlerRegistry.ts"],"names":[],"mappings":"AA8BA,MAAM,OAAO,uBAAuB;IACjB,GAAG,GAAG,IAAI,GAAG,EAAsB,CAAC;IAErD,QAAQ,CAAO,GAAW,EAAE,EAAmB;QAC7C,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,EAAgB,CAAC,CAAC;IACtC,CAAC;IAED,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI;QACF,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9B,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAA8C;IAE9C,MAAM,CAAC,GAAG,IAAI,uBAAuB,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjD,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `IdGenerator` — abstracted id source for new entries / revisions /
|
|
3
|
+
* approvals / sessions / media bearer tokens / R2 object keys.
|
|
4
|
+
*
|
|
5
|
+
* # Security invariant
|
|
6
|
+
*
|
|
7
|
+
* **Production injections MUST be cryptographically random** (CSPRNG-
|
|
8
|
+
* backed, ≥122 bits of entropy). Several call sites use the result as
|
|
9
|
+
* a bearer-token-equivalent — for example, `R2MediaStorage` returns
|
|
10
|
+
* the generated `uploadId` to the client and accepts it back on
|
|
11
|
+
* commit; an attacker who can guess pending `uploadId`s can commit
|
|
12
|
+
* someone else's upload. `R2MediaStorage` also derives R2 object keys
|
|
13
|
+
* from this generator, so a predictable id leaks pre-commit storage
|
|
14
|
+
* key locations.
|
|
15
|
+
*
|
|
16
|
+
* The default `RandomUuidGenerator` (UUID v4 via Web Crypto) satisfies
|
|
17
|
+
* this. Counter-based / sortable / "debuggable" alternatives MUST be
|
|
18
|
+
* confined to test code — never wired into a `createCmsRuntime` /
|
|
19
|
+
* adapter ctor at runtime.
|
|
20
|
+
*/
|
|
21
|
+
export interface IdGenerator {
|
|
22
|
+
next(): string;
|
|
23
|
+
}
|
|
24
|
+
/** Default production id source. UUID v4, ~122 bits CSPRNG entropy
|
|
25
|
+
* via the Workers / Node Web Crypto API. Safe for bearer tokens,
|
|
26
|
+
* R2 object keys, and primary keys. */
|
|
27
|
+
export declare const RandomUuidGenerator: IdGenerator;
|
|
28
|
+
//# sourceMappingURL=IdGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdGenerator.d.ts","sourceRoot":"","sources":["../../../src/domain/port/IdGenerator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,IAAI,MAAM,CAAC;CAChB;AAED;;wCAEwC;AACxC,eAAO,MAAM,mBAAmB,EAAE,WAAiD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Default production id source. UUID v4, ~122 bits CSPRNG entropy
|
|
2
|
+
* via the Workers / Node Web Crypto API. Safe for bearer tokens,
|
|
3
|
+
* R2 object keys, and primary keys. */
|
|
4
|
+
export const RandomUuidGenerator = { next: () => crypto.randomUUID() };
|
|
5
|
+
//# sourceMappingURL=IdGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdGenerator.js","sourceRoot":"","sources":["../../../src/domain/port/IdGenerator.ts"],"names":[],"mappings":"AAwBA;;wCAEwC;AACxC,MAAM,CAAC,MAAM,mBAAmB,GAAgB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `KvCache` — read-mostly cache for the publish pipeline. The runtime
|
|
3
|
+
* stores pre-rendered HTML, per-locale `.md` mirrors, and `llms.txt`
|
|
4
|
+
* here. Reads are on the public-content hot path; writes happen only
|
|
5
|
+
* during publish / unpublish.
|
|
6
|
+
*
|
|
7
|
+
* CF adapter: Workers KV. Future: Redis, FS, S3-compatible store.
|
|
8
|
+
*
|
|
9
|
+
* Distinct from `DatabaseDriver` — KV is eventually-consistent across
|
|
10
|
+
* regions (Workers KV) and tuned for high-fanout reads. The canonical
|
|
11
|
+
* source of truth for entries lives in the DB; KV is a derivative
|
|
12
|
+
* cache that the publish pipeline writes through.
|
|
13
|
+
*
|
|
14
|
+
* Renamed from `KvPort` per the clean-architecture naming convention.
|
|
15
|
+
*/
|
|
16
|
+
export interface KvCache {
|
|
17
|
+
get(key: string): Promise<string | null>;
|
|
18
|
+
put(key: string, value: string, opts?: KvPutOptions): Promise<void>;
|
|
19
|
+
delete(key: string): Promise<void>;
|
|
20
|
+
/** List keys with a prefix. Used by sitemap / `llms.txt` aggregation
|
|
21
|
+
* + cache invalidation paths. Cursor is opaque; consumers loop
|
|
22
|
+
* until cursor is `null`. */
|
|
23
|
+
list(prefix: string, cursor?: string | null): Promise<KvListResult>;
|
|
24
|
+
}
|
|
25
|
+
export interface KvPutOptions {
|
|
26
|
+
/** Seconds until the entry expires. Adapters that don't support
|
|
27
|
+
* TTL silently ignore. */
|
|
28
|
+
readonly expirationTtl?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface KvListResult {
|
|
31
|
+
readonly keys: readonly string[];
|
|
32
|
+
readonly cursor: string | null;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=KvCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KvCache.d.ts","sourceRoot":"","sources":["../../../src/domain/port/KvCache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,OAAO;IACtB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC;;kCAE8B;IAC9B,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACrE;AAED,MAAM,WAAW,YAAY;IAC3B;+BAC2B;IAC3B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KvCache.js","sourceRoot":"","sources":["../../../src/domain/port/KvCache.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { LifecycleHook } from "@aotter/mantle-spec";
|
|
2
|
+
import type { EntryRow } from "../model/EntryRow.js";
|
|
3
|
+
import type { HandlerContext } from "../model/HandlerContext.js";
|
|
4
|
+
/**
|
|
5
|
+
* Fires every Trigger bound to (schema, hook) in alphabetical name
|
|
6
|
+
* order (POC ADR-0014). Implemented by `usecase/lifecycle/
|
|
7
|
+
* RunLifecycleHooksUseCase`; consumed by the entry-writer decorator
|
|
8
|
+
* (`infrastructure/persistence/LifecycleHookingEntryRepository`).
|
|
9
|
+
*
|
|
10
|
+
* Honors per-Trigger `errorPolicy`:
|
|
11
|
+
* - `abort` (only allowed on before_*): handler throw → `run` throws
|
|
12
|
+
* a DiagnosticError so the surrounding mutation cancels.
|
|
13
|
+
* - `continue`: handler throw is logged via `console.error` and
|
|
14
|
+
* swallowed. (POC v0.1.x parity; observability table is v0.2.)
|
|
15
|
+
*
|
|
16
|
+
* The runner itself awaits every Trigger inline. The decorator decides
|
|
17
|
+
* whether to ride on `ctx.waitUntil` (CF Workers fast-path) or
|
|
18
|
+
* inline-await the result; it's not the runner's concern.
|
|
19
|
+
*
|
|
20
|
+
* Lives in `domain/port/` per Aotter clean-arch convention; the
|
|
21
|
+
* implementing use case lives in `usecase/lifecycle/` and is wired at
|
|
22
|
+
* the assembly root.
|
|
23
|
+
*/
|
|
24
|
+
export interface LifecycleHookRunner {
|
|
25
|
+
run(request: RunLifecycleHookRequest): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export interface RunLifecycleHookRequest {
|
|
28
|
+
readonly hook: LifecycleHook;
|
|
29
|
+
readonly schema: string;
|
|
30
|
+
/** Pre-mutation row for `before_*` hooks; persisted post-mutation
|
|
31
|
+
* row for `after_*`. `null` only on `before_create` (no row exists
|
|
32
|
+
* yet). */
|
|
33
|
+
readonly entry: EntryRow | null;
|
|
34
|
+
readonly ctx: HandlerContext;
|
|
35
|
+
/** Pre-projection original input. For builtin Procedure path this is
|
|
36
|
+
* the procedure's full input (incl. side-channel fields like a
|
|
37
|
+
* CAPTCHA token); for non-builtin paths (admin / MCP createDraft)
|
|
38
|
+
* it's typically the raw write payload. May be undefined. */
|
|
39
|
+
readonly originalInput?: unknown;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=LifecycleHookRunner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LifecycleHookRunner.d.ts","sourceRoot":"","sources":["../../../src/domain/port/LifecycleHookRunner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;gBAEY;IACZ,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;IAC7B;;;kEAG8D;IAC9D,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LifecycleHookRunner.js","sourceRoot":"","sources":["../../../src/domain/port/LifecycleHookRunner.ts"],"names":[],"mappings":""}
|