We are starting to put too many services in common folder. Version and step building should be separated into different services and go to the builder folder. Today builder folder only manage schema. We should: - keep services responsible for only one action - keep modules based on the actual action these provide rather than having common module This PR: - creates a service for workflow version builder - moves version and step builders to workflow builder folder rather than commun - creates separated folders for schema, version and steps No logic has been added. Only modules created and functions moved.
71 lines
1.6 KiB
TypeScript
71 lines
1.6 KiB
TypeScript
import {
|
|
Check,
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
UpdateDateColumn,
|
|
} from 'typeorm';
|
|
|
|
import { InputSchema } from 'src/modules/workflow/workflow-builder/workflow-schema/types/input-schema.type';
|
|
|
|
const DEFAULT_SERVERLESS_TIMEOUT_SECONDS = 300; // 5 minutes
|
|
|
|
export enum ServerlessFunctionSyncStatus {
|
|
NOT_READY = 'NOT_READY',
|
|
BUILDING = 'BUILDING',
|
|
READY = 'READY',
|
|
}
|
|
|
|
export enum ServerlessFunctionRuntime {
|
|
NODE18 = 'nodejs18.x',
|
|
}
|
|
|
|
@Entity('serverlessFunction')
|
|
export class ServerlessFunctionEntity {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Column({ nullable: false })
|
|
name: string;
|
|
|
|
@Column({ nullable: true })
|
|
description: string;
|
|
|
|
@Column({ nullable: true })
|
|
latestVersion: string;
|
|
|
|
@Column({ nullable: false, type: 'jsonb', default: [] })
|
|
publishedVersions: string[];
|
|
|
|
@Column({ nullable: true, type: 'jsonb' })
|
|
latestVersionInputSchema: InputSchema;
|
|
|
|
@Column({ nullable: false, default: ServerlessFunctionRuntime.NODE18 })
|
|
runtime: ServerlessFunctionRuntime;
|
|
|
|
@Column({ nullable: false, default: DEFAULT_SERVERLESS_TIMEOUT_SECONDS })
|
|
@Check(`"timeoutSeconds" >= 1 AND "timeoutSeconds" <= 900`)
|
|
timeoutSeconds: number;
|
|
|
|
@Column({ nullable: true })
|
|
layerVersion: number;
|
|
|
|
@Column({
|
|
nullable: false,
|
|
default: ServerlessFunctionSyncStatus.NOT_READY,
|
|
type: 'enum',
|
|
enum: ServerlessFunctionSyncStatus,
|
|
})
|
|
syncStatus: ServerlessFunctionSyncStatus;
|
|
|
|
@Column({ nullable: false, type: 'uuid' })
|
|
workspaceId: string;
|
|
|
|
@CreateDateColumn({ type: 'timestamptz' })
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn({ type: 'timestamptz' })
|
|
updatedAt: Date;
|
|
}
|