Class: IndexedDBCache<QO, TO, QB, TB, QRD, TRD>
A cache used to access records in an IndexedDB database.
Because IndexedDB access is async, this cache extends AsyncRecordCache
.
Type parameters​
Name | Type |
---|---|
QO | extends RequestOptions = RecordCacheQueryOptions |
TO | extends RequestOptions = RecordCacheTransformOptions |
QB | RecordQueryBuilder |
TB | RecordTransformBuilder |
QRD | unknown |
TRD | extends RecordCacheUpdateDetails = RecordCacheUpdateDetails |
Hierarchy​
AsyncRecordCache
<QO
,TO
,QB
,TB
,QRD
,TRD
>↳
IndexedDBCache
Constructors​
constructor​
• new IndexedDBCache<QO
, TO
, QB
, TB
, QRD
, TRD
>(settings
)
Type parameters​
Name | Type |
---|---|
QO | extends RequestOptions = RecordCacheQueryOptions |
TO | extends RequestOptions = RecordCacheTransformOptions |
QB | RecordQueryBuilder <string , RecordIdentity > |
TB | RecordTransformBuilder <string , RecordIdentity , UninitializedRecord > |
QRD | unknown |
TRD | extends RecordCacheUpdateDetails = RecordCacheUpdateDetails |
Parameters​
Name | Type |
---|---|
settings | IndexedDBCacheSettings <QO , TO , QB , TB > |
Overrides​
AsyncRecordCache<QO, TO, QB, TB, QRD, TRD\>.constructor
Defined in​
indexeddb/src/indexeddb-cache.ts:81
Accessors​
dbName​
• get
dbName(): string
IndexedDB database name.
Defaults to the namespace of the app, which can be overridden in the constructor.
Returns​
string
Defined in​
indexeddb/src/indexeddb-cache.ts:133
dbVersion​
• get
dbVersion(): number
The version to specify when opening the IndexedDB database.
Returns​
number
Defined in​
indexeddb/src/indexeddb-cache.ts:124
defaultQueryOptions​
• get
defaultQueryOptions(): undefined
| DefaultRequestOptions
<QueryOptions
>
Returns​
undefined
| DefaultRequestOptions
<QueryOptions
>
Inherited from​
AsyncRecordCache.defaultQueryOptions
Defined in​
record-cache/dist/modules/record-cache.d.ts:53
• set
defaultQueryOptions(options
): void
Parameters​
Name | Type |
---|---|
options | undefined | DefaultRequestOptions <QueryOptions > |
Returns​
void
Inherited from​
AsyncRecordCache.defaultQueryOptions
Defined in​
record-cache/dist/modules/record-cache.d.ts:54
defaultTransformOptions​
• get
defaultTransformOptions(): undefined
| DefaultRequestOptions
<TransformOptions
>
Returns​
undefined
| DefaultRequestOptions
<TransformOptions
>
Inherited from​
AsyncRecordCache.defaultTransformOptions
Defined in​
record-cache/dist/modules/record-cache.d.ts:55
• set
defaultTransformOptions(options
): void
Parameters​
Name | Type |
---|---|
options | undefined | DefaultRequestOptions <TransformOptions > |
Returns​
void
Inherited from​
AsyncRecordCache.defaultTransformOptions
Defined in​
record-cache/dist/modules/record-cache.d.ts:56
isDBOpen​
• get
isDBOpen(): boolean
Returns​
boolean
Defined in​
indexeddb/src/indexeddb-cache.ts:137
keyMap​
• get
keyMap(): undefined
| RecordKeyMap
Returns​
undefined
| RecordKeyMap
Inherited from​
AsyncRecordCache.keyMap
Defined in​
record-cache/dist/modules/record-cache.d.ts:49
name​
• get
name(): undefined
| string
Returns​
undefined
| string
Inherited from​
AsyncRecordCache.name
Defined in​
record-cache/dist/modules/record-cache.d.ts:47
namespace​
• get
namespace(): string
Returns​
string
Defined in​
indexeddb/src/indexeddb-cache.ts:101
processors​
• get
processors(): AsyncOperationProcessor
[]
Returns​
AsyncOperationProcessor
[]
Inherited from​
AsyncRecordCache.processors
Defined in​
record-cache/dist/modules/async-record-cache.d.ts:29
queryBuilder​
• get
queryBuilder(): QueryBuilder
Returns​
QueryBuilder
Inherited from​
AsyncRecordCache.queryBuilder
Defined in​
record-cache/dist/modules/record-cache.d.ts:51
schema​
• get
schema(): RecordSchema
Returns​
RecordSchema
Inherited from​
AsyncRecordCache.schema
Defined in​
record-cache/dist/modules/record-cache.d.ts:48
transformBuilder​
• get
transformBuilder(): TransformBuilder
Returns​
TransformBuilder
Inherited from​
AsyncRecordCache.transformBuilder
Defined in​
record-cache/dist/modules/record-cache.d.ts:52
validatorFor​
• get
validatorFor(): undefined
| ValidatorForFn
<StandardValidator
| StandardRecordValidator
>
Returns​
undefined
| ValidatorForFn
<StandardValidator
| StandardRecordValidator
>
Inherited from​
AsyncRecordCache.validatorFor
Defined in​
record-cache/dist/modules/record-cache.d.ts:50
Methods​
addInverseRelationshipsAsync​
â–¸ addInverseRelationshipsAsync(relationships
): Promise
<void
>
Parameters​
Name | Type |
---|---|
relationships | RecordRelationshipIdentity [] |
Returns​
Promise
<void
>
Overrides​
AsyncRecordCache.addInverseRelationshipsAsync
Defined in​
indexeddb/src/indexeddb-cache.ts:537
applyRecordChangesetAsync​
â–¸ applyRecordChangesetAsync(changeset
): Promise
<void
>
Parameters​
Name | Type |
---|---|
changeset | RecordChangeset |
Returns​
Promise
<void
>
Inherited from​
AsyncRecordCache.applyRecordChangesetAsync
Defined in​
record-cache/dist/modules/async-record-cache.d.ts:42
clearRecords​
â–¸ clearRecords(type
): Promise
<void
>
Parameters​
Name | Type |
---|---|
type | string |
Returns​
Promise
<void
>
Defined in​
indexeddb/src/indexeddb-cache.ts:273
closeDB​
â–¸ closeDB(): Promise
<void
>
Returns​
Promise
<void
>
Defined in​
indexeddb/src/indexeddb-cache.ts:170
createDB​
â–¸ createDB(db
): void
Initializes the contents of the database.
Idempotently register models which do not yet have corresponding object stores. Also, creates an object store for tracking inverse relationships, if it is missing.
Override this method and/or registerModel
to provide more advanced
db initialization.
Parameters​
Name | Type |
---|---|
db | IDBDatabase |
Returns​
void
Defined in​
indexeddb/src/indexeddb-cache.ts:199
createInverseRelationshipStore​
â–¸ createInverseRelationshipStore(db
): void
Parameters​
Name | Type |
---|---|
db | IDBDatabase |
Returns​
void
Defined in​
indexeddb/src/indexeddb-cache.ts:213
createTransaction​
â–¸ createTransaction(storeNames
, mode?
): IDBTransaction
Parameters​
Name | Type |
---|---|
storeNames | string [] |
mode? | IDBTransactionMode |
Returns​
IDBTransaction
Defined in​
indexeddb/src/indexeddb-cache.ts:258
deleteDB​
â–¸ deleteDB(): Promise
<void
>
Returns​
Promise
<void
>
Defined in​
indexeddb/src/indexeddb-cache.ts:242
emit​
â–¸ emit(event
, ...args
): void
Parameters​
Name | Type |
---|---|
event | Event |
...args | unknown [] |
Returns​
void
Inherited from​
AsyncRecordCache.emit
Defined in​
core/dist/modules/evented.d.ts:23
getInverseRelationshipsAsync​
â–¸ getInverseRelationshipsAsync(recordIdentityOrIdentities
): Promise
<RecordRelationshipIdentity
[]>
Parameters​
Name | Type |
---|---|
recordIdentityOrIdentities | RecordIdentity | RecordIdentity [] |
Returns​
Promise
<RecordRelationshipIdentity
[]>
Overrides​
AsyncRecordCache.getInverseRelationshipsAsync
Defined in​
indexeddb/src/indexeddb-cache.ts:478
getInverseTransformOperator​
â–¸ getInverseTransformOperator(op
): AsyncInverseTransformOperator
Parameters​
Name | Type |
---|---|
op | string |
Returns​
AsyncInverseTransformOperator
Inherited from​
AsyncRecordCache.getInverseTransformOperator
Defined in​
record-cache/dist/modules/async-record-cache.d.ts:32
getQueryOperator​
â–¸ getQueryOperator(op
): AsyncQueryOperator
Parameters​
Name | Type |
---|---|
op | string |
Returns​
AsyncQueryOperator
Inherited from​
AsyncRecordCache.getQueryOperator
Defined in​
record-cache/dist/modules/async-record-cache.d.ts:30
getQueryOptions​
â–¸ getQueryOptions(query
, expression?
): undefined
| QO
Parameters​
Name | Type |
---|---|
query | RecordQuery |
expression? | RecordQueryExpression |
Returns​
undefined
| QO
Inherited from​
AsyncRecordCache.getQueryOptions
Defined in​
record-cache/dist/modules/record-cache.d.ts:57
getRecordAsync​
â–¸ getRecordAsync(record
): Promise
<undefined
| InitializedRecord
>
Parameters​
Name | Type |
---|---|
record | RecordIdentity |
Returns​
Promise
<undefined
| InitializedRecord
>
Overrides​
AsyncRecordCache.getRecordAsync
Defined in​
indexeddb/src/indexeddb-cache.ts:289
getRecordsAsync​
â–¸ getRecordsAsync(typeOrIdentities?
): Promise
<InitializedRecord
[]>
Parameters​
Name | Type |
---|---|
typeOrIdentities? | string | RecordIdentity [] |
Returns​
Promise
<InitializedRecord
[]>
Overrides​
AsyncRecordCache.getRecordsAsync
Defined in​
indexeddb/src/indexeddb-cache.ts:313
getRelatedRecordAsync​
â–¸ getRelatedRecordAsync(identity
, relationship
): Promise
<undefined
| null
| RecordIdentity
>
Parameters​
Name | Type |
---|---|
identity | RecordIdentity |
relationship | string |
Returns​
Promise
<undefined
| null
| RecordIdentity
>
Inherited from​
AsyncRecordCache.getRelatedRecordAsync
Defined in​
record-cache/dist/modules/async-record-cache.d.ts:43
getRelatedRecordsAsync​
â–¸ getRelatedRecordsAsync(identity
, relationship
): Promise
<undefined
| RecordIdentity
[]>
Parameters​
Name | Type |
---|---|
identity | RecordIdentity |
relationship | string |
Returns​
Promise
<undefined
| RecordIdentity
[]>
Inherited from​
AsyncRecordCache.getRelatedRecordsAsync
Defined in​
record-cache/dist/modules/async-record-cache.d.ts:44
getTransformOperator​
â–¸ getTransformOperator(op
): AsyncTransformOperator
Parameters​
Name | Type |
---|---|
op | string |
Returns​
AsyncTransformOperator
Inherited from​
AsyncRecordCache.getTransformOperator
Defined in​
record-cache/dist/modules/async-record-cache.d.ts:31
getTransformOptions​
â–¸ getTransformOptions(transform
, operation?
): undefined
| TO
Parameters​
Name | Type |
---|---|
transform | RecordTransform |
operation? | RecordOperation |
Returns​
undefined
| TO
Inherited from​
AsyncRecordCache.getTransformOptions
Defined in​
record-cache/dist/modules/record-cache.d.ts:58
listeners​
â–¸ listeners(event
): Listener
[]
Parameters​
Name | Type |
---|---|
event | Event |
Returns​
Listener
[]
Inherited from​
AsyncRecordCache.listeners
Defined in​
core/dist/modules/evented.d.ts:24
liveQuery​
â–¸ liveQuery(queryOrExpressions
, options?
, id?
): AsyncLiveQuery
<QO
, TO
, QB
, TB
>
Parameters​
Name | Type |
---|---|
queryOrExpressions | QueryOrExpressions <RecordQueryExpression , QB > |
options? | DefaultRequestOptions <QO > |
id? | string |
Returns​
AsyncLiveQuery
<QO
, TO
, QB
, TB
>
Inherited from​
AsyncRecordCache.liveQuery
Defined in​
record-cache/dist/modules/async-record-cache.d.ts:61
migrateDB​
â–¸ migrateDB(db
, event
): void
Migrates the database to align with an updated schema.
By default, this will attempt a naive migration by invoking createDB
,
which idempotently creates object stores as needed.
Override this method to provide more sophisticated migrations.
Parameters​
Name | Type |
---|---|
db | IDBDatabase |
event | IDBVersionChangeEvent |
Returns​
void
Defined in​
indexeddb/src/indexeddb-cache.ts:231
off​
â–¸ off(event
, listener?
): void
Parameters​
Name | Type |
---|---|
event | Event |
listener? | Listener |
Returns​
void
Inherited from​
AsyncRecordCache.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​
AsyncRecordCache.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​
AsyncRecordCache.one
Defined in​
core/dist/modules/evented.d.ts:22
openDB​
â–¸ openDB(): Promise
<IDBDatabase
>
Returns​
Promise
<IDBDatabase
>
Defined in​
indexeddb/src/indexeddb-cache.ts:141
patch​
â–¸ patch(operationOrOperations
): Promise
<PatchResult
>
Patches the cache with an operation or operations.
deprecated
since v0.17
Parameters​
Name | Type |
---|---|
operationOrOperations | RecordOperation | RecordOperation [] | RecordTransformBuilderFunc | RecordOperationTerm <string , RecordIdentity , UninitializedRecord > | RecordOperationTerm <string , RecordIdentity , UninitializedRecord >[] |
Returns​
Promise
<PatchResult
>
Inherited from​
AsyncRecordCache.patch
Defined in​
record-cache/dist/modules/async-record-cache.d.ts:60
query​
â–¸ query<RequestData
>(queryOrExpressions
, options?
, id?
): Promise
<RequestData
>
Queries the cache.
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​
AsyncRecordCache.query
Defined in​
record-cache/dist/modules/async-record-cache.d.ts:48
â–¸ query<RequestData
>(queryOrExpressions
, options
, id?
): Promise
<FullResponse
<RequestData
, QRD
, RecordOperation
>>
Type parameters​
Name | Type |
---|---|
RequestData | extends RecordQueryResult <InitializedRecord > = RecordQueryResult <InitializedRecord > |
Parameters​
Name | Type |
---|---|
queryOrExpressions | QueryOrExpressions <RecordQueryExpression , QB > |
options | FullRequestOptions <QO > |
id? | string |
Returns​
Promise
<FullResponse
<RequestData
, QRD
, RecordOperation
>>
Inherited from​
AsyncRecordCache.query
Defined in​
record-cache/dist/modules/async-record-cache.d.ts:49
registerModel​
â–¸ registerModel(db
, type
): void
Parameters​
Name | Type |
---|---|
db | IDBDatabase |
type | string |
Returns​
void
Defined in​
indexeddb/src/indexeddb-cache.ts:267
removeInverseRelationshipsAsync​
â–¸ removeInverseRelationshipsAsync(relationships
): Promise
<void
>
Parameters​
Name | Type |
---|---|
relationships | RecordRelationshipIdentity [] |
Returns​
Promise
<void
>
Overrides​
AsyncRecordCache.removeInverseRelationshipsAsync
Defined in​
indexeddb/src/indexeddb-cache.ts:565
removeRecordAsync​
â–¸ removeRecordAsync(recordIdentity
): Promise
<undefined
| InitializedRecord
>
Parameters​
Name | Type |
---|---|
recordIdentity | RecordIdentity |
Returns​
Promise
<undefined
| InitializedRecord
>
Overrides​
AsyncRecordCache.removeRecordAsync
Defined in​
indexeddb/src/indexeddb-cache.ts:433
removeRecordsAsync​
â–¸ removeRecordsAsync(records
): Promise
<InitializedRecord
[]>
Parameters​
Name | Type |
---|---|
records | RecordIdentity [] |
Returns​
Promise
<InitializedRecord
[]>
Overrides​
AsyncRecordCache.removeRecordsAsync
Defined in​
indexeddb/src/indexeddb-cache.ts:449
reopenDB​
â–¸ reopenDB(): Promise
<IDBDatabase
>
Returns​
Promise
<IDBDatabase
>
Defined in​
indexeddb/src/indexeddb-cache.ts:184
reset​
â–¸ reset(): Promise
<void
>
Returns​
Promise
<void
>
Defined in​
indexeddb/src/indexeddb-cache.ts:113
setRecordAsync​
â–¸ setRecordAsync(record
): Promise
<void
>
Parameters​
Name | Type |
---|---|
record | InitializedRecord |
Returns​
Promise
<void
>
Overrides​
AsyncRecordCache.setRecordAsync
Defined in​
indexeddb/src/indexeddb-cache.ts:382
setRecordsAsync​
â–¸ setRecordsAsync(records
): Promise
<void
>
Parameters​
Name | Type |
---|---|
records | InitializedRecord [] |
Returns​
Promise
<void
>
Overrides​
AsyncRecordCache.setRecordsAsync
Defined in​
indexeddb/src/indexeddb-cache.ts:398
update​
â–¸ update<RequestData
>(transformOrOperations
, options?
, id?
): Promise
<RequestData
>
Updates the cache.
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​
AsyncRecordCache.update
Defined in​
record-cache/dist/modules/async-record-cache.d.ts:53
â–¸ update<RequestData
>(transformOrOperations
, options
, id?
): Promise
<FullResponse
<RequestData
, TRD
, RecordOperation
>>
Type parameters​
Name | Type |
---|---|
RequestData | extends RecordTransformResult <InitializedRecord > = RecordTransformResult <InitializedRecord > |
Parameters​
Name | Type |
---|---|
transformOrOperations | TransformOrOperations <RecordOperation , TB > |
options | FullRequestOptions <TO > |
id? | string |
Returns​
Promise
<FullResponse
<RequestData
, TRD
, RecordOperation
>>
Inherited from​
AsyncRecordCache.update
Defined in​
record-cache/dist/modules/async-record-cache.d.ts:54
upgrade​
â–¸ upgrade(): Promise
<void
>
Returns​
Promise
<void
>