identity-admin 1.25.23 → 1.25.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 (147) hide show
  1. package/README.md +126 -126
  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 +8 -8
  17. package/lib/controllers/ActionController.js +79 -79
  18. package/lib/controllers/DashboardController.d.ts +43 -42
  19. package/lib/controllers/DashboardController.js +695 -684
  20. package/lib/controllers/ResourceController.d.ts +15 -15
  21. package/lib/controllers/ResourceController.js +134 -134
  22. package/lib/helpers/ActionsGenerator.d.ts +11 -11
  23. package/lib/helpers/ActionsGenerator.js +179 -179
  24. package/lib/helpers/FiltersHelper.d.ts +9 -9
  25. package/lib/helpers/FiltersHelper.js +105 -105
  26. package/lib/helpers/LocalesHelper.d.ts +4 -4
  27. package/lib/helpers/LocalesHelper.js +73 -73
  28. package/lib/helpers/LocalizedStringHelper.d.ts +9 -9
  29. package/lib/helpers/LocalizedStringHelper.js +57 -57
  30. package/lib/helpers/Permissions/PermissionFetcher.d.ts +7 -7
  31. package/lib/helpers/Permissions/PermissionFetcher.js +78 -78
  32. package/lib/helpers/Permissions/PermissionLabel.d.ts +2 -2
  33. package/lib/helpers/Permissions/PermissionLabel.js +42 -42
  34. package/lib/helpers/Permissions/PermissionMapper.d.ts +13 -13
  35. package/lib/helpers/Permissions/PermissionMapper.js +35 -35
  36. package/lib/helpers/Permissions/PermissionResource.d.ts +5 -5
  37. package/lib/helpers/Permissions/PermissionResource.js +31 -31
  38. package/lib/helpers/Permissions/PermissionSavingService.d.ts +13 -13
  39. package/lib/helpers/Permissions/PermissionSavingService.js +32 -32
  40. package/lib/helpers/Permissions/SavePermissionGroup.d.ts +6 -6
  41. package/lib/helpers/Permissions/SavePermissionGroup.js +32 -32
  42. package/lib/helpers/Permissions/UpdatePermissionGroup.d.ts +6 -6
  43. package/lib/helpers/Permissions/UpdatePermissionGroup.js +50 -50
  44. package/lib/helpers/Permissions/types.d.ts +17 -17
  45. package/lib/helpers/Permissions/types.js +2 -2
  46. package/lib/helpers/PopulationHelper.d.ts +12 -12
  47. package/lib/helpers/PopulationHelper.js +50 -50
  48. package/lib/helpers/ReportsGenerator.d.ts +11 -11
  49. package/lib/helpers/ReportsGenerator.js +57 -57
  50. package/lib/helpers/ResourceGenerator.d.ts +9 -9
  51. package/lib/helpers/ResourceGenerator.js +172 -172
  52. package/lib/helpers/ResourceHelper.d.ts +28 -28
  53. package/lib/helpers/ResourceHelper.js +376 -376
  54. package/lib/helpers/RportsGenerator.d.ts +10 -10
  55. package/lib/helpers/RportsGenerator.js +21 -21
  56. package/lib/helpers/SchemaGenerator.d.ts +5 -5
  57. package/lib/helpers/SchemaGenerator.js +97 -97
  58. package/lib/helpers/SchemaHelper.d.ts +5 -5
  59. package/lib/helpers/SchemaHelper.js +21 -21
  60. package/lib/locales/en.json +53 -53
  61. package/lib/middlewares/isAuth.d.ts +13 -13
  62. package/lib/middlewares/isAuth.js +43 -43
  63. package/lib/models/ModelNames.d.ts +7 -7
  64. package/lib/models/ModelNames.js +10 -10
  65. package/lib/models/adminpermission/AdminPermission.d.ts +6 -6
  66. package/lib/models/adminpermission/AdminPermission.js +23 -23
  67. package/lib/models/adminpermission/IAdminPermission.d.ts +13 -13
  68. package/lib/models/adminpermission/IAdminPermission.js +2 -2
  69. package/lib/models/customPage/CustomPage.d.ts +2 -2
  70. package/lib/models/customPage/CustomPage.js +38 -38
  71. package/lib/models/customPage/ICustomPage.d.ts +17 -17
  72. package/lib/models/customPage/ICustomPage.js +2 -2
  73. package/lib/models/file/File.d.ts +2 -2
  74. package/lib/models/file/File.js +23 -23
  75. package/lib/models/file/IFile.d.ts +15 -15
  76. package/lib/models/file/IFile.js +2 -2
  77. package/lib/models/location/ILocation.d.ts +14 -14
  78. package/lib/models/location/ILocation.js +2 -2
  79. package/lib/models/location/Location.d.ts +2 -2
  80. package/lib/models/location/Location.js +21 -21
  81. package/lib/models/modelConfiguration/IModelConfigurations.d.ts +29 -29
  82. package/lib/models/modelConfiguration/IModelConfigurations.js +2 -2
  83. package/lib/models/modelConfiguration/ModelConfiguration.d.ts +13 -13
  84. package/lib/models/modelConfiguration/ModelConfiguration.js +95 -95
  85. package/lib/models/permission/IPermission.d.ts +14 -14
  86. package/lib/models/permission/IPermission.js +2 -2
  87. package/lib/models/permission/Permission.d.ts +2 -2
  88. package/lib/models/permission/Permission.js +21 -21
  89. package/lib/models/request-log/IRequestLog.d.ts +22 -22
  90. package/lib/models/request-log/IRequestLog.js +2 -2
  91. package/lib/models/request-log/RequestLog.d.ts +3 -3
  92. package/lib/models/request-log/RequestLog.js +51 -51
  93. package/lib/pdf/ReportTemplate.d.ts +71 -71
  94. package/lib/pdf/ReportTemplate.js +94 -94
  95. package/lib/repositories/DashboardRepository.d.ts +5 -5
  96. package/lib/repositories/DashboardRepository.js +12 -12
  97. package/lib/repositories/Repository.d.ts +68 -68
  98. package/lib/repositories/Repository.js +212 -212
  99. package/lib/repositories/RequestLogRepository.d.ts +10 -10
  100. package/lib/repositories/RequestLogRepository.js +54 -54
  101. package/lib/repositories/SaveResult.d.ts +14 -14
  102. package/lib/repositories/SaveResult.js +18 -18
  103. package/lib/router/index.d.ts +8 -8
  104. package/lib/router/index.js +104 -104
  105. package/lib/types/DashbordConfig.d.ts +21 -21
  106. package/lib/types/DashbordConfig.js +2 -2
  107. package/lib/types/IConfigurationFile.d.ts +9 -9
  108. package/lib/types/IConfigurationFile.js +2 -2
  109. package/lib/types/IResourceFile.d.ts +624 -624
  110. package/lib/types/IResourceFile.js +2 -2
  111. package/lib/types/IResourceResponse.d.ts +95 -95
  112. package/lib/types/IResourceResponse.js +2 -2
  113. package/lib/types/helpers.d.ts +61 -61
  114. package/lib/types/helpers.js +71 -71
  115. package/lib/utils/ResourceUtils.d.ts +2 -2
  116. package/lib/utils/ResourceUtils.js +7 -7
  117. package/lib/utils/ResponseUtils.d.ts +11 -11
  118. package/lib/utils/ResponseUtils.js +41 -41
  119. package/lib/utils/StringUtils.d.ts +9 -9
  120. package/lib/utils/StringUtils.js +46 -46
  121. package/lib/view/asset-manifest.json +18 -18
  122. package/lib/view/assets/icons/delete_icon.svg +3 -3
  123. package/lib/view/assets/icons/flags/ic_flag_cn.svg +9 -9
  124. package/lib/view/assets/icons/flags/ic_flag_sa.svg +9 -9
  125. package/lib/view/assets/icons/flags/ic_flag_vn.svg +9 -9
  126. package/lib/view/assets/icons/info_icon.svg +3 -3
  127. package/lib/view/assets/icons/navbar/ic_banking.svg +5 -5
  128. package/lib/view/assets/icons/navbar/ic_invoice.svg +4 -4
  129. package/lib/view/assets/icons/navbar/ic_kanban.svg +7 -7
  130. package/lib/view/assets/icons/navbar/ic_menu_item.svg +8 -8
  131. package/lib/view/assets/icons/small_info_icon.svg +3 -3
  132. package/lib/view/assets/illustrations/Group 16.svg +4 -4
  133. package/lib/view/assets/illustrations/logo.svg +5 -5
  134. package/lib/view/favicon/browserconfig.xml +9 -9
  135. package/lib/view/favicon/safari-pinned-tab.svg +182 -182
  136. package/lib/view/favicon/site.webmanifest +19 -19
  137. package/lib/view/fonts/index.css +18 -18
  138. package/lib/view/index.html +52 -52
  139. package/lib/view/manifest.json +20 -20
  140. package/lib/view/robots.txt +3 -3
  141. package/lib/view/static/css/main.54de06ef.css +1 -1
  142. package/lib/view/static/js/574.778b5963.chunk.js +1 -1
  143. package/lib/view/static/js/678.521704a3.chunk.js +1 -1
  144. package/lib/view/static/js/798.54856416.chunk.js +1 -1
  145. package/lib/view/static/js/main.4687f255.js +2 -2
  146. package/lib/view/static/js/main.4687f255.js.LICENSE.txt +214 -214
  147. package/package.json +58 -58
@@ -1,179 +1,179 @@
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
39
- ? this.addExtraActions(JSON.parse(JSON.stringify(resource.properties.actions.extras)))
40
- : actions.extras;
41
- continue;
42
- }
43
- const translation = ResourceHelper_1.default.checkActionTranslation(resource, key);
44
- actions[key] = this.appendActionValues(key, actions[key], translation);
45
- }
46
- return actions;
47
- }
48
- static addExtraActions(extraActions) {
49
- var extraActionsObject = {
50
- record: {},
51
- resource: {},
52
- };
53
- extraActions.forEach((action) => {
54
- action.keys = action.isVisible ? Object.keys(action.isVisible) : [];
55
- action.name = (0, i18n_1.__)({ phrase: action.name, locale: i18n_1.default.getLocale() });
56
- action.guardTitle = action.guardTitle
57
- ? (0, i18n_1.__)({ phrase: action.guardTitle, locale: i18n_1.default.getLocale() })
58
- : undefined;
59
- action.guard = action.guard
60
- ? (0, i18n_1.__)({ phrase: action.guard, locale: i18n_1.default.getLocale() })
61
- : undefined;
62
- action.message = action.message
63
- ? (0, i18n_1.__)({ phrase: action.message, locale: i18n_1.default.getLocale() })
64
- : undefined;
65
- action.handlerStrategy = action.handlerStrategy
66
- ? action.handlerStrategy
67
- : helpers_1.HandlerStrategy.NORMAL;
68
- action.actionType
69
- ? (extraActionsObject[action.actionType][action.key] = action)
70
- : "";
71
- });
72
- return extraActionsObject;
73
- }
74
- static getActions(actions, currentUser, configuration) {
75
- var _a, _b, _c, _d, _e, _f, _g;
76
- var actionObject = {
77
- show: {
78
- isAccessible: ((_a = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _a === void 0 ? void 0 : _a.show) === false ? false : true,
79
- isMainAction: true
80
- },
81
- new: {
82
- isAccessible: ((_b = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _b === void 0 ? void 0 : _b.new) === false ? false : true,
83
- },
84
- edit: {
85
- isAccessible: ((_c = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _c === void 0 ? void 0 : _c.edit) === false ? false : true,
86
- isMainAction: true
87
- },
88
- delete: {
89
- isAccessible: ((_d = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _d === void 0 ? void 0 : _d.delete) === false ? false : true,
90
- },
91
- bulkDelete: {
92
- isAccessible: ((_e = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _e === void 0 ? void 0 : _e.bulkDelete) === true ? true : false,
93
- },
94
- };
95
- if (!actions || Object.keys(actions).length === 0) {
96
- return actionObject;
97
- }
98
- for (const key in actions) {
99
- if (actions[key].hasOwnProperty("isAccessible") && key !== "extras") {
100
- actionObject[key] = actions[key];
101
- }
102
- else if (actions[key].isAllowed && key !== "extras") {
103
- actionObject[key] = {
104
- isAccessible: actions[key].isAllowed(currentUser),
105
- };
106
- }
107
- else if (key === "extras") {
108
- actionObject[key] = actions[key];
109
- }
110
- actionObject[key].reloadAfterAction = (_f = actions[key]) === null || _f === void 0 ? void 0 : _f.reloadAfterAction;
111
- actionObject[key].isMainAction =
112
- (_g = actions[key].isMainAction) !== null && _g !== void 0 ? _g : (key === "edit" || key === "show");
113
- }
114
- return actionObject;
115
- }
116
- static appendActionValues(action, actionObject, translation) {
117
- switch (action) {
118
- case "new":
119
- actionObject.value = translation
120
- ? translation
121
- : (0, i18n_1.__)({ phrase: "actions_new", locale: i18n_1.default.getLocale() });
122
- break;
123
- case "edit":
124
- actionObject.value = translation
125
- ? translation
126
- : (0, i18n_1.__)({ phrase: "actions_edit", locale: i18n_1.default.getLocale() });
127
- break;
128
- case "show":
129
- actionObject.value = translation
130
- ? translation
131
- : (0, i18n_1.__)({ phrase: "actions_show", locale: i18n_1.default.getLocale() });
132
- break;
133
- case "delete":
134
- actionObject.value = translation
135
- ? translation
136
- : (0, i18n_1.__)({ phrase: "actions_delete", locale: i18n_1.default.getLocale() });
137
- actionObject.confirmationMessageTitle = (0, i18n_1.__)({
138
- phrase: "actions_delete_confirmMessage_title",
139
- locale: i18n_1.default.getLocale(),
140
- });
141
- actionObject.confirmationMessageBody = (0, i18n_1.__)({
142
- phrase: "actions_delete_confirmMessage_body",
143
- locale: i18n_1.default.getLocale(),
144
- });
145
- actionObject.confirmDeleteOption = (0, i18n_1.__)({
146
- phrase: "actions_delete_options_yes",
147
- locale: i18n_1.default.getLocale(),
148
- });
149
- actionObject.cancelDeleteOption = (0, i18n_1.__)({
150
- phrase: "actions_delete_options_no",
151
- locale: i18n_1.default.getLocale(),
152
- });
153
- break;
154
- case "bulkDelete":
155
- actionObject.value = translation
156
- ? translation
157
- : (0, i18n_1.__)({ phrase: "actions_delete", locale: i18n_1.default.getLocale() });
158
- actionObject.confirmationMessageTitle = (0, i18n_1.__)({
159
- phrase: "actions_bulkDelete_confirmMessage_title",
160
- locale: i18n_1.default.getLocale(),
161
- });
162
- actionObject.confirmationMessageBody = (0, i18n_1.__)({
163
- phrase: "actions_bulkDelete_confirmMessage_body",
164
- locale: i18n_1.default.getLocale(),
165
- });
166
- actionObject.confirmDeleteOption = (0, i18n_1.__)({
167
- phrase: "actions_delete_options_yes",
168
- locale: i18n_1.default.getLocale(),
169
- });
170
- actionObject.cancelDeleteOption = (0, i18n_1.__)({
171
- phrase: "actions_delete_options_no",
172
- locale: i18n_1.default.getLocale(),
173
- });
174
- break;
175
- }
176
- return actionObject;
177
- }
178
- }
179
- 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
39
+ ? this.addExtraActions(JSON.parse(JSON.stringify(resource.properties.actions.extras)))
40
+ : actions.extras;
41
+ continue;
42
+ }
43
+ const translation = ResourceHelper_1.default.checkActionTranslation(resource, key);
44
+ actions[key] = this.appendActionValues(key, actions[key], translation);
45
+ }
46
+ return actions;
47
+ }
48
+ static addExtraActions(extraActions) {
49
+ var extraActionsObject = {
50
+ record: {},
51
+ resource: {},
52
+ };
53
+ extraActions.forEach((action) => {
54
+ action.keys = action.isVisible ? Object.keys(action.isVisible) : [];
55
+ action.name = (0, i18n_1.__)({ phrase: action.name, locale: i18n_1.default.getLocale() });
56
+ action.guardTitle = action.guardTitle
57
+ ? (0, i18n_1.__)({ phrase: action.guardTitle, locale: i18n_1.default.getLocale() })
58
+ : undefined;
59
+ action.guard = action.guard
60
+ ? (0, i18n_1.__)({ phrase: action.guard, locale: i18n_1.default.getLocale() })
61
+ : undefined;
62
+ action.message = action.message
63
+ ? (0, i18n_1.__)({ phrase: action.message, locale: i18n_1.default.getLocale() })
64
+ : undefined;
65
+ action.handlerStrategy = action.handlerStrategy
66
+ ? action.handlerStrategy
67
+ : helpers_1.HandlerStrategy.NORMAL;
68
+ action.actionType
69
+ ? (extraActionsObject[action.actionType][action.key] = action)
70
+ : "";
71
+ });
72
+ return extraActionsObject;
73
+ }
74
+ static getActions(actions, currentUser, configuration) {
75
+ var _a, _b, _c, _d, _e, _f, _g;
76
+ var actionObject = {
77
+ show: {
78
+ isAccessible: ((_a = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _a === void 0 ? void 0 : _a.show) === false ? false : true,
79
+ isMainAction: true
80
+ },
81
+ new: {
82
+ isAccessible: ((_b = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _b === void 0 ? void 0 : _b.new) === false ? false : true,
83
+ },
84
+ edit: {
85
+ isAccessible: ((_c = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _c === void 0 ? void 0 : _c.edit) === false ? false : true,
86
+ isMainAction: true
87
+ },
88
+ delete: {
89
+ isAccessible: ((_d = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _d === void 0 ? void 0 : _d.delete) === false ? false : true,
90
+ },
91
+ bulkDelete: {
92
+ isAccessible: ((_e = configuration === null || configuration === void 0 ? void 0 : configuration.actions) === null || _e === void 0 ? void 0 : _e.bulkDelete) === true ? true : false,
93
+ },
94
+ };
95
+ if (!actions || Object.keys(actions).length === 0) {
96
+ return actionObject;
97
+ }
98
+ for (const key in actions) {
99
+ if (actions[key].hasOwnProperty("isAccessible") && key !== "extras") {
100
+ actionObject[key] = actions[key];
101
+ }
102
+ else if (actions[key].isAllowed && key !== "extras") {
103
+ actionObject[key] = {
104
+ isAccessible: actions[key].isAllowed(currentUser),
105
+ };
106
+ }
107
+ else if (key === "extras") {
108
+ actionObject[key] = actions[key];
109
+ }
110
+ actionObject[key].reloadAfterAction = (_f = actions[key]) === null || _f === void 0 ? void 0 : _f.reloadAfterAction;
111
+ actionObject[key].isMainAction =
112
+ (_g = actions[key].isMainAction) !== null && _g !== void 0 ? _g : (key === "edit" || key === "show");
113
+ }
114
+ return actionObject;
115
+ }
116
+ static appendActionValues(action, actionObject, translation) {
117
+ switch (action) {
118
+ case "new":
119
+ actionObject.value = translation
120
+ ? translation
121
+ : (0, i18n_1.__)({ phrase: "actions_new", locale: i18n_1.default.getLocale() });
122
+ break;
123
+ case "edit":
124
+ actionObject.value = translation
125
+ ? translation
126
+ : (0, i18n_1.__)({ phrase: "actions_edit", locale: i18n_1.default.getLocale() });
127
+ break;
128
+ case "show":
129
+ actionObject.value = translation
130
+ ? translation
131
+ : (0, i18n_1.__)({ phrase: "actions_show", locale: i18n_1.default.getLocale() });
132
+ break;
133
+ case "delete":
134
+ actionObject.value = translation
135
+ ? translation
136
+ : (0, i18n_1.__)({ phrase: "actions_delete", locale: i18n_1.default.getLocale() });
137
+ actionObject.confirmationMessageTitle = (0, i18n_1.__)({
138
+ phrase: "actions_delete_confirmMessage_title",
139
+ locale: i18n_1.default.getLocale(),
140
+ });
141
+ actionObject.confirmationMessageBody = (0, i18n_1.__)({
142
+ phrase: "actions_delete_confirmMessage_body",
143
+ locale: i18n_1.default.getLocale(),
144
+ });
145
+ actionObject.confirmDeleteOption = (0, i18n_1.__)({
146
+ phrase: "actions_delete_options_yes",
147
+ locale: i18n_1.default.getLocale(),
148
+ });
149
+ actionObject.cancelDeleteOption = (0, i18n_1.__)({
150
+ phrase: "actions_delete_options_no",
151
+ locale: i18n_1.default.getLocale(),
152
+ });
153
+ break;
154
+ case "bulkDelete":
155
+ actionObject.value = translation
156
+ ? translation
157
+ : (0, i18n_1.__)({ phrase: "actions_delete", locale: i18n_1.default.getLocale() });
158
+ actionObject.confirmationMessageTitle = (0, i18n_1.__)({
159
+ phrase: "actions_bulkDelete_confirmMessage_title",
160
+ locale: i18n_1.default.getLocale(),
161
+ });
162
+ actionObject.confirmationMessageBody = (0, i18n_1.__)({
163
+ phrase: "actions_bulkDelete_confirmMessage_body",
164
+ locale: i18n_1.default.getLocale(),
165
+ });
166
+ actionObject.confirmDeleteOption = (0, i18n_1.__)({
167
+ phrase: "actions_delete_options_yes",
168
+ locale: i18n_1.default.getLocale(),
169
+ });
170
+ actionObject.cancelDeleteOption = (0, i18n_1.__)({
171
+ phrase: "actions_delete_options_no",
172
+ locale: i18n_1.default.getLocale(),
173
+ });
174
+ break;
175
+ }
176
+ return actionObject;
177
+ }
178
+ }
179
+ exports.default = ActionsGenerator;
@@ -1,9 +1,9 @@
1
- import { IResourceFile } from "../types/IResourceFile";
2
- export default class FilterHelper {
3
- static appendFilters(filterQuery: {
4
- [key: string]: any;
5
- }, filters: string[] | undefined, resource?: IResourceFile): Promise<{
6
- [key: string]: any;
7
- }>;
8
- private static getVirtualFilter;
9
- }
1
+ import { IResourceFile } from "../types/IResourceFile";
2
+ export default class FilterHelper {
3
+ static appendFilters(filterQuery: {
4
+ [key: string]: any;
5
+ }, filters: string[] | undefined, resource?: IResourceFile): Promise<{
6
+ [key: string]: any;
7
+ }>;
8
+ private static getVirtualFilter;
9
+ }
@@ -1,105 +1,105 @@
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
- const mongoose_1 = __importDefault(require("mongoose"));
16
- const helpers_1 = require("../types/helpers");
17
- const LocalizedStringHelper_1 = __importDefault(require("./LocalizedStringHelper"));
18
- var pluralize = require('pluralize');
19
- class FilterHelper {
20
- static appendFilters(filterQuery, filters, resource) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- if (!filters) {
23
- return filterQuery;
24
- }
25
- for (var i = 0; i < filters.length; i++) {
26
- const filter = filters[i];
27
- if (!filter || filter === '' || !filter.includes(';;')) {
28
- continue;
29
- }
30
- const filterQueryString = filter.split(';;');
31
- const fieldType = filterQueryString[1];
32
- if (fieldType === helpers_1.FieldTypes.NUMBER || fieldType === helpers_1.FieldTypes.DATE) {
33
- const rangeObject = filterQueryString[0].split(':');
34
- const fieldName = rangeObject[0];
35
- const fromToObject = rangeObject[1].split(',');
36
- const from = fromToObject[0].split('=')[1];
37
- const to = fromToObject[1].split('=')[1];
38
- var filterRange = {};
39
- if (from && from !== '' && from !== 'null') {
40
- filterRange.$gte = from;
41
- }
42
- if (to && to !== '' && to !== 'null') {
43
- filterRange.$lte = to;
44
- }
45
- if (filterRange.$lte || filterRange.$gte) {
46
- filterQuery[fieldName] = filterRange;
47
- }
48
- continue;
49
- }
50
- if (!filterQueryString[0] || !fieldType || !filterQueryString[0].includes('=')) {
51
- continue;
52
- }
53
- const splittedQueryString = filterQueryString[0].split('=');
54
- const key = splittedQueryString[0];
55
- const value = splittedQueryString[1].includes('%20') ? splittedQueryString[1].replace(/%20/g, ' ') : splittedQueryString[1];
56
- switch (fieldType) {
57
- case helpers_1.FieldTypes.OBJECTID:
58
- if (!mongoose_1.default.isValidObjectId(value)) {
59
- break;
60
- }
61
- filterQuery[key] = value;
62
- break;
63
- case helpers_1.FieldTypes.STRING:
64
- filterQuery[key] = new RegExp(value, 'i');
65
- break;
66
- case helpers_1.FieldTypes.LOCALIZEDSTRING:
67
- filterQuery.$or = [
68
- LocalizedStringHelper_1.default.getFilterObject(key, "0", new RegExp(value, 'i')),
69
- LocalizedStringHelper_1.default.getFilterObject(key, "1", new RegExp(value, 'i')),
70
- ];
71
- break;
72
- case helpers_1.FieldTypes.REFERENCE:
73
- if (value !== 'null' && value !== 'undefined') {
74
- filterQuery = yield this.getVirtualFilter(filterQuery, key, value, resource);
75
- }
76
- break;
77
- default:
78
- if (value !== 'null' && value !== 'undefined') {
79
- filterQuery[key] = value;
80
- }
81
- }
82
- }
83
- return filterQuery;
84
- });
85
- }
86
- static getVirtualFilter(filterQuery, key, value, resource) {
87
- return __awaiter(this, void 0, void 0, function* () {
88
- if (resource && resource.properties.model) {
89
- const virtuals = resource.properties.model.virtuals;
90
- if (virtuals && virtuals[key] && virtuals[key].showIn === helpers_1.Virtuals.FILTER && virtuals[key].handler) {
91
- const virtual = virtuals[key];
92
- filterQuery = yield virtual.handler(filterQuery, value);
93
- }
94
- else {
95
- filterQuery[key] = value;
96
- }
97
- }
98
- else {
99
- filterQuery[key] = value;
100
- }
101
- return filterQuery;
102
- });
103
- }
104
- }
105
- exports.default = FilterHelper;
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
+ const mongoose_1 = __importDefault(require("mongoose"));
16
+ const helpers_1 = require("../types/helpers");
17
+ const LocalizedStringHelper_1 = __importDefault(require("./LocalizedStringHelper"));
18
+ var pluralize = require('pluralize');
19
+ class FilterHelper {
20
+ static appendFilters(filterQuery, filters, resource) {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ if (!filters) {
23
+ return filterQuery;
24
+ }
25
+ for (var i = 0; i < filters.length; i++) {
26
+ const filter = filters[i];
27
+ if (!filter || filter === '' || !filter.includes(';;')) {
28
+ continue;
29
+ }
30
+ const filterQueryString = filter.split(';;');
31
+ const fieldType = filterQueryString[1];
32
+ if (fieldType === helpers_1.FieldTypes.NUMBER || fieldType === helpers_1.FieldTypes.DATE) {
33
+ const rangeObject = filterQueryString[0].split(':');
34
+ const fieldName = rangeObject[0];
35
+ const fromToObject = rangeObject[1].split(',');
36
+ const from = fromToObject[0].split('=')[1];
37
+ const to = fromToObject[1].split('=')[1];
38
+ var filterRange = {};
39
+ if (from && from !== '' && from !== 'null') {
40
+ filterRange.$gte = from;
41
+ }
42
+ if (to && to !== '' && to !== 'null') {
43
+ filterRange.$lte = to;
44
+ }
45
+ if (filterRange.$lte || filterRange.$gte) {
46
+ filterQuery[fieldName] = filterRange;
47
+ }
48
+ continue;
49
+ }
50
+ if (!filterQueryString[0] || !fieldType || !filterQueryString[0].includes('=')) {
51
+ continue;
52
+ }
53
+ const splittedQueryString = filterQueryString[0].split('=');
54
+ const key = splittedQueryString[0];
55
+ const value = splittedQueryString[1].includes('%20') ? splittedQueryString[1].replace(/%20/g, ' ') : splittedQueryString[1];
56
+ switch (fieldType) {
57
+ case helpers_1.FieldTypes.OBJECTID:
58
+ if (!mongoose_1.default.isValidObjectId(value)) {
59
+ break;
60
+ }
61
+ filterQuery[key] = value;
62
+ break;
63
+ case helpers_1.FieldTypes.STRING:
64
+ filterQuery[key] = new RegExp(value, 'i');
65
+ break;
66
+ case helpers_1.FieldTypes.LOCALIZEDSTRING:
67
+ filterQuery.$or = [
68
+ LocalizedStringHelper_1.default.getFilterObject(key, "0", new RegExp(value, 'i')),
69
+ LocalizedStringHelper_1.default.getFilterObject(key, "1", new RegExp(value, 'i')),
70
+ ];
71
+ break;
72
+ case helpers_1.FieldTypes.REFERENCE:
73
+ if (value !== 'null' && value !== 'undefined') {
74
+ filterQuery = yield this.getVirtualFilter(filterQuery, key, value, resource);
75
+ }
76
+ break;
77
+ default:
78
+ if (value !== 'null' && value !== 'undefined') {
79
+ filterQuery[key] = value;
80
+ }
81
+ }
82
+ }
83
+ return filterQuery;
84
+ });
85
+ }
86
+ static getVirtualFilter(filterQuery, key, value, resource) {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ if (resource && resource.properties.model) {
89
+ const virtuals = resource.properties.model.virtuals;
90
+ if (virtuals && virtuals[key] && virtuals[key].showIn === helpers_1.Virtuals.FILTER && virtuals[key].handler) {
91
+ const virtual = virtuals[key];
92
+ filterQuery = yield virtual.handler(filterQuery, value);
93
+ }
94
+ else {
95
+ filterQuery[key] = value;
96
+ }
97
+ }
98
+ else {
99
+ filterQuery[key] = value;
100
+ }
101
+ return filterQuery;
102
+ });
103
+ }
104
+ }
105
+ exports.default = FilterHelper;
@@ -1,4 +1,4 @@
1
- import { IResourceFile } from "../types/IResourceFile";
2
- export default class LocalesHelper {
3
- static localizeResource(resource: IResourceFile): any;
4
- }
1
+ import { IResourceFile } from "../types/IResourceFile";
2
+ export default class LocalesHelper {
3
+ static localizeResource(resource: IResourceFile): any;
4
+ }