2024-06-07 20:17:03 +03:00
|
|
|
/**
|
|
|
|
* Module: Schema of Synthesis Operations.
|
|
|
|
*/
|
|
|
|
|
2024-07-20 18:26:32 +03:00
|
|
|
import { Graph } from './Graph';
|
2024-07-28 00:37:33 +03:00
|
|
|
import { ILibraryItem, ILibraryItemData, LibraryItemID } from './library';
|
2024-07-29 16:55:48 +03:00
|
|
|
import { ConstituentaID, IConstituenta } from './rsform';
|
2024-06-07 20:17:03 +03:00
|
|
|
|
|
|
|
/**
|
2024-07-20 18:26:32 +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;
|
2024-07-24 22:23:05 +03:00
|
|
|
|
2024-07-20 18:26:32 +03:00
|
|
|
position_x: number;
|
|
|
|
position_y: number;
|
|
|
|
|
2024-07-21 15:17:36 +03:00
|
|
|
result: LibraryItemID | null;
|
2024-08-01 20:10:58 +03:00
|
|
|
|
2024-08-15 23:23:10 +03:00
|
|
|
is_owned: boolean;
|
2024-08-17 12:16:50 +03:00
|
|
|
is_consolidation: boolean; // aka 'diamond synthesis'
|
2024-08-01 20:10:58 +03:00
|
|
|
substitutions: ICstSubstituteEx[];
|
|
|
|
arguments: OperationID[];
|
2024-07-20 18:26:32 +03:00
|
|
|
}
|
|
|
|
|
2024-08-01 20:10:58 +03:00
|
|
|
/**
|
|
|
|
* Represents {@link IOperation} data from server.
|
|
|
|
*/
|
|
|
|
export interface IOperationData extends Omit<IOperation, 'substitutions' | 'arguments'> {}
|
|
|
|
|
2024-07-21 15:17:36 +03:00
|
|
|
/**
|
|
|
|
* Represents {@link IOperation} position.
|
|
|
|
*/
|
|
|
|
export interface IOperationPosition extends Pick<IOperation, 'id' | 'position_x' | 'position_y'> {}
|
|
|
|
|
2024-07-23 23:03:58 +03:00
|
|
|
/**
|
|
|
|
* Represents all {@link IOperation} positions in {@link IOperationSchema}.
|
|
|
|
*/
|
|
|
|
export interface IPositionsData {
|
|
|
|
positions: IOperationPosition[];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents target {@link IOperation}.
|
|
|
|
*/
|
|
|
|
export interface ITargetOperation extends IPositionsData {
|
|
|
|
target: OperationID;
|
|
|
|
}
|
|
|
|
|
2024-07-20 18:26:32 +03:00
|
|
|
/**
|
|
|
|
* Represents {@link IOperation} data, used in creation process.
|
|
|
|
*/
|
2024-07-23 23:03:58 +03:00
|
|
|
export interface IOperationCreateData extends IPositionsData {
|
2024-07-21 15:17:36 +03:00
|
|
|
item_data: Pick<
|
|
|
|
IOperation,
|
2024-07-30 15:59:37 +03:00
|
|
|
'alias' | 'operation_type' | 'title' | 'comment' | 'position_x' | 'position_y' | 'result'
|
2024-07-21 15:17:36 +03:00
|
|
|
>;
|
|
|
|
arguments: OperationID[] | undefined;
|
2024-07-26 17:30:37 +03:00
|
|
|
create_schema: boolean;
|
2024-07-21 15:17:36 +03:00
|
|
|
}
|
2024-07-20 18:26:32 +03:00
|
|
|
|
2024-07-29 22:30:24 +03:00
|
|
|
/**
|
|
|
|
* Represents {@link IOperation} data, used in update process.
|
|
|
|
*/
|
|
|
|
export interface IOperationUpdateData extends ITargetOperation {
|
2024-07-30 15:59:37 +03:00
|
|
|
item_data: Pick<IOperation, 'alias' | 'title' | 'comment'>;
|
2024-07-29 22:30:24 +03:00
|
|
|
arguments: OperationID[] | undefined;
|
|
|
|
substitutions: ICstSubstitute[] | undefined;
|
|
|
|
}
|
|
|
|
|
2024-08-15 23:23:10 +03:00
|
|
|
/**
|
|
|
|
* Represents {@link IOperation} data, used in destruction process.
|
|
|
|
*/
|
|
|
|
export interface IOperationDeleteData extends ITargetOperation {
|
|
|
|
keep_constituents: boolean;
|
|
|
|
delete_schema: boolean;
|
|
|
|
}
|
|
|
|
|
2024-07-28 21:29:46 +03:00
|
|
|
/**
|
|
|
|
* Represents {@link IOperation} data, used in setInput process.
|
|
|
|
*/
|
|
|
|
export interface IOperationSetInputData extends ITargetOperation {
|
|
|
|
input: LibraryItemID | null;
|
|
|
|
}
|
|
|
|
|
2024-07-20 18:26:32 +03:00
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents data, used in merging multiple {@link IConstituenta}.
|
|
|
|
*/
|
|
|
|
export interface ICstSubstituteData {
|
|
|
|
substitutions: ICstSubstitute[];
|
|
|
|
}
|
|
|
|
|
2024-07-29 16:55:48 +03:00
|
|
|
/**
|
|
|
|
* Represents substitution for multi synthesis table.
|
|
|
|
*/
|
|
|
|
export interface IMultiSubstitution {
|
2024-08-14 21:50:10 +03:00
|
|
|
original_source: ILibraryItem;
|
|
|
|
original: IConstituenta;
|
|
|
|
substitution: IConstituenta;
|
|
|
|
substitution_source: ILibraryItem;
|
2024-07-29 16:55:48 +03:00
|
|
|
}
|
|
|
|
|
2024-07-20 18:26:32 +03:00
|
|
|
/**
|
|
|
|
* Represents {@link ICstSubstitute} extended data.
|
|
|
|
*/
|
|
|
|
export interface ICstSubstituteEx extends ICstSubstitute {
|
2024-08-01 20:10:58 +03:00
|
|
|
operation: OperationID;
|
2024-07-20 18:26:32 +03:00
|
|
|
original_alias: string;
|
|
|
|
original_term: string;
|
|
|
|
substitution_alias: string;
|
|
|
|
substitution_term: string;
|
|
|
|
}
|
|
|
|
|
2024-07-26 00:33:22 +03:00
|
|
|
/**
|
|
|
|
* Represents {@link IOperationSchema} statistics.
|
|
|
|
*/
|
|
|
|
export interface IOperationSchemaStats {
|
|
|
|
count_operations: number;
|
|
|
|
count_inputs: number;
|
|
|
|
count_synthesis: number;
|
|
|
|
count_schemas: number;
|
2024-08-23 21:28:54 +03:00
|
|
|
count_owned: number;
|
2024-07-26 00:33:22 +03:00
|
|
|
}
|
|
|
|
|
2024-07-20 18:26:32 +03:00
|
|
|
/**
|
|
|
|
* Represents backend data for {@link IOperationSchema}.
|
2024-06-07 20:17:03 +03:00
|
|
|
*/
|
|
|
|
export interface IOperationSchemaData extends ILibraryItemData {
|
2024-08-01 20:10:58 +03:00
|
|
|
items: IOperationData[];
|
2024-07-20 18:26:32 +03:00
|
|
|
arguments: IArgument[];
|
|
|
|
substitutions: ICstSubstituteEx[];
|
2024-06-07 20:17:03 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-07-20 18:26:32 +03:00
|
|
|
* Represents OperationSchema.
|
2024-06-07 20:17:03 +03:00
|
|
|
*/
|
|
|
|
export interface IOperationSchema extends IOperationSchemaData {
|
2024-08-01 20:10:58 +03:00
|
|
|
items: IOperation[];
|
2024-07-20 18:26:32 +03:00
|
|
|
graph: Graph;
|
2024-07-26 00:33:22 +03:00
|
|
|
schemas: LibraryItemID[];
|
|
|
|
stats: IOperationSchemaStats;
|
2024-07-20 18:26:32 +03:00
|
|
|
operationByID: Map<OperationID, IOperation>;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents data response when creating {@link IOperation}.
|
|
|
|
*/
|
|
|
|
export interface IOperationCreatedResponse {
|
2024-08-01 20:10:58 +03:00
|
|
|
new_operation: IOperationData;
|
2024-07-20 18:26:32 +03:00
|
|
|
oss: IOperationSchemaData;
|
2024-06-21 21:46:10 +03:00
|
|
|
}
|
2024-07-28 00:37:33 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents data response when creating {@link IRSForm} for Input {@link IOperation}.
|
|
|
|
*/
|
|
|
|
export interface IInputCreatedResponse {
|
|
|
|
new_schema: ILibraryItem;
|
|
|
|
oss: IOperationSchemaData;
|
|
|
|
}
|
2024-08-26 17:24:46 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents substitution error description.
|
|
|
|
*/
|
|
|
|
export interface ISubstitutionErrorDescription {
|
|
|
|
errorType: SubstitutionErrorType;
|
|
|
|
params: string[];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents Substitution table error types.
|
|
|
|
*/
|
|
|
|
export enum SubstitutionErrorType {
|
|
|
|
invalidIDs,
|
2024-08-26 22:53:02 +03:00
|
|
|
incorrectCst,
|
2024-08-26 17:24:46 +03:00
|
|
|
invalidClasses,
|
|
|
|
invalidBasic,
|
|
|
|
invalidConstant,
|
2024-08-26 22:53:02 +03:00
|
|
|
typificationCycle,
|
|
|
|
baseSubstitutionNotSet,
|
|
|
|
unequalTypification,
|
|
|
|
unequalArgsCount,
|
|
|
|
unequalArgs
|
2024-08-26 17:24:46 +03:00
|
|
|
}
|