# Class BaseDataSource<Data, Metadata, Viewer>

#### Type Parameters

- Data = any
- Metadata extends BaseDataSourceMetadata = BaseDataSourceMetadata
- Viewer extends BaseDataSourceViewer = BaseDataSourceViewer

#### Hierarchy (view full)

- BaseDefinition<Metadata>
  - BaseDataSource
    - MethodDataSource
    - ObservableDataSource
    - PipeDataSource
    - StaticDataSource

- Defined in packages/angular/data-source/src/lib/base.data-source.ts:62

#####
Index

### Constructors

constructor

### Properties

__id
_connectedViewer
_connectedViewerTeardown
_data?
_data$
_initialised
_lastRefreshed
_retry$
_viewerIds
change$
destroyed$
error$
hasError?
hasError$
initialised$
interceptors
loading?
loading$
metadata
destroyed$
initialised$
instances

### Accessors

data
hasConnections
id
lastRefreshed

### Methods

_connect
_disconnect
applyMetadata
attach
connect
derive
destroy
disconnect
genericRetryFunction
getMetadata
getViewerId
handelError
init
isConnected
ngOnDestroy
refresh
reset
retry
toJSON
toPromise
add
remove

## Constructors

### constructor

- new BaseDataSource<Data, Metadata, Viewer>(metadata?): BaseDataSource<Data, Metadata, Viewer>

- #### Type Parameters

  - Data = any
  - Metadata extends BaseDataSourceMetadata = BaseDataSourceMetadata
  - Viewer extends BaseDataSourceViewer<any> = BaseDataSourceViewer<any>

  #### Parameters

  - metadata: null | Metadata = null

  #### Returns BaseDataSource<Data, Metadata, Viewer>

  Overrides BaseDefinition<Metadata>.constructor

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:96

## Properties

### `Internal` __id

__id: string = ...

unique internal id

Inherited from BaseDefinition.__id

- Defined in packages/angular/definition/src/lib/definition.ts:61

### `Protected` _connectedViewer

_connectedViewer: Map<string, Observable<Data>> = ...

- Defined in packages/angular/data-source/src/lib/base.data-source.ts:78

### `Protected` _connectedViewerTeardown

_connectedViewerTeardown: Map<string, TeardownLogic> = ...

- Defined in packages/angular/data-source/src/lib/base.data-source.ts:79

### `Protected` `Optional` _data

_data?: Data

- Defined in packages/angular/data-source/src/lib/base.data-source.ts:104

### `Protected` _data$

_data$: Observable<Data> = EMPTY

- Defined in packages/angular/data-source/src/lib/base.data-source.ts:83

### `Protected` _initialised

_initialised: boolean = false

Inherited from BaseDefinition._initialised

- Defined in packages/angular/definition/src/lib/definition.ts:62

### `Protected` _lastRefreshed

_lastRefreshed: null | Date = null

- Defined in packages/angular/data-source/src/lib/base.data-source.ts:77

### `Protected` _retry$

_retry$: Subject<void> = ...

- Defined in packages/angular/data-source/src/lib/base.data-source.ts:90

### `Protected` _viewerIds

_viewerIds: Map<Viewer, string> = ...

a map of viewer to view id. Allows to create a view id from the viewer object reference

- Defined in packages/angular/data-source/src/lib/base.data-source.ts:89

### `Readonly` change$

change$: Subject<Data> = ...

- Defined in packages/angular/data-source/src/lib/base.data-source.ts:67

### `Readonly` destroyed$

destroyed$: undefined | Subject<void> = ...

Emits if the data source is destroyed

Inherited from BaseDefinition.destroyed$

- Defined in packages/angular/definition/src/lib/definition.ts:48

### `Readonly` error$

error$: ReplaySubject<Error> = ...

- Defined in packages/angular/data-source/src/lib/base.data-source.ts:73

### `Optional` hasError

hasError?: Signal<boolean>

- Defined in packages/angular/data-source/src/lib/base.data-source.ts:94

### `Readonly` hasError$

hasError$: ToggleSubject = ...

- Defined in packages/angular/data-source/src/lib/base.data-source.ts:72

### `Readonly` initialised$

initialised$: undefined | Subject<void> = ...

Emits if the data source is initialised

Inherited from BaseDefinition.initialised$

- Defined in packages/angular/definition/src/lib/definition.ts:52

### `Readonly` interceptors

interceptors: undefined | Set<Subject<any>> = ...

Inherited from BaseDefinition.interceptors

- Defined in packages/angular/definition/src/lib/definition.ts:53

### `Optional` loading

loading?: Signal<boolean>

- Defined in packages/angular/data-source/src/lib/base.data-source.ts:92

### loading$

loading$: Observable<boolean> = EMPTY

Indicates weather the data source is currently loading new data

- Defined in packages/angular/data-source/src/lib/base.data-source.ts:71

### metadata

metadata: Metadata

Inherited from BaseDefinition.metadata

- Defined in packages/angular/definition/src/lib/definition.ts:44

### `Static` `Readonly` destroyed$

destroyed$: Subject<BaseDefinition<BaseDefinitionMetadata>> = ...

Emits when a new Definition instance is initialised

Inherited from BaseDefinition.destroyed$

- Defined in packages/angular/definition/src/lib/definition.ts:41

### `Static` `Readonly` initialised$

initialised$: Subject<BaseDefinition<BaseDefinitionMetadata>> = ...

Emits when a new Definition instance is initialised

Inherited from BaseDefinition.initialised$

- Defined in packages/angular/definition/src/lib/definition.ts:35

### `Static` `Readonly` instances

instances: Map<string, BaseDefinition<BaseDefinitionMetadata>> = ...

A map of active Definition instances

Inherited from BaseDefinition.instances

- Defined in packages/angular/definition/src/lib/definition.ts:27

## Accessors

### data

- get data(): undefined | Data

- #### Returns undefined | Data

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:106

### hasConnections

- get hasConnections(): boolean

- #### Returns boolean

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:110

### id

- get id(): string

- #### Returns string

  Inherited from BaseDefinition.id

  - Defined in packages/angular/definition/src/lib/definition.ts:87

### lastRefreshed

- get lastRefreshed(): null | Date

- #### Returns null | Date

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:74

## Methods

### `Protected` _connect

- _connect(viewer): Observable<Data> | [Observable<Data>, TeardownLogic]

- #### Parameters

  - viewer: BaseDataSourceViewer<any>

  #### Returns Observable<Data> | [Observable<Data>, TeardownLogic]

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:323

### `Protected` _disconnect

- _disconnect(viewerId): void

- #### Parameters

  - viewerId: string

  #### Returns void

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:308

### applyMetadata

- applyMetadata(partialMetadata): void

- #### Parameters

  - partialMetadata: Partial<Metadata>

  #### Returns void

  Inherited from BaseDefinition.applyMetadata

  - Defined in packages/angular/definition/src/lib/definition.ts:111

### attach

- attach(viewerId): Observable<Data>

- #### Parameters

  - viewerId: string

  #### Returns Observable<Data>

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:210

### connect

- connect(viewerOrString): Observable<Data>

- #### Parameters

  - viewerOrString: string | Viewer

  #### Returns Observable<Data>

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:124

### derive

- derive(id, metadata?): BaseDataSource<any, BaseDataSourceMetadata, BaseDataSourceViewer<any>>

- #### Parameters

  - id: string
  - metadata: Partial<BaseDataSourceMetadata> = ...

  #### Returns BaseDataSource<any, BaseDataSourceMetadata, BaseDataSourceViewer<any>>

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:270

### destroy

- destroy(): void

- #### Returns void

  #### Deprecated

  use ngOnDestroy instead

  Inherited from BaseDefinition.destroy

  - Defined in packages/angular/definition/src/lib/definition.ts:118

### disconnect

- disconnect(viewerOrId): void

- #### Parameters

  - viewerOrId: string | Viewer

  #### Returns void

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:225

### `Protected` genericRetryFunction

- genericRetryFunction(error, retryCount): Observable<any>

- #### Parameters

  - error: any
  - retryCount: number

  #### Returns Observable<any>

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:311

### getMetadata

- getMetadata(): null | Metadata

- #### Returns null | Metadata

  Inherited from BaseDefinition.getMetadata

  - Defined in packages/angular/definition/src/lib/definition.ts:107

### getViewerId

- getViewerId(viewer): string

- #### Parameters

  - viewer: Viewer

  #### Returns string

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:114

### `Protected` handelError

- handelError(error): void

- #### Parameters

  - error: any

  #### Returns void

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:317

### init

- init(): void

- #### Returns void

  Inherited from BaseDefinition.init

  - Defined in packages/angular/definition/src/lib/definition.ts:127

### isConnected

- isConnected(viewerOrId): boolean

- #### Parameters

  - viewerOrId: string | Viewer

  #### Returns boolean

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:217

### ngOnDestroy

- ngOnDestroy(): void

- #### Returns void

  Inherited from BaseDefinition.ngOnDestroy

  - Defined in packages/angular/definition/src/lib/definition.ts:122

### refresh

- refresh(): any

- #### Returns any

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:290

### reset

- reset(): any

- #### Returns any

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:297

### retry

- retry(): any

- #### Returns any

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:293

### toJSON

- toJSON(): object

- #### Returns object

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:280

### toPromise

- toPromise(viewer): Promise<Data>

- Creates a connection to tha data source and converts the Observable into a promise and then disconnects the viewer

  #### Parameters

  - viewer: Viewer

  #### Returns Promise<Data>

  - Defined in packages/angular/data-source/src/lib/base.data-source.ts:264

### `Static` add

- add(definition): void

- #### Parameters

  - definition: BaseDefinition<BaseDefinitionMetadata>

  #### Returns void

  Inherited from BaseDefinition.add

  - Defined in packages/angular/definition/src/lib/definition.ts:94

### `Static` remove

- remove(definition): void

- #### Parameters

  - definition: BaseDefinition<BaseDefinitionMetadata>

  #### Returns void

  Inherited from BaseDefinition.remove

  - Defined in packages/angular/definition/src/lib/definition.ts:102