- Accept
rate-limiter-flexible
5.x as valid peer dependencies - Update dependencies
- Accept
rate-limiter-flexible
3.x and 4.x as valid peer dependencies - Update dependencies
- Update dependencies
- Update dependencies
- Add support of field
extensions
to enable granular directive customization per field.
- Update dependencies, switched to using
peerDependencies
overdependencies
. - Add
setState
option toRateLimitOptions
. When provided, puts the rate limit information for the current operation intocontext
. Includes an example of how to return this information in a response'sextensions
.
- Update dependencies, minimum
graphql-tools
version is now8
IOptions
renamed toRateLimitOptions
, addsname
,defaultLimit
,defaultDuration
optional arguments.
Due to interface changes with graphql-tools
, the approach to setting up the directive has changed:
const { makeExecutableSchema } = require('@graphql-tools/schema');
const {
- createRateLimitDirective,
- createRateLimitTypeDef,
+ rateLimitDirective
} = require('graphql-rate-limit-directive');
+ const { rateLimitDirectiveTypeDefs, rateLimitDirectiveTransformer } = rateLimitDirective();
let schema = makeExecutableSchema({
typeDefs: [
- createRateLimitTypeDef(),
+ rateLimitDirectiveTypeDefs,
/* other defs */
],
resolvers,
- schemaDirectives: {
- rateLimit: createRateLimitDirective(),
- },
});
+ schema = rateLimitDirectiveTransformer(schema);
- Update dependencies, minimum
GraphQL.js
version is now15
- Update dependencies and examples
- Add
pointsCalculator
option to dynamically calculate how many points to consume - Update
createRateLimitTypeDef
to have non-nullablelimit
andduration
arguments - Update dependencies
- Support for async
keyGenerator
- Update dependencies
- Improve documentation
- Export
defaultKeyGenerator
anddefaultOnLimit
- Rename
throttle
toonLimit
to better describe when function is run
- Include examples of how to use package
- Added test coverage
- Replace
rateLimitTypeDefs
withcreateRateLimitTypeDef()
- Initial release