mxrb 0.1.4 → 0.1.7
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/README.de-DE.md +4 -1
- data/README.md +11 -3
- data/README.pt-BR.md +5 -2
- data/bin/mxrb +509 -358
- data/docker/java-actions/Dockerfile +44 -0
- data/docker/java-actions/src/com/mendix/core/Core.java +491 -0
- data/docker/java-actions/src/com/mendix/core/CoreException.java +11 -0
- data/docker/java-actions/src/com/mendix/core/CoreRuntimeException.java +10 -0
- data/docker/java-actions/src/com/mendix/core/actionmanagement/MicroflowCallBuilder.java +19 -0
- data/docker/java-actions/src/com/mendix/core/conf/Configuration.java +60 -0
- data/docker/java-actions/src/com/mendix/core/conf/RuntimeVersion.java +38 -0
- data/docker/java-actions/src/com/mendix/core/internal/ICore.java +5 -0
- data/docker/java-actions/src/com/mendix/core/objectmanagement/member/MendixAutoNumber.java +10 -0
- data/docker/java-actions/src/com/mendix/core/objectmanagement/member/MendixBinary.java +48 -0
- data/docker/java-actions/src/com/mendix/core/objectmanagement/member/MendixBoolean.java +10 -0
- data/docker/java-actions/src/com/mendix/core/objectmanagement/member/MendixDateTime.java +15 -0
- data/docker/java-actions/src/com/mendix/core/objectmanagement/member/MendixDecimal.java +10 -0
- data/docker/java-actions/src/com/mendix/core/objectmanagement/member/MendixEnum.java +18 -0
- data/docker/java-actions/src/com/mendix/core/objectmanagement/member/MendixHashString.java +10 -0
- data/docker/java-actions/src/com/mendix/core/objectmanagement/member/MendixInteger.java +10 -0
- data/docker/java-actions/src/com/mendix/core/objectmanagement/member/MendixLong.java +10 -0
- data/docker/java-actions/src/com/mendix/core/objectmanagement/member/MendixObjectMember.java +73 -0
- data/docker/java-actions/src/com/mendix/core/objectmanagement/member/MendixObjectReference.java +20 -0
- data/docker/java-actions/src/com/mendix/core/objectmanagement/member/MendixObjectReferenceSet.java +22 -0
- data/docker/java-actions/src/com/mendix/core/objectmanagement/member/MendixString.java +10 -0
- data/docker/java-actions/src/com/mendix/datastorage/DataStorage.java +5 -0
- data/docker/java-actions/src/com/mendix/datastorage/XPathBasicQuery.java +29 -0
- data/docker/java-actions/src/com/mendix/datastorage/XPathQuery.java +41 -0
- data/docker/java-actions/src/com/mendix/externalinterface/connector/RequestHandler.java +38 -0
- data/docker/java-actions/src/com/mendix/http/Http.java +5 -0
- data/docker/java-actions/src/com/mendix/integration/Integration.java +5 -0
- data/docker/java-actions/src/com/mendix/integration/WebserviceException.java +24 -0
- data/docker/java-actions/src/com/mendix/logging/ILogNode.java +35 -0
- data/docker/java-actions/src/com/mendix/logging/LogLevel.java +4 -0
- data/docker/java-actions/src/com/mendix/logging/LogMessage.java +18 -0
- data/docker/java-actions/src/com/mendix/logging/LogSubscriber.java +22 -0
- data/docker/java-actions/src/com/mendix/m2ee/api/IMxRuntimeRequest.java +20 -0
- data/docker/java-actions/src/com/mendix/m2ee/api/IMxRuntimeResponse.java +50 -0
- data/docker/java-actions/src/com/mendix/metrics/Counter.java +7 -0
- data/docker/java-actions/src/com/mendix/metrics/Gauge.java +7 -0
- data/docker/java-actions/src/com/mendix/metrics/Metric.java +17 -0
- data/docker/java-actions/src/com/mendix/metrics/Metrics.java +75 -0
- data/docker/java-actions/src/com/mendix/metrics/Timer.java +10 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/MendixException.java +9 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/MendixRuntimeException.java +9 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/connectionbus/data/IDataColumnSchema.java +7 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/connectionbus/data/IDataRow.java +14 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/connectionbus/data/IDataTable.java +11 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/connectionbus/data/IDataTableSchema.java +13 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/connectionbus/requests/IParameterMap.java +9 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/connectionbus/requests/IRetrievalSchema.java +9 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/connectionbus/requests/ISortExpression.java +7 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/connectionbus/requests/types/IGetRequest.java +9 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/connectionbus/requests/types/IOQLTextGetRequest.java +5 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/connectionbus/requests/types/ITextGetRequest.java +12 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/core/IContext.java +28 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/core/IDataType.java +20 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/core/IEntityProxy.java +27 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/core/IFeedback.java +10 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/core/ILanguage.java +11 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/core/IMendixIdentifier.java +8 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/core/IMendixObject.java +65 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/core/IMendixObjectMember.java +20 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/core/ISession.java +16 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/core/IUser.java +11 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/core/UserAction.java +25 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/core/meta/IMetaAssociation.java +15 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/core/meta/IMetaEnumValue.java +9 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/core/meta/IMetaEnumeration.java +9 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/core/meta/IMetaObject.java +39 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/core/meta/IMetaObjectMember.java +6 -0
- data/docker/java-actions/src/com/mendix/systemwideinterfaces/core/meta/IMetaPrimitive.java +19 -0
- data/docker/java-actions/src/com/mendix/thirdparty/org/json/JSONArray.java +249 -0
- data/docker/java-actions/src/com/mendix/thirdparty/org/json/JSONException.java +14 -0
- data/docker/java-actions/src/com/mendix/thirdparty/org/json/JSONObject.java +279 -0
- data/docker/java-actions/src/com/mendix/thirdparty/org/json/JSONValues.java +273 -0
- data/docker/java-actions/src/com/mendix/utils/ListUtils.java +27 -0
- data/docker/java-actions/src/com/mendix/webui/CustomJavaAction.java +11 -0
- data/docker/java-actions/src/com/mendix/webui/FeedbackHelper.java +30 -0
- data/docker/java-actions/src/javax/servlet/http/Cookie.java +69 -0
- data/docker/java-actions/src/javax/servlet/http/HttpServletRequest.java +21 -0
- data/docker/java-actions/src/javax/servlet/http/HttpServletResponse.java +27 -0
- data/docker/java-actions/src/mxrb/sidecar/Aggregate.java +70 -0
- data/docker/java-actions/src/mxrb/sidecar/Background.java +84 -0
- data/docker/java-actions/src/mxrb/sidecar/Bridge.java +306 -0
- data/docker/java-actions/src/mxrb/sidecar/Build.java +131 -0
- data/docker/java-actions/src/mxrb/sidecar/Captions.java +52 -0
- data/docker/java-actions/src/mxrb/sidecar/Handlers.java +27 -0
- data/docker/java-actions/src/mxrb/sidecar/Invoker.java +110 -0
- data/docker/java-actions/src/mxrb/sidecar/Json.java +234 -0
- data/docker/java-actions/src/mxrb/sidecar/Metadata.java +119 -0
- data/docker/java-actions/src/mxrb/sidecar/MxContext.java +100 -0
- data/docker/java-actions/src/mxrb/sidecar/MxDataTable.java +172 -0
- data/docker/java-actions/src/mxrb/sidecar/MxDataType.java +100 -0
- data/docker/java-actions/src/mxrb/sidecar/MxIdentifier.java +47 -0
- data/docker/java-actions/src/mxrb/sidecar/MxLogNode.java +50 -0
- data/docker/java-actions/src/mxrb/sidecar/MxMetaAssociation.java +62 -0
- data/docker/java-actions/src/mxrb/sidecar/MxMetaEnumeration.java +64 -0
- data/docker/java-actions/src/mxrb/sidecar/MxMetaObject.java +234 -0
- data/docker/java-actions/src/mxrb/sidecar/MxMetaPrimitive.java +88 -0
- data/docker/java-actions/src/mxrb/sidecar/MxMicroflowCall.java +36 -0
- data/docker/java-actions/src/mxrb/sidecar/MxObject.java +258 -0
- data/docker/java-actions/src/mxrb/sidecar/MxOqlRequest.java +101 -0
- data/docker/java-actions/src/mxrb/sidecar/MxRuntimeRequest.java +182 -0
- data/docker/java-actions/src/mxrb/sidecar/MxRuntimeResponse.java +122 -0
- data/docker/java-actions/src/mxrb/sidecar/MxSession.java +91 -0
- data/docker/java-actions/src/mxrb/sidecar/MxXPathQuery.java +127 -0
- data/docker/java-actions/src/mxrb/sidecar/RubyException.java +17 -0
- data/docker/java-actions/src/mxrb/sidecar/Server.java +56 -0
- data/docs/agent-relay/20260901-083127.md +15 -0
- data/docs/agent-relay/20260901-091655.md +16 -0
- data/docs/agent-relay/20260901-094201.md +16 -0
- data/docs/agent-relay/20260901-140415.md +28 -0
- data/docs/de-DE/README.md +2 -0
- data/docs/de-DE/architectural-standard.md +19 -0
- data/docs/de-DE/certificacao-ruby-typescript.md +40 -0
- data/docs/de-DE/cobertura-ruby-nativa.md +265 -0
- data/docs/de-DE/compiler.md +22 -7
- data/docs/de-DE/demanda-projeto-ruby-typescript-convencional.md +37 -0
- data/docs/de-DE/design-system.md +59 -2
- data/docs/de-DE/entity-dsl.md +12 -0
- data/docs/de-DE/method-oriented-flows.md +66 -0
- data/docs/de-DE/portabilidade-ruby-typescript.md +1050 -0
- data/docs/de-DE/project-structure.md +34 -10
- data/docs/de-DE/ruby-first-roadmap.md +286 -0
- data/docs/de-DE/runtime-ruby.md +329 -6
- data/docs/de-DE/scaffolds.md +8 -4
- data/docs/de-DE/studio-backend.md +352 -0
- data/docs/de-DE/validation-matrix.md +235 -19
- data/docs/de-DE/vetclinic-acceptance.md +4 -3
- data/docs/de-DE/windows-studio-pro.md +88 -0
- data/docs/de-DE/writing.md +3 -1
- data/docs/en-US/README.md +2 -0
- data/docs/en-US/architectural-patterns.md +2 -3
- data/docs/en-US/architectural-standard.md +21 -1
- data/docs/en-US/certificacao-ruby-typescript.md +40 -0
- data/docs/en-US/cobertura-ruby-nativa.md +381 -0
- data/docs/en-US/compiler.md +33 -6
- data/docs/en-US/conventions.md +1 -2
- data/docs/en-US/demanda-projeto-ruby-typescript-convencional.md +36 -0
- data/docs/en-US/design-system.md +55 -1
- data/docs/en-US/entity-dsl.md +12 -0
- data/docs/en-US/method-oriented-flows.md +62 -0
- data/docs/en-US/portabilidade-ruby-typescript.md +1050 -0
- data/docs/en-US/project-structure.md +31 -8
- data/docs/en-US/ruby-first-roadmap.md +271 -2
- data/docs/en-US/runtime-ruby.md +313 -7
- data/docs/en-US/scaffolds.md +7 -4
- data/docs/en-US/studio-backend.md +342 -0
- data/docs/en-US/validation-matrix.md +173 -48
- data/docs/en-US/vetclinic-acceptance.md +4 -2
- data/docs/en-US/windows-studio-pro.md +84 -0
- data/docs/en-US/writing.md +8 -3
- data/docs/guides/benchmark-budget.pt-BR.md +99 -0
- data/docs/guides/certificacao-edicoes.pt-BR.md +116 -0
- data/docs/guides/teste-manual-vetclinic-ruby.pt-BR.md +480 -0
- data/docs/planning/backlog.pt-BR.md +101 -0
- data/docs/planning/ruby-editability.pt-BR.md +277 -0
- data/docs/pt-BR/README.md +4 -0
- data/docs/pt-BR/architectural-standard.md +21 -1
- data/docs/pt-BR/certificacao-ruby-typescript.md +116 -0
- data/docs/pt-BR/cobertura-ruby-nativa.md +408 -0
- data/docs/pt-BR/compiler.md +38 -7
- data/docs/pt-BR/demanda-projeto-ruby-typescript-convencional.md +41 -0
- data/docs/pt-BR/design-system.md +58 -2
- data/docs/pt-BR/entity-dsl.md +12 -0
- data/docs/pt-BR/method-oriented-flows.md +158 -0
- data/docs/pt-BR/oql-sql.md +11 -1
- data/docs/pt-BR/portabilidade-ruby-typescript.md +1311 -0
- data/docs/pt-BR/project-structure.md +46 -8
- data/docs/pt-BR/ruby-first-roadmap.md +390 -2
- data/docs/pt-BR/runtime-ruby.md +321 -11
- data/docs/pt-BR/scaffolds.md +17 -4
- data/docs/pt-BR/studio-backend.md +363 -0
- data/docs/pt-BR/validation-matrix.md +211 -21
- data/docs/pt-BR/vetclinic-acceptance.md +4 -5
- data/docs/pt-BR/windows-studio-pro.md +85 -0
- data/docs/pt-BR/writing.md +4 -0
- data/docs/reviews/ruby-code-review-2026-09-05.pt-BR.md +385 -0
- data/examples/modbus_application.rb +105 -0
- data/examples/modbus_tcp_simulator.rb +137 -0
- data/examples/sudoku_evaluation.rb +5 -5
- data/examples/sudoku_functional_test.rb +12 -12
- data/lib/mxrb/architecture/graph.rb +2 -2
- data/lib/mxrb/architecture/validator.rb +5 -3
- data/lib/mxrb/benchmark_fixture.rb +19 -0
- data/lib/mxrb/caption.rb +107 -0
- data/lib/mxrb/cli/help.rb +47 -8
- data/lib/mxrb/compare.rb +236 -74
- data/lib/mxrb/compiler/activity_caption.rb +168 -0
- data/lib/mxrb/compiler/artifact_document_compiler.rb +2 -1
- data/lib/mxrb/compiler/attribute_type_index.rb +57 -0
- data/lib/mxrb/compiler/client_model_materializer.rb +3 -4
- data/lib/mxrb/compiler/code_action_document_compiler.rb +4 -1
- data/lib/mxrb/compiler/compatibility_analyzer.rb +53 -0
- data/lib/mxrb/compiler/constants_materializer.rb +7 -1
- data/lib/mxrb/compiler/data_grid_bundle_compiler.rb +14 -12
- data/lib/mxrb/compiler/database_connector_action_compiler.rb +2 -2
- data/lib/mxrb/compiler/deployment_materializer.rb +3 -2
- data/lib/mxrb/compiler/deployment_metadata.rb +7 -1
- data/lib/mxrb/compiler/domain_document_compiler.rb +26 -2
- data/lib/mxrb/compiler/domain_model_materializer.rb +30 -6
- data/lib/mxrb/compiler/domain_security_compiler.rb +9 -12
- data/lib/mxrb/compiler/java_proxy_generator.rb +34 -2
- data/lib/mxrb/compiler/languages.rb +30 -0
- data/lib/mxrb/compiler/legacy_data_grid_compiler.rb +19 -3
- data/lib/mxrb/compiler/legacy_page_builder.rb +96 -20
- data/lib/mxrb/compiler/mapping_materializer.rb +94 -0
- data/lib/mxrb/compiler/microflow_document_compiler.rb +5 -19
- data/lib/mxrb/compiler/microflow_materializer.rb +12 -1
- data/lib/mxrb/compiler/microflow_node_compiler.rb +257 -20
- data/lib/mxrb/compiler/model_values.rb +26 -0
- data/lib/mxrb/compiler/navigation_document_compiler.rb +73 -66
- data/lib/mxrb/compiler/navigation_grid_compiler.rb +112 -0
- data/lib/mxrb/compiler/page_bundle_builder.rb +17 -1
- data/lib/mxrb/compiler/page_bundle_compiler.rb +783 -147
- data/lib/mxrb/compiler/page_document_compiler.rb +17 -23
- data/lib/mxrb/compiler/published_rest_materializer.rb +117 -0
- data/lib/mxrb/compiler/published_rest_open_api.rb +131 -0
- data/lib/mxrb/compiler/runtime_nodes.rb +68 -0
- data/lib/mxrb/compiler/schemas/forms-11.12.1.json +19781 -0
- data/lib/mxrb/compiler/schemas/languages-10.24.0.73019.json +658 -0
- data/lib/mxrb/compiler/schemas/languages-11.12.1.json +670 -0
- data/lib/mxrb/compiler/schemas/runtime-10.24.0.73019.json +442 -0
- data/lib/mxrb/compiler/schemas/runtime-11.json +176 -0
- data/lib/mxrb/compiler/security_materializer.rb +13 -6
- data/lib/mxrb/compiler/settings_document_compiler.rb +14 -2
- data/lib/mxrb/compiler/settings_materializer.rb +2 -1
- data/lib/mxrb/compiler/source_model.rb +8 -10
- data/lib/mxrb/compiler/synchronized_entities.rb +76 -0
- data/lib/mxrb/compiler/url_segment_compiler.rb +82 -0
- data/lib/mxrb/compiler/user_role_resolver.rb +33 -0
- data/lib/mxrb/compiler/web_list_data_source.rb +6 -2
- data/lib/mxrb/compiler/web_shell_materializer.rb +14 -0
- data/lib/mxrb/compiler/web_widget_inventory.rb +72 -0
- data/lib/mxrb/converter.rb +125 -0
- data/lib/mxrb/dsl/artifact_documents.rb +56 -0
- data/lib/mxrb/dsl/asset_documents.rb +94 -0
- data/lib/mxrb/dsl/builder.rb +102 -1630
- data/lib/mxrb/dsl/code_actions.rb +201 -0
- data/lib/mxrb/dsl/data_view_builder.rb +162 -0
- data/lib/mxrb/dsl/document_builders.rb +185 -0
- data/lib/mxrb/dsl/entity_builder.rb +188 -0
- data/lib/mxrb/dsl/flow_body_dsl.rb +538 -0
- data/lib/mxrb/dsl/flow_builders.rb +362 -0
- data/lib/mxrb/dsl/flow_page_builder.rb +58 -0
- data/lib/mxrb/dsl/flow_program.rb +101 -0
- data/lib/mxrb/dsl/flow_rest_builder.rb +40 -0
- data/lib/mxrb/dsl/flow_text_builder.rb +55 -0
- data/lib/mxrb/dsl/integration_documents.rb +1634 -0
- data/lib/mxrb/dsl/layout_builders.rb +373 -0
- data/lib/mxrb/dsl/module_builder.rb +408 -0
- data/lib/mxrb/dsl/navigation_builders.rb +264 -0
- data/lib/mxrb/dsl/page_builder.rb +219 -0
- data/lib/mxrb/dsl/presentation_documents.rb +161 -0
- data/lib/mxrb/dsl/project_documents.rb +60 -0
- data/lib/mxrb/dsl/security_builder.rb +215 -0
- data/lib/mxrb/dsl/widget_builders.rb +251 -0
- data/lib/mxrb/dsl/widget_design.rb +61 -0
- data/lib/mxrb/dsl/widget_dsl.rb +553 -0
- data/lib/mxrb/dsl/widget_event_arguments.rb +52 -0
- data/lib/mxrb/dsl/workflows.rb +520 -0
- data/lib/mxrb/errors.rb +3 -0
- data/lib/mxrb/evaluation.rb +9 -8
- data/lib/mxrb/exporter/code_action_declarations.rb +133 -0
- data/lib/mxrb/exporter/data_sources.rb +144 -0
- data/lib/mxrb/exporter/domain_document_declarations.rb +222 -0
- data/lib/mxrb/exporter/flow_action_sources.rb +545 -0
- data/lib/mxrb/exporter/flow_linearization.rb +649 -0
- data/lib/mxrb/exporter/integration_declarations.rb +763 -0
- data/lib/mxrb/exporter/method_flow_source.rb +208 -0
- data/lib/mxrb/exporter/model_sources.rb +381 -0
- data/lib/mxrb/exporter/page_sources.rb +756 -0
- data/lib/mxrb/exporter/presentation_declarations.rb +161 -0
- data/lib/mxrb/exporter/project_sources.rb +306 -0
- data/lib/mxrb/exporter/rest_declarations.rb +509 -0
- data/lib/mxrb/exporter/workflow_declarations.rb +652 -0
- data/lib/mxrb/exporter.rb +677 -1491
- data/lib/mxrb/forms/catalog.rb +175 -0
- data/lib/mxrb/forms/certification.rb +115 -0
- data/lib/mxrb/forms/coverage.rb +130 -0
- data/lib/mxrb/forms/input_presentation.rb +55 -0
- data/lib/mxrb/forms/mpr_codec.rb +821 -0
- data/lib/mxrb/forms/node.rb +213 -0
- data/lib/mxrb/forms/source_emitter.rb +296 -0
- data/lib/mxrb/forms/storage_naming.rb +120 -0
- data/lib/mxrb/forms/values.rb +226 -0
- data/lib/mxrb/frontend/migrator.rb +2 -0
- data/lib/mxrb/functional.rb +47 -43
- data/lib/mxrb/github/annotator.rb +31 -27
- data/lib/mxrb/http/server.rb +10 -2
- data/lib/mxrb/integrity/validator.rb +70 -22
- data/lib/mxrb/io/bson_codec.rb +61 -35
- data/lib/mxrb/io/mpr_file.rb +638 -105
- data/lib/mxrb/io/mxunit_codec.rb +3 -3
- data/lib/mxrb/marketplace.rb +77 -73
- data/lib/mxrb/modbus/client.rb +162 -0
- data/lib/mxrb/modbus/rtu_transport.rb +150 -0
- data/lib/mxrb/modbus/stream_io.rb +43 -0
- data/lib/mxrb/modbus/tcp_transport.rb +47 -0
- data/lib/mxrb/modbus.rb +32 -0
- data/lib/mxrb/model/association.rb +28 -28
- data/lib/mxrb/model/attribute.rb +51 -35
- data/lib/mxrb/model/domain_model.rb +33 -16
- data/lib/mxrb/model/entity.rb +80 -70
- data/lib/mxrb/model/menu.rb +54 -13
- data/lib/mxrb/model/microflow.rb +48 -46
- data/lib/mxrb/model/module.rb +85 -42
- data/lib/mxrb/model/navigation.rb +232 -9
- data/lib/mxrb/model/page.rb +1223 -204
- data/lib/mxrb/model/project.rb +61 -15
- data/lib/mxrb/model/unit.rb +10 -9
- data/lib/mxrb/native_fragment_store.rb +184 -0
- data/lib/mxrb/official_marketplace/content_api.rb +13 -1
- data/lib/mxrb/official_marketplace/dependency_resolver.rb +6 -1
- data/lib/mxrb/official_marketplace/widget_package_installer.rb +2 -1
- data/lib/mxrb/oql/server.rb +8 -8
- data/lib/mxrb/pluggable/catalog.rb +179 -0
- data/lib/mxrb/pluggable/mpr_codec.rb +765 -0
- data/lib/mxrb/pluggable/node.rb +347 -0
- data/lib/mxrb/pluggable/schema_dsl.rb +179 -0
- data/lib/mxrb/pluggable/schema_source_emitter.rb +134 -0
- data/lib/mxrb/project_lifecycle.rb +5 -2
- data/lib/mxrb/protocols/entry.rb +29 -0
- data/lib/mxrb/protocols/registry.rb +59 -0
- data/lib/mxrb/protocols.rb +84 -70
- data/lib/mxrb/public_source_audit.rb +201 -0
- data/lib/mxrb/ruby_app/access_rule_builder.rb +27 -0
- data/lib/mxrb/ruby_app/application/offline_synchronization.rb +138 -0
- data/lib/mxrb/ruby_app/application/record_access.rb +402 -0
- data/lib/mxrb/ruby_app/application/request_handlers.rb +45 -0
- data/lib/mxrb/ruby_app/application/schema_security.rb +193 -0
- data/lib/mxrb/ruby_app/application/service_invocation.rb +261 -0
- data/lib/mxrb/ruby_app/application/session_access.rb +97 -0
- data/lib/mxrb/ruby_app/application/value_serialization.rb +148 -0
- data/lib/mxrb/ruby_app/application.rb +201 -0
- data/lib/mxrb/ruby_app/async_invocations.rb +97 -0
- data/lib/mxrb/ruby_app/compilation.rb +64 -0
- data/lib/mxrb/ruby_app/constant.rb +99 -0
- data/lib/mxrb/ruby_app/controller.rb +112 -0
- data/lib/mxrb/ruby_app/dataset.rb +87 -0
- data/lib/mxrb/ruby_app/design_classes.rb +177 -0
- data/lib/mxrb/ruby_app/design_declarations.rb +193 -0
- data/lib/mxrb/ruby_app/domain_rule_builders.rb +123 -0
- data/lib/mxrb/ruby_app/enumeration.rb +91 -0
- data/lib/mxrb/ruby_app/exporter/data_widget_sources.rb +614 -0
- data/lib/mxrb/ruby_app/exporter/document_exports.rb +216 -0
- data/lib/mxrb/ruby_app/exporter/domain_behaviors.rb +67 -0
- data/lib/mxrb/ruby_app/exporter/domain_manifests.rb +283 -0
- data/lib/mxrb/ruby_app/exporter/frontend_pages.rb +161 -0
- data/lib/mxrb/ruby_app/exporter/frontend_types.rb +500 -0
- data/lib/mxrb/ruby_app/exporter/model_sources.rb +376 -0
- data/lib/mxrb/ruby_app/exporter/module_exports.rb +211 -0
- data/lib/mxrb/ruby_app/exporter/nanoflow_typescript.rb +590 -0
- data/lib/mxrb/ruby_app/exporter/project_files.rb +398 -0
- data/lib/mxrb/ruby_app/exporter/support_files.rb +357 -0
- data/lib/mxrb/ruby_app/exporter/widget_manifests.rb +134 -0
- data/lib/mxrb/ruby_app/exporter/widget_sources.rb +510 -0
- data/lib/mxrb/ruby_app/exporter.rb +402 -1565
- data/lib/mxrb/ruby_app/file_content.rb +133 -0
- data/lib/mxrb/ruby_app/flow_metadata.rb +72 -0
- data/lib/mxrb/ruby_app/frontend_package.rb +54 -0
- data/lib/mxrb/ruby_app/frontend_template/package-lock.json +4790 -0
- data/lib/mxrb/ruby_app/frontend_template/src/app/App.tsx +5 -0
- data/lib/mxrb/ruby_app/frontend_template/src/app/router.tsx +18 -0
- data/lib/mxrb/ruby_app/frontend_template/src/components/auth/LoginForm.test.tsx +18 -0
- data/lib/mxrb/ruby_app/frontend_template/src/components/auth/LoginForm.tsx +80 -0
- data/lib/mxrb/ruby_app/frontend_template/src/components/feedback/AppFeedback.tsx +31 -0
- data/lib/mxrb/ruby_app/frontend_template/src/components/navigation/AppNavigation.tsx +45 -0
- data/lib/mxrb/ruby_app/frontend_template/src/core/errors.ts +3 -0
- data/lib/mxrb/ruby_app/frontend_template/src/features/README.md +4 -0
- data/lib/mxrb/ruby_app/frontend_template/src/features/routes.tsx +9 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/ApplicationRuntime.test.tsx +174 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/ApplicationRuntime.tsx +959 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/AsyncInvocation.test.ts +61 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/AsyncInvocation.ts +47 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/ClientActions.test.tsx +234 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/ClientEvents.test.tsx +174 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/CreateActions.test.tsx +114 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/OfflineStartup.test.tsx +154 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/PageDataSource.ts +26 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/PageEdits.test.ts +85 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/PageEdits.ts +132 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/PageVariables.test.tsx +107 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/PageVariables.tsx +272 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/PopupRuntime.test.tsx +226 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/StartupAuthentication.test.tsx +101 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/api.ts +35 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/calendar.test.ts +93 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/calendar.ts +134 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/captions.test.tsx +201 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/captions.ts +235 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/clientFunctions.test.ts +195 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/clientFunctions.ts +182 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/clientServices.ts +24 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/commonsStorage.test.ts +77 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/commonsStorage.ts +44 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/BoundField.test.tsx +339 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/BoundField.tsx +442 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/CoreWidgets.test.tsx +306 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/DataGrid.test.tsx +417 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/DataGrid.tsx +944 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/FieldPolicy.test.ts +96 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/FieldPolicy.tsx +106 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/FileWidget.tsx +152 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/GridIcon.tsx +92 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/LanguageSelector.test.tsx +109 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/LanguageSelector.tsx +130 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/MarketplaceChart.test.tsx +580 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/MarketplaceChart.tsx +576 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/MarketplaceControls.test.tsx +192 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/MarketplaceControls.tsx +193 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/MarketplaceDataWidgets.test.tsx +194 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/MarketplaceGridFilter.test.tsx +213 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/MarketplaceGridFilter.tsx +95 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/MarketplaceInteractive.test.tsx +202 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/MarketplaceInteractive.tsx +246 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/MarketplaceLegacy.test.tsx +171 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/MarketplaceLegacy.tsx +189 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/MarketplaceMenus.tsx +114 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/MarketplacePlotly.test.tsx +96 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/MarketplacePlotly.tsx +162 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/MarketplaceSelection.test.tsx +170 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/MarketplaceSelection.tsx +204 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/MarketplaceTimeline.tsx +116 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/MarketplaceTreeNode.tsx +91 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/NativeDataGrid.tsx +336 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/NativeDataWidgets.test.tsx +233 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/NativeDataWidgets.tsx +288 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/NativeLayout.test.tsx +100 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/NativeLayout.tsx +111 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/NativeScrollContainer.tsx +206 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/NativeSignature.tsx +104 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/NativeWidgets.test.tsx +855 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/NativeWidgets.tsx +1142 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/PageOutlet.test.tsx +74 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/PageOutlet.tsx +63 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/PageTitleContext.ts +7 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/Popup.tsx +181 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/PresentationWidgets.test.tsx +490 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/PresentationWidgets.tsx +566 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/ReferenceSetCombobox.tsx +183 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/SelectionScope.tsx +28 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/TabControl.tsx +88 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/VariableScope.ts +8 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/WidgetRenderer.test.tsx +574 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/WidgetRenderer.tsx +1076 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/autofocus.test.ts +79 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/autofocus.ts +58 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/components/marketplaceData.ts +126 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/contracts.ts +53 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/dateFormatting.ts +297 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/dateParsing.test.ts +189 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/decimal.test.ts +75 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/decimal.ts +132 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/decimalParsing.test.ts +44 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/decimalParsing.ts +123 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/expression.test.ts +139 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/expression.ts +391 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/expressionClient.test.ts +163 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/feedbackCapture.test.ts +75 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/feedbackCapture.ts +51 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/feedbackCaptureWidget.test.tsx +136 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/feedbackCaptureWidget.tsx +79 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/feedbackFiles.test.ts +92 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/feedbackFiles.ts +84 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/feedbackMetadata.test.ts +142 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/feedbackMetadata.ts +49 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/feedbackStorage.test.ts +110 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/feedbackStorage.ts +93 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/legacy/LegacyWidgetHost.tsx +218 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/legacy/amd.ts +104 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/legacy/dojo.ts +474 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/legacy/legacy.test.tsx +518 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/legacy/mx.ts +722 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/legacy/mxGlobal.ts +13 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/legacy/nativeUnavailable.ts +20 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/legacy/session.ts +26 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/listSource.test.tsx +299 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/listSource.ts +177 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/marketplace.tsx +326 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/marketplaceWidgets.json +203 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/marketplaceWidgets.test.tsx +38 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/mendixFilters.test.ts +66 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/mendixFilters.ts +101 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/nanoflow.ts +594 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/nanoflowCommons.test.ts +89 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/nanoflowCommons.ts +57 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/nanoflowData.test.ts +199 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/nanoflowLists.test.ts +34 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/nanoflowOffline.test.ts +130 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/nativeMobileActions.test.ts +310 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/nativeMobileActions.ts +493 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/nativeOnlyJavaScriptActions.test.ts +12 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/objectRestore.test.ts +164 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/objectRestore.ts +123 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/objectStorage.test.ts +179 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/objectStorage.ts +94 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/offlineStore.test.ts +147 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/offlineStore.ts +226 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/plotly.test.ts +55 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/plotly.ts +94 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/pluggableHost.test.tsx +231 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/pluggableHost.tsx +461 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/projectJavaScriptActions.test.ts +158 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/projectJavaScriptActions.ts +91 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/qrCode.test.ts +79 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/qrCode.ts +309 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/schemaLookup.ts +46 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/sort.test.ts +114 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/synchronize.test.ts +167 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/synchronize.ts +156 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/useActionExecution.tsx +100 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/useWidgetEvent.ts +132 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/value.test.ts +89 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/value.ts +319 -0
- data/lib/mxrb/ruby_app/frontend_template/src/generated/bridge/widgetContract.test.ts +32 -0
- data/lib/mxrb/ruby_app/frontend_template/src/layouts/AppLayout.tsx +19 -0
- data/lib/mxrb/ruby_app/frontend_template/src/main.tsx +16 -0
- data/lib/mxrb/ruby_app/frontend_template/src/plotly.d.ts +4 -0
- data/lib/mxrb/ruby_app/frontend_template/src/styles/index.css +1281 -0
- data/lib/mxrb/ruby_app/frontend_template/src/test/setup.ts +1 -0
- data/lib/mxrb/ruby_app/frontend_template/tsconfig.json +23 -0
- data/lib/mxrb/ruby_app/frontend_template/vitest.config.ts +10 -0
- data/lib/mxrb/ruby_app/java_actions_package.rb +118 -0
- data/lib/mxrb/ruby_app/known_community_commons_actions.rb +316 -0
- data/lib/mxrb/ruby_app/known_encryption_actions.rb +162 -0
- data/lib/mxrb/ruby_app/known_feedback_widget.rb +43 -0
- data/lib/mxrb/ruby_app/known_java_actions.rb +66 -0
- data/lib/mxrb/ruby_app/known_javascript_actions.rb +173 -0
- data/lib/mxrb/ruby_app/known_mx_model_reflection_actions.rb +353 -0
- data/lib/mxrb/ruby_app/known_oql_actions.rb +43 -0
- data/lib/mxrb/ruby_app/known_oql_module_actions.rb +101 -0
- data/lib/mxrb/ruby_app/known_startup_actions.rb +115 -0
- data/lib/mxrb/ruby_app/legacy_service_source_migration.rb +142 -0
- data/lib/mxrb/ruby_app/legacy_widget_source_migration.rb +64 -0
- data/lib/mxrb/ruby_app/manifest.rb +41 -0
- data/lib/mxrb/ruby_app/member_identity.rb +135 -0
- data/lib/mxrb/ruby_app/metamodel.rb +197 -0
- data/lib/mxrb/ruby_app/module_security.rb +51 -0
- data/lib/mxrb/ruby_app/native_bridge.rb +96 -0
- data/lib/mxrb/ruby_app/native_edit_patch.rb +69 -0
- data/lib/mxrb/ruby_app/page.rb +321 -0
- data/lib/mxrb/ruby_app/page_data_sources.rb +184 -0
- data/lib/mxrb/ruby_app/page_design_identity.rb +182 -0
- data/lib/mxrb/ruby_app/page_edit_bindings.rb +168 -0
- data/lib/mxrb/ruby_app/page_edit_contracts.rb +144 -0
- data/lib/mxrb/ruby_app/page_edit_properties.rb +93 -0
- data/lib/mxrb/ruby_app/page_edit_texts.rb +104 -0
- data/lib/mxrb/ruby_app/page_edit_translations.rb +67 -0
- data/lib/mxrb/ruby_app/page_edits.rb +662 -0
- data/lib/mxrb/ruby_app/page_widget_renames.rb +40 -0
- data/lib/mxrb/ruby_app/pluggable_context.rb +149 -0
- data/lib/mxrb/ruby_app/pluggable_properties.rb +715 -0
- data/lib/mxrb/ruby_app/pluggable_schemas.rb +28 -0
- data/lib/mxrb/ruby_app/portability_report.rb +127 -0
- data/lib/mxrb/ruby_app/presentation.rb +137 -0
- data/lib/mxrb/ruby_app/presentation_contracts.rb +132 -0
- data/lib/mxrb/ruby_app/presentation_edits.rb +179 -0
- data/lib/mxrb/ruby_app/presentation_exporter.rb +201 -0
- data/lib/mxrb/ruby_app/presentation_projection.rb +62 -0
- data/lib/mxrb/ruby_app/presentation_references.rb +53 -0
- data/lib/mxrb/ruby_app/preset.rb +37 -1
- data/lib/mxrb/ruby_app/project_javascript_actions.rb +78 -0
- data/lib/mxrb/ruby_app/project_security.rb +200 -0
- data/lib/mxrb/ruby_app/project_widget_bundle.rb +74 -0
- data/lib/mxrb/ruby_app/rack_adapter.rb +73 -0
- data/lib/mxrb/ruby_app/record.rb +388 -0
- data/lib/mxrb/ruby_app/record_identity.rb +209 -0
- data/lib/mxrb/ruby_app/record_inheritance.rb +65 -0
- data/lib/mxrb/ruby_app/record_validation.rb +175 -0
- data/lib/mxrb/ruby_app/registry.rb +149 -0
- data/lib/mxrb/ruby_app/regular_expression.rb +58 -0
- data/lib/mxrb/ruby_app/runtime_catalog.rb +106 -0
- data/lib/mxrb/ruby_app/runtime_project.rb +163 -0
- data/lib/mxrb/ruby_app/schedule_builder.rb +134 -0
- data/lib/mxrb/ruby_app/scheduled_event.rb +59 -0
- data/lib/mxrb/ruby_app/security_builders.rb +97 -0
- data/lib/mxrb/ruby_app/security_identity.rb +182 -0
- data/lib/mxrb/ruby_app/server.rb +436 -0
- data/lib/mxrb/ruby_app/service.rb +114 -0
- data/lib/mxrb/ruby_app/session_manager.rb +79 -16
- data/lib/mxrb/ruby_app/sidecar_services.rb +92 -0
- data/lib/mxrb/ruby_app/source_identity.rb +401 -0
- data/lib/mxrb/ruby_app/source_reloader.rb +38 -0
- data/lib/mxrb/ruby_app/supervisor.rb +139 -0
- data/lib/mxrb/ruby_app/synchronizer/document_synchronization.rb +281 -0
- data/lib/mxrb/ruby_app/synchronizer/entity_synchronization.rb +239 -0
- data/lib/mxrb/ruby_app/synchronizer.rb +127 -0
- data/lib/mxrb/ruby_app/thumbnail.rb +54 -0
- data/lib/mxrb/ruby_app/widget_styles.rb +73 -0
- data/lib/mxrb/ruby_app/widget_support.rb +76 -0
- data/lib/mxrb/ruby_app.rb +101 -1299
- data/lib/mxrb/runtime/access_control.rb +54 -101
- data/lib/mxrb/runtime/calendar_functions.rb +142 -0
- data/lib/mxrb/runtime/calendar_ranges.rb +93 -0
- data/lib/mxrb/runtime/client_drafts.rb +167 -0
- data/lib/mxrb/runtime/clipboard.rb +9 -2
- data/lib/mxrb/runtime/constants.rb +66 -0
- data/lib/mxrb/runtime/database_workspace.rb +282 -43
- data/lib/mxrb/runtime/date_formatting.rb +120 -0
- data/lib/mxrb/runtime/date_parse_fields.rb +144 -0
- data/lib/mxrb/runtime/date_parse_matchers.rb +39 -0
- data/lib/mxrb/runtime/date_parsing.rb +102 -0
- data/lib/mxrb/runtime/decimal_formatting.rb +56 -0
- data/lib/mxrb/runtime/decimal_parsing.rb +134 -0
- data/lib/mxrb/runtime/decimal_values.rb +121 -0
- data/lib/mxrb/runtime/docker_executor.rb +15 -14
- data/lib/mxrb/runtime/docker_workspace.rb +8 -8
- data/lib/mxrb/runtime/enumerations.rb +135 -0
- data/lib/mxrb/runtime/executor.rb +25 -25
- data/lib/mxrb/runtime/expression_functions.rb +83 -0
- data/lib/mxrb/runtime/import_mapping.rb +191 -0
- data/lib/mxrb/runtime/java_action_context.rb +224 -0
- data/lib/mxrb/runtime/java_http_exchange.rb +33 -0
- data/lib/mxrb/runtime/java_regex.rb +244 -0
- data/lib/mxrb/runtime/java_sidecar.rb +449 -0
- data/lib/mxrb/runtime/languages.rb +85 -0
- data/lib/mxrb/runtime/lifecycle.rb +21 -0
- data/lib/mxrb/runtime/native.rb +977 -155
- data/lib/mxrb/runtime/oql_case_grammar.rb +56 -0
- data/lib/mxrb/runtime/oql_datasets.rb +96 -0
- data/lib/mxrb/runtime/oql_expression_grammar.rb +128 -0
- data/lib/mxrb/runtime/oql_function_grammar.rb +114 -0
- data/lib/mxrb/runtime/oql_join_sources.rb +125 -0
- data/lib/mxrb/runtime/oql_membership.rb +35 -0
- data/lib/mxrb/runtime/oql_module_query.rb +88 -0
- data/lib/mxrb/runtime/oql_nesting.rb +51 -0
- data/lib/mxrb/runtime/oql_parameters.rb +40 -0
- data/lib/mxrb/runtime/oql_predicate.rb +322 -0
- data/lib/mxrb/runtime/oql_projection_view.rb +90 -0
- data/lib/mxrb/runtime/oql_query_shape.rb +34 -0
- data/lib/mxrb/runtime/oql_relational_query.rb +137 -0
- data/lib/mxrb/runtime/oql_relational_view.rb +100 -0
- data/lib/mxrb/runtime/oql_relations.rb +185 -0
- data/lib/mxrb/runtime/oql_scalar.rb +121 -0
- data/lib/mxrb/runtime/oql_selection.rb +127 -0
- data/lib/mxrb/runtime/oql_selection_terms.rb +50 -0
- data/lib/mxrb/runtime/oql_subquery.rb +40 -0
- data/lib/mxrb/runtime/oql_subquery_grammar.rb +68 -0
- data/lib/mxrb/runtime/oql_table.rb +117 -0
- data/lib/mxrb/runtime/oql_table_query.rb +116 -0
- data/lib/mxrb/runtime/oql_union.rb +31 -0
- data/lib/mxrb/runtime/oql_view_query.rb +62 -0
- data/lib/mxrb/runtime/oql_views.rb +107 -0
- data/lib/mxrb/runtime/password_policy.rb +59 -0
- data/lib/mxrb/runtime/scheduler.rb +61 -10
- data/lib/mxrb/runtime/schema_migrator.rb +133 -19
- data/lib/mxrb/runtime/sort_order.rb +51 -0
- data/lib/mxrb/runtime/sort_path.rb +44 -0
- data/lib/mxrb/runtime/sqlite_store.rb +352 -39
- data/lib/mxrb/runtime/string_functions.rb +42 -0
- data/lib/mxrb/runtime/system_domain.rb +140 -0
- data/lib/mxrb/runtime/system_metamodel.rb +48 -0
- data/lib/mxrb/runtime/system_metamodel_10.24.0.json +5111 -0
- data/lib/mxrb/runtime/system_metamodel_11.12.1.json +5790 -0
- data/lib/mxrb/runtime/system_sign_in.rb +53 -0
- data/lib/mxrb/runtime/time_zones.rb +85 -0
- data/lib/mxrb/runtime/toolchain.rb +16 -16
- data/lib/mxrb/runtime/xpath.rb +414 -0
- data/lib/mxrb/runtime/xpath_dates.rb +101 -0
- data/lib/mxrb/runtime/xpath_functions.rb +82 -0
- data/lib/mxrb/scaffold/cli.rb +14 -13
- data/lib/mxrb/scaffold/generator.rb +29 -7
- data/lib/mxrb/scaffold/help.rb +4 -0
- data/lib/mxrb/scaffold/recipes.rb +43 -4
- data/lib/mxrb/scaffold/templates.rb +101 -19
- data/lib/mxrb/schema/tables.rb +13 -13
- data/lib/mxrb/semantic/analyzer.rb +11 -10
- data/lib/mxrb/semantic/batch_plan.rb +8 -8
- data/lib/mxrb/semantic/domain_mutator.rb +149 -85
- data/lib/mxrb/semantic/extractor.rb +74 -75
- data/lib/mxrb/semantic/index.rb +86 -88
- data/lib/mxrb/semantic/inliner.rb +60 -60
- data/lib/mxrb/semantic/mover.rb +7 -7
- data/lib/mxrb/semantic/remover.rb +1 -1
- data/lib/mxrb/semantic/renamer.rb +23 -22
- data/lib/mxrb/settings/model.rb +330 -0
- data/lib/mxrb/settings/mpr_codec.rb +157 -0
- data/lib/mxrb/settings/source_emitter.rb +105 -0
- data/lib/mxrb/settings/value_contracts.rb +141 -0
- data/lib/mxrb/stored_fields.rb +86 -0
- data/lib/mxrb/studio/artifacts.rb +67 -0
- data/lib/mxrb/studio/backend.rb +36 -0
- data/lib/mxrb/studio/catalog.rb +249 -0
- data/lib/mxrb/studio/data_connections.rb +77 -0
- data/lib/mxrb/studio/data_explorer.rb +288 -0
- data/lib/mxrb/studio/documents.rb +260 -0
- data/lib/mxrb/studio/files.rb +321 -0
- data/lib/mxrb/studio/history.rb +181 -0
- data/lib/mxrb/studio/isolated.rb +123 -0
- data/lib/mxrb/studio/model_operations.rb +304 -0
- data/lib/mxrb/studio/parity.json +1019 -0
- data/lib/mxrb/studio/parity.rb +75 -0
- data/lib/mxrb/studio/preview_comparison.rb +106 -0
- data/lib/mxrb/studio/preview_sandbox.rb +142 -0
- data/lib/mxrb/studio/preview_sources.rb +80 -0
- data/lib/mxrb/studio/preview_worker.rb +23 -0
- data/lib/mxrb/studio/protocol.rb +116 -0
- data/lib/mxrb/studio/request_context.rb +141 -0
- data/lib/mxrb/studio/ruby_document.rb +252 -0
- data/lib/mxrb/studio/ruby_document_aggregates.rb +167 -0
- data/lib/mxrb/studio/ruby_project.rb +214 -0
- data/lib/mxrb/studio/server.rb +145 -0
- data/lib/mxrb/studio/service.rb +525 -0
- data/lib/mxrb/studio/snapshot.rb +163 -0
- data/lib/mxrb/studio/structure.rb +381 -0
- data/lib/mxrb/studio/sync.rb +1070 -0
- data/lib/mxrb/studio/sync_preview.rb +108 -0
- data/lib/mxrb/studio/task_configurations.rb +118 -0
- data/lib/mxrb/studio/text_merge.rb +185 -0
- data/lib/mxrb/studio/write_lock.rb +87 -0
- data/lib/mxrb/studio.rb +4 -0
- data/lib/mxrb/studio_compatibility/loss_audit.rb +136 -0
- data/lib/mxrb/studio_compatibility.rb +401 -0
- data/lib/mxrb/studio_schema_catalog.rb +375 -0
- data/lib/mxrb/system_texts.rb +322 -0
- data/lib/mxrb/version.rb +1 -1
- data/lib/mxrb/web_ui/assets/chunk-2GNONHZU.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-2P46CC5S.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-2SHOE7BM.js +200 -0
- data/lib/mxrb/web_ui/assets/chunk-32QEQT5X.js +1 -0
- data/lib/mxrb/web_ui/assets/{chunk-5VM5RSS4-ZNzvKenW.js → chunk-34FZNJLO.js} +2 -2
- data/lib/mxrb/web_ui/assets/chunk-35N2E2ST.js +88 -0
- data/lib/mxrb/web_ui/assets/chunk-3EBRCLBH.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-3F3S4FN6.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-3PZDNKEG.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-3UGOMMAO.js +3 -0
- data/lib/mxrb/web_ui/assets/chunk-4NYRXXLN.js +106 -0
- data/lib/mxrb/web_ui/assets/chunk-4R2TVXEB.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-4SGPCOHB.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-5BHXSKDK.js +292 -0
- data/lib/mxrb/web_ui/assets/chunk-5EVG4O6T.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-5G5NQYC6.js +34 -0
- data/lib/mxrb/web_ui/assets/chunk-5HFJOAW4.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-5TNNO4YZ.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-63IIJIEV.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-66OX7QNZ.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-6B4DUFPC.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-6HSV3Q4G.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-6KV64GIT.js +98 -0
- data/lib/mxrb/web_ui/assets/chunk-6ZPGWQKV.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-72H3YDZV.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-77A6STIF.js +66 -0
- data/lib/mxrb/web_ui/assets/chunk-7B4ZTT6G.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-7E4ON25K.js +7 -0
- data/lib/mxrb/web_ui/assets/chunk-7GXBVQXL.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-7ONEZDBB.js +291 -0
- data/lib/mxrb/web_ui/assets/chunk-7UWVQTN5.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-AFDXKSZJ.js +2 -0
- data/lib/mxrb/web_ui/assets/chunk-BUBLNEPX.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-CBAMBU3T.js +30 -0
- data/lib/mxrb/web_ui/assets/chunk-CYCQ4VLZ.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-CYUZI6LQ.js +213 -0
- data/lib/mxrb/web_ui/assets/chunk-D246GO7Q.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-DHQUYWHD.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-E2RCGYXT.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-E5A22KZX.js +70 -0
- data/lib/mxrb/web_ui/assets/chunk-E64VJRVG.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-EBM2OVIK.js +120 -0
- data/lib/mxrb/web_ui/assets/chunk-ELCFKSFF.js +41 -0
- data/lib/mxrb/web_ui/assets/chunk-EQTVJ2VI.js +36 -0
- data/lib/mxrb/web_ui/assets/chunk-FAGUL7T6.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-FHZHQJRK.js +38 -0
- data/lib/mxrb/web_ui/assets/chunk-FUKAUTTF.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-GMUATS3X.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-GVPVJSW7.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-H3FJWUNC.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-H4QZ3SLG.js +257 -0
- data/lib/mxrb/web_ui/assets/chunk-H57W7YI5.js +62 -0
- data/lib/mxrb/web_ui/assets/chunk-H6EH3XA3.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-HB5VHJFM.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-HCKYS7KE.js +139 -0
- data/lib/mxrb/web_ui/assets/chunk-HQBVNVYC.js +39 -0
- data/lib/mxrb/web_ui/assets/chunk-HSA6P35M.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-HUYRUGAK.js +135 -0
- data/lib/mxrb/web_ui/assets/chunk-I5PKQWBH.js +140 -0
- data/lib/mxrb/web_ui/assets/chunk-ID2OERHW.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-IDAIL53S.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-IWZI7GPK.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-IXXNJOS3.js +24 -0
- data/lib/mxrb/web_ui/assets/chunk-K5MIAU7K.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-K6CUQC6N.js +136 -0
- data/lib/mxrb/web_ui/assets/chunk-KE3NT6QN.js +0 -0
- data/lib/mxrb/web_ui/assets/chunk-KI74YC4J.js +72 -0
- data/lib/mxrb/web_ui/assets/chunk-KOJL4E5L.js +370 -0
- data/lib/mxrb/web_ui/assets/chunk-KPUKEWCZ.js +169 -0
- data/lib/mxrb/web_ui/assets/chunk-LEZ2D244.js +2 -0
- data/lib/mxrb/web_ui/assets/chunk-LJWZZILO.js +8 -0
- data/lib/mxrb/web_ui/assets/chunk-LOYCYQTD.js +24 -0
- data/lib/mxrb/web_ui/assets/chunk-M2T56PG5.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-NI5QL3P3.js +2 -0
- data/lib/mxrb/web_ui/assets/chunk-NM5LBQV6.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-NNFAPT7B.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-NTAWMNDE.js +7 -0
- data/lib/mxrb/web_ui/assets/chunk-NUGW2EXC.js +27 -0
- data/lib/mxrb/web_ui/assets/chunk-OKEQR3I2.js +99 -0
- data/lib/mxrb/web_ui/assets/chunk-OUPEVUDM.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-OZ3S3DQH.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-PBU4ZVTM.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-PQQBOQJI.js +217 -0
- data/lib/mxrb/web_ui/assets/chunk-Q63GKT34.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-QJHVSIW7.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-QMUNJBVF.js +2 -0
- data/lib/mxrb/web_ui/assets/chunk-RKTVQ6NQ.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-RQ6DNNSS.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-RVFML3W7.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-S5TKGUWG.js +3 -0
- data/lib/mxrb/web_ui/assets/chunk-SBICTFKY.js +2 -0
- data/lib/mxrb/web_ui/assets/chunk-SOO7HOBB.js +89 -0
- data/lib/mxrb/web_ui/assets/chunk-SQ2BDVUY.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-T5KDILTJ.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-TJ2A3WRV.js +14 -0
- data/lib/mxrb/web_ui/assets/chunk-UITAI6UC.js +78 -0
- data/lib/mxrb/web_ui/assets/chunk-UL26XZ4V.js +10 -0
- data/lib/mxrb/web_ui/assets/chunk-URTGGQPX.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-UZTYCEEY.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-VFXGN725.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-VJRJYCFG.js +84 -0
- data/lib/mxrb/web_ui/assets/chunk-W6DARM7I.js +1 -0
- data/lib/mxrb/web_ui/assets/chunk-WLRR7NCQ.js +40 -0
- data/lib/mxrb/web_ui/assets/chunk-XIMEPMUW.js +32 -0
- data/lib/mxrb/web_ui/assets/chunk-XRM2LTMZ.js +4 -0
- data/lib/mxrb/web_ui/assets/chunk-Y5TK5PAP.js +62 -0
- data/lib/mxrb/web_ui/assets/chunk-ZH3OWPCF.js +339 -0
- data/lib/mxrb/web_ui/assets/chunk-ZIHGYIEK.js +1 -0
- data/lib/mxrb/web_ui/assets/domain-STH3BZOK.js +1 -0
- data/lib/mxrb/web_ui/assets/domain-VYBHNQGI.css +1 -0
- data/lib/mxrb/web_ui/assets/modeler-S2X4PVYN.js +1 -0
- data/lib/mxrb/web_ui/assets/modeler-SWHOK6BD.css +1 -0
- data/lib/mxrb/web_ui/assets/studio/studio-3F773TXK.css +1 -0
- data/lib/mxrb/web_ui/assets/studio/studio-DSAUONWT.js +68 -0
- data/lib/mxrb/web_ui/assets/uml-6G73GOJ4.css +1 -0
- data/lib/mxrb/web_ui/assets/uml-ENRAUICA.js +18 -0
- data/lib/mxrb/web_ui/domain.html +1 -3
- data/lib/mxrb/web_ui/modeler.html +1 -4
- data/lib/mxrb/web_ui/studio.html +5 -0
- data/lib/mxrb/web_ui/uml.html +1 -19
- data/lib/mxrb/widget_certification.rb +1 -8
- data/lib/mxrb/widget_development.rb +57 -0
- data/lib/mxrb/widget_package.rb +18 -12
- data/lib/mxrb/writer/data_sources.rb +149 -0
- data/lib/mxrb/writer/page_overlay.rb +542 -0
- data/lib/mxrb/writer.rb +6143 -1598
- data/lib/mxrb.rb +198 -158
- data/marketplace/modules/shared-kernel/module.rb +1 -1
- metadata +729 -108
- data/lib/mxrb/web_ui/assets/abnfDiagram-N423BO3Z-C4JD3cEC.js +0 -1
- data/lib/mxrb/web_ui/assets/arc-3Z53kgFp.js +0 -1
- data/lib/mxrb/web_ui/assets/architecture-TIHT7OUA-BStBTLea.js +0 -1
- data/lib/mxrb/web_ui/assets/architectureDiagram-T3A2C74G-DBwqnM4J.js +0 -36
- data/lib/mxrb/web_ui/assets/array-BifhSqXX.js +0 -1
- data/lib/mxrb/web_ui/assets/blockDiagram-VBNYF7ZC-DLtuHt-j.js +0 -132
- data/lib/mxrb/web_ui/assets/c4Diagram-5PPSVZJV-ConSk_pe.js +0 -10
- data/lib/mxrb/web_ui/assets/channel-BhPvD7Dt.js +0 -1
- data/lib/mxrb/web_ui/assets/chunk-2GRJ4B5K-D2HpWsf_.js +0 -1
- data/lib/mxrb/web_ui/assets/chunk-2Q5K7J3B-C1jixKkw.js +0 -1
- data/lib/mxrb/web_ui/assets/chunk-4I5QYGJK-CiIdNwaF.js +0 -1
- data/lib/mxrb/web_ui/assets/chunk-5RXB4S5H-Bu_AaEkE.js +0 -231
- data/lib/mxrb/web_ui/assets/chunk-6Q2QTUOP-wQkNmt_X.js +0 -88
- data/lib/mxrb/web_ui/assets/chunk-7BUUIJ7U-Bb538aSH.js +0 -1
- data/lib/mxrb/web_ui/assets/chunk-GF5L2VYU-G8MmiBzU.js +0 -206
- data/lib/mxrb/web_ui/assets/chunk-I66GZJ75-CulcrLPh.js +0 -127
- data/lib/mxrb/web_ui/assets/chunk-JQJVKLGR-ukjzcdlL.js +0 -156
- data/lib/mxrb/web_ui/assets/chunk-JWPE2WC7-DVXcaiue.js +0 -1
- data/lib/mxrb/web_ui/assets/chunk-KBJHAD2P-Wm35lYov.js +0 -1
- data/lib/mxrb/web_ui/assets/chunk-KEIR6QF5-BICK3FdT.js +0 -161
- data/lib/mxrb/web_ui/assets/chunk-NSK5VX7P-D2nYrCY4.js +0 -2
- data/lib/mxrb/web_ui/assets/chunk-QR6OTTB3-BrdIzg4Q.js +0 -62
- data/lib/mxrb/web_ui/assets/chunk-RYQCIY6F-CCfZMcW6.js +0 -1
- data/lib/mxrb/web_ui/assets/chunk-UBXNYLIW-BPEVYsFK.js +0 -1
- data/lib/mxrb/web_ui/assets/chunk-W5SLKNZC-2E6OPhA4.js +0 -1
- data/lib/mxrb/web_ui/assets/chunk-WRU74C26-CBIvOyWp.js +0 -70
- data/lib/mxrb/web_ui/assets/chunk-XXDRQBXY-pH58XAyl.js +0 -1
- data/lib/mxrb/web_ui/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +0 -1
- data/lib/mxrb/web_ui/assets/classDiagram-JCYQIIEL-xiqo4D89.js +0 -1
- data/lib/mxrb/web_ui/assets/classDiagram-v2-OCEON4UE-xiqo4D89.js +0 -1
- data/lib/mxrb/web_ui/assets/cose-bilkent-JH36ORCC-t_flPpii.js +0 -1
- data/lib/mxrb/web_ui/assets/cynefin-VYW2F7L2-BIqktTEv.js +0 -1
- data/lib/mxrb/web_ui/assets/cynefinDiagram-MW4NZA55-C2d--lut.js +0 -62
- data/lib/mxrb/web_ui/assets/cytoscape.esm-B-NFISlW.js +0 -321
- data/lib/mxrb/web_ui/assets/dagre-Buvkdvvj.js +0 -1
- data/lib/mxrb/web_ui/assets/dagre-VZM6K2ZE-CSz2_tb5.js +0 -4
- data/lib/mxrb/web_ui/assets/defaultLocale-BFoDCU3G.js +0 -1
- data/lib/mxrb/web_ui/assets/diagram-7IWD3JNH-DCt7u7V_.js +0 -30
- data/lib/mxrb/web_ui/assets/diagram-B4RE2ZJO-DqZBqkMu.js +0 -3
- data/lib/mxrb/web_ui/assets/diagram-LBJQPF4R-ClIYbIsI.js +0 -24
- data/lib/mxrb/web_ui/assets/diagram-Q27KOJAE-DFxhvthJ.js +0 -24
- data/lib/mxrb/web_ui/assets/diagram-UB23O5K3-BSUTXptv.js +0 -41
- data/lib/mxrb/web_ui/assets/dist-D2qOEbeJ.js +0 -1
- data/lib/mxrb/web_ui/assets/domain-mGOZ1KCG.css +0 -1
- data/lib/mxrb/web_ui/assets/domain-qsjXhy4v.js +0 -1
- data/lib/mxrb/web_ui/assets/ebnfDiagram-BXEA7PRR-B5reICEi.js +0 -1
- data/lib/mxrb/web_ui/assets/erDiagram-JOGREHBK-Co5Mxn2p.js +0 -85
- data/lib/mxrb/web_ui/assets/eventmodeling-45OFAUF4-C1ylhSks.js +0 -1
- data/lib/mxrb/web_ui/assets/flowDiagram-UKHOOZJN-CHXaJIaS.js +0 -1
- data/lib/mxrb/web_ui/assets/ganttDiagram-PKOTCBZU-DPPPaWaz.js +0 -292
- data/lib/mxrb/web_ui/assets/gitGraph-TEB2WS4Q-qS77ywA9.js +0 -1
- data/lib/mxrb/web_ui/assets/gitGraphDiagram-DS77QQ5N-DpAv6-BT.js +0 -106
- data/lib/mxrb/web_ui/assets/graphlib-DS17s2tU.js +0 -1
- data/lib/mxrb/web_ui/assets/info-DKCQHKI2-C9VD1Y4e.js +0 -1
- data/lib/mxrb/web_ui/assets/infoDiagram-6WML65LV-Bk1kbcCy.js +0 -2
- data/lib/mxrb/web_ui/assets/init-C-OQMol4.js +0 -1
- data/lib/mxrb/web_ui/assets/ishikawaDiagram-WSZJBQD7-0gcISBFR.js +0 -70
- data/lib/mxrb/web_ui/assets/journeyDiagram-NVQOT4AX-Dt0RQnlh.js +0 -139
- data/lib/mxrb/web_ui/assets/jsx-runtime-DV0a5kSb.js +0 -9
- data/lib/mxrb/web_ui/assets/kanban-definition-27J2QSJJ-DIPQM7w9.js +0 -89
- data/lib/mxrb/web_ui/assets/katex-CXMH3UgJ.js +0 -257
- data/lib/mxrb/web_ui/assets/line-C0rYD-tL.js +0 -1
- data/lib/mxrb/web_ui/assets/linear-BPPxWorj.js +0 -1
- data/lib/mxrb/web_ui/assets/map-BaFkSB1l.js +0 -1
- data/lib/mxrb/web_ui/assets/mermaid-parser.core-B_UPzTxa.js +0 -7
- data/lib/mxrb/web_ui/assets/mindmap-definition-FAOFIHXS-CdJRSMuk.js +0 -96
- data/lib/mxrb/web_ui/assets/modeler-BNqHthwk.css +0 -1
- data/lib/mxrb/web_ui/assets/modeler-CQmqflbg.js +0 -1
- data/lib/mxrb/web_ui/assets/ordinal-BDEzSJ7C.js +0 -1
- data/lib/mxrb/web_ui/assets/packet-7NZHBO7P-CwQ4NSBs.js +0 -1
- data/lib/mxrb/web_ui/assets/path-fybaL0A-.js +0 -1
- data/lib/mxrb/web_ui/assets/pegDiagram-VL7TDLO6-D40S7ppx.js +0 -1
- data/lib/mxrb/web_ui/assets/pie-RZYD4A2V-CJroHMKh.js +0 -1
- data/lib/mxrb/web_ui/assets/pieDiagram-7S7Q4E2Y-QB54__BV.js +0 -39
- data/lib/mxrb/web_ui/assets/quadrantDiagram-CIZ2JOQS-DBhDS6ag.js +0 -7
- data/lib/mxrb/web_ui/assets/radar-I7S5WNFK-DdIUwd2d.js +0 -1
- data/lib/mxrb/web_ui/assets/railroad-3IZDKUUU-B1Lw6Xyq.js +0 -1
- data/lib/mxrb/web_ui/assets/railroad-abnf-AHOZXSZD-CQgQoeak.js +0 -1
- data/lib/mxrb/web_ui/assets/railroad-ebnf-EBAXGLYW-D7qEQ2x8.js +0 -1
- data/lib/mxrb/web_ui/assets/railroad-peg-LSFZ7HO6-C005Vxbb.js +0 -1
- data/lib/mxrb/web_ui/assets/railroadDiagram-AXF67PYL-BBP2qk7M.js +0 -1
- data/lib/mxrb/web_ui/assets/requirementDiagram-LRYGKXZP-D2cLsAoI.js +0 -84
- data/lib/mxrb/web_ui/assets/rough.esm-Dy-Kn_BL.js +0 -1
- data/lib/mxrb/web_ui/assets/sankeyDiagram-W5VNT64P-Bpi3FiP2.js +0 -40
- data/lib/mxrb/web_ui/assets/sequenceDiagram-SI44F4Z6-DCRcDlVe.js +0 -162
- data/lib/mxrb/web_ui/assets/sizeCapture-X5ZJPWSS-B0uUizjq.js +0 -1
- data/lib/mxrb/web_ui/assets/src-CvxfUak2.js +0 -1
- data/lib/mxrb/web_ui/assets/stateDiagram-OKZ733FA-C2GCEoxl.js +0 -1
- data/lib/mxrb/web_ui/assets/stateDiagram-v2-UEYNNEHI-D2gWgedh.js +0 -1
- data/lib/mxrb/web_ui/assets/swimlanes-SLNWSIFB-CRI9irEW.js +0 -2
- data/lib/mxrb/web_ui/assets/swimlanesDiagram-ULZ7WXOC-C5Wb_-hZ.js +0 -8
- data/lib/mxrb/web_ui/assets/theme-_mxc7BdY.css +0 -1
- data/lib/mxrb/web_ui/assets/timeline-definition-Z64GVDOM-B1-mNg-h.js +0 -120
- data/lib/mxrb/web_ui/assets/treeView-QDETBFTQ-7CTvIwKq.js +0 -1
- data/lib/mxrb/web_ui/assets/treemap-6X3UGDF4-CtL22pq5.js +0 -1
- data/lib/mxrb/web_ui/assets/uml-C3KAFGTq.js +0 -51
- data/lib/mxrb/web_ui/assets/uml-Dn-qd01X.css +0 -1
- data/lib/mxrb/web_ui/assets/vennDiagram-T6HMQDX7-BzVnUEAy.js +0 -34
- data/lib/mxrb/web_ui/assets/wardley-OPB4EBWU-JNi-QNag.js +0 -1
- data/lib/mxrb/web_ui/assets/wardleyDiagram-T6FBY63Y-BUwmAQ-B.js +0 -78
- data/lib/mxrb/web_ui/assets/xychartDiagram-ELKLHX3M-DEQS8sKp.js +0 -7
data/lib/mxrb/exporter.rb
CHANGED
|
@@ -1,63 +1,75 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
5
|
-
require
|
|
6
|
-
require
|
|
3
|
+
require 'base64'
|
|
4
|
+
require 'fileutils'
|
|
5
|
+
require 'json'
|
|
6
|
+
require 'digest'
|
|
7
|
+
require_relative 'native_fragment_store'
|
|
8
|
+
require_relative 'forms/mpr_codec'
|
|
9
|
+
require_relative 'pluggable/schema_source_emitter'
|
|
10
|
+
require_relative 'settings/mpr_codec'
|
|
11
|
+
require_relative 'settings/source_emitter'
|
|
12
|
+
require_relative 'exporter/data_sources'
|
|
13
|
+
require_relative 'exporter/integration_declarations'
|
|
14
|
+
require_relative 'exporter/presentation_declarations'
|
|
15
|
+
require_relative 'exporter/code_action_declarations'
|
|
16
|
+
require_relative 'exporter/workflow_declarations'
|
|
17
|
+
require_relative 'exporter/domain_document_declarations'
|
|
18
|
+
require_relative 'exporter/rest_declarations'
|
|
19
|
+
require_relative 'exporter/project_sources'
|
|
20
|
+
require_relative 'exporter/model_sources'
|
|
21
|
+
require_relative 'exporter/method_flow_source'
|
|
22
|
+
require_relative 'exporter/page_sources'
|
|
23
|
+
require_relative 'exporter/flow_linearization'
|
|
24
|
+
require_relative 'exporter/flow_action_sources'
|
|
7
25
|
|
|
8
26
|
module Mxrb
|
|
9
27
|
# Exports an MPR into an editable, layered Ruby source tree.
|
|
10
28
|
class Exporter
|
|
29
|
+
include DataSources
|
|
30
|
+
include IntegrationDeclarations
|
|
31
|
+
include PresentationDeclarations
|
|
32
|
+
include CodeActionDeclarations
|
|
33
|
+
include WorkflowDeclarations
|
|
34
|
+
include DomainDocumentDeclarations
|
|
35
|
+
include RestDeclarations
|
|
36
|
+
include ProjectSources
|
|
37
|
+
include ModelSources
|
|
38
|
+
include PageSources
|
|
39
|
+
include FlowLinearization
|
|
40
|
+
include FlowActionSources
|
|
41
|
+
|
|
11
42
|
MODES = %i[mendix ruby].freeze
|
|
12
43
|
LAYERS = %w[domain application presentation infrastructure].freeze
|
|
13
44
|
MODULE_PROGRESS_WEIGHT = 10
|
|
14
45
|
MARKETPLACE_PROVENANCE = [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
46
|
+
'.mxrb/marketplace.lock.json',
|
|
47
|
+
'.mxrb/marketplace',
|
|
48
|
+
'.mxrb/marketplace-originals'
|
|
18
49
|
].freeze
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Microflows$ExclusiveMerge
|
|
26
|
-
Microflows$LoopedActivity
|
|
27
|
-
Microflows$ErrorEvent
|
|
28
|
-
Microflows$ContinueEvent
|
|
29
|
-
Microflows$Annotation
|
|
30
|
-
Microflows$MicroflowParameter
|
|
50
|
+
# Studio Pro project files outside the design system: native app assets
|
|
51
|
+
# (icons, splash screens, push configuration) and the data snapshot that
|
|
52
|
+
# MxBuild packages as sample data.
|
|
53
|
+
PROJECT_FILES = %w[nativemobile data-snapshot.zip].freeze
|
|
54
|
+
GLOBAL_EDITABLE_DOCUMENT_TYPES = %w[
|
|
55
|
+
Settings$ProjectSettings Texts$SystemTextCollection
|
|
31
56
|
].freeze
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Microflows$CreateChangeAction
|
|
35
|
-
Microflows$ChangeObjectAction
|
|
36
|
-
Microflows$ChangeAction
|
|
37
|
-
Microflows$RetrieveAction
|
|
38
|
-
Microflows$CommitObjectsAction
|
|
39
|
-
Microflows$CommitAction
|
|
40
|
-
Microflows$DeleteAction
|
|
41
|
-
Microflows$MicroflowCallAction
|
|
42
|
-
Microflows$CreateVariableAction
|
|
43
|
-
Microflows$ChangeVariableAction
|
|
44
|
-
Microflows$ShowMessageAction
|
|
45
|
-
Microflows$LogMessageAction
|
|
46
|
-
Microflows$ShowFormAction
|
|
47
|
-
Microflows$CloseFormAction
|
|
48
|
-
Microflows$JavaActionCallAction
|
|
49
|
-
Microflows$JavaScriptActionCallAction
|
|
50
|
-
Microflows$NanoflowCallAction
|
|
51
|
-
Microflows$AppServiceCallAction
|
|
52
|
-
Microflows$AggregateAction
|
|
53
|
-
Microflows$RollbackAction
|
|
54
|
-
Microflows$CastAction
|
|
55
|
-
Microflows$CreateListAction
|
|
56
|
-
Microflows$ListOperationsAction
|
|
57
|
-
Microflows$ChangeListAction
|
|
58
|
-
Microflows$ValidationFeedbackAction
|
|
59
|
-
Microflows$RestCallAction
|
|
57
|
+
TYPED_FORMS_DOCUMENT_TYPES = %w[
|
|
58
|
+
Forms$Layout Forms$PageTemplate Forms$BuildingBlock Forms$Snippet
|
|
60
59
|
].freeze
|
|
60
|
+
RUBY_PROJECTED_DOCUMENT_TYPES = (
|
|
61
|
+
Model::Module::EDITABLE_DOCUMENT_TYPES + GLOBAL_EDITABLE_DOCUMENT_TYPES + %w[
|
|
62
|
+
DomainModels$DomainModel Forms$Page Menus$MenuDocument
|
|
63
|
+
Microflows$Microflow Microflows$Nanoflow Navigation$NavigationDocument
|
|
64
|
+
Projects$Folder Projects$ModuleGuidMapping Projects$ModuleImpl
|
|
65
|
+
Projects$ModuleSettings Projects$Project Projects$ProjectConversion
|
|
66
|
+
Security$ModuleSecurity Security$ProjectSecurity
|
|
67
|
+
]
|
|
68
|
+
).freeze
|
|
69
|
+
|
|
70
|
+
def self.ruby_projected_document_type?(type)
|
|
71
|
+
RUBY_PROJECTED_DOCUMENT_TYPES.include?(type.to_s)
|
|
72
|
+
end
|
|
61
73
|
|
|
62
74
|
attr_reader :mode
|
|
63
75
|
|
|
@@ -65,7 +77,7 @@ module Mxrb
|
|
|
65
77
|
@mpr_path = File.expand_path(mpr_path)
|
|
66
78
|
@output_dir = File.expand_path(output_dir)
|
|
67
79
|
@mode = mode.to_sym
|
|
68
|
-
raise ArgumentError,
|
|
80
|
+
raise ArgumentError, 'export mode must be mendix or ruby' unless MODES.include?(@mode)
|
|
69
81
|
end
|
|
70
82
|
|
|
71
83
|
def export!(parallel: true)
|
|
@@ -73,29 +85,37 @@ module Mxrb
|
|
|
73
85
|
|
|
74
86
|
Progress.with("Exporting #{File.basename(@mpr_path)}") do |progress|
|
|
75
87
|
FileUtils.mkdir_p(@output_dir)
|
|
88
|
+
@native_fragment_store = NativeFragmentStore.new(
|
|
89
|
+
File.join(@output_dir, '.mxrb', 'native_fragments')
|
|
90
|
+
)
|
|
76
91
|
Mxrb.open(@mpr_path) do |project|
|
|
77
92
|
@architecture = project.architecture_definition
|
|
78
93
|
units = project.all_units
|
|
79
94
|
modules = project.modules
|
|
95
|
+
prepare_typed_forms(project, units, modules)
|
|
80
96
|
@inferred_public_artifacts = infer_public_artifacts(modules)
|
|
81
97
|
assets = project_asset_files
|
|
82
98
|
progress.update(
|
|
83
99
|
current: 0,
|
|
84
100
|
total: 4 + assets.size + (units.size * 2) + (modules.size * MODULE_PROGRESS_WEIGHT),
|
|
85
|
-
detail:
|
|
101
|
+
detail: 'preparing Ruby project'
|
|
86
102
|
)
|
|
87
103
|
export_app_structure
|
|
88
|
-
|
|
104
|
+
export_pluggable_schemas
|
|
105
|
+
progress.advance(detail: 'project structure')
|
|
89
106
|
export_project_assets(assets, progress)
|
|
90
107
|
export_native_units(project, units, progress)
|
|
108
|
+
export_global_documents(project)
|
|
91
109
|
ruby_sources = export_ruby_app_sources(project)
|
|
92
110
|
export_security(project)
|
|
93
|
-
progress.advance(detail:
|
|
111
|
+
progress.advance(detail: 'project security')
|
|
94
112
|
export_architecture_contracts(project)
|
|
95
|
-
progress.advance(detail:
|
|
113
|
+
progress.advance(detail: 'navigation and design system')
|
|
114
|
+
export_semantic_metadata(modules)
|
|
115
|
+
export_rest_metadata(modules)
|
|
96
116
|
export_modules(modules, progress, parallel:)
|
|
97
117
|
write_project(project, ruby_sources:)
|
|
98
|
-
progress.advance(detail:
|
|
118
|
+
progress.advance(detail: 'project.rb')
|
|
99
119
|
end
|
|
100
120
|
end
|
|
101
121
|
@output_dir
|
|
@@ -104,42 +124,108 @@ module Mxrb
|
|
|
104
124
|
private
|
|
105
125
|
|
|
106
126
|
def export_ruby!(parallel:)
|
|
107
|
-
sidecar = File.join(@output_dir,
|
|
127
|
+
sidecar = File.join(@output_dir, '.mxrb', 'mendix')
|
|
108
128
|
self.class.new(@mpr_path, sidecar, mode: :mendix).export!(parallel:)
|
|
109
129
|
RubyApp::Exporter.new(@mpr_path, @output_dir, mendix_sidecar: sidecar).export!
|
|
110
130
|
end
|
|
111
131
|
|
|
112
132
|
def export_module(mod)
|
|
113
|
-
root = File.join(@output_dir,
|
|
133
|
+
root = File.join(@output_dir, 'modules', mod.name)
|
|
114
134
|
LAYERS.each { FileUtils.mkdir_p(File.join(root, _1)) }
|
|
115
135
|
|
|
116
136
|
export_domain(root, mod)
|
|
117
137
|
export_microflows(root, mod)
|
|
118
138
|
export_application_documents(root, mod)
|
|
119
139
|
export_infrastructure_documents(root, mod)
|
|
140
|
+
export_presentation_documents(root, mod)
|
|
141
|
+
export_asset_documents(root, mod)
|
|
120
142
|
export_pages(root, mod)
|
|
121
143
|
export_menus(root, mod)
|
|
122
144
|
export_nanoflows(root, mod)
|
|
123
145
|
export_module_scaffolding(root)
|
|
124
146
|
export_module_security(root, mod)
|
|
125
|
-
write(File.join(root,
|
|
147
|
+
write(File.join(root, 'module.rb'), module_source(mod))
|
|
126
148
|
end
|
|
127
149
|
|
|
128
150
|
def export_app_structure
|
|
129
151
|
%w[
|
|
130
|
-
app/security app/navigation app/design_system
|
|
152
|
+
app/security app/navigation app/navigation/responsive app/design_system
|
|
153
|
+
app/settings app/texts
|
|
131
154
|
theme resources themesource widgets javasource javascriptsource
|
|
132
|
-
].each { write(File.join(@output_dir, _1,
|
|
155
|
+
].each { write(File.join(@output_dir, _1, '.keep'), '') }
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def prepare_typed_forms(project, units, modules)
|
|
159
|
+
@pluggable_catalog = Pluggable::Catalog.new
|
|
160
|
+
@forms_codec = Forms::MprCodec.new(pluggable_catalog: @pluggable_catalog)
|
|
161
|
+
@typed_forms_documents = {}
|
|
162
|
+
@typed_pages = {}
|
|
163
|
+
return unless project.mendix_version.to_s.split('.').first.to_i == 11
|
|
164
|
+
|
|
165
|
+
units.each do |unit|
|
|
166
|
+
register_embedded_widget_types(project.parse_bson(unit))
|
|
167
|
+
end
|
|
168
|
+
@typed_forms_documents = units.each_with_object({}) do |unit, typed|
|
|
169
|
+
document = project.parse_bson(unit)
|
|
170
|
+
next unless TYPED_FORMS_DOCUMENT_TYPES.include?(document['$Type'])
|
|
171
|
+
|
|
172
|
+
typed[unit.fetch('UnitID')] = @forms_codec.decode(document)
|
|
173
|
+
rescue Forms::MprCodecError, Pluggable::CodecError, KeyError, TypeError => e
|
|
174
|
+
name = document&.fetch('Name', unit['UnitID'])
|
|
175
|
+
raise SerializationError, "typed Forms export failed for #{name}: #{e.message}"
|
|
176
|
+
end
|
|
177
|
+
@typed_pages = modules.flat_map(&:pages).each_with_object({}) do |page, typed|
|
|
178
|
+
# Transitional documents may store both representations. The typed
|
|
179
|
+
# Forms model has only one binding/label, so use the preserving overlay.
|
|
180
|
+
next if semantic_page_baseline?(page.widgets) && redundant_forms_aliases?(page.raw_document)
|
|
181
|
+
|
|
182
|
+
typed[page.id] = @forms_codec.decode(page.raw_document)
|
|
183
|
+
rescue Forms::MprCodecError, Pluggable::CodecError, KeyError, TypeError => e
|
|
184
|
+
# Older MXRB releases generated transitional widgets with concise,
|
|
185
|
+
# semantic fields outside their embedded schema. Their existing page
|
|
186
|
+
# projection is typed and can canonicalize them without a raw fragment.
|
|
187
|
+
next if semantic_page_baseline?(page.widgets)
|
|
188
|
+
|
|
189
|
+
raise SerializationError, "typed Forms export failed for page #{page.name}: #{e.message}"
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
def redundant_forms_aliases?(value)
|
|
194
|
+
case value
|
|
195
|
+
when Hash
|
|
196
|
+
(value.key?('AttributePath') && value.key?('AttributeRef')) ||
|
|
197
|
+
(value.key?('LabelText') && value.key?('LabelTemplate')) || value.values.any? { redundant_forms_aliases?(_1) }
|
|
198
|
+
when Array then value.any? { redundant_forms_aliases?(_1) }
|
|
199
|
+
else false
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def register_embedded_widget_types(value)
|
|
204
|
+
case value
|
|
205
|
+
when Hash
|
|
206
|
+
if value['$Type'] == 'CustomWidgets$CustomWidget'
|
|
207
|
+
type = value['Type']
|
|
208
|
+
@forms_codec.register_pluggable_type(type) if type.is_a?(Hash)
|
|
209
|
+
end
|
|
210
|
+
value.each_value { register_embedded_widget_types(_1) }
|
|
211
|
+
when Array
|
|
212
|
+
value.each { register_embedded_widget_types(_1) unless _1.is_a?(Integer) }
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def export_pluggable_schemas
|
|
217
|
+
source = Pluggable::SchemaSourceEmitter.new.emit(@pluggable_catalog.schema_definitions)
|
|
218
|
+
write(File.join(@output_dir, '.mxrb', 'widget_types.rb'), source)
|
|
133
219
|
end
|
|
134
220
|
|
|
135
221
|
def project_asset_files
|
|
136
222
|
source_root = File.dirname(@mpr_path)
|
|
137
|
-
(Model::DesignSystem::ASSET_DIRECTORIES + MARKETPLACE_PROVENANCE).flat_map do |directory|
|
|
223
|
+
(Model::DesignSystem::ASSET_DIRECTORIES + PROJECT_FILES + MARKETPLACE_PROVENANCE).flat_map do |directory|
|
|
138
224
|
root = File.join(source_root, directory)
|
|
139
225
|
next [root] if File.file?(root) && !File.symlink?(root)
|
|
140
226
|
next [] unless File.directory?(root) && !File.symlink?(root)
|
|
141
227
|
|
|
142
|
-
Dir.glob(File.join(root,
|
|
228
|
+
Dir.glob(File.join(root, '**', '*'), File::FNM_DOTMATCH)
|
|
143
229
|
end.select { File.file?(_1) && !File.symlink?(_1) }.sort
|
|
144
230
|
end
|
|
145
231
|
|
|
@@ -151,56 +237,207 @@ module Mxrb
|
|
|
151
237
|
FileUtils.mkdir_p(File.dirname(target))
|
|
152
238
|
FileUtils.cp(source, target)
|
|
153
239
|
result = {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
240
|
+
'path' => relative,
|
|
241
|
+
'size' => File.size(source),
|
|
242
|
+
'sha256' => Digest::SHA256.file(source).hexdigest
|
|
157
243
|
}
|
|
158
244
|
progress.advance(detail: "asset #{relative}")
|
|
159
245
|
result
|
|
160
246
|
end
|
|
161
247
|
write(
|
|
162
|
-
File.join(@output_dir,
|
|
163
|
-
JSON.pretty_generate(
|
|
248
|
+
File.join(@output_dir, '.mxrb', 'assets.json'),
|
|
249
|
+
JSON.pretty_generate('version' => 1, 'files' => entries)
|
|
164
250
|
)
|
|
165
251
|
end
|
|
166
252
|
|
|
167
253
|
def export_native_units(project, project_units, progress)
|
|
168
254
|
units = project_units.filter_map do |unit|
|
|
169
255
|
doc = project.parse_bson(unit)
|
|
170
|
-
type = doc[
|
|
171
|
-
next if type.to_s.empty? || type ==
|
|
256
|
+
type = doc['$Type']
|
|
257
|
+
next if type.to_s.empty? || type == 'Projects$Project'
|
|
172
258
|
|
|
173
259
|
{
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
260
|
+
'unit_id' => unit['UnitID'],
|
|
261
|
+
'container_id' => unit['ContainerID'],
|
|
262
|
+
'module' => module_name_for(project, unit),
|
|
263
|
+
'containment' => unit['ContainmentName'],
|
|
264
|
+
'name' => doc['Name'] || doc['name'] || '',
|
|
265
|
+
'type' => type,
|
|
266
|
+
'contents' => Base64.strict_encode64(IO::BsonCodec.serialize(doc))
|
|
181
267
|
}
|
|
182
268
|
ensure
|
|
183
|
-
progress.advance(detail:
|
|
269
|
+
progress.advance(detail: 'native baseline')
|
|
184
270
|
end
|
|
185
271
|
write(
|
|
186
|
-
File.join(@output_dir,
|
|
187
|
-
JSON.pretty_generate(
|
|
272
|
+
File.join(@output_dir, '.mxrb', 'native_units.json'),
|
|
273
|
+
JSON.pretty_generate(
|
|
274
|
+
'format_version' => project.format_version.to_s,
|
|
275
|
+
'source_filename' => File.basename(@mpr_path),
|
|
276
|
+
'source_version' => project.mendix_version,
|
|
277
|
+
'units' => units
|
|
278
|
+
)
|
|
188
279
|
)
|
|
189
280
|
source = project_units.filter_map do |unit|
|
|
190
281
|
doc = project.parse_bson(unit)
|
|
191
|
-
next if doc[
|
|
192
|
-
next if
|
|
282
|
+
next if doc['$Type'].to_s.empty? || doc['$Type'] == 'Projects$Project'
|
|
283
|
+
next if editable_document_type?(doc['$Type'])
|
|
193
284
|
|
|
194
285
|
native_unit_source(project, unit, doc)
|
|
195
286
|
ensure
|
|
196
|
-
progress.advance(detail:
|
|
287
|
+
progress.advance(detail: 'editable native units')
|
|
197
288
|
end
|
|
198
289
|
write(
|
|
199
|
-
File.join(@output_dir,
|
|
290
|
+
File.join(@output_dir, '.mxrb', 'native_units.rb'),
|
|
200
291
|
"# frozen_string_literal: true\n\n#{source.join("\n")}"
|
|
201
292
|
)
|
|
202
293
|
end
|
|
203
294
|
|
|
295
|
+
def export_semantic_metadata(modules)
|
|
296
|
+
values = modules.to_h do |mod|
|
|
297
|
+
typed_flows = [
|
|
298
|
+
*Array(mod.rules).map { ['Microflows$Rule', _1] },
|
|
299
|
+
*Array(mod.microflows).map { ['Microflows$Microflow', _1] },
|
|
300
|
+
*Array(mod.nanoflows).map { ['Microflows$Nanoflow', _1] }
|
|
301
|
+
]
|
|
302
|
+
flow_entries = typed_flows.map do |native_type, flow|
|
|
303
|
+
parameters = Array(flow.parameters).filter_map do |parameter|
|
|
304
|
+
next unless parameter.is_a?(Hash)
|
|
305
|
+
|
|
306
|
+
type = parameter['VariableType'] || parameter['Type'] || parameter['type']
|
|
307
|
+
{
|
|
308
|
+
'name' => parameter['Name'] || parameter['name'],
|
|
309
|
+
'id' => document_id(parameter),
|
|
310
|
+
'relative_middle_point' => parameter['RelativeMiddlePoint'],
|
|
311
|
+
'size' => parameter['Size'],
|
|
312
|
+
'type_id' => type.is_a?(Hash) ? document_id(type) : nil
|
|
313
|
+
}.compact
|
|
314
|
+
end
|
|
315
|
+
objects = Array(flow.objects)
|
|
316
|
+
graph = Array(flow.flows)
|
|
317
|
+
fingerprint = if editable_flow_body?(objects, graph)
|
|
318
|
+
lines = with_flow_return_variable(flow) { body_dsl_lines(objects, graph, 2) }
|
|
319
|
+
flow_body_fingerprint(lines, flow)
|
|
320
|
+
end
|
|
321
|
+
return_type = flow.respond_to?(:return_type_document) && flow.return_type_document
|
|
322
|
+
metadata = {
|
|
323
|
+
'native_type' => native_type,
|
|
324
|
+
'unit_id' => flow.respond_to?(:id) ? flow.id.to_s : nil,
|
|
325
|
+
'parameters' => parameters,
|
|
326
|
+
'return_type_id' => return_type.is_a?(Hash) ? document_id(return_type) : nil,
|
|
327
|
+
'body_fingerprint' => fingerprint
|
|
328
|
+
}.compact
|
|
329
|
+
[flow.name.to_s, metadata]
|
|
330
|
+
end
|
|
331
|
+
flows = flow_entries.group_by(&:first).transform_values do |entries|
|
|
332
|
+
metadata = entries.map(&:last)
|
|
333
|
+
metadata.one? ? metadata.first : metadata
|
|
334
|
+
end
|
|
335
|
+
[mod.name.to_s, { 'flows' => flows }]
|
|
336
|
+
end
|
|
337
|
+
write(
|
|
338
|
+
File.join(@output_dir, '.mxrb', 'semantic_metadata.json'),
|
|
339
|
+
JSON.pretty_generate('version' => 1, 'modules' => values)
|
|
340
|
+
)
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
def editable_document_type?(type)
|
|
344
|
+
self.class.ruby_projected_document_type?(type)
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
def export_global_documents(project)
|
|
348
|
+
documents = project.all_units.filter_map do |unit|
|
|
349
|
+
document = project.parse_bson(unit)
|
|
350
|
+
[unit, document] if GLOBAL_EDITABLE_DOCUMENT_TYPES.include?(document['$Type'])
|
|
351
|
+
end
|
|
352
|
+
settings = documents.filter_map do |unit, document|
|
|
353
|
+
next unless document['$Type'] == 'Settings$ProjectSettings'
|
|
354
|
+
|
|
355
|
+
if (5..11).cover?(project.mendix_version.to_s.split('.').first.to_i)
|
|
356
|
+
typed_project_settings_declaration(document)
|
|
357
|
+
else
|
|
358
|
+
project_document_declaration(:project_settings_document, unit, document, 'Settings')
|
|
359
|
+
end
|
|
360
|
+
end
|
|
361
|
+
texts = system_text_declarations(project, documents)
|
|
362
|
+
write(File.join(@output_dir, 'app', 'settings', 'settings.rb'), ruby_file(settings))
|
|
363
|
+
write(File.join(@output_dir, 'app', 'texts', 'system_texts.rb'), ruby_file(texts))
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
def typed_project_settings_declaration(document)
|
|
367
|
+
model = Settings::MprCodec.new.decode(document)
|
|
368
|
+
externalize_settings_binary_assets(model)
|
|
369
|
+
Settings::SourceEmitter.new.emit(model).rstrip
|
|
370
|
+
rescue Settings::Error, KeyError, TypeError => e
|
|
371
|
+
raise SerializationError, "typed project settings export failed: #{e.message}"
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
def externalize_settings_binary_assets(model)
|
|
375
|
+
index = 0
|
|
376
|
+
visit_settings_values(model) do |asset|
|
|
377
|
+
next asset if asset.bytes.empty?
|
|
378
|
+
|
|
379
|
+
index += 1
|
|
380
|
+
filename = "certificate-#{index}.bin"
|
|
381
|
+
path = File.join(@output_dir, 'app', 'settings', filename)
|
|
382
|
+
FileUtils.mkdir_p(File.dirname(path))
|
|
383
|
+
File.binwrite(path, asset.bytes)
|
|
384
|
+
asset.at(filename)
|
|
385
|
+
end
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
def visit_settings_values(value, &block)
|
|
389
|
+
case value
|
|
390
|
+
when Settings::Node
|
|
391
|
+
value.fields.each { |field, child| value.set(field, visit_settings_values(child, &block)) }
|
|
392
|
+
value
|
|
393
|
+
when Settings::Collection
|
|
394
|
+
Settings::Collection.new(items: value.items.map { visit_settings_values(_1, &block) },
|
|
395
|
+
marker: value.marker)
|
|
396
|
+
when Settings::BinaryAsset
|
|
397
|
+
yield(value)
|
|
398
|
+
else
|
|
399
|
+
value
|
|
400
|
+
end
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
def system_text_declarations(project, documents)
|
|
404
|
+
documents.filter_map do |unit, document|
|
|
405
|
+
next unless document['$Type'] == 'Texts$SystemTextCollection'
|
|
406
|
+
|
|
407
|
+
if project.mendix_version.to_s.split('.').first.to_i == 11
|
|
408
|
+
typed_system_text_declaration(document)
|
|
409
|
+
else
|
|
410
|
+
project_document_declaration(:system_text_collection, unit, document, 'SystemTexts')
|
|
411
|
+
end
|
|
412
|
+
end
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
def typed_system_text_declaration(document)
|
|
416
|
+
model = SystemTexts::MprCodec.new.decode(document)
|
|
417
|
+
SystemTexts::SourceEmitter.new.emit(model).rstrip
|
|
418
|
+
rescue SystemTexts::CodecError, KeyError, TypeError => e
|
|
419
|
+
raise SerializationError, "typed system-text export failed: #{e.message}"
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
def project_document_declaration(method, unit, document, field)
|
|
423
|
+
options = {
|
|
424
|
+
unit_id: unit.fetch('UnitID'), container_id: unit.fetch('ContainerID'),
|
|
425
|
+
containment: unit.fetch('ContainmentName'), id: document_id(document),
|
|
426
|
+
(field == 'Settings' ? :settings : :system_texts) => presentation_value_spec(document[field])
|
|
427
|
+
}
|
|
428
|
+
lines = ["#{method}("]
|
|
429
|
+
options.each_with_index do |(key, value), index|
|
|
430
|
+
comma = index == options.size - 1 ? '' : ','
|
|
431
|
+
lines << " #{key}: #{native_ruby(value, 2)}#{comma}"
|
|
432
|
+
end
|
|
433
|
+
lines << ')'
|
|
434
|
+
lines.join("\n")
|
|
435
|
+
end
|
|
436
|
+
|
|
437
|
+
def ruby_file(declarations)
|
|
438
|
+
"# frozen_string_literal: true\n\n#{declarations.join("\n\n")}\n"
|
|
439
|
+
end
|
|
440
|
+
|
|
204
441
|
def export_ruby_app_sources(project)
|
|
205
442
|
files = project.mpr.ruby_app_sources
|
|
206
443
|
return false if files.empty?
|
|
@@ -208,13 +445,13 @@ module Mxrb
|
|
|
208
445
|
payload = files.map do |file|
|
|
209
446
|
contents = file.fetch(:contents)
|
|
210
447
|
{
|
|
211
|
-
|
|
212
|
-
|
|
448
|
+
'path' => file.fetch(:path), 'sha256' => file.fetch(:sha256),
|
|
449
|
+
'contents' => Base64.strict_encode64(contents), 'mode' => file.fetch(:mode, 0o644)
|
|
213
450
|
}
|
|
214
451
|
end
|
|
215
452
|
write(
|
|
216
|
-
File.join(@output_dir,
|
|
217
|
-
JSON.pretty_generate(
|
|
453
|
+
File.join(@output_dir, '.mxrb', 'ruby_sources.json'),
|
|
454
|
+
JSON.pretty_generate('version' => 1, 'files' => payload)
|
|
218
455
|
)
|
|
219
456
|
true
|
|
220
457
|
end
|
|
@@ -233,25 +470,26 @@ module Mxrb
|
|
|
233
470
|
|
|
234
471
|
def native_unit_source(project, unit, doc)
|
|
235
472
|
<<~RUBY
|
|
236
|
-
native_unit #{ruby(unit.fetch(
|
|
237
|
-
container_id: #{ruby(unit.fetch(
|
|
238
|
-
containment: #{ruby(unit.fetch(
|
|
473
|
+
native_unit #{ruby(unit.fetch('UnitID'))},
|
|
474
|
+
container_id: #{ruby(unit.fetch('ContainerID'))},
|
|
475
|
+
containment: #{ruby(unit.fetch('ContainmentName'))},
|
|
239
476
|
module_name: #{ruby(module_name_for(project, unit))},
|
|
240
|
-
deep_structure: #{
|
|
477
|
+
deep_structure: #{native_fragment_ruby(doc)}
|
|
241
478
|
RUBY
|
|
242
479
|
end
|
|
243
480
|
|
|
244
481
|
def module_name_for(project, unit)
|
|
245
|
-
container = unit[
|
|
482
|
+
container = unit['ContainerID']
|
|
246
483
|
project.modules.find { _1.id == container }&.name ||
|
|
247
484
|
project.modules.find { |mod| native_descendant_of?(project, container, mod.id) }&.name
|
|
248
485
|
end
|
|
249
486
|
|
|
250
487
|
def native_descendant_of?(project, child_id, ancestor_id)
|
|
251
488
|
current = project.raw_unit(child_id)
|
|
252
|
-
until current.nil? || current[
|
|
253
|
-
return true if current[
|
|
254
|
-
|
|
489
|
+
until current.nil? || current['UnitID'] == current['ContainerID']
|
|
490
|
+
return true if current['ContainerID'] == ancestor_id
|
|
491
|
+
|
|
492
|
+
current = project.raw_unit(current['ContainerID'])
|
|
255
493
|
end
|
|
256
494
|
false
|
|
257
495
|
end
|
|
@@ -259,7 +497,7 @@ module Mxrb
|
|
|
259
497
|
def export_security(project)
|
|
260
498
|
doc = project_security_doc(project)
|
|
261
499
|
source = doc ? security_source(doc) : "# frozen_string_literal: true\n"
|
|
262
|
-
write(File.join(@output_dir,
|
|
500
|
+
write(File.join(@output_dir, 'app', 'security', 'security.rb'), source)
|
|
263
501
|
end
|
|
264
502
|
|
|
265
503
|
def export_architecture_contracts(project)
|
|
@@ -267,11 +505,11 @@ module Mxrb
|
|
|
267
505
|
navigation ||= project.navigation.to_h unless project.navigation.empty?
|
|
268
506
|
design_system = @architecture&.fetch(:design_system, nil)
|
|
269
507
|
write(
|
|
270
|
-
File.join(@output_dir,
|
|
508
|
+
File.join(@output_dir, 'app', 'navigation', 'navigation.rb'),
|
|
271
509
|
navigation_source(navigation)
|
|
272
510
|
)
|
|
273
511
|
write(
|
|
274
|
-
File.join(@output_dir,
|
|
512
|
+
File.join(@output_dir, 'app', 'design_system', 'design_system.rb'),
|
|
275
513
|
design_system_source(design_system)
|
|
276
514
|
)
|
|
277
515
|
end
|
|
@@ -288,25 +526,27 @@ module Mxrb
|
|
|
288
526
|
infrastructure/mappings infrastructure/actions infrastructure/endpoints
|
|
289
527
|
infrastructure/integrations
|
|
290
528
|
security
|
|
291
|
-
].each { write(File.join(root, _1,
|
|
529
|
+
].each { write(File.join(root, _1, '.keep'), '') }
|
|
292
530
|
|
|
293
|
-
security_path = File.join(root,
|
|
531
|
+
security_path = File.join(root, 'security', 'security.rb')
|
|
294
532
|
write(security_path, "# frozen_string_literal: true\n") unless File.exist?(security_path)
|
|
295
533
|
end
|
|
296
534
|
|
|
297
535
|
def export_module_security(root, mod)
|
|
298
536
|
roles = mod.module_roles.map do |role|
|
|
299
537
|
args = [symbol(role.fetch(:name))]
|
|
300
|
-
|
|
538
|
+
id = role.fetch(:id, '').to_s
|
|
539
|
+
args << "id: #{ruby(id)}" unless id.empty?
|
|
540
|
+
description = role.fetch(:description, '')
|
|
301
541
|
args << "description: #{ruby(description)}" unless description.empty?
|
|
302
542
|
"module_role #{args.join(', ')}"
|
|
303
543
|
end
|
|
304
|
-
source = ([
|
|
305
|
-
write(File.join(root,
|
|
544
|
+
source = (['# frozen_string_literal: true', ''] + roles).join("\n") + "\n"
|
|
545
|
+
write(File.join(root, 'security', 'security.rb'), source)
|
|
306
546
|
end
|
|
307
547
|
|
|
308
548
|
def export_domain(root, mod)
|
|
309
|
-
domain = File.join(root,
|
|
549
|
+
domain = File.join(root, 'domain')
|
|
310
550
|
associations = mod.associations.group_by(&:from_entity_id)
|
|
311
551
|
architecture = architecture_module(mod.name)
|
|
312
552
|
paths = {}
|
|
@@ -323,7 +563,7 @@ module Mxrb
|
|
|
323
563
|
entity_metadata = architecture&.fetch(:entities, [])&.find { _1[:name] == entity.name }
|
|
324
564
|
source = entity_source(entity, mod, associations.fetch(entity.id, []), entity_metadata)
|
|
325
565
|
if oql_view_entity?(entity) && (document = oql_document_for(entity, oql_documents, mod.name))
|
|
326
|
-
source = "#{source.rstrip}\n\n#{
|
|
566
|
+
source = "#{source.rstrip}\n\n#{integration_document_declaration(document)}"
|
|
327
567
|
attached_oql_documents[document.fetch(:id)] = true
|
|
328
568
|
end
|
|
329
569
|
write(
|
|
@@ -336,11 +576,17 @@ module Mxrb
|
|
|
336
576
|
write(File.join(domain, relative), mapping_document_source(document))
|
|
337
577
|
paths[document.fetch(:id)] = relative
|
|
338
578
|
end
|
|
579
|
+
rule_files = unique_filenames(mod.rules)
|
|
580
|
+
mod.rules.each do |rule|
|
|
581
|
+
relative = File.join('rules', rule_files.fetch(rule.id))
|
|
582
|
+
write(File.join(domain, relative), rule_source(rule))
|
|
583
|
+
paths[rule.id] = relative
|
|
584
|
+
end
|
|
339
585
|
loads = paths.values.sort.map do |relative|
|
|
340
|
-
segments = relative.split(File::SEPARATOR).map { ruby(_1) }.join(
|
|
586
|
+
segments = relative.split(File::SEPARATOR).map { ruby(_1) }.join(', ')
|
|
341
587
|
%(evaluate File.join(__dir__, #{segments}))
|
|
342
588
|
end
|
|
343
|
-
write(File.join(domain,
|
|
589
|
+
write(File.join(domain, 'model.rb'), "#{loads.join("\n")}\n")
|
|
344
590
|
end
|
|
345
591
|
|
|
346
592
|
def entity_domain_route(entity)
|
|
@@ -365,7 +611,7 @@ module Mxrb
|
|
|
365
611
|
|
|
366
612
|
def export_microflows(root, mod)
|
|
367
613
|
files = unique_filenames(mod.microflows)
|
|
368
|
-
by_layer = {
|
|
614
|
+
by_layer = { 'application' => [], 'infrastructure' => [] }
|
|
369
615
|
architecture = architecture_module(mod.name)
|
|
370
616
|
mod.microflows.each do |flow|
|
|
371
617
|
layer, category = flow_location(flow.name)
|
|
@@ -379,9 +625,9 @@ module Mxrb
|
|
|
379
625
|
end
|
|
380
626
|
repositories = architecture&.fetch(:repositories, []) || []
|
|
381
627
|
unless repositories.empty?
|
|
382
|
-
relative = File.join(
|
|
383
|
-
write(File.join(root,
|
|
384
|
-
by_layer[
|
|
628
|
+
relative = File.join('ports', 'repositories.rb')
|
|
629
|
+
write(File.join(root, 'application', relative), repositories_source(repositories))
|
|
630
|
+
by_layer['application'] << relative
|
|
385
631
|
end
|
|
386
632
|
by_layer.each do |layer, paths|
|
|
387
633
|
write_path_aggregator(File.join(root, layer, "#{layer}.rb"), paths)
|
|
@@ -389,34 +635,43 @@ module Mxrb
|
|
|
389
635
|
end
|
|
390
636
|
|
|
391
637
|
def export_pages(root, mod)
|
|
392
|
-
presentation = File.join(root,
|
|
393
|
-
documents = File.join(presentation,
|
|
638
|
+
presentation = File.join(root, 'presentation')
|
|
639
|
+
documents = File.join(presentation, 'pages')
|
|
394
640
|
FileUtils.mkdir_p(documents)
|
|
395
641
|
files = unique_filenames(mod.pages)
|
|
396
642
|
architecture = architecture_module(mod.name)
|
|
397
643
|
paths = []
|
|
398
644
|
mod.pages.each do |page|
|
|
399
|
-
relative = File.join(
|
|
400
|
-
metadata =
|
|
401
|
-
|
|
645
|
+
relative = File.join('pages', files.fetch(page.id))
|
|
646
|
+
metadata = artifact_metadata(
|
|
647
|
+
mod.name, :page, page.name,
|
|
648
|
+
architecture&.fetch(:pages, [])&.find { _1[:name] == page.name }
|
|
649
|
+
)
|
|
650
|
+
write(
|
|
651
|
+
File.join(presentation, relative),
|
|
652
|
+
page_source(page, metadata, module_unit_id: mod.id)
|
|
653
|
+
)
|
|
402
654
|
paths << relative
|
|
403
655
|
end
|
|
404
|
-
|
|
656
|
+
append_to_aggregator(File.join(presentation, 'presentation.rb'), paths)
|
|
405
657
|
end
|
|
406
658
|
|
|
407
659
|
def export_infrastructure_documents(root, mod)
|
|
408
660
|
documents = mod.infrastructure_documents
|
|
409
661
|
return if documents.empty?
|
|
410
662
|
|
|
411
|
-
infrastructure = File.join(root,
|
|
663
|
+
infrastructure = File.join(root, 'infrastructure')
|
|
412
664
|
used = {}
|
|
413
665
|
paths = documents.map do |document|
|
|
414
666
|
base = underscore(document.fetch(:name))
|
|
415
667
|
relative = unique_relative_path(document.fetch(:route), base, used)
|
|
416
|
-
write(File.join(infrastructure, relative), mapping_document_source(document))
|
|
668
|
+
write(File.join(infrastructure, relative), mapping_document_source(document, mod:))
|
|
417
669
|
relative
|
|
418
670
|
end
|
|
419
|
-
append_to_aggregator(
|
|
671
|
+
append_to_aggregator(
|
|
672
|
+
File.join(infrastructure, 'infrastructure.rb'), paths,
|
|
673
|
+
managed_types: documents.map { _1.fetch(:type) }
|
|
674
|
+
)
|
|
420
675
|
end
|
|
421
676
|
|
|
422
677
|
def export_application_documents(root, mod)
|
|
@@ -433,6 +688,45 @@ module Mxrb
|
|
|
433
688
|
append_to_aggregator(File.join(application, 'application.rb'), paths)
|
|
434
689
|
end
|
|
435
690
|
|
|
691
|
+
def export_presentation_documents(root, mod)
|
|
692
|
+
documents = mod.presentation_documents
|
|
693
|
+
return if documents.empty?
|
|
694
|
+
|
|
695
|
+
presentation = File.join(root, 'presentation')
|
|
696
|
+
used = {}
|
|
697
|
+
paths = documents.map do |document|
|
|
698
|
+
relative = unique_relative_path(
|
|
699
|
+
document.fetch(:route), underscore(document.fetch(:name)), used
|
|
700
|
+
)
|
|
701
|
+
output_path = File.join(presentation, relative)
|
|
702
|
+
write(output_path, mapping_document_source(document, output_path:))
|
|
703
|
+
relative
|
|
704
|
+
end
|
|
705
|
+
append_to_aggregator(
|
|
706
|
+
File.join(presentation, 'presentation.rb'), paths,
|
|
707
|
+
managed_types: documents.map { _1.fetch(:type) }
|
|
708
|
+
)
|
|
709
|
+
end
|
|
710
|
+
|
|
711
|
+
def export_asset_documents(root, mod)
|
|
712
|
+
documents = mod.asset_documents
|
|
713
|
+
return if documents.empty?
|
|
714
|
+
|
|
715
|
+
presentation = File.join(root, 'presentation')
|
|
716
|
+
used = {}
|
|
717
|
+
paths = documents.map do |document|
|
|
718
|
+
relative = unique_relative_path(
|
|
719
|
+
document.fetch(:route), underscore(document.fetch(:name)), used
|
|
720
|
+
)
|
|
721
|
+
write(File.join(presentation, relative), mapping_document_source(document))
|
|
722
|
+
relative
|
|
723
|
+
end
|
|
724
|
+
append_to_aggregator(
|
|
725
|
+
File.join(presentation, 'presentation.rb'), paths,
|
|
726
|
+
managed_types: documents.map { _1.fetch(:type) }
|
|
727
|
+
)
|
|
728
|
+
end
|
|
729
|
+
|
|
436
730
|
def unique_relative_path(directory, base, used)
|
|
437
731
|
candidate = File.join(directory, "#{base}.rb")
|
|
438
732
|
suffix = 2
|
|
@@ -444,14 +738,187 @@ module Mxrb
|
|
|
444
738
|
candidate
|
|
445
739
|
end
|
|
446
740
|
|
|
447
|
-
def mapping_document_source(document)
|
|
741
|
+
def mapping_document_source(document, mod: nil, output_path: nil)
|
|
448
742
|
<<~RUBY
|
|
449
743
|
# frozen_string_literal: true
|
|
450
744
|
|
|
451
|
-
#{
|
|
745
|
+
#{integration_document_declaration(document, mod:, output_path:)}
|
|
452
746
|
RUBY
|
|
453
747
|
end
|
|
454
748
|
|
|
749
|
+
def integration_document_declaration(document, mod: nil, output_path: nil)
|
|
750
|
+
doc = document.fetch(:doc)
|
|
751
|
+
if (forms_model = @typed_forms_documents&.fetch(document.fetch(:id), nil))
|
|
752
|
+
return typed_forms_document_declaration(document, forms_model, output_path:)
|
|
753
|
+
end
|
|
754
|
+
|
|
755
|
+
case document.fetch(:type)
|
|
756
|
+
when 'JsonStructures$JsonStructure'
|
|
757
|
+
return json_structure_declaration(document) if doc.key?('JsonSnippet')
|
|
758
|
+
when 'XmlSchemas$XmlSchema'
|
|
759
|
+
return xml_schema_declaration(document) if semantic_xml_schema?(doc)
|
|
760
|
+
when 'ImportMappings$ImportMapping'
|
|
761
|
+
return mapping_declaration(document, :import) if semantic_mapping?(doc)
|
|
762
|
+
when 'ExportMappings$ExportMapping'
|
|
763
|
+
return mapping_declaration(document, :export) if semantic_mapping?(doc)
|
|
764
|
+
when 'Rest$PublishedRestService'
|
|
765
|
+
return published_rest_declaration(document, mod:) if semantic_rest_service?(doc, mod:)
|
|
766
|
+
when 'ODataPublish$PublishedODataService2'
|
|
767
|
+
return published_odata_service_declaration(document) if semantic_published_odata_service?(doc)
|
|
768
|
+
when 'Rest$ConsumedODataService'
|
|
769
|
+
return consumed_odata_service_declaration(document) if semantic_consumed_odata_service?(doc)
|
|
770
|
+
when 'Authentication$Authentication'
|
|
771
|
+
return authentication_declaration(document) if semantic_authentication?(doc)
|
|
772
|
+
when 'AppServices$ConsumedAppService'
|
|
773
|
+
return consumed_app_service_declaration(document) if semantic_consumed_app_service?(doc)
|
|
774
|
+
when 'WebServices$PublishedService'
|
|
775
|
+
return published_web_service_declaration(document) if semantic_published_web_service?(doc)
|
|
776
|
+
when 'WebServices$ImportedServiceImpl'
|
|
777
|
+
return imported_web_service_declaration(document) if semantic_imported_web_service?(doc)
|
|
778
|
+
when 'MessageDefinitions$MessageDefinitionCollection'
|
|
779
|
+
return message_definition_collection_declaration(document) \
|
|
780
|
+
if semantic_message_definition_collection?(doc)
|
|
781
|
+
when 'Enumerations$Enumeration'
|
|
782
|
+
return enumeration_declaration(document) if semantic_enumeration?(doc)
|
|
783
|
+
when 'Constants$Constant'
|
|
784
|
+
return constant_declaration(document) if doc['Type'].is_a?(Hash)
|
|
785
|
+
when 'DomainModels$ViewEntitySourceDocument'
|
|
786
|
+
return oql_source_declaration(document) if doc.key?('Oql')
|
|
787
|
+
when 'DatabaseConnector$DatabaseConnection'
|
|
788
|
+
return database_connection_declaration(document) if semantic_database_connection?(doc)
|
|
789
|
+
when 'DataSets$DataSet'
|
|
790
|
+
return dataset_declaration(document) if semantic_dataset?(doc)
|
|
791
|
+
when 'Queues$Queue'
|
|
792
|
+
return task_queue_declaration(document) if semantic_task_queue?(doc)
|
|
793
|
+
when 'ScheduledEvents$ScheduledEvent'
|
|
794
|
+
return scheduled_event_declaration(document) if semantic_scheduled_event?(doc)
|
|
795
|
+
when 'RegularExpressions$RegularExpression'
|
|
796
|
+
return regular_expression_declaration(document)
|
|
797
|
+
when 'JavaActions$JavaAction'
|
|
798
|
+
return code_action_declaration(document, :java) if semantic_code_action?(doc)
|
|
799
|
+
when 'JavaScriptActions$JavaScriptAction'
|
|
800
|
+
return code_action_declaration(document, :javascript) if semantic_code_action?(doc)
|
|
801
|
+
when 'Workflows$Workflow'
|
|
802
|
+
return workflow_declaration(document) if semantic_workflow?(doc)
|
|
803
|
+
when 'Forms$Layout'
|
|
804
|
+
return layout_document_declaration(document)
|
|
805
|
+
when 'Forms$PageTemplate'
|
|
806
|
+
return page_template_document_declaration(document)
|
|
807
|
+
when 'Forms$BuildingBlock'
|
|
808
|
+
return building_block_document_declaration(document)
|
|
809
|
+
when 'Forms$Snippet'
|
|
810
|
+
return snippet_document_declaration(document)
|
|
811
|
+
when 'Images$ImageCollection'
|
|
812
|
+
return image_collection_declaration(document)
|
|
813
|
+
when 'CustomIcons$CustomIconCollection'
|
|
814
|
+
return custom_icon_collection_declaration(document)
|
|
815
|
+
end
|
|
816
|
+
native_document_declaration(document)
|
|
817
|
+
end
|
|
818
|
+
|
|
819
|
+
TYPED_FORMS_DECLARATIONS = {
|
|
820
|
+
'Forms$Layout' => :layout_document,
|
|
821
|
+
'Forms$PageTemplate' => :page_template_document,
|
|
822
|
+
'Forms$BuildingBlock' => :building_block_document,
|
|
823
|
+
'Forms$Snippet' => :snippet_document
|
|
824
|
+
}.freeze
|
|
825
|
+
|
|
826
|
+
def typed_forms_document_declaration(document, model, output_path:)
|
|
827
|
+
externalize_forms_binary_assets(model, output_path:) if output_path
|
|
828
|
+
declaration = "#{TYPED_FORMS_DECLARATIONS.fetch(document.fetch(:type))} " \
|
|
829
|
+
"#{symbol(document.fetch(:name))}"
|
|
830
|
+
Forms::SourceEmitter.new.emit_as(model, declaration).rstrip
|
|
831
|
+
end
|
|
832
|
+
|
|
833
|
+
def externalize_forms_binary_assets(model, output_path:)
|
|
834
|
+
property = model.schema_type.property(:image_data)
|
|
835
|
+
return unless property && (asset = model.fetch(property.name)).is_a?(Forms::BinaryAsset)
|
|
836
|
+
return if asset.bytes.empty?
|
|
837
|
+
|
|
838
|
+
extension = forms_binary_extension(asset.bytes)
|
|
839
|
+
filename = "#{File.basename(output_path, '.rb')}.preview#{extension}"
|
|
840
|
+
FileUtils.mkdir_p(File.dirname(output_path))
|
|
841
|
+
File.binwrite(File.join(File.dirname(output_path), filename), asset.bytes)
|
|
842
|
+
model.set(property.name, asset.at(filename))
|
|
843
|
+
end
|
|
844
|
+
|
|
845
|
+
def forms_binary_extension(bytes)
|
|
846
|
+
return '.png' if bytes.start_with?("\x89PNG\r\n\x1A\n".b)
|
|
847
|
+
return '.jpg' if bytes.start_with?("\xFF\xD8\xFF".b)
|
|
848
|
+
return '.gif' if bytes.start_with?('GIF87a', 'GIF89a')
|
|
849
|
+
return '.webp' if bytes.start_with?('RIFF') && bytes.byteslice(8, 4) == 'WEBP'
|
|
850
|
+
|
|
851
|
+
'.bin'
|
|
852
|
+
end
|
|
853
|
+
|
|
854
|
+
OAUTH_AUTHENTICATION_FIELDS = %w[
|
|
855
|
+
$ID $Type Audience ClientId ClientSecret GrantType ProviderName Scopes TenantId
|
|
856
|
+
TokenEndPoint WellKnownEndPoint
|
|
857
|
+
].freeze
|
|
858
|
+
OAUTH_AUTH_CODE_FIELDS = (
|
|
859
|
+
OAUTH_AUTHENTICATION_FIELDS + %w[AuthorizationEndpoint CallbackUrl ResponseMode ResponseType]
|
|
860
|
+
).freeze
|
|
861
|
+
|
|
862
|
+
MESSAGE_EXPOSED_ENTITY_FIELDS = %w[
|
|
863
|
+
$ID $Type Children Documentation ElementType Entity ErrorMessage Example ExposedItemName
|
|
864
|
+
ExposedName FractionDigits IsDefaultType MaxLength MaxOccurs MinOccurs Nillable OriginalName
|
|
865
|
+
Path PrimitiveType TotalDigits WarningMessage
|
|
866
|
+
].freeze
|
|
867
|
+
MESSAGE_EXPOSED_ATTRIBUTE_FIELDS = (
|
|
868
|
+
MESSAGE_EXPOSED_ENTITY_FIELDS - %w[Entity] + %w[Attribute]
|
|
869
|
+
).freeze
|
|
870
|
+
|
|
871
|
+
def semantic_block_call_lines(method, name, options, indent:)
|
|
872
|
+
lines = semantic_call_lines(method, name, options, indent:)
|
|
873
|
+
lines[-1] = "#{lines[-1]} do"
|
|
874
|
+
lines
|
|
875
|
+
end
|
|
876
|
+
|
|
877
|
+
def semantic_call_lines(method, name, options, indent:)
|
|
878
|
+
pad = ' ' * indent
|
|
879
|
+
return ["#{pad}#{method} #{symbol(name)}"] if options.empty?
|
|
880
|
+
|
|
881
|
+
continuation = ' ' * (indent + 16)
|
|
882
|
+
lines = ["#{pad}#{method} #{symbol(name)},"]
|
|
883
|
+
options.each_with_index do |(key, value), index|
|
|
884
|
+
comma = index == options.size - 1 ? '' : ','
|
|
885
|
+
lines << "#{continuation}#{key}: #{native_ruby(value, indent + 16)}#{comma}"
|
|
886
|
+
end
|
|
887
|
+
lines
|
|
888
|
+
end
|
|
889
|
+
|
|
890
|
+
WORKFLOW_ACTIVITY_FIELDS = %w[
|
|
891
|
+
$ID $Type Annotation Caption Name PersistentId RelativeMiddlePoint Size
|
|
892
|
+
].freeze
|
|
893
|
+
WORKFLOW_USER_TASK_FIELDS = (WORKFLOW_ACTIVITY_FIELDS + %w[
|
|
894
|
+
AutoAssignSingleTargetUser BoundaryEvents DueDate OnCreatedEvent Outcomes
|
|
895
|
+
TaskDescription TaskName TaskPage UserTargeting
|
|
896
|
+
]).freeze
|
|
897
|
+
WORKFLOW_MULTI_USER_TASK_FIELDS = (WORKFLOW_USER_TASK_FIELDS + %w[
|
|
898
|
+
AwaitAllUsers CompletionCriteria TargetUserInput
|
|
899
|
+
]).freeze
|
|
900
|
+
WORKFLOW_WAIT_TIMER_FIELDS = (WORKFLOW_ACTIVITY_FIELDS + %w[Delay]).freeze
|
|
901
|
+
WORKFLOW_CALL_MICROFLOW_FIELDS = (WORKFLOW_ACTIVITY_FIELDS + %w[
|
|
902
|
+
BoundaryEvents Microflow Outcomes ParameterMappings
|
|
903
|
+
]).freeze
|
|
904
|
+
WORKFLOW_CALL_WORKFLOW_FIELDS = (WORKFLOW_ACTIVITY_FIELDS + %w[
|
|
905
|
+
BoundaryEvents ExecuteAsync ParameterMappings Workflow
|
|
906
|
+
]).freeze
|
|
907
|
+
|
|
908
|
+
def bson_marker(bson, fallback)
|
|
909
|
+
IO::BsonCodec.parse_array(bson)[:marker]
|
|
910
|
+
rescue StandardError
|
|
911
|
+
fallback
|
|
912
|
+
end
|
|
913
|
+
|
|
914
|
+
def document_id(document)
|
|
915
|
+
IO::BsonCodec.extract_id(document.to_h['$ID']).to_s
|
|
916
|
+
end
|
|
917
|
+
|
|
918
|
+
def camelize_key(key)
|
|
919
|
+
key.to_s.split('_').map!(&:capitalize).join
|
|
920
|
+
end
|
|
921
|
+
|
|
455
922
|
def native_document_declaration(document)
|
|
456
923
|
<<~RUBY.rstrip
|
|
457
924
|
native_document #{symbol(document.fetch(:name))},
|
|
@@ -459,49 +926,51 @@ module Mxrb
|
|
|
459
926
|
unit_id: #{ruby(document.fetch(:id))},
|
|
460
927
|
container_id: #{ruby(document.fetch(:container_id))},
|
|
461
928
|
containment: #{ruby(document.fetch(:containment))},
|
|
462
|
-
|
|
929
|
+
# Native BSON, including bson_binary(...) values, is content-addressed.
|
|
930
|
+
deep_structure: #{native_fragment_ruby(document.fetch(:doc))}
|
|
463
931
|
RUBY
|
|
464
932
|
end
|
|
465
933
|
|
|
466
|
-
def append_to_aggregator(path, relative_paths)
|
|
934
|
+
def append_to_aggregator(path, relative_paths, managed_types: [])
|
|
467
935
|
existing = File.exist?(path) ? File.read(path).lines : []
|
|
936
|
+
management = Array(managed_types).uniq.sort.map do |type|
|
|
937
|
+
"manage_native_documents #{ruby(type)}\n"
|
|
938
|
+
end
|
|
468
939
|
additions = relative_paths.sort.map do |relative|
|
|
469
|
-
segments = relative.split(File::SEPARATOR).map { ruby(_1) }.join(
|
|
940
|
+
segments = relative.split(File::SEPARATOR).map { ruby(_1) }.join(', ')
|
|
470
941
|
"evaluate File.join(__dir__, #{segments})\n"
|
|
471
942
|
end
|
|
472
|
-
write(path, (existing + additions).uniq.join)
|
|
943
|
+
write(path, (existing + management + additions).uniq.join)
|
|
473
944
|
end
|
|
474
945
|
|
|
475
946
|
def export_menus(root, mod)
|
|
476
947
|
menus = mod.menus
|
|
477
948
|
return if menus.empty?
|
|
478
949
|
|
|
479
|
-
presentation = File.join(root,
|
|
950
|
+
presentation = File.join(root, 'presentation')
|
|
480
951
|
files = unique_filenames(menus)
|
|
481
952
|
paths = []
|
|
482
953
|
menus.each do |menu|
|
|
483
|
-
relative = File.join(
|
|
954
|
+
relative = File.join('menus', files.fetch(menu.id))
|
|
484
955
|
write(File.join(presentation, relative), menu_source(menu))
|
|
485
956
|
paths << relative
|
|
486
957
|
end
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
"evaluate File.join(__dir__, #{segments})\n"
|
|
492
|
-
end
|
|
493
|
-
write(existing_path, (existing + additions).join)
|
|
958
|
+
append_to_aggregator(
|
|
959
|
+
File.join(presentation, 'presentation.rb'), paths,
|
|
960
|
+
managed_types: ['Menus$MenuDocument']
|
|
961
|
+
)
|
|
494
962
|
end
|
|
495
963
|
|
|
496
964
|
def export_nanoflows(root, mod)
|
|
497
965
|
flows = mod.nanoflows
|
|
498
966
|
return if flows.empty?
|
|
499
|
-
|
|
967
|
+
|
|
968
|
+
presentation = File.join(root, 'presentation')
|
|
500
969
|
files = unique_filenames(flows)
|
|
501
970
|
paths = []
|
|
502
971
|
architecture = architecture_module(mod.name)
|
|
503
972
|
flows.each do |flow|
|
|
504
|
-
relative = File.join(
|
|
973
|
+
relative = File.join('client_actions', files.fetch(flow.id))
|
|
505
974
|
metadata = flow_metadata(
|
|
506
975
|
mod.name, :nanoflow, flow.name,
|
|
507
976
|
architecture&.fetch(:nanoflows, [])&.find { _1[:name] == flow.name }
|
|
@@ -509,17 +978,17 @@ module Mxrb
|
|
|
509
978
|
write(File.join(presentation, relative), nanoflow_source(flow, metadata))
|
|
510
979
|
paths << relative
|
|
511
980
|
end
|
|
512
|
-
existing = File.read(File.join(presentation,
|
|
981
|
+
existing = File.read(File.join(presentation, 'presentation.rb')).lines
|
|
513
982
|
additions = paths.sort.map do |relative|
|
|
514
|
-
segments = relative.split(File::SEPARATOR).map { ruby(_1) }.join(
|
|
983
|
+
segments = relative.split(File::SEPARATOR).map { ruby(_1) }.join(', ')
|
|
515
984
|
"evaluate File.join(__dir__, #{segments})\n"
|
|
516
985
|
end
|
|
517
|
-
write(File.join(presentation,
|
|
986
|
+
write(File.join(presentation, 'presentation.rb'), (existing + additions).join)
|
|
518
987
|
end
|
|
519
988
|
|
|
520
989
|
def write_path_aggregator(path, relative_paths)
|
|
521
990
|
loads = relative_paths.sort.map do |relative|
|
|
522
|
-
segments = relative.split(File::SEPARATOR).map { ruby(_1) }.join(
|
|
991
|
+
segments = relative.split(File::SEPARATOR).map { ruby(_1) }.join(', ')
|
|
523
992
|
%(evaluate File.join(__dir__, #{segments}))
|
|
524
993
|
end
|
|
525
994
|
write(path, "#{loads.join("\n")}\n")
|
|
@@ -536,1398 +1005,115 @@ module Mxrb
|
|
|
536
1005
|
end
|
|
537
1006
|
end
|
|
538
1007
|
|
|
539
|
-
|
|
540
|
-
module_loads = project.modules.map do |mod|
|
|
541
|
-
%( evaluate File.join(__dir__, "modules", #{ruby(mod.name)}, "module.rb"))
|
|
542
|
-
end.join("\n")
|
|
543
|
-
|
|
544
|
-
source = <<~RUBY
|
|
545
|
-
# frozen_string_literal: true
|
|
546
|
-
|
|
547
|
-
require "mxrb"
|
|
548
|
-
|
|
549
|
-
output = ENV.fetch("MXRB_OUTPUT_PATH", File.join(__dir__, #{ruby(File.basename(@mpr_path))}))
|
|
550
|
-
|
|
551
|
-
Mxrb.define(output) do
|
|
552
|
-
mendix_version #{ruby(project.mendix_version || "10.18.0")}
|
|
553
|
-
native_units File.join(__dir__, ".mxrb", "native_units.json")
|
|
554
|
-
project_assets File.join(__dir__, ".mxrb", "assets.json"), root: __dir__
|
|
555
|
-
#{' ruby_app_sources File.join(__dir__, ".mxrb", "ruby_sources.json")' if ruby_sources}
|
|
556
|
-
evaluate File.join(__dir__, ".mxrb", "native_units.rb")
|
|
557
|
-
evaluate File.join(__dir__, "app", "security", "security.rb")
|
|
558
|
-
evaluate File.join(__dir__, "app", "navigation", "navigation.rb")
|
|
559
|
-
evaluate File.join(__dir__, "app", "design_system", "design_system.rb")
|
|
560
|
-
#{module_loads}
|
|
561
|
-
end
|
|
562
|
-
RUBY
|
|
563
|
-
write(File.join(@output_dir, "project.rb"), source)
|
|
564
|
-
end
|
|
565
|
-
|
|
566
|
-
def module_source(mod)
|
|
567
|
-
<<~RUBY
|
|
568
|
-
# frozen_string_literal: true
|
|
569
|
-
|
|
570
|
-
self.module #{symbol(mod.name)} do
|
|
571
|
-
evaluate File.join(__dir__, "domain", "model.rb")
|
|
572
|
-
evaluate File.join(__dir__, "application", "application.rb")
|
|
573
|
-
evaluate File.join(__dir__, "presentation", "presentation.rb")
|
|
574
|
-
evaluate File.join(__dir__, "infrastructure", "infrastructure.rb")
|
|
575
|
-
evaluate File.join(__dir__, "security", "security.rb")
|
|
576
|
-
end
|
|
577
|
-
RUBY
|
|
578
|
-
end
|
|
579
|
-
|
|
580
|
-
def project_security_doc(project)
|
|
581
|
-
raw = project.all_units.find { |unit| project.parse_bson(unit)["$Type"] == "Security$ProjectSecurity" }
|
|
582
|
-
raw && project.parse_bson(raw)
|
|
583
|
-
end
|
|
584
|
-
|
|
585
|
-
def security_source(doc)
|
|
586
|
-
level = doc["SecurityLevel"]
|
|
587
|
-
roles = IO::BsonCodec.parse_array(doc["UserRoles"]).fetch(:items).map do |role|
|
|
588
|
-
module_roles = IO::BsonCodec.parse_array(role["ModuleRoles"]).fetch(:items)
|
|
589
|
-
admin = role["ManageAllRoles"] == true
|
|
590
|
-
args = [symbol(role.fetch("Name"))]
|
|
591
|
-
args << "module_roles: #{ruby(module_roles)}" unless module_roles.empty?
|
|
592
|
-
args << "admin: true" if admin
|
|
593
|
-
" user_role #{args.join(', ')}"
|
|
594
|
-
end
|
|
595
|
-
options = []
|
|
596
|
-
options << " admin_user_role #{ruby(doc["AdminUserRole"])}" unless doc["AdminUserRole"].to_s.empty?
|
|
597
|
-
options << " demo_users #{doc["EnableDemoUsers"] == true}"
|
|
598
|
-
demo_users = doc["DemoUsers"] || IO::BsonCodec.build_array([])
|
|
599
|
-
IO::BsonCodec.parse_array(demo_users).fetch(:items).each do |user|
|
|
600
|
-
assigned_roles = IO::BsonCodec.parse_array(user["UserRoles"]).fetch(:items)
|
|
601
|
-
options << " demo_user #{ruby(user["UserName"])}, entity: #{ruby(user["Entity"])}, " \
|
|
602
|
-
"roles: #{ruby(assigned_roles)}, password: #{ruby(user["Password"])}"
|
|
603
|
-
end
|
|
604
|
-
guest = " guest_access #{doc["EnableGuestAccess"] == true}"
|
|
605
|
-
guest += ", role: #{ruby(doc["GuestUserRole"])}" unless doc["GuestUserRole"].to_s.empty?
|
|
606
|
-
options << guest
|
|
607
|
-
options << " sign_in_microflow #{ruby(doc["SignInMicroflow"])}" unless doc["SignInMicroflow"].to_s.empty?
|
|
608
|
-
password = doc["PasswordPolicySettings"]
|
|
609
|
-
if password.is_a?(Hash)
|
|
610
|
-
known = {
|
|
611
|
-
"MinimumLength" => :minimum_length,
|
|
612
|
-
"RequireDigit" => :require_digit,
|
|
613
|
-
"RequireMixedCase" => :require_mixed_case,
|
|
614
|
-
"RequireSymbol" => :require_symbol
|
|
615
|
-
}
|
|
616
|
-
policy = password.each_with_object({}) do |(key, value), result|
|
|
617
|
-
next if %w[$ID $Type].include?(key)
|
|
618
|
-
|
|
619
|
-
result[known.fetch(key, key.to_sym)] = value
|
|
620
|
-
end
|
|
621
|
-
options << " password_policy(**#{ruby(policy)})"
|
|
622
|
-
end
|
|
623
|
-
<<~RUBY
|
|
624
|
-
# frozen_string_literal: true
|
|
625
|
-
|
|
626
|
-
security do
|
|
627
|
-
security_level #{ruby(level)}
|
|
628
|
-
#{roles.join("\n")}
|
|
629
|
-
#{options.join("\n")}
|
|
630
|
-
end
|
|
631
|
-
RUBY
|
|
632
|
-
end
|
|
633
|
-
|
|
634
|
-
def navigation_source(navigation)
|
|
635
|
-
return "# frozen_string_literal: true\n" unless navigation
|
|
636
|
-
|
|
637
|
-
profiles = navigation.fetch(:profiles, []).flat_map { navigation_profile_source(_1) }
|
|
638
|
-
<<~RUBY
|
|
639
|
-
# frozen_string_literal: true
|
|
640
|
-
|
|
641
|
-
navigation do
|
|
642
|
-
#{profiles.join("\n")}
|
|
643
|
-
end
|
|
644
|
-
RUBY
|
|
645
|
-
end
|
|
646
|
-
|
|
647
|
-
def navigation_profile_source(profile)
|
|
648
|
-
args = [symbol(profile.fetch(:name))]
|
|
649
|
-
args << "home_page: #{ruby(profile[:home_page])}" if profile[:home_page]
|
|
650
|
-
args << "home_microflow: #{ruby(profile[:home_microflow])}" if profile[:home_microflow]
|
|
651
|
-
args << "sign_in_page: #{ruby(profile[:sign_in_page])}" if profile[:sign_in_page]
|
|
652
|
-
args << "menu: #{ruby(profile[:menu])}" if profile[:menu]
|
|
653
|
-
role_homes = profile.fetch(:role_homes, {})
|
|
654
|
-
args << "role_homes: #{ruby(role_homes)}" if role_homes.is_a?(Hash) && !role_homes.empty?
|
|
655
|
-
args << "offline: true" if profile[:offline]
|
|
656
|
-
args << "kind: #{ruby(profile[:kind])}" unless profile[:kind].to_s.empty?
|
|
657
|
-
args << "app_icon: #{ruby(profile[:app_icon])}" if profile[:app_icon]
|
|
658
|
-
body = navigation_profile_body(profile, role_homes)
|
|
659
|
-
return [" profile #{args.join(', ')}"] if body.empty?
|
|
660
|
-
|
|
661
|
-
[" profile #{args.join(', ')} do", *body, " end"]
|
|
662
|
-
end
|
|
663
|
-
|
|
664
|
-
def navigation_profile_body(profile, role_homes)
|
|
665
|
-
details = role_homes.is_a?(Array) ? role_homes : profile.fetch(:role_home_details, [])
|
|
666
|
-
titles = profile.fetch(:app_title, {}).map do |locale, text|
|
|
667
|
-
" title #{ruby(locale)}, #{ruby(text)}"
|
|
668
|
-
end
|
|
669
|
-
homes = details.map do |home|
|
|
670
|
-
options = []
|
|
671
|
-
options << "page: #{ruby(home[:page])}" if home[:page]
|
|
672
|
-
options << "microflow: #{ruby(home[:microflow])}" if home[:microflow]
|
|
673
|
-
suffix = options.empty? ? "" : ", #{options.join(', ')}"
|
|
674
|
-
" home_for #{ruby(home.fetch(:role))}#{suffix}"
|
|
675
|
-
end
|
|
676
|
-
items = profile.fetch(:items, []).flat_map { navigation_item_source(_1, 4) }
|
|
677
|
-
titles + homes + items
|
|
678
|
-
end
|
|
679
|
-
|
|
680
|
-
def design_system_source(design_system)
|
|
681
|
-
return "# frozen_string_literal: true\n" unless design_system
|
|
682
|
-
|
|
683
|
-
lines = design_system.fetch(:tokens, []).map do |token|
|
|
684
|
-
args = [symbol(token.fetch(:name))]
|
|
685
|
-
args << "value: #{ruby(token[:value])}" unless token[:value].nil?
|
|
686
|
-
" #{token.fetch(:kind)} #{args.join(', ')}"
|
|
687
|
-
end
|
|
688
|
-
lines.concat(design_system.fetch(:layouts, []).map { " layout #{ruby(_1)}" })
|
|
689
|
-
lines.concat(design_system.fetch(:components, []).map { " component #{ruby(_1)}" })
|
|
690
|
-
lines.concat(design_system.fetch(:accessibility, []).map { " accessibility #{ruby(_1)}" })
|
|
691
|
-
design_system.fetch(:themes, []).each do |theme|
|
|
692
|
-
args = [ruby(theme.fetch(:name))]
|
|
693
|
-
args << "inherits: #{ruby(theme[:inherits])}" if theme[:inherits]
|
|
694
|
-
lines << " theme #{args.join(', ')} do"
|
|
695
|
-
theme.fetch(:tokens, []).each do |token|
|
|
696
|
-
token_args = [symbol(token.fetch(:name))]
|
|
697
|
-
token_args << "value: #{ruby(token[:value])}" unless token[:value].nil?
|
|
698
|
-
lines << " #{token.fetch(:kind)} #{token_args.join(', ')}"
|
|
699
|
-
end
|
|
700
|
-
lines << " end"
|
|
701
|
-
end
|
|
702
|
-
design_system.fetch(:contrast_pairs, []).each do |pair|
|
|
703
|
-
lines << " contrast foreground: #{ruby(pair.fetch(:foreground))}, " \
|
|
704
|
-
"background: #{ruby(pair.fetch(:background))}, level: #{symbol(pair.fetch(:level))}"
|
|
705
|
-
end
|
|
706
|
-
lines << " forbid_literal_colors" if design_system[:forbid_literal_colors]
|
|
707
|
-
<<~RUBY
|
|
708
|
-
# frozen_string_literal: true
|
|
709
|
-
|
|
710
|
-
design_system do
|
|
711
|
-
#{lines.join("\n")}
|
|
712
|
-
end
|
|
713
|
-
RUBY
|
|
714
|
-
end
|
|
715
|
-
|
|
716
|
-
def navigation_item_source(item, indent)
|
|
717
|
-
pad = " " * indent
|
|
718
|
-
caption = item.fetch(:caption)
|
|
719
|
-
primary = caption["en_US"] || caption[:en_US] || caption.values.first || ""
|
|
720
|
-
translations = caption.reject { |locale, _| locale.to_s == "en_US" }
|
|
721
|
-
args = [ruby(primary)]
|
|
722
|
-
args << "page: #{ruby(item[:page])}" if item[:page]
|
|
723
|
-
args << "microflow: #{ruby(item[:microflow])}" if item[:microflow]
|
|
724
|
-
args << "icon: #{ruby(item[:icon])}" if item[:icon]
|
|
725
|
-
args << "translations: #{ruby(translations)}" unless translations.empty?
|
|
726
|
-
children = item.fetch(:items, [])
|
|
727
|
-
return ["#{pad}item #{args.join(', ')}"] if children.empty?
|
|
728
|
-
|
|
729
|
-
["#{pad}item #{args.join(', ')} do",
|
|
730
|
-
*children.flat_map { navigation_item_source(_1, indent + 2) },
|
|
731
|
-
"#{pad}end"]
|
|
732
|
-
end
|
|
733
|
-
|
|
734
|
-
def entity_source(entity, mod, associations, metadata = nil)
|
|
735
|
-
attrs = entity.attributes.map do |attr|
|
|
736
|
-
options = []
|
|
737
|
-
options << "default: #{ruby(attr.default_value)}" unless attr.default_value.nil? || attr.default_value == ""
|
|
738
|
-
options << "documentation: #{ruby(attr.documentation)}" unless attr.documentation.to_s.empty?
|
|
739
|
-
options << "length: #{attr.length}" unless attr.length.nil?
|
|
740
|
-
options << "localize_date: #{attr.localize_date}" unless attr.localize_date.nil?
|
|
741
|
-
options << "enumeration: #{ruby(attr.enumeration)}" unless attr.enumeration.to_s.empty?
|
|
742
|
-
options << 'required: true' if attr.required
|
|
743
|
-
options << 'unique: true' if attr.unique
|
|
744
|
-
" #{attr.type || :string} #{symbol(attr.name)}#{options.empty? ? '' : ", #{options.join(', ')}"}"
|
|
745
|
-
end
|
|
746
|
-
assocs = associations.map do |assoc|
|
|
747
|
-
target = mod.entities.find { _1.id == assoc.to_entity_id }&.name || assoc.to_entity_id
|
|
748
|
-
qualified_target = target.to_s.include?('.') ? target : "#{mod.name}.#{target}"
|
|
749
|
-
cardinality = association_cardinality(assoc)
|
|
750
|
-
options = ["cardinality: #{symbol(cardinality)}"]
|
|
751
|
-
options << "name: #{ruby(assoc.name)}"
|
|
752
|
-
documentation = assoc.respond_to?(:documentation) ? assoc.documentation : nil
|
|
753
|
-
options << "documentation: #{ruby(documentation)}" unless documentation.to_s.empty?
|
|
754
|
-
inferred_storage = assoc.association_type == :ReferenceSet ? :Table : :Column
|
|
755
|
-
storage_format = assoc.respond_to?(:storage_format) ? assoc.storage_format : nil
|
|
756
|
-
if storage_format && storage_format != inferred_storage
|
|
757
|
-
options << "storage_format: #{symbol(storage_format)}"
|
|
758
|
-
end
|
|
759
|
-
parent_delete = assoc.respond_to?(:parent_delete_behavior) ?
|
|
760
|
-
assoc.parent_delete_behavior : :NoAction
|
|
761
|
-
child_delete = assoc.respond_to?(:child_delete_behavior) ?
|
|
762
|
-
assoc.child_delete_behavior : :NoAction
|
|
763
|
-
options << "parent_delete: #{symbol(parent_delete)}" unless parent_delete == :NoAction
|
|
764
|
-
options << "child_delete: #{symbol(child_delete)}" unless child_delete == :NoAction
|
|
765
|
-
" association #{ruby(qualified_target)}, #{options.join(', ')}"
|
|
766
|
-
end
|
|
767
|
-
flags = []
|
|
768
|
-
flags << " non_persistent!" unless entity.persistable
|
|
769
|
-
if oql_view_entity?(entity)
|
|
770
|
-
options = []
|
|
771
|
-
options << "source: #{ruby(entity.oql_source_document)}" if entity.oql_source_document
|
|
772
|
-
options << "query: #{ruby(entity.oql_query)}" unless entity.oql_query.to_s.empty?
|
|
773
|
-
flags << " oql_view #{options.join(', ')}" unless options.empty?
|
|
774
|
-
end
|
|
775
|
-
flags << " documentation #{ruby(entity.documentation)}" unless entity.documentation.to_s.empty?
|
|
776
|
-
generalization = entity.respond_to?(:generalization_target) ? entity.generalization_target : nil
|
|
777
|
-
flags << " generalizes #{ruby(generalization)}" if generalization
|
|
778
|
-
system_members = entity.respond_to?(:system_members) ? entity.system_members : {}
|
|
779
|
-
system_options = system_members.to_h.select { |_key, value| value }
|
|
780
|
-
unless system_options.empty?
|
|
781
|
-
flags << " system_members #{system_options.map { |key, value| "#{key}: #{value}" }.join(', ')}"
|
|
782
|
-
end
|
|
783
|
-
indexes = entity.respond_to?(:indexes) ? entity.indexes : []
|
|
784
|
-
Array(indexes).each do |index|
|
|
785
|
-
indexed = IO::BsonCodec.parse_array(
|
|
786
|
-
index['attributes'] || index['Attributes'] || index['IndexedAttributes']
|
|
787
|
-
)[:items]
|
|
788
|
-
members = indexed.filter_map { _1['attribute'] || _1['Attribute'] }.map { _1.to_s.split('.').last }
|
|
789
|
-
next if members.empty?
|
|
790
|
-
|
|
791
|
-
directions = indexed.map { |member| member.fetch('ascending', member.fetch('Ascending', true)) }
|
|
792
|
-
options = []
|
|
793
|
-
options << "ascending: #{ruby(directions)}" unless directions.all?
|
|
794
|
-
include_offline = index['includeInOffline'] || index['IncludeInOffline']
|
|
795
|
-
options << 'include_offline: true' if include_offline
|
|
796
|
-
flags << " index #{members.map { symbol(_1) }.join(', ')}#{options.empty? ? '' : ", #{options.join(', ')}"}"
|
|
797
|
-
end
|
|
798
|
-
metadata&.fetch(:lifecycle, [])&.each do |callback|
|
|
799
|
-
flags << " #{callback.fetch(:event)} microflow: #{symbol(callback.fetch(:handler))}"
|
|
800
|
-
end
|
|
801
|
-
access_rules = Array(entity.access_rules)
|
|
802
|
-
access_lines = access_rules.filter_map { |rule| access_rule_source(rule) }
|
|
803
|
-
# A partial access-rule export would replace the complete native rule
|
|
804
|
-
# collection. Keep the collection opaque unless every rule is editable.
|
|
805
|
-
access_lines = [] unless access_lines.size == access_rules.size
|
|
806
|
-
<<~RUBY
|
|
807
|
-
# frozen_string_literal: true
|
|
808
|
-
|
|
809
|
-
entity #{symbol(entity.name)} do
|
|
810
|
-
#{(attrs + assocs + flags + access_lines).join("\n")}
|
|
811
|
-
end
|
|
812
|
-
RUBY
|
|
813
|
-
end
|
|
814
|
-
|
|
815
|
-
def association_cardinality(association)
|
|
816
|
-
return :many_to_many if association.association_type == :ReferenceSet
|
|
817
|
-
return :one_to_one if association.owner == :Both
|
|
818
|
-
|
|
819
|
-
:many_to_one
|
|
820
|
-
end
|
|
821
|
-
|
|
822
|
-
def access_rule_source(rule)
|
|
823
|
-
role_list = rule.fetch(:roles).reject { _1.to_s.empty? }
|
|
824
|
-
return nil if role_list.empty?
|
|
825
|
-
roles = role_list.map { ruby(_1) }.join(", ")
|
|
826
|
-
opts = []
|
|
827
|
-
opts << "create: true" if rule[:create]
|
|
828
|
-
opts << "delete: true" if rule[:delete]
|
|
829
|
-
read_val = reconstruct_access(rule.fetch(:default_rights, "None"), rule.fetch(:members, []), "ReadOnly", "ReadWrite")
|
|
830
|
-
write_val = reconstruct_access(rule.fetch(:default_rights, "None"), rule.fetch(:members, []), "ReadWrite", nil)
|
|
831
|
-
opts << "read: #{format_access(read_val)}" unless read_val == :none
|
|
832
|
-
opts << "write: #{format_access(write_val)}" unless write_val == :none
|
|
833
|
-
opts << "default_rights: #{ruby(rule.fetch(:default_rights, 'None'))}"
|
|
834
|
-
opts << "members: #{native_ruby(rule.fetch(:members, []))}"
|
|
835
|
-
xpath = rule.fetch(:xpath, "")
|
|
836
|
-
opts << "xpath: #{ruby(xpath)}" unless xpath.empty?
|
|
837
|
-
" access_rule #{[roles, *opts].join(', ')}"
|
|
838
|
-
end
|
|
839
|
-
|
|
840
|
-
def reconstruct_access(default_rights, members, primary_rights, secondary_rights)
|
|
841
|
-
if default_rights == "ReadWrite"
|
|
842
|
-
return :all if primary_rights == "ReadWrite"
|
|
843
|
-
return :all if primary_rights == "ReadOnly"
|
|
844
|
-
end
|
|
845
|
-
if default_rights == "ReadOnly"
|
|
846
|
-
return :all if primary_rights == "ReadOnly"
|
|
847
|
-
explicit = members.select { _1[:rights] == primary_rights }.map { _1[:name] }
|
|
848
|
-
return explicit unless explicit.empty?
|
|
849
|
-
return :none
|
|
850
|
-
end
|
|
851
|
-
# default_rights == "None"
|
|
852
|
-
explicit = members.select { |m|
|
|
853
|
-
m[:rights] == primary_rights ||
|
|
854
|
-
(secondary_rights && m[:rights] == secondary_rights)
|
|
855
|
-
}.map { _1[:name] }
|
|
856
|
-
explicit.empty? ? :none : explicit
|
|
857
|
-
end
|
|
858
|
-
|
|
859
|
-
def format_access(value)
|
|
860
|
-
case value
|
|
861
|
-
when :all, :none then ":#{value}"
|
|
862
|
-
when Array then "[#{value.map { symbol(_1) }.join(', ')}]"
|
|
863
|
-
else ":#{value}"
|
|
864
|
-
end
|
|
865
|
-
end
|
|
866
|
-
|
|
867
|
-
def unique_entity_filenames(entities, route: nil)
|
|
868
|
-
suffix = route == "dtos" ? "_dto" : nil
|
|
869
|
-
unique_filenames(entities, suffix:)
|
|
870
|
-
end
|
|
871
|
-
|
|
872
|
-
def unique_filenames(entities, suffix: nil)
|
|
873
|
-
used = {}
|
|
874
|
-
entities.to_h do |entity|
|
|
875
|
-
base = underscore(entity.name)
|
|
876
|
-
base = "#{base}#{suffix}" if suffix && !base.end_with?(suffix)
|
|
877
|
-
candidate = "#{base}.rb"
|
|
878
|
-
sequence = 2
|
|
879
|
-
while used[candidate]
|
|
880
|
-
candidate = "#{base}_#{sequence}.rb"
|
|
881
|
-
sequence += 1
|
|
882
|
-
end
|
|
883
|
-
used[candidate] = true
|
|
884
|
-
[entity.id, candidate]
|
|
885
|
-
end
|
|
886
|
-
end
|
|
887
|
-
|
|
888
|
-
def underscore(value)
|
|
889
|
-
value.to_s
|
|
890
|
-
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
|
891
|
-
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
|
892
|
-
.tr(" -", "__")
|
|
893
|
-
.gsub(/[^a-zA-Z0-9_]/, "")
|
|
894
|
-
.downcase
|
|
895
|
-
end
|
|
896
|
-
|
|
897
|
-
def microflow_source(flow, metadata = nil)
|
|
898
|
-
parameters = flow.parameters.filter_map do |param|
|
|
899
|
-
next unless param.is_a?(Hash)
|
|
900
|
-
name = param["Name"] || param["name"]
|
|
901
|
-
type = param["VariableType"] || param["Type"] || param["type"]
|
|
902
|
-
type_source = type.is_a?(Hash) ? native_ruby(type) : symbol(type)
|
|
903
|
-
" parameter #{symbol(name)}, type: #{type_source}" if name && type
|
|
904
|
-
end
|
|
905
|
-
body = parameters
|
|
906
|
-
body << " return_type #{symbol(flow.return_type)}" if flow.return_type.is_a?(String)
|
|
907
|
-
body << " documentation #{ruby(flow.documentation)}" unless flow.documentation.to_s.empty?
|
|
908
|
-
body << " allow_concurrent_execution #{flow.allow_concurrent_execution ? 'true' : 'false'}"
|
|
909
|
-
apply_entity_access = flow.respond_to?(:apply_entity_access) && flow.apply_entity_access
|
|
910
|
-
body << " apply_entity_access #{apply_entity_access ? 'true' : 'false'}"
|
|
911
|
-
body << " mark_as_used #{flow.mark_as_used ? 'true' : 'false'}"
|
|
912
|
-
body << " excluded #{flow.excluded ? 'true' : 'false'}"
|
|
913
|
-
body << " allowed_roles #{flow.allowed_module_roles.map { symbol(_1) }.join(', ')}" unless flow.allowed_module_roles.empty?
|
|
914
|
-
metadata&.fetch(:calls, [])&.each do |call|
|
|
915
|
-
body << " call #{call.fetch(:kind)}: #{symbol(call.fetch(:name))}"
|
|
916
|
-
end
|
|
917
|
-
metadata&.fetch(:repositories, [])&.each do |repository|
|
|
918
|
-
body << " uses_repository #{symbol(repository)}"
|
|
919
|
-
end
|
|
920
|
-
objects = Array(flow.objects)
|
|
921
|
-
flows = Array(flow.flows)
|
|
922
|
-
if editable_flow_body?(objects, flows)
|
|
923
|
-
dsl_lines = body_dsl_lines(objects, flows, 2)
|
|
924
|
-
body.concat(dsl_lines)
|
|
925
|
-
fingerprint = flow_body_fingerprint(dsl_lines, flow)
|
|
926
|
-
body << " body_fingerprint #{ruby(fingerprint)}" if fingerprint
|
|
927
|
-
elsif objects.any?
|
|
928
|
-
body << " # Native body baseline retained: this graph shape has no typed DSL mapping yet"
|
|
929
|
-
end
|
|
930
|
-
declaration = [symbol(flow.name)]
|
|
931
|
-
declaration << "public: true" if metadata&.fetch(:public, false)
|
|
932
|
-
<<~RUBY
|
|
933
|
-
# frozen_string_literal: true
|
|
934
|
-
|
|
935
|
-
microflow #{declaration.join(', ')} do
|
|
936
|
-
#{body.join("\n")}
|
|
937
|
-
end
|
|
938
|
-
RUBY
|
|
939
|
-
end
|
|
940
|
-
|
|
941
|
-
def nanoflow_source(flow, metadata = nil)
|
|
942
|
-
microflow_source(flow, metadata).sub(/(^\s*)microflow /, '\1nanoflow ')
|
|
943
|
-
end
|
|
944
|
-
|
|
945
|
-
def flow_body_fingerprint(lines, flow)
|
|
946
|
-
builder = Dsl::FlowBuilder.new(
|
|
947
|
-
flow.name, runtime: :server, kind: :microflow, public: false
|
|
948
|
-
)
|
|
949
|
-
builder.instance_eval(lines.join("\n"), @mpr_path, 1)
|
|
950
|
-
definition = builder.to_h
|
|
951
|
-
Dsl::FlowBuilder.body_digest(
|
|
952
|
-
definition[:body], definition[:return_expression]
|
|
953
|
-
)
|
|
954
|
-
rescue StandardError, SyntaxError
|
|
955
|
-
nil
|
|
956
|
-
end
|
|
957
|
-
|
|
958
|
-
def repositories_source(repositories)
|
|
959
|
-
repositories.map do |repository|
|
|
960
|
-
options = []
|
|
961
|
-
options << "implementation: #{symbol(repository[:implementation])}" if repository[:implementation]
|
|
962
|
-
options << "public: true" if repository[:public]
|
|
963
|
-
options << "documentation: #{ruby(repository[:documentation])}" unless repository[:documentation].to_s.empty?
|
|
964
|
-
"repository #{symbol(repository.fetch(:name))}#{options.empty? ? '' : ", #{options.join(', ')}"}"
|
|
965
|
-
end.join("\n") + "\n"
|
|
966
|
-
end
|
|
967
|
-
|
|
968
|
-
def page_source(page, metadata = nil)
|
|
969
|
-
body = []
|
|
970
|
-
body << " layout #{ruby(page.layout_id)}" if page.layout_id
|
|
971
|
-
body << " title #{ruby(page.title)}"
|
|
972
|
-
body << " popup!" if page.popup_width.to_i.positive? || page.popup_height.to_i.positive?
|
|
973
|
-
body << " allowed_roles #{page.allowed_module_roles.map { symbol(_1) }.join(', ')}" unless page.allowed_module_roles.empty?
|
|
974
|
-
deep = page_deep_structure(page)
|
|
975
|
-
if (source = metadata&.dig(:data_source) || page.data_source)
|
|
976
|
-
body << " data_source #{source.fetch(:kind)}: #{reference(source.fetch(:name))}"
|
|
977
|
-
end
|
|
978
|
-
body << " deep_structure(#{native_ruby(deep, 2)})" if deep
|
|
979
|
-
metadata&.fetch(:events, [])&.each do |event|
|
|
980
|
-
args = []
|
|
981
|
-
args << "target: #{symbol(event[:target])}" if event[:target]
|
|
982
|
-
args << "#{event.fetch(:kind)}: #{symbol(event.fetch(:handler))}"
|
|
983
|
-
body << " #{event.fetch(:event)} #{args.join(', ')}"
|
|
984
|
-
end
|
|
985
|
-
widgets = metadata ? metadata.fetch(:widgets, []) : page.widgets
|
|
986
|
-
widgets.each do |widget|
|
|
987
|
-
rendered = render_widget(widget, 2)
|
|
988
|
-
body.concat(rendered)
|
|
989
|
-
end
|
|
990
|
-
<<~RUBY
|
|
991
|
-
# frozen_string_literal: true
|
|
992
|
-
|
|
993
|
-
page #{symbol(page.name)} do
|
|
994
|
-
#{body.join("\n")}
|
|
995
|
-
end
|
|
996
|
-
RUBY
|
|
997
|
-
end
|
|
998
|
-
|
|
999
|
-
PAGE_TYPED_KEYS = %w[$ID Name name].freeze
|
|
1000
|
-
def page_deep_structure(page)
|
|
1001
|
-
raw = page.raw_document
|
|
1002
|
-
return nil unless raw.is_a?(Hash)
|
|
1003
|
-
|
|
1004
|
-
raw.reject { |key, _| PAGE_TYPED_KEYS.include?(key.to_s) }
|
|
1005
|
-
end
|
|
1006
|
-
|
|
1007
|
-
def native_ruby(value, indent = 0)
|
|
1008
|
-
case value
|
|
1009
|
-
when BSON::Binary
|
|
1010
|
-
encoded = Base64.strict_encode64(value.data)
|
|
1011
|
-
"bson_binary(#{ruby(encoded)}, subtype: #{value.type.inspect})"
|
|
1012
|
-
when Time
|
|
1013
|
-
"Time.at(#{value.to_i}, #{value.nsec}, :nanosecond).utc"
|
|
1014
|
-
when Hash
|
|
1015
|
-
return "{}" if value.empty?
|
|
1016
|
-
|
|
1017
|
-
pad = " " * indent
|
|
1018
|
-
child_pad = " " * (indent + 2)
|
|
1019
|
-
entries = value.map do |key, item|
|
|
1020
|
-
"#{child_pad}#{ruby(key)} => #{native_ruby(item, indent + 2)}"
|
|
1021
|
-
end
|
|
1022
|
-
"{\n#{entries.join(",\n")}\n#{pad}}"
|
|
1023
|
-
when Array
|
|
1024
|
-
return "[]" if value.empty?
|
|
1025
|
-
|
|
1026
|
-
pad = " " * indent
|
|
1027
|
-
child_pad = " " * (indent + 2)
|
|
1028
|
-
entries = value.map { "#{child_pad}#{native_ruby(_1, indent + 2)}" }
|
|
1029
|
-
"[\n#{entries.join(",\n")}\n#{pad}]"
|
|
1030
|
-
else
|
|
1031
|
-
ruby(value)
|
|
1032
|
-
end
|
|
1033
|
-
end
|
|
1034
|
-
|
|
1035
|
-
def menu_source(menu)
|
|
1036
|
-
body = menu.items.flat_map { menu_item_source(_1, 2) }
|
|
1037
|
-
if menu.raw_document.is_a?(Hash)
|
|
1038
|
-
deep = menu.raw_document.reject { |key, _| %w[$ID Name name].include?(key.to_s) }
|
|
1039
|
-
body.unshift(" deep_structure(#{native_ruby(deep, 2)})")
|
|
1040
|
-
end
|
|
1041
|
-
<<~RUBY
|
|
1042
|
-
# frozen_string_literal: true
|
|
1043
|
-
|
|
1044
|
-
menu #{symbol(menu.name)} do
|
|
1045
|
-
#{body.join("\n")}
|
|
1046
|
-
end
|
|
1047
|
-
RUBY
|
|
1048
|
-
end
|
|
1049
|
-
|
|
1050
|
-
def menu_item_source(item, indent)
|
|
1051
|
-
pad = " " * indent
|
|
1052
|
-
args = [ruby(item.fetch(:caption))]
|
|
1053
|
-
args << "page: #{ruby(item[:page])}" if item[:page]
|
|
1054
|
-
children = Array(item[:items])
|
|
1055
|
-
return ["#{pad}item #{args.join(', ')}"] if children.empty?
|
|
1056
|
-
|
|
1057
|
-
lines = ["#{pad}item #{args.join(', ')} do"]
|
|
1058
|
-
lines.concat(children.flat_map { menu_item_source(_1, indent + 2) })
|
|
1059
|
-
lines << "#{pad}end"
|
|
1060
|
-
end
|
|
1061
|
-
|
|
1062
|
-
def render_widget(widget, indent)
|
|
1063
|
-
pad = " " * indent
|
|
1064
|
-
child_pad = " " * (indent + 2)
|
|
1065
|
-
# Architecture metadata is serialized through JSON inside generated MPRs,
|
|
1066
|
-
# so a second export can surface widget type values as strings.
|
|
1067
|
-
type = widget.fetch(:type).to_sym
|
|
1068
|
-
options = widget.fetch(:options, {})
|
|
1069
|
-
|
|
1070
|
-
# Snippet: snippet :name, from: "..."
|
|
1071
|
-
if type == :snippet
|
|
1072
|
-
snippet_ref = options[:snippet].to_s
|
|
1073
|
-
args = [ruby(widget.fetch(:name))]
|
|
1074
|
-
args << "from: #{ruby(snippet_ref)}" unless snippet_ref == widget.fetch(:name).to_s
|
|
1075
|
-
return ["#{pad}snippet #{args.join(', ')}"]
|
|
1076
|
-
end
|
|
1077
|
-
|
|
1078
|
-
if type == :native_widget
|
|
1079
|
-
return [
|
|
1080
|
-
"#{pad}native_widget #{symbol(widget.fetch(:name))},",
|
|
1081
|
-
"#{child_pad}type: #{ruby(options.fetch(:native_type))},",
|
|
1082
|
-
"#{child_pad}deep_structure: #{native_ruby(options.fetch(:deep_structure), indent + 2)}"
|
|
1083
|
-
]
|
|
1084
|
-
end
|
|
1085
|
-
|
|
1086
|
-
if type == :pluggable_widget
|
|
1087
|
-
args = [symbol(widget.fetch(:name)), "widget_id: #{ruby(options.fetch(:widget_id))}"]
|
|
1088
|
-
args << "widget_name: #{ruby(options[:widget_name])}" if options[:widget_name]
|
|
1089
|
-
args << "properties: #{native_ruby(options[:properties])}" if options[:properties]
|
|
1090
|
-
args << "class_name: #{ruby(options[:class])}" if options[:class]
|
|
1091
|
-
return ["#{pad}pluggable_widget #{args.join(', ')}"]
|
|
1092
|
-
end
|
|
1093
|
-
|
|
1094
|
-
# drop_down
|
|
1095
|
-
if type == :drop_down
|
|
1096
|
-
args = [symbol(widget.fetch(:name))]
|
|
1097
|
-
args << "attribute: #{symbol(options[:attribute])}" if options[:attribute]
|
|
1098
|
-
args << "caption: #{ruby(options[:caption])}" if options.key?(:caption) && !options[:caption].nil?
|
|
1099
|
-
return ["#{pad}drop_down #{args.join(', ')}"]
|
|
1100
|
-
end
|
|
1101
|
-
|
|
1102
|
-
# Container: recurse into children
|
|
1103
|
-
if type == :container
|
|
1104
|
-
children_lines = Array(widget[:children]).flat_map { render_widget(_1, indent + 2) }
|
|
1105
|
-
args = [symbol(widget.fetch(:name))]
|
|
1106
|
-
args << "class_name: #{ruby(options[:class])}" if options[:class]
|
|
1107
|
-
if children_lines.empty?
|
|
1108
|
-
return ["#{pad}container #{args.join(', ')}"]
|
|
1109
|
-
else
|
|
1110
|
-
lines = ["#{pad}container #{args.join(', ')} do"]
|
|
1111
|
-
lines.concat(children_lines)
|
|
1112
|
-
lines << "#{pad}end"
|
|
1113
|
-
return lines
|
|
1114
|
-
end
|
|
1115
|
-
end
|
|
1116
|
-
|
|
1117
|
-
args = [symbol(widget.fetch(:name))]
|
|
1118
|
-
args << "attribute: #{symbol(options[:attribute])}" if options[:attribute]
|
|
1119
|
-
args << "caption: #{ruby(options[:caption])}" if options.key?(:caption) && !options[:caption].nil?
|
|
1120
|
-
args << "entity: #{ruby(options[:entity])}" if options[:entity]
|
|
1121
|
-
args << "lines: #{options[:lines]}" if type == :text_area && options[:lines]
|
|
1122
|
-
if type == :reference_selector && options[:display_attribute]
|
|
1123
|
-
args << "display_attribute: #{ruby(options[:display_attribute])}"
|
|
1124
|
-
end
|
|
1125
|
-
|
|
1126
|
-
widget_body = []
|
|
1127
|
-
Array(options[:columns]).each do |column|
|
|
1128
|
-
column_args = [symbol(column.fetch(:name))]
|
|
1129
|
-
column_args << "attribute: #{symbol(column[:attribute])}" if column[:attribute]
|
|
1130
|
-
column_args << "caption: #{ruby(column[:caption])}" if column.key?(:caption) && !column[:caption].nil?
|
|
1131
|
-
widget_body << "#{child_pad}column #{column_args.join(', ')}"
|
|
1132
|
-
end
|
|
1133
|
-
Array(options[:tabs]).each do |tab|
|
|
1134
|
-
tab_args = [symbol(tab.fetch(:name))]
|
|
1135
|
-
tab_args << "caption: #{ruby(tab[:caption])}" if tab.key?(:caption) && !tab[:caption].nil?
|
|
1136
|
-
tab_widgets = Array(tab[:widgets])
|
|
1137
|
-
if tab_widgets.empty?
|
|
1138
|
-
widget_body << "#{child_pad}tab_page #{tab_args.join(', ')}"
|
|
1139
|
-
else
|
|
1140
|
-
widget_body << "#{child_pad}tab_page #{tab_args.join(', ')} do"
|
|
1141
|
-
widget_body.concat(tab_widgets.flat_map { render_widget(_1, indent + 4) })
|
|
1142
|
-
widget_body << "#{child_pad}end"
|
|
1143
|
-
end
|
|
1144
|
-
end
|
|
1145
|
-
|
|
1146
|
-
if (sb = options[:search_bar])
|
|
1147
|
-
sb_lines = ["#{child_pad}search_bar do"]
|
|
1148
|
-
Array(sb[:fields]).each do |field|
|
|
1149
|
-
sf_args = [symbol(field[:attribute])]
|
|
1150
|
-
sf_args << "caption: #{ruby(field[:caption])}" if field[:caption]
|
|
1151
|
-
sb_lines << "#{child_pad} search_field #{sf_args.join(', ')}"
|
|
1152
|
-
end
|
|
1153
|
-
sb_lines << "#{child_pad}end"
|
|
1154
|
-
widget_body.concat(sb_lines)
|
|
1155
|
-
end
|
|
1008
|
+
# ── Microflow / nanoflow body export ─────────────────────────────────────
|
|
1156
1009
|
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
when :search then "search_button"
|
|
1164
|
-
when :export then "export_button"
|
|
1165
|
-
end
|
|
1166
|
-
next unless btn_method
|
|
1167
|
-
tb_arg = btn[:caption] ? "caption: #{ruby(btn[:caption])}" : nil
|
|
1168
|
-
tb_lines << "#{child_pad} #{btn_method}#{tb_arg ? "(#{tb_arg})" : ""}"
|
|
1169
|
-
end
|
|
1170
|
-
tb_lines << "#{child_pad}end"
|
|
1171
|
-
widget_body.concat(tb_lines)
|
|
1172
|
-
end
|
|
1010
|
+
def ruby_val(val)
|
|
1011
|
+
# Native expressions are source text, not Ruby literals to interpret.
|
|
1012
|
+
# Leading zeros, decimal precision and words such as "nil" are data.
|
|
1013
|
+
return ruby(val) if val.is_a?(String)
|
|
1014
|
+
return 'nil' if val.nil? || val.to_s.empty?
|
|
1015
|
+
return ruby(val) if val.is_a?(Hash) || val.is_a?(Array)
|
|
1173
1016
|
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
end
|
|
1017
|
+
s = val.to_s
|
|
1018
|
+
return s if s.match?(/\A-?\d+(?:\.\d+)?\z/) || %w[true false nil].include?(s)
|
|
1177
1019
|
|
|
1178
|
-
|
|
1179
|
-
["#{pad}#{type} #{args.join(', ')}"]
|
|
1180
|
-
else
|
|
1181
|
-
lines = ["#{pad}#{type} #{args.join(', ')} do"]
|
|
1182
|
-
lines.concat(widget_body)
|
|
1183
|
-
lines << "#{pad}end"
|
|
1184
|
-
end
|
|
1020
|
+
ruby(s)
|
|
1185
1021
|
end
|
|
1186
1022
|
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
local_flows = flows_for_objects(flows, objects)
|
|
1192
|
-
unless nested
|
|
1193
|
-
return false unless objects.count { _1["$Type"] == "Microflows$StartEvent" } == 1
|
|
1194
|
-
return false unless objects.any? { _1["$Type"] == "Microflows$EndEvent" }
|
|
1195
|
-
end
|
|
1196
|
-
connected_objects = objects.reject do |object|
|
|
1197
|
-
%w[Microflows$Annotation Microflows$MicroflowParameter].include?(object["$Type"])
|
|
1198
|
-
end
|
|
1199
|
-
return false if connected_objects.size > 1 && local_flows.empty?
|
|
1200
|
-
return false unless objects.all? { EDITABLE_FLOW_OBJECT_TYPES.include?(_1["$Type"]) }
|
|
1201
|
-
return false unless local_flows.all? do
|
|
1202
|
-
%w[Microflows$SequenceFlow Microflows$AnnotationFlow].include?(_1["$Type"])
|
|
1203
|
-
end
|
|
1204
|
-
sequence_flows = local_flows.select { _1["$Type"] == "Microflows$SequenceFlow" }
|
|
1205
|
-
return false if sequence_flows.select { _1["IsErrorHandler"] == true }
|
|
1206
|
-
.group_by { _1["OriginPointer"] }.any? { |_origin, items| items.size > 1 }
|
|
1207
|
-
|
|
1208
|
-
by_id = objects.to_h { [_1["$ID"], _1] }
|
|
1209
|
-
|
|
1210
|
-
objects.all? do |object|
|
|
1211
|
-
case object["$Type"]
|
|
1212
|
-
when "Microflows$ActionActivity"
|
|
1213
|
-
editable_action?(object["Action"] || {})
|
|
1214
|
-
when "Microflows$ExclusiveSplit"
|
|
1215
|
-
decision_shape_editable?(object, sequence_flows, by_id)
|
|
1216
|
-
when "Microflows$InheritanceSplit"
|
|
1217
|
-
branches = sequence_flows.select { _1["OriginPointer"] == object["$ID"] }
|
|
1218
|
-
!object["SplitVariableName"].to_s.empty? &&
|
|
1219
|
-
branches.size >= 2 &&
|
|
1220
|
-
branches.all? { by_id.key?(_1["DestinationPointer"]) }
|
|
1221
|
-
when "Microflows$LoopedActivity"
|
|
1222
|
-
collection = object["ObjectCollection"] || {}
|
|
1223
|
-
inner_objects = bson_items(collection["Objects"])
|
|
1224
|
-
source = loop_source(object)
|
|
1225
|
-
return false unless %w[
|
|
1226
|
-
Microflows$WhileLoopCondition Microflows$IterableList
|
|
1227
|
-
Microflows$IteratorList
|
|
1228
|
-
].include?(source["$Type"])
|
|
1229
|
-
editable_flow_body?(
|
|
1230
|
-
inner_objects, flows, nested: true
|
|
1231
|
-
)
|
|
1232
|
-
else
|
|
1233
|
-
true
|
|
1234
|
-
end
|
|
1235
|
-
end
|
|
1023
|
+
def bson_items(bson)
|
|
1024
|
+
IO::BsonCodec.parse_array(bson)[:items]
|
|
1025
|
+
rescue StandardError
|
|
1026
|
+
[]
|
|
1236
1027
|
end
|
|
1237
1028
|
|
|
1238
|
-
def
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
case action["$Type"]
|
|
1242
|
-
when "Microflows$ChangeObjectAction"
|
|
1243
|
-
action.fetch("Commit", "No") == "No" && action.fetch("RefreshInClient", false) == false
|
|
1244
|
-
when "Microflows$CreateChangeAction", "Microflows$ChangeAction"
|
|
1245
|
-
%w[No Yes YesWithoutEvents].include?(action.fetch("Commit", "No")) &&
|
|
1246
|
-
[true, false].include?(action.fetch("RefreshInClient", false))
|
|
1247
|
-
when "Microflows$RetrieveAction"
|
|
1248
|
-
source = action["RetrieveSource"] || {}
|
|
1249
|
-
case source["$Type"]
|
|
1250
|
-
when "Microflows$DatabaseRetrieveSource"
|
|
1251
|
-
range_type = source.dig("Range", "$Type")
|
|
1252
|
-
%w[Microflows$ConstantRange Microflows$CustomRange].include?(range_type) &&
|
|
1253
|
-
bson_items(source.dig("NewSortings", "Sortings") || source["SortItems"]).all? do |sorting|
|
|
1254
|
-
!(sorting["AttributePath"] || sorting.dig("AttributeRef", "Attribute")).to_s.empty?
|
|
1255
|
-
end
|
|
1256
|
-
when "Microflows$AssociationRetrieveSource"
|
|
1257
|
-
!source["AssociationId"].to_s.empty? && !source["StartVariableName"].to_s.empty?
|
|
1258
|
-
else
|
|
1259
|
-
false
|
|
1260
|
-
end
|
|
1261
|
-
when "Microflows$ShowMessageAction"
|
|
1262
|
-
bson_items(action.dig("Template", "Parameters")).all? { _1["Expression"] }
|
|
1263
|
-
when "Microflows$LogMessageAction"
|
|
1264
|
-
bson_items(action.dig("MessageTemplate", "Parameters")).all? { _1["Expression"] }
|
|
1265
|
-
when "Microflows$ShowFormAction"
|
|
1266
|
-
settings = action["FormSettings"] || {}
|
|
1267
|
-
title = settings["FormTitle"] || settings["TitleOverride"]
|
|
1268
|
-
title_supported = title.nil? ||
|
|
1269
|
-
(title.is_a?(Hash) && bson_items(title["Parameters"]).empty?)
|
|
1270
|
-
title_supported && bson_items(settings["ParameterMappings"]).all? do |mapping|
|
|
1271
|
-
mapping["Parameter"] && mapping["Argument"]
|
|
1272
|
-
end
|
|
1273
|
-
when "Microflows$JavaActionCallAction"
|
|
1274
|
-
!action["JavaAction"].to_s.empty? && bson_items(action["ParameterMappings"]).all? do |mapping|
|
|
1275
|
-
value = mapping["Value"] || {}
|
|
1276
|
-
mapping["Parameter"] && %w[
|
|
1277
|
-
Microflows$BasicJavaActionParameterValue
|
|
1278
|
-
Microflows$BasicCodeActionParameterValue
|
|
1279
|
-
Microflows$EntityTypeJavaActionParameterValue
|
|
1280
|
-
Microflows$MicroflowJavaActionParameterValue
|
|
1281
|
-
Microflows$ImportMappingJavaActionParameterValue
|
|
1282
|
-
Microflows$ExportMappingJavaActionParameterValue
|
|
1283
|
-
].include?(value["$Type"])
|
|
1284
|
-
end
|
|
1285
|
-
when "Microflows$JavaScriptActionCallAction"
|
|
1286
|
-
!action["JavaScriptAction"].to_s.empty? && bson_items(action["ParameterMappings"]).all? do |mapping|
|
|
1287
|
-
value = mapping["ParameterValue"] || {}
|
|
1288
|
-
mapping["Parameter"] && %w[
|
|
1289
|
-
Microflows$BasicCodeActionParameterValue
|
|
1290
|
-
Microflows$EntityTypeCodeActionParameterValue
|
|
1291
|
-
].include?(value["$Type"])
|
|
1292
|
-
end
|
|
1293
|
-
when "Microflows$NanoflowCallAction"
|
|
1294
|
-
!action.dig("NanoflowCall", "Nanoflow").to_s.empty? &&
|
|
1295
|
-
bson_items(action.dig("NanoflowCall", "ParameterMappings")).all? do |mapping|
|
|
1296
|
-
mapping["Parameter"] && mapping["Argument"]
|
|
1297
|
-
end
|
|
1298
|
-
when "Microflows$AppServiceCallAction"
|
|
1299
|
-
!action["AppServiceAction"].to_s.empty? && bson_items(action["ParameterMappings"]).all? do |mapping|
|
|
1300
|
-
mapping["Parameter"] && mapping["Argument"]
|
|
1301
|
-
end
|
|
1302
|
-
when "Microflows$ValidationFeedbackAction"
|
|
1303
|
-
bson_items(action.dig("FeedbackTemplate", "Parameters")).all? do |parameter|
|
|
1304
|
-
parameter["Expression"]
|
|
1305
|
-
end
|
|
1306
|
-
when "Microflows$RestCallAction"
|
|
1307
|
-
http = action["HttpConfiguration"] || {}
|
|
1308
|
-
request = action["RequestHandling"] || {}
|
|
1309
|
-
!http["HttpMethod"].to_s.empty? &&
|
|
1310
|
-
bson_items(http["HttpHeaderEntries"]).all? { _1["Key"] && _1["Value"] } &&
|
|
1311
|
-
bson_items(http.dig("CustomLocationTemplate", "Parameters")).all? {
|
|
1312
|
-
_1["Expression"]
|
|
1313
|
-
} &&
|
|
1314
|
-
request["$Type"] == "Microflows$MappingRequestHandling"
|
|
1315
|
-
else
|
|
1316
|
-
true
|
|
1317
|
-
end
|
|
1029
|
+
def ruby(value)
|
|
1030
|
+
value.inspect
|
|
1318
1031
|
end
|
|
1319
1032
|
|
|
1320
|
-
def
|
|
1321
|
-
|
|
1322
|
-
condition_supported = !condition["Expression"].to_s.empty? ||
|
|
1323
|
-
(condition["$Type"] == "Microflows$RuleSplitCondition" &&
|
|
1324
|
-
!condition.dig("RuleCall", "Microflow").to_s.empty? &&
|
|
1325
|
-
bson_items(condition.dig("RuleCall", "ParameterMappings")).all? {
|
|
1326
|
-
_1["Parameter"] && _1["Argument"]
|
|
1327
|
-
})
|
|
1328
|
-
return false unless condition_supported
|
|
1329
|
-
|
|
1330
|
-
branches = flows.reject { _1["IsErrorHandler"] == true }
|
|
1331
|
-
.select { _1["OriginPointer"] == object["$ID"] }
|
|
1332
|
-
branches.size >= 2 && branches.all? { by_id.key?(_1["DestinationPointer"]) }
|
|
1333
|
-
end
|
|
1334
|
-
|
|
1335
|
-
def body_dsl_lines(objects, flows, indent = 2, nested: false)
|
|
1336
|
-
return [] if objects.empty?
|
|
1337
|
-
by_id = objects.to_h { |o| [o["$ID"], o] }
|
|
1338
|
-
fwd_map = {}
|
|
1339
|
-
err_map = {}
|
|
1340
|
-
flows.each do |f|
|
|
1341
|
-
next unless f["$Type"] == "Microflows$SequenceFlow"
|
|
1342
|
-
|
|
1343
|
-
from = f["OriginPointer"]
|
|
1344
|
-
to = f["DestinationPointer"]
|
|
1345
|
-
case_val = flow_case_value(f)
|
|
1346
|
-
if f["IsErrorHandler"] == true
|
|
1347
|
-
err_map[from] = to
|
|
1348
|
-
else
|
|
1349
|
-
fwd_map[from] ||= []
|
|
1350
|
-
fwd_map[from] << { to: to, case_val: case_val }
|
|
1351
|
-
end
|
|
1352
|
-
end
|
|
1353
|
-
start = objects.find { |o| o["$Type"] == "Microflows$StartEvent" }
|
|
1354
|
-
if nested && !start
|
|
1355
|
-
destinations = flows.to_h { [_1["DestinationPointer"], true] }
|
|
1356
|
-
start = objects.find { !destinations.key?(_1["$ID"]) }
|
|
1357
|
-
end
|
|
1358
|
-
return [] unless start
|
|
1359
|
-
lines = []
|
|
1360
|
-
linearize_flow(start["$ID"], fwd_map, err_map, by_id, flows, {}, lines, indent, nil)
|
|
1361
|
-
lines
|
|
1033
|
+
def architecture_module(name)
|
|
1034
|
+
@architecture&.fetch(:modules, [])&.find { _1[:name] == name }
|
|
1362
1035
|
end
|
|
1363
1036
|
|
|
1364
|
-
def
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
end
|
|
1372
|
-
|
|
1373
|
-
def linearize_flow(cursor, fwd, err, by_id, graph_flows, seen, lines, indent, stop_at)
|
|
1374
|
-
while cursor && cursor != stop_at
|
|
1375
|
-
break if seen[cursor]
|
|
1376
|
-
seen[cursor] = true
|
|
1377
|
-
obj = by_id[cursor]
|
|
1378
|
-
break unless obj
|
|
1379
|
-
|
|
1380
|
-
case obj["$Type"]
|
|
1381
|
-
when "Microflows$StartEvent"
|
|
1382
|
-
cursor = (fwd[cursor] || []).first&.dig(:to)
|
|
1383
|
-
|
|
1384
|
-
when "Microflows$ActionActivity"
|
|
1385
|
-
line = action_dsl_line(obj, indent)
|
|
1386
|
-
lines << line if line
|
|
1387
|
-
next_id = (fwd[cursor] || []).first&.dig(:to)
|
|
1388
|
-
error_to = err[cursor]
|
|
1389
|
-
if error_to
|
|
1390
|
-
rescue_lines = []
|
|
1391
|
-
linearize_flow(
|
|
1392
|
-
error_to, fwd, err, by_id, graph_flows,
|
|
1393
|
-
seen.dup, rescue_lines, indent + 2, nil
|
|
1394
|
-
)
|
|
1395
|
-
lines << "#{' ' * indent}rescue_all do"
|
|
1396
|
-
lines.concat(rescue_lines)
|
|
1397
|
-
lines << "#{' ' * indent}end"
|
|
1398
|
-
end
|
|
1399
|
-
cursor = next_id
|
|
1400
|
-
|
|
1401
|
-
when "Microflows$ExclusiveSplit"
|
|
1402
|
-
condition_doc = obj["SplitCondition"] || {}
|
|
1403
|
-
condition = if condition_doc["$Type"] == "Microflows$RuleSplitCondition"
|
|
1404
|
-
rule = condition_doc["RuleCall"] || {}
|
|
1405
|
-
mappings = bson_items(rule["ParameterMappings"]).to_h do |mapping|
|
|
1406
|
-
[mapping["Parameter"].to_s, mapping["Argument"].to_s]
|
|
1407
|
-
end
|
|
1408
|
-
{ rule: rule["Microflow"], pass: mappings }
|
|
1409
|
-
else
|
|
1410
|
-
condition_doc["Expression"].to_s
|
|
1411
|
-
end
|
|
1412
|
-
nexts = fwd[cursor] || []
|
|
1413
|
-
merge_id = find_common_merge_node(nexts.map { _1[:to] }, fwd, by_id)
|
|
1414
|
-
rendered_condition = condition.is_a?(Hash) ?
|
|
1415
|
-
"(#{ruby(condition)})" : ruby(condition)
|
|
1416
|
-
lines << "#{' ' * indent}decision #{rendered_condition} do"
|
|
1417
|
-
nexts.each do |edge|
|
|
1418
|
-
branch_lines = []
|
|
1419
|
-
linearize_flow(
|
|
1420
|
-
edge[:to], fwd, err, by_id, graph_flows, seen.dup,
|
|
1421
|
-
branch_lines, indent + 4, merge_id
|
|
1422
|
-
)
|
|
1423
|
-
lines << "#{' ' * (indent + 2)}on(#{ruby(edge[:case_val])}) do"
|
|
1424
|
-
lines.concat(branch_lines)
|
|
1425
|
-
lines << "#{' ' * (indent + 2)}end"
|
|
1037
|
+
def infer_public_artifacts(modules)
|
|
1038
|
+
modules.each_with_object({}) do |mod, public_artifacts|
|
|
1039
|
+
mod.pages.each do |page|
|
|
1040
|
+
infer_public_reference(public_artifacts, mod.name, page.data_source)
|
|
1041
|
+
each_page_widget(page.widgets) do |widget|
|
|
1042
|
+
infer_public_reference(public_artifacts, mod.name, widget.dig(:options, :source)) if
|
|
1043
|
+
widget[:type].to_sym == :data_view
|
|
1426
1044
|
end
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
cursor = (fwd[cursor] || []).first&.dig(:to)
|
|
1432
|
-
|
|
1433
|
-
when "Microflows$InheritanceSplit"
|
|
1434
|
-
nexts = fwd[cursor] || []
|
|
1435
|
-
merge_id = find_common_merge_node(nexts.map { _1[:to] }, fwd, by_id)
|
|
1436
|
-
lines << "#{' ' * indent}type_decision :#{obj["SplitVariableName"]} do"
|
|
1437
|
-
nexts.each do |edge|
|
|
1438
|
-
branch_lines = []
|
|
1439
|
-
linearize_flow(
|
|
1440
|
-
edge[:to], fwd, err, by_id, graph_flows, seen.dup,
|
|
1441
|
-
branch_lines, indent + 4, merge_id
|
|
1045
|
+
each_widget_event(page.widgets) do |event|
|
|
1046
|
+
infer_public_reference(
|
|
1047
|
+
public_artifacts, mod.name,
|
|
1048
|
+
{ kind: event.fetch(:kind), name: event.fetch(:handler) }
|
|
1442
1049
|
)
|
|
1443
|
-
if edge[:case_val].to_s.empty?
|
|
1444
|
-
lines << "#{' ' * (indent + 2)}otherwise do"
|
|
1445
|
-
else
|
|
1446
|
-
lines << "#{' ' * (indent + 2)}on_type #{ruby(edge[:case_val])} do"
|
|
1447
|
-
end
|
|
1448
|
-
lines.concat(branch_lines)
|
|
1449
|
-
lines << "#{' ' * (indent + 2)}end"
|
|
1450
1050
|
end
|
|
1451
|
-
lines << "#{' ' * indent}end"
|
|
1452
|
-
cursor = merge_id
|
|
1453
|
-
|
|
1454
|
-
when "Microflows$LoopedActivity"
|
|
1455
|
-
loop_src = loop_source(obj)
|
|
1456
|
-
variable = (loop_src["ListVariableName"] || loop_src["Variable"]).to_s
|
|
1457
|
-
iterator = (loop_src["VariableName"] || loop_src["IteratorVariable"]).to_s
|
|
1458
|
-
inner_col = obj["ObjectCollection"] || {}
|
|
1459
|
-
inner_objects = bson_items(inner_col["Objects"])
|
|
1460
|
-
inner_lines = body_dsl_lines(
|
|
1461
|
-
inner_objects,
|
|
1462
|
-
graph_flows,
|
|
1463
|
-
indent + 2,
|
|
1464
|
-
nested: true
|
|
1465
|
-
)
|
|
1466
|
-
if loop_src["$Type"] == "Microflows$WhileLoopCondition"
|
|
1467
|
-
lines << "#{' ' * indent}while_loop #{ruby(loop_src["WhileExpression"])} do"
|
|
1468
|
-
else
|
|
1469
|
-
as_clause = (iterator != variable && !iterator.empty?) ? ", as: :#{iterator}" : ""
|
|
1470
|
-
lines << "#{' ' * indent}loop_over :#{variable}#{as_clause} do"
|
|
1471
|
-
end
|
|
1472
|
-
lines.concat(inner_lines)
|
|
1473
|
-
lines << "#{' ' * indent}end"
|
|
1474
|
-
cursor = (fwd[cursor] || []).first&.dig(:to)
|
|
1475
|
-
|
|
1476
|
-
when "Microflows$EndEvent"
|
|
1477
|
-
ret = obj["ReturnValue"].to_s.strip
|
|
1478
|
-
unless ret.empty?
|
|
1479
|
-
if (match = ret.match(/\A\$([A-Za-z_][A-Za-z0-9_]*)\z/))
|
|
1480
|
-
lines << "#{' ' * indent}return_value :#{match[1]}"
|
|
1481
|
-
else
|
|
1482
|
-
lines << "#{' ' * indent}return_value #{ruby(ret)}"
|
|
1483
|
-
end
|
|
1484
|
-
else
|
|
1485
|
-
lines << "#{' ' * indent}end_flow" if indent > 2
|
|
1486
|
-
end
|
|
1487
|
-
break
|
|
1488
|
-
|
|
1489
|
-
when "Microflows$ErrorEvent"
|
|
1490
|
-
lines << "#{' ' * indent}error_event"
|
|
1491
|
-
break
|
|
1492
|
-
|
|
1493
|
-
when "Microflows$ContinueEvent"
|
|
1494
|
-
lines << "#{' ' * indent}continue_loop"
|
|
1495
|
-
break
|
|
1496
|
-
|
|
1497
|
-
else
|
|
1498
|
-
cursor = (fwd[cursor] || []).first&.dig(:to)
|
|
1499
|
-
end
|
|
1500
|
-
end
|
|
1501
|
-
end
|
|
1502
|
-
|
|
1503
|
-
def flows_for_objects(flows, objects)
|
|
1504
|
-
ids = objects.to_h { [_1["$ID"], true] }
|
|
1505
|
-
flows.select do |flow|
|
|
1506
|
-
ids.key?(flow["OriginPointer"]) && ids.key?(flow["DestinationPointer"])
|
|
1507
|
-
end
|
|
1508
|
-
end
|
|
1509
|
-
|
|
1510
|
-
def loop_source(object)
|
|
1511
|
-
object["LoopSource"] || object["LoopObject"] || begin
|
|
1512
|
-
if object["ListVariableName"] || object["IteratorVariableName"]
|
|
1513
|
-
{
|
|
1514
|
-
"$Type" => "Microflows$IterableList",
|
|
1515
|
-
"ListVariableName" => object["ListVariableName"],
|
|
1516
|
-
"VariableName" => object["IteratorVariableName"]
|
|
1517
|
-
}
|
|
1518
|
-
else
|
|
1519
|
-
{}
|
|
1520
1051
|
end
|
|
1521
1052
|
end
|
|
1522
1053
|
end
|
|
1523
1054
|
|
|
1524
|
-
def
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
def find_common_merge_node(starts, fwd, by_id)
|
|
1531
|
-
sets = starts.compact.map { reachable_merge_ids(_1, fwd, by_id) }
|
|
1532
|
-
return nil if sets.empty?
|
|
1533
|
-
|
|
1534
|
-
sets.reduce { |common, ids| common & ids }.first
|
|
1535
|
-
end
|
|
1536
|
-
|
|
1537
|
-
def reachable_merge_ids(start_id, fwd, by_id)
|
|
1538
|
-
result = []
|
|
1539
|
-
visited = {}
|
|
1540
|
-
queue = [start_id].compact
|
|
1541
|
-
while (id = queue.shift)
|
|
1542
|
-
next if visited[id]
|
|
1543
|
-
visited[id] = true
|
|
1544
|
-
obj = by_id[id]
|
|
1545
|
-
next unless obj
|
|
1546
|
-
result << id if obj["$Type"] == "Microflows$ExclusiveMerge"
|
|
1547
|
-
(fwd[id] || []).each { |e| queue << e[:to] }
|
|
1548
|
-
end
|
|
1549
|
-
result
|
|
1550
|
-
end
|
|
1551
|
-
|
|
1552
|
-
def action_dsl_line(obj, indent)
|
|
1553
|
-
action = obj["Action"] || {}
|
|
1554
|
-
pad = " " * indent
|
|
1555
|
-
case action["$Type"]
|
|
1556
|
-
when "Microflows$CreateObjectAction", "Microflows$CreateChangeAction"
|
|
1557
|
-
legacy = action["$Type"] == "Microflows$CreateChangeAction"
|
|
1558
|
-
members = member_specs(action[legacy ? "Items" : "Members"])
|
|
1559
|
-
has_associations = members.any? { !_1[:association].to_s.empty? }
|
|
1560
|
-
set_arg = members.empty? || has_associations ?
|
|
1561
|
-
"" : ", set: { #{members_dsl(members)} }"
|
|
1562
|
-
variable = legacy ? action["VariableName"] : action["OutputVariableName"]
|
|
1563
|
-
commit_a = action["Commit"] == "Yes" ? ", commit: true" : ""
|
|
1564
|
-
commit_a = ", commit: true, with_events: false" if action["Commit"] == "YesWithoutEvents"
|
|
1565
|
-
refresh_a = action["RefreshInClient"] == true ? ", refresh: true" : ""
|
|
1566
|
-
command = "#{pad}create_object #{ruby(action["Entity"])}, as: :#{variable}#{set_arg}#{commit_a}#{refresh_a}"
|
|
1567
|
-
has_associations ? member_block(command, members, indent) : command
|
|
1568
|
-
when "Microflows$ChangeObjectAction", "Microflows$ChangeAction"
|
|
1569
|
-
legacy = action["$Type"] == "Microflows$ChangeAction"
|
|
1570
|
-
members = member_specs(action[legacy ? "Items" : "Members"])
|
|
1571
|
-
variable = legacy ? action["ChangeVariableName"] : action["Variable"]
|
|
1572
|
-
commit_a = action["Commit"] == "Yes" ? ", commit: true" : ""
|
|
1573
|
-
commit_a = ", commit: true, with_events: false" if action["Commit"] == "YesWithoutEvents"
|
|
1574
|
-
refresh_a = action["RefreshInClient"] == true ? ", refresh: true" : ""
|
|
1575
|
-
has_associations = members.any? { !_1[:association].to_s.empty? }
|
|
1576
|
-
set_arg = members.empty? || has_associations ?
|
|
1577
|
-
"" : ", set: { #{members_dsl(members)} }"
|
|
1578
|
-
command = "#{pad}change_object :#{variable}#{set_arg}#{commit_a}#{refresh_a}"
|
|
1579
|
-
has_associations ? member_block(command, members, indent) : command
|
|
1580
|
-
when "Microflows$RetrieveAction"
|
|
1581
|
-
src = action["RetrieveSource"] || {}
|
|
1582
|
-
variable = action["ResultVariableName"] || action["ResultListName"]
|
|
1583
|
-
if src["$Type"] == "Microflows$AssociationRetrieveSource"
|
|
1584
|
-
"#{pad}retrieve_association :#{src["StartVariableName"]}, " \
|
|
1585
|
-
"association: #{ruby(src["AssociationId"])}, as: :#{variable}"
|
|
1586
|
-
else
|
|
1587
|
-
xpath = (src["XpathConstraint"] || src["XPath"]).to_s
|
|
1588
|
-
args = [ruby(src["Entity"]), "as: :#{variable}"]
|
|
1589
|
-
args << "xpath: #{ruby(xpath)}" unless xpath.empty?
|
|
1590
|
-
range = src["Range"] || {}
|
|
1591
|
-
if range["$Type"] == "Microflows$CustomRange"
|
|
1592
|
-
limit = range["LimitExpression"].to_s
|
|
1593
|
-
args << "limit: #{ruby(limit)}" unless limit.empty?
|
|
1594
|
-
elsif range["SingleObject"] == true
|
|
1595
|
-
args << "single: true"
|
|
1596
|
-
end
|
|
1597
|
-
sortings = bson_items(src.dig("NewSortings", "Sortings") || src["SortItems"])
|
|
1598
|
-
unless sortings.empty?
|
|
1599
|
-
rendered = sortings.map do |sorting|
|
|
1600
|
-
attribute = sorting["AttributePath"] ||
|
|
1601
|
-
sorting.dig("AttributeRef", "Attribute")
|
|
1602
|
-
"[#{ruby(attribute)}, :#{underscore(sorting["SortOrder"])}]"
|
|
1603
|
-
end
|
|
1604
|
-
args << "sort: [#{rendered.join(', ')}]"
|
|
1605
|
-
end
|
|
1606
|
-
"#{pad}retrieve_objects #{args.join(', ')}"
|
|
1055
|
+
def each_widget_event(widgets, &block)
|
|
1056
|
+
Array(widgets).each do |widget|
|
|
1057
|
+
Array(widget[:events]).each(&block)
|
|
1058
|
+
each_widget_event(direct_widget_children(widget), &block)
|
|
1059
|
+
Array(widget.dig(:options, :tabs)).each do |tab|
|
|
1060
|
+
each_widget_event(tab[:widgets], &block)
|
|
1607
1061
|
end
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
with_events = legacy ? action.fetch("WithEvents", true) : action["CommitWithoutEvents"] != true
|
|
1612
|
-
events_a = with_events ? "" : ", with_events: false"
|
|
1613
|
-
refresh_a = action["RefreshInClient"] == true ? ", refresh: true" : ""
|
|
1614
|
-
"#{pad}commit :#{variable}#{events_a}#{refresh_a}"
|
|
1615
|
-
when "Microflows$DeleteAction"
|
|
1616
|
-
variable = action["DeleteVariableName"] || action["DeleteVariable"]
|
|
1617
|
-
refresh_a = action["RefreshInClient"] == true ? ", refresh: true" : ""
|
|
1618
|
-
"#{pad}delete :#{variable}#{refresh_a}"
|
|
1619
|
-
when "Microflows$MicroflowCallAction"
|
|
1620
|
-
call = action["MicroflowCall"] || {}
|
|
1621
|
-
out = if action["UseReturnVariable"] == true
|
|
1622
|
-
(action["ResultVariableName"] || action["OutputVariableName"]).to_s
|
|
1623
|
-
else
|
|
1624
|
-
""
|
|
1625
|
-
end
|
|
1626
|
-
as_a = out.empty? ? "" : ", as: :#{out}"
|
|
1627
|
-
stored_result = (action["ResultVariableName"] || action["OutputVariableName"]).to_s
|
|
1628
|
-
result_a = if out.empty? && !stored_result.empty?
|
|
1629
|
-
", result_name: #{symbol(stored_result)}, use_return: false"
|
|
1630
|
-
elsif action["UseReturnVariable"] == true && out.empty?
|
|
1631
|
-
", use_return: true"
|
|
1632
|
-
else
|
|
1633
|
-
""
|
|
1062
|
+
Array(widget.dig(:options, :rows)).each do |row|
|
|
1063
|
+
Array(row[:columns]).each { each_widget_event(_1[:widgets], &block) }
|
|
1064
|
+
Array(row[:cells]).each { each_widget_event(_1[:widgets], &block) }
|
|
1634
1065
|
end
|
|
1635
|
-
params = bson_items(call["ParameterMappings"]).map { [_1["Parameter"], _1["Argument"]] }
|
|
1636
|
-
pass_a = params.empty? ? "" : ", pass: #{pass_source(params)}"
|
|
1637
|
-
"#{pad}call_microflow #{ruby(call["Microflow"])}#{as_a}#{pass_a}#{result_a}"
|
|
1638
|
-
when "Microflows$CreateVariableAction"
|
|
1639
|
-
type = action.dig("VariableType", "$Type").to_s
|
|
1640
|
-
type = type.delete_prefix("DataTypes$").delete_suffix("Type")
|
|
1641
|
-
value = action["InitialValue"]
|
|
1642
|
-
value_a = value.nil? || value.to_s.empty? ? "" : ", value: #{ruby_val(value)}"
|
|
1643
|
-
type_a = type.empty? ? "" : ", type: #{symbol(type)}"
|
|
1644
|
-
"#{pad}create_variable :#{action["VariableName"]}#{type_a}#{value_a}"
|
|
1645
|
-
when "Microflows$ChangeVariableAction"
|
|
1646
|
-
"#{pad}change_variable :#{action["ChangeVariableName"]}, to: #{ruby_val(action["Value"])}"
|
|
1647
|
-
when "Microflows$ShowMessageAction"
|
|
1648
|
-
template = action["Template"] || {}
|
|
1649
|
-
translations = translated_items(template["Text"]).to_h do |translation|
|
|
1650
|
-
[translation["LanguageCode"].to_s, translation["Text"].to_s]
|
|
1651
|
-
end
|
|
1652
|
-
parameters = bson_items(template["Parameters"]).map { _1["Expression"] }
|
|
1653
|
-
text = translations["en_US"] || translations.values.first.to_s
|
|
1654
|
-
type_a = action["Type"].to_s.empty? ? "" : ", type: :#{underscore(action["Type"])}"
|
|
1655
|
-
blocking_a = action["Blocking"] == true ? ", blocking: true" : ""
|
|
1656
|
-
translations_a = translations.size > 1 ? ", translations: #{ruby(translations)}" : ""
|
|
1657
|
-
parameters_a = parameters.empty? ? "" : ", parameters: #{ruby(parameters)}"
|
|
1658
|
-
"#{pad}show_message #{ruby(text)}#{type_a}#{blocking_a}#{translations_a}#{parameters_a}"
|
|
1659
|
-
when "Microflows$LogMessageAction"
|
|
1660
|
-
template = action["MessageTemplate"] || {}
|
|
1661
|
-
parameters = bson_items(template["Parameters"]).map { _1["Expression"] }
|
|
1662
|
-
level_a = action["Level"].to_s.empty? ? "" : ", level: :#{underscore(action["Level"])}"
|
|
1663
|
-
node_a = action["Node"].to_s.empty? ? "" : ", node: #{ruby(action["Node"])}"
|
|
1664
|
-
stack_a = action["IncludeLatestStackTrace"] == true ? ", include_stack: true" : ""
|
|
1665
|
-
parameters_a = parameters.empty? ? "" : ", parameters: #{ruby(parameters)}"
|
|
1666
|
-
"#{pad}log_message #{ruby(template["Text"].to_s)}#{level_a}#{node_a}#{stack_a}#{parameters_a}"
|
|
1667
|
-
when "Microflows$ShowFormAction"
|
|
1668
|
-
settings = action["FormSettings"] || {}
|
|
1669
|
-
args = [ruby(settings["Form"])]
|
|
1670
|
-
variable = action["FormObjectVariable"].to_s
|
|
1671
|
-
args << "object: :#{variable}" unless variable.empty?
|
|
1672
|
-
location = settings["Location"].to_s
|
|
1673
|
-
args << "location: :#{underscore(location)}" unless location.empty?
|
|
1674
|
-
mappings = bson_items(settings["ParameterMappings"]).map do |mapping|
|
|
1675
|
-
"#{ruby(mapping["Parameter"])} => #{ruby_val(mapping["Argument"])}"
|
|
1676
|
-
end
|
|
1677
|
-
args << "pass: { #{mappings.join(', ')} }" unless mappings.empty?
|
|
1678
|
-
close_pages = action["NumberOfPagesToClose"].to_s
|
|
1679
|
-
args << "close_pages: #{close_pages.to_i}" unless close_pages.empty?
|
|
1680
|
-
title = settings["FormTitle"] || settings["TitleOverride"]
|
|
1681
|
-
translations = translated_items(title&.fetch("Text", title)).to_h do |translation|
|
|
1682
|
-
[translation["LanguageCode"].to_s, translation["Text"].to_s]
|
|
1683
|
-
end
|
|
1684
|
-
args << "title: #{ruby(translations)}" unless translations.empty?
|
|
1685
|
-
"#{pad}show_page #{args.join(', ')}"
|
|
1686
|
-
when "Microflows$CloseFormAction"
|
|
1687
|
-
count = action["NumberOfPagesToClose"].to_s
|
|
1688
|
-
count.empty? ? "#{pad}close_page" : "#{pad}close_page count: #{count.to_i}"
|
|
1689
|
-
when "Microflows$JavaActionCallAction"
|
|
1690
|
-
call_action_line(
|
|
1691
|
-
pad, "call_java", action["JavaAction"], action["ResultVariableName"],
|
|
1692
|
-
bson_items(action["ParameterMappings"]).map {
|
|
1693
|
-
[_1["Parameter"], code_action_parameter_value(_1["Value"])]
|
|
1694
|
-
},
|
|
1695
|
-
action["UseReturnVariable"]
|
|
1696
|
-
)
|
|
1697
|
-
when "Microflows$JavaScriptActionCallAction"
|
|
1698
|
-
call_action_line(
|
|
1699
|
-
pad, "call_javascript", action["JavaScriptAction"], action["OutputVariableName"],
|
|
1700
|
-
bson_items(action["ParameterMappings"]).map {
|
|
1701
|
-
[_1["Parameter"], code_action_parameter_value(_1["ParameterValue"])]
|
|
1702
|
-
},
|
|
1703
|
-
action["UseReturnVariable"]
|
|
1704
|
-
)
|
|
1705
|
-
when "Microflows$NanoflowCallAction"
|
|
1706
|
-
call = action["NanoflowCall"] || {}
|
|
1707
|
-
call_action_line(
|
|
1708
|
-
pad, "call_nanoflow", call["Nanoflow"], action["OutputVariableName"],
|
|
1709
|
-
bson_items(call["ParameterMappings"]).map { [_1["Parameter"], _1["Argument"]] },
|
|
1710
|
-
action["UseReturnVariable"]
|
|
1711
|
-
)
|
|
1712
|
-
when "Microflows$AppServiceCallAction"
|
|
1713
|
-
call_action_line(
|
|
1714
|
-
pad, "call_app_service", action["AppServiceAction"], action["ResultVariableName"],
|
|
1715
|
-
bson_items(action["ParameterMappings"]).map { [_1["Parameter"], _1["Argument"]] },
|
|
1716
|
-
action["UseReturnVariable"]
|
|
1717
|
-
)
|
|
1718
|
-
when "Microflows$AggregateAction"
|
|
1719
|
-
args = [
|
|
1720
|
-
":#{action["AggregateVariableName"]}",
|
|
1721
|
-
"function: :#{underscore(action["AggregateFunction"])}",
|
|
1722
|
-
"as: :#{action["VariableName"]}"
|
|
1723
|
-
]
|
|
1724
|
-
args << "attribute: #{ruby(action["Attribute"])}" unless action["Attribute"].to_s.empty?
|
|
1725
|
-
"#{pad}aggregate #{args.join(', ')}"
|
|
1726
|
-
when "Microflows$RollbackAction"
|
|
1727
|
-
refresh = action["RefreshInClient"] == true ? ", refresh: true" : ""
|
|
1728
|
-
"#{pad}rollback :#{action["RollbackVariableName"]}#{refresh}"
|
|
1729
|
-
when "Microflows$CastAction"
|
|
1730
|
-
"#{pad}cast :#{action["VariableName"]}"
|
|
1731
|
-
when "Microflows$CreateListAction"
|
|
1732
|
-
"#{pad}create_list #{ruby(action["Entity"])}, as: :#{action["VariableName"]}"
|
|
1733
|
-
when "Microflows$ListOperationsAction"
|
|
1734
|
-
operation = action["NewOperation"] || {}
|
|
1735
|
-
op = operation["$Type"].to_s.delete_prefix("Microflows$")
|
|
1736
|
-
args = [":#{underscore(op)}", ":#{operation['ListName']}"]
|
|
1737
|
-
second = operation["SecondListOrObjectName"].to_s
|
|
1738
|
-
expression = operation["Expression"]
|
|
1739
|
-
args << "with: :#{second}" unless second.empty?
|
|
1740
|
-
args << "expression: #{ruby(expression)}" unless expression.nil?
|
|
1741
|
-
args << "as: :#{action['ResultVariableName']}"
|
|
1742
|
-
"#{pad}list_operation #{args.join(', ')}"
|
|
1743
|
-
when "Microflows$ChangeListAction"
|
|
1744
|
-
"#{pad}change_list :#{action["ChangeVariableName"]}, " \
|
|
1745
|
-
"action: :#{underscore(action["Type"])}, value: #{ruby_val(action["Value"])}"
|
|
1746
|
-
when "Microflows$ValidationFeedbackAction"
|
|
1747
|
-
template = action["FeedbackTemplate"] || {}
|
|
1748
|
-
translations = translated_items(template["Text"]).to_h do |translation|
|
|
1749
|
-
[translation["LanguageCode"].to_s, translation["Text"].to_s]
|
|
1750
|
-
end
|
|
1751
|
-
parameters = bson_items(template["Parameters"]).map { _1["Expression"] }
|
|
1752
|
-
args = [":#{action["ValidationVariableName"]}"]
|
|
1753
|
-
args << "attribute: #{ruby(action["Attribute"])}" unless action["Attribute"].to_s.empty?
|
|
1754
|
-
args << "association: #{ruby(action["Association"])}" unless action["Association"].to_s.empty?
|
|
1755
|
-
args << "translations: #{ruby(translations)}"
|
|
1756
|
-
args << "parameters: #{ruby(parameters)}" unless parameters.empty?
|
|
1757
|
-
error = underscore(action["ErrorHandlingType"])
|
|
1758
|
-
args << "error: :#{error}" unless error == "rollback"
|
|
1759
|
-
"#{pad}validation_feedback #{args.join(', ')}"
|
|
1760
|
-
when "Microflows$RestCallAction"
|
|
1761
|
-
rest_call_line(pad, action)
|
|
1762
1066
|
end
|
|
1763
1067
|
end
|
|
1764
1068
|
|
|
1765
|
-
def
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
import_call = result["ImportMappingCall"] || {}
|
|
1774
|
-
args = [
|
|
1775
|
-
"method: :#{underscore(http["HttpMethod"])}",
|
|
1776
|
-
"location: #{ruby(location["Text"].to_s)}"
|
|
1777
|
-
]
|
|
1778
|
-
parameters = bson_items(location["Parameters"]).map { _1["Expression"] }
|
|
1779
|
-
args << "location_parameters: #{ruby(parameters)}" unless parameters.empty?
|
|
1780
|
-
args << "headers: #{ruby(headers)}" unless headers.empty?
|
|
1781
|
-
args << "request_mapping: #{ruby(request["MappingId"])}" if request["MappingId"]
|
|
1782
|
-
args << "request_variable: :#{request["MappingVariableName"]}" if request["MappingVariableName"]
|
|
1783
|
-
args << "result_mapping: #{ruby(import_call["ReturnValueMapping"])}" if import_call["ReturnValueMapping"]
|
|
1784
|
-
args << "as: :#{result["ResultVariableName"]}" unless result["ResultVariableName"].to_s.empty?
|
|
1785
|
-
args << "result_entity: #{ruby(result.dig("VariableType", "Entity"))}" if result.dig("VariableType", "Entity")
|
|
1786
|
-
args << "timeout: #{ruby(action["TimeOutExpression"])}" if action["UseRequestTimeOut"] == true
|
|
1787
|
-
args << "commit: :#{underscore(import_call["Commit"])}" unless import_call["Commit"].to_s.empty?
|
|
1788
|
-
args << "error_result: :#{underscore(action["ErrorResultHandlingType"])}"
|
|
1789
|
-
args << "error: :#{underscore(action["ErrorHandlingType"])}"
|
|
1790
|
-
"#{pad}call_rest #{args.join(', ')}"
|
|
1791
|
-
end
|
|
1792
|
-
|
|
1793
|
-
def call_action_line(pad, method, target, output, mappings, use_return)
|
|
1794
|
-
args = [ruby(target)]
|
|
1795
|
-
if use_return == true && !output.to_s.empty?
|
|
1796
|
-
args << "as: :#{output}"
|
|
1797
|
-
elsif !output.to_s.empty?
|
|
1798
|
-
args << "result_name: #{symbol(output)}"
|
|
1799
|
-
args << "use_return: false"
|
|
1800
|
-
elsif use_return == true
|
|
1801
|
-
args << "use_return: true"
|
|
1802
|
-
end
|
|
1803
|
-
unless mappings.empty?
|
|
1804
|
-
args << "pass: #{pass_source(mappings)}"
|
|
1805
|
-
end
|
|
1806
|
-
"#{pad}#{method} #{args.join(', ')}"
|
|
1807
|
-
end
|
|
1808
|
-
|
|
1809
|
-
def pass_source(mappings)
|
|
1810
|
-
duplicate = mappings.map { _1.first.to_s }.tally.values.any? { _1 > 1 }
|
|
1811
|
-
rendered = mappings.map do |parameter, value|
|
|
1812
|
-
key = ruby(parameter)
|
|
1813
|
-
val = ruby_val(value)
|
|
1814
|
-
duplicate ? "[#{key}, #{val}]" : "#{key} => #{val}"
|
|
1815
|
-
end
|
|
1816
|
-
duplicate ? "[#{rendered.join(', ')}]" : "{ #{rendered.join(', ')} }"
|
|
1817
|
-
end
|
|
1818
|
-
|
|
1819
|
-
def code_action_parameter_value(value)
|
|
1820
|
-
value ||= {}
|
|
1821
|
-
type = value["$Type"].to_s
|
|
1822
|
-
return value["Argument"] if type.include?("$Basic")
|
|
1823
|
-
|
|
1824
|
-
field, kind = case type
|
|
1825
|
-
when /EntityType/ then ["Entity", :entity]
|
|
1826
|
-
when /MicroflowJava/ then ["Microflow", :microflow]
|
|
1827
|
-
when /ImportMapping/ then ["ImportMapping", :import_mapping]
|
|
1828
|
-
when /ExportMapping/ then ["ExportMapping", :export_mapping]
|
|
1829
|
-
else
|
|
1830
|
-
[nil, :native]
|
|
1831
|
-
end
|
|
1832
|
-
{ kind: kind, value: field ? value[field] : value }
|
|
1833
|
-
end
|
|
1834
|
-
|
|
1835
|
-
def translated_text(text_doc)
|
|
1836
|
-
return "" unless text_doc
|
|
1837
|
-
|
|
1838
|
-
translations = text_doc["Translations"] || text_doc["Items"]
|
|
1839
|
-
bson_items(translations).first&.fetch("Text", "") || ""
|
|
1840
|
-
end
|
|
1841
|
-
|
|
1842
|
-
def translated_items(text_doc)
|
|
1843
|
-
return [] unless text_doc
|
|
1844
|
-
|
|
1845
|
-
bson_items(text_doc["Translations"] || text_doc["Items"])
|
|
1846
|
-
end
|
|
1847
|
-
|
|
1848
|
-
def member_specs(members_bson)
|
|
1849
|
-
bson_items(members_bson).filter_map do |m|
|
|
1850
|
-
attr = m["Attribute"].to_s
|
|
1851
|
-
association = m["Association"].to_s
|
|
1852
|
-
raw_value = m["Value"]
|
|
1853
|
-
val = raw_value.is_a?(Hash) ? raw_value["Value"].to_s : raw_value.to_s
|
|
1854
|
-
next if attr.empty? && association.empty?
|
|
1855
|
-
|
|
1856
|
-
{
|
|
1857
|
-
attribute: attr, association: association, value: val,
|
|
1858
|
-
operation: m.fetch("Type", "Set")
|
|
1859
|
-
}
|
|
1860
|
-
end
|
|
1861
|
-
end
|
|
1862
|
-
|
|
1863
|
-
def members_dsl(members)
|
|
1864
|
-
members.map { "#{symbol(_1[:attribute])} => #{ruby_val(_1[:value])}" }.join(", ")
|
|
1865
|
-
end
|
|
1866
|
-
|
|
1867
|
-
def member_block(command, members, indent)
|
|
1868
|
-
pad = " " * (indent + 2)
|
|
1869
|
-
lines = ["#{command} do"]
|
|
1870
|
-
members.each do |member|
|
|
1871
|
-
if member[:association].to_s.empty?
|
|
1872
|
-
lines << "#{pad}set #{symbol(member[:attribute])}, to: #{ruby_val(member[:value])}"
|
|
1873
|
-
else
|
|
1874
|
-
operation = underscore(member[:operation])
|
|
1875
|
-
operation_a = operation == "set" ? "" : ", operation: :#{operation}"
|
|
1876
|
-
lines << "#{pad}set_association #{ruby(member[:association])}, " \
|
|
1877
|
-
"to: #{ruby_val(member[:value])}#{operation_a}"
|
|
1069
|
+
def each_page_widget(widgets, &block)
|
|
1070
|
+
Array(widgets).each do |widget|
|
|
1071
|
+
yield widget
|
|
1072
|
+
each_page_widget(direct_widget_children(widget), &block)
|
|
1073
|
+
Array(widget.dig(:options, :tabs)).each { each_page_widget(_1[:widgets], &block) }
|
|
1074
|
+
Array(widget.dig(:options, :rows)).each do |row|
|
|
1075
|
+
Array(row[:columns]).each { each_page_widget(_1[:widgets], &block) }
|
|
1076
|
+
Array(row[:cells]).each { each_page_widget(_1[:widgets], &block) }
|
|
1878
1077
|
end
|
|
1879
1078
|
end
|
|
1880
|
-
lines << "#{' ' * indent}end"
|
|
1881
|
-
lines.join("\n")
|
|
1882
1079
|
end
|
|
1883
1080
|
|
|
1884
|
-
def
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
s = val.to_s
|
|
1888
|
-
return s if s.match?(/\A-?\d+(?:\.\d+)?\z/) || %w[true false nil].include?(s)
|
|
1081
|
+
def direct_widget_children(widget)
|
|
1082
|
+
regions = widget[:regions]
|
|
1083
|
+
region_widgets = regions.is_a?(Hash) ? regions.values.flat_map { Array(_1) } : []
|
|
1889
1084
|
|
|
1890
|
-
|
|
1085
|
+
(
|
|
1086
|
+
Array(widget[:children]) +
|
|
1087
|
+
Array(widget[:slots]).flat_map { Array(_1[:widgets]) } +
|
|
1088
|
+
Array(widget[:body]) +
|
|
1089
|
+
Array(widget[:footer]) +
|
|
1090
|
+
region_widgets
|
|
1091
|
+
).uniq
|
|
1891
1092
|
end
|
|
1892
1093
|
|
|
1893
|
-
def
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
[]
|
|
1897
|
-
end
|
|
1094
|
+
def infer_public_reference(public_artifacts, current_module, reference)
|
|
1095
|
+
return unless reference
|
|
1096
|
+
return if reference.fetch(:kind).to_sym == :action
|
|
1097
|
+
return if reference[:name].to_s.empty?
|
|
1898
1098
|
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
end
|
|
1099
|
+
target_module, target_name = reference.fetch(:name).to_s.split('.', 2)
|
|
1100
|
+
return if target_name.to_s.empty? || target_module == current_module
|
|
1902
1101
|
|
|
1903
|
-
|
|
1904
|
-
@architecture&.fetch(:modules, [])&.find { _1[:name] == name }
|
|
1102
|
+
public_artifacts[[target_module, reference.fetch(:kind).to_sym, target_name]] = true
|
|
1905
1103
|
end
|
|
1906
1104
|
|
|
1907
|
-
def
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
next unless source
|
|
1912
|
-
|
|
1913
|
-
target_module, target_name = source.fetch(:name).to_s.split(".", 2)
|
|
1914
|
-
next if target_name.to_s.empty? || target_module == mod.name
|
|
1915
|
-
|
|
1916
|
-
public_artifacts[[target_module, source.fetch(:kind).to_sym, target_name]] = true
|
|
1917
|
-
end
|
|
1918
|
-
end
|
|
1105
|
+
def artifact_metadata(module_name, kind, name, metadata)
|
|
1106
|
+
result = metadata ? metadata.dup : {}
|
|
1107
|
+
result[:public] = true if @inferred_public_artifacts&.include?([module_name, kind, name])
|
|
1108
|
+
result.empty? ? nil : result
|
|
1919
1109
|
end
|
|
1920
1110
|
|
|
1921
1111
|
def flow_metadata(module_name, kind, name, metadata)
|
|
1922
|
-
|
|
1923
|
-
if @inferred_public_artifacts&.include?([module_name, kind, name])
|
|
1924
|
-
result[:public] = true
|
|
1925
|
-
end
|
|
1926
|
-
result.empty? ? nil : result
|
|
1112
|
+
artifact_metadata(module_name, kind, name, metadata)
|
|
1927
1113
|
end
|
|
1928
1114
|
|
|
1929
1115
|
def reference(value)
|
|
1930
|
-
value.to_s.include?(
|
|
1116
|
+
value.to_s.include?('.') ? ruby(value.to_s) : symbol(value)
|
|
1931
1117
|
end
|
|
1932
1118
|
|
|
1933
1119
|
def symbol(value)
|