spine-framework 0.1.0
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/.framework/README.md +129 -0
- package/.framework/cli/bin.cjs +14 -0
- package/.framework/cli/commands/agents.ts +153 -0
- package/.framework/cli/commands/auth.ts +94 -0
- package/.framework/cli/commands/create-app.ts +185 -0
- package/.framework/cli/commands/dev.ts +295 -0
- package/.framework/cli/commands/doctor.ts +442 -0
- package/.framework/cli/commands/generate.ts +332 -0
- package/.framework/cli/commands/init.ts +272 -0
- package/.framework/cli/commands/install-app.ts +391 -0
- package/.framework/cli/commands/items.ts +253 -0
- package/.framework/cli/commands/migrations.ts +141 -0
- package/.framework/cli/commands/pipelines.ts +166 -0
- package/.framework/cli/commands/status.ts +197 -0
- package/.framework/cli/commands/system.ts +184 -0
- package/.framework/cli/commands/test.ts +227 -0
- package/.framework/cli/commands/uninstall-app.ts +166 -0
- package/.framework/cli/context.ts +268 -0
- package/.framework/cli/env-loader.ts +36 -0
- package/.framework/cli/index.ts +106 -0
- package/.framework/cli/welcome.cjs +45 -0
- package/.framework/docs/API.md +384 -0
- package/.framework/docs/STABILITY.md +52 -0
- package/.framework/docs/admin-routes.md +76 -0
- package/.framework/docs/api-docs-progress.md +38 -0
- package/.framework/docs/api-governance.md +146 -0
- package/.framework/docs/api-testing-results.md +212 -0
- package/.framework/docs/apis/admin-configs.md +567 -0
- package/.framework/docs/apis/admin-data.md +272 -0
- package/.framework/docs/apis/index.md +231 -0
- package/.framework/docs/apis/internal.md +295 -0
- package/.framework/docs/apis/runtime.md +537 -0
- package/.framework/docs/assembly-launch-guide.md +138 -0
- package/.framework/docs/audit-results.md +590 -0
- package/.framework/docs/authorization-model.md +170 -0
- package/.framework/docs/db-api-inventory.md +95 -0
- package/.framework/docs/examples/custom-app/README.md +77 -0
- package/.framework/docs/examples/custom-function/README.md +27 -0
- package/.framework/docs/examples/custom-function/handler.ts +48 -0
- package/.framework/docs/examples/custom-webhook/README.md +68 -0
- package/.framework/docs/gap-remediation-backlog.md +103 -0
- package/.framework/docs/guides/cli-guide.md +224 -0
- package/.framework/docs/guides/getting-started.md +103 -0
- package/.framework/docs/guides/import-guide.md +193 -0
- package/.framework/docs/guides/testing-guide.md +229 -0
- package/.framework/docs/permission-examples.md +326 -0
- package/.framework/docs/ui-adoption-verification.md +111 -0
- package/.framework/docs/ui-api-coverage.md +84 -0
- package/.framework/docs/v2-compatibility-audit.md +228 -0
- package/.framework/functions/.gitkeep +1 -0
- package/.framework/functions/_shared/agent-runner.ts +1097 -0
- package/.framework/functions/_shared/app-manifest.ts +184 -0
- package/.framework/functions/_shared/audit.ts +150 -0
- package/.framework/functions/_shared/db.ts +174 -0
- package/.framework/functions/_shared/index.ts +382 -0
- package/.framework/functions/_shared/middleware.ts +490 -0
- package/.framework/functions/_shared/permissions.ts +1325 -0
- package/.framework/functions/_shared/pipeline-runner.ts +731 -0
- package/.framework/functions/_shared/principal.ts +760 -0
- package/.framework/functions/_shared/schema-utils.ts +967 -0
- package/.framework/functions/_shared/testing.ts +258 -0
- package/.framework/functions/_shared/trigger-engine.ts +425 -0
- package/.framework/functions/_shared/webhook-registration.ts +168 -0
- package/.framework/functions/_shared/webhook-registry.ts +129 -0
- package/.framework/functions/account-nodes.ts +111 -0
- package/.framework/functions/admin-data.ts +606 -0
- package/.framework/functions/ai-agents.ts +323 -0
- package/.framework/functions/api-keys.ts +376 -0
- package/.framework/functions/apps.ts +483 -0
- package/.framework/functions/auth.ts +196 -0
- package/.framework/functions/debug-auth.ts +107 -0
- package/.framework/functions/embeddings.ts +556 -0
- package/.framework/functions/integration-routes.ts +523 -0
- package/.framework/functions/integrations.ts +319 -0
- package/.framework/functions/item-progress.ts +272 -0
- package/.framework/functions/logs.ts +438 -0
- package/.framework/functions/observability.ts +275 -0
- package/.framework/functions/pipeline-executions.ts +494 -0
- package/.framework/functions/pipelines.ts +485 -0
- package/.framework/functions/prompt-configs.ts +339 -0
- package/.framework/functions/roles.ts +387 -0
- package/.framework/functions/system-cron.ts +742 -0
- package/.framework/functions/system.ts +323 -0
- package/.framework/functions/tests.ts +119 -0
- package/.framework/functions/timers.ts +357 -0
- package/.framework/functions/triggers.ts +563 -0
- package/.framework/functions/types.ts +604 -0
- package/.framework/migrations/000_foundation.sql +1256 -0
- package/.framework/migrations/001_seed.sql +92 -0
- package/.framework/migrations/002_seed_constraints.sql +13 -0
- package/.framework/migrations/003_auth_user_trigger.sql +59 -0
- package/.framework/src/App.tsx +126 -0
- package/.framework/src/apps/admin/index.tsx +173 -0
- package/.framework/src/components/AppWrapper.tsx +56 -0
- package/.framework/src/components/CustomAppLoader.tsx +116 -0
- package/.framework/src/components/admin/AdminListPage.tsx +151 -0
- package/.framework/src/components/admin/AdminSidebar.tsx +166 -0
- package/.framework/src/components/admin/AdminStatsCard.tsx +62 -0
- package/.framework/src/components/admin/SortableTableHeader.tsx +42 -0
- package/.framework/src/components/app-shell/GenericAppShell.tsx +181 -0
- package/.framework/src/components/app-shell/GenericDetailPage.tsx +200 -0
- package/.framework/src/components/app-shell/GenericListPage.tsx +116 -0
- package/.framework/src/components/app-sidebar.tsx +228 -0
- package/.framework/src/components/auth/ProtectedRoute.tsx +88 -0
- package/.framework/src/components/layout/AppShell.tsx +91 -0
- package/.framework/src/components/layout/Header.tsx +88 -0
- package/.framework/src/components/layout/Layout.tsx +95 -0
- package/.framework/src/components/layout/Sidebar.tsx +329 -0
- package/.framework/src/components/runtime/DataDetailHeader.tsx +77 -0
- package/.framework/src/components/runtime/DataDetailPage.tsx +171 -0
- package/.framework/src/components/runtime/DataFilters.tsx +91 -0
- package/.framework/src/components/runtime/DataHeader.tsx +68 -0
- package/.framework/src/components/runtime/DataListPage.tsx +124 -0
- package/.framework/src/components/runtime/DataStats.tsx +70 -0
- package/.framework/src/components/runtime/DataTable.tsx +174 -0
- package/.framework/src/components/runtime/SchemaDetailForm.tsx +134 -0
- package/.framework/src/components/runtime/index.ts +18 -0
- package/.framework/src/components/search-form.tsx +29 -0
- package/.framework/src/components/shared/AgentView.tsx +213 -0
- package/.framework/src/components/shared/FieldRenderer.tsx +478 -0
- package/.framework/src/components/shared/SchemaFields.tsx +226 -0
- package/.framework/src/components/ui/DataTable.tsx +343 -0
- package/.framework/src/components/ui/Form.tsx +281 -0
- package/.framework/src/components/ui/ItemCard.tsx +296 -0
- package/.framework/src/components/ui/ItemListView.tsx +308 -0
- package/.framework/src/components/ui/LoadingSpinner.tsx +52 -0
- package/.framework/src/components/ui/Modal.tsx +61 -0
- package/.framework/src/components/ui/RichTextEditor.tsx +210 -0
- package/.framework/src/components/ui/accordion.tsx +82 -0
- package/.framework/src/components/ui/alert-dialog.tsx +197 -0
- package/.framework/src/components/ui/alert.tsx +76 -0
- package/.framework/src/components/ui/aspect-ratio.tsx +11 -0
- package/.framework/src/components/ui/avatar.tsx +110 -0
- package/.framework/src/components/ui/badge.tsx +49 -0
- package/.framework/src/components/ui/breadcrumb.tsx +122 -0
- package/.framework/src/components/ui/button-group.tsx +83 -0
- package/.framework/src/components/ui/button.tsx +65 -0
- package/.framework/src/components/ui/calendar.tsx +222 -0
- package/.framework/src/components/ui/card.tsx +100 -0
- package/.framework/src/components/ui/carousel.tsx +240 -0
- package/.framework/src/components/ui/chart.tsx +373 -0
- package/.framework/src/components/ui/checkbox.tsx +31 -0
- package/.framework/src/components/ui/collapsible.tsx +33 -0
- package/.framework/src/components/ui/combobox.tsx +299 -0
- package/.framework/src/components/ui/command.tsx +193 -0
- package/.framework/src/components/ui/context-menu.tsx +261 -0
- package/.framework/src/components/ui/dialog.tsx +165 -0
- package/.framework/src/components/ui/direction.tsx +22 -0
- package/.framework/src/components/ui/drawer.tsx +132 -0
- package/.framework/src/components/ui/dropdown-menu.tsx +269 -0
- package/.framework/src/components/ui/empty.tsx +104 -0
- package/.framework/src/components/ui/field.tsx +238 -0
- package/.framework/src/components/ui/hover-card.tsx +42 -0
- package/.framework/src/components/ui/input-group.tsx +153 -0
- package/.framework/src/components/ui/input-otp.tsx +87 -0
- package/.framework/src/components/ui/input.tsx +19 -0
- package/.framework/src/components/ui/item.tsx +196 -0
- package/.framework/src/components/ui/kbd.tsx +26 -0
- package/.framework/src/components/ui/label.tsx +22 -0
- package/.framework/src/components/ui/menubar.tsx +277 -0
- package/.framework/src/components/ui/native-select.tsx +61 -0
- package/.framework/src/components/ui/navigation-menu.tsx +164 -0
- package/.framework/src/components/ui/pagination.tsx +129 -0
- package/.framework/src/components/ui/popover.tsx +87 -0
- package/.framework/src/components/ui/progress.tsx +31 -0
- package/.framework/src/components/ui/radio-group.tsx +42 -0
- package/.framework/src/components/ui/resizable.tsx +50 -0
- package/.framework/src/components/ui/scroll-area.tsx +53 -0
- package/.framework/src/components/ui/select.tsx +195 -0
- package/.framework/src/components/ui/separator.tsx +26 -0
- package/.framework/src/components/ui/sheet.tsx +145 -0
- package/.framework/src/components/ui/sidebar.tsx +706 -0
- package/.framework/src/components/ui/skeleton.tsx +13 -0
- package/.framework/src/components/ui/slider.tsx +59 -0
- package/.framework/src/components/ui/sonner.tsx +47 -0
- package/.framework/src/components/ui/spinner.tsx +10 -0
- package/.framework/src/components/ui/switch.tsx +33 -0
- package/.framework/src/components/ui/table-primitives.tsx +141 -0
- package/.framework/src/components/ui/table.tsx +114 -0
- package/.framework/src/components/ui/tabs.tsx +90 -0
- package/.framework/src/components/ui/textarea.tsx +18 -0
- package/.framework/src/components/ui/toggle-group.tsx +89 -0
- package/.framework/src/components/ui/toggle.tsx +45 -0
- package/.framework/src/components/ui/tooltip.tsx +57 -0
- package/.framework/src/contexts/AppContext.tsx +133 -0
- package/.framework/src/contexts/AuthContext.tsx +371 -0
- package/.framework/src/hooks/use-mobile.ts +19 -0
- package/.framework/src/hooks/useApi.ts +526 -0
- package/.framework/src/hooks/useApps.ts +114 -0
- package/.framework/src/hooks/useEntityList.ts +190 -0
- package/.framework/src/hooks/useEntityRecord.ts +308 -0
- package/.framework/src/hooks/useForm.ts +307 -0
- package/.framework/src/hooks/useListSchema.ts +264 -0
- package/.framework/src/hooks/useSchemaRecord.ts +223 -0
- package/.framework/src/index.css +128 -0
- package/.framework/src/lib/api.ts +156 -0
- package/.framework/src/lib/supabase.ts +94 -0
- package/.framework/src/lib/utils.ts +317 -0
- package/.framework/src/main.tsx +27 -0
- package/.framework/src/pages/DashboardPage.tsx +181 -0
- package/.framework/src/pages/NotFoundPage.tsx +39 -0
- package/.framework/src/pages/admin/AIAgentDetailPage.tsx +161 -0
- package/.framework/src/pages/admin/AIAgentsPage.tsx +318 -0
- package/.framework/src/pages/admin/APIKeyDetailPage.tsx +199 -0
- package/.framework/src/pages/admin/APIKeysPage.tsx +303 -0
- package/.framework/src/pages/admin/AlertsConfigPage.tsx +523 -0
- package/.framework/src/pages/admin/AppDetailPage.tsx +493 -0
- package/.framework/src/pages/admin/AppsPage.tsx +355 -0
- package/.framework/src/pages/admin/DesignedPage.tsx +491 -0
- package/.framework/src/pages/admin/EmbeddingDetailPage.tsx +534 -0
- package/.framework/src/pages/admin/EmbeddingsPage.tsx +424 -0
- package/.framework/src/pages/admin/ExtendedShadcnTestPage.tsx +176 -0
- package/.framework/src/pages/admin/IncrementalShadcnTestPage.tsx +109 -0
- package/.framework/src/pages/admin/IntegratedDashboard.tsx +402 -0
- package/.framework/src/pages/admin/IntegrationDetailPage.tsx +187 -0
- package/.framework/src/pages/admin/IntegrationsPage.tsx +301 -0
- package/.framework/src/pages/admin/LogsPage.tsx +283 -0
- package/.framework/src/pages/admin/MinimalShadcnTestPage.tsx +85 -0
- package/.framework/src/pages/admin/ObservabilityDashboard.tsx +470 -0
- package/.framework/src/pages/admin/PipelineDetailPage.tsx +183 -0
- package/.framework/src/pages/admin/PipelineExecutionsPage.tsx +279 -0
- package/.framework/src/pages/admin/PipelinesPage.tsx +390 -0
- package/.framework/src/pages/admin/PromptConfigDetailPage.tsx +299 -0
- package/.framework/src/pages/admin/PromptConfigsPage.tsx +292 -0
- package/.framework/src/pages/admin/ProperlyDesignedPage.tsx +434 -0
- package/.framework/src/pages/admin/RoleDetailPage.tsx +273 -0
- package/.framework/src/pages/admin/RolesPage.tsx +292 -0
- package/.framework/src/pages/admin/SelectTestPage.tsx +61 -0
- package/.framework/src/pages/admin/ShadcnTestPage.tsx +588 -0
- package/.framework/src/pages/admin/SimpleDashboard.tsx +387 -0
- package/.framework/src/pages/admin/TestRunDetailPage.tsx +172 -0
- package/.framework/src/pages/admin/TestingDashboard.tsx +257 -0
- package/.framework/src/pages/admin/TimerDetailPage.tsx +151 -0
- package/.framework/src/pages/admin/TimersPage.tsx +376 -0
- package/.framework/src/pages/admin/TriggerDetailPage.tsx +149 -0
- package/.framework/src/pages/admin/TriggersPage.tsx +381 -0
- package/.framework/src/pages/admin/TypeDetailPage.tsx +694 -0
- package/.framework/src/pages/admin/TypesPage.tsx +295 -0
- package/.framework/src/pages/auth/LoginPage.tsx +188 -0
- package/.framework/src/pages/auth/RegisterPage.tsx +163 -0
- package/.framework/src/pages/spine-framework/APIPage.tsx +17 -0
- package/.framework/src/pages/spine-framework/CLIPage.tsx +25 -0
- package/.framework/src/types/auth.ts +125 -0
- package/.framework/src/types/types.ts +407 -0
- package/STRUCTURE.md +150 -0
- package/config/components.json +25 -0
- package/config/deno.lock +108 -0
- package/config/package-lock.json +17183 -0
- package/config/postcss.config.cjs +10 -0
- package/config/tailwind.config.cjs +78 -0
- package/config/tsconfig.build.json +32 -0
- package/config/tsconfig.cli.json +18 -0
- package/config/tsconfig.json +41 -0
- package/config/tsconfig.node.json +17 -0
- package/config/tsconfig.node.tsbuildinfo +1 -0
- package/config/tsconfig.tsbuildinfo +1 -0
- package/config/typedoc.json +16 -0
- package/config/vite.config.d.ts +2 -0
- package/config/vite.config.ts +72 -0
- package/dist/cli/commands/agents.d.ts +39 -0
- package/dist/cli/commands/agents.d.ts.map +1 -0
- package/dist/cli/commands/auth.d.ts +36 -0
- package/dist/cli/commands/auth.d.ts.map +1 -0
- package/dist/cli/commands/create-app.d.ts +23 -0
- package/dist/cli/commands/create-app.d.ts.map +1 -0
- package/dist/cli/commands/dev.d.ts +39 -0
- package/dist/cli/commands/dev.d.ts.map +1 -0
- package/dist/cli/commands/doctor.d.ts +42 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/generate.d.ts +36 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/init.d.ts +30 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/install-app.d.ts +30 -0
- package/dist/cli/commands/install-app.d.ts.map +1 -0
- package/dist/cli/commands/items.d.ts +45 -0
- package/dist/cli/commands/items.d.ts.map +1 -0
- package/dist/cli/commands/migrations.d.ts +41 -0
- package/dist/cli/commands/migrations.d.ts.map +1 -0
- package/dist/cli/commands/pipelines.d.ts +40 -0
- package/dist/cli/commands/pipelines.d.ts.map +1 -0
- package/dist/cli/commands/status.d.ts +23 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/system.d.ts +29 -0
- package/dist/cli/commands/system.d.ts.map +1 -0
- package/dist/cli/commands/test.d.ts +46 -0
- package/dist/cli/commands/test.d.ts.map +1 -0
- package/dist/cli/commands/uninstall-app.d.ts +23 -0
- package/dist/cli/commands/uninstall-app.d.ts.map +1 -0
- package/dist/cli/context.d.ts +88 -0
- package/dist/cli/context.d.ts.map +1 -0
- package/dist/cli/env-loader.d.ts +14 -0
- package/dist/cli/env-loader.d.ts.map +1 -0
- package/dist/cli/index.d.ts +41 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/functions/_shared/agent-runner.d.ts +156 -0
- package/dist/functions/_shared/agent-runner.d.ts.map +1 -0
- package/dist/functions/_shared/app-manifest.d.ts +68 -0
- package/dist/functions/_shared/app-manifest.d.ts.map +1 -0
- package/dist/functions/_shared/audit.d.ts +91 -0
- package/dist/functions/_shared/audit.d.ts.map +1 -0
- package/dist/functions/_shared/db.d.ts +125 -0
- package/dist/functions/_shared/db.d.ts.map +1 -0
- package/dist/functions/_shared/index.d.ts +298 -0
- package/dist/functions/_shared/index.d.ts.map +1 -0
- package/dist/functions/_shared/middleware.d.ts +315 -0
- package/dist/functions/_shared/middleware.d.ts.map +1 -0
- package/dist/functions/_shared/permissions.d.ts +626 -0
- package/dist/functions/_shared/permissions.d.ts.map +1 -0
- package/dist/functions/_shared/pipeline-runner.d.ts +124 -0
- package/dist/functions/_shared/pipeline-runner.d.ts.map +1 -0
- package/dist/functions/_shared/principal.d.ts +284 -0
- package/dist/functions/_shared/principal.d.ts.map +1 -0
- package/dist/functions/_shared/schema-utils.d.ts +181 -0
- package/dist/functions/_shared/schema-utils.d.ts.map +1 -0
- package/dist/functions/_shared/testing.d.ts +172 -0
- package/dist/functions/_shared/testing.d.ts.map +1 -0
- package/dist/functions/_shared/trigger-engine.d.ts +140 -0
- package/dist/functions/_shared/trigger-engine.d.ts.map +1 -0
- package/dist/functions/_shared/webhook-registration.d.ts +81 -0
- package/dist/functions/_shared/webhook-registration.d.ts.map +1 -0
- package/dist/functions/_shared/webhook-registry.d.ts +57 -0
- package/dist/functions/_shared/webhook-registry.d.ts.map +1 -0
- package/dist/functions/account-nodes.d.ts +48 -0
- package/dist/functions/account-nodes.d.ts.map +1 -0
- package/dist/functions/admin-data.d.ts +178 -0
- package/dist/functions/admin-data.d.ts.map +1 -0
- package/dist/functions/ai-agents.d.ts +125 -0
- package/dist/functions/ai-agents.d.ts.map +1 -0
- package/dist/functions/api-keys.d.ts +140 -0
- package/dist/functions/api-keys.d.ts.map +1 -0
- package/dist/functions/apps.d.ts +163 -0
- package/dist/functions/apps.d.ts.map +1 -0
- package/dist/functions/auth.d.ts +74 -0
- package/dist/functions/auth.d.ts.map +1 -0
- package/dist/functions/debug-auth.d.ts +33 -0
- package/dist/functions/debug-auth.d.ts.map +1 -0
- package/dist/functions/embeddings.d.ts +205 -0
- package/dist/functions/embeddings.d.ts.map +1 -0
- package/dist/functions/integration-routes.d.ts +45 -0
- package/dist/functions/integration-routes.d.ts.map +1 -0
- package/dist/functions/integrations.d.ts +124 -0
- package/dist/functions/integrations.d.ts.map +1 -0
- package/dist/functions/item-progress.d.ts +41 -0
- package/dist/functions/item-progress.d.ts.map +1 -0
- package/dist/functions/logs.d.ts +162 -0
- package/dist/functions/logs.d.ts.map +1 -0
- package/dist/functions/observability.d.ts +123 -0
- package/dist/functions/observability.d.ts.map +1 -0
- package/dist/functions/pipeline-executions.d.ts +190 -0
- package/dist/functions/pipeline-executions.d.ts.map +1 -0
- package/dist/functions/pipelines.d.ts +171 -0
- package/dist/functions/pipelines.d.ts.map +1 -0
- package/dist/functions/prompt-configs.d.ts +125 -0
- package/dist/functions/prompt-configs.d.ts.map +1 -0
- package/dist/functions/roles.d.ts +118 -0
- package/dist/functions/roles.d.ts.map +1 -0
- package/dist/functions/system-cron.d.ts +65 -0
- package/dist/functions/system-cron.d.ts.map +1 -0
- package/dist/functions/system.d.ts +29 -0
- package/dist/functions/system.d.ts.map +1 -0
- package/dist/functions/tests.d.ts +28 -0
- package/dist/functions/tests.d.ts.map +1 -0
- package/dist/functions/timers.d.ts +139 -0
- package/dist/functions/timers.d.ts.map +1 -0
- package/dist/functions/triggers.d.ts +203 -0
- package/dist/functions/triggers.d.ts.map +1 -0
- package/dist/functions/types.d.ts +151 -0
- package/dist/functions/types.d.ts.map +1 -0
- package/dist/src/types/types.d.ts +364 -0
- package/dist/src/types/types.d.ts.map +1 -0
- package/package.json +192 -0
- package/scripts/app-install-cli.ts +286 -0
- package/scripts/assemble-frontend.sh +79 -0
- package/scripts/assemble-functions.sh +62 -0
- package/scripts/assemble.sh +35 -0
- package/scripts/boundary-check.sh +106 -0
- package/scripts/build-manifest.sh +80 -0
- package/scripts/check-core-integrity.sh +82 -0
- package/scripts/ingest-chunks.cjs +202 -0
- package/scripts/kb-chunk-parser.cjs +312 -0
- package/scripts/kb-chunk-parser.ts +330 -0
- package/scripts/load-test-app-install.ts +484 -0
- package/scripts/netlify-dev-wrapper.sh +22 -0
- package/scripts/verify-integrity.sh +69 -0
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
# Runtime APIs
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Runtime APIs handle application runtime operations including threads, messages, attachments, watchers, links, and access control. These endpoints support real-time collaboration and system operations.
|
|
6
|
+
|
|
7
|
+
## Threads API
|
|
8
|
+
|
|
9
|
+
**Endpoint:** `/.netlify/functions/threads`
|
|
10
|
+
|
|
11
|
+
**Domain:** runtime (conversation threads)
|
|
12
|
+
|
|
13
|
+
**Operations:**
|
|
14
|
+
- `GET /functions/threads` - List threads
|
|
15
|
+
- `GET /functions/threads?id=uuid` - Get single thread
|
|
16
|
+
- `POST /functions/threads` - Create thread
|
|
17
|
+
- `PATCH /functions/threads?id=uuid` - Update thread
|
|
18
|
+
- `DELETE /functions/threads?id=uuid` - Soft delete thread
|
|
19
|
+
|
|
20
|
+
**Authentication:**
|
|
21
|
+
- Reads: Account-scoped with field-level permission filtering
|
|
22
|
+
- Mutations: Auth required with schema-driven permissions
|
|
23
|
+
|
|
24
|
+
**Authorization:**
|
|
25
|
+
- Mixed Surface Operations: User messages (first surface), AI agent messages (second surface)
|
|
26
|
+
- Thread access: First surface (user permissions)
|
|
27
|
+
- Field filtering applied based on type.schema
|
|
28
|
+
|
|
29
|
+
**Audit Trail:**
|
|
30
|
+
- System operations record ctx.triggeredBy
|
|
31
|
+
- User operations record ctx.personId
|
|
32
|
+
- System admin actions are logged but bypass checks
|
|
33
|
+
|
|
34
|
+
**Request/Response:**
|
|
35
|
+
|
|
36
|
+
### List Threads
|
|
37
|
+
```typescript
|
|
38
|
+
// Request
|
|
39
|
+
GET /functions/threads?page=1&itemsPerPage=20&search=keyword&person_id=uuid
|
|
40
|
+
|
|
41
|
+
// Response
|
|
42
|
+
{
|
|
43
|
+
data: [
|
|
44
|
+
{
|
|
45
|
+
id: string,
|
|
46
|
+
person_id: string,
|
|
47
|
+
title: string,
|
|
48
|
+
description?: string,
|
|
49
|
+
thread_type: string,
|
|
50
|
+
metadata?: object,
|
|
51
|
+
is_active: true,
|
|
52
|
+
created_at: string,
|
|
53
|
+
updated_at: string,
|
|
54
|
+
created_by: string,
|
|
55
|
+
account_id: string,
|
|
56
|
+
person: {
|
|
57
|
+
id: string,
|
|
58
|
+
first_name: string,
|
|
59
|
+
last_name: string
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Create Thread
|
|
67
|
+
```typescript
|
|
68
|
+
// Request
|
|
69
|
+
POST /functions/threads
|
|
70
|
+
{
|
|
71
|
+
person_id: string, // required
|
|
72
|
+
title: string, // required
|
|
73
|
+
description?: string,
|
|
74
|
+
thread_type: string, // required
|
|
75
|
+
metadata?: object
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Response
|
|
79
|
+
{
|
|
80
|
+
data: { /* created thread */ }
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Messages API
|
|
85
|
+
|
|
86
|
+
**Endpoint:** `/.netlify/functions/messages`
|
|
87
|
+
|
|
88
|
+
**Domain:** runtime (thread messages)
|
|
89
|
+
|
|
90
|
+
**Operations:**
|
|
91
|
+
- `GET /functions/messages` - List messages
|
|
92
|
+
- `GET /functions/messages?id=uuid` - Get single message
|
|
93
|
+
- `POST /functions/messages` - Create message
|
|
94
|
+
- `PATCH /functions/messages?id=uuid` - Update message
|
|
95
|
+
- `DELETE /functions/messages?id=uuid` - Soft delete message
|
|
96
|
+
|
|
97
|
+
**Authentication:**
|
|
98
|
+
- Reads: Account-scoped
|
|
99
|
+
- Mutations: Auth required
|
|
100
|
+
|
|
101
|
+
**Request/Response:**
|
|
102
|
+
|
|
103
|
+
### List Messages
|
|
104
|
+
```typescript
|
|
105
|
+
// Request
|
|
106
|
+
GET /functions/messages?thread_id=uuid&page=1&itemsPerPage=50
|
|
107
|
+
|
|
108
|
+
// Response
|
|
109
|
+
{
|
|
110
|
+
data: [
|
|
111
|
+
{
|
|
112
|
+
id: string,
|
|
113
|
+
thread_id: string,
|
|
114
|
+
person_id: string,
|
|
115
|
+
content: string,
|
|
116
|
+
message_type: string,
|
|
117
|
+
metadata?: object,
|
|
118
|
+
is_active: true,
|
|
119
|
+
created_at: string,
|
|
120
|
+
updated_at: string,
|
|
121
|
+
created_by: string,
|
|
122
|
+
account_id: string,
|
|
123
|
+
person: {
|
|
124
|
+
id: string,
|
|
125
|
+
first_name: string,
|
|
126
|
+
last_name: string
|
|
127
|
+
},
|
|
128
|
+
thread: {
|
|
129
|
+
id: string,
|
|
130
|
+
title: string
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Create Message
|
|
138
|
+
```typescript
|
|
139
|
+
// Request
|
|
140
|
+
POST /functions/messages
|
|
141
|
+
{
|
|
142
|
+
thread_id: string, // required
|
|
143
|
+
content: string, // required
|
|
144
|
+
message_type: string, // required
|
|
145
|
+
metadata?: object
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Response
|
|
149
|
+
{
|
|
150
|
+
data: { /* created message */ }
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Attachments API
|
|
155
|
+
|
|
156
|
+
**Endpoint:** `/.netlify/functions/attachments`
|
|
157
|
+
|
|
158
|
+
**Domain:** runtime (file attachments)
|
|
159
|
+
|
|
160
|
+
**Operations:**
|
|
161
|
+
- `GET /functions/attachments` - List attachments
|
|
162
|
+
- `GET /functions/attachments?id=uuid` - Get single attachment
|
|
163
|
+
- `POST /functions/attachments` - Create attachment
|
|
164
|
+
- `PATCH /functions/attachments?id=uuid` - Update attachment
|
|
165
|
+
- `DELETE /functions/attachments?id=uuid` - Soft delete attachment
|
|
166
|
+
|
|
167
|
+
**Authentication:**
|
|
168
|
+
- Reads: Account-scoped
|
|
169
|
+
- Mutations: Auth required
|
|
170
|
+
|
|
171
|
+
**Request/Response:**
|
|
172
|
+
|
|
173
|
+
### List Attachments
|
|
174
|
+
```typescript
|
|
175
|
+
// Request
|
|
176
|
+
GET /functions/attachments?page=1&itemsPerPage=20&thread_id=uuid
|
|
177
|
+
|
|
178
|
+
// Response
|
|
179
|
+
{
|
|
180
|
+
data: [
|
|
181
|
+
{
|
|
182
|
+
id: string,
|
|
183
|
+
person_id: string,
|
|
184
|
+
thread_id?: string,
|
|
185
|
+
filename: string,
|
|
186
|
+
file_type: string,
|
|
187
|
+
file_size: number,
|
|
188
|
+
file_url: string,
|
|
189
|
+
metadata?: object,
|
|
190
|
+
is_active: true,
|
|
191
|
+
created_at: string,
|
|
192
|
+
updated_at: string,
|
|
193
|
+
created_by: string,
|
|
194
|
+
account_id: string,
|
|
195
|
+
person: {
|
|
196
|
+
id: string,
|
|
197
|
+
first_name: string,
|
|
198
|
+
last_name: string
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Create Attachment
|
|
206
|
+
```typescript
|
|
207
|
+
// Request
|
|
208
|
+
POST /functions/attachments
|
|
209
|
+
{
|
|
210
|
+
person_id: string, // required
|
|
211
|
+
thread_id?: string,
|
|
212
|
+
filename: string, // required
|
|
213
|
+
file_type: string, // required
|
|
214
|
+
file_size: number, // required
|
|
215
|
+
file_url: string, // required
|
|
216
|
+
metadata?: object
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Response
|
|
220
|
+
{
|
|
221
|
+
data: { /* created attachment */ }
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Watchers API
|
|
226
|
+
|
|
227
|
+
**Endpoint:** `/.netlify/functions/watchers`
|
|
228
|
+
|
|
229
|
+
**Domain:** runtime (entity subscriptions)
|
|
230
|
+
|
|
231
|
+
**Operations:**
|
|
232
|
+
- `GET /functions/watchers` - List watchers
|
|
233
|
+
- `GET /functions/watchers?id=uuid` - Get single watcher
|
|
234
|
+
- `POST /functions/watchers` - Create watcher
|
|
235
|
+
- `DELETE /functions/watchers?id=uuid` - Delete watcher (hard delete)
|
|
236
|
+
|
|
237
|
+
**Authentication:**
|
|
238
|
+
- Reads: Account-scoped
|
|
239
|
+
- Mutations: Auth required
|
|
240
|
+
|
|
241
|
+
**Request/Response:**
|
|
242
|
+
|
|
243
|
+
### List Watchers
|
|
244
|
+
```typescript
|
|
245
|
+
// Request
|
|
246
|
+
GET /functions/watchers?page=1&itemsPerPage=20&person_id=uuid&entity_type=string
|
|
247
|
+
|
|
248
|
+
// Response
|
|
249
|
+
{
|
|
250
|
+
data: [
|
|
251
|
+
{
|
|
252
|
+
id: string,
|
|
253
|
+
person_id: string,
|
|
254
|
+
entity_type: string,
|
|
255
|
+
entity_id: string,
|
|
256
|
+
watch_type: string,
|
|
257
|
+
created_at: string,
|
|
258
|
+
person: {
|
|
259
|
+
id: string,
|
|
260
|
+
first_name: string,
|
|
261
|
+
last_name: string
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Create Watcher
|
|
269
|
+
```typescript
|
|
270
|
+
// Request
|
|
271
|
+
POST /functions/watchers
|
|
272
|
+
{
|
|
273
|
+
person_id: string, // required
|
|
274
|
+
entity_type: string, // required
|
|
275
|
+
entity_id: string, // required
|
|
276
|
+
watch_type: string // required
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Response
|
|
280
|
+
{
|
|
281
|
+
data: { /* created watcher */ }
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## Links API
|
|
286
|
+
|
|
287
|
+
**Endpoint:** `/.netlify/functions/links`
|
|
288
|
+
|
|
289
|
+
**Domain:** runtime (polymorphic entity relationships)
|
|
290
|
+
|
|
291
|
+
**Operations:**
|
|
292
|
+
- `GET /functions/links` - List links
|
|
293
|
+
- `GET /functions/links?id=uuid` - Get single link
|
|
294
|
+
- `POST /functions/links` - Create link
|
|
295
|
+
- `DELETE /functions/links?id=uuid` - Delete link (hard delete)
|
|
296
|
+
|
|
297
|
+
**Authentication:**
|
|
298
|
+
- Reads: Account-scoped
|
|
299
|
+
- Mutations: Auth required
|
|
300
|
+
|
|
301
|
+
**Request/Response:**
|
|
302
|
+
|
|
303
|
+
### List Links
|
|
304
|
+
```typescript
|
|
305
|
+
// Request
|
|
306
|
+
GET /functions/links?page=1&itemsPerPage=20&source_type=string&source_id=uuid
|
|
307
|
+
|
|
308
|
+
// Response
|
|
309
|
+
{
|
|
310
|
+
data: [
|
|
311
|
+
{
|
|
312
|
+
id: string,
|
|
313
|
+
link_type_id: string,
|
|
314
|
+
person_id: string,
|
|
315
|
+
source_type: string,
|
|
316
|
+
source_id: string,
|
|
317
|
+
target_type: string,
|
|
318
|
+
target_id: string,
|
|
319
|
+
metadata?: object,
|
|
320
|
+
created_at: string,
|
|
321
|
+
created_by: string,
|
|
322
|
+
account_id: string,
|
|
323
|
+
link_type: {
|
|
324
|
+
id: string,
|
|
325
|
+
name: string,
|
|
326
|
+
forward_label: string,
|
|
327
|
+
reverse_label: string
|
|
328
|
+
},
|
|
329
|
+
person: {
|
|
330
|
+
id: string,
|
|
331
|
+
first_name: string,
|
|
332
|
+
last_name: string
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
]
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Create Link
|
|
340
|
+
```typescript
|
|
341
|
+
// Request
|
|
342
|
+
POST /functions/links
|
|
343
|
+
{
|
|
344
|
+
link_type_id: string, // required
|
|
345
|
+
source_type: string, // required
|
|
346
|
+
source_id: string, // required
|
|
347
|
+
target_type: string, // required
|
|
348
|
+
target_id: string, // required
|
|
349
|
+
metadata?: object
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// Response
|
|
353
|
+
{
|
|
354
|
+
data: { /* created link */ }
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
## Link Types API
|
|
359
|
+
|
|
360
|
+
**Endpoint:** `/.netlify/functions/link-types`
|
|
361
|
+
|
|
362
|
+
**Domain:** runtime (link type definitions)
|
|
363
|
+
|
|
364
|
+
**Operations:**
|
|
365
|
+
- `GET /functions/link-types` - List link types
|
|
366
|
+
- `GET /functions/link-types?id=uuid` - Get single link type
|
|
367
|
+
- `POST /functions/link-types` - Create link type
|
|
368
|
+
- `PATCH /functions/link-types?id=uuid` - Update link type
|
|
369
|
+
- `DELETE /functions/link-types?id=uuid` - Soft delete link type
|
|
370
|
+
|
|
371
|
+
**Authentication:**
|
|
372
|
+
- Reads: Public
|
|
373
|
+
- Mutations: Admin auth required
|
|
374
|
+
|
|
375
|
+
**Request/Response:**
|
|
376
|
+
|
|
377
|
+
### List Link Types
|
|
378
|
+
```typescript
|
|
379
|
+
// Request
|
|
380
|
+
GET /functions/link-types?page=1&itemsPerPage=20&app_id=uuid
|
|
381
|
+
|
|
382
|
+
// Response
|
|
383
|
+
{
|
|
384
|
+
data: [
|
|
385
|
+
{
|
|
386
|
+
id: string,
|
|
387
|
+
app_id: string,
|
|
388
|
+
name: string,
|
|
389
|
+
description?: string,
|
|
390
|
+
forward_label: string,
|
|
391
|
+
reverse_label: string,
|
|
392
|
+
source_types: string[],
|
|
393
|
+
target_types: string[],
|
|
394
|
+
is_active: true,
|
|
395
|
+
created_at: string,
|
|
396
|
+
updated_at: string,
|
|
397
|
+
created_by: string
|
|
398
|
+
}
|
|
399
|
+
]
|
|
400
|
+
}
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Create Link Type
|
|
404
|
+
```typescript
|
|
405
|
+
// Request
|
|
406
|
+
POST /functions/link-types
|
|
407
|
+
{
|
|
408
|
+
app_id: string, // required
|
|
409
|
+
name: string, // required
|
|
410
|
+
description?: string,
|
|
411
|
+
forward_label: string, // required
|
|
412
|
+
reverse_label: string, // required
|
|
413
|
+
source_types: string[], // required
|
|
414
|
+
target_types: string[] // required
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// Response
|
|
418
|
+
{
|
|
419
|
+
data: { /* created link type */ }
|
|
420
|
+
}
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
## Access Control APIs
|
|
424
|
+
|
|
425
|
+
### People-Accounts API
|
|
426
|
+
|
|
427
|
+
**Endpoint:** `/.netlify/functions/people-accounts`
|
|
428
|
+
|
|
429
|
+
**Domain:** runtime (people-accounts junction)
|
|
430
|
+
|
|
431
|
+
**Operations:**
|
|
432
|
+
- `GET /functions/people-accounts` - List people-accounts relationships
|
|
433
|
+
- `POST /functions/people-accounts` - Add person to account
|
|
434
|
+
- `DELETE /functions/people-accounts?id=uuid` - Remove person from account
|
|
435
|
+
|
|
436
|
+
**Authentication:**
|
|
437
|
+
- Reads: Account-scoped
|
|
438
|
+
- Mutations: Auth required
|
|
439
|
+
|
|
440
|
+
### People-Roles API
|
|
441
|
+
|
|
442
|
+
**Endpoint:** `/.netlify/functions/people-roles`
|
|
443
|
+
|
|
444
|
+
**Domain:** runtime (people-roles junction)
|
|
445
|
+
|
|
446
|
+
**Operations:**
|
|
447
|
+
- `GET /functions/people-roles` - List people-roles relationships
|
|
448
|
+
- `POST /functions/people-roles` - Assign role to person
|
|
449
|
+
- `DELETE /functions/people-roles?id=uuid` - Remove role from person
|
|
450
|
+
|
|
451
|
+
**Authentication:**
|
|
452
|
+
- Reads: Account-scoped
|
|
453
|
+
- Mutations: Auth required
|
|
454
|
+
|
|
455
|
+
### Account Nodes API
|
|
456
|
+
|
|
457
|
+
**Endpoint:** `/.netlify/functions/account-nodes`
|
|
458
|
+
|
|
459
|
+
**Domain:** internal (account hierarchy traversal)
|
|
460
|
+
|
|
461
|
+
**Operations:**
|
|
462
|
+
- `GET /functions/account-nodes?id=uuid&include=ancestors|descendants` - Get account hierarchy
|
|
463
|
+
|
|
464
|
+
**Authentication:**
|
|
465
|
+
- Reads: Account-scoped
|
|
466
|
+
- Uses RPC functions for hierarchy traversal
|
|
467
|
+
|
|
468
|
+
## System APIs
|
|
469
|
+
|
|
470
|
+
### Logs API
|
|
471
|
+
|
|
472
|
+
**Endpoint:** `/.netlify/functions/logs`
|
|
473
|
+
|
|
474
|
+
**Domain:** internal (system logs)
|
|
475
|
+
|
|
476
|
+
**Operations:**
|
|
477
|
+
- `GET /functions/logs` - List system logs
|
|
478
|
+
- `GET /functions/logs?id=uuid` - Get single log entry
|
|
479
|
+
|
|
480
|
+
**Authentication:**
|
|
481
|
+
- Reads: Admin auth required
|
|
482
|
+
|
|
483
|
+
### Pipeline Executions API
|
|
484
|
+
|
|
485
|
+
**Endpoint:** `/.netlify/functions/pipeline-executions`
|
|
486
|
+
|
|
487
|
+
**Domain:** runtime (pipeline execution history)
|
|
488
|
+
|
|
489
|
+
**Operations:**
|
|
490
|
+
- `GET /functions/pipeline-executions` - List pipeline executions
|
|
491
|
+
- `GET /functions/pipeline-executions?id=uuid` - Get single execution
|
|
492
|
+
|
|
493
|
+
**Authentication:**
|
|
494
|
+
- Reads: Account-scoped
|
|
495
|
+
|
|
496
|
+
## Common Features
|
|
497
|
+
|
|
498
|
+
### Account Scoping
|
|
499
|
+
- All runtime endpoints respect account boundaries
|
|
500
|
+
- Account context via `X-Account-Id` header
|
|
501
|
+
- System admin can bypass scoping
|
|
502
|
+
|
|
503
|
+
### Real-time Operations
|
|
504
|
+
- Support for WebSocket notifications
|
|
505
|
+
- Event-driven updates
|
|
506
|
+
- Optimistic locking for concurrent updates
|
|
507
|
+
|
|
508
|
+
### Audit Trail
|
|
509
|
+
- All mutations create audit logs
|
|
510
|
+
- Immutable history preservation
|
|
511
|
+
- Person attribution for all changes
|
|
512
|
+
|
|
513
|
+
### Error Handling
|
|
514
|
+
```typescript
|
|
515
|
+
// Success Response
|
|
516
|
+
{
|
|
517
|
+
data: T
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
// Error Response
|
|
521
|
+
{
|
|
522
|
+
error: "Human readable message",
|
|
523
|
+
code?: "ERROR_CODE"
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// Validation Error
|
|
527
|
+
{
|
|
528
|
+
errors: {
|
|
529
|
+
field: "field-specific error"
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
### Pagination
|
|
535
|
+
- Default: `page=1`, `itemsPerPage=20`
|
|
536
|
+
- Higher limits for message threads (50)
|
|
537
|
+
- Supports filtering and search
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Spine v2 Assembly & Launch Process Guide
|
|
2
|
+
|
|
3
|
+
## Source Directories vs Served Directories
|
|
4
|
+
|
|
5
|
+
**Edit here (source of truth):**
|
|
6
|
+
- `v2-core/src/` — core frontend (all apps, components, hooks, pages)
|
|
7
|
+
- `v2-core/functions/` — core Netlify functions
|
|
8
|
+
- `v2-custom/src/` — custom frontend overrides (`custom_*.tsx` files only)
|
|
9
|
+
- `v2-custom/functions/` — custom function overrides (`custom_*.ts` files only)
|
|
10
|
+
|
|
11
|
+
**Never edit these (generated/assembled output):**
|
|
12
|
+
- `functions/` (repo root) — assembled and served by Netlify CLI
|
|
13
|
+
- `src/v2-assembled/` — assembled for prod builds only (not used in dev)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Dev vs Prod
|
|
18
|
+
|
|
19
|
+
### Dev (`netlify dev`)
|
|
20
|
+
|
|
21
|
+
**Frontend** — not assembled. Vite serves `v2-core/` directly as its root:
|
|
22
|
+
```
|
|
23
|
+
vite.config.ts → root: 'v2-core'
|
|
24
|
+
```
|
|
25
|
+
`v2-custom/src/` is reachable via `server.fs.allow`, so `CustomAppLoader.tsx` loads
|
|
26
|
+
full custom app trees (e.g. `v2-custom/src/apps/customer-portal/`) via `import.meta.glob`
|
|
27
|
+
at runtime — no file copying needed for frontend in dev.
|
|
28
|
+
|
|
29
|
+
**Functions** — must be assembled. Netlify CLI serves functions from `functions/` at the
|
|
30
|
+
repo root (`netlify.toml [functions] directory = "functions"`). Run `npm run assemble:v2`
|
|
31
|
+
before starting dev whenever you add or change a function.
|
|
32
|
+
|
|
33
|
+
### Prod (`npm run build`)
|
|
34
|
+
|
|
35
|
+
`package.json` runs full assembly before the Vite build:
|
|
36
|
+
```
|
|
37
|
+
prebuild → npm run assemble:v2 && npm run verify
|
|
38
|
+
build → tsc -b && vite build --config vite.config.ts
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Assembly: What `npm run assemble:v2` Does
|
|
44
|
+
|
|
45
|
+
Calls `scripts/assemble-v2.sh`, which runs these three steps **in order**:
|
|
46
|
+
|
|
47
|
+
**Step 1 — Custom overlay** (`scripts/assemble-v2-custom.sh`)
|
|
48
|
+
- Finds all `custom_*.tsx` files under `v2-custom/src/` → flat-copies into `v2-core/src/`
|
|
49
|
+
- Finds all `custom_*.ts` files under `v2-custom/functions/` → flat-copies into `v2-core/functions/`
|
|
50
|
+
- Files NOT named `custom_*` are ignored by assembly (but full app trees in `v2-custom/src/apps/`
|
|
51
|
+
are still accessible to Vite dev server via `fs.allow`)
|
|
52
|
+
|
|
53
|
+
**Step 2 — Functions**
|
|
54
|
+
- Wipes `functions/` (repo root)
|
|
55
|
+
- Copies `v2-core/functions/` → `functions/` (now includes any custom_*.ts from step 1)
|
|
56
|
+
|
|
57
|
+
**Step 3 — Frontend (prod only)**
|
|
58
|
+
- Wipes `src/v2-assembled/`
|
|
59
|
+
- Copies `v2-core/src/` → `src/v2-assembled/` (now includes any custom_*.tsx from step 1)
|
|
60
|
+
- Fixes `index.html` script path: `/src/main.tsx` → `./main.tsx`
|
|
61
|
+
|
|
62
|
+
The order matters: custom files must land in `v2-core/` **before** the root copy runs,
|
|
63
|
+
so they are included in the output in a single pass.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Standard Dev Launch
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# First time, or after adding/modifying any function:
|
|
71
|
+
npm run assemble:v2
|
|
72
|
+
|
|
73
|
+
# Start the dev server:
|
|
74
|
+
netlify dev
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**What `netlify dev` does:**
|
|
78
|
+
1. Runs `scripts/netlify-dev-wrapper.sh` (via `netlify.toml [dev].command`)
|
|
79
|
+
2. Wrapper fires Vite directly: `exec node_modules/.bin/vite --config vite.config.ts`
|
|
80
|
+
3. Vite serves `v2-core/` on port 3001 with HMR
|
|
81
|
+
4. Netlify CLI proxies port 8888 → 3001 and serves `functions/` (repo root)
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Process Management
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Check ports
|
|
89
|
+
lsof -i:3001 # Vite
|
|
90
|
+
lsof -i:8888 # Netlify proxy
|
|
91
|
+
|
|
92
|
+
# Kill both
|
|
93
|
+
pkill -f vite && pkill -f netlify
|
|
94
|
+
|
|
95
|
+
# Clean restart
|
|
96
|
+
pkill -f vite && pkill -f netlify && sleep 1 && netlify dev
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Troubleshooting
|
|
102
|
+
|
|
103
|
+
### Function returning 404
|
|
104
|
+
`functions/` (repo root) is stale or missing the new function. Reassemble then restart:
|
|
105
|
+
```bash
|
|
106
|
+
npm run assemble:v2
|
|
107
|
+
# restart netlify dev
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### `custom_*.tsx` override not taking effect
|
|
111
|
+
Reassemble so the file lands in `v2-core/src/`:
|
|
112
|
+
```bash
|
|
113
|
+
npm run assemble:v2
|
|
114
|
+
```
|
|
115
|
+
Vite HMR picks it up automatically if the dev server is already running.
|
|
116
|
+
|
|
117
|
+
### Vite never binds to port 3001
|
|
118
|
+
`npm run dev` and `npx vite` silently hang under Netlify CLI. The wrapper must use the
|
|
119
|
+
direct binary. Verify `scripts/netlify-dev-wrapper.sh` contains:
|
|
120
|
+
```bash
|
|
121
|
+
exec "$PROJECT_ROOT/node_modules/.bin/vite" --config "$PROJECT_ROOT/vite.config.ts"
|
|
122
|
+
```
|
|
123
|
+
Never change this to `npm run dev` or `npx vite`.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Key Files
|
|
128
|
+
|
|
129
|
+
| File | Role |
|
|
130
|
+
|---|---|
|
|
131
|
+
| `scripts/assemble-v2.sh` | Full assembly orchestrator — runs steps 1→2→3 |
|
|
132
|
+
| `scripts/assemble-v2-custom.sh` | Step 1: overlays `custom_*` files into `v2-core/` |
|
|
133
|
+
| `scripts/netlify-dev-wrapper.sh` | Dev entry point — fires Vite binary directly |
|
|
134
|
+
| `netlify.toml` | `[dev].command` → wrapper; `[functions] directory = "functions"` |
|
|
135
|
+
| `vite.config.ts` | `root: 'v2-core'`; `fs.allow` includes `v2-custom`; `@core`/`@custom` aliases |
|
|
136
|
+
| `v2-core/src/components/CustomAppLoader.tsx` | Loads `v2-custom/src/apps/*/index.tsx` via `import.meta.glob` |
|
|
137
|
+
| `functions/` (repo root) | Assembled output — served by Netlify CLI; never edit directly |
|
|
138
|
+
| `src/v2-assembled/` | Assembled output — prod build only; never edit directly |
|