@n8n/decorators 0.29.0 → 0.30.0

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.
@@ -1,9 +1,9 @@
1
1
  export { Body, Query, Param } from './args';
2
2
  export { RestController } from './rest-controller';
3
3
  export { RootLevelController } from './root-level-controller';
4
- export { Get, Post, Put, Patch, Delete } from './route';
4
+ export { Get, Post, Put, Patch, Delete, Options } from './route';
5
5
  export { Middleware } from './middleware';
6
6
  export { ControllerRegistryMetadata } from './controller-registry-metadata';
7
7
  export { Licensed } from './licensed';
8
8
  export { GlobalScope, ProjectScope } from './scoped';
9
- export type { AccessScope, Controller, RateLimit } from './types';
9
+ export type { AccessScope, Controller, RateLimit, StaticRouterMetadata } from './types';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProjectScope = exports.GlobalScope = exports.Licensed = exports.ControllerRegistryMetadata = exports.Middleware = exports.Delete = exports.Patch = exports.Put = exports.Post = exports.Get = exports.RootLevelController = exports.RestController = exports.Param = exports.Query = exports.Body = void 0;
3
+ exports.ProjectScope = exports.GlobalScope = exports.Licensed = exports.ControllerRegistryMetadata = exports.Middleware = exports.Options = 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; } });
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "Post", { enumerable: true, get: function () { re
15
15
  Object.defineProperty(exports, "Put", { enumerable: true, get: function () { return route_1.Put; } });
16
16
  Object.defineProperty(exports, "Patch", { enumerable: true, get: function () { return route_1.Patch; } });
17
17
  Object.defineProperty(exports, "Delete", { enumerable: true, get: function () { return route_1.Delete; } });
18
+ Object.defineProperty(exports, "Options", { enumerable: true, get: function () { return route_1.Options; } });
18
19
  var middleware_1 = require("./middleware");
19
20
  Object.defineProperty(exports, "Middleware", { enumerable: true, get: function () { return middleware_1.Middleware; } });
20
21
  var controller_registry_metadata_1 = require("./controller-registry-metadata");
@@ -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,iCAAwD;AAA/C,4FAAA,GAAG,OAAA;AAAE,6FAAA,IAAI,OAAA;AAAE,4FAAA,GAAG,OAAA;AAAE,8FAAA,KAAK,OAAA;AAAE,+FAAA,MAAM,OAAA;AACtC,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"}
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,iCAAiE;AAAxD,4FAAA,GAAG,OAAA;AAAE,6FAAA,IAAI,OAAA;AAAE,4FAAA,GAAG,OAAA;AAAE,8FAAA,KAAK,OAAA;AAAE,+FAAA,MAAM,OAAA;AAAE,gGAAA,OAAO,OAAA;AAC/C,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"}
@@ -14,4 +14,5 @@ export declare const Post: (path: `/${string}`, options?: RouteOptions) => Metho
14
14
  export declare const Put: (path: `/${string}`, options?: RouteOptions) => MethodDecorator;
15
15
  export declare const Patch: (path: `/${string}`, options?: RouteOptions) => MethodDecorator;
16
16
  export declare const Delete: (path: `/${string}`, options?: RouteOptions) => MethodDecorator;
17
+ export declare const Options: (path: `/${string}`, options?: RouteOptions) => MethodDecorator;
17
18
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Delete = exports.Patch = exports.Put = exports.Post = exports.Get = void 0;
3
+ exports.Options = exports.Delete = exports.Patch = exports.Put = exports.Post = exports.Get = void 0;
4
4
  const di_1 = require("@n8n/di");
5
5
  const controller_registry_metadata_1 = require("./controller-registry-metadata");
6
6
  const RouteFactory = (method) => (path, options = {}) => (target, handlerName) => {
@@ -20,4 +20,5 @@ exports.Post = RouteFactory('post');
20
20
  exports.Put = RouteFactory('put');
21
21
  exports.Patch = RouteFactory('patch');
22
22
  exports.Delete = RouteFactory('delete');
23
+ exports.Options = RouteFactory('options');
23
24
  //# sourceMappingURL=route.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"route.js","sourceRoot":"","sources":["../../src/controller/route.ts"],"names":[],"mappings":";;;AAAA,gCAAoC;AAGpC,iFAA4E;AAiB5E,MAAM,YAAY,GACjB,CAAC,MAAc,EAAE,EAAE,CACnB,CAAC,IAAkB,EAAE,UAAwB,EAAE,EAAmB,EAAE,CACpE,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;IACvB,MAAM,aAAa,GAAG,cAAS,CAAC,GAAG,CAAC,yDAA0B,CAAC,CAAC,gBAAgB,CAC/E,MAAM,CAAC,WAAyB,EAChC,MAAM,CAAC,W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,WAAW,CAAC,CACnB,CAAC;IACF,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC;IAC9B,aAAa,CAAC,IAAI,GAAG,IAAI,CAAC;IAC1B,aAAa,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC;IACtD,aAAa,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,KAAK,CAAC;IAC7D,aAAa,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAC;IACnD,aAAa,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,IAAI,KAAK,CAAC;IAC3E,aAAa,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,KAAK,CAAC;IAC3D,aAAa,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC;IACvD,aAAa,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;AAC7C,CAAC,CAAC;AAEU,QAAA,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;AAC1B,QAAA,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;AAC5B,QAAA,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;AAC1B,QAAA,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;AAC9B,QAAA,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;AAChC,QAAA,OAAO,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import type { BooleanLicenseFeature } from '@n8n/constants';
2
2
  import type { Constructable } from '@n8n/di';
3
3
  import type { Scope } from '@n8n/permissions';
4
- import type { RequestHandler } from 'express';
5
- export type Method = 'get' | 'post' | 'put' | 'patch' | 'delete';
4
+ import type { RequestHandler, Router } from 'express';
5
+ export type Method = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'options';
6
6
  export type Arg = {
7
7
  type: 'body' | 'query';
8
8
  } | {
@@ -31,7 +31,12 @@ export interface RouteMetadata {
31
31
  licenseFeature?: BooleanLicenseFeature;
32
32
  accessScope?: AccessScope;
33
33
  args: Arg[];
34
+ router?: Router;
34
35
  }
36
+ export type StaticRouterMetadata = {
37
+ path: string;
38
+ router: Router;
39
+ } & Partial<Pick<RouteMetadata, 'skipAuth' | 'allowSkipPreviewAuth' | 'allowSkipMFA' | 'middlewares' | 'rateLimit' | 'licenseFeature' | 'accessScope'>>;
35
40
  export interface ControllerMetadata {
36
41
  basePath: `/${string}`;
37
42
  registerOnRootPath?: boolean;
@@ -14,7 +14,7 @@ function toRedactable(userLike) {
14
14
  _email: userLike.email,
15
15
  _firstName: userLike.firstName,
16
16
  _lastName: userLike.lastName,
17
- globalRole: userLike.role.slug,
17
+ globalRole: userLike.role?.slug,
18
18
  };
19
19
  }
20
20
  const Redactable = (fieldName = 'user') => (_target, _propertyName, propertyDescriptor) => {
@@ -1 +1 @@
1
- {"version":3,"file":"redactable.js","sourceRoot":"","sources":["../src/redactable.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAY/C,MAAa,eAAgB,SAAQ,8BAAe;IACnD,YAAY,SAAiB,EAAE,IAAY;QAC1C,KAAK,CACJ,mBAAmB,SAAS,2BAA2B,IAAI,CAAC,QAAQ,EAAE,2HAA2H,SAAS,aAAa,CACvN,CAAC;IACH,CAAC;CACD;AAND,0CAMC;AAED,SAAS,YAAY,CAAC,QAAkB;IACvC,OAAO;QACN,MAAM,EAAE,QAAQ,CAAC,EAAE;QACnB,MAAM,EAAE,QAAQ,CAAC,KAAK;QACtB,UAAU,EAAE,QAAQ,CAAC,SAAS;QAC9B,SAAS,EAAE,QAAQ,CAAC,QAAQ;QAC5B,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI;KAC9B,CAAC;AACH,CAAC;AAgBM,MAAM,UAAU,GACtB,CAAC,YAAuB,MAAM,EAAmB,EAAE,CACnD,CAAC,OAAO,EAAE,aAAa,EAAE,kBAAsC,EAAE,EAAE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,CAAC;AAgBM,MAAM,UAAU,GACtB,CAAC,YAAuB,MAAM,EAAmB,EAAE,CACnD,CAAC,OAAO,EAAE,aAAa,EAAE,kBAAsC,EAAE,EAAE;IAElE,MAAM,cAAc,GAAG,kBAAkB,CAAC,KAAiB,CAAC;IAI5D,kBAAkB,CAAC,KAAK,GAAG,UAAU,GAAG,IAAgB;QACvD,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,SAAS,CAAC,CAAC;QAEpE,IAAI,KAAK,KAAK,CAAC,CAAC;YAAE,MAAM,IAAI,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAExE,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;QAG1C,IAAI,QAAQ;YAAE,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;QAG9D,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC,CAAC;IAEF,OAAO,kBAAkB,CAAC;AAC3B,CAAC,CAAC;AAvBU,QAAA,UAAU,cAuBpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n8n/decorators",
3
- "version": "0.29.0",
3
+ "version": "0.30.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "src/index.ts",
6
6
  "types": "dist/index.d.ts",
@@ -16,10 +16,10 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "lodash": "4.17.21",
19
- "@n8n/di": "^0.9.0",
20
- "@n8n/permissions": "^0.41.0",
19
+ "@n8n/permissions": "^0.42.0",
21
20
  "@n8n/constants": "^0.13.0",
22
- "n8n-workflow": "^1.116.0"
21
+ "@n8n/di": "^0.9.0",
22
+ "n8n-workflow": "^1.117.0"
23
23
  },
24
24
  "license": "SEE LICENSE IN LICENSE.md",
25
25
  "homepage": "https://n8n.io",