dexie 3.2.0-rc.2 → 4.0.0-alpha.1

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/CONTRIBUTING.md CHANGED
@@ -6,7 +6,7 @@ We appreciate contributions in forms of:
6
6
  * issues
7
7
  * help answering questions in [issues](https://github.com/dfahlander/Dexie.js/issues) and on [stackoverflow](https://stackexchange.com/filters/233583/dexie-stackoverflow)
8
8
  * fixing bugs via pull-requests
9
- * developing addons or other [derived work](http://dexie.org/docs/DerivedWork)
9
+ * developing addons or other [derived work](https://dexie.org/docs/DerivedWork)
10
10
  * promoting Dexie.js
11
11
  * sharing ideas
12
12
 
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  Dexie.js
2
2
  ========
3
3
 
4
- [![NPM Version][npm-image]][npm-url] [![Build Status](https://travis-ci.com/dfahlander/Dexie.js.svg?branch=master)](https://travis-ci.com/dfahlander/Dexie.js)[![Tested with Browserstack](http://dexie.org/assets/images/tested-with-browserstack2.png)](https://www.browserstack.com)
4
+ [![NPM Version][npm-image]][npm-url] [![Build Status](https://travis-ci.com/dfahlander/Dexie.js.svg?branch=master)](https://travis-ci.com/dfahlander/Dexie.js)[![Tested with Browserstack](https://dexie.org/assets/images/tested-with-browserstack2.png)](https://www.browserstack.com)
5
5
 
6
- Dexie.js is a wrapper library for indexedDB - the standard database in the browser. http://dexie.org
6
+ Dexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org
7
7
 
8
8
  #### Why?
9
9
  Dexie solves three main issues with the native IndexedDB API:
@@ -44,17 +44,48 @@ Dexie provides a neat database API with a well thought-through API design, robus
44
44
  </head>
45
45
  </html>
46
46
  ```
47
- Yes, it's that simple.
47
+ Yes, it's that simple.
48
48
 
49
- [Tutorial](http://dexie.org/docs/Tutorial)
49
+ An equivalent modern version (works in all modern browsers):
50
50
 
51
- [API Reference](http://dexie.org/docs/API-Reference)
51
+ ```html
52
+ <!doctype html>
53
+ <html>
54
+ <head>
55
+ <script type="module">
56
+ import Dexie from "https://unpkg.com/dexie@latest/dist/modern/dexie.mjs";
57
+ //
58
+ // Declare Database
59
+ //
60
+ const db = new Dexie("FriendDatabase");
61
+ db.version(1).stores({
62
+ friends: "++id,name,age"
63
+ });
52
64
 
53
- [Samples](http://dexie.org/docs/Samples)
65
+ //
66
+ // Manipulate and Query Database
67
+ //
68
+ try {
69
+ await db.friends.add({name: "Josephine", age: 21});
70
+ const youngFriends = await db.friends.where("age").below(25).toArray();
71
+ alert (`My young friends: ${JSON.stringify(youngFriends)}`);
72
+ } catch (e) {
73
+ alert (`Error: ${e}`);
74
+ }
75
+ </script>
76
+ </head>
77
+ </html>
78
+ ```
79
+
80
+ [Tutorial](https://dexie.org/docs/Tutorial)
81
+
82
+ [API Reference](https://dexie.org/docs/API-Reference)
83
+
84
+ [Samples](https://dexie.org/docs/Samples)
54
85
 
55
86
  ### Performance
56
87
 
57
- Dexie has kick-ass performance. Its [bulk methods](http://dexie.org/docs/Table/Table.bulkPut()) take advantage of a lesser-known feature in IndexedDB that makes it possible to store stuff without listening to every onsuccess event. This speeds up the performance to a maximum.
88
+ Dexie has kick-ass performance. Its [bulk methods](https://dexie.org/docs/Table/Table.bulkPut()) take advantage of a lesser-known feature in IndexedDB that makes it possible to store stuff without listening to every onsuccess event. This speeds up the performance to a maximum.
58
89
 
59
90
  #### Supported operations
60
91
  ```js
@@ -108,42 +139,12 @@ uniqueKeys(): Promise;
108
139
  until(filter: (value) => boolean, includeStopEntry?: boolean): Collection;
109
140
  update(key: Key, changes: { [keyPath: string]: any }): Promise;
110
141
  ```
111
- This is a mix of methods from [WhereClause](http://dexie.org/docs/WhereClause/WhereClause), [Table](http://dexie.org/docs/Table/Table) and [Collection](http://dexie.org/docs/Collection/Collection). Dive into the [API reference](http://dexie.org/docs/API-Reference) to see the details.
112
-
113
- #### Hello World (ES2016 / ES7)
114
- ```js
115
- import Dexie from 'dexie';
116
-
117
- //
118
- // Declare Database
119
- //
120
- const db = new Dexie("FriendDatabase");
121
- db.version(1).stores({ friends: "++id,name,age" });
122
-
123
- db.transaction('rw', db.friends, async() => {
124
-
125
- // Make sure we have something in DB:
126
- if ((await db.friends.where({name: 'Josephine'}).count()) === 0) {
127
- const id = await db.friends.add({name: "Josephine", age: 21});
128
- alert (`Addded friend with id ${id}`);
129
- }
130
-
131
- // Query:
132
- const youngFriends = await db.friends.where("age").below(25).toArray();
133
-
134
- // Show result:
135
- alert ("My young friends: " + JSON.stringify(youngFriends));
136
-
137
- }).catch(e => {
138
- alert(e.stack || e);
139
- });
140
-
141
- ```
142
+ This is a mix of methods from [WhereClause](https://dexie.org/docs/WhereClause/WhereClause), [Table](https://dexie.org/docs/Table/Table) and [Collection](https://dexie.org/docs/Collection/Collection). Dive into the [API reference](https://dexie.org/docs/API-Reference) to see the details.
142
143
 
143
144
  #### Hello World (Typescript)
144
145
 
145
146
  ```js
146
- import Dexie from 'dexie';
147
+ import Dexie, { Table } from 'dexie';
147
148
 
148
149
  interface Friend {
149
150
  id?: number;
@@ -155,14 +156,13 @@ interface Friend {
155
156
  // Declare Database
156
157
  //
157
158
  class FriendDatabase extends Dexie {
158
- public friends: Dexie.Table<Friend, number>; // id is number in this case
159
+ public friends!: Table<Friend, number>; // id is number in this case
159
160
 
160
161
  public constructor() {
161
162
  super("FriendDatabase");
162
163
  this.version(1).stores({
163
164
  friends: "++id,name,age"
164
165
  });
165
- this.friends = this.table("friends");
166
166
  }
167
167
  }
168
168
 
@@ -189,17 +189,17 @@ db.transaction('rw', db.friends, async() => {
189
189
 
190
190
  Samples
191
191
  -------
192
- http://dexie.org/docs/Samples
192
+ https://dexie.org/docs/Samples
193
193
 
194
194
  https://github.com/dfahlander/Dexie.js/tree/master/samples
195
195
 
196
196
  Knowledge Base
197
197
  -----
198
- [http://dexie.org/docs/Questions-and-Answers](http://dexie.org/docs/Questions-and-Answers)
198
+ [https://dexie.org/docs/Questions-and-Answers](https://dexie.org/docs/Questions-and-Answers)
199
199
 
200
200
  Website
201
201
  -------
202
- [http://dexie.org](http://dexie.org)
202
+ [https://dexie.org](https://dexie.org)
203
203
 
204
204
  Install over npm
205
205
  ----------------
@@ -212,13 +212,21 @@ Download
212
212
  --------
213
213
  For those who don't like package managers, here's the download links:
214
214
 
215
- https://unpkg.com/dexie@latest/dist/dexie.js
215
+ ### Legacy:
216
+ https://unpkg.com/dexie@latest/dist/dexie.min.js
216
217
 
217
- https://unpkg.com/dexie@latest/dist/dexie.js.map
218
+ https://unpkg.com/dexie@latest/dist/dexie.min.js.map
218
219
 
220
+ ### Modern:
221
+ https://unpkg.com/dexie@latest/dist/modern/dexie.min.mjs
222
+
223
+ https://unpkg.com/dexie@latest/dist/modern/dexie.min.mjs.map
224
+
225
+ ### Typings:
219
226
  https://unpkg.com/dexie@latest/dist/dexie.d.ts
220
227
 
221
228
 
229
+
222
230
  Contributing
223
231
  ============
224
232
  Here is a little cheat-sheet for how to symlink your app's `node_modules/dexie` to a place where you can edit the source, version control your changes and create pull requests back to Dexie. Assuming you've already ran `npm install dexie --save` for the app your are developing.