identity-admin 1.28.23 → 1.28.24

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 (189) hide show
  1. package/README.md +294 -294
  2. package/lib/Dashboard.d.ts +14 -14
  3. package/lib/Dashboard.js +95 -95
  4. package/lib/container/helpers/HelperInversify.d.ts +6 -6
  5. package/lib/container/helpers/HelperInversify.js +10 -10
  6. package/lib/container/helpers/HelperTypes.d.ts +5 -5
  7. package/lib/container/helpers/HelperTypes.js +7 -7
  8. package/lib/container/index.d.ts +1 -1
  9. package/lib/container/index.js +14 -14
  10. package/lib/container/repositories/RepositoryInversify.d.ts +4 -4
  11. package/lib/container/repositories/RepositoryInversify.js +13 -13
  12. package/lib/container/repositories/RepositoryTypes.d.ts +4 -4
  13. package/lib/container/repositories/RepositoryTypes.js +6 -6
  14. package/lib/container/types.d.ts +8 -8
  15. package/lib/container/types.js +9 -9
  16. package/lib/controllers/ActionController.d.ts +9 -9
  17. package/lib/controllers/ActionController.js +141 -141
  18. package/lib/controllers/AdminNotificationController.d.ts +8 -8
  19. package/lib/controllers/AdminNotificationController.js +69 -69
  20. package/lib/controllers/DashboardController.d.ts +45 -45
  21. package/lib/controllers/DashboardController.js +827 -827
  22. package/lib/controllers/ResourceController.d.ts +15 -15
  23. package/lib/controllers/ResourceController.js +126 -126
  24. package/lib/helpers/ActionsGenerator.d.ts +11 -11
  25. package/lib/helpers/ActionsGenerator.js +168 -168
  26. package/lib/helpers/AdminNotifications/AdminNotificationCreation.d.ts +54 -54
  27. package/lib/helpers/AdminNotifications/AdminNotificationCreation.js +66 -66
  28. package/lib/helpers/AdminNotifications/AdminNotificationFetcher.d.ts +63 -63
  29. package/lib/helpers/AdminNotifications/AdminNotificationFetcher.js +45 -45
  30. package/lib/helpers/FilterQueryHelper.d.ts +9 -9
  31. package/lib/helpers/FilterQueryHelper.js +83 -83
  32. package/lib/helpers/FiltersHelper.d.ts +9 -9
  33. package/lib/helpers/FiltersHelper.js +126 -126
  34. package/lib/helpers/JsonRichText/DraftRawToUniversalConverter.d.ts +3 -2
  35. package/lib/helpers/JsonRichText/DraftRawToUniversalConverter.js +144 -122
  36. package/lib/helpers/JsonRichText/IDraftRawType.d.ts +18 -18
  37. package/lib/helpers/JsonRichText/IDraftRawType.js +2 -2
  38. package/lib/helpers/JsonRichText/IUniversalJsonType.d.ts +24 -19
  39. package/lib/helpers/JsonRichText/IUniversalJsonType.js +10 -4
  40. package/lib/helpers/LocalesHelper.d.ts +4 -4
  41. package/lib/helpers/LocalesHelper.js +73 -73
  42. package/lib/helpers/LocalizedStringHelper.d.ts +11 -11
  43. package/lib/helpers/LocalizedStringHelper.js +76 -76
  44. package/lib/helpers/Permissions/PermissionFetcher.d.ts +8 -8
  45. package/lib/helpers/Permissions/PermissionFetcher.js +95 -95
  46. package/lib/helpers/Permissions/PermissionLabel.d.ts +2 -2
  47. package/lib/helpers/Permissions/PermissionLabel.js +42 -42
  48. package/lib/helpers/Permissions/PermissionMapper.d.ts +13 -13
  49. package/lib/helpers/Permissions/PermissionMapper.js +35 -35
  50. package/lib/helpers/Permissions/PermissionResource.d.ts +6 -6
  51. package/lib/helpers/Permissions/PermissionResource.js +62 -62
  52. package/lib/helpers/Permissions/PermissionSavingService.d.ts +13 -13
  53. package/lib/helpers/Permissions/PermissionSavingService.js +32 -32
  54. package/lib/helpers/Permissions/SavePermissionGroup.d.ts +6 -6
  55. package/lib/helpers/Permissions/SavePermissionGroup.js +32 -32
  56. package/lib/helpers/Permissions/UpdatePermissionGroup.d.ts +6 -6
  57. package/lib/helpers/Permissions/UpdatePermissionGroup.js +50 -50
  58. package/lib/helpers/Permissions/types.d.ts +17 -17
  59. package/lib/helpers/Permissions/types.js +2 -2
  60. package/lib/helpers/PopulationHelper.d.ts +12 -12
  61. package/lib/helpers/PopulationHelper.js +50 -50
  62. package/lib/helpers/RecordsCounter.d.ts +10 -10
  63. package/lib/helpers/RecordsCounter.js +33 -33
  64. package/lib/helpers/ReportsGenerator.d.ts +26 -26
  65. package/lib/helpers/ReportsGenerator.js +162 -162
  66. package/lib/helpers/ResourceGenerator.d.ts +9 -9
  67. package/lib/helpers/ResourceGenerator.js +172 -172
  68. package/lib/helpers/ResourceHelper.d.ts +28 -28
  69. package/lib/helpers/ResourceHelper.js +397 -397
  70. package/lib/helpers/RportsGenerator.d.ts +10 -10
  71. package/lib/helpers/RportsGenerator.js +21 -21
  72. package/lib/helpers/SchemaGenerator.d.ts +7 -7
  73. package/lib/helpers/SchemaGenerator.js +137 -137
  74. package/lib/helpers/SchemaHelper.d.ts +5 -5
  75. package/lib/helpers/SchemaHelper.js +21 -21
  76. package/lib/helpers/UserActionsLog/UserActionsLogHelper.d.ts +2 -2
  77. package/lib/helpers/UserActionsLog/UserActionsLogHelper.js +49 -49
  78. package/lib/locales/en.json +54 -54
  79. package/lib/middlewares/cache/decorator.d.ts +3 -3
  80. package/lib/middlewares/cache/decorator.js +60 -60
  81. package/lib/middlewares/cache/deletionMethods.d.ts +3 -3
  82. package/lib/middlewares/cache/deletionMethods.js +23 -23
  83. package/lib/middlewares/isAuth.d.ts +13 -13
  84. package/lib/middlewares/isAuth.js +43 -43
  85. package/lib/models/ModelNames.d.ts +10 -10
  86. package/lib/models/ModelNames.js +13 -13
  87. package/lib/models/adminNotification/AdminNotification.d.ts +5 -5
  88. package/lib/models/adminNotification/AdminNotification.js +70 -70
  89. package/lib/models/adminNotification/IAdminNotification.d.ts +35 -35
  90. package/lib/models/adminNotification/IAdminNotification.js +15 -15
  91. package/lib/models/adminpermission/AdminPermission.d.ts +11 -11
  92. package/lib/models/adminpermission/AdminPermission.js +23 -23
  93. package/lib/models/adminpermission/IAdminPermission.d.ts +13 -13
  94. package/lib/models/adminpermission/IAdminPermission.js +2 -2
  95. package/lib/models/customPage/CustomPage.d.ts +2 -2
  96. package/lib/models/customPage/CustomPage.js +38 -38
  97. package/lib/models/customPage/ICustomPage.d.ts +17 -17
  98. package/lib/models/customPage/ICustomPage.js +2 -2
  99. package/lib/models/file/File.d.ts +2 -2
  100. package/lib/models/file/File.js +23 -23
  101. package/lib/models/file/IFile.d.ts +15 -15
  102. package/lib/models/file/IFile.js +2 -2
  103. package/lib/models/location/ILocation.d.ts +16 -16
  104. package/lib/models/location/ILocation.js +2 -2
  105. package/lib/models/location/Location.d.ts +2 -2
  106. package/lib/models/location/Location.js +29 -29
  107. package/lib/models/mailLog/IMailLog.d.ts +14 -14
  108. package/lib/models/mailLog/IMailLog.js +2 -2
  109. package/lib/models/mailLog/MailLog.d.ts +3 -3
  110. package/lib/models/mailLog/MailLog.js +23 -23
  111. package/lib/models/modelConfiguration/IModelConfigurations.d.ts +31 -31
  112. package/lib/models/modelConfiguration/IModelConfigurations.js +2 -2
  113. package/lib/models/modelConfiguration/ModelConfiguration.d.ts +13 -13
  114. package/lib/models/modelConfiguration/ModelConfiguration.js +103 -103
  115. package/lib/models/permission/IPermission.d.ts +14 -14
  116. package/lib/models/permission/IPermission.js +2 -2
  117. package/lib/models/permission/Permission.d.ts +2 -2
  118. package/lib/models/permission/Permission.js +21 -21
  119. package/lib/models/request-log/IRequestLog.d.ts +22 -22
  120. package/lib/models/request-log/IRequestLog.js +2 -2
  121. package/lib/models/request-log/RequestLog.d.ts +3 -3
  122. package/lib/models/request-log/RequestLog.js +51 -51
  123. package/lib/models/userActionsLog/IUserActionsLog.d.ts +26 -26
  124. package/lib/models/userActionsLog/IUserActionsLog.js +11 -11
  125. package/lib/models/userActionsLog/UserActionsLog.d.ts +3 -3
  126. package/lib/models/userActionsLog/UserActionsLog.js +41 -41
  127. package/lib/pdf/ReportTemplate.d.ts +71 -71
  128. package/lib/pdf/ReportTemplate.js +94 -94
  129. package/lib/repositories/AdminNotificationRepository.d.ts +7 -7
  130. package/lib/repositories/AdminNotificationRepository.js +23 -23
  131. package/lib/repositories/DashboardRepository.d.ts +5 -5
  132. package/lib/repositories/DashboardRepository.js +12 -12
  133. package/lib/repositories/Repository.d.ts +68 -68
  134. package/lib/repositories/Repository.js +215 -215
  135. package/lib/repositories/RequestLogRepository.d.ts +10 -10
  136. package/lib/repositories/RequestLogRepository.js +54 -54
  137. package/lib/repositories/SaveResult.d.ts +14 -14
  138. package/lib/repositories/SaveResult.js +18 -18
  139. package/lib/resources/AdminNotificationsResource.d.ts +3 -3
  140. package/lib/resources/AdminNotificationsResource.js +23 -23
  141. package/lib/resources/parents.d.ts +4 -4
  142. package/lib/resources/parents.js +7 -7
  143. package/lib/router/index.d.ts +8 -8
  144. package/lib/router/index.js +104 -104
  145. package/lib/types/DashbordConfig.d.ts +21 -21
  146. package/lib/types/DashbordConfig.js +2 -2
  147. package/lib/types/IConfigurationFile.d.ts +13 -13
  148. package/lib/types/IConfigurationFile.js +2 -2
  149. package/lib/types/IResourceFile.d.ts +736 -736
  150. package/lib/types/IResourceFile.js +2 -2
  151. package/lib/types/IResourceResponse.d.ts +96 -96
  152. package/lib/types/IResourceResponse.js +2 -2
  153. package/lib/types/helpers.d.ts +68 -68
  154. package/lib/types/helpers.js +83 -83
  155. package/lib/utils/DateUtils.d.ts +7 -7
  156. package/lib/utils/DateUtils.js +45 -45
  157. package/lib/utils/ResourceUtils.d.ts +2 -2
  158. package/lib/utils/ResourceUtils.js +7 -7
  159. package/lib/utils/ResponseUtils.d.ts +11 -11
  160. package/lib/utils/ResponseUtils.js +41 -41
  161. package/lib/utils/StringUtils.d.ts +9 -9
  162. package/lib/utils/StringUtils.js +46 -46
  163. package/lib/view/asset-manifest.json +18 -18
  164. package/lib/view/assets/icons/delete_icon.svg +3 -3
  165. package/lib/view/assets/icons/flags/ic_flag_cn.svg +9 -9
  166. package/lib/view/assets/icons/flags/ic_flag_sa.svg +9 -9
  167. package/lib/view/assets/icons/flags/ic_flag_vn.svg +9 -9
  168. package/lib/view/assets/icons/info_icon.svg +3 -3
  169. package/lib/view/assets/icons/navbar/ic_banking.svg +5 -5
  170. package/lib/view/assets/icons/navbar/ic_invoice.svg +4 -4
  171. package/lib/view/assets/icons/navbar/ic_kanban.svg +7 -7
  172. package/lib/view/assets/icons/navbar/ic_menu_item.svg +8 -8
  173. package/lib/view/assets/icons/small_info_icon.svg +3 -3
  174. package/lib/view/assets/illustrations/Group 16.svg +4 -4
  175. package/lib/view/assets/illustrations/logo.svg +5 -5
  176. package/lib/view/favicon/browserconfig.xml +9 -9
  177. package/lib/view/favicon/safari-pinned-tab.svg +182 -182
  178. package/lib/view/favicon/site.webmanifest +19 -19
  179. package/lib/view/fonts/index.css +18 -18
  180. package/lib/view/index.html +52 -52
  181. package/lib/view/manifest.json +20 -20
  182. package/lib/view/robots.txt +3 -3
  183. package/lib/view/static/css/main.54de06ef.css +1 -1
  184. package/lib/view/static/js/574.778b5963.chunk.js +1 -1
  185. package/lib/view/static/js/678.521704a3.chunk.js +1 -1
  186. package/lib/view/static/js/798.54856416.chunk.js +1 -1
  187. package/lib/view/static/js/main.4687f255.js +2 -2
  188. package/lib/view/static/js/main.4687f255.js.LICENSE.txt +214 -214
  189. package/package.json +64 -64
@@ -1,168 +1,168 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- const i18n_1 = __importStar(require("i18n"));
30
- const helpers_1 = require("../types/helpers");
31
- const ResourceHelper_1 = __importDefault(require("./ResourceHelper"));
32
- var pluralize = require('pluralize');
33
- class ActionsGenerator {
34
- static generateActions(actionsCheck, resource, currentUser, configuration) {
35
- const actions = this.getActions(actionsCheck ? resource.properties.actions : undefined, currentUser, configuration); //resource.properties.actions? ResourcesHelper.getActions(JSON.parse(JSON.stringify(resource.properties.actions))): ResourcesHelper.getActions(undefined)
36
- for (const key in actions) {
37
- if (key === 'extras') {
38
- actions.extras = actions.extras ? this.addExtraActions(JSON.parse(JSON.stringify(resource.properties.actions.extras))) : actions.extras;
39
- continue;
40
- }
41
- const translation = ResourceHelper_1.default.checkActionTranslation(resource, key);
42
- actions[key] = this.appendActionValues(key, actions[key], translation);
43
- }
44
- return actions;
45
- }
46
- static addExtraActions(extraActions) {
47
- var extraActionsObject = {
48
- record: {},
49
- resource: {},
50
- };
51
- extraActions.forEach((action) => {
52
- action.keys = action.isVisible ? Object.keys(action.isVisible) : [];
53
- action.name = (0, i18n_1.__)({ phrase: action.name, locale: i18n_1.default.getLocale() });
54
- action.guardTitle = action.guardTitle ? (0, i18n_1.__)({ phrase: action.guardTitle, locale: i18n_1.default.getLocale() }) : undefined;
55
- action.guard = action.guard ? (0, i18n_1.__)({ phrase: action.guard, locale: i18n_1.default.getLocale() }) : undefined;
56
- action.message = action.message ? (0, i18n_1.__)({ phrase: action.message, locale: i18n_1.default.getLocale() }) : undefined;
57
- action.handlerStrategy = action.handlerStrategy ? action.handlerStrategy : helpers_1.HandlerStrategy.NORMAL;
58
- action.actionType ? (extraActionsObject[action.actionType][action.key] = action) : '';
59
- });
60
- return extraActionsObject;
61
- }
62
- static getActions(actions, currentUser, configuration) {
63
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
64
- var actionObject = {
65
- show: {
66
- isAccessible: ((_a = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _a === void 0 ? void 0 : _a.show) === false ? false : true,
67
- isMainAction: true,
68
- },
69
- new: {
70
- isAccessible: ((_b = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _b === void 0 ? void 0 : _b.new) === false ? false : true,
71
- },
72
- duplicate: {
73
- isAccessible: ((_c = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _c === void 0 ? void 0 : _c.new) === false ? false : ((_d = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _d === void 0 ? void 0 : _d.duplicate) === false ? false : true,
74
- },
75
- edit: {
76
- isAccessible: ((_e = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _e === void 0 ? void 0 : _e.edit) === false ? false : true,
77
- isMainAction: true,
78
- },
79
- delete: {
80
- isAccessible: ((_f = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _f === void 0 ? void 0 : _f.delete) === false ? false : true,
81
- },
82
- import: {
83
- isAccessible: ((_g = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _g === void 0 ? void 0 : _g.import) === true ? true : false,
84
- },
85
- bulkDelete: {
86
- isAccessible: ((_h = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _h === void 0 ? void 0 : _h.bulkDelete) === true ? true : false,
87
- },
88
- };
89
- if (!actions || Object.keys(actions).length === 0) {
90
- return actionObject;
91
- }
92
- for (const key in actions) {
93
- if (actions[key].hasOwnProperty('isAccessible') && key !== 'extras') {
94
- actionObject[key] = actions[key];
95
- }
96
- else if (actions[key].isAllowed && key !== 'extras') {
97
- actionObject[key] = {
98
- isAccessible: actions[key].isAllowed(currentUser),
99
- };
100
- }
101
- else if (key === 'extras') {
102
- actionObject[key] = actions[key];
103
- }
104
- actionObject[key].reloadAfterAction = (_j = actions[key]) === null || _j === void 0 ? void 0 : _j.reloadAfterAction;
105
- actionObject[key].isMainAction = (_k = actions[key].isMainAction) !== null && _k !== void 0 ? _k : (key === 'edit' || key === 'show');
106
- }
107
- return actionObject;
108
- }
109
- static appendActionValues(action, actionObject, translation) {
110
- switch (action) {
111
- case 'new':
112
- actionObject.value = translation ? translation : (0, i18n_1.__)({ phrase: 'actions_new', locale: i18n_1.default.getLocale() });
113
- break;
114
- case 'duplicate':
115
- actionObject.value = translation ? translation : (0, i18n_1.__)({ phrase: 'actions_duplicate', locale: i18n_1.default.getLocale() });
116
- break;
117
- case 'edit':
118
- actionObject.value = translation ? translation : (0, i18n_1.__)({ phrase: 'actions_edit', locale: i18n_1.default.getLocale() });
119
- break;
120
- case 'show':
121
- actionObject.value = translation ? translation : (0, i18n_1.__)({ phrase: 'actions_show', locale: i18n_1.default.getLocale() });
122
- break;
123
- case 'import':
124
- actionObject.value = translation ? translation : (0, i18n_1.__)({ phrase: 'actions_import', locale: i18n_1.default.getLocale() });
125
- break;
126
- case 'delete':
127
- actionObject.value = translation ? translation : (0, i18n_1.__)({ phrase: 'actions_delete', locale: i18n_1.default.getLocale() });
128
- actionObject.confirmationMessageTitle = (0, i18n_1.__)({
129
- phrase: 'actions_delete_confirmMessage_title',
130
- locale: i18n_1.default.getLocale(),
131
- });
132
- actionObject.confirmationMessageBody = (0, i18n_1.__)({
133
- phrase: 'actions_delete_confirmMessage_body',
134
- locale: i18n_1.default.getLocale(),
135
- });
136
- actionObject.confirmDeleteOption = (0, i18n_1.__)({
137
- phrase: 'actions_delete_options_yes',
138
- locale: i18n_1.default.getLocale(),
139
- });
140
- actionObject.cancelDeleteOption = (0, i18n_1.__)({
141
- phrase: 'actions_delete_options_no',
142
- locale: i18n_1.default.getLocale(),
143
- });
144
- break;
145
- case 'bulkDelete':
146
- actionObject.value = translation ? translation : (0, i18n_1.__)({ phrase: 'actions_delete', locale: i18n_1.default.getLocale() });
147
- actionObject.confirmationMessageTitle = (0, i18n_1.__)({
148
- phrase: 'actions_bulkDelete_confirmMessage_title',
149
- locale: i18n_1.default.getLocale(),
150
- });
151
- actionObject.confirmationMessageBody = (0, i18n_1.__)({
152
- phrase: 'actions_bulkDelete_confirmMessage_body',
153
- locale: i18n_1.default.getLocale(),
154
- });
155
- actionObject.confirmDeleteOption = (0, i18n_1.__)({
156
- phrase: 'actions_delete_options_yes',
157
- locale: i18n_1.default.getLocale(),
158
- });
159
- actionObject.cancelDeleteOption = (0, i18n_1.__)({
160
- phrase: 'actions_delete_options_no',
161
- locale: i18n_1.default.getLocale(),
162
- });
163
- break;
164
- }
165
- return actionObject;
166
- }
167
- }
168
- exports.default = ActionsGenerator;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const i18n_1 = __importStar(require("i18n"));
30
+ const helpers_1 = require("../types/helpers");
31
+ const ResourceHelper_1 = __importDefault(require("./ResourceHelper"));
32
+ var pluralize = require('pluralize');
33
+ class ActionsGenerator {
34
+ static generateActions(actionsCheck, resource, currentUser, configuration) {
35
+ const actions = this.getActions(actionsCheck ? resource.properties.actions : undefined, currentUser, configuration); //resource.properties.actions? ResourcesHelper.getActions(JSON.parse(JSON.stringify(resource.properties.actions))): ResourcesHelper.getActions(undefined)
36
+ for (const key in actions) {
37
+ if (key === 'extras') {
38
+ actions.extras = actions.extras ? this.addExtraActions(JSON.parse(JSON.stringify(resource.properties.actions.extras))) : actions.extras;
39
+ continue;
40
+ }
41
+ const translation = ResourceHelper_1.default.checkActionTranslation(resource, key);
42
+ actions[key] = this.appendActionValues(key, actions[key], translation);
43
+ }
44
+ return actions;
45
+ }
46
+ static addExtraActions(extraActions) {
47
+ var extraActionsObject = {
48
+ record: {},
49
+ resource: {},
50
+ };
51
+ extraActions.forEach((action) => {
52
+ action.keys = action.isVisible ? Object.keys(action.isVisible) : [];
53
+ action.name = (0, i18n_1.__)({ phrase: action.name, locale: i18n_1.default.getLocale() });
54
+ action.guardTitle = action.guardTitle ? (0, i18n_1.__)({ phrase: action.guardTitle, locale: i18n_1.default.getLocale() }) : undefined;
55
+ action.guard = action.guard ? (0, i18n_1.__)({ phrase: action.guard, locale: i18n_1.default.getLocale() }) : undefined;
56
+ action.message = action.message ? (0, i18n_1.__)({ phrase: action.message, locale: i18n_1.default.getLocale() }) : undefined;
57
+ action.handlerStrategy = action.handlerStrategy ? action.handlerStrategy : helpers_1.HandlerStrategy.NORMAL;
58
+ action.actionType ? (extraActionsObject[action.actionType][action.key] = action) : '';
59
+ });
60
+ return extraActionsObject;
61
+ }
62
+ static getActions(actions, currentUser, configuration) {
63
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
64
+ var actionObject = {
65
+ show: {
66
+ isAccessible: ((_a = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _a === void 0 ? void 0 : _a.show) === false ? false : true,
67
+ isMainAction: true,
68
+ },
69
+ new: {
70
+ isAccessible: ((_b = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _b === void 0 ? void 0 : _b.new) === false ? false : true,
71
+ },
72
+ duplicate: {
73
+ isAccessible: ((_c = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _c === void 0 ? void 0 : _c.new) === false ? false : ((_d = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _d === void 0 ? void 0 : _d.duplicate) === false ? false : true,
74
+ },
75
+ edit: {
76
+ isAccessible: ((_e = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _e === void 0 ? void 0 : _e.edit) === false ? false : true,
77
+ isMainAction: true,
78
+ },
79
+ delete: {
80
+ isAccessible: ((_f = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _f === void 0 ? void 0 : _f.delete) === false ? false : true,
81
+ },
82
+ import: {
83
+ isAccessible: ((_g = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _g === void 0 ? void 0 : _g.import) === true ? true : false,
84
+ },
85
+ bulkDelete: {
86
+ isAccessible: ((_h = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _h === void 0 ? void 0 : _h.bulkDelete) === true ? true : false,
87
+ },
88
+ };
89
+ if (!actions || Object.keys(actions).length === 0) {
90
+ return actionObject;
91
+ }
92
+ for (const key in actions) {
93
+ if (actions[key].hasOwnProperty('isAccessible') && key !== 'extras') {
94
+ actionObject[key] = actions[key];
95
+ }
96
+ else if (actions[key].isAllowed && key !== 'extras') {
97
+ actionObject[key] = {
98
+ isAccessible: actions[key].isAllowed(currentUser),
99
+ };
100
+ }
101
+ else if (key === 'extras') {
102
+ actionObject[key] = actions[key];
103
+ }
104
+ actionObject[key].reloadAfterAction = (_j = actions[key]) === null || _j === void 0 ? void 0 : _j.reloadAfterAction;
105
+ actionObject[key].isMainAction = (_k = actions[key].isMainAction) !== null && _k !== void 0 ? _k : (key === 'edit' || key === 'show');
106
+ }
107
+ return actionObject;
108
+ }
109
+ static appendActionValues(action, actionObject, translation) {
110
+ switch (action) {
111
+ case 'new':
112
+ actionObject.value = translation ? translation : (0, i18n_1.__)({ phrase: 'actions_new', locale: i18n_1.default.getLocale() });
113
+ break;
114
+ case 'duplicate':
115
+ actionObject.value = translation ? translation : (0, i18n_1.__)({ phrase: 'actions_duplicate', locale: i18n_1.default.getLocale() });
116
+ break;
117
+ case 'edit':
118
+ actionObject.value = translation ? translation : (0, i18n_1.__)({ phrase: 'actions_edit', locale: i18n_1.default.getLocale() });
119
+ break;
120
+ case 'show':
121
+ actionObject.value = translation ? translation : (0, i18n_1.__)({ phrase: 'actions_show', locale: i18n_1.default.getLocale() });
122
+ break;
123
+ case 'import':
124
+ actionObject.value = translation ? translation : (0, i18n_1.__)({ phrase: 'actions_import', locale: i18n_1.default.getLocale() });
125
+ break;
126
+ case 'delete':
127
+ actionObject.value = translation ? translation : (0, i18n_1.__)({ phrase: 'actions_delete', locale: i18n_1.default.getLocale() });
128
+ actionObject.confirmationMessageTitle = (0, i18n_1.__)({
129
+ phrase: 'actions_delete_confirmMessage_title',
130
+ locale: i18n_1.default.getLocale(),
131
+ });
132
+ actionObject.confirmationMessageBody = (0, i18n_1.__)({
133
+ phrase: 'actions_delete_confirmMessage_body',
134
+ locale: i18n_1.default.getLocale(),
135
+ });
136
+ actionObject.confirmDeleteOption = (0, i18n_1.__)({
137
+ phrase: 'actions_delete_options_yes',
138
+ locale: i18n_1.default.getLocale(),
139
+ });
140
+ actionObject.cancelDeleteOption = (0, i18n_1.__)({
141
+ phrase: 'actions_delete_options_no',
142
+ locale: i18n_1.default.getLocale(),
143
+ });
144
+ break;
145
+ case 'bulkDelete':
146
+ actionObject.value = translation ? translation : (0, i18n_1.__)({ phrase: 'actions_delete', locale: i18n_1.default.getLocale() });
147
+ actionObject.confirmationMessageTitle = (0, i18n_1.__)({
148
+ phrase: 'actions_bulkDelete_confirmMessage_title',
149
+ locale: i18n_1.default.getLocale(),
150
+ });
151
+ actionObject.confirmationMessageBody = (0, i18n_1.__)({
152
+ phrase: 'actions_bulkDelete_confirmMessage_body',
153
+ locale: i18n_1.default.getLocale(),
154
+ });
155
+ actionObject.confirmDeleteOption = (0, i18n_1.__)({
156
+ phrase: 'actions_delete_options_yes',
157
+ locale: i18n_1.default.getLocale(),
158
+ });
159
+ actionObject.cancelDeleteOption = (0, i18n_1.__)({
160
+ phrase: 'actions_delete_options_no',
161
+ locale: i18n_1.default.getLocale(),
162
+ });
163
+ break;
164
+ }
165
+ return actionObject;
166
+ }
167
+ }
168
+ exports.default = ActionsGenerator;
@@ -1,54 +1,54 @@
1
- /// <reference types="mongoose" />
2
- /// <reference types="mongoose" />
3
- /// <reference types="mongoose" />
4
- /// <reference types="mongoose" />
5
- /// <reference types="mongoose" />
6
- /// <reference types="mongoose" />
7
- /// <reference types="mongoose" />
8
- /// <reference types="mongoose" />
9
- /// <reference types="mongoose" />
10
- /// <reference types="mongoose" />
11
- /// <reference types="mongoose" />
12
- /// <reference types="mongoose" />
13
- /// <reference types="mongoose" />
14
- /// <reference types="mongoose" />
15
- /// <reference types="mongoose" />
16
- /// <reference types="mongoose" />
17
- /// <reference types="mongoose" />
18
- /// <reference types="mongoose" />
19
- /// <reference types="mongoose" />
20
- /// <reference types="mongoose" />
21
- /// <reference types="mongoose" />
22
- /// <reference types="mongoose" />
23
- /// <reference types="mongoose" />
24
- /// <reference types="mongoose" />
25
- /// <reference types="passport-local-mongoose" />
26
- /// <reference types="mongoose" />
27
- import { AdminNotificationTypePriority } from '../../models/adminNotification/IAdminNotification';
28
- export declare enum NotificationNavigationType {
29
- NONE = "NONE",
30
- SHOW = "SHOW",
31
- LIST = "LIST",
32
- EXTERNAL_LINK = "EXTERNAL_LINK"
33
- }
34
- export interface IAdminNotificationCreationProps {
35
- title: string;
36
- navigateTo: NotificationNavigationType;
37
- type: string;
38
- modelName?: string;
39
- message?: string;
40
- externalLink?: string;
41
- relatedId?: string;
42
- priority?: AdminNotificationTypePriority;
43
- data?: string;
44
- actorIcon?: string;
45
- targetIcon?: string;
46
- targetName?: string;
47
- hideCheckNow?: boolean;
48
- additionalData?: Record<string, any>;
49
- }
50
- export declare class AdminNotificationCreation {
51
- static insert(notification: IAdminNotificationCreationProps): Promise<import("../../models/adminNotification/IAdminNotification").IAdminNotificationDocument & Required<{
52
- _id: import("mongoose").Types.ObjectId;
53
- }>>;
54
- }
1
+ /// <reference types="mongoose" />
2
+ /// <reference types="mongoose" />
3
+ /// <reference types="mongoose" />
4
+ /// <reference types="mongoose" />
5
+ /// <reference types="mongoose" />
6
+ /// <reference types="mongoose" />
7
+ /// <reference types="mongoose" />
8
+ /// <reference types="mongoose" />
9
+ /// <reference types="mongoose" />
10
+ /// <reference types="mongoose" />
11
+ /// <reference types="mongoose" />
12
+ /// <reference types="mongoose" />
13
+ /// <reference types="mongoose" />
14
+ /// <reference types="mongoose" />
15
+ /// <reference types="mongoose" />
16
+ /// <reference types="mongoose" />
17
+ /// <reference types="mongoose" />
18
+ /// <reference types="mongoose" />
19
+ /// <reference types="mongoose" />
20
+ /// <reference types="mongoose" />
21
+ /// <reference types="mongoose" />
22
+ /// <reference types="mongoose" />
23
+ /// <reference types="mongoose" />
24
+ /// <reference types="mongoose" />
25
+ /// <reference types="passport-local-mongoose" />
26
+ /// <reference types="mongoose" />
27
+ import { AdminNotificationTypePriority } from '../../models/adminNotification/IAdminNotification';
28
+ export declare enum NotificationNavigationType {
29
+ NONE = "NONE",
30
+ SHOW = "SHOW",
31
+ LIST = "LIST",
32
+ EXTERNAL_LINK = "EXTERNAL_LINK"
33
+ }
34
+ export interface IAdminNotificationCreationProps {
35
+ title: string;
36
+ navigateTo: NotificationNavigationType;
37
+ type: string;
38
+ modelName?: string;
39
+ message?: string;
40
+ externalLink?: string;
41
+ relatedId?: string;
42
+ priority?: AdminNotificationTypePriority;
43
+ data?: string;
44
+ actorIcon?: string;
45
+ targetIcon?: string;
46
+ targetName?: string;
47
+ hideCheckNow?: boolean;
48
+ additionalData?: Record<string, any>;
49
+ }
50
+ export declare class AdminNotificationCreation {
51
+ static insert(notification: IAdminNotificationCreationProps): Promise<import("../../models/adminNotification/IAdminNotification").IAdminNotificationDocument & Required<{
52
+ _id: import("mongoose").Types.ObjectId;
53
+ }>>;
54
+ }
@@ -1,66 +1,66 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.AdminNotificationCreation = exports.NotificationNavigationType = void 0;
16
- const AdminNotification_1 = __importDefault(require("../../models/adminNotification/AdminNotification"));
17
- const IAdminNotification_1 = require("../../models/adminNotification/IAdminNotification");
18
- const ResourceHelper_1 = __importDefault(require("../ResourceHelper"));
19
- var NotificationNavigationType;
20
- (function (NotificationNavigationType) {
21
- NotificationNavigationType["NONE"] = "NONE";
22
- NotificationNavigationType["SHOW"] = "SHOW";
23
- NotificationNavigationType["LIST"] = "LIST";
24
- NotificationNavigationType["EXTERNAL_LINK"] = "EXTERNAL_LINK";
25
- })(NotificationNavigationType = exports.NotificationNavigationType || (exports.NotificationNavigationType = {}));
26
- class AdminNotificationCreation {
27
- static insert(notification) {
28
- var _a;
29
- return __awaiter(this, void 0, void 0, function* () {
30
- var navigateTo = notification.navigateTo;
31
- var redirectUrlType = undefined;
32
- var redirectUrl = undefined;
33
- if (navigateTo === NotificationNavigationType.EXTERNAL_LINK && !notification.externalLink) {
34
- navigateTo = NotificationNavigationType.NONE;
35
- }
36
- if (navigateTo === NotificationNavigationType.LIST && !notification.modelName) {
37
- navigateTo = NotificationNavigationType.NONE;
38
- }
39
- if (navigateTo === NotificationNavigationType.SHOW && (!notification.modelName || !notification.relatedId)) {
40
- navigateTo = NotificationNavigationType.NONE;
41
- }
42
- const modelPath = ResourceHelper_1.default.getModelPath((_a = notification.modelName) !== null && _a !== void 0 ? _a : '');
43
- switch (navigateTo) {
44
- case NotificationNavigationType.LIST:
45
- redirectUrlType = IAdminNotification_1.AdminNotificationNavigationType.INTERNAL;
46
- redirectUrl = `${modelPath}/list`;
47
- break;
48
- case NotificationNavigationType.SHOW:
49
- redirectUrlType = IAdminNotification_1.AdminNotificationNavigationType.INTERNAL;
50
- redirectUrl = `${modelPath}/${notification.relatedId}/show`;
51
- break;
52
- case NotificationNavigationType.EXTERNAL_LINK:
53
- redirectUrlType = IAdminNotification_1.AdminNotificationNavigationType.EXTERNAL;
54
- redirectUrl = notification.externalLink;
55
- break;
56
- default:
57
- redirectUrlType = IAdminNotification_1.AdminNotificationNavigationType.NONE;
58
- break;
59
- }
60
- const props = Object.assign(Object.assign({}, notification), { redirectUrl: redirectUrl, redirectUrlType: redirectUrlType });
61
- const record = new AdminNotification_1.default(props);
62
- return yield record.save();
63
- });
64
- }
65
- }
66
- exports.AdminNotificationCreation = AdminNotificationCreation;
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.AdminNotificationCreation = exports.NotificationNavigationType = void 0;
16
+ const AdminNotification_1 = __importDefault(require("../../models/adminNotification/AdminNotification"));
17
+ const IAdminNotification_1 = require("../../models/adminNotification/IAdminNotification");
18
+ const ResourceHelper_1 = __importDefault(require("../ResourceHelper"));
19
+ var NotificationNavigationType;
20
+ (function (NotificationNavigationType) {
21
+ NotificationNavigationType["NONE"] = "NONE";
22
+ NotificationNavigationType["SHOW"] = "SHOW";
23
+ NotificationNavigationType["LIST"] = "LIST";
24
+ NotificationNavigationType["EXTERNAL_LINK"] = "EXTERNAL_LINK";
25
+ })(NotificationNavigationType = exports.NotificationNavigationType || (exports.NotificationNavigationType = {}));
26
+ class AdminNotificationCreation {
27
+ static insert(notification) {
28
+ var _a;
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ var navigateTo = notification.navigateTo;
31
+ var redirectUrlType = undefined;
32
+ var redirectUrl = undefined;
33
+ if (navigateTo === NotificationNavigationType.EXTERNAL_LINK && !notification.externalLink) {
34
+ navigateTo = NotificationNavigationType.NONE;
35
+ }
36
+ if (navigateTo === NotificationNavigationType.LIST && !notification.modelName) {
37
+ navigateTo = NotificationNavigationType.NONE;
38
+ }
39
+ if (navigateTo === NotificationNavigationType.SHOW && (!notification.modelName || !notification.relatedId)) {
40
+ navigateTo = NotificationNavigationType.NONE;
41
+ }
42
+ const modelPath = ResourceHelper_1.default.getModelPath((_a = notification.modelName) !== null && _a !== void 0 ? _a : '');
43
+ switch (navigateTo) {
44
+ case NotificationNavigationType.LIST:
45
+ redirectUrlType = IAdminNotification_1.AdminNotificationNavigationType.INTERNAL;
46
+ redirectUrl = `${modelPath}/list`;
47
+ break;
48
+ case NotificationNavigationType.SHOW:
49
+ redirectUrlType = IAdminNotification_1.AdminNotificationNavigationType.INTERNAL;
50
+ redirectUrl = `${modelPath}/${notification.relatedId}/show`;
51
+ break;
52
+ case NotificationNavigationType.EXTERNAL_LINK:
53
+ redirectUrlType = IAdminNotification_1.AdminNotificationNavigationType.EXTERNAL;
54
+ redirectUrl = notification.externalLink;
55
+ break;
56
+ default:
57
+ redirectUrlType = IAdminNotification_1.AdminNotificationNavigationType.NONE;
58
+ break;
59
+ }
60
+ const props = Object.assign(Object.assign({}, notification), { redirectUrl: redirectUrl, redirectUrlType: redirectUrlType });
61
+ const record = new AdminNotification_1.default(props);
62
+ return yield record.save();
63
+ });
64
+ }
65
+ }
66
+ exports.AdminNotificationCreation = AdminNotificationCreation;