@nextsparkjs/core 0.1.0-beta.194 → 0.1.0-beta.196
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 +8 -1
- package/dist/components/app/guards/DeveloperGuard.d.ts.map +1 -1
- package/dist/components/app/guards/DeveloperGuard.js +2 -1
- package/dist/components/app/guards/SuperAdminGuard.d.ts +8 -1
- package/dist/components/app/guards/SuperAdminGuard.d.ts.map +1 -1
- package/dist/components/app/guards/SuperAdminGuard.js +2 -1
- package/dist/components/billing/InvoicesPagination.js +2 -2
- package/dist/components/dashboard/block-editor/block-picker.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/block-picker.js +2 -1
- package/dist/components/dashboard/block-editor/builder-editor-view.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/builder-editor-view.js +39 -23
- package/dist/components/dashboard/block-editor/pattern-reference-preview.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/pattern-reference-preview.js +2 -1
- package/dist/components/dashboard/layouts/AuthGuard.d.ts.map +1 -1
- package/dist/components/dashboard/layouts/AuthGuard.js +3 -4
- package/dist/components/dashboard/layouts/AuthenticatedDashboardLayout.d.ts.map +1 -1
- package/dist/components/dashboard/layouts/AuthenticatedDashboardLayout.js +9 -10
- package/dist/components/dashboard/layouts/DashboardAuthLayout.d.ts.map +1 -1
- package/dist/components/dashboard/layouts/DashboardAuthLayout.js +3 -4
- package/dist/components/dashboard/layouts/DashboardAuthSkeleton.d.ts +2 -2
- package/dist/components/dashboard/navigation/DynamicNavigation.js +2 -2
- package/dist/components/entities/wrappers/EntityDetailWrapper.d.ts.map +1 -1
- package/dist/components/entities/wrappers/EntityDetailWrapper.js +5 -2
- package/dist/components/entities/wrappers/EntityFormWrapper.d.ts.map +1 -1
- package/dist/components/entities/wrappers/EntityFormWrapper.js +5 -2
- package/dist/components/entities/wrappers/EntityListWrapper.d.ts.map +1 -1
- package/dist/components/entities/wrappers/EntityListWrapper.js +5 -2
- package/dist/components/settings/layouts/SettingsSidebar.d.ts.map +1 -1
- package/dist/components/settings/layouts/SettingsSidebar.js +0 -1
- package/dist/components/teams/CreateTeamButton.js +2 -2
- package/dist/components/teams/CreateTeamDialog.js +1 -1
- package/dist/components/teams/InviteMemberButton.js +3 -3
- package/dist/components/teams/InviteMemberDialog.js +1 -1
- package/dist/components/teams/TeamPendingInvitations.js +2 -2
- package/dist/components/ui/relation-display.d.ts.map +1 -1
- package/dist/components/ui/relation-display.js +2 -1
- package/dist/components/ui/user-display.d.ts.map +1 -1
- package/dist/components/ui/user-display.js +2 -1
- package/dist/emails/otp-verification.d.ts.map +1 -1
- package/dist/emails/otp-verification.js +5 -3
- package/dist/emails/reset-password.d.ts.map +1 -1
- package/dist/emails/reset-password.js +5 -3
- 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/emails/verify-email.js +5 -3
- package/dist/hooks/useAuth.d.ts.map +1 -1
- package/dist/hooks/useAuth.js +21 -4
- package/dist/hooks/usePatternUsages.d.ts.map +1 -1
- package/dist/hooks/usePatternUsages.js +3 -2
- package/dist/lib/api/api-error.d.ts +2 -0
- package/dist/lib/api/api-error.d.ts.map +1 -1
- package/dist/lib/api/api-error.js +3 -1
- package/dist/lib/api/auth/dual-auth.d.ts +2 -1
- package/dist/lib/api/auth/dual-auth.d.ts.map +1 -1
- package/dist/lib/api/auth/dual-auth.js +22 -4
- package/dist/lib/api/auth/scope-policy.d.ts +6 -3
- package/dist/lib/api/auth/scope-policy.d.ts.map +1 -1
- package/dist/lib/api/auth.d.ts +2 -0
- package/dist/lib/api/auth.d.ts.map +1 -1
- package/dist/lib/api/auth.js +10 -10
- package/dist/lib/api/client-headers.d.ts +11 -0
- package/dist/lib/api/client-headers.d.ts.map +1 -0
- package/dist/lib/api/client-headers.js +12 -0
- package/dist/lib/api/client-ip.d.ts +59 -0
- package/dist/lib/api/client-ip.d.ts.map +1 -0
- package/dist/lib/api/client-ip.js +91 -0
- package/dist/lib/api/cors-response.d.ts +55 -0
- package/dist/lib/api/cors-response.d.ts.map +1 -0
- package/dist/lib/api/cors-response.js +90 -0
- package/dist/lib/api/entities.d.ts.map +1 -1
- package/dist/lib/api/entities.js +4 -3
- package/dist/lib/api/entity/audit-log.d.ts.map +1 -1
- package/dist/lib/api/entity/audit-log.js +2 -1
- package/dist/lib/api/entity/generic-handler.d.ts.map +1 -1
- package/dist/lib/api/entity/generic-handler.js +23 -8
- package/dist/lib/api/helpers.d.ts +8 -2
- package/dist/lib/api/helpers.d.ts.map +1 -1
- package/dist/lib/api/helpers.js +32 -103
- package/dist/lib/api/keys.d.ts +6 -0
- package/dist/lib/api/keys.d.ts.map +1 -1
- package/dist/lib/api/keys.js +7 -1
- package/dist/lib/api/permission-middleware.d.ts.map +1 -1
- package/dist/lib/api/permission-middleware.js +0 -2
- package/dist/lib/api/rate-limit.d.ts +12 -0
- package/dist/lib/api/rate-limit.d.ts.map +1 -1
- package/dist/lib/api/rate-limit.js +50 -43
- package/dist/lib/api/request-origin.d.ts +16 -7
- package/dist/lib/api/request-origin.d.ts.map +1 -1
- package/dist/lib/api/request-origin.js +43 -20
- package/dist/lib/auth/load-login-page.d.ts +10 -0
- package/dist/lib/auth/load-login-page.d.ts.map +1 -0
- package/dist/lib/auth/load-login-page.js +7 -0
- package/dist/lib/auth/runtime-readiness.d.ts.map +1 -1
- package/dist/lib/auth/runtime-readiness.js +4 -0
- package/dist/lib/auth/sample-accounts.d.ts +17 -0
- package/dist/lib/auth/sample-accounts.d.ts.map +1 -0
- package/dist/lib/auth/sample-accounts.js +22 -0
- package/dist/lib/auth/security-notifications/device-fingerprint.d.ts +1 -8
- package/dist/lib/auth/security-notifications/device-fingerprint.d.ts.map +1 -1
- package/dist/lib/auth/security-notifications/device-fingerprint.js +2 -12
- package/dist/lib/auth-email-callbacks.js +3 -3
- package/dist/lib/auth.d.ts.map +1 -1
- package/dist/lib/auth.js +13 -5
- package/dist/lib/cache/public-entity-cache.d.ts +21 -0
- package/dist/lib/cache/public-entity-cache.d.ts.map +1 -0
- package/dist/lib/cache/public-entity-cache.js +25 -0
- package/dist/lib/config/config-client.d.ts.map +1 -1
- package/dist/lib/config/config-client.js +1 -1
- package/dist/lib/config/config-sync.d.ts.map +1 -1
- package/dist/lib/config/config-sync.js +1 -1
- package/dist/lib/config/public-config-client.d.ts +1 -0
- package/dist/lib/config/public-config-client.d.ts.map +1 -1
- package/dist/lib/config/public-config-client.js +3 -1
- package/dist/lib/config/types.d.ts +2 -0
- package/dist/lib/config/types.d.ts.map +1 -1
- package/dist/lib/constants/reserved-slugs.d.ts +17 -8
- package/dist/lib/constants/reserved-slugs.d.ts.map +1 -1
- package/dist/lib/constants/reserved-slugs.js +16 -52
- package/dist/lib/db.d.ts.map +1 -1
- package/dist/lib/db.js +9 -3
- package/dist/lib/entities/entity-hooks.d.ts.map +1 -1
- package/dist/lib/entities/entity-hooks.js +4 -0
- package/dist/lib/entities/external-api-generator.d.ts.map +1 -1
- package/dist/lib/entities/external-api-generator.js +2 -4
- package/dist/lib/entities/public-slug.d.ts +46 -0
- package/dist/lib/entities/public-slug.d.ts.map +1 -0
- package/dist/lib/entities/public-slug.js +39 -0
- package/dist/lib/mcp/errors.d.ts +2 -0
- package/dist/lib/mcp/errors.d.ts.map +1 -1
- package/dist/lib/mcp/errors.js +3 -1
- package/dist/lib/mcp/index.d.ts +1 -1
- package/dist/lib/mcp/index.d.ts.map +1 -1
- package/dist/lib/mcp/index.js +2 -1
- package/dist/lib/services/generic-entity.service.d.ts.map +1 -1
- package/dist/lib/services/generic-entity.service.js +2 -0
- package/dist/lib/teams/actions.d.ts.map +1 -1
- package/dist/lib/teams/actions.js +0 -1
- package/dist/messages/de/billing.json +12 -1
- package/dist/messages/de/common.json +2 -0
- package/dist/messages/de/docs.json +1 -0
- package/dist/messages/de/features.json +16 -4
- package/dist/messages/de/home.json +5 -0
- package/dist/messages/de/index.d.ts +68 -25
- 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/settings.json +1 -0
- package/dist/messages/de/teams.json +3 -18
- package/dist/messages/en/billing.json +1 -1
- package/dist/messages/en/common.json +2 -0
- package/dist/messages/en/docs.json +1 -0
- package/dist/messages/en/features.json +16 -4
- package/dist/messages/en/home.json +5 -0
- package/dist/messages/en/index.d.ts +58 -25
- 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/settings.json +1 -0
- package/dist/messages/en/teams.json +3 -18
- package/dist/messages/es/billing.json +1 -1
- package/dist/messages/es/common.json +2 -0
- package/dist/messages/es/docs.json +1 -0
- package/dist/messages/es/features.json +16 -4
- package/dist/messages/es/home.json +5 -0
- package/dist/messages/es/index.d.ts +41 -8
- 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/settings.json +1 -0
- package/dist/messages/es/teams.json +3 -0
- package/dist/messages/fr/billing.json +12 -1
- package/dist/messages/fr/common.json +2 -0
- package/dist/messages/fr/docs.json +1 -0
- package/dist/messages/fr/features.json +16 -4
- package/dist/messages/fr/home.json +5 -0
- package/dist/messages/fr/index.d.ts +68 -25
- 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/settings.json +1 -0
- package/dist/messages/fr/teams.json +3 -18
- package/dist/messages/it/billing.json +12 -1
- package/dist/messages/it/common.json +2 -0
- package/dist/messages/it/docs.json +1 -0
- package/dist/messages/it/features.json +16 -4
- package/dist/messages/it/home.json +5 -0
- package/dist/messages/it/index.d.ts +68 -25
- 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/settings.json +1 -0
- package/dist/messages/it/teams.json +3 -18
- package/dist/messages/pt/billing.json +12 -1
- package/dist/messages/pt/common.json +2 -0
- package/dist/messages/pt/docs.json +1 -0
- package/dist/messages/pt/features.json +16 -4
- package/dist/messages/pt/home.json +5 -0
- package/dist/messages/pt/index.d.ts +68 -25
- 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/settings.json +1 -0
- package/dist/messages/pt/teams.json +3 -18
- package/dist/migrations/029_sample_accounts_outside_development.sql +55 -0
- package/dist/migrations/090_sample_data.sql +10 -0
- package/dist/routes/(auth)/signup/page.cc.d.ts +3 -8
- package/dist/routes/(auth)/signup/page.cc.d.ts.map +1 -1
- package/dist/routes/(auth)/signup/page.cc.js +7 -1
- package/dist/routes/(auth)/verify-email/page.d.ts.map +1 -1
- package/dist/routes/(auth)/verify-email/page.js +2 -1
- package/dist/routes/(public)/page.cc.d.ts +3 -0
- package/dist/routes/(public)/page.cc.d.ts.map +1 -0
- package/dist/routes/(public)/page.cc.js +3 -0
- package/dist/routes/_internal/area-access.cc.d.ts +21 -0
- package/dist/routes/_internal/area-access.cc.d.ts.map +1 -0
- package/dist/routes/_internal/area-access.cc.js +19 -0
- package/dist/routes/_internal/auth-layout.d.ts.map +1 -1
- package/dist/routes/_internal/auth-layout.js +3 -2
- package/dist/routes/_internal/dashboard-main-shared.d.ts +7 -0
- package/dist/routes/_internal/dashboard-main-shared.d.ts.map +1 -0
- package/dist/routes/_internal/dashboard-main-shared.js +49 -0
- package/dist/routes/_internal/default-auth-layout.d.ts.map +1 -1
- package/dist/routes/_internal/default-auth-layout.js +3 -2
- package/dist/routes/_internal/devtools-layout.cc.d.ts +3 -2
- package/dist/routes/_internal/devtools-layout.cc.d.ts.map +1 -1
- package/dist/routes/_internal/devtools-layout.cc.js +1 -1
- package/dist/routes/_internal/devtools-layout.d.ts +7 -2
- package/dist/routes/_internal/devtools-layout.d.ts.map +1 -1
- package/dist/routes/_internal/devtools-layout.js +4 -4
- package/dist/routes/_internal/entity-detail-route.cc.d.ts +8 -0
- package/dist/routes/_internal/entity-detail-route.cc.d.ts.map +1 -0
- package/dist/routes/_internal/entity-detail-route.cc.js +5 -0
- package/dist/routes/_internal/entity-edit-route.cc.d.ts +8 -0
- package/dist/routes/_internal/entity-edit-route.cc.d.ts.map +1 -0
- package/dist/routes/_internal/entity-edit-route.cc.js +5 -0
- package/dist/routes/_internal/entity-permission-layout.d.ts.map +1 -1
- package/dist/routes/_internal/entity-permission-layout.js +0 -7
- package/dist/routes/_internal/public-archive-route.d.ts +1 -1
- package/dist/routes/_internal/public-archive-route.d.ts.map +1 -1
- package/dist/routes/_internal/public-archive-route.js +8 -3
- package/dist/routes/_internal/public-item-route.cc.d.ts +5 -1
- package/dist/routes/_internal/public-item-route.cc.d.ts.map +1 -1
- package/dist/routes/_internal/public-item-route.cc.js +2 -1
- package/dist/routes/_internal/public-item-route.d.ts +7 -0
- package/dist/routes/_internal/public-item-route.d.ts.map +1 -1
- package/dist/routes/_internal/public-item-route.js +6 -1
- package/dist/routes/_internal/superadmin-layout.cc.d.ts +2 -1
- package/dist/routes/_internal/superadmin-layout.cc.d.ts.map +1 -1
- package/dist/routes/_internal/superadmin-layout.cc.js +1 -1
- package/dist/routes/_internal/superadmin-layout.d.ts +7 -2
- package/dist/routes/_internal/superadmin-layout.d.ts.map +1 -1
- package/dist/routes/_internal/superadmin-layout.js +6 -6
- package/dist/routes/_internal/suspended-route.d.ts +16 -0
- package/dist/routes/_internal/suspended-route.d.ts.map +1 -0
- package/dist/routes/_internal/suspended-route.js +7 -0
- package/dist/routes/api/auth/[...all]/route.d.ts.map +1 -1
- package/dist/routes/api/auth/[...all]/route.js +4 -12
- package/dist/routes/api/csp-report/route.d.ts.map +1 -1
- package/dist/routes/api/csp-report/route.js +2 -13
- package/dist/routes/api/devtools/config/entities/route.d.ts +2 -0
- package/dist/routes/api/devtools/config/entities/route.d.ts.map +1 -1
- package/dist/routes/api/devtools/config/entities/route.js +2 -0
- package/dist/routes/api/devtools/config/theme/route.d.ts +2 -0
- package/dist/routes/api/devtools/config/theme/route.d.ts.map +1 -1
- package/dist/routes/api/devtools/config/theme/route.js +2 -0
- package/dist/routes/api/devtools/tests/[...path]/route.d.ts +2 -0
- package/dist/routes/api/devtools/tests/[...path]/route.d.ts.map +1 -1
- package/dist/routes/api/devtools/tests/[...path]/route.js +2 -0
- package/dist/routes/api/devtools/tests/route.d.ts +2 -0
- package/dist/routes/api/devtools/tests/route.d.ts.map +1 -1
- package/dist/routes/api/devtools/tests/route.js +2 -0
- package/dist/routes/api/health/route.d.ts +2 -0
- package/dist/routes/api/health/route.d.ts.map +1 -1
- package/dist/routes/api/health/route.js +2 -0
- package/dist/routes/api/internal/user-metadata/route.d.ts +2 -0
- package/dist/routes/api/internal/user-metadata/route.d.ts.map +1 -1
- package/dist/routes/api/internal/user-metadata/route.js +2 -0
- package/dist/routes/api/mcp/route.d.ts +2 -0
- package/dist/routes/api/mcp/route.d.ts.map +1 -1
- package/dist/routes/api/mcp/route.js +9 -1
- package/dist/routes/api/superadmin/subscriptions/route.d.ts +2 -0
- package/dist/routes/api/superadmin/subscriptions/route.d.ts.map +1 -1
- package/dist/routes/api/superadmin/subscriptions/route.js +2 -0
- package/dist/routes/api/superadmin/teams/[teamId]/route.d.ts +2 -0
- package/dist/routes/api/superadmin/teams/[teamId]/route.d.ts.map +1 -1
- package/dist/routes/api/superadmin/teams/[teamId]/route.js +2 -0
- package/dist/routes/api/superadmin/teams/route.d.ts +2 -0
- package/dist/routes/api/superadmin/teams/route.d.ts.map +1 -1
- package/dist/routes/api/superadmin/teams/route.js +2 -0
- package/dist/routes/api/superadmin/users/[userId]/route.d.ts +2 -0
- package/dist/routes/api/superadmin/users/[userId]/route.d.ts.map +1 -1
- package/dist/routes/api/superadmin/users/[userId]/route.js +2 -0
- package/dist/routes/api/superadmin/users/route.d.ts +2 -0
- package/dist/routes/api/superadmin/users/route.d.ts.map +1 -1
- package/dist/routes/api/superadmin/users/route.js +2 -0
- package/dist/routes/api/user/delete-account/route.d.ts +2 -0
- package/dist/routes/api/user/delete-account/route.d.ts.map +1 -1
- package/dist/routes/api/user/delete-account/route.js +2 -0
- package/dist/routes/api/user/plan-flags/route.d.ts +2 -0
- package/dist/routes/api/user/plan-flags/route.d.ts.map +1 -1
- package/dist/routes/api/user/plan-flags/route.js +2 -0
- package/dist/routes/api/user/profile/route.d.ts +2 -0
- package/dist/routes/api/user/profile/route.d.ts.map +1 -1
- package/dist/routes/api/user/profile/route.js +4 -3
- package/dist/routes/api/v1/[entity]/[id]/child/[childType]/[childId]/route.d.ts +2 -0
- package/dist/routes/api/v1/[entity]/[id]/child/[childType]/[childId]/route.d.ts.map +1 -1
- package/dist/routes/api/v1/[entity]/[id]/child/[childType]/[childId]/route.js +2 -0
- package/dist/routes/api/v1/[entity]/[id]/child/[childType]/route.d.ts +2 -0
- package/dist/routes/api/v1/[entity]/[id]/child/[childType]/route.d.ts.map +1 -1
- package/dist/routes/api/v1/[entity]/[id]/child/[childType]/route.js +2 -0
- package/dist/routes/api/v1/billing/cancel/route.d.ts +2 -0
- package/dist/routes/api/v1/billing/cancel/route.d.ts.map +1 -1
- package/dist/routes/api/v1/billing/cancel/route.js +2 -0
- package/dist/routes/api/v1/billing/change-plan/route.d.ts +2 -0
- package/dist/routes/api/v1/billing/change-plan/route.d.ts.map +1 -1
- package/dist/routes/api/v1/billing/change-plan/route.js +2 -0
- package/dist/routes/api/v1/billing/check-action/route.d.ts +2 -0
- package/dist/routes/api/v1/billing/check-action/route.d.ts.map +1 -1
- package/dist/routes/api/v1/billing/check-action/route.js +2 -0
- package/dist/routes/api/v1/billing/checkout/route.d.ts +2 -0
- package/dist/routes/api/v1/billing/checkout/route.d.ts.map +1 -1
- package/dist/routes/api/v1/billing/checkout/route.js +2 -0
- package/dist/routes/api/v1/billing/plans/route.d.ts +2 -0
- package/dist/routes/api/v1/billing/plans/route.d.ts.map +1 -1
- package/dist/routes/api/v1/billing/plans/route.js +2 -0
- package/dist/routes/api/v1/billing/portal/route.d.ts +2 -0
- package/dist/routes/api/v1/billing/portal/route.d.ts.map +1 -1
- package/dist/routes/api/v1/billing/portal/route.js +2 -0
- package/dist/routes/api/v1/blocks/[slug]/route.d.ts +2 -0
- package/dist/routes/api/v1/blocks/[slug]/route.d.ts.map +1 -1
- package/dist/routes/api/v1/blocks/[slug]/route.js +2 -0
- package/dist/routes/api/v1/blocks/route.d.ts +2 -0
- package/dist/routes/api/v1/blocks/route.d.ts.map +1 -1
- package/dist/routes/api/v1/blocks/route.js +2 -0
- package/dist/routes/api/v1/blocks/validate/route.d.ts +2 -0
- package/dist/routes/api/v1/blocks/validate/route.d.ts.map +1 -1
- package/dist/routes/api/v1/blocks/validate/route.js +2 -0
- package/dist/routes/api/v1/devtools/blocks/route.d.ts +2 -1
- package/dist/routes/api/v1/devtools/blocks/route.d.ts.map +1 -1
- package/dist/routes/api/v1/devtools/blocks/route.js +2 -9
- package/dist/routes/api/v1/devtools/docs/route.d.ts +2 -0
- package/dist/routes/api/v1/devtools/docs/route.d.ts.map +1 -1
- package/dist/routes/api/v1/devtools/docs/route.js +2 -0
- package/dist/routes/api/v1/devtools/features/route.d.ts +2 -1
- package/dist/routes/api/v1/devtools/features/route.d.ts.map +1 -1
- package/dist/routes/api/v1/devtools/features/route.js +2 -9
- package/dist/routes/api/v1/devtools/flows/route.d.ts +2 -1
- package/dist/routes/api/v1/devtools/flows/route.d.ts.map +1 -1
- package/dist/routes/api/v1/devtools/flows/route.js +2 -9
- package/dist/routes/api/v1/devtools/scheduled-actions/route.d.ts +2 -1
- package/dist/routes/api/v1/devtools/scheduled-actions/route.d.ts.map +1 -1
- package/dist/routes/api/v1/devtools/scheduled-actions/route.js +2 -9
- package/dist/routes/api/v1/devtools/scheduled-actions/run/route.d.ts +2 -1
- package/dist/routes/api/v1/devtools/scheduled-actions/run/route.d.ts.map +1 -1
- package/dist/routes/api/v1/devtools/scheduled-actions/run/route.js +2 -9
- package/dist/routes/api/v1/devtools/testing/route.d.ts +2 -1
- package/dist/routes/api/v1/devtools/testing/route.d.ts.map +1 -1
- package/dist/routes/api/v1/devtools/testing/route.js +2 -9
- package/dist/routes/api/v1/media/[id]/route.d.ts +2 -0
- package/dist/routes/api/v1/media/[id]/route.d.ts.map +1 -1
- package/dist/routes/api/v1/media/[id]/route.js +2 -0
- package/dist/routes/api/v1/media/[id]/tags/route.d.ts +2 -0
- package/dist/routes/api/v1/media/[id]/tags/route.d.ts.map +1 -1
- package/dist/routes/api/v1/media/[id]/tags/route.js +2 -0
- package/dist/routes/api/v1/media/check-duplicates/route.d.ts +2 -0
- package/dist/routes/api/v1/media/check-duplicates/route.d.ts.map +1 -1
- package/dist/routes/api/v1/media/check-duplicates/route.js +2 -0
- package/dist/routes/api/v1/media/route.d.ts +2 -0
- package/dist/routes/api/v1/media/route.d.ts.map +1 -1
- package/dist/routes/api/v1/media/route.js +2 -0
- package/dist/routes/api/v1/media/upload/route.d.ts +4 -1
- package/dist/routes/api/v1/media/upload/route.d.ts.map +1 -1
- package/dist/routes/api/v1/media/upload/route.js +12 -2
- package/dist/routes/api/v1/media-tags/route.d.ts +2 -0
- package/dist/routes/api/v1/media-tags/route.d.ts.map +1 -1
- package/dist/routes/api/v1/media-tags/route.js +2 -0
- package/dist/routes/api/v1/post-categories/[id]/route.d.ts +2 -0
- package/dist/routes/api/v1/post-categories/[id]/route.d.ts.map +1 -1
- package/dist/routes/api/v1/post-categories/[id]/route.js +2 -0
- package/dist/routes/api/v1/post-categories/route.d.ts +2 -0
- package/dist/routes/api/v1/post-categories/route.d.ts.map +1 -1
- package/dist/routes/api/v1/post-categories/route.js +2 -0
- package/dist/routes/api/v1/teams/[teamId]/members/route.d.ts.map +1 -1
- package/dist/routes/api/v1/teams/[teamId]/members/route.js +14 -12
- package/dist/routes/api/v1/teams/[teamId]/subscription/route.d.ts +2 -0
- package/dist/routes/api/v1/teams/[teamId]/subscription/route.d.ts.map +1 -1
- package/dist/routes/api/v1/teams/[teamId]/subscription/route.js +2 -0
- package/dist/routes/api/v1/teams/[teamId]/usage/[limitSlug]/route.d.ts +2 -0
- package/dist/routes/api/v1/teams/[teamId]/usage/[limitSlug]/route.d.ts.map +1 -1
- package/dist/routes/api/v1/teams/[teamId]/usage/[limitSlug]/route.js +2 -0
- package/dist/routes/api/v1/teams/switch/route.d.ts.map +1 -1
- package/dist/routes/api/v1/teams/switch/route.js +4 -1
- package/dist/routes/api/v1/users/[id]/route.d.ts.map +1 -1
- package/dist/routes/api/v1/users/[id]/route.js +3 -2
- package/dist/routes/api/v1/users/docs.md +34 -19
- package/dist/routes/api/v1/users/me/route.d.ts +6 -0
- package/dist/routes/api/v1/users/me/route.d.ts.map +1 -0
- package/dist/routes/api/v1/users/me/route.js +5 -0
- package/dist/routes/api/v1/users/presets.ts +2 -2
- package/dist/routes/dashboard/(main)/layout.cc.d.ts +4 -0
- package/dist/routes/dashboard/(main)/layout.cc.d.ts.map +1 -0
- package/dist/routes/dashboard/(main)/layout.cc.js +10 -0
- package/dist/routes/dashboard/(main)/layout.d.ts.map +1 -1
- package/dist/routes/dashboard/(main)/layout.js +3 -44
- package/dist/routes/dashboard/permission-denied/page.d.ts +1 -1
- package/dist/routes/dashboard/permission-denied/page.d.ts.map +1 -1
- package/dist/routes/dashboard/permission-denied/page.js +5 -1
- package/dist/routes/dashboard/settings/password/page.d.ts.map +1 -1
- package/dist/routes/dashboard/settings/password/page.js +10 -12
- package/dist/routes/devtools/config/page.js +1 -1
- package/dist/routes/devtools/layout.cc.d.ts.map +1 -1
- package/dist/routes/devtools/layout.cc.js +5 -1
- package/dist/routes/devtools/page.js +1 -1
- package/dist/routes/devtools/scheduled-actions/page.js +1 -1
- package/dist/routes/devtools/tests/[[...path]]/page.js +1 -1
- package/dist/routes/manifest.json +10 -0
- package/dist/routes/robots.d.ts +10 -0
- package/dist/routes/robots.d.ts.map +1 -0
- package/dist/routes/robots.js +10 -0
- package/dist/routes/superadmin/layout.cc.d.ts.map +1 -1
- package/dist/routes/superadmin/layout.cc.js +5 -1
- package/dist/routes/variants.json +12 -2
- package/dist/templates/ci-workflows/github/cypress-regression.yml +1 -1
- package/dist/templates/ci-workflows/github/cypress-smoke.yml +2 -1
- package/dist/templates/next.config.mjs +2 -29
- package/dist/templates/projects/blog/api/authors/[username]/route.ts +3 -0
- package/dist/templates/projects/blog/api/authors/route.ts +3 -0
- package/dist/templates/projects/blog/api/posts/public/route.ts +3 -0
- package/dist/templates/projects/starter/README.md +2 -0
- package/dist/templates/projects/starter/docs/public/01-overview/01-introduction.md +2 -0
- package/dist/templates/projects/starter/templates/dashboard/analytics/layout.tsx +14 -0
- package/dist/templates/proxy.ts +27 -9
- package/dist/templates/public/favicon.ico +0 -0
- package/dist/templates/public/uploads/README.md +5 -94
- package/migrations/029_sample_accounts_outside_development.sql +55 -0
- package/migrations/090_sample_data.sql +10 -0
- package/package.json +2 -2
- package/scripts/build/registry/__tests__/api-docs-colocated.test.mjs +3 -0
- package/scripts/build/registry/__tests__/billing-registry.test.mjs +50 -1
- package/scripts/build/registry/__tests__/block-registry.test.mjs +3 -0
- package/scripts/build/registry/__tests__/icons-discovery.test.mjs +3 -0
- package/scripts/build/registry/__tests__/quiet-console.mjs +17 -0
- package/scripts/build/registry/__tests__/safe-fs.test.mjs +3 -0
- package/scripts/build/registry/__tests__/team-roles.test.mjs +3 -0
- package/scripts/build/registry/discovery/permissions.test.mjs +3 -0
- package/scripts/build/registry/discovery/plugin-capabilities.mjs +2 -2
- package/scripts/build/registry/generators/billing-registry.mjs +7 -3
- package/scripts/build/registry/host/README.md +25 -1
- package/scripts/build/registry/host/__tests__/host-area-access.test.mjs +32 -0
- package/scripts/build/registry/host/__tests__/host-entities.test.mjs +32 -1
- package/scripts/build/registry/host/__tests__/host-plan.test.mjs +12 -2
- package/scripts/build/registry/host/__tests__/host-proxy-areas.test.mjs +72 -1
- package/scripts/build/registry/host/entity-routes.mjs +9 -3
- package/scripts/build/registry/host/proxy-areas.mjs +65 -2
- package/scripts/build/registry/host/static-imports.mjs +4 -0
- package/scripts/build/routes-manifest.mjs +13 -1
- package/scripts/db/run-migrations.mjs +30 -10
- package/scripts/db/sample-data.mjs +44 -0
- package/scripts/db/ssl-config.mjs +12 -1
- package/scripts/db/verify-theme-migrations.mjs +6 -0
- package/templates/ci-workflows/github/cypress-regression.yml +1 -1
- package/templates/ci-workflows/github/cypress-smoke.yml +2 -1
- package/templates/next.config.mjs +2 -29
- package/templates/projects/blog/api/authors/[username]/route.ts +3 -0
- package/templates/projects/blog/api/authors/route.ts +3 -0
- package/templates/projects/blog/api/posts/public/route.ts +3 -0
- package/templates/projects/starter/README.md +2 -0
- package/templates/projects/starter/docs/public/01-overview/01-introduction.md +2 -0
- package/templates/projects/starter/templates/dashboard/analytics/layout.tsx +14 -0
- package/templates/proxy.ts +27 -9
- package/templates/public/favicon.ico +0 -0
- package/templates/public/uploads/README.md +5 -94
- package/tests/jest/__mocks__/@nextsparkjs/registries/api-presets-registry.ts +2 -0
- package/tests/jest/__mocks__/@nextsparkjs/registries/mcp-registry.ts +2 -0
- package/dist/templates/projects/starter/public/brand/.gitkeep +0 -0
- package/dist/templates/public/uploads/.gitignore +0 -6
- package/dist/templates/public/uploads/temp/.gitkeep +0 -1
- package/templates/projects/starter/public/brand/.gitkeep +0 -0
- package/templates/public/uploads/.gitignore +0 -6
- package/templates/public/uploads/temp/.gitkeep +0 -1
|
@@ -4,6 +4,7 @@ import { createApiResponse, createApiError } from "@nextsparkjs/core/lib/api/hel
|
|
|
4
4
|
import { API_ERROR_CODES } from "@nextsparkjs/core/lib/api/api-error";
|
|
5
5
|
import { checkPermission } from "@nextsparkjs/core/lib/permissions/check";
|
|
6
6
|
import { withRateLimitTier } from "@nextsparkjs/core/lib/api/rate-limit";
|
|
7
|
+
import { corsPreflight } from "@nextsparkjs/core/lib/api/cors-response";
|
|
7
8
|
import { MEDIA_CONFIG } from "@nextsparkjs/core/lib/config/config-sync";
|
|
8
9
|
import { MediaService } from "@nextsparkjs/core/lib/services/media.service";
|
|
9
10
|
import { extractImageDimensions } from "@nextsparkjs/core/lib/media/utils";
|
|
@@ -14,6 +15,13 @@ const isVercelBlobConfigured = () => {
|
|
|
14
15
|
const token = process.env.BLOB_READ_WRITE_TOKEN;
|
|
15
16
|
return !!token && token.startsWith("vercel_blob_");
|
|
16
17
|
};
|
|
18
|
+
const localFallbackAllowed = () => process.env.NODE_ENV !== "production";
|
|
19
|
+
const storageNotConfigured = () => createApiError(
|
|
20
|
+
'Media storage is not configured: set BLOB_READ_WRITE_TOKEN (a Vercel Blob read/write token, starts with "vercel_blob_") to upload files in production.',
|
|
21
|
+
503,
|
|
22
|
+
{ missing: "BLOB_READ_WRITE_TOKEN" },
|
|
23
|
+
API_ERROR_CODES.STORAGE_NOT_CONFIGURED
|
|
24
|
+
);
|
|
17
25
|
async function uploadToLocalStorageBuffer(buffer, fileName) {
|
|
18
26
|
const uploadDir = join(process.cwd(), "public", "uploads", "temp");
|
|
19
27
|
if (!existsSync(uploadDir)) {
|
|
@@ -36,6 +44,7 @@ export const POST = withRateLimitTier(async (request) => {
|
|
|
36
44
|
if (!await checkPermission(authResult.user.id, teamId, "media.upload")) {
|
|
37
45
|
return createApiError("Permission denied", 403, void 0, API_ERROR_CODES.PERMISSION_DENIED);
|
|
38
46
|
}
|
|
47
|
+
if (!isVercelBlobConfigured() && !localFallbackAllowed()) return storageNotConfigured();
|
|
39
48
|
const formData = await request.formData();
|
|
40
49
|
const files = Array.from(formData.getAll("files")).filter((value) => value instanceof File);
|
|
41
50
|
if (files.length === 0) {
|
|
@@ -45,7 +54,6 @@ export const POST = withRateLimitTier(async (request) => {
|
|
|
45
54
|
const uploadedMedia = [];
|
|
46
55
|
const useVercelBlob = isVercelBlobConfigured();
|
|
47
56
|
console.log(`\u{1F4E4} [Media Upload] Storage mode: ${useVercelBlob ? "Vercel Blob" : "Local Storage"}`);
|
|
48
|
-
console.log(`\u{1F4E4} [Media Upload] Team context: ${teamId}`);
|
|
49
57
|
for (const file of files) {
|
|
50
58
|
if (!file.size) {
|
|
51
59
|
continue;
|
|
@@ -100,6 +108,7 @@ export const POST = withRateLimitTier(async (request) => {
|
|
|
100
108
|
uploadedUrl = blob.url;
|
|
101
109
|
console.log(`\u2705 [Media Upload] Uploaded to Vercel Blob: ${uploadedUrl}`);
|
|
102
110
|
} catch (blobError) {
|
|
111
|
+
if (!localFallbackAllowed()) throw blobError;
|
|
103
112
|
console.warn(`\u26A0\uFE0F [Media Upload] Vercel Blob failed, falling back to local storage:`, blobError);
|
|
104
113
|
uploadedUrl = await uploadToLocalStorageBuffer(fileBuffer, fileName);
|
|
105
114
|
console.log(`\u2705 [Media Upload] Uploaded to local storage (fallback): ${uploadedUrl}`);
|
|
@@ -178,7 +187,7 @@ export const GET = withRateLimitTier(async (request) => {
|
|
|
178
187
|
const maxSizeMB = ((_a = MEDIA_CONFIG) == null ? void 0 : _a.maxSizeMB) ?? 10;
|
|
179
188
|
return createApiResponse({
|
|
180
189
|
message: "Media upload endpoint is active",
|
|
181
|
-
storage: useVercelBlob ? "Vercel Blob" : "Local Storage",
|
|
190
|
+
storage: useVercelBlob ? "Vercel Blob" : localFallbackAllowed() ? "Local Storage" : "Not configured (set BLOB_READ_WRITE_TOKEN)",
|
|
182
191
|
uploadPath: "uploads/temp/",
|
|
183
192
|
supportedTypes: ((_b = MEDIA_CONFIG) == null ? void 0 : _b.allowedMimeTypes) ?? ["image/jpeg", "image/png", "image/gif", "image/webp", "video/mp4", "video/webm"],
|
|
184
193
|
maxFileSize: `${maxSizeMB}MB`,
|
|
@@ -194,3 +203,4 @@ export const GET = withRateLimitTier(async (request) => {
|
|
|
194
203
|
);
|
|
195
204
|
}
|
|
196
205
|
}, "read");
|
|
206
|
+
export const OPTIONS = corsPreflight;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NextRequest } from 'next/server';
|
|
2
|
+
import { corsPreflight } from '@nextsparkjs/core/lib/api/cors-response';
|
|
2
3
|
/**
|
|
3
4
|
* GET /api/v1/media-tags
|
|
4
5
|
*
|
|
@@ -16,4 +17,5 @@ export declare const GET: (request: NextRequest) => Promise<import("next/server"
|
|
|
16
17
|
* Authentication: Requires valid session or API key with media:write scope
|
|
17
18
|
*/
|
|
18
19
|
export declare const POST: (request: NextRequest) => Promise<import("next/server").NextResponse>;
|
|
20
|
+
export declare const OPTIONS: typeof corsPreflight;
|
|
19
21
|
//# sourceMappingURL=route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/routes/api/v1/media-tags/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/routes/api/v1/media-tags/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAMzC,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AAGvE;;;;;;GAMG;AACH,eAAO,MAAM,GAAG,uEAwBN,CAAA;AAEV;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,uEA+BN,CAAA;AAEX,eAAO,MAAM,OAAO,sBAAgB,CAAA"}
|
|
@@ -3,6 +3,7 @@ import { createApiResponse, createApiError } from "@nextsparkjs/core/lib/api/hel
|
|
|
3
3
|
import { API_ERROR_CODES } from "@nextsparkjs/core/lib/api/api-error";
|
|
4
4
|
import { checkPermission } from "@nextsparkjs/core/lib/permissions/check";
|
|
5
5
|
import { withRateLimitTier } from "@nextsparkjs/core/lib/api/rate-limit";
|
|
6
|
+
import { corsPreflight } from "@nextsparkjs/core/lib/api/cors-response";
|
|
6
7
|
import { MediaService } from "@nextsparkjs/core/lib/services/media.service";
|
|
7
8
|
export const GET = withRateLimitTier(async (request) => {
|
|
8
9
|
try {
|
|
@@ -47,3 +48,4 @@ export const POST = withRateLimitTier(async (request) => {
|
|
|
47
48
|
return createApiError("Failed to create media tag", 500);
|
|
48
49
|
}
|
|
49
50
|
}, "write");
|
|
51
|
+
export const OPTIONS = corsPreflight;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import { corsPreflight } from '@nextsparkjs/core/lib/api/cors-response';
|
|
2
3
|
export declare const GET: (request: NextRequest, args_0: {
|
|
3
4
|
params: Promise<{
|
|
4
5
|
id: string;
|
|
@@ -14,4 +15,5 @@ export declare const DELETE: (request: NextRequest, args_0: {
|
|
|
14
15
|
id: string;
|
|
15
16
|
}>;
|
|
16
17
|
}) => Promise<NextResponse>;
|
|
18
|
+
export declare const OPTIONS: typeof corsPreflight;
|
|
17
19
|
//# sourceMappingURL=route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/routes/api/v1/post-categories/[id]/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/routes/api/v1/post-categories/[id]/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAKvD,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AAevE,eAAO,MAAM,GAAG;YAEQ,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;2BAyBrC,CAAC;AAGX,eAAO,MAAM,GAAG;YAEQ,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;2BAwIpC,CAAC;AAGZ,eAAO,MAAM,MAAM;YAEK,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;2BAiEpC,CAAC;AAEZ,eAAO,MAAM,OAAO,sBAAgB,CAAA"}
|
|
@@ -3,6 +3,7 @@ import { authenticateRequest, createAuthFailureResponse } from "@nextsparkjs/cor
|
|
|
3
3
|
import { query as dbQuery } from "@nextsparkjs/core/lib/db";
|
|
4
4
|
import * as z from "zod";
|
|
5
5
|
import { withRateLimitTier } from "@nextsparkjs/core/lib/api/rate-limit";
|
|
6
|
+
import { corsPreflight } from "@nextsparkjs/core/lib/api/cors-response";
|
|
6
7
|
const updateCategorySchema = z.object({
|
|
7
8
|
name: z.string().min(1).max(255).optional(),
|
|
8
9
|
slug: z.string().min(2).max(100).regex(/^[a-z0-9-]+$/, "Slug must be lowercase alphanumeric with dashes").optional(),
|
|
@@ -201,3 +202,4 @@ export const DELETE = withRateLimitTier(async (request, { params }) => {
|
|
|
201
202
|
return NextResponse.json({ success: false, error: "Internal server error" }, { status: 500 });
|
|
202
203
|
}
|
|
203
204
|
}, "write");
|
|
205
|
+
export const OPTIONS = corsPreflight;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import { corsPreflight } from '@nextsparkjs/core/lib/api/cors-response';
|
|
2
3
|
export declare const GET: (request: NextRequest) => Promise<NextResponse>;
|
|
3
4
|
export declare const POST: (request: NextRequest) => Promise<NextResponse>;
|
|
5
|
+
export declare const OPTIONS: typeof corsPreflight;
|
|
4
6
|
//# sourceMappingURL=route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/routes/api/v1/post-categories/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/routes/api/v1/post-categories/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAKvD,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AAyBvE,eAAO,MAAM,GAAG,iDAkBN,CAAC;AAGX,eAAO,MAAM,IAAI,iDAsEN,CAAC;AAEZ,eAAO,MAAM,OAAO,sBAAgB,CAAA"}
|
|
@@ -3,6 +3,7 @@ import { authenticateRequest, createAuthFailureResponse } from "@nextsparkjs/cor
|
|
|
3
3
|
import { query as dbQuery } from "@nextsparkjs/core/lib/db";
|
|
4
4
|
import * as z from "zod";
|
|
5
5
|
import { withRateLimitTier } from "@nextsparkjs/core/lib/api/rate-limit";
|
|
6
|
+
import { corsPreflight } from "@nextsparkjs/core/lib/api/cors-response";
|
|
6
7
|
const createCategorySchema = z.object({
|
|
7
8
|
name: z.string().min(1).max(255),
|
|
8
9
|
slug: z.string().min(2).max(100).regex(/^[a-z0-9-]+$/, "Slug must be lowercase alphanumeric with dashes").optional(),
|
|
@@ -92,3 +93,4 @@ export const POST = withRateLimitTier(async (request) => {
|
|
|
92
93
|
return NextResponse.json({ success: false, error: "Internal server error" }, { status: 500 });
|
|
93
94
|
}
|
|
94
95
|
}, "write");
|
|
96
|
+
export const OPTIONS = corsPreflight;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../src/routes/api/v1/teams/[teamId]/members/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAwBvD,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,kCAEjD;AAGD,eAAO,MAAM,GAAG;YACiC,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;2BA2HlE,CAAA;AAGV,eAAO,MAAM,IAAI;YACgC,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../src/routes/api/v1/teams/[teamId]/members/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAwBvD,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,kCAEjD;AAGD,eAAO,MAAM,GAAG;YACiC,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;2BA2HlE,CAAA;AAGV,eAAO,MAAM,IAAI;YACgC,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;2BAkMjE,CAAA"}
|
|
@@ -17,7 +17,7 @@ import { MembershipService } from "@nextsparkjs/core/lib/services";
|
|
|
17
17
|
import { canInviteToRole } from "@nextsparkjs/core/lib/teams/permissions";
|
|
18
18
|
import { EmailFactory } from "@nextsparkjs/core/lib/email/factory";
|
|
19
19
|
import { sendTeamInvitationEmail } from "@nextsparkjs/core/lib/email/send";
|
|
20
|
-
import { I18N_CONFIG } from "@nextsparkjs/core/lib/config";
|
|
20
|
+
import { I18N_CONFIG, APP_NAME } from "@nextsparkjs/core/lib/config";
|
|
21
21
|
import { withBasePath } from "@nextsparkjs/core/lib/base-path";
|
|
22
22
|
export async function OPTIONS(request) {
|
|
23
23
|
return handleCorsPreflightRequest(request);
|
|
@@ -230,25 +230,27 @@ export const POST = withRateLimitTier(withApiLogging(
|
|
|
230
230
|
role: validatedData.role,
|
|
231
231
|
acceptUrl,
|
|
232
232
|
expiresIn: "7 days",
|
|
233
|
-
appName: process.env.NEXT_PUBLIC_APP_NAME ||
|
|
233
|
+
appName: process.env.NEXT_PUBLIC_APP_NAME || APP_NAME
|
|
234
234
|
}, I18N_CONFIG.defaultLocale);
|
|
235
235
|
await emailProvider.send({
|
|
236
236
|
to: validatedData.email,
|
|
237
237
|
subject: emailContent.subject,
|
|
238
238
|
html: emailContent.html
|
|
239
239
|
});
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
240
|
+
if (process.env.NODE_ENV === "development") {
|
|
241
|
+
console.log("\n" + "\u{1F3AB}".repeat(30));
|
|
242
|
+
console.log("\u{1F4E8} TEAM INVITATION CREATED");
|
|
243
|
+
console.log("\u{1F3AB}".repeat(30));
|
|
244
|
+
console.log(`\u{1F4E7} To: ${validatedData.email}`);
|
|
245
|
+
console.log(`\u{1F464} Invited by: ${inviterName}`);
|
|
246
|
+
console.log(`\u{1F3E2} Team: ${team.name}`);
|
|
247
|
+
console.log(`\u{1F451} Role: ${validatedData.role}`);
|
|
248
|
+
console.log(`\u{1F517} Accept URL: ${acceptUrl}`);
|
|
249
|
+
console.log("\u{1F3AB}".repeat(30) + "\n");
|
|
250
|
+
}
|
|
249
251
|
} catch (emailError) {
|
|
250
252
|
console.error("Failed to send invitation email:", emailError);
|
|
251
|
-
console.log(`\u26A0\uFE0F Email failed but invitation created. Accept URL: ${acceptUrl}`);
|
|
253
|
+
if (process.env.NODE_ENV === "development") console.log(`\u26A0\uFE0F Email failed but invitation created. Accept URL: ${acceptUrl}`);
|
|
252
254
|
}
|
|
253
255
|
const response = createApiResponse(invitation, { created: true }, 201);
|
|
254
256
|
return addCorsHeaders(response, req);
|
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
* GET /api/v1/teams/[teamId]/subscription - Get team's active subscription
|
|
5
5
|
*/
|
|
6
6
|
import { NextRequest, NextResponse } from 'next/server';
|
|
7
|
+
import { corsPreflight } from '@nextsparkjs/core/lib/api/cors-response';
|
|
7
8
|
interface RouteParams {
|
|
8
9
|
params: Promise<{
|
|
9
10
|
teamId: string;
|
|
10
11
|
}>;
|
|
11
12
|
}
|
|
12
13
|
export declare const GET: (request: NextRequest, props: RouteParams) => Promise<NextResponse>;
|
|
14
|
+
export declare const OPTIONS: typeof corsPreflight;
|
|
13
15
|
export {};
|
|
14
16
|
//# sourceMappingURL=route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../src/routes/api/v1/teams/[teamId]/subscription/route.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../src/routes/api/v1/teams/[teamId]/subscription/route.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAGvD,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AAGvE,UAAU,WAAW;IACnB,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACpC;AAED,eAAO,MAAM,GAAG,qEAmCN,CAAA;AAEV,eAAO,MAAM,OAAO,sBAAgB,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NextResponse } from "next/server";
|
|
2
2
|
import { validateAndAuthenticateRequest, createApiResponse, createApiError } from "@nextsparkjs/core/lib/api/helpers";
|
|
3
3
|
import { withRateLimitTier } from "@nextsparkjs/core/lib/api/rate-limit";
|
|
4
|
+
import { corsPreflight } from "@nextsparkjs/core/lib/api/cors-response";
|
|
4
5
|
import { SubscriptionService, MembershipService } from "@nextsparkjs/core/lib/services";
|
|
5
6
|
export const GET = withRateLimitTier(async function GET2(request, props) {
|
|
6
7
|
const { auth, rateLimitResponse, errorResponse } = await validateAndAuthenticateRequest(request, { requiredScope: "billing:read" });
|
|
@@ -28,3 +29,4 @@ export const GET = withRateLimitTier(async function GET2(request, props) {
|
|
|
28
29
|
return createApiError("Failed to fetch subscription", 500);
|
|
29
30
|
}
|
|
30
31
|
}, "read");
|
|
32
|
+
export const OPTIONS = corsPreflight;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* POST /api/v1/teams/[teamId]/usage/[limitSlug] - Track usage
|
|
6
6
|
*/
|
|
7
7
|
import { NextRequest, NextResponse } from 'next/server';
|
|
8
|
+
import { corsPreflight } from '@nextsparkjs/core/lib/api/cors-response';
|
|
8
9
|
interface RouteParams {
|
|
9
10
|
params: Promise<{
|
|
10
11
|
teamId: string;
|
|
@@ -13,5 +14,6 @@ interface RouteParams {
|
|
|
13
14
|
}
|
|
14
15
|
export declare const GET: (request: NextRequest, props: RouteParams) => Promise<NextResponse>;
|
|
15
16
|
export declare const POST: (request: NextRequest, props: RouteParams) => Promise<NextResponse>;
|
|
17
|
+
export declare const OPTIONS: typeof corsPreflight;
|
|
16
18
|
export {};
|
|
17
19
|
//# sourceMappingURL=route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../../src/routes/api/v1/teams/[teamId]/usage/[limitSlug]/route.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../../src/routes/api/v1/teams/[teamId]/usage/[limitSlug]/route.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAGvD,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AAIvE,UAAU,WAAW;IACnB,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACvD;AAED,eAAO,MAAM,GAAG,qEAgCN,CAAA;AAEV,eAAO,MAAM,IAAI,qEA4CN,CAAA;AAEX,eAAO,MAAM,OAAO,sBAAgB,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NextResponse } from "next/server";
|
|
2
2
|
import { validateAndAuthenticateRequest, createApiResponse, createApiError } from "@nextsparkjs/core/lib/api/helpers";
|
|
3
3
|
import { withRateLimitTier } from "@nextsparkjs/core/lib/api/rate-limit";
|
|
4
|
+
import { corsPreflight } from "@nextsparkjs/core/lib/api/cors-response";
|
|
4
5
|
import { SubscriptionService, UsageService, MembershipService } from "@nextsparkjs/core/lib/services";
|
|
5
6
|
import { trackUsageSchema } from "@nextsparkjs/core/lib/billing/schema";
|
|
6
7
|
export const GET = withRateLimitTier(async function GET2(request, props) {
|
|
@@ -65,3 +66,4 @@ export const POST = withRateLimitTier(async function POST2(request, props) {
|
|
|
65
66
|
return createApiError(errorMessage, 500);
|
|
66
67
|
}
|
|
67
68
|
}, "write");
|
|
69
|
+
export const OPTIONS = corsPreflight;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/routes/api/v1/teams/switch/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAuBvD,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,kCAEjD;AAGD,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/routes/api/v1/teams/switch/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAuBvD,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,kCAEjD;AAGD,eAAO,MAAM,IAAI,iDAkFL,CAAA"}
|
|
@@ -38,7 +38,10 @@ export const POST = withRateLimitTier(withApiLogging(async (req) => {
|
|
|
38
38
|
);
|
|
39
39
|
return addCorsHeaders(response, req);
|
|
40
40
|
}
|
|
41
|
-
const body = await req.json();
|
|
41
|
+
const body = await req.json().catch(() => void 0);
|
|
42
|
+
if (body === void 0) {
|
|
43
|
+
return addCorsHeaders(createApiError("Request body must be valid JSON", 400, null, "INVALID_JSON"), req);
|
|
44
|
+
}
|
|
42
45
|
const validatedData = switchTeamSchema.parse(body);
|
|
43
46
|
try {
|
|
44
47
|
await TeamService.switchActive(authResult.user.id, validatedData.teamId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/routes/api/v1/users/[id]/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/routes/api/v1/users/[id]/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA+BxD,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,kCAEjD;AAGD,eAAO,MAAM,GAAG;YAEQ,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;2BAoDpC,CAAC;AAGZ,eAAO,MAAM,KAAK;YAEM,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;2BAqInC,CAAC;AAGb,eAAO,MAAM,MAAM;YAEK,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;2BAiEnC,CAAC"}
|
|
@@ -21,6 +21,7 @@ const updateUserSchema = z.object({
|
|
|
21
21
|
role: z.enum(["member", "superadmin"]).optional(),
|
|
22
22
|
metas: z.record(z.string(), z.any()).optional()
|
|
23
23
|
});
|
|
24
|
+
const resolveUserId = ({ id }, callerId) => id === "me" ? callerId : id;
|
|
24
25
|
export async function OPTIONS(request) {
|
|
25
26
|
return handleCorsPreflightRequest(request);
|
|
26
27
|
}
|
|
@@ -33,7 +34,7 @@ export const GET = withRateLimitTier(withApiLogging(async (req, { params }) => {
|
|
|
33
34
|
if (authResult.rateLimitResponse) {
|
|
34
35
|
return authResult.rateLimitResponse;
|
|
35
36
|
}
|
|
36
|
-
const
|
|
37
|
+
const id = resolveUserId(await params, authResult.user.id);
|
|
37
38
|
if (!id || id.trim() === "") {
|
|
38
39
|
const response2 = createApiError("User ID or email is required", 400, null, "MISSING_IDENTIFIER");
|
|
39
40
|
return addCorsHeaders(response2, req);
|
|
@@ -70,7 +71,7 @@ export const PATCH = withRateLimitTier(withApiLogging(async (req, { params }) =>
|
|
|
70
71
|
if (authResult.rateLimitResponse) {
|
|
71
72
|
return authResult.rateLimitResponse;
|
|
72
73
|
}
|
|
73
|
-
const
|
|
74
|
+
const id = resolveUserId(await params, authResult.user.id);
|
|
74
75
|
if (!id || id.trim() === "") {
|
|
75
76
|
const response2 = createApiError("User ID or email is required", 400, null, "MISSING_IDENTIFIER");
|
|
76
77
|
return addCorsHeaders(response2, req);
|
|
@@ -4,52 +4,67 @@ Manage user profiles and account settings.
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
The Users API allows you to view and update user profile information. Users can update their own profile
|
|
7
|
+
The Users API allows you to view and update user profile information. Users can read and update their own profile; a superadmin can manage any user.
|
|
8
8
|
|
|
9
9
|
## Authentication
|
|
10
10
|
|
|
11
11
|
All endpoints require authentication via:
|
|
12
12
|
- **Session cookie** (for browser-based requests)
|
|
13
|
-
- **API Key**
|
|
13
|
+
- **API Key** (for server-to-server requests), sent as `x-api-key: <key>` or `Authorization: Bearer <key>`: it needs the `users:read` scope to read and `users:write` to update, and it answers as the key's owner
|
|
14
|
+
|
|
15
|
+
A user can read and update only themselves; a superadmin can manage any user. Anything else answers `403`.
|
|
14
16
|
|
|
15
17
|
## Endpoints
|
|
16
18
|
|
|
17
19
|
### Get Current User
|
|
18
20
|
`GET /api/v1/users/me`
|
|
19
21
|
|
|
20
|
-
Returns the
|
|
22
|
+
Returns the signed-in user, with a session cookie or an API key. It is `GET /api/v1/users/:id` for the caller's own id, so it takes the same `metas` query parameters and answers with the same fields.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
curl -H "Cookie: <session cookie>" https://yourdomain.com/api/v1/users/me
|
|
26
|
+
curl -H "Authorization: Bearer <api key>" https://yourdomain.com/api/v1/users/me
|
|
27
|
+
curl -H "x-api-key: <api key>" https://yourdomain.com/api/v1/users/me
|
|
28
|
+
```
|
|
21
29
|
|
|
22
30
|
**Example Response:**
|
|
23
31
|
```json
|
|
24
32
|
{
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
"success": true,
|
|
34
|
+
"data": {
|
|
35
|
+
"id": "user_123",
|
|
36
|
+
"email": "john@example.com",
|
|
37
|
+
"name": "John Doe",
|
|
38
|
+
"firstName": "John",
|
|
39
|
+
"lastName": "Doe",
|
|
40
|
+
"image": "/uploads/avatar.png",
|
|
41
|
+
"country": null,
|
|
42
|
+
"timezone": null,
|
|
43
|
+
"language": "en",
|
|
44
|
+
"role": "member",
|
|
45
|
+
"emailVerified": true,
|
|
46
|
+
"createdAt": "2024-01-15T10:30:00Z",
|
|
47
|
+
"updatedAt": "2024-01-15T10:30:00Z"
|
|
48
|
+
}
|
|
37
49
|
}
|
|
38
50
|
```
|
|
39
51
|
|
|
40
52
|
### Update Current User
|
|
41
53
|
`PATCH /api/v1/users/me`
|
|
42
54
|
|
|
43
|
-
Update the
|
|
55
|
+
Update the signed-in user. It is `PATCH /api/v1/users/:id` for the caller's own id, with the same rules: only `firstName`, `lastName`, `language` and `metas` are accepted, and `role` is a superadmin's to change (anyone else gets `403`).
|
|
44
56
|
|
|
45
57
|
**Request Body:**
|
|
46
58
|
```json
|
|
47
59
|
{
|
|
48
|
-
"
|
|
49
|
-
"
|
|
60
|
+
"firstName": "John",
|
|
61
|
+
"lastName": "Smith",
|
|
62
|
+
"metas": { "preferences": { "theme": "dark" } }
|
|
50
63
|
}
|
|
51
64
|
```
|
|
52
65
|
|
|
66
|
+
To store per-user settings (the mobile client's preferences), use the user's metadata: `GET`/`PUT /api/v1/users/:id/meta/:key`.
|
|
67
|
+
|
|
53
68
|
### List Team Members
|
|
54
69
|
`GET /api/v1/users`
|
|
55
70
|
|
|
@@ -63,7 +78,7 @@ Returns all users in the current team.
|
|
|
63
78
|
### Get User by ID
|
|
64
79
|
`GET /api/v1/users/[id]`
|
|
65
80
|
|
|
66
|
-
Returns a specific user's profile
|
|
81
|
+
Returns a specific user's profile. Only that user or a superadmin can read it; `403` otherwise.
|
|
67
82
|
|
|
68
83
|
**Path Parameters:**
|
|
69
84
|
- `id` (string, required): User ID
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { NextRequest } from 'next/server';
|
|
2
|
+
import { OPTIONS } from '@nextsparkjs/core/routes/api/v1/users/[id]/route';
|
|
3
|
+
export { OPTIONS };
|
|
4
|
+
export declare const GET: (req: NextRequest) => Promise<import("next/server").NextResponse<unknown>>;
|
|
5
|
+
export declare const PATCH: (req: NextRequest) => Promise<import("next/server").NextResponse<unknown>>;
|
|
6
|
+
//# sourceMappingURL=route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/routes/api/v1/users/me/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAsC,MAAM,kDAAkD,CAAA;AAO9G,OAAO,EAAE,OAAO,EAAE,CAAA;AAClB,eAAO,MAAM,GAAG,GAAI,KAAK,WAAW,yDAAqB,CAAA;AACzD,eAAO,MAAM,KAAK,GAAI,KAAK,WAAW,yDAAuB,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OPTIONS, GET as getUser, PATCH as patchUser } from "@nextsparkjs/core/routes/api/v1/users/[id]/route";
|
|
2
|
+
const me = { params: Promise.resolve({ id: "me" }) };
|
|
3
|
+
export { OPTIONS };
|
|
4
|
+
export const GET = (req) => getUser(req, me);
|
|
5
|
+
export const PATCH = (req) => patchUser(req, me);
|
|
@@ -34,13 +34,13 @@ export default defineApiEndpoint({
|
|
|
34
34
|
{
|
|
35
35
|
id: 'update-profile',
|
|
36
36
|
title: 'Update My Profile',
|
|
37
|
-
description: 'Update current user name',
|
|
37
|
+
description: 'Update the current user first name',
|
|
38
38
|
method: 'PATCH',
|
|
39
39
|
pathParams: {
|
|
40
40
|
id: 'me'
|
|
41
41
|
},
|
|
42
42
|
payload: {
|
|
43
|
-
|
|
43
|
+
firstName: 'Updated'
|
|
44
44
|
},
|
|
45
45
|
tags: ['write', 'profile']
|
|
46
46
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.cc.d.ts","sourceRoot":"","sources":["../../../../src/routes/dashboard/(main)/layout.cc.tsx"],"names":[],"mappings":"AAgBA,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAQtF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense } from "react";
|
|
3
|
+
import { MainDashboardShell, enforceEntityPermission } from "../../_internal/dashboard-main-shared.js";
|
|
4
|
+
async function EntityPermission({ children }) {
|
|
5
|
+
await enforceEntityPermission();
|
|
6
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
7
|
+
}
|
|
8
|
+
export default function MainDashboardLayout({ children }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(MainDashboardShell, { children: /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(EntityPermission, { children }) }) });
|
|
10
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../src/routes/dashboard/(main)/layout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../src/routes/dashboard/(main)/layout.tsx"],"names":[],"mappings":"AAcA,iBAAe,0BAA0B,CAAC,EACxC,QAAQ,EACT,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,oDAIA;AAGD,eAAe,0BAA0B,CAAA"}
|
|
@@ -1,50 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { redirect } from "next/navigation";
|
|
4
|
-
import { DashboardShell } from "@nextsparkjs/core/components/dashboard/layouts/DashboardShell";
|
|
5
|
-
import { serializeEntityConfig } from "@nextsparkjs/core/lib/entities/serialization";
|
|
6
|
-
import { setEntityRegistry } from "@nextsparkjs/core/lib/entities/queries";
|
|
7
|
-
import { checkPermission } from "@nextsparkjs/core/lib/permissions/check";
|
|
8
|
-
import { getDashboardPermissionContext } from "@nextsparkjs/core/lib/auth/request-session";
|
|
9
|
-
import { isValidPermission } from "@nextsparkjs/core/lib/permissions/init";
|
|
10
|
-
import { ENTITY_REGISTRY, ENTITY_METADATA } from "@nextsparkjs/registries/entity-registry";
|
|
11
|
-
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA);
|
|
12
|
-
function parseEntityFromPathname(pathname) {
|
|
13
|
-
const match = pathname.match(/^\/dashboard\/([^/]+)(?:\/(.*))?$/);
|
|
14
|
-
if (!match) return null;
|
|
15
|
-
const entity = match[1];
|
|
16
|
-
const rest = match[2] || "";
|
|
17
|
-
if (rest === "" || rest === "/") return { entity, action: "list" };
|
|
18
|
-
if (rest === "create") return { entity, action: "create" };
|
|
19
|
-
if (rest.match(/^[^/]+\/edit$/)) return { entity, action: "update" };
|
|
20
|
-
if (rest.match(/^[^/]+$/)) return { entity, action: "read" };
|
|
21
|
-
return { entity, action: "read" };
|
|
22
|
-
}
|
|
23
|
-
function isEntityConfig(entity) {
|
|
24
|
-
return "slug" in entity;
|
|
25
|
-
}
|
|
2
|
+
import { MainDashboardShell, enforceEntityPermission } from "../../_internal/dashboard-main-shared.js";
|
|
26
3
|
async function DefaultMainDashboardLayout({
|
|
27
4
|
children
|
|
28
5
|
}) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const serializedEntities = entities.map(serializeEntityConfig);
|
|
32
|
-
const headersList = await headers();
|
|
33
|
-
const pathname = headersList.get("x-pathname") || "";
|
|
34
|
-
const { userId, teamId } = await getDashboardPermissionContext();
|
|
35
|
-
if (userId && teamId && pathname) {
|
|
36
|
-
const parsed = parseEntityFromPathname(pathname);
|
|
37
|
-
if (parsed) {
|
|
38
|
-
const { entity, action } = parsed;
|
|
39
|
-
const permission = `${entity}.${action}`;
|
|
40
|
-
if (isValidPermission(`${entity}.list`)) {
|
|
41
|
-
const hasPermission = await checkPermission(userId, teamId, permission);
|
|
42
|
-
if (!hasPermission) {
|
|
43
|
-
redirect(`/dashboard/permission-denied?entity=${entity}&action=${action}`);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return /* @__PURE__ */ jsx(DashboardShell, { entities: serializedEntities, children });
|
|
6
|
+
await enforceEntityPermission();
|
|
7
|
+
return /* @__PURE__ */ jsx(MainDashboardShell, { children });
|
|
49
8
|
}
|
|
50
9
|
export default DefaultMainDashboardLayout;
|
|
@@ -4,6 +4,6 @@ interface PermissionDeniedPageProps {
|
|
|
4
4
|
action?: string;
|
|
5
5
|
}>;
|
|
6
6
|
}
|
|
7
|
-
declare function PermissionDeniedPage({ searchParams }: PermissionDeniedPageProps):
|
|
7
|
+
declare function PermissionDeniedPage({ searchParams }: PermissionDeniedPageProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export default PermissionDeniedPage;
|
|
9
9
|
//# sourceMappingURL=page.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../src/routes/dashboard/permission-denied/page.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../src/routes/dashboard/permission-denied/page.tsx"],"names":[],"mappings":"AASA,UAAU,yBAAyB;IACjC,YAAY,EAAE,OAAO,CAAC;QACpB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAC,CAAA;CACH;AAkBD,iBAAS,oBAAoB,CAAC,EAAE,YAAY,EAAE,EAAE,yBAAyB,2CAMxE;AAED,eAAe,oBAAoB,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense } from "react";
|
|
2
3
|
import { NoPermission } from "@nextsparkjs/core/components/permissions/NoPermission";
|
|
3
|
-
async function
|
|
4
|
+
async function DeniedMessage({
|
|
4
5
|
searchParams
|
|
5
6
|
}) {
|
|
6
7
|
const { entity, action } = await searchParams;
|
|
@@ -14,4 +15,7 @@ async function PermissionDeniedPage({
|
|
|
14
15
|
}
|
|
15
16
|
);
|
|
16
17
|
}
|
|
18
|
+
function PermissionDeniedPage({ searchParams }) {
|
|
19
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(DeniedMessage, { searchParams }) });
|
|
20
|
+
}
|
|
17
21
|
export default PermissionDeniedPage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../src/routes/dashboard/settings/password/page.tsx"],"names":[],"mappings":"AAwBA,iBAAS,kBAAkB,
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../src/routes/dashboard/settings/password/page.tsx"],"names":[],"mappings":"AAwBA,iBAAS,kBAAkB,4CAsR1B;AAID,eAAe,kBAAkB,CAAA"}
|