@zajno/common 1.6.3 → 2.0.0-beta.2

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 (433) hide show
  1. package/.eslintrc.js +1 -1
  2. package/README.md +6 -1
  3. package/coverage/clover.xml +344 -1066
  4. package/coverage/coverage-final.json +31 -45
  5. package/coverage/lcov-report/__tests__/helpers/expect.ts.html +1 -1
  6. package/coverage/lcov-report/__tests__/helpers/index.html +1 -1
  7. package/coverage/lcov-report/__tests__/helpers/main.ts.html +1 -1
  8. package/coverage/lcov-report/async/arrays.ts.html +1 -1
  9. package/coverage/lcov-report/async/index.html +36 -21
  10. package/coverage/lcov-report/async/timeout.ts.html +59 -59
  11. package/coverage/lcov-report/dates/calc.ts.html +1 -1
  12. package/coverage/lcov-report/dates/convert.ts.html +1 -1
  13. package/coverage/lcov-report/dates/datex.ts.html +1 -1
  14. package/coverage/lcov-report/dates/format.ts.html +1 -1
  15. package/coverage/lcov-report/dates/index.html +1 -1
  16. package/coverage/lcov-report/dates/index.ts.html +1 -1
  17. package/coverage/lcov-report/dates/parse.ts.html +1 -1
  18. package/coverage/lcov-report/dates/period.ts.html +1 -1
  19. package/coverage/lcov-report/dates/shift.ts.html +1 -1
  20. package/coverage/lcov-report/dates/types.ts.html +1 -1
  21. package/coverage/lcov-report/dates/yearDate.ts.html +1 -1
  22. package/coverage/lcov-report/fields/index.html +1 -1
  23. package/coverage/lcov-report/fields/update.ts.html +1 -1
  24. package/coverage/lcov-report/functions/index.html +17 -17
  25. package/coverage/lcov-report/functions/safeCall.ts.html +13 -13
  26. package/coverage/lcov-report/index.html +119 -74
  27. package/coverage/lcov-report/lazy/index.html +1 -1
  28. package/coverage/lcov-report/lazy/promise.ts.html +1 -1
  29. package/coverage/lcov-report/lazy/singleton.ts.html +1 -1
  30. package/coverage/lcov-report/logger/batch.ts.html +1 -1
  31. package/coverage/lcov-report/logger/console.ts.html +1 -1
  32. package/coverage/lcov-report/logger/index.html +1 -1
  33. package/coverage/lcov-report/logger/index.ts.html +1 -1
  34. package/coverage/lcov-report/logger/named.ts.html +1 -1
  35. package/coverage/lcov-report/logger/proxy.ts.html +1 -1
  36. package/coverage/lcov-report/math/arrays.ts.html +1 -1
  37. package/coverage/lcov-report/math/calc.ts.html +1 -1
  38. package/coverage/lcov-report/math/distribution.ts.html +1 -1
  39. package/coverage/lcov-report/math/index.html +1 -1
  40. package/coverage/lcov-report/math/index.ts.html +1 -1
  41. package/coverage/lcov-report/observing/event.ts.html +1 -1
  42. package/coverage/lcov-report/observing/index.html +1 -1
  43. package/coverage/lcov-report/structures/helpers/enum.ts.html +1 -1
  44. package/coverage/lcov-report/structures/helpers/index.html +1 -1
  45. package/coverage/lcov-report/structures/index.html +1 -1
  46. package/coverage/lcov-report/structures/queue/index.html +24 -9
  47. package/coverage/lcov-report/structures/queue/parallel.ts.html +1 -1
  48. package/coverage/lcov-report/structures/queue/tasks.ts.html +358 -0
  49. package/coverage/lcov-report/structures/tempoCache.ts.html +1 -1
  50. package/coverage/lcov-report/types/comparator.ts.html +1 -1
  51. package/coverage/lcov-report/types/getter.ts.html +1 -1
  52. package/coverage/lcov-report/types/index.html +1 -1
  53. package/coverage/lcov-report/types/index.ts.html +1 -1
  54. package/coverage/lcov-report/validation/ValidationErrors.ts.html +1 -1
  55. package/coverage/lcov-report/validation/creditCard.ts.html +1 -1
  56. package/coverage/lcov-report/validation/helpers.ts.html +1 -1
  57. package/coverage/lcov-report/validation/index.html +1 -1
  58. package/coverage/lcov-report/validation/index.ts.html +1 -1
  59. package/coverage/lcov-report/validation/types.ts.html +1 -1
  60. package/coverage/lcov-report/validation/validators.ts.html +1 -1
  61. package/coverage/lcov-report/validation/wrappers.ts.html +1 -1
  62. package/coverage/lcov.info +863 -2381
  63. package/lib/fields/update.js +3 -3
  64. package/lib/fields/update.js.map +1 -1
  65. package/lib/{assert.d.ts → functions/assert.d.ts} +1 -1
  66. package/lib/functions/assert.d.ts.map +1 -0
  67. package/lib/{assert.js → functions/assert.js} +2 -2
  68. package/lib/functions/assert.js.map +1 -0
  69. package/lib/{disposer.d.ts → functions/disposer.d.ts} +0 -0
  70. package/lib/functions/disposer.d.ts.map +1 -0
  71. package/lib/{disposer.js → functions/disposer.js} +1 -1
  72. package/lib/functions/disposer.js.map +1 -0
  73. package/lib/functions/safeCall.d.ts +2 -0
  74. package/lib/functions/safeCall.d.ts.map +1 -0
  75. package/lib/{functions.js → functions/safeCall.js} +1 -1
  76. package/lib/functions/safeCall.js.map +1 -0
  77. package/lib/{throttle.d.ts → functions/throttle.d.ts} +0 -0
  78. package/lib/functions/throttle.d.ts.map +1 -0
  79. package/lib/{throttle.js → functions/throttle.js} +1 -1
  80. package/lib/functions/throttle.js.map +1 -0
  81. package/lib/lazy/light.d.ts +1 -1
  82. package/lib/lazy/light.d.ts.map +1 -1
  83. package/lib/lazy/promise.d.ts +1 -1
  84. package/lib/lazy/promise.d.ts.map +1 -1
  85. package/lib/lazy/singleton.d.ts +1 -1
  86. package/lib/lazy/singleton.d.ts.map +1 -1
  87. package/lib/math/arrays.d.ts +1 -0
  88. package/lib/math/arrays.d.ts.map +1 -1
  89. package/lib/math/arrays.js +13 -1
  90. package/lib/math/arrays.js.map +1 -1
  91. package/lib/{event.d.ts → observing/event.d.ts} +2 -3
  92. package/lib/observing/event.d.ts.map +1 -0
  93. package/lib/{event.js → observing/event.js} +2 -3
  94. package/lib/{event.js.map → observing/event.js.map} +1 -1
  95. package/lib/{throttledEvent.d.ts → observing/throttledEvent.d.ts} +0 -0
  96. package/lib/observing/throttledEvent.d.ts.map +1 -0
  97. package/lib/{throttledEvent.js → observing/throttledEvent.js} +1 -1
  98. package/lib/observing/throttledEvent.js.map +1 -0
  99. package/lib/{timer.d.ts → observing/timer.d.ts} +1 -1
  100. package/lib/observing/timer.d.ts.map +1 -0
  101. package/lib/{timer.js → observing/timer.js} +0 -0
  102. package/lib/observing/timer.js.map +1 -0
  103. package/lib/{abstractions/services/storage.d.ts → storage/abstractions.d.ts} +3 -2
  104. package/lib/storage/abstractions.d.ts.map +1 -0
  105. package/lib/{services/localization → storage}/abstractions.js +0 -0
  106. package/lib/storage/abstractions.js.map +1 -0
  107. package/lib/storage/asyncWrapper.d.ts +10 -0
  108. package/lib/storage/asyncWrapper.d.ts.map +1 -0
  109. package/lib/storage/asyncWrapper.js +24 -0
  110. package/lib/storage/asyncWrapper.js.map +1 -0
  111. package/lib/storage/index.d.ts +2 -0
  112. package/lib/storage/index.d.ts.map +1 -0
  113. package/lib/storage/index.js +5 -0
  114. package/lib/storage/index.js.map +1 -0
  115. package/lib/{services/storage/index.d.ts → storage/keyStorage.d.ts} +2 -10
  116. package/lib/storage/keyStorage.d.ts.map +1 -0
  117. package/lib/{services/storage/index.js → storage/keyStorage.js} +2 -22
  118. package/lib/storage/keyStorage.js.map +1 -0
  119. package/lib/{enumHelper.d.ts → structures/helpers/enum.d.ts} +1 -1
  120. package/lib/structures/helpers/enum.d.ts.map +1 -0
  121. package/lib/{enumHelper.js → structures/helpers/enum.js} +1 -1
  122. package/lib/structures/helpers/enum.js.map +1 -0
  123. package/lib/{nameHelper.d.ts → structures/helpers/name.d.ts} +5 -5
  124. package/lib/structures/helpers/name.d.ts.map +1 -0
  125. package/lib/{nameHelper.js → structures/helpers/name.js} +7 -6
  126. package/lib/structures/helpers/name.js.map +1 -0
  127. package/lib/structures/linkedList.d.ts +39 -0
  128. package/lib/structures/linkedList.d.ts.map +1 -0
  129. package/lib/structures/linkedList.js +82 -0
  130. package/lib/structures/linkedList.js.map +1 -0
  131. package/lib/{pool.d.ts → structures/pool.d.ts} +1 -1
  132. package/lib/structures/pool.d.ts.map +1 -0
  133. package/lib/{pool.js → structures/pool.js} +2 -2
  134. package/lib/structures/pool.js.map +1 -0
  135. package/lib/{queue → structures/queue}/parallel.d.ts +3 -3
  136. package/lib/structures/queue/parallel.d.ts.map +1 -0
  137. package/lib/{queue → structures/queue}/parallel.js +2 -2
  138. package/lib/structures/queue/parallel.js.map +1 -0
  139. package/lib/{queue → structures/queue}/tasks.d.ts +1 -1
  140. package/lib/structures/queue/tasks.d.ts.map +1 -0
  141. package/lib/{queue → structures/queue}/tasks.js +0 -0
  142. package/lib/structures/queue/tasks.js.map +1 -0
  143. package/lib/{tempoCache.d.ts → structures/tempoCache.d.ts} +0 -0
  144. package/lib/structures/tempoCache.d.ts.map +1 -0
  145. package/lib/{tempoCache.js → structures/tempoCache.js} +0 -0
  146. package/lib/structures/tempoCache.js.map +1 -0
  147. package/lib/types/comparator.d.ts +5 -0
  148. package/lib/types/comparator.d.ts.map +1 -0
  149. package/lib/types/comparator.js +8 -0
  150. package/lib/types/comparator.js.map +1 -0
  151. package/lib/types/deep.d.ts +9 -0
  152. package/lib/types/deep.d.ts.map +1 -0
  153. package/lib/{viewModels/types.js → types/deep.js} +1 -1
  154. package/lib/types/deep.js.map +1 -0
  155. package/lib/types/functions.d.ts +7 -0
  156. package/lib/types/functions.d.ts.map +1 -0
  157. package/lib/{abstractions/services/storage.js → types/functions.js} +1 -1
  158. package/lib/types/functions.js.map +1 -0
  159. package/lib/types/getter.d.ts +5 -0
  160. package/lib/types/getter.d.ts.map +1 -0
  161. package/lib/{types.js → types/getter.js} +2 -6
  162. package/lib/types/getter.js.map +1 -0
  163. package/lib/{ident.d.ts → types/ident.d.ts} +0 -0
  164. package/lib/types/ident.d.ts.map +1 -0
  165. package/lib/{ident.js → types/ident.js} +0 -0
  166. package/lib/types/ident.js.map +1 -0
  167. package/lib/types/index.d.ts +8 -0
  168. package/lib/types/index.d.ts.map +1 -0
  169. package/lib/types/index.js +7 -0
  170. package/lib/types/index.js.map +1 -0
  171. package/lib/validation/ValidationErrors.d.ts +1 -1
  172. package/lib/validation/ValidationErrors.d.ts.map +1 -1
  173. package/lib/validation/ValidationErrors.js +2 -2
  174. package/lib/validation/ValidationErrors.js.map +1 -1
  175. package/lib/{emails.d.ts → validation/emails.d.ts} +0 -0
  176. package/lib/validation/emails.d.ts.map +1 -0
  177. package/lib/{emails.js → validation/emails.js} +0 -0
  178. package/lib/validation/emails.js.map +1 -0
  179. package/package.json +16 -16
  180. package/src/async/__tests__/timeout.test.ts +1 -1
  181. package/src/fields/update.ts +1 -1
  182. package/src/{assert.ts → functions/assert.ts} +2 -2
  183. package/src/{disposer.ts → functions/disposer.ts} +1 -1
  184. package/src/functions/safeCall.ts +6 -0
  185. package/src/{throttle.ts → functions/throttle.ts} +1 -1
  186. package/src/lazy/__tests__/lazy.test.ts +1 -48
  187. package/src/lazy/light.ts +1 -1
  188. package/src/lazy/promise.ts +1 -1
  189. package/src/lazy/singleton.ts +1 -1
  190. package/src/math/arrays.ts +13 -0
  191. package/src/{event.ts → observing/event.ts} +3 -4
  192. package/src/{throttledEvent.ts → observing/throttledEvent.ts} +1 -1
  193. package/src/{timer.ts → observing/timer.ts} +1 -1
  194. package/src/{abstractions/services/storage.ts → storage/abstractions.ts} +3 -1
  195. package/src/storage/asyncWrapper.ts +24 -0
  196. package/src/storage/index.ts +2 -0
  197. package/src/{services/storage/index.ts → storage/keyStorage.ts} +1 -24
  198. package/src/{__tests__ → structures/__tests__}/enumHelper.test.ts +1 -1
  199. package/src/{__tests__ → structures/__tests__}/tempoCache.test.ts +1 -1
  200. package/src/{enumHelper.ts → structures/helpers/enum.ts} +0 -0
  201. package/src/{nameHelper.ts → structures/helpers/name.ts} +4 -4
  202. package/src/structures/linkedList.ts +129 -0
  203. package/src/{pool.ts → structures/pool.ts} +2 -2
  204. package/src/{queue → structures/queue}/__tests__/parallel.test.ts +2 -2
  205. package/src/{queue → structures/queue}/__tests__/tasks.test.ts +2 -2
  206. package/src/{queue → structures/queue}/parallel.ts +2 -2
  207. package/src/{queue → structures/queue}/tasks.ts +1 -1
  208. package/src/{tempoCache.ts → structures/tempoCache.ts} +0 -0
  209. package/src/types/comparator.ts +6 -0
  210. package/src/types/deep.ts +18 -0
  211. package/src/types/functions.ts +8 -0
  212. package/src/types/getter.ts +14 -0
  213. package/src/{ident.ts → types/ident.ts} +0 -0
  214. package/src/types/index.ts +9 -0
  215. package/src/validation/ValidationErrors.ts +1 -1
  216. package/src/{emails.ts → validation/emails.ts} +0 -0
  217. package/tsconfig.build.json +10 -0
  218. package/tsconfig.json +0 -1
  219. package/yarn.lock +467 -370
  220. package/lib/abstractions/services/storage.d.ts.map +0 -1
  221. package/lib/abstractions/services/storage.js.map +0 -1
  222. package/lib/assert.d.ts.map +0 -1
  223. package/lib/assert.js.map +0 -1
  224. package/lib/cache.d.ts +0 -36
  225. package/lib/cache.d.ts.map +0 -1
  226. package/lib/cache.js +0 -165
  227. package/lib/cache.js.map +0 -1
  228. package/lib/deepPartial.d.ts +0 -4
  229. package/lib/deepPartial.d.ts.map +0 -1
  230. package/lib/deepPartial.js +0 -3
  231. package/lib/deepPartial.js.map +0 -1
  232. package/lib/disposer.d.ts.map +0 -1
  233. package/lib/disposer.js.map +0 -1
  234. package/lib/emails.d.ts.map +0 -1
  235. package/lib/emails.js.map +0 -1
  236. package/lib/enumHelper.d.ts.map +0 -1
  237. package/lib/enumHelper.js.map +0 -1
  238. package/lib/event.d.ts.map +0 -1
  239. package/lib/functions.d.ts +0 -9
  240. package/lib/functions.d.ts.map +0 -1
  241. package/lib/functions.js.map +0 -1
  242. package/lib/ident.d.ts.map +0 -1
  243. package/lib/ident.js.map +0 -1
  244. package/lib/lazy/index.d.ts +0 -10
  245. package/lib/lazy/index.d.ts.map +0 -1
  246. package/lib/lazy/index.js +0 -23
  247. package/lib/lazy/index.js.map +0 -1
  248. package/lib/lazy/observable.d.ts +0 -9
  249. package/lib/lazy/observable.d.ts.map +0 -1
  250. package/lib/lazy/observable.js +0 -31
  251. package/lib/lazy/observable.js.map +0 -1
  252. package/lib/lazy.light.d.ts +0 -2
  253. package/lib/lazy.light.d.ts.map +0 -1
  254. package/lib/lazy.light.js +0 -8
  255. package/lib/lazy.light.js.map +0 -1
  256. package/lib/nameHelper.d.ts.map +0 -1
  257. package/lib/nameHelper.js.map +0 -1
  258. package/lib/observersMap.d.ts +0 -22
  259. package/lib/observersMap.d.ts.map +0 -1
  260. package/lib/observersMap.js +0 -93
  261. package/lib/observersMap.js.map +0 -1
  262. package/lib/observingCache.d.ts +0 -32
  263. package/lib/observingCache.d.ts.map +0 -1
  264. package/lib/observingCache.js +0 -128
  265. package/lib/observingCache.js.map +0 -1
  266. package/lib/pool.d.ts.map +0 -1
  267. package/lib/pool.js.map +0 -1
  268. package/lib/queue/parallel.d.ts.map +0 -1
  269. package/lib/queue/parallel.js.map +0 -1
  270. package/lib/queue/tasks.d.ts.map +0 -1
  271. package/lib/queue/tasks.js.map +0 -1
  272. package/lib/services/localization/LocalaziedValidationErrors.d.ts +0 -9
  273. package/lib/services/localization/LocalaziedValidationErrors.d.ts.map +0 -1
  274. package/lib/services/localization/LocalaziedValidationErrors.js +0 -27
  275. package/lib/services/localization/LocalaziedValidationErrors.js.map +0 -1
  276. package/lib/services/localization/LocalizationManager.d.ts +0 -18
  277. package/lib/services/localization/LocalizationManager.d.ts.map +0 -1
  278. package/lib/services/localization/LocalizationManager.js +0 -58
  279. package/lib/services/localization/LocalizationManager.js.map +0 -1
  280. package/lib/services/localization/abstractions.d.ts +0 -12
  281. package/lib/services/localization/abstractions.d.ts.map +0 -1
  282. package/lib/services/localization/abstractions.js.map +0 -1
  283. package/lib/services/localization/defaultShape.d.ts +0 -26
  284. package/lib/services/localization/defaultShape.d.ts.map +0 -1
  285. package/lib/services/localization/defaultShape.js +0 -28
  286. package/lib/services/localization/defaultShape.js.map +0 -1
  287. package/lib/services/localization/index.d.ts +0 -5
  288. package/lib/services/localization/index.d.ts.map +0 -1
  289. package/lib/services/localization/index.js +0 -10
  290. package/lib/services/localization/index.js.map +0 -1
  291. package/lib/services/storage/index.d.ts.map +0 -1
  292. package/lib/services/storage/index.js.map +0 -1
  293. package/lib/services/storage/web/localStorage.d.ts +0 -13
  294. package/lib/services/storage/web/localStorage.d.ts.map +0 -1
  295. package/lib/services/storage/web/localStorage.js +0 -29
  296. package/lib/services/storage/web/localStorage.js.map +0 -1
  297. package/lib/services/storage/web/sessionStorage.d.ts +0 -13
  298. package/lib/services/storage/web/sessionStorage.d.ts.map +0 -1
  299. package/lib/services/storage/web/sessionStorage.js +0 -29
  300. package/lib/services/storage/web/sessionStorage.js.map +0 -1
  301. package/lib/services/storage/web/webStorage.d.ts +0 -9
  302. package/lib/services/storage/web/webStorage.d.ts.map +0 -1
  303. package/lib/services/storage/web/webStorage.js +0 -24
  304. package/lib/services/storage/web/webStorage.js.map +0 -1
  305. package/lib/tempoCache.d.ts.map +0 -1
  306. package/lib/tempoCache.js.map +0 -1
  307. package/lib/throttle.d.ts.map +0 -1
  308. package/lib/throttle.js.map +0 -1
  309. package/lib/throttledEvent.d.ts.map +0 -1
  310. package/lib/throttledEvent.js.map +0 -1
  311. package/lib/timeHelper.d.ts +0 -7
  312. package/lib/timeHelper.d.ts.map +0 -1
  313. package/lib/timeHelper.js +0 -37
  314. package/lib/timeHelper.js.map +0 -1
  315. package/lib/timer.d.ts.map +0 -1
  316. package/lib/timer.js.map +0 -1
  317. package/lib/transitionObserver.d.ts +0 -36
  318. package/lib/transitionObserver.d.ts.map +0 -1
  319. package/lib/transitionObserver.js +0 -153
  320. package/lib/transitionObserver.js.map +0 -1
  321. package/lib/types.d.ts +0 -17
  322. package/lib/types.d.ts.map +0 -1
  323. package/lib/types.js.map +0 -1
  324. package/lib/unsubscriber.d.ts +0 -2
  325. package/lib/unsubscriber.d.ts.map +0 -1
  326. package/lib/unsubscriber.js +0 -12
  327. package/lib/unsubscriber.js.map +0 -1
  328. package/lib/validation/ValidationErrorsLocalization.d.ts +0 -27
  329. package/lib/validation/ValidationErrorsLocalization.d.ts.map +0 -1
  330. package/lib/validation/ValidationErrorsLocalization.js +0 -26
  331. package/lib/validation/ValidationErrorsLocalization.js.map +0 -1
  332. package/lib/viewModels/CommonModel.d.ts +0 -13
  333. package/lib/viewModels/CommonModel.d.ts.map +0 -1
  334. package/lib/viewModels/CommonModel.js +0 -38
  335. package/lib/viewModels/CommonModel.js.map +0 -1
  336. package/lib/viewModels/FlagModel.d.ts +0 -22
  337. package/lib/viewModels/FlagModel.d.ts.map +0 -1
  338. package/lib/viewModels/FlagModel.js +0 -52
  339. package/lib/viewModels/FlagModel.js.map +0 -1
  340. package/lib/viewModels/InitializableModel.d.ts +0 -6
  341. package/lib/viewModels/InitializableModel.d.ts.map +0 -1
  342. package/lib/viewModels/InitializableModel.js +0 -23
  343. package/lib/viewModels/InitializableModel.js.map +0 -1
  344. package/lib/viewModels/LoadingModel.d.ts +0 -17
  345. package/lib/viewModels/LoadingModel.d.ts.map +0 -1
  346. package/lib/viewModels/LoadingModel.js +0 -42
  347. package/lib/viewModels/LoadingModel.js.map +0 -1
  348. package/lib/viewModels/MultiSelectModel.d.ts +0 -47
  349. package/lib/viewModels/MultiSelectModel.d.ts.map +0 -1
  350. package/lib/viewModels/MultiSelectModel.js +0 -144
  351. package/lib/viewModels/MultiSelectModel.js.map +0 -1
  352. package/lib/viewModels/NumberModel.d.ts +0 -19
  353. package/lib/viewModels/NumberModel.d.ts.map +0 -1
  354. package/lib/viewModels/NumberModel.js +0 -38
  355. package/lib/viewModels/NumberModel.js.map +0 -1
  356. package/lib/viewModels/PromptModal.d.ts +0 -31
  357. package/lib/viewModels/PromptModal.d.ts.map +0 -1
  358. package/lib/viewModels/PromptModal.js +0 -57
  359. package/lib/viewModels/PromptModal.js.map +0 -1
  360. package/lib/viewModels/SelectModel.d.ts +0 -35
  361. package/lib/viewModels/SelectModel.d.ts.map +0 -1
  362. package/lib/viewModels/SelectModel.js +0 -118
  363. package/lib/viewModels/SelectModel.js.map +0 -1
  364. package/lib/viewModels/TextModel.d.ts +0 -41
  365. package/lib/viewModels/TextModel.d.ts.map +0 -1
  366. package/lib/viewModels/TextModel.js +0 -98
  367. package/lib/viewModels/TextModel.js.map +0 -1
  368. package/lib/viewModels/Validatable.d.ts +0 -26
  369. package/lib/viewModels/Validatable.d.ts.map +0 -1
  370. package/lib/viewModels/Validatable.js +0 -81
  371. package/lib/viewModels/Validatable.js.map +0 -1
  372. package/lib/viewModels/ValueModel.d.ts +0 -12
  373. package/lib/viewModels/ValueModel.d.ts.map +0 -1
  374. package/lib/viewModels/ValueModel.js +0 -29
  375. package/lib/viewModels/ValueModel.js.map +0 -1
  376. package/lib/viewModels/ValuesCollector.d.ts +0 -26
  377. package/lib/viewModels/ValuesCollector.d.ts.map +0 -1
  378. package/lib/viewModels/ValuesCollector.js +0 -51
  379. package/lib/viewModels/ValuesCollector.js.map +0 -1
  380. package/lib/viewModels/index.d.ts +0 -12
  381. package/lib/viewModels/index.d.ts.map +0 -1
  382. package/lib/viewModels/index.js +0 -15
  383. package/lib/viewModels/index.js.map +0 -1
  384. package/lib/viewModels/types.d.ts +0 -19
  385. package/lib/viewModels/types.d.ts.map +0 -1
  386. package/lib/viewModels/types.js.map +0 -1
  387. package/lib/viewModels/wrappers.d.ts +0 -12
  388. package/lib/viewModels/wrappers.d.ts.map +0 -1
  389. package/lib/viewModels/wrappers.js +0 -43
  390. package/lib/viewModels/wrappers.js.map +0 -1
  391. package/src/__tests__/observingCache.test.ts +0 -127
  392. package/src/__tests__/transitionObserver.test.ts +0 -219
  393. package/src/cache.ts +0 -181
  394. package/src/deepPartial.ts +0 -4
  395. package/src/functions.ts +0 -14
  396. package/src/lazy/index.ts +0 -33
  397. package/src/lazy/observable.ts +0 -37
  398. package/src/lazy.light.ts +0 -8
  399. package/src/observersMap.ts +0 -105
  400. package/src/observingCache.ts +0 -160
  401. package/src/services/localization/LocalaziedValidationErrors.ts +0 -18
  402. package/src/services/localization/LocalizationManager.ts +0 -53
  403. package/src/services/localization/abstractions.ts +0 -16
  404. package/src/services/localization/defaultShape.ts +0 -26
  405. package/src/services/localization/index.ts +0 -6
  406. package/src/services/storage/web/localStorage.ts +0 -35
  407. package/src/services/storage/web/sessionStorage.ts +0 -35
  408. package/src/services/storage/web/webStorage.ts +0 -29
  409. package/src/timeHelper.ts +0 -39
  410. package/src/transitionObserver.ts +0 -183
  411. package/src/types.ts +0 -30
  412. package/src/unsubscriber.ts +0 -14
  413. package/src/validation/ValidationErrorsLocalization.ts +0 -27
  414. package/src/viewModels/CommonModel.ts +0 -45
  415. package/src/viewModels/FlagModel.ts +0 -70
  416. package/src/viewModels/InitializableModel.ts +0 -17
  417. package/src/viewModels/LoadingModel.ts +0 -52
  418. package/src/viewModels/MultiSelectModel.ts +0 -178
  419. package/src/viewModels/NumberModel.ts +0 -50
  420. package/src/viewModels/PromptModal.ts +0 -65
  421. package/src/viewModels/SelectModel.ts +0 -152
  422. package/src/viewModels/TextModel.ts +0 -127
  423. package/src/viewModels/Validatable.ts +0 -102
  424. package/src/viewModels/ValueModel.ts +0 -34
  425. package/src/viewModels/ValuesCollector.ts +0 -81
  426. package/src/viewModels/__tests__/common.test.ts +0 -107
  427. package/src/viewModels/__tests__/multiSelect.test.ts +0 -138
  428. package/src/viewModels/__tests__/select.test.ts +0 -71
  429. package/src/viewModels/__tests__/wrappers.test.ts +0 -79
  430. package/src/viewModels/index.ts +0 -15
  431. package/src/viewModels/types.ts +0 -23
  432. package/src/viewModels/wrappers.ts +0 -49
  433. package/tsconfig.eslint.json +0 -9
@@ -1,160 +0,0 @@
1
- import { action } from 'mobx';
2
- import { Disposable } from './disposer';
3
- import { PromiseCache, DeferredGetter } from './cache';
4
- import { ObserversMap } from './observersMap';
5
- import { Fields } from './fields';
6
- import logger from './logger';
7
-
8
- export type Unsub = () => void;
9
- export type Fetcher<T> = (key: string, cb: (val: T) => Promise<void> | void) => Unsub | Promise<Unsub>;
10
-
11
- type ObserveStrategy = boolean | 'short' | number;
12
-
13
- export interface IObservingCache<T> {
14
- get(key: string): DeferredGetter<T>;
15
- }
16
-
17
- export class ObservingCache<T> extends Disposable implements IObservingCache<T> {
18
-
19
- private readonly _cache: PromiseCache<T>;
20
- private readonly _observers: ObserversMap;
21
-
22
- private _observeStrategy: ObserveStrategy = null;
23
- private readonly _observeStrategyOverrides: Record<string, ObserveStrategy> = { };
24
-
25
- private _updater: Fields.Updater<T> = null;
26
-
27
- constructor(readonly fetcher: Fetcher<T>) {
28
- super();
29
-
30
- this._cache = new PromiseCache(this._fetch);
31
- this._observers = new ObserversMap(this._subscribe);
32
-
33
- this.disposer.add(this._observers);
34
- }
35
-
36
- public get loadingCount() { return this._cache.busyCount; }
37
- public get observersCount() { return this._observers.count; }
38
-
39
- useObservingStrategy(observe: ObserveStrategy) {
40
- this._observeStrategy = observe;
41
- if (!this._observeStrategy) {
42
- this._observers.clear();
43
- } else {
44
- const currentKeys = this._cache.keys();
45
- const timeout = getObserveTimeout(this._observeStrategy);
46
- currentKeys.forEach(key => this._observers.enable(key, true, timeout));
47
- }
48
-
49
- return this;
50
- }
51
-
52
- useUpdater(updater: Fields.Updater<T>) {
53
- this._updater = updater;
54
- this._cache.useObserveItems(updater != null);
55
- return this;
56
- }
57
-
58
- getIsCached(key: string) {
59
- return this._cache.hasKey(key);
60
- }
61
-
62
- getCurent(key: string) {
63
- return this._cache.getCurrent(key, false);
64
- }
65
-
66
- get(key: string, overrideStrategy?: ObserveStrategy, observingStartedPromise?: (p: Promise<void>) => void): DeferredGetter<T> {
67
- if (overrideStrategy !== undefined) {
68
- this._observeStrategyOverrides[key] = overrideStrategy;
69
- }
70
-
71
- const strategy = firstDefined(this._observeStrategyOverrides[key], this._observeStrategy);
72
-
73
- if (strategy && !this._observers.getIsObserving(key)) {
74
- // ensure observe
75
- if (this._cache.hasKey(key)) {
76
- // the request has been initiated already
77
- const timeout = getObserveTimeout(strategy);
78
- const promise = this._observers.enable(key, true, timeout);
79
- if (observingStartedPromise) {
80
- observingStartedPromise(promise);
81
- }
82
- promise.catch(err => logger.error('[ObservingCache] Error on starting observe', key, strategy, err));
83
- }
84
- }
85
-
86
- return this._cache.getDeferred(key);
87
- }
88
-
89
- populate = (key: string, item: T) => {
90
- this._updateItem(key, item);
91
- };
92
-
93
- invalidate = (key: string) => {
94
- this._observers.enable(key, false);
95
- this._cache.invalidate(key);
96
- };
97
-
98
- private _fetch = async (key: string): Promise<T> => {
99
- let firstLoad = true;
100
-
101
- return new Promise<T>((resolve) => {
102
- Promise.resolve<Unsub>(
103
- this.fetcher(key, item => {
104
- if (firstLoad) {
105
- resolve(item);
106
- firstLoad = false;
107
- } else {
108
- this._updateItem(key, item);
109
- }
110
- })
111
- ).then(unsub => {
112
- const strategy = firstDefined(this._observeStrategyOverrides[key], this._observeStrategy);
113
- if (!strategy) {
114
- // immediate unsub in case no observing strategy has been set
115
- unsub();
116
- } else {
117
- const timeout = getObserveTimeout(strategy);
118
- this._observers.enable(key, true, timeout, [unsub]);
119
- }
120
- });
121
- });
122
- };
123
-
124
- private _subscribe = (key: string) => {
125
- return Promise.all([
126
- this.fetcher(key, item => this._updateItem(key, item)),
127
- ]);
128
- };
129
-
130
- private _updateItem = action((key: string, item: T) => {
131
- if (this._updater != null && item != null) {
132
- const current = this._cache.getCurrent(key, false);
133
- if (current != null) {
134
- const result = this._updater(current, item);
135
- // re-set existing item but with updated contents
136
- this._cache.updateValueDirectly(key, result);
137
- return;
138
- }
139
- }
140
-
141
- this._cache.updateValueDirectly(key, item);
142
- });
143
- }
144
-
145
- function getObserveTimeout(s: ObserveStrategy) {
146
- if (!s) {
147
- return undefined;
148
- }
149
-
150
- return typeof s === 'number'
151
- ? s
152
- : (s === 'short'
153
- ? 5 * 60 * 1000
154
- : null
155
- );
156
- }
157
-
158
- function firstDefined<T>(...values: (T | undefined)[]) {
159
- return values.find(v => v !== undefined);
160
- }
@@ -1,18 +0,0 @@
1
- import { action, observable } from 'mobx';
2
- import { IErrorsLocalization, ILocalizationDependency, ValidationErrorsFactory, ValidationErrorsStrings } from './abstractions';
3
-
4
- export class LocalaziedValidationErrors<TStrings extends { }, TErrors extends string | number>
5
- implements IErrorsLocalization<TErrors>, ILocalizationDependency<TStrings> {
6
-
7
- @observable.ref
8
- private _strings: ValidationErrorsStrings<TErrors> = null;
9
-
10
- constructor(private readonly factory: ValidationErrorsFactory<TStrings, TErrors>) { }
11
-
12
- public get Errors(): Partial<Record<TErrors, string>> { return this._strings; }
13
-
14
- @action
15
- public updateLocale(strings: TStrings): void {
16
- this._strings = this.factory(strings);
17
- }
18
- }
@@ -1,53 +0,0 @@
1
- import { observable, makeObservable, action } from 'mobx';
2
- import { ILocalization, ILocalizationDependency } from './abstractions';
3
-
4
- export class LocalizationManager<TLocaleType extends string, TStrings extends { }> implements ILocalization<TStrings> {
5
- @observable
6
- private _currentLocale: TLocaleType = null;
7
-
8
- @observable.ref
9
- private _currentStrings: TStrings = null;
10
-
11
- private readonly _defaultStrings: TStrings = null;
12
- private readonly _dependants: ILocalizationDependency<TStrings, TLocaleType>[] = [];
13
-
14
- constructor(
15
- private readonly _dataSource: { [locale: string]: TStrings },
16
- initialLocale: TLocaleType,
17
- defaultLocale: TLocaleType = null,
18
- ) {
19
- makeObservable(this);
20
- this._defaultStrings = this.getStrings(defaultLocale || initialLocale);
21
- this.useLocale(initialLocale);
22
- }
23
-
24
- public get Locale() { return this._currentLocale; }
25
- public get Current() { return this._currentStrings; }
26
-
27
- @action
28
- public useLocale(locale: TLocaleType) {
29
- this._currentLocale = locale;
30
- this._currentStrings = this.getStrings(this._currentLocale) || this._defaultStrings;
31
- this.updateDependencies();
32
- return this;
33
- }
34
-
35
- public useDependency(dep: ILocalizationDependency<TStrings, TLocaleType>, remove = false) {
36
- const i = this._dependants.indexOf(dep);
37
- if (i < 0 && !remove) {
38
- this._dependants.push(dep);
39
- this.updateDependencies();
40
- } else if (i >= 0 && remove) {
41
- this._dependants.splice(i, 1);
42
- }
43
- return this;
44
- }
45
-
46
- private updateDependencies() {
47
- this._dependants.forEach(d => d.updateLocale(this._currentStrings, this._currentLocale));
48
- }
49
-
50
- private getStrings(locale: string): TStrings {
51
- return this._dataSource[locale];
52
- }
53
- }
@@ -1,16 +0,0 @@
1
-
2
- export interface ILocalization<TStrings extends { }> {
3
- readonly Current: Readonly<TStrings>;
4
- }
5
-
6
- export interface IErrorsLocalization<TErrors extends string | number> {
7
- readonly Errors: ValidationErrorsStrings<TErrors>
8
- }
9
-
10
- export interface ILocalizationDependency<TStrings extends { }, TLocale extends string = any> {
11
- updateLocale(strings: TStrings, locale?: TLocale): void;
12
- }
13
-
14
- export type ValidationErrorsStrings<T extends string | number> = Partial<Record<T, string>>;
15
-
16
- export type ValidationErrorsFactory<TStrings extends { }, TErrors extends string | number> = (strings: TStrings) => ValidationErrorsStrings<TErrors>;
@@ -1,26 +0,0 @@
1
- export const Strings = {
2
- Ok: 'OK',
3
- Cancel: 'Cancel',
4
- Submit: 'Submit',
5
- ForgotPassword: 'Forgot password?',
6
- Validation: {
7
- Empty: 'Value should be not empty',
8
- Name: 'Invalid name format',
9
- Email: 'Incorrect email',
10
- Password: 'Must include at least 8 characters',
11
- EnglishOnly: 'Only English letters supported',
12
- Phone: 'Invalid phone number format: only digits allowed',
13
- CreditCard: 'Invalid credit card number format',
14
- CreditCardExpiryDate: 'Invalid expiry date format',
15
- CreditCardCvv: 'Invalid CVV format',
16
- PasswordsShouldMatch: 'Passwords should match',
17
- FirstName: 'First name is required',
18
- LastName: 'Last name is required',
19
- OnlyDigit: 'Only digits are valid',
20
- Website: 'Incorrect website',
21
- Linkedin: 'Incorrect Linkedin link',
22
- },
23
- UnknownServerError: 'Something went wrong and we were not able to process your request. Please contact the administrator.',
24
- };
25
-
26
- export type StringsShape = typeof Strings;
@@ -1,6 +0,0 @@
1
- import { LocalizationManager } from './LocalizationManager';
2
- import { LocalaziedValidationErrors } from './LocalaziedValidationErrors';
3
-
4
- export * from './abstractions';
5
-
6
- export { LocalizationManager, LocalaziedValidationErrors };
@@ -1,35 +0,0 @@
1
- import { KeyStorage, KeyStorageConverted, StorageAsyncWrapper } from '..';
2
- import IStorage, { IStorageSync } from '../../../abstractions/services/storage';
3
- import { WebStorage } from './webStorage';
4
-
5
- /* global window */
6
-
7
- if (typeof window === 'undefined') {
8
- throw new Error("Can't use web/Storage module outside browser environment!");
9
- }
10
-
11
- class WebLocalStorage extends WebStorage {
12
- protected get storage() { return window.localStorage; }
13
- }
14
-
15
- export const LocalStorage: IStorageSync = new WebLocalStorage();
16
-
17
- export const LocalStorageAsync: IStorage = new StorageAsyncWrapper(LocalStorage);
18
-
19
- export class LocalKeyStorage extends KeyStorage {
20
- constructor(readonly key: string) {
21
- super(LocalStorage, key);
22
- }
23
- }
24
-
25
- export class LocalKeyStorageConverted<T> extends KeyStorageConverted<T> {
26
- constructor(
27
- key: string,
28
- input?: (v: T) => string,
29
- output?: (s: string) => T,
30
- ) {
31
- super(LocalStorage, key, input, output);
32
- }
33
- }
34
-
35
- export default LocalStorage;
@@ -1,35 +0,0 @@
1
- import { KeyStorage, KeyStorageConverted, StorageAsyncWrapper } from '..';
2
- import IStorage, { IStorageSync } from '../../../abstractions/services/storage';
3
- import { WebStorage } from './webStorage';
4
-
5
- /* global window */
6
-
7
- if (typeof window === 'undefined') {
8
- throw new Error("Can't use web/Storage module outside browser environment!");
9
- }
10
-
11
- class WebSessionStorage extends WebStorage {
12
- protected get storage() { return window.sessionStorage; }
13
- }
14
-
15
- export const SessionStorage: IStorageSync = new WebSessionStorage();
16
-
17
- export const SessionStorageAsync: IStorage = new StorageAsyncWrapper(SessionStorage);
18
-
19
- export class SessionKeyStorage extends KeyStorage {
20
- constructor(readonly key: string) {
21
- super(SessionStorage, key);
22
- }
23
- }
24
-
25
- export class SessionKeyStorageConverted<T> extends KeyStorageConverted<T> {
26
- constructor(
27
- key: string,
28
- input?: (v: T) => string,
29
- output?: (s: string) => T,
30
- ) {
31
- super(SessionStorage, key, input, output);
32
- }
33
- }
34
-
35
- export default SessionStorage;
@@ -1,29 +0,0 @@
1
-
2
- import { IStorageSync } from '../../../abstractions/services/storage';
3
-
4
- export abstract class WebStorage implements IStorageSync {
5
-
6
- protected abstract get storage(): Storage;
7
-
8
- getValue(key: string) {
9
- return this.storage.getItem(key);
10
- }
11
-
12
- setValue(key: string, value: string) {
13
- this.storage.setItem(key, value);
14
- }
15
-
16
- hasValue(key: string) {
17
- return this.storage.getItem(key) != null;
18
- }
19
-
20
- removeValue(key: string) {
21
- const hasValue = this.hasValue(key);
22
- if (!hasValue) {
23
- return false;
24
- }
25
-
26
- this.storage.removeItem(key);
27
- return true;
28
- }
29
- }
package/src/timeHelper.ts DELETED
@@ -1,39 +0,0 @@
1
-
2
- // eslint-disable-next-line no-console
3
- console.warn('"timeHelper" module is deprecated. Please use "dates" one.');
4
-
5
- /** @deprecated */
6
- export function formatMS(ms: number): string {
7
- if (!ms && ms !== 0) {
8
- return '';
9
- }
10
-
11
- const sec = Math.floor((ms / 1000) % 60);
12
- const min = Math.floor((ms / (1000 * 60)) % 60);
13
- const hours = Math.floor((ms / (1000 * 60 * 60)) % 60);
14
-
15
- return `${hours ? hours + ':' : ''}${min < 10 ? '0' + min : min}:${sec < 10 ? '0' + sec : sec}`;
16
- }
17
-
18
- /** @deprecated */
19
- export function formatTime(n: number): string {
20
- if (n < 10) {
21
- return '0' + n;
22
- }
23
-
24
- return n.toString();
25
- }
26
-
27
- /** @deprecated */
28
- export function secToFormattedMin(totalSec: number): string {
29
- const sec = Math.round(totalSec) % 60;
30
- const min = Math.floor((totalSec + 1) / 60);
31
- let res = `${formatTime(min)}`;
32
-
33
- if (sec) {
34
- res += ':';
35
- res += formatTime(Math.floor(sec));
36
- }
37
-
38
- return res;
39
- }
@@ -1,183 +0,0 @@
1
- import { reaction } from 'mobx';
2
- import { IEvent, Event } from './event';
3
- import { ILogger, createLogger } from './logger';
4
- import { IDisposable } from './disposer';
5
-
6
- export class TransitionObserver<T> implements IDisposable {
7
-
8
- private readonly _event = new Event<T>();
9
- private _getter: () => T = null;
10
-
11
- private _disposer: () => void;
12
- private _prev: T = undefined;
13
-
14
- private _from: T = undefined;
15
- private _to: T = undefined;
16
-
17
- private _cb: (v: T) => any;
18
- private _fireOnce = false;
19
-
20
- private _promise: Promise<T> = null;
21
- private _promiseReject: (err?: any) => any = null;
22
-
23
- private logger: ILogger = createLogger('', false);
24
-
25
- constructor(getter?: () => T) {
26
- if (getter) {
27
- this.observe(getter);
28
- }
29
- }
30
-
31
- public get event(): IEvent<T> { return this._event; }
32
- public get currentValue() { return this._prev; }
33
-
34
- public get isObserving() { return this._disposer != null; }
35
- private get isPromising() { return this._promiseReject != null; }
36
-
37
- observe(getter: () => T) {
38
- this.dispose();
39
- this._getter = getter;
40
- this._prev = this._getter();
41
- this._disposer = reaction(this._getter, this._checkValue);
42
- return this;
43
- }
44
-
45
- from(from: T) {
46
- this._from = from;
47
- return this;
48
- }
49
-
50
- to(to: T) {
51
- this._to = to;
52
- return this;
53
- }
54
-
55
- cb(cb: (v: T) => any) {
56
- if (this.isPromising) {
57
- throw new Error('Cannot set callback when promise is running');
58
- }
59
- this._cb = cb;
60
- return this;
61
- }
62
-
63
- forceCall() {
64
- if (this._cb) {
65
- this._cb(this._prev);
66
- }
67
- return this;
68
- }
69
-
70
- fireOnce(enable = true) {
71
- this._fireOnce = enable;
72
- return this;
73
- }
74
-
75
- forceCheck() {
76
- return this._checkValue(this._getter());
77
- }
78
-
79
- andForceCheck() {
80
- this.forceCheck();
81
- return this;
82
- }
83
-
84
- getPromise(timeout: number = null) {
85
- if (!this._promise) {
86
- if (!this.isObserving) {
87
- return Promise.reject(new Error('Cannot get promise for disposed TransitionObserver'));
88
- }
89
-
90
- this._promise = new Promise<T>((resolve, reject) => {
91
- this._promiseReject = reject;
92
-
93
- let timeoutHandle: any = null;
94
- if (timeout) {
95
- timeoutHandle = setTimeout(() => {
96
- this._finishPromise(this._promiseReject, new Error(`TransitionObserver Aborted – timed out after ${timeout}ms`));
97
- }, timeout);
98
- }
99
-
100
- this._cb = (v => {
101
- clearTimeout(timeoutHandle);
102
- this._finishPromise(resolve, v);
103
- });
104
- this.forceCheck();
105
- });
106
- this.logger.log('started a new promise...');
107
- }
108
- return this._promise;
109
- }
110
-
111
- reverse() {
112
- return new TransitionObserver<T>(this._getter)
113
- .from(this._to)
114
- .to(this._from);
115
- }
116
-
117
- enableLogging(name: string) {
118
- this.logger = createLogger(name, name ? undefined : false);
119
- return this;
120
- }
121
-
122
- dispose = () => {
123
- this.logger.log(' disposing... ');
124
- if (this._disposer) {
125
- this._disposer();
126
- this._disposer = null;
127
- }
128
- if (this.isPromising) {
129
- this._finishPromise(this._promiseReject, new Error('TransitionObserver Aborted'));
130
- }
131
- };
132
-
133
- private _checkValue = (v: T) => {
134
- let trigger = false;
135
-
136
- if (this._from !== undefined && this._to !== undefined) {
137
- // both 'from' and 'two' should be matched
138
- trigger = this._prev === this._from && v === this._to;
139
- } else if (this._from !== undefined || this._to !== undefined) {
140
- // at least one match – 'from' or 'to'
141
- trigger = (this._from !== undefined && this._from === this._prev)
142
- || (this._to !== undefined && this._to === v);
143
- } else {
144
- // if both 'from' and 'to' are undefined – trigger for any change
145
- // this._from === undefined && this._to === undefined;
146
- trigger = true;
147
- }
148
-
149
- this.logger.log('Checked value:', v, ' ==> will trigger:', trigger);
150
-
151
- this._prev = v;
152
-
153
- if (trigger) {
154
- this._event.trigger(v);
155
-
156
- if (this._cb) {
157
- this._cb(v);
158
- }
159
-
160
- if (this._fireOnce) {
161
- this.dispose();
162
- }
163
- }
164
-
165
- return trigger;
166
- };
167
-
168
- private _finishPromise<T>(cb: (a?: T) => any, arg?: T) {
169
- this._promise = null;
170
- this._promiseReject = null;
171
- this._cb = null;
172
- if (cb) {
173
- cb(arg);
174
- }
175
- }
176
- }
177
-
178
- export function waitFor<T>(current: () => T, toBe: T) {
179
- return new TransitionObserver(current)
180
- .to(toBe)
181
- .fireOnce()
182
- .getPromise();
183
- }
package/src/types.ts DELETED
@@ -1,30 +0,0 @@
1
- export { DeepPartial } from './deepPartial';
2
-
3
- export type DeepReadonly<T> = {
4
- readonly [P in keyof T]: DeepReadonly<T[P]>;
5
- };
6
-
7
- export type Getter<T> = (() => T) | T | null;
8
-
9
- export namespace Getter {
10
- export function getValue<T>(getter: Getter<T>): T {
11
- if (getter == null) {
12
- return undefined;
13
- }
14
- if (typeof getter === 'function') {
15
- return (getter as () => T)();
16
- }
17
- return getter;
18
- }
19
- }
20
-
21
- export type Predicate<T> = (value: T) => boolean;
22
- export type Comparator<T, C = boolean> = (v1: T, v2: T) => C;
23
-
24
- export namespace Comparator {
25
- export const Default: Comparator<any> = (a, b) => a === b;
26
- }
27
-
28
- export type TypedKeys<T extends Object, K> = {
29
- [P in keyof T]: T[P] extends K ? P : never
30
- }[keyof T];
@@ -1,14 +0,0 @@
1
-
2
- // DEPRECATED MODULE. Delete in future versions
3
-
4
- import logger from './logger';
5
-
6
- export {
7
- IDisposable,
8
- DisposeFunction as Disposer,
9
- combineDisposers,
10
- Disposer as Unsubscriber,
11
- Disposable,
12
- } from './disposer';
13
-
14
- logger.warn('@zajno/common: importing module "unsusbcriber" is deprecated; please change your import to "disposer" module.');
@@ -1,27 +0,0 @@
1
- import { ValidationErrorsStrings } from '../services/localization';
2
- import { StringsShape } from '../services/localization/defaultShape';
3
- import { LocalaziedValidationErrors } from '../services/localization/LocalaziedValidationErrors';
4
- import { ValidationErrors } from './ValidationErrors';
5
-
6
- function locationFactory(strings: StringsShape): ValidationErrorsStrings<ValidationErrors> {
7
- return {
8
- [ValidationErrors.None]: '',
9
- [ValidationErrors.ShouldBeNonEmpty]: strings.Validation.Empty,
10
- [ValidationErrors.InvalidNameFormat]: strings.Validation.Name,
11
- [ValidationErrors.InvalidEmailFormat]: strings.Validation.Email,
12
- [ValidationErrors.InvalidPasswordFormat]: strings.Validation.Password,
13
- [ValidationErrors.OnlyEnglishLetters]: strings.Validation.EnglishOnly,
14
- [ValidationErrors.InvalidPhoneFormat]: strings.Validation.Phone,
15
- [ValidationErrors.InvalidCreditCardFormat]: strings.Validation.CreditCard,
16
- [ValidationErrors.InvalidCreditCardExpiryDateFormat]: strings.Validation.CreditCardExpiryDate,
17
- [ValidationErrors.InvalidCreditCardCvvFormat]: strings.Validation.CreditCardCvv,
18
-
19
- [ValidationErrors.FirstName]: strings.Validation.FirstName,
20
- [ValidationErrors.LastName]: strings.Validation.LastName,
21
- [ValidationErrors.OnlyDigit]: strings.Validation.OnlyDigit,
22
- [ValidationErrors.Website]: strings.Validation.Website,
23
- [ValidationErrors.Linkedin]: strings.Validation.Linkedin,
24
- };
25
- }
26
-
27
- export const ValidationErrorsLocalized = new LocalaziedValidationErrors<StringsShape, ValidationErrors>(locationFactory);