Compare commits

..

4 Commits

Author SHA1 Message Date
Rainer Killinger
5a48342a8d docs: update changelogs for release
ci: publish release
2025-07-30 14:15:24 +02:00
Rainer Killinger
6b06de4019 refactor: update audit relevant nodemailer dependency 2025-07-30 13:58:25 +02:00
Rainer Killinger
c5c9bcf433 docs: update changelogs for release
ci: publish release
2025-07-30 12:44:30 +02:00
Rainer Killinger
b40ba7ad63 refactor: update elasticsearch and audit relevant dependencies 2025-07-30 12:40:59 +02:00
58 changed files with 604 additions and 584 deletions

View File

@@ -1,5 +1,22 @@
# @openstapps/backend # @openstapps/backend
## 4.0.2
### Patch Changes
- 6b06de40: Updated nodemailer dependency
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
- @openstapps/core@4.0.2
- @openstapps/core-tools@4.0.2
## 4.0.1
### Patch Changes
- b40ba7ad: Updated Elasticsearch dependency
- @openstapps/core@4.0.0
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -8,7 +8,8 @@ const config = {
database: { database: {
name: 'elasticsearch', name: 'elasticsearch',
query: { query: {
fields: ["name"] minMatch: '60%',
queryType: 'query_string',
}, },
}, },
}, },

View File

@@ -39,7 +39,7 @@ const boostings = {
type: SCThingType.AcademicEvent, type: SCThingType.AcademicEvent,
}, },
{ {
factor: 2, factor: 1.6,
type: SCThingType.Building, type: SCThingType.Building,
}, },
{ {
@@ -85,7 +85,7 @@ const boostings = {
], ],
place: [ place: [
{ {
factor: 3, factor: 2,
type: SCThingType.Building, type: SCThingType.Building,
}, },
{ {

View File

@@ -17,21 +17,12 @@ const config = {
name: 'elasticsearch', name: 'elasticsearch',
version: '8.4.2', version: '8.4.2',
query: { query: {
type: 'best_fields', minMatch: '75%',
fields: [ queryType: 'dis_max',
'identifiers^20', matchBoosting: 1.3,
'name^10', fuzziness: 'AUTO',
'translations.*.name^10', cutoffFrequency: 0,
'alternateNames^10', tieBreaker: 0,
'translations.*.alternateNames^10',
'description^2',
'translations.*.description^2',
'categories^5',
],
},
searchAsYouTypeQuery: {
type: 'phrase_prefix',
fields: ['name.completion', 'name.completion._2gram', 'name.completion._3gram'],
}, },
}, },
}, },

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/backend", "name": "@openstapps/backend",
"description": "A reference implementation for a StApps backend", "description": "A reference implementation for a StApps backend",
"version": "4.0.0", "version": "4.0.2",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
@@ -43,11 +43,11 @@
"test:unit": "cross-env NODE_CONFIG_ENV=elasticsearch ALLOW_NO_TRANSPORT=true STAPPS_LOG_LEVEL=0 mocha --exit" "test:unit": "cross-env NODE_CONFIG_ENV=elasticsearch ALLOW_NO_TRANSPORT=true STAPPS_LOG_LEVEL=0 mocha --exit"
}, },
"dependencies": { "dependencies": {
"@elastic/elasticsearch": "8.4.0", "@elastic/elasticsearch": "8.14.1",
"@openstapps/core": "workspace:*", "@openstapps/core": "workspace:*",
"@openstapps/core-tools": "workspace:*", "@openstapps/core-tools": "workspace:*",
"@openstapps/logger": "workspace:*", "@openstapps/logger": "workspace:*",
"@types/body-parser": "1.19.2", "@types/body-parser": "1.19.6",
"@types/cors": "2.8.13", "@types/cors": "2.8.13",
"@types/express": "4.17.17", "@types/express": "4.17.17",
"@types/geojson": "1.0.6", "@types/geojson": "1.0.6",
@@ -56,20 +56,20 @@
"@types/nodemailer": "6.4.7", "@types/nodemailer": "6.4.7",
"@types/promise-queue": "2.2.0", "@types/promise-queue": "2.2.0",
"@types/uuid": "8.3.4", "@types/uuid": "8.3.4",
"body-parser": "1.20.2", "body-parser": "1.20.3",
"cors": "2.8.5", "cors": "2.8.5",
"cosmiconfig": "8.1.3", "cosmiconfig": "8.1.3",
"deepmerge": "4.3.1", "deepmerge": "4.3.1",
"express": "4.18.2", "express": "4.21.2",
"express-prom-bundle": "6.6.0", "express-prom-bundle": "6.6.0",
"express-promise-router": "4.1.1", "express-promise-router": "4.1.1",
"got": "12.6.0", "got": "12.6.0",
"moment": "2.30.1", "moment": "2.30.1",
"morgan": "1.10.0", "morgan": "1.10.1",
"nock": "13.3.1", "nock": "13.3.1",
"node-cache": "5.1.2", "node-cache": "5.1.2",
"node-cron": "3.0.2", "node-cron": "3.0.2",
"nodemailer": "6.9.1", "nodemailer": "6.9.9",
"prom-client": "14.1.1", "prom-client": "14.1.1",
"promise-queue": "2.2.5", "promise-queue": "2.2.5",
"uuid": "8.3.2" "uuid": "8.3.2"
@@ -83,7 +83,7 @@
"@types/chai": "4.3.20", "@types/chai": "4.3.20",
"@types/chai-as-promised": "7.1.8", "@types/chai-as-promised": "7.1.8",
"@types/mocha": "10.0.10", "@types/mocha": "10.0.10",
"@types/morgan": "1.9.4", "@types/morgan": "1.9.10",
"@types/sinon": "10.0.14", "@types/sinon": "10.0.14",
"@types/sinon-express-mock": "1.3.9", "@types/sinon-express-mock": "1.3.9",
"@types/supertest": "2.0.12", "@types/supertest": "2.0.12",

View File

@@ -20,8 +20,6 @@ import {
IndicesGetAliasResponse, IndicesGetAliasResponse,
SearchHit, SearchHit,
SearchResponse, SearchResponse,
SearchTermSuggest,
SearchTermSuggestOption,
} from '@elastic/elasticsearch/lib/api/types.js'; } from '@elastic/elasticsearch/lib/api/types.js';
import {SCConfigFile, SCSearchQuery, SCSearchResponse, SCThings, SCUuid} from '@openstapps/core'; import {SCConfigFile, SCSearchQuery, SCSearchResponse, SCThings, SCUuid} from '@openstapps/core';
import {Logger} from '@openstapps/logger'; import {Logger} from '@openstapps/logger';
@@ -49,9 +47,6 @@ import {
import {noUndefined} from './util/no-undefined.js'; import {noUndefined} from './util/no-undefined.js';
import {retryCatch, RetryOptions} from './util/retry.js'; import {retryCatch, RetryOptions} from './util/retry.js';
import {Feature, Point, Polygon} from 'geojson'; import {Feature, Point, Polygon} from 'geojson';
import {parseSuggestions} from './util/parse-suggestions.js';
import {buildScoringFunctions} from './query/boost/scoring-functions.js';
import {buildFilter} from './query/filter.js';
/** /**
* A database interface for elasticsearch * A database interface for elasticsearch
@@ -360,39 +355,6 @@ export class Elasticsearch implements Database {
throw new Error('You tried to PUT an non-existing object. PUT is only supported on existing objects.'); throw new Error('You tried to PUT an non-existing object. PUT is only supported on existing objects.');
} }
public async searchAsYouType(parameters: SCSearchQuery): Promise<SCSearchResponse> {
const result = await this.client.search({
_source: 'name',
query: {
function_score: {
functions: buildScoringFunctions(this.config.internal.boostings, parameters.context),
query: {
bool: {
must: {
multi_match: {
query: parameters.query,
type: 'bool_prefix',
fields: ['name.completion', 'name.completion._2gram', 'name.completion._3gram'],
},
},
should: [],
filter: parameters.filter === undefined ? undefined : buildFilter(parameters.filter),
},
},
score_mode: 'max',
boost_mode: 'multiply',
},
},
index: ACTIVE_INDICES_ALIAS,
allow_no_indices: true,
size: 5,
});
const suggestions = result.hits.hits.map(it => (it._source as any).name);
console.log(suggestions);
console.log(result.took);
}
/** /**
* Search all indexed data * Search all indexed data
* @param parameters search query * @param parameters search query
@@ -402,23 +364,18 @@ export class Elasticsearch implements Database {
throw new TypeError('Database is undefined. You have to configure the query build'); throw new TypeError('Database is undefined. You have to configure the query build');
} }
const esConfig = this.config.internal.database as object as ElasticsearchConfig; const esConfig: ElasticsearchConfig = {
name: this.config.internal.database.name as 'elasticsearch',
version: this.config.internal.database.version as string,
query: this.config.internal.database.query as
| ElasticsearchQueryDisMaxConfig
| ElasticsearchQueryQueryStringConfig
| undefined,
};
const response: SearchResponse<SCThings> = await this.client.search({ const response: SearchResponse<SCThings> = await this.client.search({
aggs: aggregations, aggs: aggregations,
query: buildQuery(parameters, this.config, esConfig), query: buildQuery(parameters, this.config, esConfig),
suggest:
parameters.query === undefined
? undefined
: {
text: parameters.query,
terms: {
term: {
field: 'name',
suggest_mode: 'missing',
},
},
},
from: parameters.from, from: parameters.from,
index: ACTIVE_INDICES_ALIAS, index: ACTIVE_INDICES_ALIAS,
allow_no_indices: true, allow_no_indices: true,
@@ -438,7 +395,6 @@ export class Elasticsearch implements Database {
response.aggregations === undefined response.aggregations === undefined
? [] ? []
: parseAggregations(response.aggregations as Record<AggregateName, AggregationsMultiTermsBucket>), : parseAggregations(response.aggregations as Record<AggregateName, AggregationsMultiTermsBucket>),
suggestions: response.suggest === undefined ? undefined : parseSuggestions(response.suggest),
pagination: { pagination: {
count: response.hits.hits.length, count: response.hits.hits.length,
offset: typeof parameters.from === 'number' ? parameters.from : 0, offset: typeof parameters.from === 'number' ? parameters.from : 0,

View File

@@ -30,21 +30,84 @@ export const buildQuery = function buildQuery(
defaultConfig: SCConfigFile, defaultConfig: SCConfigFile,
elasticsearchConfig: ElasticsearchConfig, elasticsearchConfig: ElasticsearchConfig,
): QueryDslQueryContainer { ): QueryDslQueryContainer {
return { // if config provides a minMatch parameter, we use query_string instead of a match query
let query;
if (elasticsearchConfig.query === undefined) {
query = {
query_string: {
analyzer: 'search_german',
default_field: 'name',
minimum_should_match: '90%',
query: typeof parameters.query === 'string' ? parameters.query : '*',
},
};
} else if (elasticsearchConfig.query.queryType === 'query_string') {
query = {
query_string: {
analyzer: 'search_german',
default_field: 'name',
minimum_should_match: elasticsearchConfig.query.minMatch,
query: typeof parameters.query === 'string' ? parameters.query : '*',
},
};
} else if (elasticsearchConfig.query.queryType === 'dis_max') {
if (typeof parameters.query === 'string' && parameters.query !== '*') {
query = {
dis_max: {
boost: 1.2,
queries: [
{
match: {
name: {
boost: elasticsearchConfig.query.matchBoosting,
fuzziness: elasticsearchConfig.query.fuzziness,
query: parameters.query,
},
},
},
{
query_string: {
default_field: 'name',
minimum_should_match: elasticsearchConfig.query.minMatch,
query: parameters.query,
},
},
],
tie_breaker: elasticsearchConfig.query.tieBreaker,
},
};
}
} else {
throw new Error(
'Unsupported query type. Check your config file and reconfigure your elasticsearch query',
);
}
const functionScoreQuery: QueryDslQueryContainer = {
function_score: { function_score: {
functions: buildScoringFunctions(defaultConfig.internal.boostings, parameters.context), functions: buildScoringFunctions(defaultConfig.internal.boostings, parameters.context),
query: { query: {
bool: { bool: {
must: minimum_should_match: 0, // if we have no should, nothing can match
parameters.query === undefined || parameters.query === '' || parameters.query === '*' must: [],
? {match_all: {}}
: {multi_match: {...elasticsearchConfig.query, query: parameters.query}},
should: [], should: [],
filter: parameters.filter === undefined ? undefined : buildFilter(parameters.filter),
}, },
}, },
score_mode: 'max', score_mode: 'multiply',
boost_mode: 'multiply',
}, },
}; };
const mustMatch = functionScoreQuery.function_score?.query?.bool?.must;
if (Array.isArray(mustMatch)) {
if (query !== undefined) {
mustMatch.push(query);
}
if (parameters.filter !== undefined) {
mustMatch.push(buildFilter(parameters.filter));
}
}
return functionScoreQuery;
}; };

View File

@@ -13,7 +13,68 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {QueryDslMultiMatchQuery} from '@elastic/elasticsearch/lib/api/types.js'; /**
* A configuration for using the Dis Max Query
*
* See https://www.elastic.co/guide/en/elasticsearch/reference/5.5/query-dsl-dis-max-query.html for further
* explanation of what the parameters mean
*/
export interface ElasticsearchQueryDisMaxConfig {
/**
* Relative (to a total number of documents) or absolute number to exclude meaningless matches that frequently appear
*/
cutoffFrequency: number;
/**
* The maximum allowed Levenshtein Edit Distance (or number of edits)
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/common-options.html#fuzziness
*/
fuzziness: number | string;
/**
* Increase the importance (relevance score) of a field
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/mapping-boost.html
*/
matchBoosting: number;
/**
* Minimal number (or percentage) of words that should match in a query
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-minimum-should-match.html
*/
minMatch: string;
/**
* Type of the query - in this case 'dis_max' which is a union of its subqueries
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-dis-max-query.html
*/
queryType: 'dis_max';
/**
* Changes behavior of default calculation of the score when multiple results match
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-multi-match-query.html#tie-breaker
*/
tieBreaker: number;
}
/**
* A configuration for using Query String Query
*
* See https://www.elastic.co/guide/en/elasticsearch/reference/5.5/query-dsl-query-string-query.html for further
* explanation of what the parameters mean
*/
export interface ElasticsearchQueryQueryStringConfig {
/**
* Minimal number (or percentage) of words that should match in a query
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-minimum-should-match.html
*/
minMatch: string;
/**
* Type of the query - in this case 'query_string' which uses a query parser in order to parse content
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-query-string-query.html
*/
queryType: 'query_string';
}
/** /**
* An config file for the elasticsearch database interface * An config file for the elasticsearch database interface
@@ -44,12 +105,7 @@ export interface ElasticsearchConfig {
/** /**
* Configuration for using queries * Configuration for using queries
*/ */
query: Omit<QueryDslMultiMatchQuery, 'query'>; query?: ElasticsearchQueryDisMaxConfig | ElasticsearchQueryQueryStringConfig;
/**
*
*/
searchAsYouTypeQuery: Omit<QueryDslMultiMatchQuery, 'query'>;
/** /**
* Version of the used elasticsearch * Version of the used elasticsearch

View File

@@ -1,28 +0,0 @@
import {
SearchSuggest,
SearchTermSuggest,
SearchTermSuggestOption,
SuggestionName,
} from '@elastic/elasticsearch/lib/api/types.js';
import {SCSearchSuggestions} from '@openstapps/core';
/**
* Parse ES Suggestions to SC Search Suggestions
*/
export function parseSuggestions(suggest: Record<SuggestionName, SearchSuggest[]>): SCSearchSuggestions {
const termsSuggestions =
suggest.terms === undefined
? []
: (suggest.terms as SearchTermSuggest[])
?.map(
({text, options}) =>
[
text,
(options as SearchTermSuggestOption[] | undefined)?.map(({text}) => text) ?? [],
] as const,
)
.filter(([, suggestions]) => suggestions.length > 0) ?? [];
return {
terms: termsSuggestions.length === 0 ? undefined : Object.fromEntries(termsSuggestions),
};
}

View File

@@ -1,5 +1,11 @@
# @openstapps/database # @openstapps/database
## 4.0.1
### Patch Changes
- b40ba7ad: Updated Elasticsearch dependency
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,4 +1,4 @@
FROM elasticsearch:8.4.2 FROM elasticsearch:8.14.3
EXPOSE 9200 EXPOSE 9200
EXPOSE 9300 EXPOSE 9300

View File

@@ -1,6 +1,6 @@
{ {
"name": "@openstapps/database", "name": "@openstapps/database",
"version": "4.0.0", "version": "4.0.1",
"private": true, "private": true,
"files": [ "files": [
"config", "config",

View File

@@ -1,5 +1,12 @@
# @openstapps/proxy # @openstapps/proxy
## 4.0.2
### Patch Changes
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/proxy", "name": "@openstapps/proxy",
"description": "NGINX proxy that is dynamically configured by a Node.js script", "description": "NGINX proxy that is dynamically configured by a Node.js script",
"version": "4.0.0", "version": "4.0.2",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",

View File

@@ -1,5 +1,19 @@
# @openstapps/projectmanagement # @openstapps/projectmanagement
## 4.0.2
### Patch Changes
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
- @openstapps/gitlab-api@4.0.2
## 4.0.1
### Patch Changes
- b40ba7ad: Updated Elasticsearch dependency
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/projectmanagement", "name": "@openstapps/projectmanagement",
"description": "Main documentation and scripts for maintenance.", "description": "Main documentation and scripts for maintenance.",
"version": "4.0.0", "version": "4.0.2",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
@@ -41,7 +41,6 @@
"@openstapps/collection-utils": "workspace:*", "@openstapps/collection-utils": "workspace:*",
"@openstapps/gitlab-api": "workspace:*", "@openstapps/gitlab-api": "workspace:*",
"@openstapps/logger": "workspace:*", "@openstapps/logger": "workspace:*",
"@slack/web-api": "6.8.1",
"commander": "10.0.0", "commander": "10.0.0",
"date-fns": "3.6.0", "date-fns": "3.6.0",
"glob": "10.3.10", "glob": "10.3.10",

View File

@@ -22,7 +22,6 @@ import {
User, User,
} from '@openstapps/gitlab-api'; } from '@openstapps/gitlab-api';
import {Logger} from '@openstapps/logger'; import {Logger} from '@openstapps/logger';
import {WebClient} from '@slack/web-api';
import {CONCURRENCY, GROUPS, MAX_DEPTH_FOR_REMINDER, NOTE_PREFIX, SLACK_CHANNEL} from '../configuration.js'; import {CONCURRENCY, GROUPS, MAX_DEPTH_FOR_REMINDER, NOTE_PREFIX, SLACK_CHANNEL} from '../configuration.js';
import {mapAsyncLimit} from '@openstapps/collection-utils'; import {mapAsyncLimit} from '@openstapps/collection-utils';
@@ -53,8 +52,7 @@ export async function remind(api: Api): Promise<void> {
Logger.info(`Found ${mergeRequests.length} open merge requests.`); Logger.info(`Found ${mergeRequests.length} open merge requests.`);
// instantiate slack client // instantiate slack client
const client = const client = undefined;
process.env.SLACK_API_TOKEN === undefined ? undefined : new WebClient(process.env.SLACK_API_TOKEN);
// get members of the main group // get members of the main group
const members = await api.getMembers(MembershipScope.GROUPS, GROUPS[0]); const members = await api.getMembers(MembershipScope.GROUPS, GROUPS[0]);

View File

@@ -1,5 +1,22 @@
# @openstapps/minimal-connector # @openstapps/minimal-connector
## 4.0.2
### Patch Changes
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
- @openstapps/core@4.0.2
- @openstapps/api@4.0.2
## 4.0.1
### Patch Changes
- Updated dependencies [b40ba7ad]
- @openstapps/api@4.0.1
- @openstapps/core@4.0.0
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/minimal-connector", "name": "@openstapps/minimal-connector",
"description": "This is a minimal connector which serves as an example", "description": "This is a minimal connector which serves as an example",
"version": "4.0.0", "version": "4.0.2",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",

View File

@@ -1,5 +1,11 @@
# @openstapps/minimal-deployment # @openstapps/minimal-deployment
## 4.0.1
### Patch Changes
- b40ba7ad: Updated Elasticsearch dependency
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,23 +1,21 @@
version: '3.7'
x-development-variables: &development-variables x-development-variables: &development-variables
NODE_ENV: "development" NODE_ENV: "development"
ALLOW_NO_TRANSPORT: "true" ALLOW_NO_TRANSPORT: "true"
services: services:
database: database:
image: registry.gitlab.com/openstapps/openstapps/database:3.0.0 image: registry.gitlab.com/openstapps/openstapps/database:4.0.1
# If you need persistence for debugging purposes uncomment the following lines # If you need persistence for debugging purposes uncomment the following lines
#volumes: # volumes:
# - ./database:/usr/share/elasticsearch/data # - ./database:/usr/share/elasticsearch/data
expose: expose:
- 9200 - 9200
ports: ports:
- 127.0.0.1:9200:9200 - 127.0.0.1:9200:9200
environment: environment:
- bootstrap.memory_lock=true # - bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms2g -Xmx2g" # - discovery.type=single-node
- discovery.type=single-node - "ES_JAVA_OPTS=-Xms4g -Xmx4g"
ulimits: ulimits:
memlock: memlock:
soft: -1 soft: -1
@@ -25,7 +23,7 @@ services:
restart: unless-stopped restart: unless-stopped
backend: backend:
image: registry.gitlab.com/openstapps/openstapps/backend:3.1.0 image: registry.gitlab.com/openstapps/openstapps/backend:4.0.1
environment: environment:
<<: *development-variables <<: *development-variables
ES_ADDR: "http://database:9200" ES_ADDR: "http://database:9200"
@@ -37,10 +35,11 @@ services:
ports: ports:
- 127.0.0.1:3000:3000 - 127.0.0.1:3000:3000
labels: labels:
- stapps.version=4.1.0 - stapps.version=4.0.0
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
- database database:
condition: service_healthy
links: links:
- database - database

View File

@@ -1,6 +1,6 @@
{ {
"name": "@openstapps/minimal-deployment", "name": "@openstapps/minimal-deployment",
"version": "4.0.0", "version": "4.0.1",
"private": true, "private": true,
"files": [ "files": [
"database", "database",

View File

@@ -1,5 +1,26 @@
# @openstapps/minimal-plugin # @openstapps/minimal-plugin
## 4.0.2
### Patch Changes
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
- @openstapps/api-plugin@4.0.2
- @openstapps/core@4.0.2
- @openstapps/core-tools@4.0.2
- @openstapps/api@4.0.2
## 4.0.1
### Patch Changes
- b40ba7ad: Updated Elasticsearch dependency
- Updated dependencies [b40ba7ad]
- @openstapps/api-plugin@4.0.1
- @openstapps/api@4.0.1
- @openstapps/core@4.0.0
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/minimal-plugin", "name": "@openstapps/minimal-plugin",
"description": "Minimal Plugin", "description": "Minimal Plugin",
"version": "4.0.0", "version": "4.0.2",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
@@ -34,7 +34,7 @@
"@openstapps/core-tools": "workspace:*", "@openstapps/core-tools": "workspace:*",
"@openstapps/logger": "workspace:*", "@openstapps/logger": "workspace:*",
"commander": "10.0.0", "commander": "10.0.0",
"express": "4.18.2", "express": "4.21.2",
"ts-node": "10.9.2" "ts-node": "10.9.2"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -1,5 +1,21 @@
# @openstapps/app # @openstapps/app
## 4.0.2
### Patch Changes
- @openstapps/core@4.0.2
- @openstapps/api@4.0.2
## 4.0.1
### Patch Changes
- b40ba7ad: Updated Elasticsearch dependency
- Updated dependencies [b40ba7ad]
- @openstapps/api@4.0.1
- @openstapps/core@4.0.0
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/app", "name": "@openstapps/app",
"description": "The generic app tailored to fulfill needs of German universities, written using Ionic Framework.", "description": "The generic app tailored to fulfill needs of German universities, written using Ionic Framework.",
"version": "4.0.0", "version": "4.0.2",
"private": true, "private": true,
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>", "author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
@@ -91,7 +91,7 @@
"cordova-plugin-calendar": "5.1.6", "cordova-plugin-calendar": "5.1.6",
"date-fns": "3.6.0", "date-fns": "3.6.0",
"deepmerge": "4.3.1", "deepmerge": "4.3.1",
"form-data": "4.0.0", "form-data": "4.0.4",
"geojson": "0.5.0", "geojson": "0.5.0",
"ionic-appauth": "0.9.0", "ionic-appauth": "0.9.0",
"ionicons": "7.4.0", "ionicons": "7.4.0",

View File

@@ -29,7 +29,6 @@ import {
SCSearchQuery, SCSearchQuery,
SCSearchSort, SCSearchSort,
SCThings, SCThings,
SCSearchSuggestions,
} from '@openstapps/core'; } from '@openstapps/core';
import {NGXLogger} from 'ngx-logger'; import {NGXLogger} from 'ngx-logger';
import {combineLatest, Subject} from 'rxjs'; import {combineLatest, Subject} from 'rxjs';
@@ -118,8 +117,6 @@ export class SearchPageComponent implements OnInit {
*/ */
items: Promise<SCThings[]>; items: Promise<SCThings[]>;
suggestions: SCSearchSuggestions | undefined;
/** /**
* Page size of queries * Page size of queries
*/ */
@@ -230,7 +227,6 @@ export class SearchPageComponent implements OnInit {
try { try {
const result = await this.dataProvider.search(searchOptions); const result = await this.dataProvider.search(searchOptions);
this.suggestions = result.suggestions;
this.singleTypeResponse = result.facets.find(facet => facet.field === 'type')?.buckets.length === 1; this.singleTypeResponse = result.facets.find(facet => facet.field === 'type')?.buckets.length === 1;
if (append) { if (append) {
// append results // append results
@@ -295,12 +291,6 @@ export class SearchPageComponent implements OnInit {
this.contextMenuService.updateContextFilter(facets); this.contextMenuService.updateContextFilter(facets);
} }
applySuggestion(target: string, suggestion: string) {
this.queryText = this.queryText.replaceAll(target, suggestion);
this.suggestions = undefined;
this.searchStringChanged(this.queryText);
}
ngOnInit(defaultListeners = true) { ngOnInit(defaultListeners = true) {
this.initialize(); this.initialize();
this.contextMenuService.setContextSort({ this.contextMenuService.setContextSort({

View File

@@ -65,23 +65,7 @@
</ion-header> </ion-header>
<ion-content class="content"> <ion-content class="content">
<div class="suggestions">
@if (suggestions?.terms; as terms) {
<span>{{ 'search.SUGGESTIONS' | translate }}: </span>
@for (suggestion of terms | keyvalue; track suggestion) {
@for (term of suggestion.value; track term) {
@if ($index == 0) {
<b (click)="applySuggestion(suggestion.key, term)" class="suggestion">{{ term }}</b>
} @else {
<span (click)="applySuggestion(suggestion.key, term)" class="suggestion">{{ term }}</span>
}
}
}
}
</div>
<div <div
class="hint"
[class.no-results]="!showDefaultData && !items && !loading" [class.no-results]="!showDefaultData && !items && !loading"
[style.display]="!showDefaultData && !items && !loading ? 'block' : 'none'" [style.display]="!showDefaultData && !items && !loading ? 'block' : 'none'"
> >

View File

@@ -46,7 +46,7 @@ ion-content {
--background: var(--ion-background-color); --background: var(--ion-background-color);
} }
.content > .hint { .content > div {
height: 100%; height: 100%;
ion-label.centered-message-container { ion-label.centered-message-container {
@@ -60,19 +60,3 @@ ion-content {
ion-header { ion-header {
background: var(--ion-color-primary); background: var(--ion-color-primary);
} }
.suggestions {
padding: var(--spacing-md);
padding-block-end: 0;
}
.suggestion {
cursor: pointer;
}
.suggestion + .suggestion::before {
cursor: text;
content: ',';
padding-inline-end: 0.25ch;
font-weight: normal;
}

File diff suppressed because one or more lines are too long

View File

@@ -425,8 +425,7 @@
"placeholder": "Veranstaltungen, Personen, Orte und mehr" "placeholder": "Veranstaltungen, Personen, Orte und mehr"
}, },
"instruction": "Finde alle Informationen rund ums Studium und den Campus", "instruction": "Finde alle Informationen rund ums Studium und den Campus",
"nothing_found": "Keine Ergebnisse", "nothing_found": "Keine Ergebnisse"
"SUGGESTIONS": "Meintest du"
}, },
"hebisSearch": { "hebisSearch": {
"title": "Bibliothekssuche", "title": "Bibliothekssuche",

View File

@@ -425,8 +425,7 @@
"placeholder": "Events, places, persons and more" "placeholder": "Events, places, persons and more"
}, },
"instruction": "Find all information related to your studies and campus", "instruction": "Find all information related to your studies and campus",
"nothing_found": "No results", "nothing_found": "No results"
"SUGGESTIONS": "Did you mean"
}, },
"hebisSearch": { "hebisSearch": {
"title": "Library Search", "title": "Library Search",

View File

@@ -18,7 +18,7 @@
// The list of which env maps to which file can be found in `.angular-cli.json`. // The list of which env maps to which file can be found in `.angular-cli.json`.
export const environment = { export const environment = {
backend_url: 'http://localhost:3000', backend_url: 'https://mobile.server.uni-frankfurt.de',
app_host: 'mobile.app.uni-frankfurt.de', app_host: 'mobile.app.uni-frankfurt.de',
custom_url_scheme: 'de.anyschool.app', custom_url_scheme: 'de.anyschool.app',
backend_version: '999.0.0', backend_version: '999.0.0',

View File

@@ -1,5 +1,23 @@
# @openstapps/api-cli # @openstapps/api-cli
## 4.0.2
### Patch Changes
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
- @openstapps/core@4.0.2
- @openstapps/core-tools@4.0.2
- @openstapps/api@4.0.2
## 4.0.1
### Patch Changes
- Updated dependencies [b40ba7ad]
- @openstapps/api@4.0.1
- @openstapps/core@4.0.0
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -23,7 +23,7 @@ node ./lib/cli.js e2e http://localhost:3000
Example to clone the full database Example to clone the full database
```shell ```shell
node app.js copy "*" -a "999.0.0" https://mobile.server.uni-frankfurt.de http://localhost:3000 100 node app.js copy "*" https://mobile.app.uni-frankfurt.de http://localhost:3000 100
``` ```
### Program arguments ### Program arguments

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/api-cli", "name": "@openstapps/api-cli",
"description": "CLI client for @openstapps/api", "description": "CLI client for @openstapps/api",
"version": "4.0.0", "version": "4.0.2",
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/api.git", "repository": "git@gitlab.com:openstapps/api.git",

View File

@@ -1,5 +1,24 @@
# @openstapps/api-plugin # @openstapps/api-plugin
## 4.0.2
### Patch Changes
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
- @openstapps/core@4.0.2
- @openstapps/core-tools@4.0.2
- @openstapps/api@4.0.2
## 4.0.1
### Patch Changes
- b40ba7ad: Updated Elasticsearch dependency
- Updated dependencies [b40ba7ad]
- @openstapps/api@4.0.1
- @openstapps/core@4.0.0
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/api-plugin", "name": "@openstapps/api-plugin",
"description": "Node.js library to interact with the StApps backend service", "description": "Node.js library to interact with the StApps backend service",
"version": "4.0.0", "version": "4.0.2",
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/api.git", "repository": "git@gitlab.com:openstapps/api.git",
@@ -36,14 +36,14 @@
"@openstapps/core": "workspace:*", "@openstapps/core": "workspace:*",
"@openstapps/core-tools": "workspace:*", "@openstapps/core-tools": "workspace:*",
"@openstapps/logger": "workspace:*", "@openstapps/logger": "workspace:*",
"@types/body-parser": "1.19.2", "@types/body-parser": "1.19.6",
"@types/express": "4.17.17", "@types/express": "4.17.17",
"@types/json-schema": "7.0.15", "@types/json-schema": "7.0.15",
"@types/morgan": "1.9.4", "@types/morgan": "1.9.10",
"body-parser": "1.20.2", "body-parser": "1.20.3",
"express": "4.18.2", "express": "4.21.2",
"json-schema": "0.4.0", "json-schema": "0.4.0",
"morgan": "1.10.0" "morgan": "1.10.1"
}, },
"devDependencies": { "devDependencies": {
"@openstapps/eslint-config": "workspace:*", "@openstapps/eslint-config": "workspace:*",

View File

@@ -1,5 +1,18 @@
# @openstapps/api # @openstapps/api
## 4.0.2
### Patch Changes
- @openstapps/core@4.0.2
## 4.0.1
### Patch Changes
- b40ba7ad: Updated Elasticsearch dependency
- @openstapps/core@4.0.0
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/api", "name": "@openstapps/api",
"description": "Node.js library to interact with the StApps backend service", "description": "Node.js library to interact with the StApps backend service",
"version": "4.0.0", "version": "4.0.2",
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/api.git", "repository": "git@gitlab.com:openstapps/api.git",
@@ -58,7 +58,7 @@
"tsup": "8.5.0", "tsup": "8.5.0",
"typedoc": "0.25.12", "typedoc": "0.25.12",
"typescript": "5.4.2", "typescript": "5.4.2",
"undici": "5.22.1" "undici": "6.21.3"
}, },
"peerDependencies": { "peerDependencies": {
"@openstapps/core": "workspace:*" "@openstapps/core": "workspace:*"

View File

@@ -1,5 +1,13 @@
# @openstapps/core-tools # @openstapps/core-tools
## 4.0.2
### Patch Changes
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
- @openstapps/easy-ast@4.0.2
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/core-tools", "name": "@openstapps/core-tools",
"description": "Tools to convert and validate StAppsCore", "description": "Tools to convert and validate StAppsCore",
"version": "4.0.0", "version": "4.0.2",
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/core-tools.git", "repository": "git@gitlab.com:openstapps/core-tools.git",

View File

@@ -1,5 +1,11 @@
# @openstapps/core # @openstapps/core
## 4.0.2
### Patch Changes
- @openstapps/core-tools@4.0.2
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/core", "name": "@openstapps/core",
"description": "StAppsCore - Generalized model of data", "description": "StAppsCore - Generalized model of data",
"version": "4.0.0", "version": "4.0.2",
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/core.git", "repository": "git@gitlab.com:openstapps/core.git",
@@ -97,8 +97,6 @@
"date", "date",
"validatable", "validatable",
"filterable", "filterable",
"suggestable",
"completable",
"inheritTags", "inheritTags",
"minLength", "minLength",
"pattern", "pattern",

View File

@@ -24,11 +24,6 @@ export interface SCSearchResult {
*/ */
data: SCThings[]; data: SCThings[];
/**
* Suggestions for query corrections
*/
suggestions?: SCSearchSuggestions;
/** /**
* Facets (aggregations over all matching data) * Facets (aggregations over all matching data)
*/ */
@@ -45,18 +40,6 @@ export interface SCSearchResult {
stats: SCSearchResultSearchEngineStats; stats: SCSearchResultSearchEngineStats;
} }
/**
* Seach suggestions
*
* Not to be confused with search-as-you-type suggestions
*/
export interface SCSearchSuggestions {
/**
* Suggestions for query terms that might have been misspelled
*/
terms?: Record<string, string[]>;
}
/** /**
* Stores information about Pagination * Stores information about Pagination
*/ */

View File

@@ -63,7 +63,7 @@ export interface SCThingWithoutReferences {
/** /**
* Alternate names of the thing * Alternate names of the thing
* @filterable * @filterable
* @text * @keyword
*/ */
alternateNames?: string[]; alternateNames?: string[];
@@ -92,8 +92,6 @@ export interface SCThingWithoutReferences {
* @filterable * @filterable
* @minLength 1 * @minLength 1
* @sortable ducet * @sortable ducet
* @completable
* @suggestable
* @text * @text
*/ */
name: string; name: string;
@@ -242,8 +240,6 @@ export interface SCThingTranslatableProperties {
* Translation of the name of the thing * Translation of the name of the thing
* @sortable ducet * @sortable ducet
* @text * @text
* @suggestable
* @completable
*/ */
name?: string; name?: string;
/** /**

View File

@@ -1,5 +1,12 @@
# @openstapps/easy-ast # @openstapps/easy-ast
## 4.0.2
### Patch Changes
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/easy-ast", "name": "@openstapps/easy-ast",
"description": "Tool to easily handle TypeScript AST", "description": "Tool to easily handle TypeScript AST",
"version": "4.0.0", "version": "4.0.2",
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/core-tools.git", "repository": "git@gitlab.com:openstapps/core-tools.git",

View File

@@ -1,5 +1,11 @@
# @openstapps/es-mapping-generator # @openstapps/es-mapping-generator
## 4.0.1
### Patch Changes
- b40ba7ad: Updated Elasticsearch dependency
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/es-mapping-generator", "name": "@openstapps/es-mapping-generator",
"description": "Tool to convert TypeScript Interfaces to Elasticsearch Mappings", "description": "Tool to convert TypeScript Interfaces to Elasticsearch Mappings",
"version": "4.0.0", "version": "4.0.1",
"type": "commonjs", "type": "commonjs",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"author": "Thea Schöbl <dev@theaninova.de>", "author": "Thea Schöbl <dev@theaninova.de>",
@@ -26,7 +26,7 @@
"test": "c8 mocha" "test": "c8 mocha"
}, },
"dependencies": { "dependencies": {
"@elastic/elasticsearch": "8.4.0", "@elastic/elasticsearch": "8.14.1",
"commander": "10.0.0", "commander": "10.0.0",
"deepmerge": "4.3.1", "deepmerge": "4.3.1",
"flatted": "3.2.7", "flatted": "3.2.7",

View File

@@ -43,27 +43,6 @@ export const fieldmap: ElasticsearchFieldmap = {
}, },
ignore: ['price'], ignore: ['price'],
}, },
suggestable: {
default: {
trigram: {
type: 'text',
analyzer: 'trigram',
},
reverse: {
type: 'text',
analyzer: 'reverse',
},
},
ignore: [],
},
completable: {
default: {
completion: {
type: 'search_as_you_type',
},
},
ignore: [],
},
}; };
export const filterableTagName = 'filterable'; export const filterableTagName = 'filterable';

View File

@@ -19,27 +19,4 @@ export const settings: IndicesPutTemplateRequest['settings'] = {
'max_result_window': 30_000, 'max_result_window': 30_000,
'number_of_replicas': 0, 'number_of_replicas': 0,
'number_of_shards': 1, 'number_of_shards': 1,
'index': {
analysis: {
analyzer: {
trigram: {
type: 'custom',
tokenizer: 'standard',
filter: ['lowercase', 'shingle'],
},
reverse: {
type: 'custom',
tokenizer: 'standard',
filter: ['lowercase', 'reverse'],
},
},
filter: {
shingle: {
type: 'shingle',
min_shingle_size: 2,
max_shingle_size: 3,
},
},
},
},
}; };

View File

@@ -1,5 +1,12 @@
# @openstapps/gitlab-api # @openstapps/gitlab-api
## 4.0.2
### Patch Changes
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/gitlab-api", "name": "@openstapps/gitlab-api",
"description": "Wraps common GitLab API calls in a TypeScript class.", "description": "Wraps common GitLab API calls in a TypeScript class.",
"version": "4.0.0", "version": "4.0.2",
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/gitlab-api.git", "repository": "git@gitlab.com:openstapps/gitlab-api.git",

View File

@@ -1,5 +1,11 @@
# @openstapps/logger # @openstapps/logger
## 4.0.2
### Patch Changes
- 6b06de40: Updated nodemailer dependency
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/logger", "name": "@openstapps/logger",
"description": "A cli logger with colors, log-levels and the possibility to use a transport system for errors", "description": "A cli logger with colors, log-levels and the possibility to use a transport system for errors",
"version": "4.0.0", "version": "4.0.2",
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/logger.git", "repository": "git@gitlab.com:openstapps/logger.git",
@@ -31,7 +31,7 @@
"@types/nodemailer": "6.4.7", "@types/nodemailer": "6.4.7",
"chalk": "5.2.0", "chalk": "5.2.0",
"flatted": "3.2.7", "flatted": "3.2.7",
"nodemailer": "6.9.1" "nodemailer": "6.9.9"
}, },
"devDependencies": { "devDependencies": {
"@openstapps/eslint-config": "workspace:*", "@openstapps/eslint-config": "workspace:*",

417
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff