emdash 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/dist/{adapters-N6BF7RCD.d.mts → adapters-BLMa4JGD.d.mts} +1 -1
  2. package/dist/{adapters-N6BF7RCD.d.mts.map → adapters-BLMa4JGD.d.mts.map} +1 -1
  3. package/dist/{apply-wmVEOSbR.mjs → apply-Bqoekfbe.mjs} +6 -6
  4. package/dist/{apply-wmVEOSbR.mjs.map → apply-Bqoekfbe.mjs.map} +1 -1
  5. package/dist/astro/index.d.mts +25 -11
  6. package/dist/astro/index.d.mts.map +1 -1
  7. package/dist/astro/index.mjs +31 -19
  8. package/dist/astro/index.mjs.map +1 -1
  9. package/dist/astro/middleware/auth.d.mts +5 -5
  10. package/dist/astro/middleware/auth.mjs +1 -1
  11. package/dist/astro/middleware/redirect.mjs +2 -2
  12. package/dist/astro/middleware/setup.mjs +1 -1
  13. package/dist/astro/middleware.mjs +20 -16
  14. package/dist/astro/middleware.mjs.map +1 -1
  15. package/dist/astro/types.d.mts +9 -9
  16. package/dist/astro/types.d.mts.map +1 -1
  17. package/dist/{byline-1WQPlISL.mjs → byline-BGj9p9Ht.mjs} +3 -3
  18. package/dist/{byline-1WQPlISL.mjs.map → byline-BGj9p9Ht.mjs.map} +1 -1
  19. package/dist/{bylines-BYdTYmia.mjs → bylines-BihaoIDY.mjs} +5 -5
  20. package/dist/{bylines-BYdTYmia.mjs.map → bylines-BihaoIDY.mjs.map} +1 -1
  21. package/dist/cli/index.mjs +8 -8
  22. package/dist/client/cf-access.d.mts +1 -1
  23. package/dist/client/index.d.mts +1 -1
  24. package/dist/client/index.mjs +1 -1
  25. package/dist/{content-BmXndhdi.mjs → content-BsBoyj8G.mjs} +20 -3
  26. package/dist/content-BsBoyj8G.mjs.map +1 -0
  27. package/dist/db/index.d.mts +3 -3
  28. package/dist/db/index.mjs +2 -2
  29. package/dist/db/libsql.d.mts +1 -1
  30. package/dist/db/postgres.d.mts +1 -1
  31. package/dist/db/sqlite.d.mts +1 -1
  32. package/dist/{dialect-helpers-B9uSp2GJ.mjs → dialect-helpers-DhTzaUxP.mjs} +4 -1
  33. package/dist/dialect-helpers-DhTzaUxP.mjs.map +1 -0
  34. package/dist/{index-UHEVQMus.d.mts → index-Cff7AimE.d.mts} +40 -16
  35. package/dist/index-Cff7AimE.d.mts.map +1 -0
  36. package/dist/index.d.mts +11 -11
  37. package/dist/index.mjs +12 -12
  38. package/dist/{loader-CHb2v0jm.mjs → loader-BmYdf3Dr.mjs} +4 -2
  39. package/dist/loader-BmYdf3Dr.mjs.map +1 -0
  40. package/dist/media/index.d.mts +1 -1
  41. package/dist/media/local-runtime.d.mts +7 -7
  42. package/dist/{mode-CYeM2rPt.mjs → mode-C2EzN1uE.mjs} +1 -1
  43. package/dist/{mode-CYeM2rPt.mjs.map → mode-C2EzN1uE.mjs.map} +1 -1
  44. package/dist/page/index.d.mts +1 -1
  45. package/dist/{placeholder-bOx1xCTY.d.mts → placeholder-SvFCKbz_.d.mts} +1 -1
  46. package/dist/{placeholder-bOx1xCTY.d.mts.map → placeholder-SvFCKbz_.d.mts.map} +1 -1
  47. package/dist/plugins/adapt-sandbox-entry.d.mts +5 -5
  48. package/dist/{query-5Hcv_5ER.mjs → query-sesiOndV.mjs} +6 -6
  49. package/dist/{query-5Hcv_5ER.mjs.map → query-sesiOndV.mjs.map} +1 -1
  50. package/dist/{redirect-DIfIni3r.mjs → redirect-DUAk-Yl_.mjs} +9 -2
  51. package/dist/redirect-DUAk-Yl_.mjs.map +1 -0
  52. package/dist/{registry-1EvbAfsC.mjs → registry-DU18yVo0.mjs} +9 -3
  53. package/dist/registry-DU18yVo0.mjs.map +1 -0
  54. package/dist/{runner-BoN0-FPi.mjs → runner-Biufrii2.mjs} +3 -3
  55. package/dist/{runner-BoN0-FPi.mjs.map → runner-Biufrii2.mjs.map} +1 -1
  56. package/dist/{runner-DTqkzOzc.d.mts → runner-EAtf0ZIe.d.mts} +2 -2
  57. package/dist/{runner-DTqkzOzc.d.mts.map → runner-EAtf0ZIe.d.mts.map} +1 -1
  58. package/dist/runtime.d.mts +6 -6
  59. package/dist/runtime.mjs +2 -2
  60. package/dist/{search-BsYMed12.mjs → search-BXB-jfu2.mjs} +13 -11
  61. package/dist/search-BXB-jfu2.mjs.map +1 -0
  62. package/dist/seed/index.d.mts +2 -2
  63. package/dist/seed/index.mjs +7 -7
  64. package/dist/seo/index.d.mts +1 -1
  65. package/dist/storage/local.d.mts +1 -1
  66. package/dist/storage/s3.d.mts +11 -3
  67. package/dist/storage/s3.d.mts.map +1 -1
  68. package/dist/storage/s3.mjs +75 -14
  69. package/dist/storage/s3.mjs.map +1 -1
  70. package/dist/{transport-COOs9GSE.d.mts → transport-BFGblqwG.d.mts} +1 -1
  71. package/dist/{transport-COOs9GSE.d.mts.map → transport-BFGblqwG.d.mts.map} +1 -1
  72. package/dist/{transport-Bl8cTdYt.mjs → transport-yxiQsi8I.mjs} +1 -1
  73. package/dist/{transport-Bl8cTdYt.mjs.map → transport-yxiQsi8I.mjs.map} +1 -1
  74. package/dist/{types-CIsTnQvJ.d.mts → types-BbsYgi_R.d.mts} +1 -1
  75. package/dist/{types-CIsTnQvJ.d.mts.map → types-BbsYgi_R.d.mts.map} +1 -1
  76. package/dist/types-Bec-r_3_.mjs.map +1 -1
  77. package/dist/{types-BljtYPSd.d.mts → types-C1-PVaS_.d.mts} +14 -6
  78. package/dist/types-C1-PVaS_.d.mts.map +1 -0
  79. package/dist/{types-6dqxBqsH.d.mts → types-CaKte3hR.d.mts} +102 -4
  80. package/dist/types-CaKte3hR.d.mts.map +1 -0
  81. package/dist/{types-CcreFIIH.d.mts → types-DPfzHnjW.d.mts} +1 -1
  82. package/dist/{types-CcreFIIH.d.mts.map → types-DPfzHnjW.d.mts.map} +1 -1
  83. package/dist/{types-7-UjSEyB.d.mts → types-DRjfYOEv.d.mts} +1 -1
  84. package/dist/{types-7-UjSEyB.d.mts.map → types-DRjfYOEv.d.mts.map} +1 -1
  85. package/dist/{validate-CqRJb_xU.mjs → validate-VPnKoIzW.mjs} +11 -11
  86. package/dist/{validate-CqRJb_xU.mjs.map → validate-VPnKoIzW.mjs.map} +1 -1
  87. package/dist/{validate-B7KP7VLM.d.mts → validate-bfg9OR6N.d.mts} +4 -4
  88. package/dist/{validate-B7KP7VLM.d.mts.map → validate-bfg9OR6N.d.mts.map} +1 -1
  89. package/dist/version-REAapfsU.mjs +7 -0
  90. package/dist/version-REAapfsU.mjs.map +1 -0
  91. package/package.json +5 -5
  92. package/src/api/handlers/redirects.ts +95 -3
  93. package/src/api/schemas/redirects.ts +1 -0
  94. package/src/astro/integration/vite-config.ts +7 -4
  95. package/src/astro/routes/admin.astro +2 -2
  96. package/src/astro/routes/api/comments/[collection]/[contentId]/index.ts +2 -0
  97. package/src/astro/routes/api/import/wordpress/rewrite-urls.ts +2 -0
  98. package/src/astro/routes/api/manifest.ts +3 -1
  99. package/src/astro/storage/adapters.ts +19 -5
  100. package/src/astro/storage/types.ts +12 -4
  101. package/src/astro/types.ts +1 -0
  102. package/src/bylines/index.ts +2 -2
  103. package/src/database/dialect-helpers.ts +3 -0
  104. package/src/database/repositories/content.ts +5 -0
  105. package/src/database/repositories/redirect.ts +13 -0
  106. package/src/database/validate.ts +10 -10
  107. package/src/emdash-runtime.ts +5 -1
  108. package/src/index.ts +1 -0
  109. package/src/loader.ts +2 -0
  110. package/src/menus/index.ts +4 -0
  111. package/src/redirects/loops.ts +318 -0
  112. package/src/schema/registry.ts +3 -0
  113. package/src/search/fts-manager.ts +4 -0
  114. package/src/storage/s3.ts +94 -25
  115. package/src/storage/types.ts +13 -5
  116. package/src/utils/slugify.ts +11 -0
  117. package/src/version.ts +12 -0
  118. package/dist/content-BmXndhdi.mjs.map +0 -1
  119. package/dist/dialect-helpers-B9uSp2GJ.mjs.map +0 -1
  120. package/dist/index-UHEVQMus.d.mts.map +0 -1
  121. package/dist/loader-CHb2v0jm.mjs.map +0 -1
  122. package/dist/redirect-DIfIni3r.mjs.map +0 -1
  123. package/dist/registry-1EvbAfsC.mjs.map +0 -1
  124. package/dist/search-BsYMed12.mjs.map +0 -1
  125. package/dist/types-6dqxBqsH.d.mts.map +0 -1
  126. package/dist/types-BljtYPSd.d.mts.map +0 -1
@@ -1,26 +1,28 @@
1
1
  import "../connection-B4zVnQIa.mjs";
2
- import { a as isSqlite } from "../dialect-helpers-B9uSp2GJ.mjs";
3
- import { r as runMigrations } from "../runner-BoN0-FPi.mjs";
4
- import { $ as sanitizeHeadersForSandbox, At as handleContentGet, Bt as handleContentUnschedule, Ct as handleContentCompare, Dt as handleContentDelete, Et as handleContentCreate, Ft as handleContentPublish, G as DEV_CONSOLE_EMAIL_PLUGIN_ID, Ht as validateRev, It as handleContentRestore, K as devConsoleEmailDeliver, Lt as handleContentSchedule, Mt as handleContentList, Nt as handleContentListTrashed, Ot as handleContentDiscardDraft, Pt as handleContentPermanentDelete, Q as extractRequestMeta, Rt as handleContentTranslations, St as hashString, Tt as handleContentCountTrashed, Vt as handleContentUpdate, W as PluginRouteRegistry, X as resolveExclusiveHooks, Y as createHookPipeline, Z as CronExecutor, _t as handleRevisionGet, et as definePlugin, ft as handleMediaCreate, gt as handleMediaUpdate, ht as handleMediaList, jt as handleContentGetIncludingTrashed, kt as handleContentDuplicate, mt as handleMediaGet, pt as handleMediaDelete, q as EmailPipeline, st as loadBundleFromR2, ut as PluginStateRepository, vt as handleRevisionList, wt as handleContentCountScheduled, yt as handleRevisionRestore, zt as handleContentUnpublish } from "../search-BsYMed12.mjs";
5
- import { r as RevisionRepository } from "../content-BmXndhdi.mjs";
2
+ import { t as validateIdentifier } from "../validate-VPnKoIzW.mjs";
3
+ import { a as isSqlite } from "../dialect-helpers-DhTzaUxP.mjs";
4
+ import { r as runMigrations } from "../runner-Biufrii2.mjs";
5
+ import { $ as sanitizeHeadersForSandbox, At as handleContentGet, Bt as handleContentUnschedule, Ct as handleContentCompare, Dt as handleContentDelete, Et as handleContentCreate, Ft as handleContentPublish, G as DEV_CONSOLE_EMAIL_PLUGIN_ID, Ht as validateRev, It as handleContentRestore, K as devConsoleEmailDeliver, Lt as handleContentSchedule, Mt as handleContentList, Nt as handleContentListTrashed, Ot as handleContentDiscardDraft, Pt as handleContentPermanentDelete, Q as extractRequestMeta, Rt as handleContentTranslations, St as hashString, Tt as handleContentCountTrashed, Vt as handleContentUpdate, W as PluginRouteRegistry, X as resolveExclusiveHooks, Y as createHookPipeline, Z as CronExecutor, _t as handleRevisionGet, et as definePlugin, ft as handleMediaCreate, gt as handleMediaUpdate, ht as handleMediaList, jt as handleContentGetIncludingTrashed, kt as handleContentDuplicate, mt as handleMediaGet, pt as handleMediaDelete, q as EmailPipeline, st as loadBundleFromR2, ut as PluginStateRepository, vt as handleRevisionList, wt as handleContentCountScheduled, yt as handleRevisionRestore, zt as handleContentUnpublish } from "../search-BXB-jfu2.mjs";
6
+ import { r as RevisionRepository } from "../content-BsBoyj8G.mjs";
6
7
  import "../base64-MBPo9ozB.mjs";
7
8
  import "../types-CMMN0pNg.mjs";
8
9
  import { t as MediaRepository } from "../media-DqHVh136.mjs";
9
- import { f as OptionsRepository } from "../apply-wmVEOSbR.mjs";
10
- import { i as FTSManager, n as SchemaRegistry } from "../registry-1EvbAfsC.mjs";
11
- import "../redirect-DIfIni3r.mjs";
12
- import "../byline-1WQPlISL.mjs";
10
+ import { f as OptionsRepository } from "../apply-Bqoekfbe.mjs";
11
+ import { i as FTSManager, n as SchemaRegistry } from "../registry-DU18yVo0.mjs";
12
+ import "../redirect-DUAk-Yl_.mjs";
13
+ import "../byline-BGj9p9Ht.mjs";
13
14
  import { n as normalizeMediaValue } from "../placeholder-aiCD8aSZ.mjs";
14
15
  import { i as setI18nConfig } from "../config-Cq8H0SfX.mjs";
15
16
  import { getRequestContext, runWithContext } from "../request-context.mjs";
16
- import { n as getDb } from "../loader-CHb2v0jm.mjs";
17
+ import { n as getDb } from "../loader-BmYdf3Dr.mjs";
17
18
  import { r as normalizeManifestRoute } from "../manifest-schema-CuMio1A9.mjs";
18
- import "../query-5Hcv_5ER.mjs";
19
+ import "../query-sesiOndV.mjs";
19
20
  import "../tokens-DrB-W6Q-.mjs";
20
- import "../bylines-BYdTYmia.mjs";
21
+ import "../bylines-BihaoIDY.mjs";
21
22
  import "../load-Veizk2cT.mjs";
22
23
  import "../index.mjs";
23
- import { t as getAuthMode } from "../mode-CYeM2rPt.mjs";
24
+ import { n as VERSION, t as COMMIT } from "../version-REAapfsU.mjs";
25
+ import { t as getAuthMode } from "../mode-C2EzN1uE.mjs";
24
26
  import { Kysely, sql } from "kysely";
25
27
  import { defineMiddleware } from "astro:middleware";
26
28
  import virtualConfig from "virtual:emdash/config";
@@ -722,7 +724,7 @@ var EmDashRuntime = class EmDashRuntime {
722
724
  }
723
725
  })();
724
726
  if (collectionCount.count === 0 && !setupDone) {
725
- const { applySeed } = await import("../apply-wmVEOSbR.mjs").then((n) => n.n);
727
+ const { applySeed } = await import("../apply-Bqoekfbe.mjs").then((n) => n.n);
726
728
  const { loadSeed } = await import("../load-Veizk2cT.mjs").then((n) => n.r);
727
729
  const { validateSeed } = await import("../validate-CXnRKfJK.mjs").then((n) => n.n);
728
730
  const seed = await loadSeed();
@@ -971,7 +973,8 @@ var EmDashRuntime = class EmDashRuntime {
971
973
  locales: i18nConfig.locales
972
974
  } : void 0;
973
975
  return {
974
- version: "0.1.0",
976
+ version: VERSION,
977
+ commit: COMMIT,
975
978
  hash: manifestHash,
976
979
  collections: manifestCollections,
977
980
  plugins: manifestPlugins,
@@ -1010,7 +1013,7 @@ var EmDashRuntime = class EmDashRuntime {
1010
1013
  return result;
1011
1014
  }
1012
1015
  async handleContentUpdate(collection, id, body) {
1013
- const { ContentRepository } = await import("../content-BmXndhdi.mjs").then((n) => n.n);
1016
+ const { ContentRepository } = await import("../content-BsBoyj8G.mjs").then((n) => n.n);
1014
1017
  const repo = new ContentRepository(this.db);
1015
1018
  const resolvedItem = await repo.findByIdOrSlug(collection, id);
1016
1019
  const resolvedId = resolvedItem?.id ?? id;
@@ -1061,6 +1064,7 @@ var EmDashRuntime = class EmDashRuntime {
1061
1064
  data: mergedData,
1062
1065
  authorId: bodyWithoutRev.authorId ?? void 0
1063
1066
  });
1067
+ validateIdentifier(collection, "collection");
1064
1068
  const tableName = `ec_${collection}`;
1065
1069
  await sql`
1066
1070
  UPDATE ${sql.ref(tableName)}
@@ -1571,7 +1575,7 @@ const onRequest = defineMiddleware(async (context, next) => {
1571
1575
  if (!isEmDashRoute && !isPublicRuntimeRoute && !hasEditCookie && !hasPreviewToken) {
1572
1576
  if (!(context.isPrerendered ? null : await context.session?.get("user")) && !playgroundDb) {
1573
1577
  if (!setupVerified) try {
1574
- const { getDb } = await import("../loader-CHb2v0jm.mjs").then((n) => n.r);
1578
+ const { getDb } = await import("../loader-BmYdf3Dr.mjs").then((n) => n.r);
1575
1579
  await (await getDb()).selectFrom("_emdash_migrations").selectAll().limit(1).execute();
1576
1580
  setupVerified = true;
1577
1581
  } catch {