mxrb 0.1.3 → 0.1.4
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 +4 -4
- data/bin/mxrb +455 -10
- data/docs/de-DE/README.md +1 -0
- data/docs/de-DE/oql-sql.md +42 -0
- data/docs/de-DE/project-structure.md +201 -2
- data/docs/de-DE/runtime-ruby.md +104 -0
- data/docs/de-DE/runtime-schema-migrations.md +44 -0
- data/docs/de-DE/validation-matrix.md +42 -4
- data/docs/en-US/README.md +1 -0
- data/docs/en-US/oql-sql.md +41 -0
- data/docs/en-US/project-structure.md +192 -2
- data/docs/en-US/runtime-ruby.md +100 -0
- data/docs/en-US/runtime-schema-migrations.md +41 -0
- data/docs/en-US/validation-matrix.md +39 -4
- data/docs/pt-BR/README.md +1 -0
- data/docs/pt-BR/oql-sql.md +41 -0
- data/docs/pt-BR/project-structure.md +197 -2
- data/docs/pt-BR/runtime-ruby.md +108 -0
- data/docs/pt-BR/runtime-schema-migrations.md +40 -0
- data/docs/pt-BR/validation-matrix.md +42 -5
- data/lib/mxrb/cli/help.rb +426 -0
- data/lib/mxrb/cli/release.rb +137 -0
- data/lib/mxrb/compiler/compatibility_analyzer.rb +1 -1
- data/lib/mxrb/compiler/data_grid_bundle_compiler.rb +8 -1
- data/lib/mxrb/compiler/domain_document_compiler.rb +3 -0
- data/lib/mxrb/compiler/gallery_bundle_compiler.rb +11 -1
- data/lib/mxrb/compiler/generic_widget_bundle_compiler.rb +76 -19
- data/lib/mxrb/compiler/legacy_custom_widget_compiler.rb +159 -0
- data/lib/mxrb/compiler/legacy_data_grid_compiler.rb +43 -7
- data/lib/mxrb/compiler/legacy_page_builder.rb +1248 -23
- data/lib/mxrb/compiler/page_bundle_compiler.rb +13 -4
- data/lib/mxrb/compiler/web_bundle_builder.rb +5 -1
- data/lib/mxrb/compiler/web_shell_materializer.rb +42 -2
- data/lib/mxrb/compiler/widget_package_extractor.rb +3 -0
- data/lib/mxrb/domain_diagram/lifecycle.rb +272 -0
- data/lib/mxrb/domain_diagram.rb +409 -0
- data/lib/mxrb/dsl/builder.rb +43 -9
- data/lib/mxrb/environment.rb +226 -0
- data/lib/mxrb/exporter.rb +89 -15
- data/lib/mxrb/http/server.rb +107 -0
- data/lib/mxrb/initializer.rb +80 -9
- data/lib/mxrb/integrity/validator.rb +14 -0
- data/lib/mxrb/io/bson_codec.rb +42 -1
- data/lib/mxrb/io/mpr_file.rb +146 -3
- data/lib/mxrb/model/attribute.rb +3 -0
- data/lib/mxrb/model/entity.rb +28 -2
- data/lib/mxrb/model/microflow.rb +3 -1
- data/lib/mxrb/model/page.rb +126 -15
- data/lib/mxrb/model/project.rb +3 -0
- data/lib/mxrb/modeler/catalog.rb +178 -0
- data/lib/mxrb/oql/reverse_translator.rb +394 -0
- data/lib/mxrb/oql/server.rb +4 -8
- data/lib/mxrb/oql.rb +23 -1
- data/lib/mxrb/project_lifecycle.rb +5 -2
- data/lib/mxrb/ruby_app/exporter.rb +1749 -0
- data/lib/mxrb/ruby_app/preset.rb +506 -0
- data/lib/mxrb/ruby_app/session_manager.rb +122 -0
- data/lib/mxrb/ruby_app.rb +1361 -0
- data/lib/mxrb/runtime/access_control.rb +408 -0
- data/lib/mxrb/runtime/native.rb +1015 -93
- data/lib/mxrb/runtime/scheduler.rb +396 -0
- data/lib/mxrb/runtime/schema_migrator.rb +598 -0
- data/lib/mxrb/runtime/shared_store.rb +335 -0
- data/lib/mxrb/runtime/sqlite_store.rb +729 -0
- data/lib/mxrb/scaffold/generator.rb +11 -3
- data/lib/mxrb/uml/activity_diagram.rb +118 -0
- data/lib/mxrb/uml/class_diagram.rb +118 -0
- data/lib/mxrb/uml/sequence_diagram.rb +112 -0
- data/lib/mxrb/uml/server.rb +146 -0
- data/lib/mxrb/uml/support.rb +35 -0
- data/lib/mxrb/version.rb +1 -1
- data/lib/mxrb/web_ui/assets/abnfDiagram-N423BO3Z-C4JD3cEC.js +1 -0
- data/lib/mxrb/web_ui/assets/arc-3Z53kgFp.js +1 -0
- data/lib/mxrb/web_ui/assets/architecture-TIHT7OUA-BStBTLea.js +1 -0
- data/lib/mxrb/web_ui/assets/architectureDiagram-T3A2C74G-DBwqnM4J.js +36 -0
- data/lib/mxrb/web_ui/assets/array-BifhSqXX.js +1 -0
- data/lib/mxrb/web_ui/assets/blockDiagram-VBNYF7ZC-DLtuHt-j.js +132 -0
- data/lib/mxrb/web_ui/assets/c4Diagram-5PPSVZJV-ConSk_pe.js +10 -0
- data/lib/mxrb/web_ui/assets/channel-BhPvD7Dt.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-2GRJ4B5K-D2HpWsf_.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-4I5QYGJK-CiIdNwaF.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-5RXB4S5H-Bu_AaEkE.js +231 -0
- data/lib/mxrb/web_ui/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- data/lib/mxrb/web_ui/assets/chunk-6Q2QTUOP-wQkNmt_X.js +88 -0
- data/lib/mxrb/web_ui/assets/chunk-7BUUIJ7U-Bb538aSH.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-GF5L2VYU-G8MmiBzU.js +206 -0
- data/lib/mxrb/web_ui/assets/chunk-I66GZJ75-CulcrLPh.js +127 -0
- data/lib/mxrb/web_ui/assets/chunk-JQJVKLGR-ukjzcdlL.js +156 -0
- data/lib/mxrb/web_ui/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-KBJHAD2P-Wm35lYov.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-KEIR6QF5-BICK3FdT.js +161 -0
- data/lib/mxrb/web_ui/assets/chunk-NSK5VX7P-D2nYrCY4.js +2 -0
- data/lib/mxrb/web_ui/assets/chunk-QR6OTTB3-BrdIzg4Q.js +62 -0
- data/lib/mxrb/web_ui/assets/chunk-RYQCIY6F-CCfZMcW6.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-UBXNYLIW-BPEVYsFK.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-W5SLKNZC-2E6OPhA4.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-WRU74C26-CBIvOyWp.js +70 -0
- data/lib/mxrb/web_ui/assets/chunk-XXDRQBXY-pH58XAyl.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- data/lib/mxrb/web_ui/assets/classDiagram-JCYQIIEL-xiqo4D89.js +1 -0
- data/lib/mxrb/web_ui/assets/classDiagram-v2-OCEON4UE-xiqo4D89.js +1 -0
- data/lib/mxrb/web_ui/assets/cose-bilkent-JH36ORCC-t_flPpii.js +1 -0
- data/lib/mxrb/web_ui/assets/cynefin-VYW2F7L2-BIqktTEv.js +1 -0
- data/lib/mxrb/web_ui/assets/cynefinDiagram-MW4NZA55-C2d--lut.js +62 -0
- data/lib/mxrb/web_ui/assets/cytoscape.esm-B-NFISlW.js +321 -0
- data/lib/mxrb/web_ui/assets/dagre-Buvkdvvj.js +1 -0
- data/lib/mxrb/web_ui/assets/dagre-VZM6K2ZE-CSz2_tb5.js +4 -0
- data/lib/mxrb/web_ui/assets/defaultLocale-BFoDCU3G.js +1 -0
- data/lib/mxrb/web_ui/assets/diagram-7IWD3JNH-DCt7u7V_.js +30 -0
- data/lib/mxrb/web_ui/assets/diagram-B4RE2ZJO-DqZBqkMu.js +3 -0
- data/lib/mxrb/web_ui/assets/diagram-LBJQPF4R-ClIYbIsI.js +24 -0
- data/lib/mxrb/web_ui/assets/diagram-Q27KOJAE-DFxhvthJ.js +24 -0
- data/lib/mxrb/web_ui/assets/diagram-UB23O5K3-BSUTXptv.js +41 -0
- data/lib/mxrb/web_ui/assets/dist-D2qOEbeJ.js +1 -0
- data/lib/mxrb/web_ui/assets/domain-mGOZ1KCG.css +1 -0
- data/lib/mxrb/web_ui/assets/domain-qsjXhy4v.js +1 -0
- data/lib/mxrb/web_ui/assets/ebnfDiagram-BXEA7PRR-B5reICEi.js +1 -0
- data/lib/mxrb/web_ui/assets/erDiagram-JOGREHBK-Co5Mxn2p.js +85 -0
- data/lib/mxrb/web_ui/assets/eventmodeling-45OFAUF4-C1ylhSks.js +1 -0
- data/lib/mxrb/web_ui/assets/flowDiagram-UKHOOZJN-CHXaJIaS.js +1 -0
- data/lib/mxrb/web_ui/assets/ganttDiagram-PKOTCBZU-DPPPaWaz.js +292 -0
- data/lib/mxrb/web_ui/assets/gitGraph-TEB2WS4Q-qS77ywA9.js +1 -0
- data/lib/mxrb/web_ui/assets/gitGraphDiagram-DS77QQ5N-DpAv6-BT.js +106 -0
- data/lib/mxrb/web_ui/assets/graphlib-DS17s2tU.js +1 -0
- data/lib/mxrb/web_ui/assets/info-DKCQHKI2-C9VD1Y4e.js +1 -0
- data/lib/mxrb/web_ui/assets/infoDiagram-6WML65LV-Bk1kbcCy.js +2 -0
- data/lib/mxrb/web_ui/assets/init-C-OQMol4.js +1 -0
- data/lib/mxrb/web_ui/assets/ishikawaDiagram-WSZJBQD7-0gcISBFR.js +70 -0
- data/lib/mxrb/web_ui/assets/journeyDiagram-NVQOT4AX-Dt0RQnlh.js +139 -0
- data/lib/mxrb/web_ui/assets/jsx-runtime-DV0a5kSb.js +9 -0
- data/lib/mxrb/web_ui/assets/kanban-definition-27J2QSJJ-DIPQM7w9.js +89 -0
- data/lib/mxrb/web_ui/assets/katex-CXMH3UgJ.js +257 -0
- data/lib/mxrb/web_ui/assets/line-C0rYD-tL.js +1 -0
- data/lib/mxrb/web_ui/assets/linear-BPPxWorj.js +1 -0
- data/lib/mxrb/web_ui/assets/map-BaFkSB1l.js +1 -0
- data/lib/mxrb/web_ui/assets/mermaid-parser.core-B_UPzTxa.js +7 -0
- data/lib/mxrb/web_ui/assets/mindmap-definition-FAOFIHXS-CdJRSMuk.js +96 -0
- data/lib/mxrb/web_ui/assets/modeler-BNqHthwk.css +1 -0
- data/lib/mxrb/web_ui/assets/modeler-CQmqflbg.js +1 -0
- data/lib/mxrb/web_ui/assets/ordinal-BDEzSJ7C.js +1 -0
- data/lib/mxrb/web_ui/assets/packet-7NZHBO7P-CwQ4NSBs.js +1 -0
- data/lib/mxrb/web_ui/assets/path-fybaL0A-.js +1 -0
- data/lib/mxrb/web_ui/assets/pegDiagram-VL7TDLO6-D40S7ppx.js +1 -0
- data/lib/mxrb/web_ui/assets/pie-RZYD4A2V-CJroHMKh.js +1 -0
- data/lib/mxrb/web_ui/assets/pieDiagram-7S7Q4E2Y-QB54__BV.js +39 -0
- data/lib/mxrb/web_ui/assets/quadrantDiagram-CIZ2JOQS-DBhDS6ag.js +7 -0
- data/lib/mxrb/web_ui/assets/radar-I7S5WNFK-DdIUwd2d.js +1 -0
- data/lib/mxrb/web_ui/assets/railroad-3IZDKUUU-B1Lw6Xyq.js +1 -0
- data/lib/mxrb/web_ui/assets/railroad-abnf-AHOZXSZD-CQgQoeak.js +1 -0
- data/lib/mxrb/web_ui/assets/railroad-ebnf-EBAXGLYW-D7qEQ2x8.js +1 -0
- data/lib/mxrb/web_ui/assets/railroad-peg-LSFZ7HO6-C005Vxbb.js +1 -0
- data/lib/mxrb/web_ui/assets/railroadDiagram-AXF67PYL-BBP2qk7M.js +1 -0
- data/lib/mxrb/web_ui/assets/requirementDiagram-LRYGKXZP-D2cLsAoI.js +84 -0
- data/lib/mxrb/web_ui/assets/rough.esm-Dy-Kn_BL.js +1 -0
- data/lib/mxrb/web_ui/assets/sankeyDiagram-W5VNT64P-Bpi3FiP2.js +40 -0
- data/lib/mxrb/web_ui/assets/sequenceDiagram-SI44F4Z6-DCRcDlVe.js +162 -0
- data/lib/mxrb/web_ui/assets/sizeCapture-X5ZJPWSS-B0uUizjq.js +1 -0
- data/lib/mxrb/web_ui/assets/src-CvxfUak2.js +1 -0
- data/lib/mxrb/web_ui/assets/stateDiagram-OKZ733FA-C2GCEoxl.js +1 -0
- data/lib/mxrb/web_ui/assets/stateDiagram-v2-UEYNNEHI-D2gWgedh.js +1 -0
- data/lib/mxrb/web_ui/assets/swimlanes-SLNWSIFB-CRI9irEW.js +2 -0
- data/lib/mxrb/web_ui/assets/swimlanesDiagram-ULZ7WXOC-C5Wb_-hZ.js +8 -0
- data/lib/mxrb/web_ui/assets/theme-_mxc7BdY.css +1 -0
- data/lib/mxrb/web_ui/assets/timeline-definition-Z64GVDOM-B1-mNg-h.js +120 -0
- data/lib/mxrb/web_ui/assets/treeView-QDETBFTQ-7CTvIwKq.js +1 -0
- data/lib/mxrb/web_ui/assets/treemap-6X3UGDF4-CtL22pq5.js +1 -0
- data/lib/mxrb/web_ui/assets/uml-C3KAFGTq.js +51 -0
- data/lib/mxrb/web_ui/assets/uml-Dn-qd01X.css +1 -0
- data/lib/mxrb/web_ui/assets/vennDiagram-T6HMQDX7-BzVnUEAy.js +34 -0
- data/lib/mxrb/web_ui/assets/wardley-OPB4EBWU-JNi-QNag.js +1 -0
- data/lib/mxrb/web_ui/assets/wardleyDiagram-T6FBY63Y-BUwmAQ-B.js +78 -0
- data/lib/mxrb/web_ui/assets/xychartDiagram-ELKLHX3M-DEQS8sKp.js +7 -0
- data/lib/mxrb/web_ui/domain.html +15 -0
- data/lib/mxrb/web_ui/modeler.html +16 -0
- data/lib/mxrb/web_ui/uml.html +31 -0
- data/lib/mxrb/web_ui.rb +89 -0
- data/lib/mxrb/widget_certification.rb +208 -0
- data/lib/mxrb/writer.rb +200 -24
- data/lib/mxrb.rb +26 -1
- metadata +156 -5
|
@@ -2,8 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
[Português](../pt-BR/project-structure.md) · **English** · [Deutsch](../de-DE/project-structure.md)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
`mxrb export` has two explicit modes. `--mode mendix` is the default and keeps
|
|
6
|
+
the layered Mendix DSL tree. `--mode ruby` creates a conventional executable
|
|
7
|
+
Ruby application with a React + Vite frontend.
|
|
8
|
+
|
|
9
|
+
## Mendix mode
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
bundle exec mxrb export App.mpr app-source --mode mendix
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This tree separates app-wide policy, module behavior, preserved native units
|
|
16
|
+
and filesystem assets:
|
|
7
17
|
|
|
8
18
|
```text
|
|
9
19
|
project.rb
|
|
@@ -46,4 +56,184 @@ The same tree supports all four normal workflows:
|
|
|
46
56
|
- Mendix project to editable Ruby;
|
|
47
57
|
- Mendix export to Ruby and back to a structurally equivalent Mendix project.
|
|
48
58
|
|
|
59
|
+
## Ruby mode
|
|
60
|
+
|
|
61
|
+
Ruby mode can also start without an existing Mendix project:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
bundle exec mxrb init CustomerPortal --mode ruby
|
|
65
|
+
cd CustomerPortal
|
|
66
|
+
bundle install
|
|
67
|
+
npm install --prefix frontend
|
|
68
|
+
bundle exec mxrb run .
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
This creates the conventional application directly with `app/models`,
|
|
72
|
+
`app/dtos`, `app/services`, `app/pages`, and React + Vite. A reversible Mendix
|
|
73
|
+
baseline is isolated under `.mxrb`; it does not dictate the editable source
|
|
74
|
+
layout. Materialize the current project as an MPR with:
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
bundle exec mxrb generate project.rb build/CustomerPortal.mpr
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
New Ruby models become entities, DTOs become non-persistent entities, and the
|
|
81
|
+
bidirectional declarations are synchronized into the MPR. Ruby or React code
|
|
82
|
+
without a native Mendix representation remains checksum-embedded and returns
|
|
83
|
+
unchanged on the next export. Compilation fails explicitly when a structural
|
|
84
|
+
change cannot be represented, preventing a silent partial conversion.
|
|
85
|
+
|
|
86
|
+
To convert an existing MPR, use:
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
bundle exec mxrb export App.mpr app-ruby --mode ruby
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
app/
|
|
94
|
+
models/
|
|
95
|
+
dtos/
|
|
96
|
+
services/
|
|
97
|
+
pages/
|
|
98
|
+
config/application.rb
|
|
99
|
+
frontend/
|
|
100
|
+
package.json
|
|
101
|
+
vite.config.ts
|
|
102
|
+
tsconfig.json
|
|
103
|
+
src/{main.tsx,App.tsx,types.ts,nanoflows.ts,app.css}
|
|
104
|
+
project.rb
|
|
105
|
+
.mxrb/
|
|
106
|
+
ruby-app.json
|
|
107
|
+
runtime/App.mpr
|
|
108
|
+
mendix/
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Persistent entities become records. Non-persistent entities become DTO classes
|
|
112
|
+
and always use the `_dto.rb` suffix, avoiding ambiguous `_2.rb` names. Services
|
|
113
|
+
are ordinary Ruby classes and initially delegate to the pure-Ruby native
|
|
114
|
+
interpreter. Pages expose native metadata to the React + TypeScript frontend.
|
|
115
|
+
The export derives `types.ts` from entities, enumerations, pages, widgets,
|
|
116
|
+
contexts, effects, and API contracts; `npm run typecheck` is part of the Vite build.
|
|
117
|
+
|
|
118
|
+
Install the Ruby and frontend dependencies once, then start both processes with
|
|
119
|
+
one command:
|
|
120
|
+
|
|
121
|
+
```sh
|
|
122
|
+
bundle install
|
|
123
|
+
npm install --prefix frontend
|
|
124
|
+
bundle exec mxrb run .
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
`mxrb run` supervises the loopback Ruby JSON API, served by Puma 8, and the
|
|
128
|
+
Vite development server.
|
|
129
|
+
Vite proxies `/api` to Ruby. Use `--server-port` for the backend port and
|
|
130
|
+
`--client-port` for the frontend port. `--no-frontend` starts only the API.
|
|
131
|
+
The former `--api-port` and `--port` names remain compatibility aliases.
|
|
132
|
+
The global `--no-progress` option is optional and only hides progress output.
|
|
133
|
+
|
|
134
|
+
Two opt-in stacks add familiar Ruby conventions without changing the default
|
|
135
|
+
Ruby mode:
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
bundle exec mxrb init ServiceDesk --mode ruby --flymetothemoon
|
|
139
|
+
bundle exec mxrb export App.mpr app-rails --mode ruby --onrails
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`--flymetothemoon` adds Sinatra, Puma, ActiveRecord, Rake and RSpec.
|
|
143
|
+
`--onrails` adds Rails, Puma, ActiveRecord and RSpec. Both keep React + Vite as
|
|
144
|
+
the integrated application frontend and run through the same `mxrb run .`
|
|
145
|
+
command. ActiveRecord migrations own Ruby-only tables; the MXRB manifest stays
|
|
146
|
+
authoritative for the Mendix domain model and its round-trips.
|
|
147
|
+
|
|
148
|
+
## Browser domain-model diagram
|
|
149
|
+
|
|
150
|
+
Open one or more Mendix module domain models in a DBeaver-inspired ER diagram:
|
|
151
|
+
|
|
152
|
+
```sh
|
|
153
|
+
bundle exec mxrb diagram-er App.mpr --module Sales
|
|
154
|
+
bundle exec mxrb diagram-er App.mpr --module Sales --module Billing \
|
|
155
|
+
--output build/App-layout.mpr
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The sidebar can select several modules together and displays associations
|
|
159
|
+
between them. The browser also supports entity search, drag-and-drop
|
|
160
|
+
positioning, zoom, fit, auto-arrange, grid, attribute visibility, relationship
|
|
161
|
+
routing and draggable source/target anchors. Persistent entities are blue,
|
|
162
|
+
DTO/non-persistent entities yellow, and OQL views green. **Save layout to MPR**
|
|
163
|
+
writes positions and local-association anchors to native Mendix fields;
|
|
164
|
+
cross-module anchors, which have no native BSON field, use isolated MXRB visual
|
|
165
|
+
metadata in the same safe copy. The default copy is `App.domain-layout.mpr`; an
|
|
166
|
+
existing output requires `--force`.
|
|
167
|
+
|
|
168
|
+
**Export PNG** downloads a high-resolution image of the selected modules using
|
|
169
|
+
the current colors, attributes and routes. PNG export does not modify the MPR;
|
|
170
|
+
save the layout separately when those positions must survive a round-trip.
|
|
171
|
+
|
|
172
|
+
Foreground mode remains available and occupies the terminal until `Ctrl+C`.
|
|
173
|
+
Use the managed lifecycle to keep the ER editor in the background; stopping it
|
|
174
|
+
preserves the layout copy and neither the source MPR nor its files are edited or
|
|
175
|
+
removed:
|
|
176
|
+
|
|
177
|
+
```sh
|
|
178
|
+
bundle exec mxrb diagram-er up App.mpr --module Sales
|
|
179
|
+
bundle exec mxrb diagram-er status App.mpr
|
|
180
|
+
bundle exec mxrb diagram-er down App.mpr
|
|
181
|
+
bundle exec mxrb diagram-er up App.mpr # resume the same copy
|
|
182
|
+
bundle exec mxrb diagram-er destroy App.mpr --yes
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
`destroy` stops the server and removes only the copy and external contents
|
|
186
|
+
created by that lifecycle. Management uses a private authenticated loopback
|
|
187
|
+
endpoint; state and token are stored in permission-restricted local files.
|
|
188
|
+
|
|
189
|
+
The editor UI is implemented in React + TypeScript and talks only to the Ruby
|
|
190
|
+
server APIs. Its Vite bundle is compiled into `lib/mxrb/web_ui`, included in the
|
|
191
|
+
gem, and served locally. Node.js is therefore not required to use the installed
|
|
192
|
+
editor, and no CDN is contacted. To develop the UI, run `npm install`,
|
|
193
|
+
`npm run typecheck`, and `npm run build` from `frontend/modeler`.
|
|
194
|
+
ER, UML, OQL, and the generic `--mode ruby` backend share the same embedded
|
|
195
|
+
Puma adapter. `puma ~> 8.0` is a direct MXRB dependency and brings
|
|
196
|
+
`nio4r ~> 2.0` transitively; WEBrick is not part of the HTTP stack.
|
|
197
|
+
|
|
198
|
+
## UML diagrams
|
|
199
|
+
|
|
200
|
+
UML is an additional implementation independent from the ER editor. It uses
|
|
201
|
+
port 4569 and does not change domain-model layout. The viewer combines class,
|
|
202
|
+
microflow activity and call-sequence diagrams rendered with Mermaid:
|
|
203
|
+
|
|
204
|
+
The same server publishes `http://127.0.0.1:4569/modeler`, a React + TypeScript
|
|
205
|
+
visual catalog for modules, pages, microflows and nanoflows, navigation,
|
|
206
|
+
security, integrations, and settings. This first expanded surface is read-only;
|
|
207
|
+
mutations remain locked until they have fail-closed validation and round-trip
|
|
208
|
+
guarantees equivalent to the ER editor.
|
|
209
|
+
|
|
210
|
+
```sh
|
|
211
|
+
bundle exec mxrb uml App.mpr
|
|
212
|
+
bundle exec mxrb uml App.mpr --export=class --module Sales
|
|
213
|
+
bundle exec mxrb uml App.mpr --export=activity \
|
|
214
|
+
--microflow=Sales.CreateOrder --format=plantuml
|
|
215
|
+
bundle exec mxrb uml App.mpr --export=sequence \
|
|
216
|
+
--root=Sales.CreateOrder --depth=3
|
|
217
|
+
bundle exec mxrb uml App.mpr --export=sequence --module=Sales
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Without `--export`, the unified viewer is served at
|
|
221
|
+
`http://127.0.0.1:4569`. Text export defaults to Mermaid; select PlantUML with
|
|
222
|
+
`--format=plantuml`. Sequence diagrams accept either a depth-limited root or
|
|
223
|
+
all calls internal to one module. The viewer uses the same React + TypeScript
|
|
224
|
+
workspace, with Mermaid bundled locally so rendering also works offline.
|
|
225
|
+
|
|
226
|
+
## Version transitions and round-trips
|
|
227
|
+
|
|
228
|
+
Both modes retain the stable Mendix IDs and complete native baseline required
|
|
229
|
+
for upgrades, downgrades and repeated round-trips. In Ruby mode, model/DTO
|
|
230
|
+
declarations are reverse-compiled into the MPR. Ruby service bodies and React
|
|
231
|
+
sources are stored with SHA-256 checksums in the MXRB source table inside the
|
|
232
|
+
MPR, so a later `--mode ruby` export restores the exact edited files.
|
|
233
|
+
|
|
234
|
+
Native Mendix behavior remains authoritative for constructs with no semantic
|
|
235
|
+
Ruby-to-Mendix compiler yet; the coverage manifest records that status instead
|
|
236
|
+
of silently claiming a conversion. The preserved Ruby/React source survives a
|
|
237
|
+
Mendix round-trip even when it has no direct Studio Pro representation.
|
|
238
|
+
|
|
49
239
|
[Back to the documentation index](README.md)
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Java-free runtime
|
|
2
|
+
|
|
3
|
+
Ruby mode runs the backend without starting the Mendix Java Runtime. When an
|
|
4
|
+
exported application opens, MXRB automatically migrates an environment-specific
|
|
5
|
+
SQLite database, opens the microflow interpreter, registers lifecycle hooks,
|
|
6
|
+
enforces security, and starts scheduled events.
|
|
7
|
+
|
|
8
|
+
Profiles live under `config/environments/` and commonly use `development.env`,
|
|
9
|
+
`qa.env`, `staging.env`, and `production.env`. Precedence is process environment,
|
|
10
|
+
profile file, `.env.<profile>`, then `.env`. Select one with `--environment qa`
|
|
11
|
+
or `MXRB_ENV=qa`; `mxrb env . --environment qa` shows sources and key names but
|
|
12
|
+
never values.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
mxrb run . --environment qa
|
|
16
|
+
mxrb test App.mpr smoke.rb --native --environment qa
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Each profile defaults to `.mxrb/runtime/<environment>.sqlite3`. Schema migration
|
|
20
|
+
derives entities, attributes, associations, and system members; additive changes
|
|
21
|
+
are idempotent and incompatible changes use a transactional rebuild. Non-
|
|
22
|
+
persistent entities remain in memory.
|
|
23
|
+
|
|
24
|
+
The Ruby API provides login and bearer tokens, sessions, schema, navigation,
|
|
25
|
+
pages, microflows, CRUD, and published REST. Page and microflow roles, entity
|
|
26
|
+
access rules, member rights, and the safe XPath subset are enforced for every
|
|
27
|
+
request. Credentials come from `MXRB_USERS_JSON` and `MXRB_AUTH_TOKENS` and
|
|
28
|
+
should be supplied by ignored local files or the deployment secret manager.
|
|
29
|
+
|
|
30
|
+
Scheduled events use MXRB's stdlib scheduler with minute, hour, and day
|
|
31
|
+
intervals, overlap protection, and supervised shutdown. IANA time zones such
|
|
32
|
+
as `America/New_York` use `tzinfo`, including daylight-saving transitions.
|
|
33
|
+
Unknown zones fail during scheduling instead of silently falling back to UTC;
|
|
34
|
+
`UTC`, `local`, and numeric offsets such as `-04:00` are also supported.
|
|
35
|
+
|
|
36
|
+
Sessions and scheduler coordination default to the native shared SQLite file
|
|
37
|
+
`.mxrb/runtime/<environment>-shared.sqlite3`, with no external service. Multiple
|
|
38
|
+
instances must point `MXRB_SHARED_STORE_PATH` to the same file. Idempotent
|
|
39
|
+
event-slot claims and heartbeat-renewed overlap leases are atomic; an unfinished
|
|
40
|
+
claim can be recovered after its lease expires. The default lease is 300 seconds
|
|
41
|
+
and can be changed with `MXRB_SCHEDULER_LEASE_TTL`. Set the shared-store path to
|
|
42
|
+
`:memory:`, `memory`, or `local` for explicit process-local mode.
|
|
43
|
+
|
|
44
|
+
Java Custom Actions never start a JVM. Every permitted action must have an
|
|
45
|
+
explicit Ruby adapter registered by qualified name in `config/adapters.rb`:
|
|
46
|
+
|
|
47
|
+
```ruby
|
|
48
|
+
Mxrb::RubyApp::Registry.register_java_custom_action('Orders.CalculateTotal') do |arguments|
|
|
49
|
+
Calculator.call(
|
|
50
|
+
items: arguments.fetch('Items'),
|
|
51
|
+
discount: arguments.fetch('Discount')
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Keys are the parameter names from the Mendix model. Basic values are evaluated
|
|
57
|
+
in the microflow context; entity, microflow, and mapping references are passed
|
|
58
|
+
as qualified names. The return value is assigned only when `UseReturnVariable`
|
|
59
|
+
is enabled (or for the legacy shape that only declares `ResultVariableName`).
|
|
60
|
+
An unregistered action fails closed with its name and registration guidance;
|
|
61
|
+
there is no class discovery, JAR execution, or JVM fallback. REST, app services,
|
|
62
|
+
SOAP, mappings, and document generation continue to use type-level Ruby
|
|
63
|
+
adapters. The browser still runs JavaScript/React, while its backend and APIs run
|
|
64
|
+
without the Java Runtime.
|
|
65
|
+
|
|
66
|
+
## Ruby → Mendix → Ruby certification
|
|
67
|
+
|
|
68
|
+
The reproducible certification scenario lives in
|
|
69
|
+
[`spec/fixtures/flymetothemoon/project.rb`](../../spec/fixtures/flymetothemoon/project.rb).
|
|
70
|
+
It models customers, products, orders, and order lines in Ruby, including an
|
|
71
|
+
enumeration, indexes, associations, microflows, a nanoflow, a scheduled event,
|
|
72
|
+
and a data-grid page. The
|
|
73
|
+
[`spec/flymetothemoon_roundtrip_spec.rb`](../../spec/flymetothemoon_roundtrip_spec.rb)
|
|
74
|
+
test verifies these use cases:
|
|
75
|
+
|
|
76
|
+
- generate and validate a Mendix 11.12.1 MPR from the Ruby DSL;
|
|
77
|
+
- export through the real CLI with `--mode ruby --flymetothemoon`;
|
|
78
|
+
- require Sinatra, Puma, ActiveRecord, and RSpec while producing no Java, JAR,
|
|
79
|
+
or bytecode files;
|
|
80
|
+
- execute creation, aggregation, branching, CRUD, and page metadata through the
|
|
81
|
+
Ruby Runtime and SQLite;
|
|
82
|
+
- compile an unchanged app and structurally compare the MPR with its source;
|
|
83
|
+
- add an attribute and replace a microflow with idiomatic Ruby;
|
|
84
|
+
- export once more and prove that both the Ruby code and Mendix model survive a
|
|
85
|
+
second structurally identical round trip.
|
|
86
|
+
|
|
87
|
+
Run the isolated case with:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
bundle exec rspec spec/flymetothemoon_roundtrip_spec.rb
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
For generated interfaces, the declarative
|
|
94
|
+
[`spec/fixtures/frontend_browser/sudoku_full_flow.json`](../../spec/fixtures/frontend_browser/sudoku_full_flow.json)
|
|
95
|
+
scenario runs through `script/frontend_browser_acceptance` in a real Chromium.
|
|
96
|
+
It covers board positions 73 and 74, selection, value entry, and Easy, Medium,
|
|
97
|
+
and Hard transitions. Each critical click waits for the microflow POST plus the
|
|
98
|
+
association GET and must finish within 250 ms. Gallery queries are filtered by
|
|
99
|
+
context in SQLite; objects loaded through an inverse association retain that
|
|
100
|
+
link when only attributes are committed.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Ruby runtime schema migrations
|
|
2
|
+
|
|
3
|
+
`Mxrb::Runtime::SchemaMigrator` identifies Mendix entities, attributes, and
|
|
4
|
+
associations by storage GUID. Renaming an artifact while preserving its GUID
|
|
5
|
+
keeps the physical table or column and its data.
|
|
6
|
+
|
|
7
|
+
## Safe policy
|
|
8
|
+
|
|
9
|
+
- Creating tables and adding optional attributes is automatic and idempotent.
|
|
10
|
+
- Required attributes are emitted as `NOT NULL`.
|
|
11
|
+
- Making an existing attribute required rebuilds the table transactionally.
|
|
12
|
+
Existing `NULL` values use the declared default; without a default, the
|
|
13
|
+
migration is rejected.
|
|
14
|
+
- Adding a required attribute to a populated table requires a default.
|
|
15
|
+
- Compatible changes preserve entity and association rows.
|
|
16
|
+
- Removing an entity, attribute, or association raises
|
|
17
|
+
`Mxrb::Runtime::UnsafeSchemaMigrationError` by default and leaves the
|
|
18
|
+
database unchanged.
|
|
19
|
+
- After reviewing the plan and taking a backup, destructive cleanup can be
|
|
20
|
+
enabled with `allow_destructive: true`. Only artifacts recorded in MXRB
|
|
21
|
+
metadata are removed; unrelated tables are never inferred or deleted.
|
|
22
|
+
|
|
23
|
+
Exported Ruby applications keep destructive migration disabled. For a
|
|
24
|
+
controlled run after backup, set
|
|
25
|
+
`MXRB_ALLOW_DESTRUCTIVE_MIGRATIONS=true` in the selected environment profile.
|
|
26
|
+
Every other value remains fail-closed.
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
database = SQLite3::Database.new('runtime.sqlite3')
|
|
30
|
+
migrator = Mxrb::Runtime::SchemaMigrator.new(
|
|
31
|
+
project,
|
|
32
|
+
database: database,
|
|
33
|
+
allow_destructive: true
|
|
34
|
+
)
|
|
35
|
+
result = migrator.migrate!
|
|
36
|
+
puts migrator.migration_plan.changes
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
DDL, data copying, metadata updates, and authorized cleanup share one SQLite
|
|
40
|
+
transaction. Any constraint violation or other failure rolls back the complete
|
|
41
|
+
migration.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[Português](../pt-BR/validation-matrix.md) · **English** · [Deutsch](../de-DE/validation-matrix.md)
|
|
4
4
|
|
|
5
|
-
Last updated: 2026-08-
|
|
5
|
+
Last updated: 2026-08-11.
|
|
6
6
|
|
|
7
7
|
The matrix exercises this pipeline using only MXRB:
|
|
8
8
|
|
|
@@ -27,6 +27,23 @@ are never modified.
|
|
|
27
27
|
| `mendixlabs/TreeViewAndGridView` (`TreeviewDemo`) | 5.21.4 | v1 | 176 | pass |
|
|
28
28
|
| `mendixlabs/TreeViewAndGridView` (`GridViewPlayground`) | 6.10.8 | v1 | 122 | pass |
|
|
29
29
|
|
|
30
|
+
On August 11, `script/validate_matrix` repeated the matrix with **6/6 passes**:
|
|
31
|
+
1,506 units, 1,734 artifacts, and 3,388 references in 16.381 seconds.
|
|
32
|
+
|
|
33
|
+
## Additional local inventory
|
|
34
|
+
|
|
35
|
+
`script/certify_mprs --cycles 2 --repair-hashes` certified seven additional
|
|
36
|
+
MPRs through 14 consecutive round trips: **7/7 passes**, 2,799 units, 3,238
|
|
37
|
+
artifacts, and 4,819 references. The set covers LearnNow, SLATaskApp,
|
|
38
|
+
SLATaskAppNative, MyFirstModule, CourseManager, RubyBridgeSandbox, and
|
|
39
|
+
VetClinic.
|
|
40
|
+
|
|
41
|
+
SLATaskApp had one stale content hash and RubyBridgeSandbox had two. The gate
|
|
42
|
+
repaired only `Unit.ContentsHash` in temporary copies, recorded the changed
|
|
43
|
+
UUIDs, and preserved the original BSON bytes. Source files were not modified.
|
|
44
|
+
The second round trip also exposed and fixed native-widget types deserialized
|
|
45
|
+
as strings.
|
|
46
|
+
|
|
30
47
|
The comparator used for this matrix includes:
|
|
31
48
|
|
|
32
49
|
- project metadata and format;
|
|
@@ -162,6 +179,24 @@ and is also expanded into editable `native_unit` hashes in
|
|
|
162
179
|
`.mxrb/native_units.rb`. Concise typed DSLs overlay that complete Ruby
|
|
163
180
|
representation where available.
|
|
164
181
|
|
|
182
|
+
## Widget certification
|
|
183
|
+
|
|
184
|
+
`script/certify_widgets --browser-report REPORT.json App.mpr` is the fail-closed
|
|
185
|
+
gate for native web compiler and Marketplace widgets actually used by a
|
|
186
|
+
project. It jointly requires page/layout compilation without fallbacks, resolution of every
|
|
187
|
+
pluggable ID to an MPK `.mjs` entry with SHA-256, a version-owned native Rspack
|
|
188
|
+
build, and passing Chromium evidence that declares every exercised widget type
|
|
189
|
+
and ID without visible Runtime/widget errors.
|
|
190
|
+
|
|
191
|
+
Importing an MPK or compiling its bundle alone does not certify behavior.
|
|
192
|
+
Widgets that require a datasource, attribute, or specific parent placement only
|
|
193
|
+
pass in a browser scenario configured with that valid context. Future or
|
|
194
|
+
unexercised packages fail as missing evidence instead of inheriting a universal
|
|
195
|
+
compatibility claim.
|
|
196
|
+
The React/TypeScript frontend for `--mode ruby` has a separate track: its
|
|
197
|
+
Chromium report certifies those widgets without claiming that equivalent
|
|
198
|
+
pluggable components also passed in the Mendix Runtime.
|
|
199
|
+
|
|
165
200
|
## Ruby semantic index
|
|
166
201
|
|
|
167
202
|
The Ruby semantic index was built successfully from every original MPR in the
|
|
@@ -202,9 +237,9 @@ instead of dumping the complete removed and added flow bodies.
|
|
|
202
237
|
|
|
203
238
|
## Ruby evaluations and coverage gate
|
|
204
239
|
|
|
205
|
-
The current suite contains 1,
|
|
206
|
-
(
|
|
207
|
-
(
|
|
240
|
+
The current suite contains 1,329 examples and passes with 100.00% line coverage
|
|
241
|
+
(23,771/23,771 executable library lines) and 100.00% branch coverage
|
|
242
|
+
(9,704/9,704 branches).
|
|
208
243
|
Run the enforced gate with:
|
|
209
244
|
|
|
210
245
|
```sh
|
data/docs/pt-BR/README.md
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
- [Roadmap Ruby-first](ruby-first-roadmap.md)
|
|
14
14
|
- [Matriz de validação](validation-matrix.md)
|
|
15
15
|
- [Compilador nativo e Runtime](compiler.md)
|
|
16
|
+
- [Runtime Ruby sem Java e ambientes](runtime-ruby.md)
|
|
16
17
|
- [Relatório de qualidade do build e Runtime](native-runtime-quality-report.md)
|
|
17
18
|
- [Criação e edição de projetos](writing.md)
|
|
18
19
|
- [Scaffolds de projeto](scaffolds.md)
|
data/docs/pt-BR/oql-sql.md
CHANGED
|
@@ -42,6 +42,47 @@ Os nomes físicos devem ser conferidos no banco criado pelo Runtime Mendix
|
|
|
42
42
|
exato. Joins por caminho de associação são declarados não suportados enquanto
|
|
43
43
|
os metadados de armazenamento do Runtime não puderem provar o join correto.
|
|
44
44
|
|
|
45
|
+
## Conversão segura de SQL para OQL
|
|
46
|
+
|
|
47
|
+
O caminho inverso aceita um subconjunto de `SELECT` em PostgreSQL, SQL Server
|
|
48
|
+
ou ANSI e produz OQL lógico. Informar o projeto permite recuperar exatamente a
|
|
49
|
+
capitalização dos módulos, entidades e atributos:
|
|
50
|
+
|
|
51
|
+
```ruby
|
|
52
|
+
projection = Mxrb.open("Shop.mpr") do |project|
|
|
53
|
+
project.sql_to_oql(
|
|
54
|
+
'SELECT p."name" FROM "shop$product" p WHERE p."name" = :Name',
|
|
55
|
+
dialect: :postgresql
|
|
56
|
+
)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
puts projection.oql if projection.supported?
|
|
60
|
+
# SELECT p/Name FROM Shop.Product p WHERE p/Name = $Name
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
O comando unificado `query` converte nas duas direções; `--input -` lê de stdin
|
|
64
|
+
e `--json` retorna o resultado tipado:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
bundle exec mxrb query \
|
|
68
|
+
'SELECT p."name" FROM "shop$product" p WHERE p."name" = :Name' \
|
|
69
|
+
--from sql --to oql --project Shop.mpr --dialect postgresql
|
|
70
|
+
bundle exec mxrb query 'SELECT p/Name FROM Shop.Product p' \
|
|
71
|
+
--from oql --to sql --dialect sql_server
|
|
72
|
+
bundle exec mxrb query --input query.sql --from sql --dialect sql_server --json
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
O subconjunto inclui aliases, joins explícitos, fontes separadas por vírgula,
|
|
76
|
+
`WHERE`, `GROUP BY`, `HAVING`, `UNION`, `ORDER BY`, `LIMIT`/`OFFSET`, funções
|
|
77
|
+
OQL conhecidas e parâmetros nomeados (`:Name`, `@Name` ou `$Name`). Tabelas
|
|
78
|
+
físicas `module$entity` viram `Module.Entity`; sem `--project`, a capitalização
|
|
79
|
+
é inferida e o resultado recebe confiança `inferred`.
|
|
80
|
+
|
|
81
|
+
Escritas, múltiplas instruções, CTEs, subconsultas em `FROM`/`JOIN`, parâmetros
|
|
82
|
+
posicionais, funções desconhecidas e extensões sem equivalente OQL seguro, como `ILIKE`,
|
|
83
|
+
`DISTINCT ON`, `TOP`, `::` e concatenação `||`, retornam `supported? == false`
|
|
84
|
+
com uma explicação em `warnings`.
|
|
85
|
+
|
|
45
86
|
## Análise dialect-aware
|
|
46
87
|
|
|
47
88
|
`Oql::Analyzer` encontra padrões de custo e portabilidade na fonte original,
|
|
@@ -2,8 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
**Português** · [English](../en-US/project-structure.md) · [Deutsch](../de-DE/project-structure.md)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
`mxrb export` possui dois modos explícitos. `--mode mendix` é o padrão e mantém
|
|
6
|
+
a árvore Mendix em DSL por camadas. `--mode ruby` cria uma aplicação Ruby
|
|
7
|
+
convencional e executável com frontend React + Vite.
|
|
8
|
+
|
|
9
|
+
## Modo Mendix
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
bundle exec mxrb export App.mpr app-source --mode mendix
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Essa árvore separa políticas globais, comportamento dos módulos, unidades
|
|
16
|
+
nativas preservadas e assets:
|
|
7
17
|
|
|
8
18
|
```text
|
|
9
19
|
project.rb
|
|
@@ -29,4 +39,189 @@ manifesto são gravadas.
|
|
|
29
39
|
A estrutura suporta Ruby para um Mendix novo, Ruby sobre baseline exportado,
|
|
30
40
|
Mendix para Ruby editável e Mendix → Ruby → Mendix estruturalmente equivalente.
|
|
31
41
|
|
|
42
|
+
## Modo Ruby
|
|
43
|
+
|
|
44
|
+
O modo Ruby também pode começar sem um projeto Mendix existente:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
bundle exec mxrb init CustomerPortal --mode ruby
|
|
48
|
+
cd CustomerPortal
|
|
49
|
+
bundle install
|
|
50
|
+
npm install --prefix frontend
|
|
51
|
+
bundle exec mxrb run .
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Esse comando cria diretamente a aplicação convencional com `app/models`,
|
|
55
|
+
`app/dtos`, `app/services`, `app/pages` e React + Vite. Um baseline Mendix
|
|
56
|
+
reversível fica isolado em `.mxrb`; ele não determina a organização do código
|
|
57
|
+
que será editado. Para materializar o projeto atual em um MPR:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
bundle exec mxrb generate project.rb build/CustomerPortal.mpr
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Models Ruby novos viram entidades, DTOs viram entidades non-persistent e as
|
|
64
|
+
declarações bidirecionais são sincronizadas no MPR. Código Ruby ou React sem
|
|
65
|
+
representação Mendix nativa permanece incorporado com checksum e reaparece
|
|
66
|
+
intacto no próximo export. A compilação falha explicitamente quando uma mudança
|
|
67
|
+
estrutural não pode ser representada, evitando conversão parcial silenciosa.
|
|
68
|
+
|
|
69
|
+
Para converter um MPR que já existe, use:
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
bundle exec mxrb export App.mpr app-ruby --mode ruby
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
app/
|
|
77
|
+
models/
|
|
78
|
+
dtos/
|
|
79
|
+
services/
|
|
80
|
+
pages/
|
|
81
|
+
config/application.rb
|
|
82
|
+
frontend/
|
|
83
|
+
package.json
|
|
84
|
+
vite.config.ts
|
|
85
|
+
tsconfig.json
|
|
86
|
+
src/{main.tsx,App.tsx,types.ts,nanoflows.ts,app.css}
|
|
87
|
+
project.rb
|
|
88
|
+
.mxrb/
|
|
89
|
+
ruby-app.json
|
|
90
|
+
runtime/App.mpr
|
|
91
|
+
mendix/
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Entidades persistentes viram records. Entidades non-persistent viram classes
|
|
95
|
+
DTO e sempre usam o sufixo `_dto.rb`, evitando nomes ambíguos como `_2.rb`.
|
|
96
|
+
Services são classes Ruby comuns e inicialmente delegam ao interpretador nativo
|
|
97
|
+
em Ruby puro. Pages expõem metadados nativos ao frontend React + TypeScript.
|
|
98
|
+
O export gera `types.ts` a partir de entidades, enumerações, páginas, widgets,
|
|
99
|
+
contextos, efeitos e contratos de API; `npm run typecheck` integra o build Vite.
|
|
100
|
+
|
|
101
|
+
Instale as dependências Ruby e do frontend uma vez e depois suba os dois
|
|
102
|
+
processos com um único comando:
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
bundle install
|
|
106
|
+
npm install --prefix frontend
|
|
107
|
+
bundle exec mxrb run .
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
`mxrb run` supervisiona a API JSON Ruby em loopback, servida pelo Puma 8, e o
|
|
111
|
+
servidor Vite. O Vite
|
|
112
|
+
encaminha `/api` para Ruby. Use `--server-port` para a porta do backend e
|
|
113
|
+
`--client-port` para a porta do frontend. `--no-frontend` inicia somente a API.
|
|
114
|
+
Os nomes antigos `--api-port` e `--port` continuam como aliases compatíveis.
|
|
115
|
+
`--no-progress` é global e opcional; apenas oculta a saída de progresso.
|
|
116
|
+
|
|
117
|
+
Duas stacks opcionais adicionam convenções Ruby conhecidas sem alterar o modo
|
|
118
|
+
Ruby padrão:
|
|
119
|
+
|
|
120
|
+
```sh
|
|
121
|
+
bundle exec mxrb init ServiceDesk --mode ruby --flymetothemoon
|
|
122
|
+
bundle exec mxrb export App.mpr app-rails --mode ruby --onrails
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`--flymetothemoon` adiciona Sinatra, Puma, ActiveRecord, Rake e RSpec.
|
|
126
|
+
`--onrails` adiciona Rails, Puma, ActiveRecord e RSpec. Ambas mantêm React +
|
|
127
|
+
Vite como frontend integrado da aplicação e usam o mesmo comando
|
|
128
|
+
`mxrb run .`. As migrations do ActiveRecord controlam apenas tabelas Ruby; o
|
|
129
|
+
manifesto MXRB continua autoritativo para o domain model Mendix e seus
|
|
130
|
+
round-trips.
|
|
131
|
+
|
|
132
|
+
## Diagrama do domain model no browser
|
|
133
|
+
|
|
134
|
+
Abra os domain models de um ou mais módulos Mendix em um diagrama ER inspirado
|
|
135
|
+
no DBeaver:
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
bundle exec mxrb diagram-er App.mpr --module Sales
|
|
139
|
+
bundle exec mxrb diagram-er App.mpr --module Sales --module Billing \
|
|
140
|
+
--output build/App-layout.mpr
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
A barra lateral permite selecionar vários módulos ao mesmo tempo e mostra as
|
|
144
|
+
associações entre eles. A página também oferece busca de entidades,
|
|
145
|
+
posicionamento por drag-and-drop, zoom, ajuste à tela, auto-organização, grade,
|
|
146
|
+
visibilidade de atributos, rotas de relacionamento e pontos de origem/destino
|
|
147
|
+
arrastáveis. Entidades persistentes são azuis, DTOs/non-persistent amarelos e
|
|
148
|
+
OQL views verdes. **Salvar layout no MPR** grava as posições e os pontos das
|
|
149
|
+
associações locais nos campos Mendix nativos; âncoras cross-module, que não têm
|
|
150
|
+
campo BSON nativo, ficam em metadados visuais isolados do MXRB na mesma cópia
|
|
151
|
+
segura. A cópia padrão é `App.domain-layout.mpr`; para substituir uma saída
|
|
152
|
+
existente é necessário `--force`.
|
|
153
|
+
|
|
154
|
+
**Exportar PNG** baixa uma imagem em alta resolução dos módulos selecionados,
|
|
155
|
+
respeitando as cores, a exibição de atributos e as rotas. A exportação não modifica
|
|
156
|
+
o MPR; salve o layout separadamente quando as posições precisarem sobreviver ao
|
|
157
|
+
round-trip.
|
|
158
|
+
|
|
159
|
+
O modo direto continua disponível e ocupa o terminal até `Ctrl+C`. Para manter o
|
|
160
|
+
editor ER em segundo plano, use o lifecycle gerenciado, que preserva a cópia de
|
|
161
|
+
layout ao parar e nunca edita nem remove o MPR de origem:
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
bundle exec mxrb diagram-er up App.mpr --module Sales
|
|
165
|
+
bundle exec mxrb diagram-er status App.mpr
|
|
166
|
+
bundle exec mxrb diagram-er down App.mpr
|
|
167
|
+
bundle exec mxrb diagram-er up App.mpr # retoma a mesma cópia
|
|
168
|
+
bundle exec mxrb diagram-er destroy App.mpr --yes
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
`destroy` para o servidor e remove somente a cópia e os conteúdos externos que
|
|
172
|
+
esse lifecycle criou. O controle usa um endpoint privado autenticado em loopback;
|
|
173
|
+
estado e token ficam em arquivos locais com permissões restritas.
|
|
174
|
+
|
|
175
|
+
A interface do editor é implementada em React + TypeScript e consome somente as
|
|
176
|
+
APIs do servidor Ruby. O bundle Vite é compilado em `lib/mxrb/web_ui`, incluído
|
|
177
|
+
na gem e servido localmente; portanto Node.js não é necessário para usar o
|
|
178
|
+
editor instalado e nenhum CDN é acessado. Para desenvolver a interface, use
|
|
179
|
+
`npm install`, `npm run typecheck` e `npm run build` em `frontend/modeler`.
|
|
180
|
+
ER, UML, OQL e o backend genérico de `--mode ruby` compartilham o mesmo
|
|
181
|
+
adaptador Puma embutido. `puma ~> 8.0` é dependência direta do MXRB e traz
|
|
182
|
+
`nio4r ~> 2.0` transitivamente; WEBrick não faz parte da pilha HTTP.
|
|
183
|
+
|
|
184
|
+
## Diagramas UML
|
|
185
|
+
|
|
186
|
+
UML é uma implementação adicional e independente do editor ER. Ela usa a porta
|
|
187
|
+
4569 e não altera o layout do domain model. O viewer reúne diagramas de classe,
|
|
188
|
+
atividade de microflows e sequência de chamadas, renderizados com Mermaid:
|
|
189
|
+
|
|
190
|
+
O mesmo servidor publica `http://127.0.0.1:4569/modeler`, um catálogo visual
|
|
191
|
+
React + TypeScript para módulos, páginas, microflows e nanoflows, navegação,
|
|
192
|
+
segurança, integrações e configurações. Essa primeira superfície ampliada é
|
|
193
|
+
somente leitura; mutações continuam bloqueadas até terem validação e roundtrip
|
|
194
|
+
fail-closed equivalentes ao editor ER.
|
|
195
|
+
|
|
196
|
+
```sh
|
|
197
|
+
bundle exec mxrb uml App.mpr
|
|
198
|
+
bundle exec mxrb uml App.mpr --export=class --module Sales
|
|
199
|
+
bundle exec mxrb uml App.mpr --export=activity \
|
|
200
|
+
--microflow=Sales.CreateOrder --format=plantuml
|
|
201
|
+
bundle exec mxrb uml App.mpr --export=sequence \
|
|
202
|
+
--root=Sales.CreateOrder --depth=3
|
|
203
|
+
bundle exec mxrb uml App.mpr --export=sequence --module=Sales
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Sem `--export`, o comando abre o viewer unificado em
|
|
207
|
+
`http://127.0.0.1:4569`. A exportação textual usa Mermaid por padrão; selecione
|
|
208
|
+
PlantUML com `--format=plantuml`. Diagramas de sequência aceitam uma raiz com
|
|
209
|
+
profundidade limitada ou todas as chamadas internas de um módulo. O viewer usa
|
|
210
|
+
o mesmo workspace React + TypeScript; Mermaid é empacotado localmente para que a
|
|
211
|
+
renderização também funcione offline.
|
|
212
|
+
|
|
213
|
+
## Transições de versão e round-trips
|
|
214
|
+
|
|
215
|
+
Os dois modos mantêm IDs estáveis do Mendix e o baseline nativo completo usado
|
|
216
|
+
em upgrades, downgrades e round-trips repetidos. No modo Ruby, declarações de
|
|
217
|
+
models/DTOs são compiladas de volta no MPR. Os corpos Ruby dos services e os
|
|
218
|
+
fontes React são armazenados com SHA-256 em uma tabela MXRB dentro do MPR; uma
|
|
219
|
+
nova exportação `--mode ruby` restaura exatamente os arquivos editados.
|
|
220
|
+
|
|
221
|
+
O comportamento Mendix nativo continua autoritativo para construções que ainda
|
|
222
|
+
não possuem compilador semântico Ruby → Mendix. O manifesto de cobertura deixa
|
|
223
|
+
esse estado explícito em vez de alegar uma conversão silenciosa. O código
|
|
224
|
+
Ruby/React preservado sobrevive ao round-trip mesmo sem representação direta no
|
|
225
|
+
Studio Pro.
|
|
226
|
+
|
|
32
227
|
[Voltar ao índice](README.md)
|