Class: LocalStorageSource<QO, TO, QB, TB, QRD, TRD>
Source for storing data in localStorage.
Type parameters​
Name | Type |
---|---|
QO | extends RequestOptions = RecordSourceQueryOptions |
TO | extends RequestOptions = RequestOptions |
QB | RecordQueryBuilder |
TB | RecordTransformBuilder |
QRD | unknown |
TRD | extends 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​
Name | Type |
---|---|
QO | extends RequestOptions = RecordSourceQueryOptions |
TO | extends RequestOptions = RequestOptions |
QB | RecordQueryBuilder <string , RecordIdentity > |
TB | RecordTransformBuilder <string , RecordIdentity , UninitializedRecord > |
QRD | unknown |
TRD | extends RecordCacheUpdateDetails = RecordCacheUpdateDetails |
Parameters​
Name | Type |
---|---|
settings | LocalStorageSourceSettings <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​
Name | Type |
---|---|
options | undefined | 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​
Name | Type |
---|---|
options | undefined | 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​
Name | Type |
---|---|
query | RecordQuery |
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​
Name | Type |
---|---|
transform | RecordTransform |
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​
Name | Type |
---|---|
query | RecordQuery |
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​
Name | Type |
---|---|
transform | RecordTransform |
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​
Name | Type |
---|---|
transform | RecordTransform |
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​
Name | Type |
---|---|
event | Event |
...args | unknown [] |
Returns​
void
Inherited from​
RecordSource.emit
Defined in​
core/dist/modules/evented.d.ts:23
getKeyForRecord​
â–¸ getKeyForRecord(record
): string
Parameters​
Name | Type |
---|---|
record | RecordIdentity | InitializedRecord |
Returns​
string
Defined in​
local-storage/src/local-storage-source.ts:168
getQueryOptions​
â–¸ getQueryOptions(query
, expression?
): undefined
| QO
Parameters​
Name | Type |
---|---|
query | Query <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​
Name | Type |
---|---|
transform | Transform <Operation > |
operation? | Operation |
Returns​
undefined
| TO
Inherited from​
RecordSource.getTransformOptions
Defined in​
data/dist/modules/source.d.ts:48
listeners​
â–¸ listeners(event
): Listener
[]
Parameters​
Name | Type |
---|---|
event | Event |
Returns​
Listener
[]
Inherited from​
RecordSource.listeners
Defined in​
core/dist/modules/evented.d.ts:24
off​
â–¸ off(event
, listener?
): void
Parameters​
Name | Type |
---|---|
event | Event |
listener? | Listener |
Returns​
void
Inherited from​
RecordSource.off
Defined in​
core/dist/modules/evented.d.ts:21
on​
â–¸ on(event
, listener
): () => void
Parameters​
Name | Type |
---|---|
event | Event |
listener | Listener |
Returns​
fn
â–¸ (): void
Returns​
void
Inherited from​
RecordSource.on
Defined in​
core/dist/modules/evented.d.ts:20
one​
â–¸ one(event
, listener
): () => void
Parameters​
Name | Type |
---|---|
event | Event |
listener | Listener |
Returns​
fn
â–¸ (): void
Returns​
void
Inherited from​
RecordSource.one
Defined in​
core/dist/modules/evented.d.ts:22
perform​
â–¸ perform(task
): Promise
<unknown
>
Parameters​
Name | Type |
---|---|
task | Task <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​
Name | Type |
---|---|
RequestOperation | extends RecordOperation = RecordOperation |
Parameters​
Name | Type |
---|---|
queryOrExpressions | QueryOrExpressions <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​
Name | Type |
---|---|
RequestData | extends RecordQueryResult <InitializedRecord > = RecordQueryResult <InitializedRecord > |
RequestDetails | QRD |
RequestOperation | extends RecordOperation = RecordOperation |
Parameters​
Name | Type |
---|---|
queryOrExpressions | QueryOrExpressions <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​
Name | Type |
---|---|
RequestOperation | extends RecordOperation = RecordOperation |
Parameters​
Name | Type |
---|---|
transformOrOperations | TransformOrOperations <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​
Name | Type |
---|---|
RequestData | extends RecordTransformResult <InitializedRecord > = RecordTransformResult <InitializedRecord > |
RequestDetails | extends RecordCacheUpdateDetails = TRD |
RequestOperation | extends RecordOperation = RecordOperation |
Parameters​
Name | Type |
---|---|
transformOrOperations | TransformOrOperations <RecordOperation , RecordTransformBuilder <string , RecordIdentity , UninitializedRecord >> |
options | FullRequestOptions <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​
Name | Type |
---|---|
RequestData | extends RecordQueryResult <InitializedRecord > = RecordQueryResult <InitializedRecord > |
Parameters​
Name | Type |
---|---|
queryOrExpressions | QueryOrExpressions <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​
Name | Type |
---|---|
RequestData | extends RecordQueryResult <InitializedRecord > = RecordQueryResult <InitializedRecord > |
RequestDetails | QRD |
RequestOperation | extends RecordOperation = RecordOperation |
Parameters​
Name | Type |
---|---|
queryOrExpressions | QueryOrExpressions <RecordQueryExpression , QB > |
options | FullRequestOptions <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 Transform
s as an argument and applies it to the source.
Parameters​
Name | Type |
---|---|
transformOrTransforms | Transform <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​
Name | Type |
---|---|
transforms | Transform <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​
Name | Type |
---|---|
RequestData | extends RecordTransformResult <InitializedRecord > = RecordTransformResult <InitializedRecord > |
Parameters​
Name | Type |
---|---|
transformOrOperations | TransformOrOperations <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​
Name | Type |
---|---|
RequestData | extends RecordTransformResult <InitializedRecord > = RecordTransformResult <InitializedRecord > |
RequestDetails | extends RecordCacheUpdateDetails = TRD |
RequestOperation | extends RecordOperation = RecordOperation |
Parameters​
Name | Type |
---|---|
transformOrOperations | TransformOrOperations <RecordOperation , TB > |
options | FullRequestOptions <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