[**@rxap/data-source v19.1.1-dev.0**](../README.md)

***

[@rxap/data-source](../globals.md) / BaseDataSource

# Class: BaseDataSource\<Data, Metadata, Viewer\>

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:62](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L62)

## Extends

- `BaseDefinition`\<`Metadata`\>

## Extended by

- [`MethodDataSource`](MethodDataSource.md)
- [`ObservableDataSource`](ObservableDataSource.md)
- [`PipeDataSource`](PipeDataSource.md)
- [`StaticDataSource`](StaticDataSource.md)

## Type Parameters

• **Data** = `any`

• **Metadata** *extends* [`BaseDataSourceMetadata`](../interfaces/BaseDataSourceMetadata.md) = [`BaseDataSourceMetadata`](../interfaces/BaseDataSourceMetadata.md)

• **Viewer** *extends* [`BaseDataSourceViewer`](../interfaces/BaseDataSourceViewer.md) = [`BaseDataSourceViewer`](../interfaces/BaseDataSourceViewer.md)

## Constructors

### new BaseDataSource()

> **new BaseDataSource**\<`Data`, `Metadata`, `Viewer`\>(`metadata`): [`BaseDataSource`](BaseDataSource.md)\<`Data`, `Metadata`, `Viewer`\>

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:96](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L96)

#### Parameters

##### metadata

`null` | `Metadata`

#### Returns

[`BaseDataSource`](BaseDataSource.md)\<`Data`, `Metadata`, `Viewer`\>

#### Overrides

`BaseDefinition<Metadata>.constructor`

## Properties

### \_\_id

> **\_\_id**: `string`

Defined in: [packages/angular/definition/src/lib/definition.ts:61](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/definition/src/lib/definition.ts#L61)

**`Internal`**

unique internal id

#### Inherited from

`BaseDefinition.__id`

***

### \_connectedViewer

> `protected` **\_connectedViewer**: `Map`\<`string`, `Observable`\<`Data`\>\>

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:78](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L78)

***

### \_connectedViewerTeardown

> `protected` **\_connectedViewerTeardown**: `Map`\<`string`, `TeardownLogic`\>

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:79](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L79)

***

### \_data?

> `protected` `optional` **\_data**: `Data`

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:104](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L104)

***

### \_data$

> `protected` **\_data$**: `Observable`\<`Data`\> = `EMPTY`

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:83](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L83)

***

### \_initialised

> `protected` **\_initialised**: `boolean` = `false`

Defined in: [packages/angular/definition/src/lib/definition.ts:62](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/definition/src/lib/definition.ts#L62)

#### Inherited from

`BaseDefinition._initialised`

***

### \_lastRefreshed

> `protected` **\_lastRefreshed**: `null` \| `Date` = `null`

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:77](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L77)

***

### \_retry$

> `protected` **\_retry$**: `Subject`\<`void`\>

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:90](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L90)

***

### \_viewerIds

> `protected` **\_viewerIds**: `Map`\<`Viewer`, `string`\>

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:89](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L89)

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

***

### change$

> `readonly` **change$**: `Subject`\<`Data`\>

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:67](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L67)

***

### destroyed$

> `readonly` **destroyed$**: `undefined` \| `Subject`\<`void`\>

Defined in: [packages/angular/definition/src/lib/definition.ts:48](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/definition/src/lib/definition.ts#L48)

Emits if the data source is destroyed

#### Inherited from

`BaseDefinition.destroyed$`

***

### error$

> `readonly` **error$**: `ReplaySubject`\<`Error`\>

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:73](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L73)

***

### hasError?

> `optional` **hasError**: `Signal`\<`boolean`\>

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:94](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L94)

***

### hasError$

> `readonly` **hasError$**: `ToggleSubject`

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:72](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L72)

***

### initialised$

> `readonly` **initialised$**: `undefined` \| `Subject`\<`void`\>

Defined in: [packages/angular/definition/src/lib/definition.ts:52](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/definition/src/lib/definition.ts#L52)

Emits if the data source is initialised

#### Inherited from

`BaseDefinition.initialised$`

***

### interceptors

> `readonly` **interceptors**: `undefined` \| `Set`\<`Subject`\<`any`\>\>

Defined in: [packages/angular/definition/src/lib/definition.ts:53](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/definition/src/lib/definition.ts#L53)

#### Inherited from

`BaseDefinition.interceptors`

***

### loading?

> `optional` **loading**: `Signal`\<`boolean`\>

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:92](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L92)

***

### loading$

> **loading$**: `Observable`\<`boolean`\> = `EMPTY`

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:71](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L71)

Indicates weather the data source is currently loading new data

***

### metadata

> **metadata**: `Metadata`

Defined in: [packages/angular/definition/src/lib/definition.ts:44](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/definition/src/lib/definition.ts#L44)

#### Inherited from

`BaseDefinition.metadata`

***

### destroyed$

> `readonly` `static` **destroyed$**: `Subject`\<`BaseDefinition`\<`BaseDefinitionMetadata`\>\>

Defined in: [packages/angular/definition/src/lib/definition.ts:41](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/definition/src/lib/definition.ts#L41)

Emits when a new Definition instance is initialised

#### Inherited from

`BaseDefinition.destroyed$`

***

### initialised$

> `readonly` `static` **initialised$**: `Subject`\<`BaseDefinition`\<`BaseDefinitionMetadata`\>\>

Defined in: [packages/angular/definition/src/lib/definition.ts:35](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/definition/src/lib/definition.ts#L35)

Emits when a new Definition instance is initialised

#### Inherited from

`BaseDefinition.initialised$`

***

### instances

> `readonly` `static` **instances**: `Map`\<`string`, `BaseDefinition`\<`BaseDefinitionMetadata`\>\>

Defined in: [packages/angular/definition/src/lib/definition.ts:27](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/definition/src/lib/definition.ts#L27)

A map of active Definition instances

#### Inherited from

`BaseDefinition.instances`

## Accessors

### data

#### Get Signature

> **get** **data**(): `undefined` \| `Data`

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:106](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L106)

##### Returns

`undefined` \| `Data`

***

### hasConnections

#### Get Signature

> **get** **hasConnections**(): `boolean`

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:110](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L110)

##### Returns

`boolean`

***

### id

#### Get Signature

> **get** **id**(): `string`

Defined in: [packages/angular/definition/src/lib/definition.ts:87](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/definition/src/lib/definition.ts#L87)

##### Returns

`string`

#### Inherited from

`BaseDefinition.id`

***

### lastRefreshed

#### Get Signature

> **get** **lastRefreshed**(): `null` \| `Date`

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:74](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L74)

##### Returns

`null` \| `Date`

## Methods

### \_connect()

> `protected` **\_connect**(`viewer`): `Observable`\<`Data`\> \| \[`Observable`\<`Data`\>, `TeardownLogic`\]

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:323](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L323)

#### Parameters

##### viewer

[`BaseDataSourceViewer`](../interfaces/BaseDataSourceViewer.md)

#### Returns

`Observable`\<`Data`\> \| \[`Observable`\<`Data`\>, `TeardownLogic`\]

***

### \_disconnect()

> `protected` **\_disconnect**(`viewerId`): `void`

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:308](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L308)

#### Parameters

##### viewerId

`string`

#### Returns

`void`

***

### applyMetadata()

> **applyMetadata**(`partialMetadata`): `void`

Defined in: [packages/angular/definition/src/lib/definition.ts:111](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/definition/src/lib/definition.ts#L111)

#### Parameters

##### partialMetadata

`Partial`\<`Metadata`\>

#### Returns

`void`

#### Inherited from

`BaseDefinition.applyMetadata`

***

### attach()

> **attach**(`viewerId`): `Observable`\<`Data`\>

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:210](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L210)

#### Parameters

##### viewerId

`string`

#### Returns

`Observable`\<`Data`\>

***

### connect()

> **connect**(`viewerOrString`): `Observable`\<`Data`\>

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:124](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L124)

#### Parameters

##### viewerOrString

`string` | `Viewer`

#### Returns

`Observable`\<`Data`\>

***

### derive()

> **derive**(`id`, `metadata`): [`BaseDataSource`](BaseDataSource.md)\<`any`\>

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:270](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L270)

#### Parameters

##### id

`string`

##### metadata

`Partial`\<[`BaseDataSourceMetadata`](../interfaces/BaseDataSourceMetadata.md)\> = `...`

#### Returns

[`BaseDataSource`](BaseDataSource.md)\<`any`\>

***

### ~~destroy()~~

> **destroy**(): `void`

Defined in: [packages/angular/definition/src/lib/definition.ts:118](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/definition/src/lib/definition.ts#L118)

#### Returns

`void`

#### Deprecated

use ngOnDestroy instead

#### Inherited from

`BaseDefinition.destroy`

***

### disconnect()

> **disconnect**(`viewerOrId`): `void`

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:225](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L225)

#### Parameters

##### viewerOrId

`string` | `Viewer`

#### Returns

`void`

***

### genericRetryFunction()

> `protected` **genericRetryFunction**(`error`, `retryCount`): `Observable`\<`any`\>

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:311](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L311)

#### Parameters

##### error

`any`

##### retryCount

`number`

#### Returns

`Observable`\<`any`\>

***

### getMetadata()

> **getMetadata**(): `null` \| `Metadata`

Defined in: [packages/angular/definition/src/lib/definition.ts:107](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/definition/src/lib/definition.ts#L107)

#### Returns

`null` \| `Metadata`

#### Inherited from

`BaseDefinition.getMetadata`

***

### getViewerId()

> **getViewerId**(`viewer`): `string`

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:114](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L114)

#### Parameters

##### viewer

`Viewer`

#### Returns

`string`

***

### handelError()

> `protected` **handelError**(`error`): `void`

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:317](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L317)

#### Parameters

##### error

`any`

#### Returns

`void`

***

### init()

> **init**(): `void`

Defined in: [packages/angular/definition/src/lib/definition.ts:127](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/definition/src/lib/definition.ts#L127)

#### Returns

`void`

#### Inherited from

`BaseDefinition.init`

***

### isConnected()

> **isConnected**(`viewerOrId`): `boolean`

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:217](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L217)

#### Parameters

##### viewerOrId

`string` | `Viewer`

#### Returns

`boolean`

***

### ngOnDestroy()

> **ngOnDestroy**(): `void`

Defined in: [packages/angular/definition/src/lib/definition.ts:122](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/definition/src/lib/definition.ts#L122)

A callback method that performs custom clean-up, invoked immediately
before a directive, pipe, or service instance is destroyed.

#### Returns

`void`

#### Inherited from

`BaseDefinition.ngOnDestroy`

***

### refresh()

> **refresh**(): `any`

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:290](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L290)

#### Returns

`any`

***

### reset()

> **reset**(): `any`

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:297](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L297)

#### Returns

`any`

***

### retry()

> **retry**(): `any`

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:293](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L293)

#### Returns

`any`

***

### toJSON()

> **toJSON**(): `object`

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:280](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L280)

#### Returns

`object`

***

### toPromise()

> **toPromise**(`viewer`): `Promise`\<`Data`\>

Defined in: [packages/angular/data-source/src/lib/base.data-source.ts:264](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/data-source/src/lib/base.data-source.ts#L264)

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`\>

***

### add()

> `static` **add**(`definition`): `void`

Defined in: [packages/angular/definition/src/lib/definition.ts:94](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/definition/src/lib/definition.ts#L94)

#### Parameters

##### definition

`BaseDefinition`

#### Returns

`void`

#### Inherited from

`BaseDefinition.add`

***

### remove()

> `static` **remove**(`definition`): `void`

Defined in: [packages/angular/definition/src/lib/definition.ts:102](https://gitlab.com/rxap/packages/-/blob/578764e2054aada088559336f4c2cf49e388b60e/packages/angular/definition/src/lib/definition.ts#L102)

#### Parameters

##### definition

`BaseDefinition`

#### Returns

`void`

#### Inherited from

`BaseDefinition.remove`
