@saltcorn/data 1.1.0-beta.11 → 1.1.0-beta.12

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.
@@ -554,7 +554,113 @@ export const types: ({
554
554
  show: {
555
555
  isEdit: boolean;
556
556
  description: string;
557
- run: (s: any) => any;
557
+ run: (v: any, req: any) => any;
558
+ };
559
+ checkboxes: {
560
+ isEdit: boolean;
561
+ description: string;
562
+ run: (v: any) => any;
563
+ };
564
+ TrueFalse: {
565
+ isEdit: boolean;
566
+ description: string;
567
+ run: (v: any) => "" | "True" | "False";
568
+ };
569
+ edit: {
570
+ isEdit: boolean;
571
+ description: string;
572
+ configFields: ({
573
+ name: string;
574
+ label: string;
575
+ type: string;
576
+ attributes: {
577
+ options: string[];
578
+ };
579
+ } | {
580
+ name: string;
581
+ label: string;
582
+ type: string;
583
+ attributes?: undefined;
584
+ })[];
585
+ run: (nm: any, v: any, attrs: any, cls: any, required: any, field: any) => any;
586
+ };
587
+ switch: {
588
+ isEdit: boolean;
589
+ description: string;
590
+ run: (nm: any, v: any, attrs: any, cls: any, required: any, field: any) => any;
591
+ };
592
+ show_with_html: {
593
+ configFields: {
594
+ input_type: string;
595
+ name: string;
596
+ label: string;
597
+ sublabel: string;
598
+ default: string;
599
+ attributes: {
600
+ mode: string;
601
+ };
602
+ }[];
603
+ isEdit: boolean;
604
+ description: string;
605
+ run: (v: any, req: any, attrs?: {}) => any;
606
+ };
607
+ tristate: {
608
+ isEdit: boolean;
609
+ description: string;
610
+ configFields: {
611
+ name: string;
612
+ label: string;
613
+ type: string;
614
+ }[];
615
+ run: (nm: any, v: any, attrs: any, cls: any, required: any, field: any) => any;
616
+ };
617
+ };
618
+ attributes: object[];
619
+ readFromFormRecord: (rec: any, name: string) => boolean | null;
620
+ read: (v: object) => boolean | null;
621
+ readFromDB: (v: object) => object;
622
+ listAs: (v: object) => object;
623
+ validate: () => boolean;
624
+ } | {
625
+ name: string;
626
+ description: string;
627
+ sql_name: string;
628
+ js_type: string;
629
+ contract: () => Function;
630
+ attributes: object[];
631
+ fieldviews: {
632
+ show: {
633
+ isEdit: boolean;
634
+ description: string;
635
+ run: (d: any, req: any, attrs?: {}) => any;
636
+ };
637
+ showDay: {
638
+ isEdit: boolean;
639
+ description: string;
640
+ run: (d: any, req: any) => any;
641
+ };
642
+ format: {
643
+ isEdit: boolean;
644
+ description: string;
645
+ configFields: {
646
+ name: string;
647
+ label: string;
648
+ type: string;
649
+ help: {
650
+ topic: string;
651
+ };
652
+ }[];
653
+ run: (d: any, req: any, options: any) => any;
654
+ };
655
+ relative: {
656
+ isEdit: boolean;
657
+ description: string;
658
+ run: (d: any, req: any) => string;
659
+ };
660
+ yearsAgo: {
661
+ isEdit: boolean;
662
+ description: string;
663
+ run: (d: any, req: any) => string;
558
664
  };
559
665
  show_with_html: {
560
666
  configFields: {
@@ -577,9 +683,17 @@ export const types: ({
577
683
  description: string;
578
684
  run: (nm: any, v: any, attrs: any, cls: any, required: any, field: any) => any;
579
685
  };
686
+ editDay: {
687
+ isEdit: boolean;
688
+ blockDisplay: boolean;
689
+ description: string;
690
+ run: (nm: any, v: any, attrs: any, cls: any, required: any, field: any) => any;
691
+ };
580
692
  };
581
- attributes: object[];
582
- read: (v: object) => object;
693
+ presets: {
694
+ Now: () => Date;
695
+ };
696
+ read: (v: object, attrs: object) => object;
583
697
  validate: () => boolean;
584
698
  } | {
585
699
  name: string;
@@ -834,40 +948,11 @@ export const types: ({
834
948
  sql_name: string;
835
949
  js_type: string;
836
950
  contract: () => Function;
837
- attributes: object[];
838
951
  fieldviews: {
839
952
  show: {
840
953
  isEdit: boolean;
841
954
  description: string;
842
- run: (d: any, req: any, attrs?: {}) => any;
843
- };
844
- showDay: {
845
- isEdit: boolean;
846
- description: string;
847
- run: (d: any, req: any) => any;
848
- };
849
- format: {
850
- isEdit: boolean;
851
- description: string;
852
- configFields: {
853
- name: string;
854
- label: string;
855
- type: string;
856
- help: {
857
- topic: string;
858
- };
859
- }[];
860
- run: (d: any, req: any, options: any) => any;
861
- };
862
- relative: {
863
- isEdit: boolean;
864
- description: string;
865
- run: (d: any, req: any) => string;
866
- };
867
- yearsAgo: {
868
- isEdit: boolean;
869
- description: string;
870
- run: (d: any, req: any) => string;
955
+ run: (s: any) => any;
871
956
  };
872
957
  show_with_html: {
873
958
  configFields: {
@@ -890,97 +975,87 @@ export const types: ({
890
975
  description: string;
891
976
  run: (nm: any, v: any, attrs: any, cls: any, required: any, field: any) => any;
892
977
  };
893
- editDay: {
894
- isEdit: boolean;
895
- blockDisplay: boolean;
896
- description: string;
897
- run: (nm: any, v: any, attrs: any, cls: any, required: any, field: any) => any;
898
- };
899
978
  };
900
- presets: {
901
- Now: () => Date;
902
- };
903
- read: (v: object, attrs: object) => object;
979
+ attributes: object[];
980
+ read: (v: object) => object;
904
981
  validate: () => boolean;
905
- } | {
982
+ })[];
983
+ export const viewtemplates: ({
906
984
  name: string;
907
985
  description: string;
908
- sql_name: string;
909
- js_type: string;
910
- contract: () => Function;
911
- fieldviews: {
912
- show: {
913
- isEdit: boolean;
914
- description: string;
915
- run: (v: any, req: any) => any;
916
- };
917
- checkboxes: {
918
- isEdit: boolean;
919
- description: string;
920
- run: (v: any) => any;
921
- };
922
- TrueFalse: {
923
- isEdit: boolean;
924
- description: string;
925
- run: (v: any) => "" | "True" | "False";
926
- };
927
- edit: {
928
- isEdit: boolean;
929
- description: string;
930
- configFields: ({
931
- name: string;
932
- label: string;
933
- type: string;
934
- attributes: {
935
- options: string[];
936
- };
937
- } | {
938
- name: string;
939
- label: string;
940
- type: string;
941
- attributes?: undefined;
942
- })[];
943
- run: (nm: any, v: any, attrs: any, cls: any, required: any, field: any) => any;
944
- };
945
- switch: {
946
- isEdit: boolean;
947
- description: string;
948
- run: (nm: any, v: any, attrs: any, cls: any, required: any, field: any) => any;
949
- };
950
- show_with_html: {
951
- configFields: {
952
- input_type: string;
953
- name: string;
954
- label: string;
955
- sublabel: string;
956
- default: string;
957
- attributes: {
958
- mode: string;
959
- };
960
- }[];
961
- isEdit: boolean;
962
- description: string;
963
- run: (v: any, req: any, attrs?: {}) => any;
964
- };
965
- tristate: {
966
- isEdit: boolean;
967
- description: string;
968
- configFields: {
969
- name: string;
970
- label: string;
971
- type: string;
972
- }[];
973
- run: (nm: any, v: any, attrs: any, cls: any, required: any, field: any) => any;
986
+ get_state_fields: () => object[];
987
+ configuration_workflow: (req: object) => import("../models/workflow");
988
+ run: (table_id: string, viewname: string, { columns, layout, page_title, page_title_formula }: {
989
+ columns: object[];
990
+ layout: object;
991
+ page_title?: string | undefined;
992
+ page_title_formula: boolean;
993
+ }, state: object, extra: object, { showQuery }: {
994
+ showQuery: any;
995
+ }) => Promise<string>;
996
+ runMany: (table_id: number, viewname: string, { columns, layout }: {
997
+ columns: object[];
998
+ layout: object;
999
+ }, state: object, extra: object, { runManyQuery }: {
1000
+ runManyQuery: any;
1001
+ }) => Promise<object[]>;
1002
+ renderRows: (table: object, viewname: string, { columns, layout }: {
1003
+ columns: object[];
1004
+ layout: object;
1005
+ }, extra: object, rows: object[], state: any) => Promise<string>;
1006
+ initial_config: Function;
1007
+ display_state_form: boolean;
1008
+ routes: {
1009
+ run_action: (table_id: number, viewname: any, { columns, layout }: {
1010
+ columns: object[];
1011
+ layout: any;
1012
+ }, body: any, { req, res }: {
1013
+ req: object;
1014
+ res: any;
1015
+ }, { actionQuery }: {
1016
+ actionQuery: any;
1017
+ }) => Promise<object>;
1018
+ };
1019
+ getStringsForI18n({ layout }: {
1020
+ layout: object;
1021
+ }): string[];
1022
+ interpolate_title_string(table_id: any, title: any, state: any): Promise<any>;
1023
+ queries: ({ table_id, exttable_name, name, configuration: { columns, layout }, req, res, }: {
1024
+ table_id: any;
1025
+ exttable_name: any;
1026
+ name: any;
1027
+ configuration: {
1028
+ columns: any;
1029
+ layout: any;
974
1030
  };
1031
+ req: any;
1032
+ res: any;
1033
+ }) => {
1034
+ showQuery(state: any): Promise<{
1035
+ rows: null;
1036
+ message: string;
1037
+ } | {
1038
+ rows: import("@saltcorn/db-common/internal").Row[];
1039
+ message: null;
1040
+ }>;
1041
+ runManyQuery(state: any, { where, limit, offset, joinFieldsExtra, orderBy, orderDesc }: {
1042
+ where: any;
1043
+ limit: any;
1044
+ offset: any;
1045
+ joinFieldsExtra: any;
1046
+ orderBy: any;
1047
+ orderDesc: any;
1048
+ }): Promise<import("@saltcorn/db-common/internal").Row[]>;
1049
+ actionQuery(): Promise<{
1050
+ json: any;
1051
+ }>;
975
1052
  };
976
- attributes: object[];
977
- readFromFormRecord: (rec: any, name: string) => boolean | null;
978
- read: (v: object) => boolean | null;
979
- readFromDB: (v: object) => object;
980
- listAs: (v: object) => object;
981
- validate: () => boolean;
982
- })[];
983
- export const viewtemplates: ({
1053
+ configCheck: (view: any) => Promise<{
1054
+ errors: string[];
1055
+ warnings: string[];
1056
+ }>;
1057
+ connectedObjects: (configuration: any) => Promise<import("@saltcorn/types/base_types").ConnectedObjects>;
1058
+ } | {
984
1059
  name: string;
985
1060
  description: string;
986
1061
  configuration_workflow: (req: object) => import("../models/workflow");
@@ -1198,81 +1273,6 @@ export const viewtemplates: ({
1198
1273
  warnings: string[];
1199
1274
  }>;
1200
1275
  connectedObjects: (configuration: any) => Promise<import("@saltcorn/types/base_types").ConnectedObjects>;
1201
- } | {
1202
- name: string;
1203
- description: string;
1204
- get_state_fields: () => object[];
1205
- configuration_workflow: (req: object) => import("../models/workflow");
1206
- run: (table_id: string, viewname: string, { columns, layout, page_title, page_title_formula }: {
1207
- columns: object[];
1208
- layout: object;
1209
- page_title?: string | undefined;
1210
- page_title_formula: boolean;
1211
- }, state: object, extra: object, { showQuery }: {
1212
- showQuery: any;
1213
- }) => Promise<string>;
1214
- runMany: (table_id: number, viewname: string, { columns, layout }: {
1215
- columns: object[];
1216
- layout: object;
1217
- }, state: object, extra: object, { runManyQuery }: {
1218
- runManyQuery: any;
1219
- }) => Promise<object[]>;
1220
- renderRows: (table: object, viewname: string, { columns, layout }: {
1221
- columns: object[];
1222
- layout: object;
1223
- }, extra: object, rows: object[], state: any) => Promise<string>;
1224
- initial_config: Function;
1225
- display_state_form: boolean;
1226
- routes: {
1227
- run_action: (table_id: number, viewname: any, { columns, layout }: {
1228
- columns: object[];
1229
- layout: any;
1230
- }, body: any, { req, res }: {
1231
- req: object;
1232
- res: any;
1233
- }, { actionQuery }: {
1234
- actionQuery: any;
1235
- }) => Promise<object>;
1236
- };
1237
- getStringsForI18n({ layout }: {
1238
- layout: object;
1239
- }): string[];
1240
- interpolate_title_string(table_id: any, title: any, state: any): Promise<any>;
1241
- queries: ({ table_id, exttable_name, name, configuration: { columns, layout }, req, res, }: {
1242
- table_id: any;
1243
- exttable_name: any;
1244
- name: any;
1245
- configuration: {
1246
- columns: any;
1247
- layout: any;
1248
- };
1249
- req: any;
1250
- res: any;
1251
- }) => {
1252
- showQuery(state: any): Promise<{
1253
- rows: null;
1254
- message: string;
1255
- } | {
1256
- rows: import("@saltcorn/db-common/internal").Row[];
1257
- message: null;
1258
- }>;
1259
- runManyQuery(state: any, { where, limit, offset, joinFieldsExtra, orderBy, orderDesc }: {
1260
- where: any;
1261
- limit: any;
1262
- offset: any;
1263
- joinFieldsExtra: any;
1264
- orderBy: any;
1265
- orderDesc: any;
1266
- }): Promise<import("@saltcorn/db-common/internal").Row[]>;
1267
- actionQuery(): Promise<{
1268
- json: any;
1269
- }>;
1270
- };
1271
- configCheck: (view: any) => Promise<{
1272
- errors: string[];
1273
- warnings: string[];
1274
- }>;
1275
- connectedObjects: (configuration: any) => Promise<import("@saltcorn/types/base_types").ConnectedObjects>;
1276
1276
  } | {
1277
1277
  name: string;
1278
1278
  description: string;
@@ -1312,7 +1312,7 @@ const prepare = async (viewname, table, fields, { columns, layout, fixed, auto_s
1312
1312
  }
1313
1313
  else {
1314
1314
  const file = req.files[field.name];
1315
- if (file?.name) {
1315
+ if (file) {
1316
1316
  const serverResp = await File.upload(req.files[field.name]);
1317
1317
  if (serverResp?.location)
1318
1318
  row[field.name] = serverResp.location;