@plures/praxis 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (534) hide show
  1. package/FRAMEWORK.md +55 -5
  2. package/LICENSE +21 -21
  3. package/README.md +162 -375
  4. package/core/codegen/docs-generator.ts +5 -2
  5. package/core/codegen/index.ts +1 -1
  6. package/core/codegen/ts-generator.ts +15 -15
  7. package/core/db-adapter/index.ts +2 -2
  8. package/core/db-adapter/sync-engine.ts +17 -6
  9. package/core/logic-engine/engine.ts +1 -1
  10. package/core/logic-engine/index.ts +2 -2
  11. package/core/logic-engine/protocol.ts +1 -1
  12. package/core/logic-engine/psf-adapter.ts +8 -4
  13. package/core/logic-engine/rules.ts +1 -1
  14. package/core/schema-engine/compiler.ts +53 -11
  15. package/core/schema-engine/generator.ts +17 -7
  16. package/core/schema-engine/index.ts +2 -2
  17. package/core/schema-engine/psf.ts +12 -3
  18. package/core/schema-engine/types.ts +3 -11
  19. package/core/schema-engine/validator.ts +112 -22
  20. package/dist/browser/engine-BjdqxeXG.d.ts +333 -0
  21. package/dist/browser/index.d.ts +3004 -0
  22. package/dist/browser/index.js +2892 -0
  23. package/dist/{src → browser}/integrations/svelte.d.ts +19 -17
  24. package/dist/browser/integrations/svelte.js +298 -0
  25. package/dist/node/auth-STARLY7I.js +207 -0
  26. package/dist/node/build-Y7OT5VBF.js +144 -0
  27. package/dist/node/canvas-UERZHJYW.js +362 -0
  28. package/dist/node/chunk-DSDC2JWZ.js +256 -0
  29. package/dist/node/chunk-FXQZXAWF.js +175 -0
  30. package/dist/node/chunk-N5Y37EUV.js +202 -0
  31. package/dist/node/chunk-QGM4M3NI.js +37 -0
  32. package/dist/node/chunk-RJMWCNHR.js +175 -0
  33. package/dist/node/chunk-SRM3OPPM.js +404 -0
  34. package/dist/node/chunk-UATVJBNV.js +175 -0
  35. package/dist/node/chunk-UY7YEBE2.js +159 -0
  36. package/dist/node/chunk-XCY2VIFX.js +143 -0
  37. package/dist/node/chunk-YXH4Y7ZZ.js +349 -0
  38. package/dist/node/cli/index.cjs +217418 -0
  39. package/dist/node/cli/index.d.cts +1 -0
  40. package/dist/node/cli/index.d.ts +1 -0
  41. package/dist/node/cli/index.js +690 -0
  42. package/dist/node/cloud/index.cjs +1043 -0
  43. package/dist/node/cloud/index.d.cts +864 -0
  44. package/dist/node/cloud/index.d.ts +864 -0
  45. package/dist/node/cloud/index.js +456 -0
  46. package/dist/node/cloud-AXOK4PSN.js +212 -0
  47. package/dist/node/component.cjs +374 -0
  48. package/dist/node/component.d.cts +125 -0
  49. package/dist/{src/core/component/generator.d.ts → node/component.d.ts} +11 -8
  50. package/dist/node/component.js +9 -0
  51. package/dist/node/components/index.cjs +216 -0
  52. package/dist/node/components/index.d.cts +43 -0
  53. package/dist/{src → node}/components/index.d.ts +8 -8
  54. package/dist/node/components/index.js +7 -0
  55. package/dist/node/create-TRLSVCNQ.js +584 -0
  56. package/dist/node/dev-PMJZUYGE.js +65 -0
  57. package/dist/node/engine-1iqLe6_P.d.ts +214 -0
  58. package/dist/node/engine-CVJobhHm.d.cts +214 -0
  59. package/dist/node/index.cjs +3247 -0
  60. package/dist/node/index.d.cts +2579 -0
  61. package/dist/node/index.d.ts +2579 -0
  62. package/dist/node/index.js +2098 -0
  63. package/dist/node/integrations/svelte.cjs +330 -0
  64. package/dist/node/integrations/svelte.d.cts +309 -0
  65. package/dist/node/integrations/svelte.d.ts +309 -0
  66. package/dist/node/integrations/svelte.js +300 -0
  67. package/dist/node/orchestrate-737TCL5H.js +127 -0
  68. package/dist/{src/core/protocol.d.ts → node/protocol-Qek7ebBl.d.cts} +11 -10
  69. package/dist/node/protocol-Qek7ebBl.d.ts +122 -0
  70. package/dist/node/schema.cjs +200 -0
  71. package/dist/{src/core/schema/types.d.ts → node/schema.d.cts} +30 -29
  72. package/dist/node/schema.d.ts +371 -0
  73. package/dist/node/schema.js +9 -0
  74. package/dist/{src/runtime/terminal-adapter.d.ts → node/terminal-adapter-07HGftGQ.d.ts} +86 -11
  75. package/dist/node/terminal-adapter-XLtCjjb_.d.cts +231 -0
  76. package/dist/node/verify-YBZ7W24H.js +213239 -0
  77. package/docs/MONETIZATION.md +21 -16
  78. package/docs/REACTIVE_REDESIGN.md +132 -0
  79. package/docs/README.md +47 -36
  80. package/docs/SVELTE_INTEGRATION_STRATEGY.md +68 -0
  81. package/docs/TERMINAL_NODE.md +27 -24
  82. package/docs/core/building-extensions.md +58 -61
  83. package/docs/core/cli-usage.md +59 -59
  84. package/docs/core/code-canvas-sync.md +28 -16
  85. package/docs/core/logic-engine.md +77 -82
  86. package/docs/core/pluresdb-integration.md +29 -39
  87. package/docs/core/schema-model.md +66 -52
  88. package/docs/core/ui-generation.md +57 -49
  89. package/docs/core/what-is-praxis.md +32 -15
  90. package/docs/guides/canvas.md +21 -5
  91. package/docs/guides/getting-started.md +13 -7
  92. package/docs/guides/history-state-pattern.md +65 -51
  93. package/docs/guides/orchestration.md +46 -32
  94. package/docs/guides/parallel-state-pattern.md +56 -72
  95. package/docs/guides/svelte-integration.md +45 -53
  96. package/docs/tutorials/README.md +16 -0
  97. package/docs/tutorials/ecommerce-cart.md +177 -95
  98. package/docs/tutorials/first-app.md +26 -41
  99. package/docs/tutorials/form-builder.md +191 -138
  100. package/docs/tutorials/todo-pluresdb.md +71 -69
  101. package/package.json +132 -97
  102. package/src/__tests__/actors.test.ts +68 -68
  103. package/src/__tests__/billing.test.ts +32 -32
  104. package/src/__tests__/canvas-components.test.ts +94 -73
  105. package/src/__tests__/cli-create.test.ts +28 -28
  106. package/src/__tests__/cloud.test.ts +36 -36
  107. package/src/__tests__/code-canvas-integration.test.ts +132 -141
  108. package/src/__tests__/docs-generator.test.ts +3 -9
  109. package/src/__tests__/dsl.test.ts +58 -64
  110. package/src/__tests__/edge-cases.test.ts +106 -108
  111. package/src/__tests__/engine.test.ts +51 -25
  112. package/src/__tests__/generators.test.ts +42 -44
  113. package/src/__tests__/introspection.test.ts +104 -114
  114. package/src/__tests__/pluresdb.test.ts +189 -187
  115. package/src/__tests__/protocol.test.ts +15 -15
  116. package/src/__tests__/provisioning.test.ts +61 -61
  117. package/src/__tests__/schema.test.ts +7 -11
  118. package/src/__tests__/state-docs-integration.test.ts +162 -145
  119. package/src/__tests__/svelte-integration.test.ts +16 -19
  120. package/src/__tests__/tauri-integration.test.ts +149 -147
  121. package/src/__tests__/terminal-node.test.ts +12 -7
  122. package/src/__tests__/unum-integration.test.ts +68 -68
  123. package/src/adapters/cli.ts +21 -15
  124. package/src/cli/commands/auth.ts +82 -78
  125. package/src/cli/commands/build.ts +29 -27
  126. package/src/cli/commands/canvas.ts +338 -127
  127. package/src/cli/commands/cloud.ts +47 -47
  128. package/src/cli/commands/create.ts +59 -47
  129. package/src/cli/commands/dev.ts +12 -12
  130. package/src/cli/commands/generate.ts +29 -40
  131. package/src/cli/commands/orchestrate.ts +24 -24
  132. package/src/cli/commands/verify.ts +7 -8
  133. package/src/cli/index.ts +14 -10
  134. package/src/cloud/README.md +28 -15
  135. package/src/cloud/auth.ts +55 -70
  136. package/src/cloud/billing.ts +59 -58
  137. package/src/cloud/client.ts +29 -35
  138. package/src/cloud/index.ts +19 -40
  139. package/src/cloud/marketplace.ts +69 -78
  140. package/src/cloud/provisioning.ts +42 -51
  141. package/src/cloud/relay/endpoints.ts +30 -34
  142. package/src/cloud/relay/health/index.ts +1 -1
  143. package/src/cloud/relay/stats/index.ts +1 -1
  144. package/src/cloud/relay/sync/index.ts +1 -1
  145. package/src/cloud/relay/usage/index.ts +1 -1
  146. package/src/cloud/sponsors.ts +31 -34
  147. package/src/cloud/types.ts +4 -4
  148. package/src/components/README.md +1 -0
  149. package/src/components/TerminalNode.svelte +457 -457
  150. package/src/components/index.ts +3 -4
  151. package/src/core/actors.ts +7 -7
  152. package/src/core/component/generator.ts +10 -28
  153. package/src/core/engine.ts +51 -24
  154. package/src/core/introspection.ts +37 -35
  155. package/src/core/logic/generator.ts +62 -62
  156. package/src/core/pluresdb/adapter.ts +8 -8
  157. package/src/core/pluresdb/generator.ts +39 -35
  158. package/src/core/pluresdb/index.ts +9 -12
  159. package/src/core/pluresdb/schema-registry.ts +22 -25
  160. package/src/core/pluresdb/store.ts +57 -57
  161. package/src/core/protocol.ts +14 -14
  162. package/src/core/reactive-engine.svelte.ts +65 -0
  163. package/src/core/reactive-engine.ts +67 -0
  164. package/src/core/rules.ts +4 -4
  165. package/src/core/schema/loader.common.ts +150 -0
  166. package/src/core/schema/loader.ts +19 -149
  167. package/src/core/schema/normalize.ts +34 -51
  168. package/src/core/schema/types.ts +47 -11
  169. package/src/dsl/index.ts +8 -8
  170. package/src/dsl.ts +11 -17
  171. package/src/examples/advanced-todo/App.svelte +506 -506
  172. package/src/examples/advanced-todo/README.md +58 -40
  173. package/src/examples/advanced-todo/index.ts +3 -3
  174. package/src/examples/auth-basic/index.ts +30 -30
  175. package/src/examples/cart/index.ts +50 -50
  176. package/src/examples/hero-ecommerce/index.ts +130 -157
  177. package/src/examples/svelte-counter/index.ts +22 -26
  178. package/src/flows.ts +6 -17
  179. package/src/index.browser.ts +204 -0
  180. package/src/index.ts +37 -42
  181. package/src/integrations/code-canvas.ts +237 -193
  182. package/src/integrations/pluresdb.ts +55 -35
  183. package/src/integrations/state-docs.ts +104 -104
  184. package/src/integrations/svelte.ts +35 -35
  185. package/src/integrations/tauri.ts +75 -73
  186. package/src/integrations/unum.ts +68 -61
  187. package/src/registry.ts +7 -14
  188. package/src/runtime/terminal-adapter.ts +31 -26
  189. package/src/step.ts +10 -16
  190. package/src/types.ts +1 -1
  191. package/templates/basic-app/README.md +6 -9
  192. package/templates/fullstack-app/README.md +10 -0
  193. package/dist/core/codegen/docs-generator.d.ts +0 -123
  194. package/dist/core/codegen/docs-generator.d.ts.map +0 -1
  195. package/dist/core/codegen/docs-generator.js +0 -674
  196. package/dist/core/codegen/docs-generator.js.map +0 -1
  197. package/dist/core/codegen/index.d.ts +0 -11
  198. package/dist/core/codegen/index.d.ts.map +0 -1
  199. package/dist/core/codegen/index.js +0 -13
  200. package/dist/core/codegen/index.js.map +0 -1
  201. package/dist/core/codegen/ts-generator.d.ts +0 -8
  202. package/dist/core/codegen/ts-generator.d.ts.map +0 -1
  203. package/dist/core/codegen/ts-generator.js +0 -8
  204. package/dist/core/codegen/ts-generator.js.map +0 -1
  205. package/dist/core/db-adapter/index.d.ts +0 -18
  206. package/dist/core/db-adapter/index.d.ts.map +0 -1
  207. package/dist/core/db-adapter/index.js +0 -23
  208. package/dist/core/db-adapter/index.js.map +0 -1
  209. package/dist/core/db-adapter/sync-engine.d.ts +0 -180
  210. package/dist/core/db-adapter/sync-engine.d.ts.map +0 -1
  211. package/dist/core/db-adapter/sync-engine.js +0 -342
  212. package/dist/core/db-adapter/sync-engine.js.map +0 -1
  213. package/dist/core/logic-engine/engine.d.ts +0 -8
  214. package/dist/core/logic-engine/engine.d.ts.map +0 -1
  215. package/dist/core/logic-engine/engine.js +0 -8
  216. package/dist/core/logic-engine/engine.js.map +0 -1
  217. package/dist/core/logic-engine/index.d.ts +0 -16
  218. package/dist/core/logic-engine/index.d.ts.map +0 -1
  219. package/dist/core/logic-engine/index.js +0 -16
  220. package/dist/core/logic-engine/index.js.map +0 -1
  221. package/dist/core/logic-engine/protocol.d.ts +0 -7
  222. package/dist/core/logic-engine/protocol.d.ts.map +0 -1
  223. package/dist/core/logic-engine/protocol.js +0 -7
  224. package/dist/core/logic-engine/protocol.js.map +0 -1
  225. package/dist/core/logic-engine/psf-adapter.d.ts +0 -88
  226. package/dist/core/logic-engine/psf-adapter.d.ts.map +0 -1
  227. package/dist/core/logic-engine/psf-adapter.js +0 -207
  228. package/dist/core/logic-engine/psf-adapter.js.map +0 -1
  229. package/dist/core/logic-engine/rules.d.ts +0 -7
  230. package/dist/core/logic-engine/rules.d.ts.map +0 -1
  231. package/dist/core/logic-engine/rules.js +0 -7
  232. package/dist/core/logic-engine/rules.js.map +0 -1
  233. package/dist/core/schema-engine/compiler.d.ts +0 -198
  234. package/dist/core/schema-engine/compiler.d.ts.map +0 -1
  235. package/dist/core/schema-engine/compiler.js +0 -262
  236. package/dist/core/schema-engine/compiler.js.map +0 -1
  237. package/dist/core/schema-engine/generator.d.ts +0 -115
  238. package/dist/core/schema-engine/generator.d.ts.map +0 -1
  239. package/dist/core/schema-engine/generator.js +0 -506
  240. package/dist/core/schema-engine/generator.js.map +0 -1
  241. package/dist/core/schema-engine/index.d.ts +0 -18
  242. package/dist/core/schema-engine/index.d.ts.map +0 -1
  243. package/dist/core/schema-engine/index.js +0 -18
  244. package/dist/core/schema-engine/index.js.map +0 -1
  245. package/dist/core/schema-engine/psf.d.ts +0 -612
  246. package/dist/core/schema-engine/psf.d.ts.map +0 -1
  247. package/dist/core/schema-engine/psf.js +0 -45
  248. package/dist/core/schema-engine/psf.js.map +0 -1
  249. package/dist/core/schema-engine/types.d.ts +0 -10
  250. package/dist/core/schema-engine/types.d.ts.map +0 -1
  251. package/dist/core/schema-engine/types.js +0 -7
  252. package/dist/core/schema-engine/types.js.map +0 -1
  253. package/dist/core/schema-engine/validator.d.ts +0 -140
  254. package/dist/core/schema-engine/validator.d.ts.map +0 -1
  255. package/dist/core/schema-engine/validator.js +0 -407
  256. package/dist/core/schema-engine/validator.js.map +0 -1
  257. package/dist/src/adapters/cli.d.ts +0 -43
  258. package/dist/src/adapters/cli.d.ts.map +0 -1
  259. package/dist/src/adapters/cli.js +0 -126
  260. package/dist/src/adapters/cli.js.map +0 -1
  261. package/dist/src/cli/commands/auth.d.ts +0 -26
  262. package/dist/src/cli/commands/auth.d.ts.map +0 -1
  263. package/dist/src/cli/commands/auth.js +0 -233
  264. package/dist/src/cli/commands/auth.js.map +0 -1
  265. package/dist/src/cli/commands/build.d.ts +0 -23
  266. package/dist/src/cli/commands/build.d.ts.map +0 -1
  267. package/dist/src/cli/commands/build.js +0 -162
  268. package/dist/src/cli/commands/build.js.map +0 -1
  269. package/dist/src/cli/commands/canvas.d.ts +0 -23
  270. package/dist/src/cli/commands/canvas.d.ts.map +0 -1
  271. package/dist/src/cli/commands/canvas.js +0 -215
  272. package/dist/src/cli/commands/canvas.js.map +0 -1
  273. package/dist/src/cli/commands/cloud.d.ts +0 -27
  274. package/dist/src/cli/commands/cloud.d.ts.map +0 -1
  275. package/dist/src/cli/commands/cloud.js +0 -232
  276. package/dist/src/cli/commands/cloud.js.map +0 -1
  277. package/dist/src/cli/commands/create.d.ts +0 -21
  278. package/dist/src/cli/commands/create.d.ts.map +0 -1
  279. package/dist/src/cli/commands/create.js +0 -621
  280. package/dist/src/cli/commands/create.js.map +0 -1
  281. package/dist/src/cli/commands/dev.d.ts +0 -21
  282. package/dist/src/cli/commands/dev.d.ts.map +0 -1
  283. package/dist/src/cli/commands/dev.js +0 -71
  284. package/dist/src/cli/commands/dev.js.map +0 -1
  285. package/dist/src/cli/commands/generate.d.ts +0 -25
  286. package/dist/src/cli/commands/generate.d.ts.map +0 -1
  287. package/dist/src/cli/commands/generate.js +0 -168
  288. package/dist/src/cli/commands/generate.js.map +0 -1
  289. package/dist/src/cli/commands/orchestrate.d.ts +0 -44
  290. package/dist/src/cli/commands/orchestrate.d.ts.map +0 -1
  291. package/dist/src/cli/commands/orchestrate.js +0 -150
  292. package/dist/src/cli/commands/orchestrate.js.map +0 -1
  293. package/dist/src/cli/commands/verify.d.ts +0 -10
  294. package/dist/src/cli/commands/verify.d.ts.map +0 -1
  295. package/dist/src/cli/commands/verify.js +0 -39
  296. package/dist/src/cli/commands/verify.js.map +0 -1
  297. package/dist/src/cli/index.d.ts +0 -8
  298. package/dist/src/cli/index.d.ts.map +0 -1
  299. package/dist/src/cli/index.js +0 -226
  300. package/dist/src/cli/index.js.map +0 -1
  301. package/dist/src/cloud/auth.d.ts +0 -51
  302. package/dist/src/cloud/auth.d.ts.map +0 -1
  303. package/dist/src/cloud/auth.js +0 -194
  304. package/dist/src/cloud/auth.js.map +0 -1
  305. package/dist/src/cloud/billing.d.ts +0 -184
  306. package/dist/src/cloud/billing.d.ts.map +0 -1
  307. package/dist/src/cloud/billing.js +0 -179
  308. package/dist/src/cloud/billing.js.map +0 -1
  309. package/dist/src/cloud/client.d.ts +0 -39
  310. package/dist/src/cloud/client.d.ts.map +0 -1
  311. package/dist/src/cloud/client.js +0 -176
  312. package/dist/src/cloud/client.js.map +0 -1
  313. package/dist/src/cloud/index.d.ts +0 -44
  314. package/dist/src/cloud/index.d.ts.map +0 -1
  315. package/dist/src/cloud/index.js +0 -44
  316. package/dist/src/cloud/index.js.map +0 -1
  317. package/dist/src/cloud/marketplace.d.ts +0 -166
  318. package/dist/src/cloud/marketplace.d.ts.map +0 -1
  319. package/dist/src/cloud/marketplace.js +0 -159
  320. package/dist/src/cloud/marketplace.js.map +0 -1
  321. package/dist/src/cloud/provisioning.d.ts +0 -110
  322. package/dist/src/cloud/provisioning.d.ts.map +0 -1
  323. package/dist/src/cloud/provisioning.js +0 -148
  324. package/dist/src/cloud/provisioning.js.map +0 -1
  325. package/dist/src/cloud/relay/endpoints.d.ts +0 -62
  326. package/dist/src/cloud/relay/endpoints.d.ts.map +0 -1
  327. package/dist/src/cloud/relay/endpoints.js +0 -217
  328. package/dist/src/cloud/relay/endpoints.js.map +0 -1
  329. package/dist/src/cloud/relay/health/index.d.ts +0 -5
  330. package/dist/src/cloud/relay/health/index.d.ts.map +0 -1
  331. package/dist/src/cloud/relay/health/index.js +0 -9
  332. package/dist/src/cloud/relay/health/index.js.map +0 -1
  333. package/dist/src/cloud/relay/stats/index.d.ts +0 -5
  334. package/dist/src/cloud/relay/stats/index.d.ts.map +0 -1
  335. package/dist/src/cloud/relay/stats/index.js +0 -9
  336. package/dist/src/cloud/relay/stats/index.js.map +0 -1
  337. package/dist/src/cloud/relay/sync/index.d.ts +0 -5
  338. package/dist/src/cloud/relay/sync/index.d.ts.map +0 -1
  339. package/dist/src/cloud/relay/sync/index.js +0 -9
  340. package/dist/src/cloud/relay/sync/index.js.map +0 -1
  341. package/dist/src/cloud/relay/usage/index.d.ts +0 -5
  342. package/dist/src/cloud/relay/usage/index.d.ts.map +0 -1
  343. package/dist/src/cloud/relay/usage/index.js +0 -9
  344. package/dist/src/cloud/relay/usage/index.js.map +0 -1
  345. package/dist/src/cloud/sponsors.d.ts +0 -81
  346. package/dist/src/cloud/sponsors.d.ts.map +0 -1
  347. package/dist/src/cloud/sponsors.js +0 -130
  348. package/dist/src/cloud/sponsors.js.map +0 -1
  349. package/dist/src/cloud/types.d.ts +0 -169
  350. package/dist/src/cloud/types.d.ts.map +0 -1
  351. package/dist/src/cloud/types.js +0 -7
  352. package/dist/src/cloud/types.js.map +0 -1
  353. package/dist/src/components/index.d.ts.map +0 -1
  354. package/dist/src/components/index.js +0 -17
  355. package/dist/src/components/index.js.map +0 -1
  356. package/dist/src/core/actors.d.ts +0 -95
  357. package/dist/src/core/actors.d.ts.map +0 -1
  358. package/dist/src/core/actors.js +0 -158
  359. package/dist/src/core/actors.js.map +0 -1
  360. package/dist/src/core/component/generator.d.ts.map +0 -1
  361. package/dist/src/core/component/generator.js +0 -349
  362. package/dist/src/core/component/generator.js.map +0 -1
  363. package/dist/src/core/engine.d.ts +0 -92
  364. package/dist/src/core/engine.d.ts.map +0 -1
  365. package/dist/src/core/engine.js +0 -199
  366. package/dist/src/core/engine.js.map +0 -1
  367. package/dist/src/core/introspection.d.ts +0 -141
  368. package/dist/src/core/introspection.d.ts.map +0 -1
  369. package/dist/src/core/introspection.js +0 -208
  370. package/dist/src/core/introspection.js.map +0 -1
  371. package/dist/src/core/logic/generator.d.ts +0 -76
  372. package/dist/src/core/logic/generator.d.ts.map +0 -1
  373. package/dist/src/core/logic/generator.js +0 -370
  374. package/dist/src/core/logic/generator.js.map +0 -1
  375. package/dist/src/core/pluresdb/adapter.d.ts +0 -72
  376. package/dist/src/core/pluresdb/adapter.d.ts.map +0 -1
  377. package/dist/src/core/pluresdb/adapter.js +0 -73
  378. package/dist/src/core/pluresdb/adapter.js.map +0 -1
  379. package/dist/src/core/pluresdb/generator.d.ts +0 -58
  380. package/dist/src/core/pluresdb/generator.d.ts.map +0 -1
  381. package/dist/src/core/pluresdb/generator.js +0 -191
  382. package/dist/src/core/pluresdb/generator.js.map +0 -1
  383. package/dist/src/core/pluresdb/index.d.ts +0 -15
  384. package/dist/src/core/pluresdb/index.d.ts.map +0 -1
  385. package/dist/src/core/pluresdb/index.js +0 -11
  386. package/dist/src/core/pluresdb/index.js.map +0 -1
  387. package/dist/src/core/pluresdb/schema-registry.d.ts +0 -104
  388. package/dist/src/core/pluresdb/schema-registry.d.ts.map +0 -1
  389. package/dist/src/core/pluresdb/schema-registry.js +0 -130
  390. package/dist/src/core/pluresdb/schema-registry.js.map +0 -1
  391. package/dist/src/core/pluresdb/store.d.ts +0 -199
  392. package/dist/src/core/pluresdb/store.d.ts.map +0 -1
  393. package/dist/src/core/pluresdb/store.js +0 -344
  394. package/dist/src/core/pluresdb/store.js.map +0 -1
  395. package/dist/src/core/protocol.d.ts.map +0 -1
  396. package/dist/src/core/protocol.js +0 -46
  397. package/dist/src/core/protocol.js.map +0 -1
  398. package/dist/src/core/rules.d.ts +0 -120
  399. package/dist/src/core/rules.d.ts.map +0 -1
  400. package/dist/src/core/rules.js +0 -81
  401. package/dist/src/core/rules.js.map +0 -1
  402. package/dist/src/core/schema/loader.d.ts +0 -47
  403. package/dist/src/core/schema/loader.d.ts.map +0 -1
  404. package/dist/src/core/schema/loader.js +0 -189
  405. package/dist/src/core/schema/loader.js.map +0 -1
  406. package/dist/src/core/schema/normalize.d.ts +0 -72
  407. package/dist/src/core/schema/normalize.d.ts.map +0 -1
  408. package/dist/src/core/schema/normalize.js +0 -190
  409. package/dist/src/core/schema/normalize.js.map +0 -1
  410. package/dist/src/core/schema/types.d.ts.map +0 -1
  411. package/dist/src/core/schema/types.js +0 -161
  412. package/dist/src/core/schema/types.js.map +0 -1
  413. package/dist/src/dsl/index.d.ts +0 -152
  414. package/dist/src/dsl/index.d.ts.map +0 -1
  415. package/dist/src/dsl/index.js +0 -132
  416. package/dist/src/dsl/index.js.map +0 -1
  417. package/dist/src/dsl.d.ts +0 -124
  418. package/dist/src/dsl.d.ts.map +0 -1
  419. package/dist/src/dsl.js +0 -130
  420. package/dist/src/dsl.js.map +0 -1
  421. package/dist/src/examples/advanced-todo/index.d.ts +0 -55
  422. package/dist/src/examples/advanced-todo/index.d.ts.map +0 -1
  423. package/dist/src/examples/advanced-todo/index.js +0 -222
  424. package/dist/src/examples/advanced-todo/index.js.map +0 -1
  425. package/dist/src/examples/auth-basic/index.d.ts +0 -17
  426. package/dist/src/examples/auth-basic/index.d.ts.map +0 -1
  427. package/dist/src/examples/auth-basic/index.js +0 -122
  428. package/dist/src/examples/auth-basic/index.js.map +0 -1
  429. package/dist/src/examples/cart/index.d.ts +0 -19
  430. package/dist/src/examples/cart/index.d.ts.map +0 -1
  431. package/dist/src/examples/cart/index.js +0 -202
  432. package/dist/src/examples/cart/index.js.map +0 -1
  433. package/dist/src/examples/hero-ecommerce/index.d.ts +0 -39
  434. package/dist/src/examples/hero-ecommerce/index.d.ts.map +0 -1
  435. package/dist/src/examples/hero-ecommerce/index.js +0 -506
  436. package/dist/src/examples/hero-ecommerce/index.js.map +0 -1
  437. package/dist/src/examples/svelte-counter/index.d.ts +0 -31
  438. package/dist/src/examples/svelte-counter/index.d.ts.map +0 -1
  439. package/dist/src/examples/svelte-counter/index.js +0 -123
  440. package/dist/src/examples/svelte-counter/index.js.map +0 -1
  441. package/dist/src/flows.d.ts +0 -125
  442. package/dist/src/flows.d.ts.map +0 -1
  443. package/dist/src/flows.js +0 -160
  444. package/dist/src/flows.js.map +0 -1
  445. package/dist/src/index.d.ts +0 -77
  446. package/dist/src/index.d.ts.map +0 -1
  447. package/dist/src/index.js +0 -64
  448. package/dist/src/index.js.map +0 -1
  449. package/dist/src/integrations/code-canvas.d.ts +0 -265
  450. package/dist/src/integrations/code-canvas.d.ts.map +0 -1
  451. package/dist/src/integrations/code-canvas.js +0 -451
  452. package/dist/src/integrations/code-canvas.js.map +0 -1
  453. package/dist/src/integrations/pluresdb.d.ts +0 -117
  454. package/dist/src/integrations/pluresdb.d.ts.map +0 -1
  455. package/dist/src/integrations/pluresdb.js +0 -117
  456. package/dist/src/integrations/pluresdb.js.map +0 -1
  457. package/dist/src/integrations/state-docs.d.ts +0 -191
  458. package/dist/src/integrations/state-docs.d.ts.map +0 -1
  459. package/dist/src/integrations/state-docs.js +0 -515
  460. package/dist/src/integrations/state-docs.js.map +0 -1
  461. package/dist/src/integrations/svelte.d.ts.map +0 -1
  462. package/dist/src/integrations/svelte.js +0 -447
  463. package/dist/src/integrations/svelte.js.map +0 -1
  464. package/dist/src/integrations/tauri.d.ts +0 -360
  465. package/dist/src/integrations/tauri.d.ts.map +0 -1
  466. package/dist/src/integrations/tauri.js +0 -278
  467. package/dist/src/integrations/tauri.js.map +0 -1
  468. package/dist/src/integrations/unum.d.ts +0 -159
  469. package/dist/src/integrations/unum.d.ts.map +0 -1
  470. package/dist/src/integrations/unum.js +0 -240
  471. package/dist/src/integrations/unum.js.map +0 -1
  472. package/dist/src/registry.d.ts +0 -94
  473. package/dist/src/registry.d.ts.map +0 -1
  474. package/dist/src/registry.js +0 -181
  475. package/dist/src/registry.js.map +0 -1
  476. package/dist/src/runtime/terminal-adapter.d.ts.map +0 -1
  477. package/dist/src/runtime/terminal-adapter.js +0 -239
  478. package/dist/src/runtime/terminal-adapter.js.map +0 -1
  479. package/dist/src/step.d.ts +0 -34
  480. package/dist/src/step.d.ts.map +0 -1
  481. package/dist/src/step.js +0 -111
  482. package/dist/src/step.js.map +0 -1
  483. package/dist/src/types.d.ts +0 -63
  484. package/dist/src/types.d.ts.map +0 -1
  485. package/dist/src/types.js +0 -6
  486. package/dist/src/types.js.map +0 -1
  487. package/dist/tools/ast-analyzer/src/ast-analyzer.d.ts +0 -8
  488. package/dist/tools/ast-analyzer/src/ast-analyzer.d.ts.map +0 -1
  489. package/dist/tools/ast-analyzer/src/ast-analyzer.js +0 -119
  490. package/dist/tools/ast-analyzer/src/ast-analyzer.js.map +0 -1
  491. package/dist/tools/cli/commands/index.d.ts +0 -7
  492. package/dist/tools/cli/commands/index.d.ts.map +0 -1
  493. package/dist/tools/cli/commands/index.js +0 -7
  494. package/dist/tools/cli/commands/index.js.map +0 -1
  495. package/dist/tools/cli/index.d.ts +0 -8
  496. package/dist/tools/cli/index.d.ts.map +0 -1
  497. package/dist/tools/cli/index.js +0 -9
  498. package/dist/tools/cli/index.js.map +0 -1
  499. package/dist/tools/watcher/index.d.ts +0 -105
  500. package/dist/tools/watcher/index.d.ts.map +0 -1
  501. package/dist/tools/watcher/index.js +0 -213
  502. package/dist/tools/watcher/index.js.map +0 -1
  503. package/dist/ui/canvas/canvas-projection.d.ts +0 -78
  504. package/dist/ui/canvas/canvas-projection.d.ts.map +0 -1
  505. package/dist/ui/canvas/canvas-projection.js +0 -416
  506. package/dist/ui/canvas/canvas-projection.js.map +0 -1
  507. package/dist/ui/canvas/canvas-state.d.ts +0 -200
  508. package/dist/ui/canvas/canvas-state.d.ts.map +0 -1
  509. package/dist/ui/canvas/canvas-state.js +0 -464
  510. package/dist/ui/canvas/canvas-state.js.map +0 -1
  511. package/dist/ui/canvas/components/index.d.ts +0 -95
  512. package/dist/ui/canvas/components/index.d.ts.map +0 -1
  513. package/dist/ui/canvas/components/index.js +0 -19
  514. package/dist/ui/canvas/components/index.js.map +0 -1
  515. package/dist/ui/canvas/index.d.ts +0 -32
  516. package/dist/ui/canvas/index.d.ts.map +0 -1
  517. package/dist/ui/canvas/index.js +0 -32
  518. package/dist/ui/canvas/index.js.map +0 -1
  519. package/dist/ui/canvas-inspector/src/server.d.ts +0 -2
  520. package/dist/ui/canvas-inspector/src/server.d.ts.map +0 -1
  521. package/dist/ui/canvas-inspector/src/server.js +0 -248
  522. package/dist/ui/canvas-inspector/src/server.js.map +0 -1
  523. package/dist/ui/canvas-inspector/src/verify-fsm-implementation.d.ts +0 -5
  524. package/dist/ui/canvas-inspector/src/verify-fsm-implementation.d.ts.map +0 -1
  525. package/dist/ui/canvas-inspector/src/verify-fsm-implementation.js +0 -58
  526. package/dist/ui/canvas-inspector/src/verify-fsm-implementation.js.map +0 -1
  527. package/dist/ui/svelte-generator/index.d.ts +0 -9
  528. package/dist/ui/svelte-generator/index.d.ts.map +0 -1
  529. package/dist/ui/svelte-generator/index.js +0 -11
  530. package/dist/ui/svelte-generator/index.js.map +0 -1
  531. package/dist/ui/svelte-generator/psf-generator.d.ts +0 -128
  532. package/dist/ui/svelte-generator/psf-generator.d.ts.map +0 -1
  533. package/dist/ui/svelte-generator/psf-generator.js +0 -506
  534. package/dist/ui/svelte-generator/psf-generator.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Cloud Relay Client
3
- *
3
+ *
4
4
  * Client for connecting to Praxis Cloud Relay service (Azure-based).
5
5
  */
6
6
 
@@ -11,7 +11,7 @@ import type {
11
11
  CRDTSyncMessage,
12
12
  UsageMetrics,
13
13
  HealthCheckResponse,
14
- } from "./types.js";
14
+ } from './types.js';
15
15
 
16
16
  /**
17
17
  * Create a cloud relay client
@@ -30,15 +30,15 @@ export function createCloudRelay(config: CloudRelayConfig): CloudRelayClient {
30
30
  async connect(): Promise<void> {
31
31
  // Validate endpoint
32
32
  if (!config.endpoint) {
33
- throw new Error("Cloud relay endpoint is required");
33
+ throw new Error('Cloud relay endpoint is required');
34
34
  }
35
35
 
36
36
  // Test connection
37
37
  try {
38
38
  const response = await fetch(`${config.endpoint}/health`, {
39
- method: "GET",
39
+ method: 'GET',
40
40
  headers: {
41
- "Content-Type": "application/json",
41
+ 'Content-Type': 'application/json',
42
42
  ...(config.authToken && {
43
43
  Authorization: `Bearer ${config.authToken}`,
44
44
  }),
@@ -79,7 +79,7 @@ export function createCloudRelay(config: CloudRelayConfig): CloudRelayClient {
79
79
 
80
80
  async sync(message: CRDTSyncMessage): Promise<void> {
81
81
  if (!status.connected) {
82
- throw new Error("Not connected to cloud relay");
82
+ throw new Error('Not connected to cloud relay');
83
83
  }
84
84
 
85
85
  // Update vector clock
@@ -88,9 +88,9 @@ export function createCloudRelay(config: CloudRelayConfig): CloudRelayClient {
88
88
 
89
89
  try {
90
90
  const response = await fetch(`${config.endpoint}/sync`, {
91
- method: "POST",
91
+ method: 'POST',
92
92
  headers: {
93
- "Content-Type": "application/json",
93
+ 'Content-Type': 'application/json',
94
94
  ...(config.authToken && {
95
95
  Authorization: `Bearer ${config.authToken}`,
96
96
  }),
@@ -105,13 +105,10 @@ export function createCloudRelay(config: CloudRelayConfig): CloudRelayClient {
105
105
  status.lastSync = Date.now();
106
106
 
107
107
  // Merge received vector clock
108
- const result = await response.json() as any;
108
+ const result = (await response.json()) as any;
109
109
  if (result.clock) {
110
110
  Object.entries(result.clock).forEach(([key, value]) => {
111
- vectorClock[key] = Math.max(
112
- vectorClock[key] || 0,
113
- value as number
114
- );
111
+ vectorClock[key] = Math.max(vectorClock[key] || 0, value as number);
115
112
  });
116
113
  }
117
114
  } catch (error) {
@@ -123,28 +120,25 @@ export function createCloudRelay(config: CloudRelayConfig): CloudRelayClient {
123
120
 
124
121
  async getUsage(): Promise<UsageMetrics> {
125
122
  if (!status.connected) {
126
- throw new Error("Not connected to cloud relay");
123
+ throw new Error('Not connected to cloud relay');
127
124
  }
128
125
 
129
126
  try {
130
- const response = await fetch(
131
- `${config.endpoint}/usage?appId=${config.appId}`,
132
- {
133
- method: "GET",
134
- headers: {
135
- "Content-Type": "application/json",
136
- ...(config.authToken && {
137
- Authorization: `Bearer ${config.authToken}`,
138
- }),
139
- },
140
- }
141
- );
127
+ const response = await fetch(`${config.endpoint}/usage?appId=${config.appId}`, {
128
+ method: 'GET',
129
+ headers: {
130
+ 'Content-Type': 'application/json',
131
+ ...(config.authToken && {
132
+ Authorization: `Bearer ${config.authToken}`,
133
+ }),
134
+ },
135
+ });
142
136
 
143
137
  if (!response.ok) {
144
138
  throw new Error(`Failed to get usage: ${response.statusText}`);
145
139
  }
146
140
 
147
- return await response.json() as UsageMetrics;
141
+ return (await response.json()) as UsageMetrics;
148
142
  } catch (error) {
149
143
  throw new Error(
150
144
  `Failed to get usage metrics: ${error instanceof Error ? error.message : String(error)}`
@@ -155,9 +149,9 @@ export function createCloudRelay(config: CloudRelayConfig): CloudRelayClient {
155
149
  async getHealth(): Promise<HealthCheckResponse> {
156
150
  try {
157
151
  const response = await fetch(`${config.endpoint}/health`, {
158
- method: "GET",
152
+ method: 'GET',
159
153
  headers: {
160
- "Content-Type": "application/json",
154
+ 'Content-Type': 'application/json',
161
155
  },
162
156
  });
163
157
 
@@ -165,7 +159,7 @@ export function createCloudRelay(config: CloudRelayConfig): CloudRelayClient {
165
159
  throw new Error(`Health check failed: ${response.statusText}`);
166
160
  }
167
161
 
168
- return await response.json() as HealthCheckResponse;
162
+ return (await response.json()) as HealthCheckResponse;
169
163
  } catch (error) {
170
164
  throw new Error(
171
165
  `Failed to get health status: ${error instanceof Error ? error.message : String(error)}`
@@ -181,21 +175,21 @@ export function createCloudRelay(config: CloudRelayConfig): CloudRelayClient {
181
175
 
182
176
  /**
183
177
  * Connect to Praxis Cloud Relay
184
- *
178
+ *
185
179
  * @param endpoint - Azure Function App endpoint URL
186
180
  * @param options - Additional configuration options
187
181
  * @returns Cloud relay client instance
188
- *
182
+ *
189
183
  * @example
190
184
  * ```typescript
191
185
  * import { connectRelay } from "@plures/praxis/cloud";
192
- *
186
+ *
193
187
  * const relay = await connectRelay("https://my-app.azurewebsites.net", {
194
188
  * appId: "my-app",
195
189
  * authToken: "github-token",
196
190
  * autoSync: true
197
191
  * });
198
- *
192
+ *
199
193
  * // Sync data
200
194
  * await relay.sync({
201
195
  * type: "delta",
@@ -208,7 +202,7 @@ export function createCloudRelay(config: CloudRelayConfig): CloudRelayClient {
208
202
  */
209
203
  export async function connectRelay(
210
204
  endpoint: string,
211
- options: Omit<CloudRelayConfig, "endpoint"> = { appId: "default" }
205
+ options: Omit<CloudRelayConfig, 'endpoint'> = { appId: 'default' }
212
206
  ): Promise<CloudRelayClient> {
213
207
  const config: CloudRelayConfig = {
214
208
  endpoint,
@@ -1,18 +1,18 @@
1
1
  /**
2
2
  * Praxis Cloud
3
- *
3
+ *
4
4
  * Cloud relay and synchronization for Praxis applications.
5
- *
5
+ *
6
6
  * @example
7
7
  * ```typescript
8
8
  * import { connectRelay } from "@plures/praxis/cloud";
9
- *
9
+ *
10
10
  * const relay = await connectRelay("https://my-app.azurewebsites.net", {
11
11
  * appId: "my-app",
12
12
  * authToken: "github-token",
13
13
  * autoSync: true
14
14
  * });
15
- *
15
+ *
16
16
  * // Sync data
17
17
  * await relay.sync({
18
18
  * type: "delta",
@@ -21,7 +21,7 @@
21
21
  * facts: [...],
22
22
  * timestamp: Date.now()
23
23
  * });
24
- *
24
+ *
25
25
  * // Get usage metrics
26
26
  * const usage = await relay.getUsage();
27
27
  * console.log(`Syncs: ${usage.syncCount}, Events: ${usage.eventCount}`);
@@ -29,7 +29,7 @@
29
29
  */
30
30
 
31
31
  // Client
32
- export { createCloudRelay, connectRelay } from "./client.js";
32
+ export { createCloudRelay, connectRelay } from './client.js';
33
33
 
34
34
  // Types
35
35
  export type {
@@ -41,15 +41,11 @@ export type {
41
41
  HealthCheckResponse,
42
42
  GitHubUser,
43
43
  AuthResult,
44
- } from "./types.js";
44
+ } from './types.js';
45
45
 
46
46
  // Authentication
47
- export {
48
- GitHubOAuth,
49
- createGitHubOAuth,
50
- authenticateWithDeviceFlow,
51
- } from "./auth.js";
52
- export type { GitHubOAuthConfig } from "./auth.js";
47
+ export { GitHubOAuth, createGitHubOAuth, authenticateWithDeviceFlow } from './auth.js';
48
+ export type { GitHubOAuthConfig } from './auth.js';
53
49
 
54
50
  // Billing and Subscriptions
55
51
  export {
@@ -61,34 +57,24 @@ export {
61
57
  checkUsageLimits,
62
58
  createFreeSubscription,
63
59
  createSponsorSubscription,
64
- } from "./billing.js";
65
- export type {
66
- TierLimits,
67
- Subscription,
68
- BillingEvent,
69
- } from "./billing.js";
60
+ } from './billing.js';
61
+ export type { TierLimits, Subscription, BillingEvent } from './billing.js';
70
62
 
71
63
  // GitHub Sponsors
72
- export {
73
- GitHubSponsorsClient,
74
- createSponsorsClient,
75
- } from "./sponsors.js";
76
- export type {
77
- SponsorTier,
78
- Sponsorship,
79
- } from "./sponsors.js";
64
+ export { GitHubSponsorsClient, createSponsorsClient } from './sponsors.js';
65
+ export type { SponsorTier, Sponsorship } from './sponsors.js';
80
66
 
81
67
  // GitHub Marketplace
82
68
  export {
83
69
  GitHubMarketplaceClient,
84
70
  createMarketplaceClient,
85
71
  MARKETPLACE_PLANS,
86
- } from "./marketplace.js";
72
+ } from './marketplace.js';
87
73
  export type {
88
74
  MarketplacePlan,
89
75
  MarketplaceAccount,
90
76
  MarketplaceWebhookEvent,
91
- } from "./marketplace.js";
77
+ } from './marketplace.js';
92
78
 
93
79
  // Auto-Provisioning
94
80
  export {
@@ -99,11 +85,8 @@ export {
99
85
  getAppStorageContainer,
100
86
  provisionTenant,
101
87
  getOrCreateTenant,
102
- } from "./provisioning.js";
103
- export type {
104
- Tenant,
105
- ProvisioningResult,
106
- } from "./provisioning.js";
88
+ } from './provisioning.js';
89
+ export type { Tenant, ProvisioningResult } from './provisioning.js';
107
90
 
108
91
  // Relay endpoints (for Azure Functions deployment)
109
92
  export {
@@ -113,9 +96,5 @@ export {
113
96
  statsEndpoint,
114
97
  eventsEndpoint,
115
98
  schemaEndpoint,
116
- } from "./relay/endpoints.js";
117
- export type {
118
- AzureContext,
119
- AzureHttpRequest,
120
- AzureHttpResponse,
121
- } from "./relay/endpoints.js";
99
+ } from './relay/endpoints.js';
100
+ export type { AzureContext, AzureHttpRequest, AzureHttpResponse } from './relay/endpoints.js';
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * GitHub Marketplace API Client
3
- *
3
+ *
4
4
  * Client for GitHub Marketplace SaaS integration (preparatory).
5
5
  */
6
6
 
7
- import type { Subscription } from "./billing.js";
8
- import { SubscriptionTier, SubscriptionStatus, BillingProvider, TIER_LIMITS } from "./billing.js";
7
+ import type { Subscription } from './billing.js';
8
+ import { SubscriptionTier, SubscriptionStatus, BillingProvider, TIER_LIMITS } from './billing.js';
9
9
 
10
10
  /**
11
11
  * GitHub Marketplace plan
@@ -15,42 +15,42 @@ export interface MarketplacePlan {
15
15
  * Plan ID
16
16
  */
17
17
  id: number;
18
-
18
+
19
19
  /**
20
20
  * Plan name
21
21
  */
22
22
  name: string;
23
-
23
+
24
24
  /**
25
25
  * Plan description
26
26
  */
27
27
  description: string;
28
-
28
+
29
29
  /**
30
30
  * Monthly price in cents
31
31
  */
32
32
  monthlyPriceInCents: number;
33
-
33
+
34
34
  /**
35
35
  * Yearly price in cents
36
36
  */
37
37
  yearlyPriceInCents: number;
38
-
38
+
39
39
  /**
40
40
  * Price model
41
41
  */
42
- priceModel: "FLAT_RATE" | "PER_UNIT";
43
-
42
+ priceModel: 'FLAT_RATE' | 'PER_UNIT';
43
+
44
44
  /**
45
45
  * Whether this plan has a free trial
46
46
  */
47
47
  hasFreeTrial: boolean;
48
-
48
+
49
49
  /**
50
50
  * Unit name (for per-unit pricing)
51
51
  */
52
52
  unitName?: string;
53
-
53
+
54
54
  /**
55
55
  * Bullets (features list)
56
56
  */
@@ -65,32 +65,32 @@ export interface MarketplaceAccount {
65
65
  * Account ID
66
66
  */
67
67
  id: number;
68
-
68
+
69
69
  /**
70
70
  * Account login
71
71
  */
72
72
  login: string;
73
-
73
+
74
74
  /**
75
75
  * Account type
76
76
  */
77
- type: "User" | "Organization";
78
-
77
+ type: 'User' | 'Organization';
78
+
79
79
  /**
80
80
  * Plan
81
81
  */
82
82
  plan: MarketplacePlan;
83
-
83
+
84
84
  /**
85
85
  * Whether account is on free trial
86
86
  */
87
87
  onFreeTrial: boolean;
88
-
88
+
89
89
  /**
90
90
  * Free trial ends on (if applicable)
91
91
  */
92
92
  freeTrialEndsOn?: string;
93
-
93
+
94
94
  /**
95
95
  * Next billing date
96
96
  */
@@ -104,31 +104,31 @@ export interface MarketplaceWebhookEvent {
104
104
  /**
105
105
  * Action type
106
106
  */
107
- action: "purchased" | "cancelled" | "changed" | "pending_change" | "pending_change_cancelled";
108
-
107
+ action: 'purchased' | 'cancelled' | 'changed' | 'pending_change' | 'pending_change_cancelled';
108
+
109
109
  /**
110
110
  * Effective date
111
111
  */
112
112
  effectiveDate?: string;
113
-
113
+
114
114
  /**
115
115
  * Marketplace purchase
116
116
  */
117
117
  marketplacePurchase: {
118
118
  account: MarketplaceAccount;
119
- billingCycle: "monthly" | "yearly";
119
+ billingCycle: 'monthly' | 'yearly';
120
120
  unitCount?: number;
121
121
  onFreeTrial: boolean;
122
122
  freeTrialEndsOn?: string;
123
123
  nextBillingDate?: string;
124
124
  };
125
-
125
+
126
126
  /**
127
127
  * Previous plan (for changes)
128
128
  */
129
129
  previousMarketplacePurchase?: {
130
130
  account: MarketplaceAccount;
131
- billingCycle: "monthly" | "yearly";
131
+ billingCycle: 'monthly' | 'yearly';
132
132
  unitCount?: number;
133
133
  };
134
134
  }
@@ -138,42 +138,37 @@ export interface MarketplaceWebhookEvent {
138
138
  */
139
139
  export const MARKETPLACE_PLANS = {
140
140
  solo: {
141
- name: "Praxis Cloud Solo",
142
- description: "For individual developers",
141
+ name: 'Praxis Cloud Solo',
142
+ description: 'For individual developers',
143
143
  monthlyPriceInCents: 500, // $5/month
144
144
  yearlyPriceInCents: 5000, // $50/year (2 months free)
145
- features: [
146
- "50,000 syncs/month",
147
- "1 GB storage",
148
- "10 apps/projects",
149
- "Standard support",
150
- ],
145
+ features: ['50,000 syncs/month', '1 GB storage', '10 apps/projects', 'Standard support'],
151
146
  },
152
147
  team: {
153
- name: "Praxis Cloud Team",
154
- description: "For small teams",
148
+ name: 'Praxis Cloud Team',
149
+ description: 'For small teams',
155
150
  monthlyPriceInCents: 2000, // $20/month
156
151
  yearlyPriceInCents: 20000, // $200/year (2 months free)
157
152
  features: [
158
- "500,000 syncs/month",
159
- "10 GB storage",
160
- "50 apps/projects",
161
- "Up to 10 team members",
162
- "Standard support",
153
+ '500,000 syncs/month',
154
+ '10 GB storage',
155
+ '50 apps/projects',
156
+ 'Up to 10 team members',
157
+ 'Standard support',
163
158
  ],
164
159
  },
165
160
  enterprise: {
166
- name: "Praxis Cloud Enterprise",
167
- description: "For large teams and organizations",
161
+ name: 'Praxis Cloud Enterprise',
162
+ description: 'For large teams and organizations',
168
163
  monthlyPriceInCents: 5000, // $50/month
169
164
  yearlyPriceInCents: 50000, // $500/year (2 months free)
170
165
  features: [
171
- "5,000,000 syncs/month",
172
- "100 GB storage",
173
- "1,000 apps/projects",
174
- "Unlimited team members",
175
- "Priority support",
176
- "SLA guarantees",
166
+ '5,000,000 syncs/month',
167
+ '100 GB storage',
168
+ '1,000 apps/projects',
169
+ 'Unlimited team members',
170
+ 'Priority support',
171
+ 'SLA guarantees',
177
172
  ],
178
173
  },
179
174
  };
@@ -183,48 +178,45 @@ export const MARKETPLACE_PLANS = {
183
178
  */
184
179
  export class GitHubMarketplaceClient {
185
180
  private token: string;
186
-
181
+
187
182
  constructor(token: string) {
188
183
  this.token = token;
189
184
  }
190
-
185
+
191
186
  /**
192
187
  * Get accounts for the authenticated user
193
188
  */
194
189
  async getAccounts(): Promise<MarketplaceAccount[]> {
195
190
  try {
196
- const response = await fetch(
197
- "https://api.github.com/marketplace_listing/accounts",
198
- {
199
- headers: {
200
- Authorization: `Bearer ${this.token}`,
201
- Accept: "application/vnd.github.v3+json",
202
- },
203
- }
204
- );
205
-
191
+ const response = await fetch('https://api.github.com/marketplace_listing/accounts', {
192
+ headers: {
193
+ Authorization: `Bearer ${this.token}`,
194
+ Accept: 'application/vnd.github.v3+json',
195
+ },
196
+ });
197
+
206
198
  if (!response.ok) {
207
199
  throw new Error(`GitHub API error: ${response.statusText}`);
208
200
  }
209
-
210
- return await response.json() as MarketplaceAccount[];
201
+
202
+ return (await response.json()) as MarketplaceAccount[];
211
203
  } catch (error) {
212
- console.error("Failed to get marketplace accounts:", error);
204
+ console.error('Failed to get marketplace accounts:', error);
213
205
  return [];
214
206
  }
215
207
  }
216
-
208
+
217
209
  /**
218
210
  * Get subscription from marketplace account
219
211
  */
220
212
  async getSubscription(accountId: number): Promise<Subscription | null> {
221
213
  const accounts = await this.getAccounts();
222
214
  const account = accounts.find((a) => a.id === accountId);
223
-
215
+
224
216
  if (!account) {
225
217
  return null;
226
218
  }
227
-
219
+
228
220
  // Map plan to tier
229
221
  let tier = SubscriptionTier.FREE;
230
222
  if (account.plan.monthlyPriceInCents >= 5000) {
@@ -234,23 +226,22 @@ export class GitHubMarketplaceClient {
234
226
  } else if (account.plan.monthlyPriceInCents >= 500) {
235
227
  tier = SubscriptionTier.SOLO;
236
228
  }
237
-
229
+
238
230
  return {
239
231
  tier,
240
232
  status: SubscriptionStatus.ACTIVE,
241
233
  provider: BillingProvider.MARKETPLACE,
242
234
  marketplacePlanId: account.plan.id,
243
- startDate: account.onFreeTrial && account.freeTrialEndsOn
244
- ? new Date(account.freeTrialEndsOn).getTime()
245
- : Date.now(),
246
- periodEnd: account.nextBillingDate
247
- ? new Date(account.nextBillingDate).getTime()
248
- : undefined,
235
+ startDate:
236
+ account.onFreeTrial && account.freeTrialEndsOn
237
+ ? new Date(account.freeTrialEndsOn).getTime()
238
+ : Date.now(),
239
+ periodEnd: account.nextBillingDate ? new Date(account.nextBillingDate).getTime() : undefined,
249
240
  autoRenew: true,
250
241
  limits: TIER_LIMITS[tier],
251
242
  };
252
243
  }
253
-
244
+
254
245
  /**
255
246
  * Handle marketplace webhook event
256
247
  */
@@ -260,12 +251,12 @@ export class GitHubMarketplaceClient {
260
251
  subscription: Subscription;
261
252
  } | null {
262
253
  const account = event.marketplacePurchase.account;
263
-
264
- if (event.action === "cancelled") {
254
+
255
+ if (event.action === 'cancelled') {
265
256
  // Handle cancellation
266
257
  return null;
267
258
  }
268
-
259
+
269
260
  // Map plan to tier
270
261
  let tier = SubscriptionTier.FREE;
271
262
  if (account.plan.monthlyPriceInCents >= 5000) {
@@ -275,7 +266,7 @@ export class GitHubMarketplaceClient {
275
266
  } else if (account.plan.monthlyPriceInCents >= 500) {
276
267
  tier = SubscriptionTier.SOLO;
277
268
  }
278
-
269
+
279
270
  return {
280
271
  userId: account.id,
281
272
  userLogin: account.login,