@enterprise_search/indexconfig
Advanced tools
Comparing version
@@ -57,2 +57,11 @@ import { NameAnd } from "@laoban/utils"; | ||
} | ||
export type NameAndDescription = { | ||
name: string; | ||
description: string; | ||
}; | ||
export type ReportConfig = { | ||
reportFile: string; | ||
reportIndex: string; | ||
extraIndicies: NameAndDescription[]; | ||
}; | ||
export type PopulatedIndexItem = Required<IndexItem>; | ||
@@ -65,2 +74,3 @@ export interface RawIndexConfig { | ||
tests: TestConfig; | ||
report?: ReportConfig; | ||
} | ||
@@ -72,4 +82,2 @@ export declare function validatePopulatedIndexItem(name: string, p: PopulatedIndexItem): void; | ||
metricsFinalFile?: string; | ||
metricsReportFile?: string; | ||
metricsReportIndex?: string; | ||
metricsIndex?: string; | ||
@@ -87,2 +95,3 @@ }; | ||
metricsConfig: MetricsConfig; | ||
report?: ReportConfig; | ||
tests?: TestConfig; | ||
@@ -89,0 +98,0 @@ }; |
@@ -159,3 +159,28 @@ "use strict"; | ||
throw new Error('metrics.metricsIndex is required if metrics.metricsFinalFile is present'); | ||
return { config: result, tika, metricsConfig: metrics, tests }; | ||
const report = config.report; | ||
if (!report) | ||
throw new Error('report is required'); | ||
if (!report.reportFile) | ||
throw new Error('report.reportFile is required'); | ||
if (typeof report.reportFile !== 'string') | ||
throw new Error('report.reportFile is not a string'); | ||
if (!report.reportIndex) | ||
throw new Error('report.reportIndex is required'); | ||
if (typeof report.reportIndex !== 'string') | ||
throw new Error('report.reportIndex is not a string'); | ||
if (!report.extraIndicies) | ||
throw new Error('report.extraIndicies is required'); | ||
if (!Array.isArray(report.extraIndicies)) | ||
throw new Error('report.extraIndicies is not an array'); | ||
report.extraIndicies.map((nameAndDescription, i) => { | ||
if (!nameAndDescription.name) | ||
throw new Error(`report.extraIndicies[${i}].name is required`); | ||
if (typeof nameAndDescription.name !== 'string') | ||
throw new Error(`report.extraIndicies[${i}].name is not a string`); | ||
if (!nameAndDescription.description) | ||
throw new Error(`report.extraIndicies[${i}/${nameAndDescription.name}].description is required`); | ||
if (typeof nameAndDescription.description !== 'string') | ||
throw new Error(`report.extraIndicies[${i}/${nameAndDescription.name}].description is not a string`); | ||
}); | ||
return { config: result, tika, metricsConfig: metrics, report, tests }; | ||
} | ||
@@ -162,0 +187,0 @@ function validateConfig(config) { |
{ | ||
"name": "@enterprise_search/indexconfig", | ||
"description": "The parsing of config files. Default logic", | ||
"version": "0.8.27", | ||
"version": "0.8.28", | ||
"main": "dist/index", | ||
@@ -27,4 +27,4 @@ "types": "dist/index", | ||
"@itsmworkbench/yaml": "0.3.12", | ||
"@enterprise_search/kleislis": "0.8.27", | ||
"@enterprise_search/tika": "0.8.27", | ||
"@enterprise_search/kleislis": "0.8.28", | ||
"@enterprise_search/tika": "0.8.28", | ||
"debug": "^4.3.4" | ||
@@ -31,0 +31,0 @@ }, |
Sorry, the diff of this file is not supported yet
44719
6.28%690
5.18%+ Added
+ Added
- Removed
- Removed