@nextsparkjs/core 0.1.0-beta.84 → 0.1.0-beta.85
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/styles/classes.json +1 -1
- package/dist/templates/app/(auth)/forgot-password/page.tsx +216 -0
- package/dist/templates/app/(auth)/layout.tsx +51 -0
- package/dist/templates/app/(auth)/login/page.tsx +21 -0
- package/dist/templates/app/(auth)/reset-password/page.tsx +212 -0
- package/dist/templates/app/(auth)/signup/page.tsx +21 -0
- package/dist/templates/app/(auth)/verify-email/page.tsx +190 -0
- package/dist/templates/app/(public)/[...slug]/page.tsx +378 -0
- package/dist/templates/app/(public)/docs/[section]/[page]/page.tsx +90 -0
- package/dist/templates/app/(public)/docs/layout.tsx +25 -0
- package/dist/templates/app/(public)/docs/page.tsx +81 -0
- package/dist/templates/app/(public)/layout.tsx +41 -0
- package/dist/templates/app/(public)/page.tsx +19 -0
- package/dist/templates/app/403/page.tsx +89 -0
- package/dist/templates/app/api/auth/[...all]/route.ts +78 -0
- package/dist/templates/app/api/cron/billing/lifecycle/route.ts +98 -0
- package/dist/templates/app/api/csp-report/route.ts +175 -0
- package/dist/templates/app/api/devtools/config/entities/route.ts +108 -0
- package/dist/templates/app/api/devtools/config/theme/route.ts +66 -0
- package/dist/templates/app/api/devtools/tests/[...path]/route.ts +130 -0
- package/dist/templates/app/api/devtools/tests/route.ts +134 -0
- package/dist/templates/app/api/health/route.ts +29 -0
- package/dist/templates/app/api/internal/user-metadata/route.ts +36 -0
- package/dist/templates/app/api/superadmin/subscriptions/route.ts +310 -0
- package/dist/templates/app/api/superadmin/teams/[teamId]/route.ts +286 -0
- package/dist/templates/app/api/superadmin/teams/route.ts +188 -0
- package/dist/templates/app/api/superadmin/users/[userId]/route.ts +540 -0
- package/dist/templates/app/api/superadmin/users/route.ts +323 -0
- package/dist/templates/app/api/user/delete-account/route.ts +55 -0
- package/dist/templates/app/api/user/plan-flags/route.ts +283 -0
- package/dist/templates/app/api/user/profile/route.ts +133 -0
- package/dist/templates/app/api/v1/[entity]/[id]/child/[childType]/[childId]/route.ts +210 -0
- package/dist/templates/app/api/v1/[entity]/[id]/child/[childType]/route.ts +331 -0
- package/dist/templates/app/api/v1/[entity]/[id]/route.ts +35 -0
- package/dist/templates/app/api/v1/[entity]/docs.md +369 -0
- package/dist/templates/app/api/v1/[entity]/presets.ts +194 -0
- package/dist/templates/app/api/v1/[entity]/route.ts +31 -0
- package/dist/templates/app/api/v1/api-keys/[id]/route.ts +303 -0
- package/dist/templates/app/api/v1/api-keys/docs.md +101 -0
- package/dist/templates/app/api/v1/api-keys/presets.ts +31 -0
- package/dist/templates/app/api/v1/api-keys/route.ts +250 -0
- package/dist/templates/app/api/v1/auth/docs.md +184 -0
- package/dist/templates/app/api/v1/auth/presets.ts +44 -0
- package/dist/templates/app/api/v1/auth/signup-with-invite/route.ts +227 -0
- package/dist/templates/app/api/v1/billing/cancel/route.ts +206 -0
- package/dist/templates/app/api/v1/billing/change-plan/route.ts +97 -0
- package/dist/templates/app/api/v1/billing/check-action/route.ts +81 -0
- package/dist/templates/app/api/v1/billing/checkout/route.ts +124 -0
- package/dist/templates/app/api/v1/billing/docs.md +209 -0
- package/dist/templates/app/api/v1/billing/plans/route.ts +85 -0
- package/dist/templates/app/api/v1/billing/portal/route.ts +90 -0
- package/dist/templates/app/api/v1/billing/presets.ts +121 -0
- package/dist/templates/app/api/v1/billing/webhooks/stripe/route.ts +428 -0
- package/dist/templates/app/api/v1/blocks/[slug]/route.ts +29 -0
- package/dist/templates/app/api/v1/blocks/docs.md +173 -0
- package/dist/templates/app/api/v1/blocks/presets.ts +121 -0
- package/dist/templates/app/api/v1/blocks/route.ts +45 -0
- package/dist/templates/app/api/v1/blocks/validate/route.ts +45 -0
- package/dist/templates/app/api/v1/cron/docs.md +116 -0
- package/dist/templates/app/api/v1/cron/presets.ts +26 -0
- package/dist/templates/app/api/v1/cron/process/route.ts +108 -0
- package/dist/templates/app/api/v1/devtools/blocks/route.ts +82 -0
- package/dist/templates/app/api/v1/devtools/docs/route.ts +150 -0
- package/dist/templates/app/api/v1/devtools/docs.md +204 -0
- package/dist/templates/app/api/v1/devtools/features/route.ts +61 -0
- package/dist/templates/app/api/v1/devtools/flows/route.ts +61 -0
- package/dist/templates/app/api/v1/devtools/presets.ts +113 -0
- package/dist/templates/app/api/v1/devtools/scheduled-actions/route.ts +120 -0
- package/dist/templates/app/api/v1/devtools/testing/route.ts +82 -0
- package/dist/templates/app/api/v1/media/docs.md +117 -0
- package/dist/templates/app/api/v1/media/presets.ts +24 -0
- package/dist/templates/app/api/v1/media/upload/route.ts +150 -0
- package/dist/templates/app/api/v1/patterns/[id]/usages/route.ts +116 -0
- package/dist/templates/app/api/v1/plugin/[...path]/route.ts +373 -0
- package/dist/templates/app/api/v1/plugin/docs.md +79 -0
- package/dist/templates/app/api/v1/plugin/presets.ts +21 -0
- package/dist/templates/app/api/v1/plugin/route.ts +96 -0
- package/dist/templates/app/api/v1/post-categories/[id]/route.ts +255 -0
- package/dist/templates/app/api/v1/post-categories/docs.md +134 -0
- package/dist/templates/app/api/v1/post-categories/presets.ts +78 -0
- package/dist/templates/app/api/v1/post-categories/route.ts +119 -0
- package/dist/templates/app/api/v1/team-invitations/[token]/accept/route.ts +179 -0
- package/dist/templates/app/api/v1/team-invitations/[token]/decline/route.ts +120 -0
- package/dist/templates/app/api/v1/team-invitations/[token]/route.ts +89 -0
- package/dist/templates/app/api/v1/team-invitations/docs.md +88 -0
- package/dist/templates/app/api/v1/team-invitations/presets.ts +43 -0
- package/dist/templates/app/api/v1/team-invitations/route.ts +114 -0
- package/dist/templates/app/api/v1/teams/[teamId]/invitations/route.ts +171 -0
- package/dist/templates/app/api/v1/teams/[teamId]/invoices/[invoiceNumber]/route.ts +105 -0
- package/dist/templates/app/api/v1/teams/[teamId]/invoices/route.ts +125 -0
- package/dist/templates/app/api/v1/teams/[teamId]/members/[memberId]/route.ts +263 -0
- package/dist/templates/app/api/v1/teams/[teamId]/members/route.ts +358 -0
- package/dist/templates/app/api/v1/teams/[teamId]/route.ts +322 -0
- package/dist/templates/app/api/v1/teams/[teamId]/subscription/route.ts +50 -0
- package/dist/templates/app/api/v1/teams/[teamId]/usage/[limitSlug]/route.ts +91 -0
- package/dist/templates/app/api/v1/teams/docs.md +320 -0
- package/dist/templates/app/api/v1/teams/presets.ts +178 -0
- package/dist/templates/app/api/v1/teams/route.ts +293 -0
- package/dist/templates/app/api/v1/teams/switch/route.ts +88 -0
- package/dist/templates/app/api/v1/theme/[...path]/route.ts +361 -0
- package/dist/templates/app/api/v1/theme/docs.md +74 -0
- package/dist/templates/app/api/v1/theme/presets.ts +21 -0
- package/dist/templates/app/api/v1/theme/route.ts +96 -0
- package/dist/templates/app/api/v1/users/[id]/meta/[key]/route.ts +363 -0
- package/dist/templates/app/api/v1/users/[id]/route.ts +302 -0
- package/dist/templates/app/api/v1/users/docs.md +93 -0
- package/dist/templates/app/api/v1/users/presets.ts +59 -0
- package/dist/templates/app/api/v1/users/route.ts +197 -0
- package/dist/templates/app/dashboard/(main)/[entity]/[id]/edit/page.tsx +117 -0
- package/dist/templates/app/dashboard/(main)/[entity]/[id]/page.tsx +103 -0
- package/dist/templates/app/dashboard/(main)/[entity]/create/page.tsx +95 -0
- package/dist/templates/app/dashboard/(main)/[entity]/error.tsx +51 -0
- package/dist/templates/app/dashboard/(main)/[entity]/layout.tsx +113 -0
- package/dist/templates/app/dashboard/(main)/[entity]/loading.tsx +61 -0
- package/dist/templates/app/dashboard/(main)/[entity]/page.tsx +90 -0
- package/dist/templates/app/dashboard/(main)/layout.tsx +98 -0
- package/dist/templates/app/dashboard/(main)/loading.tsx +5 -0
- package/dist/templates/app/dashboard/(main)/page.tsx +201 -0
- package/dist/templates/app/dashboard/(main)/patterns/[id]/edit/page.tsx +114 -0
- package/dist/templates/app/dashboard/(main)/patterns/[id]/page.tsx +20 -0
- package/dist/templates/app/dashboard/(main)/patterns/[id]/reports/page.tsx +171 -0
- package/dist/templates/app/dashboard/(main)/patterns/create/page.tsx +86 -0
- package/dist/templates/app/dashboard/(main)/patterns/page.tsx +444 -0
- package/dist/templates/app/dashboard/features/analytics/page.tsx +35 -0
- package/dist/templates/app/dashboard/features/automation/page.tsx +35 -0
- package/dist/templates/app/dashboard/features/layout.tsx +13 -0
- package/dist/templates/app/dashboard/features/loading.tsx +5 -0
- package/dist/templates/app/dashboard/features/webhooks/page.tsx +35 -0
- package/dist/templates/app/dashboard/layout.tsx +86 -0
- package/dist/templates/app/dashboard/permission-denied/page.tsx +29 -0
- package/dist/templates/app/dashboard/settings/api-keys/loading.tsx +5 -0
- package/dist/templates/app/dashboard/settings/api-keys/page.tsx +513 -0
- package/dist/templates/app/dashboard/settings/billing/loading.tsx +5 -0
- package/dist/templates/app/dashboard/settings/billing/page.tsx +284 -0
- package/dist/templates/app/dashboard/settings/invoices/[invoiceNumber]/page.tsx +222 -0
- package/dist/templates/app/dashboard/settings/invoices/loading.tsx +5 -0
- package/dist/templates/app/dashboard/settings/invoices/page.tsx +82 -0
- package/dist/templates/app/dashboard/settings/layout.tsx +151 -0
- package/dist/templates/app/dashboard/settings/loading.tsx +5 -0
- package/dist/templates/app/dashboard/settings/notifications/loading.tsx +5 -0
- package/dist/templates/app/dashboard/settings/notifications/page.tsx +462 -0
- package/dist/templates/app/dashboard/settings/page.tsx +92 -0
- package/dist/templates/app/dashboard/settings/password/loading.tsx +5 -0
- package/dist/templates/app/dashboard/settings/password/page.tsx +306 -0
- package/dist/templates/app/dashboard/settings/plans/loading.tsx +5 -0
- package/dist/templates/app/dashboard/settings/plans/page.tsx +40 -0
- package/dist/templates/app/dashboard/settings/profile/loading.tsx +5 -0
- package/dist/templates/app/dashboard/settings/profile/page.tsx +686 -0
- package/dist/templates/app/dashboard/settings/security/loading.tsx +5 -0
- package/dist/templates/app/dashboard/settings/security/page.tsx +505 -0
- package/dist/templates/app/dashboard/settings/teams/loading.tsx +5 -0
- package/dist/templates/app/dashboard/settings/teams/page.tsx +272 -0
- package/dist/templates/app/dashboard/settings/teams/permissions/page.tsx +92 -0
- package/dist/templates/app/devtools/blocks/[slug]/page.tsx +39 -0
- package/dist/templates/app/devtools/blocks/page.tsx +31 -0
- package/dist/templates/app/devtools/config/page.tsx +31 -0
- package/dist/templates/app/devtools/features/page.tsx +31 -0
- package/dist/templates/app/devtools/flows/page.tsx +31 -0
- package/dist/templates/app/devtools/layout.tsx +58 -0
- package/dist/templates/app/devtools/page.tsx +121 -0
- package/dist/templates/app/devtools/scheduled-actions/page.tsx +157 -0
- package/dist/templates/app/devtools/style/page.tsx +330 -0
- package/dist/templates/app/devtools/tags/page.tsx +31 -0
- package/dist/templates/app/devtools/tests/[[...path]]/page.tsx +47 -0
- package/dist/templates/app/favicon.ico +0 -0
- package/dist/templates/app/globals.css +12 -0
- package/dist/templates/app/layout.tsx +96 -0
- package/dist/templates/app/public/page.tsx +30 -0
- package/dist/templates/app/superadmin/docs/[section]/[page]/page.tsx +92 -0
- package/dist/templates/app/superadmin/docs/page.tsx +75 -0
- package/dist/templates/app/superadmin/layout.tsx +67 -0
- package/dist/templates/app/superadmin/page.tsx +149 -0
- package/dist/templates/app/superadmin/subscriptions/page.tsx +655 -0
- package/dist/templates/app/superadmin/team-roles/page.tsx +493 -0
- package/dist/templates/app/superadmin/teams/[teamId]/page.tsx +687 -0
- package/dist/templates/app/superadmin/teams/page.tsx +302 -0
- package/dist/templates/app/superadmin/users/[userId]/page.tsx +548 -0
- package/dist/templates/app/superadmin/users/page.tsx +528 -0
- package/package.json +2 -2
- package/templates/app/(auth)/forgot-password/page.tsx +216 -0
- package/templates/app/(auth)/layout.tsx +51 -0
- package/templates/app/(auth)/login/page.tsx +21 -0
- package/templates/app/(auth)/reset-password/page.tsx +212 -0
- package/templates/app/(auth)/signup/page.tsx +21 -0
- package/templates/app/(auth)/verify-email/page.tsx +190 -0
- package/templates/app/(public)/[...slug]/page.tsx +378 -0
- package/templates/app/(public)/docs/[section]/[page]/page.tsx +90 -0
- package/templates/app/(public)/docs/layout.tsx +25 -0
- package/templates/app/(public)/docs/page.tsx +81 -0
- package/templates/app/(public)/layout.tsx +41 -0
- package/templates/app/(public)/page.tsx +19 -0
- package/templates/app/403/page.tsx +89 -0
- package/templates/app/api/auth/[...all]/route.ts +78 -0
- package/templates/app/api/cron/billing/lifecycle/route.ts +98 -0
- package/templates/app/api/csp-report/route.ts +175 -0
- package/templates/app/api/devtools/config/entities/route.ts +108 -0
- package/templates/app/api/devtools/config/theme/route.ts +66 -0
- package/templates/app/api/devtools/tests/[...path]/route.ts +130 -0
- package/templates/app/api/devtools/tests/route.ts +134 -0
- package/templates/app/api/health/route.ts +29 -0
- package/templates/app/api/internal/user-metadata/route.ts +36 -0
- package/templates/app/api/superadmin/subscriptions/route.ts +310 -0
- package/templates/app/api/superadmin/teams/[teamId]/route.ts +286 -0
- package/templates/app/api/superadmin/teams/route.ts +188 -0
- package/templates/app/api/superadmin/users/[userId]/route.ts +540 -0
- package/templates/app/api/superadmin/users/route.ts +323 -0
- package/templates/app/api/user/delete-account/route.ts +55 -0
- package/templates/app/api/user/plan-flags/route.ts +283 -0
- package/templates/app/api/user/profile/route.ts +133 -0
- package/templates/app/api/v1/[entity]/[id]/child/[childType]/[childId]/route.ts +210 -0
- package/templates/app/api/v1/[entity]/[id]/child/[childType]/route.ts +331 -0
- package/templates/app/api/v1/[entity]/[id]/route.ts +35 -0
- package/templates/app/api/v1/[entity]/docs.md +369 -0
- package/templates/app/api/v1/[entity]/presets.ts +194 -0
- package/templates/app/api/v1/[entity]/route.ts +31 -0
- package/templates/app/api/v1/api-keys/[id]/route.ts +303 -0
- package/templates/app/api/v1/api-keys/docs.md +101 -0
- package/templates/app/api/v1/api-keys/presets.ts +31 -0
- package/templates/app/api/v1/api-keys/route.ts +250 -0
- package/templates/app/api/v1/auth/docs.md +184 -0
- package/templates/app/api/v1/auth/presets.ts +44 -0
- package/templates/app/api/v1/auth/signup-with-invite/route.ts +227 -0
- package/templates/app/api/v1/billing/cancel/route.ts +206 -0
- package/templates/app/api/v1/billing/change-plan/route.ts +97 -0
- package/templates/app/api/v1/billing/check-action/route.ts +81 -0
- package/templates/app/api/v1/billing/checkout/route.ts +124 -0
- package/templates/app/api/v1/billing/docs.md +209 -0
- package/templates/app/api/v1/billing/plans/route.ts +85 -0
- package/templates/app/api/v1/billing/portal/route.ts +90 -0
- package/templates/app/api/v1/billing/presets.ts +121 -0
- package/templates/app/api/v1/billing/webhooks/stripe/route.ts +428 -0
- package/templates/app/api/v1/blocks/[slug]/route.ts +29 -0
- package/templates/app/api/v1/blocks/docs.md +173 -0
- package/templates/app/api/v1/blocks/presets.ts +121 -0
- package/templates/app/api/v1/blocks/route.ts +45 -0
- package/templates/app/api/v1/blocks/validate/route.ts +45 -0
- package/templates/app/api/v1/cron/docs.md +116 -0
- package/templates/app/api/v1/cron/presets.ts +26 -0
- package/templates/app/api/v1/cron/process/route.ts +108 -0
- package/templates/app/api/v1/devtools/blocks/route.ts +82 -0
- package/templates/app/api/v1/devtools/docs/route.ts +150 -0
- package/templates/app/api/v1/devtools/docs.md +204 -0
- package/templates/app/api/v1/devtools/features/route.ts +61 -0
- package/templates/app/api/v1/devtools/flows/route.ts +61 -0
- package/templates/app/api/v1/devtools/presets.ts +113 -0
- package/templates/app/api/v1/devtools/scheduled-actions/route.ts +120 -0
- package/templates/app/api/v1/devtools/testing/route.ts +82 -0
- package/templates/app/api/v1/media/docs.md +117 -0
- package/templates/app/api/v1/media/presets.ts +24 -0
- package/templates/app/api/v1/media/upload/route.ts +150 -0
- package/templates/app/api/v1/patterns/[id]/usages/route.ts +116 -0
- package/templates/app/api/v1/plugin/[...path]/route.ts +373 -0
- package/templates/app/api/v1/plugin/docs.md +79 -0
- package/templates/app/api/v1/plugin/presets.ts +21 -0
- package/templates/app/api/v1/plugin/route.ts +96 -0
- package/templates/app/api/v1/post-categories/[id]/route.ts +255 -0
- package/templates/app/api/v1/post-categories/docs.md +134 -0
- package/templates/app/api/v1/post-categories/presets.ts +78 -0
- package/templates/app/api/v1/post-categories/route.ts +119 -0
- package/templates/app/api/v1/team-invitations/[token]/accept/route.ts +179 -0
- package/templates/app/api/v1/team-invitations/[token]/decline/route.ts +120 -0
- package/templates/app/api/v1/team-invitations/[token]/route.ts +89 -0
- package/templates/app/api/v1/team-invitations/docs.md +88 -0
- package/templates/app/api/v1/team-invitations/presets.ts +43 -0
- package/templates/app/api/v1/team-invitations/route.ts +114 -0
- package/templates/app/api/v1/teams/[teamId]/invitations/route.ts +171 -0
- package/templates/app/api/v1/teams/[teamId]/invoices/[invoiceNumber]/route.ts +105 -0
- package/templates/app/api/v1/teams/[teamId]/invoices/route.ts +125 -0
- package/templates/app/api/v1/teams/[teamId]/members/[memberId]/route.ts +263 -0
- package/templates/app/api/v1/teams/[teamId]/members/route.ts +358 -0
- package/templates/app/api/v1/teams/[teamId]/route.ts +322 -0
- package/templates/app/api/v1/teams/[teamId]/subscription/route.ts +50 -0
- package/templates/app/api/v1/teams/[teamId]/usage/[limitSlug]/route.ts +91 -0
- package/templates/app/api/v1/teams/docs.md +320 -0
- package/templates/app/api/v1/teams/presets.ts +178 -0
- package/templates/app/api/v1/teams/route.ts +293 -0
- package/templates/app/api/v1/teams/switch/route.ts +88 -0
- package/templates/app/api/v1/theme/[...path]/route.ts +361 -0
- package/templates/app/api/v1/theme/docs.md +74 -0
- package/templates/app/api/v1/theme/presets.ts +21 -0
- package/templates/app/api/v1/theme/route.ts +96 -0
- package/templates/app/api/v1/users/[id]/meta/[key]/route.ts +363 -0
- package/templates/app/api/v1/users/[id]/route.ts +302 -0
- package/templates/app/api/v1/users/docs.md +93 -0
- package/templates/app/api/v1/users/presets.ts +59 -0
- package/templates/app/api/v1/users/route.ts +197 -0
- package/templates/app/dashboard/(main)/[entity]/[id]/edit/page.tsx +117 -0
- package/templates/app/dashboard/(main)/[entity]/[id]/page.tsx +103 -0
- package/templates/app/dashboard/(main)/[entity]/create/page.tsx +95 -0
- package/templates/app/dashboard/(main)/[entity]/error.tsx +51 -0
- package/templates/app/dashboard/(main)/[entity]/layout.tsx +113 -0
- package/templates/app/dashboard/(main)/[entity]/loading.tsx +61 -0
- package/templates/app/dashboard/(main)/[entity]/page.tsx +90 -0
- package/templates/app/dashboard/(main)/layout.tsx +98 -0
- package/templates/app/dashboard/(main)/loading.tsx +5 -0
- package/templates/app/dashboard/(main)/page.tsx +201 -0
- package/templates/app/dashboard/(main)/patterns/[id]/edit/page.tsx +114 -0
- package/templates/app/dashboard/(main)/patterns/[id]/page.tsx +20 -0
- package/templates/app/dashboard/(main)/patterns/[id]/reports/page.tsx +171 -0
- package/templates/app/dashboard/(main)/patterns/create/page.tsx +86 -0
- package/templates/app/dashboard/(main)/patterns/page.tsx +444 -0
- package/templates/app/dashboard/features/analytics/page.tsx +35 -0
- package/templates/app/dashboard/features/automation/page.tsx +35 -0
- package/templates/app/dashboard/features/layout.tsx +13 -0
- package/templates/app/dashboard/features/loading.tsx +5 -0
- package/templates/app/dashboard/features/webhooks/page.tsx +35 -0
- package/templates/app/dashboard/layout.tsx +86 -0
- package/templates/app/dashboard/permission-denied/page.tsx +29 -0
- package/templates/app/dashboard/settings/api-keys/loading.tsx +5 -0
- package/templates/app/dashboard/settings/api-keys/page.tsx +513 -0
- package/templates/app/dashboard/settings/billing/loading.tsx +5 -0
- package/templates/app/dashboard/settings/billing/page.tsx +284 -0
- package/templates/app/dashboard/settings/invoices/[invoiceNumber]/page.tsx +222 -0
- package/templates/app/dashboard/settings/invoices/loading.tsx +5 -0
- package/templates/app/dashboard/settings/invoices/page.tsx +82 -0
- package/templates/app/dashboard/settings/layout.tsx +151 -0
- package/templates/app/dashboard/settings/loading.tsx +5 -0
- package/templates/app/dashboard/settings/notifications/loading.tsx +5 -0
- package/templates/app/dashboard/settings/notifications/page.tsx +462 -0
- package/templates/app/dashboard/settings/page.tsx +92 -0
- package/templates/app/dashboard/settings/password/loading.tsx +5 -0
- package/templates/app/dashboard/settings/password/page.tsx +306 -0
- package/templates/app/dashboard/settings/plans/loading.tsx +5 -0
- package/templates/app/dashboard/settings/plans/page.tsx +40 -0
- package/templates/app/dashboard/settings/profile/loading.tsx +5 -0
- package/templates/app/dashboard/settings/profile/page.tsx +686 -0
- package/templates/app/dashboard/settings/security/loading.tsx +5 -0
- package/templates/app/dashboard/settings/security/page.tsx +505 -0
- package/templates/app/dashboard/settings/teams/loading.tsx +5 -0
- package/templates/app/dashboard/settings/teams/page.tsx +272 -0
- package/templates/app/dashboard/settings/teams/permissions/page.tsx +92 -0
- package/templates/app/devtools/blocks/[slug]/page.tsx +39 -0
- package/templates/app/devtools/blocks/page.tsx +31 -0
- package/templates/app/devtools/config/page.tsx +31 -0
- package/templates/app/devtools/features/page.tsx +31 -0
- package/templates/app/devtools/flows/page.tsx +31 -0
- package/templates/app/devtools/layout.tsx +58 -0
- package/templates/app/devtools/page.tsx +121 -0
- package/templates/app/devtools/scheduled-actions/page.tsx +157 -0
- package/templates/app/devtools/style/page.tsx +330 -0
- package/templates/app/devtools/tags/page.tsx +31 -0
- package/templates/app/devtools/tests/[[...path]]/page.tsx +47 -0
- package/templates/app/favicon.ico +0 -0
- package/templates/app/globals.css +12 -0
- package/templates/app/layout.tsx +96 -0
- package/templates/app/public/page.tsx +30 -0
- package/templates/app/superadmin/docs/[section]/[page]/page.tsx +92 -0
- package/templates/app/superadmin/docs/page.tsx +75 -0
- package/templates/app/superadmin/layout.tsx +67 -0
- package/templates/app/superadmin/page.tsx +149 -0
- package/templates/app/superadmin/subscriptions/page.tsx +655 -0
- package/templates/app/superadmin/team-roles/page.tsx +493 -0
- package/templates/app/superadmin/teams/[teamId]/page.tsx +687 -0
- package/templates/app/superadmin/teams/page.tsx +302 -0
- package/templates/app/superadmin/users/[userId]/page.tsx +548 -0
- package/templates/app/superadmin/users/page.tsx +528 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic Entity Detail Route
|
|
3
|
+
*
|
|
4
|
+
* Catch-all route that handles GET, PATCH, and DELETE requests for any registered entity.
|
|
5
|
+
* Supports dual authentication (API Keys + Sessions).
|
|
6
|
+
*
|
|
7
|
+
* Examples:
|
|
8
|
+
* GET /api/v1/products/123 -> Get product by ID
|
|
9
|
+
* PATCH /api/v1/products/123 -> Update product
|
|
10
|
+
* DELETE /api/v1/products/123 -> Delete product
|
|
11
|
+
* GET /api/v1/orders/456 -> Get order by ID
|
|
12
|
+
* PATCH /api/v1/orders/456 -> Update order
|
|
13
|
+
* DELETE /api/v1/orders/456 -> Delete order
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
// CRITICAL: Initialize entity registry for API routes
|
|
17
|
+
// This import is processed by webpack which resolves the @nextsparkjs alias
|
|
18
|
+
// The setEntityRegistry call happens at module load time
|
|
19
|
+
import { setEntityRegistry, isRegistryInitialized } from '@nextsparkjs/core/lib/entities/queries'
|
|
20
|
+
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
21
|
+
if (!isRegistryInitialized()) {
|
|
22
|
+
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
import {
|
|
26
|
+
handleGenericRead,
|
|
27
|
+
handleGenericUpdate,
|
|
28
|
+
handleGenericDelete,
|
|
29
|
+
handleGenericOptions
|
|
30
|
+
} from '@nextsparkjs/core/lib/api/entity/generic-handler'
|
|
31
|
+
|
|
32
|
+
export const GET = handleGenericRead
|
|
33
|
+
export const PATCH = handleGenericUpdate
|
|
34
|
+
export const DELETE = handleGenericDelete
|
|
35
|
+
export const OPTIONS = handleGenericOptions
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
# Dynamic Entity API
|
|
2
|
+
|
|
3
|
+
Generic CRUD endpoints for all registered entities. These routes dynamically handle any entity configured in the system.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Dynamic Entity API provides a unified interface for managing all registered entities in the system. Instead of creating separate API routes for each entity type, this single dynamic route handles all CRUD operations based on the entity configuration.
|
|
8
|
+
|
|
9
|
+
When you access `/api/v1/products`, `/api/v1/tasks`, `/api/v1/orders`, etc., you're using this dynamic routing system that reads the entity configuration and handles the request accordingly.
|
|
10
|
+
|
|
11
|
+
## Authentication
|
|
12
|
+
|
|
13
|
+
All endpoints require authentication via:
|
|
14
|
+
- **Session cookie** (for browser-based requests)
|
|
15
|
+
- **API Key** header (for server-to-server requests)
|
|
16
|
+
|
|
17
|
+
The entity's `access` configuration determines visibility rules (public, shared, etc.).
|
|
18
|
+
|
|
19
|
+
## Entity Resolution
|
|
20
|
+
|
|
21
|
+
URLs are resolved using the entity's `tableName` (typically plural). For example:
|
|
22
|
+
- `/api/v1/products` → resolves to `product` entity
|
|
23
|
+
- `/api/v1/tasks` → resolves to `task` entity
|
|
24
|
+
- `/api/v1/team-members` → resolves to `teamMember` entity
|
|
25
|
+
|
|
26
|
+
## Endpoints
|
|
27
|
+
|
|
28
|
+
### List Entities
|
|
29
|
+
`GET /api/v1/{entity}`
|
|
30
|
+
|
|
31
|
+
Returns a paginated list of entities.
|
|
32
|
+
|
|
33
|
+
**URL Examples:**
|
|
34
|
+
```
|
|
35
|
+
GET /api/v1/tasks # List tasks
|
|
36
|
+
GET /api/v1/products # List products
|
|
37
|
+
GET /api/v1/orders # List orders
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Query Parameters:**
|
|
41
|
+
- `limit` (number, optional): Maximum records to return. Default: 20
|
|
42
|
+
- `offset` (number, optional): Number of records to skip. Default: 0
|
|
43
|
+
- `search` (string, optional): Search term (searches searchable fields)
|
|
44
|
+
- `sortBy` (string, optional): Field to sort by (must be sortable)
|
|
45
|
+
- `sortOrder` (string, optional): Sort direction - "asc" or "desc"
|
|
46
|
+
- `{fieldName}` (any, optional): Filter by any filterable field
|
|
47
|
+
|
|
48
|
+
**Example Response:**
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"success": true,
|
|
52
|
+
"data": [
|
|
53
|
+
{
|
|
54
|
+
"id": "abc123",
|
|
55
|
+
"title": "Example item",
|
|
56
|
+
"status": "active",
|
|
57
|
+
"createdAt": "2024-01-15T10:30:00Z"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"pagination": {
|
|
61
|
+
"total": 42,
|
|
62
|
+
"limit": 20,
|
|
63
|
+
"offset": 0
|
|
64
|
+
},
|
|
65
|
+
"info": {
|
|
66
|
+
"timestamp": "2024-01-15T10:30:00Z"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Filtering Examples:**
|
|
72
|
+
```
|
|
73
|
+
GET /api/v1/tasks?status=todo
|
|
74
|
+
GET /api/v1/products?category=electronics&inStock=true
|
|
75
|
+
GET /api/v1/orders?search=john&sortBy=createdAt&sortOrder=desc
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Create Entity
|
|
79
|
+
`POST /api/v1/{entity}`
|
|
80
|
+
|
|
81
|
+
Create a new entity record.
|
|
82
|
+
|
|
83
|
+
**URL Examples:**
|
|
84
|
+
```
|
|
85
|
+
POST /api/v1/tasks # Create task
|
|
86
|
+
POST /api/v1/products # Create product
|
|
87
|
+
POST /api/v1/orders # Create order
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Request Body:**
|
|
91
|
+
The request body must include all required fields defined in the entity configuration.
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"title": "New item",
|
|
96
|
+
"description": "Item details",
|
|
97
|
+
"status": "draft"
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Response (201 Created):**
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"success": true,
|
|
105
|
+
"data": {
|
|
106
|
+
"id": "new123",
|
|
107
|
+
"title": "New item",
|
|
108
|
+
"description": "Item details",
|
|
109
|
+
"status": "draft",
|
|
110
|
+
"createdAt": "2024-01-15T10:30:00Z"
|
|
111
|
+
},
|
|
112
|
+
"info": {
|
|
113
|
+
"timestamp": "2024-01-15T10:30:00Z"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Validation:**
|
|
119
|
+
- Required fields must be provided
|
|
120
|
+
- Field values are validated against the entity schema
|
|
121
|
+
- Unique constraints are enforced (e.g., slugs)
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Single Entity Endpoints
|
|
126
|
+
|
|
127
|
+
### Get Entity by ID
|
|
128
|
+
`GET /api/v1/{entity}/{id}`
|
|
129
|
+
|
|
130
|
+
Returns a single entity by its ID.
|
|
131
|
+
|
|
132
|
+
**URL Examples:**
|
|
133
|
+
```
|
|
134
|
+
GET /api/v1/tasks/abc123 # Get task by ID
|
|
135
|
+
GET /api/v1/products/prod456 # Get product by ID
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Path Parameters:**
|
|
139
|
+
- `id` (string, required): Entity ID
|
|
140
|
+
|
|
141
|
+
**Response:**
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"success": true,
|
|
145
|
+
"data": {
|
|
146
|
+
"id": "abc123",
|
|
147
|
+
"title": "Example item",
|
|
148
|
+
"description": "Full details",
|
|
149
|
+
"status": "active",
|
|
150
|
+
"createdAt": "2024-01-15T10:30:00Z",
|
|
151
|
+
"updatedAt": "2024-01-16T14:20:00Z"
|
|
152
|
+
},
|
|
153
|
+
"info": {
|
|
154
|
+
"timestamp": "2024-01-16T14:20:00Z"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Update Entity
|
|
160
|
+
`PATCH /api/v1/{entity}/{id}`
|
|
161
|
+
|
|
162
|
+
Update an existing entity. Supports partial updates.
|
|
163
|
+
|
|
164
|
+
**URL Examples:**
|
|
165
|
+
```
|
|
166
|
+
PATCH /api/v1/tasks/abc123 # Update task
|
|
167
|
+
PATCH /api/v1/products/prod456 # Update product
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Path Parameters:**
|
|
171
|
+
- `id` (string, required): Entity ID
|
|
172
|
+
|
|
173
|
+
**Request Body (partial update):**
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"status": "completed",
|
|
177
|
+
"notes": "Updated notes"
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Response:**
|
|
182
|
+
```json
|
|
183
|
+
{
|
|
184
|
+
"success": true,
|
|
185
|
+
"data": {
|
|
186
|
+
"id": "abc123",
|
|
187
|
+
"title": "Example item",
|
|
188
|
+
"status": "completed",
|
|
189
|
+
"notes": "Updated notes",
|
|
190
|
+
"updatedAt": "2024-01-16T14:25:00Z"
|
|
191
|
+
},
|
|
192
|
+
"info": {
|
|
193
|
+
"timestamp": "2024-01-16T14:25:00Z"
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Delete Entity
|
|
199
|
+
`DELETE /api/v1/{entity}/{id}`
|
|
200
|
+
|
|
201
|
+
Delete an entity record.
|
|
202
|
+
|
|
203
|
+
**URL Examples:**
|
|
204
|
+
```
|
|
205
|
+
DELETE /api/v1/tasks/abc123 # Delete task
|
|
206
|
+
DELETE /api/v1/products/prod456 # Delete product
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**Path Parameters:**
|
|
210
|
+
- `id` (string, required): Entity ID
|
|
211
|
+
|
|
212
|
+
**Response:**
|
|
213
|
+
```json
|
|
214
|
+
{
|
|
215
|
+
"success": true,
|
|
216
|
+
"data": {
|
|
217
|
+
"deleted": true,
|
|
218
|
+
"id": "abc123"
|
|
219
|
+
},
|
|
220
|
+
"info": {
|
|
221
|
+
"timestamp": "2024-01-16T14:30:00Z"
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Child Entity Endpoints
|
|
229
|
+
|
|
230
|
+
For entities with child relationships (e.g., order items under orders):
|
|
231
|
+
|
|
232
|
+
### List Child Entities
|
|
233
|
+
`GET /api/v1/{entity}/{id}/child/{childType}`
|
|
234
|
+
|
|
235
|
+
Returns child entities for a parent entity.
|
|
236
|
+
|
|
237
|
+
**URL Examples:**
|
|
238
|
+
```
|
|
239
|
+
GET /api/v1/orders/ord123/child/order-items # List order items
|
|
240
|
+
GET /api/v1/customers/cust456/child/contacts # List customer contacts
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Path Parameters:**
|
|
244
|
+
- `id` (string, required): Parent entity ID
|
|
245
|
+
- `childType` (string, required): Child entity type name
|
|
246
|
+
|
|
247
|
+
**Response:**
|
|
248
|
+
```json
|
|
249
|
+
{
|
|
250
|
+
"success": true,
|
|
251
|
+
"data": [
|
|
252
|
+
{
|
|
253
|
+
"id": "item1",
|
|
254
|
+
"parentId": "ord123",
|
|
255
|
+
"productId": "prod456",
|
|
256
|
+
"quantity": 2,
|
|
257
|
+
"price": 29.99
|
|
258
|
+
}
|
|
259
|
+
],
|
|
260
|
+
"info": {
|
|
261
|
+
"timestamp": "2024-01-16T14:30:00Z"
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Create Child Entity
|
|
267
|
+
`POST /api/v1/{entity}/{id}/child/{childType}`
|
|
268
|
+
|
|
269
|
+
Create a child entity under a parent.
|
|
270
|
+
|
|
271
|
+
**URL Examples:**
|
|
272
|
+
```
|
|
273
|
+
POST /api/v1/orders/ord123/child/order-items # Create order item
|
|
274
|
+
POST /api/v1/customers/cust456/child/contacts # Create contact
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**Request Body:**
|
|
278
|
+
```json
|
|
279
|
+
{
|
|
280
|
+
"productId": "prod789",
|
|
281
|
+
"quantity": 3,
|
|
282
|
+
"price": 19.99
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**Note:** The `parentId` is automatically set from the URL parameter.
|
|
287
|
+
|
|
288
|
+
### Single Child Entity Operations
|
|
289
|
+
`GET/PATCH/DELETE /api/v1/{entity}/{id}/child/{childType}/{childId}`
|
|
290
|
+
|
|
291
|
+
Manage individual child entities.
|
|
292
|
+
|
|
293
|
+
**URL Examples:**
|
|
294
|
+
```
|
|
295
|
+
GET /api/v1/orders/ord123/child/order-items/item1 # Get item
|
|
296
|
+
PATCH /api/v1/orders/ord123/child/order-items/item1 # Update item
|
|
297
|
+
DELETE /api/v1/orders/ord123/child/order-items/item1 # Delete item
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## Entity Configuration Properties
|
|
303
|
+
|
|
304
|
+
Each entity's behavior is controlled by its configuration:
|
|
305
|
+
|
|
306
|
+
| Property | Description |
|
|
307
|
+
|----------|-------------|
|
|
308
|
+
| `access.public` | Whether non-authenticated users can read |
|
|
309
|
+
| `access.shared` | Whether all team members can see all records |
|
|
310
|
+
| `access.api` | Whether entity has API endpoints |
|
|
311
|
+
| `access.metadata` | Whether entity supports metadata system |
|
|
312
|
+
| `ui.features.searchable` | Whether search is enabled |
|
|
313
|
+
| `ui.features.sortable` | Whether sorting is enabled |
|
|
314
|
+
| `ui.features.filterable` | Whether filtering is enabled |
|
|
315
|
+
|
|
316
|
+
## Field Types
|
|
317
|
+
|
|
318
|
+
Entities support various field types:
|
|
319
|
+
|
|
320
|
+
| Type | Description |
|
|
321
|
+
|------|-------------|
|
|
322
|
+
| `text` | Single-line text input |
|
|
323
|
+
| `textarea` | Multi-line text |
|
|
324
|
+
| `richtext` | Rich text editor (HTML) |
|
|
325
|
+
| `number` | Numeric values |
|
|
326
|
+
| `select` | Single selection from options |
|
|
327
|
+
| `multiselect` | Multiple selections |
|
|
328
|
+
| `checkbox` | Boolean toggle |
|
|
329
|
+
| `date` | Date picker |
|
|
330
|
+
| `datetime` | Date and time picker |
|
|
331
|
+
| `image` | Image upload/URL |
|
|
332
|
+
| `relation` | Reference to another entity |
|
|
333
|
+
| `relation-multi` | Multiple references |
|
|
334
|
+
| `json` | JSON data |
|
|
335
|
+
| `tags` | Tag array |
|
|
336
|
+
|
|
337
|
+
## Row Level Security (RLS)
|
|
338
|
+
|
|
339
|
+
All entity queries respect PostgreSQL Row Level Security:
|
|
340
|
+
- Team-scoped entities filter by the user's active team
|
|
341
|
+
- Shared entities allow read access to all team members
|
|
342
|
+
- Private entities filter by `createdBy` user
|
|
343
|
+
- Superadmin/developer roles can bypass RLS for management
|
|
344
|
+
|
|
345
|
+
## Error Responses
|
|
346
|
+
|
|
347
|
+
| Status | Description |
|
|
348
|
+
|--------|-------------|
|
|
349
|
+
| 400 | Bad Request - Invalid parameters or validation error |
|
|
350
|
+
| 401 | Unauthorized - Authentication required |
|
|
351
|
+
| 403 | Forbidden - Insufficient permissions or RLS violation |
|
|
352
|
+
| 404 | Not Found - Entity type or record not found |
|
|
353
|
+
| 409 | Conflict - Duplicate key or constraint violation |
|
|
354
|
+
| 422 | Validation Error - Invalid field values |
|
|
355
|
+
| 500 | Server Error - Internal error |
|
|
356
|
+
|
|
357
|
+
## Related APIs
|
|
358
|
+
|
|
359
|
+
- **[API Keys](/api/v1/api-keys)** - Manage API keys for authentication
|
|
360
|
+
- **[Teams](/api/v1/teams)** - Team management and member access
|
|
361
|
+
- **[Media](/api/v1/media)** - File uploads for entity fields
|
|
362
|
+
- **[Blocks](/api/v1/blocks)** - Page builder blocks for builder-enabled entities
|
|
363
|
+
|
|
364
|
+
## See Also
|
|
365
|
+
|
|
366
|
+
For entity-specific documentation with field details, see the individual entity docs:
|
|
367
|
+
- Tasks: `/api/v1/tasks` (entity-specific docs)
|
|
368
|
+
- Pages: `/api/v1/pages` (entity-specific docs)
|
|
369
|
+
- Posts: `/api/v1/posts` (entity-specific docs)
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Presets for Dynamic Entity Routes
|
|
3
|
+
*
|
|
4
|
+
* These presets demonstrate the generic entity API pattern.
|
|
5
|
+
* Replace {entity} with any registered entity (tasks, products, orders, etc.)
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { defineApiEndpoint } from '@nextsparkjs/core/types/api-presets'
|
|
9
|
+
|
|
10
|
+
export default defineApiEndpoint({
|
|
11
|
+
endpoint: '/api/v1/{entity}',
|
|
12
|
+
summary: 'Generic CRUD operations for any registered entity',
|
|
13
|
+
presets: [
|
|
14
|
+
// ==================== LIST OPERATIONS ====================
|
|
15
|
+
{
|
|
16
|
+
id: 'list-basic',
|
|
17
|
+
title: 'List Entities (Basic)',
|
|
18
|
+
description: 'Fetch entities with default pagination',
|
|
19
|
+
method: 'GET',
|
|
20
|
+
queryParams: {
|
|
21
|
+
limit: '20',
|
|
22
|
+
offset: '0'
|
|
23
|
+
},
|
|
24
|
+
tags: ['read', 'list']
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 'list-with-search',
|
|
28
|
+
title: 'List with Search',
|
|
29
|
+
description: 'Search entities by searchable fields',
|
|
30
|
+
method: 'GET',
|
|
31
|
+
queryParams: {
|
|
32
|
+
search: 'example',
|
|
33
|
+
limit: '20'
|
|
34
|
+
},
|
|
35
|
+
tags: ['read', 'list', 'search']
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'list-with-sort',
|
|
39
|
+
title: 'List with Sorting',
|
|
40
|
+
description: 'Sort entities by a specific field',
|
|
41
|
+
method: 'GET',
|
|
42
|
+
queryParams: {
|
|
43
|
+
sortBy: 'createdAt',
|
|
44
|
+
sortOrder: 'desc',
|
|
45
|
+
limit: '20'
|
|
46
|
+
},
|
|
47
|
+
tags: ['read', 'list', 'sort']
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: 'list-with-filter',
|
|
51
|
+
title: 'List with Filter',
|
|
52
|
+
description: 'Filter entities by field value (e.g., status)',
|
|
53
|
+
method: 'GET',
|
|
54
|
+
queryParams: {
|
|
55
|
+
status: 'active',
|
|
56
|
+
limit: '20'
|
|
57
|
+
},
|
|
58
|
+
tags: ['read', 'list', 'filter']
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: 'list-paginated',
|
|
62
|
+
title: 'List with Pagination',
|
|
63
|
+
description: 'Get second page of results',
|
|
64
|
+
method: 'GET',
|
|
65
|
+
queryParams: {
|
|
66
|
+
limit: '10',
|
|
67
|
+
offset: '10'
|
|
68
|
+
},
|
|
69
|
+
tags: ['read', 'list', 'pagination']
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
// ==================== CREATE OPERATIONS ====================
|
|
73
|
+
{
|
|
74
|
+
id: 'create-basic',
|
|
75
|
+
title: 'Create Entity',
|
|
76
|
+
description: 'Create a new entity record',
|
|
77
|
+
method: 'POST',
|
|
78
|
+
payload: {
|
|
79
|
+
title: 'New Item',
|
|
80
|
+
status: 'draft'
|
|
81
|
+
},
|
|
82
|
+
tags: ['write', 'create']
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: 'create-with-fields',
|
|
86
|
+
title: 'Create with All Fields',
|
|
87
|
+
description: 'Create entity with multiple fields',
|
|
88
|
+
method: 'POST',
|
|
89
|
+
payload: {
|
|
90
|
+
title: 'Complete Item',
|
|
91
|
+
description: 'Full description here',
|
|
92
|
+
status: 'active',
|
|
93
|
+
priority: 'high'
|
|
94
|
+
},
|
|
95
|
+
tags: ['write', 'create']
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
// ==================== READ SINGLE ====================
|
|
99
|
+
{
|
|
100
|
+
id: 'get-by-id',
|
|
101
|
+
title: 'Get Entity by ID',
|
|
102
|
+
description: 'Fetch a single entity by its ID',
|
|
103
|
+
method: 'GET',
|
|
104
|
+
path: '/{id}',
|
|
105
|
+
tags: ['read', 'detail']
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
// ==================== UPDATE OPERATIONS ====================
|
|
109
|
+
{
|
|
110
|
+
id: 'update-status',
|
|
111
|
+
title: 'Update Status',
|
|
112
|
+
description: 'Update entity status field',
|
|
113
|
+
method: 'PATCH',
|
|
114
|
+
path: '/{id}',
|
|
115
|
+
payload: {
|
|
116
|
+
status: 'completed'
|
|
117
|
+
},
|
|
118
|
+
tags: ['write', 'update']
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: 'update-multiple-fields',
|
|
122
|
+
title: 'Update Multiple Fields',
|
|
123
|
+
description: 'Partial update with multiple fields',
|
|
124
|
+
method: 'PATCH',
|
|
125
|
+
path: '/{id}',
|
|
126
|
+
payload: {
|
|
127
|
+
title: 'Updated Title',
|
|
128
|
+
description: 'Updated description',
|
|
129
|
+
priority: 'low'
|
|
130
|
+
},
|
|
131
|
+
tags: ['write', 'update']
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
// ==================== DELETE OPERATIONS ====================
|
|
135
|
+
{
|
|
136
|
+
id: 'delete-by-id',
|
|
137
|
+
title: 'Delete Entity',
|
|
138
|
+
description: 'Delete an entity by ID',
|
|
139
|
+
method: 'DELETE',
|
|
140
|
+
path: '/{id}',
|
|
141
|
+
tags: ['write', 'delete']
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
// ==================== CHILD ENTITY OPERATIONS ====================
|
|
145
|
+
{
|
|
146
|
+
id: 'list-children',
|
|
147
|
+
title: 'List Child Entities',
|
|
148
|
+
description: 'Get all child entities for a parent',
|
|
149
|
+
method: 'GET',
|
|
150
|
+
path: '/{id}/child/{childType}',
|
|
151
|
+
tags: ['read', 'list', 'children']
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: 'create-child',
|
|
155
|
+
title: 'Create Child Entity',
|
|
156
|
+
description: 'Add a new child record to parent',
|
|
157
|
+
method: 'POST',
|
|
158
|
+
path: '/{id}/child/{childType}',
|
|
159
|
+
payload: {
|
|
160
|
+
name: 'New Child Item',
|
|
161
|
+
value: 100
|
|
162
|
+
},
|
|
163
|
+
tags: ['write', 'create', 'children']
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: 'get-child',
|
|
167
|
+
title: 'Get Child Entity',
|
|
168
|
+
description: 'Fetch a specific child entity',
|
|
169
|
+
method: 'GET',
|
|
170
|
+
path: '/{id}/child/{childType}/{childId}',
|
|
171
|
+
tags: ['read', 'detail', 'children']
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
id: 'update-child',
|
|
175
|
+
title: 'Update Child Entity',
|
|
176
|
+
description: 'Update a child entity',
|
|
177
|
+
method: 'PATCH',
|
|
178
|
+
path: '/{id}/child/{childType}/{childId}',
|
|
179
|
+
payload: {
|
|
180
|
+
name: 'Updated Child',
|
|
181
|
+
value: 200
|
|
182
|
+
},
|
|
183
|
+
tags: ['write', 'update', 'children']
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
id: 'delete-child',
|
|
187
|
+
title: 'Delete Child Entity',
|
|
188
|
+
description: 'Delete a child entity',
|
|
189
|
+
method: 'DELETE',
|
|
190
|
+
path: '/{id}/child/{childType}/{childId}',
|
|
191
|
+
tags: ['write', 'delete', 'children']
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
})
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic Entity List Route
|
|
3
|
+
*
|
|
4
|
+
* Catch-all route that handles GET and POST requests for any registered entity.
|
|
5
|
+
* Supports dual authentication (API Keys + Sessions).
|
|
6
|
+
*
|
|
7
|
+
* Examples:
|
|
8
|
+
* GET /api/v1/products -> List products
|
|
9
|
+
* POST /api/v1/products -> Create product
|
|
10
|
+
* GET /api/v1/orders -> List orders
|
|
11
|
+
* POST /api/v1/orders -> Create order
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// CRITICAL: Initialize entity registry for API routes
|
|
15
|
+
// This import is processed by webpack which resolves the @nextsparkjs alias
|
|
16
|
+
// The setEntityRegistry call happens at module load time
|
|
17
|
+
import { setEntityRegistry, isRegistryInitialized } from '@nextsparkjs/core/lib/entities/queries'
|
|
18
|
+
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
19
|
+
if (!isRegistryInitialized()) {
|
|
20
|
+
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
import {
|
|
24
|
+
handleGenericList,
|
|
25
|
+
handleGenericCreate,
|
|
26
|
+
handleGenericOptions
|
|
27
|
+
} from '@nextsparkjs/core/lib/api/entity/generic-handler'
|
|
28
|
+
|
|
29
|
+
export const GET = handleGenericList
|
|
30
|
+
export const POST = handleGenericCreate
|
|
31
|
+
export const OPTIONS = handleGenericOptions
|