@mat3ra/esse 2023.12.25-2
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 +10 -0
- package/.eslintrc.json +3 -0
- package/.pre-commit-config.yaml +20 -0
- package/.prettierrc +6 -0
- package/LICENSE.md +15 -0
- package/README.md +157 -0
- package/build_schemas.js +42 -0
- package/build_schemas.py +61 -0
- package/docs/README.md +3 -0
- package/example/3pse/file/applications/espresso/7.2/pw.x.json +94 -0
- package/example/core/abstract/2d_data.json +19 -0
- package/example/core/abstract/2d_plot.json +26 -0
- package/example/core/abstract/3d_grid.json +12 -0
- package/example/core/abstract/3d_tensor.json +17 -0
- package/example/core/abstract/3d_vector_basis.json +17 -0
- package/example/core/abstract/point.json +5 -0
- package/example/core/abstract/vector.json +5 -0
- package/example/core/primitive/1d_data_series.json +12 -0
- package/example/core/primitive/3d_lattice.json +8 -0
- package/example/core/primitive/array_of_3_booleans.json +5 -0
- package/example/core/primitive/array_of_3_numbers.json +5 -0
- package/example/core/primitive/array_of_ids.json +8 -0
- package/example/core/primitive/axis.json +4 -0
- package/example/core/primitive/scalar.json +3 -0
- package/example/core/primitive/string.json +3 -0
- package/example/core/reference/experiment/condition.json +12 -0
- package/example/core/reference/experiment/location.json +4 -0
- package/example/core/reference/experiment.json +22 -0
- package/example/core/reference/literature/name.json +5 -0
- package/example/core/reference/literature/pages.json +4 -0
- package/example/core/reference/literature.json +8 -0
- package/example/core/reference/modeling/exabyte.json +7 -0
- package/example/core/reference/modeling.json +3 -0
- package/example/core/reference.json +3 -0
- package/example/core/reusable/atomic_vectors.json +18 -0
- package/example/core/reusable/band_gap.json +16 -0
- package/example/core/reusable/energy.json +5 -0
- package/example/core/reusable/file_metadata.json +5 -0
- package/example/core/reusable/object_storage_container_data.json +8 -0
- package/example/element.json +14 -0
- package/example/job/compute.json +26 -0
- package/example/job.json +26 -0
- package/example/material.json +94 -0
- package/example/method/categorized_method.json +47 -0
- package/example/method/method_parameters.json +3 -0
- package/example/method.json +7 -0
- package/example/methods_directory/legacy/localorbital.json +4 -0
- package/example/methods_directory/legacy/pseudopotential.json +4 -0
- package/example/methods_directory/legacy/regression.json +61 -0
- package/example/methods_directory/legacy/unknown.json +4 -0
- package/example/methods_directory/mathematical/cg.json +10 -0
- package/example/methods_directory/mathematical/regression.json +65 -0
- package/example/methods_directory/physical/ao/dunning.json +13 -0
- package/example/methods_directory/physical/psp/file.json +49 -0
- package/example/methods_directory/physical/psp.json +16 -0
- package/example/methods_directory/physical/pw.json +9 -0
- package/example/methods_directory/physical/smearing.json +10 -0
- package/example/methods_directory/physical/tetrahedron.json +10 -0
- package/example/model/categorized_model.json +33 -0
- package/example/model/model_parameters.json +7 -0
- package/example/model.json +7 -0
- package/example/models_category/pb/qm/abin/gw.json +7 -0
- package/example/models_category/pb/qm/dft/ksdft.json +6 -0
- package/example/models_category/pb/qm/semp.json +5 -0
- package/example/models_directory/gga.json +15 -0
- package/example/models_directory/gw.json +15 -0
- package/example/models_directory/hybrid.json +15 -0
- package/example/models_directory/lda.json +15 -0
- package/example/models_directory/legacy/dft.json +8 -0
- package/example/models_directory/legacy/ml.json +7 -0
- package/example/models_directory/legacy/unknown.json +7 -0
- package/example/models_directory/re.json +9 -0
- package/example/project.json +21 -0
- package/example/properties_directory/electronic_configuration.json +4 -0
- package/example/properties_directory/elemental/atomic_radius.json +4 -0
- package/example/properties_directory/elemental/electronegativity.json +4 -0
- package/example/properties_directory/elemental/ionization_potential.json +4 -0
- package/example/properties_directory/non-scalar/band_gaps.json +25 -0
- package/example/properties_directory/non-scalar/band_structure.json +47 -0
- package/example/properties_directory/non-scalar/charge_density_profile.json +22 -0
- package/example/properties_directory/non-scalar/density_of_states.json +55 -0
- package/example/properties_directory/non-scalar/dielectric_tensor.json +133 -0
- package/example/properties_directory/non-scalar/file_content.json +8 -0
- package/example/properties_directory/non-scalar/hubbard_u.json +24 -0
- package/example/properties_directory/non-scalar/hubbard_v.json +22 -0
- package/example/properties_directory/non-scalar/hubbard_v_nn.json +24 -0
- package/example/properties_directory/non-scalar/phonon_dispersions.json +41 -0
- package/example/properties_directory/non-scalar/phonon_dos.json +37 -0
- package/example/properties_directory/non-scalar/potential_profile.json +32 -0
- package/example/properties_directory/non-scalar/reaction_energy_profile.json +30 -0
- package/example/properties_directory/non-scalar/stress_tensor.json +21 -0
- package/example/properties_directory/non-scalar/total_energy_contributions.json +44 -0
- package/example/properties_directory/non-scalar/vibrational_spectrum.json +25 -0
- package/example/properties_directory/scalar/electron_affinity.json +5 -0
- package/example/properties_directory/scalar/fermi_energy.json +5 -0
- package/example/properties_directory/scalar/formation_energy.json +5 -0
- package/example/properties_directory/scalar/ionization_potential.json +5 -0
- package/example/properties_directory/scalar/pressure.json +5 -0
- package/example/properties_directory/scalar/reaction_energy_barrier.json +5 -0
- package/example/properties_directory/scalar/surface_energy.json +5 -0
- package/example/properties_directory/scalar/total_energy.json +5 -0
- package/example/properties_directory/scalar/total_force.json +5 -0
- package/example/properties_directory/scalar/valence_band_offset.json +5 -0
- package/example/properties_directory/scalar/zero_point_energy.json +5 -0
- package/example/properties_directory/structural/atomic_forces.json +22 -0
- package/example/properties_directory/structural/basis/atomic_constraints.json +21 -0
- package/example/properties_directory/structural/basis/atomic_coordinate.json +8 -0
- package/example/properties_directory/structural/basis/atomic_coordinates.json +21 -0
- package/example/properties_directory/structural/basis/atomic_element.json +4 -0
- package/example/properties_directory/structural/basis/bonds.json +24 -0
- package/example/properties_directory/structural/basis.json +19 -0
- package/example/properties_directory/structural/density.json +5 -0
- package/example/properties_directory/structural/elemental_ratio.json +5 -0
- package/example/properties_directory/structural/inchi.json +4 -0
- package/example/properties_directory/structural/inchi_key.json +4 -0
- package/example/properties_directory/structural/lattice/lattice_bravais.json +13 -0
- package/example/properties_directory/structural/lattice/lattice_vectors.json +19 -0
- package/example/properties_directory/structural/lattice.json +7 -0
- package/example/properties_directory/structural/magnetic_moments.json +22 -0
- package/example/properties_directory/structural/molecular_pattern.json +71 -0
- package/example/properties_directory/structural/p-norm.json +5 -0
- package/example/properties_directory/structural/symmetry.json +9 -0
- package/example/properties_directory/structural/volume.json +5 -0
- package/example/properties_directory/workflow/convergence/electronic.json +15 -0
- package/example/properties_directory/workflow/convergence/ionic.json +20 -0
- package/example/properties_directory/workflow/convergence/kpoint.json +22 -0
- package/example/property/base.json +21 -0
- package/example/software/application.json +7 -0
- package/example/software/executable.json +20 -0
- package/example/software/flavor.json +9 -0
- package/example/software/template.json +14 -0
- package/example/software_directory/ml/exabyteml.json +6 -0
- package/example/software_directory/ml/unit/execution/evaluate/cross-validate.json +17 -0
- package/example/software_directory/ml/unit/execution/initialize.json +20 -0
- package/example/software_directory/ml/unit/execution/score.json +15 -0
- package/example/software_directory/ml/unit/execution/train.json +26 -0
- package/example/software_directory/ml/unit/processing/data_transformation/manipulation.json +14 -0
- package/example/software_directory/ml/unit/processing/data_transformation/scale_and_reduce.json +26 -0
- package/example/software_directory/ml/unit/processing/feature_selection/filter_based.json +13 -0
- package/example/software_directory/modeling/espresso/arguments.json +5 -0
- package/example/software_directory/modeling/espresso.json +6 -0
- package/example/software_directory/modeling/nwchem.json +6 -0
- package/example/software_directory/modeling/unit/execution.json +16 -0
- package/example/software_directory/modeling/vasp.json +6 -0
- package/example/software_directory/scripting/jupyter-lab.json +8 -0
- package/example/software_directory/scripting/python.json +8 -0
- package/example/software_directory/scripting/shell.json +8 -0
- package/example/software_directory/scripting/unit/execution.json +17 -0
- package/example/system/_material.json +5 -0
- package/example/system/_parent_job.json +5 -0
- package/example/system/_project.json +5 -0
- package/example/system/consistency_check.json +6 -0
- package/example/system/creator.json +5 -0
- package/example/system/entity_reference.json +5 -0
- package/example/system/file_source.json +6 -0
- package/example/system/message.json +14 -0
- package/example/system/owner.json +5 -0
- package/example/workflow/subworkflow.json +18 -0
- package/example/workflow/unit/assignment.json +19 -0
- package/example/workflow/unit/condition.json +22 -0
- package/example/workflow/unit/execution.json +39 -0
- package/example/workflow/unit/input/_inputItemScope.json +4 -0
- package/example/workflow/unit/io/api.json +31 -0
- package/example/workflow/unit/io/db.json +15 -0
- package/example/workflow/unit/io/object_storage.json +7 -0
- package/example/workflow/unit/io.json +41 -0
- package/example/workflow/unit/map.json +16 -0
- package/example/workflow/unit/processing.json +13 -0
- package/example/workflow/unit/reduce.json +16 -0
- package/example/workflow/unit/runtime/runtime_items.json +14 -0
- package/example/workflow/unit.json +8 -0
- package/example/workflow.json +34 -0
- package/lib/js/esse/index.js +83 -0
- package/lib/js/esse/schemaUtils.js +78 -0
- package/lib/js/esse/settings.js +18 -0
- package/lib/js/esse/utils.js +74 -0
- package/lib/js/json_include/index.js +110 -0
- package/lib/js/json_include/settings.js +13 -0
- package/lib/js/json_include/utils.js +22 -0
- package/lib/js/scripts/createEnumsFromYaml.js +74 -0
- package/lib/js/scripts/setSchemaIds.js +156 -0
- package/npmignore +6 -0
- package/package.json +75 -0
- package/schema/3pse/file/applications/espresso/7.2/pw.x/atomic_positions.json +66 -0
- package/schema/3pse/file/applications/espresso/7.2/pw.x/atomic_species.json +30 -0
- package/schema/3pse/file/applications/espresso/7.2/pw.x/cell.json +89 -0
- package/schema/3pse/file/applications/espresso/7.2/pw.x/cell_parameters.json +36 -0
- package/schema/3pse/file/applications/espresso/7.2/pw.x/control.json +181 -0
- package/schema/3pse/file/applications/espresso/7.2/pw.x/electrons.json +157 -0
- package/schema/3pse/file/applications/espresso/7.2/pw.x/hubbard.json +219 -0
- package/schema/3pse/file/applications/espresso/7.2/pw.x/ions.json +216 -0
- package/schema/3pse/file/applications/espresso/7.2/pw.x/k_points.json +87 -0
- package/schema/3pse/file/applications/espresso/7.2/pw.x/system.json +649 -0
- package/schema/3pse/file/applications/espresso/7.2/pw.x.json +52 -0
- package/schema/core/abstract/2d_data.json +19 -0
- package/schema/core/abstract/2d_plot.json +29 -0
- package/schema/core/abstract/3d_grid.json +17 -0
- package/schema/core/abstract/3d_tensor.json +11 -0
- package/schema/core/abstract/3d_vector_basis.json +25 -0
- package/schema/core/abstract/point.json +10 -0
- package/schema/core/abstract/vector.json +13 -0
- package/schema/core/primitive/1d_data_series.json +16 -0
- package/schema/core/primitive/3d_lattice.json +40 -0
- package/schema/core/primitive/array_of_3_booleans.json +11 -0
- package/schema/core/primitive/array_of_3_numbers.json +11 -0
- package/schema/core/primitive/array_of_ids.json +17 -0
- package/schema/core/primitive/array_of_strings.json +11 -0
- package/schema/core/primitive/axis.json +18 -0
- package/schema/core/primitive/group_info.json +16 -0
- package/schema/core/primitive/integer_one_or_zero.json +8 -0
- package/schema/core/primitive/linked_list/base_node.json +34 -0
- package/schema/core/primitive/linked_list/named_node.json +14 -0
- package/schema/core/primitive/linked_list/named_node_in_group.json +14 -0
- package/schema/core/primitive/linked_list/node_with_type.json +16 -0
- package/schema/core/primitive/linked_list.json +24 -0
- package/schema/core/primitive/scalar.json +14 -0
- package/schema/core/primitive/slugified_entry.json +21 -0
- package/schema/core/primitive/slugified_entry_or_slug.json +14 -0
- package/schema/core/primitive/string.json +14 -0
- package/schema/core/reference/exabyte.json +19 -0
- package/schema/core/reference/experiment/condition.json +29 -0
- package/schema/core/reference/experiment/location.json +19 -0
- package/schema/core/reference/experiment.json +58 -0
- package/schema/core/reference/literature/name.json +24 -0
- package/schema/core/reference/literature/pages.json +17 -0
- package/schema/core/reference/literature.json +82 -0
- package/schema/core/reference/modeling/exabyte.json +30 -0
- package/schema/core/reference/modeling.json +10 -0
- package/schema/core/reference.json +16 -0
- package/schema/core/reusable/atomic_data/per_orbital.json +22 -0
- package/schema/core/reusable/atomic_data/per_orbital_pair.json +39 -0
- package/schema/core/reusable/atomic_data/value_number.json +13 -0
- package/schema/core/reusable/atomic_data/value_string.json +13 -0
- package/schema/core/reusable/atomic_data_per_orbital_numeric.json +15 -0
- package/schema/core/reusable/atomic_data_per_orbital_pair_numeric.json +15 -0
- package/schema/core/reusable/atomic_orbital.json +32 -0
- package/schema/core/reusable/atomic_scalars.json +17 -0
- package/schema/core/reusable/atomic_strings.json +17 -0
- package/schema/core/reusable/atomic_vectors.json +17 -0
- package/schema/core/reusable/band_gap.json +44 -0
- package/schema/core/reusable/categories.json +29 -0
- package/schema/core/reusable/category_path.json +7 -0
- package/schema/core/reusable/dielectric_tensor_component.json +28 -0
- package/schema/core/reusable/energy.json +29 -0
- package/schema/core/reusable/file_metadata.json +20 -0
- package/schema/core/reusable/frequency_function_matrix.json +23 -0
- package/schema/core/reusable/object_storage_container_data.json +37 -0
- package/schema/definitions/units.json +103 -0
- package/schema/element.json +28 -0
- package/schema/in_memory_entity/base.json +30 -0
- package/schema/in_memory_entity/defaultable.json +13 -0
- package/schema/in_memory_entity/named.json +13 -0
- package/schema/in_memory_entity/named_defaultable.json +16 -0
- package/schema/in_memory_entity/named_defaultable_has_metadata.json +19 -0
- package/schema/in_memory_entity/named_defaultable_runtime_items.json +19 -0
- package/schema/job/base.json +80 -0
- package/schema/job/compute.json +145 -0
- package/schema/job.json +19 -0
- package/schema/material/conventional.json +10 -0
- package/schema/material.json +57 -0
- package/schema/method/categorized_method.json +24 -0
- package/schema/method/method_parameters.json +20 -0
- package/schema/method/unit_method.json +27 -0
- package/schema/method.json +27 -0
- package/schema/methods_category/mathematical/diff/enum_options.json +8 -0
- package/schema/methods_category/mathematical/diff/enum_options.yml +3 -0
- package/schema/methods_category/mathematical/diff/fd.json +15 -0
- package/schema/methods_category/mathematical/diff.json +15 -0
- package/schema/methods_category/mathematical/discr/enum_options.json +8 -0
- package/schema/methods_category/mathematical/discr/enum_options.yml +3 -0
- package/schema/methods_category/mathematical/discr/mesh/enum_options.json +18 -0
- package/schema/methods_category/mathematical/discr/mesh/enum_options.yml +7 -0
- package/schema/methods_category/mathematical/discr/mesh/hybrid.json +15 -0
- package/schema/methods_category/mathematical/discr/mesh/nstruct.json +15 -0
- package/schema/methods_category/mathematical/discr/mesh/struct/cartesian.json +15 -0
- package/schema/methods_category/mathematical/discr/mesh/struct/enum_options.json +8 -0
- package/schema/methods_category/mathematical/discr/mesh/struct/enum_options.yml +3 -0
- package/schema/methods_category/mathematical/discr/mesh/struct.json +15 -0
- package/schema/methods_category/mathematical/discr/mesh.json +15 -0
- package/schema/methods_category/mathematical/discr.json +15 -0
- package/schema/methods_category/mathematical/enum_options.json +45 -0
- package/schema/methods_category/mathematical/enum_options.yml +22 -0
- package/schema/methods_category/mathematical/fapprx/basisexp.json +15 -0
- package/schema/methods_category/mathematical/fapprx/enum_options.json +13 -0
- package/schema/methods_category/mathematical/fapprx/enum_options.yml +5 -0
- package/schema/methods_category/mathematical/fapprx/ipol/enum_options.json +18 -0
- package/schema/methods_category/mathematical/fapprx/ipol/enum_options.yml +7 -0
- package/schema/methods_category/mathematical/fapprx/ipol/lin.json +15 -0
- package/schema/methods_category/mathematical/fapprx/ipol/poly.json +15 -0
- package/schema/methods_category/mathematical/fapprx/ipol/spline.json +15 -0
- package/schema/methods_category/mathematical/fapprx/ipol.json +15 -0
- package/schema/methods_category/mathematical/fapprx.json +15 -0
- package/schema/methods_category/mathematical/intgr/analytic/enum_options.json +20 -0
- package/schema/methods_category/mathematical/intgr/analytic/enum_options.yml +14 -0
- package/schema/methods_category/mathematical/intgr/analytic/volume.json +18 -0
- package/schema/methods_category/mathematical/intgr/analytic.json +15 -0
- package/schema/methods_category/mathematical/intgr/diffeq/enum_options.json +13 -0
- package/schema/methods_category/mathematical/intgr/diffeq/enum_options.yml +5 -0
- package/schema/methods_category/mathematical/intgr/diffeq/order1.json +15 -0
- package/schema/methods_category/mathematical/intgr/diffeq/order2.json +15 -0
- package/schema/methods_category/mathematical/intgr/diffeq.json +15 -0
- package/schema/methods_category/mathematical/intgr/enum_options.json +23 -0
- package/schema/methods_category/mathematical/intgr/enum_options.yml +9 -0
- package/schema/methods_category/mathematical/intgr/numquad/enum_options.json +13 -0
- package/schema/methods_category/mathematical/intgr/numquad/enum_options.yml +5 -0
- package/schema/methods_category/mathematical/intgr/numquad/gauss.json +15 -0
- package/schema/methods_category/mathematical/intgr/numquad/newcot.json +15 -0
- package/schema/methods_category/mathematical/intgr/numquad.json +15 -0
- package/schema/methods_category/mathematical/intgr/transf/enum_options.json +8 -0
- package/schema/methods_category/mathematical/intgr/transf/enum_options.yml +3 -0
- package/schema/methods_category/mathematical/intgr/transf/fourier.json +15 -0
- package/schema/methods_category/mathematical/intgr/transf.json +15 -0
- package/schema/methods_category/mathematical/intgr.json +15 -0
- package/schema/methods_category/mathematical/linalg/dcomp.json +15 -0
- package/schema/methods_category/mathematical/linalg/diag/davidson.json +15 -0
- package/schema/methods_category/mathematical/linalg/diag/enum_options.json +8 -0
- package/schema/methods_category/mathematical/linalg/diag/enum_options.yml +3 -0
- package/schema/methods_category/mathematical/linalg/diag.json +15 -0
- package/schema/methods_category/mathematical/linalg/enum_options.json +23 -0
- package/schema/methods_category/mathematical/linalg/enum_options.yml +9 -0
- package/schema/methods_category/mathematical/linalg/lintra.json +15 -0
- package/schema/methods_category/mathematical/linalg/matf.json +15 -0
- package/schema/methods_category/mathematical/linalg.json +15 -0
- package/schema/methods_category/mathematical/opt/diff/bracket.json +15 -0
- package/schema/methods_category/mathematical/opt/diff/enum_options.json +28 -0
- package/schema/methods_category/mathematical/opt/diff/enum_options.yml +11 -0
- package/schema/methods_category/mathematical/opt/diff/local.json +15 -0
- package/schema/methods_category/mathematical/opt/diff/order1.json +15 -0
- package/schema/methods_category/mathematical/opt/diff/order2.json +15 -0
- package/schema/methods_category/mathematical/opt/diff/ordern/cg.json +15 -0
- package/schema/methods_category/mathematical/opt/diff/ordern/enum_options.json +8 -0
- package/schema/methods_category/mathematical/opt/diff/ordern/enum_options.yml +3 -0
- package/schema/methods_category/mathematical/opt/diff/ordern.json +15 -0
- package/schema/methods_category/mathematical/opt/diff.json +15 -0
- package/schema/methods_category/mathematical/opt/enum_options.json +18 -0
- package/schema/methods_category/mathematical/opt/enum_options.yml +7 -0
- package/schema/methods_category/mathematical/opt/ndiff/direct.json +15 -0
- package/schema/methods_category/mathematical/opt/ndiff/enum_options.json +18 -0
- package/schema/methods_category/mathematical/opt/ndiff/enum_options.yml +7 -0
- package/schema/methods_category/mathematical/opt/ndiff/pop.json +15 -0
- package/schema/methods_category/mathematical/opt/ndiff/stoch.json +15 -0
- package/schema/methods_category/mathematical/opt/ndiff.json +15 -0
- package/schema/methods_category/mathematical/opt/root/bracket.json +15 -0
- package/schema/methods_category/mathematical/opt/root/enum_options.json +13 -0
- package/schema/methods_category/mathematical/opt/root/enum_options.yml +5 -0
- package/schema/methods_category/mathematical/opt/root/iter.json +15 -0
- package/schema/methods_category/mathematical/opt/root.json +15 -0
- package/schema/methods_category/mathematical/opt.json +15 -0
- package/schema/methods_category/mathematical/regression.json +18 -0
- package/schema/methods_category/physical/enum_options.json +8 -0
- package/schema/methods_category/physical/enum_options.yml +3 -0
- package/schema/methods_category/physical/qm/enum_options.json +8 -0
- package/schema/methods_category/physical/qm/enum_options.yml +3 -0
- package/schema/methods_category/physical/qm/wf/ao/dunning.json +17 -0
- package/schema/methods_category/physical/qm/wf/ao/other.json +17 -0
- package/schema/methods_category/physical/qm/wf/ao/pople.json +17 -0
- package/schema/methods_category/physical/qm/wf/ao.json +18 -0
- package/schema/methods_category/physical/qm/wf/enum_options.json +63 -0
- package/schema/methods_category/physical/qm/wf/enum_options.yml +43 -0
- package/schema/methods_category/physical/qm/wf/psp.json +18 -0
- package/schema/methods_category/physical/qm/wf/pw.json +15 -0
- package/schema/methods_category/physical/qm/wf/smearing.json +19 -0
- package/schema/methods_category/physical/qm/wf/tetrahedron.json +18 -0
- package/schema/methods_category/physical/qm/wf.json +15 -0
- package/schema/methods_category/physical/qm.json +15 -0
- package/schema/methods_directory/legacy/localorbital.json +22 -0
- package/schema/methods_directory/legacy/pseudopotential.json +25 -0
- package/schema/methods_directory/legacy/regression.json +34 -0
- package/schema/methods_directory/legacy/unknown.json +22 -0
- package/schema/methods_directory/mathematical/cg.json +17 -0
- package/schema/methods_directory/mathematical/davidson.json +17 -0
- package/schema/methods_directory/mathematical/regression/data.json +24 -0
- package/schema/methods_directory/mathematical/regression/dataset.json +21 -0
- package/schema/methods_directory/mathematical/regression/kernel_ridge/data_per_property.json +27 -0
- package/schema/methods_directory/mathematical/regression/linear/data_per_property.json +22 -0
- package/schema/methods_directory/mathematical/regression/per_feature_item.json +22 -0
- package/schema/methods_directory/mathematical/regression/precision.json +14 -0
- package/schema/methods_directory/mathematical/regression/precision_per_property.json +23 -0
- package/schema/methods_directory/mathematical/regression.json +26 -0
- package/schema/methods_directory/physical/ao/dunning.json +33 -0
- package/schema/methods_directory/physical/ao/enum_options.json +28 -0
- package/schema/methods_directory/physical/ao/enum_options.yml +19 -0
- package/schema/methods_directory/physical/ao/other.json +33 -0
- package/schema/methods_directory/physical/ao/pople.json +33 -0
- package/schema/methods_directory/physical/psp/file.json +26 -0
- package/schema/methods_directory/physical/psp/file_data_item.json +80 -0
- package/schema/methods_directory/physical/psp.json +24 -0
- package/schema/methods_directory/physical/pw.json +17 -0
- package/schema/methods_directory/physical/smearing.json +17 -0
- package/schema/methods_directory/physical/tetrahedron.json +16 -0
- package/schema/model/categorized_model.json +18 -0
- package/schema/model/mixins/dft/double_hybrid_functional.json +12 -0
- package/schema/model/mixins/dft/enum_options.json +30 -0
- package/schema/model/mixins/dft/enum_options.yml +13 -0
- package/schema/model/mixins/dft/gga_functional.json +12 -0
- package/schema/model/mixins/dft/hybrid_functional.json +12 -0
- package/schema/model/mixins/dft/lda_functional.json +12 -0
- package/schema/model/mixins/dft/mgga_functional.json +12 -0
- package/schema/model/mixins/dispersion_correction.json +12 -0
- package/schema/model/mixins/enum_options.json +22 -0
- package/schema/model/mixins/enum_options.yml +10 -0
- package/schema/model/mixins/hubbard.json +12 -0
- package/schema/model/mixins/spin_orbit_coupling.json +11 -0
- package/schema/model/mixins/spin_polarization.json +12 -0
- package/schema/model/model_parameters.json +38 -0
- package/schema/model/model_without_method.json +30 -0
- package/schema/model.json +24 -0
- package/schema/models_category/enum_options.json +13 -0
- package/schema/models_category/enum_options.yml +5 -0
- package/schema/models_category/pb/enum_options.json +8 -0
- package/schema/models_category/pb/enum_options.yml +3 -0
- package/schema/models_category/pb/qm/abin/enum_options.json +15 -0
- package/schema/models_category/pb/qm/abin/enum_options.yml +10 -0
- package/schema/models_category/pb/qm/abin/gw.json +18 -0
- package/schema/models_category/pb/qm/abin.json +15 -0
- package/schema/models_category/pb/qm/dft/enum_options.json +8 -0
- package/schema/models_category/pb/qm/dft/enum_options.yml +3 -0
- package/schema/models_category/pb/qm/dft/ksdft/double_hybrid.json +15 -0
- package/schema/models_category/pb/qm/dft/ksdft/enum_options.json +28 -0
- package/schema/models_category/pb/qm/dft/ksdft/enum_options.yml +11 -0
- package/schema/models_category/pb/qm/dft/ksdft/gga.json +15 -0
- package/schema/models_category/pb/qm/dft/ksdft/hybrid.json +15 -0
- package/schema/models_category/pb/qm/dft/ksdft/lda.json +15 -0
- package/schema/models_category/pb/qm/dft/ksdft/mgga.json +15 -0
- package/schema/models_category/pb/qm/dft/ksdft.json +15 -0
- package/schema/models_category/pb/qm/dft.json +15 -0
- package/schema/models_category/pb/qm/enum_options.json +18 -0
- package/schema/models_category/pb/qm/enum_options.yml +7 -0
- package/schema/models_category/pb/qm/semp.json +15 -0
- package/schema/models_category/pb/qm.json +15 -0
- package/schema/models_category/pb.json +15 -0
- package/schema/models_category/st/det/enum_options.json +8 -0
- package/schema/models_category/st/det/enum_options.yml +3 -0
- package/schema/models_category/st/det/ml/enum_options.json +8 -0
- package/schema/models_category/st/det/ml/enum_options.yml +3 -0
- package/schema/models_category/st/det/ml/re.json +15 -0
- package/schema/models_category/st/det/ml.json +15 -0
- package/schema/models_category/st/det.json +15 -0
- package/schema/models_category/st/enum_options.json +8 -0
- package/schema/models_category/st/enum_options.yml +3 -0
- package/schema/models_category/st.json +15 -0
- package/schema/models_directory/double_hybrid.json +39 -0
- package/schema/models_directory/gga.json +42 -0
- package/schema/models_directory/gw.json +54 -0
- package/schema/models_directory/hybrid.json +42 -0
- package/schema/models_directory/lda.json +42 -0
- package/schema/models_directory/legacy/dft.json +81 -0
- package/schema/models_directory/legacy/ml.json +22 -0
- package/schema/models_directory/legacy/unknown.json +22 -0
- package/schema/models_directory/mgga.json +42 -0
- package/schema/models_directory/re.json +23 -0
- package/schema/project.json +40 -0
- package/schema/properties_directory/derived_properties.json +31 -0
- package/schema/properties_directory/electronic_configuration.json +16 -0
- package/schema/properties_directory/elemental/atomic_radius.json +21 -0
- package/schema/properties_directory/elemental/electronegativity.json +18 -0
- package/schema/properties_directory/elemental/ionization_potential.json +21 -0
- package/schema/properties_directory/non-scalar/average_potential_profile.json +41 -0
- package/schema/properties_directory/non-scalar/band_gaps.json +51 -0
- package/schema/properties_directory/non-scalar/band_structure.json +52 -0
- package/schema/properties_directory/non-scalar/charge_density_profile.json +38 -0
- package/schema/properties_directory/non-scalar/density_of_states.json +70 -0
- package/schema/properties_directory/non-scalar/dielectric_tensor.json +22 -0
- package/schema/properties_directory/non-scalar/file_content.json +34 -0
- package/schema/properties_directory/non-scalar/hubbard_u.json +32 -0
- package/schema/properties_directory/non-scalar/hubbard_v.json +33 -0
- package/schema/properties_directory/non-scalar/hubbard_v_nn.json +11 -0
- package/schema/properties_directory/non-scalar/phonon_dispersions.json +41 -0
- package/schema/properties_directory/non-scalar/phonon_dos.json +42 -0
- package/schema/properties_directory/non-scalar/potential_profile.json +38 -0
- package/schema/properties_directory/non-scalar/reaction_energy_profile.json +38 -0
- package/schema/properties_directory/non-scalar/stress_tensor.json +18 -0
- package/schema/properties_directory/non-scalar/total_energy_contributions.json +211 -0
- package/schema/properties_directory/non-scalar/vibrational_spectrum.json +45 -0
- package/schema/properties_directory/scalar/electron_affinity.json +17 -0
- package/schema/properties_directory/scalar/fermi_energy.json +17 -0
- package/schema/properties_directory/scalar/formation_energy.json +17 -0
- package/schema/properties_directory/scalar/ionization_potential.json +17 -0
- package/schema/properties_directory/scalar/pressure.json +21 -0
- package/schema/properties_directory/scalar/reaction_energy_barrier.json +17 -0
- package/schema/properties_directory/scalar/surface_energy.json +17 -0
- package/schema/properties_directory/scalar/total_energy.json +17 -0
- package/schema/properties_directory/scalar/total_force.json +20 -0
- package/schema/properties_directory/scalar/valence_band_offset.json +17 -0
- package/schema/properties_directory/scalar/zero_point_energy.json +17 -0
- package/schema/properties_directory/structural/atomic_forces.json +19 -0
- package/schema/properties_directory/structural/basis/atomic_constraints.json +16 -0
- package/schema/properties_directory/structural/basis/atomic_coordinate.json +14 -0
- package/schema/properties_directory/structural/basis/atomic_coordinates.json +21 -0
- package/schema/properties_directory/structural/basis/atomic_element.json +25 -0
- package/schema/properties_directory/structural/basis/bonds.json +35 -0
- package/schema/properties_directory/structural/basis.json +33 -0
- package/schema/properties_directory/structural/density.json +22 -0
- package/schema/properties_directory/structural/elemental_ratio.json +27 -0
- package/schema/properties_directory/structural/inchi.json +17 -0
- package/schema/properties_directory/structural/inchi_key.json +17 -0
- package/schema/properties_directory/structural/lattice/lattice_bravais.json +38 -0
- package/schema/properties_directory/structural/lattice/lattice_vectors.json +20 -0
- package/schema/properties_directory/structural/lattice/type_enum.json +23 -0
- package/schema/properties_directory/structural/lattice/type_extended_enum.json +32 -0
- package/schema/properties_directory/structural/lattice.json +25 -0
- package/schema/properties_directory/structural/magnetic_moments.json +19 -0
- package/schema/properties_directory/structural/molecular_pattern.json +19 -0
- package/schema/properties_directory/structural/p-norm.json +22 -0
- package/schema/properties_directory/structural/patterns/functional_group.json +32 -0
- package/schema/properties_directory/structural/patterns/ring.json +31 -0
- package/schema/properties_directory/structural/patterns/special_bond.json +29 -0
- package/schema/properties_directory/structural/symmetry.json +35 -0
- package/schema/properties_directory/structural/volume.json +22 -0
- package/schema/properties_directory/workflow/convergence/electronic.json +31 -0
- package/schema/properties_directory/workflow/convergence/ionic.json +60 -0
- package/schema/properties_directory/workflow/convergence/kpoint.json +46 -0
- package/schema/property/base.json +57 -0
- package/schema/property/meta.json +10 -0
- package/schema/property/raw.json +57 -0
- package/schema/property/source.json +26 -0
- package/schema/software/application.json +40 -0
- package/schema/software/executable.json +32 -0
- package/schema/software/flavor.json +40 -0
- package/schema/software/template.json +33 -0
- package/schema/software_directory/ml/exabyteml.json +23 -0
- package/schema/software_directory/ml/unit/execution/evaluate/cross-validate.json +25 -0
- package/schema/software_directory/ml/unit/execution/initialize.json +29 -0
- package/schema/software_directory/ml/unit/execution/score.json +13 -0
- package/schema/software_directory/ml/unit/execution/train.json +38 -0
- package/schema/software_directory/ml/unit/execution.json +17 -0
- package/schema/software_directory/ml/unit/processing/data_transformation/manipulation.json +50 -0
- package/schema/software_directory/ml/unit/processing/data_transformation/scale_and_reduce.json +70 -0
- package/schema/software_directory/ml/unit/processing/data_transformation.json +8 -0
- package/schema/software_directory/ml/unit/processing/feature_selection/filter_based.json +45 -0
- package/schema/software_directory/ml/unit/processing/feature_selection.json +8 -0
- package/schema/software_directory/ml/unit/processing.json +11 -0
- package/schema/software_directory/modeling/espresso/arguments.json +44 -0
- package/schema/software_directory/modeling/espresso.json +26 -0
- package/schema/software_directory/modeling/nwchem.json +34 -0
- package/schema/software_directory/modeling/unit/execution.json +14 -0
- package/schema/software_directory/modeling/vasp.json +40 -0
- package/schema/software_directory/scripting/jupyter-lab.json +38 -0
- package/schema/software_directory/scripting/python.json +52 -0
- package/schema/software_directory/scripting/shell.json +52 -0
- package/schema/software_directory/scripting/unit/execution.json +14 -0
- package/schema/system/_material.json +19 -0
- package/schema/system/_parent_job.json +19 -0
- package/schema/system/_project.json +19 -0
- package/schema/system/bankable.json +15 -0
- package/schema/system/consistency_check.json +39 -0
- package/schema/system/creator.json +19 -0
- package/schema/system/creator_account.json +10 -0
- package/schema/system/database_source.json +40 -0
- package/schema/system/defaultable.json +12 -0
- package/schema/system/description.json +14 -0
- package/schema/system/entity_reference.json +19 -0
- package/schema/system/file_source.json +30 -0
- package/schema/system/history.json +25 -0
- package/schema/system/in_set.json +28 -0
- package/schema/system/is_multi_material.json +10 -0
- package/schema/system/is_outdated.json +10 -0
- package/schema/system/job_extended.json +39 -0
- package/schema/system/message.json +67 -0
- package/schema/system/metadata.json +10 -0
- package/schema/system/name.json +11 -0
- package/schema/system/owner.json +19 -0
- package/schema/system/path.json +11 -0
- package/schema/system/path_entity.json +13 -0
- package/schema/system/schema_version.json +12 -0
- package/schema/system/scope.json +10 -0
- package/schema/system/set.json +16 -0
- package/schema/system/sharing.json +10 -0
- package/schema/system/soft_removable.json +15 -0
- package/schema/system/status.json +31 -0
- package/schema/system/tags.json +14 -0
- package/schema/system/timestampable.json +37 -0
- package/schema/system/use_values.json +10 -0
- package/schema/workflow/base.json +39 -0
- package/schema/workflow/base_flow.json +39 -0
- package/schema/workflow/scope.json +20 -0
- package/schema/workflow/subworkflow.json +37 -0
- package/schema/workflow/unit/assertion.json +28 -0
- package/schema/workflow/unit/assignment.json +37 -0
- package/schema/workflow/unit/condition.json +51 -0
- package/schema/workflow/unit/execution.json +40 -0
- package/schema/workflow/unit/input/_input.json +22 -0
- package/schema/workflow/unit/input/_inputItem.json +20 -0
- package/schema/workflow/unit/input/_inputItemId.json +21 -0
- package/schema/workflow/unit/input/_inputItemScope.json +20 -0
- package/schema/workflow/unit/io/api.json +24 -0
- package/schema/workflow/unit/io/db.json +39 -0
- package/schema/workflow/unit/io/object_storage.json +25 -0
- package/schema/workflow/unit/io.json +53 -0
- package/schema/workflow/unit/map.json +67 -0
- package/schema/workflow/unit/processing.json +34 -0
- package/schema/workflow/unit/reduce.json +50 -0
- package/schema/workflow/unit/runtime/_runtime_item_full_object.json +15 -0
- package/schema/workflow/unit/runtime/_runtime_item_name_object.json +15 -0
- package/schema/workflow/unit/runtime/_runtime_item_string.json +7 -0
- package/schema/workflow/unit/runtime/runtime_item.json +13 -0
- package/schema/workflow/unit/runtime/runtime_items.json +36 -0
- package/schema/workflow/unit.json +65 -0
- package/schema/workflow.json +63 -0
- package/src/__init__.py +0 -0
- package/src/js/esse/index.js +47 -0
- package/src/js/esse/schemaUtils.js +45 -0
- package/src/js/esse/settings.js +4 -0
- package/src/js/esse/utils.js +52 -0
- package/src/js/json_include/index.js +71 -0
- package/src/js/json_include/settings.js +3 -0
- package/src/js/json_include/utils.js +11 -0
- package/src/js/scripts/createEnumsFromYaml.mjs +43 -0
- package/src/js/scripts/setSchemaIds.mjs +34 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buildSchemaDefinitions = buildSchemaDefinitions;
|
|
7
|
+
exports.makeFlatSchemaKey = makeFlatSchemaKey;
|
|
8
|
+
exports.makeFlatSchemaRef = makeFlatSchemaRef;
|
|
9
|
+
exports.mapObjectDeep = mapObjectDeep;
|
|
10
|
+
|
|
11
|
+
var _keyBy = _interopRequireDefault(require("lodash/keyBy"));
|
|
12
|
+
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
|
+
|
|
15
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
|
+
|
|
17
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18
|
+
|
|
19
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
20
|
+
|
|
21
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
22
|
+
|
|
23
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
24
|
+
|
|
25
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
|
+
|
|
27
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
28
|
+
|
|
29
|
+
function mapObjectDeep(object, mapValue) {
|
|
30
|
+
if (_typeof(object) !== "object") {
|
|
31
|
+
return object;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (Array.isArray(object)) {
|
|
35
|
+
return object.map(function (innerValue) {
|
|
36
|
+
return mapValue(innerValue) || mapObjectDeep(innerValue, mapValue);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var entries = Object.entries(object).map(function (_ref) {
|
|
41
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
42
|
+
key = _ref2[0],
|
|
43
|
+
value = _ref2[1];
|
|
44
|
+
|
|
45
|
+
var res = mapValue(value);
|
|
46
|
+
return [key, res === undefined ? mapObjectDeep(value, mapValue) : res];
|
|
47
|
+
});
|
|
48
|
+
return Object.fromEntries(entries);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function makeFlatSchemaKey(schemaId) {
|
|
52
|
+
return schemaId.replace(/[^a-zA-Z-]/g, ":");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function makeFlatSchemaRef(schemaId) {
|
|
56
|
+
return {
|
|
57
|
+
$ref: "#/definitions/".concat(makeFlatSchemaKey(schemaId))
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function buildSchemaDefinitions(originalSchemas) {
|
|
62
|
+
var schemas = originalSchemas.map(function (schema) {
|
|
63
|
+
return mapObjectDeep(schema, function (value) {
|
|
64
|
+
if (_typeof(value) === "object" && value.$id) {
|
|
65
|
+
return makeFlatSchemaRef(value.$id);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (_typeof(value) === "object" && value.$ref) {
|
|
69
|
+
// assume value.$ref is a $id
|
|
70
|
+
return makeFlatSchemaRef(value.$ref);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
return (0, _keyBy["default"])(schemas, function (_ref3) {
|
|
75
|
+
var $id = _ref3.$id;
|
|
76
|
+
return makeFlatSchemaKey($id);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SCHEMAS_DIR = exports.EXAMPLES_DIR = void 0;
|
|
7
|
+
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
12
|
+
var SCHEMAS_DIR = _path["default"].resolve(__dirname, "../../../schema");
|
|
13
|
+
|
|
14
|
+
exports.SCHEMAS_DIR = SCHEMAS_DIR;
|
|
15
|
+
|
|
16
|
+
var EXAMPLES_DIR = _path["default"].resolve(__dirname, "../../../example");
|
|
17
|
+
|
|
18
|
+
exports.EXAMPLES_DIR = EXAMPLES_DIR;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.parseIncludeReferenceStatements = parseIncludeReferenceStatements;
|
|
7
|
+
exports.parseIncludeReferenceStatementsByDir = parseIncludeReferenceStatementsByDir;
|
|
8
|
+
|
|
9
|
+
var _file = _interopRequireDefault(require("file"));
|
|
10
|
+
|
|
11
|
+
var _jsonSchemaDerefSync = _interopRequireDefault(require("json-schema-deref-sync"));
|
|
12
|
+
|
|
13
|
+
var _path2 = _interopRequireDefault(require("path"));
|
|
14
|
+
|
|
15
|
+
var _json_include = require("../json_include");
|
|
16
|
+
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Resolves `include` and `$ref` statements.
|
|
21
|
+
* @param filePath {String} file to parse.
|
|
22
|
+
*/
|
|
23
|
+
function parseIncludeReferenceStatements(filePath) {
|
|
24
|
+
var jsonResolver = new _json_include.JSONInclude();
|
|
25
|
+
var parsed = jsonResolver.parseIncludeStatements(filePath);
|
|
26
|
+
|
|
27
|
+
var dirPath = _path2["default"].dirname(filePath);
|
|
28
|
+
|
|
29
|
+
var dereferenced = (0, _jsonSchemaDerefSync["default"])(parsed, {
|
|
30
|
+
baseFolder: dirPath
|
|
31
|
+
}); // handle circular references and use non-dereferenced source
|
|
32
|
+
|
|
33
|
+
if (dereferenced instanceof Error && dereferenced.message === "Circular self reference") {
|
|
34
|
+
dereferenced = parsed;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return dereferenced;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Resolves `include` and `$ref` statements for all the JSON files inside a given directory.
|
|
41
|
+
* @param dirPath {String} directory to parse.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
function parseIncludeReferenceStatementsByDir(dirPath) {
|
|
46
|
+
var wrapInDataAndPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
47
|
+
var data = [];
|
|
48
|
+
|
|
49
|
+
var topDir = _path2["default"].resolve(__dirname, "../../../");
|
|
50
|
+
|
|
51
|
+
_file["default"].walkSync(dirPath, function (dirPath_, dirs_, files_) {
|
|
52
|
+
files_.forEach(function (file_) {
|
|
53
|
+
var filePath = _path2["default"].join(dirPath_, file_);
|
|
54
|
+
|
|
55
|
+
if (filePath.endsWith(".json")) {
|
|
56
|
+
var config = parseIncludeReferenceStatements(filePath);
|
|
57
|
+
|
|
58
|
+
if (wrapInDataAndPath) {
|
|
59
|
+
var _path = _path2["default"].join( // remove leading slashes and "example" from path
|
|
60
|
+
_path2["default"].dirname(filePath).replace(_path2["default"].join(topDir, "example"), "").replace(/^\/+/, ""), _path2["default"].basename(filePath).replace(".json", ""));
|
|
61
|
+
|
|
62
|
+
data.push({
|
|
63
|
+
data: config,
|
|
64
|
+
path: _path
|
|
65
|
+
});
|
|
66
|
+
} else {
|
|
67
|
+
data.push(config);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
return data;
|
|
74
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.JSONInclude = void 0;
|
|
7
|
+
|
|
8
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
+
|
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
|
11
|
+
|
|
12
|
+
var _settings = require("./settings");
|
|
13
|
+
|
|
14
|
+
var _utils = require("./utils");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
+
|
|
18
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
|
+
|
|
20
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
21
|
+
|
|
22
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
23
|
+
|
|
24
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
|
+
|
|
26
|
+
var JSONInclude = /*#__PURE__*/function () {
|
|
27
|
+
function JSONInclude() {
|
|
28
|
+
_classCallCheck(this, JSONInclude);
|
|
29
|
+
|
|
30
|
+
_defineProperty(this, "_getIncludeFileName", function (value) {
|
|
31
|
+
if ((0, _utils.isInstanceOf)(value, "String") && value.search(_settings.INCLUDE_VALUE_REGEX) !== -1) {
|
|
32
|
+
return value.match(_settings.INCLUDE_VALUE_REGEX)[1];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
this.JSON_INCLUDE_CACHE = {};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Extracts file name(path) from the include statement.
|
|
40
|
+
* @param value {String} string to extract the file name from.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
_createClass(JSONInclude, [{
|
|
45
|
+
key: "_walkObjectToInclude",
|
|
46
|
+
value:
|
|
47
|
+
/**
|
|
48
|
+
* Walks a nested object to resolve include statements.
|
|
49
|
+
* @param obj {Object} Object to traverse.
|
|
50
|
+
* @param dirpath {String} directory from which `obj` is obtained. Include statements are relative to `obj` path.
|
|
51
|
+
*/
|
|
52
|
+
function _walkObjectToInclude(obj, dirpath) {
|
|
53
|
+
var _this = this;
|
|
54
|
+
|
|
55
|
+
if ((0, _utils.isInstanceOf)(obj, "Object")) {
|
|
56
|
+
if (_settings.INCLUDE_KEY in obj) {
|
|
57
|
+
var includeName = this._getIncludeFileName(obj[_settings.INCLUDE_KEY]);
|
|
58
|
+
|
|
59
|
+
if (includeName) {
|
|
60
|
+
delete obj[_settings.INCLUDE_KEY];
|
|
61
|
+
|
|
62
|
+
if (!(includeName in this.JSON_INCLUDE_CACHE)) {
|
|
63
|
+
var filePath = _path["default"].join(dirpath, includeName);
|
|
64
|
+
|
|
65
|
+
this.JSON_INCLUDE_CACHE[includeName] = this.parseIncludeStatements(filePath);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
Object.keys(this.JSON_INCLUDE_CACHE[includeName]).forEach(function (attr) {
|
|
69
|
+
obj[attr] = _this.JSON_INCLUDE_CACHE[includeName][attr];
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
Object.keys(obj).forEach(function (key) {
|
|
75
|
+
if ((0, _utils.isInstanceOf)(obj[key], "Object") || (0, _utils.isInstanceOf)(obj[key], "Array")) {
|
|
76
|
+
_this._walkObjectToInclude(obj[key], dirpath);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
} else if ((0, _utils.isInstanceOf)(obj, "Array")) {
|
|
80
|
+
for (var i = 0; i < obj.length; i++) {
|
|
81
|
+
if ((0, _utils.isInstanceOf)(obj[i], "Object") || (0, _utils.isInstanceOf)(obj[i], "Array")) {
|
|
82
|
+
this._walkObjectToInclude(obj[i], dirpath);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Resolves `include` statements.
|
|
89
|
+
* @param filePath {String} file to parse.
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
}, {
|
|
93
|
+
key: "parseIncludeStatements",
|
|
94
|
+
value: function parseIncludeStatements(filePath) {
|
|
95
|
+
var data = (0, _utils.safeParseJSON)(_fs["default"].readFileSync(filePath, "utf8"));
|
|
96
|
+
|
|
97
|
+
if (_settings.OBJECT_ONLY && !(0, _utils.isInstanceOf)(data, "Object")) {
|
|
98
|
+
throw new Error("The JSON file being included should always be a dict rather than a list");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
this._walkObjectToInclude(data, _path["default"].dirname(filePath));
|
|
102
|
+
|
|
103
|
+
return data;
|
|
104
|
+
}
|
|
105
|
+
}]);
|
|
106
|
+
|
|
107
|
+
return JSONInclude;
|
|
108
|
+
}();
|
|
109
|
+
|
|
110
|
+
exports.JSONInclude = JSONInclude;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.OBJECT_ONLY = exports.INCLUDE_VALUE_REGEX = exports.INCLUDE_KEY = void 0;
|
|
7
|
+
var INCLUDE_KEY = "...";
|
|
8
|
+
exports.INCLUDE_KEY = INCLUDE_KEY;
|
|
9
|
+
var INCLUDE_VALUE_REGEX = /^include\((.+)\)$/;
|
|
10
|
+
exports.INCLUDE_VALUE_REGEX = INCLUDE_VALUE_REGEX;
|
|
11
|
+
var OBJECT_ONLY = false; // whether to only include Object, and not Array.
|
|
12
|
+
|
|
13
|
+
exports.OBJECT_ONLY = OBJECT_ONLY;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isInstanceOf = isInstanceOf;
|
|
7
|
+
exports.safeParseJSON = safeParseJSON;
|
|
8
|
+
|
|
9
|
+
function isInstanceOf(object, type) {
|
|
10
|
+
return Object.prototype.toString.call(object).slice(8, -1) === type;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Makes sure that text representing arrays is parsed into Arrays.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
function safeParseJSON(string) {
|
|
18
|
+
var obj = JSON.parse(string);
|
|
19
|
+
return string[0] === "[" ? Object.keys(obj).map(function (key) {
|
|
20
|
+
return obj[key];
|
|
21
|
+
}) : obj;
|
|
22
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
4
|
+
|
|
5
|
+
var _jsYaml = _interopRequireDefault(require("js-yaml"));
|
|
6
|
+
|
|
7
|
+
var _path = _interopRequireDefault(require("path"));
|
|
8
|
+
|
|
9
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
+
|
|
13
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
14
|
+
|
|
15
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
+
|
|
17
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* We use YAML files to list enum options which need to be reused in other places.
|
|
21
|
+
* The format also allows for additional context to the often shortened slugs, such as DOIs.
|
|
22
|
+
* This script converts the enum lists to JSON files for $ref blocks inside schemas.
|
|
23
|
+
*/
|
|
24
|
+
var SCHEMA_DIR = "../../../schema/";
|
|
25
|
+
|
|
26
|
+
function walkDir(dir, callback) {
|
|
27
|
+
var subDirs = _fs["default"].readdirSync(dir);
|
|
28
|
+
|
|
29
|
+
var _iterator = _createForOfIteratorHelper(subDirs),
|
|
30
|
+
_step;
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
34
|
+
var subDir = _step.value;
|
|
35
|
+
|
|
36
|
+
var itemPath = _path["default"].join(dir, subDir);
|
|
37
|
+
|
|
38
|
+
var stat = _fs["default"].statSync(itemPath);
|
|
39
|
+
|
|
40
|
+
if (stat.isDirectory()) {
|
|
41
|
+
walkDir(itemPath, callback);
|
|
42
|
+
} else {
|
|
43
|
+
callback(itemPath);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
} catch (err) {
|
|
47
|
+
_iterator.e(err);
|
|
48
|
+
} finally {
|
|
49
|
+
_iterator.f();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
walkDir(SCHEMA_DIR, function (filePath) {
|
|
54
|
+
if (_path["default"].extname(filePath) !== ".yml") {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
console.log(filePath);
|
|
59
|
+
var outFilename = "".concat(_path["default"].basename(filePath, ".yml"), ".json");
|
|
60
|
+
|
|
61
|
+
var dirname = _path["default"].dirname(filePath);
|
|
62
|
+
|
|
63
|
+
var fileContents = _fs["default"].readFileSync(filePath);
|
|
64
|
+
|
|
65
|
+
var obj = _jsYaml["default"].load(fileContents);
|
|
66
|
+
|
|
67
|
+
var enumObj = _lodash["default"].mapValues(obj, function (value) {
|
|
68
|
+
return {
|
|
69
|
+
"enum": value
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
_fs["default"].writeFileSync("".concat(_path["default"].join(dirname, outFilename)), "".concat(JSON.stringify(enumObj, null, 4), "\n"));
|
|
74
|
+
});
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _promises = _interopRequireDefault(require("fs/promises"));
|
|
4
|
+
|
|
5
|
+
var _path = _interopRequireDefault(require("path"));
|
|
6
|
+
|
|
7
|
+
var _excluded = ["$id"];
|
|
8
|
+
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
+
|
|
11
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
12
|
+
|
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
+
|
|
15
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
16
|
+
|
|
17
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
18
|
+
|
|
19
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
|
+
|
|
21
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
22
|
+
|
|
23
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
24
|
+
|
|
25
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
26
|
+
|
|
27
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
28
|
+
|
|
29
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
30
|
+
|
|
31
|
+
var SCHEMA_DIR = "../../../schema/";
|
|
32
|
+
|
|
33
|
+
function walkDir(_x, _x2) {
|
|
34
|
+
return _walkDir.apply(this, arguments);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function _walkDir() {
|
|
38
|
+
_walkDir = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(dir, callback) {
|
|
39
|
+
var subDirs, _iterator, _step, subDir, itemPath, stat;
|
|
40
|
+
|
|
41
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
42
|
+
while (1) {
|
|
43
|
+
switch (_context2.prev = _context2.next) {
|
|
44
|
+
case 0:
|
|
45
|
+
_context2.next = 2;
|
|
46
|
+
return _promises["default"].readdir(dir);
|
|
47
|
+
|
|
48
|
+
case 2:
|
|
49
|
+
subDirs = _context2.sent;
|
|
50
|
+
_iterator = _createForOfIteratorHelper(subDirs);
|
|
51
|
+
_context2.prev = 4;
|
|
52
|
+
|
|
53
|
+
_iterator.s();
|
|
54
|
+
|
|
55
|
+
case 6:
|
|
56
|
+
if ((_step = _iterator.n()).done) {
|
|
57
|
+
_context2.next = 21;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
subDir = _step.value;
|
|
62
|
+
itemPath = _path["default"].join(dir, subDir);
|
|
63
|
+
_context2.next = 11;
|
|
64
|
+
return _promises["default"].stat(itemPath);
|
|
65
|
+
|
|
66
|
+
case 11:
|
|
67
|
+
stat = _context2.sent;
|
|
68
|
+
|
|
69
|
+
if (!stat.isDirectory()) {
|
|
70
|
+
_context2.next = 17;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
_context2.next = 15;
|
|
75
|
+
return walkDir(itemPath, callback);
|
|
76
|
+
|
|
77
|
+
case 15:
|
|
78
|
+
_context2.next = 19;
|
|
79
|
+
break;
|
|
80
|
+
|
|
81
|
+
case 17:
|
|
82
|
+
_context2.next = 19;
|
|
83
|
+
return callback(itemPath);
|
|
84
|
+
|
|
85
|
+
case 19:
|
|
86
|
+
_context2.next = 6;
|
|
87
|
+
break;
|
|
88
|
+
|
|
89
|
+
case 21:
|
|
90
|
+
_context2.next = 26;
|
|
91
|
+
break;
|
|
92
|
+
|
|
93
|
+
case 23:
|
|
94
|
+
_context2.prev = 23;
|
|
95
|
+
_context2.t0 = _context2["catch"](4);
|
|
96
|
+
|
|
97
|
+
_iterator.e(_context2.t0);
|
|
98
|
+
|
|
99
|
+
case 26:
|
|
100
|
+
_context2.prev = 26;
|
|
101
|
+
|
|
102
|
+
_iterator.f();
|
|
103
|
+
|
|
104
|
+
return _context2.finish(26);
|
|
105
|
+
|
|
106
|
+
case 29:
|
|
107
|
+
case "end":
|
|
108
|
+
return _context2.stop();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}, _callee2, null, [[4, 23, 26, 29]]);
|
|
112
|
+
}));
|
|
113
|
+
return _walkDir.apply(this, arguments);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
await walkDir(SCHEMA_DIR, /*#__PURE__*/function () {
|
|
117
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(filePath) {
|
|
118
|
+
var fileContents, _JSON$parse, oldSchemaId, schema, schemaId, newContent;
|
|
119
|
+
|
|
120
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
121
|
+
while (1) {
|
|
122
|
+
switch (_context.prev = _context.next) {
|
|
123
|
+
case 0:
|
|
124
|
+
if (!(_path["default"].extname(filePath) !== ".json")) {
|
|
125
|
+
_context.next = 2;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return _context.abrupt("return");
|
|
130
|
+
|
|
131
|
+
case 2:
|
|
132
|
+
_context.next = 4;
|
|
133
|
+
return _promises["default"].readFile(filePath);
|
|
134
|
+
|
|
135
|
+
case 4:
|
|
136
|
+
fileContents = _context.sent;
|
|
137
|
+
_JSON$parse = JSON.parse(fileContents), oldSchemaId = _JSON$parse.$id, schema = _objectWithoutProperties(_JSON$parse, _excluded);
|
|
138
|
+
schemaId = filePath.replace(SCHEMA_DIR, "").replace(".json", "").replace(/_/g, "-");
|
|
139
|
+
newContent = JSON.stringify(_objectSpread({
|
|
140
|
+
$id: schemaId
|
|
141
|
+
}, schema), null, 4);
|
|
142
|
+
_context.next = 10;
|
|
143
|
+
return _promises["default"].writeFile(filePath, "".concat(newContent, "\n"));
|
|
144
|
+
|
|
145
|
+
case 10:
|
|
146
|
+
case "end":
|
|
147
|
+
return _context.stop();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}, _callee);
|
|
151
|
+
}));
|
|
152
|
+
|
|
153
|
+
return function (_x3) {
|
|
154
|
+
return _ref.apply(this, arguments);
|
|
155
|
+
};
|
|
156
|
+
}());
|
package/npmignore
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mat3ra/esse",
|
|
3
|
+
"version": "2023.12.25-2",
|
|
4
|
+
"description": "Mat3ra's Excellent Source of Schemas and Examples (ESSE) for Digital Materials R&D",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"prepublishOnly": "rm -rf lib; npm run transpile",
|
|
7
|
+
"transpile": "mkdir -p lib; babel src/js --out-dir lib/js; node build_schemas.js",
|
|
8
|
+
"transpile-and-build-assets": "mkdir -p lib; babel src/js --out-dir lib/js; BUILD_ASSETS=true BUILD_PATH='./lib/js' node build_schemas.js",
|
|
9
|
+
"build:assets": "node build_schemas.js",
|
|
10
|
+
"build:assets-with-docs": "BUILD_ASSETS=true node build_schemas.js",
|
|
11
|
+
"test": "nyc --reporter=text mocha --bail --require @babel/register tests/js/",
|
|
12
|
+
"lint": "eslint src/js && prettier --write src/js",
|
|
13
|
+
"lint:fix": "eslint --fix --cache src/js && prettier --write src/js",
|
|
14
|
+
"prettier": "prettier --check src/js",
|
|
15
|
+
"postinstall": "npm run transpile-and-build-assets",
|
|
16
|
+
"prepare": "husky install || exit 0",
|
|
17
|
+
"setSchemaIds": "cd src/js/scripts && node setSchemaIds.mjs"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/Exabyte-io/esse.git"
|
|
22
|
+
},
|
|
23
|
+
"main": "lib/js/esse/index.js",
|
|
24
|
+
"author": "Mat3ra.com",
|
|
25
|
+
"email": "info@mat3ra.com",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/Exabyte-io/exabyte-esse/issues"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://github.com/Exabyte-io/esse",
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@exabyte-io/eslint-config": "^2022.11.17-0",
|
|
32
|
+
"chai": "4.3.4",
|
|
33
|
+
"eslint": "^7.32.0",
|
|
34
|
+
"eslint-config-airbnb": "^19.0.2",
|
|
35
|
+
"eslint-config-prettier": "^8.3.0",
|
|
36
|
+
"eslint-plugin-import": "^2.25.3",
|
|
37
|
+
"eslint-plugin-jsdoc": "^37.1.0",
|
|
38
|
+
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
39
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
40
|
+
"eslint-plugin-react": "^7.27.1",
|
|
41
|
+
"eslint-plugin-react-hooks": "^4.3.0",
|
|
42
|
+
"eslint-plugin-simple-import-sort": "^7.0.0",
|
|
43
|
+
"husky": "^7.0.4",
|
|
44
|
+
"lint-staged": "^12.1.2",
|
|
45
|
+
"mocha": "^9.2.0",
|
|
46
|
+
"nyc": "15.1.0",
|
|
47
|
+
"prettier": "^2.5.1",
|
|
48
|
+
"prettyjson": "^1.1.3"
|
|
49
|
+
},
|
|
50
|
+
"license": "Apache-2.0",
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@babel/cli": "7.16.0",
|
|
53
|
+
"@babel/core": "7.16.0",
|
|
54
|
+
"@babel/eslint-parser": "7.16.3",
|
|
55
|
+
"@babel/preset-env": "7.16.4",
|
|
56
|
+
"@babel/register": "7.16.0",
|
|
57
|
+
"ajv": "^4.1.7",
|
|
58
|
+
"file": "^0.2.2",
|
|
59
|
+
"js-yaml": "^4.1.0",
|
|
60
|
+
"json-schema-deref-sync": "0.14.0",
|
|
61
|
+
"json-schema-merge-allof": "^0.8.1",
|
|
62
|
+
"lodash": "4.17.21"
|
|
63
|
+
},
|
|
64
|
+
"engines": {
|
|
65
|
+
"node": ">=12.0.0"
|
|
66
|
+
},
|
|
67
|
+
"lint-staged": {
|
|
68
|
+
"*.js": "eslint --cache --fix",
|
|
69
|
+
"*.{js,css}": "prettier --write"
|
|
70
|
+
},
|
|
71
|
+
"exports": {
|
|
72
|
+
"./schema": "./schema.js",
|
|
73
|
+
"./lib/js/esse/schemaUtils": "./lib/js/esse/schemaUtils.js"
|
|
74
|
+
}
|
|
75
|
+
}
|