Ran prettier again
This commit is contained in:
@@ -29,7 +29,7 @@ export class StaticItemsCatalog implements ItemsCatalog {
|
||||
}
|
||||
|
||||
async component(name: string): Promise<Component> {
|
||||
const item = this._components.find((i) => i.name === name);
|
||||
const item = this._components.find(i => i.name === name);
|
||||
if (!item) {
|
||||
throw new NotFoundError(`Found no component with name ${name}`);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ export class Database {
|
||||
constructor(private readonly database: Knex) {}
|
||||
|
||||
async addOrUpdateComponent(component: AddDatabaseComponent): Promise<void> {
|
||||
await this.database.transaction(async (tx) => {
|
||||
await this.database.transaction(async tx => {
|
||||
// TODO(freben): Currently, several locations can compete for the same component
|
||||
// TODO(freben): If locationId is unset in the input, it won't be overwritten - should we instead replace with null?
|
||||
const count = await tx<DatabaseComponent>('components')
|
||||
@@ -60,7 +60,7 @@ export class Database {
|
||||
}
|
||||
|
||||
async addLocation(location: AddDatabaseLocation): Promise<DatabaseLocation> {
|
||||
return await this.database.transaction<DatabaseLocation>(async (tx) => {
|
||||
return await this.database.transaction<DatabaseLocation>(async tx => {
|
||||
const existingLocation = await tx<DatabaseLocation>('locations')
|
||||
.where({
|
||||
target: location.target,
|
||||
@@ -79,9 +79,9 @@ export class Database {
|
||||
target,
|
||||
});
|
||||
|
||||
return (
|
||||
await tx<DatabaseLocation>('locations').where({ id }).select()
|
||||
)![0];
|
||||
return (await tx<DatabaseLocation>('locations')
|
||||
.where({ id })
|
||||
.select())![0];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import * as Knex from 'knex';
|
||||
|
||||
export async function up(knex: Knex): Promise<any> {
|
||||
return knex.schema
|
||||
.createTable('locations', (table) => {
|
||||
.createTable('locations', table => {
|
||||
table.comment(
|
||||
'Registered locations that shall be contiuously scanned for catalog item updates',
|
||||
);
|
||||
@@ -29,7 +29,7 @@ export async function up(knex: Knex): Promise<any> {
|
||||
.notNullable()
|
||||
.comment('The actual target of the location');
|
||||
})
|
||||
.createTable('components', (table) => {
|
||||
.createTable('components', table => {
|
||||
table.comment('All components currently stored in the catalog');
|
||||
table.uuid('id').primary().comment('Auto-generated ID of the component');
|
||||
table
|
||||
|
||||
@@ -22,7 +22,7 @@ const port = process.env.PLUGIN_PORT ? Number(process.env.PLUGIN_PORT) : 3003;
|
||||
const enableCors = yn(process.env.PLUGIN_CORS, { default: false });
|
||||
const logger = getRootLogger();
|
||||
|
||||
startStandaloneServer({ port, enableCors, logger }).catch((err) => {
|
||||
startStandaloneServer({ port, enableCors, logger }).catch(err => {
|
||||
logger.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
export function runPeriodically(fn: () => any, delayMs: number): () => void {
|
||||
let cancel: () => void;
|
||||
let cancelled = false;
|
||||
const cancellationPromise = new Promise((resolve) => {
|
||||
const cancellationPromise = new Promise(resolve => {
|
||||
cancel = () => {
|
||||
resolve();
|
||||
cancelled = true;
|
||||
@@ -43,7 +43,7 @@ export function runPeriodically(fn: () => any, delayMs: number): () => void {
|
||||
}
|
||||
|
||||
await Promise.race([
|
||||
new Promise((resolve) => setTimeout(resolve, delayMs)),
|
||||
new Promise(resolve => setTimeout(resolve, delayMs)),
|
||||
cancellationPromise,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ export class KubernetesValidatorFunctions {
|
||||
value,
|
||||
'/',
|
||||
CommonValidatorFunctions.isValidDnsSubdomain,
|
||||
(n) => n.length >= 1 && n.length <= 63 && /^[a-z0-9A-Z]+$/.test(n),
|
||||
n => n.length >= 1 && n.length <= 63 && /^[a-z0-9A-Z]+$/.test(n),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user