You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently, client that talks to Permify API is loosely typed.
Describe the solution you'd like
It would be amazing to have Typescript client automatically generated using some sort of codegen based on Permify schema, think of it like Prisma's prisma-client-js.
E.g,
entity user {}
entity organization {
relation admin @user
relation member @user
action view_files = admin or member
action edit_files = admin
}
Generates a client that allow us to do:
import{Permify}from'@permify/client'constclient=newPermify({endpoint: "localhost:3478",})// orm-like syntaxclient.permission.tenantId("t1").organization("organization-001").permission("view_files").user("user-001").check({metadata: {snapToken: "",schemaVersion: "",depth: 20},}).then(...);// strongly typed, you will get compile error if you attempt to check against something that is not written in your schemaconstresponse=awaitclient.permission.tenantId("t1").organization().permission("edit_files").user().subjectPermission();
Describe alternatives you've considered
Manually writing types and using the default client.
Standalone orm builder that can be used in all services.
Additional context
Having a strongly typed client automatically generated will greatly improve DX.
Caveats
Not sure about the complexity of implementing it and how it will work for Data service / attribute, etc. The above example roughly demonstrates the idea.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Currently, client that talks to Permify API is loosely typed.
Describe the solution you'd like
It would be amazing to have Typescript client automatically generated using some sort of codegen based on Permify schema, think of it like Prisma's
prisma-client-js
.E.g,
Generates a client that allow us to do:
Describe alternatives you've considered
Additional context
Having a strongly typed client automatically generated will greatly improve DX.
Caveats
Not sure about the complexity of implementing it and how it will work for Data service / attribute, etc. The above example roughly demonstrates the idea.
The text was updated successfully, but these errors were encountered: