Skip to content

Commit b1bd065

Browse files
committed
removed useless zip, test fix rn tls support
1 parent bc322b2 commit b1bd065

7 files changed

Lines changed: 673 additions & 582 deletions

File tree

bun.lockb

20.1 KB
Binary file not shown.

examples/with-plain-javascript.zip

-2.22 MB
Binary file not shown.

package-lock.json

Lines changed: 645 additions & 579 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sqlitecloud/drivers",
3-
"version": "1.0.245",
3+
"version": "1.0.255",
44
"description": "SQLiteCloud drivers for Typescript/Javascript in edge, web and node clients",
55
"main": "./lib/index.js",
66
"types": "./lib/index.d.ts",
@@ -43,14 +43,20 @@
4343
},
4444
"homepage": "https://github.com/sqlitecloud/sqlitecloud-js#readme",
4545
"dependencies": {
46+
"buffer": "^6.0.3",
4647
"eventemitter3": "^5.0.1",
4748
"jest-html-reporter": "^3.10.2",
4849
"lz4js": "^0.2.0",
50+
"react-native-buffer": "^6.0.3",
4951
"react-native-url-polyfill": "^2.0.0",
5052
"socket.io": "^4.7.5",
5153
"socket.io-client": "^4.7.5",
5254
"whatwg-url": "^14.0.0"
5355
},
56+
"peerDependencies": {
57+
"react-native": "0.74.5",
58+
"react-native-tcp-socket": "^6.2.0"
59+
},
5460
"devDependencies": {
5561
"@types/bun": "^1.1.1",
5662
"@types/express": "^4.17.21",
@@ -93,7 +99,9 @@
9399
"printWidth": 160
94100
},
95101
"react-native": {
96-
"whatwg-url": "react-native-url-polyfill"
102+
"whatwg-url": "react-native-url-polyfill",
103+
"tls": "react-native-tcp-socket",
104+
"buffer": "react-native-buffer"
97105
},
98106
"browser": {
99107
"tls": false

src/drivers/connection-tls.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import {
1818
ROWSET_CHUNKS_END
1919
} from './protocol'
2020

21+
// explicitly importing buffer library to allow cross-platform support by replacing it
22+
import { Buffer } from 'buffer'
23+
2124
import * as tls from 'tls'
2225

2326
import fs from 'fs'
@@ -58,7 +61,15 @@ export class SQLiteCloudTlsConnection extends SQLiteCloudConnection {
5861
servername: config.host
5962
}
6063

61-
this.socket = tls.connect(connectionOptions, () => {
64+
// tls.connect in the react-native-tcp-socket library is tls.connectTLS
65+
let connector = tls.connect
66+
// @ts-ignore
67+
if (typeof tls.connectTLS !== 'undefined') {
68+
// @ts-ignore
69+
connector = tls.connectTLS
70+
}
71+
72+
this.socket = connector(connectionOptions, () => {
6273
if (this.config.verbose) {
6374
console.debug(`SQLiteCloudTlsConnection - connected to ${this.config.host}, authorized: ${this.socket?.authorized}`)
6475
}

src/drivers/protocol.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import { SQLiteCloudError, type SQLCloudRowsetMetadata, type SQLiteCloudDataTypes } from './types'
66
import { SQLiteCloudRowset } from './rowset'
77

8+
// explicitly importing buffer library to allow cross-platform support by replacing it
9+
import { Buffer } from 'buffer'
10+
811
// https://www.npmjs.com/package/lz4js
912
const lz4 = require('lz4js')
1013

src/drivers/utilities.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
import { SQLiteCloudConfig, SQLiteCloudError, SQLiteCloudDataTypes, DEFAULT_PORT, DEFAULT_TIMEOUT } from './types'
66
import { SQLiteCloudArrayType } from './types'
7+
8+
// explicitly importing these libraries to allow cross-platform support by replacing them
79
import { URL } from 'whatwg-url'
10+
import { Buffer } from 'buffer'
811

912
//
1013
// determining running environment, thanks to browser-or-node

0 commit comments

Comments
 (0)