@mat3ra/mode 2025.10.2-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.babelrc ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "presets": [
3
+ [
4
+ "@babel/preset-env",
5
+ {
6
+ "targets": {
7
+ "node": "current"
8
+ }
9
+ }
10
+ ],
11
+ "@babel/preset-react",
12
+ ],
13
+ "plugins": [
14
+ "@babel/plugin-proposal-class-properties"
15
+ ]
16
+ }
17
+
package/LICENSE.md ADDED
@@ -0,0 +1,15 @@
1
+ # LICENSE
2
+
3
+ Copyright 2022 Exabyte Inc.
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,97 @@
1
+ [![npm version](https://badge.fury.io/js/%40mat3ra%2Fmode.svg)](https://badge.fury.io/js/%40mat3ra%2Fmode.js)
2
+ [![License: Apache](https://img.shields.io/badge/License-Apache-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
3
+
4
+ # mode.js
5
+
6
+ MOdel DEfinitions in JS - mode.js - houses model entity definitions for use in the Mat3ra platform.
7
+
8
+
9
+ ### Installation
10
+
11
+ For usage within a javascript project:
12
+
13
+ ```bash
14
+ npm install @mat3ra/mode
15
+ ```
16
+
17
+ For development:
18
+
19
+ ```bash
20
+ git clone https://github.com/Exabyte-io/mode.git
21
+ ```
22
+
23
+
24
+ ### Contribution
25
+
26
+ This repository is an [open-source](LICENSE.md) work-in-progress and we welcome contributions.
27
+
28
+ We regularly deploy the latest code containing all accepted contributions online as part of the
29
+ [Mat3ra.com](https://mat3ra.com) platform, so contributors will see their code in action there.
30
+
31
+ See [ESSE](https://github.com/Exabyte-io/esse) for additional context regarding the data schemas used here.
32
+
33
+ Useful commands for development:
34
+
35
+ ```bash
36
+ # run linter without persistence
37
+ npm run lint
38
+
39
+ # run linter and save edits
40
+ npm run lint:fix
41
+
42
+ # compile the library
43
+ npm run transpile
44
+
45
+ # run tests
46
+ npm run test
47
+ ```
48
+
49
+ #### How to Add New Models and Methods
50
+
51
+ !NOTE: this section is moved to [@mat3ra/standata](github.com/Exabyte-io/standata).
52
+
53
+ The list of model and method entities is compiled from Yaml assets located in the `./assets` directory
54
+ using the `build_entities.js` script. The assets processed by this script usually involve custom Yaml
55
+ types such as `!combine` to generate several entity configurations at once.
56
+
57
+ A new model or method may be added either by extending parameters of an existing entity or by adding
58
+ a new asset file such as the following:
59
+
60
+ ```yaml
61
+ !combine
62
+ name:
63
+ template: 'Model{{ "-" + parameters.example }}' # set the model name using a template
64
+
65
+ # Loop over parameters to create combinations
66
+ forEach:
67
+ - !parameter
68
+ key: parameters.example # path of where to set the property
69
+ values: ["A", "B", "C"] # values to iterate over
70
+ isOptional: true
71
+
72
+ # static configuration (same for all created entities
73
+ config:
74
+ tags:
75
+ - example_model
76
+ - tutorial
77
+ schema: !esse 'schema-id-placeholder' # add a schema using the !esse type to validate each configuration
78
+ ```
79
+
80
+ The above asset file will create four model configurations, "Model-A", "Model-B", "Model-C",
81
+ and "Model". The latter entity is created due to the `isOptional` flag of the example parameter.
82
+ There are a few more options available to customize the entity asset, for instance, the `!combine` type
83
+ has an `exclusions` property where conflicting pairs of entity properties can be defined, so that
84
+ combinations of those will be avoided.
85
+
86
+ For more examples, please see the asset files in `./assets` or [code.js](https://github.com/Exabyte-io/code.js)
87
+ for the definition of Yaml types such as `!combine` or `!parameter`.
88
+
89
+ MoDe
90
+ ====
91
+
92
+ The `MoDe` package is used in conjunction with the `ADe` package to define top-level parameters
93
+ present in Subworkflow units in the `WoDe` package ecosystem. The entities provided by `MoDe` are:
94
+
95
+ - `Method` - See [Method Overview](https://docs.mat3ra.com/methods/overview/) for more details
96
+ - `Model` - See [Model Overview](https://docs.mat3ra.com/models/overview/) for more details
97
+