Releases: edgedb/edgedb-js
v0.22.3
v0.22.2
v0.22.1
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
v0.21.3
v0.21.2
v0.21.1
v0.21.0
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 theClient
for setting global variablesimport {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. Docse.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:
- 64c2456 Update transaction.ts (#351)
- 825b11a Support protocol v1.0 (#354)
- f57034a [Docs] Fix two comment error (#359)
- 183f2e7 Change deprecated CONFIGURE SYSTEM to CONFIGURE INSTANCE
- 569f19c Implement
e.group
(#362) - b41208e Custom codecs update (#353)
- 832a1bc Implement globals (#369)
- 40f8635 Implement
--target mts
(#374) - b6d8636 Fix codegen (#375)
- 475f860 Pin npm-install version
- 75d157e Pin npm-install version
- f4a1664 Fix docs rendering issue
- 60fd043 Update issue templates
- 3ad3155 Update issue templates
- eaf5e99 Fix
with
blocks oninsert
,insert ... unless conflict
anddelete
expressions (#380) - 50869e8 Protocol v1 (#368)
- 02fd568 fix: set code block language highlight (#390)
- 87920c7 Fix query builder on v1 instances (#393)
- c2156a4 Use byteToHex to decode uuid (#391)
- dab4085 Auto-parse json fields (#392)
- a15e447 v0.21.0
v0.20.10
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