@plures/praxis 1.0.3 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FRAMEWORK.md +55 -5
- package/README.md +162 -375
- package/core/codegen/docs-generator.ts +5 -2
- package/core/codegen/index.ts +1 -1
- 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 +215139 -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-QRYKRIDU.js +210960 -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 +58 -23
- 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/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/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,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Documentation Generator
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Generates Markdown documentation from PSF schemas.
|
|
5
5
|
* Produces API docs, architecture diagrams, and user guides.
|
|
6
6
|
*/
|
|
@@ -802,7 +802,10 @@ export function createDocsGenerator(options?: DocsGeneratorOptions): DocsGenerat
|
|
|
802
802
|
/**
|
|
803
803
|
* Generate documentation from PSF schema (convenience function)
|
|
804
804
|
*/
|
|
805
|
-
export function generateDocs(
|
|
805
|
+
export function generateDocs(
|
|
806
|
+
schema: PSFSchema,
|
|
807
|
+
options?: DocsGeneratorOptions
|
|
808
|
+
): DocsGenerationResult {
|
|
806
809
|
const generator = new DocsGenerator(options);
|
|
807
810
|
return generator.generate(schema);
|
|
808
811
|
}
|
package/core/codegen/index.ts
CHANGED
package/core/db-adapter/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PSF Schema Sync Engine
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Provides real-time bidirectional synchronization between
|
|
5
5
|
* Code ↔ PSF Schema ↔ Canvas using PluresDB as the sync backend.
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* The sync engine ensures that:
|
|
8
8
|
* 1. Schema changes propagate to all connected clients in real-time
|
|
9
9
|
* 2. Conflicts are resolved using CRDT-style last-write-wins with metadata
|
|
@@ -63,7 +63,7 @@ export interface SyncStatus {
|
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* Schema Sync Engine
|
|
66
|
-
*
|
|
66
|
+
*
|
|
67
67
|
* Manages real-time synchronization of PSF schemas.
|
|
68
68
|
*/
|
|
69
69
|
export class SchemaSyncEngine {
|
|
@@ -292,7 +292,15 @@ export class SchemaSyncEngine {
|
|
|
292
292
|
const changes: SchemaChangeEvent[] = [];
|
|
293
293
|
const now = Date.now();
|
|
294
294
|
|
|
295
|
-
const keys: (keyof PSFSchema)[] = [
|
|
295
|
+
const keys: (keyof PSFSchema)[] = [
|
|
296
|
+
'facts',
|
|
297
|
+
'events',
|
|
298
|
+
'rules',
|
|
299
|
+
'constraints',
|
|
300
|
+
'models',
|
|
301
|
+
'components',
|
|
302
|
+
'flows',
|
|
303
|
+
];
|
|
296
304
|
|
|
297
305
|
for (const key of keys) {
|
|
298
306
|
const oldArray = oldSchema[key] as unknown[];
|
|
@@ -354,7 +362,7 @@ export function createSchemaSyncEngine(options: SchemaSyncOptions): SchemaSyncEn
|
|
|
354
362
|
|
|
355
363
|
/**
|
|
356
364
|
* Schema store for PluresDB
|
|
357
|
-
*
|
|
365
|
+
*
|
|
358
366
|
* Provides a higher-level API for storing and managing PSF schemas.
|
|
359
367
|
*/
|
|
360
368
|
export class PSFSchemaStore {
|
|
@@ -414,7 +422,10 @@ export class PSFSchemaStore {
|
|
|
414
422
|
/**
|
|
415
423
|
* Get or create a sync engine for a schema
|
|
416
424
|
*/
|
|
417
|
-
async getSyncEngine(
|
|
425
|
+
async getSyncEngine(
|
|
426
|
+
schemaId: string,
|
|
427
|
+
options?: Partial<SchemaSyncOptions>
|
|
428
|
+
): Promise<SchemaSyncEngine> {
|
|
418
429
|
if (this.syncEngines.has(schemaId)) {
|
|
419
430
|
return this.syncEngines.get(schemaId)!;
|
|
420
431
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Praxis Logic Engine
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* The Logic Engine is the core module responsible for:
|
|
5
5
|
* - Processing events through rules
|
|
6
6
|
* - Checking constraints
|
|
7
7
|
* - Managing state transitions
|
|
8
8
|
* - Schema-driven rule evaluation
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
* The engine is pure and deterministic - all state updates are immutable.
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PSF-Aware Logic Engine Adapter
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* This module connects the logic engine to the Praxis Schema Format (PSF).
|
|
5
5
|
* It enables schema-driven rule evaluation and constraint checking.
|
|
6
6
|
*/
|
|
@@ -29,7 +29,7 @@ interface CompiledExpression {
|
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* PSF Adapter for Logic Engine
|
|
32
|
-
*
|
|
32
|
+
*
|
|
33
33
|
* Converts PSF rules and constraints to logic engine format.
|
|
34
34
|
*/
|
|
35
35
|
export class PSFLogicAdapter {
|
|
@@ -108,7 +108,9 @@ export class PSFLogicAdapter {
|
|
|
108
108
|
/**
|
|
109
109
|
* Convert PSF constraints to logic engine constraint descriptors
|
|
110
110
|
*/
|
|
111
|
-
convertConstraints<TContext = unknown>(
|
|
111
|
+
convertConstraints<TContext = unknown>(
|
|
112
|
+
constraints: PSFConstraint[]
|
|
113
|
+
): ConstraintDescriptor<TContext>[] {
|
|
112
114
|
return constraints.map((constraint) => this.convertConstraint<TContext>(constraint));
|
|
113
115
|
}
|
|
114
116
|
|
|
@@ -142,7 +144,9 @@ export class PSFLogicAdapter {
|
|
|
142
144
|
/**
|
|
143
145
|
* Load a complete PSF schema into the logic engine
|
|
144
146
|
*/
|
|
145
|
-
loadSchema<TContext = unknown>(
|
|
147
|
+
loadSchema<TContext = unknown>(
|
|
148
|
+
schema: PSFSchema
|
|
149
|
+
): {
|
|
146
150
|
rules: RuleDescriptor<TContext>[];
|
|
147
151
|
constraints: ConstraintDescriptor<TContext>[];
|
|
148
152
|
} {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PSF Compiler
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Compiles TypeScript DSL definitions to PSF format.
|
|
5
5
|
* This enables code → schema synchronization.
|
|
6
6
|
*/
|
|
@@ -24,13 +24,49 @@ import { PSF_VERSION, generatePSFId } from './psf.js';
|
|
|
24
24
|
* Reserved JavaScript keywords (O(1) lookup)
|
|
25
25
|
*/
|
|
26
26
|
const RESERVED_KEYWORDS = new Set([
|
|
27
|
-
'break',
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
27
|
+
'break',
|
|
28
|
+
'case',
|
|
29
|
+
'catch',
|
|
30
|
+
'class',
|
|
31
|
+
'const',
|
|
32
|
+
'continue',
|
|
33
|
+
'debugger',
|
|
34
|
+
'default',
|
|
35
|
+
'delete',
|
|
36
|
+
'do',
|
|
37
|
+
'else',
|
|
38
|
+
'export',
|
|
39
|
+
'extends',
|
|
40
|
+
'finally',
|
|
41
|
+
'for',
|
|
42
|
+
'function',
|
|
43
|
+
'if',
|
|
44
|
+
'import',
|
|
45
|
+
'in',
|
|
46
|
+
'instanceof',
|
|
47
|
+
'new',
|
|
48
|
+
'return',
|
|
49
|
+
'super',
|
|
50
|
+
'switch',
|
|
51
|
+
'this',
|
|
52
|
+
'throw',
|
|
53
|
+
'try',
|
|
54
|
+
'typeof',
|
|
55
|
+
'var',
|
|
56
|
+
'void',
|
|
57
|
+
'while',
|
|
58
|
+
'with',
|
|
59
|
+
'yield',
|
|
60
|
+
'let',
|
|
61
|
+
'static',
|
|
62
|
+
'enum',
|
|
63
|
+
'await',
|
|
64
|
+
'implements',
|
|
65
|
+
'interface',
|
|
66
|
+
'package',
|
|
67
|
+
'private',
|
|
68
|
+
'protected',
|
|
69
|
+
'public',
|
|
34
70
|
]);
|
|
35
71
|
|
|
36
72
|
/**
|
|
@@ -183,7 +219,10 @@ export class PSFCompiler {
|
|
|
183
219
|
warnings: this.warnings,
|
|
184
220
|
};
|
|
185
221
|
} catch (error) {
|
|
186
|
-
this.addError(
|
|
222
|
+
this.addError(
|
|
223
|
+
'compilation-failed',
|
|
224
|
+
error instanceof Error ? error.message : 'Unknown compilation error'
|
|
225
|
+
);
|
|
187
226
|
return {
|
|
188
227
|
success: false,
|
|
189
228
|
errors: this.errors,
|
|
@@ -364,13 +403,16 @@ export class PSFCompiler {
|
|
|
364
403
|
|
|
365
404
|
// Handle enum types
|
|
366
405
|
if (typeStr.startsWith('enum:')) {
|
|
367
|
-
const values = typeStr
|
|
406
|
+
const values = typeStr
|
|
407
|
+
.slice(5)
|
|
408
|
+
.split('|')
|
|
409
|
+
.map((v) => v.trim());
|
|
368
410
|
return { enum: values };
|
|
369
411
|
}
|
|
370
412
|
|
|
371
413
|
// Handle basic types
|
|
372
414
|
const basicTypes = ['string', 'number', 'boolean', 'date', 'datetime', 'uuid'] as const;
|
|
373
|
-
if (basicTypes.includes(typeStr as typeof basicTypes[number])) {
|
|
415
|
+
if (basicTypes.includes(typeStr as (typeof basicTypes)[number])) {
|
|
374
416
|
return typeStr as PSFFieldType;
|
|
375
417
|
}
|
|
376
418
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PSF Generator
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Generates TypeScript DSL code from PSF schema.
|
|
5
5
|
* This enables schema → code synchronization.
|
|
6
6
|
*/
|
|
@@ -150,7 +150,9 @@ export class PSFGenerator {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
const payloadType = this.generatePayloadType(fact.payload);
|
|
153
|
-
lines.push(
|
|
153
|
+
lines.push(
|
|
154
|
+
`export const ${fact.tag} = defineFact<"${fact.tag}", ${payloadType}>("${fact.tag}");`
|
|
155
|
+
);
|
|
154
156
|
lines.push('');
|
|
155
157
|
}
|
|
156
158
|
|
|
@@ -182,7 +184,9 @@ export class PSFGenerator {
|
|
|
182
184
|
}
|
|
183
185
|
|
|
184
186
|
const payloadType = this.generatePayloadType(event.payload);
|
|
185
|
-
lines.push(
|
|
187
|
+
lines.push(
|
|
188
|
+
`export const ${event.tag} = defineEvent<"${event.tag}", ${payloadType}>("${event.tag}");`
|
|
189
|
+
);
|
|
186
190
|
lines.push('');
|
|
187
191
|
}
|
|
188
192
|
|
|
@@ -390,7 +394,9 @@ export class PSFGenerator {
|
|
|
390
394
|
if (component.props.length > 0) {
|
|
391
395
|
lines.push(` props: [`);
|
|
392
396
|
for (const prop of component.props) {
|
|
393
|
-
lines.push(
|
|
397
|
+
lines.push(
|
|
398
|
+
` { name: '${prop.name}', type: '${prop.type}', required: ${prop.required ?? false} },`
|
|
399
|
+
);
|
|
394
400
|
}
|
|
395
401
|
lines.push(` ],`);
|
|
396
402
|
}
|
|
@@ -398,7 +404,9 @@ export class PSFGenerator {
|
|
|
398
404
|
if (component.events.length > 0) {
|
|
399
405
|
lines.push(` events: [`);
|
|
400
406
|
for (const event of component.events) {
|
|
401
|
-
lines.push(
|
|
407
|
+
lines.push(
|
|
408
|
+
` { name: '${event.name}'${event.payload ? `, payload: '${event.payload}'` : ''} },`
|
|
409
|
+
);
|
|
402
410
|
}
|
|
403
411
|
lines.push(` ],`);
|
|
404
412
|
}
|
|
@@ -525,7 +533,9 @@ export class PSFGenerator {
|
|
|
525
533
|
/**
|
|
526
534
|
* Generate TypeScript type from payload schema
|
|
527
535
|
*/
|
|
528
|
-
private generatePayloadType(payload: {
|
|
536
|
+
private generatePayloadType(payload: {
|
|
537
|
+
properties: Record<string, { type: PSFFieldType | string; description?: string }>;
|
|
538
|
+
}): string {
|
|
529
539
|
const props = Object.entries(payload.properties)
|
|
530
540
|
.map(([key, value]) => `${key}: ${this.fieldTypeToTS(value.type)}`)
|
|
531
541
|
.join('; ');
|
|
@@ -611,7 +621,7 @@ export class PSFGenerator {
|
|
|
611
621
|
*/
|
|
612
622
|
private escapeString(str: string): string {
|
|
613
623
|
return str
|
|
614
|
-
.replace(/\\/g, '\\\\')
|
|
624
|
+
.replace(/\\/g, '\\\\') // Escape backslashes first
|
|
615
625
|
.replace(/'/g, "\\'")
|
|
616
626
|
.replace(/\n/g, '\\n')
|
|
617
627
|
.replace(/\r/g, '\\r')
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Praxis Schema Engine
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* The Schema Engine is the central module responsible for:
|
|
5
5
|
* - Parsing and validating Praxis Schema Format (PSF)
|
|
6
6
|
* - Compiling TS DSL to PSF
|
|
7
7
|
* - Generating TS DSL from PSF
|
|
8
8
|
* - Managing schema transformations
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
* PSF (Praxis Schema Format) is the canonical JSON/AST representation
|
|
11
11
|
* that serves as the single source of truth for all Praxis applications.
|
|
12
12
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Praxis Schema Format (PSF) Types
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* PSF is the canonical AST format that serves as the single source of truth.
|
|
5
5
|
* All code, canvas, and documentation are derived from or synchronized with PSF.
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* Design principles:
|
|
8
8
|
* - JSON-serializable for persistence and transmission
|
|
9
9
|
* - Supports bidirectional code ↔ canvas sync
|
|
@@ -211,7 +211,16 @@ export type PSFFieldType =
|
|
|
211
211
|
*/
|
|
212
212
|
export interface PSFValidation {
|
|
213
213
|
/** Validation type */
|
|
214
|
-
type:
|
|
214
|
+
type:
|
|
215
|
+
| 'required'
|
|
216
|
+
| 'min'
|
|
217
|
+
| 'max'
|
|
218
|
+
| 'minLength'
|
|
219
|
+
| 'maxLength'
|
|
220
|
+
| 'pattern'
|
|
221
|
+
| 'email'
|
|
222
|
+
| 'url'
|
|
223
|
+
| 'custom';
|
|
215
224
|
/** Validation value */
|
|
216
225
|
value?: unknown;
|
|
217
226
|
/** Error message */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Schema Engine Types
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Re-exports types from the schema engine for external use.
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -49,15 +49,7 @@ export type {
|
|
|
49
49
|
} from './compiler.js';
|
|
50
50
|
|
|
51
51
|
// Generator Types
|
|
52
|
-
export type {
|
|
53
|
-
GeneratorOptions,
|
|
54
|
-
GeneratedFile,
|
|
55
|
-
GenerationResult,
|
|
56
|
-
} from './generator.js';
|
|
52
|
+
export type { GeneratorOptions, GeneratedFile, GenerationResult } from './generator.js';
|
|
57
53
|
|
|
58
54
|
// Validator Types
|
|
59
|
-
export type {
|
|
60
|
-
ValidationResult,
|
|
61
|
-
ValidationError,
|
|
62
|
-
ValidationOptions,
|
|
63
|
-
} from './validator.js';
|
|
55
|
+
export type { ValidationResult, ValidationError, ValidationOptions } from './validator.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PSF Validator
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Validates PSF schemas for correctness, completeness, and consistency.
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -63,13 +63,49 @@ export interface ValidationOptions {
|
|
|
63
63
|
* Reserved JavaScript keywords
|
|
64
64
|
*/
|
|
65
65
|
const RESERVED_KEYWORDS = new Set([
|
|
66
|
-
'break',
|
|
67
|
-
'
|
|
68
|
-
'
|
|
69
|
-
'
|
|
70
|
-
'
|
|
71
|
-
'
|
|
72
|
-
'
|
|
66
|
+
'break',
|
|
67
|
+
'case',
|
|
68
|
+
'catch',
|
|
69
|
+
'class',
|
|
70
|
+
'const',
|
|
71
|
+
'continue',
|
|
72
|
+
'debugger',
|
|
73
|
+
'default',
|
|
74
|
+
'delete',
|
|
75
|
+
'do',
|
|
76
|
+
'else',
|
|
77
|
+
'export',
|
|
78
|
+
'extends',
|
|
79
|
+
'finally',
|
|
80
|
+
'for',
|
|
81
|
+
'function',
|
|
82
|
+
'if',
|
|
83
|
+
'import',
|
|
84
|
+
'in',
|
|
85
|
+
'instanceof',
|
|
86
|
+
'new',
|
|
87
|
+
'return',
|
|
88
|
+
'super',
|
|
89
|
+
'switch',
|
|
90
|
+
'this',
|
|
91
|
+
'throw',
|
|
92
|
+
'try',
|
|
93
|
+
'typeof',
|
|
94
|
+
'var',
|
|
95
|
+
'void',
|
|
96
|
+
'while',
|
|
97
|
+
'with',
|
|
98
|
+
'yield',
|
|
99
|
+
'let',
|
|
100
|
+
'static',
|
|
101
|
+
'enum',
|
|
102
|
+
'await',
|
|
103
|
+
'implements',
|
|
104
|
+
'interface',
|
|
105
|
+
'package',
|
|
106
|
+
'private',
|
|
107
|
+
'protected',
|
|
108
|
+
'public',
|
|
73
109
|
]);
|
|
74
110
|
|
|
75
111
|
/**
|
|
@@ -176,7 +212,11 @@ export class PSFValidator {
|
|
|
176
212
|
if (!fact.tag) {
|
|
177
213
|
this.addError(`${path}.tag`, 'Fact tag is required', 'missing-tag');
|
|
178
214
|
} else if (this.options.checkNaming && !this.isValidIdentifier(fact.tag)) {
|
|
179
|
-
this.addError(
|
|
215
|
+
this.addError(
|
|
216
|
+
`${path}.tag`,
|
|
217
|
+
`"${fact.tag}" is not a valid identifier`,
|
|
218
|
+
'invalid-identifier'
|
|
219
|
+
);
|
|
180
220
|
}
|
|
181
221
|
|
|
182
222
|
if (!fact.payload) {
|
|
@@ -199,7 +239,11 @@ export class PSFValidator {
|
|
|
199
239
|
if (!event.tag) {
|
|
200
240
|
this.addError(`${path}.tag`, 'Event tag is required', 'missing-tag');
|
|
201
241
|
} else if (this.options.checkNaming && !this.isValidIdentifier(event.tag)) {
|
|
202
|
-
this.addError(
|
|
242
|
+
this.addError(
|
|
243
|
+
`${path}.tag`,
|
|
244
|
+
`"${event.tag}" is not a valid identifier`,
|
|
245
|
+
'invalid-identifier'
|
|
246
|
+
);
|
|
203
247
|
}
|
|
204
248
|
|
|
205
249
|
if (!event.payload) {
|
|
@@ -222,7 +266,11 @@ export class PSFValidator {
|
|
|
222
266
|
}
|
|
223
267
|
|
|
224
268
|
if (!rule.description) {
|
|
225
|
-
this.addWarning(
|
|
269
|
+
this.addWarning(
|
|
270
|
+
`${path}.description`,
|
|
271
|
+
'Rule description is recommended',
|
|
272
|
+
'missing-description'
|
|
273
|
+
);
|
|
226
274
|
}
|
|
227
275
|
|
|
228
276
|
if (!rule.then) {
|
|
@@ -256,7 +304,11 @@ export class PSFValidator {
|
|
|
256
304
|
}
|
|
257
305
|
|
|
258
306
|
if (!constraint.description) {
|
|
259
|
-
this.addWarning(
|
|
307
|
+
this.addWarning(
|
|
308
|
+
`${path}.description`,
|
|
309
|
+
'Constraint description is recommended',
|
|
310
|
+
'missing-description'
|
|
311
|
+
);
|
|
260
312
|
}
|
|
261
313
|
|
|
262
314
|
if (!constraint.check) {
|
|
@@ -264,7 +316,11 @@ export class PSFValidator {
|
|
|
264
316
|
}
|
|
265
317
|
|
|
266
318
|
if (!constraint.errorMessage) {
|
|
267
|
-
this.addWarning(
|
|
319
|
+
this.addWarning(
|
|
320
|
+
`${path}.errorMessage`,
|
|
321
|
+
'Constraint error message is recommended',
|
|
322
|
+
'missing-error-message'
|
|
323
|
+
);
|
|
268
324
|
}
|
|
269
325
|
});
|
|
270
326
|
}
|
|
@@ -283,7 +339,11 @@ export class PSFValidator {
|
|
|
283
339
|
if (!model.name) {
|
|
284
340
|
this.addError(`${path}.name`, 'Model name is required', 'missing-name');
|
|
285
341
|
} else if (this.options.checkNaming && !this.isValidTypeName(model.name)) {
|
|
286
|
-
this.addError(
|
|
342
|
+
this.addError(
|
|
343
|
+
`${path}.name`,
|
|
344
|
+
`"${model.name}" is not a valid type name (should be PascalCase)`,
|
|
345
|
+
'invalid-type-name'
|
|
346
|
+
);
|
|
287
347
|
}
|
|
288
348
|
|
|
289
349
|
if (!model.fields || model.fields.length === 0) {
|
|
@@ -297,7 +357,10 @@ export class PSFValidator {
|
|
|
297
357
|
/**
|
|
298
358
|
* Validate model fields
|
|
299
359
|
*/
|
|
300
|
-
private validateModelFields(
|
|
360
|
+
private validateModelFields(
|
|
361
|
+
fields: { name: string; type: PSFFieldType; optional?: boolean }[],
|
|
362
|
+
basePath: string
|
|
363
|
+
): void {
|
|
301
364
|
const fieldNames = new Set<string>();
|
|
302
365
|
|
|
303
366
|
fields.forEach((field, index) => {
|
|
@@ -312,7 +375,11 @@ export class PSFValidator {
|
|
|
312
375
|
fieldNames.add(field.name);
|
|
313
376
|
|
|
314
377
|
if (this.options.checkNaming && !this.isValidPropertyName(field.name)) {
|
|
315
|
-
this.addWarning(
|
|
378
|
+
this.addWarning(
|
|
379
|
+
`${path}.name`,
|
|
380
|
+
`"${field.name}" should be camelCase`,
|
|
381
|
+
'naming-convention'
|
|
382
|
+
);
|
|
316
383
|
}
|
|
317
384
|
}
|
|
318
385
|
|
|
@@ -390,12 +457,20 @@ export class PSFValidator {
|
|
|
390
457
|
if (step.next) {
|
|
391
458
|
if (typeof step.next === 'string') {
|
|
392
459
|
if (!stepIds.has(step.next)) {
|
|
393
|
-
this.addError(
|
|
460
|
+
this.addError(
|
|
461
|
+
`${stepPath}.next`,
|
|
462
|
+
`Step "${step.next}" does not exist`,
|
|
463
|
+
'invalid-step-reference'
|
|
464
|
+
);
|
|
394
465
|
}
|
|
395
466
|
} else {
|
|
396
467
|
Object.values(step.next).forEach((nextId) => {
|
|
397
468
|
if (!stepIds.has(nextId)) {
|
|
398
|
-
this.addError(
|
|
469
|
+
this.addError(
|
|
470
|
+
`${stepPath}.next`,
|
|
471
|
+
`Step "${nextId}" does not exist`,
|
|
472
|
+
'invalid-step-reference'
|
|
473
|
+
);
|
|
399
474
|
}
|
|
400
475
|
});
|
|
401
476
|
}
|
|
@@ -404,7 +479,11 @@ export class PSFValidator {
|
|
|
404
479
|
|
|
405
480
|
// Check initial step
|
|
406
481
|
if (flow.initial && !stepIds.has(flow.initial)) {
|
|
407
|
-
this.addError(
|
|
482
|
+
this.addError(
|
|
483
|
+
`${path}.initial`,
|
|
484
|
+
`Initial step "${flow.initial}" does not exist`,
|
|
485
|
+
'invalid-step-reference'
|
|
486
|
+
);
|
|
408
487
|
}
|
|
409
488
|
}
|
|
410
489
|
});
|
|
@@ -470,11 +549,19 @@ export class PSFValidator {
|
|
|
470
549
|
/**
|
|
471
550
|
* Check field type for references
|
|
472
551
|
*/
|
|
473
|
-
private checkFieldTypeReferences(
|
|
552
|
+
private checkFieldTypeReferences(
|
|
553
|
+
type: PSFFieldType,
|
|
554
|
+
modelNames: Set<string>,
|
|
555
|
+
path: string
|
|
556
|
+
): void {
|
|
474
557
|
if (typeof type === 'object') {
|
|
475
558
|
if ('reference' in type) {
|
|
476
559
|
if (!modelNames.has(type.reference)) {
|
|
477
|
-
this.addWarning(
|
|
560
|
+
this.addWarning(
|
|
561
|
+
path,
|
|
562
|
+
`Reference to unknown model "${type.reference}"`,
|
|
563
|
+
'unknown-reference'
|
|
564
|
+
);
|
|
478
565
|
}
|
|
479
566
|
} else if ('array' in type) {
|
|
480
567
|
this.checkFieldTypeReferences(type.array, modelNames, path);
|
|
@@ -535,7 +622,10 @@ export function createPSFValidator(options?: ValidationOptions): PSFValidator {
|
|
|
535
622
|
/**
|
|
536
623
|
* Validate a PSF schema (convenience function)
|
|
537
624
|
*/
|
|
538
|
-
export function validatePSFSchema(
|
|
625
|
+
export function validatePSFSchema(
|
|
626
|
+
schema: PSFSchema,
|
|
627
|
+
options?: ValidationOptions
|
|
628
|
+
): ValidationResult {
|
|
539
629
|
const validator = new PSFValidator(options);
|
|
540
630
|
return validator.validate(schema);
|
|
541
631
|
}
|