2024-06-04 23:00:22 +03:00
|
|
|
/**
|
|
|
|
* Module: Schema of Synthesis Operations.
|
|
|
|
*/
|
|
|
|
|
2024-07-21 15:19:57 +03:00
|
|
|
import { Graph } from './Graph';
|
|
|
|
import { ILibraryItemData, LibraryItemID } from './library';
|
|
|
|
import { ConstituentaID } from './rsform';
|
2024-06-04 23:00:22 +03:00
|
|
|
|
|
|
|
/**
|
2024-07-21 15:19:57 +03:00
|
|
|
* Represents {@link IOperation} identifier type.
|
|
|
|
*/
|
|
|
|
export type OperationID = number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents {@link IOperation} type.
|
|
|
|
*/
|
|
|
|
export enum OperationType {
|
|
|
|
INPUT = 'input',
|
|
|
|
SYNTHESIS = 'synthesis'
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents Operation.
|
|
|
|
*/
|
|
|
|
export interface IOperation {
|
|
|
|
id: OperationID;
|
|
|
|
operation_type: OperationType;
|
|
|
|
oss: LibraryItemID;
|
|
|
|
|
|
|
|
alias: string;
|
|
|
|
title: string;
|
|
|
|
comment: string;
|
|
|
|
position_x: number;
|
|
|
|
position_y: number;
|
|
|
|
|
|
|
|
result: LibraryItemID | null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents {@link IOperation} position.
|
|
|
|
*/
|
|
|
|
export interface IOperationPosition extends Pick<IOperation, 'id' | 'position_x' | 'position_y'> {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents {@link IOperation} data, used in creation process.
|
|
|
|
*/
|
|
|
|
export interface IOperationCreateData {
|
|
|
|
item_data: Pick<
|
|
|
|
IOperation,
|
|
|
|
'alias' | 'operation_type' | 'title' | 'comment' | 'position_x' | 'position_y' | 'result'
|
|
|
|
>;
|
|
|
|
arguments: OperationID[] | undefined;
|
|
|
|
positions: IOperationPosition[];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents {@link IOperation} Argument.
|
|
|
|
*/
|
|
|
|
export interface IArgument {
|
|
|
|
operation: OperationID;
|
|
|
|
argument: OperationID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents data, used in merging single {@link IConstituenta}.
|
|
|
|
*/
|
|
|
|
export interface ICstSubstitute {
|
|
|
|
original: ConstituentaID;
|
|
|
|
substitution: ConstituentaID;
|
|
|
|
transfer_term: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents data, used in merging multiple {@link IConstituenta}.
|
|
|
|
*/
|
|
|
|
export interface ICstSubstituteData {
|
|
|
|
substitutions: ICstSubstitute[];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents {@link ICstSubstitute} extended data.
|
|
|
|
*/
|
|
|
|
export interface ICstSubstituteEx extends ICstSubstitute {
|
|
|
|
original_alias: string;
|
|
|
|
original_term: string;
|
|
|
|
substitution_alias: string;
|
|
|
|
substitution_term: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents backend data for {@link IOperationSchema}.
|
2024-06-04 23:00:22 +03:00
|
|
|
*/
|
|
|
|
export interface IOperationSchemaData extends ILibraryItemData {
|
2024-07-21 15:19:57 +03:00
|
|
|
items: IOperation[];
|
|
|
|
arguments: IArgument[];
|
|
|
|
substitutions: ICstSubstituteEx[];
|
2024-06-04 23:00:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-07-21 15:19:57 +03:00
|
|
|
* Represents OperationSchema.
|
2024-06-04 23:00:22 +03:00
|
|
|
*/
|
|
|
|
export interface IOperationSchema extends IOperationSchemaData {
|
2024-07-21 15:19:57 +03:00
|
|
|
graph: Graph;
|
|
|
|
operationByID: Map<OperationID, IOperation>;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents data response when creating {@link IOperation}.
|
|
|
|
*/
|
|
|
|
export interface IOperationCreatedResponse {
|
|
|
|
new_operation: IOperation;
|
|
|
|
oss: IOperationSchemaData;
|
2024-06-21 21:46:38 +03:00
|
|
|
}
|