File tree Expand file tree Collapse file tree
apps/web/src/features/upload Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,14 +78,19 @@ function isZodArrayDef(def: AnyZodTypeDef): def is z.ZodArrayDef {
7878// TODO - fix extract set and record array functions to handle whitespace and trailing semicolon (present or included)
7979
8080function extractSetEntry ( entry : string ) {
81- return entry . slice ( 4 , - 1 ) ; // 'SET('
81+ const result = / S E T \( \s * ( .* ?) \s * \) / . exec ( entry ) ;
82+ if ( ! result ?. [ 1 ] ) {
83+ throw new Error ( `Failed to extract set value from entry: '${ entry } '` ) ;
84+ }
85+ return result [ 1 ] ;
8286}
8387
8488function extractRecordArrayEntry ( entry : string ) {
85- if ( entry . lastIndexOf ( ';' ) === entry . length - 2 ) {
86- return entry . slice ( 13 , - 2 ) ;
89+ const result = / R E C O R D _ A R R A Y \( \s * ( .* ?) [ \s ; ] * \) / . exec ( entry ) ;
90+ if ( ! result ?. [ 1 ] ) {
91+ throw new Error ( `Failed to extract record array value from entry: '${ entry } '` ) ;
8792 }
88- return entry . slice ( 13 , - 1 ) ;
93+ return result [ 1 ] ;
8994}
9095
9196export function reformatInstrumentData ( {
You can’t perform that action at this time.
0 commit comments