@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
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
handleCorsPreflightRequest,
|
|
8
8
|
addCorsHeaders
|
|
9
9
|
} from '@nextsparkjs/core/lib/api/helpers';
|
|
10
|
-
import { authenticateRequest,
|
|
10
|
+
import { authenticateRequest, createAuthFailureResponse, resolveTeamContext } from '@nextsparkjs/core/lib/api/auth/dual-auth';
|
|
11
11
|
import { ApiKeyManager, API_SCOPES, API_KEY_LIMITS } from '@nextsparkjs/core/lib/api/keys';
|
|
12
12
|
import { validateScopesForUser } from '@nextsparkjs/core/lib/api/auth';
|
|
13
13
|
import { withRateLimitTier } from '@nextsparkjs/core/lib/api/rate-limit';
|
|
@@ -20,36 +20,25 @@ const createApiKeySchema = z.object({
|
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
// Handle CORS preflight
|
|
23
|
-
export async function OPTIONS() {
|
|
24
|
-
return handleCorsPreflightRequest();
|
|
23
|
+
export async function OPTIONS(request: NextRequest) {
|
|
24
|
+
return handleCorsPreflightRequest(request);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// GET /api/v1/api-keys - List user's API keys with dual auth
|
|
28
28
|
export const GET = withRateLimitTier(withApiLogging(async (req: NextRequest): Promise<NextResponse> => {
|
|
29
29
|
try {
|
|
30
|
-
// Authenticate using dual auth
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
// Authenticate using dual auth. Session users have admin access; API keys
|
|
31
|
+
// need the scope declared here, enforced at the entry point (#93).
|
|
32
|
+
const authResult = await authenticateRequest(req, { requiredScope: 'admin:api-keys' });
|
|
33
|
+
|
|
33
34
|
if (!authResult.success) {
|
|
34
|
-
return
|
|
35
|
-
{ success: false, error: 'Authentication required', code: 'AUTHENTICATION_FAILED' },
|
|
36
|
-
{ status: 401 }
|
|
37
|
-
);
|
|
35
|
+
return createAuthFailureResponse(authResult);
|
|
38
36
|
}
|
|
39
37
|
|
|
40
38
|
if (authResult.rateLimitResponse) {
|
|
41
39
|
return authResult.rateLimitResponse as NextResponse;
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
// Check required permissions - session users have admin access, API key users need specific scope
|
|
45
|
-
const hasPermission = authResult.type === 'session' ||
|
|
46
|
-
(authResult.type === 'api-key' && hasRequiredScope(authResult, 'admin:api-keys'));
|
|
47
|
-
|
|
48
|
-
if (!hasPermission) {
|
|
49
|
-
const response = createApiError('Insufficient permissions. Admin access required for API key management.', 403);
|
|
50
|
-
return addCorsHeaders(response);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
42
|
const apiKeys = await queryWithRLS<{
|
|
54
43
|
id: string;
|
|
55
44
|
keyPrefix: string;
|
|
@@ -125,40 +114,29 @@ export const GET = withRateLimitTier(withApiLogging(async (req: NextRequest): Pr
|
|
|
125
114
|
}));
|
|
126
115
|
|
|
127
116
|
const response = createApiResponse(keysWithStats);
|
|
128
|
-
return addCorsHeaders(response);
|
|
117
|
+
return addCorsHeaders(response, req);
|
|
129
118
|
} catch (error) {
|
|
130
119
|
console.error('Error fetching API keys:', error);
|
|
131
120
|
const response = createApiError('Internal server error', 500);
|
|
132
|
-
return addCorsHeaders(response);
|
|
121
|
+
return addCorsHeaders(response, req);
|
|
133
122
|
}
|
|
134
123
|
}), 'strict');
|
|
135
124
|
|
|
136
125
|
// POST /api/v1/api-keys - Create new API key with dual auth
|
|
137
126
|
export const POST = withRateLimitTier(withApiLogging(async (req: NextRequest): Promise<NextResponse> => {
|
|
138
127
|
try {
|
|
139
|
-
// Authenticate using dual auth
|
|
140
|
-
|
|
141
|
-
|
|
128
|
+
// Authenticate using dual auth. Session users have admin access; API keys
|
|
129
|
+
// need the scope declared here, enforced at the entry point (#93).
|
|
130
|
+
const authResult = await authenticateRequest(req, { requiredScope: 'admin:api-keys' });
|
|
131
|
+
|
|
142
132
|
if (!authResult.success) {
|
|
143
|
-
return
|
|
144
|
-
{ success: false, error: 'Authentication required', code: 'AUTHENTICATION_FAILED' },
|
|
145
|
-
{ status: 401 }
|
|
146
|
-
);
|
|
133
|
+
return createAuthFailureResponse(authResult);
|
|
147
134
|
}
|
|
148
135
|
|
|
149
136
|
if (authResult.rateLimitResponse) {
|
|
150
137
|
return authResult.rateLimitResponse as NextResponse;
|
|
151
138
|
}
|
|
152
139
|
|
|
153
|
-
// Check required permissions - session users have admin access, API key users need specific scope
|
|
154
|
-
const hasPermission = authResult.type === 'session' ||
|
|
155
|
-
(authResult.type === 'api-key' && hasRequiredScope(authResult, 'admin:api-keys'));
|
|
156
|
-
|
|
157
|
-
if (!hasPermission) {
|
|
158
|
-
const response = createApiError('Insufficient permissions. Admin access required for API key management.', 403);
|
|
159
|
-
return addCorsHeaders(response);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
140
|
const body = await req.json();
|
|
163
141
|
const validatedData = createApiKeySchema.parse(body);
|
|
164
142
|
|
|
@@ -174,7 +152,7 @@ export const POST = withRateLimitTier(withApiLogging(async (req: NextRequest): P
|
|
|
174
152
|
},
|
|
175
153
|
'INVALID_SCOPES'
|
|
176
154
|
);
|
|
177
|
-
return addCorsHeaders(response);
|
|
155
|
+
return addCorsHeaders(response, req);
|
|
178
156
|
}
|
|
179
157
|
|
|
180
158
|
// Validar que el usuario pueda crear API keys con estos scopes.
|
|
@@ -201,7 +179,7 @@ export const POST = withRateLimitTier(withApiLogging(async (req: NextRequest): P
|
|
|
201
179
|
},
|
|
202
180
|
'INSUFFICIENT_SCOPE_PERMISSIONS'
|
|
203
181
|
);
|
|
204
|
-
return addCorsHeaders(response);
|
|
182
|
+
return addCorsHeaders(response, req);
|
|
205
183
|
}
|
|
206
184
|
|
|
207
185
|
// Verificar límite de API keys por usuario (máximo 10)
|
|
@@ -218,7 +196,7 @@ export const POST = withRateLimitTier(withApiLogging(async (req: NextRequest): P
|
|
|
218
196
|
null,
|
|
219
197
|
'API_KEY_LIMIT_REACHED'
|
|
220
198
|
);
|
|
221
|
-
return addCorsHeaders(response);
|
|
199
|
+
return addCorsHeaders(response, req);
|
|
222
200
|
}
|
|
223
201
|
|
|
224
202
|
// Generar API key
|
|
@@ -249,15 +227,15 @@ export const POST = withRateLimitTier(withApiLogging(async (req: NextRequest): P
|
|
|
249
227
|
};
|
|
250
228
|
|
|
251
229
|
const response = createApiResponse(responseData, { created: true }, 201);
|
|
252
|
-
return addCorsHeaders(response);
|
|
230
|
+
return addCorsHeaders(response, req);
|
|
253
231
|
} catch (error) {
|
|
254
232
|
if (error instanceof z.ZodError) {
|
|
255
233
|
const response = createApiError('Validation error', 400, error.issues, 'VALIDATION_ERROR');
|
|
256
|
-
return addCorsHeaders(response);
|
|
234
|
+
return addCorsHeaders(response, req);
|
|
257
235
|
}
|
|
258
236
|
|
|
259
237
|
console.error('Error creating API key:', error);
|
|
260
238
|
const response = createApiError('Internal server error', 500);
|
|
261
|
-
return addCorsHeaders(response);
|
|
239
|
+
return addCorsHeaders(response, req);
|
|
262
240
|
}
|
|
263
241
|
}), 'strict');
|
|
@@ -14,8 +14,8 @@ import { withSignupContext } from '@nextsparkjs/core/lib/auth-context'
|
|
|
14
14
|
import { withRateLimitTier } from '@nextsparkjs/core/lib/api/rate-limit'
|
|
15
15
|
|
|
16
16
|
// Handle CORS preflight
|
|
17
|
-
export async function OPTIONS() {
|
|
18
|
-
return handleCorsPreflightRequest()
|
|
17
|
+
export async function OPTIONS(request: NextRequest) {
|
|
18
|
+
return handleCorsPreflightRequest(request)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
interface SignupWithInviteBody {
|
|
@@ -41,14 +41,14 @@ export const POST = withRateLimitTier(withApiLogging(
|
|
|
41
41
|
null,
|
|
42
42
|
'MISSING_FIELDS'
|
|
43
43
|
)
|
|
44
|
-
return addCorsHeaders(response)
|
|
44
|
+
return addCorsHeaders(response, req)
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// Validate email format
|
|
48
48
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
|
|
49
49
|
if (!emailRegex.test(email)) {
|
|
50
50
|
const response = createApiError('Invalid email format', 400, null, 'INVALID_EMAIL')
|
|
51
|
-
return addCorsHeaders(response)
|
|
51
|
+
return addCorsHeaders(response, req)
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
// Validate password length (min 8 characters as per Better Auth config)
|
|
@@ -59,7 +59,7 @@ export const POST = withRateLimitTier(withApiLogging(
|
|
|
59
59
|
null,
|
|
60
60
|
'INVALID_PASSWORD'
|
|
61
61
|
)
|
|
62
|
-
return addCorsHeaders(response)
|
|
62
|
+
return addCorsHeaders(response, req)
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
// Step 1: Validate the invitation token via the service pool (RLS bypass).
|
|
@@ -76,7 +76,7 @@ export const POST = withRateLimitTier(withApiLogging(
|
|
|
76
76
|
|
|
77
77
|
if (!invitation) {
|
|
78
78
|
const response = createApiError('Invitation not found', 404, null, 'INVITATION_NOT_FOUND')
|
|
79
|
-
return addCorsHeaders(response)
|
|
79
|
+
return addCorsHeaders(response, req)
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
// Verify invitation is for the correct email
|
|
@@ -87,7 +87,7 @@ export const POST = withRateLimitTier(withApiLogging(
|
|
|
87
87
|
null,
|
|
88
88
|
'EMAIL_MISMATCH'
|
|
89
89
|
)
|
|
90
|
-
return addCorsHeaders(response)
|
|
90
|
+
return addCorsHeaders(response, req)
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
// Check if invitation is pending
|
|
@@ -98,14 +98,14 @@ export const POST = withRateLimitTier(withApiLogging(
|
|
|
98
98
|
null,
|
|
99
99
|
'INVITATION_NOT_PENDING'
|
|
100
100
|
)
|
|
101
|
-
return addCorsHeaders(response)
|
|
101
|
+
return addCorsHeaders(response, req)
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
// Check if invitation has expired
|
|
105
105
|
const expiresAt = new Date(invitation.expiresAt)
|
|
106
106
|
if (expiresAt < new Date()) {
|
|
107
107
|
const response = createApiError('Invitation has expired', 410, null, 'INVITATION_EXPIRED')
|
|
108
|
-
return addCorsHeaders(response)
|
|
108
|
+
return addCorsHeaders(response, req)
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
// Step 2: Create user using Better Auth's internal API
|
|
@@ -144,7 +144,7 @@ export const POST = withRateLimitTier(withApiLogging(
|
|
|
144
144
|
null,
|
|
145
145
|
'USER_ALREADY_EXISTS'
|
|
146
146
|
)
|
|
147
|
-
return addCorsHeaders(response)
|
|
147
|
+
return addCorsHeaders(response, req)
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
const response = createApiError(
|
|
@@ -153,7 +153,7 @@ export const POST = withRateLimitTier(withApiLogging(
|
|
|
153
153
|
null,
|
|
154
154
|
'SIGNUP_FAILED'
|
|
155
155
|
)
|
|
156
|
-
return addCorsHeaders(response)
|
|
156
|
+
return addCorsHeaders(response, req)
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
// Parse response to get user data
|
|
@@ -167,7 +167,7 @@ export const POST = withRateLimitTier(withApiLogging(
|
|
|
167
167
|
null,
|
|
168
168
|
'SIGNUP_FAILED'
|
|
169
169
|
)
|
|
170
|
-
return addCorsHeaders(response)
|
|
170
|
+
return addCorsHeaders(response, req)
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
// Steps 3-4 run via the service pool (RLS bypass). This is a trusted
|
|
@@ -228,7 +228,7 @@ export const POST = withRateLimitTier(withApiLogging(
|
|
|
228
228
|
{ created: true },
|
|
229
229
|
201
|
|
230
230
|
)
|
|
231
|
-
return addCorsHeaders(response)
|
|
231
|
+
return addCorsHeaders(response, req)
|
|
232
232
|
} catch (error) {
|
|
233
233
|
await tx.rollback()
|
|
234
234
|
throw error
|
|
@@ -236,7 +236,7 @@ export const POST = withRateLimitTier(withApiLogging(
|
|
|
236
236
|
} catch (error) {
|
|
237
237
|
console.error('Error in signup-with-invite:', error)
|
|
238
238
|
const response = createApiError('Internal server error', 500)
|
|
239
|
-
return addCorsHeaders(response)
|
|
239
|
+
return addCorsHeaders(response, req)
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
), 'auth')
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { NextRequest, NextResponse } from 'next/server'
|
|
11
11
|
import { z } from 'zod'
|
|
12
|
-
import { authenticateRequest,
|
|
12
|
+
import { authenticateRequest, createAuthFailureResponse } from '@nextsparkjs/core/lib/api/auth/dual-auth'
|
|
13
13
|
import { SubscriptionService, MembershipService } from '@nextsparkjs/core/lib/services'
|
|
14
14
|
import { getBillingGateway } from '@nextsparkjs/core/lib/billing/gateways/factory'
|
|
15
15
|
import { queryWithRLS } from '@nextsparkjs/core/lib/db'
|
|
@@ -29,11 +29,12 @@ const cancelSchema = z.object({
|
|
|
29
29
|
* - reason: string (optional) - Reason for cancellation (stored in metadata)
|
|
30
30
|
*/
|
|
31
31
|
export const POST = withRateLimitTier(async (request: NextRequest) => {
|
|
32
|
-
// 1. Dual authentication
|
|
33
|
-
|
|
32
|
+
// 1. Dual authentication; the API-key scope is declared at the entry
|
|
33
|
+
// point, which fails closed for keys that lack it (#93).
|
|
34
|
+
const authResult = await authenticateRequest(request, { requiredScope: 'billing:write' })
|
|
34
35
|
|
|
35
36
|
if (!authResult.success || !authResult.user) {
|
|
36
|
-
return
|
|
37
|
+
return createAuthFailureResponse(authResult)
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
// 2. Get team context
|
|
@@ -104,7 +105,7 @@ export const POST = withRateLimitTier(async (request: NextRequest) => {
|
|
|
104
105
|
|
|
105
106
|
// 6. Cancel via billing gateway
|
|
106
107
|
try {
|
|
107
|
-
const gateway = getBillingGateway()
|
|
108
|
+
const gateway = await getBillingGateway()
|
|
108
109
|
if (immediate) {
|
|
109
110
|
await gateway.cancelSubscriptionImmediately(subscription.externalSubscriptionId)
|
|
110
111
|
} else {
|
|
@@ -171,7 +172,7 @@ async function handleReactivation(teamId: string) {
|
|
|
171
172
|
}
|
|
172
173
|
|
|
173
174
|
try {
|
|
174
|
-
const gateway = getBillingGateway()
|
|
175
|
+
const gateway = await getBillingGateway()
|
|
175
176
|
await gateway.reactivateSubscription(subscription.externalSubscriptionId)
|
|
176
177
|
|
|
177
178
|
// Update local DB
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { NextRequest, NextResponse } from 'next/server'
|
|
11
11
|
import { z } from 'zod'
|
|
12
|
-
import { authenticateRequest,
|
|
12
|
+
import { authenticateRequest, createAuthFailureResponse } from '@nextsparkjs/core/lib/api/auth/dual-auth'
|
|
13
13
|
import { SubscriptionService, MembershipService } from '@nextsparkjs/core/lib/services'
|
|
14
14
|
import { withRateLimitTier } from '@nextsparkjs/core/lib/api/rate-limit'
|
|
15
15
|
|
|
@@ -27,11 +27,12 @@ const changePlanSchema = z.object({
|
|
|
27
27
|
* - billingInterval: 'monthly' | 'yearly' (default: monthly)
|
|
28
28
|
*/
|
|
29
29
|
export const POST = withRateLimitTier(async (request: NextRequest) => {
|
|
30
|
-
// 1. Dual authentication
|
|
31
|
-
|
|
30
|
+
// 1. Dual authentication; the API-key scope is declared at the entry
|
|
31
|
+
// point, which fails closed for keys that lack it (#93).
|
|
32
|
+
const authResult = await authenticateRequest(request, { requiredScope: 'billing:write' })
|
|
32
33
|
|
|
33
34
|
if (!authResult.success || !authResult.user) {
|
|
34
|
-
return
|
|
35
|
+
return createAuthFailureResponse(authResult)
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
// 2. Get team context
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { NextRequest, NextResponse } from 'next/server'
|
|
13
|
-
import { authenticateRequest,
|
|
13
|
+
import { authenticateRequest, createAuthFailureResponse } from '@nextsparkjs/core/lib/api/auth/dual-auth'
|
|
14
14
|
import { SubscriptionService } from '@nextsparkjs/core/lib/services'
|
|
15
15
|
import { z } from 'zod'
|
|
16
16
|
import { withRateLimitTier } from '@nextsparkjs/core/lib/api/rate-limit'
|
|
@@ -21,11 +21,13 @@ const checkActionSchema = z.object({
|
|
|
21
21
|
})
|
|
22
22
|
|
|
23
23
|
export const POST = withRateLimitTier(async (request: NextRequest) => {
|
|
24
|
-
// 1. Dual authentication (API Key OR Session)
|
|
25
|
-
|
|
24
|
+
// 1. Dual authentication (API Key OR Session); the API-key scope is
|
|
25
|
+
// declared at the entry point, which fails closed for keys that lack it
|
|
26
|
+
// (#93).
|
|
27
|
+
const authResult = await authenticateRequest(request, { requiredScope: 'billing:read' })
|
|
26
28
|
|
|
27
29
|
if (!authResult.success || !authResult.user) {
|
|
28
|
-
return
|
|
30
|
+
return createAuthFailureResponse(authResult)
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
// 2. Parse and validate request body
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { NextRequest, NextResponse } from 'next/server'
|
|
11
|
-
import { authenticateRequest,
|
|
11
|
+
import { authenticateRequest, createAuthFailureResponse } from '@nextsparkjs/core/lib/api/auth/dual-auth'
|
|
12
12
|
import { getBillingGateway } from '@nextsparkjs/core/lib/billing/gateways/factory'
|
|
13
13
|
import { SubscriptionService, MembershipService } from '@nextsparkjs/core/lib/services'
|
|
14
14
|
import { z } from 'zod'
|
|
@@ -20,11 +20,12 @@ const checkoutSchema = z.object({
|
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
export const POST = withRateLimitTier(async (request: NextRequest) => {
|
|
23
|
-
// 1. Dual authentication
|
|
24
|
-
|
|
23
|
+
// 1. Dual authentication; the API-key scope is declared at the entry
|
|
24
|
+
// point, which fails closed for keys that lack it (#93).
|
|
25
|
+
const authResult = await authenticateRequest(request, { requiredScope: 'billing:write' })
|
|
25
26
|
|
|
26
27
|
if (!authResult.success || !authResult.user) {
|
|
27
|
-
return
|
|
28
|
+
return createAuthFailureResponse(authResult)
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
// 2. Parse and validate request body
|
|
@@ -121,7 +122,8 @@ export const POST = withRateLimitTier(async (request: NextRequest) => {
|
|
|
121
122
|
const successUrl = `${appUrl}/dashboard/settings/billing?success=true`
|
|
122
123
|
const cancelUrl = `${appUrl}/dashboard/settings/billing?canceled=true`
|
|
123
124
|
|
|
124
|
-
const
|
|
125
|
+
const gateway = await getBillingGateway()
|
|
126
|
+
const session = await gateway.createCheckoutSession({
|
|
125
127
|
teamId,
|
|
126
128
|
planSlug,
|
|
127
129
|
billingPeriod,
|
|
@@ -14,16 +14,10 @@ import { withRateLimitTier } from '@nextsparkjs/core/lib/api/rate-limit'
|
|
|
14
14
|
|
|
15
15
|
export const GET = withRateLimitTier(async (request: NextRequest) => {
|
|
16
16
|
// Plans list is partially public (public plans visible to all, hidden plans only to superadmin)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// Check if user is superadmin (for full access including hidden plans)
|
|
22
|
-
includeHidden = auth.scopes.includes('*') || auth.scopes.includes('superadmin:all')
|
|
23
|
-
} catch {
|
|
24
|
-
// Not authenticated, only show public plans
|
|
25
|
-
includeHidden = false
|
|
26
|
-
}
|
|
17
|
+
// Anonymous callers resolve to a null auth (#112) and only see public plans.
|
|
18
|
+
// Public listing: any valid API key may call this; only the `*` scope unlocks hidden plans, decided below (#93).
|
|
19
|
+
const { auth } = await validateAndAuthenticateRequest(request, { allowAnyScope: true })
|
|
20
|
+
const includeHidden = !!auth && (auth.scopes.includes('*') || auth.scopes.includes('superadmin:all'))
|
|
27
21
|
|
|
28
22
|
try {
|
|
29
23
|
const plans = await PlanService.list({ includeHidden })
|
|
@@ -35,9 +29,11 @@ export const GET = withRateLimitTier(async (request: NextRequest) => {
|
|
|
35
29
|
}, 'read');
|
|
36
30
|
|
|
37
31
|
export const POST = withRateLimitTier(async (request: NextRequest) => {
|
|
38
|
-
// Authenticate request
|
|
39
|
-
|
|
32
|
+
// Authenticate request; the API-key scope is declared at the entry point,
|
|
33
|
+
// which fails closed for keys that lack it (#93).
|
|
34
|
+
const { auth, rateLimitResponse, errorResponse } = await validateAndAuthenticateRequest(request, { requiredScope: 'billing:write' })
|
|
40
35
|
if (rateLimitResponse) return rateLimitResponse
|
|
36
|
+
if (!auth) return errorResponse ?? createApiError('Authentication required', 401, undefined, 'AUTHENTICATION_REQUIRED')
|
|
41
37
|
|
|
42
38
|
// Check superadmin permission
|
|
43
39
|
if (!auth.scopes.includes('*') && !auth.scopes.includes('superadmin:all')) {
|
|
@@ -8,17 +8,18 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { NextRequest, NextResponse } from 'next/server'
|
|
11
|
-
import { authenticateRequest,
|
|
11
|
+
import { authenticateRequest, createAuthFailureResponse } from '@nextsparkjs/core/lib/api/auth/dual-auth'
|
|
12
12
|
import { getBillingGateway } from '@nextsparkjs/core/lib/billing/gateways/factory'
|
|
13
13
|
import { SubscriptionService, MembershipService } from '@nextsparkjs/core/lib/services'
|
|
14
14
|
import { withRateLimitTier } from '@nextsparkjs/core/lib/api/rate-limit'
|
|
15
15
|
|
|
16
16
|
export const POST = withRateLimitTier(async (request: NextRequest) => {
|
|
17
|
-
// 1. Dual authentication
|
|
18
|
-
|
|
17
|
+
// 1. Dual authentication; the API-key scope is declared at the entry
|
|
18
|
+
// point, which fails closed for keys that lack it (#93).
|
|
19
|
+
const authResult = await authenticateRequest(request, { requiredScope: 'billing:write' })
|
|
19
20
|
|
|
20
21
|
if (!authResult.success || !authResult.user) {
|
|
21
|
-
return
|
|
22
|
+
return createAuthFailureResponse(authResult)
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
// 2. Get team context
|
|
@@ -69,7 +70,8 @@ export const POST = withRateLimitTier(async (request: NextRequest) => {
|
|
|
69
70
|
const appUrl = process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:5173'
|
|
70
71
|
const returnUrl = `${appUrl}/dashboard/settings/billing`
|
|
71
72
|
|
|
72
|
-
const
|
|
73
|
+
const gateway = await getBillingGateway()
|
|
74
|
+
const session = await gateway.createPortalSession({
|
|
73
75
|
customerId: subscription.externalCustomerId,
|
|
74
76
|
returnUrl
|
|
75
77
|
})
|
|
@@ -52,7 +52,7 @@ async function handlePolarWebhook(request: NextRequest): Promise<NextResponse> {
|
|
|
52
52
|
// 2. Verify webhook signature (MANDATORY for security)
|
|
53
53
|
let event: { id: string; type: string; data: Record<string, unknown> }
|
|
54
54
|
try {
|
|
55
|
-
const gateway = getBillingGateway()
|
|
55
|
+
const gateway = await getBillingGateway()
|
|
56
56
|
event = gateway.verifyWebhookSignature(payload, headers)
|
|
57
57
|
} catch (error) {
|
|
58
58
|
console.error('[polar-webhook] Signature verification failed:', error)
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { NextRequest, NextResponse } from 'next/server'
|
|
11
|
-
import { authenticateRequest } from '@nextsparkjs/core/lib/api/auth/dual-auth'
|
|
11
|
+
import { authenticateRequest, createAuthFailureResponse } from '@nextsparkjs/core/lib/api/auth/dual-auth'
|
|
12
12
|
import {
|
|
13
13
|
canAccessDevtoolsApi,
|
|
14
14
|
createDevtoolsAccessDeniedResponse,
|
|
@@ -19,11 +19,12 @@ import { TAGS_REGISTRY, COVERAGE_SUMMARY } from '@nextsparkjs/registries/testing
|
|
|
19
19
|
import { withRateLimitTier } from '@nextsparkjs/core/lib/api/rate-limit'
|
|
20
20
|
|
|
21
21
|
export const GET = withRateLimitTier(async (request: NextRequest) => {
|
|
22
|
-
// Authenticate request
|
|
23
|
-
|
|
22
|
+
// Authenticate request; the API-key scope is declared at the entry point,
|
|
23
|
+
// which fails closed for keys that lack it (#93).
|
|
24
|
+
const authResult = await authenticateRequest(request, { requiredScope: 'admin:devtools' })
|
|
24
25
|
|
|
25
26
|
if (!authResult.success) {
|
|
26
|
-
return createDevtoolsUnauthorizedResponse()
|
|
27
|
+
return authResult.type === 'api-key' ? createAuthFailureResponse(authResult) : createDevtoolsUnauthorizedResponse()
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
// Check DevTools access permission
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { NextRequest, NextResponse } from 'next/server'
|
|
11
|
-
import { authenticateRequest } from '@nextsparkjs/core/lib/api/auth/dual-auth'
|
|
11
|
+
import { authenticateRequest, createAuthFailureResponse } from '@nextsparkjs/core/lib/api/auth/dual-auth'
|
|
12
12
|
import {
|
|
13
13
|
canAccessDevtoolsApi,
|
|
14
14
|
createDevtoolsAccessDeniedResponse,
|
|
@@ -21,11 +21,12 @@ import {
|
|
|
21
21
|
import { withRateLimitTier } from '@nextsparkjs/core/lib/api/rate-limit'
|
|
22
22
|
|
|
23
23
|
export const GET = withRateLimitTier(async (request: NextRequest) => {
|
|
24
|
-
// Authenticate request
|
|
25
|
-
|
|
24
|
+
// Authenticate request; the API-key scope is declared at the entry point,
|
|
25
|
+
// which fails closed for keys that lack it (#93).
|
|
26
|
+
const authResult = await authenticateRequest(request, { requiredScope: 'admin:devtools' })
|
|
26
27
|
|
|
27
28
|
if (!authResult.success) {
|
|
28
|
-
return createDevtoolsUnauthorizedResponse()
|
|
29
|
+
return authResult.type === 'api-key' ? createAuthFailureResponse(authResult) : createDevtoolsUnauthorizedResponse()
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
// Check DevTools access permission
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { NextRequest, NextResponse } from 'next/server'
|
|
11
|
-
import { authenticateRequest } from '@nextsparkjs/core/lib/api/auth/dual-auth'
|
|
11
|
+
import { authenticateRequest, createAuthFailureResponse } from '@nextsparkjs/core/lib/api/auth/dual-auth'
|
|
12
12
|
import {
|
|
13
13
|
canAccessDevtoolsApi,
|
|
14
14
|
createDevtoolsAccessDeniedResponse,
|
|
@@ -21,11 +21,12 @@ import {
|
|
|
21
21
|
import { withRateLimitTier } from '@nextsparkjs/core/lib/api/rate-limit'
|
|
22
22
|
|
|
23
23
|
export const GET = withRateLimitTier(async (request: NextRequest) => {
|
|
24
|
-
// Authenticate request
|
|
25
|
-
|
|
24
|
+
// Authenticate request; the API-key scope is declared at the entry point,
|
|
25
|
+
// which fails closed for keys that lack it (#93).
|
|
26
|
+
const authResult = await authenticateRequest(request, { requiredScope: 'admin:devtools' })
|
|
26
27
|
|
|
27
28
|
if (!authResult.success) {
|
|
28
|
-
return createDevtoolsUnauthorizedResponse()
|
|
29
|
+
return authResult.type === 'api-key' ? createAuthFailureResponse(authResult) : createDevtoolsUnauthorizedResponse()
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
// Check DevTools access permission
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { NextRequest, NextResponse } from 'next/server'
|
|
11
|
-
import { authenticateRequest } from '@nextsparkjs/core/lib/api/auth/dual-auth'
|
|
11
|
+
import { authenticateRequest, createAuthFailureResponse } from '@nextsparkjs/core/lib/api/auth/dual-auth'
|
|
12
12
|
import {
|
|
13
13
|
canAccessDevtoolsApi,
|
|
14
14
|
createDevtoolsAccessDeniedResponse,
|
|
@@ -21,11 +21,12 @@ import { withRateLimitTier } from '@nextsparkjs/core/lib/api/rate-limit'
|
|
|
21
21
|
import { scheduleAction } from '@nextsparkjs/core/lib/scheduled-actions/scheduler'
|
|
22
22
|
|
|
23
23
|
export const GET = withRateLimitTier(async (request: NextRequest) => {
|
|
24
|
-
// Authenticate request
|
|
25
|
-
|
|
24
|
+
// Authenticate request; the API-key scope is declared at the entry point,
|
|
25
|
+
// which fails closed for keys that lack it (#93).
|
|
26
|
+
const authResult = await authenticateRequest(request, { requiredScope: 'admin:devtools' })
|
|
26
27
|
|
|
27
28
|
if (!authResult.success) {
|
|
28
|
-
return createDevtoolsUnauthorizedResponse()
|
|
29
|
+
return authResult.type === 'api-key' ? createAuthFailureResponse(authResult) : createDevtoolsUnauthorizedResponse()
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
// Check DevTools access permission
|
|
@@ -135,11 +136,12 @@ export const GET = withRateLimitTier(async (request: NextRequest) => {
|
|
|
135
136
|
* }
|
|
136
137
|
*/
|
|
137
138
|
export const POST = withRateLimitTier(async (request: NextRequest) => {
|
|
138
|
-
// Authenticate request
|
|
139
|
-
|
|
139
|
+
// Authenticate request; the API-key scope is declared at the entry point,
|
|
140
|
+
// which fails closed for keys that lack it (#93).
|
|
141
|
+
const authResult = await authenticateRequest(request, { requiredScope: 'admin:devtools' })
|
|
140
142
|
|
|
141
143
|
if (!authResult.success) {
|
|
142
|
-
return createDevtoolsUnauthorizedResponse()
|
|
144
|
+
return authResult.type === 'api-key' ? createAuthFailureResponse(authResult) : createDevtoolsUnauthorizedResponse()
|
|
143
145
|
}
|
|
144
146
|
|
|
145
147
|
// Check DevTools access permission
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { NextRequest, NextResponse } from 'next/server'
|
|
11
|
-
import { authenticateRequest } from '@nextsparkjs/core/lib/api/auth/dual-auth'
|
|
11
|
+
import { authenticateRequest, createAuthFailureResponse } from '@nextsparkjs/core/lib/api/auth/dual-auth'
|
|
12
12
|
import {
|
|
13
13
|
canAccessDevtoolsApi,
|
|
14
14
|
createDevtoolsAccessDeniedResponse,
|
|
@@ -20,11 +20,12 @@ import { withRateLimitTier } from '@nextsparkjs/core/lib/api/rate-limit'
|
|
|
20
20
|
import { executeAction } from '@nextsparkjs/core/lib/scheduled-actions/processor'
|
|
21
21
|
|
|
22
22
|
export const POST = withRateLimitTier(async (request: NextRequest) => {
|
|
23
|
-
// Authenticate request
|
|
24
|
-
|
|
23
|
+
// Authenticate request; the API-key scope is declared at the entry point,
|
|
24
|
+
// which fails closed for keys that lack it (#93).
|
|
25
|
+
const authResult = await authenticateRequest(request, { requiredScope: 'admin:devtools' })
|
|
25
26
|
|
|
26
27
|
if (!authResult.success) {
|
|
27
|
-
return createDevtoolsUnauthorizedResponse()
|
|
28
|
+
return authResult.type === 'api-key' ? createAuthFailureResponse(authResult) : createDevtoolsUnauthorizedResponse()
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
// Check DevTools access permission
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { NextRequest, NextResponse } from 'next/server'
|
|
11
|
-
import { authenticateRequest } from '@nextsparkjs/core/lib/api/auth/dual-auth'
|
|
11
|
+
import { authenticateRequest, createAuthFailureResponse } from '@nextsparkjs/core/lib/api/auth/dual-auth'
|
|
12
12
|
import {
|
|
13
13
|
canAccessDevtoolsApi,
|
|
14
14
|
createDevtoolsAccessDeniedResponse,
|
|
@@ -23,11 +23,12 @@ import {
|
|
|
23
23
|
import { withRateLimitTier } from '@nextsparkjs/core/lib/api/rate-limit'
|
|
24
24
|
|
|
25
25
|
export const GET = withRateLimitTier(async (request: NextRequest) => {
|
|
26
|
-
// Authenticate request
|
|
27
|
-
|
|
26
|
+
// Authenticate request; the API-key scope is declared at the entry point,
|
|
27
|
+
// which fails closed for keys that lack it (#93).
|
|
28
|
+
const authResult = await authenticateRequest(request, { requiredScope: 'admin:devtools' })
|
|
28
29
|
|
|
29
30
|
if (!authResult.success) {
|
|
30
|
-
return createDevtoolsUnauthorizedResponse()
|
|
31
|
+
return authResult.type === 'api-key' ? createAuthFailureResponse(authResult) : createDevtoolsUnauthorizedResponse()
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
// Check DevTools access permission
|