domainforge 0.13.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/.cargo/config.toml +6 -0
- package/.claude/settings.local.json +18 -0
- package/.coderabbit.yml +43 -0
- package/.codex/skills/release-management/SKILL.md +151 -0
- package/.codex/skills/release-management/agents/openai.yaml +4 -0
- package/.github/actions/decrypt-secrets/action.yml +121 -0
- package/.github/agents/Coder.agent.md +97 -0
- package/.github/agents/DeepResearch.agent.md +61 -0
- package/.github/chatmodes/tdd.vibepro.chatmode.md +1183 -0
- package/.github/copilot-instructions.md +13 -0
- package/.github/dependabot.yml +68 -0
- package/.github/workflows/README.md +165 -0
- package/.github/workflows/ci.yml +335 -0
- package/.github/workflows/dependabot-automerge.yml +114 -0
- package/.github/workflows/dependency-review.yml +27 -0
- package/.github/workflows/deploy.yml +87 -0
- package/.github/workflows/prepare-release.yml +168 -0
- package/.github/workflows/release-crates.yml +42 -0
- package/.github/workflows/release-npm.yml +137 -0
- package/.github/workflows/release-please.yml +29 -0
- package/.github/workflows/release-pypi.yml +96 -0
- package/.gitkeep +1 -0
- package/.release-please-manifest.json +5 -0
- package/.sea-registry.toml +10 -0
- package/.serena/project.yml +133 -0
- package/.sops.yaml +10 -0
- package/AGENTS.md +216 -0
- package/CHANGELOG.md +400 -0
- package/CLAUDE.md +62 -0
- package/CONTRIBUTING.md +323 -0
- package/Cargo.lock +3612 -0
- package/Cargo.toml +12 -0
- package/LICENSE +201 -0
- package/README.md +660 -0
- package/README_PYTHON.md +256 -0
- package/README_TYPESCRIPT.md +305 -0
- package/README_WASM.md +329 -0
- package/RELEASE_NOTES.md +41 -0
- package/bun.lock +378 -0
- package/bunfig.toml +11 -0
- package/check_output.txt +83 -0
- package/clippy_output.txt +80 -0
- package/commitlint.config.cjs +8 -0
- package/deny.toml +42 -0
- package/devbox.json +14 -0
- package/devbox.lock +76 -0
- package/docs/RELEASE_PROCESS.md +360 -0
- package/docs/diagnostics.md +161 -0
- package/docs/doc_guidelines.md +53 -0
- package/docs/explanations/README.md +21 -0
- package/docs/explanations/architecture-overview.md +109 -0
- package/docs/explanations/cross-language-binding-strategy.md +68 -0
- package/docs/explanations/graph-store-design.md +47 -0
- package/docs/explanations/performance-benchmarks.md +63 -0
- package/docs/explanations/policy-evaluation-logic.md +106 -0
- package/docs/explanations/semantic-modeling-concepts.md +109 -0
- package/docs/explanations/three-valued-logic.md +66 -0
- package/docs/explanations/versioning-strategy.md +45 -0
- package/docs/governance.md +168 -0
- package/docs/how-tos/README.md +46 -0
- package/docs/how-tos/ci-cd-validation.md +93 -0
- package/docs/how-tos/create-custom-units.md +125 -0
- package/docs/how-tos/define-policies.md +119 -0
- package/docs/how-tos/export-to-calm.md +110 -0
- package/docs/how-tos/export-to-protobuf.md +312 -0
- package/docs/how-tos/extend-grammar.md +133 -0
- package/docs/how-tos/generate-rdf-turtle.md +106 -0
- package/docs/how-tos/import-from-calm.md +114 -0
- package/docs/how-tos/import-from-sbvr.md +249 -0
- package/docs/how-tos/install-cli.md +126 -0
- package/docs/how-tos/parse-sea-files.md +132 -0
- package/docs/how-tos/policy-evaluation-modes.md +30 -0
- package/docs/how-tos/run-cross-language-tests.md +115 -0
- package/docs/how-tos/troubleshoot-napi-builds.md +55 -0
- package/docs/how-tos/use-modules-imports.md +285 -0
- package/docs/index.md +13 -0
- package/docs/plans/canonical-normalizer.md +121 -0
- package/docs/plans/cd_improvement.md +112 -0
- package/docs/plans/cli-ast.md +29 -0
- package/docs/plans/expression-bindings-and-normalizer-integration.md +174 -0
- package/docs/plans/protobuf_advanced_features_plan.md +597 -0
- package/docs/plans/protobuf_plan.yml +525 -0
- package/docs/plans/refactor_dsl_architecture.md +131 -0
- package/docs/plans/release-plan.md +163 -0
- package/docs/plans/sea_fmt_implementation_plan.md +516 -0
- package/docs/playbooks/README.md +18 -0
- package/docs/playbooks/adding-new-primitive.md +68 -0
- package/docs/playbooks/debugging-parser-failures.md +42 -0
- package/docs/playbooks/local-release-preparation.md +139 -0
- package/docs/playbooks/migrating-schema-versions.md +43 -0
- package/docs/playbooks/onboarding-contributors.md +64 -0
- package/docs/playbooks/releasing-beta.md +86 -0
- package/docs/playbooks/secret-management.md +64 -0
- package/docs/reference/README.md +199 -0
- package/docs/reference/ast-json-api.md +427 -0
- package/docs/reference/calm-mapping.md +519 -0
- package/docs/reference/cli-commands.md +588 -0
- package/docs/reference/configuration.md +202 -0
- package/docs/reference/error-codes.md +664 -0
- package/docs/reference/generated-artifacts-policy.md +53 -0
- package/docs/reference/grammar-spec.md +255 -0
- package/docs/reference/primitives-api.md +317 -0
- package/docs/reference/protobuf-api.md +426 -0
- package/docs/reference/python-api.md +485 -0
- package/docs/reference/registry.md +50 -0
- package/docs/reference/sea-dsl-ai-cheatsheet.yaml +913 -0
- package/docs/reference/security-model.md +74 -0
- package/docs/reference/typescript-api.md +508 -0
- package/docs/reference/wasm-api.md +420 -0
- package/docs/semantic-pack-review.md +144 -0
- package/docs/semantic-pack-signing.md +234 -0
- package/docs/semantic-packs.md +284 -0
- package/docs/specs/ADR-001-sea-dsl-semantic-source-of-truth.md +33 -0
- package/docs/specs/ADR-002-projection-first-class-construct.md +50 -0
- package/docs/specs/ADR-003-protobuf-projection-target.md +51 -0
- package/docs/specs/ADR-004-projection-compatibility-semantics.md +57 -0
- package/docs/specs/ADR-005-multi-language-support-strategy.md +112 -0
- package/docs/specs/ADR-006-error-handling-strategy.md +115 -0
- package/docs/specs/ADR-007-policy-evaluation-engine.md +95 -0
- package/docs/specs/ADR-008-knowledge-graph-integration.md +90 -0
- package/docs/specs/ADR-009-module-resolution-strategy.md +115 -0
- package/docs/specs/ADR-010-unit-system.md +106 -0
- package/docs/specs/PRD-001-sea-projection-framework.md +155 -0
- package/docs/specs/PRD-002-sea-cli-tooling.md +169 -0
- package/docs/specs/PRD-003-dsl-core-capabilities.md +275 -0
- package/docs/specs/README.md +62 -0
- package/docs/specs/SDS-001-protobuf-projection-engine.md +451 -0
- package/docs/specs/SDS-002-sea-core-architecture.md +268 -0
- package/docs/specs/SDS-003-parser-semantic-graph.md +377 -0
- package/docs/specs/SDS-004-policy-engine-design.md +362 -0
- package/docs/specs/SDS-005-knowledge-graph-module.md +364 -0
- package/docs/specs/SDS-006-calm-integration.md +367 -0
- package/docs/specs/SDS-007-sbvr-import.md +347 -0
- package/docs/templates/template_explanation.md +14 -0
- package/docs/templates/template_howto.md +21 -0
- package/docs/templates/template_playbook.md +21 -0
- package/docs/templates/template_reference.md +17 -0
- package/docs/templates/template_tutorial.md +24 -0
- package/docs/tutorials/README.md +12 -0
- package/docs/tutorials/first-sea-model.md +85 -0
- package/docs/tutorials/getting-started.md +98 -0
- package/docs/tutorials/python-binding-quickstart.md +107 -0
- package/docs/tutorials/typescript-binding-quickstart.md +91 -0
- package/docs/tutorials/wasm-in-browser.md +75 -0
- package/domainforge-core/CHANGELOG.md +138 -0
- package/domainforge-core/Cargo.toml +101 -0
- package/domainforge-core/MIGRATING.md +32 -0
- package/domainforge-core/README.md +197 -0
- package/domainforge-core/benchmark_results.txt +51 -0
- package/domainforge-core/build.rs +6 -0
- package/domainforge-core/deny.toml +31 -0
- package/domainforge-core/docs/specs/projections/sbvr_kg_mapping.md +43 -0
- package/domainforge-core/examples/basic.sea +7 -0
- package/domainforge-core/examples/cli/import_export_workflow.sh +38 -0
- package/domainforge-core/examples/cli/validate_example.sh +30 -0
- package/domainforge-core/examples/evolution_semantics.sea +31 -0
- package/domainforge-core/examples/parser_demo.rs +203 -0
- package/domainforge-core/grammar/sea.pest +408 -0
- package/domainforge-core/schemas/calm-v1.schema.json +170 -0
- package/domainforge-core/schemas/shacl/sea_shapes.ttl +19 -0
- package/domainforge-core/src/authority/compiler.rs +309 -0
- package/domainforge-core/src/authority/environment.rs +203 -0
- package/domainforge-core/src/authority/error.rs +164 -0
- package/domainforge-core/src/authority/fact_resolver.rs +224 -0
- package/domainforge-core/src/authority/mod.rs +25 -0
- package/domainforge-core/src/authority/pack.rs +133 -0
- package/domainforge-core/src/authority/policy.rs +224 -0
- package/domainforge-core/src/authority/resolver.rs +446 -0
- package/domainforge-core/src/authority/trace.rs +217 -0
- package/domainforge-core/src/authority/transform.rs +168 -0
- package/domainforge-core/src/authority/types.rs +617 -0
- package/domainforge-core/src/bin/domainforge.rs +25 -0
- package/domainforge-core/src/calm/export.rs +538 -0
- package/domainforge-core/src/calm/import.rs +1220 -0
- package/domainforge-core/src/calm/mod.rs +9 -0
- package/domainforge-core/src/calm/models.rs +108 -0
- package/domainforge-core/src/calm/sbvr_import.rs +9 -0
- package/domainforge-core/src/cli/authority.rs +149 -0
- package/domainforge-core/src/cli/format.rs +85 -0
- package/domainforge-core/src/cli/import.rs +133 -0
- package/domainforge-core/src/cli/mod.rs +64 -0
- package/domainforge-core/src/cli/normalize.rs +180 -0
- package/domainforge-core/src/cli/pack.rs +904 -0
- package/domainforge-core/src/cli/parse.rs +112 -0
- package/domainforge-core/src/cli/project.rs +294 -0
- package/domainforge-core/src/cli/registry.rs +41 -0
- package/domainforge-core/src/cli/test.rs +12 -0
- package/domainforge-core/src/cli/validate.rs +195 -0
- package/domainforge-core/src/cli/validate_kg.rs +80 -0
- package/domainforge-core/src/concept_id.rs +89 -0
- package/domainforge-core/src/error/diagnostics.rs +426 -0
- package/domainforge-core/src/error/fuzzy.rs +253 -0
- package/domainforge-core/src/error/mod.rs +13 -0
- package/domainforge-core/src/formatter/comments.rs +223 -0
- package/domainforge-core/src/formatter/config.rs +114 -0
- package/domainforge-core/src/formatter/mod.rs +22 -0
- package/domainforge-core/src/formatter/printer.rs +906 -0
- package/domainforge-core/src/graph/mod.rs +858 -0
- package/domainforge-core/src/graph/to_ast.rs +66 -0
- package/domainforge-core/src/kg.rs +1476 -0
- package/domainforge-core/src/kg_import.rs +251 -0
- package/domainforge-core/src/lib.rs +203 -0
- package/domainforge-core/src/module/mod.rs +1 -0
- package/domainforge-core/src/module/resolver.rs +260 -0
- package/domainforge-core/src/parser/ast.rs +2919 -0
- package/domainforge-core/src/parser/ast_convert.rs +494 -0
- package/domainforge-core/src/parser/ast_schema.rs +491 -0
- package/domainforge-core/src/parser/error.rs +291 -0
- package/domainforge-core/src/parser/lint.rs +39 -0
- package/domainforge-core/src/parser/mod.rs +193 -0
- package/domainforge-core/src/parser/printer.rs +702 -0
- package/domainforge-core/src/parser/profiles.rs +71 -0
- package/domainforge-core/src/parser/string_utils.rs +138 -0
- package/domainforge-core/src/patterns.rs +68 -0
- package/domainforge-core/src/policy/core.rs +1148 -0
- package/domainforge-core/src/policy/expression.rs +399 -0
- package/domainforge-core/src/policy/mod.rs +18 -0
- package/domainforge-core/src/policy/normalize.rs +1028 -0
- package/domainforge-core/src/policy/quantifier.rs +940 -0
- package/domainforge-core/src/policy/three_valued.rs +140 -0
- package/domainforge-core/src/policy/three_valued_microbench.rs +104 -0
- package/domainforge-core/src/policy/type_inference.rs +67 -0
- package/domainforge-core/src/policy/violation.rs +36 -0
- package/domainforge-core/src/primitives/concept_change.rs +61 -0
- package/domainforge-core/src/primitives/entity.rs +224 -0
- package/domainforge-core/src/primitives/flow.rs +111 -0
- package/domainforge-core/src/primitives/instance.rs +93 -0
- package/domainforge-core/src/primitives/mapping_contract.rs +50 -0
- package/domainforge-core/src/primitives/metric.rs +79 -0
- package/domainforge-core/src/primitives/mod.rs +25 -0
- package/domainforge-core/src/primitives/projection_contract.rs +50 -0
- package/domainforge-core/src/primitives/quantity.rs +56 -0
- package/domainforge-core/src/primitives/relation.rs +68 -0
- package/domainforge-core/src/primitives/resource.rs +237 -0
- package/domainforge-core/src/primitives/resource_instance.rs +88 -0
- package/domainforge-core/src/primitives/role.rs +49 -0
- package/domainforge-core/src/projection/buf.rs +404 -0
- package/domainforge-core/src/projection/contracts.rs +22 -0
- package/domainforge-core/src/projection/engine.rs +19 -0
- package/domainforge-core/src/projection/mod.rs +16 -0
- package/domainforge-core/src/projection/protobuf.rs +3331 -0
- package/domainforge-core/src/projection/registry.rs +43 -0
- package/domainforge-core/src/python/authority.rs +253 -0
- package/domainforge-core/src/python/error.rs +227 -0
- package/domainforge-core/src/python/formatter.rs +86 -0
- package/domainforge-core/src/python/graph.rs +366 -0
- package/domainforge-core/src/python/mod.rs +9 -0
- package/domainforge-core/src/python/policy.rs +651 -0
- package/domainforge-core/src/python/primitives.rs +796 -0
- package/domainforge-core/src/python/registry.rs +98 -0
- package/domainforge-core/src/python/semantic_pack.rs +619 -0
- package/domainforge-core/src/python/units.rs +96 -0
- package/domainforge-core/src/registry/mod.rs +432 -0
- package/domainforge-core/src/registry/tests.rs +210 -0
- package/domainforge-core/src/sbvr.rs +744 -0
- package/domainforge-core/src/semantic_pack/builder.rs +470 -0
- package/domainforge-core/src/semantic_pack/canonical_json.rs +184 -0
- package/domainforge-core/src/semantic_pack/diagnostics.rs +214 -0
- package/domainforge-core/src/semantic_pack/diff.rs +216 -0
- package/domainforge-core/src/semantic_pack/mod.rs +31 -0
- package/domainforge-core/src/semantic_pack/pack_set.rs +240 -0
- package/domainforge-core/src/semantic_pack/resolver.rs +437 -0
- package/domainforge-core/src/semantic_pack/review.rs +125 -0
- package/domainforge-core/src/semantic_pack/schema.rs +342 -0
- package/domainforge-core/src/semantic_pack/signing.rs +105 -0
- package/domainforge-core/src/semantic_pack/validator.rs +368 -0
- package/domainforge-core/src/semantic_version.rs +140 -0
- package/domainforge-core/src/test_utils.rs +12 -0
- package/domainforge-core/src/typescript/authority.rs +184 -0
- package/domainforge-core/src/typescript/error.rs +146 -0
- package/domainforge-core/src/typescript/formatter.rs +76 -0
- package/domainforge-core/src/typescript/graph.rs +391 -0
- package/domainforge-core/src/typescript/mod.rs +9 -0
- package/domainforge-core/src/typescript/policy.rs +564 -0
- package/domainforge-core/src/typescript/primitives.rs +784 -0
- package/domainforge-core/src/typescript/registry.rs +88 -0
- package/domainforge-core/src/typescript/semantic_pack.rs +470 -0
- package/domainforge-core/src/typescript/units.rs +76 -0
- package/domainforge-core/src/units/mod.rs +462 -0
- package/domainforge-core/src/uuid_module.rs +42 -0
- package/domainforge-core/src/validation_error.rs +818 -0
- package/domainforge-core/src/validation_result.rs +30 -0
- package/domainforge-core/src/wasm/authority.rs +192 -0
- package/domainforge-core/src/wasm/error.rs +145 -0
- package/domainforge-core/src/wasm/formatter.rs +69 -0
- package/domainforge-core/src/wasm/graph.rs +471 -0
- package/domainforge-core/src/wasm/mod.rs +16 -0
- package/domainforge-core/src/wasm/policy.rs +607 -0
- package/domainforge-core/src/wasm/primitives.rs +295 -0
- package/domainforge-core/src/wasm/semantic_pack.rs +471 -0
- package/domainforge-core/src/wasm/units.rs +62 -0
- package/domainforge-core/std/aws.sea +6 -0
- package/domainforge-core/std/core.sea +6 -0
- package/domainforge-core/std/http.sea +27 -0
- package/domainforge-core/tests/aggregation_enhanced_tests.rs +162 -0
- package/domainforge-core/tests/aggregation_eval_tests.rs +248 -0
- package/domainforge-core/tests/aggregation_integration_tests.rs +379 -0
- package/domainforge-core/tests/aggregation_parser_tests.rs +92 -0
- package/domainforge-core/tests/aggregation_tests.rs +102 -0
- package/domainforge-core/tests/authority_conformance_tests.rs +1173 -0
- package/domainforge-core/tests/calm_round_trip_tests.rs +283 -0
- package/domainforge-core/tests/calm_schema_validation_tests.rs +137 -0
- package/domainforge-core/tests/cast_operator_tests.rs +85 -0
- package/domainforge-core/tests/cli_binary_check.rs +37 -0
- package/domainforge-core/tests/cli_import_tests.rs +291 -0
- package/domainforge-core/tests/cli_path_traversal_tests.rs +124 -0
- package/domainforge-core/tests/cli_tests.rs +63 -0
- package/domainforge-core/tests/diagnostics_tests.rs +203 -0
- package/domainforge-core/tests/dimension_unit_tests.rs +80 -0
- package/domainforge-core/tests/entity_tests.rs +69 -0
- package/domainforge-core/tests/evolution_semantics_tests.rs +157 -0
- package/domainforge-core/tests/flow_tests.rs +78 -0
- package/domainforge-core/tests/flow_unit_validation_tests.rs +31 -0
- package/domainforge-core/tests/graph_integration_tests.rs +218 -0
- package/domainforge-core/tests/graph_tests.rs +626 -0
- package/domainforge-core/tests/import_parsing_tests.rs +23 -0
- package/domainforge-core/tests/instance_integration_tests.rs +98 -0
- package/domainforge-core/tests/instance_parsing_tests.rs +58 -0
- package/domainforge-core/tests/instance_tests.rs +61 -0
- package/domainforge-core/tests/kg_uri_encoding_tests.rs +53 -0
- package/domainforge-core/tests/lint_tests.rs +19 -0
- package/domainforge-core/tests/metric_tests.rs +143 -0
- package/domainforge-core/tests/module_resolution_tests.rs +100 -0
- package/domainforge-core/tests/namespace_registry_tests.rs +247 -0
- package/domainforge-core/tests/null_handling_tests.rs +26 -0
- package/domainforge-core/tests/parser_ast_v3.rs +53 -0
- package/domainforge-core/tests/parser_dimension_registry_tests.rs +20 -0
- package/domainforge-core/tests/parser_integration_tests.rs +294 -0
- package/domainforge-core/tests/parser_metadata_tests.rs +97 -0
- package/domainforge-core/tests/parser_resource_domain_only_graph_test.rs +21 -0
- package/domainforge-core/tests/parser_resource_limits_tests.rs +122 -0
- package/domainforge-core/tests/parser_tests.rs +512 -0
- package/domainforge-core/tests/pattern_semantics_tests.rs +87 -0
- package/domainforge-core/tests/phase_14_determinism_tests.rs +166 -0
- package/domainforge-core/tests/phase_15_validation_error_tests.rs +136 -0
- package/domainforge-core/tests/phase_16_unicode_tests.rs +248 -0
- package/domainforge-core/tests/phase_17_export_tests.rs +285 -0
- package/domainforge-core/tests/phase_17_round_trip_tests.rs +264 -0
- package/domainforge-core/tests/policy_tests.rs +635 -0
- package/domainforge-core/tests/primitives_integration_tests.rs +151 -0
- package/domainforge-core/tests/print_rdf_xml.rs +14 -0
- package/domainforge-core/tests/printer_tests.rs +204 -0
- package/domainforge-core/tests/profile_tests.rs +35 -0
- package/domainforge-core/tests/projection_contracts_tests.rs +154 -0
- package/domainforge-core/tests/protobuf_projection_tests.rs +199 -0
- package/domainforge-core/tests/quantity_tests.rs +41 -0
- package/domainforge-core/tests/rdf_xml_typed_literal_tests.rs +105 -0
- package/domainforge-core/tests/registry_schema_tests.rs +33 -0
- package/domainforge-core/tests/resource_tests.rs +50 -0
- package/domainforge-core/tests/resource_unit_tests.rs +24 -0
- package/domainforge-core/tests/roles_relations_tests.rs +61 -0
- package/domainforge-core/tests/round_trip_tests.rs +34 -0
- package/domainforge-core/tests/runtime_toggle_tests.rs +70 -0
- package/domainforge-core/tests/sbvr_fact_schema_tests.rs +60 -0
- package/domainforge-core/tests/sbvr_flow_facts_tests.rs +55 -0
- package/domainforge-core/tests/sbvr_parsing_tests.rs +53 -0
- package/domainforge-core/tests/semantic_pack_alias_resolution.rs +197 -0
- package/domainforge-core/tests/semantic_pack_build.rs +302 -0
- package/domainforge-core/tests/semantic_pack_consumer_smoke.rs +150 -0
- package/domainforge-core/tests/semantic_pack_pack_set.rs +160 -0
- package/domainforge-core/tests/semantic_pack_signing.rs +157 -0
- package/domainforge-core/tests/semantic_pack_three_valued.rs +250 -0
- package/domainforge-core/tests/semantic_pack_validate.rs +196 -0
- package/domainforge-core/tests/std_lib_tests.rs +37 -0
- package/domainforge-core/tests/temporal_evaluation_tests.rs +159 -0
- package/domainforge-core/tests/temporal_semantics_tests.rs +214 -0
- package/domainforge-core/tests/three_valued_quantifiers_tests.rs +164 -0
- package/domainforge-core/tests/turtle_entity_export_tests.rs +38 -0
- package/domainforge-core/tests/turtle_escaping_tests.rs +53 -0
- package/domainforge-core/tests/turtle_resource_export_tests.rs +34 -0
- package/domainforge-core/tests/type_inference_tests.rs +40 -0
- package/domainforge-core/tests/unicode_validation_tests.rs +169 -0
- package/domainforge-core/tests/unit_tests.rs +81 -0
- package/domainforge-core/tests/validate_tests.rs +38 -0
- package/domainforge-core/tests/validation_unit_mismatch_tests.rs +83 -0
- package/domainforge-core/tests/wasm_tests.rs +229 -0
- package/domainforge-python/CHANGELOG-python.md +12 -0
- package/domainforge-python/MIGRATING.md +24 -0
- package/domainforge-python/README.md +256 -0
- package/domainforge-python/domainforge/__init__.py +95 -0
- package/domainforge-python/domainforge/domainforge.pyi +519 -0
- package/domainforge-python/pyproject.toml +36 -0
- package/domainforge-typescript/CHANGELOG-typescript.md +12 -0
- package/domainforge-typescript/LICENSE +201 -0
- package/domainforge-typescript/MIGRATING.md +24 -0
- package/domainforge-typescript/README.md +305 -0
- package/domainforge-typescript/index.d.ts +452 -0
- package/domainforge-typescript/index.js +361 -0
- package/domainforge-typescript/package.json +60 -0
- package/example.js +61 -0
- package/examples/browser.html +366 -0
- package/examples/namespaces/finance/cashflow.sea +5 -0
- package/examples/namespaces/logistics/core.sea +7 -0
- package/examples/observability_metrics.sea +38 -0
- package/fixtures/semantic_packs/acme_procurement/domain/entities.sea +39 -0
- package/fixtures/semantic_packs/acme_procurement/domain/metrics.sea +11 -0
- package/fixtures/semantic_packs/acme_procurement/domain/relations.sea +7 -0
- package/fixtures/semantic_packs/acme_procurement/domain/resources.sea +9 -0
- package/fixtures/semantic_packs/acme_procurement/review/acme.procurement.semantic-review.jsonl +7 -0
- package/fixtures/semantic_packs/acme_procurement/tests/ambiguous_vendor_alias.sea +8 -0
- package/fixtures/semantic_packs/acme_procurement/tests/deprecated_vendor_alias.sea +8 -0
- package/fixtures/semantic_packs/acme_procurement/tests/invalid_relation.sea +3 -0
- package/fixtures/semantic_packs/acme_procurement/tests/proposed_concept.sea +8 -0
- package/fixtures/semantic_packs/acme_procurement/tests/rejected_concept.sea +8 -0
- package/fixtures/semantic_packs/acme_procurement/tests/unit_mismatch.sea +7 -0
- package/fixtures/semantic_packs/acme_procurement/tests/unknown_vendor_policy.sea +8 -0
- package/fixtures/semantic_packs/acme_procurement/tests/valid_purchase_policy.sea +8 -0
- package/index.d.ts +2 -0
- package/index.js +8 -0
- package/justfile +200 -0
- package/lefthook.yml +13 -0
- package/lib/validate_native_exports.d.ts +4 -0
- package/lib/validate_native_exports.js +12 -0
- package/package.json +22 -0
- package/pytest.ini +5 -0
- package/python/tests/test_registry.py +75 -0
- package/python/tests/test_units.py +18 -0
- package/release-please-config.json +49 -0
- package/requirements-dev.txt +3 -0
- package/requirements.txt +3 -0
- package/rust-toolchain.toml +3 -0
- package/schemas/ast-v1.schema.json +72 -0
- package/schemas/ast-v2.schema.json +1200 -0
- package/schemas/ast-v3.schema.json +1200 -0
- package/schemas/sea-registry.schema.json +45 -0
- package/scripts/build-python.sh +37 -0
- package/scripts/build-release.sh +279 -0
- package/scripts/build-typescript.sh +13 -0
- package/scripts/build-wasm.sh +113 -0
- package/scripts/bump-version.sh +245 -0
- package/scripts/check_unused_test_imports.py +85 -0
- package/scripts/ci_tasks.py +379 -0
- package/scripts/clear_debug_test.sh +10 -0
- package/scripts/create-github-release.sh +262 -0
- package/scripts/create-tag.sh +203 -0
- package/scripts/find_and_link_test_binary.sh +70 -0
- package/scripts/generate-changelog.sh +271 -0
- package/scripts/generate-release-notes.sh +205 -0
- package/scripts/lint_release_security.py +96 -0
- package/scripts/lint_release_workflows.py +82 -0
- package/scripts/lint_workflow_gates.py +113 -0
- package/scripts/optimized-wasm-build.sh +61 -0
- package/scripts/patch_napi_types.py +62 -0
- package/scripts/pre-release-check.sh +289 -0
- package/scripts/prepare_rust_debug.sh +52 -0
- package/scripts/release.sh +373 -0
- package/scripts/resolve_rust_binary.py +230 -0
- package/scripts/run_commitlint.sh +29 -0
- package/scripts/test-all.sh +77 -0
- package/scripts/update_launch_program.py +93 -0
- package/secrets/README.md +27 -0
- package/secrets/secrets.yaml +21 -0
- package/test_integration.py +67 -0
- package/tests/test_authority.py +328 -0
- package/tests/test_ci_tasks.py +143 -0
- package/tests/test_expression.py +256 -0
- package/tests/test_golden_payment_flow.py +42 -0
- package/tests/test_graph.py +127 -0
- package/tests/test_instance.py +136 -0
- package/tests/test_parser.py +82 -0
- package/tests/test_primitives.py +68 -0
- package/tests/test_role_relation_parity.py +56 -0
- package/tests/test_runtime_toggle.py +156 -0
- package/tests/test_semantic_pack.py +639 -0
- package/tests/test_three_valued_eval.py +159 -0
- package/tsconfig.json +30 -0
- package/typescript-tests/advanced.test.ts +165 -0
- package/typescript-tests/authority.test.ts +216 -0
- package/typescript-tests/expression.test.ts +228 -0
- package/typescript-tests/golden-payment-flow.test.ts +51 -0
- package/typescript-tests/graph.test.ts +142 -0
- package/typescript-tests/native-binding.test.ts +20 -0
- package/typescript-tests/primitives.test.ts +88 -0
- package/typescript-tests/registry.test.ts +122 -0
- package/typescript-tests/role_relation.test.ts +63 -0
- package/typescript-tests/runtime_toggle.test.ts +141 -0
- package/typescript-tests/semantic-pack.test.ts +556 -0
- package/typescript-tests/three_valued_eval.test.ts +135 -0
- package/typescript-tests/units.test.ts +36 -0
- package/vitest.config.ts +13 -0
- package/wasm_demo.html +225 -0
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
// SEA DSL Grammar Definition
|
|
2
|
+
// Based on the TypeScript Ohm-JS reference implementation
|
|
3
|
+
|
|
4
|
+
WHITESPACE = _{ " " | "\t" | "\r" | "\n" }
|
|
5
|
+
COMMENT = _{ "//" ~ (!"\n" ~ ANY)* }
|
|
6
|
+
in_keyword = @{ ^"in" ~ WHITESPACE+ }
|
|
7
|
+
|
|
8
|
+
// Program is the top-level entry point
|
|
9
|
+
program = { SOI ~ file_header? ~ declaration* ~ EOI }
|
|
10
|
+
|
|
11
|
+
// File-level metadata annotations and imports
|
|
12
|
+
file_header = { annotation* ~ import_decl* }
|
|
13
|
+
|
|
14
|
+
// Import declarations
|
|
15
|
+
import_decl = { ^"import" ~ import_specifier ~ ^"from" ~ string_literal }
|
|
16
|
+
import_specifier = { import_named | import_wildcard }
|
|
17
|
+
import_named = { "{" ~ import_item ~ ("," ~ import_item)* ~ ","? ~ "}" }
|
|
18
|
+
import_item = { identifier ~ (^"as" ~ identifier)? }
|
|
19
|
+
import_wildcard = { "*" ~ ^"as" ~ identifier }
|
|
20
|
+
|
|
21
|
+
// Export modifier
|
|
22
|
+
export_decl = { ^"export" ~ declaration_inner }
|
|
23
|
+
|
|
24
|
+
annotation = {
|
|
25
|
+
"@" ~ annotation_name ~ string_literal
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
annotation_name = {
|
|
29
|
+
^"namespace" | ^"version" | ^"owner" | ^"profile"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Declarations
|
|
33
|
+
declaration = { export_decl | declaration_inner }
|
|
34
|
+
declaration_inner = { dimension_decl | unit_decl | entity_decl | resource_decl | flow_decl | pattern_decl | role_decl | relation_decl | instance_decl | policy_decl | concept_change_decl | metric_decl | mapping_decl | projection_decl }
|
|
35
|
+
|
|
36
|
+
// Entity Declaration
|
|
37
|
+
// Syntax: Entity "Name" in domain
|
|
38
|
+
// Syntax: Entity "Name"
|
|
39
|
+
entity_decl = {
|
|
40
|
+
^"entity" ~ name ~ (^"v" ~ version)? ~ entity_annotation* ~ (in_keyword ~ identifier)?
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
entity_annotation = {
|
|
44
|
+
"@" ~ (
|
|
45
|
+
(ea_replaces ~ name ~ (^"v" ~ version)?) |
|
|
46
|
+
(ea_changes ~ string_array)
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
ea_replaces = { ^"replaces" }
|
|
51
|
+
ea_changes = { ^"changes" }
|
|
52
|
+
|
|
53
|
+
// Resource Declaration
|
|
54
|
+
// Syntax: Resource "Name" units in domain
|
|
55
|
+
// Syntax: Resource "Name" in domain
|
|
56
|
+
// Syntax: Resource "Name" units
|
|
57
|
+
// Syntax: Resource "Name"
|
|
58
|
+
resource_decl = {
|
|
59
|
+
^"resource" ~ name ~ resource_annotation* ~ (
|
|
60
|
+
(identifier ~ in_keyword ~ identifier) | // "units in domain" - most specific first
|
|
61
|
+
(in_keyword ~ identifier) | // "in domain" - next most specific
|
|
62
|
+
( !declaration_keyword ~ identifier ) // "units" only - least specific last. Must not be a keyword.
|
|
63
|
+
)?
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
resource_annotation = {
|
|
67
|
+
"@" ~ (
|
|
68
|
+
(ea_replaces ~ name ~ (^"v" ~ version)?) |
|
|
69
|
+
(ea_changes ~ string_array)
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declaration_keyword = @{
|
|
74
|
+
(
|
|
75
|
+
^"entity" | ^"resource" | ^"flow" | ^"pattern" | ^"role" | ^"relation" |
|
|
76
|
+
^"instance" | ^"policy" | ^"conceptchange" | ^"metric" | ^"mapping" |
|
|
77
|
+
^"projection" | ^"dimension" | ^"unit" | ^"import" | ^"export"
|
|
78
|
+
) ~ !(LETTER | NUMBER | "_")
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Flow Declaration
|
|
82
|
+
// Syntax: Flow "ResourceName" from "EntityA" to "EntityB" quantity 100
|
|
83
|
+
// Syntax: Flow "ResourceName" from "EntityA" to "EntityB"
|
|
84
|
+
flow_decl = {
|
|
85
|
+
^"flow" ~ string_literal ~ flow_annotation* ~ ^"from" ~ string_literal ~ ^"to" ~ string_literal ~ (^"quantity" ~ number)?
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
flow_annotation = {
|
|
89
|
+
"@" ~ (
|
|
90
|
+
(ea_replaces ~ name ~ (^"v" ~ version)?) |
|
|
91
|
+
(ea_changes ~ string_array) |
|
|
92
|
+
(identifier ~ annotation_value)
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Pattern Declaration
|
|
97
|
+
// Syntax: Pattern "Email" matches "^[a-z]+$"
|
|
98
|
+
pattern_decl = {
|
|
99
|
+
^"pattern" ~ name ~ ^"matches" ~ string_literal
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Role Declaration
|
|
103
|
+
// Syntax: Role "Approver"
|
|
104
|
+
// Syntax: Role "Approver" in governance
|
|
105
|
+
role_decl = {
|
|
106
|
+
^"role" ~ name ~ (in_keyword ~ identifier)?
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Relation Declaration
|
|
110
|
+
// Syntax:
|
|
111
|
+
// Relation "Payment"
|
|
112
|
+
// subject: "Payer"
|
|
113
|
+
// predicate: "pays"
|
|
114
|
+
// object: "Payee"
|
|
115
|
+
// via: flow "Money"
|
|
116
|
+
relation_decl = {
|
|
117
|
+
^"relation" ~ name ~
|
|
118
|
+
^"subject" ~ ":" ~ string_literal ~
|
|
119
|
+
^"predicate" ~ ":" ~ string_literal ~
|
|
120
|
+
^"object" ~ ":" ~ string_literal ~
|
|
121
|
+
(^"via" ~ ":" ~ ^"flow" ~ string_literal)?
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Concept Change Declaration
|
|
125
|
+
// Syntax:
|
|
126
|
+
// ConceptChange "Vendor_v2_migration"
|
|
127
|
+
// @from_version v2.0.0
|
|
128
|
+
// @to_version v2.1.0
|
|
129
|
+
// @migration_policy mandatory
|
|
130
|
+
// @breaking_change true
|
|
131
|
+
concept_change_decl = {
|
|
132
|
+
^"ConceptChange" ~ name ~ concept_change_annotation*
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
concept_change_annotation = {
|
|
136
|
+
"@" ~ (
|
|
137
|
+
(cc_from_version ~ ^"v" ~ version) |
|
|
138
|
+
(cc_to_version ~ ^"v" ~ version) |
|
|
139
|
+
(cc_migration_policy ~ identifier) |
|
|
140
|
+
(cc_breaking_change ~ boolean)
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
cc_from_version = { ^"from_version" }
|
|
145
|
+
cc_to_version = { ^"to_version" }
|
|
146
|
+
cc_migration_policy = { ^"migration_policy" }
|
|
147
|
+
cc_breaking_change = { ^"breaking_change" }
|
|
148
|
+
|
|
149
|
+
// Instance Declaration
|
|
150
|
+
// Syntax:
|
|
151
|
+
// Instance vendor_123 of "Vendor" {
|
|
152
|
+
// name: "Acme Corp",
|
|
153
|
+
// credit_limit: 50_000 "USD"
|
|
154
|
+
// }
|
|
155
|
+
instance_decl = {
|
|
156
|
+
^"instance" ~ identifier ~ ^"of" ~ string_literal ~ instance_body?
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
instance_body = {
|
|
160
|
+
"{" ~ (instance_field ~ ","?)* ~ "}"
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
instance_field = {
|
|
164
|
+
identifier ~ ":" ~ expression
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Dimension Declaration
|
|
168
|
+
// Syntax: Dimension "Currency"
|
|
169
|
+
dimension_decl = {
|
|
170
|
+
^"dimension" ~ string_literal
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Unit Declaration
|
|
174
|
+
// Syntax: Unit "USD" of "Currency" factor 1 base "USD"
|
|
175
|
+
unit_decl = {
|
|
176
|
+
^"unit" ~ string_literal ~ ^"of" ~ string_literal ~ ^"factor" ~ number ~ ^"base" ~ string_literal
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Policy Declaration
|
|
180
|
+
// Syntax: Policy name as: expression
|
|
181
|
+
// Syntax: Policy name v1.0.0 as: expression
|
|
182
|
+
// Syntax: Policy name per Constraint Obligation priority 5 as: expression
|
|
183
|
+
policy_decl = {
|
|
184
|
+
^"policy" ~ identifier ~ (^"per" ~ policy_kind ~ policy_modality ~ ^"priority" ~ number)? ~ policy_annotation* ~ (^"v" ~ version)? ~ ^"as" ~ ":" ~ expression
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
policy_kind = { ^"Constraint" | ^"Derivation" | ^"Obligation" }
|
|
188
|
+
|
|
189
|
+
policy_modality = { ^"Obligation" | ^"Prohibition" | ^"Permission" }
|
|
190
|
+
|
|
191
|
+
policy_annotation = {
|
|
192
|
+
"@" ~ policy_annotation_name ~ (string_literal | string_array)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
policy_annotation_name = {
|
|
196
|
+
^"rationale" | ^"tags"
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
string_array = { "[" ~ string_literal ~ ("," ~ string_literal)* ~ "]" }
|
|
200
|
+
|
|
201
|
+
annotation_value = { object_literal | string_array | string_literal | boolean | number }
|
|
202
|
+
|
|
203
|
+
// Semantic Version
|
|
204
|
+
version = @{ ASCII_DIGIT+ ~ "." ~ ASCII_DIGIT+ ~ "." ~ ASCII_DIGIT+ }
|
|
205
|
+
|
|
206
|
+
// Expressions
|
|
207
|
+
expression = { or_expr }
|
|
208
|
+
|
|
209
|
+
or_expr = { and_expr ~ (^"or" ~ and_expr)* }
|
|
210
|
+
|
|
211
|
+
and_expr = { not_expr ~ (^"and" ~ not_expr)* }
|
|
212
|
+
|
|
213
|
+
not_expr = { (^"not" ~ not_expr) | comparison_expr }
|
|
214
|
+
|
|
215
|
+
comparison_expr = { additive_expr ~ (comparison_op ~ additive_expr)? }
|
|
216
|
+
|
|
217
|
+
comparison_op = {
|
|
218
|
+
">=" | "<=" | "!=" | "=" | ">" | "<" |
|
|
219
|
+
^"contains" | ^"startswith" | ^"endswith" | ^"matches" |
|
|
220
|
+
^"before" | ^"after" | ^"during" | ^"has_role"
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
additive_expr = { multiplicative_expr ~ ((add_op ~ multiplicative_expr)*) }
|
|
224
|
+
|
|
225
|
+
add_op = { "+" | "-" }
|
|
226
|
+
|
|
227
|
+
multiplicative_expr = { unary_expr ~ ((mul_op ~ unary_expr)*) }
|
|
228
|
+
|
|
229
|
+
mul_op = { "*" | "/" }
|
|
230
|
+
|
|
231
|
+
unary_expr = { ("-" ~ unary_expr) | cast_expr }
|
|
232
|
+
|
|
233
|
+
cast_expr = { primary_expr ~ (^"as" ~ string_literal)? }
|
|
234
|
+
|
|
235
|
+
primary_expr = {
|
|
236
|
+
"(" ~ expression ~ ")" |
|
|
237
|
+
group_by_expr |
|
|
238
|
+
member_access |
|
|
239
|
+
aggregation_expr |
|
|
240
|
+
quantified_expr |
|
|
241
|
+
instance_reference |
|
|
242
|
+
literal |
|
|
243
|
+
identifier
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Group By Expression
|
|
247
|
+
// Syntax: group_by(f in flows: f.to.name) { sum(f.quantity) > 10 }
|
|
248
|
+
group_by_expr = {
|
|
249
|
+
^"group_by" ~ "(" ~ identifier ~ ^"in" ~ collection ~ (^"where" ~ expression)? ~ ":" ~ expression ~ ")" ~ "{" ~ expression ~ "}"
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Aggregation expressions
|
|
253
|
+
// Syntax: count(flows)
|
|
254
|
+
// Syntax: sum(flows.quantity)
|
|
255
|
+
// Syntax: count(flows where resource = "Camera")
|
|
256
|
+
// Syntax: sum(f in flows where f.resource = "Money": f.quantity as "USD")
|
|
257
|
+
aggregation_expr = {
|
|
258
|
+
aggregate_fn ~ "(" ~ (aggregation_comprehension | aggregation_simple) ~ ")"
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
aggregation_comprehension = {
|
|
262
|
+
identifier ~ ^"in" ~ collection ~ window_clause? ~ (^"where" ~ expression)? ~ ":" ~ expression
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
window_clause = {
|
|
266
|
+
^"over" ~ ^"last" ~ number ~ string_literal
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
aggregation_simple = {
|
|
270
|
+
(collection | identifier) ~ ("." ~ identifier)?
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
aggregate_fn = {
|
|
274
|
+
^"count" | ^"sum" | ^"min" | ^"max" | ^"avg"
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// Quantified expressions
|
|
278
|
+
// Syntax: forall x in Collection: (condition)
|
|
279
|
+
// Syntax: exists x in Collection: (condition)
|
|
280
|
+
quantified_expr = {
|
|
281
|
+
quantifier ~ identifier ~ ^"in" ~ collection ~ ":" ~ "(" ~ expression ~ ")"
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
quantifier = { ^"exists_unique" | ^"forall" | ^"exists" }
|
|
285
|
+
|
|
286
|
+
collection = {
|
|
287
|
+
^"flows" | ^"entities" | ^"resources" | ^"instances" | ^"relations"
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Member access (e.g., Flow.quantity, Entity.name)
|
|
291
|
+
member_access = { identifier ~ "." ~ identifier }
|
|
292
|
+
|
|
293
|
+
// Literals
|
|
294
|
+
literal = { time_literal | multiline_string | string_literal | interval_literal | quantity_literal | number | boolean }
|
|
295
|
+
|
|
296
|
+
// Time literal (ISO 8601 timestamp with required timezone)
|
|
297
|
+
// Syntax: "2025-12-31T23:59:59Z" or "2025-12-31T23:59:59+05:00"
|
|
298
|
+
// Note: Timezone is required to ensure unambiguous temporal comparisons
|
|
299
|
+
time_literal = @{ "\"" ~ ASCII_DIGIT{4} ~ "-" ~ ASCII_DIGIT{2} ~ "-" ~ ASCII_DIGIT{2} ~ "T" ~ ASCII_DIGIT{2} ~ ":" ~ ASCII_DIGIT{2} ~ ":" ~ ASCII_DIGIT{2} ~ ("Z" | (("+" | "-") ~ ASCII_DIGIT{2} ~ ":" ~ ASCII_DIGIT{2})) ~ "\"" }
|
|
300
|
+
|
|
301
|
+
// Interval literal (function call syntax)
|
|
302
|
+
// Syntax: interval("09:00", "17:00")
|
|
303
|
+
interval_literal = { ^"interval" ~ "(" ~ string_literal ~ "," ~ string_literal ~ ")" }
|
|
304
|
+
|
|
305
|
+
// Quantity literal with unit suffix
|
|
306
|
+
// Syntax: 1_500 "USD"
|
|
307
|
+
// Syntax: 100.5 "kg"
|
|
308
|
+
quantity_literal = { number ~ string_literal }
|
|
309
|
+
|
|
310
|
+
// Name can be either a multiline string or regular string literal
|
|
311
|
+
name = { multiline_string | string_literal }
|
|
312
|
+
|
|
313
|
+
// Multi-line string with triple quotes
|
|
314
|
+
multiline_string = @{ "\"\"\"" ~ (!"\"\"\"" ~ ANY)* ~ "\"\"\"" }
|
|
315
|
+
|
|
316
|
+
// String literal with escape sequences
|
|
317
|
+
string_literal = @{ "\"" ~ string_content* ~ "\"" }
|
|
318
|
+
|
|
319
|
+
string_content = @{
|
|
320
|
+
escape_sequence |
|
|
321
|
+
(!"\"" ~ !"\\" ~ ANY)
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
escape_sequence = @{
|
|
325
|
+
"\\\\" | // Backslash
|
|
326
|
+
"\\\"" | // Quote
|
|
327
|
+
"\\n" | // Newline
|
|
328
|
+
"\\r" | // Carriage return
|
|
329
|
+
"\\t" | // Tab
|
|
330
|
+
("\\u{" ~ ASCII_HEX_DIGIT{1,6} ~ "}") // Unicode codepoint
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
number = @{ "-"? ~ ASCII_DIGIT+ ~ ("." ~ ASCII_DIGIT+)? }
|
|
334
|
+
|
|
335
|
+
boolean = { ^"true" | ^"false" }
|
|
336
|
+
|
|
337
|
+
// Instance reference (e.g., @vendor_123)
|
|
338
|
+
instance_reference = @{ "@" ~ identifier }
|
|
339
|
+
|
|
340
|
+
// Identifier (Unicode support - letters, numbers, underscore)
|
|
341
|
+
// Must start with letter (including Unicode) or underscore
|
|
342
|
+
identifier = @{ (LETTER | "_") ~ (LETTER | NUMBER | "_")* }
|
|
343
|
+
|
|
344
|
+
// Metric Declaration
|
|
345
|
+
// Syntax: Metric "name" as: expression
|
|
346
|
+
metric_decl = {
|
|
347
|
+
^"metric" ~ name ~ ^"as" ~ ":" ~ expression ~ metric_annotation*
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
metric_annotation = {
|
|
351
|
+
"@" ~ (
|
|
352
|
+
(ma_refresh_interval ~ number ~ string_literal) |
|
|
353
|
+
(ma_unit ~ string_literal) |
|
|
354
|
+
(ma_threshold ~ number) |
|
|
355
|
+
(ma_severity ~ string_literal) |
|
|
356
|
+
(ma_target ~ number) |
|
|
357
|
+
(ma_window ~ number ~ string_literal)
|
|
358
|
+
)
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
ma_refresh_interval = { ^"refresh_interval" }
|
|
362
|
+
ma_unit = { ^"unit" }
|
|
363
|
+
ma_threshold = { ^"threshold" }
|
|
364
|
+
ma_severity = { ^"severity" }
|
|
365
|
+
ma_target = { ^"target" }
|
|
366
|
+
ma_window = { ^"window" }
|
|
367
|
+
|
|
368
|
+
// Mapping Declaration
|
|
369
|
+
mapping_decl = {
|
|
370
|
+
^"Mapping" ~ string_literal ~ ^"for" ~ target_format ~ "{" ~ mapping_rule* ~ "}"
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
target_format = { ^"calm" | ^"kg" | ^"sbvr" | ^"protobuf" | ^"proto" }
|
|
374
|
+
|
|
375
|
+
mapping_rule = {
|
|
376
|
+
primitive_type ~ string_literal ~ "->" ~ target_structure
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
primitive_type = { ^"Entity" | ^"Resource" | ^"Flow" | ^"Policy" | ^"Instance" }
|
|
380
|
+
|
|
381
|
+
target_structure = {
|
|
382
|
+
identifier ~ "{" ~ (mapping_field ~ ","?)* ~ "}"
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
mapping_field = {
|
|
386
|
+
identifier ~ ":" ~ (string_literal | object_literal | boolean)
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
object_literal = {
|
|
390
|
+
"{" ~ (string_literal ~ ":" ~ annotation_value ~ ","?)* ~ "}"
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// Projection Override
|
|
394
|
+
projection_decl = {
|
|
395
|
+
^"Projection" ~ string_literal ~ ^"for" ~ target_format ~ "{" ~ projection_rule* ~ "}"
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
projection_rule = {
|
|
399
|
+
primitive_type ~ string_literal ~ "{" ~ (projection_field ~ ","?)* ~ "}"
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
projection_field = {
|
|
403
|
+
identifier ~ ":" ~ (string_literal | property_mapping)
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
property_mapping = {
|
|
407
|
+
"{" ~ (string_literal ~ "->" ~ string_literal ~ ","?)* ~ "}"
|
|
408
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "CALM Model Schema (Simplified for SEA DSL)",
|
|
4
|
+
"description": "JSON Schema for FINOS CALM format exports from SEA DSL",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": [
|
|
7
|
+
"version",
|
|
8
|
+
"metadata",
|
|
9
|
+
"nodes",
|
|
10
|
+
"relationships"
|
|
11
|
+
],
|
|
12
|
+
"properties": {
|
|
13
|
+
"version": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "CALM schema version"
|
|
16
|
+
},
|
|
17
|
+
"metadata": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"description": "Metadata about the model",
|
|
20
|
+
"properties": {
|
|
21
|
+
"sea:exported": {
|
|
22
|
+
"type": "boolean"
|
|
23
|
+
},
|
|
24
|
+
"sea:version": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"sea:timestamp": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"format": "date-time"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"nodes": {
|
|
34
|
+
"type": "array",
|
|
35
|
+
"description": "Collection of nodes in the architecture",
|
|
36
|
+
"items": {
|
|
37
|
+
"$ref": "#/definitions/node"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"relationships": {
|
|
41
|
+
"type": "array",
|
|
42
|
+
"description": "Collection of relationships between nodes",
|
|
43
|
+
"items": {
|
|
44
|
+
"$ref": "#/definitions/relationship"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"definitions": {
|
|
49
|
+
"node": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"required": [
|
|
52
|
+
"unique-id",
|
|
53
|
+
"node-type",
|
|
54
|
+
"name"
|
|
55
|
+
],
|
|
56
|
+
"properties": {
|
|
57
|
+
"unique-id": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"description": "Unique identifier for the node"
|
|
60
|
+
},
|
|
61
|
+
"node-type": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"enum": [
|
|
64
|
+
"actor",
|
|
65
|
+
"location",
|
|
66
|
+
"resource",
|
|
67
|
+
"instance",
|
|
68
|
+
"constraint"
|
|
69
|
+
],
|
|
70
|
+
"description": "Type of the node"
|
|
71
|
+
},
|
|
72
|
+
"name": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"description": "Human-readable name"
|
|
75
|
+
},
|
|
76
|
+
"namespace": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"description": "Optional namespace for organizational grouping"
|
|
79
|
+
},
|
|
80
|
+
"metadata": {
|
|
81
|
+
"type": "object",
|
|
82
|
+
"description": "Additional metadata and attributes"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"relationship": {
|
|
87
|
+
"type": "object",
|
|
88
|
+
"required": [
|
|
89
|
+
"unique-id",
|
|
90
|
+
"relationship-type",
|
|
91
|
+
"parties"
|
|
92
|
+
],
|
|
93
|
+
"properties": {
|
|
94
|
+
"unique-id": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"description": "Unique identifier for the relationship"
|
|
97
|
+
},
|
|
98
|
+
"relationship-type": {
|
|
99
|
+
"oneOf": [
|
|
100
|
+
{
|
|
101
|
+
"type": "string",
|
|
102
|
+
"description": "Simple relationship type"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"type": "object",
|
|
106
|
+
"required": [
|
|
107
|
+
"flow"
|
|
108
|
+
],
|
|
109
|
+
"properties": {
|
|
110
|
+
"flow": {
|
|
111
|
+
"type": "object",
|
|
112
|
+
"required": [
|
|
113
|
+
"resource",
|
|
114
|
+
"quantity"
|
|
115
|
+
],
|
|
116
|
+
"properties": {
|
|
117
|
+
"resource": {
|
|
118
|
+
"type": "string",
|
|
119
|
+
"description": "Resource being transferred"
|
|
120
|
+
},
|
|
121
|
+
"quantity": {
|
|
122
|
+
"type": "string",
|
|
123
|
+
"description": "Quantity of resource"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
"parties": {
|
|
132
|
+
"type": "object",
|
|
133
|
+
"description": "Entities involved in the relationship",
|
|
134
|
+
"oneOf": [
|
|
135
|
+
{
|
|
136
|
+
"required": [
|
|
137
|
+
"source",
|
|
138
|
+
"destination"
|
|
139
|
+
],
|
|
140
|
+
"additionalProperties": false,
|
|
141
|
+
"properties": {
|
|
142
|
+
"source": {
|
|
143
|
+
"type": "string"
|
|
144
|
+
},
|
|
145
|
+
"destination": {
|
|
146
|
+
"type": "string"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"required": [
|
|
152
|
+
"owner",
|
|
153
|
+
"owned"
|
|
154
|
+
],
|
|
155
|
+
"additionalProperties": false,
|
|
156
|
+
"properties": {
|
|
157
|
+
"owner": {
|
|
158
|
+
"type": "string"
|
|
159
|
+
},
|
|
160
|
+
"owned": {
|
|
161
|
+
"type": "string"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Minimal SHACL shape for SEA Graph
|
|
2
|
+
@prefix sh: <http://www.w3.org/ns/shacl#> .
|
|
3
|
+
@prefix sea: <http://example.com/sea#> .
|
|
4
|
+
|
|
5
|
+
sea:ResourceShape a sh:NodeShape ;
|
|
6
|
+
sh:targetClass sea:Resource ;
|
|
7
|
+
sh:property [
|
|
8
|
+
sh:path sea:unit ;
|
|
9
|
+
sh:datatype xsd:string ;
|
|
10
|
+
sh:minCount 1 ;
|
|
11
|
+
] .
|
|
12
|
+
|
|
13
|
+
sea:EntityShape a sh:NodeShape ;
|
|
14
|
+
sh:targetClass sea:Entity ;
|
|
15
|
+
sh:property [
|
|
16
|
+
sh:path sea:name ;
|
|
17
|
+
sh:datatype xsd:string ;
|
|
18
|
+
sh:minCount 1 ;
|
|
19
|
+
] .
|