Resolve "Retype mapping generation using @elastic/elasticsearch"

This commit is contained in:
Thea Schöbl
2023-04-28 11:15:08 +00:00
committed by Rainer Killinger
parent fc850fe7ac
commit d90416e201
42 changed files with 441 additions and 596 deletions

132
package-lock.json generated
View File

@@ -91,6 +91,57 @@
"@jridgewell/trace-mapping": "0.3.9" "@jridgewell/trace-mapping": "0.3.9"
} }
}, },
"@elastic/elasticsearch": {
"version": "8.4.0",
"resolved": "https://registry.npmjs.org/@elastic/elasticsearch/-/elasticsearch-8.4.0.tgz",
"integrity": "sha512-0QZDBePnb5a+d76zjlMYq96IDf0AOuGP7JHugFUYlYwTC7rZvROuZSpoUsvpUjNH2CzMqWgNLIekIR6EHRMIQA==",
"requires": {
"@elastic/transport": "^8.2.0",
"tslib": "^2.4.0"
},
"dependencies": {
"tslib": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz",
"integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg=="
}
}
},
"@elastic/transport": {
"version": "8.3.1",
"resolved": "https://registry.npmjs.org/@elastic/transport/-/transport-8.3.1.tgz",
"integrity": "sha512-jv/Yp2VLvv5tSMEOF8iGrtL2YsYHbpf4s+nDsItxUTLFTzuJGpnsB/xBlfsoT2kAYEnWHiSJuqrbRcpXEI/SEQ==",
"requires": {
"debug": "^4.3.4",
"hpagent": "^1.0.0",
"ms": "^2.1.3",
"secure-json-parse": "^2.4.0",
"tslib": "^2.4.0",
"undici": "^5.5.1"
},
"dependencies": {
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"requires": {
"ms": "2.1.2"
},
"dependencies": {
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
}
}
},
"tslib": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz",
"integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg=="
}
}
},
"@es-joy/jsdoccomment": { "@es-joy/jsdoccomment": {
"version": "0.31.0", "version": "0.31.0",
"resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.31.0.tgz", "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.31.0.tgz",
@@ -196,6 +247,32 @@
"fastq": "^1.6.0" "fastq": "^1.6.0"
} }
}, },
"@openstapps/configuration": {
"version": "0.34.0",
"resolved": "https://registry.npmjs.org/@openstapps/configuration/-/configuration-0.34.0.tgz",
"integrity": "sha512-woPn4v3mQMUibtRs84VDpiC0EarowA4HvtpXbzc6ddWcYs8jtPLwA+mSbWSiROhJ2CeRQTJtMK+bJ4yhIRfdKw==",
"dev": true,
"requires": {
"@types/node": "14.18.36",
"@types/semver": "7.3.13",
"@types/yaml": "1.9.7",
"chalk": "4.1.2",
"commander": "9.5.0",
"semver": "7.3.8",
"yaml": "1.10.2"
},
"dependencies": {
"semver": {
"version": "7.3.8",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
}
}
}
},
"@openstapps/eslint-config": { "@openstapps/eslint-config": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/@openstapps/eslint-config/-/eslint-config-1.1.0.tgz", "resolved": "https://registry.npmjs.org/@openstapps/eslint-config/-/eslint-config-1.1.0.tgz",
@@ -404,6 +481,21 @@
"@types/node": "*" "@types/node": "*"
} }
}, },
"@types/semver": {
"version": "7.3.13",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz",
"integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==",
"dev": true
},
"@types/yaml": {
"version": "1.9.7",
"resolved": "https://registry.npmjs.org/@types/yaml/-/yaml-1.9.7.tgz",
"integrity": "sha512-8WMXRDD1D+wCohjfslHDgICd2JtMATZU8CkhH8LVJqcJs6dyYj5TGptzP8wApbmEullGBSsCEzzap73DQ1HJaA==",
"dev": true,
"requires": {
"yaml": "*"
}
},
"@typescript-eslint/eslint-plugin": { "@typescript-eslint/eslint-plugin": {
"version": "5.40.0", "version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.40.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.40.0.tgz",
@@ -782,6 +874,14 @@
"integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
"dev": true "dev": true
}, },
"busboy": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz",
"integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==",
"requires": {
"streamsearch": "^1.1.0"
}
},
"cacheable-lookup": { "cacheable-lookup": {
"version": "5.0.4", "version": "5.0.4",
"resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz",
@@ -2071,6 +2171,11 @@
"lru-cache": "^6.0.0" "lru-cache": "^6.0.0"
} }
}, },
"hpagent": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/hpagent/-/hpagent-1.2.0.tgz",
"integrity": "sha512-A91dYTeIB6NoXG+PxTQpCCDDnfHsW9kc06Lvpu1TEe9gnd6ZFeiBoRO9JvzEv6xK7EX97/dUE8g/vBMTqTS3CA=="
},
"http-cache-semantics": { "http-cache-semantics": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
@@ -2737,8 +2842,7 @@
"ms": { "ms": {
"version": "2.1.3", "version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
"dev": true
}, },
"nanoid": { "nanoid": {
"version": "3.3.1", "version": "3.3.1",
@@ -3269,6 +3373,11 @@
"regexp-tree": "~0.1.1" "regexp-tree": "~0.1.1"
} }
}, },
"secure-json-parse": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.7.0.tgz",
"integrity": "sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw=="
},
"semver": { "semver": {
"version": "6.3.0", "version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
@@ -3370,6 +3479,11 @@
"readable-stream": "^3.0.0" "readable-stream": "^3.0.0"
} }
}, },
"streamsearch": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
"integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg=="
},
"string-width": { "string-width": {
"version": "4.2.3", "version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
@@ -3592,6 +3706,14 @@
"integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==",
"optional": true "optional": true
}, },
"undici": {
"version": "5.22.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.22.0.tgz",
"integrity": "sha512-fR9RXCc+6Dxav4P9VV/sp5w3eFiSdOjJYsbtWfd4s5L5C4ogyuVpdKIVHeW0vV1MloM65/f7W45nR9ZxwVdyiA==",
"requires": {
"busboy": "^1.6.0"
}
},
"universalify": { "universalify": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
@@ -3694,6 +3816,12 @@
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true "dev": true
}, },
"yaml": {
"version": "1.10.2",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
"integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
"dev": true
},
"yargs": { "yargs": {
"version": "16.2.0", "version": "16.2.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",

View File

@@ -24,6 +24,7 @@
"lint:fix": "eslint --fix -c .eslintrc --ignore-path .eslintignore --ext .ts src/ test/" "lint:fix": "eslint --fix -c .eslintrc --ignore-path .eslintignore --ext .ts src/ test/"
}, },
"dependencies": { "dependencies": {
"@elastic/elasticsearch": "8.4.0",
"@openstapps/logger": "1.1.1", "@openstapps/logger": "1.1.1",
"commander": "9.5.0", "commander": "9.5.0",
"deepmerge": "4.2.2", "deepmerge": "4.2.2",
@@ -33,6 +34,7 @@
"typescript": "3.8.3" "typescript": "3.8.3"
}, },
"devDependencies": { "devDependencies": {
"@openstapps/configuration": "0.34.0",
"@testdeck/mocha": "0.3.3", "@testdeck/mocha": "0.3.3",
"@openstapps/eslint-config": "1.1.0", "@openstapps/eslint-config": "1.1.0",
"@types/chai": "4.3.4", "@types/chai": "4.3.4",

View File

@@ -12,8 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ElasticsearchFieldmap, ElasticsearchFilterableMap} from '../types/mapping'; import {MappingProperty} from '@elastic/elasticsearch/lib/api/types';
import {ElasticsearchDataType} from './typemap'; import {ElasticsearchFieldmap, SimpleType} from '../types/mapping';
const ducetSort = { const ducetSort = {
type: 'icu_collation_keyword', type: 'icu_collation_keyword',
@@ -22,12 +22,14 @@ const ducetSort = {
variant: '@collation=phonebook', variant: '@collation=phonebook',
}; };
const keyword: MappingProperty['type'] = 'keyword';
export const fieldmap: ElasticsearchFieldmap = { export const fieldmap: ElasticsearchFieldmap = {
aggregatable: { aggregatable: {
default: { default: {
raw: { raw: {
ignore_above: 10_000, ignore_above: 10_000,
type: ElasticsearchDataType.keyword, type: keyword,
}, },
}, },
ignore: ['global'], ignore: ['global'],
@@ -45,9 +47,9 @@ export const fieldmap: ElasticsearchFieldmap = {
export const filterableTagName = 'filterable'; export const filterableTagName = 'filterable';
export const filterableMap: ElasticsearchFilterableMap = { export const filterableMap: Record<string, SimpleType> = {
date: ElasticsearchDataType.keyword, date: 'keyword',
keyword: ElasticsearchDataType.keyword, keyword: 'keyword',
text: ElasticsearchDataType.keyword, text: 'keyword',
integer: ElasticsearchDataType.integer, integer: 'integer',
}; };

View File

@@ -12,53 +12,52 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ElasticsearchPremap} from '../types/mapping'; import {MappingProperty} from '@elastic/elasticsearch/lib/api/types';
import {ElasticsearchDataType} from './typemap';
export const premaps: ElasticsearchPremap = { export const premaps: Record<string, MappingProperty> = {
'CoordinateReferenceSystem': { 'CoordinateReferenceSystem': {
dynamic: true, dynamic: true,
properties: { properties: {
type: { type: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
}, },
}, },
'LineString': { 'LineString': {
type: ElasticsearchDataType.geo_shape, type: 'geo_shape',
}, },
'Point': { 'Point': {
properties: { properties: {
type: { type: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
coordinates: { coordinates: {
type: ElasticsearchDataType.geo_point, type: 'geo_point',
}, },
}, },
dynamic: 'strict', dynamic: 'strict',
}, },
'Polygon': { 'Polygon': {
type: ElasticsearchDataType.geo_shape, type: 'geo_shape',
}, },
'SCISO8601DateRange': { 'SCISO8601DateRange': {
type: ElasticsearchDataType.date_range, type: 'date_range',
}, },
'jsonpatch.OpPatch': { 'jsonpatch.OpPatch': {
dynamic: 'strict', dynamic: 'strict',
properties: { properties: {
from: { from: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
op: { op: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
path: { path: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
value: { value: {
// this is actually an 'any' type, however ES does not really support that. // this is actually an 'any' type; however, ES does not really support that.
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
}, },
}, },

View File

@@ -12,9 +12,9 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ElasticsearchSettings} from '../types/mapping'; import {IndicesPutTemplateRequest} from '@elastic/elasticsearch/lib/api/types';
export const settings: ElasticsearchSettings = { export const settings: IndicesPutTemplateRequest['settings'] = {
'mapping.total_fields.limit': 10_000, 'mapping.total_fields.limit': 10_000,
'max_result_window': 30_000, 'max_result_window': 30_000,
'number_of_replicas': 0, 'number_of_replicas': 0,

View File

@@ -12,58 +12,37 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {MappingFloatNumberProperty} from '@elastic/elasticsearch/lib/api/types';
import {ElasticsearchTypemap} from '../types/mapping'; import {ElasticsearchTypemap} from '../types/mapping';
export enum ElasticsearchDataType { export const PARSE_ERROR = 'PARSE_ERROR' as MappingFloatNumberProperty['type'];
missing_premap = 'MISSING_PREMAP', export const MISSING_PREMAP = 'MISSING_PREMAP' as MappingFloatNumberProperty['type'];
parse_error = 'PARSE_ERROR', export const TYPE_CONFLICT = 'TYPE_CONFLICT' as MappingFloatNumberProperty['type'];
type_conflict = 'TYPE_CONFLICT',
text = 'text',
keyword = 'keyword',
date = 'date',
// long = 'long',
// double = 'double',
float = 'float',
boolean = 'boolean',
ip = 'ip',
integer = 'integer',
object = 'object',
nested = 'nested',
geo_point = 'geo_point',
geo_shape = 'geo_shape',
completion = 'completion',
date_range = 'date_range',
// integer_range = 'integer_range',
// float_range = 'float_range',
// long_range = 'long_range',
// double_range = 'double_range',
// ip_range = 'ip_range',
}
export const typemap: ElasticsearchTypemap = { export const typemap: ElasticsearchTypemap = {
boolean: { boolean: {
default: ElasticsearchDataType.boolean, default: 'boolean',
}, },
false: { false: {
default: ElasticsearchDataType.boolean, default: 'boolean',
}, },
number: { number: {
default: ElasticsearchDataType.integer, default: 'integer',
float: ElasticsearchDataType.float, float: 'float',
integer: ElasticsearchDataType.integer, integer: 'integer',
date: ElasticsearchDataType.date, date: 'date',
}, },
string: { string: {
default: ElasticsearchDataType.text, default: 'text',
keyword: ElasticsearchDataType.keyword, keyword: 'keyword',
text: ElasticsearchDataType.text, text: 'text',
date: ElasticsearchDataType.date, date: 'date',
}, },
stringLiteral: { stringLiteral: {
default: ElasticsearchDataType.keyword, default: 'keyword',
}, },
true: { true: {
default: ElasticsearchDataType.boolean, default: 'boolean',
}, },
}; };

View File

@@ -12,6 +12,11 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {
MappingDynamicTemplate,
MappingObjectProperty,
MappingProperty,
} from '@elastic/elasticsearch/lib/api/types';
import {Logger} from '@openstapps/logger'; import {Logger} from '@openstapps/logger';
import merge from 'deepmerge'; import merge from 'deepmerge';
import {stringify} from 'flatted'; import {stringify} from 'flatted';
@@ -31,18 +36,11 @@ import {
import {fieldmap, filterableMap, filterableTagName} from './config/fieldmap'; import {fieldmap, filterableMap, filterableTagName} from './config/fieldmap';
import {premaps} from './config/premap'; import {premaps} from './config/premap';
import {settings} from './config/settings'; import {settings} from './config/settings';
import {dynamicTypes, ElasticsearchDataType, isTagType, typemap} from './config/typemap'; import {dynamicTypes, isTagType, MISSING_PREMAP, PARSE_ERROR, TYPE_CONFLICT, typemap} from './config/typemap';
import {AggregationSchema, ESNestedAggregation} from './types/aggregation'; import {AggregationSchema, ESNestedAggregation} from './types/aggregation';
import { import {ElasticsearchTemplateCollection, MappingGenTemplate} from './types/mapping';
ElasticsearchDynamicTemplate,
ElasticsearchObject,
ElasticsearchTemplateCollection,
ElasticsearchType,
ElasticsearchValue,
MappingGenTemplate,
} from './types/mapping';
let dynamicTemplates: ElasticsearchDynamicTemplate[] = []; let dynamicTemplates: Record<string, MappingDynamicTemplate>[] = [];
let errors: string[] = []; let errors: string[] = [];
let showErrors = true; let showErrors = true;
@@ -148,11 +146,11 @@ function trimString(value: string, maxLength: number): string {
*/ */
function getReflectionGeneric( function getReflectionGeneric(
type: ReferenceType, type: ReferenceType,
out: Map<string, ElasticsearchValue>, out: Map<string, MappingProperty>,
topTypeName: string, topTypeName: string,
path: string, path: string,
tags: CommentTag[], tags: CommentTag[],
): Map<string, ElasticsearchValue> { ): Map<string, MappingProperty> {
if ( if (
typeof type.typeArguments !== 'undefined' && typeof type.typeArguments !== 'undefined' &&
type.reflection instanceof DeclarationReflection && type.reflection instanceof DeclarationReflection &&
@@ -196,11 +194,11 @@ function getReflectionGeneric(
*/ */
function handleExternalType( function handleExternalType(
ref: ReferenceType, ref: ReferenceType,
generics: Map<string, ElasticsearchValue>, generics: Map<string, MappingProperty>,
path: string, path: string,
topTypeName: string, topTypeName: string,
tags: CommentTag[], tags: CommentTag[],
): ElasticsearchValue { ): MappingProperty {
for (const premap of Object.keys(premaps)) { for (const premap of Object.keys(premaps)) {
if (premap === ref.name) { if (premap === ref.name) {
return readFieldTags(premaps[premap], path, topTypeName, tags); return readFieldTags(premaps[premap], path, topTypeName, tags);
@@ -212,7 +210,7 @@ function handleExternalType(
if (typeof ref.typeArguments === 'undefined' || typeof ref.typeArguments[0] === 'undefined') { if (typeof ref.typeArguments === 'undefined' || typeof ref.typeArguments[0] === 'undefined') {
composeErrorMessage(path, topTypeName, 'Array with generics', 'array', 'Failed to parse'); composeErrorMessage(path, topTypeName, 'Array with generics', 'array', 'Failed to parse');
return {type: ElasticsearchDataType.parse_error}; return {type: PARSE_ERROR};
} }
return readFieldTags( return readFieldTags(
@@ -238,7 +236,7 @@ function handleExternalType(
composeErrorMessage(path, topTypeName, 'external type', ref.name, 'Missing pre-map'); composeErrorMessage(path, topTypeName, 'external type', ref.name, 'Missing pre-map');
return readFieldTags({type: ElasticsearchDataType.missing_premap}, path, topTypeName, tags); return readFieldTags({type: MISSING_PREMAP}, path, topTypeName, tags);
} }
/** /**
@@ -252,25 +250,20 @@ function handleExternalType(
*/ */
function handleDeclarationReflection( function handleDeclarationReflection(
decl: DeclarationReflection, decl: DeclarationReflection,
generics: Map<string, ElasticsearchValue>, generics: Map<string, MappingProperty>,
path: string, path: string,
topTypeName: string, topTypeName: string,
inheritedTags?: CommentTag[], inheritedTags?: CommentTag[],
): ElasticsearchValue { ): MappingProperty {
// check if we have an object referencing a generic // check if we have an object referencing a generic
if (generics.has(decl.name)) { if (generics.has(decl.name)) {
// if the object name is the same as the generic name // if the object name is the same as the generic name
return readFieldTags( return readFieldTags(generics.get(decl.name)!, path, topTypeName, decl.comment?.tags ?? []);
generics.get(decl.name) as ElasticsearchObject | ElasticsearchType,
path,
topTypeName,
decl.comment?.tags ?? [],
);
// use the value defined by the generic // use the value defined by the generic
} }
// start the actual handling process // start the actual handling process
const out: ElasticsearchObject = { const out: MappingProperty = {
dynamic: 'strict', dynamic: 'strict',
properties: {}, properties: {},
}; };
@@ -282,7 +275,7 @@ function handleDeclarationReflection(
if (typeof decl.indexSignature.type !== 'undefined') { if (typeof decl.indexSignature.type !== 'undefined') {
empty = false; empty = false;
const template: ElasticsearchDynamicTemplate = {}; const template: Record<string, MappingDynamicTemplate> = {};
template[decl.name] = { template[decl.name] = {
mapping: handleType( mapping: handleType(
decl.indexSignature.type, decl.indexSignature.type,
@@ -307,7 +300,7 @@ function handleDeclarationReflection(
if (typeof decl.children !== 'undefined' && decl.children.length > 0) { if (typeof decl.children !== 'undefined' && decl.children.length > 0) {
for (const child of decl.children) { for (const child of decl.children) {
empty = false; empty = false;
out.properties[child.name] = handleDeclarationReflection( out.properties![child.name] = handleDeclarationReflection(
child, child,
new Map(generics), new Map(generics),
`${path}${child.name}.`, `${path}${child.name}.`,
@@ -461,12 +454,12 @@ function arrayPriorityJoin(originals: CommentTag[], overrider: CommentTag[]): Co
*/ */
function handleUnionType( function handleUnionType(
type: UnionType, type: UnionType,
generics: Map<string, ElasticsearchValue>, generics: Map<string, MappingProperty>,
path: string, path: string,
topTypeName: string, topTypeName: string,
tags: CommentTag[], tags: CommentTag[],
): ElasticsearchValue { ): MappingProperty {
const list: ElasticsearchValue[] = []; const list: MappingProperty[] = [];
for (const subType of type.types) { for (const subType of type.types) {
if (subType instanceof IntrinsicType && subType.name === 'undefined') { if (subType instanceof IntrinsicType && subType.name === 'undefined') {
@@ -479,7 +472,7 @@ function handleUnionType(
let out = list[0]; let out = list[0];
for (const item of list) { for (const item of list) {
out = merge<ElasticsearchValue>(out, item); out = merge<MappingProperty>(out, item);
} }
return out; return out;
@@ -493,7 +486,7 @@ function handleUnionType(
'Empty union type. This is likely not a user error.', 'Empty union type. This is likely not a user error.',
); );
return {type: ElasticsearchDataType.parse_error}; return {type: PARSE_ERROR};
} }
/** /**
@@ -507,11 +500,11 @@ function handleUnionType(
*/ */
function handleType( function handleType(
type: Type, type: Type,
generics: Map<string, ElasticsearchValue>, generics: Map<string, MappingProperty>,
path: string, path: string,
topTypeName: string, topTypeName: string,
tags: CommentTag[], tags: CommentTag[],
): ElasticsearchValue { ): MappingProperty {
// logger.log((type as any).name); // logger.log((type as any).name);
if (type instanceof ArrayType) { if (type instanceof ArrayType) {
// array is irrelevant in Elasticsearch, so just go with the element type // array is irrelevant in Elasticsearch, so just go with the element type
@@ -556,11 +549,11 @@ function handleType(
if (type instanceof TypeParameterType) { if (type instanceof TypeParameterType) {
// check if we have an object referencing a generic // check if we have an object referencing a generic
if (generics.has(type.name)) { if (generics.has(type.name)) {
return generics.get(type.name) as ElasticsearchObject | ElasticsearchType; return generics.get(type.name)!;
} }
composeErrorMessage(path, topTypeName, 'Generic', type.name, 'Missing reflection, please report!'); composeErrorMessage(path, topTypeName, 'Generic', type.name, 'Missing reflection, please report!');
return {type: ElasticsearchDataType.parse_error}; return {type: PARSE_ERROR};
} }
if (type instanceof ReflectionType) { if (type instanceof ReflectionType) {
return readFieldTags( return readFieldTags(
@@ -573,7 +566,7 @@ function handleType(
composeErrorMessage(path, topTypeName, 'type', stringify(type), 'Not implemented type'); composeErrorMessage(path, topTypeName, 'type', stringify(type), 'Not implemented type');
return {type: ElasticsearchDataType.parse_error}; return {type: PARSE_ERROR};
} }
/** /**
@@ -617,12 +610,12 @@ function addAggregatable(path: string, topTypeName: string, global: boolean) {
* @param dataType the ElasticsearchDataType, for checking if a tag is a type tag * @param dataType the ElasticsearchDataType, for checking if a tag is a type tag
*/ */
function readFieldTags( function readFieldTags(
previous: ElasticsearchValue, previous: MappingProperty,
path: string, path: string,
topTypeName: string, topTypeName: string,
tags: CommentTag[], tags: CommentTag[],
dataType?: string, dataType?: string,
): ElasticsearchValue { ): MappingProperty {
for (const tag of tags) { for (const tag of tags) {
if (tag.tagName === aggregatableTag) { if (tag.tagName === aggregatableTag) {
addAggregatable(path, topTypeName, tag.text.trim() === aggregatableTagParameterGlobal); addAggregatable(path, topTypeName, tag.text.trim() === aggregatableTagParameterGlobal);
@@ -655,7 +648,7 @@ function readFieldTags(
previous.fields = {}; previous.fields = {};
} }
if ('type' in previous) { if ('type' in previous) {
const type = filterableMap[previous.type]; const type = filterableMap[previous.type!];
if (typeof type !== 'undefined') { if (typeof type !== 'undefined') {
// merge fields // merge fields
previous.fields = {...previous.fields, raw: {type: type}}; previous.fields = {...previous.fields, raw: {type: type}};
@@ -688,13 +681,8 @@ function readFieldTags(
* @param topTypeName the name of the SCThingType * @param topTypeName the name of the SCThingType
* @param tags tags attached to the value * @param tags tags attached to the value
*/ */
function readTypeTags( function readTypeTags(type: string, path: string, topTypeName: string, tags: CommentTag[]): MappingProperty {
type: string, let out: MappingProperty = {type: PARSE_ERROR};
path: string,
topTypeName: string,
tags: CommentTag[],
): ElasticsearchValue {
let out: ElasticsearchValue = {type: ElasticsearchDataType.parse_error};
if (typeof typemap[type] !== 'undefined') { if (typeof typemap[type] !== 'undefined') {
// first look if the value has a definition in the typemap // first look if the value has a definition in the typemap
@@ -704,23 +692,25 @@ function readTypeTags(
typeof typemap[type][tags[i].tagName] !== 'undefined' typeof typemap[type][tags[i].tagName] !== 'undefined'
) { ) {
// if we have a tag that indicates a type // if we have a tag that indicates a type
if (out.type !== ElasticsearchDataType.parse_error) { if (out.type !== PARSE_ERROR) {
composeErrorMessage( composeErrorMessage(
path, path,
topTypeName, topTypeName,
'type', 'type',
type, type,
`Type conflict; "${typemap[type][tags[i].tagName]}" would override "${out.type}"`, `Type conflict; "${typemap[type][tags[i].tagName]}" would override "${
(out as MappingProperty).type
}"`,
); );
out.type = ElasticsearchDataType.type_conflict; (out as MappingProperty).type = TYPE_CONFLICT;
continue; continue;
} }
out.type = typemap[type][tags[i].tagName]; (out as MappingProperty).type = typemap[type][tags[i].tagName];
} }
} }
if (out.type === ElasticsearchDataType.parse_error) { if (out.type === PARSE_ERROR) {
out.type = typemap[type].default; (out as MappingProperty).type = typemap[type].default;
} }
out = readFieldTags(out, path, topTypeName, tags, type); out = readFieldTags(out, path, topTypeName, tags, type);
@@ -904,21 +894,21 @@ export function generateTemplate(
const templateName = `template_${typeNameWithoutSpaces}`; const templateName = `template_${typeNameWithoutSpaces}`;
out[templateName] = { out[templateName] = {
mappings: handleDeclarationReflection(_interface, new Map(), '', typeName) as ElasticsearchObject, mappings: handleDeclarationReflection(_interface, new Map(), '', typeName) as MappingObjectProperty,
settings: settings, settings: settings,
index_patterns: [`stapps_${typeNameWithoutSpaces}*`], index_patterns: [`stapps_${typeNameWithoutSpaces}*`],
}; };
out[templateName].mappings.properties.creation_date = { out[templateName].mappings!.properties!.creation_date = {
type: ElasticsearchDataType.date, type: 'date',
}; };
out[templateName].mappings.dynamic_templates = dynamicTemplates; out[templateName].mappings!.dynamic_templates = dynamicTemplates;
// Set some properties // Set some properties
out[templateName].mappings._source = { out[templateName].mappings!._source = {
excludes: ['creation_date'], excludes: ['creation_date'],
}; };
out[templateName].mappings.date_detection = false; out[templateName].mappings!.date_detection = false;
dynamicTemplates = []; dynamicTemplates = [];

View File

@@ -35,7 +35,7 @@ export function getProjectReflection(sourcePath: PathLike, excludeExternals = tr
app.bootstrap({ app.bootstrap({
excludeExternals: excludeExternals, excludeExternals: excludeExternals,
ignoreCompilerErrors: false, // TODO: true ignoreCompilerErrors: true,
includeDeclarations: true, includeDeclarations: true,
module: ModuleKind.CommonJS, module: ModuleKind.CommonJS,
target: ScriptTarget.Latest, target: ScriptTarget.Latest,

341
src/types/mapping.d.ts vendored
View File

@@ -1,341 +0,0 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/*
* Copyright (C) 2019-2021 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {ElasticsearchDataType} from '../config/typemap';
import {AggregationSchema} from './aggregation';
// tslint:disable:no-any
/**
* Template output of the mapping generation
*/
export interface MappingGenTemplate {
/**
* All generated aggregations
*/
aggregations: AggregationSchema;
/**
* All errors that occurred
*/
errors: string[];
/**
* All mappings that were generated
*/
mappings: ElasticsearchTemplateCollection;
}
/**
* ElasticsearchValue can be either a type or an object.
*
* Both are composed similarly, and can be the value of a property
* of an Elasticsearch Object.
*/
export type ElasticsearchValue = ElasticsearchType | ElasticsearchObject | ElasticsearchGeoShape;
/**
* The Typemap is used to get the corresponding ElasticsearchDataType for a name provided by the ProjectReflection
*/
export interface ElasticsearchTypemap {
/**
* The `stringLiteral` type must always be provided
*/
stringLiteral: {
/**
* The default can be chosen freely, but must be provided
*/
default: ElasticsearchDataType;
};
/**
* The name of the JS type, so for `number` it would be number
*/
[name: string]: {
/**
* The default ElasticsearchDataType that should be used, if no tag or only not implemented tags are found
*/
default: ElasticsearchDataType;
/**
* The name of the tag, so for `@integer` it would be `integer`
*/
[name: string]: ElasticsearchDataType;
};
}
/**
* The representation of a `DynamicTemplate` in Elasticsearch
*
* https://www.elastic.co/guide/en/elasticsearch/reference/5.6/dynamic-templates.html
*/
export interface ElasticsearchDynamicTemplate {
/**
* The name of the dynamicTemplate
*/
[name: string]: {
/**
* The mapping of the template
*/
mapping: ElasticsearchValue;
/**
* With automatic mapping, we use `path_match` more or less out of convenience and because it is least error-prone
*
* This also means that match should match all ("*") interface names (because we provide the exact path of the
* interface)
*/
match: '*';
/**
* With automatic mapping, we use `path_match` more or less out of convenience and because it is least error-prone
*
* This also means that match_mapping_type should match all ("*") names (because we provide the exact path of the
* interface)
*/
match_mapping_type: '*';
/**
* With automatic mapping, we use `path_match` more or less out of convenience and because it is least error-prone
*/
path_match: string;
};
}
export interface ElasticsearchFilterableMap {
[name: string]: ElasticsearchDataType;
}
/**
* The Fieldmap contains all tag names for fields and the corresponding fields
*
* The Fieldmap works in a similar fashion to the Typemap
*/
export interface ElasticsearchFieldmap {
/**
* The name of the tag, so for `@sortable` it would be `sortable`
*/
[name: string]: {
/**
* The default value if no parameter is provided
*/
default: {
/**
* To allow the usage of `prev.fields = {...prev.fields, ...fieldmap[tag.tagName].default}`
*
* We could also have used `default: any`, but this adds slightly more improved type-safety.
*/
[name: string]: any;
};
/**
* The tag parameters that will be ignored
*
* Some tag parameters might not be important for your implementation, so you can add their names here to not get
* any errors. The `default` will be used in that case.
*/
ignore: string[];
/**
* The parameters of the tag, so for `@sortable ducet` it would be `ducet`
*/
[name: string]: {
/**
* To allow the usage of `prev.fields = {...prev.fields, ...fieldmap[tag.tagName][tag.text.trim()]}`
*
* We could also have used `default: any`, but this adds slightly more improved type-safety.
*/
[name: string]: any;
};
};
}
/**
* A primitive data type
*
* https://www.elastic.co/guide/en/elasticsearch/reference/5.6/mapping-types.html
*/
export interface ElasticsearchType {
/**
* Fields for a type
*
* The fields are optional, they are used for things like sorting, which is not needed for every single type.
*/
fields?: {
[name: string]: any;
};
/**
* The type as an ElasticsearchDataType
*/
type: ElasticsearchDataType;
}
/**
* A GeoShape data type
*
* https://www.elastic.co/guide/en/elasticsearch/reference/5.6/geo-shape.html
*/
export interface ElasticsearchGeoShape {
/**
* Does not exist; here for TypeScript compiler
*/
fields?: undefined;
/**
* This parameter may be used instead of tree_levels to set an appropriate value for the tree_levels parameter.
*
* The value specifies the desired precision and Elasticsearch will calculate the best tree_levels value to honor
* this precision. The value should be a number followed by an optional distance unit. Valid distance units include:
* in, inch, yd, yard, mi, miles, km, kilometers, m,meters, cm,centimeters, mm, millimeters.
*/
precision: string;
/**
* Name of the PrefixTree implementation to be used: geohash for GeohashPrefixTree and quadtree for QuadPrefixTree.
*/
tree: 'quadtree' | 'geohash';
/**
* The type of the object, obviously geo_shape
*/
type: ElasticsearchDataType.geo_shape;
}
/**
* An object data type
*
* https://www.elastic.co/guide/en/elasticsearch/reference/5.6/object.html
*/
export interface ElasticsearchObject {
/**
* Only for the top type
*/
_source?: {
/**
* Fields that should be excluded in the _source field
*/
excludes: ['creation_date'];
};
/**
* Whether the creation date should be set automatically
*/
date_detection?: boolean;
/**
* If the object is a dynamic
*
* https://www.elastic.co/guide/en/elasticsearch/reference/5.6/dynamic.html
* The default should be `'strict'`
*/
dynamic: true | false | 'strict';
/**
* dynamic_templates for an object
*
* https://www.elastic.co/guide/en/elasticsearch/reference/5.6/dynamic-templates.html
* This is a more complex topic, before touching this you should really know what you are doing.
*/
dynamic_templates?: ElasticsearchDynamicTemplate[];
/**
* Fields for a type
*
* The fields are optional, they are used for things like sorting, which is not needed for every single type.
*/
fields?: {
[name: string]: any;
};
/**
* Any properties of the object
*
* https://www.elastic.co/guide/en/elasticsearch/reference/5.6/properties.html
*/
properties: {
/**
* Each property can be any Elasticsearch value
*
* https://www.elastic.co/guide/en/elasticsearch/reference/5.6/mapping-types.html
*/
[name: string]: ElasticsearchValue;
};
}
/**
* A collection of Elasticsearch Templates
*/
export interface ElasticsearchTemplateCollection {
[indexName: string]: ElasticsearchTemplate;
}
/**
* An Elasticsearch template
*
* https://www.elastic.co/guide/en/elasticsearch/reference/5.6/mapping.html
* This is what you pass to Elasticsearch
*/
export interface ElasticsearchTemplate {
/**
* The name of the template, for referencing in Elasticsearch
*/
index_patterns: [string];
/**
* This is a pre-defined structure you should use for your mapping
*/
mappings: ElasticsearchObject;
/**
* The settings for Elasticsearch
*/
settings: ElasticsearchSettings;
}
/**
* A representation of ElasticsearchSettings used in Mappings
*/
export interface ElasticsearchSettings {
/**
* The settings
*/
[name: string]: any;
/**
* This is where any analyzers go
*
* https://www.elastic.co/guide/en/elasticsearch/reference/5.6/analysis-analyzers.html
*/
analysis?: {
[name: string]: any;
};
}
/**
* A premap for a specific value in a ProjectReflection
*
* This is meant to be used for external types. To aid performance, you usually should not include external libs in the
* ProjectReflection. This means that there is no way the generator can generate a mapping for it, so you can use the
* premaps to map out a type manually.
*/
export interface ElasticsearchPremap {
/**
* The name of the type with the corresponding map
*
* So for `const a: B` the name would be `B`
*/
[name: string]: ElasticsearchValue;
}

119
src/types/mapping.ts Normal file
View File

@@ -0,0 +1,119 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import {IndicesPutTemplateRequest, MappingProperty} from '@elastic/elasticsearch/lib/api/types';
/*
* Copyright (C) 2019-2021 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {AggregationSchema} from './aggregation';
/**
* Template output of the mapping generation
*/
export interface MappingGenTemplate {
/**
* All generated aggregations
*/
aggregations: AggregationSchema;
/**
* All errors that occurred
*/
errors: string[];
/**
* All mappings that were generated
*/
mappings: ElasticsearchTemplateCollection;
}
export type SimpleType = MappingProperty['type'] &
('keyword' | 'float' | 'boolean' | 'date' | 'integer' | 'text');
/**
* The Typemap is used to get the corresponding ElasticsearchDataType for a name provided by the ProjectReflection
*/
export interface ElasticsearchTypemap {
/**
* The `stringLiteral` type must always be provided
*/
stringLiteral: {
/**
* The default can be chosen freely, but must be provided
*/
default: SimpleType;
};
/**
* The name of the JS type, so for `number` it would be number
*/
[name: string]: {
/**
* The default ElasticsearchDataType that should be used, if no tag or only not implemented tags are found
*/
default: SimpleType;
/**
* The name of the tag, so for `@integer` it would be `integer`
*/
[name: string]: SimpleType;
};
}
/**
* The Fieldmap contains all tag names for fields and the corresponding fields
*
* The Fieldmap works in a similar fashion to the Typemap
*/
export interface ElasticsearchFieldmap {
/**
* The name of the tag, so for `@sortable` it would be `sortable`
*/
[name: string]: {
/**
* The default value if no parameter is provided
*/
default: {
/**
* To allow the usage of `prev.fields = {...prev.fields, ...fieldmap[tag.tagName].default}`
*
* We could also have used `default: any`, but this adds slightly more improved type-safety.
*/
[name: string]: any;
};
/**
* The tag parameters that will be ignored
*
* Some tag parameters might not be important for your implementation, so you can add their names here to not get
* any errors. The `default` will be used in that case.
*/
ignore: string[];
/**
* The parameters of the tag, so for `@sortable ducet` it would be `ducet`
*/
[name: string]: {
/**
* To allow the usage of `prev.fields = {...prev.fields, ...fieldmap[tag.tagName][tag.text.trim()]}`
*
* We could also have used `default: any`, but this adds slightly more improved type-safety.
*/
[name: string]: any;
};
};
}
/**
* A collection of Elasticsearch Templates
*/
export type ElasticsearchTemplateCollection = Record<string, Omit<IndicesPutTemplateRequest, 'name'>>;

View File

@@ -1,3 +1,6 @@
{ {
"extends": "../../../node_modules/@openstapps/configuration/tsconfig.json" "extends": "../../../node_modules/@openstapps/configuration/tsconfig.json",
"compilerOptions": {
"skipLibCheck": true
}
} }

View File

@@ -12,8 +12,7 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {MappingDynamicTemplate, MappingProperty} from '@elastic/elasticsearch/lib/api/types';
import {ElasticsearchDynamicTemplate, ElasticsearchValue} from '../../src/types/mapping';
export interface MapAggTestOptions { export interface MapAggTestOptions {
testName: string; testName: string;
@@ -29,7 +28,7 @@ export interface MapAggTestOptions {
export interface MinimalMappingDescription { export interface MinimalMappingDescription {
maps?: { maps?: {
[name: string]: ElasticsearchValue; [name: string]: MappingProperty;
}; };
dynamicTemplates?: ElasticsearchDynamicTemplate[]; dynamicTemplates?: Record<string, MappingDynamicTemplate>[];
} }

View File

@@ -12,7 +12,6 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ElasticsearchDataType} from '../../src/config/typemap';
import {generateTemplate} from '../../src/mapping'; import {generateTemplate} from '../../src/mapping';
import path from 'path'; import path from 'path';
import {expect} from 'chai'; import {expect} from 'chai';
@@ -121,10 +120,10 @@ export class MapAggTest {
}; };
const maps = map.maps ?? {}; const maps = map.maps ?? {};
maps.type = { maps.type = {
type: ElasticsearchDataType.text, type: 'text',
}; };
maps.creation_date = { maps.creation_date = {
type: ElasticsearchDataType.date, type: 'date',
}; };
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore can be used to index // @ts-ignore can be used to index

View File

@@ -12,10 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @date * @date
@@ -42,10 +40,10 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
directDate: { directDate: {
type: ElasticsearchDataType.date, type: 'date',
}, },
dateAlias: { dateAlias: {
type: ElasticsearchDataType.date, type: 'date',
}, },
}, },
}, },

View File

@@ -12,8 +12,7 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {PARSE_ERROR} from '../../../../lib/config/typemap';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
@@ -39,7 +38,7 @@ export const testConfig: MapAggTestOptions = {
dynamic: 'strict', dynamic: 'strict',
properties: { properties: {
bar: { bar: {
type: ElasticsearchDataType.parse_error, type: PARSE_ERROR,
}, },
}, },
}, },

View File

@@ -12,8 +12,7 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {TYPE_CONFLICT} from '../../../../lib/config/typemap';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
@@ -42,10 +41,10 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
stringDoubleTypeConflict: { stringDoubleTypeConflict: {
type: ElasticsearchDataType.type_conflict, type: TYPE_CONFLICT,
}, },
numberDoubleTypeConflict: { numberDoubleTypeConflict: {
type: ElasticsearchDataType.type_conflict, type: TYPE_CONFLICT,
}, },
}, },
}, },

View File

@@ -12,10 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @indexable * @indexable
@@ -49,10 +47,10 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
foo: { foo: {
type: ElasticsearchDataType.text, type: 'text',
}, },
bar: { bar: {
type: ElasticsearchDataType.text, type: 'text',
}, },
}, },
}, },

View File

@@ -12,10 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
export type FilterableEnumType = 'a' | 'b' | 'c'; export type FilterableEnumType = 'a' | 'b' | 'c';
@@ -54,34 +52,34 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
foo: { foo: {
type: ElasticsearchDataType.text, type: 'text',
fields: { fields: {
raw: { raw: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
}, },
}, },
bar: { bar: {
type: ElasticsearchDataType.keyword, type: 'keyword',
fields: { fields: {
raw: { raw: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
}, },
}, },
baz: { baz: {
type: ElasticsearchDataType.keyword, type: 'keyword',
fields: { fields: {
raw: { raw: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
}, },
}, },
buz: { buz: {
type: ElasticsearchDataType.keyword, type: 'keyword',
fields: { fields: {
raw: { raw: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
}, },
}, },

View File

@@ -12,10 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @indexable * @indexable
@@ -44,7 +42,7 @@ export const testConfig: MapAggTestOptions = {
dynamic: 'strict', dynamic: 'strict',
properties: { properties: {
bar: { bar: {
type: ElasticsearchDataType.integer, type: 'integer',
}, },
}, },
}, },
@@ -52,7 +50,7 @@ export const testConfig: MapAggTestOptions = {
dynamic: 'strict', dynamic: 'strict',
properties: { properties: {
bar: { bar: {
type: ElasticsearchDataType.text, type: 'text',
}, },
}, },
}, },

View File

@@ -12,10 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @indexable * @indexable
@@ -32,7 +30,7 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
foo: { foo: {
type: ElasticsearchDataType.boolean, type: 'boolean',
}, },
}, },
}, },

View File

@@ -12,10 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @indexable * @indexable
@@ -50,16 +48,16 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
keywordNumber: { keywordNumber: {
type: ElasticsearchDataType.integer, type: 'integer',
}, },
textNumber: { textNumber: {
type: ElasticsearchDataType.integer, type: 'integer',
}, },
integerString: { integerString: {
type: ElasticsearchDataType.text, type: 'text',
}, },
floatString: { floatString: {
type: ElasticsearchDataType.text, type: 'text',
}, },
}, },
}, },

View File

@@ -12,10 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @indexable * @indexable
@@ -48,10 +46,10 @@ export const testConfig: MapAggTestOptions = {
dynamic: 'strict', dynamic: 'strict',
properties: { properties: {
bar: { bar: {
type: ElasticsearchDataType.integer, type: 'integer',
}, },
baz: { baz: {
type: ElasticsearchDataType.text, type: 'text',
}, },
}, },
}, },

View File

@@ -12,8 +12,6 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ElasticsearchDataType} from '../../../../src/config/typemap';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ThingType} from './types'; import {ThingType} from './types';
@@ -45,15 +43,15 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
foo: { foo: {
type: ElasticsearchDataType.date, type: 'date',
fields: { fields: {
raw: { raw: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
}, },
}, },
bar: { bar: {
type: ElasticsearchDataType.date, type: 'date',
}, },
}, },
}, },

View File

@@ -12,8 +12,6 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ElasticsearchDataType} from '../../../../src/config/typemap';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ThingType} from './types'; import {ThingType} from './types';
@@ -42,13 +40,13 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
foo: { foo: {
type: ElasticsearchDataType.float, type: 'float',
}, },
bar: { bar: {
dynamic: 'strict', dynamic: 'strict',
properties: { properties: {
baz: { baz: {
type: ElasticsearchDataType.float, type: 'float',
}, },
}, },
}, },

View File

@@ -12,10 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @indexable * @indexable
@@ -44,13 +42,13 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
foo: { foo: {
type: ElasticsearchDataType.integer, type: 'integer',
}, },
bar: { bar: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
baz: { baz: {
type: ElasticsearchDataType.float, type: 'float',
}, },
}, },
}, },

View File

@@ -13,10 +13,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @indexable * @indexable
@@ -36,7 +34,7 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
foo: { foo: {
type: ElasticsearchDataType.text, type: 'text',
}, },
}, },
}, },

View File

@@ -12,10 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @indexable * @indexable
@@ -60,22 +58,22 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
esInteger: { esInteger: {
type: ElasticsearchDataType.integer, type: 'integer',
}, },
esFloat: { esFloat: {
type: ElasticsearchDataType.float, type: 'float',
}, },
esKeyword: { esKeyword: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
esText: { esText: {
type: ElasticsearchDataType.text, type: 'text',
}, },
esEpochMsDate: { esEpochMsDate: {
type: ElasticsearchDataType.date, type: 'date',
}, },
esStringDate: { esStringDate: {
type: ElasticsearchDataType.date, type: 'date',
}, },
}, },
}, },

View File

@@ -12,10 +12,9 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {MISSING_PREMAP} from '../../../../lib/config/typemap';
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @indexable * @indexable
@@ -35,7 +34,7 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
foo: { foo: {
type: ElasticsearchDataType.missing_premap, type: MISSING_PREMAP,
}, },
}, },
}, },

View File

@@ -12,10 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @indexable * @indexable
@@ -52,15 +50,15 @@ export const testConfig: MapAggTestOptions = {
dynamic: 'strict', dynamic: 'strict',
properties: { properties: {
depth3_1: { depth3_1: {
type: ElasticsearchDataType.integer, type: 'integer',
}, },
depth3_2: { depth3_2: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
}, },
}, },
depth2_2: { depth2_2: {
type: ElasticsearchDataType.boolean, type: 'boolean',
}, },
}, },
}, },

View File

@@ -12,10 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @indexable * @indexable
@@ -49,13 +47,13 @@ export const testConfig: MapAggTestOptions = {
dynamic: 'strict', dynamic: 'strict',
properties: { properties: {
a: { a: {
type: ElasticsearchDataType.boolean, type: 'boolean',
}, },
b: { b: {
type: ElasticsearchDataType.integer, type: 'integer',
}, },
intersection: { intersection: {
type: ElasticsearchDataType.text, type: 'text',
}, },
}, },
}, },

View File

@@ -12,10 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @indexable * @indexable
@@ -43,25 +41,26 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
foo: { foo: {
type: ElasticsearchDataType.keyword, type: 'keyword',
fields: { fields: {
raw: { raw: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
}, },
}, },
bar: { bar: {
type: ElasticsearchDataType.text, type: 'text',
fields: { fields: {
raw: { raw: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
sort: { sort: {
country: 'DE', country: 'DE',
language: 'de', language: 'de',
type: 'icu_collation_keyword', type: 'icu_collation_keyword',
variant: '@collation=phonebook', variant: '@collation=phonebook',
}, // eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any,
}, },
}, },
}, },

View File

@@ -12,10 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @indexable * @indexable
@@ -37,22 +35,22 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
numberDefault: { numberDefault: {
type: ElasticsearchDataType.integer, type: 'integer',
}, },
stringDefault: { stringDefault: {
type: ElasticsearchDataType.text, type: 'text',
}, },
booleanDefault: { booleanDefault: {
type: ElasticsearchDataType.boolean, type: 'boolean',
}, },
stringLiteralDefault: { stringLiteralDefault: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
booleanTrueLiteralDefault: { booleanTrueLiteralDefault: {
type: ElasticsearchDataType.boolean, type: 'boolean',
}, },
booleanFalseLiteralDefault: { booleanFalseLiteralDefault: {
type: ElasticsearchDataType.boolean, type: 'boolean',
}, },
}, },
}, },

View File

@@ -12,10 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @indexable * @indexable
@@ -45,36 +43,39 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
foo: { foo: {
type: ElasticsearchDataType.text, type: 'text',
fields: { fields: {
sort: { sort: {
country: 'DE', country: 'DE',
language: 'de', language: 'de',
type: 'icu_collation_keyword', type: 'icu_collation_keyword',
variant: '@collation=phonebook', variant: '@collation=phonebook',
}, // eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any,
}, },
}, },
bar: { bar: {
type: ElasticsearchDataType.text, type: 'text',
fields: { fields: {
sort: { sort: {
country: 'DE', country: 'DE',
language: 'de', language: 'de',
type: 'icu_collation_keyword', type: 'icu_collation_keyword',
variant: '@collation=phonebook', variant: '@collation=phonebook',
}, // eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any,
}, },
}, },
baz: { baz: {
type: ElasticsearchDataType.integer, type: 'integer',
fields: { fields: {
sort: { sort: {
country: 'DE', country: 'DE',
language: 'de', language: 'de',
type: 'icu_collation_keyword', type: 'icu_collation_keyword',
variant: '@collation=phonebook', variant: '@collation=phonebook',
}, // eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any,
}, },
}, },
}, },

View File

@@ -14,7 +14,6 @@
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @indexable * @indexable
@@ -46,16 +45,16 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
camelCase: { camelCase: {
type: ElasticsearchDataType.float, type: 'float',
}, },
lowerCase: { lowerCase: {
type: ElasticsearchDataType.float, type: 'float',
}, },
bar: { bar: {
dynamic: 'strict', dynamic: 'strict',
properties: { properties: {
baz: { baz: {
type: ElasticsearchDataType.float, type: 'float',
}, },
}, },
}, },

View File

@@ -12,10 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @indexable * @indexable
@@ -55,13 +53,13 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
textProperty: { textProperty: {
type: ElasticsearchDataType.text, type: 'text',
}, },
keywordProperty: { keywordProperty: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
overriddenTextAsKeyword: { overriddenTextAsKeyword: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
}, },
}, },

View File

@@ -12,10 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
export interface SCISO8601DateRange { export interface SCISO8601DateRange {
bar: string; bar: string;
@@ -36,7 +34,7 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
foo: { foo: {
type: ElasticsearchDataType.date_range, type: 'date_range',
}, },
}, },
}, },

View File

@@ -12,10 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @indexable * @indexable
@@ -39,7 +37,7 @@ export const testConfig: MapAggTestOptions = {
map: { map: {
maps: { maps: {
foo: { foo: {
type: ElasticsearchDataType.text, type: 'text',
}, },
}, },
}, },

View File

@@ -12,10 +12,8 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {ThingType} from './types'; import {ThingType} from './types';
import {MapAggTestOptions} from '../../map-agg-test-options'; import {MapAggTestOptions} from '../../map-agg-test-options';
import {ElasticsearchDataType} from '../../../../src/config/typemap';
/** /**
* @indexable * @indexable
@@ -53,13 +51,13 @@ export const testConfig: MapAggTestOptions = {
dynamic: 'strict', dynamic: 'strict',
properties: { properties: {
numberWrapper: { numberWrapper: {
type: ElasticsearchDataType.float, type: 'float',
}, },
stringWrapper: { stringWrapper: {
type: ElasticsearchDataType.keyword, type: 'keyword',
}, },
stringLiteralWrapper: { stringLiteralWrapper: {
type: ElasticsearchDataType.text, type: 'text',
}, },
}, },
}, },

View File

@@ -1,3 +1,6 @@
{ {
"extends": "../../../node_modules/@openstapps/configuration/tsconfig.json" "extends": "../../../node_modules/@openstapps/configuration/tsconfig.json",
"compilerOptions": {
"skipLibCheck": true
}
} }

View File

@@ -17,6 +17,7 @@
"noUnusedParameters": true, "noUnusedParameters": true,
"outDir": "./lib/", "outDir": "./lib/",
"strict": true, "strict": true,
"skipLibCheck": true,
"target": "es6" "target": "es6"
}, },
"exclude": [ "exclude": [

4
tsconfig.spec.json Normal file
View File

@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["./lib/", "./src/"]
}