Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/js/esse/JSONSchemasInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ class JSONSchemasInterface {
return patchedSchema;
}
}
exports.default = JSONSchemasInterface;
JSONSchemasInterface.schemasCache = new Map();
exports.default = JSONSchemasInterface;
5 changes: 2 additions & 3 deletions dist/js/esse/JSONSchemasInterfaceServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.readSchemaFolderSync = void 0;
exports.readSchemaFolderSync = readSchemaFolderSync;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const filesystem_1 = require("../utils/filesystem");
Expand All @@ -19,7 +19,6 @@ function readSchemaFolderSync(folderPath) {
});
return schemas;
}
exports.readSchemaFolderSync = readSchemaFolderSync;
class JSONSchemasInterfaceServer extends JSONSchemasInterface_1.default {
static setSchemaFolder(schemaFolder) {
if (this.schemaFolder !== schemaFolder) {
Expand All @@ -42,5 +41,5 @@ class JSONSchemasInterfaceServer extends JSONSchemasInterface_1.default {
return super.getSchemaById(schemaId);
}
}
exports.default = JSONSchemasInterfaceServer;
JSONSchemasInterfaceServer.schemaFolder = path_1.default.resolve(__dirname, "./../schema");
exports.default = JSONSchemasInterfaceServer;
3 changes: 1 addition & 2 deletions dist/js/esse/schemaUtils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mapObjectDeep = void 0;
exports.mapObjectDeep = mapObjectDeep;
function mapObjectDeep(object, mapValue) {
if (typeof object !== "object" || object === null) {
return object;
Expand All @@ -14,4 +14,3 @@ function mapObjectDeep(object, mapValue) {
});
return Object.fromEntries(entries);
}
exports.mapObjectDeep = mapObjectDeep;
5 changes: 2 additions & 3 deletions dist/js/esse/server/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseIncludeReferenceStatementsByDir = exports.parseIncludeReferenceStatements = void 0;
exports.parseIncludeReferenceStatements = parseIncludeReferenceStatements;
exports.parseIncludeReferenceStatementsByDir = parseIncludeReferenceStatementsByDir;
/**
* Server-side schema parsing utilities.
*
Expand Down Expand Up @@ -37,7 +38,6 @@ function parseIncludeReferenceStatements(filePath) {
}
return dereferenced;
}
exports.parseIncludeReferenceStatements = parseIncludeReferenceStatements;
/**
* Resolves `include` and `$ref` statements for all the JSON files inside a given directory.
* @param dirPath directory to parse.
Expand Down Expand Up @@ -65,4 +65,3 @@ function parseIncludeReferenceStatementsByDir(dirPath, wrapInDataAndPath = false
});
return wrapInDataAndPath ? schemasWithPath : schemas;
}
exports.parseIncludeReferenceStatementsByDir = parseIncludeReferenceStatementsByDir;
5 changes: 2 additions & 3 deletions dist/js/esse/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyPatchTree = exports.applyPatchWithDotNotation = void 0;
exports.applyPatchWithDotNotation = applyPatchWithDotNotation;
exports.applyPatchTree = applyPatchTree;
function isPlainObject(value) {
return value !== null && typeof value === "object" && !Array.isArray(value);
}
Expand Down Expand Up @@ -28,7 +29,6 @@ function applyPatchWithDotNotation(target, path, patchValue) {
}
// If existingValue is undefined, we skip;
}
exports.applyPatchWithDotNotation = applyPatchWithDotNotation;
function applyPatchTree(schema, patchNode, pathPrefix) {
Object.entries(patchNode).forEach(([key, value]) => {
if (key.includes(".")) {
Expand All @@ -49,4 +49,3 @@ function applyPatchTree(schema, patchNode, pathPrefix) {
}
});
}
exports.applyPatchTree = applyPatchTree;
1 change: 1 addition & 0 deletions dist/js/schema/properties_directory/enum_options.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"type": "string",
"enum": [
"fermi_energy",
"formation_energy",
"homo_energy",
"ionization_potential",
"lumo_energy",
Expand Down
42 changes: 42 additions & 0 deletions dist/js/schema/property/holder.json
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,48 @@
}
}
},
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Formation energy property schema",
"type": "object",
"required": [
"name",
"units",
"value"
],
"properties": {
"name": {
"enum": [
"formation_energy"
],
"type": "string"
},
"units": {
"oneOf": [
{
"enum": [
"kcal/mol",
"kJ/mol",
"eV",
"J/mol",
"hartree",
"cm-1",
"Ry",
"eV/atom"
]
},
{
"enum": [
"eV/A^2"
]
}
]
},
"value": {
"type": "number"
}
}
},
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "HOMO energy property schema",
Expand Down
2 changes: 1 addition & 1 deletion dist/js/schemas.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/scripts/compileTs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = compileTS;
const fs_1 = __importDefault(require("fs"));
const json_schema_to_typescript_1 = require("json-schema-to-typescript");
const schemaUtils_1 = require("../esse/schemaUtils");
Expand Down Expand Up @@ -77,4 +78,3 @@ async function compileTS(schemaPath, savePath) {
await fs_1.default.promises.appendFile(savePath, `${compiledSchema} \n`, { flag: "a+" });
});
}
exports.default = compileTS;
2 changes: 1 addition & 1 deletion dist/js/scripts/setSchemaIds.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = setSchemaIds;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const filesystem_1 = require("../utils/filesystem");
Expand All @@ -27,4 +28,3 @@ function setSchemaIds(schemaDir) {
}
});
}
exports.default = setSchemaIds;
6 changes: 5 additions & 1 deletion dist/js/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52195,7 +52195,7 @@ export type PropertyType = "scalar" | "non-scalar" | "tensor" | "object";
* This interface was referenced by `PropertiesDirectoryEnumOptions`'s JSON-Schema
* via the `definition` "ScalarPropertyEnum".
*/
export type ScalarPropertyEnum = "fermi_energy" | "homo_energy" | "ionization_potential" | "lumo_energy" | "pressure" | "reaction_energy_barrier" | "surface_energy" | "thermal_correction_to_energy" | "thermal_correction_to_enthalpy" | "total_energy" | "total_force" | "valence_band_offset" | "zero_point_energy";
export type ScalarPropertyEnum = "fermi_energy" | "formation_energy" | "homo_energy" | "ionization_potential" | "lumo_energy" | "pressure" | "reaction_energy_barrier" | "surface_energy" | "thermal_correction_to_energy" | "thermal_correction_to_enthalpy" | "total_energy" | "total_force" | "valence_band_offset" | "zero_point_energy";
/**
* This interface was referenced by `PropertiesDirectoryEnumOptions`'s JSON-Schema
* via the `definition` "NonScalarPropertyEnum".
Expand Down Expand Up @@ -55908,6 +55908,10 @@ export interface PropertyHolderSchema {
name: "fermi_energy";
units: ("kcal/mol" | "kJ/mol" | "eV" | "J/mol" | "hartree" | "cm-1" | "Ry" | "eV/atom") | "eV/A^2";
value: number;
} | {
name: "formation_energy";
units: ("kcal/mol" | "kJ/mol" | "eV" | "J/mol" | "hartree" | "cm-1" | "Ry" | "eV/atom") | "eV/A^2";
value: number;
} | {
name: "homo_energy";
units: ("kcal/mol" | "kJ/mol" | "eV" | "J/mol" | "hartree" | "cm-1" | "Ry" | "eV/atom") | "eV/A^2";
Expand Down
10 changes: 5 additions & 5 deletions dist/js/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var Name;
Name["VASPInputDataManager"] = "VASPInputDataManager";
Name["VASPNEBInputDataManager"] = "VASPNEBInputDataManager";
Name["NWChemInputDataManager"] = "NWChemInputDataManager";
})(Name = exports.Name || (exports.Name = {}));
})(Name || (exports.Name = Name = {}));
/**
* This interface was referenced by `ContextProvidersDirectoryEnum`'s JSON-Schema
* via the `definition` "ContextProviderNameEnum".
Expand Down Expand Up @@ -61,15 +61,15 @@ var ContextProviderNameEnum;
ContextProviderNameEnum["VASPInputDataManager"] = "VASPInputDataManager";
ContextProviderNameEnum["VASPNEBInputDataManager"] = "VASPNEBInputDataManager";
ContextProviderNameEnum["NWChemInputDataManager"] = "NWChemInputDataManager";
})(ContextProviderNameEnum = exports.ContextProviderNameEnum || (exports.ContextProviderNameEnum = {}));
})(ContextProviderNameEnum || (exports.ContextProviderNameEnum = ContextProviderNameEnum = {}));
/**
* The type of the message to distinguish the direction of the message.
*/
var Type;
(function (Type) {
Type["fromIframeToHost"] = "from-iframe-to-host";
Type["fromHostToIframe"] = "from-host-to-iframe";
})(Type = exports.Type || (exports.Type = {}));
})(Type || (exports.Type = Type = {}));
/**
* The action to be performed upon receiving the message.
*/
Expand All @@ -78,7 +78,7 @@ var Action;
Action["setData"] = "set-data";
Action["getData"] = "get-data";
Action["info"] = "info";
})(Action = exports.Action || (exports.Action = {}));
})(Action || (exports.Action = Action = {}));
/**
* This interface was referenced by `WorkflowSubworkflowConvergenceEnumOptions`'s JSON-Schema
* via the `definition` "ConvergenceParameterNameEnum".
Expand All @@ -88,4 +88,4 @@ var ConvergenceParameterNameEnum;
ConvergenceParameterNameEnum["N_k"] = "N_k";
ConvergenceParameterNameEnum["N_k_nonuniform"] = "N_k_nonuniform";
ConvergenceParameterNameEnum["N_k_nonuniform_2D"] = "N_k_nonuniform_2D";
})(ConvergenceParameterNameEnum = exports.ConvergenceParameterNameEnum || (exports.ConvergenceParameterNameEnum = {}));
})(ConvergenceParameterNameEnum || (exports.ConvergenceParameterNameEnum = ConvergenceParameterNameEnum = {}));
9 changes: 4 additions & 5 deletions dist/js/utils/ajv.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateAndClean = exports.validate = exports.getValidator = void 0;
exports.getValidator = getValidator;
exports.validate = validate;
exports.validateAndClean = validateAndClean;
const ajv_1 = __importDefault(require("ajv"));
const ajv_formats_1 = __importDefault(require("ajv-formats"));
const schemaUtils_1 = require("../esse/schemaUtils");
Expand All @@ -23,7 +25,7 @@ function addAdditionalPropertiesToSchema(schema, additionalProperties = false) {
});
}
const ajvConfig = {
strict: false,
strict: false, // TODO: adjust schemas and enable strict mode

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comes from the src when you transpile on commit

useDefaults: true,
/**
* discriminator fixes default values in oneOf
Expand Down Expand Up @@ -80,7 +82,6 @@ function getValidator(jsonSchema, { clean, coerceTypes, useDefaults = true, }) {
}
return validate;
}
exports.getValidator = getValidator;
/**
* Validates a given example against the schema.
* @param example example to validate.
Expand All @@ -95,7 +96,6 @@ function validate(data, jsonSchema) {
errors: validator.errors,
};
}
exports.validate = validate;
/**
* Validates and clean a given example against the schema
* @param example example to validate.
Expand All @@ -110,4 +110,3 @@ function validateAndClean(data, jsonSchema, { coerceTypes = false, useDefaults =
errors: validator.errors,
};
}
exports.validateAndClean = validateAndClean;
5 changes: 2 additions & 3 deletions dist/js/utils/common.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.safeParseJSON = exports.isInstanceOf = void 0;
exports.isInstanceOf = isInstanceOf;
exports.safeParseJSON = safeParseJSON;
function isInstanceOf(object, type) {
return Object.prototype.toString.call(object).slice(8, -1) === type;
}
exports.isInstanceOf = isInstanceOf;
/**
* Makes sure that text representing arrays is parsed into Arrays.
*/
function safeParseJSON(string) {
const obj = JSON.parse(string);
return string[0] === "[" ? Object.keys(obj).map((key) => obj[key]) : obj;
}
exports.safeParseJSON = safeParseJSON;
5 changes: 2 additions & 3 deletions dist/js/utils/filesystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.walkDirSync = exports.walkDir = void 0;
exports.walkDir = walkDir;
exports.walkDirSync = walkDirSync;
/* eslint-disable no-await-in-loop */
/* eslint-disable no-restricted-syntax */
const fs_1 = __importDefault(require("fs"));
Expand All @@ -21,7 +22,6 @@ async function walkDir(dir, callback) {
}
}
}
exports.walkDir = walkDir;
function walkDirSync(dir, callback) {
const subDirs = fs_1.default.readdirSync(dir);
for (const subDir of subDirs) {
Expand All @@ -35,4 +35,3 @@ function walkDirSync(dir, callback) {
}
}
}
exports.walkDirSync = walkDirSync;
6 changes: 6 additions & 0 deletions manifest/properties.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ lumo_energy:
schemaId: properties-directory/scalar/lumo-energy
isResult: true

formation_energy:
defaults:
units: eV/atom
schemaId: properties-directory/scalar/formation-energy
isResult: true

total_force:
defaults:
units: eV/angstrom
Expand Down
2 changes: 2 additions & 0 deletions schema/properties_directory/enum_options.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"type": "string",
"enum": [
"fermi_energy",
"formation_energy",
"homo_energy",
"ionization_potential",
"lumo_energy",
Expand Down Expand Up @@ -91,3 +92,4 @@
}
}
}

3 changes: 2 additions & 1 deletion schema/properties_directory/scalar/formation_energy.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
}
},
"required": [
"name"
"name",
"units"
]
}
4 changes: 4 additions & 0 deletions schema/property/holder.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
{
"$ref": "../properties_directory/scalar/fermi_energy.json"
},
{
"$ref": "../properties_directory/scalar/formation_energy.json"
Comment thread
timurbazhirov marked this conversation as resolved.
},
{
"$ref": "../properties_directory/scalar/homo_energy.json"
},
Expand Down Expand Up @@ -193,3 +196,4 @@
"exabyteId"
]
}

Loading
Loading