@envelop/rate-limiter 8.1.0 → 8.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.js CHANGED
@@ -62,8 +62,9 @@ const useRateLimiter = (options) => {
62
62
  if (rateLimitDirective && fieldConfig) {
63
63
  throw new Error(`Config error: field '${type.name}.${field.name}' has both a configuration and a directive`);
64
64
  }
65
- const rateLimitConfig = { ...(rateLimitDirective ?? fieldConfig) };
66
- if (rateLimitConfig) {
65
+ const baseConfig = rateLimitDirective ?? fieldConfig;
66
+ if (baseConfig) {
67
+ const rateLimitConfig = { ...baseConfig };
67
68
  rateLimitConfig.max = rateLimitConfig.max && Number(rateLimitConfig.max);
68
69
  if (fieldConfig?.identifyFn) {
69
70
  rateLimitConfig.identityArgs = [
package/esm/index.js CHANGED
@@ -54,8 +54,9 @@ export const useRateLimiter = (options) => {
54
54
  if (rateLimitDirective && fieldConfig) {
55
55
  throw new Error(`Config error: field '${type.name}.${field.name}' has both a configuration and a directive`);
56
56
  }
57
- const rateLimitConfig = { ...(rateLimitDirective ?? fieldConfig) };
58
- if (rateLimitConfig) {
57
+ const baseConfig = rateLimitDirective ?? fieldConfig;
58
+ if (baseConfig) {
59
+ const rateLimitConfig = { ...baseConfig };
59
60
  rateLimitConfig.max = rateLimitConfig.max && Number(rateLimitConfig.max);
60
61
  if (fieldConfig?.identifyFn) {
61
62
  rateLimitConfig.identityArgs = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envelop/rate-limiter",
3
- "version": "8.1.0",
3
+ "version": "8.1.1",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0",