emdash 0.40.0 → 0.40.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/dist/api/route-utils.mjs +6 -6
  2. package/dist/api/schemas/index.d.mts +1 -1
  3. package/dist/{api-cFFZpyS0.mjs → api-CuyNEHZG.mjs} +3 -3
  4. package/dist/{api-cFFZpyS0.mjs.map → api-CuyNEHZG.mjs.map} +1 -1
  5. package/dist/{apply-CoT603H3.mjs → apply-npY1TAhG.mjs} +237 -34
  6. package/dist/apply-npY1TAhG.mjs.map +1 -0
  7. package/dist/astro/index.d.mts +3 -3
  8. package/dist/astro/index.mjs +9 -9
  9. package/dist/astro/index.mjs.map +1 -1
  10. package/dist/astro/middleware/auth.d.mts +3 -3
  11. package/dist/astro/middleware/redirect.mjs +1 -1
  12. package/dist/astro/middleware.d.mts +3 -3
  13. package/dist/astro/middleware.d.mts.map +1 -1
  14. package/dist/astro/middleware.mjs +19 -18
  15. package/dist/astro/middleware.mjs.map +1 -1
  16. package/dist/astro/routes/api/admin/media-usage/progress.mjs +2 -2
  17. package/dist/astro/routes/api/admin/media-usage/repair.mjs +2 -2
  18. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +8 -8
  19. package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs +8 -8
  20. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +8 -8
  21. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +11 -11
  22. package/dist/astro/routes/api/admin/plugins/index.mjs +8 -8
  23. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +8 -8
  24. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +11 -11
  25. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +8 -8
  26. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +8 -8
  27. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +12 -12
  28. package/dist/astro/routes/api/admin/plugins/registry/install.mjs +9 -9
  29. package/dist/astro/routes/api/admin/plugins/registry/verify.mjs +9 -9
  30. package/dist/astro/routes/api/admin/plugins/updates.mjs +8 -8
  31. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +8 -8
  32. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +8 -8
  33. package/dist/astro/routes/api/admin/transfer/approvals/_id_/approve.mjs +3 -3
  34. package/dist/astro/routes/api/admin/transfer/approvals/_id_/deny.mjs +3 -3
  35. package/dist/astro/routes/api/admin/transfer/approvals/index.mjs +3 -3
  36. package/dist/astro/routes/api/admin/transfer/capabilities.mjs +3 -3
  37. package/dist/astro/routes/api/admin/transfer/exports/_id_/advance.mjs +3 -3
  38. package/dist/astro/routes/api/admin/transfer/exports/_id_/archive.mjs +3 -3
  39. package/dist/astro/routes/api/admin/transfer/exports/_id_/files/_...path_.mjs +3 -3
  40. package/dist/astro/routes/api/admin/transfer/exports/_id_/index.mjs +3 -3
  41. package/dist/astro/routes/api/admin/transfer/exports/_id_/manifest.mjs +3 -3
  42. package/dist/astro/routes/api/admin/transfer/exports/index.mjs +3 -3
  43. package/dist/astro/routes/api/admin/transfer/imports/_id_/abandon.mjs +3 -3
  44. package/dist/astro/routes/api/admin/transfer/imports/_id_/advance.mjs +3 -3
  45. package/dist/astro/routes/api/admin/transfer/imports/_id_/analyze.mjs +3 -3
  46. package/dist/astro/routes/api/admin/transfer/imports/_id_/cancel.mjs +3 -3
  47. package/dist/astro/routes/api/admin/transfer/imports/_id_/execute.mjs +3 -3
  48. package/dist/astro/routes/api/admin/transfer/imports/_id_/files/_...path_.mjs +3 -3
  49. package/dist/astro/routes/api/admin/transfer/imports/_id_/index.mjs +3 -3
  50. package/dist/astro/routes/api/admin/transfer/imports/_id_/missing.mjs +3 -3
  51. package/dist/astro/routes/api/admin/transfer/imports/_id_/plan.mjs +3 -3
  52. package/dist/astro/routes/api/admin/transfer/imports/_id_/receipt.mjs +3 -3
  53. package/dist/astro/routes/api/admin/transfer/imports/index.mjs +3 -3
  54. package/dist/astro/routes/api/dashboard.mjs +2 -2
  55. package/dist/astro/routes/api/health.mjs +1 -1
  56. package/dist/astro/routes/api/import/probe.mjs +3 -3
  57. package/dist/astro/routes/api/import/wordpress/execute.d.mts +3 -3
  58. package/dist/astro/routes/api/import/wordpress/media.d.mts +3 -3
  59. package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +3 -3
  60. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +3 -3
  61. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +3 -3
  62. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +3 -3
  63. package/dist/astro/routes/api/manifest.mjs +1 -1
  64. package/dist/astro/routes/api/mcp.mjs +13 -33
  65. package/dist/astro/routes/api/mcp.mjs.map +1 -1
  66. package/dist/astro/routes/api/media/_id_/confirm.mjs +1 -1
  67. package/dist/astro/routes/api/media/_id_/upload.mjs +1 -1
  68. package/dist/astro/routes/api/media/_id_/usage.mjs +2 -2
  69. package/dist/astro/routes/api/media/_id_.mjs +2 -2
  70. package/dist/astro/routes/api/media/asset/_id_/_filename_.mjs +1 -1
  71. package/dist/astro/routes/api/media/upload-url.mjs +1 -1
  72. package/dist/astro/routes/api/media.mjs +2 -2
  73. package/dist/astro/routes/api/redirects/404s/index.mjs +2 -2
  74. package/dist/astro/routes/api/redirects/404s/summary.mjs +2 -2
  75. package/dist/astro/routes/api/redirects/_id_.mjs +2 -2
  76. package/dist/astro/routes/api/redirects/index.mjs +2 -2
  77. package/dist/astro/routes/api/schema/block-types/_slug_/index.mjs +8 -8
  78. package/dist/astro/routes/api/schema/block-types/_slug_/versions/_version_/activate.mjs +8 -8
  79. package/dist/astro/routes/api/schema/block-types/index.mjs +8 -8
  80. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +8 -8
  81. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +8 -8
  82. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +8 -8
  83. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +8 -8
  84. package/dist/astro/routes/api/schema/collections/index.mjs +8 -8
  85. package/dist/astro/routes/api/schema/collections/reorder.mjs +8 -8
  86. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +8 -8
  87. package/dist/astro/routes/api/schema/orphans/index.mjs +8 -8
  88. package/dist/astro/routes/api/settings/backups/archives/_name_.mjs +2 -2
  89. package/dist/astro/routes/api/settings/backups/archives/index.mjs +2 -2
  90. package/dist/astro/routes/api/settings/backups/export.mjs +2 -2
  91. package/dist/astro/routes/api/settings/backups/index.mjs +2 -2
  92. package/dist/astro/routes/api/settings.mjs +3 -3
  93. package/dist/astro/routes/api/setup/dev-bypass.mjs +4 -4
  94. package/dist/astro/routes/api/setup/index.d.mts.map +1 -1
  95. package/dist/astro/routes/api/setup/index.mjs +35 -10
  96. package/dist/astro/routes/api/setup/index.mjs.map +1 -1
  97. package/dist/astro/routes/api/snapshot.mjs +2 -2
  98. package/dist/astro/routes/api/snapshot.mjs.map +1 -1
  99. package/dist/astro/routes/robots.txt.mjs +2 -2
  100. package/dist/astro/routes/sitemap-_collection_.xml.mjs +2 -2
  101. package/dist/astro/routes/sitemap.xml.mjs +2 -2
  102. package/dist/astro/types.d.mts +7 -3
  103. package/dist/astro/types.d.mts.map +1 -1
  104. package/dist/{backup-CBu0LrXf.mjs → backup-BQRj3afm.mjs} +3 -3
  105. package/dist/{backup-CBu0LrXf.mjs.map → backup-BQRj3afm.mjs.map} +1 -1
  106. package/dist/cli/index.mjs +6 -6
  107. package/dist/client/index.d.mts +14 -14
  108. package/dist/{config-5ii2haYu.d.mts → config-BjEm_3xL.d.mts} +25 -16
  109. package/dist/config-BjEm_3xL.d.mts.map +1 -0
  110. package/dist/{context-BeGccdUX.mjs → context-BV_7t-Ua.mjs} +6 -6
  111. package/dist/{context-BeGccdUX.mjs.map → context-BV_7t-Ua.mjs.map} +1 -1
  112. package/dist/{dashboard-DjrB-xxZ.mjs → dashboard-BP-iJqpd.mjs} +2 -2
  113. package/dist/{dashboard-DjrB-xxZ.mjs.map → dashboard-BP-iJqpd.mjs.map} +1 -1
  114. package/dist/db/libsql-migrations.mjs +2 -2
  115. package/dist/db/postgres-migrations.mjs +2 -2
  116. package/dist/db/sqlite-migrations.mjs +2 -2
  117. package/dist/{direct-executor-BmuFJJZV.mjs → direct-executor-D2lNadwo.mjs} +2 -2
  118. package/dist/{direct-executor-BmuFJJZV.mjs.map → direct-executor-D2lNadwo.mjs.map} +1 -1
  119. package/dist/{emdash-runtime-DAjghyEG.mjs → emdash-runtime-CtfnZmPi.mjs} +56 -56
  120. package/dist/emdash-runtime-CtfnZmPi.mjs.map +1 -0
  121. package/dist/{entry-lock-DVhCt49A.d.mts → entry-lock-Cf5OoIgN.d.mts} +18 -18
  122. package/dist/{entry-lock-DVhCt49A.d.mts.map → entry-lock-Cf5OoIgN.d.mts.map} +1 -1
  123. package/dist/{hreflang-DMFBL2eb.mjs → hreflang-CbVI4paR.mjs} +2 -2
  124. package/dist/{hreflang-DMFBL2eb.mjs.map → hreflang-CbVI4paR.mjs.map} +1 -1
  125. package/dist/{identity-IyNWwXr6.mjs → identity-Be5kzutJ.mjs} +2 -2
  126. package/dist/{identity-IyNWwXr6.mjs.map → identity-Be5kzutJ.mjs.map} +1 -1
  127. package/dist/{import-C3JZplWq.mjs → import-YzfKCaco.mjs} +2 -2
  128. package/dist/{import-C3JZplWq.mjs.map → import-YzfKCaco.mjs.map} +1 -1
  129. package/dist/index.d.mts +4 -4
  130. package/dist/index.mjs +16 -16
  131. package/dist/{manifest-builder-B8zR-73J.mjs → manifest-builder-BmSAOOEF.mjs} +2 -2
  132. package/dist/{manifest-builder-B8zR-73J.mjs.map → manifest-builder-BmSAOOEF.mjs.map} +1 -1
  133. package/dist/media/local-runtime.d.mts +3 -3
  134. package/dist/media/local-runtime.mjs +3 -3
  135. package/dist/{media-Qp5S3eH3.mjs → media-CPXTbb1R.mjs} +20 -2
  136. package/dist/media-CPXTbb1R.mjs.map +1 -0
  137. package/dist/{media-h7tOiDLj.mjs → media-JXRWDhw3.mjs} +77 -4
  138. package/dist/media-JXRWDhw3.mjs.map +1 -0
  139. package/dist/{media-usage-My-Vi-ex.mjs → media-usage-De-zeR9E.mjs} +2 -2
  140. package/dist/{media-usage-My-Vi-ex.mjs.map → media-usage-De-zeR9E.mjs.map} +1 -1
  141. package/dist/{menus-TsSGmSR4.mjs → menus-Cm68rsAq.mjs} +4 -4
  142. package/dist/{menus-TsSGmSR4.mjs.map → menus-Cm68rsAq.mjs.map} +1 -1
  143. package/dist/migrations/index.mjs +2 -2
  144. package/dist/page/index.mjs +2 -2
  145. package/dist/plugin-test-runtime.d.mts +3 -3
  146. package/dist/plugin-test-runtime.mjs +18 -18
  147. package/dist/plugin-utils.d.mts +3 -3
  148. package/dist/plugins/adapt-sandbox-entry.d.mts +3 -3
  149. package/dist/plugins/host.d.mts +1 -1
  150. package/dist/plugins/host.mjs +6 -6
  151. package/dist/{redirect-iJf5fltD.mjs → redirect-B29UjdUn.mjs} +10 -14
  152. package/dist/redirect-B29UjdUn.mjs.map +1 -0
  153. package/dist/{redirects-CYu1u1aK.mjs → redirects-Ca2MPfEG.mjs} +2 -2
  154. package/dist/{redirects-CYu1u1aK.mjs.map → redirects-Ca2MPfEG.mjs.map} +1 -1
  155. package/dist/{routes-CUsM40Cc.mjs → routes-vrR95WR6.mjs} +2 -2
  156. package/dist/{routes-CUsM40Cc.mjs.map → routes-vrR95WR6.mjs.map} +1 -1
  157. package/dist/runtime.d.mts +3 -3
  158. package/dist/seed/index.mjs +4 -4
  159. package/dist/seo/index.mjs +3 -3
  160. package/dist/{settings-CgjRWGW9.mjs → settings-B4vDl1fK.mjs} +2 -2
  161. package/dist/{settings-CgjRWGW9.mjs.map → settings-B4vDl1fK.mjs.map} +1 -1
  162. package/dist/{settings-2xNYr90o.mjs → settings-Dyj6v8C4.mjs} +2 -2
  163. package/dist/{settings-2xNYr90o.mjs.map → settings-Dyj6v8C4.mjs.map} +1 -1
  164. package/dist/{snapshot-CugwUqKQ.mjs → snapshot-PawoX-WG.mjs} +180 -3
  165. package/dist/snapshot-PawoX-WG.mjs.map +1 -0
  166. package/dist/{storage-query-Bdv7A62k.d.mts → storage-query-FXJH5pI8.d.mts} +6 -1
  167. package/dist/storage-query-FXJH5pI8.d.mts.map +1 -0
  168. package/dist/{transfer-BhUCrgDc.mjs → transfer-DgeCvHnj.mjs} +4 -4
  169. package/dist/{transfer-BhUCrgDc.mjs.map → transfer-DgeCvHnj.mjs.map} +1 -1
  170. package/dist/validate-CM79QXYE.d.mts.map +1 -1
  171. package/dist/version-DXsxRrob.mjs +7 -0
  172. package/dist/{version-DUQDHgrf.mjs.map → version-DXsxRrob.mjs.map} +1 -1
  173. package/package.json +5 -5
  174. package/src/api/handlers/index.ts +1 -0
  175. package/src/api/handlers/media-upload.ts +17 -71
  176. package/src/api/handlers/media.ts +97 -3
  177. package/src/api/handlers/snapshot.ts +257 -3
  178. package/src/astro/integration/vite-config.ts +10 -4
  179. package/src/astro/middleware.ts +1 -0
  180. package/src/astro/routes/api/setup/index.ts +66 -23
  181. package/src/astro/routes/api/snapshot.ts +2 -1
  182. package/src/astro/types.ts +5 -0
  183. package/src/cleanup.ts +10 -0
  184. package/src/components/Columns.astro +3 -1
  185. package/src/components/Cover.astro +3 -1
  186. package/src/database/repositories/media.ts +40 -1
  187. package/src/database/repositories/redirect.ts +17 -34
  188. package/src/emdash-runtime.ts +28 -0
  189. package/src/index.ts +1 -0
  190. package/src/mcp/server.ts +13 -48
  191. package/src/seed/apply.ts +322 -41
  192. package/dist/apply-CoT603H3.mjs.map +0 -1
  193. package/dist/config-5ii2haYu.d.mts.map +0 -1
  194. package/dist/emdash-runtime-DAjghyEG.mjs.map +0 -1
  195. package/dist/media-Qp5S3eH3.mjs.map +0 -1
  196. package/dist/media-h7tOiDLj.mjs.map +0 -1
  197. package/dist/redirect-iJf5fltD.mjs.map +0 -1
  198. package/dist/snapshot-CugwUqKQ.mjs.map +0 -1
  199. package/dist/storage-query-Bdv7A62k.d.mts.map +0 -1
  200. package/dist/version-DUQDHgrf.mjs +0 -7
package/dist/index.d.mts CHANGED
@@ -5,11 +5,11 @@ import { _ as ManifestResponse, c as ApiContext, d as ContentResponse, f as Fiel
5
5
  import { n as MediaTable, r as UserTable, t as Database } from "./types-B7Lmsh1E.mjs";
6
6
  import { $ as CurrentPluginCapability, $t as PluginStorageConfig, At as PageMetadataContribution, B as ContentPolicyEvent, Bn as normalizeCapability, Bt as PluginComment, Cn as TaxonomyAccess, Ct as MediaMetadataPatch, Dn as TaxonomyTermCreateInput, Dt as PageFragmentContribution, En as TaxonomyReadOptions, Et as NumericDelta, F as ContentDeleteEvent, Fn as VersionedRedirect, Ft as PaginatedResult, G as ContentScheduleStateChangeEvent, Gt as PluginEditorAction, H as ContentRestoreStateChangeEvent, I as ContentHookEvent, In as VersionedValue, It as PluginAdminConfig, Jt as PluginHooks, K as ContentStateChangeEvent, L as ContentItem$1, Lt as PluginAdminExports, Mn as UpdateIfResult, Mt as PageMetadataHandler, On as TaxonomyTermInfo, Ot as PageFragmentEvent, P as ContentCreateOptions, Pn as VersionedContentItem, Pt as PagePlacement, Q as CronTaskInfo, Qt as PluginRouteDefinition, R as ContentListOptions, Rn as isDeprecatedCapability, Rt as PluginAdminPage, Sn as StoredComment, Tn as TaxonomyDefInfo, Tt as ModerationDecision, U as ContentRevisionInfo, Ut as PluginContext, V as ContentPublishStateChangeEvent, Vn as normalizePluginCapabilities, Vt as PluginCommentStatus, W as ContentSchedulePolicyEvent, Wt as PluginDefinition, Yt as PluginManifest, Zt as PluginRoute, _ as ConditionalDeleteResult, _n as SettingField, _t as MediaAccess, a as CollectionSchemaInfo, an as RedirectAccessWithWrite, bn as StorageCollection, c as CommentAfterCreateHandler, cn as RedirectListOptions, ct as FieldSchemaInfo, d as CommentBeforeCreateEvent, dt as HookName, en as PortableTextBlockConfig, et as DeprecatedPluginCapability, f as CommentBeforeCreateHandler, fn as ResolvedHook, ft as HttpAccess, g as CommentModerateHandler, gn as SchemaAccess, gt as LogAccess, h as CommentModerateEvent, hn as RouteContext, i as CollectionCommentSettings, in as RedirectAccess, jn as UpdateIfArgs, jt as PageMetadataEvent, kt as PageFragmentHandler, l as CommentAfterModerateEvent, ln as RedirectStatus, lt as FieldWidgetConfig, m as CommentListOptions, mn as ResolvedPluginHooks, n as BreadcrumbItem, nn as PublicPageContext, o as CommentAccess, on as RedirectCreateInput, p as CommentCountOptions, pn as ResolvedPlugin, pt as KVAccess, q as ContentTranslationSummary, qt as PluginEditorPanel, r as CAPABILITY_RENAMES, s as CommentAfterCreateEvent, sn as RedirectInfo, t as ActorInfo, tn as PortableTextBlockField, u as CommentAfterModerateHandler, un as RedirectUpdateInput, ut as HookConfig, v as ConditionalWriteResult, vn as SettingsAccess, wn as TaxonomyAccessWithWrite, wt as MediaUploadEvent, x as ContentActionOrigin, xt as MediaBytes, y as ContentAccess, yn as SiteInfo, z as ContentPolicyDecision, zn as normalizeCapabilities, zt as PluginCapability } from "./types-Cr-Kg-3D.mjs";
7
7
  import { t as OptionsRepository } from "./options-SQCHQCPH.mjs";
8
- import "./entry-lock-DVhCt49A.mjs";
8
+ import "./entry-lock-Cf5OoIgN.mjs";
9
9
  import { _ as MediaValue, n as generatePlaceholder, r as normalizeMediaValue, t as PlaceholderData } from "./placeholder-MSEd8gty.mjs";
10
- import { $ as getMenus, $n as getSection, $r as generateManifest, $t as invalidateTaxonomyObjectCache, A as WidgetArea, Ai as FieldDefinition, An as isSafeHref, Ar as expandCollectionBlockFields, At as NoopSandboxRunner, B as getTerm, Bi as UserRepository, Bn as PortableTextImageBlock, Br as MediaListResponse, Bt as definePlugin, C as getWidgetComponents, Ci as VersionedScheduledPolicyRejection, Cn as CollectionFilter$1, Ct as GeneratePreviewTokenOptions, D as ReorderWidgetsInput, Di as reference, Dn as WhereValue, Dr as BlockWriteOptions, Dt as generatePreviewToken, E as PropDef, Ei as portableText, En as WhereRange, Er as getCollectionInfo, Et as VerifyPreviewTokenResult, F as getEntryTerms, Fi as CompoundSelectLimitedAdapter, Fn as PortableTextToProsemirrorOptions, Fr as SchemaRegistry, Ft as createPluginManager, G as TaxonomyTerm, Gn as PortableTextTableBlock, Gr as handleMediaList, Gt as contentNamespace, H as invalidateTermCache, Hi as EmDashConfigurationErrorCode, Hn as PortableTextMarkDef, Hr as handleMediaCreate, Ht as CacheNamespace, I as getTaxonomyDef, In as portableTextToProsemirror, Ir as handleMediaUsageActivationAdvance, It as ContentSaveRejectedError, J as getByline, Jn as PortableTextTextBlock, Jr as RevisionListResponse, Jt as invalidateCollectionCache, K as TaxonomyTermRow, Kn as PortableTextTableCell, Kr as handleMediaReplaceMetadata, Kt as contentNamespaces, L as getTaxonomyDefs, Li as CommentRepository, Ln as prosemirrorToPortableText, Lr as handleMediaUsageProgress, Lt as isContentSaveRejection, M as WidgetType, Mi as FileValue, Mn as computeContentHash, Mr as resolveBlockTypes, Mt as createNoopSandboxRunner, N as getAllTermsForEntries, Ni as ImageValue, Nn as hashString, Nr as BlockTypeRegistry, Nt as NodeCronScheduler, O as UpdateWidgetInput, Oi as file, Or as ResolvedBlockTypes, Ot as parseContentId, P as getEntriesByTerm, Pi as PortableTextBlock, Pn as portableTextIdentityExtensions, Pr as SchemaError, Pt as PluginManager, Q as getMenuWithCacheHint, Qn as ProseMirrorNode, Qr as handleRevisionRestore, Qt as invalidateSchemaObjectCache, R as getTaxonomyTerms, Rn as PortableTextCodeBlock, Rr as handleMediaUsageRepair, Rt as ValidatedPluginManifest, S as getWidgetAreas, Si as ScheduledPolicyRejection, Sn as createNoop, St as getPreviewUrl, T as CreateWidgetInput, Ti as scheduledPolicyRejectionKey, Tn as EntryFilter, Tt as VerifyPreviewTokenOptions, U as CreateTermInput, Ui as DatabaseConfig, Un as PortableTextSpan, Ur as handleMediaDelete, Ut as CachedQueryOptions, V as getTermsForEntries, Vi as EmDashConfigurationError, Vn as PortableTextLinkMark, Vr as MediaResponse, Vt as definePluginRoute, W as TaxonomyDef, Wi as EmDashDatabaseError, Wn as PortableTextTableAlignment, Wr as handleMediaGet, Wt as cachedQuery, X as getEntriesByByline, Xn as ProseMirrorDocument, Xr as handleRevisionGet, Xt as invalidateMenuObjectCache, Y as getBylineBySlug, Yn as PortableTextUnknownBlock, Yr as RevisionResponse, Yt as invalidateCommentObjectCache, Z as getMenu, Zn as ProseMirrorMark, Zr as handleRevisionList, Zt as invalidateObjectCache, _ as SearchTokenizer, _i as handleContentUnpublish, _n as resolveEmDashPath, _t as setSiteSettings, a as getSuggestions, ai as handleContentDelete, an as ContentEntry, ar as UpdateSectionInput, at as ReorderMenuItemsInput, b as getWidgetArea, bi as handleScheduledPolicyRejection, bn as FieldAnnotation, bt as GetPreviewUrlOptions, c as searchWithDb, ci as handleContentGet, cn as EntryResult, ct as GetCommentsOptions, d as SEARCH_TOKENIZERS, di as handleContentListTrashed, dn as TranslationSummary, dt as getComments, ei as handleContentAuthors, en as WaitUntilFn, er as getSections, et as CreateMenuInput, f as SearchConfig, fi as handleContentPermanentDelete, fn as TranslationsResult, ft as getPluginSetting, g as SearchStats, gi as handleContentTranslations, gn as getTranslations, gt as getSiteSettingsWithCacheHint, h as SearchResult, hi as handleContentSchedule, hn as getEmDashEntry, hr as SystemCleanupFn, ht as getSiteSettings, i as getSearchStats, ii as handleContentCreate, in as CollectionResult, ir as SectionSource, it as MenuItemType, j as WidgetComponentDef, ji as FieldUIHints, jn as sanitizeHref, jr as normalizeBlocksData, jt as SandboxNotAvailableError, k as Widget, ki as image, kr as StoredBlockValue, kt as verifyPreviewToken, l as FTSManager, li as handleContentGetIncludingTrashed, ln as InferCollectionData, lt as GetCommentsResult, m as SearchResponse, mi as handleContentRestore, mn as getEmDashCollection, mr as CronScheduler, mt as getSiteSetting, n as extractPlainText, ni as handleContentCountScheduled, nn as CacheHint, nr as GetSectionsOptions, nt as Menu, o as search, oi as handleContentDiscardDraft, on as EditFieldMeta, ot as UpdateMenuInput, p as SearchOptions, pi as handleContentPublish, pn as getEditMeta, pt as getPluginSettings, q as UpdateTermInput, qn as PortableTextTableRow, qr as handleMediaUpdate, qt as invalidateBylineObjectCache, r as extractSearchableFields, ri as handleContentCountTrashed, rn as CollectionFilter, rr as Section, rt as MenuItem, s as searchCollection, si as handleContentDuplicate, sn as EmDashCollections, st as UpdateMenuItemInput, ti as handleContentCompare, tn as after, tr as CreateSectionInput, tt as CreateMenuItemInput, u as CollectionSearchOptions, ui as handleContentList, un as ResolvePathResult, ut as getCommentCount, v as SuggestOptions, vi as handleContentUnschedule, vn as CMSAnnotation, vt as getPreviewToken, w as CreateWidgetAreaInput, wi as isScheduledPolicyRejection, wn as EntryData, wt as PreviewTokenPayload, x as getWidgetAreaWithCacheHint, xi as SCHEDULED_POLICY_REJECTION_PREFIX, xn as createEditable, xr as PluginDescriptor, xt as buildPreviewUrl, y as Suggestion, yi as handleContentUpdate, yn as EditProxy, yr as PluginRouteError, yt as isPreviewRequest, z as getTaxonomyTermsWithCacheHint, zi as RevisionRepository, zn as PortableTextHtmlBlock, zt as pluginManifestSchema } from "./config-5ii2haYu.mjs";
10
+ import { $ as getMenus, $n as getSection, $r as handleRevisionRestore, $t as invalidateTaxonomyObjectCache, A as WidgetArea, Ai as image, An as isSafeHref, Ar as expandCollectionBlockFields, At as NoopSandboxRunner, B as getTerm, Bi as RevisionRepository, Bn as PortableTextImageBlock, Br as MediaListResponse, Bt as definePlugin, C as getWidgetComponents, Ci as ScheduledPolicyRejection, Cn as CollectionFilter$1, Ct as GeneratePreviewTokenOptions, D as ReorderWidgetsInput, Di as portableText, Dn as WhereValue, Dr as BlockWriteOptions, Dt as generatePreviewToken, E as PropDef, Ei as scheduledPolicyRejectionKey, En as WhereRange, Er as getCollectionInfo, Et as VerifyPreviewTokenResult, F as getEntryTerms, Fi as PortableTextBlock, Fn as PortableTextToProsemirrorOptions, Fr as SchemaRegistry, Ft as createPluginManager, G as TaxonomyTerm, Gi as EmDashDatabaseError, Gn as PortableTextTableBlock, Gr as handleMediaList, Gt as contentNamespace, H as invalidateTermCache, Hi as EmDashConfigurationError, Hn as PortableTextMarkDef, Hr as handleMediaCreate, Ht as CacheNamespace, I as getTaxonomyDef, Ii as CompoundSelectLimitedAdapter, In as portableTextToProsemirror, Ir as handleMediaUsageActivationAdvance, It as ContentSaveRejectedError, J as getByline, Jn as PortableTextTextBlock, Jr as handleMediaUpdate, Jt as invalidateCollectionCache, K as TaxonomyTermRow, Kn as PortableTextTableCell, Kr as handleMediaRegisterUpload, Kt as contentNamespaces, L as getTaxonomyDefs, Ln as prosemirrorToPortableText, Lr as handleMediaUsageProgress, Lt as isContentSaveRejection, M as WidgetType, Mi as FieldUIHints, Mn as computeContentHash, Mr as resolveBlockTypes, Mt as createNoopSandboxRunner, N as getAllTermsForEntries, Ni as FileValue, Nn as hashString, Nr as BlockTypeRegistry, Nt as NodeCronScheduler, O as UpdateWidgetInput, Oi as reference, Or as ResolvedBlockTypes, Ot as parseContentId, P as getEntriesByTerm, Pi as ImageValue, Pn as portableTextIdentityExtensions, Pr as SchemaError, Pt as PluginManager, Q as getMenuWithCacheHint, Qn as ProseMirrorNode, Qr as handleRevisionList, Qt as invalidateSchemaObjectCache, R as getTaxonomyTerms, Ri as CommentRepository, Rn as PortableTextCodeBlock, Rr as handleMediaUsageRepair, Rt as ValidatedPluginManifest, S as getWidgetAreas, Si as SCHEDULED_POLICY_REJECTION_PREFIX, Sn as createNoop, St as getPreviewUrl, T as CreateWidgetInput, Ti as isScheduledPolicyRejection, Tn as EntryFilter, Tt as VerifyPreviewTokenOptions, U as CreateTermInput, Ui as EmDashConfigurationErrorCode, Un as PortableTextSpan, Ur as handleMediaDelete, Ut as CachedQueryOptions, V as getTermsForEntries, Vi as UserRepository, Vn as PortableTextLinkMark, Vr as MediaResponse, Vt as definePluginRoute, W as TaxonomyDef, Wi as DatabaseConfig, Wn as PortableTextTableAlignment, Wr as handleMediaGet, Wt as cachedQuery, X as getEntriesByByline, Xn as ProseMirrorDocument, Xr as RevisionResponse, Xt as invalidateMenuObjectCache, Y as getBylineBySlug, Yn as PortableTextUnknownBlock, Yr as RevisionListResponse, Yt as invalidateCommentObjectCache, Z as getMenu, Zn as ProseMirrorMark, Zr as handleRevisionGet, Zt as invalidateObjectCache, _ as SearchTokenizer, _i as handleContentTranslations, _n as resolveEmDashPath, _t as setSiteSettings, a as getSuggestions, ai as handleContentCreate, an as ContentEntry, ar as UpdateSectionInput, at as ReorderMenuItemsInput, b as getWidgetArea, bi as handleContentUpdate, bn as FieldAnnotation, bt as GetPreviewUrlOptions, c as searchWithDb, ci as handleContentDuplicate, cn as EntryResult, ct as GetCommentsOptions, d as SEARCH_TOKENIZERS, di as handleContentList, dn as TranslationSummary, dt as getComments, ei as generateManifest, en as WaitUntilFn, er as getSections, et as CreateMenuInput, f as SearchConfig, fi as handleContentListTrashed, fn as TranslationsResult, ft as getPluginSetting, g as SearchStats, gi as handleContentSchedule, gn as getTranslations, gt as getSiteSettingsWithCacheHint, h as SearchResult, hi as handleContentRestore, hn as getEmDashEntry, hr as SystemCleanupFn, ht as getSiteSettings, i as getSearchStats, ii as handleContentCountTrashed, in as CollectionResult, ir as SectionSource, it as MenuItemType, j as WidgetComponentDef, ji as FieldDefinition, jn as sanitizeHref, jr as normalizeBlocksData, jt as SandboxNotAvailableError, k as Widget, ki as file, kr as StoredBlockValue, kt as verifyPreviewToken, l as FTSManager, li as handleContentGet, ln as InferCollectionData, lt as GetCommentsResult, m as SearchResponse, mi as handleContentPublish, mn as getEmDashCollection, mr as CronScheduler, mt as getSiteSetting, n as extractPlainText, ni as handleContentCompare, nn as CacheHint, nr as GetSectionsOptions, nt as Menu, o as search, oi as handleContentDelete, on as EditFieldMeta, ot as UpdateMenuInput, p as SearchOptions, pi as handleContentPermanentDelete, pn as getEditMeta, pt as getPluginSettings, q as UpdateTermInput, qn as PortableTextTableRow, qr as handleMediaReplaceMetadata, qt as invalidateBylineObjectCache, r as extractSearchableFields, ri as handleContentCountScheduled, rn as CollectionFilter, rr as Section, rt as MenuItem, s as searchCollection, si as handleContentDiscardDraft, sn as EmDashCollections, st as UpdateMenuItemInput, ti as handleContentAuthors, tn as after, tr as CreateSectionInput, tt as CreateMenuItemInput, u as CollectionSearchOptions, ui as handleContentGetIncludingTrashed, un as ResolvePathResult, ut as getCommentCount, v as SuggestOptions, vi as handleContentUnpublish, vn as CMSAnnotation, vt as getPreviewToken, w as CreateWidgetAreaInput, wi as VersionedScheduledPolicyRejection, wn as EntryData, wt as PreviewTokenPayload, x as getWidgetAreaWithCacheHint, xi as handleScheduledPolicyRejection, xn as createEditable, xr as PluginDescriptor, xt as buildPreviewUrl, y as Suggestion, yi as handleContentUnschedule, yn as EditProxy, yr as PluginRouteError, yt as isPreviewRequest, z as getTaxonomyTermsWithCacheHint, zn as PortableTextHtmlBlock, zt as pluginManifestSchema } from "./config-BjEm_3xL.mjs";
11
11
  import { a as getMigrationStatus, i as getExactMigrationStatus, n as MIGRATION_NAMES, r as MigrationStatus, t as ExactMigrationStatus } from "./runner-D5_LzKXI.mjs";
12
- import { $ as MediaRepository, B as EncryptedPluginSetting, C as SandboxedPluginInstance, D as getSandboxRouteErrorDetails, E as createSandboxRouteErrorEnvelope, F as createMediaAccess, G as isEncryptedPluginSetting, H as createSettingsAccess, I as createRedirectAccess, J as HookResult, L as createSchemaAccess, M as createCommentAccess, N as createContentAccessWithWrite, O as getSandboxRouteErrorEnvelope, P as createHttpAccess, Q as MediaItem, R as createUnrestrictedHttpAccess, S as SandboxUnavailableError, T as createSandboxRouteError, U as decodePluginSettingValue, V as PluginSettingEncryptionError, W as encryptPluginSetting, X as PluginStorageRepository, Y as createHookPipeline, Z as CreateMediaInput, _ as SandboxRouteErrorCode, a as readPluginMediaBytes, b as SandboxRunner, c as CronAccessImpl, d as SandboxContentCreateCallback, f as SandboxEmailMessage, g as SandboxOptions, h as SandboxInvocationOptions, i as parsePluginMediaMetadataPatch, j as RedirectAccessError, k as ContentActionCallbacks, m as SandboxHttpFetchCallback, n as DEFAULT_PLUGIN_MEDIA_READ_BYTES, o as toPluginMediaItem, p as SandboxEmailSendCallback, q as HookPipeline, r as MAX_PLUGIN_MEDIA_READ_BYTES, rt as resolvePluginEncryptionKeys, s as updatePluginMediaMetadata, t as StorageSerializationError, tt as ContentRepository, u as SandboxCommentModerateCallback, v as SandboxRouteErrorDetails, w as SerializedRequest, x as SandboxRunnerFactory, y as SandboxRouteErrorEnvelope, z as createContentAccess } from "./storage-query-Bdv7A62k.mjs";
12
+ import { $ as MediaRepository, B as EncryptedPluginSetting, C as SandboxedPluginInstance, D as getSandboxRouteErrorDetails, E as createSandboxRouteErrorEnvelope, F as createMediaAccess, G as isEncryptedPluginSetting, H as createSettingsAccess, I as createRedirectAccess, J as HookResult, L as createSchemaAccess, M as createCommentAccess, N as createContentAccessWithWrite, O as getSandboxRouteErrorEnvelope, P as createHttpAccess, Q as MediaItem, R as createUnrestrictedHttpAccess, S as SandboxUnavailableError, T as createSandboxRouteError, U as decodePluginSettingValue, V as PluginSettingEncryptionError, W as encryptPluginSetting, X as PluginStorageRepository, Y as createHookPipeline, Z as CreateMediaInput, _ as SandboxRouteErrorCode, a as readPluginMediaBytes, b as SandboxRunner, c as CronAccessImpl, d as SandboxContentCreateCallback, f as SandboxEmailMessage, g as SandboxOptions, h as SandboxInvocationOptions, i as parsePluginMediaMetadataPatch, j as RedirectAccessError, k as ContentActionCallbacks, m as SandboxHttpFetchCallback, n as DEFAULT_PLUGIN_MEDIA_READ_BYTES, o as toPluginMediaItem, p as SandboxEmailSendCallback, q as HookPipeline, r as MAX_PLUGIN_MEDIA_READ_BYTES, rt as resolvePluginEncryptionKeys, s as updatePluginMediaMetadata, t as StorageSerializationError, tt as ContentRepository, u as SandboxCommentModerateCallback, v as SandboxRouteErrorDetails, w as SerializedRequest, x as SandboxRunnerFactory, y as SandboxRouteErrorEnvelope, z as createContentAccess } from "./storage-query-FXJH5pI8.mjs";
13
13
  import { C as decodeSlug, S as parseWxrString, _ as WxrPost, a as clearSources, b as WxrTerm, c as getSource, d as registerSource, f as importReusableBlocksAsSections, g as WxrData, h as WxrCategory, i as wxrSource, l as getUrlSources, m as WxrAuthor, n as wordpressRestSource, o as getAllSources, p as WxrAttachment, r as parseWxrDate, s as getFileSources, u as probeUrl, v as WxrSite, w as slugify, x as parseWxr, y as WxrTag } from "./index-D-hdtLe8.mjs";
14
14
  import { a as ExecuteCollectionDeletionGuard, c as SqliteConfig, i as DatabaseDialectType, n as CollectionDeletionGuardResult, o as LibsqlConfig, r as DatabaseDescriptor, s as PostgresConfig, t as CollectionDeletionGuardInput } from "./adapters-B64LbYcB.mjs";
15
15
  import { a as ListOptions, c as S3StorageConfig, d as Storage, f as StorageDescriptor, i as FileInfo, l as SignedUploadOptions, n as DownloadResult, o as ListResult, p as UploadResult, r as EmDashStorageError, s as LocalStorageConfig, t as CreateStorageFn, u as SignedUploadUrl } from "./types-DA1Te3Oy.mjs";
@@ -29,4 +29,4 @@ import { SeoMeta, SeoMetaOptions, getContentSeo, getSeoMeta } from "./seo/index.
29
29
  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-CM79QXYE.mjs";
30
30
  import "./seed/index.mjs";
31
31
  import { ulid } from "ulidx";
32
- export { type ActorInfo, type ApiContext, type ApplySeedBlockTypeInput, type AttachmentInfo, type AuthDescriptor, type AuthProviderAdminExports, type AuthProviderDescriptor, type AuthProviderModule, type AuthResult, type AuthRouteDescriptor, type BlockFieldDefinition, type BlockFieldOptions, type BlockFieldType, type BlockType, type BlockTypeCompatibility, type BlockTypeDifference, BlockTypeRegistry, type BlockTypeSource, type BlockTypeVersion, type BlockWriteOptions, type BreadcrumbItem, type BylineSummary, CAPABILITY_RENAMES, type CMSAnnotation, type CacheHint, CacheNamespace, type CachedQueryOptions, type Collection, type CollectionCommentSettings, type CollectionDeletionGuardInput, type CollectionDeletionGuardResult, type CollectionFilter, type CollectionResult, type CollectionSchemaInfo, type CollectionSchemaStatus, type CollectionSearchOptions, type CollectionSource, type CollectionSupport, type CollectionWithFields, type ColumnType, type CommentAccess, type CommentAfterCreateEvent, type CommentAfterCreateHandler, type CommentAfterModerateEvent, type CommentAfterModerateHandler, type CommentBeforeCreateEvent, type CommentBeforeCreateHandler, type CommentCountOptions, type CommentListOptions, type CommentModerateEvent, type CommentModerateHandler, CommentRepository, type CompoundSelectLimitedAdapter, type ConditionalDeleteResult, type ConditionalWriteResult, type ContentAccess, type ContentActionCallbacks, type ContentActionOrigin, type ContentBylineCredit, type ContentCreateOptions, type ContentDeleteEvent, type ContentEntry, type ContentFieldFilterScalar, type ContentFieldFilterValue, type ContentFieldFilters, type ContentFieldInFilter, type ContentFieldRangeFilter, type ContentHookEvent, type ContentItem, type ContentListOptions, type ContentListResponse, type ContentPolicyDecision, type ContentPolicyEvent, type ContentPublishStateChangeEvent, ContentRepository, type ContentResponse, type ContentRestoreStateChangeEvent, type ContentRevisionInfo, ContentSaveRejectedError, type ContentSchedulePolicyEvent, type ContentScheduleStateChangeEvent, type ContentSeo, type ContentSeoInput, type ContentStateChangeEvent, type ContentTranslationSummary, type CreateBlockTypeInput, type CreateCollectionInput, type CreateContentInput, type CreateFieldInput, type CreateMediaInput, type CreateMenuInput, type CreateMenuItemInput, type CreateObjectCacheBackendFn, type CreateSectionInput, type CreateStorageFn, type CreateTermInput, type CreateWidgetAreaInput, type CreateWidgetInput, CronAccessImpl, type CronScheduler, type CronTaskInfo, type CurrentPluginCapability, DEFAULT_PLUGIN_MEDIA_READ_BYTES, type Database, type DatabaseConfig, type DatabaseDescriptor, type DatabaseDialectType, type DeprecatedPluginCapability, type DownloadResult, type EditFieldMeta, type EditProxy, type EmDashCollections, EmDashConfigurationError, type EmDashConfigurationErrorCode, EmDashDatabaseError, type EmDashRequestContext, EmDashStorageError, EmDashValidationError, type EncryptedPluginSetting, type EntryData, type EntryFilter, type EntryResult, type ExactMigrationStatus, type ExecuteCollectionDeletionGuard, type ExternalAuthConfig, FIELD_TYPE_TO_COLUMN, FTSManager, type FetchOptions, type Field, type FieldAnnotation, type FieldCompatibility, type FieldDefinition, type FieldDescriptor, type FieldSchemaInfo, 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 HreflangAlternate, type HreflangOptions, type HttpAccess, type I18nConfig, type ImageValue, type ImportAnalysis, type ImportConfig, type ImportContext, type ImportFieldDef, type ImportResult, type ImportSource, type InferCollectionData, InvalidCursorError, type KVAccess, type LibsqlConfig, type ListOptions, type ListResponse, type ListResult, type CollectionFilter$1 as LoaderCollectionFilter, type LocalStorageConfig, type LogAccess, MAX_PLUGIN_MEDIA_READ_BYTES, MAX_SANDBOX_SAVE_REJECTION_REASON_LENGTH, MIGRATION_NAMES, type ManifestCollectionDescriptor, type ManifestCollectionMap, type ManifestFieldDescriptor, type ManifestResponse, type MediaAccess, type MediaBytes, type MediaItem, type MediaListResponse, type MediaMetadataPatch, type MediaReference, MediaRepository, type MediaResponse, type MediaTable, type MediaUploadEvent, type MediaValue, type Menu, type MenuItem, type MenuItemType, type MigrationStatus, type ModerationDecision, NodeCronScheduler, NoopSandboxRunner, type NormalizedItem, type NumericDelta, type OAuthInput, type ObjectCacheBackend, type ObjectCacheDescriptor, type ObjectCacheRuntimeConfig, OptionsRepository, PLUGIN_HTTP_MAX_REQUEST_BYTES, PLUGIN_HTTP_MAX_RESPONSE_BYTES, type PageFragmentContribution, type PageFragmentEvent, type PageFragmentHandler, type PageMetadataContribution, type PageMetadataEvent, type PageMetadataHandler, type PagePlacement, type PaginatedResult, type PlaceholderData, type PluginAdminConfig, type PluginAdminExports, type PluginAdminPage, type PluginCapability, type PluginComment, type PluginCommentStatus, type ContentItem$1 as PluginContentItem, type PluginContext, type PluginDefinition, type PluginDescriptor, type PluginEditorAction, type PluginEditorPanel, type PluginHooks, type PluginHttpRedirectAction, type PluginHttpResponseWire, PluginManager, type PluginManifest, type PluginRoute, type PluginRouteDefinition, PluginRouteError, type PluginSecretRedactor, PluginSettingEncryptionError, type PluginStorageConfig, PluginStorageRepository, type PortableTextBlock, type PortableTextBlockConfig, type PortableTextBlockField, type PortableTextCodeBlock, type PortableTextHtmlBlock, type PortableTextImageBlock, type PortableTextLinkMark, type PortableTextMarkDef, type PortableTextSpan, type PortableTextTableAlignment, type PortableTextTableBlock, type PortableTextTableCell, type PortableTextTableRow, type PortableTextTextBlock, type PortableTextToProsemirrorOptions, 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 RedirectAccess, RedirectAccessError, type RedirectAccessWithWrite, type RedirectCreateInput, type RedirectInfo, type RedirectListOptions, type RedirectStatus, type RedirectUpdateInput, type ReorderMenuItemsInput, type ReorderWidgetsInput, type ResolvePathResult, type ResolvedBlockTypes, type ResolvedHook, type ResolvedPlugin, type ResolvedPluginHooks, type RevisionListResponse, RevisionRepository, type RevisionResponse, type RouteContext, type S3StorageConfig, SANDBOX_HOOK_RESULT_VERSION, SCHEDULED_POLICY_REJECTION_PREFIX, SEARCH_TOKENIZERS, type SandboxCommentModerateCallback, type SandboxContentCreateCallback, type SandboxEmailMessage, type SandboxEmailSendCallback, type SandboxHookErrorEnvelope, type SandboxHookResultInspection, type SandboxHttpFetchCallback, type SandboxInvocationOptions, SandboxNotAvailableError, type SandboxOptions, type SandboxRouteErrorCode, type SandboxRouteErrorDetails, type SandboxRouteErrorEnvelope, type SandboxRunner, type SandboxRunnerFactory, type SandboxSaveRejectedError, SandboxUnavailableError, type SandboxedPluginInstance, type ScheduledPolicyRejection, type SchemaAccess, SchemaError, SchemaRegistry, type SearchConfig, type SearchOptions, type SearchResponse, type SearchResult, type SearchStats, type SearchTokenizer, type Section, type SectionSource, type SeedApplyOptions, type SeedApplyResult, type SeedBlockTypeVersionInput, 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 SeoSettingsUpdate, type SerializedRequest, type SettingField, type SettingsAccess, type SignedUploadOptions, type SignedUploadUrl, type SiteInfo, type SiteSettingKey, type SiteSettings, type SiteSettingsUpdate, type SourceAuth, type SourceCapabilities, type SourceInput, type SourceProbeResult, type SqliteConfig, type Storage, type StorageCollection, type StorageDescriptor, StorageSerializationError, type StoredBlockValue, type StoredComment, type SuggestOptions, type SuggestedAction, type Suggestion, type SystemCleanupFn, type TaxonomyAccess, type TaxonomyAccessWithWrite, type TaxonomyDef, type TaxonomyDefInfo, type TaxonomyReadOptions, type TaxonomyTerm, type TaxonomyTermCreateInput, type TaxonomyTermInfo, type TaxonomyTermRow, type TranslationSummary, type TranslationsResult, type UnsupportedFieldType, type UpdateBlockTypeInput, type UpdateCollectionInput, type UpdateContentInput, type UpdateFieldInput, type UpdateIfArgs, type UpdateIfResult, type UpdateMenuInput, type UpdateMenuItemInput, type UpdateSectionInput, type UpdateTermInput, type UpdateWidgetInput, type UploadResult, type UrlInput, UserRepository, type UserTable, type ValidatedPluginManifest, type ValidationResult, type VerifyPreviewTokenOptions, type VerifyPreviewTokenResult, type VersionedContentItem, type VersionedRedirect, type VersionedScheduledPolicyRejection, type VersionedValue, type WaitUntilFn, type WhereRange, type WhereValue, type Widget, type WidgetArea, type WidgetComponentDef, type WidgetType, type WxrAttachment, type WxrAuthor, type WxrCategory, type WxrData, type WxrPost, type WxrSite, type WxrTag, type WxrTerm, adaptSandboxEntry, after, applySeed, bufferPluginHttpRequest, buildPreviewUrl, cachedQuery, clearSources, computeContentHash, contentNamespace, contentNamespaces, createCommentAccess, createContentAccess, createContentAccessWithWrite, createEditable, createHookPipeline, createHttpAccess, createMediaAccess, createNoop, createNoopSandboxRunner, createPluginManager, createPluginSecretRedactor, createRedirectAccess, createSandboxRouteError, createSandboxRouteErrorEnvelope, createSchemaAccess, createSettingsAccess, createUnrestrictedHttpAccess, decodePluginSettingValue, decodeSlug, definePlugin, definePluginRoute, encryptPluginSetting, expandCollectionBlockFields, extractPlainText, extractSearchableFields, file, generateManifest, generatePlaceholder, generatePreviewToken, getAllSources, getAllTermsForEntries, getByline, getBylineBySlug, getCollectionInfo, getCommentCount, getComments, getContentSeo, getEditMeta, getEmDashCollection, getEmDashEntry, getEntriesByByline, getEntriesByTerm, getEntryTerms, getExactMigrationStatus, getFallbackChain, getFileSources, getHreflangAlternates, getI18nConfig, getMenu, getMenuWithCacheHint, getMenus, getMigrationStatus, getPluginSetting, getPluginSettings, getPreviewToken, getPreviewUrl, getRequestContext, getSandboxRouteErrorDetails, getSandboxRouteErrorEnvelope, getSearchStats, getSection, getSections, getSeoMeta, getSiteSetting, getSiteSettings, getSiteSettingsWithCacheHint, getSource, getSuggestions, getTaxonomyDef, getTaxonomyDefs, getTaxonomyTerms, getTaxonomyTermsWithCacheHint, getTerm, getTermsForEntries, getTranslations, getUrlSources, getWidgetArea, getWidgetAreaWithCacheHint, getWidgetAreas, getWidgetComponents, handleContentAuthors, handleContentCompare, handleContentCountScheduled, handleContentCountTrashed, handleContentCreate, handleContentDelete, handleContentDiscardDraft, handleContentDuplicate, handleContentGet, handleContentGetIncludingTrashed, handleContentList, handleContentListTrashed, handleContentPermanentDelete, handleContentPublish, handleContentRestore, handleContentSchedule, handleContentTranslations, handleContentUnpublish, handleContentUnschedule, handleContentUpdate, handleMediaCreate, handleMediaDelete, handleMediaGet, handleMediaList, handleMediaReplaceMetadata, handleMediaUpdate, handleMediaUsageActivationAdvance, handleMediaUsageProgress, handleMediaUsageRepair, handleRevisionGet, handleRevisionList, handleRevisionRestore, handleScheduledPolicyRejection, hashString, image, importReusableBlocksAsSections, inspectSandboxHookResult, invalidateBylineObjectCache, invalidateCollectionCache, invalidateCommentObjectCache, invalidateMenuObjectCache, invalidateObjectCache, invalidateSchemaObjectCache, invalidateTaxonomyObjectCache, invalidateTermCache, isContentSaveRejection, isDeprecatedCapability, isEncryptedPluginSetting, isI18nEnabled, isPreviewRequest, isSafeHref, isScheduledPolicyRejection, normalizeBlocksData, normalizeCapabilities, normalizeCapability, normalizeMediaValue, normalizePluginCapabilities, parseContentId, parsePluginMediaMetadataPatch, parseWxr, parseWxrDate, parseWxrString, pluginHttpRedirectAction, pluginHttpResponseFromWire, pluginHttpResponseToWire, pluginManifestSchema, pluginResponse, portableText, portableTextIdentityExtensions, portableTextToProsemirror, probeUrl, prosemirrorToPortableText, readPluginHttpBytes, readPluginMediaBytes, reference, registerSource, resolveBlockTypes, resolveContentCreateLocale, resolveEmDashPath, resolvePluginEncryptionKeys, rewritePluginHttpRedirect, runWithContext, sanitizeHref, scheduledPolicyRejectionKey, search, searchCollection, searchWithDb, setSiteSettings, slugify, toPluginMediaItem, ulid, updatePluginMediaMetadata, validateSeed, verifyPreviewToken, wordpressRestSource, wxrSource };
32
+ export { type ActorInfo, type ApiContext, type ApplySeedBlockTypeInput, type AttachmentInfo, type AuthDescriptor, type AuthProviderAdminExports, type AuthProviderDescriptor, type AuthProviderModule, type AuthResult, type AuthRouteDescriptor, type BlockFieldDefinition, type BlockFieldOptions, type BlockFieldType, type BlockType, type BlockTypeCompatibility, type BlockTypeDifference, BlockTypeRegistry, type BlockTypeSource, type BlockTypeVersion, type BlockWriteOptions, type BreadcrumbItem, type BylineSummary, CAPABILITY_RENAMES, type CMSAnnotation, type CacheHint, CacheNamespace, type CachedQueryOptions, type Collection, type CollectionCommentSettings, type CollectionDeletionGuardInput, type CollectionDeletionGuardResult, type CollectionFilter, type CollectionResult, type CollectionSchemaInfo, type CollectionSchemaStatus, type CollectionSearchOptions, type CollectionSource, type CollectionSupport, type CollectionWithFields, type ColumnType, type CommentAccess, type CommentAfterCreateEvent, type CommentAfterCreateHandler, type CommentAfterModerateEvent, type CommentAfterModerateHandler, type CommentBeforeCreateEvent, type CommentBeforeCreateHandler, type CommentCountOptions, type CommentListOptions, type CommentModerateEvent, type CommentModerateHandler, CommentRepository, type CompoundSelectLimitedAdapter, type ConditionalDeleteResult, type ConditionalWriteResult, type ContentAccess, type ContentActionCallbacks, type ContentActionOrigin, type ContentBylineCredit, type ContentCreateOptions, type ContentDeleteEvent, type ContentEntry, type ContentFieldFilterScalar, type ContentFieldFilterValue, type ContentFieldFilters, type ContentFieldInFilter, type ContentFieldRangeFilter, type ContentHookEvent, type ContentItem, type ContentListOptions, type ContentListResponse, type ContentPolicyDecision, type ContentPolicyEvent, type ContentPublishStateChangeEvent, ContentRepository, type ContentResponse, type ContentRestoreStateChangeEvent, type ContentRevisionInfo, ContentSaveRejectedError, type ContentSchedulePolicyEvent, type ContentScheduleStateChangeEvent, type ContentSeo, type ContentSeoInput, type ContentStateChangeEvent, type ContentTranslationSummary, type CreateBlockTypeInput, type CreateCollectionInput, type CreateContentInput, type CreateFieldInput, type CreateMediaInput, type CreateMenuInput, type CreateMenuItemInput, type CreateObjectCacheBackendFn, type CreateSectionInput, type CreateStorageFn, type CreateTermInput, type CreateWidgetAreaInput, type CreateWidgetInput, CronAccessImpl, type CronScheduler, type CronTaskInfo, type CurrentPluginCapability, DEFAULT_PLUGIN_MEDIA_READ_BYTES, type Database, type DatabaseConfig, type DatabaseDescriptor, type DatabaseDialectType, type DeprecatedPluginCapability, type DownloadResult, type EditFieldMeta, type EditProxy, type EmDashCollections, EmDashConfigurationError, type EmDashConfigurationErrorCode, EmDashDatabaseError, type EmDashRequestContext, EmDashStorageError, EmDashValidationError, type EncryptedPluginSetting, type EntryData, type EntryFilter, type EntryResult, type ExactMigrationStatus, type ExecuteCollectionDeletionGuard, type ExternalAuthConfig, FIELD_TYPE_TO_COLUMN, FTSManager, type FetchOptions, type Field, type FieldAnnotation, type FieldCompatibility, type FieldDefinition, type FieldDescriptor, type FieldSchemaInfo, 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 HreflangAlternate, type HreflangOptions, type HttpAccess, type I18nConfig, type ImageValue, type ImportAnalysis, type ImportConfig, type ImportContext, type ImportFieldDef, type ImportResult, type ImportSource, type InferCollectionData, InvalidCursorError, type KVAccess, type LibsqlConfig, type ListOptions, type ListResponse, type ListResult, type CollectionFilter$1 as LoaderCollectionFilter, type LocalStorageConfig, type LogAccess, MAX_PLUGIN_MEDIA_READ_BYTES, MAX_SANDBOX_SAVE_REJECTION_REASON_LENGTH, MIGRATION_NAMES, type ManifestCollectionDescriptor, type ManifestCollectionMap, type ManifestFieldDescriptor, type ManifestResponse, type MediaAccess, type MediaBytes, type MediaItem, type MediaListResponse, type MediaMetadataPatch, type MediaReference, MediaRepository, type MediaResponse, type MediaTable, type MediaUploadEvent, type MediaValue, type Menu, type MenuItem, type MenuItemType, type MigrationStatus, type ModerationDecision, NodeCronScheduler, NoopSandboxRunner, type NormalizedItem, type NumericDelta, type OAuthInput, type ObjectCacheBackend, type ObjectCacheDescriptor, type ObjectCacheRuntimeConfig, OptionsRepository, PLUGIN_HTTP_MAX_REQUEST_BYTES, PLUGIN_HTTP_MAX_RESPONSE_BYTES, type PageFragmentContribution, type PageFragmentEvent, type PageFragmentHandler, type PageMetadataContribution, type PageMetadataEvent, type PageMetadataHandler, type PagePlacement, type PaginatedResult, type PlaceholderData, type PluginAdminConfig, type PluginAdminExports, type PluginAdminPage, type PluginCapability, type PluginComment, type PluginCommentStatus, type ContentItem$1 as PluginContentItem, type PluginContext, type PluginDefinition, type PluginDescriptor, type PluginEditorAction, type PluginEditorPanel, type PluginHooks, type PluginHttpRedirectAction, type PluginHttpResponseWire, PluginManager, type PluginManifest, type PluginRoute, type PluginRouteDefinition, PluginRouteError, type PluginSecretRedactor, PluginSettingEncryptionError, type PluginStorageConfig, PluginStorageRepository, type PortableTextBlock, type PortableTextBlockConfig, type PortableTextBlockField, type PortableTextCodeBlock, type PortableTextHtmlBlock, type PortableTextImageBlock, type PortableTextLinkMark, type PortableTextMarkDef, type PortableTextSpan, type PortableTextTableAlignment, type PortableTextTableBlock, type PortableTextTableCell, type PortableTextTableRow, type PortableTextTextBlock, type PortableTextToProsemirrorOptions, 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 RedirectAccess, RedirectAccessError, type RedirectAccessWithWrite, type RedirectCreateInput, type RedirectInfo, type RedirectListOptions, type RedirectStatus, type RedirectUpdateInput, type ReorderMenuItemsInput, type ReorderWidgetsInput, type ResolvePathResult, type ResolvedBlockTypes, type ResolvedHook, type ResolvedPlugin, type ResolvedPluginHooks, type RevisionListResponse, RevisionRepository, type RevisionResponse, type RouteContext, type S3StorageConfig, SANDBOX_HOOK_RESULT_VERSION, SCHEDULED_POLICY_REJECTION_PREFIX, SEARCH_TOKENIZERS, type SandboxCommentModerateCallback, type SandboxContentCreateCallback, type SandboxEmailMessage, type SandboxEmailSendCallback, type SandboxHookErrorEnvelope, type SandboxHookResultInspection, type SandboxHttpFetchCallback, type SandboxInvocationOptions, SandboxNotAvailableError, type SandboxOptions, type SandboxRouteErrorCode, type SandboxRouteErrorDetails, type SandboxRouteErrorEnvelope, type SandboxRunner, type SandboxRunnerFactory, type SandboxSaveRejectedError, SandboxUnavailableError, type SandboxedPluginInstance, type ScheduledPolicyRejection, type SchemaAccess, SchemaError, SchemaRegistry, type SearchConfig, type SearchOptions, type SearchResponse, type SearchResult, type SearchStats, type SearchTokenizer, type Section, type SectionSource, type SeedApplyOptions, type SeedApplyResult, type SeedBlockTypeVersionInput, 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 SeoSettingsUpdate, type SerializedRequest, type SettingField, type SettingsAccess, type SignedUploadOptions, type SignedUploadUrl, type SiteInfo, type SiteSettingKey, type SiteSettings, type SiteSettingsUpdate, type SourceAuth, type SourceCapabilities, type SourceInput, type SourceProbeResult, type SqliteConfig, type Storage, type StorageCollection, type StorageDescriptor, StorageSerializationError, type StoredBlockValue, type StoredComment, type SuggestOptions, type SuggestedAction, type Suggestion, type SystemCleanupFn, type TaxonomyAccess, type TaxonomyAccessWithWrite, type TaxonomyDef, type TaxonomyDefInfo, type TaxonomyReadOptions, type TaxonomyTerm, type TaxonomyTermCreateInput, type TaxonomyTermInfo, type TaxonomyTermRow, type TranslationSummary, type TranslationsResult, type UnsupportedFieldType, type UpdateBlockTypeInput, type UpdateCollectionInput, type UpdateContentInput, type UpdateFieldInput, type UpdateIfArgs, type UpdateIfResult, type UpdateMenuInput, type UpdateMenuItemInput, type UpdateSectionInput, type UpdateTermInput, type UpdateWidgetInput, type UploadResult, type UrlInput, UserRepository, type UserTable, type ValidatedPluginManifest, type ValidationResult, type VerifyPreviewTokenOptions, type VerifyPreviewTokenResult, type VersionedContentItem, type VersionedRedirect, type VersionedScheduledPolicyRejection, type VersionedValue, type WaitUntilFn, type WhereRange, type WhereValue, type Widget, type WidgetArea, type WidgetComponentDef, type WidgetType, type WxrAttachment, type WxrAuthor, type WxrCategory, type WxrData, type WxrPost, type WxrSite, type WxrTag, type WxrTerm, adaptSandboxEntry, after, applySeed, bufferPluginHttpRequest, buildPreviewUrl, cachedQuery, clearSources, computeContentHash, contentNamespace, contentNamespaces, createCommentAccess, createContentAccess, createContentAccessWithWrite, createEditable, createHookPipeline, createHttpAccess, createMediaAccess, createNoop, createNoopSandboxRunner, createPluginManager, createPluginSecretRedactor, createRedirectAccess, createSandboxRouteError, createSandboxRouteErrorEnvelope, createSchemaAccess, createSettingsAccess, createUnrestrictedHttpAccess, decodePluginSettingValue, decodeSlug, definePlugin, definePluginRoute, encryptPluginSetting, expandCollectionBlockFields, extractPlainText, extractSearchableFields, file, generateManifest, generatePlaceholder, generatePreviewToken, getAllSources, getAllTermsForEntries, getByline, getBylineBySlug, getCollectionInfo, getCommentCount, getComments, getContentSeo, getEditMeta, getEmDashCollection, getEmDashEntry, getEntriesByByline, getEntriesByTerm, getEntryTerms, getExactMigrationStatus, getFallbackChain, getFileSources, getHreflangAlternates, getI18nConfig, getMenu, getMenuWithCacheHint, getMenus, getMigrationStatus, getPluginSetting, getPluginSettings, getPreviewToken, getPreviewUrl, getRequestContext, getSandboxRouteErrorDetails, getSandboxRouteErrorEnvelope, getSearchStats, getSection, getSections, getSeoMeta, getSiteSetting, getSiteSettings, getSiteSettingsWithCacheHint, getSource, getSuggestions, getTaxonomyDef, getTaxonomyDefs, getTaxonomyTerms, getTaxonomyTermsWithCacheHint, getTerm, getTermsForEntries, getTranslations, getUrlSources, getWidgetArea, getWidgetAreaWithCacheHint, getWidgetAreas, getWidgetComponents, handleContentAuthors, handleContentCompare, handleContentCountScheduled, handleContentCountTrashed, handleContentCreate, handleContentDelete, handleContentDiscardDraft, handleContentDuplicate, handleContentGet, handleContentGetIncludingTrashed, handleContentList, handleContentListTrashed, handleContentPermanentDelete, handleContentPublish, handleContentRestore, handleContentSchedule, handleContentTranslations, handleContentUnpublish, handleContentUnschedule, handleContentUpdate, handleMediaCreate, handleMediaDelete, handleMediaGet, handleMediaList, handleMediaRegisterUpload, handleMediaReplaceMetadata, handleMediaUpdate, handleMediaUsageActivationAdvance, handleMediaUsageProgress, handleMediaUsageRepair, handleRevisionGet, handleRevisionList, handleRevisionRestore, handleScheduledPolicyRejection, hashString, image, importReusableBlocksAsSections, inspectSandboxHookResult, invalidateBylineObjectCache, invalidateCollectionCache, invalidateCommentObjectCache, invalidateMenuObjectCache, invalidateObjectCache, invalidateSchemaObjectCache, invalidateTaxonomyObjectCache, invalidateTermCache, isContentSaveRejection, isDeprecatedCapability, isEncryptedPluginSetting, isI18nEnabled, isPreviewRequest, isSafeHref, isScheduledPolicyRejection, normalizeBlocksData, normalizeCapabilities, normalizeCapability, normalizeMediaValue, normalizePluginCapabilities, parseContentId, parsePluginMediaMetadataPatch, parseWxr, parseWxrDate, parseWxrString, pluginHttpRedirectAction, pluginHttpResponseFromWire, pluginHttpResponseToWire, pluginManifestSchema, pluginResponse, portableText, portableTextIdentityExtensions, portableTextToProsemirror, probeUrl, prosemirrorToPortableText, readPluginHttpBytes, readPluginMediaBytes, reference, registerSource, resolveBlockTypes, resolveContentCreateLocale, resolveEmDashPath, resolvePluginEncryptionKeys, rewritePluginHttpRedirect, runWithContext, sanitizeHref, scheduledPolicyRejectionKey, search, searchCollection, searchWithDb, setSiteSettings, slugify, toPluginMediaItem, ulid, updatePluginMediaMetadata, validateSeed, verifyPreviewToken, wordpressRestSource, wxrSource };
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import { t as EmDashDatabaseError } from "./errors-9P_FDrJ_.mjs";
3
3
  import "./dialect-helpers-7_IqPdh9.mjs";
4
4
  import { i as isI18nEnabled, n as getFallbackChain, r as getI18nConfig, s as resolveContentCreateLocale } from "./config-CvmjJcVw.mjs";
5
5
  import "./datetime-normalization-PeiEdcRY.mjs";
6
- import { A as image, C as definePluginRoute, D as portableText, E as portableTextIdentityExtensions, O as reference, S as definePlugin, T as prosemirrorToPortableText, _ as isContentSaveRejection, a as getComments, c as inspectSandboxHookResult, d as createNoopSandboxRunner, f as NodeCronScheduler, g as ContentSaveRejectedError, i as getCommentCount, j as EmDashConfigurationError, k as file, l as NoopSandboxRunner, m as createPluginManager, n as getMenuWithCacheHint, o as MAX_SANDBOX_SAVE_REJECTION_REASON_LENGTH, p as PluginManager, r as getMenus, s as SANDBOX_HOOK_RESULT_VERSION, t as getMenu, u as SandboxNotAvailableError, v as HookPipeline, w as portableTextToProsemirror, y as createHookPipeline } from "./menus-TsSGmSR4.mjs";
6
+ import { A as image, C as definePluginRoute, D as portableText, E as portableTextIdentityExtensions, O as reference, S as definePlugin, T as prosemirrorToPortableText, _ as isContentSaveRejection, a as getComments, c as inspectSandboxHookResult, d as createNoopSandboxRunner, f as NodeCronScheduler, g as ContentSaveRejectedError, i as getCommentCount, j as EmDashConfigurationError, k as file, l as NoopSandboxRunner, m as createPluginManager, n as getMenuWithCacheHint, o as MAX_SANDBOX_SAVE_REJECTION_REASON_LENGTH, p as PluginManager, r as getMenus, s as SANDBOX_HOOK_RESULT_VERSION, t as getMenu, u as SandboxNotAvailableError, v as HookPipeline, w as portableTextToProsemirror, y as createHookPipeline } from "./menus-Cm68rsAq.mjs";
7
7
  import { t as after } from "./after-PcEvMY_6.mjs";
8
8
  import { getRequestContext, runWithContext } from "./request-context.mjs";
9
9
  import { t as OptionsRepository } from "./options-DhrI7eMv.mjs";
@@ -14,15 +14,15 @@ import { a as contentNamespace, c as invalidateBylineObjectCache, d as invalidat
14
14
  import { l as RESERVED_COLLECTION_SLUGS, r as FIELD_TYPE_TO_COLUMN, u as RESERVED_FIELD_SLUGS } from "./types-BcrBrE6-.mjs";
15
15
  import { n as slugify, t as decodeSlug } from "./slugify-T5GHH42D.mjs";
16
16
  import { i as InvalidCursorError, r as EmDashValidationError } from "./types-BkUg2yHx.mjs";
17
- import { t as MediaRepository } from "./media-Qp5S3eH3.mjs";
17
+ import { t as MediaRepository } from "./media-CPXTbb1R.mjs";
18
18
  import { t as UserRepository } from "./user-DDSL-sGw.mjs";
19
19
  import "./taxonomy-C3Fu1YeH.mjs";
20
20
  import { t as CommentRepository } from "./comment-CrBl22OF.mjs";
21
21
  import "./audit-RfCugiSB.mjs";
22
- import { S as StorageSerializationError, _ as readPluginMediaBytes, a as createHttpAccess, b as createContentAccess, c as createSchemaAccess, f as createUnrestrictedHttpAccess, g as parsePluginMediaMetadataPatch, h as MAX_PLUGIN_MEDIA_READ_BYTES, i as createContentAccessWithWrite, m as DEFAULT_PLUGIN_MEDIA_READ_BYTES, n as RedirectAccessError, o as createMediaAccess, p as PluginRouteError, r as createCommentAccess, s as createRedirectAccess, v as toPluginMediaItem, x as PluginStorageRepository, y as updatePluginMediaMetadata } from "./context-BeGccdUX.mjs";
22
+ import { S as StorageSerializationError, _ as readPluginMediaBytes, a as createHttpAccess, b as createContentAccess, c as createSchemaAccess, f as createUnrestrictedHttpAccess, g as parsePluginMediaMetadataPatch, h as MAX_PLUGIN_MEDIA_READ_BYTES, i as createContentAccessWithWrite, m as DEFAULT_PLUGIN_MEDIA_READ_BYTES, n as RedirectAccessError, o as createMediaAccess, p as PluginRouteError, r as createCommentAccess, s as createRedirectAccess, v as toPluginMediaItem, x as PluginStorageRepository, y as updatePluginMediaMetadata } from "./context-BV_7t-Ua.mjs";
23
23
  import "./menus-ITeAbcIF.mjs";
24
24
  import "./resolve-2WbQsCvT.mjs";
25
- import "./redirect-iJf5fltD.mjs";
25
+ import "./redirect-B29UjdUn.mjs";
26
26
  import "./request-cache-DzLYKm_x.mjs";
27
27
  import "./byline-registry-gnKscbQX.mjs";
28
28
  import "./field-defs-cache-HIgBbqZZ.mjs";
@@ -40,7 +40,7 @@ import { t as FTSManager } from "./fts-manager-S-K0laoS.mjs";
40
40
  import "./loader-BzqeR1ZN.mjs";
41
41
  import "./collection-slugs-cache-CjGk__zp.mjs";
42
42
  import { a as getTaxonomyDefs, c as getTerm, d as invalidateTermCache, i as getTaxonomyDef, l as getTermsForEntries, n as getEntriesByTerm, o as getTaxonomyTerms, r as getEntryTerms, s as getTaxonomyTermsWithCacheHint, t as getAllTermsForEntries } from "./taxonomies-C1IwNe8Q.mjs";
43
- import { A as handleContentDiscardDraft, B as handleContentTranslations, C as generateManifest, D as handleContentCountTrashed, E as handleContentCountScheduled, F as handleContentListTrashed, H as handleContentUnschedule, I as handleContentPermanentDelete, L as handleContentPublish, M as handleContentGet, N as handleContentGetIncludingTrashed, O as handleContentCreate, P as handleContentList, R as handleContentRestore, T as handleContentCompare, U as handleContentUpdate, V as handleContentUnpublish, W as handleScheduledPolicyRejection, b as handleRevisionList, j as handleContentDuplicate, k as handleContentDelete, w as handleContentAuthors, x as handleRevisionRestore, y as handleRevisionGet, z as handleContentSchedule } from "./api-cFFZpyS0.mjs";
43
+ import { A as handleContentDiscardDraft, B as handleContentTranslations, C as generateManifest, D as handleContentCountTrashed, E as handleContentCountScheduled, F as handleContentListTrashed, H as handleContentUnschedule, I as handleContentPermanentDelete, L as handleContentPublish, M as handleContentGet, N as handleContentGetIncludingTrashed, O as handleContentCreate, P as handleContentList, R as handleContentRestore, T as handleContentCompare, U as handleContentUpdate, V as handleContentUnpublish, W as handleScheduledPolicyRejection, b as handleRevisionList, j as handleContentDuplicate, k as handleContentDelete, w as handleContentAuthors, x as handleRevisionRestore, y as handleRevisionGet, z as handleContentSchedule } from "./api-CuyNEHZG.mjs";
44
44
  import "./capture-triggers-kJyl_yyM.mjs";
45
45
  import "./activation-LOkDM5WT.mjs";
46
46
  import { a as SchemaRegistry, i as SchemaError, t as BlockTypeRegistry } from "./block-type-registry-DUI_3KxT.mjs";
@@ -50,14 +50,14 @@ import "./canonical-YhEQezjg.mjs";
50
50
  import "./digest-BarSh-pN.mjs";
51
51
  import { n as computeContentHash, r as hashString } from "./hash-SDAW6zC-.mjs";
52
52
  import "./zod-generator-D6uE4WiS.mjs";
53
- import "./dashboard-DjrB-xxZ.mjs";
53
+ import "./dashboard-BP-iJqpd.mjs";
54
54
  import { i as resolveBlockTypes, n as expandCollectionBlockFields, r as normalizeBlocksData } from "./block-values-C_VIPr5t.mjs";
55
- import { a as handleMediaReplaceMetadata, i as handleMediaList, n as handleMediaDelete, o as handleMediaUpdate, r as handleMediaGet, t as handleMediaCreate } from "./media-h7tOiDLj.mjs";
55
+ import { a as handleMediaRegisterUpload, i as handleMediaList, n as handleMediaDelete, o as handleMediaReplaceMetadata, r as handleMediaGet, s as handleMediaUpdate, t as handleMediaCreate } from "./media-JXRWDhw3.mjs";
56
56
  import "./media-folders-BE0oo2eX.mjs";
57
57
  import "./media-usage-work-C2OZLCAd.mjs";
58
58
  import "./content-repair-Q8IUrpLL.mjs";
59
59
  import "./collection-deletion-processor-Br6rxs3u.mjs";
60
- import { i as handleMediaUsageRepair, n as handleMediaUsageProgress } from "./media-usage-My-Vi-ex.mjs";
60
+ import { i as handleMediaUsageRepair, n as handleMediaUsageProgress } from "./media-usage-De-zeR9E.mjs";
61
61
  import "./settings-DYidIB26.mjs";
62
62
  import "./site-settings-DOgRUoFX.mjs";
63
63
  import "./errors-BF0_LFhW.mjs";
@@ -69,9 +69,9 @@ import "./schema-Du3MzCG0.mjs";
69
69
  import "./block-types-BmZmLmAD.mjs";
70
70
  import "./seo-CZT2oLtT.mjs";
71
71
  import { createPluginSecretRedactor } from "./plugins/secret-redactor.mjs";
72
- import { a as getSiteSettingsWithCacheHint, c as setSiteSettings, d as decodePluginSettingValue, i as getSiteSettings, l as PluginSettingEncryptionError, m as isEncryptedPluginSetting, n as getPluginSettings, p as encryptPluginSetting, r as getSiteSetting, t as getPluginSetting, u as createSettingsAccess } from "./settings-CgjRWGW9.mjs";
72
+ import { a as getSiteSettingsWithCacheHint, c as setSiteSettings, d as decodePluginSettingValue, i as getSiteSettings, l as PluginSettingEncryptionError, m as isEncryptedPluginSetting, n as getPluginSettings, p as encryptPluginSetting, r as getSiteSetting, t as getPluginSetting, u as createSettingsAccess } from "./settings-B4vDl1fK.mjs";
73
73
  import { o as getSection, s as getSections } from "./sections-Ddptx_o9.mjs";
74
- import "./settings-2xNYr90o.mjs";
74
+ import "./settings-Dyj6v8C4.mjs";
75
75
  import "./taxonomies-C_XMoRcX.mjs";
76
76
  import { o as pluginManifestSchema } from "./manifest-schema-CY3zng_M.mjs";
77
77
  import { a as getSandboxRouteErrorEnvelope, i as getSandboxRouteErrorDetails, n as createSandboxRouteError, r as createSandboxRouteErrorEnvelope, t as SandboxUnavailableError } from "./types-D7HUsguf.mjs";
@@ -90,23 +90,23 @@ import "./comments-fHZ8ON9O.mjs";
90
90
  import "./relations-CK9CYUyr.mjs";
91
91
  import { m as sanitizeHref, p as isSafeHref } from "./menus-BM7BPLOb.mjs";
92
92
  import "./status-DZKIG4a9.mjs";
93
- import { t as applySeed } from "./apply-CoT603H3.mjs";
93
+ import { t as applySeed } from "./apply-npY1TAhG.mjs";
94
94
  import { c as createEditable, i as getTranslations, l as createNoop, n as getEmDashCollection, r as getEmDashEntry, s as resolveEmDashPath, t as getEditMeta } from "./query-B48peoRT.mjs";
95
- import { C as parseWxrString, S as parseWxr, b as importReusableBlocksAsSections, c as parseWxrDate, d as getAllSources, f as getFileSources, g as registerSource, h as probeUrl, l as wxrSource, m as getUrlSources, p as getSource, s as wordpressRestSource, u as clearSources } from "./import-C3JZplWq.mjs";
95
+ import { C as parseWxrString, S as parseWxr, b as importReusableBlocksAsSections, c as parseWxrDate, d as getAllSources, f as getFileSources, g as registerSource, h as probeUrl, l as wxrSource, m as getUrlSources, p as getSource, s as wordpressRestSource, u as clearSources } from "./import-YzfKCaco.mjs";
96
96
  import { pluginResponse } from "./plugin-types.mjs";
97
97
  import { adaptSandboxEntry } from "./plugins/adapt-sandbox-entry.mjs";
98
- import "./redirects-CYu1u1aK.mjs";
98
+ import "./redirects-Ca2MPfEG.mjs";
99
99
  import "./ssrf-DpBH7aOt.mjs";
100
100
  import { t as CronAccessImpl } from "./cron-7DCJwPXq.mjs";
101
101
  import { PLUGIN_HTTP_MAX_REQUEST_BYTES, PLUGIN_HTTP_MAX_RESPONSE_BYTES, bufferPluginHttpRequest, pluginHttpRedirectAction, pluginHttpResponseFromWire, pluginHttpResponseToWire, readPluginHttpBytes, rewritePluginHttpRedirect } from "./plugins/http-wire.mjs";
102
102
  import "./email-console-bJn3ctqA.mjs";
103
103
  import "./fence-CMDXJYc_.mjs";
104
104
  import "./route-wire--1hLuACz.mjs";
105
- import "./routes-CUsM40Cc.mjs";
105
+ import "./routes-vrR95WR6.mjs";
106
106
  import "./utils-DdhmO9w9.mjs";
107
107
  import { n as parseContentId, r as verifyPreviewToken, t as generatePreviewToken } from "./tokens-u78jETkX.mjs";
108
108
  import { i as getPreviewUrl, n as isPreviewRequest, r as buildPreviewUrl, t as getPreviewToken } from "./preview-CIUcPYr6.mjs";
109
- import { t as getHreflangAlternates } from "./hreflang-DMFBL2eb.mjs";
109
+ import { t as getHreflangAlternates } from "./hreflang-CbVI4paR.mjs";
110
110
  import { getContentSeo, getSeoMeta } from "./seo/index.mjs";
111
111
  import "./comment-reaction-JEQ2Fpd8.mjs";
112
112
  import { i as getEntriesByByline, n as getByline, r as getBylineBySlug } from "./bylines-BPwJqoYH.mjs";
@@ -117,4 +117,4 @@ import "./seed/index.mjs";
117
117
  import { a as getSuggestions, c as searchWithDb, i as getSearchStats, n as extractPlainText, o as search, r as extractSearchableFields, s as searchCollection } from "./search-Bt1PL1jf.mjs";
118
118
  import { ulid } from "ulidx";
119
119
 
120
- export { BlockTypeRegistry, CAPABILITY_RENAMES, CacheNamespace, CommentRepository, ContentRepository, ContentSaveRejectedError, CronAccessImpl, DEFAULT_PLUGIN_MEDIA_READ_BYTES, EmDashConfigurationError, EmDashDatabaseError, EmDashStorageError, EmDashValidationError, FIELD_TYPE_TO_COLUMN, FTSManager, HookPipeline, InvalidCursorError, MAX_PLUGIN_MEDIA_READ_BYTES, MAX_SANDBOX_SAVE_REJECTION_REASON_LENGTH, MIGRATION_NAMES, MediaRepository, NodeCronScheduler, NoopSandboxRunner, OptionsRepository, PLUGIN_HTTP_MAX_REQUEST_BYTES, PLUGIN_HTTP_MAX_RESPONSE_BYTES, PluginManager, PluginRouteError, PluginSettingEncryptionError, PluginStorageRepository, RESERVED_COLLECTION_SLUGS, RESERVED_FIELD_SLUGS, RedirectAccessError, RevisionRepository, SANDBOX_HOOK_RESULT_VERSION, SCHEDULED_POLICY_REJECTION_PREFIX, SEARCH_TOKENIZERS, SandboxNotAvailableError, SandboxUnavailableError, SchemaError, SchemaRegistry, StorageSerializationError, UserRepository, adaptSandboxEntry, after, applySeed, bufferPluginHttpRequest, buildPreviewUrl, cachedQuery, clearSources, computeContentHash, contentNamespace, contentNamespaces, createCommentAccess, createContentAccess, createContentAccessWithWrite, createEditable, createHookPipeline, createHttpAccess, createMediaAccess, createNoop, createNoopSandboxRunner, createPluginManager, createPluginSecretRedactor, createRedirectAccess, createSandboxRouteError, createSandboxRouteErrorEnvelope, createSchemaAccess, createSettingsAccess, createUnrestrictedHttpAccess, decodePluginSettingValue, decodeSlug, definePlugin, definePluginRoute, encryptPluginSetting, expandCollectionBlockFields, extractPlainText, extractSearchableFields, file, generateManifest, generatePlaceholder, generatePreviewToken, getAllSources, getAllTermsForEntries, getByline, getBylineBySlug, getCollectionInfo, getCommentCount, getComments, getContentSeo, getEditMeta, getEmDashCollection, getEmDashEntry, getEntriesByByline, getEntriesByTerm, getEntryTerms, getExactMigrationStatus, getFallbackChain, getFileSources, getHreflangAlternates, getI18nConfig, getMenu, getMenuWithCacheHint, getMenus, getMigrationStatus, getPluginSetting, getPluginSettings, getPreviewToken, getPreviewUrl, getRequestContext, getSandboxRouteErrorDetails, getSandboxRouteErrorEnvelope, getSearchStats, getSection, getSections, getSeoMeta, getSiteSetting, getSiteSettings, getSiteSettingsWithCacheHint, getSource, getSuggestions, getTaxonomyDef, getTaxonomyDefs, getTaxonomyTerms, getTaxonomyTermsWithCacheHint, getTerm, getTermsForEntries, getTranslations, getUrlSources, getWidgetArea, getWidgetAreaWithCacheHint, getWidgetAreas, getWidgetComponents, handleContentAuthors, handleContentCompare, handleContentCountScheduled, handleContentCountTrashed, handleContentCreate, handleContentDelete, handleContentDiscardDraft, handleContentDuplicate, handleContentGet, handleContentGetIncludingTrashed, handleContentList, handleContentListTrashed, handleContentPermanentDelete, handleContentPublish, handleContentRestore, handleContentSchedule, handleContentTranslations, handleContentUnpublish, handleContentUnschedule, handleContentUpdate, handleMediaCreate, handleMediaDelete, handleMediaGet, handleMediaList, handleMediaReplaceMetadata, handleMediaUpdate, handleMediaUsageActivationAdvance, handleMediaUsageProgress, handleMediaUsageRepair, handleRevisionGet, handleRevisionList, handleRevisionRestore, handleScheduledPolicyRejection, hashString, image, importReusableBlocksAsSections, inspectSandboxHookResult, invalidateBylineObjectCache, invalidateCollectionCache, invalidateCommentObjectCache, invalidateMenuObjectCache, invalidateObjectCache, invalidateSchemaObjectCache, invalidateTaxonomyObjectCache, invalidateTermCache, isContentSaveRejection, isDeprecatedCapability, isEncryptedPluginSetting, isI18nEnabled, isPreviewRequest, isSafeHref, isScheduledPolicyRejection, normalizeBlocksData, normalizeCapabilities, normalizeCapability, normalizeMediaValue, normalizePluginCapabilities, parseContentId, parsePluginMediaMetadataPatch, parseWxr, parseWxrDate, parseWxrString, pluginHttpRedirectAction, pluginHttpResponseFromWire, pluginHttpResponseToWire, pluginManifestSchema, pluginResponse, portableText, portableTextIdentityExtensions, portableTextToProsemirror, probeUrl, prosemirrorToPortableText, readPluginHttpBytes, readPluginMediaBytes, reference, registerSource, resolveBlockTypes, resolveContentCreateLocale, resolveEmDashPath, resolvePluginEncryptionKeys, rewritePluginHttpRedirect, runWithContext, sanitizeHref, scheduledPolicyRejectionKey, search, searchCollection, searchWithDb, setSiteSettings, slugify, toPluginMediaItem, ulid, updatePluginMediaMetadata, validateSeed, verifyPreviewToken, wordpressRestSource, wxrSource };
120
+ export { BlockTypeRegistry, CAPABILITY_RENAMES, CacheNamespace, CommentRepository, ContentRepository, ContentSaveRejectedError, CronAccessImpl, DEFAULT_PLUGIN_MEDIA_READ_BYTES, EmDashConfigurationError, EmDashDatabaseError, EmDashStorageError, EmDashValidationError, FIELD_TYPE_TO_COLUMN, FTSManager, HookPipeline, InvalidCursorError, MAX_PLUGIN_MEDIA_READ_BYTES, MAX_SANDBOX_SAVE_REJECTION_REASON_LENGTH, MIGRATION_NAMES, MediaRepository, NodeCronScheduler, NoopSandboxRunner, OptionsRepository, PLUGIN_HTTP_MAX_REQUEST_BYTES, PLUGIN_HTTP_MAX_RESPONSE_BYTES, PluginManager, PluginRouteError, PluginSettingEncryptionError, PluginStorageRepository, RESERVED_COLLECTION_SLUGS, RESERVED_FIELD_SLUGS, RedirectAccessError, RevisionRepository, SANDBOX_HOOK_RESULT_VERSION, SCHEDULED_POLICY_REJECTION_PREFIX, SEARCH_TOKENIZERS, SandboxNotAvailableError, SandboxUnavailableError, SchemaError, SchemaRegistry, StorageSerializationError, UserRepository, adaptSandboxEntry, after, applySeed, bufferPluginHttpRequest, buildPreviewUrl, cachedQuery, clearSources, computeContentHash, contentNamespace, contentNamespaces, createCommentAccess, createContentAccess, createContentAccessWithWrite, createEditable, createHookPipeline, createHttpAccess, createMediaAccess, createNoop, createNoopSandboxRunner, createPluginManager, createPluginSecretRedactor, createRedirectAccess, createSandboxRouteError, createSandboxRouteErrorEnvelope, createSchemaAccess, createSettingsAccess, createUnrestrictedHttpAccess, decodePluginSettingValue, decodeSlug, definePlugin, definePluginRoute, encryptPluginSetting, expandCollectionBlockFields, extractPlainText, extractSearchableFields, file, generateManifest, generatePlaceholder, generatePreviewToken, getAllSources, getAllTermsForEntries, getByline, getBylineBySlug, getCollectionInfo, getCommentCount, getComments, getContentSeo, getEditMeta, getEmDashCollection, getEmDashEntry, getEntriesByByline, getEntriesByTerm, getEntryTerms, getExactMigrationStatus, getFallbackChain, getFileSources, getHreflangAlternates, getI18nConfig, getMenu, getMenuWithCacheHint, getMenus, getMigrationStatus, getPluginSetting, getPluginSettings, getPreviewToken, getPreviewUrl, getRequestContext, getSandboxRouteErrorDetails, getSandboxRouteErrorEnvelope, getSearchStats, getSection, getSections, getSeoMeta, getSiteSetting, getSiteSettings, getSiteSettingsWithCacheHint, getSource, getSuggestions, getTaxonomyDef, getTaxonomyDefs, getTaxonomyTerms, getTaxonomyTermsWithCacheHint, getTerm, getTermsForEntries, getTranslations, getUrlSources, getWidgetArea, getWidgetAreaWithCacheHint, getWidgetAreas, getWidgetComponents, handleContentAuthors, handleContentCompare, handleContentCountScheduled, handleContentCountTrashed, handleContentCreate, handleContentDelete, handleContentDiscardDraft, handleContentDuplicate, handleContentGet, handleContentGetIncludingTrashed, handleContentList, handleContentListTrashed, handleContentPermanentDelete, handleContentPublish, handleContentRestore, handleContentSchedule, handleContentTranslations, handleContentUnpublish, handleContentUnschedule, handleContentUpdate, handleMediaCreate, handleMediaDelete, handleMediaGet, handleMediaList, handleMediaRegisterUpload, handleMediaReplaceMetadata, handleMediaUpdate, handleMediaUsageActivationAdvance, handleMediaUsageProgress, handleMediaUsageRepair, handleRevisionGet, handleRevisionList, handleRevisionRestore, handleScheduledPolicyRejection, hashString, image, importReusableBlocksAsSections, inspectSandboxHookResult, invalidateBylineObjectCache, invalidateCollectionCache, invalidateCommentObjectCache, invalidateMenuObjectCache, invalidateObjectCache, invalidateSchemaObjectCache, invalidateTaxonomyObjectCache, invalidateTermCache, isContentSaveRejection, isDeprecatedCapability, isEncryptedPluginSetting, isI18nEnabled, isPreviewRequest, isSafeHref, isScheduledPolicyRejection, normalizeBlocksData, normalizeCapabilities, normalizeCapability, normalizeMediaValue, normalizePluginCapabilities, parseContentId, parsePluginMediaMetadataPatch, parseWxr, parseWxrDate, parseWxrString, pluginHttpRedirectAction, pluginHttpResponseFromWire, pluginHttpResponseToWire, pluginManifestSchema, pluginResponse, portableText, portableTextIdentityExtensions, portableTextToProsemirror, probeUrl, prosemirrorToPortableText, readPluginHttpBytes, readPluginMediaBytes, reference, registerSource, resolveBlockTypes, resolveContentCreateLocale, resolveEmDashPath, resolvePluginEncryptionKeys, rewritePluginHttpRedirect, runWithContext, sanitizeHref, scheduledPolicyRejectionKey, search, searchCollection, searchWithDb, setSiteSettings, slugify, toPluginMediaItem, ulid, updatePluginMediaMetadata, validateSeed, verifyPreviewToken, wordpressRestSource, wxrSource };
@@ -1,4 +1,4 @@
1
- import { n as fingerprintMigrationSet } from "./identity-IyNWwXr6.mjs";
1
+ import { n as fingerprintMigrationSet } from "./identity-Be5kzutJ.mjs";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region src/i18n/normalize.ts
@@ -186,4 +186,4 @@ async function buildMigrationManifest({ identity, i18n, database }) {
186
186
 
187
187
  //#endregion
188
188
  export { MigrationManifestValidationError as a, normalizeAstroI18n as c, getMigrationIntegrationMetadata as i, MIGRATION_CONFIG_SYMBOL as n, serializeMigrationManifest as o, createMigrationIntegrationMetadata as r, validateMigrationManifest as s, buildMigrationManifest as t };
189
- //# sourceMappingURL=manifest-builder-B8zR-73J.mjs.map
189
+ //# sourceMappingURL=manifest-builder-BmSAOOEF.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-builder-B8zR-73J.mjs","names":[],"sources":["../src/i18n/normalize.ts","../src/migrations/manifest.ts","../src/migrations/integration-metadata.ts","../src/migrations/manifest-builder.ts"],"sourcesContent":["import type { I18nConfig } from \"./config.js\";\n\nexport interface AstroLocaleObject {\n\tpath: string;\n\tcodes: readonly string[];\n}\n\nexport interface AstroI18nInput {\n\tdefaultLocale: string;\n\tlocales: readonly (string | AstroLocaleObject)[];\n\tfallback?: Readonly<Record<string, string | undefined>>;\n\trouting?: string | { prefixDefaultLocale?: boolean };\n}\n\nexport function normalizeAstroI18n(config: AstroI18nInput | null | undefined): I18nConfig | null {\n\tif (!config) return null;\n\n\treturn {\n\t\tdefaultLocale: config.defaultLocale,\n\t\tlocales: config.locales.map((locale) => (typeof locale === \"string\" ? locale : locale.path)),\n\t\tfallback: config.fallback\n\t\t\t? Object.fromEntries(\n\t\t\t\t\tObject.entries(config.fallback).filter(\n\t\t\t\t\t\t(entry): entry is [string, string] => entry[1] !== undefined,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t: undefined,\n\t\tprefixDefaultLocale:\n\t\t\ttypeof config.routing === \"object\" ? (config.routing.prefixDefaultLocale ?? false) : false,\n\t};\n}\n","import { z } from \"zod\";\n\nimport type { CoreMigrationIdentity } from \"./identity.js\";\nimport { fingerprintMigrationSet } from \"./identity.js\";\n\nconst FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;\nconst MIGRATION_NAME_PATTERN = /^\\d{3}_[a-z0-9_]+$/;\nconst EXECUTOR_ENTRYPOINT_PATTERN =\n\t/^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*(?:\\/[A-Za-z0-9][A-Za-z0-9._-]*)*$/;\nconst ENVIRONMENT_VARIABLE_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;\nconst ENVIRONMENT_REFERENCE_KEY_PATTERN = /(?:env|envName|envVar)$/i;\nconst URL_SCHEME_PATTERN = /^[A-Za-z][A-Za-z0-9+.-]*:/;\nconst SECRET_QUERY_KEY_PATTERN = /(?:auth|credential|key|password|secret|signature|token)/i;\nconst SECRET_CONFIG_KEY_PATTERN =\n\t/(?:accessToken|apiKey|authToken|certificate|connectionString|password|privateKey|secret)/i;\nconst SECRET_CONFIG_EXACT_KEY_PATTERN = /^(?:ca|cert|key)$/i;\nconst CONNECTION_URL_PROTOCOLS = new Set([\"mysql:\", \"postgres:\", \"postgresql:\"]);\n\ntype JsonPrimitive = boolean | number | string | null;\ntype JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\n\nconst i18nConfigSchema = z\n\t.object({\n\t\tdefaultLocale: z.string().min(1),\n\t\tlocales: z.array(z.string().min(1)).min(1),\n\t\tfallback: z.record(z.string(), z.string()).optional(),\n\t\tprefixDefaultLocale: z.boolean().optional(),\n\t})\n\t.strict();\n\nexport const migrationManifestV1Schema = z\n\t.object({\n\t\tschemaVersion: z.literal(1),\n\t\temdashVersion: z.string().min(1),\n\t\tmigrationSet: z\n\t\t\t.object({\n\t\t\t\tnames: z\n\t\t\t\t\t.array(z.string().regex(MIGRATION_NAME_PATTERN))\n\t\t\t\t\t.min(1)\n\t\t\t\t\t.refine((names) => new Set(names).size === names.length),\n\t\t\t\tfingerprint: z.string().regex(FINGERPRINT_PATTERN),\n\t\t\t})\n\t\t\t.strict(),\n\t\ti18n: i18nConfigSchema.nullable(),\n\t\tdatabase: z\n\t\t\t.object({\n\t\t\t\ttype: z.enum([\"sqlite\", \"postgres\"]),\n\t\t\t\texecutorEntrypoint: z.string().regex(EXECUTOR_ENTRYPOINT_PATTERN),\n\t\t\t\texecutorConfig: z.unknown(),\n\t\t\t})\n\t\t\t.strict(),\n\t})\n\t.strict();\n\nexport type MigrationManifestV1 = z.infer<typeof migrationManifestV1Schema>;\n\nexport class MigrationManifestValidationError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(`Invalid migration manifest: ${message}`);\n\t\tthis.name = \"MigrationManifestValidationError\";\n\t}\n}\n\nfunction isEnvironmentReferenceKey(key: string): boolean {\n\treturn ENVIRONMENT_REFERENCE_KEY_PATTERN.test(key);\n}\n\nfunction assertSafeUrl(value: string, path: string): void {\n\tif (!URL_SCHEME_PATTERN.test(value)) return;\n\n\tlet url: URL;\n\ttry {\n\t\turl = new URL(value);\n\t} catch {\n\t\tthrow new MigrationManifestValidationError(`${path} contains an invalid URL`);\n\t}\n\n\tif (CONNECTION_URL_PROTOCOLS.has(url.protocol)) {\n\t\tthrow new MigrationManifestValidationError(`${path} contains a database connection URL`);\n\t}\n\tif (url.username || url.password) {\n\t\tthrow new MigrationManifestValidationError(`${path} contains URL credentials`);\n\t}\n\tfor (const key of url.searchParams.keys()) {\n\t\tif (SECRET_QUERY_KEY_PATTERN.test(key)) {\n\t\t\tthrow new MigrationManifestValidationError(`${path} contains a credential query parameter`);\n\t\t}\n\t}\n}\n\nfunction cloneSecretFreeJson(value: unknown, path: string, ancestors: Set<object>): JsonValue {\n\tif (value === null || typeof value === \"boolean\") return value;\n\tif (typeof value === \"string\") {\n\t\tassertSafeUrl(value, path);\n\t\treturn value;\n\t}\n\tif (typeof value === \"number\") {\n\t\tif (Number.isFinite(value)) return value;\n\t\tthrow new MigrationManifestValidationError(`${path} contains a non-finite number`);\n\t}\n\tif (typeof value !== \"object\") {\n\t\tthrow new MigrationManifestValidationError(`${path} is not JSON-serializable`);\n\t}\n\tif (ancestors.has(value)) {\n\t\tthrow new MigrationManifestValidationError(`${path} contains a cycle`);\n\t}\n\n\tancestors.add(value);\n\ttry {\n\t\tif (Array.isArray(value)) {\n\t\t\treturn value.map((item, index) => cloneSecretFreeJson(item, `${path}[${index}]`, ancestors));\n\t\t}\n\n\t\tconst prototype = Object.getPrototypeOf(value);\n\t\tif (prototype !== Object.prototype && prototype !== null) {\n\t\t\tthrow new MigrationManifestValidationError(`${path} contains a non-plain object`);\n\t\t}\n\n\t\tconst cloned: Record<string, JsonValue> = {};\n\t\tfor (const [key, item] of Object.entries(value)) {\n\t\t\tconst itemPath = `${path}.${key}`;\n\t\t\tconst environmentReference = isEnvironmentReferenceKey(key);\n\t\t\tif (\n\t\t\t\t!environmentReference &&\n\t\t\t\t(SECRET_CONFIG_KEY_PATTERN.test(key) || SECRET_CONFIG_EXACT_KEY_PATTERN.test(key))\n\t\t\t) {\n\t\t\t\tthrow new MigrationManifestValidationError(`${itemPath} is a credential-bearing field`);\n\t\t\t}\n\t\t\tif (environmentReference) {\n\t\t\t\tif (typeof item !== \"string\" || !ENVIRONMENT_VARIABLE_PATTERN.test(item)) {\n\t\t\t\t\tthrow new MigrationManifestValidationError(\n\t\t\t\t\t\t`${itemPath} must contain an environment-variable name`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcloned[key] = cloneSecretFreeJson(item, itemPath, ancestors);\n\t\t}\n\t\treturn cloned;\n\t} finally {\n\t\tancestors.delete(value);\n\t}\n}\n\nexport function validateSecretFreeExecutorConfig(\n\tvalue: unknown,\n\tpath = \"database.executorConfig\",\n): unknown {\n\treturn cloneSecretFreeJson(value, path, new Set());\n}\n\nfunction identitiesMatch(\n\tmanifest: MigrationManifestV1,\n\texpectedIdentity: CoreMigrationIdentity,\n): boolean {\n\treturn (\n\t\tmanifest.emdashVersion === expectedIdentity.emdashVersion &&\n\t\tmanifest.migrationSet.fingerprint === expectedIdentity.fingerprint &&\n\t\tmanifest.migrationSet.names.length === expectedIdentity.names.length &&\n\t\tmanifest.migrationSet.names.every((name, index) => name === expectedIdentity.names[index])\n\t);\n}\n\nexport async function validateMigrationManifest(\n\tvalue: unknown,\n\texpectedIdentity?: CoreMigrationIdentity,\n): Promise<MigrationManifestV1> {\n\tconst parsed = migrationManifestV1Schema.safeParse(value);\n\tif (!parsed.success) {\n\t\tthrow new MigrationManifestValidationError(\"schema validation failed\");\n\t}\n\n\tconst executorConfig = validateSecretFreeExecutorConfig(parsed.data.database.executorConfig);\n\tconst manifest: MigrationManifestV1 = {\n\t\t...parsed.data,\n\t\tdatabase: { ...parsed.data.database, executorConfig },\n\t};\n\tconst fingerprint = await fingerprintMigrationSet(\n\t\tmanifest.emdashVersion,\n\t\tmanifest.migrationSet.names,\n\t);\n\tif (fingerprint !== manifest.migrationSet.fingerprint) {\n\t\tthrow new MigrationManifestValidationError(\n\t\t\t\"migrationSet fingerprint does not match its version and ordered names\",\n\t\t);\n\t}\n\tif (expectedIdentity && !identitiesMatch(manifest, expectedIdentity)) {\n\t\tthrow new MigrationManifestValidationError(\n\t\t\t\"manifest does not match the loaded EmDash migration identity\",\n\t\t);\n\t}\n\n\treturn manifest;\n}\n\nexport function serializeMigrationManifest(manifest: MigrationManifestV1): string {\n\treturn `${JSON.stringify(manifest, null, \"\\t\")}\\n`;\n}\n","import type { DatabaseDescriptor } from \"../db/adapters.js\";\nimport { validateSecretFreeExecutorConfig } from \"./manifest.js\";\n\nexport const MIGRATION_CONFIG_SYMBOL = Symbol.for(\"emdash:migration-config\");\n\nexport interface MigrationIntegrationMetadata {\n\tdatabase?: Pick<DatabaseDescriptor, \"type\" | \"migrations\">;\n}\n\nfunction isRecord(value: unknown): value is Record<PropertyKey, unknown> {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nfunction isMigrationIntegrationMetadata(value: unknown): value is MigrationIntegrationMetadata {\n\tif (!isRecord(value)) return false;\n\tconst database = value.database;\n\tif (database === undefined) return true;\n\tif (!isRecord(database) || (database.type !== \"sqlite\" && database.type !== \"postgres\")) {\n\t\treturn false;\n\t}\n\n\tconst migrations = database.migrations;\n\treturn (\n\t\tmigrations === undefined ||\n\t\t(isRecord(migrations) &&\n\t\t\ttypeof migrations.entrypoint === \"string\" &&\n\t\t\tObject.hasOwn(migrations, \"manifestConfig\"))\n\t);\n}\n\nexport function createMigrationIntegrationMetadata(\n\tdatabase?: DatabaseDescriptor,\n): MigrationIntegrationMetadata {\n\tif (!database) return {};\n\n\treturn {\n\t\tdatabase: {\n\t\t\ttype: database.type,\n\t\t\tmigrations: database.migrations\n\t\t\t\t? {\n\t\t\t\t\t\tentrypoint: database.migrations.entrypoint,\n\t\t\t\t\t\tmanifestConfig: validateSecretFreeExecutorConfig(\n\t\t\t\t\t\t\tdatabase.migrations.manifestConfig,\n\t\t\t\t\t\t\t\"database.migrations.manifestConfig\",\n\t\t\t\t\t\t),\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\t},\n\t};\n}\n\nexport function getMigrationIntegrationMetadata(\n\tintegration: unknown,\n): MigrationIntegrationMetadata | undefined {\n\tif (\n\t\t(typeof integration !== \"object\" || integration === null) &&\n\t\ttypeof integration !== \"function\"\n\t) {\n\t\treturn undefined;\n\t}\n\tif (!Object.hasOwn(integration, MIGRATION_CONFIG_SYMBOL)) {\n\t\treturn undefined;\n\t}\n\n\tconst metadata: unknown = Reflect.get(integration, MIGRATION_CONFIG_SYMBOL);\n\treturn isMigrationIntegrationMetadata(metadata) ? metadata : undefined;\n}\n","import type { DatabaseDescriptor } from \"../db/adapters.js\";\nimport type { I18nConfig } from \"../i18n/config.js\";\nimport type { CoreMigrationIdentity } from \"./identity.js\";\nimport { fingerprintMigrationSet } from \"./identity.js\";\nimport type { MigrationManifestV1 } from \"./manifest.js\";\nimport { MigrationManifestValidationError, validateMigrationManifest } from \"./manifest.js\";\n\nexport type ManifestDatabaseDescriptor = Pick<DatabaseDescriptor, \"type\" | \"migrations\">;\n\nexport interface BuildMigrationManifestOptions {\n\tidentity: CoreMigrationIdentity;\n\ti18n: I18nConfig | null;\n\tdatabase: ManifestDatabaseDescriptor;\n}\n\nexport class UnsupportedMigrationAdapterError extends Error {\n\tconstructor() {\n\t\tsuper(\"The configured database adapter does not provide a deployment migration executor\");\n\t\tthis.name = \"UnsupportedMigrationAdapterError\";\n\t}\n}\n\nexport async function buildMigrationManifest({\n\tidentity,\n\ti18n,\n\tdatabase,\n}: BuildMigrationManifestOptions): Promise<MigrationManifestV1> {\n\tconst identityFingerprint = await fingerprintMigrationSet(identity.emdashVersion, identity.names);\n\tif (identityFingerprint !== identity.fingerprint) {\n\t\tthrow new MigrationManifestValidationError(\n\t\t\t\"loaded identity fingerprint does not match its version and ordered names\",\n\t\t);\n\t}\n\tif (!database.migrations) {\n\t\tthrow new UnsupportedMigrationAdapterError();\n\t}\n\n\treturn validateMigrationManifest(\n\t\t{\n\t\t\tschemaVersion: 1,\n\t\t\temdashVersion: identity.emdashVersion,\n\t\t\tmigrationSet: {\n\t\t\t\tnames: [...identity.names],\n\t\t\t\tfingerprint: identity.fingerprint,\n\t\t\t},\n\t\t\ti18n,\n\t\t\tdatabase: {\n\t\t\t\ttype: database.type,\n\t\t\t\texecutorEntrypoint: database.migrations.entrypoint,\n\t\t\t\texecutorConfig: database.migrations.manifestConfig,\n\t\t\t},\n\t\t},\n\t\tidentity,\n\t);\n}\n"],"mappings":";;;;AAcA,SAAgB,mBAAmB,QAA8D;AAChG,KAAI,CAAC,OAAQ,QAAO;AAEpB,QAAO;EACN,eAAe,OAAO;EACtB,SAAS,OAAO,QAAQ,KAAK,WAAY,OAAO,WAAW,WAAW,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AACb,QAAM,mFAAmF;AACzF,OAAK,OAAO;;;AAId,eAAsB,uBAAuB,EAC5C,UACA,MACA,YAC+D;AAE/D,KAD4B,MAAM,wBAAwB,SAAS,eAAe,SAAS,MAAM,KACrE,SAAS,YACpC,OAAM,IAAI,iCACT,2EACA;AAEF,KAAI,CAAC,SAAS,WACb,OAAM,IAAI,kCAAkC;AAG7C,QAAO,0BACN;EACC,eAAe;EACf,eAAe,SAAS;EACxB,cAAc;GACb,OAAO,CAAC,GAAG,SAAS,MAAM;GAC1B,aAAa,SAAS;GACtB;EACD;EACA,UAAU;GACT,MAAM,SAAS;GACf,oBAAoB,SAAS,WAAW;GACxC,gBAAgB,SAAS,WAAW;GACpC;EACD,EACD,SACA"}
1
+ {"version":3,"file":"manifest-builder-BmSAOOEF.mjs","names":[],"sources":["../src/i18n/normalize.ts","../src/migrations/manifest.ts","../src/migrations/integration-metadata.ts","../src/migrations/manifest-builder.ts"],"sourcesContent":["import type { I18nConfig } from \"./config.js\";\n\nexport interface AstroLocaleObject {\n\tpath: string;\n\tcodes: readonly string[];\n}\n\nexport interface AstroI18nInput {\n\tdefaultLocale: string;\n\tlocales: readonly (string | AstroLocaleObject)[];\n\tfallback?: Readonly<Record<string, string | undefined>>;\n\trouting?: string | { prefixDefaultLocale?: boolean };\n}\n\nexport function normalizeAstroI18n(config: AstroI18nInput | null | undefined): I18nConfig | null {\n\tif (!config) return null;\n\n\treturn {\n\t\tdefaultLocale: config.defaultLocale,\n\t\tlocales: config.locales.map((locale) => (typeof locale === \"string\" ? locale : locale.path)),\n\t\tfallback: config.fallback\n\t\t\t? Object.fromEntries(\n\t\t\t\t\tObject.entries(config.fallback).filter(\n\t\t\t\t\t\t(entry): entry is [string, string] => entry[1] !== undefined,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t: undefined,\n\t\tprefixDefaultLocale:\n\t\t\ttypeof config.routing === \"object\" ? (config.routing.prefixDefaultLocale ?? false) : false,\n\t};\n}\n","import { z } from \"zod\";\n\nimport type { CoreMigrationIdentity } from \"./identity.js\";\nimport { fingerprintMigrationSet } from \"./identity.js\";\n\nconst FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;\nconst MIGRATION_NAME_PATTERN = /^\\d{3}_[a-z0-9_]+$/;\nconst EXECUTOR_ENTRYPOINT_PATTERN =\n\t/^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*(?:\\/[A-Za-z0-9][A-Za-z0-9._-]*)*$/;\nconst ENVIRONMENT_VARIABLE_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;\nconst ENVIRONMENT_REFERENCE_KEY_PATTERN = /(?:env|envName|envVar)$/i;\nconst URL_SCHEME_PATTERN = /^[A-Za-z][A-Za-z0-9+.-]*:/;\nconst SECRET_QUERY_KEY_PATTERN = /(?:auth|credential|key|password|secret|signature|token)/i;\nconst SECRET_CONFIG_KEY_PATTERN =\n\t/(?:accessToken|apiKey|authToken|certificate|connectionString|password|privateKey|secret)/i;\nconst SECRET_CONFIG_EXACT_KEY_PATTERN = /^(?:ca|cert|key)$/i;\nconst CONNECTION_URL_PROTOCOLS = new Set([\"mysql:\", \"postgres:\", \"postgresql:\"]);\n\ntype JsonPrimitive = boolean | number | string | null;\ntype JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\n\nconst i18nConfigSchema = z\n\t.object({\n\t\tdefaultLocale: z.string().min(1),\n\t\tlocales: z.array(z.string().min(1)).min(1),\n\t\tfallback: z.record(z.string(), z.string()).optional(),\n\t\tprefixDefaultLocale: z.boolean().optional(),\n\t})\n\t.strict();\n\nexport const migrationManifestV1Schema = z\n\t.object({\n\t\tschemaVersion: z.literal(1),\n\t\temdashVersion: z.string().min(1),\n\t\tmigrationSet: z\n\t\t\t.object({\n\t\t\t\tnames: z\n\t\t\t\t\t.array(z.string().regex(MIGRATION_NAME_PATTERN))\n\t\t\t\t\t.min(1)\n\t\t\t\t\t.refine((names) => new Set(names).size === names.length),\n\t\t\t\tfingerprint: z.string().regex(FINGERPRINT_PATTERN),\n\t\t\t})\n\t\t\t.strict(),\n\t\ti18n: i18nConfigSchema.nullable(),\n\t\tdatabase: z\n\t\t\t.object({\n\t\t\t\ttype: z.enum([\"sqlite\", \"postgres\"]),\n\t\t\t\texecutorEntrypoint: z.string().regex(EXECUTOR_ENTRYPOINT_PATTERN),\n\t\t\t\texecutorConfig: z.unknown(),\n\t\t\t})\n\t\t\t.strict(),\n\t})\n\t.strict();\n\nexport type MigrationManifestV1 = z.infer<typeof migrationManifestV1Schema>;\n\nexport class MigrationManifestValidationError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(`Invalid migration manifest: ${message}`);\n\t\tthis.name = \"MigrationManifestValidationError\";\n\t}\n}\n\nfunction isEnvironmentReferenceKey(key: string): boolean {\n\treturn ENVIRONMENT_REFERENCE_KEY_PATTERN.test(key);\n}\n\nfunction assertSafeUrl(value: string, path: string): void {\n\tif (!URL_SCHEME_PATTERN.test(value)) return;\n\n\tlet url: URL;\n\ttry {\n\t\turl = new URL(value);\n\t} catch {\n\t\tthrow new MigrationManifestValidationError(`${path} contains an invalid URL`);\n\t}\n\n\tif (CONNECTION_URL_PROTOCOLS.has(url.protocol)) {\n\t\tthrow new MigrationManifestValidationError(`${path} contains a database connection URL`);\n\t}\n\tif (url.username || url.password) {\n\t\tthrow new MigrationManifestValidationError(`${path} contains URL credentials`);\n\t}\n\tfor (const key of url.searchParams.keys()) {\n\t\tif (SECRET_QUERY_KEY_PATTERN.test(key)) {\n\t\t\tthrow new MigrationManifestValidationError(`${path} contains a credential query parameter`);\n\t\t}\n\t}\n}\n\nfunction cloneSecretFreeJson(value: unknown, path: string, ancestors: Set<object>): JsonValue {\n\tif (value === null || typeof value === \"boolean\") return value;\n\tif (typeof value === \"string\") {\n\t\tassertSafeUrl(value, path);\n\t\treturn value;\n\t}\n\tif (typeof value === \"number\") {\n\t\tif (Number.isFinite(value)) return value;\n\t\tthrow new MigrationManifestValidationError(`${path} contains a non-finite number`);\n\t}\n\tif (typeof value !== \"object\") {\n\t\tthrow new MigrationManifestValidationError(`${path} is not JSON-serializable`);\n\t}\n\tif (ancestors.has(value)) {\n\t\tthrow new MigrationManifestValidationError(`${path} contains a cycle`);\n\t}\n\n\tancestors.add(value);\n\ttry {\n\t\tif (Array.isArray(value)) {\n\t\t\treturn value.map((item, index) => cloneSecretFreeJson(item, `${path}[${index}]`, ancestors));\n\t\t}\n\n\t\tconst prototype = Object.getPrototypeOf(value);\n\t\tif (prototype !== Object.prototype && prototype !== null) {\n\t\t\tthrow new MigrationManifestValidationError(`${path} contains a non-plain object`);\n\t\t}\n\n\t\tconst cloned: Record<string, JsonValue> = {};\n\t\tfor (const [key, item] of Object.entries(value)) {\n\t\t\tconst itemPath = `${path}.${key}`;\n\t\t\tconst environmentReference = isEnvironmentReferenceKey(key);\n\t\t\tif (\n\t\t\t\t!environmentReference &&\n\t\t\t\t(SECRET_CONFIG_KEY_PATTERN.test(key) || SECRET_CONFIG_EXACT_KEY_PATTERN.test(key))\n\t\t\t) {\n\t\t\t\tthrow new MigrationManifestValidationError(`${itemPath} is a credential-bearing field`);\n\t\t\t}\n\t\t\tif (environmentReference) {\n\t\t\t\tif (typeof item !== \"string\" || !ENVIRONMENT_VARIABLE_PATTERN.test(item)) {\n\t\t\t\t\tthrow new MigrationManifestValidationError(\n\t\t\t\t\t\t`${itemPath} must contain an environment-variable name`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcloned[key] = cloneSecretFreeJson(item, itemPath, ancestors);\n\t\t}\n\t\treturn cloned;\n\t} finally {\n\t\tancestors.delete(value);\n\t}\n}\n\nexport function validateSecretFreeExecutorConfig(\n\tvalue: unknown,\n\tpath = \"database.executorConfig\",\n): unknown {\n\treturn cloneSecretFreeJson(value, path, new Set());\n}\n\nfunction identitiesMatch(\n\tmanifest: MigrationManifestV1,\n\texpectedIdentity: CoreMigrationIdentity,\n): boolean {\n\treturn (\n\t\tmanifest.emdashVersion === expectedIdentity.emdashVersion &&\n\t\tmanifest.migrationSet.fingerprint === expectedIdentity.fingerprint &&\n\t\tmanifest.migrationSet.names.length === expectedIdentity.names.length &&\n\t\tmanifest.migrationSet.names.every((name, index) => name === expectedIdentity.names[index])\n\t);\n}\n\nexport async function validateMigrationManifest(\n\tvalue: unknown,\n\texpectedIdentity?: CoreMigrationIdentity,\n): Promise<MigrationManifestV1> {\n\tconst parsed = migrationManifestV1Schema.safeParse(value);\n\tif (!parsed.success) {\n\t\tthrow new MigrationManifestValidationError(\"schema validation failed\");\n\t}\n\n\tconst executorConfig = validateSecretFreeExecutorConfig(parsed.data.database.executorConfig);\n\tconst manifest: MigrationManifestV1 = {\n\t\t...parsed.data,\n\t\tdatabase: { ...parsed.data.database, executorConfig },\n\t};\n\tconst fingerprint = await fingerprintMigrationSet(\n\t\tmanifest.emdashVersion,\n\t\tmanifest.migrationSet.names,\n\t);\n\tif (fingerprint !== manifest.migrationSet.fingerprint) {\n\t\tthrow new MigrationManifestValidationError(\n\t\t\t\"migrationSet fingerprint does not match its version and ordered names\",\n\t\t);\n\t}\n\tif (expectedIdentity && !identitiesMatch(manifest, expectedIdentity)) {\n\t\tthrow new MigrationManifestValidationError(\n\t\t\t\"manifest does not match the loaded EmDash migration identity\",\n\t\t);\n\t}\n\n\treturn manifest;\n}\n\nexport function serializeMigrationManifest(manifest: MigrationManifestV1): string {\n\treturn `${JSON.stringify(manifest, null, \"\\t\")}\\n`;\n}\n","import type { DatabaseDescriptor } from \"../db/adapters.js\";\nimport { validateSecretFreeExecutorConfig } from \"./manifest.js\";\n\nexport const MIGRATION_CONFIG_SYMBOL = Symbol.for(\"emdash:migration-config\");\n\nexport interface MigrationIntegrationMetadata {\n\tdatabase?: Pick<DatabaseDescriptor, \"type\" | \"migrations\">;\n}\n\nfunction isRecord(value: unknown): value is Record<PropertyKey, unknown> {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nfunction isMigrationIntegrationMetadata(value: unknown): value is MigrationIntegrationMetadata {\n\tif (!isRecord(value)) return false;\n\tconst database = value.database;\n\tif (database === undefined) return true;\n\tif (!isRecord(database) || (database.type !== \"sqlite\" && database.type !== \"postgres\")) {\n\t\treturn false;\n\t}\n\n\tconst migrations = database.migrations;\n\treturn (\n\t\tmigrations === undefined ||\n\t\t(isRecord(migrations) &&\n\t\t\ttypeof migrations.entrypoint === \"string\" &&\n\t\t\tObject.hasOwn(migrations, \"manifestConfig\"))\n\t);\n}\n\nexport function createMigrationIntegrationMetadata(\n\tdatabase?: DatabaseDescriptor,\n): MigrationIntegrationMetadata {\n\tif (!database) return {};\n\n\treturn {\n\t\tdatabase: {\n\t\t\ttype: database.type,\n\t\t\tmigrations: database.migrations\n\t\t\t\t? {\n\t\t\t\t\t\tentrypoint: database.migrations.entrypoint,\n\t\t\t\t\t\tmanifestConfig: validateSecretFreeExecutorConfig(\n\t\t\t\t\t\t\tdatabase.migrations.manifestConfig,\n\t\t\t\t\t\t\t\"database.migrations.manifestConfig\",\n\t\t\t\t\t\t),\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\t},\n\t};\n}\n\nexport function getMigrationIntegrationMetadata(\n\tintegration: unknown,\n): MigrationIntegrationMetadata | undefined {\n\tif (\n\t\t(typeof integration !== \"object\" || integration === null) &&\n\t\ttypeof integration !== \"function\"\n\t) {\n\t\treturn undefined;\n\t}\n\tif (!Object.hasOwn(integration, MIGRATION_CONFIG_SYMBOL)) {\n\t\treturn undefined;\n\t}\n\n\tconst metadata: unknown = Reflect.get(integration, MIGRATION_CONFIG_SYMBOL);\n\treturn isMigrationIntegrationMetadata(metadata) ? metadata : undefined;\n}\n","import type { DatabaseDescriptor } from \"../db/adapters.js\";\nimport type { I18nConfig } from \"../i18n/config.js\";\nimport type { CoreMigrationIdentity } from \"./identity.js\";\nimport { fingerprintMigrationSet } from \"./identity.js\";\nimport type { MigrationManifestV1 } from \"./manifest.js\";\nimport { MigrationManifestValidationError, validateMigrationManifest } from \"./manifest.js\";\n\nexport type ManifestDatabaseDescriptor = Pick<DatabaseDescriptor, \"type\" | \"migrations\">;\n\nexport interface BuildMigrationManifestOptions {\n\tidentity: CoreMigrationIdentity;\n\ti18n: I18nConfig | null;\n\tdatabase: ManifestDatabaseDescriptor;\n}\n\nexport class UnsupportedMigrationAdapterError extends Error {\n\tconstructor() {\n\t\tsuper(\"The configured database adapter does not provide a deployment migration executor\");\n\t\tthis.name = \"UnsupportedMigrationAdapterError\";\n\t}\n}\n\nexport async function buildMigrationManifest({\n\tidentity,\n\ti18n,\n\tdatabase,\n}: BuildMigrationManifestOptions): Promise<MigrationManifestV1> {\n\tconst identityFingerprint = await fingerprintMigrationSet(identity.emdashVersion, identity.names);\n\tif (identityFingerprint !== identity.fingerprint) {\n\t\tthrow new MigrationManifestValidationError(\n\t\t\t\"loaded identity fingerprint does not match its version and ordered names\",\n\t\t);\n\t}\n\tif (!database.migrations) {\n\t\tthrow new UnsupportedMigrationAdapterError();\n\t}\n\n\treturn validateMigrationManifest(\n\t\t{\n\t\t\tschemaVersion: 1,\n\t\t\temdashVersion: identity.emdashVersion,\n\t\t\tmigrationSet: {\n\t\t\t\tnames: [...identity.names],\n\t\t\t\tfingerprint: identity.fingerprint,\n\t\t\t},\n\t\t\ti18n,\n\t\t\tdatabase: {\n\t\t\t\ttype: database.type,\n\t\t\t\texecutorEntrypoint: database.migrations.entrypoint,\n\t\t\t\texecutorConfig: database.migrations.manifestConfig,\n\t\t\t},\n\t\t},\n\t\tidentity,\n\t);\n}\n"],"mappings":";;;;AAcA,SAAgB,mBAAmB,QAA8D;AAChG,KAAI,CAAC,OAAQ,QAAO;AAEpB,QAAO;EACN,eAAe,OAAO;EACtB,SAAS,OAAO,QAAQ,KAAK,WAAY,OAAO,WAAW,WAAW,SAAS,OAAO,KAAM;EAC5F,UAAU,OAAO,WACd,OAAO,YACP,OAAO,QAAQ,OAAO,SAAS,CAAC,QAC9B,UAAqC,MAAM,OAAO,OACnD,CACD,GACA;EACH,qBACC,OAAO,OAAO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,YACpC,OAAM,IAAI,iCACT,2EACA;AAEF,KAAI,CAAC,SAAS,WACb,OAAM,IAAI,kCAAkC;AAG7C,QAAO,0BACN;EACC,eAAe;EACf,eAAe,SAAS;EACxB,cAAc;GACb,OAAO,CAAC,GAAG,SAAS,MAAM;GAC1B,aAAa,SAAS;GACtB;EACD;EACA,UAAU;GACT,MAAM,SAAS;GACf,oBAAoB,SAAS,WAAW;GACxC,gBAAgB,SAAS,WAAW;GACpC;EACD,EACD,SACA"}
@@ -2,11 +2,11 @@ import "../parse-CVgO-Qai.mjs";
2
2
  import { t as Database } from "../types-B7Lmsh1E.mjs";
3
3
  import "../types-Cr-Kg-3D.mjs";
4
4
  import "../options-SQCHQCPH.mjs";
5
- import "../entry-lock-DVhCt49A.mjs";
5
+ import "../entry-lock-Cf5OoIgN.mjs";
6
6
  import { h as MediaProviderItem, o as CreateMediaProviderFn } from "../placeholder-MSEd8gty.mjs";
7
- import "../config-5ii2haYu.mjs";
7
+ import "../config-BjEm_3xL.mjs";
8
8
  import "../runner-D5_LzKXI.mjs";
9
- import "../storage-query-Bdv7A62k.mjs";
9
+ import "../storage-query-FXJH5pI8.mjs";
10
10
  import "../index-D-hdtLe8.mjs";
11
11
  import { d as Storage } from "../types-DA1Te3Oy.mjs";
12
12
  import "../types-Cd-O03VG.mjs";
@@ -6,11 +6,11 @@ import "../base64-DvnNgP7e.mjs";
6
6
  import "../secrets-CIi0nFiR.mjs";
7
7
  import "../object-cache-CqWNY5uP.mjs";
8
8
  import "../types-BkUg2yHx.mjs";
9
- import { t as MediaRepository } from "../media-Qp5S3eH3.mjs";
9
+ import { t as MediaRepository } from "../media-CPXTbb1R.mjs";
10
10
  import "../request-cache-DzLYKm_x.mjs";
11
11
  import "../loader-BzqeR1ZN.mjs";
12
- import { n as handleMediaDelete } from "../media-h7tOiDLj.mjs";
13
- import { s as invalidateSiteSettingsCache } from "../settings-CgjRWGW9.mjs";
12
+ import { n as handleMediaDelete } from "../media-JXRWDhw3.mjs";
13
+ import { s as invalidateSiteSettingsCache } from "../settings-B4vDl1fK.mjs";
14
14
 
15
15
  //#region src/media/local-runtime.ts
16
16
  /**
@@ -1,3 +1,4 @@
1
+ import { n as chunks, t as SQL_BATCH_SIZE } from "./chunks-Dms7Uxbt.mjs";
1
2
  import { o as decodeCursor, s as encodeCursor } from "./types-BkUg2yHx.mjs";
2
3
  import { n as normalizeFocalPoint } from "./focal-point-Gr34o-4o.mjs";
3
4
  import { sql } from "kysely";
@@ -160,6 +161,13 @@ var MediaRepository = class {
160
161
  return row ? this.rowToItem(row) : null;
161
162
  }
162
163
  /**
164
+ * Find the pending media row minted for a signed upload URL.
165
+ */
166
+ async findPendingByStorageKey(storageKey) {
167
+ const row = await this.db.selectFrom("media").selectAll().where("storage_key", "=", storageKey).where("status", "=", "pending").executeTakeFirst();
168
+ return row ? this.rowToItem(row) : null;
169
+ }
170
+ /**
163
171
  * Find media by ID
164
172
  */
165
173
  async findById(id) {
@@ -285,6 +293,9 @@ var MediaRepository = class {
285
293
  if (deleted) return deleted.storage_key;
286
294
  return null;
287
295
  }
296
+ async isStorageKeyReferenced(storageKey) {
297
+ return await this.db.selectFrom("media").select("id").where("storage_key", "=", storageKey).executeTakeFirst() !== void 0;
298
+ }
288
299
  async delete(id) {
289
300
  return await this.deleteWithStorageKey(id) !== null;
290
301
  }
@@ -320,7 +331,14 @@ var MediaRepository = class {
320
331
  */
321
332
  async cleanupPendingUploads(maxAgeMs = 3600 * 1e3) {
322
333
  const cutoff = new Date(Date.now() - maxAgeMs).toISOString();
323
- return (await this.db.deleteFrom("media").where("status", "=", "pending").where("created_at", "<", cutoff).returning("storage_key").execute()).map((r) => r.storage_key);
334
+ const keys = (await this.db.deleteFrom("media").where("status", "=", "pending").where("created_at", "<", cutoff).returning("storage_key").execute()).map((r) => r.storage_key);
335
+ if (keys.length === 0) return keys;
336
+ const stillReferenced = /* @__PURE__ */ new Set();
337
+ for (const batch of chunks(keys, SQL_BATCH_SIZE)) {
338
+ const refs = await this.db.selectFrom("media").select("storage_key").where("storage_key", "in", batch).execute();
339
+ for (const ref of refs) stillReferenced.add(ref.storage_key);
340
+ }
341
+ return keys.filter((key) => !stillReferenced.has(key));
324
342
  }
325
343
  /**
326
344
  * Convert database row to MediaItem
@@ -352,4 +370,4 @@ var MediaRepository = class {
352
370
 
353
371
  //#endregion
354
372
  export { MediaRepository as t };
355
- //# sourceMappingURL=media-Qp5S3eH3.mjs.map
373
+ //# sourceMappingURL=media-CPXTbb1R.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-CPXTbb1R.mjs","names":[],"sources":["../src/database/repositories/media.ts"],"sourcesContent":["import {\n\tsql,\n\ttype ExpressionBuilder,\n\ttype Kysely,\n\ttype SelectQueryBuilder,\n\ttype SqlBool,\n} from \"kysely\";\nimport { ulid } from \"ulidx\";\n\nimport { normalizeFocalPoint, type FocalPointUpdate } from \"../../media/focal-point.js\";\nimport { chunks, SQL_BATCH_SIZE } from \"../../utils/chunks.js\";\nimport type { Database, MediaRow } from \"../types.js\";\nimport type { FindManyResult } from \"./types.js\";\nimport { encodeCursor, decodeCursor } from \"./types.js\";\n\n/** Escape LIKE wildcard characters and the escape char itself in user-supplied values */\nfunction escapeLike(value: string): string {\n\treturn value.replaceAll(\"\\\\\", \"\\\\\\\\\").replaceAll(\"%\", \"\\\\%\").replaceAll(\"_\", \"\\\\_\");\n}\n\n/**\n * Normalize a mimeType filter (string or array) into a clean string[].\n * Entries that are empty strings are dropped.\n */\nfunction normalizeMimeFilter(input?: string | readonly string[]): string[] {\n\tif (!input) return [];\n\tconst arr = Array.isArray(input) ? input : [input];\n\treturn arr\n\t\t.filter((entry): entry is string => typeof entry === \"string\" && entry.length > 0)\n\t\t.map((entry) =>\n\t\t\tentry.endsWith(\"/\") ? entry.toLowerCase() : entry.split(\";\")[0].trim().toLowerCase(),\n\t\t);\n}\n\nfunction normalizeListLimit(limit: unknown): number {\n\tconst integer = typeof limit === \"number\" && !Number.isNaN(limit) ? Math.trunc(limit) : 50;\n\treturn Math.min(Math.max(integer, 1), 100);\n}\n\n/**\n * Build a WHERE clause that matches `mime_type` against any of the given\n * filter entries — exact equality for full MIMEs, LIKE prefix for entries\n * ending in \"/\".\n */\nfunction mimeMatchExpr(eb: ExpressionBuilder<Database, \"media\">, filters: string[]) {\n\treturn eb.or(\n\t\tfilters.map((entry) =>\n\t\t\tentry.endsWith(\"/\")\n\t\t\t\t? sql<SqlBool>`mime_type LIKE ${`${escapeLike(entry)}%`} ESCAPE '\\\\'`\n\t\t\t\t: eb(\"mime_type\", \"=\", entry),\n\t\t),\n\t);\n}\n\nexport type MediaStatus = \"pending\" | \"ready\" | \"failed\";\n\nexport interface MediaItem {\n\tid: string;\n\tfilename: string;\n\tmimeType: string;\n\tsize: number | null;\n\twidth: number | null;\n\theight: number | null;\n\tfocalX: number | null;\n\tfocalY: number | null;\n\talt: string | null;\n\tcaption: string | null;\n\tstorageKey: string;\n\tstatus: MediaStatus;\n\tcontentHash: string | null;\n\tblurhash: string | null;\n\tdominantColor: string | null;\n\tcreatedAt: string;\n\tauthorId: string | null;\n\tfolderId?: string | null;\n}\n\nexport interface CreateMediaInput {\n\tfilename: string;\n\tmimeType: string;\n\tsize?: number;\n\twidth?: number;\n\theight?: number;\n\talt?: string;\n\tcaption?: string;\n\tstorageKey: string;\n\tcontentHash?: string;\n\tblurhash?: string;\n\tdominantColor?: string;\n\tstatus?: MediaStatus;\n\tauthorId?: string;\n\tfolderId?: string | null;\n}\n\nexport interface FindManyMediaOptions {\n\tlimit?: number;\n\tcursor?: string;\n\t/** Filter by MIME type. Pass a string for a single prefix/exact, or an array to match any. Strings ending with \"/\" are treated as LIKE prefix matches; others are exact equality. */\n\tmimeType?: string | readonly string[];\n\tstatus?: MediaStatus | \"all\"; // Filter by status, defaults to \"ready\"\n\t/** Case-insensitive substring matched against the filename (covers filename and extension). */\n\tq?: string;\n\t/** Omit for all media, pass null for the Main library, or pass a folder ID. */\n\tfolderId?: string | null;\n}\n\nexport interface UpdateMediaInput extends FocalPointUpdate {\n\talt?: string | null;\n\tcaption?: string | null;\n\twidth?: number;\n\theight?: number;\n\tfolderId?: string | null;\n}\n\nexport interface ReplaceReadyMediaInput {\n\tsize: number;\n\twidth: number;\n\theight: number;\n\tcontentHash: string;\n}\n\nexport interface FindMediaPageOptions extends Omit<FindManyMediaOptions, \"cursor\"> {\n\tpage: number;\n}\n\nexport interface MediaPageResult {\n\titems: MediaItem[];\n\ttotalCount: number;\n}\n\nconst UPLOAD_ATTEMPT_CLEANUP_AGE_MS = 60 * 60 * 1000;\nconst UPLOAD_ATTEMPT_CLEANUP_BATCH_SIZE = 100;\n\n/**\n * Media repository for database operations\n */\nexport class MediaRepository {\n\tconstructor(private db: Kysely<Database>) {}\n\n\t/**\n\t * Create a new media item\n\t */\n\tasync create(input: CreateMediaInput): Promise<MediaItem> {\n\t\tconst id = ulid();\n\t\tconst now = new Date().toISOString();\n\n\t\tconst row: Omit<MediaRow, \"rowid\"> = {\n\t\t\tid,\n\t\t\tfilename: input.filename,\n\t\t\tmime_type: input.mimeType,\n\t\t\tsize: input.size ?? null,\n\t\t\twidth: input.width ?? null,\n\t\t\theight: input.height ?? null,\n\t\t\tfocal_x: null,\n\t\t\tfocal_y: null,\n\t\t\talt: input.alt ?? null,\n\t\t\tcaption: input.caption ?? null,\n\t\t\tstorage_key: input.storageKey,\n\t\t\tcontent_hash: input.contentHash ?? null,\n\t\t\tblurhash: input.blurhash ?? null,\n\t\t\tdominant_color: input.dominantColor ?? null,\n\t\t\tstatus: input.status ?? \"ready\",\n\t\t\tcreated_at: now,\n\t\t\tauthor_id: input.authorId ?? null,\n\t\t\tfolder_id: input.folderId ?? null,\n\t\t};\n\n\t\tawait this.db.insertInto(\"media\").values(row).execute();\n\n\t\treturn this.rowToItem(row);\n\t}\n\n\t/**\n\t * Create a pending media item (for signed URL upload flow)\n\t */\n\tasync createPending(input: {\n\t\tfilename: string;\n\t\tmimeType: string;\n\t\tsize?: number;\n\t\tstorageKey: string;\n\t\tcontentHash?: string;\n\t\tauthorId?: string;\n\t\tfolderId?: string | null;\n\t}): Promise<MediaItem> {\n\t\treturn this.create({\n\t\t\t...input,\n\t\t\tstatus: \"pending\",\n\t\t});\n\t}\n\n\tasync createUploadAttempt(mediaId: string, storageKey: string): Promise<void> {\n\t\tconst now = new Date().toISOString();\n\t\tawait this.db\n\t\t\t.insertInto(\"_emdash_media_upload_attempts\")\n\t\t\t.values({\n\t\t\t\tmedia_id: mediaId,\n\t\t\t\tstorage_key: storageKey,\n\t\t\t\tstatus: \"active\",\n\t\t\t\tcreated_at: now,\n\t\t\t\tupdated_at: now,\n\t\t\t})\n\t\t\t.execute();\n\t}\n\n\t/**\n\t * Register a stored object for cleanup before its media row is removed,\n\t * so a failed storage delete is retried by the cleanup sweep instead of\n\t * leaving the object unreferenced and unreachable.\n\t */\n\tasync trackStorageKeyForCleanup(mediaId: string, storageKey: string): Promise<void> {\n\t\tconst now = new Date().toISOString();\n\t\tawait this.db\n\t\t\t.insertInto(\"_emdash_media_upload_attempts\")\n\t\t\t.values({\n\t\t\t\tmedia_id: mediaId,\n\t\t\t\tstorage_key: storageKey,\n\t\t\t\tstatus: \"cleanup\",\n\t\t\t\tcreated_at: now,\n\t\t\t\tupdated_at: now,\n\t\t\t})\n\t\t\t.onConflict((oc) =>\n\t\t\t\toc.column(\"storage_key\").doUpdateSet({ status: \"cleanup\", updated_at: now }),\n\t\t\t)\n\t\t\t.execute();\n\t}\n\n\tasync hasUploadAttempt(storageKey: string): Promise<boolean> {\n\t\tconst row = await this.db\n\t\t\t.selectFrom(\"_emdash_media_upload_attempts\")\n\t\t\t.select(\"storage_key\")\n\t\t\t.where(\"storage_key\", \"=\", storageKey)\n\t\t\t.executeTakeFirst();\n\t\treturn row !== undefined;\n\t}\n\n\tasync claimUploadAttemptForCleanup(storageKey: string): Promise<boolean> {\n\t\tconst result = await this.db\n\t\t\t.updateTable(\"_emdash_media_upload_attempts\")\n\t\t\t.set({ status: \"cleanup\", updated_at: new Date().toISOString() })\n\t\t\t.where(\"storage_key\", \"=\", storageKey)\n\t\t\t.where((eb) =>\n\t\t\t\teb.not(\n\t\t\t\t\teb.exists(\n\t\t\t\t\t\teb\n\t\t\t\t\t\t\t.selectFrom(\"media\")\n\t\t\t\t\t\t\t.select(\"media.id\")\n\t\t\t\t\t\t\t.whereRef(\"media.storage_key\", \"=\", \"_emdash_media_upload_attempts.storage_key\"),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t)\n\t\t\t.executeTakeFirst();\n\n\t\treturn Number(result.numUpdatedRows ?? 0) > 0;\n\t}\n\n\tasync deleteUploadAttempt(storageKey: string): Promise<void> {\n\t\tawait this.db\n\t\t\t.deleteFrom(\"_emdash_media_upload_attempts\")\n\t\t\t.where(\"storage_key\", \"=\", storageKey)\n\t\t\t.execute();\n\t}\n\n\tasync deferUploadAttemptCleanup(storageKey: string): Promise<void> {\n\t\tawait this.db\n\t\t\t.updateTable(\"_emdash_media_upload_attempts\")\n\t\t\t.set({ updated_at: new Date().toISOString() })\n\t\t\t.where(\"storage_key\", \"=\", storageKey)\n\t\t\t.execute();\n\t}\n\n\tasync deleteCompletedUploadAttempts(): Promise<number> {\n\t\tconst result = await this.db\n\t\t\t.deleteFrom(\"_emdash_media_upload_attempts\")\n\t\t\t.where(\"status\", \"=\", \"active\")\n\t\t\t.where((eb) =>\n\t\t\t\teb.exists(\n\t\t\t\t\teb\n\t\t\t\t\t\t.selectFrom(\"media\")\n\t\t\t\t\t\t.select(\"media.id\")\n\t\t\t\t\t\t.whereRef(\"media.id\", \"=\", \"_emdash_media_upload_attempts.media_id\")\n\t\t\t\t\t\t.whereRef(\"media.storage_key\", \"=\", \"_emdash_media_upload_attempts.storage_key\")\n\t\t\t\t\t\t.where(\"media.status\", \"=\", \"ready\"),\n\t\t\t\t),\n\t\t\t)\n\t\t\t.executeTakeFirst();\n\t\treturn Number(result.numDeletedRows ?? 0);\n\t}\n\n\tasync findUploadAttemptsForCleanup(\n\t\tmaxAgeMs: number = UPLOAD_ATTEMPT_CLEANUP_AGE_MS,\n\t\tlimit: number = UPLOAD_ATTEMPT_CLEANUP_BATCH_SIZE,\n\t): Promise<string[]> {\n\t\tconst cutoff = new Date(Date.now() - maxAgeMs).toISOString();\n\t\tconst rows = await this.db\n\t\t\t.selectFrom(\"_emdash_media_upload_attempts\")\n\t\t\t.select(\"storage_key\")\n\t\t\t.where((eb) => eb.or([eb(\"status\", \"=\", \"cleanup\"), eb(\"created_at\", \"<\", cutoff)]))\n\t\t\t.where((eb) =>\n\t\t\t\teb.not(\n\t\t\t\t\teb.exists(\n\t\t\t\t\t\teb\n\t\t\t\t\t\t\t.selectFrom(\"media\")\n\t\t\t\t\t\t\t.select(\"media.id\")\n\t\t\t\t\t\t\t.whereRef(\"media.storage_key\", \"=\", \"_emdash_media_upload_attempts.storage_key\"),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t)\n\t\t\t.orderBy(\"updated_at\", \"asc\")\n\t\t\t.limit(limit)\n\t\t\t.execute();\n\n\t\treturn rows.map((row) => row.storage_key);\n\t}\n\n\tasync publishPendingStorageKey(\n\t\tid: string,\n\t\texpectedStorageKey: string,\n\t\tstorageKey: string,\n\t\tcontentHash?: string,\n\t): Promise<boolean> {\n\t\tconst result = await this.db\n\t\t\t.updateTable(\"media\")\n\t\t\t.set({\n\t\t\t\tstorage_key: storageKey,\n\t\t\t\t...(contentHash !== undefined ? { content_hash: contentHash } : {}),\n\t\t\t})\n\t\t\t.where(\"id\", \"=\", id)\n\t\t\t.where(\"status\", \"=\", \"pending\")\n\t\t\t.where(\"storage_key\", \"=\", expectedStorageKey)\n\t\t\t.where((eb) =>\n\t\t\t\teb.exists(\n\t\t\t\t\teb\n\t\t\t\t\t\t.selectFrom(\"_emdash_media_upload_attempts\")\n\t\t\t\t\t\t.select(\"storage_key\")\n\t\t\t\t\t\t.where(\"media_id\", \"=\", id)\n\t\t\t\t\t\t.where(\"storage_key\", \"=\", storageKey)\n\t\t\t\t\t\t.where(\"status\", \"=\", \"active\"),\n\t\t\t\t),\n\t\t\t)\n\t\t\t.executeTakeFirst();\n\n\t\treturn Number(result.numUpdatedRows ?? 0) > 0;\n\t}\n\n\t/**\n\t * Confirm upload (mark as ready)\n\t */\n\tasync confirmUpload(\n\t\tid: string,\n\t\tmetadata?: {\n\t\t\twidth?: number;\n\t\t\theight?: number;\n\t\t\tsize?: number;\n\t\t\tblurhash?: string;\n\t\t\tdominantColor?: string;\n\t\t\tcontentHash?: string | null;\n\t\t},\n\t\texpectedStorageKey?: string,\n\t): Promise<MediaItem | null> {\n\t\tconst updates: Partial<MediaRow> = {\n\t\t\tstatus: \"ready\",\n\t\t};\n\t\tif (metadata?.width !== undefined) updates.width = metadata.width;\n\t\tif (metadata?.height !== undefined) updates.height = metadata.height;\n\t\tif (metadata?.size !== undefined) updates.size = metadata.size;\n\t\tif (metadata?.blurhash !== undefined) updates.blurhash = metadata.blurhash;\n\t\tif (metadata?.dominantColor !== undefined) updates.dominant_color = metadata.dominantColor;\n\t\tif (metadata?.contentHash !== undefined) updates.content_hash = metadata.contentHash;\n\n\t\tlet query = this.db\n\t\t\t.updateTable(\"media\")\n\t\t\t.set(updates)\n\t\t\t.where(\"id\", \"=\", id)\n\t\t\t.where(\"status\", \"=\", \"pending\");\n\t\tif (expectedStorageKey !== undefined) {\n\t\t\tquery = query.where(\"storage_key\", \"=\", expectedStorageKey);\n\t\t}\n\n\t\tconst row = await query.returningAll().executeTakeFirst();\n\n\t\treturn row ? this.rowToItem(row) : null;\n\t}\n\n\t/**\n\t * Mark upload as failed\n\t */\n\tasync markFailed(id: string, expectedStorageKey?: string): Promise<MediaItem | null> {\n\t\tlet query = this.db.updateTable(\"media\").set({ status: \"failed\" }).where(\"id\", \"=\", id);\n\t\tif (expectedStorageKey !== undefined) {\n\t\t\tquery = query.where(\"status\", \"=\", \"pending\").where(\"storage_key\", \"=\", expectedStorageKey);\n\t\t}\n\n\t\tconst row = await query.returningAll().executeTakeFirst();\n\t\treturn row ? this.rowToItem(row) : null;\n\t}\n\n\t/**\n\t * Find the pending media row minted for a signed upload URL.\n\t */\n\tasync findPendingByStorageKey(storageKey: string): Promise<MediaItem | null> {\n\t\tconst row = await this.db\n\t\t\t.selectFrom(\"media\")\n\t\t\t.selectAll()\n\t\t\t.where(\"storage_key\", \"=\", storageKey)\n\t\t\t.where(\"status\", \"=\", \"pending\")\n\t\t\t.executeTakeFirst();\n\n\t\treturn row ? this.rowToItem(row) : null;\n\t}\n\n\t/**\n\t * Find media by ID\n\t */\n\tasync findById(id: string): Promise<MediaItem | null> {\n\t\tconst row = await this.db\n\t\t\t.selectFrom(\"media\")\n\t\t\t.selectAll()\n\t\t\t.where(\"id\", \"=\", id)\n\t\t\t.executeTakeFirst();\n\n\t\treturn row ? this.rowToItem(row) : null;\n\t}\n\n\t/**\n\t * Find media by filename\n\t * Useful for idempotent imports\n\t */\n\tasync findByFilename(filename: string): Promise<MediaItem | null> {\n\t\tconst row = await this.db\n\t\t\t.selectFrom(\"media\")\n\t\t\t.selectAll()\n\t\t\t.where(\"filename\", \"=\", filename)\n\t\t\t.executeTakeFirst();\n\n\t\treturn row ? this.rowToItem(row) : null;\n\t}\n\n\tasync findAvailableFilename(filename: string): Promise<string> {\n\t\tconst exists = async (candidate: string) =>\n\t\t\tBoolean(\n\t\t\t\tawait this.db\n\t\t\t\t\t.selectFrom(\"media\")\n\t\t\t\t\t.select(\"id\")\n\t\t\t\t\t.where(sql<string>`lower(filename)`, \"=\", candidate.toLowerCase())\n\t\t\t\t\t.executeTakeFirst(),\n\t\t\t);\n\t\tif (!(await exists(filename))) return filename;\n\n\t\tconst extensionIndex = filename.lastIndexOf(\".\");\n\t\tconst hasExtension = extensionIndex > 0;\n\t\tconst extension = hasExtension ? filename.slice(extensionIndex) : \"\";\n\t\tconst stem = hasExtension ? filename.slice(0, extensionIndex) : filename;\n\t\tlet copyNumber = 2;\n\t\tlet candidate = `${stem}-${copyNumber}${extension}`;\n\t\twhile (await exists(candidate)) {\n\t\t\tcopyNumber += 1;\n\t\t\tcandidate = `${stem}-${copyNumber}${extension}`;\n\t\t}\n\t\treturn candidate;\n\t}\n\n\t/**\n\t * Find media by content hash\n\t * Used for deduplication - same content = same hash\n\t */\n\tasync findByContentHash(contentHash: string): Promise<MediaItem | null> {\n\t\tconst row = await this.db\n\t\t\t.selectFrom(\"media\")\n\t\t\t.selectAll()\n\t\t\t.where(\"content_hash\", \"=\", contentHash)\n\t\t\t.where(\"status\", \"=\", \"ready\")\n\t\t\t.executeTakeFirst();\n\n\t\treturn row ? this.rowToItem(row) : null;\n\t}\n\n\t/**\n\t * Find many media items with cursor pagination\n\t *\n\t * Uses keyset pagination (cursor-based) for consistent results.\n\t * The cursor encodes the created_at and id of the last item.\n\t */\n\tasync findMany(options: FindManyMediaOptions = {}): Promise<FindManyResult<MediaItem>> {\n\t\tconst limit = normalizeListLimit(options.limit);\n\n\t\tlet query = this.applyListFilters(this.db.selectFrom(\"media\"), options)\n\t\t\t.selectAll()\n\t\t\t.orderBy(\"created_at\", \"desc\")\n\t\t\t.orderBy(\"id\", \"desc\")\n\t\t\t.limit(limit + 1);\n\n\t\t// Handle cursor-based pagination — throws on invalid cursor.\n\t\tif (options.cursor) {\n\t\t\tconst { orderValue: createdAt, id: cursorId } = decodeCursor(options.cursor);\n\n\t\t\t// Keyset pagination: get items where (created_at, id) < cursor\n\t\t\tquery = query.where((eb) =>\n\t\t\t\teb.or([\n\t\t\t\t\teb(\"created_at\", \"<\", createdAt),\n\t\t\t\t\teb.and([eb(\"created_at\", \"=\", createdAt), eb(\"id\", \"<\", cursorId)]),\n\t\t\t\t]),\n\t\t\t);\n\t\t}\n\n\t\tconst rows = await query.execute();\n\n\t\tconst hasMore = rows.length > limit;\n\t\tconst items = rows.slice(0, limit).map((row) => this.rowToItem(row));\n\n\t\tlet nextCursor: string | undefined;\n\t\tif (hasMore && items.length > 0) {\n\t\t\tconst lastItem = items.at(-1)!;\n\t\t\tnextCursor = encodeCursor(lastItem.createdAt, lastItem.id);\n\t\t}\n\n\t\treturn { items, nextCursor };\n\t}\n\n\tasync findPage(options: FindMediaPageOptions): Promise<MediaPageResult> {\n\t\tconst limit = normalizeListLimit(options.limit);\n\t\tconst offset = (options.page - 1) * limit;\n\t\tconst filtered = this.applyListFilters(this.db.selectFrom(\"media\"), options);\n\t\tconst rows = await filtered\n\t\t\t.selectAll()\n\t\t\t.orderBy(\"created_at\", \"desc\")\n\t\t\t.orderBy(\"id\", \"desc\")\n\t\t\t.limit(limit)\n\t\t\t.offset(offset)\n\t\t\t.execute();\n\t\tconst count = await filtered\n\t\t\t.select((eb) => eb.fn.count<number>(\"id\").as(\"count\"))\n\t\t\t.executeTakeFirst();\n\n\t\treturn {\n\t\t\titems: rows.map((row) => this.rowToItem(row)),\n\t\t\ttotalCount: Number(count?.count ?? 0),\n\t\t};\n\t}\n\n\t/**\n\t * Update media metadata\n\t */\n\tasync update(id: string, input: UpdateMediaInput): Promise<MediaItem | null> {\n\t\tconst existing = await this.findById(id);\n\t\tif (!existing) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst updates: Partial<MediaRow> = {};\n\t\tif (input.alt !== undefined) updates.alt = input.alt;\n\t\tif (input.caption !== undefined) updates.caption = input.caption;\n\t\tif (input.width !== undefined) updates.width = input.width;\n\t\tif (input.height !== undefined) updates.height = input.height;\n\t\tif (input.folderId !== undefined) updates.folder_id = input.folderId;\n\t\tif (input.focalX !== undefined && input.focalY !== undefined) {\n\t\t\tupdates.focal_x = input.focalX;\n\t\t\tupdates.focal_y = input.focalY;\n\t\t}\n\n\t\tif (Object.keys(updates).length > 0) {\n\t\t\tawait this.db.updateTable(\"media\").set(updates).where(\"id\", \"=\", id).execute();\n\t\t}\n\n\t\treturn this.findById(id);\n\t}\n\n\tasync updateReadyMetadata(\n\t\tid: string,\n\t\tinput: Pick<UpdateMediaInput, \"alt\" | \"caption\" | \"focalX\" | \"focalY\">,\n\t): Promise<MediaItem | null> {\n\t\tconst updates: Partial<MediaRow> = {};\n\t\tif (input.alt !== undefined) updates.alt = input.alt;\n\t\tif (input.caption !== undefined) updates.caption = input.caption;\n\t\tif (input.focalX !== undefined && input.focalY !== undefined) {\n\t\t\tupdates.focal_x = input.focalX;\n\t\t\tupdates.focal_y = input.focalY;\n\t\t}\n\n\t\tif (Object.keys(updates).length === 0) {\n\t\t\tthrow new TypeError(\"Media metadata update requires at least one field\");\n\t\t}\n\n\t\tconst row = await this.db\n\t\t\t.updateTable(\"media\")\n\t\t\t.set(updates)\n\t\t\t.where(\"id\", \"=\", id)\n\t\t\t.where(\"status\", \"=\", \"ready\")\n\t\t\t.returningAll()\n\t\t\t.executeTakeFirst();\n\t\treturn row ? this.rowToItem(row) : null;\n\t}\n\n\tasync replaceReadyFile(\n\t\tid: string,\n\t\texpectedStorageKey: string,\n\t\tinput: ReplaceReadyMediaInput,\n\t): Promise<MediaItem | null> {\n\t\tconst row = await this.db\n\t\t\t.updateTable(\"media\")\n\t\t\t.set({\n\t\t\t\tsize: input.size,\n\t\t\t\twidth: input.width,\n\t\t\t\theight: input.height,\n\t\t\t\tcontent_hash: input.contentHash,\n\t\t\t\tblurhash: null,\n\t\t\t\tdominant_color: null,\n\t\t\t\tfocal_x: null,\n\t\t\t\tfocal_y: null,\n\t\t\t})\n\t\t\t.where(\"id\", \"=\", id)\n\t\t\t.where(\"status\", \"=\", \"ready\")\n\t\t\t.where(\"storage_key\", \"=\", expectedStorageKey)\n\t\t\t.returningAll()\n\t\t\t.executeTakeFirst();\n\n\t\treturn row ? this.rowToItem(row) : null;\n\t}\n\n\t/**\n\t * Delete media item\n\t */\n\tasync deleteWithStorageKey(id: string): Promise<string | null> {\n\t\tconst deleted = await this.db\n\t\t\t.deleteFrom(\"media\")\n\t\t\t.where(\"id\", \"=\", id)\n\t\t\t.returning(\"storage_key\")\n\t\t\t.executeTakeFirst();\n\t\tif (deleted) return deleted.storage_key;\n\t\treturn null;\n\t}\n\n\tasync isStorageKeyReferenced(storageKey: string): Promise<boolean> {\n\t\tconst row = await this.db\n\t\t\t.selectFrom(\"media\")\n\t\t\t.select(\"id\")\n\t\t\t.where(\"storage_key\", \"=\", storageKey)\n\t\t\t.executeTakeFirst();\n\t\treturn row !== undefined;\n\t}\n\n\tasync delete(id: string): Promise<boolean> {\n\t\treturn (await this.deleteWithStorageKey(id)) !== null;\n\t}\n\n\t/**\n\t * Count media items\n\t */\n\tasync count(mimeType?: string | readonly string[]): Promise<number> {\n\t\tconst filters = normalizeMimeFilter(mimeType);\n\t\tlet query = this.db.selectFrom(\"media\").select((eb) => eb.fn.count<number>(\"id\").as(\"count\"));\n\n\t\tif (filters.length > 0) {\n\t\t\tquery = query.where((eb) => mimeMatchExpr(eb, filters));\n\t\t}\n\n\t\tconst result = await query.executeTakeFirst();\n\t\treturn Number(result?.count || 0);\n\t}\n\n\tprivate applyListFilters<O>(\n\t\tquery: SelectQueryBuilder<Database, \"media\", O>,\n\t\toptions: Omit<FindManyMediaOptions, \"cursor\" | \"limit\">,\n\t): SelectQueryBuilder<Database, \"media\", O> {\n\t\tconst mimeFilters = normalizeMimeFilter(options.mimeType);\n\t\tif (mimeFilters.length > 0) {\n\t\t\tquery = query.where((eb) => mimeMatchExpr(eb, mimeFilters));\n\t\t}\n\n\t\tconst term = options.q?.trim();\n\t\tif (term) {\n\t\t\tconst pattern = `%${escapeLike(term)}%`;\n\t\t\tquery = query.where(\n\t\t\t\tsql<string>`lower(filename)`,\n\t\t\t\t\"like\",\n\t\t\t\tsql<string>`lower(${pattern}) escape '\\\\'`,\n\t\t\t);\n\t\t}\n\n\t\tif (options.status !== \"all\") {\n\t\t\tquery = query.where(\"status\", \"=\", options.status ?? \"ready\");\n\t\t}\n\n\t\tif (options.folderId === null) {\n\t\t\tquery = query.where(\"folder_id\", \"is\", null);\n\t\t} else if (options.folderId !== undefined) {\n\t\t\tquery = query.where(\"folder_id\", \"=\", options.folderId);\n\t\t}\n\n\t\treturn query;\n\t}\n\n\t/**\n\t * Delete pending uploads older than the given age.\n\t * Pending uploads that were never confirmed indicate abandoned upload flows.\n\t *\n\t * Returns the storage keys of deleted rows so callers can remove the\n\t * corresponding files from object storage.\n\t */\n\tasync cleanupPendingUploads(maxAgeMs: number = 60 * 60 * 1000): Promise<string[]> {\n\t\tconst cutoff = new Date(Date.now() - maxAgeMs).toISOString();\n\n\t\tconst rows = await this.db\n\t\t\t.deleteFrom(\"media\")\n\t\t\t.where(\"status\", \"=\", \"pending\")\n\t\t\t.where(\"created_at\", \"<\", cutoff)\n\t\t\t.returning(\"storage_key\")\n\t\t\t.execute();\n\n\t\tconst keys = rows.map((r) => r.storage_key);\n\t\tif (keys.length === 0) return keys;\n\n\t\t// A stored object may still back another media row (for example after a\n\t\t// legacy duplicate registration); never hand such a key to storage deletion.\n\t\tconst stillReferenced = new Set<string>();\n\t\tfor (const batch of chunks(keys, SQL_BATCH_SIZE)) {\n\t\t\tconst refs = await this.db\n\t\t\t\t.selectFrom(\"media\")\n\t\t\t\t.select(\"storage_key\")\n\t\t\t\t.where(\"storage_key\", \"in\", batch)\n\t\t\t\t.execute();\n\t\t\tfor (const ref of refs) stillReferenced.add(ref.storage_key);\n\t\t}\n\n\t\treturn keys.filter((key) => !stillReferenced.has(key));\n\t}\n\n\t/**\n\t * Convert database row to MediaItem\n\t */\n\tprivate rowToItem(row: MediaRow): MediaItem {\n\t\tconst focalPoint = normalizeFocalPoint(row.focal_x, row.focal_y);\n\t\treturn {\n\t\t\tid: row.id,\n\t\t\tfilename: row.filename,\n\t\t\tmimeType: row.mime_type,\n\t\t\tsize: row.size,\n\t\t\twidth: row.width,\n\t\t\theight: row.height,\n\t\t\tfocalX: focalPoint?.focalX ?? null,\n\t\t\tfocalY: focalPoint?.focalY ?? null,\n\t\t\talt: row.alt,\n\t\t\tcaption: row.caption,\n\t\t\tstorageKey: row.storage_key,\n\t\t\tcontentHash: row.content_hash,\n\t\t\tblurhash: row.blurhash,\n\t\t\tdominantColor: row.dominant_color,\n\t\t\t// eslint-disable-next-line typescript/no-unsafe-type-assertion -- DB stores string; validated at insert but linter can't follow\n\t\t\tstatus: row.status as MediaStatus,\n\t\t\tcreatedAt: row.created_at,\n\t\t\tauthorId: row.author_id,\n\t\t\tfolderId: row.folder_id,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;AAgBA,SAAS,WAAW,OAAuB;AAC1C,QAAO,MAAM,WAAW,MAAM,OAAO,CAAC,WAAW,KAAK,MAAM,CAAC,WAAW,KAAK,MAAM;;;;;;AAOpF,SAAS,oBAAoB,OAA8C;AAC1E,KAAI,CAAC,MAAO,QAAO,EAAE;AAErB,SADY,MAAM,QAAQ,MAAM,GAAG,QAAQ,CAAC,MAAM,EAEhD,QAAQ,UAA2B,OAAO,UAAU,YAAY,MAAM,SAAS,EAAE,CACjF,KAAK,UACL,MAAM,SAAS,IAAI,GAAG,MAAM,aAAa,GAAG,MAAM,MAAM,IAAI,CAAC,GAAG,MAAM,CAAC,aAAa,CACpF;;AAGH,SAAS,mBAAmB,OAAwB;CACnD,MAAM,UAAU,OAAO,UAAU,YAAY,CAAC,OAAO,MAAM,MAAM,GAAG,KAAK,MAAM,MAAM,GAAG;AACxF,QAAO,KAAK,IAAI,KAAK,IAAI,SAAS,EAAE,EAAE,IAAI;;;;;;;AAQ3C,SAAS,cAAc,IAA0C,SAAmB;AACnF,QAAO,GAAG,GACT,QAAQ,KAAK,UACZ,MAAM,SAAS,IAAI,GAChB,GAAY,kBAAkB,GAAG,WAAW,MAAM,CAAC,GAAG,gBACtD,GAAG,aAAa,KAAK,MAAM,CAC9B,CACD;;AA+EF,MAAM,gCAAgC,OAAU;AAChD,MAAM,oCAAoC;;;;AAK1C,IAAa,kBAAb,MAA6B;CAC5B,YAAY,AAAQ,IAAsB;EAAtB;;;;;CAKpB,MAAM,OAAO,OAA6C;EACzD,MAAM,KAAK,MAAM;EACjB,MAAM,uBAAM,IAAI,MAAM,EAAC,aAAa;EAEpC,MAAM,MAA+B;GACpC;GACA,UAAU,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