Skip to content

Commit

Permalink
Driver tests and integration-tests rename to gel (#1173)
Browse files Browse the repository at this point in the history
  • Loading branch information
diksipav committed Jan 23, 2025
1 parent 00fa300 commit b76a9fb
Show file tree
Hide file tree
Showing 69 changed files with 275 additions and 287 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
dist
packages/deno
/.bench
/.vscode
node_modules
Expand Down
114 changes: 57 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
<div align="center">
<h1>The official Node.js client library for EdgeDB</h1>
<h1>The official Node.js client library for Gel</h1>

<a href="https://github.com/edgedb/edgedb-js/actions" rel="nofollow">
<img src="https://github.com/edgedb/edgedb-js/actions/workflows/tests.yml/badge.svg?event=push&branch=master" alt="Build status">
<a href="https://github.com/geldata/gel-js/actions" rel="nofollow">
<img src="https://github.com/geldata/gel-js/actions/workflows/tests.yml/badge.svg?event=push&branch=master" alt="Build status">
</a>
<a href="https://www.npmjs.com/package/edgedb" rel="nofollow">
<img src="https://img.shields.io/npm/v/edgedb" alt="NPM version">
<a href="https://www.npmjs.com/package/gel" rel="nofollow">
<img src="https://img.shields.io/npm/v/gel" alt="NPM version">
</a>
<a href="https://github.com/edgedb/edgedb" rel="nofollow">
<img src="https://img.shields.io/github/stars/edgedb/edgedb" alt="Stars">
<a href="https://github.com/geldata/gel" rel="nofollow">
<img src="https://img.shields.io/github/stars/geldata/gel" alt="Stars">
</a>
<a href="https://github.com/edgedb/edgedb/blob/master/LICENSE">
<a href="https://github.com/geldata/gel/blob/master/LICENSE">
<img src="https://img.shields.io/badge/license-Apache%202.0-blue" />
</a>
<br />
<br />
<a href="https://www.edgedb.com/docs/guides/quickstart">Quickstart</a>
<a href="https://www.geldata.com/docs/guides/quickstart">Quickstart</a>
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<a href="https://www.edgedb.com">Website</a>
<a href="https://www.geldata.com">Website</a>
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<a href="https://www.edgedb.com/docs/clients/js/index">Docs</a>
<a href="https://www.geldata.com/docs/clients/js/index">Docs</a>
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<a href="https://discord.gg/umUueND6ag">Discord</a>
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<a href="https://twitter.com/edgedatabase">Twitter</a>
<a href="https://twitter.com/usegel">Twitter</a>
<br />

</div>

This is the official [EdgeDB](https://github.com/edgedb/edgedb) client library
This is the official [Gel](https://github.com/geldata/gel) client library
for JavaScript and TypeScript.

If you're just getting started with EdgeDB, we recommend going through the
[EdgeDB Quickstart](https://www.edgedb.com/docs/quickstart) first. This walks
you through the process of installing EdgeDB, creating a simple schema, and
If you're just getting started with Gel, we recommend going through the
[Gel Quickstart](https://www.geldata.com/docs/quickstart) first. This walks
you through the process of installing Gel, creating a simple schema, and
writing some simple queries.

### Requirements
Expand All @@ -46,16 +46,16 @@ writing some simple queries.
### Installation

```bash
npm install edgedb # npm users
yarn add edgedb # yarn users
npm install gel # npm users
yarn add gel # yarn users
```

> EdgeDB 2.x requires `v0.21.0` or later
> Gel 2.x requires `v0.21.0` or later
## Basic usage

> The examples below demonstrate only the most fundamental use cases for this
> library. **[Go to the complete documentation site. >](https://www.edgedb.com/docs/clients/js/index)**
> library. **[Go to the complete documentation site. >](https://www.geldata.com/docs/clients/js/index)**
### Create a client

Expand All @@ -65,49 +65,49 @@ connections to your database and provides methods for executing queries.
_For TypeScript (and Node.js+ESM)_

```ts
import * as edgedb from "edgedb";
import * as gel from "gel";

const client = edgedb.createClient();
const client = gel.createClient();
```

_For Node.js (CommonJS)_

```js
const edgedb = require("edgedb");
const gel = require("gel");

const client = edgedb.createClient();
const client = gel.createClient();
```

### Configuring the connection

The call to `edgedb.createClient()` doesn't require arguments, as the library
The call to `gel.createClient()` doesn't require arguments, as the library
can determine how to connect to your database using the following mechanisms.

1. _For local development_: initialize a project with the `edgedb project init`
1. _For local development_: initialize a project with the `gel project init`
command. As long as the file is within a project directory, `createClient`
will be able to auto-discover the connection information of the project's
associated instance. For more information on projects, follow the
[Using projects](https://www.edgedb.com/docs/guides/projects) guide.
[Using projects](https://www.geldata.com/docs/guides/projects) guide.

2. _In production_: configure the connection using **environment variables**.
(This can also be used during local development if you prefer.) The easiest
way is to set the `EDGEDB_DSN` variable; a DSN (also known as a "connection
way is to set the `GEL_DSN` variable; a DSN (also known as a "connection
string") is a string of the form
`edgedb://USERNAME:PASSWORD@HOSTNAME:PORT/DATABASE`.
`gel://USERNAME:PASSWORD@HOSTNAME:PORT/DATABASE`.

For advanced cases, see the
[DSN specification](https://www.edgedb.com/docs/reference/dsn) and
[Reference > Connection Parameters](https://www.edgedb.com/docs/reference/connection).
[DSN specification](https://www.geldata.com/docs/reference/dsn) and
[Reference > Connection Parameters](https://www.geldata.com/docs/reference/connection).

### Run a query

> The remainder of the documentation assumes you are using ES module (`import`)
> syntax.
```ts
import * as edgedb from "edgedb";
import * as gel from "gel";

const client = edgedb.createClient();
const client = gel.createClient();
await client.query("select 2 + 2"); // => [4]
```

Expand All @@ -131,17 +131,17 @@ await client.querySingle(

## Generators

Install the `@edgedb/generate` package as a dev dependency to take advantage of EdgeDB's built-in code generators.
Install the `@gel/generate` package as a dev dependency to take advantage of Gel's built-in code generators.

```bash
npm install @edgedb/generate --save-dev # npm users
yarn add @edgedb/generate --dev # yarn users
npm install @gel/generate --save-dev # npm users
yarn add @gel/generate --dev # yarn users
```

Then run a generator with the following command:

```bash
$ npx @edgedb/generate <generator> [FLAGS]
$ npx @gel/generate <generator> [FLAGS]
```

The following `<generator>`s are currently supported:
Expand All @@ -155,7 +155,7 @@ The following `<generator>`s are currently supported:
Run the following command to generate a source file for each `*.edgeql` system in your project.

```bash
$ npx @edgedb/generate queries
$ npx @gel/generate queries
```

Assume you have a file called `getUser.edgeql` in your project directory.
Expand All @@ -172,12 +172,12 @@ filter .email = <str>$email;
This generator will generate a `getUser.query.ts` file alongside it that exports a function called `getUser`.

```ts
import {createClient} from "edgedb";
import {myQuery} from "./myQuery.query";
import { createClient } from "gel";
import { myQuery } from "./myQuery.query";

const client = createClient();

const user = await myQuery(client, {name: "Timmy"});
const user = await myQuery(client, { name: "Timmy" });
user; // {name: string; email: string}
```

Expand All @@ -187,19 +187,19 @@ The first argument is a `Client`, the second is the set of _parameters_. Both th

The query builder lets you write queries in a code-first way. It automatically infers the return type of your queries.

To generate the query builder, install the `edgedb` package, initialize a project (if you haven't already), then run the following command:
To generate the query builder, install the `gel` package, initialize a project (if you haven't already), then run the following command:

```bash
$ npx @edgedb/generate edgeql-js
$ npx @gel/generate edgeql-js
```

This will generate an EdgeQL query builder into the `./dbschema/edgeql-js`
directory, as defined relative to your project root.

For details on generating the query builder, refer to the [complete documentation](https://www.edgedb.com/docs/clients/js/generation). Below is a simple `select` query as an example.
For details on generating the query builder, refer to the [complete documentation](https://www.geldata.com/docs/clients/js/generation). Below is a simple `select` query as an example.

```ts
import { createClient } from "edgedb";
import { createClient } from "gel";
import e from "./dbschema/edgeql-js";

const client = createClient();
Expand All @@ -215,30 +215,30 @@ const result = await query.run(client);
result.actors[0].name; // => Timothee Chalamet
```

For details on using the query builder, refer to the full [query builder docs](https://www.edgedb.com/docs/clients/js/querybuilder).
For details on using the query builder, refer to the full [query builder docs](https://www.geldata.com/docs/clients/js/querybuilder).

## Contribute

Contributing to this library requires a local installation of EdgeDB. Install
EdgeDB from [here](https://www.edgedb.com/download) or
[build it from source](https://www.edgedb.com/docs/reference/dev).
Contributing to this library requires a local installation of Gel. Install
Gel from [here](https://www.geldata.com/download) or
[build it from source](https://www.geldata.com/docs/reference/dev).

```bash
$ git clone git@github.com:edgedb/edgedb-js.git
$ cd edgedb-js
$ git clone git@github.com:gel/gel-js.git
$ cd gel-js
$ yarn # install dependencies
$ yarn run build # build all packages
$ yarn run test # run tests for all packages
```

> In order to be able to run all tests you need to have `edgedb-server` in your
> In order to be able to run all tests you need to have `gel-server` in your
> path. This can be done by either running tests from within a Python 3.12
> virtual environment (you will have it if you built EdgeDB locally), or by
> [installing](https://docs.edgedb.com/cli/edgedb_server/edgedb_server_install#ref-cli-edgedb-server-install)
> specific EdgeDB version and then adding its binary path to the `EDGEDB_SERVER_BIN` environment variable.
> Check [here](https://docs.edgedb.com/cli/edgedb_server/edgedb_server_info#ref-cli-edgedb-server-info)
> virtual environment (you will have it if you built Gel locally), or by
> [installing](https://docs.geldata.com/cli/gel_server/gel_server_install#ref-cli-gel-server-install)
> specific Gel version and then adding its binary path to the `GEL_SERVER_BIN` environment variable.
> Check [here](https://docs.geldata.com/cli/gel_server/gel_server_info#ref-cli-gel-server-info)
> to find how to get the binary path.
## License

`edgedb-js` is developed and distributed under the Apache 2.0 license.
`gel-js` is developed and distributed under the Apache 2.0 license.
1 change: 0 additions & 1 deletion integration-tests/legacy/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ trace
trace/*
mts/edgeql-js
esm/edgeql-js
deno/edgeql-js
cjs/edgeql-js
db/schema/edgeql-js
db/schema/queries.ts
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[edgedb]
[gel]
server-version = "2"

[project]
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/legacy/globalSetup.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import createClient from "edgedb";
import createClient from "gel";

export default async () => {
const client = createClient();

process.env._JEST_EDGEDB_VERSION = await client.queryRequiredSingleJSON(
process.env._JEST_GEL_VERSION = await client.queryRequiredSingleJSON(
`select sys::get_version()`,
);
};
2 changes: 1 addition & 1 deletion integration-tests/legacy/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
testPathIgnorePatterns: ["./dist", "./esm", "./mts", "./cjs", "./deno"],
testPathIgnorePatterns: ["./dist", "./esm", "./mts", "./cjs"],
globalSetup: "./globalSetup.ts",
transform: {},
globals: {},
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/legacy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"name": "@edgedb/integration-legacy",
"name": "@gel/integration-legacy",
"version": "0.0.0",
"scripts": {
"typecheck": "echo 'Integration tests - legacy, skipping typecheck...'",
Expand All @@ -10,12 +10,12 @@
"ci:integration-test": "tsx ./testRunner.ts"
},
"devDependencies": {
"@edgedb/generate": "*",
"@gel/generate": "*",
"@tsconfig/node-lts": "^20.1.3",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.13",
"conditional-type-checks": "^1.0.6",
"edgedb": "*",
"gel": "*",
"jest": "^29.7.0",
"ts-jest": "^29.1.4",
"typescript": "^5.5.2"
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/legacy/setupTeardown.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as tc from "conditional-type-checks";
import { type Client, createClient } from "edgedb";
import { type Client, createClient } from "gel";

export { tc };

Expand All @@ -25,7 +25,7 @@ export async function teardownTests(client: Client) {
}

export const versionGTE = (majorVer: number) => {
const version = JSON.parse(process.env._JEST_EDGEDB_VERSION!);
const version = JSON.parse(process.env._JEST_GEL_VERSION!);
return version.major >= majorVer;
};

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/legacy/smoke.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from "node:assert/strict";
import { type Client } from "edgedb";
import { type Client } from "gel";
import e from "./db/schema/edgeql-js";
import { setupTests, teardownTests } from "./setupTeardown";

Expand Down
10 changes: 5 additions & 5 deletions integration-tests/legacy/testRunner.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import createClient from "edgedb";
import createClient from "gel";

import {
shutdown,
Expand All @@ -12,7 +12,7 @@ import {
} from "../../packages/driver/test/testUtil";

(async function main() {
console.log("\nStarting EdgeDB test cluster...");
console.log("\nStarting Gel test cluster...");

const statusFile = generateStatusFileName("node");
console.log("Node status file:", statusFile);
Expand All @@ -21,7 +21,7 @@ import {

const { proc, config } = await startServer(args, statusFile);

console.log(`EdgeDB test cluster is up [port: ${config.port}]...`);
console.log(`Gel test cluster is up [port: ${config.port}]...`);

const managementConn = await createClient(config).ensureConnected();

Expand All @@ -33,8 +33,8 @@ import {
console.error(err);
process.exit(1);
} finally {
console.log("Shutting down EdgeDB test cluster...");
console.log("Shutting down Gel test cluster...");
await shutdown(proc, managementConn);
console.log("EdgeDB test cluster is down...");
console.log("Gel test cluster is down...");
}
})();
1 change: 0 additions & 1 deletion integration-tests/lts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ trace
trace/*
mts/edgeql-js
esm/edgeql-js
deno/edgeql-js
cjs/edgeql-js
dbschema/edgeql-js
dbschema/queries.ts
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/lts/cardinality.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { $ } from "edgedb";
import type { $ } from "gel";
import type { cardutil } from "../../packages/generate/src/syntax/cardinality";
import { tc } from "./setupTeardown";

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/lts/casts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import e from "./dbschema/edgeql-js";
import type { $Movie } from "./dbschema/edgeql-js/modules/default";

import { setupTests, tc, teardownTests } from "./setupTeardown";
import type { Client, $ } from "edgedb";
import type { Client, $ } from "gel";

describe("casts", () => {
let client: Client;
Expand Down
Loading

0 comments on commit b76a9fb

Please sign in to comment.