@opra/common 1.0.0-alpha.3 → 1.0.0-alpha.31
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 +6035 -5791
- package/cjs/document/api-document.js +11 -0
- package/cjs/document/common/api-base.js +1 -1
- package/cjs/document/common/document-element.js +4 -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 -3
- 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 -2
- package/cjs/document/http/http-operation.js +28 -4
- package/cjs/document/http/http-parameter.js +4 -0
- package/cjs/document/http/http-request-body.js +0 -1
- 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 -1
- 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 -3
- 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 -2
- package/esm/document/http/http-operation.js +27 -4
- package/esm/document/http/http-parameter.js +4 -0
- package/esm/document/http/http-request-body.js +0 -1
- 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 +12 -8
- package/types/document/api-document.d.ts +1 -0
- package/types/document/common/api-base.d.ts +1 -1
- 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-api.d.ts +1 -1
- 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
|
@@ -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;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const filter_rules_js_1 = require("../../filter/filter-rules.js");
|
|
4
|
-
const index_js_1 = require("../../
|
|
5
|
-
const index_js_2 = require("../../http/index.js");
|
|
4
|
+
const index_js_1 = require("../../http/index.js");
|
|
6
5
|
const constants_js_1 = require("../constants.js");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
6
|
+
const index_js_2 = require("../data-type/extended-types/index.js");
|
|
7
|
+
const index_js_3 = require("../data-type/primitive-types/index.js");
|
|
9
8
|
const http_operation_js_1 = require("../http/http-operation.js");
|
|
10
9
|
const http_operation_decorator_js_1 = require("./http-operation.decorator.js");
|
|
11
10
|
/** Implementation **/
|
|
@@ -22,20 +21,20 @@ http_operation_js_1.HttpOperation.Entity.Create = function (arg0, arg1) {
|
|
|
22
21
|
args = { ...arg1, type: arg0 };
|
|
23
22
|
/** Initialize the decorator and the chain */
|
|
24
23
|
const decoratorChain = [];
|
|
25
|
-
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain,
|
|
26
|
-
description: args.description,
|
|
24
|
+
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, {
|
|
27
25
|
method: 'POST',
|
|
26
|
+
...args,
|
|
28
27
|
composition: 'Entity.Create',
|
|
29
28
|
requestBody: {
|
|
30
29
|
immediateFetch: true,
|
|
31
30
|
...args.requestBody,
|
|
32
31
|
required: true,
|
|
33
32
|
},
|
|
34
|
-
})
|
|
33
|
+
});
|
|
35
34
|
decorator
|
|
36
35
|
.QueryParam('projection', {
|
|
37
36
|
description: 'Determines fields projection',
|
|
38
|
-
type: new
|
|
37
|
+
type: new index_js_2.FieldPathType({
|
|
39
38
|
dataType: args.type,
|
|
40
39
|
allowSigns: 'each',
|
|
41
40
|
}),
|
|
@@ -43,18 +42,16 @@ http_operation_js_1.HttpOperation.Entity.Create = function (arg0, arg1) {
|
|
|
43
42
|
arraySeparator: ',',
|
|
44
43
|
})
|
|
45
44
|
.RequestContent(args.requestBody?.type || args.type)
|
|
46
|
-
.Response(
|
|
45
|
+
.Response(index_js_1.HttpStatusCode.CREATED, {
|
|
47
46
|
description: 'Operation is successful. Returns OperationResult with "payload" field that contains the created resource.',
|
|
48
|
-
contentType:
|
|
47
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
49
48
|
type: args.type,
|
|
50
49
|
partial: 'deep',
|
|
51
50
|
})
|
|
52
|
-
.Response(
|
|
51
|
+
.Response(index_js_1.HttpStatusCode.UNPROCESSABLE_ENTITY, {
|
|
53
52
|
description: 'The request was well-formed but was unable to process operation due to one or many errors.',
|
|
54
|
-
contentType:
|
|
53
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
55
54
|
});
|
|
56
|
-
if (typeof args.type === 'function')
|
|
57
|
-
decorator.UseType(args.type);
|
|
58
55
|
decoratorChain.push((operationMeta) => {
|
|
59
56
|
const compositionOptions = (operationMeta.compositionOptions = operationMeta.compositionOptions || {});
|
|
60
57
|
compositionOptions.type = getDataTypeName(args.type);
|
|
@@ -73,31 +70,42 @@ http_operation_js_1.HttpOperation.Entity.Delete = function (arg0, arg1) {
|
|
|
73
70
|
args = { ...arg1, type: arg0 };
|
|
74
71
|
/** Initialize the decorator and the chain */
|
|
75
72
|
const decoratorChain = [];
|
|
76
|
-
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain,
|
|
77
|
-
description: args.description,
|
|
73
|
+
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, {
|
|
78
74
|
method: 'DELETE',
|
|
75
|
+
...args,
|
|
79
76
|
composition: 'Entity.Delete',
|
|
80
|
-
})
|
|
77
|
+
});
|
|
81
78
|
decorator
|
|
82
|
-
.Response(
|
|
79
|
+
.Response(index_js_1.HttpStatusCode.OK, {
|
|
83
80
|
description: 'Operation is successful. Returns OperationResult with "affected" field.',
|
|
84
|
-
contentType:
|
|
81
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
85
82
|
})
|
|
86
|
-
.Response(
|
|
83
|
+
.Response(index_js_1.HttpStatusCode.UNPROCESSABLE_ENTITY, {
|
|
87
84
|
description: 'The request was well-formed but was unable to process operation due to one or many errors.',
|
|
88
|
-
contentType:
|
|
85
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
89
86
|
});
|
|
90
|
-
if (typeof args.type === 'function')
|
|
91
|
-
decorator.UseType(args.type);
|
|
92
87
|
/**
|
|
93
88
|
*
|
|
94
89
|
*/
|
|
95
90
|
decorator.KeyParam = (name, prmOptions) => {
|
|
96
|
-
|
|
91
|
+
const paramMeta = typeof prmOptions === 'string' || typeof prmOptions === 'function'
|
|
92
|
+
? {
|
|
93
|
+
name,
|
|
94
|
+
location: 'path',
|
|
95
|
+
type: prmOptions,
|
|
96
|
+
keyParam: true,
|
|
97
|
+
}
|
|
98
|
+
: {
|
|
99
|
+
...prmOptions,
|
|
100
|
+
name,
|
|
101
|
+
location: 'path',
|
|
102
|
+
keyParam: true,
|
|
103
|
+
};
|
|
104
|
+
decorator.PathParam(name, paramMeta);
|
|
97
105
|
decoratorChain.push((meta) => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
meta.
|
|
106
|
+
if (!meta.path?.includes(':' + name))
|
|
107
|
+
meta.path = (meta.path || '') + '@:' + name;
|
|
108
|
+
meta.mergePath = true;
|
|
101
109
|
});
|
|
102
110
|
return decorator;
|
|
103
111
|
};
|
|
@@ -120,28 +128,26 @@ http_operation_js_1.HttpOperation.Entity.DeleteMany = function (arg0, arg1) {
|
|
|
120
128
|
/** Initialize the decorator and the chain */
|
|
121
129
|
const decoratorChain = [];
|
|
122
130
|
const filterRules = new filter_rules_js_1.FilterRules();
|
|
123
|
-
const filterType = new
|
|
131
|
+
const filterType = new index_js_2.FilterType({ dataType: args.type });
|
|
124
132
|
filterType.rules = {};
|
|
125
|
-
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain,
|
|
126
|
-
description: args.description,
|
|
133
|
+
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, {
|
|
127
134
|
method: 'DELETE',
|
|
135
|
+
...args,
|
|
128
136
|
composition: 'Entity.DeleteMany',
|
|
129
|
-
})
|
|
137
|
+
});
|
|
130
138
|
decorator
|
|
131
|
-
.Response(
|
|
139
|
+
.Response(index_js_1.HttpStatusCode.OK, {
|
|
132
140
|
description: 'Operation is successful. Returns OperationResult with "affected" field.',
|
|
133
|
-
contentType:
|
|
141
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
134
142
|
})
|
|
135
|
-
.Response(
|
|
143
|
+
.Response(index_js_1.HttpStatusCode.UNPROCESSABLE_ENTITY, {
|
|
136
144
|
description: 'The request was well-formed but was unable to process operation due to one or many errors.',
|
|
137
|
-
contentType:
|
|
145
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
138
146
|
})
|
|
139
147
|
.QueryParam('filter', {
|
|
140
148
|
type: filterType,
|
|
141
149
|
description: 'Determines filter fields',
|
|
142
150
|
});
|
|
143
|
-
if (typeof args.type === 'function')
|
|
144
|
-
decorator.UseType(args.type);
|
|
145
151
|
decoratorChain.push((operationMeta) => {
|
|
146
152
|
const compositionOptions = (operationMeta.compositionOptions = operationMeta.compositionOptions || {});
|
|
147
153
|
compositionOptions.type = getDataTypeName(args.type);
|
|
@@ -168,32 +174,32 @@ http_operation_js_1.HttpOperation.Entity.FindMany = function (arg0, arg1) {
|
|
|
168
174
|
/** Initialize the decorator and the chain */
|
|
169
175
|
const decoratorChain = [];
|
|
170
176
|
const filterRules = new filter_rules_js_1.FilterRules();
|
|
171
|
-
const filterType = new
|
|
177
|
+
const filterType = new index_js_2.FilterType({ dataType: args.type });
|
|
172
178
|
filterType.rules = {};
|
|
173
|
-
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain,
|
|
174
|
-
description: args.description,
|
|
179
|
+
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, {
|
|
175
180
|
method: 'GET',
|
|
181
|
+
...args,
|
|
176
182
|
composition: 'Entity.FindMany',
|
|
177
|
-
})
|
|
183
|
+
});
|
|
178
184
|
decorator
|
|
179
|
-
.Response(
|
|
185
|
+
.Response(index_js_1.HttpStatusCode.OK, {
|
|
180
186
|
description: 'Operation is successful. Returns OperationResult with "payload" field that contains list of resources.',
|
|
181
|
-
contentType:
|
|
187
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
182
188
|
type: args.type,
|
|
183
189
|
partial: 'deep',
|
|
184
190
|
isArray: true,
|
|
185
191
|
})
|
|
186
|
-
.Response(
|
|
192
|
+
.Response(index_js_1.HttpStatusCode.UNPROCESSABLE_ENTITY, {
|
|
187
193
|
description: 'The request was well-formed but was unable to process operation due to one or many errors.',
|
|
188
|
-
contentType:
|
|
194
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
189
195
|
})
|
|
190
196
|
.QueryParam('limit', {
|
|
191
197
|
description: 'Determines number of returning instances',
|
|
192
|
-
type: new
|
|
198
|
+
type: new index_js_3.IntegerType({ minValue: 1, maxValue: args.maxLimit }),
|
|
193
199
|
})
|
|
194
200
|
.QueryParam('skip', {
|
|
195
201
|
description: 'Determines number of returning instances',
|
|
196
|
-
type: new
|
|
202
|
+
type: new index_js_3.IntegerType({ minValue: 1 }),
|
|
197
203
|
})
|
|
198
204
|
.QueryParam('count', {
|
|
199
205
|
description: 'Counts all matching instances if enabled',
|
|
@@ -201,7 +207,7 @@ http_operation_js_1.HttpOperation.Entity.FindMany = function (arg0, arg1) {
|
|
|
201
207
|
})
|
|
202
208
|
.QueryParam('projection', {
|
|
203
209
|
description: 'Determines fields projection',
|
|
204
|
-
type: new
|
|
210
|
+
type: new index_js_2.FieldPathType({
|
|
205
211
|
dataType: args.type,
|
|
206
212
|
allowSigns: 'each',
|
|
207
213
|
}),
|
|
@@ -214,18 +220,22 @@ http_operation_js_1.HttpOperation.Entity.FindMany = function (arg0, arg1) {
|
|
|
214
220
|
})
|
|
215
221
|
.QueryParam('sort', {
|
|
216
222
|
description: 'Determines sort fields',
|
|
217
|
-
type: new
|
|
223
|
+
type: new index_js_2.FieldPathType({
|
|
218
224
|
dataType: args.type,
|
|
219
225
|
allowSigns: 'first',
|
|
220
226
|
}),
|
|
221
227
|
isArray: true,
|
|
222
228
|
arraySeparator: ',',
|
|
223
229
|
});
|
|
224
|
-
if (typeof args.type === 'function')
|
|
225
|
-
decorator.UseType(args.type);
|
|
226
230
|
decoratorChain.push((operationMeta) => {
|
|
227
231
|
const compositionOptions = (operationMeta.compositionOptions = operationMeta.compositionOptions || {});
|
|
228
232
|
compositionOptions.type = getDataTypeName(args.type);
|
|
233
|
+
if (args.defaultLimit)
|
|
234
|
+
compositionOptions.defaultLimit = args.defaultLimit;
|
|
235
|
+
if (args.defaultProjection)
|
|
236
|
+
compositionOptions.defaultProjection = args.defaultProjection;
|
|
237
|
+
if (args.maxLimit)
|
|
238
|
+
compositionOptions.maxLimit = args.maxLimit;
|
|
229
239
|
});
|
|
230
240
|
decorator.DefaultSort = (...fields) => {
|
|
231
241
|
decoratorChain.push((operationMeta) => {
|
|
@@ -262,45 +272,56 @@ http_operation_js_1.HttpOperation.Entity.Get = function (arg0, arg1) {
|
|
|
262
272
|
args = { ...arg1, type: arg0 };
|
|
263
273
|
/** Initialize the decorator and the chain */
|
|
264
274
|
const decoratorChain = [];
|
|
265
|
-
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain,
|
|
266
|
-
description: args.description,
|
|
275
|
+
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, {
|
|
267
276
|
method: 'GET',
|
|
277
|
+
...args,
|
|
268
278
|
composition: 'Entity.Get',
|
|
269
|
-
})
|
|
279
|
+
});
|
|
270
280
|
decorator
|
|
271
281
|
.QueryParam('projection', {
|
|
272
282
|
description: 'Determines fields projection',
|
|
273
|
-
type: new
|
|
283
|
+
type: new index_js_2.FieldPathType({
|
|
274
284
|
dataType: args.type,
|
|
275
285
|
allowSigns: 'each',
|
|
276
286
|
}),
|
|
277
287
|
isArray: true,
|
|
278
288
|
arraySeparator: ',',
|
|
279
289
|
})
|
|
280
|
-
.Response(
|
|
290
|
+
.Response(index_js_1.HttpStatusCode.OK, {
|
|
281
291
|
description: 'Operation is successful. Returns OperationResult with "payload" field that contains the resource asked for.',
|
|
282
|
-
contentType:
|
|
292
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
283
293
|
type: args.type,
|
|
284
294
|
partial: 'deep',
|
|
285
295
|
})
|
|
286
|
-
.Response(
|
|
296
|
+
.Response(index_js_1.HttpStatusCode.NO_CONTENT, {
|
|
287
297
|
description: 'Operation is successful but no resource found',
|
|
288
298
|
})
|
|
289
|
-
.Response(
|
|
299
|
+
.Response(index_js_1.HttpStatusCode.UNPROCESSABLE_ENTITY, {
|
|
290
300
|
description: 'The request was well-formed but was unable to process operation due to one or many errors.',
|
|
291
|
-
contentType:
|
|
301
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
292
302
|
});
|
|
293
|
-
if (typeof args.type === 'function')
|
|
294
|
-
decorator.UseType(args.type);
|
|
295
303
|
/**
|
|
296
304
|
*
|
|
297
305
|
*/
|
|
298
306
|
decorator.KeyParam = (name, prmOptions) => {
|
|
299
|
-
|
|
307
|
+
const paramMeta = typeof prmOptions === 'string' || typeof prmOptions === 'function'
|
|
308
|
+
? {
|
|
309
|
+
name,
|
|
310
|
+
location: 'path',
|
|
311
|
+
type: prmOptions,
|
|
312
|
+
keyParam: true,
|
|
313
|
+
}
|
|
314
|
+
: {
|
|
315
|
+
...prmOptions,
|
|
316
|
+
name,
|
|
317
|
+
location: 'path',
|
|
318
|
+
keyParam: true,
|
|
319
|
+
};
|
|
320
|
+
decorator.PathParam(name, paramMeta);
|
|
300
321
|
decoratorChain.push((meta) => {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
meta.
|
|
322
|
+
if (!meta.path?.includes(':' + name))
|
|
323
|
+
meta.path = (meta.path || '') + '@:' + name;
|
|
324
|
+
meta.mergePath = true;
|
|
304
325
|
});
|
|
305
326
|
return decorator;
|
|
306
327
|
};
|
|
@@ -322,12 +343,12 @@ http_operation_js_1.HttpOperation.Entity.UpdateMany = function (arg0, arg1) {
|
|
|
322
343
|
args = { ...arg1, type: arg0 };
|
|
323
344
|
/** Initialize the decorator and the chain */
|
|
324
345
|
const decoratorChain = [];
|
|
325
|
-
const filterType = new
|
|
346
|
+
const filterType = new index_js_2.FilterType({ dataType: args.type });
|
|
326
347
|
filterType.rules = {};
|
|
327
348
|
const filterRules = new filter_rules_js_1.FilterRules();
|
|
328
|
-
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain,
|
|
329
|
-
description: args.description,
|
|
349
|
+
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, {
|
|
330
350
|
method: 'PATCH',
|
|
351
|
+
...args,
|
|
331
352
|
composition: 'Entity.UpdateMany',
|
|
332
353
|
requestBody: {
|
|
333
354
|
immediateFetch: true,
|
|
@@ -335,18 +356,16 @@ http_operation_js_1.HttpOperation.Entity.UpdateMany = function (arg0, arg1) {
|
|
|
335
356
|
...args.requestBody,
|
|
336
357
|
required: true,
|
|
337
358
|
},
|
|
338
|
-
})
|
|
339
|
-
decorator.RequestContent(args.requestBody?.type || args.type);
|
|
340
|
-
if (typeof args.type === 'function')
|
|
341
|
-
decorator.UseType(args.type);
|
|
359
|
+
});
|
|
342
360
|
decorator
|
|
343
|
-
.
|
|
361
|
+
.RequestContent(args.requestBody?.type || args.type)
|
|
362
|
+
.Response(index_js_1.HttpStatusCode.OK, {
|
|
344
363
|
description: 'Operation is successful. Returns OperationResult with "affected" field.',
|
|
345
|
-
contentType:
|
|
364
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
346
365
|
})
|
|
347
|
-
.Response(
|
|
366
|
+
.Response(index_js_1.HttpStatusCode.UNPROCESSABLE_ENTITY, {
|
|
348
367
|
description: 'The request was well-formed but was unable to process operation due to one or many errors.',
|
|
349
|
-
contentType:
|
|
368
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
350
369
|
})
|
|
351
370
|
.QueryParam('filter', {
|
|
352
371
|
type: filterType,
|
|
@@ -378,11 +397,11 @@ http_operation_js_1.HttpOperation.Entity.Update = function (arg0, arg1) {
|
|
|
378
397
|
/** Initialize the decorator and the chain */
|
|
379
398
|
const decoratorChain = [];
|
|
380
399
|
const filterRules = new filter_rules_js_1.FilterRules();
|
|
381
|
-
const filterType = new
|
|
400
|
+
const filterType = new index_js_2.FilterType({ dataType: args.type });
|
|
382
401
|
filterType.rules = {};
|
|
383
|
-
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain,
|
|
384
|
-
description: args.description,
|
|
402
|
+
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, {
|
|
385
403
|
method: 'PATCH',
|
|
404
|
+
...args,
|
|
386
405
|
composition: 'Entity.Update',
|
|
387
406
|
requestBody: {
|
|
388
407
|
partial: 'deep',
|
|
@@ -390,11 +409,11 @@ http_operation_js_1.HttpOperation.Entity.Update = function (arg0, arg1) {
|
|
|
390
409
|
...args.requestBody,
|
|
391
410
|
required: true,
|
|
392
411
|
},
|
|
393
|
-
})
|
|
412
|
+
});
|
|
394
413
|
decorator
|
|
395
414
|
.QueryParam('projection', {
|
|
396
415
|
description: 'Determines fields projection',
|
|
397
|
-
type: new
|
|
416
|
+
type: new index_js_2.FieldPathType({
|
|
398
417
|
dataType: args.type,
|
|
399
418
|
allowSigns: 'each',
|
|
400
419
|
}),
|
|
@@ -406,30 +425,41 @@ http_operation_js_1.HttpOperation.Entity.Update = function (arg0, arg1) {
|
|
|
406
425
|
description: 'Determines filter fields',
|
|
407
426
|
})
|
|
408
427
|
.RequestContent(args.requestBody?.type || args.type)
|
|
409
|
-
.Response(
|
|
428
|
+
.Response(index_js_1.HttpStatusCode.OK, {
|
|
410
429
|
description: 'Operation is successful. Returns OperationResult with "payload" field that contains updated resource.',
|
|
411
|
-
contentType:
|
|
430
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
412
431
|
type: args.type,
|
|
413
432
|
partial: 'deep',
|
|
414
433
|
})
|
|
415
|
-
.Response(
|
|
434
|
+
.Response(index_js_1.HttpStatusCode.NO_CONTENT, {
|
|
416
435
|
description: 'Operation is successful but no resource found',
|
|
417
436
|
})
|
|
418
|
-
.Response(
|
|
437
|
+
.Response(index_js_1.HttpStatusCode.UNPROCESSABLE_ENTITY, {
|
|
419
438
|
description: 'The request was well-formed but was unable to process operation due to one or many errors.',
|
|
420
|
-
contentType:
|
|
439
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
421
440
|
});
|
|
422
|
-
if (typeof args.type === 'function')
|
|
423
|
-
decorator.UseType(args.type);
|
|
424
441
|
/**
|
|
425
442
|
*
|
|
426
443
|
*/
|
|
427
444
|
decorator.KeyParam = (name, prmOptions) => {
|
|
428
|
-
|
|
445
|
+
const paramMeta = typeof prmOptions === 'string' || typeof prmOptions === 'function'
|
|
446
|
+
? {
|
|
447
|
+
name,
|
|
448
|
+
location: 'path',
|
|
449
|
+
type: prmOptions,
|
|
450
|
+
keyParam: true,
|
|
451
|
+
}
|
|
452
|
+
: {
|
|
453
|
+
...prmOptions,
|
|
454
|
+
name,
|
|
455
|
+
location: 'path',
|
|
456
|
+
keyParam: true,
|
|
457
|
+
};
|
|
458
|
+
decorator.PathParam(name, paramMeta);
|
|
429
459
|
decoratorChain.push((meta) => {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
meta.
|
|
460
|
+
if (!meta.path?.includes(':' + name))
|
|
461
|
+
meta.path = (meta.path || '') + '@:' + name;
|
|
462
|
+
meta.mergePath = true;
|
|
433
463
|
});
|
|
434
464
|
return decorator;
|
|
435
465
|
};
|