mxrb 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.de-DE.md +108 -0
- data/README.md +172 -0
- data/README.pt-BR.md +109 -0
- data/bin/mxrb +1613 -0
- data/docs/README.md +10 -0
- data/docs/de-DE/README.md +24 -0
- data/docs/de-DE/architectural-patterns.md +26 -0
- data/docs/de-DE/architectural-standard.md +48 -0
- data/docs/de-DE/architecture.md +76 -0
- data/docs/de-DE/compiler.md +162 -0
- data/docs/de-DE/conventions.md +19 -0
- data/docs/de-DE/design-system.md +52 -0
- data/docs/de-DE/entity-dsl.md +53 -0
- data/docs/de-DE/native-runtime-quality-report.md +74 -0
- data/docs/de-DE/oql-sql.md +211 -0
- data/docs/de-DE/platform-api-integration.md +36 -0
- data/docs/de-DE/platform-operations.md +243 -0
- data/docs/de-DE/project-structure.md +32 -0
- data/docs/de-DE/ruby-first-roadmap.md +116 -0
- data/docs/de-DE/scaffolds.md +59 -0
- data/docs/de-DE/semantic-refactoring.md +56 -0
- data/docs/de-DE/team-server.md +33 -0
- data/docs/de-DE/validation-matrix.md +64 -0
- data/docs/de-DE/vetclinic-acceptance.md +24 -0
- data/docs/de-DE/writing.md +138 -0
- data/docs/en-US/README.md +24 -0
- data/docs/en-US/architectural-patterns.md +151 -0
- data/docs/en-US/architectural-standard.md +89 -0
- data/docs/en-US/architecture.md +170 -0
- data/docs/en-US/compiler.md +157 -0
- data/docs/en-US/conventions.md +82 -0
- data/docs/en-US/design-system.md +163 -0
- data/docs/en-US/entity-dsl.md +53 -0
- data/docs/en-US/native-runtime-quality-report.md +73 -0
- data/docs/en-US/oql-sql.md +201 -0
- data/docs/en-US/platform-api-integration.md +36 -0
- data/docs/en-US/platform-operations.md +244 -0
- data/docs/en-US/project-structure.md +49 -0
- data/docs/en-US/ruby-first-roadmap.md +186 -0
- data/docs/en-US/scaffolds.md +57 -0
- data/docs/en-US/semantic-refactoring.md +198 -0
- data/docs/en-US/team-server.md +32 -0
- data/docs/en-US/validation-matrix.md +257 -0
- data/docs/en-US/vetclinic-acceptance.md +23 -0
- data/docs/en-US/writing.md +655 -0
- data/docs/pt-BR/README.md +24 -0
- data/docs/pt-BR/architectural-patterns.md +25 -0
- data/docs/pt-BR/architectural-standard.md +533 -0
- data/docs/pt-BR/architecture.md +300 -0
- data/docs/pt-BR/compiler.md +162 -0
- data/docs/pt-BR/conventions.md +19 -0
- data/docs/pt-BR/design-system.md +65 -0
- data/docs/pt-BR/entity-dsl.md +116 -0
- data/docs/pt-BR/native-runtime-quality-report.md +73 -0
- data/docs/pt-BR/oql-sql.md +208 -0
- data/docs/pt-BR/platform-api-integration.md +36 -0
- data/docs/pt-BR/platform-operations.md +260 -0
- data/docs/pt-BR/project-structure.md +32 -0
- data/docs/pt-BR/ruby-first-roadmap.md +239 -0
- data/docs/pt-BR/scaffolds.md +104 -0
- data/docs/pt-BR/semantic-refactoring.md +55 -0
- data/docs/pt-BR/team-server.md +59 -0
- data/docs/pt-BR/validation-matrix.md +86 -0
- data/docs/pt-BR/vetclinic-acceptance.md +50 -0
- data/docs/pt-BR/writing.md +177 -0
- data/examples/sudoku_evaluation.rb +14 -0
- data/examples/sudoku_functional_test.rb +28 -0
- data/lib/mxrb/architecture/graph.rb +124 -0
- data/lib/mxrb/architecture/validator.rb +98 -0
- data/lib/mxrb/benchmark.rb +33 -0
- data/lib/mxrb/compare.rb +390 -0
- data/lib/mxrb/compiler/adapter.rb +96 -0
- data/lib/mxrb/compiler/artifact_document_compiler.rb +102 -0
- data/lib/mxrb/compiler/artifact_materializer.rb +53 -0
- data/lib/mxrb/compiler/client_model_materializer.rb +42 -0
- data/lib/mxrb/compiler/code_action_document_compiler.rb +64 -0
- data/lib/mxrb/compiler/code_action_materializer.rb +35 -0
- data/lib/mxrb/compiler/code_action_type_compiler.rb +32 -0
- data/lib/mxrb/compiler/combo_box_bundle_compiler.rb +314 -0
- data/lib/mxrb/compiler/compatibility_analyzer.rb +169 -0
- data/lib/mxrb/compiler/constants_materializer.rb +111 -0
- data/lib/mxrb/compiler/data_grid_bundle_compiler.rb +290 -0
- data/lib/mxrb/compiler/database_connector_action_compiler.rb +280 -0
- data/lib/mxrb/compiler/deployment_asset_copier.rb +60 -0
- data/lib/mxrb/compiler/deployment_bootstrapper.rb +208 -0
- data/lib/mxrb/compiler/deployment_materializer.rb +43 -0
- data/lib/mxrb/compiler/deployment_metadata.rb +64 -0
- data/lib/mxrb/compiler/domain_document_compiler.rb +153 -0
- data/lib/mxrb/compiler/domain_model_materializer.rb +35 -0
- data/lib/mxrb/compiler/domain_security_compiler.rb +82 -0
- data/lib/mxrb/compiler/gallery_bundle_compiler.rb +190 -0
- data/lib/mxrb/compiler/generic_widget_bundle_compiler.rb +281 -0
- data/lib/mxrb/compiler/image_bundle_compiler.rb +216 -0
- data/lib/mxrb/compiler/java_proxy_generator.rb +509 -0
- data/lib/mxrb/compiler/legacy_data_grid_compiler.rb +267 -0
- data/lib/mxrb/compiler/legacy_page_builder.rb +287 -0
- data/lib/mxrb/compiler/mda.rb +99 -0
- data/lib/mxrb/compiler/microflow_document_compiler.rb +85 -0
- data/lib/mxrb/compiler/microflow_materializer.rb +48 -0
- data/lib/mxrb/compiler/microflow_node_compiler.rb +250 -0
- data/lib/mxrb/compiler/model_package.rb +116 -0
- data/lib/mxrb/compiler/model_values.rb +67 -0
- data/lib/mxrb/compiler/nanoflow_program_compiler.rb +483 -0
- data/lib/mxrb/compiler/navigation_document_compiler.rb +93 -0
- data/lib/mxrb/compiler/packager.rb +100 -0
- data/lib/mxrb/compiler/page_bundle_builder.rb +56 -0
- data/lib/mxrb/compiler/page_bundle_compiler.rb +2004 -0
- data/lib/mxrb/compiler/page_document_compiler.rb +77 -0
- data/lib/mxrb/compiler/portable_packager.rb +356 -0
- data/lib/mxrb/compiler/project_jar_archive.rb +84 -0
- data/lib/mxrb/compiler/project_jar_builder.rb +121 -0
- data/lib/mxrb/compiler/project_materializer.rb +139 -0
- data/lib/mxrb/compiler/project_model_orderer.rb +52 -0
- data/lib/mxrb/compiler/runtime_data_types.rb +31 -0
- data/lib/mxrb/compiler/runtime_model_schema.rb +90 -0
- data/lib/mxrb/compiler/schemas/runtime-10.24.0.73019.json +1052 -0
- data/lib/mxrb/compiler/schemas/runtime-11.json +1215 -0
- data/lib/mxrb/compiler/schemas/runtime-6.10.8.json +1148 -0
- data/lib/mxrb/compiler/schemas/runtime-7.17.0.json +1144 -0
- data/lib/mxrb/compiler/schemas/runtime-7.5.0.json +1215 -0
- data/lib/mxrb/compiler/schemas/runtime-9.6.1.29396.json +868 -0
- data/lib/mxrb/compiler/schemas/system-model-10.24.0.73019.b64 +1135 -0
- data/lib/mxrb/compiler/schemas/system-model-11.12.1.b64 +815 -0
- data/lib/mxrb/compiler/schemas/system-model-6.10.8.b64 +497 -0
- data/lib/mxrb/compiler/schemas/system-model-7.17.0.b64 +519 -0
- data/lib/mxrb/compiler/schemas/system-model-7.5.0.b64 +504 -0
- data/lib/mxrb/compiler/schemas/system-model-9.6.1.29396.b64 +816 -0
- data/lib/mxrb/compiler/security_materializer.rb +104 -0
- data/lib/mxrb/compiler/settings_document_compiler.rb +45 -0
- data/lib/mxrb/compiler/settings_materializer.rb +25 -0
- data/lib/mxrb/compiler/source_model.rb +128 -0
- data/lib/mxrb/compiler/system_model_seed.rb +88 -0
- data/lib/mxrb/compiler/system_queue_materializer.rb +54 -0
- data/lib/mxrb/compiler/system_text_materializer.rb +49 -0
- data/lib/mxrb/compiler/translation_materializer.rb +95 -0
- data/lib/mxrb/compiler/web_bundle_builder.rb +155 -0
- data/lib/mxrb/compiler/web_list_data_source.rb +139 -0
- data/lib/mxrb/compiler/web_operation_compiler.rb +614 -0
- data/lib/mxrb/compiler/web_shell_materializer.rb +194 -0
- data/lib/mxrb/compiler/widget_package_extractor.rb +63 -0
- data/lib/mxrb/doctor.rb +116 -0
- data/lib/mxrb/dsl/builder.rb +1636 -0
- data/lib/mxrb/errors.rb +18 -0
- data/lib/mxrb/evaluation.rb +131 -0
- data/lib/mxrb/exporter.rb +1716 -0
- data/lib/mxrb/frontend/migrator.rb +775 -0
- data/lib/mxrb/functional.rb +307 -0
- data/lib/mxrb/github/annotator.rb +161 -0
- data/lib/mxrb/initializer.rb +257 -0
- data/lib/mxrb/integrity/validator.rb +136 -0
- data/lib/mxrb/io/bson_codec.rb +145 -0
- data/lib/mxrb/io/mpr_file.rb +558 -0
- data/lib/mxrb/io/mxunit_codec.rb +42 -0
- data/lib/mxrb/marketplace.rb +380 -0
- data/lib/mxrb/model/association.rb +98 -0
- data/lib/mxrb/model/attribute.rb +100 -0
- data/lib/mxrb/model/connector.rb +17 -0
- data/lib/mxrb/model/design_materializer.rb +133 -0
- data/lib/mxrb/model/design_migration.rb +126 -0
- data/lib/mxrb/model/design_system.rb +111 -0
- data/lib/mxrb/model/domain_model.rb +51 -0
- data/lib/mxrb/model/entity.rb +180 -0
- data/lib/mxrb/model/menu.rb +38 -0
- data/lib/mxrb/model/microflow.rb +100 -0
- data/lib/mxrb/model/module.rb +142 -0
- data/lib/mxrb/model/navigation.rb +127 -0
- data/lib/mxrb/model/page.rb +410 -0
- data/lib/mxrb/model/project.rb +187 -0
- data/lib/mxrb/model/unit.rb +48 -0
- data/lib/mxrb/module_initializer.rb +75 -0
- data/lib/mxrb/official_marketplace/content_api.rb +292 -0
- data/lib/mxrb/official_marketplace/dependency_resolver.rb +329 -0
- data/lib/mxrb/official_marketplace/lifecycle.rb +367 -0
- data/lib/mxrb/official_marketplace/module_package_importer.rb +318 -0
- data/lib/mxrb/official_marketplace/widget_package_installer.rb +414 -0
- data/lib/mxrb/official_marketplace.rb +720 -0
- data/lib/mxrb/oql/analyzer.rb +155 -0
- data/lib/mxrb/oql/index_advisor.rb +85 -0
- data/lib/mxrb/oql/plan_analyzer.rb +185 -0
- data/lib/mxrb/oql/server.rb +132 -0
- data/lib/mxrb/oql/sql_server_plan_analyzer.rb +190 -0
- data/lib/mxrb/oql/sql_server_workload_analyzer.rb +80 -0
- data/lib/mxrb/oql/workload_analyzer.rb +175 -0
- data/lib/mxrb/oql/workload_baseline.rb +60 -0
- data/lib/mxrb/oql.rb +424 -0
- data/lib/mxrb/project_lifecycle.rb +76 -0
- data/lib/mxrb/protocols/plan.rb +86 -0
- data/lib/mxrb/protocols.rb +123 -0
- data/lib/mxrb/runtime/database_workspace.rb +677 -0
- data/lib/mxrb/runtime/docker_executor.rb +41 -0
- data/lib/mxrb/runtime/docker_workspace.rb +29 -0
- data/lib/mxrb/runtime/executor.rb +169 -0
- data/lib/mxrb/runtime/java_locator.rb +26 -0
- data/lib/mxrb/runtime/native.rb +474 -0
- data/lib/mxrb/runtime/sql_server_database.rb +146 -0
- data/lib/mxrb/runtime/toolchain.rb +82 -0
- data/lib/mxrb/scaffold/cli.rb +113 -0
- data/lib/mxrb/scaffold/generator.rb +246 -0
- data/lib/mxrb/scaffold/help.rb +80 -0
- data/lib/mxrb/scaffold/page_templates.rb +54 -0
- data/lib/mxrb/scaffold/recipes.rb +198 -0
- data/lib/mxrb/scaffold/registry.rb +82 -0
- data/lib/mxrb/scaffold/templates.rb +723 -0
- data/lib/mxrb/scaffold/transaction.rb +84 -0
- data/lib/mxrb/schema/tables.rb +55 -0
- data/lib/mxrb/semantic/analyzer.rb +473 -0
- data/lib/mxrb/semantic/batch_plan.rb +68 -0
- data/lib/mxrb/semantic/domain_mutator.rb +419 -0
- data/lib/mxrb/semantic/embedder.rb +51 -0
- data/lib/mxrb/semantic/extractor.rb +290 -0
- data/lib/mxrb/semantic/index.rb +623 -0
- data/lib/mxrb/semantic/inliner.rb +216 -0
- data/lib/mxrb/semantic/mover.rb +153 -0
- data/lib/mxrb/semantic/onnx_embedder.rb +34 -0
- data/lib/mxrb/semantic/remover.rb +70 -0
- data/lib/mxrb/semantic/renamer.rb +211 -0
- data/lib/mxrb/semantic/tfidf_embedder.rb +46 -0
- data/lib/mxrb/semantic/vec_store.rb +75 -0
- data/lib/mxrb/team_server.rb +390 -0
- data/lib/mxrb/templates/project/10.24.0.73019.json +32 -0
- data/lib/mxrb/templates/project/11.12.1.json +32 -0
- data/lib/mxrb/templates/project/6.10.8.json +50 -0
- data/lib/mxrb/templates/project/7.17.0.json +50 -0
- data/lib/mxrb/templates/project/7.5.0.json +50 -0
- data/lib/mxrb/templates/project/9.6.1.29396.json +50 -0
- data/lib/mxrb/version.rb +5 -0
- data/lib/mxrb/widget_package.rb +338 -0
- data/lib/mxrb/widget_synchronizer.rb +31 -0
- data/lib/mxrb/writer.rb +3775 -0
- data/lib/mxrb.rb +188 -0
- data/marketplace/catalog.json +10 -0
- data/marketplace/modules/shared-kernel/domain/README.md +4 -0
- data/marketplace/modules/shared-kernel/module.rb +5 -0
- data/marketplace/modules/shared-kernel/mxrb-module.json +9 -0
- metadata +447 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Mendix project architecture in MXRB
|
|
2
|
+
|
|
3
|
+
[Português](../pt-BR/architecture.md) · **English** · [Deutsch](../de-DE/architecture.md)
|
|
4
|
+
|
|
5
|
+
MXRB represents a Mendix project as editable Ruby while preserving the native
|
|
6
|
+
model required for a safe round trip. Ruby is the source-facing language; no
|
|
7
|
+
parallel MDL-like syntax is introduced.
|
|
8
|
+
|
|
9
|
+
## Mendix compatibility principles
|
|
10
|
+
|
|
11
|
+
- Mendix qualified names remain canonical inside the model.
|
|
12
|
+
- Existing native units are preserved when no typed Ruby abstraction exists.
|
|
13
|
+
- A typed edit replaces only the structure that Ruby explicitly owns.
|
|
14
|
+
- MPR v1 contents stay in SQLite; MPR v2 contents stay in `mprcontents/`.
|
|
15
|
+
- UUIDs, BSON GUIDs, containment and content hashes are handled by MXRB.
|
|
16
|
+
- Official `mx`, MxBuild and Runtime are compatibility gates, not core APIs.
|
|
17
|
+
|
|
18
|
+
## Canonical structure
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
project.rb
|
|
22
|
+
app/
|
|
23
|
+
security/
|
|
24
|
+
navigation/
|
|
25
|
+
modules/
|
|
26
|
+
Sales/
|
|
27
|
+
module.rb
|
|
28
|
+
domain/
|
|
29
|
+
model.rb
|
|
30
|
+
entities/
|
|
31
|
+
application/
|
|
32
|
+
use_cases/
|
|
33
|
+
queries/
|
|
34
|
+
presentation/
|
|
35
|
+
pages/
|
|
36
|
+
client_actions/
|
|
37
|
+
infrastructure/
|
|
38
|
+
integrations/
|
|
39
|
+
services/
|
|
40
|
+
security/
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The structure is deliberately regular. Exported files can be reviewed in Git,
|
|
44
|
+
edited in Ruby and regenerated without flattening Mendix folders or dropping
|
|
45
|
+
unknown documents.
|
|
46
|
+
|
|
47
|
+
## Clean Architecture mapping
|
|
48
|
+
|
|
49
|
+
### `domain/`
|
|
50
|
+
|
|
51
|
+
Contains entities, attributes, associations, value rules and domain events.
|
|
52
|
+
It must not depend on presentation or infrastructure details.
|
|
53
|
+
|
|
54
|
+
```ruby
|
|
55
|
+
entity :Order do
|
|
56
|
+
string :Number, documentation: "Stable order number"
|
|
57
|
+
decimal :Total, default: 0
|
|
58
|
+
association "Sales.Customer", name: "Order_Customer"
|
|
59
|
+
end
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Association cardinality follows the Mendix type/owner model:
|
|
63
|
+
|
|
64
|
+
```ruby
|
|
65
|
+
# 1:N (default): Reference + Default
|
|
66
|
+
association "Sales.Customer", name: "Order_Customer"
|
|
67
|
+
|
|
68
|
+
# 1:1: Reference + Both
|
|
69
|
+
association "Sales.Profile", name: "Customer_Profile", owner: :Both
|
|
70
|
+
|
|
71
|
+
# N:N: ReferenceSet + Default
|
|
72
|
+
association "Sales.Tag", name: "Order_Tags", type: :ReferenceSet
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### `application/`
|
|
76
|
+
|
|
77
|
+
Contains use cases, queries, validations and jobs. A microflow is not
|
|
78
|
+
automatically a service: its role is determined by its responsibility.
|
|
79
|
+
|
|
80
|
+
```ruby
|
|
81
|
+
microflow :CreateOrder do
|
|
82
|
+
return_type :Order
|
|
83
|
+
create_object "Sales.Order", as: :order
|
|
84
|
+
return_value :order
|
|
85
|
+
end
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### `presentation/`
|
|
89
|
+
|
|
90
|
+
Contains pages, UI entry points and client-side nanoflows. Feature-oriented
|
|
91
|
+
folders are preferred when a module has several independent user journeys.
|
|
92
|
+
|
|
93
|
+
### `infrastructure/`
|
|
94
|
+
|
|
95
|
+
Contains integrations, published/consumed services, adapters and technical
|
|
96
|
+
implementation details. Repository abstractions are used only at real
|
|
97
|
+
boundaries; ordinary Mendix CRUD does not require ceremonial wrappers.
|
|
98
|
+
|
|
99
|
+
## Dependency rule
|
|
100
|
+
|
|
101
|
+
Dependencies point inward:
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
presentation ─┐
|
|
105
|
+
├─> application ─> domain
|
|
106
|
+
infrastructure┘
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The semantic graph validates missing targets, cycles, cross-module relations
|
|
110
|
+
and forbidden architectural dependencies.
|
|
111
|
+
|
|
112
|
+
## Root file
|
|
113
|
+
|
|
114
|
+
`project.rb` loads the application-level configuration, native baseline and
|
|
115
|
+
module aggregators. It should contain orchestration, not business behavior.
|
|
116
|
+
|
|
117
|
+
```ruby
|
|
118
|
+
Mxrb.define("Shop.mpr") do
|
|
119
|
+
mendix_version "11.12.1"
|
|
120
|
+
native_units File.join(__dir__, ".mxrb", "native_units.json")
|
|
121
|
+
load File.join(__dir__, "modules", "Sales", "module.rb")
|
|
122
|
+
end
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Ruby-to-Mendix flow
|
|
126
|
+
|
|
127
|
+
1. Ruby definitions are evaluated.
|
|
128
|
+
2. The writer creates or opens the target MPR.
|
|
129
|
+
3. Native units are restored first.
|
|
130
|
+
4. Typed overlays are matched by stable Mendix names.
|
|
131
|
+
5. Changed flow/page structures are regenerated.
|
|
132
|
+
6. Hashes and v1/v2 storage are updated.
|
|
133
|
+
7. `mxrb validate`, `mx check` and MxBuild can act as successive gates.
|
|
134
|
+
|
|
135
|
+
## Mendix-to-Ruby flow
|
|
136
|
+
|
|
137
|
+
1. MXRB indexes all project units.
|
|
138
|
+
2. Typed modules, entities, pages, menus and flows are exported.
|
|
139
|
+
3. Deep page/flow structures remain editable Ruby.
|
|
140
|
+
4. Unknown units are written to `.mxrb/native_units.json`.
|
|
141
|
+
5. Canonical fingerprints permit exact reuse of unchanged native graphs.
|
|
142
|
+
|
|
143
|
+
## Safe round-trip strategy
|
|
144
|
+
|
|
145
|
+
### Preserving update
|
|
146
|
+
|
|
147
|
+
Use the exported native baseline when editing an existing project. This mode
|
|
148
|
+
keeps structures outside the currently typed surface without treating them as
|
|
149
|
+
discardable opaque data.
|
|
150
|
+
|
|
151
|
+
### Reconstruction
|
|
152
|
+
|
|
153
|
+
For a new project, MXRB creates the SQLite schema, root unit, module tree and
|
|
154
|
+
v2 `.mxunit` files when required. Exact official validation still depends on
|
|
155
|
+
the matching Mendix toolchain.
|
|
156
|
+
|
|
157
|
+
## Naming conventions
|
|
158
|
+
|
|
159
|
+
- Mendix names are preserved exactly.
|
|
160
|
+
- Ruby filenames use `snake_case`.
|
|
161
|
+
- Ruby symbols may adapt names for readability.
|
|
162
|
+
- Comparisons use Mendix-qualified identity, never filenames.
|
|
163
|
+
- Renames are previewed across the semantic graph before being applied.
|
|
164
|
+
|
|
165
|
+
## Source of truth
|
|
166
|
+
|
|
167
|
+
Ruby is authoritative for explicitly declared typed structures. The native
|
|
168
|
+
manifest is authoritative for preserved structures outside that declaration.
|
|
169
|
+
When a deep Ruby structure is edited, its fingerprint changes and the writer
|
|
170
|
+
regenerates that structure rather than silently restoring the old native one.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Native compiler, Runtime, and MDA format
|
|
2
|
+
|
|
3
|
+
MXRB's functional pipeline does not execute `mx`, `mxbuild`, `mxcli`, Studio
|
|
4
|
+
Pro, or the Model SDK. Those tools may remain external compatibility gates, but
|
|
5
|
+
they are not build, database, or functional-test dependencies.
|
|
6
|
+
|
|
7
|
+
## Clean build
|
|
8
|
+
|
|
9
|
+
`DeploymentMaterializer` creates a missing `deployment/` from the installed
|
|
10
|
+
version templates and runs 12 stages: security, constants, domain model,
|
|
11
|
+
artifacts, translations, system texts, system queues, client model, actions,
|
|
12
|
+
settings, microflows, and the project/module index. It also creates metadata,
|
|
13
|
+
dependency files, and a Runtime-ordered BSON `model.mdp`.
|
|
14
|
+
|
|
15
|
+
Bootstrap has audited seeds and catalogs for 6.10.8, 7.5.0, 7.17.0,
|
|
16
|
+
9.6.1.29396, 10.24.0.73019, and 11.12.1. The 6.x, 7.x, 9.x, 10.x, and 11.x families select a
|
|
17
|
+
compatible compiler seed; 5.x and 8.x fail closed without an audited
|
|
18
|
+
seed. Family selection applies to compiler schema only. Runtime must always
|
|
19
|
+
match the MPR's exact patch.
|
|
20
|
+
|
|
21
|
+
`ProjectJarBuilder` discovers the JDK through `MXRB_JAVA_HOME`, `JAVA_HOME`,
|
|
22
|
+
asdf, or mise, compiles `javasource/**/*.java` against Runtime and project
|
|
23
|
+
libraries, and writes a deterministic OSGi `project.jar`. VetClinic compiled
|
|
24
|
+
183 sources into 249 classes.
|
|
25
|
+
|
|
26
|
+
`WebBundleBuilder` selects Dojo for 6/7, Dojo plus the React wrapper for 9,
|
|
27
|
+
the project-declared classic or optimized client for 10, and React for 11.
|
|
28
|
+
The React path generates entrypoint/page modules, expands `.mpk`, and invokes
|
|
29
|
+
the version-owned Node/Rollup (10) or Node/Rspack (11) directly. Data Grid 2 compiles for the XPath datasource and attribute-column
|
|
30
|
+
subset, including `operations.json`, datasource, and attribute types.
|
|
31
|
+
Untranslated types or property combinations receive a DOM fallback and are
|
|
32
|
+
recorded in `web/mxrb-pages.json`; VetClinic's manifest is empty.
|
|
33
|
+
|
|
34
|
+
The React compiler also materializes containers, text and headings, responsive
|
|
35
|
+
grids/columns, and open/create buttons. Bootstrap injects
|
|
36
|
+
`theme.compiled.css`, the manifest, and `themesource/*/public` assets, so a
|
|
37
|
+
homepage containing a `LayoutGrid` no longer renders blank. To add Ruby content:
|
|
38
|
+
|
|
39
|
+
Parameter-backed `DataView` forms now render editable `TextBox` fields plus
|
|
40
|
+
Save/Cancel actions. Create passes the new object's GUID through `openForm2`;
|
|
41
|
+
commit/rollback operations are registered with the project user roles derived
|
|
42
|
+
from each page's allowed module roles. Runtime authorization is preserved
|
|
43
|
+
instead of bypassed.
|
|
44
|
+
|
|
45
|
+
Layouts, placeholders, scroll regions, sidebars, headers, navigation menus,
|
|
46
|
+
snippets, DataViews, ListViews, form controls, images, combo boxes, Gallery,
|
|
47
|
+
Data Grid 2 and schema-backed pluggable widgets are compiled through their
|
|
48
|
+
native React-client contracts. Page, menu and widget actions cover navigation,
|
|
49
|
+
microflows, nanoflows, object lifecycle, links and sign-out. Nanoflow programs
|
|
50
|
+
also cover decisions, error handlers, JavaScript actions and server-side
|
|
51
|
+
microflow/commit operations when their model contracts can be mapped safely.
|
|
52
|
+
|
|
53
|
+
The React path also compiles the official Gallery with XPath and microflow
|
|
54
|
+
list sources, templated item content, selection, and formatted dynamic
|
|
55
|
+
attributes. Client-side nanoflow sources and actions use the Mendix
|
|
56
|
+
`NanoflowObjectListProperty`, `NanoflowObjectProperty`, and `ActionProperty`
|
|
57
|
+
contracts. MXRB emits real `{ name, instructions }` client programs for audited
|
|
58
|
+
graph control flow, returns, variables, objects, nested nanoflow/microflow calls,
|
|
59
|
+
JavaScript actions, page/message/validation actions and commits. Missing flows,
|
|
60
|
+
unsafe parameter mappings and untranslated client instructions fail closed and
|
|
61
|
+
remain support-manifest findings.
|
|
62
|
+
|
|
63
|
+
For local developer Runtime sessions, mxrb also versions dynamic page imports,
|
|
64
|
+
content-hashes the patched React Client chunk, and gives Rspack's self-import
|
|
65
|
+
the same cache token as the entrypoint. This prevents Mendix's long-lived
|
|
66
|
+
static-resource responses from restoring an obsolete blank page after a native
|
|
67
|
+
rebuild. The generated shell also provides a bounded `openForm` adapter over
|
|
68
|
+
`openForm2`; cached legacy handlers therefore navigate instead of silently
|
|
69
|
+
issuing no request.
|
|
70
|
+
|
|
71
|
+
```ruby
|
|
72
|
+
Mxrb.define("App.mpr") do
|
|
73
|
+
mendix_version "11.12.1"
|
|
74
|
+
self.module(:App) do
|
|
75
|
+
layout :Shell
|
|
76
|
+
page(:Home) do
|
|
77
|
+
layout "App.Shell"
|
|
78
|
+
title "My application"
|
|
79
|
+
container(:main, class_name: "container") do
|
|
80
|
+
text :welcome, caption: "Content created with mxrb"
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Existing projects can be exported, changed in the DSL, and regenerated.
|
|
88
|
+
Unsupported widgets remain visible in the support manifest.
|
|
89
|
+
|
|
90
|
+
Before a native build, audit the complete MPR through the renderer selected for
|
|
91
|
+
its Mendix version:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
mxrb preflight App.mpr
|
|
95
|
+
mxrb preflight App.mpr --json
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The command is read-only and exits non-zero for unsupported versions or client
|
|
99
|
+
features. Mendix 11 is audited through the React compiler, while 6/7/9 use the
|
|
100
|
+
same legacy Dojo audit as `WebBundleBuilder`; this prevents a report from
|
|
101
|
+
claiming compatibility through a renderer the build will not use.
|
|
102
|
+
|
|
103
|
+
The Dojo path compiles Data Grid 1 database, XPath, and microflow sources plus
|
|
104
|
+
audited search, sorting, paging, selection, and buttons. Every other visible
|
|
105
|
+
widget is recorded per page in `web/mxrb-legacy-pages.json` and is not claimed
|
|
106
|
+
as rendered.
|
|
107
|
+
|
|
108
|
+
## MDA and portable package
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
mxrb pack App.mpr --output build/App.mda
|
|
112
|
+
mxrb mda inspect build/App.mda
|
|
113
|
+
mxrb portable App.mpr --output build/runtime.zip
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
MDA and portable ZIP output is deterministic. The portable package combines
|
|
117
|
+
the native deployment with the installed matching Runtime, generated settings,
|
|
118
|
+
constants, and scripts. MDA output includes only official roots; working
|
|
119
|
+
directories such as `data`, `log`, `run`, `build`, and `.gradle` are excluded.
|
|
120
|
+
|
|
121
|
+
## Regression evidence
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
script/runtime_boot_regression App.mpr /missing/deployment \
|
|
125
|
+
~/.local/share/mendix/11.12.1
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The regression creates a temporary deployment, compiles Java and web output,
|
|
129
|
+
packages it, starts Runtime, and requires HTTP 200 for `/`, `dist/index.js`, and
|
|
130
|
+
every generated page bundle. It also requires a clean shutdown. The transcript
|
|
131
|
+
and SHA-256 are written to `tmp/runtime-boot-evidence.log`. When Chromium is
|
|
132
|
+
installed, it imports every module and instantiates factories that do not need
|
|
133
|
+
a session. The Data Grid bundle is imported and evaluated; its factory reads
|
|
134
|
+
the client session and therefore requires an authenticated test to instantiate.
|
|
135
|
+
|
|
136
|
+
On August 1, 2026, VetClinic 11.12.1 started from no deployment, executed 675
|
|
137
|
+
database synchronization commands, initialized the `System` queues, scheduled
|
|
138
|
+
`VetClinic.Cleanup`, returned 200 for all four page bundles, and shut down
|
|
139
|
+
cleanly. The `ACT Create Animal` functional test then passed.
|
|
140
|
+
|
|
141
|
+
## Explicit boundaries
|
|
142
|
+
|
|
143
|
+
- all 12 stages and clean web generation are validated on 6.10.8, 7.5.0,
|
|
144
|
+
7.17.0, 9.6.1.29396, 10.24.0.73019, and 11.12.1;
|
|
145
|
+
- exact native boot is proven on 10.24.0.73019 and 11.12.1. The installed 6/7/9
|
|
146
|
+
distributions contain the exact Runtime bundles but no compatible launcher; `db up` fails closed
|
|
147
|
+
instead of substituting the Java-21 launcher from 11;
|
|
148
|
+
- Data Grid 1 is covered while other Dojo widgets remain explicit manifest
|
|
149
|
+
findings;
|
|
150
|
+
- the optimized Mendix 10 React/Rollup path is covered by a from-scratch app;
|
|
151
|
+
the Mendix 11 React path is covered by clean preflights and complete Rspack
|
|
152
|
+
builds of LearnNow, MyFirstModule, SLATaskApp, Sudoku and VetClinic. This
|
|
153
|
+
fixture matrix is evidence for the audited contracts, not a universal claim;
|
|
154
|
+
- native web bundles are generated; React Native still relies on existing
|
|
155
|
+
version-template and project assets;
|
|
156
|
+
- `mx` and `mxbuild` are never fallbacks. Unsupported input produces a clear
|
|
157
|
+
compiler error or a support-manifest entry.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Conventions
|
|
2
|
+
|
|
3
|
+
[Português](../pt-BR/conventions.md) · **English** · [Deutsch](../de-DE/conventions.md)
|
|
4
|
+
|
|
5
|
+
Conventions that hold across the MXRB codebase, its tests and its
|
|
6
|
+
documentation. Some are enforced mechanically; the rest are enforced in
|
|
7
|
+
review. Writing-style guidance for exported projects lives in
|
|
8
|
+
[writing projects](writing.md).
|
|
9
|
+
|
|
10
|
+
## Naming
|
|
11
|
+
|
|
12
|
+
- Mendix-qualified names (`Sales.Order`) are canonical everywhere: in the
|
|
13
|
+
model, in comparisons, in errors. Ruby never renames the underlying
|
|
14
|
+
artifact.
|
|
15
|
+
- Ruby files use `snake_case`; classes use `CamelCase`; symbols may adapt a
|
|
16
|
+
Mendix name for readability without changing its identity.
|
|
17
|
+
- Public API methods read as verbs or queries (`plan_rename`, `apply!`,
|
|
18
|
+
`references_to`, `impact_of`); bang methods write, non-bang methods plan or
|
|
19
|
+
read.
|
|
20
|
+
- Plan objects expose `changes` and `apply!`; report objects expose typed
|
|
21
|
+
collections (`diagnostics`, `call_cycles`, `module_dependencies`).
|
|
22
|
+
|
|
23
|
+
## Error handling
|
|
24
|
+
|
|
25
|
+
- Raise typed errors from `Mxrb::Error` downward; rescue `StandardError` only
|
|
26
|
+
at execution boundaries (CLI, runtime executor, installer cleanup).
|
|
27
|
+
- Unknown encodings and corrupt structures are rejected explicitly. A
|
|
28
|
+
non-BSON `.mxunit` raises instead of being overwritten by trial; an
|
|
29
|
+
unexpected change to a file after a migration preview raises
|
|
30
|
+
`SerializationError` instead of writing stale content.
|
|
31
|
+
- Preservation and rejection are different answers to different questions: an
|
|
32
|
+
unknown *structure* is preserved losslessly; an unknown *encoding* is a
|
|
33
|
+
hard stop.
|
|
34
|
+
- Read-only opens never write: cache persistence, plan application and
|
|
35
|
+
version migration all require `readonly: false`.
|
|
36
|
+
|
|
37
|
+
## Testing
|
|
38
|
+
|
|
39
|
+
- `bundle exec rspec` is the default suite; everything must pass.
|
|
40
|
+
- CI sets `MXRB_LINE_COVERAGE_MIN=100` and `MXRB_BRANCH_COVERAGE_MIN=100`; the
|
|
41
|
+
local helper defaults to 100/100 when those variables are omitted.
|
|
42
|
+
`bundle exec ruby script/branch_report.rb` lists uncovered branches by file
|
|
43
|
+
and line.
|
|
44
|
+
- Coverage uses Ruby's native `Coverage` API, not an external gem. Defensive
|
|
45
|
+
branches that only fire on corrupt or malformed input — states the writer
|
|
46
|
+
can never produce — are excluded with `# :nocov:` markers, inline or as
|
|
47
|
+
region toggles. Each exclusion is a reviewed claim about reachability, not
|
|
48
|
+
a way to skip hard tests.
|
|
49
|
+
- Deterministic fuzzing covers BSON documents and `.mxunit` atomic writes.
|
|
50
|
+
- Evidence scripts (`script/validate_matrix`, `script/benchmark`) exist so
|
|
51
|
+
compatibility claims can be re-run instead of trusted.
|
|
52
|
+
- Example files under `examples/` are executable documentation and are
|
|
53
|
+
validated against the public fixtures.
|
|
54
|
+
|
|
55
|
+
## Documentation and localization
|
|
56
|
+
|
|
57
|
+
- Public documentation ships in three locales with identical file sets:
|
|
58
|
+
`docs/pt-BR`, `docs/en-US`, `docs/de-DE`, plus root READMEs per language.
|
|
59
|
+
`docs/README.md` is only the language selector.
|
|
60
|
+
- `spec/documentation_spec.rb` enforces, for every Markdown file in the
|
|
61
|
+
repository:
|
|
62
|
+
- locale file-set parity across all three languages;
|
|
63
|
+
- no broken relative links;
|
|
64
|
+
- no internal workflow traces (tool-continuation notes, model or tooling
|
|
65
|
+
references) — public docs describe the project, not the process that
|
|
66
|
+
wrote them;
|
|
67
|
+
- no Portuguese prose in the English writing guide.
|
|
68
|
+
- Documentation states limits as plainly as capabilities. Unsupported cases
|
|
69
|
+
(for example non-BSON `.mxunit` payloads, or exact Mendix 5 execution
|
|
70
|
+
requiring Windows/Studio Pro) are documented as limitations, not omitted.
|
|
71
|
+
- Relative links are preferred between pages so locale trees stay
|
|
72
|
+
self-contained.
|
|
73
|
+
|
|
74
|
+
## Code style
|
|
75
|
+
|
|
76
|
+
- `# frozen_string_literal: true` everywhere.
|
|
77
|
+
- Immutable value objects (`Data.define`, frozen collections) cross public
|
|
78
|
+
boundaries; mutation stays inside writers and transactions.
|
|
79
|
+
- `bundle exec rubocop` is the gradual static-quality gate.
|
|
80
|
+
- Make the smallest change that satisfies the requirement; the plan objects
|
|
81
|
+
and the lockfile exist so that review can always see exactly what a write
|
|
82
|
+
will do before it happens.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Navigation and design system
|
|
2
|
+
|
|
3
|
+
[Português](../pt-BR/design-system.md) · **English** · [Deutsch](../de-DE/design-system.md)
|
|
4
|
+
|
|
5
|
+
Navigation and design-system round trips are part of the current typed
|
|
6
|
+
surface. Native profiles, filesystem assets and design-token quality tooling
|
|
7
|
+
are covered by the public test and fixture matrix.
|
|
8
|
+
|
|
9
|
+
## Native navigation
|
|
10
|
+
|
|
11
|
+
A Mendix navigation document is read as typed Ruby through
|
|
12
|
+
`project.navigation`:
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
Mxrb.open("app.mpr") do |project|
|
|
16
|
+
project.navigation.profiles.each do |profile|
|
|
17
|
+
puts "#{profile.name} (#{profile.kind})"
|
|
18
|
+
puts " home page: #{profile.home_page}"
|
|
19
|
+
puts " home microflow: #{profile.home_microflow}"
|
|
20
|
+
puts " sign-in page: #{profile.sign_in_page}"
|
|
21
|
+
puts " app title: #{profile.app_title}" # { "en_US" => "...", "nl_NL" => "..." }
|
|
22
|
+
|
|
23
|
+
profile.role_homes.each do |home|
|
|
24
|
+
puts " #{home[:role]} -> #{home[:page] || home[:microflow]}"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
profile.menu_items.each do |item|
|
|
28
|
+
puts " #{item[:caption]} -> #{item[:page] || item[:microflow]}"
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Coverage and behavior:
|
|
35
|
+
|
|
36
|
+
- Modern `Profiles` and the legacy Mendix 5/6 profile documents
|
|
37
|
+
(`DesktopProfile`, `PhoneProfile`, `TabletProfile`, hybrid and offline
|
|
38
|
+
variants) are normalized into the same `NavigationProfile` objects.
|
|
39
|
+
- Home pages per role, nested menu trees, icons and caption translations are
|
|
40
|
+
exposed as plain Ruby data.
|
|
41
|
+
- `offline?` flags offline-capable profiles.
|
|
42
|
+
- Navigation references participate in the semantic index, so
|
|
43
|
+
`references_from`, rename and remove plans already account for navigation
|
|
44
|
+
targets.
|
|
45
|
+
|
|
46
|
+
The same structures can be declared in the Ruby DSL and written back to the
|
|
47
|
+
native navigation document. Rename, remove, diff and lint operate on those
|
|
48
|
+
references, including user-role access to role-specific homes.
|
|
49
|
+
|
|
50
|
+
## Design tokens from real stylesheets
|
|
51
|
+
|
|
52
|
+
`project.design_system` scans the project directory (`theme/`,
|
|
53
|
+
`themesource/`, `resources/`, `widgets/`, `javasource/`,
|
|
54
|
+
`javascriptsource/`) for CSS custom properties and SCSS variables:
|
|
55
|
+
|
|
56
|
+
```ruby
|
|
57
|
+
design = project.design_system
|
|
58
|
+
|
|
59
|
+
design.tokens.each do |token|
|
|
60
|
+
puts "#{token.name}: #{token.value} (#{token.kind}, #{token.path}:#{token.line})"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
design.themes # theme names derived from _theme-<name>.scss files
|
|
64
|
+
design.catalogs # themesource/**/design-properties.json contents
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Each `DesignToken` is an immutable value with `name`, `value`, `kind`
|
|
68
|
+
(`:css_custom_property` or `:scss_variable`), `theme`, `path` and `line`.
|
|
69
|
+
|
|
70
|
+
## Materializing the Ruby contract
|
|
71
|
+
|
|
72
|
+
Tokens declared through the Ruby `design_system` DSL are written to real theme
|
|
73
|
+
assets during generation. MXRB owns
|
|
74
|
+
`theme/web/_mxrb-design-system.scss`, adds one idempotent import to
|
|
75
|
+
`theme/web/main.scss`, and publishes color tokens as Studio `ColorPicker`
|
|
76
|
+
entries in `themesource/mxrb/web/design-properties.json`.
|
|
77
|
+
|
|
78
|
+
Global tokens become CSS custom properties. Named themes become
|
|
79
|
+
`data-mxrb-theme`/`.mxrb-theme-*` selectors; inheritance is resolved before
|
|
80
|
+
writing and child values override parent values. Existing `main.scss` content
|
|
81
|
+
is preserved. Invalid names, inheritance cycles, and values that could escape
|
|
82
|
+
the generated CSS declaration are rejected before writing.
|
|
83
|
+
|
|
84
|
+
## Guidelines the tooling enforces
|
|
85
|
+
|
|
86
|
+
### Prefer tokens over literals
|
|
87
|
+
|
|
88
|
+
Hard-coded colors scattered through stylesheets drift out of sync with the
|
|
89
|
+
theme. `literal_colors` lists tokens whose values are raw hex colors, and
|
|
90
|
+
`unresolved_references` lists `var(--x)` references that point to a token
|
|
91
|
+
that does not exist:
|
|
92
|
+
|
|
93
|
+
```ruby
|
|
94
|
+
design.literal_colors
|
|
95
|
+
design.unresolved_references.each do |issue|
|
|
96
|
+
puts "#{issue[:reference]} used by #{issue[:token].name} is undefined"
|
|
97
|
+
end
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Check accessibility contrast
|
|
101
|
+
|
|
102
|
+
`contrast_ratio` computes the WCAG luminance ratio between two hex colors:
|
|
103
|
+
|
|
104
|
+
```ruby
|
|
105
|
+
design.contrast_ratio("#777777", "#ffffff") # => 4.48
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Ratios of at least 4.5 are the common baseline for normal text (7 for the
|
|
109
|
+
enhanced level); the method returns the number so projects can assert their
|
|
110
|
+
own thresholds in evaluations or lint rules.
|
|
111
|
+
|
|
112
|
+
### Migrate literals with preview and safe apply
|
|
113
|
+
|
|
114
|
+
Literal replacement follows the same plan / preview / `apply!` discipline as
|
|
115
|
+
semantic refactoring:
|
|
116
|
+
|
|
117
|
+
```ruby
|
|
118
|
+
plan = project.plan_design_token_migration("#777777" => "var(--color-foreground)")
|
|
119
|
+
|
|
120
|
+
plan.changes.each do |change|
|
|
121
|
+
puts "#{change.path}: #{change.occurrences} occurrence(s)"
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
plan.apply!
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Guarantees:
|
|
128
|
+
|
|
129
|
+
- every change lists its file, before/after contents and occurrence count;
|
|
130
|
+
- `apply!` re-checks each file's SHA-256 against the preview and raises
|
|
131
|
+
`SerializationError` if a file changed meanwhile — a stale preview is never
|
|
132
|
+
written;
|
|
133
|
+
- each file is written through a temporary file plus atomic rename;
|
|
134
|
+
- a plan applies once; re-applying raises.
|
|
135
|
+
|
|
136
|
+
The same workflows are exposed by the CLI:
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
bundle exec mxrb design scan App.mpr
|
|
140
|
+
bundle exec mxrb design scan App.mpr --json
|
|
141
|
+
bundle exec mxrb design migrate App.mpr '#3366ff' 'var(--brand-primary)'
|
|
142
|
+
bundle exec mxrb design migrate App.mpr '#3366ff' 'var(--brand-primary)' --apply
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
`scan` prints each token's name, value, kind, theme, and source location, plus
|
|
146
|
+
literal-color and unresolved-reference totals. `migrate` remains a preview
|
|
147
|
+
until `--apply` is supplied. Contrast pairs declared in the Ruby contract are
|
|
148
|
+
checked by `mxrb lint` against their configured WCAG level.
|
|
149
|
+
|
|
150
|
+
## Themes, resources and unknown structures
|
|
151
|
+
|
|
152
|
+
Themes, images, widgets, resources and Java sources are copied through
|
|
153
|
+
`.mxrb/assets.json`. Every entry has a relative path, size and SHA-256 digest;
|
|
154
|
+
reconstruction rejects traversal, missing files and checksum mismatches.
|
|
155
|
+
Unknown model units remain in the lossless native baseline.
|
|
156
|
+
|
|
157
|
+
## Validation status
|
|
158
|
+
|
|
159
|
+
The typed navigation writer, design-system materializer, asset manifest,
|
|
160
|
+
contrast/literal lint and atomic migration are implemented. Structural round
|
|
161
|
+
trips pass the six-fixture matrix, including modern `Profiles` and preserved
|
|
162
|
+
legacy navigation shapes. See the [validation matrix](validation-matrix.md)
|
|
163
|
+
for the current evidence.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Entity DSL
|
|
2
|
+
|
|
3
|
+
[Português](../pt-BR/entity-dsl.md) · **English** · [Deutsch](../de-DE/entity-dsl.md)
|
|
4
|
+
|
|
5
|
+
Files created by `mxrb entity new Module.Entity` are evaluated inside the
|
|
6
|
+
module block, so declarations use the local name:
|
|
7
|
+
|
|
8
|
+
```ruby
|
|
9
|
+
entity :Animal do
|
|
10
|
+
documentation "Animal cared for by the clinic"
|
|
11
|
+
string :Name, default: "", documentation: "Display name"
|
|
12
|
+
integer :Age, default: 0
|
|
13
|
+
long :ExternalId
|
|
14
|
+
float :Weight
|
|
15
|
+
decimal :Balance
|
|
16
|
+
boolean :Active, default: true
|
|
17
|
+
datetime :BirthDate
|
|
18
|
+
autonumber :Sequence
|
|
19
|
+
hashstring :PasswordHash
|
|
20
|
+
binary :Document
|
|
21
|
+
enum :Species, enumeration: "VetClinic.AnimalSpecies"
|
|
22
|
+
end
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Available types are `string`, `integer`, `long`, `float`, `decimal`, `boolean`,
|
|
26
|
+
`datetime`, `autonumber`, `hashstring`, `binary`, and `enum`. Options currently
|
|
27
|
+
written to the MPR are `default:`, `documentation:`, and `enumeration:` for enum
|
|
28
|
+
attributes. Declare the enumeration separately with `enumeration`; use `enum`
|
|
29
|
+
for an entity attribute.
|
|
30
|
+
|
|
31
|
+
## Associations
|
|
32
|
+
|
|
33
|
+
```ruby
|
|
34
|
+
association "VetClinic.Owner", name: "Animal_Owner" # N:1 Reference
|
|
35
|
+
association "VetClinic.Passport", name: "Animal_Passport", owner: :Both # 1:1
|
|
36
|
+
association "VetClinic.Tag", name: "Animal_Tags", type: :ReferenceSet # N:N
|
|
37
|
+
association "VetClinic.Group", name: "Animal_Groups",
|
|
38
|
+
type: :ReferenceSet, owner: :Both
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The first argument is the qualified target. `type:` accepts `:Reference`
|
|
42
|
+
(default) or `:ReferenceSet`; `owner:` accepts `:Default` or `:Both`.
|
|
43
|
+
|
|
44
|
+
## Persistence, events, and access
|
|
45
|
+
|
|
46
|
+
Use `non_persistent!` for a non-persistable entity. Lifecycle hooks are
|
|
47
|
+
`before_commit`, `after_commit`, `before_delete`, and `after_delete`, each with
|
|
48
|
+
`microflow:`. Access rules accept qualified roles plus `create:`, `delete:`,
|
|
49
|
+
`read:`, `write:`, and `xpath:`; read/write accept `:all`, `:none`, or an
|
|
50
|
+
attribute list.
|
|
51
|
+
|
|
52
|
+
Run `mxrb entity --help`, then validate generated output with
|
|
53
|
+
`mxrb generate project.rb` and `mxrb validate App.mpr`.
|