emdash 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/{apply-B4MsLM-w.mjs → apply-5uslYdUu.mjs} +174 -17
  2. package/dist/apply-5uslYdUu.mjs.map +1 -0
  3. package/dist/astro/index.d.mts +4 -4
  4. package/dist/astro/index.mjs +7 -3
  5. package/dist/astro/index.mjs.map +1 -1
  6. package/dist/astro/middleware/auth.d.mts +4 -4
  7. package/dist/astro/middleware/redirect.mjs +1 -1
  8. package/dist/astro/middleware/request-context.mjs +6 -1
  9. package/dist/astro/middleware/request-context.mjs.map +1 -1
  10. package/dist/astro/middleware.mjs +13 -12
  11. package/dist/astro/middleware.mjs.map +1 -1
  12. package/dist/astro/types.d.mts +13 -4
  13. package/dist/astro/types.d.mts.map +1 -1
  14. package/dist/cli/index.mjs +4 -4
  15. package/dist/{content-BsBoyj8G.mjs → content-D7J5y73J.mjs} +27 -1
  16. package/dist/{content-BsBoyj8G.mjs.map → content-D7J5y73J.mjs.map} +1 -1
  17. package/dist/db/index.d.mts +2 -2
  18. package/dist/db/index.mjs +1 -1
  19. package/dist/{index-BYv0mB9g.d.mts → index-De6_Xv3v.d.mts} +77 -3
  20. package/dist/index-De6_Xv3v.d.mts.map +1 -0
  21. package/dist/index.d.mts +4 -4
  22. package/dist/index.mjs +7 -7
  23. package/dist/media/local-runtime.d.mts +4 -4
  24. package/dist/plugins/adapt-sandbox-entry.d.mts +4 -4
  25. package/dist/{query-Bk_3vKvU.mjs → query-g4Ug-9j9.mjs} +3 -3
  26. package/dist/{query-Bk_3vKvU.mjs.map → query-g4Ug-9j9.mjs.map} +1 -1
  27. package/dist/{redirect-7lGhLBNZ.mjs → redirect-CN0Rt9Ob.mjs} +66 -10
  28. package/dist/redirect-CN0Rt9Ob.mjs.map +1 -0
  29. package/dist/{runner-Fl2NcUUz.d.mts → runner-BR2xKwhn.d.mts} +2 -2
  30. package/dist/{runner-Fl2NcUUz.d.mts.map → runner-BR2xKwhn.d.mts.map} +1 -1
  31. package/dist/{runner-Cd-_WyDo.mjs → runner-tQ7BJ4T7.mjs} +211 -134
  32. package/dist/runner-tQ7BJ4T7.mjs.map +1 -0
  33. package/dist/runtime.d.mts +4 -4
  34. package/dist/{search-DI4bM2w9.mjs → search-B0effn3j.mjs} +117 -23
  35. package/dist/search-B0effn3j.mjs.map +1 -0
  36. package/dist/seed/index.d.mts +2 -2
  37. package/dist/seed/index.mjs +3 -3
  38. package/dist/{taxonomies-DbrKzDju.mjs → taxonomies-K2z0Uhnj.mjs} +2 -2
  39. package/dist/{taxonomies-DbrKzDju.mjs.map → taxonomies-K2z0Uhnj.mjs.map} +1 -1
  40. package/dist/{types-8xrvl_68.d.mts → types-C2v0c34j.d.mts} +10 -1
  41. package/dist/{types-8xrvl_68.d.mts.map → types-C2v0c34j.d.mts.map} +1 -1
  42. package/dist/{validate-CaLH1Ia2.d.mts → validate-kM8Pjuf7.d.mts} +2 -2
  43. package/dist/{validate-CaLH1Ia2.d.mts.map → validate-kM8Pjuf7.d.mts.map} +1 -1
  44. package/dist/version-BnTKdfam.mjs +7 -0
  45. package/dist/{version-Uaf2ynPX.mjs.map → version-BnTKdfam.mjs.map} +1 -1
  46. package/package.json +5 -5
  47. package/src/api/handlers/content.ts +2 -0
  48. package/src/api/schemas/content.ts +8 -0
  49. package/src/astro/integration/font-provider.ts +3 -1
  50. package/src/astro/integration/index.ts +2 -0
  51. package/src/astro/integration/runtime.ts +55 -1
  52. package/src/astro/routes/admin.astro +14 -7
  53. package/src/astro/routes/api/auth/magic-link/send.ts +2 -1
  54. package/src/astro/routes/api/auth/passkey/options.ts +2 -1
  55. package/src/astro/routes/api/auth/signup/request.ts +26 -8
  56. package/src/astro/routes/api/comments/[collection]/[contentId]/index.ts +10 -6
  57. package/src/astro/routes/api/content/[collection]/[id]/compare.ts +1 -1
  58. package/src/astro/routes/api/content/[collection]/[id]/preview-url.ts +1 -1
  59. package/src/astro/routes/api/content/[collection]/[id]/revisions.ts +1 -1
  60. package/src/astro/routes/api/content/[collection]/[id]/translations.ts +26 -0
  61. package/src/astro/routes/api/content/[collection]/[id].ts +30 -2
  62. package/src/astro/routes/api/content/[collection]/index.ts +19 -1
  63. package/src/astro/routes/api/content/[collection]/trash.ts +1 -1
  64. package/src/astro/routes/api/import/wordpress-plugin/analyze.ts +4 -3
  65. package/src/astro/routes/api/import/wordpress-plugin/execute.ts +4 -3
  66. package/src/astro/routes/api/manifest.ts +7 -0
  67. package/src/astro/routes/api/oauth/device/code.ts +2 -1
  68. package/src/astro/routes/api/oauth/device/token.ts +2 -1
  69. package/src/astro/routes/api/setup/admin-verify.ts +30 -5
  70. package/src/astro/routes/api/setup/admin.ts +32 -8
  71. package/src/astro/routes/api/setup/index.ts +5 -2
  72. package/src/astro/types.ts +9 -0
  73. package/src/auth/rate-limit.ts +50 -22
  74. package/src/auth/setup-nonce.ts +22 -0
  75. package/src/auth/trusted-proxy.ts +92 -0
  76. package/src/database/migrations/035_bounded_404_log.ts +112 -0
  77. package/src/database/migrations/runner.ts +2 -0
  78. package/src/database/repositories/content.ts +39 -0
  79. package/src/database/repositories/options.ts +25 -0
  80. package/src/database/repositories/redirect.ts +111 -8
  81. package/src/database/types.ts +9 -0
  82. package/src/emdash-runtime.ts +3 -1
  83. package/src/import/registry.ts +4 -3
  84. package/src/import/ssrf.ts +253 -12
  85. package/src/mcp/server.ts +76 -3
  86. package/src/plugins/context.ts +15 -3
  87. package/src/plugins/manager.ts +6 -0
  88. package/src/plugins/request-meta.ts +66 -15
  89. package/src/plugins/routes.ts +3 -1
  90. package/src/seed/apply.ts +26 -0
  91. package/src/visual-editing/toolbar.ts +6 -1
  92. package/dist/apply-B4MsLM-w.mjs.map +0 -1
  93. package/dist/index-BYv0mB9g.d.mts.map +0 -1
  94. package/dist/redirect-7lGhLBNZ.mjs.map +0 -1
  95. package/dist/runner-Cd-_WyDo.mjs.map +0 -1
  96. package/dist/search-DI4bM2w9.mjs.map +0 -1
  97. package/dist/version-Uaf2ynPX.mjs +0 -7
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-De6_Xv3v.d.mts","names":[],"sources":["../src/database/connection.ts","../src/database/repositories/content.ts","../src/database/repositories/media.ts","../src/database/repositories/revision.ts","../src/database/repositories/comment.ts","../src/database/repositories/byline.ts","../src/fields/types.ts","../src/fields/image.ts","../src/fields/reference.ts","../src/fields/portable-text.ts","../src/api/types.ts","../src/api/handlers/content.ts","../src/api/handlers/manifest.ts","../src/api/handlers/revision.ts","../src/api/handlers/media.ts","../src/schema/registry.ts","../src/schema/query.ts","../src/sections/types.ts","../src/sections/index.ts","../src/plugins/sandbox/types.ts","../src/content/converters/types.ts","../src/content/converters/prosemirror-to-portable-text.ts","../src/content/converters/portable-text-to-prosemirror.ts","../src/utils/hash.ts","../src/utils/url.ts","../src/utils/slugify.ts","../src/visual-editing/editable.ts","../src/query.ts","../src/after.ts","../src/i18n/config.ts","../src/loader.ts","../src/cli/wxr/parser.ts","../src/plugins/define-plugin.ts","../src/auth/types.ts","../src/astro/storage/types.ts","../src/astro/integration/runtime.ts","../src/plugins/manifest-schema.ts","../src/plugins/hooks.ts","../src/plugins/email.ts","../src/plugins/context.ts","../src/plugins/routes.ts","../src/plugins/manager.ts","../src/plugins/sandbox/noop.ts","../src/import/types.ts","../src/import/sections.ts","../src/import/registry.ts","../src/import/sources/wxr.ts","../src/import/sources/wordpress-rest.ts","../src/preview/tokens.ts","../src/preview/urls.ts","../src/preview/helpers.ts","../src/settings/index.ts","../src/comments/query.ts","../src/menus/types.ts","../src/menus/index.ts","../src/bylines/index.ts","../src/taxonomies/types.ts","../src/taxonomies/index.ts","../src/widgets/types.ts","../src/widgets/index.ts","../src/search/types.ts","../src/search/fts-manager.ts","../src/search/query.ts","../src/search/text-extraction.ts"],"mappings":";;;;;;;;;;;;;;;UAMiB,cAAA;EAChB,GAAA;EACA,SAAA;AAAA;AAAA,cAGY,mBAAA,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;;;;;;;;E4DxmB3C,YAAA,CACL,cAAA,UACA,OAAA;IAAY,OAAA,GAAU,MAAA;EAAA,IACpB,OAAA;;;;;;EA6BG,aAAA,CAAc,cAAA,WAAyB,OAAA;E5D1OhC;;;E4DoPP,aAAA,CACL,cAAA,WACE,OAAA;IAAU,OAAA;IAAiB,WAAA;EAAA;E5DnJyC;;;;;;;E4D+KjE,oBAAA,CAAqB,cAAA,WAAyB,OAAA;E5D7ErC;;;;;;E4DsIT,kBAAA,CAAA,GAAsB,OAAA;AAAA;;;;;;;;;;A7D/a7B;;;;;AAKA;;;;;;;iB8DoCsB,MAAA,CAAO,KAAA,UAAe,OAAA,GAAS,aAAA,GAAqB,OAAA,CAAQ,cAAA;;;;;;;A7DqDlF;;;;;iB6DrCsB,YAAA,CACrB,EAAA,EAAI,MAAA,CAAO,QAAA,GACX,KAAA,UACA,OAAA,GAAS,aAAA,GACP,OAAA,CAAQ,cAAA;;;;;;;;;;;;;;;;;iBAgEW,gBAAA,CACrB,EAAA,EAAI,MAAA,CAAO,QAAA,GACX,UAAA,UACA,KAAA,UACA,OAAA,GAAS,uBAAA,GACP,OAAA,CAAQ,cAAA;;;;;;;;;iBA4GW,cAAA,CACrB,EAAA,EAAI,MAAA,CAAO,QAAA,GACX,KAAA,UACA,OAAA,GAAS,cAAA,GACP,OAAA,CAAQ,UAAA;;;;iBAqEW,cAAA,CAAe,EAAA,EAAI,MAAA,CAAO,QAAA,IAAY,OAAA,CAAQ,WAAA;;;;;;;;;;;A9DvTpE;;;;;AAKA;;;;;;;;iB+D2DgB,gBAAA,CAAiB,MAAA,EAAQ,mBAAA;;;;;;A9D8BzC;;;;iB8DsBgB,uBAAA,CACf,KAAA,EAAO,MAAA,mBACP,MAAA,aACE,MAAA"}
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { _ as MediaValue, n as generatePlaceholder, r as normalizeMediaValue, t as PlaceholderData } from "./placeholder-tzpqGWII.mjs";
2
- import { n as MediaTable, r as UserTable, t as Database } from "./types-8xrvl_68.mjs";
3
- import { $ as UpdateMenuInput, $n as TranslationSummary, $r as RevisionResponse, $t as SuggestedAction, A as getEntriesByTerm, Ai as reference, An as WxrTag, Ar as SandboxOptions, At as probeUrl, B as TaxonomyTerm, Bi as ContentRepository, Bn as getI18nConfig, Br as SectionSource, Bt as ImportContext, C as ReorderWidgetsInput, Ci as ApiContext, Cn as definePlugin, Cr as PortableTextTextBlock, Ct as parseWxrDate, D as WidgetComponentDef, Di as ListResponse, Dn as WxrData, Dr as ProseMirrorNode, Dt as getFileSources, E as WidgetArea, Ei as FieldDescriptor, En as WxrCategory, Er as ProseMirrorMark, Et as getAllSources, F as getTerm, Fi as ImageValue, Fn as EntryFilter, Fr as getSection, Ft as FetchOptions, G as getMenu, Gn as CollectionFilter, Gr as MediaListResponse, Gt as OAuthInput, H as UpdateTermInput, Hi as EmDashDatabaseError, Hn as WaitUntilFn, Hr as getCollectionInfo, Ht as ImportResult, I as getTermsForEntries, Ii as PortableTextBlock, Ir as getSections, It as FieldCompatibility, J as CreateMenuItemInput, Jn as EditFieldMeta, Jr as handleMediaDelete, Jt as ProbeResult, K as getMenus, Kn as CollectionResult, Kr as MediaResponse, Kt as PostTypeAnalysis, L as invalidateTermCache, Li as CreateMediaInput, Lr as CreateSectionInput, Lt as FileInput, M as getTaxonomyDef, Mi as FieldDefinition, Mn as parseWxrString, Mr as SandboxRunnerFactory, Mt as importReusableBlocksAsSections, N as getTaxonomyDefs, Ni as FieldUIHints, Nn as CollectionFilter$1, Nr as SandboxedPlugin, Nt as AttachmentInfo, O as WidgetType, Oi as ManifestResponse, On as WxrPost, Or as SandboxEmailMessage, Ot as getSource, P as getTaxonomyTerms, Pi as FileValue, Pn as EntryData, Pr as SerializedRequest, Pt as CollectionSchemaStatus, Q as ReorderMenuItemsInput, Qn as ResolvePathResult, Qr as RevisionListResponse, Qt as SourceProbeResult, R as CreateTermInput, Ri as MediaItem, Rn as I18nConfig, Rr as GetSectionsOptions, Rt as ImportAnalysis, S as PropDef, Si as handleContentUpdate, Sn as ExternalAuthConfig, Sr as PortableTextSpan, St as wordpressRestSource, T as Widget, Ti as ContentResponse, Tn as WxrAuthor, Tr as ProseMirrorDocument, Tt as clearSources, U as getByline, Un as after, Ur as SchemaError, Ut as ImportSource, V as TaxonomyTermRow, Vi as DatabaseConfig, Vn as isI18nEnabled, Vr as UpdateSectionInput, Vt as ImportFieldDef, W as getBylineBySlug, Wn as CacheHint, Wr as SchemaRegistry, Wt as NormalizedItem, X as MenuItem, Xn as EntryResult, Xr as handleMediaList, Xt as SourceCapabilities, Y as Menu, Yn as EmDashCollections, Yr as handleMediaGet, Yt as SourceAuth, Z as MenuItemType, Zn as InferCollectionData, Zr as handleMediaUpdate, Zt as SourceInput, _ as getWidgetArea, _i as handleContentRestore, _r as prosemirrorToPortableText, _t as VerifyPreviewTokenOptions, a as search, ai as handleContentCountScheduled, an as createPluginManager, ar as resolveEmDashPath, at as getPluginSetting, b as CreateWidgetAreaInput, bi as handleContentUnpublish, bn as AuthProviderModule, br as PortableTextLinkMark, bt as parseContentId, c as FTSManager, ci as handleContentDelete, cn as HookPipeline, cr as FieldAnnotation, ct as getSiteSettings, d as SearchOptions, di as handleContentGet, dn as ValidatedPluginManifest, dr as decodeSlug, dt as isPreviewRequest, ei as handleRevisionGet, en as UrlInput, er as TranslationsResult, et as UpdateMenuItemInput, f as SearchResponse, fi as handleContentGetIncludingTrashed, fn as pluginManifestSchema, fr as isSafeHref, ft as GetPreviewUrlOptions, g as Suggestion, gi as handleContentPublish, gr as portableTextToProsemirror, gt as PreviewTokenPayload, h as SuggestOptions, hi as handleContentPermanentDelete, hr as hashString, ht as GeneratePreviewTokenOptions, i as getSuggestions, ii as handleContentCompare, in as PluginManager, ir as getTranslations, it as getComments, j as getEntryTerms, ji as image, jn as parseWxr, jr as SandboxRunner, jt as registerSource, k as getAllTermsForEntries, ki as portableText, kn as WxrSite, kr as SandboxEmailSendCallback, kt as getUrlSources, l as CollectionSearchOptions, li as handleContentDiscardDraft, ln as HookResult, lr as createEditable, lt as setSiteSettings, m as SearchStats, mi as handleContentListTrashed, mn as PluginDescriptor, mr as computeContentHash, mt as getPreviewUrl, n as extractSearchableFields, ni as handleRevisionRestore, nn as SandboxNotAvailableError, nr as getEmDashCollection, nt as GetCommentsResult, o as searchCollection, oi as handleContentCountTrashed, on as PluginRouteError, or as CMSAnnotation, ot as getPluginSettings, p as SearchResult, pi as handleContentList, pr as sanitizeHref, pt as buildPreviewUrl, q as CreateMenuInput, qn as ContentEntry, qr as handleMediaCreate, qt as PostTypeMapping, r as getSearchStats, ri as generateManifest, rn as createNoopSandboxRunner, rr as getEmDashEntry, rt as getCommentCount, s as searchWithDb, si as handleContentCreate, sr as EditProxy, st as getSiteSetting, t as extractPlainText, ti as handleRevisionList, tn as NoopSandboxRunner, tr as getEditMeta, tt as GetCommentsOptions, u as SearchConfig, ui as handleContentDuplicate, un as createHookPipeline, ur as createNoop, ut as getPreviewToken, v as getWidgetAreas, vi as handleContentSchedule, vr as PortableTextCodeBlock, vt as VerifyPreviewTokenResult, w as UpdateWidgetInput, wi as ContentListResponse, wn as WxrAttachment, wr as PortableTextUnknownBlock, wt as wxrSource, x as CreateWidgetInput, xi as handleContentUnschedule, xn as AuthResult, xr as PortableTextMarkDef, xt as verifyPreviewToken, y as getWidgetComponents, yi as handleContentTranslations, yn as AuthDescriptor, yr as PortableTextImageBlock, yt as generatePreviewToken, z as TaxonomyDef, zi as MediaRepository, zn as getFallbackChain, zr as Section, zt as ImportConfig } from "./index-BYv0mB9g.mjs";
4
- import { n as getMigrationStatus, t as MigrationStatus } from "./runner-Fl2NcUUz.mjs";
2
+ import { n as MediaTable, r as UserTable, t as Database } from "./types-C2v0c34j.mjs";
3
+ import { $ as UpdateMenuInput, $n as TranslationSummary, $r as RevisionResponse, $t as SuggestedAction, A as getEntriesByTerm, Ai as reference, An as WxrTag, Ar as SandboxOptions, At as probeUrl, B as TaxonomyTerm, Bi as ContentRepository, Bn as getI18nConfig, Br as SectionSource, Bt as ImportContext, C as ReorderWidgetsInput, Ci as ApiContext, Cn as definePlugin, Cr as PortableTextTextBlock, Ct as parseWxrDate, D as WidgetComponentDef, Di as ListResponse, Dn as WxrData, Dr as ProseMirrorNode, Dt as getFileSources, E as WidgetArea, Ei as FieldDescriptor, En as WxrCategory, Er as ProseMirrorMark, Et as getAllSources, F as getTerm, Fi as ImageValue, Fn as EntryFilter, Fr as getSection, Ft as FetchOptions, G as getMenu, Gn as CollectionFilter, Gr as MediaListResponse, Gt as OAuthInput, H as UpdateTermInput, Hi as EmDashDatabaseError, Hn as WaitUntilFn, Hr as getCollectionInfo, Ht as ImportResult, I as getTermsForEntries, Ii as PortableTextBlock, Ir as getSections, It as FieldCompatibility, J as CreateMenuItemInput, Jn as EditFieldMeta, Jr as handleMediaDelete, Jt as ProbeResult, K as getMenus, Kn as CollectionResult, Kr as MediaResponse, Kt as PostTypeAnalysis, L as invalidateTermCache, Li as CreateMediaInput, Lr as CreateSectionInput, Lt as FileInput, M as getTaxonomyDef, Mi as FieldDefinition, Mn as parseWxrString, Mr as SandboxRunnerFactory, Mt as importReusableBlocksAsSections, N as getTaxonomyDefs, Ni as FieldUIHints, Nn as CollectionFilter$1, Nr as SandboxedPlugin, Nt as AttachmentInfo, O as WidgetType, Oi as ManifestResponse, On as WxrPost, Or as SandboxEmailMessage, Ot as getSource, P as getTaxonomyTerms, Pi as FileValue, Pn as EntryData, Pr as SerializedRequest, Pt as CollectionSchemaStatus, Q as ReorderMenuItemsInput, Qn as ResolvePathResult, Qr as RevisionListResponse, Qt as SourceProbeResult, R as CreateTermInput, Ri as MediaItem, Rn as I18nConfig, Rr as GetSectionsOptions, Rt as ImportAnalysis, S as PropDef, Si as handleContentUpdate, Sn as ExternalAuthConfig, Sr as PortableTextSpan, St as wordpressRestSource, T as Widget, Ti as ContentResponse, Tn as WxrAuthor, Tr as ProseMirrorDocument, Tt as clearSources, U as getByline, Un as after, Ur as SchemaError, Ut as ImportSource, V as TaxonomyTermRow, Vi as DatabaseConfig, Vn as isI18nEnabled, Vr as UpdateSectionInput, Vt as ImportFieldDef, W as getBylineBySlug, Wn as CacheHint, Wr as SchemaRegistry, Wt as NormalizedItem, X as MenuItem, Xn as EntryResult, Xr as handleMediaList, Xt as SourceCapabilities, Y as Menu, Yn as EmDashCollections, Yr as handleMediaGet, Yt as SourceAuth, Z as MenuItemType, Zn as InferCollectionData, Zr as handleMediaUpdate, Zt as SourceInput, _ as getWidgetArea, _i as handleContentRestore, _r as prosemirrorToPortableText, _t as VerifyPreviewTokenOptions, a as search, ai as handleContentCountScheduled, an as createPluginManager, ar as resolveEmDashPath, at as getPluginSetting, b as CreateWidgetAreaInput, bi as handleContentUnpublish, bn as AuthProviderModule, br as PortableTextLinkMark, bt as parseContentId, c as FTSManager, ci as handleContentDelete, cn as HookPipeline, cr as FieldAnnotation, ct as getSiteSettings, d as SearchOptions, di as handleContentGet, dn as ValidatedPluginManifest, dr as decodeSlug, dt as isPreviewRequest, ei as handleRevisionGet, en as UrlInput, er as TranslationsResult, et as UpdateMenuItemInput, f as SearchResponse, fi as handleContentGetIncludingTrashed, fn as pluginManifestSchema, fr as isSafeHref, ft as GetPreviewUrlOptions, g as Suggestion, gi as handleContentPublish, gr as portableTextToProsemirror, gt as PreviewTokenPayload, h as SuggestOptions, hi as handleContentPermanentDelete, hr as hashString, ht as GeneratePreviewTokenOptions, i as getSuggestions, ii as handleContentCompare, in as PluginManager, ir as getTranslations, it as getComments, j as getEntryTerms, ji as image, jn as parseWxr, jr as SandboxRunner, jt as registerSource, k as getAllTermsForEntries, ki as portableText, kn as WxrSite, kr as SandboxEmailSendCallback, kt as getUrlSources, l as CollectionSearchOptions, li as handleContentDiscardDraft, ln as HookResult, lr as createEditable, lt as setSiteSettings, m as SearchStats, mi as handleContentListTrashed, mn as PluginDescriptor, mr as computeContentHash, mt as getPreviewUrl, n as extractSearchableFields, ni as handleRevisionRestore, nn as SandboxNotAvailableError, nr as getEmDashCollection, nt as GetCommentsResult, o as searchCollection, oi as handleContentCountTrashed, on as PluginRouteError, or as CMSAnnotation, ot as getPluginSettings, p as SearchResult, pi as handleContentList, pr as sanitizeHref, pt as buildPreviewUrl, q as CreateMenuInput, qn as ContentEntry, qr as handleMediaCreate, qt as PostTypeMapping, r as getSearchStats, ri as generateManifest, rn as createNoopSandboxRunner, rr as getEmDashEntry, rt as getCommentCount, s as searchWithDb, si as handleContentCreate, sr as EditProxy, st as getSiteSetting, t as extractPlainText, ti as handleRevisionList, tn as NoopSandboxRunner, tr as getEditMeta, tt as GetCommentsOptions, u as SearchConfig, ui as handleContentDuplicate, un as createHookPipeline, ur as createNoop, ut as getPreviewToken, v as getWidgetAreas, vi as handleContentSchedule, vr as PortableTextCodeBlock, vt as VerifyPreviewTokenResult, w as UpdateWidgetInput, wi as ContentListResponse, wn as WxrAttachment, wr as PortableTextUnknownBlock, wt as wxrSource, x as CreateWidgetInput, xi as handleContentUnschedule, xn as AuthResult, xr as PortableTextMarkDef, xt as verifyPreviewToken, y as getWidgetComponents, yi as handleContentTranslations, yn as AuthDescriptor, yr as PortableTextImageBlock, yt as generatePreviewToken, z as TaxonomyDef, zi as MediaRepository, zn as getFallbackChain, zr as Section, zt as ImportConfig } from "./index-De6_Xv3v.mjs";
4
+ import { n as getMigrationStatus, t as MigrationStatus } from "./runner-BR2xKwhn.mjs";
5
5
  import { a as ContentSeoInput, c as FindManyOptions, i as ContentSeo, l as FindManyResult, n as ContentBylineCredit, o as CreateContentInput, r as ContentItem, s as EmDashValidationError, t as BylineSummary, u as UpdateContentInput } from "./types-6CUZRrZP.mjs";
6
6
  import { $ as StandardHookEntry, A as PageMetadataContribution, B as PluginDefinition, C as MediaAccess, D as PageFragmentContribution, E as ModerationDecision, F as PluginAdminConfig, G as PortableTextBlockConfig, H as PluginManifest, I as PluginAdminExports, K as PortableTextBlockField, L as PluginAdminPage, M as PageMetadataHandler, O as PageFragmentEvent, P as PagePlacement, Q as RouteContext, R as PluginCapability, S as LogAccess, T as MediaUploadEvent, U as PluginRoute, V as PluginHooks, W as PluginStorageConfig, X as ResolvedPlugin, Y as ResolvedHook, Z as ResolvedPluginHooks, _ as FieldWidgetConfig, a as CommentAfterModerateEvent, at as StoredComment, b as HttpAccess, c as CommentBeforeCreateHandler, d as ContentAccess, et as StandardHookHandler, f as ContentDeleteEvent, i as CommentAfterCreateHandler, it as StorageCollection, j as PageMetadataEvent, k as PageFragmentHandler, l as CommentModerateEvent, m as ContentPublishStateChangeEvent, n as CollectionCommentSettings, nt as StandardRouteEntry, o as CommentAfterModerateHandler, ot as isStandardPluginDefinition, p as ContentHookEvent, q as PublicPageContext, r as CommentAfterCreateEvent, rt as StandardRouteHandler, s as CommentBeforeCreateEvent, t as BreadcrumbItem, tt as StandardPluginDefinition, u as CommentModerateHandler, v as HookConfig, x as KVAccess, y as HookName, z as PluginContext } from "./types-DgrIP0tF.mjs";
7
7
  import { _ as RESERVED_COLLECTION_SLUGS, a as Collection, b as UpdateFieldInput, c as CollectionWithFields, d as CreateFieldInput, f as FIELD_TYPE_TO_COLUMN, g as FieldWidgetOptions, h as FieldValidation, i as SiteSettings, l as ColumnType, m as FieldType, n as SeoSettings, o as CollectionSource, p as Field, r as SiteSettingKey, s as CollectionSupport, t as MediaReference, u as CreateCollectionInput, v as RESERVED_FIELD_SLUGS, y as UpdateCollectionInput } from "./types-CnZYHyLW.mjs";
@@ -10,7 +10,7 @@ import { EmDashRequestContext, getRequestContext, runWithContext } from "./reque
10
10
  import { a as SqliteConfig, i as PostgresConfig, n as DatabaseDialectType, r as LibsqlConfig, t as DatabaseDescriptor } from "./adapters-Di31kZ28.mjs";
11
11
  import { adaptSandboxEntry } from "./plugins/adapt-sandbox-entry.mjs";
12
12
  import { SeoMeta, SeoMetaOptions, getContentSeo, getSeoMeta } from "./seo/index.mjs";
13
- import { _ as SeedTaxonomyTerm, a as applySeed, b as ValidationResult, c as SeedCollection, d as SeedFile, f as SeedMenu, g as SeedTaxonomy, l as SeedContentEntry, o as SeedApplyOptions, p as SeedMenuItem, s as SeedApplyResult, t as validateSeed, u as SeedField, v as SeedWidget, y as SeedWidgetArea } from "./validate-CaLH1Ia2.mjs";
13
+ import { _ as SeedTaxonomyTerm, a as applySeed, b as ValidationResult, c as SeedCollection, d as SeedFile, f as SeedMenu, g as SeedTaxonomy, l as SeedContentEntry, o as SeedApplyOptions, p as SeedMenuItem, s as SeedApplyResult, t as validateSeed, u as SeedField, v as SeedWidget, y as SeedWidgetArea } from "./validate-kM8Pjuf7.mjs";
14
14
  import "./seed/index.mjs";
15
15
  import { ulid } from "ulidx";
16
16
  export { type ApiContext, type AttachmentInfo, type AuthDescriptor, type AuthProviderModule, type AuthResult, type BreadcrumbItem, type BylineSummary, type CMSAnnotation, type CacheHint, type Collection, type CollectionCommentSettings, type CollectionFilter, type CollectionResult, type CollectionSchemaStatus, type CollectionSearchOptions, type CollectionSource, type CollectionSupport, type CollectionWithFields, type ColumnType, type CommentAfterCreateEvent, type CommentAfterCreateHandler, type CommentAfterModerateEvent, type CommentAfterModerateHandler, type CommentBeforeCreateEvent, type CommentBeforeCreateHandler, type CommentModerateEvent, type CommentModerateHandler, type ContentAccess, type ContentBylineCredit, type ContentDeleteEvent, type ContentEntry, type ContentHookEvent, type ContentItem, type ContentListResponse, type ContentPublishStateChangeEvent, ContentRepository, type ContentResponse, type ContentSeo, type ContentSeoInput, type CreateCollectionInput, type CreateContentInput, type CreateFieldInput, type CreateMediaInput, type CreateMenuInput, type CreateMenuItemInput, type CreateSectionInput, type CreateStorageFn, type CreateTermInput, type CreateWidgetAreaInput, type CreateWidgetInput, type Database, type DatabaseConfig, type DatabaseDescriptor, type DatabaseDialectType, type DownloadResult, type EditFieldMeta, type EditProxy, type EmDashCollections, EmDashDatabaseError, type EmDashRequestContext, EmDashStorageError, EmDashValidationError, type EntryData, type EntryFilter, type EntryResult, type ExternalAuthConfig, FIELD_TYPE_TO_COLUMN, FTSManager, type FetchOptions, type Field, type FieldAnnotation, type FieldCompatibility, type FieldDefinition, type FieldDescriptor, type FieldType, type FieldUIHints, type FieldValidation, type FieldWidgetConfig, type FieldWidgetOptions, type FileInfo, type FileInput, type FileValue, type FindManyOptions, type FindManyResult, type GeneratePreviewTokenOptions, type GetCommentsOptions, type GetCommentsResult, type GetPreviewUrlOptions, type GetSectionsOptions, type HookConfig, type HookName, HookPipeline, type HookResult, type HttpAccess, type I18nConfig, type ImageValue, type ImportAnalysis, type ImportConfig, type ImportContext, type ImportFieldDef, type ImportResult, type ImportSource, type InferCollectionData, type KVAccess, type LibsqlConfig, type ListOptions, type ListResponse, type ListResult, type CollectionFilter$1 as LoaderCollectionFilter, type LocalStorageConfig, type LogAccess, type ManifestResponse, type MediaAccess, type MediaItem, type MediaListResponse, type MediaReference, MediaRepository, type MediaResponse, type MediaTable, type MediaUploadEvent, type MediaValue, type Menu, type MenuItem, type MenuItemType, type MigrationStatus, type ModerationDecision, NoopSandboxRunner, type NormalizedItem, type OAuthInput, type PageFragmentContribution, type PageFragmentEvent, type PageFragmentHandler, type PageMetadataContribution, type PageMetadataEvent, type PageMetadataHandler, type PagePlacement, type PlaceholderData, type PluginAdminConfig, type PluginAdminExports, type PluginAdminPage, type PluginCapability, type PluginContext, type PluginDefinition, type PluginDescriptor, type PluginHooks, PluginManager, type PluginManifest, type PluginRoute, PluginRouteError, type PluginStorageConfig, type PortableTextBlock, type PortableTextBlockConfig, type PortableTextBlockField, type PortableTextCodeBlock, type PortableTextImageBlock, type PortableTextLinkMark, type PortableTextMarkDef, type PortableTextSpan, type PortableTextTextBlock, type PortableTextUnknownBlock, type PostTypeAnalysis, type PostTypeMapping, type PostgresConfig, type PreviewTokenPayload, type ProbeResult, type PropDef, type ProseMirrorDocument, type ProseMirrorMark, type ProseMirrorNode, type PublicPageContext, RESERVED_COLLECTION_SLUGS, RESERVED_FIELD_SLUGS, type ReorderMenuItemsInput, type ReorderWidgetsInput, type ResolvePathResult, type ResolvedHook, type ResolvedPlugin, type ResolvedPluginHooks, type RevisionListResponse, type RevisionResponse, type RouteContext, type S3StorageConfig, type SandboxEmailMessage, type SandboxEmailSendCallback, SandboxNotAvailableError, type SandboxOptions, type SandboxRunner, type SandboxRunnerFactory, type SandboxedPlugin, SchemaError, SchemaRegistry, type SearchConfig, type SearchOptions, type SearchResponse, type SearchResult, type SearchStats, type Section, type SectionSource, type SeedApplyOptions, type SeedApplyResult, type SeedCollection, type SeedContentEntry, type SeedField, type SeedFile, type SeedMenu, type SeedMenuItem, type SeedTaxonomy, type SeedTaxonomyTerm, type SeedWidget, type SeedWidgetArea, type SeoMeta, type SeoMetaOptions, type SeoSettings, type SerializedRequest, type SignedUploadOptions, type SignedUploadUrl, type SiteSettingKey, type SiteSettings, type SourceAuth, type SourceCapabilities, type SourceInput, type SourceProbeResult, type SqliteConfig, type StandardHookEntry, type StandardHookHandler, type StandardPluginDefinition, type StandardRouteEntry, type StandardRouteHandler, type Storage, type StorageCollection, type StorageDescriptor, type StoredComment, type SuggestOptions, type SuggestedAction, type Suggestion, type TaxonomyDef, type TaxonomyTerm, type TaxonomyTermRow, type TranslationSummary, type TranslationsResult, type UpdateCollectionInput, type UpdateContentInput, type UpdateFieldInput, type UpdateMenuInput, type UpdateMenuItemInput, type UpdateSectionInput, type UpdateTermInput, type UpdateWidgetInput, type UploadResult, type UrlInput, type UserTable, type ValidatedPluginManifest, type ValidationResult, type VerifyPreviewTokenOptions, type VerifyPreviewTokenResult, type WaitUntilFn, type Widget, type WidgetArea, type WidgetComponentDef, type WidgetType, type WxrAttachment, type WxrAuthor, type WxrCategory, type WxrData, type WxrPost, type WxrSite, type WxrTag, adaptSandboxEntry, after, applySeed, buildPreviewUrl, clearSources, computeContentHash, createEditable, createHookPipeline, createNoop, createNoopSandboxRunner, createPluginManager, decodeSlug, definePlugin, extractPlainText, extractSearchableFields, generateManifest, generatePlaceholder, generatePreviewToken, getAllSources, getAllTermsForEntries, getByline, getBylineBySlug, getCollectionInfo, getCommentCount, getComments, getContentSeo, getEditMeta, getEmDashCollection, getEmDashEntry, getEntriesByTerm, getEntryTerms, getFallbackChain, getFileSources, getI18nConfig, getMenu, getMenus, getMigrationStatus, getPluginSetting, getPluginSettings, getPreviewToken, getPreviewUrl, getRequestContext, getSearchStats, getSection, getSections, getSeoMeta, getSiteSetting, getSiteSettings, getSource, getSuggestions, getTaxonomyDef, getTaxonomyDefs, getTaxonomyTerms, getTerm, getTermsForEntries, getTranslations, getUrlSources, getWidgetArea, getWidgetAreas, getWidgetComponents, handleContentCompare, handleContentCountScheduled, handleContentCountTrashed, handleContentCreate, handleContentDelete, handleContentDiscardDraft, handleContentDuplicate, handleContentGet, handleContentGetIncludingTrashed, handleContentList, handleContentListTrashed, handleContentPermanentDelete, handleContentPublish, handleContentRestore, handleContentSchedule, handleContentTranslations, handleContentUnpublish, handleContentUnschedule, handleContentUpdate, handleMediaCreate, handleMediaDelete, handleMediaGet, handleMediaList, handleMediaUpdate, handleRevisionGet, handleRevisionList, handleRevisionRestore, hashString, image, importReusableBlocksAsSections, invalidateTermCache, isI18nEnabled, isPreviewRequest, isSafeHref, isStandardPluginDefinition, normalizeMediaValue, parseContentId, parseWxr, parseWxrDate, parseWxrString, pluginManifestSchema, portableText, portableTextToProsemirror, probeUrl, prosemirrorToPortableText, reference, registerSource, resolveEmDashPath, runWithContext, sanitizeHref, search, searchCollection, searchWithDb, setSiteSettings, ulid, validateSeed, verifyPreviewToken, wordpressRestSource, wxrSource };
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import { getRequestContext, runWithContext } from "./request-context.mjs";
2
2
  import { t as EmDashDatabaseError } from "./connection-2igzM-AT.mjs";
3
3
  import "./dialect-helpers-DhTzaUxP.mjs";
4
- import { t as getMigrationStatus } from "./runner-Cd-_WyDo.mjs";
5
- import { $ as isSafeHref, A as isStandardPluginDefinition, At as handleContentRestore, C as getAllSources, Ct as handleContentDuplicate, D as probeUrl, Dt as handleContentListTrashed, E as getUrlSources, Et as handleContentList, F as createPluginManager, Ft as handleContentUpdate, H as createHookPipeline, I as PluginRouteError, J as parseWxr, Lt as portableText, M as SandboxNotAvailableError, Mt as handleContentTranslations, N as createNoopSandboxRunner, Nt as handleContentUnpublish, O as registerSource, Ot as handleContentPermanentDelete, P as PluginManager, Pt as handleContentUnschedule, Q as prosemirrorToPortableText, Rt as reference, S as clearSources, St as handleContentDiscardDraft, T as getSource, Tt as handleContentGetIncludingTrashed, V as HookPipeline, X as after, Y as parseWxrString, Z as portableTextToProsemirror, _ as buildPreviewUrl, _t as handleContentCompare, a as search, at as getCollectionInfo, b as parseWxrDate, bt as handleContentCreate, c as getWidgetArea, ct as handleMediaGet, d as getMenu, dt as handleRevisionGet, et as sanitizeHref, f as getMenus, ft as handleRevisionList, g as isPreviewRequest, gt as hashString, h as getPreviewToken, ht as computeContentHash, i as getSuggestions, j as NoopSandboxRunner, jt as handleContentSchedule, k as importReusableBlocksAsSections, kt as handleContentPublish, l as getWidgetAreas, lt as handleMediaList, m as getComments, mt as generateManifest, n as extractSearchableFields, nt as getSection, o as searchCollection, ot as handleMediaCreate, p as getCommentCount, pt as handleRevisionRestore, q as definePlugin, r as getSearchStats, rt as getSections, s as searchWithDb, st as handleMediaDelete, t as extractPlainText, u as getWidgetComponents, ut as handleMediaUpdate, v as getPreviewUrl, vt as handleContentCountScheduled, w as getFileSources, wt as handleContentGet, x as wxrSource, xt as handleContentDelete, y as wordpressRestSource, yt as handleContentCountTrashed, zt as image } from "./search-DI4bM2w9.mjs";
6
- import { i as decodeSlug, t as ContentRepository } from "./content-BsBoyj8G.mjs";
4
+ import { t as getMigrationStatus } from "./runner-tQ7BJ4T7.mjs";
5
+ import { $ as prosemirrorToPortableText, A as isStandardPluginDefinition, At as handleContentPublish, Bt as image, C as getAllSources, Ct as handleContentDiscardDraft, D as probeUrl, Dt as handleContentList, E as getUrlSources, Et as handleContentGetIncludingTrashed, F as createPluginManager, Ft as handleContentUnschedule, H as createHookPipeline, I as PluginRouteError, It as handleContentUpdate, J as definePlugin, M as SandboxNotAvailableError, Mt as handleContentSchedule, N as createNoopSandboxRunner, Nt as handleContentTranslations, O as registerSource, Ot as handleContentListTrashed, P as PluginManager, Pt as handleContentUnpublish, Q as portableTextToProsemirror, Rt as portableText, S as clearSources, St as handleContentDelete, T as getSource, Tt as handleContentGet, V as HookPipeline, X as parseWxrString, Y as parseWxr, Z as after, _ as buildPreviewUrl, _t as hashString, a as search, b as parseWxrDate, bt as handleContentCountTrashed, c as getWidgetArea, ct as handleMediaDelete, d as getMenu, dt as handleMediaUpdate, et as isSafeHref, f as getMenus, ft as handleRevisionGet, g as isPreviewRequest, gt as computeContentHash, h as getPreviewToken, ht as generateManifest, i as getSuggestions, it as getSections, j as NoopSandboxRunner, jt as handleContentRestore, k as importReusableBlocksAsSections, kt as handleContentPermanentDelete, l as getWidgetAreas, lt as handleMediaGet, m as getComments, mt as handleRevisionRestore, n as extractSearchableFields, o as searchCollection, ot as getCollectionInfo, p as getCommentCount, pt as handleRevisionList, r as getSearchStats, rt as getSection, s as searchWithDb, st as handleMediaCreate, t as extractPlainText, tt as sanitizeHref, u as getWidgetComponents, ut as handleMediaList, v as getPreviewUrl, vt as handleContentCompare, w as getFileSources, wt as handleContentDuplicate, x as wxrSource, xt as handleContentCreate, y as wordpressRestSource, yt as handleContentCountScheduled, zt as reference } from "./search-B0effn3j.mjs";
6
+ import { i as decodeSlug, t as ContentRepository } from "./content-D7J5y73J.mjs";
7
7
  import "./base64-MBPo9ozB.mjs";
8
8
  import { t as EmDashValidationError } from "./types-CMMN0pNg.mjs";
9
9
  import { t as MediaRepository } from "./media-DqHVh136.mjs";
10
- import { c as getPluginSettings, d as setSiteSettings, l as getSiteSetting, s as getPluginSetting, t as applySeed, u as getSiteSettings } from "./apply-B4MsLM-w.mjs";
11
- import "./redirect-7lGhLBNZ.mjs";
10
+ import { c as getPluginSetting, d as getSiteSettings, f as setSiteSettings, l as getPluginSettings, t as applySeed, u as getSiteSetting } from "./apply-5uslYdUu.mjs";
11
+ import "./redirect-CN0Rt9Ob.mjs";
12
12
  import "./byline-C4OVd8b3.mjs";
13
13
  import { n as normalizeMediaValue, t as generatePlaceholder } from "./placeholder-C-fk5hYI.mjs";
14
14
  import { n as getI18nConfig, r as isI18nEnabled, t as getFallbackChain } from "./config-BXwuX8Bx.mjs";
@@ -16,10 +16,10 @@ import { i as FTSManager, n as SchemaRegistry, t as SchemaError } from "./regist
16
16
  import { i as RESERVED_FIELD_SLUGS, n as FIELD_TYPE_TO_COLUMN, r as RESERVED_COLLECTION_SLUGS } from "./types-DDS4MxsT.mjs";
17
17
  import "./loader-DeiBJEMe.mjs";
18
18
  import "./request-cache-DiR961CV.mjs";
19
- import { a as getTaxonomyDefs, c as getTermsForEntries, i as getTaxonomyDef, l as invalidateTermCache, n as getEntriesByTerm, o as getTaxonomyTerms, r as getEntryTerms, s as getTerm, t as getAllTermsForEntries } from "./taxonomies-DbrKzDju.mjs";
19
+ import { a as getTaxonomyDefs, c as getTermsForEntries, i as getTaxonomyDef, l as invalidateTermCache, n as getEntriesByTerm, o as getTaxonomyTerms, r as getEntryTerms, s as getTerm, t as getAllTermsForEntries } from "./taxonomies-K2z0Uhnj.mjs";
20
20
  import { i as pluginManifestSchema } from "./manifest-schema-V30qsMft.mjs";
21
21
  import { t as EmDashStorageError } from "./types-BH2L167P.mjs";
22
- import { c as createEditable, i as getTranslations, l as createNoop, n as getEmDashCollection, r as getEmDashEntry, s as resolveEmDashPath, t as getEditMeta } from "./query-Bk_3vKvU.mjs";
22
+ import { c as createEditable, i as getTranslations, l as createNoop, n as getEmDashCollection, r as getEmDashEntry, s as resolveEmDashPath, t as getEditMeta } from "./query-g4Ug-9j9.mjs";
23
23
  import { adaptSandboxEntry } from "./plugins/adapt-sandbox-entry.mjs";
24
24
  import { n as parseContentId, r as verifyPreviewToken, t as generatePreviewToken } from "./tokens-BFPFx3CA.mjs";
25
25
  import { getContentSeo, getSeoMeta } from "./seo/index.mjs";
@@ -1,10 +1,10 @@
1
1
  import { h as MediaProviderItem, o as CreateMediaProviderFn } from "../placeholder-tzpqGWII.mjs";
2
- import { t as Database } from "../types-8xrvl_68.mjs";
3
- import "../index-BYv0mB9g.mjs";
4
- import "../runner-Fl2NcUUz.mjs";
2
+ import { t as Database } from "../types-C2v0c34j.mjs";
3
+ import "../index-De6_Xv3v.mjs";
4
+ import "../runner-BR2xKwhn.mjs";
5
5
  import "../types-DgrIP0tF.mjs";
6
6
  import { d as Storage } from "../types-CFWjXmus.mjs";
7
- import "../validate-CaLH1Ia2.mjs";
7
+ import "../validate-kM8Pjuf7.mjs";
8
8
  import "../index.mjs";
9
9
  import { Kysely } from "kysely";
10
10
 
@@ -1,8 +1,8 @@
1
- import "../types-8xrvl_68.mjs";
2
- import { mn as PluginDescriptor } from "../index-BYv0mB9g.mjs";
3
- import "../runner-Fl2NcUUz.mjs";
1
+ import "../types-C2v0c34j.mjs";
2
+ import { mn as PluginDescriptor } from "../index-De6_Xv3v.mjs";
3
+ import "../runner-BR2xKwhn.mjs";
4
4
  import { X as ResolvedPlugin, tt as StandardPluginDefinition } from "../types-DgrIP0tF.mjs";
5
- import "../validate-CaLH1Ia2.mjs";
5
+ import "../validate-kM8Pjuf7.mjs";
6
6
 
7
7
  //#region src/plugins/adapt-sandbox-entry.d.ts
8
8
  /**
@@ -417,7 +417,7 @@ async function hydrateEntryBylines(type, entries) {
417
417
  async function hydrateEntryTerms(type, entries) {
418
418
  if (entries.length === 0) return;
419
419
  try {
420
- const { getAllTermsForEntries } = await import("./taxonomies-DbrKzDju.mjs").then((n) => n.u);
420
+ const { getAllTermsForEntries } = await import("./taxonomies-K2z0Uhnj.mjs").then((n) => n.u);
421
421
  const ids = entries.map((e) => dataStr(entryData(e), "id")).filter(Boolean);
422
422
  if (ids.length === 0) return;
423
423
  const termsMap = await getAllTermsForEntries(type, ids);
@@ -453,7 +453,7 @@ async function getTranslations(type, id) {
453
453
  try {
454
454
  const db = (await import("./loader-DeiBJEMe.mjs").then((n) => n.r)).getDb;
455
455
  const dbInstance = await db();
456
- const { ContentRepository } = await import("./content-BsBoyj8G.mjs").then((n) => n.n);
456
+ const { ContentRepository } = await import("./content-D7J5y73J.mjs").then((n) => n.n);
457
457
  const repo = new ContentRepository(dbInstance);
458
458
  const item = await repo.findByIdOrSlug(type, id);
459
459
  if (!item) return {
@@ -555,4 +555,4 @@ async function resolveEmDashPath(path) {
555
555
 
556
556
  //#endregion
557
557
  export { invalidateUrlPatternCache as a, createEditable as c, getTranslations as i, createNoop as l, getEmDashCollection as n, query_exports as o, getEmDashEntry as r, resolveEmDashPath as s, getEditMeta as t };
558
- //# sourceMappingURL=query-Bk_3vKvU.mjs.map
558
+ //# sourceMappingURL=query-g4Ug-9j9.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-Bk_3vKvU.mjs","names":[],"sources":["../src/visual-editing/editable.ts","../src/query.ts"],"sourcesContent":["/**\n * Visual editing annotation system\n *\n * Creates Proxy objects that emit data-emdash-ref attributes when spread onto elements.\n */\n\nexport interface CMSAnnotation {\n\tcollection: string;\n\tid: string;\n\tfield?: string;\n\t/** Entry status — only present on entry-level annotations (not field-level) */\n\tstatus?: string;\n\t/** Whether the entry has unpublished draft changes */\n\thasDraft?: boolean;\n}\n\n/** The shape returned when spreading an edit annotation onto an element */\nexport interface FieldAnnotation {\n\t\"data-emdash-ref\": string;\n}\n\nexport interface EditableOptions {\n\t/** Entry status: \"draft\", \"published\", \"scheduled\" */\n\tstatus?: string;\n\t/** true when draftRevisionId exists and differs from liveRevisionId */\n\thasDraft?: boolean;\n}\n\n/**\n * Create an editable proxy for an entry.\n *\n * Usage:\n * - `{...entry.edit}` - entry-level annotation (includes status/hasDraft)\n * - `{...entry.edit.title}` - field-level annotation\n * - `{...entry.edit['nested.field']}` - nested field (bracket notation)\n */\nexport function createEditable(\n\tcollection: string,\n\tid: string,\n\toptions?: EditableOptions,\n): EditProxy {\n\tconst base: CMSAnnotation = {\n\t\tcollection,\n\t\tid,\n\t\t...(options?.status && { status: options.status }),\n\t\t...(options?.hasDraft && { hasDraft: true }),\n\t};\n\n\treturn new Proxy({} as EditProxy, {\n\t\tget(_, prop) {\n\t\t\tif (prop === \"toJSON\") return () => ({ \"data-emdash-ref\": JSON.stringify(base) });\n\t\t\tif (typeof prop === \"symbol\") return undefined;\n\n\t\t\t// data-emdash-ref access returns the entry-level string\n\t\t\tif (prop === \"data-emdash-ref\") return JSON.stringify(base);\n\n\t\t\t// Field-level: return a FieldAnnotation for the specific field\n\t\t\treturn {\n\t\t\t\t\"data-emdash-ref\": JSON.stringify({ ...base, field: String(prop) }),\n\t\t\t} satisfies FieldAnnotation;\n\t\t},\n\t\townKeys() {\n\t\t\treturn [\"data-emdash-ref\"];\n\t\t},\n\t\tgetOwnPropertyDescriptor(_, prop) {\n\t\t\tif (prop === \"data-emdash-ref\") {\n\t\t\t\treturn {\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tvalue: JSON.stringify(base),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t});\n}\n\n/**\n * Create a noop proxy for production mode.\n * Spreading this produces no attributes.\n */\nexport function createNoop(): EditProxy {\n\treturn new Proxy({} as EditProxy, {\n\t\tget(_, prop) {\n\t\t\tif (typeof prop === \"symbol\") return undefined;\n\t\t\t// All property access returns undefined in noop mode\n\t\t\treturn undefined;\n\t\t},\n\t\townKeys() {\n\t\t\treturn [];\n\t\t},\n\t\tgetOwnPropertyDescriptor() {\n\t\t\treturn undefined;\n\t\t},\n\t});\n}\n\n/**\n * Visual editing proxy type.\n *\n * Spread directly onto elements for entry-level annotations: `{...entry.edit}`\n * Access a field for field-level annotations: `{...entry.edit.title}`\n *\n * In production, spreading produces no attributes (noop).\n */\nexport type EditProxy = {\n\treadonly [field: string]: Partial<FieldAnnotation>;\n};\n","/**\n * Query functions for EmDash content\n *\n * These wrap Astro's getLiveCollection/getLiveEntry with type filtering.\n * Use these instead of calling Astro's functions directly.\n *\n * Error handling follows Astro's pattern - returns { entries/entry, error }\n * so callers can gracefully handle errors (including 404s).\n *\n * Preview mode is handled implicitly via ALS request context —\n * no parameters needed. The middleware verifies the preview token\n * and sets the context; query functions read it automatically.\n */\n\nimport { getFallbackChain, getI18nConfig, isI18nEnabled } from \"./i18n/config.js\";\nimport { requestCached } from \"./request-cache.js\";\nimport { getRequestContext } from \"./request-context.js\";\nimport { isMissingTableError } from \"./utils/db-errors.js\";\nimport {\n\tcreateEditable,\n\tcreateNoop,\n\ttype EditProxy,\n\ttype EditableOptions,\n} from \"./visual-editing/editable.js\";\n\n/**\n * Collection type registry for type-safe queries.\n *\n * This interface is extended by the generated emdash-env.d.ts file\n * to provide type inference for collection names and their data shapes.\n *\n * @example\n * ```ts\n * // In emdash-env.d.ts (generated):\n * declare module \"emdash\" {\n * interface EmDashCollections {\n * posts: { title: string; content: PortableTextBlock[]; };\n * pages: { title: string; body: PortableTextBlock[]; };\n * }\n * }\n *\n * // Then in your code:\n * const { entries } = await getEmDashCollection(\"posts\");\n * // entries[0].data.title is typed as string\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface EmDashCollections {}\n\n/**\n * Helper type to infer the data type for a collection.\n * Returns the registered type if known, otherwise falls back to Record<string, unknown>.\n */\nexport type InferCollectionData<T extends string> = T extends keyof EmDashCollections\n\t? EmDashCollections[T]\n\t: Record<string, unknown>;\n\n/**\n * Sort direction\n */\nexport type SortDirection = \"asc\" | \"desc\";\n\n/**\n * Order by specification - field name to direction\n * @example { created_at: \"desc\" } - Sort by created_at descending\n * @example { title: \"asc\" } - Sort by title ascending\n * @example { published_at: \"desc\", title: \"asc\" } - Multi-field sort\n */\nexport type OrderBySpec = Record<string, SortDirection>;\n\nexport interface CollectionFilter {\n\tstatus?: \"draft\" | \"published\" | \"archived\";\n\tlimit?: number;\n\t/**\n\t * Opaque cursor for keyset pagination.\n\t * Pass the `nextCursor` value from a previous result to fetch the next page.\n\t * @example\n\t * ```ts\n\t * const cursor = Astro.url.searchParams.get(\"cursor\") ?? undefined;\n\t * const { entries, nextCursor } = await getEmDashCollection(\"posts\", {\n\t * limit: 10,\n\t * cursor,\n\t * });\n\t * ```\n\t */\n\tcursor?: string;\n\t/**\n\t * Filter by field values or taxonomy terms\n\t * @example { category: 'news' } - Filter by taxonomy term\n\t * @example { category: ['news', 'featured'] } - Filter by multiple terms (OR)\n\t */\n\twhere?: Record<string, string | string[]>;\n\t/**\n\t * Order results by field(s)\n\t * @default { created_at: \"desc\" }\n\t * @example { created_at: \"desc\" } - Sort by created_at descending (default)\n\t * @example { title: \"asc\" } - Sort by title ascending\n\t * @example { published_at: \"desc\", title: \"asc\" } - Multi-field sort\n\t */\n\torderBy?: OrderBySpec;\n\t/**\n\t * Filter by locale. When set, only returns entries in this locale.\n\t * Only relevant when i18n is configured.\n\t * @example \"en\" — English entries only\n\t * @example \"fr\" — French entries only\n\t */\n\tlocale?: string;\n}\n\nexport interface ContentEntry<T = Record<string, unknown>> {\n\tid: string;\n\tdata: T;\n\t/** Visual editing annotations. Spread onto elements: {...entry.edit.title} */\n\tedit: EditProxy;\n}\n\n/** Cache hint returned by the content loader for route caching */\nexport interface CacheHint {\n\ttags?: string[];\n\tlastModified?: Date;\n}\n\n/**\n * Result from getEmDashCollection\n */\nexport interface CollectionResult<T> {\n\t/** The entries (empty array if error or none found) */\n\tentries: ContentEntry<T>[];\n\t/** Error if the query failed */\n\terror?: Error;\n\t/** Cache hint for route caching (pass to Astro.cache.set()) */\n\tcacheHint: CacheHint;\n\t/**\n\t * Opaque cursor for the next page.\n\t * Undefined when there are no more results.\n\t * Pass this as `cursor` in the next query to get the next page.\n\t */\n\tnextCursor?: string;\n}\n\n/**\n * Result from getEmDashEntry\n */\nexport interface EntryResult<T> {\n\t/** The entry, or null if not found */\n\tentry: ContentEntry<T> | null;\n\t/** Error if the query failed (not set for \"not found\", only for actual errors) */\n\terror?: Error;\n\t/** Whether we're in preview mode (valid token was provided) */\n\tisPreview: boolean;\n\t/** Set when a fallback locale was used instead of the requested locale */\n\tfallbackLocale?: string;\n\t/** Cache hint for route caching (pass to Astro.cache.set()) */\n\tcacheHint: CacheHint;\n}\n\nconst COLLECTION_NAME = \"_emdash\";\n\n/** Symbol key for edit metadata on PT arrays — avoids collision with user data */\nconst EMDASH_EDIT = Symbol.for(\"__emdash\");\n\n/** Edit metadata attached to PT arrays in edit mode */\nexport interface EditFieldMeta {\n\tcollection: string;\n\tid: string;\n\tfield: string;\n}\n\n/** Type guard for EditFieldMeta */\nfunction isEditFieldMeta(value: unknown): value is EditFieldMeta {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tif (!(\"collection\" in value) || !(\"id\" in value) || !(\"field\" in value)) return false;\n\t// After `in` checks, TS narrows to Record<\"collection\" | \"id\" | \"field\", unknown>\n\tconst { collection, id, field } = value;\n\treturn typeof collection === \"string\" && typeof id === \"string\" && typeof field === \"string\";\n}\n\n/**\n * Read edit metadata from a value (returns undefined if not tagged).\n * Uses Object.getOwnPropertyDescriptor to access Symbol-keyed property\n * without an unsafe type assertion.\n */\nexport function getEditMeta(value: unknown): EditFieldMeta | undefined {\n\tif (value && typeof value === \"object\") {\n\t\tconst desc = Object.getOwnPropertyDescriptor(value, EMDASH_EDIT);\n\t\tconst meta: unknown = desc?.value;\n\t\tif (isEditFieldMeta(meta)) {\n\t\t\treturn meta;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/**\n * Tag PT-like arrays in entry data with edit metadata (non-enumerable).\n * A PT array is identified by: is an array, first element has _type property.\n */\nfunction tagEditableFields(data: Record<string, unknown>, collection: string, id: string): void {\n\tfor (const [field, value] of Object.entries(data)) {\n\t\tif (\n\t\t\tArray.isArray(value) &&\n\t\t\tvalue.length > 0 &&\n\t\t\tvalue[0] &&\n\t\t\ttypeof value[0] === \"object\" &&\n\t\t\t\"_type\" in value[0]\n\t\t) {\n\t\t\tObject.defineProperty(value, EMDASH_EDIT, {\n\t\t\t\tvalue: { collection, id, field } satisfies EditFieldMeta,\n\t\t\t\tenumerable: false,\n\t\t\t\tconfigurable: true,\n\t\t\t});\n\t\t}\n\t}\n}\n\n/** Safely read a string field from a Record, with optional fallback */\nfunction dataStr(data: Record<string, unknown>, key: string, fallback = \"\"): string {\n\tconst val = data[key];\n\treturn typeof val === \"string\" ? val : fallback;\n}\n\n/** Type guard for Record<string, unknown> */\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** Extract data as Record from an Astro entry (which is any-typed) */\nfunction entryData(entry: { data?: unknown }): Record<string, unknown> {\n\treturn isRecord(entry.data) ? entry.data : {};\n}\n\n/** Extract the database ID from entry data (data.id is the ULID, entry.id is the slug) */\nfunction entryDatabaseId(entry: { id: string; data?: unknown }): string {\n\tconst d = entryData(entry);\n\treturn dataStr(d, \"id\") || entry.id;\n}\n\n/** Extract edit options from entry data for the proxy */\nfunction entryEditOptions(entry: { data?: unknown }): EditableOptions {\n\tconst data = entryData(entry);\n\tconst status = dataStr(data, \"status\", \"draft\");\n\tconst draftRevisionId = dataStr(data, \"draftRevisionId\") || undefined;\n\tconst liveRevisionId = dataStr(data, \"liveRevisionId\") || undefined;\n\tconst hasDraft = !!draftRevisionId && draftRevisionId !== liveRevisionId;\n\treturn { status, hasDraft };\n}\n\n/**\n * Get all entries of a content type\n *\n * Returns { entries, error } for graceful error handling.\n *\n * When emdash-env.d.ts is generated, the collection name will be\n * type-checked and the return type will be inferred automatically.\n *\n * @example\n * ```ts\n * import { getEmDashCollection } from \"emdash\";\n *\n * const { entries: posts, error } = await getEmDashCollection(\"posts\");\n * if (error) {\n * console.error(\"Failed to load posts:\", error);\n * return;\n * }\n * // posts[0].data.title is typed (if emdash-env.d.ts exists)\n *\n * // With filters\n * const { entries: drafts } = await getEmDashCollection(\"posts\", { status: \"draft\" });\n * ```\n */\nexport async function getEmDashCollection<T extends string, D = InferCollectionData<T>>(\n\ttype: T,\n\tfilter?: CollectionFilter,\n): Promise<CollectionResult<D>> {\n\t// Cache per (type, filter) within a single request. Edit mode and\n\t// preview are request-scoped and stable, so they don't need to be\n\t// part of the key. Widgets and layouts frequently request the same\n\t// collection shape as the page itself (e.g. a \"recent posts\" list\n\t// appears on the home page AND in the sidebar) — caching collapses\n\t// those duplicate queries, along with the bylines and taxonomy-term\n\t// hydration each call would otherwise re-do.\n\treturn requestCached(collectionCacheKey(type, filter), () =>\n\t\tgetEmDashCollectionUncached<T, D>(type, filter),\n\t);\n}\n\n/**\n * Build a canonical cache key for `getEmDashCollection`.\n *\n * `JSON.stringify` is insertion-order-sensitive, so two callers passing\n * semantically identical filters with different key orders would miss\n * the cache. We fix the top-level field order and sort `where` keys\n * (order there is irrelevant), while preserving `orderBy` key order\n * because that's the sort priority.\n */\nfunction collectionCacheKey(type: string, filter?: CollectionFilter): string {\n\tif (!filter) return `collection:${type}:`;\n\tconst parts = [\n\t\tfilter.status ?? \"\",\n\t\tfilter.limit ?? \"\",\n\t\tfilter.cursor ?? \"\",\n\t\tfilter.where ? stableStringify(filter.where) : \"\",\n\t\tfilter.orderBy ? JSON.stringify(filter.orderBy) : \"\",\n\t\tfilter.locale ?? \"\",\n\t];\n\treturn `collection:${type}:${parts.join(\"|\")}`;\n}\n\nfunction stableStringify(value: Record<string, unknown>): string {\n\tconst keys = Object.keys(value).toSorted();\n\tconst ordered: Record<string, unknown> = {};\n\tfor (const k of keys) ordered[k] = value[k];\n\treturn JSON.stringify(ordered);\n}\n\nasync function getEmDashCollectionUncached<T extends string, D = InferCollectionData<T>>(\n\ttype: T,\n\tfilter?: CollectionFilter,\n): Promise<CollectionResult<D>> {\n\t// Dynamic import to avoid build-time issues\n\tconst { getLiveCollection } = await import(\"astro:content\");\n\n\t// Resolve locale: explicit filter > ALS context > defaultLocale (when i18n enabled)\n\t// Without this, queries return all locale rows, producing broken IDs\n\tconst ctx = getRequestContext();\n\tconst i18nConfig = getI18nConfig();\n\tconst resolvedLocale =\n\t\tfilter?.locale ?? ctx?.locale ?? (isI18nEnabled() ? i18nConfig!.defaultLocale : undefined);\n\n\tconst result = await getLiveCollection(COLLECTION_NAME, {\n\t\ttype,\n\t\tstatus: filter?.status,\n\t\tlimit: filter?.limit,\n\t\tcursor: filter?.cursor,\n\t\twhere: filter?.where,\n\t\torderBy: filter?.orderBy,\n\t\tlocale: resolvedLocale,\n\t});\n\n\tconst { entries, error, cacheHint } = result;\n\t// nextCursor is returned by the emdash loader but not part of Astro's base\n\t// LiveLoader return type. Extract it safely via property descriptor to avoid\n\t// an unsafe type assertion on the `any`-typed result object.\n\tconst rawCursor = Object.getOwnPropertyDescriptor(result, \"nextCursor\")?.value;\n\tconst nextCursor: string | undefined = typeof rawCursor === \"string\" ? rawCursor : undefined;\n\n\tif (error) {\n\t\treturn { entries: [], error, cacheHint: {} };\n\t}\n\n\tconst isEditMode = ctx?.editMode ?? false;\n\tconst entriesWithEdit = entries.map((entry: ContentEntry<D>) => {\n\t\tconst dbId = entryDatabaseId(entry);\n\t\tif (isEditMode) {\n\t\t\ttagEditableFields(entryData(entry), type, dbId);\n\t\t}\n\t\treturn {\n\t\t\t...entry,\n\t\t\tedit: isEditMode ? createEditable(type, dbId, entryEditOptions(entry)) : createNoop(),\n\t\t};\n\t});\n\n\t// Eagerly hydrate bylines and taxonomy terms for all entries in parallel.\n\t// Both are independent queries, so running them concurrently halves the\n\t// round-trip cost on remote databases (D1 replicas, etc.).\n\tawait Promise.all([\n\t\thydrateEntryBylines(type, entriesWithEdit),\n\t\thydrateEntryTerms(type, entriesWithEdit),\n\t]);\n\n\treturn { entries: entriesWithEdit, nextCursor, cacheHint: cacheHint ?? {} };\n}\n\n/**\n * Get a single entry by type and ID/slug\n *\n * Returns { entry, error, isPreview } for graceful error handling.\n * - entry is null if not found (not an error)\n * - error is set only for actual errors (db issues, etc.)\n *\n * Preview mode is detected automatically from request context (ALS).\n * When the URL has a valid `_preview` token, the middleware sets preview\n * context and this function serves draft revision data if available.\n *\n * @example\n * ```ts\n * import { getEmDashEntry } from \"emdash\";\n *\n * // Simple usage — preview just works via middleware\n * const { entry: post, isPreview, error } = await getEmDashEntry(\"posts\", \"my-slug\");\n * if (!post) return Astro.redirect(\"/404\");\n * ```\n */\nexport async function getEmDashEntry<T extends string, D = InferCollectionData<T>>(\n\ttype: T,\n\tid: string,\n\toptions?: { locale?: string },\n): Promise<EntryResult<D>> {\n\t// Dynamic import to avoid build-time issues\n\tconst { getLiveEntry } = await import(\"astro:content\");\n\n\t// Check ALS for preview and edit mode context\n\tconst ctx = getRequestContext();\n\tconst preview = ctx?.preview;\n\tconst isEditMode = ctx?.editMode ?? false;\n\tconst isPreviewMode = !!preview && preview.collection === type;\n\t// Edit mode implies preview — editors should see draft content\n\tconst serveDrafts = isPreviewMode || isEditMode;\n\n\t// Resolve locale: explicit option > ALS context > undefined (no filter)\n\tconst requestedLocale = options?.locale ?? ctx?.locale;\n\n\t/** Wrap a raw Astro entry with edit proxy, tagging editable fields if needed */\n\tfunction wrapEntry(raw: ContentEntry<D>): ContentEntry<D> {\n\t\tconst dbId = entryDatabaseId(raw);\n\t\tif (isEditMode) {\n\t\t\ttagEditableFields(entryData(raw), type, dbId);\n\t\t}\n\t\treturn {\n\t\t\t...raw,\n\t\t\tedit: isEditMode ? createEditable(type, dbId, entryEditOptions(raw)) : createNoop(),\n\t\t};\n\t}\n\n\t/** Check if an entry is publicly visible (published or scheduled past its time) */\n\tfunction isVisible(entry: ContentEntry<D>): boolean {\n\t\tconst data = entryData(entry);\n\t\tconst status = dataStr(data, \"status\");\n\t\tconst scheduledAt = dataStr(data, \"scheduledAt\") || undefined;\n\t\tconst isPublished = status === \"published\";\n\t\tconst isScheduledAndReady =\n\t\t\tstatus === \"scheduled\" && scheduledAt && new Date(scheduledAt) <= new Date();\n\t\treturn isPublished || !!isScheduledAndReady;\n\t}\n\n\t// Build the fallback chain: [requestedLocale, fallback1, ..., defaultLocale]\n\t// When i18n is disabled or no locale requested, just use a single-element chain\n\tconst localeChain =\n\t\trequestedLocale && isI18nEnabled() ? getFallbackChain(requestedLocale) : [requestedLocale];\n\n\t/** Return a successful EntryResult with bylines and taxonomy terms hydrated */\n\tasync function successResult(\n\t\twrapped: ContentEntry<D>,\n\t\topts: { isPreview: boolean; fallbackLocale?: string; cacheHint: CacheHint },\n\t): Promise<EntryResult<D>> {\n\t\tawait Promise.all([hydrateEntryBylines(type, [wrapped]), hydrateEntryTerms(type, [wrapped])]);\n\t\treturn {\n\t\t\tentry: wrapped,\n\t\t\tisPreview: opts.isPreview,\n\t\t\tfallbackLocale: opts.fallbackLocale,\n\t\t\tcacheHint: opts.cacheHint,\n\t\t};\n\t}\n\n\tif (serveDrafts) {\n\t\t// Draft mode: try each locale in the fallback chain\n\t\tfor (let i = 0; i < localeChain.length; i++) {\n\t\t\tconst locale = localeChain[i];\n\t\t\tconst fallbackLocale = i > 0 ? locale : undefined;\n\n\t\t\tconst {\n\t\t\t\tentry: baseEntry,\n\t\t\t\terror: baseError,\n\t\t\t\tcacheHint,\n\t\t\t} = await getLiveEntry(COLLECTION_NAME, {\n\t\t\t\ttype,\n\t\t\t\tid,\n\t\t\t\tlocale,\n\t\t\t});\n\n\t\t\tif (baseError) {\n\t\t\t\treturn { entry: null, error: baseError, isPreview: serveDrafts, cacheHint: {} };\n\t\t\t}\n\n\t\t\tif (!baseEntry) continue; // Try next locale in chain\n\n\t\t\t// Preview tokens are item-scoped: verify the resolved entry matches.\n\t\t\t// Edit mode (authenticated editors) has collection-wide draft access.\n\t\t\tif (isPreviewMode && !isEditMode) {\n\t\t\t\tconst dbId = entryDatabaseId(baseEntry);\n\t\t\t\tif (preview!.id !== dbId && preview!.id !== id) {\n\t\t\t\t\t// Token doesn't match — serve only if publicly visible, without draft access\n\t\t\t\t\tif (isVisible(baseEntry)) {\n\t\t\t\t\t\treturn successResult(wrapEntry(baseEntry), {\n\t\t\t\t\t\t\tisPreview: false,\n\t\t\t\t\t\t\tfallbackLocale,\n\t\t\t\t\t\t\tcacheHint: cacheHint ?? {},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\t// Not visible — try next locale in fallback chain\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Check if entry has a draft revision — if so, re-fetch with revision data\n\t\t\tconst baseData = entryData(baseEntry);\n\t\t\tconst draftRevisionId = dataStr(baseData, \"draftRevisionId\") || undefined;\n\n\t\t\tif (draftRevisionId) {\n\t\t\t\tconst { entry: draftEntry, error: draftError } = await getLiveEntry(COLLECTION_NAME, {\n\t\t\t\t\ttype,\n\t\t\t\t\tid,\n\t\t\t\t\trevisionId: draftRevisionId,\n\t\t\t\t\tlocale,\n\t\t\t\t});\n\n\t\t\t\tif (!draftError && draftEntry) {\n\t\t\t\t\treturn successResult(wrapEntry(draftEntry), {\n\t\t\t\t\t\tisPreview: serveDrafts,\n\t\t\t\t\t\tfallbackLocale,\n\t\t\t\t\t\tcacheHint: cacheHint ?? {},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn successResult(wrapEntry(baseEntry), {\n\t\t\t\tisPreview: serveDrafts,\n\t\t\t\tfallbackLocale,\n\t\t\t\tcacheHint: cacheHint ?? {},\n\t\t\t});\n\t\t}\n\n\t\t// No entry found in any locale\n\t\treturn { entry: null, isPreview: serveDrafts, cacheHint: {} };\n\t}\n\n\t// Normal mode: try each locale in the fallback chain, only return published content\n\tfor (let i = 0; i < localeChain.length; i++) {\n\t\tconst locale = localeChain[i];\n\t\tconst fallbackLocale = i > 0 ? locale : undefined;\n\n\t\tconst { entry, error, cacheHint } = await getLiveEntry(COLLECTION_NAME, { type, id, locale });\n\t\tif (error) {\n\t\t\treturn { entry: null, error, isPreview: false, cacheHint: {} };\n\t\t}\n\n\t\tif (entry && isVisible(entry)) {\n\t\t\treturn successResult(wrapEntry(entry), {\n\t\t\t\tisPreview: false,\n\t\t\t\tfallbackLocale,\n\t\t\t\tcacheHint: cacheHint ?? {},\n\t\t\t});\n\t\t}\n\t\t// Entry not found or not visible in this locale — try next\n\t}\n\n\treturn { entry: null, isPreview: false, cacheHint: {} };\n}\n\n/**\n * Eagerly hydrate byline data onto entry.data for one or more entries.\n *\n * Attaches `bylines` (array of ContentBylineCredit) and `byline`\n * (primary BylineSummary or null) to each entry's data object.\n * Uses batch queries to avoid N+1.\n *\n * Fails silently if the byline tables don't exist yet (pre-migration).\n */\nasync function hydrateEntryBylines<D>(type: string, entries: ContentEntry<D>[]): Promise<void> {\n\tif (entries.length === 0) return;\n\n\ttry {\n\t\tconst { getBylinesForEntries } = await import(\"./bylines/index.js\");\n\n\t\tconst ids = entries.map((e) => dataStr(entryData(e), \"id\")).filter(Boolean);\n\t\tif (ids.length === 0) return;\n\n\t\tconst bylinesMap = await getBylinesForEntries(type, ids);\n\n\t\tfor (const entry of entries) {\n\t\t\tconst data = entryData(entry);\n\t\t\tconst dbId = dataStr(data, \"id\");\n\t\t\tif (!dbId) continue;\n\n\t\t\tconst credits = bylinesMap.get(dbId) ?? [];\n\t\t\tdata.bylines = credits;\n\t\t\tdata.byline = credits[0]?.byline ?? null;\n\t\t}\n\t} catch (err) {\n\t\t// Only swallow \"table not found\" errors from pre-migration databases.\n\t\t// Matches SQLite/D1 (\"no such table\") and PostgreSQL (\"relation/table\n\t\t// ... does not exist\") via the shared helper.\n\t\tif (!isMissingTableError(err)) {\n\t\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\t\tconsole.warn(\"[emdash] Failed to hydrate bylines:\", msg);\n\t\t}\n\t}\n}\n\n/**\n * Eagerly hydrate taxonomy term data onto entry.data for one or more entries.\n *\n * Attaches `terms` (Record keyed by taxonomy name with an array of TaxonomyTerm\n * values) to each entry's data object. Uses a single batched JOIN query across\n * all taxonomies so the cost is O(1) regardless of the number of entries or\n * taxonomies on the site.\n *\n * This eliminates the common N+1 pattern where templates loop over list\n * results and call getEntryTerms() per entry. With hydration, the list page\n * stays at a single round-trip for term data.\n *\n * Fails silently if the taxonomy tables don't exist yet (pre-migration).\n */\nasync function hydrateEntryTerms<D>(type: string, entries: ContentEntry<D>[]): Promise<void> {\n\tif (entries.length === 0) return;\n\n\ttry {\n\t\tconst { getAllTermsForEntries } = await import(\"./taxonomies/index.js\");\n\n\t\tconst ids = entries.map((e) => dataStr(entryData(e), \"id\")).filter(Boolean);\n\t\tif (ids.length === 0) return;\n\n\t\tconst termsMap = await getAllTermsForEntries(type, ids);\n\n\t\tfor (const entry of entries) {\n\t\t\tconst data = entryData(entry);\n\t\t\tconst dbId = dataStr(data, \"id\");\n\t\t\tif (!dbId) continue;\n\n\t\t\tdata.terms = termsMap.get(dbId) ?? {};\n\t\t}\n\t} catch (err) {\n\t\t// Only swallow \"table not found\" errors from pre-migration databases.\n\t\t// Matches SQLite/D1 (\"no such table\") and PostgreSQL (\"relation/table\n\t\t// ... does not exist\") via the shared helper.\n\t\tif (!isMissingTableError(err)) {\n\t\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\t\tconsole.warn(\"[emdash] Failed to hydrate terms:\", msg);\n\t\t}\n\t}\n}\n\n/**\n * Translation summary for a single locale variant\n */\nexport interface TranslationSummary {\n\t/** Content item ID */\n\tid: string;\n\t/** Locale code (e.g. \"en\", \"fr\") */\n\tlocale: string;\n\t/** URL slug */\n\tslug: string | null;\n\t/** Current status */\n\tstatus: string;\n}\n\n/**\n * Result from getTranslations\n */\nexport interface TranslationsResult {\n\t/** The translation group ID (shared across locales) */\n\ttranslationGroup: string;\n\t/** All locale variants in this group */\n\ttranslations: TranslationSummary[];\n\t/** Error if the query failed */\n\terror?: Error;\n}\n\n/**\n * Get all translations of a content item.\n *\n * Given a content entry, returns all locale variants that share the same\n * translation group. This is useful for building language switcher UI.\n *\n * @example\n * ```ts\n * import { getEmDashEntry, getTranslations } from \"emdash\";\n *\n * const { entry: post } = await getEmDashEntry(\"posts\", \"hello-world\", { locale: \"en\" });\n * const { translations } = await getTranslations(\"posts\", post.data.id);\n * // translations = [{ id: \"...\", locale: \"en\", slug: \"hello-world\", status: \"published\" }, ...]\n * ```\n */\nexport async function getTranslations(type: string, id: string): Promise<TranslationsResult> {\n\ttry {\n\t\tconst db = (await import(\"./loader.js\")).getDb;\n\t\tconst dbInstance = await db();\n\t\tconst { ContentRepository } = await import(\"./database/repositories/content.js\");\n\t\tconst repo = new ContentRepository(dbInstance);\n\n\t\t// Find the item to get its translation group\n\t\tconst item = await repo.findByIdOrSlug(type, id);\n\t\tif (!item) {\n\t\t\treturn {\n\t\t\t\ttranslationGroup: \"\",\n\t\t\t\ttranslations: [],\n\t\t\t\terror: new Error(`Content item not found: ${id}`),\n\t\t\t};\n\t\t}\n\n\t\tconst group = item.translationGroup || item.id;\n\t\tconst translations = await repo.findTranslations(type, group);\n\n\t\treturn {\n\t\t\ttranslationGroup: group,\n\t\t\ttranslations: translations.map((t) => ({\n\t\t\t\tid: t.id,\n\t\t\t\tlocale: t.locale || \"en\",\n\t\t\t\tslug: t.slug,\n\t\t\t\tstatus: t.status,\n\t\t\t})),\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\ttranslationGroup: \"\",\n\t\t\ttranslations: [],\n\t\t\terror: error instanceof Error ? error : new Error(String(error)),\n\t\t};\n\t}\n}\n\n/**\n * Result from resolveEmDashPath\n */\nexport interface ResolvePathResult<T = Record<string, unknown>> {\n\t/** The matched entry */\n\tentry: ContentEntry<T>;\n\t/** The collection slug that matched */\n\tcollection: string;\n\t/** Extracted parameters from the URL pattern (e.g. { slug: \"my-post\" }) */\n\tparams: Record<string, string>;\n}\n\n/** Matches `{paramName}` placeholders in URL patterns */\nconst URL_PARAM_PATTERN = /\\{(\\w+)\\}/g;\n\n/** Convert a URL pattern like \"/blog/{slug}\" to a regex and param name list */\nfunction patternToRegex(pattern: string): { regex: RegExp; paramNames: string[] } {\n\tconst paramNames: string[] = [];\n\tconst regexStr = pattern.replace(URL_PARAM_PATTERN, (_match, name: string) => {\n\t\tparamNames.push(name);\n\t\treturn \"([^/]+)\";\n\t});\n\treturn { regex: new RegExp(`^${regexStr}$`), paramNames };\n}\n\n/** Cached compiled URL patterns for resolveEmDashPath */\ninterface CachedPattern {\n\tslug: string;\n\tregex: RegExp;\n\tparamNames: string[];\n}\nlet cachedUrlPatterns: CachedPattern[] | null = null;\n\n/**\n * Invalidate the cached URL patterns used by resolveEmDashPath.\n * Call when collection URL patterns change (schema updates).\n */\nexport function invalidateUrlPatternCache(): void {\n\tcachedUrlPatterns = null;\n}\n\n/**\n * Resolve a URL path to a content entry by matching against collection URL patterns.\n *\n * Loads all collections with a `urlPattern` set, converts each pattern to a regex,\n * and tests the given path. On match, extracts the slug and fetches the entry.\n *\n * @example\n * ```ts\n * import { resolveEmDashPath } from \"emdash\";\n *\n * // Given pages with urlPattern \"/{slug}\" and posts with \"/blog/{slug}\":\n * const result = await resolveEmDashPath(\"/blog/hello-world\");\n * if (result) {\n * console.log(result.collection); // \"posts\"\n * console.log(result.params.slug); // \"hello-world\"\n * console.log(result.entry.data); // post data\n * }\n * ```\n */\nexport async function resolveEmDashPath<T = Record<string, unknown>>(\n\tpath: string,\n): Promise<ResolvePathResult<T> | null> {\n\t// Build and cache compiled patterns on first call\n\tif (!cachedUrlPatterns) {\n\t\tconst { getDb } = await import(\"./loader.js\");\n\t\tconst { SchemaRegistry } = await import(\"./schema/registry.js\");\n\t\tconst db = await getDb();\n\t\tconst registry = new SchemaRegistry(db);\n\t\tconst collections = await registry.listCollections();\n\n\t\tcachedUrlPatterns = [];\n\t\tfor (const collection of collections) {\n\t\t\tif (!collection.urlPattern) continue;\n\t\t\tconst { regex, paramNames } = patternToRegex(collection.urlPattern);\n\t\t\tcachedUrlPatterns.push({ slug: collection.slug, regex, paramNames });\n\t\t}\n\t}\n\n\tfor (const pattern of cachedUrlPatterns) {\n\t\tconst match = path.match(pattern.regex);\n\t\tif (!match) continue;\n\n\t\t// Extract params\n\t\tconst params: Record<string, string> = {};\n\t\tfor (let i = 0; i < pattern.paramNames.length; i++) {\n\t\t\tparams[pattern.paramNames[i]] = match[i + 1];\n\t\t}\n\n\t\t// Look up entry by slug (most common pattern)\n\t\tconst slug = params.slug;\n\t\tif (!slug) continue;\n\n\t\tconst { entry } = await getEmDashEntry<string, T>(pattern.slug, slug);\n\t\tif (entry) {\n\t\t\treturn { entry, collection: pattern.slug, params };\n\t\t}\n\t}\n\n\treturn null;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoCA,SAAgB,eACf,YACA,IACA,SACY;CACZ,MAAM,OAAsB;EAC3B;EACA;EACA,GAAI,SAAS,UAAU,EAAE,QAAQ,QAAQ,QAAQ;EACjD,GAAI,SAAS,YAAY,EAAE,UAAU,MAAM;EAC3C;AAED,QAAO,IAAI,MAAM,EAAE,EAAe;EACjC,IAAI,GAAG,MAAM;AACZ,OAAI,SAAS,SAAU,eAAc,EAAE,mBAAmB,KAAK,UAAU,KAAK,EAAE;AAChF,OAAI,OAAO,SAAS,SAAU,QAAO;AAGrC,OAAI,SAAS,kBAAmB,QAAO,KAAK,UAAU,KAAK;AAG3D,UAAO,EACN,mBAAmB,KAAK,UAAU;IAAE,GAAG;IAAM,OAAO,OAAO,KAAK;IAAE,CAAC,EACnE;;EAEF,UAAU;AACT,UAAO,CAAC,kBAAkB;;EAE3B,yBAAyB,GAAG,MAAM;AACjC,OAAI,SAAS,kBACZ,QAAO;IACN,cAAc;IACd,YAAY;IACZ,OAAO,KAAK,UAAU,KAAK;IAC3B;;EAIH,CAAC;;;;;;AAOH,SAAgB,aAAwB;AACvC,QAAO,IAAI,MAAM,EAAE,EAAe;EACjC,IAAI,GAAG,MAAM;AACZ,OAAI,OAAO,SAAS,SAAU,QAAO;;EAItC,UAAU;AACT,UAAO,EAAE;;EAEV,2BAA2B;EAG3B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;AC8DH,MAAM,kBAAkB;;AAGxB,MAAM,cAAc,OAAO,IAAI,WAAW;;AAU1C,SAAS,gBAAgB,OAAwC;AAChE,KAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,KAAI,EAAE,gBAAgB,U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,"file":"query-g4Ug-9j9.mjs","names":[],"sources":["../src/visual-editing/editable.ts","../src/query.ts"],"sourcesContent":["/**\n * Visual editing annotation system\n *\n * Creates Proxy objects that emit data-emdash-ref attributes when spread onto elements.\n */\n\nexport interface CMSAnnotation {\n\tcollection: string;\n\tid: string;\n\tfield?: string;\n\t/** Entry status — only present on entry-level annotations (not field-level) */\n\tstatus?: string;\n\t/** Whether the entry has unpublished draft changes */\n\thasDraft?: boolean;\n}\n\n/** The shape returned when spreading an edit annotation onto an element */\nexport interface FieldAnnotation {\n\t\"data-emdash-ref\": string;\n}\n\nexport interface EditableOptions {\n\t/** Entry status: \"draft\", \"published\", \"scheduled\" */\n\tstatus?: string;\n\t/** true when draftRevisionId exists and differs from liveRevisionId */\n\thasDraft?: boolean;\n}\n\n/**\n * Create an editable proxy for an entry.\n *\n * Usage:\n * - `{...entry.edit}` - entry-level annotation (includes status/hasDraft)\n * - `{...entry.edit.title}` - field-level annotation\n * - `{...entry.edit['nested.field']}` - nested field (bracket notation)\n */\nexport function createEditable(\n\tcollection: string,\n\tid: string,\n\toptions?: EditableOptions,\n): EditProxy {\n\tconst base: CMSAnnotation = {\n\t\tcollection,\n\t\tid,\n\t\t...(options?.status && { status: options.status }),\n\t\t...(options?.hasDraft && { hasDraft: true }),\n\t};\n\n\treturn new Proxy({} as EditProxy, {\n\t\tget(_, prop) {\n\t\t\tif (prop === \"toJSON\") return () => ({ \"data-emdash-ref\": JSON.stringify(base) });\n\t\t\tif (typeof prop === \"symbol\") return undefined;\n\n\t\t\t// data-emdash-ref access returns the entry-level string\n\t\t\tif (prop === \"data-emdash-ref\") return JSON.stringify(base);\n\n\t\t\t// Field-level: return a FieldAnnotation for the specific field\n\t\t\treturn {\n\t\t\t\t\"data-emdash-ref\": JSON.stringify({ ...base, field: String(prop) }),\n\t\t\t} satisfies FieldAnnotation;\n\t\t},\n\t\townKeys() {\n\t\t\treturn [\"data-emdash-ref\"];\n\t\t},\n\t\tgetOwnPropertyDescriptor(_, prop) {\n\t\t\tif (prop === \"data-emdash-ref\") {\n\t\t\t\treturn {\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tvalue: JSON.stringify(base),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t});\n}\n\n/**\n * Create a noop proxy for production mode.\n * Spreading this produces no attributes.\n */\nexport function createNoop(): EditProxy {\n\treturn new Proxy({} as EditProxy, {\n\t\tget(_, prop) {\n\t\t\tif (typeof prop === \"symbol\") return undefined;\n\t\t\t// All property access returns undefined in noop mode\n\t\t\treturn undefined;\n\t\t},\n\t\townKeys() {\n\t\t\treturn [];\n\t\t},\n\t\tgetOwnPropertyDescriptor() {\n\t\t\treturn undefined;\n\t\t},\n\t});\n}\n\n/**\n * Visual editing proxy type.\n *\n * Spread directly onto elements for entry-level annotations: `{...entry.edit}`\n * Access a field for field-level annotations: `{...entry.edit.title}`\n *\n * In production, spreading produces no attributes (noop).\n */\nexport type EditProxy = {\n\treadonly [field: string]: Partial<FieldAnnotation>;\n};\n","/**\n * Query functions for EmDash content\n *\n * These wrap Astro's getLiveCollection/getLiveEntry with type filtering.\n * Use these instead of calling Astro's functions directly.\n *\n * Error handling follows Astro's pattern - returns { entries/entry, error }\n * so callers can gracefully handle errors (including 404s).\n *\n * Preview mode is handled implicitly via ALS request context —\n * no parameters needed. The middleware verifies the preview token\n * and sets the context; query functions read it automatically.\n */\n\nimport { getFallbackChain, getI18nConfig, isI18nEnabled } from \"./i18n/config.js\";\nimport { requestCached } from \"./request-cache.js\";\nimport { getRequestContext } from \"./request-context.js\";\nimport { isMissingTableError } from \"./utils/db-errors.js\";\nimport {\n\tcreateEditable,\n\tcreateNoop,\n\ttype EditProxy,\n\ttype EditableOptions,\n} from \"./visual-editing/editable.js\";\n\n/**\n * Collection type registry for type-safe queries.\n *\n * This interface is extended by the generated emdash-env.d.ts file\n * to provide type inference for collection names and their data shapes.\n *\n * @example\n * ```ts\n * // In emdash-env.d.ts (generated):\n * declare module \"emdash\" {\n * interface EmDashCollections {\n * posts: { title: string; content: PortableTextBlock[]; };\n * pages: { title: string; body: PortableTextBlock[]; };\n * }\n * }\n *\n * // Then in your code:\n * const { entries } = await getEmDashCollection(\"posts\");\n * // entries[0].data.title is typed as string\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface EmDashCollections {}\n\n/**\n * Helper type to infer the data type for a collection.\n * Returns the registered type if known, otherwise falls back to Record<string, unknown>.\n */\nexport type InferCollectionData<T extends string> = T extends keyof EmDashCollections\n\t? EmDashCollections[T]\n\t: Record<string, unknown>;\n\n/**\n * Sort direction\n */\nexport type SortDirection = \"asc\" | \"desc\";\n\n/**\n * Order by specification - field name to direction\n * @example { created_at: \"desc\" } - Sort by created_at descending\n * @example { title: \"asc\" } - Sort by title ascending\n * @example { published_at: \"desc\", title: \"asc\" } - Multi-field sort\n */\nexport type OrderBySpec = Record<string, SortDirection>;\n\nexport interface CollectionFilter {\n\tstatus?: \"draft\" | \"published\" | \"archived\";\n\tlimit?: number;\n\t/**\n\t * Opaque cursor for keyset pagination.\n\t * Pass the `nextCursor` value from a previous result to fetch the next page.\n\t * @example\n\t * ```ts\n\t * const cursor = Astro.url.searchParams.get(\"cursor\") ?? undefined;\n\t * const { entries, nextCursor } = await getEmDashCollection(\"posts\", {\n\t * limit: 10,\n\t * cursor,\n\t * });\n\t * ```\n\t */\n\tcursor?: string;\n\t/**\n\t * Filter by field values or taxonomy terms\n\t * @example { category: 'news' } - Filter by taxonomy term\n\t * @example { category: ['news', 'featured'] } - Filter by multiple terms (OR)\n\t */\n\twhere?: Record<string, string | string[]>;\n\t/**\n\t * Order results by field(s)\n\t * @default { created_at: \"desc\" }\n\t * @example { created_at: \"desc\" } - Sort by created_at descending (default)\n\t * @example { title: \"asc\" } - Sort by title ascending\n\t * @example { published_at: \"desc\", title: \"asc\" } - Multi-field sort\n\t */\n\torderBy?: OrderBySpec;\n\t/**\n\t * Filter by locale. When set, only returns entries in this locale.\n\t * Only relevant when i18n is configured.\n\t * @example \"en\" — English entries only\n\t * @example \"fr\" — French entries only\n\t */\n\tlocale?: string;\n}\n\nexport interface ContentEntry<T = Record<string, unknown>> {\n\tid: string;\n\tdata: T;\n\t/** Visual editing annotations. Spread onto elements: {...entry.edit.title} */\n\tedit: EditProxy;\n}\n\n/** Cache hint returned by the content loader for route caching */\nexport interface CacheHint {\n\ttags?: string[];\n\tlastModified?: Date;\n}\n\n/**\n * Result from getEmDashCollection\n */\nexport interface CollectionResult<T> {\n\t/** The entries (empty array if error or none found) */\n\tentries: ContentEntry<T>[];\n\t/** Error if the query failed */\n\terror?: Error;\n\t/** Cache hint for route caching (pass to Astro.cache.set()) */\n\tcacheHint: CacheHint;\n\t/**\n\t * Opaque cursor for the next page.\n\t * Undefined when there are no more results.\n\t * Pass this as `cursor` in the next query to get the next page.\n\t */\n\tnextCursor?: string;\n}\n\n/**\n * Result from getEmDashEntry\n */\nexport interface EntryResult<T> {\n\t/** The entry, or null if not found */\n\tentry: ContentEntry<T> | null;\n\t/** Error if the query failed (not set for \"not found\", only for actual errors) */\n\terror?: Error;\n\t/** Whether we're in preview mode (valid token was provided) */\n\tisPreview: boolean;\n\t/** Set when a fallback locale was used instead of the requested locale */\n\tfallbackLocale?: string;\n\t/** Cache hint for route caching (pass to Astro.cache.set()) */\n\tcacheHint: CacheHint;\n}\n\nconst COLLECTION_NAME = \"_emdash\";\n\n/** Symbol key for edit metadata on PT arrays — avoids collision with user data */\nconst EMDASH_EDIT = Symbol.for(\"__emdash\");\n\n/** Edit metadata attached to PT arrays in edit mode */\nexport interface EditFieldMeta {\n\tcollection: string;\n\tid: string;\n\tfield: string;\n}\n\n/** Type guard for EditFieldMeta */\nfunction isEditFieldMeta(value: unknown): value is EditFieldMeta {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tif (!(\"collection\" in value) || !(\"id\" in value) || !(\"field\" in value)) return false;\n\t// After `in` checks, TS narrows to Record<\"collection\" | \"id\" | \"field\", unknown>\n\tconst { collection, id, field } = value;\n\treturn typeof collection === \"string\" && typeof id === \"string\" && typeof field === \"string\";\n}\n\n/**\n * Read edit metadata from a value (returns undefined if not tagged).\n * Uses Object.getOwnPropertyDescriptor to access Symbol-keyed property\n * without an unsafe type assertion.\n */\nexport function getEditMeta(value: unknown): EditFieldMeta | undefined {\n\tif (value && typeof value === \"object\") {\n\t\tconst desc = Object.getOwnPropertyDescriptor(value, EMDASH_EDIT);\n\t\tconst meta: unknown = desc?.value;\n\t\tif (isEditFieldMeta(meta)) {\n\t\t\treturn meta;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/**\n * Tag PT-like arrays in entry data with edit metadata (non-enumerable).\n * A PT array is identified by: is an array, first element has _type property.\n */\nfunction tagEditableFields(data: Record<string, unknown>, collection: string, id: string): void {\n\tfor (const [field, value] of Object.entries(data)) {\n\t\tif (\n\t\t\tArray.isArray(value) &&\n\t\t\tvalue.length > 0 &&\n\t\t\tvalue[0] &&\n\t\t\ttypeof value[0] === \"object\" &&\n\t\t\t\"_type\" in value[0]\n\t\t) {\n\t\t\tObject.defineProperty(value, EMDASH_EDIT, {\n\t\t\t\tvalue: { collection, id, field } satisfies EditFieldMeta,\n\t\t\t\tenumerable: false,\n\t\t\t\tconfigurable: true,\n\t\t\t});\n\t\t}\n\t}\n}\n\n/** Safely read a string field from a Record, with optional fallback */\nfunction dataStr(data: Record<string, unknown>, key: string, fallback = \"\"): string {\n\tconst val = data[key];\n\treturn typeof val === \"string\" ? val : fallback;\n}\n\n/** Type guard for Record<string, unknown> */\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** Extract data as Record from an Astro entry (which is any-typed) */\nfunction entryData(entry: { data?: unknown }): Record<string, unknown> {\n\treturn isRecord(entry.data) ? entry.data : {};\n}\n\n/** Extract the database ID from entry data (data.id is the ULID, entry.id is the slug) */\nfunction entryDatabaseId(entry: { id: string; data?: unknown }): string {\n\tconst d = entryData(entry);\n\treturn dataStr(d, \"id\") || entry.id;\n}\n\n/** Extract edit options from entry data for the proxy */\nfunction entryEditOptions(entry: { data?: unknown }): EditableOptions {\n\tconst data = entryData(entry);\n\tconst status = dataStr(data, \"status\", \"draft\");\n\tconst draftRevisionId = dataStr(data, \"draftRevisionId\") || undefined;\n\tconst liveRevisionId = dataStr(data, \"liveRevisionId\") || undefined;\n\tconst hasDraft = !!draftRevisionId && draftRevisionId !== liveRevisionId;\n\treturn { status, hasDraft };\n}\n\n/**\n * Get all entries of a content type\n *\n * Returns { entries, error } for graceful error handling.\n *\n * When emdash-env.d.ts is generated, the collection name will be\n * type-checked and the return type will be inferred automatically.\n *\n * @example\n * ```ts\n * import { getEmDashCollection } from \"emdash\";\n *\n * const { entries: posts, error } = await getEmDashCollection(\"posts\");\n * if (error) {\n * console.error(\"Failed to load posts:\", error);\n * return;\n * }\n * // posts[0].data.title is typed (if emdash-env.d.ts exists)\n *\n * // With filters\n * const { entries: drafts } = await getEmDashCollection(\"posts\", { status: \"draft\" });\n * ```\n */\nexport async function getEmDashCollection<T extends string, D = InferCollectionData<T>>(\n\ttype: T,\n\tfilter?: CollectionFilter,\n): Promise<CollectionResult<D>> {\n\t// Cache per (type, filter) within a single request. Edit mode and\n\t// preview are request-scoped and stable, so they don't need to be\n\t// part of the key. Widgets and layouts frequently request the same\n\t// collection shape as the page itself (e.g. a \"recent posts\" list\n\t// appears on the home page AND in the sidebar) — caching collapses\n\t// those duplicate queries, along with the bylines and taxonomy-term\n\t// hydration each call would otherwise re-do.\n\treturn requestCached(collectionCacheKey(type, filter), () =>\n\t\tgetEmDashCollectionUncached<T, D>(type, filter),\n\t);\n}\n\n/**\n * Build a canonical cache key for `getEmDashCollection`.\n *\n * `JSON.stringify` is insertion-order-sensitive, so two callers passing\n * semantically identical filters with different key orders would miss\n * the cache. We fix the top-level field order and sort `where` keys\n * (order there is irrelevant), while preserving `orderBy` key order\n * because that's the sort priority.\n */\nfunction collectionCacheKey(type: string, filter?: CollectionFilter): string {\n\tif (!filter) return `collection:${type}:`;\n\tconst parts = [\n\t\tfilter.status ?? \"\",\n\t\tfilter.limit ?? \"\",\n\t\tfilter.cursor ?? \"\",\n\t\tfilter.where ? stableStringify(filter.where) : \"\",\n\t\tfilter.orderBy ? JSON.stringify(filter.orderBy) : \"\",\n\t\tfilter.locale ?? \"\",\n\t];\n\treturn `collection:${type}:${parts.join(\"|\")}`;\n}\n\nfunction stableStringify(value: Record<string, unknown>): string {\n\tconst keys = Object.keys(value).toSorted();\n\tconst ordered: Record<string, unknown> = {};\n\tfor (const k of keys) ordered[k] = value[k];\n\treturn JSON.stringify(ordered);\n}\n\nasync function getEmDashCollectionUncached<T extends string, D = InferCollectionData<T>>(\n\ttype: T,\n\tfilter?: CollectionFilter,\n): Promise<CollectionResult<D>> {\n\t// Dynamic import to avoid build-time issues\n\tconst { getLiveCollection } = await import(\"astro:content\");\n\n\t// Resolve locale: explicit filter > ALS context > defaultLocale (when i18n enabled)\n\t// Without this, queries return all locale rows, producing broken IDs\n\tconst ctx = getRequestContext();\n\tconst i18nConfig = getI18nConfig();\n\tconst resolvedLocale =\n\t\tfilter?.locale ?? ctx?.locale ?? (isI18nEnabled() ? i18nConfig!.defaultLocale : undefined);\n\n\tconst result = await getLiveCollection(COLLECTION_NAME, {\n\t\ttype,\n\t\tstatus: filter?.status,\n\t\tlimit: filter?.limit,\n\t\tcursor: filter?.cursor,\n\t\twhere: filter?.where,\n\t\torderBy: filter?.orderBy,\n\t\tlocale: resolvedLocale,\n\t});\n\n\tconst { entries, error, cacheHint } = result;\n\t// nextCursor is returned by the emdash loader but not part of Astro's base\n\t// LiveLoader return type. Extract it safely via property descriptor to avoid\n\t// an unsafe type assertion on the `any`-typed result object.\n\tconst rawCursor = Object.getOwnPropertyDescriptor(result, \"nextCursor\")?.value;\n\tconst nextCursor: string | undefined = typeof rawCursor === \"string\" ? rawCursor : undefined;\n\n\tif (error) {\n\t\treturn { entries: [], error, cacheHint: {} };\n\t}\n\n\tconst isEditMode = ctx?.editMode ?? false;\n\tconst entriesWithEdit = entries.map((entry: ContentEntry<D>) => {\n\t\tconst dbId = entryDatabaseId(entry);\n\t\tif (isEditMode) {\n\t\t\ttagEditableFields(entryData(entry), type, dbId);\n\t\t}\n\t\treturn {\n\t\t\t...entry,\n\t\t\tedit: isEditMode ? createEditable(type, dbId, entryEditOptions(entry)) : createNoop(),\n\t\t};\n\t});\n\n\t// Eagerly hydrate bylines and taxonomy terms for all entries in parallel.\n\t// Both are independent queries, so running them concurrently halves the\n\t// round-trip cost on remote databases (D1 replicas, etc.).\n\tawait Promise.all([\n\t\thydrateEntryBylines(type, entriesWithEdit),\n\t\thydrateEntryTerms(type, entriesWithEdit),\n\t]);\n\n\treturn { entries: entriesWithEdit, nextCursor, cacheHint: cacheHint ?? {} };\n}\n\n/**\n * Get a single entry by type and ID/slug\n *\n * Returns { entry, error, isPreview } for graceful error handling.\n * - entry is null if not found (not an error)\n * - error is set only for actual errors (db issues, etc.)\n *\n * Preview mode is detected automatically from request context (ALS).\n * When the URL has a valid `_preview` token, the middleware sets preview\n * context and this function serves draft revision data if available.\n *\n * @example\n * ```ts\n * import { getEmDashEntry } from \"emdash\";\n *\n * // Simple usage — preview just works via middleware\n * const { entry: post, isPreview, error } = await getEmDashEntry(\"posts\", \"my-slug\");\n * if (!post) return Astro.redirect(\"/404\");\n * ```\n */\nexport async function getEmDashEntry<T extends string, D = InferCollectionData<T>>(\n\ttype: T,\n\tid: string,\n\toptions?: { locale?: string },\n): Promise<EntryResult<D>> {\n\t// Dynamic import to avoid build-time issues\n\tconst { getLiveEntry } = await import(\"astro:content\");\n\n\t// Check ALS for preview and edit mode context\n\tconst ctx = getRequestContext();\n\tconst preview = ctx?.preview;\n\tconst isEditMode = ctx?.editMode ?? false;\n\tconst isPreviewMode = !!preview && preview.collection === type;\n\t// Edit mode implies preview — editors should see draft content\n\tconst serveDrafts = isPreviewMode || isEditMode;\n\n\t// Resolve locale: explicit option > ALS context > undefined (no filter)\n\tconst requestedLocale = options?.locale ?? ctx?.locale;\n\n\t/** Wrap a raw Astro entry with edit proxy, tagging editable fields if needed */\n\tfunction wrapEntry(raw: ContentEntry<D>): ContentEntry<D> {\n\t\tconst dbId = entryDatabaseId(raw);\n\t\tif (isEditMode) {\n\t\t\ttagEditableFields(entryData(raw), type, dbId);\n\t\t}\n\t\treturn {\n\t\t\t...raw,\n\t\t\tedit: isEditMode ? createEditable(type, dbId, entryEditOptions(raw)) : createNoop(),\n\t\t};\n\t}\n\n\t/** Check if an entry is publicly visible (published or scheduled past its time) */\n\tfunction isVisible(entry: ContentEntry<D>): boolean {\n\t\tconst data = entryData(entry);\n\t\tconst status = dataStr(data, \"status\");\n\t\tconst scheduledAt = dataStr(data, \"scheduledAt\") || undefined;\n\t\tconst isPublished = status === \"published\";\n\t\tconst isScheduledAndReady =\n\t\t\tstatus === \"scheduled\" && scheduledAt && new Date(scheduledAt) <= new Date();\n\t\treturn isPublished || !!isScheduledAndReady;\n\t}\n\n\t// Build the fallback chain: [requestedLocale, fallback1, ..., defaultLocale]\n\t// When i18n is disabled or no locale requested, just use a single-element chain\n\tconst localeChain =\n\t\trequestedLocale && isI18nEnabled() ? getFallbackChain(requestedLocale) : [requestedLocale];\n\n\t/** Return a successful EntryResult with bylines and taxonomy terms hydrated */\n\tasync function successResult(\n\t\twrapped: ContentEntry<D>,\n\t\topts: { isPreview: boolean; fallbackLocale?: string; cacheHint: CacheHint },\n\t): Promise<EntryResult<D>> {\n\t\tawait Promise.all([hydrateEntryBylines(type, [wrapped]), hydrateEntryTerms(type, [wrapped])]);\n\t\treturn {\n\t\t\tentry: wrapped,\n\t\t\tisPreview: opts.isPreview,\n\t\t\tfallbackLocale: opts.fallbackLocale,\n\t\t\tcacheHint: opts.cacheHint,\n\t\t};\n\t}\n\n\tif (serveDrafts) {\n\t\t// Draft mode: try each locale in the fallback chain\n\t\tfor (let i = 0; i < localeChain.length; i++) {\n\t\t\tconst locale = localeChain[i];\n\t\t\tconst fallbackLocale = i > 0 ? locale : undefined;\n\n\t\t\tconst {\n\t\t\t\tentry: baseEntry,\n\t\t\t\terror: baseError,\n\t\t\t\tcacheHint,\n\t\t\t} = await getLiveEntry(COLLECTION_NAME, {\n\t\t\t\ttype,\n\t\t\t\tid,\n\t\t\t\tlocale,\n\t\t\t});\n\n\t\t\tif (baseError) {\n\t\t\t\treturn { entry: null, error: baseError, isPreview: serveDrafts, cacheHint: {} };\n\t\t\t}\n\n\t\t\tif (!baseEntry) continue; // Try next locale in chain\n\n\t\t\t// Preview tokens are item-scoped: verify the resolved entry matches.\n\t\t\t// Edit mode (authenticated editors) has collection-wide draft access.\n\t\t\tif (isPreviewMode && !isEditMode) {\n\t\t\t\tconst dbId = entryDatabaseId(baseEntry);\n\t\t\t\tif (preview!.id !== dbId && preview!.id !== id) {\n\t\t\t\t\t// Token doesn't match — serve only if publicly visible, without draft access\n\t\t\t\t\tif (isVisible(baseEntry)) {\n\t\t\t\t\t\treturn successResult(wrapEntry(baseEntry), {\n\t\t\t\t\t\t\tisPreview: false,\n\t\t\t\t\t\t\tfallbackLocale,\n\t\t\t\t\t\t\tcacheHint: cacheHint ?? {},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\t// Not visible — try next locale in fallback chain\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Check if entry has a draft revision — if so, re-fetch with revision data\n\t\t\tconst baseData = entryData(baseEntry);\n\t\t\tconst draftRevisionId = dataStr(baseData, \"draftRevisionId\") || undefined;\n\n\t\t\tif (draftRevisionId) {\n\t\t\t\tconst { entry: draftEntry, error: draftError } = await getLiveEntry(COLLECTION_NAME, {\n\t\t\t\t\ttype,\n\t\t\t\t\tid,\n\t\t\t\t\trevisionId: draftRevisionId,\n\t\t\t\t\tlocale,\n\t\t\t\t});\n\n\t\t\t\tif (!draftError && draftEntry) {\n\t\t\t\t\treturn successResult(wrapEntry(draftEntry), {\n\t\t\t\t\t\tisPreview: serveDrafts,\n\t\t\t\t\t\tfallbackLocale,\n\t\t\t\t\t\tcacheHint: cacheHint ?? {},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn successResult(wrapEntry(baseEntry), {\n\t\t\t\tisPreview: serveDrafts,\n\t\t\t\tfallbackLocale,\n\t\t\t\tcacheHint: cacheHint ?? {},\n\t\t\t});\n\t\t}\n\n\t\t// No entry found in any locale\n\t\treturn { entry: null, isPreview: serveDrafts, cacheHint: {} };\n\t}\n\n\t// Normal mode: try each locale in the fallback chain, only return published content\n\tfor (let i = 0; i < localeChain.length; i++) {\n\t\tconst locale = localeChain[i];\n\t\tconst fallbackLocale = i > 0 ? locale : undefined;\n\n\t\tconst { entry, error, cacheHint } = await getLiveEntry(COLLECTION_NAME, { type, id, locale });\n\t\tif (error) {\n\t\t\treturn { entry: null, error, isPreview: false, cacheHint: {} };\n\t\t}\n\n\t\tif (entry && isVisible(entry)) {\n\t\t\treturn successResult(wrapEntry(entry), {\n\t\t\t\tisPreview: false,\n\t\t\t\tfallbackLocale,\n\t\t\t\tcacheHint: cacheHint ?? {},\n\t\t\t});\n\t\t}\n\t\t// Entry not found or not visible in this locale — try next\n\t}\n\n\treturn { entry: null, isPreview: false, cacheHint: {} };\n}\n\n/**\n * Eagerly hydrate byline data onto entry.data for one or more entries.\n *\n * Attaches `bylines` (array of ContentBylineCredit) and `byline`\n * (primary BylineSummary or null) to each entry's data object.\n * Uses batch queries to avoid N+1.\n *\n * Fails silently if the byline tables don't exist yet (pre-migration).\n */\nasync function hydrateEntryBylines<D>(type: string, entries: ContentEntry<D>[]): Promise<void> {\n\tif (entries.length === 0) return;\n\n\ttry {\n\t\tconst { getBylinesForEntries } = await import(\"./bylines/index.js\");\n\n\t\tconst ids = entries.map((e) => dataStr(entryData(e), \"id\")).filter(Boolean);\n\t\tif (ids.length === 0) return;\n\n\t\tconst bylinesMap = await getBylinesForEntries(type, ids);\n\n\t\tfor (const entry of entries) {\n\t\t\tconst data = entryData(entry);\n\t\t\tconst dbId = dataStr(data, \"id\");\n\t\t\tif (!dbId) continue;\n\n\t\t\tconst credits = bylinesMap.get(dbId) ?? [];\n\t\t\tdata.bylines = credits;\n\t\t\tdata.byline = credits[0]?.byline ?? null;\n\t\t}\n\t} catch (err) {\n\t\t// Only swallow \"table not found\" errors from pre-migration databases.\n\t\t// Matches SQLite/D1 (\"no such table\") and PostgreSQL (\"relation/table\n\t\t// ... does not exist\") via the shared helper.\n\t\tif (!isMissingTableError(err)) {\n\t\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\t\tconsole.warn(\"[emdash] Failed to hydrate bylines:\", msg);\n\t\t}\n\t}\n}\n\n/**\n * Eagerly hydrate taxonomy term data onto entry.data for one or more entries.\n *\n * Attaches `terms` (Record keyed by taxonomy name with an array of TaxonomyTerm\n * values) to each entry's data object. Uses a single batched JOIN query across\n * all taxonomies so the cost is O(1) regardless of the number of entries or\n * taxonomies on the site.\n *\n * This eliminates the common N+1 pattern where templates loop over list\n * results and call getEntryTerms() per entry. With hydration, the list page\n * stays at a single round-trip for term data.\n *\n * Fails silently if the taxonomy tables don't exist yet (pre-migration).\n */\nasync function hydrateEntryTerms<D>(type: string, entries: ContentEntry<D>[]): Promise<void> {\n\tif (entries.length === 0) return;\n\n\ttry {\n\t\tconst { getAllTermsForEntries } = await import(\"./taxonomies/index.js\");\n\n\t\tconst ids = entries.map((e) => dataStr(entryData(e), \"id\")).filter(Boolean);\n\t\tif (ids.length === 0) return;\n\n\t\tconst termsMap = await getAllTermsForEntries(type, ids);\n\n\t\tfor (const entry of entries) {\n\t\t\tconst data = entryData(entry);\n\t\t\tconst dbId = dataStr(data, \"id\");\n\t\t\tif (!dbId) continue;\n\n\t\t\tdata.terms = termsMap.get(dbId) ?? {};\n\t\t}\n\t} catch (err) {\n\t\t// Only swallow \"table not found\" errors from pre-migration databases.\n\t\t// Matches SQLite/D1 (\"no such table\") and PostgreSQL (\"relation/table\n\t\t// ... does not exist\") via the shared helper.\n\t\tif (!isMissingTableError(err)) {\n\t\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\t\tconsole.warn(\"[emdash] Failed to hydrate terms:\", msg);\n\t\t}\n\t}\n}\n\n/**\n * Translation summary for a single locale variant\n */\nexport interface TranslationSummary {\n\t/** Content item ID */\n\tid: string;\n\t/** Locale code (e.g. \"en\", \"fr\") */\n\tlocale: string;\n\t/** URL slug */\n\tslug: string | null;\n\t/** Current status */\n\tstatus: string;\n}\n\n/**\n * Result from getTranslations\n */\nexport interface TranslationsResult {\n\t/** The translation group ID (shared across locales) */\n\ttranslationGroup: string;\n\t/** All locale variants in this group */\n\ttranslations: TranslationSummary[];\n\t/** Error if the query failed */\n\terror?: Error;\n}\n\n/**\n * Get all translations of a content item.\n *\n * Given a content entry, returns all locale variants that share the same\n * translation group. This is useful for building language switcher UI.\n *\n * @example\n * ```ts\n * import { getEmDashEntry, getTranslations } from \"emdash\";\n *\n * const { entry: post } = await getEmDashEntry(\"posts\", \"hello-world\", { locale: \"en\" });\n * const { translations } = await getTranslations(\"posts\", post.data.id);\n * // translations = [{ id: \"...\", locale: \"en\", slug: \"hello-world\", status: \"published\" }, ...]\n * ```\n */\nexport async function getTranslations(type: string, id: string): Promise<TranslationsResult> {\n\ttry {\n\t\tconst db = (await import(\"./loader.js\")).getDb;\n\t\tconst dbInstance = await db();\n\t\tconst { ContentRepository } = await import(\"./database/repositories/content.js\");\n\t\tconst repo = new ContentRepository(dbInstance);\n\n\t\t// Find the item to get its translation group\n\t\tconst item = await repo.findByIdOrSlug(type, id);\n\t\tif (!item) {\n\t\t\treturn {\n\t\t\t\ttranslationGroup: \"\",\n\t\t\t\ttranslations: [],\n\t\t\t\terror: new Error(`Content item not found: ${id}`),\n\t\t\t};\n\t\t}\n\n\t\tconst group = item.translationGroup || item.id;\n\t\tconst translations = await repo.findTranslations(type, group);\n\n\t\treturn {\n\t\t\ttranslationGroup: group,\n\t\t\ttranslations: translations.map((t) => ({\n\t\t\t\tid: t.id,\n\t\t\t\tlocale: t.locale || \"en\",\n\t\t\t\tslug: t.slug,\n\t\t\t\tstatus: t.status,\n\t\t\t})),\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\ttranslationGroup: \"\",\n\t\t\ttranslations: [],\n\t\t\terror: error instanceof Error ? error : new Error(String(error)),\n\t\t};\n\t}\n}\n\n/**\n * Result from resolveEmDashPath\n */\nexport interface ResolvePathResult<T = Record<string, unknown>> {\n\t/** The matched entry */\n\tentry: ContentEntry<T>;\n\t/** The collection slug that matched */\n\tcollection: string;\n\t/** Extracted parameters from the URL pattern (e.g. { slug: \"my-post\" }) */\n\tparams: Record<string, string>;\n}\n\n/** Matches `{paramName}` placeholders in URL patterns */\nconst URL_PARAM_PATTERN = /\\{(\\w+)\\}/g;\n\n/** Convert a URL pattern like \"/blog/{slug}\" to a regex and param name list */\nfunction patternToRegex(pattern: string): { regex: RegExp; paramNames: string[] } {\n\tconst paramNames: string[] = [];\n\tconst regexStr = pattern.replace(URL_PARAM_PATTERN, (_match, name: string) => {\n\t\tparamNames.push(name);\n\t\treturn \"([^/]+)\";\n\t});\n\treturn { regex: new RegExp(`^${regexStr}$`), paramNames };\n}\n\n/** Cached compiled URL patterns for resolveEmDashPath */\ninterface CachedPattern {\n\tslug: string;\n\tregex: RegExp;\n\tparamNames: string[];\n}\nlet cachedUrlPatterns: CachedPattern[] | null = null;\n\n/**\n * Invalidate the cached URL patterns used by resolveEmDashPath.\n * Call when collection URL patterns change (schema updates).\n */\nexport function invalidateUrlPatternCache(): void {\n\tcachedUrlPatterns = null;\n}\n\n/**\n * Resolve a URL path to a content entry by matching against collection URL patterns.\n *\n * Loads all collections with a `urlPattern` set, converts each pattern to a regex,\n * and tests the given path. On match, extracts the slug and fetches the entry.\n *\n * @example\n * ```ts\n * import { resolveEmDashPath } from \"emdash\";\n *\n * // Given pages with urlPattern \"/{slug}\" and posts with \"/blog/{slug}\":\n * const result = await resolveEmDashPath(\"/blog/hello-world\");\n * if (result) {\n * console.log(result.collection); // \"posts\"\n * console.log(result.params.slug); // \"hello-world\"\n * console.log(result.entry.data); // post data\n * }\n * ```\n */\nexport async function resolveEmDashPath<T = Record<string, unknown>>(\n\tpath: string,\n): Promise<ResolvePathResult<T> | null> {\n\t// Build and cache compiled patterns on first call\n\tif (!cachedUrlPatterns) {\n\t\tconst { getDb } = await import(\"./loader.js\");\n\t\tconst { SchemaRegistry } = await import(\"./schema/registry.js\");\n\t\tconst db = await getDb();\n\t\tconst registry = new SchemaRegistry(db);\n\t\tconst collections = await registry.listCollections();\n\n\t\tcachedUrlPatterns = [];\n\t\tfor (const collection of collections) {\n\t\t\tif (!collection.urlPattern) continue;\n\t\t\tconst { regex, paramNames } = patternToRegex(collection.urlPattern);\n\t\t\tcachedUrlPatterns.push({ slug: collection.slug, regex, paramNames });\n\t\t}\n\t}\n\n\tfor (const pattern of cachedUrlPatterns) {\n\t\tconst match = path.match(pattern.regex);\n\t\tif (!match) continue;\n\n\t\t// Extract params\n\t\tconst params: Record<string, string> = {};\n\t\tfor (let i = 0; i < pattern.paramNames.length; i++) {\n\t\t\tparams[pattern.paramNames[i]] = match[i + 1];\n\t\t}\n\n\t\t// Look up entry by slug (most common pattern)\n\t\tconst slug = params.slug;\n\t\tif (!slug) continue;\n\n\t\tconst { entry } = await getEmDashEntry<string, T>(pattern.slug, slug);\n\t\tif (entry) {\n\t\t\treturn { entry, collection: pattern.slug, params };\n\t\t}\n\t}\n\n\treturn null;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoCA,SAAgB,eACf,YACA,IACA,SACY;CACZ,MAAM,OAAsB;EAC3B;EACA;EACA,GAAI,SAAS,UAAU,EAAE,QAAQ,QAAQ,QAAQ;EACjD,GAAI,SAAS,YAAY,EAAE,UAAU,MAAM;EAC3C;AAED,QAAO,IAAI,MAAM,EAAE,EAAe;EACjC,IAAI,GAAG,MAAM;AACZ,OAAI,SAAS,SAAU,eAAc,EAAE,m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ACvB,MAAM,EAAE,UAAU,MAAM,OAAO;EAC/B,MAAM,EAAE,mBAAmB,MAAM,OAAO;EAGxC,MAAM,cAAc,MADH,IAAI,eADV,MAAM,OAAO,CACe,CACJ,iBAAiB;AAEpD,sBAAoB,EAAE;AACtB,OAAK,MAAM,cAAc,aAAa;AACrC,OAAI,CAAC,WAAW,WAAY;GAC5B,MAAM,EAAE,OAAO,eAAe,eAAe,WAAW,WAAW;AACnE,qBAAkB,KAAK;IAAE,MAAM,WAAW;IAAM;IAAO;IAAY,CAAC;;;AAItE,MAAK,MAAM,WAAW,mBAAmB;EACxC,MAAM,QAAQ,KAAK,MAAM,QAAQ,MAAM;AACvC,MAAI,CAAC,MAAO;EAGZ,MAAM,SAAiC,EAAE;AACzC,OAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,WAAW,QAAQ,IAC9C,QAAO,QAAQ,WAAW,MAAM,MAAM,IAAI;EAI3C,MAAM,OAAO,OAAO;AACpB,MAAI,CAAC,KAAM;EAEX,MAAM,EAAE,UAAU,MAAM,eAA0B,QAAQ,MAAM,KAAK;AACrE,MAAI,MACH,QAAO;GAAE;GAAO,YAAY,QAAQ;GAAM;GAAQ;;AAIpD,QAAO"}
@@ -5,6 +5,24 @@ import { sql } from "kysely";
5
5
  import { ulid } from "ulidx";
6
6
 
7
7
  //#region src/database/repositories/redirect.ts
8
+ /**
9
+ * Hard cap on rows stored in `_emdash_404_log`. When exceeded, the oldest
10
+ * rows (by `last_seen_at`) are evicted on insert. Prevents an unauthenticated
11
+ * attacker from growing the table without bound by requesting unique URLs.
12
+ */
13
+ const MAX_404_LOG_ROWS = 1e4;
14
+ /** Max stored length for the `Referer` header — truncated on insert. */
15
+ const REFERRER_MAX_LENGTH = 512;
16
+ /** Max stored length for the `User-Agent` header — truncated on insert. */
17
+ const USER_AGENT_MAX_LENGTH = 256;
18
+ /**
19
+ * Truncate a header-derived string to `max` chars, preserving `null`/`undefined`
20
+ * as `null`. Empty strings stay empty (the caller decides whether to coerce).
21
+ */
22
+ function truncateOrNull(value, max) {
23
+ if (value === null || value === void 0) return null;
24
+ return value.length > max ? value.slice(0, max) : value;
25
+ }
8
26
  function rowToRedirect(row) {
9
27
  return {
10
28
  id: row.id,
@@ -168,15 +186,55 @@ var RedirectRepository = class {
168
186
  }).where("destination", "=", oldDestination).executeTakeFirst();
169
187
  return Number(result.numUpdatedRows);
170
188
  }
189
+ /**
190
+ * Record a 404 hit for `entry.path`.
191
+ *
192
+ * Dedups by path: repeat hits increment `hits` and refresh `last_seen_at`
193
+ * on the existing row instead of inserting a new one. Referrer and
194
+ * user-agent are truncated to bounded lengths so a malicious client can't
195
+ * blow up storage with huge headers. When the table would exceed
196
+ * MAX_404_LOG_ROWS, the oldest entries (by `last_seen_at`) are evicted.
197
+ *
198
+ * This is called from the public redirect middleware on every 404 and
199
+ * must never throw for an unauthenticated caller — failures bubble up to
200
+ * the middleware, which swallows them.
201
+ */
171
202
  async log404(entry) {
203
+ const now = (/* @__PURE__ */ new Date()).toISOString();
204
+ const referrer = truncateOrNull(entry.referrer, REFERRER_MAX_LENGTH);
205
+ const userAgent = truncateOrNull(entry.userAgent, USER_AGENT_MAX_LENGTH);
206
+ const ip = entry.ip ?? null;
172
207
  await this.db.insertInto("_emdash_404_log").values({
173
208
  id: ulid(),
174
209
  path: entry.path,
175
- referrer: entry.referrer ?? null,
176
- user_agent: entry.userAgent ?? null,
177
- ip: entry.ip ?? null,
178
- created_at: (/* @__PURE__ */ new Date()).toISOString()
179
- }).execute();
210
+ referrer,
211
+ user_agent: userAgent,
212
+ ip,
213
+ hits: 1,
214
+ last_seen_at: now,
215
+ created_at: now
216
+ }).onConflict((oc) => oc.column("path").doUpdateSet({
217
+ hits: sql`hits + 1`,
218
+ last_seen_at: now,
219
+ referrer,
220
+ user_agent: userAgent,
221
+ ip
222
+ })).execute();
223
+ await this.enforce404Cap();
224
+ }
225
+ /**
226
+ * Delete the oldest rows from `_emdash_404_log` if the row count exceeds
227
+ * MAX_404_LOG_ROWS. "Oldest" is by `last_seen_at`, so a path that keeps
228
+ * getting hit stays in the table even if it was first seen long ago.
229
+ *
230
+ * Private — callers use `log404`, which invokes this after every upsert.
231
+ */
232
+ async enforce404Cap() {
233
+ const countRow = await this.db.selectFrom("_emdash_404_log").select((eb) => eb.fn.countAll().as("c")).executeTakeFirst();
234
+ const count = Number(countRow?.c ?? 0);
235
+ if (count <= MAX_404_LOG_ROWS) return;
236
+ const excess = count - MAX_404_LOG_ROWS;
237
+ await this.db.deleteFrom("_emdash_404_log").where("id", "in", this.db.selectFrom("_emdash_404_log").select("id").orderBy("last_seen_at", "asc").orderBy("id", "asc").limit(excess)).execute();
180
238
  }
181
239
  async find404s(opts) {
182
240
  const limit = Math.min(Math.max(opts.limit ?? 50, 1), 100);
@@ -206,14 +264,12 @@ var RedirectRepository = class {
206
264
  return (await sql`
207
265
  SELECT
208
266
  path,
209
- COUNT(*) as count,
210
- MAX(created_at) as last_seen,
267
+ SUM(hits) as count,
268
+ MAX(last_seen_at) as last_seen,
211
269
  (
212
270
  SELECT referrer FROM _emdash_404_log AS inner_log
213
271
  WHERE inner_log.path = _emdash_404_log.path
214
272
  AND referrer IS NOT NULL AND referrer != ''
215
- GROUP BY referrer
216
- ORDER BY COUNT(*) DESC
217
273
  LIMIT 1
218
274
  ) as top_referrer
219
275
  FROM _emdash_404_log
@@ -243,4 +299,4 @@ var RedirectRepository = class {
243
299
 
244
300
  //#endregion
245
301
  export { RedirectRepository as t };
246
- //# sourceMappingURL=redirect-7lGhLBNZ.mjs.map
302
+ //# sourceMappingURL=redirect-CN0Rt9Ob.mjs.map