@contember/binding-legacy 2.1.0-alpha.36 → 2.1.0-alpha.39

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 (390) hide show
  1. package/dist/development/index.cjs +34 -0
  2. package/dist/development/index.cjs.map +1 -0
  3. package/dist/development/index.js +28 -0
  4. package/dist/development/index.js.map +1 -0
  5. package/dist/development/src/accessorTree/NormalizedPersistedData.cjs +10 -0
  6. package/dist/development/src/accessorTree/NormalizedPersistedData.cjs.map +1 -0
  7. package/dist/development/src/accessorTree/NormalizedPersistedData.js +10 -0
  8. package/dist/development/src/accessorTree/NormalizedPersistedData.js.map +1 -0
  9. package/dist/development/src/accessors/EntityAccessorImpl.cjs +179 -0
  10. package/dist/development/src/accessors/EntityAccessorImpl.cjs.map +1 -0
  11. package/dist/development/src/accessors/EntityAccessorImpl.js +179 -0
  12. package/dist/development/src/accessors/EntityAccessorImpl.js.map +1 -0
  13. package/dist/development/src/accessors/EntityListAccessorImpl.cjs +112 -0
  14. package/dist/development/src/accessors/EntityListAccessorImpl.cjs.map +1 -0
  15. package/dist/development/src/accessors/EntityListAccessorImpl.js +112 -0
  16. package/dist/development/src/accessors/EntityListAccessorImpl.js.map +1 -0
  17. package/dist/development/src/accessors/FieldAccessorImpl.cjs +54 -0
  18. package/dist/development/src/accessors/FieldAccessorImpl.cjs.map +1 -0
  19. package/dist/development/src/accessors/FieldAccessorImpl.js +54 -0
  20. package/dist/development/src/accessors/FieldAccessorImpl.js.map +1 -0
  21. package/dist/development/src/core/AccessorErrorManager.cjs +200 -0
  22. package/dist/development/src/core/AccessorErrorManager.cjs.map +1 -0
  23. package/dist/development/src/core/AccessorErrorManager.js +200 -0
  24. package/dist/development/src/core/AccessorErrorManager.js.map +1 -0
  25. package/dist/development/src/core/Config.cjs +29 -0
  26. package/dist/development/src/core/Config.cjs.map +1 -0
  27. package/dist/development/src/core/Config.js +29 -0
  28. package/dist/development/src/core/Config.js.map +1 -0
  29. package/dist/development/src/core/DataBinding.cjs +357 -0
  30. package/dist/development/src/core/DataBinding.cjs.map +1 -0
  31. package/dist/development/src/core/DataBinding.js +357 -0
  32. package/dist/development/src/core/DataBinding.js.map +1 -0
  33. package/dist/development/src/core/DirtinessTracker.cjs +26 -0
  34. package/dist/development/src/core/DirtinessTracker.cjs.map +1 -0
  35. package/dist/development/src/core/DirtinessTracker.js +26 -0
  36. package/dist/development/src/core/DirtinessTracker.js.map +1 -0
  37. package/dist/development/src/core/ErrorsPreprocessor.cjs +180 -0
  38. package/dist/development/src/core/ErrorsPreprocessor.cjs.map +1 -0
  39. package/dist/development/src/core/ErrorsPreprocessor.js +180 -0
  40. package/dist/development/src/core/ErrorsPreprocessor.js.map +1 -0
  41. package/dist/development/src/core/EventManager.cjs +439 -0
  42. package/dist/development/src/core/EventManager.cjs.map +1 -0
  43. package/dist/development/src/core/EventManager.js +439 -0
  44. package/dist/development/src/core/EventManager.js.map +1 -0
  45. package/dist/development/src/core/MutationGenerator.cjs +670 -0
  46. package/dist/development/src/core/MutationGenerator.cjs.map +1 -0
  47. package/dist/development/src/core/MutationGenerator.js +670 -0
  48. package/dist/development/src/core/MutationGenerator.js.map +1 -0
  49. package/dist/development/src/core/QueryGenerator.cjs +110 -0
  50. package/dist/development/src/core/QueryGenerator.cjs.map +1 -0
  51. package/dist/development/src/core/QueryGenerator.js +110 -0
  52. package/dist/development/src/core/QueryGenerator.js.map +1 -0
  53. package/dist/development/src/core/RealmKeyGenerator.cjs +42 -0
  54. package/dist/development/src/core/RealmKeyGenerator.cjs.map +1 -0
  55. package/dist/development/src/core/RealmKeyGenerator.js +42 -0
  56. package/dist/development/src/core/RealmKeyGenerator.js.map +1 -0
  57. package/dist/development/src/core/RequestResponseNormalizer.cjs +136 -0
  58. package/dist/development/src/core/RequestResponseNormalizer.cjs.map +1 -0
  59. package/dist/development/src/core/RequestResponseNormalizer.js +136 -0
  60. package/dist/development/src/core/RequestResponseNormalizer.js.map +1 -0
  61. package/dist/development/src/core/StateInitializer.cjs +379 -0
  62. package/dist/development/src/core/StateInitializer.cjs.map +1 -0
  63. package/dist/development/src/core/StateInitializer.js +379 -0
  64. package/dist/development/src/core/StateInitializer.js.map +1 -0
  65. package/dist/development/src/core/TreeAugmenter.cjs +351 -0
  66. package/dist/development/src/core/TreeAugmenter.cjs.map +1 -0
  67. package/dist/development/src/core/TreeAugmenter.js +351 -0
  68. package/dist/development/src/core/TreeAugmenter.js.map +1 -0
  69. package/dist/development/src/core/TreeStore.cjs +172 -0
  70. package/dist/development/src/core/TreeStore.cjs.map +1 -0
  71. package/dist/development/src/core/TreeStore.js +172 -0
  72. package/dist/development/src/core/TreeStore.js.map +1 -0
  73. package/dist/development/src/core/exceptions/ErrorLocator.cjs +59 -0
  74. package/dist/development/src/core/exceptions/ErrorLocator.cjs.map +1 -0
  75. package/dist/development/src/core/exceptions/ErrorLocator.js +59 -0
  76. package/dist/development/src/core/exceptions/ErrorLocator.js.map +1 -0
  77. package/dist/development/src/core/exceptions/MarkerSugarer.cjs +51 -0
  78. package/dist/development/src/core/exceptions/MarkerSugarer.cjs.map +1 -0
  79. package/dist/development/src/core/exceptions/MarkerSugarer.js +51 -0
  80. package/dist/development/src/core/exceptions/MarkerSugarer.js.map +1 -0
  81. package/dist/development/src/core/exceptions/TreeParameterSugarer.cjs +33 -0
  82. package/dist/development/src/core/exceptions/TreeParameterSugarer.cjs.map +1 -0
  83. package/dist/development/src/core/exceptions/TreeParameterSugarer.js +33 -0
  84. package/dist/development/src/core/exceptions/TreeParameterSugarer.js.map +1 -0
  85. package/dist/development/src/core/factories/createBatchUpdatesOptions.cjs +23 -0
  86. package/dist/development/src/core/factories/createBatchUpdatesOptions.cjs.map +1 -0
  87. package/dist/development/src/core/factories/createBatchUpdatesOptions.js +23 -0
  88. package/dist/development/src/core/factories/createBatchUpdatesOptions.js.map +1 -0
  89. package/dist/development/src/core/operations/EntityOperations.cjs +224 -0
  90. package/dist/development/src/core/operations/EntityOperations.cjs.map +1 -0
  91. package/dist/development/src/core/operations/EntityOperations.js +224 -0
  92. package/dist/development/src/core/operations/EntityOperations.js.map +1 -0
  93. package/dist/development/src/core/operations/FieldOperations.cjs +92 -0
  94. package/dist/development/src/core/operations/FieldOperations.cjs.map +1 -0
  95. package/dist/development/src/core/operations/FieldOperations.js +92 -0
  96. package/dist/development/src/core/operations/FieldOperations.js.map +1 -0
  97. package/dist/development/src/core/operations/ListOperations.cjs +158 -0
  98. package/dist/development/src/core/operations/ListOperations.cjs.map +1 -0
  99. package/dist/development/src/core/operations/ListOperations.js +158 -0
  100. package/dist/development/src/core/operations/ListOperations.js.map +1 -0
  101. package/dist/development/src/core/operations/OperationsHelpers.cjs +87 -0
  102. package/dist/development/src/core/operations/OperationsHelpers.cjs.map +1 -0
  103. package/dist/development/src/core/operations/OperationsHelpers.js +87 -0
  104. package/dist/development/src/core/operations/OperationsHelpers.js.map +1 -0
  105. package/dist/development/src/core/requestAliases/MutationAlias.cjs +14 -0
  106. package/dist/development/src/core/requestAliases/MutationAlias.cjs.map +1 -0
  107. package/dist/development/src/core/requestAliases/MutationAlias.js +14 -0
  108. package/dist/development/src/core/requestAliases/MutationAlias.js.map +1 -0
  109. package/dist/development/src/core/state/StateIterator.cjs +100 -0
  110. package/dist/development/src/core/state/StateIterator.cjs.map +1 -0
  111. package/dist/development/src/core/state/StateIterator.js +100 -0
  112. package/dist/development/src/core/state/StateIterator.js.map +1 -0
  113. package/dist/development/src/core/state/getEntityMarker.cjs +5 -0
  114. package/dist/development/src/core/state/getEntityMarker.cjs.map +1 -0
  115. package/dist/development/src/core/state/getEntityMarker.js +5 -0
  116. package/dist/development/src/core/state/getEntityMarker.js.map +1 -0
  117. package/dist/development/src/core/utils/getCombinedSignal.cjs +33 -0
  118. package/dist/development/src/core/utils/getCombinedSignal.cjs.map +1 -0
  119. package/dist/development/src/core/utils/getCombinedSignal.js +33 -0
  120. package/dist/development/src/core/utils/getCombinedSignal.js.map +1 -0
  121. package/dist/development/src/fieldHelpers/helpers/FieldHelper.cjs +13 -0
  122. package/dist/development/src/fieldHelpers/helpers/FieldHelper.cjs.map +1 -0
  123. package/dist/development/src/fieldHelpers/helpers/FieldHelper.js +13 -0
  124. package/dist/development/src/fieldHelpers/helpers/FieldHelper.js.map +1 -0
  125. package/dist/development/src/fieldHelpers/helpers/TemporalFieldHelper.cjs +18 -0
  126. package/dist/development/src/fieldHelpers/helpers/TemporalFieldHelper.cjs.map +1 -0
  127. package/dist/development/src/fieldHelpers/helpers/TemporalFieldHelper.js +18 -0
  128. package/dist/development/src/fieldHelpers/helpers/TemporalFieldHelper.js.map +1 -0
  129. package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.cjs +16 -0
  130. package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.cjs.map +1 -0
  131. package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.js +16 -0
  132. package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -0
  133. package/dist/development/src/utils/generateEnumerabilityPreventingEntropy.cjs +7 -0
  134. package/dist/development/src/utils/generateEnumerabilityPreventingEntropy.cjs.map +1 -0
  135. package/dist/development/src/utils/generateEnumerabilityPreventingEntropy.js +7 -0
  136. package/dist/development/src/utils/generateEnumerabilityPreventingEntropy.js.map +1 -0
  137. package/dist/development/src/utils/isEmptyObject.cjs +12 -0
  138. package/dist/development/src/utils/isEmptyObject.cjs.map +1 -0
  139. package/dist/development/src/utils/isEmptyObject.js +12 -0
  140. package/dist/development/src/utils/isEmptyObject.js.map +1 -0
  141. package/dist/production/index.cjs +34 -0
  142. package/dist/production/index.cjs.map +1 -0
  143. package/dist/production/index.js +28 -0
  144. package/dist/production/index.js.map +1 -0
  145. package/dist/production/src/accessorTree/NormalizedPersistedData.cjs +10 -0
  146. package/dist/production/src/accessorTree/NormalizedPersistedData.cjs.map +1 -0
  147. package/dist/production/src/accessorTree/NormalizedPersistedData.js +10 -0
  148. package/dist/production/src/accessorTree/NormalizedPersistedData.js.map +1 -0
  149. package/dist/production/src/accessors/EntityAccessorImpl.cjs +179 -0
  150. package/dist/production/src/accessors/EntityAccessorImpl.cjs.map +1 -0
  151. package/dist/production/src/accessors/EntityAccessorImpl.js +179 -0
  152. package/dist/production/src/accessors/EntityAccessorImpl.js.map +1 -0
  153. package/dist/production/src/accessors/EntityListAccessorImpl.cjs +112 -0
  154. package/dist/production/src/accessors/EntityListAccessorImpl.cjs.map +1 -0
  155. package/dist/production/src/accessors/EntityListAccessorImpl.js +112 -0
  156. package/dist/production/src/accessors/EntityListAccessorImpl.js.map +1 -0
  157. package/dist/production/src/accessors/FieldAccessorImpl.cjs +54 -0
  158. package/dist/production/src/accessors/FieldAccessorImpl.cjs.map +1 -0
  159. package/dist/production/src/accessors/FieldAccessorImpl.js +54 -0
  160. package/dist/production/src/accessors/FieldAccessorImpl.js.map +1 -0
  161. package/dist/production/src/core/AccessorErrorManager.cjs +200 -0
  162. package/dist/production/src/core/AccessorErrorManager.cjs.map +1 -0
  163. package/dist/production/src/core/AccessorErrorManager.js +200 -0
  164. package/dist/production/src/core/AccessorErrorManager.js.map +1 -0
  165. package/dist/production/src/core/Config.cjs +29 -0
  166. package/dist/production/src/core/Config.cjs.map +1 -0
  167. package/dist/production/src/core/Config.js +29 -0
  168. package/dist/production/src/core/Config.js.map +1 -0
  169. package/dist/production/src/core/DataBinding.cjs +357 -0
  170. package/dist/production/src/core/DataBinding.cjs.map +1 -0
  171. package/dist/production/src/core/DataBinding.js +357 -0
  172. package/dist/production/src/core/DataBinding.js.map +1 -0
  173. package/dist/production/src/core/DirtinessTracker.cjs +26 -0
  174. package/dist/production/src/core/DirtinessTracker.cjs.map +1 -0
  175. package/dist/production/src/core/DirtinessTracker.js +26 -0
  176. package/dist/production/src/core/DirtinessTracker.js.map +1 -0
  177. package/dist/production/src/core/ErrorsPreprocessor.cjs +180 -0
  178. package/dist/production/src/core/ErrorsPreprocessor.cjs.map +1 -0
  179. package/dist/production/src/core/ErrorsPreprocessor.js +180 -0
  180. package/dist/production/src/core/ErrorsPreprocessor.js.map +1 -0
  181. package/dist/production/src/core/EventManager.cjs +413 -0
  182. package/dist/production/src/core/EventManager.cjs.map +1 -0
  183. package/dist/production/src/core/EventManager.js +413 -0
  184. package/dist/production/src/core/EventManager.js.map +1 -0
  185. package/dist/production/src/core/MutationGenerator.cjs +670 -0
  186. package/dist/production/src/core/MutationGenerator.cjs.map +1 -0
  187. package/dist/production/src/core/MutationGenerator.js +670 -0
  188. package/dist/production/src/core/MutationGenerator.js.map +1 -0
  189. package/dist/production/src/core/QueryGenerator.cjs +110 -0
  190. package/dist/production/src/core/QueryGenerator.cjs.map +1 -0
  191. package/dist/production/src/core/QueryGenerator.js +110 -0
  192. package/dist/production/src/core/QueryGenerator.js.map +1 -0
  193. package/dist/production/src/core/RealmKeyGenerator.cjs +42 -0
  194. package/dist/production/src/core/RealmKeyGenerator.cjs.map +1 -0
  195. package/dist/production/src/core/RealmKeyGenerator.js +42 -0
  196. package/dist/production/src/core/RealmKeyGenerator.js.map +1 -0
  197. package/dist/production/src/core/RequestResponseNormalizer.cjs +136 -0
  198. package/dist/production/src/core/RequestResponseNormalizer.cjs.map +1 -0
  199. package/dist/production/src/core/RequestResponseNormalizer.js +136 -0
  200. package/dist/production/src/core/RequestResponseNormalizer.js.map +1 -0
  201. package/dist/production/src/core/StateInitializer.cjs +379 -0
  202. package/dist/production/src/core/StateInitializer.cjs.map +1 -0
  203. package/dist/production/src/core/StateInitializer.js +379 -0
  204. package/dist/production/src/core/StateInitializer.js.map +1 -0
  205. package/dist/production/src/core/TreeAugmenter.cjs +351 -0
  206. package/dist/production/src/core/TreeAugmenter.cjs.map +1 -0
  207. package/dist/production/src/core/TreeAugmenter.js +351 -0
  208. package/dist/production/src/core/TreeAugmenter.js.map +1 -0
  209. package/dist/production/src/core/TreeStore.cjs +172 -0
  210. package/dist/production/src/core/TreeStore.cjs.map +1 -0
  211. package/dist/production/src/core/TreeStore.js +172 -0
  212. package/dist/production/src/core/TreeStore.js.map +1 -0
  213. package/dist/production/src/core/exceptions/ErrorLocator.cjs +59 -0
  214. package/dist/production/src/core/exceptions/ErrorLocator.cjs.map +1 -0
  215. package/dist/production/src/core/exceptions/ErrorLocator.js +59 -0
  216. package/dist/production/src/core/exceptions/ErrorLocator.js.map +1 -0
  217. package/dist/production/src/core/exceptions/MarkerSugarer.cjs +51 -0
  218. package/dist/production/src/core/exceptions/MarkerSugarer.cjs.map +1 -0
  219. package/dist/production/src/core/exceptions/MarkerSugarer.js +51 -0
  220. package/dist/production/src/core/exceptions/MarkerSugarer.js.map +1 -0
  221. package/dist/production/src/core/exceptions/TreeParameterSugarer.cjs +33 -0
  222. package/dist/production/src/core/exceptions/TreeParameterSugarer.cjs.map +1 -0
  223. package/dist/production/src/core/exceptions/TreeParameterSugarer.js +33 -0
  224. package/dist/production/src/core/exceptions/TreeParameterSugarer.js.map +1 -0
  225. package/dist/production/src/core/factories/createBatchUpdatesOptions.cjs +23 -0
  226. package/dist/production/src/core/factories/createBatchUpdatesOptions.cjs.map +1 -0
  227. package/dist/production/src/core/factories/createBatchUpdatesOptions.js +23 -0
  228. package/dist/production/src/core/factories/createBatchUpdatesOptions.js.map +1 -0
  229. package/dist/production/src/core/operations/EntityOperations.cjs +224 -0
  230. package/dist/production/src/core/operations/EntityOperations.cjs.map +1 -0
  231. package/dist/production/src/core/operations/EntityOperations.js +224 -0
  232. package/dist/production/src/core/operations/EntityOperations.js.map +1 -0
  233. package/dist/production/src/core/operations/FieldOperations.cjs +73 -0
  234. package/dist/production/src/core/operations/FieldOperations.cjs.map +1 -0
  235. package/dist/production/src/core/operations/FieldOperations.js +73 -0
  236. package/dist/production/src/core/operations/FieldOperations.js.map +1 -0
  237. package/dist/production/src/core/operations/ListOperations.cjs +158 -0
  238. package/dist/production/src/core/operations/ListOperations.cjs.map +1 -0
  239. package/dist/production/src/core/operations/ListOperations.js +158 -0
  240. package/dist/production/src/core/operations/ListOperations.js.map +1 -0
  241. package/dist/production/src/core/operations/OperationsHelpers.cjs +87 -0
  242. package/dist/production/src/core/operations/OperationsHelpers.cjs.map +1 -0
  243. package/dist/production/src/core/operations/OperationsHelpers.js +87 -0
  244. package/dist/production/src/core/operations/OperationsHelpers.js.map +1 -0
  245. package/dist/production/src/core/requestAliases/MutationAlias.cjs +14 -0
  246. package/dist/production/src/core/requestAliases/MutationAlias.cjs.map +1 -0
  247. package/dist/production/src/core/requestAliases/MutationAlias.js +14 -0
  248. package/dist/production/src/core/requestAliases/MutationAlias.js.map +1 -0
  249. package/dist/production/src/core/state/StateIterator.cjs +100 -0
  250. package/dist/production/src/core/state/StateIterator.cjs.map +1 -0
  251. package/dist/production/src/core/state/StateIterator.js +100 -0
  252. package/dist/production/src/core/state/StateIterator.js.map +1 -0
  253. package/dist/production/src/core/state/getEntityMarker.cjs +5 -0
  254. package/dist/production/src/core/state/getEntityMarker.cjs.map +1 -0
  255. package/dist/production/src/core/state/getEntityMarker.js +5 -0
  256. package/dist/production/src/core/state/getEntityMarker.js.map +1 -0
  257. package/dist/production/src/core/utils/getCombinedSignal.cjs +33 -0
  258. package/dist/production/src/core/utils/getCombinedSignal.cjs.map +1 -0
  259. package/dist/production/src/core/utils/getCombinedSignal.js +33 -0
  260. package/dist/production/src/core/utils/getCombinedSignal.js.map +1 -0
  261. package/dist/production/src/fieldHelpers/helpers/FieldHelper.cjs +13 -0
  262. package/dist/production/src/fieldHelpers/helpers/FieldHelper.cjs.map +1 -0
  263. package/dist/production/src/fieldHelpers/helpers/FieldHelper.js +13 -0
  264. package/dist/production/src/fieldHelpers/helpers/FieldHelper.js.map +1 -0
  265. package/dist/production/src/fieldHelpers/helpers/TemporalFieldHelper.cjs +18 -0
  266. package/dist/production/src/fieldHelpers/helpers/TemporalFieldHelper.cjs.map +1 -0
  267. package/dist/production/src/fieldHelpers/helpers/TemporalFieldHelper.js +18 -0
  268. package/dist/production/src/fieldHelpers/helpers/TemporalFieldHelper.js.map +1 -0
  269. package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.cjs +16 -0
  270. package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.cjs.map +1 -0
  271. package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.js +16 -0
  272. package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -0
  273. package/dist/production/src/utils/generateEnumerabilityPreventingEntropy.cjs +7 -0
  274. package/dist/production/src/utils/generateEnumerabilityPreventingEntropy.cjs.map +1 -0
  275. package/dist/production/src/utils/generateEnumerabilityPreventingEntropy.js +7 -0
  276. package/dist/production/src/utils/generateEnumerabilityPreventingEntropy.js.map +1 -0
  277. package/dist/production/src/utils/isEmptyObject.cjs +12 -0
  278. package/dist/production/src/utils/isEmptyObject.cjs.map +1 -0
  279. package/dist/production/src/utils/isEmptyObject.js +12 -0
  280. package/dist/production/src/utils/isEmptyObject.js.map +1 -0
  281. package/dist/types/accessorTree/NormalizedPersistedData.d.ts +18 -0
  282. package/dist/types/accessorTree/NormalizedPersistedData.d.ts.map +1 -0
  283. package/dist/types/accessorTree/index.d.ts +2 -0
  284. package/dist/types/accessorTree/index.d.ts.map +1 -0
  285. package/dist/types/accessors/BindingConfig.d.ts +6 -0
  286. package/dist/types/accessors/BindingConfig.d.ts.map +1 -0
  287. package/dist/types/accessors/EntityAccessorImpl.d.ts +56 -0
  288. package/dist/types/accessors/EntityAccessorImpl.d.ts.map +1 -0
  289. package/dist/types/accessors/EntityListAccessorImpl.d.ts +57 -0
  290. package/dist/types/accessors/EntityListAccessorImpl.d.ts.map +1 -0
  291. package/dist/types/accessors/FieldAccessorImpl.d.ts +32 -0
  292. package/dist/types/accessors/FieldAccessorImpl.d.ts.map +1 -0
  293. package/dist/types/accessors/index.d.ts +5 -0
  294. package/dist/types/accessors/index.d.ts.map +1 -0
  295. package/dist/types/core/AccessorErrorManager.d.ts +25 -0
  296. package/dist/types/core/AccessorErrorManager.d.ts.map +1 -0
  297. package/dist/types/core/Config.d.ts +9 -0
  298. package/dist/types/core/Config.d.ts.map +1 -0
  299. package/dist/types/core/DataBinding.d.ts +54 -0
  300. package/dist/types/core/DataBinding.d.ts.map +1 -0
  301. package/dist/types/core/DirtinessTracker.d.ts +9 -0
  302. package/dist/types/core/DirtinessTracker.d.ts.map +1 -0
  303. package/dist/types/core/ErrorsPreprocessor.d.ts +34 -0
  304. package/dist/types/core/ErrorsPreprocessor.d.ts.map +1 -0
  305. package/dist/types/core/EventManager.d.ts +57 -0
  306. package/dist/types/core/EventManager.d.ts.map +1 -0
  307. package/dist/types/core/MutationGenerator.d.ts +49 -0
  308. package/dist/types/core/MutationGenerator.d.ts.map +1 -0
  309. package/dist/types/core/QueryGenerator.d.ts +13 -0
  310. package/dist/types/core/QueryGenerator.d.ts.map +1 -0
  311. package/dist/types/core/RealmKeyGenerator.d.ts +10 -0
  312. package/dist/types/core/RealmKeyGenerator.d.ts.map +1 -0
  313. package/dist/types/core/RequestResponseNormalizer.d.ts +11 -0
  314. package/dist/types/core/RequestResponseNormalizer.d.ts.map +1 -0
  315. package/dist/types/core/StateInitializer.d.ts +34 -0
  316. package/dist/types/core/StateInitializer.d.ts.map +1 -0
  317. package/dist/types/core/TreeAugmenter.d.ts +25 -0
  318. package/dist/types/core/TreeAugmenter.d.ts.map +1 -0
  319. package/dist/types/core/TreeStore.d.ts +30 -0
  320. package/dist/types/core/TreeStore.d.ts.map +1 -0
  321. package/dist/types/core/UpdateMetadata.d.ts +4 -0
  322. package/dist/types/core/UpdateMetadata.d.ts.map +1 -0
  323. package/dist/types/core/exceptions/ErrorLocator.d.ts +8 -0
  324. package/dist/types/core/exceptions/ErrorLocator.d.ts.map +1 -0
  325. package/dist/types/core/exceptions/MarkerSugarer.d.ts +10 -0
  326. package/dist/types/core/exceptions/MarkerSugarer.d.ts.map +1 -0
  327. package/dist/types/core/exceptions/TreeParameterSugarer.d.ts +11 -0
  328. package/dist/types/core/exceptions/TreeParameterSugarer.d.ts.map +1 -0
  329. package/dist/types/core/factories/createBatchUpdatesOptions.d.ts +5 -0
  330. package/dist/types/core/factories/createBatchUpdatesOptions.d.ts.map +1 -0
  331. package/dist/types/core/factories/index.d.ts +2 -0
  332. package/dist/types/core/factories/index.d.ts.map +1 -0
  333. package/dist/types/core/index.d.ts +9 -0
  334. package/dist/types/core/index.d.ts.map +1 -0
  335. package/dist/types/core/operations/EntityOperations.d.ts +26 -0
  336. package/dist/types/core/operations/EntityOperations.d.ts.map +1 -0
  337. package/dist/types/core/operations/FieldOperations.d.ts +22 -0
  338. package/dist/types/core/operations/FieldOperations.d.ts.map +1 -0
  339. package/dist/types/core/operations/ListOperations.d.ts +32 -0
  340. package/dist/types/core/operations/ListOperations.d.ts.map +1 -0
  341. package/dist/types/core/operations/OperationsHelpers.d.ts +14 -0
  342. package/dist/types/core/operations/OperationsHelpers.d.ts.map +1 -0
  343. package/dist/types/core/operations/index.d.ts +4 -0
  344. package/dist/types/core/operations/index.d.ts.map +1 -0
  345. package/dist/types/core/requestAliases/MutationAlias.d.ts +6 -0
  346. package/dist/types/core/requestAliases/MutationAlias.d.ts.map +1 -0
  347. package/dist/types/core/requestAliases/index.d.ts +2 -0
  348. package/dist/types/core/requestAliases/index.d.ts.map +1 -0
  349. package/dist/types/core/state/EntityListState.d.ts +29 -0
  350. package/dist/types/core/state/EntityListState.d.ts.map +1 -0
  351. package/dist/types/core/state/EntityRealmState.d.ts +44 -0
  352. package/dist/types/core/state/EntityRealmState.d.ts.map +1 -0
  353. package/dist/types/core/state/EntityState.d.ts +11 -0
  354. package/dist/types/core/state/EntityState.d.ts.map +1 -0
  355. package/dist/types/core/state/FieldState.d.ts +19 -0
  356. package/dist/types/core/state/FieldState.d.ts.map +1 -0
  357. package/dist/types/core/state/StateIterator.d.ts +14 -0
  358. package/dist/types/core/state/StateIterator.d.ts.map +1 -0
  359. package/dist/types/core/state/StateNode.d.ts +8 -0
  360. package/dist/types/core/state/StateNode.d.ts.map +1 -0
  361. package/dist/types/core/state/getEntityMarker.d.ts +3 -0
  362. package/dist/types/core/state/getEntityMarker.d.ts.map +1 -0
  363. package/dist/types/core/state/index.d.ts +8 -0
  364. package/dist/types/core/state/index.d.ts.map +1 -0
  365. package/dist/types/core/utils/getCombinedSignal.d.ts +2 -0
  366. package/dist/types/core/utils/getCombinedSignal.d.ts.map +1 -0
  367. package/dist/types/core/utils/index.d.ts +2 -0
  368. package/dist/types/core/utils/index.d.ts.map +1 -0
  369. package/dist/types/fieldHelpers/helpers/FieldHelper.d.ts +7 -0
  370. package/dist/types/fieldHelpers/helpers/FieldHelper.d.ts.map +1 -0
  371. package/dist/types/fieldHelpers/helpers/TemporalFieldHelper.d.ts +10 -0
  372. package/dist/types/fieldHelpers/helpers/TemporalFieldHelper.d.ts.map +1 -0
  373. package/dist/types/fieldHelpers/helpers/UuidFieldHelper.d.ts +10 -0
  374. package/dist/types/fieldHelpers/helpers/UuidFieldHelper.d.ts.map +1 -0
  375. package/dist/types/fieldHelpers/helpers/index.d.ts +3 -0
  376. package/dist/types/fieldHelpers/helpers/index.d.ts.map +1 -0
  377. package/dist/types/fieldHelpers/index.d.ts +2 -0
  378. package/dist/types/fieldHelpers/index.d.ts.map +1 -0
  379. package/dist/types/index.d.ts +5 -0
  380. package/dist/types/index.d.ts.map +1 -0
  381. package/dist/types/tsconfig.tsbuildinfo +1 -0
  382. package/dist/types/utils/assertNever.d.ts +2 -0
  383. package/dist/types/utils/assertNever.d.ts.map +1 -0
  384. package/dist/types/utils/generateEnumerabilityPreventingEntropy.d.ts +2 -0
  385. package/dist/types/utils/generateEnumerabilityPreventingEntropy.d.ts.map +1 -0
  386. package/dist/types/utils/index.d.ts +4 -0
  387. package/dist/types/utils/index.d.ts.map +1 -0
  388. package/dist/types/utils/isEmptyObject.d.ts +2 -0
  389. package/dist/types/utils/isEmptyObject.d.ts.map +1 -0
  390. package/package.json +5 -5
@@ -0,0 +1,413 @@
1
+ import { BindingError, assertNever } from "@contember/binding-common";
2
+ import { StateIterator } from "./state/StateIterator.js";
3
+ import { getEntityMarker } from "./state/getEntityMarker.js";
4
+ var __defProp = Object.defineProperty;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
+ class EventManager {
8
+ constructor(asyncBatchUpdatesOptions, batchUpdatesOptions, config, dirtinessTracker, onUpdate, treeStore, batchedUpdates) {
9
+ this.asyncBatchUpdatesOptions = asyncBatchUpdatesOptions;
10
+ this.batchUpdatesOptions = batchUpdatesOptions;
11
+ this.config = config;
12
+ this.dirtinessTracker = dirtinessTracker;
13
+ this.onUpdate = onUpdate;
14
+ this.treeStore = treeStore;
15
+ this.batchedUpdates = batchedUpdates;
16
+ __publicField(this, "transactionDepth", 0);
17
+ __publicField(this, "isFrozenWhileUpdating", false);
18
+ __publicField(this, "isMutating", false);
19
+ __publicField(this, "ongoingPersistOperation");
20
+ __publicField(this, "previousMetadata");
21
+ __publicField(this, "newlyInitializedWithListeners", /* @__PURE__ */ new Set());
22
+ __publicField(this, "pendingWithBeforeUpdate", /* @__PURE__ */ new Set());
23
+ __publicField(this, "rootsWithPendingUpdates", /* @__PURE__ */ new Set());
24
+ }
25
+ async persistOperation(operation) {
26
+ if (this.ongoingPersistOperation !== void 0) {
27
+ if (this.isMutating) {
28
+ throw new BindingError(`Cannot trigger a persist whilst another one is ongoing!`);
29
+ }
30
+ return await this.ongoingPersistOperation;
31
+ }
32
+ if (this.transactionDepth > 0) {
33
+ throw new BindingError(`Cannot trigger a persist whilst batching updates!`);
34
+ }
35
+ return await (this.ongoingPersistOperation = new Promise(async (resolve, reject) => {
36
+ await Promise.resolve();
37
+ this.isMutating = true;
38
+ this.flushUpdates();
39
+ try {
40
+ resolve(await this.asyncOperation(operation));
41
+ } catch (e) {
42
+ if (!(typeof e === "object" && e !== null && "type" in e && e.type === "invalidInput")) {
43
+ console.error("PersistError", e);
44
+ }
45
+ reject(e);
46
+ } finally {
47
+ this.ongoingPersistOperation = void 0;
48
+ this.isMutating = false;
49
+ this.flushUpdates();
50
+ }
51
+ }));
52
+ }
53
+ syncTransaction(transaction) {
54
+ try {
55
+ this.transactionDepth++;
56
+ return transaction();
57
+ } finally {
58
+ this.transactionDepth--;
59
+ }
60
+ }
61
+ syncOperation(operation) {
62
+ const result = this.syncTransaction(operation);
63
+ this.flushUpdates();
64
+ return result;
65
+ }
66
+ async asyncTransaction(transaction) {
67
+ try {
68
+ this.transactionDepth++;
69
+ return await transaction();
70
+ } finally {
71
+ this.transactionDepth--;
72
+ }
73
+ }
74
+ async asyncOperation(operation) {
75
+ const result = await this.asyncTransaction(operation);
76
+ this.flushUpdates();
77
+ return result;
78
+ }
79
+ flushUpdates() {
80
+ if (this.transactionDepth > 0) {
81
+ return;
82
+ }
83
+ if (this.isFrozenWhileUpdating) {
84
+ throw new BindingError(
85
+ `Trying to perform an update while the whole accessor tree is already updating. This is most likely caused by updating the accessor tree while rendering or from within the 'update' event handler, which is a no-op. If you wish to mutate the tree in reaction to other changes, use the 'beforeUpdate' event.`
86
+ );
87
+ }
88
+ const newMetadata = this.getNewUpdateMetadata();
89
+ if (!this.shouldFlushUpdates(newMetadata)) {
90
+ return;
91
+ }
92
+ this.batchedUpdates(() => {
93
+ this.isFrozenWhileUpdating = true;
94
+ this.triggerBeforeFlushEvents();
95
+ this.onUpdate(newMetadata);
96
+ const rootStates = Array.from(this.rootsWithPendingUpdates);
97
+ this.flushPendingAccessorUpdates(rootStates);
98
+ this.rootsWithPendingUpdates.clear();
99
+ this.isFrozenWhileUpdating = false;
100
+ this.previousMetadata = newMetadata;
101
+ });
102
+ }
103
+ getNewUpdateMetadata() {
104
+ return {
105
+ isMutating: this.isMutating
106
+ };
107
+ }
108
+ shouldFlushUpdates(newMetadata) {
109
+ if (this.transactionDepth > 0) {
110
+ return false;
111
+ }
112
+ if (this.previousMetadata === void 0) {
113
+ return true;
114
+ }
115
+ if (this.rootsWithPendingUpdates.size) {
116
+ return true;
117
+ }
118
+ for (const key in newMetadata) {
119
+ const fromPrevious = this.previousMetadata[key];
120
+ const fromNew = newMetadata[key];
121
+ if (!Object.is(fromPrevious, fromNew)) {
122
+ return true;
123
+ }
124
+ }
125
+ return false;
126
+ }
127
+ registerNewlyInitialized(newlyInitialized) {
128
+ const initializeListeners = this.getEventListeners(newlyInitialized, { type: "initialize" });
129
+ if (initializeListeners === void 0) {
130
+ return;
131
+ }
132
+ this.newlyInitializedWithListeners.add(newlyInitialized);
133
+ if (this.transactionDepth === 0) {
134
+ this.triggerOnInitialize();
135
+ }
136
+ }
137
+ registerUpdatedConnection(parentState, placeholderName) {
138
+ if (parentState.fieldsWithPendingConnectionUpdates === void 0) {
139
+ parentState.fieldsWithPendingConnectionUpdates = /* @__PURE__ */ new Set();
140
+ }
141
+ const marker = getEntityMarker(parentState);
142
+ placeholders: for (const [fieldName, placeholdersByField] of marker.fields.placeholders) {
143
+ if (typeof placeholdersByField === "string") {
144
+ if (placeholdersByField === placeholderName) {
145
+ parentState.fieldsWithPendingConnectionUpdates.add(fieldName);
146
+ }
147
+ } else {
148
+ for (const placeholderByFieldName of placeholdersByField) {
149
+ if (placeholderByFieldName === placeholderName) {
150
+ parentState.fieldsWithPendingConnectionUpdates.add(fieldName);
151
+ continue placeholders;
152
+ }
153
+ }
154
+ }
155
+ }
156
+ }
157
+ registerJustUpdated(justUpdated, changesDelta) {
158
+ const beforeUpdateListeners = this.getEventListeners(justUpdated, { type: "beforeUpdate" });
159
+ if (beforeUpdateListeners !== void 0) {
160
+ this.pendingWithBeforeUpdate.add(justUpdated);
161
+ }
162
+ justUpdated.accessor = void 0;
163
+ switch (justUpdated.type) {
164
+ case "entityRealm":
165
+ case "entityList": {
166
+ justUpdated.unpersistedChangesCount += changesDelta;
167
+ const parent = justUpdated.blueprint.parent;
168
+ if (parent === void 0) {
169
+ this.rootsWithPendingUpdates.add(justUpdated);
170
+ if (!(justUpdated.blueprint.type === "subTree" && justUpdated.blueprint.marker.parameters.isCreating && justUpdated.blueprint.marker.parameters.isUnpersisted)) {
171
+ this.dirtinessTracker.increaseBy(changesDelta);
172
+ }
173
+ } else {
174
+ if (!parent.childrenWithPendingUpdates) {
175
+ parent.childrenWithPendingUpdates = /* @__PURE__ */ new Set();
176
+ }
177
+ parent.childrenWithPendingUpdates.add(justUpdated);
178
+ this.registerJustUpdated(parent, changesDelta);
179
+ }
180
+ break;
181
+ }
182
+ case "field": {
183
+ const parent = justUpdated.parent;
184
+ if (!parent.childrenWithPendingUpdates) {
185
+ parent.childrenWithPendingUpdates = /* @__PURE__ */ new Set();
186
+ }
187
+ parent.childrenWithPendingUpdates.add(justUpdated);
188
+ this.registerJustUpdated(justUpdated.parent, changesDelta);
189
+ break;
190
+ }
191
+ }
192
+ }
193
+ flushPendingAccessorUpdates(rootStates) {
194
+ const agenda = rootStates;
195
+ for (const state of agenda) {
196
+ const updateListeners = state.type === "field" ? this.getEventDispatchers(state, { type: "update" }, [state.getAccessor()]) : state.type === "entityRealm" ? this.getEventDispatchers(state, { type: "update" }, [state.getAccessor()]) : this.getEventDispatchers(state, { type: "update" }, [state.getAccessor()]);
197
+ if (updateListeners !== void 0) {
198
+ for (const handler of updateListeners) {
199
+ handler();
200
+ }
201
+ }
202
+ if (state.type === "entityRealm" && state.fieldsWithPendingConnectionUpdates) {
203
+ for (const updatedField of state.fieldsWithPendingConnectionUpdates) {
204
+ const listeners = this.getEventListeners(state, { type: "connectionUpdate", key: updatedField });
205
+ if (!listeners) {
206
+ continue;
207
+ }
208
+ for (const listener of listeners) {
209
+ listener(state.getAccessor());
210
+ }
211
+ }
212
+ }
213
+ switch (state.type) {
214
+ case "entityRealm":
215
+ case "entityList": {
216
+ if (state.childrenWithPendingUpdates !== void 0) {
217
+ for (const childState of state.childrenWithPendingUpdates) {
218
+ agenda.push(childState);
219
+ }
220
+ state.childrenWithPendingUpdates.clear();
221
+ }
222
+ break;
223
+ }
224
+ case "field":
225
+ break;
226
+ default:
227
+ assertNever(state);
228
+ }
229
+ }
230
+ }
231
+ async triggerAsyncMutatingEvent(eventType, options) {
232
+ await this.asyncTransaction(async () => {
233
+ const callbackQueue = [];
234
+ for (const [, subTreeState] of StateIterator.eachRootState(this.treeStore)) {
235
+ for (const iNode of StateIterator.depthFirstINodes(subTreeState)) {
236
+ const listeners = this.getEventListeners(iNode, { type: eventType }) ?? [];
237
+ for (const listener of listeners) {
238
+ callbackQueue.push([iNode, listener]);
239
+ }
240
+ }
241
+ }
242
+ for (let waterfallDepth = 0; waterfallDepth < this.config.getValue(`${eventType}SettleLimit`); waterfallDepth++) {
243
+ const promiseReturns = [];
244
+ const correspondingStates = [];
245
+ if (callbackQueue.length === 0) {
246
+ break;
247
+ }
248
+ for (const [state, callback] of callbackQueue) {
249
+ correspondingStates.push(state);
250
+ const changesCountBefore2 = this.dirtinessTracker.getTotalTouchCount();
251
+ let validateChanges = false;
252
+ try {
253
+ const result = callback(state.getAccessor, options);
254
+ if (result instanceof Promise) {
255
+ validateChanges = true;
256
+ promiseReturns.push(result);
257
+ } else {
258
+ promiseReturns.push(Promise.resolve(result));
259
+ }
260
+ } catch (e) {
261
+ promiseReturns.push(Promise.reject(e));
262
+ }
263
+ if (validateChanges) {
264
+ this.validateWithoutChanges(changesCountBefore2, eventType);
265
+ }
266
+ }
267
+ const changesCountBefore = this.dirtinessTracker.getTotalTouchCount();
268
+ const newCallbacks = await Promise.allSettled(promiseReturns);
269
+ this.validateWithoutChanges(changesCountBefore, eventType);
270
+ callbackQueue.length = 0;
271
+ for (const newlyInitialized of this.newlyInitializedWithListeners) {
272
+ if (newlyInitialized.type === "field") {
273
+ continue;
274
+ }
275
+ const beforePersistHandlers = this.getEventListeners(newlyInitialized, { type: eventType });
276
+ if (beforePersistHandlers) {
277
+ for (const listener of beforePersistHandlers) {
278
+ callbackQueue.push([newlyInitialized, listener]);
279
+ }
280
+ }
281
+ }
282
+ this.triggerBeforeFlushEvents();
283
+ this.handleRejections(eventType, newCallbacks);
284
+ for (let i = 0; i < newCallbacks.length; i++) {
285
+ const result = newCallbacks[i];
286
+ const correspondingState = correspondingStates[i];
287
+ if (result.status === "fulfilled") {
288
+ if (typeof result.value === "function") {
289
+ callbackQueue.push([correspondingState, result.value]);
290
+ }
291
+ }
292
+ }
293
+ }
294
+ });
295
+ }
296
+ triggerBeforeFlushEvents() {
297
+ this.syncTransaction(() => {
298
+ const settleLimit = this.config.getValue("beforeUpdateSettleLimit");
299
+ for (let attemptNumber = 0; attemptNumber < settleLimit; attemptNumber++) {
300
+ if (!this.pendingWithBeforeUpdate.size) {
301
+ this.triggerOnInitialize();
302
+ return;
303
+ }
304
+ const withBeforeUpdate = this.pendingWithBeforeUpdate;
305
+ this.pendingWithBeforeUpdate = /* @__PURE__ */ new Set();
306
+ for (const state of withBeforeUpdate) {
307
+ const listeners = this.getEventListeners(state, { type: "beforeUpdate" });
308
+ if (listeners === void 0) {
309
+ continue;
310
+ }
311
+ switch (state.type) {
312
+ case "field":
313
+ for (const listener of listeners) {
314
+ listener(state.getAccessor());
315
+ }
316
+ break;
317
+ case "entityRealm":
318
+ case "entityList":
319
+ for (const listener of listeners) {
320
+ state.getAccessor().batchUpdates(listener);
321
+ }
322
+ break;
323
+ default:
324
+ return assertNever(state);
325
+ }
326
+ }
327
+ this.triggerOnInitialize();
328
+ }
329
+ throw new BindingError(
330
+ `Maximum stabilization limit of updates caused by 'beforeUpdate' exceeded. This likely means there is an infinite feedback loop in your code.`
331
+ );
332
+ });
333
+ }
334
+ triggerOnInitialize() {
335
+ this.syncTransaction(() => {
336
+ for (const state of this.newlyInitializedWithListeners) {
337
+ const listeners = state.type === "field" ? this.getEventDispatchers(state, { type: "initialize" }, [state.getAccessor, this.batchUpdatesOptions]) : state.type === "entityRealm" ? this.getEventDispatchers(state, { type: "initialize" }, [state.getAccessor, this.batchUpdatesOptions]) : this.getEventDispatchers(state, { type: "initialize" }, [state.getAccessor, this.batchUpdatesOptions]);
338
+ if (listeners) {
339
+ for (const listener of listeners) {
340
+ listener();
341
+ }
342
+ }
343
+ if (state.type === "entityRealm") {
344
+ state.entity.hasIdSetInStone = true;
345
+ }
346
+ }
347
+ this.newlyInitializedWithListeners.clear();
348
+ });
349
+ }
350
+ async triggerOnPersistError(options) {
351
+ await this.asyncTransaction(async () => {
352
+ const handlerPromises = [];
353
+ for (const [, subTreeState] of StateIterator.eachRootState(this.treeStore)) {
354
+ for (const iNode of StateIterator.depthFirstINodes(subTreeState)) {
355
+ const dispatchers = iNode.type === "entityRealm" ? this.getEventDispatchers(iNode, { type: "persistError" }, [iNode.getAccessor, options]) : this.getEventDispatchers(iNode, { type: "persistError" }, [iNode.getAccessor, options]);
356
+ if (dispatchers === void 0) {
357
+ continue;
358
+ }
359
+ for (const listener of dispatchers ?? []) {
360
+ try {
361
+ const result = listener();
362
+ if (result instanceof Promise) {
363
+ handlerPromises.push(result);
364
+ } else {
365
+ handlerPromises.push(Promise.resolve(result));
366
+ }
367
+ } catch (e) {
368
+ handlerPromises.push(Promise.reject(e));
369
+ }
370
+ }
371
+ }
372
+ }
373
+ const handlerResults = await Promise.allSettled(handlerPromises);
374
+ this.handleRejections("persistError", handlerResults);
375
+ });
376
+ }
377
+ async triggerOnBeforePersist() {
378
+ return this.triggerAsyncMutatingEvent("beforePersist", this.asyncBatchUpdatesOptions);
379
+ }
380
+ async triggerOnPersistSuccess(options) {
381
+ return this.triggerAsyncMutatingEvent("persistSuccess", options);
382
+ }
383
+ getEventListeners(state, event) {
384
+ if (!state.eventListeners) {
385
+ return void 0;
386
+ }
387
+ return state.eventListeners.get(event);
388
+ }
389
+ getEventDispatchers(state, event, listenerArgs) {
390
+ const eventListeners = this.getEventListeners(state, event);
391
+ if (eventListeners === void 0) {
392
+ return void 0;
393
+ }
394
+ return Array.from(eventListeners.values(), (listener) => {
395
+ return () => listener(...listenerArgs);
396
+ });
397
+ }
398
+ handleRejections(handler, promises) {
399
+ const rejections = promises.filter((it) => it.status === "rejected");
400
+ if (rejections.length === 0) {
401
+ return;
402
+ }
403
+ rejections.forEach((it) => console.error(it.reason));
404
+ }
405
+ validateWithoutChanges(initialCount, eventType) {
406
+ this.dirtinessTracker.getTotalTouchCount();
407
+ }
408
+ }
409
+ __publicField(EventManager, "NO_CHANGES_DIFFERENCE", 0);
410
+ export {
411
+ EventManager
412
+ };
413
+ //# sourceMappingURL=EventManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventManager.js","sources":["../../../../../packages/binding-legacy/src/core/EventManager.ts"],"sourcesContent":["import type {\n\tAsyncBatchUpdatesOptions,\n\tBatchUpdatesOptions,\n\tEntityAccessor,\n\tEntityListAccessor,\n\tFieldAccessor,\n\tPersistErrorOptions,\n\tPersistSuccessOptions,\n} from '@contember/binding-common'\nimport type { SuccessfulPersistResult } from '@contember/binding-common'\nimport { BindingError } from '@contember/binding-common'\nimport type { PlaceholderName } from '@contember/binding-common'\nimport { assertNever } from '@contember/binding-common'\nimport type { Config } from './Config'\nimport type { DirtinessTracker } from './DirtinessTracker'\nimport { EntityListState, EntityRealmState, FieldState, getEntityMarker, RootStateNode, StateINode, StateIterator, StateNode } from './state'\nimport type { TreeStore } from './TreeStore'\nimport type { UpdateMetadata } from './UpdateMetadata'\nimport type { EventListenersStore } from '@contember/binding-common'\n\nexport class EventManager {\n\tpublic static readonly NO_CHANGES_DIFFERENCE = 0\n\n\tprivate transactionDepth = 0\n\tprivate isFrozenWhileUpdating = false\n\n\t// This should ideally not exists as it should be synonymous to `this.ongoingPersistOperation !== undefined`\n\t// but it makes persist-related promise juggling significantly more straightforward.\n\tprivate isMutating: boolean = false\n\tprivate ongoingPersistOperation: Promise<SuccessfulPersistResult> | undefined = undefined\n\n\tprivate previousMetadata: UpdateMetadata | undefined = undefined\n\n\tprivate newlyInitializedWithListeners: Set<EntityListState | EntityRealmState | FieldState> = new Set()\n\tprivate pendingWithBeforeUpdate: Set<StateNode> = new Set()\n\tprivate rootsWithPendingUpdates: Set<RootStateNode> = new Set()\n\n\tpublic constructor(\n\t\tprivate readonly asyncBatchUpdatesOptions: AsyncBatchUpdatesOptions,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly config: Config,\n\t\tprivate readonly dirtinessTracker: DirtinessTracker,\n\t\tprivate readonly onUpdate: (metadata: UpdateMetadata) => void,\n\t\tprivate readonly treeStore: TreeStore,\n\t\tprivate readonly batchedUpdates: (callback: () => any) => void,\n\t) {}\n\n\tpublic async persistOperation(operation: () => Promise<SuccessfulPersistResult>): Promise<SuccessfulPersistResult> {\n\t\tif (this.ongoingPersistOperation !== undefined) {\n\t\t\tif (this.isMutating) {\n\t\t\t\tthrow new BindingError(`Cannot trigger a persist whilst another one is ongoing!`)\n\t\t\t}\n\t\t\treturn await this.ongoingPersistOperation\n\t\t}\n\t\tif (this.transactionDepth > 0) {\n\t\t\tthrow new BindingError(`Cannot trigger a persist whilst batching updates!`)\n\t\t}\n\t\treturn await (this.ongoingPersistOperation = new Promise<SuccessfulPersistResult>(async (resolve, reject) => {\n\t\t\tawait Promise.resolve()\n\n\t\t\tthis.isMutating = true\n\t\t\tthis.flushUpdates() // Let the world know that we're mutating\n\n\t\t\ttry {\n\t\t\t\tresolve(await this.asyncOperation(operation))\n\t\t\t} catch (e) {\n\t\t\t\tif (!(typeof e === 'object' && e !== null && 'type' in e && e.type === 'invalidInput')) {\n\t\t\t\t\tconsole.error('PersistError', e)\n\t\t\t\t}\n\t\t\t\treject(e)\n\t\t\t} finally {\n\t\t\t\tthis.ongoingPersistOperation = undefined\n\t\t\t\tthis.isMutating = false\n\t\t\t\tthis.flushUpdates()\n\t\t\t}\n\t\t}))\n\t}\n\n\tpublic syncTransaction<T>(transaction: () => T) {\n\t\ttry {\n\t\t\tthis.transactionDepth++\n\t\t\treturn transaction()\n\t\t} finally {\n\t\t\tthis.transactionDepth--\n\t\t}\n\t}\n\tpublic syncOperation<T>(operation: () => T) {\n\t\tconst result = this.syncTransaction(operation)\n\t\tthis.flushUpdates()\n\t\treturn result\n\t}\n\n\tpublic async asyncTransaction<T>(transaction: () => Promise<T>): Promise<T> {\n\t\ttry {\n\t\t\tthis.transactionDepth++\n\t\t\treturn await transaction()\n\t\t} finally {\n\t\t\tthis.transactionDepth--\n\t\t}\n\t}\n\tpublic async asyncOperation<T>(operation: () => Promise<T>): Promise<T> {\n\t\tconst result = await this.asyncTransaction(operation)\n\t\tthis.flushUpdates()\n\t\treturn result\n\t}\n\n\tprivate flushUpdates() {\n\t\tif (this.transactionDepth > 0) {\n\t\t\treturn\n\t\t}\n\n\t\tif (this.isFrozenWhileUpdating) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`Trying to perform an update while the whole accessor tree is already updating. This is most likely caused `\n\t\t\t\t\t+ `by updating the accessor tree while rendering or from within the 'update' event handler, which is a no-op. `\n\t\t\t\t\t+ `If you wish to mutate the tree in reaction to other changes, use the 'beforeUpdate' event.`,\n\t\t\t)\n\t\t}\n\n\t\tconst newMetadata = this.getNewUpdateMetadata()\n\n\t\tif (!this.shouldFlushUpdates(newMetadata)) {\n\t\t\treturn\n\t\t}\n\n\t\tthis.batchedUpdates(() => {\n\t\t\tthis.isFrozenWhileUpdating = true\n\t\t\tthis.triggerBeforeFlushEvents()\n\t\t\tthis.onUpdate(newMetadata)\n\t\t\tconst rootStates = Array.from(this.rootsWithPendingUpdates)\n\t\t\tthis.flushPendingAccessorUpdates(rootStates)\n\t\t\tthis.rootsWithPendingUpdates.clear()\n\t\t\tthis.isFrozenWhileUpdating = false\n\t\t\tthis.previousMetadata = newMetadata\n\t\t})\n\t}\n\n\tprivate getNewUpdateMetadata(): UpdateMetadata {\n\t\treturn {\n\t\t\tisMutating: this.isMutating,\n\t\t}\n\t}\n\n\tprivate shouldFlushUpdates(newMetadata: UpdateMetadata): boolean {\n\t\tif (this.transactionDepth > 0) {\n\t\t\treturn false\n\t\t}\n\t\tif (this.previousMetadata === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tif (this.rootsWithPendingUpdates.size) {\n\t\t\treturn true\n\t\t}\n\t\tfor (const key in newMetadata) {\n\t\t\tconst fromPrevious = this.previousMetadata[key as keyof UpdateMetadata]\n\t\t\tconst fromNew = newMetadata[key as keyof UpdateMetadata]\n\n\t\t\tif (!Object.is(fromPrevious, fromNew)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\n\tpublic registerNewlyInitialized(newlyInitialized: StateNode) {\n\t\tconst initializeListeners = this.getEventListeners(newlyInitialized, { type: 'initialize' })\n\n\t\tif (initializeListeners === undefined) {\n\t\t\treturn\n\t\t}\n\n\t\tthis.newlyInitializedWithListeners.add(newlyInitialized)\n\n\t\tif (this.transactionDepth === 0) {\n\t\t\tthis.triggerOnInitialize()\n\t\t}\n\t}\n\n\tpublic registerUpdatedConnection(parentState: EntityRealmState, placeholderName: PlaceholderName) {\n\t\tif (parentState.fieldsWithPendingConnectionUpdates === undefined) {\n\t\t\tparentState.fieldsWithPendingConnectionUpdates = new Set()\n\t\t}\n\n\t\tconst marker = getEntityMarker(parentState)\n\t\tplaceholders: for (const [fieldName, placeholdersByField] of marker.fields.placeholders) {\n\t\t\tif (typeof placeholdersByField === 'string') {\n\t\t\t\tif (placeholdersByField === placeholderName) {\n\t\t\t\t\tparentState.fieldsWithPendingConnectionUpdates.add(fieldName)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const placeholderByFieldName of placeholdersByField) {\n\t\t\t\t\tif (placeholderByFieldName === placeholderName) {\n\t\t\t\t\t\tparentState.fieldsWithPendingConnectionUpdates.add(fieldName)\n\t\t\t\t\t\tcontinue placeholders\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic registerJustUpdated(justUpdated: StateNode, changesDelta: number) {\n\t\tconst beforeUpdateListeners = this.getEventListeners(justUpdated, { type: 'beforeUpdate' })\n\t\tif (beforeUpdateListeners !== undefined) {\n\t\t\tthis.pendingWithBeforeUpdate.add(justUpdated)\n\t\t}\n\t\tjustUpdated.accessor = undefined\n\n\t\tswitch (justUpdated.type) {\n\t\t\tcase 'entityRealm':\n\t\t\tcase 'entityList': {\n\t\t\t\tjustUpdated.unpersistedChangesCount += changesDelta\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tif (justUpdated.unpersistedChangesCount < 0) {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`We have *JUST* reached a completely invalid state. From now on, anything can (and likely will) `\n\t\t\t\t\t\t\t\t+ `go wrong. This is definitely a bug. Please try to report whatever led to this situation.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst parent = justUpdated.blueprint.parent\n\n\t\t\t\tif (parent === undefined) {\n\t\t\t\t\tthis.rootsWithPendingUpdates.add(justUpdated)\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t!(justUpdated.blueprint.type === 'subTree' && justUpdated.blueprint.marker.parameters.isCreating\n\t\t\t\t\t\t\t&& justUpdated.blueprint.marker.parameters.isUnpersisted)\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.dirtinessTracker.increaseBy(changesDelta)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (!parent.childrenWithPendingUpdates) {\n\t\t\t\t\t\tparent.childrenWithPendingUpdates = new Set()\n\t\t\t\t\t}\n\t\t\t\t\tparent.childrenWithPendingUpdates.add(justUpdated as any)\n\t\t\t\t\tthis.registerJustUpdated(parent, changesDelta)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'field': {\n\t\t\t\tconst parent = justUpdated.parent\n\t\t\t\tif (!parent.childrenWithPendingUpdates) {\n\t\t\t\t\tparent.childrenWithPendingUpdates = new Set()\n\t\t\t\t}\n\t\t\t\tparent.childrenWithPendingUpdates.add(justUpdated as any)\n\t\t\t\tthis.registerJustUpdated(justUpdated.parent, changesDelta)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate flushPendingAccessorUpdates(rootStates: Array<StateINode>) {\n\t\t// It is *CRUCIAL* that this is a BFS so that we update the components in top-down order.\n\t\tconst agenda: StateNode[] = rootStates\n\n\t\tfor (const state of agenda) {\n\t\t\t// yes, the calls are same, but this way we can avoid type casting\n\t\t\tconst updateListeners = state.type === 'field'\n\t\t\t\t? this.getEventDispatchers(state, { type: 'update' }, [state.getAccessor()])\n\t\t\t\t: state.type === 'entityRealm'\n\t\t\t\t? this.getEventDispatchers(state, { type: 'update' }, [state.getAccessor()])\n\t\t\t\t: this.getEventDispatchers(state, { type: 'update' }, [state.getAccessor()])\n\n\t\t\tif (updateListeners !== undefined) {\n\t\t\t\tfor (const handler of updateListeners) {\n\t\t\t\t\t// TS can't quite handle the polymorphism here but this is fine.\n\t\t\t\t\thandler()\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (state.type === 'entityRealm' && state.fieldsWithPendingConnectionUpdates) {\n\t\t\t\tfor (const updatedField of state.fieldsWithPendingConnectionUpdates) {\n\t\t\t\t\tconst listeners = this.getEventListeners(state, { type: 'connectionUpdate', key: updatedField })\n\t\t\t\t\tif (!listeners) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tfor (const listener of listeners) {\n\t\t\t\t\t\tlistener(state.getAccessor())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tswitch (state.type) {\n\t\t\t\tcase 'entityRealm':\n\t\t\t\tcase 'entityList': {\n\t\t\t\t\tif (state.childrenWithPendingUpdates !== undefined) {\n\t\t\t\t\t\tfor (const childState of state.childrenWithPendingUpdates) {\n\t\t\t\t\t\t\tagenda.push(childState)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstate.childrenWithPendingUpdates.clear()\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'field':\n\t\t\t\t\t// Do nothing\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(state)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async triggerAsyncMutatingEvent(eventType: 'beforePersist', options: AsyncBatchUpdatesOptions): Promise<void>\n\tprivate async triggerAsyncMutatingEvent(eventType: 'persistSuccess', options: PersistSuccessOptions): Promise<void>\n\tprivate async triggerAsyncMutatingEvent(\n\t\teventType: 'beforePersist' | 'persistSuccess',\n\t\toptions: AsyncBatchUpdatesOptions | PersistSuccessOptions,\n\t): Promise<void> {\n\t\tawait this.asyncTransaction(async () => {\n\t\t\t// TODO if an entity from here (or its parent) gets deleted, we need to remove stale handlers from here.\n\t\t\tconst callbackQueue: Array<\n\t\t\t\t[\n\t\t\t\t\t// The typings could be nicer but TS…\n\t\t\t\t\tStateINode,\n\t\t\t\t\t(\n\t\t\t\t\t\t| EntityAccessor.EntityEventListenerMap[typeof eventType]\n\t\t\t\t\t\t| EntityListAccessor.EntityListEventListenerMap[typeof eventType]\n\t\t\t\t\t),\n\t\t\t\t]\n\t\t\t> = []\n\n\t\t\tfor (const [, subTreeState] of StateIterator.eachRootState(this.treeStore)) {\n\t\t\t\tfor (const iNode of StateIterator.depthFirstINodes(subTreeState)) {\n\t\t\t\t\tconst listeners = this.getEventListeners(iNode, { type: eventType }) ?? []\n\t\t\t\t\tfor (const listener of listeners) {\n\t\t\t\t\t\tcallbackQueue.push([iNode, listener])\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (\n\t\t\t\tlet waterfallDepth = 0;\n\t\t\t\twaterfallDepth < this.config.getValue(`${eventType}SettleLimit` as const);\n\t\t\t\twaterfallDepth++\n\t\t\t) {\n\t\t\t\tconst promiseReturns: Array<\n\t\t\t\t\tPromise<\n\t\t\t\t\t\t| void\n\t\t\t\t\t\t| EntityAccessor.EntityEventListenerMap[typeof eventType]\n\t\t\t\t\t\t| EntityListAccessor.EntityListEventListenerMap[typeof eventType]\n\t\t\t\t\t>\n\t\t\t\t> = []\n\t\t\t\tconst correspondingStates: Array<StateINode> = []\n\n\t\t\t\tif (callbackQueue.length === 0) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tfor (const [state, callback] of callbackQueue) {\n\t\t\t\t\tcorrespondingStates.push(state)\n\t\t\t\t\tconst changesCountBefore = this.dirtinessTracker.getTotalTouchCount()\n\t\t\t\t\tlet validateChanges = false\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = callback(state.getAccessor as any, options as any) // TS can't quite handle this but this is sound.\n\t\t\t\t\t\tif (result instanceof Promise) {\n\t\t\t\t\t\t\tvalidateChanges = true\n\t\t\t\t\t\t\tpromiseReturns.push(result)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpromiseReturns.push(Promise.resolve(result))\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tpromiseReturns.push(Promise.reject(e))\n\t\t\t\t\t}\n\t\t\t\t\tif (validateChanges) {\n\t\t\t\t\t\tthis.validateWithoutChanges(changesCountBefore, eventType)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// TODO timeout\n\n\t\t\t\tconst changesCountBefore = this.dirtinessTracker.getTotalTouchCount()\n\t\t\t\tconst newCallbacks = await Promise.allSettled(promiseReturns)\n\t\t\t\tthis.validateWithoutChanges(changesCountBefore, eventType)\n\n\t\t\t\tcallbackQueue.length = 0 // Empties the queue\n\n\t\t\t\t// TODO we're drifting away from the original depth-first order. Let's see if that's ever even an issue.\n\t\t\t\tfor (const newlyInitialized of this.newlyInitializedWithListeners) {\n\t\t\t\t\tif (newlyInitialized.type === 'field') {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tconst beforePersistHandlers = this.getEventListeners(newlyInitialized, { type: eventType })\n\t\t\t\t\tif (beforePersistHandlers) {\n\t\t\t\t\t\tfor (const listener of beforePersistHandlers) {\n\t\t\t\t\t\t\tcallbackQueue.push([newlyInitialized, listener])\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.triggerBeforeFlushEvents()\n\t\t\t\tthis.handleRejections(eventType, newCallbacks)\n\n\t\t\t\tfor (let i = 0; i < newCallbacks.length; i++) {\n\t\t\t\t\tconst result = newCallbacks[i]\n\t\t\t\t\tconst correspondingState = correspondingStates[i]\n\n\t\t\t\t\tif (result.status === 'fulfilled') {\n\t\t\t\t\t\tif (typeof result.value === 'function') {\n\t\t\t\t\t\t\tcallbackQueue.push([correspondingState, result.value])\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Otherwise do nothing. This is just a handler that albeit async, doesn't appear to\n\t\t\t\t\t\t// interact with data binding.\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (import.meta.env.DEV) {\n\t\t\t\tif (callbackQueue.length) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Exceeded the ${eventType} settle limit. Your code likely contains a deadlock. `\n\t\t\t\t\t\t\t+ `If that's not the case, raise the settle limit from DataBindingProvider.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate triggerBeforeFlushEvents() {\n\t\tthis.syncTransaction(() => {\n\t\t\tconst settleLimit = this.config.getValue('beforeUpdateSettleLimit')\n\n\t\t\tfor (let attemptNumber = 0; attemptNumber < settleLimit; attemptNumber++) {\n\t\t\t\tif (!this.pendingWithBeforeUpdate.size) {\n\t\t\t\t\tthis.triggerOnInitialize()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst withBeforeUpdate = this.pendingWithBeforeUpdate\n\t\t\t\tthis.pendingWithBeforeUpdate = new Set()\n\n\t\t\t\tfor (const state of withBeforeUpdate) {\n\t\t\t\t\tconst listeners = this.getEventListeners(state, { type: 'beforeUpdate' })\n\t\t\t\t\tif (listeners === undefined) {\n\t\t\t\t\t\t// This can happen if the listener has unsubscribed since we added it to the set.\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tswitch (state.type) {\n\t\t\t\t\t\tcase 'field':\n\t\t\t\t\t\t\tfor (const listener of listeners) {\n\t\t\t\t\t\t\t\t;(listener as FieldAccessor.BeforeUpdateListener)(state.getAccessor())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase 'entityRealm':\n\t\t\t\t\t\tcase 'entityList':\n\t\t\t\t\t\t\tfor (const listener of listeners) {\n\t\t\t\t\t\t\t\tstate.getAccessor().batchUpdates(listener as any)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn assertNever(state)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.triggerOnInitialize()\n\t\t\t}\n\t\t\tthrow new BindingError(\n\t\t\t\t`Maximum stabilization limit of updates caused by 'beforeUpdate' exceeded. `\n\t\t\t\t\t+ `This likely means there is an infinite feedback loop in your code.`,\n\t\t\t)\n\t\t})\n\t}\n\n\tprivate triggerOnInitialize() {\n\t\tthis.syncTransaction(() => {\n\t\t\tfor (const state of this.newlyInitializedWithListeners) {\n\t\t\t\t// yes, the calls are same, but this way we can avoid type casting\n\t\t\t\tconst listeners = state.type === 'field'\n\t\t\t\t\t? this.getEventDispatchers(state, { type: 'initialize' }, [state.getAccessor, this.batchUpdatesOptions])\n\t\t\t\t\t: state.type === 'entityRealm'\n\t\t\t\t\t? this.getEventDispatchers(state, { type: 'initialize' }, [state.getAccessor, this.batchUpdatesOptions])\n\t\t\t\t\t: this.getEventDispatchers(state, { type: 'initialize' }, [state.getAccessor, this.batchUpdatesOptions])\n\n\t\t\t\tif (listeners) {\n\t\t\t\t\tfor (const listener of listeners) {\n\t\t\t\t\t\tlistener()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (state.type === 'entityRealm') {\n\t\t\t\t\tstate.entity.hasIdSetInStone = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.newlyInitializedWithListeners.clear()\n\t\t})\n\t}\n\n\tpublic async triggerOnPersistError(options: PersistErrorOptions) {\n\t\tawait this.asyncTransaction(async () => {\n\t\t\tconst handlerPromises: Array<Promise<void>> = []\n\n\t\t\tfor (const [, subTreeState] of StateIterator.eachRootState(this.treeStore)) {\n\t\t\t\tfor (const iNode of StateIterator.depthFirstINodes(subTreeState)) {\n\t\t\t\t\t// yes, the calls are same, but this way we can avoid type casting\n\t\t\t\t\tconst dispatchers = iNode.type === 'entityRealm'\n\t\t\t\t\t\t? this.getEventDispatchers(iNode, { type: 'persistError' }, [iNode.getAccessor, options])\n\t\t\t\t\t\t: this.getEventDispatchers(iNode, { type: 'persistError' }, [iNode.getAccessor, options])\n\t\t\t\t\tif (dispatchers === undefined) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tfor (const listener of dispatchers ?? []) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst result = listener()\n\t\t\t\t\t\t\tif (result instanceof Promise) {\n\t\t\t\t\t\t\t\thandlerPromises.push(result)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\thandlerPromises.push(Promise.resolve(result))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\thandlerPromises.push(Promise.reject(e))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// TODO timeout\n\t\t\tconst handlerResults = await Promise.allSettled(handlerPromises)\n\t\t\tthis.handleRejections('persistError', handlerResults)\n\t\t})\n\t}\n\n\tpublic async triggerOnBeforePersist() {\n\t\treturn this.triggerAsyncMutatingEvent('beforePersist', this.asyncBatchUpdatesOptions)\n\t}\n\n\tpublic async triggerOnPersistSuccess(options: PersistSuccessOptions) {\n\t\treturn this.triggerAsyncMutatingEvent('persistSuccess', options)\n\t}\n\n\tpublic getEventListeners<\n\t\tState extends StateNode,\n\t\tEventListenerTypes extends Exclude<State['eventListeners'], undefined> extends EventListenersStore<infer Map> ? [keyof Map, Map] : never,\n\t\tEventType extends EventListenerTypes[0],\n\t>(state: State, event: { type: EventType; key?: string }): Set<Exclude<EventListenerTypes[1][EventType], undefined>> | undefined {\n\t\tif (!state.eventListeners) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn (state.eventListeners as EventListenersStore<EventListenerTypes[1]>).get(event) as Set<\n\t\t\tExclude<EventListenerTypes[1][EventType], undefined>\n\t\t>\n\t}\n\n\tpublic getEventDispatchers<\n\t\tState extends StateNode,\n\t\tEventListenerTypes extends Exclude<State['eventListeners'], undefined> extends EventListenersStore<infer Map> ? [keyof Map, Map] : never,\n\t\tEventType extends EventListenerTypes[0],\n\t>(\n\t\tstate: State,\n\t\tevent: { type: EventType; key?: string },\n\t\tlistenerArgs: Parameters<Exclude<EventListenerTypes[1][EventType], undefined>>,\n\t): Array<() => ReturnType<Exclude<EventListenerTypes[1][EventType], undefined>>> | undefined {\n\t\tconst eventListeners = this.getEventListeners(state, event)\n\t\tif (eventListeners === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn Array.from(eventListeners.values(), listener => {\n\t\t\treturn () => listener(...listenerArgs)\n\t\t}) as Array<() => ReturnType<Exclude<EventListenerTypes[1][EventType], undefined>>>\n\t}\n\n\tprivate handleRejections(handler: string, promises: PromiseSettledResult<any>[]) {\n\t\tconst rejections = promises.filter((it): it is PromiseRejectedResult => it.status === 'rejected')\n\t\tif (rejections.length === 0) {\n\t\t\treturn\n\t\t}\n\t\trejections.forEach(it => console.error(it.reason))\n\t\tif (import.meta.env.DEV) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`A ${handler} handler returned a promise that rejected. `\n\t\t\t\t\t+ `This is a no-op that will fail silently in production.`,\n\t\t\t)\n\t\t}\n\t}\n\n\tprivate validateWithoutChanges(initialCount: number, eventType: string): void {\n\t\tconst changesCountAfter = this.dirtinessTracker.getTotalTouchCount()\n\t\tif (import.meta.env.DEV) {\n\t\t\tif (initialCount !== changesCountAfter) {\n\t\t\t\t// This isn't bulletproof. They could e.g. undo a change and make another one which would\n\t\t\t\t// slip through this detection. But for most cases, it should be good enough and not too expensive.\n\t\t\t\tthrow new BindingError(\n\t\t\t\t\t`A ${eventType} event handler cannot be asynchronous and alter the accessor tree at the same time. `\n\t\t\t\t\t\t+ `To achieve this, prepare your data asynchronously but only touch the tree from a returned callback.`,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":["changesCountBefore"],"mappings":";;;;;;AAoBO,MAAM,aAAa;AAAA,EAiBlB,YACW,0BACA,qBACA,QACA,kBACA,UACA,WACA,gBAChB;AAPgB,SAAA,2BAAA;AACA,SAAA,sBAAA;AACA,SAAA,SAAA;AACA,SAAA,mBAAA;AACA,SAAA,WAAA;AACA,SAAA,YAAA;AACA,SAAA,iBAAA;AArBlB,kBAAA,MAAQ,oBAAmB,CAAA;AAC3B,kBAAA,MAAQ,yBAAwB,KAAA;AAIhC,kBAAA,MAAQ,cAAsB,KAAA;AAC9B,kBAAA,MAAQ,yBAAA;AAER,kBAAA,MAAQ,kBAAA;AAER,kBAAA,MAAQ,qDAA0F,IAAA,CAAI;AACtG,kBAAA,MAAQ,+CAA8C,IAAA,CAAI;AAC1D,kBAAA,MAAQ,+CAAkD,IAAA,CAAI;AAAA,EAU3D;AAAA,EAEH,MAAa,iBAAiB,WAAqF;AAClH,QAAI,KAAK,4BAA4B,QAAW;AAC/C,UAAI,KAAK,YAAY;AACpB,cAAM,IAAI,aAAa,yDAAyD;AAAA,MACjF;AACA,aAAO,MAAM,KAAK;AAAA,IACnB;AACA,QAAI,KAAK,mBAAmB,GAAG;AAC9B,YAAM,IAAI,aAAa,mDAAmD;AAAA,IAC3E;AACA,WAAO,OAAO,KAAK,0BAA0B,IAAI,QAAiC,OAAO,SAAS,WAAW;AAC5G,YAAM,QAAQ,QAAA;AAEd,WAAK,aAAa;AAClB,WAAK,aAAA;AAEL,UAAI;AACH,gBAAQ,MAAM,KAAK,eAAe,SAAS,CAAC;AAAA,MAC7C,SAAS,GAAG;AACX,YAAI,EAAE,OAAO,MAAM,YAAY,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