oneie 3.6.7 → 3.6.12
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/.claude/agents/agent-backend.md +83 -0
- package/.claude/agents/agent-designer.md +97 -0
- package/.claude/agents/agent-director.md +118 -7
- package/.claude/agents/agent-documenter.md +93 -0
- package/.claude/agents/agent-frontend.md +96 -0
- package/.claude/agents/agent-ops.md +264 -32
- package/.claude/agents/agent-problem-solver.md +166 -0
- package/.claude/agents/agent-quality.md +127 -0
- package/.claude/commands/build.md +293 -0
- package/.claude/commands/cascade.md +231 -127
- package/.claude/commands/deploy.md +56 -17
- package/.claude/commands/mcp-toggle.md +93 -0
- package/.claude/commands/one.md +78 -127
- package/.claude/commands/plan.md +394 -80
- package/.claude/commands/push.md +75 -14
- package/.claude/commands/release.md +89 -25
- package/.claude/commands/server.md +2 -0
- package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
- package/.claude/hooks/root-cleanup.py +75 -0
- package/.claude/skills/INDEX.md +523 -0
- package/.claude/skills/REGISTRY.md +529 -0
- package/.claude/skills/agent-backend-create-mutation.md +319 -0
- package/.claude/skills/agent-designer-create-wireframe.md +341 -0
- package/.claude/skills/agent-frontend-create-page.md +413 -0
- package/.claude/skills/agents/README.md +238 -0
- package/dist/clone-web.js +1 -1
- package/dist/clone-web.js.map +1 -1
- package/folders.yaml +1 -1
- package/one/.obsidian/workspace.json +38 -38
- package/one/connections/api/queries-reference.md +842 -0
- package/one/connections/api-reference.md +1011 -0
- package/one/connections/integration-examples.md +875 -0
- package/one/connections/integration-guide.md +869 -0
- package/one/connections/integration-phase2.md +736 -0
- package/one/events/API_ROUTES_FIXES_SUMMARY.md +262 -0
- package/one/events/ASTRO-INTEGRATION-EXAMPLES.md +636 -0
- package/one/events/BEFORE_AFTER_COMPARISON.md +960 -0
- package/one/events/CONNECTIONS_DEMO.md +501 -0
- package/one/events/DELIVERABLES.md +432 -0
- package/one/events/DEMO-GROUPS-PAGE.md +392 -0
- package/one/events/DEMO-TESTING-SUMMARY.md +518 -0
- package/one/events/DEMO_COMPONENTS.md +487 -0
- package/one/events/DEMO_HOOKS_INDEX.md +334 -0
- package/one/events/DEMO_INFRASTRUCTURE.md +905 -0
- package/one/events/DEMO_INFRASTRUCTURE_SUMMARY.md +570 -0
- package/one/events/DEMO_INTEGRATION_CHECKLIST.md +431 -0
- package/one/events/DEMO_QUICK_REFERENCE.md +441 -0
- package/one/events/DEMO_SETUP.md +476 -0
- package/one/events/EFFECT_TS_API_PATTERN.md +478 -0
- package/one/events/GROUPS_DEMO_IMPLEMENTATION.md +414 -0
- package/one/events/HOOKS-DEMO.md +441 -0
- package/one/events/ONTOLOGY-HOOKS-README.md +700 -0
- package/one/events/ONTOLOGY-INTEGRATION-MANIFEST.md +365 -0
- package/one/events/QA-CHECKLIST.md +674 -0
- package/one/events/QUICK-START-ONTOLOGY.md +408 -0
- package/one/events/SEARCH_DEMO_CODE_REFERENCE.md +639 -0
- package/one/events/SEARCH_DEMO_DELIVERY.md +415 -0
- package/one/events/SEARCH_DEMO_SUMMARY.md +303 -0
- package/one/events/SEARCH_DEMO_VISUAL_GUIDE.md +381 -0
- package/one/events/TEST-PLAN-INDEX.md +346 -0
- package/one/events/TEST-PLAN.md +1417 -0
- package/one/events/TESTING-DELIVERY.txt +372 -0
- package/one/events/TRANSITIONS-QUICK-START.md +141 -0
- package/one/events/TYPESCRIPT_FIXES.md +152 -0
- package/one/events/TYPESCRIPT_FIXES_COMPLETE.txt +412 -0
- package/one/events/TYPESCRIPT_FIXES_INDEX.md +341 -0
- package/one/events/VIEW-TRANSITIONS.md +428 -0
- package/one/events/backend-integration-tests.md +606 -0
- package/one/events/backend-structure-diagram.txt +393 -0
- package/one/events/backend-structure-summary.txt +269 -0
- package/one/events/cloudflare-pages-infrastructure-setup.md +264 -0
- package/one/events/convex-analysis-index.md +304 -0
- package/one/events/convex-structure-analysis.md +700 -0
- package/one/events/design-spec-complete.md +208 -0
- package/one/events/ontology-test-examples.md +562 -0
- package/one/events/phase1-backend-implementation-complete.md +518 -0
- package/one/events/test-dashboard.md +345 -0
- package/one/events/test-index.md +361 -0
- package/one/events/test-report-ontology.md +582 -0
- package/one/events/testing-summary.md +344 -0
- package/one/groups/features.md +2878 -0
- package/one/groups/strategy copy.md +869 -0
- package/one/knowledge/backend-api-reference.md +710 -0
- package/one/knowledge/documentation-summary.md +285 -0
- package/one/knowledge/lessons-learned.md +294 -4
- package/one/knowledge/ontology-visual-guide.md +360 -0
- package/one/knowledge/ontology.md +9 -17
- package/one/things/demo-accessibility-animations.md +999 -0
- package/one/things/demo-components.md +1304 -0
- package/one/things/demo-design-summary.md +629 -0
- package/one/things/demo-design-system.md +919 -0
- package/one/things/demo-page-layouts.md +989 -0
- package/one/things/designs/accessibility-audit.md +790 -0
- package/one/things/designs/component-specifications.md +757 -0
- package/one/things/designs/design-overview.md +318 -0
- package/one/things/designs/design-tokens.md +414 -0
- package/one/things/designs/wireframes-dashboard.md +653 -0
- package/one/things/docs/api-requests.md +923 -0
- package/one/things/features/0 All Features.md +2 -0
- package/one/things/implementation/backend-guide.md +412 -0
- package/one/things/plans/2-backend-agnostic-frontend.md +11 -8
- package/one/things/plans/2-sites.md +895 -0
- package/one/things/plans/ai-elements.md +1259 -0
- package/one/things/plans/ai-integration.md +947 -0
- package/one/things/plans/ai-sdk.md +761 -0
- package/one/things/plans/app.md +1 -1
- package/one/things/plans/architecture-summary.md +283 -0
- package/one/things/plans/async-ai-agents.md +215 -0
- package/one/things/plans/backend-agnostic-frontend.md +11 -6
- package/one/things/plans/backend-cleanup-quickstart.md +346 -0
- package/one/things/plans/backend-ontology-conformance.md +416 -0
- package/one/things/plans/backend-status.md +541 -0
- package/one/things/plans/backend-structure.md +799 -0
- package/one/things/plans/backend-target-structure.md +438 -0
- package/one/things/plans/backend.md +1133 -0
- package/one/things/plans/better-auth-any-backend.md +11 -11
- package/one/things/plans/cli-updates-required.md +280 -0
- package/one/things/plans/complete-step-by-step.md +1302 -0
- package/one/things/plans/convex-agents.md +1005 -0
- package/one/things/plans/deployment-architecture.md +426 -0
- package/one/things/plans/development-plan.md +1220 -0
- package/one/things/plans/effect.md +808 -48
- package/one/things/plans/integrate-frontend-and-backend.md +579 -0
- package/one/things/plans/mcp-clear-context-prompt.md +60 -0
- package/one/things/plans/mcp-simple.md +228 -0
- package/one/things/plans/one.md +8 -7
- package/one/things/plans/ontology-6-dimensions.md +20 -14
- package/one/things/plans/quick-wins.md +1273 -0
- package/one/things/plans/readme-backend-cleanup.md +361 -0
- package/one/things/plans/separate-demo.md +830 -0
- package/one/things/plans/separate.md +3 -3
- package/one/things/plans/sequence.md +1897 -0
- package/one/things/plans/sync-checklist.md +321 -0
- package/one/things/plans/unified-implementation-plan.md +3 -3
- package/one/things/plans/update-demos.md +513 -0
- package/package.json +1 -1
- package/.claude/agents/backend-specialist.md +0 -169
- package/.claude/agents/designer.md +0 -216
- package/.claude/agents/frontend-specialist.md +0 -236
- package/.claude/commands/done.md +0 -35
- package/.claude/commands/infer.md +0 -138
- package/.claude/commands/next.md +0 -53
- package/.claude/commands/one copy.md +0 -565
- package/.claude/commands/one-template.md +0 -106
- package/.claude/commands/one-v1.md +0 -609
- package/.claude/hooks/__pycache__/knowledge-post.cpython-313.pyc +0 -0
- package/.claude/hooks/__pycache__/knowledge-pre.cpython-313.pyc +0 -0
- package/one/groups/nine-padel-customers.md +0 -138
- package/one/groups/nine-padel-data-structure.md +0 -167
- package/one/groups/nine-padel-ontology-specification.md +0 -359
- package/one/groups/nine-padel-ontology.md +0 -143
- package/one/groups/nine-padel-strategy.md +0 -234
- package/one/groups/nine-padel.md +0 -211
- package/one/groups/nine-padle-contents.baked.md +0 -1252
- package/one/groups/nine-padle-contents.md +0 -6
- package/one/things/features/1-1-agent-prompts/design.md +0 -470
- package/one/things/features/1-1-agent-prompts/tests.md +0 -264
- package/one/things/features/1-2-yaml-orchestrator/design.md +0 -497
- package/one/things/features/1-2-yaml-orchestrator/tests.md +0 -227
- package/one/things/features/1-3-event-coordination/design.md +0 -544
- package/one/things/features/1-3-event-coordination/tests.md +0 -223
- package/one/things/features/1-4-knowledge-management/design.md +0 -609
- package/one/things/features/1-4-knowledge-management/tests.md +0 -195
- package/one/things/features/1-5-quality-loops/design.md +0 -797
- package/one/things/features/1-5-quality-loops/tests.md +0 -212
- package/one/things/features/1-6-numbering-structure/design.md +0 -610
- package/one/things/features/1-6-numbering-structure/tests.md +0 -213
- package/one/things/features/dataprovider-interface/1-tests.md +0 -1522
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
# Demo Infrastructure Quick Reference
|
|
2
|
+
|
|
3
|
+
Fast lookup guide for developers using the demo infrastructure.
|
|
4
|
+
|
|
5
|
+
## Import Statements
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
// Configuration
|
|
9
|
+
import { DEMO_NAVIGATION, DEMO_STATISTICS, DEMO_ENDPOINTS } from '@/config/demo';
|
|
10
|
+
|
|
11
|
+
// Types
|
|
12
|
+
import type {
|
|
13
|
+
DemoGroup,
|
|
14
|
+
DemoPerson,
|
|
15
|
+
DemoThing,
|
|
16
|
+
DemoConnection,
|
|
17
|
+
DemoEvent,
|
|
18
|
+
DemoKnowledge,
|
|
19
|
+
DemoApiResponse,
|
|
20
|
+
PaginatedResponse,
|
|
21
|
+
DemoError,
|
|
22
|
+
HealthCheckResult,
|
|
23
|
+
LoadingState,
|
|
24
|
+
} from '@/types/demo';
|
|
25
|
+
|
|
26
|
+
// API Client
|
|
27
|
+
import { getDemoApiClient, getDimensionData, getDemoStatistics } from '@/lib/demo-api';
|
|
28
|
+
|
|
29
|
+
// Error Handling
|
|
30
|
+
import {
|
|
31
|
+
DemoErrorHandler,
|
|
32
|
+
parseHttpError,
|
|
33
|
+
parseNetworkError,
|
|
34
|
+
getRecoveryAction,
|
|
35
|
+
isRetryable,
|
|
36
|
+
isCritical,
|
|
37
|
+
createErrorMessage,
|
|
38
|
+
createRecoverySuggestions,
|
|
39
|
+
} from '@/lib/demo-errors';
|
|
40
|
+
|
|
41
|
+
// Layout
|
|
42
|
+
import DemoLayout from '@/layouts/DemoLayout.astro';
|
|
43
|
+
|
|
44
|
+
// State Management
|
|
45
|
+
import {
|
|
46
|
+
$demoData,
|
|
47
|
+
$demoLoading,
|
|
48
|
+
$demoErrors,
|
|
49
|
+
updateDemoData,
|
|
50
|
+
setDemoLoading,
|
|
51
|
+
setDemoError,
|
|
52
|
+
} from '@/stores/demo';
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Common Patterns
|
|
56
|
+
|
|
57
|
+
### Create a Demo Page
|
|
58
|
+
|
|
59
|
+
```astro
|
|
60
|
+
---
|
|
61
|
+
import DemoLayout from '@/layouts/DemoLayout.astro';
|
|
62
|
+
import { getDemoApiClient } from '@/lib/demo-api';
|
|
63
|
+
import { createErrorMessage } from '@/lib/demo-errors';
|
|
64
|
+
|
|
65
|
+
let data = [];
|
|
66
|
+
let error = null;
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
const client = getDemoApiClient();
|
|
70
|
+
const response = await client.getPaginated('http/things', { limit: 10 });
|
|
71
|
+
data = response.items;
|
|
72
|
+
} catch (e) {
|
|
73
|
+
error = createErrorMessage(e);
|
|
74
|
+
}
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
<DemoLayout
|
|
78
|
+
title="Things"
|
|
79
|
+
description="All entities"
|
|
80
|
+
dimension="things"
|
|
81
|
+
>
|
|
82
|
+
{error ? <div>{error}</div> : <div>{data.map(d => <div>{d.name}</div>)}</div>}
|
|
83
|
+
</DemoLayout>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Fetch Data
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
// Get single dimension
|
|
90
|
+
const things = await getDimensionData('things');
|
|
91
|
+
|
|
92
|
+
// Get paginated data
|
|
93
|
+
const client = getDemoApiClient();
|
|
94
|
+
const response = await client.getPaginated('http/things', {
|
|
95
|
+
limit: 20,
|
|
96
|
+
offset: 0,
|
|
97
|
+
sort: 'created',
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Get all statistics
|
|
101
|
+
const stats = await getDemoStatistics();
|
|
102
|
+
|
|
103
|
+
// Check backend health
|
|
104
|
+
const health = await client.checkHealth();
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Handle Errors
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
try {
|
|
111
|
+
const data = await client.get('/http/endpoint');
|
|
112
|
+
} catch (error) {
|
|
113
|
+
// Get user-friendly message
|
|
114
|
+
const message = createErrorMessage(error);
|
|
115
|
+
|
|
116
|
+
// Get suggestions
|
|
117
|
+
const suggestions = createRecoverySuggestions(error);
|
|
118
|
+
|
|
119
|
+
// Check if retryable
|
|
120
|
+
if (isRetryable(error)) {
|
|
121
|
+
// Retry logic
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Check if critical
|
|
125
|
+
if (isCritical(error)) {
|
|
126
|
+
// Show support contact
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Use Demo Stores
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
import { $demoData, $demoLoading, updateDemoData, setDemoLoading } from '@/stores/demo';
|
|
135
|
+
|
|
136
|
+
// Get current data
|
|
137
|
+
const data = $demoData.get();
|
|
138
|
+
|
|
139
|
+
// Update data
|
|
140
|
+
updateDemoData('things', newThings);
|
|
141
|
+
|
|
142
|
+
// Set loading state
|
|
143
|
+
setDemoLoading('things', true);
|
|
144
|
+
|
|
145
|
+
// Subscribe to changes (in React)
|
|
146
|
+
import { useStore } from '@nanostores/react';
|
|
147
|
+
|
|
148
|
+
function MyComponent() {
|
|
149
|
+
const data = useStore($demoData);
|
|
150
|
+
return <div>{data.things?.length} things</div>;
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Configuration Constants
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
// Backend & Endpoints
|
|
158
|
+
DEMO_BACKEND_URL // 'https://shocking-falcon-870.convex.cloud'
|
|
159
|
+
DEMO_GROUP_ID // 'kh77jymsq3tmk1gmrwrpp94r7x7spkhw'
|
|
160
|
+
DEMO_ENDPOINTS // { groups, people, things, connections, events, knowledge }
|
|
161
|
+
|
|
162
|
+
// Request Settings
|
|
163
|
+
DEMO_REQUEST_CONFIG // { timeout: 5000, retries: 3, retryDelay: 1000 }
|
|
164
|
+
HEALTH_CHECK_CONFIG // { interval: 30000, timeout: 3000 }
|
|
165
|
+
|
|
166
|
+
// Navigation
|
|
167
|
+
DEMO_NAVIGATION // Array of { title, path, description, dimension }
|
|
168
|
+
|
|
169
|
+
// Statistics
|
|
170
|
+
DEMO_STATISTICS // { linesOfCode, reactHooks, apiEndpoints, ... }
|
|
171
|
+
|
|
172
|
+
// Messages
|
|
173
|
+
DEMO_ERROR_MESSAGES // User-friendly error messages
|
|
174
|
+
DEMO_SUCCESS_MESSAGES // User-friendly success messages
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## API Client Methods
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
const client = getDemoApiClient();
|
|
181
|
+
|
|
182
|
+
// GET request
|
|
183
|
+
const data = await client.get<MyType>('/http/endpoint');
|
|
184
|
+
|
|
185
|
+
// GET with pagination
|
|
186
|
+
const response = await client.getPaginated<MyType>('/http/endpoint', {
|
|
187
|
+
limit: 20,
|
|
188
|
+
offset: 0,
|
|
189
|
+
type: 'filter',
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
// Health check
|
|
193
|
+
const { status, latency } = await client.checkHealth();
|
|
194
|
+
|
|
195
|
+
// Request logs
|
|
196
|
+
const logs = client.getRequestLogs();
|
|
197
|
+
client.clearRequestLogs();
|
|
198
|
+
|
|
199
|
+
// Configuration
|
|
200
|
+
const config = client.getConfig();
|
|
201
|
+
client.updateConfig({ timeout: 10000 });
|
|
202
|
+
|
|
203
|
+
// Available endpoints
|
|
204
|
+
const endpoints = client.getAvailableEndpoints();
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Error Classes
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
// Custom error
|
|
211
|
+
const error = new DemoErrorHandler(
|
|
212
|
+
'NETWORK_ERROR',
|
|
213
|
+
'Failed to connect',
|
|
214
|
+
{ severity: ErrorSeverity.HIGH }
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
// Parse HTTP error
|
|
218
|
+
const httpError = parseHttpError(500, 'Internal Server Error');
|
|
219
|
+
|
|
220
|
+
// Parse network error
|
|
221
|
+
const netError = parseNetworkError(new TypeError('fetch failed'));
|
|
222
|
+
|
|
223
|
+
// Get recovery action
|
|
224
|
+
const recovery = getRecoveryAction(error);
|
|
225
|
+
// { action, message, nextSteps }
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Component Props
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
// DemoLayout props
|
|
232
|
+
interface Props {
|
|
233
|
+
title: string;
|
|
234
|
+
description?: string;
|
|
235
|
+
dimension?: string;
|
|
236
|
+
breadcrumbs?: Array<{
|
|
237
|
+
label: string;
|
|
238
|
+
path?: string;
|
|
239
|
+
current?: boolean;
|
|
240
|
+
}>;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// DemoBreadcrumbs props
|
|
244
|
+
interface Props {
|
|
245
|
+
items: Array<{
|
|
246
|
+
label: string;
|
|
247
|
+
path?: string;
|
|
248
|
+
current?: boolean;
|
|
249
|
+
}>;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// DemoNav props
|
|
253
|
+
interface Props {
|
|
254
|
+
currentPath?: string;
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## File Locations
|
|
259
|
+
|
|
260
|
+
```
|
|
261
|
+
src/config/demo.ts # Configuration
|
|
262
|
+
src/types/demo.ts # Type definitions
|
|
263
|
+
src/lib/demo-api.ts # API client
|
|
264
|
+
src/lib/demo-errors.ts # Error handling
|
|
265
|
+
src/layouts/DemoLayout.astro # Shared layout
|
|
266
|
+
src/components/demo/ # Demo components
|
|
267
|
+
src/stores/demo.ts # Global state
|
|
268
|
+
src/pages/demo/ # Demo pages
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Type Definitions Quick Lookup
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
// Response Types
|
|
275
|
+
DemoApiResponse<T> // { success, data, error, timestamp }
|
|
276
|
+
PaginatedResponse<T> // { items, total, limit, offset, hasMore }
|
|
277
|
+
|
|
278
|
+
// Entity Types
|
|
279
|
+
DemoGroup // { _id, name, type, parentGroupId, ... }
|
|
280
|
+
DemoPerson // { _id, name, email, role, ... }
|
|
281
|
+
DemoThing // { _id, type, name, properties, ... }
|
|
282
|
+
DemoConnection // { _id, fromThingId, toThingId, ... }
|
|
283
|
+
DemoEvent // { _id, type, actorId, targetId, ... }
|
|
284
|
+
DemoKnowledge // { _id, knowledgeType, text, embedding, ... }
|
|
285
|
+
|
|
286
|
+
// Query Types
|
|
287
|
+
DemoListQuery // { limit, offset, type, sort, order }
|
|
288
|
+
DemoSearchQuery // { search, filters, ... + DemoListQuery }
|
|
289
|
+
|
|
290
|
+
// System Types
|
|
291
|
+
HealthCheckResult // { status, backend, database, api }
|
|
292
|
+
DemoError // { code, message, details, timestamp, recoverable }
|
|
293
|
+
LoadingState<T> // { isLoading, isError, error, data, dataUpdatedAt }
|
|
294
|
+
DemoLoadingState // LoadingState for each dimension
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
## Common Tasks
|
|
298
|
+
|
|
299
|
+
### Task: Fetch all things
|
|
300
|
+
```typescript
|
|
301
|
+
const client = getDemoApiClient();
|
|
302
|
+
const things = await getDimensionData('things');
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Task: Get things with pagination
|
|
306
|
+
```typescript
|
|
307
|
+
const client = getDemoApiClient();
|
|
308
|
+
const response = await client.getPaginated('http/things', {
|
|
309
|
+
limit: 50,
|
|
310
|
+
offset: 0,
|
|
311
|
+
});
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Task: Get system statistics
|
|
315
|
+
```typescript
|
|
316
|
+
const stats = await getDemoStatistics();
|
|
317
|
+
console.log(`Groups: ${stats.groups.count}`);
|
|
318
|
+
console.log(`Things: ${stats.things.count}`);
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Task: Check if backend is available
|
|
322
|
+
```typescript
|
|
323
|
+
const client = getDemoApiClient();
|
|
324
|
+
const health = await client.checkHealth();
|
|
325
|
+
if (health.status === 'online') {
|
|
326
|
+
console.log(`Latency: ${health.latency}ms`);
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Task: Handle API errors with recovery
|
|
331
|
+
```typescript
|
|
332
|
+
try {
|
|
333
|
+
const data = await client.get('/http/things');
|
|
334
|
+
} catch (error) {
|
|
335
|
+
const message = createErrorMessage(error);
|
|
336
|
+
const suggestions = createRecoverySuggestions(error);
|
|
337
|
+
console.log(message);
|
|
338
|
+
console.log('Try:', suggestions);
|
|
339
|
+
}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### Task: Create a new dimension page
|
|
343
|
+
```astro
|
|
344
|
+
---
|
|
345
|
+
import DemoLayout from '@/layouts/DemoLayout.astro';
|
|
346
|
+
import { getDemoApiClient } from '@/lib/demo-api';
|
|
347
|
+
|
|
348
|
+
const client = getDemoApiClient();
|
|
349
|
+
const response = await client.getPaginated('http/my-dimension');
|
|
350
|
+
const items = response.items;
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
<DemoLayout title="My Dimension" dimension="custom">
|
|
354
|
+
<!-- Content here -->
|
|
355
|
+
</DemoLayout>
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### Task: Add error handling to a page
|
|
359
|
+
```astro
|
|
360
|
+
---
|
|
361
|
+
import { createErrorMessage, createRecoverySuggestions } from '@/lib/demo-errors';
|
|
362
|
+
|
|
363
|
+
let items = [];
|
|
364
|
+
let error = null;
|
|
365
|
+
|
|
366
|
+
try {
|
|
367
|
+
const client = getDemoApiClient();
|
|
368
|
+
const response = await client.getPaginated('http/things');
|
|
369
|
+
items = response.items;
|
|
370
|
+
} catch (e) {
|
|
371
|
+
error = createErrorMessage(e);
|
|
372
|
+
}
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
<div>
|
|
376
|
+
{error ? (
|
|
377
|
+
<div class="error">
|
|
378
|
+
<p>{error}</p>
|
|
379
|
+
<ul>
|
|
380
|
+
{createRecoverySuggestions(error).map(s => <li>{s}</li>)}
|
|
381
|
+
</ul>
|
|
382
|
+
</div>
|
|
383
|
+
) : (
|
|
384
|
+
<div>{items.map(i => <div>{i.name}</div>)}</div>
|
|
385
|
+
)}
|
|
386
|
+
</div>
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
## Troubleshooting
|
|
390
|
+
|
|
391
|
+
| Issue | Solution |
|
|
392
|
+
|-------|----------|
|
|
393
|
+
| Backend unavailable | This is expected in standalone mode. Use fallback UI. |
|
|
394
|
+
| Request timeout | Check backend URL in `DEMO_BACKEND_URL`. Verify network. |
|
|
395
|
+
| Type errors | Run `bunx astro check`. Check imports. |
|
|
396
|
+
| Navigation not working | Verify paths in `DEMO_NAVIGATION`. Check breadcrumb props. |
|
|
397
|
+
| Styles not applied | Check dark mode classes. Use semantic color names. |
|
|
398
|
+
| Request logging missing | Check `NODE_ENV === 'development'` in console. |
|
|
399
|
+
|
|
400
|
+
## Performance Tips
|
|
401
|
+
|
|
402
|
+
- Use singleton API client (automatically reused)
|
|
403
|
+
- Request logs auto-cleanup after 50 entries
|
|
404
|
+
- Health checks cached (30s interval)
|
|
405
|
+
- Minimize network requests with pagination
|
|
406
|
+
- Cache data in stores to avoid re-fetches
|
|
407
|
+
- Use error recovery for resilience
|
|
408
|
+
|
|
409
|
+
## Security Notes
|
|
410
|
+
|
|
411
|
+
- No sensitive data in frontend code
|
|
412
|
+
- API keys only in `.env.local`
|
|
413
|
+
- Error messages sanitized for users
|
|
414
|
+
- All validation server-side
|
|
415
|
+
- CORS headers configured on backend
|
|
416
|
+
- No PII in request logs
|
|
417
|
+
|
|
418
|
+
## Related Documentation
|
|
419
|
+
|
|
420
|
+
- [DEMO_SETUP.md](./DEMO_SETUP.md) - Complete setup guide
|
|
421
|
+
- [DEMO_INFRASTRUCTURE_SUMMARY.md](./DEMO_INFRASTRUCTURE_SUMMARY.md) - Implementation details
|
|
422
|
+
- [DEMO_INTEGRATION_CHECKLIST.md](./DEMO_INTEGRATION_CHECKLIST.md) - Verification checklist
|
|
423
|
+
- [AGENTS.md](./AGENTS.md) - Convex patterns
|
|
424
|
+
- [CLAUDE.md](./CLAUDE.md) - AI agent instructions
|
|
425
|
+
|
|
426
|
+
## Quick Stats
|
|
427
|
+
|
|
428
|
+
- **Configuration:** 161 lines
|
|
429
|
+
- **Types:** 298 lines
|
|
430
|
+
- **API Client:** 387 lines
|
|
431
|
+
- **Error Handler:** 422 lines
|
|
432
|
+
- **Layout:** 200 lines
|
|
433
|
+
- **Components:** 175 lines
|
|
434
|
+
- **Documentation:** 1,046 lines
|
|
435
|
+
- **Total:** 2,689 lines of code & docs
|
|
436
|
+
|
|
437
|
+
## Version
|
|
438
|
+
|
|
439
|
+
Infrastructure: v1.0.0
|
|
440
|
+
Last Updated: 2025-10-25
|
|
441
|
+
Status: Production Ready
|