@mat3ra/esse 2025.11.7-0 → 2025.11.25-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/dist/js/esse/JSONSchemasInterface.d.ts +13 -0
- package/dist/js/esse/JSONSchemasInterface.js +22 -0
- package/dist/js/esse/utils.d.ts +2 -0
- package/dist/js/esse/utils.js +50 -1
- package/dist/js/schema/context_provider.json +93 -0
- package/dist/js/schema/context_providers_directory/boundary_conditions_provider.json +24 -0
- package/dist/js/schema/context_providers_directory/enum.json +62 -0
- package/dist/js/schema/methods_directory/legacy/localorbital.json +2 -6
- package/dist/js/schema/methods_directory/legacy/pseudopotential.json +2 -3
- package/dist/js/schema/methods_directory/legacy/unknown.json +2 -6
- package/dist/js/schema/models_directory/legacy/dft.json +7 -21
- package/dist/js/schemas.json +1 -1
- package/dist/js/types.d.ts +98 -0
- package/dist/js/types.js +61 -1
- package/package.json +2 -1
- package/schema/context_provider.json +39 -0
- package/schema/context_providers_directory/boundary_conditions_provider.json +24 -0
- package/schema/context_providers_directory/enum.json +62 -0
- package/schema/methods_directory/legacy/localorbital.json +2 -6
- package/schema/methods_directory/legacy/pseudopotential.json +3 -4
- package/schema/methods_directory/legacy/unknown.json +2 -6
- package/schema/models_directory/legacy/dft.json +4 -12
- package/src/js/esse/JSONSchemasInterface.ts +33 -1
- package/src/js/esse/utils.ts +58 -0
|
@@ -28,4 +28,17 @@ export default class JSONSchemasInterface {
|
|
|
28
28
|
* })
|
|
29
29
|
*/
|
|
30
30
|
static matchSchema(query: JSONSchemasInterfaceQuery): import("json-schema").JSONSchema7 | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Get a patched copy of a schema without modifying the cached version
|
|
33
|
+
* @param schemaId - The ID of the schema to patch
|
|
34
|
+
* @param propertyPatches - Object with property names as keys and patch objects as values
|
|
35
|
+
* @returns A new schema with patched properties
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* JSONSchemasInterface.getPatchedSchema("boundary-conditions-provider", {
|
|
39
|
+
* type: { default: "pbc" },
|
|
40
|
+
* offset: { default: 0 }
|
|
41
|
+
* });
|
|
42
|
+
*/
|
|
43
|
+
static getPatchedSchemaById(schemaId: string, patchConfig: Record<string, unknown>): JSONSchema | undefined;
|
|
31
44
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("./utils");
|
|
3
4
|
class JSONSchemasInterface {
|
|
4
5
|
static setSchemas(schema) {
|
|
5
6
|
schema.forEach((schema) => this.addSchema(schema));
|
|
@@ -43,6 +44,27 @@ class JSONSchemasInterface {
|
|
|
43
44
|
});
|
|
44
45
|
});
|
|
45
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Get a patched copy of a schema without modifying the cached version
|
|
49
|
+
* @param schemaId - The ID of the schema to patch
|
|
50
|
+
* @param propertyPatches - Object with property names as keys and patch objects as values
|
|
51
|
+
* @returns A new schema with patched properties
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* JSONSchemasInterface.getPatchedSchema("boundary-conditions-provider", {
|
|
55
|
+
* type: { default: "pbc" },
|
|
56
|
+
* offset: { default: 0 }
|
|
57
|
+
* });
|
|
58
|
+
*/
|
|
59
|
+
static getPatchedSchemaById(schemaId, patchConfig) {
|
|
60
|
+
const baseSchema = this.getSchemaById(schemaId);
|
|
61
|
+
if (!baseSchema) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
const patchedSchema = JSON.parse(JSON.stringify(baseSchema));
|
|
65
|
+
(0, utils_1.applyPatchTree)(patchedSchema, patchConfig, []);
|
|
66
|
+
return patchedSchema;
|
|
67
|
+
}
|
|
46
68
|
}
|
|
47
69
|
exports.default = JSONSchemasInterface;
|
|
48
70
|
JSONSchemasInterface.schemasCache = new Map();
|
package/dist/js/esse/utils.d.ts
CHANGED
|
@@ -12,3 +12,5 @@ export interface JSONSchemaWithPath {
|
|
|
12
12
|
}
|
|
13
13
|
export declare function parseIncludeReferenceStatementsByDir(dirPath: string, wrapInDataAndPath: true): JSONSchemaWithPath[];
|
|
14
14
|
export declare function parseIncludeReferenceStatementsByDir(dirPath: string, wrapInDataAndPath?: false): JSONSchema[];
|
|
15
|
+
export declare function applyPatchWithDotNotation(target: Record<string, unknown>, path: string, patchValue: unknown): void;
|
|
16
|
+
export declare function applyPatchTree(schema: Record<string, unknown>, patchNode: Record<string, unknown>, pathPrefix: string[]): void;
|
package/dist/js/esse/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parseIncludeReferenceStatementsByDir = exports.parseIncludeReferenceStatements = void 0;
|
|
6
|
+
exports.applyPatchTree = exports.applyPatchWithDotNotation = exports.parseIncludeReferenceStatementsByDir = exports.parseIncludeReferenceStatements = void 0;
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
const json_schema_deref_sync_1 = __importDefault(require("json-schema-deref-sync"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
@@ -59,3 +59,52 @@ function parseIncludeReferenceStatementsByDir(dirPath, wrapInDataAndPath = false
|
|
|
59
59
|
return wrapInDataAndPath ? schemasWithPath : schemas;
|
|
60
60
|
}
|
|
61
61
|
exports.parseIncludeReferenceStatementsByDir = parseIncludeReferenceStatementsByDir;
|
|
62
|
+
function isPlainObject(value) {
|
|
63
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
64
|
+
}
|
|
65
|
+
function applyPatchWithDotNotation(target, path, patchValue) {
|
|
66
|
+
const keys = path.split(".");
|
|
67
|
+
let current = target;
|
|
68
|
+
// Navigate to parent of final key
|
|
69
|
+
for (let index = 0; index < keys.length - 1; index += 1) {
|
|
70
|
+
const key = keys[index];
|
|
71
|
+
if (!isPlainObject(current[key])) {
|
|
72
|
+
// Path does not exist or is not an object → skip patch
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
current = current[key];
|
|
76
|
+
}
|
|
77
|
+
const finalKey = keys[keys.length - 1];
|
|
78
|
+
const existingValue = current[finalKey];
|
|
79
|
+
if (isPlainObject(existingValue) && isPlainObject(patchValue)) {
|
|
80
|
+
// Merge object into existing object
|
|
81
|
+
Object.assign(existingValue, patchValue);
|
|
82
|
+
}
|
|
83
|
+
else if (existingValue !== undefined) {
|
|
84
|
+
// Overwrite leaf value
|
|
85
|
+
current[finalKey] = patchValue;
|
|
86
|
+
}
|
|
87
|
+
// If existingValue is undefined, we skip;
|
|
88
|
+
}
|
|
89
|
+
exports.applyPatchWithDotNotation = applyPatchWithDotNotation;
|
|
90
|
+
function applyPatchTree(schema, patchNode, pathPrefix) {
|
|
91
|
+
Object.entries(patchNode).forEach(([key, value]) => {
|
|
92
|
+
if (key.includes(".")) {
|
|
93
|
+
// Dot notation relative to current prefix
|
|
94
|
+
const fullPathSegments = [...pathPrefix, ...key.split(".")];
|
|
95
|
+
const fullPath = fullPathSegments.join(".");
|
|
96
|
+
applyPatchWithDotNotation(schema, fullPath, value);
|
|
97
|
+
}
|
|
98
|
+
else if (isPlainObject(value)) {
|
|
99
|
+
// Nested subtree → recurse with extended prefix
|
|
100
|
+
applyPatchTree(schema, value, [...pathPrefix, key]);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
// Leaf patch (primitive / array) → treat as direct field patch
|
|
104
|
+
const fullPathSegments = [...pathPrefix, key];
|
|
105
|
+
const fullPath = fullPathSegments.join(".");
|
|
106
|
+
applyPatchWithDotNotation(schema, fullPath, value);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
exports.applyPatchTree = applyPatchTree;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "context-provider",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"title": "context provider schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": [
|
|
7
|
+
"name"
|
|
8
|
+
],
|
|
9
|
+
"additionalProperties": true,
|
|
10
|
+
"properties": {
|
|
11
|
+
"name": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"enum": [
|
|
14
|
+
"PlanewaveCutoffDataManager",
|
|
15
|
+
"KGridFormDataManager",
|
|
16
|
+
"QGridFormDataManager",
|
|
17
|
+
"IGridFormDataManager",
|
|
18
|
+
"QPathFormDataManager",
|
|
19
|
+
"IPathFormDataManager",
|
|
20
|
+
"KPathFormDataManager",
|
|
21
|
+
"ExplicitKPathFormDataManager",
|
|
22
|
+
"ExplicitKPath2PIBAFormDataManager",
|
|
23
|
+
"HubbardJContextManager",
|
|
24
|
+
"HubbardUContextManager",
|
|
25
|
+
"HubbardVContextManager",
|
|
26
|
+
"HubbardContextManagerLegacy",
|
|
27
|
+
"NEBFormDataManager",
|
|
28
|
+
"BoundaryConditionsFormDataManager",
|
|
29
|
+
"MLSettingsDataManager",
|
|
30
|
+
"MLTrainTestSplitDataManager",
|
|
31
|
+
"IonDynamicsContextProvider",
|
|
32
|
+
"CollinearMagnetizationDataManager",
|
|
33
|
+
"NonCollinearMagnetizationDataManager",
|
|
34
|
+
"QEPWXInputDataManager",
|
|
35
|
+
"QENEBInputDataManager",
|
|
36
|
+
"VASPInputDataManager",
|
|
37
|
+
"VASPNEBInputDataManager",
|
|
38
|
+
"NWChemInputDataManager"
|
|
39
|
+
],
|
|
40
|
+
"tsEnumNames": [
|
|
41
|
+
"PlanewaveCutoffDataManager",
|
|
42
|
+
"KGridFormDataManager",
|
|
43
|
+
"QGridFormDataManager",
|
|
44
|
+
"IGridFormDataManager",
|
|
45
|
+
"QPathFormDataManager",
|
|
46
|
+
"IPathFormDataManager",
|
|
47
|
+
"KPathFormDataManager",
|
|
48
|
+
"ExplicitKPathFormDataManager",
|
|
49
|
+
"ExplicitKPath2PIBAFormDataManager",
|
|
50
|
+
"HubbardJContextManager",
|
|
51
|
+
"HubbardUContextManager",
|
|
52
|
+
"HubbardVContextManager",
|
|
53
|
+
"HubbardContextManagerLegacy",
|
|
54
|
+
"NEBFormDataManager",
|
|
55
|
+
"BoundaryConditionsFormDataManager",
|
|
56
|
+
"MLSettingsDataManager",
|
|
57
|
+
"MLTrainTestSplitDataManager",
|
|
58
|
+
"IonDynamicsContextProvider",
|
|
59
|
+
"CollinearMagnetizationDataManager",
|
|
60
|
+
"NonCollinearMagnetizationDataManager",
|
|
61
|
+
"QEPWXInputDataManager",
|
|
62
|
+
"QENEBInputDataManager",
|
|
63
|
+
"VASPInputDataManager",
|
|
64
|
+
"VASPNEBInputDataManager",
|
|
65
|
+
"NWChemInputDataManager"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
"domain": {
|
|
69
|
+
"description": "domain of the context provider",
|
|
70
|
+
"type": "string"
|
|
71
|
+
},
|
|
72
|
+
"entityName": {
|
|
73
|
+
"description": "entity name associated with the context provider",
|
|
74
|
+
"type": "string"
|
|
75
|
+
},
|
|
76
|
+
"data": {
|
|
77
|
+
"description": "data object for the context provider",
|
|
78
|
+
"type": "object"
|
|
79
|
+
},
|
|
80
|
+
"extraData": {
|
|
81
|
+
"description": "additional data object for the context provider",
|
|
82
|
+
"type": "object"
|
|
83
|
+
},
|
|
84
|
+
"isEdited": {
|
|
85
|
+
"description": "flag indicating if the context provider has been edited",
|
|
86
|
+
"type": "boolean"
|
|
87
|
+
},
|
|
88
|
+
"context": {
|
|
89
|
+
"description": "context object for the context provider",
|
|
90
|
+
"type": "object"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "context-providers-directory/boundary-conditions-provider",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"title": "Boundary Conditions Provider Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"type": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"title": "Type"
|
|
10
|
+
},
|
|
11
|
+
"offset": {
|
|
12
|
+
"type": "number",
|
|
13
|
+
"title": "Offset (A)"
|
|
14
|
+
},
|
|
15
|
+
"electricField": {
|
|
16
|
+
"type": "number",
|
|
17
|
+
"title": "Electric Field (eV/A)"
|
|
18
|
+
},
|
|
19
|
+
"targetFermiEnergy": {
|
|
20
|
+
"type": "number",
|
|
21
|
+
"title": "Target Fermi Energy (eV)"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "context-providers-directory/enum",
|
|
3
|
+
"definitions": {
|
|
4
|
+
"ContextProviderNameEnum": {
|
|
5
|
+
"type": "string",
|
|
6
|
+
"enum": [
|
|
7
|
+
"PlanewaveCutoffDataManager",
|
|
8
|
+
"KGridFormDataManager",
|
|
9
|
+
"QGridFormDataManager",
|
|
10
|
+
"IGridFormDataManager",
|
|
11
|
+
"QPathFormDataManager",
|
|
12
|
+
"IPathFormDataManager",
|
|
13
|
+
"KPathFormDataManager",
|
|
14
|
+
"ExplicitKPathFormDataManager",
|
|
15
|
+
"ExplicitKPath2PIBAFormDataManager",
|
|
16
|
+
"HubbardJContextManager",
|
|
17
|
+
"HubbardUContextManager",
|
|
18
|
+
"HubbardVContextManager",
|
|
19
|
+
"HubbardContextManagerLegacy",
|
|
20
|
+
"NEBFormDataManager",
|
|
21
|
+
"BoundaryConditionsFormDataManager",
|
|
22
|
+
"MLSettingsDataManager",
|
|
23
|
+
"MLTrainTestSplitDataManager",
|
|
24
|
+
"IonDynamicsContextProvider",
|
|
25
|
+
"CollinearMagnetizationDataManager",
|
|
26
|
+
"NonCollinearMagnetizationDataManager",
|
|
27
|
+
"QEPWXInputDataManager",
|
|
28
|
+
"QENEBInputDataManager",
|
|
29
|
+
"VASPInputDataManager",
|
|
30
|
+
"VASPNEBInputDataManager",
|
|
31
|
+
"NWChemInputDataManager"
|
|
32
|
+
],
|
|
33
|
+
"tsEnumNames": [
|
|
34
|
+
"PlanewaveCutoffDataManager",
|
|
35
|
+
"KGridFormDataManager",
|
|
36
|
+
"QGridFormDataManager",
|
|
37
|
+
"IGridFormDataManager",
|
|
38
|
+
"QPathFormDataManager",
|
|
39
|
+
"IPathFormDataManager",
|
|
40
|
+
"KPathFormDataManager",
|
|
41
|
+
"ExplicitKPathFormDataManager",
|
|
42
|
+
"ExplicitKPath2PIBAFormDataManager",
|
|
43
|
+
"HubbardJContextManager",
|
|
44
|
+
"HubbardUContextManager",
|
|
45
|
+
"HubbardVContextManager",
|
|
46
|
+
"HubbardContextManagerLegacy",
|
|
47
|
+
"NEBFormDataManager",
|
|
48
|
+
"BoundaryConditionsFormDataManager",
|
|
49
|
+
"MLSettingsDataManager",
|
|
50
|
+
"MLTrainTestSplitDataManager",
|
|
51
|
+
"IonDynamicsContextProvider",
|
|
52
|
+
"CollinearMagnetizationDataManager",
|
|
53
|
+
"NonCollinearMagnetizationDataManager",
|
|
54
|
+
"QEPWXInputDataManager",
|
|
55
|
+
"QENEBInputDataManager",
|
|
56
|
+
"VASPInputDataManager",
|
|
57
|
+
"VASPNEBInputDataManager",
|
|
58
|
+
"NWChemInputDataManager"
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -9,16 +9,12 @@
|
|
|
9
9
|
],
|
|
10
10
|
"properties": {
|
|
11
11
|
"type": {
|
|
12
|
-
"
|
|
13
|
-
"localorbital"
|
|
14
|
-
],
|
|
12
|
+
"const": "localorbital",
|
|
15
13
|
"description": "general type of this method, eg. `pseudopotential`",
|
|
16
14
|
"type": "string"
|
|
17
15
|
},
|
|
18
16
|
"subtype": {
|
|
19
|
-
"
|
|
20
|
-
"pople"
|
|
21
|
-
],
|
|
17
|
+
"const": "pople",
|
|
22
18
|
"description": "general subtype of this method, eg. `ultra-soft`",
|
|
23
19
|
"type": "string"
|
|
24
20
|
},
|
|
@@ -9,9 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"properties": {
|
|
11
11
|
"type": {
|
|
12
|
-
"
|
|
13
|
-
"pseudopotential"
|
|
14
|
-
],
|
|
12
|
+
"const": "pseudopotential",
|
|
15
13
|
"description": "general type of this method, eg. `pseudopotential`",
|
|
16
14
|
"type": "string"
|
|
17
15
|
},
|
|
@@ -22,6 +20,7 @@
|
|
|
22
20
|
"us",
|
|
23
21
|
"any"
|
|
24
22
|
],
|
|
23
|
+
"default": "us",
|
|
25
24
|
"description": "general subtype of this method, eg. `ultra-soft`",
|
|
26
25
|
"type": "string"
|
|
27
26
|
},
|
|
@@ -9,16 +9,12 @@
|
|
|
9
9
|
],
|
|
10
10
|
"properties": {
|
|
11
11
|
"type": {
|
|
12
|
-
"
|
|
13
|
-
"unknown"
|
|
14
|
-
],
|
|
12
|
+
"const": "unknown",
|
|
15
13
|
"description": "general type of this method, eg. `pseudopotential`",
|
|
16
14
|
"type": "string"
|
|
17
15
|
},
|
|
18
16
|
"subtype": {
|
|
19
|
-
"
|
|
20
|
-
"unknown"
|
|
21
|
-
],
|
|
17
|
+
"const": "unknown",
|
|
22
18
|
"description": "general subtype of this method, eg. `ultra-soft`",
|
|
23
19
|
"type": "string"
|
|
24
20
|
},
|
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
"lda": {
|
|
8
8
|
"properties": {
|
|
9
9
|
"subtype": {
|
|
10
|
-
"
|
|
11
|
-
"lda"
|
|
12
|
-
]
|
|
10
|
+
"const": "lda"
|
|
13
11
|
},
|
|
14
12
|
"functional": {
|
|
15
13
|
"enum": [
|
|
@@ -24,9 +22,7 @@
|
|
|
24
22
|
"gga": {
|
|
25
23
|
"properties": {
|
|
26
24
|
"subtype": {
|
|
27
|
-
"
|
|
28
|
-
"gga"
|
|
29
|
-
]
|
|
25
|
+
"const": "gga"
|
|
30
26
|
},
|
|
31
27
|
"functional": {
|
|
32
28
|
"enum": [
|
|
@@ -41,9 +37,7 @@
|
|
|
41
37
|
"hybrid": {
|
|
42
38
|
"properties": {
|
|
43
39
|
"subtype": {
|
|
44
|
-
"
|
|
45
|
-
"hybrid"
|
|
46
|
-
]
|
|
40
|
+
"const": "hybrid"
|
|
47
41
|
},
|
|
48
42
|
"functional": {
|
|
49
43
|
"enum": [
|
|
@@ -63,9 +57,7 @@
|
|
|
63
57
|
{
|
|
64
58
|
"properties": {
|
|
65
59
|
"subtype": {
|
|
66
|
-
"
|
|
67
|
-
"lda"
|
|
68
|
-
]
|
|
60
|
+
"const": "lda"
|
|
69
61
|
},
|
|
70
62
|
"functional": {
|
|
71
63
|
"enum": [
|
|
@@ -80,9 +72,7 @@
|
|
|
80
72
|
{
|
|
81
73
|
"properties": {
|
|
82
74
|
"subtype": {
|
|
83
|
-
"
|
|
84
|
-
"gga"
|
|
85
|
-
]
|
|
75
|
+
"const": "gga"
|
|
86
76
|
},
|
|
87
77
|
"functional": {
|
|
88
78
|
"enum": [
|
|
@@ -97,9 +87,7 @@
|
|
|
97
87
|
{
|
|
98
88
|
"properties": {
|
|
99
89
|
"subtype": {
|
|
100
|
-
"
|
|
101
|
-
"hybrid"
|
|
102
|
-
]
|
|
90
|
+
"const": "hybrid"
|
|
103
91
|
},
|
|
104
92
|
"functional": {
|
|
105
93
|
"enum": [
|
|
@@ -113,9 +101,7 @@
|
|
|
113
101
|
"additionalProperties": true,
|
|
114
102
|
"properties": {
|
|
115
103
|
"type": {
|
|
116
|
-
"
|
|
117
|
-
"dft"
|
|
118
|
-
],
|
|
104
|
+
"const": "dft",
|
|
119
105
|
"description": "general type of the model, eg. `dft`",
|
|
120
106
|
"type": "string"
|
|
121
107
|
},
|