chore: standardize chrono provider

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-02-17 03:11:18 -05:00
parent 974d3fe11b
commit fccd7b1df6
31 changed files with 3800 additions and 2076 deletions
+12 -13
View File
@@ -1,7 +1,11 @@
/**
* Class model for Provider Interface
*/
import type { ProviderCapabilitiesInterface, ProviderInterface } from "@/types/provider";
import type {
ProviderInterface,
ProviderCapabilitiesInterface
} from "@/types/provider";
export class ProviderObject implements ProviderInterface {
@@ -9,8 +13,8 @@ export class ProviderObject implements ProviderInterface {
constructor() {
this._data = {
'@type': 'chrono:provider',
id: '',
'@type': 'chrono.provider',
identifier: '',
label: '',
capabilities: {},
};
@@ -25,16 +29,11 @@ export class ProviderObject implements ProviderInterface {
return this._data;
}
clone(): ProviderObject {
const cloned = new ProviderObject();
cloned._data = JSON.parse(JSON.stringify(this._data));
return cloned;
capable(capability: keyof ProviderCapabilitiesInterface): boolean {
const value = this._data.capabilities?.[capability];
return value !== undefined && value !== false;
}
capable(capability: keyof ProviderCapabilitiesInterface): boolean {
return !!(this._data.capabilities && this._data.capabilities[capability]);
}
capability(capability: keyof ProviderCapabilitiesInterface): any | null {
if (this._data.capabilities) {
return this._data.capabilities[capability];
@@ -48,8 +47,8 @@ export class ProviderObject implements ProviderInterface {
return this._data['@type'];
}
get id(): string {
return this._data.id;
get identifier(): string {
return this._data.identifier;
}
get label(): string {