@saltcorn/data 0.9.4-beta.9 → 0.9.4
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.
- package/dist/base-plugin/actions.d.ts +124 -58
- package/dist/base-plugin/actions.d.ts.map +1 -1
- package/dist/base-plugin/actions.js +94 -19
- package/dist/base-plugin/actions.js.map +1 -1
- package/dist/base-plugin/fieldviews.d.ts.map +1 -1
- package/dist/base-plugin/fieldviews.js +9 -1
- package/dist/base-plugin/fieldviews.js.map +1 -1
- package/dist/base-plugin/fileviews.d.ts +13 -0
- package/dist/base-plugin/fileviews.js +42 -2
- package/dist/base-plugin/fileviews.js.map +1 -1
- package/dist/base-plugin/index.d.ts +187 -183
- package/dist/base-plugin/index.d.ts.map +1 -1
- package/dist/base-plugin/types.d.ts.map +1 -1
- package/dist/base-plugin/types.js +19 -10
- package/dist/base-plugin/types.js.map +1 -1
- package/dist/base-plugin/viewtemplates/edit.d.ts +4 -1
- package/dist/base-plugin/viewtemplates/edit.d.ts.map +1 -1
- package/dist/base-plugin/viewtemplates/edit.js +109 -33
- package/dist/base-plugin/viewtemplates/edit.js.map +1 -1
- package/dist/base-plugin/viewtemplates/feed.d.ts.map +1 -1
- package/dist/base-plugin/viewtemplates/feed.js +4 -1
- package/dist/base-plugin/viewtemplates/feed.js.map +1 -1
- package/dist/base-plugin/viewtemplates/filter.d.ts.map +1 -1
- package/dist/base-plugin/viewtemplates/filter.js +66 -5
- package/dist/base-plugin/viewtemplates/filter.js.map +1 -1
- package/dist/base-plugin/viewtemplates/list.d.ts +3 -2
- package/dist/base-plugin/viewtemplates/list.d.ts.map +1 -1
- package/dist/base-plugin/viewtemplates/list.js +274 -38
- package/dist/base-plugin/viewtemplates/list.js.map +1 -1
- package/dist/base-plugin/viewtemplates/show.d.ts.map +1 -1
- package/dist/base-plugin/viewtemplates/show.js +80 -26
- package/dist/base-plugin/viewtemplates/show.js.map +1 -1
- package/dist/base-plugin/viewtemplates/viewable_fields.d.ts +2 -1
- package/dist/base-plugin/viewtemplates/viewable_fields.d.ts.map +1 -1
- package/dist/base-plugin/viewtemplates/viewable_fields.js +147 -23
- package/dist/base-plugin/viewtemplates/viewable_fields.js.map +1 -1
- package/dist/db/connect.d.ts.map +1 -1
- package/dist/db/connect.js +20 -0
- package/dist/db/connect.js.map +1 -1
- package/dist/db/fixtures.d.ts.map +1 -1
- package/dist/db/fixtures.js +47 -0
- package/dist/db/fixtures.js.map +1 -1
- package/dist/db/state.d.ts +5 -0
- package/dist/db/state.d.ts.map +1 -1
- package/dist/db/state.js +18 -0
- package/dist/db/state.js.map +1 -1
- package/dist/migrations/202402071125.d.ts +2 -0
- package/dist/migrations/202402071125.d.ts.map +1 -0
- package/dist/migrations/202402071125.js +4 -0
- package/dist/migrations/202402071125.js.map +1 -0
- package/dist/models/config.d.ts.map +1 -1
- package/dist/models/config.js +27 -0
- package/dist/models/config.js.map +1 -1
- package/dist/models/email.d.ts.map +1 -1
- package/dist/models/email.js +6 -2
- package/dist/models/email.js.map +1 -1
- package/dist/models/field.d.ts.map +1 -1
- package/dist/models/field.js +2 -2
- package/dist/models/field.js.map +1 -1
- package/dist/models/file.d.ts +2 -0
- package/dist/models/file.d.ts.map +1 -1
- package/dist/models/file.js +9 -0
- package/dist/models/file.js.map +1 -1
- package/dist/models/internal/query.d.ts +6 -0
- package/dist/models/internal/query.d.ts.map +1 -0
- package/dist/models/internal/query.js +86 -0
- package/dist/models/internal/query.js.map +1 -0
- package/dist/models/page.d.ts.map +1 -1
- package/dist/models/page.js +4 -0
- package/dist/models/page.js.map +1 -1
- package/dist/models/page_group.d.ts +1 -0
- package/dist/models/page_group.d.ts.map +1 -1
- package/dist/models/page_group.js +1 -0
- package/dist/models/page_group.js.map +1 -1
- package/dist/models/table.d.ts +18 -4
- package/dist/models/table.d.ts.map +1 -1
- package/dist/models/table.js +84 -52
- package/dist/models/table.js.map +1 -1
- package/dist/models/tag_entry.d.ts.map +1 -1
- package/dist/models/tag_entry.js +9 -0
- package/dist/models/tag_entry.js.map +1 -1
- package/dist/models/trigger.d.ts +3 -3
- package/dist/models/trigger.d.ts.map +1 -1
- package/dist/models/trigger.js +69 -7
- package/dist/models/trigger.js.map +1 -1
- package/dist/models/user.d.ts.map +1 -1
- package/dist/models/user.js +5 -4
- package/dist/models/user.js.map +1 -1
- package/dist/models/view.d.ts +1 -0
- package/dist/models/view.d.ts.map +1 -1
- package/dist/models/view.js +6 -0
- package/dist/models/view.js.map +1 -1
- package/dist/plugin-helper.d.ts.map +1 -1
- package/dist/plugin-helper.js +56 -17
- package/dist/plugin-helper.js.map +1 -1
- package/dist/tests/actions.test.js +143 -2
- package/dist/tests/actions.test.js.map +1 -1
- package/dist/tests/auth.test.js +101 -1
- package/dist/tests/auth.test.js.map +1 -1
- package/dist/tests/calc.test.js +20 -0
- package/dist/tests/calc.test.js.map +1 -1
- package/dist/tests/edit.test.js +558 -0
- package/dist/tests/edit.test.js.map +1 -1
- package/dist/tests/filter.test.d.ts +2 -0
- package/dist/tests/filter.test.d.ts.map +1 -0
- package/dist/tests/filter.test.js +438 -0
- package/dist/tests/filter.test.js.map +1 -0
- package/dist/tests/list.test.d.ts +2 -0
- package/dist/tests/list.test.d.ts.map +1 -0
- package/dist/tests/list.test.js +903 -0
- package/dist/tests/list.test.js.map +1 -0
- package/dist/tests/show.test.d.ts +2 -0
- package/dist/tests/show.test.d.ts.map +1 -0
- package/dist/tests/show.test.js +325 -0
- package/dist/tests/show.test.js.map +1 -0
- package/dist/tests/table.test.js +213 -56
- package/dist/tests/table.test.js.map +1 -1
- package/dist/tests/table_history.test.js +51 -0
- package/dist/tests/table_history.test.js.map +1 -1
- package/dist/tests/tag.test.js +1 -1
- package/dist/tests/tag.test.js.map +1 -1
- package/dist/tests/view.test.js +15 -1
- package/dist/tests/view.test.js.map +1 -1
- package/dist/utils.d.ts +2 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +19 -0
- package/dist/utils.js.map +1 -1
- package/package.json +8 -8
|
@@ -484,10 +484,10 @@ export namespace navigate {
|
|
|
484
484
|
} | undefined>;
|
|
485
485
|
export { run_9 as run };
|
|
486
486
|
}
|
|
487
|
-
export namespace
|
|
487
|
+
export namespace step_control_flow {
|
|
488
488
|
const description_11: string;
|
|
489
489
|
export { description_11 as description };
|
|
490
|
-
const configFields_11: {
|
|
490
|
+
const configFields_11: ({
|
|
491
491
|
name: string;
|
|
492
492
|
label: string;
|
|
493
493
|
type: string;
|
|
@@ -495,21 +495,76 @@ export namespace form_action {
|
|
|
495
495
|
attributes: {
|
|
496
496
|
options: string[];
|
|
497
497
|
};
|
|
498
|
-
|
|
498
|
+
showIf?: undefined;
|
|
499
|
+
} | {
|
|
500
|
+
name: string;
|
|
501
|
+
label: string;
|
|
502
|
+
type: string;
|
|
503
|
+
required: boolean;
|
|
504
|
+
showIf: {
|
|
505
|
+
control_action: string[];
|
|
506
|
+
};
|
|
507
|
+
attributes?: undefined;
|
|
508
|
+
})[];
|
|
499
509
|
export { configFields_11 as configFields };
|
|
500
|
-
export function run_10({ configuration: {
|
|
510
|
+
export function run_10({ row, user, configuration: { control_action, step } }: {
|
|
511
|
+
row: any;
|
|
512
|
+
user: any;
|
|
513
|
+
configuration: {
|
|
514
|
+
control_action: any;
|
|
515
|
+
step: any;
|
|
516
|
+
};
|
|
517
|
+
}): Promise<{
|
|
518
|
+
halt_steps: boolean;
|
|
519
|
+
goto_step?: undefined;
|
|
520
|
+
clear_return_values?: undefined;
|
|
521
|
+
} | {
|
|
522
|
+
goto_step: any;
|
|
523
|
+
halt_steps?: undefined;
|
|
524
|
+
clear_return_values?: undefined;
|
|
525
|
+
} | {
|
|
526
|
+
clear_return_values: boolean;
|
|
527
|
+
halt_steps?: undefined;
|
|
528
|
+
goto_step?: undefined;
|
|
529
|
+
} | undefined>;
|
|
530
|
+
export { run_10 as run };
|
|
531
|
+
}
|
|
532
|
+
export namespace form_action {
|
|
533
|
+
const description_12: string;
|
|
534
|
+
export { description_12 as description };
|
|
535
|
+
const requireRow_4: boolean;
|
|
536
|
+
export { requireRow_4 as requireRow };
|
|
537
|
+
const configFields_12: {
|
|
538
|
+
name: string;
|
|
539
|
+
label: string;
|
|
540
|
+
type: string;
|
|
541
|
+
required: boolean;
|
|
542
|
+
attributes: {
|
|
543
|
+
options: string[];
|
|
544
|
+
};
|
|
545
|
+
}[];
|
|
546
|
+
export { configFields_12 as configFields };
|
|
547
|
+
export function run_11({ row, table, configuration: { form_action } }: {
|
|
548
|
+
row: any;
|
|
549
|
+
table: any;
|
|
501
550
|
configuration: {
|
|
502
551
|
form_action: any;
|
|
503
552
|
};
|
|
504
553
|
}): Promise<{
|
|
505
554
|
eval_js: string;
|
|
555
|
+
set_fields?: undefined;
|
|
556
|
+
} | {
|
|
557
|
+
set_fields: {
|
|
558
|
+
[x: number]: any;
|
|
559
|
+
};
|
|
560
|
+
eval_js?: undefined;
|
|
506
561
|
}>;
|
|
507
|
-
export {
|
|
562
|
+
export { run_11 as run };
|
|
508
563
|
}
|
|
509
564
|
export namespace toast {
|
|
510
|
-
const
|
|
511
|
-
export {
|
|
512
|
-
const
|
|
565
|
+
const description_13: string;
|
|
566
|
+
export { description_13 as description };
|
|
567
|
+
const configFields_13: ({
|
|
513
568
|
name: string;
|
|
514
569
|
label: string;
|
|
515
570
|
type: string;
|
|
@@ -524,8 +579,8 @@ export namespace toast {
|
|
|
524
579
|
required: boolean;
|
|
525
580
|
attributes?: undefined;
|
|
526
581
|
})[];
|
|
527
|
-
export {
|
|
528
|
-
export function
|
|
582
|
+
export { configFields_13 as configFields };
|
|
583
|
+
export function run_12({ row, user, configuration: { type, notify_type, text } }: {
|
|
529
584
|
row: any;
|
|
530
585
|
user: any;
|
|
531
586
|
configuration: {
|
|
@@ -546,12 +601,12 @@ export namespace toast {
|
|
|
546
601
|
error?: undefined;
|
|
547
602
|
notify_success?: undefined;
|
|
548
603
|
}>;
|
|
549
|
-
export {
|
|
604
|
+
export { run_12 as run };
|
|
550
605
|
}
|
|
551
606
|
export namespace run_js_code {
|
|
552
|
-
const
|
|
553
|
-
export {
|
|
554
|
-
export function
|
|
607
|
+
const description_14: string;
|
|
608
|
+
export { description_14 as description };
|
|
609
|
+
export function configFields_14({ table }: {
|
|
555
610
|
table: any;
|
|
556
611
|
}): Promise<({
|
|
557
612
|
name: string;
|
|
@@ -591,17 +646,17 @@ export namespace run_js_code {
|
|
|
591
646
|
help?: undefined;
|
|
592
647
|
showIf?: undefined;
|
|
593
648
|
})[]>;
|
|
594
|
-
export {
|
|
649
|
+
export { configFields_14 as configFields };
|
|
595
650
|
export { run_code as run };
|
|
596
651
|
}
|
|
597
652
|
export namespace duplicate_row_prefill_edit {
|
|
598
|
-
export function
|
|
653
|
+
export function configFields_15({ table }: {
|
|
599
654
|
table: any;
|
|
600
655
|
}): Promise<any[]>;
|
|
601
|
-
export {
|
|
602
|
-
const
|
|
603
|
-
export {
|
|
604
|
-
export function
|
|
656
|
+
export { configFields_15 as configFields };
|
|
657
|
+
const requireRow_5: boolean;
|
|
658
|
+
export { requireRow_5 as requireRow };
|
|
659
|
+
export function run_13({ row, table, configuration: { viewname, ...flds }, user }: {
|
|
605
660
|
row: any;
|
|
606
661
|
table: any;
|
|
607
662
|
configuration: {
|
|
@@ -612,12 +667,12 @@ export namespace duplicate_row_prefill_edit {
|
|
|
612
667
|
}): Promise<{
|
|
613
668
|
goto: string;
|
|
614
669
|
}>;
|
|
615
|
-
export {
|
|
670
|
+
export { run_13 as run };
|
|
616
671
|
}
|
|
617
672
|
export namespace set_user_language {
|
|
618
|
-
const
|
|
619
|
-
export {
|
|
620
|
-
export function
|
|
673
|
+
const description_15: string;
|
|
674
|
+
export { description_15 as description };
|
|
675
|
+
export function configFields_16({ table }: {
|
|
621
676
|
table: any;
|
|
622
677
|
}): Promise<{
|
|
623
678
|
name: string;
|
|
@@ -630,8 +685,8 @@ export namespace set_user_language {
|
|
|
630
685
|
}[];
|
|
631
686
|
};
|
|
632
687
|
}[]>;
|
|
633
|
-
export {
|
|
634
|
-
export function
|
|
688
|
+
export { configFields_16 as configFields };
|
|
689
|
+
export function run_14({ configuration: { language }, user, req, res }: {
|
|
635
690
|
configuration: {
|
|
636
691
|
language: any;
|
|
637
692
|
};
|
|
@@ -641,12 +696,12 @@ export namespace set_user_language {
|
|
|
641
696
|
}): Promise<{
|
|
642
697
|
reload_page: boolean;
|
|
643
698
|
}>;
|
|
644
|
-
export {
|
|
699
|
+
export { run_14 as run };
|
|
645
700
|
}
|
|
646
701
|
export namespace sync_table_from_external {
|
|
647
|
-
const
|
|
648
|
-
export {
|
|
649
|
-
export function
|
|
702
|
+
const description_16: string;
|
|
703
|
+
export { description_16 as description };
|
|
704
|
+
export function configFields_17({ table }: {
|
|
650
705
|
table: any;
|
|
651
706
|
}): Promise<({
|
|
652
707
|
name: string;
|
|
@@ -701,60 +756,71 @@ export namespace sync_table_from_external {
|
|
|
701
756
|
attributes?: undefined;
|
|
702
757
|
default?: undefined;
|
|
703
758
|
})[]>;
|
|
704
|
-
export {
|
|
705
|
-
export function
|
|
759
|
+
export { configFields_17 as configFields };
|
|
760
|
+
export function run_15({ configuration: { row_expr, table_src, table_dest, pk_field, delete_rows, match_field_names, }, user, ...rest }: {
|
|
706
761
|
row: object;
|
|
707
762
|
configuration: object;
|
|
708
763
|
user: object;
|
|
709
764
|
rest: any;
|
|
710
765
|
}): Promise<boolean | object>;
|
|
711
|
-
export {
|
|
766
|
+
export { run_15 as run };
|
|
712
767
|
}
|
|
713
768
|
export namespace reload_embedded_view {
|
|
714
|
-
const
|
|
715
|
-
export {
|
|
716
|
-
export function
|
|
769
|
+
const description_17: string;
|
|
770
|
+
export { description_17 as description };
|
|
771
|
+
export function configFields_18(): Promise<({
|
|
717
772
|
name: string;
|
|
718
773
|
label: string;
|
|
774
|
+
class: string;
|
|
719
775
|
type: string;
|
|
720
776
|
required: boolean;
|
|
721
777
|
attributes: {
|
|
722
778
|
options: any[];
|
|
723
779
|
};
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
|
|
780
|
+
} | {
|
|
781
|
+
name: string;
|
|
782
|
+
label: string;
|
|
783
|
+
type: string;
|
|
784
|
+
class: string;
|
|
785
|
+
required?: undefined;
|
|
786
|
+
attributes?: undefined;
|
|
787
|
+
})[]>;
|
|
788
|
+
export { configFields_18 as configFields };
|
|
789
|
+
export function run_16({ row, user, configuration: { view, new_state_fml } }: {
|
|
790
|
+
row: any;
|
|
791
|
+
user: any;
|
|
727
792
|
configuration: {
|
|
728
793
|
view: any;
|
|
794
|
+
new_state_fml: any;
|
|
729
795
|
};
|
|
730
796
|
}): Promise<{
|
|
731
797
|
eval_js: string;
|
|
732
798
|
}>;
|
|
733
|
-
export {
|
|
799
|
+
export { run_16 as run };
|
|
734
800
|
}
|
|
735
801
|
export namespace sleep {
|
|
736
|
-
const
|
|
737
|
-
export {
|
|
738
|
-
const
|
|
802
|
+
const description_18: string;
|
|
803
|
+
export { description_18 as description };
|
|
804
|
+
const configFields_19: {
|
|
739
805
|
name: string;
|
|
740
806
|
label: string;
|
|
741
807
|
type: string;
|
|
742
808
|
required: boolean;
|
|
743
809
|
}[];
|
|
744
|
-
export {
|
|
745
|
-
export function
|
|
810
|
+
export { configFields_19 as configFields };
|
|
811
|
+
export function run_17({ configuration: { seconds } }: {
|
|
746
812
|
configuration: {
|
|
747
813
|
seconds: any;
|
|
748
814
|
};
|
|
749
815
|
}): Promise<{
|
|
750
816
|
eval_js: string;
|
|
751
817
|
}>;
|
|
752
|
-
export {
|
|
818
|
+
export { run_17 as run };
|
|
753
819
|
}
|
|
754
820
|
export namespace notify_user {
|
|
755
|
-
const
|
|
756
|
-
export {
|
|
757
|
-
export function
|
|
821
|
+
const description_19: string;
|
|
822
|
+
export { description_19 as description };
|
|
823
|
+
export function configFields_20(): ({
|
|
758
824
|
name: string;
|
|
759
825
|
label: string;
|
|
760
826
|
type: string;
|
|
@@ -765,18 +831,18 @@ export namespace notify_user {
|
|
|
765
831
|
required: boolean;
|
|
766
832
|
type: string;
|
|
767
833
|
})[];
|
|
768
|
-
export {
|
|
769
|
-
export function
|
|
834
|
+
export { configFields_20 as configFields };
|
|
835
|
+
export function run_18({ row, user, configuration: { title, body, link, user_spec }, }: {
|
|
770
836
|
row: object;
|
|
771
837
|
configuration: object;
|
|
772
838
|
user: object;
|
|
773
839
|
}): Promise<void>;
|
|
774
|
-
export {
|
|
840
|
+
export { run_18 as run };
|
|
775
841
|
}
|
|
776
842
|
export namespace convert_session_to_user {
|
|
777
|
-
const
|
|
778
|
-
export {
|
|
779
|
-
export function
|
|
843
|
+
const description_20: string;
|
|
844
|
+
export { description_20 as description };
|
|
845
|
+
export function configFields_21({ table }: {
|
|
780
846
|
table: any;
|
|
781
847
|
}): Promise<({
|
|
782
848
|
name: string;
|
|
@@ -797,8 +863,8 @@ export namespace convert_session_to_user {
|
|
|
797
863
|
input_type?: undefined;
|
|
798
864
|
options?: undefined;
|
|
799
865
|
})[]>;
|
|
800
|
-
export {
|
|
801
|
-
export function
|
|
866
|
+
export { configFields_21 as configFields };
|
|
867
|
+
export function run_19({ row, configuration: { table_name, session_field, user_field }, user, }: {
|
|
802
868
|
row: any;
|
|
803
869
|
configuration: {
|
|
804
870
|
table_name: any;
|
|
@@ -807,7 +873,7 @@ export namespace convert_session_to_user {
|
|
|
807
873
|
};
|
|
808
874
|
user: any;
|
|
809
875
|
}): Promise<void>;
|
|
810
|
-
export {
|
|
876
|
+
export { run_19 as run };
|
|
811
877
|
}
|
|
812
878
|
export {};
|
|
813
879
|
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../base-plugin/actions.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../base-plugin/actions.js"],"names":[],"mappings":"AAyEA;;;;;;;;;GASG;AACH;;;;;;;;;;iBA4EC;;;;;;;;;;;;;;IAuCiB;;;;;;;;;;;;;;;;;;;;;;;;;;;SAqBb;;IAQI;;;;sBAWJ;;;;;;;;;;;;;;;;;;;IA+BI;;;wBAQJ;;;;;;IAca;;;;;;SAeb;;IAUI;;;;;wBA0CJ;;;;;;IAea;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA+Ib;;;IAUI;;;;;wBAqHJ;;;;;;IAea;;;;;;;;SAYb;;;;IAUI;;;;;wBAsBJ;;;;;;IAaa,0CAAQ;;;;IASjB;;;;wBAKJ;;;;;;IAgBa;;;;;;;;;;;;;;;;;;;;;;UAiBb;;IAMI;;sBAgBJ;;;;;;IAea;;;;;;;;;;;;;;;;;;UAmBb;;IAUI;;;;;;kCAiBJ;;;;;;IAca;;;;;;;;;;;;;;;;;;;;;;;;UA0Bb;;;;IAEI;;;;;;;;;qBAkBJ;;;;;;;;;;;;;;;;;;;;;;;;;;IAuCI;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAkBJ;;;;;;;;;;;;;;;;;;;;;;;;;;IA2BI;;;;;;;;;;;;;;;;;;;mBAYJ;;;;;;;;;;;;;;;;;;IAuBI;;;;;;;;;;;;;;OA6BJ;;;;;;;;;;;;;;;;;;;;;;IA2BI;;;;;;;;;;;;;;;;;;;;OAYJ;;;;;;IAea;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA+Eb;;;;;IAQa;;uBAsBb;;;;IAEI;;;;;;;;;;OAUJ;;;;;;IASa;;;;;;;;;;;;SAcb;;IACI;;;;;;;;;OAgBJ;;;;;;IAea;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAyDb;;IASI;;;;;kCAmFJ;;;;;;IAIa;;;;;;;;;;;;;;;;UAkBb;;IACI;;;;;;;;;OAQJ;;;;;;;;;;;;;IAYI;;;;;;OAMJ;;;;;;IAIa;;;;;;;;;;SAsBb;;IAQI;;;;sBAmBJ;;;;;;IAMa;;;;;;;;;;;;;;;;;;;;UA2Cb;;IACI;;;;;;;;sBAeJ"}
|
|
@@ -18,22 +18,29 @@ const Notification = require("../models/notification");
|
|
|
18
18
|
const { getMailTransport, viewToEmailHtml, loadAttachments, getFileAggregations, mjml2html, } = require("../models/email");
|
|
19
19
|
const { get_async_expression_function, recalculate_for_stored, eval_expression, } = require("../models/expression");
|
|
20
20
|
const { div, code, a, span } = require("@saltcorn/markup/tags");
|
|
21
|
-
const { sleep, getSessionId, urlStringToObject, dollarizeObject, } = require("../utils");
|
|
21
|
+
const { sleep, getSessionId, urlStringToObject, dollarizeObject, objectToQueryString, interpolate, } = require("../utils");
|
|
22
22
|
const db = require("../db");
|
|
23
|
-
const { isNode } = require("../utils");
|
|
23
|
+
const { isNode, ppVal } = require("../utils");
|
|
24
24
|
const { available_languages } = require("../models/config");
|
|
25
|
-
const _ = require("underscore");
|
|
26
25
|
//action use cases: field modify, like/rate (insert join), notify, send row to webhook
|
|
27
26
|
// todo add translation
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
const consoleInterceptor = (state) => {
|
|
28
|
+
const handle = (printer, level, message, optionalParams) => {
|
|
29
|
+
printer(message, ...optionalParams);
|
|
30
|
+
if (state.hasJoinedLogSockets && state.logLevel >= level) {
|
|
31
|
+
const s = ppVal(message);
|
|
32
|
+
state.emitLog(state.tenant || "public", level, optionalParams.length === 0
|
|
33
|
+
? s
|
|
34
|
+
: `${s} ${optionalParams.map((val) => ppVal(val)).join(" ")}`);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
log: (message, ...optionalParams) => handle(console.log, 5, message, optionalParams),
|
|
39
|
+
info: (message, ...optionalParams) => handle(console.info, 5, message, optionalParams),
|
|
40
|
+
debug: (message, ...optionalParams) => handle(console.debug, 5, message, optionalParams),
|
|
41
|
+
warn: (message, ...optionalParams) => handle(console.warn, 2, message, optionalParams),
|
|
42
|
+
error: (message, ...optionalParams) => handle(console.error, 1, message, optionalParams),
|
|
43
|
+
};
|
|
37
44
|
};
|
|
38
45
|
/**
|
|
39
46
|
* @param opts
|
|
@@ -59,7 +66,7 @@ const run_code = async ({ row, table, channel, configuration: { code, run_where
|
|
|
59
66
|
const Actions = {};
|
|
60
67
|
Object.entries(getState().actions).forEach(([k, v]) => {
|
|
61
68
|
Actions[k] = (args = {}) => {
|
|
62
|
-
v.run({ row, table, user, configuration: args, ...rest, ...args });
|
|
69
|
+
return v.run({ row, table, user, configuration: args, ...rest, ...args });
|
|
63
70
|
};
|
|
64
71
|
});
|
|
65
72
|
const trigger_actions = await Trigger.find({
|
|
@@ -68,7 +75,7 @@ const run_code = async ({ row, table, channel, configuration: { code, run_where
|
|
|
68
75
|
for (const trigger of trigger_actions) {
|
|
69
76
|
const state_action = getState().actions[trigger.action];
|
|
70
77
|
Actions[trigger.name] = (args = {}) => {
|
|
71
|
-
state_action.run({
|
|
78
|
+
return state_action.run({
|
|
72
79
|
row,
|
|
73
80
|
table,
|
|
74
81
|
configuration: trigger.configuration,
|
|
@@ -87,7 +94,7 @@ const run_code = async ({ row, table, channel, configuration: { code, run_where
|
|
|
87
94
|
table,
|
|
88
95
|
row,
|
|
89
96
|
user,
|
|
90
|
-
console,
|
|
97
|
+
console: consoleInterceptor(getState()),
|
|
91
98
|
Actions,
|
|
92
99
|
emitEvent,
|
|
93
100
|
sleep,
|
|
@@ -99,12 +106,15 @@ const run_code = async ({ row, table, channel, configuration: { code, run_where
|
|
|
99
106
|
View,
|
|
100
107
|
EventLog,
|
|
101
108
|
Buffer,
|
|
109
|
+
Notification,
|
|
102
110
|
setTimeout,
|
|
103
111
|
require,
|
|
104
112
|
setConfig: (k, v) => sysState.setConfig(k, v),
|
|
105
113
|
getConfig: (k) => sysState.getConfig(k),
|
|
106
114
|
channel: table ? table.name : channel,
|
|
107
115
|
session_id: rest.req && getSessionId(rest.req),
|
|
116
|
+
request_headers: rest?.req?.headers,
|
|
117
|
+
request_ip: rest?.req?.ip,
|
|
108
118
|
...(row || {}),
|
|
109
119
|
...getState().function_context,
|
|
110
120
|
...rest,
|
|
@@ -484,7 +494,8 @@ module.exports = {
|
|
|
484
494
|
};
|
|
485
495
|
try {
|
|
486
496
|
const sendres = await getMailTransport().sendMail(email);
|
|
487
|
-
|
|
497
|
+
getState().log(5, `send_email result: ${JSON.stringify(sendres)}`);
|
|
498
|
+
if (confirm_field && sendres.accepted.length > 0) {
|
|
488
499
|
const confirm_fld = table.getField(confirm_field);
|
|
489
500
|
if (confirm_fld && confirm_fld.type.name === "Date")
|
|
490
501
|
await table.updateRow({ [confirm_field]: new Date() }, row[table.pk_name]);
|
|
@@ -804,6 +815,44 @@ module.exports = {
|
|
|
804
815
|
}
|
|
805
816
|
},
|
|
806
817
|
},
|
|
818
|
+
step_control_flow: {
|
|
819
|
+
/**
|
|
820
|
+
* @param {object} opts
|
|
821
|
+
* @param {*} opts.table
|
|
822
|
+
* @returns {Promise<object[]>}
|
|
823
|
+
*/
|
|
824
|
+
description: "Step control flow",
|
|
825
|
+
configFields: [
|
|
826
|
+
{
|
|
827
|
+
name: "control_action",
|
|
828
|
+
label: "Control action",
|
|
829
|
+
type: "String",
|
|
830
|
+
required: true,
|
|
831
|
+
attributes: {
|
|
832
|
+
options: ["Halt steps", "Goto step", "Clear return values"],
|
|
833
|
+
},
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
name: "step",
|
|
837
|
+
label: "Step",
|
|
838
|
+
type: "Integer",
|
|
839
|
+
required: true,
|
|
840
|
+
showIf: { control_action: ["Goto step"] },
|
|
841
|
+
},
|
|
842
|
+
],
|
|
843
|
+
run: async ({ row, user, configuration: { control_action, step } }) => {
|
|
844
|
+
switch (control_action) {
|
|
845
|
+
case "Halt steps":
|
|
846
|
+
return { halt_steps: true };
|
|
847
|
+
case "Goto step":
|
|
848
|
+
return { goto_step: step };
|
|
849
|
+
case "Clear return values":
|
|
850
|
+
return { clear_return_values: true };
|
|
851
|
+
default:
|
|
852
|
+
break;
|
|
853
|
+
}
|
|
854
|
+
},
|
|
855
|
+
},
|
|
807
856
|
form_action: {
|
|
808
857
|
/**
|
|
809
858
|
* @param {object} opts
|
|
@@ -811,6 +860,7 @@ module.exports = {
|
|
|
811
860
|
* @returns {Promise<object[]>}
|
|
812
861
|
*/
|
|
813
862
|
description: "Action on form in Edit view",
|
|
863
|
+
requireRow: true,
|
|
814
864
|
configFields: [
|
|
815
865
|
{
|
|
816
866
|
name: "form_action",
|
|
@@ -822,12 +872,22 @@ module.exports = {
|
|
|
822
872
|
},
|
|
823
873
|
},
|
|
824
874
|
],
|
|
825
|
-
run: async ({ configuration: { form_action } }) => {
|
|
875
|
+
run: async ({ row, table, configuration: { form_action } }) => {
|
|
826
876
|
const jqGet = `$('form[data-viewname="'+viewname+'"]')`;
|
|
827
877
|
switch (form_action) {
|
|
828
878
|
case "Submit":
|
|
829
879
|
return { eval_js: jqGet + ".submit()" };
|
|
830
880
|
case "Save":
|
|
881
|
+
if (!row[table.pk_name]) {
|
|
882
|
+
//we will save server side so we can set id
|
|
883
|
+
const result = await table.tryInsertRow(row);
|
|
884
|
+
if (result.success)
|
|
885
|
+
return { set_fields: { [table.pk_name]: result.success } };
|
|
886
|
+
else {
|
|
887
|
+
getState().log(3, `form_actions Save failed server side, result: ${JSON.stringify(result)} row ${JSON.stringify(row)}`);
|
|
888
|
+
return { eval_js: `return saveAndContinueAsync(${jqGet})` };
|
|
889
|
+
}
|
|
890
|
+
}
|
|
831
891
|
return { eval_js: `return saveAndContinueAsync(${jqGet})` };
|
|
832
892
|
case "Reset":
|
|
833
893
|
return { eval_js: jqGet + ".trigger('reset')" };
|
|
@@ -1178,14 +1238,29 @@ module.exports = {
|
|
|
1178
1238
|
{
|
|
1179
1239
|
name: "view",
|
|
1180
1240
|
label: "View to refresh",
|
|
1241
|
+
class: "selectizable",
|
|
1181
1242
|
type: "String",
|
|
1182
1243
|
required: true,
|
|
1183
1244
|
attributes: { options: views.map((v) => v.select_option) },
|
|
1184
1245
|
},
|
|
1246
|
+
{
|
|
1247
|
+
name: "new_state_fml",
|
|
1248
|
+
label: "New state formula",
|
|
1249
|
+
type: "String",
|
|
1250
|
+
class: "validate-expression",
|
|
1251
|
+
},
|
|
1185
1252
|
];
|
|
1186
1253
|
},
|
|
1187
|
-
run: async ({ configuration: { view } }) => {
|
|
1188
|
-
|
|
1254
|
+
run: async ({ row, user, configuration: { view, new_state_fml } }) => {
|
|
1255
|
+
if (new_state_fml) {
|
|
1256
|
+
const new_state = eval_expression(new_state_fml, row || {}, user);
|
|
1257
|
+
const newqs = objectToQueryString(new_state);
|
|
1258
|
+
return {
|
|
1259
|
+
eval_js: `reload_embedded_view('${view}', '${newqs}')`,
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1262
|
+
else
|
|
1263
|
+
return { eval_js: `reload_embedded_view('${view}')` };
|
|
1189
1264
|
},
|
|
1190
1265
|
},
|
|
1191
1266
|
sleep: {
|