feat: lots more improvements
Some checks failed
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

View File

@@ -7,6 +7,7 @@ import type {
ProviderCapabilitiesInterface,
ProviderModelInterface
} from "@/types/provider";
import { clonePlain } from './clone-plain';
export class ProviderObject implements ProviderModelInterface {
@@ -23,18 +24,16 @@ export class ProviderObject implements ProviderModelInterface {
}
fromJson(data: ProviderInterface): ProviderObject {
this._data = data;
this._data = clonePlain(data);
return this;
}
toJson(): ProviderInterface {
return this._data;
return clonePlain(this._data);
}
clone(): ProviderObject {
const cloned = new ProviderObject();
cloned._data = { ...this._data };
return cloned;
return new ProviderObject().fromJson(this.toJson());
}
capable(capability: keyof ProviderCapabilitiesInterface): boolean {
@@ -60,7 +59,7 @@ export class ProviderObject implements ProviderModelInterface {
}
get capabilities(): ProviderCapabilitiesInterface {
return this._data.capabilities;
return clonePlain(this._data.capabilities);
}
}