mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-03-07 15:22:23 +00:00
Compare commits
6 Commits
89-push-no
...
183-use-ne
| Author | SHA1 | Date | |
|---|---|---|---|
|
33181941ba
|
|||
|
7e779b738e
|
|||
|
2a1a7a5d5b
|
|||
|
|
a69b80d1d4 | ||
|
e2abc983ef
|
|||
|
913193abdb
|
5
.changeset/rich-rats-guess.md
Normal file
5
.changeset/rich-rats-guess.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@openstapps/backend": patch
|
||||
---
|
||||
|
||||
fix for geo.point mapping
|
||||
@@ -1,11 +1,5 @@
|
||||
# @openstapps/backend
|
||||
|
||||
## 3.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 67ab1fd6: fix for geo.point mapping
|
||||
|
||||
## 3.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@openstapps/backend",
|
||||
"description": "A reference implementation for a StApps backend",
|
||||
"version": "3.3.1",
|
||||
"version": "3.3.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"license": "AGPL-3.0-only",
|
||||
@@ -106,9 +106,6 @@
|
||||
"entry": [
|
||||
"src/cli.ts"
|
||||
],
|
||||
"loader": {
|
||||
".groovy": "text"
|
||||
},
|
||||
"sourcemap": true,
|
||||
"clean": true,
|
||||
"target": "es2022",
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
void traverse(def a, def b, ArrayList path, HashMap result) {
|
||||
if (a instanceof Map && b instanceof Map) {
|
||||
for (key in a.keySet()) {
|
||||
path.add(key);
|
||||
traverse(a.get(key), b.get(key), path, result);
|
||||
path.remove(path.size() - 1);
|
||||
}
|
||||
} else if (a instanceof List && b instanceof List) {
|
||||
int la = a.size();
|
||||
int lb = b.size();
|
||||
int max = la > lb ? la : lb;
|
||||
for (int i = 0; i < max; i++) {
|
||||
path.add(i);
|
||||
if (i < la && i < lb) {
|
||||
traverse(a[i], b[i], path, result);
|
||||
} else if (i >= la) {
|
||||
result.added.add(path.toArray());
|
||||
} else {
|
||||
result.removed.add(path.toArray());
|
||||
}
|
||||
path.remove(path.size() - 1);
|
||||
}
|
||||
} else if (a == null && b != null) {
|
||||
result.removed.add(path.toArray());
|
||||
} else if (a != null && b == null) {
|
||||
result.added.add(path.toArray());
|
||||
} else if (!a.equals(b)) {
|
||||
result.changed.add(path.toArray());
|
||||
}
|
||||
}
|
||||
|
||||
def to;
|
||||
def from;
|
||||
|
||||
for (state in states) {
|
||||
if (state.index.equals(params.newIndex)) {
|
||||
to = state.doc;
|
||||
} else {
|
||||
from = state.doc;
|
||||
}
|
||||
}
|
||||
|
||||
HashMap result = [
|
||||
'added': [],
|
||||
'removed': [],
|
||||
'changed': []
|
||||
];
|
||||
|
||||
traverse(to, from, new ArrayList(), result);
|
||||
|
||||
if (to == null && from != null) {
|
||||
result.status = 'removed';
|
||||
} else if (to != null && from == null) {
|
||||
result.status = 'added';
|
||||
} else if (
|
||||
result.added.size() == 0 &&
|
||||
result.removed.size() == 0 &&
|
||||
result.changed.size() == 0
|
||||
) {
|
||||
result.status = 'unchanged';
|
||||
} else {
|
||||
result.status = 'changed';
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -47,7 +47,6 @@ import {
|
||||
import {noUndefined} from './util/no-undefined.js';
|
||||
import {retryCatch, RetryOptions} from './util/retry.js';
|
||||
import {Feature, Point, Polygon} from 'geojson';
|
||||
import indexDiffScript from './diff-index.groovy';
|
||||
|
||||
/**
|
||||
* A database interface for elasticsearch
|
||||
@@ -240,42 +239,6 @@ export class Elasticsearch implements Database {
|
||||
.then(it => Object.entries(it).map(([name]) => name))
|
||||
.catch(() => [] as string[]);
|
||||
|
||||
if (activeIndices.length <= 1) {
|
||||
const result = await this.client.transform.previewTransform({
|
||||
source: {
|
||||
index: [...activeIndices, index],
|
||||
query: {match_all: {}},
|
||||
},
|
||||
dest: {index: 'compare'},
|
||||
pivot: {
|
||||
group_by: {
|
||||
uid: {terms: {field: 'uid.raw'}},
|
||||
},
|
||||
aggregations: {
|
||||
compare: {
|
||||
scripted_metric: {
|
||||
map_script: `
|
||||
state.index = doc['_index'];
|
||||
state.doc = params['_source'];`,
|
||||
combine_script: `
|
||||
state.index = state.index[0];
|
||||
return state;
|
||||
`,
|
||||
reduce_script: {
|
||||
source: indexDiffScript,
|
||||
params: {
|
||||
newIndex: index,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
console.log(JSON.stringify(result.preview, null, 2))
|
||||
}
|
||||
|
||||
await this.client.indices.updateAliases({
|
||||
actions: [
|
||||
{
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
// initialize the sort value with the maximum
|
||||
double price = Double.MAX_VALUE;
|
||||
|
||||
// if we have any offers
|
||||
if (params._source.containsKey(params.field)) {
|
||||
// iterate through all offers
|
||||
for (offer in params._source[params.field]) {
|
||||
// if this offer contains a role specific price
|
||||
if (offer.containsKey('prices') && offer.prices.containsKey(params.universityRole)) {
|
||||
// if the role specific price is smaller than the cheapest we found
|
||||
if (offer.prices[params.universityRole] < price) {
|
||||
// set the role specific price as cheapest for now
|
||||
price = offer.prices[params.universityRole];
|
||||
}
|
||||
} else { // we have no role specific price for our role in this offer
|
||||
// if the default price of this offer is lower than the cheapest we found
|
||||
if (offer.price < price) {
|
||||
// set this price as the cheapest
|
||||
price = offer.price;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// return cheapest price for our role
|
||||
return price;
|
||||
@@ -13,8 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SortOptions} from '@elastic/elasticsearch/lib/api/types.js';
|
||||
import {SCPriceSort} from '@openstapps/core';
|
||||
import priceSortScript from './price-sort.groovy';
|
||||
import {SCPriceSort, SCSportCoursePriceGroup, SCThingsField} from '@openstapps/core';
|
||||
|
||||
/**
|
||||
* Converts a price sort to elasticsearch syntax
|
||||
@@ -24,11 +23,47 @@ export function buildPriceSort(sort: SCPriceSort): SortOptions {
|
||||
return {
|
||||
_script: {
|
||||
order: sort.order,
|
||||
script: {
|
||||
source: priceSortScript,
|
||||
params: sort.arguments,
|
||||
},
|
||||
script: buildPriceSortScript(sort.arguments.universityRole, sort.arguments.field),
|
||||
type: 'number' as const,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a script for sorting search results by prices
|
||||
* @param universityRole User group which consumes university services
|
||||
* @param field Field in which wanted offers with prices are located
|
||||
*/
|
||||
export function buildPriceSortScript(
|
||||
universityRole: keyof SCSportCoursePriceGroup,
|
||||
field: SCThingsField,
|
||||
): string {
|
||||
return `
|
||||
// initialize the sort value with the maximum
|
||||
double price = Double.MAX_VALUE;
|
||||
|
||||
// if we have any offers
|
||||
if (params._source.containsKey('${field}')) {
|
||||
// iterate through all offers
|
||||
for (offer in params._source.${field}) {
|
||||
// if this offer contains a role specific price
|
||||
if (offer.containsKey('prices') && offer.prices.containsKey('${universityRole}')) {
|
||||
// if the role specific price is smaller than the cheapest we found
|
||||
if (offer.prices.${universityRole} < price) {
|
||||
// set the role specific price as cheapest for now
|
||||
price = offer.prices.${universityRole};
|
||||
}
|
||||
} else { // we have no role specific price for our role in this offer
|
||||
// if the default price of this offer is lower than the cheapest we found
|
||||
if (offer.price < price) {
|
||||
// set this price as the cheapest
|
||||
price = offer.price;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// return cheapest price for our role
|
||||
return price;
|
||||
`;
|
||||
}
|
||||
|
||||
6
backend/backend/src/types.d.ts
vendored
6
backend/backend/src/types.d.ts
vendored
@@ -1,6 +0,0 @@
|
||||
declare module '*.groovy' {
|
||||
const content: string;
|
||||
export default content;
|
||||
}
|
||||
|
||||
export {};
|
||||
@@ -1,27 +1,31 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"alwaysStrict": true,
|
||||
"allowJs": true,
|
||||
"allowUnreachableCode": false,
|
||||
"checkJs": true,
|
||||
"declaration": true,
|
||||
"esModuleInterop": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"skipLibCheck": true,
|
||||
"downlevelIteration": true,
|
||||
"explainFiles": true,
|
||||
"inlineSourceMap": true,
|
||||
"isolatedModules": true,
|
||||
"lib": [
|
||||
"ES2022",
|
||||
"DOM"
|
||||
],
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"noErrorTruncation": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"isolatedModules": true,
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"resolveJsonModule": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitOverride": true,
|
||||
"noImplicitReturns": true,
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"outDir": "../../../lib/",
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
"lib": [
|
||||
"ES2022",
|
||||
"DOM"
|
||||
@@ -33,7 +37,6 @@
|
||||
"transpileOnly": true
|
||||
},
|
||||
"exclude": [
|
||||
"../../../app.js",
|
||||
"../../../lib/"
|
||||
"../../../lib/"
|
||||
]
|
||||
}
|
||||
|
||||
0
examples/minimal-connector/app.js
Executable file → Normal file
0
examples/minimal-connector/app.js
Executable file → Normal file
@@ -48,16 +48,16 @@ const program = new Command()
|
||||
const options = program.opts();
|
||||
|
||||
// create an instance of the PluginClient
|
||||
const pluginClient = new PluginClient(new HttpClient(), options.backendUrl);
|
||||
const pluginClient = new PluginClient(new HttpClient(), options['backendUrl']);
|
||||
|
||||
// create an instance of your plugin
|
||||
const plugin = new MinimalPlugin(
|
||||
// tslint:disable-next-line:no-magic-numbers
|
||||
Number.parseInt(options.port, 10),
|
||||
options.pluginName,
|
||||
options.url,
|
||||
`/${options.routeName}`,
|
||||
options.backendUrl,
|
||||
Number.parseInt(options['port'], 10),
|
||||
options['pluginName'],
|
||||
options['url'],
|
||||
`/${options['routeName']}`,
|
||||
options['backendUrl'],
|
||||
new Converter(path.resolve(__dirname, '..', 'src', 'plugin', 'protocol')), // an instance of the converter. Required
|
||||
// because your requests and response schemas are defined in the plugin. The path should lead to your request and
|
||||
// response interfaces
|
||||
@@ -69,7 +69,7 @@ const plugin = new MinimalPlugin(
|
||||
pluginClient
|
||||
.registerPlugin(plugin)
|
||||
.then(() => {
|
||||
Logger.ok(`Successfully registered plugin '${options.pluginName}' on /${options.routeName} .`);
|
||||
Logger.ok(`Successfully registered plugin '${options['pluginName']}' on /${options['routeName']} .`);
|
||||
})
|
||||
// eslint-disable-next-line unicorn/prefer-top-level-await
|
||||
.catch((error: Error) => {
|
||||
@@ -81,7 +81,9 @@ for (const signal of [`exit`, `SIGINT`, `SIGUSR1`, `SIGUSR2`, `SIGTERM`]) {
|
||||
pluginClient
|
||||
.unregisterPlugin(plugin)
|
||||
.then(() => {
|
||||
Logger.ok(`Successfully unregistered plugin '${options.pluginName}' from /${options.routeName} .`);
|
||||
Logger.ok(
|
||||
`Successfully unregistered plugin '${options['pluginName']}' from /${options['routeName']} .`,
|
||||
);
|
||||
})
|
||||
.catch((error: Error) => {
|
||||
throw error;
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @type {import('./scripts/icon-config').IconConfig} */
|
||||
/**
|
||||
* @type {import('./scripts/icon-config').IconConfig}
|
||||
*/
|
||||
const config = {
|
||||
inputPath: 'node_modules/material-symbols/material-symbols-rounded.woff2',
|
||||
outputPath: 'src/assets/icons.min.woff2',
|
||||
|
||||
@@ -25,6 +25,8 @@ import {PAIAPatron} from '../../types';
|
||||
export class ProfilePageComponent {
|
||||
patron?: PAIAPatron;
|
||||
|
||||
propertiesToShow: (keyof PAIAPatron)[] = ['id', 'name', 'email', 'address', 'expires'];
|
||||
|
||||
constructor(private readonly libraryAccountService: LibraryAccountService) {}
|
||||
|
||||
async ionViewWillEnter(): Promise<void> {
|
||||
|
||||
@@ -26,45 +26,27 @@
|
||||
<ion-card>
|
||||
<ion-card-content>
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col> {{ 'library.account.pages.profile.labels.id' | translate }}: </ion-col>
|
||||
<ion-col>
|
||||
{{ patron.id }}
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col> {{ 'library.account.pages.profile.labels.name' | translate }}: </ion-col>
|
||||
<ion-col> {{ patron.name_details?.title ?? '' }} {{ patron.name }} </ion-col>
|
||||
</ion-row>
|
||||
@if (patron.email) {
|
||||
<ion-row>
|
||||
<ion-col> {{ 'library.account.pages.profile.labels.email' | translate }}: </ion-col>
|
||||
<ion-col>
|
||||
{{ patron.email }}
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
}
|
||||
@if (patron.address) {
|
||||
<ion-row>
|
||||
<ion-col> {{ 'library.account.pages.profile.labels.address' | translate }}: </ion-col>
|
||||
<ion-col>
|
||||
{{ patron.address }}
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
}
|
||||
@if (patron.expires) {
|
||||
<ion-row>
|
||||
<ion-col> {{ 'library.account.pages.profile.labels.expires' | translate }}: </ion-col>
|
||||
<ion-col>
|
||||
@if (isUnlimitedExpiry(patron.expires)) {
|
||||
{{ 'library.account.pages.profile.values.unlimited' | translate }}
|
||||
} @else {
|
||||
{{ 'library.account.pages.profile.values.expires' | translate }}: {{
|
||||
patron.expires | amDateFormat: 'll'
|
||||
}}
|
||||
}
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
@for (property of propertiesToShow; track property) {
|
||||
@if (patron[property]) {
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
{{ 'library.account.pages.profile.labels' + '.' + property | translate }}:
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
@if (!['expires'].includes(property)) {
|
||||
{{ patron[property] }}
|
||||
} @else {
|
||||
@if (isUnlimitedExpiry(patron['expires'])) {
|
||||
{{ 'library.account.pages.profile.values.unlimited' | translate }}
|
||||
} @else {
|
||||
{{ 'library.account.pages.profile.values.expires' | translate }}: {{
|
||||
patron['expires'] | amDateFormat: 'll'
|
||||
}}
|
||||
}
|
||||
}
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
}
|
||||
}
|
||||
</ion-grid>
|
||||
</ion-card-content>
|
||||
|
||||
@@ -22,13 +22,6 @@ export interface PAIAPatron {
|
||||
status?: PAIAPatronStatus;
|
||||
type?: string;
|
||||
note?: string;
|
||||
// HeBIS specific property (not in PAIA documentation)
|
||||
name_details?: {
|
||||
firstname?: string;
|
||||
lastname?: string;
|
||||
gender?: string;
|
||||
title?: string;
|
||||
};
|
||||
}
|
||||
|
||||
export enum PAIAPatronStatus {
|
||||
|
||||
@@ -21,7 +21,7 @@ export const environment = {
|
||||
backend_url: 'https://mobile.server.uni-frankfurt.de',
|
||||
app_host: 'mobile.app.uni-frankfurt.de',
|
||||
custom_url_scheme: 'de.anyschool.app',
|
||||
backend_version: '3.3.0',
|
||||
backend_version: '999.0.0',
|
||||
production: true,
|
||||
};
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ export const environment = {
|
||||
backend_url: 'https://mobile.server.uni-frankfurt.de',
|
||||
app_host: 'mobile.app.uni-frankfurt.de',
|
||||
custom_url_scheme: 'de.anyschool.app',
|
||||
backend_version: '3.3.0',
|
||||
backend_version: '999.0.0',
|
||||
production: false,
|
||||
};
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
"outDir": "./dist/out-tsc",
|
||||
"declaration": false,
|
||||
"isolatedModules": false,
|
||||
"checkJs": false,
|
||||
"allowJs": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strictPropertyInitialization": false,
|
||||
"downlevelIteration": true,
|
||||
"importHelpers": true,
|
||||
@@ -20,3 +19,6 @@
|
||||
},
|
||||
"exclude": ["**/*.spec.ts"]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
10
packages/api-plugin/environment.d.ts
vendored
Normal file
10
packages/api-plugin/environment.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
declare global {
|
||||
namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
NODE_ENV?: string;
|
||||
PORT?: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
@@ -175,13 +175,11 @@ export abstract class Plugin {
|
||||
// tslint:disable-next-line:no-floating-promises
|
||||
Logger.error(`${bind} requires elevated privileges`);
|
||||
process.exit(1);
|
||||
break;
|
||||
}
|
||||
case 'EADDRINUSE': {
|
||||
// tslint:disable-next-line:no-floating-promises
|
||||
Logger.error(`${bind} is already in use`);
|
||||
process.exit(1);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
throw error;
|
||||
|
||||
@@ -128,8 +128,8 @@ export class Client {
|
||||
size: 1,
|
||||
});
|
||||
|
||||
if (response.data.length === 1 && response.data[0].uid === uid) {
|
||||
return response.data[0];
|
||||
if (response.data.length === 1 && response.data[0]!.uid === uid) {
|
||||
return response.data[0]!;
|
||||
}
|
||||
|
||||
throw new SCInternalServerErrorResponse(new SCNotFoundErrorResponse(true), true);
|
||||
@@ -220,11 +220,11 @@ export class Client {
|
||||
for (const key of Object.keys(multiSearchRequest)) {
|
||||
const searchRequest = multiSearchRequest[key];
|
||||
|
||||
if (searchRequest.size === undefined) {
|
||||
if (searchRequest?.size === undefined) {
|
||||
preFlightRequest[key] = {
|
||||
...searchRequest,
|
||||
};
|
||||
preFlightRequest[key].size = 0;
|
||||
preFlightRequest[key]!.size = 0;
|
||||
preFlightNecessary = true;
|
||||
}
|
||||
}
|
||||
@@ -245,8 +245,8 @@ export class Client {
|
||||
);
|
||||
|
||||
// set size for multi search requests that were in pre flight request
|
||||
for (const key of Object.keys(preFlightRequest)) {
|
||||
returnMultiSearchRequest[key].size = preFlightResponse[key].pagination.total;
|
||||
for (const key in preFlightRequest) {
|
||||
returnMultiSearchRequest[key]!.size = preFlightResponse[key]!.pagination.total;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ export class ConnectorClient extends Client {
|
||||
const thingSource = source === undefined ? 'stapps-api' : source;
|
||||
|
||||
// request a new bulk
|
||||
const bulk = await this.bulk(things[0].type, thingSource, timeout);
|
||||
const bulk = await this.bulk(things[0]!.type, thingSource, timeout);
|
||||
|
||||
// add items to the bulk - 5 concurrently
|
||||
await Promise.all(
|
||||
|
||||
@@ -33,7 +33,7 @@ export class ApiError extends Error {
|
||||
/**
|
||||
* Add additional data to the output of the error
|
||||
*/
|
||||
toString(): string {
|
||||
override toString(): string {
|
||||
let string_ = super.toString();
|
||||
|
||||
// add additional data
|
||||
|
||||
@@ -20,7 +20,7 @@ export function groupBy<T>(collection: T[], group: (item: T) => string | undefin
|
||||
return collection.reduce((accumulator: Record<string, T[]>, item) => {
|
||||
const key = group(item) ?? '';
|
||||
accumulator[key] = accumulator[key] ?? [];
|
||||
accumulator[key].push(item);
|
||||
accumulator[key]!.push(item);
|
||||
return accumulator;
|
||||
}, {});
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ export function shuffle<T>(array: T[]): T[] {
|
||||
const out = [];
|
||||
|
||||
while (copy.length > 0) {
|
||||
out.push(copy.splice(Math.floor(Math.random() * copy.length), 1)[0]);
|
||||
out.push(copy.splice(Math.floor(Math.random() * copy.length), 1)[0]!);
|
||||
}
|
||||
|
||||
return out;
|
||||
|
||||
@@ -17,5 +17,5 @@
|
||||
* Zip two arrays together.
|
||||
*/
|
||||
export function zip<T, U>(a: T[], b: U[]): [T, U][] {
|
||||
return a.map((_, i) => [a[i], b[i]]);
|
||||
return a.map((_, i) => [a[i]!, b[i]!]);
|
||||
}
|
||||
|
||||
@@ -60,11 +60,11 @@ commander
|
||||
|
||||
// get information about routes
|
||||
const routes = await gatherRouteInformation(sourcePath);
|
||||
routes.sort((a, b) => a.route.urlPath.localeCompare(b.route.urlPath));
|
||||
routes.sort((a, b) => a.route['urlPath'].localeCompare(b.route['urlPath']));
|
||||
|
||||
// change url path parameters to openapi notation
|
||||
for (const routeWithMetaInformation of routes) {
|
||||
routeWithMetaInformation.route.urlPath = routeWithMetaInformation.route.urlPath.replaceAll(
|
||||
routeWithMetaInformation.route['urlPath'] = routeWithMetaInformation.route['urlPath'].replaceAll(
|
||||
/:\w+/g,
|
||||
(match: string) => `{${match.replace(':', '')}}`,
|
||||
);
|
||||
@@ -72,7 +72,7 @@ commander
|
||||
|
||||
// keep openapi tags for routes that actually share url fragments
|
||||
let tagsToKeep = routes.map(routeWithMetaInformation =>
|
||||
capitalize(routeWithMetaInformation.route.urlPath.split('/')[1]),
|
||||
capitalize(routeWithMetaInformation.route['urlPath'].split('/')[1]),
|
||||
);
|
||||
tagsToKeep = tagsToKeep.filter(
|
||||
(element, i, array) => array.indexOf(element) === i && array.lastIndexOf(element) !== i,
|
||||
@@ -83,9 +83,9 @@ commander
|
||||
|
||||
// generate documentation for all routes
|
||||
for (const routeWithMetaInformation of routes) {
|
||||
routeWithMetaInformation.tags = [capitalize(routeWithMetaInformation.route.urlPath.split('/')[1])];
|
||||
routeWithMetaInformation.tags = [capitalize(routeWithMetaInformation.route['urlPath'].split('/')[1])];
|
||||
|
||||
output.paths[routeWithMetaInformation.route.urlPath] = generateOpenAPIForRoute(
|
||||
output.paths[routeWithMetaInformation.route['urlPath']] = generateOpenAPIForRoute(
|
||||
routeWithMetaInformation,
|
||||
path.relative(relativeOutDirectoryPath, outDirectorySchemasPath),
|
||||
tagsToKeep,
|
||||
@@ -165,7 +165,7 @@ commander
|
||||
continue;
|
||||
}
|
||||
|
||||
unexpected = unexpected || errorsPerFile[file].some(error => !error.expected);
|
||||
unexpected = unexpected || errorsPerFile[file]?.some(error => !error.expected) || false;
|
||||
}
|
||||
|
||||
if (relativeReportPath !== undefined) {
|
||||
|
||||
@@ -48,7 +48,7 @@ export async function gatherRouteInformation(path: string): Promise<RouteWithMet
|
||||
// instantiate all errors
|
||||
instantiatedRoute.errors = await Promise.all(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
instantiatedRoute.errorNames.map(async (error: any) =>
|
||||
instantiatedRoute['errorNames'].map(async (error: any) =>
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
Object.assign((await project.instantiateDefinitionByName(error.name)) as object, {
|
||||
name: error.name,
|
||||
@@ -57,10 +57,10 @@ export async function gatherRouteInformation(path: string): Promise<RouteWithMet
|
||||
);
|
||||
instantiatedRoute.responseBodyDescription =
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
|
||||
project.definitions[instantiatedRoute.responseBodyName]?.comment?.shortSummary!;
|
||||
project.definitions[instantiatedRoute['responseBodyName']]?.comment?.shortSummary!;
|
||||
instantiatedRoute.requestBodyDescription =
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
|
||||
project.definitions[instantiatedRoute.requestBodyName]?.comment?.shortSummary!;
|
||||
project.definitions[instantiatedRoute['requestBodyName']]?.comment?.shortSummary!;
|
||||
|
||||
return {
|
||||
description: {
|
||||
@@ -89,7 +89,7 @@ export function generateOpenAPIForRoute(
|
||||
const route = routeWithInfo.route;
|
||||
const openapiPath: OpenAPIV3.PathItemObject = {};
|
||||
|
||||
openapiPath[route.method.toLowerCase() as OpenAPIV3.HttpMethods] = {
|
||||
openapiPath[route['method'].toLowerCase() as OpenAPIV3.HttpMethods] = {
|
||||
summary: capitalize(routeWithInfo.description.shortText?.replace(/(Route to |Route for )/gim, '')),
|
||||
description: routeWithInfo.description.text,
|
||||
requestBody: {
|
||||
@@ -97,7 +97,7 @@ export function generateOpenAPIForRoute(
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: path.join(outDirectorySchemasPath, `${route.requestBodyName}.json`),
|
||||
$ref: path.join(outDirectorySchemasPath, `${route['requestBodyName']}.json`),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -117,19 +117,21 @@ export function generateOpenAPIForRoute(
|
||||
tags: routeWithInfo.tags?.filter(value => tagsToKeep.includes(value)),
|
||||
};
|
||||
|
||||
openapiPath[route.method.toLowerCase() as OpenAPIV3.HttpMethods]!.responses![route.statusCodeSuccess] = {
|
||||
openapiPath[route['method'].toLowerCase() as OpenAPIV3.HttpMethods]!.responses![
|
||||
route['statusCodeSuccess']
|
||||
] = {
|
||||
description: route.responseBodyDescription,
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: path.join(outDirectorySchemasPath, `${route.responseBodyName}.json`),
|
||||
$ref: path.join(outDirectorySchemasPath, `${route['responseBodyName']}.json`),
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
for (const error of route.errors) {
|
||||
openapiPath[route.method.toLowerCase() as OpenAPIV3.HttpMethods]!.responses![error.statusCode] = {
|
||||
openapiPath[route['method'].toLowerCase() as OpenAPIV3.HttpMethods]!.responses![error.statusCode] = {
|
||||
description:
|
||||
error.message ?? capitalize(error.name.replaceAll(/([A-Z][a-z])/g, ' $1').replace('SC ', '')),
|
||||
content: {
|
||||
@@ -142,8 +144,8 @@ export function generateOpenAPIForRoute(
|
||||
};
|
||||
}
|
||||
|
||||
if (typeof route.obligatoryParameters === 'object') {
|
||||
for (const [parameter, schemaDefinition] of Object.entries(route.obligatoryParameters)) {
|
||||
if (typeof route['obligatoryParameters'] === 'object') {
|
||||
for (const [parameter, schemaDefinition] of Object.entries(route['obligatoryParameters'])) {
|
||||
const openapiParameter: OpenAPIV3.ParameterObject = {
|
||||
in: 'path',
|
||||
name: parameter,
|
||||
@@ -153,7 +155,7 @@ export function generateOpenAPIForRoute(
|
||||
$ref: `schema/SCSearchResponse.json#/definitions/${schemaDefinition}`,
|
||||
},
|
||||
};
|
||||
openapiPath[route.method.toLowerCase() as OpenAPIV3.HttpMethods]?.parameters?.push(openapiParameter);
|
||||
openapiPath[route['method'].toLowerCase() as OpenAPIV3.HttpMethods]?.parameters?.push(openapiParameter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ function createPlantUMLCodeForClass(config: UMLConfig, readerClass: LightweightC
|
||||
if (config.showProperties && readerClass.properties) {
|
||||
for (const key in readerClass.properties) {
|
||||
const property = readerClass.properties[key];
|
||||
if (property.optional && !config.showOptionalProperties) {
|
||||
if (property?.optional && !config.showOptionalProperties) {
|
||||
// don't show optional attributes
|
||||
continue;
|
||||
}
|
||||
@@ -202,7 +202,7 @@ function createPlantUMLCodeForClass(config: UMLConfig, readerClass: LightweightC
|
||||
// don't show inherited properties
|
||||
continue;
|
||||
}*/
|
||||
model += `\n\t${createPropertyLine(property)}`;
|
||||
model += `\n\t${createPropertyLine(property!)}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,13 +213,13 @@ function createPlantUMLCodeForClass(config: UMLConfig, readerClass: LightweightC
|
||||
if (readerClass.properties) {
|
||||
for (const key in readerClass.properties) {
|
||||
const property = readerClass.properties[key];
|
||||
const types: string[] = getReferenceTypes(property.type);
|
||||
const types: string[] = getReferenceTypes(property!.type);
|
||||
for (const type of types) {
|
||||
if (config.showAssociations) {
|
||||
/*if (property.inherited && !config.showInheritedProperties) {
|
||||
continue;
|
||||
}*/
|
||||
model += `${readerClass.name} -up-> ${type} : ${property.name} >\n`;
|
||||
model += `${readerClass.name} -up-> ${type} : ${property!.name} >\n`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ export class Validator {
|
||||
}
|
||||
|
||||
// schema will be cached
|
||||
return this.ajvValidateWrapper(this.schemas[schema], instance);
|
||||
return this.ajvValidateWrapper(this.schemas[schema]!, instance);
|
||||
}
|
||||
|
||||
return this.ajvValidateWrapper(schema, instance);
|
||||
@@ -147,7 +147,7 @@ function fromAjvResult(
|
||||
const error: ValidationError = {
|
||||
dataPath: ajvError.instancePath,
|
||||
instance: instance,
|
||||
message: betterErrorObject?.[index]?.error ?? ajvError.message,
|
||||
message: betterErrorObject?.[index]?.error ?? ajvError.message!,
|
||||
name: ajvError.keyword,
|
||||
schemaPath: ajvError.schemaPath,
|
||||
suggestion: betterErrorObject?.[index]?.suggestion,
|
||||
@@ -223,7 +223,7 @@ export async function validateFiles(
|
||||
}
|
||||
|
||||
// add error to list of errors
|
||||
errors[testFileName].push({
|
||||
errors[testFileName]?.push({
|
||||
...error,
|
||||
expected,
|
||||
});
|
||||
@@ -234,7 +234,7 @@ export async function validateFiles(
|
||||
for (const error of expectedErrors) {
|
||||
await Logger.error(`Extraneous expected error '${error}' in ${testFile}.`);
|
||||
|
||||
errors[testFileName].push({
|
||||
errors[testFileName]?.push({
|
||||
dataPath: 'undefined',
|
||||
expected: false,
|
||||
instance: undefined,
|
||||
@@ -279,7 +279,7 @@ export async function writeReport(reportPath: PathLike, errors: ExpectedValidati
|
||||
|
||||
let fileOutput = '';
|
||||
|
||||
for (const [index, error] of errors[fileName].entries()) {
|
||||
for (const [index, error] of errors[fileName]!.entries()) {
|
||||
fileOutput += mustache.render(errorTemplate, {
|
||||
idx: index + 1,
|
||||
instance: JSON.stringify(error.instance, undefined, 2),
|
||||
|
||||
@@ -102,14 +102,14 @@ export function isSearchResponse(something: unknown): something is SCSearchRespo
|
||||
const somethingObject = something as {[key: string]: {[key: string]: string}};
|
||||
|
||||
return (
|
||||
Array.isArray(somethingObject.data) &&
|
||||
Array.isArray(somethingObject.facets) &&
|
||||
somethingObject.pagination !== undefined &&
|
||||
typeof somethingObject.pagination.count === 'number' &&
|
||||
typeof somethingObject.pagination.offset === 'number' &&
|
||||
typeof somethingObject.pagination.total === 'number' &&
|
||||
somethingObject.stats !== undefined &&
|
||||
typeof somethingObject.stats.time === 'number'
|
||||
Array.isArray(somethingObject['data']) &&
|
||||
Array.isArray(somethingObject['facets']) &&
|
||||
somethingObject['pagination'] !== undefined &&
|
||||
typeof somethingObject['pagination']['count'] === 'number' &&
|
||||
typeof somethingObject['pagination']['offset'] === 'number' &&
|
||||
typeof somethingObject['pagination']['total'] === 'number' &&
|
||||
somethingObject['stats'] !== undefined &&
|
||||
typeof somethingObject['stats']['time'] === 'number'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ export class SCAcademicDegreeMeta extends SCThingMeta implements SCMetaTranslati
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
academicDegree: 'Abschlussgrad',
|
||||
@@ -73,7 +73,7 @@ export class SCAcademicDegreeMeta extends SCThingMeta implements SCMetaTranslati
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
|
||||
@@ -67,7 +67,7 @@ export class SCAcademicTermWithoutReferencesMeta extends SCThingMeta implements
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
acronym: 'Akronym',
|
||||
@@ -89,7 +89,7 @@ export class SCAcademicTermWithoutReferencesMeta extends SCThingMeta implements
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
|
||||
@@ -124,7 +124,7 @@ export class SCCreativeWorkMeta extends SCThingMeta implements SCMetaTranslation
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
name: 'Titel',
|
||||
@@ -162,7 +162,7 @@ export class SCCreativeWorkMeta extends SCThingMeta implements SCMetaTranslation
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
|
||||
@@ -79,7 +79,7 @@ export class SCEventMeta extends SCThingMeta implements SCMetaTranslations<SCEve
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
academicTerms: 'Semester',
|
||||
@@ -105,7 +105,7 @@ export class SCEventMeta extends SCThingMeta implements SCMetaTranslations<SCEve
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
|
||||
@@ -134,7 +134,7 @@ export class SCPlaceWithoutReferencesMeta
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
address: 'Adresse',
|
||||
@@ -152,7 +152,7 @@ export class SCPlaceWithoutReferencesMeta
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
|
||||
@@ -30,7 +30,7 @@ export class SCThingInPlaceMeta extends SCThingMeta implements SCMetaTranslation
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
inPlace: 'Ort',
|
||||
@@ -44,7 +44,7 @@ export class SCThingInPlaceMeta extends SCThingMeta implements SCMetaTranslation
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
},
|
||||
|
||||
@@ -48,7 +48,7 @@ export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
paymentsAccepted: 'Bezahlmethoden',
|
||||
@@ -62,7 +62,7 @@ export class SCThingThatAcceptsPaymentsWithoutReferencesMeta
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
paymentsAccepted: {
|
||||
|
||||
@@ -119,7 +119,7 @@ export class SCAcademicEventMeta extends SCThingMeta implements SCMetaTranslatio
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCEventMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
@@ -143,7 +143,7 @@ export class SCAcademicEventMeta extends SCThingMeta implements SCMetaTranslatio
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCEventMeta().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
|
||||
@@ -119,7 +119,7 @@ export class SCArticleMeta extends SCThingMeta implements SCMetaTranslations<SCA
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
@@ -147,7 +147,7 @@ export class SCArticleMeta extends SCThingMeta implements SCMetaTranslations<SCA
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
|
||||
|
||||
@@ -120,7 +120,7 @@ export class SCAssessmentMeta extends SCThingMeta implements SCMetaTranslations<
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCAssessmentCategories,
|
||||
@@ -152,7 +152,7 @@ export class SCAssessmentMeta extends SCThingMeta implements SCMetaTranslations<
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCAssessmentCategories,
|
||||
|
||||
@@ -131,7 +131,7 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations<SCBook
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
@@ -159,7 +159,7 @@ export class SCBookMeta extends SCThingMeta implements SCMetaTranslations<SCBook
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
|
||||
@@ -95,7 +95,7 @@ export class SCBuildingMeta extends SCThingMeta implements SCMetaTranslations<SC
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCBuildingCategories,
|
||||
@@ -117,7 +117,7 @@ export class SCBuildingMeta extends SCThingMeta implements SCMetaTranslations<SC
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCBuildingCategories,
|
||||
|
||||
@@ -85,7 +85,7 @@ export class SCCatalogMeta extends SCThingMeta implements SCMetaTranslations<SCC
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCCatalogCategories,
|
||||
@@ -111,7 +111,7 @@ export class SCCatalogMeta extends SCThingMeta implements SCMetaTranslations<SCC
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCCatalogCategories,
|
||||
|
||||
@@ -80,7 +80,7 @@ export type SCCertificationCategories =
|
||||
| 'rainforest protection';
|
||||
|
||||
export class SCCertificationMeta extends SCThingMeta implements SCMetaTranslations<SCCertification> {
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
@@ -101,7 +101,7 @@ export class SCCertificationMeta extends SCThingMeta implements SCMetaTranslatio
|
||||
},
|
||||
};
|
||||
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
|
||||
@@ -83,7 +83,7 @@ export class SCContactPointMeta extends SCThingMeta implements SCMetaTranslation
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
areaServed: 'Arbeitsraum',
|
||||
@@ -107,7 +107,7 @@ export class SCContactPointMeta extends SCThingMeta implements SCMetaTranslation
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
type: 'Kontaktinformation',
|
||||
|
||||
@@ -112,7 +112,7 @@ export class SCCourseOfStudyMeta extends SCThingMeta implements SCMetaTranslatio
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCAcademicDegreeMeta().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
@@ -138,7 +138,7 @@ export class SCCourseOfStudyMeta extends SCThingMeta implements SCMetaTranslatio
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCAcademicDegreeMeta().fieldValueTranslations.de,
|
||||
modes: {
|
||||
|
||||
@@ -112,7 +112,7 @@ export class SCDateSeriesMeta extends SCThingMeta implements SCMetaTranslations<
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingInPlaceMeta().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCSportCoursePriceGroup>().fieldTranslations.de,
|
||||
@@ -138,7 +138,7 @@ export class SCDateSeriesMeta extends SCThingMeta implements SCMetaTranslations<
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCSportCoursePriceGroup>().fieldValueTranslations.de,
|
||||
|
||||
@@ -66,7 +66,7 @@ export class SCDiffMeta extends SCThingMeta implements SCMetaTranslations<SCDiff
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
action: 'Aktion',
|
||||
@@ -86,7 +86,7 @@ export class SCDiffMeta extends SCThingMeta implements SCMetaTranslations<SCDiff
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
action: {
|
||||
|
||||
@@ -205,7 +205,7 @@ export class SCDishMeta extends SCThingMeta implements SCMetaTranslations<SCDish
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCDishCategories,
|
||||
@@ -237,7 +237,7 @@ export class SCDishMeta extends SCThingMeta implements SCMetaTranslations<SCDish
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCDishCategories,
|
||||
|
||||
@@ -107,7 +107,7 @@ export class SCFloorMeta extends SCThingMeta implements SCMetaTranslations<SCFlo
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingInPlaceMeta().fieldTranslations.de,
|
||||
floorName: 'Etagenbezeichnung',
|
||||
@@ -123,7 +123,7 @@ export class SCFloorMeta extends SCThingMeta implements SCMetaTranslations<SCFlo
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.de,
|
||||
type: 'Etage',
|
||||
|
||||
@@ -66,7 +66,7 @@ export class SCIdCardMeta extends SCThingMeta implements SCMetaTranslations<SCId
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
validity: 'Gültigkeit',
|
||||
@@ -80,7 +80,7 @@ export class SCIdCardMeta extends SCThingMeta implements SCMetaTranslations<SCId
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
type: 'Ausweis',
|
||||
|
||||
@@ -54,7 +54,7 @@ export interface SCJobPosting
|
||||
}
|
||||
|
||||
export class SCJobPostingMeta extends SCThingMeta {
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta().fieldTranslations.de,
|
||||
@@ -67,7 +67,7 @@ export class SCJobPostingMeta extends SCThingMeta {
|
||||
},
|
||||
};
|
||||
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta().fieldValueTranslations.de,
|
||||
|
||||
@@ -122,7 +122,7 @@ export class SCMessageMeta extends SCThingMeta implements SCMetaTranslations<SCM
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
@@ -152,7 +152,7 @@ export class SCMessageMeta extends SCThingMeta implements SCMetaTranslations<SCM
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
|
||||
@@ -51,7 +51,7 @@ export class SCOrganizationMeta extends SCThingMeta implements SCMetaTranslation
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingInPlaceMeta().fieldTranslations.de,
|
||||
contactPoints: 'Kontaktinformationen',
|
||||
@@ -65,7 +65,7 @@ export class SCOrganizationMeta extends SCThingMeta implements SCMetaTranslation
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.de,
|
||||
type: 'Einrichtung',
|
||||
|
||||
@@ -103,7 +103,7 @@ export class SCPeriodicalMeta extends SCThingMeta implements SCMetaTranslations<
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
@@ -129,7 +129,7 @@ export class SCPeriodicalMeta extends SCThingMeta implements SCMetaTranslations<
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.de,
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
|
||||
@@ -154,7 +154,7 @@ export class SCPersonMeta extends SCThingMeta implements SCMetaTranslations<SCPe
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
additionalName: 'Zusatzname',
|
||||
@@ -197,7 +197,7 @@ export class SCPersonMeta extends SCThingMeta implements SCMetaTranslations<SCPe
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
gender: {
|
||||
|
||||
@@ -82,7 +82,7 @@ export class SCPointOfInterestMeta extends SCThingMeta implements SCMetaTranslat
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCPointOfInterestCategories,
|
||||
@@ -104,7 +104,7 @@ export class SCPointOfInterestMeta extends SCThingMeta implements SCMetaTranslat
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCPointOfInterestCategories,
|
||||
|
||||
@@ -70,7 +70,7 @@ export class SCPublicationEventMeta extends SCThingMeta implements SCMetaTransla
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCEventMeta().fieldTranslations.de,
|
||||
locations: 'Erscheinungsorte',
|
||||
@@ -86,7 +86,7 @@ export class SCPublicationEventMeta extends SCThingMeta implements SCMetaTransla
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCEventMeta().fieldValueTranslations.de,
|
||||
type: 'Veröffentlichung',
|
||||
|
||||
@@ -130,7 +130,7 @@ export class SCRoomMeta extends SCThingMeta implements SCMetaTranslations<SCRoom
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCPlaceWithoutReferencesMeta().fieldTranslations.de,
|
||||
...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldTranslations.de,
|
||||
@@ -156,7 +156,7 @@ export class SCRoomMeta extends SCThingMeta implements SCMetaTranslations<SCRoom
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCPlaceWithoutReferencesMeta().fieldValueTranslations.de,
|
||||
...new SCThingThatAcceptsPaymentsWithoutReferencesMeta().fieldValueTranslations.de,
|
||||
|
||||
@@ -57,7 +57,7 @@ export class SCSemesterMeta extends SCThingMeta implements SCMetaTranslations<SC
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCAcademicTermWithoutReferencesMeta().fieldTranslations.de,
|
||||
acronym: 'Abkürzung',
|
||||
@@ -79,7 +79,7 @@ export class SCSemesterMeta extends SCThingMeta implements SCMetaTranslations<SC
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCAcademicTermWithoutReferencesMeta().fieldValueTranslations.de,
|
||||
type: 'Semester',
|
||||
|
||||
@@ -121,7 +121,7 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCSettingCategories,
|
||||
@@ -149,7 +149,7 @@ export class SCSettingMeta extends SCThingMeta implements SCMetaTranslations<SCS
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<
|
||||
SCSettingCategories,
|
||||
|
||||
@@ -45,7 +45,7 @@ export class SCSportCourseMeta extends SCThingMeta implements SCMetaTranslations
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCEventMeta().fieldTranslations.de,
|
||||
},
|
||||
@@ -57,7 +57,7 @@ export class SCSportCourseMeta extends SCThingMeta implements SCMetaTranslations
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCEventMeta().fieldValueTranslations.de,
|
||||
type: 'Sportkurs',
|
||||
|
||||
@@ -140,7 +140,7 @@ export class SCStudyModuleMeta extends SCThingMeta implements SCMetaTranslations
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
@@ -172,7 +172,7 @@ export class SCStudyModuleMeta extends SCThingMeta implements SCMetaTranslations
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
|
||||
|
||||
@@ -62,7 +62,7 @@ export class SCTicketMeta extends SCThingMeta implements SCMetaTranslations<SCTi
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingInPlaceMeta().fieldTranslations.de,
|
||||
approxWaitingTime: 'ungefähre Wartezeit',
|
||||
@@ -80,7 +80,7 @@ export class SCTicketMeta extends SCThingMeta implements SCMetaTranslations<SCTi
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingInPlaceMeta().fieldValueTranslations.de,
|
||||
type: 'Ticket',
|
||||
|
||||
@@ -86,7 +86,7 @@ export class SCToDoMeta extends SCThingMeta implements SCMetaTranslations<SCToDo
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<string, SCThingWithCategoriesSpecificValues>()
|
||||
.fieldTranslations.de,
|
||||
@@ -106,7 +106,7 @@ export class SCToDoMeta extends SCThingMeta implements SCMetaTranslations<SCToDo
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingWithCategoriesWithoutReferencesMeta<string, SCThingWithCategoriesSpecificValues>()
|
||||
.fieldValueTranslations.de,
|
||||
|
||||
@@ -56,7 +56,7 @@ export class SCTourMeta extends SCThingMeta implements SCMetaTranslations<SCTour
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldTranslations.de,
|
||||
init: 'Initiales Skript',
|
||||
@@ -72,7 +72,7 @@ export class SCTourMeta extends SCThingMeta implements SCMetaTranslations<SCTour
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCThingMeta().fieldValueTranslations.de,
|
||||
type: 'Tour',
|
||||
|
||||
@@ -164,7 +164,7 @@ export class SCVideoMeta extends SCThingMeta implements SCMetaTranslations<SCVid
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
override fieldTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldTranslations.de,
|
||||
@@ -190,7 +190,7 @@ export class SCVideoMeta extends SCThingMeta implements SCMetaTranslations<SCVid
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
override fieldValueTranslations = {
|
||||
de: {
|
||||
...new SCCreativeWorkMeta().fieldValueTranslations.de,
|
||||
...new SCThingThatCanBeOfferedMeta<SCAcademicPriceGroup>().fieldValueTranslations.de,
|
||||
|
||||
@@ -76,7 +76,7 @@ export class SCThingTranslator {
|
||||
this.metaClasses = SCClasses;
|
||||
|
||||
// Initalize all meta classes once
|
||||
if (typeof (this.metaClasses as any)[Object.keys(this.metaClasses)[0]] === 'function') {
|
||||
if (typeof (this.metaClasses as any)[Object.keys(this.metaClasses)[0]!] === 'function') {
|
||||
for (const metaClass of Object.keys(this.metaClasses)) {
|
||||
(this.metaClasses as any)[metaClass] = new (SCClasses as any)[metaClass]();
|
||||
}
|
||||
|
||||
@@ -149,8 +149,8 @@ class LightweightDefinitionBuilder {
|
||||
indexSignature.type,
|
||||
),
|
||||
indexSignatureType: this.lightweightTypeFromType(
|
||||
this.typeChecker.getTypeFromTypeNode(indexSignature.parameters[0].type!),
|
||||
indexSignature.parameters[0].type!,
|
||||
this.typeChecker.getTypeFromTypeNode(indexSignature.parameters[0]?.type!),
|
||||
indexSignature.parameters[0]?.type!,
|
||||
),
|
||||
}),
|
||||
),
|
||||
@@ -253,6 +253,6 @@ class LightweightDefinitionBuilder {
|
||||
* Same as conversion, but generates a simple list of all definitions.
|
||||
*/
|
||||
convertToList(): LightweightDefinition[] {
|
||||
return Object.values(this.convert()).flatMap(it => it.values);
|
||||
return Object.values(this.convert()).flatMap(it => it['values']!);
|
||||
}
|
||||
}
|
||||
|
||||
9
packages/gitlab-api/environment.d.ts
vendored
Normal file
9
packages/gitlab-api/environment.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
declare global {
|
||||
namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
GITLAB_PRIVATE_TOKEN?: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
24
packages/logger/environment.d.ts
vendored
Normal file
24
packages/logger/environment.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
declare global {
|
||||
namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
/**
|
||||
* If set to true, invalid smtp configs will not throw an error
|
||||
*/
|
||||
ALLOW_NO_TRANSPORT?: 'true' | string;
|
||||
SMTP_AUTH_USER?: string;
|
||||
SMTP_AUTH_PASSWORD?: string;
|
||||
SMTP_SENDER_MAIL?: string;
|
||||
SMTP_SENDER_NAME?: string;
|
||||
SMTP_HOST?: string;
|
||||
SMTP_PORT?: string;
|
||||
SMTP_CC?: string;
|
||||
SMTP_RECIPIENTS?: string;
|
||||
SMTP_SECURE?: 'true' | string;
|
||||
STAPPS_LOG_LEVEL?: string;
|
||||
STAPPS_EXIT_LEVEL?: string;
|
||||
NODE_ENV?: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
Reference in New Issue
Block a user