Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@libsql/client

Package Overview
Dependencies
Maintainers
3
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libsql/client - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

lib-cjs/api.js

26

lib-cjs/index.js

@@ -18,16 +18,24 @@ "use strict";

exports.createClient = void 0;
const shared_types_js_1 = require("./shared-types.js");
const http_driver_js_1 = require("./http/http-driver.js");
const sqlite_driver_js_1 = require("./sqlite-driver.js");
const api_js_1 = require("./api.js");
const config_js_1 = require("./config.js");
const hrana_js_1 = require("./hrana.js");
const http_js_1 = require("./http.js");
const sqlite3_js_1 = require("./sqlite3.js");
__exportStar(require("./api.js"), exports);
function createClient(config) {
const rawUrl = config.url;
const url = new URL(rawUrl);
if (url.protocol == "libsql:" || url.protocol == "http:" || url.protocol == "https:") {
return new shared_types_js_1.Client(new http_driver_js_1.HttpDriver(url, config.authToken));
const expandedConfig = (0, config_js_1.expandConfig)(config);
const url = expandedConfig.url;
if (url.protocol === "http:" || url.protocol === "https:") {
return (0, http_js_1.createClient)(expandedConfig);
}
else if (url.protocol === "ws:" || url.protocol === "wss:" || url.protocol === "libsql:") {
return (0, hrana_js_1.createClient)(expandedConfig);
}
else if (url.protocol === "file:") {
return (0, sqlite3_js_1.createClient)(expandedConfig);
}
else {
return new shared_types_js_1.Client(new sqlite_driver_js_1.SqliteDriver(rawUrl));
throw new api_js_1.LibsqlError(`URL scheme ${JSON.stringify(url.protocol)} is not supported`, "URL_SCHEME_NOT_SUPPORTED");
}
}
exports.createClient = createClient;
__exportStar(require("./shared-types.js"), exports);

@@ -1,3 +0,3 @@

import { Config, Client } from "./shared-types.js";
import type { Config, Client } from "./api.js";
export * from "./api.js";
export declare function createClient(config: Config): Client;
export * from "./shared-types.js";

@@ -1,14 +0,22 @@

import { Client } from "./shared-types.js";
import { HttpDriver } from "./http/http-driver.js";
import { SqliteDriver } from "./sqlite-driver.js";
import { LibsqlError } from "./api.js";
import { expandConfig } from "./config.js";
import { createClient as createHranaClient } from "./hrana.js";
import { createClient as createHttpClient } from "./http.js";
import { createClient as createSqlite3Client } from "./sqlite3.js";
export * from "./api.js";
export function createClient(config) {
const rawUrl = config.url;
const url = new URL(rawUrl);
if (url.protocol == "libsql:" || url.protocol == "http:" || url.protocol == "https:") {
return new Client(new HttpDriver(url, config.authToken));
const expandedConfig = expandConfig(config);
const url = expandedConfig.url;
if (url.protocol === "http:" || url.protocol === "https:") {
return createHttpClient(expandedConfig);
}
else if (url.protocol === "ws:" || url.protocol === "wss:" || url.protocol === "libsql:") {
return createHranaClient(expandedConfig);
}
else if (url.protocol === "file:") {
return createSqlite3Client(expandedConfig);
}
else {
return new Client(new SqliteDriver(rawUrl));
throw new LibsqlError(`URL scheme ${JSON.stringify(url.protocol)} is not supported`, "URL_SCHEME_NOT_SUPPORTED");
}
}
export * from "./shared-types.js";
{
"name": "@libsql/client",
"version": "0.0.8",
"version": "0.0.9",
"keywords": [

@@ -20,8 +20,44 @@ "libsql",

"Jan Plhak <jp@chiselstrike.com>",
"Pekka Enberg <penberg@chiselstrike.com>"
"Pekka Enberg <penberg@chiselstrike.com>",
"Jan Špaček <honza@chiselstrike.com>"
],
"license": "MIT",
"type": "module",
"main": "lib-cjs/index.js",
"types": "lib-esm/index.d.ts",
"exports": {
".": {
"types": "./lib-esm/index.d.ts",
"import": "./lib-esm/index.js",
"require": "./lib-cjs/index.js"
},
"./http": {
"types": "./lib-esm/http.d.ts",
"import": "./lib-esm/http.js",
"require": "./lib-cjs/http.js"
},
"./hrana": {
"types": "./lib-esm/hrana.d.ts",
"import": "./lib-esm/hrana.js",
"require": "./lib-cjs/hrana.js"
},
"./sqlite3": {
"types": "./lib-esm/sqlite3.d.ts",
"import": "./lib-esm/sqlite3.js",
"require": "./lib-cjs/sqlite3.js"
}
},
"typesVersions": {
"*": {
"http": ["./lib-esm/http.d.ts"],
"hrana": ["./lib-esm/hrana.d.ts"],
"sqlite3": ["./lib-esm/sqlite3.d.ts"]
}
},
"files": [
"lib-cjs/**",
"lib-esm/**"
],
"scripts": {

@@ -33,14 +69,11 @@ "prebuild": "rm -rf ./lib-cjs ./lib-esm",

"postbuild": "cp package-cjs.json ./lib-cjs/package.json",
"test": "jest --config jestconfig.json",
"prettier-format": "prettier --config .prettierrc 'src/**/*.ts' --write"
"test": "jest",
"typecheck": "tsc --noEmit"
},
"files": [
"lib-cjs/**",
"lib-esm/**"
],
"devDependencies": {
"@types/better-sqlite3": "^7.6.3",
"@types/jest": "^29.2.5",
"@types/node": "^18.15.5",
"jest": "^29.3.1",
"prettier": "^2.8.3",
"ts-jest": "^29.0.5",

@@ -50,25 +83,7 @@ "typescript": "^4.9.4"

"dependencies": {
"@libsql/hrana-client": "^0.3.0",
"better-sqlite3": "^8.0.1",
"cross-fetch": "^3.1.5",
"js-base64": "^3.7.5"
},
"exports": {
".": {
"types": "./lib-esm/index.d.ts",
"import": "./lib-esm/index.js",
"require": "./lib-cjs/index.js"
},
"./http": {
"types": "./lib-esm/http/index.d.ts",
"import": "./lib-esm/http/index.js",
"require": "./lib-cjs/http/index.js"
}
},
"typesVersions": {
"*": {
"http": [
"./lib-esm/http/index.d.ts"
]
}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc