From 8501a6bebbeff663281ad791896cf912d71a0ba6 Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Fri, 22 Mar 2024 17:45:21 -0700 Subject: [PATCH] update: comment out imported json schema --- dist/material.d.ts | 1040 +------------------------------------------- dist/material.js | 5 +- src/js/material.ts | 6 +- 3 files changed, 20 insertions(+), 1031 deletions(-) diff --git a/dist/material.d.ts b/dist/material.d.ts index 293a5289..6c2ca666 100644 --- a/dist/material.d.ts +++ b/dist/material.d.ts @@ -213,514 +213,6 @@ export declare function MaterialMixin(name: string, defaultValue: T): T; - prop(name: string): T_1 | undefined; + prop(name: string, defaultValue: T): T; /** + * Converts basis to crystal/fractional coordinates. + */ + prop(name: string): T_1 | undefined; /** + * Converts basis to crystal/fractional coordinates. + */ setProp(name: string, value: unknown): void; unsetProp(name: string): void; toJSON(exclude?: string[] | undefined): AnyObject; toJSONSafe(exclude?: string[] | undefined): AnyObject; - /** - * Returns material's basis in XYZ format. - */ toJSONQuick(exclude?: string[] | undefined): AnyObject; clone(extraContext?: object | undefined): any; validate(): void; @@ -1492,7 +477,9 @@ export declare const Material: { prop(name: string): T_1_1 | undefined; setProp(name: string, value: unknown): void; unsetProp(name: string): void; - toJSON(exclude?: string[] | undefined): AnyObject; + toJSON(exclude?: string[] | undefined): AnyObject; /** + * Returns material in POSCAR format. Pass `true` to ignore original poscar source and re-serialize. + */ toJSONSafe(exclude?: string[] | undefined): AnyObject; toJSONQuick(exclude?: string[] | undefined): AnyObject; clone(extraContext?: object | undefined): any; @@ -1520,16 +507,15 @@ export declare const Material: { clone(extraContext?: object | undefined): any; validate(): void; clean(config: AnyObject): AnyObject; - isValid(): boolean; + isValid(): boolean; /** + * @summary a series of checks for the material and returns an array of results in ConsistencyChecks format. + * @returns Array of checks results + */ id: string; readonly cls: string; getClsName(): string; readonly slug: string; readonly isSystemEntity: boolean; - /** - * @summary a series of checks for the material's basis and returns an array of results in ConsistencyChecks format. - * @returns Array of checks results - */ getAsEntityReference(byIdOnly?: boolean | undefined): import("@mat3ra/esse/lib/js/types").EntityReferenceSchema; getEntityByName(entities: import("@exabyte-io/code.js/dist/entity").InMemoryEntity[], entity: string, name: string): import("@exabyte-io/code.js/dist/entity").InMemoryEntity; }) & { diff --git a/dist/material.js b/dist/material.js index 824542d4..f952de54 100644 --- a/dist/material.js +++ b/dist/material.js @@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); exports.Material = exports.MaterialMixin = exports.defaultMaterialConfig = void 0; const entity_1 = require("@exabyte-io/code.js/dist/entity"); -const material_json_1 = __importDefault(require("@mat3ra/esse/lib/js/schema/material.json")); const crypto_js_1 = __importDefault(require("crypto-js")); const constrained_basis_1 = require("./basis/constrained_basis"); const conventional_cell_1 = require("./cell/conventional_cell"); @@ -57,6 +56,9 @@ exports.defaultMaterialConfig = { }; function MaterialMixin(superclass) { class MadeMaterial extends superclass { + // TODO: add constraints (and other properties if needed) to ESSE MaterialSchema, then uncomment the line below to allow validation + // During validation of the Material entity, properties absent in ESSE schema get deleted. + // static readonly jsonSchema = MaterialJSONSchemaObject; // eslint-disable-next-line @typescript-eslint/no-explicit-any constructor(...config) { super(...config); @@ -310,7 +312,6 @@ function MaterialMixin(superclass) { return checks; } } - MadeMaterial.jsonSchema = material_json_1.default; return MadeMaterial; } exports.MaterialMixin = MaterialMixin; diff --git a/src/js/material.ts b/src/js/material.ts index 461f4e80..98cef481 100644 --- a/src/js/material.ts +++ b/src/js/material.ts @@ -1,6 +1,6 @@ import { HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity } from "@exabyte-io/code.js/dist/entity"; import { AnyObject } from "@exabyte-io/code.js/dist/entity/in_memory"; -import MaterialJSONSchemaObject from "@mat3ra/esse/lib/js/schema/material.json"; +// import MaterialJSONSchemaObject from "@mat3ra/esse/lib/js/schema/material.json"; import { ConsistencyCheck, DerivedPropertiesSchema, @@ -85,7 +85,9 @@ export function MaterialMixin< class MadeMaterial extends superclass { declare _json: MaterialSchemaJSON; - static readonly jsonSchema = MaterialJSONSchemaObject; + // TODO: add constraints (and other properties if needed) to ESSE MaterialSchema, then uncomment the line below to allow validation + // During validation of the Material entity, properties absent in ESSE schema get deleted. + // static readonly jsonSchema = MaterialJSONSchemaObject; // eslint-disable-next-line @typescript-eslint/no-explicit-any constructor(...config: any[]) {