@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.
- package/FRAMEWORK.md +55 -5
- package/LICENSE +21 -21
- package/README.md +162 -375
- package/core/codegen/docs-generator.ts +5 -2
- package/core/codegen/index.ts +1 -1
- package/core/codegen/ts-generator.ts +15 -15
- package/core/db-adapter/index.ts +2 -2
- package/core/db-adapter/sync-engine.ts +17 -6
- package/core/logic-engine/engine.ts +1 -1
- package/core/logic-engine/index.ts +2 -2
- package/core/logic-engine/protocol.ts +1 -1
- package/core/logic-engine/psf-adapter.ts +8 -4
- package/core/logic-engine/rules.ts +1 -1
- package/core/schema-engine/compiler.ts +53 -11
- package/core/schema-engine/generator.ts +17 -7
- package/core/schema-engine/index.ts +2 -2
- package/core/schema-engine/psf.ts +12 -3
- package/core/schema-engine/types.ts +3 -11
- package/core/schema-engine/validator.ts +112 -22
- package/dist/browser/engine-BjdqxeXG.d.ts +333 -0
- package/dist/browser/index.d.ts +3004 -0
- package/dist/browser/index.js +2892 -0
- package/dist/{src → browser}/integrations/svelte.d.ts +19 -17
- package/dist/browser/integrations/svelte.js +298 -0
- package/dist/node/auth-STARLY7I.js +207 -0
- package/dist/node/build-Y7OT5VBF.js +144 -0
- package/dist/node/canvas-UERZHJYW.js +362 -0
- package/dist/node/chunk-DSDC2JWZ.js +256 -0
- package/dist/node/chunk-FXQZXAWF.js +175 -0
- package/dist/node/chunk-N5Y37EUV.js +202 -0
- package/dist/node/chunk-QGM4M3NI.js +37 -0
- package/dist/node/chunk-RJMWCNHR.js +175 -0
- package/dist/node/chunk-SRM3OPPM.js +404 -0
- package/dist/node/chunk-UATVJBNV.js +175 -0
- package/dist/node/chunk-UY7YEBE2.js +159 -0
- package/dist/node/chunk-XCY2VIFX.js +143 -0
- package/dist/node/chunk-YXH4Y7ZZ.js +349 -0
- package/dist/node/cli/index.cjs +217418 -0
- package/dist/node/cli/index.d.cts +1 -0
- package/dist/node/cli/index.d.ts +1 -0
- package/dist/node/cli/index.js +690 -0
- package/dist/node/cloud/index.cjs +1043 -0
- package/dist/node/cloud/index.d.cts +864 -0
- package/dist/node/cloud/index.d.ts +864 -0
- package/dist/node/cloud/index.js +456 -0
- package/dist/node/cloud-AXOK4PSN.js +212 -0
- package/dist/node/component.cjs +374 -0
- package/dist/node/component.d.cts +125 -0
- package/dist/{src/core/component/generator.d.ts → node/component.d.ts} +11 -8
- package/dist/node/component.js +9 -0
- package/dist/node/components/index.cjs +216 -0
- package/dist/node/components/index.d.cts +43 -0
- package/dist/{src → node}/components/index.d.ts +8 -8
- package/dist/node/components/index.js +7 -0
- package/dist/node/create-TRLSVCNQ.js +584 -0
- package/dist/node/dev-PMJZUYGE.js +65 -0
- package/dist/node/engine-1iqLe6_P.d.ts +214 -0
- package/dist/node/engine-CVJobhHm.d.cts +214 -0
- package/dist/node/index.cjs +3247 -0
- package/dist/node/index.d.cts +2579 -0
- package/dist/node/index.d.ts +2579 -0
- package/dist/node/index.js +2098 -0
- package/dist/node/integrations/svelte.cjs +330 -0
- package/dist/node/integrations/svelte.d.cts +309 -0
- package/dist/node/integrations/svelte.d.ts +309 -0
- package/dist/node/integrations/svelte.js +300 -0
- package/dist/node/orchestrate-737TCL5H.js +127 -0
- package/dist/{src/core/protocol.d.ts → node/protocol-Qek7ebBl.d.cts} +11 -10
- package/dist/node/protocol-Qek7ebBl.d.ts +122 -0
- package/dist/node/schema.cjs +200 -0
- package/dist/{src/core/schema/types.d.ts → node/schema.d.cts} +30 -29
- package/dist/node/schema.d.ts +371 -0
- package/dist/node/schema.js +9 -0
- package/dist/{src/runtime/terminal-adapter.d.ts → node/terminal-adapter-07HGftGQ.d.ts} +86 -11
- package/dist/node/terminal-adapter-XLtCjjb_.d.cts +231 -0
- package/dist/node/verify-YBZ7W24H.js +213239 -0
- package/docs/MONETIZATION.md +21 -16
- package/docs/REACTIVE_REDESIGN.md +132 -0
- package/docs/README.md +47 -36
- package/docs/SVELTE_INTEGRATION_STRATEGY.md +68 -0
- package/docs/TERMINAL_NODE.md +27 -24
- package/docs/core/building-extensions.md +58 -61
- package/docs/core/cli-usage.md +59 -59
- package/docs/core/code-canvas-sync.md +28 -16
- package/docs/core/logic-engine.md +77 -82
- package/docs/core/pluresdb-integration.md +29 -39
- package/docs/core/schema-model.md +66 -52
- package/docs/core/ui-generation.md +57 -49
- package/docs/core/what-is-praxis.md +32 -15
- package/docs/guides/canvas.md +21 -5
- package/docs/guides/getting-started.md +13 -7
- package/docs/guides/history-state-pattern.md +65 -51
- package/docs/guides/orchestration.md +46 -32
- package/docs/guides/parallel-state-pattern.md +56 -72
- package/docs/guides/svelte-integration.md +45 -53
- package/docs/tutorials/README.md +16 -0
- package/docs/tutorials/ecommerce-cart.md +177 -95
- package/docs/tutorials/first-app.md +26 -41
- package/docs/tutorials/form-builder.md +191 -138
- package/docs/tutorials/todo-pluresdb.md +71 -69
- package/package.json +132 -97
- package/src/__tests__/actors.test.ts +68 -68
- package/src/__tests__/billing.test.ts +32 -32
- package/src/__tests__/canvas-components.test.ts +94 -73
- package/src/__tests__/cli-create.test.ts +28 -28
- package/src/__tests__/cloud.test.ts +36 -36
- package/src/__tests__/code-canvas-integration.test.ts +132 -141
- package/src/__tests__/docs-generator.test.ts +3 -9
- package/src/__tests__/dsl.test.ts +58 -64
- package/src/__tests__/edge-cases.test.ts +106 -108
- package/src/__tests__/engine.test.ts +51 -25
- package/src/__tests__/generators.test.ts +42 -44
- package/src/__tests__/introspection.test.ts +104 -114
- package/src/__tests__/pluresdb.test.ts +189 -187
- package/src/__tests__/protocol.test.ts +15 -15
- package/src/__tests__/provisioning.test.ts +61 -61
- package/src/__tests__/schema.test.ts +7 -11
- package/src/__tests__/state-docs-integration.test.ts +162 -145
- package/src/__tests__/svelte-integration.test.ts +16 -19
- package/src/__tests__/tauri-integration.test.ts +149 -147
- package/src/__tests__/terminal-node.test.ts +12 -7
- package/src/__tests__/unum-integration.test.ts +68 -68
- package/src/adapters/cli.ts +21 -15
- package/src/cli/commands/auth.ts +82 -78
- package/src/cli/commands/build.ts +29 -27
- package/src/cli/commands/canvas.ts +338 -127
- package/src/cli/commands/cloud.ts +47 -47
- package/src/cli/commands/create.ts +59 -47
- package/src/cli/commands/dev.ts +12 -12
- package/src/cli/commands/generate.ts +29 -40
- package/src/cli/commands/orchestrate.ts +24 -24
- package/src/cli/commands/verify.ts +7 -8
- package/src/cli/index.ts +14 -10
- package/src/cloud/README.md +28 -15
- package/src/cloud/auth.ts +55 -70
- package/src/cloud/billing.ts +59 -58
- package/src/cloud/client.ts +29 -35
- package/src/cloud/index.ts +19 -40
- package/src/cloud/marketplace.ts +69 -78
- package/src/cloud/provisioning.ts +42 -51
- package/src/cloud/relay/endpoints.ts +30 -34
- package/src/cloud/relay/health/index.ts +1 -1
- package/src/cloud/relay/stats/index.ts +1 -1
- package/src/cloud/relay/sync/index.ts +1 -1
- package/src/cloud/relay/usage/index.ts +1 -1
- package/src/cloud/sponsors.ts +31 -34
- package/src/cloud/types.ts +4 -4
- package/src/components/README.md +1 -0
- package/src/components/TerminalNode.svelte +457 -457
- package/src/components/index.ts +3 -4
- package/src/core/actors.ts +7 -7
- package/src/core/component/generator.ts +10 -28
- package/src/core/engine.ts +51 -24
- package/src/core/introspection.ts +37 -35
- package/src/core/logic/generator.ts +62 -62
- package/src/core/pluresdb/adapter.ts +8 -8
- package/src/core/pluresdb/generator.ts +39 -35
- package/src/core/pluresdb/index.ts +9 -12
- package/src/core/pluresdb/schema-registry.ts +22 -25
- package/src/core/pluresdb/store.ts +57 -57
- package/src/core/protocol.ts +14 -14
- package/src/core/reactive-engine.svelte.ts +65 -0
- package/src/core/reactive-engine.ts +67 -0
- package/src/core/rules.ts +4 -4
- package/src/core/schema/loader.common.ts +150 -0
- package/src/core/schema/loader.ts +19 -149
- package/src/core/schema/normalize.ts +34 -51
- package/src/core/schema/types.ts +47 -11
- package/src/dsl/index.ts +8 -8
- package/src/dsl.ts +11 -17
- package/src/examples/advanced-todo/App.svelte +506 -506
- package/src/examples/advanced-todo/README.md +58 -40
- package/src/examples/advanced-todo/index.ts +3 -3
- package/src/examples/auth-basic/index.ts +30 -30
- package/src/examples/cart/index.ts +50 -50
- package/src/examples/hero-ecommerce/index.ts +130 -157
- package/src/examples/svelte-counter/index.ts +22 -26
- package/src/flows.ts +6 -17
- package/src/index.browser.ts +204 -0
- package/src/index.ts +37 -42
- package/src/integrations/code-canvas.ts +237 -193
- package/src/integrations/pluresdb.ts +55 -35
- package/src/integrations/state-docs.ts +104 -104
- package/src/integrations/svelte.ts +35 -35
- package/src/integrations/tauri.ts +75 -73
- package/src/integrations/unum.ts +68 -61
- package/src/registry.ts +7 -14
- package/src/runtime/terminal-adapter.ts +31 -26
- package/src/step.ts +10 -16
- package/src/types.ts +1 -1
- package/templates/basic-app/README.md +6 -9
- package/templates/fullstack-app/README.md +10 -0
- package/dist/core/codegen/docs-generator.d.ts +0 -123
- package/dist/core/codegen/docs-generator.d.ts.map +0 -1
- package/dist/core/codegen/docs-generator.js +0 -674
- package/dist/core/codegen/docs-generator.js.map +0 -1
- package/dist/core/codegen/index.d.ts +0 -11
- package/dist/core/codegen/index.d.ts.map +0 -1
- package/dist/core/codegen/index.js +0 -13
- package/dist/core/codegen/index.js.map +0 -1
- package/dist/core/codegen/ts-generator.d.ts +0 -8
- package/dist/core/codegen/ts-generator.d.ts.map +0 -1
- package/dist/core/codegen/ts-generator.js +0 -8
- package/dist/core/codegen/ts-generator.js.map +0 -1
- package/dist/core/db-adapter/index.d.ts +0 -18
- package/dist/core/db-adapter/index.d.ts.map +0 -1
- package/dist/core/db-adapter/index.js +0 -23
- package/dist/core/db-adapter/index.js.map +0 -1
- package/dist/core/db-adapter/sync-engine.d.ts +0 -180
- package/dist/core/db-adapter/sync-engine.d.ts.map +0 -1
- package/dist/core/db-adapter/sync-engine.js +0 -342
- package/dist/core/db-adapter/sync-engine.js.map +0 -1
- package/dist/core/logic-engine/engine.d.ts +0 -8
- package/dist/core/logic-engine/engine.d.ts.map +0 -1
- package/dist/core/logic-engine/engine.js +0 -8
- package/dist/core/logic-engine/engine.js.map +0 -1
- package/dist/core/logic-engine/index.d.ts +0 -16
- package/dist/core/logic-engine/index.d.ts.map +0 -1
- package/dist/core/logic-engine/index.js +0 -16
- package/dist/core/logic-engine/index.js.map +0 -1
- package/dist/core/logic-engine/protocol.d.ts +0 -7
- package/dist/core/logic-engine/protocol.d.ts.map +0 -1
- package/dist/core/logic-engine/protocol.js +0 -7
- package/dist/core/logic-engine/protocol.js.map +0 -1
- package/dist/core/logic-engine/psf-adapter.d.ts +0 -88
- package/dist/core/logic-engine/psf-adapter.d.ts.map +0 -1
- package/dist/core/logic-engine/psf-adapter.js +0 -207
- package/dist/core/logic-engine/psf-adapter.js.map +0 -1
- package/dist/core/logic-engine/rules.d.ts +0 -7
- package/dist/core/logic-engine/rules.d.ts.map +0 -1
- package/dist/core/logic-engine/rules.js +0 -7
- package/dist/core/logic-engine/rules.js.map +0 -1
- package/dist/core/schema-engine/compiler.d.ts +0 -198
- package/dist/core/schema-engine/compiler.d.ts.map +0 -1
- package/dist/core/schema-engine/compiler.js +0 -262
- package/dist/core/schema-engine/compiler.js.map +0 -1
- package/dist/core/schema-engine/generator.d.ts +0 -115
- package/dist/core/schema-engine/generator.d.ts.map +0 -1
- package/dist/core/schema-engine/generator.js +0 -506
- package/dist/core/schema-engine/generator.js.map +0 -1
- package/dist/core/schema-engine/index.d.ts +0 -18
- package/dist/core/schema-engine/index.d.ts.map +0 -1
- package/dist/core/schema-engine/index.js +0 -18
- package/dist/core/schema-engine/index.js.map +0 -1
- package/dist/core/schema-engine/psf.d.ts +0 -612
- package/dist/core/schema-engine/psf.d.ts.map +0 -1
- package/dist/core/schema-engine/psf.js +0 -45
- package/dist/core/schema-engine/psf.js.map +0 -1
- package/dist/core/schema-engine/types.d.ts +0 -10
- package/dist/core/schema-engine/types.d.ts.map +0 -1
- package/dist/core/schema-engine/types.js +0 -7
- package/dist/core/schema-engine/types.js.map +0 -1
- package/dist/core/schema-engine/validator.d.ts +0 -140
- package/dist/core/schema-engine/validator.d.ts.map +0 -1
- package/dist/core/schema-engine/validator.js +0 -407
- package/dist/core/schema-engine/validator.js.map +0 -1
- package/dist/src/adapters/cli.d.ts +0 -43
- package/dist/src/adapters/cli.d.ts.map +0 -1
- package/dist/src/adapters/cli.js +0 -126
- package/dist/src/adapters/cli.js.map +0 -1
- package/dist/src/cli/commands/auth.d.ts +0 -26
- package/dist/src/cli/commands/auth.d.ts.map +0 -1
- package/dist/src/cli/commands/auth.js +0 -233
- package/dist/src/cli/commands/auth.js.map +0 -1
- package/dist/src/cli/commands/build.d.ts +0 -23
- package/dist/src/cli/commands/build.d.ts.map +0 -1
- package/dist/src/cli/commands/build.js +0 -162
- package/dist/src/cli/commands/build.js.map +0 -1
- package/dist/src/cli/commands/canvas.d.ts +0 -23
- package/dist/src/cli/commands/canvas.d.ts.map +0 -1
- package/dist/src/cli/commands/canvas.js +0 -215
- package/dist/src/cli/commands/canvas.js.map +0 -1
- package/dist/src/cli/commands/cloud.d.ts +0 -27
- package/dist/src/cli/commands/cloud.d.ts.map +0 -1
- package/dist/src/cli/commands/cloud.js +0 -232
- package/dist/src/cli/commands/cloud.js.map +0 -1
- package/dist/src/cli/commands/create.d.ts +0 -21
- package/dist/src/cli/commands/create.d.ts.map +0 -1
- package/dist/src/cli/commands/create.js +0 -621
- package/dist/src/cli/commands/create.js.map +0 -1
- package/dist/src/cli/commands/dev.d.ts +0 -21
- package/dist/src/cli/commands/dev.d.ts.map +0 -1
- package/dist/src/cli/commands/dev.js +0 -71
- package/dist/src/cli/commands/dev.js.map +0 -1
- package/dist/src/cli/commands/generate.d.ts +0 -25
- package/dist/src/cli/commands/generate.d.ts.map +0 -1
- package/dist/src/cli/commands/generate.js +0 -168
- package/dist/src/cli/commands/generate.js.map +0 -1
- package/dist/src/cli/commands/orchestrate.d.ts +0 -44
- package/dist/src/cli/commands/orchestrate.d.ts.map +0 -1
- package/dist/src/cli/commands/orchestrate.js +0 -150
- package/dist/src/cli/commands/orchestrate.js.map +0 -1
- package/dist/src/cli/commands/verify.d.ts +0 -10
- package/dist/src/cli/commands/verify.d.ts.map +0 -1
- package/dist/src/cli/commands/verify.js +0 -39
- package/dist/src/cli/commands/verify.js.map +0 -1
- package/dist/src/cli/index.d.ts +0 -8
- package/dist/src/cli/index.d.ts.map +0 -1
- package/dist/src/cli/index.js +0 -226
- package/dist/src/cli/index.js.map +0 -1
- package/dist/src/cloud/auth.d.ts +0 -51
- package/dist/src/cloud/auth.d.ts.map +0 -1
- package/dist/src/cloud/auth.js +0 -194
- package/dist/src/cloud/auth.js.map +0 -1
- package/dist/src/cloud/billing.d.ts +0 -184
- package/dist/src/cloud/billing.d.ts.map +0 -1
- package/dist/src/cloud/billing.js +0 -179
- package/dist/src/cloud/billing.js.map +0 -1
- package/dist/src/cloud/client.d.ts +0 -39
- package/dist/src/cloud/client.d.ts.map +0 -1
- package/dist/src/cloud/client.js +0 -176
- package/dist/src/cloud/client.js.map +0 -1
- package/dist/src/cloud/index.d.ts +0 -44
- package/dist/src/cloud/index.d.ts.map +0 -1
- package/dist/src/cloud/index.js +0 -44
- package/dist/src/cloud/index.js.map +0 -1
- package/dist/src/cloud/marketplace.d.ts +0 -166
- package/dist/src/cloud/marketplace.d.ts.map +0 -1
- package/dist/src/cloud/marketplace.js +0 -159
- package/dist/src/cloud/marketplace.js.map +0 -1
- package/dist/src/cloud/provisioning.d.ts +0 -110
- package/dist/src/cloud/provisioning.d.ts.map +0 -1
- package/dist/src/cloud/provisioning.js +0 -148
- package/dist/src/cloud/provisioning.js.map +0 -1
- package/dist/src/cloud/relay/endpoints.d.ts +0 -62
- package/dist/src/cloud/relay/endpoints.d.ts.map +0 -1
- package/dist/src/cloud/relay/endpoints.js +0 -217
- package/dist/src/cloud/relay/endpoints.js.map +0 -1
- package/dist/src/cloud/relay/health/index.d.ts +0 -5
- package/dist/src/cloud/relay/health/index.d.ts.map +0 -1
- package/dist/src/cloud/relay/health/index.js +0 -9
- package/dist/src/cloud/relay/health/index.js.map +0 -1
- package/dist/src/cloud/relay/stats/index.d.ts +0 -5
- package/dist/src/cloud/relay/stats/index.d.ts.map +0 -1
- package/dist/src/cloud/relay/stats/index.js +0 -9
- package/dist/src/cloud/relay/stats/index.js.map +0 -1
- package/dist/src/cloud/relay/sync/index.d.ts +0 -5
- package/dist/src/cloud/relay/sync/index.d.ts.map +0 -1
- package/dist/src/cloud/relay/sync/index.js +0 -9
- package/dist/src/cloud/relay/sync/index.js.map +0 -1
- package/dist/src/cloud/relay/usage/index.d.ts +0 -5
- package/dist/src/cloud/relay/usage/index.d.ts.map +0 -1
- package/dist/src/cloud/relay/usage/index.js +0 -9
- package/dist/src/cloud/relay/usage/index.js.map +0 -1
- package/dist/src/cloud/sponsors.d.ts +0 -81
- package/dist/src/cloud/sponsors.d.ts.map +0 -1
- package/dist/src/cloud/sponsors.js +0 -130
- package/dist/src/cloud/sponsors.js.map +0 -1
- package/dist/src/cloud/types.d.ts +0 -169
- package/dist/src/cloud/types.d.ts.map +0 -1
- package/dist/src/cloud/types.js +0 -7
- package/dist/src/cloud/types.js.map +0 -1
- package/dist/src/components/index.d.ts.map +0 -1
- package/dist/src/components/index.js +0 -17
- package/dist/src/components/index.js.map +0 -1
- package/dist/src/core/actors.d.ts +0 -95
- package/dist/src/core/actors.d.ts.map +0 -1
- package/dist/src/core/actors.js +0 -158
- package/dist/src/core/actors.js.map +0 -1
- package/dist/src/core/component/generator.d.ts.map +0 -1
- package/dist/src/core/component/generator.js +0 -349
- package/dist/src/core/component/generator.js.map +0 -1
- package/dist/src/core/engine.d.ts +0 -92
- package/dist/src/core/engine.d.ts.map +0 -1
- package/dist/src/core/engine.js +0 -199
- package/dist/src/core/engine.js.map +0 -1
- package/dist/src/core/introspection.d.ts +0 -141
- package/dist/src/core/introspection.d.ts.map +0 -1
- package/dist/src/core/introspection.js +0 -208
- package/dist/src/core/introspection.js.map +0 -1
- package/dist/src/core/logic/generator.d.ts +0 -76
- package/dist/src/core/logic/generator.d.ts.map +0 -1
- package/dist/src/core/logic/generator.js +0 -370
- package/dist/src/core/logic/generator.js.map +0 -1
- package/dist/src/core/pluresdb/adapter.d.ts +0 -72
- package/dist/src/core/pluresdb/adapter.d.ts.map +0 -1
- package/dist/src/core/pluresdb/adapter.js +0 -73
- package/dist/src/core/pluresdb/adapter.js.map +0 -1
- package/dist/src/core/pluresdb/generator.d.ts +0 -58
- package/dist/src/core/pluresdb/generator.d.ts.map +0 -1
- package/dist/src/core/pluresdb/generator.js +0 -191
- package/dist/src/core/pluresdb/generator.js.map +0 -1
- package/dist/src/core/pluresdb/index.d.ts +0 -15
- package/dist/src/core/pluresdb/index.d.ts.map +0 -1
- package/dist/src/core/pluresdb/index.js +0 -11
- package/dist/src/core/pluresdb/index.js.map +0 -1
- package/dist/src/core/pluresdb/schema-registry.d.ts +0 -104
- package/dist/src/core/pluresdb/schema-registry.d.ts.map +0 -1
- package/dist/src/core/pluresdb/schema-registry.js +0 -130
- package/dist/src/core/pluresdb/schema-registry.js.map +0 -1
- package/dist/src/core/pluresdb/store.d.ts +0 -199
- package/dist/src/core/pluresdb/store.d.ts.map +0 -1
- package/dist/src/core/pluresdb/store.js +0 -344
- package/dist/src/core/pluresdb/store.js.map +0 -1
- package/dist/src/core/protocol.d.ts.map +0 -1
- package/dist/src/core/protocol.js +0 -46
- package/dist/src/core/protocol.js.map +0 -1
- package/dist/src/core/rules.d.ts +0 -120
- package/dist/src/core/rules.d.ts.map +0 -1
- package/dist/src/core/rules.js +0 -81
- package/dist/src/core/rules.js.map +0 -1
- package/dist/src/core/schema/loader.d.ts +0 -47
- package/dist/src/core/schema/loader.d.ts.map +0 -1
- package/dist/src/core/schema/loader.js +0 -189
- package/dist/src/core/schema/loader.js.map +0 -1
- package/dist/src/core/schema/normalize.d.ts +0 -72
- package/dist/src/core/schema/normalize.d.ts.map +0 -1
- package/dist/src/core/schema/normalize.js +0 -190
- package/dist/src/core/schema/normalize.js.map +0 -1
- package/dist/src/core/schema/types.d.ts.map +0 -1
- package/dist/src/core/schema/types.js +0 -161
- package/dist/src/core/schema/types.js.map +0 -1
- package/dist/src/dsl/index.d.ts +0 -152
- package/dist/src/dsl/index.d.ts.map +0 -1
- package/dist/src/dsl/index.js +0 -132
- package/dist/src/dsl/index.js.map +0 -1
- package/dist/src/dsl.d.ts +0 -124
- package/dist/src/dsl.d.ts.map +0 -1
- package/dist/src/dsl.js +0 -130
- package/dist/src/dsl.js.map +0 -1
- package/dist/src/examples/advanced-todo/index.d.ts +0 -55
- package/dist/src/examples/advanced-todo/index.d.ts.map +0 -1
- package/dist/src/examples/advanced-todo/index.js +0 -222
- package/dist/src/examples/advanced-todo/index.js.map +0 -1
- package/dist/src/examples/auth-basic/index.d.ts +0 -17
- package/dist/src/examples/auth-basic/index.d.ts.map +0 -1
- package/dist/src/examples/auth-basic/index.js +0 -122
- package/dist/src/examples/auth-basic/index.js.map +0 -1
- package/dist/src/examples/cart/index.d.ts +0 -19
- package/dist/src/examples/cart/index.d.ts.map +0 -1
- package/dist/src/examples/cart/index.js +0 -202
- package/dist/src/examples/cart/index.js.map +0 -1
- package/dist/src/examples/hero-ecommerce/index.d.ts +0 -39
- package/dist/src/examples/hero-ecommerce/index.d.ts.map +0 -1
- package/dist/src/examples/hero-ecommerce/index.js +0 -506
- package/dist/src/examples/hero-ecommerce/index.js.map +0 -1
- package/dist/src/examples/svelte-counter/index.d.ts +0 -31
- package/dist/src/examples/svelte-counter/index.d.ts.map +0 -1
- package/dist/src/examples/svelte-counter/index.js +0 -123
- package/dist/src/examples/svelte-counter/index.js.map +0 -1
- package/dist/src/flows.d.ts +0 -125
- package/dist/src/flows.d.ts.map +0 -1
- package/dist/src/flows.js +0 -160
- package/dist/src/flows.js.map +0 -1
- package/dist/src/index.d.ts +0 -77
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -64
- package/dist/src/index.js.map +0 -1
- package/dist/src/integrations/code-canvas.d.ts +0 -265
- package/dist/src/integrations/code-canvas.d.ts.map +0 -1
- package/dist/src/integrations/code-canvas.js +0 -451
- package/dist/src/integrations/code-canvas.js.map +0 -1
- package/dist/src/integrations/pluresdb.d.ts +0 -117
- package/dist/src/integrations/pluresdb.d.ts.map +0 -1
- package/dist/src/integrations/pluresdb.js +0 -117
- package/dist/src/integrations/pluresdb.js.map +0 -1
- package/dist/src/integrations/state-docs.d.ts +0 -191
- package/dist/src/integrations/state-docs.d.ts.map +0 -1
- package/dist/src/integrations/state-docs.js +0 -515
- package/dist/src/integrations/state-docs.js.map +0 -1
- package/dist/src/integrations/svelte.d.ts.map +0 -1
- package/dist/src/integrations/svelte.js +0 -447
- package/dist/src/integrations/svelte.js.map +0 -1
- package/dist/src/integrations/tauri.d.ts +0 -360
- package/dist/src/integrations/tauri.d.ts.map +0 -1
- package/dist/src/integrations/tauri.js +0 -278
- package/dist/src/integrations/tauri.js.map +0 -1
- package/dist/src/integrations/unum.d.ts +0 -159
- package/dist/src/integrations/unum.d.ts.map +0 -1
- package/dist/src/integrations/unum.js +0 -240
- package/dist/src/integrations/unum.js.map +0 -1
- package/dist/src/registry.d.ts +0 -94
- package/dist/src/registry.d.ts.map +0 -1
- package/dist/src/registry.js +0 -181
- package/dist/src/registry.js.map +0 -1
- package/dist/src/runtime/terminal-adapter.d.ts.map +0 -1
- package/dist/src/runtime/terminal-adapter.js +0 -239
- package/dist/src/runtime/terminal-adapter.js.map +0 -1
- package/dist/src/step.d.ts +0 -34
- package/dist/src/step.d.ts.map +0 -1
- package/dist/src/step.js +0 -111
- package/dist/src/step.js.map +0 -1
- package/dist/src/types.d.ts +0 -63
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -6
- package/dist/src/types.js.map +0 -1
- package/dist/tools/ast-analyzer/src/ast-analyzer.d.ts +0 -8
- package/dist/tools/ast-analyzer/src/ast-analyzer.d.ts.map +0 -1
- package/dist/tools/ast-analyzer/src/ast-analyzer.js +0 -119
- package/dist/tools/ast-analyzer/src/ast-analyzer.js.map +0 -1
- package/dist/tools/cli/commands/index.d.ts +0 -7
- package/dist/tools/cli/commands/index.d.ts.map +0 -1
- package/dist/tools/cli/commands/index.js +0 -7
- package/dist/tools/cli/commands/index.js.map +0 -1
- package/dist/tools/cli/index.d.ts +0 -8
- package/dist/tools/cli/index.d.ts.map +0 -1
- package/dist/tools/cli/index.js +0 -9
- package/dist/tools/cli/index.js.map +0 -1
- package/dist/tools/watcher/index.d.ts +0 -105
- package/dist/tools/watcher/index.d.ts.map +0 -1
- package/dist/tools/watcher/index.js +0 -213
- package/dist/tools/watcher/index.js.map +0 -1
- package/dist/ui/canvas/canvas-projection.d.ts +0 -78
- package/dist/ui/canvas/canvas-projection.d.ts.map +0 -1
- package/dist/ui/canvas/canvas-projection.js +0 -416
- package/dist/ui/canvas/canvas-projection.js.map +0 -1
- package/dist/ui/canvas/canvas-state.d.ts +0 -200
- package/dist/ui/canvas/canvas-state.d.ts.map +0 -1
- package/dist/ui/canvas/canvas-state.js +0 -464
- package/dist/ui/canvas/canvas-state.js.map +0 -1
- package/dist/ui/canvas/components/index.d.ts +0 -95
- package/dist/ui/canvas/components/index.d.ts.map +0 -1
- package/dist/ui/canvas/components/index.js +0 -19
- package/dist/ui/canvas/components/index.js.map +0 -1
- package/dist/ui/canvas/index.d.ts +0 -32
- package/dist/ui/canvas/index.d.ts.map +0 -1
- package/dist/ui/canvas/index.js +0 -32
- package/dist/ui/canvas/index.js.map +0 -1
- package/dist/ui/canvas-inspector/src/server.d.ts +0 -2
- package/dist/ui/canvas-inspector/src/server.d.ts.map +0 -1
- package/dist/ui/canvas-inspector/src/server.js +0 -248
- package/dist/ui/canvas-inspector/src/server.js.map +0 -1
- package/dist/ui/canvas-inspector/src/verify-fsm-implementation.d.ts +0 -5
- package/dist/ui/canvas-inspector/src/verify-fsm-implementation.d.ts.map +0 -1
- package/dist/ui/canvas-inspector/src/verify-fsm-implementation.js +0 -58
- package/dist/ui/canvas-inspector/src/verify-fsm-implementation.js.map +0 -1
- package/dist/ui/svelte-generator/index.d.ts +0 -9
- package/dist/ui/svelte-generator/index.d.ts.map +0 -1
- package/dist/ui/svelte-generator/index.js +0 -11
- package/dist/ui/svelte-generator/index.js.map +0 -1
- package/dist/ui/svelte-generator/psf-generator.d.ts +0 -128
- package/dist/ui/svelte-generator/psf-generator.d.ts.map +0 -1
- package/dist/ui/svelte-generator/psf-generator.js +0 -506
- package/dist/ui/svelte-generator/psf-generator.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auto-Provisioning
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Automatic tenant/storage provisioning based on GitHub identity.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { GitHubUser } from
|
|
8
|
-
import type { Subscription } from
|
|
7
|
+
import type { GitHubUser } from './types.js';
|
|
8
|
+
import type { Subscription } from './billing.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Tenant information
|
|
@@ -15,37 +15,37 @@ export interface Tenant {
|
|
|
15
15
|
* Tenant ID (derived from GitHub user/org)
|
|
16
16
|
*/
|
|
17
17
|
id: string;
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
/**
|
|
20
20
|
* GitHub user ID
|
|
21
21
|
*/
|
|
22
22
|
githubUserId: number;
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
/**
|
|
25
25
|
* GitHub login (username or org name)
|
|
26
26
|
*/
|
|
27
27
|
githubLogin: string;
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
/**
|
|
30
30
|
* Tenant type
|
|
31
31
|
*/
|
|
32
|
-
type:
|
|
33
|
-
|
|
32
|
+
type: 'user' | 'organization';
|
|
33
|
+
|
|
34
34
|
/**
|
|
35
35
|
* Subscription
|
|
36
36
|
*/
|
|
37
37
|
subscription: Subscription;
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
/**
|
|
40
40
|
* Storage namespace
|
|
41
41
|
*/
|
|
42
42
|
storageNamespace: string;
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
/**
|
|
45
45
|
* Creation timestamp
|
|
46
46
|
*/
|
|
47
47
|
createdAt: number;
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
/**
|
|
50
50
|
* Last accessed timestamp
|
|
51
51
|
*/
|
|
@@ -54,17 +54,17 @@ export interface Tenant {
|
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* Generate a storage namespace from GitHub login
|
|
57
|
-
*
|
|
57
|
+
*
|
|
58
58
|
* Namespace format: gh-{login}-{hash}
|
|
59
59
|
* This ensures uniqueness and follows Azure Blob Storage naming rules.
|
|
60
60
|
*/
|
|
61
61
|
export function generateStorageNamespace(githubLogin: string, userId: number): string {
|
|
62
62
|
// Sanitize login: lowercase, replace non-alphanumeric with hyphens
|
|
63
|
-
const sanitized = githubLogin.toLowerCase().replace(/[^a-z0-9]/g,
|
|
64
|
-
|
|
63
|
+
const sanitized = githubLogin.toLowerCase().replace(/[^a-z0-9]/g, '-');
|
|
64
|
+
|
|
65
65
|
// Create a simple hash from user ID for uniqueness
|
|
66
|
-
const hash = userId.toString(36).padStart(6,
|
|
67
|
-
|
|
66
|
+
const hash = userId.toString(36).padStart(6, '0');
|
|
67
|
+
|
|
68
68
|
// Combine with prefix
|
|
69
69
|
return `gh-${sanitized}-${hash}`;
|
|
70
70
|
}
|
|
@@ -79,21 +79,15 @@ export function generateTenantId(githubUser: GitHubUser): string {
|
|
|
79
79
|
/**
|
|
80
80
|
* Create a tenant from GitHub user
|
|
81
81
|
*/
|
|
82
|
-
export function createTenant(
|
|
83
|
-
githubUser: GitHubUser,
|
|
84
|
-
subscription: Subscription
|
|
85
|
-
): Tenant {
|
|
82
|
+
export function createTenant(githubUser: GitHubUser, subscription: Subscription): Tenant {
|
|
86
83
|
const tenantId = generateTenantId(githubUser);
|
|
87
|
-
const storageNamespace = generateStorageNamespace(
|
|
88
|
-
|
|
89
|
-
githubUser.id
|
|
90
|
-
);
|
|
91
|
-
|
|
84
|
+
const storageNamespace = generateStorageNamespace(githubUser.login, githubUser.id);
|
|
85
|
+
|
|
92
86
|
return {
|
|
93
87
|
id: tenantId,
|
|
94
88
|
githubUserId: githubUser.id,
|
|
95
89
|
githubLogin: githubUser.login,
|
|
96
|
-
type:
|
|
90
|
+
type: 'user', // Could be "organization" if checking org membership
|
|
97
91
|
subscription,
|
|
98
92
|
storageNamespace,
|
|
99
93
|
createdAt: Date.now(),
|
|
@@ -103,7 +97,7 @@ export function createTenant(
|
|
|
103
97
|
|
|
104
98
|
/**
|
|
105
99
|
* Validate storage namespace
|
|
106
|
-
*
|
|
100
|
+
*
|
|
107
101
|
* Ensures namespace follows Azure Blob Storage naming rules:
|
|
108
102
|
* - 3-63 characters
|
|
109
103
|
* - lowercase letters, numbers, and hyphens only
|
|
@@ -117,43 +111,40 @@ export function validateStorageNamespace(namespace: string): {
|
|
|
117
111
|
if (namespace.length < 3 || namespace.length > 63) {
|
|
118
112
|
return {
|
|
119
113
|
valid: false,
|
|
120
|
-
error:
|
|
114
|
+
error: 'Namespace must be 3-63 characters',
|
|
121
115
|
};
|
|
122
116
|
}
|
|
123
|
-
|
|
117
|
+
|
|
124
118
|
if (!/^[a-z0-9]/.test(namespace)) {
|
|
125
119
|
return {
|
|
126
120
|
valid: false,
|
|
127
|
-
error:
|
|
121
|
+
error: 'Namespace must start with a letter or number',
|
|
128
122
|
};
|
|
129
123
|
}
|
|
130
|
-
|
|
124
|
+
|
|
131
125
|
if (!/^[a-z0-9-]+$/.test(namespace)) {
|
|
132
126
|
return {
|
|
133
127
|
valid: false,
|
|
134
|
-
error:
|
|
128
|
+
error: 'Namespace can only contain lowercase letters, numbers, and hyphens',
|
|
135
129
|
};
|
|
136
130
|
}
|
|
137
|
-
|
|
131
|
+
|
|
138
132
|
if (/--/.test(namespace)) {
|
|
139
133
|
return {
|
|
140
134
|
valid: false,
|
|
141
|
-
error:
|
|
135
|
+
error: 'Namespace cannot contain consecutive hyphens',
|
|
142
136
|
};
|
|
143
137
|
}
|
|
144
|
-
|
|
138
|
+
|
|
145
139
|
return { valid: true };
|
|
146
140
|
}
|
|
147
141
|
|
|
148
142
|
/**
|
|
149
143
|
* Get storage container name for an app
|
|
150
144
|
*/
|
|
151
|
-
export function getAppStorageContainer(
|
|
152
|
-
tenantNamespace: string,
|
|
153
|
-
appId: string
|
|
154
|
-
): string {
|
|
145
|
+
export function getAppStorageContainer(tenantNamespace: string, appId: string): string {
|
|
155
146
|
// Sanitize app ID
|
|
156
|
-
const sanitizedAppId = appId.toLowerCase().replace(/[^a-z0-9]/g,
|
|
147
|
+
const sanitizedAppId = appId.toLowerCase().replace(/[^a-z0-9]/g, '-');
|
|
157
148
|
return `${tenantNamespace}-${sanitizedAppId}`;
|
|
158
149
|
}
|
|
159
150
|
|
|
@@ -165,12 +156,12 @@ export interface ProvisioningResult {
|
|
|
165
156
|
* Whether provisioning was successful
|
|
166
157
|
*/
|
|
167
158
|
success: boolean;
|
|
168
|
-
|
|
159
|
+
|
|
169
160
|
/**
|
|
170
161
|
* Tenant (if successful)
|
|
171
162
|
*/
|
|
172
163
|
tenant?: Tenant;
|
|
173
|
-
|
|
164
|
+
|
|
174
165
|
/**
|
|
175
166
|
* Error message (if failed)
|
|
176
167
|
*/
|
|
@@ -179,7 +170,7 @@ export interface ProvisioningResult {
|
|
|
179
170
|
|
|
180
171
|
/**
|
|
181
172
|
* Provision a new tenant
|
|
182
|
-
*
|
|
173
|
+
*
|
|
183
174
|
* This would typically:
|
|
184
175
|
* 1. Create storage containers
|
|
185
176
|
* 2. Set up access policies
|
|
@@ -192,7 +183,7 @@ export async function provisionTenant(
|
|
|
192
183
|
): Promise<ProvisioningResult> {
|
|
193
184
|
try {
|
|
194
185
|
const tenant = createTenant(githubUser, subscription);
|
|
195
|
-
|
|
186
|
+
|
|
196
187
|
// Validate storage namespace
|
|
197
188
|
const validation = validateStorageNamespace(tenant.storageNamespace);
|
|
198
189
|
if (!validation.valid) {
|
|
@@ -201,17 +192,17 @@ export async function provisionTenant(
|
|
|
201
192
|
error: validation.error,
|
|
202
193
|
};
|
|
203
194
|
}
|
|
204
|
-
|
|
195
|
+
|
|
205
196
|
// TODO: In production, this would:
|
|
206
197
|
// 1. Create Azure Blob Storage container
|
|
207
198
|
// 2. Set up access policies
|
|
208
199
|
// 3. Store tenant metadata in database
|
|
209
200
|
// 4. Send welcome email
|
|
210
201
|
// 5. Log provisioning event
|
|
211
|
-
|
|
202
|
+
|
|
212
203
|
console.log(`Provisioned tenant: ${tenant.id}`);
|
|
213
204
|
console.log(`Storage namespace: ${tenant.storageNamespace}`);
|
|
214
|
-
|
|
205
|
+
|
|
215
206
|
return {
|
|
216
207
|
success: true,
|
|
217
208
|
tenant,
|
|
@@ -226,7 +217,7 @@ export async function provisionTenant(
|
|
|
226
217
|
|
|
227
218
|
/**
|
|
228
219
|
* Get or create tenant
|
|
229
|
-
*
|
|
220
|
+
*
|
|
230
221
|
* Checks if tenant exists, creates if not.
|
|
231
222
|
*/
|
|
232
223
|
export async function getOrCreateTenant(
|
|
@@ -235,7 +226,7 @@ export async function getOrCreateTenant(
|
|
|
235
226
|
tenantLookup: (id: string) => Promise<Tenant | null>
|
|
236
227
|
): Promise<Tenant> {
|
|
237
228
|
const tenantId = generateTenantId(githubUser);
|
|
238
|
-
|
|
229
|
+
|
|
239
230
|
// Try to get existing tenant
|
|
240
231
|
const existing = await tenantLookup(tenantId);
|
|
241
232
|
if (existing) {
|
|
@@ -243,12 +234,12 @@ export async function getOrCreateTenant(
|
|
|
243
234
|
existing.lastAccessedAt = Date.now();
|
|
244
235
|
return existing;
|
|
245
236
|
}
|
|
246
|
-
|
|
237
|
+
|
|
247
238
|
// Provision new tenant
|
|
248
239
|
const result = await provisionTenant(githubUser, subscription);
|
|
249
240
|
if (!result.success || !result.tenant) {
|
|
250
241
|
throw new Error(`Failed to provision tenant: ${result.error}`);
|
|
251
242
|
}
|
|
252
|
-
|
|
243
|
+
|
|
253
244
|
return result.tenant;
|
|
254
245
|
}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Azure Functions Relay Endpoints
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* HTTP-triggered Azure Functions for Praxis Cloud Relay.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type {
|
|
8
|
-
CRDTSyncMessage,
|
|
9
|
-
UsageMetrics,
|
|
10
|
-
HealthCheckResponse,
|
|
11
|
-
} from "../types.js";
|
|
7
|
+
import type { CRDTSyncMessage, UsageMetrics, HealthCheckResponse } from '../types.js';
|
|
12
8
|
|
|
13
9
|
/**
|
|
14
10
|
* Azure Function context (simplified interface)
|
|
@@ -54,12 +50,12 @@ export async function healthEndpoint(
|
|
|
54
50
|
context: AzureContext,
|
|
55
51
|
_req: AzureHttpRequest
|
|
56
52
|
): Promise<AzureHttpResponse> {
|
|
57
|
-
context.log(
|
|
53
|
+
context.log('Health check requested');
|
|
58
54
|
|
|
59
55
|
const response: HealthCheckResponse = {
|
|
60
|
-
status:
|
|
56
|
+
status: 'healthy',
|
|
61
57
|
timestamp: Date.now(),
|
|
62
|
-
version:
|
|
58
|
+
version: '0.1.0',
|
|
63
59
|
services: {
|
|
64
60
|
relay: true,
|
|
65
61
|
eventGrid: true,
|
|
@@ -70,7 +66,7 @@ export async function healthEndpoint(
|
|
|
70
66
|
|
|
71
67
|
return {
|
|
72
68
|
status: 200,
|
|
73
|
-
headers: {
|
|
69
|
+
headers: { 'Content-Type': 'application/json' },
|
|
74
70
|
body: response,
|
|
75
71
|
};
|
|
76
72
|
}
|
|
@@ -83,13 +79,13 @@ export async function syncEndpoint(
|
|
|
83
79
|
context: AzureContext,
|
|
84
80
|
req: AzureHttpRequest
|
|
85
81
|
): Promise<AzureHttpResponse> {
|
|
86
|
-
context.log(
|
|
82
|
+
context.log('Sync request received');
|
|
87
83
|
|
|
88
84
|
// Validate request
|
|
89
|
-
if (req.method !==
|
|
85
|
+
if (req.method !== 'POST') {
|
|
90
86
|
return {
|
|
91
87
|
status: 405,
|
|
92
|
-
body: { error:
|
|
88
|
+
body: { error: 'Method not allowed' },
|
|
93
89
|
};
|
|
94
90
|
}
|
|
95
91
|
|
|
@@ -98,7 +94,7 @@ export async function syncEndpoint(
|
|
|
98
94
|
if (!message || !message.appId) {
|
|
99
95
|
return {
|
|
100
96
|
status: 400,
|
|
101
|
-
body: { error:
|
|
97
|
+
body: { error: 'Invalid sync message' },
|
|
102
98
|
};
|
|
103
99
|
}
|
|
104
100
|
|
|
@@ -131,7 +127,7 @@ export async function syncEndpoint(
|
|
|
131
127
|
// Return updated vector clock
|
|
132
128
|
return {
|
|
133
129
|
status: 200,
|
|
134
|
-
headers: {
|
|
130
|
+
headers: { 'Content-Type': 'application/json' },
|
|
135
131
|
body: {
|
|
136
132
|
success: true,
|
|
137
133
|
clock: message.clock,
|
|
@@ -148,14 +144,14 @@ export async function usageEndpoint(
|
|
|
148
144
|
context: AzureContext,
|
|
149
145
|
req: AzureHttpRequest
|
|
150
146
|
): Promise<AzureHttpResponse> {
|
|
151
|
-
context.log(
|
|
147
|
+
context.log('Usage metrics requested');
|
|
152
148
|
|
|
153
149
|
const appId = req.query.appId;
|
|
154
150
|
|
|
155
151
|
if (!appId) {
|
|
156
152
|
return {
|
|
157
153
|
status: 400,
|
|
158
|
-
body: { error:
|
|
154
|
+
body: { error: 'appId query parameter is required' },
|
|
159
155
|
};
|
|
160
156
|
}
|
|
161
157
|
|
|
@@ -164,13 +160,13 @@ export async function usageEndpoint(
|
|
|
164
160
|
if (!usage) {
|
|
165
161
|
return {
|
|
166
162
|
status: 404,
|
|
167
|
-
body: { error:
|
|
163
|
+
body: { error: 'No usage data found for this app' },
|
|
168
164
|
};
|
|
169
165
|
}
|
|
170
166
|
|
|
171
167
|
return {
|
|
172
168
|
status: 200,
|
|
173
|
-
headers: {
|
|
169
|
+
headers: { 'Content-Type': 'application/json' },
|
|
174
170
|
body: usage,
|
|
175
171
|
};
|
|
176
172
|
}
|
|
@@ -183,14 +179,14 @@ export async function statsEndpoint(
|
|
|
183
179
|
context: AzureContext,
|
|
184
180
|
req: AzureHttpRequest
|
|
185
181
|
): Promise<AzureHttpResponse> {
|
|
186
|
-
context.log(
|
|
182
|
+
context.log('Stats requested');
|
|
187
183
|
|
|
188
184
|
const appId = req.query.appId;
|
|
189
185
|
|
|
190
186
|
if (!appId) {
|
|
191
187
|
return {
|
|
192
188
|
status: 400,
|
|
193
|
-
body: { error:
|
|
189
|
+
body: { error: 'appId query parameter is required' },
|
|
194
190
|
};
|
|
195
191
|
}
|
|
196
192
|
|
|
@@ -199,7 +195,7 @@ export async function statsEndpoint(
|
|
|
199
195
|
|
|
200
196
|
return {
|
|
201
197
|
status: 200,
|
|
202
|
-
headers: {
|
|
198
|
+
headers: { 'Content-Type': 'application/json' },
|
|
203
199
|
body: {
|
|
204
200
|
appId,
|
|
205
201
|
totalSyncs: syncs.length,
|
|
@@ -217,12 +213,12 @@ export async function eventsEndpoint(
|
|
|
217
213
|
context: AzureContext,
|
|
218
214
|
req: AzureHttpRequest
|
|
219
215
|
): Promise<AzureHttpResponse> {
|
|
220
|
-
context.log(
|
|
216
|
+
context.log('Event forwarding requested');
|
|
221
217
|
|
|
222
|
-
if (req.method !==
|
|
218
|
+
if (req.method !== 'POST') {
|
|
223
219
|
return {
|
|
224
220
|
status: 405,
|
|
225
|
-
body: { error:
|
|
221
|
+
body: { error: 'Method not allowed' },
|
|
226
222
|
};
|
|
227
223
|
}
|
|
228
224
|
|
|
@@ -231,7 +227,7 @@ export async function eventsEndpoint(
|
|
|
231
227
|
if (!appId || !events) {
|
|
232
228
|
return {
|
|
233
229
|
status: 400,
|
|
234
|
-
body: { error:
|
|
230
|
+
body: { error: 'Invalid event forwarding request' },
|
|
235
231
|
};
|
|
236
232
|
}
|
|
237
233
|
|
|
@@ -241,7 +237,7 @@ export async function eventsEndpoint(
|
|
|
241
237
|
// For now, just acknowledge receipt
|
|
242
238
|
return {
|
|
243
239
|
status: 200,
|
|
244
|
-
headers: {
|
|
240
|
+
headers: { 'Content-Type': 'application/json' },
|
|
245
241
|
body: {
|
|
246
242
|
success: true,
|
|
247
243
|
forwarded: events.length,
|
|
@@ -259,15 +255,15 @@ export async function schemaEndpoint(
|
|
|
259
255
|
context: AzureContext,
|
|
260
256
|
req: AzureHttpRequest
|
|
261
257
|
): Promise<AzureHttpResponse> {
|
|
262
|
-
context.log(
|
|
258
|
+
context.log('Schema registry requested');
|
|
263
259
|
|
|
264
|
-
if (req.method ===
|
|
260
|
+
if (req.method === 'POST') {
|
|
265
261
|
const { appId, schema } = req.body as { appId: string; schema: unknown };
|
|
266
262
|
|
|
267
263
|
if (!appId || !schema) {
|
|
268
264
|
return {
|
|
269
265
|
status: 400,
|
|
270
|
-
body: { error:
|
|
266
|
+
body: { error: 'Invalid schema registration request' },
|
|
271
267
|
};
|
|
272
268
|
}
|
|
273
269
|
|
|
@@ -275,7 +271,7 @@ export async function schemaEndpoint(
|
|
|
275
271
|
|
|
276
272
|
return {
|
|
277
273
|
status: 200,
|
|
278
|
-
headers: {
|
|
274
|
+
headers: { 'Content-Type': 'application/json' },
|
|
279
275
|
body: {
|
|
280
276
|
success: true,
|
|
281
277
|
schemaId: `${appId}-${Date.now()}`,
|
|
@@ -290,18 +286,18 @@ export async function schemaEndpoint(
|
|
|
290
286
|
if (!appId) {
|
|
291
287
|
return {
|
|
292
288
|
status: 400,
|
|
293
|
-
body: { error:
|
|
289
|
+
body: { error: 'appId query parameter is required' },
|
|
294
290
|
};
|
|
295
291
|
}
|
|
296
292
|
|
|
297
293
|
// Return placeholder schema
|
|
298
294
|
return {
|
|
299
295
|
status: 200,
|
|
300
|
-
headers: {
|
|
296
|
+
headers: { 'Content-Type': 'application/json' },
|
|
301
297
|
body: {
|
|
302
298
|
appId,
|
|
303
299
|
schema: null,
|
|
304
|
-
message:
|
|
300
|
+
message: 'Schema not found',
|
|
305
301
|
},
|
|
306
302
|
};
|
|
307
303
|
}
|
package/src/cloud/sponsors.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GitHub Sponsors API Client
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Client for checking GitHub Sponsors subscription status.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { Subscription } from
|
|
8
|
-
import { createSponsorSubscription, createFreeSubscription } from
|
|
7
|
+
import type { Subscription } from './billing.js';
|
|
8
|
+
import { createSponsorSubscription, createFreeSubscription } from './billing.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* GitHub Sponsors tier information
|
|
@@ -15,22 +15,22 @@ export interface SponsorTier {
|
|
|
15
15
|
* Tier ID
|
|
16
16
|
*/
|
|
17
17
|
id: string;
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
/**
|
|
20
20
|
* Tier name
|
|
21
21
|
*/
|
|
22
22
|
name: string;
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
/**
|
|
25
25
|
* Monthly price in cents
|
|
26
26
|
*/
|
|
27
27
|
monthlyPriceInCents: number;
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
/**
|
|
30
30
|
* Tier description
|
|
31
31
|
*/
|
|
32
32
|
description?: string;
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
/**
|
|
35
35
|
* Whether this is a one-time sponsorship
|
|
36
36
|
*/
|
|
@@ -45,22 +45,22 @@ export interface Sponsorship {
|
|
|
45
45
|
* Sponsor login
|
|
46
46
|
*/
|
|
47
47
|
sponsorLogin: string;
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
/**
|
|
50
50
|
* Sponsor ID
|
|
51
51
|
*/
|
|
52
52
|
sponsorId: number;
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
/**
|
|
55
55
|
* Tier information
|
|
56
56
|
*/
|
|
57
57
|
tier: SponsorTier;
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
/**
|
|
60
60
|
* Creation date
|
|
61
61
|
*/
|
|
62
62
|
createdAt: string;
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
/**
|
|
65
65
|
* Whether sponsorship is active
|
|
66
66
|
*/
|
|
@@ -73,12 +73,12 @@ export interface Sponsorship {
|
|
|
73
73
|
export class GitHubSponsorsClient {
|
|
74
74
|
private token: string;
|
|
75
75
|
private accountLogin: string;
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
constructor(token: string, accountLogin: string) {
|
|
78
78
|
this.token = token;
|
|
79
79
|
this.accountLogin = accountLogin;
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
/**
|
|
83
83
|
* Get current user's sponsorship of the Praxis account
|
|
84
84
|
*/
|
|
@@ -122,12 +122,12 @@ export class GitHubSponsorsClient {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
`;
|
|
125
|
-
|
|
126
|
-
const response = await fetch(
|
|
127
|
-
method:
|
|
125
|
+
|
|
126
|
+
const response = await fetch('https://api.github.com/graphql', {
|
|
127
|
+
method: 'POST',
|
|
128
128
|
headers: {
|
|
129
129
|
Authorization: `Bearer ${this.token}`,
|
|
130
|
-
|
|
130
|
+
'Content-Type': 'application/json',
|
|
131
131
|
},
|
|
132
132
|
body: JSON.stringify({
|
|
133
133
|
query,
|
|
@@ -137,27 +137,27 @@ export class GitHubSponsorsClient {
|
|
|
137
137
|
},
|
|
138
138
|
}),
|
|
139
139
|
});
|
|
140
|
-
|
|
140
|
+
|
|
141
141
|
if (!response.ok) {
|
|
142
142
|
throw new Error(`GitHub API error: ${response.statusText}`);
|
|
143
143
|
}
|
|
144
|
-
|
|
145
|
-
const data = await response.json() as any;
|
|
146
|
-
|
|
144
|
+
|
|
145
|
+
const data = (await response.json()) as any;
|
|
146
|
+
|
|
147
147
|
if (data.errors) {
|
|
148
148
|
throw new Error(`GraphQL error: ${JSON.stringify(data.errors)}`);
|
|
149
149
|
}
|
|
150
|
-
|
|
150
|
+
|
|
151
151
|
// Check if user sponsors the Praxis account
|
|
152
152
|
const sponsorships = data.data?.user?.sponsorshipsAsSponsor?.nodes || [];
|
|
153
153
|
const praxisSponsorship = sponsorships.find(
|
|
154
154
|
(s: any) => s.sponsorable?.login === this.accountLogin
|
|
155
155
|
);
|
|
156
|
-
|
|
156
|
+
|
|
157
157
|
if (!praxisSponsorship) {
|
|
158
158
|
return null;
|
|
159
159
|
}
|
|
160
|
-
|
|
160
|
+
|
|
161
161
|
return {
|
|
162
162
|
sponsorLogin: userLogin,
|
|
163
163
|
sponsorId: data.data.user.id,
|
|
@@ -172,27 +172,24 @@ export class GitHubSponsorsClient {
|
|
|
172
172
|
isActive: praxisSponsorship.isActive,
|
|
173
173
|
};
|
|
174
174
|
} catch (error) {
|
|
175
|
-
console.error(
|
|
175
|
+
console.error('Failed to get sponsorship:', error);
|
|
176
176
|
return null;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
|
|
179
|
+
|
|
180
180
|
/**
|
|
181
181
|
* Get subscription from sponsorship
|
|
182
182
|
*/
|
|
183
183
|
async getSubscription(userLogin: string): Promise<Subscription> {
|
|
184
184
|
const sponsorship = await this.getSponsorship(userLogin);
|
|
185
|
-
|
|
185
|
+
|
|
186
186
|
if (!sponsorship || !sponsorship.isActive) {
|
|
187
187
|
return createFreeSubscription();
|
|
188
188
|
}
|
|
189
|
-
|
|
190
|
-
return createSponsorSubscription(
|
|
191
|
-
sponsorship.tier.name,
|
|
192
|
-
sponsorship.tier.monthlyPriceInCents
|
|
193
|
-
);
|
|
189
|
+
|
|
190
|
+
return createSponsorSubscription(sponsorship.tier.name, sponsorship.tier.monthlyPriceInCents);
|
|
194
191
|
}
|
|
195
|
-
|
|
192
|
+
|
|
196
193
|
/**
|
|
197
194
|
* Check if user is a sponsor
|
|
198
195
|
*/
|
|
@@ -207,7 +204,7 @@ export class GitHubSponsorsClient {
|
|
|
207
204
|
*/
|
|
208
205
|
export function createSponsorsClient(
|
|
209
206
|
token: string,
|
|
210
|
-
accountLogin: string =
|
|
207
|
+
accountLogin: string = 'plures'
|
|
211
208
|
): GitHubSponsorsClient {
|
|
212
209
|
return new GitHubSponsorsClient(token, accountLogin);
|
|
213
210
|
}
|