@opra/common 1.0.0-alpha.3 → 1.0.0-alpha.5

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.
Files changed (76) hide show
  1. package/browser.js +253 -78
  2. package/cjs/document/data-type/api-field.js +4 -0
  3. package/cjs/document/data-type/complex-type-base.js +4 -0
  4. package/cjs/document/data-type/complex-type.js +2 -0
  5. package/cjs/document/data-type/enum-type.js +2 -0
  6. package/cjs/document/data-type/extended-types/base64.type.js +4 -0
  7. package/cjs/document/data-type/extended-types/date-string.type.js +4 -0
  8. package/cjs/document/data-type/extended-types/date-time-string.type.js +4 -0
  9. package/cjs/document/data-type/extended-types/date-time.type.js +4 -0
  10. package/cjs/document/data-type/extended-types/date.type.js +4 -0
  11. package/cjs/document/data-type/extended-types/email.type.js +4 -0
  12. package/cjs/document/data-type/extended-types/field-path.type.js +4 -0
  13. package/cjs/document/data-type/extended-types/filter.type.js +4 -0
  14. package/cjs/document/data-type/extended-types/object-id.type.js +4 -0
  15. package/cjs/document/data-type/extended-types/time.type.js +4 -0
  16. package/cjs/document/data-type/extended-types/url.type.js +4 -0
  17. package/cjs/document/data-type/extended-types/uuid.type.js +4 -0
  18. package/cjs/document/data-type/mapped-type.js +3 -0
  19. package/cjs/document/data-type/mixin-type.js +3 -0
  20. package/cjs/document/data-type/primitive-types/bigint.type.js +4 -0
  21. package/cjs/document/data-type/primitive-types/boolean.type.js +4 -0
  22. package/cjs/document/data-type/primitive-types/integer.type.js +4 -0
  23. package/cjs/document/data-type/primitive-types/null.type.js +4 -0
  24. package/cjs/document/data-type/primitive-types/number.type.js +4 -0
  25. package/cjs/document/data-type/primitive-types/string.type.js +4 -0
  26. package/cjs/document/data-type/simple-type.js +8 -1
  27. package/cjs/document/decorators/http-controller.decorator.js +25 -0
  28. package/cjs/document/decorators/http-operation-entity.decorator.js +55 -19
  29. package/cjs/document/factory/data-type.factory.js +61 -38
  30. package/cjs/document/http/http-api.js +2 -2
  31. package/cjs/document/http/http-controller.js +6 -6
  32. package/cjs/document/http/http-parameter.js +2 -0
  33. package/esm/document/data-type/api-field.js +4 -0
  34. package/esm/document/data-type/complex-type-base.js +4 -0
  35. package/esm/document/data-type/complex-type.js +2 -0
  36. package/esm/document/data-type/enum-type.js +2 -0
  37. package/esm/document/data-type/extended-types/base64.type.js +4 -0
  38. package/esm/document/data-type/extended-types/date-string.type.js +4 -0
  39. package/esm/document/data-type/extended-types/date-time-string.type.js +4 -0
  40. package/esm/document/data-type/extended-types/date-time.type.js +4 -0
  41. package/esm/document/data-type/extended-types/date.type.js +4 -0
  42. package/esm/document/data-type/extended-types/email.type.js +4 -0
  43. package/esm/document/data-type/extended-types/field-path.type.js +4 -0
  44. package/esm/document/data-type/extended-types/filter.type.js +4 -0
  45. package/esm/document/data-type/extended-types/object-id.type.js +4 -0
  46. package/esm/document/data-type/extended-types/time.type.js +4 -0
  47. package/esm/document/data-type/extended-types/url.type.js +4 -0
  48. package/esm/document/data-type/extended-types/uuid.type.js +4 -0
  49. package/esm/document/data-type/mapped-type.js +3 -0
  50. package/esm/document/data-type/mixin-type.js +3 -0
  51. package/esm/document/data-type/primitive-types/bigint.type.js +4 -0
  52. package/esm/document/data-type/primitive-types/boolean.type.js +4 -0
  53. package/esm/document/data-type/primitive-types/integer.type.js +4 -0
  54. package/esm/document/data-type/primitive-types/null.type.js +4 -0
  55. package/esm/document/data-type/primitive-types/number.type.js +4 -0
  56. package/esm/document/data-type/primitive-types/string.type.js +4 -0
  57. package/esm/document/data-type/simple-type.js +8 -1
  58. package/esm/document/decorators/http-controller.decorator.js +25 -0
  59. package/esm/document/decorators/http-operation-entity.decorator.js +55 -19
  60. package/esm/document/factory/data-type.factory.js +61 -38
  61. package/esm/document/http/http-api.js +2 -2
  62. package/esm/document/http/http-controller.js +6 -6
  63. package/esm/document/http/http-parameter.js +2 -0
  64. package/package.json +3 -3
  65. package/types/document/data-type/api-field.d.ts +2 -0
  66. package/types/document/data-type/complex-type.d.ts +1 -1
  67. package/types/document/data-type/data-type.d.ts +4 -2
  68. package/types/document/data-type/enum-type.d.ts +2 -2
  69. package/types/document/data-type/mapped-type.d.ts +2 -2
  70. package/types/document/data-type/mixin-type.d.ts +2 -2
  71. package/types/document/data-type/simple-type.d.ts +4 -2
  72. package/types/document/decorators/http-controller.decorator.d.ts +1 -0
  73. package/types/document/factory/data-type.factory.d.ts +5 -0
  74. package/types/document/http/http-parameter.d.ts +2 -0
  75. package/types/schema/data-type/simple-type.interface.d.ts +4 -0
  76. package/types/schema/http/http-parameter.interface.d.ts +4 -0
@@ -36,6 +36,8 @@ exports.ApiField = function (...args) {
36
36
  _this.exclusive = initArgs.exclusive;
37
37
  _this.translatable = initArgs.translatable;
38
38
  _this.deprecated = initArgs.deprecated;
39
+ _this.readonly = initArgs.readonly;
40
+ _this.writeonly = initArgs.writeonly;
39
41
  _this.examples = initArgs.examples;
40
42
  };
41
43
  /**
@@ -55,6 +57,8 @@ class ApiFieldClass extends document_element_js_1.DocumentElement {
55
57
  exclusive: this.exclusive,
56
58
  translatable: this.translatable,
57
59
  deprecated: this.deprecated,
60
+ readonly: this.readonly,
61
+ writeonly: this.writeonly,
58
62
  examples: this.examples,
59
63
  });
60
64
  }
@@ -146,6 +146,10 @@ class ComplexTypeBaseClass extends data_type_js_1.DataType {
146
146
  // Process fields
147
147
  let fieldName;
148
148
  for (const field of this.fields.values()) {
149
+ if ((context.ignoreReadonlyFields && field.readonly) || (context.ignoreWriteonlyFields && field.writeonly)) {
150
+ schema[field.name] = valgen_1.vg.isUndefined({ coerce: true });
151
+ continue;
152
+ }
149
153
  fieldName = field.name;
150
154
  let p;
151
155
  if (projection !== '*') {
@@ -60,6 +60,8 @@ exports.ComplexType = function (...args) {
60
60
  */
61
61
  class ComplexTypeClass extends complex_type_base_js_1.ComplexTypeBase {
62
62
  extendsFrom(baseType) {
63
+ if (!(baseType instanceof data_type_js_1.DataType))
64
+ baseType = this.node.getDataType(baseType);
63
65
  if (!(baseType instanceof complex_type_base_js_1.ComplexTypeBase))
64
66
  return false;
65
67
  if (baseType === this)
@@ -38,6 +38,8 @@ exports.EnumType = function (...args) {
38
38
  */
39
39
  class EnumTypeClass extends data_type_js_1.DataType {
40
40
  extendsFrom(baseType) {
41
+ if (!(baseType instanceof data_type_js_1.DataType))
42
+ baseType = this.node.getDataType(baseType);
41
43
  if (!(baseType instanceof exports.EnumType))
42
44
  return false;
43
45
  if (baseType === this)
@@ -21,6 +21,10 @@ exports.Base64Type = Base64Type;
21
21
  exports.Base64Type = Base64Type = tslib_1.__decorate([
22
22
  (0, simple_type_js_1.SimpleType)({
23
23
  description: 'A stream of bytes, base64 encoded',
24
+ nameMappings: {
25
+ js: 'string',
26
+ json: 'string',
27
+ },
24
28
  }),
25
29
  tslib_1.__metadata("design:paramtypes", [Object])
26
30
  ], Base64Type);
@@ -39,6 +39,10 @@ tslib_1.__decorate([
39
39
  exports.DateStringType = DateStringType = tslib_1.__decorate([
40
40
  (0, simple_type_js_1.SimpleType)({
41
41
  description: 'Date string value',
42
+ nameMappings: {
43
+ js: 'string',
44
+ json: 'string',
45
+ },
42
46
  })
43
47
  .Example('2021-04-18', 'Full date value')
44
48
  .Example('2021-04', 'Date value without day')
@@ -39,6 +39,10 @@ tslib_1.__decorate([
39
39
  exports.DateTimeStringType = DateTimeStringType = tslib_1.__decorate([
40
40
  (0, simple_type_js_1.SimpleType)({
41
41
  description: 'DateTime string value',
42
+ nameMappings: {
43
+ js: 'string',
44
+ json: 'string',
45
+ },
42
46
  })
43
47
  .Example('2021-04-18T22:30:15+01:00', 'Full date-time value with timezone')
44
48
  .Example('2021-04-18T22:30:15', 'Full date-time value without timezone')
@@ -53,6 +53,10 @@ tslib_1.__decorate([
53
53
  exports.DateTimeType = DateTimeType = tslib_1.__decorate([
54
54
  (0, simple_type_js_1.SimpleType)({
55
55
  description: 'A full datetime value',
56
+ nameMappings: {
57
+ js: 'string',
58
+ json: 'string',
59
+ },
56
60
  })
57
61
  .Example('2021-04-18T22:30:15')
58
62
  .Example('2021-04-18 22:30:15')
@@ -53,6 +53,10 @@ tslib_1.__decorate([
53
53
  exports.DateType = DateType = tslib_1.__decorate([
54
54
  (0, simple_type_js_1.SimpleType)({
55
55
  description: 'A date without time',
56
+ nameMappings: {
57
+ js: 'Date',
58
+ json: 'string',
59
+ },
56
60
  }).Example('2021-04-18', 'Full date value'),
57
61
  tslib_1.__metadata("design:paramtypes", [Object])
58
62
  ], DateType);
@@ -85,6 +85,10 @@ tslib_1.__decorate([
85
85
  exports.EmailType = EmailType = tslib_1.__decorate([
86
86
  (0, simple_type_js_1.SimpleType)({
87
87
  description: 'An email value',
88
+ nameMappings: {
89
+ js: 'string',
90
+ json: 'string',
91
+ },
88
92
  }).Example('some.body@example.com'),
89
93
  tslib_1.__metadata("design:paramtypes", [Object])
90
94
  ], EmailType);
@@ -52,6 +52,10 @@ tslib_1.__decorate([
52
52
  exports.FieldPathType = FieldPathType = tslib_1.__decorate([
53
53
  (0, simple_type_js_1.SimpleType)({
54
54
  description: 'Field path',
55
+ nameMappings: {
56
+ js: 'string',
57
+ json: 'string',
58
+ },
55
59
  }),
56
60
  tslib_1.__metadata("design:paramtypes", [Object])
57
61
  ], FieldPathType);
@@ -49,6 +49,10 @@ tslib_1.__decorate([
49
49
  exports.FilterType = FilterType = tslib_1.__decorate([
50
50
  (0, simple_type_js_1.SimpleType)({
51
51
  description: 'A query filter',
52
+ nameMappings: {
53
+ js: 'object',
54
+ json: 'string',
55
+ },
52
56
  }),
53
57
  tslib_1.__metadata("design:paramtypes", [Object])
54
58
  ], FilterType);
@@ -21,6 +21,10 @@ exports.ObjectIdType = ObjectIdType;
21
21
  exports.ObjectIdType = ObjectIdType = tslib_1.__decorate([
22
22
  (0, simple_type_js_1.SimpleType)({
23
23
  description: 'A MongoDB ObjectID value',
24
+ nameMappings: {
25
+ js: 'object',
26
+ json: 'string',
27
+ },
24
28
  }),
25
29
  tslib_1.__metadata("design:paramtypes", [Object])
26
30
  ], ObjectIdType);
@@ -43,6 +43,10 @@ tslib_1.__decorate([
43
43
  exports.TimeType = TimeType = tslib_1.__decorate([
44
44
  (0, simple_type_js_1.SimpleType)({
45
45
  description: 'Time string in 24h format',
46
+ nameMappings: {
47
+ js: 'string',
48
+ json: 'string',
49
+ },
46
50
  })
47
51
  .Example('18:23:00', 'Full time value')
48
52
  .Example('18:23:00', 'Time value without seconds'),
@@ -21,6 +21,10 @@ exports.UrlType = UrlType;
21
21
  exports.UrlType = UrlType = tslib_1.__decorate([
22
22
  (0, simple_type_js_1.SimpleType)({
23
23
  description: 'A Uniform Resource Identifier Reference (RFC 3986 icon) value',
24
+ nameMappings: {
25
+ js: 'string',
26
+ json: 'string',
27
+ },
24
28
  }).Example('http://tempuri.org'),
25
29
  tslib_1.__metadata("design:paramtypes", [Object])
26
30
  ], UrlType);
@@ -27,6 +27,10 @@ tslib_1.__decorate([
27
27
  exports.UuidType = UuidType = tslib_1.__decorate([
28
28
  (0, simple_type_js_1.SimpleType)({
29
29
  description: 'A Universal Unique Identifier (UUID) value',
30
+ nameMappings: {
31
+ js: 'string',
32
+ json: 'string',
33
+ },
30
34
  }),
31
35
  tslib_1.__metadata("design:paramtypes", [Object])
32
36
  ], UuidType);
@@ -7,6 +7,7 @@ const index_js_1 = require("../../helpers/index.js");
7
7
  const index_js_2 = require("../../schema/index.js");
8
8
  const api_field_js_1 = require("./api-field.js");
9
9
  const complex_type_base_js_1 = require("./complex-type-base.js");
10
+ const data_type_js_1 = require("./data-type.js");
10
11
  const get_is_inherited_predicate_fn_js_1 = require("./utils/get-is-inherited-predicate-fn.js");
11
12
  /**
12
13
  * MappedType constructor
@@ -68,6 +69,8 @@ exports.MappedType = function (...args) {
68
69
  */
69
70
  class MappedTypeClass extends complex_type_base_js_1.ComplexTypeBase {
70
71
  extendsFrom(baseType) {
72
+ if (!(baseType instanceof data_type_js_1.DataType))
73
+ baseType = this.node.getDataType(baseType);
71
74
  if (!(baseType instanceof complex_type_base_js_1.ComplexTypeBase))
72
75
  return false;
73
76
  if (baseType === this)
@@ -8,6 +8,7 @@ const index_js_2 = require("../../schema/index.js");
8
8
  const constants_js_1 = require("../constants.js");
9
9
  const api_field_js_1 = require("./api-field.js");
10
10
  const complex_type_base_js_1 = require("./complex-type-base.js");
11
+ const data_type_js_1 = require("./data-type.js");
11
12
  /**
12
13
  * @class MixinType
13
14
  */
@@ -43,6 +44,8 @@ exports.MixinType = function (...args) {
43
44
  */
44
45
  class MixinTypeClass extends complex_type_base_js_1.ComplexTypeBase {
45
46
  extendsFrom(baseType) {
47
+ if (!(baseType instanceof data_type_js_1.DataType))
48
+ baseType = this.node.getDataType(baseType);
46
49
  if (!(baseType instanceof complex_type_base_js_1.ComplexTypeBase))
47
50
  return false;
48
51
  if (baseType === this)
@@ -26,6 +26,10 @@ exports.BigintType = BigintType;
26
26
  exports.BigintType = BigintType = tslib_1.__decorate([
27
27
  (0, simple_type_js_1.SimpleType)({
28
28
  description: 'BigInt number',
29
+ nameMappings: {
30
+ js: 'bigint',
31
+ json: 'string',
32
+ },
29
33
  }),
30
34
  tslib_1.__metadata("design:paramtypes", [Object])
31
35
  ], BigintType);
@@ -21,6 +21,10 @@ exports.BooleanType = BooleanType;
21
21
  exports.BooleanType = BooleanType = tslib_1.__decorate([
22
22
  (0, simple_type_js_1.SimpleType)({
23
23
  description: 'Simple true/false value',
24
+ nameMappings: {
25
+ js: 'boolean',
26
+ json: 'boolean',
27
+ },
24
28
  }),
25
29
  tslib_1.__metadata("design:paramtypes", [Object])
26
30
  ], BooleanType);
@@ -26,6 +26,10 @@ exports.IntegerType = IntegerType;
26
26
  exports.IntegerType = IntegerType = tslib_1.__decorate([
27
27
  (0, simple_type_js_1.SimpleType)({
28
28
  description: 'An integer number',
29
+ nameMappings: {
30
+ js: 'number',
31
+ json: 'number',
32
+ },
29
33
  }),
30
34
  tslib_1.__metadata("design:paramtypes", [Object])
31
35
  ], IntegerType);
@@ -21,6 +21,10 @@ exports.NullType = NullType;
21
21
  exports.NullType = NullType = tslib_1.__decorate([
22
22
  (0, simple_type_js_1.SimpleType)({
23
23
  description: 'A Null value',
24
+ nameMappings: {
25
+ js: 'null',
26
+ json: 'null',
27
+ },
24
28
  }),
25
29
  tslib_1.__metadata("design:paramtypes", [Object])
26
30
  ], NullType);
@@ -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);
@@ -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);
@@ -28,6 +28,8 @@ exports.SimpleType = function (...args) {
28
28
  _this.base = initArgs.base;
29
29
  }
30
30
  _this.properties = initArgs.properties;
31
+ _this.ownNameMappings = { ...initArgs.nameMappings };
32
+ _this.nameMappings = { ..._this.base?.nameMappings, ...initArgs.nameMappings };
31
33
  _this.ownAttributes = (0, index_js_1.cloneObject)(initArgs.attributes || {});
32
34
  _this.attributes = _this.base ? (0, index_js_1.cloneObject)(_this.base.attributes) : {};
33
35
  if (_this.ownAttributes) {
@@ -46,6 +48,8 @@ exports.SimpleType = function (...args) {
46
48
  */
47
49
  class SimpleTypeClass extends data_type_js_1.DataType {
48
50
  extendsFrom(baseType) {
51
+ if (!(baseType instanceof data_type_js_1.DataType))
52
+ baseType = this.node.getDataType(baseType);
49
53
  if (!(baseType instanceof exports.SimpleType))
50
54
  return false;
51
55
  if (baseType === this)
@@ -90,12 +94,15 @@ class SimpleTypeClass extends data_type_js_1.DataType {
90
94
  return o;
91
95
  }, {});
92
96
  const baseName = this.base ? this.node.getDataTypeNameWithNs(this.base) : undefined;
93
- return (0, index_js_1.omitUndefined)({
97
+ const out = (0, index_js_1.omitUndefined)({
94
98
  ...data_type_js_1.DataType.prototype.toJSON.apply(this),
95
99
  base: this.base ? (baseName ? baseName : this.base.toJSON()) : undefined,
96
100
  attributes: attributes && Object.keys(attributes).length ? attributes : undefined,
97
101
  properties: Object.keys(properties).length ? properties : undefined,
98
102
  });
103
+ if (Object.keys(this.ownNameMappings).length)
104
+ out.nameMappings = { ...this.ownNameMappings };
105
+ return out;
99
106
  }
100
107
  }
101
108
  exports.SimpleType.prototype = SimpleTypeClass.prototype;
@@ -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
  */
@@ -23,8 +23,8 @@ http_operation_js_1.HttpOperation.Entity.Create = function (arg0, arg1) {
23
23
  /** Initialize the decorator and the chain */
24
24
  const decoratorChain = [];
25
25
  const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, (0, index_js_1.omitUndefined)({
26
- description: args.description,
27
26
  method: 'POST',
27
+ ...args,
28
28
  composition: 'Entity.Create',
29
29
  requestBody: {
30
30
  immediateFetch: true,
@@ -74,8 +74,8 @@ http_operation_js_1.HttpOperation.Entity.Delete = function (arg0, arg1) {
74
74
  /** Initialize the decorator and the chain */
75
75
  const decoratorChain = [];
76
76
  const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, (0, index_js_1.omitUndefined)({
77
- description: args.description,
78
77
  method: 'DELETE',
78
+ ...args,
79
79
  composition: 'Entity.Delete',
80
80
  }));
81
81
  decorator
@@ -93,11 +93,23 @@ http_operation_js_1.HttpOperation.Entity.Delete = function (arg0, arg1) {
93
93
  *
94
94
  */
95
95
  decorator.KeyParam = (name, prmOptions) => {
96
- decorator.PathParam(name, prmOptions);
96
+ const paramMeta = typeof prmOptions === 'string' || typeof prmOptions === 'function'
97
+ ? {
98
+ name,
99
+ location: 'path',
100
+ type: prmOptions,
101
+ keyParam: true,
102
+ }
103
+ : {
104
+ ...prmOptions,
105
+ name,
106
+ location: 'path',
107
+ keyParam: true,
108
+ };
109
+ decorator.PathParam(name, paramMeta);
97
110
  decoratorChain.push((meta) => {
98
- meta.path = (meta.path || '') + '@:' + name;
99
- meta.compositionOptions = meta.compositionOptions || {};
100
- meta.compositionOptions.keyParameter = name;
111
+ if (!meta.path?.includes(':' + name))
112
+ meta.path = (meta.path || '') + '@:' + name;
101
113
  });
102
114
  return decorator;
103
115
  };
@@ -123,8 +135,8 @@ http_operation_js_1.HttpOperation.Entity.DeleteMany = function (arg0, arg1) {
123
135
  const filterType = new index_js_3.FilterType({ dataType: args.type });
124
136
  filterType.rules = {};
125
137
  const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, (0, index_js_1.omitUndefined)({
126
- description: args.description,
127
138
  method: 'DELETE',
139
+ ...args,
128
140
  composition: 'Entity.DeleteMany',
129
141
  }));
130
142
  decorator
@@ -171,8 +183,8 @@ http_operation_js_1.HttpOperation.Entity.FindMany = function (arg0, arg1) {
171
183
  const filterType = new index_js_3.FilterType({ dataType: args.type });
172
184
  filterType.rules = {};
173
185
  const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, (0, index_js_1.omitUndefined)({
174
- description: args.description,
175
186
  method: 'GET',
187
+ ...args,
176
188
  composition: 'Entity.FindMany',
177
189
  }));
178
190
  decorator
@@ -263,8 +275,8 @@ http_operation_js_1.HttpOperation.Entity.Get = function (arg0, arg1) {
263
275
  /** Initialize the decorator and the chain */
264
276
  const decoratorChain = [];
265
277
  const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, (0, index_js_1.omitUndefined)({
266
- description: args.description,
267
278
  method: 'GET',
279
+ ...args,
268
280
  composition: 'Entity.Get',
269
281
  }));
270
282
  decorator
@@ -296,11 +308,23 @@ http_operation_js_1.HttpOperation.Entity.Get = function (arg0, arg1) {
296
308
  *
297
309
  */
298
310
  decorator.KeyParam = (name, prmOptions) => {
299
- decorator.PathParam(name, prmOptions);
311
+ const paramMeta = typeof prmOptions === 'string' || typeof prmOptions === 'function'
312
+ ? {
313
+ name,
314
+ location: 'path',
315
+ type: prmOptions,
316
+ keyParam: true,
317
+ }
318
+ : {
319
+ ...prmOptions,
320
+ name,
321
+ location: 'path',
322
+ keyParam: true,
323
+ };
324
+ decorator.PathParam(name, paramMeta);
300
325
  decoratorChain.push((meta) => {
301
- meta.path = (meta.path || '') + '@:' + name;
302
- meta.compositionOptions = meta.compositionOptions || {};
303
- meta.compositionOptions.keyParameter = name;
326
+ if (!meta.path?.includes(':' + name))
327
+ meta.path = (meta.path || '') + '@:' + name;
304
328
  });
305
329
  return decorator;
306
330
  };
@@ -326,8 +350,8 @@ http_operation_js_1.HttpOperation.Entity.UpdateMany = function (arg0, arg1) {
326
350
  filterType.rules = {};
327
351
  const filterRules = new filter_rules_js_1.FilterRules();
328
352
  const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, (0, index_js_1.omitUndefined)({
329
- description: args.description,
330
353
  method: 'PATCH',
354
+ ...args,
331
355
  composition: 'Entity.UpdateMany',
332
356
  requestBody: {
333
357
  immediateFetch: true,
@@ -381,8 +405,8 @@ http_operation_js_1.HttpOperation.Entity.Update = function (arg0, arg1) {
381
405
  const filterType = new index_js_3.FilterType({ dataType: args.type });
382
406
  filterType.rules = {};
383
407
  const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, (0, index_js_1.omitUndefined)({
384
- description: args.description,
385
408
  method: 'PATCH',
409
+ ...args,
386
410
  composition: 'Entity.Update',
387
411
  requestBody: {
388
412
  partial: 'deep',
@@ -425,11 +449,23 @@ http_operation_js_1.HttpOperation.Entity.Update = function (arg0, arg1) {
425
449
  *
426
450
  */
427
451
  decorator.KeyParam = (name, prmOptions) => {
428
- decorator.PathParam(name, prmOptions);
452
+ const paramMeta = typeof prmOptions === 'string' || typeof prmOptions === 'function'
453
+ ? {
454
+ name,
455
+ location: 'path',
456
+ type: prmOptions,
457
+ keyParam: true,
458
+ }
459
+ : {
460
+ ...prmOptions,
461
+ name,
462
+ location: 'path',
463
+ keyParam: true,
464
+ };
465
+ decorator.PathParam(name, paramMeta);
429
466
  decoratorChain.push((meta) => {
430
- meta.path = (meta.path || '') + '@:' + name;
431
- meta.compositionOptions = meta.compositionOptions || {};
432
- meta.compositionOptions.keyParameter = name;
467
+ if (!meta.path?.includes(':' + name))
468
+ meta.path = (meta.path || '') + '@:' + name;
433
469
  });
434
470
  return decorator;
435
471
  };