mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Move @kbn/es-query into data plugin - remove unused code (#50903)
This commit is contained in:
parent
a325db07ad
commit
c0d2b29e8b
14 changed files with 0 additions and 618 deletions
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { convertExistsFilter } from '../exists';
|
||||
|
||||
describe('filter to kuery migration', function () {
|
||||
|
||||
describe('exists filter', function () {
|
||||
|
||||
it('should return a kuery node equivalent to the given filter', function () {
|
||||
const filter = {
|
||||
meta: {
|
||||
type: 'exists',
|
||||
key: 'foo',
|
||||
}
|
||||
};
|
||||
const result = convertExistsFilter(filter);
|
||||
|
||||
expect(result).to.have.property('type', 'function');
|
||||
expect(result).to.have.property('function', 'exists');
|
||||
expect(result.arguments[0].value).to.be('foo');
|
||||
});
|
||||
|
||||
it('should throw an exception if the given filter is not of type "exists"', function () {
|
||||
const filter = {
|
||||
meta: {
|
||||
type: 'foo'
|
||||
}
|
||||
};
|
||||
|
||||
expect(convertExistsFilter).withArgs(filter).to.throwException(
|
||||
/Expected filter of type "exists", got "foo"/
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import expect from '@kbn/expect';
|
||||
import { filterToKueryAST } from '../filter_to_kuery';
|
||||
|
||||
describe('filter to kuery migration', function () {
|
||||
|
||||
describe('filterToKueryAST', function () {
|
||||
|
||||
it('should hand off conversion of known filter types to the appropriate converter', function () {
|
||||
const filter = {
|
||||
meta: {
|
||||
type: 'exists',
|
||||
key: 'foo',
|
||||
}
|
||||
};
|
||||
const result = filterToKueryAST(filter);
|
||||
|
||||
expect(result).to.have.property('type', 'function');
|
||||
expect(result).to.have.property('function', 'exists');
|
||||
});
|
||||
|
||||
it('should thrown an error when an unknown filter type is encountered', function () {
|
||||
const filter = {
|
||||
meta: {
|
||||
type: 'foo',
|
||||
}
|
||||
};
|
||||
|
||||
expect(filterToKueryAST).withArgs(filter).to.throwException(/Couldn't convert that filter to a kuery/);
|
||||
});
|
||||
|
||||
it('should wrap the AST node of negated filters in a "not" function', function () {
|
||||
const filter = {
|
||||
meta: {
|
||||
type: 'exists',
|
||||
key: 'foo',
|
||||
}
|
||||
};
|
||||
const negatedFilter = _.set(_.cloneDeep(filter), 'meta.negate', true);
|
||||
|
||||
const result = filterToKueryAST(filter);
|
||||
const negatedResult = filterToKueryAST(negatedFilter);
|
||||
|
||||
expect(negatedResult).to.have.property('type', 'function');
|
||||
expect(negatedResult).to.have.property('function', 'not');
|
||||
expect(negatedResult.arguments[0]).to.eql(result);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import expect from '@kbn/expect';
|
||||
import { convertGeoBoundingBox } from '../geo_bounding_box';
|
||||
|
||||
describe('filter to kuery migration', function () {
|
||||
|
||||
describe('geo_bounding_box filter', function () {
|
||||
|
||||
it('should return a kuery node equivalent to the given filter', function () {
|
||||
const filter = {
|
||||
meta: {
|
||||
type: 'geo_bounding_box',
|
||||
key: 'foo',
|
||||
params: {
|
||||
topLeft: {
|
||||
lat: 10,
|
||||
lon: 20,
|
||||
},
|
||||
bottomRight: {
|
||||
lat: 30,
|
||||
lon: 40,
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
const result = convertGeoBoundingBox(filter);
|
||||
|
||||
expect(result).to.have.property('type', 'function');
|
||||
expect(result).to.have.property('function', 'geoBoundingBox');
|
||||
|
||||
const { arguments: [ { value: fieldName }, ...args ] } = result;
|
||||
expect(fieldName).to.be('foo');
|
||||
|
||||
const argByName = _.mapKeys(args, 'name');
|
||||
expect(argByName.topLeft.value.value).to.be('10, 20');
|
||||
expect(argByName.bottomRight.value.value).to.be('30, 40');
|
||||
});
|
||||
|
||||
it('should throw an exception if the given filter is not of type "geo_bounding_box"', function () {
|
||||
const filter = {
|
||||
meta: {
|
||||
type: 'foo'
|
||||
}
|
||||
};
|
||||
|
||||
expect(convertGeoBoundingBox).withArgs(filter).to.throwException(
|
||||
/Expected filter of type "geo_bounding_box", got "foo"/
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { convertGeoPolygon } from '../geo_polygon';
|
||||
|
||||
describe('filter to kuery migration', function () {
|
||||
|
||||
describe('geo_polygon filter', function () {
|
||||
|
||||
it('should return a kuery node equivalent to the given filter', function () {
|
||||
const filter = {
|
||||
meta: {
|
||||
type: 'geo_polygon',
|
||||
key: 'foo',
|
||||
params: {
|
||||
points: [
|
||||
{
|
||||
lat: 10,
|
||||
lon: 20,
|
||||
},
|
||||
{
|
||||
lat: 30,
|
||||
lon: 40,
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
const result = convertGeoPolygon(filter);
|
||||
|
||||
expect(result).to.have.property('type', 'function');
|
||||
expect(result).to.have.property('function', 'geoPolygon');
|
||||
|
||||
const { arguments: [ { value: fieldName }, ...args ] } = result;
|
||||
expect(fieldName).to.be('foo');
|
||||
|
||||
expect(args[0].value).to.be('10, 20');
|
||||
expect(args[1].value).to.be('30, 40');
|
||||
});
|
||||
|
||||
it('should throw an exception if the given filter is not of type "geo_polygon"', function () {
|
||||
const filter = {
|
||||
meta: {
|
||||
type: 'foo'
|
||||
}
|
||||
};
|
||||
|
||||
expect(convertGeoPolygon).withArgs(filter).to.throwException(
|
||||
/Expected filter of type "geo_polygon", got "foo"/
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { convertPhraseFilter } from '../phrase';
|
||||
|
||||
describe('filter to kuery migration', function () {
|
||||
|
||||
describe('phrase filter', function () {
|
||||
|
||||
it('should return a kuery node equivalent to the given filter', function () {
|
||||
const filter = {
|
||||
meta: {
|
||||
type: 'phrase',
|
||||
key: 'foo',
|
||||
params: {
|
||||
query: 'bar'
|
||||
},
|
||||
}
|
||||
};
|
||||
const result = convertPhraseFilter(filter);
|
||||
|
||||
expect(result).to.have.property('type', 'function');
|
||||
expect(result).to.have.property('function', 'is');
|
||||
|
||||
const { arguments: [ { value: fieldName }, { value: value } ] } = result;
|
||||
expect(fieldName).to.be('foo');
|
||||
expect(value).to.be('bar');
|
||||
});
|
||||
|
||||
it('should throw an exception if the given filter is not of type "phrase"', function () {
|
||||
const filter = {
|
||||
meta: {
|
||||
type: 'foo'
|
||||
}
|
||||
};
|
||||
|
||||
expect(convertPhraseFilter).withArgs(filter).to.throwException(
|
||||
/Expected filter of type "phrase", got "foo"/
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import expect from '@kbn/expect';
|
||||
import { convertRangeFilter } from '../range';
|
||||
|
||||
describe('filter to kuery migration', function () {
|
||||
|
||||
describe('range filter', function () {
|
||||
|
||||
it('should return a kuery node equivalent to the given filter', function () {
|
||||
const filter = {
|
||||
meta: {
|
||||
type: 'range',
|
||||
key: 'foo',
|
||||
params: {
|
||||
gt: 1000,
|
||||
lt: 8000,
|
||||
},
|
||||
}
|
||||
};
|
||||
const result = convertRangeFilter(filter);
|
||||
|
||||
expect(result).to.have.property('type', 'function');
|
||||
expect(result).to.have.property('function', 'range');
|
||||
|
||||
const { arguments: [ { value: fieldName }, ...args ] } = result;
|
||||
expect(fieldName).to.be('foo');
|
||||
|
||||
const argByName = _.mapKeys(args, 'name');
|
||||
expect(argByName.gt.value.value).to.be(1000);
|
||||
expect(argByName.lt.value.value).to.be(8000);
|
||||
});
|
||||
|
||||
it('should throw an exception if the given filter is not of type "range"', function () {
|
||||
const filter = {
|
||||
meta: {
|
||||
type: 'foo'
|
||||
}
|
||||
};
|
||||
|
||||
expect(convertRangeFilter).withArgs(filter).to.throwException(
|
||||
/Expected filter of type "range", got "foo"/
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { nodeTypes } from '../node_types';
|
||||
|
||||
export function convertExistsFilter(filter) {
|
||||
if (filter.meta.type !== 'exists') {
|
||||
throw new Error(`Expected filter of type "exists", got "${filter.meta.type}"`);
|
||||
}
|
||||
|
||||
const { key } = filter.meta;
|
||||
return nodeTypes.function.buildNode('exists', key);
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { nodeTypes } from '../node_types';
|
||||
import { convertPhraseFilter } from './phrase';
|
||||
import { convertRangeFilter } from './range';
|
||||
import { convertExistsFilter } from './exists';
|
||||
import { convertGeoBoundingBox } from './geo_bounding_box';
|
||||
import { convertGeoPolygon } from './geo_polygon';
|
||||
|
||||
const conversionChain = [
|
||||
convertPhraseFilter,
|
||||
convertRangeFilter,
|
||||
convertExistsFilter,
|
||||
convertGeoBoundingBox,
|
||||
convertGeoPolygon,
|
||||
];
|
||||
|
||||
export function filterToKueryAST(filter) {
|
||||
const { negate } = filter.meta;
|
||||
|
||||
const node = conversionChain.reduce((acc, converter) => {
|
||||
if (acc !== null) return acc;
|
||||
|
||||
try {
|
||||
return converter(filter);
|
||||
}
|
||||
catch (ex) {
|
||||
return null;
|
||||
}
|
||||
}, null);
|
||||
|
||||
if (!node) {
|
||||
throw new Error(`Couldn't convert that filter to a kuery`);
|
||||
}
|
||||
|
||||
return negate ? nodeTypes.function.buildNode('not', node) : node;
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import { nodeTypes } from '../node_types';
|
||||
|
||||
export function convertGeoBoundingBox(filter) {
|
||||
if (filter.meta.type !== 'geo_bounding_box') {
|
||||
throw new Error(`Expected filter of type "geo_bounding_box", got "${filter.meta.type}"`);
|
||||
}
|
||||
|
||||
const { key, params } = filter.meta;
|
||||
const camelParams = _.mapKeys(params, (value, key) => _.camelCase(key));
|
||||
return nodeTypes.function.buildNode('geoBoundingBox', key, camelParams);
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { nodeTypes } from '../node_types';
|
||||
|
||||
export function convertGeoPolygon(filter) {
|
||||
if (filter.meta.type !== 'geo_polygon') {
|
||||
throw new Error(`Expected filter of type "geo_polygon", got "${filter.meta.type}"`);
|
||||
}
|
||||
|
||||
const { key, params: { points } } = filter.meta;
|
||||
return nodeTypes.function.buildNode('geoPolygon', key, points);
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export { filterToKueryAST } from './filter_to_kuery';
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { nodeTypes } from '../node_types';
|
||||
|
||||
export function convertPhraseFilter(filter) {
|
||||
if (filter.meta.type !== 'phrase') {
|
||||
throw new Error(`Expected filter of type "phrase", got "${filter.meta.type}"`);
|
||||
}
|
||||
|
||||
const { key, params } = filter.meta;
|
||||
return nodeTypes.function.buildNode('is', key, params.query);
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { nodeTypes } from '../node_types';
|
||||
|
||||
export function convertRangeFilter(filter) {
|
||||
if (filter.meta.type !== 'range') {
|
||||
throw new Error(`Expected filter of type "range", got "${filter.meta.type}"`);
|
||||
}
|
||||
|
||||
const { key, params } = filter.meta;
|
||||
return nodeTypes.function.buildNode('range', key, params);
|
||||
}
|
|
@ -18,6 +18,5 @@
|
|||
*/
|
||||
|
||||
export * from './ast';
|
||||
export * from './filter_migration';
|
||||
export { nodeTypes } from './node_types';
|
||||
export * from './errors';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue