@opra/sqb 1.19.0 → 1.19.2

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.
@@ -33,15 +33,16 @@ function prepareFilter(filters) {
33
33
  }
34
34
  return arr.length > 1 ? sqb.And(...arr) : arr[0];
35
35
  }
36
+ const _isDate = valgen_1.vg.isDate({ trim: 'day' });
37
+ const _isDateTime = valgen_1.vg.isDate();
36
38
  function prepareFilterAst(ast) {
37
39
  if (!ast)
38
40
  return;
39
- if (ast instanceof common_1.OpraFilter.QualifiedIdentifier ||
40
- ast instanceof common_1.OpraFilter.Literal) {
41
- return ast.value;
42
- }
43
41
  if (ast instanceof common_1.OpraFilter.DateLiteral) {
44
- return (0, valgen_1.isDate)(ast.value, { coerce: true });
42
+ return _isDate(ast.value, { coerce: true });
43
+ }
44
+ if (ast instanceof common_1.OpraFilter.DateTimeLiteral) {
45
+ return _isDateTime(ast.value, { coerce: true });
45
46
  }
46
47
  if (ast instanceof common_1.OpraFilter.ArrayExpression) {
47
48
  return ast.items.map(prepareFilterAst);
@@ -99,5 +100,9 @@ function prepareFilterAst(ast) {
99
100
  throw new Error(`ComparisonExpression operator (${ast.op}) not implemented yet`);
100
101
  }
101
102
  }
103
+ if (ast instanceof common_1.OpraFilter.QualifiedIdentifier ||
104
+ ast instanceof common_1.OpraFilter.Literal) {
105
+ return ast.value;
106
+ }
102
107
  throw new Error(`${ast.kind} is not implemented yet`);
103
108
  }
@@ -1,7 +1,7 @@
1
1
  import '@opra/core';
2
2
  import { OpraFilter } from '@opra/common';
3
3
  import * as sqb from '@sqb/builder';
4
- import { isDate } from 'valgen';
4
+ import { vg } from 'valgen';
5
5
  /**
6
6
  * Prepare the SQB filter based on the provided filters and options.
7
7
  *
@@ -29,15 +29,16 @@ export default function prepareFilter(filters) {
29
29
  }
30
30
  return arr.length > 1 ? sqb.And(...arr) : arr[0];
31
31
  }
32
+ const _isDate = vg.isDate({ trim: 'day' });
33
+ const _isDateTime = vg.isDate();
32
34
  function prepareFilterAst(ast) {
33
35
  if (!ast)
34
36
  return;
35
- if (ast instanceof OpraFilter.QualifiedIdentifier ||
36
- ast instanceof OpraFilter.Literal) {
37
- return ast.value;
38
- }
39
37
  if (ast instanceof OpraFilter.DateLiteral) {
40
- return isDate(ast.value, { coerce: true });
38
+ return _isDate(ast.value, { coerce: true });
39
+ }
40
+ if (ast instanceof OpraFilter.DateTimeLiteral) {
41
+ return _isDateTime(ast.value, { coerce: true });
41
42
  }
42
43
  if (ast instanceof OpraFilter.ArrayExpression) {
43
44
  return ast.items.map(prepareFilterAst);
@@ -95,5 +96,9 @@ function prepareFilterAst(ast) {
95
96
  throw new Error(`ComparisonExpression operator (${ast.op}) not implemented yet`);
96
97
  }
97
98
  }
99
+ if (ast instanceof OpraFilter.QualifiedIdentifier ||
100
+ ast instanceof OpraFilter.Literal) {
101
+ return ast.value;
102
+ }
98
103
  throw new Error(`${ast.kind} is not implemented yet`);
99
104
  }
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@opra/sqb",
3
- "version": "1.19.0",
3
+ "version": "1.19.2",
4
4
  "description": "Opra SQB adapter package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
7
7
  "dependencies": {
8
8
  "reflect-metadata": "^0.2.2",
9
9
  "tslib": "^2.8.1",
10
- "valgen": "^5.17.1"
10
+ "valgen": "^5.17.2"
11
11
  },
12
12
  "peerDependencies": {
13
- "@opra/core": "^1.19.0",
14
- "@opra/http": "^1.19.0",
15
- "@sqb/connect": "^4.19.6"
13
+ "@opra/core": "^1.19.2",
14
+ "@opra/http": "^1.19.2",
15
+ "@sqb/connect": "^4.20.0"
16
16
  },
17
17
  "type": "module",
18
18
  "exports": {