unkeyed / unkey

Open source API management platform
https://go.unkey.com
Other
3.99k stars 467 forks source link

Add missing types to the UnkeyContext of the @unkey/hono package #1557

Closed n3rdc4ptn closed 5 months ago

n3rdc4ptn commented 5 months ago

Preliminary Checks

Reproduction / Replay Link (Optional)

No response

Issue Summary

When developing with the @unkey/hono package, the UnkeyContext does not contain the permissions which are provided. This makes developing with the package in typescript not as convenient.

The permissions data is there, only the type definition seems to be missing.

Steps to Reproduce

  1. Add the @unkey/hono package to a hono project and set it up according to the docs.
  2. Access the unkey var in the HonoContext.
  3. See that there is no permission listed by the type and with that the typescript language server is not aware that there is a permission object.

Expected behavior

The permissions object should be there as a type.

Other information

Currently I am fixing this by defining my app like so:

const app = new Hono<{
  Variables: {
    unkey: UnkeyContext & {
      permissions?: string[];
    };
  };
}>();

Screenshots

No response

Version info

- OS: macOS
- Node: 20.11.
- bun: 1.1.3
linear[bot] commented 5 months ago

ENG-1045 Add missing types to the UnkeyContext of the @unkey/hono package

n3rdc4ptn commented 5 months ago

I also looked at the types and it seems that there are not only the permissions parameter missing, but also: