identity-admin 1.28.24 → 1.28.26

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 (213) hide show
  1. package/README.md +148 -295
  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/PermissionController.d.ts +6 -0
  23. package/lib/controllers/PermissionController.js +52 -0
  24. package/lib/controllers/ResourceController.d.ts +15 -15
  25. package/lib/controllers/ResourceController.js +128 -126
  26. package/lib/helpers/ActionsGenerator.d.ts +11 -11
  27. package/lib/helpers/ActionsGenerator.js +168 -168
  28. package/lib/helpers/AdminNotifications/AdminNotificationCreation.d.ts +54 -54
  29. package/lib/helpers/AdminNotifications/AdminNotificationCreation.js +66 -66
  30. package/lib/helpers/AdminNotifications/AdminNotificationFetcher.d.ts +63 -63
  31. package/lib/helpers/AdminNotifications/AdminNotificationFetcher.js +45 -45
  32. package/lib/helpers/FilterQueryHelper.d.ts +9 -9
  33. package/lib/helpers/FilterQueryHelper.js +83 -83
  34. package/lib/helpers/FiltersHelper.d.ts +9 -9
  35. package/lib/helpers/FiltersHelper.js +126 -126
  36. package/lib/helpers/JsonRichText/DraftRawToUniversalConverter.d.ts +3 -3
  37. package/lib/helpers/JsonRichText/DraftRawToUniversalConverter.js +144 -144
  38. package/lib/helpers/JsonRichText/IDraftRawType.d.ts +18 -18
  39. package/lib/helpers/JsonRichText/IDraftRawType.js +2 -2
  40. package/lib/helpers/JsonRichText/IUniversalJsonType.d.ts +24 -24
  41. package/lib/helpers/JsonRichText/IUniversalJsonType.js +10 -10
  42. package/lib/helpers/LocalesHelper.d.ts +4 -4
  43. package/lib/helpers/LocalesHelper.js +73 -73
  44. package/lib/helpers/LocalizedStringHelper.d.ts +11 -11
  45. package/lib/helpers/LocalizedStringHelper.js +76 -76
  46. package/lib/helpers/Permissions/PermissionFetcher.d.ts +8 -8
  47. package/lib/helpers/Permissions/PermissionFetcher.js +95 -95
  48. package/lib/helpers/Permissions/PermissionLabel.d.ts +2 -2
  49. package/lib/helpers/Permissions/PermissionLabel.js +42 -42
  50. package/lib/helpers/Permissions/PermissionMapper.d.ts +13 -13
  51. package/lib/helpers/Permissions/PermissionMapper.js +35 -35
  52. package/lib/helpers/Permissions/PermissionResource.d.ts +6 -6
  53. package/lib/helpers/Permissions/PermissionResource.js +62 -62
  54. package/lib/helpers/Permissions/PermissionSavingService.d.ts +13 -13
  55. package/lib/helpers/Permissions/PermissionSavingService.js +32 -32
  56. package/lib/helpers/Permissions/SavePermissionGroup.d.ts +6 -6
  57. package/lib/helpers/Permissions/SavePermissionGroup.js +32 -32
  58. package/lib/helpers/Permissions/UpdatePermissionGroup.d.ts +6 -6
  59. package/lib/helpers/Permissions/UpdatePermissionGroup.js +50 -50
  60. package/lib/helpers/Permissions/types.d.ts +17 -17
  61. package/lib/helpers/Permissions/types.js +2 -2
  62. package/lib/helpers/PopulationHelper.d.ts +12 -12
  63. package/lib/helpers/PopulationHelper.js +50 -50
  64. package/lib/helpers/RecordsCounter.d.ts +10 -10
  65. package/lib/helpers/RecordsCounter.js +33 -33
  66. package/lib/helpers/ReportsGenerator.d.ts +26 -26
  67. package/lib/helpers/ReportsGenerator.js +162 -162
  68. package/lib/helpers/ResourceGenerator.d.ts +9 -9
  69. package/lib/helpers/ResourceGenerator.js +172 -172
  70. package/lib/helpers/ResourceHelper.d.ts +28 -28
  71. package/lib/helpers/ResourceHelper.js +397 -397
  72. package/lib/helpers/RportsGenerator.d.ts +10 -10
  73. package/lib/helpers/RportsGenerator.js +21 -21
  74. package/lib/helpers/SchemaGenerator.d.ts +7 -7
  75. package/lib/helpers/SchemaGenerator.js +137 -137
  76. package/lib/helpers/SchemaHelper.d.ts +5 -5
  77. package/lib/helpers/SchemaHelper.js +21 -21
  78. package/lib/helpers/UserActionsLog/UserActionsLogHelper.d.ts +2 -2
  79. package/lib/helpers/UserActionsLog/UserActionsLogHelper.js +49 -49
  80. package/lib/locales/en.json +54 -54
  81. package/lib/middlewares/cache/decorator.d.ts +3 -3
  82. package/lib/middlewares/cache/decorator.js +60 -60
  83. package/lib/middlewares/cache/deletionMethods.d.ts +3 -3
  84. package/lib/middlewares/cache/deletionMethods.js +23 -23
  85. package/lib/middlewares/isAuth.d.ts +13 -13
  86. package/lib/middlewares/isAuth.js +43 -43
  87. package/lib/models/ModelNames.d.ts +10 -10
  88. package/lib/models/ModelNames.js +13 -13
  89. package/lib/models/adminNotification/AdminNotification.d.ts +5 -5
  90. package/lib/models/adminNotification/AdminNotification.js +70 -70
  91. package/lib/models/adminNotification/IAdminNotification.d.ts +35 -35
  92. package/lib/models/adminNotification/IAdminNotification.js +15 -15
  93. package/lib/models/adminpermission/AdminPermission.d.ts +6 -11
  94. package/lib/models/adminpermission/AdminPermission.js +27 -23
  95. package/lib/models/adminpermission/IAdminPermission.d.ts +13 -13
  96. package/lib/models/adminpermission/IAdminPermission.js +2 -2
  97. package/lib/models/customPage/CustomPage.d.ts +2 -2
  98. package/lib/models/customPage/CustomPage.js +38 -38
  99. package/lib/models/customPage/ICustomPage.d.ts +17 -17
  100. package/lib/models/customPage/ICustomPage.js +2 -2
  101. package/lib/models/file/File.d.ts +2 -2
  102. package/lib/models/file/File.js +23 -23
  103. package/lib/models/file/IFile.d.ts +15 -15
  104. package/lib/models/file/IFile.js +2 -2
  105. package/lib/models/language/ILanguage.d.ts +8 -0
  106. package/lib/models/language/ILanguage.js +8 -0
  107. package/lib/models/language/LanguageSchema.d.ts +9 -0
  108. package/lib/models/language/LanguageSchema.js +17 -0
  109. package/lib/models/location/ILocation.d.ts +16 -16
  110. package/lib/models/location/ILocation.js +2 -2
  111. package/lib/models/location/Location.d.ts +2 -2
  112. package/lib/models/location/Location.js +29 -29
  113. package/lib/models/mailLog/IMailLog.d.ts +14 -14
  114. package/lib/models/mailLog/IMailLog.js +2 -2
  115. package/lib/models/mailLog/MailLog.d.ts +3 -3
  116. package/lib/models/mailLog/MailLog.js +23 -23
  117. package/lib/models/modelConfiguration/IModelConfigurations.d.ts +31 -31
  118. package/lib/models/modelConfiguration/IModelConfigurations.js +2 -2
  119. package/lib/models/modelConfiguration/ModelConfiguration.d.ts +13 -13
  120. package/lib/models/modelConfiguration/ModelConfiguration.js +103 -103
  121. package/lib/models/permission/IPermission.d.ts +14 -14
  122. package/lib/models/permission/IPermission.js +2 -2
  123. package/lib/models/permission/Permission.d.ts +6 -2
  124. package/lib/models/permission/Permission.js +28 -21
  125. package/lib/models/permissiongroup/IPermissionGroup.d.ts +13 -0
  126. package/lib/models/permissiongroup/IPermissionGroup.js +2 -0
  127. package/lib/models/permissiongroup/PermissionGroup.d.ts +6 -0
  128. package/lib/models/permissiongroup/PermissionGroup.js +16 -0
  129. package/lib/models/request-log/IRequestLog.d.ts +22 -22
  130. package/lib/models/request-log/IRequestLog.js +2 -2
  131. package/lib/models/request-log/RequestLog.d.ts +3 -3
  132. package/lib/models/request-log/RequestLog.js +51 -51
  133. package/lib/models/userActionsLog/IUserActionsLog.d.ts +26 -26
  134. package/lib/models/userActionsLog/IUserActionsLog.js +11 -11
  135. package/lib/models/userActionsLog/UserActionsLog.d.ts +3 -3
  136. package/lib/models/userActionsLog/UserActionsLog.js +41 -41
  137. package/lib/pdf/ReportTemplate.d.ts +71 -71
  138. package/lib/pdf/ReportTemplate.js +94 -94
  139. package/lib/repositories/AdminNotificationRepository.d.ts +7 -7
  140. package/lib/repositories/AdminNotificationRepository.js +23 -23
  141. package/lib/repositories/AdminPermissionRepository.d.ts +7 -0
  142. package/lib/repositories/AdminPermissionRepository.js +23 -0
  143. package/lib/repositories/DashboardRepository.d.ts +5 -5
  144. package/lib/repositories/DashboardRepository.js +12 -12
  145. package/lib/repositories/PermissionGroupRepository.d.ts +7 -0
  146. package/lib/repositories/PermissionGroupRepository.js +23 -0
  147. package/lib/repositories/PermissionRepository.d.ts +7 -0
  148. package/lib/repositories/PermissionRepository.js +23 -0
  149. package/lib/repositories/Repository.d.ts +68 -68
  150. package/lib/repositories/Repository.js +215 -215
  151. package/lib/repositories/RequestLogRepository.d.ts +10 -10
  152. package/lib/repositories/RequestLogRepository.js +54 -54
  153. package/lib/repositories/SaveResult.d.ts +14 -14
  154. package/lib/repositories/SaveResult.js +18 -18
  155. package/lib/resources/AdminNotificationsResource.d.ts +3 -3
  156. package/lib/resources/AdminNotificationsResource.js +23 -23
  157. package/lib/resources/AdminPermissionResource.d.ts +5 -0
  158. package/lib/resources/AdminPermissionResource.js +36 -0
  159. package/lib/resources/PermissionGroupResource.d.ts +5 -0
  160. package/lib/resources/PermissionGroupResource.js +53 -0
  161. package/lib/resources/PermissionsResource.d.ts +5 -0
  162. package/lib/resources/PermissionsResource.js +23 -0
  163. package/lib/resources/parents.d.ts +12 -4
  164. package/lib/resources/parents.js +15 -7
  165. package/lib/router/index.d.ts +8 -8
  166. package/lib/router/index.js +104 -104
  167. package/lib/seeds/PermissionSeeder.d.ts +4 -0
  168. package/lib/seeds/PermissionSeeder.js +56 -0
  169. package/lib/types/DashbordConfig.d.ts +21 -21
  170. package/lib/types/DashbordConfig.js +2 -2
  171. package/lib/types/IConfigurationFile.d.ts +14 -13
  172. package/lib/types/IConfigurationFile.js +2 -2
  173. package/lib/types/IResourceFile.d.ts +736 -736
  174. package/lib/types/IResourceFile.js +2 -2
  175. package/lib/types/IResourceResponse.d.ts +96 -96
  176. package/lib/types/IResourceResponse.js +2 -2
  177. package/lib/types/helpers.d.ts +71 -68
  178. package/lib/types/helpers.js +83 -83
  179. package/lib/utils/DateUtils.d.ts +7 -7
  180. package/lib/utils/DateUtils.js +45 -45
  181. package/lib/utils/ResourceUtils.d.ts +2 -2
  182. package/lib/utils/ResourceUtils.js +7 -7
  183. package/lib/utils/ResponseUtils.d.ts +11 -11
  184. package/lib/utils/ResponseUtils.js +41 -41
  185. package/lib/utils/StringUtils.d.ts +9 -9
  186. package/lib/utils/StringUtils.js +46 -46
  187. package/lib/view/asset-manifest.json +18 -18
  188. package/lib/view/assets/icons/delete_icon.svg +3 -3
  189. package/lib/view/assets/icons/flags/ic_flag_cn.svg +9 -9
  190. package/lib/view/assets/icons/flags/ic_flag_sa.svg +9 -9
  191. package/lib/view/assets/icons/flags/ic_flag_vn.svg +9 -9
  192. package/lib/view/assets/icons/info_icon.svg +3 -3
  193. package/lib/view/assets/icons/navbar/ic_banking.svg +5 -5
  194. package/lib/view/assets/icons/navbar/ic_invoice.svg +4 -4
  195. package/lib/view/assets/icons/navbar/ic_kanban.svg +7 -7
  196. package/lib/view/assets/icons/navbar/ic_menu_item.svg +8 -8
  197. package/lib/view/assets/icons/small_info_icon.svg +3 -3
  198. package/lib/view/assets/illustrations/Group 16.svg +4 -4
  199. package/lib/view/assets/illustrations/logo.svg +5 -5
  200. package/lib/view/favicon/browserconfig.xml +9 -9
  201. package/lib/view/favicon/safari-pinned-tab.svg +182 -182
  202. package/lib/view/favicon/site.webmanifest +19 -19
  203. package/lib/view/fonts/index.css +18 -18
  204. package/lib/view/index.html +52 -52
  205. package/lib/view/manifest.json +20 -20
  206. package/lib/view/robots.txt +3 -3
  207. package/lib/view/static/css/main.54de06ef.css +1 -1
  208. package/lib/view/static/js/574.778b5963.chunk.js +1 -1
  209. package/lib/view/static/js/678.521704a3.chunk.js +1 -1
  210. package/lib/view/static/js/798.54856416.chunk.js +1 -1
  211. package/lib/view/static/js/main.4687f255.js +2 -2
  212. package/lib/view/static/js/main.4687f255.js.LICENSE.txt +214 -214
  213. package/package.json +64 -64
@@ -1,126 +1,126 @@
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
- case helpers_1.FieldTypes.ENUM:
78
- if (value !== 'null' && value !== 'undefined') {
79
- const valueArray = value.split(',');
80
- if (valueArray.length > 1) {
81
- filterQuery[key] = {
82
- $in: value.split(','),
83
- };
84
- }
85
- else {
86
- filterQuery[key] = value;
87
- }
88
- }
89
- break;
90
- default:
91
- if (value !== 'null' && value !== 'undefined') {
92
- filterQuery[key] = value;
93
- }
94
- }
95
- }
96
- return filterQuery;
97
- });
98
- }
99
- static getVirtualFilter(filterQuery, key, value, resource) {
100
- return __awaiter(this, void 0, void 0, function* () {
101
- if (resource && resource.properties.model) {
102
- const virtuals = resource.properties.model.virtuals;
103
- if (virtuals && virtuals[key] && virtuals[key].showIn === helpers_1.Virtuals.FILTER && virtuals[key].handler) {
104
- const virtual = virtuals[key];
105
- filterQuery = yield virtual.handler(filterQuery, value);
106
- }
107
- else {
108
- const fieldProps = resource.properties.model[key];
109
- if (fieldProps && fieldProps.multipleInFilter) {
110
- filterQuery[key] = {
111
- $in: value.split(','),
112
- };
113
- }
114
- else {
115
- filterQuery[key] = value;
116
- }
117
- }
118
- }
119
- else {
120
- filterQuery[key] = value;
121
- }
122
- return filterQuery;
123
- });
124
- }
125
- }
126
- 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
+ case helpers_1.FieldTypes.ENUM:
78
+ if (value !== 'null' && value !== 'undefined') {
79
+ const valueArray = value.split(',');
80
+ if (valueArray.length > 1) {
81
+ filterQuery[key] = {
82
+ $in: value.split(','),
83
+ };
84
+ }
85
+ else {
86
+ filterQuery[key] = value;
87
+ }
88
+ }
89
+ break;
90
+ default:
91
+ if (value !== 'null' && value !== 'undefined') {
92
+ filterQuery[key] = value;
93
+ }
94
+ }
95
+ }
96
+ return filterQuery;
97
+ });
98
+ }
99
+ static getVirtualFilter(filterQuery, key, value, resource) {
100
+ return __awaiter(this, void 0, void 0, function* () {
101
+ if (resource && resource.properties.model) {
102
+ const virtuals = resource.properties.model.virtuals;
103
+ if (virtuals && virtuals[key] && virtuals[key].showIn === helpers_1.Virtuals.FILTER && virtuals[key].handler) {
104
+ const virtual = virtuals[key];
105
+ filterQuery = yield virtual.handler(filterQuery, value);
106
+ }
107
+ else {
108
+ const fieldProps = resource.properties.model[key];
109
+ if (fieldProps && fieldProps.multipleInFilter) {
110
+ filterQuery[key] = {
111
+ $in: value.split(','),
112
+ };
113
+ }
114
+ else {
115
+ filterQuery[key] = value;
116
+ }
117
+ }
118
+ }
119
+ else {
120
+ filterQuery[key] = value;
121
+ }
122
+ return filterQuery;
123
+ });
124
+ }
125
+ }
126
+ exports.default = FilterHelper;
@@ -1,3 +1,3 @@
1
- import { UniversalBlock } from './IUniversalJsonType';
2
- export declare function convertDraftRawToUniversal(stringifiedDraftRaw: string): UniversalBlock[];
3
- export declare function serializeUniversalBlocks(blocks?: UniversalBlock[]): string;
1
+ import { UniversalBlock } from './IUniversalJsonType';
2
+ export declare function convertDraftRawToUniversal(stringifiedDraftRaw: string): UniversalBlock[];
3
+ export declare function serializeUniversalBlocks(blocks?: UniversalBlock[]): string;
@@ -1,144 +1,144 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serializeUniversalBlocks = exports.convertDraftRawToUniversal = void 0;
4
- const IUniversalJsonType_1 = require("./IUniversalJsonType");
5
- function isSupportedInlineStyle(s) {
6
- return IUniversalJsonType_1.SUPPORTED_INLINE.has(s);
7
- }
8
- function blockTypeToHeadingLevel(t) {
9
- if (t === 'header-one')
10
- return 1;
11
- if (t === 'header-two')
12
- return 2;
13
- if (t === 'header-three')
14
- return 3;
15
- return null;
16
- }
17
- function blockTypeToListStyle(t) {
18
- if (t === 'ordered-list-item')
19
- return 'ordered';
20
- if (t === 'unordered-list-item')
21
- return 'unordered';
22
- return null;
23
- }
24
- function rangesToInlineRuns(text, ranges) {
25
- const n = text.length;
26
- if (n === 0)
27
- return [{ text: '' }];
28
- const bold = new Array(n).fill(false);
29
- const italic = new Array(n).fill(false);
30
- const underline = new Array(n).fill(false);
31
- for (const r of ranges !== null && ranges !== void 0 ? ranges : []) {
32
- if (!r || typeof r.offset !== 'number' || typeof r.length !== 'number')
33
- continue;
34
- if (!isSupportedInlineStyle(r.style))
35
- continue;
36
- const start = Math.max(0, r.offset);
37
- const end = Math.min(n, r.offset + r.length);
38
- if (end <= start)
39
- continue;
40
- for (let i = start; i < end; i++) {
41
- if (r.style === 'BOLD')
42
- bold[i] = true;
43
- else if (r.style === 'ITALIC')
44
- italic[i] = true;
45
- else if (r.style === 'UNDERLINE')
46
- underline[i] = true;
47
- }
48
- }
49
- const out = [];
50
- let runStart = 0;
51
- const sameStyle = (i, j) => bold[i] === bold[j] && italic[i] === italic[j] && underline[i] === underline[j];
52
- for (let i = 1; i < n; i++) {
53
- if (!sameStyle(i - 1, i)) {
54
- const slice = text.slice(runStart, i);
55
- if (slice.length > 0) {
56
- const node = { text: slice };
57
- if (bold[runStart])
58
- node.bold = true;
59
- if (italic[runStart])
60
- node.italic = true;
61
- if (underline[runStart])
62
- node.underline = true;
63
- out.push(node);
64
- }
65
- runStart = i;
66
- }
67
- }
68
- // last run
69
- const slice = text.slice(runStart);
70
- if (slice.length > 0) {
71
- const node = { text: slice };
72
- if (bold[runStart])
73
- node.bold = true;
74
- if (italic[runStart])
75
- node.italic = true;
76
- if (underline[runStart])
77
- node.underline = true;
78
- out.push(node);
79
- }
80
- // If the entire text was empty (shouldn't happen here), return empty node
81
- return out.length ? out : [{ text }];
82
- }
83
- function draftBlockToUniversalNonList(block) {
84
- var _a;
85
- const headingLevel = blockTypeToHeadingLevel(block.type);
86
- const children = rangesToInlineRuns((_a = block.text) !== null && _a !== void 0 ? _a : '', block.inlineStyleRanges);
87
- if (headingLevel) {
88
- return { type: IUniversalJsonType_1.BlockType.HEADING, level: headingLevel, children };
89
- }
90
- return { type: IUniversalJsonType_1.BlockType.PARAGRAPH, children };
91
- }
92
- function convertDraftRawToUniversal(stringifiedDraftRaw) {
93
- var _a, _b;
94
- if (!stringifiedDraftRaw)
95
- return [];
96
- const raw = JSON.parse(stringifiedDraftRaw);
97
- const blocks = (_a = raw === null || raw === void 0 ? void 0 : raw.blocks) !== null && _a !== void 0 ? _a : [];
98
- const out = [];
99
- let currentList = null;
100
- const flushList = () => {
101
- if (currentList)
102
- out.push(currentList);
103
- currentList = null;
104
- };
105
- for (const b of blocks) {
106
- const listStyle = blockTypeToListStyle(b.type);
107
- if (listStyle) {
108
- const itemRuns = rangesToInlineRuns((_b = b.text) !== null && _b !== void 0 ? _b : '', b.inlineStyleRanges);
109
- if (!currentList || currentList.style !== listStyle) {
110
- flushList();
111
- currentList = { type: IUniversalJsonType_1.BlockType.LIST, style: listStyle, items: [] };
112
- }
113
- currentList.items.push(itemRuns);
114
- continue;
115
- }
116
- flushList();
117
- out.push(draftBlockToUniversalNonList(b));
118
- }
119
- flushList();
120
- return out;
121
- }
122
- exports.convertDraftRawToUniversal = convertDraftRawToUniversal;
123
- function serializeUniversalBlocks(blocks) {
124
- if (!blocks) {
125
- return "";
126
- }
127
- const serializeInline = (children) => children.map((child) => child.text).join("");
128
- return blocks
129
- .map((block) => {
130
- switch (block.type) {
131
- case IUniversalJsonType_1.BlockType.HEADING:
132
- case IUniversalJsonType_1.BlockType.PARAGRAPH:
133
- return serializeInline(block.children);
134
- case IUniversalJsonType_1.BlockType.LIST:
135
- return block.items
136
- .map((itemChildren) => serializeInline(itemChildren))
137
- .join(" ");
138
- default:
139
- return "";
140
- }
141
- })
142
- .join(" ");
143
- }
144
- exports.serializeUniversalBlocks = serializeUniversalBlocks;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serializeUniversalBlocks = exports.convertDraftRawToUniversal = void 0;
4
+ const IUniversalJsonType_1 = require("./IUniversalJsonType");
5
+ function isSupportedInlineStyle(s) {
6
+ return IUniversalJsonType_1.SUPPORTED_INLINE.has(s);
7
+ }
8
+ function blockTypeToHeadingLevel(t) {
9
+ if (t === 'header-one')
10
+ return 1;
11
+ if (t === 'header-two')
12
+ return 2;
13
+ if (t === 'header-three')
14
+ return 3;
15
+ return null;
16
+ }
17
+ function blockTypeToListStyle(t) {
18
+ if (t === 'ordered-list-item')
19
+ return 'ordered';
20
+ if (t === 'unordered-list-item')
21
+ return 'unordered';
22
+ return null;
23
+ }
24
+ function rangesToInlineRuns(text, ranges) {
25
+ const n = text.length;
26
+ if (n === 0)
27
+ return [{ text: '' }];
28
+ const bold = new Array(n).fill(false);
29
+ const italic = new Array(n).fill(false);
30
+ const underline = new Array(n).fill(false);
31
+ for (const r of ranges !== null && ranges !== void 0 ? ranges : []) {
32
+ if (!r || typeof r.offset !== 'number' || typeof r.length !== 'number')
33
+ continue;
34
+ if (!isSupportedInlineStyle(r.style))
35
+ continue;
36
+ const start = Math.max(0, r.offset);
37
+ const end = Math.min(n, r.offset + r.length);
38
+ if (end <= start)
39
+ continue;
40
+ for (let i = start; i < end; i++) {
41
+ if (r.style === 'BOLD')
42
+ bold[i] = true;
43
+ else if (r.style === 'ITALIC')
44
+ italic[i] = true;
45
+ else if (r.style === 'UNDERLINE')
46
+ underline[i] = true;
47
+ }
48
+ }
49
+ const out = [];
50
+ let runStart = 0;
51
+ const sameStyle = (i, j) => bold[i] === bold[j] && italic[i] === italic[j] && underline[i] === underline[j];
52
+ for (let i = 1; i < n; i++) {
53
+ if (!sameStyle(i - 1, i)) {
54
+ const slice = text.slice(runStart, i);
55
+ if (slice.length > 0) {
56
+ const node = { text: slice };
57
+ if (bold[runStart])
58
+ node.bold = true;
59
+ if (italic[runStart])
60
+ node.italic = true;
61
+ if (underline[runStart])
62
+ node.underline = true;
63
+ out.push(node);
64
+ }
65
+ runStart = i;
66
+ }
67
+ }
68
+ // last run
69
+ const slice = text.slice(runStart);
70
+ if (slice.length > 0) {
71
+ const node = { text: slice };
72
+ if (bold[runStart])
73
+ node.bold = true;
74
+ if (italic[runStart])
75
+ node.italic = true;
76
+ if (underline[runStart])
77
+ node.underline = true;
78
+ out.push(node);
79
+ }
80
+ // If the entire text was empty (shouldn't happen here), return empty node
81
+ return out.length ? out : [{ text }];
82
+ }
83
+ function draftBlockToUniversalNonList(block) {
84
+ var _a;
85
+ const headingLevel = blockTypeToHeadingLevel(block.type);
86
+ const children = rangesToInlineRuns((_a = block.text) !== null && _a !== void 0 ? _a : '', block.inlineStyleRanges);
87
+ if (headingLevel) {
88
+ return { type: IUniversalJsonType_1.BlockType.HEADING, level: headingLevel, children };
89
+ }
90
+ return { type: IUniversalJsonType_1.BlockType.PARAGRAPH, children };
91
+ }
92
+ function convertDraftRawToUniversal(stringifiedDraftRaw) {
93
+ var _a, _b;
94
+ if (!stringifiedDraftRaw)
95
+ return [];
96
+ const raw = JSON.parse(stringifiedDraftRaw);
97
+ const blocks = (_a = raw === null || raw === void 0 ? void 0 : raw.blocks) !== null && _a !== void 0 ? _a : [];
98
+ const out = [];
99
+ let currentList = null;
100
+ const flushList = () => {
101
+ if (currentList)
102
+ out.push(currentList);
103
+ currentList = null;
104
+ };
105
+ for (const b of blocks) {
106
+ const listStyle = blockTypeToListStyle(b.type);
107
+ if (listStyle) {
108
+ const itemRuns = rangesToInlineRuns((_b = b.text) !== null && _b !== void 0 ? _b : '', b.inlineStyleRanges);
109
+ if (!currentList || currentList.style !== listStyle) {
110
+ flushList();
111
+ currentList = { type: IUniversalJsonType_1.BlockType.LIST, style: listStyle, items: [] };
112
+ }
113
+ currentList.items.push(itemRuns);
114
+ continue;
115
+ }
116
+ flushList();
117
+ out.push(draftBlockToUniversalNonList(b));
118
+ }
119
+ flushList();
120
+ return out;
121
+ }
122
+ exports.convertDraftRawToUniversal = convertDraftRawToUniversal;
123
+ function serializeUniversalBlocks(blocks) {
124
+ if (!blocks) {
125
+ return "";
126
+ }
127
+ const serializeInline = (children) => children.map((child) => child.text).join("");
128
+ return blocks
129
+ .map((block) => {
130
+ switch (block.type) {
131
+ case IUniversalJsonType_1.BlockType.HEADING:
132
+ case IUniversalJsonType_1.BlockType.PARAGRAPH:
133
+ return serializeInline(block.children);
134
+ case IUniversalJsonType_1.BlockType.LIST:
135
+ return block.items
136
+ .map((itemChildren) => serializeInline(itemChildren))
137
+ .join(" ");
138
+ default:
139
+ return "";
140
+ }
141
+ })
142
+ .join(" ");
143
+ }
144
+ exports.serializeUniversalBlocks = serializeUniversalBlocks;
@@ -1,18 +1,18 @@
1
- export declare type DraftRaw = {
2
- blocks: DraftBlock[];
3
- entityMap: Record<string, unknown>;
4
- };
5
- export declare type DraftBlock = {
6
- key: string;
7
- text: string;
8
- type: 'unstyled' | 'header-one' | 'header-two' | 'header-three' | 'unordered-list-item' | 'ordered-list-item' | string;
9
- depth: number;
10
- inlineStyleRanges: DraftInlineStyleRange[];
11
- entityRanges: any[];
12
- data: Record<string, unknown>;
13
- };
14
- export declare type DraftInlineStyleRange = {
15
- offset: number;
16
- length: number;
17
- style: 'BOLD' | 'ITALIC' | 'UNDERLINE' | string;
18
- };
1
+ export declare type DraftRaw = {
2
+ blocks: DraftBlock[];
3
+ entityMap: Record<string, unknown>;
4
+ };
5
+ export declare type DraftBlock = {
6
+ key: string;
7
+ text: string;
8
+ type: 'unstyled' | 'header-one' | 'header-two' | 'header-three' | 'unordered-list-item' | 'ordered-list-item' | string;
9
+ depth: number;
10
+ inlineStyleRanges: DraftInlineStyleRange[];
11
+ entityRanges: any[];
12
+ data: Record<string, unknown>;
13
+ };
14
+ export declare type DraftInlineStyleRange = {
15
+ offset: number;
16
+ length: number;
17
+ style: 'BOLD' | 'ITALIC' | 'UNDERLINE' | string;
18
+ };
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,24 +1,24 @@
1
- export interface InlineText {
2
- text: string;
3
- bold?: boolean;
4
- italic?: boolean;
5
- underline?: boolean;
6
- }
7
- export declare enum BlockType {
8
- HEADING = "heading",
9
- PARAGRAPH = "paragraph",
10
- LIST = "list"
11
- }
12
- export declare type UniversalBlock = {
13
- type: BlockType.HEADING;
14
- level: 1 | 2 | 3;
15
- children: InlineText[];
16
- } | {
17
- type: BlockType.PARAGRAPH;
18
- children: InlineText[];
19
- } | {
20
- type: BlockType.LIST;
21
- style: 'ordered' | 'unordered';
22
- items: InlineText[][];
23
- };
24
- export declare const SUPPORTED_INLINE: Set<"BOLD" | "ITALIC" | "UNDERLINE">;
1
+ export interface InlineText {
2
+ text: string;
3
+ bold?: boolean;
4
+ italic?: boolean;
5
+ underline?: boolean;
6
+ }
7
+ export declare enum BlockType {
8
+ HEADING = "heading",
9
+ PARAGRAPH = "paragraph",
10
+ LIST = "list"
11
+ }
12
+ export declare type UniversalBlock = {
13
+ type: BlockType.HEADING;
14
+ level: 1 | 2 | 3;
15
+ children: InlineText[];
16
+ } | {
17
+ type: BlockType.PARAGRAPH;
18
+ children: InlineText[];
19
+ } | {
20
+ type: BlockType.LIST;
21
+ style: 'ordered' | 'unordered';
22
+ items: InlineText[][];
23
+ };
24
+ export declare const SUPPORTED_INLINE: Set<"BOLD" | "ITALIC" | "UNDERLINE">;