1.5.0-next.20240820T063801 • Published 1 year ago

@tai-kun/surrealdb v1.5.0-next.20240820T063801

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

A modular SurrealDB client working in major JavaScript runtimes.

GitHub Actions Workflow Status GitHub Actions Workflow Status GitHub Actions Workflow Status

GitHub Actions Workflow Status GitHub Actions Workflow Status GitHub Actions Workflow Status

codecov

License

Latest Version

!NOTE The main branch is currently under development for SurrealDB v2. You can find the repository for SurrealDB v1 here.

Document (JA/EN/KO/zh-CN)

https://tai-kun.github.io/surrealdb.js/getting-started/

Install

npm i @tai-kun/surrealdb

Quick Start

import { Surreal } from "@tai-kun/surrealdb";

const db = new Surreal();
await db.connect("<your_surrealdb_server>"); // e.g. ws://localhost:8000

try {
  await db.signin({ user: "root", pass: "root" });
  await db.use("sample_namespace", "sample_database");
  const results = await db.query<[number]>(/*surql*/ `RETURN 42;`);
  console.log(results); // [ 42 ]
} finally {
  await db.close();
}

Customization

import { initSurreal } from "@tai-kun/surrealdb";
import Client from "@tai-kun/surrealdb/standard-client";
import HttpEngine from "@tai-kun/surrealdb/http-engine";
import JsonFormatter from "@tai-kun/surrealdb/json-formatter";

const { Surreal } = initSurreal({
  Client: Client,
  engines: {
    http: config => new HttpEngine({
      ...config,
      // fetch: <your custom fetch function>
    }),
    https: "http",
  },
  formatter: new JsonFormatter(),
});

Requirements

SurrealDB >=2.1.0

The repository for SurrealDB v1 is here.

Recommended environment

EnvVersion
Node.js20.x,22.x *1
Deno1.x, 2.x *2
Bun1.x
Chromium>=104 *3
Firefox>=100 *4
WebKit>=15.4 *5

1: Probably works with 18.x
2: Probably works with ^1.44.3
3: Probably works with >=78
4: Probably works with >=68
*5: Probably works with >=14

Fully Tested

EnvVersion
Node.js20.x,22.x,23.x
Deno1.x,2.x
Bun1.x
Chromium>=104

Partial Tested

EnvVersion
Node.js18.x
Firefox>=100
WebKit>=15.4

License

Apache-2.0

2.2.0

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.0

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

2.0.0-beta.2

1 year ago

2.0.0-beta.3

1 year ago

2.0.0-beta.1

1 year ago

2.0.0-alpha.8

1 year ago

2.0.0-alpha.7

1 year ago

2.0.0-alpha.6

1 year ago

2.0.0-alpha.5

1 year ago

2.0.0-alpha.4

1 year ago

2.0.0-alpha.3

1 year ago

2.0.0-alpha.2

1 year ago

2.0.0-alpha.1

1 year ago

2.0.0-alpha.0

1 year ago

1.4.3

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.0

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.1.0

1 year ago