edgedb-js
edgedb-js copied to clipboard
ext::auth::ClientTokenIdentity has wrong cardinality type and type does not exist error
Code
The code causing the error.
const query =
e.insert(e.User, {
name: "user",
identity: e.ext.auth.ClientTokenIdentity,
})
Schema
Your application schema.
using extension auth;
module default {
type User {
required name: str;
identity: ext::auth::Identity {
constraint exclusive;
};
}
}
Error or desired behavior
For identity in the e.insert() statement, Typescript complains about:
Type 'Cardinality.Many' is not assignable to type 'Cardinality.AtMostOne | Cardinality.One | Cardinality.Empty
Expected behavior: According to its definition, I think ClientTokenIdentity should have Cardinality.AtMostOne instead of Many:
<project>/dbschema/edgeql-js/modules/ext/auth.ts
const ClientTokenIdentity: $.$expr_PathNode<$.TypeSet<$ClientTokenIdentity, $.Cardinality.Many>, null> = _.syntax.$PathNode($.$toSet($ClientTokenIdentity, $.Cardinality.Many), null);
<gel-source>/edb/lib/ext/auth.edgeql
create single global ext::auth::ClientTokenIdentity := (
with
...
select
ext::auth::Identity
filter
.id = <uuid>json_get(jwt.claims, "sub")
);
Versions:
- OS: Linux
- EdgeDB version (e.g.
2.0): "6.2+e1a80a5" edgedb-jsversion (e.g.0.20.10;): [email protected]@edgedb/generateversion (e.g.0.0.7;): @gel/[email protected]- TypeScript version: [email protected]
- Node/Deno version: node v22.11.0