UNPKG

@practicaloptimism/uniplexer

Version:

A multiplexer for 3rd party service providers and application protocols

58 lines (40 loc) 1.52 kB
class Provider { nameVersionId: string = '' type: string = '' hasOfflineSupport?: boolean = false nameDescription?: string = '' websiteURL?: string = '' iconImageURL?: string = '' textDescriptionShort?: string = '' textDescriptionLong?: string = '' providerImport?: any = {} operatingEnvironmentTable?: { [operatingEnvironmentId: string]: boolean } = {} credentialTable?: { [credentialHashId: string]: ProviderCredential } = {} functionTable?: { [functionName: string]: any } = {} constructor (detail: Provider) { for (const property in detail) { if (!detail.hasOwnProperty(property)) { continue } const propertyValue: any = (detail as any)[property] === undefined ? (this as any)[property] : (detail as any)[property]; (this as any)[property] = propertyValue } } } class ProviderCredential { credentialHashId: string = '' configurationDetail: ProviderCredentialConfigurationDetail = new ProviderCredentialConfigurationDetail() constructor (credentialHashId: string, configurationDetail: ProviderCredentialConfigurationDetail) { this.credentialHashId = credentialHashId this.configurationDetail = configurationDetail } } class ProviderCredentialConfigurationDetail { providerNameVersionId: string = ''; [propertyName: string]: any } declare type PREPARE_PROVIDER_FOR_USE = (detail?: any, extract?: any) => Promise<any> export { Provider, ProviderCredential, ProviderCredentialConfigurationDetail, PREPARE_PROVIDER_FOR_USE }