@aotter/mantle-runtime 0.1.0-alpha.1 → 0.1.0-alpha.10
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 +37 -4
- package/dist/MantleRuntime.d.ts +96 -0
- package/dist/MantleRuntime.d.ts.map +1 -0
- package/dist/MantleRuntime.js +197 -0
- package/dist/MantleRuntime.js.map +1 -0
- package/dist/domain/model/HandlerContext.d.ts +3 -4
- package/dist/domain/model/HandlerContext.d.ts.map +1 -1
- package/dist/domain/model/PreparedMantleRevision.d.ts +14 -0
- package/dist/domain/model/PreparedMantleRevision.d.ts.map +1 -0
- package/dist/domain/model/PreparedMantleRevision.js +8 -0
- package/dist/domain/model/PreparedMantleRevision.js.map +1 -0
- package/dist/domain/model/index.d.ts +1 -2
- package/dist/domain/model/index.d.ts.map +1 -1
- package/dist/domain/model/index.js +0 -1
- package/dist/domain/model/index.js.map +1 -1
- package/dist/domain/port/Clock.d.ts +1 -2
- package/dist/domain/port/Clock.d.ts.map +1 -1
- package/dist/domain/port/Clock.js.map +1 -1
- package/dist/domain/port/DatabaseDriver.d.ts +13 -21
- package/dist/domain/port/DatabaseDriver.d.ts.map +1 -1
- package/dist/domain/port/EntryReader.d.ts +1 -1
- package/dist/domain/port/EntryReader.d.ts.map +1 -1
- package/dist/domain/port/EntryRepository.d.ts +19 -4
- package/dist/domain/port/EntryRepository.d.ts.map +1 -1
- package/dist/domain/port/HandlerRegistry.d.ts +1 -1
- package/dist/domain/port/IdGenerator.d.ts +3 -4
- package/dist/domain/port/IdGenerator.d.ts.map +1 -1
- package/dist/domain/port/IdGenerator.js.map +1 -1
- package/dist/domain/port/MantleStorageAdapter.d.ts +23 -0
- package/dist/domain/port/MantleStorageAdapter.d.ts.map +1 -0
- package/dist/domain/port/MantleStorageAdapter.js +2 -0
- package/dist/domain/port/MantleStorageAdapter.js.map +1 -0
- package/dist/domain/port/SiteConfigRepository.d.ts +12 -10
- package/dist/domain/port/SiteConfigRepository.d.ts.map +1 -1
- package/dist/domain/port/ViewQueryExecutor.d.ts +29 -0
- package/dist/domain/port/ViewQueryExecutor.d.ts.map +1 -0
- package/dist/domain/port/ViewQueryExecutor.js +2 -0
- package/dist/domain/port/ViewQueryExecutor.js.map +1 -0
- package/dist/domain/port/index.d.ts +5 -2
- package/dist/domain/port/index.d.ts.map +1 -1
- package/dist/domain/port/index.js.map +1 -1
- package/dist/domain/service/LocaleNegotiator.d.ts.map +1 -1
- package/dist/domain/service/LocaleNegotiator.js +2 -2
- package/dist/domain/service/LocaleNegotiator.js.map +1 -1
- package/dist/domain/service/RuntimePlanCompiler.d.ts +89 -0
- package/dist/domain/service/RuntimePlanCompiler.d.ts.map +1 -0
- package/dist/domain/service/RuntimePlanCompiler.js +230 -0
- package/dist/domain/service/RuntimePlanCompiler.js.map +1 -0
- package/dist/domain/service/TriggerIndex.d.ts +5 -3
- package/dist/domain/service/TriggerIndex.d.ts.map +1 -1
- package/dist/domain/service/TriggerIndex.js +16 -4
- package/dist/domain/service/TriggerIndex.js.map +1 -1
- package/dist/domain/service/ViewParamCoercer.d.ts +1 -1
- package/dist/domain/service/ViewParamCoercer.js +1 -1
- package/dist/domain/service/index.d.ts +1 -9
- package/dist/domain/service/index.d.ts.map +1 -1
- package/dist/domain/service/index.js +1 -9
- package/dist/domain/service/index.js.map +1 -1
- package/dist/domain/service/io/EntryDeleteGuard.js +1 -1
- package/dist/domain/service/io/EntryDeleteGuard.js.map +1 -1
- package/dist/domain/service/io/EntryWriteGuard.d.ts +2 -2
- package/dist/domain/service/io/EntryWriteGuard.d.ts.map +1 -1
- package/dist/domain/service/io/EntryWriteGuard.js +1 -3
- package/dist/domain/service/io/EntryWriteGuard.js.map +1 -1
- package/dist/index.d.ts +17 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -11
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/boot/SqliteMigrationRunner.d.ts +10 -0
- package/dist/infrastructure/boot/SqliteMigrationRunner.d.ts.map +1 -0
- package/dist/infrastructure/boot/SqliteMigrationRunner.js +41 -0
- package/dist/infrastructure/boot/SqliteMigrationRunner.js.map +1 -0
- package/dist/infrastructure/boot/bootState.d.ts +9 -0
- package/dist/infrastructure/boot/bootState.d.ts.map +1 -0
- package/dist/infrastructure/boot/bootState.js +32 -0
- package/dist/infrastructure/boot/bootState.js.map +1 -0
- package/dist/infrastructure/boot/canonicalMigrations.d.ts +2 -0
- package/dist/infrastructure/boot/canonicalMigrations.d.ts.map +1 -1
- package/dist/infrastructure/boot/canonicalMigrations.js +166 -87
- package/dist/infrastructure/boot/canonicalMigrations.js.map +1 -1
- package/dist/infrastructure/boot/index.d.ts +3 -1
- package/dist/infrastructure/boot/index.d.ts.map +1 -1
- package/dist/infrastructure/boot/index.js +3 -1
- package/dist/infrastructure/boot/index.js.map +1 -1
- package/dist/infrastructure/http/createMantleRequestHandler.d.ts +12 -0
- package/dist/infrastructure/http/createMantleRequestHandler.d.ts.map +1 -0
- package/dist/infrastructure/http/createMantleRequestHandler.js +127 -0
- package/dist/infrastructure/http/createMantleRequestHandler.js.map +1 -0
- package/dist/infrastructure/mcp/McpJsonRpcDispatcher.d.ts +18 -23
- package/dist/infrastructure/mcp/McpJsonRpcDispatcher.d.ts.map +1 -1
- package/dist/infrastructure/mcp/McpJsonRpcDispatcher.js +64 -39
- package/dist/infrastructure/mcp/McpJsonRpcDispatcher.js.map +1 -1
- package/dist/infrastructure/mcp/McpToolCatalog.d.ts.map +1 -1
- package/dist/infrastructure/mcp/McpToolCatalog.js +84 -19
- package/dist/infrastructure/mcp/McpToolCatalog.js.map +1 -1
- package/dist/infrastructure/mcp/index.d.ts +1 -1
- package/dist/infrastructure/mcp/index.d.ts.map +1 -1
- package/dist/infrastructure/mcp/index.js.map +1 -1
- package/dist/infrastructure/persistence/DatabaseEntryRepository.d.ts +4 -8
- package/dist/infrastructure/persistence/DatabaseEntryRepository.d.ts.map +1 -1
- package/dist/infrastructure/persistence/DatabaseEntryRepository.js +75 -36
- package/dist/infrastructure/persistence/DatabaseEntryRepository.js.map +1 -1
- package/dist/infrastructure/persistence/DatabaseSiteConfigRepository.d.ts.map +1 -1
- package/dist/infrastructure/persistence/DatabaseSiteConfigRepository.js +39 -31
- package/dist/infrastructure/persistence/DatabaseSiteConfigRepository.js.map +1 -1
- package/dist/infrastructure/persistence/Pagination.d.ts +3 -0
- package/dist/infrastructure/persistence/Pagination.d.ts.map +1 -1
- package/dist/infrastructure/persistence/Pagination.js +28 -0
- package/dist/infrastructure/persistence/Pagination.js.map +1 -1
- package/dist/infrastructure/storage/SqliteMantleStorageAdapter.d.ts +22 -0
- package/dist/infrastructure/storage/SqliteMantleStorageAdapter.d.ts.map +1 -0
- package/dist/infrastructure/storage/SqliteMantleStorageAdapter.js +86 -0
- package/dist/infrastructure/storage/SqliteMantleStorageAdapter.js.map +1 -0
- package/dist/{domain/service/ViewSqlCompiler.d.ts → infrastructure/storage/SqliteViewCompiler.d.ts} +9 -10
- package/dist/infrastructure/storage/SqliteViewCompiler.d.ts.map +1 -0
- package/dist/infrastructure/storage/SqliteViewCompiler.js +307 -0
- package/dist/infrastructure/storage/SqliteViewCompiler.js.map +1 -0
- package/dist/infrastructure/testing/IndexCoverageHarness.d.ts +2 -2
- package/dist/infrastructure/testing/IndexCoverageHarness.d.ts.map +1 -1
- package/dist/infrastructure/testing/IndexCoverageHarness.js +9 -8
- package/dist/infrastructure/testing/IndexCoverageHarness.js.map +1 -1
- package/dist/usecase/boot/ValidateBootUseCase.d.ts +16 -35
- package/dist/usecase/boot/ValidateBootUseCase.d.ts.map +1 -1
- package/dist/usecase/boot/ValidateBootUseCase.js +79 -254
- package/dist/usecase/boot/ValidateBootUseCase.js.map +1 -1
- package/dist/usecase/boot/index.d.ts +1 -1
- package/dist/usecase/boot/index.d.ts.map +1 -1
- package/dist/usecase/boot/index.js +1 -1
- package/dist/usecase/boot/index.js.map +1 -1
- package/dist/usecase/content/ArchiveUseCase.d.ts +1 -1
- package/dist/usecase/content/ArchiveUseCase.js +1 -1
- package/dist/usecase/content/CreateDraftUseCase.d.ts +3 -3
- package/dist/usecase/content/CreateDraftUseCase.d.ts.map +1 -1
- package/dist/usecase/content/CreateDraftUseCase.js +5 -5
- package/dist/usecase/content/CreateDraftUseCase.js.map +1 -1
- package/dist/usecase/content/DeleteEntryUseCase.d.ts +3 -5
- package/dist/usecase/content/DeleteEntryUseCase.d.ts.map +1 -1
- package/dist/usecase/content/DeleteEntryUseCase.js +3 -5
- package/dist/usecase/content/DeleteEntryUseCase.js.map +1 -1
- package/dist/usecase/content/ListEntriesUseCase.d.ts.map +1 -1
- package/dist/usecase/content/ListEntriesUseCase.js +30 -3
- package/dist/usecase/content/ListEntriesUseCase.js.map +1 -1
- package/dist/usecase/content/RequestPublishUseCase.d.ts +4 -12
- package/dist/usecase/content/RequestPublishUseCase.d.ts.map +1 -1
- package/dist/usecase/content/RequestPublishUseCase.js +3 -21
- package/dist/usecase/content/RequestPublishUseCase.js.map +1 -1
- package/dist/usecase/content/UpdateDraftUseCase.d.ts +2 -2
- package/dist/usecase/content/UpdateDraftUseCase.d.ts.map +1 -1
- package/dist/usecase/content/UpdateDraftUseCase.js +4 -4
- package/dist/usecase/content/UpdateDraftUseCase.js.map +1 -1
- package/dist/usecase/content/diagnostics.d.ts +1 -0
- package/dist/usecase/content/diagnostics.d.ts.map +1 -1
- package/dist/usecase/content/diagnostics.js +10 -0
- package/dist/usecase/content/diagnostics.js.map +1 -1
- package/dist/usecase/dto/content/index.d.ts +10 -1
- package/dist/usecase/dto/content/index.d.ts.map +1 -1
- package/dist/usecase/dto/index.d.ts +0 -1
- package/dist/usecase/dto/index.d.ts.map +1 -1
- package/dist/usecase/dto/index.js +0 -1
- package/dist/usecase/dto/index.js.map +1 -1
- package/dist/usecase/dto/view/ExecuteViewRequest.d.ts +2 -2
- package/dist/usecase/dto/view/ExecuteViewRequest.d.ts.map +1 -1
- package/dist/usecase/index.d.ts +0 -1
- package/dist/usecase/index.d.ts.map +1 -1
- package/dist/usecase/index.js +0 -1
- package/dist/usecase/index.js.map +1 -1
- package/dist/usecase/media/diagnostics.js +1 -1
- package/dist/usecase/procedure/InvokeBuiltinUseCase.d.ts +3 -3
- package/dist/usecase/procedure/InvokeBuiltinUseCase.d.ts.map +1 -1
- package/dist/usecase/procedure/InvokeBuiltinUseCase.js +2 -2
- package/dist/usecase/procedure/InvokeBuiltinUseCase.js.map +1 -1
- package/dist/usecase/site/UpdateSiteSettingsUseCase.d.ts +3 -2
- package/dist/usecase/site/UpdateSiteSettingsUseCase.d.ts.map +1 -1
- package/dist/usecase/site/UpdateSiteSettingsUseCase.js +35 -2
- package/dist/usecase/site/UpdateSiteSettingsUseCase.js.map +1 -1
- package/dist/usecase/view/ExecuteViewUseCase.d.ts +8 -16
- package/dist/usecase/view/ExecuteViewUseCase.d.ts.map +1 -1
- package/dist/usecase/view/ExecuteViewUseCase.js +23 -94
- package/dist/usecase/view/ExecuteViewUseCase.js.map +1 -1
- package/dist/usecase/view/index.d.ts +2 -1
- package/dist/usecase/view/index.d.ts.map +1 -1
- package/dist/usecase/view/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/domain/model/SeoMeta.d.ts +0 -47
- package/dist/domain/model/SeoMeta.d.ts.map +0 -1
- package/dist/domain/model/SeoMeta.js +0 -2
- package/dist/domain/model/SeoMeta.js.map +0 -1
- package/dist/domain/model/TemplateRegistry.d.ts +0 -50
- package/dist/domain/model/TemplateRegistry.d.ts.map +0 -1
- package/dist/domain/model/TemplateRegistry.js +0 -17
- package/dist/domain/model/TemplateRegistry.js.map +0 -1
- package/dist/domain/port/AssetServer.d.ts +0 -21
- package/dist/domain/port/AssetServer.d.ts.map +0 -1
- package/dist/domain/port/AssetServer.js +0 -2
- package/dist/domain/port/AssetServer.js.map +0 -1
- package/dist/domain/service/AbsoluteUrl.d.ts +0 -6
- package/dist/domain/service/AbsoluteUrl.d.ts.map +0 -1
- package/dist/domain/service/AbsoluteUrl.js +0 -33
- package/dist/domain/service/AbsoluteUrl.js.map +0 -1
- package/dist/domain/service/HtmlEscaping.d.ts +0 -2
- package/dist/domain/service/HtmlEscaping.d.ts.map +0 -1
- package/dist/domain/service/HtmlEscaping.js +0 -9
- package/dist/domain/service/HtmlEscaping.js.map +0 -1
- package/dist/domain/service/HtmlRenderer.d.ts +0 -36
- package/dist/domain/service/HtmlRenderer.d.ts.map +0 -1
- package/dist/domain/service/HtmlRenderer.js +0 -73
- package/dist/domain/service/HtmlRenderer.js.map +0 -1
- package/dist/domain/service/MarkdownSerializer.d.ts +0 -48
- package/dist/domain/service/MarkdownSerializer.d.ts.map +0 -1
- package/dist/domain/service/MarkdownSerializer.js +0 -109
- package/dist/domain/service/MarkdownSerializer.js.map +0 -1
- package/dist/domain/service/McpToolNaming.d.ts +0 -31
- package/dist/domain/service/McpToolNaming.d.ts.map +0 -1
- package/dist/domain/service/McpToolNaming.js +0 -48
- package/dist/domain/service/McpToolNaming.js.map +0 -1
- package/dist/domain/service/PreviewBanner.d.ts +0 -10
- package/dist/domain/service/PreviewBanner.d.ts.map +0 -1
- package/dist/domain/service/PreviewBanner.js +0 -30
- package/dist/domain/service/PreviewBanner.js.map +0 -1
- package/dist/domain/service/PublicPathResolver.d.ts +0 -46
- package/dist/domain/service/PublicPathResolver.d.ts.map +0 -1
- package/dist/domain/service/PublicPathResolver.js +0 -36
- package/dist/domain/service/PublicPathResolver.js.map +0 -1
- package/dist/domain/service/SeoMetaComposer.d.ts +0 -47
- package/dist/domain/service/SeoMetaComposer.d.ts.map +0 -1
- package/dist/domain/service/SeoMetaComposer.js +0 -164
- package/dist/domain/service/SeoMetaComposer.js.map +0 -1
- package/dist/domain/service/SitemapSerializer.d.ts +0 -19
- package/dist/domain/service/SitemapSerializer.d.ts.map +0 -1
- package/dist/domain/service/SitemapSerializer.js +0 -27
- package/dist/domain/service/SitemapSerializer.js.map +0 -1
- package/dist/domain/service/ViewSqlCompiler.d.ts.map +0 -1
- package/dist/domain/service/ViewSqlCompiler.js +0 -198
- package/dist/domain/service/ViewSqlCompiler.js.map +0 -1
- package/dist/domain/service/io/MediaAssetReferences.d.ts +0 -13
- package/dist/domain/service/io/MediaAssetReferences.d.ts.map +0 -1
- package/dist/domain/service/io/MediaAssetReferences.js +0 -48
- package/dist/domain/service/io/MediaAssetReferences.js.map +0 -1
- package/dist/runtime.d.ts +0 -141
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js +0 -177
- package/dist/runtime.js.map +0 -1
- package/dist/usecase/dto/render/ComposeEntrySeoMetaRequest.d.ts +0 -14
- package/dist/usecase/dto/render/ComposeEntrySeoMetaRequest.d.ts.map +0 -1
- package/dist/usecase/dto/render/ComposeEntrySeoMetaRequest.js +0 -2
- package/dist/usecase/dto/render/ComposeEntrySeoMetaRequest.js.map +0 -1
- package/dist/usecase/dto/render/ComposeLlmsTxtRequest.d.ts +0 -8
- package/dist/usecase/dto/render/ComposeLlmsTxtRequest.d.ts.map +0 -1
- package/dist/usecase/dto/render/ComposeLlmsTxtRequest.js +0 -2
- package/dist/usecase/dto/render/ComposeLlmsTxtRequest.js.map +0 -1
- package/dist/usecase/dto/render/ComposeSitemapRequest.d.ts +0 -11
- package/dist/usecase/dto/render/ComposeSitemapRequest.d.ts.map +0 -1
- package/dist/usecase/dto/render/ComposeSitemapRequest.js +0 -2
- package/dist/usecase/dto/render/ComposeSitemapRequest.js.map +0 -1
- package/dist/usecase/dto/render/PreviewEntryRequest.d.ts +0 -13
- package/dist/usecase/dto/render/PreviewEntryRequest.d.ts.map +0 -1
- package/dist/usecase/dto/render/PreviewEntryRequest.js +0 -2
- package/dist/usecase/dto/render/PreviewEntryRequest.js.map +0 -1
- package/dist/usecase/dto/render/RenderEntryLiveRequest.d.ts +0 -14
- package/dist/usecase/dto/render/RenderEntryLiveRequest.d.ts.map +0 -1
- package/dist/usecase/dto/render/RenderEntryLiveRequest.js +0 -2
- package/dist/usecase/dto/render/RenderEntryLiveRequest.js.map +0 -1
- package/dist/usecase/dto/render/RenderListLiveRequest.d.ts +0 -11
- package/dist/usecase/dto/render/RenderListLiveRequest.d.ts.map +0 -1
- package/dist/usecase/dto/render/RenderListLiveRequest.js +0 -2
- package/dist/usecase/dto/render/RenderListLiveRequest.js.map +0 -1
- package/dist/usecase/dto/render/index.d.ts +0 -7
- package/dist/usecase/dto/render/index.d.ts.map +0 -1
- package/dist/usecase/dto/render/index.js +0 -7
- package/dist/usecase/dto/render/index.js.map +0 -1
- package/dist/usecase/render/ComposeEntrySeoMetaUseCase.d.ts +0 -28
- package/dist/usecase/render/ComposeEntrySeoMetaUseCase.d.ts.map +0 -1
- package/dist/usecase/render/ComposeEntrySeoMetaUseCase.js +0 -59
- package/dist/usecase/render/ComposeEntrySeoMetaUseCase.js.map +0 -1
- package/dist/usecase/render/ComposeLlmsTxtUseCase.d.ts +0 -16
- package/dist/usecase/render/ComposeLlmsTxtUseCase.d.ts.map +0 -1
- package/dist/usecase/render/ComposeLlmsTxtUseCase.js +0 -36
- package/dist/usecase/render/ComposeLlmsTxtUseCase.js.map +0 -1
- package/dist/usecase/render/ComposeSitemapUseCase.d.ts +0 -15
- package/dist/usecase/render/ComposeSitemapUseCase.d.ts.map +0 -1
- package/dist/usecase/render/ComposeSitemapUseCase.js +0 -28
- package/dist/usecase/render/ComposeSitemapUseCase.js.map +0 -1
- package/dist/usecase/render/PreviewEntryUseCase.d.ts +0 -28
- package/dist/usecase/render/PreviewEntryUseCase.d.ts.map +0 -1
- package/dist/usecase/render/PreviewEntryUseCase.js +0 -72
- package/dist/usecase/render/PreviewEntryUseCase.js.map +0 -1
- package/dist/usecase/render/RenderEntryLiveUseCase.d.ts +0 -36
- package/dist/usecase/render/RenderEntryLiveUseCase.d.ts.map +0 -1
- package/dist/usecase/render/RenderEntryLiveUseCase.js +0 -62
- package/dist/usecase/render/RenderEntryLiveUseCase.js.map +0 -1
- package/dist/usecase/render/RenderListLiveUseCase.d.ts +0 -25
- package/dist/usecase/render/RenderListLiveUseCase.d.ts.map +0 -1
- package/dist/usecase/render/RenderListLiveUseCase.js +0 -45
- package/dist/usecase/render/RenderListLiveUseCase.js.map +0 -1
- package/dist/usecase/render/index.d.ts +0 -7
- package/dist/usecase/render/index.d.ts.map +0 -1
- package/dist/usecase/render/index.js +0 -7
- package/dist/usecase/render/index.js.map +0 -1
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure render functions over the consumer-supplied template registry.
|
|
3
|
-
* Request-time public and preview renderers share this template lookup
|
|
4
|
-
* and doctype concatenation so the contract stays single-sourced
|
|
5
|
-
* — adding a doctype mode, an OG-meta wrapper, or a per-collection
|
|
6
|
-
* pre/post hook is one edit. No I/O; no DB; no env access.
|
|
7
|
-
*/
|
|
8
|
-
const DEFAULT_DOCTYPE = "<!doctype html>";
|
|
9
|
-
/** Returns the full HTML doc (doctype + body) or `null` if no entry
|
|
10
|
-
* template is registered for `entry.collection`. */
|
|
11
|
-
export function renderEntryHtml(args) {
|
|
12
|
-
const tpl = args.templates.getEntryTemplate(args.entry.collection);
|
|
13
|
-
if (!tpl)
|
|
14
|
-
return null;
|
|
15
|
-
return injectTrackingTags((args.doctype ?? DEFAULT_DOCTYPE) +
|
|
16
|
-
tpl({
|
|
17
|
-
entry: args.entry,
|
|
18
|
-
site: args.site,
|
|
19
|
-
mediaAssets: args.mediaAssets,
|
|
20
|
-
seo: args.seo,
|
|
21
|
-
}), args.site);
|
|
22
|
-
}
|
|
23
|
-
/** Returns the full HTML doc or `null` if no list template is
|
|
24
|
-
* registered for `collection`. */
|
|
25
|
-
export function renderListHtml(args) {
|
|
26
|
-
const tpl = args.templates.getListTemplate(args.collection);
|
|
27
|
-
if (!tpl)
|
|
28
|
-
return null;
|
|
29
|
-
return injectTrackingTags((args.doctype ?? DEFAULT_DOCTYPE) +
|
|
30
|
-
tpl({
|
|
31
|
-
collection: args.collection,
|
|
32
|
-
locale: args.locale,
|
|
33
|
-
entries: args.entries,
|
|
34
|
-
site: args.site,
|
|
35
|
-
mediaAssets: args.mediaAssets,
|
|
36
|
-
seo: args.seo,
|
|
37
|
-
}), args.site);
|
|
38
|
-
}
|
|
39
|
-
export function renderTrackingTagsHtml(site) {
|
|
40
|
-
const ga4Id = normalizeGa4MeasurementId(site.ga4MeasurementId);
|
|
41
|
-
const pixelId = normalizeFacebookPixelId(site.facebookPixelId);
|
|
42
|
-
const parts = [];
|
|
43
|
-
if (ga4Id) {
|
|
44
|
-
parts.push(`<script async src="https://www.googletagmanager.com/gtag/js?id=${ga4Id}"></script>`);
|
|
45
|
-
parts.push(`<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js',new Date());gtag('config','${ga4Id}');</script>`);
|
|
46
|
-
}
|
|
47
|
-
if (pixelId) {
|
|
48
|
-
parts.push(`<script>!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments);};if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s);}(window,document,'script','https://connect.facebook.net/en_US/fbevents.js');fbq('init','${pixelId}');fbq('track','PageView');</script>`);
|
|
49
|
-
parts.push(`<noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=${pixelId}&ev=PageView&noscript=1"/></noscript>`);
|
|
50
|
-
}
|
|
51
|
-
return parts.length > 0 ? `\n${parts.join("\n")}\n` : "";
|
|
52
|
-
}
|
|
53
|
-
function injectTrackingTags(html, site) {
|
|
54
|
-
const tags = renderTrackingTagsHtml(site);
|
|
55
|
-
if (!tags)
|
|
56
|
-
return html;
|
|
57
|
-
const headClose = /<\/head>/i;
|
|
58
|
-
if (headClose.test(html))
|
|
59
|
-
return html.replace(headClose, `${tags}</head>`);
|
|
60
|
-
const bodyOpen = /<body[^>]*>/i;
|
|
61
|
-
if (bodyOpen.test(html))
|
|
62
|
-
return html.replace(bodyOpen, (match) => `${match}${tags}`);
|
|
63
|
-
return `${tags}${html}`;
|
|
64
|
-
}
|
|
65
|
-
function normalizeGa4MeasurementId(value) {
|
|
66
|
-
const trimmed = value?.trim().toUpperCase() ?? "";
|
|
67
|
-
return /^G-[A-Z0-9]{4,32}$/.test(trimmed) ? trimmed : null;
|
|
68
|
-
}
|
|
69
|
-
function normalizeFacebookPixelId(value) {
|
|
70
|
-
const trimmed = value?.trim() ?? "";
|
|
71
|
-
return /^[0-9]{5,32}$/.test(trimmed) ? trimmed : null;
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=HtmlRenderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HtmlRenderer.js","sourceRoot":"","sources":["../../../src/domain/service/HtmlRenderer.ts"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAiB1C;qDACqD;AACrD,MAAM,UAAU,eAAe,CAAC,IAAqB;IACnD,MAAM,GAAG,GAA8B,IAAI,CAAC,SAAS,CAAC,gBAAgB,CACpE,IAAI,CAAC,KAAK,CAAC,UAAU,CACtB,CAAC;IACF,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,OAAO,kBAAkB,CACvB,CAAC,IAAI,CAAC,OAAO,IAAI,eAAe,CAAC;QAC/B,GAAG,CAAC;YACF,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAC,EACJ,IAAI,CAAC,IAAI,CACV,CAAC;AACJ,CAAC;AAaD;mCACmC;AACnC,MAAM,UAAU,cAAc,CAAC,IAAoB;IACjD,MAAM,GAAG,GAA6B,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtF,IAAI,CAAC,GAAG;Q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IAAI,CAAC;IACvB,MAAM,SAAS,GAAG,WAAW,CAAC;IAC9B,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,IAAI,SAAS,CAAC,CAAC;IAC3E,MAAM,QAAQ,GAAG,cAAc,CAAC;IAChC,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC;IACrF,OAAO,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;AAC1B,CAAC;AAED,SAAS,yBAAyB,CAAC,KAAyB;IAC1D,MAAM,OAAO,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;IAClD,OAAO,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7D,CAAC;AAED,SAAS,wBAAwB,CAAC,KAAyB;IACzD,MAAM,OAAO,GAAG,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACpC,OAAO,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AACxD,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { Entry, SiteConfig } from "@aotter/mantle-spec";
|
|
2
|
-
/**
|
|
3
|
-
* Built-in markdown serializer. Fixed format, applied to every entry
|
|
4
|
-
* whose Schema produces a `content` field. Intentionally not user-
|
|
5
|
-
* customizable — agents that consume `.md` mirrors and `/llms.txt`
|
|
6
|
-
* benefit from a predictable site-wide shape.
|
|
7
|
-
*
|
|
8
|
-
* ---
|
|
9
|
-
* title: ...
|
|
10
|
-
* description: ...
|
|
11
|
-
* slug: ...
|
|
12
|
-
* locale: ...
|
|
13
|
-
* publishedAt: ...
|
|
14
|
-
* ---
|
|
15
|
-
*
|
|
16
|
-
* # <title>
|
|
17
|
-
*
|
|
18
|
-
* > <description>
|
|
19
|
-
*
|
|
20
|
-
* <content>
|
|
21
|
-
*
|
|
22
|
-
* Entries without a `content` (or `body`) field skip the `.md`
|
|
23
|
-
* mirror — see `getMarkdownBody` below for the dual-field rule.
|
|
24
|
-
*
|
|
25
|
-
* Pure transformation — no I/O. Lives in `domain/service/`.
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* The canonical markdown source field. Spec-preferred name is
|
|
29
|
-
* `content`; the reference starter (and likely consumers cribbing
|
|
30
|
-
* from it) declares `body`. Both are markdown text under the hood;
|
|
31
|
-
* accept either everywhere a markdown payload is read so consumers
|
|
32
|
-
* don't have to choose. Single predicate so `serializeEntryAsMarkdown`,
|
|
33
|
-
* `serializeLlmsTxt`, and the article-signal heuristic stay in sync.
|
|
34
|
-
*/
|
|
35
|
-
export declare function getMarkdownBody(entry: Entry): string | null;
|
|
36
|
-
export declare function hasMarkdownBody(entry: Entry): boolean;
|
|
37
|
-
export declare function serializeEntryAsMarkdown(entry: Entry): string | null;
|
|
38
|
-
/**
|
|
39
|
-
* Per-locale `/llms.txt` index. One section per collection, one bullet
|
|
40
|
-
* per entry. The shape follows the llms.txt convention (Howard, 2024-11)
|
|
41
|
-
* so agent consumers can rely on a stable structure.
|
|
42
|
-
*/
|
|
43
|
-
export declare function serializeLlmsTxt(args: {
|
|
44
|
-
readonly site: SiteConfig;
|
|
45
|
-
readonly locale: string;
|
|
46
|
-
readonly entriesByCollection: ReadonlyMap<string, readonly Entry[]>;
|
|
47
|
-
}): string;
|
|
48
|
-
//# sourceMappingURL=MarkdownSerializer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownSerializer.d.ts","sourceRoot":"","sources":["../../../src/domain/service/MarkdownSerializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAG7D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAK3D;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAErD;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAsBpE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,mBAAmB,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC,CAAC;CACrE,GAAG,MAAM,CAsBT"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { absoluteUrl, appendMarkdownExt } from "./AbsoluteUrl.js";
|
|
2
|
-
/**
|
|
3
|
-
* Built-in markdown serializer. Fixed format, applied to every entry
|
|
4
|
-
* whose Schema produces a `content` field. Intentionally not user-
|
|
5
|
-
* customizable — agents that consume `.md` mirrors and `/llms.txt`
|
|
6
|
-
* benefit from a predictable site-wide shape.
|
|
7
|
-
*
|
|
8
|
-
* ---
|
|
9
|
-
* title: ...
|
|
10
|
-
* description: ...
|
|
11
|
-
* slug: ...
|
|
12
|
-
* locale: ...
|
|
13
|
-
* publishedAt: ...
|
|
14
|
-
* ---
|
|
15
|
-
*
|
|
16
|
-
* # <title>
|
|
17
|
-
*
|
|
18
|
-
* > <description>
|
|
19
|
-
*
|
|
20
|
-
* <content>
|
|
21
|
-
*
|
|
22
|
-
* Entries without a `content` (or `body`) field skip the `.md`
|
|
23
|
-
* mirror — see `getMarkdownBody` below for the dual-field rule.
|
|
24
|
-
*
|
|
25
|
-
* Pure transformation — no I/O. Lives in `domain/service/`.
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* The canonical markdown source field. Spec-preferred name is
|
|
29
|
-
* `content`; the reference starter (and likely consumers cribbing
|
|
30
|
-
* from it) declares `body`. Both are markdown text under the hood;
|
|
31
|
-
* accept either everywhere a markdown payload is read so consumers
|
|
32
|
-
* don't have to choose. Single predicate so `serializeEntryAsMarkdown`,
|
|
33
|
-
* `serializeLlmsTxt`, and the article-signal heuristic stay in sync.
|
|
34
|
-
*/
|
|
35
|
-
export function getMarkdownBody(entry) {
|
|
36
|
-
const data = entry.data;
|
|
37
|
-
if (typeof data["content"] === "string")
|
|
38
|
-
return data["content"];
|
|
39
|
-
if (typeof data["body"] === "string")
|
|
40
|
-
return data["body"];
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
export function hasMarkdownBody(entry) {
|
|
44
|
-
return getMarkdownBody(entry) !== null;
|
|
45
|
-
}
|
|
46
|
-
export function serializeEntryAsMarkdown(entry) {
|
|
47
|
-
const data = entry.data;
|
|
48
|
-
const content = getMarkdownBody(entry);
|
|
49
|
-
if (content == null)
|
|
50
|
-
return null;
|
|
51
|
-
const fm = [];
|
|
52
|
-
for (const k of ["title", "description", "slug", "locale", "publishedAt"]) {
|
|
53
|
-
const v = k === "locale" ? entry.locale : data[k];
|
|
54
|
-
if (typeof v === "string" && v.length > 0)
|
|
55
|
-
fm.push([k, v]);
|
|
56
|
-
}
|
|
57
|
-
const title = data["title"] ?? entry.id;
|
|
58
|
-
const description = data["description"];
|
|
59
|
-
let out = "---\n";
|
|
60
|
-
for (const [k, v] of fm)
|
|
61
|
-
out += `${k}: ${yamlScalar(v)}\n`;
|
|
62
|
-
out += "---\n\n";
|
|
63
|
-
out += `# ${title}\n\n`;
|
|
64
|
-
if (description)
|
|
65
|
-
out += `> ${description}\n\n`;
|
|
66
|
-
out += content;
|
|
67
|
-
if (!content.endsWith("\n"))
|
|
68
|
-
out += "\n";
|
|
69
|
-
return out;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Per-locale `/llms.txt` index. One section per collection, one bullet
|
|
73
|
-
* per entry. The shape follows the llms.txt convention (Howard, 2024-11)
|
|
74
|
-
* so agent consumers can rely on a stable structure.
|
|
75
|
-
*/
|
|
76
|
-
export function serializeLlmsTxt(args) {
|
|
77
|
-
const { site, locale, entriesByCollection } = args;
|
|
78
|
-
const urlLocale = locale.toLowerCase();
|
|
79
|
-
let out = `# ${site.title}\n\n`;
|
|
80
|
-
if (site.description)
|
|
81
|
-
out += `> ${site.description}\n\n`;
|
|
82
|
-
if (locale)
|
|
83
|
-
out += `Locale: ${locale}\n\n`;
|
|
84
|
-
for (const [collection, entries] of entriesByCollection) {
|
|
85
|
-
if (entries.length === 0)
|
|
86
|
-
continue;
|
|
87
|
-
out += `## ${collection}\n\n`;
|
|
88
|
-
for (const e of entries) {
|
|
89
|
-
if (!hasMarkdownBody(e))
|
|
90
|
-
continue;
|
|
91
|
-
const data = e.data;
|
|
92
|
-
const title = data["title"] ?? e.id;
|
|
93
|
-
const slug = data["slug"] ?? e.id;
|
|
94
|
-
const desc = data["description"] ?? "";
|
|
95
|
-
const localePrefix = urlLocale ? `/${urlLocale}` : "";
|
|
96
|
-
const url = appendMarkdownExt(absoluteUrl(site.origin, `${localePrefix}/${collection}/${slug}`));
|
|
97
|
-
out += desc ? `- [${title}](${url}): ${desc}\n` : `- [${title}](${url})\n`;
|
|
98
|
-
}
|
|
99
|
-
out += "\n";
|
|
100
|
-
}
|
|
101
|
-
return out;
|
|
102
|
-
}
|
|
103
|
-
function yamlScalar(s) {
|
|
104
|
-
if (/^[A-Za-z0-9._/-][\w. /:-]*$/.test(s) && !/^(true|false|null|yes|no|on|off)$/i.test(s)) {
|
|
105
|
-
return s;
|
|
106
|
-
}
|
|
107
|
-
return JSON.stringify(s);
|
|
108
|
-
}
|
|
109
|
-
//# sourceMappingURL=MarkdownSerializer.js.map
|
|
@@ -1 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CAAC;YACxB,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;gBAAE,SAAS;YAClC,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;YACpB,MAAM,KAAK,GAAI,IAAI,CAAC,OAAO,CAAwB,IAAI,CAAC,CAAC,EAAE,CAAC;YAC5D,MAAM,IAAI,GAAI,IAAI,CAAC,MAAM,CAAwB,IAAI,CAAC,CAAC,EAAE,CAAC;YAC1D,MAAM,IAAI,GAAI,IAAI,CAAC,aAAa,CAAwB,IAAI,EAAE,CAAC;YAC/D,MAAM,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACtD,MAAM,GAAG,GAAG,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,YAAY,IAAI,UAAU,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;YACjG,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,KAAK,GAAG,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,KAAK,GAAG,KAAK,CAAC;QAC7E,CAAC;QACD,GAAG,IAAI,IAAI,CAAC;IACd,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,IAAI,6BAA6B,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,oCAAoC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3F,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `Schema.metadata.name` → MCP per-collection tool name suffix.
|
|
3
|
-
* Lowercase + `kebab-` → `_snake`. Pure naming convention; the MCP
|
|
4
|
-
* tool catalog factory and the boot collision check both reference
|
|
5
|
-
* this so the rule lives in exactly one place.
|
|
6
|
-
*
|
|
7
|
-
* Lives in `domain/service/` (not `infrastructure/mcp/`) so the boot
|
|
8
|
-
* use case can call it without violating the usecase→infrastructure
|
|
9
|
-
* import rule.
|
|
10
|
-
*/
|
|
11
|
-
export declare function mcpToolNameSegment(collection: string): string;
|
|
12
|
-
/**
|
|
13
|
-
* Built-in MCP tool names registered by the dispatcher regardless of
|
|
14
|
-
* manifests. A Procedure exposed via `Trigger.source.kind: "mcp"`
|
|
15
|
-
* (#281) MUST NOT mangle to any of these names — the dispatcher
|
|
16
|
-
* routes by tool name and a collision would shadow the built-in.
|
|
17
|
-
*
|
|
18
|
-
* Mirror of the `name` fields in `McpToolCatalog.GENERIC_TOOLS` plus
|
|
19
|
-
* the two media tool names. Lives here so the boot validator can
|
|
20
|
-
* reference them without an infrastructure→usecase import.
|
|
21
|
-
*/
|
|
22
|
-
export declare const RESERVED_MCP_GENERIC_TOOL_NAMES: ReadonlySet<string>;
|
|
23
|
-
/**
|
|
24
|
-
* Prefixes the catalog factory uses for Schema- / View-derived tools.
|
|
25
|
-
* A Procedure tool name that starts with any of these would shadow
|
|
26
|
-
* (or be shadowed by) a Schema's create/update tool or a View's
|
|
27
|
-
* query tool, so boot rejects the manifest set with
|
|
28
|
-
* `MCP_TOOL_NAME_COLLISION`.
|
|
29
|
-
*/
|
|
30
|
-
export declare const RESERVED_MCP_TOOL_PREFIXES: readonly string[];
|
|
31
|
-
//# sourceMappingURL=McpToolNaming.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"McpToolNaming.d.ts","sourceRoot":"","sources":["../../../src/domain/service/McpToolNaming.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,+BAA+B,EAAE,WAAW,CAAC,MAAM,CAS9D,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAMvD,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `Schema.metadata.name` → MCP per-collection tool name suffix.
|
|
3
|
-
* Lowercase + `kebab-` → `_snake`. Pure naming convention; the MCP
|
|
4
|
-
* tool catalog factory and the boot collision check both reference
|
|
5
|
-
* this so the rule lives in exactly one place.
|
|
6
|
-
*
|
|
7
|
-
* Lives in `domain/service/` (not `infrastructure/mcp/`) so the boot
|
|
8
|
-
* use case can call it without violating the usecase→infrastructure
|
|
9
|
-
* import rule.
|
|
10
|
-
*/
|
|
11
|
-
export function mcpToolNameSegment(collection) {
|
|
12
|
-
return collection.toLowerCase().replace(/-/g, "_");
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Built-in MCP tool names registered by the dispatcher regardless of
|
|
16
|
-
* manifests. A Procedure exposed via `Trigger.source.kind: "mcp"`
|
|
17
|
-
* (#281) MUST NOT mangle to any of these names — the dispatcher
|
|
18
|
-
* routes by tool name and a collision would shadow the built-in.
|
|
19
|
-
*
|
|
20
|
-
* Mirror of the `name` fields in `McpToolCatalog.GENERIC_TOOLS` plus
|
|
21
|
-
* the two media tool names. Lives here so the boot validator can
|
|
22
|
-
* reference them without an infrastructure→usecase import.
|
|
23
|
-
*/
|
|
24
|
-
export const RESERVED_MCP_GENERIC_TOOL_NAMES = new Set([
|
|
25
|
-
"list_entries",
|
|
26
|
-
"get_entry",
|
|
27
|
-
"request_publish",
|
|
28
|
-
"unpublish_entry",
|
|
29
|
-
"archive_entry",
|
|
30
|
-
"delete_entry",
|
|
31
|
-
"create_media_upload",
|
|
32
|
-
"commit_media_upload",
|
|
33
|
-
]);
|
|
34
|
-
/**
|
|
35
|
-
* Prefixes the catalog factory uses for Schema- / View-derived tools.
|
|
36
|
-
* A Procedure tool name that starts with any of these would shadow
|
|
37
|
-
* (or be shadowed by) a Schema's create/update tool or a View's
|
|
38
|
-
* query tool, so boot rejects the manifest set with
|
|
39
|
-
* `MCP_TOOL_NAME_COLLISION`.
|
|
40
|
-
*/
|
|
41
|
-
export const RESERVED_MCP_TOOL_PREFIXES = [
|
|
42
|
-
"create_draft_",
|
|
43
|
-
"update_draft_",
|
|
44
|
-
"create_record_",
|
|
45
|
-
"update_record_",
|
|
46
|
-
"query_view_",
|
|
47
|
-
];
|
|
48
|
-
//# sourceMappingURL=McpToolNaming.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"McpToolNaming.js","sourceRoot":"","sources":["../../../src/domain/service/McpToolNaming.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAAC,UAAkB;IACnD,OAAO,UAAU,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACrD,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAwB,IAAI,GAAG,CAAC;IAC1E,cAAc;IACd,WAAW;IACX,iBAAiB;IACjB,iBAAiB;IACjB,eAAe;IACf,cAAc;IACd,qBAAqB;IACrB,qBAAqB;CACtB,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAsB;IAC3D,eAAe;IACf,eAAe;IACf,gBAAgB;IAChB,gBAAgB;IAChB,aAAa;CACd,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare function injectPreviewBanner(html: string, banner: string): string;
|
|
2
|
-
/**
|
|
3
|
-
* Build the SDK's default preview banner markup. Both `status` and
|
|
4
|
-
* `slug` are HTML-escaped — `status` is a closed enum so escaping is
|
|
5
|
-
* defense-in-depth, but `slug` is caller-supplied and a slug
|
|
6
|
-
* containing `<script>` would otherwise inject script into the
|
|
7
|
-
* preview surface.
|
|
8
|
-
*/
|
|
9
|
-
export declare function defaultPreviewBanner(status: string, slug: string): string;
|
|
10
|
-
//# sourceMappingURL=PreviewBanner.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewBanner.d.ts","sourceRoot":"","sources":["../../../src/domain/service/PreviewBanner.ts"],"names":[],"mappings":"AAgBA,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAExE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzE"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Inject a preview banner just inside the rendered `<body>`. Used by
|
|
3
|
-
* the request-time `?preview=1` route so authors can see in-progress
|
|
4
|
-
* drafts with a visible "this isn't published" mark.
|
|
5
|
-
*
|
|
6
|
-
* The injection looks for the first `<body...>` opening tag and
|
|
7
|
-
* appends `banner` immediately after it. Documents without a body tag
|
|
8
|
-
* (fragments, partial templates) fall through unchanged — the caller
|
|
9
|
-
* already validated the renderer produced a full HTML document, so a
|
|
10
|
-
* missing body is a contract violation, not user input.
|
|
11
|
-
*
|
|
12
|
-
* Pure string transformation. Lives in `domain/service/` so the
|
|
13
|
-
* regex (and any future DOM-safer replacement) stays in one place.
|
|
14
|
-
*/
|
|
15
|
-
const BODY_OPEN = /<body([^>]*)>/;
|
|
16
|
-
export function injectPreviewBanner(html, banner) {
|
|
17
|
-
return html.replace(BODY_OPEN, `<body$1>${banner}`);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Build the SDK's default preview banner markup. Both `status` and
|
|
21
|
-
* `slug` are HTML-escaped — `status` is a closed enum so escaping is
|
|
22
|
-
* defense-in-depth, but `slug` is caller-supplied and a slug
|
|
23
|
-
* containing `<script>` would otherwise inject script into the
|
|
24
|
-
* preview surface.
|
|
25
|
-
*/
|
|
26
|
-
export function defaultPreviewBanner(status, slug) {
|
|
27
|
-
return `<div class="preview-banner">Preview · ${escapeHtml(status)} · ${escapeHtml(slug)}</div>`;
|
|
28
|
-
}
|
|
29
|
-
import { escapeHtml } from "./HtmlEscaping.js";
|
|
30
|
-
//# sourceMappingURL=PreviewBanner.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewBanner.js","sourceRoot":"","sources":["../../../src/domain/service/PreviewBanner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,SAAS,GAAG,eAAe,CAAC;AAElC,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,MAAc;IAC9D,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,WAAW,MAAM,EAAE,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc,EAAE,IAAY;IAC/D,OAAO,yCAAyC,UAAU,CAAC,MAAM,CAAC,MAAM,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC;AACnG,CAAC;AACD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { type Entry } from "@aotter/mantle-spec";
|
|
2
|
-
export declare function entrySlug(entry: {
|
|
3
|
-
id: string;
|
|
4
|
-
data: Record<string, unknown>;
|
|
5
|
-
}): string;
|
|
6
|
-
export declare function entryPublicPath(entry: Entry): string;
|
|
7
|
-
/**
|
|
8
|
-
* Resolves a public URL path for an entry, given the consumer's
|
|
9
|
-
* collection→URL configuration. One source of truth for both the
|
|
10
|
-
* router (URL → collection/slug lookup) and outbound URL emission
|
|
11
|
-
* (sitemap, hreflang siblings, SEO canonical).
|
|
12
|
-
*
|
|
13
|
-
* The resolver's `forEntry` returns `null` when:
|
|
14
|
-
* - the entry's collection has no public URL (e.g. parent `posts`
|
|
15
|
-
* surfaces only via `post-translations` children)
|
|
16
|
-
* - the entry has no slug AND no canonical id-based URL pattern is
|
|
17
|
-
* configured for the collection
|
|
18
|
-
*
|
|
19
|
-
* Pure path math — no I/O. Lives in `domain/service/`.
|
|
20
|
-
*/
|
|
21
|
-
export interface CollectionRoute {
|
|
22
|
-
/** URL segment for entries of this collection.
|
|
23
|
-
*
|
|
24
|
-
* - non-empty string: `/{locale}/{segment}/{slug}` (e.g. `posts`)
|
|
25
|
-
* - empty string: `/{locale}/{slug}` (entries directly under locale)
|
|
26
|
-
* - null: collection has no public URL
|
|
27
|
-
*/
|
|
28
|
-
readonly segment: string | null;
|
|
29
|
-
/** When the entry's slug equals this value, collapse the URL to
|
|
30
|
-
* `/{locale}` (no trailing segment + slug). Used for home pages
|
|
31
|
-
* that live in a translations collection. */
|
|
32
|
-
readonly homeSlug?: string;
|
|
33
|
-
}
|
|
34
|
-
export interface PublicPathResolverConfig {
|
|
35
|
-
readonly collectionRoutes: Readonly<Record<string, CollectionRoute>>;
|
|
36
|
-
}
|
|
37
|
-
export interface PublicPathResolver {
|
|
38
|
-
/** Returns `/{locale}/{segment}/{slug}` style path, or `null` if the
|
|
39
|
-
* entry has no public URL under this configuration. */
|
|
40
|
-
forEntry(entry: Entry): string | null;
|
|
41
|
-
/** Returns the configured route for `collection`, or `undefined` if
|
|
42
|
-
* the collection isn't mapped. */
|
|
43
|
-
routeFor(collection: string): CollectionRoute | undefined;
|
|
44
|
-
}
|
|
45
|
-
export declare function createPublicPathResolver(config: PublicPathResolverConfig): PublicPathResolver;
|
|
46
|
-
//# sourceMappingURL=PublicPathResolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PublicPathResolver.d.ts","sourceRoot":"","sources":["../../../src/domain/service/PublicPathResolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE9D,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAAG,MAAM,CAMtF;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAIpD;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;kDAE8C;IAC9C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;CACtE;AAED,MAAM,WAAW,kBAAkB;IACjC;4DACwD;IACxD,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC;IACtC;uCACmC;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAC;CAC3D;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,wBAAwB,GAC/B,kBAAkB,CAmBpB"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { toUrlLocale } from "@aotter/mantle-spec";
|
|
2
|
-
export function entrySlug(entry) {
|
|
3
|
-
const fromData = entry.data["slug"];
|
|
4
|
-
if (typeof fromData === "string" && /^[a-z0-9][a-z0-9-]*$/.test(fromData)) {
|
|
5
|
-
return fromData;
|
|
6
|
-
}
|
|
7
|
-
return entry.id;
|
|
8
|
-
}
|
|
9
|
-
export function entryPublicPath(entry) {
|
|
10
|
-
const slug = entrySlug(entry);
|
|
11
|
-
if (entry.locale)
|
|
12
|
-
return `/${toUrlLocale(entry.locale)}/${entry.collection}/${slug}`;
|
|
13
|
-
return `/${entry.collection}/${slug}`;
|
|
14
|
-
}
|
|
15
|
-
export function createPublicPathResolver(config) {
|
|
16
|
-
const routes = config.collectionRoutes;
|
|
17
|
-
return {
|
|
18
|
-
forEntry(entry) {
|
|
19
|
-
const route = routes[entry.collection];
|
|
20
|
-
if (!route || route.segment === null)
|
|
21
|
-
return null;
|
|
22
|
-
const slug = entrySlug({ id: entry.id, data: entry.data });
|
|
23
|
-
const locale = entry.locale ? toUrlLocale(entry.locale) : "";
|
|
24
|
-
const localePrefix = locale ? `/${locale}` : "";
|
|
25
|
-
if (route.homeSlug && slug === route.homeSlug) {
|
|
26
|
-
return localePrefix || "/";
|
|
27
|
-
}
|
|
28
|
-
const segment = route.segment;
|
|
29
|
-
return segment ? `${localePrefix}/${segment}/${slug}` : `${localePrefix}/${slug}`;
|
|
30
|
-
},
|
|
31
|
-
routeFor(collection) {
|
|
32
|
-
return routes[collection];
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=PublicPathResolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PublicPathResolver.js","sourceRoot":"","sources":["../../../src/domain/service/PublicPathResolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,qBAAqB,CAAC;AAE9D,MAAM,UAAU,SAAS,CAAC,KAAoD;IAC5E,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,sBAAsB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1E,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO,KAAK,CAAC,EAAE,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAY;IAC1C,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9B,IAAI,KAAK,CAAC,MAAM;QAAE,OAAO,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;IACrF,OAAO,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;AAC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O meta blocks emitted on every public
|
|
5
|
-
* entry page. Carries the conventions a consumer otherwise re-invents
|
|
6
|
-
* — canonical, hreflang siblings, the `.md` mirror alternate that
|
|
7
|
-
* lets LLM crawlers grab clean markdown, og: + twitter card, JSON-LD
|
|
8
|
-
* structured data.
|
|
9
|
-
*
|
|
10
|
-
* The composer is pure — no I/O, no DB. The caller resolves the
|
|
11
|
-
* sibling translations (for hreflang) and passes them in. See
|
|
12
|
-
* `ComposeEntrySeoMetaUseCase` for the wired version that does the
|
|
13
|
-
* sibling-read.
|
|
14
|
-
*
|
|
15
|
-
* The shape of the result lives in `domain/model/SeoMeta` so
|
|
16
|
-
* `TemplateRegistry`'s `EntryContext.seo` can reference it without
|
|
17
|
-
* pulling service code into model.
|
|
18
|
-
*/
|
|
19
|
-
export type { SeoMeta } from "../model/SeoMeta.js";
|
|
20
|
-
export interface SiblingTranslation {
|
|
21
|
-
readonly locale: string;
|
|
22
|
-
readonly publicPath: string;
|
|
23
|
-
}
|
|
24
|
-
export interface ComposeEntrySeoMetaArgs {
|
|
25
|
-
readonly entry: Entry;
|
|
26
|
-
readonly site: SiteConfig;
|
|
27
|
-
/** The current entry's public path (already includes locale prefix).
|
|
28
|
-
* Composer prepends `site.origin` to absolutize. */
|
|
29
|
-
readonly publicPath: string;
|
|
30
|
-
/** Optional sibling translations for hreflang. The current entry's
|
|
31
|
-
* locale entry is added by the composer if not already present. */
|
|
32
|
-
readonly siblings?: ReadonlyArray<SiblingTranslation>;
|
|
33
|
-
/** og:type. Defaults to `article` when the entry has a `publishedAt`
|
|
34
|
-
* (or `updatedAt`) field, `website` otherwise. */
|
|
35
|
-
readonly type?: "article" | "website";
|
|
36
|
-
}
|
|
37
|
-
export declare function composeEntrySeoMeta(args: ComposeEntrySeoMetaArgs): SeoMeta;
|
|
38
|
-
/**
|
|
39
|
-
* Render the SEO meta block as an HTML fragment. Templates embed this
|
|
40
|
-
* verbatim inside `<head>` via `raw(renderSeoTagsHtml(seo))`.
|
|
41
|
-
*
|
|
42
|
-
* Order matters slightly for crawlers — canonical first, alternates
|
|
43
|
-
* (markdown then hreflang) before og:/twitter so the discoverability
|
|
44
|
-
* bones land before the rich-preview block.
|
|
45
|
-
*/
|
|
46
|
-
export declare function renderSeoTagsHtml(meta: SeoMeta): string;
|
|
47
|
-
//# sourceMappingURL=SeoMetaComposer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SeoMetaComposer.d.ts","sourceRoot":"","sources":["../../../src/domain/service/SeoMetaComposer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAKnD;;;;;;;;;;;;;;;GAeG;AACH,YAAY,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B;yDACqD;IACrD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;wEACoE;IACpE,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACtD;uDACmD;IACnD,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACvC;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAiD1E;AAmFD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CA8CvD"}
|