@opra/common 1.0.0-alpha.1 → 1.0.0-alpha.11

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 (177) hide show
  1. package/browser.js +5535 -5248
  2. package/cjs/document/api-document.js +18 -12
  3. package/cjs/document/common/data-type-map.js +1 -1
  4. package/cjs/document/common/document-element.js +2 -1
  5. package/cjs/document/constants.js +1 -1
  6. package/cjs/document/data-type/api-field.js +7 -2
  7. package/cjs/document/data-type/complex-type-base.js +6 -1
  8. package/cjs/document/data-type/complex-type.js +8 -5
  9. package/cjs/document/data-type/data-type.js +2 -1
  10. package/cjs/document/data-type/enum-type.js +5 -2
  11. package/cjs/document/data-type/extended-types/base64.type.js +6 -1
  12. package/cjs/document/data-type/extended-types/date-string.type.js +10 -3
  13. package/cjs/document/data-type/extended-types/date-time-string.type.js +10 -3
  14. package/cjs/document/data-type/extended-types/date-time.type.js +10 -3
  15. package/cjs/document/data-type/extended-types/date.type.js +10 -3
  16. package/cjs/document/data-type/extended-types/email.type.js +24 -10
  17. package/cjs/document/data-type/extended-types/field-path.type.js +13 -7
  18. package/cjs/document/data-type/extended-types/filter.type.js +25 -20
  19. package/cjs/document/data-type/extended-types/object-id.type.js +6 -1
  20. package/cjs/document/data-type/extended-types/operation-result.type.js +20 -10
  21. package/cjs/document/data-type/extended-types/time.type.js +10 -3
  22. package/cjs/document/data-type/extended-types/url.type.js +6 -1
  23. package/cjs/document/data-type/extended-types/uuid.type.js +8 -2
  24. package/cjs/document/data-type/mapped-type.js +12 -5
  25. package/cjs/document/data-type/mixin-type.js +5 -1
  26. package/cjs/document/data-type/primitive-types/any.type.js +2 -1
  27. package/cjs/document/data-type/primitive-types/bigint.type.js +6 -1
  28. package/cjs/document/data-type/primitive-types/boolean.type.js +6 -1
  29. package/cjs/document/data-type/primitive-types/integer.type.js +6 -1
  30. package/cjs/document/data-type/primitive-types/null.type.js +6 -1
  31. package/cjs/document/data-type/primitive-types/number.type.js +10 -3
  32. package/cjs/document/data-type/primitive-types/object.type.js +2 -1
  33. package/cjs/document/data-type/primitive-types/string.type.js +14 -5
  34. package/cjs/document/data-type/simple-type.js +16 -10
  35. package/cjs/document/data-type/utils/create-mapped-class.js +2 -1
  36. package/cjs/document/decorators/http-controller.decorator.js +25 -0
  37. package/cjs/document/decorators/http-operation-entity.decorator.js +55 -19
  38. package/cjs/document/decorators/http-operation.decorator.js +8 -4
  39. package/cjs/document/factory/api-document.factory.js +6 -3
  40. package/cjs/document/factory/data-type.factory.js +98 -57
  41. package/cjs/document/factory/http-api.factory.js +4 -2
  42. package/cjs/document/http/http-api.js +2 -2
  43. package/cjs/document/http/http-controller.js +25 -13
  44. package/cjs/document/http/http-media-type.js +4 -2
  45. package/cjs/document/http/http-operation-response.js +2 -1
  46. package/cjs/document/http/http-operation.js +18 -4
  47. package/cjs/document/http/http-parameter.js +2 -0
  48. package/cjs/document/http/http-status-range.js +1 -2
  49. package/cjs/document/index.js +5 -5
  50. package/cjs/exception/index.js +5 -5
  51. package/cjs/filter/antlr/OpraFilterParser.js +28 -82
  52. package/cjs/filter/ast/index.js +1 -1
  53. package/cjs/filter/build.js +1 -3
  54. package/cjs/filter/filter-rules.js +4 -2
  55. package/cjs/filter/opra-filter.ns.js +2 -2
  56. package/cjs/filter/parse.js +1 -3
  57. package/cjs/helpers/mixin-utils.js +2 -1
  58. package/cjs/helpers/monkey-patches.js +4 -2
  59. package/cjs/helpers/parse-fields-projection.js +1 -3
  60. package/cjs/helpers/responsive-map.js +5 -4
  61. package/cjs/i18n/i18n.js +4 -3
  62. package/cjs/i18n/index.js +1 -1
  63. package/cjs/index.js +1 -1
  64. package/esm/document/api-document.js +18 -12
  65. package/esm/document/common/data-type-map.js +1 -1
  66. package/esm/document/common/document-element.js +2 -1
  67. package/esm/document/constants.js +1 -1
  68. package/esm/document/data-type/api-field.js +7 -2
  69. package/esm/document/data-type/complex-type-base.js +6 -1
  70. package/esm/document/data-type/complex-type.js +8 -5
  71. package/esm/document/data-type/data-type.js +2 -1
  72. package/esm/document/data-type/enum-type.js +5 -2
  73. package/esm/document/data-type/extended-types/base64.type.js +7 -2
  74. package/esm/document/data-type/extended-types/date-string.type.js +11 -4
  75. package/esm/document/data-type/extended-types/date-time-string.type.js +11 -4
  76. package/esm/document/data-type/extended-types/date-time.type.js +11 -4
  77. package/esm/document/data-type/extended-types/date.type.js +11 -4
  78. package/esm/document/data-type/extended-types/email.type.js +25 -11
  79. package/esm/document/data-type/extended-types/field-path.type.js +14 -8
  80. package/esm/document/data-type/extended-types/filter.type.js +26 -21
  81. package/esm/document/data-type/extended-types/object-id.type.js +7 -2
  82. package/esm/document/data-type/extended-types/operation-result.type.js +21 -11
  83. package/esm/document/data-type/extended-types/time.type.js +11 -4
  84. package/esm/document/data-type/extended-types/url.type.js +7 -2
  85. package/esm/document/data-type/extended-types/uuid.type.js +9 -3
  86. package/esm/document/data-type/mapped-type.js +12 -5
  87. package/esm/document/data-type/mixin-type.js +5 -1
  88. package/esm/document/data-type/primitive-types/any.type.js +3 -2
  89. package/esm/document/data-type/primitive-types/bigint.type.js +7 -2
  90. package/esm/document/data-type/primitive-types/boolean.type.js +7 -2
  91. package/esm/document/data-type/primitive-types/integer.type.js +7 -2
  92. package/esm/document/data-type/primitive-types/null.type.js +7 -2
  93. package/esm/document/data-type/primitive-types/number.type.js +11 -4
  94. package/esm/document/data-type/primitive-types/object.type.js +3 -2
  95. package/esm/document/data-type/primitive-types/string.type.js +15 -6
  96. package/esm/document/data-type/simple-type.js +16 -10
  97. package/esm/document/data-type/utils/create-mapped-class.js +2 -1
  98. package/esm/document/decorators/http-controller.decorator.js +25 -0
  99. package/esm/document/decorators/http-operation-entity.decorator.js +55 -19
  100. package/esm/document/decorators/http-operation.decorator.js +8 -4
  101. package/esm/document/factory/api-document.factory.js +5 -3
  102. package/esm/document/factory/data-type.factory.js +98 -57
  103. package/esm/document/factory/http-api.factory.js +4 -2
  104. package/esm/document/http/http-api.js +2 -2
  105. package/esm/document/http/http-controller.js +24 -13
  106. package/esm/document/http/http-media-type.js +4 -2
  107. package/esm/document/http/http-operation-response.js +2 -1
  108. package/esm/document/http/http-operation.js +17 -4
  109. package/esm/document/http/http-parameter.js +2 -0
  110. package/esm/document/http/http-status-range.js +1 -2
  111. package/esm/document/index.js +5 -5
  112. package/esm/exception/index.js +5 -5
  113. package/esm/filter/antlr/OpraFilterParser.js +28 -82
  114. package/esm/filter/ast/index.js +1 -1
  115. package/esm/filter/build.js +1 -3
  116. package/esm/filter/filter-rules.js +4 -2
  117. package/esm/filter/opra-filter.ns.js +2 -2
  118. package/esm/filter/parse.js +1 -3
  119. package/esm/helpers/mixin-utils.js +2 -1
  120. package/esm/helpers/monkey-patches.js +4 -2
  121. package/esm/helpers/parse-fields-projection.js +1 -3
  122. package/esm/helpers/responsive-map.js +5 -4
  123. package/esm/i18n/i18n.js +4 -3
  124. package/esm/i18n/index.js +1 -1
  125. package/esm/index.js +1 -1
  126. package/package.json +8 -7
  127. package/types/document/api-document.d.ts +3 -6
  128. package/types/document/data-type/api-field.d.ts +2 -0
  129. package/types/document/data-type/complex-type.d.ts +1 -1
  130. package/types/document/data-type/data-type.d.ts +4 -2
  131. package/types/document/data-type/enum-type.d.ts +2 -2
  132. package/types/document/data-type/mapped-type.d.ts +2 -2
  133. package/types/document/data-type/mixin-type.d.ts +2 -2
  134. package/types/document/data-type/simple-type.d.ts +4 -2
  135. package/types/document/decorators/http-controller.decorator.d.ts +1 -0
  136. package/types/document/factory/api-document.factory.d.ts +1 -1
  137. package/types/document/factory/data-type.factory.d.ts +5 -0
  138. package/types/document/http/http-controller.d.ts +1 -0
  139. package/types/document/http/http-operation.d.ts +1 -0
  140. package/types/document/http/http-parameter.d.ts +3 -2
  141. package/types/document/index.d.ts +5 -5
  142. package/types/exception/index.d.ts +5 -5
  143. package/types/filter/ast/index.d.ts +1 -1
  144. package/types/filter/opra-filter.ns.d.ts +2 -2
  145. package/types/i18n/i18n.d.ts +21 -19
  146. package/types/index.d.ts +1 -1
  147. package/types/schema/data-type/simple-type.interface.d.ts +4 -0
  148. package/types/schema/document.interface.d.ts +13 -1
  149. package/types/schema/http/http-parameter.interface.d.ts +4 -0
  150. package/types/schema/index.d.ts +1 -0
  151. package/cjs/document/data-type/decorators/api-field-decorator.js +0 -26
  152. package/cjs/document/data-type/decorators/complex-type.decorator.js +0 -33
  153. package/cjs/document/data-type/decorators/simple-type.decorator.js +0 -67
  154. package/cjs/document/http/decorators/http-controller.decorator.js +0 -117
  155. package/cjs/document/http/decorators/http-operation-entity.decorator.js +0 -461
  156. package/cjs/document/http/decorators/http-operation.decorator.js +0 -183
  157. package/cjs/helpers/is-url-string.js +0 -12
  158. package/cjs/http/opra-url-path.js +0 -266
  159. package/cjs/http/opra-url.js +0 -253
  160. package/esm/document/data-type/decorators/api-field-decorator.js +0 -22
  161. package/esm/document/data-type/decorators/complex-type.decorator.js +0 -28
  162. package/esm/document/data-type/decorators/simple-type.decorator.js +0 -61
  163. package/esm/document/http/decorators/http-controller.decorator.js +0 -112
  164. package/esm/document/http/decorators/http-operation-entity.decorator.js +0 -459
  165. package/esm/document/http/decorators/http-operation.decorator.js +0 -178
  166. package/esm/helpers/is-url-string.js +0 -7
  167. package/esm/http/opra-url-path.js +0 -260
  168. package/esm/http/opra-url.js +0 -249
  169. package/types/document/data-type/decorators/api-field-decorator.d.ts +0 -5
  170. package/types/document/data-type/decorators/complex-type.decorator.d.ts +0 -2
  171. package/types/document/data-type/decorators/simple-type.decorator.d.ts +0 -20
  172. package/types/document/http/decorators/http-controller.decorator.d.ts +0 -14
  173. package/types/document/http/decorators/http-operation-entity.decorator.d.ts +0 -100
  174. package/types/document/http/decorators/http-operation.decorator.d.ts +0 -30
  175. package/types/helpers/is-url-string.d.ts +0 -2
  176. package/types/http/opra-url-path.d.ts +0 -55
  177. package/types/http/opra-url.d.ts +0 -66
@@ -26,11 +26,13 @@ export const ComplexType = function (...args) {
26
26
  if (initArgs.base) {
27
27
  context.enter('.base', () => {
28
28
  // noinspection SuspiciousTypeOfGuard
29
- if (!(initArgs.base instanceof ComplexTypeBase))
29
+ if (!(initArgs.base instanceof ComplexTypeBase)) {
30
30
  throw new TypeError(`"${initArgs.base.kind}" can't be set as base for a "${this.kind}"`);
31
+ }
31
32
  _this.base = initArgs.base;
32
- if (_this.additionalFields == null && _this.base.additionalFields)
33
+ if (_this.additionalFields == null && _this.base.additionalFields) {
33
34
  _this.additionalFields = _this.base.additionalFields;
35
+ }
34
36
  /** Copy fields from base */
35
37
  for (const v of _this.base.fields.values()) {
36
38
  this.fields.set(v.name, new ApiField(this, v));
@@ -57,6 +59,8 @@ export const ComplexType = function (...args) {
57
59
  */
58
60
  class ComplexTypeClass extends ComplexTypeBase {
59
61
  extendsFrom(baseType) {
62
+ if (!(baseType instanceof DataType))
63
+ baseType = this.node.getDataType(baseType);
60
64
  if (!(baseType instanceof ComplexTypeBase))
61
65
  return false;
62
66
  if (baseType === this)
@@ -72,9 +76,8 @@ class ComplexTypeClass extends ComplexTypeBase {
72
76
  });
73
77
  if (this.additionalFields) {
74
78
  if (this.additionalFields instanceof DataType) {
75
- out.additionalFields = this.additionalFields[1].name
76
- ? this.additionalFields[1].name
77
- : this.additionalFields[1].toJSON();
79
+ const typeName = this.node.getDataTypeNameWithNs(this.additionalFields);
80
+ out.additionalFields = typeName ? typeName : this.additionalFields.toJSON();
78
81
  }
79
82
  else
80
83
  out.additionalFields = this.additionalFields;
@@ -11,8 +11,9 @@ export const DataType = function (owner, initArgs,
11
11
  context) {
12
12
  if (!this)
13
13
  throw new TypeError('"this" should be passed to call class constructor');
14
- if (initArgs?.name && !CLASS_NAME_PATTERN.test(initArgs.name))
14
+ if (initArgs?.name && !CLASS_NAME_PATTERN.test(initArgs.name)) {
15
15
  throw new TypeError(`"${initArgs.name}" is not a valid DataType name`);
16
+ }
16
17
  DocumentElement.call(this, owner);
17
18
  const _this = asMutable(this);
18
19
  _this.kind = initArgs.kind;
@@ -19,8 +19,9 @@ export const EnumType = function (...args) {
19
19
  _this.kind = OpraSchema.EnumType.Kind;
20
20
  if (initArgs.base) {
21
21
  // noinspection SuspiciousTypeOfGuard
22
- if (!(initArgs.base instanceof EnumType))
23
- throw new TypeError(`"${initArgs.base.kind}" can't be set as base for a "${this.kind}"`);
22
+ if (!(initArgs.base instanceof EnumType)) {
23
+ throw new TypeError(`"${initArgs.base.kind}" can't be set as base for a "${_this.kind}"`);
24
+ }
24
25
  _this.base = initArgs.base;
25
26
  }
26
27
  _this.instance = initArgs.instance;
@@ -35,6 +36,8 @@ export const EnumType = function (...args) {
35
36
  */
36
37
  class EnumTypeClass extends DataType {
37
38
  extendsFrom(baseType) {
39
+ if (!(baseType instanceof DataType))
40
+ baseType = this.node.getDataType(baseType);
38
41
  if (!(baseType instanceof EnumType))
39
42
  return false;
40
43
  if (baseType === this)
@@ -1,4 +1,4 @@
1
- import { __decorate } from "tslib";
1
+ import { __decorate, __metadata } from "tslib";
2
2
  import { vg } from 'valgen';
3
3
  import { DECODER, ENCODER } from '../../constants.js';
4
4
  import { SimpleType } from '../simple-type.js';
@@ -17,6 +17,11 @@ let Base64Type = class Base64Type {
17
17
  Base64Type = __decorate([
18
18
  SimpleType({
19
19
  description: 'A stream of bytes, base64 encoded',
20
- })
20
+ nameMappings: {
21
+ js: 'string',
22
+ json: 'string',
23
+ },
24
+ }),
25
+ __metadata("design:paramtypes", [Object])
21
26
  ], Base64Type);
22
27
  export { Base64Type };
@@ -1,4 +1,4 @@
1
- import { __decorate } from "tslib";
1
+ import { __decorate, __metadata } from "tslib";
2
2
  import { vg } from 'valgen';
3
3
  import { DECODER, ENCODER } from '../../constants.js';
4
4
  import { SimpleType } from '../simple-type.js';
@@ -23,19 +23,26 @@ let DateStringType = class DateStringType {
23
23
  __decorate([
24
24
  SimpleType.Attribute({
25
25
  description: 'Minimum value',
26
- })
26
+ }),
27
+ __metadata("design:type", String)
27
28
  ], DateStringType.prototype, "minValue", void 0);
28
29
  __decorate([
29
30
  SimpleType.Attribute({
30
31
  description: 'Maximum value',
31
- })
32
+ }),
33
+ __metadata("design:type", String)
32
34
  ], DateStringType.prototype, "maxValue", void 0);
33
35
  DateStringType = __decorate([
34
36
  SimpleType({
35
37
  description: 'Date string value',
38
+ nameMappings: {
39
+ js: 'string',
40
+ json: 'string',
41
+ },
36
42
  })
37
43
  .Example('2021-04-18', 'Full date value')
38
44
  .Example('2021-04', 'Date value without day')
39
- .Example('2021', 'Year only value')
45
+ .Example('2021', 'Year only value'),
46
+ __metadata("design:paramtypes", [Object])
40
47
  ], DateStringType);
41
48
  export { DateStringType };
@@ -1,4 +1,4 @@
1
- import { __decorate } from "tslib";
1
+ import { __decorate, __metadata } from "tslib";
2
2
  import { vg } from 'valgen';
3
3
  import { DECODER, ENCODER } from '../../constants.js';
4
4
  import { SimpleType } from '../simple-type.js';
@@ -23,22 +23,29 @@ let DateTimeStringType = class DateTimeStringType {
23
23
  __decorate([
24
24
  SimpleType.Attribute({
25
25
  description: 'Minimum value',
26
- })
26
+ }),
27
+ __metadata("design:type", String)
27
28
  ], DateTimeStringType.prototype, "minValue", void 0);
28
29
  __decorate([
29
30
  SimpleType.Attribute({
30
31
  description: 'Maximum value',
31
- })
32
+ }),
33
+ __metadata("design:type", String)
32
34
  ], DateTimeStringType.prototype, "maxValue", void 0);
33
35
  DateTimeStringType = __decorate([
34
36
  SimpleType({
35
37
  description: 'DateTime string value',
38
+ nameMappings: {
39
+ js: 'string',
40
+ json: 'string',
41
+ },
36
42
  })
37
43
  .Example('2021-04-18T22:30:15+01:00', 'Full date-time value with timezone')
38
44
  .Example('2021-04-18T22:30:15', 'Full date-time value without timezone')
39
45
  .Example('2021-04-18 22:30', 'Date-time value')
40
46
  .Example('2021-04-18', 'Date value')
41
47
  .Example('2021-04', 'Date value without day')
42
- .Example('2021', 'Year only value')
48
+ .Example('2021', 'Year only value'),
49
+ __metadata("design:paramtypes", [Object])
43
50
  ], DateTimeStringType);
44
51
  export { DateTimeStringType };
@@ -1,4 +1,4 @@
1
- import { __decorate } from "tslib";
1
+ import { __decorate, __metadata } from "tslib";
2
2
  import { isDateString, toString, vg } from 'valgen';
3
3
  import { DECODER, ENCODER } from '../../constants.js';
4
4
  import { SimpleType } from '../simple-type.js';
@@ -37,19 +37,26 @@ let DateTimeType = class DateTimeType {
37
37
  __decorate([
38
38
  SimpleType.Attribute({
39
39
  description: 'Minimum value',
40
- })
40
+ }),
41
+ __metadata("design:type", String)
41
42
  ], DateTimeType.prototype, "minValue", void 0);
42
43
  __decorate([
43
44
  SimpleType.Attribute({
44
45
  description: 'Maximum value',
45
- })
46
+ }),
47
+ __metadata("design:type", String)
46
48
  ], DateTimeType.prototype, "maxValue", void 0);
47
49
  DateTimeType = __decorate([
48
50
  SimpleType({
49
51
  description: 'A full datetime value',
52
+ nameMappings: {
53
+ js: 'string',
54
+ json: 'string',
55
+ },
50
56
  })
51
57
  .Example('2021-04-18T22:30:15')
52
58
  .Example('2021-04-18 22:30:15')
53
- .Example('2021-04-18 22:30')
59
+ .Example('2021-04-18 22:30'),
60
+ __metadata("design:paramtypes", [Object])
54
61
  ], DateTimeType);
55
62
  export { DateTimeType };
@@ -1,4 +1,4 @@
1
- import { __decorate } from "tslib";
1
+ import { __decorate, __metadata } from "tslib";
2
2
  import { isDateString, toString, vg } from 'valgen';
3
3
  import { DECODER, ENCODER } from '../../constants.js';
4
4
  import { SimpleType } from '../simple-type.js';
@@ -37,16 +37,23 @@ let DateType = class DateType {
37
37
  __decorate([
38
38
  SimpleType.Attribute({
39
39
  description: 'Minimum value',
40
- })
40
+ }),
41
+ __metadata("design:type", String)
41
42
  ], DateType.prototype, "minValue", void 0);
42
43
  __decorate([
43
44
  SimpleType.Attribute({
44
45
  description: 'Maximum value',
45
- })
46
+ }),
47
+ __metadata("design:type", String)
46
48
  ], DateType.prototype, "maxValue", void 0);
47
49
  DateType = __decorate([
48
50
  SimpleType({
49
51
  description: 'A date without time',
50
- }).Example('2021-04-18', 'Full date value')
52
+ nameMappings: {
53
+ js: 'Date',
54
+ json: 'string',
55
+ },
56
+ }).Example('2021-04-18', 'Full date value'),
57
+ __metadata("design:paramtypes", [Object])
51
58
  ], DateType);
52
59
  export { DateType };
@@ -1,4 +1,4 @@
1
- import { __decorate } from "tslib";
1
+ import { __decorate, __metadata } from "tslib";
2
2
  import { vg } from 'valgen';
3
3
  import { DECODER, ENCODER } from '../../constants.js';
4
4
  import { SimpleType } from '../simple-type.js';
@@ -18,60 +18,74 @@ __decorate([
18
18
  SimpleType.Attribute({
19
19
  description: 'If set to `true`, the validator will also match `Display Name <email-address>',
20
20
  default: false,
21
- })
21
+ }),
22
+ __metadata("design:type", Boolean)
22
23
  ], EmailType.prototype, "allowDisplayName", void 0);
23
24
  __decorate([
24
25
  SimpleType.Attribute({
25
26
  description: 'If set to `true`, the validator will reject strings without the format `Display Name <email-address>',
26
27
  default: false,
27
- })
28
+ }),
29
+ __metadata("design:type", Boolean)
28
30
  ], EmailType.prototype, "requireDisplayName", void 0);
29
31
  __decorate([
30
32
  SimpleType.Attribute({
31
33
  description: "If set to `false`, the validator will not allow any non-English UTF8 character in email address's local part",
32
34
  default: true,
33
- })
35
+ }),
36
+ __metadata("design:type", Boolean)
34
37
  ], EmailType.prototype, "utf8LocalPart", void 0);
35
38
  __decorate([
36
39
  SimpleType.Attribute({
37
40
  description: 'If set to `true`, the validator will not check for the standard max length of an email',
38
41
  default: false,
39
- })
42
+ }),
43
+ __metadata("design:type", Boolean)
40
44
  ], EmailType.prototype, "ignoreMaxLength", void 0);
41
45
  __decorate([
42
46
  SimpleType.Attribute({
43
47
  description: 'If set to `true`, the validator will allow IP addresses in the host part',
44
48
  default: false,
45
- })
49
+ }),
50
+ __metadata("design:type", Boolean)
46
51
  ], EmailType.prototype, "allowIpDomain", void 0);
47
52
  __decorate([
48
53
  SimpleType.Attribute({
49
54
  description: 'If set to `true`, some additional validation will be enabled, ' +
50
55
  'e.g. disallowing certain syntactically valid email addresses that are rejected by GMail.',
51
56
  default: false,
52
- })
57
+ }),
58
+ __metadata("design:type", Boolean)
53
59
  ], EmailType.prototype, "domainSpecificValidation", void 0);
54
60
  __decorate([
55
61
  SimpleType.Attribute({
56
62
  description: 'If set to an array of strings and the part of the email after the @ symbol ' +
57
63
  ' one of the strings defined in it, the validation fails.',
58
- })
64
+ }),
65
+ __metadata("design:type", Array)
59
66
  ], EmailType.prototype, "hostBlacklist", void 0);
60
67
  __decorate([
61
68
  SimpleType.Attribute({
62
69
  description: 'If set to an array of strings and the part of the email after the @ symbol ' +
63
70
  ' matches none of the strings defined in it, the validation fails.',
64
- })
71
+ }),
72
+ __metadata("design:type", Array)
65
73
  ], EmailType.prototype, "hostWhitelist", void 0);
66
74
  __decorate([
67
75
  SimpleType.Attribute({
68
76
  description: 'If set to a string, then the validator will reject emails that include ' +
69
77
  ' any of the characters in the string, in the name part.',
70
- })
78
+ }),
79
+ __metadata("design:type", String)
71
80
  ], EmailType.prototype, "blacklistedChars", void 0);
72
81
  EmailType = __decorate([
73
82
  SimpleType({
74
83
  description: 'An email value',
75
- }).Example('some.body@example.com')
84
+ nameMappings: {
85
+ js: 'string',
86
+ json: 'string',
87
+ },
88
+ }).Example('some.body@example.com'),
89
+ __metadata("design:paramtypes", [Object])
76
90
  ], EmailType);
77
91
  export { EmailType };
@@ -1,4 +1,4 @@
1
- import { __decorate } from "tslib";
1
+ import { __decorate, __metadata } from "tslib";
2
2
  import { toString, validator, vg } from 'valgen';
3
3
  import { DECODER, ENCODER } from '../../constants.js';
4
4
  import { SimpleType } from '../simple-type.js';
@@ -12,9 +12,7 @@ let FieldPathType = class FieldPathType {
12
12
  ? element.node.getComplexType(properties.dataType)
13
13
  : element.node.getComplexType('object');
14
14
  const allowSigns = properties.allowSigns;
15
- const decodeFieldPath = validator('decodeFieldPath', function (input) {
16
- return dataType.normalizeFieldPath(input, { allowSigns });
17
- });
15
+ const decodeFieldPath = validator('decodeFieldPath', (input) => dataType.normalizeFieldPath(input, { allowSigns }));
18
16
  return vg.pipe([toString, decodeFieldPath]);
19
17
  }
20
18
  [ENCODER](properties, element) {
@@ -24,8 +22,9 @@ let FieldPathType = class FieldPathType {
24
22
  const dataType = properties.dataType
25
23
  ? element.node.getComplexType(properties.dataType)
26
24
  : element.node.getComplexType('object');
25
+ const typeName = dataType ? element.node.getDataTypeNameWithNs(dataType) : undefined;
27
26
  return {
28
- dataType: dataType.name ? dataType.name : dataType.toJSON(),
27
+ dataType: typeName ? typeName : dataType.toJSON(),
29
28
  allowSigns: properties.allowSigns,
30
29
  };
31
30
  }
@@ -33,18 +32,25 @@ let FieldPathType = class FieldPathType {
33
32
  __decorate([
34
33
  SimpleType.Attribute({
35
34
  description: 'Data type which field belong to',
36
- })
35
+ }),
36
+ __metadata("design:type", Object)
37
37
  ], FieldPathType.prototype, "dataType", void 0);
38
38
  __decorate([
39
39
  SimpleType.Attribute({
40
40
  description: 'Determines if signs (+,-) are allowed. ' +
41
41
  'If set "first" signs are allowed only beginning of the field path' +
42
42
  'If set "each" signs are allowed at each field in the path',
43
- })
43
+ }),
44
+ __metadata("design:type", String)
44
45
  ], FieldPathType.prototype, "allowSigns", void 0);
45
46
  FieldPathType = __decorate([
46
47
  SimpleType({
47
48
  description: 'Field path',
48
- })
49
+ nameMappings: {
50
+ js: 'string',
51
+ json: 'string',
52
+ },
53
+ }),
54
+ __metadata("design:paramtypes", [Object])
49
55
  ], FieldPathType);
50
56
  export { FieldPathType };
@@ -1,4 +1,4 @@
1
- import { __decorate } from "tslib";
1
+ import { __decorate, __metadata } from "tslib";
2
2
  import { validator } from 'valgen';
3
3
  import { FilterRules } from '../../../filter/filter-rules.js';
4
4
  import { OpraFilter } from '../../../filter/index.js';
@@ -32,38 +32,43 @@ let FilterType = class FilterType {
32
32
  __decorate([
33
33
  SimpleType.Attribute({
34
34
  description: 'Data type which filtering fields belong to',
35
- })
35
+ }),
36
+ __metadata("design:type", Object)
36
37
  ], FilterType.prototype, "dataType", void 0);
37
38
  __decorate([
38
39
  SimpleType.Attribute({
39
40
  description: 'Stringified JSON object defines filtering rules',
40
41
  format: 'string',
41
- })
42
+ }),
43
+ __metadata("design:type", Object)
42
44
  ], FilterType.prototype, "rules", void 0);
43
45
  FilterType = __decorate([
44
46
  SimpleType({
45
47
  description: 'A query filter',
46
- })
48
+ nameMappings: {
49
+ js: 'object',
50
+ json: 'string',
51
+ },
52
+ }),
53
+ __metadata("design:paramtypes", [Object])
47
54
  ], FilterType);
48
55
  export { FilterType };
49
- const decodeFilter = (dataType, rules) => {
50
- return validator('decodeFilter', function (input, context, _this) {
51
- if (typeof input === 'string') {
52
- try {
53
- const filter = OpraFilter.parse(input);
54
- if (rules)
55
- return rules.normalizeFilter(filter, dataType);
56
- return filter;
57
- }
58
- catch (e) {
59
- context.fail(_this, `Not a valid filter expression. ${e.message}`, input, e.errors);
60
- return;
61
- }
56
+ const decodeFilter = (dataType, rules) => validator('decodeFilter', (input, context, _this) => {
57
+ if (typeof input === 'string') {
58
+ try {
59
+ const filter = OpraFilter.parse(input);
60
+ if (rules)
61
+ return rules.normalizeFilter(filter, dataType);
62
+ return filter;
62
63
  }
63
- context.fail(_this, `Nt a valid filter expression string`, input);
64
- });
65
- };
66
- const encodeFilter = validator('encodeFilter', function (input, context, _this) {
64
+ catch (e) {
65
+ context.fail(_this, `Not a valid filter expression. ${e.message}`, input, e.errors);
66
+ return;
67
+ }
68
+ }
69
+ context.fail(_this, `Nt a valid filter expression string`, input);
70
+ });
71
+ const encodeFilter = validator('encodeFilter', (input, context, _this) => {
67
72
  if (input instanceof OpraFilter.Ast) {
68
73
  return input.toString();
69
74
  }
@@ -1,4 +1,4 @@
1
- import { __decorate } from "tslib";
1
+ import { __decorate, __metadata } from "tslib";
2
2
  import { vg } from 'valgen';
3
3
  import { DECODER, ENCODER } from '../../constants.js';
4
4
  import { SimpleType } from '../simple-type.js';
@@ -17,6 +17,11 @@ let ObjectIdType = class ObjectIdType {
17
17
  ObjectIdType = __decorate([
18
18
  SimpleType({
19
19
  description: 'A MongoDB ObjectID value',
20
- })
20
+ nameMappings: {
21
+ js: 'object',
22
+ json: 'string',
23
+ },
24
+ }),
25
+ __metadata("design:paramtypes", [Object])
21
26
  ], ObjectIdType);
22
27
  export { ObjectIdType };
@@ -1,4 +1,4 @@
1
- import { __decorate } from "tslib";
1
+ import { __decorate, __metadata } from "tslib";
2
2
  import { ApiField } from '../api-field.js';
3
3
  import { ComplexType } from '../complex-type.js';
4
4
  let OperationResult = class OperationResult {
@@ -8,30 +8,38 @@ let OperationResult = class OperationResult {
8
8
  }
9
9
  };
10
10
  __decorate([
11
- ApiField()
11
+ ApiField(),
12
+ __metadata("design:type", Number)
12
13
  ], OperationResult.prototype, "affected", void 0);
13
14
  __decorate([
14
- ApiField()
15
+ ApiField(),
16
+ __metadata("design:type", Number)
15
17
  ], OperationResult.prototype, "totalMatches", void 0);
16
18
  __decorate([
17
- ApiField()
19
+ ApiField(),
20
+ __metadata("design:type", String)
18
21
  ], OperationResult.prototype, "context", void 0);
19
22
  __decorate([
20
- ApiField()
23
+ ApiField(),
24
+ __metadata("design:type", String)
21
25
  ], OperationResult.prototype, "type", void 0);
22
26
  __decorate([
23
- ApiField()
27
+ ApiField(),
28
+ __metadata("design:type", String)
24
29
  ], OperationResult.prototype, "message", void 0);
25
30
  __decorate([
26
- ApiField({ type: 'any' })
31
+ ApiField({ type: 'any' }),
32
+ __metadata("design:type", Object)
27
33
  ], OperationResult.prototype, "payload", void 0);
28
34
  __decorate([
29
- ApiField({ type: 'object' })
35
+ ApiField({ type: 'object' }),
36
+ __metadata("design:type", Array)
30
37
  ], OperationResult.prototype, "errors", void 0);
31
38
  OperationResult = __decorate([
32
39
  ComplexType({
33
40
  description: 'Operation result',
34
- })
41
+ }),
42
+ __metadata("design:paramtypes", [Object])
35
43
  ], OperationResult);
36
44
  export { OperationResult };
37
45
  (function (OperationResult) {
@@ -42,10 +50,12 @@ export { OperationResult };
42
50
  }
43
51
  };
44
52
  __decorate([
45
- ApiField({ type, required: true })
53
+ ApiField({ type, required: true }),
54
+ __metadata("design:type", Object)
46
55
  ], OperationResult_.prototype, "payload", void 0);
47
56
  OperationResult_ = __decorate([
48
- ComplexType({ embedded: true })
57
+ ComplexType({ embedded: true }),
58
+ __metadata("design:paramtypes", [Object])
49
59
  ], OperationResult_);
50
60
  return OperationResult_;
51
61
  }
@@ -1,4 +1,4 @@
1
- import { __decorate } from "tslib";
1
+ import { __decorate, __metadata } from "tslib";
2
2
  import { vg } from 'valgen';
3
3
  import { DECODER, ENCODER } from '../../constants.js';
4
4
  import { SimpleType } from '../simple-type.js';
@@ -27,18 +27,25 @@ let TimeType = class TimeType {
27
27
  __decorate([
28
28
  SimpleType.Attribute({
29
29
  description: 'Minimum value',
30
- })
30
+ }),
31
+ __metadata("design:type", String)
31
32
  ], TimeType.prototype, "minValue", void 0);
32
33
  __decorate([
33
34
  SimpleType.Attribute({
34
35
  description: 'Maximum value',
35
- })
36
+ }),
37
+ __metadata("design:type", String)
36
38
  ], TimeType.prototype, "maxValue", void 0);
37
39
  TimeType = __decorate([
38
40
  SimpleType({
39
41
  description: 'Time string in 24h format',
42
+ nameMappings: {
43
+ js: 'string',
44
+ json: 'string',
45
+ },
40
46
  })
41
47
  .Example('18:23:00', 'Full time value')
42
- .Example('18:23:00', 'Time value without seconds')
48
+ .Example('18:23:00', 'Time value without seconds'),
49
+ __metadata("design:paramtypes", [Object])
43
50
  ], TimeType);
44
51
  export { TimeType };
@@ -1,4 +1,4 @@
1
- import { __decorate } from "tslib";
1
+ import { __decorate, __metadata } from "tslib";
2
2
  import { vg } from 'valgen';
3
3
  import { DECODER, ENCODER } from '../../constants.js';
4
4
  import { SimpleType } from '../simple-type.js';
@@ -17,6 +17,11 @@ let UrlType = class UrlType {
17
17
  UrlType = __decorate([
18
18
  SimpleType({
19
19
  description: 'A Uniform Resource Identifier Reference (RFC 3986 icon) value',
20
- }).Example('http://tempuri.org')
20
+ nameMappings: {
21
+ js: 'string',
22
+ json: 'string',
23
+ },
24
+ }).Example('http://tempuri.org'),
25
+ __metadata("design:paramtypes", [Object])
21
26
  ], UrlType);
22
27
  export { UrlType };
@@ -1,4 +1,4 @@
1
- import { __decorate } from "tslib";
1
+ import { __decorate, __metadata } from "tslib";
2
2
  import { vg } from 'valgen';
3
3
  import { DECODER, ENCODER } from '../../constants.js';
4
4
  import { SimpleType } from '../simple-type.js';
@@ -17,11 +17,17 @@ let UuidType = class UuidType {
17
17
  __decorate([
18
18
  SimpleType.Attribute({
19
19
  description: 'Version of the UUID',
20
- })
20
+ }),
21
+ __metadata("design:type", Number)
21
22
  ], UuidType.prototype, "version", void 0);
22
23
  UuidType = __decorate([
23
24
  SimpleType({
24
25
  description: 'A Universal Unique Identifier (UUID) value',
25
- })
26
+ nameMappings: {
27
+ js: 'string',
28
+ json: 'string',
29
+ },
30
+ }),
31
+ __metadata("design:paramtypes", [Object])
26
32
  ], UuidType);
27
33
  export { UuidType };