@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,17 @@
|
|
|
1
|
+
import { compileBlueprintSchema } from '../blueprints/compile.js';
|
|
2
|
+
import { hashGlobalSetDefinition } from './definition.js';
|
|
3
|
+
export function compileGlobalSet(def, sets) {
|
|
4
|
+
const options = sets ? { sets } : {};
|
|
5
|
+
return {
|
|
6
|
+
handle: def.handle,
|
|
7
|
+
label: def.label,
|
|
8
|
+
fields: def.fields,
|
|
9
|
+
schema: compileBlueprintSchema({
|
|
10
|
+
handle: def.handle,
|
|
11
|
+
label: def.label,
|
|
12
|
+
singleton: true,
|
|
13
|
+
fields: def.fields,
|
|
14
|
+
}, options),
|
|
15
|
+
hash: hashGlobalSetDefinition(def),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { z } from 'astro/zod';
|
|
2
|
+
export declare const GlobalSetDefinitionSchema: z.ZodObject<{
|
|
3
|
+
handle: z.ZodString;
|
|
4
|
+
label: z.ZodString;
|
|
5
|
+
fields: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
label: z.ZodOptional<z.ZodString>;
|
|
8
|
+
ui: z.ZodDiscriminatedUnion<readonly [z.ZodObject<{
|
|
9
|
+
kind: z.ZodLiteral<"text">;
|
|
10
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
11
|
+
kind: z.ZodLiteral<"textarea">;
|
|
12
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
13
|
+
kind: z.ZodLiteral<"blocks">;
|
|
14
|
+
sets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
15
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
16
|
+
kind: z.ZodLiteral<"date">;
|
|
17
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
18
|
+
kind: z.ZodLiteral<"boolean">;
|
|
19
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
20
|
+
kind: z.ZodLiteral<"select">;
|
|
21
|
+
options: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
22
|
+
key: z.ZodString;
|
|
23
|
+
label: z.ZodString;
|
|
24
|
+
}, z.core.$strip>]>>;
|
|
25
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
27
|
+
clearable: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
29
|
+
kind: z.ZodLiteral<"relationship">;
|
|
30
|
+
to: z.ZodString;
|
|
31
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
32
|
+
kind: z.ZodLiteral<"entry">;
|
|
33
|
+
collections: z.ZodArray<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
35
|
+
kind: z.ZodLiteral<"entries">;
|
|
36
|
+
collections: z.ZodArray<z.ZodString>;
|
|
37
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
39
|
+
kind: z.ZodLiteral<"link">;
|
|
40
|
+
collections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
41
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
42
|
+
kind: z.ZodLiteral<"asset">;
|
|
43
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
44
|
+
kind: z.ZodLiteral<"replicator">;
|
|
45
|
+
sets: z.ZodArray<z.ZodObject<{
|
|
46
|
+
name: z.ZodString;
|
|
47
|
+
label: z.ZodOptional<z.ZodString>;
|
|
48
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
label: z.ZodOptional<z.ZodString>;
|
|
51
|
+
ui: z.ZodDiscriminatedUnion<readonly [z.ZodObject<{
|
|
52
|
+
kind: z.ZodLiteral<"text">;
|
|
53
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
54
|
+
kind: z.ZodLiteral<"textarea">;
|
|
55
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
56
|
+
kind: z.ZodLiteral<"blocks">;
|
|
57
|
+
sets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
58
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
59
|
+
kind: z.ZodLiteral<"date">;
|
|
60
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
61
|
+
kind: z.ZodLiteral<"boolean">;
|
|
62
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
63
|
+
kind: z.ZodLiteral<"select">;
|
|
64
|
+
options: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
65
|
+
key: z.ZodString;
|
|
66
|
+
label: z.ZodString;
|
|
67
|
+
}, z.core.$strip>]>>;
|
|
68
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
69
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
70
|
+
clearable: z.ZodOptional<z.ZodBoolean>;
|
|
71
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
72
|
+
kind: z.ZodLiteral<"relationship">;
|
|
73
|
+
to: z.ZodString;
|
|
74
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
75
|
+
kind: z.ZodLiteral<"entry">;
|
|
76
|
+
collections: z.ZodArray<z.ZodString>;
|
|
77
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
78
|
+
kind: z.ZodLiteral<"entries">;
|
|
79
|
+
collections: z.ZodArray<z.ZodString>;
|
|
80
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
81
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
82
|
+
kind: z.ZodLiteral<"link">;
|
|
83
|
+
collections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
84
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
85
|
+
kind: z.ZodLiteral<"asset">;
|
|
86
|
+
}, z.core.$strip>], "kind">;
|
|
87
|
+
optional: z.ZodBoolean;
|
|
88
|
+
default: z.ZodOptional<z.ZodUnknown>;
|
|
89
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
90
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
92
|
+
}, z.core.$strip>>;
|
|
93
|
+
}, z.core.$strip>>;
|
|
94
|
+
}, z.core.$strip>>;
|
|
95
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
96
|
+
kind: z.ZodLiteral<"grid">;
|
|
97
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
98
|
+
name: z.ZodString;
|
|
99
|
+
label: z.ZodOptional<z.ZodString>;
|
|
100
|
+
ui: z.ZodDiscriminatedUnion<readonly [z.ZodObject<{
|
|
101
|
+
kind: z.ZodLiteral<"text">;
|
|
102
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
103
|
+
kind: z.ZodLiteral<"textarea">;
|
|
104
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
105
|
+
kind: z.ZodLiteral<"blocks">;
|
|
106
|
+
sets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
107
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
108
|
+
kind: z.ZodLiteral<"date">;
|
|
109
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
110
|
+
kind: z.ZodLiteral<"boolean">;
|
|
111
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
112
|
+
kind: z.ZodLiteral<"select">;
|
|
113
|
+
options: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
114
|
+
key: z.ZodString;
|
|
115
|
+
label: z.ZodString;
|
|
116
|
+
}, z.core.$strip>]>>;
|
|
117
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
118
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
119
|
+
clearable: z.ZodOptional<z.ZodBoolean>;
|
|
120
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
121
|
+
kind: z.ZodLiteral<"relationship">;
|
|
122
|
+
to: z.ZodString;
|
|
123
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
124
|
+
kind: z.ZodLiteral<"entry">;
|
|
125
|
+
collections: z.ZodArray<z.ZodString>;
|
|
126
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
127
|
+
kind: z.ZodLiteral<"entries">;
|
|
128
|
+
collections: z.ZodArray<z.ZodString>;
|
|
129
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
130
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
131
|
+
kind: z.ZodLiteral<"link">;
|
|
132
|
+
collections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
133
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
134
|
+
kind: z.ZodLiteral<"asset">;
|
|
135
|
+
}, z.core.$strip>], "kind">;
|
|
136
|
+
optional: z.ZodBoolean;
|
|
137
|
+
default: z.ZodOptional<z.ZodUnknown>;
|
|
138
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
139
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
140
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
141
|
+
}, z.core.$strip>>;
|
|
142
|
+
}, z.core.$strip>>;
|
|
143
|
+
minRows: z.ZodOptional<z.ZodNumber>;
|
|
144
|
+
maxRows: z.ZodOptional<z.ZodNumber>;
|
|
145
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
146
|
+
table: "table";
|
|
147
|
+
stacked: "stacked";
|
|
148
|
+
}>>;
|
|
149
|
+
addLabel: z.ZodOptional<z.ZodString>;
|
|
150
|
+
}, z.core.$strip>], "kind">;
|
|
151
|
+
optional: z.ZodBoolean;
|
|
152
|
+
default: z.ZodOptional<z.ZodUnknown>;
|
|
153
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
154
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
155
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
156
|
+
}, z.core.$strip>>;
|
|
157
|
+
}, z.core.$strip>>>;
|
|
158
|
+
}, z.core.$strip>;
|
|
159
|
+
export type GlobalSetDefinition = z.infer<typeof GlobalSetDefinitionSchema>;
|
|
160
|
+
export declare function hashGlobalSetDefinition(def: GlobalSetDefinition): string;
|
|
161
|
+
//# sourceMappingURL=definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/core/globals/definition.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAA;AAG7B,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAIpC,CAAA;AAEF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAE3E,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAcxE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { z } from 'astro/zod';
|
|
3
|
+
import { FieldDefinitionSchema } from '../blueprints/definition.js';
|
|
4
|
+
export const GlobalSetDefinitionSchema = z.object({
|
|
5
|
+
handle: z.string().regex(/^[a-z][a-z0-9_-]*$/),
|
|
6
|
+
label: z.string().min(1),
|
|
7
|
+
fields: z.array(FieldDefinitionSchema).default([]),
|
|
8
|
+
});
|
|
9
|
+
export function hashGlobalSetDefinition(def) {
|
|
10
|
+
const canonical = JSON.stringify({
|
|
11
|
+
handle: def.handle,
|
|
12
|
+
label: def.label,
|
|
13
|
+
fields: def.fields.map((f) => ({
|
|
14
|
+
name: f.name,
|
|
15
|
+
label: f.label ?? null,
|
|
16
|
+
ui: f.ui,
|
|
17
|
+
optional: f.optional,
|
|
18
|
+
default: f.default ?? null,
|
|
19
|
+
validation: f.validation ?? null,
|
|
20
|
+
})),
|
|
21
|
+
});
|
|
22
|
+
return createHash('sha256').update(canonical).digest('hex');
|
|
23
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { VulseDb } from './db.js';
|
|
2
|
+
export declare const LOCALES_KEY = "locales";
|
|
3
|
+
export declare const DEFAULT_LOCALE_KEY = "defaultLocale";
|
|
4
|
+
export interface LocalesConfig {
|
|
5
|
+
/** Ordered list of locales supported by the site. Always contains defaultLocale. */
|
|
6
|
+
locales: string[];
|
|
7
|
+
/** The locale used when none is specified. */
|
|
8
|
+
defaultLocale: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function isValidLocaleCode(code: string): boolean;
|
|
11
|
+
export declare function readLocalesConfig(db: VulseDb): Promise<LocalesConfig>;
|
|
12
|
+
/** Validate a locale param against site configuration; throws if unknown. */
|
|
13
|
+
export declare function resolveLocale(db: VulseDb, candidate: string | null | undefined): Promise<string>;
|
|
14
|
+
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../src/core/locales.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAItC,eAAO,MAAM,WAAW,YAAY,CAAA;AACpC,eAAO,MAAM,kBAAkB,kBAAkB,CAAA;AAKjD,MAAM,WAAW,aAAa;IAC5B,oFAAoF;IACpF,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,8CAA8C;IAC9C,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAa3E;AAED,6EAA6E;AAC7E,wBAAsB,aAAa,CAAC,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAOtG"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SettingsRepo } from './repos/settings.js';
|
|
2
|
+
import { DEFAULT_LOCALE } from './repos/entries.js';
|
|
3
|
+
export const LOCALES_KEY = 'locales';
|
|
4
|
+
export const DEFAULT_LOCALE_KEY = 'defaultLocale';
|
|
5
|
+
// BCP-47-ish: 2-3 letter base + optional region. Conservative, easy to extend later.
|
|
6
|
+
const LOCALE_CODE_RE = /^[a-z]{2,3}(-[A-Z]{2})?$/;
|
|
7
|
+
export function isValidLocaleCode(code) {
|
|
8
|
+
return code === DEFAULT_LOCALE || LOCALE_CODE_RE.test(code);
|
|
9
|
+
}
|
|
10
|
+
export async function readLocalesConfig(db) {
|
|
11
|
+
const repo = new SettingsRepo(db);
|
|
12
|
+
const [raw, def] = await Promise.all([
|
|
13
|
+
repo.get(LOCALES_KEY),
|
|
14
|
+
repo.get(DEFAULT_LOCALE_KEY),
|
|
15
|
+
]);
|
|
16
|
+
const locales = Array.isArray(raw)
|
|
17
|
+
? raw.filter((v) => typeof v === 'string' && isValidLocaleCode(v))
|
|
18
|
+
: [];
|
|
19
|
+
const defaultLocale = typeof def === 'string' && isValidLocaleCode(def) ? def : DEFAULT_LOCALE;
|
|
20
|
+
if (locales.length === 0)
|
|
21
|
+
locales.push(defaultLocale);
|
|
22
|
+
if (!locales.includes(defaultLocale))
|
|
23
|
+
locales.unshift(defaultLocale);
|
|
24
|
+
return { locales, defaultLocale };
|
|
25
|
+
}
|
|
26
|
+
/** Validate a locale param against site configuration; throws if unknown. */
|
|
27
|
+
export async function resolveLocale(db, candidate) {
|
|
28
|
+
const cfg = await readLocalesConfig(db);
|
|
29
|
+
if (!candidate || candidate === DEFAULT_LOCALE)
|
|
30
|
+
return cfg.defaultLocale;
|
|
31
|
+
if (!cfg.locales.includes(candidate)) {
|
|
32
|
+
throw new Error(`Unknown locale '${candidate}'. Supported: ${cfg.locales.join(', ')}`);
|
|
33
|
+
}
|
|
34
|
+
return candidate;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/core/migrations.ts"],"names":[],"mappings":"AAyBA,2FAA2F;AAC3F,wBAAsB,eAAe,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBnE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import initSql from '../../migrations/0000_init.sql?raw';
|
|
2
|
+
import collectionsSetsSql from '../../migrations/0001_collections_sets.sql?raw';
|
|
3
|
+
import ftsSql from '../../migrations/0003_fts.sql?raw';
|
|
4
|
+
import formsSql from '../../migrations/0004_forms.sql?raw';
|
|
5
|
+
import globalsSql from '../../migrations/0005_globals.sql?raw';
|
|
6
|
+
import previewSessionsSql from '../../migrations/0006_preview_sessions.sql?raw';
|
|
7
|
+
const MIGRATIONS = [
|
|
8
|
+
{ id: '0000_init', sql: initSql },
|
|
9
|
+
{ id: '0001_collections_sets', sql: collectionsSetsSql },
|
|
10
|
+
// 0002_tree_drafts was folded into 0000_init when the schema was reshaped for
|
|
11
|
+
// i18n. The ID is intentionally skipped so the ledger remains forward-only.
|
|
12
|
+
{ id: '0003_fts', sql: ftsSql },
|
|
13
|
+
{ id: '0004_forms', sql: formsSql },
|
|
14
|
+
{ id: '0005_globals', sql: globalsSql },
|
|
15
|
+
{ id: '0006_preview_sessions', sql: previewSessionsSql },
|
|
16
|
+
];
|
|
17
|
+
function splitStatements(sql) {
|
|
18
|
+
return sql
|
|
19
|
+
.split('--> statement-breakpoint')
|
|
20
|
+
.map((s) => s.trim())
|
|
21
|
+
.filter(Boolean);
|
|
22
|
+
}
|
|
23
|
+
/** Applies bundled SQL migrations directly to a D1 binding (used in tests and Workers). */
|
|
24
|
+
export async function applyMigrations(db) {
|
|
25
|
+
await db.exec('CREATE TABLE IF NOT EXISTS _vulse_migrations (id TEXT PRIMARY KEY, applied_at INTEGER NOT NULL)');
|
|
26
|
+
for (const migration of MIGRATIONS) {
|
|
27
|
+
const applied = await db
|
|
28
|
+
.prepare('SELECT id FROM _vulse_migrations WHERE id = ?')
|
|
29
|
+
.bind(migration.id)
|
|
30
|
+
.first();
|
|
31
|
+
if (applied)
|
|
32
|
+
continue;
|
|
33
|
+
for (const stmt of splitStatements(migration.sql)) {
|
|
34
|
+
await db.exec(stmt.replace(/\s+/g, ' '));
|
|
35
|
+
}
|
|
36
|
+
await db
|
|
37
|
+
.prepare('INSERT INTO _vulse_migrations (id, applied_at) VALUES (?, ?)')
|
|
38
|
+
.bind(migration.id, Date.now())
|
|
39
|
+
.run();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { z } from 'astro/zod';
|
|
2
|
+
export interface ContentValidationIssue {
|
|
3
|
+
path: (string | number)[];
|
|
4
|
+
message: string;
|
|
5
|
+
code?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Parses arbitrary content against a Zod schema. On failure, throws a
|
|
9
|
+
* ValidationError whose message names the first offending field (so the
|
|
10
|
+
* top-level error banner reads sensibly) and whose `details.issues` carries
|
|
11
|
+
* the full list with humanized messages for inline field display.
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseContent<S extends z.ZodTypeAny>(schema: S, content: unknown): z.infer<S>;
|
|
14
|
+
//# sourceMappingURL=parse-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-content.d.ts","sourceRoot":"","sources":["../../src/core/parse-content.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,WAAW,CAAA;AAGlC,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAW5F"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ValidationError } from './errors.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parses arbitrary content against a Zod schema. On failure, throws a
|
|
4
|
+
* ValidationError whose message names the first offending field (so the
|
|
5
|
+
* top-level error banner reads sensibly) and whose `details.issues` carries
|
|
6
|
+
* the full list with humanized messages for inline field display.
|
|
7
|
+
*/
|
|
8
|
+
export function parseContent(schema, content) {
|
|
9
|
+
const parsed = schema.safeParse(content);
|
|
10
|
+
if (parsed.success)
|
|
11
|
+
return parsed.data;
|
|
12
|
+
const issues = parsed.error.issues.map((issue) => ({
|
|
13
|
+
path: issue.path.filter((p) => typeof p === 'string' || typeof p === 'number'),
|
|
14
|
+
message: humanizeIssue(issue),
|
|
15
|
+
code: issue.code,
|
|
16
|
+
}));
|
|
17
|
+
throw new ValidationError(summarize(issues), { issues });
|
|
18
|
+
}
|
|
19
|
+
function summarize(issues) {
|
|
20
|
+
if (issues.length === 0)
|
|
21
|
+
return 'Validation failed';
|
|
22
|
+
const first = issues[0];
|
|
23
|
+
const fieldLabel = first.path.length ? first.path.join('.') : 'Content';
|
|
24
|
+
if (issues.length === 1)
|
|
25
|
+
return `${fieldLabel}: ${first.message}`;
|
|
26
|
+
return `${fieldLabel}: ${first.message} (and ${issues.length - 1} more issue${issues.length - 1 === 1 ? '' : 's'})`;
|
|
27
|
+
}
|
|
28
|
+
function humanizeIssue(issue) {
|
|
29
|
+
const i = issue;
|
|
30
|
+
// Missing required value.
|
|
31
|
+
if (i.code === 'invalid_type') {
|
|
32
|
+
if (i.received === 'undefined' || i.received === 'null')
|
|
33
|
+
return 'This field is required.';
|
|
34
|
+
if (/received (undefined|null)/.test(i.message))
|
|
35
|
+
return 'This field is required.';
|
|
36
|
+
if (i.expected)
|
|
37
|
+
return `Expected ${i.expected}.`;
|
|
38
|
+
}
|
|
39
|
+
// Length / numeric bounds.
|
|
40
|
+
const origin = i.origin ?? i.type;
|
|
41
|
+
if (i.code === 'too_small') {
|
|
42
|
+
if (origin === 'string' && Number(i.minimum) === 1)
|
|
43
|
+
return 'This field is required.';
|
|
44
|
+
if (origin === 'string')
|
|
45
|
+
return `Must be at least ${i.minimum} characters.`;
|
|
46
|
+
if (origin === 'number')
|
|
47
|
+
return `Must be ${i.inclusive ? 'at least' : 'greater than'} ${i.minimum}.`;
|
|
48
|
+
if (origin === 'array')
|
|
49
|
+
return `Add at least ${i.minimum} item${i.minimum === 1 ? '' : 's'}.`;
|
|
50
|
+
}
|
|
51
|
+
if (i.code === 'too_big') {
|
|
52
|
+
if (origin === 'string')
|
|
53
|
+
return `Must be at most ${i.maximum} characters.`;
|
|
54
|
+
if (origin === 'number')
|
|
55
|
+
return `Must be ${i.inclusive ? 'at most' : 'less than'} ${i.maximum}.`;
|
|
56
|
+
if (origin === 'array')
|
|
57
|
+
return `No more than ${i.maximum} item${i.maximum === 1 ? '' : 's'}.`;
|
|
58
|
+
}
|
|
59
|
+
// String formats (Zod 4: invalid_format with format; Zod 3: invalid_string with validation).
|
|
60
|
+
const fmt = i.format ?? i.validation;
|
|
61
|
+
if (fmt === 'email')
|
|
62
|
+
return 'Enter a valid email address.';
|
|
63
|
+
if (fmt === 'url')
|
|
64
|
+
return 'Enter a valid URL.';
|
|
65
|
+
if (i.message === 'Required')
|
|
66
|
+
return 'This field is required.';
|
|
67
|
+
return i.message;
|
|
68
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { FormDefinition } from '../forms/definition.js';
|
|
2
|
+
import type { SubmissionRow } from '../repos/forms.js';
|
|
3
|
+
import type { Role } from '../blueprints/types.js';
|
|
4
|
+
export type MaybePromise<T> = T | Promise<T>;
|
|
5
|
+
export interface VulsePluginLogger {
|
|
6
|
+
debug(message: string, data?: unknown): void;
|
|
7
|
+
info(message: string, data?: unknown): void;
|
|
8
|
+
warn(message: string, data?: unknown): void;
|
|
9
|
+
error(message: string, data?: unknown): void;
|
|
10
|
+
}
|
|
11
|
+
export interface VulsePluginEmail {
|
|
12
|
+
send(input: {
|
|
13
|
+
to: string;
|
|
14
|
+
subject: string;
|
|
15
|
+
text?: string;
|
|
16
|
+
body?: string;
|
|
17
|
+
html?: string;
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export interface VulsePluginContext {
|
|
21
|
+
env: Record<string, unknown>;
|
|
22
|
+
logger: VulsePluginLogger;
|
|
23
|
+
email: VulsePluginEmail;
|
|
24
|
+
}
|
|
25
|
+
export interface FormBeforeSubmitEvent {
|
|
26
|
+
request: Request;
|
|
27
|
+
form: FormDefinition;
|
|
28
|
+
payload: Record<string, unknown>;
|
|
29
|
+
ip: string;
|
|
30
|
+
headers: Headers;
|
|
31
|
+
}
|
|
32
|
+
export type FormBeforeSubmitResult = void | {
|
|
33
|
+
action?: 'continue';
|
|
34
|
+
payload?: Record<string, unknown>;
|
|
35
|
+
} | {
|
|
36
|
+
action: 'drop';
|
|
37
|
+
reason?: string;
|
|
38
|
+
response?: 'fake-success';
|
|
39
|
+
} | {
|
|
40
|
+
action: 'reject';
|
|
41
|
+
message?: string;
|
|
42
|
+
};
|
|
43
|
+
export interface FormAfterSubmitEvent {
|
|
44
|
+
request: Request;
|
|
45
|
+
form: FormDefinition;
|
|
46
|
+
payload: Record<string, unknown>;
|
|
47
|
+
submission: SubmissionRow;
|
|
48
|
+
ip: string;
|
|
49
|
+
headers: Headers;
|
|
50
|
+
}
|
|
51
|
+
export interface FormProcessEvent {
|
|
52
|
+
form: FormDefinition;
|
|
53
|
+
payload: Record<string, unknown>;
|
|
54
|
+
submission: SubmissionRow;
|
|
55
|
+
}
|
|
56
|
+
export interface AuthUserCreateInput {
|
|
57
|
+
id?: string;
|
|
58
|
+
email?: string;
|
|
59
|
+
name?: string;
|
|
60
|
+
role?: Role;
|
|
61
|
+
displayName?: string | null;
|
|
62
|
+
[key: string]: unknown;
|
|
63
|
+
}
|
|
64
|
+
export interface AuthUserCreateEvent {
|
|
65
|
+
user: AuthUserCreateInput;
|
|
66
|
+
}
|
|
67
|
+
export type AuthUserBeforeCreateResult = void | false | {
|
|
68
|
+
action?: 'continue';
|
|
69
|
+
data?: AuthUserCreateInput;
|
|
70
|
+
} | {
|
|
71
|
+
action: 'reject';
|
|
72
|
+
message?: string;
|
|
73
|
+
};
|
|
74
|
+
export interface AuthUserCreatedEvent {
|
|
75
|
+
user: AuthUserCreateInput;
|
|
76
|
+
}
|
|
77
|
+
export interface VulsePluginHooks {
|
|
78
|
+
'form:beforeSubmit'?: (event: FormBeforeSubmitEvent, ctx: VulsePluginContext) => MaybePromise<FormBeforeSubmitResult>;
|
|
79
|
+
'form:afterSubmit'?: (event: FormAfterSubmitEvent, ctx: VulsePluginContext) => MaybePromise<void>;
|
|
80
|
+
'form:beforeProcess'?: (event: FormProcessEvent, ctx: VulsePluginContext) => MaybePromise<void>;
|
|
81
|
+
'form:afterProcess'?: (event: FormProcessEvent, ctx: VulsePluginContext) => MaybePromise<void>;
|
|
82
|
+
'auth:userBeforeCreate'?: (event: AuthUserCreateEvent, ctx: VulsePluginContext) => MaybePromise<AuthUserBeforeCreateResult>;
|
|
83
|
+
'auth:userAfterCreate'?: (event: AuthUserCreatedEvent, ctx: VulsePluginContext) => MaybePromise<void>;
|
|
84
|
+
}
|
|
85
|
+
export type VulseHookName = keyof VulsePluginHooks;
|
|
86
|
+
export interface VulsePlugin {
|
|
87
|
+
id: string;
|
|
88
|
+
version?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Higher priority plugins run earlier. Plugins with the same priority run
|
|
91
|
+
* in registration order.
|
|
92
|
+
*/
|
|
93
|
+
priority?: number;
|
|
94
|
+
capabilities?: string[];
|
|
95
|
+
hooks?: VulsePluginHooks;
|
|
96
|
+
}
|
|
97
|
+
export declare function assertValidPluginId(id: string): void;
|
|
98
|
+
export declare function definePlugin<const T extends VulsePlugin>(plugin: T): T;
|
|
99
|
+
//# sourceMappingURL=definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/core/plugins/definition.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const PLUGIN_ID_RE = /^[a-z0-9][a-z0-9._-]*$/;
|
|
2
|
+
export function assertValidPluginId(id) {
|
|
3
|
+
if (!PLUGIN_ID_RE.test(id)) {
|
|
4
|
+
throw new Error(`Vulse plugin "${id}": id must be lowercase letters, numbers, dots, underscores, or dashes`);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export function definePlugin(plugin) {
|
|
8
|
+
assertValidPluginId(plugin.id);
|
|
9
|
+
return plugin;
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface VulseLivePreviewLocals {
|
|
2
|
+
entryId: string | null;
|
|
3
|
+
collection: string;
|
|
4
|
+
slug: string;
|
|
5
|
+
content: unknown;
|
|
6
|
+
}
|
|
7
|
+
export interface PreviewLocals {
|
|
8
|
+
vulseLivePreview?: VulseLivePreviewLocals | null;
|
|
9
|
+
vulsePreview?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function resolvePreviewContent(entry: {
|
|
12
|
+
id: string;
|
|
13
|
+
content: unknown;
|
|
14
|
+
draftContent?: unknown | null;
|
|
15
|
+
} | null, locals: PreviewLocals): unknown | null;
|
|
16
|
+
//# sourceMappingURL=preview-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-content.d.ts","sourceRoot":"","sources":["../../src/core/preview-content.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,gBAAgB,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAA;IAChD,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,EAC7E,MAAM,EAAE,aAAa,GACpB,OAAO,GAAG,IAAI,CAKhB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function resolvePreviewContent(entry, locals) {
|
|
2
|
+
const live = locals.vulseLivePreview;
|
|
3
|
+
if (live && entry && live.entryId === entry.id)
|
|
4
|
+
return live.content;
|
|
5
|
+
if (locals.vulsePreview && entry?.draftContent != null)
|
|
6
|
+
return entry.draftContent;
|
|
7
|
+
return entry?.content ?? null;
|
|
8
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { VulseDb } from '../db.js';
|
|
2
|
+
import { entries } from '../schema.js';
|
|
3
|
+
export declare const DEFAULT_LOCALE = "default";
|
|
4
|
+
export interface EntryRow {
|
|
5
|
+
id: string;
|
|
6
|
+
collection: string;
|
|
7
|
+
parentId: string | null;
|
|
8
|
+
sortOrder: number;
|
|
9
|
+
slug: string;
|
|
10
|
+
status: 'draft' | 'published';
|
|
11
|
+
locale: string;
|
|
12
|
+
version: number;
|
|
13
|
+
content: unknown;
|
|
14
|
+
draftContent: unknown | null;
|
|
15
|
+
hasUnpublishedChanges: boolean;
|
|
16
|
+
publishedAt: Date | null;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
updatedAt: Date;
|
|
19
|
+
createdBy: string | null;
|
|
20
|
+
updatedBy: string | null;
|
|
21
|
+
}
|
|
22
|
+
export interface EntryNode extends EntryRow {
|
|
23
|
+
children: EntryNode[];
|
|
24
|
+
}
|
|
25
|
+
export interface EntryLocaleSummary {
|
|
26
|
+
locale: string;
|
|
27
|
+
slug: string;
|
|
28
|
+
status: 'draft' | 'published';
|
|
29
|
+
hasUnpublishedChanges: boolean;
|
|
30
|
+
publishedAt: Date | null;
|
|
31
|
+
updatedAt: Date;
|
|
32
|
+
}
|
|
33
|
+
export type EntryOrderBy = 'sortOrder' | 'publishedAt' | 'updatedAt' | 'createdAt';
|
|
34
|
+
export interface ListOptions {
|
|
35
|
+
collection: string;
|
|
36
|
+
locale?: string;
|
|
37
|
+
status?: 'draft' | 'published';
|
|
38
|
+
parentId?: string | null;
|
|
39
|
+
limit?: number;
|
|
40
|
+
offset?: number;
|
|
41
|
+
createdBy?: string;
|
|
42
|
+
publishedAfter?: Date;
|
|
43
|
+
publishedBefore?: Date;
|
|
44
|
+
orderBy?: EntryOrderBy;
|
|
45
|
+
order?: 'asc' | 'desc';
|
|
46
|
+
}
|
|
47
|
+
type EntryShell = typeof entries.$inferSelect;
|
|
48
|
+
export declare class EntriesRepo {
|
|
49
|
+
private db;
|
|
50
|
+
constructor(db: VulseDb);
|
|
51
|
+
private resolveUniqueSlug;
|
|
52
|
+
private isSlugUniqueViolation;
|
|
53
|
+
maxSortOrder(collection: string, parentId: string | null): Promise<number>;
|
|
54
|
+
/** True if the proposed parent would create a cycle (parent is a descendant of id). */
|
|
55
|
+
private wouldCreateCycle;
|
|
56
|
+
create(input: {
|
|
57
|
+
collection: string;
|
|
58
|
+
slug: string;
|
|
59
|
+
content: unknown;
|
|
60
|
+
createdBy: string;
|
|
61
|
+
status?: 'draft' | 'published';
|
|
62
|
+
locale?: string;
|
|
63
|
+
parentId?: string | null;
|
|
64
|
+
draftsEnabled?: boolean;
|
|
65
|
+
}): Promise<EntryRow>;
|
|
66
|
+
/** Add a new locale translation to an existing entry. */
|
|
67
|
+
createLocale(entryId: string, input: {
|
|
68
|
+
locale: string;
|
|
69
|
+
slug: string;
|
|
70
|
+
content: unknown;
|
|
71
|
+
updatedBy: string;
|
|
72
|
+
status?: 'draft' | 'published';
|
|
73
|
+
draftsEnabled?: boolean;
|
|
74
|
+
}): Promise<EntryRow>;
|
|
75
|
+
findShellById(id: string): Promise<EntryShell | null>;
|
|
76
|
+
findById(id: string, locale?: string): Promise<EntryRow | null>;
|
|
77
|
+
/** Returns every locale row for an entry — used by the admin to render the locale picker. */
|
|
78
|
+
listLocales(id: string): Promise<EntryLocaleSummary[]>;
|
|
79
|
+
findBySlug(collection: string, slug: string, locale?: string): Promise<EntryRow | null>;
|
|
80
|
+
list(opts: ListOptions): Promise<EntryRow[]>;
|
|
81
|
+
tree(collection: string, locale?: string): Promise<EntryNode[]>;
|
|
82
|
+
move(collection: string, id: string, input: {
|
|
83
|
+
parentId: string | null;
|
|
84
|
+
sortOrder?: number;
|
|
85
|
+
}): Promise<EntryShell>;
|
|
86
|
+
updateWithRevision(id: string, patch: {
|
|
87
|
+
locale?: string;
|
|
88
|
+
content?: unknown;
|
|
89
|
+
status?: 'draft' | 'published';
|
|
90
|
+
slug?: string;
|
|
91
|
+
updatedBy: string;
|
|
92
|
+
changeSummary?: string;
|
|
93
|
+
publish?: boolean;
|
|
94
|
+
draftsEnabled?: boolean;
|
|
95
|
+
}): Promise<EntryRow>;
|
|
96
|
+
publish(id: string, updatedBy: string, locale?: string): Promise<EntryRow>;
|
|
97
|
+
delete(id: string): Promise<void>;
|
|
98
|
+
/** Delete only one locale of an entry; the entry shell remains if other locales exist. */
|
|
99
|
+
deleteLocale(id: string, locale: string): Promise<void>;
|
|
100
|
+
}
|
|
101
|
+
export {};
|
|
102
|
+
//# sourceMappingURL=entries.d.ts.map
|