@contember/binding-legacy 2.1.0-alpha.3 → 2.1.0-alpha.35

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 (412) hide show
  1. package/package.json +10 -5
  2. package/src/accessorTree/NormalizedPersistedData.ts +1 -1
  3. package/src/accessors/EntityAccessorImpl.ts +13 -11
  4. package/src/accessors/EntityListAccessorImpl.ts +16 -7
  5. package/src/core/AccessorErrorManager.ts +2 -2
  6. package/src/core/DataBinding.ts +24 -15
  7. package/src/core/ErrorsPreprocessor.ts +4 -5
  8. package/src/core/EventManager.ts +34 -46
  9. package/src/core/MutationGenerator.ts +85 -87
  10. package/src/core/QueryGenerator.ts +4 -5
  11. package/src/core/RealmKeyGenerator.ts +5 -3
  12. package/src/core/RequestResponseNormalizer.ts +3 -8
  13. package/src/core/StateInitializer.ts +10 -18
  14. package/src/core/TreeAugmenter.ts +9 -16
  15. package/src/core/TreeStore.ts +5 -4
  16. package/src/core/operations/EntityOperations.ts +25 -25
  17. package/src/core/operations/FieldOperations.ts +15 -17
  18. package/src/core/operations/ListOperations.ts +15 -15
  19. package/src/core/operations/OperationsHelpers.ts +2 -2
  20. package/src/core/state/EntityListState.ts +3 -9
  21. package/src/fieldHelpers/helpers/TemporalFieldHelper.ts +3 -3
  22. package/src/utils/assertNever.ts +4 -4
  23. package/tests/example.test.ts +2 -2
  24. package/dist/development/index.cjs +0 -34
  25. package/dist/development/index.cjs.map +0 -1
  26. package/dist/development/index.js +0 -28
  27. package/dist/development/index.js.map +0 -1
  28. package/dist/development/src/accessorTree/NormalizedPersistedData.cjs +0 -10
  29. package/dist/development/src/accessorTree/NormalizedPersistedData.cjs.map +0 -1
  30. package/dist/development/src/accessorTree/NormalizedPersistedData.js +0 -10
  31. package/dist/development/src/accessorTree/NormalizedPersistedData.js.map +0 -1
  32. package/dist/development/src/accessors/EntityAccessorImpl.cjs +0 -179
  33. package/dist/development/src/accessors/EntityAccessorImpl.cjs.map +0 -1
  34. package/dist/development/src/accessors/EntityAccessorImpl.js +0 -179
  35. package/dist/development/src/accessors/EntityAccessorImpl.js.map +0 -1
  36. package/dist/development/src/accessors/EntityListAccessorImpl.cjs +0 -112
  37. package/dist/development/src/accessors/EntityListAccessorImpl.cjs.map +0 -1
  38. package/dist/development/src/accessors/EntityListAccessorImpl.js +0 -112
  39. package/dist/development/src/accessors/EntityListAccessorImpl.js.map +0 -1
  40. package/dist/development/src/accessors/FieldAccessorImpl.cjs +0 -54
  41. package/dist/development/src/accessors/FieldAccessorImpl.cjs.map +0 -1
  42. package/dist/development/src/accessors/FieldAccessorImpl.js +0 -54
  43. package/dist/development/src/accessors/FieldAccessorImpl.js.map +0 -1
  44. package/dist/development/src/core/AccessorErrorManager.cjs +0 -200
  45. package/dist/development/src/core/AccessorErrorManager.cjs.map +0 -1
  46. package/dist/development/src/core/AccessorErrorManager.js +0 -200
  47. package/dist/development/src/core/AccessorErrorManager.js.map +0 -1
  48. package/dist/development/src/core/Config.cjs +0 -29
  49. package/dist/development/src/core/Config.cjs.map +0 -1
  50. package/dist/development/src/core/Config.js +0 -29
  51. package/dist/development/src/core/Config.js.map +0 -1
  52. package/dist/development/src/core/DataBinding.cjs +0 -354
  53. package/dist/development/src/core/DataBinding.cjs.map +0 -1
  54. package/dist/development/src/core/DataBinding.js +0 -354
  55. package/dist/development/src/core/DataBinding.js.map +0 -1
  56. package/dist/development/src/core/DirtinessTracker.cjs +0 -26
  57. package/dist/development/src/core/DirtinessTracker.cjs.map +0 -1
  58. package/dist/development/src/core/DirtinessTracker.js +0 -26
  59. package/dist/development/src/core/DirtinessTracker.js.map +0 -1
  60. package/dist/development/src/core/ErrorsPreprocessor.cjs +0 -180
  61. package/dist/development/src/core/ErrorsPreprocessor.cjs.map +0 -1
  62. package/dist/development/src/core/ErrorsPreprocessor.js +0 -180
  63. package/dist/development/src/core/ErrorsPreprocessor.js.map +0 -1
  64. package/dist/development/src/core/EventManager.cjs +0 -439
  65. package/dist/development/src/core/EventManager.cjs.map +0 -1
  66. package/dist/development/src/core/EventManager.js +0 -439
  67. package/dist/development/src/core/EventManager.js.map +0 -1
  68. package/dist/development/src/core/MutationGenerator.cjs +0 -668
  69. package/dist/development/src/core/MutationGenerator.cjs.map +0 -1
  70. package/dist/development/src/core/MutationGenerator.js +0 -668
  71. package/dist/development/src/core/MutationGenerator.js.map +0 -1
  72. package/dist/development/src/core/QueryGenerator.cjs +0 -110
  73. package/dist/development/src/core/QueryGenerator.cjs.map +0 -1
  74. package/dist/development/src/core/QueryGenerator.js +0 -110
  75. package/dist/development/src/core/QueryGenerator.js.map +0 -1
  76. package/dist/development/src/core/RealmKeyGenerator.cjs +0 -42
  77. package/dist/development/src/core/RealmKeyGenerator.cjs.map +0 -1
  78. package/dist/development/src/core/RealmKeyGenerator.js +0 -42
  79. package/dist/development/src/core/RealmKeyGenerator.js.map +0 -1
  80. package/dist/development/src/core/RequestResponseNormalizer.cjs +0 -136
  81. package/dist/development/src/core/RequestResponseNormalizer.cjs.map +0 -1
  82. package/dist/development/src/core/RequestResponseNormalizer.js +0 -136
  83. package/dist/development/src/core/RequestResponseNormalizer.js.map +0 -1
  84. package/dist/development/src/core/StateInitializer.cjs +0 -379
  85. package/dist/development/src/core/StateInitializer.cjs.map +0 -1
  86. package/dist/development/src/core/StateInitializer.js +0 -379
  87. package/dist/development/src/core/StateInitializer.js.map +0 -1
  88. package/dist/development/src/core/TreeAugmenter.cjs +0 -354
  89. package/dist/development/src/core/TreeAugmenter.cjs.map +0 -1
  90. package/dist/development/src/core/TreeAugmenter.js +0 -354
  91. package/dist/development/src/core/TreeAugmenter.js.map +0 -1
  92. package/dist/development/src/core/TreeStore.cjs +0 -172
  93. package/dist/development/src/core/TreeStore.cjs.map +0 -1
  94. package/dist/development/src/core/TreeStore.js +0 -172
  95. package/dist/development/src/core/TreeStore.js.map +0 -1
  96. package/dist/development/src/core/exceptions/ErrorLocator.cjs +0 -59
  97. package/dist/development/src/core/exceptions/ErrorLocator.cjs.map +0 -1
  98. package/dist/development/src/core/exceptions/ErrorLocator.js +0 -59
  99. package/dist/development/src/core/exceptions/ErrorLocator.js.map +0 -1
  100. package/dist/development/src/core/exceptions/MarkerSugarer.cjs +0 -51
  101. package/dist/development/src/core/exceptions/MarkerSugarer.cjs.map +0 -1
  102. package/dist/development/src/core/exceptions/MarkerSugarer.js +0 -51
  103. package/dist/development/src/core/exceptions/MarkerSugarer.js.map +0 -1
  104. package/dist/development/src/core/exceptions/TreeParameterSugarer.cjs +0 -33
  105. package/dist/development/src/core/exceptions/TreeParameterSugarer.cjs.map +0 -1
  106. package/dist/development/src/core/exceptions/TreeParameterSugarer.js +0 -33
  107. package/dist/development/src/core/exceptions/TreeParameterSugarer.js.map +0 -1
  108. package/dist/development/src/core/factories/createBatchUpdatesOptions.cjs +0 -23
  109. package/dist/development/src/core/factories/createBatchUpdatesOptions.cjs.map +0 -1
  110. package/dist/development/src/core/factories/createBatchUpdatesOptions.js +0 -23
  111. package/dist/development/src/core/factories/createBatchUpdatesOptions.js.map +0 -1
  112. package/dist/development/src/core/operations/EntityOperations.cjs +0 -226
  113. package/dist/development/src/core/operations/EntityOperations.cjs.map +0 -1
  114. package/dist/development/src/core/operations/EntityOperations.js +0 -226
  115. package/dist/development/src/core/operations/EntityOperations.js.map +0 -1
  116. package/dist/development/src/core/operations/FieldOperations.cjs +0 -92
  117. package/dist/development/src/core/operations/FieldOperations.cjs.map +0 -1
  118. package/dist/development/src/core/operations/FieldOperations.js +0 -92
  119. package/dist/development/src/core/operations/FieldOperations.js.map +0 -1
  120. package/dist/development/src/core/operations/ListOperations.cjs +0 -158
  121. package/dist/development/src/core/operations/ListOperations.cjs.map +0 -1
  122. package/dist/development/src/core/operations/ListOperations.js +0 -158
  123. package/dist/development/src/core/operations/ListOperations.js.map +0 -1
  124. package/dist/development/src/core/operations/OperationsHelpers.cjs +0 -87
  125. package/dist/development/src/core/operations/OperationsHelpers.cjs.map +0 -1
  126. package/dist/development/src/core/operations/OperationsHelpers.js +0 -87
  127. package/dist/development/src/core/operations/OperationsHelpers.js.map +0 -1
  128. package/dist/development/src/core/requestAliases/MutationAlias.cjs +0 -14
  129. package/dist/development/src/core/requestAliases/MutationAlias.cjs.map +0 -1
  130. package/dist/development/src/core/requestAliases/MutationAlias.js +0 -14
  131. package/dist/development/src/core/requestAliases/MutationAlias.js.map +0 -1
  132. package/dist/development/src/core/state/StateIterator.cjs +0 -100
  133. package/dist/development/src/core/state/StateIterator.cjs.map +0 -1
  134. package/dist/development/src/core/state/StateIterator.js +0 -100
  135. package/dist/development/src/core/state/StateIterator.js.map +0 -1
  136. package/dist/development/src/core/state/getEntityMarker.cjs +0 -5
  137. package/dist/development/src/core/state/getEntityMarker.cjs.map +0 -1
  138. package/dist/development/src/core/state/getEntityMarker.js +0 -5
  139. package/dist/development/src/core/state/getEntityMarker.js.map +0 -1
  140. package/dist/development/src/core/utils/getCombinedSignal.cjs +0 -33
  141. package/dist/development/src/core/utils/getCombinedSignal.cjs.map +0 -1
  142. package/dist/development/src/core/utils/getCombinedSignal.js +0 -33
  143. package/dist/development/src/core/utils/getCombinedSignal.js.map +0 -1
  144. package/dist/development/src/fieldHelpers/helpers/FieldHelper.cjs +0 -13
  145. package/dist/development/src/fieldHelpers/helpers/FieldHelper.cjs.map +0 -1
  146. package/dist/development/src/fieldHelpers/helpers/FieldHelper.js +0 -13
  147. package/dist/development/src/fieldHelpers/helpers/FieldHelper.js.map +0 -1
  148. package/dist/development/src/fieldHelpers/helpers/TemporalFieldHelper.cjs +0 -18
  149. package/dist/development/src/fieldHelpers/helpers/TemporalFieldHelper.cjs.map +0 -1
  150. package/dist/development/src/fieldHelpers/helpers/TemporalFieldHelper.js +0 -18
  151. package/dist/development/src/fieldHelpers/helpers/TemporalFieldHelper.js.map +0 -1
  152. package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.cjs +0 -16
  153. package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.cjs.map +0 -1
  154. package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.js +0 -16
  155. package/dist/development/src/fieldHelpers/helpers/UuidFieldHelper.js.map +0 -1
  156. package/dist/development/src/utils/generateEnumerabilityPreventingEntropy.cjs +0 -7
  157. package/dist/development/src/utils/generateEnumerabilityPreventingEntropy.cjs.map +0 -1
  158. package/dist/development/src/utils/generateEnumerabilityPreventingEntropy.js +0 -7
  159. package/dist/development/src/utils/generateEnumerabilityPreventingEntropy.js.map +0 -1
  160. package/dist/development/src/utils/isEmptyObject.cjs +0 -12
  161. package/dist/development/src/utils/isEmptyObject.cjs.map +0 -1
  162. package/dist/development/src/utils/isEmptyObject.js +0 -12
  163. package/dist/development/src/utils/isEmptyObject.js.map +0 -1
  164. package/dist/production/index.cjs +0 -34
  165. package/dist/production/index.cjs.map +0 -1
  166. package/dist/production/index.js +0 -28
  167. package/dist/production/index.js.map +0 -1
  168. package/dist/production/src/accessorTree/NormalizedPersistedData.cjs +0 -10
  169. package/dist/production/src/accessorTree/NormalizedPersistedData.cjs.map +0 -1
  170. package/dist/production/src/accessorTree/NormalizedPersistedData.js +0 -10
  171. package/dist/production/src/accessorTree/NormalizedPersistedData.js.map +0 -1
  172. package/dist/production/src/accessors/EntityAccessorImpl.cjs +0 -179
  173. package/dist/production/src/accessors/EntityAccessorImpl.cjs.map +0 -1
  174. package/dist/production/src/accessors/EntityAccessorImpl.js +0 -179
  175. package/dist/production/src/accessors/EntityAccessorImpl.js.map +0 -1
  176. package/dist/production/src/accessors/EntityListAccessorImpl.cjs +0 -112
  177. package/dist/production/src/accessors/EntityListAccessorImpl.cjs.map +0 -1
  178. package/dist/production/src/accessors/EntityListAccessorImpl.js +0 -112
  179. package/dist/production/src/accessors/EntityListAccessorImpl.js.map +0 -1
  180. package/dist/production/src/accessors/FieldAccessorImpl.cjs +0 -54
  181. package/dist/production/src/accessors/FieldAccessorImpl.cjs.map +0 -1
  182. package/dist/production/src/accessors/FieldAccessorImpl.js +0 -54
  183. package/dist/production/src/accessors/FieldAccessorImpl.js.map +0 -1
  184. package/dist/production/src/core/AccessorErrorManager.cjs +0 -200
  185. package/dist/production/src/core/AccessorErrorManager.cjs.map +0 -1
  186. package/dist/production/src/core/AccessorErrorManager.js +0 -200
  187. package/dist/production/src/core/AccessorErrorManager.js.map +0 -1
  188. package/dist/production/src/core/Config.cjs +0 -29
  189. package/dist/production/src/core/Config.cjs.map +0 -1
  190. package/dist/production/src/core/Config.js +0 -29
  191. package/dist/production/src/core/Config.js.map +0 -1
  192. package/dist/production/src/core/DataBinding.cjs +0 -354
  193. package/dist/production/src/core/DataBinding.cjs.map +0 -1
  194. package/dist/production/src/core/DataBinding.js +0 -354
  195. package/dist/production/src/core/DataBinding.js.map +0 -1
  196. package/dist/production/src/core/DirtinessTracker.cjs +0 -26
  197. package/dist/production/src/core/DirtinessTracker.cjs.map +0 -1
  198. package/dist/production/src/core/DirtinessTracker.js +0 -26
  199. package/dist/production/src/core/DirtinessTracker.js.map +0 -1
  200. package/dist/production/src/core/ErrorsPreprocessor.cjs +0 -180
  201. package/dist/production/src/core/ErrorsPreprocessor.cjs.map +0 -1
  202. package/dist/production/src/core/ErrorsPreprocessor.js +0 -180
  203. package/dist/production/src/core/ErrorsPreprocessor.js.map +0 -1
  204. package/dist/production/src/core/EventManager.cjs +0 -413
  205. package/dist/production/src/core/EventManager.cjs.map +0 -1
  206. package/dist/production/src/core/EventManager.js +0 -413
  207. package/dist/production/src/core/EventManager.js.map +0 -1
  208. package/dist/production/src/core/MutationGenerator.cjs +0 -668
  209. package/dist/production/src/core/MutationGenerator.cjs.map +0 -1
  210. package/dist/production/src/core/MutationGenerator.js +0 -668
  211. package/dist/production/src/core/MutationGenerator.js.map +0 -1
  212. package/dist/production/src/core/QueryGenerator.cjs +0 -110
  213. package/dist/production/src/core/QueryGenerator.cjs.map +0 -1
  214. package/dist/production/src/core/QueryGenerator.js +0 -110
  215. package/dist/production/src/core/QueryGenerator.js.map +0 -1
  216. package/dist/production/src/core/RealmKeyGenerator.cjs +0 -42
  217. package/dist/production/src/core/RealmKeyGenerator.cjs.map +0 -1
  218. package/dist/production/src/core/RealmKeyGenerator.js +0 -42
  219. package/dist/production/src/core/RealmKeyGenerator.js.map +0 -1
  220. package/dist/production/src/core/RequestResponseNormalizer.cjs +0 -136
  221. package/dist/production/src/core/RequestResponseNormalizer.cjs.map +0 -1
  222. package/dist/production/src/core/RequestResponseNormalizer.js +0 -136
  223. package/dist/production/src/core/RequestResponseNormalizer.js.map +0 -1
  224. package/dist/production/src/core/StateInitializer.cjs +0 -379
  225. package/dist/production/src/core/StateInitializer.cjs.map +0 -1
  226. package/dist/production/src/core/StateInitializer.js +0 -379
  227. package/dist/production/src/core/StateInitializer.js.map +0 -1
  228. package/dist/production/src/core/TreeAugmenter.cjs +0 -354
  229. package/dist/production/src/core/TreeAugmenter.cjs.map +0 -1
  230. package/dist/production/src/core/TreeAugmenter.js +0 -354
  231. package/dist/production/src/core/TreeAugmenter.js.map +0 -1
  232. package/dist/production/src/core/TreeStore.cjs +0 -172
  233. package/dist/production/src/core/TreeStore.cjs.map +0 -1
  234. package/dist/production/src/core/TreeStore.js +0 -172
  235. package/dist/production/src/core/TreeStore.js.map +0 -1
  236. package/dist/production/src/core/exceptions/ErrorLocator.cjs +0 -59
  237. package/dist/production/src/core/exceptions/ErrorLocator.cjs.map +0 -1
  238. package/dist/production/src/core/exceptions/ErrorLocator.js +0 -59
  239. package/dist/production/src/core/exceptions/ErrorLocator.js.map +0 -1
  240. package/dist/production/src/core/exceptions/MarkerSugarer.cjs +0 -51
  241. package/dist/production/src/core/exceptions/MarkerSugarer.cjs.map +0 -1
  242. package/dist/production/src/core/exceptions/MarkerSugarer.js +0 -51
  243. package/dist/production/src/core/exceptions/MarkerSugarer.js.map +0 -1
  244. package/dist/production/src/core/exceptions/TreeParameterSugarer.cjs +0 -33
  245. package/dist/production/src/core/exceptions/TreeParameterSugarer.cjs.map +0 -1
  246. package/dist/production/src/core/exceptions/TreeParameterSugarer.js +0 -33
  247. package/dist/production/src/core/exceptions/TreeParameterSugarer.js.map +0 -1
  248. package/dist/production/src/core/factories/createBatchUpdatesOptions.cjs +0 -23
  249. package/dist/production/src/core/factories/createBatchUpdatesOptions.cjs.map +0 -1
  250. package/dist/production/src/core/factories/createBatchUpdatesOptions.js +0 -23
  251. package/dist/production/src/core/factories/createBatchUpdatesOptions.js.map +0 -1
  252. package/dist/production/src/core/operations/EntityOperations.cjs +0 -226
  253. package/dist/production/src/core/operations/EntityOperations.cjs.map +0 -1
  254. package/dist/production/src/core/operations/EntityOperations.js +0 -226
  255. package/dist/production/src/core/operations/EntityOperations.js.map +0 -1
  256. package/dist/production/src/core/operations/FieldOperations.cjs +0 -73
  257. package/dist/production/src/core/operations/FieldOperations.cjs.map +0 -1
  258. package/dist/production/src/core/operations/FieldOperations.js +0 -73
  259. package/dist/production/src/core/operations/FieldOperations.js.map +0 -1
  260. package/dist/production/src/core/operations/ListOperations.cjs +0 -158
  261. package/dist/production/src/core/operations/ListOperations.cjs.map +0 -1
  262. package/dist/production/src/core/operations/ListOperations.js +0 -158
  263. package/dist/production/src/core/operations/ListOperations.js.map +0 -1
  264. package/dist/production/src/core/operations/OperationsHelpers.cjs +0 -87
  265. package/dist/production/src/core/operations/OperationsHelpers.cjs.map +0 -1
  266. package/dist/production/src/core/operations/OperationsHelpers.js +0 -87
  267. package/dist/production/src/core/operations/OperationsHelpers.js.map +0 -1
  268. package/dist/production/src/core/requestAliases/MutationAlias.cjs +0 -14
  269. package/dist/production/src/core/requestAliases/MutationAlias.cjs.map +0 -1
  270. package/dist/production/src/core/requestAliases/MutationAlias.js +0 -14
  271. package/dist/production/src/core/requestAliases/MutationAlias.js.map +0 -1
  272. package/dist/production/src/core/state/StateIterator.cjs +0 -100
  273. package/dist/production/src/core/state/StateIterator.cjs.map +0 -1
  274. package/dist/production/src/core/state/StateIterator.js +0 -100
  275. package/dist/production/src/core/state/StateIterator.js.map +0 -1
  276. package/dist/production/src/core/state/getEntityMarker.cjs +0 -5
  277. package/dist/production/src/core/state/getEntityMarker.cjs.map +0 -1
  278. package/dist/production/src/core/state/getEntityMarker.js +0 -5
  279. package/dist/production/src/core/state/getEntityMarker.js.map +0 -1
  280. package/dist/production/src/core/utils/getCombinedSignal.cjs +0 -33
  281. package/dist/production/src/core/utils/getCombinedSignal.cjs.map +0 -1
  282. package/dist/production/src/core/utils/getCombinedSignal.js +0 -33
  283. package/dist/production/src/core/utils/getCombinedSignal.js.map +0 -1
  284. package/dist/production/src/fieldHelpers/helpers/FieldHelper.cjs +0 -13
  285. package/dist/production/src/fieldHelpers/helpers/FieldHelper.cjs.map +0 -1
  286. package/dist/production/src/fieldHelpers/helpers/FieldHelper.js +0 -13
  287. package/dist/production/src/fieldHelpers/helpers/FieldHelper.js.map +0 -1
  288. package/dist/production/src/fieldHelpers/helpers/TemporalFieldHelper.cjs +0 -18
  289. package/dist/production/src/fieldHelpers/helpers/TemporalFieldHelper.cjs.map +0 -1
  290. package/dist/production/src/fieldHelpers/helpers/TemporalFieldHelper.js +0 -18
  291. package/dist/production/src/fieldHelpers/helpers/TemporalFieldHelper.js.map +0 -1
  292. package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.cjs +0 -16
  293. package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.cjs.map +0 -1
  294. package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.js +0 -16
  295. package/dist/production/src/fieldHelpers/helpers/UuidFieldHelper.js.map +0 -1
  296. package/dist/production/src/utils/generateEnumerabilityPreventingEntropy.cjs +0 -7
  297. package/dist/production/src/utils/generateEnumerabilityPreventingEntropy.cjs.map +0 -1
  298. package/dist/production/src/utils/generateEnumerabilityPreventingEntropy.js +0 -7
  299. package/dist/production/src/utils/generateEnumerabilityPreventingEntropy.js.map +0 -1
  300. package/dist/production/src/utils/isEmptyObject.cjs +0 -12
  301. package/dist/production/src/utils/isEmptyObject.cjs.map +0 -1
  302. package/dist/production/src/utils/isEmptyObject.js +0 -12
  303. package/dist/production/src/utils/isEmptyObject.js.map +0 -1
  304. package/dist/types/accessorTree/NormalizedPersistedData.d.ts +0 -18
  305. package/dist/types/accessorTree/NormalizedPersistedData.d.ts.map +0 -1
  306. package/dist/types/accessorTree/index.d.ts +0 -2
  307. package/dist/types/accessorTree/index.d.ts.map +0 -1
  308. package/dist/types/accessors/BindingConfig.d.ts +0 -6
  309. package/dist/types/accessors/BindingConfig.d.ts.map +0 -1
  310. package/dist/types/accessors/EntityAccessorImpl.d.ts +0 -56
  311. package/dist/types/accessors/EntityAccessorImpl.d.ts.map +0 -1
  312. package/dist/types/accessors/EntityListAccessorImpl.d.ts +0 -57
  313. package/dist/types/accessors/EntityListAccessorImpl.d.ts.map +0 -1
  314. package/dist/types/accessors/FieldAccessorImpl.d.ts +0 -32
  315. package/dist/types/accessors/FieldAccessorImpl.d.ts.map +0 -1
  316. package/dist/types/accessors/index.d.ts +0 -5
  317. package/dist/types/accessors/index.d.ts.map +0 -1
  318. package/dist/types/core/AccessorErrorManager.d.ts +0 -25
  319. package/dist/types/core/AccessorErrorManager.d.ts.map +0 -1
  320. package/dist/types/core/Config.d.ts +0 -9
  321. package/dist/types/core/Config.d.ts.map +0 -1
  322. package/dist/types/core/DataBinding.d.ts +0 -54
  323. package/dist/types/core/DataBinding.d.ts.map +0 -1
  324. package/dist/types/core/DirtinessTracker.d.ts +0 -9
  325. package/dist/types/core/DirtinessTracker.d.ts.map +0 -1
  326. package/dist/types/core/ErrorsPreprocessor.d.ts +0 -34
  327. package/dist/types/core/ErrorsPreprocessor.d.ts.map +0 -1
  328. package/dist/types/core/EventManager.d.ts +0 -57
  329. package/dist/types/core/EventManager.d.ts.map +0 -1
  330. package/dist/types/core/MutationGenerator.d.ts +0 -49
  331. package/dist/types/core/MutationGenerator.d.ts.map +0 -1
  332. package/dist/types/core/QueryGenerator.d.ts +0 -13
  333. package/dist/types/core/QueryGenerator.d.ts.map +0 -1
  334. package/dist/types/core/RealmKeyGenerator.d.ts +0 -10
  335. package/dist/types/core/RealmKeyGenerator.d.ts.map +0 -1
  336. package/dist/types/core/RequestResponseNormalizer.d.ts +0 -11
  337. package/dist/types/core/RequestResponseNormalizer.d.ts.map +0 -1
  338. package/dist/types/core/StateInitializer.d.ts +0 -34
  339. package/dist/types/core/StateInitializer.d.ts.map +0 -1
  340. package/dist/types/core/TreeAugmenter.d.ts +0 -25
  341. package/dist/types/core/TreeAugmenter.d.ts.map +0 -1
  342. package/dist/types/core/TreeStore.d.ts +0 -30
  343. package/dist/types/core/TreeStore.d.ts.map +0 -1
  344. package/dist/types/core/UpdateMetadata.d.ts +0 -4
  345. package/dist/types/core/UpdateMetadata.d.ts.map +0 -1
  346. package/dist/types/core/exceptions/ErrorLocator.d.ts +0 -8
  347. package/dist/types/core/exceptions/ErrorLocator.d.ts.map +0 -1
  348. package/dist/types/core/exceptions/MarkerSugarer.d.ts +0 -10
  349. package/dist/types/core/exceptions/MarkerSugarer.d.ts.map +0 -1
  350. package/dist/types/core/exceptions/TreeParameterSugarer.d.ts +0 -11
  351. package/dist/types/core/exceptions/TreeParameterSugarer.d.ts.map +0 -1
  352. package/dist/types/core/factories/createBatchUpdatesOptions.d.ts +0 -5
  353. package/dist/types/core/factories/createBatchUpdatesOptions.d.ts.map +0 -1
  354. package/dist/types/core/factories/index.d.ts +0 -2
  355. package/dist/types/core/factories/index.d.ts.map +0 -1
  356. package/dist/types/core/index.d.ts +0 -9
  357. package/dist/types/core/index.d.ts.map +0 -1
  358. package/dist/types/core/operations/EntityOperations.d.ts +0 -26
  359. package/dist/types/core/operations/EntityOperations.d.ts.map +0 -1
  360. package/dist/types/core/operations/FieldOperations.d.ts +0 -22
  361. package/dist/types/core/operations/FieldOperations.d.ts.map +0 -1
  362. package/dist/types/core/operations/ListOperations.d.ts +0 -32
  363. package/dist/types/core/operations/ListOperations.d.ts.map +0 -1
  364. package/dist/types/core/operations/OperationsHelpers.d.ts +0 -14
  365. package/dist/types/core/operations/OperationsHelpers.d.ts.map +0 -1
  366. package/dist/types/core/operations/index.d.ts +0 -4
  367. package/dist/types/core/operations/index.d.ts.map +0 -1
  368. package/dist/types/core/requestAliases/MutationAlias.d.ts +0 -6
  369. package/dist/types/core/requestAliases/MutationAlias.d.ts.map +0 -1
  370. package/dist/types/core/requestAliases/index.d.ts +0 -2
  371. package/dist/types/core/requestAliases/index.d.ts.map +0 -1
  372. package/dist/types/core/state/EntityListState.d.ts +0 -29
  373. package/dist/types/core/state/EntityListState.d.ts.map +0 -1
  374. package/dist/types/core/state/EntityRealmState.d.ts +0 -44
  375. package/dist/types/core/state/EntityRealmState.d.ts.map +0 -1
  376. package/dist/types/core/state/EntityState.d.ts +0 -11
  377. package/dist/types/core/state/EntityState.d.ts.map +0 -1
  378. package/dist/types/core/state/FieldState.d.ts +0 -19
  379. package/dist/types/core/state/FieldState.d.ts.map +0 -1
  380. package/dist/types/core/state/StateIterator.d.ts +0 -14
  381. package/dist/types/core/state/StateIterator.d.ts.map +0 -1
  382. package/dist/types/core/state/StateNode.d.ts +0 -8
  383. package/dist/types/core/state/StateNode.d.ts.map +0 -1
  384. package/dist/types/core/state/getEntityMarker.d.ts +0 -3
  385. package/dist/types/core/state/getEntityMarker.d.ts.map +0 -1
  386. package/dist/types/core/state/index.d.ts +0 -8
  387. package/dist/types/core/state/index.d.ts.map +0 -1
  388. package/dist/types/core/utils/getCombinedSignal.d.ts +0 -2
  389. package/dist/types/core/utils/getCombinedSignal.d.ts.map +0 -1
  390. package/dist/types/core/utils/index.d.ts +0 -2
  391. package/dist/types/core/utils/index.d.ts.map +0 -1
  392. package/dist/types/fieldHelpers/helpers/FieldHelper.d.ts +0 -7
  393. package/dist/types/fieldHelpers/helpers/FieldHelper.d.ts.map +0 -1
  394. package/dist/types/fieldHelpers/helpers/TemporalFieldHelper.d.ts +0 -10
  395. package/dist/types/fieldHelpers/helpers/TemporalFieldHelper.d.ts.map +0 -1
  396. package/dist/types/fieldHelpers/helpers/UuidFieldHelper.d.ts +0 -10
  397. package/dist/types/fieldHelpers/helpers/UuidFieldHelper.d.ts.map +0 -1
  398. package/dist/types/fieldHelpers/helpers/index.d.ts +0 -3
  399. package/dist/types/fieldHelpers/helpers/index.d.ts.map +0 -1
  400. package/dist/types/fieldHelpers/index.d.ts +0 -2
  401. package/dist/types/fieldHelpers/index.d.ts.map +0 -1
  402. package/dist/types/index.d.ts +0 -5
  403. package/dist/types/index.d.ts.map +0 -1
  404. package/dist/types/tsconfig.tsbuildinfo +0 -1
  405. package/dist/types/utils/assertNever.d.ts +0 -2
  406. package/dist/types/utils/assertNever.d.ts.map +0 -1
  407. package/dist/types/utils/generateEnumerabilityPreventingEntropy.d.ts +0 -2
  408. package/dist/types/utils/generateEnumerabilityPreventingEntropy.d.ts.map +0 -1
  409. package/dist/types/utils/index.d.ts +0 -4
  410. package/dist/types/utils/index.d.ts.map +0 -1
  411. package/dist/types/utils/isEmptyObject.d.ts +0 -2
  412. package/dist/types/utils/isEmptyObject.d.ts.map +0 -1
@@ -1,354 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const bindingCommon = require("@contember/binding-common");
4
- const EventManager = require("./EventManager.cjs");
5
- const OperationsHelpers = require("./operations/OperationsHelpers.cjs");
6
- const getEntityMarker = require("./state/getEntityMarker.cjs");
7
- class TreeAugmenter {
8
- constructor(eventManager, stateInitializer, treeStore, skipStateUpdateAfterPersist = false) {
9
- this.eventManager = eventManager;
10
- this.stateInitializer = stateInitializer;
11
- this.treeStore = treeStore;
12
- this.skipStateUpdateAfterPersist = skipStateUpdateAfterPersist;
13
- }
14
- extendPersistedData(newPersistedData, markerTree) {
15
- this.treeStore.mergeInQueryResponse(newPersistedData, markerTree);
16
- }
17
- extendTreeStates(newTreeId, newMarkerTree) {
18
- const subTreeStates = /* @__PURE__ */ new Map();
19
- this.treeStore.markerTrees.set(newTreeId, newMarkerTree);
20
- this.treeStore.subTreeStatesByRoot.set(newTreeId, subTreeStates);
21
- for (const [placeholderName, newSubTreeMarker] of newMarkerTree.subTrees) {
22
- const newState = this.stateInitializer.initializeSubTree(newSubTreeMarker);
23
- subTreeStates.set(placeholderName, newState);
24
- }
25
- }
26
- updatePersistedData(response, operations) {
27
- this.treeStore.mergeInMutationResponse(response, operations);
28
- if (this.skipStateUpdateAfterPersist) {
29
- return;
30
- }
31
- this.eventManager.syncTransaction(() => {
32
- for (const rootStates of this.treeStore.subTreeStatesByRoot.values()) {
33
- for (const [rootPlaceholder, rootState] of rootStates) {
34
- const rootData = this.treeStore.subTreePersistedData.get(rootPlaceholder);
35
- if (rootState.type === "entityList") {
36
- if (!(rootData instanceof Set)) {
37
- continue;
38
- }
39
- this.updateEntityListPersistedData(rootState, rootData);
40
- } else if (rootState.type === "entityRealm") {
41
- if (rootData !== void 0 && !(rootData instanceof bindingCommon.ServerId)) {
42
- continue;
43
- }
44
- this.updateRealmIdIfNecessary(rootState, rootData);
45
- this.updateEntityRealmPersistedData(rootState);
46
- } else {
47
- return bindingCommon.assertNever(rootState);
48
- }
49
- }
50
- }
51
- });
52
- }
53
- resetCreatingSubTrees() {
54
- for (const rootStates of this.treeStore.subTreeStatesByRoot.values()) {
55
- for (const [rootPlaceholder, rootState] of rootStates) {
56
- if (rootState.type === "entityList") {
57
- if (rootState.blueprint.parent !== void 0) {
58
- throw new bindingCommon.BindingError("Entity list root should not have a parent.");
59
- }
60
- if (!rootState.blueprint.marker.parameters.isCreating) {
61
- continue;
62
- }
63
- this.treeStore.subTreePersistedData.delete(rootPlaceholder);
64
- const changesCount = rootState.unpersistedChangesCount;
65
- for (const childState of rootState.children.values()) {
66
- this.treeStore.disposeOfRealm(childState);
67
- }
68
- rootState.accessor = void 0;
69
- rootState.children.clear();
70
- rootState.childrenWithPendingUpdates?.clear();
71
- rootState.errors = void 0;
72
- rootState.plannedRemovals?.clear();
73
- this.eventManager.registerJustUpdated(
74
- rootState,
75
- changesCount ? -1 * changesCount : EventManager.EventManager.NO_CHANGES_DIFFERENCE
76
- );
77
- } else if (rootState.type === "entityRealm") {
78
- if (rootState.blueprint.parent !== void 0) {
79
- throw new bindingCommon.BindingError("Entity realm root should not have a parent.");
80
- }
81
- if (!rootState.blueprint.marker.parameters.isCreating) {
82
- continue;
83
- }
84
- const presentListeners = rootState.eventListeners;
85
- this.treeStore.disposeOfRealm(rootState);
86
- this.treeStore.subTreePersistedData.delete(rootPlaceholder);
87
- const newRootState = this.stateInitializer.initializeSubTree(rootState.blueprint.marker);
88
- newRootState.eventListeners = presentListeners;
89
- OperationsHelpers.OperationsHelpers.purgeStaleListenersAfterIdChange(newRootState);
90
- rootStates.set(rootPlaceholder, newRootState);
91
- this.eventManager.registerJustUpdated(newRootState, EventManager.EventManager.NO_CHANGES_DIFFERENCE);
92
- } else {
93
- bindingCommon.assertNever(rootState);
94
- }
95
- }
96
- }
97
- }
98
- updateRealmIdIfNecessary(realm, newId) {
99
- const currentId = realm.entity.id;
100
- let idToChangeTo = void 0;
101
- if (currentId instanceof bindingCommon.ServerId) {
102
- if (newId === void 0 || newId === null) {
103
- idToChangeTo = new bindingCommon.UnpersistedEntityDummyId();
104
- } else if (currentId.value !== newId.value) {
105
- idToChangeTo = newId;
106
- }
107
- } else if (currentId instanceof bindingCommon.ClientGeneratedUuid) {
108
- idToChangeTo = newId ?? new bindingCommon.UnpersistedEntityDummyId();
109
- } else if (currentId instanceof bindingCommon.UnpersistedEntityDummyId) {
110
- if (newId) {
111
- idToChangeTo = newId;
112
- }
113
- } else {
114
- return bindingCommon.assertNever(currentId);
115
- }
116
- if (idToChangeTo) {
117
- OperationsHelpers.OperationsHelpers.changeRealmId(this.treeStore, this.eventManager, this.stateInitializer, realm, idToChangeTo);
118
- }
119
- }
120
- updateEntityRealmPersistedData(realm) {
121
- const realmId = realm.entity.id;
122
- const persistedData = realmId.existsOnServer ? this.treeStore.persistedEntityData.get(realmId.uniqueValue) : void 0;
123
- for (const [placeholderName, child] of realm.children) {
124
- const childData = persistedData?.get(placeholderName)?.value;
125
- switch (child.type) {
126
- case "field": {
127
- if (childData instanceof bindingCommon.ServerId || childData instanceof Set) {
128
- throw new bindingCommon.BindingError();
129
- }
130
- if (child.persistedValue !== childData) {
131
- const shouldChangeBothValues = child.persistedValue === child.value;
132
- child.persistedValue = childData;
133
- if (shouldChangeBothValues) {
134
- child.value = childData ?? null;
135
- }
136
- this.eventManager.registerJustUpdated(child, EventManager.EventManager.NO_CHANGES_DIFFERENCE);
137
- }
138
- break;
139
- }
140
- case "entityRealm":
141
- case "entityRealmStub": {
142
- if (!(childData instanceof bindingCommon.ServerId) && childData !== void 0 && childData !== null) {
143
- throw new bindingCommon.BindingError();
144
- }
145
- this.updateRealmIdIfNecessary(child, childData);
146
- if (child.type === "entityRealm") {
147
- this.updateEntityRealmPersistedData(child);
148
- }
149
- break;
150
- }
151
- case "entityList": {
152
- if (childData !== void 0 && !(childData instanceof Set)) {
153
- throw new bindingCommon.BindingError();
154
- }
155
- this.updateEntityListPersistedData(child, childData ?? /* @__PURE__ */ new Set());
156
- break;
157
- }
158
- default: {
159
- return bindingCommon.assertNever(child);
160
- }
161
- }
162
- }
163
- }
164
- updateEntityListPersistedData(state, newPersistedIds) {
165
- const persistedWithoutState = /* @__PURE__ */ new Set();
166
- for (const persistedId of newPersistedIds) {
167
- if (!state.children.has(persistedId)) {
168
- persistedWithoutState.add(persistedId);
169
- }
170
- }
171
- for (const [stateId, child] of state.children) {
172
- const childRuntimeId = child.entity.id;
173
- if (!newPersistedIds.has(stateId)) {
174
- if (
175
- // It's a uuid but it's not among the persisted so either it got deleted/disconnected or the client-side
176
- // id generation didn't quite pan out.
177
- childRuntimeId instanceof bindingCommon.ServerId || childRuntimeId instanceof bindingCommon.ClientGeneratedUuid || // No persisted entity id to allocate to this so that's a goodbye.
178
- persistedWithoutState.size === 0 || // not a persisted entity
179
- child.type === "entityRealmStub" || // We couldn't find a matching persisted entity
180
- !this.tryAssignIdToMatching(child, persistedWithoutState)
181
- ) {
182
- state.getAccessor().disconnectEntity(child.getAccessor());
183
- continue;
184
- }
185
- } else if (childRuntimeId instanceof bindingCommon.ClientGeneratedUuid) {
186
- OperationsHelpers.OperationsHelpers.changeRealmId(
187
- this.treeStore,
188
- this.eventManager,
189
- this.stateInitializer,
190
- child,
191
- new bindingCommon.ServerId(childRuntimeId.value, child.entity.entityName)
192
- );
193
- }
194
- if (child.type === "entityRealm") {
195
- this.updateEntityRealmPersistedData(child);
196
- }
197
- }
198
- for (const unclaimedPersistedId of persistedWithoutState) {
199
- this.stateInitializer.initializeEntityRealm(new bindingCommon.ServerId(unclaimedPersistedId, state.entityName), state.entityName, {
200
- type: "listEntity",
201
- parent: state
202
- });
203
- }
204
- state.children.changeKeyOrder(newPersistedIds);
205
- }
206
- tryAssignIdToMatching(realm, ids) {
207
- for (const candidateId of ids) {
208
- if (this.isEntityMatching(realm, candidateId)) {
209
- OperationsHelpers.OperationsHelpers.changeRealmId(
210
- this.treeStore,
211
- this.eventManager,
212
- this.stateInitializer,
213
- realm,
214
- new bindingCommon.ServerId(candidateId, realm.entity.entityName)
215
- );
216
- ids.delete(candidateId);
217
- return true;
218
- }
219
- }
220
- return false;
221
- }
222
- isEntityMatching(realm, id) {
223
- const uniqueId = bindingCommon.ServerId.formatUniqueValue(id, realm.entity.entityName);
224
- const persistedData = this.treeStore.persistedEntityData.get(uniqueId);
225
- const pathBack = this.treeStore.getPathBackToParent(realm);
226
- for (const [placeholderName, child] of realm.children) {
227
- const childData = persistedData?.get(placeholderName)?.value;
228
- switch (child.type) {
229
- case "field": {
230
- if (childData instanceof bindingCommon.ServerId || childData instanceof Set) {
231
- throw new bindingCommon.BindingError();
232
- }
233
- const value = child.value ?? child.fieldMarker.defaultValue ?? null;
234
- if (value !== null && childData !== value) {
235
- return false;
236
- }
237
- break;
238
- }
239
- case "entityRealm":
240
- case "entityRealmStub": {
241
- if (!(childData instanceof bindingCommon.ServerId) && childData !== void 0 && childData !== null) {
242
- throw new bindingCommon.BindingError();
243
- }
244
- if (child.entity.id.existsOnServer || child.entity.id instanceof bindingCommon.ClientGeneratedUuid) {
245
- if (child.entity.id.value !== childData?.value) {
246
- return false;
247
- }
248
- } else if (childData) {
249
- const marker = getEntityMarker.getEntityMarker(child);
250
- if (!(marker instanceof bindingCommon.HasOneRelationMarker)) {
251
- throw new bindingCommon.BindingError();
252
- }
253
- if (pathBack?.fieldBackToParent === marker.parameters.field) {
254
- continue;
255
- }
256
- if (child.type !== "entityRealm" || !this.isEntityMatching(child, childData.value)) {
257
- return false;
258
- }
259
- } else if (child.type === "entityRealmStub") {
260
- break;
261
- } else {
262
- if (!this.isEmptyEntity(child)) {
263
- return false;
264
- }
265
- }
266
- break;
267
- }
268
- case "entityList": {
269
- if (childData !== void 0 && !(childData instanceof Set)) {
270
- throw new bindingCommon.BindingError();
271
- }
272
- if (!childData) {
273
- break;
274
- }
275
- if (childData?.size !== child.children.size) {
276
- return false;
277
- }
278
- const remainingIds = new Set(childData);
279
- for (const childItem of child.children.values()) {
280
- if (childItem.entity.id.existsOnServer || childItem.entity.id instanceof bindingCommon.ClientGeneratedUuid) {
281
- if (!childData.has(childItem.entity.id.value)) {
282
- return false;
283
- }
284
- remainingIds.delete(childItem.entity.id.value);
285
- }
286
- }
287
- for (const childItem of child.children.values()) {
288
- if (!(childItem.entity.id.existsOnServer || childItem.entity.id instanceof bindingCommon.ClientGeneratedUuid) && childItem.type === "entityRealm") {
289
- let hasMatch = false;
290
- for (const id2 of remainingIds) {
291
- if (this.isEntityMatching(childItem, id2)) {
292
- remainingIds.delete(id2);
293
- hasMatch = true;
294
- break;
295
- }
296
- }
297
- if (!hasMatch) {
298
- return false;
299
- }
300
- }
301
- }
302
- if (remainingIds.size !== 0) {
303
- return false;
304
- }
305
- break;
306
- }
307
- default: {
308
- return bindingCommon.assertNever(child);
309
- }
310
- }
311
- }
312
- return true;
313
- }
314
- isEmptyEntity(entity) {
315
- const pathBack = this.treeStore.getPathBackToParent(entity);
316
- for (const [placeholderName, child] of entity.children) {
317
- if (child.type === "field") {
318
- if (child.fieldMarker.isNonbearing) {
319
- continue;
320
- }
321
- if (child.value !== null || child.fieldMarker.defaultValue !== null) {
322
- return false;
323
- }
324
- } else if (child.type === "entityRealm") {
325
- const marker = getEntityMarker.getEntityMarker(child);
326
- const isNonBearing = marker.parameters.isNonbearing;
327
- if (isNonBearing) {
328
- continue;
329
- }
330
- if (!(marker instanceof bindingCommon.HasOneRelationMarker)) {
331
- throw new bindingCommon.BindingError();
332
- }
333
- if (pathBack?.fieldBackToParent === marker.parameters.field) {
334
- continue;
335
- }
336
- if (!this.isEmptyEntity(child)) {
337
- return false;
338
- }
339
- } else if (child.type === "entityList") {
340
- if (child.blueprint.marker.parameters.isNonbearing) {
341
- continue;
342
- }
343
- for (const childItem of child.children.values()) {
344
- if (childItem.type === "entityRealm" && !this.isEmptyEntity(childItem)) {
345
- return false;
346
- }
347
- }
348
- }
349
- }
350
- return true;
351
- }
352
- }
353
- exports.TreeAugmenter = TreeAugmenter;
354
- //# sourceMappingURL=TreeAugmenter.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TreeAugmenter.cjs","sources":["../../../../../packages/binding-legacy/src/core/TreeAugmenter.ts"],"sourcesContent":["import {\n\tClientGeneratedUuid,\n\tHasOneRelationMarker,\n\tReceivedDataTree,\n\tRuntimeId,\n\tServerId,\n\tUnpersistedEntityDummyId,\n} from '@contember/binding-common'\nimport { BindingError } from '@contember/binding-common'\nimport type { MarkerTreeRoot } from '@contember/binding-common'\nimport type { EntityId, PlaceholderName, TreeRootId } from '@contember/binding-common'\nimport { assertNever } from '@contember/binding-common'\nimport { EventManager } from './EventManager'\nimport { OperationsHelpers } from './operations/OperationsHelpers'\nimport { EntityListState, EntityRealmState, EntityRealmStateStub, getEntityMarker, RootStateNode } from './state'\nimport type { StateInitializer } from './StateInitializer'\nimport type { TreeStore } from './TreeStore'\nimport { SubMutationOperation } from './MutationGenerator'\nimport { EntityListPersistedData } from '../accessorTree'\n\nexport class TreeAugmenter {\n\tpublic constructor(\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t\tprivate readonly skipStateUpdateAfterPersist: boolean = false,\n\t) {}\n\n\tpublic extendPersistedData(newPersistedData: ReceivedDataTree, markerTree: MarkerTreeRoot) {\n\t\t// TODO this doesn't yet handle updates for entities whose persisted data just gets magically changed without notice.\n\t\tthis.treeStore.mergeInQueryResponse(newPersistedData, markerTree)\n\t}\n\n\tpublic extendTreeStates(newTreeId: TreeRootId | undefined, newMarkerTree: MarkerTreeRoot): void {\n\t\tconst subTreeStates: Map<PlaceholderName, RootStateNode> = new Map()\n\n\t\tthis.treeStore.markerTrees.set(newTreeId, newMarkerTree)\n\t\tthis.treeStore.subTreeStatesByRoot.set(newTreeId, subTreeStates)\n\n\t\tfor (const [placeholderName, newSubTreeMarker] of newMarkerTree.subTrees) {\n\t\t\tconst newState = this.stateInitializer.initializeSubTree(newSubTreeMarker)\n\t\t\tsubTreeStates.set(placeholderName, newState)\n\t\t}\n\t}\n\n\tpublic updatePersistedData(response: ReceivedDataTree, operations: SubMutationOperation[]) {\n\t\tthis.treeStore.mergeInMutationResponse(response, operations)\n\t\tif (this.skipStateUpdateAfterPersist) {\n\t\t\treturn\n\t\t}\n\t\tthis.eventManager.syncTransaction(() => {\n\t\t\tfor (const rootStates of this.treeStore.subTreeStatesByRoot.values()) {\n\t\t\t\t// for (const rootPlaceholder in response) {\n\t\t\t\t// \tconst rootState = rootStates.get(rootPlaceholder)\n\t\t\t\t//\n\t\t\t\t// \tif (rootState === undefined) {\n\t\t\t\t// \t\tcontinue\n\t\t\t\t// \t}\n\t\t\t\t// TODO the above would be better, only refreshing roots which participated in the mutation. However, due to\n\t\t\t\t// \thow mutations are currently generated, we cannot assume that only roots present in the response need\n\t\t\t\t// \trefreshed. So we just refresh all.\n\t\t\t\tfor (const [rootPlaceholder, rootState] of rootStates) {\n\t\t\t\t\tconst rootData = this.treeStore.subTreePersistedData.get(rootPlaceholder)\n\n\t\t\t\t\tif (rootState.type === 'entityList') {\n\t\t\t\t\t\tif (!(rootData instanceof Set)) {\n\t\t\t\t\t\t\tcontinue // This should never happen.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.updateEntityListPersistedData(rootState, rootData)\n\t\t\t\t\t} else if (rootState.type === 'entityRealm') {\n\t\t\t\t\t\tif (rootData !== undefined && !(rootData instanceof ServerId)) {\n\t\t\t\t\t\t\tcontinue // This should never happen.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.updateRealmIdIfNecessary(rootState, rootData)\n\t\t\t\t\t\tthis.updateEntityRealmPersistedData(rootState)\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn assertNever(rootState)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic resetCreatingSubTrees() {\n\t\tfor (const rootStates of this.treeStore.subTreeStatesByRoot.values()) {\n\t\t\tfor (const [rootPlaceholder, rootState] of rootStates) {\n\t\t\t\tif (rootState.type === 'entityList') {\n\t\t\t\t\tif (rootState.blueprint.parent !== undefined) {\n\t\t\t\t\t\tthrow new BindingError('Entity list root should not have a parent.')\n\t\t\t\t\t}\n\t\t\t\t\tif (!rootState.blueprint.marker.parameters.isCreating) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.treeStore.subTreePersistedData.delete(rootPlaceholder)\n\t\t\t\t\tconst changesCount = rootState.unpersistedChangesCount\n\n\t\t\t\t\t// Just emptying the list. But the list itself can stay.\n\t\t\t\t\tfor (const childState of rootState.children.values()) {\n\t\t\t\t\t\tthis.treeStore.disposeOfRealm(childState)\n\t\t\t\t\t}\n\t\t\t\t\trootState.accessor = undefined\n\t\t\t\t\trootState.children.clear()\n\t\t\t\t\trootState.childrenWithPendingUpdates?.clear()\n\t\t\t\t\trootState.errors = undefined\n\t\t\t\t\trootState.plannedRemovals?.clear()\n\n\t\t\t\t\tthis.eventManager.registerJustUpdated(\n\t\t\t\t\t\trootState,\n\t\t\t\t\t\tchangesCount ? -1 * changesCount : EventManager.NO_CHANGES_DIFFERENCE,\n\t\t\t\t\t)\n\t\t\t\t} else if (rootState.type === 'entityRealm') {\n\t\t\t\t\tif (rootState.blueprint.parent !== undefined) {\n\t\t\t\t\t\tthrow new BindingError('Entity realm root should not have a parent.')\n\t\t\t\t\t}\n\t\t\t\t\tif (!rootState.blueprint.marker.parameters.isCreating) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tconst presentListeners = rootState.eventListeners\n\t\t\t\t\tthis.treeStore.disposeOfRealm(rootState)\n\n\t\t\t\t\t// It's crucial to delete the persisted data before we re-initialize so that we get a fresh, new entity.\n\t\t\t\t\tthis.treeStore.subTreePersistedData.delete(rootPlaceholder)\n\t\t\t\t\tconst newRootState = this.stateInitializer.initializeSubTree(rootState.blueprint.marker)\n\n\t\t\t\t\t// We preserve the previous listeners but purge some of them.\n\t\t\t\t\tnewRootState.eventListeners = presentListeners\n\t\t\t\t\tOperationsHelpers.purgeStaleListenersAfterIdChange(newRootState as EntityRealmState)\n\n\t\t\t\t\trootStates.set(rootPlaceholder, newRootState)\n\n\t\t\t\t\tthis.eventManager.registerJustUpdated(newRootState, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t\t} else {\n\t\t\t\t\tassertNever(rootState)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate updateRealmIdIfNecessary(\n\t\trealm: EntityRealmState | EntityRealmStateStub,\n\t\tnewId: ServerId | undefined | null,\n\t) {\n\t\tconst currentId = realm.entity.id\n\t\tlet idToChangeTo: RuntimeId | undefined = undefined\n\n\t\tif (currentId instanceof ServerId) {\n\t\t\tif (newId === undefined || newId === null) {\n\t\t\t\tidToChangeTo = new UnpersistedEntityDummyId()\n\t\t\t} else if (currentId.value !== newId.value) {\n\t\t\t\tidToChangeTo = newId\n\t\t\t}\n\t\t} else if (currentId instanceof ClientGeneratedUuid) {\n\t\t\tidToChangeTo = newId ?? new UnpersistedEntityDummyId()\n\t\t} else if (currentId instanceof UnpersistedEntityDummyId) {\n\t\t\tif (newId) {\n\t\t\t\tidToChangeTo = newId\n\t\t\t}\n\t\t} else {\n\t\t\treturn assertNever(currentId)\n\t\t}\n\t\tif (idToChangeTo) {\n\t\t\tOperationsHelpers.changeRealmId(this.treeStore, this.eventManager, this.stateInitializer, realm, idToChangeTo)\n\t\t}\n\t}\n\n\tprivate updateEntityRealmPersistedData(realm: EntityRealmState) {\n\t\tconst realmId = realm.entity.id\n\t\tconst persistedData = realmId.existsOnServer ? this.treeStore.persistedEntityData.get(realmId.uniqueValue) : undefined\n\n\t\tfor (const [placeholderName, child] of realm.children) {\n\t\t\tconst childData = persistedData?.get(placeholderName)?.value\n\n\t\t\tswitch (child.type) {\n\t\t\t\tcase 'field': {\n\t\t\t\t\tif (childData instanceof ServerId || childData instanceof Set) {\n\t\t\t\t\t\tthrow new BindingError()\n\t\t\t\t\t}\n\n\t\t\t\t\tif (child.persistedValue !== childData) {\n\t\t\t\t\t\tconst shouldChangeBothValues = child.persistedValue === child.value\n\n\t\t\t\t\t\tchild.persistedValue = childData\n\t\t\t\t\t\tif (shouldChangeBothValues) {\n\t\t\t\t\t\t\tchild.value = childData ?? null\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.eventManager.registerJustUpdated(child, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'entityRealm':\n\t\t\t\tcase 'entityRealmStub': {\n\t\t\t\t\tif (!(childData instanceof ServerId) && childData !== undefined && childData !== null) {\n\t\t\t\t\t\tthrow new BindingError()\n\t\t\t\t\t}\n\t\t\t\t\tthis.updateRealmIdIfNecessary(child, childData)\n\t\t\t\t\tif (child.type === 'entityRealm') {\n\t\t\t\t\t\tthis.updateEntityRealmPersistedData(child)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'entityList': {\n\t\t\t\t\tif (childData !== undefined && !(childData instanceof Set)) {\n\t\t\t\t\t\tthrow new BindingError()\n\t\t\t\t\t}\n\t\t\t\t\tthis.updateEntityListPersistedData(child, childData ?? new Set()) // TODO!!\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\treturn assertNever(child)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate updateEntityListPersistedData(state: EntityListState, newPersistedIds: EntityListPersistedData) {\n\t\tconst persistedWithoutState = new Set<EntityId>()\n\n\t\tfor (const persistedId of newPersistedIds) {\n\t\t\tif (!state.children.has(persistedId)) {\n\t\t\t\tpersistedWithoutState.add(persistedId)\n\t\t\t}\n\t\t}\n\t\tfor (const [stateId, child] of state.children) {\n\t\t\tconst childRuntimeId = child.entity.id\n\t\t\tif (!newPersistedIds.has(stateId)) {\n\t\t\t\tif (\n\t\t\t\t\t// It's a uuid but it's not among the persisted so either it got deleted/disconnected or the client-side\n\t\t\t\t\t// id generation didn't quite pan out.\n\t\t\t\t\tchildRuntimeId instanceof ServerId ||\n\t\t\t\t\tchildRuntimeId instanceof ClientGeneratedUuid ||\n\t\t\t\t\t// No persisted entity id to allocate to this so that's a goodbye.\n\t\t\t\t\tpersistedWithoutState.size === 0 ||\n\t\t\t\t\t// not a persisted entity\n\t\t\t\t\tchild.type === 'entityRealmStub' ||\n\t\t\t\t\t// We couldn't find a matching persisted entity\n\t\t\t\t\t!this.tryAssignIdToMatching(child, persistedWithoutState)\n\t\t\t\t) {\n\t\t\t\t\tstate.getAccessor().disconnectEntity(child.getAccessor())\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t} else if (childRuntimeId instanceof ClientGeneratedUuid) {\n\t\t\t\tOperationsHelpers.changeRealmId(\n\t\t\t\t\tthis.treeStore,\n\t\t\t\t\tthis.eventManager,\n\t\t\t\t\tthis.stateInitializer,\n\t\t\t\t\tchild,\n\t\t\t\t\tnew ServerId(childRuntimeId.value, child.entity.entityName),\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (child.type === 'entityRealm') {\n\t\t\t\tthis.updateEntityRealmPersistedData(child)\n\t\t\t}\n\t\t}\n\t\tfor (const unclaimedPersistedId of persistedWithoutState) {\n\t\t\tthis.stateInitializer.initializeEntityRealm(new ServerId(unclaimedPersistedId, state.entityName), state.entityName, {\n\t\t\t\ttype: 'listEntity',\n\t\t\t\tparent: state,\n\t\t\t})\n\t\t}\n\t\t// All that remains now is the order.\n\t\tstate.children.changeKeyOrder(newPersistedIds)\n\t}\n\n\tprivate tryAssignIdToMatching(realm: EntityRealmState, ids: Set<EntityId>) {\n\t\tfor (const candidateId of ids) {\n\t\t\tif (this.isEntityMatching(realm, candidateId)) {\n\t\t\t\tOperationsHelpers.changeRealmId(\n\t\t\t\t\tthis.treeStore,\n\t\t\t\t\tthis.eventManager,\n\t\t\t\t\tthis.stateInitializer,\n\t\t\t\t\trealm,\n\t\t\t\t\tnew ServerId(candidateId, realm.entity.entityName),\n\t\t\t\t)\n\t\t\t\tids.delete(candidateId)\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\n\tprivate isEntityMatching(realm: EntityRealmState, id: EntityId) {\n\t\tconst uniqueId = ServerId.formatUniqueValue(id, realm.entity.entityName)\n\t\tconst persistedData = this.treeStore.persistedEntityData.get(uniqueId)\n\t\tconst pathBack = this.treeStore.getPathBackToParent(realm)\n\t\tfor (const [placeholderName, child] of realm.children) {\n\t\t\tconst childData = persistedData?.get(placeholderName)?.value\n\n\t\t\tswitch (child.type) {\n\t\t\t\tcase 'field': {\n\t\t\t\t\tif (childData instanceof ServerId || childData instanceof Set) {\n\t\t\t\t\t\tthrow new BindingError()\n\t\t\t\t\t}\n\t\t\t\t\tconst value = child.value ?? child.fieldMarker.defaultValue ?? null\n\t\t\t\t\tif (value !== null && childData !== value) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'entityRealm':\n\t\t\t\tcase 'entityRealmStub': {\n\t\t\t\t\tif (!(childData instanceof ServerId) && childData !== undefined && childData !== null) {\n\t\t\t\t\t\tthrow new BindingError()\n\t\t\t\t\t}\n\t\t\t\t\tif (child.entity.id.existsOnServer || child.entity.id instanceof ClientGeneratedUuid) {\n\t\t\t\t\t\tif (child.entity.id.value !== childData?.value) {\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (childData) {\n\t\t\t\t\t\tconst marker = getEntityMarker(child)\n\t\t\t\t\t\tif (!(marker instanceof HasOneRelationMarker)) {\n\t\t\t\t\t\t\tthrow new BindingError()\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (pathBack?.fieldBackToParent === marker.parameters.field) {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (child.type !== 'entityRealm' || !this.isEntityMatching(child, childData.value)) {\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (child.type === 'entityRealmStub') {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (!this.isEmptyEntity(child)) {\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'entityList': {\n\t\t\t\t\tif (childData !== undefined && !(childData instanceof Set)) {\n\t\t\t\t\t\tthrow new BindingError()\n\t\t\t\t\t}\n\t\t\t\t\tif (!childData){\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tif (childData?.size !== child.children.size) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t\tconst remainingIds = new Set(childData)\n\n\t\t\t\t\t// first check items with known ids\n\t\t\t\t\tfor (const childItem of child.children.values()) {\n\t\t\t\t\t\tif ((childItem.entity.id.existsOnServer || childItem.entity.id instanceof ClientGeneratedUuid)) {\n\t\t\t\t\t\t\tif (!childData.has(childItem.entity.id.value)) {\n\t\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tremainingIds.delete(childItem.entity.id.value)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// then check items with unknown ids\n\t\t\t\t\tfor (const childItem of child.children.values()) {\n\t\t\t\t\t\tif (!(childItem.entity.id.existsOnServer || childItem.entity.id instanceof ClientGeneratedUuid) && childItem.type === 'entityRealm') {\n\t\t\t\t\t\t\tlet hasMatch = false\n\t\t\t\t\t\t\tfor (const id of remainingIds) {\n\t\t\t\t\t\t\t\tif (this.isEntityMatching(childItem, id)) {\n\t\t\t\t\t\t\t\t\tremainingIds.delete(id)\n\t\t\t\t\t\t\t\t\thasMatch = true\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!hasMatch) {\n\t\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (remainingIds.size !== 0) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\treturn assertNever(child)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\n\tprivate isEmptyEntity(entity: EntityRealmState) {\n\t\tconst pathBack = this.treeStore.getPathBackToParent(entity)\n\t\tfor (const [placeholderName, child] of entity.children) {\n\t\t\tif (child.type === 'field') {\n\t\t\t\tif (child.fieldMarker.isNonbearing) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif ((child.value !== null || child.fieldMarker.defaultValue !== null)) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} else if (child.type === 'entityRealm') {\n\t\t\t\tconst marker = getEntityMarker(child)\n\t\t\t\tconst isNonBearing = marker.parameters.isNonbearing\n\t\t\t\tif (isNonBearing) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (!(marker instanceof HasOneRelationMarker)) {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\t\t\t\tif (pathBack?.fieldBackToParent === marker.parameters.field) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (!this.isEmptyEntity(child)) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} else if (child.type === 'entityList') {\n\t\t\t\tif (child.blueprint.marker.parameters.isNonbearing) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfor (const childItem of child.children.values()) {\n\t\t\t\t\tif (childItem.type === 'entityRealm' && !this.isEmptyEntity(childItem)) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n}\n"],"names":["ServerId","assertNever","BindingError","EventManager","OperationsHelpers","UnpersistedEntityDummyId","ClientGeneratedUuid","getEntityMarker","HasOneRelationMarker","id"],"mappings":";;;;;;AAoBO,MAAM,cAAc;AAAA,EACnB,YACW,cACA,kBACA,WACA,8BAAuC,OACvD;AAJgB,SAAA,eAAA;AACA,SAAA,mBAAA;AACA,SAAA,YAAA;AACA,SAAA,8BAAA;AAAA,EAAA;AAAA,EAGX,oBAAoB,kBAAoC,YAA4B;AAErF,SAAA,UAAU,qBAAqB,kBAAkB,UAAU;AAAA,EAAA;AAAA,EAG1D,iBAAiB,WAAmC,eAAqC;AACzF,UAAA,oCAAyD,IAAI;AAEnE,SAAK,UAAU,YAAY,IAAI,WAAW,aAAa;AACvD,SAAK,UAAU,oBAAoB,IAAI,WAAW,aAAa;AAE/D,eAAW,CAAC,iBAAiB,gBAAgB,KAAK,cAAc,UAAU;AACzE,YAAM,WAAW,KAAK,iBAAiB,kBAAkB,gBAAgB;AAC3D,oBAAA,IAAI,iBAAiB,QAAQ;AAAA,IAAA;A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