@live-change/db-store-localstorage 0.7.2 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,11 @@
1
+ Copyright 2019-2024 Michał Łaszczewski
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/index.js CHANGED
@@ -1 +1,2 @@
1
- module.exports = require('./lib/Store.js')
1
+ import Store from './lib/Store.js'
2
+ export default Store
package/lib/Store.js CHANGED
@@ -1,7 +1,8 @@
1
- const IntervalTree = require('@live-change/interval-tree').default
2
- const ReactiveDao = require("@live-change/dao")
3
- const { BroadcastChannel, createLeaderElection } = require('broadcast-channel')
4
- const storage = require('./storage.js')
1
+ import IntervalTreeLib from '@live-change/interval-tree'
2
+ const IntervalTree = IntervalTreeLib.default ?? IntervalTreeLib
3
+ import ReactiveDao from "@live-change/dao"
4
+ import { BroadcastChannel, createLeaderElection } from 'broadcast-channel'
5
+ import * as storage from './storage.js'
5
6
 
6
7
  class ObjectObservable extends ReactiveDao.ObservableValue {
7
8
  constructor(store, key) {
@@ -248,6 +249,10 @@ class Store {
248
249
  this.rangeObservablesTree = new IntervalTree()
249
250
  }
250
251
 
252
+ clear() {
253
+ return this.storage.clear()
254
+ }
255
+
251
256
  async openChannel() {
252
257
  this.channel = new BroadcastChannel(`lc-db-${this.dbName}-${this.storeName}`, {
253
258
  idb: {
@@ -418,4 +423,4 @@ class Store {
418
423
 
419
424
  }
420
425
 
421
- module.exports = Store
426
+ export default Store
package/lib/storage.js CHANGED
@@ -158,4 +158,4 @@ if(typeof window == 'undefined') {
158
158
  }
159
159
  }
160
160
 
161
- module.exports = { local, session }
161
+ export { local, session }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/db-store-localstorage",
3
- "version": "0.7.2",
3
+ "version": "0.8.2",
4
4
  "description": "Database with observable data for live queries",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -30,5 +30,5 @@
30
30
  "@live-change/interval-tree": "^1.0.12",
31
31
  "broadcast-channel": "^4.2.0"
32
32
  },
33
- "gitHead": "36d5b8a4430d82526b8b63290c44209e6187da96"
33
+ "gitHead": "53b8efc8ec7f5c1c4af33077d8fb4a8a5580f1d9"
34
34
  }