Typescript types for the auth0 rule runtime environment
npm install --save @tepez/auth0-rules-types
The module declares global variables so you should import it, e.g.:
import '@tepez/auth0-rules-types'
It also defines types you can use in the rules:
IAuth0RuleUser
- the user object (first argument of the rule function)IAuth0RuleContext
- the context object (second argument of the rule function)IAuth0RuleCallback
- the callback function (third argument of the rule function)IAuthRuleFunction
- the rule function itself
Add typings for cache
Add:
declare global {
namespace NodeJS {
interface Global {
CACHE_KEY: string
}
}
}
Now you can access the cache on the global variable, global.CACHE_KEY
Add typings for rules configuration
Add:
declare global {
interface IAuth0RuleConfiguration {
KEY: string
}
}
Now you can access the configuration using configuration.KEY