dineway 0.1.9 → 0.1.11
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/README.md +63 -17
- package/dist/activity-events-BsMaXdJa.mjs +540 -0
- package/dist/allowed-origins-DG86sH8U.mjs +68 -0
- package/dist/api/route-utils.d.mts +41 -0
- package/dist/api/route-utils.mjs +26 -0
- package/dist/api/schemas/index.d.mts +3 -0
- package/dist/api/schemas/index.mjs +6 -0
- package/dist/api/schemas/setup.d.mts +42 -0
- package/dist/api/schemas/setup.mjs +39 -0
- package/dist/api-Cmy8Rjk5.mjs +2704 -0
- package/dist/api-tokens-Bu3ez1MO.mjs +153 -0
- package/dist/api-tokens-DzloJxuh.mjs +3 -0
- package/dist/{apply-iVSqz2qs.mjs → apply-Co5imxxT.mjs} +15 -689
- package/dist/astro/index.d.mts +10 -6
- package/dist/astro/index.mjs +86 -11
- package/dist/astro/middleware/auth.d.mts +10 -7
- package/dist/astro/middleware/auth.mjs +19 -104
- package/dist/astro/middleware/redirect.mjs +24 -14
- package/dist/astro/middleware/request-context.mjs +9 -6
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.mjs +86 -145
- package/dist/astro/routes/PluginRegistry.d.mts +14 -0
- package/dist/astro/routes/PluginRegistry.mjs +24 -0
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.d.mts +14 -0
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +65 -0
- package/dist/astro/routes/api/admin/allowed-domains/index.d.mts +14 -0
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +65 -0
- package/dist/astro/routes/api/admin/api-tokens/_id_.d.mts +10 -0
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +33 -0
- package/dist/astro/routes/api/admin/api-tokens/index.d.mts +16 -0
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +59 -0
- package/dist/astro/routes/api/admin/briefing.d.mts +7 -0
- package/dist/astro/routes/api/admin/briefing.mjs +71 -0
- package/dist/astro/routes/api/admin/bylines/_id_/index.d.mts +9 -0
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +74 -0
- package/dist/astro/routes/api/admin/bylines/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/bylines/index.mjs +61 -0
- package/dist/astro/routes/api/admin/comments/_id_/status.d.mts +7 -0
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +80 -0
- package/dist/astro/routes/api/admin/comments/_id_.d.mts +14 -0
- package/dist/astro/routes/api/admin/comments/_id_.mjs +46 -0
- package/dist/astro/routes/api/admin/comments/bulk.d.mts +7 -0
- package/dist/astro/routes/api/admin/comments/bulk.mjs +36 -0
- package/dist/astro/routes/api/admin/comments/counts.d.mts +7 -0
- package/dist/astro/routes/api/admin/comments/counts.mjs +24 -0
- package/dist/astro/routes/api/admin/comments/index.d.mts +10 -0
- package/dist/astro/routes/api/admin/comments/index.mjs +40 -0
- package/dist/astro/routes/api/admin/context/_id_/history.d.mts +7 -0
- package/dist/astro/routes/api/admin/context/_id_/history.mjs +45 -0
- package/dist/astro/routes/api/admin/context/_id_/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/context/_id_/index.mjs +45 -0
- package/dist/astro/routes/api/admin/context/_id_/review.d.mts +7 -0
- package/dist/astro/routes/api/admin/context/_id_/review.mjs +60 -0
- package/dist/astro/routes/api/admin/context/_id_/supersede.d.mts +7 -0
- package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +63 -0
- package/dist/astro/routes/api/admin/context/diff.d.mts +7 -0
- package/dist/astro/routes/api/admin/context/diff.mjs +49 -0
- package/dist/astro/routes/api/admin/context/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/context/index.mjs +71 -0
- package/dist/astro/routes/api/admin/context/stale.d.mts +7 -0
- package/dist/astro/routes/api/admin/context/stale.mjs +49 -0
- package/dist/astro/routes/api/admin/hitl-requests/_id_/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +51 -0
- package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.d.mts +7 -0
- package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +67 -0
- package/dist/astro/routes/api/admin/hitl-requests/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/hitl-requests/index.mjs +55 -0
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.d.mts +7 -0
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +98 -0
- package/dist/astro/routes/api/admin/hooks/exclusive/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +33 -0
- package/dist/astro/routes/api/admin/oauth-clients/_id_.d.mts +18 -0
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +79 -0
- package/dist/astro/routes/api/admin/oauth-clients/index.d.mts +14 -0
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +58 -0
- package/dist/astro/routes/api/admin/plugins/_id_/disable.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +89 -0
- package/dist/astro/routes/api/admin/plugins/_id_/enable.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +89 -0
- package/dist/astro/routes/api/admin/plugins/_id_/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +54 -0
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +98 -0
- package/dist/astro/routes/api/admin/plugins/_id_/update.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +131 -0
- package/dist/astro/routes/api/admin/plugins/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/index.mjs +52 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +36 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +54 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +128 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +61 -0
- package/dist/astro/routes/api/admin/plugins/updates.d.mts +7 -0
- package/dist/astro/routes/api/admin/plugins/updates.mjs +52 -0
- package/dist/astro/routes/api/admin/review-requests/_id_/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +26 -0
- package/dist/astro/routes/api/admin/review-requests/_id_/resolve.d.mts +7 -0
- package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +97 -0
- package/dist/astro/routes/api/admin/review-requests/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/review-requests/index.mjs +31 -0
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +54 -0
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.d.mts +7 -0
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +36 -0
- package/dist/astro/routes/api/admin/themes/marketplace/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +70 -0
- package/dist/astro/routes/api/admin/users/_id_/disable.d.mts +7 -0
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +38 -0
- package/dist/astro/routes/api/admin/users/_id_/enable.d.mts +7 -0
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +29 -0
- package/dist/astro/routes/api/admin/users/_id_/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +104 -0
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.d.mts +7 -0
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +43 -0
- package/dist/astro/routes/api/admin/users/index.d.mts +7 -0
- package/dist/astro/routes/api/admin/users/index.mjs +54 -0
- package/dist/astro/routes/api/auth/dev-bypass.d.mts +8 -0
- package/dist/astro/routes/api/auth/dev-bypass.mjs +81 -0
- package/dist/astro/routes/api/auth/invite/accept.d.mts +7 -0
- package/dist/astro/routes/api/auth/invite/accept.mjs +31 -0
- package/dist/astro/routes/api/auth/invite/complete.d.mts +7 -0
- package/dist/astro/routes/api/auth/invite/complete.mjs +54 -0
- package/dist/astro/routes/api/auth/invite/index.d.mts +7 -0
- package/dist/astro/routes/api/auth/invite/index.mjs +51 -0
- package/dist/astro/routes/api/auth/invite/register-options.d.mts +7 -0
- package/dist/astro/routes/api/auth/invite/register-options.mjs +44 -0
- package/dist/astro/routes/api/auth/logout.d.mts +7 -0
- package/dist/astro/routes/api/auth/logout.mjs +24 -0
- package/dist/astro/routes/api/auth/magic-link/send.d.mts +7 -0
- package/dist/astro/routes/api/auth/magic-link/send.mjs +48 -0
- package/dist/astro/routes/api/auth/magic-link/verify.d.mts +7 -0
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +32 -0
- package/dist/astro/routes/api/auth/me.d.mts +13 -0
- package/dist/astro/routes/api/auth/me.mjs +41 -0
- package/dist/astro/routes/api/auth/mode.d.mts +7 -0
- package/dist/astro/routes/api/auth/mode.mjs +28 -0
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.d.mts +7 -0
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +114 -0
- package/dist/astro/routes/api/auth/oauth/_provider_.d.mts +7 -0
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs +58 -0
- package/dist/astro/routes/api/auth/passkey/_id_.d.mts +14 -0
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +62 -0
- package/dist/astro/routes/api/auth/passkey/index.d.mts +7 -0
- package/dist/astro/routes/api/auth/passkey/index.mjs +25 -0
- package/dist/astro/routes/api/auth/passkey/options.d.mts +7 -0
- package/dist/astro/routes/api/auth/passkey/options.mjs +46 -0
- package/dist/astro/routes/api/auth/passkey/register/options.d.mts +7 -0
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +44 -0
- package/dist/astro/routes/api/auth/passkey/register/verify.d.mts +7 -0
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +59 -0
- package/dist/astro/routes/api/auth/passkey/verify.d.mts +7 -0
- package/dist/astro/routes/api/auth/passkey/verify.mjs +47 -0
- package/dist/astro/routes/api/auth/signup/complete.d.mts +7 -0
- package/dist/astro/routes/api/auth/signup/complete.mjs +55 -0
- package/dist/astro/routes/api/auth/signup/request.d.mts +7 -0
- package/dist/astro/routes/api/auth/signup/request.mjs +44 -0
- package/dist/astro/routes/api/auth/signup/verify.d.mts +7 -0
- package/dist/astro/routes/api/auth/signup/verify.mjs +32 -0
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.d.mts +14 -0
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +193 -0
- package/dist/astro/routes/api/content/_collection_/_id_/compare.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +17 -0
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +36 -0
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +39 -0
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +31 -0
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +78 -0
- package/dist/astro/routes/api/content/_collection_/_id_/publish.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +92 -0
- package/dist/astro/routes/api/content/_collection_/_id_/restore.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +36 -0
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +19 -0
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.d.mts +8 -0
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +75 -0
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.d.mts +14 -0
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +85 -0
- package/dist/astro/routes/api/content/_collection_/_id_/translations.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +40 -0
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +36 -0
- package/dist/astro/routes/api/content/_collection_/_id_.d.mts +9 -0
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +114 -0
- package/dist/astro/routes/api/content/_collection_/index.d.mts +8 -0
- package/dist/astro/routes/api/content/_collection_/index.mjs +74 -0
- package/dist/astro/routes/api/content/_collection_/trash.d.mts +7 -0
- package/dist/astro/routes/api/content/_collection_/trash.mjs +23 -0
- package/dist/astro/routes/api/dashboard.d.mts +7 -0
- package/dist/astro/routes/api/dashboard.mjs +26 -0
- package/dist/astro/routes/api/dev/emails.d.mts +8 -0
- package/dist/astro/routes/api/dev/emails.mjs +17 -0
- package/dist/astro/routes/api/health.d.mts +7 -0
- package/dist/astro/routes/api/health.mjs +34 -0
- package/dist/astro/routes/api/import/probe.d.mts +17 -0
- package/dist/astro/routes/api/import/probe.mjs +33 -0
- package/dist/astro/routes/api/import/wordpress/analyze.d.mts +87 -0
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +305 -0
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +37 -0
- package/dist/astro/routes/api/import/wordpress/execute.mjs +197 -0
- package/dist/astro/routes/api/import/wordpress/media.d.mts +35 -0
- package/dist/astro/routes/api/import/wordpress/media.mjs +222 -0
- package/dist/astro/routes/api/import/wordpress/prepare.d.mts +19 -0
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +155 -0
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +21 -0
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +289 -0
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +15 -0
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +69 -0
- package/dist/astro/routes/api/import/wordpress-plugin/callback.d.mts +7 -0
- package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs +28 -0
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +19 -0
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +268 -0
- package/dist/astro/routes/api/manifest.d.mts +7 -0
- package/dist/astro/routes/api/manifest.mjs +50 -0
- package/dist/astro/routes/api/mcp.d.mts +15 -0
- package/dist/astro/routes/api/mcp.mjs +2700 -0
- package/dist/astro/routes/api/media/_id_/confirm.d.mts +10 -0
- package/dist/astro/routes/api/media/_id_/confirm.mjs +59 -0
- package/dist/astro/routes/api/media/_id_.d.mts +22 -0
- package/dist/astro/routes/api/media/_id_.mjs +81 -0
- package/dist/astro/routes/api/media/file/_...key_.d.mts +7 -0
- package/dist/astro/routes/api/media/file/_...key_.mjs +49 -0
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.d.mts +14 -0
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +49 -0
- package/dist/astro/routes/api/media/providers/_providerId_/index.d.mts +14 -0
- package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +72 -0
- package/dist/astro/routes/api/media/providers/index.d.mts +10 -0
- package/dist/astro/routes/api/media/providers/index.mjs +18 -0
- package/dist/astro/routes/api/media/upload-url.d.mts +10 -0
- package/dist/astro/routes/api/media/upload-url.mjs +82 -0
- package/dist/astro/routes/api/media.d.mts +16 -0
- package/dist/astro/routes/api/media.mjs +137 -0
- package/dist/astro/routes/api/menus/_name_/items.d.mts +9 -0
- package/{src/astro/routes/api/menus/[name]/items.ts → dist/astro/routes/api/menus/_name_/items.mjs} +63 -105
- package/dist/astro/routes/api/menus/_name_/reorder.d.mts +7 -0
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +77 -0
- package/dist/astro/routes/api/menus/_name_.d.mts +9 -0
- package/dist/astro/routes/api/menus/_name_.mjs +123 -0
- package/dist/astro/routes/api/menus/index.d.mts +8 -0
- package/dist/astro/routes/api/menus/index.mjs +84 -0
- package/dist/astro/routes/api/oauth/authorize.d.mts +8 -0
- package/dist/astro/routes/api/oauth/authorize.mjs +265 -0
- package/dist/astro/routes/api/oauth/device/authorize.d.mts +7 -0
- package/dist/astro/routes/api/oauth/device/authorize.mjs +30 -0
- package/dist/astro/routes/api/oauth/device/code.d.mts +7 -0
- package/dist/astro/routes/api/oauth/device/code.mjs +34 -0
- package/dist/astro/routes/api/oauth/device/token.d.mts +7 -0
- package/dist/astro/routes/api/oauth/device/token.mjs +45 -0
- package/dist/astro/routes/api/oauth/register.d.mts +8 -0
- package/dist/astro/routes/api/oauth/register.mjs +115 -0
- package/dist/astro/routes/api/oauth/token/refresh.d.mts +7 -0
- package/dist/astro/routes/api/oauth/token/refresh.mjs +28 -0
- package/dist/astro/routes/api/oauth/token/revoke.d.mts +7 -0
- package/dist/astro/routes/api/oauth/token/revoke.mjs +25 -0
- package/dist/astro/routes/api/oauth/token.d.mts +8 -0
- package/dist/astro/routes/api/oauth/token.mjs +138 -0
- package/dist/astro/routes/api/openapi.json.d.mts +7 -0
- package/dist/astro/routes/api/openapi.json.mjs +2638 -0
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.d.mts +11 -0
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +77 -0
- package/dist/astro/routes/api/redirects/404s/index.d.mts +9 -0
- package/dist/astro/routes/api/redirects/404s/index.mjs +62 -0
- package/dist/astro/routes/api/redirects/404s/summary.d.mts +7 -0
- package/dist/astro/routes/api/redirects/404s/summary.mjs +34 -0
- package/dist/astro/routes/api/redirects/_id_.d.mts +9 -0
- package/dist/astro/routes/api/redirects/_id_.mjs +152 -0
- package/dist/astro/routes/api/redirects/index.d.mts +8 -0
- package/dist/astro/routes/api/redirects/index.mjs +97 -0
- package/dist/astro/routes/api/revisions/_revisionId_/index.d.mts +7 -0
- package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +16 -0
- package/dist/astro/routes/api/revisions/_revisionId_/restore.d.mts +7 -0
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +23 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.d.mts +9 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +98 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.d.mts +8 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +80 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.d.mts +7 -0
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +67 -0
- package/dist/astro/routes/api/schema/collections/_slug_/index.d.mts +9 -0
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +97 -0
- package/dist/astro/routes/api/schema/collections/index.d.mts +8 -0
- package/dist/astro/routes/api/schema/collections/index.mjs +77 -0
- package/dist/astro/routes/api/schema/index.d.mts +7 -0
- package/dist/astro/routes/api/schema/index.mjs +79 -0
- package/dist/astro/routes/api/schema/orphans/_slug_.d.mts +7 -0
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +58 -0
- package/dist/astro/routes/api/schema/orphans/index.d.mts +7 -0
- package/dist/astro/routes/api/schema/orphans/index.mjs +53 -0
- package/dist/astro/routes/api/search/enable.d.mts +15 -0
- package/dist/astro/routes/api/search/enable.mjs +55 -0
- package/dist/astro/routes/api/search/index.d.mts +16 -0
- package/dist/astro/routes/api/search/index.mjs +52 -0
- package/dist/astro/routes/api/search/rebuild.d.mts +13 -0
- package/dist/astro/routes/api/search/rebuild.mjs +48 -0
- package/dist/astro/routes/api/search/stats.d.mts +10 -0
- package/dist/astro/routes/api/search/stats.mjs +28 -0
- package/dist/astro/routes/api/search/suggest.d.mts +15 -0
- package/dist/astro/routes/api/search/suggest.mjs +43 -0
- package/dist/astro/routes/api/sections/_slug_.d.mts +9 -0
- package/dist/astro/routes/api/sections/_slug_.mjs +156 -0
- package/dist/astro/routes/api/sections/index.d.mts +8 -0
- package/dist/astro/routes/api/sections/index.mjs +99 -0
- package/dist/astro/routes/api/settings/email.d.mts +17 -0
- package/dist/astro/routes/api/settings/email.mjs +102 -0
- package/dist/astro/routes/api/settings.d.mts +20 -0
- package/dist/astro/routes/api/settings.mjs +101 -0
- package/dist/astro/routes/api/setup/admin-verify.d.mts +7 -0
- package/dist/astro/routes/api/setup/admin-verify.mjs +67 -0
- package/dist/astro/routes/api/setup/admin.d.mts +7 -0
- package/dist/astro/routes/api/setup/admin.mjs +68 -0
- package/dist/astro/routes/api/setup/dev-bypass.d.mts +8 -0
- package/dist/astro/routes/api/setup/dev-bypass.mjs +137 -0
- package/dist/astro/routes/api/setup/dev-reset.d.mts +7 -0
- package/dist/astro/routes/api/setup/dev-reset.mjs +22 -0
- package/dist/astro/routes/api/setup/index.d.mts +7 -0
- package/dist/astro/routes/api/setup/index.mjs +93 -0
- package/dist/astro/routes/api/setup/status.d.mts +7 -0
- package/dist/astro/routes/api/setup/status.mjs +57 -0
- package/dist/astro/routes/api/snapshot.d.mts +7 -0
- package/dist/astro/routes/api/snapshot.mjs +227 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.d.mts +18 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +189 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.d.mts +14 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +113 -0
- package/dist/astro/routes/api/taxonomies/index.d.mts +14 -0
- package/dist/astro/routes/api/taxonomies/index.mjs +103 -0
- package/dist/astro/routes/api/themes/preview.d.mts +7 -0
- package/dist/astro/routes/api/themes/preview.mjs +47 -0
- package/dist/astro/routes/api/typegen.d.mts +17 -0
- package/dist/astro/routes/api/typegen.mjs +75 -0
- package/dist/astro/routes/api/well-known/auth.d.mts +7 -0
- package/dist/astro/routes/api/well-known/auth.mjs +42 -0
- package/dist/astro/routes/api/well-known/oauth-authorization-server.d.mts +7 -0
- package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +33 -0
- package/dist/astro/routes/api/well-known/oauth-protected-resource.d.mts +7 -0
- package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +21 -0
- package/dist/astro/routes/api/widget-areas/_name_/reorder.d.mts +7 -0
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +88 -0
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.d.mts +8 -0
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +158 -0
- package/dist/astro/routes/api/widget-areas/_name_/widgets.d.mts +7 -0
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +104 -0
- package/dist/astro/routes/api/widget-areas/_name_.d.mts +8 -0
- package/dist/astro/routes/api/widget-areas/_name_.mjs +99 -0
- package/dist/astro/routes/api/widget-areas/index.d.mts +8 -0
- package/dist/astro/routes/api/widget-areas/index.mjs +108 -0
- package/dist/astro/routes/api/widget-components.d.mts +7 -0
- package/dist/astro/routes/api/widget-components.mjs +15 -0
- package/dist/astro/routes/robots.txt.d.mts +7 -0
- package/dist/astro/routes/robots.txt.mjs +60 -0
- package/dist/astro/routes/sitemap-_collection_.xml.d.mts +7 -0
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +70 -0
- package/dist/astro/routes/sitemap.xml.d.mts +7 -0
- package/dist/astro/routes/sitemap.xml.mjs +63 -0
- package/dist/astro/types.d.mts +41 -9
- package/dist/auth/providers/github-admin.d.mts +9 -0
- package/dist/auth/providers/github-admin.mjs +27 -0
- package/dist/auth/providers/github.d.mts +12 -0
- package/dist/auth/providers/github.mjs +17 -0
- package/dist/auth/providers/google-admin.d.mts +9 -0
- package/dist/auth/providers/google-admin.mjs +43 -0
- package/dist/auth/providers/google.d.mts +12 -0
- package/dist/auth/providers/google.mjs +17 -0
- package/dist/auth-control-guard-DKUe_1oa.mjs +13 -0
- package/dist/authorize-BBj8C6Y8.mjs +36 -0
- package/dist/briefing-BrXCuMEE.mjs +1294 -0
- package/dist/briefing-ClWw4mc9.mjs +29 -0
- package/dist/{byline-OhH2dlRu.mjs → byline-naZxOPSa.mjs} +3 -3
- package/dist/{bylines-BGpD9_hy.mjs → bylines-BcOPh6Ej.mjs} +20 -53
- package/dist/bylines-HfUKum_j.d.mts +2023 -0
- package/dist/{cache-BdSY-gQN.mjs → cache-DEbQ13c9.mjs} +21 -11
- package/dist/challenge-store-DHMgBGOq.mjs +48 -0
- package/dist/cli/index.mjs +142 -22
- package/dist/client/external-auth-headers.d.mts +1 -1
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.mjs +3 -3
- package/dist/comment-DFO-gWDH.mjs +246 -0
- package/dist/comments-Gy3zLBaP.mjs +186 -0
- package/dist/components-DND2rd3D.mjs +107 -0
- package/dist/{content-DWi4d0rT.mjs → content-CyLkb-qH.mjs} +33 -44
- package/dist/context-bE5Kyvcj.mjs +184 -0
- package/dist/context-nxMyOe3p.mjs +849 -0
- package/dist/context-route-helpers-D-6uCQ0S.mjs +45 -0
- package/dist/context-types-C-LwdAxx.mjs +23 -0
- package/dist/cron-DGzVTtJp.mjs +263 -0
- package/dist/dashboard-DqnYU8EU.mjs +120 -0
- package/dist/db/index.d.mts +3 -3
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/libsql.mjs +3 -3
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/db/sqlite.mjs +1 -2
- package/dist/device-flow-7AhWNwCK.mjs +487 -0
- package/dist/email-console-CgLVZbcn.mjs +36 -0
- package/dist/entity-aliases-C0v-yNET.mjs +51 -0
- package/dist/error-DEGjx2Xw.mjs +435 -0
- package/dist/escape-mNZr4t2A.mjs +8 -0
- package/dist/experimental-workflows-DldxJlqV.mjs +38 -0
- package/dist/fts-manager-B1pTNEG_.mjs +297 -0
- package/dist/hash-CDX7M0ze.mjs +32 -0
- package/dist/hitl-requests-Bx3Bkk9l.mjs +118 -0
- package/dist/hitl-route-helpers-DMmJRS7B.mjs +96 -0
- package/dist/import-DD3f2jkc.mjs +243 -0
- package/dist/import-DVZcYlDp.mjs +1323 -0
- package/dist/index-CkljPf5F.d.mts +227 -0
- package/dist/index.d.mts +15 -11
- package/dist/index.mjs +60 -22
- package/dist/{loader-sMG4TZ-u.mjs → loader-PZnPxFLc.mjs} +42 -5
- package/dist/{manifest-schema-D1MSVnoI.mjs → manifest-schema-DYoCQ5np.mjs} +22 -10
- package/dist/media/index.d.mts +1 -1
- package/dist/media/index.mjs +2 -1
- package/dist/media/local-runtime.d.mts +11 -7
- package/dist/media/local-runtime.mjs +3 -3
- package/dist/{media-DMTr80Gv.mjs → media-_7Fxdu45.mjs} +1 -1
- package/dist/menus-BacxVCCo.mjs +312 -0
- package/dist/menus-CrzHokKj.mjs +3502 -0
- package/dist/normalize-C49G_o1k.mjs +126 -0
- package/dist/oauth-authorization-C1qiw4hd.mjs +283 -0
- package/dist/oauth-clients-CvWatf5p.mjs +298 -0
- package/dist/oauth-state-store-hSdzxsEe.mjs +48 -0
- package/dist/oauth-user-lookup-B4OcmsLV.mjs +25 -0
- package/dist/options-z8VVg1Ll.mjs +114 -0
- package/dist/page/index.d.mts +2 -2
- package/dist/parse-BeQXIt1U.mjs +88 -0
- package/dist/passkey-config-Daqs5fjq.mjs +42 -0
- package/dist/{patterns-CrCYkMBb.mjs → patterns-K0DLqWir.mjs} +53 -1
- package/dist/{placeholder-Cp8g5Emj.mjs → placeholder-C2P5fKa4.mjs} +1 -126
- package/dist/plugins/adapt-sandbox-entry.d.mts +9 -5
- package/dist/plugins/adapt-sandbox-entry.mjs +4 -4
- package/dist/preview-C_4DyVox.mjs +788 -0
- package/dist/public-url-BB_umF5G.mjs +71 -0
- package/dist/{query-kDmwCsHh.mjs → query-RiobVwB5.mjs} +93 -19
- package/dist/rate-limit-CbJoj_fT.mjs +112 -0
- package/dist/{redirect-DnEWAkVg.mjs → redirect-CGl64yOX.mjs} +9 -5
- package/dist/redirect-ClSmMOtC.mjs +16 -0
- package/dist/redirects-B69T59hK.mjs +499 -0
- package/dist/redirects-CqaxraTO.mjs +1070 -0
- package/dist/{registry-C0zjeB9P.mjs → registry-C-_hxLqa.mjs} +26 -294
- package/dist/request-meta-Bd0mQfiS.mjs +130 -0
- package/dist/review-requests-C2DIHwlJ.mjs +148 -0
- package/dist/review-requests-DIyjw-K_.mjs +79 -0
- package/dist/{runner-CFI6B6J2.d.mts → runner-9eIQXuc2.d.mts} +1 -1
- package/dist/{index-yvc6E_17.d.mts → runtime-C4-7y7xK.d.mts} +1539 -2007
- package/dist/runtime.d.mts +10 -6
- package/dist/runtime.mjs +3 -3
- package/dist/schema-BNpI53of.mjs +40 -0
- package/dist/search-DM6CVti3.mjs +337 -0
- package/dist/secrets-dI8zzTV7.mjs +160 -0
- package/dist/sections-DZFyAQXd.mjs +338 -0
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +18 -13
- package/dist/seo/index.d.mts +1 -1
- package/dist/seo-BBgTCOYU.mjs +85 -0
- package/dist/seo-CUQctrog.mjs +129 -0
- package/dist/service-CSfcQguB.mjs +194 -0
- package/dist/settings-4XnpVMOS.mjs +223 -0
- package/dist/settings-Bw93cLfe.mjs +50 -0
- package/dist/setup-complete-DidsDQ1e.mjs +21 -0
- package/dist/setup-nonce-pml1PMKo.mjs +17 -0
- package/dist/sidecar-client-vzwV98K4.mjs +66 -0
- package/dist/site-activity-B8FjLIVh.mjs +104 -0
- package/dist/site-context-Bpu_Paur.mjs +4122 -0
- package/dist/site-url-CYIcO0Tj.mjs +12 -0
- package/dist/slugify-PDTDtMXp.mjs +30 -0
- package/dist/ssrf-CmM76lLV.mjs +248 -0
- package/dist/storage/local.d.mts +1 -1
- package/dist/storage/local.mjs +1 -1
- package/dist/storage/s3.d.mts +1 -1
- package/dist/storage/s3.mjs +2 -2
- package/dist/{taxonomies-1s5PaS_8.mjs → taxonomies-BvBgfzn3.mjs} +11 -7
- package/dist/taxonomies-CpqGcIJD.mjs +355 -0
- package/dist/taxonomy-D5cbhc8u.mjs +165 -0
- package/dist/{tokens-CJz9ubV6.mjs → tokens-DLTo4dO2.mjs} +1 -1
- package/dist/{transport-DB5eDN4x.mjs → transport-C9e_h-BF.mjs} +5 -4
- package/dist/trusted-proxy-Bi0Cuk5n.mjs +30 -0
- package/dist/{types-BawVha09.mjs → types-Bs6lTBBW.mjs} +1 -1
- package/dist/types-C982qI5I.d.mts +344 -0
- package/dist/types-D4XVOt01.d.mts +165 -0
- package/dist/{types-Cj0KMIZV.d.mts → types-DgfUZqcd.d.mts} +54 -16
- package/dist/{types-BuMDPy5C.d.mts → types-IPACEM14.d.mts} +6 -0
- package/dist/user-CcXq-zoL.mjs +154 -0
- package/dist/utils-D2in-zwy.mjs +285 -0
- package/dist/{validate-BZ5wnLLp.mjs → validate-BJgA6TW_.mjs} +1 -1
- package/dist/{validate-IPf8n4Fj.d.mts → validate-JCZihRIa.d.mts} +3 -3
- package/dist/version-DH53KCQd.mjs +6 -0
- package/dist/widgets-B7Q_7bxN.mjs +104 -0
- package/dist/wordpress-slugs-BevajWrC.mjs +14 -0
- package/dist/zod-generator-DBVP8D0P.mjs +132 -0
- package/locals.d.ts +1 -6
- package/package.json +67 -11
- package/src/components/DinewayHead.astro +8 -4
- package/src/components/DinewayImage.astro +7 -5
- package/src/components/DinewayMedia.astro +9 -3
- package/src/components/Gallery.astro +5 -3
- package/src/components/Image.astro +5 -1
- package/src/components/InlinePortableTextEditor.tsx +68 -19
- package/dist/error-BmL6QipT.mjs +0 -30
- package/dist/search-DxopAWxs.mjs +0 -11200
- package/dist/version-BPz1imu2.mjs +0 -6
- package/src/astro/routes/PluginRegistry.tsx +0 -21
- package/src/astro/routes/api/admin/allowed-domains/[domain].ts +0 -112
- package/src/astro/routes/api/admin/allowed-domains/index.ts +0 -108
- package/src/astro/routes/api/admin/api-tokens/[id].ts +0 -44
- package/src/astro/routes/api/admin/api-tokens/index.ts +0 -90
- package/src/astro/routes/api/admin/briefing.ts +0 -76
- package/src/astro/routes/api/admin/bylines/[id]/index.ts +0 -90
- package/src/astro/routes/api/admin/bylines/index.ts +0 -74
- package/src/astro/routes/api/admin/comments/[id]/status.ts +0 -120
- package/src/astro/routes/api/admin/comments/[id].ts +0 -64
- package/src/astro/routes/api/admin/comments/bulk.ts +0 -42
- package/src/astro/routes/api/admin/comments/counts.ts +0 -30
- package/src/astro/routes/api/admin/comments/index.ts +0 -46
- package/src/astro/routes/api/admin/context/[id]/history.ts +0 -35
- package/src/astro/routes/api/admin/context/[id]/index.ts +0 -35
- package/src/astro/routes/api/admin/context/[id]/review.ts +0 -57
- package/src/astro/routes/api/admin/context/[id]/supersede.ts +0 -58
- package/src/astro/routes/api/admin/context/diff.ts +0 -35
- package/src/astro/routes/api/admin/context/index.ts +0 -69
- package/src/astro/routes/api/admin/context/stale.ts +0 -35
- package/src/astro/routes/api/admin/hitl-requests/[id]/index.ts +0 -38
- package/src/astro/routes/api/admin/hitl-requests/[id]/resolve.ts +0 -54
- package/src/astro/routes/api/admin/hitl-requests/index.ts +0 -38
- package/src/astro/routes/api/admin/hooks/exclusive/[hookName].ts +0 -132
- package/src/astro/routes/api/admin/hooks/exclusive/index.ts +0 -51
- package/src/astro/routes/api/admin/oauth-clients/[id].ts +0 -137
- package/src/astro/routes/api/admin/oauth-clients/index.ts +0 -95
- package/src/astro/routes/api/admin/plugins/[id]/disable.ts +0 -91
- package/src/astro/routes/api/admin/plugins/[id]/enable.ts +0 -91
- package/src/astro/routes/api/admin/plugins/[id]/index.ts +0 -38
- package/src/astro/routes/api/admin/plugins/[id]/uninstall.ts +0 -98
- package/src/astro/routes/api/admin/plugins/[id]/update.ts +0 -154
- package/src/astro/routes/api/admin/plugins/index.ts +0 -32
- package/src/astro/routes/api/admin/plugins/marketplace/[id]/icon.ts +0 -62
- package/src/astro/routes/api/admin/plugins/marketplace/[id]/index.ts +0 -33
- package/src/astro/routes/api/admin/plugins/marketplace/[id]/install.ts +0 -135
- package/src/astro/routes/api/admin/plugins/marketplace/index.ts +0 -38
- package/src/astro/routes/api/admin/plugins/updates.ts +0 -28
- package/src/astro/routes/api/admin/review-requests/[id]/index.ts +0 -35
- package/src/astro/routes/api/admin/review-requests/[id]/resolve.ts +0 -52
- package/src/astro/routes/api/admin/review-requests/index.ts +0 -35
- package/src/astro/routes/api/admin/themes/marketplace/[id]/index.ts +0 -33
- package/src/astro/routes/api/admin/themes/marketplace/[id]/thumbnail.ts +0 -62
- package/src/astro/routes/api/admin/themes/marketplace/index.ts +0 -45
- package/src/astro/routes/api/admin/users/[id]/disable.ts +0 -72
- package/src/astro/routes/api/admin/users/[id]/enable.ts +0 -48
- package/src/astro/routes/api/admin/users/[id]/index.ts +0 -166
- package/src/astro/routes/api/admin/users/[id]/send-recovery.ts +0 -72
- package/src/astro/routes/api/admin/users/index.ts +0 -66
- package/src/astro/routes/api/auth/dev-bypass.ts +0 -139
- package/src/astro/routes/api/auth/invite/accept.ts +0 -52
- package/src/astro/routes/api/auth/invite/complete.ts +0 -86
- package/src/astro/routes/api/auth/invite/index.ts +0 -99
- package/src/astro/routes/api/auth/invite/register-options.ts +0 -73
- package/src/astro/routes/api/auth/logout.ts +0 -40
- package/src/astro/routes/api/auth/magic-link/send.ts +0 -90
- package/src/astro/routes/api/auth/magic-link/verify.ts +0 -71
- package/src/astro/routes/api/auth/me.ts +0 -60
- package/src/astro/routes/api/auth/oauth/[provider]/callback.ts +0 -221
- package/src/astro/routes/api/auth/oauth/[provider].ts +0 -120
- package/src/astro/routes/api/auth/passkey/[id].ts +0 -124
- package/src/astro/routes/api/auth/passkey/index.ts +0 -54
- package/src/astro/routes/api/auth/passkey/options.ts +0 -85
- package/src/astro/routes/api/auth/passkey/register/options.ts +0 -88
- package/src/astro/routes/api/auth/passkey/register/verify.ts +0 -119
- package/src/astro/routes/api/auth/passkey/verify.ts +0 -72
- package/src/astro/routes/api/auth/signup/complete.ts +0 -87
- package/src/astro/routes/api/auth/signup/request.ts +0 -89
- package/src/astro/routes/api/auth/signup/verify.ts +0 -53
- package/src/astro/routes/api/comments/[collection]/[contentId]/index.ts +0 -310
- package/src/astro/routes/api/content/[collection]/[id]/compare.ts +0 -28
- package/src/astro/routes/api/content/[collection]/[id]/discard-draft.ts +0 -68
- package/src/astro/routes/api/content/[collection]/[id]/duplicate.ts +0 -77
- package/src/astro/routes/api/content/[collection]/[id]/permanent.ts +0 -42
- package/src/astro/routes/api/content/[collection]/[id]/preview-url.ts +0 -107
- package/src/astro/routes/api/content/[collection]/[id]/publish.ts +0 -100
- package/src/astro/routes/api/content/[collection]/[id]/restore.ts +0 -64
- package/src/astro/routes/api/content/[collection]/[id]/revisions.ts +0 -31
- package/src/astro/routes/api/content/[collection]/[id]/schedule.ts +0 -129
- package/src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts +0 -143
- package/src/astro/routes/api/content/[collection]/[id]/translations.ts +0 -50
- package/src/astro/routes/api/content/[collection]/[id]/unpublish.ts +0 -69
- package/src/astro/routes/api/content/[collection]/[id].ts +0 -173
- package/src/astro/routes/api/content/[collection]/index.ts +0 -103
- package/src/astro/routes/api/content/[collection]/trash.ts +0 -33
- package/src/astro/routes/api/dashboard.ts +0 -32
- package/src/astro/routes/api/dev/emails.ts +0 -36
- package/src/astro/routes/api/health.ts +0 -54
- package/src/astro/routes/api/import/probe.ts +0 -47
- package/src/astro/routes/api/import/wordpress/analyze.ts +0 -523
- package/src/astro/routes/api/import/wordpress/execute.ts +0 -330
- package/src/astro/routes/api/import/wordpress/media.ts +0 -338
- package/src/astro/routes/api/import/wordpress/prepare.ts +0 -212
- package/src/astro/routes/api/import/wordpress/rewrite-urls.ts +0 -425
- package/src/astro/routes/api/import/wordpress-plugin/analyze.ts +0 -111
- package/src/astro/routes/api/import/wordpress-plugin/callback.ts +0 -58
- package/src/astro/routes/api/import/wordpress-plugin/execute.ts +0 -399
- package/src/astro/routes/api/manifest.ts +0 -75
- package/src/astro/routes/api/mcp.ts +0 -125
- package/src/astro/routes/api/media/[id]/confirm.ts +0 -93
- package/src/astro/routes/api/media/[id].ts +0 -145
- package/src/astro/routes/api/media/file/[...key].ts +0 -79
- package/src/astro/routes/api/media/providers/[providerId]/[itemId].ts +0 -91
- package/src/astro/routes/api/media/providers/[providerId]/index.ts +0 -111
- package/src/astro/routes/api/media/providers/index.ts +0 -30
- package/src/astro/routes/api/media/upload-url.ts +0 -146
- package/src/astro/routes/api/media.ts +0 -204
- package/src/astro/routes/api/menus/[name]/reorder.ts +0 -79
- package/src/astro/routes/api/menus/[name].ts +0 -145
- package/src/astro/routes/api/menus/index.ts +0 -91
- package/src/astro/routes/api/oauth/authorize.ts +0 -430
- package/src/astro/routes/api/oauth/device/authorize.ts +0 -45
- package/src/astro/routes/api/oauth/device/code.ts +0 -56
- package/src/astro/routes/api/oauth/device/token.ts +0 -70
- package/src/astro/routes/api/oauth/register.ts +0 -182
- package/src/astro/routes/api/oauth/token/refresh.ts +0 -38
- package/src/astro/routes/api/oauth/token/revoke.ts +0 -38
- package/src/astro/routes/api/oauth/token.ts +0 -195
- package/src/astro/routes/api/openapi.json.ts +0 -33
- package/src/astro/routes/api/plugins/[pluginId]/[...path].ts +0 -109
- package/src/astro/routes/api/redirects/404s/index.ts +0 -72
- package/src/astro/routes/api/redirects/404s/summary.ts +0 -33
- package/src/astro/routes/api/redirects/[id].ts +0 -183
- package/src/astro/routes/api/redirects/index.ts +0 -100
- package/src/astro/routes/api/revisions/[revisionId]/index.ts +0 -29
- package/src/astro/routes/api/revisions/[revisionId]/restore.ts +0 -62
- package/src/astro/routes/api/schema/collections/[slug]/fields/[fieldSlug].ts +0 -104
- package/src/astro/routes/api/schema/collections/[slug]/fields/index.ts +0 -67
- package/src/astro/routes/api/schema/collections/[slug]/fields/reorder.ts +0 -45
- package/src/astro/routes/api/schema/collections/[slug]/index.ts +0 -107
- package/src/astro/routes/api/schema/collections/index.ts +0 -61
- package/src/astro/routes/api/schema/index.ts +0 -109
- package/src/astro/routes/api/schema/orphans/[slug].ts +0 -36
- package/src/astro/routes/api/schema/orphans/index.ts +0 -26
- package/src/astro/routes/api/search/enable.ts +0 -64
- package/src/astro/routes/api/search/index.ts +0 -52
- package/src/astro/routes/api/search/rebuild.ts +0 -72
- package/src/astro/routes/api/search/stats.ts +0 -35
- package/src/astro/routes/api/search/suggest.ts +0 -50
- package/src/astro/routes/api/sections/[slug].ts +0 -203
- package/src/astro/routes/api/sections/index.ts +0 -107
- package/src/astro/routes/api/settings/email.ts +0 -150
- package/src/astro/routes/api/settings.ts +0 -116
- package/src/astro/routes/api/setup/admin-verify.ts +0 -122
- package/src/astro/routes/api/setup/admin.ts +0 -104
- package/src/astro/routes/api/setup/dev-bypass.ts +0 -200
- package/src/astro/routes/api/setup/dev-reset.ts +0 -40
- package/src/astro/routes/api/setup/index.ts +0 -128
- package/src/astro/routes/api/setup/status.ts +0 -122
- package/src/astro/routes/api/snapshot.ts +0 -76
- package/src/astro/routes/api/taxonomies/[name]/terms/[slug].ts +0 -232
- package/src/astro/routes/api/taxonomies/[name]/terms/index.ts +0 -131
- package/src/astro/routes/api/taxonomies/index.ts +0 -114
- package/src/astro/routes/api/themes/preview.ts +0 -78
- package/src/astro/routes/api/typegen.ts +0 -114
- package/src/astro/routes/api/well-known/auth.ts +0 -71
- package/src/astro/routes/api/well-known/oauth-authorization-server.ts +0 -48
- package/src/astro/routes/api/well-known/oauth-protected-resource.ts +0 -39
- package/src/astro/routes/api/widget-areas/[name]/reorder.ts +0 -114
- package/src/astro/routes/api/widget-areas/[name]/widgets/[id].ts +0 -213
- package/src/astro/routes/api/widget-areas/[name]/widgets.ts +0 -126
- package/src/astro/routes/api/widget-areas/[name].ts +0 -135
- package/src/astro/routes/api/widget-areas/index.ts +0 -149
- package/src/astro/routes/api/widget-components.ts +0 -22
- package/src/astro/routes/robots.txt.ts +0 -81
- package/src/astro/routes/sitemap-[collection].xml.ts +0 -104
- package/src/astro/routes/sitemap.xml.ts +0 -92
- /package/dist/{adapters-C2ypTrZZ.d.mts → adapters-BLDldpJg.d.mts} +0 -0
- /package/{src → dist}/astro/routes/admin.astro +0 -0
- /package/dist/{base64-F8-DUraK.mjs → base64-Cz-aU0X1.mjs} +0 -0
- /package/dist/{chunks--4F8ddV4.mjs → chunks-D_jVet6z.mjs} +0 -0
- /package/dist/{config-BXwuX8Bx.mjs → config-CAMFxGaV.mjs} +0 -0
- /package/dist/{db-errors-CEqD7qH9.mjs → db-errors-DKUg_NgF.mjs} +0 -0
- /package/dist/{default-VjJyuuG9.mjs → default-C3PZN-bz.mjs} +0 -0
- /package/dist/{load-Coc9HpHH.mjs → load-D-9NhLmF.mjs} +0 -0
- /package/dist/{mode-47goXBBK.mjs → mode-C80mAZQv.mjs} +0 -0
- /package/dist/{placeholder--wOi4TbO.d.mts → placeholder-CHkLckzK.d.mts} +0 -0
- /package/dist/{request-cache-Dk5qPSOx.mjs → request-cache-DHMRr2Lf.mjs} +0 -0
- /package/dist/{transaction-Cn2rjY78.mjs → transaction-x2tJQ-A1.mjs} +0 -0
- /package/dist/{transport-Wge_IzKl.d.mts → transport-6RefuBdV.d.mts} +0 -0
- /package/dist/{types-griIBQOQ.mjs → types-B9gKVOHk.mjs} +0 -0
- /package/dist/{types-CWbdtiux.d.mts → types-B9qVtiHb.d.mts} +0 -0
- /package/dist/{types-COeOq9nK.mjs → types-DL7Y8D_t.mjs} +0 -0
- /package/dist/{types-BzcUjoqg.d.mts → types-Djdp0cZO.d.mts} +0 -0
- /package/dist/{types-DOrVigru.d.mts → types-Du8jreyC.d.mts} +0 -0
|
@@ -0,0 +1,2638 @@
|
|
|
1
|
+
import { n as VERSION } from "../../../version-DH53KCQd.mjs";
|
|
2
|
+
import { r as handleError } from "../../../error-DEGjx2Xw.mjs";
|
|
3
|
+
import { $t as contentListQuery, A as searchRebuildBody, B as updateSectionBody, Bt as mediaConfirmResponseSchema, C as userDetailSchema, D as usersListQuery, Dt as fieldListResponseSchema, E as userUpdateBody, Et as createFieldBody, F as siteSettingsSchema, Ft as updateCollectionBody, G as termGetResponseSchema, H as createTermBody, I as createSectionBody, It as updateFieldBody, Jt as mediaUploadUrlBody, K as termListResponseSchema, Kt as mediaResponseSchema, L as sectionListResponseSchema, Lt as DEFAULT_MAX_UPLOAD_SIZE, Mt as orphanedTableListResponseSchema, N as searchSuggestQuery, O as searchEnableBody, Ot as fieldReorderBody, P as settingsUpdateBody, Q as createMenuItemBody, Qt as contentItemSchema, R as sectionSchema, S as allowedDomainUpdateBody, Sn as apiErrorSchema, St as collectionResponseSchema, T as userSchema, Tn as deleteResponseSchema, Tt as createCollectionBody, Ut as mediaListQuery, Vt as mediaExistingResponseSchema, W as taxonomyListResponseSchema, Wt as mediaListResponseSchema, X as updateTermBody, Xt as contentCompareResponseSchema, Yt as mediaUploadUrlResponseSchema, Z as createMenuBody, Zt as contentCreateBody, _ as widgetAreaSchema, _t as createCommentBody, a as notFoundPruneBody, at as reorderMenuItemsBody, b as widgetSchema, bt as collectionGetQuery, d as redirectsListQuery, dn as contentUpdateBody, dt as commentBulkBody, en as contentListResponseSchema, et as menuItemSchema, f as updateRedirectBody, ft as commentBulkResponseSchema, g as updateWidgetBody, gt as commentStatusBody, h as reorderWidgetsBody, ht as commentSchema, i as notFoundListResponseSchema, in as contentScheduleBody, it as menuWithItemsSchema, j as searchResponseSchema, jn as successEnvelope, jt as orphanRegisterBody, k as searchQuery, kt as fieldResponseSchema, l as redirectListResponseSchema, ln as contentTranslationsResponseSchema, m as createWidgetBody, mt as commentListQuery, nn as contentPublishBody, nt as menuListItemSchema, ot as updateMenuBody, p as createWidgetAreaBody, pn as trashedContentListResponseSchema, pt as commentCountsResponseSchema, q as termResponseSchema, qt as mediaUpdateBody, r as notFoundListQuery, rn as contentResponseSchema, s as notFoundSummaryResponseSchema, sn as contentTermsBody, st as updateMenuItemBody, t as createRedirectBody, u as redirectSchema, un as contentTrashQuery, ut as adminCommentListResponseSchema, v as widgetAreaWithWidgetsAndCountSchema, vt as publicCommentListResponseSchema, w as userListResponseSchema, wt as collectionWithFieldsResponseSchema, x as allowedDomainCreateBody, xt as collectionListResponseSchema, y as widgetAreaWithWidgetsSchema, z as sectionsListQuery, zt as mediaConfirmBody } from "../../../redirects-CqaxraTO.mjs";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { globalRegistry } from "zod/v4/core";
|
|
6
|
+
import { globalRegistry as globalRegistry$1, object, registry, toJSONSchema } from "zod/v4";
|
|
7
|
+
|
|
8
|
+
//#region ../../node_modules/.pnpm/zod-openapi@5.4.6_zod@4.3.6/node_modules/zod-openapi/dist/components-DiNDbisK.mjs
|
|
9
|
+
const isAnyZodType = (schema) => typeof schema === "object" && schema !== null && "_zod" in schema;
|
|
10
|
+
const createExamples = (examples, registry$1, path) => {
|
|
11
|
+
if (!examples) return;
|
|
12
|
+
const examplesObject = {};
|
|
13
|
+
for (const [name, example] of Object.entries(examples)) examplesObject[name] = registry$1.addExample(example, [...path, name]);
|
|
14
|
+
return examplesObject;
|
|
15
|
+
};
|
|
16
|
+
const createMediaTypeObject = (mediaType, ctx, path) => {
|
|
17
|
+
const { schema, examples, ...rest } = mediaType;
|
|
18
|
+
const mediaTypeObject = rest;
|
|
19
|
+
if (isAnyZodType(schema)) mediaTypeObject.schema = ctx.registry.addSchema(schema, [...path, "schema"], {
|
|
20
|
+
io: ctx.io,
|
|
21
|
+
source: { type: "mediaType" }
|
|
22
|
+
});
|
|
23
|
+
else mediaTypeObject.schema = schema;
|
|
24
|
+
if (examples) mediaTypeObject.examples = createExamples(examples, ctx.registry, [...path, "examples"]);
|
|
25
|
+
return mediaTypeObject;
|
|
26
|
+
};
|
|
27
|
+
const createContent = (content, ctx, path) => {
|
|
28
|
+
const contentObject = {};
|
|
29
|
+
for (const [mediaType, mediaTypeObject] of Object.entries(content)) if (mediaTypeObject) contentObject[mediaType] = createMediaTypeObject(mediaTypeObject, ctx, [...path, mediaType]);
|
|
30
|
+
return contentObject;
|
|
31
|
+
};
|
|
32
|
+
const unwrapZodObject = (zodType, io, path) => {
|
|
33
|
+
const def = zodType._zod.def;
|
|
34
|
+
switch (def.type) {
|
|
35
|
+
case "object": return zodType;
|
|
36
|
+
case "lazy": return unwrapZodObject(def.getter(), io, path);
|
|
37
|
+
case "pipe":
|
|
38
|
+
if (io === "input") return unwrapZodObject(def.in, io, path);
|
|
39
|
+
return unwrapZodObject(def.out, io, path);
|
|
40
|
+
}
|
|
41
|
+
throw new Error(`Failed to unwrap ZodObject from type: ${zodType._zod.def.type} at ${path.join(" > ")}`);
|
|
42
|
+
};
|
|
43
|
+
const isRequired = (zodType, io) => {
|
|
44
|
+
if (io === "input") return zodType._zod.optin === void 0;
|
|
45
|
+
return zodType._zod.optout === void 0;
|
|
46
|
+
};
|
|
47
|
+
const createHeaders = (headers, registry$1, path) => {
|
|
48
|
+
if (!headers) return;
|
|
49
|
+
if (isAnyZodType(headers)) {
|
|
50
|
+
const zodObject = unwrapZodObject(headers, "output", path);
|
|
51
|
+
const headersObject = {};
|
|
52
|
+
for (const [key, zodSchema] of Object.entries(zodObject._zod.def.shape)) headersObject[key] = registry$1.addHeader(zodSchema, [...path, key]);
|
|
53
|
+
return headersObject;
|
|
54
|
+
}
|
|
55
|
+
return headers;
|
|
56
|
+
};
|
|
57
|
+
const createLinks = (links, registry$1, path) => {
|
|
58
|
+
if (!links) return;
|
|
59
|
+
const linksObject = {};
|
|
60
|
+
for (const [name, link] of Object.entries(links)) linksObject[name] = registry$1.addLink(link, [...path, name]);
|
|
61
|
+
return linksObject;
|
|
62
|
+
};
|
|
63
|
+
const createManualParameters = (parameters, registry$1, path) => {
|
|
64
|
+
if (!parameters) return;
|
|
65
|
+
const parameterObjects = [];
|
|
66
|
+
for (const parameter of parameters) {
|
|
67
|
+
if (isAnyZodType(parameter)) {
|
|
68
|
+
const paramObject = registry$1.addParameter(parameter, [...path, "parameters"]);
|
|
69
|
+
parameterObjects.push(paramObject);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
parameterObjects.push(parameter);
|
|
73
|
+
}
|
|
74
|
+
return parameterObjects;
|
|
75
|
+
};
|
|
76
|
+
const createParameters = (requestParams, registry$1, path) => {
|
|
77
|
+
if (!requestParams) return;
|
|
78
|
+
const parameterObjects = [];
|
|
79
|
+
for (const [location, schema] of Object.entries(requestParams ?? {})) {
|
|
80
|
+
const zodObject = unwrapZodObject(schema, "input", path);
|
|
81
|
+
for (const [name, zodSchema] of Object.entries(zodObject._zod.def.shape)) {
|
|
82
|
+
const paramObject = registry$1.addParameter(zodSchema, [
|
|
83
|
+
...path,
|
|
84
|
+
location,
|
|
85
|
+
name
|
|
86
|
+
], { location: {
|
|
87
|
+
in: location,
|
|
88
|
+
name
|
|
89
|
+
} });
|
|
90
|
+
parameterObjects.push(paramObject);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return parameterObjects;
|
|
94
|
+
};
|
|
95
|
+
const isISpecificationExtension = (key) => key.startsWith("x-");
|
|
96
|
+
const createCallbacks = (callbacks, registry$1, path) => {
|
|
97
|
+
if (!callbacks) return;
|
|
98
|
+
const callbacksObject = {};
|
|
99
|
+
for (const [name, value] of Object.entries(callbacks)) {
|
|
100
|
+
if (isISpecificationExtension(name)) {
|
|
101
|
+
callbacksObject[name] = value;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
callbacksObject[name] = registry$1.addCallback(value, [...path, name]);
|
|
105
|
+
}
|
|
106
|
+
return callbacksObject;
|
|
107
|
+
};
|
|
108
|
+
const createResponses = (responses, registry$1, path) => {
|
|
109
|
+
if (!responses) return;
|
|
110
|
+
const responsesObject = {};
|
|
111
|
+
for (const [statusCode, response] of Object.entries(responses)) {
|
|
112
|
+
if (!response) continue;
|
|
113
|
+
if (isISpecificationExtension(statusCode)) {
|
|
114
|
+
responsesObject[statusCode] = response;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if ("$ref" in response) {
|
|
118
|
+
responsesObject[statusCode] = response;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
responsesObject[statusCode] = registry$1.addResponse(response, [...path, statusCode]);
|
|
122
|
+
}
|
|
123
|
+
return responsesObject;
|
|
124
|
+
};
|
|
125
|
+
const createOperation = (operation, registry$1, path) => {
|
|
126
|
+
const { parameters, requestParams, requestBody, responses, callbacks, ...rest } = operation;
|
|
127
|
+
const operationObject = rest;
|
|
128
|
+
const maybeManualParameters = createManualParameters(parameters, registry$1, [...path, "parameters"]);
|
|
129
|
+
const maybeRequestParams = createParameters(requestParams, registry$1, [...path, "requestParams"]);
|
|
130
|
+
if (maybeRequestParams || maybeManualParameters) operationObject.parameters = [...maybeRequestParams ?? [], ...maybeManualParameters ?? []];
|
|
131
|
+
const maybeRequestBody = requestBody && registry$1.addRequestBody(requestBody, path);
|
|
132
|
+
if (maybeRequestBody) operationObject.requestBody = maybeRequestBody;
|
|
133
|
+
const maybeResponses = createResponses(responses, registry$1, [...path, "responses"]);
|
|
134
|
+
if (maybeResponses) operationObject.responses = maybeResponses;
|
|
135
|
+
const maybeCallbacks = createCallbacks(callbacks, registry$1, [...path, "callbacks"]);
|
|
136
|
+
if (maybeCallbacks) operationObject.callbacks = maybeCallbacks;
|
|
137
|
+
return operationObject;
|
|
138
|
+
};
|
|
139
|
+
const createPaths = (paths, registry$1, path) => {
|
|
140
|
+
if (!paths) return;
|
|
141
|
+
const pathsObject = {};
|
|
142
|
+
for (const [singlePath, pathItemObject] of Object.entries(paths)) {
|
|
143
|
+
if (isISpecificationExtension(singlePath)) {
|
|
144
|
+
pathsObject[singlePath] = pathItemObject;
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
pathsObject[singlePath] = registry$1.addPathItem(pathItemObject, [...path, singlePath]);
|
|
148
|
+
}
|
|
149
|
+
return pathsObject;
|
|
150
|
+
};
|
|
151
|
+
const openApiVersions = [
|
|
152
|
+
"3.0.0",
|
|
153
|
+
"3.0.1",
|
|
154
|
+
"3.0.2",
|
|
155
|
+
"3.0.3",
|
|
156
|
+
"3.1.0",
|
|
157
|
+
"3.1.1"
|
|
158
|
+
];
|
|
159
|
+
const satisfiesVersion = (test, against) => openApiVersions.indexOf(test) >= openApiVersions.indexOf(against);
|
|
160
|
+
const override = (ctx) => {
|
|
161
|
+
const def = ctx.zodSchema._zod.def;
|
|
162
|
+
switch (def.type) {
|
|
163
|
+
case "bigint":
|
|
164
|
+
ctx.jsonSchema.type = "integer";
|
|
165
|
+
ctx.jsonSchema.format = "int64";
|
|
166
|
+
break;
|
|
167
|
+
case "union": {
|
|
168
|
+
if ("discriminator" in def && typeof def.discriminator === "string") {
|
|
169
|
+
ctx.jsonSchema.oneOf ??= ctx.jsonSchema.anyOf;
|
|
170
|
+
delete ctx.jsonSchema.anyOf;
|
|
171
|
+
ctx.jsonSchema.type = "object";
|
|
172
|
+
ctx.jsonSchema.discriminator = { propertyName: def.discriminator };
|
|
173
|
+
const mapping = {};
|
|
174
|
+
for (const [index, obj] of Object.entries(ctx.jsonSchema.oneOf)) {
|
|
175
|
+
const ref = obj.$ref;
|
|
176
|
+
if (!ref) {
|
|
177
|
+
delete ctx.jsonSchema.discriminator;
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const discriminatorValues = def.options[Number(index)]._zod.propValues?.[def.discriminator];
|
|
181
|
+
if (!discriminatorValues?.size) return;
|
|
182
|
+
for (const value of [...discriminatorValues ?? []]) {
|
|
183
|
+
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") return;
|
|
184
|
+
mapping[String(value)] = ref;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
ctx.jsonSchema.discriminator.mapping = mapping;
|
|
188
|
+
}
|
|
189
|
+
const meta = globalRegistry$1.get(ctx.zodSchema);
|
|
190
|
+
if (typeof meta?.unionOneOf === "boolean") {
|
|
191
|
+
if (meta.unionOneOf) {
|
|
192
|
+
ctx.jsonSchema.oneOf = ctx.jsonSchema.anyOf;
|
|
193
|
+
delete ctx.jsonSchema.anyOf;
|
|
194
|
+
}
|
|
195
|
+
delete ctx.jsonSchema.unionOneOf;
|
|
196
|
+
}
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
case "date":
|
|
200
|
+
ctx.jsonSchema.type = "string";
|
|
201
|
+
break;
|
|
202
|
+
case "literal":
|
|
203
|
+
if (def.values.includes(void 0)) break;
|
|
204
|
+
break;
|
|
205
|
+
case "undefined":
|
|
206
|
+
ctx.jsonSchema.not = {};
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
const validate = (ctx, opts, previousContext) => {
|
|
211
|
+
if (previousContext.context && ctx.zodSchema._zod.parent !== previousContext.context.zodSchema) {
|
|
212
|
+
if (previousContext.context.zodSchema._zod.def.type === "pipe") throw new Error(`Zod transform found at ${previousContext.context.path.join(" > ")} are not supported in output schemas. Please use \`.overwrite()\` or wrap the schema in a \`.pipe()\` or assign it manual metadata with \`.meta()\``);
|
|
213
|
+
throw new Error(`Zod schema of type \`${previousContext.context.zodSchema._zod.def.type}\` at ${previousContext.context?.path.join(" > ")} cannot be represented in OpenAPI. Please assign it metadata with \`.meta()\``);
|
|
214
|
+
}
|
|
215
|
+
previousContext.context = void 0;
|
|
216
|
+
if (Object.keys(ctx.jsonSchema).length) return;
|
|
217
|
+
const def = ctx.zodSchema._zod.def;
|
|
218
|
+
const allowEmptySchema = opts.allowEmptySchema?.[def.type];
|
|
219
|
+
if (allowEmptySchema === true || allowEmptySchema?.[ctx.io]) return;
|
|
220
|
+
switch (def.type) {
|
|
221
|
+
case "optional":
|
|
222
|
+
validate({
|
|
223
|
+
...ctx,
|
|
224
|
+
zodSchema: def.innerType
|
|
225
|
+
}, opts, previousContext);
|
|
226
|
+
return;
|
|
227
|
+
case "any": return;
|
|
228
|
+
case "unknown": return;
|
|
229
|
+
case "pipe":
|
|
230
|
+
if (ctx.io === "output") {
|
|
231
|
+
if (!ctx.zodSchema._zod.parent) {
|
|
232
|
+
previousContext.context = ctx;
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return;
|
|
237
|
+
case "transform":
|
|
238
|
+
if (ctx.io === "output") return;
|
|
239
|
+
break;
|
|
240
|
+
case "literal":
|
|
241
|
+
if (def.values.includes(void 0)) throw new Error(`Zod literal at ${ctx.path.join(" > ")} cannot include \`undefined\` as a value. Please use \`z.undefined()\` or \`.optional()\` instead.`);
|
|
242
|
+
return;
|
|
243
|
+
case "custom": if (!ctx.zodSchema._zod.parent) {
|
|
244
|
+
previousContext.context = ctx;
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
throw new Error(`Zod schema of type \`${def.type}\` at ${ctx.path.join(" > ")} cannot be represented in OpenAPI. Please assign it metadata with \`.meta()\``);
|
|
249
|
+
};
|
|
250
|
+
const renameComponents = (components, outputIds, ctx, refPath) => {
|
|
251
|
+
const componentsToRename = /* @__PURE__ */ new Map();
|
|
252
|
+
if (ctx.io === "input") return componentsToRename;
|
|
253
|
+
const componentDependencies = /* @__PURE__ */ new Map();
|
|
254
|
+
const stringifiedComponents = /* @__PURE__ */ new Map();
|
|
255
|
+
for (const [key, value] of Object.entries(components)) {
|
|
256
|
+
const stringified = JSON.stringify(value);
|
|
257
|
+
const regex = new RegExp(`"${refPath}([^"]+)"`, "g");
|
|
258
|
+
const matches = stringified.matchAll(regex);
|
|
259
|
+
const dependencies = /* @__PURE__ */ new Set();
|
|
260
|
+
for (const match of matches) {
|
|
261
|
+
const dep = match[1];
|
|
262
|
+
if (dep !== key) dependencies.add(dep);
|
|
263
|
+
}
|
|
264
|
+
stringifiedComponents.set(key, stringified);
|
|
265
|
+
componentDependencies.set(key, { dependencies });
|
|
266
|
+
}
|
|
267
|
+
for (const [key] of stringifiedComponents) {
|
|
268
|
+
if (!ctx.registry.components.schemas.ids.get(key)) continue;
|
|
269
|
+
if (isDependencyPure(componentDependencies, stringifiedComponents, ctx.registry, key)) continue;
|
|
270
|
+
const newName = outputIds.get(key) ?? `${key}${ctx.opts.outputIdSuffix ?? "Output"}`;
|
|
271
|
+
componentsToRename.set(key, newName);
|
|
272
|
+
components[newName] = components[key];
|
|
273
|
+
delete components[key];
|
|
274
|
+
}
|
|
275
|
+
return componentsToRename;
|
|
276
|
+
};
|
|
277
|
+
const isDependencyPure = (componentDependencies, stringifiedComponents, registry$1, key, visited = /* @__PURE__ */ new Set()) => {
|
|
278
|
+
if (visited.has(key)) return true;
|
|
279
|
+
const dependencies = componentDependencies.get(key);
|
|
280
|
+
if (dependencies.pure !== void 0) return dependencies.pure;
|
|
281
|
+
const stringified = stringifiedComponents.get(key);
|
|
282
|
+
const component = registry$1.components.schemas.ids.get(key);
|
|
283
|
+
if (component && stringified !== JSON.stringify(component)) {
|
|
284
|
+
dependencies.pure = false;
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
287
|
+
visited.add(key);
|
|
288
|
+
const result = [...dependencies.dependencies].every((dep) => isDependencyPure(componentDependencies, stringifiedComponents, registry$1, dep, new Set(visited)));
|
|
289
|
+
dependencies.pure = result;
|
|
290
|
+
return result;
|
|
291
|
+
};
|
|
292
|
+
const zodOpenApiMetadataFields = [
|
|
293
|
+
"param",
|
|
294
|
+
"header",
|
|
295
|
+
"unusedIO",
|
|
296
|
+
"override",
|
|
297
|
+
"outputId"
|
|
298
|
+
];
|
|
299
|
+
const deleteZodOpenApiMeta = (jsonSchema) => {
|
|
300
|
+
zodOpenApiMetadataFields.forEach((field) => {
|
|
301
|
+
delete jsonSchema[field];
|
|
302
|
+
});
|
|
303
|
+
};
|
|
304
|
+
const deleteInvalidJsonSchemaFields = (jsonSchema) => {
|
|
305
|
+
delete jsonSchema.$schema;
|
|
306
|
+
delete jsonSchema.id;
|
|
307
|
+
delete jsonSchema.$id;
|
|
308
|
+
};
|
|
309
|
+
const createSchemas = (schemas, ctx) => {
|
|
310
|
+
const refPath = ctx.opts.schemaRefPath ?? "#/components/schemas/";
|
|
311
|
+
const entries = {};
|
|
312
|
+
for (const [name, { zodType }] of Object.entries(schemas)) entries[name] = zodType;
|
|
313
|
+
const zodRegistry = registry();
|
|
314
|
+
zodRegistry.add(object(entries), { id: "zodOpenApiCreateSchema" });
|
|
315
|
+
for (const [id, { zodType }] of ctx.registry.components.schemas.manual) zodRegistry.add(zodType, { id });
|
|
316
|
+
const outputIds = /* @__PURE__ */ new Map();
|
|
317
|
+
const defsName = satisfiesVersion(ctx.openapiVersion ?? "3.1.0", "3.1.0") ? "$defs" : "definitions";
|
|
318
|
+
const previousContext = {};
|
|
319
|
+
const jsonSchema = toJSONSchema(zodRegistry, {
|
|
320
|
+
override(context) {
|
|
321
|
+
const meta = globalRegistry$1.get(context.zodSchema);
|
|
322
|
+
if (meta?.outputId && meta?.id) outputIds.set(meta.id, meta.outputId);
|
|
323
|
+
if (context.jsonSchema.$ref) return;
|
|
324
|
+
const enrichedContext = {
|
|
325
|
+
...context,
|
|
326
|
+
io: ctx.io
|
|
327
|
+
};
|
|
328
|
+
override(enrichedContext);
|
|
329
|
+
if (typeof ctx.opts.override === "function") ctx.opts.override(enrichedContext);
|
|
330
|
+
if (typeof meta?.override === "function") {
|
|
331
|
+
meta.override(enrichedContext);
|
|
332
|
+
delete context.jsonSchema.override;
|
|
333
|
+
}
|
|
334
|
+
if (typeof meta?.override === "object" && meta.override !== null) {
|
|
335
|
+
Object.assign(context.jsonSchema, meta.override);
|
|
336
|
+
delete context.jsonSchema.override;
|
|
337
|
+
}
|
|
338
|
+
deleteInvalidJsonSchemaFields(context.jsonSchema);
|
|
339
|
+
deleteZodOpenApiMeta(context.jsonSchema);
|
|
340
|
+
validate(enrichedContext, ctx.opts, previousContext);
|
|
341
|
+
},
|
|
342
|
+
io: ctx.io,
|
|
343
|
+
unrepresentable: "any",
|
|
344
|
+
reused: ctx.opts.reused,
|
|
345
|
+
cycles: ctx.opts.cycles,
|
|
346
|
+
target: satisfiesVersion(ctx.openapiVersion ?? "3.1.0", "3.1.0") ? void 0 : "openapi-3.0",
|
|
347
|
+
uri: (id) => id === "__shared" ? `#ZOD_OPENAPI/${id}` : `#ZOD_OPENAPI/__shared#/${defsName}/${id}`
|
|
348
|
+
});
|
|
349
|
+
const components = jsonSchema.schemas.__shared?.[defsName] ?? {};
|
|
350
|
+
jsonSchema.schemas.__shared ??= { [defsName]: components };
|
|
351
|
+
const dynamicComponents = /* @__PURE__ */ new Map();
|
|
352
|
+
for (const [key, value] of Object.entries(components)) {
|
|
353
|
+
deleteInvalidJsonSchemaFields(value);
|
|
354
|
+
if (/^schema\d+$/.test(key)) {
|
|
355
|
+
const newName = `__schema${ctx.registry.components.schemas.dynamicSchemaCount++}`;
|
|
356
|
+
dynamicComponents.set(key, `"${refPath}${newName}"`);
|
|
357
|
+
if (newName !== key) {
|
|
358
|
+
components[newName] = value;
|
|
359
|
+
delete components[key];
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
for (const [key] of ctx.registry.components.schemas.manual) {
|
|
364
|
+
const manualComponent = jsonSchema.schemas[key];
|
|
365
|
+
if (!manualComponent) continue;
|
|
366
|
+
deleteInvalidJsonSchemaFields(manualComponent);
|
|
367
|
+
}
|
|
368
|
+
const manualUsed = {};
|
|
369
|
+
const parsedJsonSchema = JSON.parse(JSON.stringify(jsonSchema).replace(/"#ZOD_OPENAPI\/__shared#\/(?:\$defs|definitions)\/([^"]+)"/g, (_, match) => {
|
|
370
|
+
const dynamic = dynamicComponents.get(match);
|
|
371
|
+
if (dynamic) return dynamic;
|
|
372
|
+
if (ctx.registry.components.schemas.manual.get(match)) manualUsed[match] = true;
|
|
373
|
+
return `"${refPath}${match}"`;
|
|
374
|
+
}));
|
|
375
|
+
const parsedComponents = parsedJsonSchema.schemas.__shared?.[defsName] ?? {};
|
|
376
|
+
parsedJsonSchema.schemas.__shared ??= { [defsName]: parsedComponents };
|
|
377
|
+
for (const [key] of ctx.registry.components.schemas.manual) {
|
|
378
|
+
const manualComponent = parsedJsonSchema.schemas[key];
|
|
379
|
+
if (!manualComponent) continue;
|
|
380
|
+
if (manualUsed[key]) {
|
|
381
|
+
if (parsedComponents[key]) throw new Error(`Component "${key}" is already registered as a component in the registry`);
|
|
382
|
+
parsedComponents[key] = manualComponent;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
const componentsToRename = renameComponents(parsedComponents, outputIds, ctx, refPath);
|
|
386
|
+
if (!componentsToRename.size) {
|
|
387
|
+
const parsedSchemas = parsedJsonSchema.schemas.zodOpenApiCreateSchema?.properties;
|
|
388
|
+
delete parsedJsonSchema.schemas.zodOpenApiCreateSchema;
|
|
389
|
+
delete parsedJsonSchema.schemas.__shared;
|
|
390
|
+
return {
|
|
391
|
+
schemas: parsedSchemas,
|
|
392
|
+
components: parsedComponents,
|
|
393
|
+
manual: parsedJsonSchema.schemas
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
const renamedJsonSchema = JSON.parse(JSON.stringify(parsedJsonSchema).replace(new RegExp(`"${refPath}([^"]+)"`, "g"), (_, match) => {
|
|
397
|
+
const replacement = componentsToRename.get(match);
|
|
398
|
+
if (replacement) return `"${refPath}${replacement}"`;
|
|
399
|
+
return `"${refPath}${match}"`;
|
|
400
|
+
}));
|
|
401
|
+
const renamedSchemas = renamedJsonSchema.schemas.zodOpenApiCreateSchema?.properties;
|
|
402
|
+
const renamedComponents = renamedJsonSchema.schemas.__shared?.[defsName] ?? {};
|
|
403
|
+
delete renamedJsonSchema.schemas.zodOpenApiCreateSchema;
|
|
404
|
+
delete renamedJsonSchema.schemas.__shared;
|
|
405
|
+
return {
|
|
406
|
+
schemas: renamedSchemas,
|
|
407
|
+
components: renamedComponents,
|
|
408
|
+
manual: renamedJsonSchema.schemas
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
const createRegistry = (components) => {
|
|
412
|
+
const registry$1 = {
|
|
413
|
+
components: {
|
|
414
|
+
schemas: {
|
|
415
|
+
dynamicSchemaCount: 0,
|
|
416
|
+
input: /* @__PURE__ */ new Map(),
|
|
417
|
+
output: /* @__PURE__ */ new Map(),
|
|
418
|
+
ids: /* @__PURE__ */ new Map(),
|
|
419
|
+
manual: /* @__PURE__ */ new Map()
|
|
420
|
+
},
|
|
421
|
+
headers: {
|
|
422
|
+
ids: /* @__PURE__ */ new Map(),
|
|
423
|
+
seen: /* @__PURE__ */ new WeakMap()
|
|
424
|
+
},
|
|
425
|
+
requestBodies: {
|
|
426
|
+
ids: /* @__PURE__ */ new Map(),
|
|
427
|
+
seen: /* @__PURE__ */ new WeakMap()
|
|
428
|
+
},
|
|
429
|
+
responses: {
|
|
430
|
+
ids: /* @__PURE__ */ new Map(),
|
|
431
|
+
seen: /* @__PURE__ */ new WeakMap()
|
|
432
|
+
},
|
|
433
|
+
parameters: {
|
|
434
|
+
ids: /* @__PURE__ */ new Map(),
|
|
435
|
+
seen: /* @__PURE__ */ new WeakMap()
|
|
436
|
+
},
|
|
437
|
+
callbacks: {
|
|
438
|
+
ids: /* @__PURE__ */ new Map(),
|
|
439
|
+
seen: /* @__PURE__ */ new WeakMap()
|
|
440
|
+
},
|
|
441
|
+
pathItems: {
|
|
442
|
+
ids: /* @__PURE__ */ new Map(),
|
|
443
|
+
seen: /* @__PURE__ */ new WeakMap()
|
|
444
|
+
},
|
|
445
|
+
securitySchemes: {
|
|
446
|
+
ids: /* @__PURE__ */ new Map(),
|
|
447
|
+
seen: /* @__PURE__ */ new WeakMap()
|
|
448
|
+
},
|
|
449
|
+
links: {
|
|
450
|
+
ids: /* @__PURE__ */ new Map(),
|
|
451
|
+
seen: /* @__PURE__ */ new WeakMap()
|
|
452
|
+
},
|
|
453
|
+
examples: {
|
|
454
|
+
ids: /* @__PURE__ */ new Map(),
|
|
455
|
+
seen: /* @__PURE__ */ new WeakMap()
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
addSchema: (schema, path, opts) => {
|
|
459
|
+
const schemaObject = {};
|
|
460
|
+
registry$1.components.schemas[opts.io].set(path.join(" > "), {
|
|
461
|
+
schemaObject,
|
|
462
|
+
zodType: schema,
|
|
463
|
+
source: {
|
|
464
|
+
path,
|
|
465
|
+
...opts?.source
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
return schemaObject;
|
|
469
|
+
},
|
|
470
|
+
addParameter: (parameter, path, opts) => {
|
|
471
|
+
const seenParameter = registry$1.components.parameters.seen.get(parameter);
|
|
472
|
+
if (seenParameter) return seenParameter;
|
|
473
|
+
const meta = globalRegistry.get(parameter);
|
|
474
|
+
const name = opts?.location?.name ?? meta?.param?.name;
|
|
475
|
+
const inLocation = opts?.location?.in ?? meta?.param?.in;
|
|
476
|
+
if (opts?.location?.name && meta?.param?.name || opts?.location?.in && meta?.param?.in) throw new Error(`Parameter at ${path.join(" > ")} has both \`.meta({ param: { name, in } })\` and \`.meta({ param: { location: { in, name } } })\` information`);
|
|
477
|
+
if (!name || !inLocation) throw new Error(`Parameter at ${path.join(" > ")} is missing \`.meta({ param: { name, in } })\` information`);
|
|
478
|
+
const schemaObject = registry$1.addSchema(parameter, [
|
|
479
|
+
...path,
|
|
480
|
+
inLocation,
|
|
481
|
+
name,
|
|
482
|
+
"schema"
|
|
483
|
+
], {
|
|
484
|
+
io: "input",
|
|
485
|
+
source: {
|
|
486
|
+
type: "parameter",
|
|
487
|
+
location: {
|
|
488
|
+
in: inLocation,
|
|
489
|
+
name
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
const { id: metaId, examples, ...rest } = meta?.param ?? {};
|
|
494
|
+
const parameterObject = {
|
|
495
|
+
in: inLocation,
|
|
496
|
+
name,
|
|
497
|
+
schema: schemaObject,
|
|
498
|
+
...rest
|
|
499
|
+
};
|
|
500
|
+
const examplesObject = createExamples(examples, registry$1, [
|
|
501
|
+
...path,
|
|
502
|
+
inLocation,
|
|
503
|
+
name,
|
|
504
|
+
"examples"
|
|
505
|
+
]);
|
|
506
|
+
if (examplesObject) parameterObject.examples = examplesObject;
|
|
507
|
+
if (isRequired(parameter, "input")) parameterObject.required = true;
|
|
508
|
+
if (!parameterObject.description && meta?.description) parameterObject.description = meta.description;
|
|
509
|
+
const id = metaId ?? opts?.manualId;
|
|
510
|
+
if (id) {
|
|
511
|
+
if (registry$1.components.parameters.ids.has(id)) throw new Error(`Schema "${id}" at ${path.join(" > ")} is already registered`);
|
|
512
|
+
const ref = { $ref: `#/components/parameters/${id}` };
|
|
513
|
+
registry$1.components.parameters.seen.set(parameter, ref);
|
|
514
|
+
registry$1.components.parameters.ids.set(id, parameterObject);
|
|
515
|
+
if (opts?.manualId) return parameterObject;
|
|
516
|
+
return ref;
|
|
517
|
+
}
|
|
518
|
+
if (opts?.location?.name || opts?.location?.in) return parameterObject;
|
|
519
|
+
registry$1.components.parameters.seen.set(parameter, parameterObject);
|
|
520
|
+
return parameterObject;
|
|
521
|
+
},
|
|
522
|
+
addHeader: (header, path, opts) => {
|
|
523
|
+
const seenHeader = registry$1.components.headers.seen.get(header);
|
|
524
|
+
if (seenHeader) return seenHeader;
|
|
525
|
+
const meta = globalRegistry.get(header);
|
|
526
|
+
const { id: metaId, ...rest } = meta?.header ?? {};
|
|
527
|
+
const id = metaId ?? opts?.manualId;
|
|
528
|
+
const headerObject = rest;
|
|
529
|
+
if (isRequired(header, "output")) headerObject.required = true;
|
|
530
|
+
if (!headerObject.description && meta?.description) headerObject.description = meta.description;
|
|
531
|
+
headerObject.schema = registry$1.addSchema(header, [...path, "schema"], {
|
|
532
|
+
io: "output",
|
|
533
|
+
source: { type: "header" }
|
|
534
|
+
});
|
|
535
|
+
if (id) {
|
|
536
|
+
if (registry$1.components.schemas.ids.has(id)) throw new Error(`Schema "${id}" at ${path.join(" > ")} is already registered`);
|
|
537
|
+
const ref = { $ref: `#/components/headers/${id}` };
|
|
538
|
+
registry$1.components.headers.ids.set(id, headerObject);
|
|
539
|
+
registry$1.components.headers.seen.set(header, ref);
|
|
540
|
+
if (opts?.manualId) return headerObject;
|
|
541
|
+
return ref;
|
|
542
|
+
}
|
|
543
|
+
registry$1.components.headers.seen.set(header, headerObject);
|
|
544
|
+
return headerObject;
|
|
545
|
+
},
|
|
546
|
+
addRequestBody: (requestBody, path, opts) => {
|
|
547
|
+
const seenRequestBody = registry$1.components.requestBodies.seen.get(requestBody);
|
|
548
|
+
if (seenRequestBody) return seenRequestBody;
|
|
549
|
+
const { content, id: metaId, ...rest } = requestBody;
|
|
550
|
+
const requestBodyObject = {
|
|
551
|
+
...rest,
|
|
552
|
+
content: createContent(content, {
|
|
553
|
+
registry: registry$1,
|
|
554
|
+
io: "input"
|
|
555
|
+
}, [...path, "content"])
|
|
556
|
+
};
|
|
557
|
+
const id = metaId ?? opts?.manualId;
|
|
558
|
+
if (id) {
|
|
559
|
+
if (registry$1.components.requestBodies.ids.has(id)) throw new Error(`RequestBody "${id}" at ${path.join(" > ")} is already registered`);
|
|
560
|
+
const ref = { $ref: `#/components/requestBodies/${id}` };
|
|
561
|
+
registry$1.components.requestBodies.ids.set(id, requestBodyObject);
|
|
562
|
+
registry$1.components.requestBodies.seen.set(requestBody, ref);
|
|
563
|
+
if (opts?.manualId) return requestBodyObject;
|
|
564
|
+
return ref;
|
|
565
|
+
}
|
|
566
|
+
registry$1.components.requestBodies.seen.set(requestBody, requestBodyObject);
|
|
567
|
+
return requestBodyObject;
|
|
568
|
+
},
|
|
569
|
+
addPathItem: (pathItem, path, opts) => {
|
|
570
|
+
const seenPathItem = registry$1.components.pathItems.seen.get(pathItem);
|
|
571
|
+
if (seenPathItem) return seenPathItem;
|
|
572
|
+
const pathItemObject = {};
|
|
573
|
+
const { id: metaId, ...rest } = pathItem;
|
|
574
|
+
const id = metaId ?? opts?.manualId;
|
|
575
|
+
for (const [key, value] of Object.entries(rest)) {
|
|
576
|
+
if (isISpecificationExtension(key)) {
|
|
577
|
+
pathItemObject[key] = value;
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
if (key === "get" || key === "put" || key === "post" || key === "delete" || key === "options" || key === "head" || key === "patch" || key === "trace") {
|
|
581
|
+
pathItemObject[key] = createOperation(value, registry$1, [...path, key]);
|
|
582
|
+
continue;
|
|
583
|
+
}
|
|
584
|
+
if (key === "parameters") {
|
|
585
|
+
pathItemObject[key] = createManualParameters(value, registry$1, [...path, key]);
|
|
586
|
+
continue;
|
|
587
|
+
}
|
|
588
|
+
pathItemObject[key] = value;
|
|
589
|
+
}
|
|
590
|
+
if (id) {
|
|
591
|
+
if (registry$1.components.pathItems.ids.has(id)) throw new Error(`PathItem "${id}" at ${path.join(" > ")} is already registered`);
|
|
592
|
+
const ref = { $ref: `#/components/pathItems/${id}` };
|
|
593
|
+
registry$1.components.pathItems.ids.set(id, pathItemObject);
|
|
594
|
+
registry$1.components.pathItems.seen.set(pathItem, ref);
|
|
595
|
+
if (opts?.manualId) return pathItemObject;
|
|
596
|
+
return ref;
|
|
597
|
+
}
|
|
598
|
+
registry$1.components.pathItems.seen.set(pathItem, pathItemObject);
|
|
599
|
+
return pathItemObject;
|
|
600
|
+
},
|
|
601
|
+
addResponse: (response, path, opts) => {
|
|
602
|
+
const seenResponse = registry$1.components.responses.seen.get(response);
|
|
603
|
+
if (seenResponse) return seenResponse;
|
|
604
|
+
const { content, headers, links, id: metaId, ...rest } = response;
|
|
605
|
+
const responseObject = rest;
|
|
606
|
+
const maybeHeaders = createHeaders(headers, registry$1, [...path, "headers"]);
|
|
607
|
+
if (maybeHeaders) responseObject.headers = maybeHeaders;
|
|
608
|
+
if (content) responseObject.content = createContent(content, {
|
|
609
|
+
registry: registry$1,
|
|
610
|
+
io: "output"
|
|
611
|
+
}, [...path, "content"]);
|
|
612
|
+
if (links) responseObject.links = createLinks(links, registry$1, [...path, "links"]);
|
|
613
|
+
const id = metaId ?? opts?.manualId;
|
|
614
|
+
if (id) {
|
|
615
|
+
if (registry$1.components.responses.ids.has(id)) throw new Error(`Response "${id}" at ${path.join(" > ")} is already registered`);
|
|
616
|
+
const ref = { $ref: `#/components/responses/${id}` };
|
|
617
|
+
registry$1.components.responses.ids.set(id, responseObject);
|
|
618
|
+
registry$1.components.responses.seen.set(response, ref);
|
|
619
|
+
if (opts?.manualId) return responseObject;
|
|
620
|
+
return ref;
|
|
621
|
+
}
|
|
622
|
+
registry$1.components.responses.seen.set(response, responseObject);
|
|
623
|
+
return responseObject;
|
|
624
|
+
},
|
|
625
|
+
addCallback: (callback, path, opts) => {
|
|
626
|
+
const seenCallback = registry$1.components.callbacks.seen.get(callback);
|
|
627
|
+
if (seenCallback) return seenCallback;
|
|
628
|
+
const { id: metaId, ...rest } = callback;
|
|
629
|
+
const callbackObject = {};
|
|
630
|
+
for (const [name, pathItem] of Object.entries(rest)) {
|
|
631
|
+
if (isISpecificationExtension(name)) {
|
|
632
|
+
callbackObject[name] = pathItem;
|
|
633
|
+
continue;
|
|
634
|
+
}
|
|
635
|
+
callbackObject[name] = registry$1.addPathItem(pathItem, [...path, name]);
|
|
636
|
+
}
|
|
637
|
+
const id = metaId ?? opts?.manualId;
|
|
638
|
+
if (id) {
|
|
639
|
+
if (registry$1.components.callbacks.ids.has(id)) throw new Error(`Callback "${id}" at ${path.join(" > ")} is already registered`);
|
|
640
|
+
const ref = { $ref: `#/components/callbacks/${id}` };
|
|
641
|
+
registry$1.components.callbacks.ids.set(id, callbackObject);
|
|
642
|
+
registry$1.components.callbacks.seen.set(callback, ref);
|
|
643
|
+
if (opts?.manualId) return callbackObject;
|
|
644
|
+
return ref;
|
|
645
|
+
}
|
|
646
|
+
registry$1.components.callbacks.seen.set(callback, callbackObject);
|
|
647
|
+
return callbackObject;
|
|
648
|
+
},
|
|
649
|
+
addSecurityScheme: (securityScheme, path, opts) => {
|
|
650
|
+
const seenSecurityScheme = registry$1.components.securitySchemes.seen.get(securityScheme);
|
|
651
|
+
if (seenSecurityScheme) return seenSecurityScheme;
|
|
652
|
+
const { id: metaId, ...rest } = securityScheme;
|
|
653
|
+
const securitySchemeObject = rest;
|
|
654
|
+
const id = metaId ?? opts?.manualId;
|
|
655
|
+
if (id) {
|
|
656
|
+
if (registry$1.components.securitySchemes.ids.has(id)) throw new Error(`SecurityScheme "${id}" at ${path.join(" > ")} is already registered`);
|
|
657
|
+
const ref = { $ref: `#/components/securitySchemes/${id}` };
|
|
658
|
+
registry$1.components.securitySchemes.ids.set(id, securitySchemeObject);
|
|
659
|
+
registry$1.components.securitySchemes.seen.set(securityScheme, ref);
|
|
660
|
+
if (opts?.manualId) return securitySchemeObject;
|
|
661
|
+
return ref;
|
|
662
|
+
}
|
|
663
|
+
registry$1.components.securitySchemes.seen.set(securityScheme, securitySchemeObject);
|
|
664
|
+
return securitySchemeObject;
|
|
665
|
+
},
|
|
666
|
+
addLink: (link, path, opts) => {
|
|
667
|
+
const seenLink = registry$1.components.links.seen.get(link);
|
|
668
|
+
if (seenLink) return seenLink;
|
|
669
|
+
const { id: metaId, ...rest } = link;
|
|
670
|
+
const linkObject = rest;
|
|
671
|
+
const id = metaId ?? opts?.manualId;
|
|
672
|
+
if (id) {
|
|
673
|
+
if (registry$1.components.links.ids.has(id)) throw new Error(`Link "${id}" at ${path.join(" > ")} is already registered`);
|
|
674
|
+
const ref = { $ref: `#/components/links/${id}` };
|
|
675
|
+
registry$1.components.links.ids.set(id, linkObject);
|
|
676
|
+
registry$1.components.links.seen.set(link, ref);
|
|
677
|
+
if (opts?.manualId) return linkObject;
|
|
678
|
+
return ref;
|
|
679
|
+
}
|
|
680
|
+
registry$1.components.links.seen.set(link, linkObject);
|
|
681
|
+
return linkObject;
|
|
682
|
+
},
|
|
683
|
+
addExample: (example, path, opts) => {
|
|
684
|
+
const seenExample = registry$1.components.examples.seen.get(example);
|
|
685
|
+
if (seenExample) return seenExample;
|
|
686
|
+
const { id: metaId, ...rest } = example;
|
|
687
|
+
const exampleObject = rest;
|
|
688
|
+
const id = metaId ?? opts?.manualId;
|
|
689
|
+
if (id) {
|
|
690
|
+
if (registry$1.components.examples.ids.has(id)) throw new Error(`Example "${id}" at ${path.join(" > ")} is already registered`);
|
|
691
|
+
const ref = { $ref: `#/components/examples/${id}` };
|
|
692
|
+
registry$1.components.examples.ids.set(id, exampleObject);
|
|
693
|
+
registry$1.components.examples.seen.set(example, ref);
|
|
694
|
+
if (opts?.manualId) return exampleObject;
|
|
695
|
+
return ref;
|
|
696
|
+
}
|
|
697
|
+
registry$1.components.examples.seen.set(example, exampleObject);
|
|
698
|
+
return exampleObject;
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
registerSchemas(components?.schemas, registry$1);
|
|
702
|
+
registerParameters(components?.parameters, registry$1);
|
|
703
|
+
registerHeaders(components?.headers, registry$1);
|
|
704
|
+
registerResponses(components?.responses, registry$1);
|
|
705
|
+
registerPathItems(components?.pathItems, registry$1);
|
|
706
|
+
registerRequestBodies(components?.requestBodies, registry$1);
|
|
707
|
+
registerCallbacks(components?.callbacks, registry$1);
|
|
708
|
+
registerSecuritySchemes(components?.securitySchemes, registry$1);
|
|
709
|
+
registerLinks(components?.links, registry$1);
|
|
710
|
+
registerExamples(components?.examples, registry$1);
|
|
711
|
+
return registry$1;
|
|
712
|
+
};
|
|
713
|
+
const registerSchemas = (schemas, registry$1) => {
|
|
714
|
+
if (!schemas) return;
|
|
715
|
+
for (const [key, schema] of Object.entries(schemas)) {
|
|
716
|
+
if (isAnyZodType(schema)) {
|
|
717
|
+
const id = globalRegistry.get(schema)?.id ?? key;
|
|
718
|
+
registry$1.components.schemas.manual.set(id, {
|
|
719
|
+
input: { schemaObject: {} },
|
|
720
|
+
output: { schemaObject: {} },
|
|
721
|
+
zodType: schema
|
|
722
|
+
});
|
|
723
|
+
continue;
|
|
724
|
+
}
|
|
725
|
+
registry$1.components.schemas.ids.set(key, schema);
|
|
726
|
+
}
|
|
727
|
+
};
|
|
728
|
+
const registerParameters = (parameters, registry$1) => {
|
|
729
|
+
if (!parameters) return;
|
|
730
|
+
for (const [key, schema] of Object.entries(parameters)) {
|
|
731
|
+
if (isAnyZodType(schema)) {
|
|
732
|
+
const path = [
|
|
733
|
+
"components",
|
|
734
|
+
"parameters",
|
|
735
|
+
key
|
|
736
|
+
];
|
|
737
|
+
registry$1.addParameter(schema, path, { manualId: key });
|
|
738
|
+
continue;
|
|
739
|
+
}
|
|
740
|
+
registry$1.components.parameters.ids.set(key, schema);
|
|
741
|
+
}
|
|
742
|
+
};
|
|
743
|
+
const registerHeaders = (headers, registry$1) => {
|
|
744
|
+
if (!headers) return;
|
|
745
|
+
for (const [key, schema] of Object.entries(headers)) {
|
|
746
|
+
if (isAnyZodType(schema)) {
|
|
747
|
+
const path = [
|
|
748
|
+
"components",
|
|
749
|
+
"headers",
|
|
750
|
+
key
|
|
751
|
+
];
|
|
752
|
+
registry$1.addHeader(schema, path, { manualId: key });
|
|
753
|
+
continue;
|
|
754
|
+
}
|
|
755
|
+
registry$1.components.headers.ids.set(key, schema);
|
|
756
|
+
}
|
|
757
|
+
};
|
|
758
|
+
const registerResponses = (responses, registry$1) => {
|
|
759
|
+
if (!responses) return;
|
|
760
|
+
for (const [key, schema] of Object.entries(responses)) {
|
|
761
|
+
const responseObject = registry$1.addResponse(schema, [
|
|
762
|
+
"components",
|
|
763
|
+
"responses",
|
|
764
|
+
key
|
|
765
|
+
], { manualId: key });
|
|
766
|
+
registry$1.components.responses.ids.set(key, responseObject);
|
|
767
|
+
registry$1.components.responses.seen.set(schema, responseObject);
|
|
768
|
+
}
|
|
769
|
+
};
|
|
770
|
+
const registerRequestBodies = (requestBodies, registry$1) => {
|
|
771
|
+
if (!requestBodies) return;
|
|
772
|
+
for (const [key, schema] of Object.entries(requestBodies)) {
|
|
773
|
+
if (isAnyZodType(schema)) {
|
|
774
|
+
registry$1.addRequestBody(schema, [
|
|
775
|
+
"components",
|
|
776
|
+
"requestBodies",
|
|
777
|
+
key
|
|
778
|
+
], { manualId: key });
|
|
779
|
+
continue;
|
|
780
|
+
}
|
|
781
|
+
registry$1.components.requestBodies.ids.set(key, schema);
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
const registerCallbacks = (callbacks, registry$1) => {
|
|
785
|
+
if (!callbacks) return;
|
|
786
|
+
for (const [key, schema] of Object.entries(callbacks)) registry$1.addCallback(schema, [
|
|
787
|
+
"components",
|
|
788
|
+
"callbacks",
|
|
789
|
+
key
|
|
790
|
+
], { manualId: key });
|
|
791
|
+
};
|
|
792
|
+
const registerPathItems = (pathItems, registry$1) => {
|
|
793
|
+
if (!pathItems) return;
|
|
794
|
+
for (const [key, schema] of Object.entries(pathItems)) registry$1.addPathItem(schema, [
|
|
795
|
+
"components",
|
|
796
|
+
"pathItems",
|
|
797
|
+
key
|
|
798
|
+
], { manualId: key });
|
|
799
|
+
};
|
|
800
|
+
const registerSecuritySchemes = (securitySchemes, registry$1) => {
|
|
801
|
+
if (!securitySchemes) return;
|
|
802
|
+
for (const [key, schema] of Object.entries(securitySchemes)) registry$1.addSecurityScheme(schema, [
|
|
803
|
+
"components",
|
|
804
|
+
"securitySchemes",
|
|
805
|
+
key
|
|
806
|
+
], { manualId: key });
|
|
807
|
+
};
|
|
808
|
+
const registerLinks = (links, registry$1) => {
|
|
809
|
+
if (!links) return;
|
|
810
|
+
for (const [key, schema] of Object.entries(links)) registry$1.addLink(schema, [
|
|
811
|
+
"components",
|
|
812
|
+
"links",
|
|
813
|
+
key
|
|
814
|
+
], { manualId: key });
|
|
815
|
+
};
|
|
816
|
+
const registerExamples = (examples, registry$1) => {
|
|
817
|
+
if (!examples) return;
|
|
818
|
+
for (const [key, schema] of Object.entries(examples)) registry$1.components.examples.ids.set(key, schema);
|
|
819
|
+
};
|
|
820
|
+
const createIOSchemas = (ctx) => {
|
|
821
|
+
const { schemas, components, manual } = createSchemas(Object.fromEntries(ctx.registry.components.schemas[ctx.io]), ctx);
|
|
822
|
+
for (const [key, schema] of Object.entries(components)) ctx.registry.components.schemas.ids.set(key, schema);
|
|
823
|
+
for (const [key, schema] of Object.entries(schemas)) {
|
|
824
|
+
const ioSchema = ctx.registry.components.schemas[ctx.io].get(key);
|
|
825
|
+
if (ioSchema) Object.assign(ioSchema.schemaObject, schema);
|
|
826
|
+
}
|
|
827
|
+
for (const [key, value] of Object.entries(manual)) {
|
|
828
|
+
const manualSchema = ctx.registry.components.schemas.manual.get(key);
|
|
829
|
+
if (!manualSchema) continue;
|
|
830
|
+
if (components[key]) manualSchema[ctx.io].used = true;
|
|
831
|
+
Object.assign(manualSchema[ctx.io].schemaObject, value);
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
const createManualSchemas = (registry$1) => {
|
|
835
|
+
for (const [key, value] of registry$1.components.schemas.manual) if (!value.input.used) {
|
|
836
|
+
const schema = value[globalRegistry.get(value.zodType)?.unusedIO ?? "output"].schemaObject;
|
|
837
|
+
registry$1.components.schemas.ids.set(key, schema);
|
|
838
|
+
}
|
|
839
|
+
};
|
|
840
|
+
const createComponents = (registry$1, opts, openapiVersion) => {
|
|
841
|
+
createIOSchemas({
|
|
842
|
+
registry: registry$1,
|
|
843
|
+
io: "input",
|
|
844
|
+
opts,
|
|
845
|
+
openapiVersion
|
|
846
|
+
});
|
|
847
|
+
createIOSchemas({
|
|
848
|
+
registry: registry$1,
|
|
849
|
+
io: "output",
|
|
850
|
+
opts,
|
|
851
|
+
openapiVersion
|
|
852
|
+
});
|
|
853
|
+
createManualSchemas(registry$1);
|
|
854
|
+
const components = {};
|
|
855
|
+
if (registry$1.components.schemas.ids.size > 0) components.schemas = Object.fromEntries(registry$1.components.schemas.ids);
|
|
856
|
+
if (registry$1.components.headers.ids.size > 0) components.headers = Object.fromEntries(registry$1.components.headers.ids);
|
|
857
|
+
if (registry$1.components.requestBodies.ids.size > 0) components.requestBodies = Object.fromEntries(registry$1.components.requestBodies.ids);
|
|
858
|
+
if (registry$1.components.responses.ids.size > 0) components.responses = Object.fromEntries(registry$1.components.responses.ids);
|
|
859
|
+
if (registry$1.components.parameters.ids.size > 0) components.parameters = Object.fromEntries(registry$1.components.parameters.ids);
|
|
860
|
+
if (registry$1.components.callbacks.ids.size > 0) components.callbacks = Object.fromEntries(registry$1.components.callbacks.ids);
|
|
861
|
+
if (registry$1.components.pathItems.ids.size > 0) components.pathItems = Object.fromEntries(registry$1.components.pathItems.ids);
|
|
862
|
+
if (registry$1.components.securitySchemes.ids.size > 0) components.securitySchemes = Object.fromEntries(registry$1.components.securitySchemes.ids);
|
|
863
|
+
if (registry$1.components.links.ids.size > 0) components.links = Object.fromEntries(registry$1.components.links.ids);
|
|
864
|
+
if (registry$1.components.examples.ids.size > 0) components.examples = Object.fromEntries(registry$1.components.examples.ids);
|
|
865
|
+
return components;
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
//#endregion
|
|
869
|
+
//#region ../../node_modules/.pnpm/zod-openapi@5.4.6_zod@4.3.6/node_modules/zod-openapi/dist/index.mjs
|
|
870
|
+
const createDocument = (zodOpenApiObject, opts = {}) => {
|
|
871
|
+
const { paths, webhooks, components, ...rest } = zodOpenApiObject;
|
|
872
|
+
const document = rest;
|
|
873
|
+
const registry = createRegistry(components);
|
|
874
|
+
const createdPaths = createPaths(paths, registry, ["paths"]);
|
|
875
|
+
if (createdPaths) document.paths = createdPaths;
|
|
876
|
+
const createdWebhooks = createPaths(webhooks, registry, ["webhooks"]);
|
|
877
|
+
if (createdWebhooks) document.webhooks = createdWebhooks;
|
|
878
|
+
const createdComponents = createComponents(registry, opts, zodOpenApiObject.openapi);
|
|
879
|
+
if (Object.keys(createdComponents).length > 0) document.components = createdComponents;
|
|
880
|
+
return document;
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
//#endregion
|
|
884
|
+
//#region src/api/openapi/document.ts
|
|
885
|
+
/**
|
|
886
|
+
* OpenAPI 3.1 document generator.
|
|
887
|
+
*
|
|
888
|
+
* Builds the full OpenAPI spec from Zod schemas. The Zod schemas are the
|
|
889
|
+
* single source of truth -- we never hand-write OpenAPI YAML.
|
|
890
|
+
*
|
|
891
|
+
* Covers all public API domains.
|
|
892
|
+
*/
|
|
893
|
+
const JSON_CONTENT = "application/json";
|
|
894
|
+
/** Standard error responses shared across all authenticated endpoints */
|
|
895
|
+
function standardErrors(...codes) {
|
|
896
|
+
const responses = {};
|
|
897
|
+
const errorMap = {
|
|
898
|
+
400: "Bad Request",
|
|
899
|
+
401: "Not authenticated",
|
|
900
|
+
403: "Forbidden",
|
|
901
|
+
404: "Not Found",
|
|
902
|
+
409: "Conflict",
|
|
903
|
+
500: "Internal Server Error"
|
|
904
|
+
};
|
|
905
|
+
for (const code of codes) responses[String(code)] = {
|
|
906
|
+
description: errorMap[code] ?? `Error ${code}`,
|
|
907
|
+
content: { [JSON_CONTENT]: { schema: apiErrorSchema } }
|
|
908
|
+
};
|
|
909
|
+
return responses;
|
|
910
|
+
}
|
|
911
|
+
/** Common auth error responses (401 + 403) */
|
|
912
|
+
const authErrors = standardErrors(401, 403);
|
|
913
|
+
const contentPaths = {
|
|
914
|
+
"/_dineway/api/content/{collection}": {
|
|
915
|
+
get: {
|
|
916
|
+
operationId: "listContent",
|
|
917
|
+
summary: "List content items",
|
|
918
|
+
description: "Returns a paginated list of content items in the specified collection.",
|
|
919
|
+
tags: ["Content"],
|
|
920
|
+
requestParams: {
|
|
921
|
+
path: z.object({ collection: z.string().meta({
|
|
922
|
+
description: "Collection slug",
|
|
923
|
+
example: "posts"
|
|
924
|
+
}) }),
|
|
925
|
+
query: contentListQuery
|
|
926
|
+
},
|
|
927
|
+
responses: {
|
|
928
|
+
"200": {
|
|
929
|
+
description: "Content list",
|
|
930
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(contentListResponseSchema) } }
|
|
931
|
+
},
|
|
932
|
+
...authErrors,
|
|
933
|
+
...standardErrors(500)
|
|
934
|
+
}
|
|
935
|
+
},
|
|
936
|
+
post: {
|
|
937
|
+
operationId: "createContent",
|
|
938
|
+
summary: "Create a content item",
|
|
939
|
+
tags: ["Content"],
|
|
940
|
+
requestParams: { path: z.object({ collection: z.string().meta({ description: "Collection slug" }) }) },
|
|
941
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: contentCreateBody } } },
|
|
942
|
+
responses: {
|
|
943
|
+
"201": {
|
|
944
|
+
description: "Created content item",
|
|
945
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(contentResponseSchema) } }
|
|
946
|
+
},
|
|
947
|
+
...authErrors,
|
|
948
|
+
...standardErrors(400, 500)
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
},
|
|
952
|
+
"/_dineway/api/content/{collection}/{id}": {
|
|
953
|
+
get: {
|
|
954
|
+
operationId: "getContent",
|
|
955
|
+
summary: "Get a content item",
|
|
956
|
+
tags: ["Content"],
|
|
957
|
+
requestParams: {
|
|
958
|
+
path: z.object({
|
|
959
|
+
collection: z.string().meta({ description: "Collection slug" }),
|
|
960
|
+
id: z.string().meta({ description: "Content ID or slug" })
|
|
961
|
+
}),
|
|
962
|
+
query: z.object({ locale: z.string().optional().meta({ description: "Locale filter" }) })
|
|
963
|
+
},
|
|
964
|
+
responses: {
|
|
965
|
+
"200": {
|
|
966
|
+
description: "Content item",
|
|
967
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(contentResponseSchema) } }
|
|
968
|
+
},
|
|
969
|
+
...authErrors,
|
|
970
|
+
...standardErrors(404, 500)
|
|
971
|
+
}
|
|
972
|
+
},
|
|
973
|
+
put: {
|
|
974
|
+
operationId: "updateContent",
|
|
975
|
+
summary: "Update a content item",
|
|
976
|
+
tags: ["Content"],
|
|
977
|
+
requestParams: { path: z.object({
|
|
978
|
+
collection: z.string().meta({ description: "Collection slug" }),
|
|
979
|
+
id: z.string().meta({ description: "Content ID or slug" })
|
|
980
|
+
}) },
|
|
981
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: contentUpdateBody } } },
|
|
982
|
+
responses: {
|
|
983
|
+
"200": {
|
|
984
|
+
description: "Updated content item",
|
|
985
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(contentResponseSchema) } }
|
|
986
|
+
},
|
|
987
|
+
...authErrors,
|
|
988
|
+
...standardErrors(400, 404, 409, 500)
|
|
989
|
+
}
|
|
990
|
+
},
|
|
991
|
+
delete: {
|
|
992
|
+
operationId: "deleteContent",
|
|
993
|
+
summary: "Delete a content item (soft delete)",
|
|
994
|
+
description: "Moves the content item to trash. Use the permanent delete endpoint to remove permanently.",
|
|
995
|
+
tags: ["Content"],
|
|
996
|
+
requestParams: { path: z.object({
|
|
997
|
+
collection: z.string().meta({ description: "Collection slug" }),
|
|
998
|
+
id: z.string().meta({ description: "Content ID or slug" })
|
|
999
|
+
}) },
|
|
1000
|
+
responses: {
|
|
1001
|
+
"200": {
|
|
1002
|
+
description: "Deleted",
|
|
1003
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } }
|
|
1004
|
+
},
|
|
1005
|
+
...authErrors,
|
|
1006
|
+
...standardErrors(404, 500)
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
},
|
|
1010
|
+
"/_dineway/api/content/{collection}/{id}/publish": { post: {
|
|
1011
|
+
operationId: "publishContent",
|
|
1012
|
+
summary: "Publish a content item",
|
|
1013
|
+
tags: ["Content"],
|
|
1014
|
+
requestParams: { path: z.object({
|
|
1015
|
+
collection: z.string().meta({ description: "Collection slug" }),
|
|
1016
|
+
id: z.string().meta({ description: "Content ID or slug" })
|
|
1017
|
+
}) },
|
|
1018
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: contentPublishBody } } },
|
|
1019
|
+
responses: {
|
|
1020
|
+
"200": {
|
|
1021
|
+
description: "Published content item",
|
|
1022
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(contentResponseSchema) } }
|
|
1023
|
+
},
|
|
1024
|
+
...authErrors,
|
|
1025
|
+
...standardErrors(404, 500)
|
|
1026
|
+
}
|
|
1027
|
+
} },
|
|
1028
|
+
"/_dineway/api/content/{collection}/{id}/unpublish": { post: {
|
|
1029
|
+
operationId: "unpublishContent",
|
|
1030
|
+
summary: "Unpublish a content item",
|
|
1031
|
+
description: "Reverts content to draft status.",
|
|
1032
|
+
tags: ["Content"],
|
|
1033
|
+
requestParams: { path: z.object({
|
|
1034
|
+
collection: z.string().meta({ description: "Collection slug" }),
|
|
1035
|
+
id: z.string().meta({ description: "Content ID or slug" })
|
|
1036
|
+
}) },
|
|
1037
|
+
responses: {
|
|
1038
|
+
"200": {
|
|
1039
|
+
description: "Unpublished content item",
|
|
1040
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(contentResponseSchema) } }
|
|
1041
|
+
},
|
|
1042
|
+
...authErrors,
|
|
1043
|
+
...standardErrors(404, 500)
|
|
1044
|
+
}
|
|
1045
|
+
} },
|
|
1046
|
+
"/_dineway/api/content/{collection}/{id}/schedule": {
|
|
1047
|
+
post: {
|
|
1048
|
+
operationId: "scheduleContent",
|
|
1049
|
+
summary: "Schedule content for future publishing",
|
|
1050
|
+
tags: ["Content"],
|
|
1051
|
+
requestParams: { path: z.object({
|
|
1052
|
+
collection: z.string().meta({ description: "Collection slug" }),
|
|
1053
|
+
id: z.string().meta({ description: "Content ID or slug" })
|
|
1054
|
+
}) },
|
|
1055
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: contentScheduleBody } } },
|
|
1056
|
+
responses: {
|
|
1057
|
+
"200": {
|
|
1058
|
+
description: "Scheduled content item",
|
|
1059
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(contentResponseSchema) } }
|
|
1060
|
+
},
|
|
1061
|
+
...authErrors,
|
|
1062
|
+
...standardErrors(400, 404, 500)
|
|
1063
|
+
}
|
|
1064
|
+
},
|
|
1065
|
+
delete: {
|
|
1066
|
+
operationId: "unscheduleContent",
|
|
1067
|
+
summary: "Cancel scheduled publishing",
|
|
1068
|
+
description: "Reverts a scheduled item to draft status.",
|
|
1069
|
+
tags: ["Content"],
|
|
1070
|
+
requestParams: { path: z.object({
|
|
1071
|
+
collection: z.string().meta({ description: "Collection slug" }),
|
|
1072
|
+
id: z.string().meta({ description: "Content ID or slug" })
|
|
1073
|
+
}) },
|
|
1074
|
+
responses: {
|
|
1075
|
+
"200": {
|
|
1076
|
+
description: "Unscheduled content item",
|
|
1077
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(contentResponseSchema) } }
|
|
1078
|
+
},
|
|
1079
|
+
...authErrors,
|
|
1080
|
+
...standardErrors(404, 500)
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
},
|
|
1084
|
+
"/_dineway/api/content/{collection}/{id}/duplicate": { post: {
|
|
1085
|
+
operationId: "duplicateContent",
|
|
1086
|
+
summary: "Duplicate a content item",
|
|
1087
|
+
tags: ["Content"],
|
|
1088
|
+
requestParams: { path: z.object({
|
|
1089
|
+
collection: z.string().meta({ description: "Collection slug" }),
|
|
1090
|
+
id: z.string().meta({ description: "Content ID or slug" })
|
|
1091
|
+
}) },
|
|
1092
|
+
responses: {
|
|
1093
|
+
"201": {
|
|
1094
|
+
description: "Duplicated content item",
|
|
1095
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({ item: contentItemSchema })) } }
|
|
1096
|
+
},
|
|
1097
|
+
...authErrors,
|
|
1098
|
+
...standardErrors(404, 500)
|
|
1099
|
+
}
|
|
1100
|
+
} },
|
|
1101
|
+
"/_dineway/api/content/{collection}/{id}/restore": { post: {
|
|
1102
|
+
operationId: "restoreContent",
|
|
1103
|
+
summary: "Restore a content item from trash",
|
|
1104
|
+
tags: ["Content"],
|
|
1105
|
+
requestParams: { path: z.object({
|
|
1106
|
+
collection: z.string().meta({ description: "Collection slug" }),
|
|
1107
|
+
id: z.string().meta({ description: "Content ID" })
|
|
1108
|
+
}) },
|
|
1109
|
+
responses: {
|
|
1110
|
+
"200": {
|
|
1111
|
+
description: "Restored",
|
|
1112
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({ restored: z.literal(true) })) } }
|
|
1113
|
+
},
|
|
1114
|
+
...authErrors,
|
|
1115
|
+
...standardErrors(404, 500)
|
|
1116
|
+
}
|
|
1117
|
+
} },
|
|
1118
|
+
"/_dineway/api/content/{collection}/{id}/permanent": { delete: {
|
|
1119
|
+
operationId: "permanentDeleteContent",
|
|
1120
|
+
summary: "Permanently delete a content item",
|
|
1121
|
+
description: "Permanently removes a trashed content item. This cannot be undone.",
|
|
1122
|
+
tags: ["Content"],
|
|
1123
|
+
requestParams: { path: z.object({
|
|
1124
|
+
collection: z.string().meta({ description: "Collection slug" }),
|
|
1125
|
+
id: z.string().meta({ description: "Content ID" })
|
|
1126
|
+
}) },
|
|
1127
|
+
responses: {
|
|
1128
|
+
"200": {
|
|
1129
|
+
description: "Permanently deleted",
|
|
1130
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } }
|
|
1131
|
+
},
|
|
1132
|
+
...authErrors,
|
|
1133
|
+
...standardErrors(404, 500)
|
|
1134
|
+
}
|
|
1135
|
+
} },
|
|
1136
|
+
"/_dineway/api/content/{collection}/{id}/compare": { get: {
|
|
1137
|
+
operationId: "compareContent",
|
|
1138
|
+
summary: "Compare live and draft revisions",
|
|
1139
|
+
tags: ["Content"],
|
|
1140
|
+
requestParams: { path: z.object({
|
|
1141
|
+
collection: z.string().meta({ description: "Collection slug" }),
|
|
1142
|
+
id: z.string().meta({ description: "Content ID or slug" })
|
|
1143
|
+
}) },
|
|
1144
|
+
responses: {
|
|
1145
|
+
"200": {
|
|
1146
|
+
description: "Comparison result",
|
|
1147
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(contentCompareResponseSchema) } }
|
|
1148
|
+
},
|
|
1149
|
+
...authErrors,
|
|
1150
|
+
...standardErrors(404, 500)
|
|
1151
|
+
}
|
|
1152
|
+
} },
|
|
1153
|
+
"/_dineway/api/content/{collection}/{id}/discard-draft": { post: {
|
|
1154
|
+
operationId: "discardDraft",
|
|
1155
|
+
summary: "Discard draft changes",
|
|
1156
|
+
description: "Reverts the content item to its live (published) version.",
|
|
1157
|
+
tags: ["Content"],
|
|
1158
|
+
requestParams: { path: z.object({
|
|
1159
|
+
collection: z.string().meta({ description: "Collection slug" }),
|
|
1160
|
+
id: z.string().meta({ description: "Content ID or slug" })
|
|
1161
|
+
}) },
|
|
1162
|
+
responses: {
|
|
1163
|
+
"200": {
|
|
1164
|
+
description: "Content item reverted to live version",
|
|
1165
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(contentResponseSchema) } }
|
|
1166
|
+
},
|
|
1167
|
+
...authErrors,
|
|
1168
|
+
...standardErrors(404, 500)
|
|
1169
|
+
}
|
|
1170
|
+
} },
|
|
1171
|
+
"/_dineway/api/content/{collection}/{id}/translations": { get: {
|
|
1172
|
+
operationId: "getContentTranslations",
|
|
1173
|
+
summary: "Get translations for a content item",
|
|
1174
|
+
tags: ["Content"],
|
|
1175
|
+
requestParams: { path: z.object({
|
|
1176
|
+
collection: z.string().meta({ description: "Collection slug" }),
|
|
1177
|
+
id: z.string().meta({ description: "Content ID or slug" })
|
|
1178
|
+
}) },
|
|
1179
|
+
responses: {
|
|
1180
|
+
"200": {
|
|
1181
|
+
description: "Translation group members",
|
|
1182
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(contentTranslationsResponseSchema) } }
|
|
1183
|
+
},
|
|
1184
|
+
...authErrors,
|
|
1185
|
+
...standardErrors(404, 500)
|
|
1186
|
+
}
|
|
1187
|
+
} },
|
|
1188
|
+
"/_dineway/api/content/{collection}/{id}/terms": { put: {
|
|
1189
|
+
operationId: "setContentTerms",
|
|
1190
|
+
summary: "Set taxonomy terms on a content item",
|
|
1191
|
+
tags: ["Content"],
|
|
1192
|
+
requestParams: { path: z.object({
|
|
1193
|
+
collection: z.string().meta({ description: "Collection slug" }),
|
|
1194
|
+
id: z.string().meta({ description: "Content ID or slug" })
|
|
1195
|
+
}) },
|
|
1196
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: contentTermsBody } } },
|
|
1197
|
+
responses: {
|
|
1198
|
+
"200": {
|
|
1199
|
+
description: "Terms updated",
|
|
1200
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({ termIds: z.array(z.string()) })) } }
|
|
1201
|
+
},
|
|
1202
|
+
...authErrors,
|
|
1203
|
+
...standardErrors(400, 404, 500)
|
|
1204
|
+
}
|
|
1205
|
+
} },
|
|
1206
|
+
"/_dineway/api/content/{collection}/trash": { get: {
|
|
1207
|
+
operationId: "listTrashedContent",
|
|
1208
|
+
summary: "List trashed content items",
|
|
1209
|
+
tags: ["Content"],
|
|
1210
|
+
requestParams: {
|
|
1211
|
+
path: z.object({ collection: z.string().meta({ description: "Collection slug" }) }),
|
|
1212
|
+
query: contentTrashQuery
|
|
1213
|
+
},
|
|
1214
|
+
responses: {
|
|
1215
|
+
"200": {
|
|
1216
|
+
description: "Trashed content list",
|
|
1217
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(trashedContentListResponseSchema) } }
|
|
1218
|
+
},
|
|
1219
|
+
...authErrors,
|
|
1220
|
+
...standardErrors(500)
|
|
1221
|
+
}
|
|
1222
|
+
} }
|
|
1223
|
+
};
|
|
1224
|
+
function buildMediaPaths(maxUploadSize) {
|
|
1225
|
+
return {
|
|
1226
|
+
"/_dineway/api/media": { get: {
|
|
1227
|
+
operationId: "listMedia",
|
|
1228
|
+
summary: "List media items",
|
|
1229
|
+
tags: ["Media"],
|
|
1230
|
+
requestParams: { query: mediaListQuery },
|
|
1231
|
+
responses: {
|
|
1232
|
+
"200": {
|
|
1233
|
+
description: "Media list",
|
|
1234
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(mediaListResponseSchema) } }
|
|
1235
|
+
},
|
|
1236
|
+
...authErrors,
|
|
1237
|
+
...standardErrors(500)
|
|
1238
|
+
}
|
|
1239
|
+
} },
|
|
1240
|
+
"/_dineway/api/media/{id}": {
|
|
1241
|
+
get: {
|
|
1242
|
+
operationId: "getMedia",
|
|
1243
|
+
summary: "Get a media item",
|
|
1244
|
+
tags: ["Media"],
|
|
1245
|
+
requestParams: { path: z.object({ id: z.string().meta({ description: "Media ID" }) }) },
|
|
1246
|
+
responses: {
|
|
1247
|
+
"200": {
|
|
1248
|
+
description: "Media item",
|
|
1249
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(mediaResponseSchema) } }
|
|
1250
|
+
},
|
|
1251
|
+
...authErrors,
|
|
1252
|
+
...standardErrors(404, 500)
|
|
1253
|
+
}
|
|
1254
|
+
},
|
|
1255
|
+
put: {
|
|
1256
|
+
operationId: "updateMedia",
|
|
1257
|
+
summary: "Update media metadata",
|
|
1258
|
+
tags: ["Media"],
|
|
1259
|
+
requestParams: { path: z.object({ id: z.string().meta({ description: "Media ID" }) }) },
|
|
1260
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: mediaUpdateBody } } },
|
|
1261
|
+
responses: {
|
|
1262
|
+
"200": {
|
|
1263
|
+
description: "Updated media item",
|
|
1264
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(mediaResponseSchema) } }
|
|
1265
|
+
},
|
|
1266
|
+
...authErrors,
|
|
1267
|
+
...standardErrors(400, 404, 500)
|
|
1268
|
+
}
|
|
1269
|
+
},
|
|
1270
|
+
delete: {
|
|
1271
|
+
operationId: "deleteMedia",
|
|
1272
|
+
summary: "Delete a media item",
|
|
1273
|
+
tags: ["Media"],
|
|
1274
|
+
requestParams: { path: z.object({ id: z.string().meta({ description: "Media ID" }) }) },
|
|
1275
|
+
responses: {
|
|
1276
|
+
"200": {
|
|
1277
|
+
description: "Deleted",
|
|
1278
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } }
|
|
1279
|
+
},
|
|
1280
|
+
...authErrors,
|
|
1281
|
+
...standardErrors(404, 500)
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
},
|
|
1285
|
+
"/_dineway/api/media/upload-url": { post: {
|
|
1286
|
+
operationId: "getMediaUploadUrl",
|
|
1287
|
+
summary: "Get a signed URL for direct upload",
|
|
1288
|
+
description: "Returns a signed URL for direct-to-storage upload. Creates a pending media record.",
|
|
1289
|
+
tags: ["Media"],
|
|
1290
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: mediaUploadUrlBody(maxUploadSize) } } },
|
|
1291
|
+
responses: {
|
|
1292
|
+
"200": {
|
|
1293
|
+
description: "Upload URL or existing media (deduplication)",
|
|
1294
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.union([mediaUploadUrlResponseSchema, mediaExistingResponseSchema])) } }
|
|
1295
|
+
},
|
|
1296
|
+
...authErrors,
|
|
1297
|
+
...standardErrors(400, 500)
|
|
1298
|
+
}
|
|
1299
|
+
} },
|
|
1300
|
+
"/_dineway/api/media/{id}/confirm": { post: {
|
|
1301
|
+
operationId: "confirmMediaUpload",
|
|
1302
|
+
summary: "Confirm a media upload",
|
|
1303
|
+
description: "Marks a pending media record as ready after the file has been uploaded.",
|
|
1304
|
+
tags: ["Media"],
|
|
1305
|
+
requestParams: { path: z.object({ id: z.string().meta({ description: "Media ID" }) }) },
|
|
1306
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: mediaConfirmBody } } },
|
|
1307
|
+
responses: {
|
|
1308
|
+
"200": {
|
|
1309
|
+
description: "Confirmed media item with URL",
|
|
1310
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(mediaConfirmResponseSchema) } }
|
|
1311
|
+
},
|
|
1312
|
+
...authErrors,
|
|
1313
|
+
...standardErrors(400, 404, 500)
|
|
1314
|
+
}
|
|
1315
|
+
} }
|
|
1316
|
+
};
|
|
1317
|
+
}
|
|
1318
|
+
const schemaPaths = {
|
|
1319
|
+
"/_dineway/api/schema/collections": {
|
|
1320
|
+
get: {
|
|
1321
|
+
operationId: "listCollections",
|
|
1322
|
+
summary: "List all collections",
|
|
1323
|
+
tags: ["Schema"],
|
|
1324
|
+
responses: {
|
|
1325
|
+
"200": {
|
|
1326
|
+
description: "Collection list",
|
|
1327
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(collectionListResponseSchema) } }
|
|
1328
|
+
},
|
|
1329
|
+
...authErrors,
|
|
1330
|
+
...standardErrors(500)
|
|
1331
|
+
}
|
|
1332
|
+
},
|
|
1333
|
+
post: {
|
|
1334
|
+
operationId: "createCollection",
|
|
1335
|
+
summary: "Create a collection",
|
|
1336
|
+
tags: ["Schema"],
|
|
1337
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: createCollectionBody } } },
|
|
1338
|
+
responses: {
|
|
1339
|
+
"201": {
|
|
1340
|
+
description: "Created collection",
|
|
1341
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(collectionResponseSchema) } }
|
|
1342
|
+
},
|
|
1343
|
+
...authErrors,
|
|
1344
|
+
...standardErrors(400, 409, 500)
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
},
|
|
1348
|
+
"/_dineway/api/schema/collections/{slug}": {
|
|
1349
|
+
get: {
|
|
1350
|
+
operationId: "getCollection",
|
|
1351
|
+
summary: "Get a collection",
|
|
1352
|
+
tags: ["Schema"],
|
|
1353
|
+
requestParams: {
|
|
1354
|
+
path: z.object({ slug: z.string().meta({ description: "Collection slug" }) }),
|
|
1355
|
+
query: collectionGetQuery
|
|
1356
|
+
},
|
|
1357
|
+
responses: {
|
|
1358
|
+
"200": {
|
|
1359
|
+
description: "Collection (optionally with fields)",
|
|
1360
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.union([collectionResponseSchema.shape.item, collectionWithFieldsResponseSchema.shape.item])) } }
|
|
1361
|
+
},
|
|
1362
|
+
...authErrors,
|
|
1363
|
+
...standardErrors(404, 500)
|
|
1364
|
+
}
|
|
1365
|
+
},
|
|
1366
|
+
put: {
|
|
1367
|
+
operationId: "updateCollection",
|
|
1368
|
+
summary: "Update a collection",
|
|
1369
|
+
tags: ["Schema"],
|
|
1370
|
+
requestParams: { path: z.object({ slug: z.string().meta({ description: "Collection slug" }) }) },
|
|
1371
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: updateCollectionBody } } },
|
|
1372
|
+
responses: {
|
|
1373
|
+
"200": {
|
|
1374
|
+
description: "Updated collection",
|
|
1375
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(collectionResponseSchema) } }
|
|
1376
|
+
},
|
|
1377
|
+
...authErrors,
|
|
1378
|
+
...standardErrors(400, 404, 500)
|
|
1379
|
+
}
|
|
1380
|
+
},
|
|
1381
|
+
delete: {
|
|
1382
|
+
operationId: "deleteCollection",
|
|
1383
|
+
summary: "Delete a collection",
|
|
1384
|
+
tags: ["Schema"],
|
|
1385
|
+
requestParams: { path: z.object({ slug: z.string().meta({ description: "Collection slug" }) }) },
|
|
1386
|
+
responses: {
|
|
1387
|
+
"200": {
|
|
1388
|
+
description: "Deleted",
|
|
1389
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } }
|
|
1390
|
+
},
|
|
1391
|
+
...authErrors,
|
|
1392
|
+
...standardErrors(404, 500)
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
},
|
|
1396
|
+
"/_dineway/api/schema/collections/{slug}/fields": {
|
|
1397
|
+
get: {
|
|
1398
|
+
operationId: "listFields",
|
|
1399
|
+
summary: "List fields for a collection",
|
|
1400
|
+
tags: ["Schema"],
|
|
1401
|
+
requestParams: { path: z.object({ slug: z.string().meta({ description: "Collection slug" }) }) },
|
|
1402
|
+
responses: {
|
|
1403
|
+
"200": {
|
|
1404
|
+
description: "Field list",
|
|
1405
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(fieldListResponseSchema) } }
|
|
1406
|
+
},
|
|
1407
|
+
...authErrors,
|
|
1408
|
+
...standardErrors(404, 500)
|
|
1409
|
+
}
|
|
1410
|
+
},
|
|
1411
|
+
post: {
|
|
1412
|
+
operationId: "createField",
|
|
1413
|
+
summary: "Create a field",
|
|
1414
|
+
tags: ["Schema"],
|
|
1415
|
+
requestParams: { path: z.object({ slug: z.string().meta({ description: "Collection slug" }) }) },
|
|
1416
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: createFieldBody } } },
|
|
1417
|
+
responses: {
|
|
1418
|
+
"201": {
|
|
1419
|
+
description: "Created field",
|
|
1420
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(fieldResponseSchema) } }
|
|
1421
|
+
},
|
|
1422
|
+
...authErrors,
|
|
1423
|
+
...standardErrors(400, 409, 500)
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
},
|
|
1427
|
+
"/_dineway/api/schema/collections/{slug}/fields/{fieldSlug}": {
|
|
1428
|
+
get: {
|
|
1429
|
+
operationId: "getField",
|
|
1430
|
+
summary: "Get a field",
|
|
1431
|
+
tags: ["Schema"],
|
|
1432
|
+
requestParams: { path: z.object({
|
|
1433
|
+
slug: z.string().meta({ description: "Collection slug" }),
|
|
1434
|
+
fieldSlug: z.string().meta({ description: "Field slug" })
|
|
1435
|
+
}) },
|
|
1436
|
+
responses: {
|
|
1437
|
+
"200": {
|
|
1438
|
+
description: "Field",
|
|
1439
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(fieldResponseSchema) } }
|
|
1440
|
+
},
|
|
1441
|
+
...authErrors,
|
|
1442
|
+
...standardErrors(404, 500)
|
|
1443
|
+
}
|
|
1444
|
+
},
|
|
1445
|
+
put: {
|
|
1446
|
+
operationId: "updateField",
|
|
1447
|
+
summary: "Update a field",
|
|
1448
|
+
tags: ["Schema"],
|
|
1449
|
+
requestParams: { path: z.object({
|
|
1450
|
+
slug: z.string().meta({ description: "Collection slug" }),
|
|
1451
|
+
fieldSlug: z.string().meta({ description: "Field slug" })
|
|
1452
|
+
}) },
|
|
1453
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: updateFieldBody } } },
|
|
1454
|
+
responses: {
|
|
1455
|
+
"200": {
|
|
1456
|
+
description: "Updated field",
|
|
1457
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(fieldResponseSchema) } }
|
|
1458
|
+
},
|
|
1459
|
+
...authErrors,
|
|
1460
|
+
...standardErrors(400, 404, 500)
|
|
1461
|
+
}
|
|
1462
|
+
},
|
|
1463
|
+
delete: {
|
|
1464
|
+
operationId: "deleteField",
|
|
1465
|
+
summary: "Delete a field",
|
|
1466
|
+
tags: ["Schema"],
|
|
1467
|
+
requestParams: { path: z.object({
|
|
1468
|
+
slug: z.string().meta({ description: "Collection slug" }),
|
|
1469
|
+
fieldSlug: z.string().meta({ description: "Field slug" })
|
|
1470
|
+
}) },
|
|
1471
|
+
responses: {
|
|
1472
|
+
"200": {
|
|
1473
|
+
description: "Deleted",
|
|
1474
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } }
|
|
1475
|
+
},
|
|
1476
|
+
...authErrors,
|
|
1477
|
+
...standardErrors(404, 500)
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
},
|
|
1481
|
+
"/_dineway/api/schema/collections/{slug}/fields/reorder": { post: {
|
|
1482
|
+
operationId: "reorderFields",
|
|
1483
|
+
summary: "Reorder fields in a collection",
|
|
1484
|
+
tags: ["Schema"],
|
|
1485
|
+
requestParams: { path: z.object({ slug: z.string().meta({ description: "Collection slug" }) }) },
|
|
1486
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: fieldReorderBody } } },
|
|
1487
|
+
responses: {
|
|
1488
|
+
"200": {
|
|
1489
|
+
description: "Reordered",
|
|
1490
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({ success: z.literal(true) })) } }
|
|
1491
|
+
},
|
|
1492
|
+
...authErrors,
|
|
1493
|
+
...standardErrors(400, 404, 500)
|
|
1494
|
+
}
|
|
1495
|
+
} },
|
|
1496
|
+
"/_dineway/api/schema/orphans": { get: {
|
|
1497
|
+
operationId: "listOrphanedTables",
|
|
1498
|
+
summary: "List orphaned content tables",
|
|
1499
|
+
description: "Finds ec_* tables without matching collection definitions.",
|
|
1500
|
+
tags: ["Schema"],
|
|
1501
|
+
responses: {
|
|
1502
|
+
"200": {
|
|
1503
|
+
description: "Orphaned tables",
|
|
1504
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(orphanedTableListResponseSchema) } }
|
|
1505
|
+
},
|
|
1506
|
+
...authErrors,
|
|
1507
|
+
...standardErrors(500)
|
|
1508
|
+
}
|
|
1509
|
+
} },
|
|
1510
|
+
"/_dineway/api/schema/orphans/{slug}": { post: {
|
|
1511
|
+
operationId: "registerOrphanedTable",
|
|
1512
|
+
summary: "Register an orphaned table as a collection",
|
|
1513
|
+
tags: ["Schema"],
|
|
1514
|
+
requestParams: { path: z.object({ slug: z.string().meta({ description: "Table slug (without ec_ prefix)" }) }) },
|
|
1515
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: orphanRegisterBody } } },
|
|
1516
|
+
responses: {
|
|
1517
|
+
"201": {
|
|
1518
|
+
description: "Registered collection",
|
|
1519
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(collectionResponseSchema) } }
|
|
1520
|
+
},
|
|
1521
|
+
...authErrors,
|
|
1522
|
+
...standardErrors(400, 404, 500)
|
|
1523
|
+
}
|
|
1524
|
+
} }
|
|
1525
|
+
};
|
|
1526
|
+
const commentsPaths = {
|
|
1527
|
+
"/_dineway/api/comments/{collection}/{contentId}": {
|
|
1528
|
+
get: {
|
|
1529
|
+
operationId: "listPublicComments",
|
|
1530
|
+
summary: "List approved comments for content",
|
|
1531
|
+
description: "Public endpoint. Returns approved comments with optional threading.",
|
|
1532
|
+
tags: ["Comments"],
|
|
1533
|
+
requestParams: {
|
|
1534
|
+
path: z.object({
|
|
1535
|
+
collection: z.string().meta({ description: "Collection slug" }),
|
|
1536
|
+
contentId: z.string().meta({ description: "Content ID" })
|
|
1537
|
+
}),
|
|
1538
|
+
query: z.object({
|
|
1539
|
+
limit: z.coerce.number().int().min(1).max(100).optional(),
|
|
1540
|
+
cursor: z.string().optional(),
|
|
1541
|
+
threaded: z.enum(["true", "false"]).transform((v) => v === "true").optional()
|
|
1542
|
+
})
|
|
1543
|
+
},
|
|
1544
|
+
responses: {
|
|
1545
|
+
"200": {
|
|
1546
|
+
description: "Comment list",
|
|
1547
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(publicCommentListResponseSchema) } }
|
|
1548
|
+
},
|
|
1549
|
+
...standardErrors(500)
|
|
1550
|
+
}
|
|
1551
|
+
},
|
|
1552
|
+
post: {
|
|
1553
|
+
operationId: "createComment",
|
|
1554
|
+
summary: "Submit a new comment",
|
|
1555
|
+
description: "Public endpoint. Comment enters moderation queue.",
|
|
1556
|
+
tags: ["Comments"],
|
|
1557
|
+
requestParams: { path: z.object({
|
|
1558
|
+
collection: z.string().meta({ description: "Collection slug" }),
|
|
1559
|
+
contentId: z.string().meta({ description: "Content ID" })
|
|
1560
|
+
}) },
|
|
1561
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: createCommentBody } } },
|
|
1562
|
+
responses: {
|
|
1563
|
+
"201": {
|
|
1564
|
+
description: "Comment created (pending moderation)",
|
|
1565
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({
|
|
1566
|
+
id: z.string(),
|
|
1567
|
+
status: z.string()
|
|
1568
|
+
})) } }
|
|
1569
|
+
},
|
|
1570
|
+
...standardErrors(400, 429, 500)
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
},
|
|
1574
|
+
"/_dineway/api/admin/comments": { get: {
|
|
1575
|
+
operationId: "listAdminComments",
|
|
1576
|
+
summary: "List comments for moderation",
|
|
1577
|
+
tags: ["Comments"],
|
|
1578
|
+
requestParams: { query: commentListQuery },
|
|
1579
|
+
responses: {
|
|
1580
|
+
"200": {
|
|
1581
|
+
description: "Comment moderation inbox",
|
|
1582
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(adminCommentListResponseSchema) } }
|
|
1583
|
+
},
|
|
1584
|
+
...authErrors,
|
|
1585
|
+
...standardErrors(500)
|
|
1586
|
+
}
|
|
1587
|
+
} },
|
|
1588
|
+
"/_dineway/api/admin/comments/counts": { get: {
|
|
1589
|
+
operationId: "getCommentCounts",
|
|
1590
|
+
summary: "Get comment status counts",
|
|
1591
|
+
tags: ["Comments"],
|
|
1592
|
+
responses: {
|
|
1593
|
+
"200": {
|
|
1594
|
+
description: "Counts by status",
|
|
1595
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(commentCountsResponseSchema) } }
|
|
1596
|
+
},
|
|
1597
|
+
...authErrors,
|
|
1598
|
+
...standardErrors(500)
|
|
1599
|
+
}
|
|
1600
|
+
} },
|
|
1601
|
+
"/_dineway/api/admin/comments/bulk": { post: {
|
|
1602
|
+
operationId: "bulkCommentAction",
|
|
1603
|
+
summary: "Bulk approve, spam, trash, or delete comments",
|
|
1604
|
+
tags: ["Comments"],
|
|
1605
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: commentBulkBody } } },
|
|
1606
|
+
responses: {
|
|
1607
|
+
"200": {
|
|
1608
|
+
description: "Bulk action result",
|
|
1609
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(commentBulkResponseSchema) } }
|
|
1610
|
+
},
|
|
1611
|
+
...authErrors,
|
|
1612
|
+
...standardErrors(400, 500)
|
|
1613
|
+
}
|
|
1614
|
+
} },
|
|
1615
|
+
"/_dineway/api/admin/comments/{id}": {
|
|
1616
|
+
get: {
|
|
1617
|
+
operationId: "getComment",
|
|
1618
|
+
summary: "Get a single comment",
|
|
1619
|
+
tags: ["Comments"],
|
|
1620
|
+
requestParams: { path: z.object({ id: z.string().meta({ description: "Comment ID" }) }) },
|
|
1621
|
+
responses: {
|
|
1622
|
+
"200": {
|
|
1623
|
+
description: "Comment",
|
|
1624
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(commentSchema) } }
|
|
1625
|
+
},
|
|
1626
|
+
...authErrors,
|
|
1627
|
+
...standardErrors(404, 500)
|
|
1628
|
+
}
|
|
1629
|
+
},
|
|
1630
|
+
delete: {
|
|
1631
|
+
operationId: "deleteComment",
|
|
1632
|
+
summary: "Permanently delete a comment",
|
|
1633
|
+
tags: ["Comments"],
|
|
1634
|
+
requestParams: { path: z.object({ id: z.string().meta({ description: "Comment ID" }) }) },
|
|
1635
|
+
responses: {
|
|
1636
|
+
"200": {
|
|
1637
|
+
description: "Deleted",
|
|
1638
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } }
|
|
1639
|
+
},
|
|
1640
|
+
...authErrors,
|
|
1641
|
+
...standardErrors(404, 500)
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
},
|
|
1645
|
+
"/_dineway/api/admin/comments/{id}/status": { put: {
|
|
1646
|
+
operationId: "updateCommentStatus",
|
|
1647
|
+
summary: "Change comment status",
|
|
1648
|
+
tags: ["Comments"],
|
|
1649
|
+
requestParams: { path: z.object({ id: z.string().meta({ description: "Comment ID" }) }) },
|
|
1650
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: commentStatusBody } } },
|
|
1651
|
+
responses: {
|
|
1652
|
+
"200": {
|
|
1653
|
+
description: "Updated comment",
|
|
1654
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(commentSchema) } }
|
|
1655
|
+
},
|
|
1656
|
+
...authErrors,
|
|
1657
|
+
...standardErrors(400, 404, 500)
|
|
1658
|
+
}
|
|
1659
|
+
} }
|
|
1660
|
+
};
|
|
1661
|
+
const taxonomyPaths = {
|
|
1662
|
+
"/_dineway/api/taxonomies": { get: {
|
|
1663
|
+
operationId: "listTaxonomies",
|
|
1664
|
+
summary: "List all taxonomy definitions",
|
|
1665
|
+
tags: ["Taxonomies"],
|
|
1666
|
+
responses: {
|
|
1667
|
+
"200": {
|
|
1668
|
+
description: "Taxonomy list",
|
|
1669
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(taxonomyListResponseSchema) } }
|
|
1670
|
+
},
|
|
1671
|
+
...authErrors,
|
|
1672
|
+
...standardErrors(500)
|
|
1673
|
+
}
|
|
1674
|
+
} },
|
|
1675
|
+
"/_dineway/api/taxonomies/{name}/terms": {
|
|
1676
|
+
get: {
|
|
1677
|
+
operationId: "listTerms",
|
|
1678
|
+
summary: "List terms for a taxonomy",
|
|
1679
|
+
description: "Returns a tree for hierarchical taxonomies, flat list otherwise.",
|
|
1680
|
+
tags: ["Taxonomies"],
|
|
1681
|
+
requestParams: { path: z.object({ name: z.string().meta({ description: "Taxonomy name" }) }) },
|
|
1682
|
+
responses: {
|
|
1683
|
+
"200": {
|
|
1684
|
+
description: "Term list",
|
|
1685
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(termListResponseSchema) } }
|
|
1686
|
+
},
|
|
1687
|
+
...authErrors,
|
|
1688
|
+
...standardErrors(404, 500)
|
|
1689
|
+
}
|
|
1690
|
+
},
|
|
1691
|
+
post: {
|
|
1692
|
+
operationId: "createTerm",
|
|
1693
|
+
summary: "Create a term",
|
|
1694
|
+
tags: ["Taxonomies"],
|
|
1695
|
+
requestParams: { path: z.object({ name: z.string().meta({ description: "Taxonomy name" }) }) },
|
|
1696
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: createTermBody } } },
|
|
1697
|
+
responses: {
|
|
1698
|
+
"201": {
|
|
1699
|
+
description: "Created term",
|
|
1700
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(termResponseSchema) } }
|
|
1701
|
+
},
|
|
1702
|
+
...authErrors,
|
|
1703
|
+
...standardErrors(400, 409, 500)
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
},
|
|
1707
|
+
"/_dineway/api/taxonomies/{name}/terms/{slug}": {
|
|
1708
|
+
get: {
|
|
1709
|
+
operationId: "getTerm",
|
|
1710
|
+
summary: "Get a term by slug",
|
|
1711
|
+
tags: ["Taxonomies"],
|
|
1712
|
+
requestParams: { path: z.object({
|
|
1713
|
+
name: z.string().meta({ description: "Taxonomy name" }),
|
|
1714
|
+
slug: z.string().meta({ description: "Term slug" })
|
|
1715
|
+
}) },
|
|
1716
|
+
responses: {
|
|
1717
|
+
"200": {
|
|
1718
|
+
description: "Term with children and count",
|
|
1719
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(termGetResponseSchema) } }
|
|
1720
|
+
},
|
|
1721
|
+
...authErrors,
|
|
1722
|
+
...standardErrors(404, 500)
|
|
1723
|
+
}
|
|
1724
|
+
},
|
|
1725
|
+
put: {
|
|
1726
|
+
operationId: "updateTerm",
|
|
1727
|
+
summary: "Update a term",
|
|
1728
|
+
tags: ["Taxonomies"],
|
|
1729
|
+
requestParams: { path: z.object({
|
|
1730
|
+
name: z.string().meta({ description: "Taxonomy name" }),
|
|
1731
|
+
slug: z.string().meta({ description: "Term slug" })
|
|
1732
|
+
}) },
|
|
1733
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: updateTermBody } } },
|
|
1734
|
+
responses: {
|
|
1735
|
+
"200": {
|
|
1736
|
+
description: "Updated term",
|
|
1737
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(termResponseSchema) } }
|
|
1738
|
+
},
|
|
1739
|
+
...authErrors,
|
|
1740
|
+
...standardErrors(400, 404, 409, 500)
|
|
1741
|
+
}
|
|
1742
|
+
},
|
|
1743
|
+
delete: {
|
|
1744
|
+
operationId: "deleteTerm",
|
|
1745
|
+
summary: "Delete a term",
|
|
1746
|
+
tags: ["Taxonomies"],
|
|
1747
|
+
requestParams: { path: z.object({
|
|
1748
|
+
name: z.string().meta({ description: "Taxonomy name" }),
|
|
1749
|
+
slug: z.string().meta({ description: "Term slug" })
|
|
1750
|
+
}) },
|
|
1751
|
+
responses: {
|
|
1752
|
+
"200": {
|
|
1753
|
+
description: "Deleted",
|
|
1754
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } }
|
|
1755
|
+
},
|
|
1756
|
+
...authErrors,
|
|
1757
|
+
...standardErrors(400, 404, 500)
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
};
|
|
1762
|
+
const menuPaths = {
|
|
1763
|
+
"/_dineway/api/menus": {
|
|
1764
|
+
get: {
|
|
1765
|
+
operationId: "listMenus",
|
|
1766
|
+
summary: "List all menus with item counts",
|
|
1767
|
+
tags: ["Menus"],
|
|
1768
|
+
responses: {
|
|
1769
|
+
"200": {
|
|
1770
|
+
description: "Menu list",
|
|
1771
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.array(menuListItemSchema)) } }
|
|
1772
|
+
},
|
|
1773
|
+
...authErrors,
|
|
1774
|
+
...standardErrors(500)
|
|
1775
|
+
}
|
|
1776
|
+
},
|
|
1777
|
+
post: {
|
|
1778
|
+
operationId: "createMenu",
|
|
1779
|
+
summary: "Create a menu",
|
|
1780
|
+
tags: ["Menus"],
|
|
1781
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: createMenuBody } } },
|
|
1782
|
+
responses: {
|
|
1783
|
+
"201": {
|
|
1784
|
+
description: "Created menu",
|
|
1785
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(menuWithItemsSchema) } }
|
|
1786
|
+
},
|
|
1787
|
+
...authErrors,
|
|
1788
|
+
...standardErrors(400, 409, 500)
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
},
|
|
1792
|
+
"/_dineway/api/menus/{name}": {
|
|
1793
|
+
get: {
|
|
1794
|
+
operationId: "getMenu",
|
|
1795
|
+
summary: "Get a menu with all items",
|
|
1796
|
+
tags: ["Menus"],
|
|
1797
|
+
requestParams: { path: z.object({ name: z.string().meta({ description: "Menu name" }) }) },
|
|
1798
|
+
responses: {
|
|
1799
|
+
"200": {
|
|
1800
|
+
description: "Menu with items",
|
|
1801
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(menuWithItemsSchema) } }
|
|
1802
|
+
},
|
|
1803
|
+
...authErrors,
|
|
1804
|
+
...standardErrors(404, 500)
|
|
1805
|
+
}
|
|
1806
|
+
},
|
|
1807
|
+
put: {
|
|
1808
|
+
operationId: "updateMenu",
|
|
1809
|
+
summary: "Update a menu",
|
|
1810
|
+
tags: ["Menus"],
|
|
1811
|
+
requestParams: { path: z.object({ name: z.string().meta({ description: "Menu name" }) }) },
|
|
1812
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: updateMenuBody } } },
|
|
1813
|
+
responses: {
|
|
1814
|
+
"200": {
|
|
1815
|
+
description: "Updated menu",
|
|
1816
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(menuWithItemsSchema) } }
|
|
1817
|
+
},
|
|
1818
|
+
...authErrors,
|
|
1819
|
+
...standardErrors(404, 500)
|
|
1820
|
+
}
|
|
1821
|
+
},
|
|
1822
|
+
delete: {
|
|
1823
|
+
operationId: "deleteMenu",
|
|
1824
|
+
summary: "Delete a menu and its items",
|
|
1825
|
+
tags: ["Menus"],
|
|
1826
|
+
requestParams: { path: z.object({ name: z.string().meta({ description: "Menu name" }) }) },
|
|
1827
|
+
responses: {
|
|
1828
|
+
"200": {
|
|
1829
|
+
description: "Deleted",
|
|
1830
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } }
|
|
1831
|
+
},
|
|
1832
|
+
...authErrors,
|
|
1833
|
+
...standardErrors(404, 500)
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
},
|
|
1837
|
+
"/_dineway/api/menus/{name}/items": {
|
|
1838
|
+
post: {
|
|
1839
|
+
operationId: "createMenuItem",
|
|
1840
|
+
summary: "Add an item to a menu",
|
|
1841
|
+
tags: ["Menus"],
|
|
1842
|
+
requestParams: { path: z.object({ name: z.string().meta({ description: "Menu name" }) }) },
|
|
1843
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: createMenuItemBody } } },
|
|
1844
|
+
responses: {
|
|
1845
|
+
"201": {
|
|
1846
|
+
description: "Created menu item",
|
|
1847
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(menuItemSchema) } }
|
|
1848
|
+
},
|
|
1849
|
+
...authErrors,
|
|
1850
|
+
...standardErrors(400, 404, 500)
|
|
1851
|
+
}
|
|
1852
|
+
},
|
|
1853
|
+
put: {
|
|
1854
|
+
operationId: "updateMenuItem",
|
|
1855
|
+
summary: "Update a menu item",
|
|
1856
|
+
tags: ["Menus"],
|
|
1857
|
+
requestParams: {
|
|
1858
|
+
path: z.object({ name: z.string().meta({ description: "Menu name" }) }),
|
|
1859
|
+
query: z.object({ id: z.string().meta({ description: "Menu item ID" }) })
|
|
1860
|
+
},
|
|
1861
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: updateMenuItemBody } } },
|
|
1862
|
+
responses: {
|
|
1863
|
+
"200": {
|
|
1864
|
+
description: "Updated menu item",
|
|
1865
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(menuItemSchema) } }
|
|
1866
|
+
},
|
|
1867
|
+
...authErrors,
|
|
1868
|
+
...standardErrors(400, 404, 500)
|
|
1869
|
+
}
|
|
1870
|
+
},
|
|
1871
|
+
delete: {
|
|
1872
|
+
operationId: "deleteMenuItem",
|
|
1873
|
+
summary: "Delete a menu item",
|
|
1874
|
+
tags: ["Menus"],
|
|
1875
|
+
requestParams: {
|
|
1876
|
+
path: z.object({ name: z.string().meta({ description: "Menu name" }) }),
|
|
1877
|
+
query: z.object({ id: z.string().meta({ description: "Menu item ID" }) })
|
|
1878
|
+
},
|
|
1879
|
+
responses: {
|
|
1880
|
+
"200": {
|
|
1881
|
+
description: "Deleted",
|
|
1882
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } }
|
|
1883
|
+
},
|
|
1884
|
+
...authErrors,
|
|
1885
|
+
...standardErrors(404, 500)
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
},
|
|
1889
|
+
"/_dineway/api/menus/{name}/reorder": { post: {
|
|
1890
|
+
operationId: "reorderMenuItems",
|
|
1891
|
+
summary: "Batch reorder menu items",
|
|
1892
|
+
tags: ["Menus"],
|
|
1893
|
+
requestParams: { path: z.object({ name: z.string().meta({ description: "Menu name" }) }) },
|
|
1894
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: reorderMenuItemsBody } } },
|
|
1895
|
+
responses: {
|
|
1896
|
+
"200": {
|
|
1897
|
+
description: "Reordered items",
|
|
1898
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.array(menuItemSchema)) } }
|
|
1899
|
+
},
|
|
1900
|
+
...authErrors,
|
|
1901
|
+
...standardErrors(400, 404, 500)
|
|
1902
|
+
}
|
|
1903
|
+
} }
|
|
1904
|
+
};
|
|
1905
|
+
const sectionPaths = {
|
|
1906
|
+
"/_dineway/api/sections": {
|
|
1907
|
+
get: {
|
|
1908
|
+
operationId: "listSections",
|
|
1909
|
+
summary: "List sections",
|
|
1910
|
+
tags: ["Sections"],
|
|
1911
|
+
requestParams: { query: sectionsListQuery },
|
|
1912
|
+
responses: {
|
|
1913
|
+
"200": {
|
|
1914
|
+
description: "Section list",
|
|
1915
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(sectionListResponseSchema) } }
|
|
1916
|
+
},
|
|
1917
|
+
...authErrors,
|
|
1918
|
+
...standardErrors(500)
|
|
1919
|
+
}
|
|
1920
|
+
},
|
|
1921
|
+
post: {
|
|
1922
|
+
operationId: "createSection",
|
|
1923
|
+
summary: "Create a section",
|
|
1924
|
+
tags: ["Sections"],
|
|
1925
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: createSectionBody } } },
|
|
1926
|
+
responses: {
|
|
1927
|
+
"201": {
|
|
1928
|
+
description: "Created section",
|
|
1929
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(sectionSchema) } }
|
|
1930
|
+
},
|
|
1931
|
+
...authErrors,
|
|
1932
|
+
...standardErrors(400, 409, 500)
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
},
|
|
1936
|
+
"/_dineway/api/sections/{slug}": {
|
|
1937
|
+
get: {
|
|
1938
|
+
operationId: "getSection",
|
|
1939
|
+
summary: "Get a section by slug",
|
|
1940
|
+
tags: ["Sections"],
|
|
1941
|
+
requestParams: { path: z.object({ slug: z.string().meta({ description: "Section slug" }) }) },
|
|
1942
|
+
responses: {
|
|
1943
|
+
"200": {
|
|
1944
|
+
description: "Section",
|
|
1945
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(sectionSchema) } }
|
|
1946
|
+
},
|
|
1947
|
+
...authErrors,
|
|
1948
|
+
...standardErrors(404, 500)
|
|
1949
|
+
}
|
|
1950
|
+
},
|
|
1951
|
+
put: {
|
|
1952
|
+
operationId: "updateSection",
|
|
1953
|
+
summary: "Update a section",
|
|
1954
|
+
tags: ["Sections"],
|
|
1955
|
+
requestParams: { path: z.object({ slug: z.string().meta({ description: "Section slug" }) }) },
|
|
1956
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: updateSectionBody } } },
|
|
1957
|
+
responses: {
|
|
1958
|
+
"200": {
|
|
1959
|
+
description: "Updated section",
|
|
1960
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(sectionSchema) } }
|
|
1961
|
+
},
|
|
1962
|
+
...authErrors,
|
|
1963
|
+
...standardErrors(400, 404, 409, 500)
|
|
1964
|
+
}
|
|
1965
|
+
},
|
|
1966
|
+
delete: {
|
|
1967
|
+
operationId: "deleteSection",
|
|
1968
|
+
summary: "Delete a section",
|
|
1969
|
+
tags: ["Sections"],
|
|
1970
|
+
requestParams: { path: z.object({ slug: z.string().meta({ description: "Section slug" }) }) },
|
|
1971
|
+
responses: {
|
|
1972
|
+
"200": {
|
|
1973
|
+
description: "Deleted",
|
|
1974
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } }
|
|
1975
|
+
},
|
|
1976
|
+
...authErrors,
|
|
1977
|
+
...standardErrors(403, 404, 500)
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
};
|
|
1982
|
+
const widgetPaths = {
|
|
1983
|
+
"/_dineway/api/widget-areas": {
|
|
1984
|
+
get: {
|
|
1985
|
+
operationId: "listWidgetAreas",
|
|
1986
|
+
summary: "List all widget areas",
|
|
1987
|
+
tags: ["Widgets"],
|
|
1988
|
+
responses: {
|
|
1989
|
+
"200": {
|
|
1990
|
+
description: "Widget area list",
|
|
1991
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({ items: z.array(widgetAreaWithWidgetsAndCountSchema) })) } }
|
|
1992
|
+
},
|
|
1993
|
+
...authErrors,
|
|
1994
|
+
...standardErrors(500)
|
|
1995
|
+
}
|
|
1996
|
+
},
|
|
1997
|
+
post: {
|
|
1998
|
+
operationId: "createWidgetArea",
|
|
1999
|
+
summary: "Create a widget area",
|
|
2000
|
+
tags: ["Widgets"],
|
|
2001
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: createWidgetAreaBody } } },
|
|
2002
|
+
responses: {
|
|
2003
|
+
"201": {
|
|
2004
|
+
description: "Created widget area",
|
|
2005
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(widgetAreaSchema) } }
|
|
2006
|
+
},
|
|
2007
|
+
...authErrors,
|
|
2008
|
+
...standardErrors(400, 409, 500)
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
},
|
|
2012
|
+
"/_dineway/api/widget-areas/{name}": {
|
|
2013
|
+
get: {
|
|
2014
|
+
operationId: "getWidgetArea",
|
|
2015
|
+
summary: "Get a widget area with widgets",
|
|
2016
|
+
tags: ["Widgets"],
|
|
2017
|
+
requestParams: { path: z.object({ name: z.string().meta({ description: "Widget area name" }) }) },
|
|
2018
|
+
responses: {
|
|
2019
|
+
"200": {
|
|
2020
|
+
description: "Widget area with widgets",
|
|
2021
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(widgetAreaWithWidgetsSchema) } }
|
|
2022
|
+
},
|
|
2023
|
+
...authErrors,
|
|
2024
|
+
...standardErrors(404, 500)
|
|
2025
|
+
}
|
|
2026
|
+
},
|
|
2027
|
+
delete: {
|
|
2028
|
+
operationId: "deleteWidgetArea",
|
|
2029
|
+
summary: "Delete a widget area and its widgets",
|
|
2030
|
+
tags: ["Widgets"],
|
|
2031
|
+
requestParams: { path: z.object({ name: z.string().meta({ description: "Widget area name" }) }) },
|
|
2032
|
+
responses: {
|
|
2033
|
+
"200": {
|
|
2034
|
+
description: "Deleted",
|
|
2035
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } }
|
|
2036
|
+
},
|
|
2037
|
+
...authErrors,
|
|
2038
|
+
...standardErrors(404, 500)
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
},
|
|
2042
|
+
"/_dineway/api/widget-areas/{name}/widgets": { post: {
|
|
2043
|
+
operationId: "createWidget",
|
|
2044
|
+
summary: "Add a widget to an area",
|
|
2045
|
+
tags: ["Widgets"],
|
|
2046
|
+
requestParams: { path: z.object({ name: z.string().meta({ description: "Widget area name" }) }) },
|
|
2047
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: createWidgetBody } } },
|
|
2048
|
+
responses: {
|
|
2049
|
+
"201": {
|
|
2050
|
+
description: "Created widget",
|
|
2051
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(widgetSchema) } }
|
|
2052
|
+
},
|
|
2053
|
+
...authErrors,
|
|
2054
|
+
...standardErrors(400, 404, 500)
|
|
2055
|
+
}
|
|
2056
|
+
} },
|
|
2057
|
+
"/_dineway/api/widget-areas/{name}/widgets/{id}": {
|
|
2058
|
+
put: {
|
|
2059
|
+
operationId: "updateWidget",
|
|
2060
|
+
summary: "Update a widget",
|
|
2061
|
+
tags: ["Widgets"],
|
|
2062
|
+
requestParams: { path: z.object({
|
|
2063
|
+
name: z.string().meta({ description: "Widget area name" }),
|
|
2064
|
+
id: z.string().meta({ description: "Widget ID" })
|
|
2065
|
+
}) },
|
|
2066
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: updateWidgetBody } } },
|
|
2067
|
+
responses: {
|
|
2068
|
+
"200": {
|
|
2069
|
+
description: "Updated widget",
|
|
2070
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(widgetSchema) } }
|
|
2071
|
+
},
|
|
2072
|
+
...authErrors,
|
|
2073
|
+
...standardErrors(400, 404, 500)
|
|
2074
|
+
}
|
|
2075
|
+
},
|
|
2076
|
+
delete: {
|
|
2077
|
+
operationId: "deleteWidget",
|
|
2078
|
+
summary: "Delete a widget",
|
|
2079
|
+
tags: ["Widgets"],
|
|
2080
|
+
requestParams: { path: z.object({
|
|
2081
|
+
name: z.string().meta({ description: "Widget area name" }),
|
|
2082
|
+
id: z.string().meta({ description: "Widget ID" })
|
|
2083
|
+
}) },
|
|
2084
|
+
responses: {
|
|
2085
|
+
"200": {
|
|
2086
|
+
description: "Deleted",
|
|
2087
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } }
|
|
2088
|
+
},
|
|
2089
|
+
...authErrors,
|
|
2090
|
+
...standardErrors(404, 500)
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
},
|
|
2094
|
+
"/_dineway/api/widget-areas/{name}/reorder": { post: {
|
|
2095
|
+
operationId: "reorderWidgets",
|
|
2096
|
+
summary: "Reorder widgets in an area",
|
|
2097
|
+
tags: ["Widgets"],
|
|
2098
|
+
requestParams: { path: z.object({ name: z.string().meta({ description: "Widget area name" }) }) },
|
|
2099
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: reorderWidgetsBody } } },
|
|
2100
|
+
responses: {
|
|
2101
|
+
"200": {
|
|
2102
|
+
description: "Reordered",
|
|
2103
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({ success: z.literal(true) })) } }
|
|
2104
|
+
},
|
|
2105
|
+
...authErrors,
|
|
2106
|
+
...standardErrors(400, 404, 500)
|
|
2107
|
+
}
|
|
2108
|
+
} }
|
|
2109
|
+
};
|
|
2110
|
+
const settingsPaths = { "/_dineway/api/settings": {
|
|
2111
|
+
get: {
|
|
2112
|
+
operationId: "getSettings",
|
|
2113
|
+
summary: "Get site settings",
|
|
2114
|
+
tags: ["Settings"],
|
|
2115
|
+
responses: {
|
|
2116
|
+
"200": {
|
|
2117
|
+
description: "Site settings",
|
|
2118
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(siteSettingsSchema) } }
|
|
2119
|
+
},
|
|
2120
|
+
...authErrors,
|
|
2121
|
+
...standardErrors(500)
|
|
2122
|
+
}
|
|
2123
|
+
},
|
|
2124
|
+
put: {
|
|
2125
|
+
operationId: "updateSettings",
|
|
2126
|
+
summary: "Update site settings",
|
|
2127
|
+
tags: ["Settings"],
|
|
2128
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: settingsUpdateBody } } },
|
|
2129
|
+
responses: {
|
|
2130
|
+
"200": {
|
|
2131
|
+
description: "Updated settings",
|
|
2132
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(siteSettingsSchema) } }
|
|
2133
|
+
},
|
|
2134
|
+
...authErrors,
|
|
2135
|
+
...standardErrors(400, 500)
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
} };
|
|
2139
|
+
const searchPaths = {
|
|
2140
|
+
"/_dineway/api/search": { get: {
|
|
2141
|
+
operationId: "search",
|
|
2142
|
+
summary: "Full-text search across collections",
|
|
2143
|
+
tags: ["Search"],
|
|
2144
|
+
requestParams: { query: searchQuery },
|
|
2145
|
+
responses: {
|
|
2146
|
+
"200": {
|
|
2147
|
+
description: "Search results",
|
|
2148
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(searchResponseSchema) } }
|
|
2149
|
+
},
|
|
2150
|
+
...authErrors,
|
|
2151
|
+
...standardErrors(500)
|
|
2152
|
+
}
|
|
2153
|
+
} },
|
|
2154
|
+
"/_dineway/api/search/suggest": { get: {
|
|
2155
|
+
operationId: "searchSuggest",
|
|
2156
|
+
summary: "Autocomplete search suggestions",
|
|
2157
|
+
tags: ["Search"],
|
|
2158
|
+
requestParams: { query: searchSuggestQuery },
|
|
2159
|
+
responses: {
|
|
2160
|
+
"200": {
|
|
2161
|
+
description: "Search suggestions",
|
|
2162
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(searchResponseSchema) } }
|
|
2163
|
+
},
|
|
2164
|
+
...authErrors,
|
|
2165
|
+
...standardErrors(500)
|
|
2166
|
+
}
|
|
2167
|
+
} },
|
|
2168
|
+
"/_dineway/api/search/rebuild": { post: {
|
|
2169
|
+
operationId: "rebuildSearchIndex",
|
|
2170
|
+
summary: "Rebuild the search index for a collection",
|
|
2171
|
+
tags: ["Search"],
|
|
2172
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: searchRebuildBody } } },
|
|
2173
|
+
responses: {
|
|
2174
|
+
"200": {
|
|
2175
|
+
description: "Rebuild started",
|
|
2176
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({
|
|
2177
|
+
collection: z.string(),
|
|
2178
|
+
indexed: z.number().int()
|
|
2179
|
+
})) } }
|
|
2180
|
+
},
|
|
2181
|
+
...authErrors,
|
|
2182
|
+
...standardErrors(400, 500)
|
|
2183
|
+
}
|
|
2184
|
+
} },
|
|
2185
|
+
"/_dineway/api/search/enable": { post: {
|
|
2186
|
+
operationId: "enableSearch",
|
|
2187
|
+
summary: "Enable or disable search for a collection",
|
|
2188
|
+
tags: ["Search"],
|
|
2189
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: searchEnableBody } } },
|
|
2190
|
+
responses: {
|
|
2191
|
+
"200": {
|
|
2192
|
+
description: "Search config updated",
|
|
2193
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({
|
|
2194
|
+
collection: z.string(),
|
|
2195
|
+
enabled: z.boolean()
|
|
2196
|
+
})) } }
|
|
2197
|
+
},
|
|
2198
|
+
...authErrors,
|
|
2199
|
+
...standardErrors(400, 500)
|
|
2200
|
+
}
|
|
2201
|
+
} },
|
|
2202
|
+
"/_dineway/api/search/stats": { get: {
|
|
2203
|
+
operationId: "getSearchStats",
|
|
2204
|
+
summary: "Get search index statistics",
|
|
2205
|
+
tags: ["Search"],
|
|
2206
|
+
responses: {
|
|
2207
|
+
"200": {
|
|
2208
|
+
description: "Search stats per collection",
|
|
2209
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({ collections: z.array(z.object({
|
|
2210
|
+
collection: z.string(),
|
|
2211
|
+
enabled: z.boolean(),
|
|
2212
|
+
indexed: z.number().int()
|
|
2213
|
+
})) })) } }
|
|
2214
|
+
},
|
|
2215
|
+
...authErrors,
|
|
2216
|
+
...standardErrors(500)
|
|
2217
|
+
}
|
|
2218
|
+
} }
|
|
2219
|
+
};
|
|
2220
|
+
const redirectPaths = {
|
|
2221
|
+
"/_dineway/api/redirects": {
|
|
2222
|
+
get: {
|
|
2223
|
+
operationId: "listRedirects",
|
|
2224
|
+
summary: "List redirects",
|
|
2225
|
+
tags: ["Redirects"],
|
|
2226
|
+
requestParams: { query: redirectsListQuery },
|
|
2227
|
+
responses: {
|
|
2228
|
+
"200": {
|
|
2229
|
+
description: "Redirect list",
|
|
2230
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(redirectListResponseSchema) } }
|
|
2231
|
+
},
|
|
2232
|
+
...authErrors,
|
|
2233
|
+
...standardErrors(500)
|
|
2234
|
+
}
|
|
2235
|
+
},
|
|
2236
|
+
post: {
|
|
2237
|
+
operationId: "createRedirect",
|
|
2238
|
+
summary: "Create a redirect rule",
|
|
2239
|
+
tags: ["Redirects"],
|
|
2240
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: createRedirectBody } } },
|
|
2241
|
+
responses: {
|
|
2242
|
+
"201": {
|
|
2243
|
+
description: "Created redirect",
|
|
2244
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(redirectSchema) } }
|
|
2245
|
+
},
|
|
2246
|
+
...authErrors,
|
|
2247
|
+
...standardErrors(400, 409, 500)
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
2250
|
+
},
|
|
2251
|
+
"/_dineway/api/redirects/{id}": {
|
|
2252
|
+
get: {
|
|
2253
|
+
operationId: "getRedirect",
|
|
2254
|
+
summary: "Get a redirect",
|
|
2255
|
+
tags: ["Redirects"],
|
|
2256
|
+
requestParams: { path: z.object({ id: z.string().meta({ description: "Redirect ID" }) }) },
|
|
2257
|
+
responses: {
|
|
2258
|
+
"200": {
|
|
2259
|
+
description: "Redirect",
|
|
2260
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(redirectSchema) } }
|
|
2261
|
+
},
|
|
2262
|
+
...authErrors,
|
|
2263
|
+
...standardErrors(404, 500)
|
|
2264
|
+
}
|
|
2265
|
+
},
|
|
2266
|
+
put: {
|
|
2267
|
+
operationId: "updateRedirect",
|
|
2268
|
+
summary: "Update a redirect",
|
|
2269
|
+
tags: ["Redirects"],
|
|
2270
|
+
requestParams: { path: z.object({ id: z.string().meta({ description: "Redirect ID" }) }) },
|
|
2271
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: updateRedirectBody } } },
|
|
2272
|
+
responses: {
|
|
2273
|
+
"200": {
|
|
2274
|
+
description: "Updated redirect",
|
|
2275
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(redirectSchema) } }
|
|
2276
|
+
},
|
|
2277
|
+
...authErrors,
|
|
2278
|
+
...standardErrors(400, 404, 409, 500)
|
|
2279
|
+
}
|
|
2280
|
+
},
|
|
2281
|
+
delete: {
|
|
2282
|
+
operationId: "deleteRedirect",
|
|
2283
|
+
summary: "Delete a redirect",
|
|
2284
|
+
tags: ["Redirects"],
|
|
2285
|
+
requestParams: { path: z.object({ id: z.string().meta({ description: "Redirect ID" }) }) },
|
|
2286
|
+
responses: {
|
|
2287
|
+
"200": {
|
|
2288
|
+
description: "Deleted",
|
|
2289
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } }
|
|
2290
|
+
},
|
|
2291
|
+
...authErrors,
|
|
2292
|
+
...standardErrors(404, 500)
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
},
|
|
2296
|
+
"/_dineway/api/redirects/404s": {
|
|
2297
|
+
get: {
|
|
2298
|
+
operationId: "listNotFoundEntries",
|
|
2299
|
+
summary: "List 404 log entries",
|
|
2300
|
+
tags: ["Redirects"],
|
|
2301
|
+
requestParams: { query: notFoundListQuery },
|
|
2302
|
+
responses: {
|
|
2303
|
+
"200": {
|
|
2304
|
+
description: "404 log entries",
|
|
2305
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(notFoundListResponseSchema) } }
|
|
2306
|
+
},
|
|
2307
|
+
...authErrors,
|
|
2308
|
+
...standardErrors(500)
|
|
2309
|
+
}
|
|
2310
|
+
},
|
|
2311
|
+
delete: {
|
|
2312
|
+
operationId: "clearNotFoundLog",
|
|
2313
|
+
summary: "Clear all 404 log entries",
|
|
2314
|
+
tags: ["Redirects"],
|
|
2315
|
+
responses: {
|
|
2316
|
+
"200": {
|
|
2317
|
+
description: "Cleared",
|
|
2318
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({ deleted: z.number().int() })) } }
|
|
2319
|
+
},
|
|
2320
|
+
...authErrors,
|
|
2321
|
+
...standardErrors(500)
|
|
2322
|
+
}
|
|
2323
|
+
},
|
|
2324
|
+
post: {
|
|
2325
|
+
operationId: "pruneNotFoundLog",
|
|
2326
|
+
summary: "Prune old 404 log entries",
|
|
2327
|
+
tags: ["Redirects"],
|
|
2328
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: notFoundPruneBody } } },
|
|
2329
|
+
responses: {
|
|
2330
|
+
"200": {
|
|
2331
|
+
description: "Pruned",
|
|
2332
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({ deleted: z.number().int() })) } }
|
|
2333
|
+
},
|
|
2334
|
+
...authErrors,
|
|
2335
|
+
...standardErrors(400, 500)
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
},
|
|
2339
|
+
"/_dineway/api/redirects/404s/summary": { get: {
|
|
2340
|
+
operationId: "getNotFoundSummary",
|
|
2341
|
+
summary: "Get 404 summary grouped by path",
|
|
2342
|
+
tags: ["Redirects"],
|
|
2343
|
+
responses: {
|
|
2344
|
+
"200": {
|
|
2345
|
+
description: "404 summary",
|
|
2346
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(notFoundSummaryResponseSchema) } }
|
|
2347
|
+
},
|
|
2348
|
+
...authErrors,
|
|
2349
|
+
...standardErrors(500)
|
|
2350
|
+
}
|
|
2351
|
+
} }
|
|
2352
|
+
};
|
|
2353
|
+
const userPaths = {
|
|
2354
|
+
"/_dineway/api/admin/users": { get: {
|
|
2355
|
+
operationId: "listUsers",
|
|
2356
|
+
summary: "List users",
|
|
2357
|
+
tags: ["Users"],
|
|
2358
|
+
requestParams: { query: usersListQuery },
|
|
2359
|
+
responses: {
|
|
2360
|
+
"200": {
|
|
2361
|
+
description: "User list",
|
|
2362
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(userListResponseSchema) } }
|
|
2363
|
+
},
|
|
2364
|
+
...authErrors,
|
|
2365
|
+
...standardErrors(500)
|
|
2366
|
+
}
|
|
2367
|
+
} },
|
|
2368
|
+
"/_dineway/api/admin/users/{id}": {
|
|
2369
|
+
get: {
|
|
2370
|
+
operationId: "getUser",
|
|
2371
|
+
summary: "Get user details",
|
|
2372
|
+
tags: ["Users"],
|
|
2373
|
+
requestParams: { path: z.object({ id: z.string().meta({ description: "User ID" }) }) },
|
|
2374
|
+
responses: {
|
|
2375
|
+
"200": {
|
|
2376
|
+
description: "User detail",
|
|
2377
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({ item: userDetailSchema })) } }
|
|
2378
|
+
},
|
|
2379
|
+
...authErrors,
|
|
2380
|
+
...standardErrors(404, 500)
|
|
2381
|
+
}
|
|
2382
|
+
},
|
|
2383
|
+
put: {
|
|
2384
|
+
operationId: "updateUser",
|
|
2385
|
+
summary: "Update a user",
|
|
2386
|
+
tags: ["Users"],
|
|
2387
|
+
requestParams: { path: z.object({ id: z.string().meta({ description: "User ID" }) }) },
|
|
2388
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: userUpdateBody } } },
|
|
2389
|
+
responses: {
|
|
2390
|
+
"200": {
|
|
2391
|
+
description: "Updated user",
|
|
2392
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({ item: userSchema })) } }
|
|
2393
|
+
},
|
|
2394
|
+
...authErrors,
|
|
2395
|
+
...standardErrors(400, 404, 409, 500)
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
},
|
|
2399
|
+
"/_dineway/api/admin/users/{id}/disable": { post: {
|
|
2400
|
+
operationId: "disableUser",
|
|
2401
|
+
summary: "Disable a user account",
|
|
2402
|
+
tags: ["Users"],
|
|
2403
|
+
requestParams: { path: z.object({ id: z.string().meta({ description: "User ID" }) }) },
|
|
2404
|
+
responses: {
|
|
2405
|
+
"200": {
|
|
2406
|
+
description: "User disabled",
|
|
2407
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({ item: userSchema })) } }
|
|
2408
|
+
},
|
|
2409
|
+
...authErrors,
|
|
2410
|
+
...standardErrors(400, 404, 500)
|
|
2411
|
+
}
|
|
2412
|
+
} },
|
|
2413
|
+
"/_dineway/api/admin/users/{id}/enable": { post: {
|
|
2414
|
+
operationId: "enableUser",
|
|
2415
|
+
summary: "Enable a user account",
|
|
2416
|
+
tags: ["Users"],
|
|
2417
|
+
requestParams: { path: z.object({ id: z.string().meta({ description: "User ID" }) }) },
|
|
2418
|
+
responses: {
|
|
2419
|
+
"200": {
|
|
2420
|
+
description: "User enabled",
|
|
2421
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({ item: userSchema })) } }
|
|
2422
|
+
},
|
|
2423
|
+
...authErrors,
|
|
2424
|
+
...standardErrors(404, 500)
|
|
2425
|
+
}
|
|
2426
|
+
} },
|
|
2427
|
+
"/_dineway/api/admin/allowed-domains": {
|
|
2428
|
+
get: {
|
|
2429
|
+
operationId: "listAllowedDomains",
|
|
2430
|
+
summary: "List allowed email domains",
|
|
2431
|
+
tags: ["Users"],
|
|
2432
|
+
responses: {
|
|
2433
|
+
"200": {
|
|
2434
|
+
description: "Allowed domains list",
|
|
2435
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({ items: z.array(z.object({
|
|
2436
|
+
domain: z.string(),
|
|
2437
|
+
defaultRole: z.number().int(),
|
|
2438
|
+
enabled: z.boolean(),
|
|
2439
|
+
createdAt: z.string()
|
|
2440
|
+
})) })) } }
|
|
2441
|
+
},
|
|
2442
|
+
...authErrors,
|
|
2443
|
+
...standardErrors(500)
|
|
2444
|
+
}
|
|
2445
|
+
},
|
|
2446
|
+
post: {
|
|
2447
|
+
operationId: "createAllowedDomain",
|
|
2448
|
+
summary: "Add an allowed email domain",
|
|
2449
|
+
tags: ["Users"],
|
|
2450
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: allowedDomainCreateBody } } },
|
|
2451
|
+
responses: {
|
|
2452
|
+
"201": {
|
|
2453
|
+
description: "Created",
|
|
2454
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({
|
|
2455
|
+
domain: z.string(),
|
|
2456
|
+
defaultRole: z.number().int(),
|
|
2457
|
+
enabled: z.boolean()
|
|
2458
|
+
})) } }
|
|
2459
|
+
},
|
|
2460
|
+
...authErrors,
|
|
2461
|
+
...standardErrors(400, 409, 500)
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
},
|
|
2465
|
+
"/_dineway/api/admin/allowed-domains/{domain}": {
|
|
2466
|
+
put: {
|
|
2467
|
+
operationId: "updateAllowedDomain",
|
|
2468
|
+
summary: "Update an allowed domain",
|
|
2469
|
+
tags: ["Users"],
|
|
2470
|
+
requestParams: { path: z.object({ domain: z.string().meta({ description: "Domain name" }) }) },
|
|
2471
|
+
requestBody: { content: { [JSON_CONTENT]: { schema: allowedDomainUpdateBody } } },
|
|
2472
|
+
responses: {
|
|
2473
|
+
"200": {
|
|
2474
|
+
description: "Updated",
|
|
2475
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(z.object({
|
|
2476
|
+
domain: z.string(),
|
|
2477
|
+
defaultRole: z.number().int(),
|
|
2478
|
+
enabled: z.boolean()
|
|
2479
|
+
})) } }
|
|
2480
|
+
},
|
|
2481
|
+
...authErrors,
|
|
2482
|
+
...standardErrors(404, 500)
|
|
2483
|
+
}
|
|
2484
|
+
},
|
|
2485
|
+
delete: {
|
|
2486
|
+
operationId: "deleteAllowedDomain",
|
|
2487
|
+
summary: "Remove an allowed domain",
|
|
2488
|
+
tags: ["Users"],
|
|
2489
|
+
requestParams: { path: z.object({ domain: z.string().meta({ description: "Domain name" }) }) },
|
|
2490
|
+
responses: {
|
|
2491
|
+
"200": {
|
|
2492
|
+
description: "Deleted",
|
|
2493
|
+
content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } }
|
|
2494
|
+
},
|
|
2495
|
+
...authErrors,
|
|
2496
|
+
...standardErrors(404, 500)
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
}
|
|
2500
|
+
};
|
|
2501
|
+
function buildAllPaths(maxUploadSize) {
|
|
2502
|
+
return {
|
|
2503
|
+
...contentPaths,
|
|
2504
|
+
...buildMediaPaths(maxUploadSize),
|
|
2505
|
+
...schemaPaths,
|
|
2506
|
+
...commentsPaths,
|
|
2507
|
+
...taxonomyPaths,
|
|
2508
|
+
...menuPaths,
|
|
2509
|
+
...sectionPaths,
|
|
2510
|
+
...widgetPaths,
|
|
2511
|
+
...settingsPaths,
|
|
2512
|
+
...searchPaths,
|
|
2513
|
+
...redirectPaths,
|
|
2514
|
+
...userPaths
|
|
2515
|
+
};
|
|
2516
|
+
}
|
|
2517
|
+
/**
|
|
2518
|
+
* Generate the OpenAPI 3.1 document for the Dineway Agentic Web builder API.
|
|
2519
|
+
*
|
|
2520
|
+
* Covers: Content, Media, Schema, Comments, Taxonomies, Menus,
|
|
2521
|
+
* Sections, Widgets, Settings, Search, Redirects, Users.
|
|
2522
|
+
*/
|
|
2523
|
+
function generateOpenApiDocument(options = {}) {
|
|
2524
|
+
const maxUploadSize = options.maxUploadSize ?? DEFAULT_MAX_UPLOAD_SIZE;
|
|
2525
|
+
return createDocument({
|
|
2526
|
+
openapi: "3.1.0",
|
|
2527
|
+
info: {
|
|
2528
|
+
title: "Dineway Agentic Web builder API",
|
|
2529
|
+
version: VERSION,
|
|
2530
|
+
description: "REST API for the Dineway Agentic Web builder. All endpoints require authentication and return responses wrapped in a `{ data }` envelope."
|
|
2531
|
+
},
|
|
2532
|
+
servers: [{
|
|
2533
|
+
url: "{baseUrl}",
|
|
2534
|
+
description: "CMS instance",
|
|
2535
|
+
variables: { baseUrl: { default: "http://localhost:4321" } }
|
|
2536
|
+
}],
|
|
2537
|
+
tags: [
|
|
2538
|
+
{
|
|
2539
|
+
name: "Content",
|
|
2540
|
+
description: "CRUD operations for content items across collections"
|
|
2541
|
+
},
|
|
2542
|
+
{
|
|
2543
|
+
name: "Media",
|
|
2544
|
+
description: "Media library — upload, manage, and serve files"
|
|
2545
|
+
},
|
|
2546
|
+
{
|
|
2547
|
+
name: "Schema",
|
|
2548
|
+
description: "Collection and field management"
|
|
2549
|
+
},
|
|
2550
|
+
{
|
|
2551
|
+
name: "Comments",
|
|
2552
|
+
description: "Public comments and admin moderation"
|
|
2553
|
+
},
|
|
2554
|
+
{
|
|
2555
|
+
name: "Taxonomies",
|
|
2556
|
+
description: "Taxonomy definitions and terms"
|
|
2557
|
+
},
|
|
2558
|
+
{
|
|
2559
|
+
name: "Menus",
|
|
2560
|
+
description: "Navigation menu management"
|
|
2561
|
+
},
|
|
2562
|
+
{
|
|
2563
|
+
name: "Sections",
|
|
2564
|
+
description: "Reusable content sections"
|
|
2565
|
+
},
|
|
2566
|
+
{
|
|
2567
|
+
name: "Widgets",
|
|
2568
|
+
description: "Widget areas and widget management"
|
|
2569
|
+
},
|
|
2570
|
+
{
|
|
2571
|
+
name: "Settings",
|
|
2572
|
+
description: "Site-wide settings"
|
|
2573
|
+
},
|
|
2574
|
+
{
|
|
2575
|
+
name: "Search",
|
|
2576
|
+
description: "Full-text search and index management"
|
|
2577
|
+
},
|
|
2578
|
+
{
|
|
2579
|
+
name: "Redirects",
|
|
2580
|
+
description: "Redirect rules and 404 logging"
|
|
2581
|
+
},
|
|
2582
|
+
{
|
|
2583
|
+
name: "Users",
|
|
2584
|
+
description: "User management and access control"
|
|
2585
|
+
}
|
|
2586
|
+
],
|
|
2587
|
+
components: { securitySchemes: {
|
|
2588
|
+
session: {
|
|
2589
|
+
type: "apiKey",
|
|
2590
|
+
in: "cookie",
|
|
2591
|
+
name: "dineway_session",
|
|
2592
|
+
description: "Session cookie set by the auth endpoints"
|
|
2593
|
+
},
|
|
2594
|
+
bearer: {
|
|
2595
|
+
type: "http",
|
|
2596
|
+
scheme: "bearer",
|
|
2597
|
+
description: "OAuth2 or API token"
|
|
2598
|
+
}
|
|
2599
|
+
} },
|
|
2600
|
+
security: [{ session: [] }, { bearer: [] }],
|
|
2601
|
+
paths: buildAllPaths(maxUploadSize)
|
|
2602
|
+
});
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2605
|
+
//#endregion
|
|
2606
|
+
//#region src/astro/routes/api/openapi.json.ts
|
|
2607
|
+
const prerender = false;
|
|
2608
|
+
const OPENAPI_CACHE_KEY = Symbol.for("dineway.openapi.cachedSpec");
|
|
2609
|
+
const globalCache = globalThis;
|
|
2610
|
+
function getCachedSpec() {
|
|
2611
|
+
const spec = globalCache[OPENAPI_CACHE_KEY];
|
|
2612
|
+
return typeof spec === "string" ? spec : null;
|
|
2613
|
+
}
|
|
2614
|
+
function setCachedSpec(spec) {
|
|
2615
|
+
globalCache[OPENAPI_CACHE_KEY] = spec;
|
|
2616
|
+
}
|
|
2617
|
+
const GET = async ({ locals }) => {
|
|
2618
|
+
let spec = getCachedSpec();
|
|
2619
|
+
if (!spec) try {
|
|
2620
|
+
const maxUploadSize = locals.dineway?.config.maxUploadSize;
|
|
2621
|
+
const doc = generateOpenApiDocument({ maxUploadSize });
|
|
2622
|
+
spec = JSON.stringify(doc);
|
|
2623
|
+
setCachedSpec(spec);
|
|
2624
|
+
} catch (error) {
|
|
2625
|
+
return handleError(error, "Failed to generate OpenAPI document", "OPENAPI_ERROR");
|
|
2626
|
+
}
|
|
2627
|
+
return new Response(spec, {
|
|
2628
|
+
status: 200,
|
|
2629
|
+
headers: {
|
|
2630
|
+
"Content-Type": "application/json",
|
|
2631
|
+
"Cache-Control": "private, no-store",
|
|
2632
|
+
"Access-Control-Allow-Origin": "*"
|
|
2633
|
+
}
|
|
2634
|
+
});
|
|
2635
|
+
};
|
|
2636
|
+
|
|
2637
|
+
//#endregion
|
|
2638
|
+
export { GET, prerender };
|