@opra/common 1.0.0-alpha.3 → 1.0.0-alpha.30
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/browser.js +6036 -5788
- package/cjs/document/api-document.js +12 -0
- package/cjs/document/common/api-base.js +1 -0
- package/cjs/document/common/document-element.js +5 -1
- package/cjs/document/data-type/api-field.js +12 -6
- package/cjs/document/data-type/complex-type-base.js +10 -3
- package/cjs/document/data-type/complex-type.js +6 -2
- package/cjs/document/data-type/data-type.js +2 -1
- package/cjs/document/data-type/enum-type.js +5 -2
- package/cjs/document/data-type/extended-types/base64.type.js +4 -0
- package/cjs/document/data-type/extended-types/date-string.type.js +6 -2
- package/cjs/document/data-type/extended-types/date-time-string.type.js +6 -2
- package/cjs/document/data-type/extended-types/date-time.type.js +6 -2
- package/cjs/document/data-type/extended-types/date.type.js +6 -2
- package/cjs/document/data-type/extended-types/email.type.js +6 -2
- package/cjs/document/data-type/extended-types/field-path.type.js +5 -3
- package/cjs/document/data-type/extended-types/filter.type.js +19 -17
- package/cjs/document/data-type/extended-types/object-id.type.js +4 -0
- package/cjs/document/data-type/extended-types/time.type.js +6 -2
- package/cjs/document/data-type/extended-types/url.type.js +6 -2
- package/cjs/document/data-type/extended-types/uuid.type.js +4 -0
- package/cjs/document/data-type/mapped-type.js +12 -5
- package/cjs/document/data-type/mixin-type.js +5 -1
- package/cjs/document/data-type/omit-type.js +7 -2
- package/cjs/document/data-type/partial-type.js +7 -2
- package/cjs/document/data-type/pick-type.js +1 -2
- package/cjs/document/data-type/primitive-types/bigint.type.js +4 -0
- package/cjs/document/data-type/primitive-types/boolean.type.js +4 -0
- package/cjs/document/data-type/primitive-types/integer.type.js +4 -0
- package/cjs/document/data-type/primitive-types/null.type.js +4 -0
- package/cjs/document/data-type/primitive-types/number.type.js +4 -0
- package/cjs/document/data-type/primitive-types/object.type.js +0 -3
- package/cjs/document/data-type/primitive-types/string.type.js +4 -0
- package/cjs/document/data-type/required-type.js +1 -2
- package/cjs/document/data-type/simple-type.js +17 -16
- package/cjs/document/data-type/utils/create-mapped-class.js +3 -3
- package/cjs/document/data-type/utils/get-is-inherited-predicate-fn.js +1 -2
- package/cjs/document/decorators/api-field-decorator.js +4 -6
- package/cjs/document/decorators/complex-type.decorator.js +1 -2
- package/cjs/document/decorators/http-controller.decorator.js +26 -2
- package/cjs/document/decorators/http-operation-entity.decorator.js +123 -93
- package/cjs/document/decorators/http-operation.decorator.js +12 -6
- package/cjs/document/decorators/simple-type.decorator.js +2 -3
- package/cjs/document/factory/api-document.factory.js +14 -11
- package/cjs/document/factory/data-type.factory.js +97 -56
- package/cjs/document/factory/http-api.factory.js +3 -1
- package/cjs/document/http/http-api.js +2 -2
- package/cjs/document/http/http-controller.js +26 -14
- package/cjs/document/http/http-media-type.js +21 -4
- package/cjs/document/http/http-operation-response.js +2 -1
- package/cjs/document/http/http-operation.js +28 -4
- package/cjs/document/http/http-parameter.js +4 -0
- package/cjs/document/http/http-status-range.js +6 -4
- package/cjs/document/index.js +5 -5
- package/cjs/document/utils/parse-regexp.util.js +1 -2
- package/cjs/document/utils/string-compare.util.js +1 -2
- package/cjs/exception/index.js +5 -5
- package/cjs/exception/opra-exception.js +1 -0
- package/cjs/filter/antlr/OpraFilterParser.js +28 -82
- package/cjs/filter/ast/index.js +1 -1
- package/cjs/filter/build.js +22 -25
- package/cjs/filter/filter-rules.js +4 -2
- package/cjs/filter/opra-filter.ns.js +2 -2
- package/cjs/filter/parse.js +2 -5
- package/cjs/filter/utils.js +2 -3
- package/cjs/helpers/function-utils.js +1 -2
- package/cjs/helpers/get-stack-filename.js +2 -3
- package/cjs/helpers/mixin-utils.js +4 -4
- package/cjs/helpers/monkey-patches.js +4 -2
- package/cjs/helpers/object-utils.js +5 -6
- package/cjs/helpers/parse-fields-projection.js +4 -6
- package/cjs/helpers/responsive-map.js +5 -4
- package/cjs/helpers/type-guards.js +10 -11
- package/cjs/i18n/i18n.js +4 -3
- package/cjs/i18n/index.js +1 -1
- package/cjs/i18n/string-utils.js +2 -3
- package/cjs/i18n/translate.js +1 -2
- package/cjs/index.js +1 -1
- package/cjs/schema/type-guards.js +7 -8
- package/esm/document/api-document.js +11 -0
- package/esm/document/common/api-base.js +1 -0
- package/esm/document/common/document-element.js +4 -1
- package/esm/document/data-type/api-field.js +12 -6
- package/esm/document/data-type/complex-type-base.js +10 -3
- package/esm/document/data-type/complex-type.js +6 -2
- package/esm/document/data-type/data-type.js +2 -1
- package/esm/document/data-type/enum-type.js +5 -2
- package/esm/document/data-type/extended-types/base64.type.js +4 -0
- package/esm/document/data-type/extended-types/date-string.type.js +6 -2
- package/esm/document/data-type/extended-types/date-time-string.type.js +6 -2
- package/esm/document/data-type/extended-types/date-time.type.js +6 -2
- package/esm/document/data-type/extended-types/date.type.js +6 -2
- package/esm/document/data-type/extended-types/email.type.js +6 -2
- package/esm/document/data-type/extended-types/field-path.type.js +5 -3
- package/esm/document/data-type/extended-types/filter.type.js +19 -17
- package/esm/document/data-type/extended-types/object-id.type.js +4 -0
- package/esm/document/data-type/extended-types/time.type.js +6 -2
- package/esm/document/data-type/extended-types/url.type.js +6 -2
- package/esm/document/data-type/extended-types/uuid.type.js +4 -0
- package/esm/document/data-type/mapped-type.js +12 -5
- package/esm/document/data-type/mixin-type.js +5 -1
- package/esm/document/data-type/omit-type.js +6 -0
- package/esm/document/data-type/partial-type.js +6 -0
- package/esm/document/data-type/primitive-types/bigint.type.js +4 -0
- package/esm/document/data-type/primitive-types/boolean.type.js +4 -0
- package/esm/document/data-type/primitive-types/integer.type.js +4 -0
- package/esm/document/data-type/primitive-types/null.type.js +4 -0
- package/esm/document/data-type/primitive-types/number.type.js +4 -0
- package/esm/document/data-type/primitive-types/object.type.js +0 -3
- package/esm/document/data-type/primitive-types/string.type.js +4 -0
- package/esm/document/data-type/simple-type.js +17 -16
- package/esm/document/data-type/utils/create-mapped-class.js +2 -1
- package/esm/document/decorators/api-field-decorator.js +1 -2
- package/esm/document/decorators/http-controller.decorator.js +25 -0
- package/esm/document/decorators/http-operation-entity.decorator.js +80 -50
- package/esm/document/decorators/http-operation.decorator.js +11 -4
- package/esm/document/factory/api-document.factory.js +14 -10
- package/esm/document/factory/data-type.factory.js +97 -56
- package/esm/document/factory/http-api.factory.js +3 -1
- package/esm/document/http/http-api.js +2 -2
- package/esm/document/http/http-controller.js +25 -14
- package/esm/document/http/http-media-type.js +20 -4
- package/esm/document/http/http-operation-response.js +2 -1
- package/esm/document/http/http-operation.js +27 -4
- package/esm/document/http/http-parameter.js +4 -0
- package/esm/document/http/http-status-range.js +6 -4
- package/esm/document/index.js +5 -5
- package/esm/exception/index.js +5 -5
- package/esm/exception/opra-exception.js +1 -0
- package/esm/filter/antlr/OpraFilterParser.js +28 -82
- package/esm/filter/ast/index.js +1 -1
- package/esm/filter/build.js +1 -3
- package/esm/filter/filter-rules.js +4 -2
- package/esm/filter/opra-filter.ns.js +2 -2
- package/esm/filter/parse.js +1 -3
- package/esm/helpers/mixin-utils.js +2 -1
- package/esm/helpers/monkey-patches.js +4 -2
- package/esm/helpers/object-utils.js +2 -2
- package/esm/helpers/parse-fields-projection.js +1 -3
- package/esm/helpers/responsive-map.js +5 -4
- package/esm/i18n/i18n.js +4 -3
- package/esm/i18n/index.js +1 -1
- package/esm/index.js +1 -1
- package/package.json +11 -8
- package/types/document/api-document.d.ts +1 -0
- package/types/document/common/document-element.d.ts +1 -0
- package/types/document/data-type/api-field.d.ts +12 -0
- package/types/document/data-type/complex-type-base.d.ts +1 -1
- package/types/document/data-type/complex-type.d.ts +1 -1
- package/types/document/data-type/data-type.d.ts +5 -2
- package/types/document/data-type/enum-type.d.ts +2 -2
- package/types/document/data-type/mapped-type.d.ts +3 -3
- package/types/document/data-type/mixin-type.d.ts +2 -2
- package/types/document/data-type/omit-type.d.ts +0 -6
- package/types/document/data-type/partial-type.d.ts +0 -6
- package/types/document/data-type/pick-type.d.ts +2 -2
- package/types/document/data-type/required-type.d.ts +7 -7
- package/types/document/data-type/simple-type.d.ts +4 -2
- package/types/document/decorators/http-controller.decorator.d.ts +1 -0
- package/types/document/decorators/http-operation-entity.decorator.d.ts +1 -0
- package/types/document/factory/data-type.factory.d.ts +5 -0
- package/types/document/http/http-controller.d.ts +1 -0
- package/types/document/http/http-media-type.d.ts +2 -1
- package/types/document/http/http-operation.d.ts +5 -3
- package/types/document/http/http-parameter.d.ts +3 -2
- package/types/document/http/http-status-range.d.ts +2 -1
- package/types/document/index.d.ts +5 -5
- package/types/exception/index.d.ts +5 -5
- package/types/filter/ast/index.d.ts +1 -1
- package/types/filter/opra-filter.ns.d.ts +2 -2
- package/types/helpers/type-guards.d.ts +0 -2
- package/types/i18n/i18n.d.ts +21 -19
- package/types/index.d.ts +1 -1
- package/types/schema/data-type/data-type.interface.d.ts +1 -1
- package/types/schema/data-type/mapped-type.interface.d.ts +2 -2
- package/types/schema/data-type/simple-type.interface.d.ts +4 -0
- package/types/schema/data-type-container.interface.d.ts +1 -1
- package/types/schema/document.interface.d.ts +1 -1
- package/types/schema/http/http-controller.interface.d.ts +2 -2
- package/types/schema/http/http-media-type.interface.d.ts +1 -1
- package/types/schema/http/http-operation-response.interface.d.ts +2 -2
- package/types/schema/http/http-operation.interface.d.ts +8 -4
- package/types/schema/http/http-parameter.interface.d.ts +5 -1
|
@@ -38,6 +38,10 @@ tslib_1.__decorate([
|
|
|
38
38
|
exports.NumberType = NumberType = tslib_1.__decorate([
|
|
39
39
|
(0, simple_type_js_1.SimpleType)({
|
|
40
40
|
description: 'Both Integer as well as Floating-Point numbers',
|
|
41
|
+
nameMappings: {
|
|
42
|
+
js: 'number',
|
|
43
|
+
json: 'number',
|
|
44
|
+
},
|
|
41
45
|
}),
|
|
42
46
|
tslib_1.__metadata("design:paramtypes", [Object])
|
|
43
47
|
], NumberType);
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ObjectType = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const constants_js_1 = require("../../constants.js");
|
|
6
5
|
const complex_type_js_1 = require("../complex-type.js");
|
|
7
6
|
let ObjectType = class ObjectType {
|
|
8
7
|
constructor(properties) {
|
|
@@ -19,5 +18,3 @@ exports.ObjectType = ObjectType = tslib_1.__decorate([
|
|
|
19
18
|
}),
|
|
20
19
|
tslib_1.__metadata("design:paramtypes", [Object])
|
|
21
20
|
], ObjectType);
|
|
22
|
-
const metadata = Reflect.getMetadata(constants_js_1.DATATYPE_METADATA, ObjectType);
|
|
23
|
-
metadata.ctor = Object;
|
|
@@ -58,6 +58,10 @@ tslib_1.__decorate([
|
|
|
58
58
|
exports.StringType = StringType = tslib_1.__decorate([
|
|
59
59
|
(0, simple_type_js_1.SimpleType)({
|
|
60
60
|
description: 'A sequence of characters',
|
|
61
|
+
nameMappings: {
|
|
62
|
+
js: 'string',
|
|
63
|
+
json: 'string',
|
|
64
|
+
},
|
|
61
65
|
}),
|
|
62
66
|
tslib_1.__metadata("design:paramtypes", [Object])
|
|
63
67
|
], StringType);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RequiredType =
|
|
3
|
+
exports.RequiredType = RequiredType;
|
|
4
4
|
const create_mapped_class_js_1 = require("./utils/create-mapped-class.js");
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
@@ -10,4 +10,3 @@ function RequiredType(base, ...args) {
|
|
|
10
10
|
const options = Array.isArray(args[0]) ? args[1] : args[0];
|
|
11
11
|
return (0, create_mapped_class_js_1.createMappedClass)(base, { required: keys }, options);
|
|
12
12
|
}
|
|
13
|
-
exports.RequiredType = RequiredType;
|
|
@@ -23,11 +23,14 @@ exports.SimpleType = function (...args) {
|
|
|
23
23
|
_this.kind = index_js_2.OpraSchema.SimpleType.Kind;
|
|
24
24
|
if (initArgs.base) {
|
|
25
25
|
// noinspection SuspiciousTypeOfGuard
|
|
26
|
-
if (!(initArgs.base instanceof exports.SimpleType))
|
|
26
|
+
if (!(initArgs.base instanceof exports.SimpleType)) {
|
|
27
27
|
throw new TypeError(`"${initArgs.base.kind}" can't be set as base for a "${this.kind}"`);
|
|
28
|
+
}
|
|
28
29
|
_this.base = initArgs.base;
|
|
29
30
|
}
|
|
30
31
|
_this.properties = initArgs.properties;
|
|
32
|
+
_this.ownNameMappings = { ...initArgs.nameMappings };
|
|
33
|
+
_this.nameMappings = { ..._this.base?.nameMappings, ...initArgs.nameMappings };
|
|
31
34
|
_this.ownAttributes = (0, index_js_1.cloneObject)(initArgs.attributes || {});
|
|
32
35
|
_this.attributes = _this.base ? (0, index_js_1.cloneObject)(_this.base.attributes) : {};
|
|
33
36
|
if (_this.ownAttributes) {
|
|
@@ -46,6 +49,8 @@ exports.SimpleType = function (...args) {
|
|
|
46
49
|
*/
|
|
47
50
|
class SimpleTypeClass extends data_type_js_1.DataType {
|
|
48
51
|
extendsFrom(baseType) {
|
|
52
|
+
if (!(baseType instanceof data_type_js_1.DataType))
|
|
53
|
+
baseType = this.node.getDataType(baseType);
|
|
49
54
|
if (!(baseType instanceof exports.SimpleType))
|
|
50
55
|
return false;
|
|
51
56
|
if (baseType === this)
|
|
@@ -66,15 +71,13 @@ class SimpleTypeClass extends data_type_js_1.DataType {
|
|
|
66
71
|
}
|
|
67
72
|
return valgen_1.isAny;
|
|
68
73
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
t = this.base;
|
|
75
|
-
}
|
|
76
|
-
return valgen_1.isAny;
|
|
74
|
+
let t = this;
|
|
75
|
+
while (t) {
|
|
76
|
+
if (t._generateEncoder)
|
|
77
|
+
return t._generateEncoder(prop, options?.documentElement || this.owner);
|
|
78
|
+
t = this.base;
|
|
77
79
|
}
|
|
80
|
+
return valgen_1.isAny;
|
|
78
81
|
}
|
|
79
82
|
toJSON() {
|
|
80
83
|
const attributes = (0, index_js_1.omitUndefined)(this.ownAttributes);
|
|
@@ -83,19 +86,17 @@ class SimpleTypeClass extends data_type_js_1.DataType {
|
|
|
83
86
|
properties = this.properties.toJSON(this.properties, this.owner);
|
|
84
87
|
}
|
|
85
88
|
else
|
|
86
|
-
properties = this.properties
|
|
87
|
-
properties = Object.keys(this.attributes).reduce((o, k) => {
|
|
88
|
-
if (properties[k] !== undefined)
|
|
89
|
-
o[k] = properties[k];
|
|
90
|
-
return o;
|
|
91
|
-
}, {});
|
|
89
|
+
properties = this.properties ? (0, index_js_1.cloneObject)(this.properties) : {};
|
|
92
90
|
const baseName = this.base ? this.node.getDataTypeNameWithNs(this.base) : undefined;
|
|
93
|
-
|
|
91
|
+
const out = (0, index_js_1.omitUndefined)({
|
|
94
92
|
...data_type_js_1.DataType.prototype.toJSON.apply(this),
|
|
95
93
|
base: this.base ? (baseName ? baseName : this.base.toJSON()) : undefined,
|
|
96
94
|
attributes: attributes && Object.keys(attributes).length ? attributes : undefined,
|
|
97
95
|
properties: Object.keys(properties).length ? properties : undefined,
|
|
98
96
|
});
|
|
97
|
+
if (Object.keys(this.ownNameMappings).length)
|
|
98
|
+
out.nameMappings = { ...this.ownNameMappings };
|
|
99
|
+
return out;
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
exports.SimpleType.prototype = SimpleTypeClass.prototype;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createMappedClass =
|
|
3
|
+
exports.createMappedClass = createMappedClass;
|
|
4
4
|
const index_js_1 = require("../../../helpers/index.js");
|
|
5
5
|
const index_js_2 = require("../../../schema/index.js");
|
|
6
6
|
const constants_js_1 = require("../../constants.js");
|
|
@@ -26,8 +26,9 @@ function createMappedClass(source, config, options) {
|
|
|
26
26
|
throw new TypeError(`Class "${source}" doesn't have datatype metadata information`);
|
|
27
27
|
if (!(m.kind === index_js_2.OpraSchema.ComplexType.Kind ||
|
|
28
28
|
m.kind === index_js_2.OpraSchema.MappedType.Kind ||
|
|
29
|
-
m.kind === index_js_2.OpraSchema.MixinType.Kind))
|
|
29
|
+
m.kind === index_js_2.OpraSchema.MixinType.Kind)) {
|
|
30
30
|
throw new TypeError(`Class "${source}" is not a ${index_js_2.OpraSchema.ComplexType.Kind}`);
|
|
31
|
+
}
|
|
31
32
|
}
|
|
32
33
|
const metadata = {
|
|
33
34
|
...options,
|
|
@@ -51,4 +52,3 @@ function createMappedClass(source, config, options) {
|
|
|
51
52
|
}
|
|
52
53
|
return MappedClass;
|
|
53
54
|
}
|
|
54
|
-
exports.createMappedClass = createMappedClass;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getIsInheritedPredicateFn =
|
|
3
|
+
exports.getIsInheritedPredicateFn = getIsInheritedPredicateFn;
|
|
4
4
|
function getIsInheritedPredicateFn(pick, omit) {
|
|
5
5
|
const pickKeys = pick?.map(x => String(x).toLowerCase());
|
|
6
6
|
const omitKeys = omit?.map(x => String(x).toLowerCase());
|
|
@@ -12,4 +12,3 @@ function getIsInheritedPredicateFn(pick, omit) {
|
|
|
12
12
|
return true;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
exports.getIsInheritedPredicateFn = getIsInheritedPredicateFn;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApiFieldDecorator =
|
|
4
|
-
const index_js_1 = require("../../
|
|
5
|
-
const index_js_2 = require("../../schema/index.js");
|
|
3
|
+
exports.ApiFieldDecorator = ApiFieldDecorator;
|
|
4
|
+
const index_js_1 = require("../../schema/index.js");
|
|
6
5
|
const constants_js_1 = require("../constants.js");
|
|
7
6
|
function ApiFieldDecorator(options) {
|
|
8
7
|
return function (target, propertyKey) {
|
|
9
8
|
if (typeof propertyKey !== 'string')
|
|
10
9
|
throw new TypeError(`Symbol properties can't be used as a field`);
|
|
11
10
|
const metadata = Reflect.getOwnMetadata(constants_js_1.DATATYPE_METADATA, target.constructor) || {};
|
|
12
|
-
metadata.kind =
|
|
11
|
+
metadata.kind = index_js_1.OpraSchema.ComplexType.Kind;
|
|
13
12
|
metadata.fields = metadata.fields || {};
|
|
14
13
|
const designType = Reflect.getMetadata('design:type', target, propertyKey);
|
|
15
14
|
const elemMeta = (metadata.fields[propertyKey] = {
|
|
@@ -20,7 +19,6 @@ function ApiFieldDecorator(options) {
|
|
|
20
19
|
}
|
|
21
20
|
else
|
|
22
21
|
elemMeta.type = elemMeta.type || designType;
|
|
23
|
-
Reflect.defineMetadata(constants_js_1.DATATYPE_METADATA,
|
|
22
|
+
Reflect.defineMetadata(constants_js_1.DATATYPE_METADATA, metadata, target.constructor);
|
|
24
23
|
};
|
|
25
24
|
}
|
|
26
|
-
exports.ApiFieldDecorator = ApiFieldDecorator;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ComplexTypeDecorator =
|
|
3
|
+
exports.ComplexTypeDecorator = ComplexTypeDecorator;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const lodash_omit_1 = tslib_1.__importDefault(require("lodash.omit"));
|
|
6
6
|
const index_js_1 = require("../../schema/index.js");
|
|
@@ -30,4 +30,3 @@ function ComplexTypeDecorator(options) {
|
|
|
30
30
|
Object.assign(metadata, (0, lodash_omit_1.default)(options, ['kind', 'name', 'base', 'fields']));
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
exports.ComplexTypeDecorator = ComplexTypeDecorator;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HttpControllerDecoratorFactory =
|
|
3
|
+
exports.HttpControllerDecoratorFactory = HttpControllerDecoratorFactory;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const lodash_omit_1 = tslib_1.__importDefault(require("lodash.omit"));
|
|
6
6
|
const putil_merge_1 = tslib_1.__importDefault(require("putil-merge"));
|
|
@@ -102,6 +102,31 @@ function HttpControllerDecoratorFactory(options) {
|
|
|
102
102
|
});
|
|
103
103
|
return decorator;
|
|
104
104
|
};
|
|
105
|
+
/**
|
|
106
|
+
*
|
|
107
|
+
*/
|
|
108
|
+
decorator.KeyParam = (name, arg1) => {
|
|
109
|
+
decoratorChain.push((meta) => {
|
|
110
|
+
if (!meta.path?.includes(':' + name))
|
|
111
|
+
meta.path = (meta.path || '') + '@:' + name;
|
|
112
|
+
const paramMeta = typeof arg1 === 'string' || typeof arg1 === 'function'
|
|
113
|
+
? {
|
|
114
|
+
name,
|
|
115
|
+
location: 'path',
|
|
116
|
+
type: arg1,
|
|
117
|
+
keyParam: true,
|
|
118
|
+
}
|
|
119
|
+
: {
|
|
120
|
+
...arg1,
|
|
121
|
+
name,
|
|
122
|
+
location: 'path',
|
|
123
|
+
keyParam: true,
|
|
124
|
+
};
|
|
125
|
+
meta.parameters = meta.parameters || [];
|
|
126
|
+
meta.parameters.push(paramMeta);
|
|
127
|
+
});
|
|
128
|
+
return decorator;
|
|
129
|
+
};
|
|
105
130
|
/**
|
|
106
131
|
*
|
|
107
132
|
*/
|
|
@@ -114,4 +139,3 @@ function HttpControllerDecoratorFactory(options) {
|
|
|
114
139
|
};
|
|
115
140
|
return decorator;
|
|
116
141
|
}
|
|
117
|
-
exports.HttpControllerDecoratorFactory = HttpControllerDecoratorFactory;
|