File tree Expand file tree Collapse file tree 3 files changed +11
-9
lines changed
frontend/src/components/VariablesList Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ const tableRowsSchema = z.array(
2323const tableSchema = z . object ( {
2424 rows : tableRowsSchema ,
2525 columns : tableColumnsSchema ,
26- inputSource : z . enum ( FOR_EACH_TABLE_SOURCES as [ string , ... string [ ] ] ) ,
26+ inputSource : z . enum ( FOR_EACH_TABLE_SOURCES ) ,
2727} )
2828
2929const baseDataOutSchema = z . object ( {
Original file line number Diff line number Diff line change @@ -18,4 +18,4 @@ export const FOR_EACH_TABLE_SOURCES = [
1818 FOR_EACH_INPUT_SOURCE . TILES ,
1919 FOR_EACH_INPUT_SOURCE . M365_EXCEL ,
2020 FOR_EACH_INPUT_SOURCE . FORMSG_TABLE ,
21- ]
21+ ] as const
Original file line number Diff line number Diff line change 1- import { IJSONObject , IJSONValue } from '@plumber/types'
1+ import { IJSONObject } from '@plumber/types'
22
33import { z } from 'zod'
44
@@ -25,13 +25,15 @@ const FormSgTableFieldSchema = z.object({
2525 answer : z . string ( ) . transform ( ( val ) => JSON . parse ( val ) as IJSONObject ) ,
2626} )
2727
28- const FormSgFieldsSchema = z . record ( z . any ( ) ) . transform ( ( fields ) => {
28+ const FormSgFieldSchema = z . object ( {
29+ fieldType : z . string ( ) ,
30+ answer : z . union ( [ z . string ( ) , z . record ( z . any ( ) ) ] ) . optional ( ) ,
31+ } )
32+
33+ const FormSgFieldsSchema = z . record ( FormSgFieldSchema ) . transform ( ( fields ) => {
2934 const tableField = Object . values ( fields ) . find (
30- ( field : IJSONValue ) =>
31- typeof field === 'object' &&
32- field !== null &&
33- ( field as IJSONObject ) . fieldType === 'table' ,
34- ) as IJSONObject | undefined
35+ ( field ) => field ?. fieldType === 'table' ,
36+ ) as z . infer < typeof FormSgFieldSchema > | undefined
3537
3638 if ( ! tableField ) {
3739 return {
You can’t perform that action at this time.
0 commit comments