idb_shim 2.10.1+1
idb_shim: ^2.10.1+1 copied to clipboard
indexed_db dart base interface with implementation for native (browser), file (io) and in memory.
2.10.1+1 #
- sdb default codec: a map that looks like an encoded value (a single key
$,@,$Timestamp,$Blob,@Timestamp,@Blob) is escaped when written ({'$': map}) and read back unchanged.{'$': 'raw'}used to be read back as'raw'and{'$Timestamp': text}as anSdbTimestamp. Other single$/@keys are stored as before (key paths and indexes unchanged). Already stored{'$': value}with a non map value is now read back as the map.
2.10.0+1 #
- sdb fixes:
iterate(store and index): an error thrown byonRowstops the iteration and completesiteratewith that error (it used to never complete, the error escaping as an uncaught zone error).row.update()during aniterateencodes the value likeput(SdbTimestamp,SdbBlob) and notifies the change listeners (onSnapshot,onSnapshots...) and the other tabs.- A
limitof 0 returns nothing everywhere (find, stream, keys, count, iterate, delete, store and index): it gave 0, 1 or all the records depending on the method,delete(limit: 0)deleted the whole store. - A nested map that is not a
Map<String, Object?>(i.e. aMap<dynamic, dynamic>) is stored with its entries (it was stored as{}). - Index
iterateoptions areSdbFindOptions<SdbKey>: their boundaries apply to the index key, so they can be typed with the index key type (source compatible, options typed with the store key are accepted). - A delete through an index notifies the other tabs.
onSnapshot/onSnapshots/onCount: a query error is added to the stream (it was uncaught).
- memory/io (sembast) implementation, the results now match IndexedDB:
- key comparison (
IdbFactory.cmp, key ranges, sort): number < string < binary < array, arrays compared item by item then by length (cmp([1], [1, 2])is -1, mixed types no longer compare equal or throw).KeyRange.containsworks on arrays. - multiEntry indexes: a key range applies per entry,
count,getAllandgetAllKeyscount the entries (not the records), entries with equal keys are ordered by primary key,uniqueis enforced. - stores with an array
keyPath:getAllKeys,getKeyand the indexgetKey/getAllKeysreturn the keys (not internal ids),countandgetAllby key or range work,getAllfollows the key order, aputkeeping the same value of a unique index no longer fails. prevdirection on an index: equal keys are ordered by descending primary key.Index.getandIndex.getKeyaccept aKeyRange(native too).cursor.update()in a readonly transaction throws aReadOnlyError(it wrote the value), and in a store with in-line keys a value without the cursor primary key throws aDataError(it wrote another record).getAll/getAllKeyswith a count of 0 return every record, as in the IndexedDB spec (store: 1 record, index: none). sdb is unchanged (alimitof 0 returns nothing).
- key comparison (
2.9.11 #
- sdb: the implementation is pluggable. A backend that is not IndexedDB
implements the internal interfaces (
SdbDatabaseInterface,SdbTransactionInterface,SdbTransactionStoreRefInterface,SdbTransactionIndexRefInterface,SdbOpenStoreRefInterface) and the default mixins exported bysrc/sdb/sdb_mixin.dart; the public API, joins, change listeners,onSnapshotand the schema helpers dispatch through them. The idb implementation is unchanged. - sdb:
sdbExportDatabaseLinesandsdbImportDatabasework with any sdb factory, same lines format (DateTime and Uint8List exported as@Timestampand@Blob). - sdb:
compatMigrate1To2awaits its row updates. - idb_test:
sdbDefineAllTests(SdbTestContext)runs the whole sdb suite on anySdbFactory.
2.9.10 #
- sdb: the version change requests of the other connections (another tab,
an iframe, the same page), the IndexedDB
versionchangeandblockedevents, onSdbOpenDatabaseOptions:versionChangeAction(SdbVersionChangeAction,closeby default): what the database does on its own when another connection opens it at a higher version or deletes it:none(stay open, the other waits),close(the other open completes instead of staying blocked forever,SdbDatabase.isClosedtells),closeAndReloadandcloseAlertAndReload(web: the page reloads on the new version);onVersionChangeRequest: called first, with the current and the requested version (null on a delete), to save what must be or tell the user your own way;blockedAction(SdbBlockedAction,alertby default): what the open does on its own while a connection that keeps the database open at a lower version (a tab of an older app) blocks it: a "close the other tabs" alert on the web, ornone;onBlockedis called first. The open completes once that connection closes.
VersionChangeEvent.newVersionOrNull(null on a delete); the nativeDatabase.onVersionChangestream delivers synchronously, so a close in the handler happens inside the browser event; the sembast one is an empty stream instead of throwing.- Example
example/sdb_version_change_exp: two frames of one app opening the same database at different versions.
2.9.10-1 #
- sdb: Add join support, walking the records of a store (or of an index)
together with the records they reference in another store, the equivalent of
an sql
LEFT JOIN. OnSdbStoreRefandSdbIndexRef:joinIterate/findJoinRowshand outSdbJoinRow(both sides),joinIterateRecords/findJoinRecordsthe source records only, one per source record,joinIterateJoinedRecords/findJoinedRecordsthe referenced records only (always inner, so never null),joinCountthe number of rows.
- sdb:
SdbJoinTargetsays what the join key is matched against, a store (on its primary key) or an index (on its index key), exactly one of the two:authorStore.asJoinTarget,authorEmailIndex.asJoinTarget. - sdb:
SdbJoinFindOptions(distinct,inner,chunkSize) holds the join specific options, next to the usualSdbFindOptionson the iterated side; every join method takes both. - sdb: A join is resolved natively when the implementation supports it
(
idb_sqfliteturns it into a single sqlLEFT JOIN/INNER JOINper chunk, with the key range,inner, offset and limit pushed down), and by walking a cursor otherwise; both hand out the same rows in the same order. - Internal (not part of the public idb API):
IdbJoinQuerySupport, implemented by anObjectStore/Indeximplementation able to join natively. - Internal:
SdbIndexCursorRownow exposesindexKeyandprimaryKey.
2.9.9 #
- Add
idb-shim-databaseandidb-shim-sdbagent skills inskills/, installable withdart run skills@ get
2.9.8 #
- sdb: Apply the offset and the limit natively (sql
LIMIT/OFFSET) instead of walking a cursor, when the implementation supports it, forfindRecords,findRecordKeys,streamRecords,iterateanddeleteon stores and indexes. An implementation reading its rows in one go would otherwise read the whole store on every paged query. - sdb fix:
iteratewas ignoring the offset, the skipped rows were handed to the handler. - Internal (not part of the public idb API):
IdbPagedQuerySupport, implemented by anObjectStore/Indeximplementation able to page natively.
2.9.7+1 #
- fix: correct count logic in sdb_index and sdb_transaction_store
2.9.7 #
- Expose
IdbFactorySandboxandSdbFactorySandbox
2.9.6+2 #
- Add
getDatabaseFullPath()extension method onIdbFactoryandSdbFactory - Deprecate
fullPath - export
SdbDatabase.openDatabaseOptions - export
SdbTimestamphelpers (difference,addDuration,substractDuration)
2.9.5 #
- Add
fullPath()extension method onIdbFactoryandSdbFactoryto get the full path of a database. - Add
pathContextmethod toIdbFactoryand extension method toSdbFactory
2.9.4 #
- Add
sandbox()extension method onIdbFactoryandSdbFactoryto create a factory where every database is located below a given path.
2.9.3+1 #
- Requires dart 3.12
- Add
onCountfor stores and indexes
2.9.2 #
- sdb: Add
iterateon Store and Cursor. - sdb: Add cross tab synchronization on the web
2.9.1 #
- sdb: Allow raw data and codec support
2.9.0 #
- sdb: Add support for
SdbTimestampin index - sdb: new internal format for timestamp, migration with helper
2.8.5+2 #
- sdb: Add
onSnapshotandonSnapshotssupport for stores, records, and indexes.
2.8.4+1 #
- sdb: Allow both
schemaandonVersionChangein open options - sdb: deprecate params
version,schema,onVersionChangedonSdbFactory.openDatabaseand prefer open options - sdb: fix
onVersionChangetransaction, allowing manipulating data during open
2.8.3 #
- Add built-in
SdbTimestampandSdbBlobto Sdb database
2.8.2+4 #
- Add onChange listener to SdbDatabase
- Add sdb import/export helpers
- Add options to
SdbFactory.openDatabaseOnDowngradeDeleteto support schema.
2.8.1 #
- Import jdb support (from sembast_web)
2.7.1+2 #
- Supports Sdb schema and improve sdb api
- Refactor sembast transaction implementation
- Add find options to all queries
- Experimental record streaming in Sdb
2.7.0 #
- Requires dart 3.10
- Supports opening a database with either
versionorunUpgadeNeededspecified
2.6.7+1 #
- Requires dart 3.8
- export extra sdb mixin
2.6.6+2 #
- sdb:
- Add
bool? descendingargument to all Sdb store and index APIs. - Export
SdbKey,SdbValue,SdbIndexKey,SdbClient. - Export
SdbOpenIndexRef
- Add
2.6.5+1 #
- Add
openOnDowngradeDeletetoIdbFactoryto handle downgrade by deleting the database. - Add
openDatabaseOnDowngradeDeletetoSdbFactoryto handle downgrade by deleting the database.
2.6.4+1 #
- Add Web worker support (
idbFactoryWebWorker)
2.6.3+2 #
- Open Sdb to other implementation and add filtering support
2.6.2 #
- Requires dart 3.7
2.6.1+7 #
- Requires dart 3.5
2.6.0+5 #
- More support for sdb, including key on 2,3 and 4 fields, and more.
- Add
idbFactoryWeb(shortcut foridbFactoryNative)
2.5.0+3 #
- Remove legacy
dart:htmlimplementation. - Remove
dev_testdependency
2.4.1+4 #
- Add simple sdb opinionated strong typed api based on idb database.
- Complete dart2wasm compilation support
- Deprecate old idbFactoryNative.
2.4.0 #
- Add new native implementation based on new js_interop and web package.
- Allow wasm compilation for web support (legacy implementation is still available for now by importing explicitly
idb_shim_client_native_html.dart)
2.3.2 #
- Add new cursor stream extension in
utils/idb_cursor_utils.dartto convert a stream to a list that supports offset and limit.
2.3.1 #
- Dart 3 support
2.3.0+2 #
- Support strict-casts mode.
2.2.0+8 #
- Fix keyPath array index creation
- mimic Chrome and prevent cursor delete when using openKeyCursor and invalid KeyRange
- composite key support: allow keyPath as List
- add
cursorToPrimaryKeyList()andcursorToKeyListutility in idb_utils
2.1.0 #
- Fix io implementation for generated key internal storage
- Requires dart 2.18+
2.0.1+1 #
- New lint supports
- Requires dart 2.14+
2.0.0+2 #
nnbdsupports, breaking change.- No longer supports
nullfor record value. - Remove deprecated methods.
1.12.2+3 #
- Add support for
Transaction.abort - Allow read/write during open transaction.
1.12.1+1 #
- Add
ObjectStore.getAll/getAllKeysandIndex.getAll/getAllKeys - Fix import/export through sembast
1.11.1+1 #
- Export
idbFactoryNative,idbFactoryMemoryandidbFactoryMemoryFsinidb_shim.dart - Allow safe import of
idb_shim.darton web and io.
1.11.0 #
- Add support for
DateTimeandUint8List, - fix meta export to always save the same order for stores and indecies
1.10.3+1 #
- Support keyPath array for index
1.10.2 #
- Pedantic 1.9
1.10.1 #
- Add support for
idb_sqflite, an implementation for flutter mobile on top of sqflite - Add support for service worker self.indexedDB
1.9.0 #
- Deprecates old names (sorry) and websql
- Fix update/delete in index cursor for sembast
- Sdk 2.4 min
1.8.0+3 #
- Sdk 2.5 support
1.7.6+1 #
- add support for
ObjectStore.openKeyCursor
1.7.5 #
- Supports dart 2.3
1.7.4 #
- Supports multiEntry for sembast implementation
- Fix cursor update with keyPath for sembast
1.7.3 #
- Fix dot support in keyPath to match native behavior
1.7.2 #
- Dart 2.2 support, Dart 2.1 compatible
1.7.0 #
- remove websql support
- support keyPath as array
1.6.0 #
- dart2 only, no websql yet
1.5.0 #
- Dart2 compatible (except websql shim)
- Depends on sembast 1.7.0
1.4.2 #
- Add
implicit-cast: falsesupport
1.4.0 #
- Depends on sembast 1.4.0
1.3.6 #
- Add IdbFactory.cmp
1.3.5 #
- Simulate multistore transaction on Safari
1.3.3 #
- Add support for import/export (sembast export format)
- Fix timing to mimic IE limitation
- Add workaround for transaction bug in sdk 1.13
1.3.2 #
- Fix implementation for IE/Edge where the transaction life-cycle is shorter
1.3.1 #
- Add support for ObjectStore.deleteIndex
1.2.1 #
- Fix openCursor for Index that included null key before (sembast)
- Travis test integration
1.0.0 #
- Initial revision