Initial commit

This commit is contained in:
root
2025-12-21 09:57:43 -05:00
committed by Sebastian Krupinski
commit db42b6699c
35 changed files with 6458 additions and 0 deletions

63
src/models/provider.ts Normal file
View File

@@ -0,0 +1,63 @@
/**
* Class model for Provider Interface
*/
import type { ProviderCapabilitiesInterface, ProviderInterface } from "@/types/provider";
export class ProviderObject implements ProviderInterface {
_data!: ProviderInterface;
constructor() {
this._data = {
'@type': 'files:provider',
id: '',
label: '',
capabilities: {},
};
}
fromJson(data: ProviderInterface): ProviderObject {
this._data = data;
return this;
}
toJson(): 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 {
return !!(this._data.capabilities && this._data.capabilities[capability]);
}
capability(capability: keyof ProviderCapabilitiesInterface): boolean | string[] | Record<string, string> | Record<string, string[]> | undefined {
if (this._data.capabilities) {
return this._data.capabilities[capability];
}
return undefined;
}
/** Immutable Properties */
get '@type'(): string {
return this._data['@type'];
}
get id(): string {
return this._data.id;
}
get label(): string {
return this._data.label;
}
get capabilities(): ProviderCapabilitiesInterface {
return this._data.capabilities;
}
}