@sarafapp/iron_core 1.0.64 → 1.0.66

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 (307) hide show
  1. package/package.json +2 -2
  2. package/dist/core/src/BaseModel.d.ts +0 -45
  3. package/dist/core/src/Utils.d.ts +0 -4
  4. package/dist/core/src/accessHandling/AccessControl.d.ts +0 -10
  5. package/dist/core/src/accessHandling/AccessLevel.d.ts +0 -13
  6. package/dist/core/src/accessHandling/Accessible.d.ts +0 -3
  7. package/dist/core/src/accessHandling/EveryDirectiveAccess.d.ts +0 -4
  8. package/dist/core/src/accessHandling/SSO/AuthorizationDirective.d.ts +0 -17
  9. package/dist/core/src/accessHandling/SSO/AuthorizationService.d.ts +0 -17
  10. package/dist/core/src/accessHandling/SSO/EveryLevelAuthorizationDirective.d.ts +0 -4
  11. package/dist/core/src/accessHandling/SSO/SomeLevelsAuthorizationDirective.d.ts +0 -4
  12. package/dist/core/src/accessHandling/SomeDirectiveAccess.d.ts +0 -4
  13. package/dist/core/src/accessHandling/index.d.ts +0 -9
  14. package/dist/core/src/baseDirective/BeforeMountDirective.d.ts +0 -3
  15. package/dist/core/src/baseDirective/BeforeUnMountDirective.d.ts +0 -3
  16. package/dist/core/src/baseDirective/BeforeUpdateDirective.d.ts +0 -3
  17. package/dist/core/src/baseDirective/CreatedDirective.d.ts +0 -3
  18. package/dist/core/src/baseDirective/MountedDirective.d.ts +0 -3
  19. package/dist/core/src/baseDirective/UnMountedDirective.d.ts +0 -3
  20. package/dist/core/src/baseDirective/UpdateDirective.d.ts +0 -3
  21. package/dist/core/src/baseDirective/index.d.ts +0 -7
  22. package/dist/core/src/baseForm/BaseRequestBodyFilter.d.ts +0 -4
  23. package/dist/core/src/baseForm/FormManager.d.ts +0 -18
  24. package/dist/core/src/baseForm/InputControl.d.ts +0 -40
  25. package/dist/core/src/baseForm/InputControlBuilder.d.ts +0 -16
  26. package/dist/core/src/baseForm/InputControlData.d.ts +0 -15
  27. package/dist/core/src/baseForm/RequestBodyFilter.d.ts +0 -3
  28. package/dist/core/src/baseForm/TouchSensitiveForm.d.ts +0 -9
  29. package/dist/core/src/baseForm/UseForm.d.ts +0 -18
  30. package/dist/core/src/baseForm/index.d.ts +0 -8
  31. package/dist/core/src/baseSchedule/Schedule.d.ts +0 -3
  32. package/dist/core/src/baseSchedule/Scheduler.d.ts +0 -8
  33. package/dist/core/src/baseSchedule/index.d.ts +0 -2
  34. package/dist/core/src/baseTable/BaseTable.d.ts +0 -47
  35. package/dist/core/src/baseTable/Constants.d.ts +0 -13
  36. package/dist/core/src/baseTable/OnDestory.d.ts +0 -3
  37. package/dist/core/src/baseTable/RowActionSource.d.ts +0 -4
  38. package/dist/core/src/baseTable/RowClick.d.ts +0 -3
  39. package/dist/core/src/baseTable/RowDoubleClick.d.ts +0 -3
  40. package/dist/core/src/baseTable/RowMetaClick.d.ts +0 -3
  41. package/dist/core/src/baseTable/SelectableTable.d.ts +0 -19
  42. package/dist/core/src/baseTable/TableAction.d.ts +0 -8
  43. package/dist/core/src/baseTable/TableHeaderSchema.d.ts +0 -27
  44. package/dist/core/src/baseTable/TableLoader.d.ts +0 -3
  45. package/dist/core/src/baseTable/TablePaginate.d.ts +0 -3
  46. package/dist/core/src/baseTable/TableService.d.ts +0 -9
  47. package/dist/core/src/baseTable/TableSort.d.ts +0 -4
  48. package/dist/core/src/baseTable/TableSummarySchema.d.ts +0 -9
  49. package/dist/core/src/baseTable/generator/SelectableTableGenerator.d.ts +0 -14
  50. package/dist/core/src/baseTable/generator/TableCellComponentRegistry.d.ts +0 -7
  51. package/dist/core/src/baseTable/generator/TableConfig.d.ts +0 -7
  52. package/dist/core/src/baseTable/generator/TableGenerator.d.ts +0 -37
  53. package/dist/core/src/baseTable/generator/TableSource.d.ts +0 -24
  54. package/dist/core/src/baseTable/index.d.ts +0 -23
  55. package/dist/core/src/baseTable/moduleConnection/Action.d.ts +0 -3
  56. package/dist/core/src/baseTable/moduleConnection/Column.d.ts +0 -3
  57. package/dist/core/src/baseTable/moduleConnection/Table.d.ts +0 -4
  58. package/dist/core/src/baseTable/moduleConnection/TableDestroy.d.ts +0 -2
  59. package/dist/core/src/baseTable/moduleConnection/TableRowClick.d.ts +0 -2
  60. package/dist/core/src/baseTable/moduleConnection/generator/GColumn.d.ts +0 -2
  61. package/dist/core/src/baseTable/moduleConnection/generator/GTable.d.ts +0 -2
  62. package/dist/core/src/composables/UseCrud.d.ts +0 -10
  63. package/dist/core/src/composables/UseData.d.ts +0 -15
  64. package/dist/core/src/composables/UseLoadingStatus.d.ts +0 -15
  65. package/dist/core/src/composables/UseParams.d.ts +0 -17
  66. package/dist/core/src/composables/UseRepository.d.ts +0 -67
  67. package/dist/core/src/composables/UseState.d.ts +0 -2
  68. package/dist/core/src/composables/UseStaticTableService.d.ts +0 -5
  69. package/dist/core/src/composables/index.d.ts +0 -7
  70. package/dist/core/src/constants/Constants.d.ts +0 -108
  71. package/dist/core/src/constants/index.d.ts +0 -1
  72. package/dist/core/src/crudService/CrudService.d.ts +0 -22
  73. package/dist/core/src/crudService/index.d.ts +0 -1
  74. package/dist/core/src/dateHandling/Constants.d.ts +0 -5
  75. package/dist/core/src/dateHandling/Converter.d.ts +0 -5
  76. package/dist/core/src/dateHandling/JalaliDateSetup.d.ts +0 -1
  77. package/dist/core/src/dateHandling/Model.d.ts +0 -12
  78. package/dist/core/src/dateHandling/Utils.d.ts +0 -8
  79. package/dist/core/src/dateHandling/index.d.ts +0 -5
  80. package/dist/core/src/debounce/DebounceAction.d.ts +0 -4
  81. package/dist/core/src/debounce/DebounceService.d.ts +0 -9
  82. package/dist/core/src/debounce/index.d.ts +0 -2
  83. package/dist/core/src/deviceManagement/Constants.d.ts +0 -4
  84. package/dist/core/src/deviceManagement/Visibility.d.ts +0 -4
  85. package/dist/core/src/deviceManagement/VisibilityManager.d.ts +0 -6
  86. package/dist/core/src/deviceManagement/index.d.ts +0 -3
  87. package/dist/core/src/errorHandling/ErrorHandler.d.ts +0 -3
  88. package/dist/core/src/errorHandling/HandleError.d.ts +0 -2
  89. package/dist/core/src/errorHandling/index.d.ts +0 -2
  90. package/dist/core/src/eventSystem/CustomEventDispatcher.d.ts +0 -5
  91. package/dist/core/src/eventSystem/Model.d.ts +0 -8
  92. package/dist/core/src/eventSystem/OnEvent.d.ts +0 -1
  93. package/dist/core/src/eventSystem/index.d.ts +0 -3
  94. package/dist/core/src/feedbackHandling/FailureFeedback.d.ts +0 -3
  95. package/dist/core/src/feedbackHandling/Feedback.d.ts +0 -11
  96. package/dist/core/src/feedbackHandling/HandleFeedback.d.ts +0 -2
  97. package/dist/core/src/feedbackHandling/InfoFeedback.d.ts +0 -3
  98. package/dist/core/src/feedbackHandling/SuccessFeedback.d.ts +0 -3
  99. package/dist/core/src/feedbackHandling/WarningFeedback.d.ts +0 -3
  100. package/dist/core/src/feedbackHandling/index.d.ts +0 -6
  101. package/dist/core/src/httpClient/ApiBuilder.d.ts +0 -14
  102. package/dist/core/src/httpClient/ErrorHandlerRegistry.d.ts +0 -10
  103. package/dist/core/src/httpClient/HttpClient.d.ts +0 -14
  104. package/dist/core/src/httpClient/Interceptor.d.ts +0 -4
  105. package/dist/core/src/httpClient/index.d.ts +0 -4
  106. package/dist/core/src/initializer/ApplicationInitializer.d.ts +0 -6
  107. package/dist/core/src/initializer/Initializer.d.ts +0 -3
  108. package/dist/core/src/initializer/index.d.ts +0 -2
  109. package/dist/core/src/json/JsonMapper.d.ts +0 -18
  110. package/dist/core/src/json/index.d.ts +0 -1
  111. package/dist/core/src/layout/Constants.d.ts +0 -10
  112. package/dist/core/src/layout/DialogService.d.ts +0 -406
  113. package/dist/core/src/layout/DrawerService.d.ts +0 -14
  114. package/dist/core/src/layout/Toast.d.ts +0 -8
  115. package/dist/core/src/layout/index.d.ts +0 -4
  116. package/dist/core/src/lib/Constants.d.ts +0 -20
  117. package/dist/core/src/lib/Formatter.d.ts +0 -10
  118. package/dist/core/src/lib/Util.d.ts +0 -12
  119. package/dist/core/src/lib/index.d.ts +0 -3
  120. package/dist/core/src/observables/AbstractSubject.d.ts +0 -7
  121. package/dist/core/src/observables/BehaviorSubject.d.ts +0 -16
  122. package/dist/core/src/observables/Observer.d.ts +0 -3
  123. package/dist/core/src/observables/Subject.d.ts +0 -6
  124. package/dist/core/src/observables/index.d.ts +0 -4
  125. package/dist/core/src/process/Proccess.d.ts +0 -9
  126. package/dist/core/src/process/ProcessManager.d.ts +0 -10
  127. package/dist/core/src/process/index.d.ts +0 -2
  128. package/dist/core/src/repository/Params.d.ts +0 -11
  129. package/dist/core/src/repository/Repository.d.ts +0 -38
  130. package/dist/core/src/repository/SyncDetail.d.ts +0 -5
  131. package/dist/core/src/repository/index.d.ts +0 -4
  132. package/dist/core/src/repository/model.d.ts +0 -5
  133. package/dist/core/src/routeGuard/RouteGuard.d.ts +0 -7
  134. package/dist/core/src/routeGuard/index.d.ts +0 -1
  135. package/dist/core/src/search/client/ClientArraySearch.d.ts +0 -4
  136. package/dist/core/src/search/client/ClientSearch.d.ts +0 -3
  137. package/dist/core/src/search/index.d.ts +0 -2
  138. package/dist/core/src/sort/SortDetail.d.ts +0 -6
  139. package/dist/core/src/sort/client/Sorter.d.ts +0 -6
  140. package/dist/core/src/sort/index.d.ts +0 -4
  141. package/dist/core/src/sort/strategies/SimpleSort.d.ts +0 -5
  142. package/dist/core/src/sort/strategies/SortStrategy.d.ts +0 -4
  143. package/dist/core/src/types/Global.d.ts +0 -1
  144. package/dist/core/src/types/index.d.ts +0 -1
  145. package/dist/core/src/validators/Validator.d.ts +0 -4
  146. package/dist/core/src/validators/index.d.ts +0 -1
  147. package/dist/core/src/webSocket/Constants.d.ts +0 -6
  148. package/dist/core/src/webSocket/Model.d.ts +0 -6
  149. package/dist/core/src/webSocket/WebSocketService.d.ts +0 -30
  150. package/dist/core/src/webSocket/index.d.ts +0 -3
  151. package/dist/example-vue/src/AntTableConfig.d.ts +0 -6
  152. package/dist/example-vue/src/TableService.d.ts +0 -12
  153. package/dist/example-vue/src/TextCell.vue.d.ts +0 -5
  154. package/dist/example-vue/src/app/App.vue.d.ts +0 -2
  155. package/dist/example-vue/src/app/router/index.d.ts +0 -1
  156. package/dist/example-vue/src/app/screens/Index.vue.d.ts +0 -2
  157. package/dist/example-vue/src/main.d.ts +0 -0
  158. package/src/BaseModel.ts +0 -127
  159. package/src/Utils.ts +0 -16
  160. package/src/accessHandling/AccessControl.ts +0 -33
  161. package/src/accessHandling/AccessLevel.ts +0 -52
  162. package/src/accessHandling/Accessible.ts +0 -3
  163. package/src/accessHandling/EveryDirectiveAccess.ts +0 -7
  164. package/src/accessHandling/SSO/AuthorizationDirective.ts +0 -65
  165. package/src/accessHandling/SSO/AuthorizationService.ts +0 -74
  166. package/src/accessHandling/SSO/EveryLevelAuthorizationDirective.ts +0 -7
  167. package/src/accessHandling/SSO/SomeLevelsAuthorizationDirective.ts +0 -7
  168. package/src/accessHandling/SomeDirectiveAccess.ts +0 -7
  169. package/src/accessHandling/index.ts +0 -9
  170. package/src/baseDirective/BeforeMountDirective.ts +0 -3
  171. package/src/baseDirective/BeforeUnMountDirective.ts +0 -3
  172. package/src/baseDirective/BeforeUpdateDirective.ts +0 -3
  173. package/src/baseDirective/CreatedDirective.ts +0 -3
  174. package/src/baseDirective/MountedDirective.ts +0 -3
  175. package/src/baseDirective/UnMountedDirective.ts +0 -3
  176. package/src/baseDirective/UpdateDirective.ts +0 -3
  177. package/src/baseDirective/index.ts +0 -7
  178. package/src/baseForm/BaseRequestBodyFilter.ts +0 -7
  179. package/src/baseForm/FormManager.ts +0 -95
  180. package/src/baseForm/InputControl.ts +0 -182
  181. package/src/baseForm/InputControlBuilder.ts +0 -59
  182. package/src/baseForm/InputControlData.ts +0 -16
  183. package/src/baseForm/RequestBodyFilter.ts +0 -3
  184. package/src/baseForm/TouchSensitiveForm.ts +0 -47
  185. package/src/baseForm/UseForm.ts +0 -32
  186. package/src/baseForm/index.ts +0 -8
  187. package/src/baseSchedule/Schedule.ts +0 -3
  188. package/src/baseSchedule/Scheduler.ts +0 -29
  189. package/src/baseSchedule/index.ts +0 -2
  190. package/src/baseTable/BaseTable.ts +0 -162
  191. package/src/baseTable/Constants.ts +0 -26
  192. package/src/baseTable/OnDestory.ts +0 -3
  193. package/src/baseTable/RowActionSource.ts +0 -5
  194. package/src/baseTable/RowClick.ts +0 -3
  195. package/src/baseTable/RowDoubleClick.ts +0 -3
  196. package/src/baseTable/RowMetaClick.ts +0 -3
  197. package/src/baseTable/SelectableTable.ts +0 -86
  198. package/src/baseTable/TableAction.ts +0 -10
  199. package/src/baseTable/TableHeaderSchema.ts +0 -44
  200. package/src/baseTable/TableLoader.ts +0 -3
  201. package/src/baseTable/TablePaginate.ts +0 -3
  202. package/src/baseTable/TableService.ts +0 -10
  203. package/src/baseTable/TableSort.ts +0 -5
  204. package/src/baseTable/TableSummarySchema.ts +0 -11
  205. package/src/baseTable/generator/SelectableTableGenerator.ts +0 -65
  206. package/src/baseTable/generator/TableCellComponentRegistry.ts +0 -15
  207. package/src/baseTable/generator/TableConfig.ts +0 -18
  208. package/src/baseTable/generator/TableGenerator.ts +0 -147
  209. package/src/baseTable/generator/TableSource.ts +0 -34
  210. package/src/baseTable/index.ts +0 -43
  211. package/src/baseTable/moduleConnection/Action.ts +0 -12
  212. package/src/baseTable/moduleConnection/Column.ts +0 -11
  213. package/src/baseTable/moduleConnection/Table.ts +0 -49
  214. package/src/baseTable/moduleConnection/TableDestroy.ts +0 -7
  215. package/src/baseTable/moduleConnection/TableRowClick.ts +0 -7
  216. package/src/baseTable/moduleConnection/generator/GColumn.ts +0 -10
  217. package/src/baseTable/moduleConnection/generator/GTable.ts +0 -11
  218. package/src/composables/UseCrud.ts +0 -53
  219. package/src/composables/UseData.ts +0 -70
  220. package/src/composables/UseLoadingStatus.ts +0 -65
  221. package/src/composables/UseParams.ts +0 -93
  222. package/src/composables/UseRepository.ts +0 -207
  223. package/src/composables/UseState.ts +0 -30
  224. package/src/composables/UseStaticTableService.ts +0 -45
  225. package/src/composables/index.ts +0 -7
  226. package/src/constants/Constants.ts +0 -126
  227. package/src/constants/index.ts +0 -19
  228. package/src/crudService/CrudService.ts +0 -121
  229. package/src/crudService/index.ts +0 -1
  230. package/src/dateHandling/Constants.ts +0 -5
  231. package/src/dateHandling/Converter.ts +0 -15
  232. package/src/dateHandling/JalaliDateSetup.ts +0 -42
  233. package/src/dateHandling/Model.ts +0 -27
  234. package/src/dateHandling/Utils.ts +0 -49
  235. package/src/dateHandling/index.ts +0 -5
  236. package/src/debounce/DebounceAction.ts +0 -4
  237. package/src/debounce/DebounceService.ts +0 -27
  238. package/src/debounce/index.ts +0 -2
  239. package/src/deviceManagement/Constants.ts +0 -4
  240. package/src/deviceManagement/Visibility.ts +0 -4
  241. package/src/deviceManagement/VisibilityManager.ts +0 -18
  242. package/src/deviceManagement/index.ts +0 -3
  243. package/src/errorHandling/ErrorHandler.ts +0 -3
  244. package/src/errorHandling/HandleError.ts +0 -20
  245. package/src/errorHandling/index.ts +0 -2
  246. package/src/eventSystem/CustomEventDispatcher.ts +0 -13
  247. package/src/eventSystem/Model.ts +0 -29
  248. package/src/eventSystem/OnEvent.ts +0 -25
  249. package/src/eventSystem/index.ts +0 -3
  250. package/src/feedbackHandling/FailureFeedback.ts +0 -3
  251. package/src/feedbackHandling/Feedback.ts +0 -34
  252. package/src/feedbackHandling/HandleFeedback.ts +0 -28
  253. package/src/feedbackHandling/InfoFeedback.ts +0 -3
  254. package/src/feedbackHandling/SuccessFeedback.ts +0 -3
  255. package/src/feedbackHandling/WarningFeedback.ts +0 -3
  256. package/src/feedbackHandling/index.ts +0 -6
  257. package/src/httpClient/ApiBuilder.ts +0 -57
  258. package/src/httpClient/ErrorHandlerRegistry.ts +0 -29
  259. package/src/httpClient/HttpClient.ts +0 -77
  260. package/src/httpClient/Interceptor.ts +0 -5
  261. package/src/httpClient/index.ts +0 -4
  262. package/src/initializer/ApplicationInitializer.ts +0 -15
  263. package/src/initializer/Initializer.ts +0 -3
  264. package/src/initializer/index.ts +0 -2
  265. package/src/json/JsonMapper.ts +0 -48
  266. package/src/json/index.ts +0 -1
  267. package/src/layout/Constants.ts +0 -11
  268. package/src/layout/DialogService.ts +0 -75
  269. package/src/layout/DrawerService.ts +0 -25
  270. package/src/layout/Toast.ts +0 -14
  271. package/src/layout/index.ts +0 -4
  272. package/src/lib/Constants.ts +0 -433
  273. package/src/lib/Formatter.ts +0 -68
  274. package/src/lib/Util.ts +0 -113
  275. package/src/lib/index.ts +0 -3
  276. package/src/observables/AbstractSubject.ts +0 -21
  277. package/src/observables/BehaviorSubject.ts +0 -58
  278. package/src/observables/Observer.ts +0 -3
  279. package/src/observables/Subject.ts +0 -9
  280. package/src/observables/index.ts +0 -4
  281. package/src/process/Proccess.ts +0 -21
  282. package/src/process/ProcessManager.ts +0 -31
  283. package/src/process/index.ts +0 -2
  284. package/src/repository/Params.ts +0 -10
  285. package/src/repository/Repository.ts +0 -44
  286. package/src/repository/SyncDetail.ts +0 -8
  287. package/src/repository/index.ts +0 -4
  288. package/src/repository/model.ts +0 -9
  289. package/src/routeGuard/RouteGuard.ts +0 -38
  290. package/src/routeGuard/index.ts +0 -1
  291. package/src/search/client/ClientArraySearch.ts +0 -25
  292. package/src/search/client/ClientSearch.ts +0 -3
  293. package/src/search/index.ts +0 -2
  294. package/src/sort/SortDetail.ts +0 -11
  295. package/src/sort/client/Sorter.ts +0 -28
  296. package/src/sort/index.ts +0 -4
  297. package/src/sort/strategies/SimpleSort.ts +0 -35
  298. package/src/sort/strategies/SortStrategy.ts +0 -4
  299. package/src/types/Global.ts +0 -1
  300. package/src/types/index.ts +0 -1
  301. package/src/validators/Validator.ts +0 -5
  302. package/src/validators/index.ts +0 -1
  303. package/src/webSocket/Constants.ts +0 -6
  304. package/src/webSocket/Model.ts +0 -16
  305. package/src/webSocket/WebSocketService.ts +0 -153
  306. package/src/webSocket/index.ts +0 -3
  307. package/vite.config.ts +0 -55
@@ -1,6 +0,0 @@
1
- export { HandleFeedback } from "./HandleFeedback";
2
- export { Feedback } from "./Feedback";
3
- export type { FailureFeedback } from "./FailureFeedback";
4
- export type { InfoFeedback } from "./InfoFeedback";
5
- export type { SuccessFeedback } from "./SuccessFeedback";
6
- export type { WarningFeedback } from "./WarningFeedback";
@@ -1,57 +0,0 @@
1
- import { Axios, type InternalAxiosRequestConfig } from "axios";
2
- import { type Interceptor } from "./Interceptor";
3
- import { APIErrorHandlerRegistry } from "./ErrorHandlerRegistry";
4
-
5
- export class ApiBuilder {
6
- private axiosInstance: Axios;
7
-
8
- constructor(axiosInstance: Axios) {
9
- this.axiosInstance = axiosInstance;
10
- }
11
-
12
- public setBaseURL(baseURL: string) {
13
- this.axiosInstance.defaults.baseURL = baseURL;
14
- return this;
15
- }
16
-
17
- public setTimeout(timeInMilliSeconds: number) {
18
- this.axiosInstance.defaults.timeout = timeInMilliSeconds;
19
- return this;
20
- }
21
-
22
- public setHeaders(headers: Record<string, string | string[]>) {
23
- this.axiosInstance.defaults.headers.common = headers;
24
- return this;
25
- }
26
-
27
- public attachRequestInterceptors(interceptors: Interceptor[]) {
28
- this.axiosInstance.interceptors.request.use(
29
- (config: InternalAxiosRequestConfig) => {
30
- for (const interceptor of interceptors) {
31
- interceptor.intercept(config);
32
- }
33
- return config;
34
- },
35
- (error) => {
36
- return Promise.reject(error);
37
- },
38
- );
39
- return this;
40
- }
41
-
42
- public attachResponseInterceptors(apiErrorRegistry: APIErrorHandlerRegistry) {
43
- this.axiosInstance.interceptors.response.use(
44
- (response) => response,
45
- (error) => {
46
- apiErrorRegistry.handle(error);
47
- throw error;
48
- },
49
- );
50
- return this;
51
- }
52
-
53
- public build() {
54
- return this.axiosInstance;
55
- }
56
- }
57
- export default ApiBuilder;
@@ -1,29 +0,0 @@
1
- import { AxiosError } from "axios";
2
- import { type Nullable } from "../types";
3
- import { type ErrorHandler } from "../errorHandling";
4
-
5
- export class APIErrorHandlerRegistry {
6
- private static handlers: Map<number, ErrorHandler> = new Map();
7
- private static instance: Nullable<APIErrorHandlerRegistry> = null;
8
-
9
- private constructor() {}
10
-
11
- static GetInstance() {
12
- if (!APIErrorHandlerRegistry.instance) {
13
- APIErrorHandlerRegistry.instance = new APIErrorHandlerRegistry();
14
- }
15
- return APIErrorHandlerRegistry.instance;
16
- }
17
-
18
- public static registerHandler(statusCode: number, handler: ErrorHandler) {
19
- APIErrorHandlerRegistry.handlers.set(statusCode, handler);
20
- }
21
-
22
- public handle(error: AxiosError) {
23
- const status = error.response?.status ?? 0;
24
- const handler = APIErrorHandlerRegistry.handlers.get(status);
25
- if (handler) {
26
- handler.handleError(error);
27
- }
28
- }
29
- }
@@ -1,77 +0,0 @@
1
- import {
2
- Axios,
3
- AxiosHeaders,
4
- type AxiosResponse,
5
- type InternalAxiosRequestConfig,
6
- } from "axios";
7
-
8
- type axiosConfig = { headers?: AxiosHeaders } & Omit<
9
- InternalAxiosRequestConfig,
10
- "headers"
11
- >;
12
-
13
- export class HttpClient {
14
- private axiosInstance: Axios;
15
-
16
- constructor(instance: Axios) {
17
- this.axiosInstance = instance;
18
- }
19
-
20
- public async get<T>(
21
- url: string,
22
- config?: axiosConfig,
23
- ): Promise<AxiosResponse<T>> {
24
- return await this.axiosInstance.get(
25
- url,
26
- config as InternalAxiosRequestConfig,
27
- );
28
- }
29
-
30
- public async post<T>(
31
- url: string,
32
- data?: unknown,
33
- config?: axiosConfig,
34
- ): Promise<AxiosResponse<T>> {
35
- return await this.axiosInstance.post(
36
- url,
37
- data,
38
- config as InternalAxiosRequestConfig,
39
- );
40
- }
41
-
42
- public async patch<T>(
43
- url: string,
44
- data?: unknown,
45
- config?: axiosConfig,
46
- ): Promise<AxiosResponse<T>> {
47
- return await this.axiosInstance.patch(
48
- url,
49
- data,
50
- config as InternalAxiosRequestConfig,
51
- );
52
- }
53
-
54
- public async put<T>(
55
- url: string,
56
- data?: unknown,
57
- config?: axiosConfig,
58
- ): Promise<AxiosResponse<T>> {
59
- return await this.axiosInstance.put(
60
- url,
61
- data,
62
- config as InternalAxiosRequestConfig,
63
- );
64
- }
65
-
66
- public async delete<T>(
67
- url: string,
68
- config?: axiosConfig,
69
- ): Promise<AxiosResponse<T>> {
70
- return await this.axiosInstance.delete(
71
- url,
72
- config as InternalAxiosRequestConfig,
73
- );
74
- }
75
- }
76
-
77
- export default HttpClient;
@@ -1,5 +0,0 @@
1
- import { type InternalAxiosRequestConfig } from "axios";
2
-
3
- export interface Interceptor {
4
- intercept(config: InternalAxiosRequestConfig): InternalAxiosRequestConfig;
5
- }
@@ -1,4 +0,0 @@
1
- export { APIErrorHandlerRegistry } from "./ErrorHandlerRegistry";
2
- export { ApiBuilder } from "./ApiBuilder";
3
- export { HttpClient } from "./HttpClient";
4
- export { type Interceptor } from './Interceptor';
@@ -1,15 +0,0 @@
1
- import { type Initializer } from "./Initializer";
2
-
3
- export class ApplicationInitializer {
4
- private _initializer: Initializer[] = [];
5
-
6
- public setupInitializers(initializers: Initializer[]) {
7
- this._initializer.push(...initializers);
8
- }
9
-
10
- public initialize() {
11
- for (const initializer of this._initializer) {
12
- initializer.initialize();
13
- }
14
- }
15
- }
@@ -1,3 +0,0 @@
1
- export interface Initializer {
2
- initialize(): void
3
- }
@@ -1,2 +0,0 @@
1
- export { ApplicationInitializer } from './ApplicationInitializer';
2
- export { type Initializer } from './Initializer';
@@ -1,48 +0,0 @@
1
- import type { Nullable } from "../types";
2
- import { JsonConvert } from "json2typescript";
3
-
4
- export class JsonMapper {
5
- private static Instance: Nullable<JsonMapper> = null;
6
- private jsonConverter = new JsonConvert();
7
-
8
- private constructor() {}
9
-
10
- public serializeObject<T extends object>(
11
- object: object,
12
- model: { new (): T },
13
- ) {
14
- return this.jsonConverter.serializeObject(object, model) as T;
15
- }
16
-
17
- public deserializeObject<T extends object>(
18
- object: object,
19
- model: { new (): T },
20
- ) {
21
- return this.jsonConverter.deserializeObject(object, model) as T;
22
- }
23
-
24
- public deserializeArray<T extends object>(
25
- array: Array<T>,
26
- model: { new (): T[] },
27
- ) {
28
- return this.jsonConverter.deserializeArray(array, model) as Array<T>;
29
- }
30
-
31
- public tryDeserialize(object: object, models: { new (): any }[]) {
32
- for (const model of models) {
33
- try {
34
- return this.deserializeObject(object, model);
35
- } catch (e) {
36
- // ignore
37
- }
38
- }
39
- throw new Error("Unable to deserialize object");
40
- }
41
-
42
- public static GetInstance() {
43
- if (!JsonMapper.Instance) {
44
- JsonMapper.Instance = new JsonMapper();
45
- }
46
- return JsonMapper.Instance;
47
- }
48
- }
package/src/json/index.ts DELETED
@@ -1 +0,0 @@
1
- export { JsonMapper } from './JsonMapper';
@@ -1,11 +0,0 @@
1
- export const enum ToastType {
2
- Success = 'success',
3
- Failure = 'error',
4
- Info = 'info',
5
- Warning = 'warning',
6
- }
7
-
8
- export const enum ToastLocation {
9
- BottomLeft = 'bottomLeft',
10
- TopLeft = 'topLeft',
11
- }
@@ -1,75 +0,0 @@
1
- import { type Component, computed, reactive } from 'vue';
2
- import { defineStore } from 'pinia';
3
- import { StoreNames, DialogDimensions } from '../constants';
4
- import { type Nullable } from '../types';
5
-
6
- export const useDialogService = defineStore(StoreNames.Dialog, () => {
7
- const dialogData = reactive<{
8
- dialogComponent: Nullable<Component>;
9
- props: Nullable<Record<string, unknown>>;
10
- header: string;
11
- width: DialogDimensions;
12
- height: DialogDimensions;
13
- }>({
14
- dialogComponent: null,
15
- width: DialogDimensions.DefaultWidth,
16
- height: DialogDimensions.DefaultHeight,
17
- props: null,
18
- header: '',
19
- });
20
-
21
- const isDialogExists = computed<boolean>(() => {
22
- return Boolean(dialogData.dialogComponent);
23
- });
24
-
25
- const hasDefaultHeader = computed<boolean>(() => {
26
- return Boolean(dialogData.header);
27
- });
28
-
29
- function openDialog(component: Component) {
30
- dialogData.dialogComponent = component;
31
- }
32
-
33
- function setDialogHeader(header: string) {
34
- dialogData.header = header;
35
- }
36
-
37
- function setProps(props: Record<string, unknown>) {
38
- if (!isDialogExists.value) {
39
- throw new Error('there is no dialog to set props on');
40
- }
41
- dialogData.props = props;
42
- }
43
-
44
- function setSize(size: number, type: DialogDimensions) {
45
- if (!isDialogExists.value) {
46
- throw new Error('there is no dialog to set size on');
47
- }
48
-
49
- if (size < DialogDimensions.MinimalAvailableSize) {
50
- throw new Error('negative size not supported');
51
- }
52
-
53
- if (type === DialogDimensions.Width) dialogData.width = size;
54
- else dialogData.height = size;
55
- }
56
-
57
- function clearDialog() {
58
- dialogData.props = null;
59
- dialogData.height = DialogDimensions.DefaultHeight;
60
- dialogData.width = DialogDimensions.DefaultWidth;
61
- dialogData.header = '';
62
- dialogData.dialogComponent = null;
63
- }
64
-
65
- return {
66
- dialogData,
67
- openDialog,
68
- clearDialog,
69
- setSize,
70
- setDialogHeader,
71
- setProps,
72
- isDialogExists,
73
- hasDefaultHeader
74
- };
75
- });
@@ -1,25 +0,0 @@
1
- import { computed, ref } from 'vue';
2
- import { defineStore } from 'pinia';
3
- import { StoreNames, ApplicationDrawerStatus } from '../constants';
4
-
5
- export const useDrawerService = defineStore(StoreNames.Drawer, () => {
6
- const drawerStatus = ref<ApplicationDrawerStatus>(ApplicationDrawerStatus.Close);
7
-
8
- const isDrawerOpen = computed<boolean>(() => {
9
- return drawerStatus.value === ApplicationDrawerStatus.Open;
10
- });
11
-
12
- function closeDrawer() {
13
- drawerStatus.value = ApplicationDrawerStatus.Close;
14
- }
15
-
16
- function openDrawer() {
17
- drawerStatus.value = ApplicationDrawerStatus.Open;
18
- }
19
-
20
- return {
21
- closeDrawer,
22
- openDrawer,
23
- isDrawerOpen,
24
- };
25
- });
@@ -1,14 +0,0 @@
1
- import { ToastLocation, ToastType } from "./Constants";
2
-
3
- export class ToastMessage {
4
- public type: ToastType;
5
- public message: string;
6
- public description: string;
7
- public placement: ToastLocation = ToastLocation.BottomLeft;
8
-
9
- constructor(type: ToastType, message: string, description: string) {
10
- this.type = type;
11
- this.message = message;
12
- this.description = description;
13
- }
14
- }
@@ -1,4 +0,0 @@
1
- export { ToastLocation, ToastType } from './Constants';
2
- export { ToastMessage } from './Toast';
3
- export { useDialogService } from './DialogService';
4
- export { useDrawerService } from './DrawerService';