@capacitor-community/sqlite 4.6.0 → 4.6.1-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/README.md CHANGED
@@ -9,14 +9,14 @@
9
9
  </p>
10
10
  <br>
11
11
  <p align="center">
12
- <img src="https://img.shields.io/maintenance/yes/2022?style=flat-square" />
12
+ <img src="https://img.shields.io/maintenance/yes/2023?style=flat-square" />
13
13
  <a href="https://github.com/capacitor-community/sqlite/actions?query=workflow%3A%22CI%22"><img src="https://img.shields.io/github/workflow/status/capacitor-community/sqlite/CI?style=flat-square" /></a>
14
14
  <a href="https://www.npmjs.com/package/@capacitor-community/sqlite"><img src="https://img.shields.io/npm/l/@capacitor-community/sqlite?style=flat-square" /></a>
15
15
  <br>
16
16
  <a href="https://www.npmjs.com/package/@capacitor-community/sqlite"><img src="https://img.shields.io/npm/dw/@capacitor-community/sqlite?style=flat-square" /></a>
17
17
  <a href="https://www.npmjs.com/package/@capacitor-community/sqlite"><img src="https://img.shields.io/npm/v/@capacitor-community/sqlite?style=flat-square" /></a>
18
18
  <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
19
- <a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-25-orange?style=flat-square" /></a>
19
+ <a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-28-orange?style=flat-square" /></a>
20
20
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
21
21
  </p>
22
22
 
@@ -35,7 +35,7 @@ npx cap sync
35
35
  ```
36
36
 
37
37
  ```
38
- yarn install --save @capacitor-community/sqlite
38
+ yarn add @capacitor-community/sqlite
39
39
  npx cap sync
40
40
  ```
41
41
 
@@ -92,7 +92,7 @@ See [#301](https://github.com/capacitor-community/sqlite/issues/301) and [SO que
92
92
  cd electron
93
93
  npm install --save sqlite3
94
94
  npm install --save jszip
95
- npm install --save node-fetch
95
+ npm install --save node-fetch@2.6.7
96
96
  npm install --save-dev @types/sqlite3
97
97
  ```
98
98
  - **Important**: `node-fetch` version must be `<=2.6.7`; otherwise [you'll get an error](https://github.com/capacitor-community/sqlite/issues/349 "you'll get an error ERR_REQUIRE_ESM") running the app.
@@ -189,6 +189,10 @@ npm install --save-dev @types/sqlite3
189
189
 
190
190
  - [angular-sqlite-synchronize-app](https://github.com/jepiqueau/angular-sqlite-synchronize-app)
191
191
 
192
+ ### Ionic/Angular TypeORM app
193
+
194
+ - [ionic-sqlite-typeorm-app](https://github.com/jepiqueau/ionic-sqlite-typeorm-app)
195
+
192
196
  ### Ionic/React
193
197
 
194
198
  - [Ionic/React Usage Documentation](https://github.com/capacitor-community/sqlite/blob/master/docs/Ionic-React-Usage.md)
@@ -213,14 +217,14 @@ npm install --save-dev @types/sqlite3
213
217
 
214
218
  - [vue-vite-sqlite-app](https://github.com/jepiqueau/vuevite-app)
215
219
 
216
- ### SolidJS+Vite
217
-
218
- - [solidjs-vite-sqlite-app](https://github.com/jepiqueau/capacitor-solid-sqlite)
219
-
220
220
  ### Vue TypeORM app
221
221
 
222
222
  - [vue-typeorm-app](https://github.com/jepiqueau/vue-typeorm-app)
223
223
 
224
+ ### SolidJS+Vite
225
+
226
+ - [solidjs-vite-sqlite-app](https://github.com/jepiqueau/capacitor-solid-sqlite)
227
+
224
228
 
225
229
  ## Dependencies
226
230
 
@@ -262,7 +266,10 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
262
266
  <a href="https://github.com/aeinn" title="aeinn"><img src="https://github.com/aeinn.png?size=100" width="50" height="50" /></a>
263
267
  <a href="https://github.com/jonz94" title="jonz94"><img src="https://github.com/jonz94.png?size=100" width="50" height="50" /></a>
264
268
  <a href="https://github.com/oscarfonts" title="oscarfonts"><img src="https://github.com/oscarfonts.png?size=100" width="50" height="50" /></a>
265
- </p>
269
+ <a href="https://github.com/Sirs0ri" title="Sirs0ri"><img src="https://github.com/Sirs0ri.png?size=100" width="50" height="50" /></a></p>
270
+ <a href="https://github.com/TheNovemberRain" title="TheNovemberRain"><img src="https://github.com/TheNovemberRain.png?size=100" width="50" height="50" /></a></p>
271
+ <a href="https://github.com/fizdalf" title="fizdalf"><img src="https://github.com/fizdalf.png?size=100" width="50" height="50" /></a></p>
272
+
266
273
 
267
274
  <!-- markdownlint-enable -->
268
275
  <!-- prettier-ignore-end -->
@@ -171,7 +171,7 @@ public class Database {
171
171
  if (!isNCDB() && !this._readOnly) {
172
172
  _db = SQLiteDatabase.openOrCreateDatabase(_file, password, null);
173
173
  } else {
174
- _db = SQLiteDatabase.openDatabase(String.valueOf(_file), "", null, SQLiteDatabase.OPEN_READONLY);
174
+ _db = SQLiteDatabase.openDatabase(String.valueOf(_file), password, null, SQLiteDatabase.OPEN_READONLY);
175
175
  }
176
176
  if (_db != null) {
177
177
  if (_db.isOpen()) {
@@ -3012,17 +3012,40 @@ class UtilsFile {
3012
3012
  * @param filePath
3013
3013
  */
3014
3014
  async deleteFilePath(filePath) {
3015
+ let unlinkRetries = 50000;
3016
+ /**
3017
+ * On windows, the file lock behaves unpredictable. Often it claims a databsae file is locked / busy, although
3018
+ * the file stream is already closed.
3019
+ * Even though we already checked the status with the `waitForFilePathLock()` method previously.
3020
+ *
3021
+ * The only way to handle this reliably is to retry deletion until it works.
3022
+ */
3023
+ const deleteFile = async () => {
3024
+ try {
3025
+ await promises_1.unlink(filePath);
3026
+ }
3027
+ catch (err) {
3028
+ unlinkRetries--;
3029
+ if (unlinkRetries > 0) {
3030
+ await deleteFile();
3031
+ }
3032
+ else {
3033
+ throw err;
3034
+ }
3035
+ }
3036
+ };
3015
3037
  if (filePath.length !== 0) {
3016
3038
  // check if path exists
3017
3039
  const isPath = this.isPathExists(filePath);
3018
3040
  if (isPath) {
3019
3041
  try {
3020
3042
  await this.waitForFilePathLock(filePath);
3021
- this.NodeFs.unlinkSync(filePath);
3043
+ // actually delete the file
3044
+ await deleteFile();
3022
3045
  return Promise.resolve();
3023
3046
  }
3024
3047
  catch (err) {
3025
- return Promise.reject('DeleteFilePath: ' + `${err}`);
3048
+ return Promise.reject(`DeleteFilePath: ${err}`);
3026
3049
  }
3027
3050
  }
3028
3051
  else {