chore: bunch of improvements
JS Unit Tests / test (pull_request) Successful in 33s
Build Test / test (pull_request) Successful in 36s
PHP Unit Tests / test (pull_request) Successful in 1m12s

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-04-23 22:00:50 -04:00
parent b617234b40
commit 3362afb7ec
28 changed files with 1717 additions and 1297 deletions
+14 -35
View File
@@ -2,18 +2,19 @@
* Class model for Message/Entity Interface
*/
import type { EntityInterface } from "@/types/entity";
import type { MessageInterface, MessagePartInterface } from "@/types/message";
import type { EntityInterface, EntityModelInterface } from "@/types/entity";
import type { MessageInterface } from "@/types/message";
import { MessageObject } from "./message";
export class EntityObject {
export class EntityObject implements EntityModelInterface {
_data!: EntityInterface<MessageInterface>;
_message!: MessageObject;
private _data!: EntityInterface<MessageInterface>;
private _properties!: MessageObject;
constructor() {
this._data = {
'@type': 'mail.entity',
'@type': 'mail:entity',
version: 1,
provider: '',
service: '',
collection: '',
@@ -21,24 +22,7 @@ export class EntityObject {
signature: null,
created: null,
modified: null,
properties: {
'@type': 'mail.message',
version: 1,
urid: '',
size: 0,
receivedDate: undefined,
date: undefined,
subject: '',
snippet: '',
from: undefined,
to: [],
cc: [],
bcc: [],
replyTo: [],
flags: {},
body: undefined,
attachments: [],
}
properties: {'@type': 'mail:message'},
};
}
@@ -53,10 +37,10 @@ export class EntityObject {
clone(): EntityObject {
const cloned = new EntityObject();
cloned._data = {
...this._data,
properties: { ...this._data.properties }
cloned._data = {
...this._data
};
cloned._properties = this.properties.clone();
return cloned;
}
@@ -93,15 +77,10 @@ export class EntityObject {
/** Message Object Properties */
get properties(): MessageObject {
if (!this._message) {
this._message = new MessageObject(this._data.properties);
if (!this._properties) {
this._properties = new MessageObject().fromJson(this._data.properties as MessageInterface);
}
return this._message;
}
// Alias for backward compatibility
get object(): MessageObject {
return this.properties;
return this._properties;
}
}