build: update dependencies

This commit is contained in:
Anselm Stordeur
2019-01-09 14:31:51 +01:00
committed by Rainer Killinger
parent 98f02b8830
commit 6ceb763b5a
12 changed files with 1130 additions and 84 deletions

View File

@@ -1,4 +1,4 @@
import { SCConfigFile } from '@openstapps/core'; import {SCConfigFile, SCThingType} from '@openstapps/core';
/** /**
* This is the default configuration for app and backend * This is the default configuration for app and backend
@@ -51,9 +51,9 @@ const config: Partial<SCConfigFile> = {
backend: { backend: {
SCVersion: '1.0.0', SCVersion: '1.0.0',
hiddenTypes: [ hiddenTypes: [
'date series', SCThingType.DateSeries,
'diff', SCThingType.Diff,
'floor', SCThingType.Floor,
], ],
name: 'Technische Universität Berlin', name: 'Technische Universität Berlin',
namespace: '909a8cbc-8520-456c-b474-ef1525f14209', namespace: '909a8cbc-8520-456c-b474-ef1525f14209',
@@ -68,27 +68,52 @@ const config: Partial<SCConfigFile> = {
}, },
{ {
fieldName: 'categories', fieldName: 'categories',
onlyOnTypes: ['academic event', 'building', 'catalog', 'dish', 'point of interest', 'room'], onlyOnTypes: [
SCThingType.AcademicEvent,
SCThingType.Building,
SCThingType.Catalog,
SCThingType.Dish,
SCThingType.PointOfInterest,
SCThingType.Room,
],
sortTypes: ['ducet'], sortTypes: ['ducet'],
}, },
{ {
fieldName: 'geo.point.coordinates', fieldName: 'geo.point.coordinates',
onlyOnTypes: ['building', 'point of interest', 'room'], onlyOnTypes: [
SCThingType.Building,
SCThingType.PointOfInterest,
SCThingType.Room,
],
sortTypes: ['distance'], sortTypes: ['distance'],
}, },
{ {
fieldName: 'geo.point.coordinates', fieldName: 'geo.point.coordinates',
onlyOnTypes: ['building', 'point of interest', 'room'], onlyOnTypes: [
SCThingType.Building,
SCThingType.PointOfInterest,
SCThingType.Room,
],
sortTypes: ['distance'], sortTypes: ['distance'],
}, },
{ {
fieldName: 'inPlace.geo.point.coordinates', fieldName: 'inPlace.geo.point.coordinates',
onlyOnTypes: ['date series', 'dish', 'floor', 'organization', 'point of interest', 'room', 'ticket'], onlyOnTypes: [
SCThingType.DateSeries,
SCThingType.Dish,
SCThingType.Floor,
SCThingType.Organization,
SCThingType.PointOfInterest,
SCThingType.Room,
SCThingType.Ticket,
],
sortTypes: ['distance'], sortTypes: ['distance'],
}, },
{ {
fieldName: 'offers', fieldName: 'offers',
onlyOnTypes: ['dish'], onlyOnTypes: [
SCThingType.Dish,
],
sortTypes: ['price'], sortTypes: ['price'],
}, },
], ],
@@ -97,27 +122,55 @@ const config: Partial<SCConfigFile> = {
aggregations: [ aggregations: [
{ {
fieldName: 'categories', fieldName: 'categories',
onlyOnTypes: ['academic event', 'article', 'building', 'catalog', 'dish', 'point of interest', 'room'], onlyOnTypes: [
SCThingType.AcademicEvent,
SCThingType.Article,
SCThingType.Building,
SCThingType.Catalog,
SCThingType.Dish,
SCThingType.PointOfInterest,
SCThingType.Room,
],
}, },
{ {
fieldName: 'inPlace.name', fieldName: 'inPlace.name',
onlyOnTypes: ['date series', 'dish', 'floor', 'organization', 'point of interest', 'room', 'ticket'], onlyOnTypes: [
SCThingType.DateSeries,
SCThingType.Dish,
SCThingType.Floor,
SCThingType.Organization,
SCThingType.PointOfInterest,
SCThingType.Room,
SCThingType.Ticket,
],
}, },
{ {
fieldName: 'academicTerms.acronym', fieldName: 'academicTerms.acronym',
onlyOnTypes: ['academic event', 'sport course'], onlyOnTypes: [
SCThingType.AcademicEvent,
SCThingType.SportCourse,
],
}, },
{ {
fieldName: 'academicTerm.acronym', fieldName: 'academicTerm.acronym',
onlyOnTypes: ['catalog'], onlyOnTypes: [
SCThingType.Catalog,
],
}, },
{ {
fieldName: 'majors', fieldName: 'majors',
onlyOnTypes: ['academic event'], onlyOnTypes: [
SCThingType.AcademicEvent,
],
}, },
{ {
fieldName: 'keywords', fieldName: 'keywords',
onlyOnTypes: ['article', 'book', 'message', 'video'], onlyOnTypes: [
SCThingType.Article,
SCThingType.Book,
SCThingType.Message,
SCThingType.Video,
],
}, },
{ {
fieldName: 'type', fieldName: 'type',
@@ -140,11 +193,11 @@ const config: Partial<SCConfigFile> = {
'tutorial': 1.05, 'tutorial': 1.05,
}, },
}, },
type: 'academic event', type: SCThingType.AcademicEvent,
}, },
{ {
factor: 1.6, factor: 1.6,
type: 'building', type: SCThingType.Building,
}, },
{ {
factor: 1, factor: 1,
@@ -156,7 +209,7 @@ const config: Partial<SCConfigFile> = {
'restaurant': 1.1, 'restaurant': 1.1,
}, },
}, },
type: 'point of interest', type: SCThingType.PointOfInterest,
}, },
{ {
factor: 1, factor: 1,
@@ -165,7 +218,7 @@ const config: Partial<SCConfigFile> = {
'main dish': 2, 'main dish': 2,
}, },
}, },
type: 'dish', type: SCThingType.Dish,
}, },
], ],
}, },

View File

@@ -1,4 +1,4 @@
import { ElasticsearchConfigFile } from '../src/storage/elasticsearch/Elasticsearch'; import {ElasticsearchConfigFile} from '../src/storage/elasticsearch/common';
/** /**
* A partial type which is recursive * A partial type which is recursive

1077
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -15,16 +15,17 @@
"compile": "rimraf lib && tsc --outDir lib && prepend lib/cli.js '#!/usr/bin/env node\n'", "compile": "rimraf lib && tsc --outDir lib && prepend lib/cli.js '#!/usr/bin/env node\n'",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"start": "NODE_CONFIG_ENV=elasticsearch ALLOW_NO_TRANSPORT=true node ./lib/cli.js", "start": "NODE_CONFIG_ENV=elasticsearch ALLOW_NO_TRANSPORT=true node ./lib/cli.js",
"tslint": "tslint 'src/**/*.ts'" "tslint": "tslint 'src/**/*.ts'",
"check-configuration": "openstapps-configuration"
}, },
"dependencies": { "dependencies": {
"@openstapps/core": "0.1.0", "@openstapps/core": "0.2.0",
"@openstapps/core-validator": "0.0.1", "@openstapps/core-tools": "0.1.1",
"@openstapps/logger": "0.0.3", "@openstapps/logger": "0.0.3",
"body-parser": "1.18.3", "body-parser": "1.18.3",
"config": "3.0.1", "config": "3.0.1",
"cors": "2.8.5", "cors": "2.8.5",
"elasticsearch": "15.2.0", "elasticsearch": "15.3.0",
"express": "4.16.4", "express": "4.16.4",
"express-promise-router": "3.0.3", "express-promise-router": "3.0.3",
"fs-extra": "7.0.1", "fs-extra": "7.0.1",

View File

@@ -14,12 +14,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCNotFoundErrorResponse, SCUnsupportedMediaTypeErrorResponse} from '@openstapps/core'; import {SCNotFoundErrorResponse, SCUnsupportedMediaTypeErrorResponse} from '@openstapps/core';
import {SCValidator} from '@openstapps/core-validator'; import {Validator} from '@openstapps/core-tools/lib/validate';
import * as bodyParser from 'body-parser'; import * as bodyParser from 'body-parser';
import * as config from 'config'; import * as config from 'config';
import * as cors from 'cors'; import * as cors from 'cors';
import * as express from 'express'; import * as express from 'express';
import * as morgan from 'morgan'; import * as morgan from 'morgan';
import {join} from 'path';
import {logger, mailer} from './common'; import {logger, mailer} from './common';
import {MailQueue} from './notification/MailQueue'; import {MailQueue} from './notification/MailQueue';
import {bulkAddRouter} from './routes/BulkAddRoute'; import {bulkAddRouter} from './routes/BulkAddRoute';
@@ -58,8 +59,8 @@ const databases: {[name: string]: DatabaseConstructor} = {
}; };
// validate config file // validate config file
export const scValidator = new SCValidator('./node_modules/@openstapps/core/lib/schema/'); export const scValidator = new Validator();
scValidator.feedValidator(); scValidator.addSchemas(join('node_modules', '@openstapps', 'core', 'lib', 'schema'));
// validate the config file // validate the config file
const configValidation = scValidator.validate(config.util.toObject(), 'ConfigFile'); const configValidation = scValidator.validate(config.util.toObject(), 'ConfigFile');

View File

@@ -19,7 +19,7 @@ import {
SCRoute, SCRoute,
SCValidationErrorResponse, SCValidationErrorResponse,
} from '@openstapps/core'; } from '@openstapps/core';
import {SCValidator} from '@openstapps/core-validator'; import {Validator} from '@openstapps/core-tools/lib/validate';
import {Application, Router} from 'express'; import {Application, Router} from 'express';
import PromiseRouter from 'express-promise-router'; import PromiseRouter from 'express-promise-router';
import {logger} from '../common'; import {logger} from '../common';
@@ -71,7 +71,7 @@ export function createRoute<RETURNTYPE>(
try { try {
// get the core validator from the app // get the core validator from the app
const validator: SCValidator = req.app.get('validator'); const validator: Validator = req.app.get('validator');
// validate request // validate request
const requestValidation = validator.validate(req.body, routeClass.requestBodyName.substring(2)); const requestValidation = validator.validate(req.body, routeClass.requestBodyName.substring(2));

View File

@@ -13,7 +13,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCBulkRequest, SCThingTypes} from '@openstapps/core'; import {SCBulkRequest, SCThingType} from '@openstapps/core';
import * as moment from 'moment'; import * as moment from 'moment';
import * as NodeCache from 'node-cache'; import * as NodeCache from 'node-cache';
import {promisify} from 'util'; import {promisify} from 'util';
@@ -59,7 +59,7 @@ export class Bulk implements SCBulkRequest {
/** /**
* Type of data in the bulk * Type of data in the bulk
*/ */
type: SCThingTypes; type: SCThingType;
/** /**
* Unique identifier of the bulk * Unique identifier of the bulk

View File

@@ -20,7 +20,7 @@ import {
SCSearchQuery, SCSearchQuery,
SCSearchResponse, SCSearchResponse,
SCThings, SCThings,
SCThingTypes, SCThingType,
SCUuid, SCUuid,
} from '@openstapps/core'; } from '@openstapps/core';
import * as ES from 'elasticsearch'; import * as ES from 'elasticsearch';
@@ -144,7 +144,7 @@ export class Elasticsearch implements Database {
let aliases: { let aliases: {
[index: string]: { [index: string]: {
aliases: { aliases: {
[K in SCThingTypes]: any [K in SCThingType]: any
}, },
}, },
}; };
@@ -214,7 +214,7 @@ export class Elasticsearch implements Database {
* @param source source of data in the index * @param source source of data in the index
* @param bulk bulk process which created this index * @param bulk bulk process which created this index
*/ */
private getIndex(type: SCThingTypes, source: string, bulk: SCBulkResponse) { private getIndex(type: SCThingType, source: string, bulk: SCBulkResponse) {
return `stapps_${type.toLowerCase().replace(' ', '_')}_${source}_${bulk.uid.substring(0, 8)}`; return `stapps_${type.toLowerCase().replace(' ', '_')}_${source}_${bulk.uid.substring(0, 8)}`;
} }

View File

@@ -13,10 +13,10 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCBackendAggregationConfiguration, SCFacet, SCThingTypes} from '@openstapps/core'; import {SCBackendAggregationConfiguration, SCFacet, SCThingType} from '@openstapps/core';
import {AggregationSchema} from './common'; import {AggregationSchema} from './common';
export type aggregationType = SCThingTypes | '@all'; export type aggregationType = SCThingType | '@all';
/** /**
* Builds the aggregation * Builds the aggregation

View File

@@ -13,7 +13,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThingTypes} from '@openstapps/core'; import {SCThingType} from '@openstapps/core';
import {SCThing} from '@openstapps/core'; import {SCThing} from '@openstapps/core';
/** /**
@@ -111,7 +111,7 @@ export interface ESTermsFilter {
*/ */
export interface ESTypeFilter { export interface ESTypeFilter {
type: { type: {
value: SCThingTypes; value: SCThingType;
}; };
} }

View File

@@ -22,7 +22,7 @@ import {
SCSearchSort, SCSearchSort,
SCSportCoursePriceGroup, SCSportCoursePriceGroup,
SCThingsField, SCThingsField,
SCThingTypes, SCThingType,
} from '@openstapps/core'; } from '@openstapps/core';
import {ElasticsearchConfig, ScriptSort} from './common'; import {ElasticsearchConfig, ScriptSort} from './common';
import { import {
@@ -221,7 +221,7 @@ export function buildQuery(
if (typeof params.sort !== 'undefined') { if (typeof params.sort !== 'undefined') {
params.sort.forEach((sort) => { params.sort.forEach((sort) => {
// types that the sort is supported on // types that the sort is supported on
const types: SCThingTypes[] = []; const types: SCThingType[] = [];
defaultConfig.backend.sortableFields defaultConfig.backend.sortableFields
.filter((sortableField) => { .filter((sortableField) => {