@n8n/decorators 1.39.4 → 1.39.6
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,3 +1,7 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface BodyOptions {
|
|
2
|
+
required?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function Body(target: object, propertyKey: string | symbol | undefined, parameterIndex: number): void;
|
|
5
|
+
export declare function Body(options?: BodyOptions): ParameterDecorator;
|
|
2
6
|
export declare const Query: ParameterDecorator;
|
|
3
7
|
export declare const Param: (key: string) => ParameterDecorator;
|
package/dist/controller/args.js
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Param = exports.Query =
|
|
3
|
+
exports.Param = exports.Query = void 0;
|
|
4
|
+
exports.Body = Body;
|
|
4
5
|
const di_1 = require("@n8n/di");
|
|
5
6
|
const controller_registry_metadata_1 = require("./controller-registry-metadata");
|
|
6
7
|
const ArgDecorator = (arg) => (target, handlerName, parameterIndex) => {
|
|
7
8
|
const routeMetadata = di_1.Container.get(controller_registry_metadata_1.ControllerRegistryMetadata).getRouteMetadata(target.constructor, String(handlerName));
|
|
8
9
|
routeMetadata.args[parameterIndex] = arg;
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
+
function Body(targetOrOptions, propertyKey, parameterIndex) {
|
|
12
|
+
if (parameterIndex !== undefined) {
|
|
13
|
+
return ArgDecorator({ type: 'body' })(targetOrOptions, propertyKey, parameterIndex);
|
|
14
|
+
}
|
|
15
|
+
const options = targetOrOptions;
|
|
16
|
+
return ArgDecorator({
|
|
17
|
+
type: 'body',
|
|
18
|
+
...(options?.required !== undefined && { required: options.required }),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
11
21
|
exports.Query = ArgDecorator({ type: 'query' });
|
|
12
22
|
const Param = (key) => ArgDecorator({ type: 'param', key });
|
|
13
23
|
exports.Param = Param;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/controller/args.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/controller/args.ts"],"names":[],"mappings":";;;;AAAA,gCAAoC;AAEpC,iFAA4E;AAG5E,MAAM,YAAY,GACjB,CAAC,GAAQ,EAAsB,EAAE,CACjC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,EAAE;IACvC,MAAM,aAAa,GAAG,cAAS,CAAC,GAAG,CAAC,yDAA0B,CAAC,CAAC,gBAAgB,CAC/E,MAAM,CAAC,WAAyB,EAChC,MAAM,CAAC,WAAW,CAAC,CACnB,CAAC;IACF,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC;AAC1C,CAAC,CAAC;AAaH,cACC,eAAsC,EACtC,WAA6B,EAC7B,cAAuB;IAGvB,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QAClC,OAAO,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CACpC,eAAyB,EACzB,WAA8B,EAC9B,cAAc,CACd,CAAC;IACH,CAAC;IAGD,MAAM,OAAO,GAAG,eAA0C,CAAC;IAC3D,OAAO,YAAY,CAAC;QACnB,IAAI,EAAE,MAAM;QACZ,GAAG,CAAC,OAAO,EAAE,QAAQ,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;KACtE,CAAC,CAAC;AACJ,CAAC;AAGY,QAAA,KAAK,GAAG,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AAG9C,MAAM,KAAK,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;AAA9D,QAAA,KAAK,GAAL,KAAK,CAAyD"}
|
|
@@ -18,7 +18,10 @@ export interface ErrorResponse {
|
|
|
18
18
|
}
|
|
19
19
|
export type Method = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'head' | 'options';
|
|
20
20
|
export type Arg = {
|
|
21
|
-
type: 'body'
|
|
21
|
+
type: 'body';
|
|
22
|
+
required?: boolean;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'query';
|
|
22
25
|
} | {
|
|
23
26
|
type: 'param';
|
|
24
27
|
key: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n8n/decorators",
|
|
3
|
-
"version": "1.39.
|
|
3
|
+
"version": "1.39.6",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "src/index.ts",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"zod": "3.25.76"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@n8n/api-types": "1.39.
|
|
34
|
+
"@n8n/api-types": "1.39.6",
|
|
35
35
|
"@n8n/constants": "0.38.0",
|
|
36
36
|
"@n8n/di": "0.16.0",
|
|
37
37
|
"@n8n/permissions": "0.76.0",
|
|
38
38
|
"lodash": "4.18.1",
|
|
39
|
-
"n8n-workflow": "2.39.
|
|
39
|
+
"n8n-workflow": "2.39.3"
|
|
40
40
|
},
|
|
41
41
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
42
42
|
"homepage": "https://n8n.io",
|