@opra/common 1.0.0-alpha.16 → 1.0.0-alpha.18

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 (51) hide show
  1. package/cjs/document/data-type/extended-types/date-string.type.js +2 -2
  2. package/cjs/document/data-type/extended-types/date-time-string.type.js +2 -2
  3. package/cjs/document/data-type/extended-types/date-time.type.js +2 -2
  4. package/cjs/document/data-type/extended-types/date.type.js +2 -2
  5. package/cjs/document/data-type/extended-types/email.type.js +2 -2
  6. package/cjs/document/data-type/extended-types/time.type.js +2 -2
  7. package/cjs/document/data-type/extended-types/url.type.js +2 -2
  8. package/cjs/document/data-type/omit-type.js +1 -2
  9. package/cjs/document/data-type/partial-type.js +1 -2
  10. package/cjs/document/data-type/pick-type.js +1 -2
  11. package/cjs/document/data-type/required-type.js +1 -2
  12. package/cjs/document/data-type/utils/create-mapped-class.js +1 -2
  13. package/cjs/document/data-type/utils/get-is-inherited-predicate-fn.js +1 -2
  14. package/cjs/document/decorators/api-field-decorator.js +1 -2
  15. package/cjs/document/decorators/complex-type.decorator.js +1 -2
  16. package/cjs/document/decorators/http-controller.decorator.js +1 -2
  17. package/cjs/document/decorators/http-operation.decorator.js +1 -2
  18. package/cjs/document/decorators/simple-type.decorator.js +2 -3
  19. package/cjs/document/utils/parse-regexp.util.js +1 -2
  20. package/cjs/document/utils/string-compare.util.js +1 -2
  21. package/cjs/filter/build.js +21 -22
  22. package/cjs/filter/parse.js +1 -2
  23. package/cjs/filter/utils.js +2 -3
  24. package/cjs/helpers/function-utils.js +1 -2
  25. package/cjs/helpers/get-stack-filename.js +2 -3
  26. package/cjs/helpers/mixin-utils.js +2 -3
  27. package/cjs/helpers/object-utils.js +3 -4
  28. package/cjs/helpers/parse-fields-projection.js +3 -3
  29. package/cjs/helpers/type-guards.js +10 -11
  30. package/cjs/i18n/string-utils.js +2 -3
  31. package/cjs/i18n/translate.js +1 -2
  32. package/cjs/schema/type-guards.js +7 -8
  33. package/esm/document/data-type/extended-types/date-string.type.js +2 -2
  34. package/esm/document/data-type/extended-types/date-time-string.type.js +2 -2
  35. package/esm/document/data-type/extended-types/date-time.type.js +2 -2
  36. package/esm/document/data-type/extended-types/date.type.js +2 -2
  37. package/esm/document/data-type/extended-types/email.type.js +2 -2
  38. package/esm/document/data-type/extended-types/time.type.js +2 -2
  39. package/esm/document/data-type/extended-types/url.type.js +2 -2
  40. package/package.json +2 -2
  41. package/types/document/data-type/mapped-type.d.ts +1 -1
  42. package/types/helpers/type-guards.d.ts +0 -2
  43. package/types/schema/data-type/data-type.interface.d.ts +1 -1
  44. package/types/schema/data-type/mapped-type.interface.d.ts +2 -2
  45. package/types/schema/data-type-container.interface.d.ts +1 -1
  46. package/types/schema/document.interface.d.ts +1 -1
  47. package/types/schema/http/http-controller.interface.d.ts +2 -2
  48. package/types/schema/http/http-media-type.interface.d.ts +1 -1
  49. package/types/schema/http/http-operation-response.interface.d.ts +2 -2
  50. package/types/schema/http/http-operation.interface.d.ts +4 -4
  51. package/types/schema/http/http-parameter.interface.d.ts +1 -1
@@ -37,7 +37,7 @@ tslib_1.__decorate([
37
37
  tslib_1.__metadata("design:type", String)
38
38
  ], DateStringType.prototype, "maxValue", void 0);
39
39
  exports.DateStringType = DateStringType = tslib_1.__decorate([
40
- (0, simple_type_js_1.SimpleType)({
40
+ ((0, simple_type_js_1.SimpleType)({
41
41
  description: 'Date string value',
42
42
  nameMappings: {
43
43
  js: 'string',
@@ -46,6 +46,6 @@ exports.DateStringType = DateStringType = tslib_1.__decorate([
46
46
  })
47
47
  .Example('2021-04-18', 'Full date value')
48
48
  .Example('2021-04', 'Date value without day')
49
- .Example('2021', 'Year only value'),
49
+ .Example('2021', 'Year only value')),
50
50
  tslib_1.__metadata("design:paramtypes", [Object])
51
51
  ], DateStringType);
@@ -37,7 +37,7 @@ tslib_1.__decorate([
37
37
  tslib_1.__metadata("design:type", String)
38
38
  ], DateTimeStringType.prototype, "maxValue", void 0);
39
39
  exports.DateTimeStringType = DateTimeStringType = tslib_1.__decorate([
40
- (0, simple_type_js_1.SimpleType)({
40
+ ((0, simple_type_js_1.SimpleType)({
41
41
  description: 'DateTime string value',
42
42
  nameMappings: {
43
43
  js: 'string',
@@ -49,6 +49,6 @@ exports.DateTimeStringType = DateTimeStringType = tslib_1.__decorate([
49
49
  .Example('2021-04-18 22:30', 'Date-time value')
50
50
  .Example('2021-04-18', 'Date value')
51
51
  .Example('2021-04', 'Date value without day')
52
- .Example('2021', 'Year only value'),
52
+ .Example('2021', 'Year only value')),
53
53
  tslib_1.__metadata("design:paramtypes", [Object])
54
54
  ], DateTimeStringType);
@@ -51,7 +51,7 @@ tslib_1.__decorate([
51
51
  tslib_1.__metadata("design:type", String)
52
52
  ], DateTimeType.prototype, "maxValue", void 0);
53
53
  exports.DateTimeType = DateTimeType = tslib_1.__decorate([
54
- (0, simple_type_js_1.SimpleType)({
54
+ ((0, simple_type_js_1.SimpleType)({
55
55
  description: 'A full datetime value',
56
56
  nameMappings: {
57
57
  js: 'string',
@@ -60,6 +60,6 @@ exports.DateTimeType = DateTimeType = tslib_1.__decorate([
60
60
  })
61
61
  .Example('2021-04-18T22:30:15')
62
62
  .Example('2021-04-18 22:30:15')
63
- .Example('2021-04-18 22:30'),
63
+ .Example('2021-04-18 22:30')),
64
64
  tslib_1.__metadata("design:paramtypes", [Object])
65
65
  ], DateTimeType);
@@ -51,12 +51,12 @@ tslib_1.__decorate([
51
51
  tslib_1.__metadata("design:type", String)
52
52
  ], DateType.prototype, "maxValue", void 0);
53
53
  exports.DateType = DateType = tslib_1.__decorate([
54
- (0, simple_type_js_1.SimpleType)({
54
+ ((0, simple_type_js_1.SimpleType)({
55
55
  description: 'A date without time',
56
56
  nameMappings: {
57
57
  js: 'Date',
58
58
  json: 'string',
59
59
  },
60
- }).Example('2021-04-18', 'Full date value'),
60
+ }).Example('2021-04-18', 'Full date value')),
61
61
  tslib_1.__metadata("design:paramtypes", [Object])
62
62
  ], DateType);
@@ -83,12 +83,12 @@ tslib_1.__decorate([
83
83
  tslib_1.__metadata("design:type", String)
84
84
  ], EmailType.prototype, "blacklistedChars", void 0);
85
85
  exports.EmailType = EmailType = tslib_1.__decorate([
86
- (0, simple_type_js_1.SimpleType)({
86
+ ((0, simple_type_js_1.SimpleType)({
87
87
  description: 'An email value',
88
88
  nameMappings: {
89
89
  js: 'string',
90
90
  json: 'string',
91
91
  },
92
- }).Example('some.body@example.com'),
92
+ }).Example('some.body@example.com')),
93
93
  tslib_1.__metadata("design:paramtypes", [Object])
94
94
  ], EmailType);
@@ -41,7 +41,7 @@ tslib_1.__decorate([
41
41
  tslib_1.__metadata("design:type", String)
42
42
  ], TimeType.prototype, "maxValue", void 0);
43
43
  exports.TimeType = TimeType = tslib_1.__decorate([
44
- (0, simple_type_js_1.SimpleType)({
44
+ ((0, simple_type_js_1.SimpleType)({
45
45
  description: 'Time string in 24h format',
46
46
  nameMappings: {
47
47
  js: 'string',
@@ -49,6 +49,6 @@ exports.TimeType = TimeType = tslib_1.__decorate([
49
49
  },
50
50
  })
51
51
  .Example('18:23:00', 'Full time value')
52
- .Example('18:23:00', 'Time value without seconds'),
52
+ .Example('18:23:00', 'Time value without seconds')),
53
53
  tslib_1.__metadata("design:paramtypes", [Object])
54
54
  ], TimeType);
@@ -19,12 +19,12 @@ let UrlType = class UrlType {
19
19
  };
20
20
  exports.UrlType = UrlType;
21
21
  exports.UrlType = UrlType = tslib_1.__decorate([
22
- (0, simple_type_js_1.SimpleType)({
22
+ ((0, simple_type_js_1.SimpleType)({
23
23
  description: 'A Uniform Resource Identifier Reference (RFC 3986 icon) value',
24
24
  nameMappings: {
25
25
  js: 'string',
26
26
  json: 'string',
27
27
  },
28
- }).Example('http://tempuri.org'),
28
+ }).Example('http://tempuri.org')),
29
29
  tslib_1.__metadata("design:paramtypes", [Object])
30
30
  ], UrlType);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OmitType = void 0;
3
+ exports.OmitType = OmitType;
4
4
  const create_mapped_class_js_1 = require("./utils/create-mapped-class.js");
5
5
  /**
6
6
  *
@@ -8,4 +8,3 @@ const create_mapped_class_js_1 = require("./utils/create-mapped-class.js");
8
8
  function OmitType(baseType, keys, options) {
9
9
  return (0, create_mapped_class_js_1.createMappedClass)(baseType, { omit: keys }, options);
10
10
  }
11
- exports.OmitType = OmitType;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PartialType = void 0;
3
+ exports.PartialType = PartialType;
4
4
  const create_mapped_class_js_1 = require("./utils/create-mapped-class.js");
5
5
  /**
6
6
  *
@@ -10,4 +10,3 @@ function PartialType(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, { partial: keys }, options);
12
12
  }
13
- exports.PartialType = PartialType;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PickType = void 0;
3
+ exports.PickType = PickType;
4
4
  const create_mapped_class_js_1 = require("./utils/create-mapped-class.js");
5
5
  /**
6
6
  *
@@ -8,4 +8,3 @@ const create_mapped_class_js_1 = require("./utils/create-mapped-class.js");
8
8
  function PickType(baseType, keys, options) {
9
9
  return (0, create_mapped_class_js_1.createMappedClass)(baseType, { pick: keys }, options);
10
10
  }
11
- exports.PickType = PickType;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RequiredType = void 0;
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;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createMappedClass = void 0;
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");
@@ -52,4 +52,3 @@ function createMappedClass(source, config, options) {
52
52
  }
53
53
  return MappedClass;
54
54
  }
55
- exports.createMappedClass = createMappedClass;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getIsInheritedPredicateFn = void 0;
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,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApiFieldDecorator = void 0;
3
+ exports.ApiFieldDecorator = ApiFieldDecorator;
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");
@@ -23,4 +23,3 @@ function ApiFieldDecorator(options) {
23
23
  Reflect.defineMetadata(constants_js_1.DATATYPE_METADATA, (0, index_js_1.omitUndefined)(metadata), target.constructor);
24
24
  };
25
25
  }
26
- exports.ApiFieldDecorator = ApiFieldDecorator;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ComplexTypeDecorator = void 0;
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 = void 0;
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"));
@@ -139,4 +139,3 @@ function HttpControllerDecoratorFactory(options) {
139
139
  };
140
140
  return decorator;
141
141
  }
142
- exports.HttpControllerDecoratorFactory = HttpControllerDecoratorFactory;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpOperationDecoratorFactory = void 0;
3
+ exports.HttpOperationDecoratorFactory = HttpOperationDecoratorFactory;
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("../../http/index.js");
@@ -187,4 +187,3 @@ function HttpOperationDecoratorFactory(decoratorChain, options) {
187
187
  };
188
188
  return decorator;
189
189
  }
190
- exports.HttpOperationDecoratorFactory = HttpOperationDecoratorFactory;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AttributeDecoratorFactory = exports.SimpleTypeDecoratorFactory = void 0;
3
+ exports.SimpleTypeDecoratorFactory = SimpleTypeDecoratorFactory;
4
+ exports.AttributeDecoratorFactory = AttributeDecoratorFactory;
4
5
  const tslib_1 = require("tslib");
5
6
  const lodash_omit_1 = tslib_1.__importDefault(require("lodash.omit"));
6
7
  const index_js_1 = require("../../schema/index.js");
@@ -42,7 +43,6 @@ function SimpleTypeDecoratorFactory(options) {
42
43
  };
43
44
  return decorator;
44
45
  }
45
- exports.SimpleTypeDecoratorFactory = SimpleTypeDecoratorFactory;
46
46
  function AttributeDecoratorFactory(options) {
47
47
  return (target, propertyKey) => {
48
48
  if (typeof propertyKey !== 'string')
@@ -64,4 +64,3 @@ function AttributeDecoratorFactory(options) {
64
64
  Reflect.defineMetadata(constants_js_1.DATATYPE_METADATA, metadata, target.constructor);
65
65
  };
66
66
  }
67
- exports.AttributeDecoratorFactory = AttributeDecoratorFactory;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseRegExp = void 0;
3
+ exports.parseRegExp = parseRegExp;
4
4
  function parseRegExp(str, options) {
5
5
  const i = str.lastIndexOf('/');
6
6
  if (str.startsWith('/') && i) {
@@ -19,4 +19,3 @@ function parseRegExp(str, options) {
19
19
  }
20
20
  throw new TypeError(`"${str}" is not a valid RegExp string`);
21
21
  }
22
- exports.parseRegExp = parseRegExp;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stringCompare = void 0;
3
+ exports.stringCompare = stringCompare;
4
4
  function stringCompare(a, b) {
5
5
  if (a < b)
6
6
  return -1;
@@ -8,4 +8,3 @@ function stringCompare(a, b) {
8
8
  return 1;
9
9
  return 0;
10
10
  }
11
- exports.stringCompare = stringCompare;
@@ -1,87 +1,87 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.$arithmetic = exports.$paren = exports.$notILike = exports.$ilike = exports.$notLike = exports.$like = exports.$notIn = exports.$in = exports.$lte = exports.$lt = exports.$gte = exports.$gt = exports.$ne = exports.$eq = exports.$field = exports.$array = exports.$number = exports.$time = exports.$date = exports.$and = exports.$or = void 0;
3
+ exports.$or = $or;
4
+ exports.$and = $and;
5
+ exports.$date = $date;
6
+ exports.$time = $time;
7
+ exports.$number = $number;
8
+ exports.$array = $array;
9
+ exports.$field = $field;
10
+ exports.$eq = $eq;
11
+ exports.$ne = $ne;
12
+ exports.$gt = $gt;
13
+ exports.$gte = $gte;
14
+ exports.$lt = $lt;
15
+ exports.$lte = $lte;
16
+ exports.$in = $in;
17
+ exports.$notIn = $notIn;
18
+ exports.$like = $like;
19
+ exports.$notLike = $notLike;
20
+ exports.$ilike = $ilike;
21
+ exports.$notILike = $notILike;
22
+ exports.$paren = $paren;
23
+ exports.$arithmetic = $arithmetic;
4
24
  const index_js_1 = require("./ast/index.js");
5
25
  function $or(...items) {
6
26
  return new index_js_1.LogicalExpression({ op: 'or', items });
7
27
  }
8
- exports.$or = $or;
9
28
  function $and(...items) {
10
29
  return new index_js_1.LogicalExpression({ op: 'and', items });
11
30
  }
12
- exports.$and = $and;
13
31
  function $date(v) {
14
32
  return new index_js_1.DateLiteral(v);
15
33
  }
16
- exports.$date = $date;
17
34
  function $time(v) {
18
35
  return new index_js_1.TimeLiteral(v);
19
36
  }
20
- exports.$time = $time;
21
37
  function $number(v) {
22
38
  return new index_js_1.NumberLiteral(v);
23
39
  }
24
- exports.$number = $number;
25
40
  function $array(...items) {
26
41
  return new index_js_1.ArrayExpression(items.map(wrapEntryValue));
27
42
  }
28
- exports.$array = $array;
29
43
  function $field(v) {
30
44
  return new index_js_1.QualifiedIdentifier(v);
31
45
  }
32
- exports.$field = $field;
33
46
  function $eq(left, right) {
34
47
  return comparisonExpression('=', left, right);
35
48
  }
36
- exports.$eq = $eq;
37
49
  function $ne(left, right) {
38
50
  return comparisonExpression('!=', left, right);
39
51
  }
40
- exports.$ne = $ne;
41
52
  function $gt(left, right) {
42
53
  return comparisonExpression('>', left, right);
43
54
  }
44
- exports.$gt = $gt;
45
55
  function $gte(left, right) {
46
56
  return comparisonExpression('>=', left, right);
47
57
  }
48
- exports.$gte = $gte;
49
58
  function $lt(left, right) {
50
59
  return comparisonExpression('<', left, right);
51
60
  }
52
- exports.$lt = $lt;
53
61
  function $lte(left, right) {
54
62
  return comparisonExpression('<=', left, right);
55
63
  }
56
- exports.$lte = $lte;
57
64
  function $in(left, right) {
58
65
  return comparisonExpression('in', left, right);
59
66
  }
60
- exports.$in = $in;
61
67
  function $notIn(left, right) {
62
68
  return comparisonExpression('!in', left, right);
63
69
  }
64
- exports.$notIn = $notIn;
65
70
  function $like(left, right) {
66
71
  return comparisonExpression('like', left, right);
67
72
  }
68
- exports.$like = $like;
69
73
  function $notLike(left, right) {
70
74
  return comparisonExpression('!like', left, right);
71
75
  }
72
- exports.$notLike = $notLike;
73
76
  function $ilike(left, right) {
74
77
  return comparisonExpression('ilike', left, right);
75
78
  }
76
- exports.$ilike = $ilike;
77
79
  function $notILike(left, right) {
78
80
  return comparisonExpression('!ilike', left, right);
79
81
  }
80
- exports.$notILike = $notILike;
81
82
  function $paren(expression) {
82
83
  return new index_js_1.ParenthesizedExpression(expression);
83
84
  }
84
- exports.$paren = $paren;
85
85
  function $arithmetic(n) {
86
86
  const exp = new index_js_1.ArithmeticExpression();
87
87
  exp.add = (expression) => {
@@ -103,7 +103,6 @@ function $arithmetic(n) {
103
103
  exp.append('+', wrapEntryValue(n));
104
104
  return exp;
105
105
  }
106
- exports.$arithmetic = $arithmetic;
107
106
  function comparisonExpression(op, left, right) {
108
107
  const lex = wrapEntryValue(left);
109
108
  const rex = wrapEntryValue(right);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parse = void 0;
3
+ exports.parse = parse;
4
4
  const tslib_1 = require("tslib");
5
5
  const antlr4_1 = require("@browsery/antlr4");
6
6
  const OpraFilterLexer_js_1 = tslib_1.__importDefault(require("./antlr/OpraFilterLexer.js"));
@@ -34,4 +34,3 @@ function parse(text, visitor) {
34
34
  visitor = visitor || new filter_tree_visitor_js_1.FilterTreeVisitor();
35
35
  return visitor.visit(tree);
36
36
  }
37
- exports.parse = parse;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.unquoteFilterString = exports.quoteFilterString = void 0;
3
+ exports.quoteFilterString = quoteFilterString;
4
+ exports.unquoteFilterString = unquoteFilterString;
4
5
  const quotesRegEx = /'/g;
5
6
  const escapeRegEx = /(\\)/g;
6
7
  const unescapeRegEx = /\\(.)/g;
@@ -13,7 +14,6 @@ function unescapeString(s) {
13
14
  function quoteFilterString(s) {
14
15
  return "'" + escapeString(s).replace(quotesRegEx, "\\'") + "'";
15
16
  }
16
- exports.quoteFilterString = quoteFilterString;
17
17
  function unquoteFilterString(s) {
18
18
  if (s && (s.startsWith("'") || s.startsWith('"')) && s.endsWith(s.charAt(0))) {
19
19
  return unescapeString(s.substring(1, s.length - 1));
@@ -21,4 +21,3 @@ function unquoteFilterString(s) {
21
21
  /* istanbul ignore next */
22
22
  return s;
23
23
  }
24
- exports.unquoteFilterString = unquoteFilterString;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveThunk = void 0;
3
+ exports.resolveThunk = resolveThunk;
4
4
  const tslib_1 = require("tslib");
5
5
  const putil_promisify_1 = tslib_1.__importDefault(require("putil-promisify"));
6
6
  const type_guards_js_1 = require("./type-guards.js");
@@ -13,4 +13,3 @@ async function resolveThunk(thunk) {
13
13
  }
14
14
  return thunk;
15
15
  }
16
- exports.resolveThunk = resolveThunk;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getErrorStack = exports.getStackFileName = void 0;
3
+ exports.getStackFileName = getStackFileName;
4
+ exports.getErrorStack = getErrorStack;
4
5
  const PATH_PATTERN = /^(?:file:\/\/)?(.+)$/;
5
6
  function getStackFileName(position = 1) {
6
7
  if (position >= Error.stackTraceLimit) {
@@ -23,7 +24,6 @@ function getStackFileName(position = 1) {
23
24
  }
24
25
  return '';
25
26
  }
26
- exports.getStackFileName = getStackFileName;
27
27
  function getErrorStack(position = 1) {
28
28
  if (position >= Error.stackTraceLimit) {
29
29
  throw new TypeError('getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `' +
@@ -45,4 +45,3 @@ function getErrorStack(position = 1) {
45
45
  }
46
46
  return '';
47
47
  }
48
- exports.getErrorStack = getErrorStack;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.inheritPropertyInitializers = exports.mergePrototype = void 0;
3
+ exports.mergePrototype = mergePrototype;
4
+ exports.inheritPropertyInitializers = inheritPropertyInitializers;
4
5
  function mergePrototype(targetProto, baseProto, filter) {
5
6
  for (const k of Object.getOwnPropertyNames(baseProto)) {
6
7
  if (k === 'constructor' || k === '__proto__' || k === 'toJSON' || k === 'toString' || (filter && !filter(k))) {
@@ -9,7 +10,6 @@ function mergePrototype(targetProto, baseProto, filter) {
9
10
  Object.defineProperty(targetProto, k, Object.getOwnPropertyDescriptor(baseProto, k) || Object.create(null));
10
11
  }
11
12
  }
12
- exports.mergePrototype = mergePrototype;
13
13
  // noinspection JSUnusedLocalSymbols
14
14
  function inheritPropertyInitializers(target, clazz,
15
15
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -28,4 +28,3 @@ isPropertyInherited = (key) => true) {
28
28
  //
29
29
  }
30
30
  }
31
- exports.inheritPropertyInitializers = inheritPropertyInitializers;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.omitNullish = exports.omitUndefined = exports.cloneObject = void 0;
3
+ exports.cloneObject = cloneObject;
4
+ exports.omitUndefined = omitUndefined;
5
+ exports.omitNullish = omitNullish;
4
6
  const tslib_1 = require("tslib");
5
7
  const putil_isplainobject_1 = tslib_1.__importDefault(require("putil-isplainobject"));
6
8
  const putil_merge_1 = tslib_1.__importDefault(require("putil-merge"));
@@ -15,7 +17,6 @@ function cloneObject(obj, jsonOnly) {
15
17
  },
16
18
  });
17
19
  }
18
- exports.cloneObject = cloneObject;
19
20
  function omitUndefined(obj, recursive) {
20
21
  if (!(obj && typeof obj === 'object'))
21
22
  return obj;
@@ -27,7 +28,6 @@ function omitUndefined(obj, recursive) {
27
28
  }
28
29
  return obj;
29
30
  }
30
- exports.omitUndefined = omitUndefined;
31
31
  function omitNullish(obj, recursive) {
32
32
  if (!(obj && typeof obj === 'object'))
33
33
  return obj;
@@ -39,4 +39,3 @@ function omitNullish(obj, recursive) {
39
39
  }
40
40
  return obj;
41
41
  }
42
- exports.omitNullish = omitNullish;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parse = exports.parseFieldsProjection = exports.FieldsProjection = void 0;
3
+ exports.FieldsProjection = void 0;
4
+ exports.parseFieldsProjection = parseFieldsProjection;
5
+ exports.parse = parse;
4
6
  const fast_tokenizer_1 = require("fast-tokenizer");
5
7
  const FIELD_PATTERN = /^([+-])?([a-z_$]\w*)$/i;
6
8
  const NO_DOT_BRACKET_PATTERN = /[^.]\(/g;
@@ -24,7 +26,6 @@ function parseFieldsProjection(projection, keepCase) {
24
26
  }
25
27
  return out;
26
28
  }
27
- exports.parseFieldsProjection = parseFieldsProjection;
28
29
  function parse(input, target) {
29
30
  /** Add dot before brackets which is required to split fields */
30
31
  input = input.replace(NO_DOT_BRACKET_PATTERN, s => s.charAt(0) + '.' + s.substring(1));
@@ -62,4 +63,3 @@ function parse(input, target) {
62
63
  }
63
64
  }
64
65
  }
65
- exports.parse = parse;
@@ -1,6 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAsyncIterable = exports.isIterable = exports.isURL = exports.isFormData = exports.isBlob = exports.isReadableStream = exports.isWritable = exports.isReadable = exports.isStream = exports.isConstructor = void 0;
3
+ exports.isConstructor = isConstructor;
4
+ exports.isStream = isStream;
5
+ exports.isReadable = isReadable;
6
+ exports.isWritable = isWritable;
7
+ exports.isReadableStream = isReadableStream;
8
+ exports.isBlob = isBlob;
9
+ exports.isFormData = isFormData;
10
+ exports.isURL = isURL;
11
+ exports.isIterable = isIterable;
12
+ exports.isAsyncIterable = isAsyncIterable;
4
13
  function isConstructor(fn) {
5
14
  return (typeof fn === 'function' &&
6
15
  fn.prototype &&
@@ -8,26 +17,21 @@ function isConstructor(fn) {
8
17
  fn.prototype.constructor.name !== 'Function' &&
9
18
  fn.prototype.constructor.name !== 'embedded');
10
19
  }
11
- exports.isConstructor = isConstructor;
12
20
  function isStream(x) {
13
21
  return x !== null && typeof x === 'object' && typeof x.pipe === 'function';
14
22
  }
15
- exports.isStream = isStream;
16
23
  function isReadable(x) {
17
24
  return isStream(x) && typeof x._read === 'function' && typeof x._readableState === 'object';
18
25
  }
19
- exports.isReadable = isReadable;
20
26
  function isWritable(x) {
21
27
  return isStream(x) && typeof x._write === 'function';
22
28
  }
23
- exports.isWritable = isWritable;
24
29
  function isReadableStream(x) {
25
30
  return (isStream(x) &&
26
31
  typeof x.getReader === 'function' &&
27
32
  typeof x.pipeThrough === 'function' &&
28
33
  typeof x.pipeTo === 'function');
29
34
  }
30
- exports.isReadableStream = isReadableStream;
31
35
  function isBlob(x) {
32
36
  return (x !== null &&
33
37
  typeof x === 'object' &&
@@ -35,7 +39,6 @@ function isBlob(x) {
35
39
  typeof x.arrayBuffer === 'function' &&
36
40
  typeof x.stream === 'function');
37
41
  }
38
- exports.isBlob = isBlob;
39
42
  function isFormData(x) {
40
43
  return (x !== null &&
41
44
  typeof x.constructor === 'function' &&
@@ -43,16 +46,12 @@ function isFormData(x) {
43
46
  typeof x.append === 'function' &&
44
47
  typeof x.getAll === 'function');
45
48
  }
46
- exports.isFormData = isFormData;
47
49
  function isURL(x) {
48
50
  return x !== null && typeof x == 'object' && typeof x.host === 'string' && typeof x.href === 'string';
49
51
  }
50
- exports.isURL = isURL;
51
52
  function isIterable(x) {
52
53
  return Symbol.iterator in x;
53
54
  }
54
- exports.isIterable = isIterable;
55
55
  function isAsyncIterable(x) {
56
56
  return Symbol.asyncIterator in x;
57
57
  }
58
- exports.isAsyncIterable = isAsyncIterable;
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.unescapeString = exports.escapeString = void 0;
3
+ exports.escapeString = escapeString;
4
+ exports.unescapeString = unescapeString;
4
5
  const unescapeRegEx = /\\(.)/g;
5
6
  const escapeRegEx = /(\\)/g;
6
7
  function escapeString(s) {
7
8
  return s.replace(escapeRegEx, '\\\\');
8
9
  }
9
- exports.escapeString = escapeString;
10
10
  function unescapeString(s) {
11
11
  return s.replace(unescapeRegEx, '$1');
12
12
  }
13
- exports.unescapeString = unescapeString;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.translate = void 0;
3
+ exports.translate = translate;
4
4
  const string_utils_js_1 = require("./string-utils.js");
5
5
  const bracketRegEx = /(\))/g;
6
6
  function translate(key, arg0, arg1) {
@@ -12,4 +12,3 @@ function translate(key, arg0, arg1) {
12
12
  (fallback ? '?' + (0, string_utils_js_1.escapeString)(fallback).replace(bracketRegEx, '\\$1') : '') +
13
13
  ')');
14
14
  }
15
- exports.translate = translate;
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isHttpController = exports.isEnumType = exports.isMappedType = exports.isMixinType = exports.isSimpleType = exports.isComplexType = exports.isDataType = void 0;
3
+ exports.isDataType = isDataType;
4
+ exports.isComplexType = isComplexType;
5
+ exports.isSimpleType = isSimpleType;
6
+ exports.isMixinType = isMixinType;
7
+ exports.isMappedType = isMappedType;
8
+ exports.isEnumType = isEnumType;
9
+ exports.isHttpController = isHttpController;
4
10
  const complex_type_interface_js_1 = require("./data-type/complex-type.interface.js");
5
11
  const enum_type_interface_js_1 = require("./data-type/enum-type.interface.js");
6
12
  const mapped_type_interface_js_1 = require("./data-type/mapped-type.interface.js");
@@ -16,28 +22,21 @@ function isDataType(obj) {
16
22
  obj.kind === simple_type_interface_js_1.SimpleType.Kind ||
17
23
  obj.kind === mixin_type_interface_js_1.MixinType.Kind));
18
24
  }
19
- exports.isDataType = isDataType;
20
25
  function isComplexType(obj) {
21
26
  return obj && typeof obj === 'object' && obj.kind === complex_type_interface_js_1.ComplexType.Kind;
22
27
  }
23
- exports.isComplexType = isComplexType;
24
28
  function isSimpleType(obj) {
25
29
  return obj && typeof obj === 'object' && obj.kind === simple_type_interface_js_1.SimpleType.Kind;
26
30
  }
27
- exports.isSimpleType = isSimpleType;
28
31
  function isMixinType(obj) {
29
32
  return obj && typeof obj === 'object' && obj.kind === mixin_type_interface_js_1.MixinType.Kind;
30
33
  }
31
- exports.isMixinType = isMixinType;
32
34
  function isMappedType(obj) {
33
35
  return obj && typeof obj === 'object' && obj.kind === mapped_type_interface_js_1.MappedType.Kind;
34
36
  }
35
- exports.isMappedType = isMappedType;
36
37
  function isEnumType(obj) {
37
38
  return obj && typeof obj === 'object' && obj.kind === enum_type_interface_js_1.EnumType.Kind;
38
39
  }
39
- exports.isEnumType = isEnumType;
40
40
  function isHttpController(obj) {
41
41
  return obj && typeof obj === 'object' && obj.kind === http_controller_interface_js_1.HttpController.Kind;
42
42
  }
43
- exports.isHttpController = isHttpController;
@@ -33,7 +33,7 @@ __decorate([
33
33
  __metadata("design:type", String)
34
34
  ], DateStringType.prototype, "maxValue", void 0);
35
35
  DateStringType = __decorate([
36
- SimpleType({
36
+ (SimpleType({
37
37
  description: 'Date string value',
38
38
  nameMappings: {
39
39
  js: 'string',
@@ -42,7 +42,7 @@ DateStringType = __decorate([
42
42
  })
43
43
  .Example('2021-04-18', 'Full date value')
44
44
  .Example('2021-04', 'Date value without day')
45
- .Example('2021', 'Year only value'),
45
+ .Example('2021', 'Year only value')),
46
46
  __metadata("design:paramtypes", [Object])
47
47
  ], DateStringType);
48
48
  export { DateStringType };
@@ -33,7 +33,7 @@ __decorate([
33
33
  __metadata("design:type", String)
34
34
  ], DateTimeStringType.prototype, "maxValue", void 0);
35
35
  DateTimeStringType = __decorate([
36
- SimpleType({
36
+ (SimpleType({
37
37
  description: 'DateTime string value',
38
38
  nameMappings: {
39
39
  js: 'string',
@@ -45,7 +45,7 @@ DateTimeStringType = __decorate([
45
45
  .Example('2021-04-18 22:30', 'Date-time value')
46
46
  .Example('2021-04-18', 'Date value')
47
47
  .Example('2021-04', 'Date value without day')
48
- .Example('2021', 'Year only value'),
48
+ .Example('2021', 'Year only value')),
49
49
  __metadata("design:paramtypes", [Object])
50
50
  ], DateTimeStringType);
51
51
  export { DateTimeStringType };
@@ -47,7 +47,7 @@ __decorate([
47
47
  __metadata("design:type", String)
48
48
  ], DateTimeType.prototype, "maxValue", void 0);
49
49
  DateTimeType = __decorate([
50
- SimpleType({
50
+ (SimpleType({
51
51
  description: 'A full datetime value',
52
52
  nameMappings: {
53
53
  js: 'string',
@@ -56,7 +56,7 @@ DateTimeType = __decorate([
56
56
  })
57
57
  .Example('2021-04-18T22:30:15')
58
58
  .Example('2021-04-18 22:30:15')
59
- .Example('2021-04-18 22:30'),
59
+ .Example('2021-04-18 22:30')),
60
60
  __metadata("design:paramtypes", [Object])
61
61
  ], DateTimeType);
62
62
  export { DateTimeType };
@@ -47,13 +47,13 @@ __decorate([
47
47
  __metadata("design:type", String)
48
48
  ], DateType.prototype, "maxValue", void 0);
49
49
  DateType = __decorate([
50
- SimpleType({
50
+ (SimpleType({
51
51
  description: 'A date without time',
52
52
  nameMappings: {
53
53
  js: 'Date',
54
54
  json: 'string',
55
55
  },
56
- }).Example('2021-04-18', 'Full date value'),
56
+ }).Example('2021-04-18', 'Full date value')),
57
57
  __metadata("design:paramtypes", [Object])
58
58
  ], DateType);
59
59
  export { DateType };
@@ -79,13 +79,13 @@ __decorate([
79
79
  __metadata("design:type", String)
80
80
  ], EmailType.prototype, "blacklistedChars", void 0);
81
81
  EmailType = __decorate([
82
- SimpleType({
82
+ (SimpleType({
83
83
  description: 'An email value',
84
84
  nameMappings: {
85
85
  js: 'string',
86
86
  json: 'string',
87
87
  },
88
- }).Example('some.body@example.com'),
88
+ }).Example('some.body@example.com')),
89
89
  __metadata("design:paramtypes", [Object])
90
90
  ], EmailType);
91
91
  export { EmailType };
@@ -37,7 +37,7 @@ __decorate([
37
37
  __metadata("design:type", String)
38
38
  ], TimeType.prototype, "maxValue", void 0);
39
39
  TimeType = __decorate([
40
- SimpleType({
40
+ (SimpleType({
41
41
  description: 'Time string in 24h format',
42
42
  nameMappings: {
43
43
  js: 'string',
@@ -45,7 +45,7 @@ TimeType = __decorate([
45
45
  },
46
46
  })
47
47
  .Example('18:23:00', 'Full time value')
48
- .Example('18:23:00', 'Time value without seconds'),
48
+ .Example('18:23:00', 'Time value without seconds')),
49
49
  __metadata("design:paramtypes", [Object])
50
50
  ], TimeType);
51
51
  export { TimeType };
@@ -15,13 +15,13 @@ let UrlType = class UrlType {
15
15
  }
16
16
  };
17
17
  UrlType = __decorate([
18
- SimpleType({
18
+ (SimpleType({
19
19
  description: 'A Uniform Resource Identifier Reference (RFC 3986 icon) value',
20
20
  nameMappings: {
21
21
  js: 'string',
22
22
  json: 'string',
23
23
  },
24
- }).Example('http://tempuri.org'),
24
+ }).Example('http://tempuri.org')),
25
25
  __metadata("design:paramtypes", [Object])
26
26
  ], UrlType);
27
27
  export { UrlType };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/common",
3
- "version": "1.0.0-alpha.16",
3
+ "version": "1.0.0-alpha.18",
4
4
  "description": "Opra common package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -48,7 +48,7 @@
48
48
  "putil-varhelpers": "^1.6.5",
49
49
  "reflect-metadata": "^0.2.2",
50
50
  "uid": "^2.0.1",
51
- "valgen": "^5.4.1"
51
+ "valgen": "^5.6.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@browsery/fs": "^0.4.0",
@@ -1,6 +1,6 @@
1
1
  import 'reflect-metadata';
2
2
  import { Combine, Type } from 'ts-gems';
3
- import type { Field } from '../../schema/data-type/field.interface';
3
+ import type { Field } from '../../schema/data-type/field.interface.js';
4
4
  import { OpraSchema } from '../../schema/index.js';
5
5
  import { DocumentElement } from '../common/document-element.js';
6
6
  import type { ComplexType } from './complex-type.js';
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference lib="dom" />
3
1
  import { Readable, Stream } from 'stream';
4
2
  import { Type } from 'ts-gems';
5
3
  export declare function isConstructor(fn: any): fn is Type;
@@ -1,7 +1,7 @@
1
1
  import type { ComplexType } from './complex-type.interface.js';
2
2
  import type { EnumType } from './enum-type.interface.js';
3
3
  import type { MappedType } from './mapped-type.interface.js';
4
- import type { MixinType } from './mixin-type.interface';
4
+ import type { MixinType } from './mixin-type.interface.js';
5
5
  import type { SimpleType } from './simple-type.interface.js';
6
6
  export type DataType = SimpleType | EnumType | ComplexType | MappedType | MixinType;
7
7
  export declare namespace DataType {
@@ -1,6 +1,6 @@
1
1
  import { StrictOmit } from 'ts-gems';
2
- import type { ComplexType } from './complex-type.interface';
3
- import type { DataType, DataTypeBase } from './data-type.interface';
2
+ import type { ComplexType } from './complex-type.interface.js';
3
+ import type { DataType, DataTypeBase } from './data-type.interface.js';
4
4
  import type { Field } from './field.interface.js';
5
5
  import type { MixinType } from './mixin-type.interface.js';
6
6
  export interface MappedType extends StrictOmit<DataTypeBase, 'kind'> {
@@ -1,4 +1,4 @@
1
- import type { DataType } from './data-type/data-type.interface';
1
+ import type { DataType } from './data-type/data-type.interface.js';
2
2
  /**
3
3
  * @interface DataTypeContainer
4
4
  */
@@ -1,6 +1,6 @@
1
1
  import type { SpecVersion } from './constants.js';
2
2
  import type { DataTypeContainer } from './data-type-container.interface.js';
3
- import type { HttpController } from './http/http-controller.interface';
3
+ import type { HttpController } from './http/http-controller.interface.js';
4
4
  export type Protocol = 'http' | 'ws' | 'rpc';
5
5
  /**
6
6
  * @interface Document
@@ -1,6 +1,6 @@
1
1
  import type { DataTypeContainer } from '../data-type-container.interface.js';
2
- import type { HttpOperation } from './http-operation.interface';
3
- import type { HttpParameter } from './http-parameter.interface';
2
+ import type { HttpOperation } from './http-operation.interface.js';
3
+ import type { HttpParameter } from './http-parameter.interface.js';
4
4
  /**
5
5
  *
6
6
  * @interface HttpController
@@ -1,4 +1,4 @@
1
- import type { DataType } from '../data-type/data-type.interface';
1
+ import type { DataType } from '../data-type/data-type.interface.js';
2
2
  import type { HttpMultipartField } from './http-multipart-field.interface.js';
3
3
  /**
4
4
  *
@@ -1,6 +1,6 @@
1
1
  import type { HttpMediaType } from './http-media-type.interface.js';
2
- import type { HttpParameter } from './http-parameter.interface';
3
- import type { HttpStatusRange } from './http-status-range.interface';
2
+ import type { HttpParameter } from './http-parameter.interface.js';
3
+ import type { HttpStatusRange } from './http-status-range.interface.js';
4
4
  /**
5
5
  *
6
6
  * @interface HttpOperationResponse
@@ -1,8 +1,8 @@
1
- import type { DataTypeContainer } from '../data-type-container.interface';
1
+ import type { DataTypeContainer } from '../data-type-container.interface.js';
2
2
  import type { HttpMethod } from '../types.js';
3
- import type { HttpOperationResponse } from './http-operation-response.interface';
4
- import type { HttpParameter } from './http-parameter.interface';
5
- import type { HttpRequestBody } from './http-request-body.interface';
3
+ import type { HttpOperationResponse } from './http-operation-response.interface.js';
4
+ import type { HttpParameter } from './http-parameter.interface.js';
5
+ import type { HttpRequestBody } from './http-request-body.interface.js';
6
6
  /**
7
7
  * @interface HttpOperation
8
8
  */
@@ -1,5 +1,5 @@
1
1
  import { HttpParameterLocation } from '../types.js';
2
- import type { Value } from '../value.interface';
2
+ import type { Value } from '../value.interface.js';
3
3
  /**
4
4
  *
5
5
  * @interface HttpParameter