@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
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ part of the public API.
|
|
|
26
26
|
| Module | Imports | Purpose |
|
|
27
27
|
| --- | --- | --- |
|
|
28
28
|
| auth | `@nodehive/nextjs/auth`, `/auth/server`, `/auth/react`, `/auth/routes`, `/auth/proxy` | OAuth login (authorization code + PKCE), session, client factories |
|
|
29
|
-
| puck-editor | `@nodehive/nextjs/puck-editor`, `/puck-editor/server`, `/puck-editor/fields`, `/puck-editor/render`, `/puck-editor/smart-actions`, `/puck-editor/puck-theme.css` | Puck editing surface |
|
|
29
|
+
| puck-editor | `@nodehive/nextjs/puck-editor`, `/puck-editor/server`, `/puck-editor/editor`, `/puck-editor/fields`, `/puck-editor/render`, `/puck-editor/smart-actions`, `/puck-editor/puck-theme.css` | Puck editing surface |
|
|
30
30
|
| visual-editor | `@nodehive/nextjs/visual-editor`, `/visual-editor/server` | Drupal-iframe overlays + bridge |
|
|
31
31
|
| smart-actions | `@nodehive/nextjs/smart-actions/server` | Floating editor toolbar |
|
|
32
32
|
| theme | `@nodehive/nextjs/theme.css` | Shared `--nh-editor-*` theming contract |
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { NodeHiveAuthConfig } from './internal/config';
|
|
1
|
+
import type { NodeHiveAuthConfig } from './internal/config.js';
|
|
2
2
|
export type { NodeHiveAuthConfig };
|
|
3
|
-
export type { CallbackError } from './internal/routes/callback';
|
|
3
|
+
export type { CallbackError } from './internal/routes/callback.js';
|
|
4
4
|
/** Identity helper for authoring a typed config object in the project. */
|
|
5
5
|
export declare function defineNodeHiveAuthConfig(config: NodeHiveAuthConfig): NodeHiveAuthConfig;
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/auth/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["defineNodeHiveAuthConfig","config"],"sources":["../../src/auth/index.ts"],"sourcesContent":["// Root entry: config type + authoring helper (no runtime auth code).\nimport type { NodeHiveAuthConfig } from './internal/config';\n\nexport type { NodeHiveAuthConfig };\nexport type { CallbackError } from './internal/routes/callback';\n\n/** Identity helper for authoring a typed config object in the project. */\nexport function defineNodeHiveAuthConfig(\n config: NodeHiveAuthConfig\n): NodeHiveAuthConfig {\n return config;\n}\n"],"mappings":"AAAA;;AAMA;AACA,OAAO,SAASA,wBAAwBA,CACtCC,MAA0B,EACN;EACpB,OAAOA,MAAM;AACf","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["defineNodeHiveAuthConfig","config"],"sources":["../../src/auth/index.ts"],"sourcesContent":["// Root entry: config type + authoring helper (no runtime auth code).\nimport type { NodeHiveAuthConfig } from './internal/config.ts';\n\nexport type { NodeHiveAuthConfig };\nexport type { CallbackError } from './internal/routes/callback.ts';\n\n/** Identity helper for authoring a typed config object in the project. */\nexport function defineNodeHiveAuthConfig(\n config: NodeHiveAuthConfig\n): NodeHiveAuthConfig {\n return config;\n}\n"],"mappings":"AAAA;;AAMA;AACA,OAAO,SAASA,wBAAwBA,CACtCC,MAA0B,EACN;EACpB,OAAOA,MAAM;AACf","ignoreList":[]}
|
|
@@ -11,14 +11,24 @@ export interface NodeHiveAuthConfig {
|
|
|
11
11
|
defaultLocale: string;
|
|
12
12
|
jsonapiConfig?: NodeHiveConfig;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* editor
|
|
16
|
-
* every cache layer
|
|
17
|
-
*
|
|
14
|
+
* Couples Next.js Draft Mode to the session. Default `true` assumes the
|
|
15
|
+
* editor-first product model (logged in = editor); Draft Mode then bypasses
|
|
16
|
+
* every Next.js cache layer for that session.
|
|
17
|
+
*
|
|
18
|
+
* IMPORTANT for apps with end-user login: `true` gives *every* authenticated
|
|
19
|
+
* user (not just editors) an uncached, per-request-rendered site, which
|
|
20
|
+
* defeats caching and can leak draft content to end users. In that case do
|
|
21
|
+
* one of:
|
|
22
|
+
* - restrict to editorial Drupal roles (recommended):
|
|
23
|
+
* `{ roles: ['nodehive_content_editor', 'nodehive_content_admin'] }`, so
|
|
24
|
+
* only sessions carrying one of these roles enable Draft Mode; or
|
|
25
|
+
* - set `false` to fully decouple Draft Mode from login.
|
|
26
|
+
*
|
|
27
|
+
* The roles decision reads the Drupal `user_details` cookie and fails closed
|
|
28
|
+
* (no/invalid details, or no matching role → Draft Mode stays off).
|
|
18
29
|
* Pass this config to EditorAuthGateServer too (draft self-heal trigger).
|
|
19
30
|
*/
|
|
20
31
|
draftModeOnLogin?: boolean | {
|
|
21
32
|
roles: string[];
|
|
22
33
|
};
|
|
23
34
|
}
|
|
24
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":[],"sources":["../../../src/auth/internal/config.ts"],"sourcesContent":["import type { NodeHiveConfig } from 'nodehive-js';\n\n/**\n * Project-injected auth config. Passed explicitly into the factories and\n * updateSession() — never a module-level singleton: middleware, Node routes and\n * Server Components each load the module in a separate runtime instance, so a\n * one-time global registration would be invisible to the others.\n */\nexport interface NodeHiveAuthConfig {\n multilingual: boolean;\n /** Prefixes the login-landing redirect on multilingual sites. */\n defaultLocale: string;\n jsonapiConfig?: NodeHiveConfig;\n /**\n *
|
|
1
|
+
{"version":3,"file":"config.js","names":[],"sources":["../../../src/auth/internal/config.ts"],"sourcesContent":["import type { NodeHiveConfig } from 'nodehive-js';\n\n/**\n * Project-injected auth config. Passed explicitly into the factories and\n * updateSession() — never a module-level singleton: middleware, Node routes and\n * Server Components each load the module in a separate runtime instance, so a\n * one-time global registration would be invisible to the others.\n */\nexport interface NodeHiveAuthConfig {\n multilingual: boolean;\n /** Prefixes the login-landing redirect on multilingual sites. */\n defaultLocale: string;\n jsonapiConfig?: NodeHiveConfig;\n /**\n * Couples Next.js Draft Mode to the session. Default `true` assumes the\n * editor-first product model (logged in = editor); Draft Mode then bypasses\n * every Next.js cache layer for that session.\n *\n * IMPORTANT for apps with end-user login: `true` gives *every* authenticated\n * user (not just editors) an uncached, per-request-rendered site, which\n * defeats caching and can leak draft content to end users. In that case do\n * one of:\n * - restrict to editorial Drupal roles (recommended):\n * `{ roles: ['nodehive_content_editor', 'nodehive_content_admin'] }`, so\n * only sessions carrying one of these roles enable Draft Mode; or\n * - set `false` to fully decouple Draft Mode from login.\n *\n * The roles decision reads the Drupal `user_details` cookie and fails closed\n * (no/invalid details, or no matching role → Draft Mode stays off).\n * Pass this config to EditorAuthGateServer too (draft self-heal trigger).\n */\n draftModeOnLogin?: boolean | { roles: string[] };\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { NodeHiveAuthConfig } from './config';
|
|
2
|
-
import {
|
|
1
|
+
import type { NodeHiveAuthConfig } from './config.js';
|
|
2
|
+
import type { ProxyContext } from './next-cookie-storage.js';
|
|
3
3
|
/** Next's draft-mode bypass cookie (name is fixed by Next, not configurable). */
|
|
4
4
|
export declare const DRAFT_MODE_COOKIE = "__prerender_bypass";
|
|
5
5
|
export declare function shouldEnableDraftMode(config: NodeHiveAuthConfig, proxyContext?: ProxyContext): Promise<boolean>;
|
|
@@ -14,4 +14,3 @@ export declare function persistentDraftCookieOptions(): {
|
|
|
14
14
|
/** Route Handler / Server Action only — Next forbids toggling draft elsewhere. */
|
|
15
15
|
export declare function enablePersistentDraftMode(): Promise<void>;
|
|
16
16
|
export declare function disablePersistentDraftMode(): Promise<void>;
|
|
17
|
-
//# sourceMappingURL=draft-mode.d.ts.map
|
|
@@ -1,33 +1,16 @@
|
|
|
1
1
|
import { cookies, draftMode } from 'next/headers';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { REFRESH_TOKEN_MAX_AGE } from "./oauth-config.js";
|
|
3
|
+
import { getUserRoles, hasAnyRole } from "./roles.js";
|
|
4
4
|
|
|
5
5
|
/** Next's draft-mode bypass cookie (name is fixed by Next, not configurable). */
|
|
6
6
|
export const DRAFT_MODE_COOKIE = '__prerender_bypass';
|
|
7
7
|
|
|
8
|
-
// user_details is the Drupal core REST user entity: roles come as
|
|
9
|
-
// [{ target_id: 'editor' }]; plain string arrays are accepted too.
|
|
10
|
-
function extractRoles(userDetails) {
|
|
11
|
-
const roles = userDetails?.roles;
|
|
12
|
-
if (!Array.isArray(roles)) return [];
|
|
13
|
-
return roles.map(role => typeof role === 'string' ? role : role?.target_id).filter(id => typeof id === 'string');
|
|
14
|
-
}
|
|
15
|
-
|
|
16
8
|
// Fails closed. Pass the proxy context where cookies were just written through
|
|
17
9
|
// it (refresh route), so the decision sees the fresh user_details.
|
|
18
10
|
export async function shouldEnableDraftMode(config, proxyContext) {
|
|
19
11
|
const option = config.draftModeOnLogin ?? true;
|
|
20
12
|
if (typeof option === 'boolean') return option;
|
|
21
|
-
|
|
22
|
-
if (!raw) return false;
|
|
23
|
-
let userDetails;
|
|
24
|
-
try {
|
|
25
|
-
userDetails = JSON.parse(raw);
|
|
26
|
-
} catch {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
const userRoles = extractRoles(userDetails);
|
|
30
|
-
return option.roles.some(role => userRoles.includes(role));
|
|
13
|
+
return hasAnyRole(await getUserRoles(proxyContext), option.roles);
|
|
31
14
|
}
|
|
32
15
|
|
|
33
16
|
// Next's own bypass cookie is session-scoped, unpartitioned, SameSite=Lax —
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draft-mode.js","names":["cookies","draftMode","
|
|
1
|
+
{"version":3,"file":"draft-mode.js","names":["cookies","draftMode","REFRESH_TOKEN_MAX_AGE","getUserRoles","hasAnyRole","DRAFT_MODE_COOKIE","shouldEnableDraftMode","config","proxyContext","option","draftModeOnLogin","roles","persistentDraftCookieOptions","httpOnly","sameSite","secure","partitioned","path","maxAge","enablePersistentDraftMode","enable","cookieStore","bypass","get","value","set","name","disablePersistentDraftMode","disable"],"sources":["../../../src/auth/internal/draft-mode.ts"],"sourcesContent":["import { cookies, draftMode } from 'next/headers';\n\nimport type { NodeHiveAuthConfig } from './config.ts';\nimport type { ProxyContext } from './next-cookie-storage.ts';\nimport { REFRESH_TOKEN_MAX_AGE } from './oauth-config.ts';\nimport { getUserRoles, hasAnyRole } from './roles.ts';\n\n/** Next's draft-mode bypass cookie (name is fixed by Next, not configurable). */\nexport const DRAFT_MODE_COOKIE = '__prerender_bypass';\n\n// Fails closed. Pass the proxy context where cookies were just written through\n// it (refresh route), so the decision sees the fresh user_details.\nexport async function shouldEnableDraftMode(\n config: NodeHiveAuthConfig,\n proxyContext?: ProxyContext\n): Promise<boolean> {\n const option = config.draftModeOnLogin ?? true;\n if (typeof option === 'boolean') return option;\n\n return hasAnyRole(await getUserRoles(proxyContext), option.roles);\n}\n\n// Next's own bypass cookie is session-scoped, unpartitioned, SameSite=Lax —\n// re-set persistent + partitioned to survive browser reopen and cross-site iframes.\nexport function persistentDraftCookieOptions() {\n return {\n httpOnly: true,\n sameSite: 'none' as const,\n secure: true,\n partitioned: true,\n path: '/',\n maxAge: REFRESH_TOKEN_MAX_AGE,\n };\n}\n\n/** Route Handler / Server Action only — Next forbids toggling draft elsewhere. */\nexport async function enablePersistentDraftMode(): Promise<void> {\n (await draftMode()).enable();\n\n // Re-setting the same name replaces Next's Set-Cookie (ResponseCookies is\n // keyed by name), so a single cookie goes out.\n const cookieStore = await cookies();\n const bypass = cookieStore.get(DRAFT_MODE_COOKIE)?.value;\n if (!bypass) return;\n\n cookieStore.set({\n name: DRAFT_MODE_COOKIE,\n value: bypass,\n ...persistentDraftCookieOptions(),\n });\n}\n\n// Next's own deletion lacks the Partitioned attribute and would miss our cookie.\nexport async function disablePersistentDraftMode(): Promise<void> {\n (await draftMode()).disable();\n\n const cookieStore = await cookies();\n cookieStore.set({\n name: DRAFT_MODE_COOKIE,\n value: '',\n ...persistentDraftCookieOptions(),\n maxAge: 0,\n });\n}\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,SAAS,QAAQ,cAAc;AAIjD,SAASC,qBAAqB,QAAQ,mBAAmB;AACzD,SAASC,YAAY,EAAEC,UAAU,QAAQ,YAAY;;AAErD;AACA,OAAO,MAAMC,iBAAiB,GAAG,oBAAoB;;AAErD;AACA;AACA,OAAO,eAAeC,qBAAqBA,CACzCC,MAA0B,EAC1BC,YAA2B,EACT;EAClB,MAAMC,MAAM,GAAGF,MAAM,CAACG,gBAAgB,IAAI,IAAI;EAC9C,IAAI,OAAOD,MAAM,KAAK,SAAS,EAAE,OAAOA,MAAM;EAE9C,OAAOL,UAAU,CAAC,MAAMD,YAAY,CAACK,YAAY,CAAC,EAAEC,MAAM,CAACE,KAAK,CAAC;AACnE;;AAEA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAAA,EAAG;EAC7C,OAAO;IACLC,QAAQ,EAAE,IAAI;IACdC,QAAQ,EAAE,MAAe;IACzBC,MAAM,EAAE,IAAI;IACZC,WAAW,EAAE,IAAI;IACjBC,IAAI,EAAE,GAAG;IACTC,MAAM,EAAEhB;EACV,CAAC;AACH;;AAEA;AACA,OAAO,eAAeiB,yBAAyBA,CAAA,EAAkB;EAC/D,CAAC,MAAMlB,SAAS,CAAC,CAAC,EAAEmB,MAAM,CAAC,CAAC;;EAE5B;EACA;EACA,MAAMC,WAAW,GAAG,MAAMrB,OAAO,CAAC,CAAC;EACnC,MAAMsB,MAAM,GAAGD,WAAW,CAACE,GAAG,CAAClB,iBAAiB,CAAC,EAAEmB,KAAK;EACxD,IAAI,CAACF,MAAM,EAAE;EAEbD,WAAW,CAACI,GAAG,CAAC;IACdC,IAAI,EAAErB,iBAAiB;IACvBmB,KAAK,EAAEF,MAAM;IACb,GAAGV,4BAA4B,CAAC;EAClC,CAAC,CAAC;AACJ;;AAEA;AACA,OAAO,eAAee,0BAA0BA,CAAA,EAAkB;EAChE,CAAC,MAAM1B,SAAS,CAAC,CAAC,EAAE2B,OAAO,CAAC,CAAC;EAE7B,MAAMP,WAAW,GAAG,MAAMrB,OAAO,CAAC,CAAC;EACnCqB,WAAW,CAACI,GAAG,CAAC;IACdC,IAAI,EAAErB,iBAAiB;IACvBmB,KAAK,EAAE,EAAE;IACT,GAAGZ,4BAA4B,CAAC,CAAC;IACjCM,MAAM,EAAE;EACV,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { NodeHiveClient } from 'nodehive-js';
|
|
2
2
|
export declare function resolveEditorLocale(userDetails: unknown, fallback: string): string;
|
|
3
3
|
export declare function getEditorLocale(client: NodeHiveClient, pageLocale: string): Promise<string>;
|
|
4
|
-
//# sourceMappingURL=editor-locale.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"has-session.js","names":["NextCookieStorage","checkHasSession","get"],"sources":["../../../src/auth/internal/has-session.ts"],"sourcesContent":["import { NextCookieStorage } from './next-cookie-storage';\n\n/**\n * Routing hint for the cached/fresh data-loader branch, not a security\n * boundary: Drupal authorizes every fetch by the actual token. Checks the\n * refresh-token cookie, the same durable login proof requireAuth uses.\n */\nexport async function checkHasSession(): Promise<boolean> {\n return !!(await new NextCookieStorage().get('refresh_token'));\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,
|
|
1
|
+
{"version":3,"file":"has-session.js","names":["NextCookieStorage","checkHasSession","get"],"sources":["../../../src/auth/internal/has-session.ts"],"sourcesContent":["import { NextCookieStorage } from './next-cookie-storage.ts';\n\n/**\n * Routing hint for the cached/fresh data-loader branch, not a security\n * boundary: Drupal authorizes every fetch by the actual token. Checks the\n * refresh-token cookie, the same durable login proof requireAuth uses.\n */\nexport async function checkHasSession(): Promise<boolean> {\n return !!(await new NextCookieStorage().get('refresh_token'));\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,0BAA0B;;AAE5D;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,eAAeA,CAAA,EAAqB;EACxD,OAAO,CAAC,EAAE,MAAM,IAAID,iBAAiB,CAAC,CAAC,CAACE,GAAG,CAAC,eAAe,CAAC,CAAC;AAC/D","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type DictionaryOverrides } from '../../shared/i18n.js';
|
|
2
|
+
declare const en: {
|
|
3
|
+
popupDone: {
|
|
4
|
+
message: string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export type AuthDictionary = typeof en;
|
|
8
|
+
export type AuthDictionaryOverrides = DictionaryOverrides<AuthDictionary>;
|
|
9
|
+
export declare function getAuthDictionary(locale: string, overrides?: AuthDictionaryOverrides): AuthDictionary;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { resolveDictionary } from "../../shared/i18n.js";
|
|
2
|
+
const en = {
|
|
3
|
+
popupDone: {
|
|
4
|
+
message: 'Signed in successfully. Closing window…'
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
const de = {
|
|
8
|
+
popupDone: {
|
|
9
|
+
message: 'Anmeldung erfolgreich. Fenster schliesst…'
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const fr = {
|
|
13
|
+
popupDone: {
|
|
14
|
+
message: 'Connexion réussie. Fermeture de la fenêtre…'
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const dictionaries = {
|
|
18
|
+
en,
|
|
19
|
+
de,
|
|
20
|
+
fr
|
|
21
|
+
};
|
|
22
|
+
export function getAuthDictionary(locale, overrides) {
|
|
23
|
+
return resolveDictionary(dictionaries, en, locale, overrides);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=i18n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","names":["resolveDictionary","en","popupDone","message","de","fr","dictionaries","getAuthDictionary","locale","overrides"],"sources":["../../../src/auth/internal/i18n.ts"],"sourcesContent":["import {\n resolveDictionary,\n type DictionaryOverrides,\n} from '../../shared/i18n.ts';\n\nconst en = {\n popupDone: {\n message: 'Signed in successfully. Closing window…',\n },\n};\n\nconst de: AuthDictionary = {\n popupDone: {\n message: 'Anmeldung erfolgreich. Fenster schliesst…',\n },\n};\n\nconst fr: AuthDictionary = {\n popupDone: {\n message: 'Connexion réussie. Fermeture de la fenêtre…',\n },\n};\n\nexport type AuthDictionary = typeof en;\n\nexport type AuthDictionaryOverrides = DictionaryOverrides<AuthDictionary>;\n\nconst dictionaries: Record<string, AuthDictionary> = { en, de, fr };\n\nexport function getAuthDictionary(\n locale: string,\n overrides?: AuthDictionaryOverrides\n): AuthDictionary {\n return resolveDictionary(dictionaries, en, locale, overrides);\n}\n"],"mappings":"AAAA,SACEA,iBAAiB,QAEZ,sBAAsB;AAE7B,MAAMC,EAAE,GAAG;EACTC,SAAS,EAAE;IACTC,OAAO,EAAE;EACX;AACF,CAAC;AAED,MAAMC,EAAkB,GAAG;EACzBF,SAAS,EAAE;IACTC,OAAO,EAAE;EACX;AACF,CAAC;AAED,MAAME,EAAkB,GAAG;EACzBH,SAAS,EAAE;IACTC,OAAO,EAAE;EACX;AACF,CAAC;AAMD,MAAMG,YAA4C,GAAG;EAAEL,EAAE;EAAEG,EAAE;EAAEC;AAAG,CAAC;AAEnE,OAAO,SAASE,iBAAiBA,CAC/BC,MAAc,EACdC,SAAmC,EACnB;EAChB,OAAOT,iBAAiB,CAACM,YAAY,EAAEL,EAAE,EAAEO,MAAM,EAAEC,SAAS,CAAC;AAC/D","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NodeHiveAuthConfig } from './config';
|
|
1
|
+
import type { NodeHiveAuthConfig } from './config.js';
|
|
2
2
|
export interface PerformLogoutOptions {
|
|
3
3
|
/** Where to send the user after logout. Defaults to '/'. */
|
|
4
4
|
redirectTo?: string;
|
|
@@ -9,4 +9,3 @@ export interface PerformLogoutOptions {
|
|
|
9
9
|
* session is intentionally left untouched.
|
|
10
10
|
*/
|
|
11
11
|
export declare function performLogout(config: NodeHiveAuthConfig, options?: PerformLogoutOptions): Promise<void>;
|
|
12
|
-
//# sourceMappingURL=logout.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { revalidatePath } from 'next/cache';
|
|
2
2
|
import { redirect } from 'next/navigation';
|
|
3
|
-
import { disablePersistentDraftMode } from
|
|
4
|
-
import { buildUserClient } from
|
|
5
|
-
import { getClientId, getClientSecret, getRevokeUrl } from
|
|
3
|
+
import { disablePersistentDraftMode } from "./draft-mode.js";
|
|
4
|
+
import { buildUserClient } from "./nodehive-client.js";
|
|
5
|
+
import { getClientId, getClientSecret, getRevokeUrl } from "./oauth-config.js";
|
|
6
6
|
/**
|
|
7
7
|
* Meant to be wrapped by a project Server Action (not a Route Handler) so Next's
|
|
8
8
|
* built-in CSRF protection (Same-Origin + Action-ID) applies. The Drupal admin
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout.js","names":["revalidatePath","redirect","disablePersistentDraftMode","buildUserClient","getClientId","getClientSecret","getRevokeUrl","performLogout","config","options","client","refreshToken","auth","getRefreshToken","basicAuth","Buffer","from","toString","fetch","method","headers","Authorization","body","URLSearchParams","token","token_type_hint","signal","AbortSignal","timeout","error","console","warn","logout","redirectTo"],"sources":["../../../src/auth/internal/logout.ts"],"sourcesContent":["import { revalidatePath } from 'next/cache';\nimport { redirect } from 'next/navigation';\n\nimport type { NodeHiveAuthConfig } from './config';\nimport { disablePersistentDraftMode } from './draft-mode';\nimport { buildUserClient } from './nodehive-client';\nimport { getClientId, getClientSecret, getRevokeUrl } from './oauth-config';\n\nexport interface PerformLogoutOptions {\n /** Where to send the user after logout. Defaults to '/'. */\n redirectTo?: string;\n}\n\n/**\n * Meant to be wrapped by a project Server Action (not a Route Handler) so Next's\n * built-in CSRF protection (Same-Origin + Action-ID) applies. The Drupal admin\n * session is intentionally left untouched.\n */\nexport async function performLogout(\n config: NodeHiveAuthConfig,\n options?: PerformLogoutOptions\n): Promise<void> {\n const client = buildUserClient(config);\n const refreshToken = await client.auth.getRefreshToken();\n\n // Best-effort revoke so a leaked refresh token dies now, not after its 30-day\n // TTL (also invalidates the bound access tokens). Never blocks logout.\n if (refreshToken) {\n try {\n const basicAuth = Buffer.from(\n `${getClientId()}:${getClientSecret()}`\n ).toString('base64');\n\n await fetch(getRevokeUrl(), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n Authorization: `Basic ${basicAuth}`,\n },\n body: new URLSearchParams({\n token: refreshToken,\n token_type_hint: 'refresh_token',\n }).toString(),\n // A slow/hung Drupal must not freeze logout; cookies still clear below.\n signal: AbortSignal.timeout(2500),\n });\n } catch (error) {\n console.warn('[Logout] token revocation failed (best-effort)', error);\n }\n }\n\n await client.auth.logout();\n\n // Unconditional (ignores draftModeOnLogin): a lingering draft cookie from an\n // earlier config must never survive a logout.\n await disablePersistentDraftMode();\n\n // Drop cached authed chrome (footer, account links, smart-actions) so it\n // doesn't linger on cached/back-navigated routes; redirect() alone won't.\n revalidatePath('/', 'layout');\n\n redirect(options?.redirectTo ?? '/');\n}\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,YAAY;AAC3C,SAASC,QAAQ,QAAQ,iBAAiB;AAG1C,SAASC,0BAA0B,QAAQ,
|
|
1
|
+
{"version":3,"file":"logout.js","names":["revalidatePath","redirect","disablePersistentDraftMode","buildUserClient","getClientId","getClientSecret","getRevokeUrl","performLogout","config","options","client","refreshToken","auth","getRefreshToken","basicAuth","Buffer","from","toString","fetch","method","headers","Authorization","body","URLSearchParams","token","token_type_hint","signal","AbortSignal","timeout","error","console","warn","logout","redirectTo"],"sources":["../../../src/auth/internal/logout.ts"],"sourcesContent":["import { revalidatePath } from 'next/cache';\nimport { redirect } from 'next/navigation';\n\nimport type { NodeHiveAuthConfig } from './config.ts';\nimport { disablePersistentDraftMode } from './draft-mode.ts';\nimport { buildUserClient } from './nodehive-client.ts';\nimport { getClientId, getClientSecret, getRevokeUrl } from './oauth-config.ts';\n\nexport interface PerformLogoutOptions {\n /** Where to send the user after logout. Defaults to '/'. */\n redirectTo?: string;\n}\n\n/**\n * Meant to be wrapped by a project Server Action (not a Route Handler) so Next's\n * built-in CSRF protection (Same-Origin + Action-ID) applies. The Drupal admin\n * session is intentionally left untouched.\n */\nexport async function performLogout(\n config: NodeHiveAuthConfig,\n options?: PerformLogoutOptions\n): Promise<void> {\n const client = buildUserClient(config);\n const refreshToken = await client.auth.getRefreshToken();\n\n // Best-effort revoke so a leaked refresh token dies now, not after its 30-day\n // TTL (also invalidates the bound access tokens). Never blocks logout.\n if (refreshToken) {\n try {\n const basicAuth = Buffer.from(\n `${getClientId()}:${getClientSecret()}`\n ).toString('base64');\n\n await fetch(getRevokeUrl(), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n Authorization: `Basic ${basicAuth}`,\n },\n body: new URLSearchParams({\n token: refreshToken,\n token_type_hint: 'refresh_token',\n }).toString(),\n // A slow/hung Drupal must not freeze logout; cookies still clear below.\n signal: AbortSignal.timeout(2500),\n });\n } catch (error) {\n console.warn('[Logout] token revocation failed (best-effort)', error);\n }\n }\n\n await client.auth.logout();\n\n // Unconditional (ignores draftModeOnLogin): a lingering draft cookie from an\n // earlier config must never survive a logout.\n await disablePersistentDraftMode();\n\n // Drop cached authed chrome (footer, account links, smart-actions) so it\n // doesn't linger on cached/back-navigated routes; redirect() alone won't.\n revalidatePath('/', 'layout');\n\n redirect(options?.redirectTo ?? '/');\n}\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,YAAY;AAC3C,SAASC,QAAQ,QAAQ,iBAAiB;AAG1C,SAASC,0BAA0B,QAAQ,iBAAiB;AAC5D,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,WAAW,EAAEC,eAAe,EAAEC,YAAY,QAAQ,mBAAmB;AAO9E;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,aAAaA,CACjCC,MAA0B,EAC1BC,OAA8B,EACf;EACf,MAAMC,MAAM,GAAGP,eAAe,CAACK,MAAM,CAAC;EACtC,MAAMG,YAAY,GAAG,MAAMD,MAAM,CAACE,IAAI,CAACC,eAAe,CAAC,CAAC;;EAExD;EACA;EACA,IAAIF,YAAY,EAAE;IAChB,IAAI;MACF,MAAMG,SAAS,GAAGC,MAAM,CAACC,IAAI,CAC3B,GAAGZ,WAAW,CAAC,CAAC,IAAIC,eAAe,CAAC,CAAC,EACvC,CAAC,CAACY,QAAQ,CAAC,QAAQ,CAAC;MAEpB,MAAMC,KAAK,CAACZ,YAAY,CAAC,CAAC,EAAE;QAC1Ba,MAAM,EAAE,MAAM;QACdC,OAAO,EAAE;UACP,cAAc,EAAE,mCAAmC;UACnDC,aAAa,EAAE,SAASP,SAAS;QACnC,CAAC;QACDQ,IAAI,EAAE,IAAIC,eAAe,CAAC;UACxBC,KAAK,EAAEb,YAAY;UACnBc,eAAe,EAAE;QACnB,CAAC,CAAC,CAACR,QAAQ,CAAC,CAAC;QACb;QACAS,MAAM,EAAEC,WAAW,CAACC,OAAO,CAAC,IAAI;MAClC,CAAC,CAAC;IACJ,CAAC,CAAC,OAAOC,KAAK,EAAE;MACdC,OAAO,CAACC,IAAI,CAAC,gDAAgD,EAAEF,KAAK,CAAC;IACvE;EACF;EAEA,MAAMnB,MAAM,CAACE,IAAI,CAACoB,MAAM,CAAC,CAAC;;EAE1B;EACA;EACA,MAAM9B,0BAA0B,CAAC,CAAC;;EAElC;EACA;EACAF,cAAc,CAAC,GAAG,EAAE,QAAQ,CAAC;EAE7BC,QAAQ,CAACQ,OAAO,EAAEwB,UAAU,IAAI,GAAG,CAAC;AACtC","ignoreList":[]}
|
|
@@ -14,10 +14,14 @@ export declare const BASE_COOKIE_OPTIONS: {
|
|
|
14
14
|
path: string;
|
|
15
15
|
};
|
|
16
16
|
export declare function appendClearedAuthCookie(response: NextResponse, name: string): void;
|
|
17
|
+
export interface NextCookieStorageOptions {
|
|
18
|
+
preventSdkRefresh?: boolean;
|
|
19
|
+
}
|
|
17
20
|
export declare class NextCookieStorage implements StorageAdapter {
|
|
18
21
|
private request?;
|
|
19
22
|
private response?;
|
|
20
|
-
|
|
23
|
+
private preventSdkRefresh;
|
|
24
|
+
constructor(proxyContext?: ProxyContext, options?: NextCookieStorageOptions);
|
|
21
25
|
static cookieKeys(): CookieKeyMap;
|
|
22
26
|
private resolveKey;
|
|
23
27
|
get(key: string): Promise<string | null>;
|
|
@@ -25,4 +29,3 @@ export declare class NextCookieStorage implements StorageAdapter {
|
|
|
25
29
|
remove(key: string): Promise<void>;
|
|
26
30
|
}
|
|
27
31
|
export {};
|
|
28
|
-
//# sourceMappingURL=next-cookie-storage.d.ts.map
|
|
@@ -24,9 +24,10 @@ export function appendClearedAuthCookie(response, name) {
|
|
|
24
24
|
response.headers.append('set-cookie', `${base}; Partitioned`);
|
|
25
25
|
}
|
|
26
26
|
export class NextCookieStorage {
|
|
27
|
-
constructor(proxyContext) {
|
|
27
|
+
constructor(proxyContext, options) {
|
|
28
28
|
this.request = proxyContext?.request;
|
|
29
29
|
this.response = proxyContext?.response;
|
|
30
|
+
this.preventSdkRefresh = options?.preventSdkRefresh ?? false;
|
|
30
31
|
}
|
|
31
32
|
static cookieKeys() {
|
|
32
33
|
const spacePrefix = process.env.NEXT_PUBLIC_NODEHIVE_SPACE_NAME || 'nodehive';
|
|
@@ -47,6 +48,12 @@ export class NextCookieStorage {
|
|
|
47
48
|
async get(key) {
|
|
48
49
|
const name = this.resolveKey(key);
|
|
49
50
|
if (!name) return null;
|
|
51
|
+
|
|
52
|
+
// Hide the refresh token from the SDK's 401 auto-refresh in write-incapable
|
|
53
|
+
// contexts (RSC render): reading null makes refreshToken() throw before it
|
|
54
|
+
// hits the token endpoint, so the single-use refresh token is never rotated
|
|
55
|
+
// and only the proxy performs the authoritative refresh.
|
|
56
|
+
if (this.preventSdkRefresh && key === 'refresh_token') return null;
|
|
50
57
|
if (this.request) {
|
|
51
58
|
return this.request.cookies.get(name)?.value || null;
|
|
52
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-cookie-storage.js","names":["cookies","BASE_COOKIE_OPTIONS","httpOnly","sameSite","secure","partitioned","path","appendClearedAuthCookie","response","name","o","charAt","toUpperCase","slice","base","headers","append","NextCookieStorage","constructor","proxyContext","request","cookieKeys","spacePrefix","process","env","NEXT_PUBLIC_NODEHIVE_SPACE_NAME","token","refresh_token","user_details","token_expires_at","oauth_state","pkce_verifier","return_to","redirect_uri","resolveKey","key","get","value","cookieStore","set","
|
|
1
|
+
{"version":3,"file":"next-cookie-storage.js","names":["cookies","BASE_COOKIE_OPTIONS","httpOnly","sameSite","secure","partitioned","path","appendClearedAuthCookie","response","name","o","charAt","toUpperCase","slice","base","headers","append","NextCookieStorage","constructor","proxyContext","options","request","preventSdkRefresh","cookieKeys","spacePrefix","process","env","NEXT_PUBLIC_NODEHIVE_SPACE_NAME","token","refresh_token","user_details","token_expires_at","oauth_state","pkce_verifier","return_to","redirect_uri","resolveKey","key","get","value","cookieStore","set","maxAge","toLowerCase","remove","delete"],"sources":["../../../src/auth/internal/next-cookie-storage.ts"],"sourcesContent":["import { cookies } from 'next/headers';\nimport type { NextRequest, NextResponse } from 'next/server';\nimport type { CookieOptions, StorageAdapter } from 'nodehive-js';\n\ntype CookieKey =\n | 'token'\n | 'refresh_token'\n | 'user_details'\n | 'token_expires_at'\n // Short-lived (10 min) transactional cookies for the Authorization Code flow.\n | 'oauth_state'\n | 'pkce_verifier'\n | 'return_to'\n | 'redirect_uri';\n\ntype CookieKeyMap = Record<CookieKey, string>;\n\nexport interface ProxyContext {\n request: NextRequest;\n response: NextResponse;\n}\n\n// SameSite=None reaches the cross-site editor iframe (CSRF restored by the\n// Sec-Fetch-Site guard in proxy.ts); Partitioned (CHIPS) keeps it usable in\n// privacy browsers without a storage-access gesture.\nexport const BASE_COOKIE_OPTIONS = {\n httpOnly: true,\n sameSite: 'none' as const,\n secure: true,\n partitioned: true,\n path: '/',\n};\n\n// Expire both the partitioned and the legacy unpartitioned variant — a same-named\n// cookie can exist in each partition, and the stale one would resend a consumed token.\n// Attributes are derived from BASE_COOKIE_OPTIONS so the deletion keeps matching\n// if those change. NOTE: this appends raw Set-Cookie headers — do not also call\n// response.cookies.set() for an auth cookie on the same response, or Next's\n// ResponseCookies.replace() will drop these headers.\nexport function appendClearedAuthCookie(\n response: NextResponse,\n name: string\n): void {\n const o = BASE_COOKIE_OPTIONS;\n const sameSite = o.sameSite.charAt(0).toUpperCase() + o.sameSite.slice(1);\n const base =\n `${name}=; Path=${o.path}; Max-Age=0; SameSite=${sameSite}` +\n (o.httpOnly ? '; HttpOnly' : '') +\n (o.secure ? '; Secure' : '');\n response.headers.append('set-cookie', base);\n response.headers.append('set-cookie', `${base}; Partitioned`);\n}\n\nexport interface NextCookieStorageOptions {\n preventSdkRefresh?: boolean;\n}\n\nexport class NextCookieStorage implements StorageAdapter {\n private request?: NextRequest;\n private response?: NextResponse;\n private preventSdkRefresh: boolean;\n\n constructor(proxyContext?: ProxyContext, options?: NextCookieStorageOptions) {\n this.request = proxyContext?.request;\n this.response = proxyContext?.response;\n this.preventSdkRefresh = options?.preventSdkRefresh ?? false;\n }\n\n static cookieKeys(): CookieKeyMap {\n const spacePrefix =\n process.env.NEXT_PUBLIC_NODEHIVE_SPACE_NAME || 'nodehive';\n return {\n token: `${spacePrefix}_token`,\n refresh_token: `${spacePrefix}_refresh_token`,\n user_details: `${spacePrefix}_user_details`,\n token_expires_at: `${spacePrefix}_token_expires_at`,\n oauth_state: `${spacePrefix}_oauth_state`,\n pkce_verifier: `${spacePrefix}_pkce_verifier`,\n return_to: `${spacePrefix}_return_to`,\n redirect_uri: `${spacePrefix}_redirect_uri`,\n };\n }\n\n private resolveKey(key: string): string | null {\n return NextCookieStorage.cookieKeys()[key as CookieKey] ?? null;\n }\n\n async get(key: string): Promise<string | null> {\n const name = this.resolveKey(key);\n if (!name) return null;\n\n // Hide the refresh token from the SDK's 401 auto-refresh in write-incapable\n // contexts (RSC render): reading null makes refreshToken() throw before it\n // hits the token endpoint, so the single-use refresh token is never rotated\n // and only the proxy performs the authoritative refresh.\n if (this.preventSdkRefresh && key === 'refresh_token') return null;\n\n if (this.request) {\n return this.request.cookies.get(name)?.value || null;\n }\n\n const cookieStore = await cookies();\n return cookieStore.get(name)?.value || null;\n }\n\n async set(\n key: string,\n value: string,\n options?: CookieOptions\n ): Promise<void> {\n const name = this.resolveKey(key);\n if (!name) return;\n\n if (this.request && this.response) {\n // Proxy context: set on request (for server components) and response (for browser)\n this.request.cookies.set(name, value);\n this.response.cookies.set(name, value, {\n ...BASE_COOKIE_OPTIONS,\n maxAge: options?.maxAge,\n });\n return;\n }\n\n // Server component / server action context\n const cookieStore = await cookies();\n cookieStore.set({\n name,\n value,\n maxAge: options?.maxAge,\n httpOnly: options?.httpOnly ?? BASE_COOKIE_OPTIONS.httpOnly,\n sameSite:\n (options?.sameSite?.toLowerCase() as 'lax' | 'strict' | 'none') ??\n BASE_COOKIE_OPTIONS.sameSite,\n secure: options?.secure ?? BASE_COOKIE_OPTIONS.secure,\n partitioned: BASE_COOKIE_OPTIONS.partitioned,\n path: options?.path ?? BASE_COOKIE_OPTIONS.path,\n });\n }\n\n async remove(key: string): Promise<void> {\n const name = this.resolveKey(key);\n if (!name) return;\n\n if (this.request && this.response) {\n this.request.cookies.delete(name);\n appendClearedAuthCookie(this.response, name);\n return;\n }\n\n // Server-action context (logout): Next's ResponseCookies is keyed by name,\n // so we can only emit ONE Set-Cookie per cookie — we clear the current\n // partitioned variant. A pre-migration unpartitioned cookie can't be cleared\n // here, but logout revokes the token at the IdP (performLogout) and the\n // proxy's auth-failure path dual-clears it on the next request.\n const cookieStore = await cookies();\n cookieStore.set(name, '', { ...BASE_COOKIE_OPTIONS, maxAge: 0 });\n }\n}\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,cAAc;AAsBtC;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAG;EACjCC,QAAQ,EAAE,IAAI;EACdC,QAAQ,EAAE,MAAe;EACzBC,MAAM,EAAE,IAAI;EACZC,WAAW,EAAE,IAAI;EACjBC,IAAI,EAAE;AACR,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CACrCC,QAAsB,EACtBC,IAAY,EACN;EACN,MAAMC,CAAC,GAAGT,mBAAmB;EAC7B,MAAME,QAAQ,GAAGO,CAAC,CAACP,QAAQ,CAACQ,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,GAAGF,CAAC,CAACP,QAAQ,CAACU,KAAK,CAAC,CAAC,CAAC;EACzE,MAAMC,IAAI,GACR,GAAGL,IAAI,WAAWC,CAAC,CAACJ,IAAI,yBAAyBH,QAAQ,EAAE,IAC1DO,CAAC,CAACR,QAAQ,GAAG,YAAY,GAAG,EAAE,CAAC,IAC/BQ,CAAC,CAACN,MAAM,GAAG,UAAU,GAAG,EAAE,CAAC;EAC9BI,QAAQ,CAACO,OAAO,CAACC,MAAM,CAAC,YAAY,EAAEF,IAAI,CAAC;EAC3CN,QAAQ,CAACO,OAAO,CAACC,MAAM,CAAC,YAAY,EAAE,GAAGF,IAAI,eAAe,CAAC;AAC/D;AAMA,OAAO,MAAMG,iBAAiB,CAA2B;EAKvDC,WAAWA,CAACC,YAA2B,EAAEC,OAAkC,EAAE;IAC3E,IAAI,CAACC,OAAO,GAAGF,YAAY,EAAEE,OAAO;IACpC,IAAI,CAACb,QAAQ,GAAGW,YAAY,EAAEX,QAAQ;IACtC,IAAI,CAACc,iBAAiB,GAAGF,OAAO,EAAEE,iBAAiB,IAAI,KAAK;EAC9D;EAEA,OAAOC,UAAUA,CAAA,EAAiB;IAChC,MAAMC,WAAW,GACfC,OAAO,CAACC,GAAG,CAACC,+BAA+B,IAAI,UAAU;IAC3D,OAAO;MACLC,KAAK,EAAE,GAAGJ,WAAW,QAAQ;MAC7BK,aAAa,EAAE,GAAGL,WAAW,gBAAgB;MAC7CM,YAAY,EAAE,GAAGN,WAAW,eAAe;MAC3CO,gBAAgB,EAAE,GAAGP,WAAW,mBAAmB;MACnDQ,WAAW,EAAE,GAAGR,WAAW,cAAc;MACzCS,aAAa,EAAE,GAAGT,WAAW,gBAAgB;MAC7CU,SAAS,EAAE,GAAGV,WAAW,YAAY;MACrCW,YAAY,EAAE,GAAGX,WAAW;IAC9B,CAAC;EACH;EAEQY,UAAUA,CAACC,GAAW,EAAiB;IAC7C,OAAOpB,iBAAiB,CAACM,UAAU,CAAC,CAAC,CAACc,GAAG,CAAc,IAAI,IAAI;EACjE;EAEA,MAAMC,GAAGA,CAACD,GAAW,EAA0B;IAC7C,MAAM5B,IAAI,GAAG,IAAI,CAAC2B,UAAU,CAACC,GAAG,CAAC;IACjC,IAAI,CAAC5B,IAAI,EAAE,OAAO,IAAI;;IAEtB;IACA;IACA;IACA;IACA,IAAI,IAAI,CAACa,iBAAiB,IAAIe,GAAG,KAAK,eAAe,EAAE,OAAO,IAAI;IAElE,IAAI,IAAI,CAAChB,OAAO,EAAE;MAChB,OAAO,IAAI,CAACA,OAAO,CAACrB,OAAO,CAACsC,GAAG,CAAC7B,IAAI,CAAC,EAAE8B,KAAK,IAAI,IAAI;IACtD;IAEA,MAAMC,WAAW,GAAG,MAAMxC,OAAO,CAAC,CAAC;IACnC,OAAOwC,WAAW,CAACF,GAAG,CAAC7B,IAAI,CAAC,EAAE8B,KAAK,IAAI,IAAI;EAC7C;EAEA,MAAME,GAAGA,CACPJ,GAAW,EACXE,KAAa,EACbnB,OAAuB,EACR;IACf,MAAMX,IAAI,GAAG,IAAI,CAAC2B,UAAU,CAACC,GAAG,CAAC;IACjC,IAAI,CAAC5B,IAAI,EAAE;IAEX,IAAI,IAAI,CAACY,OAAO,IAAI,IAAI,CAACb,QAAQ,EAAE;MACjC;MACA,IAAI,CAACa,OAAO,CAACrB,OAAO,CAACyC,GAAG,CAAChC,IAAI,EAAE8B,KAAK,CAAC;MACrC,IAAI,CAAC/B,QAAQ,CAACR,OAAO,CAACyC,GAAG,CAAChC,IAAI,EAAE8B,KAAK,EAAE;QACrC,GAAGtC,mBAAmB;QACtByC,MAAM,EAAEtB,OAAO,EAAEsB;MACnB,CAAC,CAAC;MACF;IACF;;IAEA;IACA,MAAMF,WAAW,GAAG,MAAMxC,OAAO,CAAC,CAAC;IACnCwC,WAAW,CAACC,GAAG,CAAC;MACdhC,IAAI;MACJ8B,KAAK;MACLG,MAAM,EAAEtB,OAAO,EAAEsB,MAAM;MACvBxC,QAAQ,EAAEkB,OAAO,EAAElB,QAAQ,IAAID,mBAAmB,CAACC,QAAQ;MAC3DC,QAAQ,EACLiB,OAAO,EAAEjB,QAAQ,EAAEwC,WAAW,CAAC,CAAC,IACjC1C,mBAAmB,CAACE,QAAQ;MAC9BC,MAAM,EAAEgB,OAAO,EAAEhB,MAAM,IAAIH,mBAAmB,CAACG,MAAM;MACrDC,WAAW,EAAEJ,mBAAmB,CAACI,WAAW;MAC5CC,IAAI,EAAEc,OAAO,EAAEd,IAAI,IAAIL,mBAAmB,CAACK;IAC7C,CAAC,CAAC;EACJ;EAEA,MAAMsC,MAAMA,CAACP,GAAW,EAAiB;IACvC,MAAM5B,IAAI,GAAG,IAAI,CAAC2B,UAAU,CAACC,GAAG,CAAC;IACjC,IAAI,CAAC5B,IAAI,EAAE;IAEX,IAAI,IAAI,CAACY,OAAO,IAAI,IAAI,CAACb,QAAQ,EAAE;MACjC,IAAI,CAACa,OAAO,CAACrB,OAAO,CAAC6C,MAAM,CAACpC,IAAI,CAAC;MACjCF,uBAAuB,CAAC,IAAI,CAACC,QAAQ,EAAEC,IAAI,CAAC;MAC5C;IACF;;IAEA;IACA;IACA;IACA;IACA;IACA,MAAM+B,WAAW,GAAG,MAAMxC,OAAO,CAAC,CAAC;IACnCwC,WAAW,CAACC,GAAG,CAAChC,IAAI,EAAE,EAAE,EAAE;MAAE,GAAGR,mBAAmB;MAAEyC,MAAM,EAAE;IAAE,CAAC,CAAC;EAClE;AACF","ignoreList":[]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { NodeHiveClient } from 'nodehive-js';
|
|
2
|
-
import type { NodeHiveAuthConfig } from './config';
|
|
3
|
-
import { type ProxyContext } from './next-cookie-storage';
|
|
4
|
-
export
|
|
2
|
+
import type { NodeHiveAuthConfig } from './config.js';
|
|
3
|
+
import { type ProxyContext } from './next-cookie-storage.js';
|
|
4
|
+
export interface BuildUserClientOptions {
|
|
5
|
+
preventSdkRefresh?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function buildUserClient(config: NodeHiveAuthConfig, proxyContext?: ProxyContext, options?: BuildUserClientOptions): NodeHiveClient;
|
|
5
8
|
export declare function buildAnonClient(config: NodeHiveAuthConfig): NodeHiveClient;
|
|
6
|
-
//# sourceMappingURL=nodehive-client.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NodeHiveClient } from 'nodehive-js';
|
|
2
|
-
import { NextCookieStorage } from
|
|
3
|
-
import { getClientId, getClientSecret, getTokenUrl, REFRESH_TOKEN_MAX_AGE } from
|
|
2
|
+
import { NextCookieStorage } from "./next-cookie-storage.js";
|
|
3
|
+
import { getClientId, getClientSecret, getTokenUrl, REFRESH_TOKEN_MAX_AGE } from "./oauth-config.js";
|
|
4
4
|
|
|
5
5
|
// Resolve the SDK base options once per config object. Env is read lazily (on
|
|
6
6
|
// first use per runtime instance, not at module load) and then memoized: the
|
|
@@ -19,8 +19,10 @@ function baseOptions(config) {
|
|
|
19
19
|
baseOptionsCache.set(config, options);
|
|
20
20
|
return options;
|
|
21
21
|
}
|
|
22
|
-
export function buildUserClient(config, proxyContext) {
|
|
23
|
-
const storage = new NextCookieStorage(proxyContext
|
|
22
|
+
export function buildUserClient(config, proxyContext, options) {
|
|
23
|
+
const storage = new NextCookieStorage(proxyContext, {
|
|
24
|
+
preventSdkRefresh: options?.preventSdkRefresh
|
|
25
|
+
});
|
|
24
26
|
const userOauthConfig = {
|
|
25
27
|
grantType: 'authorization_code',
|
|
26
28
|
clientId: getClientId(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodehive-client.js","names":["NodeHiveClient","NextCookieStorage","getClientId","getClientSecret","getTokenUrl","REFRESH_TOKEN_MAX_AGE","baseOptionsCache","WeakMap","baseOptions","config","cached","get","options","baseUrl","process","env","NEXT_PUBLIC_DRUPAL_REST_BASE_URL","debug","NODEHIVE_DEBUG","jsonapiConfig","multilingual","set","buildUserClient","proxyContext","storage","userOauthConfig","grantType","clientId","clientSecret","tokenUrl","base","userClient","auth","method","oauth","type","adapter","session","refreshTokenMaxAge","console","log","buildAnonClient","anonClient","NODEHIVE_OAUTH_ANON_CLIENT_ID","NODEHIVE_OAUTH_ANON_CLIENT_SECRET"],"sources":["../../../src/auth/internal/nodehive-client.ts"],"sourcesContent":["import { NodeHiveClient } from 'nodehive-js';\n\nimport type { NodeHiveAuthConfig } from './config';\nimport { NextCookieStorage, type ProxyContext } from './next-cookie-storage';\nimport {\n getClientId,\n getClientSecret,\n getTokenUrl,\n REFRESH_TOKEN_MAX_AGE,\n} from './oauth-config';\n\n// Resolve the SDK base options once per config object. Env is read lazily (on\n// first use per runtime instance, not at module load) and then memoized: the\n// proxy refresh path builds a client on nearly every request, so we avoid\n// re-reading env + re-allocating the options object each time.\nconst baseOptionsCache = new WeakMap<\n NodeHiveAuthConfig,\n {\n baseUrl: string;\n debug: boolean;\n config: NodeHiveAuthConfig['jsonapiConfig'];\n multilingual: boolean;\n }\n>();\n\nfunction baseOptions(config: NodeHiveAuthConfig) {\n const cached = baseOptionsCache.get(config);\n if (cached) return cached;\n const options = {\n baseUrl: process.env.NEXT_PUBLIC_DRUPAL_REST_BASE_URL || '',\n debug: process.env.NODEHIVE_DEBUG === 'true',\n config: config.jsonapiConfig,\n multilingual: config.multilingual,\n };\n baseOptionsCache.set(config, options);\n return options;\n}\n\nexport function buildUserClient(\n config: NodeHiveAuthConfig,\n proxyContext?: ProxyContext\n): NodeHiveClient {\n const storage = new NextCookieStorage(proxyContext);\n const userOauthConfig = {\n grantType: 'authorization_code' as const,\n clientId: getClientId(),\n clientSecret: getClientSecret(),\n tokenUrl: getTokenUrl(),\n };\n\n const base = baseOptions(config);\n const userClient = new NodeHiveClient({\n ...base,\n auth: {\n method: 'oauth',\n oauth: userOauthConfig,\n storage: {\n type: 'custom',\n adapter: storage,\n },\n session: {\n refreshTokenMaxAge: REFRESH_TOKEN_MAX_AGE,\n },\n },\n });\n if (base.debug) console.log('Created user client');\n return userClient;\n}\n\nexport function buildAnonClient(config: NodeHiveAuthConfig): NodeHiveClient {\n const base = baseOptions(config);\n const anonClient = new NodeHiveClient({\n ...base,\n auth: {\n method: 'oauth',\n oauth: {\n grantType: 'client_credentials',\n clientId: process.env.NODEHIVE_OAUTH_ANON_CLIENT_ID || '',\n clientSecret: process.env.NODEHIVE_OAUTH_ANON_CLIENT_SECRET || '',\n },\n },\n });\n if (base.debug) console.log('Created anon client');\n return anonClient;\n}\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,aAAa;AAG5C,SAASC,iBAAiB,QAA2B,
|
|
1
|
+
{"version":3,"file":"nodehive-client.js","names":["NodeHiveClient","NextCookieStorage","getClientId","getClientSecret","getTokenUrl","REFRESH_TOKEN_MAX_AGE","baseOptionsCache","WeakMap","baseOptions","config","cached","get","options","baseUrl","process","env","NEXT_PUBLIC_DRUPAL_REST_BASE_URL","debug","NODEHIVE_DEBUG","jsonapiConfig","multilingual","set","buildUserClient","proxyContext","storage","preventSdkRefresh","userOauthConfig","grantType","clientId","clientSecret","tokenUrl","base","userClient","auth","method","oauth","type","adapter","session","refreshTokenMaxAge","console","log","buildAnonClient","anonClient","NODEHIVE_OAUTH_ANON_CLIENT_ID","NODEHIVE_OAUTH_ANON_CLIENT_SECRET"],"sources":["../../../src/auth/internal/nodehive-client.ts"],"sourcesContent":["import { NodeHiveClient } from 'nodehive-js';\n\nimport type { NodeHiveAuthConfig } from './config.ts';\nimport { NextCookieStorage, type ProxyContext } from './next-cookie-storage.ts';\nimport {\n getClientId,\n getClientSecret,\n getTokenUrl,\n REFRESH_TOKEN_MAX_AGE,\n} from './oauth-config.ts';\n\n// Resolve the SDK base options once per config object. Env is read lazily (on\n// first use per runtime instance, not at module load) and then memoized: the\n// proxy refresh path builds a client on nearly every request, so we avoid\n// re-reading env + re-allocating the options object each time.\nconst baseOptionsCache = new WeakMap<\n NodeHiveAuthConfig,\n {\n baseUrl: string;\n debug: boolean;\n config: NodeHiveAuthConfig['jsonapiConfig'];\n multilingual: boolean;\n }\n>();\n\nfunction baseOptions(config: NodeHiveAuthConfig) {\n const cached = baseOptionsCache.get(config);\n if (cached) return cached;\n const options = {\n baseUrl: process.env.NEXT_PUBLIC_DRUPAL_REST_BASE_URL || '',\n debug: process.env.NODEHIVE_DEBUG === 'true',\n config: config.jsonapiConfig,\n multilingual: config.multilingual,\n };\n baseOptionsCache.set(config, options);\n return options;\n}\n\nexport interface BuildUserClientOptions {\n preventSdkRefresh?: boolean;\n}\n\nexport function buildUserClient(\n config: NodeHiveAuthConfig,\n proxyContext?: ProxyContext,\n options?: BuildUserClientOptions\n): NodeHiveClient {\n const storage = new NextCookieStorage(proxyContext, {\n preventSdkRefresh: options?.preventSdkRefresh,\n });\n const userOauthConfig = {\n grantType: 'authorization_code' as const,\n clientId: getClientId(),\n clientSecret: getClientSecret(),\n tokenUrl: getTokenUrl(),\n };\n\n const base = baseOptions(config);\n const userClient = new NodeHiveClient({\n ...base,\n auth: {\n method: 'oauth',\n oauth: userOauthConfig,\n storage: {\n type: 'custom',\n adapter: storage,\n },\n session: {\n refreshTokenMaxAge: REFRESH_TOKEN_MAX_AGE,\n },\n },\n });\n if (base.debug) console.log('Created user client');\n return userClient;\n}\n\nexport function buildAnonClient(config: NodeHiveAuthConfig): NodeHiveClient {\n const base = baseOptions(config);\n const anonClient = new NodeHiveClient({\n ...base,\n auth: {\n method: 'oauth',\n oauth: {\n grantType: 'client_credentials',\n clientId: process.env.NODEHIVE_OAUTH_ANON_CLIENT_ID || '',\n clientSecret: process.env.NODEHIVE_OAUTH_ANON_CLIENT_SECRET || '',\n },\n },\n });\n if (base.debug) console.log('Created anon client');\n return anonClient;\n}\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,aAAa;AAG5C,SAASC,iBAAiB,QAA2B,0BAA0B;AAC/E,SACEC,WAAW,EACXC,eAAe,EACfC,WAAW,EACXC,qBAAqB,QAChB,mBAAmB;;AAE1B;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,IAAIC,OAAO,CAQlC,CAAC;AAEH,SAASC,WAAWA,CAACC,MAA0B,EAAE;EAC/C,MAAMC,MAAM,GAAGJ,gBAAgB,CAACK,GAAG,CAACF,MAAM,CAAC;EAC3C,IAAIC,MAAM,EAAE,OAAOA,MAAM;EACzB,MAAME,OAAO,GAAG;IACdC,OAAO,EAAEC,OAAO,CAACC,GAAG,CAACC,gCAAgC,IAAI,EAAE;IAC3DC,KAAK,EAAEH,OAAO,CAACC,GAAG,CAACG,cAAc,KAAK,MAAM;IAC5CT,MAAM,EAAEA,MAAM,CAACU,aAAa;IAC5BC,YAAY,EAAEX,MAAM,CAACW;EACvB,CAAC;EACDd,gBAAgB,CAACe,GAAG,CAACZ,MAAM,EAAEG,OAAO,CAAC;EACrC,OAAOA,OAAO;AAChB;AAMA,OAAO,SAASU,eAAeA,CAC7Bb,MAA0B,EAC1Bc,YAA2B,EAC3BX,OAAgC,EAChB;EAChB,MAAMY,OAAO,GAAG,IAAIvB,iBAAiB,CAACsB,YAAY,EAAE;IAClDE,iBAAiB,EAAEb,OAAO,EAAEa;EAC9B,CAAC,CAAC;EACF,MAAMC,eAAe,GAAG;IACtBC,SAAS,EAAE,oBAA6B;IACxCC,QAAQ,EAAE1B,WAAW,CAAC,CAAC;IACvB2B,YAAY,EAAE1B,eAAe,CAAC,CAAC;IAC/B2B,QAAQ,EAAE1B,WAAW,CAAC;EACxB,CAAC;EAED,MAAM2B,IAAI,GAAGvB,WAAW,CAACC,MAAM,CAAC;EAChC,MAAMuB,UAAU,GAAG,IAAIhC,cAAc,CAAC;IACpC,GAAG+B,IAAI;IACPE,IAAI,EAAE;MACJC,MAAM,EAAE,OAAO;MACfC,KAAK,EAAET,eAAe;MACtBF,OAAO,EAAE;QACPY,IAAI,EAAE,QAAQ;QACdC,OAAO,EAAEb;MACX,CAAC;MACDc,OAAO,EAAE;QACPC,kBAAkB,EAAElC;MACtB;IACF;EACF,CAAC,CAAC;EACF,IAAI0B,IAAI,CAACd,KAAK,EAAEuB,OAAO,CAACC,GAAG,CAAC,qBAAqB,CAAC;EAClD,OAAOT,UAAU;AACnB;AAEA,OAAO,SAASU,eAAeA,CAACjC,MAA0B,EAAkB;EAC1E,MAAMsB,IAAI,GAAGvB,WAAW,CAACC,MAAM,CAAC;EAChC,MAAMkC,UAAU,GAAG,IAAI3C,cAAc,CAAC;IACpC,GAAG+B,IAAI;IACPE,IAAI,EAAE;MACJC,MAAM,EAAE,OAAO;MACfC,KAAK,EAAE;QACLR,SAAS,EAAE,oBAAoB;QAC/BC,QAAQ,EAAEd,OAAO,CAACC,GAAG,CAAC6B,6BAA6B,IAAI,EAAE;QACzDf,YAAY,EAAEf,OAAO,CAACC,GAAG,CAAC8B,iCAAiC,IAAI;MACjE;IACF;EACF,CAAC,CAAC;EACF,IAAId,IAAI,CAACd,KAAK,EAAEuB,OAAO,CAACC,GAAG,CAAC,qBAAqB,CAAC;EAClD,OAAOE,UAAU;AACnB","ignoreList":[]}
|
|
@@ -12,4 +12,3 @@ export declare function csrfGuard(request: NextRequest, isApi: boolean): NextRes
|
|
|
12
12
|
* to the login entry point, preserving where the user was.
|
|
13
13
|
*/
|
|
14
14
|
export declare function authFailedResponse(request: NextRequest, isApi: boolean, loginPath?: string): NextResponse;
|
|
15
|
-
//# sourceMappingURL=proxy-helpers.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { NextResponse } from 'next/server';
|
|
2
|
-
import { getRequestOrigin } from
|
|
3
|
-
import { clearAuthCookies } from
|
|
4
|
-
import { validateReturnTo } from
|
|
5
|
-
import { isSameOriginRequest } from
|
|
2
|
+
import { getRequestOrigin } from "./oauth-config.js";
|
|
3
|
+
import { clearAuthCookies } from "./refresh.js";
|
|
4
|
+
import { validateReturnTo } from "./return-to.js";
|
|
5
|
+
import { isSameOriginRequest } from "./same-origin.js";
|
|
6
6
|
const MUTATING_METHODS = new Set(['POST', 'PUT', 'PATCH', 'DELETE']);
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy-helpers.js","names":["NextResponse","getRequestOrigin","clearAuthCookies","validateReturnTo","isSameOriginRequest","MUTATING_METHODS","Set","csrfGuard","request","isApi","has","method","status","authFailedResponse","loginPath","res","returnTo","nextUrl","pathname","search","loginUrl","URL","searchParams","set","redirect"],"sources":["../../../src/auth/internal/proxy-helpers.ts"],"sourcesContent":["import { NextResponse, type NextRequest } from 'next/server';\n\nimport { getRequestOrigin } from './oauth-config';\nimport { clearAuthCookies } from './refresh';\nimport { validateReturnTo } from './return-to';\nimport { isSameOriginRequest } from './same-origin';\n\nconst MUTATING_METHODS = new Set(['POST', 'PUT', 'PATCH', 'DELETE']);\n\n/**\n * CSRF defense for the SameSite=None auth cookies: a cross-site page can send the\n * editor's cookies on a mutating /api request, so require Sec-Fetch-Site:\n * same-origin (a cross-site browser cannot forge it). Returns a 403 to return\n * from the middleware, or null to continue.\n */\nexport function csrfGuard(\n request: NextRequest,\n isApi: boolean\n): NextResponse | null {\n if (\n isApi &&\n MUTATING_METHODS.has(request.method) &&\n !isSameOriginRequest(request)\n ) {\n return new NextResponse('Forbidden', { status: 403 });\n }\n return null;\n}\n\n/**\n * Response for an invalid/expired session (clears cookies): a 401 for /api\n * callers — a fetch needs a status, not an HTML redirect — otherwise a redirect\n * to the login entry point, preserving where the user was.\n */\nexport function authFailedResponse(\n request: NextRequest,\n isApi: boolean,\n loginPath = '/api/auth/login'\n): NextResponse {\n if (isApi) {\n const res = new NextResponse('Unauthorized', { status: 401 });\n clearAuthCookies(request, res);\n return res;\n }\n\n const returnTo = validateReturnTo(\n `${request.nextUrl.pathname}${request.nextUrl.search}`\n );\n const loginUrl = new URL(loginPath, getRequestOrigin(request));\n loginUrl.searchParams.set('returnTo', returnTo);\n const res = NextResponse.redirect(loginUrl);\n clearAuthCookies(request, res);\n return res;\n}\n"],"mappings":"AAAA,SAASA,YAAY,QAA0B,aAAa;AAE5D,SAASC,gBAAgB,QAAQ,
|
|
1
|
+
{"version":3,"file":"proxy-helpers.js","names":["NextResponse","getRequestOrigin","clearAuthCookies","validateReturnTo","isSameOriginRequest","MUTATING_METHODS","Set","csrfGuard","request","isApi","has","method","status","authFailedResponse","loginPath","res","returnTo","nextUrl","pathname","search","loginUrl","URL","searchParams","set","redirect"],"sources":["../../../src/auth/internal/proxy-helpers.ts"],"sourcesContent":["import { NextResponse, type NextRequest } from 'next/server';\n\nimport { getRequestOrigin } from './oauth-config.ts';\nimport { clearAuthCookies } from './refresh.ts';\nimport { validateReturnTo } from './return-to.ts';\nimport { isSameOriginRequest } from './same-origin.ts';\n\nconst MUTATING_METHODS = new Set(['POST', 'PUT', 'PATCH', 'DELETE']);\n\n/**\n * CSRF defense for the SameSite=None auth cookies: a cross-site page can send the\n * editor's cookies on a mutating /api request, so require Sec-Fetch-Site:\n * same-origin (a cross-site browser cannot forge it). Returns a 403 to return\n * from the middleware, or null to continue.\n */\nexport function csrfGuard(\n request: NextRequest,\n isApi: boolean\n): NextResponse | null {\n if (\n isApi &&\n MUTATING_METHODS.has(request.method) &&\n !isSameOriginRequest(request)\n ) {\n return new NextResponse('Forbidden', { status: 403 });\n }\n return null;\n}\n\n/**\n * Response for an invalid/expired session (clears cookies): a 401 for /api\n * callers — a fetch needs a status, not an HTML redirect — otherwise a redirect\n * to the login entry point, preserving where the user was.\n */\nexport function authFailedResponse(\n request: NextRequest,\n isApi: boolean,\n loginPath = '/api/auth/login'\n): NextResponse {\n if (isApi) {\n const res = new NextResponse('Unauthorized', { status: 401 });\n clearAuthCookies(request, res);\n return res;\n }\n\n const returnTo = validateReturnTo(\n `${request.nextUrl.pathname}${request.nextUrl.search}`\n );\n const loginUrl = new URL(loginPath, getRequestOrigin(request));\n loginUrl.searchParams.set('returnTo', returnTo);\n const res = NextResponse.redirect(loginUrl);\n clearAuthCookies(request, res);\n return res;\n}\n"],"mappings":"AAAA,SAASA,YAAY,QAA0B,aAAa;AAE5D,SAASC,gBAAgB,QAAQ,mBAAmB;AACpD,SAASC,gBAAgB,QAAQ,cAAc;AAC/C,SAASC,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,mBAAmB,QAAQ,kBAAkB;AAEtD,MAAMC,gBAAgB,GAAG,IAAIC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CACvBC,OAAoB,EACpBC,KAAc,EACO;EACrB,IACEA,KAAK,IACLJ,gBAAgB,CAACK,GAAG,CAACF,OAAO,CAACG,MAAM,CAAC,IACpC,CAACP,mBAAmB,CAACI,OAAO,CAAC,EAC7B;IACA,OAAO,IAAIR,YAAY,CAAC,WAAW,EAAE;MAAEY,MAAM,EAAE;IAAI,CAAC,CAAC;EACvD;EACA,OAAO,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAChCL,OAAoB,EACpBC,KAAc,EACdK,SAAS,GAAG,iBAAiB,EACf;EACd,IAAIL,KAAK,EAAE;IACT,MAAMM,GAAG,GAAG,IAAIf,YAAY,CAAC,cAAc,EAAE;MAAEY,MAAM,EAAE;IAAI,CAAC,CAAC;IAC7DV,gBAAgB,CAACM,OAAO,EAAEO,GAAG,CAAC;IAC9B,OAAOA,GAAG;EACZ;EAEA,MAAMC,QAAQ,GAAGb,gBAAgB,CAC/B,GAAGK,OAAO,CAACS,OAAO,CAACC,QAAQ,GAAGV,OAAO,CAACS,OAAO,CAACE,MAAM,EACtD,CAAC;EACD,MAAMC,QAAQ,GAAG,IAAIC,GAAG,CAACP,SAAS,EAAEb,gBAAgB,CAACO,OAAO,CAAC,CAAC;EAC9DY,QAAQ,CAACE,YAAY,CAACC,GAAG,CAAC,UAAU,EAAEP,QAAQ,CAAC;EAC/C,MAAMD,GAAG,GAAGf,YAAY,CAACwB,QAAQ,CAACJ,QAAQ,CAAC;EAC3ClB,gBAAgB,CAACM,OAAO,EAAEO,GAAG,CAAC;EAC9B,OAAOA,GAAG;AACZ","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NextRequest, NextResponse } from 'next/server';
|
|
2
|
-
import type { NodeHiveAuthConfig } from './config';
|
|
2
|
+
import type { NodeHiveAuthConfig } from './config.js';
|
|
3
3
|
export declare function setRefreshDeadlineMsForTesting(ms: number): void;
|
|
4
4
|
export declare function shouldRefreshSession(request: NextRequest): boolean;
|
|
5
5
|
/**
|
|
@@ -10,4 +10,3 @@ export declare function shouldRefreshSession(request: NextRequest): boolean;
|
|
|
10
10
|
export declare function refreshSession(request: NextRequest, response: NextResponse, config: NodeHiveAuthConfig): Promise<void>;
|
|
11
11
|
export declare function clearAuthCookies(request: NextRequest, response: NextResponse): void;
|
|
12
12
|
export declare function isAuthFailure(error: unknown): boolean;
|
|
13
|
-
//# sourceMappingURL=refresh.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AuthenticationError } from 'nodehive-js';
|
|
2
|
-
import { DRAFT_MODE_COOKIE } from
|
|
3
|
-
import { appendClearedAuthCookie, NextCookieStorage } from
|
|
4
|
-
import { buildUserClient } from
|
|
5
|
-
import { REFRESH_TOKEN_MAX_AGE } from
|
|
2
|
+
import { DRAFT_MODE_COOKIE } from "./draft-mode.js";
|
|
3
|
+
import { appendClearedAuthCookie, NextCookieStorage } from "./next-cookie-storage.js";
|
|
4
|
+
import { buildUserClient } from "./nodehive-client.js";
|
|
5
|
+
import { REFRESH_TOKEN_MAX_AGE } from "./oauth-config.js";
|
|
6
6
|
const MAX_RETRIES = 3;
|
|
7
7
|
const BACKOFF_MS = 200;
|
|
8
8
|
const ROTATION_GRACE_MS = 30_000;
|