feat: lots more improvements
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user