@saltcorn/data 0.7.3-beta.2 → 0.7.3-beta.3

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.
Files changed (59) hide show
  1. package/dist/base-plugin/index.d.ts +182 -170
  2. package/dist/base-plugin/index.d.ts.map +1 -1
  3. package/dist/base-plugin/viewtemplates/edit.d.ts +10 -2
  4. package/dist/base-plugin/viewtemplates/edit.d.ts.map +1 -1
  5. package/dist/base-plugin/viewtemplates/edit.js +28 -13
  6. package/dist/base-plugin/viewtemplates/edit.js.map +1 -1
  7. package/dist/base-plugin/viewtemplates/room.d.ts +3 -1
  8. package/dist/base-plugin/viewtemplates/room.d.ts.map +1 -1
  9. package/dist/base-plugin/viewtemplates/room.js +8 -4
  10. package/dist/base-plugin/viewtemplates/room.js.map +1 -1
  11. package/dist/base-plugin/viewtemplates/show.d.ts +2 -0
  12. package/dist/base-plugin/viewtemplates/show.d.ts.map +1 -1
  13. package/dist/base-plugin/viewtemplates/show.js +1 -1
  14. package/dist/base-plugin/viewtemplates/show.js.map +1 -1
  15. package/dist/db/state.d.ts.map +1 -1
  16. package/dist/db/state.js +4 -1
  17. package/dist/db/state.js.map +1 -1
  18. package/dist/mobile-mocks/saltcorn/html-pdf-node.d.ts +5 -0
  19. package/dist/mobile-mocks/saltcorn/html-pdf-node.d.ts.map +1 -0
  20. package/dist/mobile-mocks/saltcorn/html-pdf-node.js +6 -0
  21. package/dist/mobile-mocks/saltcorn/html-pdf-node.js.map +1 -0
  22. package/dist/models/config.d.ts.map +1 -1
  23. package/dist/models/config.js +11 -3
  24. package/dist/models/config.js.map +1 -1
  25. package/dist/models/email.d.ts.map +1 -1
  26. package/dist/models/email.js +5 -0
  27. package/dist/models/email.js.map +1 -1
  28. package/dist/models/field.d.ts +8 -5
  29. package/dist/models/field.d.ts.map +1 -1
  30. package/dist/models/field.js +11 -6
  31. package/dist/models/field.js.map +1 -1
  32. package/dist/models/file.d.ts +11 -1
  33. package/dist/models/file.d.ts.map +1 -1
  34. package/dist/models/file.js +25 -2
  35. package/dist/models/file.js.map +1 -1
  36. package/dist/models/form.d.ts +1 -1
  37. package/dist/models/form.d.ts.map +1 -1
  38. package/dist/models/form.js +2 -2
  39. package/dist/models/form.js.map +1 -1
  40. package/dist/models/view.d.ts.map +1 -1
  41. package/dist/models/view.js.map +1 -1
  42. package/dist/plugin-helper.d.ts.map +1 -1
  43. package/dist/plugin-helper.js +5 -1
  44. package/dist/plugin-helper.js.map +1 -1
  45. package/dist/tests/email.test.js +14 -14
  46. package/dist/tests/email.test.js.map +1 -1
  47. package/dist/tsconfig.ref.tsbuildinfo +1 -1
  48. package/dist/webpack.config.d.ts +2 -0
  49. package/dist/webpack.config.js +2 -0
  50. package/dist/webpack.config.js.map +1 -1
  51. package/package.json +10 -7
  52. package/dist/app-locales/public/da.json +0 -3
  53. package/dist/db/db.test.d.ts +0 -2
  54. package/dist/db/db.test.d.ts.map +0 -1
  55. package/dist/db/db.test.js +0 -28
  56. package/dist/db/db.test.js.map +0 -1
  57. package/dist/package.json +0 -127
  58. package/dist/tsconfig.json +0 -24
  59. package/dist/tsconfig.ref.json +0 -9
@@ -418,61 +418,6 @@ export const types: ({
418
418
  validate: () => boolean;
419
419
  })[];
420
420
  export const viewtemplates: ({
421
- name: string;
422
- description: string;
423
- configuration_workflow: (req: object) => import("../models/workflow");
424
- run: (table_id: string | number, viewname: string, { columns, view_to_create, create_view_display, create_view_label, default_state, create_view_location, }: {
425
- columns: object[];
426
- view_to_create?: string | undefined;
427
- create_view_display: string;
428
- create_view_label?: string | undefined;
429
- default_state?: object | undefined;
430
- create_view_location?: string | undefined;
431
- }, stateWithId?: object | undefined, extraOpts: object, { listQuery }: {
432
- listQuery: any;
433
- }) => Promise<any>;
434
- view_quantity: string;
435
- get_state_fields: (table_id: string, viewname: any, { columns }: {
436
- columns: object[];
437
- }) => Function;
438
- initial_config: Function;
439
- on_delete: (table_id: any, viewname: string, { default_state }: {
440
- default_state: any;
441
- }) => Promise<void>;
442
- routes: {
443
- run_action: (table_id: number, viewname: any, { columns, layout }: {
444
- columns: object[];
445
- layout: any;
446
- }, body: object, { req, res }: {
447
- req: object;
448
- res: any;
449
- }, { getRowQuery }: {
450
- getRowQuery: any;
451
- }) => Promise<object>;
452
- };
453
- display_state_form: (opts: object) => boolean;
454
- default_state_form: ({ default_state }: object) => boolean;
455
- getStringsForI18n({ columns, create_view_label }: {
456
- columns: any;
457
- create_view_label: any;
458
- }): string[];
459
- queries: ({ table_id, viewname, configuration: { columns, default_state }, req, }: {
460
- table_id: any;
461
- viewname: any;
462
- configuration: {
463
- columns: any;
464
- default_state: any;
465
- };
466
- req: any;
467
- }) => {
468
- listQuery(state: any): Promise<{
469
- rows: import("@saltcorn/db-common/internal").Row[];
470
- rowCount: number;
471
- }>;
472
- getRowQuery(id: any): Promise<import("@saltcorn/db-common/internal").Row | null>;
473
- };
474
- configCheck: (view: any) => Promise<string[]>;
475
- } | {
476
421
  name: string;
477
422
  description: string;
478
423
  get_state_fields: () => object[];
@@ -514,6 +459,8 @@ export const viewtemplates: ({
514
459
  authorise_get: ({ query, table_id }: {
515
460
  query: any;
516
461
  table_id: any;
462
+ }, { authorizeGetQuery }: {
463
+ authorizeGetQuery: any;
517
464
  }) => Promise<any>;
518
465
  queries: ({ table_id, viewname, configuration: { columns, layout }, req, }: {
519
466
  table_id: any;
@@ -548,99 +495,41 @@ export const viewtemplates: ({
548
495
  name: string;
549
496
  description: string;
550
497
  configuration_workflow: (req: object) => import("../models/workflow");
551
- run: (table_id: number, viewname: string, { show_view, order_field, descending, view_to_create, create_view_display, in_card, masonry_columns, rows_per_page, hide_pagination, create_view_label, create_view_location, always_create_view, include_fml, ...cols }: {
552
- show_view: string;
553
- order_field: name;
554
- descending: boolean;
498
+ run: (table_id: string | number, viewname: string, { columns, view_to_create, create_view_display, create_view_label, default_state, create_view_location, }: {
499
+ columns: object[];
555
500
  view_to_create?: string | undefined;
556
501
  create_view_display: string;
557
- in_card: boolean;
558
- masonry_columns: string;
559
- rows_per_page?: number | undefined;
560
- hide_pagination: boolean;
561
502
  create_view_label?: string | undefined;
503
+ default_state?: object | undefined;
562
504
  create_view_location?: string | undefined;
563
- always_create_view: boolean;
564
- cols: any;
565
- }, state: object, extraArgs: any, { countRowsQuery }: {
566
- countRowsQuery: any;
567
- }) => Promise<div>;
568
- get_state_fields: (table_id: number, viewname: any, { show_view }: {
569
- show_view: any;
570
- }) => Promise<import("../models/field")>;
571
- display_state_form: boolean;
572
- getStringsForI18n({ create_view_label }: {
573
- create_view_label: any;
574
- }): string[] | Object[];
575
- queries: ({ table_id, viewname, configuration: { columns, default_state }, req, }: {
576
- table_id: any;
577
- viewname: any;
578
- configuration: {
579
- columns: any;
580
- default_state: any;
581
- };
582
- req: any;
583
- }) => {
584
- countRowsQuery(state: any): Promise<number>;
585
- };
586
- } | {
587
- name: string;
588
- description: string;
589
- configuration_workflow: (req: object) => import("../models/workflow");
590
- run: (table_id: string, viewname: string, { participant_field, msg_relation, msgsender_field, msgview, msgform, participant_maxread_field, }: {
591
- participant_field: string;
592
- msg_relation: string;
593
- msgsender_field: any;
594
- msgview: string;
595
- msgform: string;
596
- participant_maxread_field: string;
597
- }, state: object, { req, res }: {
598
- req: object;
599
- res: object;
600
- }, { getRowQuery, updateQuery }: {
601
- getRowQuery: any;
602
- updateQuery: any;
603
- }) => Promise<div>;
604
- get_state_fields: () => object[];
605
- display_state_form: boolean;
505
+ }, stateWithId?: object | undefined, extraOpts: object, { listQuery }: {
506
+ listQuery: any;
507
+ }) => Promise<any>;
508
+ view_quantity: string;
509
+ get_state_fields: (table_id: string, viewname: any, { columns }: {
510
+ columns: object[];
511
+ }) => Function;
512
+ initial_config: Function;
513
+ on_delete: (table_id: any, viewname: string, { default_state }: {
514
+ default_state: any;
515
+ }) => Promise<void>;
606
516
  routes: {
607
- submit_msg_ajax: (table_id: any, viewname: string, { participant_field, msg_relation, msgsender_field, msgview, msgform, participant_maxread_field, }: {
608
- participant_field: string;
609
- msg_relation: string;
610
- msgsender_field: any;
611
- msgview: string;
612
- msgform: string;
613
- participant_maxread_field: string;
614
- }, body: any, { req, res }: {
517
+ run_action: (table_id: number, viewname: any, { columns, layout }: {
518
+ columns: object[];
519
+ layout: any;
520
+ }, body: object, { req, res }: {
615
521
  req: object;
616
- res: object;
617
- }, { submitAjaxQuery }: {
618
- submitAjaxQuery: any;
522
+ res: any;
523
+ }, { getRowQuery }: {
524
+ getRowQuery: any;
619
525
  }) => Promise<object>;
620
- ack_read: (table_id: any, viewname: any, { participant_field, participant_maxread_field }: {
621
- participant_field: string;
622
- participant_maxread_field: string;
623
- }, body: any, { req, res }: {
624
- req: object;
625
- res: object;
626
- }, { ackReadQuery }: {
627
- ackReadQuery: any;
628
- }) => Promise<void>;
629
- fetch_older_msg: (table_id: any, viewname: any, { participant_field, msg_relation, msgsender_field, msgview, msgform, participant_maxread_field, }: object, body: object, { req, res }: string, { fetchOlderMsgQuery }: any) => Promise<object>;
630
526
  };
631
- noAutoTest: boolean;
632
- authorize_join: ({ participant_field }: {
633
- participant_field: object;
634
- }, room_id: string, user: object) => Promise<object>;
635
- virtual_triggers: (table_id: any, viewname: string, { participant_field, msg_relation, msgsender_field, msgview, msgform, participant_maxread_field, }: {
636
- participant_field: any;
637
- msg_relation: string;
638
- msgsender_field: string;
639
- msgview: string;
640
- msgform: any;
641
- participant_maxread_field: any;
642
- }) => object[];
643
- getStringsForI18n(): object[];
527
+ display_state_form: (opts: object) => boolean;
528
+ default_state_form: ({ default_state }: object) => boolean;
529
+ getStringsForI18n({ columns, create_view_label }: {
530
+ columns: any;
531
+ create_view_label: any;
532
+ }): string[];
644
533
  queries: ({ table_id, viewname, configuration: { columns, default_state }, req, }: {
645
534
  table_id: any;
646
535
  viewname: any;
@@ -650,36 +539,13 @@ export const viewtemplates: ({
650
539
  };
651
540
  req: any;
652
541
  }) => {
653
- getRowQuery(state_id: any, part_table_name: any, part_user_field: any, part_key_to_room: any): Promise<import("@saltcorn/db-common/internal").Row | null>;
654
- updateQuery(partRow: any, part_table_name: any, max_read_id: any, part_maxread_field: any): Promise<void>;
655
- submitAjaxQuery(msg_relation: any, participant_field: any, body: any, msgform: any, msgsender_field: any, participant_maxread_field: any): Promise<{
656
- json: {
657
- msgid: {
658
- error: string;
659
- } | {
660
- success: any;
661
- };
662
- error?: undefined;
663
- };
664
- } | {
665
- json: {
666
- error: any;
667
- msgid?: undefined;
668
- };
669
- }>;
670
- ackReadQuery(participant_field: any, participant_maxread_field: any, body: any): Promise<{
671
- json: {
672
- error: string;
673
- success?: undefined;
674
- };
675
- } | {
676
- json: {
677
- success: string;
678
- error?: undefined;
679
- };
542
+ listQuery(state: any): Promise<{
543
+ rows: import("@saltcorn/db-common/internal").Row[];
544
+ rowCount: number;
680
545
  }>;
681
- fetchOlderMsgQuery(participant_field: any, body: any): Promise<import("@saltcorn/db-common/internal").Row | null>;
546
+ getRowQuery(id: any): Promise<import("@saltcorn/db-common/internal").Row | null>;
682
547
  };
548
+ configCheck: (view: any) => Promise<string[]>;
683
549
  } | {
684
550
  name: string;
685
551
  description: string;
@@ -696,9 +562,10 @@ export const viewtemplates: ({
696
562
  runMany: (table_id: number, viewname: string, { columns, layout, auto_save }: {
697
563
  columns: any;
698
564
  layout: any;
699
- }, state: State, extra: object, { editManyQuery, getRowQuery }: {
565
+ }, state: State, extra: object, { editManyQuery, getRowQuery, optionsQuery }: {
700
566
  editManyQuery: any;
701
567
  getRowQuery: any;
568
+ optionsQuery: any;
702
569
  }) => Promise<import("../models/form")[]>;
703
570
  runPost: (table_id: number, viewname: string, { columns, layout, fixed, view_when_done, formula_destinations, auto_save, destination_type, }: {
704
571
  columns: object[];
@@ -750,7 +617,13 @@ export const viewtemplates: ({
750
617
  res: any;
751
618
  }) => {
752
619
  editQuery(state: any): Promise<import("../models/form")>;
753
- editManyQuery(state: any, extra: any): Promise<{
620
+ editManyQuery(state: any, { limit, offset, orderBy, orderDesc, where }: {
621
+ limit: any;
622
+ offset: any;
623
+ orderBy: any;
624
+ orderDesc: any;
625
+ where: any;
626
+ }): Promise<{
754
627
  table: import("../models/table") | null;
755
628
  fields: import("../models/field")[];
756
629
  rows: import("@saltcorn/db-common/internal").Row[];
@@ -767,6 +640,7 @@ export const viewtemplates: ({
767
640
  actionQuery(): Promise<{
768
641
  json: any;
769
642
  }>;
643
+ optionsQuery(reftable_name: any, type: any, attributes: any, where: any): Promise<any>;
770
644
  };
771
645
  routes: {
772
646
  run_action: (table_id: number, viewname: any, { columns, layout }: {
@@ -810,6 +684,45 @@ export const viewtemplates: ({
810
684
  }) => {
811
685
  getRowQuery(uniques: any): Promise<import("@saltcorn/db-common/internal").Row | null>;
812
686
  };
687
+ } | {
688
+ name: string;
689
+ description: string;
690
+ configuration_workflow: (req: object) => import("../models/workflow");
691
+ run: (table_id: number, viewname: string, { show_view, order_field, descending, view_to_create, create_view_display, in_card, masonry_columns, rows_per_page, hide_pagination, create_view_label, create_view_location, always_create_view, include_fml, ...cols }: {
692
+ show_view: string;
693
+ order_field: name;
694
+ descending: boolean;
695
+ view_to_create?: string | undefined;
696
+ create_view_display: string;
697
+ in_card: boolean;
698
+ masonry_columns: string;
699
+ rows_per_page?: number | undefined;
700
+ hide_pagination: boolean;
701
+ create_view_label?: string | undefined;
702
+ create_view_location?: string | undefined;
703
+ always_create_view: boolean;
704
+ cols: any;
705
+ }, state: object, extraArgs: any, { countRowsQuery }: {
706
+ countRowsQuery: any;
707
+ }) => Promise<div>;
708
+ get_state_fields: (table_id: number, viewname: any, { show_view }: {
709
+ show_view: any;
710
+ }) => Promise<import("../models/field")>;
711
+ display_state_form: boolean;
712
+ getStringsForI18n({ create_view_label }: {
713
+ create_view_label: any;
714
+ }): string[] | Object[];
715
+ queries: ({ table_id, viewname, configuration: { columns, default_state }, req, }: {
716
+ table_id: any;
717
+ viewname: any;
718
+ configuration: {
719
+ columns: any;
720
+ default_state: any;
721
+ };
722
+ req: any;
723
+ }) => {
724
+ countRowsQuery(state: any): Promise<number>;
725
+ };
813
726
  } | {
814
727
  name: string;
815
728
  description: string;
@@ -840,6 +753,105 @@ export const viewtemplates: ({
840
753
  role: any;
841
754
  }>;
842
755
  };
756
+ } | {
757
+ name: string;
758
+ description: string;
759
+ configuration_workflow: (req: object) => import("../models/workflow");
760
+ run: (table_id: string, viewname: string, { participant_field, msg_relation, msgsender_field, msgview, msgform, participant_maxread_field, }: {
761
+ participant_field: string;
762
+ msg_relation: string;
763
+ msgsender_field: any;
764
+ msgview: string;
765
+ msgform: string;
766
+ participant_maxread_field: string;
767
+ }, state: object, { req, res }: {
768
+ req: object;
769
+ res: object;
770
+ }, { getRowQuery, updateQuery, optionsQuery }: {
771
+ getRowQuery: any;
772
+ updateQuery: any;
773
+ optionsQuery: any;
774
+ }) => Promise<div>;
775
+ get_state_fields: () => object[];
776
+ display_state_form: boolean;
777
+ routes: {
778
+ submit_msg_ajax: (table_id: any, viewname: string, { participant_field, msg_relation, msgsender_field, msgview, msgform, participant_maxread_field, }: {
779
+ participant_field: string;
780
+ msg_relation: string;
781
+ msgsender_field: any;
782
+ msgview: string;
783
+ msgform: string;
784
+ participant_maxread_field: string;
785
+ }, body: any, { req, res }: {
786
+ req: object;
787
+ res: object;
788
+ }, { submitAjaxQuery }: {
789
+ submitAjaxQuery: any;
790
+ }) => Promise<object>;
791
+ ack_read: (table_id: any, viewname: any, { participant_field, participant_maxread_field }: {
792
+ participant_field: string;
793
+ participant_maxread_field: string;
794
+ }, body: any, { req, res }: {
795
+ req: object;
796
+ res: object;
797
+ }, { ackReadQuery }: {
798
+ ackReadQuery: any;
799
+ }) => Promise<void>;
800
+ fetch_older_msg: (table_id: any, viewname: any, { participant_field, msg_relation, msgsender_field, msgview, msgform, participant_maxread_field, }: object, body: object, { req, res }: string, { fetchOlderMsgQuery }: any) => Promise<object>;
801
+ };
802
+ noAutoTest: boolean;
803
+ authorize_join: ({ participant_field }: {
804
+ participant_field: object;
805
+ }, room_id: string, user: object) => Promise<object>;
806
+ virtual_triggers: (table_id: any, viewname: string, { participant_field, msg_relation, msgsender_field, msgview, msgform, participant_maxread_field, }: {
807
+ participant_field: any;
808
+ msg_relation: string;
809
+ msgsender_field: string;
810
+ msgview: string;
811
+ msgform: any;
812
+ participant_maxread_field: any;
813
+ }) => object[];
814
+ getStringsForI18n(): object[];
815
+ queries: ({ table_id, viewname, configuration: { columns, default_state }, req, }: {
816
+ table_id: any;
817
+ viewname: any;
818
+ configuration: {
819
+ columns: any;
820
+ default_state: any;
821
+ };
822
+ req: any;
823
+ }) => {
824
+ getRowQuery(state_id: any, part_table_name: any, part_user_field: any, part_key_to_room: any): Promise<import("@saltcorn/db-common/internal").Row | null>;
825
+ updateQuery(partRow: any, part_table_name: any, max_read_id: any, part_maxread_field: any): Promise<void>;
826
+ submitAjaxQuery(msg_relation: any, participant_field: any, body: any, msgform: any, msgsender_field: any, participant_maxread_field: any): Promise<{
827
+ json: {
828
+ msgid: {
829
+ error: string;
830
+ } | {
831
+ success: any;
832
+ };
833
+ error?: undefined;
834
+ };
835
+ } | {
836
+ json: {
837
+ error: any;
838
+ msgid?: undefined;
839
+ };
840
+ }>;
841
+ ackReadQuery(participant_field: any, participant_maxread_field: any, body: any): Promise<{
842
+ json: {
843
+ error: string;
844
+ success?: undefined;
845
+ };
846
+ } | {
847
+ json: {
848
+ success: string;
849
+ error?: undefined;
850
+ };
851
+ }>;
852
+ fetchOlderMsgQuery(participant_field: any, body: any): Promise<import("@saltcorn/db-common/internal").Row | null>;
853
+ optionsQuery(reftable_name: any, type: any, attributes: any, where: any): Promise<any>;
854
+ };
843
855
  })[];
844
856
  import fileviews = require("./fileviews");
845
857
  import actions = require("./actions");
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../base-plugin/index.js"],"names":[],"mappings":"AAuCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAAsD;AACtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA2E;;;;4CAG9D,MAAM;yCAYN,MAAM"}
@@ -37,9 +37,10 @@ export function run(table_id: number, viewname: string, {}: {
37
37
  export function runMany(table_id: number, viewname: string, { columns, layout, auto_save }: {
38
38
  columns: any;
39
39
  layout: any;
40
- }, state: State, extra: object, { editManyQuery, getRowQuery }: {
40
+ }, state: State, extra: object, { editManyQuery, getRowQuery, optionsQuery }: {
41
41
  editManyQuery: any;
42
42
  getRowQuery: any;
43
+ optionsQuery: any;
43
44
  }): Promise<Form[]>;
44
45
  /**
45
46
  * @param {number} table_id
@@ -163,7 +164,13 @@ export declare function queries({ table_id, name, configuration: { columns, defa
163
164
  res: any;
164
165
  }): {
165
166
  editQuery(state: any): Promise<Form>;
166
- editManyQuery(state: any, extra: any): Promise<{
167
+ editManyQuery(state: any, { limit, offset, orderBy, orderDesc, where }: {
168
+ limit: any;
169
+ offset: any;
170
+ orderBy: any;
171
+ orderDesc: any;
172
+ where: any;
173
+ }): Promise<{
167
174
  table: Table | null;
168
175
  fields: Field[];
169
176
  rows: import("@saltcorn/db-common/internal").Row[];
@@ -180,6 +187,7 @@ export declare function queries({ table_id, name, configuration: { columns, defa
180
187
  actionQuery(): Promise<{
181
188
  json: any;
182
189
  }>;
190
+ optionsQuery(reftable_name: any, type: any, attributes: any, where: any): Promise<any>;
183
191
  };
184
192
  export declare namespace routes {
185
193
  export { run_action };
@@ -1 +1 @@
1
- {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../base-plugin/viewtemplates/edit.js"],"names":[],"mappings":"AAiEA;;;GAGG;AAEH,4CAJW,MAAM,GACJ,QAAQ,CA+PjB;AAgCJ;;;;;;;;;;;GAWG;AACH,8BAXW,MAAM,YACN,MAAM;IAEK,OAAO;IACP,MAAM;UACjB,MAAM;IAEU,GAAG,EAAnB,MAAM;IACU,GAAG,EAAnB,MAAM;;;IACJ,QAAQ,IAAI,CAAC,CAWzB;AAED;;;;;;;;;GASG;AACH,kCATW,MAAM,YACN,MAAM;IAEE,OAAO;IACP,MAAM;wBAEd,MAAM;;;IACJ,QAAQ,IAAI,EAAE,CAAC,CA6B3B;AAoND;;;;;;;;;;;;;;;;GAgBG;AACH,kCAhBW,MAAM,YACN,MAAM;IAEY,OAAO,EAAzB,MAAM,EAAE;IACQ,MAAM;IACN,KAAK,EAArB,MAAM;IACW,cAAc,EAA/B,OAAO;IACW,oBAAoB,EAAtC,MAAM,EAAE;UACR,MAAM;IAGU,GAAG,EAAnB,MAAM;IACU,GAAG,EAAnB,MAAM;IACU,QAAQ,EAAxB,MAAM;;;;;iBACJ,QAAQ,IAAI,CAAC,CA+MzB;AA5gBD;;;;;;GAM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,EAAnB,MAAM;IACU,QAAQ,EAAxB,MAAM;;;;;iBACJ,QAAQ,IAAI,CAAC,CA+MzB;AAthBD;;;;;;GAMG;AACH;IAHmB,OAAO;IACb,QAAQ,MAAM,EAAE,CAAC,CAQ7B;AAcD,uBAAuB;AACvB,sCAAuD;AAihBvD;;;;;;GAMG;AACH;IALwB,IAAI,EAAjB,MAAM;IACO,QAAQ,EAArB,MAAM;IACO,GAAG,EAAhB,MAAM;;;IACJ,QAAQ,OAAO,CAAC,CAO5B;;;;AAED;;;;;;;;;;;GAWG;AACH,sCAXW,MAAM;IAGS,OAAO,EAAtB,MAAM,EAAE;IACA,MAAM;;IAGE,GAAG,EAAnB,MAAM;IACK,GAAG;;;IACZ,QAAQ,MAAM,CAAC,CAe3B;;2BAGY,MAAM;kCAEN,MAAM;yCAQN,OAAO;AASH;;;;;qBAEd;AACD;;;;GAIG;AACH;;aAEC;AAPD;;;;GAIG;AACH;;aAEC;AACQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqIP;;;;AAGW,kEAyBZ"}
@@ -18,13 +18,14 @@ const { text, text_attr } = require("@saltcorn/markup/tags");
18
18
  const { renderForm } = require("@saltcorn/markup");
19
19
  const FieldRepeat = require("../../models/fieldrepeat");
20
20
  const { get_expression_function, expressionChecker, } = require("../../models/expression");
21
- const { InvalidConfiguration, isNode } = require("../../utils");
21
+ const { InvalidConfiguration, isNode, mergeIntoWhere } = require("../../utils");
22
22
  const Library = require("../../models/library");
23
23
  const { check_view_columns } = require("../../plugin-testing");
24
24
  const { initial_config_all_fields, calcfldViewOptions, calcfldViewConfig, get_parent_views, get_link_view_opts, picked_fields_to_query, stateFieldsToWhere, stateFieldsToQuery, strictParseInt, run_action_column, } = require("../../plugin-helper");
25
25
  const { splitUniques, getForm, fill_presets, parse_view_select, get_view_link_query, objToQueryString, action_url, action_link, } = require("./viewable_fields");
26
26
  const { traverse, getStringsForI18n, translateLayout, traverseSync, } = require("../../models/layout");
27
27
  const { asyncMap, isWeb } = require("../../utils");
28
+ const db = require("../../db");
28
29
  const builtInActions = [
29
30
  "Save",
30
31
  "SaveAndContinue",
@@ -305,10 +306,18 @@ const run = async (table_id, viewname, {}, state, { res, req }, { editQuery }) =
305
306
  * @param {object} extra
306
307
  * @returns {Promise<Form[]>}
307
308
  */
308
- const runMany = async (table_id, viewname, { columns, layout, auto_save }, state, extra, { editManyQuery, getRowQuery }) => {
309
- const { table, fields, rows } = isNode()
310
- ? await editManyQuery(state, extra) // quick fix
311
- : await editManyQuery(state); // TODO ch change query call signature
309
+ const runMany = async (table_id, viewname, { columns, layout, auto_save }, state, extra, { editManyQuery, getRowQuery, optionsQuery }) => {
310
+ let { table, fields, rows } = await editManyQuery(state, {
311
+ limit: extra.limit,
312
+ offset: extra.offset,
313
+ orderBy: extra.orderBy,
314
+ orderDesc: extra.orderDesc,
315
+ where: extra.where,
316
+ });
317
+ if (!isNode()) {
318
+ table = Table.findOne({ id: table.id });
319
+ fields = await table.getFields();
320
+ }
312
321
  return await asyncMap(rows, async (row) => {
313
322
  const html = await render({
314
323
  table,
@@ -322,6 +331,7 @@ const runMany = async (table_id, viewname, { columns, layout, auto_save }, state
322
331
  state,
323
332
  auto_save,
324
333
  getRowQuery,
334
+ optionsQuery,
325
335
  });
326
336
  return { html, row };
327
337
  });
@@ -445,7 +455,7 @@ const transformForm = async ({ form, table, req, row, res, getRowQuery, viewname
445
455
  * @param {object} opts.res
446
456
  * @returns {Promise<Form>}
447
457
  */
448
- const render = async ({ table, fields, viewname, columns, layout, row, req, state, res, auto_save, destination_type, isRemote, getRowQuery, }) => {
458
+ const render = async ({ table, fields, viewname, columns, layout, row, req, state, res, auto_save, destination_type, isRemote, getRowQuery, optionsQuery, }) => {
449
459
  const form = await getForm(table, viewname, columns, layout, state.id, req, isRemote);
450
460
  if (auto_save)
451
461
  form.onChange = `saveAndContinue(this, ${!isWeb(req) ? `'${form.action}'` : undefined})`;
@@ -477,7 +487,7 @@ const render = async ({ table, fields, viewname, columns, layout, row, req, stat
477
487
  }
478
488
  }
479
489
  });
480
- await form.fill_fkey_options();
490
+ await form.fill_fkey_options(false, optionsQuery);
481
491
  await transformForm({ form, table, req, row, res, getRowQuery, viewname });
482
492
  return renderForm(form, !isRemote && req.csrfToken ? req.csrfToken() : false);
483
493
  };
@@ -772,21 +782,22 @@ module.exports = {
772
782
  isRemote,
773
783
  });
774
784
  },
775
- // TODO ch move 'extra' to query signature (quick fix)
776
- async editManyQuery(state, extra) {
785
+ async editManyQuery(state, { limit, offset, orderBy, orderDesc, where }) {
777
786
  const table = await Table.findOne({ id: table_id });
778
787
  const fields = await table.getFields();
779
788
  const { joinFields, aggregations } = picked_fields_to_query(columns, fields);
780
789
  const qstate = await stateFieldsToWhere({ fields, state });
781
790
  const q = await stateFieldsToQuery({ state, fields });
791
+ if (where)
792
+ mergeIntoWhere(qstate, where);
782
793
  const rows = await table.getJoinedRows({
783
794
  where: qstate,
784
795
  joinFields,
785
796
  aggregations,
786
- ...(extra && extra.limit && { limit: extra.limit }),
787
- ...(extra && extra.offset && { offset: extra.offset }),
788
- ...(extra && extra.orderBy && { orderBy: extra.orderBy }),
789
- ...(extra && extra.orderDesc && { orderDesc: extra.orderDesc }),
797
+ ...(limit && { limit: limit }),
798
+ ...(offset && { offset: offset }),
799
+ ...(orderBy && { orderBy: orderBy }),
800
+ ...(orderDesc && { orderDesc: orderDesc }),
790
801
  ...q,
791
802
  });
792
803
  return {
@@ -848,6 +859,10 @@ module.exports = {
848
859
  return { json: { error: e.message || e } };
849
860
  }
850
861
  },
862
+ async optionsQuery(reftable_name, type, attributes, where) {
863
+ const rows = await db.select(reftable_name, type === "File" ? attributes.select_file_where : where);
864
+ return rows;
865
+ },
851
866
  }),
852
867
  routes: { run_action },
853
868
  configCheck: async (view) => {