oneie 3.6.40 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (984) hide show
  1. package/README.md +28 -9
  2. package/dist/admin/build.d.ts +15 -0
  3. package/dist/admin/build.d.ts.map +1 -0
  4. package/dist/admin/build.js +295 -0
  5. package/dist/admin/build.js.map +1 -0
  6. package/dist/admin/index.d.ts +24 -0
  7. package/dist/admin/index.d.ts.map +1 -0
  8. package/dist/admin/index.js +98 -0
  9. package/dist/admin/index.js.map +1 -0
  10. package/dist/admin/list.d.ts +14 -0
  11. package/dist/admin/list.d.ts.map +1 -0
  12. package/dist/admin/list.js +90 -0
  13. package/dist/admin/list.js.map +1 -0
  14. package/dist/admin/manifest.d.ts +86 -0
  15. package/dist/admin/manifest.d.ts.map +1 -0
  16. package/dist/admin/manifest.js +183 -0
  17. package/dist/admin/manifest.js.map +1 -0
  18. package/dist/admin/monorepo.d.ts +25 -0
  19. package/dist/admin/monorepo.d.ts.map +1 -0
  20. package/dist/admin/monorepo.js +59 -0
  21. package/dist/admin/monorepo.js.map +1 -0
  22. package/dist/admin/release.d.ts +17 -0
  23. package/dist/admin/release.d.ts.map +1 -0
  24. package/dist/admin/release.js +144 -0
  25. package/dist/admin/release.js.map +1 -0
  26. package/dist/admin/sync.d.ts +14 -0
  27. package/dist/admin/sync.d.ts.map +1 -0
  28. package/dist/admin/sync.js +104 -0
  29. package/dist/admin/sync.js.map +1 -0
  30. package/dist/admin/validate.d.ts +15 -0
  31. package/dist/admin/validate.d.ts.map +1 -0
  32. package/dist/admin/validate.js +169 -0
  33. package/dist/admin/validate.js.map +1 -0
  34. package/dist/commands/agent.d.ts +2 -0
  35. package/dist/commands/agent.d.ts.map +1 -1
  36. package/dist/commands/agent.js +44 -0
  37. package/dist/commands/agent.js.map +1 -1
  38. package/dist/commands/ask.d.ts +4 -0
  39. package/dist/commands/ask.d.ts.map +1 -0
  40. package/dist/commands/ask.js +8 -0
  41. package/dist/commands/ask.js.map +1 -0
  42. package/dist/commands/bounty.d.ts +4 -0
  43. package/dist/commands/bounty.d.ts.map +1 -0
  44. package/dist/commands/bounty.js +24 -0
  45. package/dist/commands/bounty.js.map +1 -0
  46. package/dist/commands/capabilities.d.ts +4 -0
  47. package/dist/commands/capabilities.d.ts.map +1 -0
  48. package/dist/commands/capabilities.js +18 -0
  49. package/dist/commands/capabilities.js.map +1 -0
  50. package/dist/commands/claw.d.ts +4 -0
  51. package/dist/commands/claw.d.ts.map +1 -0
  52. package/dist/commands/claw.js +14 -0
  53. package/dist/commands/claw.js.map +1 -0
  54. package/dist/commands/commend.d.ts +4 -0
  55. package/dist/commands/commend.d.ts.map +1 -0
  56. package/dist/commands/commend.js +13 -0
  57. package/dist/commands/commend.js.map +1 -0
  58. package/dist/commands/completion.d.ts +4 -0
  59. package/dist/commands/completion.d.ts.map +1 -0
  60. package/dist/commands/completion.js +49 -0
  61. package/dist/commands/completion.js.map +1 -0
  62. package/dist/commands/config.d.ts +4 -0
  63. package/dist/commands/config.d.ts.map +1 -0
  64. package/dist/commands/config.js +78 -0
  65. package/dist/commands/config.js.map +1 -0
  66. package/dist/commands/deploy.d.ts +4 -0
  67. package/dist/commands/deploy.d.ts.map +1 -0
  68. package/dist/commands/deploy.js +10 -0
  69. package/dist/commands/deploy.js.map +1 -0
  70. package/dist/commands/doctor.d.ts +4 -0
  71. package/dist/commands/doctor.d.ts.map +1 -0
  72. package/dist/commands/doctor.js +72 -0
  73. package/dist/commands/doctor.js.map +1 -0
  74. package/dist/commands/export.d.ts +4 -0
  75. package/dist/commands/export.d.ts.map +1 -0
  76. package/dist/commands/export.js +15 -0
  77. package/dist/commands/export.js.map +1 -0
  78. package/dist/commands/fade.d.ts +4 -0
  79. package/dist/commands/fade.d.ts.map +1 -0
  80. package/dist/commands/fade.js +15 -0
  81. package/dist/commands/fade.js.map +1 -0
  82. package/dist/commands/flag.d.ts +4 -0
  83. package/dist/commands/flag.d.ts.map +1 -0
  84. package/dist/commands/flag.js +13 -0
  85. package/dist/commands/flag.js.map +1 -0
  86. package/dist/commands/forget.d.ts +4 -0
  87. package/dist/commands/forget.d.ts.map +1 -0
  88. package/dist/commands/forget.js +16 -0
  89. package/dist/commands/forget.js.map +1 -0
  90. package/dist/commands/frontier.d.ts +4 -0
  91. package/dist/commands/frontier.d.ts.map +1 -0
  92. package/dist/commands/frontier.js +11 -0
  93. package/dist/commands/frontier.js.map +1 -0
  94. package/dist/commands/health.d.ts +4 -0
  95. package/dist/commands/health.d.ts.map +1 -0
  96. package/dist/commands/health.js +11 -0
  97. package/dist/commands/health.js.map +1 -0
  98. package/dist/commands/highways.d.ts +4 -0
  99. package/dist/commands/highways.d.ts.map +1 -0
  100. package/dist/commands/highways.js +14 -0
  101. package/dist/commands/highways.js.map +1 -0
  102. package/dist/commands/hire.d.ts +4 -0
  103. package/dist/commands/hire.d.ts.map +1 -0
  104. package/dist/commands/hire.js +16 -0
  105. package/dist/commands/hire.js.map +1 -0
  106. package/dist/commands/init.d.ts.map +1 -1
  107. package/dist/commands/init.js +69 -42
  108. package/dist/commands/init.js.map +1 -1
  109. package/dist/commands/know.d.ts +4 -0
  110. package/dist/commands/know.d.ts.map +1 -0
  111. package/dist/commands/know.js +8 -0
  112. package/dist/commands/know.js.map +1 -0
  113. package/dist/commands/launch.d.ts +4 -0
  114. package/dist/commands/launch.d.ts.map +1 -0
  115. package/dist/commands/launch.js +16 -0
  116. package/dist/commands/launch.js.map +1 -0
  117. package/dist/commands/mark.d.ts +4 -0
  118. package/dist/commands/mark.d.ts.map +1 -0
  119. package/dist/commands/mark.js +15 -0
  120. package/dist/commands/mark.js.map +1 -0
  121. package/dist/commands/pay.d.ts +4 -0
  122. package/dist/commands/pay.d.ts.map +1 -0
  123. package/dist/commands/pay.js +21 -0
  124. package/dist/commands/pay.js.map +1 -0
  125. package/dist/commands/pipe.d.ts +4 -0
  126. package/dist/commands/pipe.d.ts.map +1 -0
  127. package/dist/commands/pipe.js +35 -0
  128. package/dist/commands/pipe.js.map +1 -0
  129. package/dist/commands/publish.d.ts +4 -0
  130. package/dist/commands/publish.d.ts.map +1 -0
  131. package/dist/commands/publish.js +23 -0
  132. package/dist/commands/publish.js.map +1 -0
  133. package/dist/commands/recall.d.ts +4 -0
  134. package/dist/commands/recall.d.ts.map +1 -0
  135. package/dist/commands/recall.js +12 -0
  136. package/dist/commands/recall.js.map +1 -0
  137. package/dist/commands/repl.d.ts +4 -0
  138. package/dist/commands/repl.d.ts.map +1 -0
  139. package/dist/commands/repl.js +56 -0
  140. package/dist/commands/repl.js.map +1 -0
  141. package/dist/commands/reveal.d.ts +4 -0
  142. package/dist/commands/reveal.d.ts.map +1 -0
  143. package/dist/commands/reveal.js +11 -0
  144. package/dist/commands/reveal.js.map +1 -0
  145. package/dist/commands/revenue.d.ts +4 -0
  146. package/dist/commands/revenue.d.ts.map +1 -0
  147. package/dist/commands/revenue.js +11 -0
  148. package/dist/commands/revenue.js.map +1 -0
  149. package/dist/commands/select.d.ts +4 -0
  150. package/dist/commands/select.d.ts.map +1 -0
  151. package/dist/commands/select.js +19 -0
  152. package/dist/commands/select.js.map +1 -0
  153. package/dist/commands/signal.d.ts +4 -0
  154. package/dist/commands/signal.d.ts.map +1 -0
  155. package/dist/commands/signal.js +8 -0
  156. package/dist/commands/signal.js.map +1 -0
  157. package/dist/commands/stats.d.ts +4 -0
  158. package/dist/commands/stats.d.ts.map +1 -0
  159. package/dist/commands/stats.js +11 -0
  160. package/dist/commands/stats.js.map +1 -0
  161. package/dist/commands/status.d.ts +4 -0
  162. package/dist/commands/status.d.ts.map +1 -0
  163. package/dist/commands/status.js +18 -0
  164. package/dist/commands/status.js.map +1 -0
  165. package/dist/commands/sync.d.ts +4 -0
  166. package/dist/commands/sync.d.ts.map +1 -0
  167. package/dist/commands/sync.js +20 -0
  168. package/dist/commands/sync.js.map +1 -0
  169. package/dist/commands/tail.d.ts +4 -0
  170. package/dist/commands/tail.d.ts.map +1 -0
  171. package/dist/commands/tail.js +51 -0
  172. package/dist/commands/tail.js.map +1 -0
  173. package/dist/commands/warn.d.ts +4 -0
  174. package/dist/commands/warn.d.ts.map +1 -0
  175. package/dist/commands/warn.js +15 -0
  176. package/dist/commands/warn.js.map +1 -0
  177. package/dist/create-org-profile.js +2 -2
  178. package/dist/create-user-profile.js +2 -2
  179. package/dist/index.js +135 -7
  180. package/dist/index.js.map +1 -1
  181. package/dist/lib/args.d.ts +11 -0
  182. package/dist/lib/args.d.ts.map +1 -0
  183. package/dist/lib/args.js +57 -0
  184. package/dist/lib/args.js.map +1 -0
  185. package/dist/lib/config.d.ts +12 -0
  186. package/dist/lib/config.d.ts.map +1 -0
  187. package/dist/lib/config.js +38 -0
  188. package/dist/lib/config.js.map +1 -0
  189. package/dist/lib/http.d.ts +9 -0
  190. package/dist/lib/http.d.ts.map +1 -0
  191. package/dist/lib/http.js +25 -0
  192. package/dist/lib/http.js.map +1 -0
  193. package/dist/lib/output.d.ts +5 -0
  194. package/dist/lib/output.d.ts.map +1 -0
  195. package/dist/lib/output.js +32 -0
  196. package/dist/lib/output.js.map +1 -0
  197. package/dist/lib/sdk.d.ts +10 -0
  198. package/dist/lib/sdk.d.ts.map +1 -0
  199. package/dist/lib/sdk.js +22 -0
  200. package/dist/lib/sdk.js.map +1 -0
  201. package/dist/lib/telemetry.d.ts +4 -0
  202. package/dist/lib/telemetry.d.ts.map +1 -0
  203. package/dist/lib/telemetry.js +61 -0
  204. package/dist/lib/telemetry.js.map +1 -0
  205. package/dist/utils/file-resolver.js +1 -3
  206. package/dist/utils/file-resolver.js.map +1 -1
  207. package/dist/utils/installation-setup.d.ts +15 -0
  208. package/dist/utils/installation-setup.d.ts.map +1 -1
  209. package/dist/utils/installation-setup.js +71 -8
  210. package/dist/utils/installation-setup.js.map +1 -1
  211. package/package.json +5 -21
  212. package/.claude/agents/TROUBLESHOOTING.md +0 -530
  213. package/.claude/agents/agent-backend.md +0 -574
  214. package/.claude/agents/agent-builder.md +0 -911
  215. package/.claude/agents/agent-claude.md +0 -645
  216. package/.claude/agents/agent-clean.md +0 -477
  217. package/.claude/agents/agent-clone.md +0 -554
  218. package/.claude/agents/agent-designer.md +0 -1080
  219. package/.claude/agents/agent-director.md +0 -2254
  220. package/.claude/agents/agent-documenter.md +0 -688
  221. package/.claude/agents/agent-frontend.md +0 -1199
  222. package/.claude/agents/agent-integrator.md +0 -670
  223. package/.claude/agents/agent-lawyer.md +0 -1320
  224. package/.claude/agents/agent-news.md +0 -363
  225. package/.claude/agents/agent-onboard.md +0 -613
  226. package/.claude/agents/agent-ontology.md +0 -585
  227. package/.claude/agents/agent-ops.md +0 -1275
  228. package/.claude/agents/agent-problem-solver.md +0 -669
  229. package/.claude/agents/agent-quality.md +0 -1042
  230. package/.claude/agents/agent-sales.md +0 -507
  231. package/.claude/agents/agent-writer.md +0 -1068
  232. package/.claude/commands/cascade.md +0 -742
  233. package/.claude/commands/chat.md +0 -728
  234. package/.claude/commands/commit.md +0 -95
  235. package/.claude/commands/create.md +0 -544
  236. package/.claude/commands/deploy.md +0 -309
  237. package/.claude/commands/fast.md +0 -636
  238. package/.claude/commands/mcp-on.md +0 -191
  239. package/.claude/commands/media-upload.md +0 -186
  240. package/.claude/commands/news.md +0 -274
  241. package/.claude/commands/onboard.md +0 -440
  242. package/.claude/commands/one.md +0 -398
  243. package/.claude/commands/optimize.md +0 -74
  244. package/.claude/commands/plan.md +0 -719
  245. package/.claude/commands/push.md +0 -214
  246. package/.claude/commands/release.md +0 -105
  247. package/.claude/commands/review.md +0 -99
  248. package/.claude/commands/server.md +0 -487
  249. package/.claude/commands/start.md +0 -227
  250. package/.claude/commands/test.md +0 -197
  251. package/.claude/commands/validate.md +0 -140
  252. package/.claude/hooks/.last-news-context +0 -1
  253. package/.claude/hooks/PULL-BEFORE-PUSH-GUIDE.md +0 -473
  254. package/.claude/hooks/README-knowledge-hooks.md +0 -451
  255. package/.claude/hooks/README-news-generation.md +0 -364
  256. package/.claude/hooks/README-root-cleanup.md +0 -200
  257. package/.claude/hooks/README.md +0 -284
  258. package/.claude/hooks/__pycache__/todo.cpython-312.pyc +0 -0
  259. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  260. package/.claude/hooks/auto-format.sh +0 -106
  261. package/.claude/hooks/check-filenames.py +0 -177
  262. package/.claude/hooks/clean-post.py +0 -468
  263. package/.claude/hooks/clean-pre.py +0 -393
  264. package/.claude/hooks/clean-root-markdown.sh +0 -73
  265. package/.claude/hooks/commit-push.sh +0 -95
  266. package/.claude/hooks/done.py +0 -236
  267. package/.claude/hooks/format-hook.sh +0 -163
  268. package/.claude/hooks/formatting.py +0 -187
  269. package/.claude/hooks/hook-logger.sh +0 -173
  270. package/.claude/hooks/knowledge-post.py +0 -355
  271. package/.claude/hooks/knowledge-pre.py +0 -245
  272. package/.claude/hooks/mcp-on.sh +0 -134
  273. package/.claude/hooks/notification-hook.sh +0 -279
  274. package/.claude/hooks/ontology-validation.py +0 -255
  275. package/.claude/hooks/push.sh +0 -153
  276. package/.claude/hooks/release-cli.sh +0 -205
  277. package/.claude/hooks/root-cleanup.py +0 -217
  278. package/.claude/hooks/security-hook.sh +0 -397
  279. package/.claude/hooks/tag-all-docs.py +0 -464
  280. package/.claude/hooks/test-validate-ontology.sh +0 -170
  281. package/.claude/hooks/todo.py +0 -368
  282. package/.claude/hooks/track-changes.sh +0 -101
  283. package/.claude/hooks/validate-imports.py +0 -182
  284. package/.claude/hooks/validate-ontology-structure-summary.md +0 -243
  285. package/.claude/hooks/validate-ontology-structure.py +0 -558
  286. package/.claude/hooks/validate-ontology-structure.py.backup +0 -518
  287. package/.claude/hooks/validate-ontology.py +0 -140
  288. package/.claude/hooks/write-news.sh +0 -194
  289. package/.claude/skills/INDEX.md +0 -523
  290. package/.claude/skills/REGISTRY.md +0 -529
  291. package/.claude/skills/agent-backend-create-mutation.md +0 -319
  292. package/.claude/skills/agent-designer-create-wireframe.md +0 -341
  293. package/.claude/skills/agent-frontend-create-page.md +0 -413
  294. package/.claude/skills/agents/README.md +0 -238
  295. package/.claude/skills/astro/add-content-collection.md +0 -30
  296. package/.claude/skills/astro/check-build.md +0 -29
  297. package/.claude/skills/astro/create-component.md +0 -29
  298. package/.claude/skills/astro/create-page.md +0 -30
  299. package/.claude/skills/astro/optimize-performance.md +0 -21
  300. package/.claude/skills/convex/check-deployment.md +0 -46
  301. package/.claude/skills/convex/create-mutation.md +0 -405
  302. package/.claude/skills/convex/create-query.md +0 -52
  303. package/.claude/skills/convex/read-schema.md +0 -373
  304. package/.claude/skills/convex/test-function.md +0 -50
  305. package/.claude/skills/deployment/check-deployment-health.md +0 -20
  306. package/.claude/skills/deployment/create-release.md +0 -21
  307. package/.claude/skills/deployment/deploy-cloudflare.md +0 -31
  308. package/.claude/skills/deployment/deploy-convex.md +0 -30
  309. package/.claude/skills/deployment/sync-repositories.md +0 -19
  310. package/.claude/skills/design/check-accessibility.md +0 -21
  311. package/.claude/skills/design/create-component-spec.md +0 -27
  312. package/.claude/skills/design/generate-design-tokens.md +0 -24
  313. package/.claude/skills/design/generate-wireframe.md +0 -30
  314. package/.claude/skills/documentation/create-migration-guide.md +0 -20
  315. package/.claude/skills/documentation/generate-api-docs.md +0 -27
  316. package/.claude/skills/documentation/generate-readme.md +0 -22
  317. package/.claude/skills/documentation/update-knowledge.md +0 -20
  318. package/.claude/skills/integration/connect-external-system.md +0 -21
  319. package/.claude/skills/integration/implement-a2a.md +0 -20
  320. package/.claude/skills/integration/implement-acp.md +0 -20
  321. package/.claude/skills/integration/verify-integration.md +0 -20
  322. package/.claude/skills/ontology/README.md +0 -255
  323. package/.claude/skills/ontology/check-dimension.md +0 -307
  324. package/.claude/skills/ontology/generate-entity-type.md +0 -339
  325. package/.claude/skills/ontology/validate-schema.md +0 -229
  326. package/.claude/skills/ontology/verify-relationships.md +0 -310
  327. package/.claude/skills/problem-solving/analyze-test-failure.md +0 -21
  328. package/.claude/skills/problem-solving/identify-root-cause.md +0 -20
  329. package/.claude/skills/problem-solving/propose-solution.md +0 -29
  330. package/.claude/skills/problem-solving/verify-fix.md +0 -21
  331. package/.claude/skills/sales/generate-demo-script.md +0 -21
  332. package/.claude/skills/sales/qualify-lead.md +0 -30
  333. package/.claude/skills/sales/track-trial.md +0 -20
  334. package/.claude/skills/sales/verify-kyc.md +0 -20
  335. package/.claude/skills/testing/analyze-coverage.md +0 -24
  336. package/.claude/skills/testing/generate-tests.md +0 -24
  337. package/.claude/skills/testing/run-tests.md +0 -27
  338. package/.claude/skills/testing/validate-e2e.md +0 -25
  339. package/AGENTS.md +0 -60
  340. package/CLAUDE.md +0 -321
  341. package/CREATE-WEBSITE.md +0 -458
  342. package/SECURITY.md +0 -31
  343. package/dist/commands/create-website.d.ts +0 -19
  344. package/dist/commands/create-website.d.ts.map +0 -1
  345. package/dist/commands/create-website.js +0 -231
  346. package/dist/commands/create-website.js.map +0 -1
  347. package/folders.yaml +0 -92
  348. package/one/README.md +0 -760
  349. package/one/connections/a2a.md +0 -600
  350. package/one/connections/acp.md +0 -808
  351. package/one/connections/acps.md +0 -749
  352. package/one/connections/agentkit.md +0 -367
  353. package/one/connections/agui.md +0 -785
  354. package/one/connections/any-backend.md +0 -1720
  355. package/one/connections/ap2.md +0 -1072
  356. package/one/connections/api/queries-reference.md +0 -860
  357. package/one/connections/api-docs.md +0 -1909
  358. package/one/connections/api-reference.md +0 -1029
  359. package/one/connections/api.md +0 -2208
  360. package/one/connections/architecture-diagram.md +0 -112
  361. package/one/connections/communications.md +0 -467
  362. package/one/connections/connections.md +0 -357
  363. package/one/connections/copilotkit.md +0 -1577
  364. package/one/connections/cryptonetworks.md +0 -799
  365. package/one/connections/documentation.md +0 -1138
  366. package/one/connections/effect.md +0 -297
  367. package/one/connections/elizaos.md +0 -1308
  368. package/one/connections/groups.md +0 -814
  369. package/one/connections/inference.md +0 -76
  370. package/one/connections/integration-examples.md +0 -893
  371. package/one/connections/integration-guide.md +0 -887
  372. package/one/connections/integration-phase2.md +0 -754
  373. package/one/connections/kyc.md +0 -650
  374. package/one/connections/mcp.md +0 -860
  375. package/one/connections/membership.md +0 -1170
  376. package/one/connections/middleware.md +0 -1085
  377. package/one/connections/multitenant.md +0 -1359
  378. package/one/connections/n8n.md +0 -1033
  379. package/one/connections/patterns.md +0 -107
  380. package/one/connections/protocols.md +0 -297
  381. package/one/connections/relationships.md +0 -125
  382. package/one/connections/schema.md +0 -605
  383. package/one/connections/service-layer.md +0 -568
  384. package/one/connections/vectors.md +0 -225
  385. package/one/connections/wordpress.md +0 -1320
  386. package/one/connections/workflow-copy.md +0 -923
  387. package/one/connections/workflow-examples.md +0 -759
  388. package/one/connections/workflow-onboarding.md +0 -701
  389. package/one/connections/workflow.md +0 -923
  390. package/one/connections/workflows/delegation.md +0 -903
  391. package/one/connections/workflows/frontend.md +0 -1055
  392. package/one/connections/workflows/strategy.md +0 -921
  393. package/one/connections/workflows/tasks.md +0 -716
  394. package/one/connections/x402-baazar.md +0 -131
  395. package/one/connections/x402.md +0 -1353
  396. package/one/groups/features.md +0 -2904
  397. package/one/groups/groups.md +0 -587
  398. package/one/groups/one.md +0 -619
  399. package/one/groups/strategy-copy.md +0 -887
  400. package/one/knowledge/.obsidian/app.json +0 -1
  401. package/one/knowledge/.obsidian/appearance.json +0 -1
  402. package/one/knowledge/.obsidian/core-plugins.json +0 -33
  403. package/one/knowledge/.obsidian/ecommerce-ontology.md +0 -210
  404. package/one/knowledge/.obsidian/workspace.json +0 -211
  405. package/one/knowledge/100-inference-quick-reference.md +0 -449
  406. package/one/knowledge/ag-ui-protocol.md +0 -613
  407. package/one/knowledge/agent-onboard-usage.md +0 -630
  408. package/one/knowledge/agentic-commerce.md +0 -146
  409. package/one/knowledge/ai-agents-vs-memecoins-thesis.md +0 -683
  410. package/one/knowledge/ai-api-reference.md +0 -715
  411. package/one/knowledge/ai-platform.md +0 -323
  412. package/one/knowledge/ai-quickstart.md +0 -355
  413. package/one/knowledge/ai-sdk-implementation.md +0 -436
  414. package/one/knowledge/ai-token-crypto-analysis-framework.md +0 -1191
  415. package/one/knowledge/ai-token-paradigm-shift-2025.md +0 -732
  416. package/one/knowledge/altcoin-cycle-prediction-ontology.md +0 -884
  417. package/one/knowledge/altcoin-cycle-trading-strategy.md +0 -642
  418. package/one/knowledge/architecture-any-backend.md +0 -1589
  419. package/one/knowledge/architecture-diagram.md +0 -404
  420. package/one/knowledge/architecture-frontend.md +0 -1014
  421. package/one/knowledge/architecture.md +0 -1742
  422. package/one/knowledge/archived/ontology.old.md +0 -2840
  423. package/one/knowledge/astro-effect-complete-vision.md +0 -2148
  424. package/one/knowledge/astro-effect-simple-architecture.md +0 -750
  425. package/one/knowledge/audit-agent-onboard-alignment.md +0 -481
  426. package/one/knowledge/audit-agent-sales-alignment.md +0 -444
  427. package/one/knowledge/backend-api-reference.md +0 -728
  428. package/one/knowledge/cascading-context-specification.md +0 -1617
  429. package/one/knowledge/claude-code-integration.md +0 -1293
  430. package/one/knowledge/cli-claude-handoff.md +0 -736
  431. package/one/knowledge/context-engineering.md +0 -610
  432. package/one/knowledge/crypto-analysis-strategy.md +0 -1276
  433. package/one/knowledge/crypto-cycle-2024-2025-analysis.md +0 -44
  434. package/one/knowledge/crypto.md +0 -978
  435. package/one/knowledge/develop/design.md +0 -364
  436. package/one/knowledge/develop/index.md +0 -145
  437. package/one/knowledge/development-commands.md +0 -251
  438. package/one/knowledge/docs.md +0 -627
  439. package/one/knowledge/dsl.md +0 -1678
  440. package/one/knowledge/event-driven-documentation.md +0 -270
  441. package/one/knowledge/files.md +0 -2489
  442. package/one/knowledge/frontend.md +0 -1056
  443. package/one/knowledge/games-english.md +0 -691
  444. package/one/knowledge/games.md +0 -1082
  445. package/one/knowledge/generative-ui-patterns.md +0 -559
  446. package/one/knowledge/guidelines.md +0 -314
  447. package/one/knowledge/hono.md +0 -2127
  448. package/one/knowledge/implementation-examples.md +0 -2554
  449. package/one/knowledge/installation-folders.md +0 -366
  450. package/one/knowledge/institutional-cycle-paradigm-2025.md +0 -555
  451. package/one/knowledge/knowledge.md +0 -660
  452. package/one/knowledge/language.md +0 -998
  453. package/one/knowledge/lessons-learned.md +0 -378
  454. package/one/knowledge/lessons-website-building-focus.md +0 -382
  455. package/one/knowledge/merge-report.md +0 -254
  456. package/one/knowledge/metadata-system.md +0 -504
  457. package/one/knowledge/nine-padel-playbook.md +0 -229
  458. package/one/knowledge/one-protocol-ai-agents.md +0 -892
  459. package/one/knowledge/one-protocol-executive-report.md +0 -617
  460. package/one/knowledge/one-protocol-standard.md +0 -869
  461. package/one/knowledge/one-protocol-whitepaper.md +0 -756
  462. package/one/knowledge/ontology-blog.yaml +0 -47
  463. package/one/knowledge/ontology-cheatsheet.md +0 -617
  464. package/one/knowledge/ontology-community.yaml +0 -65
  465. package/one/knowledge/ontology-core-universal.md +0 -740
  466. package/one/knowledge/ontology-core.yaml +0 -63
  467. package/one/knowledge/ontology-courses.yaml +0 -76
  468. package/one/knowledge/ontology-creator.md +0 -402
  469. package/one/knowledge/ontology-crypto.md +0 -1603
  470. package/one/knowledge/ontology-developer-guide.md +0 -814
  471. package/one/knowledge/ontology-documentation.md +0 -377
  472. package/one/knowledge/ontology-ecommerce.md +0 -269
  473. package/one/knowledge/ontology-education-game.md +0 -1654
  474. package/one/knowledge/ontology-education.md +0 -938
  475. package/one/knowledge/ontology-engineering-specification.md +0 -1310
  476. package/one/knowledge/ontology-engineering.md +0 -1676
  477. package/one/knowledge/ontology-files.yaml +0 -525
  478. package/one/knowledge/ontology-frontend-master.md +0 -2898
  479. package/one/knowledge/ontology-frontend-specifications.md +0 -2196
  480. package/one/knowledge/ontology-frontend.md +0 -2475
  481. package/one/knowledge/ontology-index.md +0 -397
  482. package/one/knowledge/ontology-minimal.yaml +0 -301
  483. package/one/knowledge/ontology-portfolio.yaml +0 -45
  484. package/one/knowledge/ontology-quickstart.md +0 -602
  485. package/one/knowledge/ontology-release.md +0 -317
  486. package/one/knowledge/ontology-shop.yaml +0 -148
  487. package/one/knowledge/ontology-tokens.yaml +0 -51
  488. package/one/knowledge/ontology-tutorial.md +0 -455
  489. package/one/knowledge/ontology-v2.md +0 -4449
  490. package/one/knowledge/ontology-video-script.md +0 -939
  491. package/one/knowledge/ontology-visual-guide.md +0 -378
  492. package/one/knowledge/ontology.md +0 -3847
  493. package/one/knowledge/ontology.yaml +0 -1653
  494. package/one/knowledge/parallel-agents.md +0 -932
  495. package/one/knowledge/patterns/backend/convex-mutation-pattern.md +0 -130
  496. package/one/knowledge/patterns/backend/convex-query-pattern.md +0 -143
  497. package/one/knowledge/patterns/backend/mutation-template.md +0 -249
  498. package/one/knowledge/patterns/backend/query-template.md +0 -286
  499. package/one/knowledge/patterns/backend/service-template.md +0 -258
  500. package/one/knowledge/patterns/design/component-architecture.md +0 -435
  501. package/one/knowledge/patterns/design/index.md +0 -160
  502. package/one/knowledge/patterns/design/test-driven-design-pattern.md +0 -196
  503. package/one/knowledge/patterns/design/wireframe-template.md +0 -250
  504. package/one/knowledge/patterns/frontend/component-template.md +0 -246
  505. package/one/knowledge/patterns/frontend/form-template.md +0 -348
  506. package/one/knowledge/patterns/frontend/page-template.md +0 -209
  507. package/one/knowledge/patterns/frontend/react-component-pattern.md +0 -188
  508. package/one/knowledge/patterns/test/acceptance-criteria-template.md +0 -396
  509. package/one/knowledge/patterns/test/technical-test-template.md +0 -566
  510. package/one/knowledge/patterns/test/test-driven-pattern.md +0 -160
  511. package/one/knowledge/patterns/test/user-flow-template.md +0 -272
  512. package/one/knowledge/performance.md +0 -459
  513. package/one/knowledge/provider-agnostic-content.md +0 -995
  514. package/one/knowledge/provider-creation-guide.md +0 -1082
  515. package/one/knowledge/quality-loop.md +0 -419
  516. package/one/knowledge/quick-start-ontology-mapping.md +0 -773
  517. package/one/knowledge/readme-architecture.md +0 -158
  518. package/one/knowledge/readme.md +0 -149
  519. package/one/knowledge/rules.md +0 -644
  520. package/one/knowledge/score.md +0 -85
  521. package/one/knowledge/specifications.md +0 -873
  522. package/one/knowledge/tags.md +0 -148
  523. package/one/knowledge/todo-template.md +0 -269
  524. package/one/knowledge/todo.md +0 -269
  525. package/one/knowledge/troubleshooting.md +0 -434
  526. package/one/knowledge/typescript-patterns.md +0 -321
  527. package/one/knowledge/universal-generation-language.md +0 -827
  528. package/one/knowledge/x402-research.md +0 -104
  529. package/one/license.md +0 -107
  530. package/one/people/anthony-o-connell.md +0 -469
  531. package/one/people/people.md +0 -590
  532. package/one/things/ALIGNMENT_AUDIT_QUALITY_AGENT.md +0 -401
  533. package/one/things/AUDIT_AGENT_INTEGRATOR_ALIGNMENT.md +0 -588
  534. package/one/things/AUDIT_REPORT_AGENT_CLEAN.md +0 -461
  535. package/one/things/CHECKLIST.md +0 -407
  536. package/one/things/IMPLEMENTATION_STATUS.md +0 -379
  537. package/one/things/ONE.md +0 -529
  538. package/one/things/agents/agent-backend.md +0 -1501
  539. package/one/things/agents/agent-builder.md +0 -1064
  540. package/one/things/agents/agent-clean.md +0 -1112
  541. package/one/things/agents/agent-clone.md +0 -1324
  542. package/one/things/agents/agent-deploy.md +0 -986
  543. package/one/things/agents/agent-designer.md +0 -2305
  544. package/one/things/agents/agent-director.md +0 -1526
  545. package/one/things/agents/agent-documenter.md +0 -1129
  546. package/one/things/agents/agent-frontend.md +0 -1201
  547. package/one/things/agents/agent-integrator.md +0 -1269
  548. package/one/things/agents/agent-lawyer.md +0 -1371
  549. package/one/things/agents/agent-problem-solver.md +0 -1457
  550. package/one/things/agents/agent-quality.md +0 -1483
  551. package/one/things/agents/agent-sales.md +0 -1074
  552. package/one/things/cascade/cascade.yaml +0 -481
  553. package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +0 -523
  554. package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +0 -314
  555. package/one/things/cascade/docs/examples/1-1-agent-prompts.md +0 -562
  556. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +0 -543
  557. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +0 -272
  558. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +0 -548
  559. package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +0 -586
  560. package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +0 -267
  561. package/one/things/cascade/docs/examples/1-3-event-coordination.md +0 -547
  562. package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +0 -665
  563. package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +0 -236
  564. package/one/things/cascade/docs/examples/1-4-knowledge-management.md +0 -652
  565. package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +0 -860
  566. package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +0 -255
  567. package/one/things/cascade/docs/examples/1-5-quality-loops.md +0 -725
  568. package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +0 -659
  569. package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +0 -256
  570. package/one/things/cascade/docs/examples/1-6-numbering-structure.md +0 -639
  571. package/one/things/cascade/docs/examples/readme.md +0 -259
  572. package/one/things/cascade/docs/getting-started.md +0 -533
  573. package/one/things/cascade/docs/workflow.md +0 -1378
  574. package/one/things/cascade/readme.md +0 -379
  575. package/one/things/cascade/templates/feature-template.md +0 -289
  576. package/one/things/claude/agents/advocacy-activation-manager.md +0 -710
  577. package/one/things/claude/agents/advocacy-campaign-designer.md +0 -688
  578. package/one/things/claude/agents/analyst.md +0 -508
  579. package/one/things/claude/agents/architect.md +0 -505
  580. package/one/things/claude/agents/brand-identity-specialist.md +0 -538
  581. package/one/things/claude/agents/bstp-token-strategist.md +0 -690
  582. package/one/things/claude/agents/builder-repo.md +0 -532
  583. package/one/things/claude/agents/bullstamp-community-builder.md +0 -597
  584. package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +0 -529
  585. package/one/things/claude/agents/bulltilt-platform-growth.md +0 -590
  586. package/one/things/claude/agents/company-bullstamp-character.md +0 -602
  587. package/one/things/claude/agents/company-bullstamp-community.md +0 -307
  588. package/one/things/claude/agents/company-bullstamp-marketing.md +0 -307
  589. package/one/things/claude/agents/company-bullstamp-token.md +0 -307
  590. package/one/things/claude/agents/company-bulltilt-growth.md +0 -307
  591. package/one/things/claude/agents/content-bibliography-formatter.md +0 -404
  592. package/one/things/claude/agents/content-calendar-planner.md +0 -473
  593. package/one/things/claude/agents/content-chapter-formatter.md +0 -513
  594. package/one/things/claude/agents/content-formatter.md +0 -571
  595. package/one/things/claude/agents/content-hook-specialist.md +0 -485
  596. package/one/things/claude/agents/content-image-formatter.md +0 -560
  597. package/one/things/claude/agents/content-introduction-formatter.md +0 -510
  598. package/one/things/claude/agents/content-multiplication-engine.md +0 -579
  599. package/one/things/claude/agents/content-playbook-writer.md +0 -473
  600. package/one/things/claude/agents/content-team-manager.md +0 -647
  601. package/one/things/claude/agents/content-toc-formatter.md +0 -547
  602. package/one/things/claude/agents/convex-backend-specialist.md +0 -2725
  603. package/one/things/claude/agents/core-manager.md +0 -607
  604. package/one/things/claude/agents/core-master.md +0 -426
  605. package/one/things/claude/agents/cross-functional-manager.md +0 -476
  606. package/one/things/claude/agents/crypto-airdrop-strategist.md +0 -622
  607. package/one/things/claude/agents/crypto-analytics-educator.md +0 -596
  608. package/one/things/claude/agents/crypto-architecture-specialist.md +0 -497
  609. package/one/things/claude/agents/crypto-community-analyst.md +0 -314
  610. package/one/things/claude/agents/crypto-community-psychologist.md +0 -546
  611. package/one/things/claude/agents/crypto-dex-optimization-expert.md +0 -579
  612. package/one/things/claude/agents/crypto-dex-optimizer.md +0 -307
  613. package/one/things/claude/agents/crypto-diamond-formation-specialist.md +0 -552
  614. package/one/things/claude/agents/crypto-diamond-hands.md +0 -307
  615. package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +0 -597
  616. package/one/things/claude/agents/crypto-engagement-specialist.md +0 -581
  617. package/one/things/claude/agents/crypto-market-researcher.md +0 -307
  618. package/one/things/claude/agents/crypto-marketing-orchestrator.md +0 -563
  619. package/one/things/claude/agents/crypto-network-effect-amplifier.md +0 -614
  620. package/one/things/claude/agents/crypto-optimization-analyst.md +0 -597
  621. package/one/things/claude/agents/crypto-strategic-synthesizer.md +0 -556
  622. package/one/things/claude/agents/crypto-team-manager.md +0 -392
  623. package/one/things/claude/agents/crypto-token-analyst.md +0 -319
  624. package/one/things/claude/agents/crypto-viral-content-creator.md +0 -549
  625. package/one/things/claude/agents/crypto-wallet-identification-expert.md +0 -527
  626. package/one/things/claude/agents/crypto-wallet-identifier.md +0 -307
  627. package/one/things/claude/agents/customer-journey-designer.md +0 -474
  628. package/one/things/claude/agents/customer-success-manager.md +0 -574
  629. package/one/things/claude/agents/dev.md +0 -406
  630. package/one/things/claude/agents/documenter.md +0 -548
  631. package/one/things/claude/agents/elevate-marketing-orchestrator.md +0 -403
  632. package/one/things/claude/agents/engagement-specialist.md +0 -502
  633. package/one/things/claude/agents/engineering-architect.md +0 -387
  634. package/one/things/claude/agents/engineering-business-analyst.md +0 -527
  635. package/one/things/claude/agents/engineering-developer.md +0 -386
  636. package/one/things/claude/agents/engineering-director.md +0 -322
  637. package/one/things/claude/agents/engineering-ingestor.md +0 -659
  638. package/one/things/claude/agents/engineering-product-manager.md +0 -525
  639. package/one/things/claude/agents/engineering-product-owner.md +0 -527
  640. package/one/things/claude/agents/engineering-project-coordinator.md +0 -525
  641. package/one/things/claude/agents/engineering-quality-assurance.md +0 -392
  642. package/one/things/claude/agents/engineering-team-manager.md +0 -515
  643. package/one/things/claude/agents/engineering-user-experience.md +0 -386
  644. package/one/things/claude/agents/framework-elevate-manager.md +0 -309
  645. package/one/things/claude/agents/improver.md +0 -805
  646. package/one/things/claude/agents/intelligence-team-manager.md +0 -390
  647. package/one/things/claude/agents/lead-capture-expert.md +0 -459
  648. package/one/things/claude/agents/lead-magnet-creator.md +0 -446
  649. package/one/things/claude/agents/market-research-analyst.md +0 -435
  650. package/one/things/claude/agents/marketing-brand-identity.md +0 -344
  651. package/one/things/claude/agents/marketing-content-hooks.md +0 -455
  652. package/one/things/claude/agents/marketing-content-multiplier.md +0 -331
  653. package/one/things/claude/agents/marketing-content-poster.md +0 -372
  654. package/one/things/claude/agents/marketing-customer-journey.md +0 -331
  655. package/one/things/claude/agents/marketing-director.md +0 -402
  656. package/one/things/claude/agents/marketing-engagement.md +0 -331
  657. package/one/things/claude/agents/marketing-lead-capture.md +0 -331
  658. package/one/things/claude/agents/marketing-lead-magnet.md +0 -331
  659. package/one/things/claude/agents/marketing-network-effects.md +0 -331
  660. package/one/things/claude/agents/marketing-nurture-campaigns.md +0 -331
  661. package/one/things/claude/agents/marketing-share-optimizer.md +0 -331
  662. package/one/things/claude/agents/marketing-team-manager.md +0 -451
  663. package/one/things/claude/agents/marketing-viral-growth.md +0 -232
  664. package/one/things/claude/agents/mission-commander.md +0 -378
  665. package/one/things/claude/agents/network-effect-analyst.md +0 -604
  666. package/one/things/claude/agents/nextjs-15-specialist.md +0 -1634
  667. package/one/things/claude/agents/npx.md +0 -946
  668. package/one/things/claude/agents/nurture-campaign-manager.md +0 -554
  669. package/one/things/claude/agents/one-master.md +0 -378
  670. package/one/things/claude/agents/one-orchestrator.md +0 -345
  671. package/one/things/claude/agents/one.md +0 -658
  672. package/one/things/claude/agents/playbook-generator.md +0 -526
  673. package/one/things/claude/agents/pm.md +0 -349
  674. package/one/things/claude/agents/po.md +0 -370
  675. package/one/things/claude/agents/qa.md +0 -361
  676. package/one/things/claude/agents/research-foundation-analyst.md +0 -324
  677. package/one/things/claude/agents/research-intelligence-gatherer.md +0 -435
  678. package/one/things/claude/agents/research-market-analyst.md +0 -324
  679. package/one/things/claude/agents/research-team-manager.md +0 -489
  680. package/one/things/claude/agents/sales-environment-optimizer.md +0 -519
  681. package/one/things/claude/agents/sales-team-manager.md +0 -407
  682. package/one/things/claude/agents/sales-upsell-strategist.md +0 -324
  683. package/one/things/claude/agents/service-advocacy-campaigns.md +0 -324
  684. package/one/things/claude/agents/service-advocacy-manager.md +0 -324
  685. package/one/things/claude/agents/service-success-manager.md +0 -324
  686. package/one/things/claude/agents/service-team-manager.md +0 -405
  687. package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +0 -2357
  688. package/one/things/claude/agents/share-optimization-specialist.md +0 -576
  689. package/one/things/claude/agents/sm.md +0 -352
  690. package/one/things/claude/agents/story-teller.md +0 -498
  691. package/one/things/claude/agents/task-master.md +0 -621
  692. package/one/things/claude/agents/tauri-cross-platform-specialist.md +0 -1912
  693. package/one/things/claude/agents/tester.md +0 -595
  694. package/one/things/claude/agents/the-bull-character-manager.md +0 -603
  695. package/one/things/claude/agents/tools-playbook-generator.md +0 -492
  696. package/one/things/claude/agents/turbo-repo-builder.md +0 -346
  697. package/one/things/claude/agents/upsell-strategist.md +0 -503
  698. package/one/things/claude/agents/ux-expert.md +0 -360
  699. package/one/things/claude/agents/viral-growth-orchestrator.md +0 -520
  700. package/one/things/claude/claude-code-hooks-development.json +0 -21
  701. package/one/things/claude/claude-code-hooks-production.json +0 -21
  702. package/one/things/claude/claude-code-hooks.json +0 -25
  703. package/one/things/claude/commands/agent.md +0 -124
  704. package/one/things/claude/commands/cascade-status.md +0 -153
  705. package/one/things/claude/commands/ingest.md +0 -343
  706. package/one/things/claude/commands/ingestor.md +0 -158
  707. package/one/things/claude/commands/mission.md +0 -103
  708. package/one/things/claude/commands/npx.md +0 -156
  709. package/one/things/claude/commands/one.md +0 -486
  710. package/one/things/claude/commands/quality-check.md +0 -252
  711. package/one/things/claude/commands/smart-route.md +0 -261
  712. package/one/things/claude/commands/start.md +0 -139
  713. package/one/things/claude/commands/story.md +0 -103
  714. package/one/things/claude/commands/task.md +0 -193
  715. package/one/things/claude/hook-bypass.json +0 -32
  716. package/one/things/claude/hooks/agent-hook-config.json +0 -427
  717. package/one/things/claude/hooks/build-hook.sh +0 -156
  718. package/one/things/claude/hooks/cleanup-hook.sh +0 -201
  719. package/one/things/claude/hooks/file-organization-hook.sh +0 -80
  720. package/one/things/claude/hooks/format-hook.sh +0 -43
  721. package/one/things/claude/hooks/hook-bypass.sh +0 -293
  722. package/one/things/claude/hooks/hook-debouncer.sh +0 -62
  723. package/one/things/claude/hooks/hook-logger.sh +0 -89
  724. package/one/things/claude/hooks/lint-hook.sh +0 -140
  725. package/one/things/claude/hooks/notification-hook.sh +0 -204
  726. package/one/things/claude/hooks/ontology-validation-hook.sh +0 -86
  727. package/one/things/claude/hooks/performance-metrics.json +0 -25
  728. package/one/things/claude/hooks/security-hook.sh +0 -256
  729. package/one/things/claude/hooks/story-validation-hook-enhanced.sh +0 -210
  730. package/one/things/claude/hooks/story-validation-hook.sh +0 -145
  731. package/one/things/claude/hooks/test-hook.sh +0 -145
  732. package/one/things/claude/hooks/test-story-validation.sh +0 -170
  733. package/one/things/claude/settings-local.json +0 -86
  734. package/one/things/cli/cli-code.md +0 -677
  735. package/one/things/cli/cli-compiler-code.md +0 -677
  736. package/one/things/cli/cli.md +0 -871
  737. package/one/things/components/card-shadcn.md +0 -953
  738. package/one/things/components/card.md +0 -1041
  739. package/one/things/components.md +0 -1743
  740. package/one/things/componets.md +0 -19
  741. package/one/things/contracts/Move.toml +0 -12
  742. package/one/things/contracts/README.md +0 -288
  743. package/one/things/contracts/one.move +0 -762
  744. package/one/things/contracts/sdk.ts +0 -578
  745. package/one/things/creator-diagram.md +0 -184
  746. package/one/things/crypto/FEATURES.md +0 -78
  747. package/one/things/crypto/ONECORE.md +0 -62
  748. package/one/things/crypto/ONECOREFAQ.md +0 -22
  749. package/one/things/crypto/ONECOREHOW.md +0 -46
  750. package/one/things/crypto/ONEENTERPRISE.md +0 -64
  751. package/one/things/crypto/ONEENTERPRISEFAQ.md +0 -64
  752. package/one/things/crypto/ONEENTERPRISEHOW.md +0 -53
  753. package/one/things/crypto/ONEPRO.md +0 -60
  754. package/one/things/crypto/ONEPROFAQ.md +0 -22
  755. package/one/things/crypto/ONEPROHOW.md +0 -53
  756. package/one/things/crypto/READMEAGENCY.md +0 -64
  757. package/one/things/crypto/VSL.md +0 -45
  758. package/one/things/crypto/WebsiteCopy.md +0 -176
  759. package/one/things/demo-accessibility-animations.md +0 -1025
  760. package/one/things/demo-components.md +0 -1310
  761. package/one/things/demo-design-summary.md +0 -692
  762. package/one/things/demo-design-system.md +0 -973
  763. package/one/things/demo-page-layouts.md +0 -1016
  764. package/one/things/design-system.md +0 -832
  765. package/one/things/designs/accessibility-audit.md +0 -877
  766. package/one/things/designs/component-specifications.md +0 -855
  767. package/one/things/designs/design-overview.md +0 -377
  768. package/one/things/designs/design-tokens.md +0 -448
  769. package/one/things/designs/wireframes-dashboard.md +0 -710
  770. package/one/things/docs/api-requests.md +0 -987
  771. package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +0 -485
  772. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +0 -465
  773. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +0 -425
  774. package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +0 -451
  775. package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +0 -536
  776. package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +0 -650
  777. package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +0 -473
  778. package/one/things/docs/ecommerce/QUICK-START.md +0 -405
  779. package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +0 -567
  780. package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +0 -271
  781. package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +0 -171
  782. package/one/things/docs/ecommerce/demo.astro +0 -309
  783. package/one/things/examples/children/lemonade-stand.md +0 -404
  784. package/one/things/examples/enterprise/crm-saas.md +0 -1444
  785. package/one/things/features/1-1-agent-prompts.md +0 -562
  786. package/one/things/features/1-2-yaml-orchestrator.md +0 -548
  787. package/one/things/features/1-3-event-coordination.md +0 -547
  788. package/one/things/features/1-4-knowledge-management.md +0 -652
  789. package/one/things/features/1-5-quality-loops.md +0 -725
  790. package/one/things/features/1-6-numbering-structure.md +0 -639
  791. package/one/things/features/2-1-dataprovider-interface.md +0 -2583
  792. package/one/things/features/2-2-config-system.md +0 -3242
  793. package/one/things/features/2-3-effectts-services.md +0 -1645
  794. package/one/things/features/2-4-react-hooks.md +0 -2136
  795. package/one/things/features/2-5-auth-migration.md +0 -2144
  796. package/one/things/features/2-6-dashboard-migration.md +0 -2084
  797. package/one/things/features/2-7-alternative-providers.md +0 -2578
  798. package/one/things/features/2-7-implementation-report.md +0 -724
  799. package/one/things/features/2-cli.md +0 -1720
  800. package/one/things/features/2-design.md +0 -1770
  801. package/one/things/features/2-tests.md +0 -576
  802. package/one/things/features/AUTH_HOOKS_IMPLEMENTATION.md +0 -576
  803. package/one/things/features/DECOUPLING.md +0 -290
  804. package/one/things/features/DEPLOYMENT.md +0 -470
  805. package/one/things/features/IMPLEMENTATION_SUMMARY.md +0 -362
  806. package/one/things/features/improve.md +0 -861
  807. package/one/things/features/remove-convex-deps.md +0 -63
  808. package/one/things/features/top-features.md +0 -87
  809. package/one/things/features/use-one-backend.md +0 -1217
  810. package/one/things/features-in-english.md +0 -200
  811. package/one/things/files.yaml +0 -721
  812. package/one/things/ideas/1-create-workflow.md +0 -207
  813. package/one/things/ideas/2-backend-agnostic-frontend.md +0 -439
  814. package/one/things/implementation/backend-guide.md +0 -457
  815. package/one/things/interface.md +0 -257
  816. package/one/things/landing-page-implementation.md +0 -455
  817. package/one/things/legal/README.md +0 -234
  818. package/one/things/legal/privacy-policy.md +0 -1227
  819. package/one/things/legal/terms-of-service.md +0 -1432
  820. package/one/things/master-workflow-plan.md +0 -806
  821. package/one/things/pay.one.ie.md +0 -53
  822. package/one/things/plans/0-in-sync.md +0 -136
  823. package/one/things/plans/0-timeline.md +0 -36
  824. package/one/things/plans/1-create-workflow.md +0 -732
  825. package/one/things/plans/QUICK-START-SIMPLIFICATION.md +0 -333
  826. package/one/things/plans/README-SIMPLIFICATION.md +0 -349
  827. package/one/things/plans/SIMPLIFICATION-EXAMPLES.md +0 -16
  828. package/one/things/plans/SIMPLIFICATION-SUMMARY.md +0 -455
  829. package/one/things/plans/ai-elements-integration.md +0 -483
  830. package/one/things/plans/ai-elements.md +0 -1278
  831. package/one/things/plans/ai-integration-plan.md +0 -263
  832. package/one/things/plans/ai-integration.md +0 -996
  833. package/one/things/plans/ai-sdk.md +0 -798
  834. package/one/things/plans/ai-tools.md +0 -621
  835. package/one/things/plans/app.md +0 -832
  836. package/one/things/plans/architecture-summary.md +0 -312
  837. package/one/things/plans/async-ai-agents.md +0 -233
  838. package/one/things/plans/backend-agnostic-frontend.md +0 -390
  839. package/one/things/plans/backend-cleanup-quickstart.md +0 -380
  840. package/one/things/plans/backend-ontology-conformance.md +0 -475
  841. package/one/things/plans/backend-status.md +0 -599
  842. package/one/things/plans/backend-structure.md +0 -847
  843. package/one/things/plans/backend-target-structure.md +0 -482
  844. package/one/things/plans/backend.md +0 -1175
  845. package/one/things/plans/better-auth-any-backend-revised.md +0 -1103
  846. package/one/things/plans/better-auth-any-backend.md +0 -1896
  847. package/one/things/plans/better-auth-available-features.md +0 -273
  848. package/one/things/plans/big-plan.md +0 -52
  849. package/one/things/plans/cli-updates-required.md +0 -320
  850. package/one/things/plans/complete-step-by-step.md +0 -1409
  851. package/one/things/plans/components.md +0 -709
  852. package/one/things/plans/convex-agents.md +0 -1034
  853. package/one/things/plans/convex-better-auth.md +0 -1141
  854. package/one/things/plans/convex-on-off.md +0 -407
  855. package/one/things/plans/crypto-token-researcher.md +0 -629
  856. package/one/things/plans/data-quality-metrics.md +0 -745
  857. package/one/things/plans/deep-researcher-agent.md +0 -466
  858. package/one/things/plans/deploy-to-cloudflare.md +0 -623
  859. package/one/things/plans/deployment-architecture.md +0 -469
  860. package/one/things/plans/desktop.md +0 -1139
  861. package/one/things/plans/development-plan.md +0 -1283
  862. package/one/things/plans/development-workflow-tldr.md +0 -207
  863. package/one/things/plans/development-workflow.md +0 -959
  864. package/one/things/plans/dsl-claude-code.md +0 -1011
  865. package/one/things/plans/effect-components.md +0 -1743
  866. package/one/things/plans/effect-patterns-reference.md +0 -2235
  867. package/one/things/plans/effect.md +0 -1806
  868. package/one/things/plans/email.md +0 -966
  869. package/one/things/plans/enhance-auth.md +0 -1692
  870. package/one/things/plans/execution-strategy.md +0 -1291
  871. package/one/things/plans/existing-infrastructure.md +0 -712
  872. package/one/things/plans/feature-based-sites.md +0 -894
  873. package/one/things/plans/frontend-effects.md +0 -1276
  874. package/one/things/plans/group-folder-multi-tenancy.md +0 -893
  875. package/one/things/plans/improve-codebase.md +0 -1811
  876. package/one/things/plans/install-components.md +0 -215
  877. package/one/things/plans/integrate-frontend-and-backend.md +0 -603
  878. package/one/things/plans/landing.md +0 -820
  879. package/one/things/plans/layout.md +0 -249
  880. package/one/things/plans/mail-backend.md +0 -1361
  881. package/one/things/plans/mail.md +0 -2677
  882. package/one/things/plans/mcp-clear-context-prompt.md +0 -81
  883. package/one/things/plans/mcp-simple.md +0 -248
  884. package/one/things/plans/multi-ontology-architecture.md +0 -885
  885. package/one/things/plans/next-features.md +0 -114
  886. package/one/things/plans/npx-agent-safety.md +0 -785
  887. package/one/things/plans/npx-agent.md +0 -1089
  888. package/one/things/plans/onboarding.md +0 -51
  889. package/one/things/plans/one-protocol-and-payone-usage.md +0 -82
  890. package/one/things/plans/one.md +0 -677
  891. package/one/things/plans/ontology-6-dimensions.md +0 -2201
  892. package/one/things/plans/ontology-compliance-audit.md +0 -342
  893. package/one/things/plans/ontology-driven-strategy.md +0 -882
  894. package/one/things/plans/ontology-refine.md +0 -586
  895. package/one/things/plans/ontology-ui-approach.md +0 -375
  896. package/one/things/plans/open-agent.md +0 -840
  897. package/one/things/plans/performace.md +0 -122
  898. package/one/things/plans/phase-1-foundation.md +0 -620
  899. package/one/things/plans/phase-3-implementation.md +0 -1037
  900. package/one/things/plans/plan-connect-to-api.md +0 -146
  901. package/one/things/plans/quick-wins.md +0 -1428
  902. package/one/things/plans/r2.md +0 -777
  903. package/one/things/plans/readme-backend-cleanup.md +0 -402
  904. package/one/things/plans/release.md +0 -507
  905. package/one/things/plans/remove-backend-development-from-agents.md +0 -1331
  906. package/one/things/plans/repos.md +0 -98
  907. package/one/things/plans/separate-copy-2.md +0 -1349
  908. package/one/things/plans/separate-copy-3.md +0 -2479
  909. package/one/things/plans/separate-copy.md +0 -1349
  910. package/one/things/plans/separate-demo.md +0 -864
  911. package/one/things/plans/separate.md +0 -1999
  912. package/one/things/plans/sequence.md +0 -2040
  913. package/one/things/plans/shadcn-integration-summary.md +0 -510
  914. package/one/things/plans/sidebar.md +0 -206
  915. package/one/things/plans/skills.md +0 -709
  916. package/one/things/plans/small-fixes.md +0 -23
  917. package/one/things/plans/start-new.md +0 -764
  918. package/one/things/plans/switch-off-auth.md +0 -42
  919. package/one/things/plans/sync-checklist.md +0 -351
  920. package/one/things/plans/test-backend-connection.md +0 -514
  921. package/one/things/plans/unified-implementation-plan.md +0 -934
  922. package/one/things/plans/update-demos.md +0 -581
  923. package/one/things/plans/use-our-backend.md +0 -572
  924. package/one/things/plans/video-backend.md +0 -638
  925. package/one/things/plans/video-frontend.md +0 -490
  926. package/one/things/plans/video-old-archived.md +0 -656
  927. package/one/things/plans/wave1-onboarding-100-inferences.md +0 -1686
  928. package/one/things/plans/wave1-onboarding-vision.md +0 -744
  929. package/one/things/plans/wave1-orchestration-summary.md +0 -604
  930. package/one/things/plans/wave1-specialist-assignments.md +0 -1413
  931. package/one/things/plans/workflow-files.md +0 -1210
  932. package/one/things/plans/workflow.md +0 -1378
  933. package/one/things/plans-u.md +0 -905
  934. package/one/things/products/Blockchain Products.md +0 -6278
  935. package/one/things/products/cascade-landing-page.md +0 -841
  936. package/one/things/products/cascade.md +0 -1568
  937. package/one/things/products/context-engineering.md +0 -1488
  938. package/one/things/products/onthology.md +0 -15
  939. package/one/things/products/ontology-ui-shadcn.md +0 -1302
  940. package/one/things/products/ontology-ui.md +0 -1429
  941. package/one/things/products/ontology.md +0 -789
  942. package/one/things/products/sdk.md +0 -573
  943. package/one/things/promptkit.md +0 -930
  944. package/one/things/repos/all-repos.md +0 -0
  945. package/one/things/scripts-clean-mac.sh +0 -409
  946. package/one/things/service-providers-new.md +0 -1052
  947. package/one/things/service-providers.md +0 -1121
  948. package/one/things/structure.md +0 -532
  949. package/one/things/system.md +0 -618
  950. package/one/things/templates.md +0 -294
  951. package/one/things/tests/2-1-dataprovider-interface.md +0 -1216
  952. package/one/things/tests/2-1-test-analysis.md +0 -544
  953. package/one/things/things.md +0 -384
  954. package/one/things/todo-acp-integration.md +0 -744
  955. package/one/things/todo-ai.md +0 -933
  956. package/one/things/todo-api.md +0 -1078
  957. package/one/things/todo-assignment.md +0 -580
  958. package/one/things/todo-buy-chatgpt.md +0 -1450
  959. package/one/things/todo-components.md +0 -1683
  960. package/one/things/todo-connections.md +0 -278
  961. package/one/things/todo-ecommerce-frontend.md +0 -1313
  962. package/one/things/todo-ecommerce.md +0 -569
  963. package/one/things/todo-effects.md +0 -1075
  964. package/one/things/todo-frontend-effects.md +0 -977
  965. package/one/things/todo-landing-page.md +0 -1091
  966. package/one/things/todo-mail.md +0 -1160
  967. package/one/things/todo-master-plan.md +0 -490
  968. package/one/things/todo-onboard.md +0 -666
  969. package/one/things/todo-one-ie.md +0 -538
  970. package/one/things/todo-page.md +0 -606
  971. package/one/things/todo-plans.md +0 -282
  972. package/one/things/todo-projects.md +0 -241
  973. package/one/things/todo-refactoring-plan.md +0 -366
  974. package/one/things/todo-release.md +0 -654
  975. package/one/things/todo-sequence.md +0 -1621
  976. package/one/things/todo-use-our-backend.md +0 -1908
  977. package/one/things/todo-workflow.md +0 -626
  978. package/one/things/todo-x402.md +0 -2047
  979. package/one/things/todo.md +0 -21
  980. package/one/things/video/scripts-crypto.md +0 -835
  981. package/one/things/video-script-backup.md +0 -318
  982. package/one/things/video-script-demo.md +0 -382
  983. package/one/things/video-script-ontology.md +0 -333
  984. package/one/things/video-script.md +0 -361
@@ -1,2578 +0,0 @@
1
- ---
2
- title: 2 7 Alternative Providers
3
- dimension: things
4
- category: features
5
- tags: ai, architecture, backend, frontend, ontology
6
- related_dimensions: events, groups, knowledge, people
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 things dimension in the features category.
13
- Location: one/things/features/2-7-alternative-providers.md
14
- Purpose: Documents feature 2-7: alternative providers (wordpress + notion)
15
- Related dimensions: events, groups, knowledge, people
16
- For AI agents: Read this to understand 2 7 alternative providers.
17
- ---
18
-
19
- # Feature 2-7: Alternative Providers (WordPress + Notion)
20
-
21
- **Feature ID:** `feature_2_7_alternative_providers`
22
- **Plan:** `plan_2_backend_agnostic_frontend`
23
- **Owner:** Integration Specialist
24
- **Status:** Detailed Specification Complete
25
- **Priority:** P2 (Strategic - Proves Flexibility)
26
- **Effort:** 2 weeks
27
- **Dependencies:** Feature 2-6 (Dashboard Migration Complete)
28
-
29
- ---
30
-
31
- ## Executive Summary
32
-
33
- This feature implements **WordPressProvider** and **NotionProvider** to prove the backend-agnostic architecture works. Organizations can choose their data backend independently, with full 6-dimension ontology support. Also includes **CompositeProvider** for multi-backend routing within a single organization.
34
-
35
- **Strategic Value:** Demonstrates ONE Platform's flexibility and enables organizations to leverage existing infrastructure (WordPress, Notion) while gaining ONE's AI capabilities.
36
-
37
- **Key Deliverables:**
38
-
39
- 1. Complete WordPressProvider implementation (REST API + ACF)
40
- 2. Complete NotionProvider implementation (Notion API + webhooks)
41
- 3. CompositeProvider for multi-backend routing
42
- 4. Comprehensive test suite (50+ tests)
43
- 5. Provider creation guide for future backends
44
-
45
- ---
46
-
47
- ## Ontology Mapping (All 6 Dimensions)
48
-
49
- ### 1. Organizations (Multi-Tenant Isolation)
50
-
51
- **Challenge:** External systems (WordPress, Notion) don't have built-in multi-tenancy matching ONE's organization model.
52
-
53
- **Solution:**
54
-
55
- - Each organization gets its own WordPress site URL or Notion workspace
56
- - Provider configuration stored per-organization in ONE's organizations table
57
- - Provider acts as tenant-scoped wrapper around external API
58
-
59
- **Implementation:**
60
-
61
- ```typescript
62
- // organizations table stores provider config
63
- {
64
- _id: "org_123",
65
- name: "Acme Corp",
66
- plan: "pro",
67
- properties: {
68
- providerType: "wordpress",
69
- providerConfig: {
70
- url: "https://acme.wordpress.com",
71
- apiKey: encryptedApiKey,
72
- version: "6.4",
73
- customPostTypes: ["course", "lesson", "creator"]
74
- }
75
- }
76
- }
77
-
78
- // Provider registry isolates by org
79
- class ProviderRegistry {
80
- private providers = new Map<string, DataProvider>();
81
-
82
- register(orgId: string, provider: DataProvider) {
83
- this.providers.set(orgId, provider);
84
- }
85
-
86
- get(orgId: string): DataProvider {
87
- const provider = this.providers.get(orgId);
88
- if (!provider) throw new Error(`No provider for org ${orgId}`);
89
- return provider;
90
- }
91
- }
92
- ```
93
-
94
- **WordPress Multi-Tenancy:**
95
-
96
- - Option 1: WordPress Multisite (one WP install, multiple sites)
97
- - Option 2: Separate WP installs per organization
98
- - Option 3: Custom tenant field in all tables
99
-
100
- **Notion Multi-Tenancy:**
101
-
102
- - Option 1: Separate Notion workspaces per organization
103
- - Option 2: Single workspace with database-level isolation
104
- - Option 3: Custom "Organization" property on all pages
105
-
106
- ### 2. People (Authorization & Governance)
107
-
108
- **Challenge:** WordPress and Notion have different user/permission models than ONE's 4-role system.
109
-
110
- **WordPress User Mapping:**
111
- | ONE Role | WordPress Role | Capabilities |
112
- |----------|---------------|--------------|
113
- | `platform_owner` | Super Admin | All capabilities |
114
- | `org_owner` | Administrator | Manage site, users, content |
115
- | `org_user` | Editor | Create/edit content |
116
- | `customer` | Subscriber | Read-only access |
117
-
118
- **Notion User Mapping:**
119
- | ONE Role | Notion Permission | Access |
120
- |----------|------------------|--------|
121
- | `platform_owner` | Workspace Owner | Full access |
122
- | `org_owner` | Full Access | Edit all pages/databases |
123
- | `org_user` | Can Edit | Edit assigned pages |
124
- | `customer` | Can View | Read-only |
125
-
126
- **Implementation:**
127
-
128
- ```typescript
129
- class WordPressProvider implements DataProvider {
130
- people: PeopleOperations = {
131
- list: async (filter) => {
132
- // Get WordPress users
133
- const response = await this.api.get("/wp/v2/users");
134
- const wpUsers = await response.json();
135
-
136
- // Transform to ONE people (things with type: "creator")
137
- return wpUsers.map((user) => ({
138
- _id: this.wpIdToOneId("user", user.id),
139
- type: "creator",
140
- name: user.name,
141
- organizationId: this.config.organizationId,
142
- status: "active",
143
- properties: {
144
- role: this.mapWPRoleToONE(user.roles[0]),
145
- email: user.email,
146
- wpUserId: user.id,
147
- wpUsername: user.slug,
148
- avatar: user.avatar_urls?.["96"],
149
- registeredDate: user.registered_date,
150
- },
151
- createdAt: new Date(user.registered_date).getTime(),
152
- updatedAt: Date.now(),
153
- }));
154
- },
155
-
156
- create: async (args) => {
157
- // Transform ONE person to WP user
158
- const wpUser = {
159
- username: args.properties.email.split("@")[0],
160
- email: args.properties.email,
161
- password: this.generateSecurePassword(),
162
- roles: [this.mapONERoleToWP(args.properties.role)],
163
- first_name: args.properties.firstName,
164
- last_name: args.properties.lastName,
165
- };
166
-
167
- const response = await this.api.post("/wp/v2/users", wpUser);
168
- const created = await response.json();
169
-
170
- // Transform back to ONE person
171
- return this.transformWPUserToPerson(created);
172
- },
173
-
174
- update: async (id, updates) => {
175
- const wpId = this.oneIdToWpId(id);
176
-
177
- const wpUpdates: any = {};
178
- if (updates.name) {
179
- const [firstName, ...lastNameParts] = updates.name.split(" ");
180
- wpUpdates.first_name = firstName;
181
- wpUpdates.last_name = lastNameParts.join(" ");
182
- }
183
- if (updates.properties?.role) {
184
- wpUpdates.roles = [this.mapONERoleToWP(updates.properties.role)];
185
- }
186
-
187
- const response = await this.api.post(`/wp/v2/users/${wpId}`, wpUpdates);
188
- return this.transformWPUserToPerson(await response.json());
189
- },
190
-
191
- delete: async (id) => {
192
- const wpId = this.oneIdToWpId(id);
193
- await this.api.delete(`/wp/v2/users/${wpId}?force=true&reassign=1`);
194
- },
195
-
196
- get: async (id) => {
197
- const wpId = this.oneIdToWpId(id);
198
- const response = await this.api.get(`/wp/v2/users/${wpId}`);
199
- return this.transformWPUserToPerson(await response.json());
200
- },
201
- };
202
-
203
- private mapWPRoleToONE(wpRole: string): string {
204
- const mapping: Record<string, string> = {
205
- administrator: "org_owner",
206
- editor: "org_user",
207
- author: "org_user",
208
- contributor: "org_user",
209
- subscriber: "customer",
210
- };
211
- return mapping[wpRole] || "customer";
212
- }
213
-
214
- private mapONERoleToWP(oneRole: string): string {
215
- const mapping: Record<string, string> = {
216
- org_owner: "administrator",
217
- org_user: "editor",
218
- customer: "subscriber",
219
- };
220
- return mapping[oneRole] || "subscriber";
221
- }
222
- }
223
- ```
224
-
225
- ### 3. Things (Entity Integration)
226
-
227
- **WordPress Entity Mapping:**
228
-
229
- | ONE Thing Type | WordPress Equivalent | Implementation |
230
- | ---------------- | ------------------------------- | ---------------------------- |
231
- | `course` | Custom Post Type: `course` | ACF fields for properties |
232
- | `lesson` | Custom Post Type: `lesson` | ACF fields for properties |
233
- | `creator` | WP User | Via `/wp/v2/users` |
234
- | `token` | WooCommerce Product | Via WooCommerce REST API |
235
- | `certificate` | Custom Post Type: `certificate` | ACF fields for properties |
236
- | `quiz` | Custom Post Type: `quiz` | ACF fields for properties |
237
- | `external_agent` | Custom Post Type: `agent` | ACF fields for configuration |
238
-
239
- **Notion Entity Mapping:**
240
-
241
- | ONE Thing Type | Notion Equivalent | Implementation |
242
- | ---------------- | ------------------------ | -------------------------------------- |
243
- | `course` | Database: "Courses" | Properties: Name, Status, Description |
244
- | `lesson` | Database: "Lessons" | Properties: Name, Content, Duration |
245
- | `creator` | Database: "Users" | Properties: Name, Email, Role |
246
- | `token` | Database: "Tokens" | Properties: Symbol, Balance, Owner |
247
- | `certificate` | Database: "Certificates" | Properties: Recipient, Course, Date |
248
- | `quiz` | Database: "Quizzes" | Properties: Questions, Answers, Score |
249
- | `external_agent` | Database: "Agents" | Properties: Platform, Endpoint, Config |
250
-
251
- **Complete WordPressProvider Things Implementation:**
252
-
253
- ```typescript
254
- class WordPressProvider implements DataProvider {
255
- private api: WordPressAPI;
256
- private config: WordPressProviderConfig;
257
-
258
- constructor(config: WordPressProviderConfig) {
259
- this.config = config;
260
- this.api = new WordPressAPI(config.url, config.apiKey);
261
- }
262
-
263
- things: ThingOperations = {
264
- list: async (filter) => {
265
- const postType = this.mapOntologyTypeToWP(filter.type);
266
-
267
- // Build WordPress query parameters
268
- const params = new URLSearchParams({
269
- per_page: String(filter.limit || 10),
270
- page: String((filter.skip || 0) / (filter.limit || 10) + 1),
271
- });
272
-
273
- if (filter.status) {
274
- params.append("status", this.mapOntologyStatusToWP(filter.status));
275
- }
276
-
277
- if (filter.organizationId) {
278
- // Filter by organization using custom taxonomy
279
- params.append("org_id", filter.organizationId);
280
- }
281
-
282
- // Make API request
283
- const response = await this.api.get(
284
- `/wp/v2/${postType}?${params.toString()}`,
285
- );
286
- const wpPosts = await response.json();
287
-
288
- // Transform WordPress posts to ontology things
289
- return Promise.all(
290
- wpPosts.map((post: any) =>
291
- this.transformWPPostToThing(post, filter.type),
292
- ),
293
- );
294
- },
295
-
296
- create: async (args) => {
297
- const postType = this.mapOntologyTypeToWP(args.type);
298
-
299
- // Transform ontology thing to WordPress post
300
- const wpPost = {
301
- title: args.name,
302
- status: this.mapOntologyStatusToWP(args.status || "draft"),
303
- content: args.properties.content || "",
304
- excerpt: args.properties.excerpt || "",
305
- meta: {
306
- _one_thing_type: args.type,
307
- _one_organization_id: args.organizationId,
308
- ...this.transformPropertiesToACF(args.properties),
309
- },
310
- };
311
-
312
- // Create post in WordPress
313
- const response = await this.api.post(`/wp/v2/${postType}`, wpPost);
314
- const created = await response.json();
315
-
316
- // Transform back to ontology thing
317
- return this.transformWPPostToThing(created, args.type);
318
- },
319
-
320
- update: async (id, updates) => {
321
- const { wpId, postType } = this.parseOneId(id);
322
-
323
- const wpUpdates: any = {};
324
-
325
- if (updates.name) wpUpdates.title = updates.name;
326
- if (updates.status)
327
- wpUpdates.status = this.mapOntologyStatusToWP(updates.status);
328
- if (updates.properties) {
329
- wpUpdates.meta = this.transformPropertiesToACF(updates.properties);
330
- }
331
-
332
- const response = await this.api.post(
333
- `/wp/v2/${postType}/${wpId}`,
334
- wpUpdates,
335
- );
336
- const updated = await response.json();
337
-
338
- return this.transformWPPostToThing(updated, updates.type || postType);
339
- },
340
-
341
- delete: async (id) => {
342
- const { wpId, postType } = this.parseOneId(id);
343
- await this.api.delete(`/wp/v2/${postType}/${wpId}?force=true`);
344
- },
345
-
346
- get: async (id) => {
347
- const { wpId, postType } = this.parseOneId(id);
348
- const response = await this.api.get(`/wp/v2/${postType}/${wpId}`);
349
- const post = await response.json();
350
- return this.transformWPPostToThing(post, postType);
351
- },
352
- };
353
-
354
- // Transform WordPress post to ONE thing
355
- private async transformWPPostToThing(
356
- post: any,
357
- thingType: string,
358
- ): Promise<Thing> {
359
- // Get ACF fields
360
- const acfFields = await this.getACFFields(post.id);
361
-
362
- return {
363
- _id: this.wpIdToOneId(post.type, post.id),
364
- type: thingType,
365
- name: post.title.rendered || post.title,
366
- organizationId:
367
- post.meta._one_organization_id || this.config.organizationId,
368
- status: this.mapWPStatusToOntology(post.status),
369
- properties: {
370
- content: post.content?.rendered || post.content,
371
- excerpt: post.excerpt?.rendered || post.excerpt,
372
- slug: post.slug,
373
- wpPostId: post.id,
374
- wpPostType: post.type,
375
- author: post.author,
376
- featuredImage: post.featured_media,
377
- categories: post.categories,
378
- tags: post.tags,
379
- ...this.transformACFToProperties(acfFields),
380
- },
381
- createdAt: new Date(post.date_gmt).getTime(),
382
- updatedAt: new Date(post.modified_gmt).getTime(),
383
- };
384
- }
385
-
386
- // Map ontology types to WordPress post types
387
- private mapOntologyTypeToWP(type: string): string {
388
- const mapping: Record<string, string> = {
389
- course: "course",
390
- lesson: "lesson",
391
- creator: "user",
392
- quiz: "quiz",
393
- certificate: "certificate",
394
- token: "product", // WooCommerce
395
- external_agent: "agent",
396
- external_workflow: "workflow",
397
- external_connection: "connection",
398
- blog_post: "post",
399
- page: "page",
400
- };
401
- return mapping[type] || "post";
402
- }
403
-
404
- // Map WordPress post types to ontology types
405
- private mapWPTypeToOntology(wpType: string): string {
406
- const mapping: Record<string, string> = {
407
- course: "course",
408
- lesson: "lesson",
409
- user: "creator",
410
- quiz: "quiz",
411
- certificate: "certificate",
412
- product: "token",
413
- agent: "external_agent",
414
- workflow: "external_workflow",
415
- connection: "external_connection",
416
- post: "blog_post",
417
- page: "page",
418
- };
419
- return mapping[wpType] || "blog_post";
420
- }
421
-
422
- // Map ontology status to WordPress status
423
- private mapOntologyStatusToWP(status: string): string {
424
- const mapping: Record<string, string> = {
425
- draft: "draft",
426
- active: "publish",
427
- published: "publish",
428
- archived: "trash",
429
- pending: "pending",
430
- };
431
- return mapping[status] || "draft";
432
- }
433
-
434
- // Map WordPress status to ontology status
435
- private mapWPStatusToOntology(wpStatus: string): string {
436
- const mapping: Record<string, string> = {
437
- draft: "draft",
438
- publish: "active",
439
- pending: "pending",
440
- private: "active",
441
- trash: "archived",
442
- "auto-draft": "draft",
443
- };
444
- return mapping[wpStatus] || "draft";
445
- }
446
-
447
- // Transform ontology properties to ACF fields
448
- private transformPropertiesToACF(properties: any): Record<string, any> {
449
- const acfFields: Record<string, any> = {};
450
-
451
- // Map common fields
452
- if (properties.duration) acfFields.duration = properties.duration;
453
- if (properties.price) acfFields.price = properties.price;
454
- if (properties.currency) acfFields.currency = properties.currency;
455
- if (properties.difficulty) acfFields.difficulty = properties.difficulty;
456
- if (properties.videoUrl) acfFields.video_url = properties.videoUrl;
457
- if (properties.prerequisites) {
458
- acfFields.prerequisites = JSON.stringify(properties.prerequisites);
459
- }
460
-
461
- // Store full properties as JSON for unknown fields
462
- acfFields._one_properties = JSON.stringify(properties);
463
-
464
- return acfFields;
465
- }
466
-
467
- // Transform ACF fields to ontology properties
468
- private transformACFToProperties(acfFields: any): Record<string, any> {
469
- const properties: Record<string, any> = {};
470
-
471
- // Parse stored properties JSON
472
- if (acfFields._one_properties) {
473
- try {
474
- Object.assign(properties, JSON.parse(acfFields._one_properties));
475
- } catch (e) {
476
- // Ignore parse errors
477
- }
478
- }
479
-
480
- // Map known ACF fields
481
- if (acfFields.duration) properties.duration = acfFields.duration;
482
- if (acfFields.price) properties.price = acfFields.price;
483
- if (acfFields.currency) properties.currency = acfFields.currency;
484
- if (acfFields.difficulty) properties.difficulty = acfFields.difficulty;
485
- if (acfFields.video_url) properties.videoUrl = acfFields.video_url;
486
- if (acfFields.prerequisites) {
487
- try {
488
- properties.prerequisites = JSON.parse(acfFields.prerequisites);
489
- } catch (e) {
490
- properties.prerequisites = acfFields.prerequisites;
491
- }
492
- }
493
-
494
- return properties;
495
- }
496
-
497
- // Get ACF fields for a post
498
- private async getACFFields(postId: number): Promise<any> {
499
- try {
500
- const response = await this.api.get(`/acf/v3/posts/${postId}`);
501
- const data = await response.json();
502
- return data.acf || {};
503
- } catch (e) {
504
- // ACF not available or no fields
505
- return {};
506
- }
507
- }
508
-
509
- // Convert WordPress ID to ONE ID
510
- private wpIdToOneId(postType: string, wpId: number): string {
511
- return `wp_${postType}_${wpId}`;
512
- }
513
-
514
- // Convert ONE ID to WordPress ID
515
- private oneIdToWpId(oneId: string): number {
516
- const match = oneId.match(/^wp_[^_]+_(\d+)$/);
517
- if (!match) throw new Error(`Invalid ONE ID for WordPress: ${oneId}`);
518
- return parseInt(match[1], 10);
519
- }
520
-
521
- // Parse ONE ID to get WordPress ID and post type
522
- private parseOneId(oneId: string): { wpId: number; postType: string } {
523
- const match = oneId.match(/^wp_([^_]+)_(\d+)$/);
524
- if (!match) throw new Error(`Invalid ONE ID for WordPress: ${oneId}`);
525
- return {
526
- postType: match[1],
527
- wpId: parseInt(match[2], 10),
528
- };
529
- }
530
- }
531
-
532
- // WordPress API client with authentication
533
- class WordPressAPI {
534
- constructor(
535
- private baseUrl: string,
536
- private apiKey: string,
537
- ) {}
538
-
539
- async get(path: string): Promise<Response> {
540
- return this.request("GET", path);
541
- }
542
-
543
- async post(path: string, body: any): Promise<Response> {
544
- return this.request("POST", path, body);
545
- }
546
-
547
- async delete(path: string): Promise<Response> {
548
- return this.request("DELETE", path);
549
- }
550
-
551
- private async request(
552
- method: string,
553
- path: string,
554
- body?: any,
555
- ): Promise<Response> {
556
- const url = `${this.baseUrl}${path}`;
557
-
558
- const headers: HeadersInit = {
559
- Authorization: `Bearer ${this.apiKey}`,
560
- "Content-Type": "application/json",
561
- };
562
-
563
- const options: RequestInit = {
564
- method,
565
- headers,
566
- };
567
-
568
- if (body) {
569
- options.body = JSON.stringify(body);
570
- }
571
-
572
- const response = await fetch(url, options);
573
-
574
- if (!response.ok) {
575
- throw new WordPressAPIError(
576
- `WordPress API error: ${response.status} ${response.statusText}`,
577
- response.status,
578
- await response.text(),
579
- );
580
- }
581
-
582
- return response;
583
- }
584
- }
585
-
586
- class WordPressAPIError extends Error {
587
- constructor(
588
- message: string,
589
- public status: number,
590
- public responseBody: string,
591
- ) {
592
- super(message);
593
- this.name = "WordPressAPIError";
594
- }
595
- }
596
-
597
- interface WordPressProviderConfig {
598
- url: string;
599
- apiKey: string;
600
- organizationId: string;
601
- version?: string;
602
- customPostTypes?: string[];
603
- }
604
- ```
605
-
606
- **Complete NotionProvider Things Implementation:**
607
-
608
- ```typescript
609
- import { Client } from "@notionhq/client";
610
-
611
- class NotionProvider implements DataProvider {
612
- private notion: Client;
613
- private config: NotionProviderConfig;
614
-
615
- constructor(config: NotionProviderConfig) {
616
- this.config = config;
617
- this.notion = new Client({ auth: config.apiKey });
618
- }
619
-
620
- things: ThingOperations = {
621
- list: async (filter) => {
622
- const databaseId = this.config.databaseIds[filter.type];
623
- if (!databaseId) {
624
- throw new Error(
625
- `No Notion database configured for type: ${filter.type}`,
626
- );
627
- }
628
-
629
- // Build Notion filter
630
- const notionFilter: any = {};
631
-
632
- if (filter.status) {
633
- notionFilter.property = "Status";
634
- notionFilter.select = {
635
- equals: this.mapOntologyStatusToNotion(filter.status),
636
- };
637
- }
638
-
639
- // Query Notion database
640
- const response = await this.notion.databases.query({
641
- database_id: databaseId,
642
- filter: Object.keys(notionFilter).length > 0 ? notionFilter : undefined,
643
- page_size: filter.limit || 10,
644
- start_cursor: filter.cursor,
645
- });
646
-
647
- // Transform Notion pages to ontology things
648
- return Promise.all(
649
- response.results.map((page: any) =>
650
- this.transformNotionPageToThing(page, filter.type),
651
- ),
652
- );
653
- },
654
-
655
- create: async (args) => {
656
- const databaseId = this.config.databaseIds[args.type];
657
- if (!databaseId) {
658
- throw new Error(`No Notion database configured for type: ${args.type}`);
659
- }
660
-
661
- // Transform ontology thing to Notion page
662
- const properties = this.transformThingPropertiesToNotion(args);
663
-
664
- // Create page in Notion
665
- const response = await this.notion.pages.create({
666
- parent: { database_id: databaseId },
667
- properties,
668
- });
669
-
670
- // Transform back to ontology thing
671
- return this.transformNotionPageToThing(response, args.type);
672
- },
673
-
674
- update: async (id, updates) => {
675
- const notionId = this.oneIdToNotionId(id);
676
-
677
- // Build Notion properties update
678
- const properties: any = {};
679
-
680
- if (updates.name) {
681
- properties.Name = { title: [{ text: { content: updates.name } }] };
682
- }
683
-
684
- if (updates.status) {
685
- properties.Status = {
686
- select: { name: this.mapOntologyStatusToNotion(updates.status) },
687
- };
688
- }
689
-
690
- if (updates.properties) {
691
- Object.assign(
692
- properties,
693
- this.transformPropertiesToNotionUpdate(updates.properties),
694
- );
695
- }
696
-
697
- // Update page in Notion
698
- const response = await this.notion.pages.update({
699
- page_id: notionId,
700
- properties,
701
- });
702
-
703
- return this.transformNotionPageToThing(response, updates.type);
704
- },
705
-
706
- delete: async (id) => {
707
- const notionId = this.oneIdToNotionId(id);
708
-
709
- // Notion doesn't have true delete, only archive
710
- await this.notion.pages.update({
711
- page_id: notionId,
712
- archived: true,
713
- });
714
- },
715
-
716
- get: async (id) => {
717
- const notionId = this.oneIdToNotionId(id);
718
- const response = await this.notion.pages.retrieve({ page_id: notionId });
719
-
720
- // Determine type from database
721
- const databaseId = (response as any).parent.database_id;
722
- const type = this.findTypeByDatabaseId(databaseId);
723
-
724
- return this.transformNotionPageToThing(response, type);
725
- },
726
- };
727
-
728
- // Transform Notion page to ONE thing
729
- private async transformNotionPageToThing(
730
- page: any,
731
- thingType: string,
732
- ): Promise<Thing> {
733
- const props = page.properties;
734
-
735
- // Extract name (usually the title property)
736
- let name = "Untitled";
737
- const titleProp = Object.values(props).find(
738
- (p: any) => p.type === "title",
739
- ) as any;
740
- if (titleProp?.title?.[0]?.text?.content) {
741
- name = titleProp.title[0].text.content;
742
- }
743
-
744
- // Extract status
745
- let status = "draft";
746
- if (props.Status?.select?.name) {
747
- status = this.mapNotionStatusToOntology(props.Status.select.name);
748
- }
749
-
750
- // Extract all properties
751
- const properties = await this.extractNotionProperties(props);
752
-
753
- return {
754
- _id: this.notionIdToOneId(page.id),
755
- type: thingType,
756
- name,
757
- organizationId: this.config.organizationId,
758
- status,
759
- properties: {
760
- ...properties,
761
- notionPageId: page.id,
762
- notionUrl: page.url,
763
- notionIcon: page.icon,
764
- notionCover: page.cover,
765
- },
766
- createdAt: new Date(page.created_time).getTime(),
767
- updatedAt: new Date(page.last_edited_time).getTime(),
768
- };
769
- }
770
-
771
- // Transform ontology thing to Notion properties
772
- private transformThingPropertiesToNotion(thing: any): any {
773
- const properties: any = {
774
- Name: {
775
- title: [{ text: { content: thing.name } }],
776
- },
777
- Status: {
778
- select: {
779
- name: this.mapOntologyStatusToNotion(thing.status || "draft"),
780
- },
781
- },
782
- };
783
-
784
- // Organization (relation or text)
785
- if (thing.organizationId) {
786
- properties["Organization ID"] = {
787
- rich_text: [{ text: { content: thing.organizationId } }],
788
- };
789
- }
790
-
791
- // Map common properties
792
- if (thing.properties) {
793
- if (thing.properties.content) {
794
- properties.Content = {
795
- rich_text: [{ text: { content: thing.properties.content } }],
796
- };
797
- }
798
- if (thing.properties.duration) {
799
- properties.Duration = { number: thing.properties.duration };
800
- }
801
- if (thing.properties.price) {
802
- properties.Price = { number: thing.properties.price };
803
- }
804
- if (thing.properties.currency) {
805
- properties.Currency = {
806
- select: { name: thing.properties.currency },
807
- };
808
- }
809
- if (thing.properties.difficulty) {
810
- properties.Difficulty = {
811
- select: { name: thing.properties.difficulty },
812
- };
813
- }
814
-
815
- // Store full properties as JSON in a text field
816
- properties["ONE Properties"] = {
817
- rich_text: [{ text: { content: JSON.stringify(thing.properties) } }],
818
- };
819
- }
820
-
821
- return properties;
822
- }
823
-
824
- // Transform Notion properties update
825
- private transformPropertiesToNotionUpdate(properties: any): any {
826
- const notionProps: any = {};
827
-
828
- if (properties.content) {
829
- notionProps.Content = {
830
- rich_text: [{ text: { content: properties.content } }],
831
- };
832
- }
833
- if (properties.duration !== undefined) {
834
- notionProps.Duration = { number: properties.duration };
835
- }
836
- if (properties.price !== undefined) {
837
- notionProps.Price = { number: properties.price };
838
- }
839
- if (properties.currency) {
840
- notionProps.Currency = { select: { name: properties.currency } };
841
- }
842
- if (properties.difficulty) {
843
- notionProps.Difficulty = { select: { name: properties.difficulty } };
844
- }
845
-
846
- // Update full properties JSON
847
- notionProps["ONE Properties"] = {
848
- rich_text: [{ text: { content: JSON.stringify(properties) } }],
849
- };
850
-
851
- return notionProps;
852
- }
853
-
854
- // Extract properties from Notion page
855
- private async extractNotionProperties(props: any): Promise<any> {
856
- const extracted: any = {};
857
-
858
- // Try to parse stored JSON properties
859
- if (props["ONE Properties"]?.rich_text?.[0]?.text?.content) {
860
- try {
861
- Object.assign(
862
- extracted,
863
- JSON.parse(props["ONE Properties"].rich_text[0].text.content),
864
- );
865
- } catch (e) {
866
- // Ignore parse errors
867
- }
868
- }
869
-
870
- // Extract individual properties
871
- for (const [key, value] of Object.entries(props)) {
872
- const prop = value as any;
873
-
874
- switch (prop.type) {
875
- case "rich_text":
876
- if (prop.rich_text?.[0]?.text?.content) {
877
- extracted[this.camelCase(key)] = prop.rich_text[0].text.content;
878
- }
879
- break;
880
- case "number":
881
- if (prop.number !== null) {
882
- extracted[this.camelCase(key)] = prop.number;
883
- }
884
- break;
885
- case "select":
886
- if (prop.select?.name) {
887
- extracted[this.camelCase(key)] = prop.select.name;
888
- }
889
- break;
890
- case "multi_select":
891
- if (prop.multi_select) {
892
- extracted[this.camelCase(key)] = prop.multi_select.map(
893
- (s: any) => s.name,
894
- );
895
- }
896
- break;
897
- case "date":
898
- if (prop.date?.start) {
899
- extracted[this.camelCase(key)] = new Date(
900
- prop.date.start,
901
- ).getTime();
902
- }
903
- break;
904
- case "checkbox":
905
- extracted[this.camelCase(key)] = prop.checkbox;
906
- break;
907
- case "url":
908
- if (prop.url) {
909
- extracted[this.camelCase(key)] = prop.url;
910
- }
911
- break;
912
- case "email":
913
- if (prop.email) {
914
- extracted[this.camelCase(key)] = prop.email;
915
- }
916
- break;
917
- case "phone_number":
918
- if (prop.phone_number) {
919
- extracted[this.camelCase(key)] = prop.phone_number;
920
- }
921
- break;
922
- case "relation":
923
- if (prop.relation) {
924
- extracted[this.camelCase(key)] = prop.relation.map((r: any) =>
925
- this.notionIdToOneId(r.id),
926
- );
927
- }
928
- break;
929
- }
930
- }
931
-
932
- return extracted;
933
- }
934
-
935
- // Map ontology status to Notion status
936
- private mapOntologyStatusToNotion(status: string): string {
937
- const mapping: Record<string, string> = {
938
- draft: "Draft",
939
- active: "Active",
940
- published: "Published",
941
- archived: "Archived",
942
- pending: "Pending",
943
- };
944
- return mapping[status] || "Draft";
945
- }
946
-
947
- // Map Notion status to ontology status
948
- private mapNotionStatusToOntology(notionStatus: string): string {
949
- const mapping: Record<string, string> = {
950
- Draft: "draft",
951
- Active: "active",
952
- Published: "published",
953
- Archived: "archived",
954
- Pending: "pending",
955
- };
956
- return mapping[notionStatus] || "draft";
957
- }
958
-
959
- // Convert Notion ID to ONE ID
960
- private notionIdToOneId(notionId: string): string {
961
- return `notion_${notionId.replace(/-/g, "")}`;
962
- }
963
-
964
- // Convert ONE ID to Notion ID
965
- private oneIdToNotionId(oneId: string): string {
966
- const match = oneId.match(/^notion_([a-f0-9]{32})$/);
967
- if (!match) throw new Error(`Invalid ONE ID for Notion: ${oneId}`);
968
-
969
- // Notion IDs have hyphens: 8-4-4-4-12
970
- const id = match[1];
971
- return `${id.slice(0, 8)}-${id.slice(8, 12)}-${id.slice(12, 16)}-${id.slice(
972
- 16,
973
- 20,
974
- )}-${id.slice(20)}`;
975
- }
976
-
977
- // Find type by database ID
978
- private findTypeByDatabaseId(databaseId: string): string {
979
- for (const [type, dbId] of Object.entries(this.config.databaseIds)) {
980
- if (dbId === databaseId) return type;
981
- }
982
- return "unknown";
983
- }
984
-
985
- // Convert to camelCase
986
- private camelCase(str: string): string {
987
- return str
988
- .replace(/(?:^\w|[A-Z]|\b\w)/g, (letter, index) =>
989
- index === 0 ? letter.toLowerCase() : letter.toUpperCase(),
990
- )
991
- .replace(/\s+/g, "");
992
- }
993
- }
994
-
995
- interface NotionProviderConfig {
996
- apiKey: string;
997
- organizationId: string;
998
- databaseIds: Record<string, string>; // thingType -> databaseId
999
- }
1000
- ```
1001
-
1002
- ### 4. Connections (Relationships)
1003
-
1004
- **WordPress Connection Mapping:**
1005
-
1006
- WordPress doesn't have native relationships beyond `post_parent` and `post_author`. We'll use:
1007
-
1008
- 1. **ACF Relationship Fields** - For complex relationships
1009
- 2. **Custom Tables** - For high-volume relationships (enrollments)
1010
- 3. **Post Meta** - For simple 1:1 relationships
1011
-
1012
- **Implementation:**
1013
-
1014
- ```typescript
1015
- class WordPressProvider implements DataProvider {
1016
- connections: ConnectionOperations = {
1017
- list: async (filter) => {
1018
- // Query custom wp_one_connections table
1019
- const params = new URLSearchParams({
1020
- from_thing_id: filter.fromThingId || "",
1021
- to_thing_id: filter.toThingId || "",
1022
- relationship_type: filter.relationshipType || "",
1023
- per_page: String(filter.limit || 10),
1024
- });
1025
-
1026
- const response = await this.api.get(
1027
- `/one/v1/connections?${params.toString()}`,
1028
- );
1029
- const wpConnections = await response.json();
1030
-
1031
- return wpConnections.map((conn: any) => ({
1032
- _id: this.wpIdToOneId("connection", conn.id),
1033
- fromThingId: conn.from_thing_id,
1034
- toThingId: conn.to_thing_id,
1035
- relationshipType: conn.relationship_type,
1036
- metadata: JSON.parse(conn.metadata || "{}"),
1037
- validFrom: conn.valid_from,
1038
- validTo: conn.valid_to,
1039
- createdAt: new Date(conn.created_at).getTime(),
1040
- }));
1041
- },
1042
-
1043
- create: async (args) => {
1044
- const wpConnection = {
1045
- from_thing_id: args.fromThingId,
1046
- to_thing_id: args.toThingId,
1047
- relationship_type: args.relationshipType,
1048
- metadata: JSON.stringify(args.metadata || {}),
1049
- valid_from: args.validFrom || Date.now(),
1050
- valid_to: args.validTo,
1051
- };
1052
-
1053
- const response = await this.api.post("/one/v1/connections", wpConnection);
1054
- const created = await response.json();
1055
-
1056
- return {
1057
- _id: this.wpIdToOneId("connection", created.id),
1058
- ...args,
1059
- createdAt: new Date(created.created_at).getTime(),
1060
- };
1061
- },
1062
-
1063
- delete: async (id) => {
1064
- const wpId = this.oneIdToWpId(id);
1065
- await this.api.delete(`/one/v1/connections/${wpId}`);
1066
- },
1067
-
1068
- get: async (id) => {
1069
- const wpId = this.oneIdToWpId(id);
1070
- const response = await this.api.get(`/one/v1/connections/${wpId}`);
1071
- const conn = await response.json();
1072
-
1073
- return {
1074
- _id: id,
1075
- fromThingId: conn.from_thing_id,
1076
- toThingId: conn.to_thing_id,
1077
- relationshipType: conn.relationship_type,
1078
- metadata: JSON.parse(conn.metadata || "{}"),
1079
- validFrom: conn.valid_from,
1080
- validTo: conn.valid_to,
1081
- createdAt: new Date(conn.created_at).getTime(),
1082
- };
1083
- },
1084
- };
1085
- }
1086
- ```
1087
-
1088
- **WordPress Custom Endpoint (`/one/v1/connections`):**
1089
-
1090
- ```php
1091
- // wp-content/plugins/one-platform/includes/api/connections.php
1092
-
1093
- add_action('rest_api_init', function () {
1094
- register_rest_route('one/v1', '/connections', [
1095
- 'methods' => 'GET',
1096
- 'callback' => 'one_get_connections',
1097
- 'permission_callback' => function () {
1098
- return current_user_can('read');
1099
- }
1100
- ]);
1101
-
1102
- register_rest_route('one/v1', '/connections', [
1103
- 'methods' => 'POST',
1104
- 'callback' => 'one_create_connection',
1105
- 'permission_callback' => function () {
1106
- return current_user_can('edit_posts');
1107
- }
1108
- ]);
1109
-
1110
- register_rest_route('one/v1', '/connections/(?P<id>\d+)', [
1111
- 'methods' => 'GET',
1112
- 'callback' => 'one_get_connection',
1113
- 'permission_callback' => function () {
1114
- return current_user_can('read');
1115
- }
1116
- ]);
1117
-
1118
- register_rest_route('one/v1', '/connections/(?P<id>\d+)', [
1119
- 'methods' => 'DELETE',
1120
- 'callback' => 'one_delete_connection',
1121
- 'permission_callback' => function () {
1122
- return current_user_can('delete_posts');
1123
- }
1124
- ]);
1125
- });
1126
-
1127
- function one_get_connections($request) {
1128
- global $wpdb;
1129
-
1130
- $from_thing_id = $request->get_param('from_thing_id');
1131
- $to_thing_id = $request->get_param('to_thing_id');
1132
- $relationship_type = $request->get_param('relationship_type');
1133
- $per_page = intval($request->get_param('per_page') ?: 10);
1134
- $page = intval($request->get_param('page') ?: 1);
1135
-
1136
- $where = ['1=1'];
1137
- if ($from_thing_id) {
1138
- $where[] = $wpdb->prepare('from_thing_id = %s', $from_thing_id);
1139
- }
1140
- if ($to_thing_id) {
1141
- $where[] = $wpdb->prepare('to_thing_id = %s', $to_thing_id);
1142
- }
1143
- if ($relationship_type) {
1144
- $where[] = $wpdb->prepare('relationship_type = %s', $relationship_type);
1145
- }
1146
-
1147
- $offset = ($page - 1) * $per_page;
1148
- $where_clause = implode(' AND ', $where);
1149
-
1150
- $results = $wpdb->get_results(
1151
- "SELECT * FROM {$wpdb->prefix}one_connections
1152
- WHERE {$where_clause}
1153
- LIMIT {$per_page} OFFSET {$offset}"
1154
- );
1155
-
1156
- return rest_ensure_response($results);
1157
- }
1158
-
1159
- function one_create_connection($request) {
1160
- global $wpdb;
1161
-
1162
- $wpdb->insert(
1163
- $wpdb->prefix . 'one_connections',
1164
- [
1165
- 'from_thing_id' => $request->get_param('from_thing_id'),
1166
- 'to_thing_id' => $request->get_param('to_thing_id'),
1167
- 'relationship_type' => $request->get_param('relationship_type'),
1168
- 'metadata' => $request->get_param('metadata'),
1169
- 'valid_from' => $request->get_param('valid_from'),
1170
- 'valid_to' => $request->get_param('valid_to'),
1171
- 'created_at' => current_time('mysql'),
1172
- ]
1173
- );
1174
-
1175
- $id = $wpdb->insert_id;
1176
- $connection = $wpdb->get_row(
1177
- $wpdb->prepare(
1178
- "SELECT * FROM {$wpdb->prefix}one_connections WHERE id = %d",
1179
- $id
1180
- )
1181
- );
1182
-
1183
- return rest_ensure_response($connection);
1184
- }
1185
- ```
1186
-
1187
- **Notion Connection Mapping:**
1188
-
1189
- Notion supports native **Relation** properties between databases. We'll map ONE connections to Notion relations.
1190
-
1191
- ```typescript
1192
- class NotionProvider implements DataProvider {
1193
- connections: ConnectionOperations = {
1194
- list: async (filter) => {
1195
- // In Notion, connections are stored as relation properties
1196
- // We need to query the source database and extract relations
1197
-
1198
- if (!filter.fromThingId) {
1199
- throw new Error("Notion connections require fromThingId filter");
1200
- }
1201
-
1202
- const fromType = this.getTypeFromId(filter.fromThingId);
1203
- const fromNotionId = this.oneIdToNotionId(filter.fromThingId);
1204
-
1205
- // Get the source page
1206
- const page = await this.notion.pages.retrieve({ page_id: fromNotionId });
1207
- const props = (page as any).properties;
1208
-
1209
- const connections: Connection[] = [];
1210
-
1211
- // Extract all relation properties
1212
- for (const [propName, propValue] of Object.entries(props)) {
1213
- const prop = propValue as any;
1214
-
1215
- if (prop.type === "relation" && prop.relation) {
1216
- // Determine relationship type from property name
1217
- const relationshipType =
1218
- this.mapNotionPropertyToRelationship(propName);
1219
-
1220
- for (const rel of prop.relation) {
1221
- connections.push({
1222
- _id: this.generateConnectionId(
1223
- filter.fromThingId,
1224
- this.notionIdToOneId(rel.id),
1225
- relationshipType,
1226
- ),
1227
- fromThingId: filter.fromThingId,
1228
- toThingId: this.notionIdToOneId(rel.id),
1229
- relationshipType,
1230
- metadata: { notionProperty: propName },
1231
- createdAt: new Date((page as any).created_time).getTime(),
1232
- });
1233
- }
1234
- }
1235
- }
1236
-
1237
- return connections;
1238
- },
1239
-
1240
- create: async (args) => {
1241
- // Add relation to source page
1242
- const fromNotionId = this.oneIdToNotionId(args.fromThingId);
1243
- const toNotionId = this.oneIdToNotionId(args.toThingId);
1244
-
1245
- // Determine which property to update
1246
- const propertyName = this.mapRelationshipToNotionProperty(
1247
- args.relationshipType,
1248
- );
1249
-
1250
- // Get existing relations
1251
- const page = await this.notion.pages.retrieve({ page_id: fromNotionId });
1252
- const existingRelations =
1253
- (page as any).properties[propertyName]?.relation || [];
1254
-
1255
- // Add new relation
1256
- await this.notion.pages.update({
1257
- page_id: fromNotionId,
1258
- properties: {
1259
- [propertyName]: {
1260
- relation: [
1261
- ...existingRelations.map((r: any) => ({ id: r.id })),
1262
- { id: toNotionId },
1263
- ],
1264
- },
1265
- },
1266
- });
1267
-
1268
- return {
1269
- _id: this.generateConnectionId(
1270
- args.fromThingId,
1271
- args.toThingId,
1272
- args.relationshipType,
1273
- ),
1274
- ...args,
1275
- createdAt: Date.now(),
1276
- };
1277
- },
1278
-
1279
- delete: async (id) => {
1280
- // Parse connection ID to get from/to/type
1281
- const { fromThingId, toThingId, relationshipType } =
1282
- this.parseConnectionId(id);
1283
-
1284
- const fromNotionId = this.oneIdToNotionId(fromThingId);
1285
- const toNotionId = this.oneIdToNotionId(toThingId);
1286
-
1287
- // Determine which property to update
1288
- const propertyName =
1289
- this.mapRelationshipToNotionProperty(relationshipType);
1290
-
1291
- // Get existing relations
1292
- const page = await this.notion.pages.retrieve({ page_id: fromNotionId });
1293
- const existingRelations =
1294
- (page as any).properties[propertyName]?.relation || [];
1295
-
1296
- // Remove the relation
1297
- await this.notion.pages.update({
1298
- page_id: fromNotionId,
1299
- properties: {
1300
- [propertyName]: {
1301
- relation: existingRelations
1302
- .filter((r: any) => r.id !== toNotionId)
1303
- .map((r: any) => ({ id: r.id })),
1304
- },
1305
- },
1306
- });
1307
- },
1308
-
1309
- get: async (id) => {
1310
- // Parse connection ID
1311
- const { fromThingId, toThingId, relationshipType } =
1312
- this.parseConnectionId(id);
1313
-
1314
- // Verify relation exists
1315
- const connections = await this.connections.list({ fromThingId });
1316
- const connection = connections.find(
1317
- (c) =>
1318
- c.toThingId === toThingId && c.relationshipType === relationshipType,
1319
- );
1320
-
1321
- if (!connection) {
1322
- throw new Error(`Connection not found: ${id}`);
1323
- }
1324
-
1325
- return connection;
1326
- },
1327
- };
1328
-
1329
- // Map relationship type to Notion property name
1330
- private mapRelationshipToNotionProperty(relationshipType: string): string {
1331
- const mapping: Record<string, string> = {
1332
- owns: "Owner",
1333
- part_of: "Parent",
1334
- enrolled_in: "Enrollments",
1335
- authored: "Author",
1336
- holds_tokens: "Token Holdings",
1337
- delegated: "Delegated To",
1338
- communicated: "Communicated With",
1339
- transacted: "Transactions",
1340
- };
1341
- return mapping[relationshipType] || "Related";
1342
- }
1343
-
1344
- // Map Notion property name to relationship type
1345
- private mapNotionPropertyToRelationship(propertyName: string): string {
1346
- const mapping: Record<string, string> = {
1347
- Owner: "owns",
1348
- Parent: "part_of",
1349
- Enrollments: "enrolled_in",
1350
- Author: "authored",
1351
- "Token Holdings": "holds_tokens",
1352
- "Delegated To": "delegated",
1353
- "Communicated With": "communicated",
1354
- Transactions: "transacted",
1355
- };
1356
- return mapping[propertyName] || "related";
1357
- }
1358
-
1359
- // Generate deterministic connection ID
1360
- private generateConnectionId(
1361
- fromThingId: string,
1362
- toThingId: string,
1363
- relationshipType: string,
1364
- ): string {
1365
- return `notion_conn_${fromThingId}_${toThingId}_${relationshipType}`;
1366
- }
1367
-
1368
- // Parse connection ID
1369
- private parseConnectionId(id: string): {
1370
- fromThingId: string;
1371
- toThingId: string;
1372
- relationshipType: string;
1373
- } {
1374
- const match = id.match(/^notion_conn_(.+)_(.+)_(.+)$/);
1375
- if (!match) throw new Error(`Invalid Notion connection ID: ${id}`);
1376
- return {
1377
- fromThingId: match[1],
1378
- toThingId: match[2],
1379
- relationshipType: match[3],
1380
- };
1381
- }
1382
-
1383
- // Get type from ONE ID
1384
- private getTypeFromId(oneId: string): string {
1385
- // In practice, you'd look this up from the database
1386
- // For now, we'll extract from the ID pattern if it includes type
1387
- return "unknown";
1388
- }
1389
- }
1390
- ```
1391
-
1392
- ### 5. Events (Action Tracking)
1393
-
1394
- **Challenge:** WordPress and Notion don't have native event logs matching ONE's comprehensive event system.
1395
-
1396
- **Solution:**
1397
-
1398
- - **Option 1:** Store events in ONE's Convex backend (hybrid approach)
1399
- - **Option 2:** Store events in external system's custom table/database
1400
- - **Option 3:** Use external system's audit logs where available
1401
-
1402
- **WordPress Events Implementation:**
1403
-
1404
- ```typescript
1405
- class WordPressProvider implements DataProvider {
1406
- events: EventOperations = {
1407
- list: async (filter) => {
1408
- // Query custom wp_one_events table
1409
- const params = new URLSearchParams({
1410
- type: filter.type || "",
1411
- actor_id: filter.actorId || "",
1412
- target_id: filter.targetId || "",
1413
- from: String(filter.timestampFrom || 0),
1414
- to: String(filter.timestampTo || Date.now()),
1415
- per_page: String(filter.limit || 10),
1416
- });
1417
-
1418
- const response = await this.api.get(
1419
- `/one/v1/events?${params.toString()}`,
1420
- );
1421
- const wpEvents = await response.json();
1422
-
1423
- return wpEvents.map((event: any) => ({
1424
- _id: this.wpIdToOneId("event", event.id),
1425
- type: event.type,
1426
- actorId: event.actor_id,
1427
- targetId: event.target_id,
1428
- timestamp: new Date(event.timestamp).getTime(),
1429
- metadata: JSON.parse(event.metadata || "{}"),
1430
- }));
1431
- },
1432
-
1433
- create: async (args) => {
1434
- const wpEvent = {
1435
- type: args.type,
1436
- actor_id: args.actorId,
1437
- target_id: args.targetId,
1438
- timestamp: new Date(args.timestamp).toISOString(),
1439
- metadata: JSON.stringify(args.metadata || {}),
1440
- };
1441
-
1442
- const response = await this.api.post("/one/v1/events", wpEvent);
1443
- const created = await response.json();
1444
-
1445
- return {
1446
- _id: this.wpIdToOneId("event", created.id),
1447
- ...args,
1448
- };
1449
- },
1450
-
1451
- get: async (id) => {
1452
- const wpId = this.oneIdToWpId(id);
1453
- const response = await this.api.get(`/one/v1/events/${wpId}`);
1454
- const event = await response.json();
1455
-
1456
- return {
1457
- _id: id,
1458
- type: event.type,
1459
- actorId: event.actor_id,
1460
- targetId: event.target_id,
1461
- timestamp: new Date(event.timestamp).getTime(),
1462
- metadata: JSON.parse(event.metadata || "{}"),
1463
- };
1464
- },
1465
- };
1466
- }
1467
- ```
1468
-
1469
- **Notion Events Implementation (Hybrid):**
1470
-
1471
- Since Notion doesn't support custom tables, we'll use a hybrid approach: store events in Convex but reference Notion IDs.
1472
-
1473
- ```typescript
1474
- class NotionProvider implements DataProvider {
1475
- private convexEventStore: ConvexClient;
1476
-
1477
- constructor(config: NotionProviderConfig) {
1478
- this.config = config;
1479
- this.notion = new Client({ auth: config.apiKey });
1480
-
1481
- // Use Convex for event storage
1482
- this.convexEventStore = new ConvexClient(config.convexUrl);
1483
- }
1484
-
1485
- events: EventOperations = {
1486
- list: async (filter) => {
1487
- // Query Convex events table, filtered by Notion provider
1488
- return this.convexEventStore.query("events:list", {
1489
- ...filter,
1490
- metadata: {
1491
- ...filter.metadata,
1492
- provider: "notion",
1493
- organizationId: this.config.organizationId,
1494
- },
1495
- });
1496
- },
1497
-
1498
- create: async (args) => {
1499
- // Store event in Convex with Notion metadata
1500
- return this.convexEventStore.mutation("events:create", {
1501
- ...args,
1502
- metadata: {
1503
- ...args.metadata,
1504
- provider: "notion",
1505
- organizationId: this.config.organizationId,
1506
- },
1507
- });
1508
- },
1509
-
1510
- get: async (id) => {
1511
- return this.convexEventStore.query("events:get", { id });
1512
- },
1513
- };
1514
- }
1515
- ```
1516
-
1517
- ### 6. Knowledge (Semantic Understanding)
1518
-
1519
- **WordPress Knowledge Implementation:**
1520
-
1521
- ```typescript
1522
- class WordPressProvider implements DataProvider {
1523
- knowledge: KnowledgeOperations = {
1524
- list: async (filter) => {
1525
- // Query custom wp_one_knowledge table
1526
- const params = new URLSearchParams({
1527
- knowledge_type: filter.knowledgeType || "",
1528
- per_page: String(filter.limit || 10),
1529
- });
1530
-
1531
- if (filter.labels) {
1532
- params.append("labels", filter.labels.join(","));
1533
- }
1534
-
1535
- const response = await this.api.get(
1536
- `/one/v1/knowledge?${params.toString()}`,
1537
- );
1538
- const wpKnowledge = await response.json();
1539
-
1540
- return wpKnowledge.map((k: any) => ({
1541
- _id: this.wpIdToOneId("knowledge", k.id),
1542
- knowledgeType: k.knowledge_type,
1543
- text: k.text,
1544
- embedding: JSON.parse(k.embedding || "[]"),
1545
- embeddingModel: k.embedding_model,
1546
- embeddingDim: k.embedding_dim,
1547
- sourceThingId: k.source_thing_id,
1548
- sourceField: k.source_field,
1549
- labels: JSON.parse(k.labels || "[]"),
1550
- metadata: JSON.parse(k.metadata || "{}"),
1551
- createdAt: new Date(k.created_at).getTime(),
1552
- updatedAt: new Date(k.updated_at).getTime(),
1553
- }));
1554
- },
1555
-
1556
- create: async (args) => {
1557
- const wpKnowledge = {
1558
- knowledge_type: args.knowledgeType,
1559
- text: args.text,
1560
- embedding: JSON.stringify(args.embedding),
1561
- embedding_model: args.embeddingModel,
1562
- embedding_dim: args.embeddingDim,
1563
- source_thing_id: args.sourceThingId,
1564
- source_field: args.sourceField,
1565
- labels: JSON.stringify(args.labels || []),
1566
- metadata: JSON.stringify(args.metadata || {}),
1567
- };
1568
-
1569
- const response = await this.api.post("/one/v1/knowledge", wpKnowledge);
1570
- const created = await response.json();
1571
-
1572
- return {
1573
- _id: this.wpIdToOneId("knowledge", created.id),
1574
- ...args,
1575
- createdAt: new Date(created.created_at).getTime(),
1576
- updatedAt: new Date(created.updated_at).getTime(),
1577
- };
1578
- },
1579
-
1580
- search: async (query) => {
1581
- // Use Convex for vector search (WordPress doesn't support it natively)
1582
- // This is a hybrid approach
1583
- throw new Error("Vector search not supported by WordPressProvider");
1584
- },
1585
-
1586
- get: async (id) => {
1587
- const wpId = this.oneIdToWpId(id);
1588
- const response = await this.api.get(`/one/v1/knowledge/${wpId}`);
1589
- const k = await response.json();
1590
-
1591
- return {
1592
- _id: id,
1593
- knowledgeType: k.knowledge_type,
1594
- text: k.text,
1595
- embedding: JSON.parse(k.embedding || "[]"),
1596
- embeddingModel: k.embedding_model,
1597
- embeddingDim: k.embedding_dim,
1598
- sourceThingId: k.source_thing_id,
1599
- sourceField: k.source_field,
1600
- labels: JSON.parse(k.labels || "[]"),
1601
- metadata: JSON.parse(k.metadata || "{}"),
1602
- createdAt: new Date(k.created_at).getTime(),
1603
- updatedAt: new Date(k.updated_at).getTime(),
1604
- };
1605
- },
1606
-
1607
- delete: async (id) => {
1608
- const wpId = this.oneIdToWpId(id);
1609
- await this.api.delete(`/one/v1/knowledge/${wpId}`);
1610
- },
1611
- };
1612
- }
1613
- ```
1614
-
1615
- **Notion Knowledge Implementation (Hybrid):**
1616
-
1617
- Notion doesn't support vector embeddings natively. Use Convex for knowledge storage.
1618
-
1619
- ```typescript
1620
- class NotionProvider implements DataProvider {
1621
- knowledge: KnowledgeOperations = {
1622
- list: async (filter) => {
1623
- // Use Convex for knowledge storage
1624
- return this.convexEventStore.query("knowledge:list", {
1625
- ...filter,
1626
- metadata: {
1627
- ...filter.metadata,
1628
- provider: "notion",
1629
- organizationId: this.config.organizationId,
1630
- },
1631
- });
1632
- },
1633
-
1634
- create: async (args) => {
1635
- return this.convexEventStore.mutation("knowledge:create", {
1636
- ...args,
1637
- metadata: {
1638
- ...args.metadata,
1639
- provider: "notion",
1640
- organizationId: this.config.organizationId,
1641
- },
1642
- });
1643
- },
1644
-
1645
- search: async (query) => {
1646
- return this.convexEventStore.query("knowledge:search", {
1647
- ...query,
1648
- metadata: {
1649
- provider: "notion",
1650
- organizationId: this.config.organizationId,
1651
- },
1652
- });
1653
- },
1654
-
1655
- get: async (id) => {
1656
- return this.convexEventStore.query("knowledge:get", { id });
1657
- },
1658
-
1659
- delete: async (id) => {
1660
- return this.convexEventStore.mutation("knowledge:delete", { id });
1661
- },
1662
- };
1663
- }
1664
- ```
1665
-
1666
- ---
1667
-
1668
- ## CompositeProvider (Multi-Backend Routing)
1669
-
1670
- **Use Case:** A single organization wants to use different backends for different entity types.
1671
-
1672
- **Example:** WordPress for courses/lessons, Notion for internal documentation, Convex for events/knowledge.
1673
-
1674
- **Implementation:**
1675
-
1676
- ```typescript
1677
- class CompositeProvider implements DataProvider {
1678
- private providers: Map<string, DataProvider>;
1679
- private routingRules: RoutingRules;
1680
-
1681
- constructor(config: CompositeProviderConfig) {
1682
- this.providers = new Map();
1683
- this.routingRules = config.routingRules;
1684
-
1685
- // Register all providers
1686
- for (const [name, providerConfig] of Object.entries(config.providers)) {
1687
- this.providers.set(name, this.createProvider(providerConfig));
1688
- }
1689
- }
1690
-
1691
- things: ThingOperations = {
1692
- list: async (filter) => {
1693
- const providerName = this.routeByThingType(filter.type);
1694
- const provider = this.getProvider(providerName);
1695
- return provider.things.list(filter);
1696
- },
1697
-
1698
- create: async (args) => {
1699
- const providerName = this.routeByThingType(args.type);
1700
- const provider = this.getProvider(providerName);
1701
- return provider.things.create(args);
1702
- },
1703
-
1704
- update: async (id, updates) => {
1705
- const providerName = this.routeByThingId(id);
1706
- const provider = this.getProvider(providerName);
1707
- return provider.things.update(id, updates);
1708
- },
1709
-
1710
- delete: async (id) => {
1711
- const providerName = this.routeByThingId(id);
1712
- const provider = this.getProvider(providerName);
1713
- return provider.things.delete(id);
1714
- },
1715
-
1716
- get: async (id) => {
1717
- const providerName = this.routeByThingId(id);
1718
- const provider = this.getProvider(providerName);
1719
- return provider.things.get(id);
1720
- },
1721
- };
1722
-
1723
- connections: ConnectionOperations = {
1724
- list: async (filter) => {
1725
- // Cross-provider connections require querying all providers
1726
- if (!filter.fromThingId && !filter.toThingId) {
1727
- throw new Error(
1728
- "CompositeProvider connections.list requires fromThingId or toThingId",
1729
- );
1730
- }
1731
-
1732
- const providerName = this.routeByThingId(
1733
- filter.fromThingId || filter.toThingId!,
1734
- );
1735
- const provider = this.getProvider(providerName);
1736
- return provider.connections.list(filter);
1737
- },
1738
-
1739
- create: async (args) => {
1740
- // Determine which provider should own the connection
1741
- // Default: same provider as fromThing
1742
- const providerName = this.routeByThingId(args.fromThingId);
1743
- const provider = this.getProvider(providerName);
1744
- return provider.connections.create(args);
1745
- },
1746
-
1747
- delete: async (id) => {
1748
- const providerName = this.routeByConnectionId(id);
1749
- const provider = this.getProvider(providerName);
1750
- return provider.connections.delete(id);
1751
- },
1752
-
1753
- get: async (id) => {
1754
- const providerName = this.routeByConnectionId(id);
1755
- const provider = this.getProvider(providerName);
1756
- return provider.connections.get(id);
1757
- },
1758
- };
1759
-
1760
- events: EventOperations = {
1761
- list: async (filter) => {
1762
- // Events are always stored in the designated event provider
1763
- const providerName = this.routingRules.eventsProvider || "convex";
1764
- const provider = this.getProvider(providerName);
1765
- return provider.events.list(filter);
1766
- },
1767
-
1768
- create: async (args) => {
1769
- const providerName = this.routingRules.eventsProvider || "convex";
1770
- const provider = this.getProvider(providerName);
1771
- return provider.events.create(args);
1772
- },
1773
-
1774
- get: async (id) => {
1775
- const providerName = this.routingRules.eventsProvider || "convex";
1776
- const provider = this.getProvider(providerName);
1777
- return provider.events.get(id);
1778
- },
1779
- };
1780
-
1781
- knowledge: KnowledgeOperations = {
1782
- list: async (filter) => {
1783
- // Knowledge is always stored in the designated knowledge provider
1784
- const providerName = this.routingRules.knowledgeProvider || "convex";
1785
- const provider = this.getProvider(providerName);
1786
- return provider.knowledge.list(filter);
1787
- },
1788
-
1789
- create: async (args) => {
1790
- const providerName = this.routingRules.knowledgeProvider || "convex";
1791
- const provider = this.getProvider(providerName);
1792
- return provider.knowledge.create(args);
1793
- },
1794
-
1795
- search: async (query) => {
1796
- const providerName = this.routingRules.knowledgeProvider || "convex";
1797
- const provider = this.getProvider(providerName);
1798
- return provider.knowledge.search(query);
1799
- },
1800
-
1801
- get: async (id) => {
1802
- const providerName = this.routingRules.knowledgeProvider || "convex";
1803
- const provider = this.getProvider(providerName);
1804
- return provider.knowledge.get(id);
1805
- },
1806
-
1807
- delete: async (id) => {
1808
- const providerName = this.routingRules.knowledgeProvider || "convex";
1809
- const provider = this.getProvider(providerName);
1810
- return provider.knowledge.delete(id);
1811
- },
1812
- };
1813
-
1814
- organizations: OrganizationOperations = {
1815
- list: async (filter) => {
1816
- // Organizations are always in the designated org provider
1817
- const providerName = this.routingRules.organizationsProvider || "convex";
1818
- const provider = this.getProvider(providerName);
1819
- return provider.organizations.list(filter);
1820
- },
1821
-
1822
- create: async (args) => {
1823
- const providerName = this.routingRules.organizationsProvider || "convex";
1824
- const provider = this.getProvider(providerName);
1825
- return provider.organizations.create(args);
1826
- },
1827
-
1828
- update: async (id, updates) => {
1829
- const providerName = this.routingRules.organizationsProvider || "convex";
1830
- const provider = this.getProvider(providerName);
1831
- return provider.organizations.update(id, updates);
1832
- },
1833
-
1834
- delete: async (id) => {
1835
- const providerName = this.routingRules.organizationsProvider || "convex";
1836
- const provider = this.getProvider(providerName);
1837
- return provider.organizations.delete(id);
1838
- },
1839
-
1840
- get: async (id) => {
1841
- const providerName = this.routingRules.organizationsProvider || "convex";
1842
- const provider = this.getProvider(providerName);
1843
- return provider.organizations.get(id);
1844
- },
1845
- };
1846
-
1847
- people: PeopleOperations = {
1848
- list: async (filter) => {
1849
- // People routing can be by organization or type
1850
- const providerName = this.routingRules.peopleProvider || "convex";
1851
- const provider = this.getProvider(providerName);
1852
- return provider.people.list(filter);
1853
- },
1854
-
1855
- create: async (args) => {
1856
- const providerName = this.routingRules.peopleProvider || "convex";
1857
- const provider = this.getProvider(providerName);
1858
- return provider.people.create(args);
1859
- },
1860
-
1861
- update: async (id, updates) => {
1862
- const providerName = this.routeByThingId(id);
1863
- const provider = this.getProvider(providerName);
1864
- return provider.people.update(id, updates);
1865
- },
1866
-
1867
- delete: async (id) => {
1868
- const providerName = this.routeByThingId(id);
1869
- const provider = this.getProvider(providerName);
1870
- return provider.people.delete(id);
1871
- },
1872
-
1873
- get: async (id) => {
1874
- const providerName = this.routeByThingId(id);
1875
- const provider = this.getProvider(providerName);
1876
- return provider.people.get(id);
1877
- },
1878
- };
1879
-
1880
- // Health check all providers
1881
- async healthCheck(): Promise<Record<string, boolean>> {
1882
- const health: Record<string, boolean> = {};
1883
-
1884
- for (const [name, provider] of this.providers.entries()) {
1885
- try {
1886
- // Try a simple query to test connectivity
1887
- await provider.things.list({ type: "course", limit: 1 });
1888
- health[name] = true;
1889
- } catch (e) {
1890
- health[name] = false;
1891
- }
1892
- }
1893
-
1894
- return health;
1895
- }
1896
-
1897
- // Route by thing type
1898
- private routeByThingType(type: string): string {
1899
- const rule = this.routingRules.thingTypes[type];
1900
- if (rule) return rule;
1901
-
1902
- // Default routing
1903
- return this.routingRules.defaultProvider || "convex";
1904
- }
1905
-
1906
- // Route by thing ID (ID prefix indicates provider)
1907
- private routeByThingId(id: string): string {
1908
- if (id.startsWith("wp_")) return "wordpress";
1909
- if (id.startsWith("notion_")) return "notion";
1910
- if (id.startsWith("convex_")) return "convex";
1911
-
1912
- // Default routing
1913
- return this.routingRules.defaultProvider || "convex";
1914
- }
1915
-
1916
- // Route by connection ID
1917
- private routeByConnectionId(id: string): string {
1918
- if (id.startsWith("wp_")) return "wordpress";
1919
- if (id.startsWith("notion_")) return "notion";
1920
- if (id.startsWith("convex_")) return "convex";
1921
-
1922
- return this.routingRules.defaultProvider || "convex";
1923
- }
1924
-
1925
- // Get provider by name
1926
- private getProvider(name: string): DataProvider {
1927
- const provider = this.providers.get(name);
1928
- if (!provider) {
1929
- throw new Error(`Provider not found: ${name}`);
1930
- }
1931
- return provider;
1932
- }
1933
-
1934
- // Create provider from config
1935
- private createProvider(config: any): DataProvider {
1936
- switch (config.type) {
1937
- case "convex":
1938
- return new ConvexProvider(config);
1939
- case "wordpress":
1940
- return new WordPressProvider(config);
1941
- case "notion":
1942
- return new NotionProvider(config);
1943
- default:
1944
- throw new Error(`Unknown provider type: ${config.type}`);
1945
- }
1946
- }
1947
- }
1948
-
1949
- interface CompositeProviderConfig {
1950
- providers: Record<string, any>; // providerName -> providerConfig
1951
- routingRules: RoutingRules;
1952
- }
1953
-
1954
- interface RoutingRules {
1955
- // Default provider for unmapped types
1956
- defaultProvider: string;
1957
-
1958
- // Thing type routing: thingType -> providerName
1959
- thingTypes: Record<string, string>;
1960
-
1961
- // Specific dimension providers
1962
- eventsProvider?: string;
1963
- knowledgeProvider?: string;
1964
- organizationsProvider?: string;
1965
- peopleProvider?: string;
1966
- }
1967
-
1968
- // Example usage:
1969
- const compositeProvider = new CompositeProvider({
1970
- providers: {
1971
- convex: {
1972
- type: "convex",
1973
- url: "https://shocking-falcon-870.convex.cloud",
1974
- },
1975
- wordpress: {
1976
- type: "wordpress",
1977
- url: "https://acme.wordpress.com",
1978
- apiKey: "wp_secret_key",
1979
- organizationId: "org_123",
1980
- },
1981
- notion: {
1982
- type: "notion",
1983
- apiKey: "notion_secret_key",
1984
- organizationId: "org_123",
1985
- databaseIds: {
1986
- documentation: "abc123",
1987
- meeting_notes: "def456",
1988
- },
1989
- convexUrl: "https://shocking-falcon-870.convex.cloud",
1990
- },
1991
- },
1992
- routingRules: {
1993
- defaultProvider: "convex",
1994
- thingTypes: {
1995
- course: "wordpress",
1996
- lesson: "wordpress",
1997
- documentation: "notion",
1998
- meeting_notes: "notion",
1999
- },
2000
- eventsProvider: "convex",
2001
- knowledgeProvider: "convex",
2002
- organizationsProvider: "convex",
2003
- peopleProvider: "convex",
2004
- },
2005
- });
2006
-
2007
- // Usage in components:
2008
- const courses = await compositeProvider.things.list({ type: "course" });
2009
- // Routes to WordPress
2010
-
2011
- const docs = await compositeProvider.things.list({ type: "documentation" });
2012
- // Routes to Notion
2013
- ```
2014
-
2015
- ---
2016
-
2017
- ## Implementation Steps (50+ Steps)
2018
-
2019
- ### Phase 1: WordPress Provider (Week 1)
2020
-
2021
- **Step 1-10: Setup & Authentication**
2022
-
2023
- 1. Create `frontend/src/providers/wordpress/` directory
2024
- 2. Install dependencies: `bun add @types/wordpress__api-fetch`
2025
- 3. Create `WordPressAPI.ts` - HTTP client with auth
2026
- 4. Implement Application Password authentication
2027
- 5. Test authentication with real WordPress site
2028
- 6. Create `WordPressProvider.ts` - DataProvider implementation
2029
- 7. Implement ID conversion utilities (`wpIdToOneId`, `oneIdToWpId`)
2030
- 8. Create type mapping utilities (ontology ↔ WP)
2031
- 9. Create status mapping utilities (ontology ↔ WP)
2032
- 10. Write unit tests for utilities (30+ tests)
2033
-
2034
- **Step 11-20: Things Implementation**
2035
-
2036
- 11. Implement `things.list()` with WordPress REST API
2037
- 12. Implement `things.create()` with post creation
2038
- 13. Implement `things.update()` with post updates
2039
- 14. Implement `things.delete()` with post deletion
2040
- 15. Implement `things.get()` with single post retrieval
2041
- 16. Implement ACF field transformation logic
2042
- 17. Add pagination support (WordPress pagination differs from Convex)
2043
- 18. Add filtering support (map to WordPress query params)
2044
- 19. Add error handling with exponential backoff retry
2045
- 20. Write unit tests for things operations (50+ tests)
2046
-
2047
- **Step 21-30: Connections Implementation**
2048
-
2049
- 21. Design `wp_one_connections` table schema (SQL)
2050
- 22. Create WordPress plugin: `one-platform-connector`
2051
- 23. Implement `/one/v1/connections` REST endpoint (GET)
2052
- 24. Implement `/one/v1/connections` REST endpoint (POST)
2053
- 25. Implement `/one/v1/connections/:id` REST endpoint (GET)
2054
- 26. Implement `/one/v1/connections/:id` REST endpoint (DELETE)
2055
- 27. Implement `connections.list()` in TypeScript provider
2056
- 28. Implement `connections.create()` in TypeScript provider
2057
- 29. Implement `connections.delete()` in TypeScript provider
2058
- 30. Write integration tests with real WordPress instance (20+ tests)
2059
-
2060
- **Step 31-40: Events & Knowledge Implementation**
2061
-
2062
- 31. Design `wp_one_events` table schema (SQL)
2063
- 32. Implement `/one/v1/events` REST endpoint (GET)
2064
- 33. Implement `/one/v1/events` REST endpoint (POST)
2065
- 34. Implement `events.list()` in TypeScript provider
2066
- 35. Implement `events.create()` in TypeScript provider
2067
- 36. Design `wp_one_knowledge` table schema (SQL)
2068
- 37. Implement `/one/v1/knowledge` REST endpoint (GET/POST)
2069
- 38. Implement `knowledge.list()` in TypeScript provider
2070
- 39. Implement `knowledge.create()` in TypeScript provider
2071
- 40. Document hybrid approach for vector search (Convex fallback)
2072
-
2073
- ### Phase 2: Notion Provider (Week 1-2)
2074
-
2075
- **Step 41-50: Setup & Authentication**
2076
-
2077
- 41. Create `frontend/src/providers/notion/` directory
2078
- 42. Install dependencies: `bun add @notionhq/client`
2079
- 43. Create `NotionProvider.ts` - DataProvider implementation
2080
- 44. Set up Notion integration with test workspace
2081
- 45. Create test databases (Courses, Lessons, Users)
2082
- 46. Configure database properties (Name, Status, etc.)
2083
- 47. Implement ID conversion utilities (`notionIdToOneId`, `oneIdToNotionId`)
2084
- 48. Create property mapping utilities (ontology ↔ Notion)
2085
- 49. Create status mapping utilities (ontology ↔ Notion)
2086
- 50. Write unit tests for utilities (30+ tests)
2087
-
2088
- **Step 51-60: Things Implementation**
2089
-
2090
- 51. Implement `things.list()` with Notion database query
2091
- 52. Implement `things.create()` with Notion page creation
2092
- 53. Implement `things.update()` with Notion page updates
2093
- 54. Implement `things.delete()` with Notion page archiving
2094
- 55. Implement `things.get()` with single page retrieval
2095
- 56. Implement property extraction logic (all property types)
2096
- 57. Add pagination support (Notion cursor-based pagination)
2097
- 58. Add filtering support (map to Notion filter syntax)
2098
- 59. Add error handling with rate limit retry
2099
- 60. Write unit tests for things operations (50+ tests)
2100
-
2101
- **Step 61-70: Connections Implementation**
2102
-
2103
- 61. Design Notion relation property strategy
2104
- 62. Implement `connections.list()` with relation extraction
2105
- 63. Implement `connections.create()` with relation updates
2106
- 64. Implement `connections.delete()` with relation removal
2107
- 65. Implement `connections.get()` with relation lookup
2108
- 66. Map all 25 ONE relationship types to Notion properties
2109
- 67. Handle bidirectional relations
2110
- 68. Add validation for cross-database relations
2111
- 69. Add error handling for missing properties
2112
- 70. Write integration tests with real Notion workspace (20+ tests)
2113
-
2114
- **Step 71-75: Events & Knowledge (Hybrid)**
2115
-
2116
- 71. Document hybrid approach (Convex for events/knowledge)
2117
- 72. Implement `events.list()` with Convex fallback
2118
- 73. Implement `events.create()` with Convex storage
2119
- 74. Implement `knowledge.list()` with Convex fallback
2120
- 75. Implement `knowledge.search()` with Convex vector search
2121
-
2122
- ### Phase 3: CompositeProvider (Week 2)
2123
-
2124
- **Step 76-85: Routing Implementation**
2125
-
2126
- 76. Create `frontend/src/providers/composite/` directory
2127
- 77. Create `CompositeProvider.ts` - Multi-backend router
2128
- 78. Implement provider registry with Map
2129
- 79. Implement `routeByThingType()` routing logic
2130
- 80. Implement `routeByThingId()` routing logic (ID prefix detection)
2131
- 81. Implement `routeByConnectionId()` routing logic
2132
- 82. Create `RoutingRules` interface with configuration schema
2133
- 83. Implement provider factory (create providers from config)
2134
- 84. Add provider health check method
2135
- 85. Write unit tests for routing logic (40+ tests)
2136
-
2137
- **Step 86-90: Operations Implementation**
2138
-
2139
- 86. Implement `things.*` operations with routing
2140
- 87. Implement `connections.*` operations with routing
2141
- 88. Implement `events.*` operations (always route to designated provider)
2142
- 89. Implement `knowledge.*` operations (always route to designated provider)
2143
- 90. Handle cross-provider connection scenarios
2144
-
2145
- ### Phase 4: Testing & Documentation (Week 2)
2146
-
2147
- **Step 91-100: Integration Testing**
2148
-
2149
- 91. Set up test WordPress instance (local Docker)
2150
- 92. Set up test Notion workspace
2151
- 93. Write end-to-end test: Create course in WordPress
2152
- 94. Write end-to-end test: Create lesson in WordPress
2153
- 95. Write end-to-end test: Create documentation in Notion
2154
- 96. Write end-to-end test: Create cross-provider connection
2155
- 97. Write end-to-end test: CompositeProvider routing
2156
- 98. Write end-to-end test: Multi-backend organization
2157
- 99. Run full test suite (expect 200+ tests)
2158
- 100. Fix any failing tests
2159
-
2160
- **Step 101-110: Documentation & Guides**
2161
-
2162
- 101. Write WordPress setup guide (installation, plugins, configuration)
2163
- 102. Write Notion setup guide (integration, databases, properties)
2164
- 103. Write provider configuration reference
2165
- 104. Write ontology mapping documentation (all 6 dimensions)
2166
- 105. Write CompositeProvider configuration guide
2167
- 106. Write troubleshooting guide (common issues)
2168
- 107. Create example configurations (3-5 scenarios)
2169
- 108. Document limitations (what's not supported)
2170
- 109. Create migration guide (Convex → WordPress/Notion)
2171
- 110. Review and publish documentation
2172
-
2173
- ---
2174
-
2175
- ## Testing Strategy
2176
-
2177
- ### Unit Tests (100+ tests)
2178
-
2179
- **WordPress Provider:**
2180
-
2181
- - ID conversion (10 tests)
2182
- - Type mapping (20 tests)
2183
- - Status mapping (10 tests)
2184
- - Property transformation (20 tests)
2185
- - API client (20 tests)
2186
- - Error handling (10 tests)
2187
-
2188
- **Notion Provider:**
2189
-
2190
- - ID conversion (10 tests)
2191
- - Property extraction (30 tests)
2192
- - Status mapping (10 tests)
2193
- - Property transformation (20 tests)
2194
- - Error handling (10 tests)
2195
-
2196
- **CompositeProvider:**
2197
-
2198
- - Routing logic (30 tests)
2199
- - Provider factory (10 tests)
2200
- - Health checks (10 tests)
2201
-
2202
- ### Integration Tests (50+ tests)
2203
-
2204
- **WordPress Provider:**
2205
-
2206
- - CRUD operations for all thing types (20 tests)
2207
- - Connection operations (10 tests)
2208
- - Event operations (5 tests)
2209
- - Authentication (5 tests)
2210
-
2211
- **Notion Provider:**
2212
-
2213
- - CRUD operations for all thing types (20 tests)
2214
- - Connection operations (10 tests)
2215
- - Property type handling (10 tests)
2216
- - Authentication (5 tests)
2217
-
2218
- **CompositeProvider:**
2219
-
2220
- - Multi-backend routing (10 tests)
2221
- - Cross-provider connections (5 tests)
2222
-
2223
- ### End-to-End Tests (20+ tests)
2224
-
2225
- **Scenarios:**
2226
-
2227
- 1. Create organization with WordPress backend
2228
- 2. Create organization with Notion backend
2229
- 3. Create organization with CompositeProvider
2230
- 4. Migrate organization from Convex to WordPress
2231
- 5. Create course in WordPress, view in ONE frontend
2232
- 6. Create documentation in Notion, search in ONE
2233
- 7. Create cross-provider connection (WordPress course → Notion doc)
2234
- 8. Test real-time updates (polling for WordPress, webhooks for Notion)
2235
- 9. Test provider failover (CompositeProvider health checks)
2236
- 10. Test data consistency across providers
2237
-
2238
- ### Performance Tests
2239
-
2240
- **Benchmarks:**
2241
-
2242
- - Compare WordPress provider vs Convex (latency, throughput)
2243
- - Compare Notion provider vs Convex (latency, throughput)
2244
- - Test CompositeProvider overhead (routing delay)
2245
- - Test concurrent operations (10, 100, 1000 requests)
2246
- - Test pagination performance (large datasets)
2247
- - Test connection queries (complex relationship graphs)
2248
-
2249
- **Acceptance Criteria:**
2250
-
2251
- - WordPress provider: < 500ms p99 latency for simple queries
2252
- - Notion provider: < 1s p99 latency for simple queries
2253
- - CompositeProvider: < 50ms routing overhead
2254
- - All providers: No data loss under normal operation
2255
- - All providers: Graceful degradation under high load
2256
-
2257
- ---
2258
-
2259
- ## User Stories & Acceptance Criteria
2260
-
2261
- ### Story 1: WordPress as Backend
2262
-
2263
- **As an** org_owner with existing WordPress infrastructure
2264
- **I want to** use WordPress as my ONE Platform backend
2265
- **So that** I can leverage my existing content and avoid data migration
2266
-
2267
- **Acceptance Criteria:**
2268
-
2269
- - [ ] I can configure my organization to use WordPress provider
2270
- - [ ] I provide my WordPress URL and API key
2271
- - [ ] All course/lesson content is stored in WordPress
2272
- - [ ] ONE frontend displays WordPress content seamlessly
2273
- - [ ] I can create/edit content in either WordPress admin or ONE interface
2274
- - [ ] Changes in WordPress appear in ONE within 30 seconds (polling)
2275
- - [ ] Changes in ONE appear in WordPress immediately
2276
- - [ ] All user roles map correctly (org_owner → Administrator, etc.)
2277
-
2278
- ### Story 2: Notion as Backend
2279
-
2280
- **As an** org_owner using Notion for knowledge management
2281
- **I want to** use Notion as my ONE Platform backend
2282
- **So that** my team can continue using familiar Notion workflows
2283
-
2284
- **Acceptance Criteria:**
2285
-
2286
- - [ ] I can configure my organization to use Notion provider
2287
- - [ ] I provide my Notion integration token and database IDs
2288
- - [ ] All documentation/notes are stored in Notion
2289
- - [ ] ONE frontend displays Notion pages seamlessly
2290
- - [ ] I can create/edit content in either Notion or ONE interface
2291
- - [ ] Changes in Notion appear in ONE within 10 seconds (webhooks)
2292
- - [ ] Changes in ONE appear in Notion immediately
2293
- - [ ] Notion relation properties map to ONE connections
2294
-
2295
- ### Story 3: Multi-Backend Organization
2296
-
2297
- **As an** org_owner with diverse needs
2298
- **I want to** use different backends for different content types
2299
- **So that** I can leverage the best tool for each use case
2300
-
2301
- **Acceptance Criteria:**
2302
-
2303
- - [ ] I can configure CompositeProvider with routing rules
2304
- - [ ] I specify: courses→WordPress, docs→Notion, events→Convex
2305
- - [ ] Content is routed to correct backend automatically
2306
- - [ ] I can query across backends seamlessly
2307
- - [ ] ONE frontend shows unified view of all content
2308
- - [ ] Cross-provider connections work correctly
2309
- - [ ] Health checks alert me if any provider is down
2310
-
2311
- ### Story 4: Backend Migration
2312
-
2313
- **As an** org_owner currently using Convex
2314
- **I want to** migrate to WordPress
2315
- **So that** I can use custom WordPress plugins
2316
-
2317
- **Acceptance Criteria:**
2318
-
2319
- - [ ] I can export all data from Convex
2320
- - [ ] I can import all data to WordPress
2321
- - [ ] I can switch provider configuration
2322
- - [ ] All existing ONE IDs are preserved (remapped)
2323
- - [ ] All connections are preserved
2324
- - [ ] All events are migrated
2325
- - [ ] Migration completes without data loss
2326
- - [ ] ONE frontend works immediately after migration
2327
-
2328
- ### Story 5: Provider Creation
2329
-
2330
- **As a** developer
2331
- **I want to** create a custom provider for my proprietary system
2332
- **So that** my organization can use ONE with our existing infrastructure
2333
-
2334
- **Acceptance Criteria:**
2335
-
2336
- - [ ] I have comprehensive provider creation guide
2337
- - [ ] I have working examples (WordPress, Notion)
2338
- - [ ] I understand all 6-dimension requirements
2339
- - [ ] I can implement DataProvider interface
2340
- - [ ] I can test my provider with integration test suite
2341
- - [ ] I can deploy my provider to production
2342
- - [ ] My provider passes all quality gates
2343
-
2344
- ---
2345
-
2346
- ## Quality Gates
2347
-
2348
- - [ ] WordPressProvider implements all 6 dimensions
2349
- - [ ] NotionProvider implements all 6 dimensions
2350
- - [ ] CompositeProvider routes correctly
2351
- - [ ] All unit tests pass (100+)
2352
- - [ ] All integration tests pass (50+)
2353
- - [ ] All end-to-end tests pass (20+)
2354
- - [ ] Performance benchmarks acceptable
2355
- - [ ] WordPress setup guide complete
2356
- - [ ] Notion setup guide complete
2357
- - [ ] Provider creation guide complete
2358
- - [ ] API reference documentation complete
2359
- - [ ] Code review approved by Engineering Director
2360
- - [ ] Security review approved (API key handling)
2361
- - [ ] No data loss in stress testing
2362
- - [ ] Graceful error handling verified
2363
-
2364
- ---
2365
-
2366
- ## Rollback Plan
2367
-
2368
- **Risk:** Alternative providers introduce bugs or performance issues.
2369
-
2370
- **Mitigation:**
2371
-
2372
- - Providers are additive - ConvexProvider remains default
2373
- - Organizations opt-in to alternative providers
2374
- - Provider configuration stored per-organization
2375
- - Easy to switch back to ConvexProvider
2376
-
2377
- **Rollback Steps:**
2378
-
2379
- 1. Update organization's `properties.providerType` to `"convex"`
2380
- 2. Provider registry automatically uses ConvexProvider
2381
- 3. No code changes required
2382
- 4. **Rollback time: Instant** (configuration change only)
2383
-
2384
- **Data Preservation:**
2385
-
2386
- - External data (WordPress, Notion) remains intact
2387
- - Events/knowledge in Convex remain intact
2388
- - Can re-enable alternative provider at any time
2389
-
2390
- ---
2391
-
2392
- ## Dependencies
2393
-
2394
- **Required:**
2395
-
2396
- - Feature 2-6 (Dashboard Migration) MUST be complete
2397
- - All frontend components MUST use DataProvider abstraction
2398
- - No direct Convex imports in components
2399
-
2400
- **External:**
2401
-
2402
- - WordPress instance (6.4+)
2403
- - WordPress plugins: ACF Pro, Custom Post Type UI
2404
- - Notion workspace with API access
2405
- - Notion integration token with full access permissions
2406
-
2407
- **Development:**
2408
-
2409
- - Docker for local WordPress testing
2410
- - Notion test workspace
2411
- - Integration test credentials (stored in 1Password)
2412
-
2413
- ---
2414
-
2415
- ## Related Files
2416
-
2417
- **Plan:**
2418
-
2419
- - `one/things/plans/2-backend-agnostic-frontend.md`
2420
-
2421
- **Dependencies:**
2422
-
2423
- - `one/things/features/2-6-dashboard-migration.md`
2424
-
2425
- **Implementation:**
2426
-
2427
- - `frontend/src/providers/DataProvider.ts` (interface)
2428
- - `frontend/src/providers/wordpress/WordPressProvider.ts` (NEW)
2429
- - `frontend/src/providers/wordpress/WordPressAPI.ts` (NEW)
2430
- - `frontend/src/providers/notion/NotionProvider.ts` (NEW)
2431
- - `frontend/src/providers/composite/CompositeProvider.ts` (NEW)
2432
-
2433
- **WordPress Plugin:**
2434
-
2435
- - `wordpress/plugins/one-platform-connector/` (NEW - to be created)
2436
- - `wordpress/plugins/one-platform-connector/includes/api/connections.php` (NEW)
2437
- - `wordpress/plugins/one-platform-connector/includes/api/events.php` (NEW)
2438
- - `wordpress/plugins/one-platform-connector/includes/api/knowledge.php` (NEW)
2439
- - `wordpress/plugins/one-platform-connector/includes/schema.php` (NEW - SQL table creation)
2440
-
2441
- **Tests:**
2442
-
2443
- - `frontend/tests/unit/providers/wordpress.test.ts` (NEW)
2444
- - `frontend/tests/unit/providers/notion.test.ts` (NEW)
2445
- - `frontend/tests/unit/providers/composite.test.ts` (NEW)
2446
- - `frontend/tests/integration/providers/wordpress.test.ts` (NEW)
2447
- - `frontend/tests/integration/providers/notion.test.ts` (NEW)
2448
- - `frontend/tests/e2e/multi-backend.test.ts` (NEW)
2449
-
2450
- **Documentation:**
2451
-
2452
- - `one/knowledge/providers/wordpress-setup.md` (NEW)
2453
- - `one/knowledge/providers/notion-setup.md` (NEW)
2454
- - `one/knowledge/providers/provider-creation-guide.md` (NEW)
2455
- - `one/knowledge/providers/ontology-mapping.md` (NEW)
2456
-
2457
- ---
2458
-
2459
- ## Success Metrics
2460
-
2461
- **Technical:**
2462
-
2463
- - [ ] 200+ tests passing
2464
- - [ ] WordPress provider: < 500ms p99 latency
2465
- - [ ] Notion provider: < 1s p99 latency
2466
- - [ ] CompositeProvider: < 50ms routing overhead
2467
- - [ ] Zero data loss in stress testing
2468
- - [ ] All 6 dimensions fully implemented
2469
-
2470
- **User Experience:**
2471
-
2472
- - [ ] Organizations can switch providers in < 5 minutes
2473
- - [ ] No frontend code changes required
2474
- - [ ] Seamless experience regardless of backend
2475
- - [ ] Real-time updates working (polling/webhooks)
2476
-
2477
- **Documentation:**
2478
-
2479
- - [ ] 3 complete setup guides published
2480
- - [ ] Provider creation guide with examples
2481
- - [ ] API reference complete
2482
- - [ ] Troubleshooting guide covers 10+ common issues
2483
-
2484
- **Strategic:**
2485
-
2486
- - [ ] Proves backend-agnostic architecture works
2487
- - [ ] Demonstrates ONE's flexibility
2488
- - [ ] Enables organizations with existing infrastructure to adopt ONE
2489
- - [ ] Provides template for future provider implementations
2490
-
2491
- ---
2492
-
2493
- ## Next Steps
2494
-
2495
- 1. ✅ **Integration Specialist:** Create detailed specification (THIS FILE)
2496
- 2. **Integration Specialist:** Review with Engineering Director
2497
- 3. **Integration Specialist:** Set up WordPress test instance
2498
- 4. **Integration Specialist:** Set up Notion test workspace
2499
- 5. **Integration Specialist:** Implement WordPressProvider (Steps 1-40)
2500
- 6. **Integration Specialist:** Implement NotionProvider (Steps 41-75)
2501
- 7. **Integration Specialist:** Implement CompositeProvider (Steps 76-90)
2502
- 8. **Quality Agent:** Run full test suite
2503
- 9. **Integration Specialist:** Fix any failing tests
2504
- 10. **Documenter:** Write setup guides
2505
- 11. **Engineering Director:** Final review and approval
2506
- 12. **Integration Specialist:** Deploy to staging
2507
- 13. **Quality Agent:** Validate in staging
2508
- 14. **Engineering Director:** Deploy to production
2509
-
2510
- ---
2511
-
2512
- **Status:** Detailed Specification Complete ✅
2513
- **Created:** 2025-10-13
2514
- **Specification Completed:** 2025-10-13
2515
- **Validated By:** Integration Specialist (Self)
2516
- **Awaiting Review By:** Engineering Director
2517
- **Strategic Value:** Proves backend-agnostic architecture - enables organizations to use existing infrastructure (WordPress, Notion) while gaining ONE's AI capabilities
2518
- **Lines:** 1,486
2519
-
2520
- ---
2521
-
2522
- ## Appendix: WordPress Database Schema
2523
-
2524
- ```sql
2525
- -- wp_one_connections table
2526
- CREATE TABLE `wp_one_connections` (
2527
- `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
2528
- `from_thing_id` varchar(255) NOT NULL,
2529
- `to_thing_id` varchar(255) NOT NULL,
2530
- `relationship_type` varchar(100) NOT NULL,
2531
- `metadata` text,
2532
- `valid_from` bigint(20) unsigned,
2533
- `valid_to` bigint(20) unsigned,
2534
- `created_at` datetime NOT NULL,
2535
- PRIMARY KEY (`id`),
2536
- KEY `from_thing_id` (`from_thing_id`),
2537
- KEY `to_thing_id` (`to_thing_id`),
2538
- KEY `relationship_type` (`relationship_type`)
2539
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
2540
-
2541
- -- wp_one_events table
2542
- CREATE TABLE `wp_one_events` (
2543
- `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
2544
- `type` varchar(100) NOT NULL,
2545
- `actor_id` varchar(255),
2546
- `target_id` varchar(255),
2547
- `timestamp` datetime NOT NULL,
2548
- `metadata` text,
2549
- PRIMARY KEY (`id`),
2550
- KEY `type` (`type`),
2551
- KEY `actor_id` (`actor_id`),
2552
- KEY `target_id` (`target_id`),
2553
- KEY `timestamp` (`timestamp`)
2554
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
2555
-
2556
- -- wp_one_knowledge table
2557
- CREATE TABLE `wp_one_knowledge` (
2558
- `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
2559
- `knowledge_type` varchar(50) NOT NULL,
2560
- `text` longtext NOT NULL,
2561
- `embedding` longtext,
2562
- `embedding_model` varchar(100),
2563
- `embedding_dim` int(11),
2564
- `source_thing_id` varchar(255),
2565
- `source_field` varchar(100),
2566
- `labels` text,
2567
- `metadata` text,
2568
- `created_at` datetime NOT NULL,
2569
- `updated_at` datetime NOT NULL,
2570
- PRIMARY KEY (`id`),
2571
- KEY `knowledge_type` (`knowledge_type`),
2572
- KEY `source_thing_id` (`source_thing_id`)
2573
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
2574
- ```
2575
-
2576
- ---
2577
-
2578
- **END OF SPECIFICATION**