mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 00:52:55 +00:00
feat: pipeline improvements
This commit is contained in:
@@ -8,13 +8,13 @@
|
||||
"main": "./src/index.js",
|
||||
"types": "./src/types.d.ts",
|
||||
"files": [
|
||||
"app.js",
|
||||
"lib",
|
||||
"src",
|
||||
"schema",
|
||||
"README.md",
|
||||
"CHANGELOG.md"
|
||||
],
|
||||
"scripts": {
|
||||
"docs": "typedoc --json ./docs/docs.json --options ../../typedoc.base.json src/types.d.ts",
|
||||
"format": "prettier . -c --ignore-path ../../.gitignore",
|
||||
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
|
||||
"lint": "tsc --noEmit && eslint --ext .js src/",
|
||||
@@ -25,9 +25,7 @@
|
||||
"@elastic/elasticsearch": "8.10.0",
|
||||
"@openstapps/json-schema-generator": "workspace:*",
|
||||
"@openstapps/tsup-plugin": "workspace:*",
|
||||
"@types/json-schema": "7.0.14",
|
||||
"ajv": "8.12.0",
|
||||
"ajv-formats": "2.1.1"
|
||||
"@types/json-schema": "7.0.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openstapps/eslint-config": "workspace:*",
|
||||
|
||||
@@ -71,11 +71,10 @@ export class Context {
|
||||
*/
|
||||
deriveContext(reference) {
|
||||
let referenceName = typeof reference === 'string' ? getNameFromRef(reference) : undefined;
|
||||
if (referenceName === undefined) this.bail(`Can't find reference name for ${reference}`);
|
||||
let definition = /** @type {JSONSchema} */ (typeof reference === 'string' ? undefined : reference);
|
||||
|
||||
if (!definition && !this.generator.cache.has(referenceName)) {
|
||||
const reference = this.generator.project.definitions[referenceName];
|
||||
if (!definition && !this.generator.cache.has(/** @type {string} */ (referenceName))) {
|
||||
const reference = this.generator.project.definitions[/** @type {string} */ (referenceName)];
|
||||
if (typeof reference === 'boolean') this.bail('Invalid schema');
|
||||
definition = reference;
|
||||
if (typeof definition !== 'object') this.bail(`Invalid path ${referenceName}`);
|
||||
|
||||
@@ -26,12 +26,12 @@ export class MappingGenerator {
|
||||
searchMods = {mods: {}};
|
||||
|
||||
/**
|
||||
* @param project {JSONSchema & Pick<Required<JSONSchema>, 'definitions'>}
|
||||
* @param project {JSONSchema}
|
||||
* @param options {import('../types.js').GeneratorOptions}
|
||||
*/
|
||||
constructor(project, options) {
|
||||
if (!project.definitions) throw new Error('Invalid schema');
|
||||
this.project = project;
|
||||
this.project = /** @type {JSONSchema & Pick<Required<JSONSchema>, 'definitions'>} */ (project);
|
||||
this.template = options.template ?? {};
|
||||
this.presets = new Map(Object.entries(options.presets));
|
||||
this.cache = new Map(
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* 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 {MappingDynamicTemplate, MappingProperty} from '@elastic/elasticsearch/lib/api/types';
|
||||
import {MappingDynamicTemplate, MappingProperty} from '@elastic/elasticsearch/lib/api/types.js';
|
||||
|
||||
export interface MapAggTestOptions {
|
||||
testName: string;
|
||||
|
||||
@@ -16,9 +16,9 @@ import {generateTemplate, getProjectReflection, settings} from '../../src';
|
||||
import path from 'path';
|
||||
import {expect} from 'chai';
|
||||
import {ProjectReflection} from 'typedoc';
|
||||
import {MapAggTestOptions, MinimalMappingDescription} from './map-agg-test-options';
|
||||
import type {AggregationSchema, ESNestedAggregation} from '../../schema/aggregations';
|
||||
import type {ElasticsearchTemplateCollection} from '../../schema/mappings';
|
||||
import {MapAggTestOptions, MinimalMappingDescription} from './map-agg-test-options.js';
|
||||
import type {AggregationSchema, ESNestedAggregation} from '../../schema/aggregations.js';
|
||||
import type {ElasticsearchTemplateCollection} from '../../schema/mappings.js';
|
||||
|
||||
export class MapAggTest {
|
||||
mapping_model_path!: string;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft-07/schema",
|
||||
"$ref": "#/definitions/MappingSchema",
|
||||
"definitions": {
|
||||
"MappingSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"schema": {
|
||||
"$ref": "https://json-schema.org/draft-07/schema"
|
||||
},
|
||||
"config": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": ["schema", "config"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "../mapping-test.schema.json",
|
||||
"schema": {
|
||||
"definitions": ""
|
||||
},
|
||||
"config": {}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"exclude": ["./lib/", "./src/"]
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import {defineConfig} from 'tsup';
|
||||
|
||||
export default defineConfig({
|
||||
entry: ['src/index.ts'],
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
format: 'esm',
|
||||
outDir: 'lib',
|
||||
});
|
||||
Reference in New Issue
Block a user