@aotter/mantle-runtime 0.1.0-alpha.7 → 0.1.0-alpha.8
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/HandlerRegistry.d.ts +1 -1
- package/dist/domain/port/IdGenerator.d.ts +1 -2
- 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 +10 -8
- 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/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 +3 -0
- package/dist/domain/service/TriggerIndex.d.ts.map +1 -1
- package/dist/domain/service/TriggerIndex.js +14 -1
- package/dist/domain/service/TriggerIndex.js.map +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/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 +15 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -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 +2 -4
- package/dist/infrastructure/boot/bootState.d.ts.map +1 -1
- package/dist/infrastructure/boot/bootState.js +1 -1
- package/dist/infrastructure/boot/bootState.js.map +1 -1
- package/dist/infrastructure/boot/canonicalMigrations.d.ts.map +1 -1
- package/dist/infrastructure/boot/canonicalMigrations.js +124 -60
- package/dist/infrastructure/boot/canonicalMigrations.js.map +1 -1
- package/dist/infrastructure/boot/index.d.ts +1 -0
- package/dist/infrastructure/boot/index.d.ts.map +1 -1
- package/dist/infrastructure/boot/index.js +1 -0
- 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 +2 -2
- package/dist/infrastructure/mcp/McpJsonRpcDispatcher.d.ts.map +1 -1
- package/dist/infrastructure/mcp/McpJsonRpcDispatcher.js +1 -1
- 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 +6 -7
- package/dist/infrastructure/mcp/McpToolCatalog.js.map +1 -1
- package/dist/infrastructure/persistence/DatabaseEntryRepository.d.ts +1 -1
- package/dist/infrastructure/persistence/DatabaseEntryRepository.d.ts.map +1 -1
- package/dist/infrastructure/persistence/DatabaseEntryRepository.js +1 -1
- package/dist/infrastructure/persistence/DatabaseEntryRepository.js.map +1 -1
- package/dist/infrastructure/persistence/DatabaseSiteConfigRepository.js +3 -3
- 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 -20
- 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 +4 -4
- package/dist/infrastructure/testing/IndexCoverageHarness.js.map +1 -1
- package/dist/usecase/boot/ValidateBootUseCase.d.ts +15 -38
- package/dist/usecase/boot/ValidateBootUseCase.d.ts.map +1 -1
- package/dist/usecase/boot/ValidateBootUseCase.js +79 -274
- 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/CreateDraftUseCase.d.ts +2 -2
- package/dist/usecase/content/CreateDraftUseCase.d.ts.map +1 -1
- package/dist/usecase/content/CreateDraftUseCase.js.map +1 -1
- package/dist/usecase/content/RequestPublishUseCase.d.ts +2 -2
- package/dist/usecase/content/RequestPublishUseCase.d.ts.map +1 -1
- 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.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 +2 -2
- package/dist/usecase/procedure/InvokeBuiltinUseCase.d.ts.map +1 -1
- package/dist/usecase/procedure/InvokeBuiltinUseCase.js.map +1 -1
- package/dist/usecase/site/UpdateSiteSettingsUseCase.d.ts.map +1 -1
- package/dist/usecase/site/UpdateSiteSettingsUseCase.js +8 -1
- 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 +19 -95
- 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 -49
- 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 -22
- 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 -38
- 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 -45
- package/dist/domain/service/MarkdownSerializer.d.ts.map +0 -1
- package/dist/domain/service/MarkdownSerializer.js +0 -154
- 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 -60
- package/dist/domain/service/SeoMetaComposer.d.ts.map +0 -1
- package/dist/domain/service/SeoMetaComposer.js +0 -213
- 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 -244
- 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 -145
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js +0 -224
- package/dist/runtime.js.map +0 -1
- package/dist/usecase/dto/render/ComposeEntrySeoMetaRequest.d.ts +0 -18
- 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 -13
- 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 -13
- 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 -18
- 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 -19
- 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 -15
- 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 -66
- package/dist/usecase/render/ComposeEntrySeoMetaUseCase.js.map +0 -1
- package/dist/usecase/render/ComposeLlmsTxtUseCase.d.ts +0 -18
- package/dist/usecase/render/ComposeLlmsTxtUseCase.d.ts.map +0 -1
- package/dist/usecase/render/ComposeLlmsTxtUseCase.js +0 -47
- 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 -38
- 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 -46
- 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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AbsoluteUrl.d.ts","sourceRoot":"","sources":["../../../src/domain/service/AbsoluteUrl.ts"],"names":[],"mappings":"AAcA,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAMhE;AAED;;6BAE6B;AAC7B,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAIhE"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Absolutize a path against a `SiteConfig.origin`. Single chokepoint
|
|
3
|
-
* so trailing-slash handling is consistent across every URL the SDK
|
|
4
|
-
* emits — sitemap, llms.txt mirrors, SEO canonical, hreflang siblings.
|
|
5
|
-
*
|
|
6
|
-
* Two divergent strip behaviors used to live across the codebase
|
|
7
|
-
* (`/\/$/` vs `/\/+$/`); both flow through here now.
|
|
8
|
-
*
|
|
9
|
-
* Empty `origin` returns the path unchanged — useful for tests and
|
|
10
|
-
* for templates that intentionally emit relative URLs. Already-
|
|
11
|
-
* absolute `path` (http(s)://...) returns unchanged.
|
|
12
|
-
*/
|
|
13
|
-
const TRAILING_SLASHES = /\/+$/;
|
|
14
|
-
export function absoluteUrl(origin, path) {
|
|
15
|
-
if (!origin)
|
|
16
|
-
return path;
|
|
17
|
-
if (path.startsWith("http://") || path.startsWith("https://"))
|
|
18
|
-
return path;
|
|
19
|
-
const cleanOrigin = origin.replace(TRAILING_SLASHES, "");
|
|
20
|
-
if (!path)
|
|
21
|
-
return cleanOrigin;
|
|
22
|
-
return `${cleanOrigin}${path.startsWith("/") ? "" : "/"}${path}`;
|
|
23
|
-
}
|
|
24
|
-
/** Append `.md` before any query string / hash. Used by the SEO
|
|
25
|
-
* composer + sitemap to derive markdown-mirror URLs without
|
|
26
|
-
* mangling query params. */
|
|
27
|
-
export function appendMarkdownExt(absoluteOrPath) {
|
|
28
|
-
const match = /^([^?#]*)(.*)$/.exec(absoluteOrPath);
|
|
29
|
-
if (!match)
|
|
30
|
-
return `${absoluteOrPath}.md`;
|
|
31
|
-
return `${match[1]}.md${match[2]}`;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=AbsoluteUrl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AbsoluteUrl.js","sourceRoot":"","sources":["../../../src/domain/service/AbsoluteUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEhC,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,IAAY;IACtD,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;QAAE,OAAO,IAAI,CAAC;IAC3E,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;IACzD,IAAI,CAAC,IAAI;QAAE,OAAO,WAAW,CAAC;IAC9B,OAAO,GAAG,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,EAAE,CAAC;AACnE,CAAC;AAED;;6BAE6B;AAC7B,MAAM,UAAU,iBAAiB,CAAC,cAAsB;IACtD,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACpD,IAAI,CAAC,KAAK;QAAE,OAAO,GAAG,cAAc,KAAK,CAAC;IAC1C,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HtmlEscaping.d.ts","sourceRoot":"","sources":["../../../src/domain/service/HtmlEscaping.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOhD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HtmlEscaping.js","sourceRoot":"","sources":["../../../src/domain/service/HtmlEscaping.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAO,KAAK;SACT,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { Entry, SiteConfig } from "@aotter/mantle-spec";
|
|
2
|
-
import type { TemplateRegistry } from "../model/TemplateRegistry.js";
|
|
3
|
-
import type { SeoMeta } from "../model/SeoMeta.js";
|
|
4
|
-
import type { MediaAsset } from "../port/MediaStorage.js";
|
|
5
|
-
export interface RenderEntryArgs {
|
|
6
|
-
readonly entry: Entry;
|
|
7
|
-
readonly site: SiteConfig;
|
|
8
|
-
readonly templates: TemplateRegistry;
|
|
9
|
-
/** Defaults to `<!doctype html>`. Pipelines that want the
|
|
10
|
-
* upper-case `<!DOCTYPE html>\n` shape pass it explicitly. */
|
|
11
|
-
readonly doctype?: string;
|
|
12
|
-
readonly mediaAssets?: ReadonlyMap<string, MediaAsset>;
|
|
13
|
-
/** Optional pre-composed SEO/AEO block. Threaded into the
|
|
14
|
-
* `EntryContext.seo` field so templates can emit `<SeoTags
|
|
15
|
-
* seo={seo}/>` inside `<head>`. Renderers that skip composition
|
|
16
|
-
* leave it undefined — opt-out templates keep working. */
|
|
17
|
-
readonly seo?: SeoMeta;
|
|
18
|
-
}
|
|
19
|
-
/** Returns the full HTML doc (doctype + body) or `null` if no entry
|
|
20
|
-
* template is registered for `entry.collection`. */
|
|
21
|
-
export declare function renderEntryHtml(args: RenderEntryArgs): string | null;
|
|
22
|
-
export interface RenderListArgs {
|
|
23
|
-
readonly collection: string;
|
|
24
|
-
readonly locale: string;
|
|
25
|
-
readonly entries: ReadonlyArray<Entry>;
|
|
26
|
-
readonly site: SiteConfig;
|
|
27
|
-
readonly templates: TemplateRegistry;
|
|
28
|
-
readonly doctype?: string;
|
|
29
|
-
readonly mediaAssets?: ReadonlyMap<string, MediaAsset>;
|
|
30
|
-
readonly seo?: SeoMeta;
|
|
31
|
-
}
|
|
32
|
-
/** Returns the full HTML doc or `null` if no list template is
|
|
33
|
-
* registered for `collection`. */
|
|
34
|
-
export declare function renderListHtml(args: RenderListArgs): string | null;
|
|
35
|
-
export declare function renderTrackingTagsHtml(site: SiteConfig): string;
|
|
36
|
-
export declare function normalizeGa4MeasurementId(value: string | undefined): string | null;
|
|
37
|
-
export declare function normalizeFacebookPixelId(value: string | undefined): string | null;
|
|
38
|
-
//# sourceMappingURL=HtmlRenderer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HtmlRenderer.d.ts","sourceRoot":"","sources":["../../../src/domain/service/HtmlRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAGV,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAW1D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IACrC;mEAC+D;IAC/D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACvD;;;+DAG2D;IAC3D,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;qDACqD;AACrD,wBAAgB,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,GAAG,IAAI,CAepE;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IACrC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACvD,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;mCACmC;AACnC,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CAelE;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAa/D;AAYD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAGlF;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAGjF"}
|
|
@@ -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
|
-
export function normalizeGa4MeasurementId(value) {
|
|
66
|
-
const trimmed = value?.trim().toUpperCase() ?? "";
|
|
67
|
-
return /^G-[A-Z0-9]{4,32}$/.test(trimmed) ? trimmed : null;
|
|
68
|
-
}
|
|
69
|
-
export 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.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AO,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,MAAM,UAAU,wBAAwB,CAAC,KAAyB;IAChE,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,45 +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 serializable public content skip the `.md` mirror.
|
|
23
|
-
*
|
|
24
|
-
* Pure transformation — no I/O. Lives in `domain/service/`.
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* `content`/`body` win, then structured sections, then a non-empty
|
|
28
|
-
* description/summary. One predicate keeps mirrors and metadata in sync.
|
|
29
|
-
*/
|
|
30
|
-
export declare function getMarkdownBody(entry: Entry): string | null;
|
|
31
|
-
export declare function hasMarkdownBody(entry: Entry): boolean;
|
|
32
|
-
export declare function getEntryDescription(entry: Entry): string | null;
|
|
33
|
-
export declare function serializeEntryAsMarkdown(entry: Entry): string | null;
|
|
34
|
-
/**
|
|
35
|
-
* Per-locale `/llms.txt` index. One section per collection, one bullet
|
|
36
|
-
* per entry. The shape follows the llms.txt convention (Howard, 2024-11)
|
|
37
|
-
* so agent consumers can rely on a stable structure.
|
|
38
|
-
*/
|
|
39
|
-
export declare function serializeLlmsTxt(args: {
|
|
40
|
-
readonly site: SiteConfig;
|
|
41
|
-
readonly locale: string;
|
|
42
|
-
readonly entriesByCollection: ReadonlyMap<string, readonly Entry[]>;
|
|
43
|
-
readonly pathFor: (entry: Entry) => string | null;
|
|
44
|
-
}): string | null;
|
|
45
|
-
//# 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;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAS3D;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAErD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAG/D;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAuBpE;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;IACpE,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,GAAG,IAAI,CAAC;CACnD,GAAG,MAAM,GAAG,IAAI,CAsBhB"}
|
|
@@ -1,154 +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 serializable public content skip the `.md` mirror.
|
|
23
|
-
*
|
|
24
|
-
* Pure transformation — no I/O. Lives in `domain/service/`.
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* `content`/`body` win, then structured sections, then a non-empty
|
|
28
|
-
* description/summary. One predicate keeps mirrors and metadata in sync.
|
|
29
|
-
*/
|
|
30
|
-
export function getMarkdownBody(entry) {
|
|
31
|
-
const data = entry.data;
|
|
32
|
-
for (const key of ["content", "body"]) {
|
|
33
|
-
const value = nonEmptyString(data[key]);
|
|
34
|
-
if (value)
|
|
35
|
-
return value;
|
|
36
|
-
}
|
|
37
|
-
const sections = serializeSections(data["sections"]);
|
|
38
|
-
if (sections)
|
|
39
|
-
return sections;
|
|
40
|
-
return getEntryDescription(entry);
|
|
41
|
-
}
|
|
42
|
-
export function hasMarkdownBody(entry) {
|
|
43
|
-
return getMarkdownBody(entry) !== null;
|
|
44
|
-
}
|
|
45
|
-
export function getEntryDescription(entry) {
|
|
46
|
-
return nonEmptyString(entry.data["description"])
|
|
47
|
-
?? nonEmptyString(entry.data["summary"]);
|
|
48
|
-
}
|
|
49
|
-
export function serializeEntryAsMarkdown(entry) {
|
|
50
|
-
const data = entry.data;
|
|
51
|
-
const content = getMarkdownBody(entry);
|
|
52
|
-
if (content == null)
|
|
53
|
-
return null;
|
|
54
|
-
const fm = [];
|
|
55
|
-
for (const k of ["title", "slug", "locale", "publishedAt"]) {
|
|
56
|
-
const v = k === "locale" ? entry.locale : data[k];
|
|
57
|
-
if (typeof v === "string" && v.length > 0)
|
|
58
|
-
fm.push([k, v]);
|
|
59
|
-
}
|
|
60
|
-
const title = data["title"] ?? entry.id;
|
|
61
|
-
const description = getEntryDescription(entry);
|
|
62
|
-
if (description)
|
|
63
|
-
fm.splice(1, 0, ["description", description]);
|
|
64
|
-
let out = "---\n";
|
|
65
|
-
for (const [k, v] of fm)
|
|
66
|
-
out += `${k}: ${yamlScalar(v)}\n`;
|
|
67
|
-
out += "---\n\n";
|
|
68
|
-
out += `# ${title}\n\n`;
|
|
69
|
-
if (description)
|
|
70
|
-
out += `> ${description}\n\n`;
|
|
71
|
-
out += content;
|
|
72
|
-
if (!content.endsWith("\n"))
|
|
73
|
-
out += "\n";
|
|
74
|
-
return out;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Per-locale `/llms.txt` index. One section per collection, one bullet
|
|
78
|
-
* per entry. The shape follows the llms.txt convention (Howard, 2024-11)
|
|
79
|
-
* so agent consumers can rely on a stable structure.
|
|
80
|
-
*/
|
|
81
|
-
export function serializeLlmsTxt(args) {
|
|
82
|
-
const { site, locale, entriesByCollection, pathFor } = args;
|
|
83
|
-
const sections = [];
|
|
84
|
-
for (const [collection, entries] of entriesByCollection) {
|
|
85
|
-
const bullets = [];
|
|
86
|
-
for (const e of entries) {
|
|
87
|
-
if (!hasMarkdownBody(e))
|
|
88
|
-
continue;
|
|
89
|
-
const data = e.data;
|
|
90
|
-
const title = data["title"] ?? e.id;
|
|
91
|
-
const path = pathFor(e);
|
|
92
|
-
if (!path)
|
|
93
|
-
continue;
|
|
94
|
-
const desc = getEntryDescription(e) ?? "";
|
|
95
|
-
const url = appendMarkdownExt(absoluteUrl(site.origin, path));
|
|
96
|
-
bullets.push(desc ? `- [${title}](${url}): ${desc}` : `- [${title}](${url})`);
|
|
97
|
-
}
|
|
98
|
-
if (bullets.length > 0)
|
|
99
|
-
sections.push(`## ${collection}\n\n${bullets.join("\n")}`);
|
|
100
|
-
}
|
|
101
|
-
if (sections.length === 0)
|
|
102
|
-
return null;
|
|
103
|
-
let out = `# ${site.title}\n\n`;
|
|
104
|
-
if (site.description)
|
|
105
|
-
out += `> ${site.description}\n\n`;
|
|
106
|
-
if (locale)
|
|
107
|
-
out += `Locale: ${locale}\n\n`;
|
|
108
|
-
return `${out}${sections.join("\n\n")}\n`;
|
|
109
|
-
}
|
|
110
|
-
function serializeSections(value) {
|
|
111
|
-
if (!Array.isArray(value))
|
|
112
|
-
return null;
|
|
113
|
-
const sections = value.map(serializeSection).filter((section) => section.length > 0);
|
|
114
|
-
return sections.length > 0 ? sections.join("\n\n") : null;
|
|
115
|
-
}
|
|
116
|
-
function serializeSection(value) {
|
|
117
|
-
if (!isRecord(value))
|
|
118
|
-
return "";
|
|
119
|
-
const heading = nonEmptyString(value["title"]);
|
|
120
|
-
const lines = heading ? [`## ${heading}`] : [];
|
|
121
|
-
for (const key of ["eyebrow", "body", "description", "quote", "value"]) {
|
|
122
|
-
const text = nonEmptyString(value[key]);
|
|
123
|
-
if (text && text !== heading)
|
|
124
|
-
lines.push(text);
|
|
125
|
-
}
|
|
126
|
-
if (Array.isArray(value["items"])) {
|
|
127
|
-
for (const item of value["items"]) {
|
|
128
|
-
if (!isRecord(item))
|
|
129
|
-
continue;
|
|
130
|
-
const title = nonEmptyString(item["title"]);
|
|
131
|
-
const body = nonEmptyString(item["body"])
|
|
132
|
-
?? nonEmptyString(item["description"])
|
|
133
|
-
?? nonEmptyString(item["quote"]);
|
|
134
|
-
if (title && body)
|
|
135
|
-
lines.push(`- **${title}:** ${body}`);
|
|
136
|
-
else if (title ?? body)
|
|
137
|
-
lines.push(`- ${title ?? body}`);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return lines.join("\n\n");
|
|
141
|
-
}
|
|
142
|
-
function nonEmptyString(value) {
|
|
143
|
-
return typeof value === "string" && value.trim() ? value : null;
|
|
144
|
-
}
|
|
145
|
-
function isRecord(value) {
|
|
146
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
147
|
-
}
|
|
148
|
-
function yamlScalar(s) {
|
|
149
|
-
if (/^[A-Za-z0-9._/-][\w. /:-]*$/.test(s) && !/^(true|false|null|yes|no|on|off)$/i.test(s)) {
|
|
150
|
-
return s;
|
|
151
|
-
}
|
|
152
|
-
return JSON.stringify(s);
|
|
153
|
-
}
|
|
154
|
-
//# sourceMappingURL=MarkdownSerializer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownSerializer.js","sourceRoot":"","sources":["../../../src/domain/service/MarkdownSerializer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAAY;IAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACxB,KAAK,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,CAAU,EAAE,CAAC;QAC/C,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACxC,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC;IAC1B,CAAC;IACD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,C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,KAAc;IACpC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAClE,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,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
|
|
@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