@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,674 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Documentation Generator
|
|
3
|
-
*
|
|
4
|
-
* Generates Markdown documentation from PSF schemas.
|
|
5
|
-
* Produces API docs, architecture diagrams, and user guides.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Documentation Generator class
|
|
9
|
-
*/
|
|
10
|
-
export class DocsGenerator {
|
|
11
|
-
options;
|
|
12
|
-
constructor(options = {}) {
|
|
13
|
-
this.options = {
|
|
14
|
-
outputDir: options.outputDir || './docs',
|
|
15
|
-
includeDiagrams: options.includeDiagrams ?? true,
|
|
16
|
-
includeExamples: options.includeExamples ?? true,
|
|
17
|
-
includeApiReference: options.includeApiReference ?? true,
|
|
18
|
-
includeToc: options.includeToc ?? true,
|
|
19
|
-
format: options.format || 'markdown',
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Generate all documentation from schema
|
|
24
|
-
*/
|
|
25
|
-
generate(schema) {
|
|
26
|
-
const files = [];
|
|
27
|
-
const errors = [];
|
|
28
|
-
try {
|
|
29
|
-
// Generate overview
|
|
30
|
-
files.push(this.generateOverview(schema));
|
|
31
|
-
// Generate API reference
|
|
32
|
-
if (this.options.includeApiReference) {
|
|
33
|
-
files.push(this.generateApiReference(schema));
|
|
34
|
-
}
|
|
35
|
-
// Generate model docs
|
|
36
|
-
if (schema.models.length > 0) {
|
|
37
|
-
files.push(this.generateModelsDoc(schema.models));
|
|
38
|
-
}
|
|
39
|
-
// Generate component docs
|
|
40
|
-
if (schema.components.length > 0) {
|
|
41
|
-
files.push(this.generateComponentsDoc(schema.components));
|
|
42
|
-
}
|
|
43
|
-
// Generate flow docs
|
|
44
|
-
if (schema.flows.length > 0) {
|
|
45
|
-
files.push(this.generateFlowsDoc(schema.flows));
|
|
46
|
-
}
|
|
47
|
-
// Generate diagrams
|
|
48
|
-
if (this.options.includeDiagrams) {
|
|
49
|
-
files.push(this.generateDiagrams(schema));
|
|
50
|
-
}
|
|
51
|
-
// Generate index
|
|
52
|
-
files.push(this.generateIndex(schema, files));
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
errors.push(error instanceof Error ? error.message : 'Unknown error');
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
success: errors.length === 0,
|
|
59
|
-
files,
|
|
60
|
-
errors,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Generate overview document
|
|
65
|
-
*/
|
|
66
|
-
generateOverview(schema) {
|
|
67
|
-
const lines = [];
|
|
68
|
-
lines.push(`# ${schema.name}`);
|
|
69
|
-
lines.push('');
|
|
70
|
-
if (schema.description) {
|
|
71
|
-
lines.push(schema.description);
|
|
72
|
-
lines.push('');
|
|
73
|
-
}
|
|
74
|
-
// Schema info
|
|
75
|
-
lines.push('## Schema Information');
|
|
76
|
-
lines.push('');
|
|
77
|
-
lines.push(`- **Version**: ${schema.$version}`);
|
|
78
|
-
lines.push(`- **ID**: ${schema.id}`);
|
|
79
|
-
if (schema.createdAt) {
|
|
80
|
-
lines.push(`- **Created**: ${new Date(schema.createdAt).toLocaleString()}`);
|
|
81
|
-
}
|
|
82
|
-
if (schema.modifiedAt) {
|
|
83
|
-
lines.push(`- **Last Modified**: ${new Date(schema.modifiedAt).toLocaleString()}`);
|
|
84
|
-
}
|
|
85
|
-
lines.push('');
|
|
86
|
-
// Quick stats
|
|
87
|
-
lines.push('## Overview');
|
|
88
|
-
lines.push('');
|
|
89
|
-
lines.push(`| Type | Count |`);
|
|
90
|
-
lines.push(`| ---- | ----- |`);
|
|
91
|
-
lines.push(`| Facts | ${schema.facts.length} |`);
|
|
92
|
-
lines.push(`| Events | ${schema.events.length} |`);
|
|
93
|
-
lines.push(`| Rules | ${schema.rules.length} |`);
|
|
94
|
-
lines.push(`| Constraints | ${schema.constraints.length} |`);
|
|
95
|
-
lines.push(`| Models | ${schema.models.length} |`);
|
|
96
|
-
lines.push(`| Components | ${schema.components.length} |`);
|
|
97
|
-
lines.push(`| Flows | ${schema.flows.length} |`);
|
|
98
|
-
lines.push('');
|
|
99
|
-
// Schema documentation if available
|
|
100
|
-
if (schema.docs) {
|
|
101
|
-
if (schema.docs.overview) {
|
|
102
|
-
lines.push('## About');
|
|
103
|
-
lines.push('');
|
|
104
|
-
lines.push(schema.docs.overview);
|
|
105
|
-
lines.push('');
|
|
106
|
-
}
|
|
107
|
-
if (schema.docs.gettingStarted) {
|
|
108
|
-
lines.push('## Getting Started');
|
|
109
|
-
lines.push('');
|
|
110
|
-
lines.push(schema.docs.gettingStarted);
|
|
111
|
-
lines.push('');
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return {
|
|
115
|
-
path: `${this.options.outputDir}/overview.md`,
|
|
116
|
-
content: lines.join('\n'),
|
|
117
|
-
type: 'overview',
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Generate API reference
|
|
122
|
-
*/
|
|
123
|
-
generateApiReference(schema) {
|
|
124
|
-
const lines = [];
|
|
125
|
-
lines.push('# API Reference');
|
|
126
|
-
lines.push('');
|
|
127
|
-
if (this.options.includeToc) {
|
|
128
|
-
lines.push('## Table of Contents');
|
|
129
|
-
lines.push('');
|
|
130
|
-
lines.push('- [Facts](#facts)');
|
|
131
|
-
lines.push('- [Events](#events)');
|
|
132
|
-
lines.push('- [Rules](#rules)');
|
|
133
|
-
lines.push('- [Constraints](#constraints)');
|
|
134
|
-
lines.push('');
|
|
135
|
-
}
|
|
136
|
-
// Facts
|
|
137
|
-
lines.push('## Facts');
|
|
138
|
-
lines.push('');
|
|
139
|
-
if (schema.facts.length === 0) {
|
|
140
|
-
lines.push('No facts defined.');
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
for (const fact of schema.facts) {
|
|
144
|
-
lines.push(this.generateFactDoc(fact));
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
lines.push('');
|
|
148
|
-
// Events
|
|
149
|
-
lines.push('## Events');
|
|
150
|
-
lines.push('');
|
|
151
|
-
if (schema.events.length === 0) {
|
|
152
|
-
lines.push('No events defined.');
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
for (const event of schema.events) {
|
|
156
|
-
lines.push(this.generateEventDoc(event));
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
lines.push('');
|
|
160
|
-
// Rules
|
|
161
|
-
lines.push('## Rules');
|
|
162
|
-
lines.push('');
|
|
163
|
-
if (schema.rules.length === 0) {
|
|
164
|
-
lines.push('No rules defined.');
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
for (const rule of schema.rules) {
|
|
168
|
-
lines.push(this.generateRuleDoc(rule));
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
lines.push('');
|
|
172
|
-
// Constraints
|
|
173
|
-
lines.push('## Constraints');
|
|
174
|
-
lines.push('');
|
|
175
|
-
if (schema.constraints.length === 0) {
|
|
176
|
-
lines.push('No constraints defined.');
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
for (const constraint of schema.constraints) {
|
|
180
|
-
lines.push(this.generateConstraintDoc(constraint));
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return {
|
|
184
|
-
path: `${this.options.outputDir}/api.md`,
|
|
185
|
-
content: lines.join('\n'),
|
|
186
|
-
type: 'api',
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Generate fact documentation
|
|
191
|
-
*/
|
|
192
|
-
generateFactDoc(fact) {
|
|
193
|
-
const lines = [];
|
|
194
|
-
lines.push(`### ${fact.tag}`);
|
|
195
|
-
lines.push('');
|
|
196
|
-
if (fact.description) {
|
|
197
|
-
lines.push(fact.description);
|
|
198
|
-
lines.push('');
|
|
199
|
-
}
|
|
200
|
-
if (fact.docs?.summary) {
|
|
201
|
-
lines.push(`> ${fact.docs.summary}`);
|
|
202
|
-
lines.push('');
|
|
203
|
-
}
|
|
204
|
-
// Payload schema
|
|
205
|
-
if (fact.payload && Object.keys(fact.payload.properties).length > 0) {
|
|
206
|
-
lines.push('**Payload**');
|
|
207
|
-
lines.push('');
|
|
208
|
-
lines.push('| Property | Type | Description |');
|
|
209
|
-
lines.push('| -------- | ---- | ----------- |');
|
|
210
|
-
for (const [name, prop] of Object.entries(fact.payload.properties)) {
|
|
211
|
-
const type = this.formatFieldType(prop.type);
|
|
212
|
-
const desc = prop.description || '-';
|
|
213
|
-
lines.push(`| \`${name}\` | \`${type}\` | ${desc} |`);
|
|
214
|
-
}
|
|
215
|
-
lines.push('');
|
|
216
|
-
}
|
|
217
|
-
if (this.options.includeExamples) {
|
|
218
|
-
lines.push('**Example**');
|
|
219
|
-
lines.push('');
|
|
220
|
-
lines.push('```typescript');
|
|
221
|
-
lines.push(`const fact = ${fact.tag}.create({`);
|
|
222
|
-
for (const [name, prop] of Object.entries(fact.payload.properties)) {
|
|
223
|
-
const example = this.getExampleValue(prop.type);
|
|
224
|
-
lines.push(` ${name}: ${example},`);
|
|
225
|
-
}
|
|
226
|
-
lines.push('});');
|
|
227
|
-
lines.push('```');
|
|
228
|
-
lines.push('');
|
|
229
|
-
}
|
|
230
|
-
return lines.join('\n');
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Generate event documentation
|
|
234
|
-
*/
|
|
235
|
-
generateEventDoc(event) {
|
|
236
|
-
const lines = [];
|
|
237
|
-
lines.push(`### ${event.tag}`);
|
|
238
|
-
lines.push('');
|
|
239
|
-
if (event.description) {
|
|
240
|
-
lines.push(event.description);
|
|
241
|
-
lines.push('');
|
|
242
|
-
}
|
|
243
|
-
if (event.docs?.summary) {
|
|
244
|
-
lines.push(`> ${event.docs.summary}`);
|
|
245
|
-
lines.push('');
|
|
246
|
-
}
|
|
247
|
-
// Payload schema
|
|
248
|
-
if (event.payload && Object.keys(event.payload.properties).length > 0) {
|
|
249
|
-
lines.push('**Payload**');
|
|
250
|
-
lines.push('');
|
|
251
|
-
lines.push('| Property | Type | Description |');
|
|
252
|
-
lines.push('| -------- | ---- | ----------- |');
|
|
253
|
-
for (const [name, prop] of Object.entries(event.payload.properties)) {
|
|
254
|
-
const type = this.formatFieldType(prop.type);
|
|
255
|
-
const desc = prop.description || '-';
|
|
256
|
-
lines.push(`| \`${name}\` | \`${type}\` | ${desc} |`);
|
|
257
|
-
}
|
|
258
|
-
lines.push('');
|
|
259
|
-
}
|
|
260
|
-
if (this.options.includeExamples) {
|
|
261
|
-
lines.push('**Example**');
|
|
262
|
-
lines.push('');
|
|
263
|
-
lines.push('```typescript');
|
|
264
|
-
lines.push(`const event = ${event.tag}.create({`);
|
|
265
|
-
for (const [name, prop] of Object.entries(event.payload.properties)) {
|
|
266
|
-
const example = this.getExampleValue(prop.type);
|
|
267
|
-
lines.push(` ${name}: ${example},`);
|
|
268
|
-
}
|
|
269
|
-
lines.push('});');
|
|
270
|
-
lines.push('```');
|
|
271
|
-
lines.push('');
|
|
272
|
-
}
|
|
273
|
-
return lines.join('\n');
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Generate rule documentation
|
|
277
|
-
*/
|
|
278
|
-
generateRuleDoc(rule) {
|
|
279
|
-
const lines = [];
|
|
280
|
-
lines.push(`### ${rule.name || rule.id}`);
|
|
281
|
-
lines.push('');
|
|
282
|
-
lines.push(`**ID**: \`${rule.id}\``);
|
|
283
|
-
lines.push('');
|
|
284
|
-
if (rule.description) {
|
|
285
|
-
lines.push(rule.description);
|
|
286
|
-
lines.push('');
|
|
287
|
-
}
|
|
288
|
-
if (rule.triggers && rule.triggers.length > 0) {
|
|
289
|
-
lines.push(`**Triggers**: ${rule.triggers.map((t) => `\`${t}\``).join(', ')}`);
|
|
290
|
-
lines.push('');
|
|
291
|
-
}
|
|
292
|
-
if (rule.priority !== undefined) {
|
|
293
|
-
lines.push(`**Priority**: ${rule.priority}`);
|
|
294
|
-
lines.push('');
|
|
295
|
-
}
|
|
296
|
-
return lines.join('\n');
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Generate constraint documentation
|
|
300
|
-
*/
|
|
301
|
-
generateConstraintDoc(constraint) {
|
|
302
|
-
const lines = [];
|
|
303
|
-
lines.push(`### ${constraint.name || constraint.id}`);
|
|
304
|
-
lines.push('');
|
|
305
|
-
lines.push(`**ID**: \`${constraint.id}\``);
|
|
306
|
-
lines.push('');
|
|
307
|
-
if (constraint.description) {
|
|
308
|
-
lines.push(constraint.description);
|
|
309
|
-
lines.push('');
|
|
310
|
-
}
|
|
311
|
-
if (constraint.severity) {
|
|
312
|
-
lines.push(`**Severity**: ${constraint.severity}`);
|
|
313
|
-
lines.push('');
|
|
314
|
-
}
|
|
315
|
-
if (constraint.errorMessage) {
|
|
316
|
-
lines.push(`**Error Message**: "${constraint.errorMessage}"`);
|
|
317
|
-
lines.push('');
|
|
318
|
-
}
|
|
319
|
-
return lines.join('\n');
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Generate models documentation
|
|
323
|
-
*/
|
|
324
|
-
generateModelsDoc(models) {
|
|
325
|
-
const lines = [];
|
|
326
|
-
lines.push('# Data Models');
|
|
327
|
-
lines.push('');
|
|
328
|
-
for (const model of models) {
|
|
329
|
-
lines.push(`## ${model.name}`);
|
|
330
|
-
lines.push('');
|
|
331
|
-
if (model.description) {
|
|
332
|
-
lines.push(model.description);
|
|
333
|
-
lines.push('');
|
|
334
|
-
}
|
|
335
|
-
// Fields table
|
|
336
|
-
lines.push('### Fields');
|
|
337
|
-
lines.push('');
|
|
338
|
-
lines.push('| Field | Type | Optional | Description |');
|
|
339
|
-
lines.push('| ----- | ---- | -------- | ----------- |');
|
|
340
|
-
for (const field of model.fields) {
|
|
341
|
-
const type = this.formatFieldType(field.type);
|
|
342
|
-
const optional = field.optional ? 'Yes' : 'No';
|
|
343
|
-
const desc = field.description || '-';
|
|
344
|
-
lines.push(`| \`${field.name}\` | \`${type}\` | ${optional} | ${desc} |`);
|
|
345
|
-
}
|
|
346
|
-
lines.push('');
|
|
347
|
-
// Relationships
|
|
348
|
-
if (model.relationships && model.relationships.length > 0) {
|
|
349
|
-
lines.push('### Relationships');
|
|
350
|
-
lines.push('');
|
|
351
|
-
for (const rel of model.relationships) {
|
|
352
|
-
lines.push(`- **${rel.name}** → \`${rel.target}\` (${rel.type})`);
|
|
353
|
-
}
|
|
354
|
-
lines.push('');
|
|
355
|
-
}
|
|
356
|
-
// Indexes
|
|
357
|
-
if (model.indexes && model.indexes.length > 0) {
|
|
358
|
-
lines.push('### Indexes');
|
|
359
|
-
lines.push('');
|
|
360
|
-
for (const idx of model.indexes) {
|
|
361
|
-
const unique = idx.unique ? ' (unique)' : '';
|
|
362
|
-
lines.push(`- **${idx.name}**: ${idx.fields.join(', ')}${unique}`);
|
|
363
|
-
}
|
|
364
|
-
lines.push('');
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
return {
|
|
368
|
-
path: `${this.options.outputDir}/models.md`,
|
|
369
|
-
content: lines.join('\n'),
|
|
370
|
-
type: 'model',
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* Generate components documentation
|
|
375
|
-
*/
|
|
376
|
-
generateComponentsDoc(components) {
|
|
377
|
-
const lines = [];
|
|
378
|
-
lines.push('# UI Components');
|
|
379
|
-
lines.push('');
|
|
380
|
-
for (const comp of components) {
|
|
381
|
-
lines.push(`## ${comp.name}`);
|
|
382
|
-
lines.push('');
|
|
383
|
-
lines.push(`**Type**: ${comp.type}`);
|
|
384
|
-
lines.push('');
|
|
385
|
-
if (comp.description) {
|
|
386
|
-
lines.push(comp.description);
|
|
387
|
-
lines.push('');
|
|
388
|
-
}
|
|
389
|
-
if (comp.model) {
|
|
390
|
-
lines.push(`**Bound Model**: \`${comp.model}\``);
|
|
391
|
-
lines.push('');
|
|
392
|
-
}
|
|
393
|
-
// Props
|
|
394
|
-
if (comp.props.length > 0) {
|
|
395
|
-
lines.push('### Props');
|
|
396
|
-
lines.push('');
|
|
397
|
-
lines.push('| Prop | Type | Required | Description |');
|
|
398
|
-
lines.push('| ---- | ---- | -------- | ----------- |');
|
|
399
|
-
for (const prop of comp.props) {
|
|
400
|
-
const required = prop.required ? 'Yes' : 'No';
|
|
401
|
-
const desc = prop.description || '-';
|
|
402
|
-
lines.push(`| \`${prop.name}\` | \`${prop.type}\` | ${required} | ${desc} |`);
|
|
403
|
-
}
|
|
404
|
-
lines.push('');
|
|
405
|
-
}
|
|
406
|
-
// Events
|
|
407
|
-
if (comp.events.length > 0) {
|
|
408
|
-
lines.push('### Events');
|
|
409
|
-
lines.push('');
|
|
410
|
-
for (const event of comp.events) {
|
|
411
|
-
lines.push(`- **${event.name}**${event.payload ? `: ${event.payload}` : ''}`);
|
|
412
|
-
if (event.description) {
|
|
413
|
-
lines.push(` - ${event.description}`);
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
lines.push('');
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
return {
|
|
420
|
-
path: `${this.options.outputDir}/components.md`,
|
|
421
|
-
content: lines.join('\n'),
|
|
422
|
-
type: 'component',
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
/**
|
|
426
|
-
* Generate flows documentation
|
|
427
|
-
*/
|
|
428
|
-
generateFlowsDoc(flows) {
|
|
429
|
-
const lines = [];
|
|
430
|
-
lines.push('# Flows & Orchestration');
|
|
431
|
-
lines.push('');
|
|
432
|
-
for (const flow of flows) {
|
|
433
|
-
lines.push(`## ${flow.name}`);
|
|
434
|
-
lines.push('');
|
|
435
|
-
lines.push(`**Type**: ${flow.type}`);
|
|
436
|
-
lines.push('');
|
|
437
|
-
if (flow.description) {
|
|
438
|
-
lines.push(flow.description);
|
|
439
|
-
lines.push('');
|
|
440
|
-
}
|
|
441
|
-
if (flow.initial) {
|
|
442
|
-
lines.push(`**Initial Step**: \`${flow.initial}\``);
|
|
443
|
-
lines.push('');
|
|
444
|
-
}
|
|
445
|
-
// Steps
|
|
446
|
-
if (flow.steps.length > 0) {
|
|
447
|
-
lines.push('### Steps');
|
|
448
|
-
lines.push('');
|
|
449
|
-
for (const step of flow.steps) {
|
|
450
|
-
lines.push(`#### ${step.name || step.id}`);
|
|
451
|
-
lines.push('');
|
|
452
|
-
lines.push(`- **ID**: \`${step.id}\``);
|
|
453
|
-
lines.push(`- **Type**: ${step.type}`);
|
|
454
|
-
if (step.next) {
|
|
455
|
-
if (typeof step.next === 'string') {
|
|
456
|
-
lines.push(`- **Next**: \`${step.next}\``);
|
|
457
|
-
}
|
|
458
|
-
else {
|
|
459
|
-
lines.push('- **Next**:');
|
|
460
|
-
for (const [condition, target] of Object.entries(step.next)) {
|
|
461
|
-
lines.push(` - \`${condition}\` → \`${target}\``);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
lines.push('');
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
return {
|
|
470
|
-
path: `${this.options.outputDir}/flows.md`,
|
|
471
|
-
content: lines.join('\n'),
|
|
472
|
-
type: 'flow',
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
/**
|
|
476
|
-
* Generate Mermaid diagrams
|
|
477
|
-
*/
|
|
478
|
-
generateDiagrams(schema) {
|
|
479
|
-
const lines = [];
|
|
480
|
-
lines.push('# Architecture Diagrams');
|
|
481
|
-
lines.push('');
|
|
482
|
-
// Entity Relationship Diagram
|
|
483
|
-
lines.push('## Data Model Diagram');
|
|
484
|
-
lines.push('');
|
|
485
|
-
lines.push('```mermaid');
|
|
486
|
-
lines.push('erDiagram');
|
|
487
|
-
for (const model of schema.models) {
|
|
488
|
-
for (const rel of model.relationships || []) {
|
|
489
|
-
const cardinalityMap = {
|
|
490
|
-
'one-to-one': '||--||',
|
|
491
|
-
'one-to-many': '||--o{',
|
|
492
|
-
'many-to-many': '}o--o{',
|
|
493
|
-
};
|
|
494
|
-
const cardinality = cardinalityMap[rel.type] || '||--||';
|
|
495
|
-
lines.push(` ${model.name} ${cardinality} ${rel.target} : "${rel.name}"`);
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
for (const model of schema.models) {
|
|
499
|
-
lines.push(` ${model.name} {`);
|
|
500
|
-
for (const field of model.fields) {
|
|
501
|
-
const type = this.formatFieldTypeSimple(field.type);
|
|
502
|
-
lines.push(` ${type} ${field.name}`);
|
|
503
|
-
}
|
|
504
|
-
lines.push(' }');
|
|
505
|
-
}
|
|
506
|
-
lines.push('```');
|
|
507
|
-
lines.push('');
|
|
508
|
-
// Event Flow Diagram
|
|
509
|
-
if (schema.rules.length > 0) {
|
|
510
|
-
lines.push('## Event Flow Diagram');
|
|
511
|
-
lines.push('');
|
|
512
|
-
lines.push('```mermaid');
|
|
513
|
-
lines.push('flowchart LR');
|
|
514
|
-
for (const rule of schema.rules) {
|
|
515
|
-
const ruleNode = `rule_${this.sanitizeId(rule.id)}`;
|
|
516
|
-
lines.push(` ${ruleNode}["${rule.name || rule.id}"]`);
|
|
517
|
-
if (rule.triggers) {
|
|
518
|
-
for (const trigger of rule.triggers) {
|
|
519
|
-
lines.push(` event_${trigger}((${trigger})) --> ${ruleNode}`);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
lines.push('```');
|
|
524
|
-
lines.push('');
|
|
525
|
-
}
|
|
526
|
-
// Component Diagram
|
|
527
|
-
if (schema.components.length > 0) {
|
|
528
|
-
lines.push('## Component Diagram');
|
|
529
|
-
lines.push('');
|
|
530
|
-
lines.push('```mermaid');
|
|
531
|
-
lines.push('flowchart TB');
|
|
532
|
-
lines.push(' subgraph UI[UI Layer]');
|
|
533
|
-
for (const comp of schema.components) {
|
|
534
|
-
lines.push(` ${comp.name}[${comp.name}]`);
|
|
535
|
-
}
|
|
536
|
-
lines.push(' end');
|
|
537
|
-
lines.push(' subgraph Data[Data Layer]');
|
|
538
|
-
for (const model of schema.models) {
|
|
539
|
-
lines.push(` ${model.name}[(${model.name})]`);
|
|
540
|
-
}
|
|
541
|
-
lines.push(' end');
|
|
542
|
-
// Bindings
|
|
543
|
-
for (const comp of schema.components) {
|
|
544
|
-
if (comp.model) {
|
|
545
|
-
lines.push(` ${comp.name} --> ${comp.model}`);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
lines.push('```');
|
|
549
|
-
lines.push('');
|
|
550
|
-
}
|
|
551
|
-
return {
|
|
552
|
-
path: `${this.options.outputDir}/diagrams.md`,
|
|
553
|
-
content: lines.join('\n'),
|
|
554
|
-
type: 'diagram',
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
/**
|
|
558
|
-
* Generate index document
|
|
559
|
-
*/
|
|
560
|
-
generateIndex(schema, files) {
|
|
561
|
-
const lines = [];
|
|
562
|
-
lines.push(`# ${schema.name} Documentation`);
|
|
563
|
-
lines.push('');
|
|
564
|
-
if (schema.description) {
|
|
565
|
-
lines.push(schema.description);
|
|
566
|
-
lines.push('');
|
|
567
|
-
}
|
|
568
|
-
lines.push('## Documentation');
|
|
569
|
-
lines.push('');
|
|
570
|
-
const docLinks = {
|
|
571
|
-
overview: { title: 'Overview', desc: 'Project overview and introduction' },
|
|
572
|
-
api: { title: 'API Reference', desc: 'Facts, events, rules, and constraints' },
|
|
573
|
-
model: { title: 'Data Models', desc: 'Entity definitions and relationships' },
|
|
574
|
-
component: { title: 'UI Components', desc: 'Component documentation' },
|
|
575
|
-
flow: { title: 'Flows', desc: 'Orchestration and workflows' },
|
|
576
|
-
diagram: { title: 'Diagrams', desc: 'Architecture and flow diagrams' },
|
|
577
|
-
};
|
|
578
|
-
for (const file of files) {
|
|
579
|
-
if (file.type === 'index')
|
|
580
|
-
continue;
|
|
581
|
-
const link = docLinks[file.type];
|
|
582
|
-
if (link) {
|
|
583
|
-
const relativePath = file.path.replace(`${this.options.outputDir}/`, '');
|
|
584
|
-
lines.push(`- [${link.title}](${relativePath}) - ${link.desc}`);
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
lines.push('');
|
|
588
|
-
lines.push('---');
|
|
589
|
-
lines.push('');
|
|
590
|
-
lines.push(`Generated from PSF Schema v${schema.$version}`);
|
|
591
|
-
return {
|
|
592
|
-
path: `${this.options.outputDir}/README.md`,
|
|
593
|
-
content: lines.join('\n'),
|
|
594
|
-
type: 'index',
|
|
595
|
-
};
|
|
596
|
-
}
|
|
597
|
-
/**
|
|
598
|
-
* Format field type for display
|
|
599
|
-
*/
|
|
600
|
-
formatFieldType(type) {
|
|
601
|
-
if (typeof type === 'string')
|
|
602
|
-
return type;
|
|
603
|
-
if ('array' in type)
|
|
604
|
-
return `${this.formatFieldType(type.array)}[]`;
|
|
605
|
-
if ('reference' in type)
|
|
606
|
-
return type.reference;
|
|
607
|
-
if ('enum' in type)
|
|
608
|
-
return type.enum.join(' | ');
|
|
609
|
-
if ('union' in type)
|
|
610
|
-
return type.union.map((t) => this.formatFieldType(t)).join(' | ');
|
|
611
|
-
return 'object';
|
|
612
|
-
}
|
|
613
|
-
/**
|
|
614
|
-
* Format field type simple (for Mermaid)
|
|
615
|
-
*/
|
|
616
|
-
formatFieldTypeSimple(type) {
|
|
617
|
-
if (typeof type === 'string')
|
|
618
|
-
return type;
|
|
619
|
-
if ('array' in type)
|
|
620
|
-
return 'array';
|
|
621
|
-
if ('reference' in type)
|
|
622
|
-
return 'ref';
|
|
623
|
-
if ('enum' in type)
|
|
624
|
-
return 'enum';
|
|
625
|
-
return 'object';
|
|
626
|
-
}
|
|
627
|
-
/**
|
|
628
|
-
* Get example value for type
|
|
629
|
-
*/
|
|
630
|
-
getExampleValue(type) {
|
|
631
|
-
if (typeof type === 'string') {
|
|
632
|
-
switch (type) {
|
|
633
|
-
case 'string':
|
|
634
|
-
return '"example"';
|
|
635
|
-
case 'number':
|
|
636
|
-
return '42';
|
|
637
|
-
case 'boolean':
|
|
638
|
-
return 'true';
|
|
639
|
-
case 'date':
|
|
640
|
-
case 'datetime':
|
|
641
|
-
return 'new Date()';
|
|
642
|
-
case 'uuid':
|
|
643
|
-
return '"550e8400-e29b-41d4-a716-446655440000"';
|
|
644
|
-
default:
|
|
645
|
-
return 'null';
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
if ('array' in type)
|
|
649
|
-
return '[]';
|
|
650
|
-
if ('enum' in type && type.enum.length > 0)
|
|
651
|
-
return `"${type.enum[0]}"`;
|
|
652
|
-
return '{}';
|
|
653
|
-
}
|
|
654
|
-
/**
|
|
655
|
-
* Sanitize ID for Mermaid
|
|
656
|
-
*/
|
|
657
|
-
sanitizeId(id) {
|
|
658
|
-
return id.replace(/[^a-zA-Z0-9_]/g, '_');
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
/**
|
|
662
|
-
* Create a docs generator
|
|
663
|
-
*/
|
|
664
|
-
export function createDocsGenerator(options) {
|
|
665
|
-
return new DocsGenerator(options);
|
|
666
|
-
}
|
|
667
|
-
/**
|
|
668
|
-
* Generate documentation from PSF schema (convenience function)
|
|
669
|
-
*/
|
|
670
|
-
export function generateDocs(schema, options) {
|
|
671
|
-
const generator = new DocsGenerator(options);
|
|
672
|
-
return generator.generate(schema);
|
|
673
|
-
}
|
|
674
|
-
//# sourceMappingURL=docs-generator.js.map
|