@nodehive/nextjs 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +102 -0
- package/dist/auth/index.d.ts +6 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +7 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/internal/config.d.ts +24 -0
- package/dist/auth/internal/config.d.ts.map +1 -0
- package/dist/auth/internal/config.js +2 -0
- package/dist/auth/internal/config.js.map +1 -0
- package/dist/auth/internal/draft-mode.d.ts +17 -0
- package/dist/auth/internal/draft-mode.d.ts.map +1 -0
- package/dist/auth/internal/draft-mode.js +73 -0
- package/dist/auth/internal/draft-mode.js.map +1 -0
- package/dist/auth/internal/editor-locale.d.ts +4 -0
- package/dist/auth/internal/editor-locale.d.ts.map +1 -0
- package/dist/auth/internal/editor-locale.js +14 -0
- package/dist/auth/internal/editor-locale.js.map +1 -0
- package/dist/auth/internal/handoff.d.ts +11 -0
- package/dist/auth/internal/handoff.d.ts.map +1 -0
- package/dist/auth/internal/handoff.js +44 -0
- package/dist/auth/internal/handoff.js.map +1 -0
- package/dist/auth/internal/has-session.d.ts +7 -0
- package/dist/auth/internal/has-session.d.ts.map +1 -0
- package/dist/auth/internal/has-session.js +11 -0
- package/dist/auth/internal/has-session.js.map +1 -0
- package/dist/auth/internal/logout.d.ts +12 -0
- package/dist/auth/internal/logout.d.ts.map +1 -0
- package/dist/auth/internal/logout.js +48 -0
- package/dist/auth/internal/logout.js.map +1 -0
- package/dist/auth/internal/next-cookie-storage.d.ts +28 -0
- package/dist/auth/internal/next-cookie-storage.d.ts.map +1 -0
- package/dist/auth/internal/next-cookie-storage.js +103 -0
- package/dist/auth/internal/next-cookie-storage.js.map +1 -0
- package/dist/auth/internal/nodehive-client.d.ts +6 -0
- package/dist/auth/internal/nodehive-client.d.ts.map +1 -0
- package/dist/auth/internal/nodehive-client.js +64 -0
- package/dist/auth/internal/nodehive-client.js.map +1 -0
- package/dist/auth/internal/oauth-config.d.ts +37 -0
- package/dist/auth/internal/oauth-config.d.ts.map +1 -0
- package/dist/auth/internal/oauth-config.js +70 -0
- package/dist/auth/internal/oauth-config.js.map +1 -0
- package/dist/auth/internal/proxy-helpers.d.ts +15 -0
- package/dist/auth/internal/proxy-helpers.d.ts.map +1 -0
- package/dist/auth/internal/proxy-helpers.js +43 -0
- package/dist/auth/internal/proxy-helpers.js.map +1 -0
- package/dist/auth/internal/refresh.d.ts +13 -0
- package/dist/auth/internal/refresh.d.ts.map +1 -0
- package/dist/auth/internal/refresh.js +170 -0
- package/dist/auth/internal/refresh.js.map +1 -0
- package/dist/auth/internal/require-auth.d.ts +2 -0
- package/dist/auth/internal/require-auth.d.ts.map +1 -0
- package/dist/auth/internal/require-auth.js +11 -0
- package/dist/auth/internal/require-auth.js.map +1 -0
- package/dist/auth/internal/return-to.d.ts +16 -0
- package/dist/auth/internal/return-to.d.ts.map +1 -0
- package/dist/auth/internal/return-to.js +31 -0
- package/dist/auth/internal/return-to.js.map +1 -0
- package/dist/auth/internal/routes/callback.d.ts +11 -0
- package/dist/auth/internal/routes/callback.d.ts.map +1 -0
- package/dist/auth/internal/routes/callback.js +93 -0
- package/dist/auth/internal/routes/callback.js.map +1 -0
- package/dist/auth/internal/routes/chips-exchange.d.ts +4 -0
- package/dist/auth/internal/routes/chips-exchange.d.ts.map +1 -0
- package/dist/auth/internal/routes/chips-exchange.js +64 -0
- package/dist/auth/internal/routes/chips-exchange.js.map +1 -0
- package/dist/auth/internal/routes/draft.d.ts +4 -0
- package/dist/auth/internal/routes/draft.d.ts.map +1 -0
- package/dist/auth/internal/routes/draft.js +34 -0
- package/dist/auth/internal/routes/draft.js.map +1 -0
- package/dist/auth/internal/routes/index.d.ts +25 -0
- package/dist/auth/internal/routes/index.d.ts.map +1 -0
- package/dist/auth/internal/routes/index.js +66 -0
- package/dist/auth/internal/routes/index.js.map +1 -0
- package/dist/auth/internal/routes/login.d.ts +3 -0
- package/dist/auth/internal/routes/login.d.ts.map +1 -0
- package/dist/auth/internal/routes/login.js +47 -0
- package/dist/auth/internal/routes/login.js.map +1 -0
- package/dist/auth/internal/routes/popup-done.d.ts +3 -0
- package/dist/auth/internal/routes/popup-done.d.ts.map +1 -0
- package/dist/auth/internal/routes/popup-done.js +24 -0
- package/dist/auth/internal/routes/popup-done.js.map +1 -0
- package/dist/auth/internal/routes/refresh.d.ts +6 -0
- package/dist/auth/internal/routes/refresh.d.ts.map +1 -0
- package/dist/auth/internal/routes/refresh.js +44 -0
- package/dist/auth/internal/routes/refresh.js.map +1 -0
- package/dist/auth/internal/same-origin.d.ts +8 -0
- package/dist/auth/internal/same-origin.d.ts.map +1 -0
- package/dist/auth/internal/same-origin.js +9 -0
- package/dist/auth/internal/same-origin.js.map +1 -0
- package/dist/auth/internal/session-gates.d.ts +7 -0
- package/dist/auth/internal/session-gates.d.ts.map +1 -0
- package/dist/auth/internal/session-gates.js +12 -0
- package/dist/auth/internal/session-gates.js.map +1 -0
- package/dist/auth/internal/update-session.d.ts +17 -0
- package/dist/auth/internal/update-session.d.ts.map +1 -0
- package/dist/auth/internal/update-session.js +39 -0
- package/dist/auth/internal/update-session.js.map +1 -0
- package/dist/auth/internal/use-editor-login.d.ts +33 -0
- package/dist/auth/internal/use-editor-login.d.ts.map +1 -0
- package/dist/auth/internal/use-editor-login.js +143 -0
- package/dist/auth/internal/use-editor-login.js.map +1 -0
- package/dist/auth/proxy.d.ts +8 -0
- package/dist/auth/proxy.d.ts.map +1 -0
- package/dist/auth/proxy.js +8 -0
- package/dist/auth/proxy.js.map +1 -0
- package/dist/auth/react.d.ts +2 -0
- package/dist/auth/react.d.ts.map +1 -0
- package/dist/auth/react.js +3 -0
- package/dist/auth/react.js.map +1 -0
- package/dist/auth/routes.d.ts +3 -0
- package/dist/auth/routes.d.ts.map +1 -0
- package/dist/auth/routes.js +3 -0
- package/dist/auth/routes.js.map +1 -0
- package/dist/auth/server.d.ts +23 -0
- package/dist/auth/server.d.ts.map +1 -0
- package/dist/auth/server.js +61 -0
- package/dist/auth/server.js.map +1 -0
- package/dist/puck-editor/fields.d.ts +7 -0
- package/dist/puck-editor/fields.d.ts.map +1 -0
- package/dist/puck-editor/fields.js +4 -0
- package/dist/puck-editor/fields.js.map +1 -0
- package/dist/puck-editor/index.d.ts +14 -0
- package/dist/puck-editor/index.d.ts.map +1 -0
- package/dist/puck-editor/index.js +12 -0
- package/dist/puck-editor/index.js.map +1 -0
- package/dist/puck-editor/internal/api/client.d.ts +32 -0
- package/dist/puck-editor/internal/api/client.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/client.js +128 -0
- package/dist/puck-editor/internal/api/client.js.map +1 -0
- package/dist/puck-editor/internal/api/config.d.ts +29 -0
- package/dist/puck-editor/internal/api/config.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/config.js +2 -0
- package/dist/puck-editor/internal/api/config.js.map +1 -0
- package/dist/puck-editor/internal/api/create-puck-api.d.ts +26 -0
- package/dist/puck-editor/internal/api/create-puck-api.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/create-puck-api.js +124 -0
- package/dist/puck-editor/internal/api/create-puck-api.js.map +1 -0
- package/dist/puck-editor/internal/api/handlers/create-page.d.ts +13 -0
- package/dist/puck-editor/internal/api/handlers/create-page.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/handlers/create-page.js +125 -0
- package/dist/puck-editor/internal/api/handlers/create-page.js.map +1 -0
- package/dist/puck-editor/internal/api/handlers/entities.d.ts +17 -0
- package/dist/puck-editor/internal/api/handlers/entities.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/handlers/entities.js +166 -0
- package/dist/puck-editor/internal/api/handlers/entities.js.map +1 -0
- package/dist/puck-editor/internal/api/handlers/publish.d.ts +6 -0
- package/dist/puck-editor/internal/api/handlers/publish.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/handlers/publish.js +115 -0
- package/dist/puck-editor/internal/api/handlers/publish.js.map +1 -0
- package/dist/puck-editor/internal/api/handlers/template.d.ts +15 -0
- package/dist/puck-editor/internal/api/handlers/template.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/handlers/template.js +222 -0
- package/dist/puck-editor/internal/api/handlers/template.js.map +1 -0
- package/dist/puck-editor/internal/api/handlers/upload.d.ts +13 -0
- package/dist/puck-editor/internal/api/handlers/upload.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/handlers/upload.js +129 -0
- package/dist/puck-editor/internal/api/handlers/upload.js.map +1 -0
- package/dist/puck-editor/internal/api/media-params.d.ts +4 -0
- package/dist/puck-editor/internal/api/media-params.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/media-params.js +38 -0
- package/dist/puck-editor/internal/api/media-params.js.map +1 -0
- package/dist/puck-editor/internal/api/media-upload.d.ts +24 -0
- package/dist/puck-editor/internal/api/media-upload.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/media-upload.js +171 -0
- package/dist/puck-editor/internal/api/media-upload.js.map +1 -0
- package/dist/puck-editor/internal/api/space.d.ts +4 -0
- package/dist/puck-editor/internal/api/space.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/space.js +11 -0
- package/dist/puck-editor/internal/api/space.js.map +1 -0
- package/dist/puck-editor/internal/content-model.d.ts +55 -0
- package/dist/puck-editor/internal/content-model.d.ts.map +1 -0
- package/dist/puck-editor/internal/content-model.js +73 -0
- package/dist/puck-editor/internal/content-model.js.map +1 -0
- package/dist/puck-editor/internal/editor/allowed-types.d.ts +4 -0
- package/dist/puck-editor/internal/editor/allowed-types.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/allowed-types.js +6 -0
- package/dist/puck-editor/internal/editor/allowed-types.js.map +1 -0
- package/dist/puck-editor/internal/editor/canvas-add-picker.d.ts +9 -0
- package/dist/puck-editor/internal/editor/canvas-add-picker.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/canvas-add-picker.js +231 -0
- package/dist/puck-editor/internal/editor/canvas-add-picker.js.map +1 -0
- package/dist/puck-editor/internal/editor/canvas-empty-state.d.ts +6 -0
- package/dist/puck-editor/internal/editor/canvas-empty-state.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/canvas-empty-state.js +85 -0
- package/dist/puck-editor/internal/editor/canvas-empty-state.js.map +1 -0
- package/dist/puck-editor/internal/editor/canvas-quick-add.d.ts +2 -0
- package/dist/puck-editor/internal/editor/canvas-quick-add.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/canvas-quick-add.js +844 -0
- package/dist/puck-editor/internal/editor/canvas-quick-add.js.map +1 -0
- package/dist/puck-editor/internal/editor/canvas-scroll.d.ts +3 -0
- package/dist/puck-editor/internal/editor/canvas-scroll.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/canvas-scroll.js +16 -0
- package/dist/puck-editor/internal/editor/canvas-scroll.js.map +1 -0
- package/dist/puck-editor/internal/editor/component-icons.d.ts +14 -0
- package/dist/puck-editor/internal/editor/component-icons.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/component-icons.js +35 -0
- package/dist/puck-editor/internal/editor/component-icons.js.map +1 -0
- package/dist/puck-editor/internal/editor/component-item.d.ts +6 -0
- package/dist/puck-editor/internal/editor/component-item.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/component-item.js +42 -0
- package/dist/puck-editor/internal/editor/component-item.js.map +1 -0
- package/dist/puck-editor/internal/editor/editor-action-bar.d.ts +6 -0
- package/dist/puck-editor/internal/editor/editor-action-bar.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/editor-action-bar.js +249 -0
- package/dist/puck-editor/internal/editor/editor-action-bar.js.map +1 -0
- package/dist/puck-editor/internal/editor/editor-header-actions.d.ts +7 -0
- package/dist/puck-editor/internal/editor/editor-header-actions.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/editor-header-actions.js +120 -0
- package/dist/puck-editor/internal/editor/editor-header-actions.js.map +1 -0
- package/dist/puck-editor/internal/editor/find-missing-required-fields.d.ts +15 -0
- package/dist/puck-editor/internal/editor/find-missing-required-fields.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/find-missing-required-fields.js +61 -0
- package/dist/puck-editor/internal/editor/find-missing-required-fields.js.map +1 -0
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.d.ts +15 -0
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.js +147 -0
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.js.map +1 -0
- package/dist/puck-editor/internal/editor/grouped-entry-list.d.ts +17 -0
- package/dist/puck-editor/internal/editor/grouped-entry-list.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/grouped-entry-list.js +125 -0
- package/dist/puck-editor/internal/editor/grouped-entry-list.js.map +1 -0
- package/dist/puck-editor/internal/editor/header-save-button.d.ts +5 -0
- package/dist/puck-editor/internal/editor/header-save-button.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/header-save-button.js +60 -0
- package/dist/puck-editor/internal/editor/header-save-button.js.map +1 -0
- package/dist/puck-editor/internal/editor/page-template-picker.d.ts +4 -0
- package/dist/puck-editor/internal/editor/page-template-picker.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/page-template-picker.js +140 -0
- package/dist/puck-editor/internal/editor/page-template-picker.js.map +1 -0
- package/dist/puck-editor/internal/editor/picker-entry-item.d.ts +6 -0
- package/dist/puck-editor/internal/editor/picker-entry-item.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/picker-entry-item.js +79 -0
- package/dist/puck-editor/internal/editor/picker-entry-item.js.map +1 -0
- package/dist/puck-editor/internal/editor/picker-model.d.ts +62 -0
- package/dist/puck-editor/internal/editor/picker-model.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/picker-model.js +489 -0
- package/dist/puck-editor/internal/editor/picker-model.js.map +1 -0
- package/dist/puck-editor/internal/editor/publish-puck-data.d.ts +30 -0
- package/dist/puck-editor/internal/editor/publish-puck-data.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/publish-puck-data.js +30 -0
- package/dist/puck-editor/internal/editor/publish-puck-data.js.map +1 -0
- package/dist/puck-editor/internal/editor/puck-editor.d.ts +15 -0
- package/dist/puck-editor/internal/editor/puck-editor.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/puck-editor.js +333 -0
- package/dist/puck-editor/internal/editor/puck-editor.js.map +1 -0
- package/dist/puck-editor/internal/editor/section-template-modal.d.ts +4 -0
- package/dist/puck-editor/internal/editor/section-template-modal.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/section-template-modal.js +71 -0
- package/dist/puck-editor/internal/editor/section-template-modal.js.map +1 -0
- package/dist/puck-editor/internal/editor/use-scroll-lock-outside.d.ts +15 -0
- package/dist/puck-editor/internal/editor/use-scroll-lock-outside.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/use-scroll-lock-outside.js +93 -0
- package/dist/puck-editor/internal/editor/use-scroll-lock-outside.js.map +1 -0
- package/dist/puck-editor/internal/editor-config.d.ts +30 -0
- package/dist/puck-editor/internal/editor-config.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor-config.js +57 -0
- package/dist/puck-editor/internal/editor-config.js.map +1 -0
- package/dist/puck-editor/internal/editor-query-client.d.ts +4 -0
- package/dist/puck-editor/internal/editor-query-client.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor-query-client.js +8 -0
- package/dist/puck-editor/internal/editor-query-client.js.map +1 -0
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.d.ts +14 -0
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.js +120 -0
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.d.ts +21 -0
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.js +24 -0
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.d.ts +16 -0
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.js +20 -0
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/date-picker/date-picker.d.ts +8 -0
- package/dist/puck-editor/internal/fields/date-picker/date-picker.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/date-picker/date-picker.js +151 -0
- package/dist/puck-editor/internal/fields/date-picker/date-picker.js.map +1 -0
- package/dist/puck-editor/internal/fields/index.d.ts +10 -0
- package/dist/puck-editor/internal/fields/index.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/index.js +10 -0
- package/dist/puck-editor/internal/fields/index.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/anchor.d.ts +33 -0
- package/dist/puck-editor/internal/fields/link-picker/anchor.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/anchor.js +83 -0
- package/dist/puck-editor/internal/fields/link-picker/anchor.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.d.ts +24 -0
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.js +31 -0
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/humanize.d.ts +2 -0
- package/dist/puck-editor/internal/fields/link-picker/humanize.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/humanize.js +4 -0
- package/dist/puck-editor/internal/fields/link-picker/humanize.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.d.ts +27 -0
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.js +564 -0
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.d.ts +9 -0
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.js +189 -0
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/link-value.d.ts +72 -0
- package/dist/puck-editor/internal/fields/link-picker/link-value.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/link-value.js +114 -0
- package/dist/puck-editor/internal/fields/link-picker/link-value.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.d.ts +14 -0
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.js +667 -0
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.d.ts +11 -0
- package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.js +34 -0
- package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.d.ts +40 -0
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.js +146 -0
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/types.d.ts +34 -0
- package/dist/puck-editor/internal/fields/link-picker/types.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/types.js +2 -0
- package/dist/puck-editor/internal/fields/link-picker/types.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.d.ts +27 -0
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.js +32 -0
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-array/media-array-field.d.ts +13 -0
- package/dist/puck-editor/internal/fields/media-array/media-array-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-array/media-array-field.js +372 -0
- package/dist/puck-editor/internal/fields/media-array/media-array-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-array/reorder.d.ts +2 -0
- package/dist/puck-editor/internal/fields/media-array/reorder.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-array/reorder.js +8 -0
- package/dist/puck-editor/internal/fields/media-array/reorder.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.d.ts +27 -0
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.js +32 -0
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.d.ts +11 -0
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.js +219 -0
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/crop-types.d.ts +24 -0
- package/dist/puck-editor/internal/fields/media-selector/crop-types.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/crop-types.js +8 -0
- package/dist/puck-editor/internal/fields/media-selector/crop-types.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/extract-fields.d.ts +8 -0
- package/dist/puck-editor/internal/fields/media-selector/extract-fields.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/extract-fields.js +51 -0
- package/dist/puck-editor/internal/fields/media-selector/extract-fields.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.d.ts +7 -0
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.js +147 -0
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.d.ts +30 -0
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.js +358 -0
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.d.ts +14 -0
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.js +355 -0
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.d.ts +2 -0
- package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.js +55 -0
- package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.d.ts +24 -0
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.js +229 -0
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.d.ts +7 -0
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.js +120 -0
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.js.map +1 -0
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.d.ts +31 -0
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.js +39 -0
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/required-field-label.d.ts +16 -0
- package/dist/puck-editor/internal/fields/required-field-label.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/required-field-label.js +89 -0
- package/dist/puck-editor/internal/fields/required-field-label.js.map +1 -0
- package/dist/puck-editor/internal/fields/required.d.ts +19 -0
- package/dist/puck-editor/internal/fields/required.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/required.js +20 -0
- package/dist/puck-editor/internal/fields/required.js.map +1 -0
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.d.ts +37 -0
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.js +26 -0
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.js.map +1 -0
- package/dist/puck-editor/internal/i18n.d.ts +188 -0
- package/dist/puck-editor/internal/i18n.d.ts.map +1 -0
- package/dist/puck-editor/internal/i18n.js +414 -0
- package/dist/puck-editor/internal/i18n.js.map +1 -0
- package/dist/puck-editor/internal/locale.d.ts +13 -0
- package/dist/puck-editor/internal/locale.d.ts.map +1 -0
- package/dist/puck-editor/internal/locale.js +20 -0
- package/dist/puck-editor/internal/locale.js.map +1 -0
- package/dist/puck-editor/internal/localize.d.ts +11 -0
- package/dist/puck-editor/internal/localize.d.ts.map +1 -0
- package/dist/puck-editor/internal/localize.js +42 -0
- package/dist/puck-editor/internal/localize.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.d.ts +21 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.js +197 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.js +131 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.d.ts +20 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.js +46 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.d.ts +46 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.js +176 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/catalog.d.ts +20 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/catalog.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/catalog.js +39 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/catalog.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/constants.d.ts +5 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/constants.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/constants.js +3 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/constants.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/create-page.d.ts +17 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/create-page.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/create-page.js +35 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/create-page.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.d.ts +19 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.js +79 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/help.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/help.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/help.js +243 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/help.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/index.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/index.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/index.js +2 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/index.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.d.ts +19 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.js +31 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.d.ts +23 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.js +72 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.d.ts +20 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.js +34 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.d.ts +17 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.js +70 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.js.map +1 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.js +37 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.js.map +1 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.d.ts +7 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.js +18 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.js.map +1 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.js +2 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.js.map +1 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/index.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/index.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/index.js +2 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/index.js.map +1 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.js +861 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.js.map +1 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.d.ts +5 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.js +16 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.js.map +1 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.d.ts +53 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.js +145 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.js.map +1 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/index.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/index.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/index.js +2 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/index.js.map +1 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.js +69 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.js.map +1 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.d.ts +7 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.js +18 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.d.ts +6 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.js +178 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.d.ts +3 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.js +55 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.d.ts +12 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.js +125 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.d.ts +8 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.js +582 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/index.d.ts +6 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/index.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/index.js +6 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/index.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.d.ts +4 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.js +54 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.d.ts +11 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.js +92 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.d.ts +7 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.js +30 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.js +471 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.d.ts +5 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.js +16 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.d.ts +43 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.js +115 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.d.ts +9 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.js +152 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.d.ts +16 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.js +134 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.js.map +1 -0
- package/dist/puck-editor/internal/puck-augmentation.d.ts +28 -0
- package/dist/puck-editor/internal/puck-augmentation.d.ts.map +1 -0
- package/dist/puck-editor/internal/puck-augmentation.js +7 -0
- package/dist/puck-editor/internal/puck-augmentation.js.map +1 -0
- package/dist/puck-editor/internal/puck-editor-provider.d.ts +12 -0
- package/dist/puck-editor/internal/puck-editor-provider.d.ts.map +1 -0
- package/dist/puck-editor/internal/puck-editor-provider.js +69 -0
- package/dist/puck-editor/internal/puck-editor-provider.js.map +1 -0
- package/dist/puck-editor/internal/puck-node.d.ts +29 -0
- package/dist/puck-editor/internal/puck-node.d.ts.map +1 -0
- package/dist/puck-editor/internal/puck-node.js +2 -0
- package/dist/puck-editor/internal/puck-node.js.map +1 -0
- package/dist/puck-editor/internal/puck-wrapper.d.ts +19 -0
- package/dist/puck-editor/internal/puck-wrapper.d.ts.map +1 -0
- package/dist/puck-editor/internal/puck-wrapper.js +270 -0
- package/dist/puck-editor/internal/puck-wrapper.js.map +1 -0
- package/dist/puck-editor/internal/render/cropped-image.d.ts +19 -0
- package/dist/puck-editor/internal/render/cropped-image.d.ts.map +1 -0
- package/dist/puck-editor/internal/render/cropped-image.js +126 -0
- package/dist/puck-editor/internal/render/cropped-image.js.map +1 -0
- package/dist/puck-editor/internal/smart-actions/index.d.ts +13 -0
- package/dist/puck-editor/internal/smart-actions/index.d.ts.map +1 -0
- package/dist/puck-editor/internal/smart-actions/index.js +29 -0
- package/dist/puck-editor/internal/smart-actions/index.js.map +1 -0
- package/dist/puck-editor/internal/smart-actions/new-page.d.ts +13 -0
- package/dist/puck-editor/internal/smart-actions/new-page.d.ts.map +1 -0
- package/dist/puck-editor/internal/smart-actions/new-page.js +80 -0
- package/dist/puck-editor/internal/smart-actions/new-page.js.map +1 -0
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.d.ts +2 -0
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.d.ts.map +1 -0
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.js +65 -0
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.js.map +1 -0
- package/dist/puck-editor/internal/ui/calendar.d.ts +9 -0
- package/dist/puck-editor/internal/ui/calendar.d.ts.map +1 -0
- package/dist/puck-editor/internal/ui/calendar.js +147 -0
- package/dist/puck-editor/internal/ui/calendar.js.map +1 -0
- package/dist/puck-editor/internal/ui/component-list-accordion.d.ts +13 -0
- package/dist/puck-editor/internal/ui/component-list-accordion.d.ts.map +1 -0
- package/dist/puck-editor/internal/ui/component-list-accordion.js +93 -0
- package/dist/puck-editor/internal/ui/component-list-accordion.js.map +1 -0
- package/dist/puck-editor/internal/ui/dialog.d.ts +20 -0
- package/dist/puck-editor/internal/ui/dialog.d.ts.map +1 -0
- package/dist/puck-editor/internal/ui/dialog.js +286 -0
- package/dist/puck-editor/internal/ui/dialog.js.map +1 -0
- package/dist/puck-editor/internal/ui/drawer-item-content.d.ts +11 -0
- package/dist/puck-editor/internal/ui/drawer-item-content.d.ts.map +1 -0
- package/dist/puck-editor/internal/ui/drawer-item-content.js +109 -0
- package/dist/puck-editor/internal/ui/drawer-item-content.js.map +1 -0
- package/dist/puck-editor/internal/ui/icon-button.d.ts +10 -0
- package/dist/puck-editor/internal/ui/icon-button.d.ts.map +1 -0
- package/dist/puck-editor/internal/ui/icon-button.js +72 -0
- package/dist/puck-editor/internal/ui/icon-button.js.map +1 -0
- package/dist/puck-editor/internal/ui/popover.d.ts +9 -0
- package/dist/puck-editor/internal/ui/popover.d.ts.map +1 -0
- package/dist/puck-editor/internal/ui/popover.js +165 -0
- package/dist/puck-editor/internal/ui/popover.js.map +1 -0
- package/dist/puck-editor/internal/ui/required-mark.d.ts +2 -0
- package/dist/puck-editor/internal/ui/required-mark.d.ts.map +1 -0
- package/dist/puck-editor/internal/ui/required-mark.js +12 -0
- package/dist/puck-editor/internal/ui/required-mark.js.map +1 -0
- package/dist/puck-editor/internal/ui/search-control.d.ts +20 -0
- package/dist/puck-editor/internal/ui/search-control.d.ts.map +1 -0
- package/dist/puck-editor/internal/ui/search-control.js +156 -0
- package/dist/puck-editor/internal/ui/search-control.js.map +1 -0
- package/dist/puck-editor/internal/ui/use-panel-search-focus.d.ts +2 -0
- package/dist/puck-editor/internal/ui/use-panel-search-focus.d.ts.map +1 -0
- package/dist/puck-editor/internal/ui/use-panel-search-focus.js +40 -0
- package/dist/puck-editor/internal/ui/use-panel-search-focus.js.map +1 -0
- package/dist/puck-editor/internal/use-puck-overlay.d.ts +16 -0
- package/dist/puck-editor/internal/use-puck-overlay.d.ts.map +1 -0
- package/dist/puck-editor/internal/use-puck-overlay.js +121 -0
- package/dist/puck-editor/internal/use-puck-overlay.js.map +1 -0
- package/dist/puck-editor/internal/utils.d.ts +6 -0
- package/dist/puck-editor/internal/utils.d.ts.map +1 -0
- package/dist/puck-editor/internal/utils.js +57 -0
- package/dist/puck-editor/internal/utils.js.map +1 -0
- package/dist/puck-editor/puck-theme.css +110 -0
- package/dist/puck-editor/render.d.ts +3 -0
- package/dist/puck-editor/render.d.ts.map +1 -0
- package/dist/puck-editor/render.js +2 -0
- package/dist/puck-editor/render.js.map +1 -0
- package/dist/puck-editor/server.d.ts +4 -0
- package/dist/puck-editor/server.d.ts.map +1 -0
- package/dist/puck-editor/server.js +4 -0
- package/dist/puck-editor/server.js.map +1 -0
- package/dist/puck-editor/smart-actions.d.ts +2 -0
- package/dist/puck-editor/smart-actions.d.ts.map +1 -0
- package/dist/puck-editor/smart-actions.js +2 -0
- package/dist/puck-editor/smart-actions.js.map +1 -0
- package/dist/shared/cn.d.ts +3 -0
- package/dist/shared/cn.d.ts.map +1 -0
- package/dist/shared/cn.js +9 -0
- package/dist/shared/cn.js.map +1 -0
- package/dist/shared/i18n.d.ts +5 -0
- package/dist/shared/i18n.d.ts.map +1 -0
- package/dist/shared/i18n.js +18 -0
- package/dist/shared/i18n.js.map +1 -0
- package/dist/shared/toolbar-action.d.ts +9 -0
- package/dist/shared/toolbar-action.d.ts.map +1 -0
- package/dist/shared/toolbar-action.js +2 -0
- package/dist/shared/toolbar-action.js.map +1 -0
- package/dist/smart-actions/internal/get-smart-actions-context.d.ts +19 -0
- package/dist/smart-actions/internal/get-smart-actions-context.d.ts.map +1 -0
- package/dist/smart-actions/internal/get-smart-actions-context.js +24 -0
- package/dist/smart-actions/internal/get-smart-actions-context.js.map +1 -0
- package/dist/smart-actions/internal/i18n.d.ts +20 -0
- package/dist/smart-actions/internal/i18n.d.ts.map +1 -0
- package/dist/smart-actions/internal/i18n.js +35 -0
- package/dist/smart-actions/internal/i18n.js.map +1 -0
- package/dist/smart-actions/internal/logout-form.d.ts +8 -0
- package/dist/smart-actions/internal/logout-form.d.ts.map +1 -0
- package/dist/smart-actions/internal/logout-form.js +88 -0
- package/dist/smart-actions/internal/logout-form.js.map +1 -0
- package/dist/smart-actions/internal/refresh-page.d.ts +2 -0
- package/dist/smart-actions/internal/refresh-page.d.ts.map +1 -0
- package/dist/smart-actions/internal/refresh-page.js +126 -0
- package/dist/smart-actions/internal/refresh-page.js.map +1 -0
- package/dist/smart-actions/internal/smart-actions-button.d.ts +24 -0
- package/dist/smart-actions/internal/smart-actions-button.d.ts.map +1 -0
- package/dist/smart-actions/internal/smart-actions-button.js +41 -0
- package/dist/smart-actions/internal/smart-actions-button.js.map +1 -0
- package/dist/smart-actions/internal/smart-actions-config.d.ts +13 -0
- package/dist/smart-actions/internal/smart-actions-config.d.ts.map +1 -0
- package/dist/smart-actions/internal/smart-actions-config.js +101 -0
- package/dist/smart-actions/internal/smart-actions-config.js.map +1 -0
- package/dist/smart-actions/internal/smart-actions-toolbar-client.d.ts +15 -0
- package/dist/smart-actions/internal/smart-actions-toolbar-client.d.ts.map +1 -0
- package/dist/smart-actions/internal/smart-actions-toolbar-client.js +71 -0
- package/dist/smart-actions/internal/smart-actions-toolbar-client.js.map +1 -0
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.d.ts +13 -0
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.d.ts.map +1 -0
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.js +323 -0
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.js.map +1 -0
- package/dist/smart-actions/internal/toolbar/storage.d.ts +7 -0
- package/dist/smart-actions/internal/toolbar/storage.d.ts.map +1 -0
- package/dist/smart-actions/internal/toolbar/storage.js +29 -0
- package/dist/smart-actions/internal/toolbar/storage.js.map +1 -0
- package/dist/smart-actions/internal/toolbar/types.d.ts +4 -0
- package/dist/smart-actions/internal/toolbar/types.d.ts.map +1 -0
- package/dist/smart-actions/internal/toolbar/types.js +2 -0
- package/dist/smart-actions/internal/toolbar/types.js.map +1 -0
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.d.ts +6 -0
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.d.ts.map +1 -0
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.js +43 -0
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.js.map +1 -0
- package/dist/smart-actions/internal/ui/tooltip.d.ts +8 -0
- package/dist/smart-actions/internal/ui/tooltip.d.ts.map +1 -0
- package/dist/smart-actions/internal/ui/tooltip.js +156 -0
- package/dist/smart-actions/internal/ui/tooltip.js.map +1 -0
- package/dist/smart-actions/internal/user-profile.d.ts +8 -0
- package/dist/smart-actions/internal/user-profile.d.ts.map +1 -0
- package/dist/smart-actions/internal/user-profile.js +30 -0
- package/dist/smart-actions/internal/user-profile.js.map +1 -0
- package/dist/smart-actions/server.d.ts +4 -0
- package/dist/smart-actions/server.d.ts.map +1 -0
- package/dist/smart-actions/server.js +4 -0
- package/dist/smart-actions/server.js.map +1 -0
- package/dist/theme.css +2 -0
- package/dist/visual-editor/index.d.ts +4 -0
- package/dist/visual-editor/index.d.ts.map +1 -0
- package/dist/visual-editor/index.js +4 -0
- package/dist/visual-editor/index.js.map +1 -0
- package/dist/visual-editor/internal/bridge/connector.d.ts +7 -0
- package/dist/visual-editor/internal/bridge/connector.d.ts.map +1 -0
- package/dist/visual-editor/internal/bridge/connector.js +72 -0
- package/dist/visual-editor/internal/bridge/connector.js.map +1 -0
- package/dist/visual-editor/internal/bridge/draft-mode-self-heal.d.ts +8 -0
- package/dist/visual-editor/internal/bridge/draft-mode-self-heal.d.ts.map +1 -0
- package/dist/visual-editor/internal/bridge/draft-mode-self-heal.js +44 -0
- package/dist/visual-editor/internal/bridge/draft-mode-self-heal.js.map +1 -0
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.d.ts +16 -0
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.d.ts.map +1 -0
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.js +43 -0
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.js.map +1 -0
- package/dist/visual-editor/internal/bridge/editor-auth-gate.d.ts +15 -0
- package/dist/visual-editor/internal/bridge/editor-auth-gate.d.ts.map +1 -0
- package/dist/visual-editor/internal/bridge/editor-auth-gate.js +146 -0
- package/dist/visual-editor/internal/bridge/editor-auth-gate.js.map +1 -0
- package/dist/visual-editor/internal/i18n.d.ts +29 -0
- package/dist/visual-editor/internal/i18n.d.ts.map +1 -0
- package/dist/visual-editor/internal/i18n.js +51 -0
- package/dist/visual-editor/internal/i18n.js.map +1 -0
- package/dist/visual-editor/internal/overlays/drupal-origin.d.ts +7 -0
- package/dist/visual-editor/internal/overlays/drupal-origin.d.ts.map +1 -0
- package/dist/visual-editor/internal/overlays/drupal-origin.js +15 -0
- package/dist/visual-editor/internal/overlays/drupal-origin.js.map +1 -0
- package/dist/visual-editor/internal/overlays/edit-button.d.ts +10 -0
- package/dist/visual-editor/internal/overlays/edit-button.d.ts.map +1 -0
- package/dist/visual-editor/internal/overlays/edit-button.js +138 -0
- package/dist/visual-editor/internal/overlays/edit-button.js.map +1 -0
- package/dist/visual-editor/internal/overlays/edit-icon.d.ts +3 -0
- package/dist/visual-editor/internal/overlays/edit-icon.d.ts.map +1 -0
- package/dist/visual-editor/internal/overlays/edit-icon.js +19 -0
- package/dist/visual-editor/internal/overlays/edit-icon.js.map +1 -0
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.d.ts +15 -0
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.d.ts.map +1 -0
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.js +52 -0
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.js.map +1 -0
- package/dist/visual-editor/internal/overlays/iframe-wrapper.d.ts +6 -0
- package/dist/visual-editor/internal/overlays/iframe-wrapper.d.ts.map +1 -0
- package/dist/visual-editor/internal/overlays/iframe-wrapper.js +42 -0
- package/dist/visual-editor/internal/overlays/iframe-wrapper.js.map +1 -0
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.d.ts +9 -0
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.d.ts.map +1 -0
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.js +33 -0
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.js.map +1 -0
- package/dist/visual-editor/internal/overlays/node/node-metadata.d.ts +13 -0
- package/dist/visual-editor/internal/overlays/node/node-metadata.d.ts.map +1 -0
- package/dist/visual-editor/internal/overlays/node/node-metadata.js +17 -0
- package/dist/visual-editor/internal/overlays/node/node-metadata.js.map +1 -0
- package/dist/visual-editor/internal/overlays/node/node-wrapper.d.ts +8 -0
- package/dist/visual-editor/internal/overlays/node/node-wrapper.d.ts.map +1 -0
- package/dist/visual-editor/internal/overlays/node/node-wrapper.js +25 -0
- package/dist/visual-editor/internal/overlays/node/node-wrapper.js.map +1 -0
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.d.ts +18 -0
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.d.ts.map +1 -0
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.js +58 -0
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.js.map +1 -0
- package/dist/visual-editor/internal/revalidate-route.d.ts +19 -0
- package/dist/visual-editor/internal/revalidate-route.d.ts.map +1 -0
- package/dist/visual-editor/internal/revalidate-route.js +51 -0
- package/dist/visual-editor/internal/revalidate-route.js.map +1 -0
- package/dist/visual-editor/server.d.ts +7 -0
- package/dist/visual-editor/server.d.ts.map +1 -0
- package/dist/visual-editor/server.js +8 -0
- package/dist/visual-editor/server.js.map +1 -0
- package/package.json +154 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { NextResponse } from 'next/server';
|
|
2
|
+
import { DrupalJsonApiParams } from 'drupal-jsonapi-params';
|
|
3
|
+
import { normalizeLang } from '../../locale';
|
|
4
|
+
import { buildMediaListParams, buildMediaParams } from '../media-params';
|
|
5
|
+
|
|
6
|
+
// All handlers run behind requireAuth, so they act as the logged-in editor
|
|
7
|
+
// and stay uncached; site rendering keeps its own cached data layer.
|
|
8
|
+
|
|
9
|
+
const NO_STORE = 'no-store, no-cache, must-revalidate';
|
|
10
|
+
const NODE_LIST_LIMIT = 50;
|
|
11
|
+
export async function handleLinks(config, lang) {
|
|
12
|
+
if (!config.getLinks) {
|
|
13
|
+
return NextResponse.json({
|
|
14
|
+
error: 'links are not configured (PuckApiConfig.getLinks)'
|
|
15
|
+
}, {
|
|
16
|
+
status: 404
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const links = await config.getLinks(lang ?? '');
|
|
21
|
+
return NextResponse.json(links);
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error('Error fetching puck links:', error);
|
|
24
|
+
return NextResponse.json({
|
|
25
|
+
error: 'Failed to load links'
|
|
26
|
+
}, {
|
|
27
|
+
status: 500
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export async function handleNodeList(config, type, searchParams) {
|
|
32
|
+
try {
|
|
33
|
+
const lang = normalizeLang(searchParams.get('lang'));
|
|
34
|
+
const query = searchParams.get('query')?.trim() ?? '';
|
|
35
|
+
const searchFields = (searchParams.get('searchFields') ?? 'title').split(',').map(field => field.trim()).filter(Boolean);
|
|
36
|
+
const fields = (searchParams.get('fields') ?? '').split(',').map(field => field.trim()).filter(Boolean);
|
|
37
|
+
const apiParams = new DrupalJsonApiParams().addSort('created', 'DESC').addPageLimit(NODE_LIST_LIMIT);
|
|
38
|
+
if (fields.length) {
|
|
39
|
+
apiParams.addFields(`node--${type}`, fields);
|
|
40
|
+
}
|
|
41
|
+
if (query) {
|
|
42
|
+
if (searchFields.length > 1) {
|
|
43
|
+
apiParams.addGroup('node-search', 'OR');
|
|
44
|
+
searchFields.forEach(field => apiParams.addFilter(field, query, 'CONTAINS', 'node-search'));
|
|
45
|
+
} else {
|
|
46
|
+
apiParams.addFilter(searchFields[0] ?? 'title', query, 'CONTAINS');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const nodes = await config.createUserClient().getNodes(type, {
|
|
50
|
+
lang,
|
|
51
|
+
params: apiParams
|
|
52
|
+
});
|
|
53
|
+
return NextResponse.json(nodes?.data ?? []);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error('Error fetching node:', error);
|
|
56
|
+
return NextResponse.json({
|
|
57
|
+
error: 'An unexpected error occurred'
|
|
58
|
+
}, {
|
|
59
|
+
status: 500
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export async function handleNodeItem(config, type, id, lang) {
|
|
64
|
+
try {
|
|
65
|
+
const node = await config.createUserClient().getNode(id, type, {
|
|
66
|
+
lang
|
|
67
|
+
});
|
|
68
|
+
if (!node?.data) {
|
|
69
|
+
return NextResponse.json({
|
|
70
|
+
error: `Node not found: ${type}/${id}`
|
|
71
|
+
}, {
|
|
72
|
+
status: 404
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return NextResponse.json(node.data);
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.error('Error fetching node:', error);
|
|
78
|
+
return NextResponse.json({
|
|
79
|
+
error: 'An unexpected error occurred'
|
|
80
|
+
}, {
|
|
81
|
+
status: 500
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export async function handleMediaList(config, type, searchParams) {
|
|
86
|
+
try {
|
|
87
|
+
const lang = normalizeLang(searchParams.get('lang'));
|
|
88
|
+
const query = searchParams.get('query') ?? undefined;
|
|
89
|
+
const offset = searchParams.get('offset') ?? undefined;
|
|
90
|
+
const limit = searchParams.get('limit') ?? undefined;
|
|
91
|
+
const client = await config.createClient();
|
|
92
|
+
const mediaList = await client.getMediaList(type, {
|
|
93
|
+
lang,
|
|
94
|
+
params: buildMediaListParams(type, query, offset, limit)
|
|
95
|
+
});
|
|
96
|
+
const response = NextResponse.json(mediaList);
|
|
97
|
+
response.headers.set('Cache-Control', NO_STORE);
|
|
98
|
+
return response;
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error('Error fetching media:', error);
|
|
101
|
+
return NextResponse.json({
|
|
102
|
+
error: 'An unexpected error occurred'
|
|
103
|
+
}, {
|
|
104
|
+
status: 500
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
export async function handleMediaItem(config, type, id, lang) {
|
|
109
|
+
try {
|
|
110
|
+
const media = await config.createUserClient().getMedia(id, type, {
|
|
111
|
+
lang,
|
|
112
|
+
params: buildMediaParams(type)
|
|
113
|
+
});
|
|
114
|
+
if (!media?.data) {
|
|
115
|
+
return NextResponse.json({
|
|
116
|
+
error: 'Media not found'
|
|
117
|
+
}, {
|
|
118
|
+
status: 404
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
const response = NextResponse.json(media);
|
|
122
|
+
response.headers.set('Cache-Control', NO_STORE);
|
|
123
|
+
return response;
|
|
124
|
+
} catch (error) {
|
|
125
|
+
console.error('Error fetching media:', error);
|
|
126
|
+
return NextResponse.json({
|
|
127
|
+
error: 'An unexpected error occurred'
|
|
128
|
+
}, {
|
|
129
|
+
status: 500
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export async function handleFragmentList(config, type, searchParams) {
|
|
134
|
+
try {
|
|
135
|
+
const lang = normalizeLang(searchParams.get('lang'));
|
|
136
|
+
const query = searchParams.get('query') ?? undefined;
|
|
137
|
+
const offset = searchParams.get('offset') ?? undefined;
|
|
138
|
+
const limit = searchParams.get('limit') ?? undefined;
|
|
139
|
+
const apiParams = new DrupalJsonApiParams().addSort('created', 'DESC');
|
|
140
|
+
if (config.spaceId) {
|
|
141
|
+
apiParams.addFilter('space_id.meta.drupal_internal__target_id', config.spaceId);
|
|
142
|
+
}
|
|
143
|
+
if (query) {
|
|
144
|
+
apiParams.addFilter('title', query, 'CONTAINS');
|
|
145
|
+
}
|
|
146
|
+
if (offset) {
|
|
147
|
+
apiParams.addPageOffset(Number(offset));
|
|
148
|
+
}
|
|
149
|
+
if (limit) {
|
|
150
|
+
apiParams.addPageLimit(Number(limit));
|
|
151
|
+
}
|
|
152
|
+
const fragments = await config.createUserClient().getFragments(type, {
|
|
153
|
+
lang,
|
|
154
|
+
params: apiParams
|
|
155
|
+
});
|
|
156
|
+
return NextResponse.json(fragments);
|
|
157
|
+
} catch (error) {
|
|
158
|
+
console.error('Error fetching fragments:', error);
|
|
159
|
+
return NextResponse.json({
|
|
160
|
+
error: 'An unexpected error occurred'
|
|
161
|
+
}, {
|
|
162
|
+
status: 500
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=entities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.js","names":["NextResponse","DrupalJsonApiParams","normalizeLang","buildMediaListParams","buildMediaParams","NO_STORE","NODE_LIST_LIMIT","handleLinks","config","lang","getLinks","json","error","status","links","console","handleNodeList","type","searchParams","get","query","trim","searchFields","split","map","field","filter","Boolean","fields","apiParams","addSort","addPageLimit","length","addFields","addGroup","forEach","addFilter","nodes","createUserClient","getNodes","params","data","handleNodeItem","id","node","getNode","handleMediaList","undefined","offset","limit","client","createClient","mediaList","getMediaList","response","headers","set","handleMediaItem","media","getMedia","handleFragmentList","spaceId","addPageOffset","Number","fragments","getFragments"],"sources":["../../../../../src/puck-editor/internal/api/handlers/entities.ts"],"sourcesContent":["import { NextResponse } from 'next/server';\nimport { DrupalJsonApiParams } from 'drupal-jsonapi-params';\n\nimport { normalizeLang } from '../../locale';\nimport type { PuckApiConfig } from '../config';\nimport { buildMediaListParams, buildMediaParams } from '../media-params';\n\n// All handlers run behind requireAuth, so they act as the logged-in editor\n// and stay uncached; site rendering keeps its own cached data layer.\n\nconst NO_STORE = 'no-store, no-cache, must-revalidate';\n\nconst NODE_LIST_LIMIT = 50;\n\nexport async function handleLinks(config: PuckApiConfig, lang?: string) {\n if (!config.getLinks) {\n return NextResponse.json(\n { error: 'links are not configured (PuckApiConfig.getLinks)' },\n { status: 404 }\n );\n }\n\n try {\n const links = await config.getLinks(lang ?? '');\n return NextResponse.json(links);\n } catch (error) {\n console.error('Error fetching puck links:', error);\n return NextResponse.json(\n { error: 'Failed to load links' },\n { status: 500 }\n );\n }\n}\n\nexport async function handleNodeList(\n config: PuckApiConfig,\n type: string,\n searchParams: URLSearchParams\n) {\n try {\n const lang = normalizeLang(searchParams.get('lang'));\n const query = searchParams.get('query')?.trim() ?? '';\n const searchFields = (searchParams.get('searchFields') ?? 'title')\n .split(',')\n .map((field) => field.trim())\n .filter(Boolean);\n const fields = (searchParams.get('fields') ?? '')\n .split(',')\n .map((field) => field.trim())\n .filter(Boolean);\n\n const apiParams = new DrupalJsonApiParams()\n .addSort('created', 'DESC')\n .addPageLimit(NODE_LIST_LIMIT);\n\n if (fields.length) {\n apiParams.addFields(`node--${type}`, fields);\n }\n\n if (query) {\n if (searchFields.length > 1) {\n apiParams.addGroup('node-search', 'OR');\n searchFields.forEach((field) =>\n apiParams.addFilter(field, query, 'CONTAINS', 'node-search')\n );\n } else {\n apiParams.addFilter(searchFields[0] ?? 'title', query, 'CONTAINS');\n }\n }\n\n const nodes = await config\n .createUserClient()\n .getNodes(type, { lang, params: apiParams });\n\n return NextResponse.json(nodes?.data ?? []);\n } catch (error) {\n console.error('Error fetching node:', error);\n return NextResponse.json(\n { error: 'An unexpected error occurred' },\n { status: 500 }\n );\n }\n}\n\nexport async function handleNodeItem(\n config: PuckApiConfig,\n type: string,\n id: string,\n lang?: string\n) {\n try {\n const node = await config.createUserClient().getNode(id, type, { lang });\n\n if (!node?.data) {\n return NextResponse.json(\n { error: `Node not found: ${type}/${id}` },\n { status: 404 }\n );\n }\n\n return NextResponse.json(node.data);\n } catch (error) {\n console.error('Error fetching node:', error);\n return NextResponse.json(\n { error: 'An unexpected error occurred' },\n { status: 500 }\n );\n }\n}\n\nexport async function handleMediaList(\n config: PuckApiConfig,\n type: string,\n searchParams: URLSearchParams\n) {\n try {\n const lang = normalizeLang(searchParams.get('lang'));\n const query = searchParams.get('query') ?? undefined;\n const offset = searchParams.get('offset') ?? undefined;\n const limit = searchParams.get('limit') ?? undefined;\n\n const client = await config.createClient();\n const mediaList = await client.getMediaList(type, {\n lang,\n params: buildMediaListParams(type, query, offset, limit),\n });\n\n const response = NextResponse.json(mediaList);\n response.headers.set('Cache-Control', NO_STORE);\n return response;\n } catch (error) {\n console.error('Error fetching media:', error);\n return NextResponse.json(\n { error: 'An unexpected error occurred' },\n { status: 500 }\n );\n }\n}\n\nexport async function handleMediaItem(\n config: PuckApiConfig,\n type: string,\n id: string,\n lang?: string\n) {\n try {\n const media = await config.createUserClient().getMedia(id, type, {\n lang,\n params: buildMediaParams(type),\n });\n\n if (!media?.data) {\n return NextResponse.json({ error: 'Media not found' }, { status: 404 });\n }\n\n const response = NextResponse.json(media);\n response.headers.set('Cache-Control', NO_STORE);\n return response;\n } catch (error) {\n console.error('Error fetching media:', error);\n return NextResponse.json(\n { error: 'An unexpected error occurred' },\n { status: 500 }\n );\n }\n}\n\nexport async function handleFragmentList(\n config: PuckApiConfig,\n type: string,\n searchParams: URLSearchParams\n) {\n try {\n const lang = normalizeLang(searchParams.get('lang'));\n const query = searchParams.get('query') ?? undefined;\n const offset = searchParams.get('offset') ?? undefined;\n const limit = searchParams.get('limit') ?? undefined;\n\n const apiParams = new DrupalJsonApiParams().addSort('created', 'DESC');\n if (config.spaceId) {\n apiParams.addFilter(\n 'space_id.meta.drupal_internal__target_id',\n config.spaceId\n );\n }\n if (query) {\n apiParams.addFilter('title', query, 'CONTAINS');\n }\n if (offset) {\n apiParams.addPageOffset(Number(offset));\n }\n if (limit) {\n apiParams.addPageLimit(Number(limit));\n }\n\n const fragments = await config.createUserClient().getFragments(type, {\n lang,\n params: apiParams,\n });\n\n return NextResponse.json(fragments);\n } catch (error) {\n console.error('Error fetching fragments:', error);\n return NextResponse.json(\n { error: 'An unexpected error occurred' },\n { status: 500 }\n );\n }\n}\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,aAAa;AAC1C,SAASC,mBAAmB,QAAQ,uBAAuB;AAE3D,SAASC,aAAa,QAAQ,cAAc;AAE5C,SAASC,oBAAoB,EAAEC,gBAAgB,QAAQ,iBAAiB;;AAExE;AACA;;AAEA,MAAMC,QAAQ,GAAG,qCAAqC;AAEtD,MAAMC,eAAe,GAAG,EAAE;AAE1B,OAAO,eAAeC,WAAWA,CAACC,MAAqB,EAAEC,IAAa,EAAE;EACtE,IAAI,CAACD,MAAM,CAACE,QAAQ,EAAE;IACpB,OAAOV,YAAY,CAACW,IAAI,CACtB;MAAEC,KAAK,EAAE;IAAoD,CAAC,EAC9D;MAAEC,MAAM,EAAE;IAAI,CAChB,CAAC;EACH;EAEA,IAAI;IACF,MAAMC,KAAK,GAAG,MAAMN,MAAM,CAACE,QAAQ,CAACD,IAAI,IAAI,EAAE,CAAC;IAC/C,OAAOT,YAAY,CAACW,IAAI,CAACG,KAAK,CAAC;EACjC,CAAC,CAAC,OAAOF,KAAK,EAAE;IACdG,OAAO,CAACH,KAAK,CAAC,4BAA4B,EAAEA,KAAK,CAAC;IAClD,OAAOZ,YAAY,CAACW,IAAI,CACtB;MAAEC,KAAK,EAAE;IAAuB,CAAC,EACjC;MAAEC,MAAM,EAAE;IAAI,CAChB,CAAC;EACH;AACF;AAEA,OAAO,eAAeG,cAAcA,CAClCR,MAAqB,EACrBS,IAAY,EACZC,YAA6B,EAC7B;EACA,IAAI;IACF,MAAMT,IAAI,GAAGP,aAAa,CAACgB,YAAY,CAACC,G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O,EAAEhB,KAAK,EAAE,UAAU,CAAC;IACjD;IACA,IAAI4B,MAAM,EAAE;MACVnB,SAAS,CAACiC,aAAa,CAACC,MAAM,CAACf,MAAM,CAAC,CAAC;IACzC;IACA,IAAIC,KAAK,EAAE;MACTpB,SAAS,CAACE,YAAY,CAACgC,MAAM,CAACd,KAAK,CAAC,CAAC;IACvC;IAEA,MAAMe,SAAS,GAAG,MAAMxD,MAAM,CAAC8B,gBAAgB,CAAC,CAAC,CAAC2B,YAAY,CAAChD,IAAI,EAAE;MACnER,IAAI;MACJ+B,MAAM,EAAEX;IACV,CAAC,CAAC;IAEF,OAAO7B,YAAY,CAACW,IAAI,CAACqD,SAAS,CAAC;EACrC,CAAC,CAAC,OAAOpD,KAAK,EAAE;IACdG,OAAO,CAACH,KAAK,CAAC,2BAA2B,EAAEA,KAAK,CAAC;IACjD,OAAOZ,YAAY,CAACW,IAAI,CACtB;MAAEC,KAAK,EAAE;IAA+B,CAAC,EACzC;MAAEC,MAAM,EAAE;IAAI,CAChB,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import type { PuckApiRuntime } from '../config';
|
|
3
|
+
export declare function handlePublish(config: PuckApiRuntime, request: NextRequest): Promise<NextResponse<{
|
|
4
|
+
status: string;
|
|
5
|
+
}>>;
|
|
6
|
+
//# sourceMappingURL=publish.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../../../src/puck-editor/internal/api/handlers/publish.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAMhD,wBAAsB,aAAa,CACjC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,WAAW;;IA6HrB"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { revalidatePath } from 'next/cache';
|
|
2
|
+
import { NextResponse } from 'next/server';
|
|
3
|
+
import { DEFAULT_METADATA_FIELDS, getBundle } from '../../content-model';
|
|
4
|
+
const TYPE_RE = /^[a-z_]+(--[a-z_]+)?$/;
|
|
5
|
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
6
|
+
export async function handlePublish(config, request) {
|
|
7
|
+
const {
|
|
8
|
+
path,
|
|
9
|
+
type,
|
|
10
|
+
data,
|
|
11
|
+
nodeId,
|
|
12
|
+
fieldName,
|
|
13
|
+
lang,
|
|
14
|
+
pageSettings
|
|
15
|
+
} = await request.json();
|
|
16
|
+
const bundle = getBundle(config.model, type);
|
|
17
|
+
const allowedFieldNames = bundle ? new Set([bundle.dataField]) : new Set([...config.model.bundles.map(b => b.dataField), config.model.templates.dataField]);
|
|
18
|
+
if (typeof fieldName !== 'string' || !allowedFieldNames.has(fieldName) || typeof type !== 'string' || !TYPE_RE.test(type) || typeof nodeId !== 'string' || !UUID_RE.test(nodeId)) {
|
|
19
|
+
return NextResponse.json({
|
|
20
|
+
status: 'error',
|
|
21
|
+
message: 'invalid fieldName, type, or nodeId'
|
|
22
|
+
}, {
|
|
23
|
+
status: 400
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const meta = bundle?.metadataFields ?? DEFAULT_METADATA_FIELDS;
|
|
27
|
+
const jsonApiType = type.replace('node--', '');
|
|
28
|
+
try {
|
|
29
|
+
const attributes = {
|
|
30
|
+
[fieldName]: JSON.stringify(data)
|
|
31
|
+
};
|
|
32
|
+
if (typeof pageSettings?.title === 'string' && pageSettings.title.trim()) {
|
|
33
|
+
attributes.title = pageSettings.title.trim();
|
|
34
|
+
}
|
|
35
|
+
if (meta.title && typeof pageSettings?.metadataTitle === 'string') {
|
|
36
|
+
attributes[meta.title] = pageSettings.metadataTitle;
|
|
37
|
+
}
|
|
38
|
+
if (meta.description && typeof pageSettings?.metadataDescription === 'string') {
|
|
39
|
+
attributes[meta.description] = pageSettings.metadataDescription;
|
|
40
|
+
}
|
|
41
|
+
if (typeof pageSettings?.published === 'boolean') {
|
|
42
|
+
attributes.status = pageSettings.published;
|
|
43
|
+
}
|
|
44
|
+
if (typeof pageSettings?.urlAlias === 'string') {
|
|
45
|
+
const alias = pageSettings.urlAlias.trim();
|
|
46
|
+
if (alias) {
|
|
47
|
+
attributes.path = {
|
|
48
|
+
alias: alias.startsWith('/') ? alias : `/${alias}`
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const relationships = {};
|
|
53
|
+
if (meta.image && pageSettings?.metadataImage === null) {
|
|
54
|
+
relationships[meta.image] = {
|
|
55
|
+
data: null
|
|
56
|
+
};
|
|
57
|
+
} else if (meta.image && pageSettings?.metadataImage?.id) {
|
|
58
|
+
relationships[meta.image] = {
|
|
59
|
+
data: {
|
|
60
|
+
type: pageSettings.metadataImage.type || 'media--image',
|
|
61
|
+
id: pageSettings.metadataImage.id
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const client = config.createUserClient();
|
|
66
|
+
const endpoint = `/jsonapi/node/${jsonApiType}/${nodeId}`;
|
|
67
|
+
const payload = {
|
|
68
|
+
data: {
|
|
69
|
+
type: type,
|
|
70
|
+
id: nodeId,
|
|
71
|
+
attributes,
|
|
72
|
+
...(Object.keys(relationships).length > 0 ? {
|
|
73
|
+
relationships
|
|
74
|
+
} : {})
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
await client.request(endpoint, {
|
|
78
|
+
method: 'PATCH',
|
|
79
|
+
lang,
|
|
80
|
+
data: payload,
|
|
81
|
+
headers: {
|
|
82
|
+
Accept: 'application/vnd.api+json'
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
} catch (error) {
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
|
+
const details = error?.details;
|
|
88
|
+
console.error('Error updating Drupal node:', error);
|
|
89
|
+
if (details) {
|
|
90
|
+
console.error('Drupal response details:', JSON.stringify(details, null, 2));
|
|
91
|
+
}
|
|
92
|
+
return NextResponse.json({
|
|
93
|
+
status: 'error',
|
|
94
|
+
message: `Error updating Drupal node: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
95
|
+
}, {
|
|
96
|
+
status: 500
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (typeof path === 'string' && path) {
|
|
100
|
+
revalidatePath(path);
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
await config.onPublished?.({
|
|
104
|
+
nodeId,
|
|
105
|
+
path,
|
|
106
|
+
lang
|
|
107
|
+
});
|
|
108
|
+
} catch (error) {
|
|
109
|
+
console.error('onPublished hook failed:', error);
|
|
110
|
+
}
|
|
111
|
+
return NextResponse.json({
|
|
112
|
+
status: 'ok'
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=publish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.js","names":["revalidatePath","NextResponse","DEFAULT_METADATA_FIELDS","getBundle","TYPE_RE","UUID_RE","handlePublish","config","request","path","type","data","nodeId","fieldName","lang","pageSettings","json","bundle","model","allowedFieldNames","Set","dataField","bundles","map","b","templates","has","test","status","message","meta","metadataFields","jsonApiType","replace","attributes","JSON","stringify","title","trim","metadataTitle","description","metadataDescription","published","urlAlias","alias","startsWith","relationships","image","metadataImage","id","client","createUserClient","endpoint","payload","Object","keys","length","method","headers","Accept","error","details","console","Error","onPublished"],"sources":["../../../../../src/puck-editor/internal/api/handlers/publish.ts"],"sourcesContent":["import { revalidatePath } from 'next/cache';\nimport { NextRequest, NextResponse } from 'next/server';\n\nimport { DEFAULT_METADATA_FIELDS, getBundle } from '../../content-model';\nimport type { PuckApiRuntime } from '../config';\n\nconst TYPE_RE = /^[a-z_]+(--[a-z_]+)?$/;\nconst UUID_RE =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nexport async function handlePublish(\n config: PuckApiRuntime,\n request: NextRequest\n) {\n const { path, type, data, nodeId, fieldName, lang, pageSettings } =\n await request.json();\n\n const bundle = getBundle(config.model, type);\n const allowedFieldNames = bundle\n ? new Set([bundle.dataField])\n : new Set([\n ...config.model.bundles.map((b) => b.dataField),\n config.model.templates.dataField,\n ]);\n\n if (\n typeof fieldName !== 'string' ||\n !allowedFieldNames.has(fieldName) ||\n typeof type !== 'string' ||\n !TYPE_RE.test(type) ||\n typeof nodeId !== 'string' ||\n !UUID_RE.test(nodeId)\n ) {\n return NextResponse.json(\n { status: 'error', message: 'invalid fieldName, type, or nodeId' },\n { status: 400 }\n );\n }\n\n const meta = bundle?.metadataFields ?? DEFAULT_METADATA_FIELDS;\n const jsonApiType = type.replace('node--', '');\n try {\n const attributes: Record<string, unknown> = {\n [fieldName]: JSON.stringify(data),\n };\n\n if (typeof pageSettings?.title === 'string' && pageSettings.title.trim()) {\n attributes.title = pageSettings.title.trim();\n }\n\n if (meta.title && typeof pageSettings?.metadataTitle === 'string') {\n attributes[meta.title] = pageSettings.metadataTitle;\n }\n\n if (\n meta.description &&\n typeof pageSettings?.metadataDescription === 'string'\n ) {\n attributes[meta.description] = pageSettings.metadataDescription;\n }\n\n if (typeof pageSettings?.published === 'boolean') {\n attributes.status = pageSettings.published;\n }\n\n if (typeof pageSettings?.urlAlias === 'string') {\n const alias = pageSettings.urlAlias.trim();\n if (alias) {\n attributes.path = {\n alias: alias.startsWith('/') ? alias : `/${alias}`,\n };\n }\n }\n\n const relationships: Record<string, unknown> = {};\n if (meta.image && pageSettings?.metadataImage === null) {\n relationships[meta.image] = {\n data: null,\n };\n } else if (meta.image && pageSettings?.metadataImage?.id) {\n relationships[meta.image] = {\n data: {\n type: pageSettings.metadataImage.type || 'media--image',\n id: pageSettings.metadataImage.id,\n },\n };\n }\n\n const client = config.createUserClient();\n const endpoint = `/jsonapi/node/${jsonApiType}/${nodeId}`;\n const payload = {\n data: {\n type: type,\n id: nodeId,\n attributes,\n ...(Object.keys(relationships).length > 0 ? { relationships } : {}),\n },\n };\n\n await client.request(endpoint, {\n method: 'PATCH',\n lang,\n data: payload,\n headers: { Accept: 'application/vnd.api+json' },\n });\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const details = (error as any)?.details;\n console.error('Error updating Drupal node:', error);\n if (details) {\n console.error(\n 'Drupal response details:',\n JSON.stringify(details, null, 2)\n );\n }\n return NextResponse.json(\n {\n status: 'error',\n message: `Error updating Drupal node: ${\n error instanceof Error ? error.message : 'Unknown error'\n }`,\n },\n { status: 500 }\n );\n }\n\n if (typeof path === 'string' && path) {\n revalidatePath(path);\n }\n\n try {\n await config.onPublished?.({ nodeId, path, lang });\n } catch (error) {\n console.error('onPublished hook failed:', error);\n }\n\n return NextResponse.json({ status: 'ok' });\n}\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,YAAY;AAC3C,SAAsBC,YAAY,QAAQ,aAAa;AAEvD,SAASC,uBAAuB,EAAEC,SAAS,QAAQ,qBAAqB;AAGxE,MAAMC,OAAO,GAAG,uBAAuB;AACvC,MAAMC,OAAO,GACX,iEAAiE;AAEnE,OAAO,eAAeC,aAAaA,CACjCC,MAAsB,EACtBC,OAAoB,EACpB;EACA,MAAM;IAAEC,IAAI;IAAEC,IAAI;IAAEC,IAAI;IAAEC,MAAM;IAAEC,SAAS;IAAEC,IAAI;IAAEC;EAAa,CAAC,GAC/D,MAAMP,OAAO,CAACQ,IAAI,CAAC,CAAC;EAEtB,MAAMC,MAAM,GAAGd,SAAS,CAACI,MAAM,CAACW,KAAK,EAAER,IAAI,CAAC;EAC5C,MAAMS,iBAAiB,GAAGF,MAAM,GAC5B,IAAIG,GAAG,CAAC,CAACH,MAAM,CAACI,SAAS,CAAC,CAAC,GAC3B,IAAID,GAAG,CAAC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C","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import type { PuckApiRuntime } from '../config';
|
|
3
|
+
export declare function handleSaveTemplate(config: PuckApiRuntime, request: NextRequest): Promise<NextResponse<{
|
|
4
|
+
success: boolean;
|
|
5
|
+
message: string;
|
|
6
|
+
}>>;
|
|
7
|
+
export declare function handleUpdateTemplate(config: PuckApiRuntime, fragmentType: string, id: string, request: NextRequest): Promise<NextResponse<{
|
|
8
|
+
success: boolean;
|
|
9
|
+
message: string;
|
|
10
|
+
}>>;
|
|
11
|
+
export declare function handleDeleteTemplate(config: PuckApiRuntime, fragmentType: string, id: string): Promise<NextResponse<{
|
|
12
|
+
success: boolean;
|
|
13
|
+
message: string;
|
|
14
|
+
}>>;
|
|
15
|
+
//# sourceMappingURL=template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../../src/puck-editor/internal/api/handlers/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAuBhD,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,WAAW;aAnBiB,OAAO;aAAW,MAAM;IAyG9D;AAED,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,MAAM,EACpB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,WAAW;aA/GiB,OAAO;aAAW,MAAM;IAsL9D;AAED,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,MAAM,EACpB,EAAE,EAAE,MAAM;aA3L2B,OAAO;aAAW,MAAM;IAmN9D"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { NextResponse } from 'next/server';
|
|
2
|
+
import { resolveSpaceUuid, SPACE_TYPE } from '../space';
|
|
3
|
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
4
|
+
function resultJson(result) {
|
|
5
|
+
return NextResponse.json(result, {
|
|
6
|
+
status: result.success ? 200 : 500
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// fragmentType and id land in the JSON:API URL; the fragment type from the
|
|
11
|
+
// path must match the configured one, the id must be a UUID — anything else
|
|
12
|
+
// could smuggle path segments (fetch normalizes ..).
|
|
13
|
+
function invalidTemplateRef(config, fragmentType, id) {
|
|
14
|
+
return fragmentType !== config.model.templates.fragmentType || !UUID_RE.test(id);
|
|
15
|
+
}
|
|
16
|
+
export async function handleSaveTemplate(config, request) {
|
|
17
|
+
const {
|
|
18
|
+
name,
|
|
19
|
+
content,
|
|
20
|
+
category,
|
|
21
|
+
aiDescription,
|
|
22
|
+
aiInstructions
|
|
23
|
+
} = await request.json();
|
|
24
|
+
const {
|
|
25
|
+
fragmentType,
|
|
26
|
+
dataField,
|
|
27
|
+
categoryField,
|
|
28
|
+
aiDescriptionField,
|
|
29
|
+
aiInstructionsField
|
|
30
|
+
} = config.model.templates;
|
|
31
|
+
if (typeof name !== 'string' || !name) {
|
|
32
|
+
return NextResponse.json({
|
|
33
|
+
success: false,
|
|
34
|
+
message: 'Name is required'
|
|
35
|
+
}, {
|
|
36
|
+
status: 400
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (typeof content !== 'string' || !content) {
|
|
40
|
+
return NextResponse.json({
|
|
41
|
+
success: false,
|
|
42
|
+
message: 'Content is required'
|
|
43
|
+
}, {
|
|
44
|
+
status: 400
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
const ALLOWED_CATEGORIES = new Set(['page', 'section', 'block']);
|
|
48
|
+
if (typeof category !== 'string' || !ALLOWED_CATEGORIES.has(category)) {
|
|
49
|
+
return NextResponse.json({
|
|
50
|
+
success: false,
|
|
51
|
+
message: 'Category must be one of page, section, block'
|
|
52
|
+
}, {
|
|
53
|
+
status: 400
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const client = await config.createClient();
|
|
57
|
+
const attributes = {
|
|
58
|
+
title: name,
|
|
59
|
+
status: true,
|
|
60
|
+
[dataField]: content,
|
|
61
|
+
[categoryField]: category
|
|
62
|
+
};
|
|
63
|
+
if (typeof aiDescription === 'string' && aiDescription) {
|
|
64
|
+
attributes[aiDescriptionField] = aiDescription;
|
|
65
|
+
}
|
|
66
|
+
if (typeof aiInstructions === 'string' && aiInstructions) {
|
|
67
|
+
attributes[aiInstructionsField] = aiInstructions;
|
|
68
|
+
}
|
|
69
|
+
let relationships;
|
|
70
|
+
if (config.spaceId) {
|
|
71
|
+
const uuid = await resolveSpaceUuid(client, config.spaceId);
|
|
72
|
+
if (!uuid) {
|
|
73
|
+
return resultJson({
|
|
74
|
+
success: false,
|
|
75
|
+
message: 'Could not resolve the NodeHive space; template not saved.'
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
relationships = {
|
|
79
|
+
space_id: {
|
|
80
|
+
data: [{
|
|
81
|
+
type: SPACE_TYPE,
|
|
82
|
+
id: uuid
|
|
83
|
+
}]
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const payload = {
|
|
88
|
+
data: {
|
|
89
|
+
type: `nodehive_fragment--${fragmentType}`,
|
|
90
|
+
attributes,
|
|
91
|
+
...(relationships ? {
|
|
92
|
+
relationships
|
|
93
|
+
} : {})
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
try {
|
|
97
|
+
await client.request(`/jsonapi/nodehive_fragment/${fragmentType}`, {
|
|
98
|
+
method: 'POST',
|
|
99
|
+
data: payload
|
|
100
|
+
});
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.error('Error saving template:', error);
|
|
103
|
+
return resultJson({
|
|
104
|
+
success: false,
|
|
105
|
+
message: `An error occurred while saving the template: ${error}`
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return resultJson({
|
|
109
|
+
success: true,
|
|
110
|
+
message: 'Template saved'
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
export async function handleUpdateTemplate(config, fragmentType, id, request) {
|
|
114
|
+
if (invalidTemplateRef(config, fragmentType, id)) {
|
|
115
|
+
return NextResponse.json({
|
|
116
|
+
success: false,
|
|
117
|
+
message: 'invalid fragmentType or id'
|
|
118
|
+
}, {
|
|
119
|
+
status: 400
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
const {
|
|
123
|
+
title,
|
|
124
|
+
aiDescription,
|
|
125
|
+
aiInstructions
|
|
126
|
+
} = await request.json();
|
|
127
|
+
const {
|
|
128
|
+
aiDescriptionField,
|
|
129
|
+
aiInstructionsField
|
|
130
|
+
} = config.model.templates;
|
|
131
|
+
const attributes = {};
|
|
132
|
+
if (title !== undefined) {
|
|
133
|
+
if (typeof title !== 'string' || !title) {
|
|
134
|
+
return NextResponse.json({
|
|
135
|
+
success: false,
|
|
136
|
+
message: 'Name is required'
|
|
137
|
+
}, {
|
|
138
|
+
status: 400
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
attributes.title = title;
|
|
142
|
+
}
|
|
143
|
+
if (aiDescription !== undefined) {
|
|
144
|
+
if (typeof aiDescription !== 'string') {
|
|
145
|
+
return NextResponse.json({
|
|
146
|
+
success: false,
|
|
147
|
+
message: 'aiDescription must be a string'
|
|
148
|
+
}, {
|
|
149
|
+
status: 400
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
attributes[aiDescriptionField] = aiDescription || null;
|
|
153
|
+
}
|
|
154
|
+
if (aiInstructions !== undefined) {
|
|
155
|
+
if (typeof aiInstructions !== 'string') {
|
|
156
|
+
return NextResponse.json({
|
|
157
|
+
success: false,
|
|
158
|
+
message: 'aiInstructions must be a string'
|
|
159
|
+
}, {
|
|
160
|
+
status: 400
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
attributes[aiInstructionsField] = aiInstructions || null;
|
|
164
|
+
}
|
|
165
|
+
if (Object.keys(attributes).length === 0) {
|
|
166
|
+
return NextResponse.json({
|
|
167
|
+
success: false,
|
|
168
|
+
message: 'No fields to update'
|
|
169
|
+
}, {
|
|
170
|
+
status: 400
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
const payload = {
|
|
174
|
+
data: {
|
|
175
|
+
type: `nodehive_fragment--${fragmentType}`,
|
|
176
|
+
id,
|
|
177
|
+
attributes
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
try {
|
|
181
|
+
await config.createUserClient().request(`/jsonapi/nodehive_fragment/${fragmentType}/${id}`, {
|
|
182
|
+
method: 'PATCH',
|
|
183
|
+
data: payload
|
|
184
|
+
});
|
|
185
|
+
} catch (error) {
|
|
186
|
+
console.error('Error updating template:', error);
|
|
187
|
+
return resultJson({
|
|
188
|
+
success: false,
|
|
189
|
+
message: `An error occurred while updating the template: ${error}`
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
return resultJson({
|
|
193
|
+
success: true,
|
|
194
|
+
message: 'Template updated'
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
export async function handleDeleteTemplate(config, fragmentType, id) {
|
|
198
|
+
if (invalidTemplateRef(config, fragmentType, id)) {
|
|
199
|
+
return NextResponse.json({
|
|
200
|
+
success: false,
|
|
201
|
+
message: 'invalid fragmentType or id'
|
|
202
|
+
}, {
|
|
203
|
+
status: 400
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
try {
|
|
207
|
+
await config.createUserClient().request(`/jsonapi/nodehive_fragment/${fragmentType}/${id}`, {
|
|
208
|
+
method: 'DELETE'
|
|
209
|
+
});
|
|
210
|
+
} catch (error) {
|
|
211
|
+
console.error('Error deleting template:', error);
|
|
212
|
+
return resultJson({
|
|
213
|
+
success: false,
|
|
214
|
+
message: `An error occurred while deleting the template: ${error}`
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
return resultJson({
|
|
218
|
+
success: true,
|
|
219
|
+
message: 'Template deleted'
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","names":["NextResponse","resolveSpaceUuid","SPACE_TYPE","UUID_RE","resultJson","result","json","status","success","invalidTemplateRef","config","fragmentType","id","model","templates","test","handleSaveTemplate","request","name","content","category","aiDescription","aiInstructions","dataField","categoryField","aiDescriptionField","aiInstructionsField","message","ALLOWED_CATEGORIES","Set","has","client","createClient","attributes","title","relationships","spaceId","uuid","space_id","data","type","payload","method","error","console","handleUpdateTemplate","undefined","Object","keys","length","createUserClient","handleDeleteTemplate"],"sources":["../../../../../src/puck-editor/internal/api/handlers/template.ts"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\n\nimport type { PuckApiRuntime } from '../config';\nimport { resolveSpaceUuid, SPACE_TYPE } from '../space';\n\nconst UUID_RE =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nfunction resultJson(result: { success: boolean; message: string }) {\n return NextResponse.json(result, { status: result.success ? 200 : 500 });\n}\n\n// fragmentType and id land in the JSON:API URL; the fragment type from the\n// path must match the configured one, the id must be a UUID — anything else\n// could smuggle path segments (fetch normalizes ..).\nfunction invalidTemplateRef(\n config: PuckApiRuntime,\n fragmentType: string,\n id: string\n) {\n return (\n fragmentType !== config.model.templates.fragmentType || !UUID_RE.test(id)\n );\n}\n\nexport async function handleSaveTemplate(\n config: PuckApiRuntime,\n request: NextRequest\n) {\n const { name, content, category, aiDescription, aiInstructions } =\n await request.json();\n const {\n fragmentType,\n dataField,\n categoryField,\n aiDescriptionField,\n aiInstructionsField,\n } = config.model.templates;\n\n if (typeof name !== 'string' || !name) {\n return NextResponse.json(\n { success: false, message: 'Name is required' },\n { status: 400 }\n );\n }\n if (typeof content !== 'string' || !content) {\n return NextResponse.json(\n { success: false, message: 'Content is required' },\n { status: 400 }\n );\n }\n\n const ALLOWED_CATEGORIES = new Set(['page', 'section', 'block']);\n\n if (typeof category !== 'string' || !ALLOWED_CATEGORIES.has(category)) {\n return NextResponse.json(\n {\n success: false,\n message: 'Category must be one of page, section, block',\n },\n { status: 400 }\n );\n }\n\n const client = await config.createClient();\n\n const attributes: Record<string, unknown> = {\n title: name,\n status: true,\n [dataField]: content,\n [categoryField]: category,\n };\n if (typeof aiDescription === 'string' && aiDescription) {\n attributes[aiDescriptionField] = aiDescription;\n }\n if (typeof aiInstructions === 'string' && aiInstructions) {\n attributes[aiInstructionsField] = aiInstructions;\n }\n\n let relationships;\n if (config.spaceId) {\n const uuid = await resolveSpaceUuid(client, config.spaceId);\n if (!uuid) {\n return resultJson({\n success: false,\n message: 'Could not resolve the NodeHive space; template not saved.',\n });\n }\n relationships = { space_id: { data: [{ type: SPACE_TYPE, id: uuid }] } };\n }\n\n const payload = {\n data: {\n type: `nodehive_fragment--${fragmentType}`,\n attributes,\n ...(relationships ? { relationships } : {}),\n },\n };\n\n try {\n await client.request(`/jsonapi/nodehive_fragment/${fragmentType}`, {\n method: 'POST',\n data: payload,\n });\n } catch (error) {\n console.error('Error saving template:', error);\n return resultJson({\n success: false,\n message: `An error occurred while saving the template: ${error}`,\n });\n }\n\n return resultJson({ success: true, message: 'Template saved' });\n}\n\nexport async function handleUpdateTemplate(\n config: PuckApiRuntime,\n fragmentType: string,\n id: string,\n request: NextRequest\n) {\n if (invalidTemplateRef(config, fragmentType, id)) {\n return NextResponse.json(\n { success: false, message: 'invalid fragmentType or id' },\n { status: 400 }\n );\n }\n\n const { title, aiDescription, aiInstructions } = await request.json();\n const { aiDescriptionField, aiInstructionsField } = config.model.templates;\n\n const attributes: Record<string, unknown> = {};\n if (title !== undefined) {\n if (typeof title !== 'string' || !title) {\n return NextResponse.json(\n { success: false, message: 'Name is required' },\n { status: 400 }\n );\n }\n attributes.title = title;\n }\n if (aiDescription !== undefined) {\n if (typeof aiDescription !== 'string') {\n return NextResponse.json(\n { success: false, message: 'aiDescription must be a string' },\n { status: 400 }\n );\n }\n attributes[aiDescriptionField] = aiDescription || null;\n }\n if (aiInstructions !== undefined) {\n if (typeof aiInstructions !== 'string') {\n return NextResponse.json(\n { success: false, message: 'aiInstructions must be a string' },\n { status: 400 }\n );\n }\n attributes[aiInstructionsField] = aiInstructions || null;\n }\n if (Object.keys(attributes).length === 0) {\n return NextResponse.json(\n { success: false, message: 'No fields to update' },\n { status: 400 }\n );\n }\n\n const payload = {\n data: {\n type: `nodehive_fragment--${fragmentType}`,\n id,\n attributes,\n },\n };\n\n try {\n await config\n .createUserClient()\n .request(`/jsonapi/nodehive_fragment/${fragmentType}/${id}`, {\n method: 'PATCH',\n data: payload,\n });\n } catch (error) {\n console.error('Error updating template:', error);\n return resultJson({\n success: false,\n message: `An error occurred while updating the template: ${error}`,\n });\n }\n\n return resultJson({ success: true, message: 'Template updated' });\n}\n\nexport async function handleDeleteTemplate(\n config: PuckApiRuntime,\n fragmentType: string,\n id: string\n) {\n if (invalidTemplateRef(config, fragmentType, id)) {\n return NextResponse.json(\n { success: false, message: 'invalid fragmentType or id' },\n { status: 400 }\n );\n }\n\n try {\n await config\n .createUserClient()\n .request(`/jsonapi/nodehive_fragment/${fragmentType}/${id}`, {\n method: 'DELETE',\n });\n } catch (error) {\n console.error('Error deleting template:', error);\n return resultJson({\n success: false,\n message: `An error occurred while deleting the template: ${error}`,\n });\n }\n\n return resultJson({ success: true, message: 'Template deleted' });\n}\n"],"mappings":"AAAA,SAAsBA,YAAY,QAAQ,aAAa;AAGvD,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,UAAU;AAEvD,MAAMC,OAAO,GACX,iEAAiE;AAEnE,SAASC,UAAUA,CAACC,MAA6C,EAAE;EACjE,OAAOL,YAAY,CAACM,IAAI,CAACD,MAAM,EAAE;IAAEE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AChBI,OAAO,EAAE,KAAK;MACdmB,OAAO,EAAE,kDAAkDgB,KAAK;IAClE,CAAC,CAAC;EACJ;EAEA,OAAOvC,UAAU,CAAC;IAAEI,OAAO,EAAE,IAAI;IAAEmB,OAAO,EAAE;EAAmB,CAAC,CAAC;AACnE;AAEA,OAAO,eAAewB,oBAAoBA,CACxCzC,MAAsB,EACtBC,YAAoB,EACpBC,EAAU,EACV;EACA,IAAIH,kBAAkB,CAACC,MAAM,EAAEC,YAAY,EAAEC,EAAE,CAAC,EAAE;IAChD,OAAOZ,YAAY,CAACM,IAAI,CACtB;MAAEE,OAAO,EAAE,KAAK;MAAEmB,OAAO,EAAE;IAA6B,CAAC,EACzD;MAAEpB,MAAM,EAAE;IAAI,CAChB,CAAC;EACH;EAEA,IAAI;IACF,MAAMG,MAAM,CACTwC,gBAAgB,CAAC,CAAC,CAClBjC,OAAO,CAAC,8BAA8BN,YAAY,IAAIC,EAAE,EAAE,EAAE;MAC3D8B,MAAM,EAAE;IACV,CAAC,CAAC;EACN,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdC,OAAO,CAACD,KAAK,CAAC,0BAA0B,EAAEA,KAAK,CAAC;IAChD,OAAOvC,UAAU,CAAC;MAChBI,OAAO,EAAE,KAAK;MACdmB,OAAO,EAAE,kDAAkDgB,KAAK;IAClE,CAAC,CAAC;EACJ;EAEA,OAAOvC,UAAU,CAAC;IAAEI,OAAO,EAAE,IAAI;IAAEmB,OAAO,EAAE;EAAmB,CAAC,CAAC;AACnE","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import type { PuckApiRuntime } from '../config';
|
|
3
|
+
/**
|
|
4
|
+
* Editor upload forms send multipart form data (file/videoUrl + name/alt);
|
|
5
|
+
* the agent bridge sends JSON with an inline data: URL for images or a
|
|
6
|
+
* YouTube/Vimeo page URL for remote_video. The server never fetches
|
|
7
|
+
* external URLs.
|
|
8
|
+
*/
|
|
9
|
+
export declare function handleUpload(config: PuckApiRuntime, request: NextRequest): Promise<NextResponse<{
|
|
10
|
+
status: string;
|
|
11
|
+
message: string;
|
|
12
|
+
}>>;
|
|
13
|
+
//# sourceMappingURL=upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../../../src/puck-editor/internal/api/handlers/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AA0ChD;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,WAAW;;;IA4ErB"}
|