@acms-subir/core 0.3.10 → 0.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/cli/common.mjs +2 -2
  3. package/cli/legacy.mjs +2 -1
  4. package/cli/main.mjs +11 -3
  5. package/cli/migrate.mjs +102 -0
  6. package/cli/migrations.generated.mjs +1044 -0
  7. package/cli/preview.mjs +1 -1
  8. package/deploy/Dockerfile +5 -1
  9. package/deploy/compose.yml +21 -0
  10. package/docs/live-video.md +1 -1
  11. package/docs/theme-authoring.md +31 -0
  12. package/integration.mjs +39 -0
  13. package/migrate.mjs +5 -0
  14. package/package.json +9 -11
  15. package/src/actions/index.ts +5 -5
  16. package/src/components/DesignManager.tsx +29 -10
  17. package/src/components/EmailSettings.tsx +53 -11
  18. package/src/components/ThemeTransfer.tsx +211 -0
  19. package/src/components/auth/ClerkSession.astro +80 -0
  20. package/src/components/auth/ReverifyForms.astro +61 -0
  21. package/src/components/auth/clerk.ts +169 -0
  22. package/src/components/import/ImportExport.tsx +16 -6
  23. package/src/components/import/runner.ts +3 -0
  24. package/src/layouts/Admin.astro +40 -9
  25. package/src/layouts/Site.astro +6 -1
  26. package/src/lib/api.ts +6 -3
  27. package/src/lib/auth/accounts.ts +94 -0
  28. package/src/lib/auth/config.ts +22 -0
  29. package/src/lib/auth/login-limit.ts +15 -0
  30. package/src/lib/auth/request.ts +161 -0
  31. package/src/lib/auth/store.ts +72 -0
  32. package/src/lib/auth.ts +3 -0
  33. package/src/lib/backup/archive.ts +26 -0
  34. package/src/lib/backup/offsite.ts +173 -0
  35. package/src/lib/backup/store.ts +28 -0
  36. package/src/lib/cache/config.ts +7 -0
  37. package/src/lib/cache/memory.ts +39 -0
  38. package/src/lib/cache/policy.ts +89 -0
  39. package/src/lib/cache/purge.ts +89 -0
  40. package/src/lib/designPreview.ts +2 -2
  41. package/src/lib/dynamicBlocks.ts +1 -1
  42. package/src/lib/editor/auth.ts +35 -5
  43. package/src/lib/editor/http.ts +4 -1
  44. package/src/lib/editor/store.ts +13 -7
  45. package/src/lib/editor/token-route.ts +2 -1
  46. package/src/lib/email/accounts.ts +4 -0
  47. package/src/lib/email/service.ts +1 -0
  48. package/src/lib/email/templates.ts +2 -1
  49. package/src/lib/email/types.ts +1 -0
  50. package/src/lib/mobile/http.ts +4 -3
  51. package/src/lib/mobile/route.ts +41 -4
  52. package/src/lib/net.ts +82 -14
  53. package/src/lib/repo/migrate-runner.ts +96 -0
  54. package/src/lib/repo/migrations.ts +76 -0
  55. package/src/lib/repo/sql.ts +56 -24
  56. package/src/lib/repo/sqlite.ts +14 -1
  57. package/src/lib/repo/types.ts +12 -1
  58. package/src/lib/scheduler.ts +7 -0
  59. package/src/lib/theme-transfer.ts +163 -0
  60. package/src/lib/theme.ts +5 -0
  61. package/src/lib/webhooks.ts +7 -2
  62. package/src/middleware.ts +41 -11
  63. package/src/pages/[...slug].astro +3 -2
  64. package/src/pages/account/[action].astro +6 -0
  65. package/src/pages/admin/app-auth.astro +21 -7
  66. package/src/pages/admin/design.astro +2 -1
  67. package/src/pages/admin/import.astro +5 -3
  68. package/src/pages/admin/index.astro +3 -2
  69. package/src/pages/admin/integrations.astro +3 -2
  70. package/src/pages/admin/login.astro +236 -25
  71. package/src/pages/admin/logout.ts +16 -2
  72. package/src/pages/admin/settings.astro +31 -5
  73. package/src/pages/admin/users.astro +350 -59
  74. package/src/pages/api/backup.ts +10 -26
  75. package/src/pages/api/design/export.ts +72 -0
  76. package/src/pages/api/design/import.ts +41 -0
  77. package/src/pages/api/email/settings.ts +9 -5
  78. package/src/pages/api/live/oauth/youtube/callback.ts +5 -4
  79. package/src/pages/api/live/settings.ts +2 -2
  80. package/src/pages/api/media/upload.ts +2 -2
  81. package/src/pages/api/push/admin.ts +3 -2
  82. package/src/pages/api/restore.ts +6 -3
  83. package/src/pages/api/v1/calendars.ts +1 -1
  84. package/src/pages/api/v1/links.ts +1 -1
  85. package/src/pages/api/v1/openapi.json.ts +1 -1
  86. package/src/pages/api/v1/push/topics.ts +1 -1
  87. package/src/pages/api/v1/resources.ts +1 -1
  88. package/src/pages/api/v1/theme.ts +1 -1
  89. package/src/pages/blog/[slug].astro +3 -2
  90. package/src/pages/events/[slug].astro +3 -2
  91. package/src/pages/preview/[type]/[id].astro +3 -3
  92. package/src/styles/admin.css +103 -16
  93. package/src/styles/email-settings.css +6 -0
  94. package/src/theme-sdk/calendar.ts +48 -0
  95. package/src/theme-sdk/index.ts +2 -0
  96. package/src/virtual.d.ts +1 -0
  97. package/src/worker.ts +7 -1
@@ -1,5 +1,7 @@
1
1
  export { ThemeTokens, ThemeManifest, PostOptions, SectionDefinition, SectionInstance, SectionLayout, SectionPages, PagePreset, BUILTIN_SECTIONS, sectionDefinitions, sectionIssues, THEME_API_VERSION } from './contract.mjs';
2
2
  export { formatTime, formatDay } from './fields.mjs';
3
+ export { upcomingEvents, calendarConfig, eventUrl } from './calendar';
4
+ export type { UpcomingEventsOptions, UpcomingEvent, ThemeCalendarConfig } from './calendar';
3
5
  export { CONTENT, postsIndexUrl, postUrl, tagUrl, collectionUrl } from '../lib/content';
4
6
  export { formatDate } from '../lib/dates';
5
7
  export type { Page, Post, Settings, Tag, CalEvent, Calendar, User } from '../lib/schema';
package/src/virtual.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  declare module 'virtual:acms-config' {
4
4
  export const userConfig: {
5
5
  coreVersion: string;
6
+ auth?: { provider: 'builtin' | 'clerk' };
6
7
  brand: { name?: string; version?: string; stack?: string };
7
8
  seed: { siteTitle?: string; tagline?: string; heroHeading?: string; heroSub?: string };
8
9
  // resolved (defaults applied + validated) by integration.mjs; `posts`
package/src/worker.ts CHANGED
@@ -3,6 +3,7 @@ import { App } from 'astro/app';
3
3
  import { handle } from '@astrojs/cloudflare/handler';
4
4
  import { D1Repository, type D1Database } from './lib/repo/d1';
5
5
  import { runScheduledTasks } from './lib/scheduler';
6
+ import { EXECUTION_CONTEXT } from './lib/cache/purge';
6
7
 
7
8
  // Custom Workers entrypoint (wired via the adapter's workerEntryPoint
8
9
  // option): identical fetch behavior to the stock entry, plus a cron-driven
@@ -19,11 +20,16 @@ export function createExports(manifest: SSRManifest) {
19
20
  return {
20
21
  default: {
21
22
  async fetch(request: HandleRequest, env: HandleEnv, context: HandleContext) {
23
+ // the adapter's locals.runtime.ctx has no `cache`; the middleware
24
+ // reads Workers Cache from here (lib/cache/purge.ts)
25
+ Reflect.set(request, EXECUTION_CONTEXT, context);
22
26
  return handle(manifest, app, request, env, context);
23
27
  },
24
28
  async scheduled(_controller: unknown, env: HandleEnv, context: HandleContext) {
25
29
  const repo = new D1Repository(env.DB as D1Database);
26
- context.waitUntil(runScheduledTasks(repo, { runtime: { env } }).then(report => {
30
+ // ctx carries Workers Cache (ctx.cache) for the purge job; `scheduled`
31
+ // tells it a missing ctx.cache here doesn't mean caching is off
32
+ context.waitUntil(runScheduledTasks(repo, { runtime: { env, ctx: context, scheduled: true } }).then(report => {
27
33
  if (!report.ok) throw new Error('Scheduled maintenance failed; see authenticated operations status.');
28
34
  }));
29
35
  },