Skip to content

Commit

Permalink
Merge pull request #106 from Exabyte-io/chore/SOF-7506
Browse files Browse the repository at this point in the history
SOF-7506: entity types fixes
  • Loading branch information
k0stik authored Jan 27, 2025
2 parents 1039be8 + 012509d commit 1922da6
Show file tree
Hide file tree
Showing 59 changed files with 6,922 additions and 3,583 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
node-version:
- 14.x
- 20.x
- 22.x

steps:
- name: Checkout this repository
Expand Down
28 changes: 14 additions & 14 deletions dist/js/constants.d.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
export namespace coefficients {
const EV_TO_RY: number;
const BOHR_TO_ANGSTROM: number;
const ANGSTROM_TO_BOHR: number;
const EV_A_TO_RY_BOHR: number;
let EV_TO_RY: number;
let BOHR_TO_ANGSTROM: number;
let ANGSTROM_TO_BOHR: number;
let EV_A_TO_RY_BOHR: number;
}
export namespace tolerance {
const length: number;
const lengthAngstrom: number;
const pointsDistance: number;
let length: number;
let lengthAngstrom: number;
let pointsDistance: number;
}
export namespace units {
const bohr: string;
const angstrom: string;
const degree: string;
const radian: string;
const alat: string;
let bohr: string;
let angstrom: string;
let degree: string;
let radian: string;
let alat: string;
}
export namespace ATOMIC_COORD_UNITS {
const crystal: string;
const cartesian: string;
let crystal: string;
let cartesian: string;
}
export const HASH_TOLERANCE: 3;
declare namespace _default {
Expand Down
10 changes: 5 additions & 5 deletions dist/js/context/mixins.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export declare function MaterialContextMixin<T extends Constructor>(superclass:
_material: Material;
extraData?: {
materialHash: string;
} | undefined;
isEdited?: boolean | undefined;
};
isEdited?: boolean;
readonly isEditedIsSetToFalseOnMaterialUpdate: boolean;
updateMaterialHash(): void;
readonly isMaterialCreatedDefault: boolean;
Expand Down Expand Up @@ -46,10 +46,10 @@ export declare function MethodDataContextMixin<T extends Constructor>(superclass
[x: string]: any;
_methodData: any;
isEdited: boolean;
methodDataHash?: string | undefined;
methodDataHash?: string;
extraData?: {
methodDataHash?: string | undefined;
} | undefined;
methodDataHash?: string;
};
_initMethodDataHash(): void;
readonly methodData: any;
readonly isMethodDataUpdated: boolean;
Expand Down
15 changes: 7 additions & 8 deletions dist/js/context/mixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.JobContextMixin = exports.WorkflowContextMixin = exports.MethodDataContextMixin = exports.MaterialsContextMixin = exports.MaterialsSetContextMixin = exports.MaterialContextMixin = exports.ApplicationContextMixin = void 0;
exports.ApplicationContextMixin = ApplicationContextMixin;
exports.MaterialContextMixin = MaterialContextMixin;
exports.MaterialsSetContextMixin = MaterialsSetContextMixin;
exports.MaterialsContextMixin = MaterialsContextMixin;
exports.MethodDataContextMixin = MethodDataContextMixin;
exports.WorkflowContextMixin = WorkflowContextMixin;
exports.JobContextMixin = JobContextMixin;
const crypto_js_1 = __importDefault(require("crypto-js"));
const utils_1 = require("../entity/set/ordered/utils");
function ApplicationContextMixin(superclass) {
Expand All @@ -25,7 +31,6 @@ function ApplicationContextMixin(superclass) {
}
};
}
exports.ApplicationContextMixin = ApplicationContextMixin;
function MaterialContextMixin(superclass) {
return class MaterialContextMixin extends superclass {
constructor(...args) {
Expand Down Expand Up @@ -64,7 +69,6 @@ function MaterialContextMixin(superclass) {
}
};
}
exports.MaterialContextMixin = MaterialContextMixin;
function MaterialsSetContextMixin(superclass) {
return class MaterialsSetContextMixin extends superclass {
constructor(...params) {
Expand All @@ -82,7 +86,6 @@ function MaterialsSetContextMixin(superclass) {
}
};
}
exports.MaterialsSetContextMixin = MaterialsSetContextMixin;
function MaterialsContextMixin(superclass) {
return class MaterialsContextMixin extends superclass {
constructor(...params) {
Expand All @@ -103,7 +106,6 @@ function MaterialsContextMixin(superclass) {
}
};
}
exports.MaterialsContextMixin = MaterialsContextMixin;
function MethodDataContextMixin(superclass) {
return class extends superclass {
constructor(...params) {
Expand Down Expand Up @@ -142,7 +144,6 @@ function MethodDataContextMixin(superclass) {
}
};
}
exports.MethodDataContextMixin = MethodDataContextMixin;
function WorkflowContextMixin(superclass) {
return class extends superclass {
constructor(...params) {
Expand All @@ -156,7 +157,6 @@ function WorkflowContextMixin(superclass) {
}
};
}
exports.WorkflowContextMixin = WorkflowContextMixin;
function JobContextMixin(superclass) {
return class extends superclass {
constructor(...params) {
Expand All @@ -170,4 +170,3 @@ function JobContextMixin(superclass) {
}
};
}
exports.JobContextMixin = JobContextMixin;
2 changes: 1 addition & 1 deletion dist/js/context/registry.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export class ContextProviderRegistryContainer {
_providers: any[];
set providers(arg: any[]);
set providers(p: any[]);
get providers(): any[];
addProvider({ name, instance }: {
name: any;
Expand Down
18 changes: 12 additions & 6 deletions dist/js/entity/in_memory.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AnyObject } from "@mat3ra/esse/dist/js/esse/types";
import { JSONSchema } from "@mat3ra/esse/dist/js/esse/utils";
import { EntityReferenceSchema } from "@mat3ra/esse/dist/js/types";
import { BaseInMemoryEntitySchema, EntityReferenceSchema } from "@mat3ra/esse/dist/js/types";
export declare enum ValidationErrorCode {
IN_MEMORY_ENTITY_DATA_INVALID = "IN_MEMORY_ENTITY_DATA_INVALID"
}
Expand All @@ -17,7 +17,7 @@ export declare class EntityError extends Error {
details?: ErrorDetails;
});
}
export declare class InMemoryEntity {
export declare class InMemoryEntity implements BaseInMemoryEntitySchema {
static create(config: object): InMemoryEntity;
static _isDeepCloneRequired: boolean;
static allowJsonSchemaTypesCoercing: boolean;
Expand Down Expand Up @@ -56,13 +56,9 @@ export declare class InMemoryEntity {
validate(): void;
clean(config: AnyObject): AnyObject;
isValid(): boolean;
get id(): string;
set id(id: string);
static get cls(): string;
get cls(): string;
getClsName(): string;
get slug(): string;
get isSystemEntity(): boolean;
/**
* @summary get small identifying payload of object
* @param byIdOnly if true, return only the id
Expand All @@ -77,6 +73,16 @@ export declare class InMemoryEntity {
* @param name the name of the entity to choose
*/
getEntityByName(entities: InMemoryEntity[], entity: string, name: string): InMemoryEntity;
get id(): string;
set id(id: string);
get _id(): string;
set _id(id: string);
get schemaVersion(): string;
set schemaVersion(schemaVersion: string);
get systemName(): string;
set systemName(systemName: string);
get slug(): string;
get isSystemEntity(): boolean;
}
export type InMemoryEntityConstructor<T extends InMemoryEntity = InMemoryEntity> = new (...args: any[]) => T;
export {};
69 changes: 49 additions & 20 deletions dist/js/entity/in_memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Expand All @@ -35,7 +45,7 @@ const clone_1 = require("../utils/clone");
var ValidationErrorCode;
(function (ValidationErrorCode) {
ValidationErrorCode["IN_MEMORY_ENTITY_DATA_INVALID"] = "IN_MEMORY_ENTITY_DATA_INVALID";
})(ValidationErrorCode = exports.ValidationErrorCode || (exports.ValidationErrorCode = {}));
})(ValidationErrorCode || (exports.ValidationErrorCode = ValidationErrorCode = {}));
class EntityError extends Error {
constructor({ code, details }) {
super(code);
Expand Down Expand Up @@ -160,12 +170,6 @@ class InMemoryEntity {
return false;
}
}
get id() {
return this.prop("_id", "");
}
set id(id) {
this.setProp("_id", id);
}
static get cls() {
return this.prototype.constructor.name;
}
Expand All @@ -176,12 +180,6 @@ class InMemoryEntity {
getClsName() {
return this.constructor.name;
}
get slug() {
return this.prop("slug", "");
}
get isSystemEntity() {
return Boolean(this.prop("systemName", ""));
}
/**
* @summary get small identifying payload of object
* @param byIdOnly if true, return only the id
Expand Down Expand Up @@ -220,6 +218,37 @@ class InMemoryEntity {
}
return filtered[0];
}
// Properties from BaseInMemoryEntitySchema
get id() {
return this.prop("_id", "");
}
set id(id) {
this.setProp("_id", id);
}
get _id() {
return this.prop("_id", "");
}
set _id(id) {
this.setProp("_id", id);
}
get schemaVersion() {
return this.prop("schemaVersion", "");
}
set schemaVersion(schemaVersion) {
this.setProp("schemaVersion", schemaVersion);
}
get systemName() {
return this.prop("systemName", "");
}
set systemName(systemName) {
this.setProp("systemName", systemName);
}
get slug() {
return this.prop("slug", "");
}
get isSystemEntity() {
return Boolean(this.systemName);
}
}
exports.InMemoryEntity = InMemoryEntity;
// Override if deepClone of config is required
Expand Down
24 changes: 17 additions & 7 deletions dist/js/entity/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowchartItemMixin = exports.FlowchartEntityMixin = exports.ContextAndRenderFieldsMixin = exports.OrderedInMemoryEntityInSetMixin = exports.OrderedInMemoryEntitySetMixin = exports.InMemoryEntityInSetMixin = exports.InMemoryEntitySetMixin = exports.selectorsForEntitySet = exports.constructEntitySetFactoryByConfig = exports.ENTITY_SET_TYPES = exports.InMemoryEntitySet = exports.HashedInputArrayMixin = exports.RuntimeContextFieldMixin = exports.RuntimeItemsMixin = exports.NamedEntityMixin = exports.HasScopeTrackMixin = exports.TaggableMixin = exports.HasMetadataMixin = exports.HasDescriptionMixin = exports.DefaultableMixin = exports.HasConsistencyChecksMixin = exports.HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity = exports.NamedDefaultableRepetitionRuntimeItemsImportantSettingsContextAndRenderHashedInMemoryEntity = exports.NamedDefaultableRepetitionImportantSettingsInMemoryEntity = exports.NamedDefaultableRepetitionContextAndRenderInMemoryEntity = exports.HasMetadataNamedDefaultableInMemoryEntity = exports.NamedDefaultableInMemoryEntity = exports.DefaultableInMemoryEntity = exports.NamedInMemoryEntity = exports.InMemoryEntity = void 0;
const in_memory_1 = require("./in_memory");
Expand Down
Loading

0 comments on commit 1922da6

Please sign in to comment.