Skip to content

Commit

Permalink
Update types for new conditionals
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Cassidy <[email protected]>
  • Loading branch information
stevecassidy committed Mar 2, 2024
1 parent b5bbfae commit af87fc8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "faims3-datamodel",
"version": "1.1.1",
"version": "1.1.2",
"description": "Database access layer for FAIMS3",
"main": "./build/src/index.js",
"exports": {
Expand Down
15 changes: 15 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,27 @@ export interface ProjectUIViewsets {
};
}

export interface ConditionalExpression {
operator: string;
left?: ConditionalExpression;
right?: ConditionalExpression;
field?: string;
value?: any;
}

export interface RecordValues {
[field_name: string]: any;
}

export interface ProjectUIViews {
[key: string]: {
label?: string;
fields: string[];
uidesign?: string;
next_label?: string;
is_logic?: {[key: string]: string[]}; //add for branching logic
condition?: ConditionalExpression; // new conditional logic
conditionFn?: (v: RecordValues) => boolean; // compiled conditional function
};
}

Expand Down Expand Up @@ -458,6 +472,7 @@ export interface ProjectUIModel {
views: ProjectUIViews;
viewsets: ProjectUIViewsets;
visible_types: string[];
conditional_sources?: Set<string>;
}

export interface RecordMetadata {
Expand Down

0 comments on commit af87fc8

Please sign in to comment.