@contember/binding 1.2.6 → 1.3.0-alpha.10

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 (1106) hide show
  1. package/dist/development/BindingError.cjs +10 -0
  2. package/dist/development/BindingError.cjs.map +1 -0
  3. package/dist/development/accessorTree/NormalizedPersistedData.cjs +10 -0
  4. package/dist/development/accessorTree/NormalizedPersistedData.cjs.map +1 -0
  5. package/dist/development/accessorTree/RuntimeId.cjs +64 -0
  6. package/dist/development/accessorTree/RuntimeId.cjs.map +1 -0
  7. package/dist/development/accessorTree/RuntimeId.js +5 -5
  8. package/dist/development/accessorTree/RuntimeId.js.map +1 -1
  9. package/dist/development/accessors/EntityAccessor.cjs +169 -0
  10. package/dist/development/accessors/EntityAccessor.cjs.map +1 -0
  11. package/dist/development/accessors/EntityAccessor.js +1 -1
  12. package/dist/development/accessors/EntityAccessor.js.map +1 -1
  13. package/dist/development/accessors/EntityListAccessor.cjs +101 -0
  14. package/dist/development/accessors/EntityListAccessor.cjs.map +1 -0
  15. package/dist/development/accessors/ErrorAccessor.cjs +16 -0
  16. package/dist/development/accessors/ErrorAccessor.cjs.map +1 -0
  17. package/dist/development/accessors/FieldAccessor.cjs +59 -0
  18. package/dist/development/accessors/FieldAccessor.cjs.map +1 -0
  19. package/dist/development/accessors/TreeRootAccessor.cjs +14 -0
  20. package/dist/development/accessors/TreeRootAccessor.cjs.map +1 -0
  21. package/dist/development/accessors/TreeRootAccessor.js.map +1 -1
  22. package/dist/development/bindingTypes.cjs +9 -0
  23. package/dist/development/bindingTypes.cjs.map +1 -0
  24. package/dist/development/core/AccessorErrorManager.cjs +207 -0
  25. package/dist/development/core/AccessorErrorManager.cjs.map +1 -0
  26. package/dist/development/core/AccessorErrorManager.js +6 -5
  27. package/dist/development/core/AccessorErrorManager.js.map +1 -1
  28. package/dist/development/core/Config.cjs +32 -0
  29. package/dist/development/core/Config.cjs.map +1 -0
  30. package/dist/development/core/Config.js +3 -3
  31. package/dist/development/core/Config.js.map +1 -1
  32. package/dist/development/core/DataBinding.cjs +352 -0
  33. package/dist/development/core/DataBinding.cjs.map +1 -0
  34. package/dist/development/core/DataBinding.js +56 -49
  35. package/dist/development/core/DataBinding.js.map +1 -1
  36. package/dist/development/core/DirtinessTracker.cjs +29 -0
  37. package/dist/development/core/DirtinessTracker.cjs.map +1 -0
  38. package/dist/development/core/ErrorsPreprocessor.cjs +181 -0
  39. package/dist/development/core/ErrorsPreprocessor.cjs.map +1 -0
  40. package/dist/development/core/ErrorsPreprocessor.js +16 -16
  41. package/dist/development/core/ErrorsPreprocessor.js.map +1 -1
  42. package/dist/development/core/EventManager.cjs +440 -0
  43. package/dist/development/core/EventManager.cjs.map +1 -0
  44. package/dist/development/core/EventManager.js +7 -5
  45. package/dist/development/core/EventManager.js.map +1 -1
  46. package/dist/development/core/MarkerComparator.cjs +79 -0
  47. package/dist/development/core/MarkerComparator.cjs.map +1 -0
  48. package/dist/development/core/MarkerComparator.js.map +1 -1
  49. package/dist/development/core/MarkerMerger.cjs +252 -0
  50. package/dist/development/core/MarkerMerger.cjs.map +1 -0
  51. package/dist/development/core/MarkerMerger.js +2 -2
  52. package/dist/development/core/MarkerMerger.js.map +1 -1
  53. package/dist/development/core/MutationGenerator.cjs +635 -0
  54. package/dist/development/core/MutationGenerator.cjs.map +1 -0
  55. package/dist/development/core/MutationGenerator.js +341 -294
  56. package/dist/development/core/MutationGenerator.js.map +1 -1
  57. package/dist/development/core/QueryGenerator.cjs +113 -0
  58. package/dist/development/core/QueryGenerator.cjs.map +1 -0
  59. package/dist/development/core/QueryGenerator.js +62 -75
  60. package/dist/development/core/QueryGenerator.js.map +1 -1
  61. package/dist/development/core/RealmKeyGenerator.cjs +47 -0
  62. package/dist/development/core/RealmKeyGenerator.cjs.map +1 -0
  63. package/dist/development/core/RealmKeyGenerator.js.map +1 -1
  64. package/dist/development/core/RequestResponseNormalizer.cjs +125 -0
  65. package/dist/development/core/RequestResponseNormalizer.cjs.map +1 -0
  66. package/dist/development/core/StateInitializer.cjs +389 -0
  67. package/dist/development/core/StateInitializer.cjs.map +1 -0
  68. package/dist/development/core/StateInitializer.js +2 -2
  69. package/dist/development/core/StateInitializer.js.map +1 -1
  70. package/dist/development/core/TreeAugmenter.cjs +213 -0
  71. package/dist/development/core/TreeAugmenter.cjs.map +1 -0
  72. package/dist/development/core/TreeFilterGenerator.cjs +83 -0
  73. package/dist/development/core/TreeFilterGenerator.cjs.map +1 -0
  74. package/dist/development/core/TreeParameterMerger.cjs +304 -0
  75. package/dist/development/core/TreeParameterMerger.cjs.map +1 -0
  76. package/dist/development/core/TreeParameterMerger.js +8 -0
  77. package/dist/development/core/TreeParameterMerger.js.map +1 -1
  78. package/dist/development/core/TreeStore.cjs +182 -0
  79. package/dist/development/core/TreeStore.cjs.map +1 -0
  80. package/dist/development/core/TreeStore.js +1 -1
  81. package/dist/development/core/TreeStore.js.map +1 -1
  82. package/dist/development/core/VariableInputTransformer.cjs +24 -0
  83. package/dist/development/core/VariableInputTransformer.cjs.map +1 -0
  84. package/dist/development/core/VariableInputTransformer.js.map +1 -1
  85. package/dist/development/core/exceptions/ErrorLocator.cjs +62 -0
  86. package/dist/development/core/exceptions/ErrorLocator.cjs.map +1 -0
  87. package/dist/development/core/exceptions/LocalizedBindingError.cjs +14 -0
  88. package/dist/development/core/exceptions/LocalizedBindingError.cjs.map +1 -0
  89. package/dist/development/core/exceptions/MarkerSugarer.cjs +56 -0
  90. package/dist/development/core/exceptions/MarkerSugarer.cjs.map +1 -0
  91. package/dist/development/core/exceptions/TreeParameterSugarer.cjs +33 -0
  92. package/dist/development/core/exceptions/TreeParameterSugarer.cjs.map +1 -0
  93. package/dist/development/core/exceptions/TreeParameterSugarer.js.map +1 -1
  94. package/dist/development/core/factories/createBatchUpdatesOptions.cjs +20 -0
  95. package/dist/development/core/factories/createBatchUpdatesOptions.cjs.map +1 -0
  96. package/dist/development/core/factories/createBatchUpdatesOptions.js.map +1 -1
  97. package/dist/development/core/operations/EntityOperations.cjs +238 -0
  98. package/dist/development/core/operations/EntityOperations.cjs.map +1 -0
  99. package/dist/development/core/operations/EntityOperations.js +1 -1
  100. package/dist/development/core/operations/EntityOperations.js.map +1 -1
  101. package/dist/development/core/operations/FieldOperations.cjs +96 -0
  102. package/dist/development/core/operations/FieldOperations.cjs.map +1 -0
  103. package/dist/development/core/operations/FieldOperations.js +1 -1
  104. package/dist/development/core/operations/FieldOperations.js.map +1 -1
  105. package/dist/development/core/operations/ListOperations.cjs +159 -0
  106. package/dist/development/core/operations/ListOperations.cjs.map +1 -0
  107. package/dist/development/core/operations/ListOperations.js.map +1 -1
  108. package/dist/development/core/operations/OperationsHelpers.cjs +85 -0
  109. package/dist/development/core/operations/OperationsHelpers.cjs.map +1 -0
  110. package/dist/development/core/operations/OperationsHelpers.js.map +1 -1
  111. package/dist/development/core/requestAliases/MutationAlias.cjs +14 -0
  112. package/dist/development/core/requestAliases/MutationAlias.cjs.map +1 -0
  113. package/dist/development/core/requestAliases/MutationAlias.js.map +1 -1
  114. package/dist/development/core/schema/Schema.cjs +39 -0
  115. package/dist/development/core/schema/Schema.cjs.map +1 -0
  116. package/dist/development/core/schema/Schema.js.map +1 -1
  117. package/dist/development/core/schema/SchemaLoader.cjs +28 -0
  118. package/dist/development/core/schema/SchemaLoader.cjs.map +1 -0
  119. package/dist/development/core/schema/SchemaLoader.js +2 -2
  120. package/dist/development/core/schema/SchemaLoader.js.map +1 -1
  121. package/dist/development/core/schema/SchemaPreprocessor.cjs +38 -0
  122. package/dist/development/core/schema/SchemaPreprocessor.cjs.map +1 -0
  123. package/dist/development/core/state/StateIterator.cjs +100 -0
  124. package/dist/development/core/state/StateIterator.cjs.map +1 -0
  125. package/dist/development/core/state/getEntityMarker.cjs +5 -0
  126. package/dist/development/core/state/getEntityMarker.cjs.map +1 -0
  127. package/dist/development/core/utils/createQueryBuilder.cjs +32 -0
  128. package/dist/development/core/utils/createQueryBuilder.cjs.map +1 -0
  129. package/dist/development/core/utils/createQueryBuilder.js +32 -0
  130. package/dist/development/core/utils/createQueryBuilder.js.map +1 -0
  131. package/dist/development/core/utils/getCombinedSignal.cjs +33 -0
  132. package/dist/development/core/utils/getCombinedSignal.cjs.map +1 -0
  133. package/dist/development/dao/Environment.cjs +213 -0
  134. package/dist/development/dao/Environment.cjs.map +1 -0
  135. package/dist/development/dao/Environment.js.map +1 -1
  136. package/dist/development/dao/TreeNodeEnvironmentFactory.cjs +89 -0
  137. package/dist/development/dao/TreeNodeEnvironmentFactory.cjs.map +1 -0
  138. package/dist/development/dao/VariableFieldValue.cjs +9 -0
  139. package/dist/development/dao/VariableFieldValue.cjs.map +1 -0
  140. package/dist/development/fieldHelpers/helpers/FieldHelper.cjs +17 -0
  141. package/dist/development/fieldHelpers/helpers/FieldHelper.cjs.map +1 -0
  142. package/dist/development/fieldHelpers/helpers/TemporalFieldHelper.cjs +18 -0
  143. package/dist/development/fieldHelpers/helpers/TemporalFieldHelper.cjs.map +1 -0
  144. package/dist/development/fieldHelpers/helpers/UuidFieldHelper.cjs +16 -0
  145. package/dist/development/fieldHelpers/helpers/UuidFieldHelper.cjs.map +1 -0
  146. package/dist/development/index.cjs +124 -0
  147. package/dist/development/index.cjs.map +1 -0
  148. package/dist/development/index.js +18 -135
  149. package/dist/development/index.js.map +1 -1
  150. package/dist/development/markers/EntityFieldMarkersContainer.cjs +41 -0
  151. package/dist/development/markers/EntityFieldMarkersContainer.cjs.map +1 -0
  152. package/dist/development/markers/EntityFieldsWithHoistablesMarker.cjs +11 -0
  153. package/dist/development/markers/EntityFieldsWithHoistablesMarker.cjs.map +1 -0
  154. package/dist/development/markers/EntityListSubTreeMarker.cjs +23 -0
  155. package/dist/development/markers/EntityListSubTreeMarker.cjs.map +1 -0
  156. package/dist/development/markers/EntitySubTreeMarker.cjs +23 -0
  157. package/dist/development/markers/EntitySubTreeMarker.cjs.map +1 -0
  158. package/dist/development/markers/FieldMarker.cjs +20 -0
  159. package/dist/development/markers/FieldMarker.cjs.map +1 -0
  160. package/dist/development/markers/HasManyRelationMarker.cjs +29 -0
  161. package/dist/development/markers/HasManyRelationMarker.cjs.map +1 -0
  162. package/dist/development/markers/HasOneRelationMarker.cjs +23 -0
  163. package/dist/development/markers/HasOneRelationMarker.cjs.map +1 -0
  164. package/dist/development/markers/MarkerTreeRoot.cjs +10 -0
  165. package/dist/development/markers/MarkerTreeRoot.cjs.map +1 -0
  166. package/dist/development/markers/ParentEntityMarker.cjs +10 -0
  167. package/dist/development/markers/ParentEntityMarker.cjs.map +1 -0
  168. package/dist/development/markers/PlaceholderGenerator.cjs +23 -0
  169. package/dist/development/markers/PlaceholderGenerator.cjs.map +1 -0
  170. package/dist/development/markers/PlaceholderGenerator.js.map +1 -1
  171. package/dist/development/markers/PlaceholderParametersGenerator.cjs +62 -0
  172. package/dist/development/markers/PlaceholderParametersGenerator.cjs.map +1 -0
  173. package/dist/development/queryLanguage/CacheStore.cjs +47 -0
  174. package/dist/development/queryLanguage/CacheStore.cjs.map +1 -0
  175. package/dist/development/queryLanguage/CacheStore.js +2 -1
  176. package/dist/development/queryLanguage/CacheStore.js.map +1 -1
  177. package/dist/development/queryLanguage/MarkerFactory.cjs +200 -0
  178. package/dist/development/queryLanguage/MarkerFactory.cjs.map +1 -0
  179. package/dist/development/queryLanguage/MarkerFactory.js +1 -1
  180. package/dist/development/queryLanguage/Parser.cjs +728 -0
  181. package/dist/development/queryLanguage/Parser.cjs.map +1 -0
  182. package/dist/development/queryLanguage/Parser.js +70 -29
  183. package/dist/development/queryLanguage/Parser.js.map +1 -1
  184. package/dist/development/queryLanguage/QueryLanguage.cjs +520 -0
  185. package/dist/development/queryLanguage/QueryLanguage.cjs.map +1 -0
  186. package/dist/development/queryLanguage/QueryLanguage.js +16 -14
  187. package/dist/development/queryLanguage/QueryLanguage.js.map +1 -1
  188. package/dist/development/queryLanguage/QueryLanguageError.cjs +6 -0
  189. package/dist/development/queryLanguage/QueryLanguageError.cjs.map +1 -0
  190. package/dist/development/queryLanguage/tokenList.cjs +150 -0
  191. package/dist/development/queryLanguage/tokenList.cjs.map +1 -0
  192. package/dist/development/queryLanguage/tokenList.js +1 -1
  193. package/dist/development/queryLanguage/tokenList.js.map +1 -1
  194. package/dist/development/structures/BijectiveIndexedMap.cjs +120 -0
  195. package/dist/development/structures/BijectiveIndexedMap.cjs.map +1 -0
  196. package/dist/development/structures/LRUCache.cjs +35 -0
  197. package/dist/development/structures/LRUCache.cjs.map +1 -0
  198. package/dist/development/structures/WeakIdCache.cjs +33 -0
  199. package/dist/development/structures/WeakIdCache.cjs.map +1 -0
  200. package/dist/development/treeParameterHelpers/wrapFilterInHasOnes.cjs +22 -0
  201. package/dist/development/treeParameterHelpers/wrapFilterInHasOnes.cjs.map +1 -0
  202. package/dist/development/treeParameters/EntityCreationParameters.cjs +8 -0
  203. package/dist/development/treeParameters/EntityCreationParameters.cjs.map +1 -0
  204. package/dist/development/treeParameters/EntityListPreferences.cjs +7 -0
  205. package/dist/development/treeParameters/EntityListPreferences.cjs.map +1 -0
  206. package/dist/development/treeParameters/EventListenersStore.cjs +70 -0
  207. package/dist/development/treeParameters/EventListenersStore.cjs.map +1 -0
  208. package/dist/development/treeParameters/EventListenersStore.js.map +1 -1
  209. package/dist/development/treeParameters/LeafField.cjs +7 -0
  210. package/dist/development/treeParameters/LeafField.cjs.map +1 -0
  211. package/dist/development/treeParameters/QualifiedEntityParameters.cjs +7 -0
  212. package/dist/development/treeParameters/QualifiedEntityParameters.cjs.map +1 -0
  213. package/dist/development/treeParameters/Relation.cjs +7 -0
  214. package/dist/development/treeParameters/Relation.cjs.map +1 -0
  215. package/dist/development/utils/Hashing.cjs +22 -0
  216. package/dist/development/utils/Hashing.cjs.map +1 -0
  217. package/dist/development/utils/TreeNodeUtils.cjs +77 -0
  218. package/dist/development/utils/TreeNodeUtils.cjs.map +1 -0
  219. package/dist/development/utils/TreeNodeUtils.js.map +1 -1
  220. package/dist/development/utils/assert.cjs +11 -0
  221. package/dist/development/utils/assert.cjs.map +1 -0
  222. package/dist/development/utils/assert.js.map +1 -1
  223. package/dist/development/utils/assertNever.cjs +10 -0
  224. package/dist/development/utils/assertNever.cjs.map +1 -0
  225. package/dist/development/utils/generateEnumerabilityPreventingEntropy.cjs +7 -0
  226. package/dist/development/utils/generateEnumerabilityPreventingEntropy.cjs.map +1 -0
  227. package/dist/development/utils/isEmptyObject.cjs +12 -0
  228. package/dist/development/utils/isEmptyObject.cjs.map +1 -0
  229. package/dist/development/utils/ucfirst.cjs +5 -0
  230. package/dist/development/utils/ucfirst.cjs.map +1 -0
  231. package/dist/development/utils/ucfirst.js.map +1 -1
  232. package/dist/production/BindingError.cjs +10 -0
  233. package/dist/production/BindingError.cjs.map +1 -0
  234. package/dist/production/accessorTree/NormalizedPersistedData.cjs +10 -0
  235. package/dist/production/accessorTree/NormalizedPersistedData.cjs.map +1 -0
  236. package/dist/production/accessorTree/RuntimeId.cjs +64 -0
  237. package/dist/production/accessorTree/RuntimeId.cjs.map +1 -0
  238. package/dist/production/accessorTree/RuntimeId.js +5 -5
  239. package/dist/production/accessorTree/RuntimeId.js.map +1 -1
  240. package/dist/production/accessors/EntityAccessor.cjs +169 -0
  241. package/dist/production/accessors/EntityAccessor.cjs.map +1 -0
  242. package/dist/production/accessors/EntityAccessor.js +1 -1
  243. package/dist/production/accessors/EntityAccessor.js.map +1 -1
  244. package/dist/production/accessors/EntityListAccessor.cjs +101 -0
  245. package/dist/production/accessors/EntityListAccessor.cjs.map +1 -0
  246. package/dist/production/accessors/ErrorAccessor.cjs +16 -0
  247. package/dist/production/accessors/ErrorAccessor.cjs.map +1 -0
  248. package/dist/production/accessors/FieldAccessor.cjs +59 -0
  249. package/dist/production/accessors/FieldAccessor.cjs.map +1 -0
  250. package/dist/production/accessors/TreeRootAccessor.cjs +14 -0
  251. package/dist/production/accessors/TreeRootAccessor.cjs.map +1 -0
  252. package/dist/production/accessors/TreeRootAccessor.js.map +1 -1
  253. package/dist/production/bindingTypes.cjs +9 -0
  254. package/dist/production/bindingTypes.cjs.map +1 -0
  255. package/dist/production/core/AccessorErrorManager.cjs +207 -0
  256. package/dist/production/core/AccessorErrorManager.cjs.map +1 -0
  257. package/dist/production/core/AccessorErrorManager.js +6 -5
  258. package/dist/production/core/AccessorErrorManager.js.map +1 -1
  259. package/dist/production/core/Config.cjs +32 -0
  260. package/dist/production/core/Config.cjs.map +1 -0
  261. package/dist/production/core/Config.js +3 -3
  262. package/dist/production/core/Config.js.map +1 -1
  263. package/dist/production/core/DataBinding.cjs +352 -0
  264. package/dist/production/core/DataBinding.cjs.map +1 -0
  265. package/dist/production/core/DataBinding.js +56 -49
  266. package/dist/production/core/DataBinding.js.map +1 -1
  267. package/dist/production/core/DirtinessTracker.cjs +29 -0
  268. package/dist/production/core/DirtinessTracker.cjs.map +1 -0
  269. package/dist/production/core/ErrorsPreprocessor.cjs +181 -0
  270. package/dist/production/core/ErrorsPreprocessor.cjs.map +1 -0
  271. package/dist/production/core/ErrorsPreprocessor.js +16 -16
  272. package/dist/production/core/ErrorsPreprocessor.js.map +1 -1
  273. package/dist/production/core/EventManager.cjs +414 -0
  274. package/dist/production/core/EventManager.cjs.map +1 -0
  275. package/dist/production/core/EventManager.js +7 -5
  276. package/dist/production/core/EventManager.js.map +1 -1
  277. package/dist/production/core/MarkerComparator.cjs +79 -0
  278. package/dist/production/core/MarkerComparator.cjs.map +1 -0
  279. package/dist/production/core/MarkerComparator.js.map +1 -1
  280. package/dist/production/core/MarkerMerger.cjs +252 -0
  281. package/dist/production/core/MarkerMerger.cjs.map +1 -0
  282. package/dist/production/core/MarkerMerger.js +2 -2
  283. package/dist/production/core/MarkerMerger.js.map +1 -1
  284. package/dist/production/core/MutationGenerator.cjs +635 -0
  285. package/dist/production/core/MutationGenerator.cjs.map +1 -0
  286. package/dist/production/core/MutationGenerator.js +341 -294
  287. package/dist/production/core/MutationGenerator.js.map +1 -1
  288. package/dist/production/core/QueryGenerator.cjs +113 -0
  289. package/dist/production/core/QueryGenerator.cjs.map +1 -0
  290. package/dist/production/core/QueryGenerator.js +62 -75
  291. package/dist/production/core/QueryGenerator.js.map +1 -1
  292. package/dist/production/core/RealmKeyGenerator.cjs +47 -0
  293. package/dist/production/core/RealmKeyGenerator.cjs.map +1 -0
  294. package/dist/production/core/RealmKeyGenerator.js.map +1 -1
  295. package/dist/production/core/RequestResponseNormalizer.cjs +125 -0
  296. package/dist/production/core/RequestResponseNormalizer.cjs.map +1 -0
  297. package/dist/production/core/StateInitializer.cjs +389 -0
  298. package/dist/production/core/StateInitializer.cjs.map +1 -0
  299. package/dist/production/core/StateInitializer.js +2 -2
  300. package/dist/production/core/StateInitializer.js.map +1 -1
  301. package/dist/production/core/TreeAugmenter.cjs +213 -0
  302. package/dist/production/core/TreeAugmenter.cjs.map +1 -0
  303. package/dist/production/core/TreeFilterGenerator.cjs +83 -0
  304. package/dist/production/core/TreeFilterGenerator.cjs.map +1 -0
  305. package/dist/production/core/TreeParameterMerger.cjs +304 -0
  306. package/dist/production/core/TreeParameterMerger.cjs.map +1 -0
  307. package/dist/production/core/TreeParameterMerger.js +8 -0
  308. package/dist/production/core/TreeParameterMerger.js.map +1 -1
  309. package/dist/production/core/TreeStore.cjs +182 -0
  310. package/dist/production/core/TreeStore.cjs.map +1 -0
  311. package/dist/production/core/TreeStore.js +1 -1
  312. package/dist/production/core/TreeStore.js.map +1 -1
  313. package/dist/production/core/VariableInputTransformer.cjs +24 -0
  314. package/dist/production/core/VariableInputTransformer.cjs.map +1 -0
  315. package/dist/production/core/VariableInputTransformer.js.map +1 -1
  316. package/dist/production/core/exceptions/ErrorLocator.cjs +62 -0
  317. package/dist/production/core/exceptions/ErrorLocator.cjs.map +1 -0
  318. package/dist/production/core/exceptions/LocalizedBindingError.cjs +14 -0
  319. package/dist/production/core/exceptions/LocalizedBindingError.cjs.map +1 -0
  320. package/dist/production/core/exceptions/MarkerSugarer.cjs +56 -0
  321. package/dist/production/core/exceptions/MarkerSugarer.cjs.map +1 -0
  322. package/dist/production/core/exceptions/TreeParameterSugarer.cjs +33 -0
  323. package/dist/production/core/exceptions/TreeParameterSugarer.cjs.map +1 -0
  324. package/dist/production/core/exceptions/TreeParameterSugarer.js.map +1 -1
  325. package/dist/production/core/factories/createBatchUpdatesOptions.cjs +20 -0
  326. package/dist/production/core/factories/createBatchUpdatesOptions.cjs.map +1 -0
  327. package/dist/production/core/factories/createBatchUpdatesOptions.js.map +1 -1
  328. package/dist/production/core/operations/EntityOperations.cjs +238 -0
  329. package/dist/production/core/operations/EntityOperations.cjs.map +1 -0
  330. package/dist/production/core/operations/EntityOperations.js +1 -1
  331. package/dist/production/core/operations/EntityOperations.js.map +1 -1
  332. package/dist/production/core/operations/FieldOperations.cjs +76 -0
  333. package/dist/production/core/operations/FieldOperations.cjs.map +1 -0
  334. package/dist/production/core/operations/FieldOperations.js +1 -1
  335. package/dist/production/core/operations/ListOperations.cjs +159 -0
  336. package/dist/production/core/operations/ListOperations.cjs.map +1 -0
  337. package/dist/production/core/operations/ListOperations.js.map +1 -1
  338. package/dist/production/core/operations/OperationsHelpers.cjs +85 -0
  339. package/dist/production/core/operations/OperationsHelpers.cjs.map +1 -0
  340. package/dist/production/core/operations/OperationsHelpers.js.map +1 -1
  341. package/dist/production/core/requestAliases/MutationAlias.cjs +14 -0
  342. package/dist/production/core/requestAliases/MutationAlias.cjs.map +1 -0
  343. package/dist/production/core/requestAliases/MutationAlias.js.map +1 -1
  344. package/dist/production/core/schema/Schema.cjs +39 -0
  345. package/dist/production/core/schema/Schema.cjs.map +1 -0
  346. package/dist/production/core/schema/Schema.js.map +1 -1
  347. package/dist/production/core/schema/SchemaLoader.cjs +28 -0
  348. package/dist/production/core/schema/SchemaLoader.cjs.map +1 -0
  349. package/dist/production/core/schema/SchemaLoader.js +2 -2
  350. package/dist/production/core/schema/SchemaLoader.js.map +1 -1
  351. package/dist/production/core/schema/SchemaPreprocessor.cjs +38 -0
  352. package/dist/production/core/schema/SchemaPreprocessor.cjs.map +1 -0
  353. package/dist/production/core/state/StateIterator.cjs +100 -0
  354. package/dist/production/core/state/StateIterator.cjs.map +1 -0
  355. package/dist/production/core/state/getEntityMarker.cjs +5 -0
  356. package/dist/production/core/state/getEntityMarker.cjs.map +1 -0
  357. package/dist/production/core/utils/createQueryBuilder.cjs +32 -0
  358. package/dist/production/core/utils/createQueryBuilder.cjs.map +1 -0
  359. package/dist/production/core/utils/createQueryBuilder.js +32 -0
  360. package/dist/production/core/utils/createQueryBuilder.js.map +1 -0
  361. package/dist/production/core/utils/getCombinedSignal.cjs +33 -0
  362. package/dist/production/core/utils/getCombinedSignal.cjs.map +1 -0
  363. package/dist/production/dao/Environment.cjs +213 -0
  364. package/dist/production/dao/Environment.cjs.map +1 -0
  365. package/dist/production/dao/Environment.js.map +1 -1
  366. package/dist/production/dao/TreeNodeEnvironmentFactory.cjs +89 -0
  367. package/dist/production/dao/TreeNodeEnvironmentFactory.cjs.map +1 -0
  368. package/dist/production/dao/VariableFieldValue.cjs +9 -0
  369. package/dist/production/dao/VariableFieldValue.cjs.map +1 -0
  370. package/dist/production/fieldHelpers/helpers/FieldHelper.cjs +17 -0
  371. package/dist/production/fieldHelpers/helpers/FieldHelper.cjs.map +1 -0
  372. package/dist/production/fieldHelpers/helpers/TemporalFieldHelper.cjs +18 -0
  373. package/dist/production/fieldHelpers/helpers/TemporalFieldHelper.cjs.map +1 -0
  374. package/dist/production/fieldHelpers/helpers/UuidFieldHelper.cjs +16 -0
  375. package/dist/production/fieldHelpers/helpers/UuidFieldHelper.cjs.map +1 -0
  376. package/dist/production/index.cjs +124 -0
  377. package/dist/production/index.cjs.map +1 -0
  378. package/dist/production/index.js +18 -135
  379. package/dist/production/index.js.map +1 -1
  380. package/dist/production/markers/EntityFieldMarkersContainer.cjs +41 -0
  381. package/dist/production/markers/EntityFieldMarkersContainer.cjs.map +1 -0
  382. package/dist/production/markers/EntityFieldsWithHoistablesMarker.cjs +11 -0
  383. package/dist/production/markers/EntityFieldsWithHoistablesMarker.cjs.map +1 -0
  384. package/dist/production/markers/EntityListSubTreeMarker.cjs +23 -0
  385. package/dist/production/markers/EntityListSubTreeMarker.cjs.map +1 -0
  386. package/dist/production/markers/EntitySubTreeMarker.cjs +23 -0
  387. package/dist/production/markers/EntitySubTreeMarker.cjs.map +1 -0
  388. package/dist/production/markers/FieldMarker.cjs +20 -0
  389. package/dist/production/markers/FieldMarker.cjs.map +1 -0
  390. package/dist/production/markers/HasManyRelationMarker.cjs +23 -0
  391. package/dist/production/markers/HasManyRelationMarker.cjs.map +1 -0
  392. package/dist/production/markers/HasOneRelationMarker.cjs +23 -0
  393. package/dist/production/markers/HasOneRelationMarker.cjs.map +1 -0
  394. package/dist/production/markers/MarkerTreeRoot.cjs +10 -0
  395. package/dist/production/markers/MarkerTreeRoot.cjs.map +1 -0
  396. package/dist/production/markers/ParentEntityMarker.cjs +10 -0
  397. package/dist/production/markers/ParentEntityMarker.cjs.map +1 -0
  398. package/dist/production/markers/PlaceholderGenerator.cjs +23 -0
  399. package/dist/production/markers/PlaceholderGenerator.cjs.map +1 -0
  400. package/dist/production/markers/PlaceholderGenerator.js.map +1 -1
  401. package/dist/production/markers/PlaceholderParametersGenerator.cjs +62 -0
  402. package/dist/production/markers/PlaceholderParametersGenerator.cjs.map +1 -0
  403. package/dist/production/queryLanguage/CacheStore.cjs +47 -0
  404. package/dist/production/queryLanguage/CacheStore.cjs.map +1 -0
  405. package/dist/production/queryLanguage/CacheStore.js +2 -1
  406. package/dist/production/queryLanguage/CacheStore.js.map +1 -1
  407. package/dist/production/queryLanguage/MarkerFactory.cjs +200 -0
  408. package/dist/production/queryLanguage/MarkerFactory.cjs.map +1 -0
  409. package/dist/production/queryLanguage/MarkerFactory.js +1 -1
  410. package/dist/production/queryLanguage/Parser.cjs +725 -0
  411. package/dist/production/queryLanguage/Parser.cjs.map +1 -0
  412. package/dist/production/queryLanguage/Parser.js +70 -29
  413. package/dist/production/queryLanguage/Parser.js.map +1 -1
  414. package/dist/production/queryLanguage/QueryLanguage.cjs +517 -0
  415. package/dist/production/queryLanguage/QueryLanguage.cjs.map +1 -0
  416. package/dist/production/queryLanguage/QueryLanguage.js +16 -14
  417. package/dist/production/queryLanguage/QueryLanguage.js.map +1 -1
  418. package/dist/production/queryLanguage/QueryLanguageError.cjs +6 -0
  419. package/dist/production/queryLanguage/QueryLanguageError.cjs.map +1 -0
  420. package/dist/production/queryLanguage/tokenList.cjs +150 -0
  421. package/dist/production/queryLanguage/tokenList.cjs.map +1 -0
  422. package/dist/production/queryLanguage/tokenList.js +1 -1
  423. package/dist/production/queryLanguage/tokenList.js.map +1 -1
  424. package/dist/production/structures/BijectiveIndexedMap.cjs +120 -0
  425. package/dist/production/structures/BijectiveIndexedMap.cjs.map +1 -0
  426. package/dist/production/structures/LRUCache.cjs +35 -0
  427. package/dist/production/structures/LRUCache.cjs.map +1 -0
  428. package/dist/production/structures/WeakIdCache.cjs +33 -0
  429. package/dist/production/structures/WeakIdCache.cjs.map +1 -0
  430. package/dist/production/treeParameterHelpers/wrapFilterInHasOnes.cjs +22 -0
  431. package/dist/production/treeParameterHelpers/wrapFilterInHasOnes.cjs.map +1 -0
  432. package/dist/production/treeParameters/EntityCreationParameters.cjs +8 -0
  433. package/dist/production/treeParameters/EntityCreationParameters.cjs.map +1 -0
  434. package/dist/production/treeParameters/EntityListPreferences.cjs +7 -0
  435. package/dist/production/treeParameters/EntityListPreferences.cjs.map +1 -0
  436. package/dist/production/treeParameters/EventListenersStore.cjs +70 -0
  437. package/dist/production/treeParameters/EventListenersStore.cjs.map +1 -0
  438. package/dist/production/treeParameters/EventListenersStore.js.map +1 -1
  439. package/dist/production/treeParameters/LeafField.cjs +7 -0
  440. package/dist/production/treeParameters/LeafField.cjs.map +1 -0
  441. package/dist/production/treeParameters/QualifiedEntityParameters.cjs +7 -0
  442. package/dist/production/treeParameters/QualifiedEntityParameters.cjs.map +1 -0
  443. package/dist/production/treeParameters/Relation.cjs +7 -0
  444. package/dist/production/treeParameters/Relation.cjs.map +1 -0
  445. package/dist/production/utils/Hashing.cjs +22 -0
  446. package/dist/production/utils/Hashing.cjs.map +1 -0
  447. package/dist/production/utils/TreeNodeUtils.cjs +77 -0
  448. package/dist/production/utils/TreeNodeUtils.cjs.map +1 -0
  449. package/dist/production/utils/TreeNodeUtils.js.map +1 -1
  450. package/dist/production/utils/assert.cjs +11 -0
  451. package/dist/production/utils/assert.cjs.map +1 -0
  452. package/dist/production/utils/assert.js.map +1 -1
  453. package/dist/production/utils/assertNever.cjs +10 -0
  454. package/dist/production/utils/assertNever.cjs.map +1 -0
  455. package/dist/production/utils/generateEnumerabilityPreventingEntropy.cjs +7 -0
  456. package/dist/production/utils/generateEnumerabilityPreventingEntropy.cjs.map +1 -0
  457. package/dist/production/utils/isEmptyObject.cjs +12 -0
  458. package/dist/production/utils/isEmptyObject.cjs.map +1 -0
  459. package/dist/production/utils/ucfirst.cjs +5 -0
  460. package/dist/production/utils/ucfirst.cjs.map +1 -0
  461. package/dist/production/utils/ucfirst.js.map +1 -1
  462. package/dist/types/accessorTree/PersistResult.d.ts +1 -2
  463. package/dist/types/accessorTree/PersistResult.d.ts.map +1 -1
  464. package/dist/types/accessorTree/index.d.ts +0 -15
  465. package/dist/types/accessorTree/index.d.ts.map +1 -1
  466. package/dist/types/accessors/BindingOperations.d.ts +2 -2
  467. package/dist/types/accessors/BindingOperations.d.ts.map +1 -1
  468. package/dist/types/accessors/EntityAccessor.d.ts +2 -2
  469. package/dist/types/accessors/EntityAccessor.d.ts.map +1 -1
  470. package/dist/types/accessors/ExtendTree.d.ts +1 -2
  471. package/dist/types/accessors/ExtendTree.d.ts.map +1 -1
  472. package/dist/types/accessors/TreeRootAccessor.d.ts +3 -3
  473. package/dist/types/accessors/TreeRootAccessor.d.ts.map +1 -1
  474. package/dist/types/core/AccessorErrorManager.d.ts +2 -2
  475. package/dist/types/core/AccessorErrorManager.d.ts.map +1 -1
  476. package/dist/types/core/DataBinding.d.ts +11 -6
  477. package/dist/types/core/DataBinding.d.ts.map +1 -1
  478. package/dist/types/core/ErrorsPreprocessor.d.ts +2 -2
  479. package/dist/types/core/ErrorsPreprocessor.d.ts.map +1 -1
  480. package/dist/types/core/EventManager.d.ts +2 -1
  481. package/dist/types/core/EventManager.d.ts.map +1 -1
  482. package/dist/types/core/MutationGenerator.d.ts +16 -13
  483. package/dist/types/core/MutationGenerator.d.ts.map +1 -1
  484. package/dist/types/core/QueryGenerator.d.ts +6 -8
  485. package/dist/types/core/QueryGenerator.d.ts.map +1 -1
  486. package/dist/types/core/TreeParameterMerger.d.ts.map +1 -1
  487. package/dist/types/core/index.d.ts +7 -1
  488. package/dist/types/core/index.d.ts.map +1 -1
  489. package/dist/types/core/schema/index.d.ts +2 -0
  490. package/dist/types/core/schema/index.d.ts.map +1 -1
  491. package/dist/types/core/state/EntityListState.d.ts +2 -0
  492. package/dist/types/core/state/EntityListState.d.ts.map +1 -1
  493. package/dist/types/core/utils/createQueryBuilder.d.ts +4 -0
  494. package/dist/types/core/utils/createQueryBuilder.d.ts.map +1 -0
  495. package/dist/types/dao/Environment.d.ts +5 -2
  496. package/dist/types/dao/Environment.d.ts.map +1 -1
  497. package/dist/types/dao/index.d.ts +1 -0
  498. package/dist/types/dao/index.d.ts.map +1 -1
  499. package/dist/types/index.d.ts +0 -5
  500. package/dist/types/index.d.ts.map +1 -1
  501. package/dist/types/queryLanguage/CacheStore.d.ts.map +1 -1
  502. package/dist/types/queryLanguage/Parser.d.ts +3 -2
  503. package/dist/types/queryLanguage/Parser.d.ts.map +1 -1
  504. package/dist/types/queryLanguage/QueryLanguage.d.ts.map +1 -1
  505. package/dist/types/treeParameters/EventListenersStore.d.ts +2 -1
  506. package/dist/types/treeParameters/EventListenersStore.d.ts.map +1 -1
  507. package/dist/types/treeParameters/UnconstrainedQualifiedEntityList.d.ts +2 -0
  508. package/dist/types/treeParameters/UnconstrainedQualifiedEntityList.d.ts.map +1 -1
  509. package/dist/types/treeParameters/UnconstrainedQualifiedSingleEntity.d.ts +2 -0
  510. package/dist/types/treeParameters/UnconstrainedQualifiedSingleEntity.d.ts.map +1 -1
  511. package/dist/types/tsconfig.tsbuildinfo +1 -1
  512. package/package.json +13 -15
  513. package/src/accessorTree/PersistResult.ts +1 -2
  514. package/src/accessorTree/index.ts +0 -15
  515. package/src/accessors/BindingOperations.ts +2 -2
  516. package/src/accessors/EntityAccessor.ts +2 -2
  517. package/src/accessors/ExtendTree.ts +1 -2
  518. package/src/accessors/TreeRootAccessor.ts +2 -2
  519. package/src/core/AccessorErrorManager.ts +11 -9
  520. package/src/core/DataBinding.ts +76 -75
  521. package/src/core/ErrorsPreprocessor.ts +24 -23
  522. package/src/core/EventManager.ts +6 -3
  523. package/src/core/MutationGenerator.ts +411 -412
  524. package/src/core/QueryGenerator.ts +66 -117
  525. package/src/core/StateInitializer.ts +2 -2
  526. package/src/core/TreeParameterMerger.ts +8 -0
  527. package/src/core/index.ts +7 -1
  528. package/src/core/schema/SchemaLoader.ts +2 -2
  529. package/src/core/schema/index.ts +2 -0
  530. package/src/core/state/EntityListState.ts +2 -0
  531. package/src/core/utils/createQueryBuilder.ts +31 -0
  532. package/src/dao/Environment.ts +6 -2
  533. package/src/dao/index.ts +1 -0
  534. package/src/index.ts +0 -5
  535. package/src/queryLanguage/CacheStore.ts +1 -0
  536. package/src/queryLanguage/Parser.ts +76 -37
  537. package/src/queryLanguage/QueryLanguage.ts +4 -1
  538. package/src/queryLanguage/tokenList.ts +1 -1
  539. package/src/treeParameters/EventListenersStore.ts +2 -1
  540. package/src/treeParameters/UnconstrainedQualifiedEntityList.ts +2 -0
  541. package/src/treeParameters/UnconstrainedQualifiedSingleEntity.ts +2 -0
  542. package/src/tsconfig.json +1 -4
  543. package/dist/development/accessorPropagation/AccessorProvider.js +0 -18
  544. package/dist/development/accessorPropagation/AccessorProvider.js.map +0 -1
  545. package/dist/development/accessorPropagation/BindingOperationsContext.js +0 -31
  546. package/dist/development/accessorPropagation/BindingOperationsContext.js.map +0 -1
  547. package/dist/development/accessorPropagation/BindingOperationsProvider.js +0 -13
  548. package/dist/development/accessorPropagation/BindingOperationsProvider.js.map +0 -1
  549. package/dist/development/accessorPropagation/EntityKeyContext.js +0 -7
  550. package/dist/development/accessorPropagation/EntityKeyContext.js.map +0 -1
  551. package/dist/development/accessorPropagation/EntityKeyProvider.js +0 -13
  552. package/dist/development/accessorPropagation/EntityKeyProvider.js.map +0 -1
  553. package/dist/development/accessorPropagation/EnvironmentContext.js +0 -53
  554. package/dist/development/accessorPropagation/EnvironmentContext.js.map +0 -1
  555. package/dist/development/accessorPropagation/TreeRootIdContext.js +0 -7
  556. package/dist/development/accessorPropagation/TreeRootIdContext.js.map +0 -1
  557. package/dist/development/accessorPropagation/TreeRootIdProvider.js +0 -13
  558. package/dist/development/accessorPropagation/TreeRootIdProvider.js.map +0 -1
  559. package/dist/development/accessorPropagation/useAccessorUpdateSubscription.js +0 -55
  560. package/dist/development/accessorPropagation/useAccessorUpdateSubscription.js.map +0 -1
  561. package/dist/development/accessorPropagation/useBindingOperations.js +0 -7
  562. package/dist/development/accessorPropagation/useBindingOperations.js.map +0 -1
  563. package/dist/development/accessorPropagation/useDesugaredRelativeEntityList.js +0 -47
  564. package/dist/development/accessorPropagation/useDesugaredRelativeEntityList.js.map +0 -1
  565. package/dist/development/accessorPropagation/useDesugaredRelativeSingleEntity.js +0 -35
  566. package/dist/development/accessorPropagation/useDesugaredRelativeSingleEntity.js.map +0 -1
  567. package/dist/development/accessorPropagation/useDesugaredRelativeSingleField.js +0 -35
  568. package/dist/development/accessorPropagation/useDesugaredRelativeSingleField.js.map +0 -1
  569. package/dist/development/accessorPropagation/useEntity.js +0 -38
  570. package/dist/development/accessorPropagation/useEntity.js.map +0 -1
  571. package/dist/development/accessorPropagation/useEntityKey.js +0 -16
  572. package/dist/development/accessorPropagation/useEntityKey.js.map +0 -1
  573. package/dist/development/accessorPropagation/useEntityList.js +0 -36
  574. package/dist/development/accessorPropagation/useEntityList.js.map +0 -1
  575. package/dist/development/accessorPropagation/useEntityListSubTree.js +0 -19
  576. package/dist/development/accessorPropagation/useEntityListSubTree.js.map +0 -1
  577. package/dist/development/accessorPropagation/useEntityListSubTreeParameters.js +0 -69
  578. package/dist/development/accessorPropagation/useEntityListSubTreeParameters.js.map +0 -1
  579. package/dist/development/accessorPropagation/useEntitySubTree.js +0 -19
  580. package/dist/development/accessorPropagation/useEntitySubTree.js.map +0 -1
  581. package/dist/development/accessorPropagation/useEntitySubTreeParameters.js +0 -47
  582. package/dist/development/accessorPropagation/useEntitySubTreeParameters.js.map +0 -1
  583. package/dist/development/accessorPropagation/useEnvironment.js +0 -9
  584. package/dist/development/accessorPropagation/useEnvironment.js.map +0 -1
  585. package/dist/development/accessorPropagation/useExtendTree.js +0 -32
  586. package/dist/development/accessorPropagation/useExtendTree.js.map +0 -1
  587. package/dist/development/accessorPropagation/useField.js +0 -36
  588. package/dist/development/accessorPropagation/useField.js.map +0 -1
  589. package/dist/development/accessorPropagation/useGetEntityByKey.js +0 -6
  590. package/dist/development/accessorPropagation/useGetEntityByKey.js.map +0 -1
  591. package/dist/development/accessorPropagation/useGetEntityListSubTree.js +0 -17
  592. package/dist/development/accessorPropagation/useGetEntityListSubTree.js.map +0 -1
  593. package/dist/development/accessorPropagation/useGetEntitySubTree.js +0 -17
  594. package/dist/development/accessorPropagation/useGetEntitySubTree.js.map +0 -1
  595. package/dist/development/accessorPropagation/useGetTreeFilters.js +0 -6
  596. package/dist/development/accessorPropagation/useGetTreeFilters.js.map +0 -1
  597. package/dist/development/accessorPropagation/useHasEntity.js +0 -9
  598. package/dist/development/accessorPropagation/useHasEntity.js.map +0 -1
  599. package/dist/development/accessorPropagation/usePersist.js +0 -6
  600. package/dist/development/accessorPropagation/usePersist.js.map +0 -1
  601. package/dist/development/accessorPropagation/useTreeRootId.js +0 -7
  602. package/dist/development/accessorPropagation/useTreeRootId.js.map +0 -1
  603. package/dist/development/accessorSorting/SetOrderFieldOnCreate.js +0 -118
  604. package/dist/development/accessorSorting/SetOrderFieldOnCreate.js.map +0 -1
  605. package/dist/development/accessorSorting/addEntityAtIndex.js +0 -18
  606. package/dist/development/accessorSorting/addEntityAtIndex.js.map +0 -1
  607. package/dist/development/accessorSorting/errors.js +0 -10
  608. package/dist/development/accessorSorting/errors.js.map +0 -1
  609. package/dist/development/accessorSorting/moveEntity.js +0 -42
  610. package/dist/development/accessorSorting/moveEntity.js.map +0 -1
  611. package/dist/development/accessorSorting/repairEntitiesOrder.js +0 -13
  612. package/dist/development/accessorSorting/repairEntitiesOrder.js.map +0 -1
  613. package/dist/development/accessorSorting/sortEntities.js +0 -17
  614. package/dist/development/accessorSorting/sortEntities.js.map +0 -1
  615. package/dist/development/accessorSorting/useSortedEntities.js +0 -80
  616. package/dist/development/accessorSorting/useSortedEntities.js.map +0 -1
  617. package/dist/development/accessorTree/AccessorTree.js +0 -39
  618. package/dist/development/accessorTree/AccessorTree.js.map +0 -1
  619. package/dist/development/accessorTree/AccessorTreeStateContext.js +0 -6
  620. package/dist/development/accessorTree/AccessorTreeStateContext.js.map +0 -1
  621. package/dist/development/accessorTree/DirtinessContext.js +0 -7
  622. package/dist/development/accessorTree/DirtinessContext.js.map +0 -1
  623. package/dist/development/accessorTree/MutationStateContext.js +0 -7
  624. package/dist/development/accessorTree/MutationStateContext.js.map +0 -1
  625. package/dist/development/accessorTree/accessorTreeStateReducer.js +0 -34
  626. package/dist/development/accessorTree/accessorTreeStateReducer.js.map +0 -1
  627. package/dist/development/accessorTree/metadataToRequestError.js +0 -15
  628. package/dist/development/accessorTree/metadataToRequestError.js.map +0 -1
  629. package/dist/development/accessorTree/useAccessorTreeState.js +0 -14
  630. package/dist/development/accessorTree/useAccessorTreeState.js.map +0 -1
  631. package/dist/development/accessorTree/useDataBinding.js +0 -84
  632. package/dist/development/accessorTree/useDataBinding.js.map +0 -1
  633. package/dist/development/accessorTree/useDirtinessState.js +0 -7
  634. package/dist/development/accessorTree/useDirtinessState.js.map +0 -1
  635. package/dist/development/accessorTree/useMutationState.js +0 -7
  636. package/dist/development/accessorTree/useMutationState.js.map +0 -1
  637. package/dist/development/core/IncrementalMarkerBuilder.js +0 -70
  638. package/dist/development/core/IncrementalMarkerBuilder.js.map +0 -1
  639. package/dist/development/core/MarkerTreeGenerator.js +0 -95
  640. package/dist/development/core/MarkerTreeGenerator.js.map +0 -1
  641. package/dist/development/coreComponents/Component.js +0 -33
  642. package/dist/development/coreComponents/Component.js.map +0 -1
  643. package/dist/development/coreComponents/DataBindingProvider.js +0 -24
  644. package/dist/development/coreComponents/DataBindingProvider.js.map +0 -1
  645. package/dist/development/coreComponents/Entity.js +0 -20
  646. package/dist/development/coreComponents/Entity.js.map +0 -1
  647. package/dist/development/coreComponents/EntityList.js +0 -45
  648. package/dist/development/coreComponents/EntityList.js.map +0 -1
  649. package/dist/development/coreComponents/EntityListSubTree.js +0 -58
  650. package/dist/development/coreComponents/EntityListSubTree.js.map +0 -1
  651. package/dist/development/coreComponents/EntitySubTree.js +0 -81
  652. package/dist/development/coreComponents/EntitySubTree.js.map +0 -1
  653. package/dist/development/coreComponents/Field.js +0 -37
  654. package/dist/development/coreComponents/Field.js.map +0 -1
  655. package/dist/development/coreComponents/HasMany.js +0 -42
  656. package/dist/development/coreComponents/HasMany.js.map +0 -1
  657. package/dist/development/coreComponents/HasOne.js +0 -42
  658. package/dist/development/coreComponents/HasOne.js.map +0 -1
  659. package/dist/development/coreComponents/ParentEntity.js +0 -18
  660. package/dist/development/coreComponents/ParentEntity.js.map +0 -1
  661. package/dist/development/entityEvents/useDerivedField.js +0 -42
  662. package/dist/development/entityEvents/useDerivedField.js.map +0 -1
  663. package/dist/development/entityEvents/useEntityBeforePersist.js +0 -8
  664. package/dist/development/entityEvents/useEntityBeforePersist.js.map +0 -1
  665. package/dist/development/entityEvents/useEntityBeforeUpdate.js +0 -8
  666. package/dist/development/entityEvents/useEntityBeforeUpdate.js.map +0 -1
  667. package/dist/development/entityEvents/useEntityEvent.js +0 -32
  668. package/dist/development/entityEvents/useEntityEvent.js.map +0 -1
  669. package/dist/development/entityEvents/useEntityPersistError.js +0 -8
  670. package/dist/development/entityEvents/useEntityPersistError.js.map +0 -1
  671. package/dist/development/entityEvents/useEntityPersistSuccess.js +0 -8
  672. package/dist/development/entityEvents/useEntityPersistSuccess.js.map +0 -1
  673. package/dist/development/entityEvents/useOnConnectionUpdate.js +0 -8
  674. package/dist/development/entityEvents/useOnConnectionUpdate.js.map +0 -1
  675. package/dist/development/helperComponents/DeferredSubTrees.js +0 -105
  676. package/dist/development/helperComponents/DeferredSubTrees.js.map +0 -1
  677. package/dist/development/helperComponents/EntityView.js +0 -14
  678. package/dist/development/helperComponents/EntityView.js.map +0 -1
  679. package/dist/development/helperComponents/FieldView.js +0 -61
  680. package/dist/development/helperComponents/FieldView.js.map +0 -1
  681. package/dist/development/helperComponents/If.js +0 -84
  682. package/dist/development/helperComponents/If.js.map +0 -1
  683. package/dist/development/helperComponents/StaticRender.js +0 -15
  684. package/dist/development/helperComponents/StaticRender.js.map +0 -1
  685. package/dist/development/helperComponents/SugaredField.js +0 -21
  686. package/dist/development/helperComponents/SugaredField.js.map +0 -1
  687. package/dist/development/helperComponents/helpers/FilterEvaluator.js +0 -37
  688. package/dist/development/helperComponents/helpers/FilterEvaluator.js.map +0 -1
  689. package/dist/development/helperComponents/helpers/FilterFieldsCollector.js +0 -40
  690. package/dist/development/helperComponents/helpers/FilterFieldsCollector.js.map +0 -1
  691. package/dist/development/helperComponents/helpers/evaluateCondition.js +0 -49
  692. package/dist/development/helperComponents/helpers/evaluateCondition.js.map +0 -1
  693. package/dist/production/accessorPropagation/AccessorProvider.js +0 -10
  694. package/dist/production/accessorPropagation/AccessorProvider.js.map +0 -1
  695. package/dist/production/accessorPropagation/BindingOperationsContext.js +0 -31
  696. package/dist/production/accessorPropagation/BindingOperationsContext.js.map +0 -1
  697. package/dist/production/accessorPropagation/BindingOperationsProvider.js +0 -9
  698. package/dist/production/accessorPropagation/BindingOperationsProvider.js.map +0 -1
  699. package/dist/production/accessorPropagation/EntityKeyContext.js +0 -7
  700. package/dist/production/accessorPropagation/EntityKeyContext.js.map +0 -1
  701. package/dist/production/accessorPropagation/EntityKeyProvider.js +0 -9
  702. package/dist/production/accessorPropagation/EntityKeyProvider.js.map +0 -1
  703. package/dist/production/accessorPropagation/EnvironmentContext.js +0 -37
  704. package/dist/production/accessorPropagation/EnvironmentContext.js.map +0 -1
  705. package/dist/production/accessorPropagation/TreeRootIdContext.js +0 -7
  706. package/dist/production/accessorPropagation/TreeRootIdContext.js.map +0 -1
  707. package/dist/production/accessorPropagation/TreeRootIdProvider.js +0 -9
  708. package/dist/production/accessorPropagation/TreeRootIdProvider.js.map +0 -1
  709. package/dist/production/accessorPropagation/useAccessorUpdateSubscription.js +0 -55
  710. package/dist/production/accessorPropagation/useAccessorUpdateSubscription.js.map +0 -1
  711. package/dist/production/accessorPropagation/useBindingOperations.js +0 -7
  712. package/dist/production/accessorPropagation/useBindingOperations.js.map +0 -1
  713. package/dist/production/accessorPropagation/useDesugaredRelativeEntityList.js +0 -47
  714. package/dist/production/accessorPropagation/useDesugaredRelativeEntityList.js.map +0 -1
  715. package/dist/production/accessorPropagation/useDesugaredRelativeSingleEntity.js +0 -35
  716. package/dist/production/accessorPropagation/useDesugaredRelativeSingleEntity.js.map +0 -1
  717. package/dist/production/accessorPropagation/useDesugaredRelativeSingleField.js +0 -35
  718. package/dist/production/accessorPropagation/useDesugaredRelativeSingleField.js.map +0 -1
  719. package/dist/production/accessorPropagation/useEntity.js +0 -38
  720. package/dist/production/accessorPropagation/useEntity.js.map +0 -1
  721. package/dist/production/accessorPropagation/useEntityKey.js +0 -16
  722. package/dist/production/accessorPropagation/useEntityKey.js.map +0 -1
  723. package/dist/production/accessorPropagation/useEntityList.js +0 -36
  724. package/dist/production/accessorPropagation/useEntityList.js.map +0 -1
  725. package/dist/production/accessorPropagation/useEntityListSubTree.js +0 -19
  726. package/dist/production/accessorPropagation/useEntityListSubTree.js.map +0 -1
  727. package/dist/production/accessorPropagation/useEntityListSubTreeParameters.js +0 -69
  728. package/dist/production/accessorPropagation/useEntityListSubTreeParameters.js.map +0 -1
  729. package/dist/production/accessorPropagation/useEntitySubTree.js +0 -19
  730. package/dist/production/accessorPropagation/useEntitySubTree.js.map +0 -1
  731. package/dist/production/accessorPropagation/useEntitySubTreeParameters.js +0 -47
  732. package/dist/production/accessorPropagation/useEntitySubTreeParameters.js.map +0 -1
  733. package/dist/production/accessorPropagation/useEnvironment.js +0 -9
  734. package/dist/production/accessorPropagation/useEnvironment.js.map +0 -1
  735. package/dist/production/accessorPropagation/useExtendTree.js +0 -32
  736. package/dist/production/accessorPropagation/useExtendTree.js.map +0 -1
  737. package/dist/production/accessorPropagation/useField.js +0 -36
  738. package/dist/production/accessorPropagation/useField.js.map +0 -1
  739. package/dist/production/accessorPropagation/useGetEntityByKey.js +0 -6
  740. package/dist/production/accessorPropagation/useGetEntityByKey.js.map +0 -1
  741. package/dist/production/accessorPropagation/useGetEntityListSubTree.js +0 -17
  742. package/dist/production/accessorPropagation/useGetEntityListSubTree.js.map +0 -1
  743. package/dist/production/accessorPropagation/useGetEntitySubTree.js +0 -17
  744. package/dist/production/accessorPropagation/useGetEntitySubTree.js.map +0 -1
  745. package/dist/production/accessorPropagation/useGetTreeFilters.js +0 -6
  746. package/dist/production/accessorPropagation/useGetTreeFilters.js.map +0 -1
  747. package/dist/production/accessorPropagation/useHasEntity.js +0 -9
  748. package/dist/production/accessorPropagation/useHasEntity.js.map +0 -1
  749. package/dist/production/accessorPropagation/usePersist.js +0 -6
  750. package/dist/production/accessorPropagation/usePersist.js.map +0 -1
  751. package/dist/production/accessorPropagation/useTreeRootId.js +0 -7
  752. package/dist/production/accessorPropagation/useTreeRootId.js.map +0 -1
  753. package/dist/production/accessorSorting/SetOrderFieldOnCreate.js +0 -74
  754. package/dist/production/accessorSorting/SetOrderFieldOnCreate.js.map +0 -1
  755. package/dist/production/accessorSorting/addEntityAtIndex.js +0 -18
  756. package/dist/production/accessorSorting/addEntityAtIndex.js.map +0 -1
  757. package/dist/production/accessorSorting/errors.js +0 -10
  758. package/dist/production/accessorSorting/errors.js.map +0 -1
  759. package/dist/production/accessorSorting/moveEntity.js +0 -42
  760. package/dist/production/accessorSorting/moveEntity.js.map +0 -1
  761. package/dist/production/accessorSorting/repairEntitiesOrder.js +0 -13
  762. package/dist/production/accessorSorting/repairEntitiesOrder.js.map +0 -1
  763. package/dist/production/accessorSorting/sortEntities.js +0 -17
  764. package/dist/production/accessorSorting/sortEntities.js.map +0 -1
  765. package/dist/production/accessorSorting/useSortedEntities.js +0 -80
  766. package/dist/production/accessorSorting/useSortedEntities.js.map +0 -1
  767. package/dist/production/accessorTree/AccessorTree.js +0 -19
  768. package/dist/production/accessorTree/AccessorTree.js.map +0 -1
  769. package/dist/production/accessorTree/AccessorTreeStateContext.js +0 -6
  770. package/dist/production/accessorTree/AccessorTreeStateContext.js.map +0 -1
  771. package/dist/production/accessorTree/DirtinessContext.js +0 -7
  772. package/dist/production/accessorTree/DirtinessContext.js.map +0 -1
  773. package/dist/production/accessorTree/MutationStateContext.js +0 -7
  774. package/dist/production/accessorTree/MutationStateContext.js.map +0 -1
  775. package/dist/production/accessorTree/accessorTreeStateReducer.js +0 -34
  776. package/dist/production/accessorTree/accessorTreeStateReducer.js.map +0 -1
  777. package/dist/production/accessorTree/metadataToRequestError.js +0 -15
  778. package/dist/production/accessorTree/metadataToRequestError.js.map +0 -1
  779. package/dist/production/accessorTree/useAccessorTreeState.js +0 -14
  780. package/dist/production/accessorTree/useAccessorTreeState.js.map +0 -1
  781. package/dist/production/accessorTree/useDataBinding.js +0 -84
  782. package/dist/production/accessorTree/useDataBinding.js.map +0 -1
  783. package/dist/production/accessorTree/useDirtinessState.js +0 -7
  784. package/dist/production/accessorTree/useDirtinessState.js.map +0 -1
  785. package/dist/production/accessorTree/useMutationState.js +0 -7
  786. package/dist/production/accessorTree/useMutationState.js.map +0 -1
  787. package/dist/production/core/IncrementalMarkerBuilder.js +0 -70
  788. package/dist/production/core/IncrementalMarkerBuilder.js.map +0 -1
  789. package/dist/production/core/MarkerTreeGenerator.js +0 -95
  790. package/dist/production/core/MarkerTreeGenerator.js.map +0 -1
  791. package/dist/production/coreComponents/Component.js +0 -33
  792. package/dist/production/coreComponents/Component.js.map +0 -1
  793. package/dist/production/coreComponents/DataBindingProvider.js +0 -20
  794. package/dist/production/coreComponents/DataBindingProvider.js.map +0 -1
  795. package/dist/production/coreComponents/Entity.js +0 -16
  796. package/dist/production/coreComponents/Entity.js.map +0 -1
  797. package/dist/production/coreComponents/EntityList.js +0 -33
  798. package/dist/production/coreComponents/EntityList.js.map +0 -1
  799. package/dist/production/coreComponents/EntityListSubTree.js +0 -46
  800. package/dist/production/coreComponents/EntityListSubTree.js.map +0 -1
  801. package/dist/production/coreComponents/EntitySubTree.js +0 -57
  802. package/dist/production/coreComponents/EntitySubTree.js.map +0 -1
  803. package/dist/production/coreComponents/Field.js +0 -29
  804. package/dist/production/coreComponents/Field.js.map +0 -1
  805. package/dist/production/coreComponents/HasMany.js +0 -30
  806. package/dist/production/coreComponents/HasMany.js.map +0 -1
  807. package/dist/production/coreComponents/HasOne.js +0 -30
  808. package/dist/production/coreComponents/HasOne.js.map +0 -1
  809. package/dist/production/coreComponents/ParentEntity.js +0 -14
  810. package/dist/production/coreComponents/ParentEntity.js.map +0 -1
  811. package/dist/production/entityEvents/useDerivedField.js +0 -42
  812. package/dist/production/entityEvents/useDerivedField.js.map +0 -1
  813. package/dist/production/entityEvents/useEntityBeforePersist.js +0 -8
  814. package/dist/production/entityEvents/useEntityBeforePersist.js.map +0 -1
  815. package/dist/production/entityEvents/useEntityBeforeUpdate.js +0 -8
  816. package/dist/production/entityEvents/useEntityBeforeUpdate.js.map +0 -1
  817. package/dist/production/entityEvents/useEntityEvent.js +0 -32
  818. package/dist/production/entityEvents/useEntityEvent.js.map +0 -1
  819. package/dist/production/entityEvents/useEntityPersistError.js +0 -8
  820. package/dist/production/entityEvents/useEntityPersistError.js.map +0 -1
  821. package/dist/production/entityEvents/useEntityPersistSuccess.js +0 -8
  822. package/dist/production/entityEvents/useEntityPersistSuccess.js.map +0 -1
  823. package/dist/production/entityEvents/useOnConnectionUpdate.js +0 -8
  824. package/dist/production/entityEvents/useOnConnectionUpdate.js.map +0 -1
  825. package/dist/production/helperComponents/DeferredSubTrees.js +0 -89
  826. package/dist/production/helperComponents/DeferredSubTrees.js.map +0 -1
  827. package/dist/production/helperComponents/EntityView.js +0 -10
  828. package/dist/production/helperComponents/EntityView.js.map +0 -1
  829. package/dist/production/helperComponents/FieldView.js +0 -49
  830. package/dist/production/helperComponents/FieldView.js.map +0 -1
  831. package/dist/production/helperComponents/If.js +0 -52
  832. package/dist/production/helperComponents/If.js.map +0 -1
  833. package/dist/production/helperComponents/StaticRender.js +0 -11
  834. package/dist/production/helperComponents/StaticRender.js.map +0 -1
  835. package/dist/production/helperComponents/SugaredField.js +0 -13
  836. package/dist/production/helperComponents/SugaredField.js.map +0 -1
  837. package/dist/production/helperComponents/helpers/FilterEvaluator.js +0 -37
  838. package/dist/production/helperComponents/helpers/FilterEvaluator.js.map +0 -1
  839. package/dist/production/helperComponents/helpers/FilterFieldsCollector.js +0 -40
  840. package/dist/production/helperComponents/helpers/FilterFieldsCollector.js.map +0 -1
  841. package/dist/production/helperComponents/helpers/evaluateCondition.js +0 -49
  842. package/dist/production/helperComponents/helpers/evaluateCondition.js.map +0 -1
  843. package/dist/types/accessorPropagation/AccessorProvider.d.ts +0 -8
  844. package/dist/types/accessorPropagation/AccessorProvider.d.ts.map +0 -1
  845. package/dist/types/accessorPropagation/BindingOperationsContext.d.ts +0 -4
  846. package/dist/types/accessorPropagation/BindingOperationsContext.d.ts.map +0 -1
  847. package/dist/types/accessorPropagation/BindingOperationsProvider.d.ts +0 -8
  848. package/dist/types/accessorPropagation/BindingOperationsProvider.d.ts.map +0 -1
  849. package/dist/types/accessorPropagation/EntityKeyContext.d.ts +0 -2
  850. package/dist/types/accessorPropagation/EntityKeyContext.d.ts.map +0 -1
  851. package/dist/types/accessorPropagation/EntityKeyProvider.d.ts +0 -7
  852. package/dist/types/accessorPropagation/EntityKeyProvider.d.ts.map +0 -1
  853. package/dist/types/accessorPropagation/EnvironmentContext.d.ts +0 -15
  854. package/dist/types/accessorPropagation/EnvironmentContext.d.ts.map +0 -1
  855. package/dist/types/accessorPropagation/TreeRootIdContext.d.ts +0 -2
  856. package/dist/types/accessorPropagation/TreeRootIdContext.d.ts.map +0 -1
  857. package/dist/types/accessorPropagation/TreeRootIdProvider.d.ts +0 -8
  858. package/dist/types/accessorPropagation/TreeRootIdProvider.d.ts.map +0 -1
  859. package/dist/types/accessorPropagation/index.d.ts +0 -28
  860. package/dist/types/accessorPropagation/index.d.ts.map +0 -1
  861. package/dist/types/accessorPropagation/useAccessorUpdateSubscription.d.ts +0 -16
  862. package/dist/types/accessorPropagation/useAccessorUpdateSubscription.d.ts.map +0 -1
  863. package/dist/types/accessorPropagation/useBindingOperations.d.ts +0 -3
  864. package/dist/types/accessorPropagation/useBindingOperations.d.ts.map +0 -1
  865. package/dist/types/accessorPropagation/useDesugaredRelativeEntityList.d.ts +0 -11
  866. package/dist/types/accessorPropagation/useDesugaredRelativeEntityList.d.ts.map +0 -1
  867. package/dist/types/accessorPropagation/useDesugaredRelativeSingleEntity.d.ts +0 -11
  868. package/dist/types/accessorPropagation/useDesugaredRelativeSingleEntity.d.ts.map +0 -1
  869. package/dist/types/accessorPropagation/useDesugaredRelativeSingleField.d.ts +0 -11
  870. package/dist/types/accessorPropagation/useDesugaredRelativeSingleField.d.ts.map +0 -1
  871. package/dist/types/accessorPropagation/useEntity.d.ts +0 -7
  872. package/dist/types/accessorPropagation/useEntity.d.ts.map +0 -1
  873. package/dist/types/accessorPropagation/useEntityKey.d.ts +0 -2
  874. package/dist/types/accessorPropagation/useEntityKey.d.ts.map +0 -1
  875. package/dist/types/accessorPropagation/useEntityList.d.ts +0 -6
  876. package/dist/types/accessorPropagation/useEntityList.d.ts.map +0 -1
  877. package/dist/types/accessorPropagation/useEntityListSubTree.d.ts +0 -6
  878. package/dist/types/accessorPropagation/useEntityListSubTree.d.ts.map +0 -1
  879. package/dist/types/accessorPropagation/useEntityListSubTreeParameters.d.ts +0 -5
  880. package/dist/types/accessorPropagation/useEntityListSubTreeParameters.d.ts.map +0 -1
  881. package/dist/types/accessorPropagation/useEntitySubTree.d.ts +0 -6
  882. package/dist/types/accessorPropagation/useEntitySubTree.d.ts.map +0 -1
  883. package/dist/types/accessorPropagation/useEntitySubTreeParameters.d.ts +0 -5
  884. package/dist/types/accessorPropagation/useEntitySubTreeParameters.d.ts.map +0 -1
  885. package/dist/types/accessorPropagation/useEnvironment.d.ts +0 -3
  886. package/dist/types/accessorPropagation/useEnvironment.d.ts.map +0 -1
  887. package/dist/types/accessorPropagation/useExtendTree.d.ts +0 -5
  888. package/dist/types/accessorPropagation/useExtendTree.d.ts.map +0 -1
  889. package/dist/types/accessorPropagation/useField.d.ts +0 -6
  890. package/dist/types/accessorPropagation/useField.d.ts.map +0 -1
  891. package/dist/types/accessorPropagation/useGetEntityByKey.d.ts +0 -3
  892. package/dist/types/accessorPropagation/useGetEntityByKey.d.ts.map +0 -1
  893. package/dist/types/accessorPropagation/useGetEntityListSubTree.d.ts +0 -5
  894. package/dist/types/accessorPropagation/useGetEntityListSubTree.d.ts.map +0 -1
  895. package/dist/types/accessorPropagation/useGetEntitySubTree.d.ts +0 -5
  896. package/dist/types/accessorPropagation/useGetEntitySubTree.d.ts.map +0 -1
  897. package/dist/types/accessorPropagation/useGetTreeFilters.d.ts +0 -3
  898. package/dist/types/accessorPropagation/useGetTreeFilters.d.ts.map +0 -1
  899. package/dist/types/accessorPropagation/useHasEntity.d.ts +0 -2
  900. package/dist/types/accessorPropagation/useHasEntity.d.ts.map +0 -1
  901. package/dist/types/accessorPropagation/usePersist.d.ts +0 -3
  902. package/dist/types/accessorPropagation/usePersist.d.ts.map +0 -1
  903. package/dist/types/accessorPropagation/useTreeRootId.d.ts +0 -3
  904. package/dist/types/accessorPropagation/useTreeRootId.d.ts.map +0 -1
  905. package/dist/types/accessorSorting/SetOrderFieldOnCreate.d.ts +0 -9
  906. package/dist/types/accessorSorting/SetOrderFieldOnCreate.d.ts.map +0 -1
  907. package/dist/types/accessorSorting/SortedEntities.d.ts +0 -9
  908. package/dist/types/accessorSorting/SortedEntities.d.ts.map +0 -1
  909. package/dist/types/accessorSorting/addEntityAtIndex.d.ts +0 -4
  910. package/dist/types/accessorSorting/addEntityAtIndex.d.ts.map +0 -1
  911. package/dist/types/accessorSorting/errors.d.ts +0 -3
  912. package/dist/types/accessorSorting/errors.d.ts.map +0 -1
  913. package/dist/types/accessorSorting/index.d.ts +0 -8
  914. package/dist/types/accessorSorting/index.d.ts.map +0 -1
  915. package/dist/types/accessorSorting/moveEntity.d.ts +0 -5
  916. package/dist/types/accessorSorting/moveEntity.d.ts.map +0 -1
  917. package/dist/types/accessorSorting/repairEntitiesOrder.d.ts +0 -4
  918. package/dist/types/accessorSorting/repairEntitiesOrder.d.ts.map +0 -1
  919. package/dist/types/accessorSorting/sortEntities.d.ts +0 -4
  920. package/dist/types/accessorSorting/sortEntities.d.ts.map +0 -1
  921. package/dist/types/accessorSorting/useSortedEntities.d.ts +0 -5
  922. package/dist/types/accessorSorting/useSortedEntities.d.ts.map +0 -1
  923. package/dist/types/accessorTree/AccessorTree.d.ts +0 -14
  924. package/dist/types/accessorTree/AccessorTree.d.ts.map +0 -1
  925. package/dist/types/accessorTree/AccessorTreeState.d.ts +0 -23
  926. package/dist/types/accessorTree/AccessorTreeState.d.ts.map +0 -1
  927. package/dist/types/accessorTree/AccessorTreeStateAction.d.ts +0 -18
  928. package/dist/types/accessorTree/AccessorTreeStateAction.d.ts.map +0 -1
  929. package/dist/types/accessorTree/AccessorTreeStateContext.d.ts +0 -3
  930. package/dist/types/accessorTree/AccessorTreeStateContext.d.ts.map +0 -1
  931. package/dist/types/accessorTree/AccessorTreeStateMetadata.d.ts +0 -4
  932. package/dist/types/accessorTree/AccessorTreeStateMetadata.d.ts.map +0 -1
  933. package/dist/types/accessorTree/AccessorTreeStateOptions.d.ts +0 -7
  934. package/dist/types/accessorTree/AccessorTreeStateOptions.d.ts.map +0 -1
  935. package/dist/types/accessorTree/DirtinessContext.d.ts +0 -2
  936. package/dist/types/accessorTree/DirtinessContext.d.ts.map +0 -1
  937. package/dist/types/accessorTree/MutationRequestResponse.d.ts +0 -52
  938. package/dist/types/accessorTree/MutationRequestResponse.d.ts.map +0 -1
  939. package/dist/types/accessorTree/MutationStateContext.d.ts +0 -2
  940. package/dist/types/accessorTree/MutationStateContext.d.ts.map +0 -1
  941. package/dist/types/accessorTree/RequestError.d.ts +0 -21
  942. package/dist/types/accessorTree/RequestError.d.ts.map +0 -1
  943. package/dist/types/accessorTree/accessorTreeStateReducer.d.ts +0 -4
  944. package/dist/types/accessorTree/accessorTreeStateReducer.d.ts.map +0 -1
  945. package/dist/types/accessorTree/metadataToRequestError.d.ts +0 -4
  946. package/dist/types/accessorTree/metadataToRequestError.d.ts.map +0 -1
  947. package/dist/types/accessorTree/useAccessorTreeState.d.ts +0 -2
  948. package/dist/types/accessorTree/useAccessorTreeState.d.ts.map +0 -1
  949. package/dist/types/accessorTree/useDataBinding.d.ts +0 -4
  950. package/dist/types/accessorTree/useDataBinding.d.ts.map +0 -1
  951. package/dist/types/accessorTree/useDirtinessState.d.ts +0 -2
  952. package/dist/types/accessorTree/useDirtinessState.d.ts.map +0 -1
  953. package/dist/types/accessorTree/useMutationState.d.ts +0 -2
  954. package/dist/types/accessorTree/useMutationState.d.ts.map +0 -1
  955. package/dist/types/core/IncrementalMarkerBuilder.d.ts +0 -7
  956. package/dist/types/core/IncrementalMarkerBuilder.d.ts.map +0 -1
  957. package/dist/types/core/MarkerTreeGenerator.d.ts +0 -14
  958. package/dist/types/core/MarkerTreeGenerator.d.ts.map +0 -1
  959. package/dist/types/coreComponents/Component.d.ts +0 -13
  960. package/dist/types/coreComponents/Component.d.ts.map +0 -1
  961. package/dist/types/coreComponents/DataBindingProvider.d.ts +0 -27
  962. package/dist/types/coreComponents/DataBindingProvider.d.ts.map +0 -1
  963. package/dist/types/coreComponents/Entity.d.ts +0 -12
  964. package/dist/types/coreComponents/Entity.d.ts.map +0 -1
  965. package/dist/types/coreComponents/EntityList.d.ts +0 -15
  966. package/dist/types/coreComponents/EntityList.d.ts.map +0 -1
  967. package/dist/types/coreComponents/EntityListSubTree.d.ts +0 -26
  968. package/dist/types/coreComponents/EntityListSubTree.d.ts.map +0 -1
  969. package/dist/types/coreComponents/EntitySubTree.d.ts +0 -24
  970. package/dist/types/coreComponents/EntitySubTree.d.ts.map +0 -1
  971. package/dist/types/coreComponents/Field.d.ts +0 -14
  972. package/dist/types/coreComponents/Field.d.ts.map +0 -1
  973. package/dist/types/coreComponents/HasMany.d.ts +0 -16
  974. package/dist/types/coreComponents/HasMany.d.ts.map +0 -1
  975. package/dist/types/coreComponents/HasOne.d.ts +0 -12
  976. package/dist/types/coreComponents/HasOne.d.ts.map +0 -1
  977. package/dist/types/coreComponents/MarkerProvider.d.ts +0 -21
  978. package/dist/types/coreComponents/MarkerProvider.d.ts.map +0 -1
  979. package/dist/types/coreComponents/ParentEntity.d.ts +0 -10
  980. package/dist/types/coreComponents/ParentEntity.d.ts.map +0 -1
  981. package/dist/types/coreComponents/index.d.ts +0 -12
  982. package/dist/types/coreComponents/index.d.ts.map +0 -1
  983. package/dist/types/entityEvents/index.d.ts +0 -8
  984. package/dist/types/entityEvents/index.d.ts.map +0 -1
  985. package/dist/types/entityEvents/useDerivedField.d.ts +0 -9
  986. package/dist/types/entityEvents/useDerivedField.d.ts.map +0 -1
  987. package/dist/types/entityEvents/useEntityBeforePersist.d.ts +0 -3
  988. package/dist/types/entityEvents/useEntityBeforePersist.d.ts.map +0 -1
  989. package/dist/types/entityEvents/useEntityBeforeUpdate.d.ts +0 -3
  990. package/dist/types/entityEvents/useEntityBeforeUpdate.d.ts.map +0 -1
  991. package/dist/types/entityEvents/useEntityEvent.d.ts +0 -9
  992. package/dist/types/entityEvents/useEntityEvent.d.ts.map +0 -1
  993. package/dist/types/entityEvents/useEntityPersistError.d.ts +0 -3
  994. package/dist/types/entityEvents/useEntityPersistError.d.ts.map +0 -1
  995. package/dist/types/entityEvents/useEntityPersistSuccess.d.ts +0 -3
  996. package/dist/types/entityEvents/useEntityPersistSuccess.d.ts.map +0 -1
  997. package/dist/types/entityEvents/useOnConnectionUpdate.d.ts +0 -4
  998. package/dist/types/entityEvents/useOnConnectionUpdate.d.ts.map +0 -1
  999. package/dist/types/helperComponents/DeferredSubTrees.d.ts +0 -10
  1000. package/dist/types/helperComponents/DeferredSubTrees.d.ts.map +0 -1
  1001. package/dist/types/helperComponents/EntityView.d.ts +0 -12
  1002. package/dist/types/helperComponents/EntityView.d.ts.map +0 -1
  1003. package/dist/types/helperComponents/FieldView.d.ts +0 -59
  1004. package/dist/types/helperComponents/FieldView.d.ts.map +0 -1
  1005. package/dist/types/helperComponents/If.d.ts +0 -17
  1006. package/dist/types/helperComponents/If.d.ts.map +0 -1
  1007. package/dist/types/helperComponents/StaticRender.d.ts +0 -9
  1008. package/dist/types/helperComponents/StaticRender.d.ts.map +0 -1
  1009. package/dist/types/helperComponents/SugaredField.d.ts +0 -12
  1010. package/dist/types/helperComponents/SugaredField.d.ts.map +0 -1
  1011. package/dist/types/helperComponents/helpers/FilterEvaluator.d.ts +0 -9
  1012. package/dist/types/helperComponents/helpers/FilterEvaluator.d.ts.map +0 -1
  1013. package/dist/types/helperComponents/helpers/FilterFieldsCollector.d.ts +0 -10
  1014. package/dist/types/helperComponents/helpers/FilterFieldsCollector.d.ts.map +0 -1
  1015. package/dist/types/helperComponents/helpers/evaluateCondition.d.ts +0 -4
  1016. package/dist/types/helperComponents/helpers/evaluateCondition.d.ts.map +0 -1
  1017. package/dist/types/helperComponents/index.d.ts +0 -7
  1018. package/dist/types/helperComponents/index.d.ts.map +0 -1
  1019. package/src/accessorPropagation/AccessorProvider.tsx +0 -17
  1020. package/src/accessorPropagation/BindingOperationsContext.ts +0 -32
  1021. package/src/accessorPropagation/BindingOperationsProvider.tsx +0 -16
  1022. package/src/accessorPropagation/EntityKeyContext.ts +0 -4
  1023. package/src/accessorPropagation/EntityKeyProvider.tsx +0 -11
  1024. package/src/accessorPropagation/EnvironmentContext.tsx +0 -44
  1025. package/src/accessorPropagation/TreeRootIdContext.ts +0 -5
  1026. package/src/accessorPropagation/TreeRootIdProvider.tsx +0 -12
  1027. package/src/accessorPropagation/index.ts +0 -30
  1028. package/src/accessorPropagation/useAccessorUpdateSubscription.ts +0 -107
  1029. package/src/accessorPropagation/useBindingOperations.ts +0 -5
  1030. package/src/accessorPropagation/useDesugaredRelativeEntityList.ts +0 -70
  1031. package/src/accessorPropagation/useDesugaredRelativeSingleEntity.ts +0 -58
  1032. package/src/accessorPropagation/useDesugaredRelativeSingleField.ts +0 -58
  1033. package/src/accessorPropagation/useEntity.ts +0 -56
  1034. package/src/accessorPropagation/useEntityKey.ts +0 -15
  1035. package/src/accessorPropagation/useEntityList.ts +0 -49
  1036. package/src/accessorPropagation/useEntityListSubTree.ts +0 -27
  1037. package/src/accessorPropagation/useEntityListSubTreeParameters.ts +0 -88
  1038. package/src/accessorPropagation/useEntitySubTree.ts +0 -26
  1039. package/src/accessorPropagation/useEntitySubTreeParameters.ts +0 -66
  1040. package/src/accessorPropagation/useEnvironment.ts +0 -7
  1041. package/src/accessorPropagation/useExtendTree.ts +0 -30
  1042. package/src/accessorPropagation/useField.ts +0 -51
  1043. package/src/accessorPropagation/useGetEntityByKey.ts +0 -4
  1044. package/src/accessorPropagation/useGetEntityListSubTree.ts +0 -28
  1045. package/src/accessorPropagation/useGetEntitySubTree.ts +0 -28
  1046. package/src/accessorPropagation/useGetTreeFilters.ts +0 -4
  1047. package/src/accessorPropagation/useHasEntity.ts +0 -6
  1048. package/src/accessorPropagation/usePersist.ts +0 -4
  1049. package/src/accessorPropagation/useTreeRootId.ts +0 -5
  1050. package/src/accessorSorting/SetOrderFieldOnCreate.tsx +0 -92
  1051. package/src/accessorSorting/SortedEntities.ts +0 -9
  1052. package/src/accessorSorting/addEntityAtIndex.ts +0 -27
  1053. package/src/accessorSorting/errors.ts +0 -9
  1054. package/src/accessorSorting/index.ts +0 -9
  1055. package/src/accessorSorting/moveEntity.ts +0 -66
  1056. package/src/accessorSorting/repairEntitiesOrder.ts +0 -15
  1057. package/src/accessorSorting/sortEntities.ts +0 -20
  1058. package/src/accessorSorting/useSortedEntities.ts +0 -102
  1059. package/src/accessorTree/AccessorTree.tsx +0 -37
  1060. package/src/accessorTree/AccessorTreeState.ts +0 -29
  1061. package/src/accessorTree/AccessorTreeStateAction.ts +0 -21
  1062. package/src/accessorTree/AccessorTreeStateContext.ts +0 -4
  1063. package/src/accessorTree/AccessorTreeStateMetadata.ts +0 -3
  1064. package/src/accessorTree/AccessorTreeStateOptions.ts +0 -7
  1065. package/src/accessorTree/DirtinessContext.ts +0 -4
  1066. package/src/accessorTree/MutationRequestResponse.ts +0 -64
  1067. package/src/accessorTree/MutationStateContext.ts +0 -4
  1068. package/src/accessorTree/RequestError.ts +0 -22
  1069. package/src/accessorTree/accessorTreeStateReducer.ts +0 -36
  1070. package/src/accessorTree/metadataToRequestError.ts +0 -14
  1071. package/src/accessorTree/useAccessorTreeState.ts +0 -11
  1072. package/src/accessorTree/useDataBinding.ts +0 -104
  1073. package/src/accessorTree/useDirtinessState.ts +0 -4
  1074. package/src/accessorTree/useMutationState.ts +0 -4
  1075. package/src/core/IncrementalMarkerBuilder.ts +0 -60
  1076. package/src/core/MarkerTreeGenerator.ts +0 -121
  1077. package/src/coreComponents/Component.tsx +0 -74
  1078. package/src/coreComponents/DataBindingProvider.tsx +0 -54
  1079. package/src/coreComponents/Entity.tsx +0 -26
  1080. package/src/coreComponents/EntityList.tsx +0 -55
  1081. package/src/coreComponents/EntityListSubTree.tsx +0 -83
  1082. package/src/coreComponents/EntitySubTree.tsx +0 -93
  1083. package/src/coreComponents/Field.tsx +0 -46
  1084. package/src/coreComponents/HasMany.tsx +0 -47
  1085. package/src/coreComponents/HasOne.tsx +0 -41
  1086. package/src/coreComponents/MarkerProvider.ts +0 -59
  1087. package/src/coreComponents/ParentEntity.tsx +0 -20
  1088. package/src/coreComponents/index.ts +0 -11
  1089. package/src/entityEvents/index.ts +0 -7
  1090. package/src/entityEvents/useDerivedField.ts +0 -64
  1091. package/src/entityEvents/useEntityBeforePersist.ts +0 -6
  1092. package/src/entityEvents/useEntityBeforeUpdate.ts +0 -6
  1093. package/src/entityEvents/useEntityEvent.ts +0 -57
  1094. package/src/entityEvents/useEntityPersistError.ts +0 -6
  1095. package/src/entityEvents/useEntityPersistSuccess.ts +0 -6
  1096. package/src/entityEvents/useOnConnectionUpdate.ts +0 -10
  1097. package/src/helperComponents/DeferredSubTrees.tsx +0 -126
  1098. package/src/helperComponents/EntityView.tsx +0 -19
  1099. package/src/helperComponents/FieldView.tsx +0 -142
  1100. package/src/helperComponents/If.tsx +0 -74
  1101. package/src/helperComponents/StaticRender.tsx +0 -15
  1102. package/src/helperComponents/SugaredField.tsx +0 -18
  1103. package/src/helperComponents/helpers/FilterEvaluator.ts +0 -46
  1104. package/src/helperComponents/helpers/FilterFieldsCollector.ts +0 -46
  1105. package/src/helperComponents/helpers/evaluateCondition.ts +0 -52
  1106. package/src/helperComponents/index.ts +0 -6
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const uuid = require("uuid");
4
+ const BindingError = require("../../BindingError.cjs");
5
+ const EventManager = require("../EventManager.cjs");
6
+ const MarkerComparator = require("../MarkerComparator.cjs");
7
+ const RealmKeyGenerator = require("../RealmKeyGenerator.cjs");
8
+ const OperationsHelpers = require("./OperationsHelpers.cjs");
9
+ const EventListenersStore = require("../../treeParameters/EventListenersStore.cjs");
10
+ const StateIterator = require("../state/StateIterator.cjs");
11
+ const ErrorLocator = require("../exceptions/ErrorLocator.cjs");
12
+ const getEntityMarker = require("../state/getEntityMarker.cjs");
13
+ const LocalizedBindingError = require("../exceptions/LocalizedBindingError.cjs");
14
+ const RuntimeId = require("../../accessorTree/RuntimeId.cjs");
15
+ class ListOperations {
16
+ constructor(accessorErrorManager, batchUpdatesOptions, eventManager, stateInitializer, treeStore) {
17
+ this.accessorErrorManager = accessorErrorManager;
18
+ this.batchUpdatesOptions = batchUpdatesOptions;
19
+ this.eventManager = eventManager;
20
+ this.stateInitializer = stateInitializer;
21
+ this.treeStore = treeStore;
22
+ }
23
+ addError(listState, error) {
24
+ return this.accessorErrorManager.addError(listState, error);
25
+ }
26
+ addEventListener(state, event, listener) {
27
+ if (state.eventListeners === void 0) {
28
+ state.eventListeners = new EventListenersStore.EventListenersStore();
29
+ }
30
+ return state.eventListeners.add(event, listener);
31
+ }
32
+ addChildEventListener(state, event, listener) {
33
+ if (state.childEventListeners === void 0) {
34
+ state.childEventListeners = new EventListenersStore.EventListenersStore();
35
+ }
36
+ return state.childEventListeners.add(event, listener);
37
+ }
38
+ batchUpdates(state, performUpdates) {
39
+ this.eventManager.syncOperation(() => {
40
+ performUpdates(state.getAccessor, this.batchUpdatesOptions);
41
+ });
42
+ }
43
+ connectEntity(outerState, entityToConnect) {
44
+ this.eventManager.syncOperation(() => {
45
+ const persistedEntityIds = this.treeStore.getEntityListPersistedIds(outerState);
46
+ const stateToConnect = OperationsHelpers.OperationsHelpers.resolveAndPrepareEntityToConnect(this.treeStore, entityToConnect);
47
+ const idToConnect = stateToConnect.entity.id;
48
+ for (const state of StateIterator.StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {
49
+ if (state.entityName !== stateToConnect.entity.entityName) {
50
+ throw new BindingError.BindingError(
51
+ `EntityListAccessor.connectEntity: Attempting to connect at an entity of type '${stateToConnect.entity.entityName}' but '${state.entityName}' is expected.
52
+
53
+ Entity located at: ${ErrorLocator.ErrorLocator.locateInternalState(outerState)}.`
54
+ );
55
+ }
56
+ try {
57
+ MarkerComparator.MarkerComparator.assertEntityMarkersSubsetOf(
58
+ state.blueprint.marker.fields,
59
+ getEntityMarker.getEntityMarker(stateToConnect).fields
60
+ );
61
+ } catch (error) {
62
+ if (error instanceof LocalizedBindingError.LocalizedBindingError) {
63
+ throw new BindingError.BindingError(
64
+ `Entity list: cannot connect entity with key '${entityToConnect.key}' because its fields are incompatible with entities found on this list. Make sure both trees are equivalent.
65
+
66
+ ${error.message}
67
+
68
+ ` + (error.markerPath.length > 1 ? `Incompatibility found at: ${ErrorLocator.ErrorLocator.locateMarkerPath(error.markerPath)}.
69
+
70
+ ` : "") + `Entity list located at: ${ErrorLocator.ErrorLocator.locateInternalState(state)}.`
71
+ );
72
+ }
73
+ throw error;
74
+ }
75
+ if (state.children.has(idToConnect.value)) {
76
+ continue;
77
+ }
78
+ this.stateInitializer.initializeEntityRealm(idToConnect, state.entityName, {
79
+ type: "listEntity",
80
+ parent: state
81
+ }, stateToConnect);
82
+ state.plannedRemovals?.delete(idToConnect.value);
83
+ let changesDelta = 0;
84
+ if (persistedEntityIds.has(idToConnect.value)) {
85
+ changesDelta--;
86
+ } else if (idToConnect.existsOnServer) {
87
+ changesDelta++;
88
+ }
89
+ if (stateToConnect.type === "entityRealm") {
90
+ changesDelta += stateToConnect.unpersistedChangesCount;
91
+ }
92
+ this.eventManager.registerJustUpdated(state, changesDelta);
93
+ }
94
+ });
95
+ }
96
+ disconnectEntity(listState, childEntity, options) {
97
+ this.eventManager.syncOperation(() => {
98
+ const persistedEntityIds = this.treeStore.getEntityListPersistedIds(listState);
99
+ for (const state of StateIterator.StateIterator.eachSiblingRealmChild(this.treeStore, listState)) {
100
+ const disconnectedChildIdValue = childEntity.id;
101
+ const disconnectedChildRealm = state.children.get(disconnectedChildIdValue);
102
+ if (disconnectedChildRealm === void 0) {
103
+ throw new BindingError.BindingError(
104
+ `Entity list doesn't include an entity with id '${disconnectedChildIdValue}' and so it cannot remove it.`
105
+ );
106
+ }
107
+ this.treeStore.disposeOfRealm(disconnectedChildRealm);
108
+ listState.children.delete(disconnectedChildIdValue);
109
+ let changesDelta = 0;
110
+ if (persistedEntityIds.has(disconnectedChildIdValue)) {
111
+ changesDelta++;
112
+ if (state.plannedRemovals === void 0) {
113
+ state.plannedRemovals = /* @__PURE__ */ new Map();
114
+ }
115
+ if (!options.noPersist) {
116
+ state.plannedRemovals.set(disconnectedChildIdValue, "disconnect");
117
+ }
118
+ } else if (disconnectedChildRealm.entity.id.existsOnServer) {
119
+ changesDelta--;
120
+ }
121
+ if (disconnectedChildRealm.type === "entityRealm") {
122
+ changesDelta -= disconnectedChildRealm.unpersistedChangesCount;
123
+ }
124
+ this.eventManager.registerJustUpdated(state, changesDelta);
125
+ }
126
+ });
127
+ }
128
+ createNewEntity(outerState, initialize) {
129
+ return this.eventManager.syncOperation(() => {
130
+ const id = new RuntimeId.UnpersistedEntityDummyId();
131
+ for (const state of StateIterator.StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {
132
+ const newEntity = this.stateInitializer.initializeEntityRealm(id, state.entityName, {
133
+ type: "listEntity",
134
+ parent: state
135
+ });
136
+ this.stateInitializer.runImmediateUserInitialization(newEntity, initialize);
137
+ this.eventManager.registerJustUpdated(state, EventManager.EventManager.NO_CHANGES_DIFFERENCE);
138
+ }
139
+ return id;
140
+ });
141
+ }
142
+ getChildEntityById(state, id) {
143
+ const realm = state.children.get(id);
144
+ if (realm === void 0) {
145
+ const isRuntimeId = typeof id === "number" || uuid.validate(id) || RuntimeId.UnpersistedEntityDummyId.matchesDummyId(id);
146
+ if (isRuntimeId) {
147
+ throw new BindingError.BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`);
148
+ }
149
+ const looksLikeKey = typeof id === "string" && (this.treeStore.entityRealmStore.has(id) || RealmKeyGenerator.RealmKeyGenerator.vaguelyAppearsToBeAKey(id));
150
+ throw new BindingError.BindingError(
151
+ `EntityList: cannot retrieve an entity with id '${id}' because it's not a valid id.` + (looksLikeKey ? `
152
+ The supplied value appears to be an entity *key*, not an *id*. List accessors are indexed by ids and you can use \`EntityAccessor.id\` to obtain one. Keys, on the other hand, are globally unique and you can use \`getEntityByKey\` to get its EntityAccessor.` : "")
153
+ );
154
+ }
155
+ return realm.getAccessor();
156
+ }
157
+ }
158
+ exports.ListOperations = ListOperations;
159
+ //# sourceMappingURL=ListOperations.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListOperations.cjs","sources":["../../../../src/core/operations/ListOperations.ts"],"sourcesContent":["import { validate as uuidValidate } from 'uuid'\nimport type { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, ErrorAccessor } from '../../accessors'\nimport { RuntimeId, UnpersistedEntityDummyId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport type { AccessorErrorManager } from '../AccessorErrorManager'\nimport { EventManager } from '../EventManager'\nimport { ErrorLocator, LocalizedBindingError } from '../exceptions'\nimport { MarkerComparator } from '../MarkerComparator'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator'\nimport { EntityListState, getEntityMarker, StateIterator } from '../state'\nimport type { StateInitializer } from '../StateInitializer'\nimport type { TreeStore } from '../TreeStore'\nimport { OperationsHelpers } from './OperationsHelpers'\nimport { EntityId, EventListenersStore } from '../../treeParameters'\n\nexport class ListOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(listState: EntityListState, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(listState, error)\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityListAccessor.RuntimeEntityListEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityListAccessor.RuntimeEntityListEventListenerMap[Type],\n\t) {\n\t\tif (state.eventListeners === undefined) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic addChildEventListener<Type extends keyof EntityAccessor.EntityEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t) {\n\t\tif (state.childEventListeners === undefined) {\n\t\t\tstate.childEventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.childEventListeners.add(event, listener)\n\t}\n\n\tpublic batchUpdates(state: EntityListState, performUpdates: EntityListAccessor.BatchUpdatesHandler) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tperformUpdates(state.getAccessor, this.batchUpdatesOptions)\n\t\t})\n\t}\n\n\tpublic connectEntity(outerState: EntityListState, entityToConnect: EntityAccessor) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(outerState)\n\t\t\tconst stateToConnect = OperationsHelpers.resolveAndPrepareEntityToConnect(this.treeStore, entityToConnect)\n\t\t\tconst idToConnect = stateToConnect.entity.id\n\n\t\t\t// TODO disable this at the top-level.\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tif (state.entityName !== stateToConnect.entity.entityName) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`EntityListAccessor.connectEntity: Attempting to connect at an entity of type ` +\n\t\t\t\t\t\t\t`'${stateToConnect.entity.entityName}' but '${state.entityName}' is expected.\\n\\n` +\n\t\t\t\t\t\t\t`Entity located at: ${ErrorLocator.locateInternalState(outerState)}.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tMarkerComparator.assertEntityMarkersSubsetOf(\n\t\t\t\t\t\tstate.blueprint.marker.fields,\n\t\t\t\t\t\tgetEntityMarker(stateToConnect).fields,\n\t\t\t\t\t)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof LocalizedBindingError) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Entity list: cannot connect entity with key '${entityToConnect.key}' because its fields are ` +\n\t\t\t\t\t\t\t\t`incompatible with entities found on this list. Make sure both trees are equivalent.\\n\\n` +\n\t\t\t\t\t\t\t\t`${error.message}\\n\\n` +\n\t\t\t\t\t\t\t\t(error.markerPath.length > 1\n\t\t\t\t\t\t\t\t\t? `Incompatibility found at: ${ErrorLocator.locateMarkerPath(error.markerPath)}.\\n\\n`\n\t\t\t\t\t\t\t\t\t: '') +\n\t\t\t\t\t\t\t\t`Entity list located at: ${ErrorLocator.locateInternalState(state)}.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\n\t\t\t\tif (state.children.has(idToConnect.value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.stateInitializer.initializeEntityRealm(idToConnect, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t}, stateToConnect)\n\n\t\t\t\tstate.plannedRemovals?.delete(idToConnect.value)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(idToConnect.value)) {\n\t\t\t\t\t// It was removed from the list but now we're adding it back.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t} else if (idToConnect.existsOnServer) {\n\t\t\t\t\t// ignoring unpersisted entities\n\t\t\t\t\tchangesDelta++\n\t\t\t\t}\n\t\t\t\tif (stateToConnect.type === 'entityRealm') {\n\t\t\t\t\tchangesDelta += stateToConnect.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic disconnectEntity(listState: EntityListState, childEntity: EntityAccessor, options: {noPersist?: boolean}) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\t// TODO disable this at the top-level.\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(listState)\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, listState)) {\n\t\t\t\tconst disconnectedChildIdValue = childEntity.id\n\t\t\t\tconst disconnectedChildRealm = state.children.get(disconnectedChildIdValue)\n\n\t\t\t\tif (disconnectedChildRealm === undefined) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Entity list doesn't include an entity with id '${disconnectedChildIdValue}' and so it cannot remove it.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tthis.treeStore.disposeOfRealm(disconnectedChildRealm)\n\t\t\t\tlistState.children.delete(disconnectedChildIdValue)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(disconnectedChildIdValue)) {\n\t\t\t\t\tchangesDelta++\n\n\t\t\t\t\tif (state.plannedRemovals === undefined) {\n\t\t\t\t\t\tstate.plannedRemovals = new Map()\n\t\t\t\t\t}\n\t\t\t\t\tif (!options.noPersist) {\n\t\t\t\t\t\tstate.plannedRemovals.set(disconnectedChildIdValue, 'disconnect')\n\t\t\t\t\t}\n\t\t\t\t} else if (disconnectedChildRealm.entity.id.existsOnServer) {\n\t\t\t\t\t// Disconnecting unpersisted entities doesn't constitute a change.\n\n\t\t\t\t\t// It wasn't on the list, then it was, and now we're removing it again.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t}\n\n\t\t\t\tif (disconnectedChildRealm.type === 'entityRealm') {\n\t\t\t\t\t// Undoing whatever changes this child had caused.\n\t\t\t\t\tchangesDelta -= disconnectedChildRealm.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic createNewEntity(outerState: EntityListState, initialize: EntityAccessor.BatchUpdatesHandler | undefined): RuntimeId {\n\t\treturn this.eventManager.syncOperation((): RuntimeId => {\n\t\t\t// All siblings need to have the same id.\n\t\t\tconst id = new UnpersistedEntityDummyId()\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tconst newEntity = this.stateInitializer.initializeEntityRealm(id, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t})\n\n\t\t\t\tthis.stateInitializer.runImmediateUserInitialization(newEntity, initialize)\n\n\t\t\t\t// The act of creating the entity doesn't constitute a change unless there's something inside to persist.\n\t\t\t\t// TODO forceCreate\n\t\t\t\t// TODO defaultValue\n\t\t\t\tthis.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\t\t\treturn id\n\t\t})\n\t}\n\n\tpublic getChildEntityById(state: EntityListState, id: EntityId) {\n\t\tconst realm = state.children.get(id)\n\t\tif (realm === undefined) {\n\t\t\tconst isRuntimeId = typeof id === 'number' || uuidValidate(id) || UnpersistedEntityDummyId.matchesDummyId(id)\n\t\t\tif (isRuntimeId) {\n\t\t\t\tthrow new BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`)\n\t\t\t}\n\t\t\tconst looksLikeKey = typeof id === 'string' && (this.treeStore.entityRealmStore.has(id) || RealmKeyGenerator.vaguelyAppearsToBeAKey(id))\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityList: cannot retrieve an entity with id '${id}' because it's not a valid id.` +\n\t\t\t\t\t(looksLikeKey\n\t\t\t\t\t\t? `\\nThe supplied value appears to be an entity *key*, not an *id*. List accessors are indexed by ids ` +\n\t\t\t\t\t\t `and you can use \\`EntityAccessor.id\\` to obtain one. Keys, on the other hand, are globally unique and ` +\n\t\t\t\t\t\t `you can use \\`getEntityByKey\\` to get its EntityAccessor.`\n\t\t\t\t\t\t: ''),\n\t\t\t)\n\t\t}\n\t\treturn realm.getAccessor()\n\t}\n}\n"],"names":["EventListenersStore","OperationsHelpers","StateIterator","BindingError","ErrorLocator","MarkerComparator","getEntityMarker","LocalizedBindingError","UnpersistedEntityDummy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EAAE,6BAA6B;AAAA,MACzG;AACA,YAAM,eAAe,OAAO,OAAO,aAAa,KAAK,UAAU,iBAAiB,IAAI,EAAE,KAAKQ,kBAAAA,kBAAkB,uBAAuB,EAAE;AACtI,YAAM,IAAIR,aAAA;AAAA,QACT,kDAAkD,EAAE,oCAClD,eACE;AAAA,oQAGA;AAAA,MAAA;AAAA,IAEN;AACA,WAAO,MAAM;EACd;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ListOperations.js","sources":["../../../../src/core/operations/ListOperations.ts"],"sourcesContent":["import { validate as uuidValidate } from 'uuid'\nimport type { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, ErrorAccessor } from '../../accessors'\nimport { RuntimeId, UnpersistedEntityDummyId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport type { AccessorErrorManager } from '../AccessorErrorManager'\nimport { EventManager } from '../EventManager'\nimport { ErrorLocator, LocalizedBindingError } from '../exceptions'\nimport { MarkerComparator } from '../MarkerComparator'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator'\nimport { EntityListState, getEntityMarker, StateIterator } from '../state'\nimport type { StateInitializer } from '../StateInitializer'\nimport type { TreeStore } from '../TreeStore'\nimport { OperationsHelpers } from './OperationsHelpers'\nimport { EntityId, EventListenersStore } from '../../treeParameters'\n\nexport class ListOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(listState: EntityListState, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(listState, error)\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityListAccessor.RuntimeEntityListEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityListAccessor.RuntimeEntityListEventListenerMap[Type],\n\t) {\n\t\tif (state.eventListeners === undefined) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic addChildEventListener<Type extends keyof EntityAccessor.EntityEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t) {\n\t\tif (state.childEventListeners === undefined) {\n\t\t\tstate.childEventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.childEventListeners.add(event, listener)\n\t}\n\n\tpublic batchUpdates(state: EntityListState, performUpdates: EntityListAccessor.BatchUpdatesHandler) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tperformUpdates(state.getAccessor, this.batchUpdatesOptions)\n\t\t})\n\t}\n\n\tpublic connectEntity(outerState: EntityListState, entityToConnect: EntityAccessor) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(outerState)\n\t\t\tconst stateToConnect = OperationsHelpers.resolveAndPrepareEntityToConnect(this.treeStore, entityToConnect)\n\t\t\tconst idToConnect = stateToConnect.entity.id\n\n\t\t\t// TODO disable this at the top-level.\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tif (state.entityName !== stateToConnect.entity.entityName) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`EntityListAccessor.connectEntity: Attempting to connect at an entity of type ` +\n\t\t\t\t\t\t\t`'${stateToConnect.entity.entityName}' but '${state.entityName}' is expected.\\n\\n` +\n\t\t\t\t\t\t\t`Entity located at: ${ErrorLocator.locateInternalState(outerState)}.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tMarkerComparator.assertEntityMarkersSubsetOf(\n\t\t\t\t\t\tstate.blueprint.marker.fields,\n\t\t\t\t\t\tgetEntityMarker(stateToConnect).fields,\n\t\t\t\t\t)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof LocalizedBindingError) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Entity list: cannot connect entity with key '${entityToConnect.key}' because its fields are ` +\n\t\t\t\t\t\t\t\t`incompatible with entities found on this list. Make sure both trees are equivalent.\\n\\n` +\n\t\t\t\t\t\t\t\t`${error.message}\\n\\n` +\n\t\t\t\t\t\t\t\t(error.markerPath.length > 1\n\t\t\t\t\t\t\t\t\t? `Incompatibility found at: ${ErrorLocator.locateMarkerPath(error.markerPath)}.\\n\\n`\n\t\t\t\t\t\t\t\t\t: '') +\n\t\t\t\t\t\t\t\t`Entity list located at: ${ErrorLocator.locateInternalState(state)}.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\n\t\t\t\tif (state.children.has(idToConnect.value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.stateInitializer.initializeEntityRealm(idToConnect, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t}, stateToConnect)\n\n\t\t\t\tstate.plannedRemovals?.delete(idToConnect.value)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(idToConnect.value)) {\n\t\t\t\t\t// It was removed from the list but now we're adding it back.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t} else if (idToConnect.existsOnServer) {\n\t\t\t\t\t// ignoring unpersisted entities\n\t\t\t\t\tchangesDelta++\n\t\t\t\t}\n\t\t\t\tif (stateToConnect.type === 'entityRealm') {\n\t\t\t\t\tchangesDelta += stateToConnect.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic disconnectEntity(listState: EntityListState, childEntity: EntityAccessor, options: {noPersist?: boolean}) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\t// TODO disable this at the top-level.\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(listState)\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, listState)) {\n\t\t\t\tconst disconnectedChildIdValue = childEntity.id\n\t\t\t\tconst disconnectedChildRealm = state.children.get(disconnectedChildIdValue)\n\n\t\t\t\tif (disconnectedChildRealm === undefined) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Entity list doesn't include an entity with id '${disconnectedChildIdValue}' and so it cannot remove it.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tthis.treeStore.disposeOfRealm(disconnectedChildRealm)\n\t\t\t\tlistState.children.delete(disconnectedChildIdValue)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(disconnectedChildIdValue)) {\n\t\t\t\t\tchangesDelta++\n\n\t\t\t\t\tif (state.plannedRemovals === undefined) {\n\t\t\t\t\t\tstate.plannedRemovals = new Map()\n\t\t\t\t\t}\n\t\t\t\t\tif (!options.noPersist) {\n\t\t\t\t\t\tstate.plannedRemovals.set(disconnectedChildIdValue, 'disconnect')\n\t\t\t\t\t}\n\t\t\t\t} else if (disconnectedChildRealm.entity.id.existsOnServer) {\n\t\t\t\t\t// Disconnecting unpersisted entities doesn't constitute a change.\n\n\t\t\t\t\t// It wasn't on the list, then it was, and now we're removing it again.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t}\n\n\t\t\t\tif (disconnectedChildRealm.type === 'entityRealm') {\n\t\t\t\t\t// Undoing whatever changes this child had caused.\n\t\t\t\t\tchangesDelta -= disconnectedChildRealm.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic createNewEntity(outerState: EntityListState, initialize: EntityAccessor.BatchUpdatesHandler | undefined): RuntimeId {\n\t\treturn this.eventManager.syncOperation((): RuntimeId => {\n\t\t\t// All siblings need to have the same id.\n\t\t\tconst id = new UnpersistedEntityDummyId()\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tconst newEntity = this.stateInitializer.initializeEntityRealm(id, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t})\n\n\t\t\t\tthis.stateInitializer.runImmediateUserInitialization(newEntity, initialize)\n\n\t\t\t\t// The act of creating the entity doesn't constitute a change unless there's something inside to persist.\n\t\t\t\t// TODO forceCreate\n\t\t\t\t// TODO defaultValue\n\t\t\t\tthis.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\t\t\treturn id\n\t\t})\n\t}\n\n\tpublic getChildEntityById(state: EntityListState, id: EntityId) {\n\t\tconst realm = state.children.get(id)\n\t\tif (realm === undefined) {\n\t\t\tconst isRuntimeId = typeof id === 'number' || uuidValidate(id) || UnpersistedEntityDummyId.matchesDummyId(id)\n\t\t\tif (isRuntimeId) {\n\t\t\t\tthrow new BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`)\n\t\t\t}\n\t\t\tconst looksLikeKey = typeof id === 'string' && (this.treeStore.entityRealmStore.has(id) || RealmKeyGenerator.vaguelyAppearsToBeAKey(id))\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityList: cannot retrieve an entity with id '${id}' because it's not a valid id.` +\n\t\t\t\t\t(looksLikeKey\n\t\t\t\t\t\t? `\\nThe supplied value appears to be an entity *key*, not an *id*. List accessors are indexed by ids ` +\n\t\t\t\t\t\t `and you can use \\`EntityAccessor.id\\` to obtain one. Keys, on the other hand, are globally unique and ` +\n\t\t\t\t\t\t `you can use \\`getEntityByKey\\` to get its EntityAccessor.`\n\t\t\t\t\t\t: ''),\n\t\t\t)\n\t\t}\n\t\treturn realm.getAccessor()\n\t}\n}\n"],"names":["uuidValidate"],"mappings":";;;;;;;;;;;;AAeO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"ListOperations.js","sources":["../../../../src/core/operations/ListOperations.ts"],"sourcesContent":["import { validate as uuidValidate } from 'uuid'\nimport type { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, ErrorAccessor } from '../../accessors'\nimport { RuntimeId, UnpersistedEntityDummyId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport type { AccessorErrorManager } from '../AccessorErrorManager'\nimport { EventManager } from '../EventManager'\nimport { ErrorLocator, LocalizedBindingError } from '../exceptions'\nimport { MarkerComparator } from '../MarkerComparator'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator'\nimport { EntityListState, getEntityMarker, StateIterator } from '../state'\nimport type { StateInitializer } from '../StateInitializer'\nimport type { TreeStore } from '../TreeStore'\nimport { OperationsHelpers } from './OperationsHelpers'\nimport { EntityId, EventListenersStore } from '../../treeParameters'\n\nexport class ListOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(listState: EntityListState, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(listState, error)\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityListAccessor.RuntimeEntityListEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityListAccessor.RuntimeEntityListEventListenerMap[Type],\n\t) {\n\t\tif (state.eventListeners === undefined) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic addChildEventListener<Type extends keyof EntityAccessor.EntityEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t) {\n\t\tif (state.childEventListeners === undefined) {\n\t\t\tstate.childEventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.childEventListeners.add(event, listener)\n\t}\n\n\tpublic batchUpdates(state: EntityListState, performUpdates: EntityListAccessor.BatchUpdatesHandler) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tperformUpdates(state.getAccessor, this.batchUpdatesOptions)\n\t\t})\n\t}\n\n\tpublic connectEntity(outerState: EntityListState, entityToConnect: EntityAccessor) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(outerState)\n\t\t\tconst stateToConnect = OperationsHelpers.resolveAndPrepareEntityToConnect(this.treeStore, entityToConnect)\n\t\t\tconst idToConnect = stateToConnect.entity.id\n\n\t\t\t// TODO disable this at the top-level.\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tif (state.entityName !== stateToConnect.entity.entityName) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`EntityListAccessor.connectEntity: Attempting to connect at an entity of type ` +\n\t\t\t\t\t\t\t`'${stateToConnect.entity.entityName}' but '${state.entityName}' is expected.\\n\\n` +\n\t\t\t\t\t\t\t`Entity located at: ${ErrorLocator.locateInternalState(outerState)}.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tMarkerComparator.assertEntityMarkersSubsetOf(\n\t\t\t\t\t\tstate.blueprint.marker.fields,\n\t\t\t\t\t\tgetEntityMarker(stateToConnect).fields,\n\t\t\t\t\t)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof LocalizedBindingError) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Entity list: cannot connect entity with key '${entityToConnect.key}' because its fields are ` +\n\t\t\t\t\t\t\t\t`incompatible with entities found on this list. Make sure both trees are equivalent.\\n\\n` +\n\t\t\t\t\t\t\t\t`${error.message}\\n\\n` +\n\t\t\t\t\t\t\t\t(error.markerPath.length > 1\n\t\t\t\t\t\t\t\t\t? `Incompatibility found at: ${ErrorLocator.locateMarkerPath(error.markerPath)}.\\n\\n`\n\t\t\t\t\t\t\t\t\t: '') +\n\t\t\t\t\t\t\t\t`Entity list located at: ${ErrorLocator.locateInternalState(state)}.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\n\t\t\t\tif (state.children.has(idToConnect.value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.stateInitializer.initializeEntityRealm(idToConnect, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t}, stateToConnect)\n\n\t\t\t\tstate.plannedRemovals?.delete(idToConnect.value)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(idToConnect.value)) {\n\t\t\t\t\t// It was removed from the list but now we're adding it back.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t} else if (idToConnect.existsOnServer) {\n\t\t\t\t\t// ignoring unpersisted entities\n\t\t\t\t\tchangesDelta++\n\t\t\t\t}\n\t\t\t\tif (stateToConnect.type === 'entityRealm') {\n\t\t\t\t\tchangesDelta += stateToConnect.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic disconnectEntity(listState: EntityListState, childEntity: EntityAccessor, options: {noPersist?: boolean}) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\t// TODO disable this at the top-level.\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(listState)\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, listState)) {\n\t\t\t\tconst disconnectedChildIdValue = childEntity.id\n\t\t\t\tconst disconnectedChildRealm = state.children.get(disconnectedChildIdValue)\n\n\t\t\t\tif (disconnectedChildRealm === undefined) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Entity list doesn't include an entity with id '${disconnectedChildIdValue}' and so it cannot remove it.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tthis.treeStore.disposeOfRealm(disconnectedChildRealm)\n\t\t\t\tlistState.children.delete(disconnectedChildIdValue)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(disconnectedChildIdValue)) {\n\t\t\t\t\tchangesDelta++\n\n\t\t\t\t\tif (state.plannedRemovals === undefined) {\n\t\t\t\t\t\tstate.plannedRemovals = new Map()\n\t\t\t\t\t}\n\t\t\t\t\tif (!options.noPersist) {\n\t\t\t\t\t\tstate.plannedRemovals.set(disconnectedChildIdValue, 'disconnect')\n\t\t\t\t\t}\n\t\t\t\t} else if (disconnectedChildRealm.entity.id.existsOnServer) {\n\t\t\t\t\t// Disconnecting unpersisted entities doesn't constitute a change.\n\n\t\t\t\t\t// It wasn't on the list, then it was, and now we're removing it again.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t}\n\n\t\t\t\tif (disconnectedChildRealm.type === 'entityRealm') {\n\t\t\t\t\t// Undoing whatever changes this child had caused.\n\t\t\t\t\tchangesDelta -= disconnectedChildRealm.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic createNewEntity(outerState: EntityListState, initialize: EntityAccessor.BatchUpdatesHandler | undefined): RuntimeId {\n\t\treturn this.eventManager.syncOperation((): RuntimeId => {\n\t\t\t// All siblings need to have the same id.\n\t\t\tconst id = new UnpersistedEntityDummyId()\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tconst newEntity = this.stateInitializer.initializeEntityRealm(id, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t})\n\n\t\t\t\tthis.stateInitializer.runImmediateUserInitialization(newEntity, initialize)\n\n\t\t\t\t// The act of creating the entity doesn't constitute a change unless there's something inside to persist.\n\t\t\t\t// TODO forceCreate\n\t\t\t\t// TODO defaultValue\n\t\t\t\tthis.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\t\t\treturn id\n\t\t})\n\t}\n\n\tpublic getChildEntityById(state: EntityListState, id: EntityId) {\n\t\tconst realm = state.children.get(id)\n\t\tif (realm === undefined) {\n\t\t\tconst isRuntimeId = typeof id === 'number' || uuidValidate(id) || UnpersistedEntityDummyId.matchesDummyId(id)\n\t\t\tif (isRuntimeId) {\n\t\t\t\tthrow new BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`)\n\t\t\t}\n\t\t\tconst looksLikeKey = typeof id === 'string' && (this.treeStore.entityRealmStore.has(id) || RealmKeyGenerator.vaguelyAppearsToBeAKey(id))\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityList: cannot retrieve an entity with id '${id}' because it's not a valid id.` +\n\t\t\t\t\t(looksLikeKey\n\t\t\t\t\t\t? `\\nThe supplied value appears to be an entity *key*, not an *id*. List accessors are indexed by ids ` +\n\t\t\t\t\t\t `and you can use \\`EntityAccessor.id\\` to obtain one. Keys, on the other hand, are globally unique and ` +\n\t\t\t\t\t\t `you can use \\`getEntityByKey\\` to get its EntityAccessor.`\n\t\t\t\t\t\t: ''),\n\t\t\t)\n\t\t}\n\t\treturn realm.getAccessor()\n\t}\n}\n"],"names":["uuidValidate"],"mappings":";;;;;;;;;;;;AAeO,MAAM,eAAe;AAAA,EACpB,YACW,sBACA,qBACA,cACA,kBACA,WAChB;AALgB,SAAA,uBAAA;AACA,SAAA,sBAAA;AACA,SAAA,eAAA;AACA,SAAA,mBAAA;AACA,SAAA,YAAA;AAAA,EACf;AAAA,EAEI,SAAS,WAA4B,OAAwC;AACnF,WAAO,KAAK,qBAAqB,SAAS,WAAW,KAAK;AAAA,EAC3D;AAAA,EAEO,iBACN,OACA,OACA,UACC;AACG,QAAA,M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AgB,uBAAuB;AAAA,QACxC;AAEK,aAAA,aAAa,oBAAoB,OAAO,YAAY;AAAA,MAC1D;AAAA,IAAA,CACA;AAAA,EACF;AAAA,EAEO,gBAAgB,YAA6B,YAAuE;AACnH,WAAA,KAAK,aAAa,cAAc,MAAiB;AAEjD,YAAA,KAAK,IAAI;AAEf,iBAAW,SAAS,cAAc,sBAAsB,KAAK,WAAW,UAAU,GAAG;AACpF,cAAM,YAAY,KAAK,iBAAiB,sBAAsB,IAAI,MAAM,YAAY;AAAA,UACnF,MAAM;AAAA,UACN,QAAQ;AAAA,QAAA,CACR;AAEI,aAAA,iBAAiB,+BAA+B,WAAW,UAAU;AAK1E,aAAK,aAAa,oBAAoB,OAAO,aAAa,qBAAqB;AAAA,MAChF;AACO,aAAA;AAAA,IAAA,CACP;AAAA,EACF;AAAA,EAEO,mBAAmB,OAAwB,IAAc;AAC/D,UAAM,QAAQ,MAAM,SAAS,IAAI,EAAE;AACnC,QAAI,UAAU,QAAW;AAClB,YAAA,cAAc,OAAO,OAAO,YAAYA,SAAa,EAAE,KAAK,yBAAyB,eAAe,EAAE;AAC5G,UAAI,aAAa;AAChB,cAAM,IAAI,aAAa,kDAAkD,EAAE,6BAA6B;AAAA,MACzG;AACA,YAAM,eAAe,OAAO,OAAO,aAAa,KAAK,UAAU,iBAAiB,IAAI,EAAE,KAAK,kBAAkB,uBAAuB,EAAE;AACtI,YAAM,IAAI;AAAA,QACT,kDAAkD,EAAE,oCAClD,eACE;AAAA,oQAGA;AAAA,MAAA;AAAA,IAEN;AACA,WAAO,MAAM;EACd;AACD;"}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const BindingError = require("../../BindingError.cjs");
4
+ const bindingTypes = require("../../bindingTypes.cjs");
5
+ const EventManager = require("../EventManager.cjs");
6
+ const RealmKeyGenerator = require("../RealmKeyGenerator.cjs");
7
+ class OperationsHelpers {
8
+ static rejectInvalidAccessorTree() {
9
+ throw new BindingError.BindingError(
10
+ `The accessor tree does not correspond to the MarkerTree. This should absolutely never happen.`
11
+ );
12
+ }
13
+ static resolveAndPrepareEntityToConnect(treeStore, entityToConnect) {
14
+ const entityToConnectKey = entityToConnect.key;
15
+ const stateToConnect = treeStore.entityRealmStore.get(entityToConnectKey);
16
+ if (stateToConnect === void 0) {
17
+ throw new BindingError.BindingError(`Attempting to connect an entity with key '${entityToConnectKey}' but it doesn't exist.`);
18
+ }
19
+ return stateToConnect;
20
+ }
21
+ static changeEntityId(treeStore, eventManager, stateInitializer, entity, newId) {
22
+ const previousId = entity.id;
23
+ treeStore.entityStore.delete(previousId.uniqueValue);
24
+ treeStore.entityStore.set(newId.uniqueValue, entity);
25
+ let counter = 0;
26
+ for (const realm of entity.realms.values()) {
27
+ this.changeRealmId(treeStore, eventManager, stateInitializer, realm, newId);
28
+ if (++counter === entity.realms.size) {
29
+ break;
30
+ }
31
+ }
32
+ entity.hasIdSetInStone = true;
33
+ entity.id = newId;
34
+ }
35
+ static changeRealmId(treeStore, eventManager, stateInitializer, realm, newId) {
36
+ const oldEntity = realm.entity;
37
+ const oldRealmKey = realm.realmKey;
38
+ const oldId = oldEntity.id;
39
+ const realmBlueprint = realm.blueprint;
40
+ const newEntity = stateInitializer.initializeEntityState(newId, oldEntity.entityName);
41
+ const newRealmKey = RealmKeyGenerator.RealmKeyGenerator.getRealmKey(newId, realmBlueprint);
42
+ realm.realmKey = newRealmKey;
43
+ realm.entity = newEntity;
44
+ newEntity.id = newId;
45
+ oldEntity.realms.delete(oldRealmKey);
46
+ newEntity.realms.set(newRealmKey, realm);
47
+ if (realm.type === "entityRealm") {
48
+ const childIdState = realm.children.get(bindingTypes.PRIMARY_KEY_NAME);
49
+ if (childIdState?.type === "field") {
50
+ childIdState.value = newId.value;
51
+ eventManager.registerJustUpdated(childIdState, EventManager.EventManager.NO_CHANGES_DIFFERENCE);
52
+ }
53
+ this.purgeStaleListenersAfterIdChange(realm);
54
+ }
55
+ if (oldEntity.realms.size === 0) {
56
+ treeStore.disposeOfEntity(oldEntity);
57
+ }
58
+ treeStore.entityRealmStore.delete(oldRealmKey);
59
+ treeStore.entityRealmStore.set(newRealmKey, realm);
60
+ if (realmBlueprint.type === "listEntity") {
61
+ const list = realmBlueprint.parent;
62
+ list.children.changeKey(oldId.value, newId.value);
63
+ } else if (realmBlueprint.type === "hasOne") {
64
+ eventManager.registerUpdatedConnection(realmBlueprint.parent, realmBlueprint.marker.placeholderName);
65
+ }
66
+ const parent = realmBlueprint.parent;
67
+ if (parent) {
68
+ eventManager.registerJustUpdated(parent, EventManager.EventManager.NO_CHANGES_DIFFERENCE);
69
+ }
70
+ if (realm.type === "entityRealm") {
71
+ eventManager.registerJustUpdated(realm, EventManager.EventManager.NO_CHANGES_DIFFERENCE);
72
+ }
73
+ }
74
+ static purgeStaleListenersAfterIdChange(realm) {
75
+ const listeners = realm.eventListeners;
76
+ if (listeners) {
77
+ if (realm.blueprint.parent) {
78
+ listeners.delete({ type: "update" });
79
+ }
80
+ listeners.deleteByType("connectionUpdate");
81
+ }
82
+ }
83
+ }
84
+ exports.OperationsHelpers = OperationsHelpers;
85
+ //# sourceMappingURL=OperationsHelpers.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OperationsHelpers.cjs","sources":["../../../../src/core/operations/OperationsHelpers.ts"],"sourcesContent":["import type { EntityAccessor } from '../../accessors'\nimport type { RuntimeId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport { PRIMARY_KEY_NAME } from '../../bindingTypes'\nimport { EventManager } from '../EventManager'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator'\nimport type { EntityRealmState, EntityRealmStateStub, EntityState } from '../state'\nimport type { StateInitializer } from '../StateInitializer'\nimport type { TreeStore } from '../TreeStore'\n\nexport class OperationsHelpers {\n\tpublic static rejectInvalidAccessorTree(): never {\n\t\tthrow new BindingError(\n\t\t\t`The accessor tree does not correspond to the MarkerTree. This should absolutely never happen.`,\n\t\t)\n\t}\n\n\tpublic static resolveAndPrepareEntityToConnect(\n\t\ttreeStore: TreeStore,\n\t\tentityToConnect: EntityAccessor,\n\t): EntityRealmState | EntityRealmStateStub {\n\t\tconst entityToConnectKey = entityToConnect.key\n\t\tconst stateToConnect = treeStore.entityRealmStore.get(entityToConnectKey)\n\n\t\tif (stateToConnect === undefined) {\n\t\t\tthrow new BindingError(`Attempting to connect an entity with key '${entityToConnectKey}' but it doesn't exist.`)\n\t\t}\n\t\t// TODO This is commented out for now in order to at least somewhat mitigate the limitations of dealing with\n\t\t//\t\tinverse relations. However, once that has been addressed systemically, this code needs to be re-enabled.\n\t\t// if (!stateToConnect.entity.id.existsOnServer) {\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Attempting to connect an entity with key '${stateToConnect.realmKey}' that ` +\n\t\t// \t\t\t`doesn't exist on server. That is currently impossible.`, // At least for now.\n\t\t// \t)\n\t\t// }\n\n\t\t// TODO\n\t\t// if (stateToConnect.entity.isScheduledForDeletion) {\n\t\t// \t// As far as the other realms are concerned, this entity is deleted. We don't want to just make it re-appear\n\t\t// \t// for them just because some other random relation decided to connect it.\n\t\t// \tstateToConnect.entity.realms.clear()\n\t\t// \tstateToConnect.entity.isScheduledForDeletion = false\n\t\t// }\n\n\t\treturn stateToConnect\n\t}\n\n\tpublic static changeEntityId(\n\t\ttreeStore: TreeStore,\n\t\teventManager: EventManager,\n\t\tstateInitializer: StateInitializer,\n\t\tentity: EntityState,\n\t\tnewId: RuntimeId,\n\t) {\n\t\tconst previousId = entity.id\n\n\t\ttreeStore.entityStore.delete(previousId.uniqueValue)\n\t\ttreeStore.entityStore.set(newId.uniqueValue, entity)\n\n\t\tlet counter = 0\n\t\tfor (const realm of entity.realms.values()) {\n\t\t\tthis.changeRealmId(treeStore, eventManager, stateInitializer, realm, newId)\n\n\t\t\tif (++counter === entity.realms.size) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tentity.hasIdSetInStone = true\n\t\tentity.id = newId\n\t}\n\n\tpublic static changeRealmId(\n\t\ttreeStore: TreeStore,\n\t\teventManager: EventManager,\n\t\tstateInitializer: StateInitializer,\n\t\trealm: EntityRealmState | EntityRealmStateStub,\n\t\tnewId: RuntimeId,\n\t) {\n\t\tconst oldEntity = realm.entity\n\t\tconst oldRealmKey = realm.realmKey\n\t\tconst oldId = oldEntity.id\n\n\t\tconst realmBlueprint = realm.blueprint\n\n\t\tconst newEntity = stateInitializer.initializeEntityState(newId, oldEntity.entityName)\n\t\tconst newRealmKey = RealmKeyGenerator.getRealmKey(newId, realmBlueprint)\n\n\t\trealm.realmKey = newRealmKey\n\t\trealm.entity = newEntity\n\n\t\t// This may still actually be necessary if we're going from a client to server generated uuid.\n\t\t// They both may have the same value but still be different.\n\t\tnewEntity.id = newId\n\t\toldEntity.realms.delete(oldRealmKey)\n\t\tnewEntity.realms.set(newRealmKey, realm)\n\n\t\tif (realm.type === 'entityRealm') {\n\t\t\tconst childIdState = realm.children.get(PRIMARY_KEY_NAME)\n\t\t\tif (childIdState?.type === 'field') {\n\t\t\t\tchildIdState.value = newId.value\n\t\t\t\teventManager.registerJustUpdated(childIdState, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\n\t\t\tthis.purgeStaleListenersAfterIdChange(realm)\n\t\t}\n\n\t\tif (oldEntity.realms.size === 0) {\n\t\t\ttreeStore.disposeOfEntity(oldEntity)\n\t\t}\n\n\t\ttreeStore.entityRealmStore.delete(oldRealmKey)\n\t\ttreeStore.entityRealmStore.set(newRealmKey, realm)\n\n\t\tif (realmBlueprint.type === 'listEntity') {\n\t\t\tconst list = realmBlueprint.parent\n\t\t\tlist.children.changeKey(oldId.value, newId.value) // 😎\n\t\t} else if (realmBlueprint.type === 'hasOne') {\n\t\t\teventManager.registerUpdatedConnection(realmBlueprint.parent, realmBlueprint.marker.placeholderName)\n\t\t}\n\t\tconst parent = realmBlueprint.parent\n\t\tif (parent) {\n\t\t\teventManager.registerJustUpdated(parent, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t}\n\t\tif (realm.type === 'entityRealm') {\n\t\t\teventManager.registerJustUpdated(realm, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t}\n\t}\n\n\tpublic static purgeStaleListenersAfterIdChange(realm: EntityRealmState) {\n\t\t// Version 1.\n\t\t// The listeners subscribed to a particular entity key so we no longer want to call these.\n\t\t// The only positionally associated listeners are in the blueprint so we re-initialize those.\n\t\t//realm.eventListeners = stateInitializer.initializeEntityEventListenerStore(realmBlueprint)\n\n\t\t// Version 2.\n\t\t// This is version two of this terrible hack. We want to preserve e.g. persistSuccess handlers.\n\n\t\t// Version 3.\n\t\t// The saga continues. We add a condition to exempt top-level realms. That way they can start\n\t\t// propagating changes from the top.\n\t\tconst listeners = realm.eventListeners\n\t\tif (listeners) {\n\t\t\tif (realm.blueprint.parent) {\n\t\t\t\tlisteners.delete({ type: 'update' })\n\t\t\t}\n\t\t\tlisteners.deleteByType('connectionUpdate')\n\t\t}\n\t}\n}\n"],"names":["BindingError","RealmKeyGenerator","PRIMARY_KEY_NAME","EventManager"],"mappings":";;;;;;AAUO,MAAM,kBAAkB;AAAA,EAC9B,OAAc,4BAAmC;AAChD,UAAM,IAAIA,aAAA;AAAA,MACT;AAAA,IAAA;AAAA,EAEF;AAAA,EAEA,OAAc,iCACb,WACA,iBAC0C;AAC1C,UAAM,qBAAqB,gBAAgB;AAC3C,UAAM,iBAAiB,UAAU,iBAAiB,IAAI,kBAAkB;AAExE,QAAI,mBAAmB,QAAW;AACjC,YAAM,IAAIA,aAAA,aAAa,6CAA6C,kBAAkB,yBAAyB;AAAA,IAChH;AAkBO,WAAA;AAAA,EACR;AAAA,EAEA,OAAc,eACb,WACA,cACA,kBACA,QACA,OACC;AACD,UAAM,aAAa,OAAO;AAEhB,cAAA,YAAY,OAAO,WAAW,WAAW;AACnD,cAAU,YAAY,IAAI,MAAM,aAAa,MAAM;AAEnD,QAAI,UAAU;AACd,eAAW,SAAS,OAAO,OAAO,OAA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qBAAqB;AAAA,IAC5E;AACI,QAAA,MAAM,SAAS,eAAe;AACpB,mBAAA,oBAAoB,OAAOA,aAAA,aAAa,qBAAqB;AAAA,IAC3E;AAAA,EACD;AAAA,EAEA,OAAc,iCAAiC,OAAyB;AAYvE,UAAM,YAAY,MAAM;AACxB,QAAI,WAAW;AACV,UAAA,MAAM,UAAU,QAAQ;AAC3B,kBAAU,OAAO,EAAE,MAAM,SAAU,CAAA;AAAA,MACpC;AACA,gBAAU,aAAa,kBAAkB;AAAA,IAC1C;AAAA,EACD;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"OperationsHelpers.js","sources":["../../../../src/core/operations/OperationsHelpers.ts"],"sourcesContent":["import type { EntityAccessor } from '../../accessors'\nimport type { RuntimeId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport { PRIMARY_KEY_NAME } from '../../bindingTypes'\nimport { EventManager } from '../EventManager'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator'\nimport type { EntityRealmState, EntityRealmStateStub, EntityState } from '../state'\nimport type { StateInitializer } from '../StateInitializer'\nimport type { TreeStore } from '../TreeStore'\n\nexport class OperationsHelpers {\n\tpublic static rejectInvalidAccessorTree(): never {\n\t\tthrow new BindingError(\n\t\t\t`The accessor tree does not correspond to the MarkerTree. This should absolutely never happen.`,\n\t\t)\n\t}\n\n\tpublic static resolveAndPrepareEntityToConnect(\n\t\ttreeStore: TreeStore,\n\t\tentityToConnect: EntityAccessor,\n\t): EntityRealmState | EntityRealmStateStub {\n\t\tconst entityToConnectKey = entityToConnect.key\n\t\tconst stateToConnect = treeStore.entityRealmStore.get(entityToConnectKey)\n\n\t\tif (stateToConnect === undefined) {\n\t\t\tthrow new BindingError(`Attempting to connect an entity with key '${entityToConnectKey}' but it doesn't exist.`)\n\t\t}\n\t\t// TODO This is commented out for now in order to at least somewhat mitigate the limitations of dealing with\n\t\t//\t\tinverse relations. However, once that has been addressed systemically, this code needs to be re-enabled.\n\t\t// if (!stateToConnect.entity.id.existsOnServer) {\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Attempting to connect an entity with key '${stateToConnect.realmKey}' that ` +\n\t\t// \t\t\t`doesn't exist on server. That is currently impossible.`, // At least for now.\n\t\t// \t)\n\t\t// }\n\n\t\t// TODO\n\t\t// if (stateToConnect.entity.isScheduledForDeletion) {\n\t\t// \t// As far as the other realms are concerned, this entity is deleted. We don't want to just make it re-appear\n\t\t// \t// for them just because some other random relation decided to connect it.\n\t\t// \tstateToConnect.entity.realms.clear()\n\t\t// \tstateToConnect.entity.isScheduledForDeletion = false\n\t\t// }\n\n\t\treturn stateToConnect\n\t}\n\n\tpublic static changeEntityId(\n\t\ttreeStore: TreeStore,\n\t\teventManager: EventManager,\n\t\tstateInitializer: StateInitializer,\n\t\tentity: EntityState,\n\t\tnewId: RuntimeId,\n\t) {\n\t\tconst previousId = entity.id\n\n\t\ttreeStore.entityStore.delete(previousId.uniqueValue)\n\t\ttreeStore.entityStore.set(newId.uniqueValue, entity)\n\n\t\tlet counter = 0\n\t\tfor (const realm of entity.realms.values()) {\n\t\t\tthis.changeRealmId(treeStore, eventManager, stateInitializer, realm, newId)\n\n\t\t\tif (++counter === entity.realms.size) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tentity.hasIdSetInStone = true\n\t\tentity.id = newId\n\t}\n\n\tpublic static changeRealmId(\n\t\ttreeStore: TreeStore,\n\t\teventManager: EventManager,\n\t\tstateInitializer: StateInitializer,\n\t\trealm: EntityRealmState | EntityRealmStateStub,\n\t\tnewId: RuntimeId,\n\t) {\n\t\tconst oldEntity = realm.entity\n\t\tconst oldRealmKey = realm.realmKey\n\t\tconst oldId = oldEntity.id\n\n\t\tconst realmBlueprint = realm.blueprint\n\n\t\tconst newEntity = stateInitializer.initializeEntityState(newId, oldEntity.entityName)\n\t\tconst newRealmKey = RealmKeyGenerator.getRealmKey(newId, realmBlueprint)\n\n\t\trealm.realmKey = newRealmKey\n\t\trealm.entity = newEntity\n\n\t\t// This may still actually be necessary if we're going from a client to server generated uuid.\n\t\t// They both may have the same value but still be different.\n\t\tnewEntity.id = newId\n\t\toldEntity.realms.delete(oldRealmKey)\n\t\tnewEntity.realms.set(newRealmKey, realm)\n\n\t\tif (realm.type === 'entityRealm') {\n\t\t\tconst childIdState = realm.children.get(PRIMARY_KEY_NAME)\n\t\t\tif (childIdState?.type === 'field') {\n\t\t\t\tchildIdState.value = newId.value\n\t\t\t\teventManager.registerJustUpdated(childIdState, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\n\t\t\tthis.purgeStaleListenersAfterIdChange(realm)\n\t\t}\n\n\t\tif (oldEntity.realms.size === 0) {\n\t\t\ttreeStore.disposeOfEntity(oldEntity)\n\t\t}\n\n\t\ttreeStore.entityRealmStore.delete(oldRealmKey)\n\t\ttreeStore.entityRealmStore.set(newRealmKey, realm)\n\n\t\tif (realmBlueprint.type === 'listEntity') {\n\t\t\tconst list = realmBlueprint.parent\n\t\t\tlist.children.changeKey(oldId.value, newId.value) // 😎\n\t\t} else if (realmBlueprint.type === 'hasOne') {\n\t\t\teventManager.registerUpdatedConnection(realmBlueprint.parent, realmBlueprint.marker.placeholderName)\n\t\t}\n\t\tconst parent = realmBlueprint.parent\n\t\tif (parent) {\n\t\t\teventManager.registerJustUpdated(parent, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t}\n\t\tif (realm.type === 'entityRealm') {\n\t\t\teventManager.registerJustUpdated(realm, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t}\n\t}\n\n\tpublic static purgeStaleListenersAfterIdChange(realm: EntityRealmState) {\n\t\t// Version 1.\n\t\t// The listeners subscribed to a particular entity key so we no longer want to call these.\n\t\t// The only positionally associated listeners are in the blueprint so we re-initialize those.\n\t\t//realm.eventListeners = stateInitializer.initializeEntityEventListenerStore(realmBlueprint)\n\n\t\t// Version 2.\n\t\t// This is version two of this terrible hack. We want to preserve e.g. persistSuccess handlers.\n\n\t\t// Version 3.\n\t\t// The saga continues. We add a condition to exempt top-level realms. That way they can start\n\t\t// propagating changes from the top.\n\t\tconst listeners = realm.eventListeners\n\t\tif (listeners) {\n\t\t\tif (realm.blueprint.parent) {\n\t\t\t\tlisteners.delete({ type: 'update' })\n\t\t\t}\n\t\t\tlisteners.deleteByType('connectionUpdate')\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;AAUO,MAAM,kBAAkB;AAAA,EAC9B,OAAc,4BAAmC;AAChD,UAAM,IAAI;AAAA,MACT;AAAA,IAAA;AAAA,EAEF;AAAA,EAEA,OAAc,iCACb,WACA,iBAC0C;AAC1C,UAAM,qBAAqB,gBAAgB;AAC3C,UAAM,iBAAiB,UAAU,iBAAiB,IAAI,kBAAkB;AAExE,QAAI,mBAAmB,QAAW;AAC3B,YAAA,IAAI,aAAa,6CAA6C,2CAA2C;AAAA,IAChH;AAkBO,WAAA;AAAA,EACR;AAAA,EAEA,OAAc,eACb,WACA,cACA,kBACA,QACA,OACC;AACD,UAAM,aAAa,OAAO;AAEhB,cAAA,YAAY,OAAO,WAAW,WAAW;AACnD,cAAU,YAAY,IAAI,MAAM,aAAa,MAAM;AAEnD,QAAI,UAAU;AACd,eAAW,SAAS,OAAO,OAAO,OAAA,GAAU;AAC3C,WAAK,cAAc,WAAW,cAAc,kBAAkB,OAAO,KAAK;AAE1E,UAAI,EAAE,YAAY,OAAO,OAAO,MAAM;AACrC;AAAA,MACD;AAAA,IACD;AAEA,WAAO,kBAAkB;AACzB,WAAO,KAAK;AAAA,EACb;AAAA,EAEA,OAAc,cACb,WACA,cACA,kBACA,OACA,OACC;AACD,UAAM,YAAY,MAAM;AACxB,UAAM,cAAc,MAAM;AAC1B,UAAM,QAAQ,UAAU;AAExB,UAAM,iBAAiB,MAAM;AAE7B,UAAM,YAAY,iBAAiB,sBAAsB,OAAO,UAAU,UAAU;AACpF,UAAM,cAAc,kBAAkB,YAAY,OAAO,cAAc;AAEvE,UAAM,WAAW;AACjB,UAAM,SAAS;AAIf,cAAU,KAAK;AACL,cAAA,OAAO,OAAO,WAAW;AACzB,cAAA,OAAO,IAAI,aAAa,KAAK;AAEnC,QAAA,MAAM,SAAS,eAAe;AACjC,YAAM,eAAe,MAAM,SAAS,IAAI,gBAAgB;AACpD,UAAA,cAAc,SAAS,SAAS;AACnC,qBAAa,QAAQ,MAAM;AACd,qBAAA,oBAAoB,cAAc,aAAa,qBAAqB;AAAA,MAClF;AAEA,WAAK,iCAAiC,KAAK;AAAA,IAC5C;AAEI,QAAA,UAAU,OAAO,SAAS,GAAG;AAChC,gBAAU,gBAAgB,SAAS;AAAA,IACpC;AAEU,cAAA,iBAAiB,OAAO,WAAW;AACnC,cAAA,iBAAiB,IAAI,aAAa,KAAK;AAE7C,QAAA,eAAe,SAAS,cAAc;AACzC,YAAM,OAAO,eAAe;AAC5B,WAAK,SAAS,UAAU,MAAM,OAAO,MAAM,KAAK;AAAA,IAAA,WACtC,eAAe,SAAS,UAAU;AAC5C,mBAAa,0BAA0B,eAAe,QAAQ,eAAe,OAAO,eAAe;AAAA,IACpG;AACA,UAAM,SAAS,eAAe;AAC9B,QAAI,QAAQ;AACE,mBAAA,oBAAoB,QAAQ,aAAa,qBAAqB;AAAA,IAC5E;AACI,QAAA,MAAM,SAAS,eAAe;AACpB,mBAAA,oBAAoB,OAAO,aAAa,qBAAqB;AAAA,IAC3E;AAAA,EACD;AAAA,EAEA,OAAc,iCAAiC,OAAyB;AAYvE,UAAM,YAAY,MAAM;AACxB,QAAI,WAAW;AACV,UAAA,MAAM,UAAU,QAAQ;AAC3B,kBAAU,OAAO,EAAE,MAAM,SAAU,CAAA;AAAA,MACpC;AACA,gBAAU,aAAa,kBAAkB;AAAA,IAC1C;AAAA,EACD;AACD;"}
1
+ {"version":3,"file":"OperationsHelpers.js","sources":["../../../../src/core/operations/OperationsHelpers.ts"],"sourcesContent":["import type { EntityAccessor } from '../../accessors'\nimport type { RuntimeId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport { PRIMARY_KEY_NAME } from '../../bindingTypes'\nimport { EventManager } from '../EventManager'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator'\nimport type { EntityRealmState, EntityRealmStateStub, EntityState } from '../state'\nimport type { StateInitializer } from '../StateInitializer'\nimport type { TreeStore } from '../TreeStore'\n\nexport class OperationsHelpers {\n\tpublic static rejectInvalidAccessorTree(): never {\n\t\tthrow new BindingError(\n\t\t\t`The accessor tree does not correspond to the MarkerTree. This should absolutely never happen.`,\n\t\t)\n\t}\n\n\tpublic static resolveAndPrepareEntityToConnect(\n\t\ttreeStore: TreeStore,\n\t\tentityToConnect: EntityAccessor,\n\t): EntityRealmState | EntityRealmStateStub {\n\t\tconst entityToConnectKey = entityToConnect.key\n\t\tconst stateToConnect = treeStore.entityRealmStore.get(entityToConnectKey)\n\n\t\tif (stateToConnect === undefined) {\n\t\t\tthrow new BindingError(`Attempting to connect an entity with key '${entityToConnectKey}' but it doesn't exist.`)\n\t\t}\n\t\t// TODO This is commented out for now in order to at least somewhat mitigate the limitations of dealing with\n\t\t//\t\tinverse relations. However, once that has been addressed systemically, this code needs to be re-enabled.\n\t\t// if (!stateToConnect.entity.id.existsOnServer) {\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Attempting to connect an entity with key '${stateToConnect.realmKey}' that ` +\n\t\t// \t\t\t`doesn't exist on server. That is currently impossible.`, // At least for now.\n\t\t// \t)\n\t\t// }\n\n\t\t// TODO\n\t\t// if (stateToConnect.entity.isScheduledForDeletion) {\n\t\t// \t// As far as the other realms are concerned, this entity is deleted. We don't want to just make it re-appear\n\t\t// \t// for them just because some other random relation decided to connect it.\n\t\t// \tstateToConnect.entity.realms.clear()\n\t\t// \tstateToConnect.entity.isScheduledForDeletion = false\n\t\t// }\n\n\t\treturn stateToConnect\n\t}\n\n\tpublic static changeEntityId(\n\t\ttreeStore: TreeStore,\n\t\teventManager: EventManager,\n\t\tstateInitializer: StateInitializer,\n\t\tentity: EntityState,\n\t\tnewId: RuntimeId,\n\t) {\n\t\tconst previousId = entity.id\n\n\t\ttreeStore.entityStore.delete(previousId.uniqueValue)\n\t\ttreeStore.entityStore.set(newId.uniqueValue, entity)\n\n\t\tlet counter = 0\n\t\tfor (const realm of entity.realms.values()) {\n\t\t\tthis.changeRealmId(treeStore, eventManager, stateInitializer, realm, newId)\n\n\t\t\tif (++counter === entity.realms.size) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tentity.hasIdSetInStone = true\n\t\tentity.id = newId\n\t}\n\n\tpublic static changeRealmId(\n\t\ttreeStore: TreeStore,\n\t\teventManager: EventManager,\n\t\tstateInitializer: StateInitializer,\n\t\trealm: EntityRealmState | EntityRealmStateStub,\n\t\tnewId: RuntimeId,\n\t) {\n\t\tconst oldEntity = realm.entity\n\t\tconst oldRealmKey = realm.realmKey\n\t\tconst oldId = oldEntity.id\n\n\t\tconst realmBlueprint = realm.blueprint\n\n\t\tconst newEntity = stateInitializer.initializeEntityState(newId, oldEntity.entityName)\n\t\tconst newRealmKey = RealmKeyGenerator.getRealmKey(newId, realmBlueprint)\n\n\t\trealm.realmKey = newRealmKey\n\t\trealm.entity = newEntity\n\n\t\t// This may still actually be necessary if we're going from a client to server generated uuid.\n\t\t// They both may have the same value but still be different.\n\t\tnewEntity.id = newId\n\t\toldEntity.realms.delete(oldRealmKey)\n\t\tnewEntity.realms.set(newRealmKey, realm)\n\n\t\tif (realm.type === 'entityRealm') {\n\t\t\tconst childIdState = realm.children.get(PRIMARY_KEY_NAME)\n\t\t\tif (childIdState?.type === 'field') {\n\t\t\t\tchildIdState.value = newId.value\n\t\t\t\teventManager.registerJustUpdated(childIdState, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\n\t\t\tthis.purgeStaleListenersAfterIdChange(realm)\n\t\t}\n\n\t\tif (oldEntity.realms.size === 0) {\n\t\t\ttreeStore.disposeOfEntity(oldEntity)\n\t\t}\n\n\t\ttreeStore.entityRealmStore.delete(oldRealmKey)\n\t\ttreeStore.entityRealmStore.set(newRealmKey, realm)\n\n\t\tif (realmBlueprint.type === 'listEntity') {\n\t\t\tconst list = realmBlueprint.parent\n\t\t\tlist.children.changeKey(oldId.value, newId.value) // 😎\n\t\t} else if (realmBlueprint.type === 'hasOne') {\n\t\t\teventManager.registerUpdatedConnection(realmBlueprint.parent, realmBlueprint.marker.placeholderName)\n\t\t}\n\t\tconst parent = realmBlueprint.parent\n\t\tif (parent) {\n\t\t\teventManager.registerJustUpdated(parent, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t}\n\t\tif (realm.type === 'entityRealm') {\n\t\t\teventManager.registerJustUpdated(realm, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t}\n\t}\n\n\tpublic static purgeStaleListenersAfterIdChange(realm: EntityRealmState) {\n\t\t// Version 1.\n\t\t// The listeners subscribed to a particular entity key so we no longer want to call these.\n\t\t// The only positionally associated listeners are in the blueprint so we re-initialize those.\n\t\t//realm.eventListeners = stateInitializer.initializeEntityEventListenerStore(realmBlueprint)\n\n\t\t// Version 2.\n\t\t// This is version two of this terrible hack. We want to preserve e.g. persistSuccess handlers.\n\n\t\t// Version 3.\n\t\t// The saga continues. We add a condition to exempt top-level realms. That way they can start\n\t\t// propagating changes from the top.\n\t\tconst listeners = realm.eventListeners\n\t\tif (listeners) {\n\t\t\tif (realm.blueprint.parent) {\n\t\t\t\tlisteners.delete({ type: 'update' })\n\t\t\t}\n\t\t\tlisteners.deleteByType('connectionUpdate')\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;AAUO,MAAM,kBAAkB;AAAA,EAC9B,OAAc,4BAAmC;AAChD,UAAM,IAAI;AAAA,MACT;AAAA,IAAA;AAAA,EAEF;AAAA,EAEA,OAAc,iCACb,WACA,iBAC0C;AAC1C,UAAM,qBAAqB,gBAAgB;AAC3C,UAAM,iBAAiB,UAAU,iBAAiB,IAAI,kBAAkB;AAExE,QAAI,mBAAmB,QAAW;AACjC,YAAM,IAAI,aAAa,6CAA6C,kBAAkB,yBAAyB;AAAA,IACh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M,OAAO,MAAM,KAAK;AAAA,IAAA,WACtC,eAAe,SAAS,UAAU;AAC5C,mBAAa,0BAA0B,eAAe,QAAQ,eAAe,OAAO,eAAe;AAAA,IACpG;AACA,UAAM,SAAS,eAAe;AAC9B,QAAI,QAAQ;AACE,mBAAA,oBAAoB,QAAQ,aAAa,qBAAqB;AAAA,IAC5E;AACI,QAAA,MAAM,SAAS,eAAe;AACpB,mBAAA,oBAAoB,OAAO,aAAa,qBAAqB;AAAA,IAC3E;AAAA,EACD;AAAA,EAEA,OAAc,iCAAiC,OAAyB;AAYvE,UAAM,YAAY,MAAM;AACxB,QAAI,WAAW;AACV,UAAA,MAAM,UAAU,QAAQ;AAC3B,kBAAU,OAAO,EAAE,MAAM,SAAU,CAAA;AAAA,MACpC;AACA,gBAAU,aAAa,kBAAkB;AAAA,IAC1C;AAAA,EACD;AACD;"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ class MutationAlias {
4
+ static encodeEntityId(entityId) {
5
+ return `_${String(entityId.value).replace(/-/g, "_")}`;
6
+ }
7
+ static decodeEntityId(alias) {
8
+ const stringId = `${alias.substring(1).replace(/_/g, "-")}`;
9
+ const intId = parseInt(stringId);
10
+ return intId.toString() === stringId ? intId : stringId;
11
+ }
12
+ }
13
+ exports.MutationAlias = MutationAlias;
14
+ //# sourceMappingURL=MutationAlias.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MutationAlias.cjs","sources":["../../../../src/core/requestAliases/MutationAlias.ts"],"sourcesContent":["import type { RuntimeId } from '../../accessorTree'\n\nexport class MutationAlias {\n\tpublic static encodeEntityId(entityId: RuntimeId): string {\n\t\treturn `_${String(entityId.value).replace(/-/g, '_')}`\n\t}\n\n\tpublic static decodeEntityId(alias: string): RuntimeId['value'] {\n\t\tconst stringId = `${alias.substring(1).replace(/_/g, '-')}`\n\t\tconst intId = parseInt(stringId)\n\t\treturn intId.toString() === stringId ? intId : stringId\n\t}\n}\n"],"names":[],"mappings":";;AAEO,MAAM,cAAc;AAAA,EAC1B,OAAc,eAAe,UAA6B;AAClD,WAAA,IAAI,OAAO,SAAS,KAAK,EAAE,QAAQ,MAAM,GAAG,CAAC;AAAA,EACrD;AAAA,EAEA,OAAc,eAAe,OAAmC;AACzD,UAAA,WAAW,GAAG,MAAM,UAAU,CAAC,EAAE,QAAQ,MAAM,GAAG,CAAC;AACnD,UAAA,QAAQ,SAAS,QAAQ;AAC/B,WAAO,MAAM,SAAA,MAAe,WAAW,QAAQ;AAAA,EAChD;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MutationAlias.js","sources":["../../../../src/core/requestAliases/MutationAlias.ts"],"sourcesContent":["import type { RuntimeId } from '../../accessorTree'\n\nexport class MutationAlias {\n\tpublic static encodeEntityId(entityId: RuntimeId): string {\n\t\treturn `_${String(entityId.value).replace(/-/g, '_')}`\n\t}\n\n\tpublic static decodeEntityId(alias: string): RuntimeId['value'] {\n\t\tconst stringId = `${alias.substring(1).replace(/_/g, '-')}`\n\t\tconst intId = parseInt(stringId)\n\t\treturn intId.toString() === stringId ? intId : stringId\n\t}\n}\n"],"names":[],"mappings":"AAEO,MAAM,cAAc;AAAA,EAC1B,OAAc,eAAe,UAA6B;AACzD,WAAO,IAAI,OAAO,SAAS,KAAK,EAAE,QAAQ,MAAM,GAAG;AAAA,EACpD;AAAA,EAEA,OAAc,eAAe,OAAmC;AACzD,UAAA,WAAW,GAAG,MAAM,UAAU,CAAC,EAAE,QAAQ,MAAM,GAAG;AAClD,UAAA,QAAQ,SAAS,QAAQ;AAC/B,WAAO,MAAM,SAAA,MAAe,WAAW,QAAQ;AAAA,EAChD;AACD;"}
1
+ {"version":3,"file":"MutationAlias.js","sources":["../../../../src/core/requestAliases/MutationAlias.ts"],"sourcesContent":["import type { RuntimeId } from '../../accessorTree'\n\nexport class MutationAlias {\n\tpublic static encodeEntityId(entityId: RuntimeId): string {\n\t\treturn `_${String(entityId.value).replace(/-/g, '_')}`\n\t}\n\n\tpublic static decodeEntityId(alias: string): RuntimeId['value'] {\n\t\tconst stringId = `${alias.substring(1).replace(/_/g, '-')}`\n\t\tconst intId = parseInt(stringId)\n\t\treturn intId.toString() === stringId ? intId : stringId\n\t}\n}\n"],"names":[],"mappings":"AAEO,MAAM,cAAc;AAAA,EAC1B,OAAc,eAAe,UAA6B;AAClD,WAAA,IAAI,OAAO,SAAS,KAAK,EAAE,QAAQ,MAAM,GAAG,CAAC;AAAA,EACrD;AAAA,EAEA,OAAc,eAAe,OAAmC;AACzD,UAAA,WAAW,GAAG,MAAM,UAAU,CAAC,EAAE,QAAQ,MAAM,GAAG,CAAC;AACnD,UAAA,QAAQ,SAAS,QAAQ;AAC/B,WAAO,MAAM,SAAA,MAAe,WAAW,QAAQ;AAAA,EAChD;AACD;"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const BindingError = require("../../BindingError.cjs");
4
+ class Schema {
5
+ constructor(store) {
6
+ this.store = store;
7
+ }
8
+ getEnumValues(enumName) {
9
+ return Array.from(this.store.enums.get(enumName) ?? this.throwError(`Missing schema for enum ${enumName}`));
10
+ }
11
+ getEntityOrUndefined(entityName) {
12
+ return this.store.entities.get(entityName);
13
+ }
14
+ getEntityNames() {
15
+ return Array.from(this.store.entities.keys());
16
+ }
17
+ getEntity(entityName) {
18
+ return this.getEntityOrUndefined(entityName) ?? this.throwError(`Missing schema for entity ${entityName}`);
19
+ }
20
+ getEntityFieldOrUndefined(entityName, fieldName) {
21
+ return this.store.entities.get(entityName)?.fields.get(fieldName);
22
+ }
23
+ getEntityField(entityName, fieldName) {
24
+ return this.getEntityFieldOrUndefined(entityName, fieldName) ?? this.throwError(`Missing schema for field ${entityName}.${fieldName}`);
25
+ }
26
+ getEntityColumn(entityName, fieldName) {
27
+ const field = this.getEntityField(entityName, fieldName);
28
+ return field.__typename === "_Column" ? field : this.throwError(`Field ${entityName}.${fieldName} is not of type column`);
29
+ }
30
+ getEntityRelation(entityName, fieldName) {
31
+ const field = this.getEntityField(entityName, fieldName);
32
+ return field.__typename === "_Relation" ? field : this.throwError(`Field ${entityName}.${fieldName} is not of type relation`);
33
+ }
34
+ throwError(message) {
35
+ throw new BindingError.BindingError(message);
36
+ }
37
+ }
38
+ exports.Schema = Schema;
39
+ //# sourceMappingURL=Schema.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Schema.cjs","sources":["../../../../src/core/schema/Schema.ts"],"sourcesContent":["import type { EntityName, FieldName } from '../../treeParameters'\nimport { BindingError } from '../../BindingError'\nimport type { SchemaField } from './SchemaField'\nimport type { SchemaStore } from './SchemaStore'\nimport { SchemaEntity } from './SchemaEntity'\nimport { SchemaColumn } from './SchemaColumn'\nimport { SchemaRelation } from './SchemaRelation'\nimport { SchemaEnumName } from './SchemaEnums'\n\nexport class Schema {\n\tpublic constructor(private readonly store: SchemaStore) {}\n\n\tpublic getEnumValues(enumName: SchemaEnumName): string[] {\n\t\treturn Array.from(this.store.enums.get(enumName) ?? this.throwError(`Missing schema for enum ${enumName}`))\n\t}\n\n\tpublic getEntityOrUndefined(entityName: EntityName): SchemaEntity | undefined {\n\t\treturn this.store.entities.get(entityName)\n\t}\n\n\tpublic getEntityNames(): string[] {\n\t\treturn Array.from(this.store.entities.keys())\n\t}\n\n\tpublic getEntity(entityName: EntityName): SchemaEntity {\n\t\treturn this.getEntityOrUndefined(entityName) ?? this.throwError(`Missing schema for entity ${entityName}`)\n\t}\n\n\tpublic getEntityFieldOrUndefined(entityName: EntityName, fieldName: FieldName): SchemaField | undefined {\n\t\treturn this.store.entities.get(entityName)?.fields.get(fieldName)\n\t}\n\n\tpublic getEntityField(entityName: EntityName, fieldName: FieldName): SchemaField {\n\t\treturn this.getEntityFieldOrUndefined(entityName, fieldName) ?? this.throwError(`Missing schema for field ${entityName}.${fieldName}`)\n\t}\n\n\tpublic getEntityColumn(entityName: EntityName, fieldName: FieldName): SchemaColumn {\n\t\tconst field = this.getEntityField(entityName, fieldName)\n\t\treturn field.__typename === '_Column' ? field : this.throwError(`Field ${entityName}.${fieldName} is not of type column`)\n\t}\n\n\tpublic getEntityRelation(entityName: EntityName, fieldName: FieldName): SchemaRelation {\n\t\tconst field = this.getEntityField(entityName, fieldName)\n\t\treturn field.__typename === '_Relation' ? field : this.throwError(`Field ${entityName}.${fieldName} is not of type relation`)\n\t}\n\n\tprivate throwError(message: string): never {\n\t\tthrow new BindingError(message)\n\t}\n}\n"],"names":["BindingError"],"mappings":";;;AASO,MAAM,OAAO;AAAA,EACZ,YAA6B,OAAoB;AAApB,SAAA,QAAA;AAAA,EAAqB;AAAA,EAElD,cAAc,UAAoC;AACxD,WAAO,MAAM,KAAK,KAAK,MAAM,MAAM,IAAI,QAAQ,KAAK,KAAK,WAAW,2BAA2B,QAAQ,EAAE,CAAC;AAAA,EAC3G;AAAA,EAEO,qBAAqB,YAAkD;AAC7E,WAAO,KAAK,MAAM,SAAS,IAAI,UAAU;AAAA,EAC1C;AAAA,EAEO,iBAA2B;AACjC,WAAO,MAAM,KAAK,KAAK,MAAM,SAAS,MAAM;AAAA,EAC7C;AAAA,EAEO,UAAU,YAAsC;AAC/C,WAAA,KAAK,qBAAqB,UAAU,KAAK,KAAK,WAAW,6BAA6B,UAAU,EAAE;AAAA,EAC1G;AAAA,EAEO,0BAA0B,YAAwB,WAA+C;AAChG,WAAA,KAAK,MAAM,SAAS,IAAI,UAAU,GAAG,OAAO,IAAI,SAAS;AAAA,EACjE;AAAA,EAEO,eAAe,YAAwB,WAAmC;AACzE,WAAA,KAAK,0BAA0B,YAAY,SAAS,KAAK,KAAK,WAAW,4BAA4B,UAAU,IAAI,SAAS,EAAE;AAAA,EACtI;AAAA,EAEO,gBAAgB,YAAwB,WAAoC;AAClF,UAAM,QAAQ,KAAK,eAAe,YAAY,SAAS;AAChD,WAAA,MAAM,eAAe,YAAY,QAAQ,KAAK,WAAW,SAAS,UAAU,IAAI,SAAS,wBAAwB;AAAA,EACzH;AAAA,EAEO,kBAAkB,YAAwB,WAAsC;AACtF,UAAM,QAAQ,KAAK,eAAe,YAAY,SAAS;AAChD,WAAA,MAAM,eAAe,cAAc,QAAQ,KAAK,WAAW,SAAS,UAAU,IAAI,SAAS,0BAA0B;AAAA,EAC7H;AAAA,EAEQ,WAAW,SAAwB;AACpC,UAAA,IAAIA,aAAAA,aAAa,OAAO;AAAA,EAC/B;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Schema.js","sources":["../../../../src/core/schema/Schema.ts"],"sourcesContent":["import type { EntityName, FieldName } from '../../treeParameters'\nimport { BindingError } from '../../BindingError'\nimport type { SchemaField } from './SchemaField'\nimport type { SchemaStore } from './SchemaStore'\nimport { SchemaEntity } from './SchemaEntity'\nimport { SchemaColumn } from './SchemaColumn'\nimport { SchemaRelation } from './SchemaRelation'\nimport { SchemaEnumName } from './SchemaEnums'\n\nexport class Schema {\n\tpublic constructor(private readonly store: SchemaStore) {}\n\n\tpublic getEnumValues(enumName: SchemaEnumName): string[] {\n\t\treturn Array.from(this.store.enums.get(enumName) ?? this.throwError(`Missing schema for enum ${enumName}`))\n\t}\n\n\tpublic getEntityOrUndefined(entityName: EntityName): SchemaEntity | undefined {\n\t\treturn this.store.entities.get(entityName)\n\t}\n\n\tpublic getEntityNames(): string[] {\n\t\treturn Array.from(this.store.entities.keys())\n\t}\n\n\tpublic getEntity(entityName: EntityName): SchemaEntity {\n\t\treturn this.getEntityOrUndefined(entityName) ?? this.throwError(`Missing schema for entity ${entityName}`)\n\t}\n\n\tpublic getEntityFieldOrUndefined(entityName: EntityName, fieldName: FieldName): SchemaField | undefined {\n\t\treturn this.store.entities.get(entityName)?.fields.get(fieldName)\n\t}\n\n\tpublic getEntityField(entityName: EntityName, fieldName: FieldName): SchemaField {\n\t\treturn this.getEntityFieldOrUndefined(entityName, fieldName) ?? this.throwError(`Missing schema for field ${entityName}.${fieldName}`)\n\t}\n\n\tpublic getEntityColumn(entityName: EntityName, fieldName: FieldName): SchemaColumn {\n\t\tconst field = this.getEntityField(entityName, fieldName)\n\t\treturn field.__typename === '_Column' ? field : this.throwError(`Field ${entityName}.${fieldName} is not of type column`)\n\t}\n\n\tpublic getEntityRelation(entityName: EntityName, fieldName: FieldName): SchemaRelation {\n\t\tconst field = this.getEntityField(entityName, fieldName)\n\t\treturn field.__typename === '_Relation' ? field : this.throwError(`Field ${entityName}.${fieldName} is not of type relation`)\n\t}\n\n\tprivate throwError(message: string): never {\n\t\tthrow new BindingError(message)\n\t}\n}\n"],"names":[],"mappings":";AASO,MAAM,OAAO;AAAA,EACZ,YAA6B,OAAoB;AAApB,SAAA,QAAA;AAAA,EAAqB;AAAA,EAElD,cAAc,UAAoC;AACxD,WAAO,MAAM,KAAK,KAAK,MAAM,MAAM,IAAI,QAAQ,KAAK,KAAK,WAAW,2BAA2B,UAAU,CAAC;AAAA,EAC3G;AAAA,EAEO,qBAAqB,YAAkD;AAC7E,WAAO,KAAK,MAAM,SAAS,IAAI,UAAU;AAAA,EAC1C;AAAA,EAEO,iBAA2B;AACjC,WAAO,MAAM,KAAK,KAAK,MAAM,SAAS,MAAM;AAAA,EAC7C;AAAA,EAEO,UAAU,YAAsC;AACtD,WAAO,KAAK,qBAAqB,UAAU,KAAK,KAAK,WAAW,6BAA6B,YAAY;AAAA,EAC1G;AAAA,EAEO,0BAA0B,YAAwB,WAA+C;AAChG,WAAA,KAAK,MAAM,SAAS,IAAI,UAAU,GAAG,OAAO,IAAI,SAAS;AAAA,EACjE;AAAA,EAEO,eAAe,YAAwB,WAAmC;AACzE,WAAA,KAAK,0BAA0B,YAAY,SAAS,KAAK,KAAK,WAAW,4BAA4B,cAAc,WAAW;AAAA,EACtI;AAAA,EAEO,gBAAgB,YAAwB,WAAoC;AAClF,UAAM,QAAQ,KAAK,eAAe,YAAY,SAAS;AAChD,WAAA,MAAM,eAAe,YAAY,QAAQ,KAAK,WAAW,SAAS,cAAc,iCAAiC;AAAA,EACzH;AAAA,EAEO,kBAAkB,YAAwB,WAAsC;AACtF,UAAM,QAAQ,KAAK,eAAe,YAAY,SAAS;AAChD,WAAA,MAAM,eAAe,cAAc,QAAQ,KAAK,WAAW,SAAS,cAAc,mCAAmC;AAAA,EAC7H;AAAA,EAEQ,WAAW,SAAwB;AACpC,UAAA,IAAI,aAAa,OAAO;AAAA,EAC/B;AACD;"}
1
+ {"version":3,"file":"Schema.js","sources":["../../../../src/core/schema/Schema.ts"],"sourcesContent":["import type { EntityName, FieldName } from '../../treeParameters'\nimport { BindingError } from '../../BindingError'\nimport type { SchemaField } from './SchemaField'\nimport type { SchemaStore } from './SchemaStore'\nimport { SchemaEntity } from './SchemaEntity'\nimport { SchemaColumn } from './SchemaColumn'\nimport { SchemaRelation } from './SchemaRelation'\nimport { SchemaEnumName } from './SchemaEnums'\n\nexport class Schema {\n\tpublic constructor(private readonly store: SchemaStore) {}\n\n\tpublic getEnumValues(enumName: SchemaEnumName): string[] {\n\t\treturn Array.from(this.store.enums.get(enumName) ?? this.throwError(`Missing schema for enum ${enumName}`))\n\t}\n\n\tpublic getEntityOrUndefined(entityName: EntityName): SchemaEntity | undefined {\n\t\treturn this.store.entities.get(entityName)\n\t}\n\n\tpublic getEntityNames(): string[] {\n\t\treturn Array.from(this.store.entities.keys())\n\t}\n\n\tpublic getEntity(entityName: EntityName): SchemaEntity {\n\t\treturn this.getEntityOrUndefined(entityName) ?? this.throwError(`Missing schema for entity ${entityName}`)\n\t}\n\n\tpublic getEntityFieldOrUndefined(entityName: EntityName, fieldName: FieldName): SchemaField | undefined {\n\t\treturn this.store.entities.get(entityName)?.fields.get(fieldName)\n\t}\n\n\tpublic getEntityField(entityName: EntityName, fieldName: FieldName): SchemaField {\n\t\treturn this.getEntityFieldOrUndefined(entityName, fieldName) ?? this.throwError(`Missing schema for field ${entityName}.${fieldName}`)\n\t}\n\n\tpublic getEntityColumn(entityName: EntityName, fieldName: FieldName): SchemaColumn {\n\t\tconst field = this.getEntityField(entityName, fieldName)\n\t\treturn field.__typename === '_Column' ? field : this.throwError(`Field ${entityName}.${fieldName} is not of type column`)\n\t}\n\n\tpublic getEntityRelation(entityName: EntityName, fieldName: FieldName): SchemaRelation {\n\t\tconst field = this.getEntityField(entityName, fieldName)\n\t\treturn field.__typename === '_Relation' ? field : this.throwError(`Field ${entityName}.${fieldName} is not of type relation`)\n\t}\n\n\tprivate throwError(message: string): never {\n\t\tthrow new BindingError(message)\n\t}\n}\n"],"names":[],"mappings":";AASO,MAAM,OAAO;AAAA,EACZ,YAA6B,OAAoB;AAApB,SAAA,QAAA;AAAA,EAAqB;AAAA,EAElD,cAAc,UAAoC;AACxD,WAAO,MAAM,KAAK,KAAK,MAAM,MAAM,IAAI,QAAQ,KAAK,KAAK,WAAW,2BAA2B,QAAQ,EAAE,CAAC;AAAA,EAC3G;AAAA,EAEO,qBAAqB,YAAkD;AAC7E,WAAO,KAAK,MAAM,SAAS,IAAI,UAAU;AAAA,EAC1C;AAAA,EAEO,iBAA2B;AACjC,WAAO,MAAM,KAAK,KAAK,MAAM,SAAS,MAAM;AAAA,EAC7C;AAAA,EAEO,UAAU,YAAsC;AAC/C,WAAA,KAAK,qBAAqB,UAAU,KAAK,KAAK,WAAW,6BAA6B,UAAU,EAAE;AAAA,EAC1G;AAAA,EAEO,0BAA0B,YAAwB,WAA+C;AAChG,WAAA,KAAK,MAAM,SAAS,IAAI,UAAU,GAAG,OAAO,IAAI,SAAS;AAAA,EACjE;AAAA,EAEO,eAAe,YAAwB,WAAmC;AACzE,WAAA,KAAK,0BAA0B,YAAY,SAAS,KAAK,KAAK,WAAW,4BAA4B,UAAU,IAAI,SAAS,EAAE;AAAA,EACtI;AAAA,EAEO,gBAAgB,YAAwB,WAAoC;AAClF,UAAM,QAAQ,KAAK,eAAe,YAAY,SAAS;AAChD,WAAA,MAAM,eAAe,YAAY,QAAQ,KAAK,WAAW,SAAS,UAAU,IAAI,SAAS,wBAAwB;AAAA,EACzH;AAAA,EAEO,kBAAkB,YAAwB,WAAsC;AACtF,UAAM,QAAQ,KAAK,eAAe,YAAY,SAAS;AAChD,WAAA,MAAM,eAAe,cAAc,QAAQ,KAAK,WAAW,SAAS,UAAU,IAAI,SAAS,0BAA0B;AAAA,EAC7H;AAAA,EAEQ,WAAW,SAAwB;AACpC,UAAA,IAAI,aAAa,OAAO;AAAA,EAC/B;AACD;"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => {
5
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
+ return value;
7
+ };
8
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
9
+ const Schema = require("./Schema.cjs");
10
+ const SchemaPreprocessor = require("./SchemaPreprocessor.cjs");
11
+ class SchemaLoader {
12
+ static async loadSchema(client, options) {
13
+ const existing = this.schemaLoadCache.get(client.apiUrl);
14
+ if (existing !== void 0) {
15
+ return existing;
16
+ }
17
+ const schemaPromise = (async () => {
18
+ const raw = await client.execute(this.schemaQuery, options);
19
+ return new Schema.Schema(SchemaPreprocessor.SchemaPreprocessor.processRawSchema(raw.schema));
20
+ })();
21
+ this.schemaLoadCache.set(client.apiUrl, schemaPromise);
22
+ return await schemaPromise;
23
+ }
24
+ }
25
+ __publicField(SchemaLoader, "schemaLoadCache", /* @__PURE__ */ new Map());
26
+ __publicField(SchemaLoader, "schemaQuery", "query {\n schema {\n enums {\n name\n values\n }\n entities {\n name\n customPrimaryAllowed\n unique {\n fields\n }\n fields {\n __typename\n name\n type\n nullable\n ... on _Column {\n enumName\n defaultValue\n }\n ... on _Relation {\n side\n targetEntity\n ownedBy\n inversedBy\n onDelete\n orphanRemoval\n orderBy {\n path\n direction\n }\n }\n }\n }\n }\n}");
27
+ exports.SchemaLoader = SchemaLoader;
28
+ //# sourceMappingURL=SchemaLoader.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaLoader.cjs","sources":["../../../../src/core/schema/SchemaLoader.ts"],"sourcesContent":["import type { GraphQlClient, GraphQlClientRequestOptions } from '@contember/client'\nimport type { RawSchema } from './RawSchema'\nimport { Schema } from './Schema'\nimport { SchemaPreprocessor } from './SchemaPreprocessor'\n\nexport class SchemaLoader {\n\tprivate static readonly schemaLoadCache: Map<string, Promise<Schema>> = new Map()\n\n\tprivate static readonly schemaQuery =\n\t\t'query {\\n' +\n\t\t' schema {\\n' +\n\t\t' enums {\\n' +\n\t\t' name\\n' +\n\t\t' values\\n' +\n\t\t' }\\n' +\n\t\t' entities {\\n' +\n\t\t' name\\n' +\n\t\t' customPrimaryAllowed\\n' +\n\t\t' unique {\\n' +\n\t\t' fields\\n' +\n\t\t' }\\n' +\n\t\t' fields {\\n' +\n\t\t' __typename\\n' +\n\t\t' name\\n' +\n\t\t' type\\n' +\n\t\t' nullable\\n' +\n\t\t' ... on _Column {\\n' +\n\t\t' enumName\\n' +\n\t\t' defaultValue\\n' +\n\t\t' }\\n' +\n\t\t' ... on _Relation {\\n' +\n\t\t' side\\n' +\n\t\t' targetEntity\\n' +\n\t\t' ownedBy\\n' +\n\t\t' inversedBy\\n' +\n\t\t' onDelete\\n' +\n\t\t' orphanRemoval\\n' +\n\t\t' orderBy {\\n' +\n\t\t' path\\n' +\n\t\t' direction\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t'}'\n\n\tpublic static async loadSchema(\n\t\tclient: GraphQlClient,\n\t\toptions?: GraphQlClientRequestOptions,\n\t): Promise<Schema> {\n\n\t\tconst existing = this.schemaLoadCache.get(client.apiUrl)\n\t\tif (existing !== undefined) {\n\t\t\treturn existing\n\t\t}\n\t\tconst schemaPromise = (async () => {\n\t\t\tconst raw = await client.execute<{ schema: RawSchema }>(this.schemaQuery, options)\n\t\t\treturn new Schema(SchemaPreprocessor.processRawSchema(raw.schema))\n\t\t})()\n\t\tthis.schemaLoadCache.set(client.apiUrl, schemaPromise)\n\t\treturn await schemaPromise\n\t}\n}\n"],"names":["Schema","SchemaPreprocessor"],"mappings":";;;;;;;;;;AAKO,MAAM,aAAa;AAAA,EA0CzB,aAAoB,WACnB,QACA,SACkB;AAElB,UAAM,WAAW,KAAK,gBAAgB,IAAI,OAAO,MAAM;AACvD,QAAI,aAAa,QAAW;AACpB,aAAA;AAAA,IACR;AACA,UAAM,iBAAiB,YAAY;AAClC,YAAM,MAAM,MAAM,OAAO,QAA+B,KAAK,aAAa,OAAO;AACjF,aAAO,IAAIA,OAAO,OAAAC,mBAAA,mBAAmB,iBAAiB,IAAI,MAAM,CAAC;AAAA,IAAA;AAElE,SAAK,gBAAgB,IAAI,OAAO,QAAQ,aAAa;AACrD,WAAO,MAAM;AAAA,EACd;AACD;AAzDC,cADY,cACY,mBAAgD,oBAAI;AAE5E,cAHY,cAGY,eACvB;;"}
@@ -13,8 +13,8 @@ class SchemaLoader {
13
13
  return existing;
14
14
  }
15
15
  const schemaPromise = (async () => {
16
- const raw = await client.sendRequest(this.schemaQuery, options);
17
- return new Schema(SchemaPreprocessor.processRawSchema(raw.data.schema));
16
+ const raw = await client.execute(this.schemaQuery, options);
17
+ return new Schema(SchemaPreprocessor.processRawSchema(raw.schema));
18
18
  })();
19
19
  this.schemaLoadCache.set(client.apiUrl, schemaPromise);
20
20
  return await schemaPromise;
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaLoader.js","sources":["../../../../src/core/schema/SchemaLoader.ts"],"sourcesContent":["import type { GraphQlClient, GraphQlClientRequestOptions } from '@contember/client'\nimport type { RawSchema } from './RawSchema'\nimport { Schema } from './Schema'\nimport { SchemaPreprocessor } from './SchemaPreprocessor'\n\nexport class SchemaLoader {\n\tprivate static readonly schemaLoadCache: Map<string, Promise<Schema>> = new Map()\n\n\tprivate static readonly schemaQuery =\n\t\t'query {\\n' +\n\t\t' schema {\\n' +\n\t\t' enums {\\n' +\n\t\t' name\\n' +\n\t\t' values\\n' +\n\t\t' }\\n' +\n\t\t' entities {\\n' +\n\t\t' name\\n' +\n\t\t' customPrimaryAllowed\\n' +\n\t\t' unique {\\n' +\n\t\t' fields\\n' +\n\t\t' }\\n' +\n\t\t' fields {\\n' +\n\t\t' __typename\\n' +\n\t\t' name\\n' +\n\t\t' type\\n' +\n\t\t' nullable\\n' +\n\t\t' ... on _Column {\\n' +\n\t\t' enumName\\n' +\n\t\t' defaultValue\\n' +\n\t\t' }\\n' +\n\t\t' ... on _Relation {\\n' +\n\t\t' side\\n' +\n\t\t' targetEntity\\n' +\n\t\t' ownedBy\\n' +\n\t\t' inversedBy\\n' +\n\t\t' onDelete\\n' +\n\t\t' orphanRemoval\\n' +\n\t\t' orderBy {\\n' +\n\t\t' path\\n' +\n\t\t' direction\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t'}'\n\n\tpublic static async loadSchema(\n\t\tclient: GraphQlClient,\n\t\toptions?: GraphQlClientRequestOptions,\n\t): Promise<Schema> {\n\n\t\tconst existing = this.schemaLoadCache.get(client.apiUrl)\n\t\tif (existing !== undefined) {\n\t\t\treturn existing\n\t\t}\n\t\tconst schemaPromise = (async () => {\n\t\t\tconst raw: { data: { schema: RawSchema } } = await client.sendRequest(this.schemaQuery, options)\n\t\t\treturn new Schema(SchemaPreprocessor.processRawSchema(raw.data.schema))\n\t\t})()\n\t\tthis.schemaLoadCache.set(client.apiUrl, schemaPromise)\n\t\treturn await schemaPromise\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;AAKO,MAAM,aAAa;AAAA,EA0CzB,aAAoB,WACnB,QACA,SACkB;AAElB,UAAM,WAAW,KAAK,gBAAgB,IAAI,OAAO,MAAM;AACvD,QAAI,aAAa,QAAW;AACpB,aAAA;AAAA,IACR;AACA,UAAM,iBAAiB,YAAY;AAClC,YAAM,MAAuC,MAAM,OAAO,YAAY,KAAK,aAAa,OAAO;AAC/F,aAAO,IAAI,OAAO,mBAAmB,iBAAiB,IAAI,KAAK,MAAM,CAAC;AAAA,IAAA;AAEvE,SAAK,gBAAgB,IAAI,OAAO,QAAQ,aAAa;AACrD,WAAO,MAAM;AAAA,EACd;AACD;AAzDC,cADY,cACY,mBAAgD,oBAAI;AAE5E,cAHY,cAGY,eACvB;"}
1
+ {"version":3,"file":"SchemaLoader.js","sources":["../../../../src/core/schema/SchemaLoader.ts"],"sourcesContent":["import type { GraphQlClient, GraphQlClientRequestOptions } from '@contember/client'\nimport type { RawSchema } from './RawSchema'\nimport { Schema } from './Schema'\nimport { SchemaPreprocessor } from './SchemaPreprocessor'\n\nexport class SchemaLoader {\n\tprivate static readonly schemaLoadCache: Map<string, Promise<Schema>> = new Map()\n\n\tprivate static readonly schemaQuery =\n\t\t'query {\\n' +\n\t\t' schema {\\n' +\n\t\t' enums {\\n' +\n\t\t' name\\n' +\n\t\t' values\\n' +\n\t\t' }\\n' +\n\t\t' entities {\\n' +\n\t\t' name\\n' +\n\t\t' customPrimaryAllowed\\n' +\n\t\t' unique {\\n' +\n\t\t' fields\\n' +\n\t\t' }\\n' +\n\t\t' fields {\\n' +\n\t\t' __typename\\n' +\n\t\t' name\\n' +\n\t\t' type\\n' +\n\t\t' nullable\\n' +\n\t\t' ... on _Column {\\n' +\n\t\t' enumName\\n' +\n\t\t' defaultValue\\n' +\n\t\t' }\\n' +\n\t\t' ... on _Relation {\\n' +\n\t\t' side\\n' +\n\t\t' targetEntity\\n' +\n\t\t' ownedBy\\n' +\n\t\t' inversedBy\\n' +\n\t\t' onDelete\\n' +\n\t\t' orphanRemoval\\n' +\n\t\t' orderBy {\\n' +\n\t\t' path\\n' +\n\t\t' direction\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t'}'\n\n\tpublic static async loadSchema(\n\t\tclient: GraphQlClient,\n\t\toptions?: GraphQlClientRequestOptions,\n\t): Promise<Schema> {\n\n\t\tconst existing = this.schemaLoadCache.get(client.apiUrl)\n\t\tif (existing !== undefined) {\n\t\t\treturn existing\n\t\t}\n\t\tconst schemaPromise = (async () => {\n\t\t\tconst raw = await client.execute<{ schema: RawSchema }>(this.schemaQuery, options)\n\t\t\treturn new Schema(SchemaPreprocessor.processRawSchema(raw.schema))\n\t\t})()\n\t\tthis.schemaLoadCache.set(client.apiUrl, schemaPromise)\n\t\treturn await schemaPromise\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;AAKO,MAAM,aAAa;AAAA,EA0CzB,aAAoB,WACnB,QACA,SACkB;AAElB,UAAM,WAAW,KAAK,gBAAgB,IAAI,OAAO,MAAM;AACvD,QAAI,aAAa,QAAW;AACpB,aAAA;AAAA,IACR;AACA,UAAM,iBAAiB,YAAY;AAClC,YAAM,MAAM,MAAM,OAAO,QAA+B,KAAK,aAAa,OAAO;AACjF,aAAO,IAAI,OAAO,mBAAmB,iBAAiB,IAAI,MAAM,CAAC;AAAA,IAAA;AAElE,SAAK,gBAAgB,IAAI,OAAO,QAAQ,aAAa;AACrD,WAAO,MAAM;AAAA,EACd;AACD;AAzDC,cADY,cACY,mBAAgD,oBAAI;AAE5E,cAHY,cAGY,eACvB;"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ class SchemaPreprocessor {
4
+ static processRawSchema(rawSchema) {
5
+ return {
6
+ enums: this.processRawEnums(rawSchema.enums),
7
+ entities: this.processRawEntities(rawSchema.entities)
8
+ };
9
+ }
10
+ static processRawEnums(rawEnums) {
11
+ const enums = /* @__PURE__ */ new Map();
12
+ for (const { name, values } of rawEnums) {
13
+ enums.set(name, new Set(values));
14
+ }
15
+ return enums;
16
+ }
17
+ static processRawEntities(rawEntities) {
18
+ const entities = /* @__PURE__ */ new Map();
19
+ for (const entity of rawEntities) {
20
+ entities.set(entity.name, {
21
+ customPrimaryAllowed: entity.customPrimaryAllowed,
22
+ fields: this.processRawFields(entity.fields),
23
+ name: entity.name,
24
+ unique: entity.unique.map((it) => ({ fields: new Set(it.fields) }))
25
+ });
26
+ }
27
+ return entities;
28
+ }
29
+ static processRawFields(rawFields) {
30
+ const fields = /* @__PURE__ */ new Map();
31
+ for (const field of rawFields) {
32
+ fields.set(field.name, field);
33
+ }
34
+ return fields;
35
+ }
36
+ }
37
+ exports.SchemaPreprocessor = SchemaPreprocessor;
38
+ //# sourceMappingURL=SchemaPreprocessor.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaPreprocessor.cjs","sources":["../../../../src/core/schema/SchemaPreprocessor.ts"],"sourcesContent":["import type { RawSchema } from './RawSchema'\nimport type { RawSchemaEntity, RawSchemaFields } from './RawSchemaEntity'\nimport type { RawSchemaEnum } from './RawSchemaEnum'\nimport type { SchemaEntities } from './SchemaEntities'\nimport type { SchemaEnums } from './SchemaEnums'\nimport type { SchemaFields } from './SchemaFields'\nimport type { SchemaStore } from './SchemaStore'\n\nexport class SchemaPreprocessor {\n\tpublic static processRawSchema(rawSchema: RawSchema): SchemaStore {\n\t\treturn {\n\t\t\tenums: this.processRawEnums(rawSchema.enums),\n\t\t\tentities: this.processRawEntities(rawSchema.entities),\n\t\t}\n\t}\n\n\tprivate static processRawEnums(rawEnums: RawSchemaEnum[]): SchemaEnums {\n\t\tconst enums: SchemaEnums = new Map()\n\n\t\tfor (const { name, values } of rawEnums) {\n\t\t\tenums.set(name, new Set(values))\n\t\t}\n\n\t\treturn enums\n\t}\n\n\tprivate static processRawEntities(rawEntities: RawSchemaEntity[]): SchemaEntities {\n\t\tconst entities: SchemaEntities = new Map()\n\n\t\tfor (const entity of rawEntities) {\n\t\t\tentities.set(entity.name, {\n\t\t\t\tcustomPrimaryAllowed: entity.customPrimaryAllowed,\n\t\t\t\tfields: this.processRawFields(entity.fields),\n\t\t\t\tname: entity.name,\n\t\t\t\tunique: entity.unique.map(it => ({ fields: new Set(it.fields) })),\n\t\t\t})\n\t\t}\n\n\t\treturn entities\n\t}\n\n\tprivate static processRawFields(rawFields: RawSchemaFields): SchemaFields {\n\t\tconst fields: SchemaFields = new Map()\n\n\t\tfor (const field of rawFields) {\n\t\t\tfields.set(field.name, field)\n\t\t}\n\n\t\treturn fields\n\t}\n}\n"],"names":[],"mappings":";;AAQO,MAAM,mBAAmB;AAAA,EAC/B,OAAc,iBAAiB,WAAmC;AAC1D,WAAA;AAAA,MACN,OAAO,KAAK,gBAAgB,UAAU,KAAK;AAAA,MAC3C,UAAU,KAAK,mBAAmB,UAAU,QAAQ;AAAA,IAAA;AAAA,EAEtD;AAAA,EAEA,OAAe,gBAAgB,UAAwC;AAChE,UAAA,4BAAyB;AAE/B,eAAW,EAAE,MAAM,OAAO,KAAK,UAAU;AACxC,YAAM,IAAI,MAAM,IAAI,IAAI,MAAM,CAAC;AAAA,IAChC;AAEO,WAAA;AAAA,EACR;AAAA,EAEA,OAAe,mBAAmB,aAAgD;AAC3E,UAAA,+BAA+B;AAErC,eAAW,UAAU,aAAa;AACxB,eAAA,IAAI,OAAO,MAAM;AAAA,QACzB,sBAAsB,OAAO;AAAA,QAC7B,QAAQ,KAAK,iBAAiB,OAAO,MAAM;AAAA,QAC3C,MAAM,OAAO;AAAA,QACb,QAAQ,OAAO,OAAO,IAAI,CAAO,QAAA,EAAE,QAAQ,IAAI,IAAI,GAAG,MAAM,EAAI,EAAA;AAAA,MAAA,CAChE;AAAA,IACF;AAEO,WAAA;AAAA,EACR;AAAA,EAEA,OAAe,iBAAiB,WAA0C;AACnE,UAAA,6BAA2B;AAEjC,eAAW,SAAS,WAAW;AACvB,aAAA,IAAI,MAAM,MAAM,KAAK;AAAA,IAC7B;AAEO,WAAA;AAAA,EACR;AACD;;"}