@n8n/decorators 1.27.0 → 1.27.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.
@@ -7,4 +7,4 @@ export { ControllerRegistryMetadata } from './controller-registry-metadata';
7
7
  export { Licensed } from './licensed';
8
8
  export { GlobalScope, ProjectScope } from './scoped';
9
9
  export type { AccessScope, Controller, CorsOptions, Method, StaticRouterMetadata, } from './types';
10
- export { type RateLimiterLimits, type BodyKeyedRateLimiterConfig, type UserKeyedRateLimiterConfig, type KeyedRateLimiterConfig, createBodyKeyedRateLimiter, createUserKeyedRateLimiter, } from './rate-limit';
10
+ export { type RateLimiterLimits, type BodyKeyedRateLimiterConfig, type UserKeyedRateLimiterConfig, type KeyedRateLimiterConfig, createBodyKeyedRateLimiter, createUserKeyedRateLimiter, createIpRateLimit, } from './rate-limit';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createUserKeyedRateLimiter = exports.createBodyKeyedRateLimiter = exports.ProjectScope = exports.GlobalScope = exports.Licensed = exports.ControllerRegistryMetadata = exports.Middleware = exports.Options = exports.Head = exports.Delete = exports.Patch = exports.Put = exports.Post = exports.Get = exports.RootLevelController = exports.RestController = exports.Param = exports.Query = exports.Body = void 0;
3
+ exports.createIpRateLimit = exports.createUserKeyedRateLimiter = exports.createBodyKeyedRateLimiter = exports.ProjectScope = exports.GlobalScope = exports.Licensed = exports.ControllerRegistryMetadata = exports.Middleware = exports.Options = exports.Head = exports.Delete = exports.Patch = exports.Put = exports.Post = exports.Get = exports.RootLevelController = exports.RestController = exports.Param = exports.Query = exports.Body = void 0;
4
4
  var args_1 = require("./args");
5
5
  Object.defineProperty(exports, "Body", { enumerable: true, get: function () { return args_1.Body; } });
6
6
  Object.defineProperty(exports, "Query", { enumerable: true, get: function () { return args_1.Query; } });
@@ -29,4 +29,5 @@ Object.defineProperty(exports, "ProjectScope", { enumerable: true, get: function
29
29
  var rate_limit_1 = require("./rate-limit");
30
30
  Object.defineProperty(exports, "createBodyKeyedRateLimiter", { enumerable: true, get: function () { return rate_limit_1.createBodyKeyedRateLimiter; } });
31
31
  Object.defineProperty(exports, "createUserKeyedRateLimiter", { enumerable: true, get: function () { return rate_limit_1.createUserKeyedRateLimiter; } });
32
+ Object.defineProperty(exports, "createIpRateLimit", { enumerable: true, get: function () { return rate_limit_1.createIpRateLimit; } });
32
33
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/controller/index.ts"],"names":[],"mappings":";;;AAAA,+BAA4C;AAAnC,4FAAA,IAAI,OAAA;AAAE,6FAAA,KAAK,OAAA;AAAE,6FAAA,KAAK,OAAA;AAC3B,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,iEAA8D;AAArD,4HAAA,mBAAmB,OAAA;AAC5B,iCAAuE;AAA9D,4FAAA,GAAG,OAAA;AAAE,6FAAA,IAAI,OAAA;AAAE,4FAAA,GAAG,OAAA;AAAE,8FAAA,KAAK,OAAA;AAAE,+FAAA,MAAM,OAAA;AAAE,6FAAA,IAAI,OAAA;AAAE,gGAAA,OAAO,OAAA;AACrD,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,+EAA4E;AAAnE,0IAAA,0BAA0B,OAAA;AACnC,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,mCAAqD;AAA5C,qGAAA,WAAW,OAAA;AAAE,sGAAA,YAAY,OAAA;AAQlC,2CAOsB;AAFrB,wHAAA,0BAA0B,OAAA;AAC1B,wHAAA,0BAA0B,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/controller/index.ts"],"names":[],"mappings":";;;AAAA,+BAA4C;AAAnC,4FAAA,IAAI,OAAA;AAAE,6FAAA,KAAK,OAAA;AAAE,6FAAA,KAAK,OAAA;AAC3B,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,iEAA8D;AAArD,4HAAA,mBAAmB,OAAA;AAC5B,iCAAuE;AAA9D,4FAAA,GAAG,OAAA;AAAE,6FAAA,IAAI,OAAA;AAAE,4FAAA,GAAG,OAAA;AAAE,8FAAA,KAAK,OAAA;AAAE,+FAAA,MAAM,OAAA;AAAE,6FAAA,IAAI,OAAA;AAAE,gGAAA,OAAO,OAAA;AACrD,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,+EAA4E;AAAnE,0IAAA,0BAA0B,OAAA;AACnC,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,mCAAqD;AAA5C,qGAAA,WAAW,OAAA;AAAE,sGAAA,YAAY,OAAA;AAQlC,2CAQsB;AAHrB,wHAAA,0BAA0B,OAAA;AAC1B,wHAAA,0BAA0B,OAAA;AAC1B,+GAAA,iBAAiB,OAAA"}
@@ -10,6 +10,7 @@ export interface UserKeyedRateLimiterConfig extends RateLimiterLimits {
10
10
  source: 'user';
11
11
  }
12
12
  export type KeyedRateLimiterConfig = BodyKeyedRateLimiterConfig | UserKeyedRateLimiterConfig;
13
+ export declare const createIpRateLimit: (limit: number, windowMs?: number) => false | RateLimiterLimits;
13
14
  export declare const createBodyKeyedRateLimiter: <T extends object>({ limit, windowMs, field, }: RateLimiterLimits & {
14
15
  field: keyof T & string;
15
16
  }) => BodyKeyedRateLimiterConfig;
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createUserKeyedRateLimiter = exports.createBodyKeyedRateLimiter = void 0;
3
+ exports.createUserKeyedRateLimiter = exports.createBodyKeyedRateLimiter = exports.createIpRateLimit = void 0;
4
+ const createIpRateLimit = (limit, windowMs) => {
5
+ if (limit <= 0)
6
+ return false;
7
+ return windowMs === undefined ? { limit } : { limit, windowMs };
8
+ };
9
+ exports.createIpRateLimit = createIpRateLimit;
4
10
  const createBodyKeyedRateLimiter = ({ limit, windowMs, field, }) => ({
5
11
  source: 'body',
6
12
  limit,
@@ -1 +1 @@
1
- {"version":3,"file":"rate-limit.js","sourceRoot":"","sources":["../../src/controller/rate-limit.ts"],"names":[],"mappings":";;;AA6CO,MAAM,0BAA0B,GAAG,CAAmB,EAC5D,KAAK,EACL,QAAQ,EACR,KAAK,GAGL,EAA8B,EAAE,CAAC,CAAC;IAClC,MAAM,EAAE,MAAM;IACd,KAAK;IACL,QAAQ;IACR,KAAK;CACL,CAAC,CAAC;AAXU,QAAA,0BAA0B,8BAWpC;AAYI,MAAM,0BAA0B,GAAG,CAAC,EAC1C,KAAK,EACL,QAAQ,GACW,EAA8B,EAAE,CAAC,CAAC;IACrD,MAAM,EAAE,MAAM;IACd,KAAK;IACL,QAAQ;CACR,CAAC,CAAC;AAPU,QAAA,0BAA0B,8BAOpC"}
1
+ {"version":3,"file":"rate-limit.js","sourceRoot":"","sources":["../../src/controller/rate-limit.ts"],"names":[],"mappings":";;;AA4CO,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAE,QAAiB,EAA6B,EAAE;IAChG,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC7B,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACjE,CAAC,CAAC;AAHW,QAAA,iBAAiB,qBAG5B;AAcK,MAAM,0BAA0B,GAAG,CAAmB,EAC5D,KAAK,EACL,QAAQ,EACR,KAAK,GAGL,EAA8B,EAAE,CAAC,CAAC;IAClC,MAAM,EAAE,MAAM;IACd,KAAK;IACL,QAAQ;IACR,KAAK;CACL,CAAC,CAAC;AAXU,QAAA,0BAA0B,8BAWpC;AAYI,MAAM,0BAA0B,GAAG,CAAC,EAC1C,KAAK,EACL,QAAQ,GACW,EAA8B,EAAE,CAAC,CAAC;IACrD,MAAM,EAAE,MAAM;IACd,KAAK;IACL,QAAQ;CACR,CAAC,CAAC;AAPU,QAAA,0BAA0B,8BAOpC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n8n/decorators",
3
- "version": "1.27.0",
3
+ "version": "1.27.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "src/index.ts",
6
6
  "types": "dist/index.d.ts",
@@ -19,10 +19,10 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "lodash": "4.18.1",
22
- "@n8n/constants": "0.27.0",
23
- "@n8n/di": "0.14.0",
24
22
  "@n8n/api-types": "1.27.0",
23
+ "@n8n/di": "0.14.0",
25
24
  "@n8n/permissions": "0.64.0",
25
+ "@n8n/constants": "0.27.0",
26
26
  "n8n-workflow": "2.27.0"
27
27
  },
28
28
  "license": "SEE LICENSE IN LICENSE.md",