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@latestBreaking changes
-
All
uuidproperties 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
jsonproperties 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
.withGlobalsmethod theClientfor 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
groupstatement. 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
DateDurationvalues
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
withblocks oninsert,insert ... unless conflictanddeleteexpressions (#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