@sarafapp/iron_core 1.0.63 → 1.0.64

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 (320) hide show
  1. package/dist/IronCore.js +15 -5
  2. package/dist/core/index.d.ts +31 -0
  3. package/dist/{src → core/src}/BaseModel.d.ts +4 -4
  4. package/dist/core/src/baseForm/UseForm.d.ts +18 -0
  5. package/dist/{src → core/src}/baseTable/BaseTable.d.ts +3 -2
  6. package/dist/{src → core/src}/baseTable/Constants.d.ts +4 -3
  7. package/dist/{src → core/src}/baseTable/SelectableTable.d.ts +2 -2
  8. package/dist/{src → core/src}/baseTable/generator/SelectableTableGenerator.d.ts +3 -3
  9. package/dist/{src → core/src}/baseTable/moduleConnection/Table.d.ts +1 -1
  10. package/dist/{src → core/src}/baseTable/moduleConnection/generator/GColumn.d.ts +1 -1
  11. package/dist/{src → core/src}/composables/UseCrud.d.ts +4 -4
  12. package/dist/{src → core/src}/composables/UseData.d.ts +4 -3
  13. package/dist/core/src/composables/UseLoadingStatus.d.ts +15 -0
  14. package/dist/{src → core/src}/composables/UseParams.d.ts +3 -1
  15. package/dist/core/src/composables/UseRepository.d.ts +67 -0
  16. package/dist/core/src/composables/UseStaticTableService.d.ts +5 -0
  17. package/dist/{src → core/src}/crudService/CrudService.d.ts +8 -8
  18. package/dist/{src → core/src}/dateHandling/Converter.d.ts +1 -1
  19. package/dist/{src → core/src}/httpClient/ErrorHandlerRegistry.d.ts +1 -1
  20. package/dist/{src → core/src}/json/JsonMapper.d.ts +1 -1
  21. package/dist/core/src/layout/DialogService.d.ts +406 -0
  22. package/dist/core/src/layout/DrawerService.d.ts +14 -0
  23. package/dist/{src → core/src}/lib/Formatter.d.ts +1 -1
  24. package/dist/{src → core/src}/lib/Util.d.ts +2 -1
  25. package/dist/core/vite.config.d.ts +2 -0
  26. package/dist/example-vue/src/AntTableConfig.d.ts +6 -0
  27. package/dist/example-vue/src/TableService.d.ts +12 -0
  28. package/dist/example-vue/src/TextCell.vue.d.ts +5 -0
  29. package/dist/example-vue/src/app/App.vue.d.ts +2 -0
  30. package/dist/example-vue/src/app/router/index.d.ts +1 -0
  31. package/dist/example-vue/src/app/screens/Index.vue.d.ts +2 -0
  32. package/dist/example-vue/src/main.d.ts +0 -0
  33. package/dist/example-vue/vite.config.d.ts +2 -0
  34. package/dist/index.d.ts +2 -31
  35. package/index.ts +37 -0
  36. package/package.json +2 -5
  37. package/src/BaseModel.ts +127 -0
  38. package/src/Utils.ts +16 -0
  39. package/src/accessHandling/AccessControl.ts +33 -0
  40. package/src/accessHandling/AccessLevel.ts +52 -0
  41. package/src/accessHandling/Accessible.ts +3 -0
  42. package/src/accessHandling/EveryDirectiveAccess.ts +7 -0
  43. package/src/accessHandling/SSO/AuthorizationDirective.ts +65 -0
  44. package/src/accessHandling/SSO/AuthorizationService.ts +74 -0
  45. package/src/accessHandling/SSO/EveryLevelAuthorizationDirective.ts +7 -0
  46. package/src/accessHandling/SSO/SomeLevelsAuthorizationDirective.ts +7 -0
  47. package/src/accessHandling/SomeDirectiveAccess.ts +7 -0
  48. package/src/accessHandling/index.ts +9 -0
  49. package/src/baseDirective/BeforeMountDirective.ts +3 -0
  50. package/src/baseDirective/BeforeUnMountDirective.ts +3 -0
  51. package/src/baseDirective/BeforeUpdateDirective.ts +3 -0
  52. package/src/baseDirective/CreatedDirective.ts +3 -0
  53. package/src/baseDirective/MountedDirective.ts +3 -0
  54. package/src/baseDirective/UnMountedDirective.ts +3 -0
  55. package/src/baseDirective/UpdateDirective.ts +3 -0
  56. package/src/baseDirective/index.ts +7 -0
  57. package/src/baseForm/BaseRequestBodyFilter.ts +7 -0
  58. package/src/baseForm/FormManager.ts +95 -0
  59. package/src/baseForm/InputControl.ts +182 -0
  60. package/src/baseForm/InputControlBuilder.ts +59 -0
  61. package/src/baseForm/InputControlData.ts +16 -0
  62. package/src/baseForm/RequestBodyFilter.ts +3 -0
  63. package/src/baseForm/TouchSensitiveForm.ts +47 -0
  64. package/src/baseForm/UseForm.ts +32 -0
  65. package/src/baseForm/index.ts +8 -0
  66. package/src/baseSchedule/Schedule.ts +3 -0
  67. package/src/baseSchedule/Scheduler.ts +29 -0
  68. package/src/baseSchedule/index.ts +2 -0
  69. package/src/baseTable/BaseTable.ts +162 -0
  70. package/src/baseTable/Constants.ts +26 -0
  71. package/src/baseTable/OnDestory.ts +3 -0
  72. package/src/baseTable/RowActionSource.ts +5 -0
  73. package/src/baseTable/RowClick.ts +3 -0
  74. package/src/baseTable/RowDoubleClick.ts +3 -0
  75. package/src/baseTable/RowMetaClick.ts +3 -0
  76. package/src/baseTable/SelectableTable.ts +86 -0
  77. package/src/baseTable/TableAction.ts +10 -0
  78. package/src/baseTable/TableHeaderSchema.ts +44 -0
  79. package/src/baseTable/TableLoader.ts +3 -0
  80. package/src/baseTable/TablePaginate.ts +3 -0
  81. package/src/baseTable/TableService.ts +10 -0
  82. package/src/baseTable/TableSort.ts +5 -0
  83. package/src/baseTable/TableSummarySchema.ts +11 -0
  84. package/src/baseTable/generator/SelectableTableGenerator.ts +65 -0
  85. package/src/baseTable/generator/TableCellComponentRegistry.ts +15 -0
  86. package/src/baseTable/generator/TableConfig.ts +18 -0
  87. package/src/baseTable/generator/TableGenerator.ts +147 -0
  88. package/src/baseTable/generator/TableSource.ts +34 -0
  89. package/src/baseTable/index.ts +43 -0
  90. package/src/baseTable/moduleConnection/Action.ts +12 -0
  91. package/src/baseTable/moduleConnection/Column.ts +11 -0
  92. package/src/baseTable/moduleConnection/Table.ts +49 -0
  93. package/src/baseTable/moduleConnection/TableDestroy.ts +7 -0
  94. package/src/baseTable/moduleConnection/TableRowClick.ts +7 -0
  95. package/src/baseTable/moduleConnection/generator/GColumn.ts +10 -0
  96. package/src/baseTable/moduleConnection/generator/GTable.ts +11 -0
  97. package/src/composables/UseCrud.ts +53 -0
  98. package/src/composables/UseData.ts +70 -0
  99. package/src/composables/UseLoadingStatus.ts +65 -0
  100. package/src/composables/UseParams.ts +93 -0
  101. package/src/composables/UseRepository.ts +207 -0
  102. package/src/composables/UseState.ts +30 -0
  103. package/src/composables/UseStaticTableService.ts +45 -0
  104. package/src/composables/index.ts +7 -0
  105. package/src/constants/Constants.ts +126 -0
  106. package/src/constants/index.ts +19 -0
  107. package/src/crudService/CrudService.ts +121 -0
  108. package/src/crudService/index.ts +1 -0
  109. package/src/dateHandling/Constants.ts +5 -0
  110. package/src/dateHandling/Converter.ts +15 -0
  111. package/src/dateHandling/JalaliDateSetup.ts +42 -0
  112. package/src/dateHandling/Model.ts +27 -0
  113. package/src/dateHandling/Utils.ts +49 -0
  114. package/src/dateHandling/index.ts +5 -0
  115. package/src/debounce/DebounceAction.ts +4 -0
  116. package/src/debounce/DebounceService.ts +27 -0
  117. package/src/debounce/index.ts +2 -0
  118. package/src/deviceManagement/Constants.ts +4 -0
  119. package/src/deviceManagement/Visibility.ts +4 -0
  120. package/src/deviceManagement/VisibilityManager.ts +18 -0
  121. package/src/deviceManagement/index.ts +3 -0
  122. package/src/errorHandling/ErrorHandler.ts +3 -0
  123. package/src/errorHandling/HandleError.ts +20 -0
  124. package/src/errorHandling/index.ts +2 -0
  125. package/src/eventSystem/CustomEventDispatcher.ts +13 -0
  126. package/src/eventSystem/Model.ts +29 -0
  127. package/src/eventSystem/OnEvent.ts +25 -0
  128. package/src/eventSystem/index.ts +3 -0
  129. package/src/feedbackHandling/FailureFeedback.ts +3 -0
  130. package/src/feedbackHandling/Feedback.ts +34 -0
  131. package/src/feedbackHandling/HandleFeedback.ts +28 -0
  132. package/src/feedbackHandling/InfoFeedback.ts +3 -0
  133. package/src/feedbackHandling/SuccessFeedback.ts +3 -0
  134. package/src/feedbackHandling/WarningFeedback.ts +3 -0
  135. package/src/feedbackHandling/index.ts +6 -0
  136. package/src/httpClient/ApiBuilder.ts +57 -0
  137. package/src/httpClient/ErrorHandlerRegistry.ts +29 -0
  138. package/src/httpClient/HttpClient.ts +77 -0
  139. package/src/httpClient/Interceptor.ts +5 -0
  140. package/src/httpClient/index.ts +4 -0
  141. package/src/initializer/ApplicationInitializer.ts +15 -0
  142. package/src/initializer/Initializer.ts +3 -0
  143. package/src/initializer/index.ts +2 -0
  144. package/src/json/JsonMapper.ts +48 -0
  145. package/src/json/index.ts +1 -0
  146. package/src/layout/Constants.ts +11 -0
  147. package/src/layout/DialogService.ts +75 -0
  148. package/src/layout/DrawerService.ts +25 -0
  149. package/src/layout/Toast.ts +14 -0
  150. package/src/layout/index.ts +4 -0
  151. package/src/lib/Constants.ts +433 -0
  152. package/src/lib/Formatter.ts +68 -0
  153. package/src/lib/Util.ts +113 -0
  154. package/src/lib/index.ts +3 -0
  155. package/src/observables/AbstractSubject.ts +21 -0
  156. package/src/observables/BehaviorSubject.ts +58 -0
  157. package/src/observables/Observer.ts +3 -0
  158. package/src/observables/Subject.ts +9 -0
  159. package/src/observables/index.ts +4 -0
  160. package/src/process/Proccess.ts +21 -0
  161. package/src/process/ProcessManager.ts +31 -0
  162. package/src/process/index.ts +2 -0
  163. package/src/repository/Params.ts +10 -0
  164. package/src/repository/Repository.ts +44 -0
  165. package/src/repository/SyncDetail.ts +8 -0
  166. package/src/repository/index.ts +4 -0
  167. package/src/repository/model.ts +9 -0
  168. package/src/routeGuard/RouteGuard.ts +38 -0
  169. package/src/routeGuard/index.ts +1 -0
  170. package/src/search/client/ClientArraySearch.ts +25 -0
  171. package/src/search/client/ClientSearch.ts +3 -0
  172. package/src/search/index.ts +2 -0
  173. package/src/sort/SortDetail.ts +11 -0
  174. package/src/sort/client/Sorter.ts +28 -0
  175. package/src/sort/index.ts +4 -0
  176. package/src/sort/strategies/SimpleSort.ts +35 -0
  177. package/src/sort/strategies/SortStrategy.ts +4 -0
  178. package/src/types/Global.ts +1 -0
  179. package/src/types/index.ts +1 -0
  180. package/src/validators/Validator.ts +5 -0
  181. package/src/validators/index.ts +1 -0
  182. package/src/webSocket/Constants.ts +6 -0
  183. package/src/webSocket/Model.ts +16 -0
  184. package/src/webSocket/WebSocketService.ts +153 -0
  185. package/src/webSocket/index.ts +3 -0
  186. package/vite.config.ts +55 -0
  187. package/dist/src/baseForm/UseForm.d.ts +0 -5
  188. package/dist/src/composables/UseLoadingStatus.d.ts +0 -15
  189. package/dist/src/composables/UseRepository.d.ts +0 -63
  190. package/dist/src/composables/UseStaticTableService.d.ts +0 -4
  191. package/dist/src/layout/DialogService.d.ts +0 -1
  192. package/dist/src/layout/DrawerService.d.ts +0 -1
  193. package/dist/vite.config.d.ts +0 -2
  194. /package/dist/{src → core/src}/Utils.d.ts +0 -0
  195. /package/dist/{src → core/src}/accessHandling/AccessControl.d.ts +0 -0
  196. /package/dist/{src → core/src}/accessHandling/AccessLevel.d.ts +0 -0
  197. /package/dist/{src → core/src}/accessHandling/Accessible.d.ts +0 -0
  198. /package/dist/{src → core/src}/accessHandling/EveryDirectiveAccess.d.ts +0 -0
  199. /package/dist/{src → core/src}/accessHandling/SSO/AuthorizationDirective.d.ts +0 -0
  200. /package/dist/{src → core/src}/accessHandling/SSO/AuthorizationService.d.ts +0 -0
  201. /package/dist/{src → core/src}/accessHandling/SSO/EveryLevelAuthorizationDirective.d.ts +0 -0
  202. /package/dist/{src → core/src}/accessHandling/SSO/SomeLevelsAuthorizationDirective.d.ts +0 -0
  203. /package/dist/{src → core/src}/accessHandling/SomeDirectiveAccess.d.ts +0 -0
  204. /package/dist/{src → core/src}/accessHandling/index.d.ts +0 -0
  205. /package/dist/{src → core/src}/baseDirective/BeforeMountDirective.d.ts +0 -0
  206. /package/dist/{src → core/src}/baseDirective/BeforeUnMountDirective.d.ts +0 -0
  207. /package/dist/{src → core/src}/baseDirective/BeforeUpdateDirective.d.ts +0 -0
  208. /package/dist/{src → core/src}/baseDirective/CreatedDirective.d.ts +0 -0
  209. /package/dist/{src → core/src}/baseDirective/MountedDirective.d.ts +0 -0
  210. /package/dist/{src → core/src}/baseDirective/UnMountedDirective.d.ts +0 -0
  211. /package/dist/{src → core/src}/baseDirective/UpdateDirective.d.ts +0 -0
  212. /package/dist/{src → core/src}/baseDirective/index.d.ts +0 -0
  213. /package/dist/{src → core/src}/baseForm/BaseRequestBodyFilter.d.ts +0 -0
  214. /package/dist/{src → core/src}/baseForm/FormManager.d.ts +0 -0
  215. /package/dist/{src → core/src}/baseForm/InputControl.d.ts +0 -0
  216. /package/dist/{src → core/src}/baseForm/InputControlBuilder.d.ts +0 -0
  217. /package/dist/{src → core/src}/baseForm/InputControlData.d.ts +0 -0
  218. /package/dist/{src → core/src}/baseForm/RequestBodyFilter.d.ts +0 -0
  219. /package/dist/{src → core/src}/baseForm/TouchSensitiveForm.d.ts +0 -0
  220. /package/dist/{src → core/src}/baseForm/index.d.ts +0 -0
  221. /package/dist/{src → core/src}/baseSchedule/Schedule.d.ts +0 -0
  222. /package/dist/{src → core/src}/baseSchedule/Scheduler.d.ts +0 -0
  223. /package/dist/{src → core/src}/baseSchedule/index.d.ts +0 -0
  224. /package/dist/{src → core/src}/baseTable/OnDestory.d.ts +0 -0
  225. /package/dist/{src → core/src}/baseTable/RowActionSource.d.ts +0 -0
  226. /package/dist/{src → core/src}/baseTable/RowClick.d.ts +0 -0
  227. /package/dist/{src → core/src}/baseTable/RowDoubleClick.d.ts +0 -0
  228. /package/dist/{src → core/src}/baseTable/RowMetaClick.d.ts +0 -0
  229. /package/dist/{src → core/src}/baseTable/TableAction.d.ts +0 -0
  230. /package/dist/{src → core/src}/baseTable/TableHeaderSchema.d.ts +0 -0
  231. /package/dist/{src → core/src}/baseTable/TableLoader.d.ts +0 -0
  232. /package/dist/{src → core/src}/baseTable/TablePaginate.d.ts +0 -0
  233. /package/dist/{src → core/src}/baseTable/TableService.d.ts +0 -0
  234. /package/dist/{src → core/src}/baseTable/TableSort.d.ts +0 -0
  235. /package/dist/{src → core/src}/baseTable/TableSummarySchema.d.ts +0 -0
  236. /package/dist/{src → core/src}/baseTable/generator/TableCellComponentRegistry.d.ts +0 -0
  237. /package/dist/{src → core/src}/baseTable/generator/TableConfig.d.ts +0 -0
  238. /package/dist/{src → core/src}/baseTable/generator/TableGenerator.d.ts +0 -0
  239. /package/dist/{src → core/src}/baseTable/generator/TableSource.d.ts +0 -0
  240. /package/dist/{src → core/src}/baseTable/index.d.ts +0 -0
  241. /package/dist/{src → core/src}/baseTable/moduleConnection/Action.d.ts +0 -0
  242. /package/dist/{src → core/src}/baseTable/moduleConnection/Column.d.ts +0 -0
  243. /package/dist/{src → core/src}/baseTable/moduleConnection/TableDestroy.d.ts +0 -0
  244. /package/dist/{src → core/src}/baseTable/moduleConnection/TableRowClick.d.ts +0 -0
  245. /package/dist/{src → core/src}/baseTable/moduleConnection/generator/GTable.d.ts +0 -0
  246. /package/dist/{src → core/src}/composables/UseState.d.ts +0 -0
  247. /package/dist/{src → core/src}/composables/index.d.ts +0 -0
  248. /package/dist/{src → core/src}/constants/Constants.d.ts +0 -0
  249. /package/dist/{src → core/src}/constants/index.d.ts +0 -0
  250. /package/dist/{src → core/src}/crudService/index.d.ts +0 -0
  251. /package/dist/{src → core/src}/dateHandling/Constants.d.ts +0 -0
  252. /package/dist/{src → core/src}/dateHandling/JalaliDateSetup.d.ts +0 -0
  253. /package/dist/{src → core/src}/dateHandling/Model.d.ts +0 -0
  254. /package/dist/{src → core/src}/dateHandling/Utils.d.ts +0 -0
  255. /package/dist/{src → core/src}/dateHandling/index.d.ts +0 -0
  256. /package/dist/{src → core/src}/debounce/DebounceAction.d.ts +0 -0
  257. /package/dist/{src → core/src}/debounce/DebounceService.d.ts +0 -0
  258. /package/dist/{src → core/src}/debounce/index.d.ts +0 -0
  259. /package/dist/{src → core/src}/deviceManagement/Constants.d.ts +0 -0
  260. /package/dist/{src → core/src}/deviceManagement/Visibility.d.ts +0 -0
  261. /package/dist/{src → core/src}/deviceManagement/VisibilityManager.d.ts +0 -0
  262. /package/dist/{src → core/src}/deviceManagement/index.d.ts +0 -0
  263. /package/dist/{src → core/src}/errorHandling/ErrorHandler.d.ts +0 -0
  264. /package/dist/{src → core/src}/errorHandling/HandleError.d.ts +0 -0
  265. /package/dist/{src → core/src}/errorHandling/index.d.ts +0 -0
  266. /package/dist/{src → core/src}/eventSystem/CustomEventDispatcher.d.ts +0 -0
  267. /package/dist/{src → core/src}/eventSystem/Model.d.ts +0 -0
  268. /package/dist/{src → core/src}/eventSystem/OnEvent.d.ts +0 -0
  269. /package/dist/{src → core/src}/eventSystem/index.d.ts +0 -0
  270. /package/dist/{src → core/src}/feedbackHandling/FailureFeedback.d.ts +0 -0
  271. /package/dist/{src → core/src}/feedbackHandling/Feedback.d.ts +0 -0
  272. /package/dist/{src → core/src}/feedbackHandling/HandleFeedback.d.ts +0 -0
  273. /package/dist/{src → core/src}/feedbackHandling/InfoFeedback.d.ts +0 -0
  274. /package/dist/{src → core/src}/feedbackHandling/SuccessFeedback.d.ts +0 -0
  275. /package/dist/{src → core/src}/feedbackHandling/WarningFeedback.d.ts +0 -0
  276. /package/dist/{src → core/src}/feedbackHandling/index.d.ts +0 -0
  277. /package/dist/{src → core/src}/httpClient/ApiBuilder.d.ts +0 -0
  278. /package/dist/{src → core/src}/httpClient/HttpClient.d.ts +0 -0
  279. /package/dist/{src → core/src}/httpClient/Interceptor.d.ts +0 -0
  280. /package/dist/{src → core/src}/httpClient/index.d.ts +0 -0
  281. /package/dist/{src → core/src}/initializer/ApplicationInitializer.d.ts +0 -0
  282. /package/dist/{src → core/src}/initializer/Initializer.d.ts +0 -0
  283. /package/dist/{src → core/src}/initializer/index.d.ts +0 -0
  284. /package/dist/{src → core/src}/json/index.d.ts +0 -0
  285. /package/dist/{src → core/src}/layout/Constants.d.ts +0 -0
  286. /package/dist/{src → core/src}/layout/Toast.d.ts +0 -0
  287. /package/dist/{src → core/src}/layout/index.d.ts +0 -0
  288. /package/dist/{src → core/src}/lib/Constants.d.ts +0 -0
  289. /package/dist/{src → core/src}/lib/index.d.ts +0 -0
  290. /package/dist/{src → core/src}/observables/AbstractSubject.d.ts +0 -0
  291. /package/dist/{src → core/src}/observables/BehaviorSubject.d.ts +0 -0
  292. /package/dist/{src → core/src}/observables/Observer.d.ts +0 -0
  293. /package/dist/{src → core/src}/observables/Subject.d.ts +0 -0
  294. /package/dist/{src → core/src}/observables/index.d.ts +0 -0
  295. /package/dist/{src → core/src}/process/Proccess.d.ts +0 -0
  296. /package/dist/{src → core/src}/process/ProcessManager.d.ts +0 -0
  297. /package/dist/{src → core/src}/process/index.d.ts +0 -0
  298. /package/dist/{src → core/src}/repository/Params.d.ts +0 -0
  299. /package/dist/{src → core/src}/repository/Repository.d.ts +0 -0
  300. /package/dist/{src → core/src}/repository/SyncDetail.d.ts +0 -0
  301. /package/dist/{src → core/src}/repository/index.d.ts +0 -0
  302. /package/dist/{src → core/src}/repository/model.d.ts +0 -0
  303. /package/dist/{src → core/src}/routeGuard/RouteGuard.d.ts +0 -0
  304. /package/dist/{src → core/src}/routeGuard/index.d.ts +0 -0
  305. /package/dist/{src → core/src}/search/client/ClientArraySearch.d.ts +0 -0
  306. /package/dist/{src → core/src}/search/client/ClientSearch.d.ts +0 -0
  307. /package/dist/{src → core/src}/search/index.d.ts +0 -0
  308. /package/dist/{src → core/src}/sort/SortDetail.d.ts +0 -0
  309. /package/dist/{src → core/src}/sort/client/Sorter.d.ts +0 -0
  310. /package/dist/{src → core/src}/sort/index.d.ts +0 -0
  311. /package/dist/{src → core/src}/sort/strategies/SimpleSort.d.ts +0 -0
  312. /package/dist/{src → core/src}/sort/strategies/SortStrategy.d.ts +0 -0
  313. /package/dist/{src → core/src}/types/Global.d.ts +0 -0
  314. /package/dist/{src → core/src}/types/index.d.ts +0 -0
  315. /package/dist/{src → core/src}/validators/Validator.d.ts +0 -0
  316. /package/dist/{src → core/src}/validators/index.d.ts +0 -0
  317. /package/dist/{src → core/src}/webSocket/Constants.d.ts +0 -0
  318. /package/dist/{src → core/src}/webSocket/Model.d.ts +0 -0
  319. /package/dist/{src → core/src}/webSocket/WebSocketService.d.ts +0 -0
  320. /package/dist/{src → core/src}/webSocket/index.d.ts +0 -0
@@ -0,0 +1,21 @@
1
+ import type { Nullable } from '../types/Global'
2
+ import { ProcessManager } from './ProcessManager'
3
+
4
+ export abstract class Process {
5
+ public name: string;
6
+ public next: Nullable<Process> = null;
7
+
8
+ constructor(name: string, next: Nullable<Process>) {
9
+ this.name = name
10
+ this.next = next
11
+ }
12
+
13
+ public addToManager(manager: ProcessManager) {
14
+ manager.setProcessToMap(this)
15
+ if (this.next) {
16
+ this.next.addToManager(manager)
17
+ }
18
+ }
19
+
20
+ public abstract execute(): Promise<void>
21
+ }
@@ -0,0 +1,31 @@
1
+ import { Process } from './Proccess';
2
+
3
+ export class ProcessManager {
4
+ private mapProcesses = new Map<string, Process>()
5
+ private processes: Process
6
+
7
+ constructor(process: Process) {
8
+ this.processes = process
9
+ this.assignProcessManager()
10
+ }
11
+
12
+ private assignProcessManager() {
13
+ this.processes.addToManager(this)
14
+ }
15
+
16
+ public setProcessToMap(process: Process) {
17
+ this.mapProcesses.set(process.name, process)
18
+ }
19
+
20
+ public async start() {
21
+ await this.processes.execute()
22
+ }
23
+
24
+ public async startFrom(processName: string) {
25
+ const process = this.mapProcesses.get(processName)
26
+ if(!process) {
27
+ throw new Error(`Process ${processName} not found`)
28
+ }
29
+ await process.execute()
30
+ }
31
+ }
@@ -0,0 +1,2 @@
1
+ export { ProcessManager } from './ProcessManager.ts';
2
+ export { Process } from './Proccess'
@@ -0,0 +1,10 @@
1
+ import { SortDetail } from "../sort";
2
+ import { SortOrder } from "../constants";
3
+ import { BaseModel } from "../BaseModel";
4
+
5
+ export class Params {
6
+ pageNumber: number = 1;
7
+ itemCount: number = 20;
8
+ sortDetail: SortDetail<BaseModel> = new SortDetail("id", SortOrder.DESC);
9
+ filters: { key: string; value: unknown }[] = [];
10
+ }
@@ -0,0 +1,44 @@
1
+ import { BaseModel } from "../BaseModel";
2
+ import { FetchListResponse } from "./model";
3
+ import { type Nullable } from "../types";
4
+ import type { SyncDetail } from "./SyncDetail";
5
+
6
+ export interface Repository<Model extends BaseModel> {
7
+ /**
8
+ * Fetches a list of items based on optional query parameters.
9
+ * @param query - Optional query parameters.
10
+ * @returns A promise resolving to an array of items or undefined.
11
+ */
12
+ fetchList(query?: Record<string, unknown>): Promise<FetchListResponse<Model>>;
13
+
14
+ /**
15
+ * Fetches a single item by its ID.
16
+ * @param id - ID of the item to retrieve.
17
+ * @returns A promise resolving to the fetched item or undefined.
18
+ */
19
+ fetchItemById(id: number): Promise<Nullable<Model>>;
20
+
21
+ /**
22
+ * Creates a new item.
23
+ * @param body - Data for creating the item.
24
+ * @returns A promise resolving to the created item or undefined.
25
+ */
26
+ createItem<Body>(body: Body): Promise<Nullable<Model>>;
27
+
28
+ /**
29
+ * Updates an existing item by its ID.
30
+ * @param id - ID of the item to update.
31
+ * @param body - Updated data for the item.
32
+ * @returns A promise resolving to the updated item or undefined.
33
+ */
34
+ updateItem<Body>(id: number, body: Body): Promise<Nullable<Model>>;
35
+
36
+ /**
37
+ * Deletes an item by its ID.
38
+ * @param id - ID of the item to delete.
39
+ * @returns A promise resolving to a boolean indicating if the deletion was successful.
40
+ */
41
+ deleteItem(id: number): Promise<boolean>;
42
+
43
+ getSyncDetail(): SyncDetail;
44
+ }
@@ -0,0 +1,8 @@
1
+ export class SyncDetail {
2
+ public shouldKeepSync: boolean;
3
+ public intervalInMillisecond: number;
4
+ constructor(shouldKeepSync: boolean, intervalInMillisecond: number) {
5
+ this.shouldKeepSync = shouldKeepSync;
6
+ this.intervalInMillisecond = intervalInMillisecond;
7
+ }
8
+ }
@@ -0,0 +1,4 @@
1
+ export { Params } from "./Params";
2
+ export { type Repository } from "./Repository";
3
+ export { FetchListResponse } from './model'
4
+ export { SyncDetail } from './SyncDetail'
@@ -0,0 +1,9 @@
1
+ export class FetchListResponse<Model> {
2
+ public items: Model[]
3
+ public totalItems: number
4
+
5
+ constructor(items: Model[], totalItems: number) {
6
+ this.items = items
7
+ this.totalItems = totalItems
8
+ }
9
+ }
@@ -0,0 +1,38 @@
1
+ export abstract class RouteGuard {
2
+
3
+ protected constructor() {
4
+ this.checkAccessibility = this.checkAccessibility.bind(this);
5
+ this.isAccessible = this.isAccessible.bind(this);
6
+ this.getDestinationRouteName = this.getDestinationRouteName.bind(this);
7
+ }
8
+
9
+ public async checkAccessibility(to: unknown, from: unknown, next: CallableFunction) {
10
+ if (await this.isAccessible(to, from)) {
11
+ next();
12
+ return;
13
+ }
14
+
15
+ if (await this.getDestinationRouteName()) {
16
+ next({name: await this.getDestinationRouteName()})
17
+ return;
18
+ }
19
+
20
+ if (await this.getDestinationRouteLocation(to, from)) {
21
+ next(await this.getDestinationRouteLocation(to, from));
22
+ return;
23
+ }
24
+
25
+ next(false);
26
+ }
27
+
28
+ protected abstract isAccessible(to: unknown, from: unknown): Promise<boolean>
29
+
30
+ protected async getDestinationRouteName(): Promise<string> {
31
+ return ''
32
+ }
33
+
34
+ protected async getDestinationRouteLocation(to: unknown, from: unknown): Promise<unknown> {
35
+ return null
36
+ }
37
+
38
+ }
@@ -0,0 +1 @@
1
+ export { RouteGuard } from './RouteGuard'
@@ -0,0 +1,25 @@
1
+ import { ClientSearch } from "./ClientSearch";
2
+ import { Util } from "../../lib/Util";
3
+
4
+ export class ClientArraySearch<T> extends ClientSearch {
5
+ public search(
6
+ items: T[],
7
+ phrase: string,
8
+ column: (item: T) => (string | number)[],
9
+ ) {
10
+ const matchedItems: T[] = [];
11
+ item: for (const item of items) {
12
+ for (const value of column(item)) {
13
+ if (
14
+ Util.removeSpacesFromString(String(value).toLowerCase()).indexOf(
15
+ Util.removeSpacesFromString(String(phrase).toLowerCase()),
16
+ ) > -1
17
+ ) {
18
+ matchedItems.push(item);
19
+ continue item;
20
+ }
21
+ }
22
+ }
23
+ return matchedItems;
24
+ }
25
+ }
@@ -0,0 +1,3 @@
1
+ export abstract class ClientSearch {
2
+ abstract search(items: unknown, phrase: string, column: (item: unknown) => (string | number)[]): unknown
3
+ }
@@ -0,0 +1,2 @@
1
+ export { ClientSearch } from './client/ClientSearch'
2
+ export { ClientArraySearch } from './client/ClientArraySearch'
@@ -0,0 +1,11 @@
1
+ import { SortOrder } from "../constants";
2
+
3
+ export class SortDetail<T> {
4
+ public key: keyof T;
5
+ public order: SortOrder;
6
+
7
+ constructor(key: keyof T, order: SortOrder) {
8
+ this.key = key;
9
+ this.order = order;
10
+ }
11
+ }
@@ -0,0 +1,28 @@
1
+ import { SortOrder } from "../../constants/Constants";
2
+ import { SortStrategy } from "../strategies/SortStrategy";
3
+ import { SimpleSort } from "../strategies/SimpleSort";
4
+
5
+ export class Sorter {
6
+ public arrayOfObjectSort<T>(
7
+ items: T[],
8
+ by: keyof T,
9
+ order: SortOrder,
10
+ strategy: SortStrategy<T> = new SimpleSort(),
11
+ ): T[] {
12
+ if (order === SortOrder.ASC) {
13
+ return strategy.aSort(items, by);
14
+ }
15
+ return strategy.bSort(items, by);
16
+ }
17
+
18
+ public arraySort(
19
+ items: number[] | string[],
20
+ order: SortOrder,
21
+ strategy: SortStrategy<string | number> = new SimpleSort(),
22
+ ) {
23
+ if (order === SortOrder.ASC) {
24
+ return strategy.aSort(items);
25
+ }
26
+ return strategy.bSort(items);
27
+ }
28
+ }
@@ -0,0 +1,4 @@
1
+ export { SortDetail } from './SortDetail';
2
+ export * from './client/Sorter';
3
+ export * from './strategies/SortStrategy';
4
+ export * from './strategies/SimpleSort';
@@ -0,0 +1,35 @@
1
+ import { SortStrategy } from "./SortStrategy";
2
+
3
+ export class SimpleSort<T> implements SortStrategy<T> {
4
+ aSort(items: T[], by?: keyof T): T[] {
5
+ return items.sort((a: T, b: T) => {
6
+ const aItem = a[by as keyof T] ?? a;
7
+ const bItem = b[by as keyof T] ?? b;
8
+ if (typeof aItem === "string" && typeof bItem === "string") {
9
+ return aItem.localeCompare(bItem);
10
+ }
11
+
12
+ if (typeof aItem === "number" && typeof bItem === "number") {
13
+ return aItem - bItem;
14
+ }
15
+
16
+ throw new Error("Not supported data type");
17
+ });
18
+ }
19
+
20
+ bSort(items: T[], by?: keyof T): T[] {
21
+ return items.sort((a: T, b: T) => {
22
+ const aItem = a[by as keyof T] ?? a;
23
+ const bItem = b[by as keyof T] ?? b;
24
+ if (typeof aItem === "string" && typeof bItem === "string") {
25
+ return bItem.localeCompare(aItem);
26
+ }
27
+
28
+ if (typeof aItem === "number" && typeof bItem === "number") {
29
+ return bItem - aItem;
30
+ }
31
+
32
+ throw new Error("Not supported data type");
33
+ });
34
+ }
35
+ }
@@ -0,0 +1,4 @@
1
+ export interface SortStrategy<T> {
2
+ aSort(items: T[], by?: keyof T): T[];
3
+ bSort(items: T[], by?: keyof T): T[];
4
+ }
@@ -0,0 +1 @@
1
+ export type Nullable<T> = T | null;
@@ -0,0 +1 @@
1
+ export * from "./Global";
@@ -0,0 +1,5 @@
1
+ import { type Nullable } from "../types";
2
+
3
+ export interface Validator<T> {
4
+ validate(value: Nullable<T>): string | Promise<string>;
5
+ }
@@ -0,0 +1 @@
1
+ export { type Validator } from "./Validator";
@@ -0,0 +1,6 @@
1
+ export const enum WebSocketEvents {
2
+ CLOSE = "wsClose",
3
+ OPEN = "wsOpen",
4
+ ERROR = "wsError",
5
+ TIMEOUT = "wsTimeout",
6
+ }
@@ -0,0 +1,16 @@
1
+ export class WebSocketPostMessage<T> {
2
+ private type: string;
3
+ private data: T;
4
+
5
+ constructor(type: string, data: T) {
6
+ this.type = type;
7
+ this.data = data;
8
+ }
9
+
10
+ public getPayload() {
11
+ return JSON.stringify({
12
+ type: this.type,
13
+ data: this.data,
14
+ });
15
+ }
16
+ }
@@ -0,0 +1,153 @@
1
+ import { Nullable } from "../types";
2
+ import { CustomEventDispatcher } from "../eventSystem/CustomEventDispatcher";
3
+ import { WebSocketEvents } from "./Constants";
4
+ import { WebSocketEvent } from "../eventSystem";
5
+ import { WebSocketPostMessage } from "./Model";
6
+
7
+ export class WebSocketService {
8
+ private webSocket: Nullable<WebSocket> = null;
9
+ private retry: number = 3;
10
+ private url: string = "";
11
+ private protocols: string[] = [];
12
+ private delayTimeInMillieSeconds: number = 500;
13
+ private baseUrl: string = "";
14
+ private intervalId: Nullable<ReturnType<typeof setInterval>> = null;
15
+
16
+ constructor(
17
+ private readonly customEventDispatcher: CustomEventDispatcher,
18
+ baseUrl: string,
19
+ ) {
20
+ this.onOpen = this.onOpen.bind(this);
21
+ this.onMessage = this.onMessage.bind(this);
22
+ this.onError = this.onError.bind(this);
23
+ this.onClose = this.onClose.bind(this);
24
+ this.checkHealth = this.checkHealth.bind(this);
25
+ this.sendPing = this.sendPing.bind(this);
26
+ this.reconnect = this.reconnect.bind(this);
27
+ this.fakeWait = this.fakeWait.bind(this);
28
+ this.isClosing = this.isClosing.bind(this);
29
+ this.isClosed = this.isClosed.bind(this);
30
+ this.connect = this.connect.bind(this);
31
+ this.registerPingPontInterval = this.registerPingPontInterval.bind(this);
32
+ this.closeConnection = this.closeConnection.bind(this);
33
+ this.isConnectionOpen = this.isConnectionOpen.bind(this);
34
+ this.isConnecting = this.isConnecting.bind(this);
35
+ this.send = this.send.bind(this);
36
+ this.setBaseUrl = this.setBaseUrl.bind(this);
37
+ this.setBaseUrl(baseUrl);
38
+ }
39
+
40
+ public connect(url: string, protocols: string[] = [], retry: number = 3) {
41
+ if (this.webSocket) {
42
+ this.webSocket.removeEventListener("open", this.onOpen);
43
+ this.webSocket.removeEventListener("close", this.onClose);
44
+ this.webSocket.removeEventListener("error", this.onError);
45
+ }
46
+
47
+ this.webSocket = new WebSocket(this.baseUrl + url, protocols);
48
+ this.retry = retry;
49
+ this.url = url;
50
+ this.protocols = protocols;
51
+
52
+ this.webSocket.addEventListener("error", this.onError);
53
+ this.webSocket.addEventListener("close", this.onClose);
54
+ this.webSocket.addEventListener("open", this.onOpen);
55
+ this.checkHealth();
56
+ }
57
+
58
+ private async checkHealth() {
59
+ try {
60
+ await this.fakeWait(this.delayTimeInMillieSeconds);
61
+ if (!this.isClosed() && !this.isClosing() && !this.isConnectionOpen()) {
62
+ this.sendPing();
63
+ }
64
+ } catch (_error) {
65
+ this.reconnect();
66
+ }
67
+ }
68
+
69
+ private sendPing() {
70
+ this.webSocket!.send("PING");
71
+ }
72
+
73
+ private reconnect() {
74
+ if (this.retry === 0) {
75
+ this.customEventDispatcher.dispatchOnWindow(WebSocketEvents.TIMEOUT);
76
+ }
77
+ if (this.retry > 0) {
78
+ this.delayTimeInMillieSeconds = this.delayTimeInMillieSeconds * 2;
79
+ this.connect(this.url, this.protocols, --this.retry);
80
+ }
81
+ }
82
+
83
+ private fakeWait(timeInMilleSeconds: number) {
84
+ return new Promise((resolve) => {
85
+ setTimeout(() => {
86
+ resolve(null);
87
+ }, timeInMilleSeconds);
88
+ });
89
+ }
90
+
91
+ private onError() {
92
+ this.customEventDispatcher.dispatchOnWindow(WebSocketEvents.ERROR);
93
+ this.closeConnection();
94
+ }
95
+
96
+ private onOpen() {
97
+ this.webSocket!.addEventListener("message", this.onMessage);
98
+ this.customEventDispatcher.dispatchOnWindow(WebSocketEvents.OPEN);
99
+ this.registerPingPontInterval();
100
+ }
101
+
102
+ private registerPingPontInterval() {
103
+ this.intervalId = setInterval(() => {
104
+ this.sendPing();
105
+ }, 10_000);
106
+ }
107
+
108
+ private onMessage(message: MessageEvent) {
109
+ const webSocketEvent = new WebSocketEvent<unknown>(message);
110
+ this.customEventDispatcher.dispatchWebSocketOnWindow(webSocketEvent);
111
+ }
112
+
113
+ private onClose() {
114
+ this.customEventDispatcher.dispatchOnWindow(WebSocketEvents.CLOSE);
115
+ if (this.intervalId) {
116
+ clearInterval(this.intervalId);
117
+ }
118
+ }
119
+
120
+ public closeConnection() {
121
+ if (!this.webSocket) {
122
+ console.warn("No connection to close");
123
+ return;
124
+ }
125
+
126
+ this.webSocket.close();
127
+ }
128
+
129
+ public isConnectionOpen() {
130
+ return this.webSocket?.readyState === 1;
131
+ }
132
+
133
+ public isConnecting() {
134
+ return this.webSocket?.readyState === 0;
135
+ }
136
+
137
+ public isClosing() {
138
+ return this.webSocket?.readyState === 2;
139
+ }
140
+
141
+ public isClosed() {
142
+ return this.webSocket?.readyState === 3;
143
+ }
144
+
145
+ public send(data: WebSocketPostMessage<unknown>) {
146
+ if (!this.webSocket) throw new Error("NO webSocket to send data");
147
+ this.webSocket.send(data.getPayload());
148
+ }
149
+
150
+ private setBaseUrl(baseUrl: string) {
151
+ this.baseUrl = baseUrl;
152
+ }
153
+ }
@@ -0,0 +1,3 @@
1
+ export { WebSocketPostMessage } from "./Model";
2
+ export { WebSocketService } from "./WebSocketService";
3
+ export { WebSocketEvents } from "./Constants";
package/vite.config.ts ADDED
@@ -0,0 +1,55 @@
1
+ import { dirname, resolve } from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ import { defineConfig } from "vite";
4
+ import dts from "vite-plugin-dts";
5
+ import * as path from "node:path";
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+
9
+ export default defineConfig({
10
+ plugins: [dts({ insertTypesEntry: true })],
11
+ resolve: {
12
+ alias: {
13
+ "@": path.resolve(__dirname, "packages/core/src"),
14
+ },
15
+ },
16
+ build: {
17
+ lib: {
18
+ entry: resolve(__dirname, "index.ts"),
19
+ name: "IronCore",
20
+ // the proper extensions will be added
21
+ fileName: "IronCore",
22
+ },
23
+ rollupOptions: {
24
+ // make sure to externalize deps that shouldn't be bundled
25
+ // into your library
26
+ external: [
27
+ "vue",
28
+ "json2typescript",
29
+ "axios",
30
+ "dayjs",
31
+ "jalaliday",
32
+ "pinia",
33
+ ],
34
+ output: {
35
+ // Provide global variables to use in the UMD build
36
+ // for externalized deps
37
+ globals: {
38
+ vue: "Vue",
39
+ json2typescript: "json2typescript",
40
+ axios: "axios",
41
+ dayjs: "dayjs",
42
+ jalaliday: "jalaliday",
43
+ pinia: "pinia",
44
+ "jalali-plugin-dayjs": "jalali-plugin-dayjs",
45
+ },
46
+ },
47
+ },
48
+ terserOptions: {
49
+ compress: {
50
+ dead_code: false,
51
+ conditionals: false,
52
+ },
53
+ },
54
+ },
55
+ });
@@ -1,5 +0,0 @@
1
- import { FormManager } from './FormManager';
2
- export declare function useForm(form: FormManager, hasCustomValidation?: boolean): {
3
- reactiveForm: any;
4
- validationStatus: any;
5
- };
@@ -1,15 +0,0 @@
1
- import { LoadingStatus } from '../constants';
2
- export declare function useLoadingStatus(): {
3
- loadingStatus: any;
4
- isFetchingList: any;
5
- isFetchingItem: any;
6
- isFetchingLastItems: any;
7
- isFetchingPreviousItems: any;
8
- isCreating: any;
9
- isUpdating: any;
10
- isDeleting: any;
11
- isSearching: any;
12
- isSorting: any;
13
- setStatus: (status: LoadingStatus) => void;
14
- removeStatus: (status: LoadingStatus) => void;
15
- };
@@ -1,63 +0,0 @@
1
- import { computed } from 'vue';
2
- import { Repository } from '../repository';
3
- import { LoadingStatus } from '../constants';
4
- import { SortDetail } from '../sort';
5
- import { BaseModel } from '../BaseModel';
6
- export declare function useRepository<Model extends BaseModel>(repository: Repository<Model>): {
7
- loadingStatusManager: {
8
- loadingStatus: any;
9
- isFetchingList: any;
10
- isFetchingItem: any;
11
- isFetchingLastItems: any;
12
- isFetchingPreviousItems: any;
13
- isCreating: any;
14
- isUpdating: any;
15
- isDeleting: any;
16
- isSearching: any;
17
- isSorting: any;
18
- setStatus: (status: LoadingStatus) => void;
19
- removeStatus: (status: LoadingStatus) => void;
20
- };
21
- dataManger: {
22
- itemsAsArray: any;
23
- totalCount: any;
24
- currentItem: any;
25
- setTotalCount: (totalItems: number) => void;
26
- addOrReplaceItems: (itemsToAdd: BaseModel[]) => void;
27
- getById: (id: number) => computed<BaseModel>;
28
- removeById: (id: number) => boolean;
29
- clearItems: () => void;
30
- setCurrentItem: (item: computed<BaseModel>) => void;
31
- clearCurrentItem: () => void;
32
- };
33
- paramsManager: {
34
- params: Ref<Params>;
35
- setNextPage: () => void;
36
- setPreventPage: () => void;
37
- setPageNumber: (pageNumber: number) => void;
38
- setItemCount: (itemCount: number) => void;
39
- setSortDetail: (sortDetail: SortDetail<BaseModel>) => void;
40
- setFilter: (key: string, value: unknown) => void;
41
- removeFilter: (key: string) => void;
42
- getRequestParams: () => Record<string, unknown>;
43
- clearParam: () => void;
44
- setFiltersBaseOnRequestBody: (filters: Record<string, unknown>) => void;
45
- };
46
- tableRenderingData: any;
47
- fetchList: (loadingStatus?: LoadingStatus) => Promise<any>;
48
- fetchWithAutoRefresh: () => Promise<void>;
49
- setupAutoRefresh: () => void;
50
- stopAutoRefresh: () => void;
51
- fetchItemById: (id: number, shouldRemoveItem?: boolean) => Promise<any>;
52
- createItem: <Body>(body: Body) => Promise<any>;
53
- updateItem: <Body>(id: number, body: Body) => Promise<any>;
54
- deleteItem: (id: number) => Promise<boolean>;
55
- fetchLastItems: () => Promise<any>;
56
- fetchPreviousItems: () => Promise<any>;
57
- fetchItemsByPageNumber: (pageNumber: number) => Promise<any>;
58
- search: (searchedValue: string) => Promise<any>;
59
- sort: (sortDetail: SortDetail<Model>) => Promise<any>;
60
- clearFilters: () => Promise<any>;
61
- tableService: any;
62
- currentPageItems: any;
63
- };
@@ -1,4 +0,0 @@
1
- export declare function useStaticTableService<Model>(initialRows: Model[]): {
2
- tableRows: any;
3
- staticTableService: any;
4
- };
@@ -1 +0,0 @@
1
- export declare const useDialogService: any;
@@ -1 +0,0 @@
1
- export declare const useDrawerService: any;
@@ -1,2 +0,0 @@
1
- declare const _default: any;
2
- export default _default;
File without changes