🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@libsql/hrana-client

Package Overview
Dependencies
Maintainers
3
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libsql/hrana-client - npm Package Compare versions

Comparing version
0.8.0
to
0.9.0
+4
-2
lib-cjs/http/client.js

@@ -38,2 +38,3 @@ "use strict";

#fetch;
#remoteEncryptionKey;
#closed;

@@ -46,3 +47,3 @@ #streams;

/** @private */
constructor(url, jwt, customFetch, protocolVersion = 2) {
constructor(url, jwt, customFetch, remoteEncryptionKey, protocolVersion = 2) {
super();

@@ -52,2 +53,3 @@ this.#url = url;

this.#fetch = customFetch ?? cross_fetch_1.fetch;
this.#remoteEncryptionKey = remoteEncryptionKey;
this.#closed = undefined;

@@ -92,3 +94,3 @@ this.#streams = new Set();

}
const stream = new stream_js_1.HttpStream(this, this.#url, this.#jwt, this.#fetch);
const stream = new stream_js_1.HttpStream(this, this.#url, this.#jwt, this.#fetch, this.#remoteEncryptionKey);
this.#streams.add(stream);

@@ -95,0 +97,0 @@ return stream;

@@ -26,2 +26,3 @@ "use strict";

#fetch;
#remoteEncryptionKey;
#baton;

@@ -36,3 +37,3 @@ #queue;

/** @private */
constructor(client, baseUrl, jwt, customFetch) {
constructor(client, baseUrl, jwt, customFetch, remoteEncryptionKey) {
super(client.intMode);

@@ -43,2 +44,3 @@ this.#client = client;

this.#fetch = customFetch;
this.#remoteEncryptionKey = remoteEncryptionKey;
this.#baton = undefined;

@@ -311,2 +313,5 @@ this.#queue = new queue_js_1.Queue();

}
if (this.#remoteEncryptionKey !== undefined) {
headers.set("x-turso-encryption-key", this.#remoteEncryptionKey);
}
return new cross_fetch_1.Request(url.toString(), { method: "POST", headers, body: bodyData });

@@ -313,0 +318,0 @@ }

@@ -74,5 +74,5 @@ "use strict";

*/
function openHttp(url, jwt, customFetch, protocolVersion = 2) {
return new client_js_2.HttpClient(url instanceof URL ? url : new URL(url), jwt, customFetch, protocolVersion);
function openHttp(url, jwt, customFetch, remoteEncryptionKey, protocolVersion = 2) {
return new client_js_2.HttpClient(url instanceof URL ? url : new URL(url), jwt, customFetch, remoteEncryptionKey, protocolVersion);
}
exports.openHttp = openHttp;

@@ -20,3 +20,3 @@ import type { ProtocolVersion, ProtocolEncoding } from "../client.js";

/** @private */
constructor(url: URL, jwt: string | undefined, customFetch: unknown | undefined, protocolVersion?: ProtocolVersion);
constructor(url: URL, jwt: string | undefined, customFetch: unknown | undefined, remoteEncryptionKey?: string, protocolVersion?: ProtocolVersion);
/** Get the protocol version supported by the server. */

@@ -23,0 +23,0 @@ getVersion(): Promise<ProtocolVersion>;

@@ -35,2 +35,3 @@ import { fetch, Request } from "cross-fetch";

#fetch;
#remoteEncryptionKey;
#closed;

@@ -43,3 +44,3 @@ #streams;

/** @private */
constructor(url, jwt, customFetch, protocolVersion = 2) {
constructor(url, jwt, customFetch, remoteEncryptionKey, protocolVersion = 2) {
super();

@@ -49,2 +50,3 @@ this.#url = url;

this.#fetch = customFetch ?? fetch;
this.#remoteEncryptionKey = remoteEncryptionKey;
this.#closed = undefined;

@@ -89,3 +91,3 @@ this.#streams = new Set();

}
const stream = new HttpStream(this, this.#url, this.#jwt, this.#fetch);
const stream = new HttpStream(this, this.#url, this.#jwt, this.#fetch, this.#remoteEncryptionKey);
this.#streams.add(stream);

@@ -92,0 +94,0 @@ return stream;

@@ -11,3 +11,3 @@ import type { fetch } from "cross-fetch";

/** @private */
constructor(client: HttpClient, baseUrl: URL, jwt: string | undefined, customFetch: typeof fetch);
constructor(client: HttpClient, baseUrl: URL, jwt: string | undefined, customFetch: typeof fetch, remoteEncryptionKey?: string);
/** Get the {@link HttpClient} object that this stream belongs to. */

@@ -14,0 +14,0 @@ client(): HttpClient;

@@ -23,2 +23,3 @@ import { Request, Headers } from "cross-fetch";

#fetch;
#remoteEncryptionKey;
#baton;

@@ -33,3 +34,3 @@ #queue;

/** @private */
constructor(client, baseUrl, jwt, customFetch) {
constructor(client, baseUrl, jwt, customFetch, remoteEncryptionKey) {
super(client.intMode);

@@ -40,2 +41,3 @@ this.#client = client;

this.#fetch = customFetch;
this.#remoteEncryptionKey = remoteEncryptionKey;
this.#baton = undefined;

@@ -308,2 +310,5 @@ this.#queue = new Queue();

}
if (this.#remoteEncryptionKey !== undefined) {
headers.set("x-turso-encryption-key", this.#remoteEncryptionKey);
}
return new Request(url.toString(), { method: "POST", headers, body: bodyData });

@@ -310,0 +315,0 @@ }

@@ -33,2 +33,2 @@ import { HttpClient } from "./http/client.js";

*/
export declare function openHttp(url: string | URL, jwt?: string, customFetch?: unknown | undefined, protocolVersion?: ProtocolVersion): HttpClient;
export declare function openHttp(url: string | URL, jwt?: string, customFetch?: unknown | undefined, remoteEncryptionKey?: string, protocolVersion?: ProtocolVersion): HttpClient;

@@ -40,4 +40,4 @@ import { WebSocket } from "@libsql/isomorphic-ws";

*/
export function openHttp(url, jwt, customFetch, protocolVersion = 2) {
return new HttpClient(url instanceof URL ? url : new URL(url), jwt, customFetch, protocolVersion);
export function openHttp(url, jwt, customFetch, remoteEncryptionKey, protocolVersion = 2) {
return new HttpClient(url instanceof URL ? url : new URL(url), jwt, customFetch, remoteEncryptionKey, protocolVersion);
}
{
"name": "@libsql/hrana-client",
"version": "0.8.0",
"version": "0.9.0",
"keywords": [

@@ -5,0 +5,0 @@ "hrana",