@opra/elastic 0.32.2 → 0.32.4

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.
@@ -2,9 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ElasticAdapter = void 0;
4
4
  const tslib_1 = require("tslib");
5
- /* eslint-disable camelcase */
6
- const lodash_isnil_1 = tslib_1.__importDefault(require("lodash.isnil"));
7
- const lodash_omitby_1 = tslib_1.__importDefault(require("lodash.omitby"));
8
5
  const common_1 = require("@opra/common");
9
6
  const transform_filter_js_1 = tslib_1.__importDefault(require("./transform-filter.js"));
10
7
  const transform_key_values_js_1 = tslib_1.__importDefault(require("./transform-key-values.js"));
@@ -37,8 +34,8 @@ var ElasticAdapter;
37
34
  searchRequest._source = (0, transform_projection_js_1.default)(resource.type, params);
38
35
  if (params?.sort)
39
36
  searchRequest.sort = (0, transform_sort_js_1.default)(params.sort);
40
- searchRequest = (0, lodash_omitby_1.default)(searchRequest, lodash_isnil_1.default);
41
- options = (0, lodash_omitby_1.default)(options, lodash_isnil_1.default);
37
+ searchRequest = (0, common_1.omitNullish)(searchRequest);
38
+ options = (0, common_1.omitNullish)(options);
42
39
  return {
43
40
  method: 'search',
44
41
  params: searchRequest,
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  require("@opra/core");
5
- const lodash_isnil_1 = tslib_1.__importDefault(require("lodash.isnil"));
6
4
  const common_1 = require("@opra/common");
5
+ const isNil = (v) => v == null;
7
6
  function transformFilter(ast, negative) {
8
7
  if (!ast)
9
8
  return;
@@ -21,7 +20,7 @@ function transformFilter(ast, negative) {
21
20
  if (ast instanceof common_1.OpraFilter.ArrayExpression) {
22
21
  return ast.items
23
22
  .map(x => transformFilter(x, negative))
24
- .filter(x => !(0, lodash_isnil_1.default)(x));
23
+ .filter(x => !isNil(x));
25
24
  }
26
25
  if (ast instanceof common_1.OpraFilter.NegativeExpression) {
27
26
  return transformFilter(ast.expression, !negative);
@@ -29,7 +28,7 @@ function transformFilter(ast, negative) {
29
28
  if (ast instanceof common_1.OpraFilter.LogicalExpression) {
30
29
  const v = ast.items
31
30
  .map(x => transformFilter(x))
32
- .filter(x => !(0, lodash_isnil_1.default)(x));
31
+ .filter(x => !isNil(x));
33
32
  if (ast.op === 'and') {
34
33
  return {
35
34
  'bool': {
@@ -1,8 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const lodash_isnil_1 = tslib_1.__importDefault(require("lodash.isnil"));
5
- const lodash_omitby_1 = tslib_1.__importDefault(require("lodash.omitby"));
6
3
  const common_1 = require("@opra/common");
7
4
  function transformProjection(dataType, args) {
8
5
  let includes;
@@ -48,9 +45,9 @@ function transformProjection(dataType, args) {
48
45
  excludes.push(k);
49
46
  }
50
47
  }
51
- return (0, lodash_omitby_1.default)({
48
+ return (0, common_1.omitNullish)({
52
49
  includes,
53
50
  excludes
54
- }, lodash_isnil_1.default);
51
+ });
55
52
  }
56
53
  exports.default = transformProjection;
@@ -1,7 +1,4 @@
1
- /* eslint-disable camelcase */
2
- import isNil from 'lodash.isnil';
3
- import omitBy from 'lodash.omitby';
4
- import { Collection, Singleton } from '@opra/common';
1
+ import { Collection, omitNullish, Singleton } from '@opra/common';
5
2
  import _transformFilter from './transform-filter.js';
6
3
  import _transformKeyValues from './transform-key-values.js';
7
4
  import _transformProjection from './transform-projection.js';
@@ -33,8 +30,8 @@ export var ElasticAdapter;
33
30
  searchRequest._source = _transformProjection(resource.type, params);
34
31
  if (params?.sort)
35
32
  searchRequest.sort = _transformSort(params.sort);
36
- searchRequest = omitBy(searchRequest, isNil);
37
- options = omitBy(options, isNil);
33
+ searchRequest = omitNullish(searchRequest);
34
+ options = omitNullish(options);
38
35
  return {
39
36
  method: 'search',
40
37
  params: searchRequest,
@@ -1,6 +1,6 @@
1
1
  import '@opra/core';
2
- import isNil from 'lodash.isnil';
3
2
  import { OpraFilter } from '@opra/common';
3
+ const isNil = (v) => v == null;
4
4
  export default function transformFilter(ast, negative) {
5
5
  if (!ast)
6
6
  return;
@@ -1,6 +1,4 @@
1
- import isNil from 'lodash.isnil';
2
- import omitBy from 'lodash.omitby';
3
- import { ComplexType } from '@opra/common';
1
+ import { ComplexType, omitNullish } from '@opra/common';
4
2
  export default function transformProjection(dataType, args) {
5
3
  let includes;
6
4
  let excludes;
@@ -45,8 +43,8 @@ export default function transformProjection(dataType, args) {
45
43
  excludes.push(k);
46
44
  }
47
45
  }
48
- return omitBy({
46
+ return omitNullish({
49
47
  includes,
50
48
  excludes
51
- }, isNil);
49
+ });
52
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/elastic",
3
- "version": "0.32.2",
3
+ "version": "0.32.4",
4
4
  "description": "Opra Elastic Search adapter package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -25,21 +25,15 @@
25
25
  "clean:dist": "rimraf ../../build/client",
26
26
  "clean:cover": "rimraf ../../coverage/client"
27
27
  },
28
- "dependencies": {
29
- "lodash.isnil": "^4.0.0",
30
- "lodash.omitby": "^4.6.0"
31
- },
32
28
  "devDependencies": {
33
29
  "@elastic/elasticsearch": "^8.10.0",
34
30
  "@faker-js/faker": "^8.3.1",
35
- "@types/lodash.isnil": "^4.0.9",
36
- "@types/lodash.omitby": "^4.6.9",
37
- "ts-gems": "^2.7.1"
31
+ "ts-gems": "^2.8.0"
38
32
  },
39
33
  "peerDependencies": {
40
34
  "@elastic/elasticsearch": ">=8.7.0",
41
- "@opra/common": "^0.32.2",
42
- "@opra/core": "^0.32.2"
35
+ "@opra/common": "^0.32.4",
36
+ "@opra/core": "^0.32.4"
43
37
  },
44
38
  "type": "module",
45
39
  "module": "./esm/index.js",