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

@libsql/hrana-client

Package Overview
Dependencies
Maintainers
1
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.9.0
to
0.10.0
+2
-3
lib-cjs/http/client.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpClient = exports.checkEndpoints = void 0;
const cross_fetch_1 = require("cross-fetch");
const client_js_1 = require("../client.js");

@@ -50,3 +49,3 @@ const errors_js_1 = require("../errors.js");

this.#jwt = jwt;
this.#fetch = customFetch ?? cross_fetch_1.fetch;
this.#fetch = customFetch ?? globalThis.fetch;
this.#remoteEncryptionKey = remoteEncryptionKey;

@@ -123,3 +122,3 @@ this.#closed = undefined;

const url = new URL(endpoint.versionPath, clientUrl);
const request = new cross_fetch_1.Request(url.toString(), { method: "GET" });
const request = new Request(url.toString(), { method: "GET" });
const response = await fetch(request);

@@ -126,0 +125,0 @@ await response.arrayBuffer();

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpStream = void 0;
const cross_fetch_1 = require("cross-fetch");
const errors_js_1 = require("../errors.js");

@@ -305,3 +304,3 @@ const index_js_1 = require("../encoding/index.js");

}
const headers = new cross_fetch_1.Headers();
const headers = new Headers();
headers.set("content-type", contentType);

@@ -314,3 +313,3 @@ if (this.#jwt !== undefined) {

}
return new cross_fetch_1.Request(url.toString(), { method: "POST", headers, body: bodyData });
return new Request(url.toString(), { method: "POST", headers, body: bodyData });
}

@@ -317,0 +316,0 @@ }

+2
-7

@@ -17,3 +17,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.openHttp = exports.openWs = exports.WsStream = exports.WsClient = exports.HttpStream = exports.HttpClient = exports.Stream = exports.Stmt = exports.Sql = exports.parseLibsqlUrl = exports.BatchCond = exports.BatchStep = exports.Batch = exports.Client = exports.Headers = exports.Request = exports.fetch = exports.WebSocket = void 0;
exports.openHttp = exports.openWs = exports.WsStream = exports.WsClient = exports.HttpStream = exports.HttpClient = exports.Stream = exports.Stmt = exports.Sql = exports.parseLibsqlUrl = exports.BatchCond = exports.BatchStep = exports.Batch = exports.Client = exports.WebSocket = void 0;
const isomorphic_ws_1 = require("@libsql/isomorphic-ws");

@@ -26,6 +26,2 @@ const client_js_1 = require("./ws/client.js");

Object.defineProperty(exports, "WebSocket", { enumerable: true, get: function () { return isomorphic_ws_2.WebSocket; } });
var cross_fetch_1 = require("cross-fetch");
Object.defineProperty(exports, "fetch", { enumerable: true, get: function () { return cross_fetch_1.fetch; } });
Object.defineProperty(exports, "Request", { enumerable: true, get: function () { return cross_fetch_1.Request; } });
Object.defineProperty(exports, "Headers", { enumerable: true, get: function () { return cross_fetch_1.Headers; } });
var client_js_4 = require("./client.js");

@@ -73,4 +69,3 @@ Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_js_4.Client; } });

* If the `customFetch` argument is passed and not `undefined`, it is used in place of the `fetch` function
* from `cross-fetch`. This function is always called with a `Request` object from
* `cross-fetch`.
* from the global `fetch`. This function is always called with a global `Request` object.
*/

@@ -77,0 +72,0 @@ function openHttp(url, jwt, customFetch, remoteEncryptionKey, protocolVersion = 2) {

@@ -1,2 +0,1 @@

import { fetch, Request } from "cross-fetch";
import { Client } from "../client.js";

@@ -47,3 +46,3 @@ import { ClientError, ClosedError, ProtocolVersionError } from "../errors.js";

this.#jwt = jwt;
this.#fetch = customFetch ?? fetch;
this.#fetch = customFetch ?? globalThis.fetch;
this.#remoteEncryptionKey = remoteEncryptionKey;

@@ -50,0 +49,0 @@ this.#closed = undefined;

@@ -1,2 +0,1 @@

import type { fetch } from "cross-fetch";
import type { SqlOwner, ProtoSql } from "../sql.js";

@@ -11,3 +10,3 @@ import { Sql } from "../sql.js";

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

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

@@ -1,2 +0,1 @@

import { Request, Headers } from "cross-fetch";
import { ClientError, HttpServerError, ProtocolVersionError, ProtoError, ClosedError, InternalError, } from "../errors.js";

@@ -3,0 +2,0 @@ import { readJsonObject, writeJsonObject, readProtobufMessage, writeProtobufMessage, } from "../encoding/index.js";

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

export { WebSocket } from "@libsql/isomorphic-ws";
export type { Response } from "cross-fetch";
export { fetch, Request, Headers } from "cross-fetch";
export type { ProtocolVersion, ProtocolEncoding } from "./client.js";

@@ -31,5 +29,4 @@ export { Client } from "./client.js";

* If the `customFetch` argument is passed and not `undefined`, it is used in place of the `fetch` function
* from `cross-fetch`. This function is always called with a `Request` object from
* `cross-fetch`.
* from the global `fetch`. This function is always called with a global `Request` object.
*/
export declare function openHttp(url: string | URL, jwt?: string, customFetch?: unknown | undefined, remoteEncryptionKey?: string, protocolVersion?: ProtocolVersion): HttpClient;

@@ -7,3 +7,2 @@ import { WebSocket } from "@libsql/isomorphic-ws";

export { WebSocket } from "@libsql/isomorphic-ws";
export { fetch, Request, Headers } from "cross-fetch";
export { Client } from "./client.js";

@@ -38,4 +37,3 @@ export * from "./errors.js";

* If the `customFetch` argument is passed and not `undefined`, it is used in place of the `fetch` function
* from `cross-fetch`. This function is always called with a `Request` object from
* `cross-fetch`.
* from the global `fetch`. This function is always called with a global `Request` object.
*/

@@ -42,0 +40,0 @@ export function openHttp(url, jwt, customFetch, remoteEncryptionKey, protocolVersion = 2) {

{
"name": "@libsql/hrana-client",
"version": "0.9.0",
"version": "0.10.0",
"keywords": [

@@ -44,10 +44,7 @@ "hrana",

"typecheck": "tsc --noEmit",
"test": "jest --runInBand",
"typedoc": "rm -rf ./docs && typedoc"
"test": "jest --runInBand"
},
"dependencies": {
"@libsql/isomorphic-ws": "^0.1.5",
"cross-fetch": "^4.0.0",
"js-base64": "^3.7.5",
"node-fetch": "^3.3.2"
"js-base64": "^3.7.5"
},

@@ -58,5 +55,4 @@ "devDependencies": {

"ts-jest": "^29.1.1",
"typedoc": "^0.24.8",
"typescript": "^5.1.6"
}
}