spine-framework 0.3.16 → 0.3.18
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/cli/commands/create-app.ts +1 -1
- package/.framework/cli/commands/dev.ts +215 -33
- package/.framework/cli/index.ts +37 -75
- package/.framework/functions/_shared/app-manifest.ts +8 -15
- package/.framework/functions/_shared/db.ts +11 -15
- package/.framework/functions/_shared/index.ts +7 -16
- package/.framework/functions/_shared/principal.ts +4 -62
- package/.framework/functions/_shared/resolve-ids.ts +6 -6
- package/.framework/functions/_shared/webhook-registry.ts +43 -1
- package/.framework/functions/admin-funnel.ts +104 -0
- package/.framework/functions/admin-install-funnel.ts +225 -0
- package/.framework/functions/admin-signals.ts +241 -0
- package/.framework/functions/integration-routes.ts +3 -7
- package/.framework/migrations/001_schema.sql +406 -0
- package/.framework/migrations/002_rls_and_functions.sql +710 -0
- package/.framework/migrations/003_system_data.sql +520 -0
- package/.framework/migrations/004_enhancements.sql +43 -0
- package/.framework/public/_redirects +3 -0
- package/.framework/public/spine-logo.jpg +0 -0
- package/.framework/public/spine-logo.svg +3 -0
- package/{scripts → .framework/scripts}/assemble-frontend.sh +8 -5
- package/{scripts → .framework/scripts}/assemble-functions.sh +4 -47
- package/{scripts → .framework/scripts}/assemble.sh +2 -8
- package/{scripts → .framework/scripts}/boundary-check.sh +5 -9
- package/{scripts → .framework/scripts}/check-core-integrity.sh +0 -0
- package/.framework/seeds/link_types/account_cli_instances.json +9 -0
- package/.framework/seeds/types/funnel_signal_use.json +98 -0
- package/.framework/seeds/types/spine_instance.json +109 -0
- package/.framework/src/App.tsx +11 -21
- package/.framework/src/components/CustomAppLoader.tsx +2 -19
- package/.framework/src/components/ui/accordion.tsx +1 -1
- package/.framework/src/components/ui/alert-dialog.tsx +1 -1
- package/.framework/src/components/ui/aspect-ratio.tsx +1 -1
- package/.framework/src/components/ui/avatar.tsx +1 -1
- package/.framework/src/components/ui/badge.tsx +2 -2
- package/.framework/src/components/ui/breadcrumb.tsx +2 -2
- package/.framework/src/components/ui/button-group.tsx +2 -2
- package/.framework/src/components/ui/button.tsx +2 -2
- package/.framework/src/components/ui/chart.tsx +6 -1
- package/.framework/src/components/ui/checkbox.tsx +1 -1
- package/.framework/src/components/ui/collapsible.tsx +1 -1
- package/.framework/src/components/ui/context-menu.tsx +1 -1
- package/.framework/src/components/ui/dialog.tsx +1 -1
- package/.framework/src/components/ui/direction.tsx +17 -1
- package/.framework/src/components/ui/dropdown-menu.tsx +1 -1
- package/.framework/src/components/ui/hover-card.tsx +1 -1
- package/.framework/src/components/ui/item.tsx +2 -2
- package/.framework/src/components/ui/label.tsx +1 -1
- package/.framework/src/components/ui/menubar.tsx +1 -1
- package/.framework/src/components/ui/navigation-menu.tsx +1 -1
- package/.framework/src/components/ui/popover.tsx +1 -1
- package/.framework/src/components/ui/progress.tsx +1 -1
- package/.framework/src/components/ui/radio-group.tsx +1 -1
- package/.framework/src/components/ui/scroll-area.tsx +1 -1
- package/.framework/src/components/ui/select.tsx +1 -1
- package/.framework/src/components/ui/separator.tsx +1 -1
- package/.framework/src/components/ui/sheet.tsx +1 -1
- package/.framework/src/components/ui/sidebar.tsx +6 -6
- package/.framework/src/components/ui/slider.tsx +1 -1
- package/.framework/src/components/ui/switch.tsx +1 -1
- package/.framework/src/components/ui/tabs.tsx +1 -1
- package/.framework/src/components/ui/toggle-group.tsx +1 -1
- package/.framework/src/components/ui/toggle.tsx +1 -1
- package/.framework/src/components/ui/tooltip.tsx +1 -1
- package/.framework/src/pages/auth/LoginPage.tsx +10 -9
- package/LICENSE.md +63 -93
- package/README.md +254 -129
- package/custom/.devin/skills/install-app/SKILL.md +39 -0
- package/custom/.devin/workflows/app-install.yaml +83 -0
- package/custom/README.md +79 -0
- package/docs/APPS.md +232 -0
- package/docs/ARCHITECTURE.md +246 -0
- package/docs/INSTALL.md +155 -0
- package/docs/README.md +170 -0
- package/docs/design-schema-spec.md +1837 -0
- package/docs/dev-guides/01-create-an-app.md +183 -0
- package/docs/dev-guides/02-create-a-function.md +178 -0
- package/docs/dev-guides/03-create-a-component.md +178 -0
- package/docs/dev-guides/04-webhook-handlers.md +129 -0
- package/docs/dev-guides/05-testing.md +168 -0
- package/docs/dev-guides/README.md +40 -0
- package/docs/npm-packages-plan.md +288 -0
- package/docs/spine-core--api-reference.md +822 -0
- package/package.json +78 -150
- package/.framework/cli/bin.cjs +0 -14
- package/.framework/cli/commands/claim.ts +0 -430
- package/.framework/cli/commands/init.ts +0 -219
- package/.framework/cli/commands/install-app.ts +0 -685
- package/.framework/cli/commands/migrate.ts +0 -178
- package/.framework/cli/commands/publish.ts +0 -191
- package/.framework/cli/commands/status.ts +0 -268
- package/.framework/cli/commands/uninstall-app.ts +0 -166
- package/.framework/cli/commands/update-app.ts +0 -397
- package/.framework/cli/welcome.cjs +0 -45
- package/.framework/config/signal-client.ts +0 -147
- package/.framework/config/signals.ts +0 -70
- package/.framework/docs/STABILITY.md +0 -52
- package/.framework/docs/examples/custom-app/README.md +0 -77
- package/.framework/docs/examples/custom-function/README.md +0 -27
- package/.framework/docs/examples/custom-function/handler.ts +0 -48
- package/.framework/docs/examples/custom-webhook/README.md +0 -68
- package/.framework/functions/handler-registry.ts +0 -22
- package/.framework/functions/signal.ts +0 -168
- package/.framework/migrations/000_foundation.sql +0 -1302
- package/.framework/migrations/001_seed.sql +0 -163
- package/.framework/migrations/002_seed_constraints.sql +0 -19
- package/.framework/migrations/003_auth_user_trigger.sql +0 -67
- package/.framework/migrations/004_app_version_tracking.sql +0 -8
- package/.framework/migrations/005_pipelines_slug_stages.sql +0 -21
- package/.framework/src/pages/auth/RegisterPage.tsx +0 -163
- package/CHANGELOG.md +0 -68
- package/STRUCTURE.md +0 -150
- package/bin/spine-framework.cjs +0 -62
- package/bin/welcome.cjs +0 -58
- package/bin/ws-shim.ts +0 -10
- package/config/components.json +0 -25
- package/config/deno.lock +0 -108
- package/config/package-lock.json +0 -17183
- package/config/postcss.config.cjs +0 -10
- package/config/tailwind.config.cjs +0 -78
- package/config/tsconfig.build.json +0 -32
- package/config/tsconfig.cli.json +0 -18
- package/config/tsconfig.json +0 -41
- package/config/tsconfig.node.json +0 -17
- package/config/tsconfig.node.tsbuildinfo +0 -1
- package/config/tsconfig.tsbuildinfo +0 -1
- package/config/typedoc.json +0 -16
- package/config/vite.config.d.ts +0 -2
- package/config/vite.config.ts +0 -71
- package/dist/cli/commands/agents.d.ts +0 -39
- package/dist/cli/commands/agents.d.ts.map +0 -1
- package/dist/cli/commands/auth.d.ts +0 -36
- package/dist/cli/commands/auth.d.ts.map +0 -1
- package/dist/cli/commands/claim.d.ts +0 -38
- package/dist/cli/commands/claim.d.ts.map +0 -1
- package/dist/cli/commands/create-app.d.ts +0 -23
- package/dist/cli/commands/create-app.d.ts.map +0 -1
- package/dist/cli/commands/dev.d.ts +0 -24
- package/dist/cli/commands/dev.d.ts.map +0 -1
- package/dist/cli/commands/doctor.d.ts +0 -42
- package/dist/cli/commands/doctor.d.ts.map +0 -1
- package/dist/cli/commands/generate.d.ts +0 -36
- package/dist/cli/commands/generate.d.ts.map +0 -1
- package/dist/cli/commands/init.d.ts +0 -20
- package/dist/cli/commands/init.d.ts.map +0 -1
- package/dist/cli/commands/install-app.d.ts +0 -30
- package/dist/cli/commands/install-app.d.ts.map +0 -1
- package/dist/cli/commands/items.d.ts +0 -45
- package/dist/cli/commands/items.d.ts.map +0 -1
- package/dist/cli/commands/migrate.d.ts +0 -21
- package/dist/cli/commands/migrate.d.ts.map +0 -1
- package/dist/cli/commands/migrations.d.ts +0 -41
- package/dist/cli/commands/migrations.d.ts.map +0 -1
- package/dist/cli/commands/pipelines.d.ts +0 -40
- package/dist/cli/commands/pipelines.d.ts.map +0 -1
- package/dist/cli/commands/publish.d.ts +0 -23
- package/dist/cli/commands/publish.d.ts.map +0 -1
- package/dist/cli/commands/status.d.ts +0 -23
- package/dist/cli/commands/status.d.ts.map +0 -1
- package/dist/cli/commands/system.d.ts +0 -29
- package/dist/cli/commands/system.d.ts.map +0 -1
- package/dist/cli/commands/test.d.ts +0 -46
- package/dist/cli/commands/test.d.ts.map +0 -1
- package/dist/cli/commands/uninstall-app.d.ts +0 -23
- package/dist/cli/commands/uninstall-app.d.ts.map +0 -1
- package/dist/cli/commands/update-app.d.ts +0 -24
- package/dist/cli/commands/update-app.d.ts.map +0 -1
- package/dist/cli/context.d.ts +0 -88
- package/dist/cli/context.d.ts.map +0 -1
- package/dist/cli/env-loader.d.ts +0 -14
- package/dist/cli/env-loader.d.ts.map +0 -1
- package/dist/cli/index.d.ts +0 -44
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/config/signals.d.ts +0 -82
- package/dist/config/signals.d.ts.map +0 -1
- package/dist/functions/_shared/agent-runner.d.ts +0 -156
- package/dist/functions/_shared/agent-runner.d.ts.map +0 -1
- package/dist/functions/_shared/app-manifest.d.ts +0 -68
- package/dist/functions/_shared/app-manifest.d.ts.map +0 -1
- package/dist/functions/_shared/audit.d.ts +0 -91
- package/dist/functions/_shared/audit.d.ts.map +0 -1
- package/dist/functions/_shared/db.d.ts +0 -125
- package/dist/functions/_shared/db.d.ts.map +0 -1
- package/dist/functions/_shared/index.d.ts +0 -299
- package/dist/functions/_shared/index.d.ts.map +0 -1
- package/dist/functions/_shared/middleware.d.ts +0 -315
- package/dist/functions/_shared/middleware.d.ts.map +0 -1
- package/dist/functions/_shared/permissions.d.ts +0 -626
- package/dist/functions/_shared/permissions.d.ts.map +0 -1
- package/dist/functions/_shared/pipeline-runner.d.ts +0 -124
- package/dist/functions/_shared/pipeline-runner.d.ts.map +0 -1
- package/dist/functions/_shared/principal.d.ts +0 -284
- package/dist/functions/_shared/principal.d.ts.map +0 -1
- package/dist/functions/_shared/resolve-ids.d.ts +0 -10
- package/dist/functions/_shared/resolve-ids.d.ts.map +0 -1
- package/dist/functions/_shared/schema-utils.d.ts +0 -181
- package/dist/functions/_shared/schema-utils.d.ts.map +0 -1
- package/dist/functions/_shared/testing.d.ts +0 -172
- package/dist/functions/_shared/testing.d.ts.map +0 -1
- package/dist/functions/_shared/trigger-engine.d.ts +0 -140
- package/dist/functions/_shared/trigger-engine.d.ts.map +0 -1
- package/dist/functions/_shared/webhook-registration.d.ts +0 -81
- package/dist/functions/_shared/webhook-registration.d.ts.map +0 -1
- package/dist/functions/_shared/webhook-registry.d.ts +0 -41
- package/dist/functions/_shared/webhook-registry.d.ts.map +0 -1
- package/dist/functions/account-nodes.d.ts +0 -48
- package/dist/functions/account-nodes.d.ts.map +0 -1
- package/dist/functions/admin-data.d.ts +0 -178
- package/dist/functions/admin-data.d.ts.map +0 -1
- package/dist/functions/ai-agents.d.ts +0 -125
- package/dist/functions/ai-agents.d.ts.map +0 -1
- package/dist/functions/api-keys.d.ts +0 -140
- package/dist/functions/api-keys.d.ts.map +0 -1
- package/dist/functions/apps.d.ts +0 -163
- package/dist/functions/apps.d.ts.map +0 -1
- package/dist/functions/auth.d.ts +0 -74
- package/dist/functions/auth.d.ts.map +0 -1
- package/dist/functions/debug-auth.d.ts +0 -33
- package/dist/functions/debug-auth.d.ts.map +0 -1
- package/dist/functions/embeddings.d.ts +0 -205
- package/dist/functions/embeddings.d.ts.map +0 -1
- package/dist/functions/handler-registry.d.ts +0 -22
- package/dist/functions/handler-registry.d.ts.map +0 -1
- package/dist/functions/integration-routes.d.ts +0 -45
- package/dist/functions/integration-routes.d.ts.map +0 -1
- package/dist/functions/integrations.d.ts +0 -124
- package/dist/functions/integrations.d.ts.map +0 -1
- package/dist/functions/item-progress.d.ts +0 -41
- package/dist/functions/item-progress.d.ts.map +0 -1
- package/dist/functions/logs.d.ts +0 -162
- package/dist/functions/logs.d.ts.map +0 -1
- package/dist/functions/observability.d.ts +0 -123
- package/dist/functions/observability.d.ts.map +0 -1
- package/dist/functions/pipeline-executions.d.ts +0 -190
- package/dist/functions/pipeline-executions.d.ts.map +0 -1
- package/dist/functions/pipelines.d.ts +0 -171
- package/dist/functions/pipelines.d.ts.map +0 -1
- package/dist/functions/prompt-configs.d.ts +0 -125
- package/dist/functions/prompt-configs.d.ts.map +0 -1
- package/dist/functions/roles.d.ts +0 -118
- package/dist/functions/roles.d.ts.map +0 -1
- package/dist/functions/signal.d.ts +0 -73
- package/dist/functions/signal.d.ts.map +0 -1
- package/dist/functions/system-cron.d.ts +0 -65
- package/dist/functions/system-cron.d.ts.map +0 -1
- package/dist/functions/system.d.ts +0 -29
- package/dist/functions/system.d.ts.map +0 -1
- package/dist/functions/tests.d.ts +0 -28
- package/dist/functions/tests.d.ts.map +0 -1
- package/dist/functions/timers.d.ts +0 -139
- package/dist/functions/timers.d.ts.map +0 -1
- package/dist/functions/triggers.d.ts +0 -203
- package/dist/functions/triggers.d.ts.map +0 -1
- package/dist/functions/types.d.ts +0 -151
- package/dist/functions/types.d.ts.map +0 -1
- package/dist/src/types/types.d.ts +0 -364
- package/dist/src/types/types.d.ts.map +0 -1
- package/index.html +0 -13
- package/netlify.toml +0 -36
- package/package-project.json +0 -71
- package/scripts/ingest-chunks.cjs +0 -202
- package/scripts/kb-chunk-parser.cjs +0 -312
- package/scripts/kb-chunk-parser.ts +0 -330
- package/scripts/load-test-app-install.ts +0 -484
- package/scripts/netlify-dev-wrapper.sh +0 -22
- package/vitest.config.ts +0 -45
- /package/{scripts → .framework/scripts}/app-install-cli.ts +0 -0
- /package/{scripts → .framework/scripts}/build-manifest.sh +0 -0
- /package/{scripts → .framework/scripts}/verify-integrity.sh +0 -0
|
@@ -0,0 +1,822 @@
|
|
|
1
|
+
# Spine Core API Reference
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This document describes all APIs exposed by Spine Core that custom apps can consume. All APIs are served from the same origin when assembled, requiring no API keys — authentication is handled via Supabase Auth session cookies.
|
|
6
|
+
|
|
7
|
+
**Base URL:** `/.netlify/functions/{endpoint}`
|
|
8
|
+
|
|
9
|
+
**Authentication:** All endpoints (except noted) require authenticated Supabase session. The `createHandler` middleware extracts JWT from cookies and builds `ctx.principal`.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Config APIs (Admin-Only Write)
|
|
14
|
+
|
|
15
|
+
These endpoints define system shapes and behaviors. Reads are available to all authenticated users; writes require system admin.
|
|
16
|
+
|
|
17
|
+
### 1. Types API (`types.ts`)
|
|
18
|
+
|
|
19
|
+
**Purpose:** CRUD for type definitions — the schemas that shape items, people, accounts, and links.
|
|
20
|
+
|
|
21
|
+
**Endpoints:**
|
|
22
|
+
```
|
|
23
|
+
GET /.netlify/functions/types (list)
|
|
24
|
+
GET /.netlify/functions/types?id={uuid} (get)
|
|
25
|
+
POST /.netlify/functions/types (create - admin only)
|
|
26
|
+
PATCH /.netlify/functions/types?id={uuid} (update - admin only)
|
|
27
|
+
DELETE /.netlify/functions/types?id={uuid} (remove - admin only)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Query Parameters:**
|
|
31
|
+
- `kind` — filter by type kind (entity, item, link, etc.)
|
|
32
|
+
- `app_id` — filter by parent app (use `null` for system types)
|
|
33
|
+
- `ownership` — filter by ownership (system, tenant, pack)
|
|
34
|
+
- `include_schema` — include design_schema in response
|
|
35
|
+
|
|
36
|
+
**Request Body (Create/Update):**
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"slug": "support_ticket",
|
|
40
|
+
"name": "Support Ticket",
|
|
41
|
+
"kind": "item",
|
|
42
|
+
"app_id": "uuid-or-null",
|
|
43
|
+
"design_schema": { "fields": {}, "record_permissions": {} },
|
|
44
|
+
"validation_schema": {}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Expected Output:**
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"id": "uuid",
|
|
52
|
+
"slug": "support_ticket",
|
|
53
|
+
"name": "Support Ticket",
|
|
54
|
+
"kind": "item",
|
|
55
|
+
"design_schema": { ... },
|
|
56
|
+
"is_active": true,
|
|
57
|
+
"created_at": "2024-01-01T00:00:00Z"
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**How to Test:**
|
|
62
|
+
```bash
|
|
63
|
+
# List all types
|
|
64
|
+
curl -H "Cookie: sb-access-token=..." \
|
|
65
|
+
/.netlify/functions/types?kind=item
|
|
66
|
+
|
|
67
|
+
# Create type (admin only)
|
|
68
|
+
curl -X POST \
|
|
69
|
+
-H "Cookie: sb-access-token=..." \
|
|
70
|
+
-H "Content-Type: application/json" \
|
|
71
|
+
-d '{"slug":"test","name":"Test","kind":"item"}' \
|
|
72
|
+
/.netlify/functions/types
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### 2. Apps API (`apps.ts`)
|
|
78
|
+
|
|
79
|
+
**Purpose:** CRUD for app definitions — installable units of functionality with nav configuration.
|
|
80
|
+
|
|
81
|
+
**Endpoints:**
|
|
82
|
+
```
|
|
83
|
+
GET /.netlify/functions/apps (list)
|
|
84
|
+
GET /.netlify/functions/apps?id={uuid} (get)
|
|
85
|
+
POST /.netlify/functions/apps (create - admin only)
|
|
86
|
+
PATCH /.netlify/functions/apps?id={uuid} (update - admin only)
|
|
87
|
+
DELETE /.netlify/functions/apps?id={uuid} (remove - admin only)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Query Parameters:**
|
|
91
|
+
- `include_system` — include system apps (default: true)
|
|
92
|
+
- `include_inactive` — include inactive apps
|
|
93
|
+
- `account_id` — scope to specific account
|
|
94
|
+
|
|
95
|
+
**Request Body (Create/Update):**
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"slug": "my-app",
|
|
99
|
+
"name": "My Application",
|
|
100
|
+
"route_prefix": "/my-app",
|
|
101
|
+
"renderer": "custom",
|
|
102
|
+
"nav_items": [
|
|
103
|
+
{ "title": "Dashboard", "path": "/", "icon": "Layout" }
|
|
104
|
+
],
|
|
105
|
+
"min_role": "admin"
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**How to Test:**
|
|
110
|
+
```bash
|
|
111
|
+
curl -H "Cookie: sb-access-token=..." \
|
|
112
|
+
/.netlify/functions/apps?include_system=true
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
### 3. Roles API (`roles.ts`)
|
|
118
|
+
|
|
119
|
+
**Purpose:** CRUD for role definitions with permission sets.
|
|
120
|
+
|
|
121
|
+
**Endpoints:**
|
|
122
|
+
```
|
|
123
|
+
GET /.netlify/functions/roles (list)
|
|
124
|
+
GET /.netlify/functions/roles?id={uuid} (get)
|
|
125
|
+
POST /.netlify/functions/roles (create - admin only)
|
|
126
|
+
PATCH /.netlify/functions/roles?id={uuid} (update - admin only)
|
|
127
|
+
DELETE /.netlify/functions/roles?id={uuid} (remove - admin only)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Query Parameters:**
|
|
131
|
+
- `app_id` — filter by parent app
|
|
132
|
+
- `is_system` — filter system roles
|
|
133
|
+
|
|
134
|
+
**Request Body:**
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"slug": "manager",
|
|
138
|
+
"name": "Manager",
|
|
139
|
+
"permissions": ["read", "write"],
|
|
140
|
+
"is_system": false
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**How to Test:**
|
|
145
|
+
```bash
|
|
146
|
+
curl -H "Cookie: sb-access-token=..." \
|
|
147
|
+
/.netlify/functions/roles?is_system=true
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
### 4. Pipelines API (`pipelines.ts`)
|
|
153
|
+
|
|
154
|
+
**Purpose:** CRUD for pipeline definitions — named stage sequences for workflow automation.
|
|
155
|
+
|
|
156
|
+
**Endpoints:**
|
|
157
|
+
```
|
|
158
|
+
GET /.netlify/functions/pipelines (list)
|
|
159
|
+
GET /.netlify/functions/pipelines?action=by-trigger&trigger_type={type}
|
|
160
|
+
GET /.netlify/functions/pipelines?action=executions&pipeline_id={id}
|
|
161
|
+
GET /.netlify/functions/pipelines?id={uuid} (get)
|
|
162
|
+
POST /.netlify/functions/pipelines (create)
|
|
163
|
+
POST /.netlify/functions/pipelines?action=toggle&id={uuid} (toggle active)
|
|
164
|
+
PATCH /.netlify/functions/pipelines?id={uuid} (update)
|
|
165
|
+
DELETE /.netlify/functions/pipelines?id={uuid} (remove - hard delete)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Request Body:**
|
|
169
|
+
```json
|
|
170
|
+
{
|
|
171
|
+
"name": "Ticket Workflow",
|
|
172
|
+
"trigger_type": "item_created",
|
|
173
|
+
"stages": [
|
|
174
|
+
{ "name": "validate", "action": "validate_schema" },
|
|
175
|
+
{ "name": "notify", "action": "send_notification" }
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**How to Test:**
|
|
181
|
+
```bash
|
|
182
|
+
curl -H "Cookie: sb-access-token=..." \
|
|
183
|
+
/.netlify/functions/pipelines?action=by-trigger&trigger_type=item_created
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
### 5. Triggers API (`triggers.ts`)
|
|
189
|
+
|
|
190
|
+
**Purpose:** CRUD for trigger definitions — event-to-pipeline bindings.
|
|
191
|
+
|
|
192
|
+
**Endpoints:**
|
|
193
|
+
```
|
|
194
|
+
GET /.netlify/functions/triggers (list)
|
|
195
|
+
GET /.netlify/functions/triggers?action=by-event&event_type={type}
|
|
196
|
+
GET /.netlify/functions/triggers?action=executions&trigger_id={id}
|
|
197
|
+
GET /.netlify/functions/triggers?id={uuid} (get)
|
|
198
|
+
POST /.netlify/functions/triggers (create)
|
|
199
|
+
POST /.netlify/functions/triggers?action=toggle&id={uuid} (toggle)
|
|
200
|
+
PATCH /.netlify/functions/triggers?id={uuid} (update)
|
|
201
|
+
DELETE /.netlify/functions/triggers?id={uuid} (remove - soft delete)
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Request Body:**
|
|
205
|
+
```json
|
|
206
|
+
{
|
|
207
|
+
"name": "On Ticket Created",
|
|
208
|
+
"trigger_type": "event",
|
|
209
|
+
"event_type": "item.created",
|
|
210
|
+
"pipeline_id": "uuid-of-pipeline",
|
|
211
|
+
"config": { "conditions": [] }
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
**How to Test:**
|
|
216
|
+
```bash
|
|
217
|
+
curl -H "Cookie: sb-access-token=..." \
|
|
218
|
+
/.netlify/functions/triggers?action=by-event&event_type=item.created
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
### 6. Timers API (`timers.ts`)
|
|
224
|
+
|
|
225
|
+
**Purpose:** CRUD for timer definitions — scheduled execution triggers.
|
|
226
|
+
|
|
227
|
+
**Endpoints:**
|
|
228
|
+
```
|
|
229
|
+
GET /.netlify/functions/timers (list)
|
|
230
|
+
GET /.netlify/functions/timers?id={uuid} (get)
|
|
231
|
+
POST /.netlify/functions/timers (create)
|
|
232
|
+
PATCH /.netlify/functions/timers?id={uuid} (update)
|
|
233
|
+
DELETE /.netlify/functions/timers?id={uuid} (remove)
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**Request Body:**
|
|
237
|
+
```json
|
|
238
|
+
{
|
|
239
|
+
"name": "Daily Report",
|
|
240
|
+
"timer_type": "cron",
|
|
241
|
+
"config": { "cron": "0 9 * * *" },
|
|
242
|
+
"pipeline_id": "uuid-of-pipeline"
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
### 7. AI Agents API (`ai-agents.ts`)
|
|
249
|
+
|
|
250
|
+
**Purpose:** CRUD for AI agent configurations — LLM-powered automation entities.
|
|
251
|
+
|
|
252
|
+
**Endpoints:**
|
|
253
|
+
```
|
|
254
|
+
GET /.netlify/functions/ai-agents (list)
|
|
255
|
+
GET /.netlify/functions/ai-agents?id={uuid} (get)
|
|
256
|
+
POST /.netlify/functions/ai-agents (create)
|
|
257
|
+
POST /.netlify/functions/ai-agents?action=run&id={uuid} (run inference)
|
|
258
|
+
PATCH /.netlify/functions/ai-agents?id={uuid} (update)
|
|
259
|
+
DELETE /.netlify/functions/ai-agents?id={uuid} (remove)
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
**Request Body:**
|
|
263
|
+
```json
|
|
264
|
+
{
|
|
265
|
+
"name": "Support Bot",
|
|
266
|
+
"agent_type": "conversational",
|
|
267
|
+
"model_config": { "model": "gpt-4", "temperature": 0.7 },
|
|
268
|
+
"system_prompt": "You are a helpful support agent...",
|
|
269
|
+
"tools": ["search_knowledge", "create_ticket"]
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
### 8. Prompt Configs API (`prompt-configs.ts`)
|
|
276
|
+
|
|
277
|
+
**Purpose:** CRUD for prompt template configurations.
|
|
278
|
+
|
|
279
|
+
**Endpoints:**
|
|
280
|
+
```
|
|
281
|
+
GET /.netlify/functions/prompt-configs (list)
|
|
282
|
+
GET /.netlify/functions/prompt-configs?id={uuid} (get)
|
|
283
|
+
POST /.netlify/functions/prompt-configs (create)
|
|
284
|
+
PATCH /.netlify/functions/prompt-configs?id={uuid} (update)
|
|
285
|
+
DELETE /.netlify/functions/prompt-configs?id={uuid} (remove)
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**Request Body:**
|
|
289
|
+
```json
|
|
290
|
+
{
|
|
291
|
+
"name": "Ticket Summary",
|
|
292
|
+
"slug": "ticket-summary",
|
|
293
|
+
"system_prompt": "Summarize this ticket...",
|
|
294
|
+
"model": "gpt-4",
|
|
295
|
+
"temperature": 0.5
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
### 9. Integrations API (`integrations.ts`)
|
|
302
|
+
|
|
303
|
+
**Purpose:** CRUD for integration definitions — external service connections.
|
|
304
|
+
|
|
305
|
+
**Endpoints:**
|
|
306
|
+
```
|
|
307
|
+
GET /.netlify/functions/integrations (list)
|
|
308
|
+
GET /.netlify/functions/integrations?id={uuid} (get)
|
|
309
|
+
POST /.netlify/functions/integrations (create)
|
|
310
|
+
POST /.netlify/functions/integrations?action=test&id={uuid} (test connection)
|
|
311
|
+
PATCH /.netlify/functions/integrations?id={uuid} (update)
|
|
312
|
+
DELETE /.netlify/functions/integrations?id={uuid} (remove)
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
**Request Body:**
|
|
316
|
+
```json
|
|
317
|
+
{
|
|
318
|
+
"name": "Slack Connection",
|
|
319
|
+
"integration_type": "slack",
|
|
320
|
+
"provider": "slack",
|
|
321
|
+
"config": { "workspace": "my-workspace" },
|
|
322
|
+
"credentials": { "bot_token": "xoxb-..." }
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
### 10. API Keys API (`api-keys.ts`)
|
|
329
|
+
|
|
330
|
+
**Purpose:** CRUD for API key management — machine principal credentials.
|
|
331
|
+
|
|
332
|
+
**Endpoints:**
|
|
333
|
+
```
|
|
334
|
+
GET /.netlify/functions/api-keys (list)
|
|
335
|
+
GET /.netlify/functions/api-keys?id={uuid} (get)
|
|
336
|
+
POST /.netlify/functions/api-keys (create)
|
|
337
|
+
POST /.netlify/functions/api-keys?action=rotate&id={uuid} (rotate key)
|
|
338
|
+
PATCH /.netlify/functions/api-keys?id={uuid} (update)
|
|
339
|
+
DELETE /.netlify/functions/api-keys?id={uuid} (revoke)
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
**Request Body:**
|
|
343
|
+
```json
|
|
344
|
+
{
|
|
345
|
+
"name": "Service Account",
|
|
346
|
+
"key_type": "service",
|
|
347
|
+
"permissions": ["read", "write"],
|
|
348
|
+
"scopes": ["items:read", "items:write"]
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## Runtime APIs
|
|
355
|
+
|
|
356
|
+
These endpoints manage application-generated data. Full CRUD available to apps via RLS-scoped access.
|
|
357
|
+
|
|
358
|
+
### 11. Admin Data API (`admin-data.ts`)
|
|
359
|
+
|
|
360
|
+
**Purpose:** Generic CRUD for all runtime entities. Single endpoint covers 9 entity types.
|
|
361
|
+
|
|
362
|
+
**Endpoints:**
|
|
363
|
+
```
|
|
364
|
+
GET /.netlify/functions/admin-data?entity={type} (list)
|
|
365
|
+
GET /.netlify/functions/admin-data?entity={type}&id={uuid} (get)
|
|
366
|
+
POST /.netlify/functions/admin-data?entity={type} (create)
|
|
367
|
+
PATCH /.netlify/functions/admin-data?entity={type}&id={uuid} (update)
|
|
368
|
+
DELETE /.netlify/functions/admin-data?entity={type}&id={uuid} (remove)
|
|
369
|
+
GET /.netlify/functions/admin-data?entity={type}&action=stats (stats)
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
**Valid Entity Types:** `accounts`, `people`, `items`, `threads`, `messages`, `links`, `attachments`, `watchers`, `item_progress`
|
|
373
|
+
|
|
374
|
+
**Query Parameters:**
|
|
375
|
+
- `search` — text search in entity's display field
|
|
376
|
+
- `sort_field`, `sort_direction` — ordering
|
|
377
|
+
- `limit`, `offset` — pagination
|
|
378
|
+
- `type_slug` — filter items by type
|
|
379
|
+
- `view` — resolve view config from type schema
|
|
380
|
+
|
|
381
|
+
**Request Body (Create/Update):**
|
|
382
|
+
```json
|
|
383
|
+
{
|
|
384
|
+
"type_id": "uuid-of-type",
|
|
385
|
+
"title": "My Item",
|
|
386
|
+
"data": { "custom_field": "value" }
|
|
387
|
+
}
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
**Expected Output:**
|
|
391
|
+
```json
|
|
392
|
+
{
|
|
393
|
+
"id": "uuid",
|
|
394
|
+
"type_id": "uuid",
|
|
395
|
+
"title": "My Item",
|
|
396
|
+
"data": { "custom_field": "value" },
|
|
397
|
+
"design_schema": { ... },
|
|
398
|
+
"created_at": "2024-01-01T00:00:00Z"
|
|
399
|
+
}
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
**How to Test:**
|
|
403
|
+
```bash
|
|
404
|
+
# List items of type "support_ticket"
|
|
405
|
+
curl -H "Cookie: sb-access-token=..." \
|
|
406
|
+
"/.netlify/functions/admin-data?entity=items&type_slug=support_ticket"
|
|
407
|
+
|
|
408
|
+
# Create item
|
|
409
|
+
curl -X POST \
|
|
410
|
+
-H "Cookie: sb-access-token=..." \
|
|
411
|
+
-H "Content-Type: application/json" \
|
|
412
|
+
-d '{"type_id":"uuid","title":"New Ticket","data":{"priority":"high"}}' \
|
|
413
|
+
"/.netlify/functions/admin-data?entity=items"
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
---
|
|
417
|
+
|
|
418
|
+
### 12. Item Progress API (`item-progress.ts`)
|
|
419
|
+
|
|
420
|
+
**Purpose:** CRUD + upsert for per-person, per-item progress tracking.
|
|
421
|
+
|
|
422
|
+
**Endpoints:**
|
|
423
|
+
```
|
|
424
|
+
GET /.netlify/functions/item-progress (list)
|
|
425
|
+
GET /.netlify/functions/item-progress?id={uuid} (get)
|
|
426
|
+
POST /.netlify/functions/item-progress (create)
|
|
427
|
+
PATCH /.netlify/functions/item-progress?id={uuid} (update)
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
**Query Parameters:**
|
|
431
|
+
- `person_id` — filter by person
|
|
432
|
+
- `item_id` — filter by item
|
|
433
|
+
- `item_ids` — comma-separated list of items
|
|
434
|
+
- `status` — filter by status
|
|
435
|
+
|
|
436
|
+
**Request Body:**
|
|
437
|
+
```json
|
|
438
|
+
{
|
|
439
|
+
"person_id": "uuid",
|
|
440
|
+
"item_id": "uuid",
|
|
441
|
+
"type_id": "uuid",
|
|
442
|
+
"status": "in_progress",
|
|
443
|
+
"score": 75
|
|
444
|
+
}
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
### 13. Pipeline Executions API (`pipeline-executions.ts`)
|
|
450
|
+
|
|
451
|
+
**Purpose:** Lifecycle management for pipeline run records.
|
|
452
|
+
|
|
453
|
+
**Endpoints:**
|
|
454
|
+
```
|
|
455
|
+
GET /.netlify/functions/pipeline-executions (list)
|
|
456
|
+
GET /.netlify/functions/pipeline-executions?action=running (active runs)
|
|
457
|
+
GET /.netlify/functions/pipeline-executions?action=stats (statistics)
|
|
458
|
+
GET /.netlify/functions/pipeline-executions?id={uuid} (get)
|
|
459
|
+
POST /.netlify/functions/pipeline-executions (create)
|
|
460
|
+
PATCH /.netlify/functions/pipeline-executions?action=start&id={uuid}
|
|
461
|
+
PATCH /.netlify/functions/pipeline-executions?action=complete&id={uuid}
|
|
462
|
+
PATCH /.netlify/functions/pipeline-executions?action=cancel&id={uuid}
|
|
463
|
+
POST /.netlify/functions/pipeline-executions?action=cleanup (cleanup old)
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
**Status FSM:** `pending` → `running` → `completed` | `failed` | `cancelled`
|
|
467
|
+
|
|
468
|
+
**Query Parameters:**
|
|
469
|
+
- `pipeline_id` — filter by parent pipeline
|
|
470
|
+
- `status` — filter by execution status
|
|
471
|
+
|
|
472
|
+
**How to Test:**
|
|
473
|
+
```bash
|
|
474
|
+
curl -H "Cookie: sb-access-token=..." \
|
|
475
|
+
"/.netlify/functions/pipeline-executions?pipeline_id={uuid}&status=running"
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
### 14. Embeddings API (`embeddings.ts`)
|
|
481
|
+
|
|
482
|
+
**Purpose:** CRUD and vector similarity search for embedding records.
|
|
483
|
+
|
|
484
|
+
**Endpoints:**
|
|
485
|
+
```
|
|
486
|
+
GET /.netlify/functions/embeddings (list)
|
|
487
|
+
GET /.netlify/functions/embeddings?id={uuid} (get)
|
|
488
|
+
POST /.netlify/functions/embeddings (create)
|
|
489
|
+
POST /.netlify/functions/embeddings?action=batch-create (batch insert)
|
|
490
|
+
POST /.netlify/functions/embeddings?action=delete-document (bulk delete)
|
|
491
|
+
POST /.netlify/functions/embeddings?action=search-similar (vector search)
|
|
492
|
+
POST /.netlify/functions/embeddings?action=search-semantic (text search)
|
|
493
|
+
POST /.netlify/functions/embeddings?action=cleanup (cleanup old)
|
|
494
|
+
GET /.netlify/functions/embeddings?action=stats (statistics)
|
|
495
|
+
PATCH /.netlify/functions/embeddings?id={uuid} (update)
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
**Query Parameters:**
|
|
499
|
+
- `model_id` — filter by embedding model
|
|
500
|
+
- `document_id` — filter by source document
|
|
501
|
+
|
|
502
|
+
**Request Body (Search):**
|
|
503
|
+
```json
|
|
504
|
+
{
|
|
505
|
+
"query_embedding": [0.1, 0.2, ...], // 1536-dim vector
|
|
506
|
+
"limit": 10,
|
|
507
|
+
"threshold": 0.8
|
|
508
|
+
}
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
**How to Test:**
|
|
512
|
+
```bash
|
|
513
|
+
# Search similar embeddings
|
|
514
|
+
curl -X POST \
|
|
515
|
+
-H "Cookie: sb-access-token=..." \
|
|
516
|
+
-H "Content-Type: application/json" \
|
|
517
|
+
-d '{"query_embedding":[...],"limit":5}' \
|
|
518
|
+
/.netlify/functions/embeddings?action=search-similar
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
---
|
|
522
|
+
|
|
523
|
+
### 15. Logs API (`logs.ts`)
|
|
524
|
+
|
|
525
|
+
**Purpose:** Read API for system logs plus write endpoint for external ingestion.
|
|
526
|
+
|
|
527
|
+
**Endpoints:**
|
|
528
|
+
```
|
|
529
|
+
GET /.netlify/functions/logs?action=account (list by account)
|
|
530
|
+
GET /.netlify/functions/logs?action=target (list by target entity)
|
|
531
|
+
GET /.netlify/functions/logs?action=person (list by person)
|
|
532
|
+
GET /.netlify/functions/logs?action=stats (statistics)
|
|
533
|
+
GET /.netlify/functions/logs?action=search (search with filters)
|
|
534
|
+
POST /.netlify/functions/logs?action=cleanup (cleanup old logs - admin)
|
|
535
|
+
POST /.netlify/functions/logs (ingest external log)
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
**Query Parameters:**
|
|
539
|
+
- `event_type` — filter by event type
|
|
540
|
+
- `target_type`, `target_id` — filter by target entity
|
|
541
|
+
- `date_from`, `date_to` — date range
|
|
542
|
+
- `limit`, `offset` — pagination
|
|
543
|
+
|
|
544
|
+
**Request Body (Ingest):**
|
|
545
|
+
```json
|
|
546
|
+
{
|
|
547
|
+
"level": "error",
|
|
548
|
+
"message": "Something went wrong",
|
|
549
|
+
"context": { "error_code": "E123" }
|
|
550
|
+
}
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
**How to Test:**
|
|
554
|
+
```bash
|
|
555
|
+
curl -H "Cookie: sb-access-token=..." \
|
|
556
|
+
"/.netlify/functions/logs?action=account&event_type=item.created&date_from=2024-01-01"
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
---
|
|
560
|
+
|
|
561
|
+
## System APIs
|
|
562
|
+
|
|
563
|
+
### 16. Auth API (`auth.ts`)
|
|
564
|
+
|
|
565
|
+
**Purpose:** Returns authenticated user context including account hierarchy.
|
|
566
|
+
|
|
567
|
+
**Endpoints:**
|
|
568
|
+
```
|
|
569
|
+
GET /.netlify/functions/auth (get context)
|
|
570
|
+
GET /.netlify/functions/auth?action=health (health check - unauthenticated)
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
**Expected Output:**
|
|
574
|
+
```json
|
|
575
|
+
{
|
|
576
|
+
"id": "person-uuid",
|
|
577
|
+
"email": "user@example.com",
|
|
578
|
+
"full_name": "John Doe",
|
|
579
|
+
"account_id": "account-uuid",
|
|
580
|
+
"account": {
|
|
581
|
+
"id": "account-uuid",
|
|
582
|
+
"slug": "my-org",
|
|
583
|
+
"display_name": "My Organization"
|
|
584
|
+
},
|
|
585
|
+
"roles": ["admin"],
|
|
586
|
+
"permissions": ["read", "write", "admin"],
|
|
587
|
+
"accessible_accounts": [
|
|
588
|
+
{ "id": "child-uuid", "slug": "child", "display_name": "Child Account" }
|
|
589
|
+
]
|
|
590
|
+
}
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
**How to Test:**
|
|
594
|
+
```bash
|
|
595
|
+
curl -H "Cookie: sb-access-token=..." \
|
|
596
|
+
/.netlify/functions/auth
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
---
|
|
600
|
+
|
|
601
|
+
### 17. System API (`system.ts`)
|
|
602
|
+
|
|
603
|
+
**Purpose:** System health and administrative operations.
|
|
604
|
+
|
|
605
|
+
**Endpoints:**
|
|
606
|
+
```
|
|
607
|
+
GET /.netlify/functions/system?action=health (health check)
|
|
608
|
+
GET /.netlify/functions/system?action=version (version info)
|
|
609
|
+
GET /.netlify/functions/system?action=status (system status)
|
|
610
|
+
POST /.netlify/functions/system?action=ping (ping test)
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
**How to Test:**
|
|
614
|
+
```bash
|
|
615
|
+
curl /.netlify/functions/system?action=health
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
---
|
|
619
|
+
|
|
620
|
+
### 18. Observability API (`observability.ts`)
|
|
621
|
+
|
|
622
|
+
**Purpose:** Aggregated metrics and analytics over logs.
|
|
623
|
+
|
|
624
|
+
**Endpoints:**
|
|
625
|
+
```
|
|
626
|
+
GET /.netlify/functions/observability?action=event_volume&from={ISO}&to={ISO}&bucket=hour
|
|
627
|
+
GET /.netlify/functions/observability?action=error_rate&from={ISO}&to={ISO}
|
|
628
|
+
GET /.netlify/functions/observability?action=latency_percentiles&from={ISO}&to={ISO}
|
|
629
|
+
GET /.netlify/functions/observability?action=pipeline_stats&from={ISO}&to={ISO}
|
|
630
|
+
GET /.netlify/functions/observability?action=top_actors&from={ISO}&to={ISO}
|
|
631
|
+
POST /.netlify/functions/observability?action=cleanup (cleanup old - admin)
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
**Query Parameters:**
|
|
635
|
+
- `from`, `to` — required date range (ISO 8601)
|
|
636
|
+
- `bucket` — time bucket size (minute, hour, day)
|
|
637
|
+
|
|
638
|
+
**Expected Output (event_volume):**
|
|
639
|
+
```json
|
|
640
|
+
[
|
|
641
|
+
{ "bucket_time": "2024-01-01T00:00:00Z", "event_type": "item.created", "count": 42 },
|
|
642
|
+
{ "bucket_time": "2024-01-01T01:00:00Z", "event_type": "item.created", "count": 38 }
|
|
643
|
+
]
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
**How to Test:**
|
|
647
|
+
```bash
|
|
648
|
+
curl -H "Cookie: sb-access-token=..." \
|
|
649
|
+
"/.netlify/functions/observability?action=event_volume&from=2024-01-01T00:00:00Z&to=2024-01-02T00:00:00Z&bucket=hour"
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
---
|
|
653
|
+
|
|
654
|
+
### 19. Tests API (`tests.ts`)
|
|
655
|
+
|
|
656
|
+
**Purpose:** Test run management and execution history.
|
|
657
|
+
|
|
658
|
+
**Endpoints:**
|
|
659
|
+
```
|
|
660
|
+
GET /.netlify/functions/tests (list test runs)
|
|
661
|
+
GET /.netlify/functions/tests?id={uuid} (get test run)
|
|
662
|
+
POST /.netlify/functions/tests (create test run)
|
|
663
|
+
PATCH /.netlify/functions/tests?id={uuid} (update test run)
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
**How to Test:**
|
|
667
|
+
```bash
|
|
668
|
+
curl -H "Cookie: sb-access-token=..." \
|
|
669
|
+
/.netlify/functions/tests
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
---
|
|
673
|
+
|
|
674
|
+
### 20. System Cron API (`system-cron.ts`)
|
|
675
|
+
|
|
676
|
+
**Purpose:** Cron job management and threshold-based alerting.
|
|
677
|
+
|
|
678
|
+
**Endpoints:**
|
|
679
|
+
```
|
|
680
|
+
GET /.netlify/functions/system-cron?action=list (list jobs)
|
|
681
|
+
GET /.netlify/functions/system-cron?action=get&id={uuid} (get job)
|
|
682
|
+
POST /.netlify/functions/system-cron (create job)
|
|
683
|
+
PATCH /.netlify/functions/system-cron?id={uuid} (update job)
|
|
684
|
+
DELETE /.netlify/functions/system-cron?id={uuid} (delete job)
|
|
685
|
+
POST /.netlify/functions/system-cron?action=run&id={uuid} (trigger now)
|
|
686
|
+
POST /.netlify/functions/system-cron?action=evaluate (evaluate thresholds)
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
**How to Test:**
|
|
690
|
+
```bash
|
|
691
|
+
curl -H "Cookie: sb-access-token=..." \
|
|
692
|
+
/.netlify/functions/system-cron?action=list
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
---
|
|
696
|
+
|
|
697
|
+
### 21. Account Nodes API (`account-nodes.ts`)
|
|
698
|
+
|
|
699
|
+
**Purpose:** Account hierarchy node management.
|
|
700
|
+
|
|
701
|
+
**Endpoints:**
|
|
702
|
+
```
|
|
703
|
+
GET /.netlify/functions/account-nodes (list nodes)
|
|
704
|
+
GET /.netlify/functions/account-nodes?id={uuid} (get node)
|
|
705
|
+
POST /.netlify/functions/account-nodes (create node)
|
|
706
|
+
PATCH /.netlify/functions/account-nodes?id={uuid} (update node)
|
|
707
|
+
DELETE /.netlify/functions/account-nodes?id={uuid} (delete node)
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
**How to Test:**
|
|
711
|
+
```bash
|
|
712
|
+
curl -H "Cookie: sb-access-token=..." \
|
|
713
|
+
/.netlify/functions/account-nodes
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
---
|
|
717
|
+
|
|
718
|
+
## Integration Routes API
|
|
719
|
+
|
|
720
|
+
### 22. Integration Routes API (`integration-routes.ts`)
|
|
721
|
+
|
|
722
|
+
**Purpose:** Dynamic routing and handler dispatch for integration webhook endpoints.
|
|
723
|
+
|
|
724
|
+
**Endpoints:**
|
|
725
|
+
```
|
|
726
|
+
GET /.netlify/functions/integration-routes (list routes)
|
|
727
|
+
GET /.netlify/functions/integration-routes?id={uuid} (get route)
|
|
728
|
+
POST /.netlify/functions/integration-routes (create route)
|
|
729
|
+
POST /.netlify/functions/integration-routes?action=invoke&id={uuid} (invoke handler)
|
|
730
|
+
PATCH /.netlify/functions/integration-routes?id={uuid} (update route)
|
|
731
|
+
DELETE /.netlify/functions/integration-routes?id={uuid} (remove route)
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
**How to Test:**
|
|
735
|
+
```bash
|
|
736
|
+
curl -H "Cookie: sb-access-token=..." \
|
|
737
|
+
/.netlify/functions/integration-routes
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
---
|
|
741
|
+
|
|
742
|
+
## Common Patterns
|
|
743
|
+
|
|
744
|
+
### Authentication
|
|
745
|
+
All endpoints (except health checks) require a valid Supabase Auth session. The `createHandler` middleware:
|
|
746
|
+
1. Extracts JWT from `sb-access-token` cookie
|
|
747
|
+
2. Validates and decodes the token
|
|
748
|
+
3. Builds `ctx.principal` with user identity
|
|
749
|
+
4. Creates `ctx.db` — an RLS-scoped Supabase client
|
|
750
|
+
|
|
751
|
+
### Error Responses
|
|
752
|
+
All errors follow this shape:
|
|
753
|
+
```json
|
|
754
|
+
{
|
|
755
|
+
"error": "Human-readable error message",
|
|
756
|
+
"statusCode": 400
|
|
757
|
+
}
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
### Pagination
|
|
761
|
+
List endpoints support:
|
|
762
|
+
- `limit` — max results (default varies: 50-100)
|
|
763
|
+
- `offset` — skip N results (default: 0)
|
|
764
|
+
|
|
765
|
+
### Response Format
|
|
766
|
+
Success responses return either:
|
|
767
|
+
- Single object for `get`, `create`, `update`
|
|
768
|
+
- Array for `list`
|
|
769
|
+
- Stats/metrics object for analytics endpoints
|
|
770
|
+
|
|
771
|
+
### Testing via CLI
|
|
772
|
+
Use the `spine` CLI for testing without browser cookies:
|
|
773
|
+
```bash
|
|
774
|
+
# The CLI uses service_role key internally
|
|
775
|
+
npx spine-framework items list --type support_ticket
|
|
776
|
+
npx spine-framework items get <uuid>
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
---
|
|
780
|
+
|
|
781
|
+
## Missing Runtime APIs (Not Yet Implemented)
|
|
782
|
+
|
|
783
|
+
The following runtime tables currently have **no API coverage**:
|
|
784
|
+
|
|
785
|
+
| Table | Status |
|
|
786
|
+
|-------|--------|
|
|
787
|
+
| `trigger_executions` | ❌ No API — planned for trigger-monitoring.ts |
|
|
788
|
+
| `schedule_executions` | ❌ No API — planned for schedule-monitoring.ts |
|
|
789
|
+
| `api_key_usage_logs` | ❌ No API — extend logs.ts or new api-usage.ts |
|
|
790
|
+
|
|
791
|
+
---
|
|
792
|
+
|
|
793
|
+
## Summary Table
|
|
794
|
+
|
|
795
|
+
| Endpoint | Config/Runtime | Purpose | Auth Required |
|
|
796
|
+
|----------|---------------|---------|---------------|
|
|
797
|
+
| `types` | Config | Schema definitions | Read: Any, Write: Admin |
|
|
798
|
+
| `apps` | Config | App definitions | Read: Any, Write: Admin |
|
|
799
|
+
| `roles` | Config | Role definitions | Read: Any, Write: Admin |
|
|
800
|
+
| `pipelines` | Config | Workflow definitions | Read: Any, Write: Auth |
|
|
801
|
+
| `triggers` | Config | Event bindings | Read: Any, Write: Auth |
|
|
802
|
+
| `timers` | Config | Scheduled triggers | Read: Any, Write: Auth |
|
|
803
|
+
| `ai-agents` | Config | AI configurations | Read: Any, Write: Auth |
|
|
804
|
+
| `prompt-configs` | Config | Prompt templates | Read: Any, Write: Auth |
|
|
805
|
+
| `integrations` | Config | External services | Read: Any, Write: Auth |
|
|
806
|
+
| `api-keys` | Config | Machine credentials | Read: Any, Write: Auth |
|
|
807
|
+
| `admin-data` | Runtime | Generic CRUD for 9 entities | Auth + RLS |
|
|
808
|
+
| `item-progress` | Runtime | Progress tracking | Auth + RLS |
|
|
809
|
+
| `pipeline-executions` | Runtime | Pipeline run logs | Auth + RLS |
|
|
810
|
+
| `embeddings` | Runtime | Vector storage/search | Auth + RLS |
|
|
811
|
+
| `logs` | Runtime | System audit logs | Auth + RLS |
|
|
812
|
+
| `observability` | Runtime | Metrics/analytics | Auth + RLS |
|
|
813
|
+
| `auth` | System | Session context | Auth |
|
|
814
|
+
| `system` | System | Health/status | Varies |
|
|
815
|
+
| `tests` | System | Test management | Auth |
|
|
816
|
+
| `system-cron` | System | Cron jobs | Auth |
|
|
817
|
+
| `account-nodes` | System | Hierarchy nodes | Auth + RLS |
|
|
818
|
+
| `integration-routes` | System | Webhook routing | Auth |
|
|
819
|
+
|
|
820
|
+
---
|
|
821
|
+
|
|
822
|
+
*Generated from v2-core source analysis. Last updated: 2026-05-26*
|