@prestizni-software/server-dem 0.7.3 → 0.7.5

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 (525) hide show
  1. package/AutoUpdateClientManagerClass.d.ts +141 -0
  2. package/AutoUpdateClientManagerClass.js +656 -0
  3. package/AutoUpdateClientManagerClass.js.map +1 -0
  4. package/AutoUpdateManagerClass.d.ts +102 -0
  5. package/AutoUpdateManagerClass.js +117 -0
  6. package/AutoUpdateManagerClass.js.map +1 -0
  7. package/AutoUpdateServerManagerClass.d.ts +208 -0
  8. package/AutoUpdateServerManagerClass.js +913 -0
  9. package/AutoUpdateServerManagerClass.js.map +1 -0
  10. package/AutoUpdatedClientObjectClass.d.ts +215 -0
  11. package/AutoUpdatedClientObjectClass.js +911 -0
  12. package/AutoUpdatedClientObjectClass.js.map +1 -0
  13. package/AutoUpdatedServerObjectClass.d.ts +134 -0
  14. package/AutoUpdatedServerObjectClass.js +346 -0
  15. package/AutoUpdatedServerObjectClass.js.map +1 -0
  16. package/ClientTypes.d.ts +15 -0
  17. package/ClientTypes.js +52 -0
  18. package/ClientTypes.js.map +1 -0
  19. package/CommonTypes.d.ts +259 -0
  20. package/CommonTypes.js +233 -0
  21. package/CommonTypes.js.map +1 -0
  22. package/CommonTypes_server.d.ts +1 -0
  23. package/CommonTypes_server.js +2 -0
  24. package/CommonTypes_server.js.map +1 -0
  25. package/{dist/DEMErrors.d.ts → DEMErrors.d.ts} +22 -2
  26. package/{dist/DEMErrors.js → DEMErrors.js} +22 -2
  27. package/{dist/DEMErrors.js.map → DEMErrors.js.map} +1 -1
  28. package/ServerTypes.d.ts +16 -0
  29. package/ServerTypes.js +60 -0
  30. package/ServerTypes.js.map +1 -0
  31. package/client.d.ts +6 -0
  32. package/client.js +7 -0
  33. package/client.js.map +1 -0
  34. package/coverage/lcov-report/block-navigation.js +71 -0
  35. package/coverage/lcov-report/block-navigation.js.map +1 -0
  36. package/coverage/lcov-report/prettify.js +478 -0
  37. package/coverage/lcov-report/prettify.js.map +1 -0
  38. package/coverage/lcov-report/sorter.js +177 -0
  39. package/coverage/lcov-report/sorter.js.map +1 -0
  40. package/dist/AutoUpdateClientManagerClass.d.ts +20 -0
  41. package/dist/AutoUpdateClientManagerClass.js +283 -0
  42. package/dist/AutoUpdateClientManagerClass.js.map +1 -0
  43. package/dist/AutoUpdateManagerClass.d.ts +17 -31
  44. package/dist/AutoUpdateManagerClass.js +15 -36
  45. package/dist/AutoUpdateManagerClass.js.map +1 -1
  46. package/dist/AutoUpdateServerManagerClass.d.ts +18 -118
  47. package/dist/AutoUpdateServerManagerClass.js +198 -583
  48. package/dist/AutoUpdateServerManagerClass.js.map +1 -1
  49. package/dist/AutoUpdatedClientObjectClass.d.ts +63 -92
  50. package/dist/AutoUpdatedClientObjectClass.js +660 -599
  51. package/dist/AutoUpdatedClientObjectClass.js.map +1 -1
  52. package/dist/AutoUpdatedServerObjectClass.d.ts +13 -33
  53. package/dist/AutoUpdatedServerObjectClass.js +92 -234
  54. package/dist/AutoUpdatedServerObjectClass.js.map +1 -1
  55. package/dist/ClientTypes.d.ts +13 -0
  56. package/dist/ClientTypes.js +70 -0
  57. package/dist/ClientTypes.js.map +1 -0
  58. package/dist/CommonTypes.d.ts +3 -220
  59. package/dist/CommonTypes.js +4 -188
  60. package/dist/CommonTypes.js.map +1 -1
  61. package/dist/CommonTypes_server.d.ts +1 -1
  62. package/dist/CommonTypes_server.js +2 -1
  63. package/dist/CommonTypes_server.js.map +1 -1
  64. package/dist/ServerTypes.d.ts +13 -0
  65. package/dist/ServerTypes.js +78 -0
  66. package/dist/ServerTypes.js.map +1 -0
  67. package/dist/TestTypes.d.ts +1 -0
  68. package/dist/TestTypes.js +7 -0
  69. package/dist/TestTypes.js.map +1 -0
  70. package/dist/client.d.ts +1 -0
  71. package/dist/client.js +12 -0
  72. package/dist/client.js.map +1 -0
  73. package/dist/coverage/lcov-report/block-navigation.d.ts +1 -0
  74. package/dist/coverage/lcov-report/block-navigation.js +71 -0
  75. package/dist/coverage/lcov-report/block-navigation.js.map +1 -0
  76. package/dist/coverage/lcov-report/prettify.d.ts +0 -0
  77. package/dist/coverage/lcov-report/prettify.js +736 -0
  78. package/dist/coverage/lcov-report/prettify.js.map +1 -0
  79. package/dist/coverage/lcov-report/sorter.d.ts +1 -0
  80. package/dist/coverage/lcov-report/sorter.js +177 -0
  81. package/dist/coverage/lcov-report/sorter.js.map +1 -0
  82. package/dist/dist/AutoUpdateClientManagerClass.d.ts +19 -0
  83. package/dist/dist/AutoUpdateClientManagerClass.js +284 -0
  84. package/dist/dist/AutoUpdateClientManagerClass.js.map +1 -0
  85. package/dist/dist/AutoUpdateManagerClass.d.ts +23 -0
  86. package/dist/dist/AutoUpdateManagerClass.js +60 -0
  87. package/dist/dist/AutoUpdateManagerClass.js.map +1 -0
  88. package/dist/dist/AutoUpdateServerManagerClass.d.ts +50 -0
  89. package/dist/dist/AutoUpdateServerManagerClass.js +413 -0
  90. package/dist/dist/AutoUpdateServerManagerClass.js.map +1 -0
  91. package/dist/dist/AutoUpdatedClientObjectClass.d.ts +72 -0
  92. package/dist/dist/AutoUpdatedClientObjectClass.js +865 -0
  93. package/dist/dist/AutoUpdatedClientObjectClass.js.map +1 -0
  94. package/dist/dist/AutoUpdatedServerObjectClass.d.ts +15 -0
  95. package/dist/dist/AutoUpdatedServerObjectClass.js +124 -0
  96. package/dist/dist/AutoUpdatedServerObjectClass.js.map +1 -0
  97. package/dist/dist/ClientTypes.d.ts +13 -0
  98. package/dist/dist/ClientTypes.js +71 -0
  99. package/dist/dist/ClientTypes.js.map +1 -0
  100. package/dist/dist/CommonTypes.d.ts +3 -0
  101. package/dist/dist/CommonTypes.js +20 -0
  102. package/dist/dist/CommonTypes.js.map +1 -0
  103. package/dist/dist/CommonTypes_server.d.ts +1 -0
  104. package/dist/dist/CommonTypes_server.js +4 -0
  105. package/dist/dist/CommonTypes_server.js.map +1 -0
  106. package/dist/dist/ServerTypes.d.ts +13 -0
  107. package/dist/dist/ServerTypes.js +79 -0
  108. package/dist/dist/ServerTypes.js.map +1 -0
  109. package/dist/dist/TestTypes.d.ts +1 -0
  110. package/dist/dist/TestTypes.js +8 -0
  111. package/dist/dist/TestTypes.js.map +1 -0
  112. package/dist/dist/client.d.ts +1 -0
  113. package/dist/dist/client.js +13 -0
  114. package/dist/dist/client.js.map +1 -0
  115. package/dist/dist/coverage/lcov-report/block-navigation.d.ts +1 -0
  116. package/dist/dist/coverage/lcov-report/block-navigation.js +71 -0
  117. package/dist/dist/coverage/lcov-report/block-navigation.js.map +1 -0
  118. package/dist/dist/coverage/lcov-report/prettify.d.ts +0 -0
  119. package/dist/dist/coverage/lcov-report/prettify.js +736 -0
  120. package/dist/dist/coverage/lcov-report/prettify.js.map +1 -0
  121. package/dist/dist/coverage/lcov-report/sorter.d.ts +1 -0
  122. package/dist/dist/coverage/lcov-report/sorter.js +177 -0
  123. package/dist/dist/coverage/lcov-report/sorter.js.map +1 -0
  124. package/dist/dist/dist/AutoUpdateClientManagerClass.d.ts +19 -0
  125. package/dist/dist/dist/AutoUpdateClientManagerClass.js +285 -0
  126. package/dist/dist/dist/AutoUpdateClientManagerClass.js.map +1 -0
  127. package/dist/dist/dist/AutoUpdateManagerClass.d.ts +23 -0
  128. package/dist/dist/dist/AutoUpdateManagerClass.js +61 -0
  129. package/dist/dist/dist/AutoUpdateManagerClass.js.map +1 -0
  130. package/dist/dist/dist/AutoUpdateServerManagerClass.d.ts +158 -0
  131. package/dist/dist/dist/AutoUpdateServerManagerClass.js +414 -0
  132. package/dist/dist/dist/AutoUpdateServerManagerClass.js.map +1 -0
  133. package/dist/dist/dist/AutoUpdatedClientObjectClass.d.ts +72 -0
  134. package/dist/dist/dist/AutoUpdatedClientObjectClass.js +866 -0
  135. package/dist/dist/dist/AutoUpdatedClientObjectClass.js.map +1 -0
  136. package/dist/dist/dist/AutoUpdatedServerObjectClass.d.ts +15 -0
  137. package/dist/dist/dist/AutoUpdatedServerObjectClass.js +125 -0
  138. package/dist/dist/dist/AutoUpdatedServerObjectClass.js.map +1 -0
  139. package/dist/dist/dist/ClientTypes.d.ts +13 -0
  140. package/dist/dist/dist/ClientTypes.js +72 -0
  141. package/dist/dist/dist/ClientTypes.js.map +1 -0
  142. package/dist/dist/dist/CommonTypes.d.ts +3 -0
  143. package/dist/dist/dist/CommonTypes.js +21 -0
  144. package/dist/dist/dist/CommonTypes.js.map +1 -0
  145. package/dist/dist/dist/CommonTypes_server.d.ts +1 -0
  146. package/dist/dist/dist/CommonTypes_server.js +5 -0
  147. package/dist/dist/dist/CommonTypes_server.js.map +1 -0
  148. package/dist/dist/dist/ServerTypes.d.ts +13 -0
  149. package/dist/dist/dist/ServerTypes.js +80 -0
  150. package/dist/dist/dist/ServerTypes.js.map +1 -0
  151. package/dist/dist/dist/TestTypes.d.ts +1 -0
  152. package/dist/dist/dist/TestTypes.js +9 -0
  153. package/dist/dist/dist/TestTypes.js.map +1 -0
  154. package/dist/dist/dist/client.d.ts +1 -0
  155. package/dist/dist/dist/client.js +14 -0
  156. package/dist/dist/dist/client.js.map +1 -0
  157. package/dist/dist/dist/coverage/lcov-report/block-navigation.d.ts +1 -0
  158. package/dist/dist/dist/coverage/lcov-report/block-navigation.js +71 -0
  159. package/dist/dist/dist/coverage/lcov-report/block-navigation.js.map +1 -0
  160. package/dist/dist/dist/coverage/lcov-report/prettify.d.ts +0 -0
  161. package/dist/dist/dist/coverage/lcov-report/prettify.js +736 -0
  162. package/dist/dist/dist/coverage/lcov-report/prettify.js.map +1 -0
  163. package/dist/dist/dist/coverage/lcov-report/sorter.d.ts +1 -0
  164. package/dist/dist/dist/coverage/lcov-report/sorter.js +177 -0
  165. package/dist/dist/dist/coverage/lcov-report/sorter.js.map +1 -0
  166. package/dist/dist/dist/expo-test/app/(tabs)/_layout.d.ts +1 -0
  167. package/dist/dist/dist/expo-test/app/(tabs)/_layout.js +27 -0
  168. package/dist/dist/dist/expo-test/app/(tabs)/_layout.js.map +1 -0
  169. package/dist/dist/dist/expo-test/app/(tabs)/explore.d.ts +1 -0
  170. package/dist/dist/dist/expo-test/app/(tabs)/explore.js +95 -0
  171. package/dist/dist/dist/expo-test/app/(tabs)/explore.js.map +1 -0
  172. package/dist/dist/dist/expo-test/app/(tabs)/index.d.ts +1 -0
  173. package/dist/dist/dist/expo-test/app/(tabs)/index.js +81 -0
  174. package/dist/dist/dist/expo-test/app/(tabs)/index.js.map +1 -0
  175. package/dist/dist/dist/expo-test/app/_layout.d.ts +4 -0
  176. package/dist/dist/dist/expo-test/app/_layout.js +22 -0
  177. package/dist/dist/dist/expo-test/app/_layout.js.map +1 -0
  178. package/dist/dist/dist/expo-test/app/modal.d.ts +1 -0
  179. package/dist/dist/dist/expo-test/app/modal.js +28 -0
  180. package/dist/dist/dist/expo-test/app/modal.js.map +1 -0
  181. package/dist/dist/dist/expo-test/components/external-link.d.ts +4 -0
  182. package/dist/dist/dist/expo-test/components/external-link.js +18 -0
  183. package/dist/dist/dist/expo-test/components/external-link.js.map +1 -0
  184. package/dist/dist/dist/expo-test/components/haptic-tab.d.ts +1 -0
  185. package/dist/dist/dist/expo-test/components/haptic-tab.js +15 -0
  186. package/dist/dist/dist/expo-test/components/haptic-tab.js.map +1 -0
  187. package/dist/dist/dist/expo-test/components/hello-wave.d.ts +1 -0
  188. package/dist/dist/dist/expo-test/components/hello-wave.js +19 -0
  189. package/dist/dist/dist/expo-test/components/hello-wave.js.map +1 -0
  190. package/dist/dist/dist/expo-test/components/parallax-scroll-view.d.ts +5 -0
  191. package/dist/dist/dist/expo-test/components/parallax-scroll-view.js +53 -0
  192. package/dist/dist/dist/expo-test/components/parallax-scroll-view.js.map +1 -0
  193. package/dist/dist/dist/expo-test/components/themed-text.d.ts +7 -0
  194. package/dist/dist/dist/expo-test/components/themed-text.js +43 -0
  195. package/dist/dist/dist/expo-test/components/themed-text.js.map +1 -0
  196. package/dist/dist/dist/expo-test/components/themed-view.d.ts +6 -0
  197. package/dist/dist/dist/expo-test/components/themed-view.js +10 -0
  198. package/dist/dist/dist/expo-test/components/themed-view.js.map +1 -0
  199. package/dist/dist/dist/expo-test/components/ui/collapsible.d.ts +4 -0
  200. package/dist/dist/dist/expo-test/components/ui/collapsible.js +34 -0
  201. package/dist/dist/dist/expo-test/components/ui/collapsible.js.map +1 -0
  202. package/dist/dist/dist/expo-test/components/ui/icon-symbol.d.ts +11 -0
  203. package/dist/dist/dist/expo-test/components/ui/icon-symbol.ios.d.ts +7 -0
  204. package/dist/dist/dist/expo-test/components/ui/icon-symbol.ios.js +14 -0
  205. package/dist/dist/dist/expo-test/components/ui/icon-symbol.ios.js.map +1 -0
  206. package/dist/dist/dist/expo-test/components/ui/icon-symbol.js +25 -0
  207. package/dist/dist/dist/expo-test/components/ui/icon-symbol.js.map +1 -0
  208. package/dist/dist/dist/expo-test/constants/theme.d.ts +26 -0
  209. package/dist/dist/dist/expo-test/constants/theme.js +53 -0
  210. package/dist/dist/dist/expo-test/constants/theme.js.map +1 -0
  211. package/dist/dist/dist/expo-test/eslint.config.d.ts +2 -0
  212. package/dist/dist/dist/expo-test/eslint.config.js +11 -0
  213. package/dist/dist/dist/expo-test/eslint.config.js.map +1 -0
  214. package/dist/dist/dist/expo-test/hooks/use-color-scheme.d.ts +1 -0
  215. package/dist/dist/dist/expo-test/hooks/use-color-scheme.js +5 -0
  216. package/dist/dist/dist/expo-test/hooks/use-color-scheme.js.map +1 -0
  217. package/dist/dist/dist/expo-test/hooks/use-color-scheme.web.d.ts +4 -0
  218. package/dist/dist/dist/expo-test/hooks/use-color-scheme.web.js +20 -0
  219. package/dist/dist/dist/expo-test/hooks/use-color-scheme.web.js.map +1 -0
  220. package/dist/dist/dist/expo-test/hooks/use-theme-color.d.ts +1 -0
  221. package/dist/dist/dist/expo-test/hooks/use-theme-color.js +20 -0
  222. package/dist/dist/dist/expo-test/hooks/use-theme-color.js.map +1 -0
  223. package/dist/dist/dist/expo-test/scripts/reset-project.d.ts +2 -0
  224. package/dist/dist/dist/expo-test/scripts/reset-project.js +98 -0
  225. package/dist/dist/dist/expo-test/scripts/reset-project.js.map +1 -0
  226. package/dist/dist/dist/jest.config.d.ts +21 -0
  227. package/dist/dist/dist/jest.config.js +20 -0
  228. package/dist/dist/dist/jest.config.js.map +1 -0
  229. package/dist/dist/dist/server.d.ts +1 -0
  230. package/dist/dist/dist/server.js +16 -0
  231. package/dist/dist/dist/server.js.map +1 -0
  232. package/dist/dist/dist/socket_test.d.ts +1 -0
  233. package/dist/dist/dist/socket_test.js +24 -0
  234. package/dist/dist/dist/socket_test.js.map +1 -0
  235. package/dist/dist/dist/test.d.ts +1 -0
  236. package/dist/dist/dist/test.js +7 -0
  237. package/dist/dist/dist/test.js.map +1 -0
  238. package/dist/dist/dist/test_client.d.ts +1 -0
  239. package/dist/dist/dist/test_client.js +26 -0
  240. package/dist/dist/dist/test_client.js.map +1 -0
  241. package/dist/dist/dist/test_lib.d.ts +2 -0
  242. package/dist/dist/dist/test_lib.js +85 -0
  243. package/dist/dist/dist/test_lib.js.map +1 -0
  244. package/dist/dist/dist/test_server.d.ts +1 -0
  245. package/dist/dist/dist/test_server.js +54 -0
  246. package/dist/dist/dist/test_server.js.map +1 -0
  247. package/dist/dist/dist/tests/dem.test.d.ts +1 -0
  248. package/dist/dist/dist/tests/dem.test.js +341 -0
  249. package/dist/dist/dist/tests/dem.test.js.map +1 -0
  250. package/dist/dist/expo-test/app/(tabs)/_layout.d.ts +1 -0
  251. package/dist/dist/expo-test/app/(tabs)/_layout.js +26 -0
  252. package/dist/dist/expo-test/app/(tabs)/_layout.js.map +1 -0
  253. package/dist/dist/expo-test/app/(tabs)/explore.d.ts +1 -0
  254. package/dist/dist/expo-test/app/(tabs)/explore.js +94 -0
  255. package/dist/dist/expo-test/app/(tabs)/explore.js.map +1 -0
  256. package/dist/dist/expo-test/app/(tabs)/index.d.ts +1 -0
  257. package/dist/dist/expo-test/app/(tabs)/index.js +80 -0
  258. package/dist/dist/expo-test/app/(tabs)/index.js.map +1 -0
  259. package/dist/dist/expo-test/app/_layout.d.ts +4 -0
  260. package/dist/dist/expo-test/app/_layout.js +21 -0
  261. package/dist/dist/expo-test/app/_layout.js.map +1 -0
  262. package/dist/dist/expo-test/app/modal.d.ts +1 -0
  263. package/dist/dist/expo-test/app/modal.js +27 -0
  264. package/dist/dist/expo-test/app/modal.js.map +1 -0
  265. package/dist/dist/expo-test/components/external-link.d.ts +4 -0
  266. package/dist/dist/expo-test/components/external-link.js +17 -0
  267. package/dist/dist/expo-test/components/external-link.js.map +1 -0
  268. package/dist/dist/expo-test/components/haptic-tab.d.ts +1 -0
  269. package/dist/dist/expo-test/components/haptic-tab.js +14 -0
  270. package/dist/dist/expo-test/components/haptic-tab.js.map +1 -0
  271. package/dist/dist/expo-test/components/hello-wave.d.ts +1 -0
  272. package/dist/dist/expo-test/components/hello-wave.js +18 -0
  273. package/dist/dist/expo-test/components/hello-wave.js.map +1 -0
  274. package/dist/dist/expo-test/components/parallax-scroll-view.d.ts +5 -0
  275. package/dist/dist/expo-test/components/parallax-scroll-view.js +52 -0
  276. package/dist/dist/expo-test/components/parallax-scroll-view.js.map +1 -0
  277. package/dist/dist/expo-test/components/themed-text.d.ts +7 -0
  278. package/dist/dist/expo-test/components/themed-text.js +42 -0
  279. package/dist/dist/expo-test/components/themed-text.js.map +1 -0
  280. package/dist/dist/expo-test/components/themed-view.d.ts +6 -0
  281. package/dist/dist/expo-test/components/themed-view.js +9 -0
  282. package/dist/dist/expo-test/components/themed-view.js.map +1 -0
  283. package/dist/dist/expo-test/components/ui/collapsible.d.ts +4 -0
  284. package/dist/dist/expo-test/components/ui/collapsible.js +33 -0
  285. package/dist/dist/expo-test/components/ui/collapsible.js.map +1 -0
  286. package/dist/dist/expo-test/components/ui/icon-symbol.d.ts +11 -0
  287. package/dist/dist/expo-test/components/ui/icon-symbol.ios.d.ts +7 -0
  288. package/dist/dist/expo-test/components/ui/icon-symbol.ios.js +13 -0
  289. package/dist/dist/expo-test/components/ui/icon-symbol.ios.js.map +1 -0
  290. package/dist/dist/expo-test/components/ui/icon-symbol.js +24 -0
  291. package/dist/dist/expo-test/components/ui/icon-symbol.js.map +1 -0
  292. package/dist/dist/expo-test/constants/theme.d.ts +26 -0
  293. package/dist/dist/expo-test/constants/theme.js +52 -0
  294. package/dist/dist/expo-test/constants/theme.js.map +1 -0
  295. package/dist/dist/expo-test/eslint.config.d.ts +2 -0
  296. package/dist/dist/expo-test/eslint.config.js +11 -0
  297. package/dist/dist/expo-test/eslint.config.js.map +1 -0
  298. package/dist/dist/expo-test/hooks/use-color-scheme.d.ts +1 -0
  299. package/dist/dist/expo-test/hooks/use-color-scheme.js +4 -0
  300. package/dist/dist/expo-test/hooks/use-color-scheme.js.map +1 -0
  301. package/dist/dist/expo-test/hooks/use-color-scheme.web.d.ts +4 -0
  302. package/dist/dist/expo-test/hooks/use-color-scheme.web.js +19 -0
  303. package/dist/dist/expo-test/hooks/use-color-scheme.web.js.map +1 -0
  304. package/dist/dist/expo-test/hooks/use-theme-color.d.ts +1 -0
  305. package/dist/dist/expo-test/hooks/use-theme-color.js +19 -0
  306. package/dist/dist/expo-test/hooks/use-theme-color.js.map +1 -0
  307. package/dist/dist/expo-test/scripts/reset-project.d.ts +2 -0
  308. package/dist/dist/expo-test/scripts/reset-project.js +98 -0
  309. package/dist/dist/expo-test/scripts/reset-project.js.map +1 -0
  310. package/dist/dist/jest.config.d.ts +21 -0
  311. package/dist/dist/jest.config.js +19 -0
  312. package/dist/dist/jest.config.js.map +1 -0
  313. package/dist/dist/server.d.ts +1 -0
  314. package/dist/dist/server.js +15 -0
  315. package/dist/dist/server.js.map +1 -0
  316. package/dist/dist/socket_test.d.ts +1 -0
  317. package/dist/dist/socket_test.js +23 -0
  318. package/dist/dist/socket_test.js.map +1 -0
  319. package/dist/dist/test.d.ts +1 -0
  320. package/dist/dist/test.js +6 -0
  321. package/dist/dist/test.js.map +1 -0
  322. package/dist/dist/test_client.d.ts +1 -0
  323. package/dist/dist/test_client.js +25 -0
  324. package/dist/dist/test_client.js.map +1 -0
  325. package/dist/dist/test_lib.d.ts +2 -0
  326. package/dist/dist/test_lib.js +84 -0
  327. package/dist/dist/test_lib.js.map +1 -0
  328. package/dist/dist/test_server.d.ts +1 -0
  329. package/dist/dist/test_server.js +53 -0
  330. package/dist/dist/test_server.js.map +1 -0
  331. package/dist/dist/tests/dem.test.d.ts +1 -0
  332. package/dist/dist/tests/dem.test.js +340 -0
  333. package/dist/dist/tests/dem.test.js.map +1 -0
  334. package/dist/expo-test/app/(tabs)/_layout.d.ts +1 -0
  335. package/dist/expo-test/app/(tabs)/_layout.js +25 -0
  336. package/dist/expo-test/app/(tabs)/_layout.js.map +1 -0
  337. package/dist/expo-test/app/(tabs)/explore.d.ts +1 -0
  338. package/dist/expo-test/app/(tabs)/explore.js +93 -0
  339. package/dist/expo-test/app/(tabs)/explore.js.map +1 -0
  340. package/dist/expo-test/app/(tabs)/index.d.ts +1 -0
  341. package/dist/expo-test/app/(tabs)/index.js +79 -0
  342. package/dist/expo-test/app/(tabs)/index.js.map +1 -0
  343. package/dist/expo-test/app/_layout.d.ts +4 -0
  344. package/dist/expo-test/app/_layout.js +20 -0
  345. package/dist/expo-test/app/_layout.js.map +1 -0
  346. package/dist/expo-test/app/modal.d.ts +1 -0
  347. package/dist/expo-test/app/modal.js +26 -0
  348. package/dist/expo-test/app/modal.js.map +1 -0
  349. package/dist/expo-test/components/external-link.d.ts +4 -0
  350. package/dist/expo-test/components/external-link.js +16 -0
  351. package/dist/expo-test/components/external-link.js.map +1 -0
  352. package/dist/expo-test/components/haptic-tab.d.ts +1 -0
  353. package/dist/expo-test/components/haptic-tab.js +13 -0
  354. package/dist/expo-test/components/haptic-tab.js.map +1 -0
  355. package/dist/expo-test/components/hello-wave.d.ts +1 -0
  356. package/dist/expo-test/components/hello-wave.js +17 -0
  357. package/dist/expo-test/components/hello-wave.js.map +1 -0
  358. package/dist/expo-test/components/parallax-scroll-view.d.ts +5 -0
  359. package/dist/expo-test/components/parallax-scroll-view.js +51 -0
  360. package/dist/expo-test/components/parallax-scroll-view.js.map +1 -0
  361. package/dist/expo-test/components/themed-text.d.ts +7 -0
  362. package/dist/expo-test/components/themed-text.js +41 -0
  363. package/dist/expo-test/components/themed-text.js.map +1 -0
  364. package/dist/expo-test/components/themed-view.d.ts +6 -0
  365. package/dist/expo-test/components/themed-view.js +8 -0
  366. package/dist/expo-test/components/themed-view.js.map +1 -0
  367. package/dist/expo-test/components/ui/collapsible.d.ts +4 -0
  368. package/dist/expo-test/components/ui/collapsible.js +32 -0
  369. package/dist/expo-test/components/ui/collapsible.js.map +1 -0
  370. package/dist/expo-test/components/ui/icon-symbol.d.ts +11 -0
  371. package/dist/expo-test/components/ui/icon-symbol.ios.d.ts +7 -0
  372. package/dist/expo-test/components/ui/icon-symbol.ios.js +12 -0
  373. package/dist/expo-test/components/ui/icon-symbol.ios.js.map +1 -0
  374. package/dist/expo-test/components/ui/icon-symbol.js +23 -0
  375. package/dist/expo-test/components/ui/icon-symbol.js.map +1 -0
  376. package/dist/expo-test/constants/theme.d.ts +26 -0
  377. package/dist/expo-test/constants/theme.js +51 -0
  378. package/dist/expo-test/constants/theme.js.map +1 -0
  379. package/dist/expo-test/eslint.config.d.ts +2 -0
  380. package/dist/expo-test/eslint.config.js +11 -0
  381. package/dist/expo-test/eslint.config.js.map +1 -0
  382. package/dist/expo-test/hooks/use-color-scheme.d.ts +1 -0
  383. package/dist/expo-test/hooks/use-color-scheme.js +3 -0
  384. package/dist/expo-test/hooks/use-color-scheme.js.map +1 -0
  385. package/dist/expo-test/hooks/use-color-scheme.web.d.ts +4 -0
  386. package/dist/expo-test/hooks/use-color-scheme.web.js +18 -0
  387. package/dist/expo-test/hooks/use-color-scheme.web.js.map +1 -0
  388. package/dist/expo-test/hooks/use-theme-color.d.ts +1 -0
  389. package/dist/expo-test/hooks/use-theme-color.js +18 -0
  390. package/dist/expo-test/hooks/use-theme-color.js.map +1 -0
  391. package/dist/expo-test/scripts/reset-project.d.ts +2 -0
  392. package/dist/expo-test/scripts/reset-project.js +98 -0
  393. package/dist/expo-test/scripts/reset-project.js.map +1 -0
  394. package/dist/jest.config.d.ts +21 -0
  395. package/dist/jest.config.js +18 -0
  396. package/dist/jest.config.js.map +1 -0
  397. package/dist/server.d.ts +1 -8
  398. package/dist/server.js +13 -8
  399. package/dist/server.js.map +1 -1
  400. package/dist/socket_test.d.ts +1 -0
  401. package/dist/socket_test.js +22 -0
  402. package/dist/socket_test.js.map +1 -0
  403. package/dist/test.d.ts +1 -0
  404. package/dist/test.js +5 -0
  405. package/dist/test.js.map +1 -0
  406. package/dist/test_client.d.ts +1 -0
  407. package/dist/test_client.js +24 -0
  408. package/dist/test_client.js.map +1 -0
  409. package/dist/test_lib.d.ts +12 -0
  410. package/dist/test_lib.js +83 -0
  411. package/dist/test_lib.js.map +1 -0
  412. package/dist/test_server.d.ts +1 -0
  413. package/dist/test_server.js +52 -0
  414. package/dist/test_server.js.map +1 -0
  415. package/dist/tests/dem.test.d.ts +1 -0
  416. package/dist/tests/dem.test.js +339 -0
  417. package/dist/tests/dem.test.js.map +1 -0
  418. package/expo-test/app/(tabs)/_layout.d.ts +2 -0
  419. package/expo-test/app/(tabs)/_layout.js +24 -0
  420. package/expo-test/app/(tabs)/_layout.js.map +1 -0
  421. package/expo-test/app/(tabs)/explore.d.ts +1 -0
  422. package/expo-test/app/(tabs)/explore.js +92 -0
  423. package/expo-test/app/(tabs)/explore.js.map +1 -0
  424. package/expo-test/app/(tabs)/index.d.ts +1 -0
  425. package/expo-test/app/(tabs)/index.js +78 -0
  426. package/expo-test/app/(tabs)/index.js.map +1 -0
  427. package/expo-test/app/_layout.d.ts +5 -0
  428. package/expo-test/app/_layout.js +19 -0
  429. package/expo-test/app/_layout.js.map +1 -0
  430. package/expo-test/app/modal.d.ts +1 -0
  431. package/expo-test/app/modal.js +25 -0
  432. package/expo-test/app/modal.js.map +1 -0
  433. package/expo-test/components/external-link.d.ts +7 -0
  434. package/expo-test/components/external-link.js +15 -0
  435. package/expo-test/components/external-link.js.map +1 -0
  436. package/expo-test/components/haptic-tab.d.ts +2 -0
  437. package/expo-test/components/haptic-tab.js +12 -0
  438. package/expo-test/components/haptic-tab.js.map +1 -0
  439. package/expo-test/components/hello-wave.d.ts +1 -0
  440. package/expo-test/components/hello-wave.js +16 -0
  441. package/expo-test/components/hello-wave.js.map +1 -0
  442. package/expo-test/components/parallax-scroll-view.d.ts +10 -0
  443. package/expo-test/components/parallax-scroll-view.js +50 -0
  444. package/expo-test/components/parallax-scroll-view.js.map +1 -0
  445. package/expo-test/components/themed-text.d.ts +7 -0
  446. package/expo-test/components/themed-text.js +40 -0
  447. package/expo-test/components/themed-text.js.map +1 -0
  448. package/expo-test/components/themed-view.d.ts +6 -0
  449. package/expo-test/components/themed-view.js +7 -0
  450. package/expo-test/components/themed-view.js.map +1 -0
  451. package/expo-test/components/ui/collapsible.d.ts +4 -0
  452. package/expo-test/components/ui/collapsible.js +31 -0
  453. package/expo-test/components/ui/collapsible.js.map +1 -0
  454. package/expo-test/components/ui/icon-symbol.d.ts +25 -0
  455. package/expo-test/components/ui/icon-symbol.ios.d.ts +9 -0
  456. package/expo-test/components/ui/icon-symbol.ios.js +11 -0
  457. package/expo-test/components/ui/icon-symbol.ios.js.map +1 -0
  458. package/expo-test/components/ui/icon-symbol.js +22 -0
  459. package/expo-test/components/ui/icon-symbol.js.map +1 -0
  460. package/expo-test/constants/theme.d.ts +32 -0
  461. package/expo-test/constants/theme.js +50 -0
  462. package/expo-test/constants/theme.js.map +1 -0
  463. package/expo-test/eslint.config.d.ts +2 -0
  464. package/expo-test/eslint.config.js +11 -0
  465. package/expo-test/eslint.config.js.map +1 -0
  466. package/expo-test/hooks/use-color-scheme.d.ts +1 -0
  467. package/expo-test/hooks/use-color-scheme.js +2 -0
  468. package/expo-test/hooks/use-color-scheme.js.map +1 -0
  469. package/expo-test/hooks/use-color-scheme.web.d.ts +4 -0
  470. package/expo-test/hooks/use-color-scheme.web.js +17 -0
  471. package/expo-test/hooks/use-color-scheme.web.js.map +1 -0
  472. package/expo-test/hooks/use-theme-color.d.ts +9 -0
  473. package/expo-test/hooks/use-theme-color.js +17 -0
  474. package/expo-test/hooks/use-theme-color.js.map +1 -0
  475. package/expo-test/scripts/reset-project.d.ts +2 -0
  476. package/expo-test/scripts/reset-project.js +98 -0
  477. package/expo-test/scripts/reset-project.js.map +1 -0
  478. package/index.d.ts +4 -0
  479. package/index.js +5 -0
  480. package/index.js.map +1 -0
  481. package/jest.config.d.ts +3 -0
  482. package/jest.config.js +17 -0
  483. package/jest.config.js.map +1 -0
  484. package/package.json +23 -42
  485. package/server.d.ts +8 -0
  486. package/server.js +9 -0
  487. package/server.js.map +1 -0
  488. package/{dist/sync → sync}/ClientStateReconciler.d.ts +20 -0
  489. package/{dist/sync → sync}/ClientStateReconciler.js +20 -0
  490. package/sync/ClientStateReconciler.js.map +1 -0
  491. package/{dist/sync → sync}/ServerChangeTracker.d.ts +46 -0
  492. package/{dist/sync → sync}/ServerChangeTracker.js +46 -0
  493. package/sync/ServerChangeTracker.js.map +1 -0
  494. package/sync/storage/IndexedDbStorageAdapter.d.ts +53 -0
  495. package/{dist/sync → sync}/storage/IndexedDbStorageAdapter.js +31 -0
  496. package/sync/storage/IndexedDbStorageAdapter.js.map +1 -0
  497. package/sync/storage/LocalStorageAdapter.d.ts +59 -0
  498. package/{dist/sync → sync}/storage/LocalStorageAdapter.js +32 -0
  499. package/sync/storage/LocalStorageAdapter.js.map +1 -0
  500. package/sync/storage/MemoryStorageAdapter.d.ts +34 -0
  501. package/sync/storage/MemoryStorageAdapter.js +45 -0
  502. package/sync/storage/MemoryStorageAdapter.js.map +1 -0
  503. package/version.d.ts +21 -0
  504. package/version.js +22 -0
  505. package/version.js.map +1 -0
  506. package/README.md +0 -18
  507. package/dist/sync/ClientStateReconciler.js.map +0 -1
  508. package/dist/sync/ServerChangeTracker.js.map +0 -1
  509. package/dist/sync/storage/IndexedDbStorageAdapter.d.ts +0 -22
  510. package/dist/sync/storage/IndexedDbStorageAdapter.js.map +0 -1
  511. package/dist/sync/storage/LocalStorageAdapter.d.ts +0 -27
  512. package/dist/sync/storage/LocalStorageAdapter.js.map +0 -1
  513. package/dist/sync/storage/MemoryStorageAdapter.d.ts +0 -13
  514. package/dist/sync/storage/MemoryStorageAdapter.js +0 -25
  515. package/dist/sync/storage/MemoryStorageAdapter.js.map +0 -1
  516. package/dist/tsconfig.tsbuildinfo +0 -1
  517. /package/{dist/sync → sync}/index.d.ts +0 -0
  518. /package/{dist/sync → sync}/index.js +0 -0
  519. /package/{dist/sync → sync}/index.js.map +0 -0
  520. /package/{dist/sync → sync}/storage/IClientStorageAdapter.d.ts +0 -0
  521. /package/{dist/sync → sync}/storage/IClientStorageAdapter.js +0 -0
  522. /package/{dist/sync → sync}/storage/IClientStorageAdapter.js.map +0 -0
  523. /package/{dist/sync → sync}/types.d.ts +0 -0
  524. /package/{dist/sync → sync}/types.js +0 -0
  525. /package/{dist/sync → sync}/types.js.map +0 -0
@@ -0,0 +1,911 @@
1
+ import "reflect-metadata";
2
+ import _ from "lodash";
3
+ import { EVENT_INTERNAL_PRE_LOADED, EVENT_DELETE, EVENT_GET, EVENT_NEW, EVENT_UPDATE, globalCache, DEMError, DEMErrorCode, toDEMError, } from "./CommonTypes.js";
4
+ import { ObjectId } from "bson";
5
+ export class AutoUpdatedClientObject {
6
+ entry;
7
+ socket;
8
+ data;
9
+ isServer = false;
10
+ loggers;
11
+ isLoading = true;
12
+ loadError;
13
+ isLoadingReferences = true;
14
+ checkedMissingProperties;
15
+ emitter;
16
+ properties;
17
+ classParam;
18
+ className;
19
+ parentManager;
20
+ static _emitterCounter = 0;
21
+ EmitterID = `dem_e_${++AutoUpdatedClientObject._emitterCounter}`;
22
+ toChangeOnParents;
23
+ callbacks;
24
+ loadReferencesAsync = async () => {
25
+ try {
26
+ if (!this.isLoaded) {
27
+ await this.waitForPreloaded();
28
+ }
29
+ this.generateSettersAndGetters();
30
+ if (this.isServer) {
31
+ await this.loadForceReferences();
32
+ if (this.toChangeOnParents) {
33
+ for (const thing of this.toChangeOnParents) {
34
+ await this.setValue__(thing.key, thing.value, true, false, false, true);
35
+ }
36
+ }
37
+ }
38
+ }
39
+ catch (error) {
40
+ // Fix 3: Enhanced diagnostics with stack trace
41
+ this.loggers.error?.("Error loading references: " +
42
+ (error instanceof Error ? error.message + "\n" + error.stack : String(error)));
43
+ }
44
+ finally {
45
+ this.isLoadingReferences = false;
46
+ }
47
+ };
48
+ /**
49
+ * Initializes an AutoUpdatedClientObject instance.
50
+ *
51
+ * @param classParam - Constructor of the client object entity.
52
+ * @param socket - Socket.IO client socket connection.
53
+ * @param data - Entity identifier string or initial data object.
54
+ * @param loggers - Logging interfaces.
55
+ * @param className - Managed entity class name.
56
+ * @param parentManager - Host client manager.
57
+ * @param callback - Event callbacks interface.
58
+ * @param emitter - Shared event emitter.
59
+ * @param isServer - Flag indicating whether running on server runtime.
60
+ * @throws {DEMError} Throws DEMErrorCode.MISSING_ARGUMENT when required parameters are omitted.
61
+ */
62
+ constructor(classParam, socket, data, loggers, className, parentManager, callback, emitter, isServer = false) {
63
+ if (!classParam ||
64
+ !socket ||
65
+ !data ||
66
+ !loggers ||
67
+ !className ||
68
+ !parentManager ||
69
+ !emitter) {
70
+ this.classParam = classParam;
71
+ this.socket = socket;
72
+ this.data = data;
73
+ this.loggers = loggers;
74
+ this.className = className;
75
+ this.parentManager = parentManager;
76
+ this.callbacks = callback;
77
+ this.emitter = emitter;
78
+ this.properties = undefined;
79
+ if (!classParam &&
80
+ !socket &&
81
+ !data &&
82
+ !loggers &&
83
+ !className &&
84
+ !parentManager &&
85
+ !callback &&
86
+ !emitter)
87
+ return;
88
+ else
89
+ throw new DEMError(DEMErrorCode.MISSING_ARGUMENT, "Missing arguments for AutoUpdatedClientObject: " + className);
90
+ }
91
+ this.classParam = classParam;
92
+ this.socket = socket;
93
+ this.isServer = isServer;
94
+ this.emitter = emitter;
95
+ this.isLoadingReferences = true;
96
+ this.isLoading = true;
97
+ this.parentManager = parentManager;
98
+ this.className = className;
99
+ if (classParam) {
100
+ const meta = setupClassAccessors(classParam);
101
+ this.properties = meta.properties;
102
+ }
103
+ else {
104
+ this.properties = [];
105
+ }
106
+ this.callbacks = callback;
107
+ this.loggers = {
108
+ debug: (s) => loggers.debug?.(`[DEM - ${this.className}: ${this.data?._id ?? this._id ?? "not loaded"}] ${s}`),
109
+ info: (s) => loggers.info?.(`[DEM - ${this.className}: ${this.data?._id ?? this._id ?? "not loaded"}] ${s}`),
110
+ warn: (s) => loggers.warn?.(`[DEM - ${this.className}: ${this.data?._id ?? this._id ?? "not loaded"}] ${s}`),
111
+ error: (s) => loggers.error?.(`[DEM - ${this.className}: ${this.data?._id ?? this._id ?? "not loaded"}] ${s}`),
112
+ };
113
+ if (typeof data === "string") {
114
+ this.data = { _id: data };
115
+ if (this.isServer) {
116
+ this.isLoading = false;
117
+ this.generateSettersAndGetters();
118
+ return;
119
+ }
120
+ this.socket.emit(EVENT_GET + this.className + data, null, (res) => {
121
+ if (!res.success) {
122
+ this.isLoading = false;
123
+ this.loadError = res.message;
124
+ this.loggers.error?.("Could not load data from server: " + res.message);
125
+ this.emitter.emit(EVENT_INTERNAL_PRE_LOADED + this.EmitterID, true, res.message);
126
+ return;
127
+ }
128
+ this.data = this.handleDataCleanup(res.data);
129
+ this.generateSettersAndGetters();
130
+ this.isLoading = false;
131
+ this.emitter.emit(EVENT_INTERNAL_PRE_LOADED + this.EmitterID);
132
+ this.openSockets();
133
+ });
134
+ }
135
+ else {
136
+ this.isLoading = true;
137
+ this.data = this.handleDataCleanup(data);
138
+ if ((!this.data._id || this.data._id === "") && !this.isServer) {
139
+ this.handleNewObject(this.data);
140
+ }
141
+ else {
142
+ this.isLoading = false;
143
+ if (!this.isServer)
144
+ this.openSockets();
145
+ }
146
+ }
147
+ this.generateSettersAndGetters();
148
+ Promise.resolve().then(() => {
149
+ this.generateSettersAndGetters();
150
+ });
151
+ }
152
+ /**
153
+ * Normalizes reference fields in entity data into string IDs.
154
+ *
155
+ * @param data - Entity data payload.
156
+ * @returns Cleaned entity data payload.
157
+ */
158
+ handleDataCleanup(data) {
159
+ if (!data || typeof data !== "object")
160
+ return data;
161
+ const meta = this.classParam ? setupClassAccessors(this.classParam) : null;
162
+ const refProps = meta ? meta.refProps : null;
163
+ if (!refProps || refProps.size === 0)
164
+ return data;
165
+ const dataAsRecord = data;
166
+ for (const key of refProps) {
167
+ const val = dataAsRecord[key];
168
+ if (!val)
169
+ continue;
170
+ if (Array.isArray(val)) {
171
+ let needsNormalization = false;
172
+ for (let i = 0; i < val.length; i++) {
173
+ const item = val[i];
174
+ if (item && typeof item === "object") {
175
+ needsNormalization = true;
176
+ break;
177
+ }
178
+ }
179
+ if (needsNormalization) {
180
+ dataAsRecord[key] = val.map((obj) => obj?._id?.toString() ??
181
+ obj?.toString());
182
+ }
183
+ }
184
+ else if (typeof val === "object") {
185
+ dataAsRecord[key] =
186
+ val?._id?.toString() ??
187
+ val?.toString();
188
+ }
189
+ }
190
+ return data;
191
+ }
192
+ /**
193
+ * Pauses execution until the object finishes asynchronous preloading.
194
+ *
195
+ * @param timeoutMs - Maximum milliseconds to wait before rejecting.
196
+ * @throws {DEMError} Throws DEMErrorCode.PRELOAD_TIMEOUT on timeout or OBJECT_LOAD_FAILED on failure.
197
+ */
198
+ async waitForPreloaded(timeoutMs = 15000) {
199
+ if (this.loadError)
200
+ throw new DEMError(DEMErrorCode.OBJECT_LOAD_FAILED, this.loadError);
201
+ if (this.isLoaded)
202
+ return;
203
+ await new Promise((resolve, reject) => {
204
+ const timer = setTimeout(() => {
205
+ const errorMsg = `Timeout waiting for object preloading (${this.className})`;
206
+ this.loadError = errorMsg;
207
+ this.isLoading = false;
208
+ reject(new DEMError(DEMErrorCode.PRELOAD_TIMEOUT, errorMsg));
209
+ }, timeoutMs);
210
+ this.emitter.once(EVENT_INTERNAL_PRE_LOADED + this.EmitterID, (failed, reason) => {
211
+ clearTimeout(timer);
212
+ if (failed)
213
+ reject(new DEMError(DEMErrorCode.OBJECT_LOAD_FAILED, reason));
214
+ else
215
+ resolve();
216
+ });
217
+ });
218
+ }
219
+ /**
220
+ * Emits creation event to the server socket and awaits populated entity response.
221
+ *
222
+ * @param data - Initial data payload.
223
+ */
224
+ handleNewObject(data) {
225
+ this.isLoading = true;
226
+ if (!this.socket) {
227
+ const errorMsg = `Cannot create ${this.className}: Socket is missing.`;
228
+ this.loadError = errorMsg;
229
+ this.isLoading = false;
230
+ this.loggers.error?.(errorMsg);
231
+ this.emitter.emit(EVENT_INTERNAL_PRE_LOADED + this.EmitterID, true, errorMsg);
232
+ return;
233
+ }
234
+ let payload = data;
235
+ try {
236
+ if (data && typeof data === "object") {
237
+ payload = JSON.parse(JSON.stringify(data));
238
+ }
239
+ }
240
+ catch (err) {
241
+ this.loggers.warn?.(`Failed to JSON-serialize creation payload for ${this.className}, falling back to raw data: ${err instanceof Error ? err.message : String(err)}`);
242
+ }
243
+ this.socket.emit(EVENT_NEW + this.className, payload, (res) => {
244
+ if (this.loadError)
245
+ return;
246
+ if (!res) {
247
+ const errorMsg = `No response received from server when creating ${this.className}`;
248
+ this.isLoading = false;
249
+ this.loadError = errorMsg;
250
+ this.loggers.error?.(errorMsg);
251
+ this.emitter.emit(EVENT_INTERNAL_PRE_LOADED + this.EmitterID, true, errorMsg);
252
+ return;
253
+ }
254
+ if (!res.success) {
255
+ this.isLoading = false;
256
+ this.loadError = res.message;
257
+ this.loggers.error?.("Could not create data on server: " + res.message);
258
+ this.emitter.emit(EVENT_INTERNAL_PRE_LOADED + this.EmitterID, true, res.message);
259
+ return;
260
+ }
261
+ this.data = res.data;
262
+ this.generateSettersAndGetters();
263
+ this.isLoading = false;
264
+ this.emitter.emit(EVENT_INTERNAL_PRE_LOADED + this.EmitterID);
265
+ if (!this.isServer)
266
+ this.openSockets();
267
+ });
268
+ }
269
+ /**
270
+ * Returns a deep clone of the entity's extracted data with reference objects converted to IDs.
271
+ *
272
+ * @returns Serialized entity representation.
273
+ */
274
+ get extractedData() {
275
+ const extracted = processIsRefProperties(this.data, this, null, [], {}, this.loggers).newData;
276
+ return _.cloneDeep(extracted);
277
+ }
278
+ /**
279
+ * Indicates whether the entity has finished loading its data.
280
+ *
281
+ * @returns True if loaded.
282
+ */
283
+ get isLoaded() {
284
+ return !this.isLoading;
285
+ }
286
+ /**
287
+ * Asynchronously awaits preloading and loads all missing reference links.
288
+ *
289
+ * @returns Promise resolving to true when completed.
290
+ */
291
+ async isPreLoadedAsync() {
292
+ await this.loadReferencesAsync();
293
+ this.generateSettersAndGetters();
294
+ return true;
295
+ }
296
+ /**
297
+ * Identifies and connects missing cross-entity references on server startup.
298
+ */
299
+ async loadMissingReferences() {
300
+ if (!this.isServer)
301
+ return;
302
+ this.checkedMissingProperties = {};
303
+ await this.checkForMissingRefs();
304
+ this.generateSettersAndGetters();
305
+ }
306
+ openSockets() {
307
+ const id = this.data?._id ?? this._id;
308
+ const event = EVENT_UPDATE + this.className + id.toString();
309
+ this.socket.on(event, async (update, ack) => {
310
+ const res = await this.handleUpdateRequest(update);
311
+ if (ack && typeof ack === "function")
312
+ ack(res);
313
+ return res;
314
+ });
315
+ }
316
+ async handleUpdateRequest(update) {
317
+ try {
318
+ await this.setValue__(update.key, update.value, true);
319
+ if (this.isLoaded)
320
+ this.callbacks.update(this, update.key);
321
+ return { success: true, data: undefined, message: "" };
322
+ }
323
+ catch (error) {
324
+ this.loggers.error?.(`[${this.data._id}] Error applying patch: ${error instanceof Error ? error.message : String(error)}`);
325
+ return {
326
+ success: false,
327
+ message: "Error applying update: " +
328
+ (error instanceof Error ? error.message : String(error)),
329
+ };
330
+ }
331
+ }
332
+ _gettersGenerated = false;
333
+ writeQueue = Promise.resolve();
334
+ get updateEventName() {
335
+ const id = this.data?._id ?? this._id;
336
+ return EVENT_UPDATE + this.className + (id ? id.toString() : "");
337
+ }
338
+ getRawId(key) {
339
+ if (!this.data)
340
+ return undefined;
341
+ const val = this.data[key];
342
+ if (!val)
343
+ return undefined;
344
+ if (typeof val === "string")
345
+ return val;
346
+ if (typeof val === "object" && val !== null && val._id) {
347
+ return val._id.toString();
348
+ }
349
+ return String(val);
350
+ }
351
+ generateSettersAndGetters() {
352
+ if (this.classParam) {
353
+ setupClassAccessors(this.classParam);
354
+ }
355
+ if (this.properties) {
356
+ for (const key of this.properties) {
357
+ if (typeof key === "string" && Object.hasOwn(this, key)) {
358
+ delete this[key];
359
+ }
360
+ }
361
+ }
362
+ }
363
+ getValue(key_) {
364
+ const key = key_;
365
+ const parts = key.split(".");
366
+ let value = this;
367
+ for (const part of parts) {
368
+ if (value === undefined || value === null)
369
+ return undefined;
370
+ const nextValue = value[part];
371
+ if (nextValue !== undefined) {
372
+ value = nextValue;
373
+ }
374
+ else if (value.data &&
375
+ value.data[part] !== undefined) {
376
+ value = value.data[part];
377
+ }
378
+ else {
379
+ return undefined;
380
+ }
381
+ }
382
+ return value;
383
+ }
384
+ /**
385
+ * Resolves reference pointer ID to instantiated entity instance across caches and managers.
386
+ *
387
+ * @param id - Entity ID or ObjectId.
388
+ * @param key - Property key referencing the entity.
389
+ * @returns Resolved entity instance or undefined.
390
+ */
391
+ findReference(id, key) {
392
+ if (!id)
393
+ return undefined;
394
+ const idStr = typeof id === "string" ? id : id.toString();
395
+ const cached = globalCache.objects[idStr];
396
+ if (cached?.object)
397
+ return cached.object;
398
+ const cacheKey = `${this.className}:${key}`;
399
+ const cachedManager = this.parentManager?.cache?.references?.[cacheKey];
400
+ if (cachedManager) {
401
+ const res = cachedManager.getObject(idStr);
402
+ if (res)
403
+ return res;
404
+ }
405
+ if (this.parentManager?.managers) {
406
+ for (const manager of Object.values(this.parentManager.managers)) {
407
+ const result = manager.getObject(idStr);
408
+ if (result) {
409
+ if (this.parentManager.cache?.references) {
410
+ this.parentManager.cache.references[cacheKey] = manager;
411
+ }
412
+ return result;
413
+ }
414
+ }
415
+ }
416
+ return undefined;
417
+ }
418
+ /**
419
+ * Mutates property value and synchronizes change to the server via socket.
420
+ *
421
+ * @param key - Property key to modify.
422
+ * @param val - Value to assign.
423
+ * @returns Promise resolving to modification result.
424
+ */
425
+ async setValue(key, val) {
426
+ return await this.setValue__(key, val);
427
+ }
428
+ /**
429
+ * Internal setter with writeQueue serialization ensuring sequential updates.
430
+ *
431
+ * @param key - Property key.
432
+ * @param val - Value to assign.
433
+ * @param silent - Whether socket broadcast is bypassed.
434
+ * @param noGet - Whether local update bypasses get.
435
+ * @param noUpdate - Whether onUpdate hook is bypassed.
436
+ * @param isParentUpdate - Whether mutation originated from parent.
437
+ * @returns Promise resolving to operation outcome.
438
+ */
439
+ async setValue__(key, val, silent = false, noGet = false, noUpdate = false, isParentUpdate = false) {
440
+ this.writeQueue = this.writeQueue
441
+ .catch(() => { })
442
+ .then(() => this.setValueQueueInternal(key, val, silent, noGet, noUpdate, isParentUpdate));
443
+ return this.writeQueue;
444
+ }
445
+ async setValueQueueInternal(key, val, silent = false, noGet = false, noUpdate = false, isParentUpdate = false) {
446
+ const rootProp = key.split(".")[0];
447
+ if (key === "__proto__" ||
448
+ key === "constructor" ||
449
+ key === "prototype" ||
450
+ (this.properties && !this.properties.includes(rootProp) && rootProp !== "_id")) {
451
+ return { success: false, msg: `Invalid property key: ${key}` };
452
+ }
453
+ try {
454
+ const isRef = getMetadataRecursive("isRef", this, key);
455
+ const pointer = getMetadataRecursive("refsTo", this, key);
456
+ if (pointer && !isParentUpdate && !silent && !this.isServer) {
457
+ throw new DEMError(DEMErrorCode.CANNOT_SET_REF_DIRECTLY, "Cannot set value of a reference pointer directly.");
458
+ }
459
+ let valueToStore = val;
460
+ if (isRef) {
461
+ valueToStore = Array.isArray(val)
462
+ ? val.map((v) => v?._id?.toString() ??
463
+ v?.toString() ??
464
+ v)
465
+ : (val?._id?.toString() ??
466
+ val?.toString() ??
467
+ val);
468
+ }
469
+ const currentVal = this.getValue(key);
470
+ const currentValId = Array.isArray(currentVal)
471
+ ? currentVal.map((v) => v?._id?.toString() ??
472
+ v?.toString() ??
473
+ v)
474
+ : (currentVal?._id?.toString() ??
475
+ currentVal?.toString());
476
+ if (_.isEqual(currentValId, valueToStore))
477
+ return { success: true, msg: "Successfully set " + key + " to " + val };
478
+ const path = key.split(".");
479
+ if (path.length > 1) {
480
+ let obj = this.data;
481
+ for (let i = 0; i < path.length - 1; i++) {
482
+ const currentKey = path[i];
483
+ const valAtKey = obj[currentKey];
484
+ if (typeof valAtKey === "string" ||
485
+ (valAtKey && ObjectId.isValid(valAtKey))) {
486
+ const ref = await this.resolveReference(String(valAtKey));
487
+ if (!ref)
488
+ throw new DEMError(DEMErrorCode.REFERENCE_RESOLUTION_FAILED, "Could not resolve reference on path: " + key);
489
+ return await ref.setValue(path.slice(i + 1).join("."), val);
490
+ }
491
+ obj = obj[currentKey];
492
+ }
493
+ }
494
+ const res = await this.setValueInternal(key, valueToStore, silent, noUpdate);
495
+ if (res.success) {
496
+ const pathArr = key.split(".");
497
+ let obj = this.data;
498
+ for (let i = 0; i < pathArr.length - 1; i++) {
499
+ obj = obj[pathArr[i]];
500
+ }
501
+ obj[pathArr[pathArr.length - 1]] = valueToStore;
502
+ if (this.isServer) {
503
+ await this.findAndLoadReferences(key, valueToStore);
504
+ if (isRef && this.parentManager.isLoaded)
505
+ await this.contactChildren();
506
+ }
507
+ if (this.isLoaded) {
508
+ this.callbacks.update(this, key);
509
+ await this.onUpdate(noUpdate, key);
510
+ }
511
+ }
512
+ return {
513
+ ...res,
514
+ msg: res.msg ?? "Successfully set " + key + " to " + val,
515
+ };
516
+ }
517
+ catch (error) {
518
+ this.loggers.error?.(`Error setting value ${key}: ${error instanceof Error ? error.message : String(error)}`);
519
+ const demErr = error instanceof DEMError
520
+ ? error
521
+ : toDEMError(error, DEMErrorCode.DB_SAVE_FAILED);
522
+ return {
523
+ success: false,
524
+ code: demErr.code,
525
+ msg: demErr.message,
526
+ };
527
+ }
528
+ }
529
+ async setValueInternal(key, value, silent = false, noUpdate = false) {
530
+ if (silent)
531
+ return { success: true, msg: "Silent" };
532
+ return new Promise((resolve) => {
533
+ const id = this.data?._id ?? this._id;
534
+ this.socket.emit(EVENT_UPDATE + this.className + id, { _id: id.toString(), key, value }, (res) => {
535
+ resolve({
536
+ success: res.success,
537
+ code: res.code,
538
+ msg: res.message ?? (res.success ? "Success" : "Error"),
539
+ });
540
+ });
541
+ });
542
+ }
543
+ makeUpdate(key, value) {
544
+ const id = this.data?._id ?? this._id;
545
+ if (!id) {
546
+ this.loggers.error?.(`Probably missing the identifier ['_id'] again: ${key} = ${value}`);
547
+ throw new DEMError(DEMErrorCode.MISSING_ID, `Cannot make update for ${this.className} because _id is missing.`);
548
+ }
549
+ return { _id: id.toString(), key, value };
550
+ }
551
+ async resolveReference(id) {
552
+ for (const manager of Object.values(this.parentManager.managers)) {
553
+ const obj = manager.getObject(id);
554
+ if (obj)
555
+ return obj;
556
+ }
557
+ return null;
558
+ }
559
+ async findAndLoadReferences(lastPath, value) {
560
+ const isRef = getMetadataRecursive("isRef", this, lastPath);
561
+ if (isRef) {
562
+ for (const id of Array.isArray(value) ? value : [value]) {
563
+ if (!id)
564
+ continue;
565
+ let result;
566
+ for (const manager of Object.values(this.parentManager.managers)) {
567
+ result = manager.getObject(id?.toString());
568
+ if (result)
569
+ break;
570
+ }
571
+ if (result && result.parentManager.isLoaded && typeof result.loadMissingReferences === "function") {
572
+ await result.loadMissingReferences();
573
+ }
574
+ }
575
+ }
576
+ }
577
+ async wipeSelf() {
578
+ if (this.data.Wiped)
579
+ return;
580
+ const id = this.data?._id ?? this._id;
581
+ const _id = id ? id.toString() : "unknown";
582
+ for (const key of Object.keys(this.data)) {
583
+ delete this.data[key];
584
+ }
585
+ this.data = { Wiped: true };
586
+ this.loggers.info?.(`[${_id}] ${this.className} object wiped`);
587
+ }
588
+ destroyImmediate() {
589
+ this.wipeSelf();
590
+ }
591
+ async loadForceReferences(obj = this.data, proto = this, alreadySeen = new Set()) {
592
+ const meta = this.classParam ? setupClassAccessors(this.classParam) : null;
593
+ const props = obj === this.data && this.properties
594
+ ? this.properties
595
+ : Reflect.getMetadata("props", proto) ||
596
+ Reflect.getMetadata("props", Object.getPrototypeOf(proto)) ||
597
+ [];
598
+ for (const key of props) {
599
+ if (typeof key !== "string")
600
+ continue;
601
+ const pointer = meta?.refsToMap.get(key) ||
602
+ Reflect.getMetadata("refsTo", proto, key) ||
603
+ (proto ? Reflect.getMetadata("refsTo", Object.getPrototypeOf(proto), key) : undefined);
604
+ if (pointer &&
605
+ obj === (this.data) &&
606
+ obj[key] &&
607
+ !alreadySeen.has(obj)) {
608
+ await this.createdWithParent(pointer.split(":"), obj[key]);
609
+ }
610
+ if (obj[key] && !alreadySeen.has(obj[key]))
611
+ alreadySeen.add(obj[key]);
612
+ const val = obj[key];
613
+ if (val &&
614
+ typeof val === "object" &&
615
+ !(val instanceof Date) &&
616
+ !(val instanceof ObjectId)) {
617
+ const nestedProto = Object.getPrototypeOf(val);
618
+ if (nestedProto && !alreadySeen.has(val)) {
619
+ alreadySeen.add(val);
620
+ await this.loadForceReferences(val, nestedProto, alreadySeen);
621
+ }
622
+ }
623
+ }
624
+ }
625
+ async createdWithParent(pointer, parent) {
626
+ if (pointer.length !== 2)
627
+ return;
628
+ const parentId = parent._id?.toString() ?? parent.toString();
629
+ const manager = this.parentManager.managers[pointer[0]];
630
+ if (!manager) {
631
+ this.loggers.warn?.(`createdWithParent: Manager not found for ${pointer[0]}.`);
632
+ return;
633
+ }
634
+ const obj = manager.getObject(parentId);
635
+ if (!obj) {
636
+ this.loggers.warn?.(`createdWithParent: Parent object not found for ID ${parentId} in manager ${pointer[0]}`);
637
+ return;
638
+ }
639
+ const myId = this.data._id?.toString?.() ?? String(this.data._id);
640
+ const rawData = obj.data;
641
+ const rawVal = rawData ? rawData[pointer[1]] : undefined;
642
+ if (Array.isArray(rawVal)) {
643
+ let alreadyIncluded = false;
644
+ for (let i = 0; i < rawVal.length; i++) {
645
+ const item = rawVal[i];
646
+ const idStr = item?._id?.toString?.() ?? item?.toString?.();
647
+ if (idStr === myId) {
648
+ alreadyIncluded = true;
649
+ break;
650
+ }
651
+ }
652
+ if (!alreadyIncluded) {
653
+ this.loggers.debug?.(`createdWithParent: Adding myId to parent array`);
654
+ await obj.setValue__(pointer[1], [...rawVal, myId], false, false, false, true);
655
+ }
656
+ }
657
+ else {
658
+ const currentIdStr = rawVal?._id?.toString?.() ?? rawVal?.toString?.();
659
+ if (currentIdStr !== myId) {
660
+ this.loggers.debug?.(`createdWithParent: Setting myId to parent field`);
661
+ await obj.setValue__(pointer[1], myId, false, false, false, true);
662
+ }
663
+ }
664
+ }
665
+ /**
666
+ * Destroys the entity and notifies server socket of deletion.
667
+ *
668
+ * @param once - Internal flag preventing infinite recursion.
669
+ * @returns Promise resolving to deletion outcome.
670
+ */
671
+ async destroy(once = false) {
672
+ if (!once)
673
+ return await this.parentManager.deleteObject(this.data._id.toString());
674
+ return new Promise((resolve) => {
675
+ this.socket.emit(EVENT_DELETE + this.className, this.data._id, (res) => {
676
+ resolve({
677
+ success: res.success,
678
+ code: res.code,
679
+ message: res.message ?? "",
680
+ });
681
+ });
682
+ });
683
+ }
684
+ async checkForMissingRefs() {
685
+ for (const prop of this.properties) {
686
+ const pointer = getMetadataRecursive("refsTo", this, prop.toString());
687
+ if (pointer && !this.data?.[prop]) {
688
+ const parts = pointer.split(":");
689
+ if (parts.length === 2)
690
+ await this.findMissingObjectReference(prop, parts);
691
+ }
692
+ }
693
+ }
694
+ async findMissingObjectReference(prop, pointer) {
695
+ this.checkedMissingProperties ??= {};
696
+ if (this.checkedMissingProperties[prop])
697
+ return;
698
+ this.checkedMissingProperties[prop] = true;
699
+ const ac = this.parentManager.managers[pointer[0]];
700
+ if (!ac)
701
+ return;
702
+ const targetId = this.data._id?.toString?.() ?? String(this.data._id);
703
+ const allObjects = ac.objectsAsArray;
704
+ for (let i = 0; i < allObjects.length; i++) {
705
+ const obj = allObjects[i];
706
+ const rawData = obj.data;
707
+ if (!rawData)
708
+ continue;
709
+ const val = rawData[pointer[1]];
710
+ if (!val)
711
+ continue;
712
+ if (Array.isArray(val)) {
713
+ for (let j = 0; j < val.length; j++) {
714
+ const id = val[j]?._id?.toString?.() ?? val[j]?.toString?.();
715
+ if (id === targetId) {
716
+ this.data[prop] = obj._id;
717
+ return;
718
+ }
719
+ }
720
+ }
721
+ else {
722
+ const id = val?._id?.toString?.() ?? val?.toString?.();
723
+ if (id === targetId) {
724
+ this.data[prop] = obj._id;
725
+ return;
726
+ }
727
+ }
728
+ }
729
+ }
730
+ /**
731
+ * Triggers missing reference resolution on all child referenced entities.
732
+ */
733
+ async contactChildren() {
734
+ if (!this.isServer)
735
+ return;
736
+ for (const prop of this.properties) {
737
+ const isRef = getMetadataRecursive("isRef", this, prop.toString());
738
+ const pointer = getMetadataRecursive("refsTo", this, prop.toString());
739
+ if (!isRef || pointer)
740
+ continue;
741
+ const obj = this.getValue(prop);
742
+ if (!obj)
743
+ continue;
744
+ const children = Array.isArray(obj) ? obj : [obj];
745
+ for (const child of children) {
746
+ if (child &&
747
+ typeof child
748
+ .loadMissingReferences === "function") {
749
+ await child.loadMissingReferences();
750
+ }
751
+ }
752
+ }
753
+ this.generateSettersAndGetters();
754
+ }
755
+ async onUpdate(noUpdate = false, key) {
756
+ // Placeholder for server-side override
757
+ }
758
+ async onDeletion() {
759
+ // Placeholder for server-side override
760
+ }
761
+ }
762
+ /**
763
+ * Traverses entity object and transforms referenced objects into string identifiers.
764
+ *
765
+ * @param instance - Raw entity data record.
766
+ * @param target - Reflection prototype target.
767
+ * @param prefix - Dot-notated property key prefix.
768
+ * @param allProps - Accumulated array of discovered property paths.
769
+ * @param newData - Output object receiving sanitized data.
770
+ * @param loggers - Logging interfaces.
771
+ * @returns Object containing all property paths and transformed newData.
772
+ */
773
+ export function processIsRefProperties(instance, target, prefix, allProps, newData, loggers) {
774
+ const props = Reflect.getMetadata("props", target) || [];
775
+ for (const prop of props) {
776
+ const path = prefix ? `${prefix}.${prop}` : prop;
777
+ allProps.push(path);
778
+ newData[prop] =
779
+ instance[prop] && ObjectId.isValid(instance[prop])
780
+ ? instance[prop]?.toString()
781
+ : instance[prop];
782
+ if (Reflect.getMetadata("isRef", target, prop)) {
783
+ if (Array.isArray(instance[prop]))
784
+ newData[prop] = instance[prop]
785
+ .map((item) => item?._id?.toString() ??
786
+ item?.toString())
787
+ .filter(Boolean);
788
+ else
789
+ newData[prop] =
790
+ instance[prop]?._id?.toString() ??
791
+ instance[prop]?.toString();
792
+ }
793
+ const type = Reflect.getMetadata("design:type", target, prop);
794
+ if (type?.prototype) {
795
+ const nestedProps = Reflect.getMetadata("props", type.prototype);
796
+ if (nestedProps && instance[prop]) {
797
+ newData[prop] = processIsRefProperties(instance[prop], type.prototype, path, allProps, {}, loggers).newData;
798
+ }
799
+ }
800
+ }
801
+ return { allProps, newData };
802
+ }
803
+ /**
804
+ * Compiles V8 fast-shape property getters and setters on the class prototype.
805
+ *
806
+ * @param classParam - Constructor function of the target entity class.
807
+ * @returns Cached metadata object with properties list, refProps set, and refsToMap.
808
+ */
809
+ export function setupClassAccessors(classParam) {
810
+ if (!classParam) {
811
+ return { properties: [], refProps: new Set(), refsToMap: new Map() };
812
+ }
813
+ if (classParam.__metaCache) {
814
+ return classParam.__metaCache;
815
+ }
816
+ const allProps = new Set();
817
+ const refProps = new Set();
818
+ const refsToMap = new Map();
819
+ let proto_ = classParam.prototype;
820
+ while (proto_ && proto_ !== Object.prototype) {
821
+ const props = Reflect.getMetadata("props", proto_) ||
822
+ Reflect.getOwnMetadata("props", proto_) ||
823
+ [];
824
+ for (const p of props) {
825
+ if (typeof p === "string") {
826
+ allProps.add(p);
827
+ const isRef = Reflect.getMetadata("isRef", proto_, p) || Reflect.getOwnMetadata("isRef", proto_, p);
828
+ if (isRef)
829
+ refProps.add(p);
830
+ const refsTo = Reflect.getMetadata("refsTo", proto_, p) || Reflect.getOwnMetadata("refsTo", proto_, p);
831
+ if (refsTo)
832
+ refsToMap.set(p, refsTo);
833
+ }
834
+ }
835
+ proto_ = Object.getPrototypeOf(proto_);
836
+ }
837
+ const properties = Array.from(allProps);
838
+ for (const key of properties) {
839
+ const isRef = refProps.has(key);
840
+ Object.defineProperty(classParam.prototype, key, {
841
+ get() {
842
+ if (!this.data)
843
+ return undefined;
844
+ let val = this.data[key];
845
+ if (val === null)
846
+ val = undefined;
847
+ if (isRef && val) {
848
+ if (Array.isArray(val)) {
849
+ const result = [];
850
+ for (let i = 0; i < val.length; i++) {
851
+ const item = val[i];
852
+ if (item) {
853
+ const ref = this.findReference(item, key);
854
+ if (ref)
855
+ result.push(ref);
856
+ }
857
+ }
858
+ return result;
859
+ }
860
+ else {
861
+ return this.findReference(val, key);
862
+ }
863
+ }
864
+ return val;
865
+ },
866
+ set(v) {
867
+ if (this.data) {
868
+ let valueToSet = v;
869
+ if (isRef && v) {
870
+ if (Array.isArray(v)) {
871
+ valueToSet = v.map((item) => item && item._id
872
+ ? item._id.toString()
873
+ : item?.toString());
874
+ }
875
+ else {
876
+ valueToSet = v._id
877
+ ? v._id.toString()
878
+ : v.toString();
879
+ }
880
+ }
881
+ this.data[key] = valueToSet;
882
+ }
883
+ },
884
+ enumerable: true,
885
+ configurable: true,
886
+ });
887
+ }
888
+ const meta = { properties, refProps, refsToMap };
889
+ classParam.__metaCache = meta;
890
+ classParam.__propsCache = properties;
891
+ classParam.__refPropsCache = Array.from(refProps);
892
+ return meta;
893
+ }
894
+ /**
895
+ * Traverses prototype chain recursively to resolve metadata key.
896
+ *
897
+ * @param metaKey - Reflection metadata key.
898
+ * @param proto - Prototype object.
899
+ * @param prop - Property name on prototype.
900
+ * @returns Metadata value or undefined.
901
+ */
902
+ export function getMetadataRecursive(metaKey, proto, prop) {
903
+ while (proto) {
904
+ const meta = Reflect.getMetadata(metaKey, proto, prop);
905
+ if (meta)
906
+ return meta;
907
+ proto = Object.getPrototypeOf(proto);
908
+ }
909
+ return undefined;
910
+ }
911
+ //# sourceMappingURL=AutoUpdatedClientObjectClass.js.map