Skip to content

Commit f7b0fdf

Browse files
authored
Merge pull request #50 from craftzdog/beta
v4.1.0. Fix #49 #47 #40
2 parents 95728ab + b5ba465 commit f7b0fdf

File tree

9 files changed

+1238
-1071
lines changed

9 files changed

+1238
-1071
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18
1+
v20

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ It now directly uses op-sqlite, so it's more efficient.
1111
### Installation
1212

1313
```sh
14-
yarn add @op-engineering/op-sqlite react-native-quick-crypto @craftzdog/react-native-buffer
14+
yarn add @op-engineering/op-sqlite react-native-quick-crypto @craftzdog/react-native-buffer @craftzdog/pouchdb-errors
1515
```
1616

1717
### Polyfill NodeJS APIs
@@ -42,6 +42,7 @@ Then, in your `babel.config.js`, add the plugin to swap the `crypto`, `stream` a
4242
crypto: 'react-native-quick-crypto',
4343
stream: 'readable-stream',
4444
buffer: '@craftzdog/react-native-buffer',
45+
'pouchdb-errors': '@craftzdog/pouchdb-errors'
4546
},
4647
},
4748
],

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
22
presets: ['module:react-native-builder-bob/babel-preset'],
3-
};
3+
}

example/babel.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ const root = path.resolve(__dirname, '..')
77
module.exports = getConfig(
88
{
99
presets: ['module:@react-native/babel-preset'],
10+
plugins: [
11+
[
12+
'module-resolver',
13+
{
14+
extensions: ['.tsx', '.ts', '.js', '.json'],
15+
alias: {
16+
'@': './src',
17+
'crypto': 'react-native-quick-crypto',
18+
'stream': 'readable-stream',
19+
'buffer': '@craftzdog/react-native-buffer',
20+
'pouchdb-errors': '@craftzdog/pouchdb-errors',
21+
},
22+
},
23+
],
24+
],
1025
},
1126
{ root, pkg }
1227
)

example/definitions/pouchdb.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare module 'pouchdb-adapter-http'
2+
declare module 'pouchdb-replication'
3+
declare module 'pouchdb-mapreduce'

example/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"build:ios": "react-native build-ios --scheme PouchdbAdapterReactNativeSqliteExample --mode Debug --extra-params \"-sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO\""
1111
},
1212
"dependencies": {
13-
"@op-engineering/op-sqlite": "^11.2.3",
13+
"@craftzdog/pouchdb-errors": "^9.0.1",
14+
"@op-engineering/op-sqlite": "^12.0.2",
1415
"debug": "^4.4.0",
1516
"pouchdb-adapter-http": "^9.0.0",
1617
"pouchdb-core": "^9.0.0",

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pouchdb-adapter-react-native-sqlite",
3-
"version": "4.0.5",
3+
"version": "4.1.0",
44
"description": "PouchDB adapter for React Native SQLite",
55
"source": "./src/index.ts",
66
"main": "./lib/commonjs/index.js",
@@ -74,7 +74,7 @@
7474
"@types/react": "^18.2.44",
7575
"commitlint": "^17.0.2",
7676
"del-cli": "^5.1.0",
77-
"eslint": "^8.51.0",
77+
"eslint": "^8.57.0",
7878
"eslint-config-prettier": "^9.0.0",
7979
"eslint-plugin-prettier": "^5.0.1",
8080
"jest": "^29.7.0",
@@ -87,7 +87,7 @@
8787
"typescript": "^5.2.2"
8888
},
8989
"dependencies": {
90-
"@op-engineering/op-sqlite": "^11.2.3",
90+
"@op-engineering/op-sqlite": "^12.0.2",
9191
"debug": "^4.4.0",
9292
"events": "^3.3.0",
9393
"pouchdb-adapter-utils": "^9.0.0",
@@ -144,6 +144,8 @@
144144
"prettier"
145145
],
146146
"rules": {
147+
"@typescript-eslint/no-shadow": "off",
148+
"react-native/no-inline-styles": "off",
147149
"react/react-in-jsx-scope": "off",
148150
"prettier/prettier": [
149151
"error",

src/core.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ function SqlPouch(opts: OpenDatabaseOptions, cb: (err: any) => void) {
193193
onGetInstanceId()
194194
}
195195

196-
async function runMigrations(tx: Transaction, dbVersion: number) {
196+
async function runMigrations(_tx: Transaction, dbVersion: number) {
197197
// const tasks = [setupDone]
198198
//
199199
// let i = dbVersion
@@ -666,8 +666,8 @@ function SqlPouch(opts: OpenDatabaseOptions, cb: (err: any) => void) {
666666
}
667667

668668
api._getAttachment = (
669-
docId: string,
670-
attachId: string,
669+
_docId: string,
670+
_attachId: string,
671671
attachment: any,
672672
opts: any,
673673
callback: (err: any, response?: any) => void
@@ -722,10 +722,10 @@ function SqlPouch(opts: OpenDatabaseOptions, cb: (err: any) => void) {
722722
traverseRevTree(
723723
metadata.rev_tree,
724724
(
725-
isLeaf: boolean,
725+
_isLeaf: boolean,
726726
pos: number,
727727
revHash: string,
728-
ctx: Transaction,
728+
_ctx: Transaction,
729729
opts: any
730730
) => {
731731
const rev = pos + '-' + revHash
@@ -852,7 +852,7 @@ function SqlPouch(opts: OpenDatabaseOptions, cb: (err: any) => void) {
852852
}
853853
}
854854

855-
api._destroy = (opts: any, callback: (err: any, response?: any) => void) => {
855+
api._destroy = (_opts: any, callback: (err: any, response?: any) => void) => {
856856
sqliteChanges.removeAllListeners(api._name)
857857
transaction(async (tx: Transaction) => {
858858
try {

0 commit comments

Comments
 (0)