@sqlitecloud/drivers
Advanced tools
Comparing version 1.0.122 to 1.0.178
@@ -7,3 +7,3 @@ /** | ||
/** | ||
* Implementation of SQLiteCloudConnection that connects to the database using specific Bun APIs | ||
* Implementation of SQLiteCloudConnection that connects to the database using specific tls APIs | ||
* that connect to native sockets or tls sockets and communicates via raw, binary protocol. | ||
@@ -10,0 +10,0 @@ */ |
@@ -36,3 +36,3 @@ "use strict"; | ||
/** | ||
* Implementation of SQLiteCloudConnection that connects to the database using specific Bun APIs | ||
* Implementation of SQLiteCloudConnection that connects to the database using specific tls APIs | ||
* that connect to native sockets or tls sockets and communicates via raw, binary protocol. | ||
@@ -69,3 +69,3 @@ */ | ||
port: config.port, | ||
rejectUnauthorized: false, | ||
rejectUnauthorized: config.host != 'localhost', | ||
// Server name for the SNI (Server Name Indication) TLS extension. | ||
@@ -72,0 +72,0 @@ // https://r2.nodejs.org/docs/v6.11.4/api/tls.html#tls_class_tls_tlssocket |
@@ -37,16 +37,12 @@ "use strict"; | ||
function getInitializationCommands(config) { | ||
// we check the credentials using non linearizable so we're quicker | ||
// then we bring back linearizability unless specified otherwise | ||
let commands = 'SET CLIENT KEY NONLINEARIZABLE TO 1; '; | ||
// first user authentication, then all other commands | ||
let commands = ''; | ||
if (config.apikey) { | ||
commands = `AUTH APIKEY ${config.apikey}; `; | ||
commands += `AUTH APIKEY ${config.apikey}; `; | ||
} | ||
else { | ||
commands = `AUTH USER ${config.username || ''} ${config.password_hashed ? 'HASH' : 'PASSWORD'} ${config.password || ''}; `; | ||
commands += `AUTH USER ${config.username || ''} ${config.password_hashed ? 'HASH' : 'PASSWORD'} ${config.password || ''}; `; | ||
} | ||
if (config.database) { | ||
if (config.create && !config.memory) { | ||
commands += `CREATE DATABASE ${config.database} IF NOT EXISTS; `; | ||
} | ||
commands += `USE DATABASE ${config.database}; `; | ||
} | ||
if (config.compression) { | ||
@@ -58,5 +54,2 @@ commands += 'SET CLIENT KEY COMPRESSION TO 1; '; | ||
} | ||
if (config.non_linearizable) { | ||
commands += 'SET CLIENT KEY NONLINEARIZABLE TO 1; '; | ||
} | ||
if (config.noblob) { | ||
@@ -74,2 +67,13 @@ commands += 'SET CLIENT KEY NOBLOB TO 1; '; | ||
} | ||
// we ALWAYS set non linearizable to 1 when we start so we can be quicker on login | ||
// but then we need to put it back to its default value if "linearizable" unless set | ||
if (!config.non_linearizable) { | ||
commands += 'SET CLIENT KEY NONLINEARIZABLE TO 0; '; | ||
} | ||
if (config.database) { | ||
if (config.create && !config.memory) { | ||
commands += `CREATE DATABASE ${config.database} IF NOT EXISTS; `; | ||
} | ||
commands += `USE DATABASE ${config.database}; `; | ||
} | ||
return commands; | ||
@@ -76,0 +80,0 @@ } |
{ | ||
"name": "@sqlitecloud/drivers", | ||
"version": "1.0.122", | ||
"version": "1.0.178", | ||
"description": "SQLiteCloud drivers for Typescript/Javascript in edge, web and node clients", | ||
@@ -11,3 +11,3 @@ "main": "./lib/index.js", | ||
"scripts": { | ||
"test": "jest --coverage", | ||
"test": "jest --coverage --testPathIgnorePatterns=core", | ||
"build": "rm -rf ./lib/ && tsc --project tsconfig.build.json && npx webpack", | ||
@@ -49,15 +49,15 @@ "publish": "npm run build && npm publish --access public", | ||
"lz4js": "^0.2.0", | ||
"socket.io": "^4.7.4", | ||
"socket.io-client": "^4.7.4" | ||
"socket.io": "^4.7.5", | ||
"socket.io-client": "^4.7.5" | ||
}, | ||
"devDependencies": { | ||
"@types/bun": "^1.0.5", | ||
"@types/bun": "^1.1.1", | ||
"@types/express": "^4.17.21", | ||
"@types/jest": "^29.5.11", | ||
"@types/jest": "^29.5.12", | ||
"@types/lz4": "^0.6.4", | ||
"@types/node": "^12.20.55", | ||
"@typescript-eslint/eslint-plugin": "^4.22.0", | ||
"@typescript-eslint/parser": "^4.22.0", | ||
"dotenv": "^16.4.1", | ||
"dotenv-cli": "^7.3.0", | ||
"@typescript-eslint/eslint-plugin": "^4.33.0", | ||
"@typescript-eslint/parser": "^4.33.0", | ||
"dotenv": "^16.4.5", | ||
"dotenv-cli": "^7.4.1", | ||
"eslint": "^7.32.0", | ||
@@ -67,13 +67,13 @@ "eslint-config-prettier": "^8.10.0", | ||
"eslint-plugin-prettier": "^3.4.1", | ||
"express": "^4.18.2", | ||
"express": "^4.19.2", | ||
"husky": "^9.0.11", | ||
"jest": "^29.7.0", | ||
"prettier": "^2.2.1", | ||
"sqlite3": "^5.1.6", | ||
"ts-jest": "^29.1.1", | ||
"prettier": "^3.2.5", | ||
"sqlite3": "^5.1.7", | ||
"ts-jest": "^29.1.2", | ||
"ts-node": "^10.9.2", | ||
"typedoc": "^0.25.3", | ||
"typedoc": "^0.25.13", | ||
"typedoc-plugin-markdown": "^3.17.1", | ||
"typescript": "^4.9.5", | ||
"webpack": "^5.90.0", | ||
"webpack": "^5.91.0", | ||
"webpack-cli": "^5.1.4" | ||
@@ -93,3 +93,6 @@ }, | ||
"printWidth": 160 | ||
}, | ||
"browser": { | ||
"tls": false | ||
} | ||
} |
@@ -21,2 +21,3 @@ # @sqlitecloud/drivers | ||
let database = new Database('sqlitecloud://user:password@xxx.sqlite.cloud:8860/chinook.sqlite') | ||
// or use sqlitecloud://xxx.sqlite.cloud:8860?apikey=xxxxxxx | ||
@@ -23,0 +24,0 @@ let name = 'Breaking The Rules' |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
531142
3711
54
Updatedsocket.io@^4.7.5
Updatedsocket.io-client@^4.7.5