mxrb 0.1.2 → 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.
Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/bin/mxrb +458 -10
  3. data/docs/de-DE/README.md +1 -0
  4. data/docs/de-DE/oql-sql.md +42 -0
  5. data/docs/de-DE/project-structure.md +201 -2
  6. data/docs/de-DE/runtime-ruby.md +104 -0
  7. data/docs/de-DE/runtime-schema-migrations.md +44 -0
  8. data/docs/de-DE/validation-matrix.md +42 -4
  9. data/docs/en-US/README.md +1 -0
  10. data/docs/en-US/oql-sql.md +41 -0
  11. data/docs/en-US/project-structure.md +192 -2
  12. data/docs/en-US/runtime-ruby.md +100 -0
  13. data/docs/en-US/runtime-schema-migrations.md +41 -0
  14. data/docs/en-US/validation-matrix.md +39 -4
  15. data/docs/pt-BR/README.md +1 -0
  16. data/docs/pt-BR/entity-dsl.md +8 -0
  17. data/docs/pt-BR/oql-sql.md +41 -0
  18. data/docs/pt-BR/project-structure.md +197 -2
  19. data/docs/pt-BR/runtime-ruby.md +108 -0
  20. data/docs/pt-BR/runtime-schema-migrations.md +40 -0
  21. data/docs/pt-BR/validation-matrix.md +42 -5
  22. data/docs/pt-BR/writing.md +28 -0
  23. data/lib/mxrb/cli/help.rb +426 -0
  24. data/lib/mxrb/cli/release.rb +137 -0
  25. data/lib/mxrb/compiler/compatibility_analyzer.rb +1 -1
  26. data/lib/mxrb/compiler/data_grid_bundle_compiler.rb +8 -1
  27. data/lib/mxrb/compiler/domain_document_compiler.rb +3 -0
  28. data/lib/mxrb/compiler/gallery_bundle_compiler.rb +11 -1
  29. data/lib/mxrb/compiler/generic_widget_bundle_compiler.rb +76 -19
  30. data/lib/mxrb/compiler/legacy_custom_widget_compiler.rb +159 -0
  31. data/lib/mxrb/compiler/legacy_data_grid_compiler.rb +43 -7
  32. data/lib/mxrb/compiler/legacy_page_builder.rb +1248 -23
  33. data/lib/mxrb/compiler/packager.rb +27 -13
  34. data/lib/mxrb/compiler/page_bundle_compiler.rb +13 -4
  35. data/lib/mxrb/compiler/portable_packager.rb +16 -11
  36. data/lib/mxrb/compiler/web_bundle_builder.rb +5 -1
  37. data/lib/mxrb/compiler/web_shell_materializer.rb +42 -2
  38. data/lib/mxrb/compiler/widget_package_extractor.rb +3 -0
  39. data/lib/mxrb/domain_diagram/lifecycle.rb +272 -0
  40. data/lib/mxrb/domain_diagram.rb +409 -0
  41. data/lib/mxrb/dsl/builder.rb +62 -11
  42. data/lib/mxrb/environment.rb +226 -0
  43. data/lib/mxrb/exporter.rb +265 -45
  44. data/lib/mxrb/http/server.rb +107 -0
  45. data/lib/mxrb/initializer.rb +80 -9
  46. data/lib/mxrb/integrity/validator.rb +32 -7
  47. data/lib/mxrb/io/bson_codec.rb +42 -1
  48. data/lib/mxrb/io/mpr_file.rb +146 -3
  49. data/lib/mxrb/model/attribute.rb +3 -0
  50. data/lib/mxrb/model/entity.rb +44 -2
  51. data/lib/mxrb/model/microflow.rb +3 -1
  52. data/lib/mxrb/model/module.rb +71 -0
  53. data/lib/mxrb/model/page.rb +126 -15
  54. data/lib/mxrb/model/project.rb +3 -0
  55. data/lib/mxrb/modeler/catalog.rb +178 -0
  56. data/lib/mxrb/official_marketplace/module_package_importer.rb +23 -12
  57. data/lib/mxrb/official_marketplace/widget_package_installer.rb +15 -11
  58. data/lib/mxrb/official_marketplace.rb +9 -3
  59. data/lib/mxrb/oql/reverse_translator.rb +394 -0
  60. data/lib/mxrb/oql/server.rb +4 -8
  61. data/lib/mxrb/oql.rb +32 -4
  62. data/lib/mxrb/progress.rb +242 -0
  63. data/lib/mxrb/project_lifecycle.rb +5 -2
  64. data/lib/mxrb/ruby_app/exporter.rb +1749 -0
  65. data/lib/mxrb/ruby_app/preset.rb +506 -0
  66. data/lib/mxrb/ruby_app/session_manager.rb +122 -0
  67. data/lib/mxrb/ruby_app.rb +1361 -0
  68. data/lib/mxrb/runtime/access_control.rb +408 -0
  69. data/lib/mxrb/runtime/native.rb +1015 -93
  70. data/lib/mxrb/runtime/scheduler.rb +396 -0
  71. data/lib/mxrb/runtime/schema_migrator.rb +598 -0
  72. data/lib/mxrb/runtime/shared_store.rb +335 -0
  73. data/lib/mxrb/runtime/sqlite_store.rb +729 -0
  74. data/lib/mxrb/scaffold/generator.rb +11 -3
  75. data/lib/mxrb/team_server.rb +10 -7
  76. data/lib/mxrb/uml/activity_diagram.rb +118 -0
  77. data/lib/mxrb/uml/class_diagram.rb +118 -0
  78. data/lib/mxrb/uml/sequence_diagram.rb +112 -0
  79. data/lib/mxrb/uml/server.rb +146 -0
  80. data/lib/mxrb/uml/support.rb +35 -0
  81. data/lib/mxrb/version.rb +1 -1
  82. data/lib/mxrb/web_ui/assets/abnfDiagram-N423BO3Z-C4JD3cEC.js +1 -0
  83. data/lib/mxrb/web_ui/assets/arc-3Z53kgFp.js +1 -0
  84. data/lib/mxrb/web_ui/assets/architecture-TIHT7OUA-BStBTLea.js +1 -0
  85. data/lib/mxrb/web_ui/assets/architectureDiagram-T3A2C74G-DBwqnM4J.js +36 -0
  86. data/lib/mxrb/web_ui/assets/array-BifhSqXX.js +1 -0
  87. data/lib/mxrb/web_ui/assets/blockDiagram-VBNYF7ZC-DLtuHt-j.js +132 -0
  88. data/lib/mxrb/web_ui/assets/c4Diagram-5PPSVZJV-ConSk_pe.js +10 -0
  89. data/lib/mxrb/web_ui/assets/channel-BhPvD7Dt.js +1 -0
  90. data/lib/mxrb/web_ui/assets/chunk-2GRJ4B5K-D2HpWsf_.js +1 -0
  91. data/lib/mxrb/web_ui/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  92. data/lib/mxrb/web_ui/assets/chunk-4I5QYGJK-CiIdNwaF.js +1 -0
  93. data/lib/mxrb/web_ui/assets/chunk-5RXB4S5H-Bu_AaEkE.js +231 -0
  94. data/lib/mxrb/web_ui/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
  95. data/lib/mxrb/web_ui/assets/chunk-6Q2QTUOP-wQkNmt_X.js +88 -0
  96. data/lib/mxrb/web_ui/assets/chunk-7BUUIJ7U-Bb538aSH.js +1 -0
  97. data/lib/mxrb/web_ui/assets/chunk-GF5L2VYU-G8MmiBzU.js +206 -0
  98. data/lib/mxrb/web_ui/assets/chunk-I66GZJ75-CulcrLPh.js +127 -0
  99. data/lib/mxrb/web_ui/assets/chunk-JQJVKLGR-ukjzcdlL.js +156 -0
  100. data/lib/mxrb/web_ui/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  101. data/lib/mxrb/web_ui/assets/chunk-KBJHAD2P-Wm35lYov.js +1 -0
  102. data/lib/mxrb/web_ui/assets/chunk-KEIR6QF5-BICK3FdT.js +161 -0
  103. data/lib/mxrb/web_ui/assets/chunk-NSK5VX7P-D2nYrCY4.js +2 -0
  104. data/lib/mxrb/web_ui/assets/chunk-QR6OTTB3-BrdIzg4Q.js +62 -0
  105. data/lib/mxrb/web_ui/assets/chunk-RYQCIY6F-CCfZMcW6.js +1 -0
  106. data/lib/mxrb/web_ui/assets/chunk-UBXNYLIW-BPEVYsFK.js +1 -0
  107. data/lib/mxrb/web_ui/assets/chunk-W5SLKNZC-2E6OPhA4.js +1 -0
  108. data/lib/mxrb/web_ui/assets/chunk-WRU74C26-CBIvOyWp.js +70 -0
  109. data/lib/mxrb/web_ui/assets/chunk-XXDRQBXY-pH58XAyl.js +1 -0
  110. data/lib/mxrb/web_ui/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  111. data/lib/mxrb/web_ui/assets/classDiagram-JCYQIIEL-xiqo4D89.js +1 -0
  112. data/lib/mxrb/web_ui/assets/classDiagram-v2-OCEON4UE-xiqo4D89.js +1 -0
  113. data/lib/mxrb/web_ui/assets/cose-bilkent-JH36ORCC-t_flPpii.js +1 -0
  114. data/lib/mxrb/web_ui/assets/cynefin-VYW2F7L2-BIqktTEv.js +1 -0
  115. data/lib/mxrb/web_ui/assets/cynefinDiagram-MW4NZA55-C2d--lut.js +62 -0
  116. data/lib/mxrb/web_ui/assets/cytoscape.esm-B-NFISlW.js +321 -0
  117. data/lib/mxrb/web_ui/assets/dagre-Buvkdvvj.js +1 -0
  118. data/lib/mxrb/web_ui/assets/dagre-VZM6K2ZE-CSz2_tb5.js +4 -0
  119. data/lib/mxrb/web_ui/assets/defaultLocale-BFoDCU3G.js +1 -0
  120. data/lib/mxrb/web_ui/assets/diagram-7IWD3JNH-DCt7u7V_.js +30 -0
  121. data/lib/mxrb/web_ui/assets/diagram-B4RE2ZJO-DqZBqkMu.js +3 -0
  122. data/lib/mxrb/web_ui/assets/diagram-LBJQPF4R-ClIYbIsI.js +24 -0
  123. data/lib/mxrb/web_ui/assets/diagram-Q27KOJAE-DFxhvthJ.js +24 -0
  124. data/lib/mxrb/web_ui/assets/diagram-UB23O5K3-BSUTXptv.js +41 -0
  125. data/lib/mxrb/web_ui/assets/dist-D2qOEbeJ.js +1 -0
  126. data/lib/mxrb/web_ui/assets/domain-mGOZ1KCG.css +1 -0
  127. data/lib/mxrb/web_ui/assets/domain-qsjXhy4v.js +1 -0
  128. data/lib/mxrb/web_ui/assets/ebnfDiagram-BXEA7PRR-B5reICEi.js +1 -0
  129. data/lib/mxrb/web_ui/assets/erDiagram-JOGREHBK-Co5Mxn2p.js +85 -0
  130. data/lib/mxrb/web_ui/assets/eventmodeling-45OFAUF4-C1ylhSks.js +1 -0
  131. data/lib/mxrb/web_ui/assets/flowDiagram-UKHOOZJN-CHXaJIaS.js +1 -0
  132. data/lib/mxrb/web_ui/assets/ganttDiagram-PKOTCBZU-DPPPaWaz.js +292 -0
  133. data/lib/mxrb/web_ui/assets/gitGraph-TEB2WS4Q-qS77ywA9.js +1 -0
  134. data/lib/mxrb/web_ui/assets/gitGraphDiagram-DS77QQ5N-DpAv6-BT.js +106 -0
  135. data/lib/mxrb/web_ui/assets/graphlib-DS17s2tU.js +1 -0
  136. data/lib/mxrb/web_ui/assets/info-DKCQHKI2-C9VD1Y4e.js +1 -0
  137. data/lib/mxrb/web_ui/assets/infoDiagram-6WML65LV-Bk1kbcCy.js +2 -0
  138. data/lib/mxrb/web_ui/assets/init-C-OQMol4.js +1 -0
  139. data/lib/mxrb/web_ui/assets/ishikawaDiagram-WSZJBQD7-0gcISBFR.js +70 -0
  140. data/lib/mxrb/web_ui/assets/journeyDiagram-NVQOT4AX-Dt0RQnlh.js +139 -0
  141. data/lib/mxrb/web_ui/assets/jsx-runtime-DV0a5kSb.js +9 -0
  142. data/lib/mxrb/web_ui/assets/kanban-definition-27J2QSJJ-DIPQM7w9.js +89 -0
  143. data/lib/mxrb/web_ui/assets/katex-CXMH3UgJ.js +257 -0
  144. data/lib/mxrb/web_ui/assets/line-C0rYD-tL.js +1 -0
  145. data/lib/mxrb/web_ui/assets/linear-BPPxWorj.js +1 -0
  146. data/lib/mxrb/web_ui/assets/map-BaFkSB1l.js +1 -0
  147. data/lib/mxrb/web_ui/assets/mermaid-parser.core-B_UPzTxa.js +7 -0
  148. data/lib/mxrb/web_ui/assets/mindmap-definition-FAOFIHXS-CdJRSMuk.js +96 -0
  149. data/lib/mxrb/web_ui/assets/modeler-BNqHthwk.css +1 -0
  150. data/lib/mxrb/web_ui/assets/modeler-CQmqflbg.js +1 -0
  151. data/lib/mxrb/web_ui/assets/ordinal-BDEzSJ7C.js +1 -0
  152. data/lib/mxrb/web_ui/assets/packet-7NZHBO7P-CwQ4NSBs.js +1 -0
  153. data/lib/mxrb/web_ui/assets/path-fybaL0A-.js +1 -0
  154. data/lib/mxrb/web_ui/assets/pegDiagram-VL7TDLO6-D40S7ppx.js +1 -0
  155. data/lib/mxrb/web_ui/assets/pie-RZYD4A2V-CJroHMKh.js +1 -0
  156. data/lib/mxrb/web_ui/assets/pieDiagram-7S7Q4E2Y-QB54__BV.js +39 -0
  157. data/lib/mxrb/web_ui/assets/quadrantDiagram-CIZ2JOQS-DBhDS6ag.js +7 -0
  158. data/lib/mxrb/web_ui/assets/radar-I7S5WNFK-DdIUwd2d.js +1 -0
  159. data/lib/mxrb/web_ui/assets/railroad-3IZDKUUU-B1Lw6Xyq.js +1 -0
  160. data/lib/mxrb/web_ui/assets/railroad-abnf-AHOZXSZD-CQgQoeak.js +1 -0
  161. data/lib/mxrb/web_ui/assets/railroad-ebnf-EBAXGLYW-D7qEQ2x8.js +1 -0
  162. data/lib/mxrb/web_ui/assets/railroad-peg-LSFZ7HO6-C005Vxbb.js +1 -0
  163. data/lib/mxrb/web_ui/assets/railroadDiagram-AXF67PYL-BBP2qk7M.js +1 -0
  164. data/lib/mxrb/web_ui/assets/requirementDiagram-LRYGKXZP-D2cLsAoI.js +84 -0
  165. data/lib/mxrb/web_ui/assets/rough.esm-Dy-Kn_BL.js +1 -0
  166. data/lib/mxrb/web_ui/assets/sankeyDiagram-W5VNT64P-Bpi3FiP2.js +40 -0
  167. data/lib/mxrb/web_ui/assets/sequenceDiagram-SI44F4Z6-DCRcDlVe.js +162 -0
  168. data/lib/mxrb/web_ui/assets/sizeCapture-X5ZJPWSS-B0uUizjq.js +1 -0
  169. data/lib/mxrb/web_ui/assets/src-CvxfUak2.js +1 -0
  170. data/lib/mxrb/web_ui/assets/stateDiagram-OKZ733FA-C2GCEoxl.js +1 -0
  171. data/lib/mxrb/web_ui/assets/stateDiagram-v2-UEYNNEHI-D2gWgedh.js +1 -0
  172. data/lib/mxrb/web_ui/assets/swimlanes-SLNWSIFB-CRI9irEW.js +2 -0
  173. data/lib/mxrb/web_ui/assets/swimlanesDiagram-ULZ7WXOC-C5Wb_-hZ.js +8 -0
  174. data/lib/mxrb/web_ui/assets/theme-_mxc7BdY.css +1 -0
  175. data/lib/mxrb/web_ui/assets/timeline-definition-Z64GVDOM-B1-mNg-h.js +120 -0
  176. data/lib/mxrb/web_ui/assets/treeView-QDETBFTQ-7CTvIwKq.js +1 -0
  177. data/lib/mxrb/web_ui/assets/treemap-6X3UGDF4-CtL22pq5.js +1 -0
  178. data/lib/mxrb/web_ui/assets/uml-C3KAFGTq.js +51 -0
  179. data/lib/mxrb/web_ui/assets/uml-Dn-qd01X.css +1 -0
  180. data/lib/mxrb/web_ui/assets/vennDiagram-T6HMQDX7-BzVnUEAy.js +34 -0
  181. data/lib/mxrb/web_ui/assets/wardley-OPB4EBWU-JNi-QNag.js +1 -0
  182. data/lib/mxrb/web_ui/assets/wardleyDiagram-T6FBY63Y-BUwmAQ-B.js +78 -0
  183. data/lib/mxrb/web_ui/assets/xychartDiagram-ELKLHX3M-DEQS8sKp.js +7 -0
  184. data/lib/mxrb/web_ui/domain.html +15 -0
  185. data/lib/mxrb/web_ui/modeler.html +16 -0
  186. data/lib/mxrb/web_ui/uml.html +31 -0
  187. data/lib/mxrb/web_ui.rb +89 -0
  188. data/lib/mxrb/widget_certification.rb +208 -0
  189. data/lib/mxrb/writer.rb +278 -41
  190. data/lib/mxrb.rb +38 -8
  191. metadata +157 -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
- The Ruby tree produced by `mxrb export` separates app-wide policy, module
6
- behavior, preserved native units and filesystem assets:
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-05.
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,039 examples and passes with 100.00% line coverage
206
- (17,224/17,224 executable library lines) and 100.00% branch coverage
207
- (6,811/6,811 branches).
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)
@@ -94,6 +94,12 @@ entity :AnimalSearchResult do
94
94
  string :Name
95
95
  end
96
96
 
97
+ entity :AnimalSummaryView do
98
+ oql_view source: "VetClinic.AnimalSummarySource"
99
+ string :Name
100
+ integer :Total
101
+ end
102
+
97
103
  entity :Animal do
98
104
  before_commit microflow: "VetClinic.VAL_Animal"
99
105
  after_commit microflow: "VetClinic.ACT_AfterAnimalCommit"
@@ -111,6 +117,8 @@ end
111
117
 
112
118
  Em `access_rule`, `read:` e `write:` aceitam `:all`, `:none` ou uma lista de
113
119
  atributos. Declare um ou mais papéis qualificados como primeiros argumentos.
120
+ `oql_view` liga a entidade ao `ViewEntitySourceDocument`; ao exportar um projeto
121
+ existente, a consulta OQL aparece junto da entidade em `domain/oql_views`.
114
122
 
115
123
  Use `mxrb entity --help` para o comando e `mxrb generate project.rb` seguido de
116
124
  `mxrb validate App.mpr` para validar o resultado.
@@ -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,