2.2.0 • Published 8 months ago

@tai-kun/surrealdb v2.2.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
8 months 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

8 months ago

2.1.2

9 months ago

2.1.1

9 months ago

2.1.0

9 months ago

2.0.3

9 months ago

2.0.2

10 months ago

2.0.1

10 months ago

2.0.0

10 months ago

2.0.0-beta.2

10 months ago

2.0.0-beta.3

10 months ago

2.0.0-beta.1

10 months ago

2.0.0-alpha.8

10 months ago

2.0.0-alpha.7

10 months ago

2.0.0-alpha.6

10 months ago

2.0.0-alpha.5

10 months ago

2.0.0-alpha.4

10 months ago

2.0.0-alpha.3

10 months ago

2.0.0-alpha.2

10 months ago

2.0.0-alpha.1

10 months ago

2.0.0-alpha.0

11 months ago

1.4.3

11 months ago

1.4.2

11 months ago

1.4.1

11 months ago

1.4.0

11 months ago

1.3.0

11 months ago

1.2.1

12 months ago

1.2.0

12 months ago

1.1.0

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago

0.1.0

1 year ago