Skip to main content
Version: 0.17

Class: LocalStorageSource<QO, TO, QB, TB, QRD, TRD>

Source for storing data in localStorage.

Type parameters​

NameType
QOextends RequestOptions = RecordSourceQueryOptions
TOextends RequestOptions = RequestOptions
QBRecordQueryBuilder
TBRecordTransformBuilder
QRDunknown
TRDextends RecordCacheUpdateDetails = RecordCacheUpdateDetails

Hierarchy​

  • RecordSource<QO, TO, QB, TB>

  • RecordSyncable

  • RecordPullable<QRD>

  • RecordPushable<TRD>

  • RecordQueryable<QRD, QB, QO>

  • RecordUpdatable<TRD, TB, TO>

  • Resettable

    ↳ LocalStorageSource

Implements​

  • RecordSyncable
  • RecordQueryable<QRD, QB, QO>
  • RecordUpdatable<TRD, TB, TO>

Constructors​

constructor​

• new LocalStorageSource<QO, TO, QB, TB, QRD, TRD>(settings)

Type parameters​

NameType
QOextends RequestOptions = RecordSourceQueryOptions
TOextends RequestOptions = RequestOptions
QBRecordQueryBuilder<string, RecordIdentity>
TBRecordTransformBuilder<string, RecordIdentity, UninitializedRecord>
QRDunknown
TRDextends RecordCacheUpdateDetails = RecordCacheUpdateDetails

Parameters​

NameType
settingsLocalStorageSourceSettings<QO, TO, QB, TB, QRD, TRD>

Inherited from​

RecordSource<QO, TO, QB, TB>.constructor

Defined in​

local-storage/src/local-storage-source.ts:100

Accessors​

activated​

• get activated(): Promise<void>

Returns​

Promise<void>

Inherited from​

RecordSource.activated

Defined in​

data/dist/modules/source.d.ts:54


bucket​

• get bucket(): undefined | Bucket<unknown>

Returns​

undefined | Bucket<unknown>

Inherited from​

RecordSource.bucket

Defined in​

data/dist/modules/source.d.ts:37


cache​

• get cache(): LocalStorageCache<QO, TO, QB, TB, QRD, TRD>

Returns​

LocalStorageCache<QO, TO, QB, TB, QRD, TRD>

Defined in​

local-storage/src/local-storage-source.ts:140


defaultQueryOptions​

• get defaultQueryOptions(): undefined | DefaultRequestOptions<QO>

Returns​

undefined | DefaultRequestOptions<QO>

Inherited from​

RecordSource.defaultQueryOptions

Defined in​

local-storage/src/local-storage-source.ts:152

• set defaultQueryOptions(options): void

Parameters​

NameType
optionsundefined | DefaultRequestOptions<QO>

Returns​

void

Inherited from​

RecordSource.defaultQueryOptions

Defined in​

local-storage/src/local-storage-source.ts:156


defaultTransformOptions​

• get defaultTransformOptions(): undefined | DefaultRequestOptions<TO>

Returns​

undefined | DefaultRequestOptions<TO>

Inherited from​

RecordSource.defaultTransformOptions

Defined in​

local-storage/src/local-storage-source.ts:160

• set defaultTransformOptions(options): void

Parameters​

NameType
optionsundefined | DefaultRequestOptions<TO>

Returns​

void

Inherited from​

RecordSource.defaultTransformOptions

Defined in​

local-storage/src/local-storage-source.ts:164


delimiter​

• get delimiter(): string

Returns​

string

Defined in​

local-storage/src/local-storage-source.ts:148


keyMap​

• get keyMap(): undefined | RecordKeyMap

Returns​

undefined | RecordKeyMap

Inherited from​

RecordSource.keyMap

Defined in​

records/dist/modules/record-source.d.ts:57


name​

• get name(): undefined | string

Returns​

undefined | string

Inherited from​

RecordSource.name

Defined in​

data/dist/modules/source.d.ts:36


namespace​

• get namespace(): string

Returns​

string

Defined in​

local-storage/src/local-storage-source.ts:144


queryBuilder​

• get queryBuilder(): QB

Returns​

QB

Inherited from​

RecordSource.queryBuilder

Defined in​

records/dist/modules/record-source.d.ts:59


requestQueue​

• get requestQueue(): TaskQueue<string, unknown, unknown, unknown>

Returns​

TaskQueue<string, unknown, unknown, unknown>

Inherited from​

RecordSource.requestQueue

Defined in​

data/dist/modules/source.d.ts:39


schema​

• get schema(): RecordSchema

Returns​

RecordSchema

Inherited from​

RecordSource.schema

Defined in​

records/dist/modules/record-source.d.ts:56


syncQueue​

• get syncQueue(): TaskQueue<string, unknown, unknown, unknown>

Returns​

TaskQueue<string, unknown, unknown, unknown>

Inherited from​

RecordSource.syncQueue

Defined in​

data/dist/modules/source.d.ts:40


transformBuilder​

• get transformBuilder(): TB

Returns​

TB

Inherited from​

RecordSource.transformBuilder

Defined in​

records/dist/modules/record-source.d.ts:60


transformLog​

• get transformLog(): Log

Returns​

Log

Inherited from​

RecordSource.transformLog

Defined in​

data/dist/modules/source.d.ts:38


validatorFor​

• get validatorFor(): undefined | ValidatorForFn<StandardValidator | StandardRecordValidator>

Returns​

undefined | ValidatorForFn<StandardValidator | StandardRecordValidator>

Inherited from​

RecordSource.validatorFor

Defined in​

records/dist/modules/record-source.d.ts:58

Methods​

_pull​

â–¸ _pull(query): Promise<FullResponse<undefined, QRD, RecordOperation>>

Parameters​

NameType
queryRecordQuery

Returns​

Promise<FullResponse<undefined, QRD, RecordOperation>>

Inherited from​

RecordPullable._pull

Defined in​

local-storage/src/local-storage-source.ts:301


_push​

â–¸ _push(transform): Promise<FullResponse<undefined, TRD, RecordOperation>>

Parameters​

NameType
transformRecordTransform

Returns​

Promise<FullResponse<undefined, TRD, RecordOperation>>

Inherited from​

RecordPushable._push

Defined in​

local-storage/src/local-storage-source.ts:284


_query​

â–¸ _query(query, hints?): Promise<FullResponse<RecordQueryResult<InitializedRecord>, QRD, RecordOperation>>

Parameters​

NameType
queryRecordQuery
hints?ResponseHints<RecordQueryResult<InitializedRecord>, QRD>

Returns​

Promise<FullResponse<RecordQueryResult<InitializedRecord>, QRD, RecordOperation>>

Inherited from​

RecordQueryable._query

Defined in​

local-storage/src/local-storage-source.ts:245


_sync​

â–¸ _sync(transform): Promise<void>

Parameters​

NameType
transformRecordTransform

Returns​

Promise<void>

Inherited from​

RecordSyncable._sync

Defined in​

local-storage/src/local-storage-source.ts:188


_update​

â–¸ _update(transform, hints?): Promise<FullResponse<RecordTransformResult<InitializedRecord>, TRD, RecordOperation>>

Parameters​

NameType
transformRecordTransform
hints?ResponseHints<RecordTransformResult<InitializedRecord>, TRD>

Returns​

Promise<FullResponse<RecordTransformResult<InitializedRecord>, TRD, RecordOperation>>

Inherited from​

RecordUpdatable._update

Defined in​

local-storage/src/local-storage-source.ts:199


activate​

â–¸ activate(): Promise<void>

Returns​

Promise<void>

Inherited from​

RecordSource.activate

Defined in​

data/dist/modules/source.d.ts:55


deactivate​

â–¸ deactivate(): Promise<void>

Returns​

Promise<void>

Inherited from​

RecordSource.deactivate

Defined in​

data/dist/modules/source.d.ts:56


emit​

â–¸ emit(event, ...args): void

Parameters​

NameType
eventEvent
...argsunknown[]

Returns​

void

Inherited from​

RecordSource.emit

Defined in​

core/dist/modules/evented.d.ts:23


getKeyForRecord​

â–¸ getKeyForRecord(record): string

Parameters​

NameType
recordRecordIdentity | InitializedRecord

Returns​

string

Defined in​

local-storage/src/local-storage-source.ts:168


getQueryOptions​

â–¸ getQueryOptions(query, expression?): undefined | QO

Parameters​

NameType
queryQuery<QueryExpression>
expression?QueryExpression

Returns​

undefined | QO

Inherited from​

RecordSource.getQueryOptions

Defined in​

data/dist/modules/source.d.ts:47


getTransformOptions​

â–¸ getTransformOptions(transform, operation?): undefined | TO

Parameters​

NameType
transformTransform<Operation>
operation?Operation

Returns​

undefined | TO

Inherited from​

RecordSource.getTransformOptions

Defined in​

data/dist/modules/source.d.ts:48


listeners​

â–¸ listeners(event): Listener[]

Parameters​

NameType
eventEvent

Returns​

Listener[]

Inherited from​

RecordSource.listeners

Defined in​

core/dist/modules/evented.d.ts:24


off​

â–¸ off(event, listener?): void

Parameters​

NameType
eventEvent
listener?Listener

Returns​

void

Inherited from​

RecordSource.off

Defined in​

core/dist/modules/evented.d.ts:21


on​

â–¸ on(event, listener): () => void

Parameters​

NameType
eventEvent
listenerListener

Returns​

fn

â–¸ (): void

Returns​

void

Inherited from​

RecordSource.on

Defined in​

core/dist/modules/evented.d.ts:20


one​

â–¸ one(event, listener): () => void

Parameters​

NameType
eventEvent
listenerListener

Returns​

fn

â–¸ (): void

Returns​

void

Inherited from​

RecordSource.one

Defined in​

core/dist/modules/evented.d.ts:22


perform​

â–¸ perform(task): Promise<unknown>

Parameters​

NameType
taskTask<string, unknown, unknown>

Returns​

Promise<unknown>

Inherited from​

RecordSource.perform

Defined in​

data/dist/modules/source.d.ts:49


pull​

â–¸ pull<RequestOperation>(queryOrExpressions, options?, id?): Promise<Transform<RequestOperation>[]>

The pull method accepts a query or expression(s) and returns a promise that resolves to an array of Transform instances that represent the changeset that resulted from applying the query. In other words, a pull request retrieves the results of a query in Transform form.

Type parameters​

NameType
RequestOperationextends RecordOperation = RecordOperation

Parameters​

NameType
queryOrExpressionsQueryOrExpressions<RecordQueryExpression, RecordQueryBuilder<string, RecordIdentity>>
options?DefaultRequestOptions<RequestOptions>
id?string

Returns​

Promise<Transform<RequestOperation>[]>

Inherited from​

RecordPullable.pull

Defined in​

data/dist/modules/source-interfaces/pullable.d.ts:25

â–¸ pull<RequestData, RequestDetails, RequestOperation>(queryOrExpressions, options?, id?): Promise<FullResponse<RequestData, RequestDetails, RequestOperation>>

Type parameters​

NameType
RequestDataextends RecordQueryResult<InitializedRecord> = RecordQueryResult<InitializedRecord>
RequestDetailsQRD
RequestOperationextends RecordOperation = RecordOperation

Parameters​

NameType
queryOrExpressionsQueryOrExpressions<RecordQueryExpression, RecordQueryBuilder<string, RecordIdentity>>
options?FullRequestOptions<RequestOptions>
id?string

Returns​

Promise<FullResponse<RequestData, RequestDetails, RequestOperation>>

Inherited from​

RecordPullable.pull

Defined in​

data/dist/modules/source-interfaces/pullable.d.ts:26


push​

â–¸ push<RequestOperation>(transformOrOperations, options?, id?): Promise<Transform<RequestOperation>[]>

The push method accepts a Transform instance as an argument and returns a promise that resolves to an array of Transform instances that are applied as a result. In other words, push captures the direct results and side effects of applying a Transform to a source.

Type parameters​

NameType
RequestOperationextends RecordOperation = RecordOperation

Parameters​

NameType
transformOrOperationsTransformOrOperations<RecordOperation, RecordTransformBuilder<string, RecordIdentity, UninitializedRecord>>
options?DefaultRequestOptions<RequestOptions>
id?string

Returns​

Promise<Transform<RequestOperation>[]>

Inherited from​

RecordPushable.push

Defined in​

data/dist/modules/source-interfaces/pushable.d.ts:23

â–¸ push<RequestData, RequestDetails, RequestOperation>(transformOrOperations, options, id?): Promise<FullResponse<RequestData, RequestDetails, RequestOperation>>

Type parameters​

NameType
RequestDataextends RecordTransformResult<InitializedRecord> = RecordTransformResult<InitializedRecord>
RequestDetailsextends RecordCacheUpdateDetails = TRD
RequestOperationextends RecordOperation = RecordOperation

Parameters​

NameType
transformOrOperationsTransformOrOperations<RecordOperation, RecordTransformBuilder<string, RecordIdentity, UninitializedRecord>>
optionsFullRequestOptions<RequestOptions>
id?string

Returns​

Promise<FullResponse<RequestData, RequestDetails, RequestOperation>>

Inherited from​

RecordPushable.push

Defined in​

data/dist/modules/source-interfaces/pushable.d.ts:24


query​

â–¸ query<RequestData>(queryOrExpressions, options?, id?): Promise<RequestData>

Type parameters​

NameType
RequestDataextends RecordQueryResult<InitializedRecord> = RecordQueryResult<InitializedRecord>

Parameters​

NameType
queryOrExpressionsQueryOrExpressions<RecordQueryExpression, QB>
options?DefaultRequestOptions<QO>
id?string

Returns​

Promise<RequestData>

Inherited from​

RecordQueryable.query

Defined in​

data/dist/modules/queryable.d.ts:7

â–¸ query<RequestData, RequestDetails, RequestOperation>(queryOrExpressions, options, id?): Promise<FullResponse<RequestData, RequestDetails, RequestOperation>>

Type parameters​

NameType
RequestDataextends RecordQueryResult<InitializedRecord> = RecordQueryResult<InitializedRecord>
RequestDetailsQRD
RequestOperationextends RecordOperation = RecordOperation

Parameters​

NameType
queryOrExpressionsQueryOrExpressions<RecordQueryExpression, QB>
optionsFullRequestOptions<QO>
id?string

Returns​

Promise<FullResponse<RequestData, RequestDetails, RequestOperation>>

Inherited from​

RecordQueryable.query

Defined in​

data/dist/modules/queryable.d.ts:8


reset​

â–¸ reset(): Promise<void>

Returns​

Promise<void>

Inherited from​

Resettable.reset

Defined in​

local-storage/src/local-storage-source.ts:180


sync​

â–¸ sync(transformOrTransforms): Promise<void>

The sync method to a source. This method accepts a Transform or array of Transforms as an argument and applies it to the source.

Parameters​

NameType
transformOrTransformsTransform<RecordOperation> | Transform<RecordOperation>[] | TransformBuilderFunc<RecordOperation, RecordTransformBuilder<string, RecordIdentity, UninitializedRecord>>

Returns​

Promise<void>

Inherited from​

RecordSyncable.sync

Defined in​

data/dist/modules/source-interfaces/syncable.d.ts:17


transformed​

â–¸ transformed(transforms): Promise<void>

Notifies listeners that this source has been transformed by emitting the transform event.

Resolves when any promises returned to event listeners are resolved.

Also, adds an entry to the Source's transformLog for each transform.

Parameters​

NameType
transformsTransform<Operation>[]

Returns​

Promise<void>

Inherited from​

RecordSource.transformed

Defined in​

data/dist/modules/source.d.ts:65


update​

â–¸ update<RequestData>(transformOrOperations, options?, id?): Promise<RequestData>

Type parameters​

NameType
RequestDataextends RecordTransformResult<InitializedRecord> = RecordTransformResult<InitializedRecord>

Parameters​

NameType
transformOrOperationsTransformOrOperations<RecordOperation, TB>
options?DefaultRequestOptions<TO>
id?string

Returns​

Promise<RequestData>

Inherited from​

RecordUpdatable.update

Defined in​

data/dist/modules/updatable.d.ts:6

â–¸ update<RequestData, RequestDetails, RequestOperation>(transformOrOperations, options, id?): Promise<FullResponse<RequestData, RequestDetails, RequestOperation>>

Type parameters​

NameType
RequestDataextends RecordTransformResult<InitializedRecord> = RecordTransformResult<InitializedRecord>
RequestDetailsextends RecordCacheUpdateDetails = TRD
RequestOperationextends RecordOperation = RecordOperation

Parameters​

NameType
transformOrOperationsTransformOrOperations<RecordOperation, TB>
optionsFullRequestOptions<TO>
id?string

Returns​

Promise<FullResponse<RequestData, RequestDetails, RequestOperation>>

Inherited from​

RecordUpdatable.update

Defined in​

data/dist/modules/updatable.d.ts:7


upgrade​

â–¸ upgrade(): Promise<void>

Returns​

Promise<void>

Inherited from​

RecordSource.upgrade

Defined in​

local-storage/src/local-storage-source.ts:172