@nextsparkjs/theme-default 0.1.0-beta.1 → 0.1.0-beta.101
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/LICENSE +21 -0
- package/api/ai/chat/stream/route.ts +4 -1
- package/api/ai/orchestrator/route.ts +10 -3
- package/api/ai/single-agent/route.ts +10 -3
- package/api/ai/usage/route.ts +4 -1
- package/blocks/benefits/component.tsx +4 -4
- package/blocks/cta-section/component.tsx +4 -4
- package/blocks/faq-accordion/component.tsx +2 -2
- package/blocks/features-grid/component.tsx +5 -5
- package/blocks/hero/component.tsx +2 -2
- package/blocks/hero/fields.ts +1 -1
- package/blocks/hero-with-form/component.tsx +7 -7
- package/blocks/hero-with-form/fields.ts +1 -1
- package/blocks/jumbotron/component.tsx +7 -7
- package/blocks/jumbotron/fields.ts +1 -1
- package/blocks/logo-cloud/component.tsx +6 -6
- package/blocks/logo-cloud/fields.ts +1 -1
- package/blocks/post-content/component.tsx +2 -2
- package/blocks/pricing-table/component.tsx +5 -5
- package/blocks/split-content/component.tsx +5 -5
- package/blocks/split-content/fields.ts +1 -1
- package/blocks/stats-counter/component.tsx +9 -9
- package/blocks/testimonials/component.tsx +4 -4
- package/blocks/testimonials/fields.ts +1 -1
- package/blocks/text-content/component.tsx +12 -10
- package/blocks/timeline/component.tsx +12 -12
- package/blocks/video-hero/component.tsx +7 -7
- package/blocks/video-hero/fields.ts +1 -1
- package/components/ai-chat/ChatPanel.tsx +7 -7
- package/components/ai-chat/Message.tsx +2 -2
- package/components/ai-chat/MessageInput.tsx +3 -3
- package/components/ai-chat/MessageList.tsx +3 -3
- package/components/ai-chat/TypingIndicator.tsx +2 -2
- package/config/app.config.ts +75 -62
- package/config/dashboard.config.ts +14 -0
- package/config/features.config.ts +10 -0
- package/config/permissions.config.ts +26 -1
- package/docs/{01-overview → public/01-overview}/01-introduction.md +5 -0
- package/docs/{01-overview → public/01-overview}/02-customization.md +5 -0
- package/docs/{02-features → public/02-features}/03-tasks-entity.md +5 -0
- package/docs/{03-ai → public/03-ai}/01-overview.md +5 -0
- package/docs/{03-ai → public/03-ai}/02-customization.md +5 -0
- package/docs/superadmin/01-setup/01-configuration.md +79 -0
- package/docs/superadmin/01-setup/02-deployment.md +82 -0
- package/docs/superadmin/02-management/01-users.md +83 -0
- package/docs/superadmin/03-integrations/01-langchain.md +139 -0
- package/entities/customers/api/docs.md +107 -0
- package/entities/customers/api/presets.ts +80 -0
- package/entities/pages/api/docs.md +114 -0
- package/entities/pages/api/presets.ts +72 -0
- package/entities/posts/api/docs.md +120 -0
- package/entities/posts/api/presets.ts +74 -0
- package/entities/tasks/api/docs.md +126 -0
- package/entities/tasks/api/presets.ts +84 -0
- package/lib/selectors.ts +7 -4
- package/messages/de/admin.json +45 -0
- package/messages/en/admin.json +56 -0
- package/messages/en/navigation.json +2 -1
- package/messages/es/admin.json +56 -0
- package/messages/es/navigation.json +2 -1
- package/messages/fr/admin.json +45 -0
- package/messages/it/admin.json +45 -0
- package/messages/pt/admin.json +45 -0
- package/migrations/090_demo_users_teams.sql +11 -11
- package/migrations/091_greek_teams_billing.sql +15 -15
- package/migrations/093_pages_sample_data.sql +7 -7
- package/migrations/098_patterns_sample_data.sql +234 -0
- package/package.json +8 -3
- package/styles/globals.css +42 -0
- package/templates/(public)/blog/[slug]/page.tsx +1 -1
- package/templates/(public)/page.tsx +1 -1
- package/tests/cypress/e2e/_utils/devtools/access.bdd.md +262 -0
- package/tests/cypress/e2e/_utils/devtools/access.cy.ts +171 -0
- package/tests/cypress/e2e/_utils/devtools/navigation.bdd.md +261 -0
- package/tests/cypress/e2e/_utils/devtools/navigation.cy.ts +157 -0
- package/tests/cypress/e2e/_utils/devtools/pages.bdd.md +303 -0
- package/tests/cypress/e2e/_utils/devtools/pages.cy.ts +184 -0
- package/tests/cypress/e2e/_utils/docs/README.md +215 -0
- package/tests/cypress/e2e/_utils/selectors/auth.bdd.md +354 -0
- package/tests/cypress/e2e/_utils/selectors/auth.cy.ts +310 -0
- package/tests/cypress/e2e/_utils/selectors/billing.bdd.md +276 -0
- package/tests/cypress/e2e/_utils/selectors/billing.cy.ts +182 -0
- package/tests/cypress/e2e/_utils/selectors/block-editor.bdd.md +615 -0
- package/tests/cypress/e2e/_utils/selectors/block-editor.cy.ts +783 -0
- package/tests/cypress/e2e/_utils/selectors/dashboard-container.cy.ts +52 -0
- package/tests/cypress/e2e/_utils/selectors/dashboard-mobile.bdd.md +205 -0
- package/tests/cypress/e2e/_utils/selectors/dashboard-mobile.cy.ts +137 -0
- package/tests/cypress/e2e/_utils/selectors/dashboard-navigation.bdd.md +147 -0
- package/tests/cypress/e2e/_utils/selectors/dashboard-navigation.cy.ts +114 -0
- package/tests/cypress/e2e/_utils/selectors/dashboard-sidebar.bdd.md +76 -0
- package/tests/cypress/e2e/_utils/selectors/dashboard-sidebar.cy.ts +68 -0
- package/tests/cypress/e2e/_utils/selectors/dashboard-topnav.bdd.md +326 -0
- package/tests/cypress/e2e/_utils/selectors/dashboard-topnav.cy.ts +177 -0
- package/tests/cypress/e2e/_utils/selectors/devtools.bdd.md +306 -0
- package/tests/cypress/e2e/_utils/selectors/devtools.cy.ts +273 -0
- package/tests/cypress/e2e/_utils/selectors/global-search.bdd.md +115 -0
- package/tests/cypress/e2e/_utils/selectors/global-search.cy.ts +93 -0
- package/tests/cypress/e2e/_utils/selectors/patterns.bdd.md +388 -0
- package/tests/cypress/e2e/_utils/selectors/patterns.cy.ts +559 -0
- package/tests/cypress/e2e/_utils/selectors/public.cy.ts +112 -0
- package/tests/cypress/e2e/_utils/selectors/settings-api-keys.bdd.md +266 -0
- package/tests/cypress/e2e/_utils/selectors/settings-api-keys.cy.ts +233 -0
- package/tests/cypress/e2e/_utils/selectors/settings-billing.bdd.md +78 -0
- package/tests/cypress/e2e/_utils/selectors/settings-billing.cy.ts +108 -0
- package/tests/cypress/e2e/_utils/selectors/settings-layout.bdd.md +129 -0
- package/tests/cypress/e2e/_utils/selectors/settings-layout.cy.ts +115 -0
- package/tests/cypress/e2e/_utils/selectors/settings-password.bdd.md +82 -0
- package/tests/cypress/e2e/_utils/selectors/settings-password.cy.ts +74 -0
- package/tests/cypress/e2e/_utils/selectors/settings-profile.bdd.md +77 -0
- package/tests/cypress/e2e/_utils/selectors/settings-profile.cy.ts +79 -0
- package/tests/cypress/e2e/_utils/selectors/settings-teams.bdd.md +130 -0
- package/tests/cypress/e2e/_utils/selectors/settings-teams.cy.ts +86 -0
- package/tests/cypress/e2e/_utils/selectors/superadmin.bdd.md +261 -0
- package/tests/cypress/e2e/_utils/selectors/superadmin.cy.ts +193 -0
- package/tests/cypress/e2e/_utils/selectors/tasks.bdd.md +593 -0
- package/tests/cypress/e2e/_utils/selectors/tasks.cy.ts +864 -0
- package/tests/cypress/e2e/_utils/selectors/taxonomies.cy.ts +126 -0
- package/tests/cypress/e2e/_utils/selectors/teams.bdd.md +278 -0
- package/tests/cypress/e2e/_utils/selectors/teams.cy.ts +195 -0
- package/tests/cypress/e2e/_utils/superadmin/all-teams.bdd.md +261 -0
- package/tests/cypress/e2e/_utils/superadmin/all-teams.cy.ts +177 -0
- package/tests/cypress/e2e/_utils/superadmin/all-users.bdd.md +406 -0
- package/tests/cypress/e2e/_utils/superadmin/all-users.cy.ts +294 -0
- package/tests/cypress/e2e/_utils/superadmin/dashboard.bdd.md +235 -0
- package/tests/cypress/e2e/_utils/superadmin/dashboard.cy.ts +149 -0
- package/tests/cypress/e2e/_utils/superadmin/subscriptions-overview.bdd.md +290 -0
- package/tests/cypress/e2e/_utils/superadmin/subscriptions-overview.cy.ts +194 -0
- package/tests/cypress/e2e/ai/ai-usage.cy.ts +209 -0
- package/tests/cypress/e2e/ai/chat-api.cy.ts +119 -0
- package/tests/cypress/e2e/ai/guardrails.cy.ts +332 -0
- package/tests/cypress/e2e/api/_core/billing/BillingAPIController.js +319 -0
- package/tests/cypress/e2e/api/_core/billing/check-action.cy.ts +326 -0
- package/tests/cypress/e2e/api/_core/billing/checkout.cy.ts +358 -0
- package/tests/cypress/e2e/api/_core/billing/lifecycle.cy.ts +423 -0
- package/tests/cypress/e2e/api/_core/billing/plans/README.md +345 -0
- package/tests/cypress/e2e/api/_core/billing/plans/business.cy.ts +412 -0
- package/tests/cypress/e2e/api/_core/billing/plans/downgrade.cy.ts +510 -0
- package/tests/cypress/e2e/api/_core/billing/plans/fixtures/billing-plans.json +163 -0
- package/tests/cypress/e2e/api/_core/billing/plans/free.cy.ts +500 -0
- package/tests/cypress/e2e/api/_core/billing/plans/pro.cy.ts +497 -0
- package/tests/cypress/e2e/api/_core/billing/plans/starter.cy.ts +342 -0
- package/tests/cypress/e2e/api/_core/billing/portal.cy.ts +313 -0
- package/tests/cypress/e2e/api/_core/devtools/registries.bdd.md +300 -0
- package/tests/cypress/e2e/api/_core/devtools/registries.cy.ts +368 -0
- package/tests/cypress/e2e/api/_core/scheduled-actions/cron-endpoint.bdd.md +375 -0
- package/tests/cypress/e2e/api/_core/scheduled-actions/cron-endpoint.cy.ts +346 -0
- package/tests/cypress/e2e/api/_core/scheduled-actions/devtools-endpoint.bdd.md +451 -0
- package/tests/cypress/e2e/api/_core/scheduled-actions/devtools-endpoint.cy.ts +447 -0
- package/tests/cypress/e2e/api/_core/scheduled-actions/scheduling.bdd.md +649 -0
- package/tests/cypress/e2e/api/_core/scheduled-actions/scheduling.cy.ts +333 -0
- package/tests/cypress/e2e/api/_core/security/security-headers.cy.ts +601 -0
- package/tests/cypress/e2e/api/_core/settings/api-keys.crud.cy.ts +923 -0
- package/tests/cypress/e2e/api/_core/teams/teams-security.cy.ts +415 -0
- package/tests/cypress/e2e/api/_core/users/users-crud.cy.ts +469 -0
- package/tests/cypress/e2e/api/_core/users/users-metas.cy.ts +913 -0
- package/tests/cypress/e2e/api/_core/users/users-security.cy.ts +375 -0
- package/tests/cypress/e2e/api/entities/customers/customers-crud.cy.ts +648 -0
- package/tests/cypress/e2e/api/entities/customers/customers-metas.cy.ts +839 -0
- package/tests/cypress/e2e/api/entities/media/media-crud.cy.ts +600 -0
- package/tests/cypress/e2e/api/entities/media/media-role-permissions.cy.ts +617 -0
- package/tests/cypress/e2e/api/entities/media/media-team-isolation.cy.ts +464 -0
- package/tests/cypress/e2e/api/entities/pages/blocks-scope.cy.ts +396 -0
- package/tests/cypress/e2e/api/entities/pages/pages-crud.cy.ts +425 -0
- package/tests/cypress/e2e/api/entities/pages/pages-status.cy.ts +335 -0
- package/tests/cypress/e2e/api/entities/posts/post-categories-crud.cy.ts +610 -0
- package/tests/cypress/e2e/api/entities/posts/posts-crud.cy.ts +709 -0
- package/tests/cypress/e2e/api/entities/posts/posts-status.cy.ts +396 -0
- package/tests/cypress/e2e/api/entities/tasks/tasks-crud.cy.ts +602 -0
- package/tests/cypress/e2e/api/entities/tasks/tasks-metas.cy.ts +878 -0
- package/tests/cypress/e2e/patterns/patterns-in-pages.cy.ts +367 -0
- package/tests/cypress/e2e/uat/_core/auth/app-roles/developer-login.bdd.md +231 -0
- package/tests/cypress/e2e/uat/_core/auth/app-roles/developer-login.cy.ts +144 -0
- package/tests/cypress/e2e/uat/_core/auth/app-roles/superadmin-login.bdd.md +118 -0
- package/tests/cypress/e2e/uat/_core/auth/app-roles/superadmin-login.cy.ts +84 -0
- package/tests/cypress/e2e/uat/_core/auth/custom-roles/editor-login.bdd.md +288 -0
- package/tests/cypress/e2e/uat/_core/auth/custom-roles/editor-login.cy.ts +188 -0
- package/tests/cypress/e2e/uat/_core/auth/login-logout.bdd.md +160 -0
- package/tests/cypress/e2e/uat/_core/auth/login-logout.cy.ts +116 -0
- package/tests/cypress/e2e/uat/_core/auth/password-reset.bdd.md +289 -0
- package/tests/cypress/e2e/uat/_core/auth/password-reset.cy.ts +200 -0
- package/tests/cypress/e2e/uat/_core/auth/registration-control-invitation.cy.ts +176 -0
- package/tests/cypress/e2e/uat/_core/auth/registration-control-open.cy.ts +131 -0
- package/tests/cypress/e2e/uat/_core/auth/registration-control.cy.ts +140 -0
- package/tests/cypress/e2e/uat/_core/auth/team-roles/admin-login.bdd.md +225 -0
- package/tests/cypress/e2e/uat/_core/auth/team-roles/admin-login.cy.ts +148 -0
- package/tests/cypress/e2e/uat/_core/auth/team-roles/member-login.bdd.md +251 -0
- package/tests/cypress/e2e/uat/_core/auth/team-roles/member-login.cy.ts +163 -0
- package/tests/cypress/e2e/uat/_core/auth/team-roles/owner-login.bdd.md +231 -0
- package/tests/cypress/e2e/uat/_core/auth/team-roles/owner-login.cy.ts +141 -0
- package/tests/cypress/e2e/uat/_core/billing/extended.bdd.md +273 -0
- package/tests/cypress/e2e/uat/_core/billing/extended.cy.ts +209 -0
- package/tests/cypress/e2e/uat/_core/billing/feature-gates.bdd.md +407 -0
- package/tests/cypress/e2e/uat/_core/billing/feature-gates.cy.ts +307 -0
- package/tests/cypress/e2e/uat/_core/billing/page.bdd.md +329 -0
- package/tests/cypress/e2e/uat/_core/billing/page.cy.ts +250 -0
- package/tests/cypress/e2e/uat/_core/billing/status.bdd.md +190 -0
- package/tests/cypress/e2e/uat/_core/billing/status.cy.ts +145 -0
- package/tests/cypress/e2e/uat/_core/billing/team-switch.bdd.md +156 -0
- package/tests/cypress/e2e/uat/_core/billing/team-switch.cy.ts +122 -0
- package/tests/cypress/e2e/uat/_core/billing/usage.bdd.md +218 -0
- package/tests/cypress/e2e/uat/_core/billing/usage.cy.ts +176 -0
- package/tests/cypress/e2e/uat/_core/blocks/hero.bdd.md +124 -0
- package/tests/cypress/e2e/uat/_core/blocks/hero.cy.ts +56 -0
- package/tests/cypress/e2e/uat/_core/devtools/api-tester.cy.ts +390 -0
- package/tests/cypress/e2e/uat/_core/performance/suspense-loading.cy.ts +134 -0
- package/tests/cypress/e2e/uat/_core/scheduled-actions/devtools-ui.bdd.md +736 -0
- package/tests/cypress/e2e/uat/_core/scheduled-actions/devtools-ui.cy.ts +740 -0
- package/tests/cypress/e2e/uat/_core/teams/inline-edit.cy.ts +278 -0
- package/tests/cypress/e2e/uat/_core/teams/roles-matrix.bdd.md +553 -0
- package/tests/cypress/e2e/uat/_core/teams/roles-matrix.cy.ts +185 -0
- package/tests/cypress/e2e/uat/_core/teams/switcher.bdd.md +1151 -0
- package/tests/cypress/e2e/uat/_core/teams/switcher.cy.ts +497 -0
- package/tests/cypress/e2e/uat/_core/teams/team-switcher.md +198 -0
- package/tests/cypress/e2e/uat/entities/customers/member.bdd.md +275 -0
- package/tests/cypress/e2e/uat/entities/customers/member.cy.ts +122 -0
- package/tests/cypress/e2e/uat/entities/customers/owner.bdd.md +243 -0
- package/tests/cypress/e2e/uat/entities/customers/owner.cy.ts +165 -0
- package/tests/cypress/e2e/uat/entities/pages/block-crud.bdd.md +476 -0
- package/tests/cypress/e2e/uat/entities/pages/block-crud.cy.ts +486 -0
- package/tests/cypress/e2e/uat/entities/pages/block-editor.bdd.md +460 -0
- package/tests/cypress/e2e/uat/entities/pages/block-editor.cy.ts +301 -0
- package/tests/cypress/e2e/uat/entities/pages/list.bdd.md +432 -0
- package/tests/cypress/e2e/uat/entities/pages/list.cy.ts +273 -0
- package/tests/cypress/e2e/uat/entities/pages/public-rendering.bdd.md +696 -0
- package/tests/cypress/e2e/uat/entities/pages/public-rendering.cy.ts +340 -0
- package/tests/cypress/e2e/uat/entities/posts/categories-api-aware.bdd.md +161 -0
- package/tests/cypress/e2e/uat/entities/posts/categories-api-aware.cy.ts +104 -0
- package/tests/cypress/e2e/uat/entities/posts/categories.bdd.md +375 -0
- package/tests/cypress/e2e/uat/entities/posts/categories.cy.ts +241 -0
- package/tests/cypress/e2e/uat/entities/posts/editor.bdd.md +429 -0
- package/tests/cypress/e2e/uat/entities/posts/editor.cy.ts +257 -0
- package/tests/cypress/e2e/uat/entities/posts/list.bdd.md +340 -0
- package/tests/cypress/e2e/uat/entities/posts/list.cy.ts +177 -0
- package/tests/cypress/e2e/uat/entities/posts/public.bdd.md +614 -0
- package/tests/cypress/e2e/uat/entities/posts/public.cy.ts +249 -0
- package/tests/cypress/e2e/uat/entities/tasks/member.bdd.md +222 -0
- package/tests/cypress/e2e/uat/entities/tasks/member.cy.ts +165 -0
- package/tests/cypress/e2e/uat/entities/tasks/owner.bdd.md +419 -0
- package/tests/cypress/e2e/uat/entities/tasks/owner.cy.ts +191 -0
- package/tests/cypress/e2e/uat/features/roles/editor-role.bdd.md +552 -0
- package/tests/cypress/e2e/uat/features/roles/editor-role.cy.ts +210 -0
- package/tests/cypress/e2e/uat/features/roles/member-restrictions.bdd.md +450 -0
- package/tests/cypress/e2e/uat/features/roles/member-restrictions.cy.ts +189 -0
- package/tests/cypress/e2e/uat/features/roles/owner-full-crud.bdd.md +530 -0
- package/tests/cypress/e2e/uat/features/roles/owner-full-crud.cy.ts +247 -0
- package/tests/cypress/fixtures/blocks.json +218 -0
- package/tests/cypress/fixtures/entities.json +87 -0
- package/tests/cypress/fixtures/page-builder.json +21 -0
- package/tests/cypress/src/components/CategoriesPOM.ts +382 -0
- package/tests/cypress/src/components/CustomersPOM.ts +439 -0
- package/tests/cypress/src/components/DevKeyringPOM.ts +160 -0
- package/tests/cypress/src/components/EntityForm.ts +375 -0
- package/tests/cypress/src/components/EntityList.ts +389 -0
- package/tests/cypress/src/components/PageBuilderPOM.ts +710 -0
- package/tests/cypress/src/components/PostEditorPOM.ts +370 -0
- package/tests/cypress/src/components/PostsListPOM.ts +223 -0
- package/tests/cypress/src/components/PublicPagePOM.ts +447 -0
- package/tests/cypress/src/components/PublicPostPOM.ts +146 -0
- package/tests/cypress/src/components/TasksPOM.ts +272 -0
- package/tests/cypress/src/components/TeamSwitcherPOM.ts +450 -0
- package/tests/cypress/src/components/index.ts +21 -0
- package/tests/cypress/src/controllers/ApiKeysAPIController.js +178 -0
- package/tests/cypress/src/controllers/BaseAPIController.js +317 -0
- package/tests/cypress/src/controllers/CustomerAPIController.js +251 -0
- package/tests/cypress/src/controllers/MediaAPIController.js +231 -0
- package/tests/cypress/src/controllers/PagesAPIController.js +226 -0
- package/tests/cypress/src/controllers/PostsAPIController.js +250 -0
- package/tests/cypress/src/controllers/TaskAPIController.js +240 -0
- package/tests/cypress/src/controllers/UsersAPIController.js +242 -0
- package/tests/cypress/src/controllers/index.js +25 -0
- package/tests/cypress/src/core/AuthPOM.ts +450 -0
- package/tests/cypress/src/core/BasePOM.ts +33 -0
- package/tests/cypress/src/core/BlockEditorBasePOM.ts +874 -0
- package/tests/cypress/src/core/DashboardEntityPOM.ts +41 -0
- package/tests/cypress/src/core/index.ts +14 -0
- package/tests/cypress/src/entities/CustomersPOM.ts +172 -0
- package/tests/cypress/src/entities/PagesPOM.ts +137 -0
- package/tests/cypress/src/entities/PatternsPOM.ts +329 -0
- package/tests/cypress/src/entities/PostsPOM.ts +137 -0
- package/tests/cypress/src/entities/TasksPOM.ts +246 -0
- package/tests/cypress/src/entities/index.ts +16 -0
- package/tests/cypress/src/features/BillingPOM.ts +385 -0
- package/tests/cypress/src/features/DashboardPOM.ts +271 -0
- package/tests/cypress/src/features/DevtoolsPOM.ts +750 -0
- package/tests/cypress/src/features/PageBuilderPOM.ts +283 -0
- package/tests/cypress/src/features/PostEditorPOM.ts +313 -0
- package/tests/cypress/src/features/ScheduledActionsPOM.ts +463 -0
- package/tests/cypress/src/features/SettingsPOM.ts +707 -0
- package/tests/cypress/src/features/SuperadminPOM.ts +851 -0
- package/tests/cypress/src/features/SuperadminTeamRolesPOM.ts +285 -0
- package/tests/cypress/src/features/index.ts +28 -0
- package/tests/cypress/src/helpers/ApiInterceptor.ts +20 -0
- package/tests/cypress/src/index.ts +101 -0
- package/tests/cypress/src/pages/dashboard/Dashboard.js +677 -0
- package/tests/cypress/src/pages/dashboard/DashboardPage.js +43 -0
- package/tests/cypress/src/pages/dashboard/DashboardStats.js +546 -0
- package/tests/cypress/src/pages/dashboard/index.js +6 -0
- package/tests/cypress/src/pages/index.js +5 -0
- package/tests/cypress/src/pages/public/FeaturesPage.js +28 -0
- package/tests/cypress/src/pages/public/LandingPage.js +69 -0
- package/tests/cypress/src/pages/public/PricingPage.js +33 -0
- package/tests/cypress/src/pages/public/index.js +6 -0
- package/tests/cypress/src/selectors.ts +46 -0
- package/tests/cypress/src/session-helpers.ts +518 -0
- package/tests/cypress/support/doc-commands.ts +260 -0
- package/tests/cypress/support/e2e.ts +90 -0
- package/tests/cypress.config.ts +178 -0
- package/tests/jest/__mocks__/@nextsparkjs/core/components/ui/badge.js +16 -0
- package/tests/jest/__mocks__/@nextsparkjs/core/lib/db.js +11 -0
- package/tests/jest/__mocks__/@nextsparkjs/registries/permissions-registry.ts +160 -0
- package/tests/jest/__mocks__/@nextsparkjs/registries/theme-registry.ts +68 -0
- package/tests/jest/__mocks__/jose.js +22 -0
- package/tests/jest/__mocks__/next/image.js +15 -0
- package/tests/jest/__mocks__/next-server.js +56 -0
- package/tests/jest/components/post-header.test.tsx +377 -0
- package/tests/jest/jest.config.cjs +154 -0
- package/tests/jest/langchain/COVERAGE.md +372 -0
- package/tests/jest/langchain/guardrails.test.ts +465 -0
- package/tests/jest/langchain/streaming.test.ts +370 -0
- package/tests/jest/langchain/token-tracker.test.ts +455 -0
- package/tests/jest/langchain/tracer-callbacks.test.ts +881 -0
- package/tests/jest/langchain/tracer.test.ts +823 -0
- package/tests/jest/services/tasks.service.test.ts +707 -0
- package/tests/jest/setup.ts +170 -0
- package/tests/jest/tsconfig.jest.json +6 -0
- package/tests/jest/validation/categories.test.ts +429 -0
- package/tests/jest/validation/posts.test.ts +546 -0
- package/tests/tsconfig.json +21 -0
- /package/docs/{02-features → public/02-features}/01-components.md +0 -0
- /package/docs/{02-features → public/02-features}/02-styling.md +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Configuration
|
|
3
|
+
description: Environment variables and configuration options for NextSpark applications.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Configuration Guide
|
|
7
|
+
|
|
8
|
+
This guide covers the configuration options available to administrators for setting up and customizing your NextSpark application.
|
|
9
|
+
|
|
10
|
+
## Environment Variables
|
|
11
|
+
|
|
12
|
+
### Required Variables
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Database
|
|
16
|
+
DATABASE_URL="postgresql://user:password@localhost:5432/dbname"
|
|
17
|
+
|
|
18
|
+
# Authentication
|
|
19
|
+
BETTER_AUTH_SECRET="your-secret-key"
|
|
20
|
+
|
|
21
|
+
# Application
|
|
22
|
+
NEXT_PUBLIC_APP_URL="https://your-domain.com"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Optional Variables
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Email (for notifications)
|
|
29
|
+
SMTP_HOST="smtp.example.com"
|
|
30
|
+
SMTP_PORT="587"
|
|
31
|
+
SMTP_USER="user@example.com"
|
|
32
|
+
SMTP_PASSWORD="password"
|
|
33
|
+
|
|
34
|
+
# Billing (Stripe)
|
|
35
|
+
STRIPE_SECRET_KEY="sk_..."
|
|
36
|
+
STRIPE_WEBHOOK_SECRET="whsec_..."
|
|
37
|
+
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_..."
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Configuration Files
|
|
41
|
+
|
|
42
|
+
### app.config.ts
|
|
43
|
+
|
|
44
|
+
The main application configuration file located at `config/app.config.ts`:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
export const APP_CONFIG_OVERRIDES = {
|
|
48
|
+
app: {
|
|
49
|
+
name: 'Your App Name',
|
|
50
|
+
version: '1.0.0',
|
|
51
|
+
},
|
|
52
|
+
teams: {
|
|
53
|
+
mode: 'multi-tenant', // or 'single-tenant', 'single-user'
|
|
54
|
+
},
|
|
55
|
+
i18n: {
|
|
56
|
+
supportedLocales: ['en', 'es'],
|
|
57
|
+
defaultLocale: 'en',
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### permissions.config.ts
|
|
63
|
+
|
|
64
|
+
Define roles and permissions in `config/permissions.config.ts`:
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
export const PERMISSIONS_CONFIG = {
|
|
68
|
+
roles: {
|
|
69
|
+
additionalRoles: ['editor'],
|
|
70
|
+
hierarchy: { editor: 5 },
|
|
71
|
+
},
|
|
72
|
+
// ... permissions
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Next Steps
|
|
77
|
+
|
|
78
|
+
- [Deployment Guide](./02-deployment.md)
|
|
79
|
+
- [User Management](../02-management/01-users.md)
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Deployment
|
|
3
|
+
description: Guide to deploying NextSpark applications to Vercel, Docker, and other platforms.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deployment Guide
|
|
7
|
+
|
|
8
|
+
This guide covers deploying your NextSpark application to production environments.
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
- Node.js 18+ installed
|
|
13
|
+
- PostgreSQL database provisioned
|
|
14
|
+
- Domain configured with SSL
|
|
15
|
+
|
|
16
|
+
## Vercel Deployment
|
|
17
|
+
|
|
18
|
+
### 1. Connect Repository
|
|
19
|
+
|
|
20
|
+
1. Go to [Vercel Dashboard](https://vercel.com/dashboard)
|
|
21
|
+
2. Click "Add New Project"
|
|
22
|
+
3. Import your Git repository
|
|
23
|
+
|
|
24
|
+
### 2. Configure Environment Variables
|
|
25
|
+
|
|
26
|
+
Add all required environment variables in Vercel project settings:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
DATABASE_URL=postgresql://...
|
|
30
|
+
BETTER_AUTH_SECRET=...
|
|
31
|
+
NEXT_PUBLIC_APP_URL=https://your-domain.com
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 3. Deploy
|
|
35
|
+
|
|
36
|
+
Vercel will automatically build and deploy your application.
|
|
37
|
+
|
|
38
|
+
## Docker Deployment
|
|
39
|
+
|
|
40
|
+
### Build Image
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
docker build -t nextspark-app .
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Run Container
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
docker run -p 3000:3000 \
|
|
50
|
+
-e DATABASE_URL="postgresql://..." \
|
|
51
|
+
-e BETTER_AUTH_SECRET="..." \
|
|
52
|
+
nextspark-app
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Database Migrations
|
|
56
|
+
|
|
57
|
+
Run migrations before starting the application:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pnpm db:migrate
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Health Checks
|
|
64
|
+
|
|
65
|
+
The application exposes health check endpoints:
|
|
66
|
+
|
|
67
|
+
- `/api/health` - Basic health check
|
|
68
|
+
- `/api/health/db` - Database connectivity check
|
|
69
|
+
|
|
70
|
+
## Monitoring
|
|
71
|
+
|
|
72
|
+
Configure monitoring and alerting for:
|
|
73
|
+
|
|
74
|
+
- Application errors
|
|
75
|
+
- Database connection issues
|
|
76
|
+
- API response times
|
|
77
|
+
- Memory and CPU usage
|
|
78
|
+
|
|
79
|
+
## Next Steps
|
|
80
|
+
|
|
81
|
+
- [Configuration Guide](./01-configuration.md)
|
|
82
|
+
- [User Management](../02-management/01-users.md)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: User Management
|
|
3
|
+
description: Managing users, teams, and roles in your NextSpark application.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# User Management
|
|
7
|
+
|
|
8
|
+
This guide covers managing users and teams in your NextSpark application.
|
|
9
|
+
|
|
10
|
+
## User Roles
|
|
11
|
+
|
|
12
|
+
### System Roles
|
|
13
|
+
|
|
14
|
+
| Role | Description |
|
|
15
|
+
|------|-------------|
|
|
16
|
+
| `superadmin` | Full system access, can manage all users and teams |
|
|
17
|
+
| `developer` | Access to developer tools and debugging features |
|
|
18
|
+
| `member` | Standard user role |
|
|
19
|
+
|
|
20
|
+
### Team Roles
|
|
21
|
+
|
|
22
|
+
| Role | Description |
|
|
23
|
+
|------|-------------|
|
|
24
|
+
| `owner` | Team creator, full team management |
|
|
25
|
+
| `admin` | Can manage team settings and members |
|
|
26
|
+
| `member` | Standard team member |
|
|
27
|
+
| `viewer` | Read-only access |
|
|
28
|
+
|
|
29
|
+
## Managing Users
|
|
30
|
+
|
|
31
|
+
### View All Users
|
|
32
|
+
|
|
33
|
+
Access the user management panel at `/superadmin/users`:
|
|
34
|
+
|
|
35
|
+
1. Navigate to Superadmin Dashboard
|
|
36
|
+
2. Click on "Users" in the sidebar
|
|
37
|
+
3. Use filters to search by name, email, or role
|
|
38
|
+
|
|
39
|
+
### Update User Role
|
|
40
|
+
|
|
41
|
+
1. Find the user in the list
|
|
42
|
+
2. Click on the user row to open details
|
|
43
|
+
3. Select new role from dropdown
|
|
44
|
+
4. Click "Save Changes"
|
|
45
|
+
|
|
46
|
+
### Deactivate User
|
|
47
|
+
|
|
48
|
+
1. Open user details
|
|
49
|
+
2. Click "Deactivate Account"
|
|
50
|
+
3. Confirm the action
|
|
51
|
+
|
|
52
|
+
## Managing Teams
|
|
53
|
+
|
|
54
|
+
### View All Teams
|
|
55
|
+
|
|
56
|
+
Access team management at `/superadmin/teams`:
|
|
57
|
+
|
|
58
|
+
- See all teams across the platform
|
|
59
|
+
- View team member counts
|
|
60
|
+
- Monitor team activity
|
|
61
|
+
|
|
62
|
+
### Team Impersonation
|
|
63
|
+
|
|
64
|
+
Superadmins can view the application as any team member:
|
|
65
|
+
|
|
66
|
+
1. Navigate to team details
|
|
67
|
+
2. Click "Impersonate" on a team member
|
|
68
|
+
3. You'll see the app from their perspective
|
|
69
|
+
4. Click "Exit Impersonation" when done
|
|
70
|
+
|
|
71
|
+
## Audit Logs
|
|
72
|
+
|
|
73
|
+
All administrative actions are logged. View logs at `/superadmin/logs`:
|
|
74
|
+
|
|
75
|
+
- User creation/deletion
|
|
76
|
+
- Role changes
|
|
77
|
+
- Team modifications
|
|
78
|
+
- Login attempts
|
|
79
|
+
|
|
80
|
+
## Next Steps
|
|
81
|
+
|
|
82
|
+
- [Configuration Guide](../01-setup/01-configuration.md)
|
|
83
|
+
- [Deployment Guide](../01-setup/02-deployment.md)
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Langchain Integration
|
|
3
|
+
description: Configure and manage the AI-powered Langchain plugin for your application.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Langchain Integration
|
|
7
|
+
|
|
8
|
+
The Langchain plugin provides AI-powered capabilities to your application, including conversational agents, document processing, and intelligent automation.
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Langchain is integrated as a plugin that can be enabled per-theme. It provides:
|
|
13
|
+
|
|
14
|
+
- **Conversational AI**: Build chat interfaces with context-aware responses
|
|
15
|
+
- **Memory Management**: Persistent conversation history with PostgreSQL storage
|
|
16
|
+
- **Tool Integration**: Connect AI to your application's data and actions
|
|
17
|
+
- **Streaming Responses**: Real-time AI responses for better UX
|
|
18
|
+
|
|
19
|
+
## Configuration
|
|
20
|
+
|
|
21
|
+
### Environment Variables
|
|
22
|
+
|
|
23
|
+
Add the following to your `.env` file:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# OpenAI API Key (required)
|
|
27
|
+
OPENAI_API_KEY=sk-your-api-key-here
|
|
28
|
+
|
|
29
|
+
# Optional: Model configuration
|
|
30
|
+
LANGCHAIN_MODEL=gpt-4o-mini
|
|
31
|
+
LANGCHAIN_TEMPERATURE=0.7
|
|
32
|
+
LANGCHAIN_MAX_TOKENS=2000
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Plugin Activation
|
|
36
|
+
|
|
37
|
+
Enable the plugin in your theme configuration:
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
// themes/{theme}/config/theme.config.ts
|
|
41
|
+
export const themeConfig = {
|
|
42
|
+
plugins: ['langchain'],
|
|
43
|
+
// ...
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Database Setup
|
|
48
|
+
|
|
49
|
+
The plugin requires a memory table for conversation persistence. Run the migration:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pnpm db:migrate
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This creates the `langchain_memory` table with the following schema:
|
|
56
|
+
|
|
57
|
+
| Column | Type | Description |
|
|
58
|
+
|--------|------|-------------|
|
|
59
|
+
| id | uuid | Primary key |
|
|
60
|
+
| sessionId | varchar | Conversation session identifier |
|
|
61
|
+
| messages | jsonb | Array of message objects |
|
|
62
|
+
| metadata | jsonb | Additional context data |
|
|
63
|
+
| createdAt | timestamp | Creation timestamp |
|
|
64
|
+
| updatedAt | timestamp | Last update timestamp |
|
|
65
|
+
|
|
66
|
+
## Usage
|
|
67
|
+
|
|
68
|
+
### Basic Chat Endpoint
|
|
69
|
+
|
|
70
|
+
The plugin exposes an API endpoint for chat interactions:
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
// POST /api/v1/ai/chat
|
|
74
|
+
{
|
|
75
|
+
"message": "Hello, how can you help me?",
|
|
76
|
+
"sessionId": "user-123-session-456"
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Response:
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
{
|
|
84
|
+
"success": true,
|
|
85
|
+
"data": {
|
|
86
|
+
"response": "Hello! I'm here to help you with...",
|
|
87
|
+
"sessionId": "user-123-session-456"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Streaming Responses
|
|
93
|
+
|
|
94
|
+
For real-time streaming:
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
// POST /api/v1/ai/chat/stream
|
|
98
|
+
{
|
|
99
|
+
"message": "Explain quantum computing",
|
|
100
|
+
"sessionId": "user-123-session-456",
|
|
101
|
+
"stream": true
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Security Considerations
|
|
106
|
+
|
|
107
|
+
- **API Key Protection**: Never expose your OpenAI API key in client-side code
|
|
108
|
+
- **Rate Limiting**: Consider implementing rate limits per user/team
|
|
109
|
+
- **Content Filtering**: The plugin includes basic content moderation
|
|
110
|
+
- **Session Isolation**: Conversations are isolated by sessionId
|
|
111
|
+
|
|
112
|
+
## Monitoring
|
|
113
|
+
|
|
114
|
+
View AI usage statistics in the Superadmin dashboard:
|
|
115
|
+
|
|
116
|
+
1. Navigate to **Superadmin > Analytics** (coming soon)
|
|
117
|
+
2. Select the **AI Usage** tab
|
|
118
|
+
3. Monitor token usage, response times, and error rates
|
|
119
|
+
|
|
120
|
+
## Troubleshooting
|
|
121
|
+
|
|
122
|
+
### Common Issues
|
|
123
|
+
|
|
124
|
+
**"OPENAI_API_KEY not configured"**
|
|
125
|
+
- Ensure the environment variable is set
|
|
126
|
+
- Restart the development server after adding the key
|
|
127
|
+
|
|
128
|
+
**"Rate limit exceeded"**
|
|
129
|
+
- OpenAI has per-minute and per-day limits
|
|
130
|
+
- Consider implementing request queuing
|
|
131
|
+
|
|
132
|
+
**"Memory not persisting"**
|
|
133
|
+
- Verify the database migration ran successfully
|
|
134
|
+
- Check that `sessionId` is being passed consistently
|
|
135
|
+
|
|
136
|
+
## Related Documentation
|
|
137
|
+
|
|
138
|
+
- [Plugin System](/docs/plugins/overview)
|
|
139
|
+
- [API Authentication](/docs/api/authentication)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Customers API
|
|
2
|
+
|
|
3
|
+
Manage customer records in the system. This endpoint supports full CRUD operations with team-based multi-tenancy.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Customers API allows you to create, read, update, and delete customer records. Each customer belongs to a team and is automatically filtered based on the authenticated user's team context.
|
|
8
|
+
|
|
9
|
+
## Authentication
|
|
10
|
+
|
|
11
|
+
All endpoints require authentication via:
|
|
12
|
+
- **Session cookie** (for browser-based requests)
|
|
13
|
+
- **API Key** header (for server-to-server requests)
|
|
14
|
+
|
|
15
|
+
## Endpoints
|
|
16
|
+
|
|
17
|
+
### List Customers
|
|
18
|
+
`GET /api/v1/customers`
|
|
19
|
+
|
|
20
|
+
Returns a paginated list of customers for the current team.
|
|
21
|
+
|
|
22
|
+
**Query Parameters:**
|
|
23
|
+
- `limit` (number, optional): Maximum records to return. Default: 20
|
|
24
|
+
- `offset` (number, optional): Number of records to skip. Default: 0
|
|
25
|
+
- `status` (string, optional): Filter by status (active, inactive, pending)
|
|
26
|
+
- `search` (string, optional): Search term for partial matching
|
|
27
|
+
- `searchField` (string, optional): Field to search in (name, email)
|
|
28
|
+
- `sortBy` (string, optional): Field to sort by
|
|
29
|
+
- `sortOrder` (string, optional): Sort direction (asc, desc)
|
|
30
|
+
|
|
31
|
+
**Example Response:**
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"data": [
|
|
35
|
+
{
|
|
36
|
+
"id": "cust_123",
|
|
37
|
+
"name": "John Doe",
|
|
38
|
+
"email": "john@example.com",
|
|
39
|
+
"status": "active",
|
|
40
|
+
"createdAt": "2024-01-15T10:30:00Z"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"pagination": {
|
|
44
|
+
"total": 42,
|
|
45
|
+
"limit": 20,
|
|
46
|
+
"offset": 0
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Get Single Customer
|
|
52
|
+
`GET /api/v1/customers/[id]`
|
|
53
|
+
|
|
54
|
+
Returns a single customer by ID.
|
|
55
|
+
|
|
56
|
+
**Path Parameters:**
|
|
57
|
+
- `id` (string, required): Customer ID
|
|
58
|
+
|
|
59
|
+
### Create Customer
|
|
60
|
+
`POST /api/v1/customers`
|
|
61
|
+
|
|
62
|
+
Create a new customer record.
|
|
63
|
+
|
|
64
|
+
**Request Body:**
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"name": "Jane Smith",
|
|
68
|
+
"email": "jane@example.com",
|
|
69
|
+
"phone": "+1234567890",
|
|
70
|
+
"status": "active"
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Update Customer
|
|
75
|
+
`PATCH /api/v1/customers/[id]`
|
|
76
|
+
|
|
77
|
+
Update an existing customer.
|
|
78
|
+
|
|
79
|
+
**Path Parameters:**
|
|
80
|
+
- `id` (string, required): Customer ID
|
|
81
|
+
|
|
82
|
+
**Request Body:**
|
|
83
|
+
Any fields to update (partial update supported).
|
|
84
|
+
|
|
85
|
+
### Delete Customer
|
|
86
|
+
`DELETE /api/v1/customers/[id]`
|
|
87
|
+
|
|
88
|
+
Delete a customer record.
|
|
89
|
+
|
|
90
|
+
**Path Parameters:**
|
|
91
|
+
- `id` (string, required): Customer ID
|
|
92
|
+
|
|
93
|
+
## Admin Bypass
|
|
94
|
+
|
|
95
|
+
Superadmin users can access customers across all teams by sending:
|
|
96
|
+
- Header: `x-admin-bypass: confirm-cross-team-access`
|
|
97
|
+
- Optional header: `x-team-id: {team_id}` to filter a specific team
|
|
98
|
+
|
|
99
|
+
## Error Responses
|
|
100
|
+
|
|
101
|
+
| Status | Description |
|
|
102
|
+
|--------|-------------|
|
|
103
|
+
| 400 | Bad Request - Invalid parameters |
|
|
104
|
+
| 401 | Unauthorized - Missing or invalid auth |
|
|
105
|
+
| 403 | Forbidden - Insufficient permissions |
|
|
106
|
+
| 404 | Not Found - Customer doesn't exist |
|
|
107
|
+
| 422 | Validation Error - Invalid data |
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Presets for Customers Entity
|
|
3
|
+
*
|
|
4
|
+
* These presets appear in the DevTools API Explorer's "Presets" tab.
|
|
5
|
+
* The endpoint is automatically derived from the entity name: /api/v1/customers
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { defineApiEndpoint } from '@nextsparkjs/core/types/api-presets'
|
|
9
|
+
|
|
10
|
+
export default defineApiEndpoint({
|
|
11
|
+
// endpoint is optional - derived from entity folder name
|
|
12
|
+
summary: 'Manage customer records in the system',
|
|
13
|
+
presets: [
|
|
14
|
+
{
|
|
15
|
+
id: 'list-all',
|
|
16
|
+
title: 'List All Customers',
|
|
17
|
+
description: 'Fetch all customers with default pagination',
|
|
18
|
+
method: 'GET',
|
|
19
|
+
params: {
|
|
20
|
+
limit: 10,
|
|
21
|
+
offset: 0
|
|
22
|
+
},
|
|
23
|
+
tags: ['read', 'list']
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'list-by-status',
|
|
27
|
+
title: 'List Active Customers',
|
|
28
|
+
description: 'Fetch only customers with active status',
|
|
29
|
+
method: 'GET',
|
|
30
|
+
params: {
|
|
31
|
+
status: 'active',
|
|
32
|
+
limit: 20
|
|
33
|
+
},
|
|
34
|
+
tags: ['read', 'filter']
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'create-test',
|
|
38
|
+
title: 'Create Test Customer',
|
|
39
|
+
description: 'Create a new customer with sample data for testing',
|
|
40
|
+
method: 'POST',
|
|
41
|
+
payload: {
|
|
42
|
+
name: 'Test Customer',
|
|
43
|
+
email: 'test@example.com',
|
|
44
|
+
phone: '+1234567890',
|
|
45
|
+
status: 'active'
|
|
46
|
+
},
|
|
47
|
+
sessionConfig: {
|
|
48
|
+
crossTeam: false
|
|
49
|
+
},
|
|
50
|
+
tags: ['write', 'create']
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: 'create-bypass',
|
|
54
|
+
title: 'Create (Bypass Mode)',
|
|
55
|
+
description: 'Create customer using admin bypass for cross-team access',
|
|
56
|
+
method: 'POST',
|
|
57
|
+
payload: {
|
|
58
|
+
name: 'Cross-Team Customer',
|
|
59
|
+
email: 'crossteam@example.com',
|
|
60
|
+
status: 'pending'
|
|
61
|
+
},
|
|
62
|
+
sessionConfig: {
|
|
63
|
+
crossTeam: true,
|
|
64
|
+
teamId: '{{FIRST_TEAM_ID}}'
|
|
65
|
+
},
|
|
66
|
+
tags: ['write', 'admin', 'bypass']
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: 'search-name',
|
|
70
|
+
title: 'Search by Name',
|
|
71
|
+
description: 'Search customers by name using partial match',
|
|
72
|
+
method: 'GET',
|
|
73
|
+
params: {
|
|
74
|
+
search: 'John',
|
|
75
|
+
searchField: 'name'
|
|
76
|
+
},
|
|
77
|
+
tags: ['read', 'search']
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
})
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Pages API
|
|
2
|
+
|
|
3
|
+
Manage builder-enabled pages in the system. Pages render at root URLs (e.g., /about, /contact) and support the page builder for content creation.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Pages API allows you to create, read, update, and delete pages with builder content. Pages are public content and can be accessed by all authenticated users.
|
|
8
|
+
|
|
9
|
+
## Authentication
|
|
10
|
+
|
|
11
|
+
All endpoints require authentication via:
|
|
12
|
+
- **Session cookie** (for browser-based requests)
|
|
13
|
+
- **API Key** header (for server-to-server requests)
|
|
14
|
+
|
|
15
|
+
## Endpoints
|
|
16
|
+
|
|
17
|
+
### List Pages
|
|
18
|
+
`GET /api/v1/pages`
|
|
19
|
+
|
|
20
|
+
Returns a paginated list of pages.
|
|
21
|
+
|
|
22
|
+
**Query Parameters:**
|
|
23
|
+
- `limit` (number, optional): Maximum records to return. Default: 20
|
|
24
|
+
- `offset` (number, optional): Number of records to skip. Default: 0
|
|
25
|
+
- `status` (string, optional): Filter by status (draft, published, scheduled, archived)
|
|
26
|
+
- `locale` (string, optional): Filter by locale (en, es)
|
|
27
|
+
- `search` (string, optional): Search term for title/slug
|
|
28
|
+
- `sortBy` (string, optional): Field to sort by
|
|
29
|
+
- `sortOrder` (string, optional): Sort direction (asc, desc)
|
|
30
|
+
|
|
31
|
+
**Example Response:**
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"data": [
|
|
35
|
+
{
|
|
36
|
+
"id": "page_123",
|
|
37
|
+
"title": "About Us",
|
|
38
|
+
"slug": "about",
|
|
39
|
+
"status": "published",
|
|
40
|
+
"locale": "en",
|
|
41
|
+
"blocks": [...],
|
|
42
|
+
"createdAt": "2024-01-15T10:30:00Z"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"pagination": {
|
|
46
|
+
"total": 15,
|
|
47
|
+
"limit": 20,
|
|
48
|
+
"offset": 0
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Get Single Page
|
|
54
|
+
`GET /api/v1/pages/[id]`
|
|
55
|
+
|
|
56
|
+
Returns a single page by ID.
|
|
57
|
+
|
|
58
|
+
**Path Parameters:**
|
|
59
|
+
- `id` (string, required): Page ID
|
|
60
|
+
|
|
61
|
+
### Create Page
|
|
62
|
+
`POST /api/v1/pages`
|
|
63
|
+
|
|
64
|
+
Create a new page record.
|
|
65
|
+
|
|
66
|
+
**Request Body:**
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"title": "Contact Us",
|
|
70
|
+
"slug": "contact",
|
|
71
|
+
"status": "draft",
|
|
72
|
+
"locale": "en",
|
|
73
|
+
"blocks": []
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Update Page
|
|
78
|
+
`PATCH /api/v1/pages/[id]`
|
|
79
|
+
|
|
80
|
+
Update an existing page.
|
|
81
|
+
|
|
82
|
+
**Path Parameters:**
|
|
83
|
+
- `id` (string, required): Page ID
|
|
84
|
+
|
|
85
|
+
**Request Body:**
|
|
86
|
+
Any fields to update (partial update supported).
|
|
87
|
+
|
|
88
|
+
### Delete Page
|
|
89
|
+
`DELETE /api/v1/pages/[id]`
|
|
90
|
+
|
|
91
|
+
Delete a page record.
|
|
92
|
+
|
|
93
|
+
**Path Parameters:**
|
|
94
|
+
- `id` (string, required): Page ID
|
|
95
|
+
|
|
96
|
+
## Fields
|
|
97
|
+
|
|
98
|
+
| Field | Type | Required | Description |
|
|
99
|
+
|-------|------|----------|-------------|
|
|
100
|
+
| title | text | Yes | Page title |
|
|
101
|
+
| slug | text | Yes | URL-friendly identifier |
|
|
102
|
+
| status | select | Yes | draft, published, scheduled, archived |
|
|
103
|
+
| locale | select | Yes | en, es |
|
|
104
|
+
| blocks | json | No | Page builder content |
|
|
105
|
+
|
|
106
|
+
## Error Responses
|
|
107
|
+
|
|
108
|
+
| Status | Description |
|
|
109
|
+
|--------|-------------|
|
|
110
|
+
| 400 | Bad Request - Invalid parameters |
|
|
111
|
+
| 401 | Unauthorized - Missing or invalid auth |
|
|
112
|
+
| 403 | Forbidden - Insufficient permissions |
|
|
113
|
+
| 404 | Not Found - Page doesn't exist |
|
|
114
|
+
| 422 | Validation Error - Invalid data |
|