@opra/elastic 0.22.0 → 0.23.0

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.
@@ -19,36 +19,36 @@ var ElasticAdapter;
19
19
  function transformRequest(request) {
20
20
  const { resource } = request;
21
21
  if (resource instanceof common_1.Collection || resource instanceof common_1.Singleton) {
22
- const { args, operation } = request;
22
+ const { params, operation } = request;
23
23
  let options = {};
24
24
  switch (operation) {
25
25
  case 'findMany': {
26
- let params = {};
27
- const filter = ElasticAdapter.transformFilter(args.filter);
26
+ let searchRequest = {};
27
+ const filter = ElasticAdapter.transformFilter(params?.filter);
28
28
  if (filter)
29
- params.query = filter;
30
- if (args.limit != null)
31
- params.size = args.limit;
32
- if (args.skip != null)
33
- params.from = args.skip;
34
- if (args.count)
35
- params.track_total_hits = true;
36
- if (args.pick || args.include || args.omit)
37
- params._source = (0, transform_projection_js_1.default)(resource.type, args);
38
- if (args.sort)
39
- params.sort = (0, transform_sort_js_1.default)(args.sort);
40
- params = (0, lodash_omitby_1.default)(params, lodash_isnil_1.default);
29
+ searchRequest.query = filter;
30
+ if (params?.limit != null)
31
+ searchRequest.size = params.limit;
32
+ if (params?.skip != null)
33
+ searchRequest.from = params.skip;
34
+ if (params?.count)
35
+ searchRequest.track_total_hits = true;
36
+ if (params?.pick || params?.include || params?.omit)
37
+ searchRequest._source = (0, transform_projection_js_1.default)(resource.type, params);
38
+ if (params?.sort)
39
+ searchRequest.sort = (0, transform_sort_js_1.default)(params.sort);
40
+ searchRequest = (0, lodash_omitby_1.default)(searchRequest, lodash_isnil_1.default);
41
41
  options = (0, lodash_omitby_1.default)(options, lodash_isnil_1.default);
42
42
  return {
43
43
  method: 'search',
44
- params,
44
+ params: searchRequest,
45
45
  options,
46
- args: [params, options]
46
+ args: [searchRequest, options]
47
47
  };
48
48
  }
49
49
  }
50
50
  }
51
- throw new TypeError(`Unimplemented request (${request.resourceKind}.${request.operation})`);
51
+ throw new TypeError(`Unimplemented request (${request.resource.kind}.${request.operation})`);
52
52
  }
53
53
  ElasticAdapter.transformRequest = transformRequest;
54
54
  })(ElasticAdapter || (exports.ElasticAdapter = ElasticAdapter = {}));
@@ -15,36 +15,36 @@ export var ElasticAdapter;
15
15
  function transformRequest(request) {
16
16
  const { resource } = request;
17
17
  if (resource instanceof Collection || resource instanceof Singleton) {
18
- const { args, operation } = request;
18
+ const { params, operation } = request;
19
19
  let options = {};
20
20
  switch (operation) {
21
21
  case 'findMany': {
22
- let params = {};
23
- const filter = ElasticAdapter.transformFilter(args.filter);
22
+ let searchRequest = {};
23
+ const filter = ElasticAdapter.transformFilter(params?.filter);
24
24
  if (filter)
25
- params.query = filter;
26
- if (args.limit != null)
27
- params.size = args.limit;
28
- if (args.skip != null)
29
- params.from = args.skip;
30
- if (args.count)
31
- params.track_total_hits = true;
32
- if (args.pick || args.include || args.omit)
33
- params._source = _transformProjection(resource.type, args);
34
- if (args.sort)
35
- params.sort = _transformSort(args.sort);
36
- params = omitBy(params, isNil);
25
+ searchRequest.query = filter;
26
+ if (params?.limit != null)
27
+ searchRequest.size = params.limit;
28
+ if (params?.skip != null)
29
+ searchRequest.from = params.skip;
30
+ if (params?.count)
31
+ searchRequest.track_total_hits = true;
32
+ if (params?.pick || params?.include || params?.omit)
33
+ searchRequest._source = _transformProjection(resource.type, params);
34
+ if (params?.sort)
35
+ searchRequest.sort = _transformSort(params.sort);
36
+ searchRequest = omitBy(searchRequest, isNil);
37
37
  options = omitBy(options, isNil);
38
38
  return {
39
39
  method: 'search',
40
- params,
40
+ params: searchRequest,
41
41
  options,
42
- args: [params, options]
42
+ args: [searchRequest, options]
43
43
  };
44
44
  }
45
45
  }
46
46
  }
47
- throw new TypeError(`Unimplemented request (${request.resourceKind}.${request.operation})`);
47
+ throw new TypeError(`Unimplemented request (${request.resource.kind}.${request.operation})`);
48
48
  }
49
49
  ElasticAdapter.transformRequest = transformRequest;
50
50
  })(ElasticAdapter || (ElasticAdapter = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/elastic",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "Opra Elastic Search adapter package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -34,8 +34,8 @@
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@elastic/elasticsearch": ">=8.7.0",
37
- "@opra/common": "^0.22.0",
38
- "@opra/core": "^0.22.0"
37
+ "@opra/common": "^0.23.0",
38
+ "@opra/core": "^0.23.0"
39
39
  },
40
40
  "type": "module",
41
41
  "types": "types/index.d.ts",