oneie 3.7.0 → 3.8.1
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/README.md +9 -9
- package/dist/commands/agent.d.ts +2 -0
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +44 -0
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/bounty.d.ts +4 -0
- package/dist/commands/bounty.d.ts.map +1 -0
- package/dist/commands/bounty.js +24 -0
- package/dist/commands/bounty.js.map +1 -0
- package/dist/commands/buy.d.ts +19 -0
- package/dist/commands/buy.d.ts.map +1 -0
- package/dist/commands/buy.js +63 -0
- package/dist/commands/buy.js.map +1 -0
- package/dist/commands/capabilities.d.ts +4 -0
- package/dist/commands/capabilities.d.ts.map +1 -0
- package/dist/commands/capabilities.js +18 -0
- package/dist/commands/capabilities.js.map +1 -0
- package/dist/commands/commend.d.ts +4 -0
- package/dist/commands/commend.d.ts.map +1 -0
- package/dist/commands/commend.js +13 -0
- package/dist/commands/commend.js.map +1 -0
- package/dist/commands/completion.d.ts +4 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/completion.js +49 -0
- package/dist/commands/completion.js.map +1 -0
- package/dist/commands/config.d.ts +4 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +78 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/deploy.d.ts +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +39 -4
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/doctor.d.ts +4 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +72 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/domain.d.ts +4 -0
- package/dist/commands/domain.d.ts.map +1 -0
- package/dist/commands/domain.js +19 -0
- package/dist/commands/domain.js.map +1 -0
- package/dist/commands/export.d.ts +4 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +15 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/fade.d.ts.map +1 -1
- package/dist/commands/fade.js +8 -4
- package/dist/commands/fade.js.map +1 -1
- package/dist/commands/flag.d.ts +4 -0
- package/dist/commands/flag.d.ts.map +1 -0
- package/dist/commands/flag.js +13 -0
- package/dist/commands/flag.js.map +1 -0
- package/dist/commands/health.d.ts +4 -0
- package/dist/commands/health.d.ts.map +1 -0
- package/dist/commands/health.js +11 -0
- package/dist/commands/health.js.map +1 -0
- package/dist/commands/highways.d.ts.map +1 -1
- package/dist/commands/highways.js +7 -4
- package/dist/commands/highways.js.map +1 -1
- package/dist/commands/hire.d.ts +4 -0
- package/dist/commands/hire.d.ts.map +1 -0
- package/dist/commands/hire.js +16 -0
- package/dist/commands/hire.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +85 -48
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/invite.d.ts +4 -0
- package/dist/commands/invite.d.ts.map +1 -0
- package/dist/commands/invite.js +37 -0
- package/dist/commands/invite.js.map +1 -0
- package/dist/commands/mark.d.ts.map +1 -1
- package/dist/commands/mark.js +7 -7
- package/dist/commands/mark.js.map +1 -1
- package/dist/commands/pay.d.ts +4 -0
- package/dist/commands/pay.d.ts.map +1 -0
- package/dist/commands/pay.js +21 -0
- package/dist/commands/pay.js.map +1 -0
- package/dist/commands/pipe.d.ts +4 -0
- package/dist/commands/pipe.d.ts.map +1 -0
- package/dist/commands/pipe.js +35 -0
- package/dist/commands/pipe.js.map +1 -0
- package/dist/commands/publish.d.ts +4 -0
- package/dist/commands/publish.d.ts.map +1 -0
- package/dist/commands/publish.js +23 -0
- package/dist/commands/publish.js.map +1 -0
- package/dist/commands/repl.d.ts +4 -0
- package/dist/commands/repl.d.ts.map +1 -0
- package/dist/commands/repl.js +56 -0
- package/dist/commands/repl.js.map +1 -0
- package/dist/commands/revenue.d.ts +4 -0
- package/dist/commands/revenue.d.ts.map +1 -0
- package/dist/commands/revenue.js +11 -0
- package/dist/commands/revenue.js.map +1 -0
- package/dist/commands/sell.d.ts +15 -0
- package/dist/commands/sell.d.ts.map +1 -0
- package/dist/commands/sell.js +49 -0
- package/dist/commands/sell.js.map +1 -0
- package/dist/commands/stats.d.ts +4 -0
- package/dist/commands/stats.d.ts.map +1 -0
- package/dist/commands/stats.js +11 -0
- package/dist/commands/stats.js.map +1 -0
- package/dist/commands/status.d.ts +4 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +18 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/subscribe.d.ts +14 -0
- package/dist/commands/subscribe.d.ts.map +1 -0
- package/dist/commands/subscribe.js +33 -0
- package/dist/commands/subscribe.js.map +1 -0
- package/dist/commands/tail.d.ts +4 -0
- package/dist/commands/tail.d.ts.map +1 -0
- package/dist/commands/tail.js +51 -0
- package/dist/commands/tail.js.map +1 -0
- package/dist/commands/warn.d.ts.map +1 -1
- package/dist/commands/warn.js +6 -6
- package/dist/commands/warn.js.map +1 -1
- package/dist/index.js +70 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/args.d.ts +1 -0
- package/dist/lib/args.d.ts.map +1 -1
- package/dist/lib/args.js +3 -0
- package/dist/lib/args.js.map +1 -1
- package/dist/lib/output.d.ts +5 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +32 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/lib/sdk.d.ts +10 -0
- package/dist/lib/sdk.d.ts.map +1 -0
- package/dist/lib/sdk.js +22 -0
- package/dist/lib/sdk.js.map +1 -0
- package/dist/utils/installation-setup.d.ts +15 -0
- package/dist/utils/installation-setup.d.ts.map +1 -1
- package/dist/utils/installation-setup.js +63 -0
- package/dist/utils/installation-setup.js.map +1 -1
- package/package.json +3 -18
- package/.claude/agents/TROUBLESHOOTING.md +0 -530
- package/.claude/agents/agent-backend.md +0 -574
- package/.claude/agents/agent-builder.md +0 -911
- package/.claude/agents/agent-claude.md +0 -645
- package/.claude/agents/agent-clean.md +0 -477
- package/.claude/agents/agent-clone.md +0 -554
- package/.claude/agents/agent-designer.md +0 -1080
- package/.claude/agents/agent-director.md +0 -2254
- package/.claude/agents/agent-documenter.md +0 -688
- package/.claude/agents/agent-frontend.md +0 -1199
- package/.claude/agents/agent-integrator.md +0 -670
- package/.claude/agents/agent-lawyer.md +0 -1320
- package/.claude/agents/agent-news.md +0 -363
- package/.claude/agents/agent-onboard.md +0 -613
- package/.claude/agents/agent-ontology.md +0 -585
- package/.claude/agents/agent-ops.md +0 -1275
- package/.claude/agents/agent-problem-solver.md +0 -669
- package/.claude/agents/agent-quality.md +0 -1042
- package/.claude/agents/agent-sales.md +0 -507
- package/.claude/agents/agent-writer.md +0 -1068
- package/.claude/commands/cascade.md +0 -742
- package/.claude/commands/chat.md +0 -728
- package/.claude/commands/commit.md +0 -95
- package/.claude/commands/create.md +0 -544
- package/.claude/commands/deploy.md +0 -309
- package/.claude/commands/fast.md +0 -636
- package/.claude/commands/mcp-on.md +0 -191
- package/.claude/commands/media-upload.md +0 -186
- package/.claude/commands/news.md +0 -274
- package/.claude/commands/onboard.md +0 -440
- package/.claude/commands/one.md +0 -398
- package/.claude/commands/optimize.md +0 -74
- package/.claude/commands/plan.md +0 -719
- package/.claude/commands/push.md +0 -214
- package/.claude/commands/release.md +0 -105
- package/.claude/commands/review.md +0 -99
- package/.claude/commands/server.md +0 -487
- package/.claude/commands/start.md +0 -227
- package/.claude/commands/test.md +0 -197
- package/.claude/commands/validate.md +0 -140
- package/.claude/hooks/.last-news-context +0 -1
- package/.claude/hooks/PULL-BEFORE-PUSH-GUIDE.md +0 -473
- package/.claude/hooks/README-knowledge-hooks.md +0 -451
- package/.claude/hooks/README-news-generation.md +0 -364
- package/.claude/hooks/README-root-cleanup.md +0 -200
- package/.claude/hooks/README.md +0 -284
- package/.claude/hooks/__pycache__/todo.cpython-312.pyc +0 -0
- package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
- package/.claude/hooks/auto-format.sh +0 -106
- package/.claude/hooks/check-filenames.py +0 -177
- package/.claude/hooks/clean-post.py +0 -468
- package/.claude/hooks/clean-pre.py +0 -393
- package/.claude/hooks/clean-root-markdown.sh +0 -73
- package/.claude/hooks/commit-push.sh +0 -95
- package/.claude/hooks/done.py +0 -236
- package/.claude/hooks/format-hook.sh +0 -163
- package/.claude/hooks/formatting.py +0 -187
- package/.claude/hooks/hook-logger.sh +0 -173
- package/.claude/hooks/knowledge-post.py +0 -355
- package/.claude/hooks/knowledge-pre.py +0 -245
- package/.claude/hooks/mcp-on.sh +0 -134
- package/.claude/hooks/notification-hook.sh +0 -279
- package/.claude/hooks/ontology-validation.py +0 -255
- package/.claude/hooks/push.sh +0 -153
- package/.claude/hooks/release-cli.sh +0 -205
- package/.claude/hooks/root-cleanup.py +0 -217
- package/.claude/hooks/security-hook.sh +0 -397
- package/.claude/hooks/tag-all-docs.py +0 -464
- package/.claude/hooks/test-validate-ontology.sh +0 -170
- package/.claude/hooks/todo.py +0 -368
- package/.claude/hooks/track-changes.sh +0 -101
- package/.claude/hooks/validate-imports.py +0 -182
- package/.claude/hooks/validate-ontology-structure-summary.md +0 -243
- package/.claude/hooks/validate-ontology-structure.py +0 -558
- package/.claude/hooks/validate-ontology-structure.py.backup +0 -518
- package/.claude/hooks/validate-ontology.py +0 -140
- package/.claude/hooks/write-news.sh +0 -194
- package/.claude/skills/INDEX.md +0 -523
- package/.claude/skills/REGISTRY.md +0 -529
- package/.claude/skills/agent-backend-create-mutation.md +0 -319
- package/.claude/skills/agent-designer-create-wireframe.md +0 -341
- package/.claude/skills/agent-frontend-create-page.md +0 -413
- package/.claude/skills/agents/README.md +0 -238
- package/.claude/skills/astro/add-content-collection.md +0 -30
- package/.claude/skills/astro/check-build.md +0 -29
- package/.claude/skills/astro/create-component.md +0 -29
- package/.claude/skills/astro/create-page.md +0 -30
- package/.claude/skills/astro/optimize-performance.md +0 -21
- package/.claude/skills/convex/check-deployment.md +0 -46
- package/.claude/skills/convex/create-mutation.md +0 -405
- package/.claude/skills/convex/create-query.md +0 -52
- package/.claude/skills/convex/read-schema.md +0 -373
- package/.claude/skills/convex/test-function.md +0 -50
- package/.claude/skills/deployment/check-deployment-health.md +0 -20
- package/.claude/skills/deployment/create-release.md +0 -21
- package/.claude/skills/deployment/deploy-cloudflare.md +0 -31
- package/.claude/skills/deployment/deploy-convex.md +0 -30
- package/.claude/skills/deployment/sync-repositories.md +0 -19
- package/.claude/skills/design/check-accessibility.md +0 -21
- package/.claude/skills/design/create-component-spec.md +0 -27
- package/.claude/skills/design/generate-design-tokens.md +0 -24
- package/.claude/skills/design/generate-wireframe.md +0 -30
- package/.claude/skills/documentation/create-migration-guide.md +0 -20
- package/.claude/skills/documentation/generate-api-docs.md +0 -27
- package/.claude/skills/documentation/generate-readme.md +0 -22
- package/.claude/skills/documentation/update-knowledge.md +0 -20
- package/.claude/skills/integration/connect-external-system.md +0 -21
- package/.claude/skills/integration/implement-a2a.md +0 -20
- package/.claude/skills/integration/implement-acp.md +0 -20
- package/.claude/skills/integration/verify-integration.md +0 -20
- package/.claude/skills/ontology/README.md +0 -255
- package/.claude/skills/ontology/check-dimension.md +0 -307
- package/.claude/skills/ontology/generate-entity-type.md +0 -339
- package/.claude/skills/ontology/validate-schema.md +0 -229
- package/.claude/skills/ontology/verify-relationships.md +0 -310
- package/.claude/skills/problem-solving/analyze-test-failure.md +0 -21
- package/.claude/skills/problem-solving/identify-root-cause.md +0 -20
- package/.claude/skills/problem-solving/propose-solution.md +0 -29
- package/.claude/skills/problem-solving/verify-fix.md +0 -21
- package/.claude/skills/sales/generate-demo-script.md +0 -21
- package/.claude/skills/sales/qualify-lead.md +0 -30
- package/.claude/skills/sales/track-trial.md +0 -20
- package/.claude/skills/sales/verify-kyc.md +0 -20
- package/.claude/skills/testing/analyze-coverage.md +0 -24
- package/.claude/skills/testing/generate-tests.md +0 -24
- package/.claude/skills/testing/run-tests.md +0 -27
- package/.claude/skills/testing/validate-e2e.md +0 -25
- package/AGENTS.md +0 -60
- package/CLAUDE.md +0 -130
- package/CREATE-WEBSITE.md +0 -458
- package/SECURITY.md +0 -31
- package/folders.yaml +0 -92
- package/one/README.md +0 -760
- package/one/actors/anthony-o-connell.md +0 -469
- package/one/actors/people.md +0 -590
- package/one/events/0-changes.md +0 -2764
- package/one/events/1-PROJECTS-START-HERE.md +0 -384
- package/one/events/1-projects-developer-quickstart.md +0 -620
- package/one/events/1-projects-feature.md +0 -2047
- package/one/events/1-projects-team-briefing.md +0 -583
- package/one/events/2024-10-14-deployment-plan.md +0 -330
- package/one/events/2024-10-14-deployment-success.md +0 -447
- package/one/events/2024-10-14-final-sync-complete.md +0 -250
- package/one/events/2024-10-14-release-v2.0.6.md +0 -414
- package/one/events/2024-10-15-agent-clean-v2-summary.md +0 -495
- package/one/events/2024-10-15-handoff-to-clean.md +0 -347
- package/one/events/2024-10-15-package-manager-tests.md +0 -442
- package/one/events/2024-10-15-release-command-complete.md +0 -416
- package/one/events/2025-10-15-private-files-secured.md +0 -359
- package/one/events/2025-10-15-unignore-public-group-docs.md +0 -298
- package/one/events/2025-11-08-backend-claude-refactor.md +0 -242
- package/one/events/2025-11-08-parallel-agent-implementation.md +0 -620
- package/one/events/2025-11-10-ai-integration-status-report.md +0 -241
- package/one/events/ACCESSIBILITY_CHECKLIST.md +0 -275
- package/one/events/ACCESSIBILITY_FIXES_SUMMARY.md +0 -293
- package/one/events/ALIGNMENT_REPORT_PROBLEM_SOLVER.md +0 -335
- package/one/events/ALIGNMENT_SUMMARY.md +0 -280
- package/one/events/API_ROUTES_FIXES_SUMMARY.md +0 -280
- package/one/events/ASTRO-INTEGRATION-EXAMPLES.md +0 -654
- package/one/events/AUDIT-ONTOLOGY-ALIGNMENT.md +0 -598
- package/one/events/AUDIT_PLAN_COMPLETION-20251108-125555.md +0 -262
- package/one/events/BEFORE_AFTER_COMPARISON.md +0 -978
- package/one/events/CART-DRAWER-INTEGRATION-GUIDE.md +0 -372
- package/one/events/CASCADE-2-BACKEND-AGNOSTIC.md +0 -430
- package/one/events/CHARTS-READY-TO-USE-20251106-080939.md +0 -184
- package/one/events/CHARTS-SUMMARY-20251106-080938.md +0 -196
- package/one/events/CLAUDE copy.md +0 -897
- package/one/events/CLEANUP-RELEASE-V2.0.8.md +0 -308
- package/one/events/CLOUDFLARE-FS-FIX-20251106-100516.md +0 -75
- package/one/events/COMPONENT_SHOWCASE-20251106-080938.md +0 -629
- package/one/events/CONNECTIONS_DEMO.md +0 -519
- package/one/events/CREATE-WEBSITE.md +0 -460
- package/one/events/CRITICAL-FIXES-COMPLETE.md +0 -571
- package/one/events/CUSTOM-DOMAIN.md +0 -375
- package/one/events/DELIVERABLES.md +0 -450
- package/one/events/DELIVERABLES.txt +0 -273
- package/one/events/DEMO-GROUPS-PAGE.md +0 -410
- package/one/events/DEMO-TESTING-SUMMARY.md +0 -536
- package/one/events/DEMO_COMPONENTS.md +0 -505
- package/one/events/DEMO_HOOKS_INDEX.md +0 -352
- package/one/events/DEMO_INFRASTRUCTURE.md +0 -923
- package/one/events/DEMO_INFRASTRUCTURE_SUMMARY.md +0 -588
- package/one/events/DEMO_INTEGRATION_CHECKLIST.md +0 -449
- package/one/events/DEMO_QUICK_REFERENCE.md +0 -459
- package/one/events/DEMO_SETUP.md +0 -494
- package/one/events/DEPLOYMENT copy.md +0 -444
- package/one/events/DEPLOYMENT.md +0 -196
- package/one/events/DESIGN-DELIVERABLES-20251106-080938.md +0 -557
- package/one/events/DESIGN-EXECUTIVE-SUMMARY-20251106-080938.md +0 -484
- package/one/events/DOCS-SYSTEM-GUIDE-20251105-142103.md +0 -458
- package/one/events/DOCUMENTER-DELIVERY-SUMMARY.md +0 -481
- package/one/events/DOCUMENTER-EXECUTION-GUIDE.md +0 -394
- package/one/events/DOCUMENTER-TASK-BREAKDOWN.md +0 -783
- package/one/events/ECOMMERCE-BEFORE-AFTER.md +0 -267
- package/one/events/ECOMMERCE-DEMO-PLAN.md +0 -243
- package/one/events/ECOMMERCE-ENHANCEMENTS.md +0 -594
- package/one/events/ECOMMERCE-HIGH-CONVERTING-ELEMENTS.md +0 -439
- package/one/events/ECOMMERCE-LIVE-DEMO.md +0 -381
- package/one/events/ECOMMERCE-QUICKSTART.md +0 -376
- package/one/events/ECOMMERCE-README.md +0 -354
- package/one/events/ECOMMERCE-REFACTOR-SUMMARY.md +0 -214
- package/one/events/ECOMMERCE-SETUP-SUMMARY.md +0 -414
- package/one/events/ECOMMERCE-TEMPLATE-COMPLETE.md +0 -753
- package/one/events/ECOMMERCE-TEMPLATES-SUMMARY.md +0 -941
- package/one/events/EFFECT_TS_API_PATTERN.md +0 -496
- package/one/events/EXECUTION-READY.md +0 -359
- package/one/events/EXECUTION-SUMMARY.md +0 -478
- package/one/events/FEATURE-2-4-COMPLETE.md +0 -320
- package/one/events/FEATURE_2_3_COMPLETE.md +0 -593
- package/one/events/FILE-REFERENCE-20251105-142103.md +0 -325
- package/one/events/GRADIENT-TEXT-PERMANENT-FIX.md +0 -241
- package/one/events/GROUPS-MIGRATION.md +0 -643
- package/one/events/GROUPS_DEMO_IMPLEMENTATION.md +0 -432
- package/one/events/HANDOFF.md +0 -331
- package/one/events/HOOKS-DEMO.md +0 -459
- package/one/events/IMPLEMENTATION-CHECKLIST-20251105-142103.md +0 -274
- package/one/events/IMPLEMENTATION-REPORT-DOCS-20251105-142102.md +0 -394
- package/one/events/IMPLEMENTATION-SUMMARY-FINAL.md +0 -568
- package/one/events/IMPLEMENTATION_SUMMARY-20251106-080938.md +0 -571
- package/one/events/IMPLEMENTATION_SUMMARY.md +0 -547
- package/one/events/INDEX-ALL-AGENTS.md +0 -190
- package/one/events/INDEX-FRONTEND-TESTING.md +0 -524
- package/one/events/INDEX-PROBLEM-SOLVER.md +0 -488
- package/one/events/INDEX-QUALITY-AGENT-INFER65.md +0 -455
- package/one/events/INDEX.md +0 -295
- package/one/events/INDEX_QUICK_START_REDESIGN-20251106-080939.md +0 -342
- package/one/events/INSTALL-TESTS.md +0 -311
- package/one/events/INSTALLATION_FOLDERS.md +0 -534
- package/one/events/INSTALLATION_FOLDERS_FILES.md +0 -223
- package/one/events/INSTALLATION_FOLDERS_SUMMARY.md +0 -437
- package/one/events/INTEGRATION-ARCHITECTURE.md +0 -579
- package/one/events/INTEGRATION-CHECKLIST.md +0 -1252
- package/one/events/INTEGRATION-ORCHESTRATION.md +0 -2641
- package/one/events/INTEGRATION-SUMMARY.md +0 -671
- package/one/events/LANDING-PAGE-EXAMPLE-OUTPUT.md +0 -684
- package/one/events/LANDING-PAGE-IMPLEMENTATION.md +0 -660
- package/one/events/LANDING-PAGE-QUICKSTART.md +0 -425
- package/one/events/LICENSE.md +0 -107
- package/one/events/MASTER-COORDINATION-PLAN.md +0 -613
- package/one/events/MASTER-ORCHESTRATION-INFER65.md +0 -441
- package/one/events/MASTER-PLAN-SUMMARY.md +0 -309
- package/one/events/MCP-CONFIGURATION.md +0 -354
- package/one/events/MCP-SETUP-COMPLETE.md +0 -223
- package/one/events/MIGRATION-REPORT.md +0 -453
- package/one/events/MIGRATION.md +0 -87
- package/one/events/MULTI-ONTOLOGY-COMPLETE-GUIDE.md +0 -1663
- package/one/events/MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md +0 -643
- package/one/events/NEWS-COMMANDS.md +0 -506
- package/one/events/NEWS-SYSTEM-SUMMARY.md +0 -480
- package/one/events/NODE-UPGRADE.md +0 -129
- package/one/events/ONBOARDING-IMPLEMENTATION-COMPLETE copy.md +0 -416
- package/one/events/ONTOLOGY-HOOKS-README.md +0 -718
- package/one/events/ONTOLOGY-INTEGRATION-MANIFEST.md +0 -383
- package/one/events/ONTOLOGY-TUTORIALS-SUMMARY.md +0 -569
- package/one/events/ONTOLOGY-TYPE-GENERATOR-SUMMARY.md +0 -491
- package/one/events/ONTOLOGY_DISCOVERY_IMPLEMENTATION.md +0 -504
- package/one/events/ONTOLOGY_DISCOVERY_QUICKSTART.md +0 -221
- package/one/events/PACKAGE-STRUCTURE.md +0 -328
- package/one/events/PLAN-COMPLETE.md +0 -429
- package/one/events/PLAYBOOK-SETUP-SUMMARY.md +0 -349
- package/one/events/PROBLEM-SOLVER-EXECUTIVE-SUMMARY.md +0 -484
- package/one/events/PROBLEM-SOLVER-QUICKSTART.md +0 -420
- package/one/events/PROJECTS-PLAN-SUMMARY.md +0 -480
- package/one/events/PROMPT_FIX_FRONTEND_ONLY.md +0 -585
- package/one/events/QA-CHECKLIST.md +0 -692
- package/one/events/QUALITY-AGENT-SUMMARY.md +0 -334
- package/one/events/QUALITY-EXECUTION-CHECKLIST.md +0 -593
- package/one/events/QUICK-REFERENCE-FRONTEND-TESTING.md +0 -475
- package/one/events/QUICK-START-ONTOLOGY.md +0 -426
- package/one/events/QUICK_START_REDESIGN-20251106-080938.md +0 -400
- package/one/events/README-PROBLEM-SOLVER.md +0 -394
- package/one/events/README-archived.md +0 -537
- package/one/events/README_QUICK_START_REDESIGN-20251106-080938.md +0 -484
- package/one/events/SEARCH_DEMO_CODE_REFERENCE.md +0 -657
- package/one/events/SEARCH_DEMO_DELIVERY.md +0 -433
- package/one/events/SEARCH_DEMO_SUMMARY.md +0 -321
- package/one/events/SEARCH_DEMO_VISUAL_GUIDE.md +0 -399
- package/one/events/SECURITY-AUDIT-FIXES.md +0 -394
- package/one/events/SECURITY-SCAN-COMPLETE.md +0 -299
- package/one/events/SHOP-BUILD-STATUS.md +0 -132
- package/one/events/SHOP-PREMIUM-UPDATE.md +0 -165
- package/one/events/SIMPLE_FIX_FRONTEND_ONLY.md +0 -280
- package/one/events/SITE-WIDE-GRADIENT-FIX.md +0 -317
- package/one/events/SPECIALIST-QUICK-REFERENCE.md +0 -678
- package/one/events/STORE-PRODUCTION-READY-STATUS.md +0 -377
- package/one/events/STRIPE-INTEGRATION.md +0 -432
- package/one/events/STRIPE-PAYMENT-METHODS-GUIDE.md +0 -447
- package/one/events/STRIPE-SETUP-GUIDE.md +0 -480
- package/one/events/TEST-PLAN-INDEX.md +0 -364
- package/one/events/TEST-PLAN.md +0 -1435
- package/one/events/TEST-SUMMARY.md +0 -411
- package/one/events/TESTING-DELIVERY.txt +0 -372
- package/one/events/TESTS-QUICK-REF.md +0 -280
- package/one/events/TRANSITIONS-QUICK-START.md +0 -159
- package/one/events/TRANSPARENCY-FIXES.md +0 -293
- package/one/events/TYPESCRIPT_FIXES.md +0 -170
- package/one/events/TYPESCRIPT_FIXES_COMPLETE.txt +0 -412
- package/one/events/TYPESCRIPT_FIXES_INDEX.md +0 -359
- package/one/events/VERIFICATION_CHECKLIST-20251106-080938.md +0 -326
- package/one/events/VIEW-TRANSITIONS.md +0 -446
- package/one/events/agent-command-implementation.md +0 -305
- package/one/events/agent-director-enhancement-summary.md +0 -404
- package/one/events/agent-director-routing-update.md +0 -214
- package/one/events/agent-onboard-implementation-summary.md +0 -475
- package/one/events/agent-ontology-alignment-completion.md +0 -263
- package/one/events/ai-integration-complete.md +0 -294
- package/one/events/ai-integration-lessons-learned.md +0 -511
- package/one/events/backend-integration-tests.md +0 -624
- package/one/events/backend-structure-diagram.txt +0 -393
- package/one/events/backend-structure-summary.txt +0 -269
- package/one/events/bullfm-video-podcast-analysis.md +0 -319
- package/one/events/clean-agent-ontology-cleanup-report.md +0 -371
- package/one/events/clean-agent-todo-analysis-summary.md +0 -336
- package/one/events/cloudflare-automation-complete.md +0 -350
- package/one/events/cloudflare-pages-infrastructure-setup.md +0 -282
- package/one/events/contact-page-complete.md +0 -316
- package/one/events/convex-analysis-index.md +0 -322
- package/one/events/convex-structure-analysis.md +0 -718
- package/one/events/creation-instructions-9-todos.md +0 -906
- package/one/events/cycle-3-video-player-port-20251108.md +0 -368
- package/one/events/cycle-3-video-player-port-complete-20251108.md +0 -334
- package/one/events/deployment-installation-folders.md +0 -178
- package/one/events/deployment-ops-summary.md +0 -386
- package/one/events/deployment-verification.md +0 -366
- package/one/events/design-spec-complete.md +0 -226
- package/one/events/documentation-audit-index.md +0 -473
- package/one/events/documentation-audit-summary.md +0 -417
- package/one/events/documentation-improvement-roadmap.md +0 -906
- package/one/events/documentation-standards-compliance-report.md +0 -538
- package/one/events/documentation-updates.md +0 -370
- package/one/events/events.md +0 -563
- package/one/events/fix-product-hydration-20251106.md +0 -211
- package/one/events/frontend-effects-complete.md +0 -584
- package/one/events/frontend-effects-orchestration.md +0 -1356
- package/one/events/frontend-effects-risk-register.md +0 -1055
- package/one/events/frontend-effects-week1-assignments.md +0 -1594
- package/one/events/hook-ontology-alignment-summary.md +0 -528
- package/one/events/installation-folders-workflow-integration.md +0 -458
- package/one/events/landing-page-generator.md +0 -476
- package/one/events/legal-assessment-2025-10-16.md +0 -1917
- package/one/events/master-coordination-plan.json +0 -1078
- package/one/events/master-plan-9-todos.md +0 -900
- package/one/events/mobile-performance-optimization.md +0 -179
- package/one/events/onboarding-implementation-complete.md +0 -523
- package/one/events/ontology-audit-agent-clone.md +0 -323
- package/one/events/ontology-test-examples.md +0 -580
- package/one/events/phase1-backend-implementation-complete.md +0 -536
- package/one/events/plan-completion-audit.md +0 -707
- package/one/events/plan-files-updated.md +0 -273
- package/one/events/production-readiness-plan.md +0 -389
- package/one/events/readme.md +0 -100
- package/one/events/release.md +0 -272
- package/one/events/root-cleanup-alignment-report.md +0 -265
- package/one/events/security-fixes-2025-01-15.md +0 -226
- package/one/events/separate-implementation-status.md +0 -555
- package/one/events/server-command-optimization-20251108.md +0 -150
- package/one/events/session-summary-2025-10-18.md +0 -366
- package/one/events/skills-complete.md +0 -351
- package/one/events/skills-infer-6-10-summary.md +0 -70
- package/one/events/skills-phase1-complete.md +0 -281
- package/one/events/specialist-assignments.md +0 -766
- package/one/events/structural-analysis-architecture-vs-plans.md +0 -600
- package/one/events/test-dashboard.md +0 -363
- package/one/events/test-index.md +0 -421
- package/one/events/test-report-ontology.md +0 -611
- package/one/events/testing-summary.md +0 -388
- package/one/events/todo-agent-builder.md +0 -1180
- package/one/events/todo-agent-director.md +0 -164
- package/one/events/todo-agent-documenter.md +0 -1815
- package/one/events/todo-agent-frontend.md +0 -1542
- package/one/events/todo-agent-problem-solver.md +0 -1682
- package/one/events/todo-agent-quality.md +0 -1647
- package/one/events/todo-refactoring-complete.md +0 -408
- package/one/events/wave1-backend-implementation-complete.md +0 -698
- package/one/events/web-AI_INTEGRATION_PHASE2_SUMMARY-20251111-152540.md +0 -529
- package/one/events/web-BUY-IN-CHATGPT-README-20251116-235241.md +0 -491
- package/one/events/web-CHARTS-IMPLEMENTATION-20251106-080939.md +0 -576
- package/one/events/web-CHARTS-QUICKSTART-20251106-080939.md +0 -416
- package/one/events/web-CODE-HIGHLIGHTING-SUMMARY-20251111-152540.md +0 -442
- package/one/events/web-DEPLOYMENT_SUMMARY-20251116-005428.md +0 -290
- package/one/events/web-DESIGN-SUMMARY-20251106-080939.md +0 -514
- package/one/events/web-README-AI-INTEGRATION-20251111-152540.md +0 -196
- package/one/events/web-RECHARTS-INTEGRATION-20251111-152540.md +0 -265
- package/one/events/web-RELEASE_OPTIMIZATION_PLAN-20251116-005428.md +0 -447
- package/one/events/web-TEST-CLEANUP-20251105-143205.md +0 -3
- package/one/events/web-USING-ANY-COMPONENT-IN-CHAT-20251111-152540.md +0 -561
- package/one/events/web-test-code-highlighting-20251111-152540.md +0 -231
- package/one/groups/features.md +0 -2904
- package/one/groups/groups.md +0 -587
- package/one/groups/one.md +0 -619
- package/one/groups/strategy-copy.md +0 -887
- package/one/learning/.obsidian/app.json +0 -1
- package/one/learning/.obsidian/appearance.json +0 -1
- package/one/learning/.obsidian/core-plugins.json +0 -33
- package/one/learning/.obsidian/ecommerce-ontology.md +0 -210
- package/one/learning/.obsidian/workspace.json +0 -211
- package/one/learning/100-inference-quick-reference.md +0 -449
- package/one/learning/ag-ui-protocol.md +0 -613
- package/one/learning/agent-onboard-usage.md +0 -630
- package/one/learning/agentic-commerce.md +0 -146
- package/one/learning/ai-agents-vs-memecoins-thesis.md +0 -683
- package/one/learning/ai-api-reference.md +0 -715
- package/one/learning/ai-platform.md +0 -323
- package/one/learning/ai-quickstart.md +0 -355
- package/one/learning/ai-sdk-implementation.md +0 -436
- package/one/learning/ai-token-crypto-analysis-framework.md +0 -1191
- package/one/learning/ai-token-paradigm-shift-2025.md +0 -732
- package/one/learning/altcoin-cycle-prediction-ontology.md +0 -884
- package/one/learning/altcoin-cycle-trading-strategy.md +0 -642
- package/one/learning/architecture-any-backend.md +0 -1589
- package/one/learning/architecture-diagram.md +0 -404
- package/one/learning/architecture-frontend.md +0 -1014
- package/one/learning/architecture.md +0 -1742
- package/one/learning/archived/ontology.old.md +0 -2840
- package/one/learning/astro-effect-complete-vision.md +0 -2148
- package/one/learning/astro-effect-simple-architecture.md +0 -750
- package/one/learning/audit-agent-onboard-alignment.md +0 -481
- package/one/learning/audit-agent-sales-alignment.md +0 -444
- package/one/learning/backend-api-reference.md +0 -728
- package/one/learning/cascading-context-specification.md +0 -1617
- package/one/learning/claude-code-integration.md +0 -1293
- package/one/learning/cli-claude-handoff.md +0 -736
- package/one/learning/context-engineering.md +0 -610
- package/one/learning/crypto-analysis-strategy.md +0 -1276
- package/one/learning/crypto-cycle-2024-2025-analysis.md +0 -44
- package/one/learning/crypto.md +0 -978
- package/one/learning/develop/design.md +0 -364
- package/one/learning/develop/index.md +0 -145
- package/one/learning/development-commands.md +0 -251
- package/one/learning/docs.md +0 -627
- package/one/learning/dsl.md +0 -1678
- package/one/learning/event-driven-documentation.md +0 -270
- package/one/learning/files.md +0 -2489
- package/one/learning/frontend.md +0 -1056
- package/one/learning/games-english.md +0 -691
- package/one/learning/games.md +0 -1082
- package/one/learning/generative-ui-patterns.md +0 -559
- package/one/learning/guidelines.md +0 -314
- package/one/learning/hono.md +0 -2127
- package/one/learning/implementation-examples.md +0 -2554
- package/one/learning/installation-folders.md +0 -366
- package/one/learning/institutional-cycle-paradigm-2025.md +0 -555
- package/one/learning/knowledge.md +0 -660
- package/one/learning/language.md +0 -998
- package/one/learning/lessons-learned.md +0 -378
- package/one/learning/lessons-website-building-focus.md +0 -382
- package/one/learning/merge-report.md +0 -254
- package/one/learning/metadata-system.md +0 -504
- package/one/learning/nine-padel-playbook.md +0 -229
- package/one/learning/one-protocol-ai-agents.md +0 -892
- package/one/learning/one-protocol-executive-report.md +0 -617
- package/one/learning/one-protocol-standard.md +0 -869
- package/one/learning/one-protocol-whitepaper.md +0 -756
- package/one/learning/ontology-blog.yaml +0 -47
- package/one/learning/ontology-cheatsheet.md +0 -617
- package/one/learning/ontology-community.yaml +0 -65
- package/one/learning/ontology-core-universal.md +0 -740
- package/one/learning/ontology-core.yaml +0 -63
- package/one/learning/ontology-courses.yaml +0 -76
- package/one/learning/ontology-creator.md +0 -402
- package/one/learning/ontology-crypto.md +0 -1603
- package/one/learning/ontology-developer-guide.md +0 -814
- package/one/learning/ontology-documentation.md +0 -377
- package/one/learning/ontology-ecommerce.md +0 -269
- package/one/learning/ontology-education-game.md +0 -1654
- package/one/learning/ontology-education.md +0 -938
- package/one/learning/ontology-engineering-specification.md +0 -1310
- package/one/learning/ontology-engineering.md +0 -1676
- package/one/learning/ontology-files.yaml +0 -525
- package/one/learning/ontology-frontend-master.md +0 -2898
- package/one/learning/ontology-frontend-specifications.md +0 -2196
- package/one/learning/ontology-frontend.md +0 -2475
- package/one/learning/ontology-index.md +0 -397
- package/one/learning/ontology-minimal.yaml +0 -301
- package/one/learning/ontology-portfolio.yaml +0 -45
- package/one/learning/ontology-quickstart.md +0 -602
- package/one/learning/ontology-release.md +0 -317
- package/one/learning/ontology-shop.yaml +0 -148
- package/one/learning/ontology-tokens.yaml +0 -51
- package/one/learning/ontology-tutorial.md +0 -455
- package/one/learning/ontology-v2.md +0 -4449
- package/one/learning/ontology-video-script.md +0 -939
- package/one/learning/ontology-visual-guide.md +0 -378
- package/one/learning/ontology.md +0 -3847
- package/one/learning/ontology.yaml +0 -1653
- package/one/learning/parallel-agents.md +0 -932
- package/one/learning/patterns/backend/convex-mutation-pattern.md +0 -130
- package/one/learning/patterns/backend/convex-query-pattern.md +0 -143
- package/one/learning/patterns/backend/mutation-template.md +0 -249
- package/one/learning/patterns/backend/query-template.md +0 -286
- package/one/learning/patterns/backend/service-template.md +0 -258
- package/one/learning/patterns/design/component-architecture.md +0 -435
- package/one/learning/patterns/design/index.md +0 -160
- package/one/learning/patterns/design/test-driven-design-pattern.md +0 -196
- package/one/learning/patterns/design/wireframe-template.md +0 -250
- package/one/learning/patterns/frontend/component-template.md +0 -246
- package/one/learning/patterns/frontend/form-template.md +0 -348
- package/one/learning/patterns/frontend/page-template.md +0 -209
- package/one/learning/patterns/frontend/react-component-pattern.md +0 -188
- package/one/learning/patterns/test/acceptance-criteria-template.md +0 -396
- package/one/learning/patterns/test/technical-test-template.md +0 -566
- package/one/learning/patterns/test/test-driven-pattern.md +0 -160
- package/one/learning/patterns/test/user-flow-template.md +0 -272
- package/one/learning/performance.md +0 -459
- package/one/learning/provider-agnostic-content.md +0 -995
- package/one/learning/provider-creation-guide.md +0 -1082
- package/one/learning/quality-loop.md +0 -419
- package/one/learning/quick-start-ontology-mapping.md +0 -773
- package/one/learning/readme-architecture.md +0 -158
- package/one/learning/readme.md +0 -149
- package/one/learning/rules.md +0 -644
- package/one/learning/score.md +0 -85
- package/one/learning/specifications.md +0 -873
- package/one/learning/tags.md +0 -148
- package/one/learning/todo-template.md +0 -269
- package/one/learning/todo.md +0 -269
- package/one/learning/troubleshooting.md +0 -434
- package/one/learning/typescript-patterns.md +0 -321
- package/one/learning/universal-generation-language.md +0 -827
- package/one/learning/x402-research.md +0 -104
- package/one/license.md +0 -107
- package/one/paths/a2a.md +0 -600
- package/one/paths/acp.md +0 -808
- package/one/paths/acps.md +0 -749
- package/one/paths/agentkit.md +0 -367
- package/one/paths/agui.md +0 -785
- package/one/paths/any-backend.md +0 -1720
- package/one/paths/ap2.md +0 -1072
- package/one/paths/api/queries-reference.md +0 -860
- package/one/paths/api-docs.md +0 -1909
- package/one/paths/api-reference.md +0 -1029
- package/one/paths/api.md +0 -2208
- package/one/paths/architecture-diagram.md +0 -112
- package/one/paths/communications.md +0 -467
- package/one/paths/connections.md +0 -357
- package/one/paths/copilotkit.md +0 -1577
- package/one/paths/cryptonetworks.md +0 -799
- package/one/paths/documentation.md +0 -1138
- package/one/paths/effect.md +0 -297
- package/one/paths/elizaos.md +0 -1308
- package/one/paths/groups.md +0 -814
- package/one/paths/inference.md +0 -76
- package/one/paths/integration-examples.md +0 -893
- package/one/paths/integration-guide.md +0 -887
- package/one/paths/integration-phase2.md +0 -754
- package/one/paths/kyc.md +0 -650
- package/one/paths/mcp.md +0 -860
- package/one/paths/membership.md +0 -1170
- package/one/paths/middleware.md +0 -1085
- package/one/paths/multitenant.md +0 -1359
- package/one/paths/n8n.md +0 -1033
- package/one/paths/patterns.md +0 -107
- package/one/paths/protocols.md +0 -297
- package/one/paths/relationships.md +0 -125
- package/one/paths/schema.md +0 -605
- package/one/paths/service-layer.md +0 -568
- package/one/paths/vectors.md +0 -225
- package/one/paths/wordpress.md +0 -1320
- package/one/paths/workflow-copy.md +0 -923
- package/one/paths/workflow-examples.md +0 -759
- package/one/paths/workflow-onboarding.md +0 -701
- package/one/paths/workflow.md +0 -923
- package/one/paths/workflows/delegation.md +0 -903
- package/one/paths/workflows/frontend.md +0 -1055
- package/one/paths/workflows/strategy.md +0 -921
- package/one/paths/workflows/tasks.md +0 -716
- package/one/paths/x402-baazar.md +0 -131
- package/one/paths/x402.md +0 -1353
- package/one/things/ALIGNMENT_AUDIT_QUALITY_AGENT.md +0 -401
- package/one/things/AUDIT_AGENT_INTEGRATOR_ALIGNMENT.md +0 -588
- package/one/things/AUDIT_REPORT_AGENT_CLEAN.md +0 -461
- package/one/things/CHECKLIST.md +0 -407
- package/one/things/IMPLEMENTATION_STATUS.md +0 -379
- package/one/things/ONE.md +0 -529
- package/one/things/agents/agent-backend.md +0 -1501
- package/one/things/agents/agent-builder.md +0 -1064
- package/one/things/agents/agent-clean.md +0 -1112
- package/one/things/agents/agent-clone.md +0 -1324
- package/one/things/agents/agent-deploy.md +0 -986
- package/one/things/agents/agent-designer.md +0 -2305
- package/one/things/agents/agent-director.md +0 -1526
- package/one/things/agents/agent-documenter.md +0 -1129
- package/one/things/agents/agent-frontend.md +0 -1201
- package/one/things/agents/agent-integrator.md +0 -1269
- package/one/things/agents/agent-lawyer.md +0 -1371
- package/one/things/agents/agent-problem-solver.md +0 -1457
- package/one/things/agents/agent-quality.md +0 -1483
- package/one/things/agents/agent-sales.md +0 -1074
- package/one/things/cascade/cascade.yaml +0 -481
- package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +0 -523
- package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +0 -314
- package/one/things/cascade/docs/examples/1-1-agent-prompts.md +0 -562
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +0 -543
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +0 -272
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +0 -548
- package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +0 -586
- package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +0 -267
- package/one/things/cascade/docs/examples/1-3-event-coordination.md +0 -547
- package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +0 -665
- package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +0 -236
- package/one/things/cascade/docs/examples/1-4-knowledge-management.md +0 -652
- package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +0 -860
- package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +0 -255
- package/one/things/cascade/docs/examples/1-5-quality-loops.md +0 -725
- package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +0 -659
- package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +0 -256
- package/one/things/cascade/docs/examples/1-6-numbering-structure.md +0 -639
- package/one/things/cascade/docs/examples/readme.md +0 -259
- package/one/things/cascade/docs/getting-started.md +0 -533
- package/one/things/cascade/docs/workflow.md +0 -1378
- package/one/things/cascade/readme.md +0 -379
- package/one/things/cascade/templates/feature-template.md +0 -289
- package/one/things/claude/agents/advocacy-activation-manager.md +0 -710
- package/one/things/claude/agents/advocacy-campaign-designer.md +0 -688
- package/one/things/claude/agents/analyst.md +0 -508
- package/one/things/claude/agents/architect.md +0 -505
- package/one/things/claude/agents/brand-identity-specialist.md +0 -538
- package/one/things/claude/agents/bstp-token-strategist.md +0 -690
- package/one/things/claude/agents/builder-repo.md +0 -532
- package/one/things/claude/agents/bullstamp-community-builder.md +0 -597
- package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +0 -529
- package/one/things/claude/agents/bulltilt-platform-growth.md +0 -590
- package/one/things/claude/agents/company-bullstamp-character.md +0 -602
- package/one/things/claude/agents/company-bullstamp-community.md +0 -307
- package/one/things/claude/agents/company-bullstamp-marketing.md +0 -307
- package/one/things/claude/agents/company-bullstamp-token.md +0 -307
- package/one/things/claude/agents/company-bulltilt-growth.md +0 -307
- package/one/things/claude/agents/content-bibliography-formatter.md +0 -404
- package/one/things/claude/agents/content-calendar-planner.md +0 -473
- package/one/things/claude/agents/content-chapter-formatter.md +0 -513
- package/one/things/claude/agents/content-formatter.md +0 -571
- package/one/things/claude/agents/content-hook-specialist.md +0 -485
- package/one/things/claude/agents/content-image-formatter.md +0 -560
- package/one/things/claude/agents/content-introduction-formatter.md +0 -510
- package/one/things/claude/agents/content-multiplication-engine.md +0 -579
- package/one/things/claude/agents/content-playbook-writer.md +0 -473
- package/one/things/claude/agents/content-team-manager.md +0 -647
- package/one/things/claude/agents/content-toc-formatter.md +0 -547
- package/one/things/claude/agents/convex-backend-specialist.md +0 -2725
- package/one/things/claude/agents/core-manager.md +0 -607
- package/one/things/claude/agents/core-master.md +0 -426
- package/one/things/claude/agents/cross-functional-manager.md +0 -476
- package/one/things/claude/agents/crypto-airdrop-strategist.md +0 -622
- package/one/things/claude/agents/crypto-analytics-educator.md +0 -596
- package/one/things/claude/agents/crypto-architecture-specialist.md +0 -497
- package/one/things/claude/agents/crypto-community-analyst.md +0 -314
- package/one/things/claude/agents/crypto-community-psychologist.md +0 -546
- package/one/things/claude/agents/crypto-dex-optimization-expert.md +0 -579
- package/one/things/claude/agents/crypto-dex-optimizer.md +0 -307
- package/one/things/claude/agents/crypto-diamond-formation-specialist.md +0 -552
- package/one/things/claude/agents/crypto-diamond-hands.md +0 -307
- package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +0 -597
- package/one/things/claude/agents/crypto-engagement-specialist.md +0 -581
- package/one/things/claude/agents/crypto-market-researcher.md +0 -307
- package/one/things/claude/agents/crypto-marketing-orchestrator.md +0 -563
- package/one/things/claude/agents/crypto-network-effect-amplifier.md +0 -614
- package/one/things/claude/agents/crypto-optimization-analyst.md +0 -597
- package/one/things/claude/agents/crypto-strategic-synthesizer.md +0 -556
- package/one/things/claude/agents/crypto-team-manager.md +0 -392
- package/one/things/claude/agents/crypto-token-analyst.md +0 -319
- package/one/things/claude/agents/crypto-viral-content-creator.md +0 -549
- package/one/things/claude/agents/crypto-wallet-identification-expert.md +0 -527
- package/one/things/claude/agents/crypto-wallet-identifier.md +0 -307
- package/one/things/claude/agents/customer-journey-designer.md +0 -474
- package/one/things/claude/agents/customer-success-manager.md +0 -574
- package/one/things/claude/agents/dev.md +0 -406
- package/one/things/claude/agents/documenter.md +0 -548
- package/one/things/claude/agents/elevate-marketing-orchestrator.md +0 -403
- package/one/things/claude/agents/engagement-specialist.md +0 -502
- package/one/things/claude/agents/engineering-architect.md +0 -387
- package/one/things/claude/agents/engineering-business-analyst.md +0 -527
- package/one/things/claude/agents/engineering-developer.md +0 -386
- package/one/things/claude/agents/engineering-director.md +0 -322
- package/one/things/claude/agents/engineering-ingestor.md +0 -659
- package/one/things/claude/agents/engineering-product-manager.md +0 -525
- package/one/things/claude/agents/engineering-product-owner.md +0 -527
- package/one/things/claude/agents/engineering-project-coordinator.md +0 -525
- package/one/things/claude/agents/engineering-quality-assurance.md +0 -392
- package/one/things/claude/agents/engineering-team-manager.md +0 -515
- package/one/things/claude/agents/engineering-user-experience.md +0 -386
- package/one/things/claude/agents/framework-elevate-manager.md +0 -309
- package/one/things/claude/agents/improver.md +0 -805
- package/one/things/claude/agents/intelligence-team-manager.md +0 -390
- package/one/things/claude/agents/lead-capture-expert.md +0 -459
- package/one/things/claude/agents/lead-magnet-creator.md +0 -446
- package/one/things/claude/agents/market-research-analyst.md +0 -435
- package/one/things/claude/agents/marketing-brand-identity.md +0 -344
- package/one/things/claude/agents/marketing-content-hooks.md +0 -455
- package/one/things/claude/agents/marketing-content-multiplier.md +0 -331
- package/one/things/claude/agents/marketing-content-poster.md +0 -372
- package/one/things/claude/agents/marketing-customer-journey.md +0 -331
- package/one/things/claude/agents/marketing-director.md +0 -402
- package/one/things/claude/agents/marketing-engagement.md +0 -331
- package/one/things/claude/agents/marketing-lead-capture.md +0 -331
- package/one/things/claude/agents/marketing-lead-magnet.md +0 -331
- package/one/things/claude/agents/marketing-network-effects.md +0 -331
- package/one/things/claude/agents/marketing-nurture-campaigns.md +0 -331
- package/one/things/claude/agents/marketing-share-optimizer.md +0 -331
- package/one/things/claude/agents/marketing-team-manager.md +0 -451
- package/one/things/claude/agents/marketing-viral-growth.md +0 -232
- package/one/things/claude/agents/mission-commander.md +0 -378
- package/one/things/claude/agents/network-effect-analyst.md +0 -604
- package/one/things/claude/agents/nextjs-15-specialist.md +0 -1634
- package/one/things/claude/agents/npx.md +0 -946
- package/one/things/claude/agents/nurture-campaign-manager.md +0 -554
- package/one/things/claude/agents/one-master.md +0 -378
- package/one/things/claude/agents/one-orchestrator.md +0 -345
- package/one/things/claude/agents/one.md +0 -658
- package/one/things/claude/agents/playbook-generator.md +0 -526
- package/one/things/claude/agents/pm.md +0 -349
- package/one/things/claude/agents/po.md +0 -370
- package/one/things/claude/agents/qa.md +0 -361
- package/one/things/claude/agents/research-foundation-analyst.md +0 -324
- package/one/things/claude/agents/research-intelligence-gatherer.md +0 -435
- package/one/things/claude/agents/research-market-analyst.md +0 -324
- package/one/things/claude/agents/research-team-manager.md +0 -489
- package/one/things/claude/agents/sales-environment-optimizer.md +0 -519
- package/one/things/claude/agents/sales-team-manager.md +0 -407
- package/one/things/claude/agents/sales-upsell-strategist.md +0 -324
- package/one/things/claude/agents/service-advocacy-campaigns.md +0 -324
- package/one/things/claude/agents/service-advocacy-manager.md +0 -324
- package/one/things/claude/agents/service-success-manager.md +0 -324
- package/one/things/claude/agents/service-team-manager.md +0 -405
- package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +0 -2357
- package/one/things/claude/agents/share-optimization-specialist.md +0 -576
- package/one/things/claude/agents/sm.md +0 -352
- package/one/things/claude/agents/story-teller.md +0 -498
- package/one/things/claude/agents/task-master.md +0 -621
- package/one/things/claude/agents/tauri-cross-platform-specialist.md +0 -1912
- package/one/things/claude/agents/tester.md +0 -595
- package/one/things/claude/agents/the-bull-character-manager.md +0 -603
- package/one/things/claude/agents/tools-playbook-generator.md +0 -492
- package/one/things/claude/agents/turbo-repo-builder.md +0 -346
- package/one/things/claude/agents/upsell-strategist.md +0 -503
- package/one/things/claude/agents/ux-expert.md +0 -360
- package/one/things/claude/agents/viral-growth-orchestrator.md +0 -520
- package/one/things/claude/claude-code-hooks-development.json +0 -21
- package/one/things/claude/claude-code-hooks-production.json +0 -21
- package/one/things/claude/claude-code-hooks.json +0 -25
- package/one/things/claude/commands/agent.md +0 -124
- package/one/things/claude/commands/cascade-status.md +0 -153
- package/one/things/claude/commands/ingest.md +0 -343
- package/one/things/claude/commands/ingestor.md +0 -158
- package/one/things/claude/commands/mission.md +0 -103
- package/one/things/claude/commands/npx.md +0 -156
- package/one/things/claude/commands/one.md +0 -486
- package/one/things/claude/commands/quality-check.md +0 -252
- package/one/things/claude/commands/smart-route.md +0 -261
- package/one/things/claude/commands/start.md +0 -139
- package/one/things/claude/commands/story.md +0 -103
- package/one/things/claude/commands/task.md +0 -193
- package/one/things/claude/hook-bypass.json +0 -32
- package/one/things/claude/hooks/agent-hook-config.json +0 -427
- package/one/things/claude/hooks/build-hook.sh +0 -156
- package/one/things/claude/hooks/cleanup-hook.sh +0 -201
- package/one/things/claude/hooks/file-organization-hook.sh +0 -80
- package/one/things/claude/hooks/format-hook.sh +0 -43
- package/one/things/claude/hooks/hook-bypass.sh +0 -293
- package/one/things/claude/hooks/hook-debouncer.sh +0 -62
- package/one/things/claude/hooks/hook-logger.sh +0 -89
- package/one/things/claude/hooks/lint-hook.sh +0 -140
- package/one/things/claude/hooks/notification-hook.sh +0 -204
- package/one/things/claude/hooks/ontology-validation-hook.sh +0 -86
- package/one/things/claude/hooks/performance-metrics.json +0 -25
- package/one/things/claude/hooks/security-hook.sh +0 -256
- package/one/things/claude/hooks/story-validation-hook-enhanced.sh +0 -210
- package/one/things/claude/hooks/story-validation-hook.sh +0 -145
- package/one/things/claude/hooks/test-hook.sh +0 -145
- package/one/things/claude/hooks/test-story-validation.sh +0 -170
- package/one/things/claude/settings-local.json +0 -86
- package/one/things/cli/cli-code.md +0 -677
- package/one/things/cli/cli-compiler-code.md +0 -677
- package/one/things/cli/cli.md +0 -871
- package/one/things/components/card-shadcn.md +0 -953
- package/one/things/components/card.md +0 -1041
- package/one/things/components.md +0 -1743
- package/one/things/componets.md +0 -19
- package/one/things/contracts/Move.toml +0 -12
- package/one/things/contracts/README.md +0 -288
- package/one/things/contracts/one.move +0 -762
- package/one/things/contracts/sdk.ts +0 -579
- package/one/things/creator-diagram.md +0 -184
- package/one/things/crypto/FEATURES.md +0 -78
- package/one/things/crypto/ONECORE.md +0 -62
- package/one/things/crypto/ONECOREFAQ.md +0 -22
- package/one/things/crypto/ONECOREHOW.md +0 -46
- package/one/things/crypto/ONEENTERPRISE.md +0 -64
- package/one/things/crypto/ONEENTERPRISEFAQ.md +0 -64
- package/one/things/crypto/ONEENTERPRISEHOW.md +0 -53
- package/one/things/crypto/ONEPRO.md +0 -60
- package/one/things/crypto/ONEPROFAQ.md +0 -22
- package/one/things/crypto/ONEPROHOW.md +0 -53
- package/one/things/crypto/READMEAGENCY.md +0 -64
- package/one/things/crypto/VSL.md +0 -45
- package/one/things/crypto/WebsiteCopy.md +0 -176
- package/one/things/demo-accessibility-animations.md +0 -1025
- package/one/things/demo-components.md +0 -1310
- package/one/things/demo-design-summary.md +0 -692
- package/one/things/demo-design-system.md +0 -973
- package/one/things/demo-page-layouts.md +0 -1016
- package/one/things/design-system.md +0 -832
- package/one/things/designs/accessibility-audit.md +0 -877
- package/one/things/designs/component-specifications.md +0 -855
- package/one/things/designs/design-overview.md +0 -377
- package/one/things/designs/design-tokens.md +0 -448
- package/one/things/designs/wireframes-dashboard.md +0 -710
- package/one/things/docs/api-requests.md +0 -987
- package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +0 -485
- package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +0 -465
- package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +0 -425
- package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +0 -451
- package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +0 -536
- package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +0 -650
- package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +0 -473
- package/one/things/docs/ecommerce/QUICK-START.md +0 -405
- package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +0 -567
- package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +0 -271
- package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +0 -171
- package/one/things/docs/ecommerce/demo.astro +0 -309
- package/one/things/examples/children/lemonade-stand.md +0 -404
- package/one/things/examples/enterprise/crm-saas.md +0 -1444
- package/one/things/features/1-1-agent-prompts.md +0 -562
- package/one/things/features/1-2-yaml-orchestrator.md +0 -548
- package/one/things/features/1-3-event-coordination.md +0 -547
- package/one/things/features/1-4-knowledge-management.md +0 -652
- package/one/things/features/1-5-quality-loops.md +0 -725
- package/one/things/features/1-6-numbering-structure.md +0 -639
- package/one/things/features/2-1-dataprovider-interface.md +0 -2583
- package/one/things/features/2-2-config-system.md +0 -3242
- package/one/things/features/2-3-effectts-services.md +0 -1645
- package/one/things/features/2-4-react-hooks.md +0 -2136
- package/one/things/features/2-5-auth-migration.md +0 -2144
- package/one/things/features/2-6-dashboard-migration.md +0 -2084
- package/one/things/features/2-7-alternative-providers.md +0 -2578
- package/one/things/features/2-7-implementation-report.md +0 -724
- package/one/things/features/2-cli.md +0 -1720
- package/one/things/features/2-design.md +0 -1770
- package/one/things/features/2-tests.md +0 -576
- package/one/things/features/AUTH_HOOKS_IMPLEMENTATION.md +0 -576
- package/one/things/features/DECOUPLING.md +0 -290
- package/one/things/features/DEPLOYMENT.md +0 -470
- package/one/things/features/IMPLEMENTATION_SUMMARY.md +0 -362
- package/one/things/features/improve.md +0 -861
- package/one/things/features/remove-convex-deps.md +0 -63
- package/one/things/features/top-features.md +0 -87
- package/one/things/features/use-one-backend.md +0 -1217
- package/one/things/features-in-english.md +0 -200
- package/one/things/files.yaml +0 -721
- package/one/things/ideas/1-create-workflow.md +0 -207
- package/one/things/ideas/2-backend-agnostic-frontend.md +0 -439
- package/one/things/implementation/backend-guide.md +0 -457
- package/one/things/interface.md +0 -257
- package/one/things/landing-page-implementation.md +0 -455
- package/one/things/legal/README.md +0 -234
- package/one/things/legal/privacy-policy.md +0 -1227
- package/one/things/legal/terms-of-service.md +0 -1432
- package/one/things/master-workflow-plan.md +0 -806
- package/one/things/pay.one.ie.md +0 -53
- package/one/things/plans/0-in-sync.md +0 -136
- package/one/things/plans/0-timeline.md +0 -36
- package/one/things/plans/1-create-workflow.md +0 -732
- package/one/things/plans/QUICK-START-SIMPLIFICATION.md +0 -333
- package/one/things/plans/README-SIMPLIFICATION.md +0 -349
- package/one/things/plans/SIMPLIFICATION-EXAMPLES.md +0 -16
- package/one/things/plans/SIMPLIFICATION-SUMMARY.md +0 -455
- package/one/things/plans/ai-elements-integration.md +0 -483
- package/one/things/plans/ai-elements.md +0 -1278
- package/one/things/plans/ai-integration-plan.md +0 -263
- package/one/things/plans/ai-integration.md +0 -996
- package/one/things/plans/ai-sdk.md +0 -798
- package/one/things/plans/ai-tools.md +0 -621
- package/one/things/plans/app.md +0 -832
- package/one/things/plans/architecture-summary.md +0 -312
- package/one/things/plans/async-ai-agents.md +0 -233
- package/one/things/plans/backend-agnostic-frontend.md +0 -390
- package/one/things/plans/backend-cleanup-quickstart.md +0 -380
- package/one/things/plans/backend-ontology-conformance.md +0 -475
- package/one/things/plans/backend-status.md +0 -599
- package/one/things/plans/backend-structure.md +0 -847
- package/one/things/plans/backend-target-structure.md +0 -482
- package/one/things/plans/backend.md +0 -1175
- package/one/things/plans/better-auth-any-backend-revised.md +0 -1103
- package/one/things/plans/better-auth-any-backend.md +0 -1896
- package/one/things/plans/better-auth-available-features.md +0 -273
- package/one/things/plans/big-plan.md +0 -52
- package/one/things/plans/cli-updates-required.md +0 -320
- package/one/things/plans/complete-step-by-step.md +0 -1409
- package/one/things/plans/components.md +0 -709
- package/one/things/plans/convex-agents.md +0 -1034
- package/one/things/plans/convex-better-auth.md +0 -1141
- package/one/things/plans/convex-on-off.md +0 -407
- package/one/things/plans/crypto-token-researcher.md +0 -629
- package/one/things/plans/data-quality-metrics.md +0 -745
- package/one/things/plans/deep-researcher-agent.md +0 -466
- package/one/things/plans/deploy-to-cloudflare.md +0 -623
- package/one/things/plans/deployment-architecture.md +0 -469
- package/one/things/plans/desktop.md +0 -1139
- package/one/things/plans/development-plan.md +0 -1283
- package/one/things/plans/development-workflow-tldr.md +0 -207
- package/one/things/plans/development-workflow.md +0 -959
- package/one/things/plans/dsl-claude-code.md +0 -1011
- package/one/things/plans/effect-components.md +0 -1743
- package/one/things/plans/effect-patterns-reference.md +0 -2235
- package/one/things/plans/effect.md +0 -1806
- package/one/things/plans/email.md +0 -966
- package/one/things/plans/enhance-auth.md +0 -1692
- package/one/things/plans/execution-strategy.md +0 -1291
- package/one/things/plans/existing-infrastructure.md +0 -712
- package/one/things/plans/feature-based-sites.md +0 -894
- package/one/things/plans/frontend-effects.md +0 -1276
- package/one/things/plans/group-folder-multi-tenancy.md +0 -893
- package/one/things/plans/improve-codebase.md +0 -1811
- package/one/things/plans/install-components.md +0 -215
- package/one/things/plans/integrate-frontend-and-backend.md +0 -603
- package/one/things/plans/landing.md +0 -820
- package/one/things/plans/layout.md +0 -249
- package/one/things/plans/mail-backend.md +0 -1361
- package/one/things/plans/mail.md +0 -2677
- package/one/things/plans/mcp-clear-context-prompt.md +0 -81
- package/one/things/plans/mcp-simple.md +0 -248
- package/one/things/plans/multi-ontology-architecture.md +0 -885
- package/one/things/plans/next-features.md +0 -114
- package/one/things/plans/npx-agent-safety.md +0 -785
- package/one/things/plans/npx-agent.md +0 -1089
- package/one/things/plans/onboarding.md +0 -51
- package/one/things/plans/one-protocol-and-payone-usage.md +0 -82
- package/one/things/plans/one.md +0 -677
- package/one/things/plans/ontology-6-dimensions.md +0 -2201
- package/one/things/plans/ontology-compliance-audit.md +0 -342
- package/one/things/plans/ontology-driven-strategy.md +0 -882
- package/one/things/plans/ontology-refine.md +0 -586
- package/one/things/plans/ontology-ui-approach.md +0 -375
- package/one/things/plans/open-agent.md +0 -840
- package/one/things/plans/performace.md +0 -122
- package/one/things/plans/phase-1-foundation.md +0 -620
- package/one/things/plans/phase-3-implementation.md +0 -1037
- package/one/things/plans/plan-connect-to-api.md +0 -146
- package/one/things/plans/quick-wins.md +0 -1428
- package/one/things/plans/r2.md +0 -777
- package/one/things/plans/readme-backend-cleanup.md +0 -402
- package/one/things/plans/release.md +0 -507
- package/one/things/plans/remove-backend-development-from-agents.md +0 -1331
- package/one/things/plans/repos.md +0 -98
- package/one/things/plans/separate-copy-2.md +0 -1349
- package/one/things/plans/separate-copy-3.md +0 -2479
- package/one/things/plans/separate-copy.md +0 -1349
- package/one/things/plans/separate-demo.md +0 -864
- package/one/things/plans/separate.md +0 -1999
- package/one/things/plans/sequence.md +0 -2040
- package/one/things/plans/shadcn-integration-summary.md +0 -510
- package/one/things/plans/sidebar.md +0 -206
- package/one/things/plans/skills.md +0 -709
- package/one/things/plans/small-fixes.md +0 -23
- package/one/things/plans/start-new.md +0 -764
- package/one/things/plans/switch-off-auth.md +0 -42
- package/one/things/plans/sync-checklist.md +0 -351
- package/one/things/plans/test-backend-connection.md +0 -514
- package/one/things/plans/unified-implementation-plan.md +0 -934
- package/one/things/plans/update-demos.md +0 -581
- package/one/things/plans/use-our-backend.md +0 -572
- package/one/things/plans/video-backend.md +0 -638
- package/one/things/plans/video-frontend.md +0 -490
- package/one/things/plans/video-old-archived.md +0 -656
- package/one/things/plans/wave1-onboarding-100-inferences.md +0 -1686
- package/one/things/plans/wave1-onboarding-vision.md +0 -744
- package/one/things/plans/wave1-orchestration-summary.md +0 -604
- package/one/things/plans/wave1-specialist-assignments.md +0 -1413
- package/one/things/plans/workflow-files.md +0 -1210
- package/one/things/plans/workflow.md +0 -1378
- package/one/things/plans-u.md +0 -905
- package/one/things/products/Blockchain Products.md +0 -6278
- package/one/things/products/cascade-landing-page.md +0 -841
- package/one/things/products/cascade.md +0 -1568
- package/one/things/products/context-engineering.md +0 -1488
- package/one/things/products/onthology.md +0 -15
- package/one/things/products/ontology-ui-shadcn.md +0 -1302
- package/one/things/products/ontology-ui.md +0 -1429
- package/one/things/products/ontology.md +0 -789
- package/one/things/products/sdk.md +0 -573
- package/one/things/promptkit.md +0 -930
- package/one/things/repos/all-repos.md +0 -0
- package/one/things/scripts-clean-mac.sh +0 -409
- package/one/things/service-providers-new.md +0 -1052
- package/one/things/service-providers.md +0 -1121
- package/one/things/structure.md +0 -532
- package/one/things/system.md +0 -618
- package/one/things/templates.md +0 -294
- package/one/things/tests/2-1-dataprovider-interface.md +0 -1216
- package/one/things/tests/2-1-test-analysis.md +0 -544
- package/one/things/things.md +0 -384
- package/one/things/todo-acp-integration.md +0 -744
- package/one/things/todo-ai.md +0 -933
- package/one/things/todo-api.md +0 -1078
- package/one/things/todo-assignment.md +0 -580
- package/one/things/todo-buy-chatgpt.md +0 -1450
- package/one/things/todo-components.md +0 -1683
- package/one/things/todo-connections.md +0 -278
- package/one/things/todo-ecommerce-frontend.md +0 -1313
- package/one/things/todo-ecommerce.md +0 -569
- package/one/things/todo-effects.md +0 -1075
- package/one/things/todo-frontend-effects.md +0 -977
- package/one/things/todo-landing-page.md +0 -1091
- package/one/things/todo-mail.md +0 -1160
- package/one/things/todo-master-plan.md +0 -490
- package/one/things/todo-onboard.md +0 -666
- package/one/things/todo-one-ie.md +0 -538
- package/one/things/todo-page.md +0 -606
- package/one/things/todo-plans.md +0 -282
- package/one/things/todo-projects.md +0 -241
- package/one/things/todo-refactoring-plan.md +0 -366
- package/one/things/todo-release.md +0 -654
- package/one/things/todo-sequence.md +0 -1621
- package/one/things/todo-use-our-backend.md +0 -1908
- package/one/things/todo-workflow.md +0 -626
- package/one/things/todo-x402.md +0 -2047
- package/one/things/todo.md +0 -21
- package/one/things/video/scripts-crypto.md +0 -835
- package/one/things/video-script-backup.md +0 -318
- package/one/things/video-script-demo.md +0 -382
- package/one/things/video-script-ontology.md +0 -333
- package/one/things/video-script.md +0 -361
package/one/paths/api.md
DELETED
|
@@ -1,2208 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Api
|
|
3
|
-
dimension: connections
|
|
4
|
-
category: api.md
|
|
5
|
-
tags: auth, backend, frontend
|
|
6
|
-
related_dimensions: people, things
|
|
7
|
-
scope: global
|
|
8
|
-
created: 2025-11-03
|
|
9
|
-
updated: 2025-11-03
|
|
10
|
-
version: 1.0.0
|
|
11
|
-
ai_context: |
|
|
12
|
-
This document is part of the connections dimension in the api.md category.
|
|
13
|
-
Location: one/connections/api.md
|
|
14
|
-
Purpose: Documents one platform - api reference
|
|
15
|
-
Related dimensions: people, things
|
|
16
|
-
For AI agents: Read this to understand api.
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
# ONE Platform - API Reference
|
|
20
|
-
|
|
21
|
-
**Version:** 1.0.0
|
|
22
|
-
**Last Updated:** 2025-01-15
|
|
23
|
-
**Purpose:** Complete API reference for Convex backend, service layer, and external integrations
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## Table of Contents
|
|
28
|
-
|
|
29
|
-
1. [Convex Backend API](#convex-backend-api)
|
|
30
|
-
2. [Effect.ts Service Layer](#effectts-service-layer)
|
|
31
|
-
3. [External Service Providers](#external-service-providers)
|
|
32
|
-
4. [Frontend Integration](#frontend-integration)
|
|
33
|
-
5. [Authentication API](#authentication-api)
|
|
34
|
-
6. [Schema Reference](#schema-reference)
|
|
35
|
-
7. [Error Handling](#error-handling)
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## Convex Backend API
|
|
40
|
-
|
|
41
|
-
### Core Function Types
|
|
42
|
-
|
|
43
|
-
The ONE platform uses Convex for real-time backend operations with three primary function types:
|
|
44
|
-
|
|
45
|
-
#### Queries (Read Operations)
|
|
46
|
-
|
|
47
|
-
**Purpose:** Read data, automatically cached, real-time reactive subscriptions
|
|
48
|
-
|
|
49
|
-
```typescript
|
|
50
|
-
// convex/queries/creators.ts
|
|
51
|
-
import { query } from "./_generated/server";
|
|
52
|
-
import { v } from "convex/values";
|
|
53
|
-
|
|
54
|
-
export const get = query({
|
|
55
|
-
args: { id: v.id("entities") },
|
|
56
|
-
handler: async (ctx, args) => {
|
|
57
|
-
const creator = await ctx.db.get(args.id);
|
|
58
|
-
|
|
59
|
-
if (!creator || creator.type !== "creator") {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Get relationships
|
|
64
|
-
const contentConnections = await ctx.db
|
|
65
|
-
.query("connections")
|
|
66
|
-
.withIndex("from_type", q =>
|
|
67
|
-
q.eq("fromEntityId", args.id)
|
|
68
|
-
.eq("relationshipType", "authored")
|
|
69
|
-
)
|
|
70
|
-
.collect();
|
|
71
|
-
|
|
72
|
-
return {
|
|
73
|
-
...creator,
|
|
74
|
-
contentCount: contentConnections.length
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
export const list = query({
|
|
80
|
-
args: {
|
|
81
|
-
limit: v.optional(v.number()),
|
|
82
|
-
niche: v.optional(v.string())
|
|
83
|
-
},
|
|
84
|
-
handler: async (ctx, args) => {
|
|
85
|
-
let query = ctx.db
|
|
86
|
-
.query("entities")
|
|
87
|
-
.withIndex("by_type", q => q.eq("type", "creator"))
|
|
88
|
-
.filter(q => q.eq(q.field("status"), "active"));
|
|
89
|
-
|
|
90
|
-
if (args.niche) {
|
|
91
|
-
query = query.filter(q =>
|
|
92
|
-
q.eq(q.field("properties.niche"), args.niche)
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return await query.take(args.limit || 20);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
**Key Features:**
|
|
102
|
-
- Automatic caching and invalidation
|
|
103
|
-
- Real-time subscriptions (updates push to clients)
|
|
104
|
-
- Can run in parallel
|
|
105
|
-
- Read-only (no database modifications)
|
|
106
|
-
|
|
107
|
-
#### Mutations (Write Operations)
|
|
108
|
-
|
|
109
|
-
**Purpose:** Write/modify data, transactional (all-or-nothing), optimistic UI updates
|
|
110
|
-
|
|
111
|
-
```typescript
|
|
112
|
-
// convex/mutations/creators.ts
|
|
113
|
-
import { mutation } from "./_generated/server";
|
|
114
|
-
import { v } from "convex/values";
|
|
115
|
-
|
|
116
|
-
export const create = mutation({
|
|
117
|
-
args: {
|
|
118
|
-
email: v.string(),
|
|
119
|
-
name: v.string(),
|
|
120
|
-
niche: v.array(v.string())
|
|
121
|
-
},
|
|
122
|
-
handler: async (ctx, args) => {
|
|
123
|
-
// Check uniqueness
|
|
124
|
-
const existing = await ctx.db
|
|
125
|
-
.query("entities")
|
|
126
|
-
.withIndex("by_type", q => q.eq("type", "creator"))
|
|
127
|
-
.filter(q => q.eq(q.field("properties.email"), args.email))
|
|
128
|
-
.first();
|
|
129
|
-
|
|
130
|
-
if (existing) {
|
|
131
|
-
throw new Error(`Creator with email ${args.email} already exists`);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Create entity
|
|
135
|
-
const creatorId = await ctx.db.insert("entities", {
|
|
136
|
-
type: "creator",
|
|
137
|
-
name: args.name,
|
|
138
|
-
properties: {
|
|
139
|
-
email: args.email,
|
|
140
|
-
username: args.email.split("@")[0],
|
|
141
|
-
displayName: args.name,
|
|
142
|
-
niche: args.niche,
|
|
143
|
-
expertise: [],
|
|
144
|
-
totalFollowers: 0,
|
|
145
|
-
totalContent: 0,
|
|
146
|
-
totalRevenue: 0
|
|
147
|
-
},
|
|
148
|
-
status: "active",
|
|
149
|
-
createdAt: Date.now(),
|
|
150
|
-
updatedAt: Date.now()
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
// Log creation event
|
|
154
|
-
await ctx.db.insert("events", {
|
|
155
|
-
type: "creator_created",
|
|
156
|
-
actorId: creatorId,
|
|
157
|
-
timestamp: Date.now(),
|
|
158
|
-
metadata: {
|
|
159
|
-
email: args.email,
|
|
160
|
-
niche: args.niche
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
return { creatorId };
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
export const update = mutation({
|
|
169
|
-
args: {
|
|
170
|
-
id: v.id("entities"),
|
|
171
|
-
bio: v.optional(v.string()),
|
|
172
|
-
niche: v.optional(v.array(v.string())),
|
|
173
|
-
avatar: v.optional(v.string())
|
|
174
|
-
},
|
|
175
|
-
handler: async (ctx, args) => {
|
|
176
|
-
const { id, ...updates } = args;
|
|
177
|
-
|
|
178
|
-
const current = await ctx.db.get(id);
|
|
179
|
-
if (!current || current.type !== "creator") {
|
|
180
|
-
throw new Error("Creator not found");
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// Merge updates
|
|
184
|
-
const newProperties = {
|
|
185
|
-
...current.properties,
|
|
186
|
-
...updates
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
await ctx.db.patch(id, {
|
|
190
|
-
properties: newProperties,
|
|
191
|
-
updatedAt: Date.now()
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
// Log update event
|
|
195
|
-
await ctx.db.insert("events", {
|
|
196
|
-
type: "creator_updated",
|
|
197
|
-
actorId: id,
|
|
198
|
-
timestamp: Date.now(),
|
|
199
|
-
metadata: {
|
|
200
|
-
updatedFields: Object.keys(updates)
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
return { success: true };
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
**Key Features:**
|
|
210
|
-
- Transactional (all succeed or all fail)
|
|
211
|
-
- Optimistic UI updates
|
|
212
|
-
- Validated with Convex validators
|
|
213
|
-
- Can schedule background actions
|
|
214
|
-
|
|
215
|
-
#### Actions (External API Calls)
|
|
216
|
-
|
|
217
|
-
**Purpose:** Call external services (OpenAI, Stripe, etc.), non-transactional, can be long-running
|
|
218
|
-
|
|
219
|
-
```typescript
|
|
220
|
-
// convex/actions/ai/clone-voice.ts
|
|
221
|
-
import { action } from "../../_generated/server";
|
|
222
|
-
import { v } from "convex/values";
|
|
223
|
-
import { api } from "../../_generated/api";
|
|
224
|
-
|
|
225
|
-
export const cloneVoice = action({
|
|
226
|
-
args: {
|
|
227
|
-
creatorId: v.id("entities"),
|
|
228
|
-
audioSamples: v.array(v.string())
|
|
229
|
-
},
|
|
230
|
-
handler: async (ctx, args) => {
|
|
231
|
-
// Call external ElevenLabs API
|
|
232
|
-
const response = await fetch("https://api.elevenlabs.io/v1/voices/add", {
|
|
233
|
-
method: "POST",
|
|
234
|
-
headers: {
|
|
235
|
-
"xi-api-key": process.env.ELEVENLABS_API_KEY!,
|
|
236
|
-
"Content-Type": "application/json",
|
|
237
|
-
},
|
|
238
|
-
body: JSON.stringify({
|
|
239
|
-
name: `Creator-${args.creatorId}`,
|
|
240
|
-
files: args.audioSamples,
|
|
241
|
-
}),
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
if (!response.ok) {
|
|
245
|
-
throw new Error(`ElevenLabs API error: ${response.statusText}`);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
const data = await response.json();
|
|
249
|
-
const voiceId = data.voice_id;
|
|
250
|
-
|
|
251
|
-
// Update creator entity with voice ID
|
|
252
|
-
await ctx.runMutation(api.creators.update, {
|
|
253
|
-
id: args.creatorId,
|
|
254
|
-
voiceId
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
return { voiceId };
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
**Key Features:**
|
|
263
|
-
- Can call external services
|
|
264
|
-
- Can call mutations/queries via `ctx.runMutation()` and `ctx.runQuery()`
|
|
265
|
-
- Not transactional (no automatic rollback)
|
|
266
|
-
- Access to `process.env` for secrets
|
|
267
|
-
|
|
268
|
-
#### Internal Functions
|
|
269
|
-
|
|
270
|
-
**Purpose:** Functions only callable from other Convex functions (not from clients)
|
|
271
|
-
|
|
272
|
-
```typescript
|
|
273
|
-
// convex/auth.ts (internal functions)
|
|
274
|
-
import { internalMutation, internalAction } from "./_generated/server";
|
|
275
|
-
import { v } from "convex/values";
|
|
276
|
-
import { Resend } from "@convex-dev/resend";
|
|
277
|
-
import { components } from "./_generated/api";
|
|
278
|
-
|
|
279
|
-
export const createPasswordResetToken = internalMutation({
|
|
280
|
-
args: { email: v.string() },
|
|
281
|
-
handler: async (ctx, args) => {
|
|
282
|
-
const user = await ctx.db
|
|
283
|
-
.query("users")
|
|
284
|
-
.withIndex("by_email", q => q.eq("email", args.email))
|
|
285
|
-
.unique();
|
|
286
|
-
|
|
287
|
-
if (!user) return null;
|
|
288
|
-
|
|
289
|
-
const token = crypto.randomUUID();
|
|
290
|
-
const expires = Date.now() + 3600000; // 1 hour
|
|
291
|
-
|
|
292
|
-
await ctx.db.insert("verificationTokens", {
|
|
293
|
-
identifier: args.email,
|
|
294
|
-
token,
|
|
295
|
-
expires,
|
|
296
|
-
type: "password_reset"
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
return { token, email: args.email };
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
export const sendPasswordResetEmailAction = internalAction({
|
|
304
|
-
args: { email: v.string(), resetLink: v.string() },
|
|
305
|
-
handler: async (ctx, args) => {
|
|
306
|
-
const resend = new Resend(components.resend, { testMode: false });
|
|
307
|
-
|
|
308
|
-
await resend.sendEmail(ctx, {
|
|
309
|
-
from: process.env.RESEND_FROM_EMAIL || "onboarding@resend.dev",
|
|
310
|
-
to: args.email,
|
|
311
|
-
subject: "Reset your password",
|
|
312
|
-
html: `
|
|
313
|
-
<h1>Reset your password</h1>
|
|
314
|
-
<p>Click the link below to reset your password:</p>
|
|
315
|
-
<a href="${args.resetLink}">Reset Password</a>
|
|
316
|
-
<p>This link expires in 1 hour.</p>
|
|
317
|
-
`,
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
### Database Operations
|
|
324
|
-
|
|
325
|
-
#### Basic CRUD
|
|
326
|
-
|
|
327
|
-
```typescript
|
|
328
|
-
// Insert
|
|
329
|
-
const id = await ctx.db.insert("entities", {
|
|
330
|
-
type: "creator",
|
|
331
|
-
name: "John Doe",
|
|
332
|
-
properties: {},
|
|
333
|
-
status: "active",
|
|
334
|
-
createdAt: Date.now(),
|
|
335
|
-
updatedAt: Date.now()
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
// Get by ID
|
|
339
|
-
const entity = await ctx.db.get(id);
|
|
340
|
-
|
|
341
|
-
// Update (partial)
|
|
342
|
-
await ctx.db.patch(id, {
|
|
343
|
-
properties: { bio: "Updated bio" },
|
|
344
|
-
updatedAt: Date.now()
|
|
345
|
-
});
|
|
346
|
-
|
|
347
|
-
// Replace (full)
|
|
348
|
-
await ctx.db.replace(id, {
|
|
349
|
-
type: "creator",
|
|
350
|
-
name: "John Doe",
|
|
351
|
-
properties: { bio: "New bio" },
|
|
352
|
-
status: "active",
|
|
353
|
-
createdAt: entity.createdAt,
|
|
354
|
-
updatedAt: Date.now()
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
// Delete
|
|
358
|
-
await ctx.db.delete(id);
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
#### Queries with Indexes
|
|
362
|
-
|
|
363
|
-
```typescript
|
|
364
|
-
// Query by index
|
|
365
|
-
const creators = await ctx.db
|
|
366
|
-
.query("entities")
|
|
367
|
-
.withIndex("by_type", q => q.eq("type", "creator"))
|
|
368
|
-
.collect();
|
|
369
|
-
|
|
370
|
-
// Compound index query
|
|
371
|
-
const activeCreators = await ctx.db
|
|
372
|
-
.query("entities")
|
|
373
|
-
.withIndex("by_type_status", q =>
|
|
374
|
-
q.eq("type", "creator").eq("status", "active")
|
|
375
|
-
)
|
|
376
|
-
.collect();
|
|
377
|
-
|
|
378
|
-
// Filter after index
|
|
379
|
-
const recentCreators = await ctx.db
|
|
380
|
-
.query("entities")
|
|
381
|
-
.withIndex("by_type", q => q.eq("type", "creator"))
|
|
382
|
-
.filter(q => q.gt(q.field("createdAt"), Date.now() - 86400000))
|
|
383
|
-
.order("desc")
|
|
384
|
-
.take(10);
|
|
385
|
-
|
|
386
|
-
// Unique result
|
|
387
|
-
const creator = await ctx.db
|
|
388
|
-
.query("entities")
|
|
389
|
-
.withIndex("by_type", q => q.eq("type", "creator"))
|
|
390
|
-
.filter(q => q.eq(q.field("properties.email"), email))
|
|
391
|
-
.unique();
|
|
392
|
-
|
|
393
|
-
// First result (optional)
|
|
394
|
-
const firstCreator = await ctx.db
|
|
395
|
-
.query("entities")
|
|
396
|
-
.withIndex("by_type", q => q.eq("type", "creator"))
|
|
397
|
-
.first();
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
#### Pagination
|
|
401
|
-
|
|
402
|
-
```typescript
|
|
403
|
-
import { paginationOptsValidator } from "convex/server";
|
|
404
|
-
|
|
405
|
-
export const listPaginated = query({
|
|
406
|
-
args: { paginationOpts: paginationOptsValidator },
|
|
407
|
-
handler: async (ctx, args) => {
|
|
408
|
-
return await ctx.db
|
|
409
|
-
.query("entities")
|
|
410
|
-
.withIndex("by_type", q => q.eq("type", "creator"))
|
|
411
|
-
.order("desc")
|
|
412
|
-
.paginate(args.paginationOpts);
|
|
413
|
-
}
|
|
414
|
-
});
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
#### Relationship Queries
|
|
418
|
-
|
|
419
|
-
```typescript
|
|
420
|
-
// Get all content authored by creator
|
|
421
|
-
const contentConnections = await ctx.db
|
|
422
|
-
.query("connections")
|
|
423
|
-
.withIndex("from_type", q =>
|
|
424
|
-
q.eq("fromEntityId", creatorId)
|
|
425
|
-
.eq("relationshipType", "authored")
|
|
426
|
-
)
|
|
427
|
-
.collect();
|
|
428
|
-
|
|
429
|
-
const content = await Promise.all(
|
|
430
|
-
contentConnections.map(conn => ctx.db.get(conn.toEntityId))
|
|
431
|
-
);
|
|
432
|
-
|
|
433
|
-
// Get all followers of creator
|
|
434
|
-
const followerConnections = await ctx.db
|
|
435
|
-
.query("connections")
|
|
436
|
-
.withIndex("to_type", q =>
|
|
437
|
-
q.eq("toEntityId", creatorId)
|
|
438
|
-
.eq("relationshipType", "following")
|
|
439
|
-
)
|
|
440
|
-
.collect();
|
|
441
|
-
|
|
442
|
-
// Bidirectional relationship check
|
|
443
|
-
const existingConnection = await ctx.db
|
|
444
|
-
.query("connections")
|
|
445
|
-
.withIndex("bidirectional", q =>
|
|
446
|
-
q.eq("fromEntityId", userId)
|
|
447
|
-
.eq("toEntityId", creatorId)
|
|
448
|
-
.eq("relationshipType", "following")
|
|
449
|
-
)
|
|
450
|
-
.unique();
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
### File Storage
|
|
454
|
-
|
|
455
|
-
```typescript
|
|
456
|
-
// Generate upload URL (mutation)
|
|
457
|
-
export const generateUploadUrl = mutation({
|
|
458
|
-
args: {},
|
|
459
|
-
handler: async (ctx) => {
|
|
460
|
-
return await ctx.storage.generateUploadUrl();
|
|
461
|
-
}
|
|
462
|
-
});
|
|
463
|
-
|
|
464
|
-
// Save file reference (mutation)
|
|
465
|
-
export const saveFile = mutation({
|
|
466
|
-
args: {
|
|
467
|
-
storageId: v.id("_storage"),
|
|
468
|
-
name: v.string(),
|
|
469
|
-
type: v.string(),
|
|
470
|
-
size: v.number()
|
|
471
|
-
},
|
|
472
|
-
handler: async (ctx, args) => {
|
|
473
|
-
const fileId = await ctx.db.insert("entities", {
|
|
474
|
-
type: "media_asset",
|
|
475
|
-
name: args.name,
|
|
476
|
-
properties: {
|
|
477
|
-
storageId: args.storageId,
|
|
478
|
-
fileType: args.type,
|
|
479
|
-
fileSize: args.size
|
|
480
|
-
},
|
|
481
|
-
status: "active",
|
|
482
|
-
createdAt: Date.now(),
|
|
483
|
-
updatedAt: Date.now()
|
|
484
|
-
});
|
|
485
|
-
|
|
486
|
-
return { fileId };
|
|
487
|
-
}
|
|
488
|
-
});
|
|
489
|
-
|
|
490
|
-
// Get file URL (mutation or action)
|
|
491
|
-
export const getFileUrl = mutation({
|
|
492
|
-
args: { storageId: v.id("_storage") },
|
|
493
|
-
handler: async (ctx, args) => {
|
|
494
|
-
return await ctx.storage.getUrl(args.storageId);
|
|
495
|
-
}
|
|
496
|
-
});
|
|
497
|
-
```
|
|
498
|
-
|
|
499
|
-
### Scheduled Functions (Crons)
|
|
500
|
-
|
|
501
|
-
```typescript
|
|
502
|
-
// convex/crons.ts
|
|
503
|
-
import { cronJobs } from "convex/server";
|
|
504
|
-
import { internal } from "./_generated/api";
|
|
505
|
-
|
|
506
|
-
const crons = cronJobs();
|
|
507
|
-
|
|
508
|
-
// Every hour
|
|
509
|
-
crons.interval(
|
|
510
|
-
"cleanup expired tokens",
|
|
511
|
-
{ minutes: 60 },
|
|
512
|
-
internal.auth.cleanupExpiredTokens
|
|
513
|
-
);
|
|
514
|
-
|
|
515
|
-
// Every day at midnight UTC
|
|
516
|
-
crons.daily(
|
|
517
|
-
"daily content generation",
|
|
518
|
-
{ hourUTC: 0, minuteUTC: 0 },
|
|
519
|
-
internal.content.generateDailyContent
|
|
520
|
-
);
|
|
521
|
-
|
|
522
|
-
// Every Monday at 9 AM UTC
|
|
523
|
-
crons.weekly(
|
|
524
|
-
"weekly analytics report",
|
|
525
|
-
{ hourUTC: 9, minuteUTC: 0, dayOfWeek: "monday" },
|
|
526
|
-
internal.analytics.generateWeeklyReport
|
|
527
|
-
);
|
|
528
|
-
|
|
529
|
-
// Every month on the 1st at 10 AM UTC
|
|
530
|
-
crons.monthly(
|
|
531
|
-
"monthly billing",
|
|
532
|
-
{ hourUTC: 10, minuteUTC: 0, day: 1 },
|
|
533
|
-
internal.billing.processMonthlyBilling
|
|
534
|
-
);
|
|
535
|
-
|
|
536
|
-
export default crons;
|
|
537
|
-
```
|
|
538
|
-
|
|
539
|
-
---
|
|
540
|
-
|
|
541
|
-
## Effect.ts Service Layer
|
|
542
|
-
|
|
543
|
-
### Service Architecture
|
|
544
|
-
|
|
545
|
-
Effect.ts services provide typed, composable business logic with automatic dependency injection.
|
|
546
|
-
|
|
547
|
-
#### Creating a Service
|
|
548
|
-
|
|
549
|
-
```typescript
|
|
550
|
-
// convex/services/tokens/purchase.ts
|
|
551
|
-
import { Effect } from "effect";
|
|
552
|
-
import { ConvexDatabase } from "../core/database";
|
|
553
|
-
import { StripeProvider } from "../providers/stripe";
|
|
554
|
-
import { BlockchainProvider } from "../providers/blockchain";
|
|
555
|
-
|
|
556
|
-
export class TokenService extends Effect.Service<TokenService>()(
|
|
557
|
-
"TokenService",
|
|
558
|
-
{
|
|
559
|
-
effect: Effect.gen(function* () {
|
|
560
|
-
const db = yield* ConvexDatabase;
|
|
561
|
-
const stripe = yield* StripeProvider;
|
|
562
|
-
const blockchain = yield* BlockchainProvider;
|
|
563
|
-
|
|
564
|
-
return {
|
|
565
|
-
purchase: ({
|
|
566
|
-
userId,
|
|
567
|
-
tokenId,
|
|
568
|
-
amount,
|
|
569
|
-
usdAmount
|
|
570
|
-
}: {
|
|
571
|
-
userId: Id<"entities">;
|
|
572
|
-
tokenId: Id<"entities">;
|
|
573
|
-
amount: number;
|
|
574
|
-
usdAmount: number;
|
|
575
|
-
}) =>
|
|
576
|
-
Effect.gen(function* () {
|
|
577
|
-
// All operations must succeed atomically
|
|
578
|
-
const [payment, tokens] = yield* Effect.all(
|
|
579
|
-
[
|
|
580
|
-
stripe.charge({
|
|
581
|
-
amount: usdAmount * 100,
|
|
582
|
-
currency: "usd",
|
|
583
|
-
metadata: { userId, tokenId, amount }
|
|
584
|
-
}),
|
|
585
|
-
blockchain.mint({
|
|
586
|
-
contractAddress: tokenId,
|
|
587
|
-
toAddress: userId,
|
|
588
|
-
amount
|
|
589
|
-
})
|
|
590
|
-
],
|
|
591
|
-
{ concurrency: 2 }
|
|
592
|
-
);
|
|
593
|
-
|
|
594
|
-
// Record in database
|
|
595
|
-
yield* db.insert("events", {
|
|
596
|
-
type: "tokens_purchased",
|
|
597
|
-
actorId: userId,
|
|
598
|
-
targetId: tokenId,
|
|
599
|
-
timestamp: Date.now(),
|
|
600
|
-
metadata: {
|
|
601
|
-
amount,
|
|
602
|
-
usdAmount,
|
|
603
|
-
paymentId: payment.id,
|
|
604
|
-
txHash: tokens.transactionHash
|
|
605
|
-
}
|
|
606
|
-
});
|
|
607
|
-
|
|
608
|
-
// Update balance
|
|
609
|
-
yield* db.upsert("connections", {
|
|
610
|
-
fromEntityId: userId,
|
|
611
|
-
toEntityId: tokenId,
|
|
612
|
-
relationshipType: "holds_tokens",
|
|
613
|
-
metadata: { balance: amount }
|
|
614
|
-
});
|
|
615
|
-
|
|
616
|
-
return {
|
|
617
|
-
paymentId: payment.id,
|
|
618
|
-
txHash: tokens.transactionHash,
|
|
619
|
-
amount
|
|
620
|
-
};
|
|
621
|
-
}).pipe(
|
|
622
|
-
// Automatic rollback on error
|
|
623
|
-
Effect.onError((error) =>
|
|
624
|
-
Effect.all([
|
|
625
|
-
stripe.refund(payment.id),
|
|
626
|
-
blockchain.burn({ contractAddress: tokenId, amount })
|
|
627
|
-
])
|
|
628
|
-
),
|
|
629
|
-
Effect.retry({ times: 3 }),
|
|
630
|
-
Effect.timeout("5 minutes"),
|
|
631
|
-
Effect.withSpan("purchaseTokens", {
|
|
632
|
-
attributes: { userId, tokenId, amount }
|
|
633
|
-
})
|
|
634
|
-
)
|
|
635
|
-
};
|
|
636
|
-
}),
|
|
637
|
-
dependencies: [
|
|
638
|
-
ConvexDatabase.Default,
|
|
639
|
-
StripeProvider.Default,
|
|
640
|
-
BlockchainProvider.Default
|
|
641
|
-
]
|
|
642
|
-
}
|
|
643
|
-
) {}
|
|
644
|
-
```
|
|
645
|
-
|
|
646
|
-
#### Using Services in Convex Functions
|
|
647
|
-
|
|
648
|
-
```typescript
|
|
649
|
-
// convex/mutations/tokens.ts
|
|
650
|
-
import { confect } from "convex-helpers/server/confect";
|
|
651
|
-
import { v } from "convex/values";
|
|
652
|
-
import { Effect } from "effect";
|
|
653
|
-
import { TokenService } from "../services/tokens/purchase";
|
|
654
|
-
import { MainLayer } from "../services";
|
|
655
|
-
|
|
656
|
-
export const purchase = confect.mutation({
|
|
657
|
-
args: {
|
|
658
|
-
tokenId: v.id("entities"),
|
|
659
|
-
amount: v.number(),
|
|
660
|
-
usdAmount: v.number()
|
|
661
|
-
},
|
|
662
|
-
handler: (ctx, args) =>
|
|
663
|
-
Effect.gen(function* () {
|
|
664
|
-
const userId = yield* getUserId(ctx);
|
|
665
|
-
const tokenService = yield* TokenService;
|
|
666
|
-
|
|
667
|
-
return yield* tokenService.purchase({
|
|
668
|
-
userId,
|
|
669
|
-
tokenId: args.tokenId,
|
|
670
|
-
amount: args.amount,
|
|
671
|
-
usdAmount: args.usdAmount
|
|
672
|
-
});
|
|
673
|
-
}).pipe(
|
|
674
|
-
Effect.provide(MainLayer),
|
|
675
|
-
Effect.catchTags({
|
|
676
|
-
StripeError: (error) =>
|
|
677
|
-
Effect.fail(new ConvexError({
|
|
678
|
-
message: `Payment failed: ${error.message}`
|
|
679
|
-
})),
|
|
680
|
-
BlockchainError: (error) =>
|
|
681
|
-
Effect.fail(new ConvexError({
|
|
682
|
-
message: `Token minting failed: ${error.message}`
|
|
683
|
-
}))
|
|
684
|
-
})
|
|
685
|
-
)
|
|
686
|
-
});
|
|
687
|
-
```
|
|
688
|
-
|
|
689
|
-
### Typed Errors
|
|
690
|
-
|
|
691
|
-
```typescript
|
|
692
|
-
// convex/services/errors.ts
|
|
693
|
-
export class NotFoundError {
|
|
694
|
-
readonly _tag = "NotFoundError";
|
|
695
|
-
constructor(
|
|
696
|
-
readonly message: string,
|
|
697
|
-
readonly entityId?: string
|
|
698
|
-
) {}
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
export class ValidationError {
|
|
702
|
-
readonly _tag = "ValidationError";
|
|
703
|
-
constructor(
|
|
704
|
-
readonly field: string,
|
|
705
|
-
readonly message: string
|
|
706
|
-
) {}
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
export class InsufficientTokensError {
|
|
710
|
-
readonly _tag = "InsufficientTokensError";
|
|
711
|
-
constructor(
|
|
712
|
-
readonly userId: string,
|
|
713
|
-
readonly required: number,
|
|
714
|
-
readonly available: number
|
|
715
|
-
) {}
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
export class PaymentFailedError {
|
|
719
|
-
readonly _tag = "PaymentFailedError";
|
|
720
|
-
constructor(
|
|
721
|
-
readonly message: string,
|
|
722
|
-
readonly code?: string
|
|
723
|
-
) {}
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
// Usage with typed error handling
|
|
727
|
-
Effect.gen(function* () {
|
|
728
|
-
const result = yield* tokenService.purchase(args);
|
|
729
|
-
return result;
|
|
730
|
-
}).pipe(
|
|
731
|
-
Effect.catchTag("InsufficientTokensError", (error) =>
|
|
732
|
-
Effect.succeed({
|
|
733
|
-
error: `You need ${error.required} tokens but only have ${error.available}`
|
|
734
|
-
})
|
|
735
|
-
),
|
|
736
|
-
Effect.catchTag("PaymentFailedError", (error) =>
|
|
737
|
-
Effect.succeed({
|
|
738
|
-
error: `Payment failed: ${error.message}`
|
|
739
|
-
})
|
|
740
|
-
)
|
|
741
|
-
)
|
|
742
|
-
```
|
|
743
|
-
|
|
744
|
-
---
|
|
745
|
-
|
|
746
|
-
## External Service Providers
|
|
747
|
-
|
|
748
|
-
### OpenAI Provider
|
|
749
|
-
|
|
750
|
-
```typescript
|
|
751
|
-
// convex/services/providers/openai.ts
|
|
752
|
-
import { Effect } from "effect";
|
|
753
|
-
|
|
754
|
-
export class OpenAIProvider extends Effect.Service<OpenAIProvider>()(
|
|
755
|
-
"OpenAIProvider",
|
|
756
|
-
{
|
|
757
|
-
effect: Effect.gen(function* () {
|
|
758
|
-
return {
|
|
759
|
-
chat: ({
|
|
760
|
-
systemPrompt,
|
|
761
|
-
messages,
|
|
762
|
-
temperature = 0.7
|
|
763
|
-
}: {
|
|
764
|
-
systemPrompt: string;
|
|
765
|
-
messages: Array<{ role: string; content: string }>;
|
|
766
|
-
temperature?: number;
|
|
767
|
-
}) =>
|
|
768
|
-
Effect.tryPromise({
|
|
769
|
-
try: async () => {
|
|
770
|
-
const response = await fetch(
|
|
771
|
-
"https://api.openai.com/v1/chat/completions",
|
|
772
|
-
{
|
|
773
|
-
method: "POST",
|
|
774
|
-
headers: {
|
|
775
|
-
"Authorization": `Bearer ${process.env.OPENAI_API_KEY}`,
|
|
776
|
-
"Content-Type": "application/json",
|
|
777
|
-
},
|
|
778
|
-
body: JSON.stringify({
|
|
779
|
-
model: "gpt-4-turbo-preview",
|
|
780
|
-
messages: [
|
|
781
|
-
{ role: "system", content: systemPrompt },
|
|
782
|
-
...messages
|
|
783
|
-
],
|
|
784
|
-
temperature
|
|
785
|
-
}),
|
|
786
|
-
}
|
|
787
|
-
);
|
|
788
|
-
|
|
789
|
-
const data = await response.json();
|
|
790
|
-
return {
|
|
791
|
-
content: data.choices[0].message.content,
|
|
792
|
-
usage: data.usage
|
|
793
|
-
};
|
|
794
|
-
},
|
|
795
|
-
catch: (error) => new OpenAIError(String(error))
|
|
796
|
-
}),
|
|
797
|
-
|
|
798
|
-
embed: (text: string) =>
|
|
799
|
-
Effect.tryPromise({
|
|
800
|
-
try: async () => {
|
|
801
|
-
const response = await fetch(
|
|
802
|
-
"https://api.openai.com/v1/embeddings",
|
|
803
|
-
{
|
|
804
|
-
method: "POST",
|
|
805
|
-
headers: {
|
|
806
|
-
"Authorization": `Bearer ${process.env.OPENAI_API_KEY}`,
|
|
807
|
-
"Content-Type": "application/json",
|
|
808
|
-
},
|
|
809
|
-
body: JSON.stringify({
|
|
810
|
-
model: "text-embedding-ada-002",
|
|
811
|
-
input: text
|
|
812
|
-
}),
|
|
813
|
-
}
|
|
814
|
-
);
|
|
815
|
-
|
|
816
|
-
const data = await response.json();
|
|
817
|
-
return data.data[0].embedding;
|
|
818
|
-
},
|
|
819
|
-
catch: (error) => new OpenAIError(String(error))
|
|
820
|
-
})
|
|
821
|
-
};
|
|
822
|
-
})
|
|
823
|
-
}
|
|
824
|
-
) {}
|
|
825
|
-
|
|
826
|
-
class OpenAIError {
|
|
827
|
-
readonly _tag = "OpenAIError";
|
|
828
|
-
constructor(readonly message: string) {}
|
|
829
|
-
}
|
|
830
|
-
```
|
|
831
|
-
|
|
832
|
-
### Stripe Provider
|
|
833
|
-
|
|
834
|
-
```typescript
|
|
835
|
-
// convex/services/providers/stripe.ts
|
|
836
|
-
import { Effect } from "effect";
|
|
837
|
-
import Stripe from "stripe";
|
|
838
|
-
|
|
839
|
-
export class StripeProvider extends Effect.Service<StripeProvider>()(
|
|
840
|
-
"StripeProvider",
|
|
841
|
-
{
|
|
842
|
-
effect: Effect.gen(function* () {
|
|
843
|
-
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {
|
|
844
|
-
apiVersion: "2023-10-16"
|
|
845
|
-
});
|
|
846
|
-
|
|
847
|
-
return {
|
|
848
|
-
charge: ({
|
|
849
|
-
amount,
|
|
850
|
-
currency,
|
|
851
|
-
metadata
|
|
852
|
-
}: {
|
|
853
|
-
amount: number;
|
|
854
|
-
currency: string;
|
|
855
|
-
metadata?: Record<string, string>;
|
|
856
|
-
}) =>
|
|
857
|
-
Effect.tryPromise({
|
|
858
|
-
try: async () => {
|
|
859
|
-
const paymentIntent = await stripe.paymentIntents.create({
|
|
860
|
-
amount,
|
|
861
|
-
currency,
|
|
862
|
-
metadata
|
|
863
|
-
});
|
|
864
|
-
return paymentIntent;
|
|
865
|
-
},
|
|
866
|
-
catch: (error) => new StripeError(String(error))
|
|
867
|
-
}),
|
|
868
|
-
|
|
869
|
-
refund: (paymentIntentId: string) =>
|
|
870
|
-
Effect.tryPromise({
|
|
871
|
-
try: async () => {
|
|
872
|
-
const refund = await stripe.refunds.create({
|
|
873
|
-
payment_intent: paymentIntentId
|
|
874
|
-
});
|
|
875
|
-
return refund;
|
|
876
|
-
},
|
|
877
|
-
catch: (error) => new StripeError(String(error))
|
|
878
|
-
})
|
|
879
|
-
};
|
|
880
|
-
})
|
|
881
|
-
}
|
|
882
|
-
) {}
|
|
883
|
-
|
|
884
|
-
class StripeError {
|
|
885
|
-
readonly _tag = "StripeError";
|
|
886
|
-
constructor(readonly message: string) {}
|
|
887
|
-
}
|
|
888
|
-
```
|
|
889
|
-
|
|
890
|
-
### Blockchain Provider
|
|
891
|
-
|
|
892
|
-
```typescript
|
|
893
|
-
// convex/services/providers/blockchain.ts
|
|
894
|
-
import { Effect } from "effect";
|
|
895
|
-
import { ethers } from "ethers";
|
|
896
|
-
|
|
897
|
-
export class BlockchainProvider extends Effect.Service<BlockchainProvider>()(
|
|
898
|
-
"BlockchainProvider",
|
|
899
|
-
{
|
|
900
|
-
effect: Effect.gen(function* () {
|
|
901
|
-
const provider = new ethers.JsonRpcProvider(process.env.BASE_RPC_URL);
|
|
902
|
-
const wallet = new ethers.Wallet(
|
|
903
|
-
process.env.DEPLOYER_PRIVATE_KEY!,
|
|
904
|
-
provider
|
|
905
|
-
);
|
|
906
|
-
|
|
907
|
-
return {
|
|
908
|
-
mint: ({
|
|
909
|
-
contractAddress,
|
|
910
|
-
toAddress,
|
|
911
|
-
amount
|
|
912
|
-
}: {
|
|
913
|
-
contractAddress: string;
|
|
914
|
-
toAddress: string;
|
|
915
|
-
amount: number;
|
|
916
|
-
}) =>
|
|
917
|
-
Effect.tryPromise({
|
|
918
|
-
try: async () => {
|
|
919
|
-
const contract = new ethers.Contract(
|
|
920
|
-
contractAddress,
|
|
921
|
-
["function mint(address to, uint256 amount)"],
|
|
922
|
-
wallet
|
|
923
|
-
);
|
|
924
|
-
|
|
925
|
-
const tx = await contract.mint(toAddress, amount);
|
|
926
|
-
const receipt = await tx.wait();
|
|
927
|
-
|
|
928
|
-
return {
|
|
929
|
-
transactionHash: receipt.hash,
|
|
930
|
-
blockNumber: receipt.blockNumber
|
|
931
|
-
};
|
|
932
|
-
},
|
|
933
|
-
catch: (error) => new BlockchainError(String(error))
|
|
934
|
-
}),
|
|
935
|
-
|
|
936
|
-
burn: ({
|
|
937
|
-
contractAddress,
|
|
938
|
-
amount
|
|
939
|
-
}: {
|
|
940
|
-
contractAddress: string;
|
|
941
|
-
amount: number;
|
|
942
|
-
}) =>
|
|
943
|
-
Effect.tryPromise({
|
|
944
|
-
try: async () => {
|
|
945
|
-
const contract = new ethers.Contract(
|
|
946
|
-
contractAddress,
|
|
947
|
-
["function burn(uint256 amount)"],
|
|
948
|
-
wallet
|
|
949
|
-
);
|
|
950
|
-
|
|
951
|
-
const tx = await contract.burn(amount);
|
|
952
|
-
const receipt = await tx.wait();
|
|
953
|
-
|
|
954
|
-
return {
|
|
955
|
-
transactionHash: receipt.hash,
|
|
956
|
-
blockNumber: receipt.blockNumber
|
|
957
|
-
};
|
|
958
|
-
},
|
|
959
|
-
catch: (error) => new BlockchainError(String(error))
|
|
960
|
-
})
|
|
961
|
-
};
|
|
962
|
-
})
|
|
963
|
-
}
|
|
964
|
-
) {}
|
|
965
|
-
|
|
966
|
-
class BlockchainError {
|
|
967
|
-
readonly _tag = "BlockchainError";
|
|
968
|
-
constructor(readonly message: string) {}
|
|
969
|
-
}
|
|
970
|
-
```
|
|
971
|
-
|
|
972
|
-
---
|
|
973
|
-
|
|
974
|
-
## Frontend Integration
|
|
975
|
-
|
|
976
|
-
### React Components with Convex Hooks
|
|
977
|
-
|
|
978
|
-
```typescript
|
|
979
|
-
// src/components/features/tokens/TokenPurchase.tsx
|
|
980
|
-
import { useQuery, useMutation } from "convex/react";
|
|
981
|
-
import { api } from "@/convex/_generated/api";
|
|
982
|
-
import { Id } from "@/convex/_generated/dataModel";
|
|
983
|
-
import { Button } from "@/components/ui/button";
|
|
984
|
-
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
|
985
|
-
import { Skeleton } from "@/components/ui/skeleton";
|
|
986
|
-
import { Alert, AlertDescription } from "@/components/ui/alert";
|
|
987
|
-
import { useState } from "react";
|
|
988
|
-
|
|
989
|
-
interface TokenPurchaseProps {
|
|
990
|
-
tokenId: Id<"entities">;
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
export function TokenPurchase({ tokenId }: TokenPurchaseProps) {
|
|
994
|
-
const token = useQuery(api.tokens.get, { id: tokenId });
|
|
995
|
-
const balance = useQuery(api.tokens.getBalance, { tokenId });
|
|
996
|
-
const purchase = useMutation(api.tokens.purchase);
|
|
997
|
-
|
|
998
|
-
const [amount, setAmount] = useState(100);
|
|
999
|
-
const [error, setError] = useState<string | null>(null);
|
|
1000
|
-
const [loading, setLoading] = useState(false);
|
|
1001
|
-
|
|
1002
|
-
// Loading state
|
|
1003
|
-
if (token === undefined || balance === undefined) {
|
|
1004
|
-
return (
|
|
1005
|
-
<Card>
|
|
1006
|
-
<CardHeader>
|
|
1007
|
-
<Skeleton className="h-6 w-48" />
|
|
1008
|
-
</CardHeader>
|
|
1009
|
-
<CardContent>
|
|
1010
|
-
<Skeleton className="h-24 w-full" />
|
|
1011
|
-
</CardContent>
|
|
1012
|
-
</Card>
|
|
1013
|
-
);
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
// Error state
|
|
1017
|
-
if (token === null) {
|
|
1018
|
-
return (
|
|
1019
|
-
<Card>
|
|
1020
|
-
<CardContent className="py-6">
|
|
1021
|
-
<Alert variant="destructive">
|
|
1022
|
-
<AlertDescription>Token not found</AlertDescription>
|
|
1023
|
-
</Alert>
|
|
1024
|
-
</CardContent>
|
|
1025
|
-
</Card>
|
|
1026
|
-
);
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
const handlePurchase = async () => {
|
|
1030
|
-
setLoading(true);
|
|
1031
|
-
setError(null);
|
|
1032
|
-
|
|
1033
|
-
try {
|
|
1034
|
-
await purchase({
|
|
1035
|
-
tokenId,
|
|
1036
|
-
amount,
|
|
1037
|
-
usdAmount: amount * token.properties.priceUsd
|
|
1038
|
-
});
|
|
1039
|
-
} catch (err) {
|
|
1040
|
-
setError(err.message);
|
|
1041
|
-
} finally {
|
|
1042
|
-
setLoading(false);
|
|
1043
|
-
}
|
|
1044
|
-
};
|
|
1045
|
-
|
|
1046
|
-
return (
|
|
1047
|
-
<Card>
|
|
1048
|
-
<CardHeader>
|
|
1049
|
-
<CardTitle>Purchase {token.name}</CardTitle>
|
|
1050
|
-
</CardHeader>
|
|
1051
|
-
<CardContent className="space-y-4">
|
|
1052
|
-
<div>
|
|
1053
|
-
<p className="text-sm text-muted-foreground">Current Balance</p>
|
|
1054
|
-
<p className="text-2xl font-bold">{balance?.amount || 0}</p>
|
|
1055
|
-
</div>
|
|
1056
|
-
|
|
1057
|
-
<div>
|
|
1058
|
-
<label className="text-sm font-medium">Amount</label>
|
|
1059
|
-
<input
|
|
1060
|
-
type="number"
|
|
1061
|
-
value={amount}
|
|
1062
|
-
onChange={(e) => setAmount(Number(e.target.value))}
|
|
1063
|
-
className="w-full px-3 py-2 border rounded"
|
|
1064
|
-
/>
|
|
1065
|
-
</div>
|
|
1066
|
-
|
|
1067
|
-
<div>
|
|
1068
|
-
<p className="text-sm text-muted-foreground">Total Cost</p>
|
|
1069
|
-
<p className="text-xl font-bold">
|
|
1070
|
-
${(amount * token.properties.priceUsd).toFixed(2)}
|
|
1071
|
-
</p>
|
|
1072
|
-
</div>
|
|
1073
|
-
|
|
1074
|
-
{error && (
|
|
1075
|
-
<Alert variant="destructive">
|
|
1076
|
-
<AlertDescription>{error}</AlertDescription>
|
|
1077
|
-
</Alert>
|
|
1078
|
-
)}
|
|
1079
|
-
|
|
1080
|
-
<Button
|
|
1081
|
-
onClick={handlePurchase}
|
|
1082
|
-
disabled={loading || amount <= 0}
|
|
1083
|
-
className="w-full"
|
|
1084
|
-
>
|
|
1085
|
-
{loading ? "Processing..." : `Buy ${amount} Tokens`}
|
|
1086
|
-
</Button>
|
|
1087
|
-
</CardContent>
|
|
1088
|
-
</Card>
|
|
1089
|
-
);
|
|
1090
|
-
}
|
|
1091
|
-
```
|
|
1092
|
-
|
|
1093
|
-
### Astro Pages with SSR
|
|
1094
|
-
|
|
1095
|
-
```astro
|
|
1096
|
-
---
|
|
1097
|
-
// src/pages/tokens/[id].astro
|
|
1098
|
-
import { ConvexHttpClient } from "convex/browser";
|
|
1099
|
-
import { api } from "@/convex/_generated/api";
|
|
1100
|
-
import Layout from "@/layouts/Layout.astro";
|
|
1101
|
-
import { TokenPurchase } from "@/components/features/tokens/TokenPurchase";
|
|
1102
|
-
|
|
1103
|
-
const convex = new ConvexHttpClient(import.meta.env.PUBLIC_CONVEX_URL);
|
|
1104
|
-
const token = await convex.query(api.tokens.get, { id: Astro.params.id as any });
|
|
1105
|
-
|
|
1106
|
-
if (!token) {
|
|
1107
|
-
return Astro.redirect("/404");
|
|
1108
|
-
}
|
|
1109
|
-
---
|
|
1110
|
-
|
|
1111
|
-
<Layout title={`${token.name} - Token Details`}>
|
|
1112
|
-
<div class="container mx-auto py-12">
|
|
1113
|
-
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
|
|
1114
|
-
<div>
|
|
1115
|
-
<h1 class="text-4xl font-bold mb-4">{token.name}</h1>
|
|
1116
|
-
<p class="text-lg text-muted-foreground mb-6">
|
|
1117
|
-
{token.properties.description}
|
|
1118
|
-
</p>
|
|
1119
|
-
|
|
1120
|
-
<div class="space-y-4">
|
|
1121
|
-
<div>
|
|
1122
|
-
<p class="text-sm text-muted-foreground">Price</p>
|
|
1123
|
-
<p class="text-2xl font-bold">
|
|
1124
|
-
${token.properties.priceUsd.toFixed(2)}
|
|
1125
|
-
</p>
|
|
1126
|
-
</div>
|
|
1127
|
-
|
|
1128
|
-
<div>
|
|
1129
|
-
<p class="text-sm text-muted-foreground">Total Supply</p>
|
|
1130
|
-
<p class="text-2xl font-bold">
|
|
1131
|
-
{token.properties.totalSupply.toLocaleString()}
|
|
1132
|
-
</p>
|
|
1133
|
-
</div>
|
|
1134
|
-
</div>
|
|
1135
|
-
</div>
|
|
1136
|
-
|
|
1137
|
-
<div>
|
|
1138
|
-
<TokenPurchase client:load tokenId={token._id} />
|
|
1139
|
-
</div>
|
|
1140
|
-
</div>
|
|
1141
|
-
</div>
|
|
1142
|
-
</Layout>
|
|
1143
|
-
```
|
|
1144
|
-
|
|
1145
|
-
---
|
|
1146
|
-
|
|
1147
|
-
## Authentication API
|
|
1148
|
-
|
|
1149
|
-
### Better Auth Integration
|
|
1150
|
-
|
|
1151
|
-
The ONE platform uses Better Auth for authentication, not Convex Auth.
|
|
1152
|
-
|
|
1153
|
-
#### Auth Configuration
|
|
1154
|
-
|
|
1155
|
-
```typescript
|
|
1156
|
-
// convex/auth.config.ts
|
|
1157
|
-
import { betterAuth } from "better-auth";
|
|
1158
|
-
import { convexAdapter } from "better-auth/adapters/convex";
|
|
1159
|
-
|
|
1160
|
-
export const auth = betterAuth({
|
|
1161
|
-
database: convexAdapter(),
|
|
1162
|
-
emailAndPassword: {
|
|
1163
|
-
enabled: true,
|
|
1164
|
-
requireEmailVerification: true,
|
|
1165
|
-
},
|
|
1166
|
-
socialProviders: {
|
|
1167
|
-
github: {
|
|
1168
|
-
clientId: process.env.GITHUB_CLIENT_ID!,
|
|
1169
|
-
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
|
1170
|
-
},
|
|
1171
|
-
google: {
|
|
1172
|
-
clientId: process.env.GOOGLE_CLIENT_ID!,
|
|
1173
|
-
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
|
|
1174
|
-
},
|
|
1175
|
-
},
|
|
1176
|
-
});
|
|
1177
|
-
```
|
|
1178
|
-
|
|
1179
|
-
#### Auth Helpers
|
|
1180
|
-
|
|
1181
|
-
```typescript
|
|
1182
|
-
// convex/auth.ts
|
|
1183
|
-
import { query, mutation, internalMutation, internalAction } from "./_generated/server";
|
|
1184
|
-
import { v } from "convex/values";
|
|
1185
|
-
import { Resend } from "@convex-dev/resend";
|
|
1186
|
-
import { components } from "./_generated/api";
|
|
1187
|
-
import { internal } from "./_generated/api";
|
|
1188
|
-
|
|
1189
|
-
export const getUserId = async (ctx: any): Promise<string | null> => {
|
|
1190
|
-
const identity = await ctx.auth.getUserIdentity();
|
|
1191
|
-
if (!identity) return null;
|
|
1192
|
-
|
|
1193
|
-
const user = await ctx.db
|
|
1194
|
-
.query("users")
|
|
1195
|
-
.withIndex("by_token", q => q.eq("tokenIdentifier", identity.tokenIdentifier))
|
|
1196
|
-
.unique();
|
|
1197
|
-
|
|
1198
|
-
return user?._id || null;
|
|
1199
|
-
};
|
|
1200
|
-
|
|
1201
|
-
export const requestPasswordReset = mutation({
|
|
1202
|
-
args: { email: v.string(), baseUrl: v.string() },
|
|
1203
|
-
handler: async (ctx, args) => {
|
|
1204
|
-
const result = await ctx.runMutation(internal.auth.createPasswordResetToken, {
|
|
1205
|
-
email: args.email,
|
|
1206
|
-
});
|
|
1207
|
-
|
|
1208
|
-
if (!result) return { success: true };
|
|
1209
|
-
|
|
1210
|
-
const resetLink = `${args.baseUrl}/reset-password?token=${result.token}`;
|
|
1211
|
-
|
|
1212
|
-
await ctx.scheduler.runAfter(0, internal.auth.sendPasswordResetEmailAction, {
|
|
1213
|
-
email: result.email,
|
|
1214
|
-
resetLink,
|
|
1215
|
-
});
|
|
1216
|
-
|
|
1217
|
-
return { success: true };
|
|
1218
|
-
},
|
|
1219
|
-
});
|
|
1220
|
-
|
|
1221
|
-
export const createPasswordResetToken = internalMutation({
|
|
1222
|
-
args: { email: v.string() },
|
|
1223
|
-
handler: async (ctx, args) => {
|
|
1224
|
-
const user = await ctx.db
|
|
1225
|
-
.query("users")
|
|
1226
|
-
.withIndex("by_email", q => q.eq("email", args.email))
|
|
1227
|
-
.unique();
|
|
1228
|
-
|
|
1229
|
-
if (!user) return null;
|
|
1230
|
-
|
|
1231
|
-
const token = crypto.randomUUID();
|
|
1232
|
-
const expires = Date.now() + 3600000; // 1 hour
|
|
1233
|
-
|
|
1234
|
-
await ctx.db.insert("verificationTokens", {
|
|
1235
|
-
identifier: args.email,
|
|
1236
|
-
token,
|
|
1237
|
-
expires,
|
|
1238
|
-
type: "password_reset"
|
|
1239
|
-
});
|
|
1240
|
-
|
|
1241
|
-
return { token, email: args.email };
|
|
1242
|
-
},
|
|
1243
|
-
});
|
|
1244
|
-
|
|
1245
|
-
export const sendPasswordResetEmailAction = internalAction({
|
|
1246
|
-
args: { email: v.string(), resetLink: v.string() },
|
|
1247
|
-
handler: async (ctx, args) => {
|
|
1248
|
-
const resend = new Resend(components.resend, { testMode: false });
|
|
1249
|
-
|
|
1250
|
-
await resend.sendEmail(ctx, {
|
|
1251
|
-
from: process.env.RESEND_FROM_EMAIL || "onboarding@resend.dev",
|
|
1252
|
-
to: args.email,
|
|
1253
|
-
subject: "Reset your password",
|
|
1254
|
-
html: `<a href="${args.resetLink}">Reset Password</a>`,
|
|
1255
|
-
});
|
|
1256
|
-
},
|
|
1257
|
-
});
|
|
1258
|
-
```
|
|
1259
|
-
|
|
1260
|
-
---
|
|
1261
|
-
|
|
1262
|
-
## Schema Reference (6-Dimension Ontology)
|
|
1263
|
-
|
|
1264
|
-
The ONE platform uses a **6-dimension ontology** where every feature maps to one of these dimensions:
|
|
1265
|
-
|
|
1266
|
-
```
|
|
1267
|
-
┌──────────────────────────────────────────────────────────────┐
|
|
1268
|
-
│ ORGANIZATIONS TABLE │
|
|
1269
|
-
│ Multi-tenant isolation - who owns what at org level │
|
|
1270
|
-
└──────────────────────────────────────────────────────────────┘
|
|
1271
|
-
↓
|
|
1272
|
-
┌──────────────────────────────────────────────────────────────┐
|
|
1273
|
-
│ PEOPLE TABLE │
|
|
1274
|
-
│ Authorization & governance - who can do what │
|
|
1275
|
-
└──────────────────────────────────────────────────────────────┘
|
|
1276
|
-
↓
|
|
1277
|
-
┌──────────────────────────────────────────────────────────────┐
|
|
1278
|
-
│ THINGS TABLE │
|
|
1279
|
-
│ Every "thing" - users, agents, content, tokens, courses │
|
|
1280
|
-
└──────────────────────────────────────────────────────────────┘
|
|
1281
|
-
↓
|
|
1282
|
-
┌──────────────────────────────────────────────────────────────┐
|
|
1283
|
-
│ CONNECTIONS TABLE │
|
|
1284
|
-
│ Every relationship - owns, follows, taught_by, powers │
|
|
1285
|
-
└──────────────────────────────────────────────────────────────┘
|
|
1286
|
-
↓
|
|
1287
|
-
┌──────────────────────────────────────────────────────────────┐
|
|
1288
|
-
│ EVENTS TABLE │
|
|
1289
|
-
│ Every action - purchased, created, viewed, completed │
|
|
1290
|
-
└──────────────────────────────────────────────────────────────┘
|
|
1291
|
-
↓
|
|
1292
|
-
┌──────────────────────────────────────────────────────────────┐
|
|
1293
|
-
│ KNOWLEDGE TABLE │
|
|
1294
|
-
│ Labels + vectors powering RAG & search │
|
|
1295
|
-
└──────────────────────────────────────────────────────────────┘
|
|
1296
|
-
```
|
|
1297
|
-
|
|
1298
|
-
**Golden Rule:** If you can't map your feature to these 6 dimensions, you're thinking about it wrong.
|
|
1299
|
-
|
|
1300
|
-
### Entities Table
|
|
1301
|
-
|
|
1302
|
-
**46 entity types** representing all objects in the ONE platform.
|
|
1303
|
-
|
|
1304
|
-
**What goes in Entities?**
|
|
1305
|
-
- Simple test: If you can point at it and say "this is a ___", it's an entity.
|
|
1306
|
-
- Examples: "This is a creator" ✅ | "This is a relationship" ❌ (that's a connection)
|
|
1307
|
-
|
|
1308
|
-
```typescript
|
|
1309
|
-
entities: defineTable({
|
|
1310
|
-
type: v.union(
|
|
1311
|
-
// Core (3)
|
|
1312
|
-
v.literal("creator"), // Human creator
|
|
1313
|
-
v.literal("ai_clone"), // Digital twin of creator
|
|
1314
|
-
v.literal("audience_member"), // Fan/user
|
|
1315
|
-
|
|
1316
|
-
// Business Agents (10)
|
|
1317
|
-
v.literal("strategy_agent"), // Vision, planning, OKRs
|
|
1318
|
-
v.literal("research_agent"), // Market, trends, competitors
|
|
1319
|
-
v.literal("marketing_agent"), // Content strategy, SEO
|
|
1320
|
-
v.literal("sales_agent"), // Funnels, conversion
|
|
1321
|
-
v.literal("service_agent"), // Support, onboarding
|
|
1322
|
-
v.literal("design_agent"), // Brand, UI/UX, assets
|
|
1323
|
-
v.literal("engineering_agent"), // Tech, integration
|
|
1324
|
-
v.literal("finance_agent"), // Revenue, costs, forecasting
|
|
1325
|
-
v.literal("legal_agent"), // Compliance, contracts, IP
|
|
1326
|
-
v.literal("intelligence_agent"), // Analytics, insights
|
|
1327
|
-
|
|
1328
|
-
// Content (7)
|
|
1329
|
-
v.literal("blog_post"),
|
|
1330
|
-
v.literal("video"),
|
|
1331
|
-
v.literal("podcast"),
|
|
1332
|
-
v.literal("social_post"),
|
|
1333
|
-
v.literal("email"),
|
|
1334
|
-
v.literal("course"),
|
|
1335
|
-
v.literal("lesson"),
|
|
1336
|
-
|
|
1337
|
-
// Products (4)
|
|
1338
|
-
v.literal("digital_product"),
|
|
1339
|
-
v.literal("membership"),
|
|
1340
|
-
v.literal("consultation"),
|
|
1341
|
-
v.literal("nft"),
|
|
1342
|
-
|
|
1343
|
-
// Community (3)
|
|
1344
|
-
v.literal("community"),
|
|
1345
|
-
v.literal("conversation"),
|
|
1346
|
-
v.literal("message"),
|
|
1347
|
-
|
|
1348
|
-
// Token (2)
|
|
1349
|
-
v.literal("token"),
|
|
1350
|
-
v.literal("token_contract"),
|
|
1351
|
-
|
|
1352
|
-
// Knowledge (2)
|
|
1353
|
-
v.literal("knowledge_item"),
|
|
1354
|
-
v.literal("embedding"),
|
|
1355
|
-
|
|
1356
|
-
// Platform (6)
|
|
1357
|
-
v.literal("website"),
|
|
1358
|
-
v.literal("landing_page"),
|
|
1359
|
-
v.literal("template"),
|
|
1360
|
-
v.literal("livestream"),
|
|
1361
|
-
v.literal("recording"),
|
|
1362
|
-
v.literal("media_asset"),
|
|
1363
|
-
|
|
1364
|
-
// Business (7)
|
|
1365
|
-
v.literal("payment"),
|
|
1366
|
-
v.literal("subscription"),
|
|
1367
|
-
v.literal("invoice"),
|
|
1368
|
-
v.literal("metric"),
|
|
1369
|
-
v.literal("insight"),
|
|
1370
|
-
v.literal("prediction"),
|
|
1371
|
-
v.literal("report"),
|
|
1372
|
-
|
|
1373
|
-
// Marketing (5)
|
|
1374
|
-
v.literal("notification"),
|
|
1375
|
-
v.literal("email_campaign"),
|
|
1376
|
-
v.literal("announcement"),
|
|
1377
|
-
v.literal("referral"),
|
|
1378
|
-
v.literal("campaign"),
|
|
1379
|
-
v.literal("lead")
|
|
1380
|
-
),
|
|
1381
|
-
|
|
1382
|
-
name: v.string(), // Display name
|
|
1383
|
-
properties: v.any(), // Type-specific data (JSON)
|
|
1384
|
-
status: v.optional(v.union(
|
|
1385
|
-
v.literal("active"),
|
|
1386
|
-
v.literal("inactive"),
|
|
1387
|
-
v.literal("draft"),
|
|
1388
|
-
v.literal("published"),
|
|
1389
|
-
v.literal("archived")
|
|
1390
|
-
)),
|
|
1391
|
-
createdAt: v.number(),
|
|
1392
|
-
updatedAt: v.number(),
|
|
1393
|
-
deletedAt: v.optional(v.number())
|
|
1394
|
-
})
|
|
1395
|
-
.index("by_type", ["type"])
|
|
1396
|
-
.index("by_status", ["status"])
|
|
1397
|
-
.index("by_type_status", ["type", "status"])
|
|
1398
|
-
.index("by_created", ["createdAt"])
|
|
1399
|
-
.index("by_updated", ["updatedAt"])
|
|
1400
|
-
.searchIndex("search_entities", {
|
|
1401
|
-
searchField: "name",
|
|
1402
|
-
filterFields: ["type", "status"]
|
|
1403
|
-
})
|
|
1404
|
-
```
|
|
1405
|
-
|
|
1406
|
-
#### Example Entity Properties by Type
|
|
1407
|
-
|
|
1408
|
-
**Creator:**
|
|
1409
|
-
```typescript
|
|
1410
|
-
{
|
|
1411
|
-
email: string,
|
|
1412
|
-
username: string,
|
|
1413
|
-
displayName: string,
|
|
1414
|
-
bio?: string,
|
|
1415
|
-
avatar?: string,
|
|
1416
|
-
niche: string[], // ["fitness", "nutrition"]
|
|
1417
|
-
expertise: string[],
|
|
1418
|
-
targetAudience: string,
|
|
1419
|
-
brandColors?: {
|
|
1420
|
-
primary: string,
|
|
1421
|
-
secondary: string,
|
|
1422
|
-
accent: string
|
|
1423
|
-
},
|
|
1424
|
-
totalFollowers: number,
|
|
1425
|
-
totalContent: number,
|
|
1426
|
-
totalRevenue: number
|
|
1427
|
-
}
|
|
1428
|
-
```
|
|
1429
|
-
|
|
1430
|
-
**AI Clone:**
|
|
1431
|
-
```typescript
|
|
1432
|
-
{
|
|
1433
|
-
voiceId?: string,
|
|
1434
|
-
voiceProvider?: "elevenlabs" | "azure" | "custom",
|
|
1435
|
-
appearanceId?: string,
|
|
1436
|
-
appearanceProvider?: "d-id" | "heygen" | "custom",
|
|
1437
|
-
systemPrompt: string,
|
|
1438
|
-
temperature: number,
|
|
1439
|
-
knowledgeBaseSize: number,
|
|
1440
|
-
lastTrainingDate: number,
|
|
1441
|
-
totalInteractions: number,
|
|
1442
|
-
satisfactionScore: number
|
|
1443
|
-
}
|
|
1444
|
-
```
|
|
1445
|
-
|
|
1446
|
-
**Token:**
|
|
1447
|
-
```typescript
|
|
1448
|
-
{
|
|
1449
|
-
contractAddress: string,
|
|
1450
|
-
blockchain: "sui" | "base" | "solana",
|
|
1451
|
-
standard: "ERC20" | "ERC721" | "ERC1155",
|
|
1452
|
-
totalSupply: number,
|
|
1453
|
-
circulatingSupply: number,
|
|
1454
|
-
price: number,
|
|
1455
|
-
marketCap: number,
|
|
1456
|
-
utility: string[],
|
|
1457
|
-
burnRate: number,
|
|
1458
|
-
holders: number,
|
|
1459
|
-
transactions24h: number,
|
|
1460
|
-
volume24h: number
|
|
1461
|
-
}
|
|
1462
|
-
```
|
|
1463
|
-
|
|
1464
|
-
**Course:**
|
|
1465
|
-
```typescript
|
|
1466
|
-
{
|
|
1467
|
-
title: string,
|
|
1468
|
-
description: string,
|
|
1469
|
-
thumbnail?: string,
|
|
1470
|
-
modules: number,
|
|
1471
|
-
lessons: number,
|
|
1472
|
-
totalDuration: number,
|
|
1473
|
-
price: number,
|
|
1474
|
-
currency: string,
|
|
1475
|
-
tokenPrice?: number,
|
|
1476
|
-
enrollments: number,
|
|
1477
|
-
completions: number,
|
|
1478
|
-
averageRating: number,
|
|
1479
|
-
generatedBy: "ai" | "human" | "hybrid",
|
|
1480
|
-
personalizationLevel: "none" | "basic" | "advanced"
|
|
1481
|
-
}
|
|
1482
|
-
```
|
|
1483
|
-
|
|
1484
|
-
### Connections Table
|
|
1485
|
-
|
|
1486
|
-
**24 relationship types** (consolidated from 33).
|
|
1487
|
-
|
|
1488
|
-
```typescript
|
|
1489
|
-
connections: defineTable({
|
|
1490
|
-
fromEntityId: v.id("entities"),
|
|
1491
|
-
toEntityId: v.id("entities"),
|
|
1492
|
-
relationshipType: v.union(
|
|
1493
|
-
// Ownership (2)
|
|
1494
|
-
v.literal("owns"),
|
|
1495
|
-
v.literal("created_by"),
|
|
1496
|
-
|
|
1497
|
-
// AI (3)
|
|
1498
|
-
v.literal("clone_of"),
|
|
1499
|
-
v.literal("trained_on"),
|
|
1500
|
-
v.literal("powers"),
|
|
1501
|
-
|
|
1502
|
-
// Content (5)
|
|
1503
|
-
v.literal("authored"),
|
|
1504
|
-
v.literal("generated_by"),
|
|
1505
|
-
v.literal("published_to"),
|
|
1506
|
-
v.literal("part_of"),
|
|
1507
|
-
v.literal("references"),
|
|
1508
|
-
|
|
1509
|
-
// Community (4)
|
|
1510
|
-
v.literal("member_of"),
|
|
1511
|
-
v.literal("following"),
|
|
1512
|
-
v.literal("moderates"),
|
|
1513
|
-
v.literal("participated_in"),
|
|
1514
|
-
|
|
1515
|
-
// Business (4)
|
|
1516
|
-
v.literal("manages"),
|
|
1517
|
-
v.literal("reports_to"),
|
|
1518
|
-
v.literal("collaborates_with"),
|
|
1519
|
-
v.literal("assigned_to"),
|
|
1520
|
-
|
|
1521
|
-
// Token (3)
|
|
1522
|
-
v.literal("holds_tokens"),
|
|
1523
|
-
v.literal("staked_in"),
|
|
1524
|
-
v.literal("earned_from"),
|
|
1525
|
-
|
|
1526
|
-
// Product (4)
|
|
1527
|
-
v.literal("purchased"),
|
|
1528
|
-
v.literal("enrolled_in"),
|
|
1529
|
-
v.literal("completed"),
|
|
1530
|
-
v.literal("teaching"),
|
|
1531
|
-
|
|
1532
|
-
// Consolidated (3)
|
|
1533
|
-
v.literal("transacted"), // payment, subscription, invoice
|
|
1534
|
-
v.literal("referred"), // direct, conversion, campaign
|
|
1535
|
-
v.literal("notified"), // email, sms, push, in_app
|
|
1536
|
-
|
|
1537
|
-
// Media (2)
|
|
1538
|
-
v.literal("featured_in"),
|
|
1539
|
-
v.literal("hosted_on"),
|
|
1540
|
-
|
|
1541
|
-
// Analytics (3)
|
|
1542
|
-
v.literal("analyzed_by"),
|
|
1543
|
-
v.literal("optimized_by"),
|
|
1544
|
-
v.literal("influences")
|
|
1545
|
-
),
|
|
1546
|
-
metadata: v.optional(v.any()),
|
|
1547
|
-
createdAt: v.number(),
|
|
1548
|
-
deletedAt: v.optional(v.number())
|
|
1549
|
-
})
|
|
1550
|
-
.index("from_entity", ["fromEntityId"])
|
|
1551
|
-
.index("to_entity", ["toEntityId"])
|
|
1552
|
-
.index("from_type", ["fromEntityId", "relationshipType"])
|
|
1553
|
-
.index("to_type", ["toEntityId", "relationshipType"])
|
|
1554
|
-
.index("bidirectional", ["fromEntityId", "toEntityId", "relationshipType"])
|
|
1555
|
-
.index("by_created", ["createdAt"])
|
|
1556
|
-
```
|
|
1557
|
-
|
|
1558
|
-
### Events Table
|
|
1559
|
-
|
|
1560
|
-
**35 event types** (consolidated from 54).
|
|
1561
|
-
|
|
1562
|
-
```typescript
|
|
1563
|
-
events: defineTable({
|
|
1564
|
-
type: v.union(
|
|
1565
|
-
// Creator (3)
|
|
1566
|
-
v.literal("creator_created"),
|
|
1567
|
-
v.literal("creator_updated"),
|
|
1568
|
-
v.literal("content_uploaded"),
|
|
1569
|
-
|
|
1570
|
-
// AI Clone (5)
|
|
1571
|
-
v.literal("clone_created"),
|
|
1572
|
-
v.literal("clone_interaction"),
|
|
1573
|
-
v.literal("clone_generated_content"),
|
|
1574
|
-
v.literal("voice_cloned"),
|
|
1575
|
-
v.literal("appearance_cloned"),
|
|
1576
|
-
|
|
1577
|
-
// Agent (4)
|
|
1578
|
-
v.literal("agent_created"),
|
|
1579
|
-
v.literal("agent_executed"),
|
|
1580
|
-
v.literal("agent_completed"),
|
|
1581
|
-
v.literal("agent_failed"),
|
|
1582
|
-
|
|
1583
|
-
// Content (2 - consolidated)
|
|
1584
|
-
v.literal("content_changed"), // created, updated, deleted
|
|
1585
|
-
v.literal("content_interacted"), // viewed, shared, liked
|
|
1586
|
-
|
|
1587
|
-
// Audience (4)
|
|
1588
|
-
v.literal("user_joined"),
|
|
1589
|
-
v.literal("user_engaged"),
|
|
1590
|
-
v.literal("ugc_created"),
|
|
1591
|
-
v.literal("comment_posted"),
|
|
1592
|
-
|
|
1593
|
-
// Course (5)
|
|
1594
|
-
v.literal("course_created"),
|
|
1595
|
-
v.literal("course_enrolled"),
|
|
1596
|
-
v.literal("lesson_completed"),
|
|
1597
|
-
v.literal("course_completed"),
|
|
1598
|
-
v.literal("certificate_earned"),
|
|
1599
|
-
|
|
1600
|
-
// Token (7)
|
|
1601
|
-
v.literal("token_deployed"),
|
|
1602
|
-
v.literal("tokens_purchased"),
|
|
1603
|
-
v.literal("tokens_earned"),
|
|
1604
|
-
v.literal("tokens_burned"),
|
|
1605
|
-
v.literal("tokens_staked"),
|
|
1606
|
-
v.literal("tokens_unstaked"),
|
|
1607
|
-
v.literal("governance_vote"),
|
|
1608
|
-
|
|
1609
|
-
// Business (3)
|
|
1610
|
-
v.literal("revenue_generated"),
|
|
1611
|
-
v.literal("cost_incurred"),
|
|
1612
|
-
v.literal("referral_made"),
|
|
1613
|
-
|
|
1614
|
-
// Growth (4)
|
|
1615
|
-
v.literal("viral_share"),
|
|
1616
|
-
v.literal("referral_converted"),
|
|
1617
|
-
v.literal("achievement_unlocked"),
|
|
1618
|
-
v.literal("level_up"),
|
|
1619
|
-
|
|
1620
|
-
// Analytics (5)
|
|
1621
|
-
v.literal("metric_calculated"),
|
|
1622
|
-
v.literal("insight_generated"),
|
|
1623
|
-
v.literal("prediction_made"),
|
|
1624
|
-
v.literal("optimization_applied"),
|
|
1625
|
-
v.literal("report_generated"),
|
|
1626
|
-
|
|
1627
|
-
// Consolidated events
|
|
1628
|
-
v.literal("payment_processed"), // initiated, completed, failed, refunded
|
|
1629
|
-
v.literal("subscription_updated"), // started, renewed, cancelled
|
|
1630
|
-
v.literal("livestream_status_changed"), // scheduled, started, ended
|
|
1631
|
-
v.literal("livestream_interaction"), // joined, left, message
|
|
1632
|
-
v.literal("notification_delivered"), // email, sms, push, in_app
|
|
1633
|
-
v.literal("referral_activity"), // created, converted
|
|
1634
|
-
v.literal("lead_captured")
|
|
1635
|
-
),
|
|
1636
|
-
actorId: v.id("entities"),
|
|
1637
|
-
targetId: v.optional(v.id("entities")),
|
|
1638
|
-
timestamp: v.number(),
|
|
1639
|
-
metadata: v.any() // Event-specific data
|
|
1640
|
-
})
|
|
1641
|
-
.index("by_type", ["type"])
|
|
1642
|
-
.index("by_actor", ["actorId"])
|
|
1643
|
-
.index("by_target", ["targetId"])
|
|
1644
|
-
.index("by_timestamp", ["timestamp"])
|
|
1645
|
-
.index("by_actor_type", ["actorId", "type"])
|
|
1646
|
-
.index("by_target_type", ["targetId", "type"])
|
|
1647
|
-
```
|
|
1648
|
-
|
|
1649
|
-
### Tags Table
|
|
1650
|
-
|
|
1651
|
-
Simple key-value tagging system for categorization.
|
|
1652
|
-
|
|
1653
|
-
```typescript
|
|
1654
|
-
tags: defineTable({
|
|
1655
|
-
entityId: v.id("entities"),
|
|
1656
|
-
key: v.string(),
|
|
1657
|
-
value: v.string()
|
|
1658
|
-
})
|
|
1659
|
-
.index("by_entity", ["entityId"])
|
|
1660
|
-
.index("by_key", ["key"])
|
|
1661
|
-
.index("by_key_value", ["key", "value"])
|
|
1662
|
-
```
|
|
1663
|
-
|
|
1664
|
-
---
|
|
1665
|
-
|
|
1666
|
-
## Error Handling
|
|
1667
|
-
|
|
1668
|
-
### Typed Errors in Effect.ts
|
|
1669
|
-
|
|
1670
|
-
```typescript
|
|
1671
|
-
// Define error classes
|
|
1672
|
-
export class NotFoundError {
|
|
1673
|
-
readonly _tag = "NotFoundError";
|
|
1674
|
-
constructor(readonly message: string) {}
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
|
-
export class ValidationError {
|
|
1678
|
-
readonly _tag = "ValidationError";
|
|
1679
|
-
constructor(
|
|
1680
|
-
readonly field: string,
|
|
1681
|
-
readonly message: string
|
|
1682
|
-
) {}
|
|
1683
|
-
}
|
|
1684
|
-
|
|
1685
|
-
// Use in service
|
|
1686
|
-
Effect.gen(function* () {
|
|
1687
|
-
const user = yield* db.get(userId);
|
|
1688
|
-
if (!user) {
|
|
1689
|
-
return yield* Effect.fail(new NotFoundError("User not found"));
|
|
1690
|
-
}
|
|
1691
|
-
return user;
|
|
1692
|
-
}).pipe(
|
|
1693
|
-
Effect.catchTag("NotFoundError", (error) =>
|
|
1694
|
-
Effect.succeed({ error: error.message })
|
|
1695
|
-
)
|
|
1696
|
-
)
|
|
1697
|
-
```
|
|
1698
|
-
|
|
1699
|
-
### Convex Error Handling
|
|
1700
|
-
|
|
1701
|
-
```typescript
|
|
1702
|
-
import { ConvexError } from "convex/values";
|
|
1703
|
-
|
|
1704
|
-
export const myMutation = mutation({
|
|
1705
|
-
handler: async (ctx, args) => {
|
|
1706
|
-
const user = await ctx.db.get(args.userId);
|
|
1707
|
-
|
|
1708
|
-
if (!user) {
|
|
1709
|
-
throw new ConvexError({
|
|
1710
|
-
message: "User not found",
|
|
1711
|
-
code: "NOT_FOUND"
|
|
1712
|
-
});
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
// ... continue
|
|
1716
|
-
}
|
|
1717
|
-
});
|
|
1718
|
-
```
|
|
1719
|
-
|
|
1720
|
-
---
|
|
1721
|
-
|
|
1722
|
-
## Environment Variables
|
|
1723
|
-
|
|
1724
|
-
### Required Variables
|
|
1725
|
-
|
|
1726
|
-
```bash
|
|
1727
|
-
# Convex
|
|
1728
|
-
CONVEX_URL=https://your-deployment.convex.cloud
|
|
1729
|
-
CONVEX_DEPLOYMENT=your-deployment-name
|
|
1730
|
-
|
|
1731
|
-
# Better Auth
|
|
1732
|
-
BETTER_AUTH_SECRET=your-secret-key
|
|
1733
|
-
BETTER_AUTH_URL=https://your-domain.com
|
|
1734
|
-
|
|
1735
|
-
# OAuth Providers
|
|
1736
|
-
GITHUB_CLIENT_ID=your-github-client-id
|
|
1737
|
-
GITHUB_CLIENT_SECRET=your-github-client-secret
|
|
1738
|
-
GOOGLE_CLIENT_ID=your-google-client-id
|
|
1739
|
-
GOOGLE_CLIENT_SECRET=your-google-client-secret
|
|
1740
|
-
|
|
1741
|
-
# Email (Resend)
|
|
1742
|
-
RESEND_API_KEY=re_...
|
|
1743
|
-
RESEND_FROM_EMAIL=noreply@yourdomain.com
|
|
1744
|
-
|
|
1745
|
-
# Payments (Stripe)
|
|
1746
|
-
STRIPE_SECRET_KEY=sk_...
|
|
1747
|
-
STRIPE_PUBLISHABLE_KEY=pk_...
|
|
1748
|
-
|
|
1749
|
-
# Blockchain (Base L2)
|
|
1750
|
-
BASE_RPC_URL=https://mainnet.base.org
|
|
1751
|
-
DEPLOYER_PRIVATE_KEY=0x...
|
|
1752
|
-
|
|
1753
|
-
# AI Services
|
|
1754
|
-
OPENAI_API_KEY=sk-...
|
|
1755
|
-
ELEVENLABS_API_KEY=...
|
|
1756
|
-
```
|
|
1757
|
-
|
|
1758
|
-
---
|
|
1759
|
-
|
|
1760
|
-
## Quick Reference
|
|
1761
|
-
|
|
1762
|
-
### Common Validators
|
|
1763
|
-
|
|
1764
|
-
```typescript
|
|
1765
|
-
import { v } from "convex/values";
|
|
1766
|
-
|
|
1767
|
-
// Primitives
|
|
1768
|
-
v.string()
|
|
1769
|
-
v.number()
|
|
1770
|
-
v.boolean()
|
|
1771
|
-
v.null()
|
|
1772
|
-
v.any()
|
|
1773
|
-
|
|
1774
|
-
// Complex types
|
|
1775
|
-
v.id("tableName")
|
|
1776
|
-
v.array(v.string())
|
|
1777
|
-
v.object({ name: v.string(), age: v.number() })
|
|
1778
|
-
v.union(v.literal("a"), v.literal("b"))
|
|
1779
|
-
v.optional(v.string())
|
|
1780
|
-
|
|
1781
|
-
// Pagination
|
|
1782
|
-
paginationOptsValidator
|
|
1783
|
-
```
|
|
1784
|
-
|
|
1785
|
-
### Best Practices
|
|
1786
|
-
|
|
1787
|
-
1. **Always use indexes** for queries on non-_id fields
|
|
1788
|
-
2. **Email sending** must be in internal actions, scheduled from mutations
|
|
1789
|
-
3. **Use Effect.ts** for all business logic with multiple steps or external calls
|
|
1790
|
-
4. **Type all errors** with `_tag` for exhaustive error handling
|
|
1791
|
-
5. **Validate args** with Convex validators
|
|
1792
|
-
6. **Log events** for all significant actions
|
|
1793
|
-
7. **Use .unique()** when expecting exactly one result, `.first()` for optional
|
|
1794
|
-
8. **Schedule background work** with `ctx.scheduler.runAfter()`
|
|
1795
|
-
9. **Keep mutations fast** - use actions for long-running operations
|
|
1796
|
-
10. **Always provide MainLayer** when using Effect.ts services in Convex functions
|
|
1797
|
-
|
|
1798
|
-
---
|
|
1799
|
-
|
|
1800
|
-
## How Features Map to Ontology
|
|
1801
|
-
|
|
1802
|
-
Understanding how to map features to the 6-dimension ontology is critical for implementing new functionality.
|
|
1803
|
-
|
|
1804
|
-
### Example: AI Clone Creation
|
|
1805
|
-
|
|
1806
|
-
**Feature Goal:** Allow creators to create AI clones of themselves.
|
|
1807
|
-
|
|
1808
|
-
**Ontology Mapping:**
|
|
1809
|
-
|
|
1810
|
-
**Entities Created:**
|
|
1811
|
-
1. `ai_clone` entity (the digital twin)
|
|
1812
|
-
2. Multiple `knowledge_item` entities (training data from creator's content)
|
|
1813
|
-
|
|
1814
|
-
**Connections Created:**
|
|
1815
|
-
1. creator → ai_clone (`owns`)
|
|
1816
|
-
2. ai_clone → knowledge_items (`trained_on`)
|
|
1817
|
-
3. agent → ai_clone (`powers`) - which agent runs the clone
|
|
1818
|
-
|
|
1819
|
-
**Events Logged:**
|
|
1820
|
-
1. `clone_created` - when clone entity created
|
|
1821
|
-
2. `voice_cloned` - when voice cloning completes
|
|
1822
|
-
3. `appearance_cloned` - when appearance cloning completes
|
|
1823
|
-
|
|
1824
|
-
**Tags Added:**
|
|
1825
|
-
- Clone inherits creator's `industry` and `skill` tags
|
|
1826
|
-
- Additional tags: `status:training`, `status:active`
|
|
1827
|
-
|
|
1828
|
-
### Example: Token Purchase
|
|
1829
|
-
|
|
1830
|
-
**Feature Goal:** Allow users to purchase creator tokens.
|
|
1831
|
-
|
|
1832
|
-
**Ontology Mapping:**
|
|
1833
|
-
|
|
1834
|
-
**Entities Involved:**
|
|
1835
|
-
1. `token` entity (the token being purchased)
|
|
1836
|
-
2. `audience_member` entity (the buyer)
|
|
1837
|
-
|
|
1838
|
-
**Connections Created/Updated:**
|
|
1839
|
-
1. buyer → token (`holds_tokens`, metadata: { balance: 100, blockchain: "sui" })
|
|
1840
|
-
|
|
1841
|
-
**Events Logged:**
|
|
1842
|
-
1. `tokens_purchased` (amount, blockchain, payment details)
|
|
1843
|
-
2. `revenue_generated` (for creator)
|
|
1844
|
-
3. `payment_processed` (fiat) OR blockchain transaction event (crypto)
|
|
1845
|
-
|
|
1846
|
-
**Tags Added:**
|
|
1847
|
-
- None (tokens already have tags)
|
|
1848
|
-
|
|
1849
|
-
### Example: Course Generation
|
|
1850
|
-
|
|
1851
|
-
**Feature Goal:** AI generates a personalized course for a creator.
|
|
1852
|
-
|
|
1853
|
-
**Ontology Mapping:**
|
|
1854
|
-
|
|
1855
|
-
**Entities Created:**
|
|
1856
|
-
1. `course` entity
|
|
1857
|
-
2. Multiple `lesson` entities (one per lesson)
|
|
1858
|
-
3. `content` entities for each lesson (video, text, quiz)
|
|
1859
|
-
|
|
1860
|
-
**Connections Created:**
|
|
1861
|
-
1. creator → course (`owns`)
|
|
1862
|
-
2. ai_agent → course (`generated_by`)
|
|
1863
|
-
3. ai_clone → course (`teaching`)
|
|
1864
|
-
4. course → lessons (`part_of`)
|
|
1865
|
-
5. lessons → content (`part_of`)
|
|
1866
|
-
|
|
1867
|
-
**Events Logged:**
|
|
1868
|
-
1. `course_created`
|
|
1869
|
-
2. `clone_generated_content` (for each lesson)
|
|
1870
|
-
|
|
1871
|
-
**Tags Added:**
|
|
1872
|
-
- `skill` tags - what the course teaches
|
|
1873
|
-
- `industry` tags - course category
|
|
1874
|
-
- `audience` tags - target skill level
|
|
1875
|
-
- `format` tag - video, text, interactive
|
|
1876
|
-
|
|
1877
|
-
### Example: Livestream Session
|
|
1878
|
-
|
|
1879
|
-
**Feature Goal:** Creator hosts a livestream with AI clone co-host.
|
|
1880
|
-
|
|
1881
|
-
**Ontology Mapping:**
|
|
1882
|
-
|
|
1883
|
-
**Entities Created:**
|
|
1884
|
-
1. `livestream` entity
|
|
1885
|
-
2. `recording` entity (after stream ends)
|
|
1886
|
-
3. Multiple `message` entities (chat messages)
|
|
1887
|
-
|
|
1888
|
-
**Connections Created:**
|
|
1889
|
-
1. creator → livestream (`owns`)
|
|
1890
|
-
2. ai_clone → livestream (`participated_in`)
|
|
1891
|
-
3. livestream → platform (`hosted_on`)
|
|
1892
|
-
4. viewers → livestream (`participated_in`)
|
|
1893
|
-
|
|
1894
|
-
**Events Logged:**
|
|
1895
|
-
1. `livestream_status_changed` (scheduled → started → ended)
|
|
1896
|
-
2. `livestream_interaction` (viewers joining, leaving, chatting)
|
|
1897
|
-
3. `content_changed` (recording created after stream)
|
|
1898
|
-
|
|
1899
|
-
**Tags Added:**
|
|
1900
|
-
- `topic` tags for stream content
|
|
1901
|
-
- `format:live` tag
|
|
1902
|
-
|
|
1903
|
-
---
|
|
1904
|
-
|
|
1905
|
-
## Query Patterns for Common Operations
|
|
1906
|
-
|
|
1907
|
-
### Get Creator with All Their Content
|
|
1908
|
-
|
|
1909
|
-
```typescript
|
|
1910
|
-
export const getCreatorWithContent = query({
|
|
1911
|
-
args: { creatorId: v.id("entities") },
|
|
1912
|
-
handler: async (ctx, args) => {
|
|
1913
|
-
// Get creator
|
|
1914
|
-
const creator = await ctx.db.get(args.creatorId);
|
|
1915
|
-
if (!creator || creator.type !== "creator") {
|
|
1916
|
-
return null;
|
|
1917
|
-
}
|
|
1918
|
-
|
|
1919
|
-
// Get all authored connections
|
|
1920
|
-
const authoredConnections = await ctx.db
|
|
1921
|
-
.query("connections")
|
|
1922
|
-
.withIndex("from_type", q =>
|
|
1923
|
-
q.eq("fromEntityId", args.creatorId)
|
|
1924
|
-
.eq("relationshipType", "authored")
|
|
1925
|
-
)
|
|
1926
|
-
.collect();
|
|
1927
|
-
|
|
1928
|
-
// Get all content entities
|
|
1929
|
-
const content = await Promise.all(
|
|
1930
|
-
authoredConnections.map(conn => ctx.db.get(conn.toEntityId))
|
|
1931
|
-
);
|
|
1932
|
-
|
|
1933
|
-
// Get follower count
|
|
1934
|
-
const followers = await ctx.db
|
|
1935
|
-
.query("connections")
|
|
1936
|
-
.withIndex("to_type", q =>
|
|
1937
|
-
q.eq("toEntityId", args.creatorId)
|
|
1938
|
-
.eq("relationshipType", "following")
|
|
1939
|
-
)
|
|
1940
|
-
.collect();
|
|
1941
|
-
|
|
1942
|
-
return {
|
|
1943
|
-
...creator,
|
|
1944
|
-
content: content.filter(Boolean),
|
|
1945
|
-
followerCount: followers.length
|
|
1946
|
-
};
|
|
1947
|
-
}
|
|
1948
|
-
});
|
|
1949
|
-
```
|
|
1950
|
-
|
|
1951
|
-
### Get User's Token Holdings
|
|
1952
|
-
|
|
1953
|
-
```typescript
|
|
1954
|
-
export const getUserTokenHoldings = query({
|
|
1955
|
-
args: { userId: v.id("entities") },
|
|
1956
|
-
handler: async (ctx, args) => {
|
|
1957
|
-
// Get all token holding connections
|
|
1958
|
-
const holdings = await ctx.db
|
|
1959
|
-
.query("connections")
|
|
1960
|
-
.withIndex("from_type", q =>
|
|
1961
|
-
q.eq("fromEntityId", args.userId)
|
|
1962
|
-
.eq("relationshipType", "holds_tokens")
|
|
1963
|
-
)
|
|
1964
|
-
.collect();
|
|
1965
|
-
|
|
1966
|
-
// Get token details
|
|
1967
|
-
const tokens = await Promise.all(
|
|
1968
|
-
holdings.map(async (holding) => {
|
|
1969
|
-
const token = await ctx.db.get(holding.toEntityId);
|
|
1970
|
-
return {
|
|
1971
|
-
...token,
|
|
1972
|
-
balance: holding.metadata?.balance || 0,
|
|
1973
|
-
blockchain: holding.metadata?.blockchain || "unknown"
|
|
1974
|
-
};
|
|
1975
|
-
})
|
|
1976
|
-
);
|
|
1977
|
-
|
|
1978
|
-
return tokens.filter(Boolean);
|
|
1979
|
-
}
|
|
1980
|
-
});
|
|
1981
|
-
```
|
|
1982
|
-
|
|
1983
|
-
### Get Content Interaction History
|
|
1984
|
-
|
|
1985
|
-
```typescript
|
|
1986
|
-
export const getContentHistory = query({
|
|
1987
|
-
args: { contentId: v.id("entities"), limit: v.optional(v.number()) },
|
|
1988
|
-
handler: async (ctx, args) => {
|
|
1989
|
-
const events = await ctx.db
|
|
1990
|
-
.query("events")
|
|
1991
|
-
.withIndex("by_target_type", q =>
|
|
1992
|
-
q.eq("targetId", args.contentId)
|
|
1993
|
-
.eq("type", "content_interacted")
|
|
1994
|
-
)
|
|
1995
|
-
.order("desc")
|
|
1996
|
-
.take(args.limit || 100);
|
|
1997
|
-
|
|
1998
|
-
// Get actor details for each event
|
|
1999
|
-
const history = await Promise.all(
|
|
2000
|
-
events.map(async (event) => {
|
|
2001
|
-
const actor = await ctx.db.get(event.actorId);
|
|
2002
|
-
return {
|
|
2003
|
-
timestamp: event.timestamp,
|
|
2004
|
-
interactionType: event.metadata.interactionType,
|
|
2005
|
-
actor: actor?.name || "Unknown",
|
|
2006
|
-
duration: event.metadata.duration
|
|
2007
|
-
};
|
|
2008
|
-
})
|
|
2009
|
-
);
|
|
2010
|
-
|
|
2011
|
-
return history;
|
|
2012
|
-
}
|
|
2013
|
-
});
|
|
2014
|
-
```
|
|
2015
|
-
|
|
2016
|
-
### Get AI Clone Performance Metrics
|
|
2017
|
-
|
|
2018
|
-
```typescript
|
|
2019
|
-
export const getCloneMetrics = query({
|
|
2020
|
-
args: { cloneId: v.id("entities") },
|
|
2021
|
-
handler: async (ctx, args) => {
|
|
2022
|
-
const clone = await ctx.db.get(args.cloneId);
|
|
2023
|
-
if (!clone || clone.type !== "ai_clone") {
|
|
2024
|
-
return null;
|
|
2025
|
-
}
|
|
2026
|
-
|
|
2027
|
-
// Get interaction count (last 30 days)
|
|
2028
|
-
const thirtyDaysAgo = Date.now() - 30 * 24 * 60 * 60 * 1000;
|
|
2029
|
-
const interactions = await ctx.db
|
|
2030
|
-
.query("events")
|
|
2031
|
-
.withIndex("by_target_type", q =>
|
|
2032
|
-
q.eq("targetId", args.cloneId)
|
|
2033
|
-
.eq("type", "clone_interaction")
|
|
2034
|
-
)
|
|
2035
|
-
.filter(q => q.gte(q.field("timestamp"), thirtyDaysAgo))
|
|
2036
|
-
.collect();
|
|
2037
|
-
|
|
2038
|
-
// Calculate average sentiment
|
|
2039
|
-
const sentiments = interactions
|
|
2040
|
-
.map(e => e.metadata.sentiment)
|
|
2041
|
-
.filter(Boolean);
|
|
2042
|
-
|
|
2043
|
-
const avgSentiment = sentiments.length > 0
|
|
2044
|
-
? sentiments.filter(s => s === "positive").length / sentiments.length
|
|
2045
|
-
: 0;
|
|
2046
|
-
|
|
2047
|
-
// Get tokens earned from clone interactions
|
|
2048
|
-
const tokensEarned = await ctx.db
|
|
2049
|
-
.query("events")
|
|
2050
|
-
.withIndex("by_type", q => q.eq("type", "tokens_earned"))
|
|
2051
|
-
.filter(q =>
|
|
2052
|
-
q.and(
|
|
2053
|
-
q.gte(q.field("timestamp"), thirtyDaysAgo),
|
|
2054
|
-
q.eq(q.field("metadata.source"), "clone_interaction")
|
|
2055
|
-
)
|
|
2056
|
-
)
|
|
2057
|
-
.collect()
|
|
2058
|
-
.then(events =>
|
|
2059
|
-
events.reduce((sum, e) => sum + (e.metadata.amount || 0), 0)
|
|
2060
|
-
);
|
|
2061
|
-
|
|
2062
|
-
return {
|
|
2063
|
-
...clone,
|
|
2064
|
-
metrics: {
|
|
2065
|
-
interactions30d: interactions.length,
|
|
2066
|
-
avgSentiment,
|
|
2067
|
-
tokensEarned30d: tokensEarned,
|
|
2068
|
-
satisfactionScore: clone.properties.satisfactionScore
|
|
2069
|
-
}
|
|
2070
|
-
};
|
|
2071
|
-
}
|
|
2072
|
-
});
|
|
2073
|
-
```
|
|
2074
|
-
|
|
2075
|
-
---
|
|
2076
|
-
|
|
2077
|
-
## Migration Guide: Old System → 6-Dimension Ontology
|
|
2078
|
-
|
|
2079
|
-
### Step 1: Identify Entity Types
|
|
2080
|
-
|
|
2081
|
-
Map your existing models to the 46 entity types:
|
|
2082
|
-
|
|
2083
|
-
| Old Model | New Entity Type | Notes |
|
|
2084
|
-
|-----------|-----------------|-------|
|
|
2085
|
-
| User (creator) | `creator` | If they create content |
|
|
2086
|
-
| User (consumer) | `audience_member` | If they consume content |
|
|
2087
|
-
| Post | `blog_post` | Or `social_post` depending on platform |
|
|
2088
|
-
| Video | `video` | Content type |
|
|
2089
|
-
| Follow | N/A | This becomes a `connection` |
|
|
2090
|
-
| Like | N/A | This becomes an `event` |
|
|
2091
|
-
| Comment | `message` | Part of a `conversation` |
|
|
2092
|
-
| Subscription | `subscription` | Business entity |
|
|
2093
|
-
|
|
2094
|
-
### Step 2: Transform Properties
|
|
2095
|
-
|
|
2096
|
-
Extract structured data into the `properties` JSON field:
|
|
2097
|
-
|
|
2098
|
-
```typescript
|
|
2099
|
-
// OLD USER MODEL
|
|
2100
|
-
{
|
|
2101
|
-
id: "123",
|
|
2102
|
-
name: "John Doe",
|
|
2103
|
-
email: "john@example.com",
|
|
2104
|
-
bio: "Fitness coach",
|
|
2105
|
-
follower_count: 5000,
|
|
2106
|
-
created_at: "2024-01-15"
|
|
2107
|
-
}
|
|
2108
|
-
|
|
2109
|
-
// NEW ENTITY
|
|
2110
|
-
{
|
|
2111
|
-
_id: "creator-123",
|
|
2112
|
-
type: "creator",
|
|
2113
|
-
name: "John Doe",
|
|
2114
|
-
properties: {
|
|
2115
|
-
email: "john@example.com",
|
|
2116
|
-
username: "johndoe",
|
|
2117
|
-
displayName: "John Doe",
|
|
2118
|
-
bio: "Fitness coach",
|
|
2119
|
-
niche: ["fitness", "health"],
|
|
2120
|
-
expertise: ["training", "nutrition"],
|
|
2121
|
-
targetAudience: "fitness enthusiasts",
|
|
2122
|
-
totalFollowers: 5000,
|
|
2123
|
-
totalContent: 0,
|
|
2124
|
-
totalRevenue: 0
|
|
2125
|
-
},
|
|
2126
|
-
status: "active",
|
|
2127
|
-
createdAt: new Date("2024-01-15").getTime(),
|
|
2128
|
-
updatedAt: Date.now()
|
|
2129
|
-
}
|
|
2130
|
-
```
|
|
2131
|
-
|
|
2132
|
-
### Step 3: Convert Relationships
|
|
2133
|
-
|
|
2134
|
-
Transform foreign keys into connections:
|
|
2135
|
-
|
|
2136
|
-
```typescript
|
|
2137
|
-
// OLD: posts table with user_id foreign key
|
|
2138
|
-
{
|
|
2139
|
-
id: "post-456",
|
|
2140
|
-
user_id: "user-123",
|
|
2141
|
-
title: "My First Post",
|
|
2142
|
-
content: "..."
|
|
2143
|
-
}
|
|
2144
|
-
|
|
2145
|
-
// NEW: Separate entities + connection
|
|
2146
|
-
// 1. Creator entity (user-123 → creator-123)
|
|
2147
|
-
// 2. Post entity
|
|
2148
|
-
{
|
|
2149
|
-
_id: "post-456",
|
|
2150
|
-
type: "blog_post",
|
|
2151
|
-
name: "My First Post",
|
|
2152
|
-
properties: {
|
|
2153
|
-
content: "...",
|
|
2154
|
-
publishedAt: Date.now(),
|
|
2155
|
-
views: 0
|
|
2156
|
-
},
|
|
2157
|
-
status: "published",
|
|
2158
|
-
createdAt: Date.now(),
|
|
2159
|
-
updatedAt: Date.now()
|
|
2160
|
-
}
|
|
2161
|
-
|
|
2162
|
-
// 3. Connection
|
|
2163
|
-
{
|
|
2164
|
-
fromEntityId: "creator-123",
|
|
2165
|
-
toEntityId: "post-456",
|
|
2166
|
-
relationshipType: "authored",
|
|
2167
|
-
createdAt: Date.now()
|
|
2168
|
-
}
|
|
2169
|
-
```
|
|
2170
|
-
|
|
2171
|
-
### Step 4: Preserve History
|
|
2172
|
-
|
|
2173
|
-
Convert activity logs to events:
|
|
2174
|
-
|
|
2175
|
-
```typescript
|
|
2176
|
-
// OLD: Activity log entry
|
|
2177
|
-
{
|
|
2178
|
-
user_id: "123",
|
|
2179
|
-
action: "viewed",
|
|
2180
|
-
post_id: "456",
|
|
2181
|
-
timestamp: 1705334400000
|
|
2182
|
-
}
|
|
2183
|
-
|
|
2184
|
-
// NEW: Event
|
|
2185
|
-
{
|
|
2186
|
-
type: "content_interacted",
|
|
2187
|
-
actorId: "user-123",
|
|
2188
|
-
targetId: "post-456",
|
|
2189
|
-
timestamp: 1705334400000,
|
|
2190
|
-
metadata: {
|
|
2191
|
-
interactionType: "viewed",
|
|
2192
|
-
source: "feed",
|
|
2193
|
-
duration: 120
|
|
2194
|
-
}
|
|
2195
|
-
}
|
|
2196
|
-
```
|
|
2197
|
-
|
|
2198
|
-
---
|
|
2199
|
-
|
|
2200
|
-
**Last Updated:** 2025-01-15
|
|
2201
|
-
**Maintainer:** AI Agents + Human Developers
|
|
2202
|
-
|
|
2203
|
-
**See Also:**
|
|
2204
|
-
- `Ontology.md` - Complete ontology specification
|
|
2205
|
-
- `Schema.md` - Convex schema details
|
|
2206
|
-
- `Patterns.md` - Code patterns to replicate
|
|
2207
|
-
- `Architecture.md` - System architecture overview
|
|
2208
|
-
- `AGENTS.md` - Quick Convex reference for agents
|