nexus-shared 1.1.20 → 2.0.0

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 (332) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +903 -0
  3. package/dist/Client.Index.d.ts +44 -0
  4. package/dist/Client.Index.js +49 -0
  5. package/dist/Components/Documents/Button.d.ts +29 -0
  6. package/dist/Components/Documents/Button.js +11 -0
  7. package/dist/Components/Documents/Menu.d.ts +102 -0
  8. package/dist/Components/Documents/Menu.js +238 -0
  9. package/dist/Components/Documents/SplitButton.d.ts +64 -0
  10. package/dist/Components/Documents/SplitButton.js +127 -0
  11. package/dist/Components/Documents/TabButtons.d.ts +62 -0
  12. package/dist/Components/Documents/TabButtons.js +19 -0
  13. package/dist/Components/Forms/ApiForm.d.ts +21 -0
  14. package/dist/Components/Forms/ApiForm.js +99 -0
  15. package/dist/Components/Forms/Crud.d.ts +17 -0
  16. package/dist/Components/Forms/Crud.js +556 -0
  17. package/dist/Components/Forms/CrudParts.d.ts +15 -0
  18. package/dist/Components/Forms/CrudParts.js +36 -0
  19. package/dist/Components/Forms/Form.d.ts +52 -0
  20. package/dist/Components/Forms/Form.js +319 -0
  21. package/dist/Components/Forms/SubmitForm.d.ts +65 -0
  22. package/dist/Components/Forms/SubmitForm.js +198 -0
  23. package/dist/Components/Inputs/Calendar.d.ts +69 -0
  24. package/dist/Components/Inputs/Calendar.js +258 -0
  25. package/dist/Components/Inputs/CheckBox.d.ts +53 -0
  26. package/dist/Components/Inputs/CheckBox.js +87 -0
  27. package/dist/Components/Inputs/CheckBoxGroup.d.ts +20 -0
  28. package/dist/Components/Inputs/CheckBoxGroup.js +80 -0
  29. package/dist/Components/Inputs/ChoiceField.d.ts +122 -0
  30. package/dist/Components/Inputs/ChoiceField.js +169 -0
  31. package/dist/Components/Inputs/DatePicker.d.ts +54 -0
  32. package/dist/Components/Inputs/DatePicker.js +246 -0
  33. package/dist/Components/Inputs/DateRangePicker.d.ts +62 -0
  34. package/dist/Components/Inputs/DateRangePicker.js +283 -0
  35. package/dist/Components/Inputs/DateTimePicker.d.ts +75 -0
  36. package/dist/Components/Inputs/DateTimePicker.js +399 -0
  37. package/dist/Components/Inputs/Dropdown.d.ts +117 -0
  38. package/dist/Components/Inputs/Dropdown.js +839 -0
  39. package/dist/Components/Inputs/DropdownParts.d.ts +84 -0
  40. package/dist/Components/Inputs/DropdownParts.js +102 -0
  41. package/dist/Components/Inputs/EditorShell.d.ts +45 -0
  42. package/dist/Components/Inputs/EditorShell.js +214 -0
  43. package/dist/Components/Inputs/Field.d.ts +53 -0
  44. package/dist/Components/Inputs/Field.js +16 -0
  45. package/dist/Components/Inputs/GroupForm.d.ts +20 -0
  46. package/dist/Components/Inputs/GroupForm.js +170 -0
  47. package/dist/Components/Inputs/InputField.d.ts +59 -0
  48. package/dist/Components/Inputs/InputField.js +169 -0
  49. package/dist/Components/Inputs/InputRenderer.d.ts +35 -0
  50. package/dist/Components/Inputs/InputRenderer.js +99 -0
  51. package/dist/Components/Inputs/MarkdownEditor.d.ts +67 -0
  52. package/dist/Components/Inputs/MarkdownEditor.js +289 -0
  53. package/dist/Components/Inputs/NumberBox.d.ts +53 -0
  54. package/dist/Components/Inputs/NumberBox.js +228 -0
  55. package/dist/Components/Inputs/RadioGroup.d.ts +20 -0
  56. package/dist/Components/Inputs/RadioGroup.js +43 -0
  57. package/dist/Components/Inputs/ReadOnlyNotice.d.ts +36 -0
  58. package/dist/Components/Inputs/ReadOnlyNotice.js +116 -0
  59. package/dist/Components/Inputs/RichTextEditor.d.ts +103 -0
  60. package/dist/Components/Inputs/RichTextEditor.js +1170 -0
  61. package/dist/Components/Inputs/RichTextParts.d.ts +63 -0
  62. package/dist/Components/Inputs/RichTextParts.js +157 -0
  63. package/dist/Components/Inputs/RowsInput.d.ts +104 -0
  64. package/dist/Components/Inputs/RowsInput.js +259 -0
  65. package/dist/Components/Inputs/Slider.d.ts +87 -0
  66. package/dist/Components/Inputs/Slider.js +216 -0
  67. package/dist/Components/Inputs/TabularForm.d.ts +23 -0
  68. package/dist/Components/Inputs/TabularForm.js +283 -0
  69. package/dist/Components/Inputs/TextArea.d.ts +43 -0
  70. package/dist/Components/Inputs/TextArea.js +31 -0
  71. package/dist/Components/Inputs/TextBox.d.ts +52 -0
  72. package/dist/Components/Inputs/TextBox.js +58 -0
  73. package/dist/Components/Inputs/TextField.d.ts +31 -0
  74. package/dist/Components/Inputs/TextField.js +35 -0
  75. package/dist/Components/Inputs/TimePanel.d.ts +34 -0
  76. package/dist/Components/Inputs/TimePanel.js +288 -0
  77. package/dist/Components/Inputs/TimePicker.d.ts +54 -0
  78. package/dist/Components/Inputs/TimePicker.js +239 -0
  79. package/dist/Components/Inputs/TreeView.d.ts +160 -0
  80. package/dist/Components/Inputs/TreeView.js +947 -0
  81. package/dist/Components/Layouts/MessageBox.d.ts +71 -0
  82. package/dist/Components/Layouts/MessageBox.js +104 -0
  83. package/dist/Components/Layouts/Popup.d.ts +92 -0
  84. package/dist/Components/Layouts/Popup.js +376 -0
  85. package/dist/Components/Layouts/PopupContext.d.ts +2 -0
  86. package/dist/Components/Layouts/PopupContext.js +4 -0
  87. package/dist/Components/Layouts/PopupDock.d.ts +22 -0
  88. package/dist/Components/Layouts/PopupDock.js +121 -0
  89. package/dist/Components/Layouts/PopupHost.d.ts +56 -0
  90. package/dist/Components/Layouts/PopupHost.js +163 -0
  91. package/dist/Components/Layouts/PopupRules.d.ts +30 -0
  92. package/dist/Components/Layouts/PopupRules.js +63 -0
  93. package/dist/Components/Layouts/ThemePicker.d.ts +13 -0
  94. package/dist/Components/Layouts/ThemePicker.js +22 -0
  95. package/dist/Components/Layouts/ThemeScript.d.ts +14 -0
  96. package/dist/Components/Layouts/ThemeScript.js +13 -0
  97. package/dist/Components/Layouts/ThemeSwitcher.d.ts +13 -0
  98. package/dist/Components/Layouts/ThemeSwitcher.js +29 -0
  99. package/dist/Components/Layouts/Toaster.d.ts +76 -0
  100. package/dist/Components/Layouts/Toaster.js +172 -0
  101. package/dist/Components/Viewers/DataTable.d.ts +25 -0
  102. package/dist/Components/Viewers/DataTable.js +542 -0
  103. package/dist/Components/Viewers/DataTableParts.d.ts +134 -0
  104. package/dist/Components/Viewers/DataTableParts.js +145 -0
  105. package/dist/Components/Viewers/MarkdownView.d.ts +26 -0
  106. package/dist/Components/Viewers/MarkdownView.js +79 -0
  107. package/dist/Components/Viewers/RichTextView.d.ts +18 -0
  108. package/dist/Components/Viewers/RichTextView.js +17 -0
  109. package/dist/Helpers/AnimationHelpers.d.ts +6 -0
  110. package/dist/Helpers/AnimationHelpers.js +35 -0
  111. package/dist/Helpers/ApiClient.d.ts +74 -0
  112. package/dist/Helpers/ApiClient.js +197 -0
  113. package/dist/Helpers/ApiFormHelpers.d.ts +26 -0
  114. package/dist/Helpers/ApiFormHelpers.js +56 -0
  115. package/dist/Helpers/ApiModules.d.ts +135 -0
  116. package/dist/Helpers/ApiModules.js +194 -0
  117. package/dist/Helpers/ApiResponses.d.ts +41 -0
  118. package/dist/Helpers/ApiResponses.js +159 -0
  119. package/dist/Helpers/ApiRoutes.d.ts +150 -0
  120. package/dist/Helpers/ApiRoutes.js +191 -0
  121. package/dist/Helpers/ApiToasts.d.ts +21 -0
  122. package/dist/Helpers/ApiToasts.js +22 -0
  123. package/dist/Helpers/ClassHelpers.d.ts +3 -0
  124. package/dist/Helpers/ClassHelpers.js +4 -0
  125. package/dist/Helpers/CrudBackend.d.ts +56 -0
  126. package/dist/Helpers/CrudBackend.js +119 -0
  127. package/dist/Helpers/CrudHelpers.d.ts +76 -0
  128. package/dist/Helpers/CrudHelpers.js +202 -0
  129. package/dist/Helpers/DateHelpers.d.ts +88 -0
  130. package/dist/Helpers/DateHelpers.js +363 -0
  131. package/dist/Helpers/DatePreferences.d.ts +14 -0
  132. package/dist/Helpers/DatePreferences.js +94 -0
  133. package/dist/Helpers/DateTimeHelpers.d.ts +87 -0
  134. package/dist/Helpers/DateTimeHelpers.js +286 -0
  135. package/dist/Helpers/DragHelpers.d.ts +129 -0
  136. package/dist/Helpers/DragHelpers.js +281 -0
  137. package/dist/Helpers/DropdownHelpers.d.ts +56 -0
  138. package/dist/Helpers/DropdownHelpers.js +180 -0
  139. package/dist/Helpers/FormDrafts.d.ts +18 -0
  140. package/dist/Helpers/FormDrafts.js +76 -0
  141. package/dist/Helpers/FormStore.d.ts +231 -0
  142. package/dist/Helpers/FormStore.js +734 -0
  143. package/dist/Helpers/InputParamsHelpers.d.ts +79 -0
  144. package/dist/Helpers/InputParamsHelpers.js +388 -0
  145. package/dist/Helpers/MarkdownEditing.d.ts +27 -0
  146. package/dist/Helpers/MarkdownEditing.js +250 -0
  147. package/dist/Helpers/MarkdownHelpers.d.ts +82 -0
  148. package/dist/Helpers/MarkdownHelpers.js +775 -0
  149. package/dist/Helpers/MessageBuilder.d.ts +74 -0
  150. package/dist/Helpers/MessageBuilder.js +254 -0
  151. package/dist/Helpers/NepaliCalendar.d.ts +25 -0
  152. package/dist/Helpers/NepaliCalendar.js +107 -0
  153. package/dist/Helpers/NumberHelpers.d.ts +71 -0
  154. package/dist/Helpers/NumberHelpers.js +202 -0
  155. package/dist/Helpers/Permissions.d.ts +62 -0
  156. package/dist/Helpers/Permissions.js +133 -0
  157. package/dist/Helpers/PopoverHelpers.d.ts +43 -0
  158. package/dist/Helpers/PopoverHelpers.js +91 -0
  159. package/dist/Helpers/RichTextHelpers.d.ts +77 -0
  160. package/dist/Helpers/RichTextHelpers.js +1072 -0
  161. package/dist/Helpers/RowsStore.d.ts +160 -0
  162. package/dist/Helpers/RowsStore.js +584 -0
  163. package/dist/Helpers/TableColumns.d.ts +40 -0
  164. package/dist/Helpers/TableColumns.js +254 -0
  165. package/dist/Helpers/TableExport.d.ts +30 -0
  166. package/dist/Helpers/TableExport.js +97 -0
  167. package/dist/Helpers/TableHelpers.d.ts +102 -0
  168. package/dist/Helpers/TableHelpers.js +281 -0
  169. package/dist/Helpers/TableStore.d.ts +142 -0
  170. package/dist/Helpers/TableStore.js +530 -0
  171. package/dist/Helpers/ThemeHelpers.d.ts +15 -0
  172. package/dist/Helpers/ThemeHelpers.js +16 -0
  173. package/dist/Helpers/TimeHelpers.d.ts +73 -0
  174. package/dist/Helpers/TimeHelpers.js +253 -0
  175. package/dist/Helpers/TreeStore.d.ts +188 -0
  176. package/dist/Helpers/TreeStore.js +577 -0
  177. package/dist/Helpers/ValidationHelpers.d.ts +124 -0
  178. package/dist/Helpers/ValidationHelpers.js +301 -0
  179. package/dist/Interfaces/ApiInterfaces.d.ts +149 -0
  180. package/dist/Interfaces/ApiInterfaces.js +24 -0
  181. package/dist/Interfaces/CrudInterfaces.d.ts +171 -0
  182. package/{src/sso-client.tsx → dist/Interfaces/CrudInterfaces.js} +1 -1
  183. package/dist/Interfaces/DateInterfaces.d.ts +154 -0
  184. package/dist/Interfaces/DateInterfaces.js +29 -0
  185. package/dist/Interfaces/FormInterfaces.d.ts +352 -0
  186. package/dist/Interfaces/FormInterfaces.js +1 -0
  187. package/dist/Interfaces/InputInterfaces.d.ts +141 -0
  188. package/dist/Interfaces/InputInterfaces.js +1 -0
  189. package/dist/Interfaces/MessageInterfaces.d.ts +111 -0
  190. package/dist/Interfaces/MessageInterfaces.js +5 -0
  191. package/dist/Interfaces/TableInterfaces.d.ts +291 -0
  192. package/dist/Interfaces/TableInterfaces.js +1 -0
  193. package/dist/Interfaces/ThemeInterfaces.d.ts +17 -0
  194. package/dist/Interfaces/ThemeInterfaces.js +17 -0
  195. package/dist/Interfaces/TypeInterfaces.d.ts +4 -0
  196. package/dist/Interfaces/TypeInterfaces.js +1 -0
  197. package/dist/Server.Index.d.ts +2 -0
  198. package/dist/Server.Index.js +5 -0
  199. package/dist/Services/ApiProxy.d.ts +32 -0
  200. package/dist/Services/ApiProxy.js +111 -0
  201. package/dist/Services/BrowserApi.d.ts +78 -0
  202. package/dist/Services/BrowserApi.js +111 -0
  203. package/dist/Services/ServerApi.d.ts +49 -0
  204. package/dist/Services/ServerApi.js +75 -0
  205. package/dist/Services/ThemeService.d.ts +17 -0
  206. package/dist/Services/ThemeService.js +83 -0
  207. package/dist/Shared.Index.d.ts +43 -0
  208. package/dist/Shared.Index.js +47 -0
  209. package/package.json +82 -33
  210. package/src/Styles/Nexus.Base.css +70 -0
  211. package/src/Styles/Nexus.Button.css +151 -0
  212. package/src/Styles/Nexus.Calendar.css +275 -0
  213. package/src/Styles/Nexus.Choice.css +345 -0
  214. package/src/Styles/Nexus.Crud.css +84 -0
  215. package/src/Styles/Nexus.DateTime.css +81 -0
  216. package/src/Styles/Nexus.Dropdown.css +774 -0
  217. package/src/Styles/Nexus.Editor.css +297 -0
  218. package/src/Styles/Nexus.Form.css +298 -0
  219. package/src/Styles/Nexus.Index.css +34 -0
  220. package/src/Styles/Nexus.Input.css +637 -0
  221. package/src/Styles/Nexus.Markdown.css +265 -0
  222. package/src/Styles/Nexus.Menu.css +249 -0
  223. package/src/Styles/Nexus.Popup.css +731 -0
  224. package/src/Styles/Nexus.RichText.css +463 -0
  225. package/src/Styles/Nexus.Rows.css +566 -0
  226. package/src/Styles/Nexus.Slider.css +278 -0
  227. package/src/Styles/Nexus.Tab.Buttons.css +364 -0
  228. package/src/Styles/Nexus.Table.css +1014 -0
  229. package/src/Styles/Nexus.Theme.Picker.css +159 -0
  230. package/src/Styles/Nexus.Themes.css +194 -0
  231. package/src/Styles/Nexus.Time.css +147 -0
  232. package/src/Styles/Nexus.Toast.css +265 -0
  233. package/src/Styles/Nexus.Tokens.css +72 -0
  234. package/src/Styles/Nexus.Tree.css +435 -0
  235. package/src/api-services/authentication-service.tsx +0 -23
  236. package/src/api-services/preference-service.tsx +0 -5
  237. package/src/api-services/system-service.tsx +0 -34
  238. package/src/client.ts +0 -31
  239. package/src/components/documents/button.tsx +0 -142
  240. package/src/components/documents/icon-box.tsx +0 -93
  241. package/src/components/documents/page-title.tsx +0 -7
  242. package/src/components/documents/tab-button.tsx +0 -172
  243. package/src/components/documents/tag.tsx +0 -30
  244. package/src/components/index.js +0 -0
  245. package/src/components/inputs/checkbox-input.tsx +0 -66
  246. package/src/components/inputs/input-box.tsx +0 -48
  247. package/src/components/inputs/input-element.tsx +0 -65
  248. package/src/components/inputs/input-form.tsx +0 -164
  249. package/src/components/inputs/input.tsx +0 -181
  250. package/src/components/inputs/number-input.tsx +0 -108
  251. package/src/components/inputs/radiobox-input.tsx +0 -53
  252. package/src/components/inputs/textarea-input.tsx +0 -47
  253. package/src/components/inputs/textbox-input.tsx +0 -45
  254. package/src/components/layouts/global-dialogbox.tsx +0 -431
  255. package/src/components/layouts/global-layout.tsx +0 -59
  256. package/src/components/layouts/layout-helpers.tsx +0 -20
  257. package/src/components/layouts/panels/user-panel.tsx +0 -112
  258. package/src/components/layouts/utility-menu.tsx +0 -49
  259. package/src/components/panels/theme-panel.tsx +0 -46
  260. package/src/helpers/bitwise-helpers.tsx +0 -11
  261. package/src/helpers/browser-helpers.tsx +0 -156
  262. package/src/helpers/datasource-helpers.tsx +0 -99
  263. package/src/helpers/element-helpers.tsx +0 -57
  264. package/src/helpers/input-helpers.tsx +0 -74
  265. package/src/helpers/string-helpers.tsx +0 -28
  266. package/src/helpers/utility-helpers.tsx +0 -45
  267. package/src/helpers/validation-helpers.tsx +0 -302
  268. package/src/index.ts +0 -26
  269. package/src/interface.ts +0 -19
  270. package/src/interfaces/auth-token-interfaces.tsx +0 -6
  271. package/src/interfaces/browser-interfaces.tsx +0 -36
  272. package/src/interfaces/button-interfaces.tsx +0 -63
  273. package/src/interfaces/datasource-interfaces.tsx +0 -22
  274. package/src/interfaces/datatable-interfaces.tsx +0 -25
  275. package/src/interfaces/dialogbox-interfaces.tsx +0 -5
  276. package/src/interfaces/exception-interfaces.tsx +0 -99
  277. package/src/interfaces/http-interfaces.tsx +0 -129
  278. package/src/interfaces/icon-interfaces.tsx +0 -129
  279. package/src/interfaces/input-interfaces.tsx +0 -410
  280. package/src/interfaces/layout-interfaces.tsx +0 -191
  281. package/src/interfaces/menu-interfaces.tsx +0 -49
  282. package/src/interfaces/message-interfaces.tsx +0 -32
  283. package/src/interfaces/permission-interfaces.tsx +0 -9
  284. package/src/interfaces/storage-interfaces.tsx +0 -5
  285. package/src/interfaces/system-interfaces.tsx +0 -22
  286. package/src/interfaces/theme-interfaces.tsx +0 -123
  287. package/src/interfaces/type-interfaces.tsx +0 -28
  288. package/src/interfaces/user-interfaces.tsx +0 -47
  289. package/src/nexus-client.tsx +0 -21
  290. package/src/nexus.environments.tsx +0 -66
  291. package/src/proxy-api/proxy-backend.tsx +0 -60
  292. package/src/proxy-api/proxy-constants.tsx +0 -28
  293. package/src/proxy-api/proxy-helpers.tsx +0 -91
  294. package/src/proxy-api-client.tsx +0 -1
  295. package/src/proxy-api-server.tsx +0 -2
  296. package/src/services/http-client-services.tsx +0 -75
  297. package/src/services/http-services.tsx +0 -158
  298. package/src/services/loader-service.tsx +0 -185
  299. package/src/services/localstorage-service.tsx +0 -119
  300. package/src/services/message-services.tsx +0 -383
  301. package/src/services/theme-service.tsx +0 -161
  302. package/src/services/user-services.tsx +0 -10
  303. package/src/sso-config/auth-token-validation.ts +0 -16
  304. package/src/sso-config/callback-route.tsx +0 -35
  305. package/src/sso-config/cookie-encryption.ts +0 -51
  306. package/src/sso-config/cookie-helpers.tsx +0 -102
  307. package/src/sso-config/forgot-password-route.tsx +0 -36
  308. package/src/sso-config/oauth-callback-state.ts +0 -61
  309. package/src/sso-config/pkce-helpers.ts +0 -9
  310. package/src/sso-config/provider-complete-route.tsx +0 -18
  311. package/src/sso-config/redirect-context-actions.tsx +0 -45
  312. package/src/sso-config/redirect-context-helpers.tsx +0 -159
  313. package/src/sso-config/redirect-context-persist.tsx +0 -18
  314. package/src/sso-config/redirect-context-route.tsx +0 -45
  315. package/src/sso-config/refresh-route.tsx +0 -23
  316. package/src/sso-config/sign-in-route.tsx +0 -74
  317. package/src/sso-config/sign-out-route.tsx +0 -57
  318. package/src/sso-config/sign-up-route.tsx +0 -57
  319. package/src/sso-config/sso-backend-flow.ts +0 -38
  320. package/src/sso-config/sso-complete-route.tsx +0 -50
  321. package/src/sso-config/sso-config.ts +0 -59
  322. package/src/sso-config/sso-interfaces.tsx +0 -99
  323. package/src/sso-config/sso-response-helpers.tsx +0 -20
  324. package/src/sso-server.tsx +0 -21
  325. package/src/styles/nexus.animation.css +0 -269
  326. package/src/styles/nexus.core.css +0 -119
  327. package/src/styles/nexus.dialog.css +0 -144
  328. package/src/styles/nexus.icon.css +0 -51
  329. package/src/styles/nexus.input.css +0 -207
  330. package/src/styles/nexus.loader.css +0 -11
  331. package/src/styles/nexus.logic.css +0 -47
  332. package/src/styles/nexus.utility.css +0 -347
@@ -1,191 +0,0 @@
1
- import { IAccessAction } from "./permission-interfaces";
2
-
3
- import { IThemeInformation } from "./theme-interfaces";
4
-
5
- export const ROOT_LOADER_IDENTITY = "root-loader";
6
- export const DEFAULT_FONT_WEIGHTS = ["300", "400", "500", "600", "700", "800"];
7
- export const DEFAULT_ANIMATION_DURATION = 300;
8
- export const COLUMN_SIZE_ATTRIBUTE_KEY = "data-column-size";
9
-
10
- export enum EFontWeights {
11
- /** Light:300 */
12
-
13
- LIGHT = "300",
14
-
15
- /** Regular:400 */
16
-
17
- REGULAR = "400",
18
-
19
- /** Medium:500 */
20
-
21
- MEDIUM = "500",
22
-
23
- /** Semi Bold:600 */
24
-
25
- SEMI_BOLD = "600",
26
-
27
- /** Bold:700 */
28
-
29
- BOLD = "700",
30
-
31
- /** Extra Bold:800 */
32
-
33
- EXTRA_BOLD = "800",
34
- }
35
-
36
- export interface IGlobalLayout {
37
- /** Document Title */
38
-
39
- defaultDocumentTitle: string;
40
-
41
- /** Document Description */
42
-
43
- defaultDocumentDescription: string;
44
-
45
- /** Document Keywords LIKE: "nexus, solutions, software, development" */
46
-
47
- defaultDocumentKeywords: string[];
48
-
49
- /** Is admin or client layout? */
50
-
51
- isAdminLayout: boolean;
52
-
53
- /** Access actions */
54
-
55
- accessActions?: IAccessAction[];
56
-
57
- /** System themes */
58
-
59
- systemThemes: IThemeInformation[];
60
-
61
- /** Should menu be dark? */
62
-
63
- shouldMenuDark: boolean;
64
- }
65
-
66
- export const GetGlobalLayout = (
67
- defaultDocumentTitle: string,
68
-
69
- defaultDocumentDescription: string,
70
-
71
- defaultDocumentKeywords: string[],
72
- ): IGlobalLayout => {
73
- return {
74
- defaultDocumentTitle: defaultDocumentTitle,
75
-
76
- defaultDocumentDescription: defaultDocumentDescription,
77
-
78
- defaultDocumentKeywords: defaultDocumentKeywords,
79
- } as IGlobalLayout;
80
- };
81
-
82
- /** Keyframe / class string names for CSS `animation-name` or matching utility classes. */
83
-
84
- export enum EAnimations {
85
- FADE_IN = "fadeIn",
86
- FADE_OUT = "fadeOut",
87
- FADE_IN_OUT = "fadeInOut",
88
-
89
- /** Vertical motion loop only (no enter/exit variant). */
90
- BOUNCE = "bounce",
91
-
92
- PULSE_IN = "pulseIn",
93
-
94
- PULSE_OUT = "pulseOut",
95
-
96
- PULSE_IN_OUT = "pulseInOut",
97
-
98
- /** Circular border loop; theme border-top tint cycles like a loader. */
99
- SPIN = "spin",
100
-
101
- /** Indeterminate track: segment sweeps left → right (e.g. form submitting). */
102
- SLIDE_BAR = "slideBar",
103
-
104
- /** Segment starts at 0, travels to the far wall, reverses back (two-wall bounce). */
105
- BOUNCE_BAR = "bounceBar",
106
- }
107
-
108
- /** Short utility classes applied with `className`. */
109
-
110
- export enum EAnimationClasses {
111
- FADE_IN = "an-fa",
112
-
113
- FADE_OUT = "an-fo",
114
-
115
- FADE_IN_OUT = "an-fio",
116
-
117
- BOUNCE = "an-bounce",
118
-
119
- PULSE_IN = "an-pi",
120
-
121
- PULSE_OUT = "an-po",
122
-
123
- PULSE_IN_OUT = "an-pio",
124
-
125
- SPIN = "an-spin",
126
-
127
- SLIDE_BAR = "an-sbar",
128
-
129
- BOUNCE_BAR = "an-bbar",
130
- }
131
-
132
- export enum ESizes {
133
- VeryTiny = "xxs",
134
-
135
- Tiny = "xs",
136
-
137
- VerySmall = "ssm",
138
-
139
- Small = "sm",
140
-
141
- Normal = "nr",
142
-
143
- Medium = "med",
144
-
145
- Large = "lg",
146
-
147
- ExtraLarge = "xl",
148
-
149
- VeryExtraLarge = "xxl",
150
-
151
- FullSize = "fs",
152
- }
153
-
154
- export enum EBadgeTypes {
155
- Dot = "dot",
156
-
157
- Count = "count",
158
- }
159
-
160
- export enum EOpacity {
161
- O05 = "o05",
162
-
163
- O06 = "o06",
164
-
165
- O07 = "o07",
166
-
167
- O08 = "o08",
168
-
169
- O09 = "o09",
170
-
171
- FULL = "o1",
172
-
173
- NONE = "o0",
174
- }
175
- export enum EPositions {
176
- Left = "left",
177
- Right = "right",
178
- Top = "top",
179
- Bottom = "bottom",
180
- Center = "center",
181
- }
182
- export enum ETextPositions {
183
- Left = "tl",
184
- Right = "tr",
185
- Center = "tc",
186
- }
187
- export enum EFlexPositions {
188
- Left = "jl",
189
- Right = "jr",
190
- Center = "jc",
191
- }
@@ -1,49 +0,0 @@
1
- import { EIcons } from "./icon-interfaces";
2
-
3
- export const UTILITIES_BUTTON_PREFIX = "btn-utility-";
4
- export const GetUtilityMenuCode = (utilityCode: string) => `${UTILITIES_BUTTON_PREFIX}${utilityCode}`;
5
-
6
- export enum EMenuTargets {
7
- ClientModule = 1 << 0, // 1
8
- PublicAdminModule = 1 << 1, // 2
9
- AdminModule = 1 << 2, // 4
10
- }
11
- export enum EMenuVisibility {
12
- GuestOnly = 1 << 0, // 1
13
- AuthenticatedOnly = 1 << 1, // 2
14
- }
15
- export interface IMenuBase {
16
- id?: string | number;
17
- menuVisibilities: EMenuVisibility;
18
- menuName: string;
19
- menuCode: string;
20
- menuIcon: EIcons;
21
- menuTooltip?: string;
22
- displayOrder: number;
23
- }
24
-
25
- export type IUtilityMenu = IMenuBase;
26
- export interface IPanelMenu extends IMenuBase {
27
- groupOrder: number;
28
- menuUrl?: string;
29
- defaultValue?: string;
30
- }
31
- export interface IClientMenu extends IMenuBase {
32
- menuUrl: string;
33
- documentTitle: string;
34
- pageTitle: string;
35
- breadcrumbTitle?: string;
36
- }
37
- export const BUTTON_IDENTITY = (isneedPrefix: boolean) => {
38
- const _ = isneedPrefix ? UTILITIES_BUTTON_PREFIX : "";
39
- return {
40
- PROFILE_BOX: `${_}profile`,
41
- SEARCH_BOX: `${_}root-search`,
42
- FAVORITE_BOX: `${_}favorite-menu`,
43
- CARD_BOX: `${_}cart-menu`,
44
- THEME_BOX: `${_}switch-theme`,
45
- MEGA_BOX: `${_}mega-menu`,
46
- SIGN_IN_BUTTON: `${_}sign-in`,
47
- SIGN_OUT_BUTTON: `${_}sign-out`,
48
- };
49
- };
@@ -1,32 +0,0 @@
1
- import { EIcons } from "./icon-interfaces";
2
- import { EBackgrounds } from "./theme-interfaces";
3
-
4
- export enum EMessageTypes {
5
- Information = EBackgrounds.InfoColor,
6
- Success = EBackgrounds.SuccessColor,
7
- Warning = EBackgrounds.WarningColor,
8
- Error = EBackgrounds.ErrorColor,
9
- }
10
- export enum EMessageIcons {
11
- Information = EIcons.INFORMATION,
12
- Success = EIcons.CHECKMARK_DOUBLE,
13
- Warning = EIcons.WARNING,
14
- Error = EIcons.CLOSE,
15
- Question = EIcons.HELP,
16
- Delete = EIcons.TRASH,
17
- Bin = EIcons.TRASH_BIN,
18
- }
19
- export enum EMessageResult {
20
- OK = "OK",
21
- Yes = "Yes",
22
- No = "No",
23
- Cancel = "Cancel",
24
- Undefined = "Undefined",
25
- }
26
-
27
- export enum EMessageBoxButtons {
28
- OK = "OK",
29
- YES_NO = "Yes_No",
30
- YES_CANCEL = "Yes_Cancel",
31
- YES_NO_CANCEL = "Yes_No_Cancel",
32
- }
@@ -1,9 +0,0 @@
1
- import { EActions } from "./http-interfaces";
2
- import { EModules } from "./system-interfaces";
3
-
4
- export interface IAccessAction {
5
- controllerName: string;
6
- actionName: string;
7
- actionMethod: EActions;
8
- nexusModule: EModules;
9
- }
@@ -1,5 +0,0 @@
1
- export const LOCAL_STORAGE_KEYS = {
2
- ACTIVE_THEME: "nexus-themes",
3
- CURRENT_USER: "nexus-current-user",
4
- FORM_BUTTON_POSITION: "nexus-form-button-position",
5
- };
@@ -1,22 +0,0 @@
1
- export enum EModules {
2
- None = 0,
3
-
4
- Migrations = 1 << 0, // 1 | 1
5
- Configuration = 1 << 1, // 2 | 2
6
- Authentication = 1 << 2, // 3 | 4
7
- Enterprise = 1 << 3, // 4 | 8
8
- Drive = 1 << 4, // 5 | 16
9
- Message = 1 << 5, // 6 | 32
10
- Accounting = 1 << 6, // 7 | 64
11
- Report = 1 << 7, // 8 | 128
12
- Portfolio = 1 << 8, // 9 | 256
13
- Subscription = 1 << 9, // 10 | 512
14
- Reservation = 1 << 10, // 11 | 1024
15
- }
16
- export enum EPreferenceTargets {
17
- Company = 1 << 0, // 1
18
- Branch = 1 << 1, // 2
19
- User = 1 << 2, // 4
20
- Application = 1 << 3, // 8
21
- Compiler = 1 << 4, // 16
22
- }
@@ -1,123 +0,0 @@
1
- import { EIcons } from "./icon-interfaces";
2
- import { UN } from "./type-interfaces";
3
-
4
- export const DEFAULT_THEME_NAME = "light";
5
-
6
- export enum EBackgroundColors {
7
- Background1 = "var(--B1)",
8
- Background2 = "var(--B2)",
9
- Background3 = "var(--B3)",
10
- SuccessColor = "var(--B10)",
11
- WarningColor = "var(--B11)",
12
- InfoColor = "var(--B12)",
13
- ErrorColor = "var(--B13)",
14
- PrimaryColor = "var(--B20)",
15
- BorderColor = "var(--B30)",
16
- BoxShadowColor = "var(--B41)",
17
- PopupBackgroundColor = "var(--B51)",
18
- AlwaysDarkBackgroundColor = "var(--B52)",
19
- ThemeColor100 = "var(--B100)",
20
- ThemeColor200 = "var(--B200)",
21
- ThemeColor400 = "var(--B400)",
22
- ThemeColor600 = "var(--B600)",
23
- ThemeColor800 = "var(--B800)",
24
- ThemeColor950 = "var(--B950)",
25
- }
26
- export enum EBackgrounds {
27
- None = "no-background",
28
- Background1 = "bg1",
29
- Background2 = "bg2",
30
- Background3 = "bg3",
31
- SuccessColor = "bg10",
32
- WarningColor = "bg11",
33
- InfoColor = "bg12",
34
- ErrorColor = "bg13",
35
- PrimaryColor = "bg20",
36
- BorderColor = "bg30",
37
- BoxShadowColor = "bg41",
38
- PopupBackgroundColor = "bg51",
39
- AlwaysDarkBackgroundColor = "bg52",
40
- ThemeColor100 = "bg100",
41
- ThemeColor200 = "bg200",
42
- ThemeColor400 = "bg400",
43
- ThemeColor600 = "bg600",
44
- ThemeColor800 = "bg800",
45
- ThemeColor950 = "bg950",
46
- }
47
- export enum ETextColors {
48
- TextColor1 = "var(--T1)",
49
- TextColor2 = "var(--T2)",
50
- TextColor3 = "var(--T3)",
51
- TextColor10 = "var(--T10)",
52
- TextColor11 = "var(--T11)",
53
- TextColor12 = "var(--T12)",
54
- TextColor13 = "var(--T13)",
55
- TextColor20 = "var(--T20)",
56
- TextColor30 = "var(--T30)",
57
- TextColor41 = "var(--T41)",
58
- TextColor51 = "var(--T51)",
59
- TextColor52 = "var(--T52)",
60
- TextColor100 = "var(--T100)",
61
- TextColor200 = "var(--T200)",
62
- TextColor400 = "var(--T400)",
63
- TextColor600 = "var(--T600)",
64
- TextColor800 = "var(--T800)",
65
- TextColor950 = "var(--T950)",
66
- }
67
- export enum EColorTypes {
68
- Background = "--B",
69
- Hover = "--H",
70
- Focus = "--F",
71
- Text = "--T",
72
- }
73
-
74
- export interface IThemeInformation {
75
- displayName: string;
76
- systemName: string;
77
- displayOrder: number;
78
- iconName: EIcons;
79
- id?: string | UN;
80
-
81
- /** Background Color 1 */
82
- C1: string;
83
- /** Background Color 2 */
84
- C2: string;
85
- /** Background Color 3 */
86
- C3: string;
87
-
88
- /** Success Color */
89
- C10: string;
90
- /** Warning/Reset/Clear Color */
91
- C11: string;
92
- /** Info Color */
93
- C12: string;
94
- /** Error/Delete/Remove Color */
95
- C13: string;
96
-
97
- /** Primary/Submit/Link Button Color */
98
- C20: string;
99
-
100
- /** Border Color 1 */
101
- C30: string;
102
-
103
- /** Box Shadow Color 1 */
104
- C41: string;
105
-
106
- /** Popup/Model Background Color 1 */
107
- C51: string;
108
- /** Always Dark Background Color 1 */
109
- C52: string;
110
-
111
- /** Theme Color 100 */
112
- C100: string;
113
- /** Theme Color 200 */
114
- C200: string;
115
- /** Theme Color 400 */
116
- C400: string;
117
- /** Theme Color 600 */
118
- C600: string;
119
- /** Theme Color 800 */
120
- C800: string;
121
- /** Theme Color 950 */
122
- C950: string;
123
- }
@@ -1,28 +0,0 @@
1
- export type UN = undefined | null;
2
- export type U = undefined;
3
- export type N = null;
4
- export type SUN = undefined | null | string;
5
- export type CallbackHandler<PARAM, RETURN> = (param?: PARAM) => RETURN;
6
- export type ClickHandler = (event: React.MouseEvent<HTMLElement> | Event | UN, element?: HTMLElement | UN, data?: any | UN, index?: number | UN) => void;
7
- export type EmptyClickHandler = () => void;
8
- export type StringCallbackHandler = CallbackHandler<string, string>;
9
- export type StringNullCallbackHandler = CallbackHandler<string | UN, string | UN>;
10
- export type NumberCallbackHandler = CallbackHandler<number, number>;
11
- export type NumberNullCallbackHandler = CallbackHandler<number | UN, number | UN>;
12
- export type BooleanCallbackHandler = CallbackHandler<boolean, boolean>;
13
- export type BooleanNullCallbackHandler = CallbackHandler<boolean | UN, boolean | UN>;
14
- export type ObjectCallbackHandler<T> = CallbackHandler<T, T>;
15
- export type ObjectNullCallbackHandler<T> = CallbackHandler<T | UN, T | UN>;
16
- export type ArrayCallbackHandler<T> = CallbackHandler<T[], T[]>;
17
- export type ArrayNullCallbackHandler<T> = CallbackHandler<T[] | UN, T[] | UN>;
18
- export type VoidCallbackHandler = CallbackHandler<void | any | any[] | UN, void>;
19
- export type PopupMessageCallback = (type: ECallbackTypes) => void;
20
- export interface IInterface {
21
- // Blank Interface
22
- }
23
-
24
- export enum ECallbackTypes {
25
- Initialize = 0,
26
- Destroy = 1,
27
- ForceChangeValue = 2,
28
- }
@@ -1,47 +0,0 @@
1
- import { EModules } from "./system-interfaces";
2
- import { UN } from "./type-interfaces";
3
-
4
- export enum EUserRoles {
5
- Guest = 0,
6
- User = 1,
7
- Admin = 2,
8
- SuperAdmin = 3,
9
- }
10
- export const IsAdmin = (userRole: EUserRoles | string | UN) => userRole === EUserRoles.Admin || EUserRoles[EUserRoles.Admin] === userRole;
11
- export const IsSuperAdmin = (userRole: EUserRoles | string | UN) => userRole === EUserRoles.SuperAdmin || EUserRoles[EUserRoles.SuperAdmin] === userRole;
12
- export const IsAdmin_SuperAdmin = (userRole: EUserRoles | string | UN) => IsAdmin(userRole) || IsSuperAdmin(userRole);
13
- export const IsUser = (userRole: EUserRoles | string | UN) => userRole === EUserRoles.User || EUserRoles[EUserRoles.User] === userRole;
14
- export const IsGuest = (userRole: EUserRoles | string | UN) => userRole === EUserRoles.Guest || EUserRoles[EUserRoles.Guest] === userRole;
15
- export const IsUser_Guest = (userRole: EUserRoles | string | UN) => IsUser(userRole) || IsGuest(userRole);
16
-
17
- export interface IUserValidationResponse {
18
- isValidUser: boolean;
19
- isValidCompany: boolean;
20
- isValidBranch: boolean;
21
- isValidFiscalYear: boolean;
22
- userRole: EUserRoles;
23
- assignedModules: EModules;
24
- }
25
- export interface ICurrentUser {
26
- id: string;
27
- fullname: string;
28
- username: string;
29
- roleName: string;
30
- profilePicture: string | UN;
31
- emailAddress: string | UN;
32
- contactNumber: string | UN;
33
- isImpersonating: boolean | UN;
34
- isMultiTenant: boolean | UN;
35
- enableAuditHistory: boolean | UN;
36
- rootAccess: boolean | UN;
37
- branchId: string | UN;
38
- companyId: string | UN;
39
- fiscalYearId: string | UN;
40
- modules: EModules | UN;
41
- }
42
- export enum ESigninRequestMode {
43
- DEFAULT = "0",
44
- SIGN_OUT = "1",
45
- SWITCH_BRANCH = "2",
46
- SWITCH_FISCAL_YEAR = "3",
47
- }
@@ -1,21 +0,0 @@
1
- import { IAccessAction } from "./interfaces/permission-interfaces";
2
- import { IThemeInformation } from "./interfaces/theme-interfaces";
3
-
4
- export interface IGlobalObject {
5
- systemThemes?: IThemeInformation[];
6
- accessActions?: IAccessAction[];
7
- isAdminModule?: boolean;
8
- }
9
- const _globalObject: IGlobalObject = {
10
- systemThemes: undefined,
11
- };
12
- export const NEXUS_OBJECT = (systemThemes: IThemeInformation[], access?: IAccessAction[], isAdminModule?: boolean) => {
13
- if (!_globalObject.systemThemes && systemThemes) {
14
- _globalObject.accessActions = access ?? [];
15
- _globalObject.systemThemes = systemThemes;
16
- _globalObject.isAdminModule = isAdminModule;
17
- }
18
- return _globalObject;
19
- };
20
-
21
- export const O = _globalObject;
@@ -1,66 +0,0 @@
1
- import { EModules } from "./interfaces/system-interfaces";
2
- import { EBackgrounds } from "./interfaces/theme-interfaces";
3
-
4
- // @ts-ignore
5
- const processEnv = process.env;
6
-
7
- export const APIS = {
8
- DRIVE: processEnv.API_DRIVE as string,
9
- AUTHENTICATION: processEnv.API_AUTHENTICATION as string,
10
- CONFIGURATION: processEnv.API_CONFIGURATION as string,
11
- CURRENT: processEnv.API_CURRENT as string,
12
- ENTERPRISE: processEnv.API_ENTERPRISE as string,
13
- MESSAGE: processEnv.API_MESSAGE as string,
14
- ACCOUNTING: processEnv.API_ACCOUNTING as string,
15
- REPORT: processEnv.API_REPORT as string,
16
- };
17
-
18
- export const URLS = {
19
- GLOBAL_SIGNIN: `${processEnv.URL_AUTHENTICATION}/api/auth/redirect-context`,
20
- CURRENT: processEnv.URL_CURRENT as string,
21
- AUTHENTICATION: processEnv.URL_AUTHENTICATION as string,
22
- SIGN_IN: processEnv.URL_AUTHENTICATION_SIGN_IN as string,
23
- ALLOWED_ORIGINS: (processEnv.ALLOWED_ORIGINS ?? "")
24
- .split(",")
25
- .map((origin: string) => origin.trim())
26
- .filter(Boolean),
27
- };
28
- const FILE = (apiName: string, filePath: string, fileName: string) => `${processEnv.API_RESOURCES_BASE_PATH ?? `/api/app/${EModules.Drive}/Resources`}/${apiName}/${encodeURIComponent(filePath)}/${encodeURIComponent(fileName)}`;
29
- export const FILES = {
30
- LOGO: {
31
- ICON: FILE("Image", "logos", "icon-logo"),
32
- FULL: FILE("Image", "logos", "full-logo"),
33
- FULL_TEXT: FILE("Image", "logos", "full-text-logo"),
34
- },
35
- ICONS: {
36
- USER: FILE("Image", "icons", "user"),
37
- NO_IMAGE: FILE("Image", "icons", "no-image"),
38
- },
39
- SCRIPT: (fileName: string, isStyles: boolean = false) => FILE("Script", isStyles ? "css" : "js", fileName),
40
- };
41
- export const NEXUS_INFO = {
42
- IS_ADMIN_MODULE: processEnv.IS_ADMIN_MODULE !== "false",
43
- CURRENT_MODULE: processEnv.CURRENT_MODULE !== undefined ? (parseInt(processEnv.CURRENT_MODULE) as EModules) : undefined,
44
- CURRENT_MODULE_NAME: processEnv.CURRENT_MODULE_NAME as string,
45
- CURRENT_MODULE_SHORT_NAME: processEnv.CURRENT_MODULE_SHORT_NAME as string,
46
- IS_PRODUCTION: processEnv.NODE_ENV === "production",
47
- SOFTWARE_COMPANY_SHORT_NAME: processEnv.SOFTWARE_COMPANY_SHORT_NAME as string,
48
- SOFTWARE_COMPANY_FULL_NAME: processEnv.SOFTWARE_COMPANY_FULL_NAME as string,
49
- SOFTWARE_VERSION: processEnv.SOFTWARE_VERSION as string,
50
- SOFTWARE_LAST_UPDATE_DATE: processEnv.SOFTWARE_LAST_UPDATE_DATE as string,
51
- SOFTWARE_COMPANY_WEBSITE: processEnv.SOFTWARE_COMPANY_WEBSITE as string,
52
- IS_PROXY_SERVER: processEnv.IS_PROXY_SERVER !== "false",
53
- };
54
- export const NEXUS_CONFIG = {
55
- /** Default revalidate time for static generation (in minutes) */
56
- DEFAULT_REVALIDATE_TIME: NEXUS_INFO.IS_PRODUCTION ? 60 * 24 : 0,
57
- DEFAULT_REVALIDATE_TIME_ONE_HOUR: NEXUS_INFO.IS_PRODUCTION ? 60 : 0,
58
- DEFAULT_REVALIDATE_TIME_ONE_DAY: NEXUS_INFO.IS_PRODUCTION ? 60 * 24 : 0,
59
- DEFAULT_REVALIDATE_TIME_ONE_WEEK: NEXUS_INFO.IS_PRODUCTION ? 60 * 24 * 7 : 0,
60
- DEFAULT_REVALIDATE_TIME_ONE_MONTH: NEXUS_INFO.IS_PRODUCTION ? 60 * 24 * 30 : 0,
61
- DEFAULT_REVALIDATE_TIME_ONE_YEAR: NEXUS_INFO.IS_PRODUCTION ? 60 * 24 * 365 : 0,
62
- /** Default timeout for HTTP requests (in milliseconds) */
63
- DEFAULT_HTTP_REQUEST_TIMEOUT: NEXUS_INFO.IS_PRODUCTION ? 60000 : 1000000,
64
-
65
- DEFAULT_BACKGROUND: (processEnv.DEFAULT_BACKGROUND as EBackgrounds) ?? EBackgrounds.Background1,
66
- };
@@ -1,60 +0,0 @@
1
- import { NextRequest, NextResponse } from "next/server";
2
- import { EErrorCodes } from "../interfaces/exception-interfaces";
3
- import { GetRootApi } from "../services/http-services";
4
- import { DecryptCookieValue } from "../sso-config/cookie-encryption";
5
- import { ALLOWED_MODULES, PROXY_ALLOWED_METHODS } from "./proxy-constants";
6
- import { BuildBackendUrl, BuildForwardHeaders, ProxyErrorResponse, ReadRequestBody, SanitizeResponseHeaders } from "./proxy-helpers";
7
-
8
- const GENERIC_PROXY_ERROR = "Unable to reach the backend service.";
9
- const MODULE_NOT_ALLOWED_ERROR = "This module is not allowed for proxy requests.";
10
-
11
- const ACCESS_TOKEN_COOKIE = "access_token";
12
-
13
- export async function ProxyToBackend(req: NextRequest, moduleParam: string, pathSegments: string[]): Promise<NextResponse> {
14
- const method = req.method.toUpperCase();
15
-
16
- if (!PROXY_ALLOWED_METHODS.has(method)) {
17
- return ProxyErrorResponse(`Method ${method} is not supported.`, 405, "METHOD_NOT_SUPPORTED", EErrorCodes.Forbidden);
18
- }
19
-
20
- const module = ALLOWED_MODULES.includes(moduleParam) ? parseInt(moduleParam) : null;
21
- if (!module) return ProxyErrorResponse(MODULE_NOT_ALLOWED_ERROR, 400, "INVALID_MODULE");
22
- const backendBase = GetRootApi(module);
23
- const backendUrl = BuildBackendUrl(backendBase, pathSegments, req.nextUrl.searchParams);
24
-
25
- return ProxyToBackendRequest(backendUrl, backendBase, module, method, req);
26
- }
27
-
28
- export async function ProxyToBackendRequest(backendFullUrl: string, backendUrlBase: string, module: number, method: string, req: NextRequest): Promise<NextResponse> {
29
- // BuildForwardHeaders already strips the Cookie header (see PROXY_REQUEST_HEADERS_TO_SKIP).
30
- const headers = BuildForwardHeaders(req);
31
-
32
- // Decrypt the access token from the httpOnly cookie and inject it as a Bearer token.
33
- // The raw encrypted blob is never forwarded — only the plaintext token reaches the backend.
34
- const encryptedToken = req.cookies.get(ACCESS_TOKEN_COOKIE)?.value;
35
- if (encryptedToken) {
36
- const token = DecryptCookieValue(encryptedToken);
37
- if (token) headers.set("Authorization", `Bearer ${token}`);
38
- }
39
-
40
- const body = await ReadRequestBody(req, method);
41
-
42
- let backendResponse: Response;
43
- try {
44
- backendResponse = await fetch(backendFullUrl, {
45
- method,
46
- headers,
47
- body,
48
- redirect: "manual",
49
- });
50
- } catch {
51
- return ProxyErrorResponse(GENERIC_PROXY_ERROR, 502, "BACKEND_UNREACHABLE");
52
- }
53
- const responseHeaders = SanitizeResponseHeaders(backendResponse.headers, backendUrlBase, module);
54
- const responseBody = await backendResponse.arrayBuffer();
55
-
56
- return new NextResponse(responseBody, {
57
- status: backendResponse.status,
58
- headers: responseHeaders,
59
- });
60
- }
@@ -1,28 +0,0 @@
1
- import { EModules } from "../interfaces/system-interfaces";
2
-
3
-
4
- /** HTTP methods supported by the backend proxy. */
5
- export const PROXY_ALLOWED_METHODS = new Set(["GET", "POST", "PUT", "DELETE", "PATCH"]);
6
-
7
- /** Request headers that must not be forwarded to the backend. */
8
- export const PROXY_REQUEST_HEADERS_TO_SKIP = new Set(["host", "connection", "content-length", "transfer-encoding", "keep-alive", "upgrade", "cookie"]);
9
-
10
- /** Response headers that must not be forwarded to the browser. */
11
- export const PROXY_RESPONSE_HEADERS_TO_SKIP = new Set(["connection", "transfer-encoding", "keep-alive", "proxy-authenticate", "proxy-authorization", "te", "trailer", "upgrade"]);
12
-
13
- /** Public path prefix the browser uses to reach the proxy. */
14
-
15
- /** Allowed modules for proxy requests. */
16
-
17
- export const ALLOWED_MODULES = [
18
- EModules.Authentication.toString(),
19
- EModules.Configuration.toString(),
20
- EModules.Enterprise.toString(),
21
- EModules.Drive.toString(),
22
- EModules.Message.toString(),
23
- EModules.Accounting.toString(),
24
- EModules.Report.toString(),
25
- EModules.Portfolio.toString(),
26
- EModules.Subscription.toString(),
27
- EModules.Reservation.toString(),
28
- ]