feat: lots more improvements
JS Unit Tests / test (pull_request) Failing after 29s
Build Test / test (pull_request) Successful in 31s
PHP Unit Tests / test (pull_request) Successful in 1m12s

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-04-25 15:41:16 -04:00
parent 86e4772d45
commit 99a68737d1
26 changed files with 902 additions and 596 deletions
+13 -9
View File
@@ -5,11 +5,12 @@
import type { EntityInterface, EntityModelInterface } from "@/types/entity";
import type { MessageInterface } from "@/types/message";
import { MessageObject } from "./message";
import { clonePlain } from './clone-plain';
export class EntityObject implements EntityModelInterface {
private _data!: EntityInterface<MessageInterface>;
private _properties!: MessageObject;
private _properties: MessageObject | undefined = undefined;
constructor() {
this._data = {
@@ -27,21 +28,24 @@ export class EntityObject implements EntityModelInterface {
}
fromJson(data: EntityInterface<MessageInterface>): EntityObject {
this._data = data;
this._data = clonePlain(data);
this._properties = undefined;
return this;
}
toJson(): EntityInterface<MessageInterface> {
return this._data;
const json = this._properties
? {
...this._data,
properties: this._properties.toJson(),
}
: this._data;
return clonePlain(json);
}
clone(): EntityObject {
const cloned = new EntityObject();
cloned._data = {
...this._data
};
cloned._properties = this.properties.clone();
return cloned;
return new EntityObject().fromJson(this.toJson());
}
/** Metadata Properties */