feat(cli): run migrations and app in start command (#284)
* feat: perform pending migrations in start command * feat: log error when DB connection is refused * feat: log error when Redis connection is refused * refactor: fix type errors * fix: correct server and copy graphql schema * fix: differentiate migrations by env * chore: remove dev executable * chore: fix typo in default postgresUsername * fix: copy json files into dist folder * chore(cli): add dev script * chore: pull non-dev logs to info level * feat(cli): run app in start command * fix(backend): remove default count in Connection * fix(cli): remove .eslintrc usage in lint script * refactor: remove disableMigrationsListValidation * refactor: make Step optional in ExecutionStep * refactor: make Flow optional in Step
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import { dirname, join } from 'path';
|
||||
import { IApp } from '@automatisch/types';
|
||||
import appInfoConverter from '../helpers/app-info-converter';
|
||||
|
||||
class App {
|
||||
@@ -7,7 +8,7 @@ class App {
|
||||
static folderPath = join(dirname(this.backendPath), 'apps');
|
||||
static list = fs.readdirSync(this.folderPath);
|
||||
|
||||
static findAll(name?: string): object[] {
|
||||
static findAll(name?: string): IApp[] {
|
||||
if (!name) return this.list.map((name) => this.findOneByName(name));
|
||||
|
||||
return this.list
|
||||
@@ -15,7 +16,7 @@ class App {
|
||||
.map((name) => this.findOneByName(name));
|
||||
}
|
||||
|
||||
static findOneByName(name: string): object {
|
||||
static findOneByName(name: string): IApp {
|
||||
const rawAppData = fs.readFileSync(
|
||||
this.folderPath + `/${name}/info.json`,
|
||||
'utf-8'
|
||||
@@ -23,7 +24,7 @@ class App {
|
||||
return appInfoConverter(rawAppData);
|
||||
}
|
||||
|
||||
static findOneByKey(key: string): object {
|
||||
static findOneByKey(key: string): IApp {
|
||||
const rawAppData = fs.readFileSync(
|
||||
this.folderPath + `/${key}/info.json`,
|
||||
'utf-8'
|
||||
|
@@ -9,10 +9,10 @@ import { IJSONObject } from '@automatisch/types';
|
||||
class Connection extends Base {
|
||||
id!: string;
|
||||
key!: string;
|
||||
data: string;
|
||||
formattedData!: IJSONObject;
|
||||
data = '';
|
||||
formattedData?: IJSONObject;
|
||||
userId!: string;
|
||||
verified: boolean;
|
||||
verified = false;
|
||||
count: number;
|
||||
|
||||
static tableName = 'connections';
|
||||
@@ -50,7 +50,7 @@ class Connection extends Base {
|
||||
appConfig.encryptionKey
|
||||
).toString();
|
||||
|
||||
delete this['formattedData'];
|
||||
delete this.formattedData;
|
||||
}
|
||||
|
||||
decryptData(): void {
|
||||
|
@@ -8,7 +8,7 @@ class ExecutionStep extends Base {
|
||||
stepId!: string;
|
||||
dataIn!: Record<string, unknown>;
|
||||
dataOut!: Record<string, unknown>;
|
||||
status: string;
|
||||
status = 'failure';
|
||||
step: Step;
|
||||
|
||||
static tableName = 'execution_steps';
|
||||
|
@@ -5,8 +5,8 @@ import ExecutionStep from './execution-step';
|
||||
class Execution extends Base {
|
||||
id!: string;
|
||||
flowId!: string;
|
||||
testRun: boolean;
|
||||
executionSteps: ExecutionStep[];
|
||||
testRun = false;
|
||||
executionSteps: ExecutionStep[] = [];
|
||||
|
||||
static tableName = 'executions';
|
||||
|
||||
|
@@ -6,9 +6,9 @@ import Execution from './execution';
|
||||
|
||||
class Flow extends Base {
|
||||
id!: string;
|
||||
name: string;
|
||||
name!: string;
|
||||
userId!: string;
|
||||
active: boolean;
|
||||
active = false;
|
||||
steps?: [Step];
|
||||
|
||||
static tableName = 'flows';
|
||||
|
@@ -7,15 +7,15 @@ import type { IStep } from '@automatisch/types';
|
||||
class Step extends Base {
|
||||
id!: string;
|
||||
flowId!: string;
|
||||
key: string;
|
||||
appKey: string;
|
||||
key?: string;
|
||||
appKey?: string;
|
||||
type!: IStep["type"];
|
||||
connectionId?: string;
|
||||
status: string;
|
||||
position: number;
|
||||
parameters: Record<string, unknown>;
|
||||
status = 'incomplete';
|
||||
position!: number;
|
||||
parameters: Record<string, unknown> = {};
|
||||
connection?: Connection;
|
||||
flow?: Flow;
|
||||
flow: Flow;
|
||||
executionSteps?: [ExecutionStep];
|
||||
|
||||
static tableName = 'steps';
|
||||
|
Reference in New Issue
Block a user