sveltekit-ui 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -612,1941 +612,2062 @@ const table_id_for_foreign_row_literal = {
612
612
  }
613
613
  // image_literal
614
614
  // audio_literal
615
- // code_literal
616
- // cron_literal
617
- // dropdown_literal
618
615
  // file_literal
619
- // icon_literal
616
+ // dropdown_literal
620
617
  // text_array_literal
621
- // time_literal
622
618
  // function_literal
623
- // idk need to go to bed and think on fresh not what a literal even is as far as data types content types function type
624
-
625
- // defined_target_literal: {
626
- // kind: "literal",
627
- // category: "variables",
628
- // name: "Defined Target Literal",
629
- // value: {
630
- // identifier: null,
631
- // property_path: [],
632
- // },
633
- // node_structure: [[{ ui_type: "input", value: "defined_target_literal" }]],
634
- // postgres_type: "jsonb",
635
- // json_schema: {
636
- // type: "object",
637
- // properties: {
638
- // identifier: {
639
- // type: "string",
640
- // },
641
- // property_path: {
642
- // type: "array",
643
- // minItems: 1,
644
- // maxItems: 50,
645
- // items: {
646
- // anyOf: [
647
- // {
648
- // type: "string",
649
- // pattern: "^[a-z0-9]+(_[a-z0-9]+)*$",
650
- // },
651
- // {
652
- // type: "number",
653
- // },
654
- // ],
655
- // },
656
- // },
657
- // },
658
- // },
659
- // validator: (input) => {
660
- // // validate here, made up of identifier_literal values
661
- // },
662
- // },
663
619
 
664
- // stack_literal: {
665
- // kind: "literal",
666
- // category: "hidden",
667
- // name: "Stack Literal",
668
- // child_node_options: [
669
- // "define",
670
- // "set_defined",
671
- // "run_defined",
672
- // "instantiate_function",
673
- // "if_then",
674
- // "if_then_else",
675
- // "for_loop",
676
- // "return",
677
- // "log",
678
- // "call_endpoint",
679
- // "cron_job",
680
- // ],
681
- // postgres_type: "jsonb",
682
- // json_schema: {
683
- // type: "array",
684
- // items: {
685
- // type: "object",
686
- // properties: {
687
- // type: {
688
- // type: "string",
689
- // },
690
- // value: {
691
- // type: "any",
692
- // },
693
- // },
694
- // },
695
- // },
696
- // validator: (input) => {
697
- // // validate here
698
- // },
699
- // },
700
-
701
- // function_literal: {
702
- // kind: "literal",
703
- // category: "main",
704
- // name: "Function Literal",
705
- // fields: {
706
- // parameters: {
707
- // node_options: ["parameters_literal"],
708
- // forced_node: "parameters_literal",
709
- // },
710
- // is_do_collapsed: {
711
- // node_options: ["arrow_toggle_literal", "checkbox_literal"],
712
- // forced_node: "arrow_toggle_literal",
713
- // },
714
- // do: {
715
- // node_options: ["stack_literal"],
716
- // forced_node: "stack_literal",
717
- // },
718
- // },
719
- // node_structure: [
720
- // [
721
- // { ui_type: "field", field: "is_do_collapsed" },
722
- // { ui_type: "text", value: "function with parameters" },
723
- // { ui_type: "field", field: "parameters" },
724
- // ],
725
- // { ui_type: "stack", field: "do" },
726
- // ],
727
- // postgres_type: "jsonb",
728
- // json_schema: {
729
- // type: "object",
730
- // default: { parameters: [], is_do_collapsed: false, do: [] },
731
- // properties: {
732
- // parameters: {
733
- // type: "array",
734
- // items: {
735
- // type: "object",
736
- // default: { identifier: null, type: null },
737
- // properties: {
738
- // identifier: {
739
- // type: "string",
740
- // minLength: 1,
741
- // maxLength: 50,
742
- // pattern: "^[a-z0-9]+(_[a-z0-9]+)*$",
743
- // },
744
- // type: {
745
- // type: "string",
746
- // enum: all_node_types,
747
- // },
748
- // },
749
- // },
750
- // },
751
- // is_do_collapsed: {
752
- // type: "boolean",
753
- // },
754
- // do: {
755
- // type: "array",
756
- // items: node_json_schema,
757
- // },
758
- // },
759
- // required: ["do"],
760
- // },
761
- // validator: (input) => {
762
- // // validate here
763
- // },
764
- // },
620
+ const node_json_schema = {}
621
+ const all_node_types = [
622
+ "defined_target_literal",
623
+ "stack_literal",
624
+ "function_literal",
625
+ "define",
626
+ "set_defined",
627
+ "get_defined",
628
+ "run_defined",
629
+ "if_then",
630
+ "if_then_else",
631
+ "for_loop",
632
+ "return",
633
+ "dropdown_literal",
634
+ "log",
635
+ "truthy_compare",
636
+ "arithmetic_binary_operation",
637
+ "round",
638
+ "parse",
639
+ "add_item_to_array",
640
+ "add_item_to_array_at_index",
641
+ "remove_item_from_array",
642
+ "remove_item_from_array_at_index",
643
+ "split_text",
644
+ "concat_arrays",
645
+ "sort_array",
646
+ "local_compare",
647
+ "slice",
648
+ "join_array_of_text_items",
649
+ "reverse_array",
650
+ "average_of_number_array",
651
+ "sum_of_number_array",
652
+ "trim_text",
653
+ "replace_text",
654
+ "compare_numbers",
655
+ "compare_text",
656
+ "get_length",
657
+ "object_expression",
658
+ "call_endpoint",
659
+ "cron_job",
660
+ ]
661
+ const value_node_types = [
662
+ "array_literal",
663
+ "array_uniform_literal",
664
+ "object_literal",
665
+ "object_uniform_literal",
666
+ "text_literal",
667
+ "boolean_literal",
668
+ "int_literal",
669
+ "bigint_literal",
670
+ "null_literal",
671
+ "epoch_literal",
672
+ "float_literal",
673
+ "color_literal",
674
+ "domain_literal",
675
+ "email_address_literal",
676
+ "email_address_full_literal",
677
+ "email_attachment_literal",
678
+ "json_literal",
679
+ "storage_item_literal",
680
+ "html_literal",
681
+ "phone_literal",
682
+ "vector_literal",
683
+ "icon_literal",
684
+ "time_literal",
685
+ "time_zone_literal",
686
+ "location_literal",
687
+ "cron_literal",
688
+ "variable_path_literal",
689
+ "content_literal",
690
+ "table_id_for_foreign_row_literal",
691
+ ]
765
692
 
766
- // define: {
767
- // kind: "definition",
768
- // category: "variables",
769
- // name: "Define",
770
- // fields: {
771
- // identifier: {
772
- // node_options: ["identifier_literal", "get_defined"],
773
- // forced_node: "identifier_literal",
774
- // },
775
- // value: {
776
- // node_options: all_node_types,
777
- // },
778
- // },
779
- // postgres_type: "jsonb",
780
- // node_structure: [
781
- // [
782
- // { ui_type: "field", field: "identifier" },
783
- // { ui_type: "text", value: "=" },
784
- // { ui_type: "field", field: "value" },
785
- // ],
786
- // ],
787
- // json_schema: {
788
- // type: "object",
789
- // properties: {
790
- // identifier: {
791
- // type: "string",
792
- // minLength: 1,
793
- // maxLength: 50,
794
- // pattern: "^[a-z0-9]+(_[a-z0-9]+)*$",
795
- // },
796
- // value: node_json_schema,
797
- // },
798
- // required: ["identifier", "value"],
799
- // },
800
- // validator: (input) => {
801
- // // validate here
802
- // },
803
- // },
693
+ export const function_types = {
694
+ defined_target_literal: {
695
+ kind: "literal",
696
+ category: "variables",
697
+ name: "Defined Target Literal",
698
+ value: {
699
+ identifier: null,
700
+ property_path: [],
701
+ },
702
+ node_structure: [[{ ui_type: "input", value: "defined_target_literal" }]],
703
+ postgres_type: "jsonb",
704
+ json_schema: {
705
+ type: "object",
706
+ properties: {
707
+ identifier: {
708
+ type: "string",
709
+ },
710
+ property_path: {
711
+ type: "array",
712
+ minItems: 1,
713
+ maxItems: 50,
714
+ items: {
715
+ anyOf: [
716
+ {
717
+ type: "string",
718
+ pattern: "^[a-z0-9]+(_[a-z0-9]+)*$",
719
+ },
720
+ {
721
+ type: "number",
722
+ },
723
+ ],
724
+ },
725
+ },
726
+ },
727
+ },
728
+ validator: (input) => {
729
+ // validate here, made up of identifier_literal values
730
+ },
731
+ },
804
732
 
805
- // set_defined: {
806
- // kind: "definition",
807
- // category: "variables",
808
- // name: "Set Defined",
809
- // fields: {
810
- // defined_target: {
811
- // node_options: ["defined_target_literal"],
812
- // forced_node: "defined_target_literal",
813
- // },
814
- // value: {
815
- // node_options: all_node_types,
816
- // },
817
- // },
818
- // postgres_type: "jsonb",
819
- // node_structure: [
820
- // [
821
- // { ui_type: "field", field: "defined_target" },
822
- // { ui_type: "text", value: "=" },
823
- // { ui_type: "field", field: "value" },
824
- // ],
825
- // ],
826
- // json_schema: {
827
- // type: "object",
828
- // properties: {
829
- // defined_target: {
830
- // type: "object",
831
- // properties: {
832
- // identifier: {
833
- // type: "string",
834
- // },
835
- // property_path: {
836
- // type: "array",
837
- // minItems: 1,
838
- // maxItems: 50,
839
- // items: {
840
- // anyOf: [
841
- // {
842
- // type: "string",
843
- // pattern: "^[a-z0-9]+(_[a-z0-9]+)*$",
844
- // },
845
- // {
846
- // type: "number",
847
- // },
848
- // ],
849
- // },
850
- // },
851
- // },
852
- // },
853
- // value: node_json_schema,
854
- // },
855
- // required: ["defined_target"],
856
- // },
857
- // validator: (input) => {
858
- // // validate here
859
- // },
860
- // },
733
+ stack_literal: {
734
+ kind: "literal",
735
+ category: "hidden",
736
+ name: "Stack Literal",
737
+ child_node_options: [
738
+ "define",
739
+ "set_defined",
740
+ "run_defined",
741
+ "instantiate_function",
742
+ "if_then",
743
+ "if_then_else",
744
+ "for_loop",
745
+ "return",
746
+ "log",
747
+ "call_endpoint",
748
+ "cron_job",
749
+ ],
750
+ postgres_type: "jsonb",
751
+ json_schema: {
752
+ type: "array",
753
+ items: {
754
+ type: "object",
755
+ properties: {
756
+ type: {
757
+ type: "string",
758
+ },
759
+ value: {
760
+ type: "any",
761
+ },
762
+ },
763
+ },
764
+ },
765
+ validator: (input) => {
766
+ // validate here
767
+ },
768
+ },
861
769
 
862
- // get_defined: {
863
- // kind: "expression",
864
- // category: "variables",
865
- // name: "Get Defined",
866
- // fields: {
867
- // defined_target: {
868
- // node_options: ["defined_target_literal"],
869
- // forced_node: "defined_target_literal",
870
- // },
871
- // },
872
- // postgres_type: "jsonb",
873
- // node_structure: [
874
- // [
875
- // { ui_type: "text", value: "value of" },
876
- // { ui_type: "field", field: "defined_target" },
877
- // ],
878
- // ],
879
- // json_schema: {
880
- // type: "object",
881
- // properties: {
882
- // defined_target: {
883
- // type: "array",
884
- // minItems: 1,
885
- // maxItems: 50,
886
- // items: {
887
- // anyOf: [
888
- // {
889
- // type: "string",
890
- // pattern: "^[a-z0-9]+(_[a-z0-9]+)*$",
891
- // },
892
- // {
893
- // type: "number",
894
- // },
895
- // ],
896
- // },
897
- // },
898
- // },
899
- // required: ["defined_target"],
900
- // },
901
- // output: {
902
- // json_schema: {
903
- // type: "any",
904
- // },
905
- // },
906
- // validator: (input) => {
907
- // // validate here
908
- // },
909
- // },
770
+ function_literal: {
771
+ kind: "literal",
772
+ category: "main",
773
+ name: "Function Literal",
774
+ fields: {
775
+ parameters: {
776
+ node_options: ["parameters_literal"],
777
+ forced_node: "parameters_literal",
778
+ },
779
+ is_do_collapsed: {
780
+ node_options: ["arrow_toggle_literal", "checkbox_literal"],
781
+ forced_node: "arrow_toggle_literal",
782
+ },
783
+ do: {
784
+ node_options: ["stack_literal"],
785
+ forced_node: "stack_literal",
786
+ },
787
+ },
788
+ node_structure: [
789
+ [
790
+ { ui_type: "field", field: "is_do_collapsed" },
791
+ { ui_type: "text", value: "function with parameters" },
792
+ { ui_type: "field", field: "parameters" },
793
+ ],
794
+ { ui_type: "stack", field: "do" },
795
+ ],
796
+ postgres_type: "jsonb",
797
+ json_schema: {
798
+ type: "object",
799
+ default: { parameters: [], is_do_collapsed: false, do: [] },
800
+ properties: {
801
+ parameters: {
802
+ type: "array",
803
+ items: {
804
+ type: "object",
805
+ default: { identifier: null, type: null },
806
+ properties: {
807
+ identifier: {
808
+ type: "string",
809
+ minLength: 1,
810
+ maxLength: 50,
811
+ pattern: "^[a-z0-9]+(_[a-z0-9]+)*$",
812
+ },
813
+ type: {
814
+ type: "string",
815
+ enum: all_node_types,
816
+ },
817
+ },
818
+ },
819
+ },
820
+ is_do_collapsed: {
821
+ type: "boolean",
822
+ },
823
+ do: {
824
+ type: "array",
825
+ items: node_json_schema,
826
+ },
827
+ },
828
+ required: ["do"],
829
+ },
830
+ validator: (input) => {
831
+ // validate here
832
+ },
833
+ },
910
834
 
911
- // run_defined: {
912
- // kind: "expression",
913
- // category: "variables",
914
- // name: "Run Defined",
915
- // fields: {
916
- // defined_target: {
917
- // node_options: ["defined_target_literal"],
918
- // forced_node: "defined_target_literal",
919
- // },
920
- // arguments: {
921
- // node_options: ["arguments_literal"],
922
- // forced_node: "arguments_literal",
923
- // },
924
- // },
925
- // postgres_type: "jsonb",
926
- // node_structure: [
927
- // [
928
- // { ui_type: "text", value: "run" },
929
- // { ui_type: "field", field: "defined_target" },
930
- // { ui_type: "text", value: "with arguments" },
931
- // { ui_type: "field", field: "arguments" },
932
- // ],
933
- // ],
934
- // json_schema: {
935
- // type: "object",
936
- // properties: {
937
- // defined_target: {
938
- // type: "array",
939
- // minItems: 1,
940
- // maxItems: 50,
941
- // items: {
942
- // anyOf: [
943
- // {
944
- // type: "string",
945
- // pattern: "^[a-z0-9]+(_[a-z0-9]+)*$",
946
- // },
947
- // {
948
- // type: "number",
949
- // },
950
- // ],
951
- // },
952
- // },
953
- // arguments: {
954
- // type: "array",
955
- // items: {
956
- // parameter: {
957
- // type: "string",
958
- // },
959
- // value: {
960
- // type: "any",
961
- // },
962
- // },
963
- // },
964
- // },
965
- // required: ["defined_target"],
966
- // },
967
- // output: {
968
- // json_schema: {
969
- // type: "any",
970
- // },
971
- // },
972
- // validator: (input) => {
973
- // // validate here
974
- // },
975
- // },
835
+ define: {
836
+ kind: "definition",
837
+ category: "variables",
838
+ name: "Define",
839
+ fields: {
840
+ identifier: {
841
+ node_options: ["identifier_literal", "get_defined"],
842
+ forced_node: "identifier_literal",
843
+ },
844
+ value: {
845
+ node_options: all_node_types,
846
+ },
847
+ },
848
+ postgres_type: "jsonb",
849
+ node_structure: [
850
+ [
851
+ { ui_type: "field", field: "identifier" },
852
+ { ui_type: "text", value: "=" },
853
+ { ui_type: "field", field: "value" },
854
+ ],
855
+ ],
856
+ json_schema: {
857
+ type: "object",
858
+ properties: {
859
+ identifier: {
860
+ type: "string",
861
+ minLength: 1,
862
+ maxLength: 50,
863
+ pattern: "^[a-z0-9]+(_[a-z0-9]+)*$",
864
+ },
865
+ value: node_json_schema,
866
+ },
867
+ required: ["identifier", "value"],
868
+ },
869
+ validator: (input) => {
870
+ // validate here
871
+ },
872
+ },
976
873
 
977
- // if_then: {
978
- // kind: "statement",
979
- // category: "main",
980
- // name: "If Then",
981
- // fields: {
982
- // condition: {
983
- // node_options: value_node_types,
984
- // },
985
- // is_do_collapsed: {
986
- // node_options: ["arrow_toggle_literal"],
987
- // forced_node: "arrow_toggle_literal",
988
- // },
989
- // do: {
990
- // node_options: ["stack_literal"],
991
- // forced_node: "stack_literal",
992
- // },
993
- // },
994
- // postgres_type: "jsonb",
995
- // node_structure: [
996
- // [
997
- // { ui_type: "field", field: "is_do_collapsed" },
998
- // { ui_type: "text", value: "if" },
999
- // { ui_type: "field", field: "condition" },
1000
- // { ui_type: "text", value: "then" },
1001
- // ],
1002
- // { ui_type: "stack", field: "do" },
1003
- // ],
1004
- // json_schema: {
1005
- // type: "object",
1006
- // properties: {
1007
- // condition: {
1008
- // type: ["boolean", "number", "string", "epoch", "object", "array"],
1009
- // },
1010
- // passed_do: {
1011
- // type: "array",
1012
- // items: node_json_schema,
1013
- // },
1014
- // },
1015
- // required: ["condition"],
1016
- // },
1017
- // validator: (input) => {
1018
- // // validate here
1019
- // },
1020
- // },
874
+ set_defined: {
875
+ kind: "definition",
876
+ category: "variables",
877
+ name: "Set Defined",
878
+ fields: {
879
+ defined_target: {
880
+ node_options: ["defined_target_literal"],
881
+ forced_node: "defined_target_literal",
882
+ },
883
+ value: {
884
+ node_options: all_node_types,
885
+ },
886
+ },
887
+ postgres_type: "jsonb",
888
+ node_structure: [
889
+ [
890
+ { ui_type: "field", field: "defined_target" },
891
+ { ui_type: "text", value: "=" },
892
+ { ui_type: "field", field: "value" },
893
+ ],
894
+ ],
895
+ json_schema: {
896
+ type: "object",
897
+ properties: {
898
+ defined_target: {
899
+ type: "object",
900
+ properties: {
901
+ identifier: {
902
+ type: "string",
903
+ },
904
+ property_path: {
905
+ type: "array",
906
+ minItems: 1,
907
+ maxItems: 50,
908
+ items: {
909
+ anyOf: [
910
+ {
911
+ type: "string",
912
+ pattern: "^[a-z0-9]+(_[a-z0-9]+)*$",
913
+ },
914
+ {
915
+ type: "number",
916
+ },
917
+ ],
918
+ },
919
+ },
920
+ },
921
+ },
922
+ value: node_json_schema,
923
+ },
924
+ required: ["defined_target"],
925
+ },
926
+ validator: (input) => {
927
+ // validate here
928
+ },
929
+ },
1021
930
 
1022
- // if_then_else: {
1023
- // kind: "statement",
1024
- // category: "main",
1025
- // name: "If Then Else",
1026
- // fields: {
1027
- // condition: {
1028
- // node_options: value_node_types,
1029
- // },
1030
- // is_passed_do_collapsed: {
1031
- // node_options: ["arrow_toggle_literal"],
1032
- // forced_node: "arrow_toggle_literal",
1033
- // },
1034
- // passed_do: {
1035
- // node_options: ["stack_literal"],
1036
- // forced_node: "stack_literal",
1037
- // },
1038
- // is_failed_do_collapsed: {
1039
- // node_options: ["arrow_toggle_literal"],
1040
- // forced_node: "arrow_toggle_literal",
1041
- // },
1042
- // failed_do: {
1043
- // node_options: ["stack_literal"],
1044
- // forced_node: "stack_literal",
1045
- // },
1046
- // },
1047
- // postgres_type: "jsonb",
1048
- // node_structure: [
1049
- // [
1050
- // { ui_type: "field", field: "is_passed_do_collapsed" },
1051
- // { ui_type: "text", value: "if" },
1052
- // { ui_type: "field", field: "condition" },
1053
- // { ui_type: "text", value: "then" },
1054
- // ],
1055
- // { ui_type: "stack", field: "passed_do" },
1056
- // [
1057
- // { ui_type: "field", field: "is_failed_do_collapsed" },
1058
- // { ui_type: "text", value: "else" },
1059
- // ],
1060
- // { ui_type: "stack", field: "failed_do" },
1061
- // ],
1062
- // json_schema: {
1063
- // type: "object",
1064
- // properties: {
1065
- // condition: {
1066
- // type: ["boolean", "number", "string", "epoch", "object", "array"],
1067
- // },
1068
- // passed_do: {
1069
- // type: "array",
1070
- // items: node_json_schema,
1071
- // },
1072
- // failed_do: {
1073
- // type: "array",
1074
- // items: node_json_schema,
1075
- // },
1076
- // },
1077
- // required: ["condition"],
1078
- // },
1079
- // validator: (input) => {
1080
- // // validate here
1081
- // },
1082
- // },
931
+ get_defined: {
932
+ kind: "expression",
933
+ category: "variables",
934
+ name: "Get Defined",
935
+ fields: {
936
+ defined_target: {
937
+ node_options: ["defined_target_literal"],
938
+ forced_node: "defined_target_literal",
939
+ },
940
+ },
941
+ postgres_type: "jsonb",
942
+ node_structure: [
943
+ [
944
+ { ui_type: "text", value: "value of" },
945
+ { ui_type: "field", field: "defined_target" },
946
+ ],
947
+ ],
948
+ json_schema: {
949
+ type: "object",
950
+ properties: {
951
+ defined_target: {
952
+ type: "array",
953
+ minItems: 1,
954
+ maxItems: 50,
955
+ items: {
956
+ anyOf: [
957
+ {
958
+ type: "string",
959
+ pattern: "^[a-z0-9]+(_[a-z0-9]+)*$",
960
+ },
961
+ {
962
+ type: "number",
963
+ },
964
+ ],
965
+ },
966
+ },
967
+ },
968
+ required: ["defined_target"],
969
+ },
970
+ output: {
971
+ json_schema: {
972
+ type: "any",
973
+ },
974
+ },
975
+ validator: (input) => {
976
+ // validate here
977
+ },
978
+ },
1083
979
 
1084
- // for_loop: {
1085
- // kind: "statement",
1086
- // category: "main",
1087
- // name: "For Loop",
1088
- // fields: {
1089
- // loop_over: {
1090
- // node_options: ["get_defined", "int_literal"],
1091
- // },
1092
- // iter_item_identifier: {
1093
- // node_options: ["identifier_literal"],
1094
- // forced_node: "identifier_literal",
1095
- // },
1096
- // is_do_collapsed: {
1097
- // node_options: ["arrow_toggle_literal"],
1098
- // forced_node: "arrow_toggle_literal",
1099
- // },
1100
- // do: {
1101
- // node_options: ["stack_literal"],
1102
- // forced_node: "stack_literal",
1103
- // },
1104
- // },
1105
- // postgres_type: "jsonb",
1106
- // node_structure: [
1107
- // [
1108
- // { ui_type: "field", field: "is_do_collapsed" },
1109
- // { ui_type: "text", value: "loop over" },
1110
- // { ui_type: "field", field: "loop_over" },
1111
- // { ui_type: "text", value: "as" },
1112
- // { ui_type: "field", field: "iter_item_identifier" },
1113
- // ],
1114
- // { ui_type: "stack", field: "do" },
1115
- // ],
1116
- // json_schema: {
1117
- // type: "object",
1118
- // properties: {
1119
- // loop_over: {
1120
- // type: ["number", "object", "array"],
1121
- // },
1122
- // iter_item_identifier: {
1123
- // type: "string",
1124
- // minLength: 1,
1125
- // maxLength: 80,
1126
- // pattern: "^[a-z0-9]+(_[a-z0-9]+)*$",
1127
- // },
1128
- // do: {
1129
- // type: "array",
1130
- // items: node_json_schema,
1131
- // },
1132
- // },
1133
- // required: ["loop_over"],
1134
- // },
1135
- // validator: (input) => {
1136
- // // validate here
1137
- // },
1138
- // },
980
+ run_defined: {
981
+ kind: "expression",
982
+ category: "variables",
983
+ name: "Run Defined",
984
+ fields: {
985
+ defined_target: {
986
+ node_options: ["defined_target_literal"],
987
+ forced_node: "defined_target_literal",
988
+ },
989
+ arguments: {
990
+ node_options: ["arguments_literal"],
991
+ forced_node: "arguments_literal",
992
+ },
993
+ },
994
+ postgres_type: "jsonb",
995
+ node_structure: [
996
+ [
997
+ { ui_type: "text", value: "run" },
998
+ { ui_type: "field", field: "defined_target" },
999
+ { ui_type: "text", value: "with arguments" },
1000
+ { ui_type: "field", field: "arguments" },
1001
+ ],
1002
+ ],
1003
+ json_schema: {
1004
+ type: "object",
1005
+ properties: {
1006
+ defined_target: {
1007
+ type: "array",
1008
+ minItems: 1,
1009
+ maxItems: 50,
1010
+ items: {
1011
+ anyOf: [
1012
+ {
1013
+ type: "string",
1014
+ pattern: "^[a-z0-9]+(_[a-z0-9]+)*$",
1015
+ },
1016
+ {
1017
+ type: "number",
1018
+ },
1019
+ ],
1020
+ },
1021
+ },
1022
+ arguments: {
1023
+ type: "array",
1024
+ items: {
1025
+ parameter: {
1026
+ type: "string",
1027
+ },
1028
+ value: {
1029
+ type: "any",
1030
+ },
1031
+ },
1032
+ },
1033
+ },
1034
+ required: ["defined_target"],
1035
+ },
1036
+ output: {
1037
+ json_schema: {
1038
+ type: "any",
1039
+ },
1040
+ },
1041
+ validator: (input) => {
1042
+ // validate here
1043
+ },
1044
+ },
1139
1045
 
1140
- // return: {
1141
- // kind: "statement",
1142
- // category: "main",
1143
- // name: "Return",
1144
- // fields: {
1145
- // value: {
1146
- // node_options: all_node_types,
1147
- // },
1148
- // },
1149
- // postgres_type: "jsonb",
1150
- // node_structure: [
1151
- // [
1152
- // { ui_type: "text", value: "return" },
1153
- // { ui_type: "field", field: "value" },
1154
- // ],
1155
- // ],
1156
- // json_schema: {
1157
- // type: "object",
1158
- // properties: {
1159
- // value: node_json_schema,
1160
- // },
1161
- // },
1162
- // validator: (input) => {
1163
- // // validate here
1164
- // },
1165
- // },
1046
+ if_then: {
1047
+ kind: "statement",
1048
+ category: "main",
1049
+ name: "If Then",
1050
+ fields: {
1051
+ condition: {
1052
+ node_options: value_node_types,
1053
+ },
1054
+ is_do_collapsed: {
1055
+ node_options: ["arrow_toggle_literal"],
1056
+ forced_node: "arrow_toggle_literal",
1057
+ },
1058
+ do: {
1059
+ node_options: ["stack_literal"],
1060
+ forced_node: "stack_literal",
1061
+ },
1062
+ },
1063
+ postgres_type: "jsonb",
1064
+ node_structure: [
1065
+ [
1066
+ { ui_type: "field", field: "is_do_collapsed" },
1067
+ { ui_type: "text", value: "if" },
1068
+ { ui_type: "field", field: "condition" },
1069
+ { ui_type: "text", value: "then" },
1070
+ ],
1071
+ { ui_type: "stack", field: "do" },
1072
+ ],
1073
+ json_schema: {
1074
+ type: "object",
1075
+ properties: {
1076
+ condition: {
1077
+ type: ["boolean", "number", "string", "epoch", "object", "array"],
1078
+ },
1079
+ passed_do: {
1080
+ type: "array",
1081
+ items: node_json_schema,
1082
+ },
1083
+ },
1084
+ required: ["condition"],
1085
+ },
1086
+ validator: (input) => {
1087
+ // validate here
1088
+ },
1089
+ },
1166
1090
 
1167
- // log: {
1168
- // kind: "statement",
1169
- // category: "main",
1170
- // name: "Log",
1171
- // fields: {
1172
- // type: {
1173
- // node_options: ["dropdown_literal"],
1174
- // forced_node: "dropdown_literal",
1175
- // dropdown_options: [
1176
- // { key: "log", name: "Log" },
1177
- // { key: "warning", name: "Warning" },
1178
- // { key: "error", name: "Error" },
1179
- // ],
1180
- // dropdown_default: "log",
1181
- // },
1182
- // label: {
1183
- // node_options: ["text_literal"],
1184
- // forced_node: "text_literal",
1185
- // },
1186
- // value: {
1187
- // node_options: all_node_types,
1188
- // },
1189
- // },
1190
- // postgres_type: "jsonb",
1191
- // node_structure: [
1192
- // [
1193
- // { ui_type: "field", field: "type" },
1194
- // { ui_type: "field", field: "label" },
1195
- // { ui_type: "field", field: "value" },
1196
- // ],
1197
- // ],
1198
- // json_schema: {
1199
- // type: "object",
1200
- // properties: {
1201
- // kind: {
1202
- // type: "string",
1203
- // enum: ["log", "warning", "error"],
1204
- // default: "log",
1205
- // },
1206
- // label: {
1207
- // type: "string",
1208
- // },
1209
- // value: node_json_schema,
1210
- // },
1211
- // required: ["kind", "value"],
1212
- // },
1213
- // validator: (input) => {
1214
- // // validate here
1215
- // },
1216
- // },
1091
+ if_then_else: {
1092
+ kind: "statement",
1093
+ category: "main",
1094
+ name: "If Then Else",
1095
+ fields: {
1096
+ condition: {
1097
+ node_options: value_node_types,
1098
+ },
1099
+ is_passed_do_collapsed: {
1100
+ node_options: ["arrow_toggle_literal"],
1101
+ forced_node: "arrow_toggle_literal",
1102
+ },
1103
+ passed_do: {
1104
+ node_options: ["stack_literal"],
1105
+ forced_node: "stack_literal",
1106
+ },
1107
+ is_failed_do_collapsed: {
1108
+ node_options: ["arrow_toggle_literal"],
1109
+ forced_node: "arrow_toggle_literal",
1110
+ },
1111
+ failed_do: {
1112
+ node_options: ["stack_literal"],
1113
+ forced_node: "stack_literal",
1114
+ },
1115
+ },
1116
+ postgres_type: "jsonb",
1117
+ node_structure: [
1118
+ [
1119
+ { ui_type: "field", field: "is_passed_do_collapsed" },
1120
+ { ui_type: "text", value: "if" },
1121
+ { ui_type: "field", field: "condition" },
1122
+ { ui_type: "text", value: "then" },
1123
+ ],
1124
+ { ui_type: "stack", field: "passed_do" },
1125
+ [
1126
+ { ui_type: "field", field: "is_failed_do_collapsed" },
1127
+ { ui_type: "text", value: "else" },
1128
+ ],
1129
+ { ui_type: "stack", field: "failed_do" },
1130
+ ],
1131
+ json_schema: {
1132
+ type: "object",
1133
+ properties: {
1134
+ condition: {
1135
+ type: ["boolean", "number", "string", "epoch", "object", "array"],
1136
+ },
1137
+ passed_do: {
1138
+ type: "array",
1139
+ items: node_json_schema,
1140
+ },
1141
+ failed_do: {
1142
+ type: "array",
1143
+ items: node_json_schema,
1144
+ },
1145
+ },
1146
+ required: ["condition"],
1147
+ },
1148
+ validator: (input) => {
1149
+ // validate here
1150
+ },
1151
+ },
1217
1152
 
1218
- // truthy_compare: {
1219
- // kind: "expression",
1220
- // category: "compare",
1221
- // name: "Truthy Compare",
1222
- // fields: {
1223
- // a: {
1224
- // node_options: all_node_types,
1225
- // },
1226
- // b: {
1227
- // node_options: all_node_types,
1228
- // },
1229
- // operator: {
1230
- // node_options: ["dropdown_literal"],
1231
- // forced_node: "dropdown_literal",
1232
- // dropdown_options: [
1233
- // { key: "logical_or", name: "logical_or (||)" },
1234
- // { key: "nullish_coalescing", name: "nullish_coalescing (??)" },
1235
- // { key: "and", name: "and (&&)" },
1236
- // ],
1237
- // dropdown_default: "and",
1238
- // },
1239
- // },
1240
- // postgres_type: "jsonb",
1241
- // node_structure: [
1242
- // [
1243
- // { ui_type: "field", field: "a" },
1244
- // { ui_type: "field", field: "operator" },
1245
- // { ui_type: "field", field: "b" },
1246
- // ],
1247
- // ],
1248
- // json_schema: {
1249
- // type: "object",
1250
- // properties: {
1251
- // a: {
1252
- // type: ["string", "number", "boolean", "object", "array"],
1253
- // },
1254
- // b: {
1255
- // type: ["string", "number", "boolean", "object", "array"],
1256
- // },
1257
- // operator: {
1258
- // type: "string",
1259
- // enum: ["logical_or", "nullish_coalescing", "and"],
1260
- // default: "and",
1261
- // },
1262
- // },
1263
- // required: ["operator"],
1264
- // },
1265
- // output: {
1266
- // json_schema: {
1267
- // type: "boolean_literal",
1268
- // },
1269
- // },
1270
- // validator: (input) => {
1271
- // // validate here
1272
- // },
1273
- // },
1153
+ for_loop: {
1154
+ kind: "statement",
1155
+ category: "main",
1156
+ name: "For Loop",
1157
+ fields: {
1158
+ loop_over: {
1159
+ node_options: ["get_defined", "int_literal"],
1160
+ },
1161
+ iter_item_identifier: {
1162
+ node_options: ["identifier_literal"],
1163
+ forced_node: "identifier_literal",
1164
+ },
1165
+ is_do_collapsed: {
1166
+ node_options: ["arrow_toggle_literal"],
1167
+ forced_node: "arrow_toggle_literal",
1168
+ },
1169
+ do: {
1170
+ node_options: ["stack_literal"],
1171
+ forced_node: "stack_literal",
1172
+ },
1173
+ },
1174
+ postgres_type: "jsonb",
1175
+ node_structure: [
1176
+ [
1177
+ { ui_type: "field", field: "is_do_collapsed" },
1178
+ { ui_type: "text", value: "loop over" },
1179
+ { ui_type: "field", field: "loop_over" },
1180
+ { ui_type: "text", value: "as" },
1181
+ { ui_type: "field", field: "iter_item_identifier" },
1182
+ ],
1183
+ { ui_type: "stack", field: "do" },
1184
+ ],
1185
+ json_schema: {
1186
+ type: "object",
1187
+ properties: {
1188
+ loop_over: {
1189
+ type: ["number", "object", "array"],
1190
+ },
1191
+ iter_item_identifier: {
1192
+ type: "string",
1193
+ minLength: 1,
1194
+ maxLength: 80,
1195
+ pattern: "^[a-z0-9]+(_[a-z0-9]+)*$",
1196
+ },
1197
+ do: {
1198
+ type: "array",
1199
+ items: node_json_schema,
1200
+ },
1201
+ },
1202
+ required: ["loop_over"],
1203
+ },
1204
+ validator: (input) => {
1205
+ // validate here
1206
+ },
1207
+ },
1274
1208
 
1275
- // arithmetic_binary_operation: {
1276
- // kind: "expression",
1277
- // category: "math",
1278
- // name: "Arithmatic Binary Operator",
1279
- // fields: {
1280
- // a: {
1281
- // node_options: [
1282
- // "get_defined",
1283
- // "arithmetic_binary_operation",
1284
- // "round",
1285
- // "parse",
1286
- // "get_length",
1287
- // "int_literal",
1288
- // "bigint_literal",
1289
- // "float_literal",
1290
- // ],
1291
- // },
1292
- // b: {
1293
- // node_options: [
1294
- // "get_defined",
1295
- // "arithmetic_binary_operation",
1296
- // "round",
1297
- // "parse",
1298
- // "get_length",
1299
- // "int_literal",
1300
- // "bigint_literal",
1301
- // "float_literal",
1302
- // ],
1303
- // },
1304
- // operator: {
1305
- // node_options: ["dropdown_literal"],
1306
- // forced_node: "dropdown_literal",
1307
- // dropdown_options: [
1308
- // { key: "add", name: "addition (+)" },
1309
- // { key: "subtract", name: "subtraction (-)" },
1310
- // { key: "multiply", name: "multiplication (*)" },
1311
- // { key: "divide", name: "division (/)" },
1312
- // { key: "remainder", name: "remainder (%)" },
1313
- // { key: "exponent", name: "exponent (^)" },
1314
- // { key: "min", name: "lowest" },
1315
- // { key: "max", name: "highest" },
1316
- // { key: "rand_value_between", name: "random value between" },
1317
- // { key: "to_precision", name: "round to significant figures" },
1318
- // ],
1319
- // dropdown_default: "add",
1320
- // },
1321
- // },
1322
- // postgres_type: "jsonb",
1323
- // node_structure: [
1324
- // [
1325
- // { ui_type: "field", field: "a" },
1326
- // { ui_type: "field", field: "operator" },
1327
- // { ui_type: "field", field: "b" },
1328
- // ],
1329
- // ],
1330
- // json_schema: {
1331
- // type: "object",
1332
- // properties: {
1333
- // a: {
1334
- // type: "number",
1335
- // },
1336
- // b: {
1337
- // type: "number",
1338
- // },
1339
- // operator: {
1340
- // type: "string",
1341
- // enum: [
1342
- // "add",
1343
- // "subtract",
1344
- // "multiply",
1345
- // "divide",
1346
- // "remainder",
1347
- // "exponent",
1348
- // "min",
1349
- // "max",
1350
- // "rand_value_between",
1351
- // "to_precision",
1352
- // ],
1353
- // default: "add",
1354
- // },
1355
- // },
1356
- // required: ["a", "b", "operator"],
1357
- // },
1358
- // output: {
1359
- // json_schema: {
1360
- // type: "number",
1361
- // },
1362
- // },
1363
- // validator: (input) => {
1364
- // // validate here
1365
- // },
1366
- // },
1209
+ return: {
1210
+ kind: "statement",
1211
+ category: "main",
1212
+ name: "Return",
1213
+ fields: {
1214
+ value: {
1215
+ node_options: all_node_types,
1216
+ },
1217
+ },
1218
+ postgres_type: "jsonb",
1219
+ node_structure: [
1220
+ [
1221
+ { ui_type: "text", value: "return" },
1222
+ { ui_type: "field", field: "value" },
1223
+ ],
1224
+ ],
1225
+ json_schema: {
1226
+ type: "object",
1227
+ properties: {
1228
+ value: node_json_schema,
1229
+ },
1230
+ },
1231
+ validator: (input) => {
1232
+ // validate here
1233
+ },
1234
+ },
1367
1235
 
1368
- // round: {
1369
- // kind: "expression",
1370
- // category: "math",
1371
- // name: "Round",
1372
- // fields: {
1373
- // value: {
1374
- // node_options: [
1375
- // "get_defined",
1376
- // "arithmetic_binary_operation",
1377
- // "round",
1378
- // "parse",
1379
- // "get_length",
1380
- // "int_literal",
1381
- // "bigint_literal",
1382
- // "float_literal",
1383
- // ],
1384
- // },
1385
- // operator: {
1386
- // node_options: ["dropdown_literal"],
1387
- // forced_node: "dropdown_literal",
1388
- // dropdown_options: [
1389
- // { key: "nearest_int", name: "nearest_int" },
1390
- // { key: "floor_int", name: "floor_int" },
1391
- // { key: "ceil_int", name: "ceil_int" },
1392
- // { key: "absolute_value", name: "absolute_value" },
1393
- // ],
1394
- // dropdown_default: "floor_int",
1395
- // },
1396
- // },
1397
- // postgres_type: "jsonb",
1398
- // node_structure: [
1399
- // [
1400
- // { ui_type: "field", field: "operator" },
1401
- // { ui_type: "field", field: "value" },
1402
- // ],
1403
- // ],
1404
- // json_schema: {
1405
- // type: "object",
1406
- // properties: {
1407
- // value: {
1408
- // type: "number",
1409
- // },
1410
- // operator: {
1411
- // type: "string",
1412
- // enum: ["nearest_int", "floor_int", "ceil_int", "absolute_value"],
1413
- // default: "floor_int",
1414
- // },
1415
- // },
1416
- // required: ["value", "operator"],
1417
- // },
1418
- // output: {
1419
- // json_schema: {
1420
- // type: "number",
1421
- // },
1422
- // },
1423
- // validator: (input) => {
1424
- // // validate here
1425
- // },
1426
- // },
1236
+ dropdown_literal: {
1237
+ kind: "statement",
1238
+ category: "main",
1239
+ name: "Dropdown",
1240
+ fields: {
1241
+ type: {
1242
+ node_options: ["dropdown_literal"],
1243
+ forced_node: "dropdown_literal",
1244
+ dropdown_options: [
1245
+ { key: "log", name: "Log" },
1246
+ { key: "warning", name: "Warning" },
1247
+ { key: "error", name: "Error" },
1248
+ ],
1249
+ dropdown_default: "log",
1250
+ },
1251
+ label: {
1252
+ node_options: ["text_literal"],
1253
+ forced_node: "text_literal",
1254
+ },
1255
+ value: {
1256
+ node_options: all_node_types,
1257
+ },
1258
+ },
1259
+ postgres_type: "jsonb",
1260
+ node_structure: [
1261
+ [
1262
+ { ui_type: "field", field: "type" },
1263
+ { ui_type: "field", field: "label" },
1264
+ { ui_type: "field", field: "value" },
1265
+ ],
1266
+ ],
1267
+ json_schema: {
1268
+ type: "object",
1269
+ properties: {
1270
+ kind: {
1271
+ type: "string",
1272
+ enum: ["log", "warning", "error"],
1273
+ default: "log",
1274
+ },
1275
+ label: {
1276
+ type: "string",
1277
+ },
1278
+ value: node_json_schema,
1279
+ },
1280
+ required: ["kind", "value"],
1281
+ },
1282
+ validator: (input) => {
1283
+ // validate here
1284
+ },
1285
+ },
1427
1286
 
1428
- // parse: {
1429
- // kind: "expression",
1430
- // category: "main",
1431
- // name: "Parse",
1432
- // fields: {
1433
- // value: {
1434
- // node_options: ["get_defined", "text_literal"],
1435
- // },
1436
- // operator: {
1437
- // node_options: ["dropdown_literal"],
1438
- // forced_node: "dropdown_literal",
1439
- // dropdown_options: [
1440
- // { key: "to_int", name: "to_int" },
1441
- // { key: "to_float", name: "to_float" },
1442
- // { key: "to_json", name: "to_json" },
1443
- // { key: "to_boolean", name: "to_boolean" },
1444
- // ],
1445
- // dropdown_default: "to_json",
1446
- // },
1447
- // },
1448
- // postgres_type: "jsonb",
1449
- // node_structure: [
1450
- // [
1451
- // { ui_type: "field", field: "operator" },
1452
- // { ui_type: "field", field: "value" },
1453
- // ],
1454
- // ],
1455
- // json_schema: {
1456
- // type: "object",
1457
- // properties: {
1458
- // value: {
1459
- // type: "string",
1460
- // },
1461
- // operator: {
1462
- // type: "string",
1463
- // enum: ["to_int", "to_float", "to_object", "to_array", "to_boolean"],
1464
- // default: "to_object",
1465
- // },
1466
- // },
1467
- // required: ["value", "operator"],
1468
- // },
1469
- // output: {
1470
- // json_schema: {
1471
- // type: "any",
1472
- // },
1473
- // },
1474
- // validator: (input) => {
1475
- // // validate here
1476
- // },
1477
- // },
1287
+ log: {
1288
+ kind: "statement",
1289
+ category: "main",
1290
+ name: "Log",
1291
+ fields: {
1292
+ type: {
1293
+ node_options: ["dropdown_literal"],
1294
+ forced_node: "dropdown_literal",
1295
+ dropdown_options: [
1296
+ { key: "log", name: "Log" },
1297
+ { key: "warning", name: "Warning" },
1298
+ { key: "error", name: "Error" },
1299
+ ],
1300
+ dropdown_default: "log",
1301
+ },
1302
+ label: {
1303
+ node_options: ["text_literal"],
1304
+ forced_node: "text_literal",
1305
+ },
1306
+ value: {
1307
+ node_options: all_node_types,
1308
+ },
1309
+ },
1310
+ postgres_type: "jsonb",
1311
+ node_structure: [
1312
+ [
1313
+ { ui_type: "field", field: "type" },
1314
+ { ui_type: "field", field: "label" },
1315
+ { ui_type: "field", field: "value" },
1316
+ ],
1317
+ ],
1318
+ json_schema: {
1319
+ type: "object",
1320
+ properties: {
1321
+ kind: {
1322
+ type: "string",
1323
+ enum: ["log", "warning", "error"],
1324
+ default: "log",
1325
+ },
1326
+ label: {
1327
+ type: "string",
1328
+ },
1329
+ value: node_json_schema,
1330
+ },
1331
+ required: ["kind", "value"],
1332
+ },
1333
+ validator: (input) => {
1334
+ // validate here
1335
+ },
1336
+ },
1478
1337
 
1479
- // add_item_to_array: {
1480
- // kind: "expression",
1481
- // category: "arrays",
1482
- // name: "Add Item To Array",
1483
- // fields: {
1484
- // array: {
1485
- // node_options: ["get_defined", "empty_array_literal"],
1486
- // },
1487
- // value_to_add: {
1488
- // node_options: all_node_types,
1489
- // },
1490
- // where_to_add: {
1491
- // node_options: ["dropdown_literal"],
1492
- // forced_node: "dropdown_literal",
1493
- // dropdown_options: [
1494
- // { key: "start", name: "start" },
1495
- // { key: "end", name: "end" },
1496
- // ],
1497
- // dropdown_default: "end",
1498
- // },
1499
- // },
1500
- // postgres_type: "jsonb",
1501
- // node_structure: [
1502
- // [
1503
- // { ui_type: "text", value: "add" },
1504
- // { ui_type: "field", field: "value_to_add" },
1505
- // { ui_type: "text", value: "to" },
1506
- // { ui_type: "field", field: "array" },
1507
- // { ui_type: "text", value: "at" },
1508
- // { ui_type: "field", field: "where_to_add" },
1509
- // ],
1510
- // ],
1511
- // json_schema: {
1512
- // type: "object",
1513
- // properties: {
1514
- // array: {
1515
- // type: "array",
1516
- // items: {
1517
- // type: "any",
1518
- // },
1519
- // },
1520
- // value_to_add: node_json_schema,
1521
- // where_to_add: {
1522
- // type: "string",
1523
- // enum: ["start", "end"],
1524
- // default: "end",
1525
- // },
1526
- // },
1527
- // required: ["array", "value_to_add", "where_to_add"],
1528
- // },
1529
- // output: {
1530
- // json_schema: {
1531
- // type: "array",
1532
- // items: {
1533
- // type: "any",
1534
- // },
1535
- // },
1536
- // },
1537
- // validator: (input) => {
1538
- // // validate here
1539
- // },
1540
- // },
1338
+ truthy_compare: {
1339
+ kind: "expression",
1340
+ category: "compare",
1341
+ name: "Truthy Compare",
1342
+ fields: {
1343
+ a: {
1344
+ node_options: all_node_types,
1345
+ },
1346
+ b: {
1347
+ node_options: all_node_types,
1348
+ },
1349
+ operator: {
1350
+ node_options: ["dropdown_literal"],
1351
+ forced_node: "dropdown_literal",
1352
+ dropdown_options: [
1353
+ { key: "logical_or", name: "logical_or (||)" },
1354
+ { key: "nullish_coalescing", name: "nullish_coalescing (??)" },
1355
+ { key: "and", name: "and (&&)" },
1356
+ ],
1357
+ dropdown_default: "and",
1358
+ },
1359
+ },
1360
+ postgres_type: "jsonb",
1361
+ node_structure: [
1362
+ [
1363
+ { ui_type: "field", field: "a" },
1364
+ { ui_type: "field", field: "operator" },
1365
+ { ui_type: "field", field: "b" },
1366
+ ],
1367
+ ],
1368
+ json_schema: {
1369
+ type: "object",
1370
+ properties: {
1371
+ a: {
1372
+ type: ["string", "number", "boolean", "object", "array"],
1373
+ },
1374
+ b: {
1375
+ type: ["string", "number", "boolean", "object", "array"],
1376
+ },
1377
+ operator: {
1378
+ type: "string",
1379
+ enum: ["logical_or", "nullish_coalescing", "and"],
1380
+ default: "and",
1381
+ },
1382
+ },
1383
+ required: ["operator"],
1384
+ },
1385
+ output: {
1386
+ json_schema: {
1387
+ type: "boolean_literal",
1388
+ },
1389
+ },
1390
+ validator: (input) => {
1391
+ // validate here
1392
+ },
1393
+ },
1541
1394
 
1542
- // add_item_to_array_at_index: {
1543
- // kind: "expression",
1544
- // category: "arrays",
1545
- // name: "Add Item To Array At Index",
1546
- // fields: {
1547
- // array: {
1548
- // node_options: ["get_defined", "empty_array_literal"],
1549
- // },
1550
- // value_to_add: {
1551
- // node_options: all_node_types,
1552
- // },
1553
- // where_to_add: {
1554
- // node_options: ["get_defined", "int_literal"],
1555
- // },
1556
- // },
1557
- // node_structure: [
1558
- // [
1559
- // { ui_type: "text", value: "add" },
1560
- // { ui_type: "field", field: "value_to_add" },
1561
- // { ui_type: "text", value: "to" },
1562
- // { ui_type: "field", field: "array" },
1563
- // { ui_type: "text", value: "at index" },
1564
- // { ui_type: "field", field: "where_to_add" },
1565
- // ],
1566
- // ],
1567
- // postgres_type: "jsonb",
1568
- // json_schema: {
1569
- // type: "object",
1570
- // properties: {
1571
- // array: {
1572
- // type: "array",
1573
- // items: {
1574
- // type: "any",
1575
- // },
1576
- // },
1577
- // value_to_add: node_json_schema,
1578
- // where_to_add: {
1579
- // type: "number",
1580
- // },
1581
- // },
1582
- // required: ["array", "value_to_add", "where_to_add"],
1583
- // },
1584
- // output: {
1585
- // json_schema: {
1586
- // type: "array",
1587
- // items: {
1588
- // type: "any",
1589
- // },
1590
- // },
1591
- // },
1592
- // validator: (input) => {
1593
- // // validate here
1594
- // },
1595
- // },
1395
+ arithmetic_binary_operation: {
1396
+ kind: "expression",
1397
+ category: "math",
1398
+ name: "Arithmatic Binary Operator",
1399
+ fields: {
1400
+ a: {
1401
+ node_options: [
1402
+ "get_defined",
1403
+ "arithmetic_binary_operation",
1404
+ "round",
1405
+ "parse",
1406
+ "get_length",
1407
+ "int_literal",
1408
+ "bigint_literal",
1409
+ "float_literal",
1410
+ ],
1411
+ },
1412
+ b: {
1413
+ node_options: [
1414
+ "get_defined",
1415
+ "arithmetic_binary_operation",
1416
+ "round",
1417
+ "parse",
1418
+ "get_length",
1419
+ "int_literal",
1420
+ "bigint_literal",
1421
+ "float_literal",
1422
+ ],
1423
+ },
1424
+ operator: {
1425
+ node_options: ["dropdown_literal"],
1426
+ forced_node: "dropdown_literal",
1427
+ dropdown_options: [
1428
+ { key: "add", name: "addition (+)" },
1429
+ { key: "subtract", name: "subtraction (-)" },
1430
+ { key: "multiply", name: "multiplication (*)" },
1431
+ { key: "divide", name: "division (/)" },
1432
+ { key: "remainder", name: "remainder (%)" },
1433
+ { key: "exponent", name: "exponent (^)" },
1434
+ { key: "min", name: "lowest" },
1435
+ { key: "max", name: "highest" },
1436
+ { key: "rand_value_between", name: "random value between" },
1437
+ { key: "to_precision", name: "round to significant figures" },
1438
+ ],
1439
+ dropdown_default: "add",
1440
+ },
1441
+ },
1442
+ postgres_type: "jsonb",
1443
+ node_structure: [
1444
+ [
1445
+ { ui_type: "field", field: "a" },
1446
+ { ui_type: "field", field: "operator" },
1447
+ { ui_type: "field", field: "b" },
1448
+ ],
1449
+ ],
1450
+ json_schema: {
1451
+ type: "object",
1452
+ properties: {
1453
+ a: {
1454
+ type: "number",
1455
+ },
1456
+ b: {
1457
+ type: "number",
1458
+ },
1459
+ operator: {
1460
+ type: "string",
1461
+ enum: [
1462
+ "add",
1463
+ "subtract",
1464
+ "multiply",
1465
+ "divide",
1466
+ "remainder",
1467
+ "exponent",
1468
+ "min",
1469
+ "max",
1470
+ "rand_value_between",
1471
+ "to_precision",
1472
+ ],
1473
+ default: "add",
1474
+ },
1475
+ },
1476
+ required: ["a", "b", "operator"],
1477
+ },
1478
+ output: {
1479
+ json_schema: {
1480
+ type: "number",
1481
+ },
1482
+ },
1483
+ validator: (input) => {
1484
+ // validate here
1485
+ },
1486
+ },
1596
1487
 
1597
- // remove_item_from_array: {
1598
- // kind: "expression",
1599
- // category: "arrays",
1600
- // name: "Remove Item From Array",
1601
- // fields: {
1602
- // array: {
1603
- // node_options: ["get_defined"],
1604
- // forced_node: "get_defined",
1605
- // },
1606
- // where_to_remove: {
1607
- // node_options: ["dropdown_literal"],
1608
- // forced_node: "dropdown_literal",
1609
- // dropdown_options: [
1610
- // { key: "start", name: "start" },
1611
- // { key: "end", name: "end" },
1612
- // ],
1613
- // dropdown_default: "end",
1614
- // },
1615
- // },
1616
- // postgres_type: "jsonb",
1617
- // node_structure: [
1618
- // [
1619
- // { ui_type: "text", value: "remove item from array" },
1620
- // { ui_type: "field", field: "array" },
1621
- // { ui_type: "text", value: "at" },
1622
- // { ui_type: "field", field: "where_to_remove" },
1623
- // ],
1624
- // ],
1625
- // json_schema: {
1626
- // type: "object",
1627
- // properties: {
1628
- // array: {
1629
- // type: "array",
1630
- // items: {
1631
- // type: "any",
1632
- // },
1633
- // },
1634
- // where_to_remove: {
1635
- // type: "string",
1636
- // enum: ["start", "end"],
1637
- // default: "end",
1638
- // },
1639
- // },
1640
- // required: ["array", "where_to_remove"],
1641
- // },
1642
- // output: {
1643
- // json_schema: {
1644
- // type: "array",
1645
- // items: {
1646
- // type: "any",
1647
- // },
1648
- // },
1649
- // },
1650
- // validator: (input) => {
1651
- // // validate here
1652
- // },
1653
- // },
1488
+ round: {
1489
+ kind: "expression",
1490
+ category: "math",
1491
+ name: "Round",
1492
+ fields: {
1493
+ value: {
1494
+ node_options: [
1495
+ "get_defined",
1496
+ "arithmetic_binary_operation",
1497
+ "round",
1498
+ "parse",
1499
+ "get_length",
1500
+ "int_literal",
1501
+ "bigint_literal",
1502
+ "float_literal",
1503
+ ],
1504
+ },
1505
+ operator: {
1506
+ node_options: ["dropdown_literal"],
1507
+ forced_node: "dropdown_literal",
1508
+ dropdown_options: [
1509
+ { key: "nearest_int", name: "nearest_int" },
1510
+ { key: "floor_int", name: "floor_int" },
1511
+ { key: "ceil_int", name: "ceil_int" },
1512
+ { key: "absolute_value", name: "absolute_value" },
1513
+ ],
1514
+ dropdown_default: "floor_int",
1515
+ },
1516
+ },
1517
+ postgres_type: "jsonb",
1518
+ node_structure: [
1519
+ [
1520
+ { ui_type: "field", field: "operator" },
1521
+ { ui_type: "field", field: "value" },
1522
+ ],
1523
+ ],
1524
+ json_schema: {
1525
+ type: "object",
1526
+ properties: {
1527
+ value: {
1528
+ type: "number",
1529
+ },
1530
+ operator: {
1531
+ type: "string",
1532
+ enum: ["nearest_int", "floor_int", "ceil_int", "absolute_value"],
1533
+ default: "floor_int",
1534
+ },
1535
+ },
1536
+ required: ["value", "operator"],
1537
+ },
1538
+ output: {
1539
+ json_schema: {
1540
+ type: "number",
1541
+ },
1542
+ },
1543
+ validator: (input) => {
1544
+ // validate here
1545
+ },
1546
+ },
1654
1547
 
1655
- // remove_item_from_array_at_index: {
1656
- // kind: "expression",
1657
- // category: "arrays",
1658
- // name: "Remove Item From Array At Index",
1659
- // fields: {
1660
- // array: {
1661
- // node_options: ["get_defined"],
1662
- // forced_node: "get_defined",
1663
- // },
1664
- // where_to_remove: {
1665
- // node_options: ["get_defined", "int_literal"],
1666
- // },
1667
- // },
1668
- // node_structure: [
1669
- // [
1670
- // { ui_type: "text", value: "remove item from array" },
1671
- // { ui_type: "field", field: "array" },
1672
- // { ui_type: "text", value: "at index" },
1673
- // { ui_type: "field", field: "where_to_remove" },
1674
- // ],
1675
- // ],
1676
- // postgres_type: "jsonb",
1677
- // json_schema: {
1678
- // type: "object",
1679
- // properties: {
1680
- // array: {
1681
- // type: "array",
1682
- // items: {
1683
- // type: "any",
1684
- // },
1685
- // },
1686
- // where_to_remove: {
1687
- // type: "number",
1688
- // },
1689
- // },
1690
- // required: ["array", "where_to_remove"],
1691
- // },
1692
- // output: {
1693
- // json_schema: {
1694
- // type: "array",
1695
- // items: {
1696
- // type: "any",
1697
- // },
1698
- // },
1699
- // },
1700
- // validator: (input) => {
1701
- // // validate here
1702
- // },
1703
- // },
1548
+ parse: {
1549
+ kind: "expression",
1550
+ category: "main",
1551
+ name: "Parse",
1552
+ fields: {
1553
+ value: {
1554
+ node_options: ["get_defined", "text_literal"],
1555
+ },
1556
+ operator: {
1557
+ node_options: ["dropdown_literal"],
1558
+ forced_node: "dropdown_literal",
1559
+ dropdown_options: [
1560
+ { key: "to_int", name: "to_int" },
1561
+ { key: "to_float", name: "to_float" },
1562
+ { key: "to_json", name: "to_json" },
1563
+ { key: "to_boolean", name: "to_boolean" },
1564
+ ],
1565
+ dropdown_default: "to_json",
1566
+ },
1567
+ },
1568
+ postgres_type: "jsonb",
1569
+ node_structure: [
1570
+ [
1571
+ { ui_type: "field", field: "operator" },
1572
+ { ui_type: "field", field: "value" },
1573
+ ],
1574
+ ],
1575
+ json_schema: {
1576
+ type: "object",
1577
+ properties: {
1578
+ value: {
1579
+ type: "string",
1580
+ },
1581
+ operator: {
1582
+ type: "string",
1583
+ enum: ["to_int", "to_float", "to_object", "to_array", "to_boolean"],
1584
+ default: "to_object",
1585
+ },
1586
+ },
1587
+ required: ["value", "operator"],
1588
+ },
1589
+ output: {
1590
+ json_schema: {
1591
+ type: "any",
1592
+ },
1593
+ },
1594
+ validator: (input) => {
1595
+ // validate here
1596
+ },
1597
+ },
1704
1598
 
1705
- // split_text: {
1706
- // kind: "expression",
1707
- // category: "arrays",
1708
- // name: "Split Text",
1709
- // fields: {
1710
- // text: {
1711
- // node_options: ["text_literal", "get_defined"],
1712
- // },
1713
- // delimiter: {
1714
- // node_options: ["text_literal", "get_defined"],
1715
- // },
1716
- // },
1717
- // node_structure: [
1718
- // [
1719
- // { ui_type: "text", value: "split text" },
1720
- // { ui_type: "field", field: "text" },
1721
- // { ui_type: "text", value: "to array at delimiter" },
1722
- // { ui_type: "field", field: "delimiter" },
1723
- // ],
1724
- // ],
1725
- // postgres_type: "jsonb",
1726
- // json_schema: {
1727
- // type: "object",
1728
- // properties: {
1729
- // text: {
1730
- // type: "string",
1731
- // },
1732
- // delimiter: {
1733
- // type: "string",
1734
- // },
1735
- // },
1736
- // required: ["text", "delimiter"],
1737
- // },
1738
- // output: {
1739
- // json_schema: {
1740
- // type: "array",
1741
- // items: {
1742
- // type: "string",
1743
- // },
1744
- // },
1745
- // },
1746
- // validator: (input) => {
1747
- // // validate here
1748
- // },
1749
- // },
1599
+ add_item_to_array: {
1600
+ kind: "expression",
1601
+ category: "arrays",
1602
+ name: "Add Item To Array",
1603
+ fields: {
1604
+ array: {
1605
+ node_options: ["get_defined", "empty_array_literal"],
1606
+ },
1607
+ value_to_add: {
1608
+ node_options: all_node_types,
1609
+ },
1610
+ where_to_add: {
1611
+ node_options: ["dropdown_literal"],
1612
+ forced_node: "dropdown_literal",
1613
+ dropdown_options: [
1614
+ { key: "start", name: "start" },
1615
+ { key: "end", name: "end" },
1616
+ ],
1617
+ dropdown_default: "end",
1618
+ },
1619
+ },
1620
+ postgres_type: "jsonb",
1621
+ node_structure: [
1622
+ [
1623
+ { ui_type: "text", value: "add" },
1624
+ { ui_type: "field", field: "value_to_add" },
1625
+ { ui_type: "text", value: "to" },
1626
+ { ui_type: "field", field: "array" },
1627
+ { ui_type: "text", value: "at" },
1628
+ { ui_type: "field", field: "where_to_add" },
1629
+ ],
1630
+ ],
1631
+ json_schema: {
1632
+ type: "object",
1633
+ properties: {
1634
+ array: {
1635
+ type: "array",
1636
+ items: {
1637
+ type: "any",
1638
+ },
1639
+ },
1640
+ value_to_add: node_json_schema,
1641
+ where_to_add: {
1642
+ type: "string",
1643
+ enum: ["start", "end"],
1644
+ default: "end",
1645
+ },
1646
+ },
1647
+ required: ["array", "value_to_add", "where_to_add"],
1648
+ },
1649
+ output: {
1650
+ json_schema: {
1651
+ type: "array",
1652
+ items: {
1653
+ type: "any",
1654
+ },
1655
+ },
1656
+ },
1657
+ validator: (input) => {
1658
+ // validate here
1659
+ },
1660
+ },
1750
1661
 
1751
- // concat_arrays: {
1752
- // kind: "expression",
1753
- // category: "arrays",
1754
- // name: "Concat Arrays",
1755
- // fields: {
1756
- // first_array: {
1757
- // node_options: [
1758
- // "get_defined",
1759
- // "concat_arrays",
1760
- // "add_item_to_array",
1761
- // "add_item_to_array_at_index",
1762
- // "remove_item_from_array",
1763
- // "remove_item_from_array_at_index",
1764
- // ],
1765
- // },
1766
- // second_array: {
1767
- // node_options: [
1768
- // "get_defined",
1769
- // "concat_arrays",
1770
- // "add_item_to_array",
1771
- // "add_item_to_array_at_index",
1772
- // "remove_item_from_array",
1773
- // "remove_item_from_array_at_index",
1774
- // ],
1775
- // },
1776
- // },
1777
- // postgres_type: "jsonb",
1778
- // node_structure: [
1779
- // [
1780
- // { ui_type: "text", value: "concat arrays" },
1781
- // { ui_type: "field", field: "first_array" },
1782
- // { ui_type: "text", value: "and" },
1783
- // { ui_type: "field", field: "second_array" },
1784
- // ],
1785
- // ],
1786
- // postgres_type: "jsonb",
1787
- // json_schema: {
1788
- // type: "object",
1789
- // properties: {
1790
- // first_array: {
1791
- // type: "array",
1792
- // items: {
1793
- // type: "any",
1794
- // },
1795
- // },
1796
- // second_array: {
1797
- // type: "array",
1798
- // items: {
1799
- // type: "any",
1800
- // },
1801
- // },
1802
- // },
1803
- // required: ["first_array", "second_array"],
1804
- // },
1805
- // output: {
1806
- // json_schema: {
1807
- // type: "array",
1808
- // items: {
1809
- // type: "any",
1810
- // },
1811
- // },
1812
- // },
1813
- // validator: (input) => {
1814
- // // validate here
1815
- // },
1816
- // },
1662
+ add_item_to_array_at_index: {
1663
+ kind: "expression",
1664
+ category: "arrays",
1665
+ name: "Add Item To Array At Index",
1666
+ fields: {
1667
+ array: {
1668
+ node_options: ["get_defined", "empty_array_literal"],
1669
+ },
1670
+ value_to_add: {
1671
+ node_options: all_node_types,
1672
+ },
1673
+ where_to_add: {
1674
+ node_options: ["get_defined", "int_literal"],
1675
+ },
1676
+ },
1677
+ node_structure: [
1678
+ [
1679
+ { ui_type: "text", value: "add" },
1680
+ { ui_type: "field", field: "value_to_add" },
1681
+ { ui_type: "text", value: "to" },
1682
+ { ui_type: "field", field: "array" },
1683
+ { ui_type: "text", value: "at index" },
1684
+ { ui_type: "field", field: "where_to_add" },
1685
+ ],
1686
+ ],
1687
+ postgres_type: "jsonb",
1688
+ json_schema: {
1689
+ type: "object",
1690
+ properties: {
1691
+ array: {
1692
+ type: "array",
1693
+ items: {
1694
+ type: "any",
1695
+ },
1696
+ },
1697
+ value_to_add: node_json_schema,
1698
+ where_to_add: {
1699
+ type: "number",
1700
+ },
1701
+ },
1702
+ required: ["array", "value_to_add", "where_to_add"],
1703
+ },
1704
+ output: {
1705
+ json_schema: {
1706
+ type: "array",
1707
+ items: {
1708
+ type: "any",
1709
+ },
1710
+ },
1711
+ },
1712
+ validator: (input) => {
1713
+ // validate here
1714
+ },
1715
+ },
1817
1716
 
1818
- // sort_array: {
1819
- // kind: "expression",
1820
- // category: "arrays",
1821
- // name: "Sort Array",
1822
- // fields: {
1823
- // array: {
1824
- // node_options: [
1825
- // "get_defined",
1826
- // "concat_arrays",
1827
- // "add_item_to_array",
1828
- // "add_item_to_array_at_index",
1829
- // "remove_item_from_array",
1830
- // "remove_item_from_array_at_index",
1831
- // ],
1832
- // },
1833
- // iter_item_a_identifier: {
1834
- // node_options: ["identifier_literal"],
1835
- // forced_node: "identifier_literal",
1836
- // },
1837
- // iter_item_b_identifier: {
1838
- // node_options: ["identifier_literal"],
1839
- // forced_node: "identifier_literal",
1840
- // },
1841
- // do: {
1842
- // node_options: ["stack_literal"],
1843
- // forced_node: "stack_literal",
1844
- // },
1845
- // },
1846
- // node_structure: [
1847
- // [
1848
- // { ui_type: "text", value: "sort array" },
1849
- // { ui_type: "field", field: "array" },
1850
- // { ui_type: "text", value: "with item identifiers" },
1851
- // { ui_type: "field", field: "iter_item_a_identifier" },
1852
- // { ui_type: "field", field: "iter_item_b_identifier" },
1853
- // ],
1854
- // { ui_type: "stack", field: "do" },
1855
- // ],
1856
- // postgres_type: "jsonb",
1857
- // json_schema: {
1858
- // type: "object",
1859
- // properties: {
1860
- // array: {
1861
- // type: "array",
1862
- // items: {
1863
- // type: "any",
1864
- // },
1865
- // },
1866
- // iter_item_a_identifier: {
1867
- // type: "string",
1868
- // },
1869
- // iter_item_b_identifier: {
1870
- // type: "string",
1871
- // },
1872
- // do: {
1873
- // type: "array",
1874
- // items: {
1875
- // type: "node",
1876
- // },
1877
- // },
1878
- // },
1879
- // required: ["array", "do"],
1880
- // },
1881
- // output: {
1882
- // json_schema: {
1883
- // type: "array",
1884
- // items: {
1885
- // type: "any",
1886
- // },
1887
- // },
1888
- // },
1889
- // validator: (input) => {
1890
- // // validate here
1891
- // },
1892
- // },
1717
+ remove_item_from_array: {
1718
+ kind: "expression",
1719
+ category: "arrays",
1720
+ name: "Remove Item From Array",
1721
+ fields: {
1722
+ array: {
1723
+ node_options: ["get_defined"],
1724
+ forced_node: "get_defined",
1725
+ },
1726
+ where_to_remove: {
1727
+ node_options: ["dropdown_literal"],
1728
+ forced_node: "dropdown_literal",
1729
+ dropdown_options: [
1730
+ { key: "start", name: "start" },
1731
+ { key: "end", name: "end" },
1732
+ ],
1733
+ dropdown_default: "end",
1734
+ },
1735
+ },
1736
+ postgres_type: "jsonb",
1737
+ node_structure: [
1738
+ [
1739
+ { ui_type: "text", value: "remove item from array" },
1740
+ { ui_type: "field", field: "array" },
1741
+ { ui_type: "text", value: "at" },
1742
+ { ui_type: "field", field: "where_to_remove" },
1743
+ ],
1744
+ ],
1745
+ json_schema: {
1746
+ type: "object",
1747
+ properties: {
1748
+ array: {
1749
+ type: "array",
1750
+ items: {
1751
+ type: "any",
1752
+ },
1753
+ },
1754
+ where_to_remove: {
1755
+ type: "string",
1756
+ enum: ["start", "end"],
1757
+ default: "end",
1758
+ },
1759
+ },
1760
+ required: ["array", "where_to_remove"],
1761
+ },
1762
+ output: {
1763
+ json_schema: {
1764
+ type: "array",
1765
+ items: {
1766
+ type: "any",
1767
+ },
1768
+ },
1769
+ },
1770
+ validator: (input) => {
1771
+ // validate here
1772
+ },
1773
+ },
1893
1774
 
1894
- // local_compare: {
1895
- // kind: "expression",
1896
- // category: "arrays",
1897
- // name: "Alphabetically Compare",
1898
- // fields: {
1899
- // a: {
1900
- // node_options: ["text_literal", "get_defined"],
1901
- // },
1902
- // b: {
1903
- // node_options: ["text_literal", "get_defined"],
1904
- // },
1905
- // },
1906
- // node_structure: [
1907
- // [
1908
- // { ui_type: "text", value: "alphabetically compare" },
1909
- // { ui_type: "field", field: "a" },
1910
- // { ui_type: "text", value: "to" },
1911
- // { ui_type: "field", field: "b" },
1912
- // ],
1913
- // ],
1914
- // postgres_type: "jsonb",
1915
- // json_schema: {
1916
- // type: "object",
1917
- // properties: {
1918
- // a: {
1919
- // type: "string",
1920
- // },
1921
- // b: {
1922
- // type: "string",
1923
- // },
1924
- // },
1925
- // required: ["a", "b"],
1926
- // },
1927
- // output: {
1928
- // json_schema: {
1929
- // type: "boolean",
1930
- // },
1931
- // },
1932
- // validator: (input) => {
1933
- // // validate here
1934
- // },
1935
- // },
1775
+ remove_item_from_array_at_index: {
1776
+ kind: "expression",
1777
+ category: "arrays",
1778
+ name: "Remove Item From Array At Index",
1779
+ fields: {
1780
+ array: {
1781
+ node_options: ["get_defined"],
1782
+ forced_node: "get_defined",
1783
+ },
1784
+ where_to_remove: {
1785
+ node_options: ["get_defined", "int_literal"],
1786
+ },
1787
+ },
1788
+ node_structure: [
1789
+ [
1790
+ { ui_type: "text", value: "remove item from array" },
1791
+ { ui_type: "field", field: "array" },
1792
+ { ui_type: "text", value: "at index" },
1793
+ { ui_type: "field", field: "where_to_remove" },
1794
+ ],
1795
+ ],
1796
+ postgres_type: "jsonb",
1797
+ json_schema: {
1798
+ type: "object",
1799
+ properties: {
1800
+ array: {
1801
+ type: "array",
1802
+ items: {
1803
+ type: "any",
1804
+ },
1805
+ },
1806
+ where_to_remove: {
1807
+ type: "number",
1808
+ },
1809
+ },
1810
+ required: ["array", "where_to_remove"],
1811
+ },
1812
+ output: {
1813
+ json_schema: {
1814
+ type: "array",
1815
+ items: {
1816
+ type: "any",
1817
+ },
1818
+ },
1819
+ },
1820
+ validator: (input) => {
1821
+ // validate here
1822
+ },
1823
+ },
1936
1824
 
1937
- // slice: {
1938
- // kind: "expression",
1939
- // category: "arrays",
1940
- // name: "Slice",
1941
- // fields: {
1942
- // value: {
1943
- // node_options: ["get_defined"],
1944
- // forced_node: "get_defined",
1945
- // },
1946
- // start_index: {
1947
- // node_options: ["int_literal", "get_defined"],
1948
- // },
1949
- // end_index: {
1950
- // node_options: ["int_literal", "get_defined"],
1951
- // },
1952
- // },
1953
- // node_structure: [
1954
- // [
1955
- // { ui_type: "text", value: "slice" },
1956
- // { ui_type: "field", field: "value" },
1957
- // { ui_type: "text", value: "from" },
1958
- // { ui_type: "field", field: "start_index" },
1959
- // { ui_type: "text", value: "to" },
1960
- // { ui_type: "field", field: "end_index" },
1961
- // ],
1962
- // ],
1963
- // postgres_type: "jsonb",
1964
- // json_schema: {
1965
- // type: "object",
1966
- // properties: {
1967
- // value: {
1968
- // type: ["array", "string"],
1969
- // },
1970
- // start_index: {
1971
- // type: "number",
1972
- // },
1973
- // end_index: {
1974
- // type: "number",
1975
- // },
1976
- // },
1977
- // required: ["value", "start_index", "end_index"],
1978
- // },
1979
- // output: {
1980
- // json_schema: {
1981
- // type: "array",
1982
- // items: {
1983
- // type: "any",
1984
- // },
1985
- // },
1986
- // },
1987
- // validator: (input) => {
1988
- // // validate here
1989
- // },
1990
- // },
1825
+ split_text: {
1826
+ kind: "expression",
1827
+ category: "arrays",
1828
+ name: "Split Text",
1829
+ fields: {
1830
+ text: {
1831
+ node_options: ["text_literal", "get_defined"],
1832
+ },
1833
+ delimiter: {
1834
+ node_options: ["text_literal", "get_defined"],
1835
+ },
1836
+ },
1837
+ node_structure: [
1838
+ [
1839
+ { ui_type: "text", value: "split text" },
1840
+ { ui_type: "field", field: "text" },
1841
+ { ui_type: "text", value: "to array at delimiter" },
1842
+ { ui_type: "field", field: "delimiter" },
1843
+ ],
1844
+ ],
1845
+ postgres_type: "jsonb",
1846
+ json_schema: {
1847
+ type: "object",
1848
+ properties: {
1849
+ text: {
1850
+ type: "string",
1851
+ },
1852
+ delimiter: {
1853
+ type: "string",
1854
+ },
1855
+ },
1856
+ required: ["text", "delimiter"],
1857
+ },
1858
+ output: {
1859
+ json_schema: {
1860
+ type: "array",
1861
+ items: {
1862
+ type: "string",
1863
+ },
1864
+ },
1865
+ },
1866
+ validator: (input) => {
1867
+ // validate here
1868
+ },
1869
+ },
1991
1870
 
1992
- // join_array_of_text_items: {
1993
- // kind: "expression",
1994
- // category: "arrays",
1995
- // name: "Join Array Of Text Items",
1996
- // fields: {
1997
- // array: {
1998
- // node_options: ["get_defined"],
1999
- // forced_node: "get_defined",
2000
- // },
2001
- // },
2002
- // node_structure: [
2003
- // [
2004
- // { ui_type: "text", value: "join array of text" },
2005
- // { ui_type: "field", field: "array" },
2006
- // ],
2007
- // ],
2008
- // postgres_type: "jsonb",
2009
- // json_schema: {
2010
- // type: "object",
2011
- // properties: {
2012
- // array: {
2013
- // type: "array",
2014
- // items: {
2015
- // type: "any",
2016
- // },
2017
- // },
2018
- // },
2019
- // required: ["array"],
2020
- // },
2021
- // output: {
2022
- // json_schema: {
2023
- // type: "string",
2024
- // },
2025
- // },
2026
- // validator: (input) => {
2027
- // // validate here
2028
- // },
2029
- // },
1871
+ concat_arrays: {
1872
+ kind: "expression",
1873
+ category: "arrays",
1874
+ name: "Concat Arrays",
1875
+ fields: {
1876
+ first_array: {
1877
+ node_options: [
1878
+ "get_defined",
1879
+ "concat_arrays",
1880
+ "add_item_to_array",
1881
+ "add_item_to_array_at_index",
1882
+ "remove_item_from_array",
1883
+ "remove_item_from_array_at_index",
1884
+ ],
1885
+ },
1886
+ second_array: {
1887
+ node_options: [
1888
+ "get_defined",
1889
+ "concat_arrays",
1890
+ "add_item_to_array",
1891
+ "add_item_to_array_at_index",
1892
+ "remove_item_from_array",
1893
+ "remove_item_from_array_at_index",
1894
+ ],
1895
+ },
1896
+ },
1897
+ postgres_type: "jsonb",
1898
+ node_structure: [
1899
+ [
1900
+ { ui_type: "text", value: "concat arrays" },
1901
+ { ui_type: "field", field: "first_array" },
1902
+ { ui_type: "text", value: "and" },
1903
+ { ui_type: "field", field: "second_array" },
1904
+ ],
1905
+ ],
1906
+ postgres_type: "jsonb",
1907
+ json_schema: {
1908
+ type: "object",
1909
+ properties: {
1910
+ first_array: {
1911
+ type: "array",
1912
+ items: {
1913
+ type: "any",
1914
+ },
1915
+ },
1916
+ second_array: {
1917
+ type: "array",
1918
+ items: {
1919
+ type: "any",
1920
+ },
1921
+ },
1922
+ },
1923
+ required: ["first_array", "second_array"],
1924
+ },
1925
+ output: {
1926
+ json_schema: {
1927
+ type: "array",
1928
+ items: {
1929
+ type: "any",
1930
+ },
1931
+ },
1932
+ },
1933
+ validator: (input) => {
1934
+ // validate here
1935
+ },
1936
+ },
1937
+
1938
+ sort_array: {
1939
+ kind: "expression",
1940
+ category: "arrays",
1941
+ name: "Sort Array",
1942
+ fields: {
1943
+ array: {
1944
+ node_options: [
1945
+ "get_defined",
1946
+ "concat_arrays",
1947
+ "add_item_to_array",
1948
+ "add_item_to_array_at_index",
1949
+ "remove_item_from_array",
1950
+ "remove_item_from_array_at_index",
1951
+ ],
1952
+ },
1953
+ iter_item_a_identifier: {
1954
+ node_options: ["identifier_literal"],
1955
+ forced_node: "identifier_literal",
1956
+ },
1957
+ iter_item_b_identifier: {
1958
+ node_options: ["identifier_literal"],
1959
+ forced_node: "identifier_literal",
1960
+ },
1961
+ do: {
1962
+ node_options: ["stack_literal"],
1963
+ forced_node: "stack_literal",
1964
+ },
1965
+ },
1966
+ node_structure: [
1967
+ [
1968
+ { ui_type: "text", value: "sort array" },
1969
+ { ui_type: "field", field: "array" },
1970
+ { ui_type: "text", value: "with item identifiers" },
1971
+ { ui_type: "field", field: "iter_item_a_identifier" },
1972
+ { ui_type: "field", field: "iter_item_b_identifier" },
1973
+ ],
1974
+ { ui_type: "stack", field: "do" },
1975
+ ],
1976
+ postgres_type: "jsonb",
1977
+ json_schema: {
1978
+ type: "object",
1979
+ properties: {
1980
+ array: {
1981
+ type: "array",
1982
+ items: {
1983
+ type: "any",
1984
+ },
1985
+ },
1986
+ iter_item_a_identifier: {
1987
+ type: "string",
1988
+ },
1989
+ iter_item_b_identifier: {
1990
+ type: "string",
1991
+ },
1992
+ do: {
1993
+ type: "array",
1994
+ items: {
1995
+ type: "node",
1996
+ },
1997
+ },
1998
+ },
1999
+ required: ["array", "do"],
2000
+ },
2001
+ output: {
2002
+ json_schema: {
2003
+ type: "array",
2004
+ items: {
2005
+ type: "any",
2006
+ },
2007
+ },
2008
+ },
2009
+ validator: (input) => {
2010
+ // validate here
2011
+ },
2012
+ },
2013
+
2014
+ local_compare: {
2015
+ kind: "expression",
2016
+ category: "arrays",
2017
+ name: "Alphabetically Compare",
2018
+ fields: {
2019
+ a: {
2020
+ node_options: ["text_literal", "get_defined"],
2021
+ },
2022
+ b: {
2023
+ node_options: ["text_literal", "get_defined"],
2024
+ },
2025
+ },
2026
+ node_structure: [
2027
+ [
2028
+ { ui_type: "text", value: "alphabetically compare" },
2029
+ { ui_type: "field", field: "a" },
2030
+ { ui_type: "text", value: "to" },
2031
+ { ui_type: "field", field: "b" },
2032
+ ],
2033
+ ],
2034
+ postgres_type: "jsonb",
2035
+ json_schema: {
2036
+ type: "object",
2037
+ properties: {
2038
+ a: {
2039
+ type: "string",
2040
+ },
2041
+ b: {
2042
+ type: "string",
2043
+ },
2044
+ },
2045
+ required: ["a", "b"],
2046
+ },
2047
+ output: {
2048
+ json_schema: {
2049
+ type: "boolean",
2050
+ },
2051
+ },
2052
+ validator: (input) => {
2053
+ // validate here
2054
+ },
2055
+ },
2056
+
2057
+ slice: {
2058
+ kind: "expression",
2059
+ category: "arrays",
2060
+ name: "Slice",
2061
+ fields: {
2062
+ value: {
2063
+ node_options: ["get_defined"],
2064
+ forced_node: "get_defined",
2065
+ },
2066
+ start_index: {
2067
+ node_options: ["int_literal", "get_defined"],
2068
+ },
2069
+ end_index: {
2070
+ node_options: ["int_literal", "get_defined"],
2071
+ },
2072
+ },
2073
+ node_structure: [
2074
+ [
2075
+ { ui_type: "text", value: "slice" },
2076
+ { ui_type: "field", field: "value" },
2077
+ { ui_type: "text", value: "from" },
2078
+ { ui_type: "field", field: "start_index" },
2079
+ { ui_type: "text", value: "to" },
2080
+ { ui_type: "field", field: "end_index" },
2081
+ ],
2082
+ ],
2083
+ postgres_type: "jsonb",
2084
+ json_schema: {
2085
+ type: "object",
2086
+ properties: {
2087
+ value: {
2088
+ type: ["array", "string"],
2089
+ },
2090
+ start_index: {
2091
+ type: "number",
2092
+ },
2093
+ end_index: {
2094
+ type: "number",
2095
+ },
2096
+ },
2097
+ required: ["value", "start_index", "end_index"],
2098
+ },
2099
+ output: {
2100
+ json_schema: {
2101
+ type: "array",
2102
+ items: {
2103
+ type: "any",
2104
+ },
2105
+ },
2106
+ },
2107
+ validator: (input) => {
2108
+ // validate here
2109
+ },
2110
+ },
2111
+
2112
+ join_array_of_text_items: {
2113
+ kind: "expression",
2114
+ category: "arrays",
2115
+ name: "Join Array Of Text Items",
2116
+ fields: {
2117
+ array: {
2118
+ node_options: ["get_defined"],
2119
+ forced_node: "get_defined",
2120
+ },
2121
+ },
2122
+ node_structure: [
2123
+ [
2124
+ { ui_type: "text", value: "join array of text" },
2125
+ { ui_type: "field", field: "array" },
2126
+ ],
2127
+ ],
2128
+ postgres_type: "jsonb",
2129
+ json_schema: {
2130
+ type: "object",
2131
+ properties: {
2132
+ array: {
2133
+ type: "array",
2134
+ items: {
2135
+ type: "any",
2136
+ },
2137
+ },
2138
+ },
2139
+ required: ["array"],
2140
+ },
2141
+ output: {
2142
+ json_schema: {
2143
+ type: "string",
2144
+ },
2145
+ },
2146
+ validator: (input) => {
2147
+ // validate here
2148
+ },
2149
+ },
2030
2150
 
2031
- // reverse_array: {
2032
- // kind: "expression",
2033
- // category: "arrays",
2034
- // name: "Reverse Array",
2035
- // fields: {
2036
- // array: {
2037
- // node_options: ["get_defined"],
2038
- // forced_node: "get_defined",
2039
- // },
2040
- // },
2041
- // node_structure: [
2042
- // [
2043
- // { ui_type: "text", value: "reverse array" },
2044
- // { ui_type: "field", field: "array" },
2045
- // ],
2046
- // ],
2047
- // postgres_type: "jsonb",
2048
- // json_schema: {
2049
- // type: "object",
2050
- // properties: {
2051
- // array: {
2052
- // type: "array",
2053
- // items: {
2054
- // type: "any",
2055
- // },
2056
- // },
2057
- // },
2058
- // required: ["array"],
2059
- // },
2060
- // output: {
2061
- // json_schema: {
2062
- // type: "array",
2063
- // items: {
2064
- // type: "any",
2065
- // },
2066
- // },
2067
- // },
2068
- // validator: (input) => {
2069
- // // validate here
2070
- // },
2071
- // },
2151
+ reverse_array: {
2152
+ kind: "expression",
2153
+ category: "arrays",
2154
+ name: "Reverse Array",
2155
+ fields: {
2156
+ array: {
2157
+ node_options: ["get_defined"],
2158
+ forced_node: "get_defined",
2159
+ },
2160
+ },
2161
+ node_structure: [
2162
+ [
2163
+ { ui_type: "text", value: "reverse array" },
2164
+ { ui_type: "field", field: "array" },
2165
+ ],
2166
+ ],
2167
+ postgres_type: "jsonb",
2168
+ json_schema: {
2169
+ type: "object",
2170
+ properties: {
2171
+ array: {
2172
+ type: "array",
2173
+ items: {
2174
+ type: "any",
2175
+ },
2176
+ },
2177
+ },
2178
+ required: ["array"],
2179
+ },
2180
+ output: {
2181
+ json_schema: {
2182
+ type: "array",
2183
+ items: {
2184
+ type: "any",
2185
+ },
2186
+ },
2187
+ },
2188
+ validator: (input) => {
2189
+ // validate here
2190
+ },
2191
+ },
2072
2192
 
2073
- // average_of_number_array: {
2074
- // kind: "expression",
2075
- // category: "arrays",
2076
- // name: "Average Of Number Array",
2077
- // fields: {
2078
- // array: {
2079
- // node_options: ["get_defined"],
2080
- // forced_node: "get_defined",
2081
- // },
2082
- // },
2083
- // node_structure: [
2084
- // [
2085
- // { ui_type: "text", value: "average of numbers in" },
2086
- // { ui_type: "field", field: "array" },
2087
- // ],
2088
- // ],
2089
- // postgres_type: "jsonb",
2090
- // json_schema: {
2091
- // type: "object",
2092
- // properties: {
2093
- // array: {
2094
- // type: "array",
2095
- // items: {
2096
- // type: "number",
2097
- // },
2098
- // },
2099
- // },
2100
- // required: ["array"],
2101
- // },
2102
- // output: {
2103
- // json_schema: {
2104
- // type: "number",
2105
- // },
2106
- // },
2107
- // validator: (input) => {
2108
- // // validate here
2109
- // },
2110
- // },
2193
+ average_of_number_array: {
2194
+ kind: "expression",
2195
+ category: "arrays",
2196
+ name: "Average Of Number Array",
2197
+ fields: {
2198
+ array: {
2199
+ node_options: ["get_defined"],
2200
+ forced_node: "get_defined",
2201
+ },
2202
+ },
2203
+ node_structure: [
2204
+ [
2205
+ { ui_type: "text", value: "average of numbers in" },
2206
+ { ui_type: "field", field: "array" },
2207
+ ],
2208
+ ],
2209
+ postgres_type: "jsonb",
2210
+ json_schema: {
2211
+ type: "object",
2212
+ properties: {
2213
+ array: {
2214
+ type: "array",
2215
+ items: {
2216
+ type: "number",
2217
+ },
2218
+ },
2219
+ },
2220
+ required: ["array"],
2221
+ },
2222
+ output: {
2223
+ json_schema: {
2224
+ type: "number",
2225
+ },
2226
+ },
2227
+ validator: (input) => {
2228
+ // validate here
2229
+ },
2230
+ },
2111
2231
 
2112
- // sum_of_number_array: {
2113
- // kind: "expression",
2114
- // category: "arrays",
2115
- // name: "Sum Of Number Array",
2116
- // fields: {
2117
- // array: {
2118
- // node_options: ["get_defined"],
2119
- // forced_node: "get_defined",
2120
- // },
2121
- // },
2122
- // node_structure: [
2123
- // [
2124
- // { ui_type: "text", value: "sum of numbers in" },
2125
- // { ui_type: "field", field: "array" },
2126
- // ],
2127
- // ],
2128
- // postgres_type: "jsonb",
2129
- // json_schema: {
2130
- // type: "object",
2131
- // properties: {
2132
- // array: {
2133
- // type: "array",
2134
- // items: {
2135
- // type: "number",
2136
- // },
2137
- // },
2138
- // },
2139
- // required: ["array"],
2140
- // },
2141
- // output: {
2142
- // json_schema: {
2143
- // type: "number",
2144
- // },
2145
- // },
2146
- // validator: (input) => {
2147
- // // validate here
2148
- // },
2149
- // },
2232
+ sum_of_number_array: {
2233
+ kind: "expression",
2234
+ category: "arrays",
2235
+ name: "Sum Of Number Array",
2236
+ fields: {
2237
+ array: {
2238
+ node_options: ["get_defined"],
2239
+ forced_node: "get_defined",
2240
+ },
2241
+ },
2242
+ node_structure: [
2243
+ [
2244
+ { ui_type: "text", value: "sum of numbers in" },
2245
+ { ui_type: "field", field: "array" },
2246
+ ],
2247
+ ],
2248
+ postgres_type: "jsonb",
2249
+ json_schema: {
2250
+ type: "object",
2251
+ properties: {
2252
+ array: {
2253
+ type: "array",
2254
+ items: {
2255
+ type: "number",
2256
+ },
2257
+ },
2258
+ },
2259
+ required: ["array"],
2260
+ },
2261
+ output: {
2262
+ json_schema: {
2263
+ type: "number",
2264
+ },
2265
+ },
2266
+ validator: (input) => {
2267
+ // validate here
2268
+ },
2269
+ },
2150
2270
 
2151
- // trim_text: {
2152
- // kind: "expression",
2153
- // category: "operation",
2154
- // name: "Trim Text",
2155
- // fields: {
2156
- // text: {
2157
- // node_options: ["get_defined"],
2158
- // forced_node: "get_defined",
2159
- // },
2160
- // },
2161
- // node_structure: [
2162
- // [
2163
- // { ui_type: "text", value: "trim" },
2164
- // { ui_type: "field", field: "text" },
2165
- // ],
2166
- // ],
2167
- // postgres_type: "jsonb",
2168
- // json_schema: {
2169
- // type: "object",
2170
- // properties: {
2171
- // text: {
2172
- // type: "string",
2173
- // },
2174
- // },
2175
- // required: ["text"],
2176
- // },
2177
- // output: {
2178
- // json_schema: {
2179
- // type: "string",
2180
- // },
2181
- // },
2182
- // validator: (input) => {
2183
- // // validate here
2184
- // },
2185
- // },
2271
+ trim_text: {
2272
+ kind: "expression",
2273
+ category: "operation",
2274
+ name: "Trim Text",
2275
+ fields: {
2276
+ text: {
2277
+ node_options: ["get_defined"],
2278
+ forced_node: "get_defined",
2279
+ },
2280
+ },
2281
+ node_structure: [
2282
+ [
2283
+ { ui_type: "text", value: "trim" },
2284
+ { ui_type: "field", field: "text" },
2285
+ ],
2286
+ ],
2287
+ postgres_type: "jsonb",
2288
+ json_schema: {
2289
+ type: "object",
2290
+ properties: {
2291
+ text: {
2292
+ type: "string",
2293
+ },
2294
+ },
2295
+ required: ["text"],
2296
+ },
2297
+ output: {
2298
+ json_schema: {
2299
+ type: "string",
2300
+ },
2301
+ },
2302
+ validator: (input) => {
2303
+ // validate here
2304
+ },
2305
+ },
2186
2306
 
2187
- // replace_text: {
2188
- // kind: "expression",
2189
- // category: "operation",
2190
- // name: "Replace Text",
2191
- // fields: {
2192
- // base_text: {
2193
- // node_options: ["text_literal", "get_defined"],
2194
- // },
2195
- // text_to_replace: {
2196
- // node_options: ["text_literal", "get_defined"],
2197
- // },
2198
- // replacement_text: {
2199
- // node_options: ["text_literal", "get_defined"],
2200
- // },
2201
- // },
2202
- // node_structure: [
2203
- // [
2204
- // { ui_type: "text", value: "from base text" },
2205
- // { ui_type: "field", field: "base_text" },
2206
- // { ui_type: "text", value: "replace" },
2207
- // { ui_type: "field", field: "text_to_replace" },
2208
- // { ui_type: "text", value: "with" },
2209
- // { ui_type: "field", field: "replacement_text" },
2210
- // ],
2211
- // ],
2212
- // postgres_type: "jsonb",
2213
- // json_schema: {
2214
- // type: "object",
2215
- // properties: {
2216
- // base_text: {
2217
- // type: "string",
2218
- // },
2219
- // text_to_replace: {
2220
- // type: "string",
2221
- // },
2222
- // replacement_text: {
2223
- // type: "string",
2224
- // },
2225
- // },
2226
- // required: ["base_text", "text_to_replace", "replacement_text"],
2227
- // },
2228
- // output: {
2229
- // json_schema: {
2230
- // type: "string",
2231
- // },
2232
- // },
2233
- // validator: (input) => {
2234
- // // validate here
2235
- // },
2236
- // },
2307
+ replace_text: {
2308
+ kind: "expression",
2309
+ category: "operation",
2310
+ name: "Replace Text",
2311
+ fields: {
2312
+ base_text: {
2313
+ node_options: ["text_literal", "get_defined"],
2314
+ },
2315
+ text_to_replace: {
2316
+ node_options: ["text_literal", "get_defined"],
2317
+ },
2318
+ replacement_text: {
2319
+ node_options: ["text_literal", "get_defined"],
2320
+ },
2321
+ },
2322
+ node_structure: [
2323
+ [
2324
+ { ui_type: "text", value: "from base text" },
2325
+ { ui_type: "field", field: "base_text" },
2326
+ { ui_type: "text", value: "replace" },
2327
+ { ui_type: "field", field: "text_to_replace" },
2328
+ { ui_type: "text", value: "with" },
2329
+ { ui_type: "field", field: "replacement_text" },
2330
+ ],
2331
+ ],
2332
+ postgres_type: "jsonb",
2333
+ json_schema: {
2334
+ type: "object",
2335
+ properties: {
2336
+ base_text: {
2337
+ type: "string",
2338
+ },
2339
+ text_to_replace: {
2340
+ type: "string",
2341
+ },
2342
+ replacement_text: {
2343
+ type: "string",
2344
+ },
2345
+ },
2346
+ required: ["base_text", "text_to_replace", "replacement_text"],
2347
+ },
2348
+ output: {
2349
+ json_schema: {
2350
+ type: "string",
2351
+ },
2352
+ },
2353
+ validator: (input) => {
2354
+ // validate here
2355
+ },
2356
+ },
2237
2357
 
2238
- // compare_numbers: {
2239
- // kind: "expression",
2240
- // category: "compare",
2241
- // name: "Compare Numbers",
2242
- // fields: {
2243
- // a: {
2244
- // node_options: [
2245
- // "get_defined",
2246
- // "arithmetic_binary_operation",
2247
- // "round",
2248
- // "parse",
2249
- // "get_length",
2250
- // "int_literal",
2251
- // "bigint_literal",
2252
- // "float_literal",
2253
- // ],
2254
- // },
2255
- // b: {
2256
- // node_options: [
2257
- // "get_defined",
2258
- // "arithmetic_binary_operation",
2259
- // "round",
2260
- // "parse",
2261
- // "get_length",
2262
- // "int_literal",
2263
- // "bigint_literal",
2264
- // "float_literal",
2265
- // ],
2266
- // },
2267
- // operator: {
2268
- // node_options: ["dropdown_literal"],
2269
- // forced_node: "dropdown_literal",
2270
- // dropdown_options: [
2271
- // { key: "less_than", name: "less than (<)" },
2272
- // { key: "less_than_or_equal", name: "less than or equal to (<=)" },
2273
- // { key: "greater_than", name: "greater than (>)" },
2274
- // { key: "greater_than_or_equal", name: "greater than or equal to (>=)" },
2275
- // { key: "equal_to", name: "equals (==)" },
2276
- // { key: "not_equal_to", name: "not equal to (!=)" },
2277
- // ],
2278
- // dropdown_default: "less_than",
2279
- // },
2280
- // },
2281
- // node_structure: [
2282
- // [
2283
- // { ui_type: "field", field: "a" },
2284
- // { ui_type: "field", field: "operator" },
2285
- // { ui_type: "field", field: "b" },
2286
- // ],
2287
- // ],
2288
- // postgres_type: "jsonb",
2289
- // json_schema: {
2290
- // type: "object",
2291
- // properties: {
2292
- // a: {
2293
- // type: "number",
2294
- // },
2295
- // b: {
2296
- // type: "number",
2297
- // },
2298
- // operator: {
2299
- // type: "string",
2300
- // enum: [
2301
- // "less_than",
2302
- // "less_than_or_equal",
2303
- // "greater_than",
2304
- // "greater_than_or_equal",
2305
- // "equal_to",
2306
- // "not_equal_to",
2307
- // ],
2308
- // default: "less_than",
2309
- // },
2310
- // },
2311
- // required: ["a", "b", "operator"],
2312
- // },
2313
- // output: {
2314
- // json_schema: {
2315
- // type: "boolean",
2316
- // },
2317
- // },
2318
- // validator: (input) => {
2319
- // // validate here
2320
- // },
2321
- // },
2358
+ compare_numbers: {
2359
+ kind: "expression",
2360
+ category: "compare",
2361
+ name: "Compare Numbers",
2362
+ fields: {
2363
+ a: {
2364
+ node_options: [
2365
+ "get_defined",
2366
+ "arithmetic_binary_operation",
2367
+ "round",
2368
+ "parse",
2369
+ "get_length",
2370
+ "int_literal",
2371
+ "bigint_literal",
2372
+ "float_literal",
2373
+ ],
2374
+ },
2375
+ b: {
2376
+ node_options: [
2377
+ "get_defined",
2378
+ "arithmetic_binary_operation",
2379
+ "round",
2380
+ "parse",
2381
+ "get_length",
2382
+ "int_literal",
2383
+ "bigint_literal",
2384
+ "float_literal",
2385
+ ],
2386
+ },
2387
+ operator: {
2388
+ node_options: ["dropdown_literal"],
2389
+ forced_node: "dropdown_literal",
2390
+ dropdown_options: [
2391
+ { key: "less_than", name: "less than (<)" },
2392
+ { key: "less_than_or_equal", name: "less than or equal to (<=)" },
2393
+ { key: "greater_than", name: "greater than (>)" },
2394
+ { key: "greater_than_or_equal", name: "greater than or equal to (>=)" },
2395
+ { key: "equal_to", name: "equals (==)" },
2396
+ { key: "not_equal_to", name: "not equal to (!=)" },
2397
+ ],
2398
+ dropdown_default: "less_than",
2399
+ },
2400
+ },
2401
+ node_structure: [
2402
+ [
2403
+ { ui_type: "field", field: "a" },
2404
+ { ui_type: "field", field: "operator" },
2405
+ { ui_type: "field", field: "b" },
2406
+ ],
2407
+ ],
2408
+ postgres_type: "jsonb",
2409
+ json_schema: {
2410
+ type: "object",
2411
+ properties: {
2412
+ a: {
2413
+ type: "number",
2414
+ },
2415
+ b: {
2416
+ type: "number",
2417
+ },
2418
+ operator: {
2419
+ type: "string",
2420
+ enum: [
2421
+ "less_than",
2422
+ "less_than_or_equal",
2423
+ "greater_than",
2424
+ "greater_than_or_equal",
2425
+ "equal_to",
2426
+ "not_equal_to",
2427
+ ],
2428
+ default: "less_than",
2429
+ },
2430
+ },
2431
+ required: ["a", "b", "operator"],
2432
+ },
2433
+ output: {
2434
+ json_schema: {
2435
+ type: "boolean",
2436
+ },
2437
+ },
2438
+ validator: (input) => {
2439
+ // validate here
2440
+ },
2441
+ },
2322
2442
 
2323
- // compare_text: {
2324
- // kind: "expression",
2325
- // category: "compare",
2326
- // name: "Compare Text",
2327
- // fields: {
2328
- // a: {
2329
- // node_options: ["get_defined", "text_literal"],
2330
- // },
2331
- // b: {
2332
- // node_options: ["get_defined", "text_literal"],
2333
- // },
2334
- // operator: {
2335
- // node_options: ["dropdown_literal"],
2336
- // forced_node: "dropdown_literal",
2337
- // dropdown_options: [
2338
- // { key: "equal_to", name: "equals (==)" },
2339
- // { key: "not_equal_to", name: "not equal to (!=)" },
2340
- // { key: "contains", name: "contains" },
2341
- // { key: "does_not_contain", name: "does not contain" },
2342
- // { key: "starts_with", name: "starts with" },
2343
- // { key: "ends_with", name: "ends with" },
2344
- // ],
2345
- // dropdown_default: "starts_with",
2346
- // },
2347
- // },
2348
- // node_structure: [
2349
- // [
2350
- // { ui_type: "field", field: "a" },
2351
- // { ui_type: "field", field: "operator" },
2352
- // { ui_type: "field", field: "b" },
2353
- // ],
2354
- // ],
2355
- // postgres_type: "jsonb",
2356
- // json_schema: {
2357
- // type: "object",
2358
- // properties: {
2359
- // a: {
2360
- // type: "text",
2361
- // },
2362
- // b: {
2363
- // type: "text",
2364
- // },
2365
- // operator: {
2366
- // type: "string",
2367
- // enum: ["equal_to", "not_equal_to", "contains", "does_not_contain", "starts_with", "ends_with"],
2368
- // default: "starts_with",
2369
- // },
2370
- // },
2371
- // required: ["a", "b", "operator"],
2372
- // },
2373
- // output: {
2374
- // json_schema: {
2375
- // type: "boolean",
2376
- // },
2377
- // },
2378
- // validator: (input) => {
2379
- // // validate here
2380
- // },
2381
- // },
2443
+ compare_text: {
2444
+ kind: "expression",
2445
+ category: "compare",
2446
+ name: "Compare Text",
2447
+ fields: {
2448
+ a: {
2449
+ node_options: ["get_defined", "text_literal"],
2450
+ },
2451
+ b: {
2452
+ node_options: ["get_defined", "text_literal"],
2453
+ },
2454
+ operator: {
2455
+ node_options: ["dropdown_literal"],
2456
+ forced_node: "dropdown_literal",
2457
+ dropdown_options: [
2458
+ { key: "equal_to", name: "equals (==)" },
2459
+ { key: "not_equal_to", name: "not equal to (!=)" },
2460
+ { key: "contains", name: "contains" },
2461
+ { key: "does_not_contain", name: "does not contain" },
2462
+ { key: "starts_with", name: "starts with" },
2463
+ { key: "ends_with", name: "ends with" },
2464
+ ],
2465
+ dropdown_default: "starts_with",
2466
+ },
2467
+ },
2468
+ node_structure: [
2469
+ [
2470
+ { ui_type: "field", field: "a" },
2471
+ { ui_type: "field", field: "operator" },
2472
+ { ui_type: "field", field: "b" },
2473
+ ],
2474
+ ],
2475
+ postgres_type: "jsonb",
2476
+ json_schema: {
2477
+ type: "object",
2478
+ properties: {
2479
+ a: {
2480
+ type: "text",
2481
+ },
2482
+ b: {
2483
+ type: "text",
2484
+ },
2485
+ operator: {
2486
+ type: "string",
2487
+ enum: ["equal_to", "not_equal_to", "contains", "does_not_contain", "starts_with", "ends_with"],
2488
+ default: "starts_with",
2489
+ },
2490
+ },
2491
+ required: ["a", "b", "operator"],
2492
+ },
2493
+ output: {
2494
+ json_schema: {
2495
+ type: "boolean",
2496
+ },
2497
+ },
2498
+ validator: (input) => {
2499
+ // validate here
2500
+ },
2501
+ },
2382
2502
 
2383
- // get_length: {
2384
- // kind: "expression",
2385
- // category: "math",
2386
- // name: "Get Length",
2387
- // fields: {
2388
- // value: {
2389
- // node_options: ["get_defined", "text_literal"], // array types
2390
- // },
2391
- // },
2392
- // node_structure: [
2393
- // [
2394
- // { ui_type: "text", value: "length of" },
2395
- // { ui_type: "field", field: "value" },
2396
- // ],
2397
- // ],
2398
- // postgres_type: "jsonb",
2399
- // json_schema: {
2400
- // type: "object",
2401
- // properties: {
2402
- // value: {
2403
- // type: ["array", "object", "text"],
2404
- // },
2405
- // },
2406
- // required: ["value"],
2407
- // },
2408
- // output: {
2409
- // json_schema: {
2410
- // type: "number",
2411
- // },
2412
- // },
2413
- // validator: (input) => {
2414
- // // validate here
2415
- // },
2416
- // },
2503
+ get_length: {
2504
+ kind: "expression",
2505
+ category: "math",
2506
+ name: "Get Length",
2507
+ fields: {
2508
+ value: {
2509
+ node_options: ["get_defined", "text_literal"], // array types
2510
+ },
2511
+ },
2512
+ node_structure: [
2513
+ [
2514
+ { ui_type: "text", value: "length of" },
2515
+ { ui_type: "field", field: "value" },
2516
+ ],
2517
+ ],
2518
+ postgres_type: "jsonb",
2519
+ json_schema: {
2520
+ type: "object",
2521
+ properties: {
2522
+ value: {
2523
+ type: ["array", "object", "text"],
2524
+ },
2525
+ },
2526
+ required: ["value"],
2527
+ },
2528
+ output: {
2529
+ json_schema: {
2530
+ type: "number",
2531
+ },
2532
+ },
2533
+ validator: (input) => {
2534
+ // validate here
2535
+ },
2536
+ },
2417
2537
 
2418
- // object_expression: {
2419
- // kind: "expression",
2420
- // category: "variables",
2421
- // name: "Object Expression",
2422
- // fields: {
2423
- // value: {
2424
- // node_options: ["object_builder"],
2425
- // forced_node: "object_builder",
2426
- // },
2427
- // },
2428
- // node_structure: [
2429
- // [{ ui_type: "text", value: "build object" }, { ui_type: "br" }, { ui_type: "field", field: "value" }],
2430
- // ],
2431
- // postgres_type: "jsonb",
2432
- // json_schema: {
2433
- // type: "array",
2434
- // items: {
2435
- // type: "object",
2436
- // properties: {
2437
- // key: {
2438
- // type: "string",
2439
- // node_options: ["text_literal", "get_defined"],
2440
- // },
2441
- // value: {
2442
- // type: "any",
2443
- // node_options: [...value_node_types],
2444
- // },
2445
- // },
2446
- // },
2447
- // },
2448
- // output: {
2449
- // json_schema: {
2450
- // type: "object",
2451
- // },
2452
- // },
2453
- // validator: (input) => {
2454
- // // validate here
2455
- // },
2456
- // },
2538
+ object_expression: {
2539
+ kind: "expression",
2540
+ category: "variables",
2541
+ name: "Object Expression",
2542
+ fields: {
2543
+ value: {
2544
+ node_options: ["object_builder"],
2545
+ forced_node: "object_builder",
2546
+ },
2547
+ },
2548
+ node_structure: [
2549
+ [{ ui_type: "text", value: "build object" }, { ui_type: "br" }, { ui_type: "field", field: "value" }],
2550
+ ],
2551
+ postgres_type: "jsonb",
2552
+ json_schema: {
2553
+ type: "array",
2554
+ items: {
2555
+ type: "object",
2556
+ properties: {
2557
+ key: {
2558
+ type: "string",
2559
+ node_options: ["text_literal", "get_defined"],
2560
+ },
2561
+ value: {
2562
+ type: "any",
2563
+ node_options: [...value_node_types],
2564
+ },
2565
+ },
2566
+ },
2567
+ },
2568
+ output: {
2569
+ json_schema: {
2570
+ type: "object",
2571
+ },
2572
+ },
2573
+ validator: (input) => {
2574
+ // validate here
2575
+ },
2576
+ },
2457
2577
 
2458
- // call_endpoint: {
2459
- // kind: "expression",
2460
- // category: "actions",
2461
- // name: "Call Endpoint",
2462
- // fields: {
2463
- // endpoint: {
2464
- // node_options: ["get_defined", "text_literal"],
2465
- // },
2466
- // headers: {
2467
- // node_options: ["object_literal", "get_defined"],
2468
- // },
2469
- // body: {
2470
- // node_options: ["object_literal", "get_defined"],
2471
- // },
2472
- // },
2473
- // node_structure: [
2474
- // [
2475
- // { ui_type: "text", value: "call endpoint" },
2476
- // { ui_type: "br" },
2477
- // { ui_type: "field", field: "endpoint" },
2478
- // { ui_type: "br" },
2479
- // { ui_type: "text", value: "with headers" },
2480
- // { ui_type: "br" },
2481
- // { ui_type: "field", field: "headers" },
2482
- // { ui_type: "br" },
2483
- // { ui_type: "text", value: "and body" },
2484
- // { ui_type: "br" },
2485
- // { ui_type: "field", field: "body" },
2486
- // ],
2487
- // ],
2488
- // postgres_type: "jsonb",
2489
- // json_schema: {
2490
- // type: "object",
2491
- // properties: {
2492
- // endpoint: { type: "string" },
2493
- // headers: { type: "object" },
2494
- // body: { type: "object" },
2495
- // },
2496
- // required: ["endpoint"],
2497
- // },
2498
- // output: {
2499
- // json_schema: {
2500
- // type: "object",
2501
- // },
2502
- // },
2503
- // validator: (input) => {
2504
- // // validate here
2505
- // },
2506
- // },
2578
+ call_endpoint: {
2579
+ kind: "expression",
2580
+ category: "actions",
2581
+ name: "Call Endpoint",
2582
+ fields: {
2583
+ endpoint: {
2584
+ node_options: ["get_defined", "text_literal"],
2585
+ },
2586
+ headers: {
2587
+ node_options: ["object_literal", "get_defined"],
2588
+ },
2589
+ body: {
2590
+ node_options: ["object_literal", "get_defined"],
2591
+ },
2592
+ },
2593
+ node_structure: [
2594
+ [
2595
+ { ui_type: "text", value: "call endpoint" },
2596
+ { ui_type: "br" },
2597
+ { ui_type: "field", field: "endpoint" },
2598
+ { ui_type: "br" },
2599
+ { ui_type: "text", value: "with headers" },
2600
+ { ui_type: "br" },
2601
+ { ui_type: "field", field: "headers" },
2602
+ { ui_type: "br" },
2603
+ { ui_type: "text", value: "and body" },
2604
+ { ui_type: "br" },
2605
+ { ui_type: "field", field: "body" },
2606
+ ],
2607
+ ],
2608
+ postgres_type: "jsonb",
2609
+ json_schema: {
2610
+ type: "object",
2611
+ properties: {
2612
+ endpoint: { type: "string" },
2613
+ headers: { type: "object" },
2614
+ body: { type: "object" },
2615
+ },
2616
+ required: ["endpoint"],
2617
+ },
2618
+ output: {
2619
+ json_schema: {
2620
+ type: "object",
2621
+ },
2622
+ },
2623
+ validator: (input) => {
2624
+ // validate here
2625
+ },
2626
+ },
2507
2627
 
2508
- // cron_job: {
2509
- // kind: "expression",
2510
- // category: "triggers",
2511
- // name: "Cron Job",
2512
- // fields: {
2513
- // cron: {
2514
- // node_options: ["cron_literal"],
2515
- // forced_node: "cron_literal",
2516
- // },
2517
- // do: {
2518
- // node_options: ["stack_literal"],
2519
- // forced_node: "stack_literal",
2520
- // },
2521
- // },
2522
- // node_structure: [
2523
- // [
2524
- // { ui_type: "text", value: "cron" },
2525
- // { ui_type: "field", field: "cron" },
2526
- // ],
2527
- // { ui_type: "stack", field: "do" },
2528
- // ],
2529
- // postgres_type: "jsonb",
2530
- // json_schema: {
2531
- // type: "object",
2532
- // properties: {
2533
- // cron: { type: "string" },
2534
- // do: {
2535
- // type: "array",
2536
- // items: node_json_schema,
2537
- // },
2538
- // },
2539
- // required: ["cron", "do"],
2540
- // },
2541
- // output: {
2542
- // json_schema: {
2543
- // type: "object",
2544
- // },
2545
- // },
2546
- // validator: (input) => {
2547
- // // validate here
2548
- // },
2549
- // },
2628
+ cron_job: {
2629
+ kind: "expression",
2630
+ category: "triggers",
2631
+ name: "Cron Job",
2632
+ fields: {
2633
+ cron: {
2634
+ node_options: ["cron_literal"],
2635
+ forced_node: "cron_literal",
2636
+ },
2637
+ do: {
2638
+ node_options: ["stack_literal"],
2639
+ forced_node: "stack_literal",
2640
+ },
2641
+ },
2642
+ node_structure: [
2643
+ [
2644
+ { ui_type: "text", value: "cron" },
2645
+ { ui_type: "field", field: "cron" },
2646
+ ],
2647
+ { ui_type: "stack", field: "do" },
2648
+ ],
2649
+ postgres_type: "jsonb",
2650
+ json_schema: {
2651
+ type: "object",
2652
+ properties: {
2653
+ cron: { type: "string" },
2654
+ do: {
2655
+ type: "array",
2656
+ items: node_json_schema,
2657
+ },
2658
+ },
2659
+ required: ["cron", "do"],
2660
+ },
2661
+ output: {
2662
+ json_schema: {
2663
+ type: "object",
2664
+ },
2665
+ },
2666
+ validator: (input) => {
2667
+ // validate here
2668
+ },
2669
+ },
2670
+ }
2550
2671
 
2551
2672
  export const literal_types = {
2552
2673
  array_literal,
@@ -4018,6 +4139,7 @@ export const content_types = {
4018
4139
  export const node_types = {
4019
4140
  ...literal_types,
4020
4141
  ...content_types,
4142
+ ...function_types,
4021
4143
  }
4022
4144
 
4023
4145
  function get_content_node_json_schema(type_id) {