@ekrist1/vulse 0.1.6-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +104 -0
- package/dist/admin/client/active-locale.d.ts +3 -0
- package/dist/admin/client/active-locale.d.ts.map +1 -0
- package/dist/admin/client/active-locale.js +14 -0
- package/dist/admin/client/api.d.ts +14 -0
- package/dist/admin/client/api.d.ts.map +1 -0
- package/dist/admin/client/api.js +26 -0
- package/dist/admin/client/form-from-zod.d.ts +2 -0
- package/dist/admin/client/form-from-zod.d.ts.map +1 -0
- package/dist/admin/client/form-from-zod.js +1 -0
- package/dist/admin/client/live-preview-enabled.d.ts +3 -0
- package/dist/admin/client/live-preview-enabled.d.ts.map +1 -0
- package/dist/admin/client/live-preview-enabled.js +6 -0
- package/dist/cli/collection-scaffold.d.ts +14 -0
- package/dist/cli/collection-scaffold.d.ts.map +1 -0
- package/dist/cli/collection-scaffold.js +44 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +74 -0
- package/dist/cli/migrate.d.ts +5 -0
- package/dist/cli/migrate.d.ts.map +1 -0
- package/dist/cli/migrate.js +10 -0
- package/dist/cli/platform.d.ts +12 -0
- package/dist/cli/platform.d.ts.map +1 -0
- package/dist/cli/platform.js +38 -0
- package/dist/cli/seed-admin.d.ts +19 -0
- package/dist/cli/seed-admin.d.ts.map +1 -0
- package/dist/cli/seed-admin.js +59 -0
- package/dist/cli/setup.d.ts +29 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +254 -0
- package/dist/core/access.d.ts +5 -0
- package/dist/core/access.d.ts.map +1 -0
- package/dist/core/access.js +6 -0
- package/dist/core/blocks/schema.d.ts +81 -0
- package/dist/core/blocks/schema.d.ts.map +1 -0
- package/dist/core/blocks/schema.js +54 -0
- package/dist/core/blueprints/code-to-definition.d.ts +6 -0
- package/dist/core/blueprints/code-to-definition.d.ts.map +1 -0
- package/dist/core/blueprints/code-to-definition.js +147 -0
- package/dist/core/blueprints/compile.d.ts +10 -0
- package/dist/core/blueprints/compile.d.ts.map +1 -0
- package/dist/core/blueprints/compile.js +153 -0
- package/dist/core/blueprints/define.d.ts +6 -0
- package/dist/core/blueprints/define.d.ts.map +1 -0
- package/dist/core/blueprints/define.js +8 -0
- package/dist/core/blueprints/definition.d.ts +963 -0
- package/dist/core/blueprints/definition.d.ts.map +1 -0
- package/dist/core/blueprints/definition.js +151 -0
- package/dist/core/blueprints/load.d.ts +11 -0
- package/dist/core/blueprints/load.d.ts.map +1 -0
- package/dist/core/blueprints/load.js +137 -0
- package/dist/core/blueprints/mutations.d.ts +8 -0
- package/dist/core/blueprints/mutations.d.ts.map +1 -0
- package/dist/core/blueprints/mutations.js +191 -0
- package/dist/core/blueprints/preview-path.d.ts +15 -0
- package/dist/core/blueprints/preview-path.d.ts.map +1 -0
- package/dist/core/blueprints/preview-path.js +25 -0
- package/dist/core/blueprints/reflect-fields.d.ts +36 -0
- package/dist/core/blueprints/reflect-fields.d.ts.map +1 -0
- package/dist/core/blueprints/reflect-fields.js +229 -0
- package/dist/core/blueprints/registry.d.ts +9 -0
- package/dist/core/blueprints/registry.d.ts.map +1 -0
- package/dist/core/blueprints/registry.js +11 -0
- package/dist/core/blueprints/seed.d.ts +5 -0
- package/dist/core/blueprints/seed.d.ts.map +1 -0
- package/dist/core/blueprints/seed.js +17 -0
- package/dist/core/blueprints/select-helpers.d.ts +10 -0
- package/dist/core/blueprints/select-helpers.d.ts.map +1 -0
- package/dist/core/blueprints/select-helpers.js +26 -0
- package/dist/core/blueprints/seo.d.ts +41 -0
- package/dist/core/blueprints/seo.d.ts.map +1 -0
- package/dist/core/blueprints/seo.js +125 -0
- package/dist/core/blueprints/types.d.ts +60 -0
- package/dist/core/blueprints/types.d.ts.map +1 -0
- package/dist/core/blueprints/types.js +1 -0
- package/dist/core/blueprints/zod-helpers.d.ts +79 -0
- package/dist/core/blueprints/zod-helpers.d.ts.map +1 -0
- package/dist/core/blueprints/zod-helpers.js +72 -0
- package/dist/core/db.d.ts +7 -0
- package/dist/core/db.d.ts.map +1 -0
- package/dist/core/db.js +8 -0
- package/dist/core/errors.d.ts +21 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +29 -0
- package/dist/core/forms/compile.d.ts +9 -0
- package/dist/core/forms/compile.d.ts.map +1 -0
- package/dist/core/forms/compile.js +80 -0
- package/dist/core/forms/definition.d.ts +226 -0
- package/dist/core/forms/definition.d.ts.map +1 -0
- package/dist/core/forms/definition.js +83 -0
- package/dist/core/forms/rate-limit.d.ts +10 -0
- package/dist/core/forms/rate-limit.d.ts.map +1 -0
- package/dist/core/forms/rate-limit.js +31 -0
- package/dist/core/forms/unique.d.ts +5 -0
- package/dist/core/forms/unique.d.ts.map +1 -0
- package/dist/core/forms/unique.js +30 -0
- package/dist/core/globals/compile.d.ts +13 -0
- package/dist/core/globals/compile.d.ts.map +1 -0
- package/dist/core/globals/compile.js +17 -0
- package/dist/core/globals/definition.d.ts +161 -0
- package/dist/core/globals/definition.d.ts.map +1 -0
- package/dist/core/globals/definition.js +23 -0
- package/dist/core/locales.d.ts +14 -0
- package/dist/core/locales.d.ts.map +1 -0
- package/dist/core/locales.js +35 -0
- package/dist/core/migrations.d.ts +3 -0
- package/dist/core/migrations.d.ts.map +1 -0
- package/dist/core/migrations.js +41 -0
- package/dist/core/parse-content.d.ts +14 -0
- package/dist/core/parse-content.d.ts.map +1 -0
- package/dist/core/parse-content.js +68 -0
- package/dist/core/plugins/definition.d.ts +99 -0
- package/dist/core/plugins/definition.d.ts.map +1 -0
- package/dist/core/plugins/definition.js +10 -0
- package/dist/core/preview-content.d.ts +16 -0
- package/dist/core/preview-content.d.ts.map +1 -0
- package/dist/core/preview-content.js +8 -0
- package/dist/core/repos/entries.d.ts +102 -0
- package/dist/core/repos/entries.d.ts.map +1 -0
- package/dist/core/repos/entries.js +393 -0
- package/dist/core/repos/forms.d.ts +82 -0
- package/dist/core/repos/forms.d.ts.map +1 -0
- package/dist/core/repos/forms.js +199 -0
- package/dist/core/repos/globals.d.ts +31 -0
- package/dist/core/repos/globals.d.ts.map +1 -0
- package/dist/core/repos/globals.js +150 -0
- package/dist/core/repos/media.d.ts +39 -0
- package/dist/core/repos/media.d.ts.map +1 -0
- package/dist/core/repos/media.js +81 -0
- package/dist/core/repos/preview-sessions.d.ts +35 -0
- package/dist/core/repos/preview-sessions.d.ts.map +1 -0
- package/dist/core/repos/preview-sessions.js +85 -0
- package/dist/core/repos/revisions.d.ts +24 -0
- package/dist/core/repos/revisions.d.ts.map +1 -0
- package/dist/core/repos/revisions.js +44 -0
- package/dist/core/repos/settings.d.ts +9 -0
- package/dist/core/repos/settings.d.ts.map +1 -0
- package/dist/core/repos/settings.js +21 -0
- package/dist/core/schema.d.ts +2717 -0
- package/dist/core/schema.d.ts.map +1 -0
- package/dist/core/schema.js +220 -0
- package/dist/core/sets/compile.d.ts +8 -0
- package/dist/core/sets/compile.d.ts.map +1 -0
- package/dist/core/sets/compile.js +4 -0
- package/dist/core/sets/definition.d.ts +53 -0
- package/dist/core/sets/definition.d.ts.map +1 -0
- package/dist/core/sets/definition.js +7 -0
- package/dist/core/sets/service.d.ts +13 -0
- package/dist/core/sets/service.d.ts.map +1 -0
- package/dist/core/sets/service.js +68 -0
- package/dist/core/sets/validate-tree.d.ts +4 -0
- package/dist/core/sets/validate-tree.d.ts.map +1 -0
- package/dist/core/sets/validate-tree.js +40 -0
- package/dist/core/slug.d.ts +5 -0
- package/dist/core/slug.d.ts.map +1 -0
- package/dist/core/slug.js +25 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/integration/cron.d.ts +4 -0
- package/dist/integration/cron.d.ts.map +1 -0
- package/dist/integration/cron.js +2 -0
- package/dist/integration/index.d.ts +9 -0
- package/dist/integration/index.d.ts.map +1 -0
- package/dist/integration/index.js +63 -0
- package/dist/integration/inject-admin-routes.d.ts +12 -0
- package/dist/integration/inject-admin-routes.d.ts.map +1 -0
- package/dist/integration/inject-admin-routes.js +35 -0
- package/dist/integration/inject-routes.d.ts +11 -0
- package/dist/integration/inject-routes.d.ts.map +1 -0
- package/dist/integration/inject-routes.js +51 -0
- package/dist/integration/install-hook.d.ts +2 -0
- package/dist/integration/install-hook.d.ts.map +1 -0
- package/dist/integration/install-hook.js +74 -0
- package/dist/integration/live-preview-middleware-helpers.d.ts +29 -0
- package/dist/integration/live-preview-middleware-helpers.d.ts.map +1 -0
- package/dist/integration/live-preview-middleware-helpers.js +75 -0
- package/dist/integration/loader-binding.d.ts +6 -0
- package/dist/integration/loader-binding.d.ts.map +1 -0
- package/dist/integration/loader-binding.js +15 -0
- package/dist/integration/middleware.d.ts +2 -0
- package/dist/integration/middleware.d.ts.map +1 -0
- package/dist/integration/middleware.js +51 -0
- package/dist/integration/type-gen.d.ts +2 -0
- package/dist/integration/type-gen.d.ts.map +1 -0
- package/dist/integration/type-gen.js +26 -0
- package/dist/integration/vite-plugin-blueprints.d.ts +3 -0
- package/dist/integration/vite-plugin-blueprints.d.ts.map +1 -0
- package/dist/integration/vite-plugin-blueprints.js +33 -0
- package/dist/integration/wrangler-patch.d.ts +6 -0
- package/dist/integration/wrangler-patch.d.ts.map +1 -0
- package/dist/integration/wrangler-patch.js +18 -0
- package/dist/integration.d.ts +3 -0
- package/dist/integration.d.ts.map +1 -0
- package/dist/integration.js +1 -0
- package/dist/loader.d.ts +3 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +1 -0
- package/dist/package-name.d.ts +3 -0
- package/dist/package-name.d.ts.map +1 -0
- package/dist/package-name.js +2 -0
- package/dist/scaffold/collection-write.d.ts +14 -0
- package/dist/scaffold/collection-write.d.ts.map +1 -0
- package/dist/scaffold/collection-write.js +59 -0
- package/dist/scaffold/collection.d.ts +36 -0
- package/dist/scaffold/collection.d.ts.map +1 -0
- package/dist/scaffold/collection.js +231 -0
- package/dist/server/assets/live-preview-bridge.content.d.ts +2 -0
- package/dist/server/assets/live-preview-bridge.content.d.ts.map +1 -0
- package/dist/server/assets/live-preview-bridge.content.js +2 -0
- package/dist/server/better-auth.d.ts +71 -0
- package/dist/server/better-auth.d.ts.map +1 -0
- package/dist/server/better-auth.js +68 -0
- package/dist/server/cf-images.d.ts +12 -0
- package/dist/server/cf-images.d.ts.map +1 -0
- package/dist/server/cf-images.js +27 -0
- package/dist/server/cron.d.ts +9 -0
- package/dist/server/cron.d.ts.map +1 -0
- package/dist/server/cron.js +26 -0
- package/dist/server/email.d.ts +10 -0
- package/dist/server/email.d.ts.map +1 -0
- package/dist/server/email.js +9 -0
- package/dist/server/endpoints/api-auth.d.ts +5 -0
- package/dist/server/endpoints/api-auth.d.ts.map +1 -0
- package/dist/server/endpoints/api-auth.js +7 -0
- package/dist/server/endpoints/api-vulse-blueprints.d.ts +6 -0
- package/dist/server/endpoints/api-vulse-blueprints.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-blueprints.js +19 -0
- package/dist/server/endpoints/api-vulse-entries-locales.d.ts +4 -0
- package/dist/server/endpoints/api-vulse-entries-locales.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-entries-locales.js +9 -0
- package/dist/server/endpoints/api-vulse-entries-move.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-entries-move.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-entries-move.js +5 -0
- package/dist/server/endpoints/api-vulse-entries-publish.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-entries-publish.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-entries-publish.js +5 -0
- package/dist/server/endpoints/api-vulse-entries-tree.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-entries-tree.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-entries-tree.js +5 -0
- package/dist/server/endpoints/api-vulse-entries.d.ts +6 -0
- package/dist/server/endpoints/api-vulse-entries.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-entries.js +19 -0
- package/dist/server/endpoints/api-vulse-form-handle.d.ts +6 -0
- package/dist/server/endpoints/api-vulse-form-handle.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-form-handle.js +27 -0
- package/dist/server/endpoints/api-vulse-form-public.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-form-public.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-form-public.js +5 -0
- package/dist/server/endpoints/api-vulse-form-submit.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-form-submit.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-form-submit.js +5 -0
- package/dist/server/endpoints/api-vulse-form-upload.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-form-upload.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-form-upload.js +5 -0
- package/dist/server/endpoints/api-vulse-forms.d.ts +4 -0
- package/dist/server/endpoints/api-vulse-forms.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-forms.js +9 -0
- package/dist/server/endpoints/api-vulse-globals-handle.d.ts +5 -0
- package/dist/server/endpoints/api-vulse-globals-handle.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-globals-handle.js +19 -0
- package/dist/server/endpoints/api-vulse-globals-public-handle.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-globals-public-handle.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-globals-public-handle.js +5 -0
- package/dist/server/endpoints/api-vulse-globals-public.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-globals-public.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-globals-public.js +5 -0
- package/dist/server/endpoints/api-vulse-globals-value.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-globals-value.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-globals-value.js +7 -0
- package/dist/server/endpoints/api-vulse-globals.d.ts +4 -0
- package/dist/server/endpoints/api-vulse-globals.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-globals.js +9 -0
- package/dist/server/endpoints/api-vulse-media-file.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-media-file.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-media-file.js +5 -0
- package/dist/server/endpoints/api-vulse-media-id.d.ts +4 -0
- package/dist/server/endpoints/api-vulse-media-id.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-media-id.js +9 -0
- package/dist/server/endpoints/api-vulse-media.d.ts +4 -0
- package/dist/server/endpoints/api-vulse-media.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-media.js +9 -0
- package/dist/server/endpoints/api-vulse-preview-bridge.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-preview-bridge.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-preview-bridge.js +9 -0
- package/dist/server/endpoints/api-vulse-preview-sessions-id.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-preview-sessions-id.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-preview-sessions-id.js +10 -0
- package/dist/server/endpoints/api-vulse-preview-sessions.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-preview-sessions.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-preview-sessions.js +5 -0
- package/dist/server/endpoints/api-vulse-preview-start.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-preview-start.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-preview-start.js +5 -0
- package/dist/server/endpoints/api-vulse-preview-stop.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-preview-stop.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-preview-stop.js +5 -0
- package/dist/server/endpoints/api-vulse-revisions-restore.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-revisions-restore.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-revisions-restore.js +5 -0
- package/dist/server/endpoints/api-vulse-revisions.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-revisions.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-revisions.js +5 -0
- package/dist/server/endpoints/api-vulse-search.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-search.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-search.js +5 -0
- package/dist/server/endpoints/api-vulse-sets.d.ts +6 -0
- package/dist/server/endpoints/api-vulse-sets.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-sets.js +19 -0
- package/dist/server/endpoints/api-vulse-settings.d.ts +4 -0
- package/dist/server/endpoints/api-vulse-settings.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-settings.js +9 -0
- package/dist/server/endpoints/api-vulse-users-id.d.ts +4 -0
- package/dist/server/endpoints/api-vulse-users-id.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-users-id.js +9 -0
- package/dist/server/endpoints/api-vulse-users-reset-password.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-users-reset-password.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-users-reset-password.js +5 -0
- package/dist/server/endpoints/api-vulse-users-role.d.ts +4 -0
- package/dist/server/endpoints/api-vulse-users-role.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-users-role.js +6 -0
- package/dist/server/endpoints/api-vulse-users.d.ts +3 -0
- package/dist/server/endpoints/api-vulse-users.d.ts.map +1 -0
- package/dist/server/endpoints/api-vulse-users.js +5 -0
- package/dist/server/endpoints/with-runtime.d.ts +2 -0
- package/dist/server/endpoints/with-runtime.d.ts.map +1 -0
- package/dist/server/endpoints/with-runtime.js +10 -0
- package/dist/server/env.d.ts +16 -0
- package/dist/server/env.d.ts.map +1 -0
- package/dist/server/env.js +9 -0
- package/dist/server/envelope.d.ts +15 -0
- package/dist/server/envelope.d.ts.map +1 -0
- package/dist/server/envelope.js +16 -0
- package/dist/server/forms/email.d.ts +8 -0
- package/dist/server/forms/email.d.ts.map +1 -0
- package/dist/server/forms/email.js +6 -0
- package/dist/server/forms/process-submission.d.ts +8 -0
- package/dist/server/forms/process-submission.d.ts.map +1 -0
- package/dist/server/forms/process-submission.js +75 -0
- package/dist/server/forms/queue.d.ts +8 -0
- package/dist/server/forms/queue.d.ts.map +1 -0
- package/dist/server/forms/queue.js +17 -0
- package/dist/server/forms/templates.d.ts +9 -0
- package/dist/server/forms/templates.d.ts.map +1 -0
- package/dist/server/forms/templates.js +14 -0
- package/dist/server/forms/webhook.d.ts +2 -0
- package/dist/server/forms/webhook.d.ts.map +1 -0
- package/dist/server/forms/webhook.js +17 -0
- package/dist/server/handler.d.ts +17 -0
- package/dist/server/handler.d.ts.map +1 -0
- package/dist/server/handler.js +45 -0
- package/dist/server/image-probe.d.ts +6 -0
- package/dist/server/image-probe.d.ts.map +1 -0
- package/dist/server/image-probe.js +38 -0
- package/dist/server/loader.d.ts +10 -0
- package/dist/server/loader.d.ts.map +1 -0
- package/dist/server/loader.js +42 -0
- package/dist/server/plugins.d.ts +17 -0
- package/dist/server/plugins.d.ts.map +1 -0
- package/dist/server/plugins.js +134 -0
- package/dist/server/preview.d.ts +7 -0
- package/dist/server/preview.d.ts.map +1 -0
- package/dist/server/preview.js +22 -0
- package/dist/server/r2.d.ts +8 -0
- package/dist/server/r2.d.ts.map +1 -0
- package/dist/server/r2.js +9 -0
- package/dist/server/routes/blueprints.d.ts +10 -0
- package/dist/server/routes/blueprints.d.ts.map +1 -0
- package/dist/server/routes/blueprints.js +46 -0
- package/dist/server/routes/entries.d.ts +16 -0
- package/dist/server/routes/entries.d.ts.map +1 -0
- package/dist/server/routes/entries.js +262 -0
- package/dist/server/routes/form-submit.d.ts +10 -0
- package/dist/server/routes/form-submit.d.ts.map +1 -0
- package/dist/server/routes/form-submit.js +155 -0
- package/dist/server/routes/form-upload.d.ts +11 -0
- package/dist/server/routes/form-upload.d.ts.map +1 -0
- package/dist/server/routes/form-upload.js +87 -0
- package/dist/server/routes/forms.d.ts +14 -0
- package/dist/server/routes/forms.d.ts.map +1 -0
- package/dist/server/routes/forms.js +78 -0
- package/dist/server/routes/globals-public.d.ts +6 -0
- package/dist/server/routes/globals-public.d.ts.map +1 -0
- package/dist/server/routes/globals-public.js +30 -0
- package/dist/server/routes/globals.d.ts +11 -0
- package/dist/server/routes/globals.d.ts.map +1 -0
- package/dist/server/routes/globals.js +84 -0
- package/dist/server/routes/media.d.ts +23 -0
- package/dist/server/routes/media.d.ts.map +1 -0
- package/dist/server/routes/media.js +129 -0
- package/dist/server/routes/preview-sessions.d.ts +9 -0
- package/dist/server/routes/preview-sessions.d.ts.map +1 -0
- package/dist/server/routes/preview-sessions.js +74 -0
- package/dist/server/routes/preview.d.ts +6 -0
- package/dist/server/routes/preview.d.ts.map +1 -0
- package/dist/server/routes/preview.js +37 -0
- package/dist/server/routes/revisions.d.ts +7 -0
- package/dist/server/routes/revisions.d.ts.map +1 -0
- package/dist/server/routes/revisions.js +26 -0
- package/dist/server/routes/search.d.ts +6 -0
- package/dist/server/routes/search.d.ts.map +1 -0
- package/dist/server/routes/search.js +28 -0
- package/dist/server/routes/sets.d.ts +10 -0
- package/dist/server/routes/sets.d.ts.map +1 -0
- package/dist/server/routes/sets.js +33 -0
- package/dist/server/routes/settings.d.ts +7 -0
- package/dist/server/routes/settings.d.ts.map +1 -0
- package/dist/server/routes/settings.js +21 -0
- package/dist/server/routes/users.d.ts +10 -0
- package/dist/server/routes/users.d.ts.map +1 -0
- package/dist/server/routes/users.js +113 -0
- package/dist/server/runtime.d.ts +49 -0
- package/dist/server/runtime.d.ts.map +1 -0
- package/dist/server/runtime.js +69 -0
- package/dist/server/sdk/collections.d.ts +25 -0
- package/dist/server/sdk/collections.d.ts.map +1 -0
- package/dist/server/sdk/collections.js +76 -0
- package/dist/server/sdk/index.d.ts +45 -0
- package/dist/server/sdk/index.d.ts.map +1 -0
- package/dist/server/sdk/index.js +13 -0
- package/dist/server/sdk/media.d.ts +7 -0
- package/dist/server/sdk/media.d.ts.map +1 -0
- package/dist/server/sdk/media.js +9 -0
- package/dist/server/sdk/search.d.ts +19 -0
- package/dist/server/sdk/search.d.ts.map +1 -0
- package/dist/server/sdk/search.js +58 -0
- package/dist/server.d.ts +8 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +6 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/migrations/0000_init.sql +114 -0
- package/migrations/0001_collections_sets.sql +21 -0
- package/migrations/0003_fts.sql +22 -0
- package/migrations/0004_forms.sql +58 -0
- package/migrations/0005_globals.sql +16 -0
- package/migrations/0006_preview_sessions.sql +16 -0
- package/migrations/meta/0000_snapshot.json +672 -0
- package/migrations/meta/_journal.json +13 -0
- package/package.json +130 -0
- package/src/client/BlockRenderer.astro +40 -0
- package/src/client/BlockRenderer.vue +42 -0
- package/src/client/Node.vue +21 -0
- package/src/client/ProseMirrorRenderer.vue +31 -0
- package/src/client/auth.ts +28 -0
- package/src/client/blocks/Blockquote.vue +12 -0
- package/src/client/blocks/BulletList.vue +12 -0
- package/src/client/blocks/CodeBlock.vue +12 -0
- package/src/client/blocks/Emoji.vue +14 -0
- package/src/client/blocks/HardBreak.vue +1 -0
- package/src/client/blocks/Heading.vue +17 -0
- package/src/client/blocks/ListItem.vue +12 -0
- package/src/client/blocks/OrderedList.vue +12 -0
- package/src/client/blocks/Paragraph.vue +12 -0
- package/src/client/blocks/Text.vue +33 -0
- package/src/client/blocks/VulseAccordion.vue +16 -0
- package/src/client/blocks/VulseAccordionGroup.vue +12 -0
- package/src/client/blocks/VulseCallout.vue +14 -0
- package/src/client/blocks/VulseIframe.vue +65 -0
- package/src/client/blocks/VulseImage.vue +30 -0
- package/src/client/blocks/VulseSet.vue +26 -0
- package/src/client/blocks/VulseVideo.vue +18 -0
- package/src/client/components/ForgotPasswordForm.astro +71 -0
- package/src/client/components/FormRenderer.astro +40 -0
- package/src/client/components/ResetPasswordForm.astro +72 -0
- package/src/client/components/SessionGuard.astro +27 -0
- package/src/client/components/SignInForm.astro +57 -0
- package/src/client/components/SignOutButton.astro +22 -0
- package/src/client/components/SignUpForm.astro +61 -0
- package/src/client/components/VulseImage.vue +25 -0
- package/src/client/embed.ts +52 -0
- package/src/client/index.ts +2 -0
- package/src/client/inject.ts +4 -0
- package/src/client/live-preview-bridge.ts +20 -0
- package/src/client/pm-defaults.ts +38 -0
- package/src/client/pm-types.ts +21 -0
- package/src/client/render-pm-html.ts +154 -0
- package/src/client/url.ts +35 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { VulseDb } from '../db.js';
|
|
2
|
+
import { type GlobalSetDefinition } from '../globals/definition.js';
|
|
3
|
+
export interface GlobalSetRow {
|
|
4
|
+
handle: string;
|
|
5
|
+
label: string;
|
|
6
|
+
definition: GlobalSetDefinition;
|
|
7
|
+
blueprintHash: string;
|
|
8
|
+
createdAt: Date;
|
|
9
|
+
updatedAt: Date;
|
|
10
|
+
}
|
|
11
|
+
export interface GlobalValueRow {
|
|
12
|
+
handle: string;
|
|
13
|
+
content: Record<string, unknown>;
|
|
14
|
+
createdAt: Date;
|
|
15
|
+
updatedAt: Date;
|
|
16
|
+
}
|
|
17
|
+
export type PublicGlobals = Record<string, Record<string, unknown>>;
|
|
18
|
+
export declare class GlobalsRepo {
|
|
19
|
+
private db;
|
|
20
|
+
constructor(db: VulseDb);
|
|
21
|
+
listSets(): Promise<GlobalSetRow[]>;
|
|
22
|
+
findSetByHandle(handle: string): Promise<GlobalSetRow | null>;
|
|
23
|
+
createSet(input: GlobalSetDefinition): Promise<GlobalSetRow>;
|
|
24
|
+
updateSet(handle: string, input: GlobalSetDefinition): Promise<GlobalSetRow>;
|
|
25
|
+
deleteSet(handle: string): Promise<void>;
|
|
26
|
+
getValue(handle: string): Promise<GlobalValueRow | null>;
|
|
27
|
+
updateValue(handle: string, input: unknown): Promise<GlobalValueRow>;
|
|
28
|
+
publicValues(): Promise<PublicGlobals>;
|
|
29
|
+
publicValue(handle: string): Promise<Record<string, unknown> | null>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=globals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../../src/core/repos/globals.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAIvC,OAAO,EACL,KAAK,mBAAmB,EAGzB,MAAM,0BAA0B,CAAA;AAGjC,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,mBAAmB,CAAA;IAC/B,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,IAAI,CAAA;IACf,SAAS,EAAE,IAAI,CAAA;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,SAAS,EAAE,IAAI,CAAA;IACf,SAAS,EAAE,IAAI,CAAA;CAChB;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;AAsBnE,qBAAa,WAAW;IACV,OAAO,CAAC,EAAE;gBAAF,EAAE,EAAE,OAAO;IAEzB,QAAQ,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAKnC,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAK7D,SAAS,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC;IA6B5D,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC;IAsB5E,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAOxD,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC;IA4BpE,YAAY,IAAI,OAAO,CAAC,aAAa,CAAC;IAiBtC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAM3E"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { eq } from 'drizzle-orm';
|
|
2
|
+
import { vulseGlobalSets, vulseGlobalValues } from '../schema.js';
|
|
3
|
+
import { ConflictError, NotFoundError, ValidationError } from '../errors.js';
|
|
4
|
+
import { loadCompiledSets } from '../sets/service.js';
|
|
5
|
+
import { GlobalSetDefinitionSchema, hashGlobalSetDefinition, } from '../globals/definition.js';
|
|
6
|
+
import { compileGlobalSet } from '../globals/compile.js';
|
|
7
|
+
function parseSetRow(row) {
|
|
8
|
+
return {
|
|
9
|
+
handle: row.handle,
|
|
10
|
+
label: row.label,
|
|
11
|
+
definition: GlobalSetDefinitionSchema.parse(row.definition),
|
|
12
|
+
blueprintHash: row.blueprintHash,
|
|
13
|
+
createdAt: row.createdAt,
|
|
14
|
+
updatedAt: row.updatedAt,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function parseValueRow(row) {
|
|
18
|
+
return {
|
|
19
|
+
handle: row.handle,
|
|
20
|
+
content: (row.content ?? {}),
|
|
21
|
+
createdAt: row.createdAt,
|
|
22
|
+
updatedAt: row.updatedAt,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export class GlobalsRepo {
|
|
26
|
+
db;
|
|
27
|
+
constructor(db) {
|
|
28
|
+
this.db = db;
|
|
29
|
+
}
|
|
30
|
+
async listSets() {
|
|
31
|
+
const rows = await this.db.select().from(vulseGlobalSets).orderBy(vulseGlobalSets.createdAt);
|
|
32
|
+
return rows.map(parseSetRow);
|
|
33
|
+
}
|
|
34
|
+
async findSetByHandle(handle) {
|
|
35
|
+
const row = await this.db.select().from(vulseGlobalSets).where(eq(vulseGlobalSets.handle, handle)).get();
|
|
36
|
+
return row ? parseSetRow(row) : null;
|
|
37
|
+
}
|
|
38
|
+
async createSet(input) {
|
|
39
|
+
const parsed = GlobalSetDefinitionSchema.safeParse(input);
|
|
40
|
+
if (!parsed.success)
|
|
41
|
+
throw new ValidationError('Invalid global set', { issues: parsed.error.issues });
|
|
42
|
+
const def = parsed.data;
|
|
43
|
+
const existing = await this.findSetByHandle(def.handle);
|
|
44
|
+
if (existing)
|
|
45
|
+
throw new ConflictError(`global set already exists: ${def.handle}`);
|
|
46
|
+
const now = new Date();
|
|
47
|
+
const hash = hashGlobalSetDefinition(def);
|
|
48
|
+
await this.db.insert(vulseGlobalSets).values({
|
|
49
|
+
handle: def.handle,
|
|
50
|
+
label: def.label,
|
|
51
|
+
definition: def,
|
|
52
|
+
blueprintHash: hash,
|
|
53
|
+
createdAt: now,
|
|
54
|
+
updatedAt: now,
|
|
55
|
+
});
|
|
56
|
+
await this.db.insert(vulseGlobalValues).values({
|
|
57
|
+
handle: def.handle,
|
|
58
|
+
content: {},
|
|
59
|
+
createdAt: now,
|
|
60
|
+
updatedAt: now,
|
|
61
|
+
});
|
|
62
|
+
const row = await this.findSetByHandle(def.handle);
|
|
63
|
+
if (!row)
|
|
64
|
+
throw new Error(`global set not found after create: ${def.handle}`);
|
|
65
|
+
return row;
|
|
66
|
+
}
|
|
67
|
+
async updateSet(handle, input) {
|
|
68
|
+
if (input.handle !== handle) {
|
|
69
|
+
throw new ValidationError('Global set handles are immutable', { issues: [{ path: ['handle'], message: 'Handle cannot be changed' }] });
|
|
70
|
+
}
|
|
71
|
+
const parsed = GlobalSetDefinitionSchema.safeParse(input);
|
|
72
|
+
if (!parsed.success)
|
|
73
|
+
throw new ValidationError('Invalid global set', { issues: parsed.error.issues });
|
|
74
|
+
const def = parsed.data;
|
|
75
|
+
const existing = await this.findSetByHandle(handle);
|
|
76
|
+
if (!existing)
|
|
77
|
+
throw new NotFoundError('global set not found');
|
|
78
|
+
await this.db.update(vulseGlobalSets).set({
|
|
79
|
+
label: def.label,
|
|
80
|
+
definition: def,
|
|
81
|
+
blueprintHash: hashGlobalSetDefinition(def),
|
|
82
|
+
updatedAt: new Date(),
|
|
83
|
+
}).where(eq(vulseGlobalSets.handle, handle));
|
|
84
|
+
const row = await this.findSetByHandle(handle);
|
|
85
|
+
if (!row)
|
|
86
|
+
throw new NotFoundError('global set not found');
|
|
87
|
+
return row;
|
|
88
|
+
}
|
|
89
|
+
async deleteSet(handle) {
|
|
90
|
+
const existing = await this.findSetByHandle(handle);
|
|
91
|
+
if (!existing)
|
|
92
|
+
throw new NotFoundError('global set not found');
|
|
93
|
+
await this.db.delete(vulseGlobalSets).where(eq(vulseGlobalSets.handle, handle));
|
|
94
|
+
}
|
|
95
|
+
async getValue(handle) {
|
|
96
|
+
const set = await this.findSetByHandle(handle);
|
|
97
|
+
if (!set)
|
|
98
|
+
return null;
|
|
99
|
+
const row = await this.db.select().from(vulseGlobalValues).where(eq(vulseGlobalValues.handle, handle)).get();
|
|
100
|
+
return row ? parseValueRow(row) : null;
|
|
101
|
+
}
|
|
102
|
+
async updateValue(handle, input) {
|
|
103
|
+
const set = await this.findSetByHandle(handle);
|
|
104
|
+
if (!set)
|
|
105
|
+
throw new NotFoundError('global set not found');
|
|
106
|
+
const sets = await loadCompiledSets(this.db);
|
|
107
|
+
const compiled = compileGlobalSet(set.definition, sets);
|
|
108
|
+
const result = compiled.schema.safeParse(input);
|
|
109
|
+
if (!result.success) {
|
|
110
|
+
throw new ValidationError('Invalid global value', { issues: result.error.issues });
|
|
111
|
+
}
|
|
112
|
+
const now = new Date();
|
|
113
|
+
const content = result.data;
|
|
114
|
+
await this.db.insert(vulseGlobalValues).values({
|
|
115
|
+
handle,
|
|
116
|
+
content,
|
|
117
|
+
createdAt: now,
|
|
118
|
+
updatedAt: now,
|
|
119
|
+
}).onConflictDoUpdate({
|
|
120
|
+
target: vulseGlobalValues.handle,
|
|
121
|
+
set: { content, updatedAt: now },
|
|
122
|
+
});
|
|
123
|
+
const row = await this.getValue(handle);
|
|
124
|
+
if (!row)
|
|
125
|
+
throw new Error(`global value not found after update: ${handle}`);
|
|
126
|
+
return row;
|
|
127
|
+
}
|
|
128
|
+
async publicValues() {
|
|
129
|
+
const rows = await this.db
|
|
130
|
+
.select({
|
|
131
|
+
handle: vulseGlobalValues.handle,
|
|
132
|
+
content: vulseGlobalValues.content,
|
|
133
|
+
})
|
|
134
|
+
.from(vulseGlobalValues)
|
|
135
|
+
.innerJoin(vulseGlobalSets, eq(vulseGlobalValues.handle, vulseGlobalSets.handle))
|
|
136
|
+
.orderBy(vulseGlobalSets.createdAt);
|
|
137
|
+
const out = {};
|
|
138
|
+
for (const row of rows) {
|
|
139
|
+
out[row.handle] = (row.content ?? {});
|
|
140
|
+
}
|
|
141
|
+
return out;
|
|
142
|
+
}
|
|
143
|
+
async publicValue(handle) {
|
|
144
|
+
const set = await this.findSetByHandle(handle);
|
|
145
|
+
if (!set)
|
|
146
|
+
return null;
|
|
147
|
+
const value = await this.getValue(handle);
|
|
148
|
+
return value?.content ?? {};
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { VulseDb } from '../db.js';
|
|
2
|
+
export interface MediaRow {
|
|
3
|
+
id: string;
|
|
4
|
+
r2Key: string;
|
|
5
|
+
mime: string;
|
|
6
|
+
size: number;
|
|
7
|
+
width: number | null;
|
|
8
|
+
height: number | null;
|
|
9
|
+
alt: string | null;
|
|
10
|
+
blurhash: string | null;
|
|
11
|
+
uploadedBy: string | null;
|
|
12
|
+
createdAt: Date;
|
|
13
|
+
deletedAt: Date | null;
|
|
14
|
+
}
|
|
15
|
+
export declare class MediaRepo {
|
|
16
|
+
private db;
|
|
17
|
+
constructor(db: VulseDb);
|
|
18
|
+
create(input: {
|
|
19
|
+
r2Key: string;
|
|
20
|
+
mime: string;
|
|
21
|
+
size: number;
|
|
22
|
+
uploadedBy?: string | null;
|
|
23
|
+
width?: number | null;
|
|
24
|
+
height?: number | null;
|
|
25
|
+
alt?: string | null;
|
|
26
|
+
blurhash?: string | null;
|
|
27
|
+
}): Promise<MediaRow>;
|
|
28
|
+
list(opts?: {
|
|
29
|
+
includeDeleted?: boolean;
|
|
30
|
+
limit?: number;
|
|
31
|
+
offset?: number;
|
|
32
|
+
}): Promise<MediaRow[]>;
|
|
33
|
+
findById(id: string): Promise<MediaRow | null>;
|
|
34
|
+
softDelete(id: string): Promise<void>;
|
|
35
|
+
updateAlt(id: string, alt: string): Promise<void>;
|
|
36
|
+
listPurgeable(days: number): Promise<MediaRow[]>;
|
|
37
|
+
hardDelete(id: string): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/core/repos/media.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAIvC,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,SAAS,EAAE,IAAI,CAAA;IACf,SAAS,EAAE,IAAI,GAAG,IAAI,CAAA;CACvB;AAkBD,qBAAa,SAAS;IACR,OAAO,CAAC,EAAE;gBAAF,EAAE,EAAE,OAAO;IAEzB,MAAM,CAAC,KAAK,EAAE;QAClB,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACrB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACtB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KACzB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAmBf,IAAI,CAAC,IAAI,GAAE;QAAE,cAAc,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAWnG,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAK9C,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMrC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMjD,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAOhD,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG5C"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { and, desc, eq, isNotNull, isNull, lt } from 'drizzle-orm';
|
|
2
|
+
import { nanoid } from 'nanoid';
|
|
3
|
+
import { media } from '../schema.js';
|
|
4
|
+
import { NotFoundError } from '../errors.js';
|
|
5
|
+
function rowToMedia(row) {
|
|
6
|
+
return {
|
|
7
|
+
id: row.id,
|
|
8
|
+
r2Key: row.r2Key,
|
|
9
|
+
mime: row.mime,
|
|
10
|
+
size: row.size,
|
|
11
|
+
width: row.width ?? null,
|
|
12
|
+
height: row.height ?? null,
|
|
13
|
+
alt: row.alt ?? null,
|
|
14
|
+
blurhash: row.blurhash ?? null,
|
|
15
|
+
uploadedBy: row.uploadedBy ?? null,
|
|
16
|
+
createdAt: row.createdAt,
|
|
17
|
+
deletedAt: row.deletedAt ?? null,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export class MediaRepo {
|
|
21
|
+
db;
|
|
22
|
+
constructor(db) {
|
|
23
|
+
this.db = db;
|
|
24
|
+
}
|
|
25
|
+
async create(input) {
|
|
26
|
+
const now = new Date();
|
|
27
|
+
const row = {
|
|
28
|
+
id: nanoid(),
|
|
29
|
+
r2Key: input.r2Key,
|
|
30
|
+
mime: input.mime,
|
|
31
|
+
size: input.size,
|
|
32
|
+
width: input.width ?? null,
|
|
33
|
+
height: input.height ?? null,
|
|
34
|
+
alt: input.alt ?? null,
|
|
35
|
+
blurhash: input.blurhash ?? null,
|
|
36
|
+
uploadedBy: input.uploadedBy ?? null,
|
|
37
|
+
createdAt: now,
|
|
38
|
+
deletedAt: null,
|
|
39
|
+
};
|
|
40
|
+
await this.db.insert(media).values(row);
|
|
41
|
+
return rowToMedia(row);
|
|
42
|
+
}
|
|
43
|
+
async list(opts = {}) {
|
|
44
|
+
const conditions = opts.includeDeleted ? undefined : isNull(media.deletedAt);
|
|
45
|
+
let query = this.db.select().from(media);
|
|
46
|
+
if (conditions)
|
|
47
|
+
query = query.where(conditions);
|
|
48
|
+
query = query.orderBy(desc(media.createdAt));
|
|
49
|
+
if (opts.limit !== undefined)
|
|
50
|
+
query = query.limit(opts.limit);
|
|
51
|
+
if (opts.offset !== undefined)
|
|
52
|
+
query = query.offset(opts.offset);
|
|
53
|
+
const rows = await query;
|
|
54
|
+
return rows.map(rowToMedia);
|
|
55
|
+
}
|
|
56
|
+
async findById(id) {
|
|
57
|
+
const [row] = await this.db.select().from(media).where(eq(media.id, id));
|
|
58
|
+
return row ? rowToMedia(row) : null;
|
|
59
|
+
}
|
|
60
|
+
async softDelete(id) {
|
|
61
|
+
const existing = await this.findById(id);
|
|
62
|
+
if (!existing)
|
|
63
|
+
throw new NotFoundError(`Media ${id} not found`);
|
|
64
|
+
await this.db.update(media).set({ deletedAt: new Date() }).where(eq(media.id, id));
|
|
65
|
+
}
|
|
66
|
+
async updateAlt(id, alt) {
|
|
67
|
+
const existing = await this.findById(id);
|
|
68
|
+
if (!existing)
|
|
69
|
+
throw new NotFoundError(`Media ${id} not found`);
|
|
70
|
+
await this.db.update(media).set({ alt }).where(eq(media.id, id));
|
|
71
|
+
}
|
|
72
|
+
async listPurgeable(days) {
|
|
73
|
+
const cutoff = new Date(Date.now() - days * 86_400_000);
|
|
74
|
+
const rows = await this.db.select().from(media)
|
|
75
|
+
.where(and(isNotNull(media.deletedAt), lt(media.deletedAt, cutoff)));
|
|
76
|
+
return rows.map(rowToMedia);
|
|
77
|
+
}
|
|
78
|
+
async hardDelete(id) {
|
|
79
|
+
await this.db.delete(media).where(eq(media.id, id));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { VulseDb } from '../db.js';
|
|
2
|
+
export interface PreviewSessionRow {
|
|
3
|
+
id: string;
|
|
4
|
+
userId: string;
|
|
5
|
+
entryId: string | null;
|
|
6
|
+
collection: string;
|
|
7
|
+
locale: string;
|
|
8
|
+
slug: string;
|
|
9
|
+
content: unknown;
|
|
10
|
+
expiresAt: Date;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
updatedAt: Date;
|
|
13
|
+
}
|
|
14
|
+
export declare class PreviewSessionsRepo {
|
|
15
|
+
private db;
|
|
16
|
+
constructor(db: VulseDb);
|
|
17
|
+
create(input: {
|
|
18
|
+
userId: string;
|
|
19
|
+
collection: string;
|
|
20
|
+
slug: string;
|
|
21
|
+
content: unknown;
|
|
22
|
+
locale?: string;
|
|
23
|
+
entryId?: string | null;
|
|
24
|
+
ttlMs?: number;
|
|
25
|
+
}): Promise<PreviewSessionRow>;
|
|
26
|
+
findById(id: string): Promise<PreviewSessionRow | null>;
|
|
27
|
+
update(id: string, userId: string, patch: {
|
|
28
|
+
slug?: string;
|
|
29
|
+
content?: unknown;
|
|
30
|
+
locale?: string;
|
|
31
|
+
}): Promise<PreviewSessionRow | null>;
|
|
32
|
+
delete(id: string, userId: string): Promise<boolean>;
|
|
33
|
+
purgeExpired(now?: Date): Promise<number>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=preview-sessions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-sessions.d.ts","sourceRoot":"","sources":["../../../src/core/repos/preview-sessions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAMvC,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,IAAI,CAAA;IACf,SAAS,EAAE,IAAI,CAAA;IACf,SAAS,EAAE,IAAI,CAAA;CAChB;AAiBD,qBAAa,mBAAmB;IAClB,OAAO,CAAC,EAAE;gBAAF,EAAE,EAAE,OAAO;IAEzB,MAAM,CAAC,KAAK,EAAE;QAClB,MAAM,EAAE,MAAM,CAAA;QACd,UAAU,EAAE,MAAM,CAAA;QAClB,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,OAAO,CAAA;QAChB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACvB,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAoBxB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IASvD,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAenI,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAOpD,YAAY,CAAC,GAAG,OAAa,GAAG,OAAO,CAAC,MAAM,CAAC;CAStD"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { nanoid } from 'nanoid';
|
|
2
|
+
import { eq, lt } from 'drizzle-orm';
|
|
3
|
+
import { vulsePreviewSessions } from '../schema.js';
|
|
4
|
+
import { DEFAULT_LOCALE } from './entries.js';
|
|
5
|
+
const DEFAULT_TTL_MS = 60 * 60 * 1000;
|
|
6
|
+
function mapRow(row) {
|
|
7
|
+
return {
|
|
8
|
+
id: row.id,
|
|
9
|
+
userId: row.userId,
|
|
10
|
+
entryId: row.entryId ?? null,
|
|
11
|
+
collection: row.collection,
|
|
12
|
+
locale: row.locale,
|
|
13
|
+
slug: row.slug,
|
|
14
|
+
content: row.content,
|
|
15
|
+
expiresAt: row.expiresAt,
|
|
16
|
+
createdAt: row.createdAt,
|
|
17
|
+
updatedAt: row.updatedAt,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export class PreviewSessionsRepo {
|
|
21
|
+
db;
|
|
22
|
+
constructor(db) {
|
|
23
|
+
this.db = db;
|
|
24
|
+
}
|
|
25
|
+
async create(input) {
|
|
26
|
+
const now = new Date();
|
|
27
|
+
const ttl = input.ttlMs ?? DEFAULT_TTL_MS;
|
|
28
|
+
const id = nanoid(32);
|
|
29
|
+
const row = {
|
|
30
|
+
id,
|
|
31
|
+
userId: input.userId,
|
|
32
|
+
entryId: input.entryId ?? null,
|
|
33
|
+
collection: input.collection,
|
|
34
|
+
locale: input.locale ?? DEFAULT_LOCALE,
|
|
35
|
+
slug: input.slug,
|
|
36
|
+
content: input.content,
|
|
37
|
+
expiresAt: new Date(now.getTime() + ttl),
|
|
38
|
+
createdAt: now,
|
|
39
|
+
updatedAt: now,
|
|
40
|
+
};
|
|
41
|
+
await this.db.insert(vulsePreviewSessions).values(row);
|
|
42
|
+
return mapRow(row);
|
|
43
|
+
}
|
|
44
|
+
async findById(id) {
|
|
45
|
+
const row = await this.db.query.vulsePreviewSessions.findFirst({
|
|
46
|
+
where: eq(vulsePreviewSessions.id, id),
|
|
47
|
+
});
|
|
48
|
+
if (!row)
|
|
49
|
+
return null;
|
|
50
|
+
if (row.expiresAt.getTime() < Date.now())
|
|
51
|
+
return null;
|
|
52
|
+
return mapRow(row);
|
|
53
|
+
}
|
|
54
|
+
async update(id, userId, patch) {
|
|
55
|
+
const existing = await this.findById(id);
|
|
56
|
+
if (!existing || existing.userId !== userId)
|
|
57
|
+
return null;
|
|
58
|
+
const now = new Date();
|
|
59
|
+
const next = {
|
|
60
|
+
slug: patch.slug ?? existing.slug,
|
|
61
|
+
content: patch.content ?? existing.content,
|
|
62
|
+
locale: patch.locale ?? existing.locale,
|
|
63
|
+
expiresAt: new Date(now.getTime() + DEFAULT_TTL_MS),
|
|
64
|
+
updatedAt: now,
|
|
65
|
+
};
|
|
66
|
+
await this.db.update(vulsePreviewSessions).set(next).where(eq(vulsePreviewSessions.id, id));
|
|
67
|
+
return { ...existing, ...next };
|
|
68
|
+
}
|
|
69
|
+
async delete(id, userId) {
|
|
70
|
+
const existing = await this.findById(id);
|
|
71
|
+
if (!existing || existing.userId !== userId)
|
|
72
|
+
return false;
|
|
73
|
+
await this.db.delete(vulsePreviewSessions).where(eq(vulsePreviewSessions.id, id));
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
async purgeExpired(now = new Date()) {
|
|
77
|
+
const expired = await this.db.select({ id: vulsePreviewSessions.id })
|
|
78
|
+
.from(vulsePreviewSessions)
|
|
79
|
+
.where(lt(vulsePreviewSessions.expiresAt, now));
|
|
80
|
+
for (const row of expired) {
|
|
81
|
+
await this.db.delete(vulsePreviewSessions).where(eq(vulsePreviewSessions.id, row.id));
|
|
82
|
+
}
|
|
83
|
+
return expired.length;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { VulseDb } from '../db.js';
|
|
2
|
+
export interface RevisionRow {
|
|
3
|
+
id: string;
|
|
4
|
+
entryId: string;
|
|
5
|
+
locale: string;
|
|
6
|
+
version: number;
|
|
7
|
+
content: unknown;
|
|
8
|
+
authorId: string | null;
|
|
9
|
+
changeSummary: string | null;
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
}
|
|
12
|
+
export declare class RevisionsRepo {
|
|
13
|
+
private db;
|
|
14
|
+
constructor(db: VulseDb);
|
|
15
|
+
listByEntry(entryId: string, locale?: string): Promise<RevisionRow[]>;
|
|
16
|
+
getVersion(entryId: string, version: number, locale?: string): Promise<RevisionRow | null>;
|
|
17
|
+
restore(entryId: string, version: number, opts: {
|
|
18
|
+
userId: string;
|
|
19
|
+
locale?: string;
|
|
20
|
+
}): Promise<void>;
|
|
21
|
+
/** Keep only the most recent `keep` revisions per (entry, locale). */
|
|
22
|
+
prune(entryId: string, locale: string, keep: number): Promise<number>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=revisions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revisions.d.ts","sourceRoot":"","sources":["../../../src/core/repos/revisions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAKvC,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,SAAS,EAAE,IAAI,CAAA;CAChB;AAED,qBAAa,aAAa;IACZ,OAAO,CAAC,EAAE;gBAAF,EAAE,EAAE,OAAO;IAEzB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,MAAuB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAMrF,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,MAAuB,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAU1G,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAazG,sEAAsE;IAChE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAS5E"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { and, desc, eq } from 'drizzle-orm';
|
|
2
|
+
import { entryRevisions } from '../schema.js';
|
|
3
|
+
import { NotFoundError } from '../errors.js';
|
|
4
|
+
import { DEFAULT_LOCALE, EntriesRepo } from './entries.js';
|
|
5
|
+
export class RevisionsRepo {
|
|
6
|
+
db;
|
|
7
|
+
constructor(db) {
|
|
8
|
+
this.db = db;
|
|
9
|
+
}
|
|
10
|
+
async listByEntry(entryId, locale = DEFAULT_LOCALE) {
|
|
11
|
+
return await this.db.select().from(entryRevisions)
|
|
12
|
+
.where(and(eq(entryRevisions.entryId, entryId), eq(entryRevisions.locale, locale)))
|
|
13
|
+
.orderBy(desc(entryRevisions.version));
|
|
14
|
+
}
|
|
15
|
+
async getVersion(entryId, version, locale = DEFAULT_LOCALE) {
|
|
16
|
+
const [row] = await this.db.select().from(entryRevisions)
|
|
17
|
+
.where(and(eq(entryRevisions.entryId, entryId), eq(entryRevisions.locale, locale), eq(entryRevisions.version, version)));
|
|
18
|
+
return row ?? null;
|
|
19
|
+
}
|
|
20
|
+
async restore(entryId, version, opts) {
|
|
21
|
+
const locale = opts.locale ?? DEFAULT_LOCALE;
|
|
22
|
+
const target = await this.getVersion(entryId, version, locale);
|
|
23
|
+
if (!target)
|
|
24
|
+
throw new NotFoundError(`Revision ${version} for ${entryId} (${locale}) not found`);
|
|
25
|
+
const repo = new EntriesRepo(this.db);
|
|
26
|
+
await repo.updateWithRevision(entryId, {
|
|
27
|
+
locale,
|
|
28
|
+
content: target.content,
|
|
29
|
+
updatedBy: opts.userId,
|
|
30
|
+
changeSummary: `Restored v${version}`,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/** Keep only the most recent `keep` revisions per (entry, locale). */
|
|
34
|
+
async prune(entryId, locale, keep) {
|
|
35
|
+
if (keep < 1)
|
|
36
|
+
return 0;
|
|
37
|
+
const all = await this.listByEntry(entryId, locale);
|
|
38
|
+
const toDelete = all.slice(keep);
|
|
39
|
+
for (const r of toDelete) {
|
|
40
|
+
await this.db.delete(entryRevisions).where(eq(entryRevisions.id, r.id));
|
|
41
|
+
}
|
|
42
|
+
return toDelete.length;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { VulseDb } from '../db.js';
|
|
2
|
+
export declare class SettingsRepo {
|
|
3
|
+
private db;
|
|
4
|
+
constructor(db: VulseDb);
|
|
5
|
+
get<T = unknown>(key: string): Promise<T | null>;
|
|
6
|
+
set(key: string, value: unknown): Promise<void>;
|
|
7
|
+
all(): Promise<Record<string, unknown>>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../src/core/repos/settings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAGvC,qBAAa,YAAY;IACX,OAAO,CAAC,EAAE;gBAAF,EAAE,EAAE,OAAO;IAEzB,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAKhD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAM/C,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAI9C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { eq } from 'drizzle-orm';
|
|
2
|
+
import { settings } from '../schema.js';
|
|
3
|
+
export class SettingsRepo {
|
|
4
|
+
db;
|
|
5
|
+
constructor(db) {
|
|
6
|
+
this.db = db;
|
|
7
|
+
}
|
|
8
|
+
async get(key) {
|
|
9
|
+
const [row] = await this.db.select().from(settings).where(eq(settings.key, key));
|
|
10
|
+
return row?.value ?? null;
|
|
11
|
+
}
|
|
12
|
+
async set(key, value) {
|
|
13
|
+
const now = new Date();
|
|
14
|
+
await this.db.insert(settings).values({ key, value, updatedAt: now })
|
|
15
|
+
.onConflictDoUpdate({ target: settings.key, set: { value, updatedAt: now } });
|
|
16
|
+
}
|
|
17
|
+
async all() {
|
|
18
|
+
const rows = await this.db.select().from(settings);
|
|
19
|
+
return Object.fromEntries(rows.map((r) => [r.key, r.value]));
|
|
20
|
+
}
|
|
21
|
+
}
|