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

surrealdb.js

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

surrealdb.js - npm Package Compare versions

Comparing version 1.0.0-beta.7 to 1.0.0-beta.8

8

esm/library/engine.js

@@ -56,4 +56,4 @@ import { z } from "zod";

}
version(url) {
return retrieveRemoteVersion(url);
version(url, timeout) {
return retrieveRemoteVersion(url, timeout);
}

@@ -195,4 +195,4 @@ async connect(url) {

}
version(url) {
return retrieveRemoteVersion(url);
version(url, timeout) {
return retrieveRemoteVersion(url, timeout);
}

@@ -199,0 +199,0 @@ connect(url) {

@@ -13,3 +13,3 @@ import semver from "semver";

}
export async function retrieveRemoteVersion(url) {
export async function retrieveRemoteVersion(url, timeout) {
const mappedProtocols = {

@@ -26,4 +26,8 @@ "ws:": "http:",

url.pathname = url.pathname.slice(0, -4) + "/version";
const controller = new AbortController();
const id = setTimeout(() => controller.abort(), timeout);
const versionPrefix = "surrealdb-";
const version = await fetch(url)
const version = await fetch(url, {
signal: controller.signal,
})
.then((res) => res.text())

@@ -33,2 +37,5 @@ .then((version) => version.slice(versionPrefix.length))

throw new VersionRetrievalFailure();
})
.finally(() => {
clearTimeout(id);
});

@@ -35,0 +42,0 @@ return version;

@@ -78,3 +78,3 @@ import { EngineDisconnected, NoActiveSocket, NoDatabaseSpecified, NoNamespaceSpecified, NoTokenReturned, ResponseError, UnsupportedEngine, } from "./errors.js";

if (opts.versionCheck !== false) {
const version = await connection.version(url);
const version = await connection.version(url, opts.versionCheckTimeout ?? 5000);
versionCheck(version);

@@ -81,0 +81,0 @@ }

@@ -6,3 +6,3 @@ {

"name": "surrealdb.js",
"version": "1.0.0-beta.7",
"version": "1.0.0-beta.8",
"description": "Javascript driver for SurrealDB",

@@ -9,0 +9,0 @@ "license": "Apache 2.0",

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

}
version(url) {
return (0, versionCheck_js_1.retrieveRemoteVersion)(url);
version(url, timeout) {
return (0, versionCheck_js_1.retrieveRemoteVersion)(url, timeout);
}

@@ -203,4 +203,4 @@ async connect(url) {

}
version(url) {
return (0, versionCheck_js_1.retrieveRemoteVersion)(url);
version(url, timeout) {
return (0, versionCheck_js_1.retrieveRemoteVersion)(url, timeout);
}

@@ -207,0 +207,0 @@ connect(url) {

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

exports.isVersionSupported = isVersionSupported;
async function retrieveRemoteVersion(url) {
async function retrieveRemoteVersion(url, timeout) {
const mappedProtocols = {

@@ -34,4 +34,8 @@ "ws:": "http:",

url.pathname = url.pathname.slice(0, -4) + "/version";
const controller = new AbortController();
const id = setTimeout(() => controller.abort(), timeout);
const versionPrefix = "surrealdb-";
const version = await fetch(url)
const version = await fetch(url, {
signal: controller.signal,
})
.then((res) => res.text())

@@ -41,2 +45,5 @@ .then((version) => version.slice(versionPrefix.length))

throw new errors_js_1.VersionRetrievalFailure();
})
.finally(() => {
clearTimeout(id);
});

@@ -43,0 +50,0 @@ return version;

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

if (opts.versionCheck !== false) {
const version = await connection.version(url);
const version = await connection.version(url, opts.versionCheckTimeout ?? 5000);
(0, versionCheck_js_1.versionCheck)(version);

@@ -84,0 +84,0 @@ }

@@ -60,3 +60,3 @@ import { z } from "zod";

abstract version(url: URL): Promise<string>;
abstract version(url: URL, timeout: number): Promise<string>;
}

@@ -89,4 +89,4 @@

version(url: URL): Promise<string> {
return retrieveRemoteVersion(url);
version(url: URL, timeout: number): Promise<string> {
return retrieveRemoteVersion(url, timeout);
}

@@ -259,4 +259,4 @@

version(url: URL): Promise<string> {
return retrieveRemoteVersion(url);
version(url: URL, timeout: number): Promise<string> {
return retrieveRemoteVersion(url, timeout);
}

@@ -263,0 +263,0 @@

@@ -18,3 +18,3 @@ import semver from "semver";

export async function retrieveRemoteVersion(url: URL) {
export async function retrieveRemoteVersion(url: URL, timeout: number) {
const mappedProtocols = {

@@ -33,4 +33,11 @@ "ws:": "http:",

const controller = new AbortController();
const id = setTimeout(() => controller.abort(), timeout);
const versionPrefix = "surrealdb-";
const version = await fetch(url)
const version = await fetch(
url,
{
signal: controller.signal,
},
)
.then((res) => res.text())

@@ -40,2 +47,5 @@ .then((version) => version.slice(versionPrefix.length))

throw new VersionRetrievalFailure();
})
.finally(() => {
clearTimeout(id);
});

@@ -42,0 +52,0 @@

@@ -99,3 +99,6 @@ import {

if (opts.versionCheck !== false) {
const version = await connection.version(url);
const version = await connection.version(
url,
opts.versionCheckTimeout ?? 5000,
);
versionCheck(version);

@@ -102,0 +105,0 @@ }

@@ -198,2 +198,3 @@ import { z } from "zod";

versionCheck?: boolean;
versionCheckTimeout?: number;
prepare?: (connection: Surreal) => unknown;

@@ -200,0 +201,0 @@ auth?: AnyAuth | Token;

@@ -32,3 +32,3 @@ import { Emitter } from "./emitter.js";

};
abstract version(url: URL): Promise<string>;
abstract version(url: URL, timeout: number): Promise<string>;
}

@@ -48,3 +48,3 @@ export declare class WebsocketEngine implements Engine {

private setStatus;
version(url: URL): Promise<string>;
version(url: URL, timeout: number): Promise<string>;
connect(url: URL): Promise<void>;

@@ -69,3 +69,3 @@ disconnect(): Promise<void>;

private setStatus;
version(url: URL): Promise<string>;
version(url: URL, timeout: number): Promise<string>;
connect(url: URL): Promise<void>;

@@ -72,0 +72,0 @@ disconnect(): Promise<void>;

export declare const supportedSurrealDbVersionRange = ">= 1.4.2 < 2.0.0";
export declare function versionCheck(version: string): true;
export declare function isVersionSupported(version: string): boolean;
export declare function retrieveRemoteVersion(url: URL): Promise<string>;
export declare function retrieveRemoteVersion(url: URL, timeout: number): Promise<string>;

@@ -258,2 +258,3 @@ import { z } from "zod";

versionCheck?: boolean;
versionCheckTimeout?: number;
prepare?: (connection: Surreal) => unknown;

@@ -260,0 +261,0 @@ auth?: AnyAuth | Token;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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