@nodehive/nextjs 0.1.3 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/auth/index.d.ts +2 -3
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/internal/config.d.ts +15 -5
- package/dist/auth/internal/config.js.map +1 -1
- package/dist/auth/internal/draft-mode.d.ts +2 -3
- package/dist/auth/internal/draft-mode.js +3 -20
- package/dist/auth/internal/draft-mode.js.map +1 -1
- package/dist/auth/internal/editor-locale.d.ts +0 -1
- package/dist/auth/internal/handoff.d.ts +0 -1
- package/dist/auth/internal/has-session.d.ts +0 -1
- package/dist/auth/internal/has-session.js +1 -1
- package/dist/auth/internal/has-session.js.map +1 -1
- package/dist/auth/internal/i18n.d.ts +10 -0
- package/dist/auth/internal/i18n.js +25 -0
- package/dist/auth/internal/i18n.js.map +1 -0
- package/dist/auth/internal/logout.d.ts +1 -2
- package/dist/auth/internal/logout.js +3 -3
- package/dist/auth/internal/logout.js.map +1 -1
- package/dist/auth/internal/next-cookie-storage.d.ts +5 -2
- package/dist/auth/internal/next-cookie-storage.js +8 -1
- package/dist/auth/internal/next-cookie-storage.js.map +1 -1
- package/dist/auth/internal/nodehive-client.d.ts +6 -4
- package/dist/auth/internal/nodehive-client.js +6 -4
- package/dist/auth/internal/nodehive-client.js.map +1 -1
- package/dist/auth/internal/oauth-config.d.ts +0 -1
- package/dist/auth/internal/proxy-helpers.d.ts +0 -1
- package/dist/auth/internal/proxy-helpers.js +4 -4
- package/dist/auth/internal/proxy-helpers.js.map +1 -1
- package/dist/auth/internal/refresh.d.ts +1 -2
- package/dist/auth/internal/refresh.js +4 -4
- package/dist/auth/internal/refresh.js.map +1 -1
- package/dist/auth/internal/require-auth.d.ts +0 -1
- package/dist/auth/internal/require-auth.js +1 -1
- package/dist/auth/internal/require-auth.js.map +1 -1
- package/dist/auth/internal/return-to.d.ts +0 -1
- package/dist/auth/internal/roles.d.ts +17 -0
- package/dist/auth/internal/roles.js +39 -0
- package/dist/auth/internal/roles.js.map +1 -0
- package/dist/auth/internal/routes/callback.d.ts +1 -2
- package/dist/auth/internal/routes/callback.js +6 -6
- package/dist/auth/internal/routes/callback.js.map +1 -1
- package/dist/auth/internal/routes/chips-exchange.d.ts +1 -2
- package/dist/auth/internal/routes/chips-exchange.js +5 -5
- package/dist/auth/internal/routes/chips-exchange.js.map +1 -1
- package/dist/auth/internal/routes/draft.d.ts +1 -2
- package/dist/auth/internal/routes/draft.js +3 -3
- package/dist/auth/internal/routes/draft.js.map +1 -1
- package/dist/auth/internal/routes/index.d.ts +4 -2
- package/dist/auth/internal/routes/index.js +7 -7
- package/dist/auth/internal/routes/index.js.map +1 -1
- package/dist/auth/internal/routes/login.d.ts +0 -1
- package/dist/auth/internal/routes/login.js +3 -3
- package/dist/auth/internal/routes/login.js.map +1 -1
- package/dist/auth/internal/routes/popup-done.d.ts +2 -2
- package/dist/auth/internal/routes/popup-done.js +9 -7
- package/dist/auth/internal/routes/popup-done.js.map +1 -1
- package/dist/auth/internal/routes/refresh.d.ts +2 -5
- package/dist/auth/internal/routes/refresh.js +8 -2
- package/dist/auth/internal/routes/refresh.js.map +1 -1
- package/dist/auth/internal/same-origin.d.ts +0 -1
- package/dist/auth/internal/session-gates.d.ts +27 -3
- package/dist/auth/internal/session-gates.js +35 -3
- package/dist/auth/internal/session-gates.js.map +1 -1
- package/dist/auth/internal/update-session.d.ts +1 -2
- package/dist/auth/internal/update-session.js +1 -1
- package/dist/auth/internal/update-session.js.map +1 -1
- package/dist/auth/internal/use-editor-login.d.ts +0 -1
- package/dist/auth/internal/use-editor-login.js +2 -3
- package/dist/auth/internal/use-editor-login.js.map +1 -1
- package/dist/auth/proxy.d.ts +7 -8
- package/dist/auth/proxy.js +6 -6
- package/dist/auth/proxy.js.map +1 -1
- package/dist/auth/react.d.ts +1 -2
- package/dist/auth/react.js +1 -1
- package/dist/auth/react.js.map +1 -1
- package/dist/auth/routes.d.ts +3 -3
- package/dist/auth/routes.js +1 -1
- package/dist/auth/routes.js.map +1 -1
- package/dist/auth/server.d.ts +14 -12
- package/dist/auth/server.js +14 -9
- package/dist/auth/server.js.map +1 -1
- package/dist/bridge-protocol/index.d.ts +50 -0
- package/dist/bridge-protocol/index.js +25 -0
- package/dist/bridge-protocol/index.js.map +1 -0
- package/dist/puck-editor/editor.d.ts +8 -0
- package/dist/puck-editor/editor.js +9 -0
- package/dist/puck-editor/editor.js.map +1 -0
- package/dist/puck-editor/fields.d.ts +6 -7
- package/dist/puck-editor/fields.js +3 -3
- package/dist/puck-editor/fields.js.map +1 -1
- package/dist/puck-editor/index.d.ts +17 -14
- package/dist/puck-editor/index.js +13 -11
- package/dist/puck-editor/index.js.map +1 -1
- package/dist/puck-editor/internal/api/client.d.ts +19 -4
- package/dist/puck-editor/internal/api/client.js +56 -19
- package/dist/puck-editor/internal/api/client.js.map +1 -1
- package/dist/puck-editor/internal/api/config.d.ts +36 -3
- package/dist/puck-editor/internal/api/config.js.map +1 -1
- package/dist/puck-editor/internal/api/create-puck-api.d.ts +1 -2
- package/dist/puck-editor/internal/api/create-puck-api.js +10 -13
- package/dist/puck-editor/internal/api/create-puck-api.js.map +1 -1
- package/dist/puck-editor/internal/api/handlers/create-page.d.ts +1 -2
- package/dist/puck-editor/internal/api/handlers/create-page.js +6 -4
- package/dist/puck-editor/internal/api/handlers/create-page.js.map +1 -1
- package/dist/puck-editor/internal/api/handlers/entities.d.ts +6 -5
- package/dist/puck-editor/internal/api/handlers/entities.js +60 -15
- package/dist/puck-editor/internal/api/handlers/entities.js.map +1 -1
- package/dist/puck-editor/internal/api/handlers/publish.d.ts +3 -6
- package/dist/puck-editor/internal/api/handlers/publish.js +57 -14
- package/dist/puck-editor/internal/api/handlers/publish.js.map +1 -1
- package/dist/puck-editor/internal/api/handlers/template.d.ts +5 -2
- package/dist/puck-editor/internal/api/handlers/template.js +28 -60
- package/dist/puck-editor/internal/api/handlers/template.js.map +1 -1
- package/dist/puck-editor/internal/api/handlers/upload.d.ts +10 -2
- package/dist/puck-editor/internal/api/handlers/upload.js +93 -28
- package/dist/puck-editor/internal/api/handlers/upload.js.map +1 -1
- package/dist/puck-editor/internal/api/localize-message.d.ts +15 -0
- package/dist/puck-editor/internal/api/localize-message.js +15 -0
- package/dist/puck-editor/internal/api/localize-message.js.map +1 -0
- package/dist/puck-editor/internal/api/media-params.d.ts +3 -3
- package/dist/puck-editor/internal/api/media-params.js +23 -19
- package/dist/puck-editor/internal/api/media-params.js.map +1 -1
- package/dist/puck-editor/internal/api/media-upload.d.ts +5 -3
- package/dist/puck-editor/internal/api/media-upload.js +33 -22
- package/dist/puck-editor/internal/api/media-upload.js.map +1 -1
- package/dist/puck-editor/internal/api/space.d.ts +0 -1
- package/dist/puck-editor/internal/api/type-segment.d.ts +2 -0
- package/dist/puck-editor/internal/api/type-segment.js +9 -0
- package/dist/puck-editor/internal/api/type-segment.js.map +1 -0
- package/dist/puck-editor/internal/content-model.d.ts +31 -3
- package/dist/puck-editor/internal/content-model.js +76 -6
- package/dist/puck-editor/internal/content-model.js.map +1 -1
- package/dist/puck-editor/internal/dictionaries.d.ts +225 -0
- package/dist/puck-editor/internal/dictionaries.js +673 -0
- package/dist/puck-editor/internal/dictionaries.js.map +1 -0
- package/dist/puck-editor/internal/editor/allowed-types.d.ts +1 -2
- package/dist/puck-editor/internal/editor/allowed-types.js +2 -2
- package/dist/puck-editor/internal/editor/allowed-types.js.map +1 -1
- package/dist/puck-editor/internal/editor/canvas-add-picker.d.ts +0 -1
- package/dist/puck-editor/internal/editor/canvas-add-picker.js +5 -5
- package/dist/puck-editor/internal/editor/canvas-add-picker.js.map +1 -1
- package/dist/puck-editor/internal/editor/canvas-empty-state.d.ts +0 -1
- package/dist/puck-editor/internal/editor/canvas-empty-state.js +4 -4
- package/dist/puck-editor/internal/editor/canvas-empty-state.js.map +1 -1
- package/dist/puck-editor/internal/editor/canvas-quick-add.d.ts +0 -1
- package/dist/puck-editor/internal/editor/canvas-quick-add.js +8 -8
- package/dist/puck-editor/internal/editor/canvas-quick-add.js.map +1 -1
- package/dist/puck-editor/internal/editor/canvas-scroll.d.ts +0 -1
- package/dist/puck-editor/internal/editor/component-icons.d.ts +1 -2
- package/dist/puck-editor/internal/editor/component-icons.js.map +1 -1
- package/dist/puck-editor/internal/editor/component-item.d.ts +0 -1
- package/dist/puck-editor/internal/editor/component-item.js +2 -2
- package/dist/puck-editor/internal/editor/component-item.js.map +1 -1
- package/dist/puck-editor/internal/editor/compose-save-issues.d.ts +15 -0
- package/dist/puck-editor/internal/editor/compose-save-issues.js +16 -0
- package/dist/puck-editor/internal/editor/compose-save-issues.js.map +1 -0
- package/dist/puck-editor/internal/editor/dirty-state.d.ts +3 -0
- package/dist/puck-editor/internal/editor/dirty-state.js +7 -0
- package/dist/puck-editor/internal/editor/dirty-state.js.map +1 -0
- package/dist/puck-editor/internal/editor/draft-restore-banner.d.ts +9 -0
- package/dist/puck-editor/internal/editor/draft-restore-banner.js +289 -0
- package/dist/puck-editor/internal/editor/draft-restore-banner.js.map +1 -0
- package/dist/puck-editor/internal/editor/draft-storage.d.ts +41 -0
- package/dist/puck-editor/internal/editor/draft-storage.js +129 -0
- package/dist/puck-editor/internal/editor/draft-storage.js.map +1 -0
- package/dist/puck-editor/internal/editor/editor-action-bar.d.ts +0 -1
- package/dist/puck-editor/internal/editor/editor-action-bar.js +4 -4
- package/dist/puck-editor/internal/editor/editor-action-bar.js.map +1 -1
- package/dist/puck-editor/internal/editor/editor-header-actions.d.ts +6 -4
- package/dist/puck-editor/internal/editor/editor-header-actions.js +119 -60
- package/dist/puck-editor/internal/editor/editor-header-actions.js.map +1 -1
- package/dist/puck-editor/internal/editor/find-missing-required-fields.d.ts +0 -1
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.d.ts +1 -2
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.js +6 -6
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.js.map +1 -1
- package/dist/puck-editor/internal/editor/grouped-entry-list.d.ts +1 -2
- package/dist/puck-editor/internal/editor/grouped-entry-list.js +7 -6
- package/dist/puck-editor/internal/editor/grouped-entry-list.js.map +1 -1
- package/dist/puck-editor/internal/editor/header-save-button.d.ts +4 -4
- package/dist/puck-editor/internal/editor/header-save-button.js +66 -27
- package/dist/puck-editor/internal/editor/header-save-button.js.map +1 -1
- package/dist/puck-editor/internal/editor/leave-confirm-dialog.d.ts +5 -0
- package/dist/puck-editor/internal/editor/leave-confirm-dialog.js +140 -0
- package/dist/puck-editor/internal/editor/leave-confirm-dialog.js.map +1 -0
- package/dist/puck-editor/internal/editor/page-template-picker.d.ts +0 -1
- package/dist/puck-editor/internal/editor/page-template-picker.js +5 -5
- package/dist/puck-editor/internal/editor/page-template-picker.js.map +1 -1
- package/dist/puck-editor/internal/editor/picker-entry-item.d.ts +1 -2
- package/dist/puck-editor/internal/editor/picker-entry-item.js +4 -4
- package/dist/puck-editor/internal/editor/picker-entry-item.js.map +1 -1
- package/dist/puck-editor/internal/editor/picker-model.d.ts +14 -5
- package/dist/puck-editor/internal/editor/picker-model.js +157 -132
- package/dist/puck-editor/internal/editor/picker-model.js.map +1 -1
- package/dist/puck-editor/internal/editor/publish-puck-data.d.ts +18 -4
- package/dist/puck-editor/internal/editor/publish-puck-data.js +25 -4
- package/dist/puck-editor/internal/editor/publish-puck-data.js.map +1 -1
- package/dist/puck-editor/internal/editor/puck-editor.d.ts +6 -4
- package/dist/puck-editor/internal/editor/puck-editor.js +270 -209
- package/dist/puck-editor/internal/editor/puck-editor.js.map +1 -1
- package/dist/puck-editor/internal/editor/save-guard.d.ts +15 -0
- package/dist/puck-editor/internal/editor/save-guard.js +30 -0
- package/dist/puck-editor/internal/editor/save-guard.js.map +1 -0
- package/dist/puck-editor/internal/editor/save-page-context.d.ts +8 -0
- package/dist/puck-editor/internal/editor/save-page-context.js +34 -0
- package/dist/puck-editor/internal/editor/save-page-context.js.map +1 -0
- package/dist/puck-editor/internal/editor/section-template-modal.d.ts +0 -1
- package/dist/puck-editor/internal/editor/section-template-modal.js +2 -2
- package/dist/puck-editor/internal/editor/section-template-modal.js.map +1 -1
- package/dist/puck-editor/internal/editor/use-draft-recovery.d.ts +16 -0
- package/dist/puck-editor/internal/editor/use-draft-recovery.js +194 -0
- package/dist/puck-editor/internal/editor/use-draft-recovery.js.map +1 -0
- package/dist/puck-editor/internal/editor/use-frame-zoom.d.ts +0 -1
- package/dist/puck-editor/internal/editor/use-is-dirty.d.ts +1 -0
- package/dist/puck-editor/internal/editor/use-is-dirty.js +32 -0
- package/dist/puck-editor/internal/editor/use-is-dirty.js.map +1 -0
- package/dist/puck-editor/internal/editor/use-scroll-lock-outside.d.ts +0 -1
- package/dist/puck-editor/internal/editor-config.d.ts +16 -3
- package/dist/puck-editor/internal/editor-config.js +8 -1
- package/dist/puck-editor/internal/editor-config.js.map +1 -1
- package/dist/puck-editor/internal/editor-query-client.d.ts +0 -1
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.d.ts +0 -1
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.js +2 -2
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.d.ts +0 -1
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.js +1 -1
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.d.ts +0 -1
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.js +1 -1
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/date-picker/date-picker.d.ts +0 -1
- package/dist/puck-editor/internal/fields/date-picker/date-picker.js +90 -73
- package/dist/puck-editor/internal/fields/date-picker/date-picker.js.map +1 -1
- package/dist/puck-editor/internal/fields/index.d.ts +10 -10
- package/dist/puck-editor/internal/fields/index.js +10 -9
- package/dist/puck-editor/internal/fields/index.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/anchor.d.ts +0 -1
- package/dist/puck-editor/internal/fields/link-picker/anchor.js +1 -1
- package/dist/puck-editor/internal/fields/link-picker/anchor.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.d.ts +1 -2
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.js +1 -1
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/humanize.d.ts +0 -1
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.d.ts +0 -1
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.js +208 -140
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.d.ts +1 -2
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.js +6 -6
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/link-value.d.ts +25 -5
- package/dist/puck-editor/internal/fields/link-picker/link-value.js +56 -6
- package/dist/puck-editor/internal/fields/link-picker/link-value.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.d.ts +0 -1
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.js +4 -4
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.d.ts +0 -1
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.d.ts +0 -1
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.js +3 -3
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/types.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.d.ts +2 -3
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.js +1 -1
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-array/media-array-field.d.ts +2 -3
- package/dist/puck-editor/internal/fields/media-array/media-array-field.js +100 -88
- package/dist/puck-editor/internal/fields/media-array/media-array-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-array/reorder.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.d.ts +2 -3
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.js +1 -1
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.d.ts +1 -2
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.js +4 -4
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/crop-types.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-selector/extract-fields.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.js +19 -10
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.d.ts +7 -3
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.js +29 -22
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.d.ts +1 -2
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.js +281 -255
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.d.ts +15 -2
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.js +23 -18
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.js +12 -6
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.js.map +1 -1
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.d.ts +0 -1
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.js +2 -2
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/required-field-label.d.ts +0 -1
- package/dist/puck-editor/internal/fields/required-field-label.js +1 -1
- package/dist/puck-editor/internal/fields/required-field-label.js.map +1 -1
- package/dist/puck-editor/internal/fields/required.d.ts +0 -1
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.d.ts +13 -3
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.js +32 -22
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.js.map +1 -1
- package/dist/puck-editor/internal/i18n.d.ts +2 -181
- package/dist/puck-editor/internal/i18n.js +2 -358
- package/dist/puck-editor/internal/i18n.js.map +1 -1
- package/dist/puck-editor/internal/locale.d.ts +0 -1
- package/dist/puck-editor/internal/localize.d.ts +1 -2
- package/dist/puck-editor/internal/localize.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.d.ts +3 -3
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.js +41 -32
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.js +2 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.d.ts +3 -3
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.js +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/catalog.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/constants.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/create-page.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/help.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/index.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/index.js +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/index.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.d.ts +2 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.js +4 -3
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.d.ts +5 -6
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.js +2 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.js +2 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.js.map +1 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.js +3 -3
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.js.map +1 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.js +1 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.js.map +1 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.js +1 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.js.map +1 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/index.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/outline-plugin/index.js +1 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/index.js.map +1 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.js +46 -31
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.js.map +1 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.js +1 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.js.map +1 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/index.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/sections-plugin/index.js +1 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/index.js.map +1 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.js +5 -5
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.js.map +1 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.js +1 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.js +2 -2
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.js +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.js +3 -3
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.js +224 -219
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/index.d.ts +5 -6
- package/dist/puck-editor/internal/plugins/templates-plugin/index.js +5 -5
- package/dist/puck-editor/internal/plugins/templates-plugin/index.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.js +3 -3
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.js +17 -16
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.js +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.js +171 -161
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.js +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.d.ts +2 -3
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.js +9 -2
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.js +22 -20
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.d.ts +14 -5
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.js +23 -15
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.js.map +1 -1
- package/dist/puck-editor/internal/puck-augmentation.d.ts +0 -1
- package/dist/puck-editor/internal/puck-editor-provider.d.ts +0 -1
- package/dist/puck-editor/internal/puck-node.d.ts +0 -1
- package/dist/puck-editor/internal/puck-props.d.ts +13 -0
- package/dist/puck-editor/internal/puck-props.js +2 -0
- package/dist/puck-editor/internal/puck-props.js.map +1 -0
- package/dist/puck-editor/internal/puck-wrapper.d.ts +25 -6
- package/dist/puck-editor/internal/puck-wrapper.js +124 -115
- package/dist/puck-editor/internal/puck-wrapper.js.map +1 -1
- package/dist/puck-editor/internal/render/cropped-image.d.ts +1 -2
- package/dist/puck-editor/internal/render/cropped-image.js.map +1 -1
- package/dist/puck-editor/internal/smart-actions/action-selection.d.ts +8 -0
- package/dist/puck-editor/internal/smart-actions/action-selection.js +10 -0
- package/dist/puck-editor/internal/smart-actions/action-selection.js.map +1 -0
- package/dist/puck-editor/internal/smart-actions/index.d.ts +10 -4
- package/dist/puck-editor/internal/smart-actions/index.js +27 -12
- package/dist/puck-editor/internal/smart-actions/index.js.map +1 -1
- package/dist/puck-editor/internal/smart-actions/new-page.d.ts +3 -2
- package/dist/puck-editor/internal/smart-actions/new-page.js +6 -6
- package/dist/puck-editor/internal/smart-actions/new-page.js.map +1 -1
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.d.ts +3 -2
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.js +49 -37
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.js.map +1 -1
- package/dist/puck-editor/internal/ui/calendar.d.ts +0 -1
- package/dist/puck-editor/internal/ui/calendar.js +1 -1
- package/dist/puck-editor/internal/ui/calendar.js.map +1 -1
- package/dist/puck-editor/internal/ui/component-list-accordion.d.ts +0 -1
- package/dist/puck-editor/internal/ui/dialog.d.ts +0 -1
- package/dist/puck-editor/internal/ui/dialog.js +33 -20
- package/dist/puck-editor/internal/ui/dialog.js.map +1 -1
- package/dist/puck-editor/internal/ui/drawer-item-content.d.ts +0 -1
- package/dist/puck-editor/internal/ui/icon-button.d.ts +0 -1
- package/dist/puck-editor/internal/ui/icon-button.js +1 -1
- package/dist/puck-editor/internal/ui/icon-button.js.map +1 -1
- package/dist/puck-editor/internal/ui/load-error-notice.d.ts +6 -0
- package/dist/puck-editor/internal/ui/load-error-notice.js +81 -0
- package/dist/puck-editor/internal/ui/load-error-notice.js.map +1 -0
- package/dist/puck-editor/internal/ui/popover.d.ts +0 -1
- package/dist/puck-editor/internal/ui/popover.js +1 -1
- package/dist/puck-editor/internal/ui/popover.js.map +1 -1
- package/dist/puck-editor/internal/ui/required-mark.d.ts +0 -1
- package/dist/puck-editor/internal/ui/scroll-area.d.ts +8 -0
- package/dist/puck-editor/internal/ui/scroll-area.js +160 -0
- package/dist/puck-editor/internal/ui/scroll-area.js.map +1 -0
- package/dist/puck-editor/internal/ui/search-control.d.ts +0 -1
- package/dist/puck-editor/internal/ui/search-control.js +3 -3
- package/dist/puck-editor/internal/ui/search-control.js.map +1 -1
- package/dist/puck-editor/internal/ui/use-panel-search-focus.d.ts +0 -1
- package/dist/puck-editor/internal/use-puck-overlay.d.ts +1 -2
- package/dist/puck-editor/internal/use-puck-overlay.js +6 -5
- package/dist/puck-editor/internal/use-puck-overlay.js.map +1 -1
- package/dist/puck-editor/internal/utils.d.ts +0 -1
- package/dist/puck-editor/render.d.ts +2 -3
- package/dist/puck-editor/render.js +1 -1
- package/dist/puck-editor/render.js.map +1 -1
- package/dist/puck-editor/server.d.ts +3 -4
- package/dist/puck-editor/server.js +1 -1
- package/dist/puck-editor/server.js.map +1 -1
- package/dist/puck-editor/smart-actions.d.ts +1 -2
- package/dist/puck-editor/smart-actions.js +1 -1
- package/dist/puck-editor/smart-actions.js.map +1 -1
- package/dist/shared/cn.d.ts +0 -1
- package/dist/shared/i18n.d.ts +0 -1
- package/dist/shared/revalidate-path.d.ts +1 -0
- package/dist/shared/revalidate-path.js +2 -0
- package/dist/shared/revalidate-path.js.map +1 -0
- package/dist/shared/toolbar-action.d.ts +0 -1
- package/dist/shared/use-is-hydrated.d.ts +0 -1
- package/dist/shared/use-is-in-iframe.d.ts +0 -1
- package/dist/shared/use-is-in-iframe.js +1 -1
- package/dist/shared/use-is-in-iframe.js.map +1 -1
- package/dist/smart-actions/internal/backend-edit-link.d.ts +6 -0
- package/dist/smart-actions/internal/backend-edit-link.js +60 -0
- package/dist/smart-actions/internal/backend-edit-link.js.map +1 -0
- package/dist/smart-actions/internal/get-smart-actions-context.d.ts +1 -2
- package/dist/smart-actions/internal/get-smart-actions-context.js +2 -2
- package/dist/smart-actions/internal/get-smart-actions-context.js.map +1 -1
- package/dist/smart-actions/internal/i18n.d.ts +1 -2
- package/dist/smart-actions/internal/i18n.js +16 -2
- package/dist/smart-actions/internal/i18n.js.map +1 -1
- package/dist/smart-actions/internal/logout-form.d.ts +2 -2
- package/dist/smart-actions/internal/logout-form.js +47 -40
- package/dist/smart-actions/internal/logout-form.js.map +1 -1
- package/dist/smart-actions/internal/refresh-page.d.ts +3 -2
- package/dist/smart-actions/internal/refresh-page.js +60 -53
- package/dist/smart-actions/internal/refresh-page.js.map +1 -1
- package/dist/smart-actions/internal/smart-actions-button.d.ts +22 -4
- package/dist/smart-actions/internal/smart-actions-button.js +36 -13
- package/dist/smart-actions/internal/smart-actions-button.js.map +1 -1
- package/dist/smart-actions/internal/smart-actions-config.d.ts +12 -4
- package/dist/smart-actions/internal/smart-actions-config.js +36 -80
- package/dist/smart-actions/internal/smart-actions-config.js.map +1 -1
- package/dist/smart-actions/internal/smart-actions-toolbar-client.d.ts +5 -11
- package/dist/smart-actions/internal/smart-actions-toolbar-client.js +13 -53
- package/dist/smart-actions/internal/smart-actions-toolbar-client.js.map +1 -1
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.d.ts +1 -2
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.js +4 -4
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.js.map +1 -1
- package/dist/smart-actions/internal/toolbar/storage.d.ts +1 -2
- package/dist/smart-actions/internal/toolbar/storage.js.map +1 -1
- package/dist/smart-actions/internal/toolbar/types.d.ts +1 -2
- package/dist/smart-actions/internal/toolbar/types.js.map +1 -1
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.d.ts +1 -2
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.js +1 -1
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.js.map +1 -1
- package/dist/smart-actions/internal/ui/tooltip.d.ts +0 -1
- package/dist/smart-actions/internal/ui/tooltip.js +1 -1
- package/dist/smart-actions/internal/ui/tooltip.js.map +1 -1
- package/dist/smart-actions/internal/user-profile.d.ts +0 -1
- package/dist/smart-actions/internal/user-profile.js +71 -24
- package/dist/smart-actions/internal/user-profile.js.map +1 -1
- package/dist/smart-actions/server.d.ts +5 -4
- package/dist/smart-actions/server.js +2 -2
- package/dist/smart-actions/server.js.map +1 -1
- package/dist/theme.css +1 -1
- package/dist/visual-editor/index.d.ts +3 -4
- package/dist/visual-editor/index.js +3 -3
- package/dist/visual-editor/index.js.map +1 -1
- package/dist/visual-editor/internal/bridge/connector.d.ts +4 -3
- package/dist/visual-editor/internal/bridge/connector.js +22 -21
- package/dist/visual-editor/internal/bridge/connector.js.map +1 -1
- package/dist/visual-editor/internal/bridge/draft-mode-self-heal.d.ts +0 -1
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.d.ts +5 -3
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.js +7 -8
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.js.map +1 -1
- package/dist/visual-editor/internal/bridge/editor-auth-gate.d.ts +3 -3
- package/dist/visual-editor/internal/bridge/editor-auth-gate.js +4 -2
- package/dist/visual-editor/internal/bridge/editor-auth-gate.js.map +1 -1
- package/dist/visual-editor/internal/i18n.d.ts +3 -2
- package/dist/visual-editor/internal/i18n.js +32 -4
- package/dist/visual-editor/internal/i18n.js.map +1 -1
- package/dist/visual-editor/internal/overlays/drupal-origin.d.ts +1 -7
- package/dist/visual-editor/internal/overlays/drupal-origin.js +16 -3
- package/dist/visual-editor/internal/overlays/drupal-origin.js.map +1 -1
- package/dist/visual-editor/internal/overlays/edit-button.d.ts +5 -4
- package/dist/visual-editor/internal/overlays/edit-button.js +46 -44
- package/dist/visual-editor/internal/overlays/edit-button.js.map +1 -1
- package/dist/visual-editor/internal/overlays/edit-icon.d.ts +0 -1
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.d.ts +11 -2
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.js +18 -7
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.js.map +1 -1
- package/dist/visual-editor/internal/overlays/iframe-wrapper.d.ts +0 -1
- package/dist/visual-editor/internal/overlays/iframe-wrapper.js +1 -1
- package/dist/visual-editor/internal/overlays/iframe-wrapper.js.map +1 -1
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.d.ts +12 -3
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.js +14 -5
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.js.map +1 -1
- package/dist/visual-editor/internal/overlays/node/node-metadata.d.ts +4 -2
- package/dist/visual-editor/internal/overlays/node/node-metadata.js +10 -4
- package/dist/visual-editor/internal/overlays/node/node-metadata.js.map +1 -1
- package/dist/visual-editor/internal/overlays/node/node-wrapper.d.ts +5 -3
- package/dist/visual-editor/internal/overlays/node/node-wrapper.js +4 -2
- package/dist/visual-editor/internal/overlays/node/node-wrapper.js.map +1 -1
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.d.ts +11 -2
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.js +18 -7
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.js.map +1 -1
- package/dist/visual-editor/internal/revalidate-route.d.ts +0 -1
- package/dist/visual-editor/internal/revalidate-route.js +1 -1
- package/dist/visual-editor/internal/revalidate-route.js.map +1 -1
- package/dist/visual-editor/server.d.ts +6 -7
- package/dist/visual-editor/server.js +6 -6
- package/dist/visual-editor/server.js.map +1 -1
- package/package.json +20 -3
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/internal/config.d.ts.map +0 -1
- package/dist/auth/internal/draft-mode.d.ts.map +0 -1
- package/dist/auth/internal/editor-locale.d.ts.map +0 -1
- package/dist/auth/internal/handoff.d.ts.map +0 -1
- package/dist/auth/internal/has-session.d.ts.map +0 -1
- package/dist/auth/internal/logout.d.ts.map +0 -1
- package/dist/auth/internal/next-cookie-storage.d.ts.map +0 -1
- package/dist/auth/internal/nodehive-client.d.ts.map +0 -1
- package/dist/auth/internal/oauth-config.d.ts.map +0 -1
- package/dist/auth/internal/proxy-helpers.d.ts.map +0 -1
- package/dist/auth/internal/refresh.d.ts.map +0 -1
- package/dist/auth/internal/require-auth.d.ts.map +0 -1
- package/dist/auth/internal/return-to.d.ts.map +0 -1
- package/dist/auth/internal/routes/callback.d.ts.map +0 -1
- package/dist/auth/internal/routes/chips-exchange.d.ts.map +0 -1
- package/dist/auth/internal/routes/draft.d.ts.map +0 -1
- package/dist/auth/internal/routes/index.d.ts.map +0 -1
- package/dist/auth/internal/routes/login.d.ts.map +0 -1
- package/dist/auth/internal/routes/popup-done.d.ts.map +0 -1
- package/dist/auth/internal/routes/refresh.d.ts.map +0 -1
- package/dist/auth/internal/same-origin.d.ts.map +0 -1
- package/dist/auth/internal/session-gates.d.ts.map +0 -1
- package/dist/auth/internal/update-session.d.ts.map +0 -1
- package/dist/auth/internal/use-editor-login.d.ts.map +0 -1
- package/dist/auth/proxy.d.ts.map +0 -1
- package/dist/auth/react.d.ts.map +0 -1
- package/dist/auth/routes.d.ts.map +0 -1
- package/dist/auth/server.d.ts.map +0 -1
- package/dist/puck-editor/fields.d.ts.map +0 -1
- package/dist/puck-editor/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/client.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/config.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/create-puck-api.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/handlers/create-page.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/handlers/entities.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/handlers/publish.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/handlers/template.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/handlers/upload.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/media-params.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/media-upload.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/space.d.ts.map +0 -1
- package/dist/puck-editor/internal/content-model.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/allowed-types.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/canvas-add-picker.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/canvas-empty-state.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/canvas-quick-add.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/canvas-scroll.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/component-icons.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/component-item.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/editor-action-bar.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/editor-header-actions.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/find-missing-required-fields.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/grouped-entry-list.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/header-save-button.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/page-template-picker.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/picker-entry-item.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/picker-model.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/publish-puck-data.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/puck-editor.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/section-template-modal.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/use-frame-zoom.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/use-scroll-lock-outside.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor-config.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor-query-client.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/date-picker/date-picker.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/anchor.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/humanize.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/link-value.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/types.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-array/media-array-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-array/reorder.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/crop-types.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/extract-fields.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/required-field-label.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/required.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/i18n.d.ts.map +0 -1
- package/dist/puck-editor/internal/locale.d.ts.map +0 -1
- package/dist/puck-editor/internal/localize.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/catalog.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/constants.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/create-page.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/help.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.d.ts.map +0 -1
- package/dist/puck-editor/internal/puck-augmentation.d.ts.map +0 -1
- package/dist/puck-editor/internal/puck-editor-provider.d.ts.map +0 -1
- package/dist/puck-editor/internal/puck-node.d.ts.map +0 -1
- package/dist/puck-editor/internal/puck-wrapper.d.ts.map +0 -1
- package/dist/puck-editor/internal/render/cropped-image.d.ts.map +0 -1
- package/dist/puck-editor/internal/smart-actions/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/smart-actions/new-page.d.ts.map +0 -1
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/calendar.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/component-list-accordion.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/dialog.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/drawer-item-content.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/icon-button.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/popover.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/required-mark.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/search-control.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/use-panel-search-focus.d.ts.map +0 -1
- package/dist/puck-editor/internal/use-puck-overlay.d.ts.map +0 -1
- package/dist/puck-editor/internal/utils.d.ts.map +0 -1
- package/dist/puck-editor/render.d.ts.map +0 -1
- package/dist/puck-editor/server.d.ts.map +0 -1
- package/dist/puck-editor/smart-actions.d.ts.map +0 -1
- package/dist/shared/cn.d.ts.map +0 -1
- package/dist/shared/i18n.d.ts.map +0 -1
- package/dist/shared/toolbar-action.d.ts.map +0 -1
- package/dist/shared/use-is-hydrated.d.ts.map +0 -1
- package/dist/shared/use-is-in-iframe.d.ts.map +0 -1
- package/dist/smart-actions/internal/get-smart-actions-context.d.ts.map +0 -1
- package/dist/smart-actions/internal/i18n.d.ts.map +0 -1
- package/dist/smart-actions/internal/logout-form.d.ts.map +0 -1
- package/dist/smart-actions/internal/refresh-page.d.ts.map +0 -1
- package/dist/smart-actions/internal/smart-actions-button.d.ts.map +0 -1
- package/dist/smart-actions/internal/smart-actions-config.d.ts.map +0 -1
- package/dist/smart-actions/internal/smart-actions-toolbar-client.d.ts.map +0 -1
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.d.ts.map +0 -1
- package/dist/smart-actions/internal/toolbar/storage.d.ts.map +0 -1
- package/dist/smart-actions/internal/toolbar/types.d.ts.map +0 -1
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.d.ts.map +0 -1
- package/dist/smart-actions/internal/ui/tooltip.d.ts.map +0 -1
- package/dist/smart-actions/internal/user-profile.d.ts.map +0 -1
- package/dist/smart-actions/server.d.ts.map +0 -1
- package/dist/visual-editor/index.d.ts.map +0 -1
- package/dist/visual-editor/internal/bridge/connector.d.ts.map +0 -1
- package/dist/visual-editor/internal/bridge/draft-mode-self-heal.d.ts.map +0 -1
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.d.ts.map +0 -1
- package/dist/visual-editor/internal/bridge/editor-auth-gate.d.ts.map +0 -1
- package/dist/visual-editor/internal/i18n.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/drupal-origin.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/edit-button.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/edit-icon.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/iframe-wrapper.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/node/node-metadata.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/node/node-wrapper.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.d.ts.map +0 -1
- package/dist/visual-editor/internal/revalidate-route.d.ts.map +0 -1
- package/dist/visual-editor/server.d.ts.map +0 -1
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import './internal/puck-augmentation';
|
|
2
|
-
export { default as PuckWrapper } from './internal/puck-wrapper';
|
|
3
|
-
export { usePuckOverlay } from './internal/use-puck-overlay';
|
|
4
|
-
export { stripInstanceNames } from './internal/utils';
|
|
5
|
-
export { getPuckDictionary,
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export
|
|
10
|
-
export type {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
|
|
1
|
+
import './internal/puck-augmentation.js';
|
|
2
|
+
export { default as PuckWrapper } from './internal/puck-wrapper.js';
|
|
3
|
+
export { usePuckOverlay } from './internal/use-puck-overlay.js';
|
|
4
|
+
export { stripInstanceNames } from './internal/utils.js';
|
|
5
|
+
export { getPuckDictionary, type PuckDictionary, type PuckDictionaryOverrides, } from './internal/dictionaries.js';
|
|
6
|
+
export { PuckI18nProvider, usePuckDictionary, usePuckLocale, } from './internal/i18n.js';
|
|
7
|
+
export { localizeApiMessage, type ApiMessageParams, type PuckApiMessageCode, } from './internal/api/localize-message.js';
|
|
8
|
+
export { MEDIA_TYPES, type MediaType, } from './internal/plugins/agent-plugin/constants.js';
|
|
9
|
+
export { PuckEditorConfigProvider, usePuckContentModel, usePuckEditorConfig, usePuckPropTransforms, type PuckEditorConfig, } from './internal/editor-config.js';
|
|
10
|
+
export type { PuckApiInjection } from './internal/api/client.js';
|
|
11
|
+
export { creatableBundles, getBundle, parsePuckData, resolveContentModel, type PuckBundleConfig, type PuckContentModel, type PuckContentModelInput, type PuckMediaConfig, type PuckMetadataFields, type PuckPropTransforms, type PuckTemplatesConfig, type ResolvedPuckBundle, } from './internal/content-model.js';
|
|
12
|
+
export type { PuckOnAction, PuckPassthroughProps, PuckValidate, PuckValidationIssue, } from './internal/puck-props.js';
|
|
13
|
+
export type { PuckNode, PuckNodeMetadataImage } from './internal/puck-node.js';
|
|
14
|
+
export type { BuiltinTemplate, TemplateAi, TemplateCategory, TemplateEnvelope, } from './internal/plugins/templates-plugin/templates.js';
|
|
15
|
+
export { localizeConfig, localizeTemplates, type PuckLabelCatalog, } from './internal/localize.js';
|
|
16
|
+
export { RootDropZone } from './internal/plugins/templates-plugin/root-drop-zone.js';
|
|
17
|
+
export { PuckEditorProvider, usePuckEditor, } from './internal/puck-editor-provider.js';
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { default as PuckWrapper } from
|
|
3
|
-
export { usePuckOverlay } from
|
|
4
|
-
export { stripInstanceNames } from
|
|
5
|
-
export { getPuckDictionary
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
1
|
+
import "./internal/puck-augmentation.js";
|
|
2
|
+
export { default as PuckWrapper } from "./internal/puck-wrapper.js";
|
|
3
|
+
export { usePuckOverlay } from "./internal/use-puck-overlay.js";
|
|
4
|
+
export { stripInstanceNames } from "./internal/utils.js";
|
|
5
|
+
export { getPuckDictionary } from "./internal/dictionaries.js";
|
|
6
|
+
export { PuckI18nProvider, usePuckDictionary, usePuckLocale } from "./internal/i18n.js";
|
|
7
|
+
export { localizeApiMessage } from "./internal/api/localize-message.js";
|
|
8
|
+
export { MEDIA_TYPES } from "./internal/plugins/agent-plugin/constants.js";
|
|
9
|
+
export { PuckEditorConfigProvider, usePuckContentModel, usePuckEditorConfig, usePuckPropTransforms } from "./internal/editor-config.js";
|
|
10
|
+
export { creatableBundles, getBundle, parsePuckData, resolveContentModel } from "./internal/content-model.js";
|
|
11
|
+
export { localizeConfig, localizeTemplates } from "./internal/localize.js";
|
|
12
|
+
export { RootDropZone } from "./internal/plugins/templates-plugin/root-drop-zone.js";
|
|
13
|
+
export { PuckEditorProvider, usePuckEditor } from "./internal/puck-editor-provider.js";
|
|
12
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","PuckWrapper","usePuckOverlay","stripInstanceNames","getPuckDictionary","PuckI18nProvider","usePuckDictionary","MEDIA_TYPES","PuckEditorConfigProvider","usePuckContentModel","usePuckEditorConfig","creatableBundles","getBundle","parsePuckData","resolveContentModel","localizeConfig","localizeTemplates","RootDropZone","PuckEditorProvider","usePuckEditor"],"sources":["../../src/puck-editor/index.ts"],"sourcesContent":["import './internal/puck-augmentation';\n\nexport { default as PuckWrapper } from './internal/puck-wrapper';\nexport { usePuckOverlay } from './internal/use-puck-overlay';\nexport { stripInstanceNames } from './internal/utils';\nexport {\n getPuckDictionary,\n PuckI18nProvider,\n usePuckDictionary,\n type
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","PuckWrapper","usePuckOverlay","stripInstanceNames","getPuckDictionary","PuckI18nProvider","usePuckDictionary","usePuckLocale","localizeApiMessage","MEDIA_TYPES","PuckEditorConfigProvider","usePuckContentModel","usePuckEditorConfig","usePuckPropTransforms","creatableBundles","getBundle","parsePuckData","resolveContentModel","localizeConfig","localizeTemplates","RootDropZone","PuckEditorProvider","usePuckEditor"],"sources":["../../src/puck-editor/index.ts"],"sourcesContent":["import './internal/puck-augmentation.ts';\n\nexport { default as PuckWrapper } from './internal/puck-wrapper.tsx';\nexport { usePuckOverlay } from './internal/use-puck-overlay.ts';\nexport { stripInstanceNames } from './internal/utils.ts';\nexport {\n getPuckDictionary,\n type PuckDictionary,\n type PuckDictionaryOverrides,\n} from './internal/dictionaries.ts';\nexport {\n PuckI18nProvider,\n usePuckDictionary,\n usePuckLocale,\n} from './internal/i18n.tsx';\nexport {\n localizeApiMessage,\n type ApiMessageParams,\n type PuckApiMessageCode,\n} from './internal/api/localize-message.ts';\nexport {\n MEDIA_TYPES,\n type MediaType,\n} from './internal/plugins/agent-plugin/constants.ts';\nexport {\n PuckEditorConfigProvider,\n usePuckContentModel,\n usePuckEditorConfig,\n usePuckPropTransforms,\n type PuckEditorConfig,\n} from './internal/editor-config.tsx';\nexport type { PuckApiInjection } from './internal/api/client.ts';\nexport {\n creatableBundles,\n getBundle,\n parsePuckData,\n resolveContentModel,\n type PuckBundleConfig,\n type PuckContentModel,\n type PuckContentModelInput,\n type PuckMediaConfig,\n type PuckMetadataFields,\n type PuckPropTransforms,\n type PuckTemplatesConfig,\n type ResolvedPuckBundle,\n} from './internal/content-model.ts';\nexport type {\n PuckOnAction,\n PuckPassthroughProps,\n PuckValidate,\n PuckValidationIssue,\n} from './internal/puck-props.ts';\nexport type { PuckNode, PuckNodeMetadataImage } from './internal/puck-node.ts';\nexport type {\n BuiltinTemplate,\n TemplateAi,\n TemplateCategory,\n TemplateEnvelope,\n} from './internal/plugins/templates-plugin/templates.ts';\nexport {\n localizeConfig,\n localizeTemplates,\n type PuckLabelCatalog,\n} from './internal/localize.ts';\nexport { RootDropZone } from './internal/plugins/templates-plugin/root-drop-zone.tsx';\nexport {\n PuckEditorProvider,\n usePuckEditor,\n} from './internal/puck-editor-provider.tsx';\n"],"mappings":"AAAA,OAAO,iCAAiC;AAExC,SAASA,OAAO,IAAIC,WAAW,QAAQ,4BAA6B;AACpE,SAASC,cAAc,QAAQ,gCAAgC;AAC/D,SAASC,kBAAkB,QAAQ,qBAAqB;AACxD,SACEC,iBAAiB,QAGZ,4BAA4B;AACnC,SACEC,gBAAgB,EAChBC,iBAAiB,EACjBC,aAAa,QACR,oBAAqB;AAC5B,SACEC,kBAAkB,QAGb,oCAAoC;AAC3C,SACEC,WAAW,QAEN,8CAA8C;AACrD,SACEC,wBAAwB,EACxBC,mBAAmB,EACnBC,mBAAmB,EACnBC,qBAAqB,QAEhB,6BAA8B;AAErC,SACEC,gBAAgB,EAChBC,SAAS,EACTC,aAAa,EACbC,mBAAmB,QASd,6BAA6B;AAcpC,SACEC,cAAc,EACdC,iBAAiB,QAEZ,wBAAwB;AAC/B,SAASC,YAAY,QAAQ,uDAAwD;AACrF,SACEC,kBAAkB,EAClBC,aAAa,QACR,oCAAqC","ignoreList":[]}
|
|
@@ -1,9 +1,26 @@
|
|
|
1
|
+
import type { ApiMessageParams, PuckApiMessageCode } from './localize-message.js';
|
|
1
2
|
export type PuckApiResult = {
|
|
2
3
|
success: boolean;
|
|
3
4
|
message: string;
|
|
5
|
+
/** Stable message code; the UI maps it to the localized catalog, message is the fallback. */
|
|
6
|
+
code?: PuckApiMessageCode;
|
|
7
|
+
params?: ApiMessageParams;
|
|
4
8
|
data?: unknown;
|
|
5
9
|
};
|
|
6
|
-
export
|
|
10
|
+
export type PuckApiInjection = {
|
|
11
|
+
/** Base path prepended to every editor API call. Defaults to the env value or /api/puck. */
|
|
12
|
+
base?: string;
|
|
13
|
+
/** Custom fetch (e.g. to add headers or route through a gateway). Defaults to global fetch. */
|
|
14
|
+
fetch?: typeof fetch;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Set by PuckEditorConfigProvider from PuckEditorConfig.api. The env value stays
|
|
18
|
+
* the default source, so consumers that never pass `api` keep the current
|
|
19
|
+
* behavior. Client-only: the provider guards the call so no server request
|
|
20
|
+
* leaks another request's injection.
|
|
21
|
+
*/
|
|
22
|
+
export declare function configurePuckApi(api?: PuckApiInjection): void;
|
|
23
|
+
export declare function puckRequest(path: string, init?: RequestInit): Promise<Response>;
|
|
7
24
|
export declare function absolutizeMediaUrl(baseUrl: string, url?: string): string | undefined;
|
|
8
25
|
export declare function puckFetch<T = unknown>(path: string, init?: RequestInit): Promise<T>;
|
|
9
26
|
export declare function fetchNodeList<T = unknown>(type: string, { lang, query, searchFields, fields, }?: {
|
|
@@ -27,6 +44,4 @@ export type TemplateUpdate = {
|
|
|
27
44
|
};
|
|
28
45
|
export declare function updateTemplate(fragmentType: string, id: string, fields: TemplateUpdate): Promise<PuckApiResult>;
|
|
29
46
|
export declare function deleteTemplate(fragmentType: string, id: string): Promise<PuckApiResult>;
|
|
30
|
-
export declare function
|
|
31
|
-
export declare function uploadRemoteVideoMedia(formData: FormData, lang?: string): Promise<PuckApiResult>;
|
|
32
|
-
//# sourceMappingURL=client.d.ts.map
|
|
47
|
+
export declare function uploadMedia(formData: FormData, type: string, lang?: string): Promise<PuckApiResult>;
|
|
@@ -4,7 +4,26 @@
|
|
|
4
4
|
// editor backend routes through here so the base path, error handling and
|
|
5
5
|
// media-URL absolutization live in one place.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const ENV_PUCK_API_BASE = process.env.NEXT_PUBLIC_NODEHIVE_PUCK_API_BASE || '/api/puck';
|
|
8
|
+
let injected = {};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Set by PuckEditorConfigProvider from PuckEditorConfig.api. The env value stays
|
|
12
|
+
* the default source, so consumers that never pass `api` keep the current
|
|
13
|
+
* behavior. Client-only: the provider guards the call so no server request
|
|
14
|
+
* leaks another request's injection.
|
|
15
|
+
*/
|
|
16
|
+
export function configurePuckApi(api) {
|
|
17
|
+
injected = api ?? {};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Every browser call to the editor backend routes through here so the base
|
|
21
|
+
// path and injected fetch resolve in one place.
|
|
22
|
+
export function puckRequest(path, init) {
|
|
23
|
+
const fetchImpl = injected.fetch ?? globalThis.fetch;
|
|
24
|
+
const base = injected.base ?? ENV_PUCK_API_BASE;
|
|
25
|
+
return fetchImpl(`${base}${path}`, init);
|
|
26
|
+
}
|
|
8
27
|
export function absolutizeMediaUrl(baseUrl, url) {
|
|
9
28
|
if (!url) return undefined;
|
|
10
29
|
if (/^(?:[a-z]+:)?\/\//i.test(url)) return url;
|
|
@@ -18,6 +37,32 @@ function toSearch(params) {
|
|
|
18
37
|
const query = search.toString();
|
|
19
38
|
return query ? `?${query}` : '';
|
|
20
39
|
}
|
|
40
|
+
|
|
41
|
+
// Internal API handlers use three error shapes: { error }, { success, message }
|
|
42
|
+
// and { status, message }. Read all so server messages reach the UI.
|
|
43
|
+
function serverMessage(body) {
|
|
44
|
+
if (typeof body !== 'object' || body === null) return undefined;
|
|
45
|
+
const {
|
|
46
|
+
message,
|
|
47
|
+
error
|
|
48
|
+
} = body;
|
|
49
|
+
if (typeof message === 'string' && message) return message;
|
|
50
|
+
if (typeof error === 'string' && error) return error;
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Stable code + params ride alongside the English message so the UI can localize.
|
|
55
|
+
function serverCode(body) {
|
|
56
|
+
if (typeof body !== 'object' || body === null) return {};
|
|
57
|
+
const {
|
|
58
|
+
code,
|
|
59
|
+
params
|
|
60
|
+
} = body;
|
|
61
|
+
return {
|
|
62
|
+
code: typeof code === 'string' ? code : undefined,
|
|
63
|
+
params: params && typeof params === 'object' ? params : undefined
|
|
64
|
+
};
|
|
65
|
+
}
|
|
21
66
|
async function jsonResult(response) {
|
|
22
67
|
const body = await response.json().catch(() => ({}));
|
|
23
68
|
if (typeof body.success === 'boolean') {
|
|
@@ -25,7 +70,8 @@ async function jsonResult(response) {
|
|
|
25
70
|
}
|
|
26
71
|
return {
|
|
27
72
|
success: response.ok && body.status !== 'error',
|
|
28
|
-
message: body
|
|
73
|
+
message: serverMessage(body) ?? (response.ok ? 'OK' : `Request failed: ${response.status}`),
|
|
74
|
+
...serverCode(body),
|
|
29
75
|
data: body.data
|
|
30
76
|
};
|
|
31
77
|
}
|
|
@@ -34,10 +80,10 @@ async function jsonResult(response) {
|
|
|
34
80
|
// created entities). Throws on a non-2xx response so callers surface errors
|
|
35
81
|
// uniformly instead of re-checking `response.ok`.
|
|
36
82
|
export async function puckFetch(path, init) {
|
|
37
|
-
const response = await
|
|
83
|
+
const response = await puckRequest(path, init);
|
|
38
84
|
if (!response.ok) {
|
|
39
85
|
const body = await response.json().catch(() => ({}));
|
|
40
|
-
throw new Error(body
|
|
86
|
+
throw new Error(serverMessage(body) ?? `Request failed: ${response.status}`);
|
|
41
87
|
}
|
|
42
88
|
return response.json();
|
|
43
89
|
}
|
|
@@ -76,7 +122,7 @@ export async function fetchMediaItem(type, id, lang) {
|
|
|
76
122
|
// Fragment type, data and category field come from the server's contentModel;
|
|
77
123
|
// the client only sends the user input.
|
|
78
124
|
export async function saveTemplate(formData) {
|
|
79
|
-
const response = await
|
|
125
|
+
const response = await puckRequest('/template', {
|
|
80
126
|
method: 'POST',
|
|
81
127
|
headers: {
|
|
82
128
|
'Content-Type': 'application/json'
|
|
@@ -92,7 +138,7 @@ export async function saveTemplate(formData) {
|
|
|
92
138
|
return jsonResult(response);
|
|
93
139
|
}
|
|
94
140
|
export async function updateTemplate(fragmentType, id, fields) {
|
|
95
|
-
const response = await
|
|
141
|
+
const response = await puckRequest(`/template/${fragmentType}/${encodeURIComponent(id)}`, {
|
|
96
142
|
method: 'PATCH',
|
|
97
143
|
headers: {
|
|
98
144
|
'Content-Type': 'application/json'
|
|
@@ -102,24 +148,15 @@ export async function updateTemplate(fragmentType, id, fields) {
|
|
|
102
148
|
return jsonResult(response);
|
|
103
149
|
}
|
|
104
150
|
export async function deleteTemplate(fragmentType, id) {
|
|
105
|
-
const response = await
|
|
151
|
+
const response = await puckRequest(`/template/${fragmentType}/${encodeURIComponent(id)}`, {
|
|
106
152
|
method: 'DELETE'
|
|
107
153
|
});
|
|
108
154
|
return jsonResult(response);
|
|
109
155
|
}
|
|
110
|
-
export async function
|
|
111
|
-
formData.set('type',
|
|
112
|
-
if (lang) formData.set('lang', lang);
|
|
113
|
-
const response = await fetch(`${PUCK_API_BASE}/upload`, {
|
|
114
|
-
method: 'POST',
|
|
115
|
-
body: formData
|
|
116
|
-
});
|
|
117
|
-
return jsonResult(response);
|
|
118
|
-
}
|
|
119
|
-
export async function uploadRemoteVideoMedia(formData, lang) {
|
|
120
|
-
formData.set('type', 'remote_video');
|
|
156
|
+
export async function uploadMedia(formData, type, lang) {
|
|
157
|
+
formData.set('type', type);
|
|
121
158
|
if (lang) formData.set('lang', lang);
|
|
122
|
-
const response = await
|
|
159
|
+
const response = await puckRequest('/upload', {
|
|
123
160
|
method: 'POST',
|
|
124
161
|
body: formData
|
|
125
162
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["PUCK_API_BASE","process","env","NEXT_PUBLIC_NODEHIVE_PUCK_API_BASE","absolutizeMediaUrl","baseUrl","url","undefined","test","replace","toSearch","params","search","URLSearchParams","key","value","Object","entries","set","String","query","toString","jsonResult","response","body","json","catch","success","ok","status","message","data","puckFetch","path","init","fetch","Error","fetchNodeList","type","lang","searchFields","fields","length","join","Array","isArray","fetchMediaList","cache","credentials","fetchMediaItem","id","t","Date","now","saveTemplate","formData","method","headers","JSON","stringify","name","get","content","category","aiDescription","aiInstructions","updateTemplate","fragmentType","encodeURIComponent","deleteTemplate","uploadImageMedia","uploadRemoteVideoMedia"],"sources":["../../../../src/puck-editor/internal/api/client.ts"],"sourcesContent":["export type PuckApiResult = {\n success: boolean;\n message: string;\n data?: unknown;\n};\n\n// Browser-side counterparts of the createPuckApi handlers. They replace the\n// former PuckActions server-action context: editor components import these\n// directly instead of receiving injected actions. Every browser call to the\n// editor backend routes through here so the base path, error handling and\n// media-URL absolutization live in one place.\n\nexport const PUCK_API_BASE =\n process.env.NEXT_PUBLIC_NODEHIVE_PUCK_API_BASE || '/api/puck';\n\nexport function absolutizeMediaUrl(\n baseUrl: string,\n url?: string\n): string | undefined {\n if (!url) return undefined;\n if (/^(?:[a-z]+:)?\\/\\//i.test(url)) return url;\n return `${baseUrl.replace(/\\/+$/, '')}${url}`;\n}\n\nfunction toSearch(params: Record<string, string | number | undefined>): string {\n const search = new URLSearchParams();\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== '') search.set(key, String(value));\n }\n const query = search.toString();\n return query ? `?${query}` : '';\n}\n\nasync function jsonResult(response: Response): Promise<PuckApiResult> {\n const body = await response.json().catch(() => ({}));\n if (typeof body.success === 'boolean') {\n return body;\n }\n return {\n success: response.ok && body.status !== 'error',\n message:\n body.message ??\n (response.ok ? 'OK' : `Request failed: ${response.status}`),\n data: body.data,\n };\n}\n\n// Read/mutate endpoints that return their own JSON shape (arrays, `{ data }`,\n// created entities). Throws on a non-2xx response so callers surface errors\n// uniformly instead of re-checking `response.ok`.\nexport async function puckFetch<T = unknown>(\n path: string,\n init?: RequestInit\n): Promise<T> {\n const response = await fetch(`${PUCK_API_BASE}${path}`, init);\n if (!response.ok) {\n const body = await response.json().catch(() => ({}));\n throw new Error(\n (body as { message?: string }).message ??\n `Request failed: ${response.status}`\n );\n }\n return response.json();\n}\n\nexport async function fetchNodeList<T = unknown>(\n type: string,\n {\n lang,\n query,\n searchFields,\n fields,\n }: {\n lang?: string;\n query?: string;\n searchFields?: string[];\n fields?: string[];\n } = {}\n): Promise<T[]> {\n const data = await puckFetch<unknown>(\n `/node/${type}${toSearch({\n lang,\n query,\n searchFields: searchFields?.length ? searchFields.join(',') : undefined,\n fields: fields?.length ? fields.join(',') : undefined,\n })}`\n );\n if (!Array.isArray(data)) {\n throw new Error(`Invalid response format for ${type} nodes`);\n }\n return data as T[];\n}\n\nexport async function fetchMediaList<T = unknown>(\n type: string,\n params: {\n lang?: string;\n query?: string;\n offset?: number | string;\n limit?: number | string;\n } = {}\n): Promise<T> {\n return puckFetch<T>(`/media/${type}${toSearch(params)}`, {\n cache: 'no-store',\n credentials: 'include',\n });\n}\n\nexport async function fetchMediaItem<T = unknown>(\n type: string,\n id: string,\n lang?: string\n): Promise<T> {\n return puckFetch<T>(\n `/media/${type}/${id}${toSearch({ lang, t: Date.now() })}`,\n { cache: 'no-store' }\n );\n}\n\n// Fragment type, data and category field come from the server's contentModel;\n// the client only sends the user input.\nexport async function saveTemplate(formData: FormData): Promise<PuckApiResult> {\n const response = await fetch(`${PUCK_API_BASE}/template`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n name: formData.get('name'),\n content: formData.get('content'),\n category: formData.get('category'),\n aiDescription: formData.get('aiDescription'),\n aiInstructions: formData.get('aiInstructions'),\n }),\n });\n return jsonResult(response);\n}\n\nexport type TemplateUpdate = {\n title?: string;\n aiDescription?: string;\n aiInstructions?: string;\n};\n\nexport async function updateTemplate(\n fragmentType: string,\n id: string,\n fields: TemplateUpdate\n): Promise<PuckApiResult> {\n const response = await fetch(\n `${PUCK_API_BASE}/template/${fragmentType}/${encodeURIComponent(id)}`,\n {\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(fields),\n }\n );\n return jsonResult(response);\n}\n\nexport async function deleteTemplate(\n fragmentType: string,\n id: string\n): Promise<PuckApiResult> {\n const response = await fetch(\n `${PUCK_API_BASE}/template/${fragmentType}/${encodeURIComponent(id)}`,\n { method: 'DELETE' }\n );\n return jsonResult(response);\n}\n\nexport async function uploadImageMedia(\n formData: FormData,\n lang?: string\n): Promise<PuckApiResult> {\n formData.set('type', 'image');\n if (lang) formData.set('lang', lang);\n const response = await fetch(`${PUCK_API_BASE}/upload`, {\n method: 'POST',\n body: formData,\n });\n return jsonResult(response);\n}\n\nexport async function uploadRemoteVideoMedia(\n formData: FormData,\n lang?: string\n): Promise<PuckApiResult> {\n formData.set('type', 'remote_video');\n if (lang) formData.set('lang', lang);\n const response = await fetch(`${PUCK_API_BASE}/upload`, {\n method: 'POST',\n body: formData,\n });\n return jsonResult(response);\n}\n"],"mappings":"AAMA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,aAAa,GACxBC,OAAO,CAACC,GAAG,CAACC,kCAAkC,IAAI,WAAW;AAE/D,OAAO,SAASC,kBAAkBA,CAChCC,OAAe,EACfC,GAAY,EACQ;EACpB,IAAI,CAACA,GAAG,EAAE,OAAOC,SAAS;EAC1B,IAAI,oBAAoB,CAACC,IAAI,CAACF,GAAG,CAAC,EAAE,OAAOA,GAAG;EAC9C,OAAO,GAAGD,OAAO,CAACI,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAGH,GAAG,EAAE;AAC/C;AAEA,SAASI,QAAQA,CAACC,MAAmD,EAAU;EAC7E,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAAC,CAAC;EACpC,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACN,MAAM,CAAC,EAAE;IACjD,IAAII,KAAK,KAAKR,SAAS,IAAIQ,KAAK,KAAK,EAAE,EAAEH,MAAM,CAACM,GAAG,CAACJ,GAAG,EAAEK,MAAM,CAACJ,KAAK,CAAC,CAAC;EACzE;EACA,MAAMK,KAAK,GAAGR,MAAM,CAACS,QAAQ,CAAC,CAAC;EAC/B,OAAOD,KAAK,GAAG,IAAIA,KAAK,EAAE,GAAG,EAAE;AACjC;AAEA,eAAeE,UAAUA,CAACC,QAAkB,EAA0B;EACpE,MAAMC,IAAI,GAAG,MAAMD,QAAQ,CAACE,IAAI,CAAC,CAAC,CAACC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;EACpD,IAAI,OAAOF,IAAI,CAACG,OAAO,KAAK,SAAS,EAAE;IACrC,OAAOH,IAAI;EACb;EACA,OAAO;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qB,IAAI,CAAC;EACpC,MAAMhB,QAAQ,GAAG,MAAMY,KAAK,CAAC,GAAGnC,aAAa,SAAS,EAAE;IACtDwD,MAAM,EAAE,MAAM;IACdhC,IAAI,EAAE+B;EACR,CAAC,CAAC;EACF,OAAOjC,UAAU,CAACC,QAAQ,CAAC;AAC7B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"client.js","names":["ENV_PUCK_API_BASE","process","env","NEXT_PUBLIC_NODEHIVE_PUCK_API_BASE","injected","configurePuckApi","api","puckRequest","path","init","fetchImpl","fetch","globalThis","base","absolutizeMediaUrl","baseUrl","url","undefined","test","replace","toSearch","params","search","URLSearchParams","key","value","Object","entries","set","String","query","toString","serverMessage","body","message","error","serverCode","code","jsonResult","response","json","catch","success","ok","status","data","puckFetch","Error","fetchNodeList","type","lang","searchFields","fields","length","join","Array","isArray","fetchMediaList","cache","credentials","fetchMediaItem","id","t","Date","now","saveTemplate","formData","method","headers","JSON","stringify","name","get","content","category","aiDescription","aiInstructions","updateTemplate","fragmentType","encodeURIComponent","deleteTemplate","uploadMedia"],"sources":["../../../../src/puck-editor/internal/api/client.ts"],"sourcesContent":["import type {\n ApiMessageParams,\n PuckApiMessageCode,\n} from './localize-message.ts';\n\nexport type PuckApiResult = {\n success: boolean;\n message: string;\n /** Stable message code; the UI maps it to the localized catalog, message is the fallback. */\n code?: PuckApiMessageCode;\n params?: ApiMessageParams;\n data?: unknown;\n};\n\n// Browser-side counterparts of the createPuckApi handlers. They replace the\n// former PuckActions server-action context: editor components import these\n// directly instead of receiving injected actions. Every browser call to the\n// editor backend routes through here so the base path, error handling and\n// media-URL absolutization live in one place.\n\nexport type PuckApiInjection = {\n /** Base path prepended to every editor API call. Defaults to the env value or /api/puck. */\n base?: string;\n /** Custom fetch (e.g. to add headers or route through a gateway). Defaults to global fetch. */\n fetch?: typeof fetch;\n};\n\nconst ENV_PUCK_API_BASE =\n process.env.NEXT_PUBLIC_NODEHIVE_PUCK_API_BASE || '/api/puck';\n\nlet injected: PuckApiInjection = {};\n\n/**\n * Set by PuckEditorConfigProvider from PuckEditorConfig.api. The env value stays\n * the default source, so consumers that never pass `api` keep the current\n * behavior. Client-only: the provider guards the call so no server request\n * leaks another request's injection.\n */\nexport function configurePuckApi(api?: PuckApiInjection): void {\n injected = api ?? {};\n}\n\n// Every browser call to the editor backend routes through here so the base\n// path and injected fetch resolve in one place.\nexport function puckRequest(\n path: string,\n init?: RequestInit\n): Promise<Response> {\n const fetchImpl = injected.fetch ?? globalThis.fetch;\n const base = injected.base ?? ENV_PUCK_API_BASE;\n return fetchImpl(`${base}${path}`, init);\n}\n\nexport function absolutizeMediaUrl(\n baseUrl: string,\n url?: string\n): string | undefined {\n if (!url) return undefined;\n if (/^(?:[a-z]+:)?\\/\\//i.test(url)) return url;\n return `${baseUrl.replace(/\\/+$/, '')}${url}`;\n}\n\nfunction toSearch(params: Record<string, string | number | undefined>): string {\n const search = new URLSearchParams();\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== '') search.set(key, String(value));\n }\n const query = search.toString();\n return query ? `?${query}` : '';\n}\n\n// Internal API handlers use three error shapes: { error }, { success, message }\n// and { status, message }. Read all so server messages reach the UI.\nfunction serverMessage(body: unknown): string | undefined {\n if (typeof body !== 'object' || body === null) return undefined;\n const { message, error } = body as { message?: unknown; error?: unknown };\n if (typeof message === 'string' && message) return message;\n if (typeof error === 'string' && error) return error;\n return undefined;\n}\n\n// Stable code + params ride alongside the English message so the UI can localize.\nfunction serverCode(body: unknown): Pick<PuckApiResult, 'code' | 'params'> {\n if (typeof body !== 'object' || body === null) return {};\n const { code, params } = body as { code?: unknown; params?: unknown };\n return {\n code: typeof code === 'string' ? (code as PuckApiMessageCode) : undefined,\n params:\n params && typeof params === 'object'\n ? (params as ApiMessageParams)\n : undefined,\n };\n}\n\nasync function jsonResult(response: Response): Promise<PuckApiResult> {\n const body = await response.json().catch(() => ({}));\n if (typeof body.success === 'boolean') {\n return body;\n }\n return {\n success: response.ok && body.status !== 'error',\n message:\n serverMessage(body) ??\n (response.ok ? 'OK' : `Request failed: ${response.status}`),\n ...serverCode(body),\n data: body.data,\n };\n}\n\n// Read/mutate endpoints that return their own JSON shape (arrays, `{ data }`,\n// created entities). Throws on a non-2xx response so callers surface errors\n// uniformly instead of re-checking `response.ok`.\nexport async function puckFetch<T = unknown>(\n path: string,\n init?: RequestInit\n): Promise<T> {\n const response = await puckRequest(path, init);\n if (!response.ok) {\n const body = await response.json().catch(() => ({}));\n throw new Error(\n serverMessage(body) ?? `Request failed: ${response.status}`\n );\n }\n return response.json();\n}\n\nexport async function fetchNodeList<T = unknown>(\n type: string,\n {\n lang,\n query,\n searchFields,\n fields,\n }: {\n lang?: string;\n query?: string;\n searchFields?: string[];\n fields?: string[];\n } = {}\n): Promise<T[]> {\n const data = await puckFetch<unknown>(\n `/node/${type}${toSearch({\n lang,\n query,\n searchFields: searchFields?.length ? searchFields.join(',') : undefined,\n fields: fields?.length ? fields.join(',') : undefined,\n })}`\n );\n if (!Array.isArray(data)) {\n throw new Error(`Invalid response format for ${type} nodes`);\n }\n return data as T[];\n}\n\nexport async function fetchMediaList<T = unknown>(\n type: string,\n params: {\n lang?: string;\n query?: string;\n offset?: number | string;\n limit?: number | string;\n } = {}\n): Promise<T> {\n return puckFetch<T>(`/media/${type}${toSearch(params)}`, {\n cache: 'no-store',\n credentials: 'include',\n });\n}\n\nexport async function fetchMediaItem<T = unknown>(\n type: string,\n id: string,\n lang?: string\n): Promise<T> {\n return puckFetch<T>(\n `/media/${type}/${id}${toSearch({ lang, t: Date.now() })}`,\n { cache: 'no-store' }\n );\n}\n\n// Fragment type, data and category field come from the server's contentModel;\n// the client only sends the user input.\nexport async function saveTemplate(formData: FormData): Promise<PuckApiResult> {\n const response = await puckRequest('/template', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n name: formData.get('name'),\n content: formData.get('content'),\n category: formData.get('category'),\n aiDescription: formData.get('aiDescription'),\n aiInstructions: formData.get('aiInstructions'),\n }),\n });\n return jsonResult(response);\n}\n\nexport type TemplateUpdate = {\n title?: string;\n aiDescription?: string;\n aiInstructions?: string;\n};\n\nexport async function updateTemplate(\n fragmentType: string,\n id: string,\n fields: TemplateUpdate\n): Promise<PuckApiResult> {\n const response = await puckRequest(\n `/template/${fragmentType}/${encodeURIComponent(id)}`,\n {\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(fields),\n }\n );\n return jsonResult(response);\n}\n\nexport async function deleteTemplate(\n fragmentType: string,\n id: string\n): Promise<PuckApiResult> {\n const response = await puckRequest(\n `/template/${fragmentType}/${encodeURIComponent(id)}`,\n { method: 'DELETE' }\n );\n return jsonResult(response);\n}\n\nexport async function uploadMedia(\n formData: FormData,\n type: string,\n lang?: string\n): Promise<PuckApiResult> {\n formData.set('type', type);\n if (lang) formData.set('lang', lang);\n const response = await puckRequest('/upload', {\n method: 'POST',\n body: formData,\n });\n return jsonResult(response);\n}\n"],"mappings":"AAcA;AACA;AACA;AACA;AACA;;AASA,MAAMA,iBAAiB,GACrBC,OAAO,CAACC,GAAG,CAACC,kCAAkC,IAAI,WAAW;AAE/D,IAAIC,QAA0B,GAAG,CAAC,CAAC;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAACC,GAAsB,EAAQ;EAC7DF,QAAQ,GAAGE,GAAG,IAAI,CAAC,CAAC;AACtB;;AAEA;AACA;AACA,OAAO,SAASC,WAAWA,CACzBC,IAAY,EACZC,IAAkB,EACC;EACnB,MAAMC,SAAS,GAAGN,QAAQ,CAACO,KAAK,IAAIC,UAAU,CAACD,KAAK;EACpD,MAAME,IAAI,GAAGT,QAAQ,CAACS,IAAI,IAAIb,iBAAiB;EAC/C,OAAOU,SAAS,CAAC,GAAGG,IAAI,GAAGL,IAAI,EAAE,EAAEC,IAAI,CAAC;AAC1C;AAEA,OAAO,SAASK,kBAAkBA,CAChCC,OAAe,EACfC,GAAY,EACQ;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G,CAAC,MAAM,EAAEsB,IAAI,CAAC;EACpC,MAAMX,QAAQ,GAAG,MAAMhC,WAAW,CAAC,SAAS,EAAE;IAC5C4D,MAAM,EAAE,MAAM;IACdlC,IAAI,EAAEiC;EACR,CAAC,CAAC;EACF,OAAO5B,UAAU,CAACC,QAAQ,CAAC;AAC7B","ignoreList":[]}
|
|
@@ -1,6 +1,34 @@
|
|
|
1
|
+
import type { NextRequest, NextResponse } from 'next/server';
|
|
1
2
|
import type { NodeHiveClient } from 'nodehive-js';
|
|
2
|
-
import type { PuckContentModel, PuckContentModelInput } from '../content-model';
|
|
3
|
-
import type { RoutableLink } from '../fields/link-picker/types';
|
|
3
|
+
import type { PuckContentModel, PuckContentModelInput } from '../content-model.js';
|
|
4
|
+
import type { RoutableLink } from '../fields/link-picker/types.js';
|
|
5
|
+
export type PuckPublishPageSettings = {
|
|
6
|
+
title?: string;
|
|
7
|
+
metadataTitle?: string;
|
|
8
|
+
metadataDescription?: string;
|
|
9
|
+
metadataImage?: {
|
|
10
|
+
id?: string;
|
|
11
|
+
type?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
thumbnailImage?: string;
|
|
14
|
+
} | null;
|
|
15
|
+
published?: boolean;
|
|
16
|
+
urlAlias?: string;
|
|
17
|
+
};
|
|
18
|
+
export type PuckPublishPayload = {
|
|
19
|
+
path?: string;
|
|
20
|
+
type: string;
|
|
21
|
+
data: unknown;
|
|
22
|
+
nodeId: string;
|
|
23
|
+
fieldName: string;
|
|
24
|
+
lang?: string;
|
|
25
|
+
pageSettings?: PuckPublishPageSettings;
|
|
26
|
+
};
|
|
27
|
+
export type PuckPublishContext = {
|
|
28
|
+
request: NextRequest;
|
|
29
|
+
model: PuckContentModel;
|
|
30
|
+
createUserClient: () => NodeHiveClient;
|
|
31
|
+
};
|
|
4
32
|
export type PuckApiConfig = {
|
|
5
33
|
/** Default client: user when a session token is present, else anon. */
|
|
6
34
|
createClient: () => Promise<NodeHiveClient> | NodeHiveClient;
|
|
@@ -10,6 +38,12 @@ export type PuckApiConfig = {
|
|
|
10
38
|
spaceId?: string;
|
|
11
39
|
/** Internally-routable pages offered by the link picker. */
|
|
12
40
|
getLinks?: (lang: string) => Promise<RoutableLink[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Called before the publish write. Return the (optionally mutated) payload to
|
|
43
|
+
* continue, or a NextResponse to abort the publish with that response (e.g. a
|
|
44
|
+
* 4xx for custom validation or business rules).
|
|
45
|
+
*/
|
|
46
|
+
onBeforePublish?: (payload: PuckPublishPayload, ctx: PuckPublishContext) => PuckPublishPayload | NextResponse | Promise<PuckPublishPayload | NextResponse>;
|
|
13
47
|
/** Called after a successful publish, e.g. for project cache-tag invalidation. */
|
|
14
48
|
onPublished?: (info: {
|
|
15
49
|
nodeId: string;
|
|
@@ -26,4 +60,3 @@ export type PuckApiConfig = {
|
|
|
26
60
|
export type PuckApiRuntime = PuckApiConfig & {
|
|
27
61
|
model: PuckContentModel;
|
|
28
62
|
};
|
|
29
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":[],"sources":["../../../../src/puck-editor/internal/api/config.ts"],"sourcesContent":["import type { NodeHiveClient } from 'nodehive-js';\n\nimport type {
|
|
1
|
+
{"version":3,"file":"config.js","names":[],"sources":["../../../../src/puck-editor/internal/api/config.ts"],"sourcesContent":["import type { NextRequest, NextResponse } from 'next/server';\nimport type { NodeHiveClient } from 'nodehive-js';\n\nimport type {\n PuckContentModel,\n PuckContentModelInput,\n} from '../content-model.ts';\nimport type { RoutableLink } from '../fields/link-picker/types.ts';\n\nexport type PuckPublishPageSettings = {\n title?: string;\n metadataTitle?: string;\n metadataDescription?: string;\n metadataImage?: {\n id?: string;\n type?: string;\n name?: string;\n thumbnailImage?: string;\n } | null;\n published?: boolean;\n urlAlias?: string;\n};\n\nexport type PuckPublishPayload = {\n path?: string;\n type: string;\n data: unknown;\n nodeId: string;\n fieldName: string;\n lang?: string;\n pageSettings?: PuckPublishPageSettings;\n};\n\nexport type PuckPublishContext = {\n request: NextRequest;\n model: PuckContentModel;\n createUserClient: () => NodeHiveClient;\n};\n\nexport type PuckApiConfig = {\n /** Default client: user when a session token is present, else anon. */\n createClient: () => Promise<NodeHiveClient> | NodeHiveClient;\n /** Client that deliberately acts as the logged-in user. */\n createUserClient: () => NodeHiveClient;\n /** NodeHive space new pages and templates are assigned to. */\n spaceId?: string;\n /** Internally-routable pages offered by the link picker. */\n getLinks?: (lang: string) => Promise<RoutableLink[]>;\n /**\n * Called before the publish write. Return the (optionally mutated) payload to\n * continue, or a NextResponse to abort the publish with that response (e.g. a\n * 4xx for custom validation or business rules).\n */\n onBeforePublish?: (\n payload: PuckPublishPayload,\n ctx: PuckPublishContext\n ) =>\n | PuckPublishPayload\n | NextResponse\n | Promise<PuckPublishPayload | NextResponse>;\n /** Called after a successful publish, e.g. for project cache-tag invalidation. */\n onPublished?: (info: {\n nodeId: string;\n path?: string;\n lang?: string;\n }) => void | Promise<void>;\n /**\n * Drupal content-model overrides (puck-enabled bundles, templates, media\n * upload limit). Pass the same value to the client's PuckEditorConfig.\n */\n contentModel?: PuckContentModelInput;\n};\n\n/** Config plus the resolved content model, as handed to the handlers. */\nexport type PuckApiRuntime = PuckApiConfig & { model: PuckContentModel };\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NextRequest } from 'next/server';
|
|
2
|
-
import type { PuckApiConfig } from './config';
|
|
2
|
+
import type { PuckApiConfig } from './config.js';
|
|
3
3
|
type PuckRouteContext = {
|
|
4
4
|
params: Promise<{
|
|
5
5
|
puck?: string[];
|
|
@@ -23,4 +23,3 @@ export declare function createPuckApi(rawConfig: PuckApiConfig): {
|
|
|
23
23
|
DELETE: (request: NextRequest, context: PuckRouteContext) => Promise<Response>;
|
|
24
24
|
};
|
|
25
25
|
export {};
|
|
26
|
-
//# sourceMappingURL=create-puck-api.d.ts.map
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { NextResponse } from 'next/server';
|
|
2
|
-
import { isSameOriginRequest, requireAuth } from
|
|
3
|
-
import { resolveContentModel } from
|
|
4
|
-
import { normalizeLang } from
|
|
5
|
-
import { handleCreatePage } from
|
|
6
|
-
import { handleFragmentList, handleLinks, handleMediaItem, handleMediaList, handleNodeItem, handleNodeList } from
|
|
7
|
-
import { handlePublish } from
|
|
8
|
-
import { handleDeleteTemplate, handleSaveTemplate, handleUpdateTemplate } from
|
|
9
|
-
import { handleUpload } from
|
|
10
|
-
|
|
11
|
-
// that could smuggle path segments before the handlers interpolate them.
|
|
12
|
-
const TYPE_SEGMENT_RE = /^[a-z_]+$/;
|
|
13
|
-
|
|
2
|
+
import { isSameOriginRequest, requireAuth } from "../../../auth/server.js";
|
|
3
|
+
import { resolveContentModel } from "../content-model.js";
|
|
4
|
+
import { normalizeLang } from "../locale.js";
|
|
5
|
+
import { handleCreatePage } from "./handlers/create-page.js";
|
|
6
|
+
import { handleFragmentList, handleLinks, handleMediaItem, handleMediaList, handleNodeItem, handleNodeList } from "./handlers/entities.js";
|
|
7
|
+
import { handlePublish } from "./handlers/publish.js";
|
|
8
|
+
import { handleDeleteTemplate, handleSaveTemplate, handleUpdateTemplate } from "./handlers/template.js";
|
|
9
|
+
import { handleUpload } from "./handlers/upload.js";
|
|
10
|
+
import { isValidTypeSegment } from "./type-segment.js";
|
|
14
11
|
/**
|
|
15
12
|
* Handler factory for the Puck editor backend, mounted once as a catch-all
|
|
16
13
|
* route (Auth.js pattern):
|
|
@@ -45,7 +42,7 @@ export function createPuckApi(rawConfig) {
|
|
|
45
42
|
} = request.nextUrl;
|
|
46
43
|
const lang = normalizeLang(searchParams.get('lang'));
|
|
47
44
|
const typedResources = new Set(['node', 'media', 'fragment']);
|
|
48
|
-
if (typedResources.has(resource) &&
|
|
45
|
+
if (typedResources.has(resource) && !isValidTypeSegment(second)) {
|
|
49
46
|
return NextResponse.json({
|
|
50
47
|
error: 'Not found'
|
|
51
48
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-puck-api.js","names":["NextResponse","isSameOriginRequest","requireAuth","resolveContentModel","normalizeLang","handleCreatePage","handleFragmentList","handleLinks","handleMediaItem","handleMediaList","handleNodeItem","handleNodeList","handlePublish","handleDeleteTemplate","handleSaveTemplate","handleUpdateTemplate","handleUpload","
|
|
1
|
+
{"version":3,"file":"create-puck-api.js","names":["NextResponse","isSameOriginRequest","requireAuth","resolveContentModel","normalizeLang","handleCreatePage","handleFragmentList","handleLinks","handleMediaItem","handleMediaList","handleNodeItem","handleNodeList","handlePublish","handleDeleteTemplate","handleSaveTemplate","handleUpdateTemplate","handleUpload","isValidTypeSegment","createPuckApi","rawConfig","config","model","contentModel","handle","request","context","unauthorized","method","json","status","message","segments","params","puck","resource","second","third","searchParams","nextUrl","lang","get","typedResources","Set","has","error","length","console","join","GET","POST","PATCH","DELETE"],"sources":["../../../../src/puck-editor/internal/api/create-puck-api.ts"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\n\nimport { isSameOriginRequest, requireAuth } from '../../../auth/server.ts';\nimport { resolveContentModel } from '../content-model.ts';\nimport { normalizeLang } from '../locale.ts';\nimport type { PuckApiConfig, PuckApiRuntime } from './config.ts';\nimport { handleCreatePage } from './handlers/create-page.ts';\nimport {\n handleFragmentList,\n handleLinks,\n handleMediaItem,\n handleMediaList,\n handleNodeItem,\n handleNodeList,\n} from './handlers/entities.ts';\nimport { handlePublish } from './handlers/publish.ts';\nimport {\n handleDeleteTemplate,\n handleSaveTemplate,\n handleUpdateTemplate,\n} from './handlers/template.ts';\nimport { handleUpload } from './handlers/upload.ts';\nimport { isValidTypeSegment } from './type-segment.ts';\n\ntype PuckRouteContext = { params: Promise<{ puck?: string[] }> };\n\n/**\n * Handler factory for the Puck editor backend, mounted once as a catch-all\n * route (Auth.js pattern):\n *\n * // src/app/api/puck/[...puck]/route.ts\n * export const { GET, POST, PATCH, DELETE } = createPuckApi({ ... });\n *\n * Projects extend via Next.js routing precedence, not via config: a sibling\n * route file next to the mount adds an endpoint, a file on the same path as a\n * built-in handler shadows it.\n */\nexport function createPuckApi(rawConfig: PuckApiConfig) {\n const config: PuckApiRuntime = {\n ...rawConfig,\n model: resolveContentModel(rawConfig.contentModel),\n };\n const handle = async (request: NextRequest, context: PuckRouteContext) => {\n const unauthorized = await requireAuth();\n if (unauthorized) return unauthorized;\n\n if (request.method !== 'GET' && !isSameOriginRequest(request)) {\n return NextResponse.json(\n { status: 'error', message: 'cross-site request rejected' },\n { status: 403 }\n );\n }\n\n const segments = (await context.params).puck ?? [];\n const [resource, second, third] = segments;\n const { searchParams } = request.nextUrl;\n const lang = normalizeLang(searchParams.get('lang'));\n\n const typedResources = new Set(['node', 'media', 'fragment']);\n if (typedResources.has(resource) && !isValidTypeSegment(second)) {\n return NextResponse.json({ error: 'Not found' }, { status: 404 });\n }\n\n try {\n switch (request.method) {\n case 'GET':\n if (resource === 'links' && segments.length === 1) {\n return await handleLinks(config, lang);\n }\n if (resource === 'node' && segments.length === 2) {\n return await handleNodeList(config, second, searchParams);\n }\n if (resource === 'node' && segments.length === 3) {\n return await handleNodeItem(config, second, third, lang);\n }\n if (resource === 'media' && segments.length === 2) {\n return await handleMediaList(config, second, searchParams);\n }\n if (resource === 'media' && segments.length === 3) {\n return await handleMediaItem(config, second, third, lang);\n }\n if (resource === 'fragment' && segments.length === 2) {\n return await handleFragmentList(config, second, searchParams);\n }\n break;\n case 'POST':\n if (resource === 'create' && segments.length === 1) {\n return await handleCreatePage(config, request);\n }\n if (resource === 'upload' && segments.length === 1) {\n return await handleUpload(config, request);\n }\n if (resource === 'template' && segments.length === 1) {\n return await handleSaveTemplate(config, request);\n }\n break;\n case 'PATCH':\n if (resource === 'publish' && segments.length === 1) {\n return await handlePublish(config, request);\n }\n if (resource === 'template' && segments.length === 3) {\n return await handleUpdateTemplate(config, second, third, request);\n }\n break;\n case 'DELETE':\n if (resource === 'template' && segments.length === 3) {\n return await handleDeleteTemplate(config, second, third);\n }\n break;\n }\n } catch (error) {\n console.error(\n `puck api ${request.method} /${segments.join('/')}:`,\n error\n );\n return NextResponse.json(\n { status: 'error', message: 'An unexpected error occurred' },\n { status: 500 }\n );\n }\n\n return NextResponse.json({ error: 'Not found' }, { status: 404 });\n };\n\n return { GET: handle, POST: handle, PATCH: handle, DELETE: handle };\n}\n"],"mappings":"AAAA,SAAsBA,YAAY,QAAQ,aAAa;AAEvD,SAASC,mBAAmB,EAAEC,WAAW,QAAQ,yBAAyB;AAC1E,SAASC,mBAAmB,QAAQ,qBAAqB;AACzD,SAASC,aAAa,QAAQ,cAAc;AAE5C,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SACEC,kBAAkB,EAClBC,WAAW,EACXC,eAAe,EACfC,eAAe,EACfC,cAAc,EACdC,cAAc,QACT,wBAAwB;AAC/B,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SACEC,oBAAoB,EACpBC,kBAAkB,EAClBC,oBAAoB,QACf,wBAAwB;AAC/B,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SAASC,kBAAkB,QAAQ,mBAAmB;AAItD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAACC,SAAwB,EAAE;EACtD,MAAMC,MAAsB,GAAG;IAC7B,GAAGD,SAAS;IACZE,KAAK,EAAElB,mBAAmB,CAACgB,SAAS,CAACG,YAAY;EACnD,CAAC;EACD,MAAMC,MAAM,GAAG,MAAAA,CAAOC,OAAoB,EAAEC,OAAyB,KAAK;IACxE,MAAMC,YAAY,GAAG,MAAMxB,WAAW,CAAC,CAAC;IACxC,IAAIwB,YAAY,EAAE,OAAOA,YAAY;IAErC,IAAIF,OAAO,CAACG,MAAM,KAAK,KAAK,IAAI,CAAC1B,mBAAmB,CAACuB,OAAO,CAAC,EAAE;MAC7D,OAAOxB,YAAY,CAAC4B,IAAI,CACtB;QAAEC,MAAM,EAAE,OAAO;QAA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ACnE;UACA;QACF,KAAK,QAAQ;UACX,IAAIU,QAAQ,KAAK,UAAU,IAAIH,QAAQ,CAACc,MAAM,KAAK,CAAC,EAAE;YACpD,OAAO,MAAMhC,oBAAoB,CAACO,MAAM,EAAEe,MAAM,EAAEC,KAAK,CAAC;UAC1D;UACA;MACJ;IACF,CAAC,CAAC,OAAOQ,KAAK,EAAE;MACdE,OAAO,CAACF,KAAK,CACX,YAAYpB,OAAO,CAACG,MAAM,KAAKI,QAAQ,CAACgB,IAAI,CAAC,GAAG,CAAC,GAAG,EACpDH,KACF,CAAC;MACD,OAAO5C,YAAY,CAAC4B,IAAI,CACtB;QAAEC,MAAM,EAAE,OAAO;QAAEC,OAAO,EAAE;MAA+B,CAAC,EAC5D;QAAED,MAAM,EAAE;MAAI,CAChB,CAAC;IACH;IAEA,OAAO7B,YAAY,CAAC4B,IAAI,CAAC;MAAEgB,KAAK,EAAE;IAAY,CAAC,EAAE;MAAEf,MAAM,EAAE;IAAI,CAAC,CAAC;EACnE,CAAC;EAED,OAAO;IAAEmB,GAAG,EAAEzB,MAAM;IAAE0B,IAAI,EAAE1B,MAAM;IAAE2B,KAAK,EAAE3B,MAAM;IAAE4B,MAAM,EAAE5B;EAAO,CAAC;AACrE","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
-
import type { PuckApiRuntime } from '../config';
|
|
2
|
+
import type { PuckApiRuntime } from '../config.js';
|
|
3
3
|
export declare function handleCreatePage(config: PuckApiRuntime, request: NextRequest): Promise<NextResponse<{
|
|
4
4
|
status: string;
|
|
5
5
|
message: string;
|
|
@@ -10,4 +10,3 @@ export declare function handleCreatePage(config: PuckApiRuntime, request: NextRe
|
|
|
10
10
|
alias: any;
|
|
11
11
|
fieldName: string;
|
|
12
12
|
}>>;
|
|
13
|
-
//# sourceMappingURL=create-page.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NextResponse } from 'next/server';
|
|
2
|
-
import { creatableBundles, getBundle } from
|
|
3
|
-
import {
|
|
2
|
+
import { creatableBundles, getBundle } from "../../content-model.js";
|
|
3
|
+
import { normalizeLang } from "../../locale.js";
|
|
4
|
+
import { resolveSpaceUuid, SPACE_TYPE } from "../space.js";
|
|
4
5
|
const DEFAULT_TITLE = 'New page';
|
|
5
6
|
const EMPTY_PUCK_DATA = {
|
|
6
7
|
content: [],
|
|
@@ -32,8 +33,9 @@ export async function handleCreatePage(config, request) {
|
|
|
32
33
|
alias,
|
|
33
34
|
type,
|
|
34
35
|
fieldName,
|
|
35
|
-
lang
|
|
36
|
+
lang: rawLang
|
|
36
37
|
} = await request.json();
|
|
38
|
+
const lang = normalizeLang(rawLang);
|
|
37
39
|
const requestedType = type ?? creatableBundles(config.model)[0]?.type;
|
|
38
40
|
const bundle = getBundle(config.model, requestedType);
|
|
39
41
|
if (!bundle || !bundle.creatable || fieldName !== undefined && fieldName !== bundle.dataField) {
|
|
@@ -116,7 +118,7 @@ export async function handleCreatePage(config, request) {
|
|
|
116
118
|
}
|
|
117
119
|
return NextResponse.json({
|
|
118
120
|
status: 'error',
|
|
119
|
-
message:
|
|
121
|
+
message: 'Error creating Drupal node'
|
|
120
122
|
}, {
|
|
121
123
|
status: 500
|
|
122
124
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-page.js","names":["NextResponse","creatableBundles","getBundle","resolveSpaceUuid","SPACE_TYPE","DEFAULT_TITLE","EMPTY_PUCK_DATA","content","root","props","normalizeAlias","input","trimmed","trim","replace","alias","startsWith","test","readNodeAlias","client","jsonApiType","type","id","lang","fetched","request","data","attributes","path","error","console","handleCreatePage","config","title","fieldName","json","requestedType","model","bundle","creatable","undefined","dataField","status","message","relationships","spaceId","spaceUuid","createClient","nodehive_space","normalizedAlias","createDefaults","JSON","stringify","langcode","pathauto","createUserClient","response","method","headers","Accept","nid","drupal_internal__nid","resolvedAlias","details"
|
|
1
|
+
{"version":3,"file":"create-page.js","names":["NextResponse","creatableBundles","getBundle","normalizeLang","resolveSpaceUuid","SPACE_TYPE","DEFAULT_TITLE","EMPTY_PUCK_DATA","content","root","props","normalizeAlias","input","trimmed","trim","replace","alias","startsWith","test","readNodeAlias","client","jsonApiType","type","id","lang","fetched","request","data","attributes","path","error","console","handleCreatePage","config","title","fieldName","rawLang","json","requestedType","model","bundle","creatable","undefined","dataField","status","message","relationships","spaceId","spaceUuid","createClient","nodehive_space","normalizedAlias","createDefaults","JSON","stringify","langcode","pathauto","createUserClient","response","method","headers","Accept","nid","drupal_internal__nid","resolvedAlias","details"],"sources":["../../../../../src/puck-editor/internal/api/handlers/create-page.ts"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\nimport type { NodeHiveClient } from 'nodehive-js';\n\nimport { creatableBundles, getBundle } from '../../content-model.ts';\nimport { normalizeLang } from '../../locale.ts';\nimport type { PuckApiRuntime } from '../config.ts';\nimport { resolveSpaceUuid, SPACE_TYPE } from '../space.ts';\n\nconst DEFAULT_TITLE = 'New page';\nconst EMPTY_PUCK_DATA = { content: [], root: { props: {} } };\n\nfunction normalizeAlias(input: unknown): string | null {\n if (typeof input !== 'string') return null;\n const trimmed = input.trim().replace(/\\/+$/, '');\n if (!trimmed) return null;\n const alias = trimmed.startsWith('/') ? trimmed : `/${trimmed}`;\n return /^(\\/[a-z0-9-]+)+$/i.test(alias) ? alias : null;\n}\n\nasync function readNodeAlias(\n client: NodeHiveClient,\n jsonApiType: string,\n type: string,\n id: string,\n lang?: string\n): Promise<string | null> {\n try {\n const fetched = await client.request(\n `/jsonapi/node/${jsonApiType}/${id}?fields[${type}]=path`,\n { lang }\n );\n return fetched?.data?.attributes?.path?.alias ?? null;\n } catch (error) {\n console.error('Error reading created node alias:', error);\n return null;\n }\n}\n\nexport async function handleCreatePage(\n config: PuckApiRuntime,\n request: NextRequest\n) {\n const { title, alias, type, fieldName, lang: rawLang } = await request.json();\n const lang = normalizeLang(rawLang);\n\n const requestedType = type ?? creatableBundles(config.model)[0]?.type;\n const bundle = getBundle(config.model, requestedType);\n\n if (\n !bundle ||\n !bundle.creatable ||\n (fieldName !== undefined && fieldName !== bundle.dataField)\n ) {\n return NextResponse.json(\n { status: 'error', message: 'invalid type or fieldName' },\n { status: 400 }\n );\n }\n\n let relationships: Record<string, unknown> | undefined;\n if (config.spaceId) {\n const spaceUuid = await resolveSpaceUuid(\n await config.createClient(),\n config.spaceId\n );\n if (!spaceUuid) {\n return NextResponse.json(\n {\n status: 'error',\n message: 'Could not resolve the NodeHive space; page not created.',\n },\n { status: 500 }\n );\n }\n relationships = {\n nodehive_space: { data: [{ type: SPACE_TYPE, id: spaceUuid }] },\n };\n }\n\n const normalizedAlias = normalizeAlias(alias);\n const jsonApiType = bundle.type.replace('node--', '');\n const attributes: Record<string, unknown> = {\n title:\n typeof title === 'string' && title.trim()\n ? title.trim()\n : (bundle.createDefaults.title ?? DEFAULT_TITLE),\n status: false,\n [bundle.dataField]: JSON.stringify(EMPTY_PUCK_DATA),\n ...(typeof lang === 'string' && lang ? { langcode: lang } : {}),\n ...(normalizedAlias\n ? { path: { alias: normalizedAlias, pathauto: 0 } }\n : {}),\n };\n\n try {\n const client = config.createUserClient();\n const response = await client.request(`/jsonapi/node/${jsonApiType}`, {\n method: 'POST',\n lang,\n data: {\n data: {\n type: bundle.type,\n attributes,\n ...(relationships ? { relationships } : {}),\n },\n },\n headers: { Accept: 'application/vnd.api+json' },\n });\n\n const id = response?.data?.id ?? null;\n const nid = response?.data?.attributes?.drupal_internal__nid ?? null;\n const resolvedAlias =\n response?.data?.attributes?.path?.alias ??\n (id\n ? await readNodeAlias(client, jsonApiType, bundle.type, id, lang)\n : null);\n\n return NextResponse.json({\n status: 'ok',\n id,\n nid,\n alias: resolvedAlias,\n fieldName: bundle.dataField,\n });\n } catch (error) {\n const details = (error as { details?: unknown })?.details;\n console.error('Error creating Drupal node:', error);\n if (details) {\n console.error(\n 'Drupal response details:',\n JSON.stringify(details, null, 2)\n );\n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uC,GAAG,GAAGJ,QAAQ,EAAE/B,IAAI,EAAEC,UAAU,EAAEmC,oBAAoB,IAAI,IAAI;IACpE,MAAMC,aAAa,GACjBN,QAAQ,EAAE/B,IAAI,EAAEC,UAAU,EAAEC,IAAI,EAAEb,KAAK,KACtCO,EAAE,GACC,MAAMJ,aAAa,CAACC,MAAM,EAAEC,WAAW,EAAEmB,MAAM,CAAClB,IAAI,EAAEC,EAAE,EAAEC,IAAI,CAAC,GAC/D,IAAI,CAAC;IAEX,OAAOxB,YAAY,CAACqC,IAAI,CAAC;MACvBO,MAAM,EAAE,IAAI;MACZrB,EAAE;MACFuC,GAAG;MACH9C,KAAK,EAAEgD,aAAa;MACpB7B,SAAS,EAAEK,MAAM,CAACG;IACpB,CAAC,CAAC;EACJ,CAAC,CAAC,OAAOb,KAAK,EAAE;IACd,MAAMmC,OAAO,GAAInC,KAAK,EAA4BmC,OAAO;IACzDlC,OAAO,CAACD,KAAK,CAAC,6BAA6B,EAAEA,KAAK,CAAC;IACnD,IAAImC,OAAO,EAAE;MACXlC,OAAO,CAACD,KAAK,CACX,0BAA0B,EAC1BuB,IAAI,CAACC,SAAS,CAACW,OAAO,EAAE,IAAI,EAAE,CAAC,CACjC,CAAC;IACH;IACA,OAAOjE,YAAY,CAACqC,IAAI,CACtB;MAAEO,MAAM,EAAE,OAAO;MAAEC,OAAO,EAAE;IAA6B,CAAC,EAC1D;MAAED,MAAM,EAAE;IAAI,CAChB,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { NextResponse } from 'next/server';
|
|
2
|
-
import type { PuckApiConfig } from '../config';
|
|
2
|
+
import type { PuckApiConfig, PuckApiRuntime } from '../config.js';
|
|
3
3
|
export declare function handleLinks(config: PuckApiConfig, lang?: string): Promise<NextResponse<{
|
|
4
4
|
error: string;
|
|
5
|
-
}> | NextResponse<import("../../../fields").RoutableLink[]>>;
|
|
5
|
+
}> | NextResponse<import("../../../fields.js").RoutableLink[]>>;
|
|
6
6
|
export declare function handleNodeList(config: PuckApiConfig, type: string, searchParams: URLSearchParams): Promise<NextResponse<any>>;
|
|
7
7
|
export declare function handleNodeItem(config: PuckApiConfig, type: string, id: string, lang?: string): Promise<NextResponse<any>>;
|
|
8
|
-
export declare function handleMediaList(config:
|
|
8
|
+
export declare function handleMediaList(config: PuckApiRuntime, type: string, searchParams: URLSearchParams): Promise<NextResponse<import("nodehive-js").ApiResponse<any>> | NextResponse<{
|
|
9
9
|
error: string;
|
|
10
10
|
}>>;
|
|
11
|
-
export declare function handleMediaItem(config:
|
|
11
|
+
export declare function handleMediaItem(config: PuckApiRuntime, type: string, id: string, lang?: string): Promise<NextResponse<import("nodehive-js").ApiResponse<any>> | NextResponse<{
|
|
12
12
|
error: string;
|
|
13
13
|
}>>;
|
|
14
14
|
export declare function handleFragmentList(config: PuckApiConfig, type: string, searchParams: URLSearchParams): Promise<NextResponse<import("nodehive-js").ApiResponse<any>> | NextResponse<{
|
|
15
|
+
data: never[];
|
|
16
|
+
}> | NextResponse<{
|
|
15
17
|
error: string;
|
|
16
18
|
}>>;
|
|
17
|
-
//# sourceMappingURL=entities.d.ts.map
|