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
@@ -51,9 +51,9 @@ const config: Partial<SCConfigFile> = {
backend: {
SCVersion: '1.0.0',
hiddenTypes: [
'date series',
'diff',
'floor',
SCThingType.DateSeries,
SCThingType.Diff,
SCThingType.Floor,
],
name: 'Technische Universität Berlin',
namespace: '909a8cbc-8520-456c-b474-ef1525f14209',
@@ -68,27 +68,52 @@ const config: Partial<SCConfigFile> = {
},
{
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'],
},
{
fieldName: 'geo.point.coordinates',
onlyOnTypes: ['building', 'point of interest', 'room'],
onlyOnTypes: [
SCThingType.Building,
SCThingType.PointOfInterest,
SCThingType.Room,
],
sortTypes: ['distance'],
},
{
fieldName: 'geo.point.coordinates',
onlyOnTypes: ['building', 'point of interest', 'room'],
onlyOnTypes: [
SCThingType.Building,
SCThingType.PointOfInterest,
SCThingType.Room,
],
sortTypes: ['distance'],
},
{
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'],
},
{
fieldName: 'offers',
onlyOnTypes: ['dish'],
onlyOnTypes: [
SCThingType.Dish,
],
sortTypes: ['price'],
},
],
@@ -97,27 +122,55 @@ const config: Partial<SCConfigFile> = {
aggregations: [
{
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',
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',
onlyOnTypes: ['academic event', 'sport course'],
onlyOnTypes: [
SCThingType.AcademicEvent,
SCThingType.SportCourse,
],
},
{
fieldName: 'academicTerm.acronym',
onlyOnTypes: ['catalog'],
onlyOnTypes: [
SCThingType.Catalog,
],
},
{
fieldName: 'majors',
onlyOnTypes: ['academic event'],
onlyOnTypes: [
SCThingType.AcademicEvent,
],
},
{
fieldName: 'keywords',
onlyOnTypes: ['article', 'book', 'message', 'video'],
onlyOnTypes: [
SCThingType.Article,
SCThingType.Book,
SCThingType.Message,
SCThingType.Video,
],
},
{
fieldName: 'type',
@@ -140,11 +193,11 @@ const config: Partial<SCConfigFile> = {
'tutorial': 1.05,
},
},
type: 'academic event',
type: SCThingType.AcademicEvent,
},
{
factor: 1.6,
type: 'building',
type: SCThingType.Building,
},
{
factor: 1,
@@ -156,7 +209,7 @@ const config: Partial<SCConfigFile> = {
'restaurant': 1.1,
},
},
type: 'point of interest',
type: SCThingType.PointOfInterest,
},
{
factor: 1,
@@ -165,7 +218,7 @@ const config: Partial<SCConfigFile> = {
'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

View File

@@ -1,4 +1,4 @@
import { ElasticsearchConfigFile } from '../src/storage/elasticsearch/common';
import {ElasticsearchConfigFile} from '../src/storage/elasticsearch/common';
/**
* This is the default configuration for elasticsearch (a database)

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'",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"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": {
"@openstapps/core": "0.1.0",
"@openstapps/core-validator": "0.0.1",
"@openstapps/core": "0.2.0",
"@openstapps/core-tools": "0.1.1",
"@openstapps/logger": "0.0.3",
"body-parser": "1.18.3",
"config": "3.0.1",
"cors": "2.8.5",
"elasticsearch": "15.2.0",
"elasticsearch": "15.3.0",
"express": "4.16.4",
"express-promise-router": "3.0.3",
"fs-extra": "7.0.1",

View File

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

View File

@@ -19,7 +19,7 @@ import {
SCRoute,
SCValidationErrorResponse,
} from '@openstapps/core';
import {SCValidator} from '@openstapps/core-validator';
import {Validator} from '@openstapps/core-tools/lib/validate';
import {Application, Router} from 'express';
import PromiseRouter from 'express-promise-router';
import {logger} from '../common';
@@ -71,7 +71,7 @@ export function createRoute<RETURNTYPE>(
try {
// get the core validator from the app
const validator: SCValidator = req.app.get('validator');
const validator: Validator = req.app.get('validator');
// validate request
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
* 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 NodeCache from 'node-cache';
import {promisify} from 'util';
@@ -59,7 +59,7 @@ export class Bulk implements SCBulkRequest {
/**
* Type of data in the bulk
*/
type: SCThingTypes;
type: SCThingType;
/**
* Unique identifier of the bulk

View File

@@ -20,7 +20,7 @@ import {
SCSearchQuery,
SCSearchResponse,
SCThings,
SCThingTypes,
SCThingType,
SCUuid,
} from '@openstapps/core';
import * as ES from 'elasticsearch';
@@ -144,7 +144,7 @@ export class Elasticsearch implements Database {
let aliases: {
[index: string]: {
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 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)}`;
}

View File

@@ -13,10 +13,10 @@
* 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/>.
*/
import {SCBackendAggregationConfiguration, SCFacet, SCThingTypes} from '@openstapps/core';
import {SCBackendAggregationConfiguration, SCFacet, SCThingType} from '@openstapps/core';
import {AggregationSchema} from './common';
export type aggregationType = SCThingTypes | '@all';
export type aggregationType = SCThingType | '@all';
/**
* Builds the aggregation

View File

@@ -13,7 +13,7 @@
* 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/>.
*/
import {SCThingTypes} from '@openstapps/core';
import {SCThingType} from '@openstapps/core';
import {SCThing} from '@openstapps/core';
/**
@@ -111,7 +111,7 @@ export interface ESTermsFilter {
*/
export interface ESTypeFilter {
type: {
value: SCThingTypes;
value: SCThingType;
};
}

View File

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