@nextsparkjs/core 0.1.0-beta.185 → 0.1.0-beta.187
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/dist/components/app/guards/DeveloperGuard.d.ts.map +1 -1
- package/dist/components/app/guards/DeveloperGuard.js +8 -4
- package/dist/components/app/guards/SuperAdminGuard.d.ts.map +1 -1
- package/dist/components/app/guards/SuperAdminGuard.js +8 -4
- package/dist/components/app/layouts/PublicFooter.d.ts.map +1 -1
- package/dist/components/app/layouts/PublicFooter.js +2 -2
- package/dist/components/app/layouts/PublicNavbar.d.ts.map +1 -1
- package/dist/components/app/layouts/PublicNavbar.js +2 -2
- package/dist/components/app/misc/ThemeToggle.d.ts.map +1 -1
- package/dist/components/app/misc/ThemeToggle.js +4 -1
- package/dist/components/auth/DevKeyring.d.ts.map +1 -1
- package/dist/components/auth/DevKeyring.js +10 -2
- package/dist/components/auth/SessionCookieRefresher.d.ts +21 -0
- package/dist/components/auth/SessionCookieRefresher.d.ts.map +1 -0
- package/dist/components/auth/SessionCookieRefresher.js +11 -0
- package/dist/components/auth/forms/LoginForm.d.ts.map +1 -1
- package/dist/components/auth/forms/LoginForm.js +300 -6
- package/dist/components/auth/index.d.ts +1 -0
- package/dist/components/auth/index.d.ts.map +1 -1
- package/dist/components/auth/index.js +2 -0
- package/dist/components/billing/InvoicesTable.d.ts.map +1 -1
- package/dist/components/billing/InvoicesTable.js +4 -3
- package/dist/components/dashboard/block-editor/dynamic-form.d.ts.map +1 -1
- package/dist/components/dashboard/layouts/AuthGuard.d.ts.map +1 -1
- package/dist/components/dashboard/layouts/AuthGuard.js +2 -2
- package/dist/components/dashboard/layouts/DashboardAuthLayout.d.ts.map +1 -1
- package/dist/components/dashboard/layouts/DashboardAuthLayout.js +2 -2
- package/dist/components/dashboard/layouts/DashboardAuthSkeleton.d.ts +17 -0
- package/dist/components/dashboard/layouts/DashboardAuthSkeleton.d.ts.map +1 -0
- package/dist/components/dashboard/layouts/DashboardAuthSkeleton.js +52 -0
- package/dist/components/dashboard/layouts/Sidebar.d.ts.map +1 -1
- package/dist/components/dashboard/layouts/Sidebar.js +2 -3
- package/dist/components/dashboard/layouts/TopNavbar.js +2 -2
- package/dist/components/dashboard/layouts/index.d.ts +1 -0
- package/dist/components/dashboard/layouts/index.d.ts.map +1 -1
- package/dist/components/dashboard/layouts/index.js +2 -0
- package/dist/components/devtools/api-explorer/ApiExplorer.js +4 -4
- package/dist/components/entities/EntityFieldRenderer.d.ts.map +1 -1
- package/dist/components/entities/EntityFieldRenderer.js +3 -0
- package/dist/components/entities/EntityTable.d.ts.map +1 -1
- package/dist/components/entities/EntityTable.js +2 -1
- package/dist/components/entities/wrappers/EntityFormWrapper.d.ts.map +1 -1
- package/dist/components/entities/wrappers/EntityFormWrapper.js +7 -2
- package/dist/components/patterns/pages/PatternEditPage.d.ts +5 -1
- package/dist/components/patterns/pages/PatternEditPage.d.ts.map +1 -1
- package/dist/components/patterns/pages/PatternEditPage.js +16 -5
- package/dist/components/patterns/pages/PatternsCreatePage.d.ts +2 -1
- package/dist/components/patterns/pages/PatternsCreatePage.d.ts.map +1 -1
- package/dist/components/patterns/pages/PatternsCreatePage.js +17 -5
- package/dist/components/ui/combobox.d.ts +8 -1
- package/dist/components/ui/combobox.d.ts.map +1 -1
- package/dist/components/ui/combobox.js +37 -44
- package/dist/components/ui/country-select.d.ts +3 -1
- package/dist/components/ui/country-select.d.ts.map +1 -1
- package/dist/components/ui/country-select.js +3 -1
- package/dist/components/ui/currency-select.d.ts +3 -1
- package/dist/components/ui/currency-select.d.ts.map +1 -1
- package/dist/components/ui/currency-select.js +3 -1
- package/dist/components/ui/sheet.d.ts +5 -0
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet.js +46 -26
- package/dist/components/ui/timezone-select.d.ts +3 -1
- package/dist/components/ui/timezone-select.d.ts.map +1 -1
- package/dist/components/ui/timezone-select.js +3 -1
- package/dist/contexts/TeamContext.d.ts +6 -0
- package/dist/contexts/TeamContext.d.ts.map +1 -1
- package/dist/contexts/TeamContext.js +8 -1
- package/dist/emails/otp-verification.d.ts.map +1 -1
- package/dist/emails/reset-password.d.ts.map +1 -1
- package/dist/emails/team-invitation.d.ts.map +1 -1
- package/dist/emails/team-invitation.js +3 -2
- package/dist/emails/verify-email.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useAuth.d.ts +29 -0
- package/dist/hooks/useAuth.d.ts.map +1 -1
- package/dist/hooks/useAuth.js +24 -0
- package/dist/hooks/useEnsureUserMetadata.d.ts +22 -0
- package/dist/hooks/useEnsureUserMetadata.d.ts.map +1 -1
- package/dist/hooks/useEnsureUserMetadata.js +18 -5
- package/dist/hooks/useSessionCookieRefresh.d.ts +35 -0
- package/dist/hooks/useSessionCookieRefresh.d.ts.map +1 -0
- package/dist/hooks/useSessionCookieRefresh.js +49 -0
- package/dist/lib/api/api-error.d.ts +3 -1
- package/dist/lib/api/api-error.d.ts.map +1 -1
- package/dist/lib/api/api-error.js +4 -2
- package/dist/lib/api/auth/dual-auth.d.ts +38 -3
- package/dist/lib/api/auth/dual-auth.d.ts.map +1 -1
- package/dist/lib/api/auth/dual-auth.js +42 -7
- package/dist/lib/api/auth/permissions.d.ts +7 -2
- package/dist/lib/api/auth/permissions.d.ts.map +1 -1
- package/dist/lib/api/auth/permissions.js +2 -2
- package/dist/lib/api/auth/scope-policy.d.ts +71 -0
- package/dist/lib/api/auth/scope-policy.d.ts.map +1 -0
- package/dist/lib/api/auth/scope-policy.js +53 -0
- package/dist/lib/api/auth.d.ts +15 -0
- package/dist/lib/api/auth.d.ts.map +1 -1
- package/dist/lib/api/auth.js +17 -4
- package/dist/lib/api/entities.js +2 -1
- package/dist/lib/api/entity/audit-log.d.ts +35 -0
- package/dist/lib/api/entity/audit-log.d.ts.map +1 -0
- package/dist/lib/api/entity/audit-log.js +35 -0
- package/dist/lib/api/entity/generic-handler.d.ts.map +1 -1
- package/dist/lib/api/entity/generic-handler.js +333 -138
- package/dist/lib/api/entity-handler.js +2 -2
- package/dist/lib/api/helpers.d.ts +29 -4
- package/dist/lib/api/helpers.d.ts.map +1 -1
- package/dist/lib/api/helpers.js +30 -6
- package/dist/lib/api/keys.d.ts +16 -0
- package/dist/lib/api/keys.d.ts.map +1 -1
- package/dist/lib/api/keys.js +19 -1
- package/dist/lib/api/routes/patterns-usages.d.ts.map +1 -1
- package/dist/lib/api/routes/patterns-usages.js +3 -11
- package/dist/lib/auth/auth-methods.d.ts +52 -0
- package/dist/lib/auth/auth-methods.d.ts.map +1 -0
- package/dist/lib/auth/auth-methods.js +63 -0
- package/dist/lib/auth/registration-guard-plugin.d.ts.map +1 -1
- package/dist/lib/auth/registration-helpers.d.ts +9 -0
- package/dist/lib/auth/registration-helpers.d.ts.map +1 -1
- package/dist/lib/auth/registration-helpers.js +8 -2
- package/dist/lib/auth/security-notifications/device-fingerprint.d.ts +52 -0
- package/dist/lib/auth/security-notifications/device-fingerprint.d.ts.map +1 -0
- package/dist/lib/auth/security-notifications/device-fingerprint.js +42 -0
- package/dist/lib/auth/security-notifications/dispatcher.d.ts +37 -0
- package/dist/lib/auth/security-notifications/dispatcher.d.ts.map +1 -0
- package/dist/lib/auth/security-notifications/dispatcher.js +157 -0
- package/dist/lib/auth/security-notifications/index.d.ts +20 -0
- package/dist/lib/auth/security-notifications/index.d.ts.map +1 -0
- package/dist/lib/auth/security-notifications/index.js +22 -0
- package/dist/lib/auth/security-notifications/registry.d.ts +36 -0
- package/dist/lib/auth/security-notifications/registry.d.ts.map +1 -0
- package/dist/lib/auth/security-notifications/registry.js +26 -0
- package/dist/lib/auth/security-notifications/templates/email-changed.d.ts +12 -0
- package/dist/lib/auth/security-notifications/templates/email-changed.d.ts.map +1 -0
- package/dist/lib/auth/security-notifications/templates/email-changed.js +43 -0
- package/dist/lib/auth/security-notifications/templates/new-device-login.d.ts +7 -0
- package/dist/lib/auth/security-notifications/templates/new-device-login.d.ts.map +1 -0
- package/dist/lib/auth/security-notifications/templates/new-device-login.js +46 -0
- package/dist/lib/auth/security-notifications/templates/password-changed.d.ts +7 -0
- package/dist/lib/auth/security-notifications/templates/password-changed.d.ts.map +1 -0
- package/dist/lib/auth/security-notifications/templates/password-changed.js +35 -0
- package/dist/lib/auth/security-notifications/templates/shared.d.ts +36 -0
- package/dist/lib/auth/security-notifications/templates/shared.d.ts.map +1 -0
- package/dist/lib/auth/security-notifications/templates/shared.js +68 -0
- package/dist/lib/auth/security-notifications/types.d.ts +74 -0
- package/dist/lib/auth/security-notifications/types.d.ts.map +1 -0
- package/dist/lib/auth/session-config.d.ts +37 -0
- package/dist/lib/auth/session-config.d.ts.map +1 -0
- package/dist/lib/auth/session-config.js +59 -0
- package/dist/lib/auth/session-refresh.d.ts +46 -0
- package/dist/lib/auth/session-refresh.d.ts.map +1 -0
- package/dist/lib/auth/session-refresh.js +11 -0
- package/dist/lib/auth-client.d.ts +1639 -0
- package/dist/lib/auth-client.d.ts.map +1 -0
- package/dist/lib/auth-client.js +13 -1
- package/dist/lib/auth.d.ts.map +1 -1
- package/dist/lib/auth.js +45 -11
- package/dist/lib/billing/gateways/factory.d.ts +8 -3
- package/dist/lib/billing/gateways/factory.d.ts.map +1 -1
- package/dist/lib/billing/gateways/factory.js +37 -23
- package/dist/lib/billing/stripe-webhook.d.ts.map +1 -1
- package/dist/lib/billing/stripe-webhook.js +2 -1
- package/dist/lib/config/app.config.d.ts.map +1 -1
- package/dist/lib/config/app.config.js +71 -0
- package/dist/lib/config/config-sync.d.ts +1 -4
- package/dist/lib/config/config-sync.d.ts.map +1 -1
- package/dist/lib/config/config-sync.js +6 -2
- package/dist/lib/config/types.d.ts +130 -0
- package/dist/lib/config/types.d.ts.map +1 -1
- package/dist/lib/email/templates.d.ts +3 -3
- package/dist/lib/email/templates.d.ts.map +1 -1
- package/dist/lib/entities/api-generator.js +5 -5
- package/dist/lib/entities/entity-hooks.d.ts +9 -1
- package/dist/lib/entities/entity-hooks.d.ts.map +1 -1
- package/dist/lib/entities/entity-hooks.js +77 -4
- package/dist/lib/entities/schema-generator.d.ts.map +1 -1
- package/dist/lib/entities/schema-generator.js +20 -4
- package/dist/lib/entities/serialization.d.ts +2 -2
- package/dist/lib/entities/serialization.d.ts.map +1 -1
- package/dist/lib/entities/serialization.js +3 -2
- package/dist/lib/entities/types.d.ts +20 -0
- package/dist/lib/entities/types.d.ts.map +1 -1
- package/dist/lib/locale.d.ts.map +1 -1
- package/dist/lib/locale.js +4 -1
- package/dist/lib/mcp/audit.d.ts +8 -4
- package/dist/lib/mcp/audit.d.ts.map +1 -1
- package/dist/lib/plugins/hook-system.d.ts +13 -0
- package/dist/lib/plugins/hook-system.d.ts.map +1 -1
- package/dist/lib/plugins/hook-system.js +32 -2
- package/dist/lib/scheduled-actions/handlers/index.d.ts +1 -0
- package/dist/lib/scheduled-actions/handlers/index.d.ts.map +1 -1
- package/dist/lib/scheduled-actions/handlers/index.js +3 -1
- package/dist/lib/scheduled-actions/handlers/security-notification.d.ts +26 -0
- package/dist/lib/scheduled-actions/handlers/security-notification.d.ts.map +1 -0
- package/dist/lib/scheduled-actions/handlers/security-notification.js +54 -0
- package/dist/lib/selectors/core-selectors.d.ts +12 -0
- package/dist/lib/selectors/core-selectors.d.ts.map +1 -1
- package/dist/lib/selectors/domains/auth.selectors.d.ts +12 -0
- package/dist/lib/selectors/domains/auth.selectors.d.ts.map +1 -1
- package/dist/lib/selectors/domains/auth.selectors.js +14 -1
- package/dist/lib/selectors/selectors.d.ts +24 -0
- package/dist/lib/selectors/selectors.d.ts.map +1 -1
- package/dist/lib/services/api-docs.service.d.ts +5 -1
- package/dist/lib/services/api-docs.service.d.ts.map +1 -1
- package/dist/lib/services/api-presets.service.d.ts +6 -1
- package/dist/lib/services/api-presets.service.d.ts.map +1 -1
- package/dist/lib/services/feature.service.d.ts +58 -4
- package/dist/lib/services/feature.service.d.ts.map +1 -1
- package/dist/lib/services/generic-entity.service.d.ts.map +1 -1
- package/dist/lib/services/generic-entity.service.js +16 -32
- package/dist/lib/services/membership.service.d.ts +10 -2
- package/dist/lib/services/membership.service.d.ts.map +1 -1
- package/dist/lib/services/membership.service.js +37 -16
- package/dist/lib/services/permission.service.d.ts +10 -4
- package/dist/lib/services/permission.service.d.ts.map +1 -1
- package/dist/lib/services/plugin.service.d.ts +1 -1
- package/dist/lib/services/plugin.service.d.ts.map +1 -1
- package/dist/lib/services/subscription.service.d.ts.map +1 -1
- package/dist/lib/services/subscription.service.js +2 -1
- package/dist/lib/services/team-member.service.d.ts +15 -3
- package/dist/lib/services/team-member.service.d.ts.map +1 -1
- package/dist/lib/services/team-member.service.js +27 -6
- package/dist/lib/services/team.service.d.ts.map +1 -1
- package/dist/lib/teams/permissions.d.ts +3 -1
- package/dist/lib/teams/permissions.d.ts.map +1 -1
- package/dist/lib/teams/permissions.js +6 -0
- package/dist/lib/teams/schema.d.ts.map +1 -1
- package/dist/lib/teams/schema.js +3 -0
- package/dist/lib/template-resolver.d.ts +3 -3
- package/dist/lib/theme/forced-theme.d.ts +34 -0
- package/dist/lib/theme/forced-theme.d.ts.map +1 -0
- package/dist/lib/theme/forced-theme.js +27 -0
- package/dist/lib/theme/get-default-theme-mode.d.ts +3 -0
- package/dist/lib/theme/get-default-theme-mode.d.ts.map +1 -1
- package/dist/lib/theme/get-default-theme-mode.js +5 -3
- package/dist/lib/utils/cors.d.ts +13 -0
- package/dist/lib/utils/cors.d.ts.map +1 -1
- package/dist/lib/utils/cors.js +20 -0
- package/dist/messages/de/auth.json +25 -2
- package/dist/messages/de/index.d.ts +83 -0
- package/dist/messages/de/index.d.ts.map +1 -1
- package/dist/messages/de/index.js +2 -0
- package/dist/messages/de/index.ts +2 -0
- package/dist/messages/de/navigation.json +3 -1
- package/dist/messages/en/auth.json +25 -2
- package/dist/messages/en/index.d.ts +83 -0
- package/dist/messages/en/index.d.ts.map +1 -1
- package/dist/messages/en/index.js +2 -0
- package/dist/messages/en/index.ts +2 -0
- package/dist/messages/en/navigation.json +3 -1
- package/dist/messages/es/auth.json +25 -2
- package/dist/messages/es/index.d.ts +83 -0
- package/dist/messages/es/index.d.ts.map +1 -1
- package/dist/messages/es/index.js +2 -0
- package/dist/messages/es/index.ts +2 -0
- package/dist/messages/es/navigation.json +3 -1
- package/dist/messages/fr/auth.json +25 -2
- package/dist/messages/fr/index.d.ts +83 -0
- package/dist/messages/fr/index.d.ts.map +1 -1
- package/dist/messages/fr/index.js +2 -0
- package/dist/messages/fr/index.ts +2 -0
- package/dist/messages/fr/navigation.json +3 -1
- package/dist/messages/it/auth.json +25 -2
- package/dist/messages/it/index.d.ts +83 -0
- package/dist/messages/it/index.d.ts.map +1 -1
- package/dist/messages/it/index.js +2 -0
- package/dist/messages/it/index.ts +2 -0
- package/dist/messages/it/navigation.json +3 -1
- package/dist/messages/pt/auth.json +25 -2
- package/dist/messages/pt/index.d.ts +83 -0
- package/dist/messages/pt/index.d.ts.map +1 -1
- package/dist/messages/pt/index.js +2 -0
- package/dist/messages/pt/index.ts +2 -0
- package/dist/messages/pt/navigation.json +3 -1
- package/dist/migrations/005_api_audit_log.sql +2 -1
- package/dist/migrations/025_api_audit_log_nullable_api_key.sql +12 -0
- package/dist/migrations/026_login_events.sql +91 -0
- package/dist/migrations/027_rls_bypass_developer_and_system_admin_team.sql +197 -0
- package/dist/nextspark-registries.d.ts +580 -236
- package/dist/providers/DashboardProviders.d.ts +12 -3
- package/dist/providers/DashboardProviders.d.ts.map +1 -1
- package/dist/providers/DashboardProviders.js +6 -2
- package/dist/providers/theme-provider.d.ts +19 -2
- package/dist/providers/theme-provider.d.ts.map +1 -1
- package/dist/providers/theme-provider.js +6 -2
- package/dist/templates/app/(auth)/signup/page.tsx +8 -0
- package/dist/templates/app/(public)/[...slug]/page.tsx +9 -14
- package/dist/templates/app/api/auth/[...all]/route.ts +23 -1
- package/dist/templates/app/api/health/route.ts +4 -2
- package/dist/templates/app/api/internal/user-metadata/route.ts +5 -3
- package/dist/templates/app/api/mcp/route.ts +4 -1
- package/dist/templates/app/api/superadmin/subscriptions/route.ts +2 -1
- package/dist/templates/app/api/superadmin/teams/[teamId]/route.ts +4 -3
- package/dist/templates/app/api/superadmin/users/[userId]/route.ts +10 -3
- package/dist/templates/app/api/v1/api-keys/[id]/route.ts +50 -71
- package/dist/templates/app/api/v1/api-keys/route.ts +21 -43
- package/dist/templates/app/api/v1/auth/signup-with-invite/route.ts +14 -14
- package/dist/templates/app/api/v1/billing/cancel/route.ts +7 -6
- package/dist/templates/app/api/v1/billing/change-plan/route.ts +5 -4
- package/dist/templates/app/api/v1/billing/check-action/route.ts +6 -4
- package/dist/templates/app/api/v1/billing/checkout/route.ts +7 -5
- package/dist/templates/app/api/v1/billing/plans/route.ts +8 -12
- package/dist/templates/app/api/v1/billing/portal/route.ts +7 -5
- package/dist/templates/app/api/v1/billing/webhooks/polar/route.ts +1 -1
- package/dist/templates/app/api/v1/devtools/blocks/route.ts +5 -4
- package/dist/templates/app/api/v1/devtools/features/route.ts +5 -4
- package/dist/templates/app/api/v1/devtools/flows/route.ts +5 -4
- package/dist/templates/app/api/v1/devtools/scheduled-actions/route.ts +9 -7
- package/dist/templates/app/api/v1/devtools/scheduled-actions/run/route.ts +5 -4
- package/dist/templates/app/api/v1/devtools/testing/route.ts +5 -4
- package/dist/templates/app/api/v1/media/[id]/route.ts +13 -25
- package/dist/templates/app/api/v1/media/[id]/tags/route.ts +17 -25
- package/dist/templates/app/api/v1/media/check-duplicates/route.ts +5 -7
- package/dist/templates/app/api/v1/media/route.ts +5 -9
- package/dist/templates/app/api/v1/media/upload/route.ts +9 -21
- package/dist/templates/app/api/v1/media-tags/route.ts +9 -13
- package/dist/templates/app/api/v1/patterns/[id]/usages/route.ts +11 -19
- package/dist/templates/app/api/v1/post-categories/[id]/route.ts +9 -7
- package/dist/templates/app/api/v1/post-categories/route.ts +5 -4
- package/dist/templates/app/api/v1/team-invitations/[token]/accept/route.ts +16 -18
- package/dist/templates/app/api/v1/team-invitations/[token]/decline/route.ts +15 -17
- package/dist/templates/app/api/v1/team-invitations/[token]/route.ts +8 -8
- package/dist/templates/app/api/v1/team-invitations/route.ts +9 -11
- package/dist/templates/app/api/v1/teams/[teamId]/invitations/route.ts +41 -32
- package/dist/templates/app/api/v1/teams/[teamId]/invoices/[invoiceNumber]/route.ts +15 -16
- package/dist/templates/app/api/v1/teams/[teamId]/invoices/route.ts +14 -15
- package/dist/templates/app/api/v1/teams/[teamId]/members/[memberId]/route.ts +32 -36
- package/dist/templates/app/api/v1/teams/[teamId]/members/route.ts +33 -33
- package/dist/templates/app/api/v1/teams/[teamId]/route.ts +35 -41
- package/dist/templates/app/api/v1/teams/[teamId]/subscription/route.ts +5 -3
- package/dist/templates/app/api/v1/teams/[teamId]/usage/[limitSlug]/route.ts +10 -6
- package/dist/templates/app/api/v1/teams/route.ts +33 -27
- package/dist/templates/app/api/v1/teams/switch/route.ts +11 -13
- package/dist/templates/app/api/v1/theme/[...path]/route.ts +23 -2
- package/dist/templates/app/api/v1/users/[id]/meta/[key]/route.ts +32 -77
- package/dist/templates/app/api/v1/users/[id]/route.ts +35 -68
- package/dist/templates/app/api/v1/users/route.ts +21 -25
- package/dist/templates/app/dashboard/layout.tsx +2 -6
- package/dist/templates/app/layout.ppr.tsx +15 -15
- package/dist/templates/app/layout.tsx +46 -20
- package/dist/templates/contents/themes/starter/config/app.config.ts +19 -0
- package/dist/templates/contents/themes/starter/config/theme.config.ts +6 -0
- package/dist/templates/contents/themes/starter/styles/globals.css +6 -2
- package/dist/templates/proxy.ts +46 -10
- package/dist/templates/tsconfig.json +4 -0
- package/dist/types/theme.d.ts +9 -0
- package/dist/types/theme.d.ts.map +1 -1
- package/migrations/005_api_audit_log.sql +2 -1
- package/migrations/025_api_audit_log_nullable_api_key.sql +12 -0
- package/migrations/026_login_events.sql +91 -0
- package/migrations/027_rls_bypass_developer_and_system_admin_team.sql +197 -0
- package/package.json +14 -11
- package/scripts/build/registry/__tests__/scope-registry.test.mjs +18 -0
- package/scripts/build/registry/generators/scope-registry.mjs +9 -2
- package/templates/app/(auth)/signup/page.tsx +8 -0
- package/templates/app/(public)/[...slug]/page.tsx +9 -14
- package/templates/app/api/auth/[...all]/route.ts +23 -1
- package/templates/app/api/health/route.ts +4 -2
- package/templates/app/api/internal/user-metadata/route.ts +5 -3
- package/templates/app/api/mcp/route.ts +4 -1
- package/templates/app/api/superadmin/subscriptions/route.ts +2 -1
- package/templates/app/api/superadmin/teams/[teamId]/route.ts +4 -3
- package/templates/app/api/superadmin/users/[userId]/route.ts +10 -3
- package/templates/app/api/v1/api-keys/[id]/route.ts +50 -71
- package/templates/app/api/v1/api-keys/route.ts +21 -43
- package/templates/app/api/v1/auth/signup-with-invite/route.ts +14 -14
- package/templates/app/api/v1/billing/cancel/route.ts +7 -6
- package/templates/app/api/v1/billing/change-plan/route.ts +5 -4
- package/templates/app/api/v1/billing/check-action/route.ts +6 -4
- package/templates/app/api/v1/billing/checkout/route.ts +7 -5
- package/templates/app/api/v1/billing/plans/route.ts +8 -12
- package/templates/app/api/v1/billing/portal/route.ts +7 -5
- package/templates/app/api/v1/billing/webhooks/polar/route.ts +1 -1
- package/templates/app/api/v1/devtools/blocks/route.ts +5 -4
- package/templates/app/api/v1/devtools/features/route.ts +5 -4
- package/templates/app/api/v1/devtools/flows/route.ts +5 -4
- package/templates/app/api/v1/devtools/scheduled-actions/route.ts +9 -7
- package/templates/app/api/v1/devtools/scheduled-actions/run/route.ts +5 -4
- package/templates/app/api/v1/devtools/testing/route.ts +5 -4
- package/templates/app/api/v1/media/[id]/route.ts +13 -25
- package/templates/app/api/v1/media/[id]/tags/route.ts +17 -25
- package/templates/app/api/v1/media/check-duplicates/route.ts +5 -7
- package/templates/app/api/v1/media/route.ts +5 -9
- package/templates/app/api/v1/media/upload/route.ts +9 -21
- package/templates/app/api/v1/media-tags/route.ts +9 -13
- package/templates/app/api/v1/patterns/[id]/usages/route.ts +11 -19
- package/templates/app/api/v1/post-categories/[id]/route.ts +9 -7
- package/templates/app/api/v1/post-categories/route.ts +5 -4
- package/templates/app/api/v1/team-invitations/[token]/accept/route.ts +16 -18
- package/templates/app/api/v1/team-invitations/[token]/decline/route.ts +15 -17
- package/templates/app/api/v1/team-invitations/[token]/route.ts +8 -8
- package/templates/app/api/v1/team-invitations/route.ts +9 -11
- package/templates/app/api/v1/teams/[teamId]/invitations/route.ts +41 -32
- package/templates/app/api/v1/teams/[teamId]/invoices/[invoiceNumber]/route.ts +15 -16
- package/templates/app/api/v1/teams/[teamId]/invoices/route.ts +14 -15
- package/templates/app/api/v1/teams/[teamId]/members/[memberId]/route.ts +32 -36
- package/templates/app/api/v1/teams/[teamId]/members/route.ts +33 -33
- package/templates/app/api/v1/teams/[teamId]/route.ts +35 -41
- package/templates/app/api/v1/teams/[teamId]/subscription/route.ts +5 -3
- package/templates/app/api/v1/teams/[teamId]/usage/[limitSlug]/route.ts +10 -6
- package/templates/app/api/v1/teams/route.ts +33 -27
- package/templates/app/api/v1/teams/switch/route.ts +11 -13
- package/templates/app/api/v1/theme/[...path]/route.ts +23 -2
- package/templates/app/api/v1/users/[id]/meta/[key]/route.ts +32 -77
- package/templates/app/api/v1/users/[id]/route.ts +35 -68
- package/templates/app/api/v1/users/route.ts +21 -25
- package/templates/app/dashboard/layout.tsx +2 -6
- package/templates/app/layout.ppr.tsx +15 -15
- package/templates/app/layout.tsx +46 -20
- package/templates/contents/themes/starter/config/app.config.ts +19 -0
- package/templates/contents/themes/starter/config/theme.config.ts +6 -0
- package/templates/contents/themes/starter/styles/globals.css +6 -2
- package/templates/proxy.ts +46 -10
- package/templates/tsconfig.json +4 -0
- package/tests/jest/__mocks__/@nextsparkjs/registries/permissions-registry.ts +23 -0
- package/tests/jest/__mocks__/next-server.js +24 -0
- package/dist/components/teams/TeamSwitchModal.d.js +0 -0
- package/dist/components/ui/accordion.d.js +0 -0
- package/dist/components/ui/avatar.d.js +0 -0
- package/dist/components/ui/badge.d.js +0 -0
- package/dist/components/ui/button.d.js +0 -0
- package/dist/components/ui/card.d.js +0 -0
- package/dist/components/ui/dialog.d.js +0 -0
- package/dist/components/ui/dropdown-menu.d.js +0 -0
- package/dist/components/ui/input.d.js +0 -0
- package/dist/components/ui/progress.d.js +0 -0
- package/dist/components/ui/scroll-area.d.js +0 -0
- package/dist/components/ui/select.d.js +0 -0
- package/dist/components/ui/separator.d.js +0 -0
- package/dist/components/ui/table.d.js +0 -0
- package/dist/components/ui/textarea.d.js +0 -0
- package/dist/contexts/TeamContext.d.js +0 -0
- package/dist/hooks/useAuth.d.js +0 -0
- package/dist/hooks/useLastAuthMethod.d.js +0 -0
- package/dist/hooks/useOrigin.d.js +0 -0
- package/dist/lib/api/auth/dual-auth.d.js +0 -0
- package/dist/lib/api/auth.d.js +0 -0
- package/dist/lib/api/cache.d.js +0 -0
- package/dist/lib/api/keys.d.js +0 -0
- package/dist/lib/auth-client.d.js +0 -0
- package/dist/lib/auth-context.d.js +0 -0
- package/dist/lib/auth.d.js +0 -0
- package/dist/lib/billing/config-types.d.js +0 -0
- package/dist/lib/billing/enforcement.d.js +0 -0
- package/dist/lib/billing/helpers.d.js +0 -0
- package/dist/lib/billing/jobs.d.js +0 -0
- package/dist/lib/billing/types.d.js +0 -0
- package/dist/lib/blocks/loader.d.js +0 -0
- package/dist/lib/config/app.config.d.js +0 -0
- package/dist/lib/config/config-loader.d.js +0 -0
- package/dist/lib/config/config-sync.d.js +0 -0
- package/dist/lib/config/config-types.d.js +0 -0
- package/dist/lib/config/config-utils.d.js +0 -0
- package/dist/lib/config/dashboard-types.d.js +0 -0
- package/dist/lib/config/dashboard.config.d.js +0 -0
- package/dist/lib/config/icon-map.d.js +0 -0
- package/dist/lib/config/index.d.js +0 -7
- package/dist/lib/config/nextspark-types.d.js +0 -0
- package/dist/lib/config/roles-merge.d.js +0 -0
- package/dist/lib/config/types.d.js +0 -0
- package/dist/lib/db.d.js +0 -0
- package/dist/lib/email/factory.d.js +0 -0
- package/dist/lib/email/index.d.js +0 -3
- package/dist/lib/email/providers/console.d.js +0 -0
- package/dist/lib/email/providers/resend.d.js +0 -0
- package/dist/lib/email/templates.d.js +0 -0
- package/dist/lib/email/types.d.js +0 -0
- package/dist/lib/entities/types.d.js +0 -0
- package/dist/lib/permissions/system.d.js +0 -0
- package/dist/lib/permissions/types.d.js +0 -0
- package/dist/lib/plugins/hook-system.d.js +0 -0
- package/dist/lib/scheduled-actions/cleanup.d.js +0 -0
- package/dist/lib/scheduled-actions/index.d.js +0 -19
- package/dist/lib/scheduled-actions/initializer.d.js +0 -1
- package/dist/lib/scheduled-actions/processor.d.js +0 -0
- package/dist/lib/scheduled-actions/registry.d.js +0 -0
- package/dist/lib/scheduled-actions/scheduler.d.js +0 -0
- package/dist/lib/scheduled-actions/types.d.js +0 -0
- package/dist/lib/services/api-routes.service.d.js +0 -0
- package/dist/lib/services/entity-type.service.d.js +0 -0
- package/dist/lib/services/index.d.js +0 -40
- package/dist/lib/services/invoice.service.d.js +0 -0
- package/dist/lib/services/membership.service.d.js +0 -0
- package/dist/lib/services/meta.service.d.js +0 -0
- package/dist/lib/services/middleware.service.d.js +0 -0
- package/dist/lib/services/namespace.service.d.js +0 -0
- package/dist/lib/services/permission.service.d.js +0 -0
- package/dist/lib/services/plan.service.d.js +0 -0
- package/dist/lib/services/plugin.service.d.js +0 -0
- package/dist/lib/services/route-handler.service.d.js +0 -0
- package/dist/lib/services/scope.service.d.js +0 -0
- package/dist/lib/services/subscription.service.d.js +0 -0
- package/dist/lib/services/team-member.service.d.js +0 -0
- package/dist/lib/services/team.service.d.js +0 -0
- package/dist/lib/services/theme.service.d.js +0 -0
- package/dist/lib/services/usage.service.d.js +0 -0
- package/dist/lib/services/user-flags.service.d.js +0 -0
- package/dist/lib/services/user.service.d.js +0 -0
- package/dist/lib/teams/helpers.d.js +0 -0
- package/dist/lib/teams/permissions.d.js +0 -0
- package/dist/lib/teams/types.d.js +0 -0
- package/dist/lib/utils/config-merge.d.js +0 -0
- package/dist/lib/utils/file-logger.d.js +0 -0
- package/dist/lib/utils.d.js +0 -0
- package/dist/styles/classes.json +0 -1093
- package/dist/styles/ui.css +0 -2
- package/dist/types/auth.d.js +0 -0
- package/dist/types/blocks.d.js +0 -0
- package/dist/types/meta.types.d.js +0 -0
- package/dist/types/plugin.d.js +0 -0
- package/dist/types/testing.types.d.js +0 -0
- package/dist/types/theme.d.js +0 -0
- package/dist/types/user.types.d.js +0 -0
- package/scripts/build/build-ui-css.mjs +0 -351
- /package/dist/{components/app/layouts/PublicFooter.d.js → lib/auth/security-notifications/types.js} +0 -0
- /package/dist/{components/app/layouts/PublicNavbar.d.js → nextspark-registries.d.js} +0 -0
- /package/dist/{components/app/misc/ThemeToggle.d.js → types/use-intl-react-shim.d.js} +0 -0
|
@@ -55,27 +55,22 @@ export const metadata: Metadata = getMetadataOrDefault(
|
|
|
55
55
|
defaultMetadata
|
|
56
56
|
)
|
|
57
57
|
|
|
58
|
-
export default function RootLayout({
|
|
58
|
+
export default async function RootLayout({
|
|
59
59
|
children,
|
|
60
60
|
}: Readonly<{
|
|
61
61
|
children: React.ReactNode
|
|
62
62
|
}>) {
|
|
63
|
+
const billingHints = await getBillingResourceHints()
|
|
64
|
+
|
|
63
65
|
return (
|
|
64
66
|
<html lang={DEFAULT_LOCALE} suppressHydrationWarning>
|
|
65
67
|
<head>
|
|
66
|
-
{(() =>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
))}
|
|
73
|
-
{[...hints.preconnect, ...hints.dnsPrefetch].map((domain) => (
|
|
74
|
-
<link key={`dns-${domain}`} rel="dns-prefetch" href={domain} />
|
|
75
|
-
))}
|
|
76
|
-
</>
|
|
77
|
-
)
|
|
78
|
-
})()}
|
|
68
|
+
{billingHints.preconnect.map((domain) => (
|
|
69
|
+
<link key={`pre-${domain}`} rel="preconnect" href={domain} />
|
|
70
|
+
))}
|
|
71
|
+
{[...billingHints.preconnect, ...billingHints.dnsPrefetch].map((domain) => (
|
|
72
|
+
<link key={`dns-${domain}`} rel="dns-prefetch" href={domain} />
|
|
73
|
+
))}
|
|
79
74
|
</head>
|
|
80
75
|
<body
|
|
81
76
|
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
|
@@ -84,7 +79,12 @@ export default function RootLayout({
|
|
|
84
79
|
<NextThemeProvider
|
|
85
80
|
attribute="class"
|
|
86
81
|
defaultTheme={DEFAULT_THEME_MODE}
|
|
87
|
-
|
|
82
|
+
// Always true here: this layout never passes forcedTheme, so
|
|
83
|
+
// ThemeToggle is unconditionally visible and offers "System" as one
|
|
84
|
+
// of its 3 choices — gating on DEFAULT_THEME_MODE === 'system' had
|
|
85
|
+
// the same bug as the non-PPR layout (see #175): a build-time
|
|
86
|
+
// default of 'light'/'dark' silently broke the "System" option.
|
|
87
|
+
enableSystem
|
|
88
88
|
disableTransitionOnChange
|
|
89
89
|
>
|
|
90
90
|
<CustomThemeProvider>
|
package/templates/app/layout.tsx
CHANGED
|
@@ -15,11 +15,15 @@ import { getBillingResourceHints } from "@nextsparkjs/core/lib/billing/gateways/
|
|
|
15
15
|
import { ThemeProvider as NextThemeProvider } from "@nextsparkjs/core/providers/theme-provider"
|
|
16
16
|
import { ThemeProvider as CustomThemeProvider } from "@nextsparkjs/core/lib/theme/ThemeProvider"
|
|
17
17
|
import { Toaster } from "@nextsparkjs/core/components/ui/sonner"
|
|
18
|
+
import { QueryProvider } from "@nextsparkjs/core/providers/query-provider"
|
|
19
|
+
import { TeamProvider } from "@nextsparkjs/core/contexts/TeamContext"
|
|
20
|
+
import { SubscriptionProvider } from "@nextsparkjs/core/contexts/SubscriptionContext"
|
|
18
21
|
import { getUserLocale } from '@nextsparkjs/core/lib/locale'
|
|
19
22
|
import { TranslationContextManager } from "@nextsparkjs/core/providers/TranslationContextManager"
|
|
23
|
+
import { SessionCookieRefresher } from "@nextsparkjs/core/components/auth/SessionCookieRefresher"
|
|
20
24
|
import { PluginService } from '@nextsparkjs/core/lib/services'
|
|
21
25
|
import { getMetadataOrDefault } from '@nextsparkjs/core/lib/template-resolver'
|
|
22
|
-
import {
|
|
26
|
+
import { getThemeSettings } from '@nextsparkjs/core/lib/theme/get-default-theme-mode'
|
|
23
27
|
|
|
24
28
|
const geistSans = Geist({
|
|
25
29
|
variable: "--font-geist-sans",
|
|
@@ -55,24 +59,18 @@ export default async function RootLayout({
|
|
|
55
59
|
|
|
56
60
|
const locale = await getUserLocale()
|
|
57
61
|
const messages = await getMessages({ locale })
|
|
58
|
-
const
|
|
62
|
+
const { defaultMode, allowUserToggle, forcedThemeRoutes } = await getThemeSettings()
|
|
63
|
+
const billingHints = await getBillingResourceHints()
|
|
59
64
|
|
|
60
65
|
return (
|
|
61
66
|
<html lang={locale} suppressHydrationWarning>
|
|
62
67
|
<head>
|
|
63
|
-
{(() =>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
))}
|
|
70
|
-
{[...hints.preconnect, ...hints.dnsPrefetch].map((domain) => (
|
|
71
|
-
<link key={`dns-${domain}`} rel="dns-prefetch" href={domain} />
|
|
72
|
-
))}
|
|
73
|
-
</>
|
|
74
|
-
)
|
|
75
|
-
})()}
|
|
68
|
+
{billingHints.preconnect.map((domain) => (
|
|
69
|
+
<link key={`pre-${domain}`} rel="preconnect" href={domain} />
|
|
70
|
+
))}
|
|
71
|
+
{[...billingHints.preconnect, ...billingHints.dnsPrefetch].map((domain) => (
|
|
72
|
+
<link key={`dns-${domain}`} rel="dns-prefetch" href={domain} />
|
|
73
|
+
))}
|
|
76
74
|
</head>
|
|
77
75
|
<body
|
|
78
76
|
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
|
@@ -80,14 +78,42 @@ export default async function RootLayout({
|
|
|
80
78
|
<NextIntlClientProvider locale={locale} messages={messages}>
|
|
81
79
|
<NextThemeProvider
|
|
82
80
|
attribute="class"
|
|
83
|
-
defaultTheme={
|
|
84
|
-
|
|
81
|
+
defaultTheme={defaultMode}
|
|
82
|
+
// When allowUserToggle is false, force the theme and ignore localStorage/system
|
|
83
|
+
forcedTheme={!allowUserToggle ? defaultMode : undefined}
|
|
84
|
+
// Detect OS preference whenever the user can toggle at all. ThemeToggle
|
|
85
|
+
// always offers "System" as one of its 3 choices when toggling is
|
|
86
|
+
// allowed, so the provider must be able to resolve it whenever that's
|
|
87
|
+
// true — gating on `defaultMode === 'system'` looks equivalent at
|
|
88
|
+
// first render, but defaultMode is the user's last SAVED preference
|
|
89
|
+
// for a logged-in user (see getThemeSettings), not a static "is
|
|
90
|
+
// system-matching enabled" flag. That made "System" silently write a
|
|
91
|
+
// literal, unmatched `class="system"` for anyone whose saved
|
|
92
|
+
// preference (or the theme's own config default) wasn't already
|
|
93
|
+
// 'system' — see #175.
|
|
94
|
+
enableSystem={allowUserToggle}
|
|
95
|
+
// Force a theme on the routes declared in theme.config.ts (forcedThemeRoutes)
|
|
96
|
+
forcedThemeRoutes={forcedThemeRoutes}
|
|
85
97
|
disableTransitionOnChange
|
|
86
98
|
>
|
|
87
99
|
<CustomThemeProvider>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
100
|
+
{/* Team providers live here (not only in DashboardProviders) so the activeTeamId
|
|
101
|
+
cookie is synced from any route, matching layout.ppr.tsx — see #115.
|
|
102
|
+
DashboardProviders skips re-mounting them when already present. */}
|
|
103
|
+
<QueryProvider>
|
|
104
|
+
<TeamProvider>
|
|
105
|
+
<SubscriptionProvider>
|
|
106
|
+
<TranslationContextManager />
|
|
107
|
+
{/* Real session-cookie renewal for installed PWAs: the render-time
|
|
108
|
+
session reads above (getUserLocale/getThemeSettings) cannot
|
|
109
|
+
write cookies, so the rolling refresh is triggered from the
|
|
110
|
+
client through the auth Route Handler instead. */}
|
|
111
|
+
<SessionCookieRefresher />
|
|
112
|
+
<main>{children}</main>
|
|
113
|
+
<Suspense><Toaster position="bottom-left" /></Suspense>
|
|
114
|
+
</SubscriptionProvider>
|
|
115
|
+
</TeamProvider>
|
|
116
|
+
</QueryProvider>
|
|
91
117
|
</CustomThemeProvider>
|
|
92
118
|
</NextThemeProvider>
|
|
93
119
|
</NextIntlClientProvider>
|
|
@@ -115,6 +115,25 @@ export const APP_CONFIG_OVERRIDES = {
|
|
|
115
115
|
enabled: false,
|
|
116
116
|
},
|
|
117
117
|
},
|
|
118
|
+
/**
|
|
119
|
+
* Login methods, in priority order. Core default = passwordless preset:
|
|
120
|
+
* a one-time code by email + Google, no password field (needs an email
|
|
121
|
+
* provider — RESEND_API_KEY — and GOOGLE_CLIENT_ID/SECRET for Google).
|
|
122
|
+
*
|
|
123
|
+
* Uncomment to switch to the classic email + password preset, or list both
|
|
124
|
+
* (the first email method is the form shown first):
|
|
125
|
+
*/
|
|
126
|
+
// methods: ['email-password', 'google'],
|
|
127
|
+
// methods: ['email-otp', 'email-password', 'google'],
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Session duration / renewal in seconds (defaults: 7 days, renewed daily).
|
|
131
|
+
* Long-lived sessions for an installed PWA, for example:
|
|
132
|
+
*/
|
|
133
|
+
// session: {
|
|
134
|
+
// expiresIn: 60 * 60 * 24 * 90, // 90 days
|
|
135
|
+
// updateAge: 60 * 60 * 24 * 7, // renew weekly
|
|
136
|
+
// },
|
|
118
137
|
/**
|
|
119
138
|
* Whether Better Auth automatically sends the verification email on signup.
|
|
120
139
|
*
|
|
@@ -22,6 +22,12 @@ export const starterThemeConfig: ThemeConfig = {
|
|
|
22
22
|
// ==========================================
|
|
23
23
|
plugins: [],
|
|
24
24
|
|
|
25
|
+
// ==========================================
|
|
26
|
+
// THEME MODE (Optional)
|
|
27
|
+
// ==========================================
|
|
28
|
+
// defaultMode: 'system', // 'light' | 'dark' | 'system'
|
|
29
|
+
// forcedThemeRoutes: { '/login': 'light' }, // force a theme on route prefixes (longest wins)
|
|
30
|
+
|
|
25
31
|
// ==========================================
|
|
26
32
|
// STYLES CONFIGURATION
|
|
27
33
|
// ==========================================
|
|
@@ -200,8 +200,12 @@
|
|
|
200
200
|
/* =============================================
|
|
201
201
|
BASE STYLES
|
|
202
202
|
============================================= */
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
/* Must live in @layer base: un-layered rules beat every Tailwind v4 utility
|
|
204
|
+
(border-primary, border-destructive, ...) regardless of specificity. */
|
|
205
|
+
@layer base {
|
|
206
|
+
* {
|
|
207
|
+
border-color: var(--border);
|
|
208
|
+
}
|
|
205
209
|
}
|
|
206
210
|
|
|
207
211
|
body {
|
package/templates/proxy.ts
CHANGED
|
@@ -64,9 +64,48 @@ function isPublicPath(pathname: string): boolean {
|
|
|
64
64
|
)
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Identity headers this proxy injects for downstream server code.
|
|
69
|
+
*
|
|
70
|
+
* SECURITY (#87): these headers are trusted by RSC layouts and permission
|
|
71
|
+
* checks, so an inbound value must NEVER reach the app. They are stripped from
|
|
72
|
+
* every request before any path branching and re-added only from the verified
|
|
73
|
+
* session. Gating the strip on protected prefixes is not enough: Next.js
|
|
74
|
+
* dispatches Server Actions by the `Next-Action` header, not by the URL, so an
|
|
75
|
+
* action can be POSTed to a public path with a forged `x-user-id`.
|
|
76
|
+
*/
|
|
77
|
+
const TRUSTED_IDENTITY_HEADERS = ['x-user-id', 'x-user-email', 'x-pathname'] as const
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Build the request headers forwarded to the app: inbound copy minus every
|
|
81
|
+
* trusted identity header, plus the real pathname.
|
|
82
|
+
*/
|
|
83
|
+
function sanitizeRequestHeaders(request: NextRequest): Headers {
|
|
84
|
+
const headers = new Headers(request.headers)
|
|
85
|
+
for (const name of TRUSTED_IDENTITY_HEADERS) {
|
|
86
|
+
headers.delete(name)
|
|
87
|
+
}
|
|
88
|
+
headers.set('x-pathname', request.nextUrl.pathname)
|
|
89
|
+
return headers
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Continue to the app with the (sanitized) request headers.
|
|
94
|
+
* Every pass-through in this proxy MUST go through here so the strip applies
|
|
95
|
+
* to public paths, /api/v1 and unmatched routes alike.
|
|
96
|
+
*/
|
|
97
|
+
function passThrough(requestHeaders: Headers): NextResponse {
|
|
98
|
+
return NextResponse.next({
|
|
99
|
+
request: { headers: requestHeaders },
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
|
|
67
103
|
export async function proxy(request: NextRequest) {
|
|
68
104
|
const { pathname } = request.nextUrl
|
|
69
105
|
|
|
106
|
+
// 0. Strip forgeable identity headers before ANY branching (see #87)
|
|
107
|
+
const requestHeaders = sanitizeRequestHeaders(request)
|
|
108
|
+
|
|
70
109
|
// 1. Check for theme middleware override
|
|
71
110
|
const activeTheme = process.env.NEXT_PUBLIC_ACTIVE_THEME
|
|
72
111
|
if (activeTheme && hasThemeMiddleware(activeTheme)) {
|
|
@@ -114,17 +153,17 @@ export async function proxy(request: NextRequest) {
|
|
|
114
153
|
return NextResponse.redirect(loginUrl)
|
|
115
154
|
}
|
|
116
155
|
}
|
|
117
|
-
return
|
|
156
|
+
return passThrough(requestHeaders)
|
|
118
157
|
}
|
|
119
158
|
|
|
120
159
|
// 4. Allow public paths
|
|
121
160
|
if (isPublicPath(pathname)) {
|
|
122
|
-
return
|
|
161
|
+
return passThrough(requestHeaders)
|
|
123
162
|
}
|
|
124
163
|
|
|
125
164
|
// 5. API v1 routes handle their own dual authentication
|
|
126
165
|
if (pathname.startsWith('/api/v1')) {
|
|
127
|
-
return
|
|
166
|
+
return passThrough(requestHeaders)
|
|
128
167
|
}
|
|
129
168
|
|
|
130
169
|
// 6. Protected routes - require authentication and inject user headers
|
|
@@ -162,20 +201,17 @@ export async function proxy(request: NextRequest) {
|
|
|
162
201
|
}
|
|
163
202
|
}
|
|
164
203
|
|
|
165
|
-
// Inject user headers for downstream use
|
|
204
|
+
// Inject user headers for downstream use, ONLY from the verified session
|
|
205
|
+
// (requestHeaders already had any inbound values stripped).
|
|
166
206
|
// IMPORTANT: EntityPermissionLayout depends on these headers
|
|
167
|
-
const requestHeaders = new Headers(request.headers)
|
|
168
207
|
if (session.user?.id) {
|
|
169
208
|
requestHeaders.set('x-user-id', session.user.id)
|
|
170
209
|
}
|
|
171
210
|
if (session.user?.email) {
|
|
172
211
|
requestHeaders.set('x-user-email', session.user.email)
|
|
173
212
|
}
|
|
174
|
-
requestHeaders.set('x-pathname', pathname)
|
|
175
213
|
|
|
176
|
-
return
|
|
177
|
-
request: { headers: requestHeaders },
|
|
178
|
-
})
|
|
214
|
+
return passThrough(requestHeaders)
|
|
179
215
|
} catch (error) {
|
|
180
216
|
console.error('Proxy error:', error)
|
|
181
217
|
const loginUrl = new URL('/login', request.url)
|
|
@@ -184,7 +220,7 @@ export async function proxy(request: NextRequest) {
|
|
|
184
220
|
}
|
|
185
221
|
}
|
|
186
222
|
|
|
187
|
-
return
|
|
223
|
+
return passThrough(requestHeaders)
|
|
188
224
|
}
|
|
189
225
|
|
|
190
226
|
export const config = {
|
package/templates/tsconfig.json
CHANGED
|
@@ -56,6 +56,10 @@
|
|
|
56
56
|
],
|
|
57
57
|
"exclude": [
|
|
58
58
|
"node_modules",
|
|
59
|
+
// PPR template variants (layout.ppr.tsx) are copied over layout.tsx when a project
|
|
60
|
+
// enables cacheComponents; in place they import registry exports that only exist
|
|
61
|
+
// in PPR mode, so they are never type-checked as-is.
|
|
62
|
+
"**/*.ppr.tsx",
|
|
59
63
|
"**/*.test.ts",
|
|
60
64
|
"**/*.test.tsx",
|
|
61
65
|
"**/*.spec.ts",
|
|
@@ -36,3 +36,26 @@ export const TEAM_PERMISSIONS_BY_ROLE: Record<string, string[]> = {
|
|
|
36
36
|
member: ['team.view', 'team.members.view'],
|
|
37
37
|
viewer: ['team.view'],
|
|
38
38
|
}
|
|
39
|
+
|
|
40
|
+
// Entity permissions used by service tests (mirrors the default theme's customers entity)
|
|
41
|
+
const ENTITY_PERMISSIONS_BY_ROLE: Record<string, string[]> = {
|
|
42
|
+
owner: ['customers.create', 'customers.read', 'customers.list', 'customers.update', 'customers.delete'],
|
|
43
|
+
admin: ['customers.create', 'customers.read', 'customers.list', 'customers.update'],
|
|
44
|
+
editor: ['customers.read', 'customers.list'],
|
|
45
|
+
member: ['customers.read', 'customers.list'],
|
|
46
|
+
viewer: [],
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const ROLE_PERMISSIONS_ARRAY: Record<string, string[]> = Object.fromEntries(
|
|
50
|
+
AVAILABLE_ROLES.map((role) => [
|
|
51
|
+
role,
|
|
52
|
+
[...(TEAM_PERMISSIONS_BY_ROLE[role] ?? []), ...(ENTITY_PERMISSIONS_BY_ROLE[role] ?? [])],
|
|
53
|
+
])
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
export const PERMISSIONS_BY_ROLE: Record<string, Set<string>> = Object.fromEntries(
|
|
57
|
+
Object.entries(ROLE_PERMISSIONS_ARRAY).map(([role, perms]) => [role, new Set(perms)])
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
export const ALL_PERMISSIONS: string[] = Array.from(new Set(Object.values(ROLE_PERMISSIONS_ARRAY).flat()))
|
|
61
|
+
export const ALL_PERMISSIONS_SET: Set<string> = new Set(ALL_PERMISSIONS)
|
|
@@ -9,6 +9,14 @@ class MockNextRequest {
|
|
|
9
9
|
this.method = options.method || 'GET'
|
|
10
10
|
this.headers = new Map(Object.entries(options.headers || {}))
|
|
11
11
|
this._body = options.body
|
|
12
|
+
// Minimal nextUrl (pathname/origin/searchParams/clone) for proxy/middleware tests
|
|
13
|
+
try {
|
|
14
|
+
const parsed = new URL(url, 'http://localhost')
|
|
15
|
+
parsed.clone = () => new URL(parsed.toString())
|
|
16
|
+
this.nextUrl = parsed
|
|
17
|
+
} catch {
|
|
18
|
+
this.nextUrl = undefined
|
|
19
|
+
}
|
|
12
20
|
}
|
|
13
21
|
|
|
14
22
|
async json() {
|
|
@@ -48,6 +56,22 @@ class MockNextResponse {
|
|
|
48
56
|
headers: { 'Content-Type': 'application/json', ...options.headers }
|
|
49
57
|
})
|
|
50
58
|
}
|
|
59
|
+
|
|
60
|
+
// Pass-through response. Keeps the forwarded request headers (if any) so
|
|
61
|
+
// middleware/proxy tests can assert what reaches the app.
|
|
62
|
+
static next(init = {}) {
|
|
63
|
+
const response = new MockNextResponse(null, { status: 200, headers: init.headers })
|
|
64
|
+
response.type = 'next'
|
|
65
|
+
response.requestHeaders = init.request && init.request.headers ? init.request.headers : null
|
|
66
|
+
return response
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static redirect(url, status = 307) {
|
|
70
|
+
const response = new MockNextResponse(null, { status, headers: { Location: String(url) } })
|
|
71
|
+
response.type = 'redirect'
|
|
72
|
+
response.redirectUrl = String(url)
|
|
73
|
+
return response
|
|
74
|
+
}
|
|
51
75
|
}
|
|
52
76
|
|
|
53
77
|
module.exports = {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/hooks/useAuth.d.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/lib/api/auth.d.js
DELETED
|
File without changes
|
package/dist/lib/api/cache.d.js
DELETED
|
File without changes
|
package/dist/lib/api/keys.d.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/lib/auth.d.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/lib/db.d.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { registerScheduledAction, getActionHandler, getAllRegisteredActions, isActionRegistered, clearActionRegistry } from "./registry.js";
|
|
2
|
-
import { scheduleAction, scheduleRecurringAction, cancelScheduledAction } from "./scheduler.js";
|
|
3
|
-
import { processPendingActions } from "./processor.js";
|
|
4
|
-
import { cleanupOldActions } from "./cleanup.js";
|
|
5
|
-
import { initializeScheduledActions, initializeRecurringActions } from "./initializer.js";
|
|
6
|
-
export {
|
|
7
|
-
cancelScheduledAction,
|
|
8
|
-
cleanupOldActions,
|
|
9
|
-
clearActionRegistry,
|
|
10
|
-
getActionHandler,
|
|
11
|
-
getAllRegisteredActions,
|
|
12
|
-
initializeRecurringActions,
|
|
13
|
-
initializeScheduledActions,
|
|
14
|
-
isActionRegistered,
|
|
15
|
-
processPendingActions,
|
|
16
|
-
registerScheduledAction,
|
|
17
|
-
scheduleAction,
|
|
18
|
-
scheduleRecurringAction
|
|
19
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "server-only";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { UserService } from "./user.service.js";
|
|
2
|
-
import { MetaService } from "./meta.service.js";
|
|
3
|
-
import { PlanService } from "./plan.service.js";
|
|
4
|
-
import { SubscriptionService } from "./subscription.service.js";
|
|
5
|
-
import { UsageService } from "./usage.service.js";
|
|
6
|
-
import { InvoiceService } from "./invoice.service.js";
|
|
7
|
-
import { TeamService } from "./team.service.js";
|
|
8
|
-
import { TeamMemberService } from "./team-member.service.js";
|
|
9
|
-
import { PermissionService } from "./permission.service.js";
|
|
10
|
-
import { MembershipService, TeamMembership } from "./membership.service.js";
|
|
11
|
-
import { ThemeService } from "./theme.service.js";
|
|
12
|
-
import { EntityTypeService } from "./entity-type.service.js";
|
|
13
|
-
import { NamespaceService } from "./namespace.service.js";
|
|
14
|
-
import { MiddlewareService } from "./middleware.service.js";
|
|
15
|
-
import { ScopeService } from "./scope.service.js";
|
|
16
|
-
import { RouteHandlerService } from "./route-handler.service.js";
|
|
17
|
-
import { PluginService, usePlugin } from "./plugin.service.js";
|
|
18
|
-
import { ApiRoutesService } from "./api-routes.service.js";
|
|
19
|
-
export {
|
|
20
|
-
ApiRoutesService,
|
|
21
|
-
EntityTypeService,
|
|
22
|
-
InvoiceService,
|
|
23
|
-
MembershipService,
|
|
24
|
-
MetaService,
|
|
25
|
-
MiddlewareService,
|
|
26
|
-
NamespaceService,
|
|
27
|
-
PermissionService,
|
|
28
|
-
PlanService,
|
|
29
|
-
PluginService,
|
|
30
|
-
RouteHandlerService,
|
|
31
|
-
ScopeService,
|
|
32
|
-
SubscriptionService,
|
|
33
|
-
TeamMemberService,
|
|
34
|
-
TeamMembership,
|
|
35
|
-
TeamService,
|
|
36
|
-
ThemeService,
|
|
37
|
-
UsageService,
|
|
38
|
-
UserService,
|
|
39
|
-
usePlugin
|
|
40
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|