New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@libsql/client

Package Overview
Dependencies
Maintainers
3
Versions
95
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.7 to 0.0.8

24

lib-cjs/http/http-driver.js

@@ -9,10 +9,26 @@ "use strict";

authHeader;
constructor(url) {
constructor(url, authToken) {
for (const [key, value] of url.searchParams.entries()) {
if (key === "jwt") {
if (authToken) {
throw new TypeError(`Cannot specify both auth token in config and URL query argument`);
}
authToken = value;
}
else {
throw new TypeError(`Unknown URL query argument ${JSON.stringify(key)}`);
}
}
if (authToken) {
this.authHeader = `Bearer ${authToken}`;
}
var protocol = url.protocol;
if (protocol == "libsql:") {
protocol = "https:";
}
if (url.username !== "" || url.password !== "") {
const encodedCreds = js_base64_1.Base64.encode(`${url.username}:${url.password}`);
this.authHeader = `Basic ${encodedCreds}`;
url.username = "";
url.password = "";
}
this.url = url;
this.url = new URL(`${protocol}//${url.host}${url.pathname}`);
}

@@ -19,0 +35,0 @@ async execute(stmt, params) {

4

lib-cjs/index.js

@@ -24,4 +24,4 @@ "use strict";

const url = new URL(rawUrl);
if (url.protocol == "http:" || url.protocol == "https:") {
return new shared_types_js_1.Client(new http_driver_js_1.HttpDriver(url));
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));
}

@@ -28,0 +28,0 @@ else {

@@ -6,5 +6,5 @@ import { ResultSet, BoundStatement, Params } from "../shared-types.js";

private authHeader;
constructor(url: URL);
constructor(url: URL, authToken?: string);
execute(stmt: string, params?: Params): Promise<ResultSet>;
transaction(stmts: (string | BoundStatement)[]): Promise<ResultSet[]>;
}

@@ -6,10 +6,26 @@ import { fetch as crossFetch } from "cross-fetch";

authHeader;
constructor(url) {
constructor(url, authToken) {
for (const [key, value] of url.searchParams.entries()) {
if (key === "jwt") {
if (authToken) {
throw new TypeError(`Cannot specify both auth token in config and URL query argument`);
}
authToken = value;
}
else {
throw new TypeError(`Unknown URL query argument ${JSON.stringify(key)}`);
}
}
if (authToken) {
this.authHeader = `Bearer ${authToken}`;
}
var protocol = url.protocol;
if (protocol == "libsql:") {
protocol = "https:";
}
if (url.username !== "" || url.password !== "") {
const encodedCreds = Base64.encode(`${url.username}:${url.password}`);
this.authHeader = `Basic ${encodedCreds}`;
url.username = "";
url.password = "";
}
this.url = url;
this.url = new URL(`${protocol}//${url.host}${url.pathname}`);
}

@@ -16,0 +32,0 @@ async execute(stmt, params) {

@@ -7,4 +7,4 @@ import { Client } from "./shared-types.js";

const url = new URL(rawUrl);
if (url.protocol == "http:" || url.protocol == "https:") {
return new Client(new HttpDriver(url));
if (url.protocol == "libsql:" || url.protocol == "http:" || url.protocol == "https:") {
return new Client(new HttpDriver(url, config.authToken));
}

@@ -11,0 +11,0 @@ else {

import { Driver } from "./driver.js";
export type Config = {
url: string;
authToken?: string;
};

@@ -5,0 +6,0 @@ /**

{
"name": "@libsql/client",
"version": "0.0.7",
"version": "0.0.8",
"keywords": [

@@ -5,0 +5,0 @@ "libsql",

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

# libSQL driver for TypeScript and JavaScript
# libSQL client API for TypeScript and JavaScript
[![Node.js CI](https://github.com/libsql/libsql-client-ts/actions/workflows/node-ci.yaml/badge.svg)](https://github.com/libsql/libsql-client-ts/actions/workflows/node-ci.yaml)
[![License](https://img.shields.io/badge/license-MIT-blue)](https://github.com/libsql/libsql-client-ts/blob/main/LICENSE)
## Getting Started

@@ -36,6 +39,1 @@

* SQL over HTTP with `fetch()`
## Roadmap
* Read replica mode
* Cloudflare D1 API compatibility?
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