rivet-gg / modules

🧩 Official registry of Rivet Modules.
https://rivet.gg/modules
Apache License 2.0
109 stars 5 forks source link

Type-safe module calling on ctx #2

Closed NathanFlurry closed 8 months ago

NathanFlurry commented 8 months ago

Example: ctx.users.get({ … })

This should only make the listed dependencies available in the given context. If using a context that's not ModuleContext, then all modules are available. Should be easy to do using a Partial.

Any module names that conflict with the core types (e.g. db) will be renamed with an underscore. e.g. calling the db module looks like ctx._db.doSomething({})

This needs to have a type-safe req/res format. This will require generating types in the runtime_config.ts file.

linear[bot] commented 8 months ago
OGSE-1 Call modules using Proxies

> Would be fun to use lol with Proxys, probably not as intuitive > ctx.call("users", "get") > ctx.users.get()