Skip to content

Releases: edgedb/edgedb-js

v0.22.3

05 Sep 22:59
eefc05f
Compare
Choose a tag to compare

Commits:

v0.22.2

04 Sep 02:33
dd25635
Compare
Choose a tag to compare

Commits:

  • 68299c8 Reorder options for help text of target and include deno in it (#436)
  • dd25635 Fix TS4.8 compilation issue (#438)

v0.22.1

25 Aug 03:03
Compare
Choose a tag to compare

Deno support for query builder

This release includes Deno support for the query builder. Basic usage guidelines:

Generation

$ deno run -A --unstable --reload https://deno.land/x/edgedb/generate.ts

This command supports all same flags as the npx equivalent:

  • Connection flags like -I, --dsn
  • Specify output dir with --output-dir
  • Specify target with --target

Import map

The generated code contains imports from "edgedb". You'll need to define an import map so Deno knows how to resolve this.

deno.json

// deno.json
{
  // ...
  "importMap": "./import_map.json"
}

import_map.json

{
  "imports": {
    "edgedb": "https://deno.land/x/edgedb/mod.ts",
    "edgedb/": "https://deno.land/x/edgedb/"
  }
}

Usage

Nothing special here, most of the examples in the query builder docs will work as-is. Here's a minimal script you can try out.

test.ts

import {createClient} from 'edgedb';

import e from './dbschema/edgeql-js/index.ts';

const client = createClient();
const query = e.select({
  num: e.int64(35),
  msg: e.str('Hello world'),
});

const result = await query.run(client);
console.log(JSON.stringify(result, null, 2));

Deno.exit();
$ deno run -A --unstable test.ts

Commits:

v0.22.0

24 Aug 02:54
Compare
Choose a tag to compare

Commits:

v0.21.3

03 Aug 21:40
Compare
Choose a tag to compare

Commits:

v0.21.2

01 Aug 22:22
74db978
Compare
Choose a tag to compare

Commits:

v0.21.1

27 Jul 07:20
Compare
Choose a tag to compare

Commits:

v0.21.0

20 Jul 00:25
Compare
Choose a tag to compare

Migrating to EdgeDB 2.0

We recently released v0.21.0 of the edgedb module on NPM and deno.land/x, which supports the latest EdgeDB 2.0 features and protocol. It is backwards-compatible with v1 instances as well, so we recommend all users upgrade.

npm install edgedb@latest

Breaking changes

  • All uuid properties are now decoded to include hyphens. Previously hyphens were elided for performance reasons; this issue has since been resolved.

    client.querySingle(`select uuid_generate_v1mc();`);
    // "ce13b17a-7fcd-42b3-b5e3-eb28d1b953f6"
  • All json properties and parameters are now parsed/stringified internally by the client. Previously:

    const result = await client.querySingle(
      `select to_json('{"hello": "world"}');`
    );
    result; // '{"hello": "world"}'
    typeof result; // string

    Now:

    const result = await client.querySingle(
      `select to_json('{"hello": "world"}');`
    );
    result; // {hello: "world"}
    typeof result; // object
    result.hello; // "world"

New features

  • Added the .withGlobals method the Client for setting global variables

    import {createClient} from "edgedb";
    const client = createClient().withGlobals({
      current_user: getUserIdFromCookie(),
    });
    
    client.query(`select User { email } filter .id = global current_user;`);
  • Support for globals in the query builder

    const query = e.select(e.User, user => ({
      email: true,
      filter: e.op(user.id, "=", e.global.current_user),
    }));
    
    await query.run(client);
  • Support for the group statement. Docs

    e.group(e.Movie, movie => {
      return {
        title: true,
        actors: {name: true},
        num_actors: e.count(movie.characters),
        by: {release_year: movie.release_year},
      };
    });
    /* [
      {
        key: {release_year: 2008},
        grouping: ["release_year"],
        elements: [{
          title: "Iron Man",
          actors: [...],
          num_actors: 5
        }, {
          title: "The Incredible Hulk",
          actors: [...],
          num_actors: 3
        }]
      },
      // ...
    ] */
  • Support for range types and DateDuration values

Commits:

v0.20.10

12 May 01:27
Compare
Choose a tag to compare

Commits:

  • 4dcafbb Improve docs, add query builder primer page (#348)
  • 94479ab Add link prop example. Switch runtime -> release_year. (#342)
  • cfc3f17 Clean up Proxy logic. Fix Date type. Support JS literals in e.cast. (#341)
  • 53fffd5 Improve link prop documentation. Support link props in insert. (#349)
  • f170b5f 0.20.10

v0.20.9

03 May 22:32
Compare
Choose a tag to compare

Commits:

  • 05f3631 Correctly quote backlink keys in shapes (#335)
  • 59cdb7f When selecting a required multi link, wrap expr in assert_exists guard (#334)
  • 00b501f 0.20.9