adminforth 2.17.0-next.6 → 2.17.0-next.61

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 (114) hide show
  1. package/commands/callTsProxy.js +2 -1
  2. package/commands/createApp/templates/adminuser.ts.hbs +2 -1
  3. package/commands/createApp/templates/index.ts.hbs +3 -2
  4. package/commands/createCustomComponent/main.js +0 -3
  5. package/commands/createCustomComponent/templates/customCrud/afterBreadcrumbs.vue.hbs +4 -2
  6. package/commands/createCustomComponent/templates/customCrud/beforeActionButtons.vue.hbs +3 -2
  7. package/commands/createCustomComponent/templates/customCrud/beforeBreadcrumbs.vue.hbs +4 -2
  8. package/commands/createCustomComponent/templates/customCrud/bottom.vue.hbs +4 -2
  9. package/commands/createCustomComponent/templates/customCrud/threeDotsDropdownItems.vue.hbs +4 -2
  10. package/commands/createPlugin/templates/index.ts.hbs +4 -0
  11. package/dist/auth.d.ts +2 -2
  12. package/dist/auth.d.ts.map +1 -1
  13. package/dist/auth.js +17 -10
  14. package/dist/auth.js.map +1 -1
  15. package/dist/basePlugin.d.ts +1 -0
  16. package/dist/basePlugin.d.ts.map +1 -1
  17. package/dist/basePlugin.js +4 -2
  18. package/dist/basePlugin.js.map +1 -1
  19. package/dist/dataConnectors/baseConnector.d.ts +4 -0
  20. package/dist/dataConnectors/baseConnector.d.ts.map +1 -1
  21. package/dist/dataConnectors/baseConnector.js +103 -14
  22. package/dist/dataConnectors/baseConnector.js.map +1 -1
  23. package/dist/dataConnectors/clickhouse.d.ts +2 -0
  24. package/dist/dataConnectors/clickhouse.d.ts.map +1 -1
  25. package/dist/dataConnectors/clickhouse.js +15 -4
  26. package/dist/dataConnectors/clickhouse.js.map +1 -1
  27. package/dist/dataConnectors/mongo.d.ts +8 -1
  28. package/dist/dataConnectors/mongo.d.ts.map +1 -1
  29. package/dist/dataConnectors/mongo.js +72 -28
  30. package/dist/dataConnectors/mongo.js.map +1 -1
  31. package/dist/dataConnectors/mysql.d.ts +2 -0
  32. package/dist/dataConnectors/mysql.d.ts.map +1 -1
  33. package/dist/dataConnectors/mysql.js +22 -23
  34. package/dist/dataConnectors/mysql.js.map +1 -1
  35. package/dist/dataConnectors/postgres.d.ts +2 -0
  36. package/dist/dataConnectors/postgres.d.ts.map +1 -1
  37. package/dist/dataConnectors/postgres.js +23 -26
  38. package/dist/dataConnectors/postgres.js.map +1 -1
  39. package/dist/dataConnectors/sqlite.d.ts +2 -0
  40. package/dist/dataConnectors/sqlite.d.ts.map +1 -1
  41. package/dist/dataConnectors/sqlite.js +19 -19
  42. package/dist/dataConnectors/sqlite.js.map +1 -1
  43. package/dist/index.d.ts +21 -40
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +77 -54
  46. package/dist/index.js.map +1 -1
  47. package/dist/modules/codeInjector.d.ts.map +1 -1
  48. package/dist/modules/codeInjector.js +45 -63
  49. package/dist/modules/codeInjector.js.map +1 -1
  50. package/dist/modules/configValidator.d.ts.map +1 -1
  51. package/dist/modules/configValidator.js +14 -9
  52. package/dist/modules/configValidator.js.map +1 -1
  53. package/dist/modules/logger.d.ts +5 -0
  54. package/dist/modules/logger.d.ts.map +1 -0
  55. package/dist/modules/logger.js +16 -0
  56. package/dist/modules/logger.js.map +1 -0
  57. package/dist/modules/restApi.d.ts.map +1 -1
  58. package/dist/modules/restApi.js +31 -24
  59. package/dist/modules/restApi.js.map +1 -1
  60. package/dist/modules/socketBroker.d.ts.map +1 -1
  61. package/dist/modules/socketBroker.js +6 -5
  62. package/dist/modules/socketBroker.js.map +1 -1
  63. package/dist/modules/styles.js +1 -1
  64. package/dist/servers/express.d.ts.map +1 -1
  65. package/dist/servers/express.js +11 -11
  66. package/dist/servers/express.js.map +1 -1
  67. package/dist/spa/package-lock.json +0 -13
  68. package/dist/spa/package.json +0 -1
  69. package/dist/spa/src/App.vue +6 -3
  70. package/dist/spa/src/adminforth.ts +60 -1
  71. package/dist/spa/src/afcl/DatePicker.vue +0 -1
  72. package/dist/spa/src/afcl/Dialog.vue +2 -2
  73. package/dist/spa/src/afcl/Dropzone.vue +6 -4
  74. package/dist/spa/src/afcl/Select.vue +1 -1
  75. package/dist/spa/src/afcl/Table.vue +7 -5
  76. package/dist/spa/src/afcl/Tooltip.vue +38 -4
  77. package/dist/spa/src/components/ColumnValueInput.vue +14 -1
  78. package/dist/spa/src/components/CustomDateRangePicker.vue +0 -2
  79. package/dist/spa/src/components/CustomRangePicker.vue +9 -6
  80. package/dist/spa/src/components/Filters.vue +4 -4
  81. package/dist/spa/src/components/ListActionsThreeDots.vue +235 -0
  82. package/dist/spa/src/components/ResourceForm.vue +4 -4
  83. package/dist/spa/src/components/ResourceListTable.vue +30 -16
  84. package/dist/spa/src/components/ResourceListTableVirtual.vue +34 -18
  85. package/dist/spa/src/components/Sidebar.vue +4 -2
  86. package/dist/spa/src/components/ThreeDotsMenu.vue +35 -20
  87. package/dist/spa/src/composables/useFrontendApi.ts +8 -4
  88. package/dist/spa/src/renderers/CompactField.vue +3 -2
  89. package/dist/spa/src/renderers/CompactUUID.vue +3 -2
  90. package/dist/spa/src/renderers/RichText.vue +15 -0
  91. package/dist/spa/src/stores/core.ts +3 -2
  92. package/dist/spa/src/stores/filters.ts +1 -1
  93. package/dist/spa/src/stores/toast.ts +1 -2
  94. package/dist/spa/src/types/Back.ts +419 -18
  95. package/dist/spa/src/types/Common.ts +7 -14
  96. package/dist/spa/src/types/FrontendAPI.ts +27 -11
  97. package/dist/spa/src/views/CreateView.vue +23 -31
  98. package/dist/spa/src/views/EditView.vue +27 -31
  99. package/dist/spa/src/views/ListView.vue +20 -10
  100. package/dist/spa/src/views/SettingsView.vue +3 -2
  101. package/dist/spa/src/views/ShowView.vue +7 -6
  102. package/dist/types/Back.d.ts +371 -44
  103. package/dist/types/Back.d.ts.map +1 -1
  104. package/dist/types/Back.js +6 -0
  105. package/dist/types/Back.js.map +1 -1
  106. package/dist/types/Common.d.ts +8 -15
  107. package/dist/types/Common.d.ts.map +1 -1
  108. package/dist/types/Common.js +2 -0
  109. package/dist/types/Common.js.map +1 -1
  110. package/dist/types/FrontendAPI.d.ts +34 -11
  111. package/dist/types/FrontendAPI.d.ts.map +1 -1
  112. package/dist/types/FrontendAPI.js.map +1 -1
  113. package/package.json +4 -1
  114. package/commands/createCustomComponent/templates/customCrud/saveButton.vue.hbs +0 -28
@@ -1,7 +1,7 @@
1
1
  import type { Express, Request } from 'express';
2
2
  import type { Writable } from 'stream';
3
3
 
4
- import { ActionCheckSource, AdminForthFilterOperators, AdminForthSortDirections, AllowedActionsEnum,
4
+ import { ActionCheckSource, AdminForthFilterOperators, AdminForthSortDirections, AllowedActionsEnum, AdminForthResourcePages,
5
5
  type AdminForthComponentDeclaration,
6
6
  type AdminForthResourceCommon,
7
7
  type AdminUser, type AllowedActionsResolved,
@@ -12,7 +12,6 @@ import { ActionCheckSource, AdminForthFilterOperators, AdminForthSortDirections,
12
12
  type AdminForthComponentDeclarationFull,
13
13
  type AdminForthConfigMenuItem,
14
14
  type AnnouncementBadgeResponse,
15
- AdminForthResourcePages,
16
15
  type AdminForthResourceColumnInputCommon,
17
16
  } from './Common.js';
18
17
 
@@ -129,7 +128,7 @@ export interface IAdminForthSingleFilter {
129
128
  operator?: AdminForthFilterOperators.EQ | AdminForthFilterOperators.NE
130
129
  | AdminForthFilterOperators.GT | AdminForthFilterOperators.LT | AdminForthFilterOperators.GTE
131
130
  | AdminForthFilterOperators.LTE | AdminForthFilterOperators.LIKE | AdminForthFilterOperators.ILIKE
132
- | AdminForthFilterOperators.IN | AdminForthFilterOperators.NIN;
131
+ | AdminForthFilterOperators.IN | AdminForthFilterOperators.NIN | AdminForthFilterOperators.IS_EMPTY | AdminForthFilterOperators.IS_NOT_EMPTY;
133
132
  value?: any;
134
133
  rightField?: string;
135
134
  insecureRawSQL?: string;
@@ -307,7 +306,7 @@ export interface IAdminForthAuth {
307
306
 
308
307
  removeCustomCookie({response, name}: {response: any, name: string}): void;
309
308
 
310
- setCustomCookie({response, payload}: {response: any, payload: {name: string, value: string, expiry: number, expirySeconds: number, httpOnly: boolean}}): void;
309
+ setCustomCookie({response, payload}: {response: any, payload: {name: string, value: string, expiry?: number, expirySeconds: number, httpOnly: boolean}}): void;
311
310
 
312
311
  getCustomCookie({cookies, name}: {cookies: {key: string, value: string}[], name: string}): string | null;
313
312
 
@@ -360,17 +359,16 @@ export interface IAdminForth {
360
359
  tr(msg: string, category: string, lang: string, params: any, pluralizationNumber?: number): Promise<string>;
361
360
 
362
361
  createResourceRecord(
363
- params: { resource: AdminForthResource, record: any, adminUser: AdminUser, extra?: HttpExtra }
364
- ): Promise<{ error?: string, createdRecord?: any, newRecordId?: any }>;
362
+ params: CreateResourceRecordParams,
363
+ ): Promise<CreateResourceRecordResult>;
365
364
 
366
365
  updateResourceRecord(
367
- params: { resource: AdminForthResource, recordId: any, record: any, oldRecord: any, adminUser: AdminUser, extra?: HttpExtra, updates?: never }
368
- | { resource: AdminForthResource, recordId: any, record?: never, oldRecord: any, adminUser: AdminUser, extra?: HttpExtra, updates: any }
369
- ): Promise<{ error?: string }>;
366
+ params: UpdateResourceRecordParams,
367
+ ): Promise<UpdateResourceRecordResult>;
370
368
 
371
369
  deleteResourceRecord(
372
- params: { resource: AdminForthResource, recordId: string, adminUser: AdminUser, record: any, extra?: HttpExtra }
373
- ): Promise<{ error?: string }>;
370
+ params: DeleteResourceRecordParams,
371
+ ): Promise<DeleteResourceRecordResult>;
374
372
 
375
373
  auth: IAdminForthAuth;
376
374
 
@@ -469,6 +467,13 @@ export interface IAdminForthPlugin {
469
467
  instanceUniqueRepresentation(pluginOptions: any) : string;
470
468
 
471
469
 
470
+ /**
471
+ * If this method returns true, AdminForth will allow only one instance of plugin per whole app
472
+ * (only for case when we are creating copy of resource and activating plugins)
473
+ * If false, multiple instances of plugin can be installed on different resources.
474
+ */
475
+ shouldHaveSingleInstancePerWholeApp?(): boolean;
476
+
472
477
  /**
473
478
  * Optional method which will be called after AdminForth discovers all resources and their columns.
474
479
  * Can be used to validate types of columns, check if some columns are missing, etc.
@@ -528,49 +533,347 @@ export interface HttpExtra {
528
533
  cookies: Record<string, string>,
529
534
  requestUrl: string,
530
535
  meta?: any,
536
+ response: IAdminForthHttpResponse
531
537
  }
538
+
539
+ /**
540
+ * Result of {@link IAdminForth.createResourceRecord}.
541
+ */
542
+ export type CreateResourceRecordResult = {
543
+ /** Optional error message if creation failed. */
544
+ error?: string;
545
+
546
+ /** Created record as returned from the connector. */
547
+ createdRecord?: any;
548
+
549
+ /**
550
+ * Optional id of an existing record to redirect to
551
+ * (used when a beforeSave hook aborts creation and supplies newRecordId, allows to implement programmatic creation via API).
552
+ */
553
+ newRecordId?: any;
554
+ };
555
+
556
+ /**
557
+ * Parameters for {@link IAdminForth.createResourceRecord}.
558
+ */
559
+ export type CreateResourceRecordParams = {
560
+ /**
561
+ * Resource configuration used to create a record.
562
+ */
563
+ resource: AdminForthResource;
564
+
565
+ /**
566
+ * Record data to create.
567
+ */
568
+ record: any;
569
+
570
+ /**
571
+ * Admin user performing the action.
572
+ */
573
+ adminUser: AdminUser;
574
+
575
+ /**
576
+ * HTTP response object.
577
+ *
578
+ * @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
579
+ */
580
+ response?: IAdminForthHttpResponse;
581
+
582
+ /**
583
+ * Extra HTTP information. Prefer using extra.response over the top-level response field.
584
+ */
585
+ extra?: HttpExtra;
586
+ };
587
+
588
+ /**
589
+ * Parameters for {@link IAdminForth.updateResourceRecord}.
590
+ */
591
+ export type UpdateResourceRecordParams =
592
+ | {
593
+ /**
594
+ * Resource configuration used to update a record.
595
+ */
596
+ resource: AdminForthResource;
597
+
598
+ /**
599
+ * Primary key value of the record to update.
600
+ */
601
+ recordId: any;
602
+
603
+ /**
604
+ * Full record data with applied changes.
605
+ *
606
+ * @deprecated Since 1.2.9. Will be removed in 2.0.0. Use updates instead.
607
+ */
608
+ record: any;
609
+
610
+ /**
611
+ * Record data before update.
612
+ */
613
+ oldRecord: any;
614
+
615
+ /**
616
+ * Admin user performing the action.
617
+ */
618
+ adminUser: AdminUser;
619
+
620
+ /**
621
+ * HTTP response object.
622
+ *
623
+ * @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
624
+ */
625
+ response?: IAdminForthHttpResponse;
626
+
627
+ /**
628
+ * Extra HTTP information. Prefer using extra.response over the top-level response field.
629
+ */
630
+ extra?: HttpExtra;
631
+
632
+ /**
633
+ * Partial record data with only changed fields. Mutually exclusive with record.
634
+ */
635
+ updates?: never;
636
+ }
637
+ | {
638
+ /**
639
+ * Resource configuration used to update a record.
640
+ */
641
+ resource: AdminForthResource;
642
+
643
+ /**
644
+ * Primary key value of the record to update.
645
+ */
646
+ recordId: any;
647
+
648
+ /**
649
+ * Full record data with applied changes.
650
+ *
651
+ * @deprecated Since 1.2.9. Will be removed in 2.0.0. Use updates instead.
652
+ */
653
+ record?: never;
654
+
655
+ /**
656
+ * Record data before update.
657
+ */
658
+ oldRecord: any;
659
+
660
+ /**
661
+ * Admin user performing the action.
662
+ */
663
+ adminUser: AdminUser;
664
+
665
+ /**
666
+ * HTTP response object.
667
+ *
668
+ * @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
669
+ */
670
+ response?: IAdminForthHttpResponse;
671
+
672
+ /**
673
+ * Extra HTTP information. Prefer using extra.response over the top-level response field.
674
+ */
675
+ extra?: HttpExtra;
676
+
677
+ /**
678
+ * Partial record data with only changed fields. Mutually exclusive with record.
679
+ */
680
+ updates: any;
681
+ };
682
+
683
+ /**
684
+ * Parameters for {@link IAdminForth.deleteResourceRecord}.
685
+ */
686
+ export type DeleteResourceRecordParams = {
687
+ /**
688
+ * Resource configuration used to delete a record.
689
+ */
690
+ resource: AdminForthResource;
691
+
692
+ /**
693
+ * Primary key value of the record to delete.
694
+ */
695
+ recordId: string;
696
+
697
+ /**
698
+ * Admin user performing the action.
699
+ */
700
+ adminUser: AdminUser;
701
+
702
+ /**
703
+ * Record data before deletion.
704
+ */
705
+ record: any;
706
+
707
+ /**
708
+ * HTTP response object.
709
+ *
710
+ * @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
711
+ */
712
+ response?: IAdminForthHttpResponse;
713
+
714
+ /**
715
+ * Extra HTTP information. Prefer using extra.response over the top-level response field.
716
+ */
717
+ extra?: HttpExtra;
718
+ };
719
+
720
+ /**
721
+ * Result of {@link IAdminForth.updateResourceRecord}.
722
+ */
723
+ export type UpdateResourceRecordResult = {
724
+ /** Optional error message if update failed. */
725
+ error?: string;
726
+ };
727
+
728
+ /**
729
+ * Result of {@link IAdminForth.deleteResourceRecord}.
730
+ */
731
+ export type DeleteResourceRecordResult = {
732
+ /** Optional error message if delete failed. */
733
+ error?: string;
734
+ };
532
735
  /**
533
736
  * Modify record to change how data is saved to database.
534
737
  * Return ok: false and error: string to stop execution and show error message to user. Return ok: true to continue execution.
535
738
  */
536
739
  export type BeforeDeleteSaveFunction = (params: {
740
+ /**
741
+ * Resource info.
742
+ */
537
743
  resource: AdminForthResource,
744
+ /**
745
+ * Primary key value of the record to delete.
746
+ */
538
747
  recordId: any,
539
- adminUser: AdminUser,
748
+ /**
749
+ * Admin user performing the action.
750
+ */
751
+ adminUser: AdminUser,
752
+ /**
753
+ * Record data before deletion.
754
+ */
540
755
  record: any,
756
+ /**
757
+ * Adminforth instance.
758
+ */
541
759
  adminforth: IAdminForth,
760
+ /**
761
+ * HTTP response object.
762
+ *
763
+ * @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
764
+ */
765
+ response?: IAdminForthHttpResponse,
766
+ /**
767
+ * Extra HTTP information. Prefer using extra.response over the top-level response field.
768
+ */
542
769
  extra?: HttpExtra,
543
770
  }) => Promise<{ok: boolean, error?: string}>;
544
771
 
545
772
 
546
773
  export type BeforeEditSaveFunction = (params: {
774
+ /**
775
+ * Resource info.
776
+ */
547
777
  resource: AdminForthResource,
778
+ /**
779
+ * Primary key value of the record to delete.
780
+ */
548
781
  recordId: any,
782
+ /**
783
+ * Admin user performing the action.
784
+ */
549
785
  adminUser: AdminUser,
786
+ /*
787
+ * Fields to update in record.
788
+ */
550
789
  updates: any,
790
+ /**
791
+ * Record with updates
792
+ *
793
+ * @deprecated. Will be removed in 2.0.0. Use updates instead.
794
+ */
551
795
  record: any, // legacy, 'updates' should be used instead
796
+ /**
797
+ * Record data before update.
798
+ */
552
799
  oldRecord: any,
800
+ /**
801
+ * Adminforth instance.
802
+ */
553
803
  adminforth: IAdminForth,
804
+ /**
805
+ * HTTP response object.
806
+ *
807
+ * @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
808
+ */
809
+ response: IAdminForthHttpResponse,
810
+ /**
811
+ * Extra HTTP information. Prefer using extra.response over the top-level response field.
812
+ */
554
813
  extra?: HttpExtra,
555
814
  }) => Promise<{ok: boolean, error?: string | null}>;
556
815
 
557
-
558
-
559
816
  export type BeforeCreateSaveFunction = (params: {
817
+ /**
818
+ * Resource info.
819
+ */
560
820
  resource: AdminForthResource,
821
+ /**
822
+ * Admin user performing the action.
823
+ */
561
824
  adminUser: AdminUser,
825
+ /**
826
+ * Record data to create.
827
+ */
562
828
  record: any,
829
+ /**
830
+ * Adminforth instance.
831
+ */
563
832
  adminforth: IAdminForth,
833
+ /**
834
+ * HTTP response object.
835
+ *
836
+ * @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
837
+ */
838
+ response: IAdminForthHttpResponse,
839
+
564
840
  extra?: HttpExtra,
565
841
  }) => Promise<{ok: boolean, error?: string | null, newRecordId?: string}>;
566
842
 
567
843
  export type AfterCreateSaveFunction = (params: {
844
+ /**
845
+ * Resource info.
846
+ */
568
847
  resource: AdminForthResource,
848
+ /**
849
+ * Primary key value of the record to delete.
850
+ */
569
851
  recordId: any,
852
+ /**
853
+ * Admin user performing the action.
854
+ */
570
855
  adminUser: AdminUser,
856
+ /**
857
+ * Record data after creation.
858
+ */
571
859
  record: any,
860
+ /**
861
+ * Adminforth instance.
862
+ */
572
863
  adminforth: IAdminForth,
864
+ /**
865
+ * Record with virtual columns after creation.
866
+ */
573
867
  recordWithVirtualColumns?: any,
868
+ /**
869
+ * HTTP response object.
870
+ *
871
+ * @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
872
+ */
873
+ response: IAdminForthHttpResponse,
874
+ /**
875
+ * Extra HTTP information. Prefer using extra.response over the top-level response field.
876
+ */
574
877
  extra?: HttpExtra,
575
878
  }) => Promise<{ok: boolean, error?: string}>;
576
879
 
@@ -579,23 +882,79 @@ export type AfterCreateSaveFunction = (params: {
579
882
  * Return ok: false and error: string to stop execution and show error message to user. Return ok: true to continue execution.
580
883
  */
581
884
  export type AfterDeleteSaveFunction = (params: {
885
+ /**
886
+ * Resource info.
887
+ */
582
888
  resource: AdminForthResource,
889
+ /**
890
+ * Primary key value of the record to delete.
891
+ */
583
892
  recordId: any,
893
+ /**
894
+ * Admin user performing the action.
895
+ */
584
896
  adminUser: AdminUser,
897
+ /**
898
+ * Record data, that was deleted.
899
+ */
585
900
  record: any,
901
+ /**
902
+ * Adminforth instance.
903
+ */
586
904
  adminforth: IAdminForth,
905
+ /**
906
+ * HTTP response object.
907
+ *
908
+ * @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
909
+ */
910
+ response: IAdminForthHttpResponse,
911
+ /**
912
+ * Extra HTTP information. Prefer using extra.response over the top-level response field.
913
+ */
587
914
  extra?: HttpExtra,
588
915
  }) => Promise<{ok: boolean, error?: string}>;
589
916
 
590
917
 
591
918
  export type AfterEditSaveFunction = (params: {
919
+ /**
920
+ * Resource info.
921
+ */
592
922
  resource: AdminForthResource,
923
+ /**
924
+ * Primary key value of the record to delete.
925
+ */
593
926
  recordId: any,
927
+ /**
928
+ * Admin user performing the action.
929
+ */
594
930
  adminUser: AdminUser,
931
+ /**
932
+ * Record updates.
933
+ */
595
934
  updates: any,
935
+ /**
936
+ * Record after update.
937
+ *
938
+ * @deprecated. Will be removed in 2.0.0. Use updates instead.
939
+ */
596
940
  record: any, // legacy, 'updates' should be used instead
941
+ /**
942
+ * Record data before update.
943
+ */
597
944
  oldRecord: any,
945
+ /**
946
+ * Adminforth instance.
947
+ */
598
948
  adminforth: IAdminForth,
949
+ /**
950
+ * HTTP response object.
951
+ *
952
+ * @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
953
+ */
954
+ response: IAdminForthHttpResponse,
955
+ /**
956
+ * Extra HTTP information. Prefer using extra.response over the top-level response field.
957
+ */
599
958
  extra?: HttpExtra,
600
959
  }) => Promise<{ok: boolean, error?: string}>;
601
960
 
@@ -603,10 +962,27 @@ export type AfterEditSaveFunction = (params: {
603
962
  * Allow to get user data before login confirmation, will triger when user try to login.
604
963
  */
605
964
  export type BeforeLoginConfirmationFunction = (params?: {
965
+ /**
966
+ * Admin user performing the action.
967
+ */
606
968
  adminUser: AdminUser,
969
+ /**
970
+ * HTTP response object.
971
+ *
972
+ * @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
973
+ */
607
974
  response: IAdminForthHttpResponse,
975
+ /**
976
+ * Adminforth instance.
977
+ */
608
978
  adminforth: IAdminForth,
979
+ /**
980
+ * Extra HTTP information. Prefer using extra.response over the top-level response field.
981
+ */
609
982
  extra?: HttpExtra,
983
+ /**
984
+ * Duration of session in format "1s", "1m", "1h", or "1d" (e.g., "30d" for 30 days)
985
+ */
610
986
  sessionDuration?: string,
611
987
  }) => Promise<{
612
988
  error?: string,
@@ -620,9 +996,23 @@ export type BeforeLoginConfirmationFunction = (params?: {
620
996
  * Allow to make extra authorization
621
997
  */
622
998
  export type AdminUserAuthorizeFunction = ((params?: {
999
+ /**
1000
+ * Admin user performing the action.
1001
+ */
623
1002
  adminUser: AdminUser,
1003
+ /**
1004
+ * HTTP response object.
1005
+ *
1006
+ * @deprecated Since 1.2.9. Will be removed in 2.0.0. Use extra.response instead.
1007
+ */
624
1008
  response: IAdminForthHttpResponse,
1009
+ /**
1010
+ * Adminforth instance.
1011
+ */
625
1012
  adminforth: IAdminForth,
1013
+ /**
1014
+ * Extra HTTP information. Prefer using extra.response over the top-level response field.
1015
+ */
626
1016
  extra?: HttpExtra,
627
1017
  }) => Promise<{
628
1018
  error?: string,
@@ -848,6 +1238,7 @@ export interface AdminForthActionInput {
848
1238
  name: string;
849
1239
  showIn?: {
850
1240
  list?: boolean,
1241
+ listThreeDotsMenu?: boolean,
851
1242
  showButton?: boolean,
852
1243
  showThreeDotsMenu?: boolean,
853
1244
  };
@@ -861,6 +1252,7 @@ export interface AdminForthActionInput {
861
1252
  resource: AdminForthResource;
862
1253
  recordId: string;
863
1254
  adminUser: AdminUser;
1255
+ response: IAdminForthHttpResponse;
864
1256
  extra?: HttpExtra;
865
1257
  tr: Function;
866
1258
  }) => Promise<{
@@ -1058,7 +1450,7 @@ export interface AdminForthInputConfig {
1058
1450
  /**
1059
1451
  * Function to return avatar URL for user.
1060
1452
  */
1061
- avatarUrl?: ((adminUser: AdminUser) => string | Promise<string>)
1453
+ avatarUrl?: ((adminUser: AdminUser) => string | Promise<string> | undefined | Promise<undefined>),
1062
1454
 
1063
1455
  /**
1064
1456
  * Remember me duration for "Remember Me" checkbox on login page.
@@ -1102,7 +1494,7 @@ export interface AdminForthInputConfig {
1102
1494
  /**
1103
1495
  * Add custom page to the settings page
1104
1496
  */
1105
- userMenuSettingsPages: {
1497
+ userMenuSettingsPages?: {
1106
1498
  icon?: string,
1107
1499
  pageLabel: string,
1108
1500
  slug?: string,
@@ -1282,6 +1674,14 @@ export class Filters {
1282
1674
  subFilters,
1283
1675
  };
1284
1676
  }
1677
+
1678
+ static IS_EMPTY(field: string): IAdminForthSingleFilter {
1679
+ return { field, operator: AdminForthFilterOperators.IS_EMPTY, value: null };
1680
+ }
1681
+
1682
+ static IS_NOT_EMPTY(field: string): IAdminForthSingleFilter {
1683
+ return { field, operator: AdminForthFilterOperators.IS_NOT_EMPTY, value: null };
1684
+ }
1285
1685
  }
1286
1686
 
1287
1687
  export type FDataSort = (field: string, direction: AdminForthSortDirections) => IAdminForthSort;
@@ -1358,6 +1758,7 @@ export type AllowedActions = {
1358
1758
  */
1359
1759
  export interface ResourceOptionsInput extends Omit<NonNullable<AdminForthResourceInputCommon['options']>, 'allowedActions' | 'bulkActions'> {
1360
1760
 
1761
+ baseActionsAsQuickIcons?: ('show' | 'edit' | 'delete')[],
1361
1762
  /**
1362
1763
  * Custom bulk actions list. Bulk actions available in list view when user selects multiple records by
1363
1764
  * using checkboxes.
@@ -1526,8 +1927,8 @@ export interface AdminForthBulkAction extends AdminForthBulkActionCommon {
1526
1927
  * Callback which will be called on backend when user clicks on action button.
1527
1928
  * It should return Promise which will be resolved when action is done.
1528
1929
  */
1529
- action: ({ resource, selectedIds, adminUser, tr }: {
1530
- resource: AdminForthResource, selectedIds: Array<any>, adminUser: AdminUser, tr: (key: string, category?: string, params?: any) => string
1930
+ action: ({ resource, selectedIds, adminUser, response, tr }: {
1931
+ resource: AdminForthResource, selectedIds: Array<any>, adminUser: AdminUser, response: IAdminForthHttpResponse, tr: (key: string, category?: string, params?: any) => string
1531
1932
  }) => Promise<{ ok: boolean, error?: string, successMessage?: string }>,
1532
1933
 
1533
1934
  /**
@@ -28,6 +28,8 @@ export enum AdminForthFilterOperators {
28
28
  NIN = 'nin',
29
29
  AND = 'and',
30
30
  OR = 'or',
31
+ IS_EMPTY = 'isEmpty',
32
+ IS_NOT_EMPTY = 'isNotEmpty',
31
33
  };
32
34
 
33
35
  export type FilterParams = {
@@ -294,7 +296,7 @@ export interface AdminForthComponentDeclarationFull {
294
296
  [key: string]: any,
295
297
  }
296
298
  }
297
- import { type AdminForthActionInput } from './Back.js'
299
+ import { type AdminForthActionInput, type AdminForthResource } from './Back.js'
298
300
  export { type AdminForthActionInput } from './Back.js'
299
301
 
300
302
  export type AdminForthComponentDeclaration = AdminForthComponentDeclarationFull | string;
@@ -445,7 +447,7 @@ export interface AdminForthResourceInputCommon {
445
447
  * If you wish to open page in new tab, add `target=_blank` get param to returned URL, example:
446
448
  *
447
449
  * ```ts
448
- * listTableClickUrl: async (record, adminUser) => {
450
+ * listTableClickUrl: async (record, adminUser, resource) => {
449
451
  * return `https://google.com/search?q=${record.name}&target=_blank`;
450
452
  * }
451
453
  * ```
@@ -455,7 +457,7 @@ export interface AdminForthResourceInputCommon {
455
457
  * Example:
456
458
  *
457
459
  * ```ts
458
- * listTableClickUrl: async (record, adminUser) => {
460
+ * listTableClickUrl: async (record, adminUser, resource) => {
459
461
  * return null;
460
462
  * }
461
463
  * ```
@@ -464,7 +466,7 @@ export interface AdminForthResourceInputCommon {
464
466
  * @param adminUser - user who clicked
465
467
  * @returns
466
468
  */
467
- listTableClickUrl?: (record: any, adminUser: AdminUser) => Promise<string | null>,
469
+ listTableClickUrl?: (record: any, adminUser: AdminUser, resource: AdminForthResource) => Promise<string | null>,
468
470
 
469
471
  /**
470
472
  * Whether to refresh existing list rows automatically every N seconds.
@@ -503,6 +505,7 @@ export interface AdminForthResourceInputCommon {
503
505
  bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
504
506
  threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
505
507
  customActionIcons?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
508
+ customActionIconsThreeDotsMenuItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
506
509
  tableBodyStart?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
507
510
  tableRowReplace?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
508
511
  },
@@ -529,11 +532,6 @@ export interface AdminForthResourceInputCommon {
529
532
  afterBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
530
533
  bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
531
534
  threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
532
- /**
533
- * Custom Save button component for Edit page.
534
- * Accepts props: [record, resource, adminUser, meta, saving, validating, isValid, disabled, saveRecord]
535
- */
536
- saveButton?: AdminForthComponentDeclaration,
537
535
  },
538
536
 
539
537
  /**
@@ -546,11 +544,6 @@ export interface AdminForthResourceInputCommon {
546
544
  afterBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
547
545
  bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
548
546
  threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
549
- /**
550
- * Custom Save button component for Create page.
551
- * Accepts props: [record, resource, adminUser, meta, saving, validating, isValid, disabled, saveRecord]
552
- */
553
- saveButton?: AdminForthComponentDeclaration,
554
547
  },
555
548
  }
556
549
  },