@opra/common 1.17.1 → 1.17.3

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.
@@ -272,9 +272,7 @@ class ComplexTypeBaseClass extends data_type_js_1.DataType {
272
272
  currentPath: currentPath + (currentPath ? '.' : '') + fieldName,
273
273
  });
274
274
  schema[fieldName] =
275
- context.partial || !field.required
276
- ? valgen_1.vg.optional(fn)
277
- : valgen_1.vg.pipe([valgen_1.vg.required(fn), valgen_1.vg.isNotEmpty()]);
275
+ context.partial || !field.required ? valgen_1.vg.optional(fn) : valgen_1.vg.required(fn);
278
276
  }
279
277
  if (context.allowPatchOperators) {
280
278
  schema._$pull = valgen_1.vg.optional(valgen_1.vg.isAny());
@@ -13,9 +13,9 @@ let DateStringType = class DateStringType {
13
13
  [constants_js_1.DECODER](properties) {
14
14
  const fn = valgen_1.vg.isDateString({ trim: 'date', coerce: true });
15
15
  const x = [];
16
- if (properties.minValue)
16
+ if (properties.minValue != null)
17
17
  x.push(valgen_1.vg.isGte(properties.minValue));
18
- if (properties.maxValue)
18
+ if (properties.maxValue != null)
19
19
  x.push(valgen_1.vg.isLte(properties.maxValue));
20
20
  return x.length > 0 ? valgen_1.vg.pipe([fn, ...x], { returnIndex: 0 }) : fn;
21
21
  }
@@ -13,9 +13,9 @@ let DateTimeStringType = class DateTimeStringType {
13
13
  [constants_js_1.DECODER](properties) {
14
14
  const fn = valgen_1.vg.isDateString({ coerce: true });
15
15
  const x = [];
16
- if (properties.minValue)
16
+ if (properties.minValue != null)
17
17
  x.push(valgen_1.vg.isGte(properties.minValue));
18
- if (properties.maxValue)
18
+ if (properties.maxValue != null)
19
19
  x.push(valgen_1.vg.isLte(properties.maxValue));
20
20
  return x.length > 0 ? valgen_1.vg.pipe([fn, ...x]) : fn;
21
21
  }
@@ -13,11 +13,11 @@ let DateTimeType = class DateTimeType {
13
13
  [constants_js_1.DECODER](properties) {
14
14
  const fn = valgen_1.vg.isDate({ precision: 'time', coerce: true });
15
15
  const x = [];
16
- if (properties.minValue) {
16
+ if (properties.minValue != null) {
17
17
  (0, valgen_1.isDateString)(properties.minValue);
18
18
  x.push(valgen_1.toString, valgen_1.vg.isGte(properties.minValue));
19
19
  }
20
- if (properties.maxValue) {
20
+ if (properties.maxValue != null) {
21
21
  (0, valgen_1.isDateString)(properties.maxValue);
22
22
  x.push(valgen_1.toString, valgen_1.vg.isLte(properties.maxValue));
23
23
  }
@@ -30,11 +30,11 @@ let DateTimeType = class DateTimeType {
30
30
  coerce: true,
31
31
  });
32
32
  const x = [];
33
- if (properties.minValue) {
33
+ if (properties.minValue != null) {
34
34
  (0, valgen_1.isDateString)(properties.minValue);
35
35
  x.push(valgen_1.vg.isGte(properties.minValue));
36
36
  }
37
- if (properties.maxValue) {
37
+ if (properties.maxValue != null) {
38
38
  (0, valgen_1.isDateString)(properties.maxValue);
39
39
  x.push(valgen_1.vg.isLte(properties.maxValue));
40
40
  }
@@ -13,11 +13,11 @@ let DateType = class DateType {
13
13
  [constants_js_1.DECODER](properties) {
14
14
  const fn = valgen_1.vg.isDate({ precision: 'date', coerce: true });
15
15
  const x = [];
16
- if (properties.minValue) {
16
+ if (properties.minValue != null) {
17
17
  (0, valgen_1.isDateString)(properties.minValue);
18
18
  x.push(valgen_1.toString, valgen_1.vg.isGte(properties.minValue));
19
19
  }
20
- if (properties.maxValue) {
20
+ if (properties.maxValue != null) {
21
21
  (0, valgen_1.isDateString)(properties.maxValue);
22
22
  x.push(valgen_1.toString, valgen_1.vg.isLte(properties.maxValue));
23
23
  }
@@ -30,11 +30,11 @@ let DateType = class DateType {
30
30
  coerce: true,
31
31
  });
32
32
  const x = [];
33
- if (properties.minValue) {
33
+ if (properties.minValue != null) {
34
34
  (0, valgen_1.isDateString)(properties.minValue);
35
35
  x.push(valgen_1.vg.isGte(properties.minValue));
36
36
  }
37
- if (properties.maxValue) {
37
+ if (properties.maxValue != null) {
38
38
  (0, valgen_1.isDateString)(properties.maxValue);
39
39
  x.push(valgen_1.vg.isLte(properties.maxValue));
40
40
  }
@@ -17,9 +17,9 @@ let TimeType = class TimeType {
17
17
  coerce: true,
18
18
  });
19
19
  const x = [];
20
- if (properties.minValue)
20
+ if (properties.minValue != null)
21
21
  x.push(valgen_1.vg.isGte(properties.minValue));
22
- if (properties.maxValue)
22
+ if (properties.maxValue != null)
23
23
  x.push(valgen_1.vg.isLte(properties.maxValue));
24
24
  return x.length > 0 ? valgen_1.vg.pipe([fn, ...x], { returnIndex: 0 }) : fn;
25
25
  }
@@ -12,9 +12,9 @@ let BigintType = class BigintType extends number_type_js_1.NumberType {
12
12
  }
13
13
  [constants_js_1.DECODER](properties) {
14
14
  const x = [];
15
- if (properties.minValue)
15
+ if (properties.minValue != null)
16
16
  x.push(valgen_1.vg.isGte(properties.minValue));
17
- if (properties.maxValue)
17
+ if (properties.maxValue != null)
18
18
  x.push(valgen_1.vg.isLte(properties.maxValue));
19
19
  return x.length > 0
20
20
  ? valgen_1.vg.pipe([valgen_1.toBigint, ...x], { returnIndex: 0 })
@@ -12,9 +12,9 @@ let IntegerType = class IntegerType extends number_type_js_1.NumberType {
12
12
  }
13
13
  [constants_js_1.DECODER](properties) {
14
14
  const x = [];
15
- if (properties.minValue)
15
+ if (properties.minValue != null)
16
16
  x.push(valgen_1.vg.isGte(properties.minValue));
17
- if (properties.maxValue)
17
+ if (properties.maxValue != null)
18
18
  x.push(valgen_1.vg.isLte(properties.maxValue));
19
19
  return x.length > 0
20
20
  ? valgen_1.vg.pipe([valgen_1.toInteger, ...x], { returnIndex: 0 })
@@ -12,9 +12,9 @@ let NumberType = class NumberType {
12
12
  }
13
13
  [constants_js_1.DECODER](properties) {
14
14
  const x = [];
15
- if (properties.minValue)
15
+ if (properties.minValue != null)
16
16
  x.push(valgen_1.vg.isGte(properties.minValue));
17
- if (properties.maxValue)
17
+ if (properties.maxValue != null)
18
18
  x.push(valgen_1.vg.isLte(properties.maxValue));
19
19
  return x.length > 0
20
20
  ? valgen_1.vg.pipe([valgen_1.toNumber, ...x], { returnIndex: 0 })
@@ -269,9 +269,7 @@ class ComplexTypeBaseClass extends DataType {
269
269
  currentPath: currentPath + (currentPath ? '.' : '') + fieldName,
270
270
  });
271
271
  schema[fieldName] =
272
- context.partial || !field.required
273
- ? vg.optional(fn)
274
- : vg.pipe([vg.required(fn), vg.isNotEmpty()]);
272
+ context.partial || !field.required ? vg.optional(fn) : vg.required(fn);
275
273
  }
276
274
  if (context.allowPatchOperators) {
277
275
  schema._$pull = vg.optional(vg.isAny());
@@ -10,9 +10,9 @@ let DateStringType = class DateStringType {
10
10
  [DECODER](properties) {
11
11
  const fn = vg.isDateString({ trim: 'date', coerce: true });
12
12
  const x = [];
13
- if (properties.minValue)
13
+ if (properties.minValue != null)
14
14
  x.push(vg.isGte(properties.minValue));
15
- if (properties.maxValue)
15
+ if (properties.maxValue != null)
16
16
  x.push(vg.isLte(properties.maxValue));
17
17
  return x.length > 0 ? vg.pipe([fn, ...x], { returnIndex: 0 }) : fn;
18
18
  }
@@ -10,9 +10,9 @@ let DateTimeStringType = class DateTimeStringType {
10
10
  [DECODER](properties) {
11
11
  const fn = vg.isDateString({ coerce: true });
12
12
  const x = [];
13
- if (properties.minValue)
13
+ if (properties.minValue != null)
14
14
  x.push(vg.isGte(properties.minValue));
15
- if (properties.maxValue)
15
+ if (properties.maxValue != null)
16
16
  x.push(vg.isLte(properties.maxValue));
17
17
  return x.length > 0 ? vg.pipe([fn, ...x]) : fn;
18
18
  }
@@ -10,11 +10,11 @@ let DateTimeType = class DateTimeType {
10
10
  [DECODER](properties) {
11
11
  const fn = vg.isDate({ precision: 'time', coerce: true });
12
12
  const x = [];
13
- if (properties.minValue) {
13
+ if (properties.minValue != null) {
14
14
  isDateString(properties.minValue);
15
15
  x.push(toString, vg.isGte(properties.minValue));
16
16
  }
17
- if (properties.maxValue) {
17
+ if (properties.maxValue != null) {
18
18
  isDateString(properties.maxValue);
19
19
  x.push(toString, vg.isLte(properties.maxValue));
20
20
  }
@@ -27,11 +27,11 @@ let DateTimeType = class DateTimeType {
27
27
  coerce: true,
28
28
  });
29
29
  const x = [];
30
- if (properties.minValue) {
30
+ if (properties.minValue != null) {
31
31
  isDateString(properties.minValue);
32
32
  x.push(vg.isGte(properties.minValue));
33
33
  }
34
- if (properties.maxValue) {
34
+ if (properties.maxValue != null) {
35
35
  isDateString(properties.maxValue);
36
36
  x.push(vg.isLte(properties.maxValue));
37
37
  }
@@ -10,11 +10,11 @@ let DateType = class DateType {
10
10
  [DECODER](properties) {
11
11
  const fn = vg.isDate({ precision: 'date', coerce: true });
12
12
  const x = [];
13
- if (properties.minValue) {
13
+ if (properties.minValue != null) {
14
14
  isDateString(properties.minValue);
15
15
  x.push(toString, vg.isGte(properties.minValue));
16
16
  }
17
- if (properties.maxValue) {
17
+ if (properties.maxValue != null) {
18
18
  isDateString(properties.maxValue);
19
19
  x.push(toString, vg.isLte(properties.maxValue));
20
20
  }
@@ -27,11 +27,11 @@ let DateType = class DateType {
27
27
  coerce: true,
28
28
  });
29
29
  const x = [];
30
- if (properties.minValue) {
30
+ if (properties.minValue != null) {
31
31
  isDateString(properties.minValue);
32
32
  x.push(vg.isGte(properties.minValue));
33
33
  }
34
- if (properties.maxValue) {
34
+ if (properties.maxValue != null) {
35
35
  isDateString(properties.maxValue);
36
36
  x.push(vg.isLte(properties.maxValue));
37
37
  }
@@ -14,9 +14,9 @@ let TimeType = class TimeType {
14
14
  coerce: true,
15
15
  });
16
16
  const x = [];
17
- if (properties.minValue)
17
+ if (properties.minValue != null)
18
18
  x.push(vg.isGte(properties.minValue));
19
- if (properties.maxValue)
19
+ if (properties.maxValue != null)
20
20
  x.push(vg.isLte(properties.maxValue));
21
21
  return x.length > 0 ? vg.pipe([fn, ...x], { returnIndex: 0 }) : fn;
22
22
  }
@@ -9,9 +9,9 @@ let BigintType = class BigintType extends NumberType {
9
9
  }
10
10
  [DECODER](properties) {
11
11
  const x = [];
12
- if (properties.minValue)
12
+ if (properties.minValue != null)
13
13
  x.push(vg.isGte(properties.minValue));
14
- if (properties.maxValue)
14
+ if (properties.maxValue != null)
15
15
  x.push(vg.isLte(properties.maxValue));
16
16
  return x.length > 0
17
17
  ? vg.pipe([toBigint, ...x], { returnIndex: 0 })
@@ -9,9 +9,9 @@ let IntegerType = class IntegerType extends NumberType {
9
9
  }
10
10
  [DECODER](properties) {
11
11
  const x = [];
12
- if (properties.minValue)
12
+ if (properties.minValue != null)
13
13
  x.push(vg.isGte(properties.minValue));
14
- if (properties.maxValue)
14
+ if (properties.maxValue != null)
15
15
  x.push(vg.isLte(properties.maxValue));
16
16
  return x.length > 0
17
17
  ? vg.pipe([toInteger, ...x], { returnIndex: 0 })
@@ -9,9 +9,9 @@ let NumberType = class NumberType {
9
9
  }
10
10
  [DECODER](properties) {
11
11
  const x = [];
12
- if (properties.minValue)
12
+ if (properties.minValue != null)
13
13
  x.push(vg.isGte(properties.minValue));
14
- if (properties.maxValue)
14
+ if (properties.maxValue != null)
15
15
  x.push(vg.isLte(properties.maxValue));
16
16
  return x.length > 0
17
17
  ? vg.pipe([toNumber, ...x], { returnIndex: 0 })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/common",
3
- "version": "1.17.1",
3
+ "version": "1.17.3",
4
4
  "description": "Opra common package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -10,7 +10,7 @@
10
10
  "@browsery/http-parser": "^0.5.9-r4",
11
11
  "@browsery/i18next": "^24.2.2",
12
12
  "@browsery/type-is": "^1.6.18-r8",
13
- "@jsopen/objects": "^1.5.2",
13
+ "@jsopen/objects": "^1.6.0",
14
14
  "fast-tokenizer": "^1.7.0",
15
15
  "putil-promisify": "^1.10.1",
16
16
  "putil-varhelpers": "^1.6.5",