@opra/elastic 0.18.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Panates
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @opra/mongodb
2
+
3
+ OPRA MongoDB package.
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ElasticAdapter = void 0;
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
+ const common_1 = require("@opra/common");
9
+ const transform_filter_js_1 = tslib_1.__importDefault(require("./transform-filter.js"));
10
+ const transform_key_values_js_1 = tslib_1.__importDefault(require("./transform-key-values.js"));
11
+ const transform_projection_js_1 = tslib_1.__importDefault(require("./transform-projection.js"));
12
+ const transform_sort_js_1 = tslib_1.__importDefault(require("./transform-sort.js"));
13
+ var ElasticAdapter;
14
+ (function (ElasticAdapter) {
15
+ ElasticAdapter.transformFilter = transform_filter_js_1.default;
16
+ ElasticAdapter.transformKeyValues = transform_key_values_js_1.default;
17
+ ElasticAdapter.transformProjection = transform_projection_js_1.default;
18
+ ElasticAdapter.transformSort = transform_sort_js_1.default;
19
+ function transformRequest(request) {
20
+ const { resource } = request;
21
+ if (resource instanceof common_1.Collection || resource instanceof common_1.Singleton) {
22
+ const { args, operation } = request;
23
+ let options = {};
24
+ switch (operation) {
25
+ case 'findMany': {
26
+ let params = {};
27
+ const filter = ElasticAdapter.transformFilter(args.filter);
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);
41
+ options = (0, lodash_omitby_1.default)(options, lodash_isnil_1.default);
42
+ return {
43
+ method: 'search',
44
+ params,
45
+ options,
46
+ args: [params, options]
47
+ };
48
+ }
49
+ }
50
+ }
51
+ throw new TypeError(`Unimplemented request (${request.resourceKind}.${request.operation})`);
52
+ }
53
+ ElasticAdapter.transformRequest = transformRequest;
54
+ })(ElasticAdapter = exports.ElasticAdapter || (exports.ElasticAdapter = {}));
package/cjs/index.js ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./elastic-adapter.js"), exports);
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ require("@opra/core");
5
+ const lodash_isnil_1 = tslib_1.__importDefault(require("lodash.isnil"));
6
+ const common_1 = require("@opra/common");
7
+ function transformFilter(ast, negative) {
8
+ if (!ast)
9
+ return;
10
+ if (ast instanceof common_1.OpraFilter.QualifiedIdentifier) {
11
+ return ast.value;
12
+ }
13
+ if (ast instanceof common_1.OpraFilter.NumberLiteral ||
14
+ ast instanceof common_1.OpraFilter.StringLiteral ||
15
+ ast instanceof common_1.OpraFilter.BooleanLiteral ||
16
+ ast instanceof common_1.OpraFilter.NullLiteral ||
17
+ ast instanceof common_1.OpraFilter.DateLiteral ||
18
+ ast instanceof common_1.OpraFilter.TimeLiteral) {
19
+ return ast.value;
20
+ }
21
+ if (ast instanceof common_1.OpraFilter.ArrayExpression) {
22
+ return ast.items
23
+ .map(x => transformFilter(x, negative))
24
+ .filter(x => !(0, lodash_isnil_1.default)(x));
25
+ }
26
+ if (ast instanceof common_1.OpraFilter.NegativeExpression) {
27
+ return transformFilter(ast.expression, !negative);
28
+ }
29
+ if (ast instanceof common_1.OpraFilter.LogicalExpression) {
30
+ const v = ast.items
31
+ .map(x => transformFilter(x))
32
+ .filter(x => !(0, lodash_isnil_1.default)(x));
33
+ if (ast.op === 'and') {
34
+ return {
35
+ 'bool': {
36
+ [(negative ? 'must_not' : 'must')]: v
37
+ }
38
+ };
39
+ }
40
+ return wrapNot({
41
+ 'bool': { 'should': v }
42
+ }, negative);
43
+ }
44
+ if (ast instanceof common_1.OpraFilter.ParenthesizedExpression) {
45
+ return transformFilter(ast.expression, negative);
46
+ }
47
+ if (ast instanceof common_1.OpraFilter.ComparisonExpression)
48
+ return _transformComparisonExpression(ast, !!negative);
49
+ throw new Error(`${ast.kind} is not implemented yet`);
50
+ }
51
+ exports.default = transformFilter;
52
+ function _transformComparisonExpression(ast, negative) {
53
+ const left = transformFilter(ast.left, negative);
54
+ if (ast.right instanceof common_1.OpraFilter.QualifiedIdentifier) {
55
+ throw new TypeError('not implemented yet');
56
+ }
57
+ const right = transformFilter(ast.right);
58
+ if (right == null) {
59
+ const op = ast.op === '='
60
+ ? (negative ? '!=' : '=')
61
+ : (negative ? '=' : '!=');
62
+ if (op === '=')
63
+ return { 'bool': { 'must_not': { 'exists': { 'field': left } } } };
64
+ if (op === '!=')
65
+ return { 'bool': { 'exists': { 'field': left } } };
66
+ }
67
+ switch (ast.op) {
68
+ case '=':
69
+ return wrapNot({ 'term': { [left]: right } }, negative);
70
+ case '!=':
71
+ return wrapNot({ 'term': { [left]: right } }, !negative);
72
+ case '>':
73
+ return wrapNot({ 'range': { [left]: { 'gt': right } } }, negative);
74
+ case '>=':
75
+ return wrapNot({ 'range': { [left]: { 'gte': right } } }, negative);
76
+ case '<':
77
+ return wrapNot({ 'range': { [left]: { 'lt': right } } }, negative);
78
+ case '<=':
79
+ return wrapNot({ 'range': { [left]: { 'lte': right } } }, negative);
80
+ case 'in':
81
+ return wrapNot({ 'terms': { [left]: Array.isArray(right) ? right : [right] } }, negative);
82
+ case '!in':
83
+ return wrapNot({ 'terms': { [left]: Array.isArray(right) ? right : [right] } }, !negative);
84
+ case 'like':
85
+ return wrapNot({ 'wildcard': { [left]: String(right) } }, negative);
86
+ case '!like':
87
+ return wrapNot({ 'wildcard': { [left]: String(right) } }, !negative);
88
+ case 'ilike':
89
+ return wrapNot({
90
+ 'wildcard': {
91
+ [left]: {
92
+ 'value': String(right),
93
+ "case_insensitive": true
94
+ }
95
+ }
96
+ }, negative);
97
+ case '!ilike':
98
+ return wrapNot({
99
+ 'wildcard': {
100
+ [left]: {
101
+ 'value': String(right),
102
+ "case_insensitive": true
103
+ }
104
+ }
105
+ }, !negative);
106
+ }
107
+ throw new Error(`ComparisonExpression operator (${ast.op}) not implemented yet`);
108
+ }
109
+ const wrapNot = (o, negative) => negative ? { 'bool': { 'must_not': o } } : o;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function transformKeyValues(resource, keyValues) {
4
+ const { primaryKey } = resource;
5
+ if (primaryKey.length > 1) {
6
+ const out = {};
7
+ primaryKey.forEach((k, i) => {
8
+ out[k] = typeof keyValues === 'object' ? keyValues[k] : keyValues[i];
9
+ });
10
+ return out;
11
+ }
12
+ return { [primaryKey[0]]: keyValues };
13
+ }
14
+ exports.default = transformKeyValues;
@@ -0,0 +1,56 @@
1
+ "use strict";
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
+ const common_1 = require("@opra/common");
7
+ function transformProjection(dataType, args) {
8
+ let includes;
9
+ let excludes;
10
+ if (args.include && !args.pick) {
11
+ includes = includes || [];
12
+ for (const [k, f] of dataType.fields) {
13
+ if (f.exclusive)
14
+ continue;
15
+ if (f.type instanceof common_1.ComplexType)
16
+ includes.push(k + '.*');
17
+ else
18
+ includes.push(k);
19
+ }
20
+ }
21
+ if (args.pick) {
22
+ includes = includes || [];
23
+ for (const k of args.pick) {
24
+ const f = dataType.getField(k);
25
+ if (f.type instanceof common_1.ComplexType)
26
+ includes.push(k + '.*');
27
+ else
28
+ includes.push(k);
29
+ }
30
+ }
31
+ if (args.include) {
32
+ includes = includes || [];
33
+ for (const k of args.include) {
34
+ const f = dataType.getField(k);
35
+ if (f.type instanceof common_1.ComplexType)
36
+ includes.push(k + '.*');
37
+ else
38
+ includes.push(k);
39
+ }
40
+ }
41
+ if (args.omit) {
42
+ excludes = excludes || [];
43
+ for (const k of args.omit) {
44
+ const f = dataType.getField(k);
45
+ if (f.type instanceof common_1.ComplexType)
46
+ excludes.push(k + '.*');
47
+ else
48
+ excludes.push(k);
49
+ }
50
+ }
51
+ return (0, lodash_omitby_1.default)({
52
+ includes,
53
+ excludes
54
+ }, lodash_isnil_1.default);
55
+ }
56
+ exports.default = transformProjection;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function transformSort(sort) {
4
+ if (!(sort && sort.length))
5
+ return;
6
+ const out = [];
7
+ sort.forEach(k => {
8
+ if (k.startsWith('-'))
9
+ out.push({ [k.substring(1)]: 'desc' });
10
+ else if (k.startsWith('+'))
11
+ out.push(k.substring(1));
12
+ else
13
+ out.push(k);
14
+ });
15
+ return out;
16
+ }
17
+ exports.default = transformSort;
@@ -0,0 +1,50 @@
1
+ /* eslint-disable camelcase */
2
+ import isNil from 'lodash.isnil';
3
+ import omitBy from 'lodash.omitby';
4
+ import { Collection, Singleton } from '@opra/common';
5
+ import _transformFilter from './transform-filter.js';
6
+ import _transformKeyValues from './transform-key-values.js';
7
+ import _transformProjection from './transform-projection.js';
8
+ import _transformSort from './transform-sort.js';
9
+ export var ElasticAdapter;
10
+ (function (ElasticAdapter) {
11
+ ElasticAdapter.transformFilter = _transformFilter;
12
+ ElasticAdapter.transformKeyValues = _transformKeyValues;
13
+ ElasticAdapter.transformProjection = _transformProjection;
14
+ ElasticAdapter.transformSort = _transformSort;
15
+ function transformRequest(request) {
16
+ const { resource } = request;
17
+ if (resource instanceof Collection || resource instanceof Singleton) {
18
+ const { args, operation } = request;
19
+ let options = {};
20
+ switch (operation) {
21
+ case 'findMany': {
22
+ let params = {};
23
+ const filter = ElasticAdapter.transformFilter(args.filter);
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);
37
+ options = omitBy(options, isNil);
38
+ return {
39
+ method: 'search',
40
+ params,
41
+ options,
42
+ args: [params, options]
43
+ };
44
+ }
45
+ }
46
+ }
47
+ throw new TypeError(`Unimplemented request (${request.resourceKind}.${request.operation})`);
48
+ }
49
+ ElasticAdapter.transformRequest = transformRequest;
50
+ })(ElasticAdapter || (ElasticAdapter = {}));
package/esm/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from './elastic-adapter.js';
@@ -0,0 +1,105 @@
1
+ import '@opra/core';
2
+ import isNil from 'lodash.isnil';
3
+ import { OpraFilter } from '@opra/common';
4
+ export default function transformFilter(ast, negative) {
5
+ if (!ast)
6
+ return;
7
+ if (ast instanceof OpraFilter.QualifiedIdentifier) {
8
+ return ast.value;
9
+ }
10
+ if (ast instanceof OpraFilter.NumberLiteral ||
11
+ ast instanceof OpraFilter.StringLiteral ||
12
+ ast instanceof OpraFilter.BooleanLiteral ||
13
+ ast instanceof OpraFilter.NullLiteral ||
14
+ ast instanceof OpraFilter.DateLiteral ||
15
+ ast instanceof OpraFilter.TimeLiteral) {
16
+ return ast.value;
17
+ }
18
+ if (ast instanceof OpraFilter.ArrayExpression) {
19
+ return ast.items
20
+ .map(x => transformFilter(x, negative))
21
+ .filter(x => !isNil(x));
22
+ }
23
+ if (ast instanceof OpraFilter.NegativeExpression) {
24
+ return transformFilter(ast.expression, !negative);
25
+ }
26
+ if (ast instanceof OpraFilter.LogicalExpression) {
27
+ const v = ast.items
28
+ .map(x => transformFilter(x))
29
+ .filter(x => !isNil(x));
30
+ if (ast.op === 'and') {
31
+ return {
32
+ 'bool': {
33
+ [(negative ? 'must_not' : 'must')]: v
34
+ }
35
+ };
36
+ }
37
+ return wrapNot({
38
+ 'bool': { 'should': v }
39
+ }, negative);
40
+ }
41
+ if (ast instanceof OpraFilter.ParenthesizedExpression) {
42
+ return transformFilter(ast.expression, negative);
43
+ }
44
+ if (ast instanceof OpraFilter.ComparisonExpression)
45
+ return _transformComparisonExpression(ast, !!negative);
46
+ throw new Error(`${ast.kind} is not implemented yet`);
47
+ }
48
+ function _transformComparisonExpression(ast, negative) {
49
+ const left = transformFilter(ast.left, negative);
50
+ if (ast.right instanceof OpraFilter.QualifiedIdentifier) {
51
+ throw new TypeError('not implemented yet');
52
+ }
53
+ const right = transformFilter(ast.right);
54
+ if (right == null) {
55
+ const op = ast.op === '='
56
+ ? (negative ? '!=' : '=')
57
+ : (negative ? '=' : '!=');
58
+ if (op === '=')
59
+ return { 'bool': { 'must_not': { 'exists': { 'field': left } } } };
60
+ if (op === '!=')
61
+ return { 'bool': { 'exists': { 'field': left } } };
62
+ }
63
+ switch (ast.op) {
64
+ case '=':
65
+ return wrapNot({ 'term': { [left]: right } }, negative);
66
+ case '!=':
67
+ return wrapNot({ 'term': { [left]: right } }, !negative);
68
+ case '>':
69
+ return wrapNot({ 'range': { [left]: { 'gt': right } } }, negative);
70
+ case '>=':
71
+ return wrapNot({ 'range': { [left]: { 'gte': right } } }, negative);
72
+ case '<':
73
+ return wrapNot({ 'range': { [left]: { 'lt': right } } }, negative);
74
+ case '<=':
75
+ return wrapNot({ 'range': { [left]: { 'lte': right } } }, negative);
76
+ case 'in':
77
+ return wrapNot({ 'terms': { [left]: Array.isArray(right) ? right : [right] } }, negative);
78
+ case '!in':
79
+ return wrapNot({ 'terms': { [left]: Array.isArray(right) ? right : [right] } }, !negative);
80
+ case 'like':
81
+ return wrapNot({ 'wildcard': { [left]: String(right) } }, negative);
82
+ case '!like':
83
+ return wrapNot({ 'wildcard': { [left]: String(right) } }, !negative);
84
+ case 'ilike':
85
+ return wrapNot({
86
+ 'wildcard': {
87
+ [left]: {
88
+ 'value': String(right),
89
+ "case_insensitive": true
90
+ }
91
+ }
92
+ }, negative);
93
+ case '!ilike':
94
+ return wrapNot({
95
+ 'wildcard': {
96
+ [left]: {
97
+ 'value': String(right),
98
+ "case_insensitive": true
99
+ }
100
+ }
101
+ }, !negative);
102
+ }
103
+ throw new Error(`ComparisonExpression operator (${ast.op}) not implemented yet`);
104
+ }
105
+ const wrapNot = (o, negative) => negative ? { 'bool': { 'must_not': o } } : o;
@@ -0,0 +1,11 @@
1
+ export default function transformKeyValues(resource, keyValues) {
2
+ const { primaryKey } = resource;
3
+ if (primaryKey.length > 1) {
4
+ const out = {};
5
+ primaryKey.forEach((k, i) => {
6
+ out[k] = typeof keyValues === 'object' ? keyValues[k] : keyValues[i];
7
+ });
8
+ return out;
9
+ }
10
+ return { [primaryKey[0]]: keyValues };
11
+ }
@@ -0,0 +1,52 @@
1
+ import isNil from 'lodash.isnil';
2
+ import omitBy from 'lodash.omitby';
3
+ import { ComplexType } from '@opra/common';
4
+ export default function transformProjection(dataType, args) {
5
+ let includes;
6
+ let excludes;
7
+ if (args.include && !args.pick) {
8
+ includes = includes || [];
9
+ for (const [k, f] of dataType.fields) {
10
+ if (f.exclusive)
11
+ continue;
12
+ if (f.type instanceof ComplexType)
13
+ includes.push(k + '.*');
14
+ else
15
+ includes.push(k);
16
+ }
17
+ }
18
+ if (args.pick) {
19
+ includes = includes || [];
20
+ for (const k of args.pick) {
21
+ const f = dataType.getField(k);
22
+ if (f.type instanceof ComplexType)
23
+ includes.push(k + '.*');
24
+ else
25
+ includes.push(k);
26
+ }
27
+ }
28
+ if (args.include) {
29
+ includes = includes || [];
30
+ for (const k of args.include) {
31
+ const f = dataType.getField(k);
32
+ if (f.type instanceof ComplexType)
33
+ includes.push(k + '.*');
34
+ else
35
+ includes.push(k);
36
+ }
37
+ }
38
+ if (args.omit) {
39
+ excludes = excludes || [];
40
+ for (const k of args.omit) {
41
+ const f = dataType.getField(k);
42
+ if (f.type instanceof ComplexType)
43
+ excludes.push(k + '.*');
44
+ else
45
+ excludes.push(k);
46
+ }
47
+ }
48
+ return omitBy({
49
+ includes,
50
+ excludes
51
+ }, isNil);
52
+ }
@@ -0,0 +1,14 @@
1
+ export default function transformSort(sort) {
2
+ if (!(sort && sort.length))
3
+ return;
4
+ const out = [];
5
+ sort.forEach(k => {
6
+ if (k.startsWith('-'))
7
+ out.push({ [k.substring(1)]: 'desc' });
8
+ else if (k.startsWith('+'))
9
+ out.push(k.substring(1));
10
+ else
11
+ out.push(k);
12
+ });
13
+ return out;
14
+ }
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@opra/elastic",
3
+ "version": "0.18.0",
4
+ "description": "Opra Elastic Search adapter package",
5
+ "author": "Panates",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/panates/opra.git",
10
+ "directory": "packages/elastic"
11
+ },
12
+ "scripts": {
13
+ "compile": "tsc",
14
+ "prebuild": "npm run lint && npm run clean",
15
+ "build": "npm run build:cjs && npm run build:esm",
16
+ "build:cjs": "tsc -b tsconfig-build-cjs.json",
17
+ "build:esm": "tsc -b tsconfig-build-esm.json",
18
+ "postbuild": "cp README.md package.json ../../LICENSE ../../build/elastic && cp ../../package.cjs.json ../../build/elastic/cjs/package.json",
19
+ "lint": "eslint . --max-warnings=0",
20
+ "test": "jest",
21
+ "cover": "jest --collect-coverage",
22
+ "clean": "npm run clean:src && npm run clean:dist && npm run clean:cover",
23
+ "clean:src": "ts-cleanup -s src --all && ts-cleanup -s test --all",
24
+ "clean:dist": "rimraf ../../build/elastic",
25
+ "clean:cover": "rimraf ../../coverage/elastic"
26
+ },
27
+ "dependencies": {
28
+ "lodash": "^4.17.21"
29
+ },
30
+ "devDependencies": {
31
+ "@elastic/elasticsearch": "^8.7.0",
32
+ "@faker-js/faker": "^8.0.0",
33
+ "ts-gems": "^2.4.0"
34
+ },
35
+ "peerDependencies": {
36
+ "@elastic/elasticsearch": ">=8.7.0",
37
+ "@opra/common": "^0.18.0",
38
+ "@opra/core": "^0.18.0"
39
+ },
40
+ "type": "module",
41
+ "types": "types/index.d.ts",
42
+ "exports": {
43
+ ".": {
44
+ "require": "./cjs/index.js",
45
+ "default": "./esm/index.js"
46
+ },
47
+ "./cjs": "./cjs/index.js",
48
+ "./esm": "./esm/index.js"
49
+ },
50
+ "engines": {
51
+ "node": ">=16.0",
52
+ "npm": ">=7.0.0"
53
+ },
54
+ "files": [
55
+ "bin/",
56
+ "cjs/",
57
+ "esm/",
58
+ "types/",
59
+ "LICENSE",
60
+ "README.md"
61
+ ],
62
+ "keywords": [
63
+ "opra",
64
+ "elastic",
65
+ "elasticsearch",
66
+ "adapter"
67
+ ]
68
+ }
@@ -0,0 +1,12 @@
1
+ import { Request } from '@opra/core';
2
+ import _transformFilter from './transform-filter.js';
3
+ import _transformKeyValues from './transform-key-values.js';
4
+ import _transformProjection from './transform-projection.js';
5
+ import _transformSort from './transform-sort.js';
6
+ export declare namespace ElasticAdapter {
7
+ const transformFilter: typeof _transformFilter;
8
+ const transformKeyValues: typeof _transformKeyValues;
9
+ const transformProjection: typeof _transformProjection;
10
+ const transformSort: typeof _transformSort;
11
+ function transformRequest(request: Request): any;
12
+ }
@@ -0,0 +1 @@
1
+ export * from './elastic-adapter.js';
@@ -0,0 +1,3 @@
1
+ import '@opra/core';
2
+ import { OpraFilter } from '@opra/common';
3
+ export default function transformFilter(ast: OpraFilter.Expression | undefined, negative?: boolean): any;
@@ -0,0 +1,2 @@
1
+ import { Collection } from '@opra/common';
2
+ export default function transformKeyValues(resource: Collection, keyValues: any): Record<string, any>;
@@ -0,0 +1,6 @@
1
+ import { ComplexType } from '@opra/common';
2
+ export default function transformProjection(dataType: ComplexType, args: {
3
+ pick?: string[];
4
+ omit?: string[];
5
+ include?: string[];
6
+ }): any;
@@ -0,0 +1 @@
1
+ export default function transformSort(sort?: string[]): any[] | undefined;